@dazhicheng/ui 1.6.8 → 1.6.10

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.
@@ -1,7 +1,7 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
3
  import { isFunction as y } from "../../../../packages/utils/src/is.js";
4
- import { computed as p, ref as w, toRaw as te, unref as re, nextTick as ne } from "vue";
4
+ import { computed as m, ref as w, toRaw as re, unref as ne, nextTick as ie } from "vue";
5
5
  import "dayjs";
6
6
  import "numeral";
7
7
  import "xe-utils";
@@ -12,10 +12,11 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
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 { get as o, cloneDeep as ie, omit as le } from "lodash-es";
16
- import { pinyin as ae } from "pinyin-pro";
17
- function Ae(l) {
18
- const T = p(() => {
15
+ import { get as o, cloneDeep as le, omit as ae } from "lodash-es";
16
+ import { pinyin as oe } from "pinyin-pro";
17
+ import { splitPanelSelectText as se } from "../common.js";
18
+ function Se(l) {
19
+ const T = m(() => {
19
20
  const e = l.treeConfig || {};
20
21
  return {
21
22
  transform: e.transform,
@@ -26,39 +27,39 @@ function Ae(l) {
26
27
  parentField: e.parentField ?? "pid",
27
28
  rootParentValue: e.rootParentValue ?? null
28
29
  };
29
- }), b = w(!1), A = w([]), C = w(!1), P = w(!1), M = p(() => te(y(l.api) ? A.value : l.options || [])), S = p(() => R(M.value)), x = p(() => !k() && l.showPinyinMode ? $(O.value) : L(S.value)), N = p(() => q(S.value)), B = p(() => N.value.filter((e) => {
30
+ }), F = w(!1), A = w([]), C = w(!1), P = w(!1), S = m(() => re(y(l.api) ? A.value : l.options || [])), M = m(() => R(S.value)), I = m(() => !D() && l.showPinyinMode ? $(O.value) : G(M.value)), N = m(() => q(M.value)), B = m(() => N.value.filter((e) => {
30
31
  var t;
31
32
  return (t = e.children) == null ? void 0 : t.length;
32
- })), O = p(() => N.value.filter((e) => e.children === void 0));
33
- async function G() {
33
+ })), O = m(() => N.value.filter((e) => e.children === void 0));
34
+ async function k() {
34
35
  if (!(!l.api || !y(l.api))) {
35
- if (b.value) {
36
+ if (F.value) {
36
37
  C.value = !0;
37
38
  return;
38
39
  }
39
40
  A.value = [];
40
41
  try {
41
- b.value = !0;
42
- let e = re(l.params);
43
- l.beforeFetch && y(l.beforeFetch) && (e = await l.beforeFetch(ie(e)) || e);
42
+ F.value = !0;
43
+ let e = ne(l.params);
44
+ l.beforeFetch && y(l.beforeFetch) && (e = await l.beforeFetch(le(e)) || e);
44
45
  let t = await l.api(e);
45
46
  l.afterFetch && y(l.afterFetch) && (t = await l.afterFetch(t) || t), P.value = !0, A.value = Array.isArray(t) ? t : o(t, l.resultField || "") || [];
46
47
  } catch {
47
48
  P.value = !1;
48
49
  } finally {
49
- b.value = !1, C.value && (C.value = !1, await ne(), G());
50
+ F.value = !1, C.value && (C.value = !1, await ie(), k());
50
51
  }
51
52
  }
52
53
  }
53
54
  function R(e) {
54
- const { childrenField: t, transform: r, valueField: n, labelField: i, disabledField: s, parentField: u } = T.value, f = e.some((a) => Array.isArray(o(a, t))), m = e.some((a) => {
55
+ const { childrenField: t, transform: r, valueField: n, labelField: i, disabledField: s, parentField: u } = T.value, f = e.some((a) => Array.isArray(o(a, t))), p = e.some((a) => {
55
56
  const d = o(a, t);
56
57
  return Array.isArray(d) && d.length > 0;
57
- }), F = f || m ? e : r ? U(e) : e, g = [i, n, s, t].filter(
58
+ }), b = f || p ? e : r ? U(e) : e, g = [i, n, s, t].filter(
58
59
  (a) => !!a
59
- ), X = g.some((a) => a.includes("."));
60
- function Y(a) {
61
- if (X) return le(a, g);
60
+ ), Y = g.some((a) => a.includes("."));
61
+ function Z(a) {
62
+ if (Y) return ae(a, g);
62
63
  const d = {};
63
64
  for (const c in a)
64
65
  g.includes(c) || (d[c] = a[c]);
@@ -66,41 +67,41 @@ function Ae(l) {
66
67
  }
67
68
  function _(a, d = 0, c) {
68
69
  return a.map((h) => {
69
- const Z = o(h, n), z = o(h, t), ee = Array.isArray(z), v = {
70
- ...Y(h),
70
+ const ee = o(h, n), x = o(h, t), te = Array.isArray(x), v = {
71
+ ...Z(h),
71
72
  label: String(o(h, i) ?? ""),
72
- value: Z,
73
+ value: ee,
73
74
  disabled: !!o(h, s),
74
75
  pid: (c == null ? void 0 : c.value) ?? o(h, u),
75
76
  level: d,
76
77
  path: [],
77
78
  raw: h
78
79
  };
79
- if (v.path = c ? [...c.path, v] : [v], ee) {
80
- const I = z;
81
- v.children = I.length ? _(I, d + 1, v) : [];
80
+ if (v.path = c ? [...c.path, v] : [v], te) {
81
+ const z = x;
82
+ v.children = z.length ? _(z, d + 1, v) : [];
82
83
  } else
83
84
  v.children = void 0;
84
85
  return v;
85
86
  });
86
87
  }
87
- return _(F);
88
+ return _(b);
88
89
  }
89
90
  function U(e) {
90
91
  const t = /* @__PURE__ */ new Map(), r = [], { childrenField: n, valueField: i, parentField: s, rootParentValue: u } = T.value;
91
92
  return e.forEach((f) => {
92
- const m = o(f, i);
93
- t.set(m, { ...f });
93
+ const p = o(f, i);
94
+ t.set(p, { ...f });
94
95
  }), t.forEach((f) => {
95
- const m = o(f, s), F = m === u ? void 0 : t.get(m);
96
- if (F) {
97
- const g = o(F, n) || [];
98
- g.push(f), F[n] = g;
96
+ const p = o(f, s), b = p === u ? void 0 : t.get(p);
97
+ if (b) {
98
+ const g = o(b, n) || [];
99
+ g.push(f), b[n] = g;
99
100
  } else
100
101
  r.push(f);
101
102
  }), r;
102
103
  }
103
- function L(e) {
104
+ function G(e) {
104
105
  return e.filter((t) => {
105
106
  var r;
106
107
  return (r = t.children) == null ? void 0 : r.length;
@@ -111,7 +112,7 @@ function Ae(l) {
111
112
  children: (r = t.children) != null && r.some((n) => {
112
113
  var i;
113
114
  return (i = n.children) == null ? void 0 : i.length;
114
- }) ? L(t.children) : void 0
115
+ }) ? G(t.children) : void 0
115
116
  };
116
117
  });
117
118
  }
@@ -138,16 +139,22 @@ function Ae(l) {
138
139
  }
139
140
  return t;
140
141
  }
141
- function D(e, t) {
142
- const r = t.trim().toLowerCase();
143
- return r ? e.filter((n) => n.label.toLowerCase().includes(r)) : e;
142
+ function j(e) {
143
+ return se(e, l.separator).map((t) => t.toLowerCase());
144
144
  }
145
- function j(e, t) {
146
- const r = D(e, t);
147
- return l.showOriginMode ? J(r) : l.showPinyinMode ? K(r) : k() ? H(r) : E(r);
145
+ function L(e, t) {
146
+ const r = j(t);
147
+ return r.length ? e.filter((n) => {
148
+ const i = n.label.toLowerCase();
149
+ return r.some((s) => i.includes(s));
150
+ }) : e;
148
151
  }
149
- function k() {
150
- const { childrenField: e, transform: t } = T.value, r = M.value.some((s) => Array.isArray(o(s, e))), n = M.value.some((s) => {
152
+ function H(e, t) {
153
+ const r = L(e, t);
154
+ return l.showOriginMode ? Q(r) : l.showPinyinMode ? K(r) : D() ? J(r) : E(r);
155
+ }
156
+ function D() {
157
+ const { childrenField: e, transform: t } = T.value, r = S.value.some((s) => Array.isArray(o(s, e))), n = S.value.some((s) => {
151
158
  const u = o(s, e);
152
159
  return Array.isArray(u) && !!u.length;
153
160
  });
@@ -160,10 +167,10 @@ function Ae(l) {
160
167
  u.options.push(r), t.set(i, u);
161
168
  }), Array.from(t.values());
162
169
  }
163
- function H(e) {
170
+ function J(e) {
164
171
  return E(e);
165
172
  }
166
- function J(e) {
173
+ function Q(e) {
167
174
  return e.length ? [
168
175
  {
169
176
  value: "__origin__",
@@ -175,35 +182,35 @@ function Ae(l) {
175
182
  function K(e) {
176
183
  const t = /* @__PURE__ */ new Map();
177
184
  return e.forEach((r) => {
178
- const n = Q(r.label), i = t.get(n) || { value: n, label: n.toUpperCase(), options: [] };
185
+ const n = W(r.label), i = t.get(n) || { value: n, label: n.toUpperCase(), options: [] };
179
186
  i.options.push(r), t.set(n, i);
180
187
  }), Array.from(t.values()).sort((r, n) => String(r.value).localeCompare(String(n.value)));
181
188
  }
182
189
  const V = /* @__PURE__ */ new Map();
183
- function Q(e) {
190
+ function W(e) {
184
191
  const t = V.get(e);
185
192
  if (t !== void 0) return t;
186
- const r = W(e);
193
+ const r = X(e);
187
194
  return V.set(e, r), r;
188
195
  }
189
- function W(e) {
196
+ function X(e) {
190
197
  const t = String(e || "").trim(), r = t.charAt(0).toLowerCase();
191
198
  if (/^[a-z]$/.test(r)) return r;
192
- const i = String(ae(t, { pattern: "initial" })).replace(/\s+/g, "").charAt(0).toLowerCase();
199
+ const i = String(oe(t, { pattern: "initial" })).replace(/\s+/g, "").charAt(0).toLowerCase();
193
200
  return /^[a-z]$/.test(i) ? i : "#";
194
201
  }
195
202
  return {
196
- loading: b,
197
- fetchApi: G,
198
- treeOptions: S,
199
- navTreeOptions: x,
203
+ loading: F,
204
+ fetchApi: k,
205
+ treeOptions: M,
206
+ navTreeOptions: I,
200
207
  navNodes: B,
201
208
  leafNodes: O,
202
- filterNodes: D,
203
- buildOptionGroups: j,
209
+ filterNodes: L,
210
+ buildOptionGroups: H,
204
211
  isFirstLoaded: P
205
212
  };
206
213
  }
207
214
  export {
208
- Ae as usePanelSelectData
215
+ Se as usePanelSelectData
209
216
  };
@@ -17,8 +17,10 @@ export declare function usePanelSelectSelection(params: UsePanelSelectSelectionP
17
17
  selectedValueSet: import('vue').ComputedRef<Set<PanelSelectValue>>;
18
18
  isAllChecked: import('vue').ComputedRef<boolean>;
19
19
  isIndeterminate: import('vue').ComputedRef<boolean>;
20
- isGroupChecked: (group: OptionGroup) => boolean;
21
- isGroupIndeterminate: (group: OptionGroup) => boolean;
20
+ getGroupCheckCount: (group: OptionGroup) => {
21
+ enabledCount: number;
22
+ checkedCount: number;
23
+ };
22
24
  handleGroupCheck: (group: OptionGroup, checked: boolean) => void;
23
25
  handleAllOptionCheck: (checked: boolean) => void;
24
26
  handleOptionCheck: (value: PanelSelectValue, checked: boolean) => void;
@@ -1,9 +1,9 @@
1
- import { computed as u, unref as l } from "vue";
2
- function L(p) {
3
- const { multiple: s, modelValue: d, selectedValues: a, leafNodes: h, allValue: r } = p, i = u(() => new Set(l(a))), m = u(() => {
4
- const e = l(i), n = l(h).filter((t) => e.has(t.value));
5
- if (e.has(l(r))) {
6
- const t = l(r);
1
+ import { computed as u, unref as n } from "vue";
2
+ function z(k) {
3
+ const { multiple: d, modelValue: s, selectedValues: a, leafNodes: h, allValue: c } = k, i = u(() => new Set(n(a))), p = u(() => {
4
+ const e = n(i), l = n(h).filter((t) => e.has(t.value));
5
+ if (e.has(n(c))) {
6
+ const t = n(c);
7
7
  return [
8
8
  {
9
9
  label: "全部",
@@ -12,113 +12,114 @@ function L(p) {
12
12
  path: [],
13
13
  raw: { label: "全部", value: t }
14
14
  },
15
- ...n
15
+ ...l
16
16
  ];
17
17
  }
18
- return n;
19
- }), v = u(
20
- () => l(h).filter((e) => !e.disabled).map((e) => e.value)
21
- );
22
- function f(e) {
23
- const n = l(i);
18
+ return l;
19
+ }), f = u(() => {
20
+ const e = [];
21
+ return n(h).forEach((l) => {
22
+ l.disabled || e.push(l.value);
23
+ }), e;
24
+ });
25
+ function C(e) {
26
+ const l = n(i);
24
27
  let t = 0;
25
28
  return e.forEach((o) => {
26
- n.has(o) && (t += 1);
29
+ l.has(o) && (t += 1);
27
30
  }), t;
28
31
  }
29
- const k = u(() => {
30
- const e = l(v);
31
- return e.length > 0 && f(e) === e.length;
32
- }), C = u(() => {
33
- const e = l(v), n = f(e);
34
- return n > 0 && n < e.length;
32
+ const v = u(() => C(n(f))), m = u(() => {
33
+ const e = n(f).length;
34
+ return e > 0 && n(v) === e;
35
+ }), b = u(() => {
36
+ const e = n(v);
37
+ return e > 0 && e < n(f).length;
35
38
  });
36
- function g(e) {
37
- const n = e.options.filter((t) => !t.disabled).map((t) => t.value);
38
- return n.length > 0 && f(n) === n.length;
39
- }
40
39
  function w(e) {
41
- const n = e.options.filter((o) => !o.disabled).map((o) => o.value), t = f(n);
42
- return n.length > 0 && t > 0 && t < n.length;
40
+ const l = n(i);
41
+ let t = 0, o = 0;
42
+ return e.options.forEach((r) => {
43
+ r.disabled || (t += 1, l.has(r.value) && (o += 1));
44
+ }), { enabledCount: t, checkedCount: o };
43
45
  }
44
- function A(e, n) {
45
- const t = e.options.filter((c) => !c.disabled).map((c) => c.value);
46
+ function A(e, l) {
47
+ const t = e.options.filter((r) => !r.disabled).map((r) => r.value);
46
48
  if (!t.length) return;
47
- if (!l(s)) {
48
- d.value = n ? t[0] : void 0;
49
+ if (!n(d)) {
50
+ s.value = l ? t[0] : void 0;
49
51
  return;
50
52
  }
51
- const o = new Set(l(a));
52
- o.delete(l(r)), t.forEach((c) => n ? o.add(c) : o.delete(c)), a.value = Array.from(o);
53
+ const o = new Set(n(a));
54
+ o.delete(n(c)), t.forEach((r) => l ? o.add(r) : o.delete(r)), a.value = Array.from(o);
53
55
  }
54
56
  function V(e) {
55
- if (!l(s)) {
56
- d.value = e ? l(r) : void 0;
57
+ if (!n(d)) {
58
+ s.value = e ? n(c) : void 0;
57
59
  return;
58
60
  }
59
- a.value = e ? [l(r)] : [];
61
+ a.value = e ? [n(c)] : [];
60
62
  }
61
- function b(e, n) {
62
- if (!l(s)) {
63
- d.value = n ? e : void 0;
63
+ function E(e, l) {
64
+ if (!n(d)) {
65
+ s.value = l ? e : void 0;
64
66
  return;
65
67
  }
66
- const t = new Set(l(a));
67
- t.delete(l(r)), n ? t.add(e) : t.delete(e), a.value = Array.from(t);
68
+ const t = new Set(n(a));
69
+ t.delete(n(c)), l ? t.add(e) : t.delete(e), a.value = Array.from(t);
68
70
  }
69
- function y(e, n) {
71
+ function g(e, l) {
70
72
  if (!e.length) return;
71
- if (!l(s)) {
72
- d.value = n ? e.at(-1) : void 0;
73
+ if (!n(d)) {
74
+ s.value = l ? e.at(-1) : void 0;
73
75
  return;
74
76
  }
75
- const t = new Set(l(a));
76
- t.delete(l(r)), e.forEach((o) => n ? t.add(o) : t.delete(o)), a.value = Array.from(t);
77
+ const t = new Set(n(a));
78
+ t.delete(n(c)), e.forEach((o) => l ? t.add(o) : t.delete(o)), a.value = Array.from(t);
77
79
  }
78
- function E(e) {
79
- const n = l(v), t = new Set(l(a));
80
- t.delete(l(r)), n.forEach((o) => e ? t.add(o) : t.delete(o)), a.value = Array.from(t);
80
+ function y(e) {
81
+ const l = n(f), t = new Set(n(a));
82
+ t.delete(n(c)), l.forEach((o) => e ? t.add(o) : t.delete(o)), a.value = Array.from(t);
81
83
  }
82
84
  const S = u(() => {
83
- const e = l(i), n = /* @__PURE__ */ new Set();
84
- return l(h).forEach((t) => {
85
- t.disabled && e.has(t.value) && n.add(t.value);
86
- }), n;
85
+ const e = n(i), l = /* @__PURE__ */ new Set();
86
+ return n(h).forEach((t) => {
87
+ t.disabled && e.has(t.value) && l.add(t.value);
88
+ }), l;
87
89
  });
88
90
  function O() {
89
- const e = Array.from(l(S));
90
- if (!l(s)) {
91
- d.value = e.length ? e[0] : void 0;
91
+ const e = Array.from(n(S));
92
+ if (!n(d)) {
93
+ s.value = e.length ? e[0] : void 0;
92
94
  return;
93
95
  }
94
96
  a.value = e;
95
97
  }
96
- function G(e) {
97
- l(S).has(e) || (a.value = l(a).filter((n) => n !== e));
98
- }
99
98
  function x(e) {
100
- const n = l(S);
101
- if (!n.size) return e;
99
+ n(S).has(e) || (a.value = n(a).filter((l) => l !== e));
100
+ }
101
+ function G(e) {
102
+ const l = n(S);
103
+ if (!l.size) return e;
102
104
  const t = new Set(e);
103
- return n.forEach((o) => t.add(o)), Array.from(t);
105
+ return l.forEach((o) => t.add(o)), Array.from(t);
104
106
  }
105
107
  return {
106
- selectedOptions: m,
108
+ selectedOptions: p,
107
109
  selectedValueSet: i,
108
- isAllChecked: k,
109
- isIndeterminate: C,
110
- isGroupChecked: g,
111
- isGroupIndeterminate: w,
110
+ isAllChecked: m,
111
+ isIndeterminate: b,
112
+ getGroupCheckCount: w,
112
113
  handleGroupCheck: A,
113
114
  handleAllOptionCheck: V,
114
- handleOptionCheck: b,
115
- handleOptionsCheck: y,
116
- handleCheckAll: E,
115
+ handleOptionCheck: E,
116
+ handleOptionsCheck: g,
117
+ handleCheckAll: y,
117
118
  clearSelected: O,
118
- removeSelected: G,
119
- withLockedSelectedValues: x
119
+ removeSelected: x,
120
+ withLockedSelectedValues: G
120
121
  };
121
122
  }
122
123
  export {
123
- L as usePanelSelectSelection
124
+ z as usePanelSelectSelection
124
125
  };
@@ -34,7 +34,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
34
34
  alwaysLoad: boolean;
35
35
  leftPlaceholder: string;
36
36
  pasteSearch: boolean;
37
- separator: string;
37
+ separator: import('./types').PanelSelectSeparator;
38
38
  middlePlaceholder: string;
39
39
  showNav: boolean;
40
40
  showAllField: PanelSelectValue;
@@ -52,6 +52,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
52
52
  onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
53
53
  }>, {
54
54
  scrollToGroup: (groupValue: PanelSelectValue) => Promise<void>;
55
+ inputFocus: () => void;
55
56
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
56
57
  "update:keyword": (value: string) => any;
57
58
  checkAll: (checked: boolean) => any;
@@ -63,7 +64,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
63
64
  disabled: boolean;
64
65
  scrollToGroupValue: PanelSelectValue;
65
66
  pasteSearch: boolean;
66
- separator: string;
67
+ separator: import('./types').PanelSelectSeparator;
67
68
  }, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
68
69
  searchInputRef: ({
69
70
  $: import('vue').ComponentInternalInstance;
@@ -398,11 +399,12 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
398
399
  onOptionsCheck?: ((values: PanelSelectValue[], checked: boolean) => any) | undefined;
399
400
  }>, {
400
401
  scrollToGroup: (groupValue: PanelSelectValue) => Promise<void>;
402
+ inputFocus: () => void;
401
403
  }, {}, {}, {}, {
402
404
  disabled: boolean;
403
405
  scrollToGroupValue: PanelSelectValue;
404
406
  pasteSearch: boolean;
405
- separator: string;
407
+ separator: import('./types').PanelSelectSeparator;
406
408
  }> | null;
407
409
  }, HTMLDivElement>;
408
410
  export default _default;