@unicom-cloud/ui 0.8.60 → 0.8.62
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/Affix.js +1 -1
- package/Alert.js +44 -40
- package/Anchor.js +1 -1
- package/AutoComplete.js +4 -4
- package/Avatar.js +1 -1
- package/BackTop.js +7 -7
- package/Badge.js +2 -2
- package/Breadcrumb.js +22 -22
- package/Button.js +2 -2
- package/Calendar.js +106 -104
- package/Card.js +1 -1
- package/Carousel.js +34 -33
- package/Cascader.js +1 -1
- package/Checkbox.js +1 -1
- package/Collapse.js +1 -1
- package/ColorPicker.js +12 -12
- package/Comment.js +1 -1
- package/ConfigProvider.js +2 -2
- package/Copy.js +16 -16
- package/DatePicker.js +165 -162
- package/Descriptions.js +1 -1
- package/Divider.js +1 -1
- package/Draggable.js +1 -1
- package/Drawer.js +1 -1
- package/Dropdown.js +9 -9
- package/Empty.js +2 -2
- package/Form.js +60 -54
- package/Grid.js +2 -2
- package/Icon.js +1 -1
- package/IconHover.js +1 -1
- package/Image.js +1 -1
- package/Input.js +1 -1
- package/InputNumber.js +6 -6
- package/InputTag.js +1 -1
- package/Layout.js +2 -2
- package/Link.js +14 -14
- package/List.js +3 -3
- package/Mentions.js +3 -3
- package/Menu.js +1 -1
- package/Message.js +2 -2
- package/Modal.js +1 -1
- package/Notice.js +9 -3
- package/Notification.js +2 -2
- package/OverflowEllipsis.js +32 -32
- package/PageHeader.js +23 -22
- package/Pagination.js +1 -1
- package/Picker.js +1 -1
- package/Popconfirm.js +7 -7
- package/Popover.js +1 -1
- package/Progress.js +14 -14
- package/Radio.js +2 -2
- package/Rate.js +43 -40
- package/ResizeBox.js +97 -96
- package/Result.js +15 -15
- package/Select.js +1 -1
- package/SelectView.js +295 -249
- package/Skeleton.js +1 -1
- package/Slider.js +25 -25
- package/Space.js +1 -1
- package/SpeechSynthesis.js +32 -29
- package/Spin.js +2 -2
- package/Statistic.js +1 -1
- package/Steps.js +11 -11
- package/Switch.js +3 -3
- package/Table.js +994 -991
- package/Tabs.js +1 -1
- package/Tag.js +68 -67
- package/TimePicker.js +17 -17
- package/Timeline.js +1 -1
- package/Tooltip.js +1 -1
- package/Transfer.js +47 -46
- package/Tree.js +2 -2
- package/TreeSelect.js +1 -1
- package/Trigger.js +3 -3
- package/Typography.js +1 -1
- package/Upload.js +2 -2
- package/VerificationCode.js +1 -1
- package/Version.js +1 -1
- package/Watermark.js +1 -1
- package/chunk/{V6euPXVB.js → -Z968QpN.js} +257 -251
- package/chunk/{IooeSKJJ.js → AqH9yP_J.js} +19 -19
- package/chunk/{cZiP8FvM.js → B0oDiPqE.js} +1 -1
- package/chunk/{B16KHtX-.js → B4-WpgY2.js} +191 -185
- package/chunk/{CuOl4X0X.js → B8SZFOjt.js} +1 -1
- package/chunk/{CbiWdbr_.js → BXWxA-tS.js} +35 -34
- package/chunk/{DpfUGhi4.js → BlNFmhNa.js} +288 -283
- package/chunk/{C1xMmQIZ.js → BmO1y0vr.js} +34 -34
- package/chunk/{Kbr6FzOG.js → BnqeQYIZ.js} +210 -186
- package/chunk/{BPZ-6HKJ.js → Bp3XomF8.js} +1 -2
- package/chunk/BsWphzcT.js +20 -0
- package/chunk/{RMBPs_Ry.js → C4eJ9vCf.js} +4 -3
- package/chunk/{BNHrEI0Y.js → C6fEFlPt.js} +52 -48
- package/chunk/C8o-VGyc.js +376 -0
- package/chunk/{eK7lxdak.js → CDJ1EnJ2.js} +8 -8
- package/chunk/{C5AQWbC4.js → CHyuuVxl.js} +1 -1
- package/chunk/{B2vORJQ8.js → CJnshq6A.js} +13 -13
- package/chunk/CT1lZ7ss.js +116 -0
- package/chunk/{Bdh4XVuf.js → CV1kLw5Z.js} +290 -281
- package/chunk/{DmUhn9ib.js → CazXy0r4.js} +54 -53
- package/chunk/{BBVjSFnw.js → Cqyp4qni.js} +23 -19
- package/chunk/{BJ_7JTqC.js → D3VMG9V1.js} +1 -1
- package/chunk/{D2HkyI6A.js → DGasAUHE.js} +2 -2
- package/chunk/{YIlBPVAs.js → DRQ1v6Ux.js} +1 -1
- package/chunk/{DhBo0pPJ.js → DRp7voqz.js} +119 -118
- package/chunk/{gIbzjQ-X.js → Dtm4BmKB.js} +2 -2
- package/chunk/{BEDYCG-I.js → KchYsivk.js} +18 -18
- package/chunk/{Cbd50gx8.js → Wum88vrW.js} +33 -33
- package/chunk/{BjSHZA0m.js → mfn4EgmQ.js} +1 -1
- package/chunk/{BYhtrDV3.js → nbEvdwT0.js} +152 -148
- package/chunk/{C1D7T29r.js → qpd2axxs.js} +83 -76
- package/chunk/{BVLwPZis.js → tOFzwzpT.js} +31 -30
- package/chunk/{DSGRHf-1.js → yESVS-qX.js} +157 -156
- package/hooks/useMergeValue.js +1 -1
- package/icons.js +4 -6001
- package/index.js +420 -392
- package/locale/en-US.js +1 -1
- package/locale/tr-TR.js +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/cascader/panel/Search.d.ts +1 -1
- package/types/config-provider/interface.d.ts +1 -1
- package/types/form/interface.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/message/index.d.ts +2 -2
- package/types/notification/index.d.ts +2 -2
- package/types/notification-base/index.d.ts +2 -2
- package/types/select/interface.d.ts +1 -0
- package/types/select-view/interface.d.ts +1 -0
- package/types/table/interface.d.ts +1 -0
- package/types/tree/Context.d.ts +1 -0
- package/types/tree/Tree.d.ts +1 -1
- package/types/tree/index.d.ts +5 -4
- package/types/tree/interface.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/lodash.d.ts +14 -1
- package/types/version/index.d.ts +1 -1
- package/utils/CSSTransition.js +1 -1
- package/utils/caseName.js +2 -18
- package/utils/contextHolder.js +1 -1
- package/utils/index.js +220 -191
- package/utils/is.js +68 -67
- package/utils/lodash.js +32 -6
- package/utils/reactDOM.js +1 -1
- package/chunk/-LZOUh53.js +0 -29
- package/chunk/-jdfq71f.js +0 -23
- package/chunk/B0GOLsj_.js +0 -58
- package/chunk/B7Zsp3gO.js +0 -29
- package/chunk/BDjXkzNj.js +0 -23
- package/chunk/BHn4xgbv.js +0 -209
- package/chunk/BLSiP_gg.js +0 -32
- package/chunk/BMJfSSLX.js +0 -23
- package/chunk/B_nfMl0e.js +0 -116
- package/chunk/BcS17Pzy.js +0 -66
- package/chunk/BdiEwtQO.js +0 -41
- package/chunk/Bpug_KxP.js +0 -34
- package/chunk/C1u_ckwU.js +0 -29
- package/chunk/C43Hv2Bl.js +0 -34
- package/chunk/C9vsih_D.js +0 -29
- package/chunk/CAfR2wLq.js +0 -41
- package/chunk/CAfecMDF.js +0 -46
- package/chunk/CKp4rZnD.js +0 -207
- package/chunk/CV2Aqv9q.js +0 -52
- package/chunk/CYdarMv9.js +0 -32
- package/chunk/C_S5Mdvd.js +0 -379
- package/chunk/CmB-TL7C.js +0 -46
- package/chunk/D-ER56Sf.js +0 -29
- package/chunk/D-aYnb6u.js +0 -41
- package/chunk/D3xQFJcO.js +0 -23
- package/chunk/DJcEys80.js +0 -29
- package/chunk/DLIm6rRJ.js +0 -29
- package/chunk/DOWEHtqM.js +0 -41
- package/chunk/DT37l12z.js +0 -40
- package/chunk/DW-B7npC.js +0 -23
- package/chunk/D_MTFBb0.js +0 -38
- package/chunk/Dx_5J4fO.js +0 -29
- package/chunk/Dy487FZ1.js +0 -118
- package/chunk/Uz-rNulO.js +0 -98
- package/chunk/cDZI_t6o.js +0 -52
- package/chunk/sScV-J56.js +0 -206
- package/chunk/wI2I1qb0.js +0 -23
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as b, jsxs as j, Fragment as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var fe = (r, p, e) => p in r ? he(r, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[p] = e;
|
|
3
|
+
var y = (r, p, e) => fe(r, typeof p != "symbol" ? p + "" : p, e);
|
|
4
|
+
import { jsx as b, jsxs as j, Fragment as pe } from "react/jsx-runtime";
|
|
5
|
+
import Y, { createContext as ye, useContext as U, useRef as A, useEffect as ee, useMemo as H, forwardRef as ne, useState as ge, useCallback as V, useImperativeHandle as ue, createElement as q, Component as Ke } from "react";
|
|
6
|
+
import { G as ke } from "./Cqyp4qni.js";
|
|
7
|
+
import O from "lodash/get";
|
|
8
|
+
import B from "lodash/has";
|
|
9
9
|
import me from "lodash/isArray";
|
|
10
|
-
import
|
|
10
|
+
import I from "lodash/isEqualWith";
|
|
11
11
|
import $ from "lodash/isFunction";
|
|
12
|
-
import
|
|
13
|
-
import { d as
|
|
12
|
+
import te from "lodash/isUndefined";
|
|
13
|
+
import { d as z, I as xe } from "./CV1kLw5Z.js";
|
|
14
14
|
import { y as M } from "./BzPkh4Zv.js";
|
|
15
15
|
import { pickDataAttributes as Ne } from "../utils/pick.js";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { C as Ee } from "./
|
|
16
|
+
import be from "@unicom-cloud/icons/IconUiCaretDown";
|
|
17
|
+
import De from "@unicom-cloud/icons/IconUiDragDotVertical";
|
|
18
|
+
import Ce from "@unicom-cloud/icons/IconUiFile";
|
|
19
|
+
import Pe from "@unicom-cloud/icons/IconUiLoading";
|
|
20
|
+
import { C as Ee } from "./CDJ1EnJ2.js";
|
|
21
21
|
import we from "../utils/throttleByRaf.js";
|
|
22
22
|
import Se from "lodash/isNumber";
|
|
23
|
-
import { P as _e } from "./
|
|
24
|
-
import { V as
|
|
23
|
+
import { P as _e } from "./Bp3XomF8.js";
|
|
24
|
+
import { V as ie } from "./D3NFxdmG.js";
|
|
25
25
|
import Le from "../utils/scrollIntoView.js";
|
|
26
|
-
const
|
|
26
|
+
const G = ye({});
|
|
27
27
|
function ve(r) {
|
|
28
28
|
return r.key || r._key;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const Oe = (r) => {
|
|
31
31
|
var g;
|
|
32
|
-
const
|
|
33
|
-
a.current = r.childrenData,
|
|
34
|
-
var
|
|
35
|
-
(
|
|
32
|
+
const p = U(G), { getPrefixCls: e } = U(z), n = e("tree-node"), { expandedKeys: s, currentExpandKeys: t } = p.getTreeState(), i = r.expanded, a = A(r.childrenData);
|
|
33
|
+
a.current = r.childrenData, ee(() => () => {
|
|
34
|
+
var l;
|
|
35
|
+
(l = p.onExpandEnd) == null || l.call(p, r._key);
|
|
36
36
|
}, []);
|
|
37
37
|
const d = H(() => {
|
|
38
|
-
const
|
|
39
|
-
x.forEach((
|
|
40
|
-
const
|
|
41
|
-
|
|
38
|
+
const l = [], k = (x) => {
|
|
39
|
+
x.forEach((m) => {
|
|
40
|
+
const c = p.getFieldInfo(m);
|
|
41
|
+
l.push(c), c.children && c.children.length && k(c.children);
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
return
|
|
44
|
+
return k(a.current || []), l;
|
|
45
45
|
}, [i]), o = H(() => {
|
|
46
|
-
const
|
|
46
|
+
const l = [];
|
|
47
47
|
if (d.length) {
|
|
48
|
-
const
|
|
48
|
+
const k = new Set(s || []);
|
|
49
49
|
d.forEach((x) => {
|
|
50
50
|
var C;
|
|
51
|
-
let
|
|
52
|
-
const
|
|
53
|
-
...
|
|
51
|
+
let m;
|
|
52
|
+
const c = {
|
|
53
|
+
...p.key2nodeProps[x.key]
|
|
54
54
|
};
|
|
55
55
|
if (i)
|
|
56
|
-
|
|
57
|
-
else if (
|
|
58
|
-
const D =
|
|
59
|
-
|
|
56
|
+
m = c.parentKey === r._key || ((C = c.pathParentKeys) == null ? void 0 : C.every((D) => k.has(D)));
|
|
57
|
+
else if (c.pathParentKeys) {
|
|
58
|
+
const D = c.pathParentKeys.indexOf(r._key);
|
|
59
|
+
m = c.pathParentKeys.slice(D + 1).every((N) => k.has(N));
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
...
|
|
61
|
+
m && l.push({
|
|
62
|
+
...c,
|
|
63
63
|
key: x.key
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
return
|
|
68
|
-
}, [d, r._key, i]);
|
|
69
|
-
let
|
|
70
|
-
return
|
|
71
|
-
t.indexOf(r._key) > -1 && o.length === 0 &&
|
|
67
|
+
return p.getNodeProps(l);
|
|
68
|
+
}, [d, r._key, i, s]);
|
|
69
|
+
let u = (g = p.virtualListProps) == null ? void 0 : g.height;
|
|
70
|
+
return u = Se(u) ? u : 0, ee(() => {
|
|
71
|
+
t.indexOf(r._key) > -1 && o.length === 0 && p.onExpandEnd(r._key);
|
|
72
72
|
}, [o, t]), /* @__PURE__ */ b(
|
|
73
73
|
_e,
|
|
74
74
|
{
|
|
@@ -79,43 +79,43 @@ const Ie = (r) => {
|
|
|
79
79
|
enter: 200,
|
|
80
80
|
exit: 0
|
|
81
81
|
},
|
|
82
|
-
onEnter: (
|
|
83
|
-
if (!
|
|
84
|
-
const
|
|
85
|
-
|
|
82
|
+
onEnter: (l) => {
|
|
83
|
+
if (!l) return;
|
|
84
|
+
const k = l.scrollHeight;
|
|
85
|
+
l.style.height = i ? 0 : `${Math.min(u || k, l.scrollHeight)}px`;
|
|
86
86
|
},
|
|
87
|
-
onEntering: (
|
|
88
|
-
if (!
|
|
89
|
-
const
|
|
90
|
-
|
|
87
|
+
onEntering: (l) => {
|
|
88
|
+
if (!l) return;
|
|
89
|
+
const k = l.scrollHeight;
|
|
90
|
+
l.style.height = i ? `${Math.min(u || k, k)}px` : 0;
|
|
91
91
|
},
|
|
92
|
-
onEntered: (
|
|
93
|
-
|
|
92
|
+
onEntered: (l) => {
|
|
93
|
+
l && (l.style.height = r.expanded ? "" : 0, p.onExpandEnd(r._key));
|
|
94
94
|
},
|
|
95
|
-
onExit: (
|
|
96
|
-
|
|
95
|
+
onExit: (l) => {
|
|
96
|
+
l && (l.style.display = "none");
|
|
97
97
|
},
|
|
98
98
|
children: /* @__PURE__ */ b(
|
|
99
|
-
|
|
99
|
+
ie,
|
|
100
100
|
{
|
|
101
101
|
itemKey: ve,
|
|
102
102
|
className: `${n}-list`,
|
|
103
103
|
isStaticItemHeight: !1,
|
|
104
|
-
...
|
|
104
|
+
...p.virtualListProps,
|
|
105
105
|
data: o,
|
|
106
106
|
"aria-hidden": !0,
|
|
107
107
|
style: { overflow: "hidden" },
|
|
108
|
-
children: (
|
|
109
|
-
|
|
110
|
-
return /* @__PURE__ */ b(R, { ...x },
|
|
108
|
+
children: (l) => {
|
|
109
|
+
const { key: k, ...x } = l ?? {};
|
|
110
|
+
return /* @__PURE__ */ b(R, { ...x }, k);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
)
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
116
|
};
|
|
117
|
-
function
|
|
118
|
-
const e = U(
|
|
117
|
+
function Ie(r, p) {
|
|
118
|
+
const e = U(G), { getPrefixCls: n } = U(z), s = A(), [t, i] = ge({
|
|
119
119
|
isAllowDrop: !0,
|
|
120
120
|
isDragOver: !1,
|
|
121
121
|
dragPosition: 0,
|
|
@@ -124,13 +124,13 @@ function Oe(r, y) {
|
|
|
124
124
|
_key: a = "",
|
|
125
125
|
title: d,
|
|
126
126
|
icon: o,
|
|
127
|
-
checkable:
|
|
127
|
+
checkable: u,
|
|
128
128
|
selected: g,
|
|
129
|
-
disabled:
|
|
130
|
-
disableCheckbox:
|
|
129
|
+
disabled: l,
|
|
130
|
+
disableCheckbox: k,
|
|
131
131
|
isLeaf: x,
|
|
132
|
-
draggable:
|
|
133
|
-
expanded:
|
|
132
|
+
draggable: m,
|
|
133
|
+
expanded: c,
|
|
134
134
|
showLine: C,
|
|
135
135
|
loading: D,
|
|
136
136
|
selectable: N = !0
|
|
@@ -139,107 +139,107 @@ function Oe(r, y) {
|
|
|
139
139
|
{
|
|
140
140
|
[`${h}-selected`]: g,
|
|
141
141
|
[`${h}-is-leaf`]: x,
|
|
142
|
-
[`${h}-expanded`]:
|
|
142
|
+
[`${h}-expanded`]: c,
|
|
143
143
|
[`${h}-disabled-selectable`]: !N,
|
|
144
|
-
[`${h}-disabled`]:
|
|
145
|
-
[`${h}-draggable`]:
|
|
144
|
+
[`${h}-disabled`]: l,
|
|
145
|
+
[`${h}-draggable`]: m
|
|
146
146
|
},
|
|
147
147
|
r.className
|
|
148
148
|
), S = (() => {
|
|
149
|
-
const f = $(e.icons) ? e.icons(r) : e.icons,
|
|
150
|
-
return { ...f, ...
|
|
149
|
+
const f = $(e.icons) ? e.icons(r) : e.icons, K = $(r.icons) ? r.icons(r) : r.icons;
|
|
150
|
+
return { ...f, ...K };
|
|
151
151
|
})(), E = V(
|
|
152
152
|
(f) => {
|
|
153
|
-
var
|
|
154
|
-
f !==
|
|
153
|
+
var K;
|
|
154
|
+
f !== c && ((K = e.onExpand) == null || K.call(e, f, a));
|
|
155
155
|
},
|
|
156
|
-
[
|
|
156
|
+
[c, e.onExpand]
|
|
157
157
|
), L = V(async () => {
|
|
158
158
|
var P;
|
|
159
|
-
const { isLeaf: f, expanded:
|
|
160
|
-
f || (!((P = r.childrenData) != null && P.length) && $(e.loadMore) && !
|
|
159
|
+
const { isLeaf: f, expanded: K } = r;
|
|
160
|
+
f || (!((P = r.childrenData) != null && P.length) && $(e.loadMore) && !K ? await e.loadMore(r) : E(!K));
|
|
161
161
|
}, [r, E, e.loadMore]), ce = () => {
|
|
162
162
|
if (D)
|
|
163
163
|
return "loadingIcon" in S ? S.loadingIcon : /* @__PURE__ */ b(Pe, {});
|
|
164
|
-
let f = null,
|
|
164
|
+
let f = null, K = !1;
|
|
165
165
|
if (x)
|
|
166
|
-
C && (f = "switcherIcon" in S ? S.switcherIcon : /* @__PURE__ */ b(Ce, {}),
|
|
166
|
+
C && (f = "switcherIcon" in S ? S.switcherIcon : /* @__PURE__ */ b(Ce, {}), K = !0);
|
|
167
167
|
else {
|
|
168
|
-
const P = C ? /* @__PURE__ */ b("span", { className: `${h}-${
|
|
169
|
-
f = "switcherIcon" in S ? S.switcherIcon : P,
|
|
168
|
+
const P = C ? /* @__PURE__ */ b("span", { className: `${h}-${c ? "minus" : "plus"}-icon` }) : /* @__PURE__ */ b(be, {});
|
|
169
|
+
f = "switcherIcon" in S ? S.switcherIcon : P, K = !C;
|
|
170
170
|
}
|
|
171
171
|
if (f)
|
|
172
172
|
return f = /* @__PURE__ */ b(
|
|
173
173
|
"span",
|
|
174
174
|
{
|
|
175
175
|
className: `${h}-switcher-icon`,
|
|
176
|
-
"aria-label":
|
|
176
|
+
"aria-label": c ? "fold button" : "expand button",
|
|
177
177
|
role: "button",
|
|
178
178
|
tabIndex: 0,
|
|
179
179
|
onClick: L,
|
|
180
180
|
children: f
|
|
181
181
|
}
|
|
182
|
-
),
|
|
182
|
+
), K ? /* @__PURE__ */ b(xe, { prefix: h, children: f }) : f;
|
|
183
183
|
}, F = V(
|
|
184
184
|
we((f) => {
|
|
185
|
-
var
|
|
186
|
-
const
|
|
187
|
-
if (!
|
|
188
|
-
const P =
|
|
185
|
+
var Z;
|
|
186
|
+
const K = s.current;
|
|
187
|
+
if (!K) return;
|
|
188
|
+
const P = K.getBoundingClientRect(), T = window.pageYOffset + P.top, v = f.pageY, Q = P.height / 4, X = v - T, W = X < Q ? -1 : X < P.height - Q ? 0 : 1, le = e.allowDrop(r, W);
|
|
189
189
|
i({
|
|
190
190
|
...t,
|
|
191
|
-
isAllowDrop:
|
|
191
|
+
isAllowDrop: le,
|
|
192
192
|
isDragOver: !0,
|
|
193
193
|
dragPosition: W
|
|
194
|
-
}), (
|
|
194
|
+
}), (Z = e.onNodeDragOver) == null || Z.call(e, f, r, W);
|
|
195
195
|
}),
|
|
196
196
|
[e.onNodeDragOver]
|
|
197
|
-
),
|
|
198
|
-
(f,
|
|
197
|
+
), J = V(
|
|
198
|
+
(f, K) => {
|
|
199
199
|
var v;
|
|
200
200
|
const { disableCheckbox: P, disabled: T } = r;
|
|
201
|
-
P || T || (v = e.onCheck) == null || v.call(e, f, a,
|
|
201
|
+
P || T || (v = e.onCheck) == null || v.call(e, f, a, K);
|
|
202
202
|
},
|
|
203
203
|
[r.disabled, r.disableCheckbox]
|
|
204
204
|
);
|
|
205
|
-
return /* @__PURE__ */ j(
|
|
205
|
+
return /* @__PURE__ */ j(pe, { children: [
|
|
206
206
|
/* @__PURE__ */ j(
|
|
207
207
|
"div",
|
|
208
208
|
{
|
|
209
209
|
style: r.style,
|
|
210
210
|
className: w,
|
|
211
|
-
ref:
|
|
211
|
+
ref: p,
|
|
212
212
|
role: "treeitem",
|
|
213
|
-
"aria-disabled":
|
|
214
|
-
"aria-expanded":
|
|
213
|
+
"aria-disabled": l,
|
|
214
|
+
"aria-expanded": c,
|
|
215
215
|
"aria-level": r._level,
|
|
216
216
|
children: [
|
|
217
|
-
/* @__PURE__ */ b("span", { className: `${h}-indent`, "aria-hidden": !0, children: [...Array(r._level)].map((f,
|
|
217
|
+
/* @__PURE__ */ b("span", { className: `${h}-indent`, "aria-hidden": !0, children: [...Array(r._level)].map((f, K) => /* @__PURE__ */ b(
|
|
218
218
|
"span",
|
|
219
219
|
{
|
|
220
220
|
className: M(`${h}-indent-block`, {
|
|
221
|
-
[`${h}-indent-block-lineless`]: r._lineless && r._lineless[
|
|
221
|
+
[`${h}-indent-block-lineless`]: r._lineless && r._lineless[K]
|
|
222
222
|
})
|
|
223
223
|
},
|
|
224
|
-
|
|
224
|
+
K
|
|
225
225
|
)) }),
|
|
226
226
|
/* @__PURE__ */ b(
|
|
227
227
|
"span",
|
|
228
228
|
{
|
|
229
229
|
className: M(`${h}-switcher`, {
|
|
230
|
-
[`${h}-switcher-expanded`]:
|
|
230
|
+
[`${h}-switcher-expanded`]: c
|
|
231
231
|
}),
|
|
232
232
|
children: ce()
|
|
233
233
|
}
|
|
234
234
|
),
|
|
235
|
-
|
|
235
|
+
u ? /* @__PURE__ */ b(
|
|
236
236
|
Ee,
|
|
237
237
|
{
|
|
238
|
-
disabled:
|
|
238
|
+
disabled: k || l,
|
|
239
239
|
value: a,
|
|
240
240
|
indeterminate: r.indeterminated,
|
|
241
241
|
checked: r.checked,
|
|
242
|
-
onChange:
|
|
242
|
+
onChange: J
|
|
243
243
|
}
|
|
244
244
|
) : null,
|
|
245
245
|
/* @__PURE__ */ j(
|
|
@@ -248,7 +248,7 @@ function Oe(r, y) {
|
|
|
248
248
|
"aria-grabbed": t.isDragging,
|
|
249
249
|
ref: s,
|
|
250
250
|
className: M(`${h}-title`, {
|
|
251
|
-
[`${h}-title-draggable`]:
|
|
251
|
+
[`${h}-title-draggable`]: m,
|
|
252
252
|
[`${h}-title-gap-top`]: t.isDragOver && t.isAllowDrop && t.dragPosition < 0,
|
|
253
253
|
[`${h}-title-gap-bottom`]: t.isDragOver && t.isAllowDrop && t.dragPosition > 0,
|
|
254
254
|
[`${h}-title-highlight`]: !t.isDragging && t.isDragOver && t.isAllowDrop && t.dragPosition === 0,
|
|
@@ -257,51 +257,51 @@ function Oe(r, y) {
|
|
|
257
257
|
}),
|
|
258
258
|
onClick: (f) => {
|
|
259
259
|
const {
|
|
260
|
-
onSelect:
|
|
260
|
+
onSelect: K,
|
|
261
261
|
onSelect_: P,
|
|
262
262
|
// 潘启宝添加
|
|
263
263
|
actionOnClick: T
|
|
264
264
|
} = e;
|
|
265
265
|
if (!r.disabled) {
|
|
266
266
|
const v = [].concat(T);
|
|
267
|
-
N && v.indexOf("select") > -1 && (
|
|
267
|
+
N && v.indexOf("select") > -1 && (K == null || K(a, f)), P == null || P(r), v.indexOf("expand") > -1 && L(), u && v.indexOf("check") > -1 && J(!r.checked, f);
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
-
draggable:
|
|
270
|
+
draggable: m,
|
|
271
271
|
onDrop: (f) => {
|
|
272
|
-
var
|
|
273
|
-
f.stopPropagation(), f.preventDefault(), (
|
|
272
|
+
var K;
|
|
273
|
+
f.stopPropagation(), f.preventDefault(), (K = e.onNodeDrop) == null || K.call(e, f, r, t.dragPosition), F.cancel(), i({
|
|
274
274
|
...t,
|
|
275
275
|
isDragOver: !1,
|
|
276
276
|
dragPosition: 0
|
|
277
277
|
});
|
|
278
278
|
},
|
|
279
279
|
onDragStart: (f) => {
|
|
280
|
-
var
|
|
281
|
-
if (
|
|
280
|
+
var K;
|
|
281
|
+
if (m) {
|
|
282
282
|
f.stopPropagation(), i({ ...t, isDragging: !0 });
|
|
283
283
|
try {
|
|
284
284
|
f.dataTransfer.setData("text/plain", "");
|
|
285
285
|
} catch {
|
|
286
286
|
}
|
|
287
|
-
(
|
|
287
|
+
(K = e.onNodeDragStart) == null || K.call(e, f, r);
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
290
|
onDragEnd: (f) => {
|
|
291
|
-
var
|
|
292
|
-
|
|
291
|
+
var K;
|
|
292
|
+
m && (f.stopPropagation(), F.cancel(), i({ ...t, isDragOver: !1, isDragging: !1 }), (K = e.onNodeDragEnd) == null || K.call(e, f, r));
|
|
293
293
|
},
|
|
294
294
|
onDragOver: (f) => {
|
|
295
295
|
f.preventDefault(), f.stopPropagation(), f.persist(), F(f);
|
|
296
296
|
},
|
|
297
297
|
onDragLeave: (f) => {
|
|
298
|
-
var
|
|
299
|
-
|
|
298
|
+
var K;
|
|
299
|
+
m && (f.stopPropagation(), F.cancel(), i({ ...t, isDragOver: !1 }), (K = e.onNodeDragLeave) == null || K.call(e, f, r));
|
|
300
300
|
},
|
|
301
301
|
children: [
|
|
302
302
|
o && /* @__PURE__ */ b("span", { className: `${h}-icon ${h}-custom-icon`, children: o }),
|
|
303
303
|
/* @__PURE__ */ b("span", { className: `${h}-title-text`, children: $(e.renderTitle) ? e.renderTitle(r) : d }),
|
|
304
|
-
|
|
304
|
+
m && /* @__PURE__ */ b("span", { className: `${h}-icon ${h}-drag-icon`, children: "dragIcon" in S ? S.dragIcon : /* @__PURE__ */ b(De, {}) })
|
|
305
305
|
]
|
|
306
306
|
}
|
|
307
307
|
),
|
|
@@ -309,16 +309,16 @@ function Oe(r, y) {
|
|
|
309
309
|
]
|
|
310
310
|
}
|
|
311
311
|
),
|
|
312
|
-
/* @__PURE__ */ b(
|
|
312
|
+
e.animation && /* @__PURE__ */ b(Oe, { ...r })
|
|
313
313
|
] });
|
|
314
314
|
}
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
const R =
|
|
315
|
+
const re = ne(Ie);
|
|
316
|
+
re.displayName = "TreeNode";
|
|
317
|
+
const R = Y.memo(re);
|
|
318
318
|
function $e(r) {
|
|
319
319
|
return r.key || r._key;
|
|
320
320
|
}
|
|
321
|
-
function Me(r,
|
|
321
|
+
function Me(r, p) {
|
|
322
322
|
const {
|
|
323
323
|
className: e,
|
|
324
324
|
style: n,
|
|
@@ -328,37 +328,37 @@ function Me(r, y) {
|
|
|
328
328
|
currentExpandKeys: a,
|
|
329
329
|
nodeList: d,
|
|
330
330
|
getNodeProps: o,
|
|
331
|
-
getDataSet:
|
|
332
|
-
} = r, g = (t == null ? void 0 : t.threshold) !== null,
|
|
331
|
+
getDataSet: u
|
|
332
|
+
} = r, g = (t == null ? void 0 : t.threshold) !== null, l = A(), k = A(), x = A(), m = H(() => new Set(i), [i]), c = H(() => {
|
|
333
333
|
const N = /* @__PURE__ */ new Set(), h = new Set(a);
|
|
334
334
|
return d.forEach((w) => {
|
|
335
335
|
(w.pathParentKeys || []).every(
|
|
336
|
-
(E) => !h.has(E) &&
|
|
336
|
+
(E) => !h.has(E) && m.has(E)
|
|
337
337
|
) && N.add(w._key);
|
|
338
338
|
}), N;
|
|
339
|
-
}, [
|
|
340
|
-
return
|
|
339
|
+
}, [m, a, d]), C = () => d.filter((N) => !!((!s || (s == null ? void 0 : s(N))) && c.has(N.key))), D = H(() => C(), [d, s, c]);
|
|
340
|
+
return ue(p, () => ({
|
|
341
341
|
// index: 第几个dom元素, 如果传入的是字符串,会作为 node 的 key去查找。
|
|
342
342
|
// nodeProps: _index 是 key 时,对应的node
|
|
343
343
|
scrollIntoView: (N, h) => {
|
|
344
344
|
let w = N;
|
|
345
345
|
if (typeof N == "string") {
|
|
346
346
|
let E = N;
|
|
347
|
-
!
|
|
347
|
+
!c.has(N) && h && h.pathParentKeys && (E = [...h.pathParentKeys].reverse().find((L) => c.has(L)) || w), w = D.findIndex(({ _key: L }) => L === E);
|
|
348
348
|
}
|
|
349
|
-
if (!g &&
|
|
350
|
-
const E =
|
|
349
|
+
if (!g && k.current) {
|
|
350
|
+
const E = k.current, L = E ? E.children[w] : null;
|
|
351
351
|
L && Le(L, {
|
|
352
352
|
boundary: E.parentElement
|
|
353
353
|
});
|
|
354
|
-
} else
|
|
354
|
+
} else l.current && l.current.scrollTo({ index: w });
|
|
355
355
|
}
|
|
356
356
|
})), g ? /* @__PURE__ */ b(
|
|
357
|
-
|
|
357
|
+
ie,
|
|
358
358
|
{
|
|
359
359
|
className: e,
|
|
360
360
|
style: n,
|
|
361
|
-
ref:
|
|
361
|
+
ref: l,
|
|
362
362
|
data: D,
|
|
363
363
|
isStaticItemHeight: !1,
|
|
364
364
|
itemKey: $e,
|
|
@@ -366,9 +366,9 @@ function Me(r, y) {
|
|
|
366
366
|
...r.ariaProps,
|
|
367
367
|
...t,
|
|
368
368
|
children: (N, h, { itemIndex: w }) => {
|
|
369
|
-
w === 0 && (x.current =
|
|
369
|
+
w === 0 && (x.current = u());
|
|
370
370
|
const S = o(N, x.current);
|
|
371
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ q(R, { ...N, key: N.key, ...S });
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
) : /* @__PURE__ */ b(
|
|
@@ -378,46 +378,46 @@ function Me(r, y) {
|
|
|
378
378
|
tabIndex: 0,
|
|
379
379
|
className: e,
|
|
380
380
|
style: n,
|
|
381
|
-
ref:
|
|
381
|
+
ref: k,
|
|
382
382
|
...r.ariaProps,
|
|
383
383
|
onMouseDown: r.onMouseDown,
|
|
384
384
|
children: D.map((N) => {
|
|
385
385
|
const h = o(N);
|
|
386
|
-
return /* @__PURE__ */
|
|
386
|
+
return /* @__PURE__ */ q(R, { ...h, key: N.key });
|
|
387
387
|
})
|
|
388
388
|
}
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
|
-
const Te =
|
|
392
|
-
const
|
|
393
|
-
if (!
|
|
391
|
+
const Te = ne(Me), Ae = (r) => {
|
|
392
|
+
const p = (e) => Y.Children.map(e, (n) => {
|
|
393
|
+
if (!Y.isValidElement(n))
|
|
394
394
|
return;
|
|
395
395
|
const s = n.key;
|
|
396
396
|
return {
|
|
397
397
|
...n.props,
|
|
398
398
|
key: s,
|
|
399
|
-
children:
|
|
399
|
+
children: p(n.props.children)
|
|
400
400
|
};
|
|
401
401
|
});
|
|
402
|
-
return
|
|
402
|
+
return p(r);
|
|
403
403
|
};
|
|
404
|
-
function
|
|
404
|
+
function ae(r, p) {
|
|
405
405
|
const e = /* @__PURE__ */ new Set(), n = (s) => {
|
|
406
406
|
s.map((t) => {
|
|
407
|
-
const i = t.key, a =
|
|
407
|
+
const i = t.key, a = p[i];
|
|
408
408
|
!a || a.disabled || a.disableCheckbox || a.checkable === !1 || (e.add(i), n(a.children || []));
|
|
409
409
|
});
|
|
410
410
|
};
|
|
411
411
|
return r && n(r.children || []), e;
|
|
412
412
|
}
|
|
413
|
-
const
|
|
414
|
-
[...
|
|
415
|
-
const i =
|
|
413
|
+
const oe = (r, p, e, n) => {
|
|
414
|
+
[...p[r].pathParentKeys].reverse().some((t) => {
|
|
415
|
+
const i = p[t];
|
|
416
416
|
if (i && !i.disabled && !i.disableCheckbox && i.checkable !== !1) {
|
|
417
417
|
let a = 0, d = 0;
|
|
418
418
|
i.children.some(({ key: o }) => {
|
|
419
|
-
const
|
|
420
|
-
if (!
|
|
419
|
+
const u = p[o];
|
|
420
|
+
if (!u || u.disabled || u.disableCheckbox || u.checkable === !1)
|
|
421
421
|
return !1;
|
|
422
422
|
if (a++, e.has(o))
|
|
423
423
|
d++;
|
|
@@ -428,36 +428,36 @@ const ae = (r, y, e, n) => {
|
|
|
428
428
|
return !0;
|
|
429
429
|
});
|
|
430
430
|
};
|
|
431
|
-
function He(r,
|
|
431
|
+
function He(r, p) {
|
|
432
432
|
const e = new Set(r || []), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
433
433
|
return r.forEach((t) => {
|
|
434
|
-
s.has(t) ||
|
|
434
|
+
s.has(t) || ae(p[t], p).forEach((a) => {
|
|
435
435
|
s.add(a);
|
|
436
|
-
}),
|
|
436
|
+
}), p[t] && !p[t].pathParentKeys.some(
|
|
437
437
|
(i) => e.has(i)
|
|
438
|
-
) &&
|
|
438
|
+
) && oe(t, p, e, n);
|
|
439
439
|
}), {
|
|
440
440
|
checkedKeys: [.../* @__PURE__ */ new Set([...e, ...s])],
|
|
441
441
|
indeterminateKeys: [...n]
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
function Re(r,
|
|
444
|
+
function Re(r, p, e, n, s) {
|
|
445
445
|
if (!n[r])
|
|
446
446
|
return {
|
|
447
447
|
checkedKeys: e,
|
|
448
448
|
indeterminateKeys: s
|
|
449
449
|
};
|
|
450
|
-
const t = new Set(e), i = new Set(s), a =
|
|
451
|
-
return
|
|
450
|
+
const t = new Set(e), i = new Set(s), a = ae(n[r], n), d = t;
|
|
451
|
+
return p ? (d.add(r), i.delete(r), a.forEach((o) => {
|
|
452
452
|
d.add(o);
|
|
453
453
|
})) : (i.delete(r), d.delete(r), a.forEach((o) => {
|
|
454
454
|
d.delete(o);
|
|
455
|
-
})),
|
|
455
|
+
})), oe(r, n, t, i), {
|
|
456
456
|
checkedKeys: [...d],
|
|
457
457
|
indeterminateKeys: [...i]
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
|
-
const
|
|
460
|
+
const de = {
|
|
461
461
|
key: "key",
|
|
462
462
|
title: "title",
|
|
463
463
|
children: "children",
|
|
@@ -472,7 +472,8 @@ const oe = {
|
|
|
472
472
|
checkedStrategy: "all",
|
|
473
473
|
actionOnClick: "select",
|
|
474
474
|
allowDrop: () => !0,
|
|
475
|
-
fieldNames:
|
|
475
|
+
fieldNames: de,
|
|
476
|
+
animation: !0
|
|
476
477
|
}, Ve = [
|
|
477
478
|
"style",
|
|
478
479
|
"className",
|
|
@@ -487,33 +488,34 @@ const oe = {
|
|
|
487
488
|
"showLine",
|
|
488
489
|
"selectable",
|
|
489
490
|
"allowDrop",
|
|
490
|
-
"actionOnClick"
|
|
491
|
-
|
|
491
|
+
"actionOnClick",
|
|
492
|
+
"animation"
|
|
493
|
+
], _ = class _ extends Ke {
|
|
492
494
|
constructor(e, n) {
|
|
493
495
|
super(e, n);
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
496
|
+
y(this, "context");
|
|
497
|
+
y(this, "key2nodeProps", {});
|
|
498
|
+
y(this, "dragNode");
|
|
499
|
+
y(this, "nodeListRef");
|
|
500
|
+
y(this, "dropPosition");
|
|
501
|
+
y(this, "getMergedProps", (e) => {
|
|
500
502
|
const { componentConfig: n } = this.context ?? {}, s = e || this.props, t = (n == null ? void 0 : n.Tree) || {}, i = {};
|
|
501
503
|
return Ve.forEach((a) => {
|
|
502
|
-
|
|
504
|
+
te(s[a]) ? te(t[a]) ? i[a] = Fe[a] : i[a] = t[a] : i[a] = s[a];
|
|
503
505
|
}), i;
|
|
504
506
|
});
|
|
505
507
|
// index: 第几个dom元素, 如果传入的是字符串,会作为 node 的 key去查找。
|
|
506
508
|
// nodeProps 参数似乎咩有什么用。。。但是不知道外部有没有调用,就当key用吧。。
|
|
507
|
-
|
|
509
|
+
y(this, "scrollIntoView", (e, n) => {
|
|
508
510
|
let s = e;
|
|
509
511
|
n && (s = n._key), this.nodeListRef && this.nodeListRef.scrollIntoView(
|
|
510
512
|
s,
|
|
511
513
|
n || this.key2nodeProps[s]
|
|
512
514
|
);
|
|
513
515
|
});
|
|
514
|
-
|
|
516
|
+
y(this, "getTreeData", () => "treeData" in this.props ? this.props.treeData : Ae(this.props.children));
|
|
515
517
|
// 以下外部传入的属性改变时,需要更新nodeList
|
|
516
|
-
|
|
518
|
+
y(this, "needUpdateTreeData", (e, n) => {
|
|
517
519
|
const s = [
|
|
518
520
|
"fieldNames",
|
|
519
521
|
"selectable",
|
|
@@ -525,50 +527,50 @@ const oe = {
|
|
|
525
527
|
"treeData",
|
|
526
528
|
"children"
|
|
527
529
|
];
|
|
528
|
-
return e.treeData !== n.treeData || e.children !== n.children || s.some((t) =>
|
|
530
|
+
return e.treeData !== n.treeData || e.children !== n.children || s.some((t) => I(e[t], n[t]));
|
|
529
531
|
});
|
|
530
532
|
// 根据 fieldNames 获取节点数据
|
|
531
|
-
|
|
533
|
+
y(this, "getFieldInfo", (e) => {
|
|
532
534
|
const n = this.getMergedProps(), { selectable: s } = n, t = {
|
|
533
|
-
...
|
|
535
|
+
...de,
|
|
534
536
|
..."treeData" in this.props ? n.fieldNames : {}
|
|
535
537
|
}, i = {
|
|
536
|
-
children:
|
|
537
|
-
selectable: (
|
|
538
|
-
checkable: (
|
|
539
|
-
title:
|
|
540
|
-
disabled:
|
|
541
|
-
disableCheckbox:
|
|
542
|
-
isLeaf:
|
|
543
|
-
key:
|
|
538
|
+
children: O(e, t.children),
|
|
539
|
+
selectable: B(e, t.selectable) ? O(e, t.selectable) : s,
|
|
540
|
+
checkable: B(e, t.checkable) ? O(e, t.checkable) : this.props.checkable,
|
|
541
|
+
title: O(e, t.title),
|
|
542
|
+
disabled: O(e, t.disabled),
|
|
543
|
+
disableCheckbox: O(e, t.disableCheckbox),
|
|
544
|
+
isLeaf: O(e, t.isLeaf),
|
|
545
|
+
key: O(e, t.key)
|
|
544
546
|
};
|
|
545
|
-
return (
|
|
547
|
+
return B(e, t.key) || delete i.key, i;
|
|
546
548
|
});
|
|
547
|
-
|
|
549
|
+
y(this, "getNodeList", (e, n) => {
|
|
548
550
|
this.key2nodeProps = {};
|
|
549
551
|
const s = n || this.context.getPrefixCls("tree"), t = [];
|
|
550
552
|
let i = 0;
|
|
551
|
-
const { showLine: a, blockNode: d } = this.getMergedProps(), o = (
|
|
552
|
-
const
|
|
553
|
-
return
|
|
553
|
+
const { showLine: a, blockNode: d } = this.getMergedProps(), o = (u, g) => {
|
|
554
|
+
const l = u.length;
|
|
555
|
+
return u.map((k, x) => {
|
|
554
556
|
const {
|
|
555
|
-
children:
|
|
556
|
-
selectable:
|
|
557
|
+
children: m,
|
|
558
|
+
selectable: c,
|
|
557
559
|
checkable: C,
|
|
558
560
|
key: D = `${(g == null ? void 0 : g._key) || ""}-${x}`,
|
|
559
561
|
...N
|
|
560
|
-
} = this.getFieldInfo(
|
|
562
|
+
} = this.getFieldInfo(k), h = {
|
|
561
563
|
// data 中含有dataRef时,优先级较高
|
|
562
|
-
dataRef:
|
|
564
|
+
dataRef: k,
|
|
563
565
|
draggable: this.props.draggable,
|
|
564
|
-
selectable:
|
|
566
|
+
selectable: c,
|
|
565
567
|
checkable: C,
|
|
566
568
|
showLine: a,
|
|
567
569
|
blockNode: d,
|
|
568
|
-
...
|
|
570
|
+
...k,
|
|
569
571
|
...N,
|
|
570
572
|
key: D,
|
|
571
|
-
children:
|
|
573
|
+
children: m,
|
|
572
574
|
_key: D,
|
|
573
575
|
_index: i++,
|
|
574
576
|
parentKey: g ? g._key : void 0,
|
|
@@ -577,21 +579,21 @@ const oe = {
|
|
|
577
579
|
// 保存node在sowLine模式下是否显示缩进线。如果父节点是其所在层级的最后一个节点,那么所有的子节点(包括孙子节点等)在父节点所在层级的缩进格都不显示缩进线。
|
|
578
580
|
_lineless: g && g._lineless ? [...g._lineless || [], g._isTail] : []
|
|
579
581
|
};
|
|
580
|
-
return
|
|
582
|
+
return l === x + 1 && (h.className = M(
|
|
581
583
|
`${s}-node-is-tail`,
|
|
582
584
|
h.className
|
|
583
|
-
)), t.push(h), this.key2nodeProps[D] = h,
|
|
585
|
+
)), t.push(h), this.key2nodeProps[D] = h, m && m.length && (this.key2nodeProps[D].children = o(m, {
|
|
584
586
|
_key: D,
|
|
585
587
|
_level: h._level + 1,
|
|
586
588
|
_lineless: h._lineless,
|
|
587
|
-
_isTail:
|
|
589
|
+
_isTail: l === x + 1,
|
|
588
590
|
pathParentKeys: [...(g == null ? void 0 : g.pathParentKeys) || [], D]
|
|
589
591
|
})), h;
|
|
590
592
|
});
|
|
591
593
|
};
|
|
592
594
|
return o(e || [], {}), t;
|
|
593
595
|
});
|
|
594
|
-
|
|
596
|
+
y(this, "getInitExpandedKeys", (e) => {
|
|
595
597
|
if (!this.getMergedProps().autoExpandParent)
|
|
596
598
|
return e || [];
|
|
597
599
|
if (!e)
|
|
@@ -607,7 +609,7 @@ const oe = {
|
|
|
607
609
|
}));
|
|
608
610
|
}), Object.keys(n);
|
|
609
611
|
});
|
|
610
|
-
|
|
612
|
+
y(this, "getInitCheckedKeys", (e) => {
|
|
611
613
|
if (!this.props.checkStrictly) {
|
|
612
614
|
const { checkedKeys: n, indeterminateKeys: s } = He(
|
|
613
615
|
e,
|
|
@@ -623,7 +625,7 @@ const oe = {
|
|
|
623
625
|
halfCheckedKeys: this.props.halfCheckedKeys || []
|
|
624
626
|
};
|
|
625
627
|
});
|
|
626
|
-
|
|
628
|
+
y(this, "handleSelect", (e, n) => {
|
|
627
629
|
const { onSelect: s } = this.props, t = { e: n, node: this.getCacheNode([e])[0] };
|
|
628
630
|
if (this.props.multiple) {
|
|
629
631
|
const i = [...this.state.selectedKeys], a = i.indexOf(e);
|
|
@@ -631,41 +633,41 @@ const oe = {
|
|
|
631
633
|
} else
|
|
632
634
|
t.selected = !0, t.selectedNodes = this.getCacheNode([e]), "selectedKeys" in this.props || this.setState({ selectedKeys: [e] }), s == null || s([e], t);
|
|
633
635
|
});
|
|
634
|
-
|
|
636
|
+
y(this, "handleCheck", (e, n, s) => {
|
|
635
637
|
const { checkedStrategy: t } = this.getMergedProps(), { onCheck: i, checkStrictly: a } = this.props, d = { e: s, node: this.getCacheNode([n])[0] };
|
|
636
|
-
let o = this.state.checkedKeys,
|
|
638
|
+
let o = this.state.checkedKeys, u = this.state.halfCheckedKeys;
|
|
637
639
|
if (a) {
|
|
638
|
-
e ? o = o.concat(n) : o = o.filter((
|
|
640
|
+
e ? o = o.concat(n) : o = o.filter((l) => l !== n);
|
|
639
641
|
const g = {};
|
|
640
|
-
"checkedKeys" in this.props || (g.checkedKeys = o), "halfCheckedKeys" in this.props || (g.halfCheckedKeys =
|
|
642
|
+
"checkedKeys" in this.props || (g.checkedKeys = o), "halfCheckedKeys" in this.props || (g.halfCheckedKeys = u), ke(g) || this.setState({ ...g });
|
|
641
643
|
} else {
|
|
642
|
-
const { checkedKeys: g, indeterminateKeys:
|
|
644
|
+
const { checkedKeys: g, indeterminateKeys: l } = Re(
|
|
643
645
|
n,
|
|
644
646
|
e,
|
|
645
647
|
o,
|
|
646
648
|
this.key2nodeProps,
|
|
647
|
-
|
|
649
|
+
u
|
|
648
650
|
);
|
|
649
|
-
o = g,
|
|
650
|
-
const x = this.key2nodeProps[
|
|
651
|
+
o = g, u = l, "checkedKeys" in this.props ? this.setState({ halfCheckedKeys: u }) : this.setState({ checkedKeys: o, halfCheckedKeys: u }), t === _.SHOW_PARENT ? o = o.filter((k) => {
|
|
652
|
+
const x = this.key2nodeProps[k];
|
|
651
653
|
if (!x || o.indexOf(x.parentKey) === -1)
|
|
652
654
|
return !0;
|
|
653
|
-
}) : t === _.SHOW_CHILD && (o = o.filter((
|
|
654
|
-
var
|
|
655
|
-
const x = this.key2nodeProps[
|
|
656
|
-
if (!x || !((
|
|
655
|
+
}) : t === _.SHOW_CHILD && (o = o.filter((k) => {
|
|
656
|
+
var m, c;
|
|
657
|
+
const x = this.key2nodeProps[k];
|
|
658
|
+
if (!x || !((m = x.children) != null && m.length) || (c = x.children) != null && c.every((C) => o.indexOf(C._key) === -1))
|
|
657
659
|
return !0;
|
|
658
660
|
}));
|
|
659
661
|
}
|
|
660
662
|
i == null || i(o, {
|
|
661
663
|
checkedNodes: this.getCacheNode(o),
|
|
662
664
|
checked: e,
|
|
663
|
-
halfCheckedKeys:
|
|
664
|
-
halfCheckedNodes: this.getCacheNode(
|
|
665
|
+
halfCheckedKeys: u,
|
|
666
|
+
halfCheckedNodes: this.getCacheNode(u),
|
|
665
667
|
...d
|
|
666
668
|
});
|
|
667
669
|
});
|
|
668
|
-
|
|
670
|
+
y(this, "handleLoadMore", (e) => {
|
|
669
671
|
const { loadMore: n } = this.props;
|
|
670
672
|
if ($(n)) {
|
|
671
673
|
const { loadingKeys: s = [], loadedKeys: t } = this.state;
|
|
@@ -695,27 +697,27 @@ const oe = {
|
|
|
695
697
|
);
|
|
696
698
|
}
|
|
697
699
|
});
|
|
698
|
-
|
|
700
|
+
y(this, "handleNodeDragStart", (e, n) => {
|
|
699
701
|
this.dragNode = this.getCacheNode([n._key])[0], this.dropPosition = 0;
|
|
700
702
|
const { onDragStart: s } = this.props;
|
|
701
703
|
s == null || s(e, this.getCacheNode([n._key])[0]);
|
|
702
704
|
});
|
|
703
|
-
|
|
705
|
+
y(this, "handleNodeDragEnd", (e, n) => {
|
|
704
706
|
this.dragNode = null, this.dropPosition = 0;
|
|
705
707
|
const { onDragEnd: s } = this.props;
|
|
706
708
|
s == null || s(e, this.getCacheNode([n._key])[0]);
|
|
707
709
|
});
|
|
708
|
-
|
|
710
|
+
y(this, "handleNodeDragOver", (e, n, s) => {
|
|
709
711
|
this.dropPosition = s;
|
|
710
712
|
const { onDragOver: t } = this.props;
|
|
711
713
|
t == null || t(e, this.getCacheNode([n._key])[0]);
|
|
712
714
|
});
|
|
713
|
-
|
|
715
|
+
y(this, "handleNodeDragLeave", (e, n) => {
|
|
714
716
|
this.dropPosition = 0;
|
|
715
717
|
const { onDragLeave: s } = this.props;
|
|
716
718
|
s == null || s(e, this.getCacheNode([n._key])[0]);
|
|
717
719
|
});
|
|
718
|
-
|
|
720
|
+
y(this, "isChildOfNode", (e, n) => {
|
|
719
721
|
let s = this.key2nodeProps[e.parentKey];
|
|
720
722
|
for (; s; ) {
|
|
721
723
|
const { _key: t, parentKey: i } = s;
|
|
@@ -725,7 +727,7 @@ const oe = {
|
|
|
725
727
|
s = this.key2nodeProps[i];
|
|
726
728
|
}
|
|
727
729
|
});
|
|
728
|
-
|
|
730
|
+
y(this, "isSameNode", (e, n) => {
|
|
729
731
|
if (e === void 0 || n === void 0) return !1;
|
|
730
732
|
if (e === n) return !0;
|
|
731
733
|
const s = e.key, t = n.key;
|
|
@@ -733,7 +735,7 @@ const oe = {
|
|
|
733
735
|
const i = e.props._key, a = n.props._key;
|
|
734
736
|
return i === void 0 && a === void 0 ? !1 : i === a;
|
|
735
737
|
});
|
|
736
|
-
|
|
738
|
+
y(this, "handleNodeDrop", (e, n, s) => {
|
|
737
739
|
if (this.dragNode) {
|
|
738
740
|
const { allowDrop: t } = this.getMergedProps(), { onDrop: i } = this.props, a = this.getCacheNode([n._key])[0];
|
|
739
741
|
if (i && !this.isChildOfNode(n, this.dragNode) && !this.isSameNode(this.dragNode, a)) {
|
|
@@ -752,7 +754,7 @@ const oe = {
|
|
|
752
754
|
}
|
|
753
755
|
}
|
|
754
756
|
});
|
|
755
|
-
|
|
757
|
+
y(this, "handleAllowDrop", (e, n) => {
|
|
756
758
|
const { allowDrop: s } = this.getMergedProps();
|
|
757
759
|
let t = !0;
|
|
758
760
|
return typeof s == "function" && (t = s({
|
|
@@ -761,21 +763,21 @@ const oe = {
|
|
|
761
763
|
dropPosition: n
|
|
762
764
|
})), t;
|
|
763
765
|
});
|
|
764
|
-
|
|
765
|
-
const { currentExpandKeys: s, expandedKeys: t = [] } = this.state, {
|
|
766
|
+
y(this, "handleExpand", (e, n) => {
|
|
767
|
+
const { currentExpandKeys: s, expandedKeys: t = [] } = this.state, { animation: i } = this.getMergedProps(), { onExpand: a } = this.props;
|
|
766
768
|
if (s.indexOf(n) > -1)
|
|
767
769
|
return;
|
|
768
|
-
let
|
|
769
|
-
e ?
|
|
770
|
-
expandedKeys:
|
|
771
|
-
currentExpandKeys: [...s, n]
|
|
772
|
-
}),
|
|
770
|
+
let d = [];
|
|
771
|
+
e ? d = Array.from(/* @__PURE__ */ new Set([...t, n])) : d = t.filter((o) => o !== n), "expandedKeys" in this.props || this.setState({
|
|
772
|
+
expandedKeys: d,
|
|
773
|
+
currentExpandKeys: i ? [...s, n] : []
|
|
774
|
+
}), a == null || a(d, {
|
|
773
775
|
expanded: e,
|
|
774
776
|
node: this.getCacheNode([n])[0],
|
|
775
|
-
expandedNodes: this.getCacheNode(
|
|
777
|
+
expandedNodes: this.getCacheNode(d)
|
|
776
778
|
});
|
|
777
779
|
});
|
|
778
|
-
|
|
780
|
+
y(this, "getCacheNode", (e) => {
|
|
779
781
|
const { __PqbAdapterMode__: n } = this.props, s = [];
|
|
780
782
|
return [].concat(e).forEach((i) => {
|
|
781
783
|
const a = this.key2nodeProps[i];
|
|
@@ -783,10 +785,10 @@ const oe = {
|
|
|
783
785
|
}), this.getNodeProps(s).map((i) => n ? {
|
|
784
786
|
props: i,
|
|
785
787
|
key: e
|
|
786
|
-
} : /* @__PURE__ */
|
|
788
|
+
} : /* @__PURE__ */ q(R, { ...i, key: i.key }));
|
|
787
789
|
});
|
|
788
790
|
// 转换为 set 类型,便于查找。主要是传递给node-list使用
|
|
789
|
-
|
|
791
|
+
y(this, "getDataSet", (e) => {
|
|
790
792
|
var n, s, t, i;
|
|
791
793
|
return {
|
|
792
794
|
expandedKeysSet: (e == null ? void 0 : e.expandedKeysSet) || new Set(((n = this.state) == null ? void 0 : n.expandedKeys) || []),
|
|
@@ -796,47 +798,47 @@ const oe = {
|
|
|
796
798
|
};
|
|
797
799
|
});
|
|
798
800
|
// dataSet:传入构建好的expandedKeysSet,, checkedKeysSet, halfCheckedKeysSet ,性能优化
|
|
799
|
-
|
|
801
|
+
y(this, "getNodeProps", (e, n) => {
|
|
800
802
|
const { autoExpandParent: s } = this.getMergedProps(), { loadMore: t } = this.props, {
|
|
801
803
|
selectedKeys: i,
|
|
802
804
|
expandedKeys: a,
|
|
803
805
|
checkedKeys: d,
|
|
804
806
|
loadingKeys: o = [],
|
|
805
|
-
loadedKeys:
|
|
807
|
+
loadedKeys: u = []
|
|
806
808
|
} = this.state, {
|
|
807
809
|
expandedKeysSet: g,
|
|
808
|
-
checkedKeysSet:
|
|
809
|
-
selectedKeysSet:
|
|
810
|
+
checkedKeysSet: l,
|
|
811
|
+
selectedKeysSet: k,
|
|
810
812
|
halfCheckedKeysSet: x
|
|
811
|
-
} = this.getDataSet(n),
|
|
812
|
-
const C =
|
|
813
|
+
} = this.getDataSet(n), m = (c) => {
|
|
814
|
+
const C = c.children && c.children.length, D = {
|
|
813
815
|
isLeaf: !C,
|
|
814
816
|
autoExpandParent: C ? s : !1,
|
|
815
|
-
expanded: g ? g.has(
|
|
817
|
+
expanded: g ? g.has(c._key) : a.indexOf(c._key) > -1
|
|
816
818
|
};
|
|
817
819
|
if (t) {
|
|
818
|
-
const N =
|
|
819
|
-
D.loaded = N, D.isLeaf = C ? !1 :
|
|
820
|
+
const N = u.indexOf(c._key) > -1;
|
|
821
|
+
D.loaded = N, D.isLeaf = C ? !1 : c.isLeaf;
|
|
820
822
|
}
|
|
821
823
|
return {
|
|
822
|
-
...
|
|
824
|
+
...c,
|
|
823
825
|
...D,
|
|
824
|
-
selected:
|
|
825
|
-
indeterminated: x.has(
|
|
826
|
-
loading: o.indexOf(
|
|
827
|
-
checked:
|
|
826
|
+
selected: k.has(c._key),
|
|
827
|
+
indeterminated: x.has(c._key),
|
|
828
|
+
loading: o.indexOf(c._key) > -1,
|
|
829
|
+
checked: l.has(c._key),
|
|
828
830
|
selectedKeys: i,
|
|
829
831
|
checkedKeys: d,
|
|
830
832
|
loadingKeys: o,
|
|
831
|
-
loadedKeys:
|
|
833
|
+
loadedKeys: u,
|
|
832
834
|
expandedKeys: a,
|
|
833
|
-
childrenData:
|
|
835
|
+
childrenData: c.children || [],
|
|
834
836
|
children: null
|
|
835
837
|
};
|
|
836
838
|
};
|
|
837
|
-
return me(e) ? e.map((
|
|
839
|
+
return me(e) ? e.map((c) => m(c)) : m(e);
|
|
838
840
|
});
|
|
839
|
-
|
|
841
|
+
y(this, "handleExpandEnd", (e) => {
|
|
840
842
|
this.setState((n) => {
|
|
841
843
|
const { currentExpandKeys: s } = n;
|
|
842
844
|
return s.indexOf(e) > -1 ? {
|
|
@@ -845,7 +847,7 @@ const oe = {
|
|
|
845
847
|
});
|
|
846
848
|
});
|
|
847
849
|
// 获取tree的state数据,在子组件里使用。
|
|
848
|
-
|
|
850
|
+
y(this, "getTreeState", () => this.state);
|
|
849
851
|
this.state = {};
|
|
850
852
|
const s = this.getTreeData(), t = this.getNodeList(s, n.getPrefixCls("tree")), { checkedKeys: i, halfCheckedKeys: a } = this.getInitCheckedKeys(
|
|
851
853
|
e.checkedKeys || e.defaultCheckedKeys || []
|
|
@@ -865,11 +867,11 @@ const oe = {
|
|
|
865
867
|
}
|
|
866
868
|
static getDerivedStateFromProps(e, n) {
|
|
867
869
|
const s = {};
|
|
868
|
-
return "selectedKeys" in e && !
|
|
870
|
+
return "selectedKeys" in e && !I(e.selectedKeys, n.selectedKeys) && (s.selectedKeys = e.selectedKeys || []), Object.keys(s).length ? s : null;
|
|
869
871
|
}
|
|
870
872
|
componentDidUpdate(e) {
|
|
871
873
|
const n = this.getMergedProps(e), s = this.getMergedProps();
|
|
872
|
-
if (e !== this.props || !
|
|
874
|
+
if (e !== this.props || !I(n, s)) {
|
|
873
875
|
const t = {};
|
|
874
876
|
if (this.needUpdateTreeData(
|
|
875
877
|
{ prevMergedProps: n, ...e },
|
|
@@ -878,23 +880,23 @@ const oe = {
|
|
|
878
880
|
const a = this.getTreeData(), d = this.getNodeList(a);
|
|
879
881
|
t.treeData = a, t.nodeList = d;
|
|
880
882
|
}
|
|
881
|
-
if (t.treeData || "checkedKeys" in this.props && !
|
|
883
|
+
if (t.treeData || "checkedKeys" in this.props && !I(e.checkedKeys, this.props.checkedKeys)) {
|
|
882
884
|
const a = "checkedKeys" in this.props ? this.props.checkedKeys : this.state.checkedKeys, { halfCheckedKeys: d, checkedKeys: o } = this.getInitCheckedKeys(
|
|
883
885
|
a || []
|
|
884
886
|
);
|
|
885
|
-
|
|
887
|
+
I(o, this.state.checkedKeys) || (t.checkedKeys = o), I(d, this.state.halfCheckedKeys) || (t.halfCheckedKeys = d);
|
|
886
888
|
}
|
|
887
|
-
this.props.checkStrictly && "halfCheckedKeys" in this.props && !
|
|
888
|
-
...t.expandedKeys,
|
|
889
|
-
...this.state.expandedKeys
|
|
889
|
+
this.props.checkStrictly && "halfCheckedKeys" in this.props && !I(e.halfCheckedKeys, this.props.halfCheckedKeys) && (t.halfCheckedKeys = this.props.halfCheckedKeys), "expandedKeys" in this.props && !I(this.props.expandedKeys, e.expandedKeys) && (t.expandedKeys = this.props.expandedKeys, t.currentExpandKeys = s.animation ? [
|
|
890
|
+
...t.expandedKeys ?? [],
|
|
891
|
+
...this.state.expandedKeys ?? []
|
|
890
892
|
].reduce((a, d) => {
|
|
891
893
|
const o = a.indexOf(d);
|
|
892
894
|
return o === -1 ? a.push(d) : a.splice(o, 1), a;
|
|
893
895
|
}, []).filter((a, d, o) => {
|
|
894
|
-
var
|
|
896
|
+
var u;
|
|
895
897
|
if (this.key2nodeProps[a])
|
|
896
|
-
return this.key2nodeProps[a].pathParentKeys.some((
|
|
897
|
-
}));
|
|
898
|
+
return this.key2nodeProps[a].pathParentKeys.some((l) => o.indexOf(l) > -1) ? !1 : (u = this.key2nodeProps[a].children) == null ? void 0 : u.length;
|
|
899
|
+
}) : []);
|
|
898
900
|
const i = t.currentExpandKeys || this.state.currentExpandKeys;
|
|
899
901
|
t.treeData && i && (t.currentExpandKeys = i.filter((a) => {
|
|
900
902
|
const d = t.treeData.find((o) => o.key === a);
|
|
@@ -911,23 +913,26 @@ const oe = {
|
|
|
911
913
|
height: i,
|
|
912
914
|
style: a,
|
|
913
915
|
icons: d,
|
|
914
|
-
actionOnClick: o
|
|
915
|
-
|
|
916
|
+
actionOnClick: o,
|
|
917
|
+
animation: u
|
|
918
|
+
} = this.getMergedProps(), { loadMore: g, checkable: l } = this.props, k = t ? {
|
|
916
919
|
threshold: 100,
|
|
917
920
|
...t
|
|
918
921
|
} : i ? { height: i, threshold: 100 } : {
|
|
919
922
|
threshold: null
|
|
920
|
-
}, { getPrefixCls:
|
|
923
|
+
}, { getPrefixCls: x, rtl: m } = this.context, c = x("tree");
|
|
921
924
|
return /* @__PURE__ */ b(
|
|
922
|
-
|
|
925
|
+
G.Provider,
|
|
923
926
|
{
|
|
924
927
|
value: {
|
|
925
928
|
icons: d,
|
|
929
|
+
animation: u,
|
|
926
930
|
key2nodeProps: this.key2nodeProps,
|
|
927
931
|
getFieldInfo: this.getFieldInfo,
|
|
928
932
|
getTreeState: this.getTreeState,
|
|
929
933
|
getNodeProps: this.getNodeProps,
|
|
930
|
-
onExpandEnd: this.handleExpandEnd
|
|
934
|
+
onExpandEnd: u ? this.handleExpandEnd : () => {
|
|
935
|
+
},
|
|
931
936
|
onSelect: this.handleSelect,
|
|
932
937
|
onCheck: this.handleCheck,
|
|
933
938
|
onNodeDragStart: this.handleNodeDragStart,
|
|
@@ -938,30 +943,30 @@ const oe = {
|
|
|
938
943
|
onExpand: this.handleExpand,
|
|
939
944
|
renderExtra: this.props.renderExtra,
|
|
940
945
|
renderTitle: this.props.renderTitle,
|
|
941
|
-
loadMore:
|
|
946
|
+
loadMore: g && this.handleLoadMore,
|
|
942
947
|
allowDrop: this.handleAllowDrop,
|
|
943
948
|
actionOnClick: o,
|
|
944
|
-
virtualListProps:
|
|
949
|
+
virtualListProps: k
|
|
945
950
|
},
|
|
946
951
|
children: /* @__PURE__ */ b(
|
|
947
952
|
Te,
|
|
948
953
|
{
|
|
949
|
-
ref: (
|
|
950
|
-
this.nodeListRef =
|
|
954
|
+
ref: (C) => {
|
|
955
|
+
this.nodeListRef = C;
|
|
951
956
|
},
|
|
952
957
|
className: M(
|
|
953
|
-
|
|
958
|
+
c,
|
|
954
959
|
{
|
|
955
|
-
[`${
|
|
956
|
-
[`${
|
|
957
|
-
[`${
|
|
958
|
-
[`${
|
|
960
|
+
[`${c}-checkable`]: l,
|
|
961
|
+
[`${c}-show-line`]: n,
|
|
962
|
+
[`${c}-size-${s}`]: s,
|
|
963
|
+
[`${c}-rtl`]: m
|
|
959
964
|
},
|
|
960
965
|
e
|
|
961
966
|
),
|
|
962
967
|
style: a,
|
|
963
968
|
filterNode: this.props.filterNode,
|
|
964
|
-
virtualListProps:
|
|
969
|
+
virtualListProps: k,
|
|
965
970
|
expandedKeys: this.state.expandedKeys,
|
|
966
971
|
currentExpandKeys: this.state.currentExpandKeys,
|
|
967
972
|
getNodeProps: this.getNodeProps,
|
|
@@ -980,10 +985,10 @@ const oe = {
|
|
|
980
985
|
);
|
|
981
986
|
}
|
|
982
987
|
};
|
|
983
|
-
|
|
984
|
-
let
|
|
988
|
+
y(_, "displayName", "Tree"), y(_, "SHOW_PARENT", "parent"), y(_, "SHOW_ALL", "all"), y(_, "SHOW_CHILD", "child"), y(_, "Node", R), y(_, "contextType", z);
|
|
989
|
+
let se = _;
|
|
985
990
|
export {
|
|
986
|
-
|
|
991
|
+
se as T,
|
|
987
992
|
Ae as a,
|
|
988
993
|
Re as b,
|
|
989
994
|
He as g
|