@dazhicheng/ui 1.5.218 → 1.5.219

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.
@@ -50,6 +50,8 @@ export interface UseFormSchemasLinkFieldConfig {
50
50
  onChange?: (values: unknown, context: FieldOnChangeContext) => void;
51
51
  /** 是否展示全部选项 */
52
52
  showAll?: boolean;
53
+ /** “全部”选项的值,默认为 "all"。用于自定义“全部”选项对应的 value,与 TtPanelSelect 的 showAllField 对齐 */
54
+ showAllField?: string | number;
53
55
  /**
54
56
  * @description 自定义过滤数据源
55
57
  * @param values 表单对象
@@ -1,6 +1,6 @@
1
- import { useDataPermissionOptions as z } from "./useDataPermissionOptions.js";
1
+ import { useDataPermissionOptions as J } from "./useDataPermissionOptions.js";
2
2
  import "axios";
3
- import { ElSelectV2 as G } from "element-plus";
3
+ import { ElSelectV2 as K } from "element-plus";
4
4
  import { isFunction as x } from "../packages/utils/src/is.js";
5
5
  import "vue";
6
6
  import "xe-utils";
@@ -12,163 +12,173 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
12
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
13
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
14
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
- import { omit as J } from "lodash-es";
16
- const u = "all", K = { label: "全部", value: u }, R = [
15
+ import { omit as Q } from "lodash-es";
16
+ const U = "all", W = { label: "全部", value: U }, R = [
17
17
  "platformId",
18
18
  "shopId",
19
19
  "purchasePlaceId",
20
20
  "businessType",
21
21
  "lockUserId",
22
22
  "userId"
23
- ], Q = {
23
+ ], X = {
24
24
  platformId: "platformIds",
25
25
  shopId: "shopIds",
26
26
  purchasePlaceId: "purchasePlaceId",
27
27
  businessType: "businessType",
28
28
  lockUserId: "lockUserId"
29
- }, W = {
29
+ }, Y = {
30
30
  platformId: "平台",
31
31
  shopId: "店铺",
32
32
  purchasePlaceId: "采购地",
33
33
  businessType: "业务线",
34
34
  lockUserId: "锁单人"
35
35
  };
36
- function M(t) {
37
- return typeof t == "string" && t.toLowerCase() === u.toLowerCase();
36
+ function M(e) {
37
+ return typeof e == "string" && e.toLowerCase() === U.toLowerCase();
38
38
  }
39
- function _(t) {
40
- return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
39
+ function _(e) {
40
+ return Array.isArray(e) ? e : e == null || e === "" ? [] : [e];
41
41
  }
42
- function X(t = []) {
43
- return [K].concat(t);
42
+ function Z(e = []) {
43
+ return [W].concat(e);
44
44
  }
45
- function Y(t, c, i, b) {
46
- return t ? x(t) ? t(c, i, b) : t : {};
45
+ function $(e, l, c, A) {
46
+ return e ? x(e) ? e(l, c, A) : e : {};
47
47
  }
48
- function B(t, c, i, b) {
49
- var A;
50
- c == null || c(t);
51
- const I = b(), f = (A = I.values) == null ? void 0 : A[I.fieldName];
52
- i == null || i(f, I);
48
+ function B(e, l, c, A) {
49
+ var C;
50
+ l == null || l(e);
51
+ const g = A(), u = (C = g.values) == null ? void 0 : C[g.fieldName];
52
+ c == null || c(u, g);
53
53
  }
54
- function Z(t = {}, c = R) {
55
- const i = t.scene || "list", b = c.reduce(
56
- (o, n) => (n === "userId" || (o[n] = a(n).showAll ?? !1), o),
54
+ function y(e = {}, l = R) {
55
+ const c = e.scene || "list", A = l.reduce(
56
+ (o, n) => {
57
+ if (n === "userId") return o;
58
+ const t = I(n), s = t.component === "TtPanelSelect";
59
+ return o[n] = s ? !1 : t.showAll ?? !1, o;
60
+ },
57
61
  {}
58
- ), { dataSource: I } = z({
59
- codes: c,
60
- dataSource: t.dataSource,
61
- showAll: b
62
+ ), { dataSource: g } = J({
63
+ codes: l,
64
+ dataSource: e.dataSource,
65
+ showAll: A
62
66
  });
63
- function f(o) {
64
- return a(o).fieldName || Q[o];
67
+ function u(o) {
68
+ return I(o).fieldName || X[o];
65
69
  }
66
- function A(o) {
67
- return a(o).rules;
70
+ function C(o) {
71
+ return I(o).rules;
68
72
  }
69
73
  function F(o) {
70
- return a(o).label || W[o];
74
+ return I(o).label || Y[o];
71
75
  }
72
- function a(o) {
76
+ function I(o) {
73
77
  var n;
74
- return ((n = t.fieldConfigs) == null ? void 0 : n[o]) || {};
78
+ return ((n = e.fieldConfigs) == null ? void 0 : n[o]) || {};
79
+ }
80
+ function b(o) {
81
+ return I(o).showAllField ?? U;
75
82
  }
76
- function U(o, n) {
77
- const e = a(o).dependencies;
78
- if (!n) return e;
79
- if (!e) return n;
83
+ function V(o, n) {
84
+ const t = I(o).dependencies;
85
+ if (!n) return t;
86
+ if (!t) return n;
80
87
  const s = {
81
88
  ...n,
82
- ...e
89
+ ...t
83
90
  };
84
- if (n && e) {
85
- const l = n.triggerFields, r = e.triggerFields;
86
- s.triggerFields = r ?? l;
91
+ if (n && t) {
92
+ const f = n.triggerFields, r = t.triggerFields;
93
+ s.triggerFields = r ?? f;
87
94
  }
88
95
  return s;
89
96
  }
90
97
  function O(o) {
91
- return a(o).component || "TtApiComponent";
98
+ return I(o).component || "TtApiComponent";
92
99
  }
93
- function C(o) {
94
- return a(o).multiple ?? !0;
100
+ function S(o) {
101
+ return I(o).multiple ?? !0;
95
102
  }
96
- function N(o) {
97
- return I.value[o] || [];
103
+ function w(o) {
104
+ return g.value[o] || [];
98
105
  }
99
- function V(o) {
106
+ function j(o) {
100
107
  return _(o).some((n) => M(n));
101
108
  }
102
- function L(o) {
103
- const n = V(o), e = Array.isArray(o) ? o.length > 1 : !1;
104
- return i === "action" && (n || e);
109
+ function N(o) {
110
+ const n = j(o), t = Array.isArray(o) ? o.length > 1 : !1;
111
+ return c === "action" && (n || t);
105
112
  }
106
- function j(o) {
107
- const n = N("shopId"), e = _(o);
108
- if (!e.length)
109
- return i === "action" ? [] : n;
110
- if (L(o)) return [];
111
- const s = n.filter((r) => e.includes(r.platformId));
112
- return !s.some((r) => M(r.value)) || s.length <= 1 ? s : X(s.filter((r) => !M(r.value)));
113
+ function q(o) {
114
+ const n = w("shopId"), t = _(o);
115
+ if (!t.length)
116
+ return c === "action" ? [] : n;
117
+ if (N(o)) return [];
118
+ const s = n.filter((r) => t.includes(r.platformId));
119
+ return !s.some((r) => M(r.value)) || s.length <= 1 ? s : Z(s.filter((r) => !M(r.value)));
113
120
  }
114
- function E(o, n, e, s, l) {
115
- const r = f(o), g = l ? s.filter((m) => {
116
- var h;
117
- return (h = n[r]) == null ? void 0 : h.includes(m.value);
118
- }) || [] : s.find((m) => m.value === n[r]);
121
+ function E(o, n, t, s, f) {
122
+ const r = u(o), P = f ? s.filter((i) => {
123
+ var m;
124
+ return (m = n[r]) == null ? void 0 : m.includes(i.value);
125
+ }) || [] : s.find((i) => i.value === n[r]);
119
126
  return {
120
127
  values: n,
121
- actions: e,
128
+ actions: t,
122
129
  fieldName: r,
123
130
  dataType: o,
124
131
  options: s,
125
- currentOption: g
132
+ currentOption: P
126
133
  };
127
134
  }
128
- function k(o, n, e, s, l) {
129
- const r = a(o), g = Y(r.componentProps, n, e, s), m = C(o), { onChange: h, ...d } = g, p = x(r.customOptions) ? r.customOptions(n, s) : s;
135
+ function L(o, n, t, s, f) {
136
+ const r = I(o), P = $(r.componentProps, n, t, s), i = S(o), { onChange: m, ...a } = P, p = x(r.customOptions) ? r.customOptions(n, s) : s;
130
137
  return r.component === "TtPanelSelect" ? {
131
- multiple: m,
138
+ multiple: i,
132
139
  showAll: r.showAll ?? !1,
133
- ...d,
140
+ showAllField: b(o),
141
+ ...a,
134
142
  options: p,
135
- onChange(S) {
143
+ onChange(h) {
136
144
  B(
137
- S,
138
- l,
145
+ h,
146
+ void 0,
139
147
  r.onChange,
140
- () => E(o, n, e, p, m)
148
+ () => E(o, n, t, p, i)
141
149
  );
142
150
  }
143
151
  } : {
144
- multiple: m,
145
- component: G,
146
- ...d,
152
+ multiple: i,
153
+ component: K,
154
+ showOriginMode: !1,
155
+ showPinyinMode: !0,
156
+ ...a,
147
157
  options: p,
148
- onChange(S) {
158
+ onChange(h) {
149
159
  B(
150
- S,
151
- l,
160
+ h,
161
+ f,
152
162
  r.onChange,
153
- () => E(o, n, e, p, m)
163
+ () => E(o, n, t, p, i)
154
164
  );
155
165
  }
156
166
  };
157
167
  }
158
- function w(o) {
159
- const n = f(o);
168
+ function k(o) {
169
+ const n = u(o);
160
170
  return {
161
171
  component: O(o),
162
172
  fieldName: n,
163
173
  label: F(o),
164
- rules: A(o),
165
- dependencies: U(o),
166
- componentProps: (e, s) => {
167
- var h;
168
- const l = N(o), r = f(o), g = C(o), m = ((h = e[r]) == null ? void 0 : h.at(-1)) !== u;
169
- return k(o, e, s, l, (d) => {
170
- const p = e[r];
171
- g && (m && (d == null ? void 0 : d.at(-1)) === u ? e[r] = [u] : e[r] = p == null ? void 0 : p.filter((P) => P !== u));
174
+ rules: C(o),
175
+ dependencies: V(o),
176
+ componentProps: (t, s) => {
177
+ var a;
178
+ const f = w(o), r = u(o), P = S(o), i = b(o), m = ((a = t[r]) == null ? void 0 : a.at(-1)) !== i;
179
+ return L(o, t, s, f, (p) => {
180
+ const d = t[r];
181
+ P && (m && (p == null ? void 0 : p.at(-1)) === i ? t[r] = [i] : t[r] = d == null ? void 0 : d.filter((h) => h !== i));
172
182
  });
173
183
  }
174
184
  };
@@ -177,113 +187,113 @@ function Z(t = {}, c = R) {
177
187
  // 平台
178
188
  platformId: {
179
189
  component: O("platformId"),
180
- fieldName: f("platformId"),
190
+ fieldName: u("platformId"),
181
191
  label: F("platformId"),
182
- rules: A("platformId"),
192
+ rules: C("platformId"),
183
193
  componentProps: (o, n) => {
184
- var d;
185
- const e = "platformId", s = f(e), l = f("shopId"), r = C(e), g = C("shopId"), m = N(e), h = ((d = o[s]) == null ? void 0 : d.at(-1)) !== u;
186
- return k(e, o, n, m, (p) => {
187
- const P = o[s];
188
- r && (h && (p == null ? void 0 : p.at(-1)) === u ? o[s] = [u] : o[s] = P == null ? void 0 : P.filter((S) => S !== u)), o[l] = g ? [] : void 0;
194
+ var p;
195
+ const t = "platformId", s = u(t), f = u("shopId"), r = S(t), P = S("shopId"), i = w(t), m = b(t), a = ((p = o[s]) == null ? void 0 : p.at(-1)) !== m;
196
+ return L(t, o, n, i, (d) => {
197
+ const h = o[s];
198
+ r && (a && (d == null ? void 0 : d.at(-1)) === m ? o[s] = [m] : o[s] = h == null ? void 0 : h.filter((G) => G !== m)), o[f] = P ? [] : void 0;
189
199
  });
190
200
  }
191
201
  },
192
202
  // 店铺
193
203
  shopId: {
194
204
  component: O("shopId"),
195
- fieldName: f("shopId"),
205
+ fieldName: u("shopId"),
196
206
  label: F("shopId"),
197
207
  componentProps: (o, n) => {
198
- var h;
199
- const e = "shopId", s = f(e), l = o[f("platformId")], r = j(l), g = C(e), m = ((h = o[s]) == null ? void 0 : h.at(-1)) !== u;
200
- return k(e, o, n, r, (d) => {
201
- const p = o[s];
202
- g && (m && (d == null ? void 0 : d.at(-1)) === u ? o[s] = [u] : o[s] = p == null ? void 0 : p.filter((P) => P !== u));
208
+ var a;
209
+ const t = "shopId", s = u(t), f = o[u("platformId")], r = q(f), P = S(t), i = b(t), m = ((a = o[s]) == null ? void 0 : a.at(-1)) !== i;
210
+ return L(t, o, n, r, (p) => {
211
+ const d = o[s];
212
+ P && (m && (p == null ? void 0 : p.at(-1)) === i ? o[s] = [i] : o[s] = d == null ? void 0 : d.filter((h) => h !== i));
203
213
  });
204
214
  },
205
- dependencies: U("shopId", {
206
- triggerFields: [f("platformId")],
215
+ dependencies: V("shopId", {
216
+ triggerFields: [u("platformId")],
207
217
  disabled(o) {
208
- return L(o[f("platformId")]);
218
+ return N(o[u("platformId")]);
209
219
  },
210
220
  rules(o) {
211
- return L(o[f("platformId")]) ? null : A("shopId") || null;
221
+ return N(o[u("platformId")]) ? null : C("shopId") || null;
212
222
  }
213
223
  })
214
224
  },
215
- purchasePlaceId: w("purchasePlaceId"),
216
- businessType: w("businessType"),
217
- lockUserId: w("lockUserId")
225
+ purchasePlaceId: k("purchasePlaceId"),
226
+ businessType: k("businessType"),
227
+ lockUserId: k("lockUserId")
218
228
  };
219
- function q() {
229
+ function z() {
220
230
  return Object.keys(D).reduce(
221
231
  (o, n) => {
222
- var l;
223
- const e = D[n], s = (l = t.fieldConfigs) == null ? void 0 : l[n];
232
+ var f;
233
+ const t = D[n], s = (f = e.fieldConfigs) == null ? void 0 : f[n];
224
234
  return o[n] = {
225
- ...e,
226
- ...J(s, ["componentProps", "rules"])
235
+ ...t,
236
+ ...Q(s, ["componentProps", "rules"])
227
237
  }, o;
228
238
  },
229
239
  {}
230
240
  );
231
241
  }
232
242
  return {
233
- ...q(),
234
- dataSource: I
243
+ ...z(),
244
+ dataSource: g
235
245
  };
236
246
  }
237
- function fo() {
238
- const t = {
247
+ function mo() {
248
+ const e = {
239
249
  options: {},
240
250
  codes: [...R]
241
- }, c = {
251
+ }, l = {
242
252
  /**
243
253
  * @description 渲染查询场景
244
254
  */
245
255
  list() {
246
- return t.options.scene = "list", c;
256
+ return e.options.scene = "list", l;
247
257
  },
248
258
  /**
249
259
  * @description 渲染新增编辑场景
250
260
  */
251
261
  action() {
252
- return t.options.scene = "action", c;
262
+ return e.options.scene = "action", l;
253
263
  },
254
264
  /**
255
265
  * @param scene 场景值 list为查询 action为新增编辑等操作
256
266
  * @returns FormSchemasLinkBuilder
257
267
  */
258
- scene(i) {
259
- return t.options.scene = i, c;
268
+ scene(c) {
269
+ return e.options.scene = c, l;
260
270
  },
261
271
  /**
262
272
  * @param codes 接口请求所需要的入参,需要什么数据源就传什么入参
263
273
  * @returns FormSchemasLinkBuilder
264
274
  */
265
- codes(i) {
266
- return t.codes = [...i], c;
275
+ codes(c) {
276
+ return e.codes = [...c], l;
267
277
  },
268
- dataSource(i) {
269
- return t.options.dataSource = i, c;
278
+ dataSource(c) {
279
+ return e.options.dataSource = c, l;
270
280
  },
271
- field(i, b) {
272
- var I;
273
- return t.options.fieldConfigs = {
274
- ...t.options.fieldConfigs,
275
- [i]: {
276
- ...((I = t.options.fieldConfigs) == null ? void 0 : I[i]) || {},
277
- ...b
281
+ field(c, A) {
282
+ var g;
283
+ return e.options.fieldConfigs = {
284
+ ...e.options.fieldConfigs,
285
+ [c]: {
286
+ ...((g = e.options.fieldConfigs) == null ? void 0 : g[c]) || {},
287
+ ...A
278
288
  }
279
- }, c;
289
+ }, l;
280
290
  },
281
291
  build() {
282
- return Z(t.options, t.codes);
292
+ return y(e.options, e.codes);
283
293
  }
284
294
  };
285
- return c;
295
+ return l;
286
296
  }
287
297
  export {
288
- fo as useFormSchemasLink
298
+ mo as useFormSchemasLink
289
299
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.218",
3
+ "version": "1.5.219",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -67,8 +67,8 @@
67
67
  "vue-router": "^5.0.2",
68
68
  "vxe-pc-ui": "^4.12.36",
69
69
  "vxe-table": "^4.17.48",
70
- "@dazhicheng/hooks": "1.4.44",
71
- "@dazhicheng/utils": "1.3.41"
70
+ "@dazhicheng/utils": "1.3.41",
71
+ "@dazhicheng/hooks": "1.4.44"
72
72
  },
73
73
  "files": [
74
74
  "dist"