@unicom-cloud/ui 0.8.91 → 0.8.93

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 +72 -72
  6. package/tree/Tree.js +332 -332
  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 +1 -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(() => {
54
- var l;
55
- const e = H(), t = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: n } = W(
52
+ function Ge(r, fe) {
53
+ const C = ve(qe), U = S(null), f = S({}), b = S(), T = S(), M = S(), [o, m] = Te(() => {
54
+ var s;
55
+ const e = H(), n = $(e, (s = C.getPrefixCls) == null ? void 0 : s.call(C, "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
- function C(e) {
72
- const { componentConfig: t } = g ?? {}, c = e || r, n = (t == null ? void 0 : t.Tree) || {}, l = {};
73
- return Ve.forEach((s) => {
74
- se(c[s]) ? se(n[s]) ? l[s] = Ue[s] : l[s] = n[s] : l[s] = c[s];
75
- }), l;
71
+ function N(e) {
72
+ const { componentConfig: n } = C ?? {}, c = e || r, t = (n == null ? void 0 : n.Tree) || {}, s = {};
73
+ return Ve.forEach((l) => {
74
+ le(c[l]) ? le(t[l]) ? s[l] = Ue[l] : s[l] = t[l] : s[l] = c[l];
75
+ }), s;
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 : {}
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)
101
+ function V(e) {
102
+ const n = N(), { selectable: c } = n, t = {
103
+ ...ae,
104
+ ..."treeData" in r ? n.fieldNames : {}
105
+ }, s = {
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 s.key, s;
116
116
  }
117
- function $(e, t) {
118
- var y;
117
+ function $(e, n) {
118
+ var i;
119
119
  f.current = {};
120
- const c = t || ((y = g.getPrefixCls) == null ? void 0 : y.call(g, "tree")), n = [];
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) => {
120
+ const c = n || ((i = C.getPrefixCls) == null ? void 0 : i.call(C, "tree")), t = [];
121
+ let s = 0;
122
+ const { showLine: l, blockNode: d } = N(), a = (k, u) => {
123
+ const w = k.length;
124
+ return k.map((x, g) => {
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: y,
127
+ selectable: h,
128
+ checkable: D,
129
+ key: _ = `${(u == null ? void 0 : u._key) || ""}-${g}`,
130
+ ...z
131
+ } = V(x), O = {
132
132
  // data 中含有 dataRef 时,优先级较高
133
- dataRef: h,
133
+ dataRef: x,
134
134
  draggable: r.draggable,
135
- selectable: L,
136
- checkable: P,
137
- showLine: s,
135
+ selectable: h,
136
+ checkable: D,
137
+ showLine: l,
138
138
  blockNode: d,
139
- ...h,
140
- ...Pe,
141
- key: b,
142
- children: u,
143
- _key: b,
144
- _index: l++,
145
- parentKey: a ? a._key : void 0,
146
- pathParentKeys: a && a.pathParentKeys || [],
147
- _level: a._level || 0,
139
+ ...x,
140
+ ...z,
141
+ key: _,
142
+ children: y,
143
+ _key: _,
144
+ _index: s++,
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 === g + 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[_] = O, y && y.length && (f.current[_].children = a(y, {
155
+ _key: _,
156
+ _level: O._level + 1,
157
+ _lineless: O._lineless,
158
+ _isTail: w === g + 1,
159
+ pathParentKeys: [...(u == null ? void 0 : u.pathParentKeys) || [], _]
160
+ })), O;
161
161
  });
162
162
  };
163
- return i(e || [], {}), n;
163
+ return a(e || [], {}), t;
164
164
  }
165
- function V(e) {
166
- if (!C().autoExpandParent)
165
+ function G(e) {
166
+ if (!N().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((s) => {
177
+ n[s] = 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,178 +194,182 @@ function Ge(r, ue) {
194
194
  halfCheckedKeys: r.halfCheckedKeys || []
195
195
  };
196
196
  }
197
- function Ke(e, t) {
198
- var l;
199
- const { onSelect: c } = r, n = {
200
- e: t,
201
- data: (l = f.current[e]) == null ? void 0 : l.dataRef,
197
+ function ke(e, n) {
198
+ var l, d;
199
+ const { onSelect: c } = r, t = (l = f.current[e]) == null ? void 0 : l.dataRef, s = {
200
+ e: n,
201
+ data: t,
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) => {
208
- const y = { ...i };
209
- return y.selectedKeys = s, y;
210
- }), c == null || c(s, n);
206
+ const a = [...o.selectedKeys], i = a.indexOf(e);
207
+ i > -1 ? (a.splice(i, 1), s.selected = !1) : (s.selected = !0, a.push(e)), s.selectedNodes = K(a), "selectedKeys" in r || m((k) => {
208
+ const u = { ...k };
209
+ return u.selectedKeys = a, u;
210
+ }), c == null || c(a, s);
211
211
  } else
212
- n.selected = !0, n.selectedNodes = K([e]), "selectedKeys" in r || k((s) => {
213
- const d = { ...s };
214
- return d.selectedKeys = [e], d;
215
- }), c == null || c([e], n);
212
+ s.selected = !0, s.selectedNodes = K([e]), "selectedKeys" in r || m((a) => {
213
+ const i = { ...a };
214
+ return i.selectedKeys = [e], i;
215
+ }), c == null || c([e], s);
216
+ (d = r.onNodeSelect) == null || d.call(r, e, t, s);
216
217
  }
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;
220
- if (s) {
221
- e ? i = i.concat(t) : i = i.filter((a) => a !== t);
222
- const m = {};
223
- "checkedKeys" in r || (m.checkedKeys = i), "halfCheckedKeys" in r || (m.halfCheckedKeys = y), Me(m) || k((a) => ({ ...a, ...m }));
218
+ function J(e, n, c) {
219
+ var u, w;
220
+ const { checkedStrategy: t } = N(), { onCheck: s, checkStrictly: l } = r, d = (u = f.current[n]) == null ? void 0 : u.dataRef, a = { e: c, node: K([n])[0] };
221
+ let i = [...o.checkedKeys || []], k = o.halfCheckedKeys;
222
+ if (l) {
223
+ e ? i = i.concat(n) : i = i.filter((g) => g !== n);
224
+ const x = {};
225
+ "checkedKeys" in r || (x.checkedKeys = i), "halfCheckedKeys" in r || (x.halfCheckedKeys = k), Me(x) || m((g) => ({ ...g, ...x }));
224
226
  } else {
225
- const { checkedKeys: m, indeterminateKeys: a } = Be(
226
- t,
227
+ const { checkedKeys: x, indeterminateKeys: g } = Be(
228
+ n,
227
229
  e,
228
230
  i,
229
231
  f.current,
230
- y
232
+ k
231
233
  );
232
- i = m, y = a, "checkedKeys" in r ? k((x) => {
233
- const h = { ...x };
234
- return h.halfCheckedKeys = y, h;
235
- }) : k((x) => {
236
- const h = { ...x };
237
- return h.checkedKeys = i, h.halfCheckedKeys = y, h;
238
- }), n === oe ? i = i.filter((x) => {
239
- const h = f.current[x];
234
+ i = x, k = g, "checkedKeys" in r ? m((y) => {
235
+ const h = { ...y };
236
+ return h.halfCheckedKeys = k, h;
237
+ }) : m((y) => {
238
+ const h = { ...y };
239
+ return h.checkedKeys = i, h.halfCheckedKeys = k, h;
240
+ }), t === oe ? i = i.filter((y) => {
241
+ const h = f.current[y];
240
242
  if (!h || i.indexOf(h.parentKey) === -1)
241
243
  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))
244
+ }) : t === ue && (i = i.filter((y) => {
245
+ var D, _;
246
+ const h = f.current[y];
247
+ if (!h || !((D = h.children) != null && D.length) || (_ = h.children) != null && _.every((z) => i.indexOf(z._key) === -1))
246
248
  return !0;
247
249
  }));
248
250
  }
249
- l == null || l(i, {
251
+ s == null || s(i, {
250
252
  checkedNodes: K(i),
251
253
  checked: e,
252
- halfCheckedKeys: y,
253
- halfCheckedNodes: K(y),
254
- ...d
255
- });
254
+ halfCheckedKeys: k,
255
+ halfCheckedNodes: K(k),
256
+ data: d,
257
+ // 潘启宝添加
258
+ ...a
259
+ }), (w = r.onNodeCheck) == null || w.call(r, n, d, a);
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) => {
264
- k((l) => {
265
- const s = { ...l };
266
- 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) => {
269
- k((l) => {
270
- const s = { ...l };
271
- return s.loadingKeys = l.loadingKeys.filter((d) => d !== e._key), s;
272
- }), console.error("[tree]load data error: ", n);
263
+ const { loadingKeys: n = [], loadedKeys: c } = o;
264
+ m((t) => {
265
+ const s = { ...t };
266
+ return s.loadingKeys = Array.from(/* @__PURE__ */ new Set([...n, e._key])), s.loadedKeys = c.filter((l) => l !== e._key), s;
267
+ }), I == null || I(K([e._key])[0]).then((t) => {
268
+ m((s) => {
269
+ const l = { ...s };
270
+ return l.loadingKeys = s.loadingKeys.filter((d) => d !== e._key), l.loadedKeys = Array.from(/* @__PURE__ */ new Set([...s.loadedKeys, e._key])), l;
271
+ }), W(!e.expanded, e._key);
272
+ }).catch((t) => {
273
+ m((s) => {
274
+ const l = { ...s };
275
+ return l.loadingKeys = s.loadingKeys.filter((d) => d !== e._key), l;
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: s } = c;
305
+ if (t === n.props._key)
302
306
  return !0;
303
- if (l === n)
307
+ if (s === t)
304
308
  return;
305
- c = f.current[l];
309
+ c = f.current[s];
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
- return l === void 0 && s === void 0 ? !1 : l === s;
317
+ const c = e.key, t = n.key;
318
+ if (c !== void 0 || t !== void 0)
319
+ return c === t;
320
+ const s = e.props._key, l = n.props._key;
321
+ return s === void 0 && l === void 0 ? !1 : s === l;
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({
324
- dropNode: s,
325
- dragNode: _.current,
323
+ function X(e, n, c) {
324
+ if (b.current) {
325
+ const { allowDrop: t } = N(), { onDrop: s } = r, l = K([n._key])[0];
326
+ if (s && !_e(n, b.current) && !Q(b.current, l)) {
327
+ if (t && !t({
328
+ dropNode: l,
329
+ dragNode: b.current,
326
330
  dropPosition: c
327
331
  }))
328
332
  return;
329
- l({
330
- dragNode: _.current,
331
- dropNode: s,
333
+ s({
334
+ dragNode: b.current,
335
+ dropNode: l,
332
336
  dropPosition: c,
333
337
  e
334
338
  });
335
339
  }
336
340
  }
337
341
  }
338
- function X(e, t) {
339
- const { allowDrop: c } = C();
340
- let n = !0;
341
- return typeof c == "function" && (n = c({
342
+ function Y(e, n) {
343
+ const { allowDrop: c } = N();
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 = [] } = o, { animation: s } = N(), { onExpand: l } = 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) => {
353
- const y = { ...i };
354
- return y.expandedKeys = d, y.currentExpandKeys = l ? [...c, t] : [], y;
355
- }), s == null || s(d, {
356
+ e ? d = Array.from(/* @__PURE__ */ new Set([...t, n])) : d = t.filter((a) => a !== n), "expandedKeys" in r || m((a) => {
357
+ const i = { ...a };
358
+ return i.expandedKeys = d, i.currentExpandKeys = s ? [...c, n] : [], i;
359
+ }), l == null || l(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 {
@@ -375,193 +379,189 @@ function Ge(r, ue) {
375
379
  halfCheckedKeysSet: (e == null ? void 0 : e.halfCheckedKeysSet) || new Set((o == null ? void 0 : o.halfCheckedKeys) || [])
376
380
  };
377
381
  }
378
- function A(e, t) {
379
- const { autoExpandParent: c } = C(), { loadMore: n } = r, {
380
- selectedKeys: l,
381
- expandedKeys: s,
382
+ function A(e, n) {
383
+ const { autoExpandParent: c } = N(), { loadMore: t } = r, {
384
+ selectedKeys: s,
385
+ expandedKeys: l,
382
386
  checkedKeys: d,
383
- loadingKeys: i = [],
384
- loadedKeys: y = []
387
+ loadingKeys: a = [],
388
+ loadedKeys: i = []
385
389
  } = 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
390
+ expandedKeysSet: k,
391
+ checkedKeysSet: u,
392
+ selectedKeysSet: w,
393
+ halfCheckedKeysSet: x
394
+ } = j(n), g = (y) => {
395
+ const h = y.children && y.children.length, D = {
396
+ isLeaf: !h,
397
+ autoExpandParent: h ? c : !1,
398
+ expanded: k ? k.has(y._key) : l.indexOf(y._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 _ = i.indexOf(y._key) > -1;
402
+ D.loaded = _, D.isLeaf = h ? !1 : y.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),
407
- selectedKeys: l,
405
+ ...y,
406
+ ...D,
407
+ selected: w.has(y._key),
408
+ indeterminated: x.has(y._key),
409
+ loading: a.indexOf(y._key) > -1,
410
+ checked: u.has(y._key),
411
+ selectedKeys: s,
408
412
  checkedKeys: d,
409
- loadingKeys: i,
410
- loadedKeys: y,
411
- expandedKeys: s,
412
- childrenData: u.children || [],
413
+ loadingKeys: a,
414
+ loadedKeys: i,
415
+ expandedKeys: l,
416
+ childrenData: y.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((y) => g(y)) : g(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
+ m((n) => {
424
+ const c = { ...n }, { currentExpandKeys: t } = n;
425
+ return t.indexOf(e) > -1 && (c.currentExpandKeys = t.filter((s, l, d) => s !== e)), c;
422
426
  });
423
427
  }
424
- function Z() {
428
+ function p() {
425
429
  return o;
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 = N(e), c = N();
445
+ if (e !== r || !L(n, c)) {
446
+ const t = {};
447
+ if (Ke(
448
+ { prevMergedProps: n, ...e },
445
449
  { ...c, ...r }
446
450
  )) {
447
- const s = H(), d = $(s);
448
- n.treeData = s, n.nodeList = d;
451
+ const l = H(), d = $(l);
452
+ t.treeData = l, 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(
452
- s || []
454
+ if (t.treeData || "checkedKeys" in r && !L(e == null ? void 0 : e.checkedKeys, r.checkedKeys)) {
455
+ const l = "checkedKeys" in r ? r.checkedKeys : o.checkedKeys, { halfCheckedKeys: d, checkedKeys: a } = R(
456
+ l || []
453
457
  );
454
- E(i, o.checkedKeys) || (n.checkedKeys = i), E(d, o.halfCheckedKeys) || (n.halfCheckedKeys = d);
458
+ L(a, o.checkedKeys) || (t.checkedKeys = a), L(d, o.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) => {
457
- const i = s.indexOf(d);
458
- return i === -1 ? s.push(d) : s.splice(i, 1), s;
459
- }, []).filter((s, d, i) => {
460
- var y;
461
- 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;
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 ?? [], ...o.expandedKeys ?? []].reduce((l, d) => {
461
+ const a = l.indexOf(d);
462
+ return a === -1 ? l.push(d) : l.splice(a, 1), l;
463
+ }, []).filter((l, d, a) => {
464
+ var i;
465
+ if (f.current[l])
466
+ return f.current[l].pathParentKeys.some((u) => a.indexOf(u) > -1) ? !1 : (i = f.current[l].children) == null ? void 0 : i.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 s = t.currentExpandKeys || o.currentExpandKeys;
469
+ t.treeData && s && (t.currentExpandKeys = s.filter((l) => {
470
+ const d = t.treeData.find((a) => a.key === l);
467
471
  return d && d.children && d.children.length;
468
- })), Object.keys(n).length && k((s) => ({ ...s, ...n }));
472
+ })), Object.keys(t).length && m((l) => ({ ...l, ...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, o.selectedKeys) && m((e) => {
477
+ const n = { ...e };
478
+ return n.selectedKeys = r.selectedKeys || [], n;
475
479
  }), () => {
476
- }), [r.selectedKeys, o.selectedKeys]), z(() => {
477
- var l;
478
- const e = H(), t = $(e, (l = g.getPrefixCls) == null ? void 0 : l.call(g, "tree")), { checkedKeys: c, halfCheckedKeys: n } = W(
480
+ }), [r.selectedKeys, o.selectedKeys]), B(() => {
481
+ var s;
482
+ const e = H(), n = $(e, (s = C.getPrefixCls) == null ? void 0 : s.call(C, "tree")), { checkedKeys: c, halfCheckedKeys: t } = R(
479
483
  r.checkedKeys || r.defaultCheckedKeys || []
480
484
  );
481
- return k((s) => {
482
- let d = { ...s };
485
+ return m((l) => {
486
+ let d = { ...l };
483
487
  return d = {
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
+ } = N(), { 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 } = C, 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);
544
- }
541
+ loadMore: I && me,
542
+ allowDrop: Y,
543
+ actionOnClick: we,
544
+ virtualListProps: re
545
545
  },
546
- children: /* @__PURE__ */ re(
546
+ children: /* @__PURE__ */ se(
547
547
  je,
548
548
  {
549
549
  ref: (e) => {
550
550
  M.current = e;
551
551
  },
552
- className: le(
553
- O,
552
+ className: de(
553
+ P,
554
554
  {
555
- [`${O}-checkable`]: we,
556
- [`${O}-show-line`]: be,
557
- [`${O}-size-${p}`]: p,
558
- [`${O}-rtl`]: Oe
555
+ [`${P}-checkable`]: Oe,
556
+ [`${P}-show-line`]: De,
557
+ [`${P}-size-${ee}`]: ee,
558
+ [`${P}-rtl`]: Pe
559
559
  },
560
- _e
560
+ be
561
561
  ),
562
- style: De,
562
+ style: Ee,
563
563
  filterNode: r.filterNode,
564
- virtualListProps: ce,
564
+ virtualListProps: re,
565
565
  expandedKeys: o.expandedKeys,
566
566
  currentExpandKeys: o.currentExpandKeys,
567
567
  getNodeProps: A,
@@ -572,7 +572,7 @@ function Ge(r, ue) {
572
572
  role: "tree",
573
573
  "aria-multiselectable": r.multiple,
574
574
  tabIndex: 0,
575
- ...We(r)
575
+ ...Re(r)
576
576
  }
577
577
  }
578
578
  )
@@ -584,10 +584,10 @@ const v = Se(
584
584
  );
585
585
  v.displayName = "Tree";
586
586
  v.SHOW_PARENT = oe;
587
- v.SHOW_ALL = ae;
588
- v.SHOW_CHILD = ye;
589
- v.Node = de;
587
+ v.SHOW_ALL = ye;
588
+ v.SHOW_CHILD = ue;
589
+ v.Node = ie;
590
590
  export {
591
- de as TreeNode,
591
+ ie as TreeNode,
592
592
  v as default
593
593
  };