@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.
Files changed (286) hide show
  1. package/Affix.js +1 -1
  2. package/Alert.js +1 -1
  3. package/AutoComplete.js +3 -5
  4. package/BackTop.js +1 -1
  5. package/Badge.js +1 -1
  6. package/Breadcrumb.js +2 -2
  7. package/Button.js +1 -1
  8. package/Calendar.js +3 -3
  9. package/Card.js +1 -1
  10. package/Carousel.js +1 -1
  11. package/Cascader.js +1 -1
  12. package/Checkbox.js +6 -2
  13. package/Collapse.js +1 -1
  14. package/ColorPicker.js +3 -4
  15. package/Comment.js +1 -1
  16. package/ConfigProvider.js +2 -3
  17. package/Copy.js +1 -1
  18. package/DatePicker.js +1 -1
  19. package/Descriptions.js +1 -1
  20. package/Divider.js +1 -1
  21. package/Draggable.js +1 -1
  22. package/Dropdown.js +1 -1
  23. package/Empty.js +1 -1
  24. package/Icon.js +1 -1
  25. package/IconHover.js +1 -1
  26. package/Image.js +1 -1
  27. package/InputNumber.js +1 -1
  28. package/Layout.js +1 -1
  29. package/Link.js +1 -1
  30. package/List.js +5 -6
  31. package/Mentions.js +3 -4
  32. package/Menu.js +1 -1
  33. package/Message.js +1 -1
  34. package/Modal.js +1 -1
  35. package/Notice.js +1 -1
  36. package/Notification.js +1 -1
  37. package/OverflowEllipsis.js +1 -1
  38. package/PageHeader.js +1 -1
  39. package/Pagination.js +2 -2
  40. package/Popconfirm.js +1 -1
  41. package/Popover.js +1 -1
  42. package/Progress.js +1 -1
  43. package/Radio.js +5 -4
  44. package/Rate.js +1 -1
  45. package/ResizeBox.js +1 -1
  46. package/Result.js +1 -1
  47. package/Select.js +5 -6
  48. package/Skeleton.js +1 -1
  49. package/Slider.js +1 -1
  50. package/Space.js +1 -1
  51. package/SpeechSynthesis.js +4 -3
  52. package/Spin.js +1 -1
  53. package/Statistic.js +1 -1
  54. package/Steps.js +1 -1
  55. package/Switch.js +1 -1
  56. package/Table.js +15 -16
  57. package/Tabs.js +1 -1
  58. package/Tag.js +1 -1
  59. package/Tooltip.js +2 -2
  60. package/Transfer.js +3 -4
  61. package/Tree.js +2 -3
  62. package/TreeSelect.js +3 -3
  63. package/Trigger.js +1 -1
  64. package/Typography.js +3 -3
  65. package/affix/index.js +86 -82
  66. package/alert/index.js +1 -1
  67. package/anchor/Anchor.js +1 -1
  68. package/anchor/Link.js +1 -1
  69. package/auto-complete/index.js +13 -147
  70. package/avatar/Avatar.js +1 -1
  71. package/avatar/Group.js +1 -1
  72. package/back-top/index.js +1 -1
  73. package/badge/index.js +1 -1
  74. package/breadcrumb/index.js +2 -2
  75. package/button/Group.js +1 -1
  76. package/button/index.js +1 -1
  77. package/calendar/index.js +12 -318
  78. package/card/Grid.js +1 -1
  79. package/card/Meta.js +1 -1
  80. package/card/index.js +1 -1
  81. package/carousel/Arrow.js +1 -1
  82. package/carousel/Indicator.js +1 -1
  83. package/carousel/index.js +1 -1
  84. package/cascader/Cascader.js +4 -4
  85. package/cascader/index.js +1 -1
  86. package/cascader/util.js +8 -8
  87. package/checkbox/Checkbox.js +7 -4
  88. package/checkbox/Group.js +5 -5
  89. package/checkbox/GroupBlock.js +8 -0
  90. package/checkbox/index.js +7 -2
  91. package/chunk/{BbqvFW5R.js → 9TSjT7x_.js} +112 -112
  92. package/chunk/ATwvJ8j2.js +6 -0
  93. package/chunk/{Dv6USvVF.js → BC5fEyWK.js} +2 -1
  94. package/chunk/{WVoGhvMI.js → BPQXH_5i.js} +32 -31
  95. package/chunk/{BPD5iNdA.js → CB4jGw4K.js} +22 -18
  96. package/chunk/{B8hkFIar.js → CBgu99gQ.js} +1 -1
  97. package/chunk/CBzE-PUr.js +23 -0
  98. package/chunk/CNcLypMY.js +723 -0
  99. package/chunk/{CPlPBkN7.js → C_4I3haT.js} +1 -1
  100. package/chunk/{0mWCmQHr.js → CjqvxJml.js} +2 -2
  101. package/chunk/Cwm8LL5p.js +7818 -0
  102. package/chunk/D0ZWT7db.js +5 -0
  103. package/chunk/{CWlklVfi.js → tpmioyz1.js} +1 -1
  104. package/collapse/Collapse.js +2 -2
  105. package/collapse/Item.js +2 -2
  106. package/collapse/index.js +1 -1
  107. package/color-picker/ControlBar.js +1 -1
  108. package/color-picker/InputAlpha.js +1 -1
  109. package/color-picker/InputHex.js +2 -2
  110. package/color-picker/InputRgb.js +2 -2
  111. package/color-picker/Palette.js +2 -2
  112. package/color-picker/Panel.js +15 -266
  113. package/color-picker/colors.js +4 -4
  114. package/color-picker/index.js +13 -268
  115. package/color-picker/utils.js +1 -1
  116. package/comment/index.js +1 -1
  117. package/config-provider/ConfigProvider.js +4 -6
  118. package/config-provider/context.js +3 -2
  119. package/config-provider/index.js +4 -5
  120. package/copy/index.js +1 -1
  121. package/date-picker/Picker.js +1 -1
  122. package/date-picker/PickerRange.js +2 -2
  123. package/date-picker/index.js +1 -1
  124. package/descriptions/index.js +1 -1
  125. package/divider/index.js +1 -1
  126. package/draggable/index.js +1 -1
  127. package/drawer/Drawer.js +30 -21
  128. package/dropdown/Button.js +1 -1
  129. package/dropdown/index.js +1 -1
  130. package/empty/index.js +1 -1
  131. package/form/Form.js +10 -10
  132. package/form/FormItem.js +1 -1
  133. package/form/context.js +1 -1
  134. package/grid/Col.js +1 -1
  135. package/grid/Row.js +1 -1
  136. package/grid/grid-item.js +1 -1
  137. package/grid/grid.js +1 -1
  138. package/hooks/index.js +1 -1
  139. package/hooks/useWindowSize.js +1 -1
  140. package/icon/index.js +1 -1
  141. package/icon-hover/index.js +1 -1
  142. package/image/Image.js +2 -2
  143. package/image/ImagePreview.js +2 -2
  144. package/image/ImagePreviewArrow.js +1 -1
  145. package/image/ImagePreviewGroup.js +1 -1
  146. package/image/index.js +1 -1
  147. package/index.js +453 -463
  148. package/input/Group.js +1 -1
  149. package/input/Input.js +1 -1
  150. package/input/InputElement.js +1 -1
  151. package/input/Password.js +1 -1
  152. package/input/Search.js +1 -1
  153. package/input/Textarea.js +1 -1
  154. package/input-number/index.js +1 -1
  155. package/input-tag/InputTag.js +1 -1
  156. package/layout/Content.js +1 -1
  157. package/layout/Footer.js +1 -1
  158. package/layout/Header.js +1 -1
  159. package/layout/Sider.js +1 -1
  160. package/layout/index.js +1 -1
  161. package/link/index.js +1 -1
  162. package/list/Item.js +1 -1
  163. package/list/Meta.js +1 -1
  164. package/list/index.js +17 -267
  165. package/mentions/index.js +11 -144
  166. package/menu/Menu.js +2 -2
  167. package/menu/OverflowWrap.js +1 -1
  168. package/menu/index.js +2 -2
  169. package/message/index.js +1 -1
  170. package/message/useMessage.js +1 -1
  171. package/modal/Confirm.js +2 -2
  172. package/modal/Modal.js +2 -2
  173. package/modal/index.js +1 -1
  174. package/notice/index.js +1 -1
  175. package/notification/index.js +1 -1
  176. package/notification/useNotification.js +1 -1
  177. package/overflow-ellipsis/OverflowItem.js +1 -1
  178. package/overflow-ellipsis/index.js +1 -1
  179. package/package.json +1 -1
  180. package/page-header/index.js +1 -1
  181. package/pagination/PageItem.js +1 -1
  182. package/pagination/PageJumper.js +1 -1
  183. package/pagination/PageOption.js +5 -45
  184. package/pagination/Pagination.js +11 -243
  185. package/pagination/index.js +2 -2
  186. package/picker/Input.js +1 -1
  187. package/picker/InputRange.js +1 -1
  188. package/popconfirm/index.js +1 -1
  189. package/popover/index.js +1 -1
  190. package/progress/index.js +1 -1
  191. package/radio/Group.js +5 -5
  192. package/radio/GroupBlock.js +9 -0
  193. package/radio/Radio.js +6 -5
  194. package/radio/index.js +4 -3
  195. package/rate/index.js +1 -1
  196. package/resize-box/ResizeTrigger.js +1 -1
  197. package/resize-box/Split.js +1 -1
  198. package/resize-box/SplitGroup.js +1 -1
  199. package/resize-box/index.js +1 -1
  200. package/result/index.js +1 -1
  201. package/select/Option.js +6 -93
  202. package/select/Select.js +23 -546
  203. package/select/index.js +3 -3
  204. package/select/util.js +18 -139
  205. package/select-view/Core.js +1 -1
  206. package/skeleton/index.js +1 -1
  207. package/slider/Button.js +1 -1
  208. package/slider/index.js +1 -1
  209. package/space/index.js +1 -1
  210. package/speech-synthesis/index.js +4 -3
  211. package/spin/DotLoading.js +1 -1
  212. package/spin/index.js +1 -1
  213. package/statistic/Countdown.js +1 -1
  214. package/statistic/index.js +1 -1
  215. package/steps/index.js +1 -1
  216. package/style/variables.less +0 -484
  217. package/style.css +1 -1
  218. package/switch/index.js +1 -1
  219. package/table/Table.js +2 -3
  220. package/table/index.js +15 -109
  221. package/tabs/Tab.js +2 -2
  222. package/tabs/TabContent.js +2 -2
  223. package/tabs/TabPane.js +1 -1
  224. package/tabs/index.js +2 -2
  225. package/tag/index.js +1 -1
  226. package/time-picker/Picker.js +1 -1
  227. package/time-picker/TimePicker.js +1 -1
  228. package/timeline/Item.js +1 -1
  229. package/timeline/Timeline.js +1 -1
  230. package/tooltip/index.js +2 -2
  231. package/transfer/Item.js +9 -104
  232. package/transfer/List.js +13 -184
  233. package/transfer/index.js +13 -180
  234. package/tree/Animation.js +2 -2
  235. package/tree/Node.js +3 -4
  236. package/tree/NodeList.js +6 -80
  237. package/tree/Tree.js +17 -578
  238. package/tree/index.js +2 -3
  239. package/tree-select/List.js +6 -122
  240. package/tree-select/Select.js +22 -392
  241. package/tree-select/index.js +3 -3
  242. package/trigger/index.js +1 -1
  243. package/types/checkbox/Checkbox.d.ts +5 -2
  244. package/types/checkbox/GroupBlock.d.ts +7 -0
  245. package/types/checkbox/index.d.ts +2 -1
  246. package/types/config-provider/ConfigProvider.d.ts +0 -27
  247. package/types/config-provider/interface.d.ts +3 -1
  248. package/types/index.d.ts +2 -2
  249. package/types/menu/context.d.ts +1 -1
  250. package/types/radio/GroupBlock.d.ts +7 -0
  251. package/types/radio/Radio.d.ts +5 -3
  252. package/types/utils/constant.d.ts +2 -1
  253. package/types/utils/index.d.ts +1 -0
  254. package/types/utils/setDarkTheme.d.ts +2 -3
  255. package/types/utils/setPrimaryColor.d.ts +2 -0
  256. package/typography/Base.js +1 -1
  257. package/typography/Ellipsis.js +9 -22
  258. package/typography/Paragraph.js +1 -1
  259. package/typography/Typography.js +1 -1
  260. package/typography/index.js +10 -276
  261. package/upload/TriggerNode.js +1 -1
  262. package/upload/Upload.js +1 -1
  263. package/upload/Uploader.js +43 -44
  264. package/upload/request.js +1 -1
  265. package/upload/request_.js +1 -1
  266. package/utils/caseName.js +1 -1
  267. package/utils/color.js +1 -1
  268. package/utils/constant.js +7 -5
  269. package/utils/contextHolder.js +1 -1
  270. package/utils/dom.js +1 -1
  271. package/utils/index.js +199 -195
  272. package/utils/setDarkTheme.js +34 -5
  273. package/utils/setPrimaryColor.js +26 -0
  274. package/utils/tinycolor.js +1 -1
  275. package/verification-code/VerificationCode.js +1 -1
  276. package/version/index.js +1 -1
  277. package/watermark/Watermark.js +1 -1
  278. package/chunk/BViFMHr-.js +0 -1820
  279. package/chunk/BsWphzcT.js +0 -20
  280. package/chunk/BxZ39GzB.js +0 -209
  281. package/chunk/C9XYyypq.js +0 -713
  282. package/chunk/CIkPwQlq.js +0 -6
  283. package/chunk/DFcz9ZPP.js +0 -1020
  284. package/chunk/DeCsZrXb.js +0 -310
  285. package/chunk/DskaI8QL.js +0 -25
  286. package/chunk/EL5Jmjgr.js +0 -170
package/tree/Tree.js CHANGED
@@ -1,580 +1,19 @@
1
- import { jsx as ce } from "react/jsx-runtime";
2
- import { forwardRef as Oe, useContext as Se, useRef as O, useState as ve, useImperativeHandle as Te, useEffect as F, createElement as Ae } from "react";
3
- import { S as Ie } from "../chunk/C0pRaDCf.js";
4
- import b from "lodash/get";
5
- import z from "lodash/has";
6
- import Me from "lodash/isArray";
7
- import D from "lodash/isEqualWith";
8
- import He from "lodash/isFunction";
9
- import re from "lodash/isUndefined";
10
- import { a as $e } from "../chunk/C9XYyypq.js";
11
- import { p as se } from "../chunk/CUFsOxJ2.js";
12
- import { a as We } from "../chunk/ClqoGc3r.js";
13
- import { TreeContext as Re } from "./Context.js";
14
- import { N as le } from "../chunk/DeCsZrXb.js";
15
- import je from "./NodeList.js";
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
- le as TreeNode,
579
- S as default
17
+ b as TreeNode,
18
+ c as default
580
19
  };
package/tree/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import { default as r } from "./Tree.js";
2
- import { N as t } from "../chunk/DeCsZrXb.js";
1
+ import { N as o, s as r } from "../chunk/Cwm8LL5p.js";
3
2
  export {
4
- t as TreeNode,
3
+ o as TreeNode,
5
4
  r as default
6
5
  };