SIconSelect.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { useAttrs as y, resolveComponent as S, openBlock as o, createBlock as c, mergeProps as _, unref as s, withCtx as d, createElementBlock as v, Fragment as w, renderList as B, createVNode as b, createElementVNode as x, toDisplayString as C } from "vue";
  2. import { f as k } from "./icon-groups.js";
  3. import { a7 as L, a8 as N } from "./index2.js";
  4. const W = { style: { "margin-left": "8px" } }, O = {
  5. __name: "SIconSelect",
  6. props: {
  7. // 选中图标名,支持 v-model:value
  8. value: {
  9. type: String,
  10. default: ""
  11. },
  12. placeholder: {
  13. type: String,
  14. default() {
  15. return window.$l("请选择图标");
  16. }
  17. },
  18. multiple: {
  19. type: Boolean,
  20. default: !1
  21. },
  22. disabled: {
  23. type: Boolean,
  24. default: !1
  25. },
  26. required: {
  27. type: Boolean,
  28. default: !1
  29. },
  30. minWidth: {
  31. type: Number,
  32. default: 240
  33. }
  34. },
  35. emits: ["update:value", "change"],
  36. setup(t, { emit: i }) {
  37. const u = y(), r = i, m = (e) => {
  38. r("update:value", e), r("change", e);
  39. }, f = k("all", ""), p = (e, l) => {
  40. var a;
  41. return String((a = l == null ? void 0 : l.value) != null ? a : "").toLowerCase().includes(String(e != null ? e : "").trim().toLowerCase());
  42. };
  43. return (e, l) => {
  44. const a = S("s-icon"), h = N, g = L;
  45. return o(), c(g, _({
  46. value: t.value,
  47. disabled: t.disabled,
  48. mode: t.multiple ? "multiple" : void 0,
  49. "allow-clear": !t.required,
  50. placeholder: t.placeholder,
  51. "show-search": "",
  52. "filter-option": p,
  53. onChange: m
  54. }, s(u), {
  55. style: { minWidth: t.minWidth + "px" }
  56. }), {
  57. default: d(() => [
  58. (o(!0), v(w, null, B(s(f), (n) => (o(), c(h, {
  59. value: n,
  60. key: n
  61. }, {
  62. default: d(() => [
  63. b(a, {
  64. name: n,
  65. color: ""
  66. }, null, 8, ["name"]),
  67. x("span", W, C(n), 1)
  68. ]),
  69. _: 2
  70. }, 1032, ["value"]))), 128))
  71. ]),
  72. _: 1
  73. }, 16, ["value", "disabled", "mode", "allow-clear", "placeholder", "style"]);
  74. };
  75. }
  76. };
  77. export {
  78. O as default
  79. };