UNPKG

yanzhen-design-vue

Version:

242 lines (241 loc) 12.5 kB
"use strict"; 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("../../avatar/index.cjs"); const utilsVue = require("@yanzhen-libs/utils-vue"); require("./contacts.vue.cjs"); const contactsSelect = require("./contacts-select.cjs"); const useContactsSelect = require("./use-contacts-select.cjs"); const contacts_vue_vue_type_script_setup_true_lang = require("./contacts.vue2.cjs"); const _hoisted_1 = ["src"]; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: contactsSelect.contactsSelectName }, __name: "contacts-select", props: contactsSelect.contactsSelectProps, emits: contactsSelect.contactsSelectEmits, setup(__props, { expose: __expose, emit: __emit }) { const { ns } = contactsSelect.contactsSelectOptions; const props = __props; const emit = __emit; const $attrs = vue.useAttrs(); const { refs: { contactsRef }, ctx: { _open, modalProps, contactsProps, selectProps, listType, selectedValue, selectedData }, methods, handleDelete, handleOpen, handleConfirm, handleCancel, handleContactsChange, handleOverageText } = useContactsSelect.useContactsSelect(props, emit); __expose({ ...methods }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ vue.createVNode(vue.unref(antDesignVue.Modal), vue.mergeProps({ open: vue.unref(_open), "onUpdate:open": _cache[1] || (_cache[1] = ($event) => vue.isRef(_open) ? _open.value = $event : null), "wrap-class-name": [vue.unref(ns).b(), vue.unref(ns).b("modal-wrap")], class: [vue.unref(ns).e("modal")], width: "", centered: "" }, vue.unref(modalProps), { "force-render": true, "destroy-on-close": true, onOk: vue.unref(handleConfirm), onCancel: vue.unref(handleCancel), onClose: vue.unref(handleCancel) }), { title: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "title", {}, () => [ vue.createTextVNode(vue.toDisplayString(vue.unref(modalProps).title), 1) ]) ]), default: vue.withCtx(() => [ vue.createVNode(contacts_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({ ref_key: "contactsRef", ref: contactsRef, "selected-value": vue.unref(selectedValue), "onUpdate:selectedValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(selectedValue) ? selectedValue.value = $event : null) }, vue.unref(contactsProps), { onChange: vue.unref(handleContactsChange) }), { "all-select": vue.withCtx(({ state, onTrigger }) => [ state.show ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Checkbox), { key: 0, class: vue.normalizeClass([vue.unref(ns).e("all-select")]), checked: state.checked, indeterminate: state.indeterminate, onChange: ($event) => onTrigger(state) }, { default: vue.withCtx(() => _cache[3] || (_cache[3] = [ vue.createTextVNode(" 全选 ") ])), _: 2 }, 1032, ["class", "checked", "indeterminate", "onChange"])) : vue.createCommentVNode("", true) ]), _: 1 }, 16, ["selected-value", "onChange"]) ]), _: 3 }, 16, ["open", "wrap-class-name", "class", "onOk", "onCancel", "onClose"]), vue.unref(listType) !== false ? (vue.openBlock(), vue.createBlock(vue.unref(utilsVue.SlotEvents), { key: 0, onClick: vue.withModifiers(vue.unref(handleOpen), ["stop"]) }, { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", { selectedValue: vue.unref(selectedValue) }, () => [ vue.unref(listType).includes("avatar") ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Flex), { key: 0, vertical: false, align: "center", gap: 4, class: vue.normalizeClass([vue.unref(ns).e("input-wrap"), vue.unref($attrs).class]), style: vue.normalizeStyle(vue.unref($attrs).style) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(antDesignVue.Avatar).Group, { "max-count": vue.unref(selectProps).maxCount, onClick: vue.withModifiers(vue.unref(handleOpen), ["stop"]) }, { default: vue.withCtx(() => [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(selectedValue), (item) => { return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tooltip), { key: item.value, title: item.label, placement: "top" }, { default: vue.withCtx(() => [ vue.createElementVNode("span", null, [ vue.createVNode(vue.unref(index.YzAvatar), { gap: 0, size: 30, src: item.avatar, text: item.label, style: { marginRight: "10px" } }, { icon: vue.withCtx(() => [ vue.createVNode(vue.unref(iconsVue.UserOutlined)) ]), _: 2 }, 1032, ["src", "text"]) ]) ]), _: 2 }, 1032, ["title"]); }), 128)) ]), _: 1 }, 8, ["max-count", "onClick"]), vue.createVNode(vue.unref(index.YzAvatar), { gap: 0, size: 30, onClick: vue.withModifiers(vue.unref(handleOpen), ["stop"]) }, { icon: vue.withCtx(() => [ vue.createVNode(vue.unref(iconsVue.UserOutlined)) ]), _: 1 }, 8, ["onClick"]) ]), _: 1 }, 8, ["class", "style"])) : vue.unref(listType).includes("input") ? (vue.openBlock(), vue.createElementBlock("div", { key: 1, class: vue.normalizeClass([vue.unref(ns).e("input-wrap"), vue.unref(ns).is("input"), vue.unref($attrs).class]), style: vue.normalizeStyle(vue.unref($attrs).style) }, [ vue.unref(selectedValue).length === 0 ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Input), { key: 0, readonly: "", placeholder: vue.unref(selectProps).placeholder }, null, 8, ["placeholder"])) : (vue.openBlock(), vue.createElementBlock("div", { key: 1, class: vue.normalizeClass(vue.unref(ns).is("select-wrap")) }, [ vue.createVNode(vue.unref(antDesignVue.Flex), { vertical: false, align: "center", gap: 4 }, { default: vue.withCtx(() => [ vue.unref(selectProps).multiple ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(selectedData).values, (item, index2) => { return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tag), { key: item.value, closable: "", class: vue.normalizeClass(vue.unref(ns).is("select-tag")), onClose: vue.withModifiers(($event) => vue.unref(handleDelete)(item, index2), ["prevent"]) }, { default: vue.withCtx(() => [ item.flag === "PRIMARY" && vue.unref(selectProps).primaryIcon ? (vue.openBlock(), vue.createElementBlock("img", { key: 0, class: vue.normalizeClass(vue.unref(ns).is("select-tag-primary-icon")), src: vue.unref(selectProps).primaryIcon, alt: "" }, null, 10, _hoisted_1)) : vue.createCommentVNode("", true), vue.createVNode(vue.unref(antDesignVue.Tooltip), { title: item.label }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(item.label), 1) ]), _: 2 }, 1032, ["title"]) ]), _: 2 }, 1032, ["class", "onClose"]); }), 128)), vue.unref(selectedData).overage.length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tooltip), { key: 0, title: vue.unref(handleOverageText)(vue.unref(selectedData).overage) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(antDesignVue.Tag), { class: vue.normalizeClass(vue.unref(ns).is("select-tag")) }, { default: vue.withCtx(() => [ vue.createTextVNode("+" + vue.toDisplayString(vue.unref(selectedData).overage.length), 1) ]), _: 1 }, 8, ["class"]) ]), _: 1 }, 8, ["title"])) : vue.createCommentVNode("", true) ], 64)) : vue.unref(selectedValue).length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tooltip), { key: 1, title: vue.unref(handleOverageText)(vue.unref(selectedValue)) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(antDesignVue.Tag), { bordered: false, class: vue.normalizeClass([vue.unref(ns).is("select-tag"), vue.unref(ns).is("no-multiple")]) }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(vue.unref(handleOverageText)(vue.unref(selectedValue))), 1) ]), _: 1 }, 8, ["class"]) ]), _: 1 }, 8, ["title"])) : vue.createCommentVNode("", true) ]), _: 1 }) ], 2)), vue.unref(selectProps).autoClear && vue.unref(selectedValue).length > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.CloseCircleOutlined), { key: 2, class: vue.normalizeClass(vue.unref(ns).is("select-close")), onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(handleDelete)(), ["stop", "prevent"])) }, null, 8, ["class"])) : vue.createCommentVNode("", true) ], 6)) : vue.createCommentVNode("", true) ]) ]), _: 3 }, 8, ["onClick"])) : vue.createCommentVNode("", true) ], 64); }; } }); exports.default = _sfc_main;