@guodun/antdv 1.4.4 → 1.4.5

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.
Files changed (93) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +85 -85
  2. package/dist/es/components/dept-selector/src/dept.mjs +170 -142
  3. package/dist/es/components/index.mjs +1 -0
  4. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  5. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +372 -185
  6. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +59 -42
  7. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +218 -85
  8. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.mjs +5 -0
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +97 -0
  10. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +914 -853
  11. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +550 -245
  12. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +214 -139
  13. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +53 -35
  14. package/dist/es/components/pro-contract-template-designer/src/types.mjs +15 -2
  15. package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +91 -0
  16. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -65
  17. package/dist/es/components/pro-contract-template-designer/src/utils/template-tool-icons.mjs +23 -16
  18. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  19. package/dist/es/components/pro-selector/src/components/org-tree.mjs +130 -89
  20. package/dist/es/components/pro-selector/src/components/user.mjs +34 -26
  21. package/dist/es/components/pro-selector/src/pro-user.mjs +86 -72
  22. package/dist/es/components/pro-selector/src/types.mjs +4 -1
  23. package/dist/es/components/pro-selector/src/utils/orgTree.mjs +5 -2
  24. package/dist/es/components/pro-selector-group/src/compoents/dept-tree.vue.mjs +92 -65
  25. package/dist/es/components/pro-selector-group/src/compoents/dept.vue.mjs +3 -3
  26. package/dist/es/components/pro-selector-group/src/compoents/role.vue.mjs +98 -73
  27. package/dist/es/components/pro-selector-group/src/compoents/select-box.vue.mjs +12 -9
  28. package/dist/es/components/pro-selector-group/src/compoents/user.vue.mjs +101 -72
  29. package/dist/es/components/pro-selector-group/src/hooks/useApi.mjs +39 -22
  30. package/dist/es/components/pro-selector-group/src/index.vue.mjs +105 -83
  31. package/dist/es/components/pro-selector-group/src/utils/index.mjs +36 -0
  32. package/dist/es/components/role-selector/src/role.mjs +134 -120
  33. package/dist/es/index.mjs +50 -49
  34. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  35. package/dist/lib/components/dept-selector/src/dept.cjs +1 -1
  36. package/dist/lib/components/index.cjs +1 -1
  37. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  38. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +2 -1
  39. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
  40. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.cjs +1 -0
  42. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -0
  43. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  44. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  45. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  46. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  47. package/dist/lib/components/pro-contract-template-designer/src/types.cjs +1 -1
  48. package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -0
  49. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  50. package/dist/lib/components/pro-contract-template-designer/src/utils/template-tool-icons.cjs +1 -1
  51. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  52. package/dist/lib/components/pro-selector/src/components/org-tree.cjs +1 -1
  53. package/dist/lib/components/pro-selector/src/components/user.cjs +1 -1
  54. package/dist/lib/components/pro-selector/src/pro-user.cjs +1 -1
  55. package/dist/lib/components/pro-selector/src/types.cjs +1 -1
  56. package/dist/lib/components/pro-selector/src/utils/orgTree.cjs +1 -1
  57. package/dist/lib/components/pro-selector-group/src/compoents/dept-tree.vue.cjs +1 -1
  58. package/dist/lib/components/pro-selector-group/src/compoents/dept.vue.cjs +1 -1
  59. package/dist/lib/components/pro-selector-group/src/compoents/role.vue.cjs +1 -1
  60. package/dist/lib/components/pro-selector-group/src/compoents/select-box.vue.cjs +1 -1
  61. package/dist/lib/components/pro-selector-group/src/compoents/user.vue.cjs +1 -1
  62. package/dist/lib/components/pro-selector-group/src/hooks/useApi.cjs +1 -1
  63. package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
  64. package/dist/lib/components/pro-selector-group/src/utils/index.cjs +1 -0
  65. package/dist/lib/components/role-selector/src/role.cjs +1 -1
  66. package/dist/lib/index.cjs +1 -1
  67. package/dist/theme/dept-selector.css +1 -1
  68. package/dist/theme/icon.css +1 -1
  69. package/dist/theme/index.css +1 -1
  70. package/dist/theme/pro-selector-group.css +1 -1
  71. package/dist/theme/pro-selector.css +1 -1
  72. package/dist/theme/role-selector.css +1 -1
  73. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -3
  74. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  75. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +1 -0
  76. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +3 -0
  77. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.d.ts +7 -1
  78. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.d.ts +14 -0
  79. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +13 -1
  80. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +11 -1
  81. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +4 -0
  82. package/dist/types/components/pro-contract-template-designer/src/extensions/template-variable.d.ts +11 -1
  83. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +131 -2
  84. package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +15 -0
  85. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +10 -2
  86. package/dist/types/components/pro-selector/index.d.ts +9 -0
  87. package/dist/types/components/pro-selector/src/components/user.d.ts +9 -0
  88. package/dist/types/components/pro-selector/src/types.d.ts +2 -0
  89. package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +4 -1
  90. package/dist/types/components/pro-selector-group/src/compoents/select-box.vue.d.ts +4 -4
  91. package/dist/types/components/pro-selector-group/src/hooks/useApi.d.ts +6 -1
  92. package/dist/types/components/pro-selector-group/src/utils/index.d.ts +8 -0
  93. package/package.json +3 -1
@@ -1,17 +1,18 @@
1
1
  import { useNamespace as e } from "../../../hooks/use-namespace/index.mjs";
2
- import t from "../../pro-modal/index.mjs";
3
- import { selectContextKey as n } from "./types.mjs";
4
- import r from "./compoents/dept.mjs";
5
- import i from "./compoents/role.mjs";
6
- import a from "./compoents/user.mjs";
7
- import o from "./compoents/select-box.mjs";
8
- import s from "../../pro-dynamic-tags/index.mjs";
9
- import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createVNode as m, defineComponent as h, mergeModels as g, nextTick as _, normalizeClass as v, normalizeStyle as y, openBlock as b, provide as x, ref as S, renderList as C, resolveDynamicComponent as w, unref as T, useModel as E, watch as D, watchEffect as O, withCtx as k } from "vue";
10
- import { TabPane as A, Tabs as j } from "ant-design-vue";
2
+ import t from "../../pro-modal/src/ProModal.mjs";
3
+ import n from "../../pro-dynamic-tags/src/index.mjs";
4
+ import { selectContextKey as r } from "./types.mjs";
5
+ import i from "./compoents/dept.mjs";
6
+ import a from "./compoents/role.mjs";
7
+ import o from "./compoents/user.mjs";
8
+ import s from "./compoents/select-box.mjs";
9
+ import { normalizeSelectorOptions as c, removeSelectorOption as l, replaceSelectorOptionsForType as u } from "./utils/index.mjs";
10
+ import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createVNode as _, defineComponent as v, mergeModels as y, nextTick as b, normalizeClass as x, normalizeStyle as S, openBlock as C, provide as w, ref as T, renderList as E, resolveDynamicComponent as D, unref as O, useModel as k, watch as A, withCtx as j } from "vue";
11
+ import { TabPane as M, Tabs as N } from "ant-design-vue";
11
12
  //#region src/components/pro-selector-group/src/index.vue?vue&type=script&setup=true&lang.ts
12
- var M = { key: 0 }, N = /* @__PURE__ */ h({
13
+ var P = { key: 0 }, F = /* @__PURE__ */ v({
13
14
  __name: "index",
14
- props: /* @__PURE__ */ g({
15
+ props: /* @__PURE__ */ y({
15
16
  title: { default: "选择器" },
16
17
  http: {},
17
18
  urlPrefix: {},
@@ -37,121 +38,142 @@ var M = { key: 0 }, N = /* @__PURE__ */ h({
37
38
  },
38
39
  visibleModifiers: {}
39
40
  }),
40
- emits: /* @__PURE__ */ g(["confirm", "changeTab"], ["update:modelValue", "update:visible"]),
41
- setup(h, { emit: g }) {
42
- let N = h, P = g, F = [
41
+ emits: /* @__PURE__ */ y(["confirm", "changeTab"], ["update:modelValue", "update:visible"]),
42
+ setup(v, { emit: y }) {
43
+ let F = v, I = y, L = [
43
44
  {
44
45
  key: "dept",
45
46
  tab: "部门",
46
- component: r
47
+ component: i
47
48
  },
48
49
  {
49
50
  key: "role",
50
51
  tab: "角色",
51
- component: i
52
+ component: a
52
53
  },
53
54
  {
54
55
  key: "user",
55
56
  tab: "用户",
56
- component: a
57
+ component: o
57
58
  }
58
- ], I = E(h, "modelValue"), L = E(h, "visible"), R = S([]), z = S(N.type || "dept"), B = S({}), V = l(() => I.value.map((e) => ({
59
+ ], R = k(v, "modelValue"), z = k(v, "visible"), B = T([]), V = T(F.type || "dept"), H = T({}), U = f(() => R.value.map((e) => ({
59
60
  label: e.label || "",
60
61
  value: e.value,
61
62
  type: e.type
62
- }))), H = l(() => R.value.length === 0 ? F : N.isSingle ? F.filter((e) => R.value.some((t) => t.type === e.key)) : F);
63
- O(async () => {
64
- L.value && I.value.length > 0 && (await _(), Y(I.value));
65
- }), D(() => N.type, (e) => {
66
- e && (z.value = e);
67
- });
68
- function U(e) {
69
- R.value = e;
63
+ }))), W = f(() => F.isSingle ? L.filter((e) => e.key === F.type) : L);
64
+ A(() => F.type, (e) => {
65
+ e && (V.value = e);
66
+ }), A(z, async (e) => {
67
+ if (!e) {
68
+ B.value = c(R.value);
69
+ return;
70
+ }
71
+ B.value = c(R.value), await Q();
72
+ }, { immediate: !0 }), A(() => R.value, async (e) => {
73
+ z.value || (B.value = c(e)), z.value && await Q();
74
+ }, { deep: !0 });
75
+ async function G() {
76
+ await b();
77
+ let e = H.value[V.value];
78
+ e && typeof e.echo == "function" && e.echo(B.value.filter((e) => e.type === V.value));
79
+ }
80
+ function K(e) {
81
+ let t = V.value;
82
+ B.value = F.isSingle ? c(e).map((e) => ({
83
+ ...e,
84
+ type: t
85
+ })) : u(B.value, t, e);
70
86
  }
71
- x(n, {
72
- http: N.http,
73
- urlPrefix: N.urlPrefix || "",
74
- selectedData: R,
75
- currentTabKey: z,
76
- changeSelectData: U
87
+ w(r, {
88
+ http: F.http,
89
+ urlPrefix: F.urlPrefix || "",
90
+ selectedData: B,
91
+ currentTabKey: V,
92
+ changeSelectData: K
77
93
  });
78
- let { b: W } = e("pro-selector-group");
79
- function G(e, t) {
80
- e && (B.value[t] = e);
94
+ let { b: q } = e("pro-selector-group");
95
+ function J(e, t) {
96
+ e && (H.value[t] = e);
81
97
  }
82
- let K = l(() => ({ width: z.value === "user" ? "600px" : "450px" }));
83
- function q() {
84
- I.value = R.value, P("confirm"), L.value = !1;
98
+ let Y = f(() => ({ width: V.value === "user" ? "600px" : "450px" }));
99
+ function X() {
100
+ R.value = c(B.value), I("confirm"), z.value = !1;
85
101
  }
86
- function J() {
87
- L.value = !1;
102
+ function Z() {
103
+ z.value = !1;
88
104
  }
89
- function Y(e) {
90
- let t = B.value[z.value];
91
- console.log("currentTabRefAAA =>", z.value), t && typeof t.echo == "function" && t.echo(e);
105
+ async function Q() {
106
+ await b(), Object.entries(H.value).forEach(([e, t]) => {
107
+ t && typeof t.echo == "function" && t.echo(B.value.filter((t) => t.type === e));
108
+ });
92
109
  }
93
- function X() {
94
- P("changeTab", z.value);
110
+ function $(e) {
111
+ let t = H.value[e.type || V.value];
112
+ t && typeof t.delFn == "function" && t.delFn(e.value), B.value = l(B.value, e.value, e.type);
95
113
  }
96
- function Z(e) {
97
- let t = B.value[z.value];
98
- t && typeof t.delFn == "function" && t.delFn(e);
114
+ async function ee() {
115
+ I("changeTab", V.value), await G();
99
116
  }
100
- function Q(e) {
101
- let t = B.value[z.value];
102
- t && typeof t.deleteAll == "function" && t.deleteAll(e);
117
+ function te(e) {
118
+ let t = /* @__PURE__ */ new Map();
119
+ e.forEach((e) => {
120
+ let n = e.type;
121
+ n && t.set(n, [...t.get(n) || [], e.value]);
122
+ }), t.forEach((e, t) => {
123
+ H.value[t]?.deleteAll?.(e);
124
+ }), B.value = [];
103
125
  }
104
- function $() {
105
- L.value = !0, R.value = [], console.log("selectedData =>", R.value);
126
+ async function ne() {
127
+ z.value = !0, await Q();
106
128
  }
107
- function ee(e) {
108
- let t = I.value.findIndex((t) => t.value === e.value);
129
+ function re(e) {
130
+ let t = R.value.findIndex((t) => t.value === e.value && t.type === e.type);
109
131
  if (t > -1) {
110
- let e = I.value[t];
111
- I.value.splice(t, 1), Z(String(e.value));
132
+ let e = R.value[t];
133
+ R.value = l(R.value, e.value, e.type), B.value = c(R.value), $(e);
112
134
  }
113
135
  }
114
- return (e, n) => (b(), f("div", { class: v(T(W)()) }, [h.hideSlot ? d("", !0) : (b(), f("div", M, [m(T(s), {
115
- "model-value": V.value,
136
+ return (e, r) => (C(), h("div", { class: x(O(q)()) }, [v.hideSlot ? m("", !0) : (C(), h("div", P, [_(n, {
137
+ "model-value": U.value,
116
138
  "add-text": "添加",
117
- onAdd: $,
118
- onClose: ee
119
- }, null, 8, ["model-value"])])), m(T(t), {
120
- modelValue: L.value,
121
- "onUpdate:modelValue": n[2] ||= (e) => L.value = e,
122
- title: h.title,
139
+ onAdd: ne,
140
+ onClose: re
141
+ }, null, 8, ["model-value"])])), _(t, {
142
+ modelValue: z.value,
143
+ "onUpdate:modelValue": r[2] ||= (e) => z.value = e,
144
+ title: v.title,
123
145
  width: "950px",
124
- onOnConfirm: q,
125
- onOnCancel: J
146
+ onOnConfirm: X,
147
+ onOnCancel: Z
126
148
  }, {
127
- default: k(() => [p("div", { class: v(T(W)("content")) }, [p("div", {
128
- class: v(T(W)("left")),
129
- style: y(K.value)
130
- }, [m(T(j), {
131
- "active-key": z.value,
132
- "onUpdate:activeKey": n[0] ||= (e) => z.value = e,
133
- onChange: X
149
+ default: j(() => [g("div", { class: x(O(q)("content")) }, [g("div", {
150
+ class: x(O(q)("left")),
151
+ style: S(Y.value)
152
+ }, [_(O(N), {
153
+ "active-key": V.value,
154
+ "onUpdate:activeKey": r[0] ||= (e) => V.value = e,
155
+ onChange: ee
134
156
  }, {
135
- default: k(() => [(b(!0), f(c, null, C(H.value, (e) => (b(), u(T(A), {
157
+ default: j(() => [(C(!0), h(d, null, E(W.value, (e) => (C(), p(O(M), {
136
158
  key: e.key,
137
159
  tab: e.tab
138
160
  }, {
139
- default: k(() => [(b(), u(w(e.component), {
161
+ default: j(() => [(C(), p(D(e.component), {
140
162
  ref_for: !0,
141
- ref: (t) => G(t, e.key)
163
+ ref: (t) => J(t, e.key)
142
164
  }, null, 512))]),
143
165
  _: 2
144
166
  }, 1032, ["tab"]))), 128))]),
145
167
  _: 1
146
- }, 8, ["active-key"])], 6), p("div", { class: v(T(W)("right")) }, [m(o, {
147
- modelValue: R.value,
148
- "onUpdate:modelValue": n[1] ||= (e) => R.value = e,
149
- onDelete: Z,
150
- onDeleteAll: Q
168
+ }, 8, ["active-key"])], 6), g("div", { class: x(O(q)("right")) }, [_(s, {
169
+ modelValue: B.value,
170
+ "onUpdate:modelValue": r[1] ||= (e) => B.value = e,
171
+ onDelete: $,
172
+ onDeleteAll: te
151
173
  }, null, 8, ["modelValue"])], 2)], 2)]),
152
174
  _: 1
153
175
  }, 8, ["modelValue", "title"])], 2));
154
176
  }
155
177
  });
156
178
  //#endregion
157
- export { N as default };
179
+ export { F as default };
@@ -0,0 +1,36 @@
1
+ //#region src/components/pro-selector-group/src/utils/index.ts
2
+ function e(t) {
3
+ return t.map((t) => ({
4
+ key: t.id,
5
+ title: t.deptName,
6
+ ...t,
7
+ children: e(t.children || [])
8
+ }));
9
+ }
10
+ function t(e) {
11
+ if (!Array.isArray(e)) return [];
12
+ let t = /* @__PURE__ */ new Set();
13
+ return e.flatMap((e) => {
14
+ if (!e || typeof e != "object") return [];
15
+ let n = e;
16
+ if (typeof n.value != "string" || !n.value) return [];
17
+ let r = `${n.type || ""}:${n.value}`;
18
+ return t.has(r) ? [] : (t.add(r), [{
19
+ label: typeof n.label == "string" ? n.label : "",
20
+ value: n.value,
21
+ type: n.type
22
+ }]);
23
+ });
24
+ }
25
+ function n(e, n, r) {
26
+ let i = t(r).map((e) => ({
27
+ ...e,
28
+ type: n || e.type
29
+ }));
30
+ return [...e.filter((e) => e.type !== n), ...i];
31
+ }
32
+ function r(e, t, n) {
33
+ return e.filter((e) => !(e.value === t && (!n || e.type === n)));
34
+ }
35
+ //#endregion
36
+ export { t as normalizeSelectorOptions, r as removeSelectorOption, n as replaceSelectorOptionsForType };
@@ -3,169 +3,181 @@ import t from "../../pro-modal/index.mjs";
3
3
  import n from "../../icon/index.mjs";
4
4
  import { GTE_OPTIONS_URL as r, roleSelectorEmits as i, roleSelectorProps as a } from "./types.mjs";
5
5
  import o from "../../pro-dynamic-tags/index.mjs";
6
- import { computed as s, createVNode as c, defineComponent as l, isVNode as u, mergeProps as d, onMounted as f, ref as p, watch as m } from "vue";
7
- import { Checkbox as h, CheckboxGroup as g, Empty as _, FormItemRest as v, InputSearch as y, Radio as b, RadioGroup as x, Spin as S, message as C } from "ant-design-vue";
6
+ import { computed as s, createTextVNode as c, createVNode as l, defineComponent as u, isVNode as d, mergeProps as f, onMounted as p, ref as m, watch as h } from "vue";
7
+ import { Alert as g, Button as _, Checkbox as v, CheckboxGroup as y, Empty as b, FormItemRest as x, InputSearch as S, Radio as C, RadioGroup as w, Spin as T, message as E } from "ant-design-vue";
8
8
  //#region src/components/role-selector/src/role.tsx
9
- function w(e) {
10
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !u(e);
9
+ function D(e) {
10
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
11
11
  }
12
- var T = e("role-selector"), E = /* @__PURE__ */ l({
12
+ var O = e("role-selector"), k = /* @__PURE__ */ u({
13
13
  name: "KRoleSelector",
14
14
  props: a,
15
15
  emits: i,
16
- setup(e, { emit: i, attrs: a, slots: l }) {
17
- let u = p([]), E = p(""), D = p([]), O = p([]), k = p([]), A = p(""), j = p(!1), M = p(e.options || []), N = p(!1), P = p(!1), F = (t) => t.filter((e) => e.enable !== !1).map((t) => ({
16
+ setup(e, { emit: i, attrs: a, slots: u }) {
17
+ let d = m([]), k = m(""), A = m([]), j = m([]), M = m([]), N = m(""), P = m(e.options || []), F = m(!1), I = m(!1), L = m(""), R = (t) => t.filter((e) => e.enable !== !1).map((t) => ({
18
18
  label: t.roleName,
19
19
  value: t[e.valueField]
20
- })), I = () => {
21
- let e = E.value.trim();
22
- e ? D.value = M.value.filter((t) => t.label?.includes(e) || t.value?.includes(e)) : D.value = [...M.value];
23
- }, L = async () => {
24
- if (!(!e.isBuiltInRequest || P.value)) {
20
+ })), z = () => {
21
+ let e = k.value.trim();
22
+ e ? A.value = P.value.filter((t) => t.label?.includes(e) || t.value?.includes(e)) : A.value = [...P.value];
23
+ }, B = async () => {
24
+ if (!(!e.isBuiltInRequest || I.value)) {
25
25
  if (!e.http) throw Error("请传入http实例");
26
- N.value = !0;
26
+ F.value = !0, L.value = "";
27
27
  try {
28
28
  let t = await e.http.get(`${e.prefix}${r}`);
29
- t.status === 0 && (M.value = F(Array.isArray(t.data) ? t.data : []), I(), P.value = !0, k.value = H(k.value), V(), R());
30
- } catch (e) {
31
- C.error(typeof e == "string" ? e : "获取角色列表失败");
29
+ t.status === 0 ? (P.value = R(Array.isArray(t.data) ? t.data : []), z(), I.value = !0, M.value = G(M.value), W(), V()) : L.value = "角色数据加载失败,请重试";
30
+ } catch {
31
+ L.value = "角色数据加载失败,请重试";
32
32
  } finally {
33
- N.value = !1;
33
+ F.value = !1;
34
34
  }
35
35
  }
36
36
  };
37
- f(() => {
38
- e.isBuiltInRequest && L();
37
+ p(() => {
38
+ e.isBuiltInRequest && B();
39
39
  });
40
- let R = () => {
41
- if (!j.value) {
42
- A.value = "";
43
- let e = [];
44
- M.value.forEach((t) => {
45
- Array.isArray(u.value) ? u.value.includes(t.value) && e.push(t.label) : u.value === t.value && e.push(t.label);
46
- }), A.value = e.join(",");
47
- }
48
- }, z = () => {
40
+ let V = () => {
41
+ N.value = "";
42
+ let e = [];
43
+ P.value.forEach((t) => {
44
+ Array.isArray(d.value) ? d.value.includes(t.value) && e.push(t.label) : d.value === t.value && e.push(t.label);
45
+ }), N.value = e.join(",");
46
+ }, H = () => {
49
47
  let e = [];
50
- if (Array.isArray(u.value)) u.value.forEach((t) => {
51
- let n = M.value.find((e) => e.value === t);
48
+ if (Array.isArray(d.value)) d.value.forEach((t) => {
49
+ let n = P.value.find((e) => e.value === t);
52
50
  n && e.push(n);
53
51
  });
54
52
  else {
55
- let t = M.value.find((e) => e.value === u.value);
53
+ let t = P.value.find((e) => e.value === d.value);
56
54
  t && e.push(t);
57
55
  }
58
- O.value = e;
59
- }, B = (e) => typeof e == "object" && !!e && "value" in e && e.value !== void 0 && e.value !== null, V = () => {
60
- Array.isArray(e.modelValue) ? u.value = e.modelValue.map((e) => e.value) : e.type === "radio" ? B(e.modelValue) ? u.value = e.modelValue.value : u.value = "" : u.value = e.modelValue?.value || "";
61
- }, H = (e) => e.length ? M.value.length === 0 ? e : e.map((e) => {
62
- let t = M.value.find((t) => t.value === e.value);
56
+ j.value = e;
57
+ }, U = (e) => typeof e == "object" && !!e && "value" in e && e.value !== void 0 && e.value !== null, W = () => {
58
+ Array.isArray(e.modelValue) ? d.value = e.modelValue.map((e) => e.value) : e.type === "radio" ? U(e.modelValue) ? d.value = e.modelValue.value : d.value = "" : d.value = e.modelValue?.value || "";
59
+ }, G = (e) => e.length ? P.value.length === 0 ? e : e.map((e) => {
60
+ let t = P.value.find((t) => t.value === e.value);
63
61
  return t ? {
64
62
  ...e,
65
63
  label: t.label
66
64
  } : e;
67
65
  }) : [];
68
- m(() => e.visible, (e) => {
69
- V();
70
- }), m(() => e.modelValue, (e) => {
71
- if (j.value) j.value = !1;
72
- else {
73
- V(), M.value.length > 0 && R();
74
- let t = [];
75
- Array.isArray(e) ? t = [...e] : B(e) && (t = [e]), k.value = H(t);
76
- }
66
+ h(() => e.visible, (e) => {
67
+ W(), e && H();
68
+ }), h(() => e.modelValue, (e) => {
69
+ W(), P.value.length > 0 && V();
70
+ let t = [];
71
+ Array.isArray(e) ? t = [...e] : U(e) && (t = [e]), M.value = G(t);
77
72
  }, {
78
73
  deep: !0,
79
74
  immediate: !0
80
- }), m(() => e.options, (t) => {
81
- e.isBuiltInRequest || (M.value = t || [], D.value = t || [], k.value = H(k.value), R(), z());
75
+ }), h(() => e.options, (t) => {
76
+ e.isBuiltInRequest || (P.value = t || [], A.value = t || [], M.value = G(M.value), V(), H());
82
77
  }, {
83
78
  deep: !0,
84
79
  immediate: !0
85
- }), m(u, () => {
86
- z();
80
+ }), h(d, () => {
81
+ H();
87
82
  }, {
88
83
  deep: !0,
89
84
  immediate: !0
90
- }), m(E, () => {
91
- I();
85
+ }), h(k, () => {
86
+ z();
92
87
  });
93
- let U = () => {
94
- i("update:visible", !1), i("cancel");
95
- }, W = () => {
96
- if (e.type === "radio" && !u.value) {
97
- C.warn("请选择角色");
88
+ let K = () => {
89
+ W(), H(), i("update:visible", !1), i("cancel");
90
+ }, q = () => {
91
+ if (e.type === "radio" && !d.value) {
92
+ E.warn("请选择角色");
98
93
  return;
99
94
  }
100
- if (Array.isArray(u.value) && u.value.length === 0) {
101
- C.warn("请选择角色");
95
+ if (Array.isArray(d.value) && d.value.length === 0) {
96
+ E.warn("请选择角色");
102
97
  return;
103
98
  }
104
- k.value = [...O.value], Array.isArray(u.value) ? (A.value = O.value.map((e) => e.label).join(","), i("update:modelValue", O.value)) : (A.value = O.value[0]?.label || "", i("update:modelValue", O.value[0] || null)), j.value = !0, i("update:visible", !1), i("confirm", O.value);
105
- }, G = (e) => {
106
- Array.isArray(u.value) ? u.value = u.value.filter((t) => t !== e.value) : u.value = "";
107
- }, K = s(() => k.value.map((e) => ({
99
+ M.value = [...j.value], Array.isArray(d.value) ? (N.value = j.value.map((e) => e.label).join(","), i("update:modelValue", j.value)) : (N.value = j.value[0]?.label || "", i("update:modelValue", j.value[0] || null)), i("update:visible", !1), i("confirm", j.value);
100
+ }, J = (e) => {
101
+ Array.isArray(d.value) ? d.value = d.value.filter((t) => t !== e.value) : d.value = "";
102
+ }, Y = s(() => M.value.map((e) => ({
108
103
  label: e.label,
109
104
  value: e.value,
110
105
  closable: !0
111
- }))), q = (e, t) => {
112
- let n = k.value[t];
113
- if (n) if (k.value = k.value.filter((e, n) => n !== t), G(n), Array.isArray(u.value)) {
114
- let e = k.value;
115
- A.value = e.map((e) => e.label).join(","), i("update:modelValue", e);
116
- } else A.value = k.value[0]?.label || "", i("update:modelValue", k.value[0] || null);
117
- }, J = () => {
106
+ }))), X = (e, t) => {
107
+ let n = M.value[t];
108
+ if (n) if (M.value = M.value.filter((e, n) => n !== t), J(n), Array.isArray(d.value)) {
109
+ let e = M.value;
110
+ N.value = e.map((e) => e.label).join(","), i("update:modelValue", e);
111
+ } else N.value = M.value[0]?.label || "", i("update:modelValue", M.value[0] || null);
112
+ }, Z = () => {
118
113
  i("update:visible", !0);
119
- }, Y = (e, t) => c("div", { class: [T.e("role-item"), t && T.is("active")] }, [c("div", { class: T.e("role-item-label") }, [c(n, {
114
+ }, Q = (e, t) => l("div", { class: [O.e("role-item"), t && O.is("active")] }, [l("div", { class: O.e("role-item-label") }, [l(n, {
120
115
  name: "a-jiaoseguanli2",
121
116
  size: 18,
122
117
  color: "var(--gdant-neutral-600)"
123
- }, null), c("span", { class: T.e("label") }, [e.label], 2)], 2), c("div", {
124
- class: T.e("role-item-del"),
125
- onClick: () => G(e)
126
- }, [t && c(n, {
118
+ }, null), l("span", { class: O.e("label") }, [e.label], 2)], 2), l("div", { class: O.e("role-item-del") }, [t && l("button", {
119
+ type: "button",
120
+ "aria-label": `移除${e.label || "角色"}`,
121
+ onClick: () => J(e)
122
+ }, [l(n, {
127
123
  name: "shanchu",
128
- size: 18,
129
- color: "var(--gdant-neutral-600)"
130
- }, null)], 10, ["onClick"])], 2), X = () => c("div", { class: T.b("left") }, [c(y, {
131
- allowClear: !0,
132
- placeholder: "请输入角色名称",
133
- value: E.value,
134
- "onUpdate:value": (e) => E.value = e
135
- }, null, 8, [
136
- "allowClear",
137
- "value",
138
- "onUpdate:value"
139
- ]), c(S, { spinning: N.value }, { default: () => [c("div", { class: T.e("role-list") }, [!N.value && D.value.length === 0 && c(_, {
124
+ size: 16
125
+ }, null)], 8, ["aria-label", "onClick"])], 2)], 2), $ = () => l("div", { class: O.b("left") }, [
126
+ l(S, {
127
+ allowClear: !0,
128
+ placeholder: "搜索角色",
129
+ value: k.value,
130
+ "onUpdate:value": (e) => k.value = e
131
+ }, null, 8, [
132
+ "allowClear",
133
+ "value",
134
+ "onUpdate:value"
135
+ ]),
136
+ L.value && l(g, {
137
+ class: O.e("feedback"),
138
+ type: "error",
139
+ showIcon: !0,
140
+ message: L.value
141
+ }, { action: () => l(_, {
142
+ type: "link",
143
+ size: "small",
144
+ onClick: B
145
+ }, { default: () => [c("重试")] }, 8, ["onClick"]) }, 8, [
146
+ "class",
147
+ "showIcon",
148
+ "message"
149
+ ]),
150
+ l(T, { spinning: F.value }, { default: () => [l("div", { class: O.e("role-list") }, [!F.value && !L.value && A.value.length === 0 && l(b, {
151
+ description: "暂无角色",
152
+ image: b.PRESENTED_IMAGE_SIMPLE
153
+ }, null, 8, ["image"]), e.type === "radio" ? l(w, {
154
+ value: d.value,
155
+ "onUpdate:value": (e) => d.value = e
156
+ }, { default: () => [l("div", { style: "width: 100%;" }, [A.value.map((e) => {
157
+ let t;
158
+ return l("div", { key: e.value }, [l(C, { value: e.value }, D(t = Q(e)) ? t : {
159
+ default: () => [t],
160
+ _: 1
161
+ }, 8, ["value"])]);
162
+ })])] }, 8, ["value", "onUpdate:value"]) : l(y, {
163
+ value: d.value,
164
+ "onUpdate:value": (e) => d.value = e
165
+ }, { default: () => [l("div", { style: "width: 100%;" }, [A.value.map((e) => {
166
+ let t;
167
+ return l("div", { key: e.value }, [l(v, { value: e.value }, D(t = Q(e)) ? t : {
168
+ default: () => [t],
169
+ _: 1
170
+ }, 8, ["value"])]);
171
+ })])] }, 8, ["value", "onUpdate:value"])], 2)] }, 8, ["spinning"])
172
+ ], 2), ee = () => l("div", { class: O.b("right") }, [j.value.map((e) => l("div", { key: e.value }, [Q(e, !0)])), j.value.length === 0 && l(b, {
140
173
  description: "暂无数据",
141
- image: _.PRESENTED_IMAGE_SIMPLE
142
- }, null, 8, ["image"]), e.type === "radio" ? c(x, {
143
- value: u.value,
144
- "onUpdate:value": (e) => u.value = e
145
- }, { default: () => [c("div", { style: "width: 100%;" }, [D.value.map((e) => {
146
- let t;
147
- return c("div", { key: e.value }, [c(b, { value: e.value }, w(t = Y(e)) ? t : {
148
- default: () => [t],
149
- _: 1
150
- }, 8, ["value"])]);
151
- })])] }, 8, ["value", "onUpdate:value"]) : c(g, {
152
- value: u.value,
153
- "onUpdate:value": (e) => u.value = e
154
- }, { default: () => [c("div", { style: "width: 100%;" }, [D.value.map((e) => {
155
- let t;
156
- return c("div", { key: e.value }, [c(h, { value: e.value }, w(t = Y(e)) ? t : {
157
- default: () => [t],
158
- _: 1
159
- }, 8, ["value"])]);
160
- })])] }, 8, ["value", "onUpdate:value"])], 2)] }, 8, ["spinning"])], 2), Z = () => c("div", { class: T.b("right") }, [O.value.map((e) => c("div", { key: e.value }, [Y(e, !0)])), O.value.length === 0 && c(_, {
161
- description: "暂无数据",
162
- image: _.PRESENTED_IMAGE_SIMPLE
163
- }, null, 8, ["image"])], 2), Q = () => {
174
+ image: b.PRESENTED_IMAGE_SIMPLE
175
+ }, null, 8, ["image"])], 2), te = () => {
164
176
  let n = {
165
- onOnCancel: U,
166
- onOnConfirm: W
177
+ onOnCancel: K,
178
+ onOnConfirm: q
167
179
  };
168
- return c("div", null, [c(t, d({
180
+ return l("div", null, [l(t, f({
169
181
  modelValue: e.visible,
170
182
  title: "选择角色",
171
183
  modalProps: {
@@ -174,20 +186,22 @@ var T = e("role-selector"), E = /* @__PURE__ */ l({
174
186
  width: "700px",
175
187
  ...a
176
188
  },
177
- "onUpdate:modelValue": (e) => i("update:visible", e)
178
- }, n), { default: () => [c("div", { class: T.b("modal") }, [X(), Z()], 2)] }, 16, [
189
+ "onUpdate:modelValue": (e) => {
190
+ e || (W(), H()), i("update:visible", e);
191
+ }
192
+ }, n), { default: () => [l("div", { class: O.b("modal") }, [$(), ee()], 2)] }, 16, [
179
193
  "modelValue",
180
194
  "modalProps",
181
195
  "onUpdate:modelValue"
182
196
  ])]);
183
197
  };
184
- return () => c(v, null, { default: () => [c("div", { class: T.b() }, [e.hideSlot ? null : l.default ? l.default() : c(o, {
185
- modelValue: K.value,
198
+ return () => l(x, null, { default: () => [l("div", { class: O.b() }, [e.hideSlot ? null : u.default ? u.default() : l(o, {
199
+ modelValue: Y.value,
186
200
  showAdd: !0,
187
201
  addText: "选择角色",
188
202
  closable: !0,
189
- onClose: q,
190
- onAdd: J,
203
+ onClose: X,
204
+ onAdd: Z,
191
205
  customStyle: {
192
206
  width: "100%",
193
207
  minHeight: "30px"
@@ -196,8 +210,8 @@ var T = e("role-selector"), E = /* @__PURE__ */ l({
196
210
  "modelValue",
197
211
  "onClose",
198
212
  "onAdd"
199
- ]), Q()], 2)] });
213
+ ]), te()], 2)] });
200
214
  }
201
215
  });
202
216
  //#endregion
203
- export { E as default };
217
+ export { k as default };