| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { ref as m, computed as x, resolveComponent as N, openBlock as a, createElementBlock as c, createVNode as i, normalizeStyle as $, withCtx as p, createBlock as f, resolveDynamicComponent as w, createCommentVNode as T, createElementVNode as r, Fragment as b, renderList as B, normalizeClass as L, toDisplayString as V } from "vue";
- import { n as z, ap as D, I as E, aq as F } from "./index2.js";
- const U = { class: "s-icon-select-common" }, j = { class: "icon-search" }, q = { class: "icon-list" }, H = ["onClick"], O = { class: "name" }, A = {
- __name: "SIconSelect",
- props: {
- // 选中图标名,支持 v-model:value
- value: {
- type: String,
- default: ""
- },
- width: {
- type: [Number, String],
- default: 300
- },
- placeholder: {
- type: String,
- default() {
- return window.$l("请选择图标");
- }
- },
- title: {
- type: String,
- default() {
- return window.$l("图标选择");
- }
- }
- },
- emits: ["update:value", "change"],
- setup(e, { expose: h, emit: y }) {
- const u = y, C = ["createFromIconfontCN", "default", "getTwoToneColor", "setTwoToneColor"], d = Object.keys(D).filter((l) => !C.includes(l)), o = m(!1), s = m(""), k = x(() => {
- const l = s.value.trim().toLowerCase();
- return l ? d.filter((n) => n.toLowerCase().includes(l)) : d;
- }), v = () => {
- o.value = !0;
- }, _ = (l) => {
- u("update:value", l), u("change", l), o.value = !1;
- };
- return h({ open: v }), (l, n) => {
- const g = E, S = F, I = N("s-modal");
- return a(), c("div", U, [
- i(g, {
- readonly: !0,
- value: e.value,
- placeholder: e.placeholder,
- style: $({ width: e.width.includes("px") || e.width.includes("%") ? e.width : e.width + "px" }),
- onClick: v
- }, {
- prefix: p(() => [
- e.value ? (a(), f(w(e.value), {
- key: 0,
- class: "prefix-icon"
- })) : T("", !0)
- ]),
- _: 1
- }, 8, ["value", "placeholder", "style"]),
- i(I, {
- value: o.value,
- "onUpdate:value": n[1] || (n[1] = (t) => o.value = t),
- title: e.title,
- width: 900,
- onHandCancel: n[2] || (n[2] = (t) => o.value = !1)
- }, {
- default: p(() => [
- r("div", j, [
- i(S, {
- value: s.value,
- "onUpdate:value": n[0] || (n[0] = (t) => s.value = t),
- placeholder: l.$l("搜索图标"),
- "allow-clear": ""
- }, null, 8, ["value", "placeholder"])
- ]),
- r("div", q, [
- (a(!0), c(b, null, B(k.value, (t) => (a(), c("div", {
- key: t,
- class: L(["item-icon", { active: t === e.value }]),
- onClick: (G) => _(t)
- }, [
- (a(), f(w(t), { class: "icon" })),
- r("div", O, V(t), 1)
- ], 10, H))), 128))
- ])
- ]),
- _: 1
- }, 8, ["value", "title"])
- ]);
- };
- }
- }, M = /* @__PURE__ */ z(A, [["__scopeId", "data-v-39f10f6c"]]);
- export {
- M as default
- };
|