@unicom-cloud/ui 0.8.91 → 0.8.92

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 (57) hide show
  1. package/Upload.js +4 -4
  2. package/color-picker/Mode.js +6 -7
  3. package/index.js +171 -171
  4. package/package.json +1 -1
  5. package/tree/Node.js +5 -5
  6. package/tree/Tree.js +287 -283
  7. package/types/common/empty/index.d.ts +1 -1
  8. package/types/common/icons/file/index.d.ts +1 -1
  9. package/types/common/space/index.d.ts +1 -1
  10. package/types/pc/anchor/context.d.ts +1 -1
  11. package/types/pc/color-picker/InputHex.d.ts +1 -1
  12. package/types/pc/color-picker/InputRgb.d.ts +1 -1
  13. package/types/pc/color-picker/Mode.d.ts +1 -1
  14. package/types/pc/color-picker/Palette.d.ts +1 -1
  15. package/types/pc/color-picker/utils.d.ts +1 -1
  16. package/types/pc/config-provider/context.d.ts +1 -1
  17. package/types/pc/date-picker/Picker.d.ts +1 -1
  18. package/types/pc/date-picker/RangePicker.d.ts +1 -1
  19. package/types/pc/grid/context.d.ts +1 -1
  20. package/types/pc/grid/util.d.ts +1 -1
  21. package/types/pc/hooks/use-watermark/index.d.ts +1 -1
  22. package/types/pc/icons/file/index.d.ts +1 -1
  23. package/types/pc/input/index.d.ts +1 -1
  24. package/types/pc/message/index.d.ts +1 -2
  25. package/types/pc/message/useMessage.d.ts +1 -1
  26. package/types/pc/notification/useNotification.d.ts +1 -1
  27. package/types/pc/space/index.d.ts +1 -1
  28. package/types/pc/table/ColGroup.d.ts +1 -1
  29. package/types/pc/table/constant.d.ts +1 -1
  30. package/types/pc/tree/Context.d.ts +2 -2
  31. package/types/pc/tree/index.d.ts +1 -1
  32. package/types/pc/tree/interface.d.ts +5 -1
  33. package/types/pc/trigger/getPopupStyle.d.ts +1 -1
  34. package/types/pc/typography/EditContent.d.ts +1 -1
  35. package/types/pc/typography/Ellipsis.d.ts +1 -1
  36. package/types/pc/typography/Paragraph.d.ts +1 -1
  37. package/types/pc/typography/Title.d.ts +1 -1
  38. package/types/pc/upload/Upload.d.ts +2 -2
  39. package/types/pc/upload/constant.d.ts +4 -0
  40. package/types/pc/upload/index.d.ts +2 -0
  41. package/types/pc/upload/interface.d.ts +0 -3
  42. package/types/pc/upload/request.d.ts +1 -1
  43. package/types/pc/upload/util.d.ts +1 -1
  44. package/types/pc/verification-code/VerificationCode.d.ts +1 -1
  45. package/types/pc/verification-code/index.d.ts +1 -1
  46. package/types/pc/watermark/Watermark.d.ts +1 -1
  47. package/types/pc/watermark/index.d.ts +1 -1
  48. package/upload/Upload.js +52 -53
  49. package/upload/Uploader.js +1 -1
  50. package/upload/constant.js +9 -0
  51. package/upload/index.js +4 -4
  52. package/upload/interface.js +1 -9
  53. package/upload/list/PictureItem.js +1 -1
  54. package/upload/list/TextItem.js +1 -1
  55. package/upload/list/UploadProgress.js +1 -1
  56. package/upload/list/index.js +1 -1
  57. package/version/index.js +1 -1
package/tree/Tree.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsx as re } from "react/jsx-runtime";
2
- import { forwardRef as Se, useContext as ve, useRef as S, useState as Te, useImperativeHandle as Ae, useEffect as z, createElement as Ie } from "react";
1
+ import { jsx as se } from "react/jsx-runtime";
2
+ import { forwardRef as Se, useContext as ve, useRef as S, useState as Te, useImperativeHandle as Ae, useEffect as B, createElement as Ie } from "react";
3
3
  import { isEmptyObject as Me } from "@unicom-cloud/utils/is";
4
- import D from "lodash/get";
5
- import B from "lodash/has";
4
+ import E from "lodash/get";
5
+ import q from "lodash/has";
6
6
  import He from "lodash/isArray";
7
- import E from "lodash/isEqualWith";
7
+ import L from "lodash/isEqualWith";
8
8
  import $e from "lodash/isFunction";
9
- import se from "lodash/isUndefined";
9
+ import le from "lodash/isUndefined";
10
10
  import "../config-provider/ConfigProvider.js";
11
- import le from "@unicom-cloud/utils/class-name";
12
- import { pickDataAttributes as We } from "../components/common/utils/pick.js";
13
- import { TreeContext as Re } from "./Context.js";
14
- import de from "./Node.js";
11
+ import de from "@unicom-cloud/utils/class-name";
12
+ import { pickDataAttributes as Re } from "../components/common/utils/pick.js";
13
+ import { TreeContext as We } from "./Context.js";
14
+ import ie from "./Node.js";
15
15
  import je from "./NodeList.js";
16
16
  import { getTreeDataFromTreeChildren as Fe, getCheckedKeysByInitKeys as ze, getAllCheckedKeysByCheck as Be } from "./util.js";
17
17
  import qe from "../config-provider/context.js";
18
- const ie = {
18
+ const ae = {
19
19
  key: "key",
20
20
  title: "title",
21
21
  children: "children",
@@ -24,13 +24,13 @@ const ie = {
24
24
  disableCheckbox: "disableCheckbox",
25
25
  checkable: "checkable",
26
26
  isLeaf: "isLeaf"
27
- }, oe = "parent", ae = "all", ye = "child", Ue = {
27
+ }, oe = "parent", ye = "all", ue = "child", Ue = {
28
28
  selectable: !0,
29
29
  autoExpandParent: !0,
30
- checkedStrategy: ae,
30
+ checkedStrategy: ye,
31
31
  actionOnClick: "select",
32
32
  allowDrop: () => !0,
33
- fieldNames: ie,
33
+ fieldNames: ae,
34
34
  animation: !0
35
35
  }, Ve = [
36
36
  "style",
@@ -49,42 +49,42 @@ const ie = {
49
49
  "actionOnClick",
50
50
  "animation"
51
51
  ];
52
- function Ge(r, ue) {
53
- const g = ve(qe), q = S(null), f = S({}), _ = S(), T = S(), M = S(), [o, k] = Te(() => {
52
+ function Ge(r, fe) {
53
+ const g = ve(qe), U = S(null), f = S({}), b = S(), T = S(), M = S(), [a, k] = Te(() => {
54
54
  var l;
55
- const e = H(), t = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: n } = W(
55
+ const e = H(), n = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: t } = R(
56
56
  r.checkedKeys || r.defaultCheckedKeys || []
57
57
  );
58
58
  return {
59
59
  selectedKeys: r.selectedKeys || r.defaultSelectedKeys || [],
60
60
  checkedKeys: c,
61
- halfCheckedKeys: n,
62
- expandedKeys: V(
61
+ halfCheckedKeys: t,
62
+ expandedKeys: G(
63
63
  r.expandedKeys || r.defaultExpandedKeys
64
64
  ),
65
65
  loadedKeys: [],
66
66
  loadingKeys: [],
67
67
  currentExpandKeys: [],
68
- nodeList: t
68
+ nodeList: n
69
69
  };
70
70
  });
71
71
  function C(e) {
72
- const { componentConfig: t } = g ?? {}, c = e || r, n = (t == null ? void 0 : t.Tree) || {}, l = {};
72
+ const { componentConfig: n } = g ?? {}, c = e || r, t = (n == null ? void 0 : n.Tree) || {}, l = {};
73
73
  return Ve.forEach((s) => {
74
- se(c[s]) ? se(n[s]) ? l[s] = Ue[s] : l[s] = n[s] : l[s] = c[s];
74
+ le(c[s]) ? le(t[s]) ? l[s] = Ue[s] : l[s] = t[s] : l[s] = c[s];
75
75
  }), l;
76
76
  }
77
- function fe(e, t) {
77
+ function he(e, n) {
78
78
  let c = e;
79
- t && (c = t._key), M.current && M.current.scrollIntoView(
79
+ n && (c = n._key), M.current && M.current.scrollIntoView(
80
80
  c,
81
- t || f.current[c]
81
+ n || f.current[c]
82
82
  );
83
83
  }
84
84
  function H() {
85
85
  return "treeData" in r ? r.treeData : Fe(r.children);
86
86
  }
87
- function he(e, t) {
87
+ function Ke(e, n) {
88
88
  const c = [
89
89
  "fieldNames",
90
90
  "selectable",
@@ -96,96 +96,96 @@ function Ge(r, ue) {
96
96
  "treeData",
97
97
  "children"
98
98
  ];
99
- return e.treeData !== t.treeData || e.children !== t.children || c.some((n) => E(e[n], t[n]));
99
+ return e.treeData !== n.treeData || e.children !== n.children || c.some((t) => L(e[t], n[t]));
100
100
  }
101
- function U(e) {
102
- const t = C(), { selectable: c } = t, n = {
103
- ...ie,
104
- ..."treeData" in r ? t.fieldNames : {}
101
+ function V(e) {
102
+ const n = C(), { selectable: c } = n, t = {
103
+ ...ae,
104
+ ..."treeData" in r ? n.fieldNames : {}
105
105
  }, l = {
106
- children: D(e, n.children),
107
- selectable: B(e, n.selectable) ? D(e, n.selectable) : c,
108
- checkable: B(e, n.checkable) ? D(e, n.checkable) : r.checkable,
109
- title: D(e, n.title),
110
- disabled: D(e, n.disabled),
111
- disableCheckbox: D(e, n.disableCheckbox),
112
- isLeaf: D(e, n.isLeaf),
113
- key: D(e, n.key)
106
+ children: E(e, t.children),
107
+ selectable: q(e, t.selectable) ? E(e, t.selectable) : c,
108
+ checkable: q(e, t.checkable) ? E(e, t.checkable) : r.checkable,
109
+ title: E(e, t.title),
110
+ disabled: E(e, t.disabled),
111
+ disableCheckbox: E(e, t.disableCheckbox),
112
+ isLeaf: E(e, t.isLeaf),
113
+ key: E(e, t.key)
114
114
  };
115
- return B(e, n.key) || delete l.key, l;
115
+ return q(e, t.key) || delete l.key, l;
116
116
  }
117
- function $(e, t) {
117
+ function $(e, n) {
118
118
  var y;
119
119
  f.current = {};
120
- const c = t || ((y = g.getPrefixCls) == null ? void 0 : y.call(g, "tree")), n = [];
120
+ const c = n || ((y = g.getPrefixCls) == null ? void 0 : y.call(g, "tree")), t = [];
121
121
  let l = 0;
122
- const { showLine: s, blockNode: d } = C(), i = (m, a) => {
123
- const x = m.length;
124
- return m.map((h, N) => {
122
+ const { showLine: s, blockNode: d } = C(), i = (_, u) => {
123
+ const w = _.length;
124
+ return _.map((m, x) => {
125
125
  const {
126
- children: u,
127
- selectable: L,
128
- checkable: P,
129
- key: b = `${(a == null ? void 0 : a._key) || ""}-${N}`,
130
- ...Pe
131
- } = U(h), w = {
126
+ children: o,
127
+ selectable: h,
128
+ checkable: D,
129
+ key: N = `${(u == null ? void 0 : u._key) || ""}-${x}`,
130
+ ...z
131
+ } = V(m), O = {
132
132
  // data 中含有 dataRef 时,优先级较高
133
- dataRef: h,
133
+ dataRef: m,
134
134
  draggable: r.draggable,
135
- selectable: L,
136
- checkable: P,
135
+ selectable: h,
136
+ checkable: D,
137
137
  showLine: s,
138
138
  blockNode: d,
139
- ...h,
140
- ...Pe,
141
- key: b,
142
- children: u,
143
- _key: b,
139
+ ...m,
140
+ ...z,
141
+ key: N,
142
+ children: o,
143
+ _key: N,
144
144
  _index: l++,
145
- parentKey: a ? a._key : void 0,
146
- pathParentKeys: a && a.pathParentKeys || [],
147
- _level: a._level || 0,
145
+ parentKey: u ? u._key : void 0,
146
+ pathParentKeys: u && u.pathParentKeys || [],
147
+ _level: u._level || 0,
148
148
  // 保存node在sowLine模式下是否显示缩进线。如果父节点是其所在层级的最后一个节点,那么所有的子节点(包括孙子节点等)在父节点所在层级的缩进格都不显示缩进线。
149
- _lineless: a && a._lineless ? [...a._lineless || [], a._isTail] : []
149
+ _lineless: u && u._lineless ? [...u._lineless || [], u._isTail] : []
150
150
  };
151
- return x === N + 1 && (w.className = le(
151
+ return w === x + 1 && (O.className = de(
152
152
  `${c}-node-is-tail`,
153
- w.className
154
- )), n.push(w), f.current[b] = w, u && u.length && (f.current[b].children = i(u, {
155
- _key: b,
156
- _level: w._level + 1,
157
- _lineless: w._lineless,
158
- _isTail: x === N + 1,
159
- pathParentKeys: [...(a == null ? void 0 : a.pathParentKeys) || [], b]
160
- })), w;
153
+ O.className
154
+ )), t.push(O), f.current[N] = O, o && o.length && (f.current[N].children = i(o, {
155
+ _key: N,
156
+ _level: O._level + 1,
157
+ _lineless: O._lineless,
158
+ _isTail: w === x + 1,
159
+ pathParentKeys: [...(u == null ? void 0 : u.pathParentKeys) || [], N]
160
+ })), O;
161
161
  });
162
162
  };
163
- return i(e || [], {}), n;
163
+ return i(e || [], {}), t;
164
164
  }
165
- function V(e) {
165
+ function G(e) {
166
166
  if (!C().autoExpandParent)
167
167
  return e || [];
168
168
  if (!e)
169
169
  return Object.keys(f.current).filter((c) => {
170
- const n = f.current[c];
171
- return n.children && n.children.length;
170
+ const t = f.current[c];
171
+ return t.children && t.children.length;
172
172
  });
173
- const t = {};
173
+ const n = {};
174
174
  return e.forEach((c) => {
175
- const n = f.current[c];
176
- n && (t[c] = 1, n.pathParentKeys && n.pathParentKeys.forEach((l) => {
177
- t[l] = 1;
175
+ const t = f.current[c];
176
+ t && (n[c] = 1, t.pathParentKeys && t.pathParentKeys.forEach((l) => {
177
+ n[l] = 1;
178
178
  }));
179
- }), Object.keys(t);
179
+ }), Object.keys(n);
180
180
  }
181
- function W(e) {
181
+ function R(e) {
182
182
  if (!r.checkStrictly) {
183
- const { checkedKeys: t, indeterminateKeys: c } = ze(
183
+ const { checkedKeys: n, indeterminateKeys: c } = ze(
184
184
  e,
185
185
  f.current
186
186
  );
187
187
  return {
188
- checkedKeys: t,
188
+ checkedKeys: n,
189
189
  halfCheckedKeys: c
190
190
  };
191
191
  }
@@ -194,140 +194,144 @@ function Ge(r, ue) {
194
194
  halfCheckedKeys: r.halfCheckedKeys || []
195
195
  };
196
196
  }
197
- function Ke(e, t) {
197
+ function ke(e, n) {
198
198
  var l;
199
- const { onSelect: c } = r, n = {
200
- e: t,
199
+ const { onSelect: c } = r, t = {
200
+ e: n,
201
201
  data: (l = f.current[e]) == null ? void 0 : l.dataRef,
202
202
  // 潘启宝添加
203
203
  node: K([e])[0]
204
204
  };
205
205
  if (r.multiple) {
206
- const s = [...o.selectedKeys], d = s.indexOf(e);
207
- d > -1 ? (s.splice(d, 1), n.selected = !1) : (n.selected = !0, s.push(e)), n.selectedNodes = K(s), "selectedKeys" in r || k((i) => {
206
+ const s = [...a.selectedKeys], d = s.indexOf(e);
207
+ d > -1 ? (s.splice(d, 1), t.selected = !1) : (t.selected = !0, s.push(e)), t.selectedNodes = K(s), "selectedKeys" in r || k((i) => {
208
208
  const y = { ...i };
209
209
  return y.selectedKeys = s, y;
210
- }), c == null || c(s, n);
210
+ }), c == null || c(s, t);
211
211
  } else
212
- n.selected = !0, n.selectedNodes = K([e]), "selectedKeys" in r || k((s) => {
212
+ t.selected = !0, t.selectedNodes = K([e]), "selectedKeys" in r || k((s) => {
213
213
  const d = { ...s };
214
214
  return d.selectedKeys = [e], d;
215
- }), c == null || c([e], n);
215
+ }), c == null || c([e], t);
216
216
  }
217
- function G(e, t, c) {
218
- const { checkedStrategy: n } = C(), { onCheck: l, checkStrictly: s } = r, d = { e: c, node: K([t])[0] };
219
- let i = [...o.checkedKeys || []], y = o.halfCheckedKeys;
217
+ function J(e, n, c) {
218
+ var u, w;
219
+ const { checkedStrategy: t } = C(), { onCheck: l, checkStrictly: s } = r, d = { e: c, node: K([n])[0] };
220
+ let i = [...a.checkedKeys || []], y = a.halfCheckedKeys;
220
221
  if (s) {
221
- e ? i = i.concat(t) : i = i.filter((a) => a !== t);
222
+ e ? i = i.concat(n) : i = i.filter((x) => x !== n);
222
223
  const m = {};
223
- "checkedKeys" in r || (m.checkedKeys = i), "halfCheckedKeys" in r || (m.halfCheckedKeys = y), Me(m) || k((a) => ({ ...a, ...m }));
224
+ "checkedKeys" in r || (m.checkedKeys = i), "halfCheckedKeys" in r || (m.halfCheckedKeys = y), Me(m) || k((x) => ({ ...x, ...m }));
224
225
  } else {
225
- const { checkedKeys: m, indeterminateKeys: a } = Be(
226
- t,
226
+ const { checkedKeys: m, indeterminateKeys: x } = Be(
227
+ n,
227
228
  e,
228
229
  i,
229
230
  f.current,
230
231
  y
231
232
  );
232
- i = m, y = a, "checkedKeys" in r ? k((x) => {
233
- const h = { ...x };
233
+ i = m, y = x, "checkedKeys" in r ? k((o) => {
234
+ const h = { ...o };
234
235
  return h.halfCheckedKeys = y, h;
235
- }) : k((x) => {
236
- const h = { ...x };
236
+ }) : k((o) => {
237
+ const h = { ...o };
237
238
  return h.checkedKeys = i, h.halfCheckedKeys = y, h;
238
- }), n === oe ? i = i.filter((x) => {
239
- const h = f.current[x];
239
+ }), t === oe ? i = i.filter((o) => {
240
+ const h = f.current[o];
240
241
  if (!h || i.indexOf(h.parentKey) === -1)
241
242
  return !0;
242
- }) : n === ye && (i = i.filter((x) => {
243
- var N, u;
244
- const h = f.current[x];
245
- if (!h || !((N = h.children) != null && N.length) || (u = h.children) != null && u.every((L) => i.indexOf(L._key) === -1))
243
+ }) : t === ue && (i = i.filter((o) => {
244
+ var D, N;
245
+ const h = f.current[o];
246
+ if (!h || !((D = h.children) != null && D.length) || (N = h.children) != null && N.every((z) => i.indexOf(z._key) === -1))
246
247
  return !0;
247
248
  }));
248
249
  }
250
+ const _ = (u = f.current[n]) == null ? void 0 : u.dataRef;
249
251
  l == null || l(i, {
252
+ data: _,
253
+ // 潘启宝添加
250
254
  checkedNodes: K(i),
251
255
  checked: e,
252
256
  halfCheckedKeys: y,
253
257
  halfCheckedNodes: K(y),
254
258
  ...d
255
- });
259
+ }), (w = r.onNodeCheck) == null || w.call(r, n, _, d);
256
260
  }
257
- function ke(e) {
261
+ function me(e) {
258
262
  if ($e(r.loadMore)) {
259
- const { loadingKeys: t = [], loadedKeys: c } = o;
260
- k((n) => {
261
- const l = { ...n };
262
- return l.loadingKeys = Array.from(/* @__PURE__ */ new Set([...t, e._key])), l.loadedKeys = c.filter((s) => s !== e._key), l;
263
- }), I == null || I(K([e._key])[0]).then((n) => {
263
+ const { loadingKeys: n = [], loadedKeys: c } = a;
264
+ k((t) => {
265
+ const l = { ...t };
266
+ return l.loadingKeys = Array.from(/* @__PURE__ */ new Set([...n, e._key])), l.loadedKeys = c.filter((s) => s !== e._key), l;
267
+ }), I == null || I(K([e._key])[0]).then((t) => {
264
268
  k((l) => {
265
269
  const s = { ...l };
266
270
  return s.loadingKeys = l.loadingKeys.filter((d) => d !== e._key), s.loadedKeys = Array.from(/* @__PURE__ */ new Set([...l.loadedKeys, e._key])), s;
267
- }), R(!e.expanded, e._key);
268
- }).catch((n) => {
271
+ }), W(!e.expanded, e._key);
272
+ }).catch((t) => {
269
273
  k((l) => {
270
274
  const s = { ...l };
271
275
  return s.loadingKeys = l.loadingKeys.filter((d) => d !== e._key), s;
272
- }), console.error("[tree]load data error: ", n);
276
+ }), console.error("[tree]load data error: ", t);
273
277
  }).finally(() => {
274
278
  });
275
279
  }
276
280
  }
277
- function me(e, t) {
278
- _.current = K([t._key])[0], T.current = 0;
281
+ function xe(e, n) {
282
+ b.current = K([n._key])[0], T.current = 0;
279
283
  const { onDragStart: c } = r;
280
- c == null || c(e, K([t._key])[0]);
284
+ c == null || c(e, K([n._key])[0]);
281
285
  }
282
- function xe(e, t) {
283
- _.current = null, T.current = 0;
286
+ function ge(e, n) {
287
+ b.current = null, T.current = 0;
284
288
  const { onDragEnd: c } = r;
285
- c == null || c(e, K([t._key])[0]);
289
+ c == null || c(e, K([n._key])[0]);
286
290
  }
287
- function ge(e, t, c) {
291
+ function Ce(e, n, c) {
288
292
  T.current = c;
289
- const { onDragOver: n } = r;
290
- n == null || n(e, K([t._key])[0]);
293
+ const { onDragOver: t } = r;
294
+ t == null || t(e, K([n._key])[0]);
291
295
  }
292
- function Ce(e, t) {
296
+ function Ne(e, n) {
293
297
  T.current = 0;
294
298
  const { onDragLeave: c } = r;
295
- c == null || c(e, K([t._key])[0]);
299
+ c == null || c(e, K([n._key])[0]);
296
300
  }
297
- function Ne(e, t) {
301
+ function _e(e, n) {
298
302
  let c = f.current[e.parentKey];
299
303
  for (; c; ) {
300
- const { _key: n, parentKey: l } = c;
301
- if (n === t.props._key)
304
+ const { _key: t, parentKey: l } = c;
305
+ if (t === n.props._key)
302
306
  return !0;
303
- if (l === n)
307
+ if (l === t)
304
308
  return;
305
309
  c = f.current[l];
306
310
  }
307
311
  }
308
- function J(e, t) {
309
- if (e === void 0 || t === void 0)
312
+ function Q(e, n) {
313
+ if (e === void 0 || n === void 0)
310
314
  return !1;
311
- if (e === t)
315
+ if (e === n)
312
316
  return !0;
313
- const c = e.key, n = t.key;
314
- if (c !== void 0 || n !== void 0)
315
- return c === n;
316
- const l = e.props._key, s = t.props._key;
317
+ const c = e.key, t = n.key;
318
+ if (c !== void 0 || t !== void 0)
319
+ return c === t;
320
+ const l = e.props._key, s = n.props._key;
317
321
  return l === void 0 && s === void 0 ? !1 : l === s;
318
322
  }
319
- function Q(e, t, c) {
320
- if (_.current) {
321
- const { allowDrop: n } = C(), { onDrop: l } = r, s = K([t._key])[0];
322
- if (l && !Ne(t, _.current) && !J(_.current, s)) {
323
- if (n && !n({
323
+ function X(e, n, c) {
324
+ if (b.current) {
325
+ const { allowDrop: t } = C(), { onDrop: l } = r, s = K([n._key])[0];
326
+ if (l && !_e(n, b.current) && !Q(b.current, s)) {
327
+ if (t && !t({
324
328
  dropNode: s,
325
- dragNode: _.current,
329
+ dragNode: b.current,
326
330
  dropPosition: c
327
331
  }))
328
332
  return;
329
333
  l({
330
- dragNode: _.current,
334
+ dragNode: b.current,
331
335
  dropNode: s,
332
336
  dropPosition: c,
333
337
  e
@@ -335,147 +339,147 @@ function Ge(r, ue) {
335
339
  }
336
340
  }
337
341
  }
338
- function X(e, t) {
342
+ function Y(e, n) {
339
343
  const { allowDrop: c } = C();
340
- let n = !0;
341
- return typeof c == "function" && (n = c({
344
+ let t = !0;
345
+ return typeof c == "function" && (t = c({
342
346
  dropNode: K([e._key])[0],
343
- dragNode: _.current,
344
- dropPosition: t
345
- })), n;
347
+ dragNode: b.current,
348
+ dropPosition: n
349
+ })), t;
346
350
  }
347
- function R(e, t) {
348
- const { currentExpandKeys: c, expandedKeys: n = [] } = o, { animation: l } = C(), { onExpand: s } = r;
349
- if (c.indexOf(t) > -1)
351
+ function W(e, n) {
352
+ const { currentExpandKeys: c, expandedKeys: t = [] } = a, { animation: l } = C(), { onExpand: s } = r;
353
+ if (c.indexOf(n) > -1)
350
354
  return;
351
355
  let d = [];
352
- e ? d = Array.from(/* @__PURE__ */ new Set([...n, t])) : d = n.filter((i) => i !== t), "expandedKeys" in r || k((i) => {
356
+ e ? d = Array.from(/* @__PURE__ */ new Set([...t, n])) : d = t.filter((i) => i !== n), "expandedKeys" in r || k((i) => {
353
357
  const y = { ...i };
354
- return y.expandedKeys = d, y.currentExpandKeys = l ? [...c, t] : [], y;
358
+ return y.expandedKeys = d, y.currentExpandKeys = l ? [...c, n] : [], y;
355
359
  }), s == null || s(d, {
356
360
  expanded: e,
357
- node: K([t])[0],
361
+ node: K([n])[0],
358
362
  expandedNodes: K(d)
359
363
  });
360
364
  }
361
365
  function K(e) {
362
- const { __PqbAdapterMode__: t } = r;
366
+ const { __PqbAdapterMode__: n } = r;
363
367
  return A(
364
- [].concat(e).map((n) => f.current[n]).filter(Boolean)
365
- ).map((n) => t ? {
366
- props: n,
368
+ [].concat(e).map((t) => f.current[t]).filter(Boolean)
369
+ ).map((t) => n ? {
370
+ props: t,
367
371
  key: e
368
- } : /* @__PURE__ */ Ie(de, { ...n, key: n.key }));
372
+ } : /* @__PURE__ */ Ie(ie, { ...t, key: t.key }));
369
373
  }
370
374
  function j(e) {
371
375
  return {
372
- expandedKeysSet: (e == null ? void 0 : e.expandedKeysSet) || new Set((o == null ? void 0 : o.expandedKeys) || []),
373
- checkedKeysSet: (e == null ? void 0 : e.checkedKeysSet) || new Set((o == null ? void 0 : o.checkedKeys) || []),
374
- selectedKeysSet: (e == null ? void 0 : e.selectedKeysSet) || new Set((o == null ? void 0 : o.selectedKeys) || []),
375
- halfCheckedKeysSet: (e == null ? void 0 : e.halfCheckedKeysSet) || new Set((o == null ? void 0 : o.halfCheckedKeys) || [])
376
+ expandedKeysSet: (e == null ? void 0 : e.expandedKeysSet) || new Set((a == null ? void 0 : a.expandedKeys) || []),
377
+ checkedKeysSet: (e == null ? void 0 : e.checkedKeysSet) || new Set((a == null ? void 0 : a.checkedKeys) || []),
378
+ selectedKeysSet: (e == null ? void 0 : e.selectedKeysSet) || new Set((a == null ? void 0 : a.selectedKeys) || []),
379
+ halfCheckedKeysSet: (e == null ? void 0 : e.halfCheckedKeysSet) || new Set((a == null ? void 0 : a.halfCheckedKeys) || [])
376
380
  };
377
381
  }
378
- function A(e, t) {
379
- const { autoExpandParent: c } = C(), { loadMore: n } = r, {
382
+ function A(e, n) {
383
+ const { autoExpandParent: c } = C(), { loadMore: t } = r, {
380
384
  selectedKeys: l,
381
385
  expandedKeys: s,
382
386
  checkedKeys: d,
383
387
  loadingKeys: i = [],
384
388
  loadedKeys: y = []
385
- } = o, {
386
- expandedKeysSet: m,
387
- checkedKeysSet: a,
388
- selectedKeysSet: x,
389
- halfCheckedKeysSet: h
390
- } = j(t), N = (u) => {
391
- const L = u.children && u.children.length, P = {
392
- isLeaf: !L,
393
- autoExpandParent: L ? c : !1,
394
- expanded: m ? m.has(u._key) : s.indexOf(u._key) > -1
389
+ } = a, {
390
+ expandedKeysSet: _,
391
+ checkedKeysSet: u,
392
+ selectedKeysSet: w,
393
+ halfCheckedKeysSet: m
394
+ } = j(n), x = (o) => {
395
+ const h = o.children && o.children.length, D = {
396
+ isLeaf: !h,
397
+ autoExpandParent: h ? c : !1,
398
+ expanded: _ ? _.has(o._key) : s.indexOf(o._key) > -1
395
399
  };
396
- if (n) {
397
- const b = y.indexOf(u._key) > -1;
398
- P.loaded = b, P.isLeaf = L ? !1 : u.isLeaf;
400
+ if (t) {
401
+ const N = y.indexOf(o._key) > -1;
402
+ D.loaded = N, D.isLeaf = h ? !1 : o.isLeaf;
399
403
  }
400
404
  return {
401
- ...u,
402
- ...P,
403
- selected: x.has(u._key),
404
- indeterminated: h.has(u._key),
405
- loading: i.indexOf(u._key) > -1,
406
- checked: a.has(u._key),
405
+ ...o,
406
+ ...D,
407
+ selected: w.has(o._key),
408
+ indeterminated: m.has(o._key),
409
+ loading: i.indexOf(o._key) > -1,
410
+ checked: u.has(o._key),
407
411
  selectedKeys: l,
408
412
  checkedKeys: d,
409
413
  loadingKeys: i,
410
414
  loadedKeys: y,
411
415
  expandedKeys: s,
412
- childrenData: u.children || [],
416
+ childrenData: o.children || [],
413
417
  children: null
414
418
  };
415
419
  };
416
- return He(e) ? e.map((u) => N(u)) : N(e);
420
+ return He(e) ? e.map((o) => x(o)) : x(e);
417
421
  }
418
- function Y(e) {
419
- k((t) => {
420
- const c = { ...t }, { currentExpandKeys: n } = t;
421
- return n.indexOf(e) > -1 && (c.currentExpandKeys = n.filter((l, s, d) => l !== e)), c;
422
+ function Z(e) {
423
+ k((n) => {
424
+ const c = { ...n }, { currentExpandKeys: t } = n;
425
+ return t.indexOf(e) > -1 && (c.currentExpandKeys = t.filter((l, s, d) => l !== e)), c;
422
426
  });
423
427
  }
424
- function Z() {
425
- return o;
428
+ function p() {
429
+ return a;
426
430
  }
427
- Ae(ue, () => ({
428
- scrollIntoView: fe,
429
- handleCheck: G,
430
- getTreeState: Z,
431
- handleExpandEnd: Y,
431
+ Ae(fe, () => ({
432
+ scrollIntoView: he,
433
+ handleCheck: J,
434
+ getTreeState: p,
435
+ handleExpandEnd: Z,
432
436
  getNodeProps: A,
433
437
  getDataSet: j,
434
438
  getCacheNode: K,
435
- handleExpand: R,
436
- handleAllowDrop: X,
437
- handleNodeDrop: Q,
438
- isSameNode: J
439
- })), z(() => {
440
- const e = q.current, t = C(e), c = C();
441
- if (e !== r || !E(t, c)) {
442
- const n = {};
443
- if (he(
444
- { prevMergedProps: t, ...e },
439
+ handleExpand: W,
440
+ handleAllowDrop: Y,
441
+ handleNodeDrop: X,
442
+ isSameNode: Q
443
+ })), B(() => {
444
+ const e = U.current, n = C(e), c = C();
445
+ if (e !== r || !L(n, c)) {
446
+ const t = {};
447
+ if (Ke(
448
+ { prevMergedProps: n, ...e },
445
449
  { ...c, ...r }
446
450
  )) {
447
451
  const s = H(), d = $(s);
448
- n.treeData = s, n.nodeList = d;
452
+ t.treeData = s, t.nodeList = d;
449
453
  }
450
- if (n.treeData || "checkedKeys" in r && !E(e == null ? void 0 : e.checkedKeys, r.checkedKeys)) {
451
- const s = "checkedKeys" in r ? r.checkedKeys : o.checkedKeys, { halfCheckedKeys: d, checkedKeys: i } = W(
454
+ if (t.treeData || "checkedKeys" in r && !L(e == null ? void 0 : e.checkedKeys, r.checkedKeys)) {
455
+ const s = "checkedKeys" in r ? r.checkedKeys : a.checkedKeys, { halfCheckedKeys: d, checkedKeys: i } = R(
452
456
  s || []
453
457
  );
454
- E(i, o.checkedKeys) || (n.checkedKeys = i), E(d, o.halfCheckedKeys) || (n.halfCheckedKeys = d);
458
+ L(i, a.checkedKeys) || (t.checkedKeys = i), L(d, a.halfCheckedKeys) || (t.halfCheckedKeys = d);
455
459
  }
456
- r.checkStrictly && "halfCheckedKeys" in r && !E(e == null ? void 0 : e.halfCheckedKeys, r.halfCheckedKeys) && (n.halfCheckedKeys = r.halfCheckedKeys), "expandedKeys" in r && !E(r.expandedKeys, e == null ? void 0 : e.expandedKeys) && (n.expandedKeys = r.expandedKeys, n.currentExpandKeys = c.animation ? [...n.expandedKeys ?? [], ...o.expandedKeys ?? []].reduce((s, d) => {
460
+ r.checkStrictly && "halfCheckedKeys" in r && !L(e == null ? void 0 : e.halfCheckedKeys, r.halfCheckedKeys) && (t.halfCheckedKeys = r.halfCheckedKeys), "expandedKeys" in r && !L(r.expandedKeys, e == null ? void 0 : e.expandedKeys) && (t.expandedKeys = r.expandedKeys, t.currentExpandKeys = c.animation ? [...t.expandedKeys ?? [], ...a.expandedKeys ?? []].reduce((s, d) => {
457
461
  const i = s.indexOf(d);
458
462
  return i === -1 ? s.push(d) : s.splice(i, 1), s;
459
463
  }, []).filter((s, d, i) => {
460
464
  var y;
461
465
  if (f.current[s])
462
- return f.current[s].pathParentKeys.some((a) => i.indexOf(a) > -1) ? !1 : (y = f.current[s].children) == null ? void 0 : y.length;
466
+ return f.current[s].pathParentKeys.some((u) => i.indexOf(u) > -1) ? !1 : (y = f.current[s].children) == null ? void 0 : y.length;
463
467
  }) : []);
464
- const l = n.currentExpandKeys || o.currentExpandKeys;
465
- n.treeData && l && (n.currentExpandKeys = l.filter((s) => {
466
- const d = n.treeData.find((i) => i.key === s);
468
+ const l = t.currentExpandKeys || a.currentExpandKeys;
469
+ t.treeData && l && (t.currentExpandKeys = l.filter((s) => {
470
+ const d = t.treeData.find((i) => i.key === s);
467
471
  return d && d.children && d.children.length;
468
- })), Object.keys(n).length && k((s) => ({ ...s, ...n }));
472
+ })), Object.keys(t).length && k((s) => ({ ...s, ...t }));
469
473
  }
470
- return q.current = r, () => {
474
+ return U.current = r, () => {
471
475
  };
472
- }), z(() => ("selectedKeys" in r && !E(r.selectedKeys, o.selectedKeys) && k((e) => {
473
- const t = { ...e };
474
- return t.selectedKeys = r.selectedKeys || [], t;
476
+ }), B(() => ("selectedKeys" in r && !L(r.selectedKeys, a.selectedKeys) && k((e) => {
477
+ const n = { ...e };
478
+ return n.selectedKeys = r.selectedKeys || [], n;
475
479
  }), () => {
476
- }), [r.selectedKeys, o.selectedKeys]), z(() => {
480
+ }), [r.selectedKeys, a.selectedKeys]), B(() => {
477
481
  var l;
478
- const e = H(), t = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: n } = W(
482
+ const e = H(), n = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: t } = R(
479
483
  r.checkedKeys || r.defaultCheckedKeys || []
480
484
  );
481
485
  return k((s) => {
@@ -484,95 +488,95 @@ function Ge(r, ue) {
484
488
  ...d,
485
489
  selectedKeys: r.selectedKeys || r.defaultSelectedKeys || [],
486
490
  checkedKeys: c,
487
- halfCheckedKeys: n,
488
- expandedKeys: V(
491
+ halfCheckedKeys: t,
492
+ expandedKeys: G(
489
493
  r.expandedKeys || r.defaultExpandedKeys
490
494
  ),
491
495
  loadedKeys: [],
492
496
  loadingKeys: [],
493
497
  currentExpandKeys: [],
494
- nodeList: t
498
+ nodeList: n
495
499
  }, d;
496
500
  }), () => {
497
501
  };
498
502
  }, []);
499
503
  const {
500
- className: _e,
501
- showLine: be,
502
- size: p,
503
- virtualListProps: ee,
504
+ className: be,
505
+ showLine: De,
506
+ size: ee,
507
+ virtualListProps: te,
504
508
  height: ne,
505
- style: De,
506
- icons: Ee,
507
- actionOnClick: Le,
508
- animation: te
509
- } = C(), { loadMore: I, checkable: we } = r, ce = ee ? {
509
+ style: Ee,
510
+ icons: Le,
511
+ actionOnClick: we,
512
+ animation: ce
513
+ } = C(), { loadMore: I, checkable: Oe } = r, re = te ? {
510
514
  threshold: 100,
511
- ...ee
515
+ ...te
512
516
  } : ne ? { height: ne, threshold: 100 } : {
513
517
  threshold: null
514
- }, { getPrefixCls: F, rtl: Oe } = g, O = F == null ? void 0 : F("tree");
515
- return /* @__PURE__ */ re(
516
- Re.Provider,
518
+ }, { getPrefixCls: F, rtl: Pe } = g, P = F == null ? void 0 : F("tree");
519
+ return /* @__PURE__ */ se(
520
+ We.Provider,
517
521
  {
518
522
  value: {
519
- icons: Ee,
520
- animation: te,
523
+ icons: Le,
524
+ animation: ce,
521
525
  key2nodeProps: f.current,
522
- getFieldInfo: U,
523
- getTreeState: Z,
526
+ getFieldInfo: V,
527
+ getTreeState: p,
524
528
  getNodeProps: A,
525
- onExpandEnd: te ? Y : () => {
529
+ onExpandEnd: ce ? Z : () => {
526
530
  },
527
- onSelect: Ke,
528
- onCheck: G,
529
- onNodeDragStart: me,
530
- onNodeDragEnd: xe,
531
- onNodeDragLeave: Ce,
532
- onNodeDragOver: ge,
533
- onNodeDrop: Q,
534
- onExpand: R,
531
+ onSelect: ke,
532
+ onCheck: J,
533
+ onNodeDragStart: xe,
534
+ onNodeDragEnd: ge,
535
+ onNodeDragLeave: Ne,
536
+ onNodeDragOver: Ce,
537
+ onNodeDrop: X,
538
+ onExpand: W,
535
539
  renderExtra: r.renderExtra,
536
540
  renderTitle: r.renderTitle,
537
- loadMore: I && ke,
538
- allowDrop: X,
539
- actionOnClick: Le,
540
- virtualListProps: ce,
541
- onNodeClick(e, t, c) {
542
- var n;
543
- (n = r.onNodeClick) == null || n.call(r, e, t, c);
541
+ loadMore: I && me,
542
+ allowDrop: Y,
543
+ actionOnClick: we,
544
+ virtualListProps: re,
545
+ onNodeSelect(e, n, c) {
546
+ var t;
547
+ (t = r.onNodeSelect) == null || t.call(r, e, n, c);
544
548
  }
545
549
  },
546
- children: /* @__PURE__ */ re(
550
+ children: /* @__PURE__ */ se(
547
551
  je,
548
552
  {
549
553
  ref: (e) => {
550
554
  M.current = e;
551
555
  },
552
- className: le(
553
- O,
556
+ className: de(
557
+ P,
554
558
  {
555
- [`${O}-checkable`]: we,
556
- [`${O}-show-line`]: be,
557
- [`${O}-size-${p}`]: p,
558
- [`${O}-rtl`]: Oe
559
+ [`${P}-checkable`]: Oe,
560
+ [`${P}-show-line`]: De,
561
+ [`${P}-size-${ee}`]: ee,
562
+ [`${P}-rtl`]: Pe
559
563
  },
560
- _e
564
+ be
561
565
  ),
562
- style: De,
566
+ style: Ee,
563
567
  filterNode: r.filterNode,
564
- virtualListProps: ce,
565
- expandedKeys: o.expandedKeys,
566
- currentExpandKeys: o.currentExpandKeys,
568
+ virtualListProps: re,
569
+ expandedKeys: a.expandedKeys,
570
+ currentExpandKeys: a.currentExpandKeys,
567
571
  getNodeProps: A,
568
572
  getDataSet: j,
569
- nodeList: o.nodeList,
573
+ nodeList: a.nodeList,
570
574
  onMouseDown: r.onMouseDown,
571
575
  ariaProps: {
572
576
  role: "tree",
573
577
  "aria-multiselectable": r.multiple,
574
578
  tabIndex: 0,
575
- ...We(r)
579
+ ...Re(r)
576
580
  }
577
581
  }
578
582
  )
@@ -584,10 +588,10 @@ const v = Se(
584
588
  );
585
589
  v.displayName = "Tree";
586
590
  v.SHOW_PARENT = oe;
587
- v.SHOW_ALL = ae;
588
- v.SHOW_CHILD = ye;
589
- v.Node = de;
591
+ v.SHOW_ALL = ye;
592
+ v.SHOW_CHILD = ue;
593
+ v.Node = ie;
590
594
  export {
591
- de as TreeNode,
595
+ ie as TreeNode,
592
596
  v as default
593
597
  };