@dazhicheng/ui 1.6.79 → 1.6.81

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 (53) hide show
  1. package/dist/api/supplier.d.ts +16 -0
  2. package/dist/api/supplier.js +39 -12
  3. package/dist/assets/svg/download.svg.js +1 -1
  4. package/dist/components/tt-area/TtArea.vue.js +1 -1
  5. package/dist/components/tt-button/index.d.ts +28 -28
  6. package/dist/components/tt-button/index.vue.d.ts +16 -16
  7. package/dist/components/tt-custom-export-modal/src/assets/search.svg.js +5 -5
  8. package/dist/components/tt-custom-export-modal/src/assets/star.svg.js +3 -3
  9. package/dist/components/tt-custom-export-modal/src/assets/trash.svg.js +7 -7
  10. package/dist/components/tt-custom-export-modal/src/components/FieldGridSection.vue.js +1 -1
  11. package/dist/components/tt-drawer/index.d.ts +109 -109
  12. package/dist/components/tt-drawer/src/RenderDrawer.vue.d.ts +60 -60
  13. package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
  14. package/dist/components/tt-empty/index.d.ts +4 -4
  15. package/dist/components/tt-form/src/components/FormElInput.vue.d.ts +10 -10
  16. package/dist/components/tt-icon/index.vue.js +2 -2
  17. package/dist/components/tt-image/index.d.ts +29 -29
  18. package/dist/components/tt-image/src/components/ImageViewer.d.ts +20 -20
  19. package/dist/components/tt-image/tt-image.d.ts +29 -29
  20. package/dist/components/tt-input-textarea/index.vue.d.ts +40 -40
  21. package/dist/components/tt-loading/src/loading.vue.js +2 -2
  22. package/dist/components/tt-modal/index.d.ts +150 -150
  23. package/dist/components/tt-modal/src/RenderModal.vue.d.ts +42 -42
  24. package/dist/components/tt-modal/src/hooks/useModalRender.d.ts +17 -17
  25. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +5 -5
  26. package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.js +133 -122
  27. package/dist/components/tt-panel-select/src/components/PanelRight.vue.js +77 -66
  28. package/dist/components/tt-panel-select/src/hooks/usePanelData.d.ts +2 -0
  29. package/dist/components/tt-panel-select/src/hooks/usePanelData.js +14 -14
  30. package/dist/components/tt-panel-select/src/index.vue.d.ts +7 -5
  31. package/dist/components/tt-panel-select/src/index.vue.js +300 -219
  32. package/dist/components/tt-panel-select/src/types.d.ts +12 -0
  33. package/dist/components/tt-table/index.js +6 -5
  34. package/dist/components/tt-table/src/TableForm.vue.js +3 -2
  35. package/dist/components/tt-table/src/hooks/useQuery.js +52 -50
  36. package/dist/components/tt-upload/index.d.ts +60 -60
  37. package/dist/components/tt-upload/src/TtUpload.vue.d.ts +37 -37
  38. package/dist/components/tt-upload/src/typing.d.ts +17 -17
  39. package/dist/hooks/basicDataCodes.d.ts +5 -0
  40. package/dist/hooks/basicDataCodes.js +61 -60
  41. package/dist/hooks/missingOptionsCache.d.ts +53 -0
  42. package/dist/hooks/missingOptionsCache.js +133 -0
  43. package/dist/hooks/panelSelectEchoFields.d.ts +12 -0
  44. package/dist/hooks/panelSelectEchoFields.js +46 -0
  45. package/dist/hooks/useBasicDataOptions.d.ts +2 -0
  46. package/dist/hooks/useBasicDataOptions.js +85 -78
  47. package/dist/hooks/useDataPermissionOptions.d.ts +10 -0
  48. package/dist/hooks/useDataPermissionOptions.js +83 -66
  49. package/dist/hooks/useFormSchemasLink.js +240 -194
  50. package/dist/hooks/usePanelSelectSchemas.d.ts +11 -0
  51. package/dist/hooks/usePanelSelectSchemas.js +158 -122
  52. package/dist/style.css +1 -1
  53. package/package.json +1 -1
@@ -61,9 +61,20 @@ export interface PanelSelectFieldConfig<TValues extends Recordable = Recordable>
61
61
  groupBy?: PanelSelectGroupBy;
62
62
  /** 自定义过滤完整 options(过滤在分组前执行,入参为扁平 options) */
63
63
  customOptions?: (values: TValues, options: BasicDataOption[]) => BasicDataOption[];
64
+ /**
65
+ * 缺码(deleted)项是否 disabled。
66
+ * 默认跟随 `UsePanelSelectSchemasOptions.disableMissingOptions`(再默认 false 放开)。
67
+ * 新增编辑需禁用时传 true。
68
+ */
69
+ disableMissingOptions?: boolean;
64
70
  }
65
71
  export interface UsePanelSelectSchemasOptions {
66
72
  dataSource?: MaybeRef<BasicDataOptionsMap | undefined>;
73
+ /**
74
+ * 缺码项是否 disabled,默认 false(放开可选)。
75
+ * 新增/编辑表单传 true;字段级 `disableMissingOptions` 可覆盖。
76
+ */
77
+ disableMissingOptions?: boolean;
67
78
  }
68
79
  /**
69
80
  * 基础数据 PanelSelect schema hooks。
@@ -1,6 +1,6 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
- import { isFunction as X } from "../packages/utils/src/is.js";
3
+ import { isFunction as re } from "../packages/utils/src/is.js";
4
4
  import "vue";
5
5
  import "dayjs";
6
6
  import "numeral";
@@ -13,124 +13,145 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
13
13
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
14
14
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
15
15
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
16
- import { omit as _ } from "lodash-es";
17
- import { CODE_REGISTRY as ce, resolveDefaultGroupBy as le, CODES as pe, GROUP_BY as V, groupPurchasePlaceOptions as ue, groupBasicDataOptions as ie } from "./basicDataCodes.js";
18
- import { useBasicDataOptions as ae } from "./useBasicDataOptions.js";
19
- const E = "all";
20
- function d(t) {
16
+ import { omit as Y } from "lodash-es";
17
+ import { CODE_REGISTRY as he, resolveDefaultGroupBy as Oe, CODES as Pe, GROUP_BY as X, groupPurchasePlaceOptions as we, groupBasicDataOptions as xe } from "./basicDataCodes.js";
18
+ import { ensureMissingOptions as f, withMissingOptionDisabled as $ } from "./missingOptionsCache.js";
19
+ import { registerPanelSelectEchoField as C } from "./panelSelectEchoFields.js";
20
+ import { useBasicDataOptions as Ae } from "./useBasicDataOptions.js";
21
+ import { useOwnerRoutePath as ye } from "./useOwnerRoutePath.js";
22
+ const T = "all";
23
+ function P(t) {
21
24
  return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
22
25
  }
23
- function de(t, n = E) {
26
+ function Se(t, n = T) {
24
27
  return t === n ? !0 : typeof t == "string" && typeof n == "string" && t.toLowerCase() === String(n).toLowerCase();
25
28
  }
26
- function me(t, n = E) {
27
- return d(t).some((r) => de(r, n));
29
+ function ge(t, n = T) {
30
+ return P(t).some((s) => Se(s, n));
28
31
  }
29
- function he(t) {
32
+ function Me(t) {
30
33
  return t.replace(/[-_]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("");
31
34
  }
32
- function j(t, n, r, c) {
33
- return t ? X(t) ? t(n, r, c) : t : {};
35
+ function ee(t, n, s, c) {
36
+ return t ? re(t) ? t(n, s, c) : t : {};
34
37
  }
35
- function q(t, n, r, c) {
36
- const p = new Set(r.map((e) => e.value)), l = t[n];
38
+ function te(t, n, s, c) {
39
+ const l = new Set(s.map((m) => m.value)), r = t[n];
37
40
  if (c) {
38
- const e = d(l).filter((u) => p.has(u)), s = d(l);
39
- (e.length !== s.length || e.some((u, g) => u !== s[g])) && (t[n] = e);
41
+ const m = P(r).filter((e) => l.has(e)), p = P(r);
42
+ (m.length !== p.length || m.some((e, i) => e !== p[i])) && (t[n] = m);
40
43
  return;
41
44
  }
42
- l == null || l === "" || p.has(l) || (t[n] = void 0);
45
+ r == null || r === "" || l.has(r) || (t[n] = void 0);
43
46
  }
44
- function H(t, n, r, c, p, l) {
45
- const e = l ? p.filter((s) => d(r[n]).includes(s.value)) : p.find((s) => s.value === r[n]);
47
+ function ne(t, n, s, c, l, r) {
48
+ const m = r ? l.filter((p) => P(s[n]).includes(p.value)) : l.find((p) => p.value === s[n]);
46
49
  return {
47
- values: r,
50
+ values: s,
48
51
  actions: c,
49
52
  fieldName: n,
50
53
  code: t,
51
- options: p,
52
- currentOption: e
54
+ options: l,
55
+ currentOption: m
53
56
  };
54
57
  }
55
- function Z(t, n, r) {
56
- const c = d(t);
58
+ function oe(t, n, s) {
59
+ const c = P(t);
57
60
  if (!c.length) return [];
58
- if (me(t, r)) return n;
59
- const p = new Set(c);
60
- return n.filter((l) => p.has(l.value));
61
+ if (ge(t, s)) return n;
62
+ const l = new Set(c);
63
+ return n.filter((r) => l.has(r.value));
61
64
  }
62
- function J(t, n) {
63
- const r = new Set(d(t));
64
- return r.size ? n.filter((c) => !r.has(c.value)) : n;
65
+ function se(t, n) {
66
+ const s = new Set(P(t));
67
+ return s.size ? n.filter((c) => !s.has(c.value)) : n;
65
68
  }
66
- function Q(t, n) {
69
+ function D(t, n) {
67
70
  var c;
68
- const r = (c = t.value) == null ? void 0 : c[n];
69
- return Array.isArray(r) ? r : [];
71
+ const s = (c = t.value) == null ? void 0 : c[n];
72
+ return Array.isArray(s) ? s : [];
70
73
  }
71
- function ke(t, n = {}) {
72
- const r = [...new Set(t.map((e) => e.code))], c = t.reduce(
73
- (e, s) => (e[s.code] = (e[s.code] || 0) + 1, e),
74
+ function He(t, n = {}) {
75
+ const s = [...new Set(t.map((e) => e.code))], c = t.reduce(
76
+ (e, i) => (e[i.code] = (e[i.code] || 0) + 1, e),
74
77
  {}
75
- ), { dataSource: p } = ae({
76
- codes: r,
78
+ ), l = ye(), { dataSource: r } = Ae({
79
+ codes: s,
77
80
  dataSource: n.dataSource
78
- }), l = {};
81
+ }), m = n.disableMissingOptions ?? !1, p = {};
79
82
  return t.forEach((e) => {
80
- var $;
81
- const s = ce[e.code], u = e.fieldName || s.defaultFieldName, g = e.key || ((c[e.code] || 0) > 1 ? u : e.code), k = e.label || s.defaultLabel, R = e.multiple ?? s.defaultMultiple, v = e.showAll ?? s.defaultShowAll, N = e.showAllField ?? E, m = e.mutexWith, b = le(e.code, e.groupBy), y = e.code === pe.PURCHASE_PLACE, D = b === V.NONE, T = b === V.PINYIN, f = !y && !D && !T, S = s.defaultTreeConfig, U = !!S, I = y ? !1 : s.defaultShowNav ?? !1;
82
- function W(o) {
83
- return y ? ue(o) : f ? ie(o, b) : o;
83
+ var Z, J;
84
+ const i = he[e.code], h = e.fieldName || i.defaultFieldName, F = !!i.fetchMissingOptions, L = e.disableMissingOptions ?? m;
85
+ F && (C(l, e.code, h), (Z = e.exclude) != null && Z.fieldName && C(l, e.code, e.exclude.fieldName));
86
+ const v = e.key || ((c[e.code] || 0) > 1 ? h : e.code), z = e.label || i.defaultLabel, K = e.multiple ?? i.defaultMultiple, ce = e.showAll ?? i.defaultShowAll, _ = e.showAllField ?? T, w = e.mutexWith, B = Oe(e.code, e.groupBy), S = e.code === Pe.PURCHASE_PLACE, G = B === X.NONE, R = B === X.PINYIN, le = !S && !G && !R, g = i.defaultTreeConfig, V = !!g, j = S ? !1 : i.defaultShowNav ?? !1;
87
+ function q(o) {
88
+ const u = F ? $(o, L) : o;
89
+ return S ? we(u) : le ? xe(u, B) : u;
84
90
  }
85
- const C = [
86
- ...m ? [m] : [],
87
- ...(($ = e.dependencies) == null ? void 0 : $.triggerFields) || []
88
- ], Y = [...new Set(C)], ee = _(e.dependencies || {}, ["triggerFields"]), te = Y.length ? {
89
- ...ee,
90
- triggerFields: Y
91
- } : e.dependencies, L = {
91
+ const ie = [
92
+ ...w ? [w] : [],
93
+ ...((J = e.dependencies) == null ? void 0 : J.triggerFields) || []
94
+ ], H = [...new Set(ie)], pe = Y(e.dependencies || {}, ["triggerFields"]), ue = H.length ? {
95
+ ...pe,
96
+ triggerFields: H
97
+ } : e.dependencies, k = {
92
98
  component: "TtPanelSelect",
93
- fieldName: u,
94
- label: k,
99
+ fieldName: h,
100
+ label: z,
95
101
  rules: e.rules,
96
- dependencies: te,
97
- componentProps: (o, x) => {
98
- const P = Q(p, e.code);
99
- let a = m ? J(o[m], P) : P;
100
- X(e.customOptions) && (a = e.customOptions(o, a) || []);
101
- const F = W(a), M = j(e.componentProps, o, x, a), { onChange: z, ...O } = M;
102
+ dependencies: ue,
103
+ componentProps: (o, u) => {
104
+ const A = D(r, e.code);
105
+ let O = w ? se(o[w], A) : A;
106
+ re(e.customOptions) && (O = e.customOptions(o, O) || []);
107
+ const b = q(O), U = ee(e.componentProps, o, u, O), {
108
+ onChange: Q,
109
+ resolveMissingOptions: E,
110
+ ...I
111
+ } = U;
102
112
  return {
103
- multiple: R,
104
- showAll: v,
105
- showAllField: N,
106
- showNav: I,
107
- showOriginMode: D,
108
- showPinyinMode: U || y ? !1 : T,
109
- ...S ? { treeConfig: S } : {},
110
- ...O,
111
- options: F,
112
- onChange(A) {
113
- var w;
114
- if (m) {
115
- const i = Array.isArray(o[m]), h = J(A, P);
116
- q(o, m, h, i);
113
+ multiple: K,
114
+ showAll: ce,
115
+ showAllField: _,
116
+ showNav: j,
117
+ showOriginMode: G,
118
+ showPinyinMode: V || S ? !1 : R,
119
+ ...g ? { treeConfig: g } : {},
120
+ ...I,
121
+ options: b,
122
+ ...F ? {
123
+ resolveMissingOptions: async (a) => {
124
+ const d = await f(
125
+ l,
126
+ e.code,
127
+ a,
128
+ D(r, e.code)
129
+ );
130
+ return $(d, L);
131
+ }
132
+ } : {},
133
+ onChange(a) {
134
+ var d;
135
+ if (w) {
136
+ const x = Array.isArray(o[w]), y = se(a, A);
137
+ te(o, w, y, x);
117
138
  }
118
139
  if (e.exclude) {
119
- const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, B = Z(A, P, N);
120
- d(A).length ? q(o, i, B, h) : o[i] = h ? [] : void 0;
140
+ const x = e.exclude.fieldName, y = e.exclude.multiple ?? !0, M = oe(a, A, _);
141
+ P(a).length ? te(o, x, M, y) : o[x] = y ? [] : void 0;
121
142
  }
122
- (w = e.onChange) == null || w.call(
143
+ (d = e.onChange) == null || d.call(
123
144
  e,
124
- A,
125
- H(e.code, u, o, x, a, R)
145
+ a,
146
+ ne(e.code, h, o, u, O, K)
126
147
  );
127
148
  }
128
149
  };
129
150
  }
130
151
  };
131
- if (l[g] = {
132
- ...L,
133
- ..._(e, [
152
+ if (p[v] = {
153
+ ...k,
154
+ ...Y(e, [
134
155
  "code",
135
156
  "key",
136
157
  "fieldName",
@@ -147,57 +168,72 @@ function ke(t, n = {}) {
147
168
  "groupBy",
148
169
  "customOptions"
149
170
  ]),
150
- fieldName: u,
151
- label: k,
171
+ fieldName: h,
172
+ label: z,
152
173
  rules: e.rules,
153
174
  description: e.description,
154
- dependencies: L.dependencies,
155
- componentProps: L.componentProps,
175
+ dependencies: k.dependencies,
176
+ componentProps: k.componentProps,
156
177
  component: "TtPanelSelect"
157
178
  }, e.exclude) {
158
- const o = e.exclude, x = o.fieldName, P = o.key || `exclude${he(g)}`, a = o.label || s.defaultExcludeLabel, F = o.multiple ?? !0, M = o.showAll ?? !1, z = o.showAllField ?? E, O = o.dependencies || {}, A = {
159
- ...O,
160
- triggerFields: O.triggerFields ?? [u],
161
- if: O.if ?? ((i) => d(i[u]).length > 0)
162
- }, w = {
179
+ const o = e.exclude, u = o.fieldName, A = o.key || `exclude${Me(v)}`, O = o.label || i.defaultExcludeLabel, b = o.multiple ?? !0, U = o.showAll ?? !1, Q = o.showAllField ?? T, E = o.dependencies || {}, I = {
180
+ ...E,
181
+ triggerFields: E.triggerFields ?? [h],
182
+ if: E.if ?? ((d) => P(d[h]).length > 0)
183
+ }, a = {
163
184
  component: "TtPanelSelect",
164
- fieldName: x,
165
- label: a,
185
+ fieldName: u,
186
+ label: O,
166
187
  rules: o.rules,
167
- dependencies: A,
168
- componentProps: (i, h) => {
169
- const B = Q(p, e.code), G = Z(i[u], B, N), ne = W(G), oe = j(o.componentProps, i, h, G), { onChange: xe, ...re } = oe;
188
+ dependencies: I,
189
+ componentProps: (d, x) => {
190
+ const y = D(r, e.code), M = oe(d[h], y, _), ae = q(M), de = ee(o.componentProps, d, x, M), {
191
+ onChange: Fe,
192
+ resolveMissingOptions: be,
193
+ ...me
194
+ } = de;
170
195
  return {
171
- multiple: F,
172
- showAll: M,
173
- showAllField: z,
174
- showNav: I,
175
- showOriginMode: D,
176
- showPinyinMode: U || y ? !1 : T,
177
- ...S ? { treeConfig: S } : {},
178
- ...re,
179
- options: ne,
180
- onChange(se) {
181
- var K;
182
- (K = o.onChange) == null || K.call(
196
+ multiple: b,
197
+ showAll: U,
198
+ showAllField: Q,
199
+ showNav: j,
200
+ showOriginMode: G,
201
+ showPinyinMode: V || S ? !1 : R,
202
+ ...g ? { treeConfig: g } : {},
203
+ ...me,
204
+ options: ae,
205
+ ...F ? {
206
+ resolveMissingOptions: async (W) => {
207
+ const N = await f(
208
+ l,
209
+ e.code,
210
+ W,
211
+ D(r, e.code)
212
+ );
213
+ return $(N, L);
214
+ }
215
+ } : {},
216
+ onChange(W) {
217
+ var N;
218
+ (N = o.onChange) == null || N.call(
183
219
  o,
184
- se,
185
- H(
220
+ W,
221
+ ne(
186
222
  e.code,
223
+ u,
224
+ d,
187
225
  x,
188
- i,
189
- h,
190
- G,
191
- F
226
+ M,
227
+ b
192
228
  )
193
229
  );
194
230
  }
195
231
  };
196
232
  }
197
233
  };
198
- l[P] = {
199
- ...w,
200
- ..._(o, [
234
+ p[A] = {
235
+ ...a,
236
+ ...Y(o, [
201
237
  "fieldName",
202
238
  "label",
203
239
  "key",
@@ -209,19 +245,19 @@ function ke(t, n = {}) {
209
245
  "onChange",
210
246
  "rules"
211
247
  ]),
212
- fieldName: x,
213
- label: a,
248
+ fieldName: u,
249
+ label: O,
214
250
  rules: o.rules,
215
- dependencies: w.dependencies,
216
- componentProps: w.componentProps,
251
+ dependencies: a.dependencies,
252
+ componentProps: a.componentProps,
217
253
  component: "TtPanelSelect"
218
254
  };
219
255
  }
220
256
  }), {
221
- ...l,
222
- dataSource: p
257
+ ...p,
258
+ dataSource: r
223
259
  };
224
260
  }
225
261
  export {
226
- ke as usePanelSelectSchemas
262
+ He as usePanelSelectSchemas
227
263
  };