@dazhicheng/ui 1.5.246 → 1.5.247

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.
@@ -44,6 +44,8 @@ export interface PanelSelectFieldConfig {
44
44
  dependencies?: TtFormSchema["dependencies"];
45
45
  onChange?: (value: unknown, context: PanelSelectFieldOnChangeContext) => void;
46
46
  rules?: TtFormSchema["rules"];
47
+ /** 表单项描述,透传到 TtFormSchema.description */
48
+ description?: TtFormSchema["description"];
47
49
  /** 与另一字段互斥:填对方的 fieldName */
48
50
  mutexWith?: string;
49
51
  /** 同 code 数据源的排除字段联动 */
@@ -1,6 +1,6 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
- import { isFunction as H } from "../packages/utils/src/is.js";
3
+ import { isFunction as Q } from "../packages/utils/src/is.js";
4
4
  import "vue";
5
5
  import "xe-utils";
6
6
  import "dayjs";
@@ -11,120 +11,125 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
11
11
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
12
12
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
13
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
- import { omit as L } from "lodash-es";
15
- import { CODE_REGISTRY as ne, resolveDefaultGroupBy as oe, GROUP_BY as re, groupBasicDataOptions as $ } from "./basicDataCodes.js";
16
- import { useBasicDataOptions as se } from "./useBasicDataOptions.js";
17
- const b = "all";
14
+ import { omit as _ } from "lodash-es";
15
+ import { CODE_REGISTRY as oe, resolveDefaultGroupBy as re, GROUP_BY as se, groupBasicDataOptions as z } from "./basicDataCodes.js";
16
+ import { useBasicDataOptions as ce } from "./useBasicDataOptions.js";
17
+ const N = "all";
18
18
  function d(t) {
19
19
  return Array.isArray(t) ? t : t == null || t === "" ? [] : [t];
20
20
  }
21
- function ce(t, n = b) {
21
+ function le(t, n = N) {
22
22
  return t === n ? !0 : typeof t == "string" && typeof n == "string" && t.toLowerCase() === String(n).toLowerCase();
23
23
  }
24
- function le(t, n = b) {
25
- return d(t).some((r) => ce(r, n));
24
+ function pe(t, n = N) {
25
+ return d(t).some((r) => le(r, n));
26
26
  }
27
- function pe(t) {
27
+ function ue(t) {
28
28
  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("");
29
29
  }
30
- function z(t, n, r, c) {
31
- return t ? H(t) ? t(n, r, c) : t : {};
30
+ function K(t, n) {
31
+ const r = "支持多选和全选", s = typeof t == "string" && t.trim() ? t.trim().replace(/[,,]\s*$/, "") : "请选择";
32
+ return s.includes(r) ? s : `${s},${r}`;
32
33
  }
33
- function K(t, n, r, c) {
34
+ function V(t, n, r, s) {
35
+ return t ? Q(t) ? t(n, r, s) : t : {};
36
+ }
37
+ function j(t, n, r, s) {
34
38
  const p = new Set(r.map((e) => e.value)), l = t[n];
35
- if (c) {
36
- const e = d(l).filter((u) => p.has(u)), s = d(l);
37
- (e.length !== s.length || e.some((u, g) => u !== s[g])) && (t[n] = e);
39
+ if (s) {
40
+ const e = d(l).filter((u) => p.has(u)), c = d(l);
41
+ (e.length !== c.length || e.some((u, F) => u !== c[F])) && (t[n] = e);
38
42
  return;
39
43
  }
40
44
  l == null || l === "" || p.has(l) || (t[n] = void 0);
41
45
  }
42
- function V(t, n, r, c, p, l) {
43
- const e = l ? p.filter((s) => d(r[n]).includes(s.value)) : p.find((s) => s.value === r[n]);
46
+ function q(t, n, r, s, p, l) {
47
+ const e = l ? p.filter((c) => d(r[n]).includes(c.value)) : p.find((c) => c.value === r[n]);
44
48
  return {
45
49
  values: r,
46
- actions: c,
50
+ actions: s,
47
51
  fieldName: n,
48
52
  code: t,
49
53
  options: p,
50
54
  currentOption: e
51
55
  };
52
56
  }
53
- function j(t, n, r) {
54
- const c = d(t);
55
- if (!c.length) return [];
56
- if (le(t, r)) return n;
57
- const p = new Set(c);
57
+ function Z(t, n, r) {
58
+ const s = d(t);
59
+ if (!s.length) return [];
60
+ if (pe(t, r)) return n;
61
+ const p = new Set(s);
58
62
  return n.filter((l) => p.has(l.value));
59
63
  }
60
- function q(t, n) {
64
+ function H(t, n) {
61
65
  const r = new Set(d(t));
62
- return r.size ? n.filter((c) => !r.has(c.value)) : n;
66
+ return r.size ? n.filter((s) => !r.has(s.value)) : n;
63
67
  }
64
- function Z(t, n) {
65
- var c;
66
- const r = (c = t.value) == null ? void 0 : c[n];
68
+ function J(t, n) {
69
+ var s;
70
+ const r = (s = t.value) == null ? void 0 : s[n];
67
71
  return Array.isArray(r) ? r : [];
68
72
  }
69
- function Ee(t, n = {}) {
70
- const r = [...new Set(t.map((e) => e.code))], c = t.reduce(
71
- (e, s) => (e[s.code] = (e[s.code] || 0) + 1, e),
73
+ function Me(t, n = {}) {
74
+ const r = [...new Set(t.map((e) => e.code))], s = t.reduce(
75
+ (e, c) => (e[c.code] = (e[c.code] || 0) + 1, e),
72
76
  {}
73
- ), { dataSource: p } = se({
77
+ ), { dataSource: p } = ce({
74
78
  codes: r,
75
79
  dataSource: n.dataSource
76
80
  }), l = {};
77
81
  return t.forEach((e) => {
78
- var U;
79
- const s = ne[e.code], u = e.fieldName || s.defaultFieldName, g = e.key || ((c[e.code] || 0) > 1 ? u : e.code), _ = e.label || s.defaultLabel, k = e.multiple ?? s.defaultMultiple, J = e.showAll ?? s.defaultShowAll, E = e.showAllField ?? b, m = e.mutexWith, T = oe(e.code, e.groupBy), F = T !== re.PINYIN, P = s.defaultTreeConfig, G = !!P, I = s.defaultShowNav ?? !1, Q = [
82
+ var R;
83
+ const c = oe[e.code], u = e.fieldName || c.defaultFieldName, F = e.key || ((s[e.code] || 0) > 1 ? u : e.code), $ = e.label || c.defaultLabel, E = e.multiple ?? c.defaultMultiple, X = e.showAll ?? c.defaultShowAll, M = e.showAllField ?? N, m = e.mutexWith, T = re(e.code, e.groupBy), O = T !== se.PINYIN, S = c.defaultTreeConfig, k = !!S, G = c.defaultShowNav ?? !1, f = [
80
84
  ...m ? [m] : [],
81
- ...((U = e.dependencies) == null ? void 0 : U.triggerFields) || []
82
- ], R = [...new Set(Q)], X = L(e.dependencies || {}, ["triggerFields"]), v = R.length ? {
83
- ...X,
84
- triggerFields: R
85
- } : e.dependencies, M = {
85
+ ...((R = e.dependencies) == null ? void 0 : R.triggerFields) || []
86
+ ], I = [...new Set(f)], v = _(e.dependencies || {}, ["triggerFields"]), C = I.length ? {
87
+ ...v,
88
+ triggerFields: I
89
+ } : e.dependencies, B = {
86
90
  component: "TtPanelSelect",
87
91
  fieldName: u,
88
- label: _,
92
+ label: $,
89
93
  rules: e.rules,
90
- dependencies: v,
94
+ dependencies: C,
91
95
  componentProps: (o, x) => {
92
- const A = Z(p, e.code);
93
- let a = m ? q(o[m], A) : A;
94
- H(e.customOptions) && (a = e.customOptions(o, a) || []);
95
- const O = F ? $(a, T) : a, B = z(e.componentProps, o, x, a), { onChange: W, ...S } = B;
96
+ const A = J(p, e.code);
97
+ let a = m ? H(o[m], A) : A;
98
+ Q(e.customOptions) && (a = e.customOptions(o, a) || []);
99
+ const g = O ? z(a, T) : a, D = V(e.componentProps, o, x, a), { onChange: U, ...w } = D;
96
100
  return {
97
- multiple: k,
98
- showAll: J,
99
- showAllField: E,
100
- showNav: I,
101
+ multiple: E,
102
+ showAll: X,
103
+ showAllField: M,
104
+ showNav: G,
101
105
  showOriginMode: !1,
102
- showPinyinMode: G ? !1 : !F,
103
- ...P ? { treeConfig: P } : {},
104
- ...S,
105
- options: O,
106
- onChange(w) {
107
- var y;
106
+ showPinyinMode: k ? !1 : !O,
107
+ ...S ? { treeConfig: S } : {},
108
+ ...w,
109
+ ...E ? { placeholder: K(w.placeholder) } : {},
110
+ options: g,
111
+ onChange(y) {
112
+ var P;
108
113
  if (m) {
109
- const i = Array.isArray(o[m]), h = q(w, A);
110
- K(o, m, h, i);
114
+ const i = Array.isArray(o[m]), h = H(y, A);
115
+ j(o, m, h, i);
111
116
  }
112
117
  if (e.exclude) {
113
- const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, D = j(w, A, E);
114
- d(w).length ? K(o, i, D, h) : o[i] = h ? [] : void 0;
118
+ const i = e.exclude.fieldName, h = e.exclude.multiple ?? !0, L = Z(y, A, M);
119
+ d(y).length ? j(o, i, L, h) : o[i] = h ? [] : void 0;
115
120
  }
116
- (y = e.onChange) == null || y.call(
121
+ (P = e.onChange) == null || P.call(
117
122
  e,
118
- w,
119
- V(e.code, u, o, x, a, k)
123
+ y,
124
+ q(e.code, u, o, x, a, E)
120
125
  );
121
126
  }
122
127
  };
123
128
  }
124
129
  };
125
- if (l[g] = {
126
- ...M,
127
- ...L(e, [
130
+ if (l[F] = {
131
+ ...B,
132
+ ..._(e, [
128
133
  "code",
129
134
  "key",
130
135
  "fieldName",
@@ -142,48 +147,50 @@ function Ee(t, n = {}) {
142
147
  "customOptions"
143
148
  ]),
144
149
  fieldName: u,
145
- label: _,
150
+ label: $,
146
151
  rules: e.rules,
147
- dependencies: M.dependencies,
148
- componentProps: M.componentProps,
152
+ description: e.description,
153
+ dependencies: B.dependencies,
154
+ componentProps: B.componentProps,
149
155
  component: "TtPanelSelect"
150
156
  }, e.exclude) {
151
- const o = e.exclude, x = o.fieldName, A = o.key || `exclude${pe(g)}`, a = o.label || s.defaultExcludeLabel, O = o.multiple ?? !0, B = o.showAll ?? !1, W = o.showAllField ?? b, S = o.dependencies || {}, w = {
152
- ...S,
153
- triggerFields: S.triggerFields ?? [u],
154
- if: S.if ?? ((i) => d(i[u]).length > 0)
155
- }, y = {
157
+ const o = e.exclude, x = o.fieldName, A = o.key || `exclude${ue(F)}`, a = o.label || c.defaultExcludeLabel, g = o.multiple ?? !0, D = o.showAll ?? !1, U = o.showAllField ?? N, w = o.dependencies || {}, y = {
158
+ ...w,
159
+ triggerFields: w.triggerFields ?? [u],
160
+ if: w.if ?? ((i) => d(i[u]).length > 0)
161
+ }, P = {
156
162
  component: "TtPanelSelect",
157
163
  fieldName: x,
158
164
  label: a,
159
165
  rules: o.rules,
160
- dependencies: w,
166
+ dependencies: y,
161
167
  componentProps: (i, h) => {
162
- const D = Z(p, e.code), N = j(i[u], D, E), f = F ? $(N, T) : N, C = z(o.componentProps, i, h, N), { onChange: ue, ...ee } = C;
168
+ const L = J(p, e.code), b = Z(i[u], L, M), ee = O ? z(b, T) : b, te = V(o.componentProps, i, h, b), { onChange: ie, ...W } = te;
163
169
  return {
164
- multiple: O,
165
- showAll: B,
166
- showAllField: W,
167
- showNav: I,
170
+ multiple: g,
171
+ showAll: D,
172
+ showAllField: U,
173
+ showNav: G,
168
174
  showOriginMode: !1,
169
- showPinyinMode: G ? !1 : !F,
170
- ...P ? { treeConfig: P } : {},
171
- ...ee,
172
- options: f,
173
- onChange(te) {
175
+ showPinyinMode: k ? !1 : !O,
176
+ ...S ? { treeConfig: S } : {},
177
+ ...W,
178
+ ...g ? { placeholder: K(W.placeholder) } : {},
179
+ options: ee,
180
+ onChange(ne) {
174
181
  var Y;
175
182
  (Y = o.onChange) == null || Y.call(
176
183
  o,
177
- te,
178
- V(e.code, x, i, h, N, O)
184
+ ne,
185
+ q(e.code, x, i, h, b, g)
179
186
  );
180
187
  }
181
188
  };
182
189
  }
183
190
  };
184
191
  l[A] = {
185
- ...y,
186
- ...L(o, [
192
+ ...P,
193
+ ..._(o, [
187
194
  "fieldName",
188
195
  "label",
189
196
  "key",
@@ -198,8 +205,8 @@ function Ee(t, n = {}) {
198
205
  fieldName: x,
199
206
  label: a,
200
207
  rules: o.rules,
201
- dependencies: y.dependencies,
202
- componentProps: y.componentProps,
208
+ dependencies: P.dependencies,
209
+ componentProps: P.componentProps,
203
210
  component: "TtPanelSelect"
204
211
  };
205
212
  }
@@ -209,5 +216,5 @@ function Ee(t, n = {}) {
209
216
  };
210
217
  }
211
218
  export {
212
- Ee as usePanelSelectSchemas
219
+ Me as usePanelSelectSchemas
213
220
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.246",
3
+ "version": "1.5.247",
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/utils": "1.3.43",
71
- "@dazhicheng/hooks": "1.4.46"
70
+ "@dazhicheng/utils": "1.3.44",
71
+ "@dazhicheng/hooks": "1.4.47"
72
72
  },
73
73
  "files": [
74
74
  "dist"