@dazhicheng/ui 1.5.217 → 1.5.218

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