UNPKG

yanzhen-design-vue

Version:

97 lines (96 loc) 4.12 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const antDesignVue = require("ant-design-vue"); const select = require("./select.cjs"); const useSelect = require("./use-select.cjs"); const _hoisted_1 = { key: 0 }; const _hoisted_2 = ["title"]; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: select.selectName }, __name: "select", props: select.selectProps, emits: select.selectEmits, setup(__props, { expose: __expose, emit: __emit }) { const { ns } = select.selectOptions; const props = __props; const emit = __emit; const [ { selectCtx, proxyProps, showCreateOptionButton, addOptionHandler, dropdownVisibleChangeHandler, createItem, searchMatchOption } ] = useSelect.useSelect(props, emit); __expose({ ref: selectCtx }); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Select), vue.mergeProps({ ref_key: "selectCtx", ref: selectCtx, class: [vue.unref(ns).b()] }, vue.unref(proxyProps), { onDropdownVisibleChange: vue.unref(dropdownVisibleChangeHandler) }), vue.createSlots({ dropdownRender: vue.withCtx(({ menuNode: menu }) => [ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(menu))), vue.unref(showCreateOptionButton) && vue.unref(searchMatchOption) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createVNode(vue.unref(antDesignVue.Divider), { style: { "margin": "4px 0" } }), vue.createElementVNode("div", { style: { "color": "black", "padding": "5px 12px", "cursor": "pointer", "word-break": "break-all" }, onClick: _cache[2] || (_cache[2] = //@ts-ignore (...args) => vue.unref(addOptionHandler) && vue.unref(addOptionHandler)(...args)), onMousedown: _cache[3] || (_cache[3] = (e) => e.preventDefault()) }, ' 创建选项"' + vue.toDisplayString(vue.unref(createItem)) + '" ', 33) ])) : vue.createCommentVNode("", true) ]), option: vue.withCtx((item) => [ vue.createVNode(vue.unref(antDesignVue.Tooltip), { placement: "right" }, { title: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(item[props.labelKey]), 1) ]), default: vue.withCtx(() => [ _ctx.showTag ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tag), { key: 0, color: item.color }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(item[props.labelKey]), 1) ]), _: 2 }, 1032, ["color"])) : (vue.openBlock(), vue.createElementBlock("span", { key: 1, title: item[props.labelKey] }, vue.toDisplayString(item[props.labelKey]), 9, _hoisted_2)) ]), _: 2 }, 1024) ]), _: 2 }, [ vue.unref(showCreateOptionButton) ? { name: "notFoundContent", fn: vue.withCtx(() => [ vue.createElementVNode("div", { style: { "color": "black", "cursor": "pointer", "word-break": "break-all" }, onClick: _cache[0] || (_cache[0] = //@ts-ignore (...args) => vue.unref(addOptionHandler) && vue.unref(addOptionHandler)(...args)), onMousedown: _cache[1] || (_cache[1] = (e) => e.preventDefault()) }, ' 创建选项"' + vue.toDisplayString(vue.unref(createItem)) + '" ', 33) ]), key: "0" } : props.fetching ? { name: "notFoundContent", fn: vue.withCtx(() => [ vue.createVNode(vue.unref(antDesignVue.Spin), { size: "small" }) ]), key: "1" } : void 0 ]), 1040, ["class", "onDropdownVisibleChange"]); }; } }); exports.default = _sfc_main;