UNPKG

lwx-test-ui

Version:

lwx-test-ui

137 lines (136 loc) 4.36 kB
import { defineComponent as U, ref as m, computed as V, resolveComponent as u, createElementBlock as k, openBlock as n, Fragment as C, createVNode as c, withCtx as t, createElementVNode as d, createBlock as r, createCommentVNode as j, resolveDynamicComponent as g, unref as D, renderList as I, toDisplayString as K, createTextVNode as b } from "vue"; import * as O from "@element-plus/icons-vue"; import { Search as z } from "@element-plus/icons-vue"; const F = { style: { "margin-bottom": "5px" } }, P = { style: { "font-size": "11px", "overflow-wrap": "anywhere", "text-align": "center" } }, T = { class: "dialog-footer" }, H = /* @__PURE__ */ U({ name: "LwxSelectIcon", __name: "select-icon", props: { modelValue: { type: [String], default: "" } }, emits: ["update:modelValue"], setup(x, { emit: w }) { const L = x, N = w, s = m([]); for (const [l] of Object.entries(O)) s.value.push(l); const i = V({ get() { return L.modelValue; }, set(l) { N("update:modelValue", l); } }), a = m(!1); function h(l) { l(); } function S(l) { i.value = l, a.value = !1; } const p = m(""), f = V(() => { if (!p.value) return s.value; const l = []; for (const e in s.value) s.value[e].toLowerCase().includes(p.value.toLowerCase()) && l.push(s.value[e]); return l; }); return (l, e) => { const v = u("el-icon"), _ = u("el-input"), $ = u("el-scrollbar"), B = u("el-empty"), y = u("el-button"), E = u("el-dialog"); return n(), k(C, null, [ c(_, { modelValue: i.value, "onUpdate:modelValue": e[1] || (e[1] = (o) => i.value = o), readonly: "" }, { prepend: t(() => [ i.value ? (n(), r(v, { key: 0 }, { default: t(() => [ (n(), r(g(i.value))) ]), _: 1 })) : j("", !0) ]), append: t(() => [ d("span", { style: { cursor: "pointer" }, onClick: e[0] || (e[0] = (o) => a.value = !0) }, "选择") ]), _: 1 }, 8, ["modelValue"]), c(E, { modelValue: a.value, "onUpdate:modelValue": e[5] || (e[5] = (o) => a.value = o), title: "请选择图标", draggable: "", width: "50%", "before-close": h }, { footer: t(() => [ d("div", T, [ c(y, { onClick: e[3] || (e[3] = (o) => a.value = !1) }, { default: t(() => [ b(" Cancel ") ]), _: 1 }), c(y, { type: "primary", onClick: e[4] || (e[4] = (o) => a.value = !1) }, { default: t(() => [ b(" Confirm ") ]), _: 1 }) ]) ]), default: t(() => [ d("div", null, [ d("div", F, [ c(_, { modelValue: p.value, "onUpdate:modelValue": e[2] || (e[2] = (o) => p.value = o), placeholder: "请输入图标名称", clearable: "", "prefix-icon": D(z) }, null, 8, ["modelValue", "prefix-icon"]) ]), Object.keys(f.value).length ? (n(), r($, { key: 0, height: "40vh" }, { default: t(() => [ (n(!0), k(C, null, I(f.value, (o) => (n(), r(v, { key: o, class: "my-icon", onClick: (q) => S(o) }, { default: t(() => [ (n(), r(g(o))), d("span", P, K(o), 1) ]), _: 2 }, 1032, ["onClick"]))), 128)) ]), _: 1 })) : (n(), r(B, { key: 1, description: "未搜索到您要找的图标" })) ]) ]), _: 1 }, 8, ["modelValue"]) ], 64); }; } }); export { H as default };