yanzhen-design-vue
Version:
252 lines (251 loc) • 11.6 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const antDesignVue = require("ant-design-vue");
const iconsVue = require("@ant-design/icons-vue");
const index = require("../../../list/index.cjs");
const contacts = require("../constants/contacts.cjs");
require("../item/contacts-item.vue.cjs");
require("../item/contacts-selected-icon.vue.cjs");
const useContactsList = require("./use-contacts-list.cjs");
const contactsList = require("./contacts-list.cjs");
const contactsItem_vue_vue_type_script_setup_true_lang = require("../item/contacts-item.vue2.cjs");
const contactsSelectedIcon_vue_vue_type_script_setup_true_lang = require("../item/contacts-selected-icon.vue2.cjs");
const _hoisted_1 = ["onClick"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{ name: contactsList.contactsListName },
__name: "contacts-list",
props: contactsList.contactsListProps,
emits: contactsList.contactsListEmits,
setup(__props, { emit: __emit }) {
const { ns } = contactsList.contactsListOptions;
const props = __props;
const emit = __emit;
const {
ctx: {
dataSource,
isTreeMode,
headerClass,
activeTab,
childTabs,
itemClass,
treeClass,
_childActiveTab,
_disabledIds,
_selectedIds,
selectedIconClass,
multiple,
optionKey,
listConfig
},
templates: {
DefineHeaderTemplate,
ReusableHeaderTemplate,
DefineContactsItemTemplate,
ReusableContactsItemTemplate,
DefineContactsCardItemTemplate,
ReusableContactsCardItemTemplate,
DefineTreeTemplate,
ReusableTreeTemplate,
DefineTreeItemTemplate,
ReusableTreeItemTemplate
},
handleTreeNode,
handleItemClick,
handleTreeSelect,
handleTreeExpand,
handleLoadMore
// handleUpdateChildActiveTab,
} = useContactsList.useContactsList(props, emit);
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
vue.createVNode(vue.unref(DefineContactsItemTemplate), null, {
default: vue.withCtx(({ item, onItemClick, onSuffixClick, $slots, ...itemProps }) => [
item ? (vue.openBlock(), vue.createBlock(contactsItem_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({
key: item.value
}, item, {
style: itemProps.style,
class: [
itemProps.class,
{
[vue.unref(ns).is("item-hover")]: true,
[vue.unref(ns).is("disabled")]: vue.unref(_disabledIds).includes(item.value)
}
],
type: vue.unref(activeTab),
onItemClick,
onSuffixClick
}), vue.createSlots({ _: 2 }, [
($slots == null ? void 0 : $slots.default) ? {
name: "default",
fn: vue.withCtx(() => [
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent($slots.default)))
]),
key: "0"
} : void 0,
($slots == null ? void 0 : $slots.suffix) ? {
name: "suffix",
fn: vue.withCtx(() => [
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent($slots.suffix)))
]),
key: "1"
} : void 0
]), 1040, ["style", "class", "type", "onItemClick", "onSuffixClick"])) : vue.createCommentVNode("", true)
]),
_: 1
}),
vue.createVNode(vue.unref(DefineContactsCardItemTemplate), null, {
default: vue.withCtx(({ treeNode: item, ...listItemProps }) => [
(vue.openBlock(), vue.createBlock(vue.unref(ReusableContactsItemTemplate), {
key: item == null ? void 0 : item.value,
item,
checked: item.checked,
class: vue.normalizeClass([vue.unref(itemClass), vue.unref(ns).is("list-item")]),
style: vue.normalizeStyle(listItemProps.style),
onItemClick: ($event) => vue.unref(handleItemClick)(item),
onSuffixClick: ($event) => vue.unref(handleItemClick)(item)
}, {
suffix: vue.withCtx(() => {
var _a, _b;
return [
vue.createVNode(contactsSelectedIcon_vue_vue_type_script_setup_true_lang.default, {
class: vue.normalizeClass([vue.unref(selectedIconClass)]),
multiple: vue.unref(multiple),
disabled: (_a = vue.unref(_disabledIds)) == null ? void 0 : _a.includes(item.value),
checked: (_b = vue.unref(_selectedIds)) == null ? void 0 : _b.includes(item == null ? void 0 : item.value)
}, null, 8, ["class", "multiple", "disabled", "checked"])
];
}),
_: 2
}, 1032, ["item", "checked", "class", "style", "onItemClick", "onSuffixClick"]))
]),
_: 1
}),
vue.createVNode(vue.unref(DefineTreeItemTemplate), null, {
default: vue.withCtx(({ treeNode: item }) => [
item.isCard ? (vue.openBlock(), vue.createBlock(vue.unref(ReusableContactsCardItemTemplate), {
key: 0,
"tree-node": item,
style: { "padding-left": "0", "padding-right": "0" }
}, null, 8, ["tree-node"])) : (item == null ? void 0 : item.label) ? (vue.openBlock(), vue.createElementBlock("div", {
key: 1,
onClick: vue.withModifiers(($event) => vue.unref(handleItemClick)(item), ["stop"])
}, [
vue.createElementVNode("span", null, vue.toDisplayString(item == null ? void 0 : item.label), 1),
vue.createVNode(contactsSelectedIcon_vue_vue_type_script_setup_true_lang.default, {
class: vue.normalizeClass([vue.unref(selectedIconClass)].concat([vue.unref(ns).is("tree-selected-icon")])),
multiple: vue.unref(multiple),
checked: item.checked,
disabled: item.disabled,
indeterminate: item.halfChecked
}, null, 8, ["class", "multiple", "checked", "disabled", "indeterminate"])
], 8, _hoisted_1)) : vue.createCommentVNode("", true)
]),
_: 1
}),
vue.createVNode(vue.unref(DefineTreeTemplate), null, {
default: vue.withCtx(({ height }) => [
vue.unref(dataSource) ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tree), {
key: 0,
class: vue.normalizeClass([vue.unref(treeClass), vue.unref(ns).is("tree-list")]),
style: {
height: "100%"
},
"block-node": true,
"show-icon": true,
virtual: true,
selectable: false,
multiple: vue.unref(multiple),
height,
"selected-keys": vue.unref(_selectedIds),
"checked-keys": vue.unref(_selectedIds),
checkable: true,
"tree-data": vue.unref(dataSource),
"field-names": {
children: vue.unref(optionKey).children,
title: vue.unref(optionKey).label,
key: vue.unref(optionKey).value
},
onExpand: vue.unref(handleTreeExpand),
onSelect: vue.unref(handleTreeSelect)
}, {
switcherIcon: vue.withCtx(({ switcherCls, dataRef }) => [
(dataRef == null ? void 0 : dataRef.loading) ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.LoadingOutlined), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.CaretDownOutlined), {
key: 1,
class: vue.normalizeClass(switcherCls)
}, null, 8, ["class"]))
]),
title: vue.withCtx((treeNode) => [
vue.createVNode(vue.unref(ReusableTreeItemTemplate), {
"tree-node": vue.unref(handleTreeNode)(treeNode, vue.unref(_selectedIds))
}, null, 8, ["tree-node"])
]),
_: 2
}, 1032, ["class", "multiple", "height", "selected-keys", "checked-keys", "tree-data", "field-names", "onExpand", "onSelect"])) : vue.createCommentVNode("", true)
]),
_: 1
}),
vue.createVNode(vue.unref(DefineHeaderTemplate), null, {
default: vue.withCtx(() => [
vue.createElementVNode("div", {
class: vue.normalizeClass([vue.unref(headerClass), vue.unref(ns).is("list-header")])
}, [
vue.createVNode(vue.unref(antDesignVue.Radio).Group, {
value: vue.unref(_childActiveTab),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => vue.isRef(_childActiveTab) ? _childActiveTab.value = $event : null),
"button-style": "solid",
size: "small",
onChange: vue.unref(handleLoadMore)
}, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(childTabs), (item) => {
return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Radio).Button, {
key: item.value,
value: item.value
}, {
default: vue.withCtx(() => [
vue.createTextVNode(vue.toDisplayString(item.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
]),
_: 1
}, 8, ["value", "onChange"])
], 2)
]),
_: 1
}),
vue.createVNode(vue.unref(index.YzList), vue.mergeProps({
class: [vue.unref(ns).b()],
"data-source": vue.unref(dataSource)
}, vue.unref(listConfig)), vue.createSlots({ _: 2 }, [
_ctx.$slots.header || vue.unref(activeTab) === vue.unref(contacts.Contacts).USER ? {
name: "header",
fn: vue.withCtx((headerProps) => [
_ctx.$slots.header ? vue.renderSlot(_ctx.$slots, "header", vue.normalizeProps(vue.mergeProps({ key: 0 }, headerProps))) : vue.unref(activeTab) === vue.unref(contacts.Contacts).USER ? (vue.openBlock(), vue.createBlock(vue.unref(ReusableHeaderTemplate), { key: 1 })) : vue.createCommentVNode("", true)
]),
key: "0"
} : void 0,
vue.unref(isTreeMode) ? {
name: "tree",
fn: vue.withCtx(({ height, props: treeProps }) => [
vue.createVNode(vue.unref(ReusableTreeTemplate), vue.normalizeProps(vue.guardReactiveProps({ height, props: treeProps })), null, 16)
]),
key: "1"
} : {
name: "default",
fn: vue.withCtx(({ item }) => [
item ? (vue.openBlock(), vue.createBlock(vue.unref(ReusableContactsCardItemTemplate), {
key: 0,
"tree-node": vue.unref(handleTreeNode)(item, vue.unref(_selectedIds))
}, null, 8, ["tree-node"])) : vue.createCommentVNode("", true)
]),
key: "2"
}
]), 1040, ["class", "data-source"])
], 64);
};
}
});
exports.default = _sfc_main;