@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.
- package/Upload.js +4 -4
- package/color-picker/Mode.js +6 -7
- package/index.js +171 -171
- package/package.json +1 -1
- package/tree/Node.js +72 -72
- package/tree/Tree.js +332 -332
- package/types/common/empty/index.d.ts +1 -1
- package/types/common/icons/file/index.d.ts +1 -1
- package/types/common/space/index.d.ts +1 -1
- package/types/pc/anchor/context.d.ts +1 -1
- package/types/pc/color-picker/InputHex.d.ts +1 -1
- package/types/pc/color-picker/InputRgb.d.ts +1 -1
- package/types/pc/color-picker/Mode.d.ts +1 -1
- package/types/pc/color-picker/Palette.d.ts +1 -1
- package/types/pc/color-picker/utils.d.ts +1 -1
- package/types/pc/config-provider/context.d.ts +1 -1
- package/types/pc/date-picker/Picker.d.ts +1 -1
- package/types/pc/date-picker/RangePicker.d.ts +1 -1
- package/types/pc/grid/context.d.ts +1 -1
- package/types/pc/grid/util.d.ts +1 -1
- package/types/pc/hooks/use-watermark/index.d.ts +1 -1
- package/types/pc/icons/file/index.d.ts +1 -1
- package/types/pc/input/index.d.ts +1 -1
- package/types/pc/message/index.d.ts +1 -2
- package/types/pc/message/useMessage.d.ts +1 -1
- package/types/pc/notification/useNotification.d.ts +1 -1
- package/types/pc/space/index.d.ts +1 -1
- package/types/pc/table/ColGroup.d.ts +1 -1
- package/types/pc/table/constant.d.ts +1 -1
- package/types/pc/tree/Context.d.ts +1 -2
- package/types/pc/tree/index.d.ts +1 -1
- package/types/pc/tree/interface.d.ts +5 -1
- package/types/pc/trigger/getPopupStyle.d.ts +1 -1
- package/types/pc/typography/EditContent.d.ts +1 -1
- package/types/pc/typography/Ellipsis.d.ts +1 -1
- package/types/pc/typography/Paragraph.d.ts +1 -1
- package/types/pc/typography/Title.d.ts +1 -1
- package/types/pc/upload/Upload.d.ts +2 -2
- package/types/pc/upload/constant.d.ts +4 -0
- package/types/pc/upload/index.d.ts +2 -0
- package/types/pc/upload/interface.d.ts +0 -3
- package/types/pc/upload/request.d.ts +1 -1
- package/types/pc/upload/util.d.ts +1 -1
- package/types/pc/verification-code/VerificationCode.d.ts +1 -1
- package/types/pc/verification-code/index.d.ts +1 -1
- package/types/pc/watermark/Watermark.d.ts +1 -1
- package/types/pc/watermark/index.d.ts +1 -1
- package/upload/Upload.js +52 -53
- package/upload/Uploader.js +1 -1
- package/upload/constant.js +9 -0
- package/upload/index.js +4 -4
- package/upload/interface.js +1 -9
- package/upload/list/PictureItem.js +1 -1
- package/upload/list/TextItem.js +1 -1
- package/upload/list/UploadProgress.js +1 -1
- package/upload/list/index.js +1 -1
- package/version/index.js +1 -1
package/tree/Tree.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as Se, useContext as ve, useRef as S, useState as Te, useImperativeHandle as Ae, useEffect as
|
|
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
|
|
5
|
-
import
|
|
4
|
+
import E from "lodash/get";
|
|
5
|
+
import q from "lodash/has";
|
|
6
6
|
import He from "lodash/isArray";
|
|
7
|
-
import
|
|
7
|
+
import L from "lodash/isEqualWith";
|
|
8
8
|
import $e from "lodash/isFunction";
|
|
9
|
-
import
|
|
9
|
+
import le from "lodash/isUndefined";
|
|
10
10
|
import "../config-provider/ConfigProvider.js";
|
|
11
|
-
import
|
|
12
|
-
import { pickDataAttributes as
|
|
13
|
-
import { TreeContext as
|
|
14
|
-
import
|
|
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
|
|
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",
|
|
27
|
+
}, oe = "parent", ye = "all", ue = "child", Ue = {
|
|
28
28
|
selectable: !0,
|
|
29
29
|
autoExpandParent: !0,
|
|
30
|
-
checkedStrategy:
|
|
30
|
+
checkedStrategy: ye,
|
|
31
31
|
actionOnClick: "select",
|
|
32
32
|
allowDrop: () => !0,
|
|
33
|
-
fieldNames:
|
|
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,
|
|
53
|
-
const
|
|
54
|
-
var
|
|
55
|
-
const e = H(),
|
|
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:
|
|
62
|
-
expandedKeys:
|
|
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:
|
|
68
|
+
nodeList: n
|
|
69
69
|
};
|
|
70
70
|
});
|
|
71
|
-
function
|
|
72
|
-
const { componentConfig:
|
|
73
|
-
return Ve.forEach((
|
|
74
|
-
|
|
75
|
-
}),
|
|
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
|
|
77
|
+
function he(e, n) {
|
|
78
78
|
let c = e;
|
|
79
|
-
|
|
79
|
+
n && (c = n._key), M.current && M.current.scrollIntoView(
|
|
80
80
|
c,
|
|
81
|
-
|
|
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
|
|
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 !==
|
|
99
|
+
return e.treeData !== n.treeData || e.children !== n.children || c.some((t) => L(e[t], n[t]));
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
...
|
|
104
|
-
..."treeData" in r ?
|
|
105
|
-
},
|
|
106
|
-
children:
|
|
107
|
-
selectable:
|
|
108
|
-
checkable:
|
|
109
|
-
title:
|
|
110
|
-
disabled:
|
|
111
|
-
disableCheckbox:
|
|
112
|
-
isLeaf:
|
|
113
|
-
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
|
|
115
|
+
return q(e, t.key) || delete s.key, s;
|
|
116
116
|
}
|
|
117
|
-
function $(e,
|
|
118
|
-
var
|
|
117
|
+
function $(e, n) {
|
|
118
|
+
var i;
|
|
119
119
|
f.current = {};
|
|
120
|
-
const c =
|
|
121
|
-
let
|
|
122
|
-
const { showLine:
|
|
123
|
-
const
|
|
124
|
-
return
|
|
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:
|
|
127
|
-
selectable:
|
|
128
|
-
checkable:
|
|
129
|
-
key:
|
|
130
|
-
...
|
|
131
|
-
} =
|
|
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:
|
|
133
|
+
dataRef: x,
|
|
134
134
|
draggable: r.draggable,
|
|
135
|
-
selectable:
|
|
136
|
-
checkable:
|
|
137
|
-
showLine:
|
|
135
|
+
selectable: h,
|
|
136
|
+
checkable: D,
|
|
137
|
+
showLine: l,
|
|
138
138
|
blockNode: d,
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
key:
|
|
142
|
-
children:
|
|
143
|
-
_key:
|
|
144
|
-
_index:
|
|
145
|
-
parentKey:
|
|
146
|
-
pathParentKeys:
|
|
147
|
-
_level:
|
|
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:
|
|
149
|
+
_lineless: u && u._lineless ? [...u._lineless || [], u._isTail] : []
|
|
150
150
|
};
|
|
151
|
-
return
|
|
151
|
+
return w === g + 1 && (O.className = de(
|
|
152
152
|
`${c}-node-is-tail`,
|
|
153
|
-
|
|
154
|
-
)),
|
|
155
|
-
_key:
|
|
156
|
-
_level:
|
|
157
|
-
_lineless:
|
|
158
|
-
_isTail:
|
|
159
|
-
pathParentKeys: [...(
|
|
160
|
-
})),
|
|
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
|
|
163
|
+
return a(e || [], {}), t;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
if (!
|
|
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
|
|
171
|
-
return
|
|
170
|
+
const t = f.current[c];
|
|
171
|
+
return t.children && t.children.length;
|
|
172
172
|
});
|
|
173
|
-
const
|
|
173
|
+
const n = {};
|
|
174
174
|
return e.forEach((c) => {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
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(
|
|
179
|
+
}), Object.keys(n);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function R(e) {
|
|
182
182
|
if (!r.checkStrictly) {
|
|
183
|
-
const { checkedKeys:
|
|
183
|
+
const { checkedKeys: n, indeterminateKeys: c } = ze(
|
|
184
184
|
e,
|
|
185
185
|
f.current
|
|
186
186
|
);
|
|
187
187
|
return {
|
|
188
|
-
checkedKeys:
|
|
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
|
|
198
|
-
var l;
|
|
199
|
-
const { onSelect: c } = r,
|
|
200
|
-
e:
|
|
201
|
-
data:
|
|
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
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
return
|
|
210
|
-
}), c == null || c(
|
|
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
|
-
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
}), c == null || c([e],
|
|
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
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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:
|
|
226
|
-
|
|
227
|
+
const { checkedKeys: x, indeterminateKeys: g } = Be(
|
|
228
|
+
n,
|
|
227
229
|
e,
|
|
228
230
|
i,
|
|
229
231
|
f.current,
|
|
230
|
-
|
|
232
|
+
k
|
|
231
233
|
);
|
|
232
|
-
i =
|
|
233
|
-
const h = { ...
|
|
234
|
-
return h.halfCheckedKeys =
|
|
235
|
-
}) :
|
|
236
|
-
const h = { ...
|
|
237
|
-
return h.checkedKeys = i, h.halfCheckedKeys =
|
|
238
|
-
}),
|
|
239
|
-
const h = f.current[
|
|
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
|
-
}) :
|
|
243
|
-
var
|
|
244
|
-
const h = f.current[
|
|
245
|
-
if (!h || !((
|
|
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
|
-
|
|
251
|
+
s == null || s(i, {
|
|
250
252
|
checkedNodes: K(i),
|
|
251
253
|
checked: e,
|
|
252
|
-
halfCheckedKeys:
|
|
253
|
-
halfCheckedNodes: K(
|
|
254
|
-
|
|
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
|
|
261
|
+
function me(e) {
|
|
258
262
|
if ($e(r.loadMore)) {
|
|
259
|
-
const { loadingKeys:
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
return
|
|
263
|
-
}), I == null || I(K([e._key])[0]).then((
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
-
return
|
|
267
|
-
}),
|
|
268
|
-
}).catch((
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
}), console.error("[tree]load data error: ",
|
|
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
|
|
278
|
-
|
|
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([
|
|
284
|
+
c == null || c(e, K([n._key])[0]);
|
|
281
285
|
}
|
|
282
|
-
function
|
|
283
|
-
|
|
286
|
+
function ge(e, n) {
|
|
287
|
+
b.current = null, T.current = 0;
|
|
284
288
|
const { onDragEnd: c } = r;
|
|
285
|
-
c == null || c(e, K([
|
|
289
|
+
c == null || c(e, K([n._key])[0]);
|
|
286
290
|
}
|
|
287
|
-
function
|
|
291
|
+
function Ce(e, n, c) {
|
|
288
292
|
T.current = c;
|
|
289
|
-
const { onDragOver:
|
|
290
|
-
|
|
293
|
+
const { onDragOver: t } = r;
|
|
294
|
+
t == null || t(e, K([n._key])[0]);
|
|
291
295
|
}
|
|
292
|
-
function
|
|
296
|
+
function Ne(e, n) {
|
|
293
297
|
T.current = 0;
|
|
294
298
|
const { onDragLeave: c } = r;
|
|
295
|
-
c == null || c(e, K([
|
|
299
|
+
c == null || c(e, K([n._key])[0]);
|
|
296
300
|
}
|
|
297
|
-
function
|
|
301
|
+
function _e(e, n) {
|
|
298
302
|
let c = f.current[e.parentKey];
|
|
299
303
|
for (; c; ) {
|
|
300
|
-
const { _key:
|
|
301
|
-
if (
|
|
304
|
+
const { _key: t, parentKey: s } = c;
|
|
305
|
+
if (t === n.props._key)
|
|
302
306
|
return !0;
|
|
303
|
-
if (
|
|
307
|
+
if (s === t)
|
|
304
308
|
return;
|
|
305
|
-
c = f.current[
|
|
309
|
+
c = f.current[s];
|
|
306
310
|
}
|
|
307
311
|
}
|
|
308
|
-
function
|
|
309
|
-
if (e === void 0 ||
|
|
312
|
+
function Q(e, n) {
|
|
313
|
+
if (e === void 0 || n === void 0)
|
|
310
314
|
return !1;
|
|
311
|
-
if (e ===
|
|
315
|
+
if (e === n)
|
|
312
316
|
return !0;
|
|
313
|
-
const c = e.key,
|
|
314
|
-
if (c !== void 0 ||
|
|
315
|
-
return c ===
|
|
316
|
-
const
|
|
317
|
-
return
|
|
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
|
|
320
|
-
if (
|
|
321
|
-
const { allowDrop:
|
|
322
|
-
if (
|
|
323
|
-
if (
|
|
324
|
-
dropNode:
|
|
325
|
-
dragNode:
|
|
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
|
-
|
|
330
|
-
dragNode:
|
|
331
|
-
dropNode:
|
|
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
|
|
339
|
-
const { allowDrop: c } =
|
|
340
|
-
let
|
|
341
|
-
return typeof c == "function" && (
|
|
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:
|
|
344
|
-
dropPosition:
|
|
345
|
-
})),
|
|
347
|
+
dragNode: b.current,
|
|
348
|
+
dropPosition: n
|
|
349
|
+
})), t;
|
|
346
350
|
}
|
|
347
|
-
function
|
|
348
|
-
const { currentExpandKeys: c, expandedKeys:
|
|
349
|
-
if (c.indexOf(
|
|
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([...
|
|
353
|
-
const
|
|
354
|
-
return
|
|
355
|
-
}),
|
|
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([
|
|
361
|
+
node: K([n])[0],
|
|
358
362
|
expandedNodes: K(d)
|
|
359
363
|
});
|
|
360
364
|
}
|
|
361
365
|
function K(e) {
|
|
362
|
-
const { __PqbAdapterMode__:
|
|
366
|
+
const { __PqbAdapterMode__: n } = r;
|
|
363
367
|
return A(
|
|
364
|
-
[].concat(e).map((
|
|
365
|
-
).map((
|
|
366
|
-
props:
|
|
368
|
+
[].concat(e).map((t) => f.current[t]).filter(Boolean)
|
|
369
|
+
).map((t) => n ? {
|
|
370
|
+
props: t,
|
|
367
371
|
key: e
|
|
368
|
-
} : /* @__PURE__ */ Ie(
|
|
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,
|
|
379
|
-
const { autoExpandParent: c } =
|
|
380
|
-
selectedKeys:
|
|
381
|
-
expandedKeys:
|
|
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:
|
|
384
|
-
loadedKeys:
|
|
387
|
+
loadingKeys: a = [],
|
|
388
|
+
loadedKeys: i = []
|
|
385
389
|
} = o, {
|
|
386
|
-
expandedKeysSet:
|
|
387
|
-
checkedKeysSet:
|
|
388
|
-
selectedKeysSet:
|
|
389
|
-
halfCheckedKeysSet:
|
|
390
|
-
} = j(
|
|
391
|
-
const
|
|
392
|
-
isLeaf: !
|
|
393
|
-
autoExpandParent:
|
|
394
|
-
expanded:
|
|
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 (
|
|
397
|
-
const
|
|
398
|
-
|
|
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
|
-
...
|
|
402
|
-
...
|
|
403
|
-
selected:
|
|
404
|
-
indeterminated:
|
|
405
|
-
loading:
|
|
406
|
-
checked:
|
|
407
|
-
selectedKeys:
|
|
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:
|
|
410
|
-
loadedKeys:
|
|
411
|
-
expandedKeys:
|
|
412
|
-
childrenData:
|
|
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((
|
|
420
|
+
return He(e) ? e.map((y) => g(y)) : g(e);
|
|
417
421
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
420
|
-
const c = { ...
|
|
421
|
-
return
|
|
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
|
|
428
|
+
function p() {
|
|
425
429
|
return o;
|
|
426
430
|
}
|
|
427
|
-
Ae(
|
|
428
|
-
scrollIntoView:
|
|
429
|
-
handleCheck:
|
|
430
|
-
getTreeState:
|
|
431
|
-
handleExpandEnd:
|
|
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:
|
|
436
|
-
handleAllowDrop:
|
|
437
|
-
handleNodeDrop:
|
|
438
|
-
isSameNode:
|
|
439
|
-
})),
|
|
440
|
-
const e =
|
|
441
|
-
if (e !== r || !
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
{ prevMergedProps:
|
|
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
|
|
448
|
-
|
|
451
|
+
const l = H(), d = $(l);
|
|
452
|
+
t.treeData = l, t.nodeList = d;
|
|
449
453
|
}
|
|
450
|
-
if (
|
|
451
|
-
const
|
|
452
|
-
|
|
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
|
-
|
|
458
|
+
L(a, o.checkedKeys) || (t.checkedKeys = a), L(d, o.halfCheckedKeys) || (t.halfCheckedKeys = d);
|
|
455
459
|
}
|
|
456
|
-
r.checkStrictly && "halfCheckedKeys" in r && !
|
|
457
|
-
const
|
|
458
|
-
return
|
|
459
|
-
}, []).filter((
|
|
460
|
-
var
|
|
461
|
-
if (f.current[
|
|
462
|
-
return f.current[
|
|
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
|
|
465
|
-
|
|
466
|
-
const d =
|
|
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(
|
|
472
|
+
})), Object.keys(t).length && m((l) => ({ ...l, ...t }));
|
|
469
473
|
}
|
|
470
|
-
return
|
|
474
|
+
return U.current = r, () => {
|
|
471
475
|
};
|
|
472
|
-
}),
|
|
473
|
-
const
|
|
474
|
-
return
|
|
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]),
|
|
477
|
-
var
|
|
478
|
-
const e = H(),
|
|
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
|
|
482
|
-
let d = { ...
|
|
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:
|
|
488
|
-
expandedKeys:
|
|
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:
|
|
498
|
+
nodeList: n
|
|
495
499
|
}, d;
|
|
496
500
|
}), () => {
|
|
497
501
|
};
|
|
498
502
|
}, []);
|
|
499
503
|
const {
|
|
500
|
-
className:
|
|
501
|
-
showLine:
|
|
502
|
-
size:
|
|
503
|
-
virtualListProps:
|
|
504
|
+
className: be,
|
|
505
|
+
showLine: De,
|
|
506
|
+
size: ee,
|
|
507
|
+
virtualListProps: te,
|
|
504
508
|
height: ne,
|
|
505
|
-
style:
|
|
506
|
-
icons:
|
|
507
|
-
actionOnClick:
|
|
508
|
-
animation:
|
|
509
|
-
} =
|
|
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
|
-
...
|
|
515
|
+
...te
|
|
512
516
|
} : ne ? { height: ne, threshold: 100 } : {
|
|
513
517
|
threshold: null
|
|
514
|
-
}, { getPrefixCls: F, rtl:
|
|
515
|
-
return /* @__PURE__ */
|
|
516
|
-
|
|
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:
|
|
520
|
-
animation:
|
|
523
|
+
icons: Le,
|
|
524
|
+
animation: ce,
|
|
521
525
|
key2nodeProps: f.current,
|
|
522
|
-
getFieldInfo:
|
|
523
|
-
getTreeState:
|
|
526
|
+
getFieldInfo: V,
|
|
527
|
+
getTreeState: p,
|
|
524
528
|
getNodeProps: A,
|
|
525
|
-
onExpandEnd:
|
|
529
|
+
onExpandEnd: ce ? Z : () => {
|
|
526
530
|
},
|
|
527
|
-
onSelect:
|
|
528
|
-
onCheck:
|
|
529
|
-
onNodeDragStart:
|
|
530
|
-
onNodeDragEnd:
|
|
531
|
-
onNodeDragLeave:
|
|
532
|
-
onNodeDragOver:
|
|
533
|
-
onNodeDrop:
|
|
534
|
-
onExpand:
|
|
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 &&
|
|
538
|
-
allowDrop:
|
|
539
|
-
actionOnClick:
|
|
540
|
-
virtualListProps:
|
|
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__ */
|
|
546
|
+
children: /* @__PURE__ */ se(
|
|
547
547
|
je,
|
|
548
548
|
{
|
|
549
549
|
ref: (e) => {
|
|
550
550
|
M.current = e;
|
|
551
551
|
},
|
|
552
|
-
className:
|
|
553
|
-
|
|
552
|
+
className: de(
|
|
553
|
+
P,
|
|
554
554
|
{
|
|
555
|
-
[`${
|
|
556
|
-
[`${
|
|
557
|
-
[`${
|
|
558
|
-
[`${
|
|
555
|
+
[`${P}-checkable`]: Oe,
|
|
556
|
+
[`${P}-show-line`]: De,
|
|
557
|
+
[`${P}-size-${ee}`]: ee,
|
|
558
|
+
[`${P}-rtl`]: Pe
|
|
559
559
|
},
|
|
560
|
-
|
|
560
|
+
be
|
|
561
561
|
),
|
|
562
|
-
style:
|
|
562
|
+
style: Ee,
|
|
563
563
|
filterNode: r.filterNode,
|
|
564
|
-
virtualListProps:
|
|
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
|
-
...
|
|
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 =
|
|
588
|
-
v.SHOW_CHILD =
|
|
589
|
-
v.Node =
|
|
587
|
+
v.SHOW_ALL = ye;
|
|
588
|
+
v.SHOW_CHILD = ue;
|
|
589
|
+
v.Node = ie;
|
|
590
590
|
export {
|
|
591
|
-
|
|
591
|
+
ie as TreeNode,
|
|
592
592
|
v as default
|
|
593
593
|
};
|