import { ref as f, computed as u, watch as z, resolveComponent as D, openBlock as a, createElementBlock as c, createVNode as r, withCtx as i, normalizeStyle as _, normalizeClass as h, createBlock as y, resolveDynamicComponent as g, createCommentVNode as w, createElementVNode as p, Fragment as E, renderList as L, toDisplayString as k } from "vue"; import { f as P } from "./icon-groups.js"; import { n as U, I as W, aC as M } from "./index2.js"; import { _ as j } from "./index6.js"; const q = { class: "s-icon-select-common" }, A = { class: "icon-list" }, G = ["onClick"], H = ["title"], J = { key: 0, class: "icon-empty" }, K = { __name: "SIconSelectPopover", props: { // 选中图标名,支持 v-model:value value: { type: String, default: "" }, width: { type: [Number, String], default: 280 }, placeholder: { type: String, default() { return window.$l("请选择图标"); } }, // 保留:下拉版不再需要弹窗标题,兼容旧调用方传参 title: { type: String, default() { return window.$l("图标选择"); } } }, emits: ["update:value", "change"], setup(l, { expose: x, emit: S }) { const $ = l, d = S, o = f(!1), s = f(""), m = u(() => { const e = $.width; if (typeof e == "number") return `${e}px`; const n = String(e != null ? e : "").trim(); return n ? /^-?\d+(\.\d+)?$/.test(n) ? `${n}px` : n : "280px"; }), C = u(() => { const e = parseFloat(m.value); return `${Math.max(280, Number.isFinite(e) ? e : 0)}px`; }), v = u(() => P("all", s.value)); z(o, (e) => { e || (s.value = ""); }); const I = () => { o.value = !0; }, b = (e) => { d("update:value", e), d("change", e), o.value = !1; }; return x({ open: I }), (e, n) => { const N = M, B = D("down-outlined"), F = W, V = j; return a(), c("div", q, [ r(V, { trigger: "click", placement: "bottomLeft", open: o.value, "onUpdate:open": n[1] || (n[1] = (t) => o.value = t) }, { content: i(() => [ p("div", { class: "picker-panel", style: _({ width: C.value }) }, [ r(N, { value: s.value, "onUpdate:value": n[0] || (n[0] = (t) => s.value = t), class: "icon-search", placeholder: e.$l("搜索图标"), "allow-clear": "" }, null, 8, ["value", "placeholder"]), p("div", A, [ (a(!0), c(E, null, L(v.value, (t) => (a(), c("div", { key: t, class: h(["item-icon", { active: t === l.value }]), onClick: (O) => b(t) }, [ (a(), y(g(t), { class: "icon" })), p("div", { class: "name", title: t }, k(t), 9, H) ], 10, G))), 128)), v.value.length ? w("", !0) : (a(), c("div", J, k(e.$l("暂无数据")), 1)) ]) ], 4) ]), default: i(() => [ r(F, { class: "icon-input", readonly: !0, value: l.value, placeholder: l.placeholder, style: _({ width: m.value }) }, { prefix: i(() => [ l.value ? (a(), y(g(l.value), { key: 0, class: "prefix-icon" })) : w("", !0) ]), suffix: i(() => [ r(B, { class: h(["select-arrow", { open: o.value }]) }, null, 8, ["class"]) ]), _: 1 }, 8, ["value", "placeholder", "style"]) ]), _: 1 }, 8, ["open"]) ]); }; } }, Y = /* @__PURE__ */ U(K, [["__scopeId", "data-v-854f2576"]]); export { Y as default };