@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.
- 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 +5 -5
- package/tree/Tree.js +287 -283
- 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 +2 -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 g = ve(qe),
|
|
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(),
|
|
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:
|
|
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
71
|
function C(e) {
|
|
72
|
-
const { componentConfig:
|
|
72
|
+
const { componentConfig: n } = g ?? {}, c = e || r, t = (n == null ? void 0 : n.Tree) || {}, l = {};
|
|
73
73
|
return Ve.forEach((s) => {
|
|
74
|
-
|
|
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
|
|
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 ?
|
|
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:
|
|
107
|
-
selectable:
|
|
108
|
-
checkable:
|
|
109
|
-
title:
|
|
110
|
-
disabled:
|
|
111
|
-
disableCheckbox:
|
|
112
|
-
isLeaf:
|
|
113
|
-
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
|
|
115
|
+
return q(e, t.key) || delete l.key, l;
|
|
116
116
|
}
|
|
117
|
-
function $(e,
|
|
117
|
+
function $(e, n) {
|
|
118
118
|
var y;
|
|
119
119
|
f.current = {};
|
|
120
|
-
const c =
|
|
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 = (
|
|
123
|
-
const
|
|
124
|
-
return
|
|
122
|
+
const { showLine: s, blockNode: d } = C(), i = (_, u) => {
|
|
123
|
+
const w = _.length;
|
|
124
|
+
return _.map((m, x) => {
|
|
125
125
|
const {
|
|
126
|
-
children:
|
|
127
|
-
selectable:
|
|
128
|
-
checkable:
|
|
129
|
-
key:
|
|
130
|
-
...
|
|
131
|
-
} =
|
|
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:
|
|
133
|
+
dataRef: m,
|
|
134
134
|
draggable: r.draggable,
|
|
135
|
-
selectable:
|
|
136
|
-
checkable:
|
|
135
|
+
selectable: h,
|
|
136
|
+
checkable: D,
|
|
137
137
|
showLine: s,
|
|
138
138
|
blockNode: d,
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
key:
|
|
142
|
-
children:
|
|
143
|
-
_key:
|
|
139
|
+
...m,
|
|
140
|
+
...z,
|
|
141
|
+
key: N,
|
|
142
|
+
children: o,
|
|
143
|
+
_key: N,
|
|
144
144
|
_index: l++,
|
|
145
|
-
parentKey:
|
|
146
|
-
pathParentKeys:
|
|
147
|
-
_level:
|
|
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 === x + 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[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 || [], {}),
|
|
163
|
+
return i(e || [], {}), t;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
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
|
|
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((l) => {
|
|
177
|
+
n[l] = 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,140 +194,144 @@ function Ge(r, ue) {
|
|
|
194
194
|
halfCheckedKeys: r.halfCheckedKeys || []
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function ke(e, n) {
|
|
198
198
|
var l;
|
|
199
|
-
const { onSelect: c } = r,
|
|
200
|
-
e:
|
|
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 = [...
|
|
207
|
-
d > -1 ? (s.splice(d, 1),
|
|
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,
|
|
210
|
+
}), c == null || c(s, t);
|
|
211
211
|
} else
|
|
212
|
-
|
|
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],
|
|
215
|
+
}), c == null || c([e], t);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
219
|
-
|
|
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(
|
|
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((
|
|
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:
|
|
226
|
-
|
|
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 =
|
|
233
|
-
const h = { ...
|
|
233
|
+
i = m, y = x, "checkedKeys" in r ? k((o) => {
|
|
234
|
+
const h = { ...o };
|
|
234
235
|
return h.halfCheckedKeys = y, h;
|
|
235
|
-
}) : k((
|
|
236
|
-
const h = { ...
|
|
236
|
+
}) : k((o) => {
|
|
237
|
+
const h = { ...o };
|
|
237
238
|
return h.checkedKeys = i, h.halfCheckedKeys = y, h;
|
|
238
|
-
}),
|
|
239
|
-
const h = f.current[
|
|
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
|
-
}) :
|
|
243
|
-
var
|
|
244
|
-
const h = f.current[
|
|
245
|
-
if (!h || !((
|
|
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
|
|
261
|
+
function me(e) {
|
|
258
262
|
if ($e(r.loadMore)) {
|
|
259
|
-
const { loadingKeys:
|
|
260
|
-
k((
|
|
261
|
-
const l = { ...
|
|
262
|
-
return l.loadingKeys = Array.from(/* @__PURE__ */ new Set([...
|
|
263
|
-
}), I == null || I(K([e._key])[0]).then((
|
|
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
|
-
}),
|
|
268
|
-
}).catch((
|
|
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: ",
|
|
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: l } = c;
|
|
305
|
+
if (t === n.props._key)
|
|
302
306
|
return !0;
|
|
303
|
-
if (l ===
|
|
307
|
+
if (l === t)
|
|
304
308
|
return;
|
|
305
309
|
c = f.current[l];
|
|
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 l = e.props._key, s =
|
|
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
|
|
320
|
-
if (
|
|
321
|
-
const { allowDrop:
|
|
322
|
-
if (l && !
|
|
323
|
-
if (
|
|
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:
|
|
329
|
+
dragNode: b.current,
|
|
326
330
|
dropPosition: c
|
|
327
331
|
}))
|
|
328
332
|
return;
|
|
329
333
|
l({
|
|
330
|
-
dragNode:
|
|
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
|
|
342
|
+
function Y(e, n) {
|
|
339
343
|
const { allowDrop: c } = C();
|
|
340
|
-
let
|
|
341
|
-
return typeof c == "function" && (
|
|
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 = [] } = 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([...
|
|
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,
|
|
358
|
+
return y.expandedKeys = d, y.currentExpandKeys = l ? [...c, n] : [], y;
|
|
355
359
|
}), s == null || s(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 {
|
|
372
|
-
expandedKeysSet: (e == null ? void 0 : e.expandedKeysSet) || new Set((
|
|
373
|
-
checkedKeysSet: (e == null ? void 0 : e.checkedKeysSet) || new Set((
|
|
374
|
-
selectedKeysSet: (e == null ? void 0 : e.selectedKeysSet) || new Set((
|
|
375
|
-
halfCheckedKeysSet: (e == null ? void 0 : e.halfCheckedKeysSet) || new Set((
|
|
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,
|
|
379
|
-
const { autoExpandParent: c } = C(), { loadMore:
|
|
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
|
-
} =
|
|
386
|
-
expandedKeysSet:
|
|
387
|
-
checkedKeysSet:
|
|
388
|
-
selectedKeysSet:
|
|
389
|
-
halfCheckedKeysSet:
|
|
390
|
-
} = j(
|
|
391
|
-
const
|
|
392
|
-
isLeaf: !
|
|
393
|
-
autoExpandParent:
|
|
394
|
-
expanded:
|
|
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 (
|
|
397
|
-
const
|
|
398
|
-
|
|
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
|
-
...
|
|
402
|
-
...
|
|
403
|
-
selected:
|
|
404
|
-
indeterminated:
|
|
405
|
-
loading: i.indexOf(
|
|
406
|
-
checked:
|
|
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:
|
|
416
|
+
childrenData: o.children || [],
|
|
413
417
|
children: null
|
|
414
418
|
};
|
|
415
419
|
};
|
|
416
|
-
return He(e) ? e.map((
|
|
420
|
+
return He(e) ? e.map((o) => x(o)) : x(e);
|
|
417
421
|
}
|
|
418
|
-
function
|
|
419
|
-
k((
|
|
420
|
-
const c = { ...
|
|
421
|
-
return
|
|
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
|
|
425
|
-
return
|
|
428
|
+
function p() {
|
|
429
|
+
return a;
|
|
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 = 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
|
-
|
|
452
|
+
t.treeData = s, t.nodeList = d;
|
|
449
453
|
}
|
|
450
|
-
if (
|
|
451
|
-
const s = "checkedKeys" in r ? r.checkedKeys :
|
|
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
|
-
|
|
458
|
+
L(i, a.checkedKeys) || (t.checkedKeys = i), L(d, a.halfCheckedKeys) || (t.halfCheckedKeys = d);
|
|
455
459
|
}
|
|
456
|
-
r.checkStrictly && "halfCheckedKeys" in r && !
|
|
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((
|
|
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 =
|
|
465
|
-
|
|
466
|
-
const d =
|
|
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(
|
|
472
|
+
})), Object.keys(t).length && k((s) => ({ ...s, ...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, a.selectedKeys) && k((e) => {
|
|
477
|
+
const n = { ...e };
|
|
478
|
+
return n.selectedKeys = r.selectedKeys || [], n;
|
|
475
479
|
}), () => {
|
|
476
|
-
}), [r.selectedKeys,
|
|
480
|
+
}), [r.selectedKeys, a.selectedKeys]), B(() => {
|
|
477
481
|
var l;
|
|
478
|
-
const e = H(),
|
|
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:
|
|
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
|
-
} = C(), { loadMore: I, checkable:
|
|
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
|
-
...
|
|
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 } = g, 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
|
-
|
|
542
|
-
var
|
|
543
|
-
(
|
|
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__ */
|
|
550
|
+
children: /* @__PURE__ */ se(
|
|
547
551
|
je,
|
|
548
552
|
{
|
|
549
553
|
ref: (e) => {
|
|
550
554
|
M.current = e;
|
|
551
555
|
},
|
|
552
|
-
className:
|
|
553
|
-
|
|
556
|
+
className: de(
|
|
557
|
+
P,
|
|
554
558
|
{
|
|
555
|
-
[`${
|
|
556
|
-
[`${
|
|
557
|
-
[`${
|
|
558
|
-
[`${
|
|
559
|
+
[`${P}-checkable`]: Oe,
|
|
560
|
+
[`${P}-show-line`]: De,
|
|
561
|
+
[`${P}-size-${ee}`]: ee,
|
|
562
|
+
[`${P}-rtl`]: Pe
|
|
559
563
|
},
|
|
560
|
-
|
|
564
|
+
be
|
|
561
565
|
),
|
|
562
|
-
style:
|
|
566
|
+
style: Ee,
|
|
563
567
|
filterNode: r.filterNode,
|
|
564
|
-
virtualListProps:
|
|
565
|
-
expandedKeys:
|
|
566
|
-
currentExpandKeys:
|
|
568
|
+
virtualListProps: re,
|
|
569
|
+
expandedKeys: a.expandedKeys,
|
|
570
|
+
currentExpandKeys: a.currentExpandKeys,
|
|
567
571
|
getNodeProps: A,
|
|
568
572
|
getDataSet: j,
|
|
569
|
-
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
|
-
...
|
|
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 =
|
|
588
|
-
v.SHOW_CHILD =
|
|
589
|
-
v.Node =
|
|
591
|
+
v.SHOW_ALL = ye;
|
|
592
|
+
v.SHOW_CHILD = ue;
|
|
593
|
+
v.Node = ie;
|
|
590
594
|
export {
|
|
591
|
-
|
|
595
|
+
ie as TreeNode,
|
|
592
596
|
v as default
|
|
593
597
|
};
|