@pubinfo/module-rbac 2.1.9 → 2.1.10-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import "./enum-3E_sUqRF.js";
2
- import { t as IconSelect_default } from "./IconSelect-1pVgA_5l.js";
2
+ import { t as IconSelect_default } from "./IconSelect-CiLpc63Z.js";
3
3
  export { IconSelect_default as default };
@@ -1,8 +1,7 @@
1
1
  import { h as _plugin_vue_export_helper_default } from "./index.js";
2
2
  import { r as RESOURCE_TYPE } from "./enum-3E_sUqRF.js";
3
3
  import { PubinfoIcon, getAllIconModules } from "pubinfo";
4
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, reactive, ref, renderList, renderSlot, resolveComponent, toDisplayString, unref, useModel, watch, withCtx } from "vue";
5
- import * as AntdIcons from "@ant-design/icons-vue";
4
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, reactive, ref, renderList, renderSlot, resolveComponent, shallowRef, toDisplayString, unref, useModel, watch, withCtx } from "vue";
6
5
  import { Empty } from "ant-design-vue";
7
6
  import { Button, Empty as Empty$1, FormItem, FormItemRest, Input as Input$1, InputNumber, Modal as Modal$1, Pagination as Pagination$1, RadioButton, RadioGroup, Tooltip as Tooltip$1 } from "ant-design-vue/es";
8
7
  import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-full select-none" }, _hoisted_2$2 = { class: "flex items-center gap-3" }, _hoisted_3$2 = { class: "relative inline-flex items-center" }, _hoisted_4$1 = ["disabled"], _hoisted_5$1 = ["value", "disabled"], _hoisted_6$1 = { class: "flex items-center gap-3" }, _hoisted_7$1 = { class: "relative inline-flex items-center" }, _hoisted_8$1 = ["disabled"], _hoisted_9$1 = ["value", "disabled"], _hoisted_10$1 = { class: "flex items-center gap-3" }, _hoisted_11$1 = { class: "flex items-center gap-3" }, _hoisted_12$1 = { class: "flex items-center gap-3" }, BoxColorPicker_default = /* @__PURE__ */ defineComponent({
@@ -73,15 +72,15 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
73
72
  function l(e) {
74
73
  return Math.min(100, Math.max(0, e));
75
74
  }
76
- let f = a(n.background), m = ref(f.from), h = ref(f.to), g = ref(i(n.angle)), _ = ref(o(n.radius)), v = ref(s(n.iconSize)), y = ref(null), x = ref(null);
77
- function S() {
75
+ let f = a(n.background), m = ref(f.from), h = ref(f.to), g = ref(i(n.angle)), _ = ref(o(n.radius)), v = ref(s(n.iconSize)), y = ref(null), b = ref(null);
76
+ function x() {
78
77
  if (n.disabled) return;
79
78
  let e = y.value;
80
79
  e && (e.style.width = "16px", e.style.height = "16px", e.click());
81
80
  }
82
- function C() {
81
+ function S() {
83
82
  if (n.disabled) return;
84
- let e = x.value;
83
+ let e = b.value;
85
84
  e && (e.style.width = "16px", e.style.height = "16px", e.click());
86
85
  }
87
86
  return watch([
@@ -122,7 +121,7 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
122
121
  disabled: n.disabled,
123
122
  class: normalizeClass(["w-4 h-4 rounded border border-gray-300 dark:border-gray-700", n.disabled ? "opacity-50 cursor-not-allowed" : ""]),
124
123
  style: normalizeStyle({ background: m.value }),
125
- onClick: S
124
+ onClick: x
126
125
  }, null, 14, _hoisted_4$1), createElementVNode("input", {
127
126
  ref_key: "fromColorPickerRef",
128
127
  ref: y,
@@ -151,10 +150,10 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
151
150
  disabled: n.disabled,
152
151
  class: normalizeClass(["w-4 h-4 rounded border border-gray-300 dark:border-gray-700", n.disabled ? "opacity-50 cursor-not-allowed" : ""]),
153
152
  style: normalizeStyle({ background: h.value }),
154
- onClick: C
153
+ onClick: S
155
154
  }, null, 14, _hoisted_8$1), createElementVNode("input", {
156
155
  ref_key: "toColorPickerRef",
157
- ref: x,
156
+ ref: b,
158
157
  type: "color",
159
158
  value: h.value,
160
159
  disabled: n.disabled,
@@ -256,38 +255,50 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
256
255
  "update:iconSize"
257
256
  ],
258
257
  setup(e) {
259
- let t = useModel(e, "modelValue"), l = useModel(e, "boxType"), f = useModel(e, "angle"), g = useModel(e, "background"), w = useModel(e, "radius"), T = useModel(e, "iconColor"), E = useModel(e, "iconSize"), D = ref(t.value), O = ref(l.value || "null"), k = ref(f.value ?? 65), A = ref(g.value ?? {
258
+ let t = shallowRef([]), l = ref(!1);
259
+ async function f() {
260
+ if (!(t.value.length > 0 || l.value)) {
261
+ l.value = !0;
262
+ try {
263
+ let e = await import("@ant-design/icons-vue");
264
+ t.value = Object.keys(e).filter((e) => /(?:Outlined|Filled|TwoTone)$/.test(e)).map((e) => `antd:${e}`).sort();
265
+ } finally {
266
+ l.value = !1;
267
+ }
268
+ }
269
+ }
270
+ let g = useModel(e, "modelValue"), C = useModel(e, "boxType"), w = useModel(e, "angle"), T = useModel(e, "background"), E = useModel(e, "radius"), D = useModel(e, "iconColor"), O = useModel(e, "iconSize"), k = ref(g.value), A = ref(C.value || "null"), j = ref(w.value ?? 65), M = ref(T.value ?? {
260
271
  from: "#65E54A",
261
272
  to: "#35C724"
262
- }), j = ref(w.value ?? "50%"), M = ref(E.value ?? "50%"), N = ref(T.value ?? ""), P = ref(null), F = ref(!1);
263
- function I() {
264
- D.value = t.value, O.value = l.value || "null", k.value = f.value ?? 65;
265
- let e = g.value;
266
- A.value = typeof e == "string" ? e : e ? { ...e } : {
273
+ }), N = ref(E.value ?? "50%"), P = ref(O.value ?? "50%"), F = ref(D.value ?? ""), I = ref(null), L = ref(!1);
274
+ function R() {
275
+ f(), k.value = g.value, A.value = C.value || "null", j.value = w.value ?? 65;
276
+ let e = T.value;
277
+ M.value = typeof e == "string" ? e : e ? { ...e } : {
267
278
  from: "#65E54A",
268
279
  to: "#35C724"
269
- }, j.value = w.value ?? "50%", M.value = E.value ?? "50%", N.value = T.value ?? "", F.value = !0;
280
+ }, N.value = E.value ?? "50%", P.value = O.value ?? "50%", F.value = D.value ?? "", L.value = !0;
270
281
  }
271
- function L() {
272
- F.value = !1;
282
+ function z() {
283
+ L.value = !1;
273
284
  }
274
- function R() {
275
- t.value = D.value, l.value = O.value, f.value = k.value;
276
- let e = A.value;
277
- g.value = typeof e == "string" ? e : e && { ...e }, w.value = j.value, E.value = M.value, T.value = N.value, F.value = !1;
285
+ function B() {
286
+ g.value = k.value, C.value = A.value, w.value = j.value;
287
+ let e = M.value;
288
+ T.value = typeof e == "string" ? e : e && { ...e }, E.value = N.value, O.value = P.value, D.value = F.value, L.value = !1;
278
289
  }
279
- function z(e) {
290
+ function V(e) {
280
291
  return (e.split(/[\\/]/).pop() || e).replace(/\.(svg|png|jpe?g)$/i, "");
281
292
  }
282
- let B = computed(() => {
293
+ let H = computed(() => {
283
294
  let e = /* @__PURE__ */ new Map(), t = getAllIconModules();
284
295
  for (let [n, r] of t.entries()) {
285
- let t = Object.keys(r).map(z).sort();
296
+ let t = Object.keys(r).map(V).sort();
286
297
  e.set(n, t);
287
298
  }
288
299
  return e;
289
- }), V = computed(() => Object.keys(AntdIcons).filter((e) => /(?:Outlined|Filled|TwoTone)$/.test(e)).map((e) => `antd:${e}`).sort()), H = computed(() => {
290
- let e = Array.from(B.value.keys()), t = e.includes("local"), n = e.filter((e) => e !== "local").sort();
300
+ }), U = computed(() => t.value), W = computed(() => {
301
+ let e = Array.from(H.value.keys()), t = e.includes("local"), n = e.filter((e) => e !== "local").sort();
291
302
  return [
292
303
  {
293
304
  label: "全部",
@@ -306,9 +317,9 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
306
317
  value: "antd"
307
318
  }
308
319
  ];
309
- }), U = ref("all"), W = ref(""), G = computed(() => {
320
+ }), G = ref("all"), K = ref(""), q = computed(() => {
310
321
  let e = [];
311
- for (let [t, n] of B.value.entries()) n.forEach((n) => {
322
+ for (let [t, n] of H.value.entries()) n.forEach((n) => {
312
323
  t === "local" ? e.push({
313
324
  name: n,
314
325
  module: t
@@ -317,76 +328,76 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
317
328
  module: t
318
329
  });
319
330
  });
320
- return V.value.forEach((t) => e.push({
331
+ return U.value.forEach((t) => e.push({
321
332
  name: t,
322
333
  module: "antd"
323
334
  })), e;
324
- }), K = computed(() => U.value === "all" ? G.value : U.value === "antd" ? G.value.filter((e) => e.module === "antd") : G.value.filter((e) => e.module === U.value)), q = computed(() => {
325
- let e = W.value.trim().toLowerCase();
326
- return e ? K.value.filter((t) => t.name.toLowerCase().includes(e)) : K.value;
335
+ }), J = computed(() => G.value === "all" ? q.value : G.value === "antd" ? q.value.filter((e) => e.module === "antd") : q.value.filter((e) => e.module === G.value)), Y = computed(() => {
336
+ let e = K.value.trim().toLowerCase();
337
+ return e ? J.value.filter((t) => t.name.toLowerCase().includes(e)) : J.value;
327
338
  });
328
- function J(e) {
329
- return e === "all" ? G.value.length : e === "antd" ? G.value.filter((e) => e.module === "antd").length : G.value.filter((t) => t.module === e).length;
339
+ function Qe(e) {
340
+ return e === "all" ? q.value.length : e === "antd" ? q.value.filter((e) => e.module === "antd").length : q.value.filter((t) => t.module === e).length;
330
341
  }
331
- let Y = ref(1), X = computed(() => Math.max(1, Math.ceil(q.value.length / pageSize))), Z = computed(() => {
332
- let e = (Y.value - 1) * pageSize;
333
- return q.value.slice(e, e + pageSize);
342
+ let X = ref(1), Z = computed(() => Math.max(1, Math.ceil(Y.value.length / pageSize))), $e = computed(() => {
343
+ let e = (X.value - 1) * pageSize;
344
+ return Y.value.slice(e, e + pageSize);
334
345
  });
335
- watch([W, U], () => {
336
- Y.value = 1;
337
- }), watch(q, () => {
338
- Y.value > X.value && (Y.value = X.value);
346
+ watch([K, G], () => {
347
+ X.value = 1;
348
+ }), watch(Y, () => {
349
+ X.value > Z.value && (X.value = Z.value);
339
350
  });
340
- function Q(e) {
341
- Y.value = e;
351
+ function et(e) {
352
+ X.value = e;
342
353
  }
343
- function Ze(e) {
344
- D.value = e.name;
354
+ function tt(e) {
355
+ k.value = e.name;
345
356
  }
346
- let Qe = Empty.PRESENTED_IMAGE_SIMPLE;
347
- function $e() {
348
- if (!(D.value || "").startsWith("antd:")) return;
349
- let e = P.value;
357
+ let nt = Empty.PRESENTED_IMAGE_SIMPLE;
358
+ function Q() {
359
+ if (!(k.value || "").startsWith("antd:")) return;
360
+ let e = I.value;
350
361
  e && (e.style.width = "16px", e.style.height = "16px", e.click());
351
362
  }
352
- let $ = computed(() => (D.value || "").startsWith("antd:"));
353
- return watch(O, (e, t) => {
354
- t === "null" && e !== "null" && !N.value && (N.value = "#ffffff");
355
- }), (e, r) => {
356
- let a = Tooltip$1, l = Input$1, f = Pagination$1, p = Empty$1, g = RadioButton, y = RadioGroup, b = Button, x = Modal$1, S = FormItemRest;
357
- return openBlock(), createElementBlock(Fragment, null, [renderSlot(e.$slots, "default", { open: I }, () => [createVNode(l, {
358
- value: t.value,
363
+ let $ = computed(() => (k.value || "").startsWith("antd:"));
364
+ return watch(A, (e, t) => {
365
+ t === "null" && e !== "null" && !F.value && (F.value = "#ffffff");
366
+ }), (e, t) => {
367
+ let r = Tooltip$1, a = Input$1, l = Pagination$1, f = Empty$1, p = RadioButton, _ = RadioGroup, b = Button, Ze = Modal$1, x = FormItemRest;
368
+ return openBlock(), createElementBlock(Fragment, null, [renderSlot(e.$slots, "default", { open: R }, () => [createVNode(a, {
369
+ value: g.value,
359
370
  readonly: "",
360
- onClick: I
371
+ onClick: R
361
372
  }, {
362
- addonAfter: withCtx(() => [createVNode(a, null, {
373
+ addonAfter: withCtx(() => [createVNode(r, null, {
363
374
  title: withCtx(() => [createVNode(unref(PubinfoIcon), {
364
- name: t.value || "",
375
+ name: g.value || "",
365
376
  size: "40px",
366
377
  class: "cursor-default"
367
378
  }, null, 8, ["name"])]),
368
379
  default: withCtx(() => [createVNode(unref(PubinfoIcon), {
369
- name: t.value || "",
380
+ name: g.value || "",
370
381
  size: "20px",
371
382
  class: "cursor-default"
372
383
  }, null, 8, ["name"])]),
373
384
  _: 1
374
385
  })]),
375
386
  _: 1
376
- }, 8, ["value"])], !0), createVNode(S, null, {
377
- default: withCtx(() => [createVNode(x, {
378
- open: F.value,
379
- "onUpdate:open": r[8] ||= (e) => F.value = e,
387
+ }, 8, ["value"])], !0), createVNode(x, null, {
388
+ default: withCtx(() => [createVNode(Ze, {
389
+ open: L.value,
390
+ "onUpdate:open": t[8] ||= (e) => L.value = e,
380
391
  title: "选择图标",
381
392
  width: "1200px",
382
393
  footer: null,
383
394
  "destroy-on-close": "",
384
- onCancel: L
395
+ onCancel: z
385
396
  }, {
386
397
  default: withCtx(() => [createElementVNode("div", _hoisted_1$1, [
387
- createElementVNode("div", _hoisted_2$1, [createElementVNode("div", _hoisted_3$1, [createVNode(l, {
388
- value: W.value,
389
- "onUpdate:value": r[0] ||= (e) => W.value = e,
398
+ createElementVNode("div", _hoisted_2$1, [createElementVNode("div", _hoisted_3$1, [createVNode(a, {
399
+ value: K.value,
400
+ "onUpdate:value": t[0] ||= (e) => K.value = e,
390
401
  "allow-clear": "",
391
402
  bordered: !0,
392
403
  placeholder: "搜索图标",
@@ -398,52 +409,52 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
398
409
  class: "text-[#7a869a]"
399
410
  })]),
400
411
  _: 1
401
- }, 8, ["value"])]), createElementVNode("div", _hoisted_4, [(openBlock(!0), createElementBlock(Fragment, null, renderList(H.value, (e) => (openBlock(), createElementBlock("div", {
412
+ }, 8, ["value"])]), createElementVNode("div", _hoisted_4, [(openBlock(!0), createElementBlock(Fragment, null, renderList(W.value, (e) => (openBlock(), createElementBlock("div", {
402
413
  key: e.value,
403
- class: normalizeClass(["flex items-center justify-between px-3 py-2 rounded-md cursor-pointer text-13px border border-transparent hover:bg-[#f3f6fa] dark:hover:bg-[#262c33] transition", U.value === e.value ? "bg-[#eef5ff] dark:bg-[#1e2a33] border-[#1677ff] text-[#1677ff] font-medium" : "text-[#4b5563]"]),
404
- onClick: (t) => U.value = e.value
405
- }, [createElementVNode("span", _hoisted_6, toDisplayString(e.label), 1), createElementVNode("span", _hoisted_7, toDisplayString(J(e.value)), 1)], 10, _hoisted_5))), 128))])]),
406
- createElementVNode("div", _hoisted_8, [q.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("div", _hoisted_9, [(openBlock(!0), createElementBlock(Fragment, null, renderList(Z.value, (e) => (openBlock(), createBlock(a, {
414
+ class: normalizeClass(["flex items-center justify-between px-3 py-2 rounded-md cursor-pointer text-13px border border-transparent hover:bg-[#f3f6fa] dark:hover:bg-[#262c33] transition", G.value === e.value ? "bg-[#eef5ff] dark:bg-[#1e2a33] border-[#1677ff] text-[#1677ff] font-medium" : "text-[#4b5563]"]),
415
+ onClick: (t) => G.value = e.value
416
+ }, [createElementVNode("span", _hoisted_6, toDisplayString(e.label), 1), createElementVNode("span", _hoisted_7, toDisplayString(Qe(e.value)), 1)], 10, _hoisted_5))), 128))])]),
417
+ createElementVNode("div", _hoisted_8, [Y.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("div", _hoisted_9, [(openBlock(!0), createElementBlock(Fragment, null, renderList($e.value, (e) => (openBlock(), createBlock(r, {
407
418
  key: `${e.module || ""}:${e.name}`,
408
419
  "mouse-enter-delay": .35
409
420
  }, {
410
421
  title: withCtx(() => [createElementVNode("div", _hoisted_10, [createElementVNode("div", _hoisted_11, toDisplayString(e.name), 1), e.module ? (openBlock(), createElementBlock("div", _hoisted_12, " 模块: " + toDisplayString(e.module), 1)) : createCommentVNode("", !0)])]),
411
422
  default: withCtx(() => [createElementVNode("div", {
412
- class: normalizeClass(["group relative flex flex-col items-center justify-center cursor-pointer rounded-md border", D.value === e.name ? "border-solid border-[#1677ff]" : "border-dashed border-[#e5e7eb] dark:border-[#30363d]"]),
413
- onClick: (t) => Ze(e)
423
+ class: normalizeClass(["group relative flex flex-col items-center justify-center cursor-pointer rounded-md border", k.value === e.name ? "border-solid border-[#1677ff]" : "border-dashed border-[#e5e7eb] dark:border-[#30363d]"]),
424
+ onClick: (t) => tt(e)
414
425
  }, [createVNode(unref(PubinfoIcon), {
415
426
  name: e.name,
416
427
  size: "30px"
417
428
  }, null, 8, ["name"])], 10, _hoisted_13)]),
418
429
  _: 2
419
- }, 1024))), 128))]), createElementVNode("div", _hoisted_14, [createVNode(f, {
420
- current: Y.value,
430
+ }, 1024))), 128))]), createElementVNode("div", _hoisted_14, [createVNode(l, {
431
+ current: X.value,
421
432
  "page-size": pageSize,
422
- total: q.value.length,
433
+ total: Y.value.length,
423
434
  "show-size-changer": !1,
424
435
  "show-quick-jumper": "",
425
- onChange: Q
426
- }, null, 8, ["current", "total"])])], 64)) : (openBlock(), createElementBlock("div", _hoisted_15, [createVNode(p, {
427
- image: unref(Qe),
436
+ onChange: et
437
+ }, null, 8, ["current", "total"])])], 64)) : (openBlock(), createElementBlock("div", _hoisted_15, [createVNode(f, {
438
+ image: unref(nt),
428
439
  description: "没有匹配的图标"
429
440
  }, null, 8, ["image"])]))]),
430
- D.value ? (openBlock(), createElementBlock("div", _hoisted_16, [createElementVNode("div", _hoisted_17, [
431
- createElementVNode("div", _hoisted_18, [createVNode(y, {
432
- value: O.value,
433
- "onUpdate:value": r[1] ||= (e) => O.value = e,
441
+ k.value ? (openBlock(), createElementBlock("div", _hoisted_16, [createElementVNode("div", _hoisted_17, [
442
+ createElementVNode("div", _hoisted_18, [createVNode(_, {
443
+ value: A.value,
444
+ "onUpdate:value": t[1] ||= (e) => A.value = e,
434
445
  class: "flex justify-center items-center"
435
446
  }, {
436
447
  default: withCtx(() => [
437
- createVNode(g, { value: "null" }, {
448
+ createVNode(p, { value: "null" }, {
438
449
  default: withCtx(() => [createElementVNode("div", _hoisted_19, [createVNode(unref(PubinfoIcon), {
439
- name: D.value,
450
+ name: k.value,
440
451
  size: previewBoxOuter - previewBoxPadding * 2
441
452
  }, null, 8, ["name", "size"])])]),
442
453
  _: 1
443
454
  }),
444
- createVNode(g, { value: "square" }, {
455
+ createVNode(p, { value: "square" }, {
445
456
  default: withCtx(() => [createElementVNode("div", _hoisted_20, [createVNode(unref(PubinfoIcon), {
446
- name: D.value,
457
+ name: k.value,
447
458
  box: "square",
448
459
  size: previewBoxOuter,
449
460
  radius: "25%",
@@ -451,9 +462,9 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
451
462
  }, null, 8, ["name"])])]),
452
463
  _: 1
453
464
  }),
454
- createVNode(g, { value: "prism" }, {
465
+ createVNode(p, { value: "prism" }, {
455
466
  default: withCtx(() => [createElementVNode("div", _hoisted_21, [createVNode(unref(PubinfoIcon), {
456
- name: D.value,
467
+ name: k.value,
457
468
  box: "prism",
458
469
  size: previewBoxOuter,
459
470
  color: "#ffffff",
@@ -465,16 +476,16 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
465
476
  _: 1
466
477
  }, 8, ["value"])]),
467
478
  createElementVNode("div", _hoisted_22, [
468
- createElementVNode("div", _hoisted_23, [r[9] ||= createElementVNode("div", { class: "text-12px mb-2 opacity-70" }, " 背景设置 ", -1), createVNode(BoxColorPicker_default, {
469
- angle: k.value,
470
- "onUpdate:angle": r[2] ||= (e) => k.value = e,
471
- background: A.value,
472
- "onUpdate:background": r[3] ||= (e) => A.value = e,
473
- radius: j.value,
474
- "onUpdate:radius": r[4] ||= (e) => j.value = e,
475
- "icon-size": M.value,
476
- "onUpdate:iconSize": r[5] ||= (e) => M.value = e,
477
- disabled: O.value === "null"
479
+ createElementVNode("div", _hoisted_23, [t[9] ||= createElementVNode("div", { class: "text-12px mb-2 opacity-70" }, " 背景设置 ", -1), createVNode(BoxColorPicker_default, {
480
+ angle: j.value,
481
+ "onUpdate:angle": t[2] ||= (e) => j.value = e,
482
+ background: M.value,
483
+ "onUpdate:background": t[3] ||= (e) => M.value = e,
484
+ radius: N.value,
485
+ "onUpdate:radius": t[4] ||= (e) => N.value = e,
486
+ "icon-size": P.value,
487
+ "onUpdate:iconSize": t[5] ||= (e) => P.value = e,
488
+ disabled: A.value === "null"
478
489
  }, null, 8, [
479
490
  "angle",
480
491
  "background",
@@ -482,19 +493,19 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
482
493
  "icon-size",
483
494
  "disabled"
484
495
  ])]),
485
- createElementVNode("div", _hoisted_24, [createElementVNode("div", _hoisted_25, [createElementVNode("label", _hoisted_26, [r[11] ||= createTextVNode(" 图标色 ", -1), createVNode(a, null, {
486
- title: withCtx(() => [...r[10] ||= [createTextVNode(" 仅 Ant Design 图标有效 ", -1)]]),
496
+ createElementVNode("div", _hoisted_24, [createElementVNode("div", _hoisted_25, [createElementVNode("label", _hoisted_26, [t[11] ||= createTextVNode(" 图标色 ", -1), createVNode(r, null, {
497
+ title: withCtx(() => [...t[10] ||= [createTextVNode(" 仅 Ant Design 图标有效 ", -1)]]),
487
498
  default: withCtx(() => [createVNode(unref(PubinfoIcon), {
488
499
  name: "i-carbon-information",
489
500
  size: "12px",
490
501
  class: "ml-1 cursor-help"
491
502
  })]),
492
503
  _: 1
493
- })]), createElementVNode("div", _hoisted_27, [createVNode(l, {
494
- value: N.value,
495
- "onUpdate:value": r[7] ||= (e) => N.value = e,
504
+ })]), createElementVNode("div", _hoisted_27, [createVNode(a, {
505
+ value: F.value,
506
+ "onUpdate:value": t[7] ||= (e) => F.value = e,
496
507
  "allow-clear": "",
497
- placeholder: O.value === "null" ? "默认" : "#ffffff",
508
+ placeholder: A.value === "null" ? "默认" : "#ffffff",
498
509
  size: "small",
499
510
  class: "flex-1 min-w-0",
500
511
  disabled: !$.value
@@ -503,20 +514,20 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
503
514
  type: "button",
504
515
  disabled: !$.value,
505
516
  class: normalizeClass(["w-4 h-4 rounded border border-gray-300 dark:border-gray-700", $.value ? "" : "opacity-50 cursor-not-allowed"]),
506
- style: normalizeStyle({ background: N.value || "#ffffff" }),
507
- onClick: $e
517
+ style: normalizeStyle({ background: F.value || "#ffffff" }),
518
+ onClick: Q
508
519
  }, null, 14, _hoisted_29), createElementVNode("input", {
509
520
  ref_key: "iconColorPickerRef",
510
- ref: P,
521
+ ref: I,
511
522
  type: "color",
512
- value: N.value || "#ffffff",
523
+ value: F.value || "#ffffff",
513
524
  disabled: !$.value,
514
525
  class: "absolute left-0 top-0 opacity-0 pointer-events-none",
515
526
  style: {
516
527
  width: "16px",
517
528
  height: "16px"
518
529
  },
519
- onInput: r[6] ||= (e) => N.value = e.target.value
530
+ onInput: t[6] ||= (e) => F.value = e.target.value
520
531
  }, null, 40, _hoisted_30)])]),
521
532
  _: 1
522
533
  }, 8, [
@@ -524,21 +535,21 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
524
535
  "placeholder",
525
536
  "disabled"
526
537
  ])])])]),
527
- createElementVNode("div", _hoisted_31, [createElementVNode("div", _hoisted_32, [D.value ? (openBlock(), createElementBlock("div", _hoisted_33, [O.value === "null" ? (openBlock(), createBlock(unref(PubinfoIcon), {
538
+ createElementVNode("div", _hoisted_31, [createElementVNode("div", _hoisted_32, [k.value ? (openBlock(), createElementBlock("div", _hoisted_33, [A.value === "null" ? (openBlock(), createBlock(unref(PubinfoIcon), {
528
539
  key: 0,
529
- name: D.value,
540
+ name: k.value,
530
541
  size: 80,
531
- color: $.value && N.value ? N.value : void 0
542
+ color: $.value && F.value ? F.value : void 0
532
543
  }, null, 8, ["name", "color"])) : (openBlock(), createBlock(unref(PubinfoIcon), {
533
544
  key: 1,
534
- name: D.value,
535
- box: O.value,
545
+ name: k.value,
546
+ box: A.value,
536
547
  size: 80,
537
- angle: k.value,
538
- background: A.value,
539
- radius: j.value,
540
- "icon-size": M.value,
541
- color: $.value ? N.value || "#ffffff" : void 0
548
+ angle: j.value,
549
+ background: M.value,
550
+ radius: N.value,
551
+ "icon-size": P.value,
552
+ color: $.value ? F.value || "#ffffff" : void 0
542
553
  }, null, 8, [
543
554
  "name",
544
555
  "box",
@@ -549,14 +560,14 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
549
560
  "color"
550
561
  ]))])) : createCommentVNode("", !0)])])
551
562
  ]),
552
- createElementVNode("div", _hoisted_34, [createVNode(b, { onClick: L }, {
553
- default: withCtx(() => [...r[12] ||= [createTextVNode(" 取消 ", -1)]]),
563
+ createElementVNode("div", _hoisted_34, [createVNode(b, { onClick: z }, {
564
+ default: withCtx(() => [...t[12] ||= [createTextVNode(" 取消 ", -1)]]),
554
565
  _: 1
555
566
  }), createVNode(b, {
556
567
  type: "primary",
557
- onClick: R
568
+ onClick: B
558
569
  }, {
559
- default: withCtx(() => [...r[13] ||= [createTextVNode(" 确定 ", -1)]]),
570
+ default: withCtx(() => [...t[13] ||= [createTextVNode(" 确定 ", -1)]]),
560
571
  _: 1
561
572
  })])
562
573
  ])])) : createCommentVNode("", !0)
@@ -567,7 +578,7 @@ import './IconSelect.css';var _hoisted_1$2 = { class: "flex flex-col gap-3 w-ful
567
578
  })], 64);
568
579
  };
569
580
  }
570
- }), [["__scopeId", "data-v-877afd5a"]]), _hoisted_1 = ["onClick"], _hoisted_2 = ["onClick"], _hoisted_3 = { class: "flex flex-col items-center justify-center" }, IconSelect_default = /* @__PURE__ */ defineComponent({
581
+ }), [["__scopeId", "data-v-21a5fc0d"]]), _hoisted_1 = ["onClick"], _hoisted_2 = ["onClick"], _hoisted_3 = { class: "flex flex-col items-center justify-center" }, IconSelect_default = /* @__PURE__ */ defineComponent({
571
582
  name: "ResourceIconSelect",
572
583
  __name: "IconSelect",
573
584
  props: {
@@ -1 +1 @@
1
- [data-v-877afd5a] .ant-radio-group{align-items:center;display:inline-flex}[data-v-877afd5a] .ant-radio-button-wrapper{flex:none;justify-content:center;align-items:center;padding:4px 10px;display:inline-flex;height:auto!important;line-height:1!important}[data-v-877afd5a] .ant-radio-button-wrapper>span{justify-content:center;align-items:center;display:inline-flex}
1
+ [data-v-21a5fc0d] .ant-radio-group{align-items:center;display:inline-flex}[data-v-21a5fc0d] .ant-radio-button-wrapper{flex:none;justify-content:center;align-items:center;padding:4px 10px;display:inline-flex;height:auto!important;line-height:1!important}[data-v-21a5fc0d] .ant-radio-button-wrapper>span{justify-content:center;align-items:center;display:inline-flex}
@@ -4,7 +4,7 @@ import "./enum-3mYayxff.js";
4
4
  import "./enum-3E_sUqRF.js";
5
5
  import "./DynamicRoutesForm-DP_sq_Uu.js";
6
6
  import "./HoverCard-BDFcxxvk.js";
7
- import "./IconSelect-1pVgA_5l.js";
7
+ import "./IconSelect-CiLpc63Z.js";
8
8
  import "./LayoutForm-Cp4bBrYl.js";
9
- import { t as ResourceEdit_default } from "./ResourceEdit-Dwr5KLyS.js";
9
+ import { t as ResourceEdit_default } from "./ResourceEdit-w8qh1MFO.js";
10
10
  export { ResourceEdit_default as default };
@@ -4,7 +4,7 @@ import { B as postRbacResourceResourceUpdate, F as getRbacResourceInfo, Lt as us
4
4
  import { n as DATA_PERMISSION_TYPE, r as dataPermissionOptions } from "./enum-3mYayxff.js";
5
5
  import { i as resourceOptions, n as RESOURCE_COLOR, r as RESOURCE_TYPE, t as ACTION } from "./enum-3E_sUqRF.js";
6
6
  import { t as DynamicRoutesForm_default } from "./DynamicRoutesForm-DP_sq_Uu.js";
7
- import { t as IconSelect_default } from "./IconSelect-1pVgA_5l.js";
7
+ import { t as IconSelect_default } from "./IconSelect-CiLpc63Z.js";
8
8
  import { t as LayoutForm_default } from "./LayoutForm-Cp4bBrYl.js";
9
9
  import { PartyLoginModal } from "pubinfo";
10
10
  import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, isRef, openBlock, reactive, ref, resolveComponent, toDisplayString, unref, withCtx } from "vue";
package/dist/index.js CHANGED
@@ -76,7 +76,7 @@ import './index.css';var _virtual_pubinfo_resolver_default = {
76
76
  "src/views/page_w_setting/index.vue": () => import("./page_w_setting-CD_HtSUv.js"),
77
77
  "src/views/position/index.vue": () => import("./position-CLpbgKGj.js"),
78
78
  "src/views/region/index.vue": () => import("./region-Dd9pt_Si.js"),
79
- "src/views/resource/index.vue": () => import("./resource-B-gkg5Ti.js"),
79
+ "src/views/resource/index.vue": () => import("./resource-C7dXB0EE.js"),
80
80
  "src/views/role/index.vue": () => import("./role-JGtvRObt.js"),
81
81
  "src/views/role_group/index.vue": () => import("./role_group-CKOb_m63.js"),
82
82
  "src/views/safe_setting/index.vue": () => import("./safe_setting-G_ZP-jWQ.js"),
@@ -101,11 +101,11 @@ import './index.css';var _virtual_pubinfo_resolver_default = {
101
101
  "src/views/resource/components/ComponentSelect.vue": () => import("./ComponentSelect-WO-3S5rH.js"),
102
102
  "src/views/resource/components/DynamicRoutesForm.vue": () => import("./DynamicRoutesForm-DjZ3eVLW.js"),
103
103
  "src/views/resource/components/HoverCard.vue": () => import("./HoverCard-69ZIOivd.js"),
104
- "src/views/resource/components/IconSelect.vue": () => import("./IconSelect-C5KTdyzv.js"),
104
+ "src/views/resource/components/IconSelect.vue": () => import("./IconSelect-C_Gj5G4I.js"),
105
105
  "src/views/resource/components/ImportExport.vue": () => import("./ImportExport-CPy2rvv7.js"),
106
106
  "src/views/resource/components/LayoutForm.vue": () => import("./LayoutForm-QFjwakyQ.js"),
107
107
  "src/views/resource/components/MetaForm.vue": () => import("./MetaForm-Bb-um1Zo.js"),
108
- "src/views/resource/components/ResourceEdit.vue": () => import("./ResourceEdit-BX6xdiXV.js"),
108
+ "src/views/resource/components/ResourceEdit.vue": () => import("./ResourceEdit-BTaNdwC_.js"),
109
109
  "src/views/resource/components/RoleRelation.vue": () => import("./RoleRelation-CyTcqRfZ.js"),
110
110
  "src/views/role/components/ResourceRelation.vue": () => import("./ResourceRelation-BIOzTOKA.js"),
111
111
  "src/views/role/components/drawerRole.vue": () => import("./drawerRole-BNrbcSmr.js"),
@@ -1408,7 +1408,7 @@ var _baseUniq_default = baseUniq, unionBy_default = _baseRest_default(function(t
1408
1408
  children: [
1409
1409
  {
1410
1410
  path: "resource",
1411
- component: () => import("./resource-B-gkg5Ti.js"),
1411
+ component: () => import("./resource-C7dXB0EE.js"),
1412
1412
  name: "Resource",
1413
1413
  meta: {
1414
1414
  title: "资源管理",
@@ -6,11 +6,11 @@ import "./enum-3mYayxff.js";
6
6
  import { i as resourceOptions, n as RESOURCE_COLOR, r as RESOURCE_TYPE, t as ACTION } from "./enum-3E_sUqRF.js";
7
7
  import "./DynamicRoutesForm-DP_sq_Uu.js";
8
8
  import "./HoverCard-BDFcxxvk.js";
9
- import "./IconSelect-1pVgA_5l.js";
9
+ import "./IconSelect-CiLpc63Z.js";
10
10
  import "./dayjs.min-sGDSMYRj.js";
11
11
  import { t as ImportExport_default } from "./ImportExport-CL5uPlby.js";
12
12
  import "./LayoutForm-Cp4bBrYl.js";
13
- import { t as ResourceEdit_default } from "./ResourceEdit-Dwr5KLyS.js";
13
+ import { t as ResourceEdit_default } from "./ResourceEdit-w8qh1MFO.js";
14
14
  import { t as RoleRelation_default } from "./RoleRelation-DzyVn5dk.js";
15
15
  import { PubinfoIcon, useAuth } from "pubinfo";
16
16
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, resolveDirective, toDisplayString, unref, withCtx, withDirectives } from "vue";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/module-rbac",
3
3
  "type": "module",
4
- "version": "2.1.9",
4
+ "version": "2.1.10-beta.2",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "alova": "^3.3.4",
26
26
  "ant-design-vue": "^4.2.6",
27
27
  "pinia": "^3.0.4",
28
- "pubinfo": "2.1.9"
28
+ "pubinfo": "2.1.10-beta.2"
29
29
  },
30
30
  "dependencies": {
31
31
  "@destyler/color-picker": "^0.1.0",
@@ -51,7 +51,7 @@
51
51
  "ant-design-vue": "^4.2.6",
52
52
  "pinia": "^3.0.4",
53
53
  "type-fest": "^4.41.0",
54
- "pubinfo": "2.1.9"
54
+ "pubinfo": "2.1.10-beta.2"
55
55
  },
56
56
  "scripts": {
57
57
  "dev": "pubinfo build -w --sourcemap",
@@ -1,12 +1,33 @@
1
1
  <script setup lang="ts">
2
- import * as AntdIcons from '@ant-design/icons-vue';
3
2
  import { Empty } from 'ant-design-vue';
4
3
  import { getAllIconModules, PubinfoIcon } from 'pubinfo';
5
- import { computed, ref, watch } from 'vue';
4
+ import { computed, ref, shallowRef, watch } from 'vue';
6
5
  import ResourceIconesBoxColorPicker from './BoxColorPicker.vue';
7
6
 
8
7
  defineOptions({ name: 'ResourceIconesSelect' });
9
8
 
9
+ // 懒加载 Ant Design 图标名称列表,避免全量打包
10
+ const antdIconNames = shallowRef<string[]>([]);
11
+ const antdIconsLoading = ref(false);
12
+
13
+ async function loadAntdIconNames() {
14
+ if (antdIconNames.value.length > 0 || antdIconsLoading.value) {
15
+ return;
16
+ }
17
+ antdIconsLoading.value = true;
18
+ try {
19
+ // 动态导入,仅在需要时加载
20
+ const AntdIcons = await import('@ant-design/icons-vue');
21
+ antdIconNames.value = Object.keys(AntdIcons)
22
+ .filter(n => /(?:Outlined|Filled|TwoTone)$/.test(n))
23
+ .map(n => `antd:${n}`)
24
+ .sort();
25
+ }
26
+ finally {
27
+ antdIconsLoading.value = false;
28
+ }
29
+ }
30
+
10
31
  // v-model(对外的值)
11
32
  const modelValueRef = defineModel<string>();
12
33
  // 额外样式参数的多路 v-model:边框(boxType)、角度(angle)、背景(background)、圆角(radius)、图标色(iconColor)
@@ -33,6 +54,8 @@ const iconColorPickerRef = ref<HTMLInputElement | null>(null);
33
54
  // 弹窗
34
55
  const visibleRef = ref(false);
35
56
  function handleOpenModal() {
57
+ // 打开时加载 AntD 图标名称
58
+ loadAntdIconNames();
36
59
  // 打开时同步一次外部值到临时值,避免未确认的变更影响外部
37
60
  tempValueRef.value = modelValueRef.value;
38
61
  // 同步样式参数到对话框内部状态
@@ -88,12 +111,8 @@ const moduleIconMap = computed(() => {
88
111
  return m;
89
112
  });
90
113
 
91
- // AntD 图标(带前缀 antd:)
92
- const antdIcons = computed<string[]>(() => Object.keys(AntdIcons)
93
- .filter(n => /(?:Outlined|Filled|TwoTone)$/.test(n))
94
- .map(n => `antd:${n}`)
95
- .sort(),
96
- );
114
+ // AntD 图标(带前缀 antd:)- 使用懒加载的数据
115
+ const antdIcons = computed<string[]>(() => antdIconNames.value);
97
116
 
98
117
  // 模块列表(全部 + 本地(local) 优先 + 其余模块 + Ant Design)
99
118
  const moduleOptions = computed(() => {