UNPKG

ideaz-element

Version:

<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>

89 lines (88 loc) 2.8 kB
import { isVNode as E, defineComponent as y, useAttrs as g, createVNode as a, mergeProps as j } from "vue"; import { ElOption as z, ElSelect as C, ElOptionGroup as F } from "element-plus"; import "../../../utils/index.mjs"; import "../../../node_modules/.pnpm/lodash-unified@1.0.3_@types_lodash-es@4.17.12_lodash-es@4.17.21_lodash@4.17.21/node_modules/lodash-unified/import.mjs"; import "./hooks/index.mjs"; import { selectProps as M, SELECT_SLOTS as _ } from "./props.mjs"; import { useVModel as h } from "../../../hooks/useVModel.mjs"; import { useFormComponentSlots as k } from "../../../hooks/useFormComponentSlots.mjs"; import { useFormSize as x } from "../../../hooks/useFormSize.mjs"; import { useExpose as A } from "../../../hooks/useExpose.mjs"; import { useSelectMethods as L } from "./hooks/useSelectMethods.mjs"; import { useOptions as N } from "./hooks/useOptions.mjs"; import s from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs"; import { isSlot as P, isFunction as T, isArray as G } from "../../../utils/is.mjs"; function I(t) { return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !E(t); } const $ = /* @__PURE__ */ y({ name: "ZSelect", props: M, emits: ["input", "update:modelValue"], setup(t, { emit: c, slots: o }) { const { vModelVal: u } = h(t, c), { focus: f, blur: p } = L(), { scopedSlots: b } = k(t, o, _), { options: S, handleSelectInput: v } = N(t, u), O = x(), V = g(); A({ focus: f, blur: p }); const m = (e) => { var i, d, n; const l = s(e, ((i = t.alias) == null ? void 0 : i.value) || "value", ""), r = {}; return P(e.render) && o[e.render] && (r.default = () => o[e.render]({ option: e })), a(z, { key: l, label: s(e, ((d = t.alias) == null ? void 0 : d.label) || "label", ""), disabled: s(e, ((n = t.alias) == null ? void 0 : n.disabled) || "disabled", !1), value: l }, { default: () => [T(e.render) ? e.render({ option: e }) : null], ...r }); }; return () => a(C, j({ ref: "selectRef", modelValue: u.value }, { ...V, multiple: t.multiple }, { size: O.value, "onUpdate:modelValue": v }), { default: () => [S.value.map((e) => { if (G(e.options)) { let l; return a(F, { label: e.label, key: e.label, disabled: e.disabled }, I(l = e.options.map((r) => m(r))) ? l : { default: () => [l] }); } return m(e); })], ...b.value }); } }); export { $ as default }; //# sourceMappingURL=index.mjs.map