@unicom-cloud/ui 0.8.75 → 0.8.77
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 +1 -1
- package/AutoComplete.js +3 -5
- package/BackTop.js +1 -1
- package/Badge.js +1 -1
- package/Breadcrumb.js +2 -2
- package/Button.js +1 -1
- package/Calendar.js +3 -3
- package/Card.js +1 -1
- package/Carousel.js +1 -1
- package/Cascader.js +1 -1
- package/Checkbox.js +6 -2
- package/Collapse.js +1 -1
- package/ColorPicker.js +3 -4
- package/Comment.js +1 -1
- package/ConfigProvider.js +2 -3
- package/Copy.js +1 -1
- package/DatePicker.js +1 -1
- package/Descriptions.js +1 -1
- package/Divider.js +1 -1
- package/Draggable.js +1 -1
- package/Dropdown.js +1 -1
- package/Empty.js +1 -1
- package/Icon.js +1 -1
- package/IconHover.js +1 -1
- package/Image.js +1 -1
- package/InputNumber.js +1 -1
- package/Layout.js +1 -1
- package/Link.js +1 -1
- package/List.js +5 -6
- package/Mentions.js +3 -4
- package/Menu.js +1 -1
- package/Message.js +1 -1
- package/Modal.js +1 -1
- package/Notice.js +1 -1
- package/Notification.js +1 -1
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/Pagination.js +2 -2
- package/Popconfirm.js +1 -1
- package/Popover.js +1 -1
- package/Progress.js +1 -1
- package/Radio.js +5 -4
- package/Rate.js +1 -1
- package/ResizeBox.js +1 -1
- package/Result.js +1 -1
- package/Select.js +5 -6
- package/Skeleton.js +1 -1
- package/Slider.js +1 -1
- package/Space.js +1 -1
- package/SpeechSynthesis.js +4 -3
- package/Spin.js +1 -1
- package/Statistic.js +1 -1
- package/Steps.js +1 -1
- package/Switch.js +1 -1
- package/Table.js +15 -16
- package/Tabs.js +1 -1
- package/Tag.js +1 -1
- package/Tooltip.js +2 -2
- package/Transfer.js +3 -4
- package/Tree.js +2 -3
- package/TreeSelect.js +3 -3
- package/Trigger.js +1 -1
- package/Typography.js +3 -3
- package/affix/index.js +86 -82
- package/alert/index.js +1 -1
- package/anchor/Anchor.js +1 -1
- package/anchor/Link.js +1 -1
- package/auto-complete/index.js +13 -147
- package/avatar/Avatar.js +1 -1
- package/avatar/Group.js +1 -1
- package/back-top/index.js +1 -1
- package/badge/index.js +1 -1
- package/breadcrumb/index.js +2 -2
- package/button/Group.js +1 -1
- package/button/index.js +1 -1
- package/calendar/index.js +12 -318
- package/card/Grid.js +1 -1
- package/card/Meta.js +1 -1
- package/card/index.js +1 -1
- package/carousel/Arrow.js +1 -1
- package/carousel/Indicator.js +1 -1
- package/carousel/index.js +1 -1
- package/cascader/Cascader.js +4 -4
- package/cascader/index.js +1 -1
- package/cascader/util.js +8 -8
- package/checkbox/Checkbox.js +7 -4
- package/checkbox/Group.js +5 -5
- package/checkbox/GroupBlock.js +8 -0
- package/checkbox/index.js +7 -2
- package/chunk/{BbqvFW5R.js → 9TSjT7x_.js} +112 -112
- package/chunk/ATwvJ8j2.js +6 -0
- package/chunk/{Dv6USvVF.js → BC5fEyWK.js} +2 -1
- package/chunk/{WVoGhvMI.js → BPQXH_5i.js} +32 -31
- package/chunk/{BPD5iNdA.js → CB4jGw4K.js} +22 -18
- package/chunk/{B8hkFIar.js → CBgu99gQ.js} +1 -1
- package/chunk/CBzE-PUr.js +23 -0
- package/chunk/CNcLypMY.js +723 -0
- package/chunk/{CPlPBkN7.js → C_4I3haT.js} +1 -1
- package/chunk/{0mWCmQHr.js → CjqvxJml.js} +2 -2
- package/chunk/Cwm8LL5p.js +7818 -0
- package/chunk/D0ZWT7db.js +5 -0
- package/chunk/{CWlklVfi.js → tpmioyz1.js} +1 -1
- package/collapse/Collapse.js +2 -2
- package/collapse/Item.js +2 -2
- package/collapse/index.js +1 -1
- package/color-picker/ControlBar.js +1 -1
- package/color-picker/InputAlpha.js +1 -1
- package/color-picker/InputHex.js +2 -2
- package/color-picker/InputRgb.js +2 -2
- package/color-picker/Palette.js +2 -2
- package/color-picker/Panel.js +15 -266
- package/color-picker/colors.js +4 -4
- package/color-picker/index.js +13 -268
- package/color-picker/utils.js +1 -1
- package/comment/index.js +1 -1
- package/config-provider/ConfigProvider.js +4 -6
- package/config-provider/context.js +3 -2
- package/config-provider/index.js +4 -5
- package/copy/index.js +1 -1
- package/date-picker/Picker.js +1 -1
- package/date-picker/PickerRange.js +2 -2
- package/date-picker/index.js +1 -1
- package/descriptions/index.js +1 -1
- package/divider/index.js +1 -1
- package/draggable/index.js +1 -1
- package/drawer/Drawer.js +30 -21
- package/dropdown/Button.js +1 -1
- package/dropdown/index.js +1 -1
- package/empty/index.js +1 -1
- package/form/Form.js +10 -10
- package/form/FormItem.js +1 -1
- package/form/context.js +1 -1
- package/grid/Col.js +1 -1
- package/grid/Row.js +1 -1
- package/grid/grid-item.js +1 -1
- package/grid/grid.js +1 -1
- package/hooks/index.js +1 -1
- package/hooks/useWindowSize.js +1 -1
- package/icon/index.js +1 -1
- package/icon-hover/index.js +1 -1
- package/image/Image.js +2 -2
- package/image/ImagePreview.js +2 -2
- package/image/ImagePreviewArrow.js +1 -1
- package/image/ImagePreviewGroup.js +1 -1
- package/image/index.js +1 -1
- package/index.js +453 -463
- package/input/Group.js +1 -1
- package/input/Input.js +1 -1
- package/input/InputElement.js +1 -1
- package/input/Password.js +1 -1
- package/input/Search.js +1 -1
- package/input/Textarea.js +1 -1
- package/input-number/index.js +1 -1
- package/input-tag/InputTag.js +1 -1
- package/layout/Content.js +1 -1
- package/layout/Footer.js +1 -1
- package/layout/Header.js +1 -1
- package/layout/Sider.js +1 -1
- package/layout/index.js +1 -1
- package/link/index.js +1 -1
- package/list/Item.js +1 -1
- package/list/Meta.js +1 -1
- package/list/index.js +17 -267
- package/mentions/index.js +11 -144
- package/menu/Menu.js +2 -2
- package/menu/OverflowWrap.js +1 -1
- package/menu/index.js +2 -2
- package/message/index.js +1 -1
- package/message/useMessage.js +1 -1
- package/modal/Confirm.js +2 -2
- package/modal/Modal.js +2 -2
- package/modal/index.js +1 -1
- package/notice/index.js +1 -1
- package/notification/index.js +1 -1
- package/notification/useNotification.js +1 -1
- package/overflow-ellipsis/OverflowItem.js +1 -1
- package/overflow-ellipsis/index.js +1 -1
- package/package.json +1 -1
- package/page-header/index.js +1 -1
- package/pagination/PageItem.js +1 -1
- package/pagination/PageJumper.js +1 -1
- package/pagination/PageOption.js +5 -45
- package/pagination/Pagination.js +11 -243
- package/pagination/index.js +2 -2
- package/picker/Input.js +1 -1
- package/picker/InputRange.js +1 -1
- package/popconfirm/index.js +1 -1
- package/popover/index.js +1 -1
- package/progress/index.js +1 -1
- package/radio/Group.js +5 -5
- package/radio/GroupBlock.js +9 -0
- package/radio/Radio.js +6 -5
- package/radio/index.js +4 -3
- package/rate/index.js +1 -1
- package/resize-box/ResizeTrigger.js +1 -1
- package/resize-box/Split.js +1 -1
- package/resize-box/SplitGroup.js +1 -1
- package/resize-box/index.js +1 -1
- package/result/index.js +1 -1
- package/select/Option.js +6 -93
- package/select/Select.js +23 -546
- package/select/index.js +3 -3
- package/select/util.js +18 -139
- package/select-view/Core.js +1 -1
- package/skeleton/index.js +1 -1
- package/slider/Button.js +1 -1
- package/slider/index.js +1 -1
- package/space/index.js +1 -1
- package/speech-synthesis/index.js +4 -3
- package/spin/DotLoading.js +1 -1
- package/spin/index.js +1 -1
- package/statistic/Countdown.js +1 -1
- package/statistic/index.js +1 -1
- package/steps/index.js +1 -1
- package/style/variables.less +0 -484
- package/style.css +1 -1
- package/switch/index.js +1 -1
- package/table/Table.js +2 -3
- package/table/index.js +15 -109
- package/tabs/Tab.js +2 -2
- package/tabs/TabContent.js +2 -2
- package/tabs/TabPane.js +1 -1
- package/tabs/index.js +2 -2
- package/tag/index.js +1 -1
- package/time-picker/Picker.js +1 -1
- package/time-picker/TimePicker.js +1 -1
- package/timeline/Item.js +1 -1
- package/timeline/Timeline.js +1 -1
- package/tooltip/index.js +2 -2
- package/transfer/Item.js +9 -104
- package/transfer/List.js +13 -184
- package/transfer/index.js +13 -180
- package/tree/Animation.js +2 -2
- package/tree/Node.js +3 -4
- package/tree/NodeList.js +6 -80
- package/tree/Tree.js +17 -578
- package/tree/index.js +2 -3
- package/tree-select/List.js +6 -122
- package/tree-select/Select.js +22 -392
- package/tree-select/index.js +3 -3
- package/trigger/index.js +1 -1
- package/types/checkbox/Checkbox.d.ts +5 -2
- package/types/checkbox/GroupBlock.d.ts +7 -0
- package/types/checkbox/index.d.ts +2 -1
- package/types/config-provider/ConfigProvider.d.ts +0 -27
- package/types/config-provider/interface.d.ts +3 -1
- package/types/index.d.ts +2 -2
- package/types/menu/context.d.ts +1 -1
- package/types/radio/GroupBlock.d.ts +7 -0
- package/types/radio/Radio.d.ts +5 -3
- package/types/utils/constant.d.ts +2 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/setDarkTheme.d.ts +2 -3
- package/types/utils/setPrimaryColor.d.ts +2 -0
- package/typography/Base.js +1 -1
- package/typography/Ellipsis.js +9 -22
- package/typography/Paragraph.js +1 -1
- package/typography/Typography.js +1 -1
- package/typography/index.js +10 -276
- package/upload/TriggerNode.js +1 -1
- package/upload/Upload.js +1 -1
- package/upload/Uploader.js +43 -44
- package/upload/request.js +1 -1
- package/upload/request_.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/color.js +1 -1
- package/utils/constant.js +7 -5
- package/utils/contextHolder.js +1 -1
- package/utils/dom.js +1 -1
- package/utils/index.js +199 -195
- package/utils/setDarkTheme.js +34 -5
- package/utils/setPrimaryColor.js +26 -0
- package/utils/tinycolor.js +1 -1
- package/verification-code/VerificationCode.js +1 -1
- package/version/index.js +1 -1
- package/watermark/Watermark.js +1 -1
- package/chunk/BViFMHr-.js +0 -1820
- package/chunk/BsWphzcT.js +0 -20
- package/chunk/BxZ39GzB.js +0 -209
- package/chunk/C9XYyypq.js +0 -713
- package/chunk/CIkPwQlq.js +0 -6
- package/chunk/DFcz9ZPP.js +0 -1020
- package/chunk/DeCsZrXb.js +0 -310
- package/chunk/DskaI8QL.js +0 -25
- package/chunk/EL5Jmjgr.js +0 -170
package/tree/Tree.js
CHANGED
|
@@ -1,580 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { N as
|
|
15
|
-
import
|
|
16
|
-
import { getTreeDataFromTreeChildren as Fe, getCheckedKeysByInitKeys as ze, getAllCheckedKeysByCheck as qe } from "./util.js";
|
|
17
|
-
const de = {
|
|
18
|
-
key: "key",
|
|
19
|
-
title: "title",
|
|
20
|
-
children: "children",
|
|
21
|
-
selectable: "selectable",
|
|
22
|
-
disabled: "disabled",
|
|
23
|
-
disableCheckbox: "disableCheckbox",
|
|
24
|
-
checkable: "checkable",
|
|
25
|
-
isLeaf: "isLeaf"
|
|
26
|
-
}, ie = "parent", oe = "all", ae = "child", Be = {
|
|
27
|
-
selectable: !0,
|
|
28
|
-
autoExpandParent: !0,
|
|
29
|
-
checkedStrategy: oe,
|
|
30
|
-
actionOnClick: "select",
|
|
31
|
-
allowDrop: () => !0,
|
|
32
|
-
fieldNames: de,
|
|
33
|
-
animation: !0
|
|
34
|
-
}, Ue = [
|
|
35
|
-
"style",
|
|
36
|
-
"className",
|
|
37
|
-
"height",
|
|
38
|
-
"size",
|
|
39
|
-
"blockNode",
|
|
40
|
-
"autoExpandParent",
|
|
41
|
-
"checkedStrategy",
|
|
42
|
-
"fieldNames",
|
|
43
|
-
"icons",
|
|
44
|
-
"virtualListProps",
|
|
45
|
-
"showLine",
|
|
46
|
-
"selectable",
|
|
47
|
-
"allowDrop",
|
|
48
|
-
"actionOnClick",
|
|
49
|
-
"animation"
|
|
50
|
-
];
|
|
51
|
-
function Ve(s, ye) {
|
|
52
|
-
const w = Se($e), q = O(null), h = O({}), N = O(), v = O(), I = O(), [o, x] = ve(() => {
|
|
53
|
-
const e = M(), c = H(e, w.getPrefixCls("tree")), { checkedKeys: n, halfCheckedKeys: t } = $(
|
|
54
|
-
s.checkedKeys || s.defaultCheckedKeys || []
|
|
55
|
-
);
|
|
56
|
-
return {
|
|
57
|
-
selectedKeys: s.selectedKeys || s.defaultSelectedKeys || [],
|
|
58
|
-
checkedKeys: n,
|
|
59
|
-
halfCheckedKeys: t,
|
|
60
|
-
expandedKeys: U(
|
|
61
|
-
s.expandedKeys || s.defaultExpandedKeys
|
|
62
|
-
),
|
|
63
|
-
loadedKeys: [],
|
|
64
|
-
loadingKeys: [],
|
|
65
|
-
currentExpandKeys: [],
|
|
66
|
-
nodeList: c
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
function g(e) {
|
|
70
|
-
const { componentConfig: c } = w ?? {}, n = e || s, t = (c == null ? void 0 : c.Tree) || {}, l = {};
|
|
71
|
-
return Ue.forEach((r) => {
|
|
72
|
-
re(n[r]) ? re(t[r]) ? l[r] = Be[r] : l[r] = t[r] : l[r] = n[r];
|
|
73
|
-
}), l;
|
|
74
|
-
}
|
|
75
|
-
function fe(e, c) {
|
|
76
|
-
let n = e;
|
|
77
|
-
c && (n = c._key), I.current && I.current.scrollIntoView(
|
|
78
|
-
n,
|
|
79
|
-
c || h.current[n]
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
function M() {
|
|
83
|
-
return "treeData" in s ? s.treeData : Fe(s.children);
|
|
84
|
-
}
|
|
85
|
-
function ue(e, c) {
|
|
86
|
-
const n = [
|
|
87
|
-
"fieldNames",
|
|
88
|
-
"selectable",
|
|
89
|
-
"draggable",
|
|
90
|
-
"checkStrictly",
|
|
91
|
-
"showLine",
|
|
92
|
-
"blockNode",
|
|
93
|
-
"checkable",
|
|
94
|
-
"treeData",
|
|
95
|
-
"children"
|
|
96
|
-
];
|
|
97
|
-
return e.treeData !== c.treeData || e.children !== c.children || n.some((t) => D(e[t], c[t]));
|
|
98
|
-
}
|
|
99
|
-
function B(e) {
|
|
100
|
-
const c = g(), { selectable: n } = c, t = {
|
|
101
|
-
...de,
|
|
102
|
-
..."treeData" in s ? c.fieldNames : {}
|
|
103
|
-
}, l = {
|
|
104
|
-
children: b(e, t.children),
|
|
105
|
-
selectable: z(e, t.selectable) ? b(e, t.selectable) : n,
|
|
106
|
-
checkable: z(e, t.checkable) ? b(e, t.checkable) : s.checkable,
|
|
107
|
-
title: b(e, t.title),
|
|
108
|
-
disabled: b(e, t.disabled),
|
|
109
|
-
disableCheckbox: b(e, t.disableCheckbox),
|
|
110
|
-
isLeaf: b(e, t.isLeaf),
|
|
111
|
-
key: b(e, t.key)
|
|
112
|
-
};
|
|
113
|
-
return z(e, t.key) || delete l.key, l;
|
|
114
|
-
}
|
|
115
|
-
function H(e, c) {
|
|
116
|
-
h.current = {};
|
|
117
|
-
const n = c || w.getPrefixCls("tree"), t = [];
|
|
118
|
-
let l = 0;
|
|
119
|
-
const { showLine: r, blockNode: i } = g(), d = (y, a) => {
|
|
120
|
-
const m = y.length;
|
|
121
|
-
return y.map((k, f) => {
|
|
122
|
-
const {
|
|
123
|
-
children: C,
|
|
124
|
-
selectable: u,
|
|
125
|
-
checkable: E,
|
|
126
|
-
key: _ = `${(a == null ? void 0 : a._key) || ""}-${f}`,
|
|
127
|
-
...j
|
|
128
|
-
} = B(k), L = {
|
|
129
|
-
// data 中含有dataRef时,优先级较高
|
|
130
|
-
dataRef: k,
|
|
131
|
-
draggable: s.draggable,
|
|
132
|
-
selectable: u,
|
|
133
|
-
checkable: E,
|
|
134
|
-
showLine: r,
|
|
135
|
-
blockNode: i,
|
|
136
|
-
...k,
|
|
137
|
-
...j,
|
|
138
|
-
key: _,
|
|
139
|
-
children: C,
|
|
140
|
-
_key: _,
|
|
141
|
-
_index: l++,
|
|
142
|
-
parentKey: a ? a._key : void 0,
|
|
143
|
-
pathParentKeys: a && a.pathParentKeys || [],
|
|
144
|
-
_level: a._level || 0,
|
|
145
|
-
// 保存node在sowLine模式下是否显示缩进线。如果父节点是其所在层级的最后一个节点,那么所有的子节点(包括孙子节点等)在父节点所在层级的缩进格都不显示缩进线。
|
|
146
|
-
_lineless: a && a._lineless ? [...a._lineless || [], a._isTail] : []
|
|
147
|
-
};
|
|
148
|
-
return m === f + 1 && (L.className = se(
|
|
149
|
-
`${n}-node-is-tail`,
|
|
150
|
-
L.className
|
|
151
|
-
)), t.push(L), h.current[_] = L, C && C.length && (h.current[_].children = d(C, {
|
|
152
|
-
_key: _,
|
|
153
|
-
_level: L._level + 1,
|
|
154
|
-
_lineless: L._lineless,
|
|
155
|
-
_isTail: m === f + 1,
|
|
156
|
-
pathParentKeys: [...(a == null ? void 0 : a.pathParentKeys) || [], _]
|
|
157
|
-
})), L;
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
return d(e || [], {}), t;
|
|
161
|
-
}
|
|
162
|
-
function U(e) {
|
|
163
|
-
if (!g().autoExpandParent)
|
|
164
|
-
return e || [];
|
|
165
|
-
if (!e)
|
|
166
|
-
return Object.keys(h.current).filter((n) => {
|
|
167
|
-
const t = h.current[n];
|
|
168
|
-
return t.children && t.children.length;
|
|
169
|
-
});
|
|
170
|
-
const c = {};
|
|
171
|
-
return e.forEach((n) => {
|
|
172
|
-
const t = h.current[n];
|
|
173
|
-
t && (c[n] = 1, t.pathParentKeys && t.pathParentKeys.forEach((l) => {
|
|
174
|
-
c[l] = 1;
|
|
175
|
-
}));
|
|
176
|
-
}), Object.keys(c);
|
|
177
|
-
}
|
|
178
|
-
function $(e) {
|
|
179
|
-
if (!s.checkStrictly) {
|
|
180
|
-
const { checkedKeys: c, indeterminateKeys: n } = ze(
|
|
181
|
-
e,
|
|
182
|
-
h.current
|
|
183
|
-
);
|
|
184
|
-
return {
|
|
185
|
-
checkedKeys: c,
|
|
186
|
-
halfCheckedKeys: n
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
checkedKeys: e,
|
|
191
|
-
halfCheckedKeys: s.halfCheckedKeys || []
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function he(e, c) {
|
|
195
|
-
const { onSelect: n } = s, t = { e: c, node: K([e])[0] };
|
|
196
|
-
if (s.multiple) {
|
|
197
|
-
const l = [...o.selectedKeys], r = l.indexOf(e);
|
|
198
|
-
r > -1 ? (l.splice(r, 1), t.selected = !1) : (t.selected = !0, l.push(e)), t.selectedNodes = K(l), "selectedKeys" in s || x((i) => {
|
|
199
|
-
const d = { ...i };
|
|
200
|
-
return d.selectedKeys = l, d;
|
|
201
|
-
}), n == null || n(l, t);
|
|
202
|
-
} else
|
|
203
|
-
t.selected = !0, t.selectedNodes = K([e]), "selectedKeys" in s || x((l) => {
|
|
204
|
-
const r = { ...l };
|
|
205
|
-
return r.selectedKeys = [e], r;
|
|
206
|
-
}), n == null || n([e], t);
|
|
207
|
-
}
|
|
208
|
-
function V(e, c, n) {
|
|
209
|
-
const { checkedStrategy: t } = g(), { onCheck: l, checkStrictly: r } = s, i = { e: n, node: K([c])[0] };
|
|
210
|
-
let d = [...o.checkedKeys || []], y = o.halfCheckedKeys;
|
|
211
|
-
if (r) {
|
|
212
|
-
e ? d = d.concat(c) : d = d.filter((m) => m !== c);
|
|
213
|
-
const a = {};
|
|
214
|
-
"checkedKeys" in s || (a.checkedKeys = d), "halfCheckedKeys" in s || (a.halfCheckedKeys = y), Ie(a) || x((m) => ({ ...m, ...a }));
|
|
215
|
-
} else {
|
|
216
|
-
const { checkedKeys: a, indeterminateKeys: m } = qe(
|
|
217
|
-
c,
|
|
218
|
-
e,
|
|
219
|
-
d,
|
|
220
|
-
h.current,
|
|
221
|
-
y
|
|
222
|
-
);
|
|
223
|
-
d = a, y = m, "checkedKeys" in s ? x((k) => {
|
|
224
|
-
const f = { ...k };
|
|
225
|
-
return f.halfCheckedKeys = y, f;
|
|
226
|
-
}) : x((k) => {
|
|
227
|
-
const f = { ...k };
|
|
228
|
-
return f.checkedKeys = d, f.halfCheckedKeys = y, f;
|
|
229
|
-
}), t === ie ? d = d.filter((k) => {
|
|
230
|
-
const f = h.current[k];
|
|
231
|
-
if (!f || d.indexOf(f.parentKey) === -1)
|
|
232
|
-
return !0;
|
|
233
|
-
}) : t === ae && (d = d.filter((k) => {
|
|
234
|
-
var C, u;
|
|
235
|
-
const f = h.current[k];
|
|
236
|
-
if (!f || !((C = f.children) != null && C.length) || (u = f.children) != null && u.every((E) => d.indexOf(E._key) === -1))
|
|
237
|
-
return !0;
|
|
238
|
-
}));
|
|
239
|
-
}
|
|
240
|
-
l == null || l(d, {
|
|
241
|
-
checkedNodes: K(d),
|
|
242
|
-
checked: e,
|
|
243
|
-
halfCheckedKeys: y,
|
|
244
|
-
halfCheckedNodes: K(y),
|
|
245
|
-
...i
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
function Ke(e) {
|
|
249
|
-
if (He(s.loadMore)) {
|
|
250
|
-
const { loadingKeys: c = [], loadedKeys: n } = o;
|
|
251
|
-
x((t) => {
|
|
252
|
-
const l = { ...t };
|
|
253
|
-
return l.loadingKeys = Array.from(/* @__PURE__ */ new Set([...c, e._key])), l.loadedKeys = n.filter((r) => r !== e._key), l;
|
|
254
|
-
}), A == null || A(K([e._key])[0]).then((t) => {
|
|
255
|
-
x((l) => {
|
|
256
|
-
const r = { ...l };
|
|
257
|
-
return r.loadingKeys = l.loadingKeys.filter((i) => i !== e._key), r.loadedKeys = Array.from(/* @__PURE__ */ new Set([...l.loadedKeys, e._key])), r;
|
|
258
|
-
}), W(!e.expanded, e._key);
|
|
259
|
-
}).catch((t) => {
|
|
260
|
-
x((l) => {
|
|
261
|
-
const r = { ...l };
|
|
262
|
-
return r.loadingKeys = l.loadingKeys.filter((i) => i !== e._key), r;
|
|
263
|
-
}), console.error("[tree]load data error: ", t);
|
|
264
|
-
}).finally(() => {
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function ke(e, c) {
|
|
269
|
-
N.current = K([c._key])[0], v.current = 0;
|
|
270
|
-
const { onDragStart: n } = s;
|
|
271
|
-
n == null || n(e, K([c._key])[0]);
|
|
272
|
-
}
|
|
273
|
-
function xe(e, c) {
|
|
274
|
-
N.current = null, v.current = 0;
|
|
275
|
-
const { onDragEnd: n } = s;
|
|
276
|
-
n == null || n(e, K([c._key])[0]);
|
|
277
|
-
}
|
|
278
|
-
function me(e, c, n) {
|
|
279
|
-
v.current = n;
|
|
280
|
-
const { onDragOver: t } = s;
|
|
281
|
-
t == null || t(e, K([c._key])[0]);
|
|
282
|
-
}
|
|
283
|
-
function ge(e, c) {
|
|
284
|
-
v.current = 0;
|
|
285
|
-
const { onDragLeave: n } = s;
|
|
286
|
-
n == null || n(e, K([c._key])[0]);
|
|
287
|
-
}
|
|
288
|
-
function Ce(e, c) {
|
|
289
|
-
let n = h.current[e.parentKey];
|
|
290
|
-
for (; n; ) {
|
|
291
|
-
const { _key: t, parentKey: l } = n;
|
|
292
|
-
if (t === c.props._key)
|
|
293
|
-
return !0;
|
|
294
|
-
if (l === t)
|
|
295
|
-
return;
|
|
296
|
-
n = h.current[l];
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function G(e, c) {
|
|
300
|
-
if (e === void 0 || c === void 0)
|
|
301
|
-
return !1;
|
|
302
|
-
if (e === c)
|
|
303
|
-
return !0;
|
|
304
|
-
const n = e.key, t = c.key;
|
|
305
|
-
if (n !== void 0 || t !== void 0)
|
|
306
|
-
return n === t;
|
|
307
|
-
const l = e.props._key, r = c.props._key;
|
|
308
|
-
return l === void 0 && r === void 0 ? !1 : l === r;
|
|
309
|
-
}
|
|
310
|
-
function J(e, c, n) {
|
|
311
|
-
if (N.current) {
|
|
312
|
-
const { allowDrop: t } = g(), { onDrop: l } = s, r = K([c._key])[0];
|
|
313
|
-
if (l && !Ce(c, N.current) && !G(N.current, r)) {
|
|
314
|
-
if (t && !t({
|
|
315
|
-
dropNode: r,
|
|
316
|
-
dragNode: N.current,
|
|
317
|
-
dropPosition: n
|
|
318
|
-
}))
|
|
319
|
-
return;
|
|
320
|
-
l({
|
|
321
|
-
dragNode: N.current,
|
|
322
|
-
dropNode: r,
|
|
323
|
-
dropPosition: n,
|
|
324
|
-
e
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
function Q(e, c) {
|
|
330
|
-
const { allowDrop: n } = g();
|
|
331
|
-
let t = !0;
|
|
332
|
-
return typeof n == "function" && (t = n({
|
|
333
|
-
dropNode: K([e._key])[0],
|
|
334
|
-
dragNode: N.current,
|
|
335
|
-
dropPosition: c
|
|
336
|
-
})), t;
|
|
337
|
-
}
|
|
338
|
-
function W(e, c) {
|
|
339
|
-
const { currentExpandKeys: n, expandedKeys: t = [] } = o, { animation: l } = g(), { onExpand: r } = s;
|
|
340
|
-
if (n.indexOf(c) > -1)
|
|
341
|
-
return;
|
|
342
|
-
let i = [];
|
|
343
|
-
e ? i = Array.from(/* @__PURE__ */ new Set([...t, c])) : i = t.filter((d) => d !== c), "expandedKeys" in s || x((d) => {
|
|
344
|
-
const y = { ...d };
|
|
345
|
-
return y.expandedKeys = i, y.currentExpandKeys = l ? [...n, c] : [], y;
|
|
346
|
-
}), r == null || r(i, {
|
|
347
|
-
expanded: e,
|
|
348
|
-
node: K([c])[0],
|
|
349
|
-
expandedNodes: K(i)
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
function K(e) {
|
|
353
|
-
const { __PqbAdapterMode__: c } = s, n = [];
|
|
354
|
-
return [].concat(e).forEach((l) => {
|
|
355
|
-
const r = h.current[l];
|
|
356
|
-
r && n.push(r);
|
|
357
|
-
}), T(n).map((l) => c ? {
|
|
358
|
-
props: l,
|
|
359
|
-
key: e
|
|
360
|
-
} : /* @__PURE__ */ Ae(le, { ...l, key: l.key }));
|
|
361
|
-
}
|
|
362
|
-
function R(e) {
|
|
363
|
-
return {
|
|
364
|
-
expandedKeysSet: (e == null ? void 0 : e.expandedKeysSet) || new Set((o == null ? void 0 : o.expandedKeys) || []),
|
|
365
|
-
checkedKeysSet: (e == null ? void 0 : e.checkedKeysSet) || new Set((o == null ? void 0 : o.checkedKeys) || []),
|
|
366
|
-
selectedKeysSet: (e == null ? void 0 : e.selectedKeysSet) || new Set((o == null ? void 0 : o.selectedKeys) || []),
|
|
367
|
-
halfCheckedKeysSet: (e == null ? void 0 : e.halfCheckedKeysSet) || new Set((o == null ? void 0 : o.halfCheckedKeys) || [])
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
function T(e, c) {
|
|
371
|
-
const { autoExpandParent: n } = g(), { loadMore: t } = s, {
|
|
372
|
-
selectedKeys: l,
|
|
373
|
-
expandedKeys: r,
|
|
374
|
-
checkedKeys: i,
|
|
375
|
-
loadingKeys: d = [],
|
|
376
|
-
loadedKeys: y = []
|
|
377
|
-
} = o, {
|
|
378
|
-
expandedKeysSet: a,
|
|
379
|
-
checkedKeysSet: m,
|
|
380
|
-
selectedKeysSet: k,
|
|
381
|
-
halfCheckedKeysSet: f
|
|
382
|
-
} = R(c), C = (u) => {
|
|
383
|
-
const E = u.children && u.children.length, _ = {
|
|
384
|
-
isLeaf: !E,
|
|
385
|
-
autoExpandParent: E ? n : !1,
|
|
386
|
-
expanded: a ? a.has(u._key) : r.indexOf(u._key) > -1
|
|
387
|
-
};
|
|
388
|
-
if (t) {
|
|
389
|
-
const j = y.indexOf(u._key) > -1;
|
|
390
|
-
_.loaded = j, _.isLeaf = E ? !1 : u.isLeaf;
|
|
391
|
-
}
|
|
392
|
-
return {
|
|
393
|
-
...u,
|
|
394
|
-
..._,
|
|
395
|
-
selected: k.has(u._key),
|
|
396
|
-
indeterminated: f.has(u._key),
|
|
397
|
-
loading: d.indexOf(u._key) > -1,
|
|
398
|
-
checked: m.has(u._key),
|
|
399
|
-
selectedKeys: l,
|
|
400
|
-
checkedKeys: i,
|
|
401
|
-
loadingKeys: d,
|
|
402
|
-
loadedKeys: y,
|
|
403
|
-
expandedKeys: r,
|
|
404
|
-
childrenData: u.children || [],
|
|
405
|
-
children: null
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
|
-
return Me(e) ? e.map((u) => C(u)) : C(e);
|
|
409
|
-
}
|
|
410
|
-
function X(e) {
|
|
411
|
-
x((c) => {
|
|
412
|
-
const n = { ...c }, { currentExpandKeys: t } = c;
|
|
413
|
-
return t.indexOf(e) > -1 && (n.currentExpandKeys = t.filter((l) => l !== e)), n;
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
function Y() {
|
|
417
|
-
return o;
|
|
418
|
-
}
|
|
419
|
-
Te(ye, () => ({
|
|
420
|
-
scrollIntoView: fe,
|
|
421
|
-
handleCheck: V,
|
|
422
|
-
getTreeState: Y,
|
|
423
|
-
handleExpandEnd: X,
|
|
424
|
-
getNodeProps: T,
|
|
425
|
-
getDataSet: R,
|
|
426
|
-
getCacheNode: K,
|
|
427
|
-
handleExpand: W,
|
|
428
|
-
handleAllowDrop: Q,
|
|
429
|
-
handleNodeDrop: J,
|
|
430
|
-
isSameNode: G
|
|
431
|
-
})), F(() => {
|
|
432
|
-
const e = q.current, c = g(e), n = g();
|
|
433
|
-
if (e !== s || !D(c, n)) {
|
|
434
|
-
const t = {};
|
|
435
|
-
if (ue(
|
|
436
|
-
{ prevMergedProps: c, ...e },
|
|
437
|
-
{ ...n, ...s }
|
|
438
|
-
)) {
|
|
439
|
-
const r = M(), i = H(r);
|
|
440
|
-
t.treeData = r, t.nodeList = i;
|
|
441
|
-
}
|
|
442
|
-
if (t.treeData || "checkedKeys" in s && !D(e == null ? void 0 : e.checkedKeys, s.checkedKeys)) {
|
|
443
|
-
const r = "checkedKeys" in s ? s.checkedKeys : o.checkedKeys, { halfCheckedKeys: i, checkedKeys: d } = $(
|
|
444
|
-
r || []
|
|
445
|
-
);
|
|
446
|
-
D(d, o.checkedKeys) || (t.checkedKeys = d), D(i, o.halfCheckedKeys) || (t.halfCheckedKeys = i);
|
|
447
|
-
}
|
|
448
|
-
s.checkStrictly && "halfCheckedKeys" in s && !D(e == null ? void 0 : e.halfCheckedKeys, s.halfCheckedKeys) && (t.halfCheckedKeys = s.halfCheckedKeys), "expandedKeys" in s && !D(s.expandedKeys, e == null ? void 0 : e.expandedKeys) && (t.expandedKeys = s.expandedKeys, t.currentExpandKeys = n.animation ? [...t.expandedKeys ?? [], ...o.expandedKeys ?? []].reduce((r, i) => {
|
|
449
|
-
const d = r.indexOf(i);
|
|
450
|
-
return d === -1 ? r.push(i) : r.splice(d, 1), r;
|
|
451
|
-
}, []).filter((r, i, d) => {
|
|
452
|
-
var y;
|
|
453
|
-
if (h.current[r])
|
|
454
|
-
return h.current[r].pathParentKeys.some((m) => d.indexOf(m) > -1) ? !1 : (y = h.current[r].children) == null ? void 0 : y.length;
|
|
455
|
-
}) : []);
|
|
456
|
-
const l = t.currentExpandKeys || o.currentExpandKeys;
|
|
457
|
-
t.treeData && l && (t.currentExpandKeys = l.filter((r) => {
|
|
458
|
-
const i = t.treeData.find((d) => d.key === r);
|
|
459
|
-
return i && i.children && i.children.length;
|
|
460
|
-
})), Object.keys(t).length && x((r) => ({ ...r, ...t }));
|
|
461
|
-
}
|
|
462
|
-
return q.current = s, () => {
|
|
463
|
-
};
|
|
464
|
-
}), F(() => ("selectedKeys" in s && !D(s.selectedKeys, o.selectedKeys) && x((e) => {
|
|
465
|
-
const c = { ...e };
|
|
466
|
-
return c.selectedKeys = s.selectedKeys || [], c;
|
|
467
|
-
}), () => {
|
|
468
|
-
}), [s.selectedKeys, o.selectedKeys]), F(() => {
|
|
469
|
-
const e = M(), c = H(e, w.getPrefixCls("tree")), { checkedKeys: n, halfCheckedKeys: t } = $(
|
|
470
|
-
s.checkedKeys || s.defaultCheckedKeys || []
|
|
471
|
-
);
|
|
472
|
-
return x((l) => {
|
|
473
|
-
let r = { ...l };
|
|
474
|
-
return r = {
|
|
475
|
-
...r,
|
|
476
|
-
selectedKeys: s.selectedKeys || s.defaultSelectedKeys || [],
|
|
477
|
-
checkedKeys: n,
|
|
478
|
-
halfCheckedKeys: t,
|
|
479
|
-
expandedKeys: U(
|
|
480
|
-
s.expandedKeys || s.defaultExpandedKeys
|
|
481
|
-
),
|
|
482
|
-
loadedKeys: [],
|
|
483
|
-
loadingKeys: [],
|
|
484
|
-
currentExpandKeys: [],
|
|
485
|
-
nodeList: c
|
|
486
|
-
}, r;
|
|
487
|
-
}), () => {
|
|
488
|
-
};
|
|
489
|
-
}, []);
|
|
490
|
-
const {
|
|
491
|
-
className: _e,
|
|
492
|
-
showLine: Ne,
|
|
493
|
-
size: Z,
|
|
494
|
-
virtualListProps: p,
|
|
495
|
-
height: ee,
|
|
496
|
-
style: be,
|
|
497
|
-
icons: De,
|
|
498
|
-
actionOnClick: Ee,
|
|
499
|
-
animation: te
|
|
500
|
-
} = g(), { loadMore: A, checkable: Le } = s, ne = p ? {
|
|
501
|
-
threshold: 100,
|
|
502
|
-
...p
|
|
503
|
-
} : ee ? { height: ee, threshold: 100 } : {
|
|
504
|
-
threshold: null
|
|
505
|
-
}, { getPrefixCls: we, rtl: Pe } = w, P = we("tree");
|
|
506
|
-
return /* @__PURE__ */ ce(
|
|
507
|
-
Re.Provider,
|
|
508
|
-
{
|
|
509
|
-
value: {
|
|
510
|
-
icons: De,
|
|
511
|
-
animation: te,
|
|
512
|
-
key2nodeProps: h.current,
|
|
513
|
-
getFieldInfo: B,
|
|
514
|
-
getTreeState: Y,
|
|
515
|
-
getNodeProps: T,
|
|
516
|
-
onExpandEnd: te ? X : () => {
|
|
517
|
-
},
|
|
518
|
-
onSelect: he,
|
|
519
|
-
onCheck: V,
|
|
520
|
-
onNodeDragStart: ke,
|
|
521
|
-
onNodeDragEnd: xe,
|
|
522
|
-
onNodeDragLeave: ge,
|
|
523
|
-
onNodeDragOver: me,
|
|
524
|
-
onNodeDrop: J,
|
|
525
|
-
onExpand: W,
|
|
526
|
-
renderExtra: s.renderExtra,
|
|
527
|
-
renderTitle: s.renderTitle,
|
|
528
|
-
loadMore: A && Ke,
|
|
529
|
-
allowDrop: Q,
|
|
530
|
-
actionOnClick: Ee,
|
|
531
|
-
virtualListProps: ne
|
|
532
|
-
},
|
|
533
|
-
children: /* @__PURE__ */ ce(
|
|
534
|
-
je,
|
|
535
|
-
{
|
|
536
|
-
ref: (e) => {
|
|
537
|
-
I.current = e;
|
|
538
|
-
},
|
|
539
|
-
className: se(
|
|
540
|
-
P,
|
|
541
|
-
{
|
|
542
|
-
[`${P}-checkable`]: Le,
|
|
543
|
-
[`${P}-show-line`]: Ne,
|
|
544
|
-
[`${P}-size-${Z}`]: Z,
|
|
545
|
-
[`${P}-rtl`]: Pe
|
|
546
|
-
},
|
|
547
|
-
_e
|
|
548
|
-
),
|
|
549
|
-
style: be,
|
|
550
|
-
filterNode: s.filterNode,
|
|
551
|
-
virtualListProps: ne,
|
|
552
|
-
expandedKeys: o.expandedKeys,
|
|
553
|
-
currentExpandKeys: o.currentExpandKeys,
|
|
554
|
-
getNodeProps: T,
|
|
555
|
-
getDataSet: R,
|
|
556
|
-
nodeList: o.nodeList,
|
|
557
|
-
onMouseDown: s.onMouseDown,
|
|
558
|
-
ariaProps: {
|
|
559
|
-
role: "tree",
|
|
560
|
-
"aria-multiselectable": s.multiple,
|
|
561
|
-
tabIndex: 0,
|
|
562
|
-
...We(s)
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
)
|
|
566
|
-
}
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
const S = Oe(
|
|
570
|
-
Ve
|
|
571
|
-
);
|
|
572
|
-
S.displayName = "Tree";
|
|
573
|
-
S.SHOW_PARENT = ie;
|
|
574
|
-
S.SHOW_ALL = oe;
|
|
575
|
-
S.SHOW_CHILD = ae;
|
|
576
|
-
S.Node = le;
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../chunk/C0pRaDCf.js";
|
|
4
|
+
import "lodash/get";
|
|
5
|
+
import "lodash/has";
|
|
6
|
+
import "lodash/isArray";
|
|
7
|
+
import "lodash/isEqualWith";
|
|
8
|
+
import "lodash/isFunction";
|
|
9
|
+
import "lodash/isUndefined";
|
|
10
|
+
import "../chunk/CNcLypMY.js";
|
|
11
|
+
import "../chunk/CUFsOxJ2.js";
|
|
12
|
+
import "../chunk/ClqoGc3r.js";
|
|
13
|
+
import "./Context.js";
|
|
14
|
+
import { N as b, s as c } from "../chunk/Cwm8LL5p.js";
|
|
15
|
+
import "./util.js";
|
|
577
16
|
export {
|
|
578
|
-
|
|
579
|
-
|
|
17
|
+
b as TreeNode,
|
|
18
|
+
c as default
|
|
580
19
|
};
|
package/tree/index.js
CHANGED