@unicom-cloud/ui 0.8.96 → 0.8.98
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/Carousel.js +1 -1
- package/LiquidFill.js +4 -0
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/QrCode.js +57 -0
- package/Tour.js +63 -0
- package/Trigger.js +1 -1
- package/_virtual/_commonjsHelpers.js +6 -0
- package/_virtual/index.js +7 -0
- package/_virtual/index2.js +4 -0
- package/affix/index.js +70 -72
- package/alert/index.js +56 -56
- package/anchor/Anchor.js +55 -55
- package/anchor/Link.js +34 -34
- package/anchor/util.js +5 -5
- package/auto-complete/index.js +116 -122
- package/avatar/Avatar.js +33 -33
- package/avatar/Group.js +26 -26
- package/back-top/index.js +58 -61
- package/badge/index.js +46 -46
- package/breadcrumb/Item.js +42 -43
- package/breadcrumb/index.js +47 -47
- package/button/Group.js +6 -6
- package/button/index.js +91 -91
- package/calendar/Month.js +75 -75
- package/calendar/Year.js +35 -35
- package/calendar/header/index.js +25 -25
- package/calendar/index.js +103 -103
- package/card/Grid.js +8 -8
- package/card/Meta.js +16 -16
- package/card/index.js +49 -49
- package/carousel/Arrow.js +19 -19
- package/carousel/Indicator.js +26 -26
- package/carousel/index.js +108 -108
- package/cascader/Cascader.js +178 -191
- package/cascader/base/node.js +133 -136
- package/cascader/base/store.js +82 -85
- package/cascader/panel/List.js +125 -129
- package/cascader/panel/Search.js +79 -81
- package/cascader/util.js +13 -13
- package/checkbox/Checkbox.js +94 -96
- package/checkbox/Group.js +54 -56
- package/checkbox/GroupBlock.js +28 -29
- package/collapse/Collapse.js +45 -45
- package/collapse/Item.js +53 -55
- package/color-picker/ControlBar.js +43 -43
- package/color-picker/InputAlpha.js +12 -12
- package/color-picker/InputHex.js +30 -31
- package/color-picker/InputRgb.js +24 -24
- package/color-picker/Palette.js +18 -18
- package/color-picker/Panel.js +122 -125
- package/color-picker/hooks/useColorPicker.js +85 -88
- package/color-picker/hooks/useControlBlock.js +38 -40
- package/color-picker/index.js +47 -47
- package/comment/index.js +29 -29
- package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
- package/components/common/hooks/useId.js +8 -8
- package/components/common/hooks/useInView.js +16 -16
- package/components/common/hooks/useIntersectionObserver.js +1 -1
- package/components/common/hooks/useKeyboardEvent.js +9 -10
- package/components/common/hooks/useOverflowHidden.js +1 -4
- package/components/common/hooks/usePersistCallback.js +7 -7
- package/components/common/hooks/useStateCallback.js +9 -10
- package/components/common/hooks/useWindowSize.js +8 -8
- package/components/common/space/index.js +9 -7
- package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/components/common/utils/dom.js +27 -29
- package/components/common/utils/findScrollParent.js +17 -0
- package/components/common/utils/intersectionObserver.js +21 -0
- package/components/common/utils/is.js +99 -109
- package/components/common/utils/mutationObserver.js +19 -0
- package/components/common/utils/reactDOM.js +34 -34
- package/components/common/utils/resizeObserver.js +21 -0
- package/copy/index.js +38 -40
- package/date-picker/Picker.js +290 -295
- package/date-picker/RangePicker.js +367 -372
- package/date-picker/index.js +33 -35
- package/date-picker/panel/Body.js +46 -47
- package/date-picker/panel/Header.js +33 -33
- package/date-picker/panel/Shortcut.js +31 -31
- package/date-picker/panel/date/index.js +85 -85
- package/date-picker/panel/month/index.js +59 -59
- package/date-picker/panel/quarter/index.js +67 -70
- package/date-picker/panel/range/index.js +101 -101
- package/date-picker/panel/year/index.js +39 -39
- package/date-picker/util.js +17 -18
- package/descriptions/index.js +62 -62
- package/details/index.js +53 -55
- package/development/index.js +9 -9
- package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
- package/dist/validate/src/index.js +5 -5
- package/dist/validate/src/util.js +1 -1
- package/divider/index.js +21 -21
- package/draggable/Item.js +35 -35
- package/draggable/index.js +22 -22
- package/drawer/Drawer.js +142 -147
- package/dropdown/Button.js +48 -48
- package/dropdown/index.js +88 -92
- package/empty/index.js +16 -16
- package/form/Control.js +211 -225
- package/form/Form.js +109 -113
- package/form/FormItem.js +118 -120
- package/form/FormList.js +60 -66
- package/form/FormProvider.js +31 -34
- package/form/hook/useContext.js +17 -19
- package/form/hook/useState.js +22 -23
- package/form/hook/useWatch.js +26 -27
- package/form/promisify.js +14 -18
- package/form/store.js +304 -316
- package/form/util.js +14 -15
- package/grid/Col.js +64 -64
- package/grid/Grid.js +51 -51
- package/grid/GridItem.js +48 -48
- package/grid/Row.js +39 -39
- package/hooks/useVerificationCode.js +41 -43
- package/hooks/useWatermark.js +89 -92
- package/icon/index.js +23 -24
- package/icon-hover/index.js +16 -16
- package/icons/file.js +11 -11
- package/image/Image.js +140 -141
- package/image/ImagePreview.js +252 -255
- package/image/ImagePreviewArrow.js +25 -25
- package/image/ImagePreviewGroup.js +62 -62
- package/image/util/getScale.js +25 -28
- package/index.js +684 -675
- package/input/Button.js +48 -50
- package/input/Group.js +9 -9
- package/input/Input.js +145 -154
- package/input/InputElement.js +108 -115
- package/input/Password.js +38 -38
- package/input/Search.js +51 -55
- package/input/Textarea.js +80 -81
- package/input/useComposition.js +23 -23
- package/input-number/decimal.js +59 -62
- package/input-number/index.js +139 -141
- package/input-tag/InputTag.js +222 -230
- package/layout/Content.js +6 -6
- package/layout/Footer.js +8 -8
- package/layout/Header.js +7 -7
- package/layout/Sider.js +88 -90
- package/layout/index.js +30 -30
- package/link/index.js +45 -46
- package/liquid-fill/LiquidFill.js +226 -0
- package/liquid-fill/LiquidFill2.js +3 -0
- package/liquid-fill/index.js +4 -0
- package/list/Item.js +28 -28
- package/list/Meta.js +12 -12
- package/list/index.js +146 -148
- package/mentions/index.js +75 -76
- package/menu/Item.js +58 -58
- package/menu/Menu.js +125 -127
- package/menu/OverflowWrap.js +39 -40
- package/menu/sub-menu/Inline.js +45 -45
- package/menu/util.js +26 -28
- package/message/index.js +96 -99
- package/message/useMessage.js +26 -27
- package/modal/Confirm.js +47 -49
- package/modal/Modal.js +250 -257
- package/modal/use-modal/Hook.js +26 -28
- package/modal/use-modal/index.js +46 -49
- package/notice/index.js +89 -90
- package/notification/index.js +60 -65
- package/notification/withNotification.js +35 -35
- package/overflow-ellipsis/OverflowItem.js +19 -20
- package/overflow-ellipsis/index.js +45 -46
- package/package.json +1 -1
- package/page-header/index.js +45 -45
- package/pagination/PageItem.js +87 -91
- package/pagination/PageJumper.js +40 -41
- package/pagination/PageOption.js +31 -35
- package/pagination/Pagination.js +162 -163
- package/picker/Input.js +90 -96
- package/picker/InputRange.js +115 -122
- package/popconfirm/index.js +98 -100
- package/popover/index.js +28 -28
- package/portal/Portal.js +10 -11
- package/progress/index.js +36 -36
- package/qr-code/index.js +99 -0
- package/qr-code/interface.js +1 -0
- package/radio/Group.js +48 -48
- package/radio/GroupBlock.js +32 -33
- package/radio/Radio.js +62 -64
- package/rate/index.js +88 -88
- package/resize-box/ResizeTrigger.js +39 -39
- package/resize-box/Split.js +92 -96
- package/resize-box/SplitGroup.js +116 -122
- package/resize-box/index.js +112 -115
- package/result/index.js +44 -44
- package/select/Option.js +53 -56
- package/select/Select.js +365 -381
- package/select/util.js +95 -99
- package/select-view/Core.js +159 -160
- package/skeleton/index.js +23 -23
- package/slider/Button.js +84 -92
- package/slider/Input.js +47 -49
- package/slider/Tick.js +28 -31
- package/slider/index.js +107 -107
- package/space/index.js +26 -26
- package/space-/index.js +51 -51
- package/spin/DotLoading.js +8 -8
- package/spin/index.js +47 -47
- package/statistic/Countdown.js +37 -37
- package/statistic/index.js +58 -58
- package/steps/Step.js +42 -42
- package/steps/index.js +54 -54
- package/style.css +1 -1
- package/switch/index.js +77 -78
- package/table/ColGroup.js +36 -37
- package/table/Table.js +447 -450
- package/table/hook/useExpand.js +24 -24
- package/table/hook/useRowSelection.js +62 -62
- package/table/summary/Row.js +16 -17
- package/table/tbody/Td.js +119 -118
- package/table/tbody/Tr.js +119 -121
- package/table/tbody/index.js +62 -63
- package/table/th-resizable/index.js +30 -30
- package/table/thead/Column.js +148 -148
- package/table/thead/index.js +87 -88
- package/tabs/Tab.js +55 -55
- package/tabs/TabContent.js +8 -8
- package/tabs/TabPane.js +15 -15
- package/tabs/hook/useHeaderScroll.js +36 -36
- package/tabs/tab-header/TabInk.js +31 -33
- package/tabs/tab-header/TabNavIcon.js +34 -35
- package/tabs/tab-header/index.js +192 -195
- package/tag/index.js +94 -97
- package/time-picker/Picker.js +167 -172
- package/time-picker/RangePicker.js +28 -28
- package/time-picker/TimePicker.js +146 -146
- package/timeline/Item.js +46 -46
- package/timeline/Timeline.js +52 -52
- package/tooltip/index.js +89 -95
- package/tour/index.js +289 -0
- package/transfer/Item.js +54 -54
- package/transfer/List.js +134 -136
- package/transfer/index.js +91 -91
- package/tree/Animation.js +49 -52
- package/tree/Node.js +114 -122
- package/tree/NodeList.js +51 -51
- package/tree/Tree.js +386 -393
- package/tree-select/List.js +71 -72
- package/tree-select/Select.js +135 -143
- package/tree-select/hook/useKeyCache.js +39 -39
- package/tree-select/hook/useStateValue.js +12 -12
- package/trigger/getPopupStyle.js +60 -61
- package/trigger/index.js +337 -346
- package/types/common/space/interface.d.ts +1 -1
- package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/common/utils/findScrollParent.d.ts +2 -0
- package/types/common/utils/index.d.ts +5 -0
- package/types/common/utils/intersectionObserver.d.ts +2 -0
- package/types/common/utils/mutationObserver.d.ts +2 -0
- package/types/common/utils/resizeObserver.d.ts +2 -0
- package/types/pc/config-provider/interface.d.ts +6 -0
- package/types/pc/index.d.ts +3 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
- package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
- package/types/pc/liquid-fill/index.d.ts +2 -0
- package/types/pc/qr-code/index.d.ts +34 -0
- package/types/pc/qr-code/interface.d.ts +39 -0
- package/types/pc/table/interface.d.ts +2 -2
- package/types/pc/tour/index.d.ts +42 -0
- package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/pc/utils/findScrollParent.d.ts +2 -0
- package/types/pc/utils/index.d.ts +5 -0
- package/types/pc/utils/intersectionObserver.d.ts +2 -0
- package/types/pc/utils/mutationObserver.d.ts +2 -0
- package/types/pc/utils/names.d.ts +18 -0
- package/types/pc/utils/resizeObserver.d.ts +2 -0
- package/typography/Base.js +79 -81
- package/typography/EditContent.js +30 -33
- package/typography/Ellipsis.js +77 -73
- package/typography/Operations.js +50 -52
- package/typography/Paragraph.js +7 -7
- package/typography/Typography.js +7 -7
- package/typography/useEllipsis.js +105 -106
- package/upload/TriggerNode.js +69 -76
- package/upload/Upload.js +84 -87
- package/upload/Uploader.js +115 -118
- package/upload/list/PictureItem.js +61 -71
- package/upload/list/TextItem.js +61 -67
- package/upload/list/UploadProgress.js +42 -49
- package/upload/list/index.js +48 -49
- package/upload/request_.js +37 -38
- package/upload/util.js +39 -39
- package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/utils/findScrollParent.js +4 -0
- package/utils/index.js +281 -278
- package/utils/intersectionObserver.js +4 -0
- package/utils/mutationObserver.js +4 -0
- package/utils/names.js +12 -0
- package/utils/resizeObserver.js +4 -0
- package/verification-code/VerificationCode.js +50 -51
- package/version/index.js +1 -1
- package/virtual-list/VirtualList.js +243 -244
- package/virtual-list/util/item.js +3 -4
- package/watermark/Watermark.js +27 -31
- package/components/common/utils/resizeObserverEffect.js +0 -23
- package/types/common/utils/resizeObserverEffect.d.ts +0 -2
- package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
- package/utils/resizeObserverEffect.js +0 -4
package/tree/Node.js
CHANGED
|
@@ -1,130 +1,126 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as N, Fragment as q, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import z from "@unicom-cloud/icons/IconUiCaretDown";
|
|
3
|
+
import G from "@unicom-cloud/icons/IconUiDragDotVertical";
|
|
4
|
+
import J from "@unicom-cloud/icons/IconUiFile";
|
|
5
|
+
import K from "@unicom-cloud/icons/IconUiLoading";
|
|
6
6
|
import m from "lodash/isFunction";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import Q, { forwardRef as W, useContext as E, useRef as X, useState as Z, useCallback as v } from "react";
|
|
8
|
+
import ee from "../checkbox/Checkbox.js";
|
|
9
9
|
import "../checkbox/Group.js";
|
|
10
10
|
import "../config-provider/ConfigProvider.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { throttleByRaf as
|
|
14
|
-
import
|
|
15
|
-
import { TreeContext as
|
|
16
|
-
import
|
|
17
|
-
function
|
|
18
|
-
const
|
|
11
|
+
import ne from "../icon-hover/index.js";
|
|
12
|
+
import D from "@unicom-cloud/utils/class-name";
|
|
13
|
+
import { throttleByRaf as te } from "../components/common/utils/throttleByRaf.js";
|
|
14
|
+
import ie from "./Animation.js";
|
|
15
|
+
import { TreeContext as ae } from "./Context.js";
|
|
16
|
+
import oe from "../config-provider/context.js";
|
|
17
|
+
function re(n, S) {
|
|
18
|
+
const i = E(ae), { getPrefixCls: R } = E(oe), C = X(), [o, f] = Z({
|
|
19
19
|
isAllowDrop: !0,
|
|
20
20
|
isDragOver: !1,
|
|
21
21
|
dragPosition: 0,
|
|
22
22
|
isDragging: !1
|
|
23
23
|
}), {
|
|
24
24
|
_key: h = "",
|
|
25
|
-
title:
|
|
26
|
-
icon:
|
|
27
|
-
checkable:
|
|
28
|
-
selected:
|
|
29
|
-
disabled:
|
|
30
|
-
disableCheckbox:
|
|
31
|
-
isLeaf:
|
|
25
|
+
title: _,
|
|
26
|
+
icon: k,
|
|
27
|
+
checkable: w,
|
|
28
|
+
selected: U,
|
|
29
|
+
disabled: b,
|
|
30
|
+
disableCheckbox: Y,
|
|
31
|
+
isLeaf: I,
|
|
32
32
|
draggable: l,
|
|
33
33
|
expanded: d,
|
|
34
|
-
showLine:
|
|
35
|
-
loading:
|
|
36
|
-
selectable:
|
|
37
|
-
} =
|
|
38
|
-
|
|
34
|
+
showLine: x,
|
|
35
|
+
loading: F,
|
|
36
|
+
selectable: p = !0
|
|
37
|
+
} = n, t = R?.("tree-node"), H = D(
|
|
38
|
+
t,
|
|
39
39
|
{
|
|
40
|
-
[`${
|
|
41
|
-
[`${
|
|
42
|
-
[`${
|
|
43
|
-
[`${
|
|
44
|
-
[`${
|
|
45
|
-
[`${
|
|
40
|
+
[`${t}-selected`]: U,
|
|
41
|
+
[`${t}-is-leaf`]: I,
|
|
42
|
+
[`${t}-expanded`]: d,
|
|
43
|
+
[`${t}-disabled-selectable`]: !p,
|
|
44
|
+
[`${t}-disabled`]: b,
|
|
45
|
+
[`${t}-draggable`]: l
|
|
46
46
|
},
|
|
47
|
-
|
|
47
|
+
n.className
|
|
48
48
|
), c = (() => {
|
|
49
|
-
const e = m(
|
|
49
|
+
const e = m(i.icons) ? i.icons(n) : i.icons, a = m(n.icons) ? n.icons(n) : n.icons;
|
|
50
50
|
return { ...e, ...a };
|
|
51
|
-
})(),
|
|
51
|
+
})(), O = v(
|
|
52
52
|
(e) => {
|
|
53
|
-
|
|
54
|
-
e !== d && ((a = n.onExpand) == null || a.call(n, e, h));
|
|
53
|
+
e !== d && i.onExpand?.(e, h);
|
|
55
54
|
},
|
|
56
|
-
[d,
|
|
57
|
-
),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return "loadingIcon" in c ? c.loadingIcon : /* @__PURE__ */ r(Q, {});
|
|
55
|
+
[d, i.onExpand]
|
|
56
|
+
), P = v(async () => {
|
|
57
|
+
const { isLeaf: e, expanded: a } = n;
|
|
58
|
+
e || (!n.childrenData?.length && m(i.loadMore) && !a ? await i.loadMore(n) : O(!a));
|
|
59
|
+
}, [n, O, i.loadMore]), M = () => {
|
|
60
|
+
if (F)
|
|
61
|
+
return "loadingIcon" in c ? c.loadingIcon : /* @__PURE__ */ r(K, {});
|
|
64
62
|
let e = null, a = !1;
|
|
65
|
-
if (
|
|
66
|
-
|
|
63
|
+
if (I)
|
|
64
|
+
x && (e = "switcherIcon" in c ? c.switcherIcon : /* @__PURE__ */ r(J, {}), a = !0);
|
|
67
65
|
else {
|
|
68
|
-
const s =
|
|
69
|
-
e = "switcherIcon" in c ? c.switcherIcon : s, a = !
|
|
66
|
+
const s = x ? /* @__PURE__ */ r("span", { className: `${t}-${d ? "minus" : "plus"}-icon` }) : /* @__PURE__ */ r(z, {});
|
|
67
|
+
e = "switcherIcon" in c ? c.switcherIcon : s, a = !x;
|
|
70
68
|
}
|
|
71
69
|
if (e)
|
|
72
70
|
return e = /* @__PURE__ */ r(
|
|
73
71
|
"span",
|
|
74
72
|
{
|
|
75
|
-
className: `${
|
|
73
|
+
className: `${t}-switcher-icon`,
|
|
76
74
|
"aria-label": d ? "fold button" : "expand button",
|
|
77
75
|
role: "button",
|
|
78
76
|
tabIndex: 0,
|
|
79
|
-
onClick:
|
|
77
|
+
onClick: P,
|
|
80
78
|
children: e
|
|
81
79
|
}
|
|
82
|
-
), a ? /* @__PURE__ */ r(
|
|
83
|
-
}, u =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const a = p.current;
|
|
80
|
+
), a ? /* @__PURE__ */ r(ne, { prefix: t, children: e }) : e;
|
|
81
|
+
}, u = v(
|
|
82
|
+
te((e) => {
|
|
83
|
+
const a = C.current;
|
|
87
84
|
if (!a)
|
|
88
85
|
return;
|
|
89
|
-
const s = a.getBoundingClientRect(), g = window.pageYOffset + s.top,
|
|
86
|
+
const s = a.getBoundingClientRect(), g = window.pageYOffset + s.top, B = e.pageY, y = s.height / 4, A = B - g, $ = A < y ? -1 : A < s.height - y ? 0 : 1, V = i.allowDrop(n, $);
|
|
90
87
|
f({
|
|
91
|
-
...
|
|
92
|
-
isAllowDrop:
|
|
88
|
+
...o,
|
|
89
|
+
isAllowDrop: V,
|
|
93
90
|
isDragOver: !0,
|
|
94
|
-
dragPosition:
|
|
95
|
-
}),
|
|
91
|
+
dragPosition: $
|
|
92
|
+
}), i.onNodeDragOver?.(e, n, $);
|
|
96
93
|
}),
|
|
97
|
-
[
|
|
94
|
+
[i.onNodeDragOver]
|
|
98
95
|
);
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
s || g || (D = n.onCheck) == null || D.call(n, e, h, a);
|
|
96
|
+
function T(e, a) {
|
|
97
|
+
const { disableCheckbox: s, disabled: g } = n;
|
|
98
|
+
s || g || i.onCheck?.(e, h, a);
|
|
103
99
|
}
|
|
104
|
-
function
|
|
105
|
-
const { onSelect: a, actionOnClick: s } =
|
|
106
|
-
if (
|
|
100
|
+
function j(e) {
|
|
101
|
+
const { onSelect: a, actionOnClick: s } = i;
|
|
102
|
+
if (n.disabled)
|
|
107
103
|
return;
|
|
108
104
|
const g = [].concat(s);
|
|
109
|
-
|
|
105
|
+
p && g.indexOf("select") > -1 && a?.(h, e), g.indexOf("expand") > -1 && P(), w && g.indexOf("check") > -1 && T(!n.checked, e);
|
|
110
106
|
}
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ N(q, { children: [
|
|
108
|
+
/* @__PURE__ */ N(
|
|
113
109
|
"div",
|
|
114
110
|
{
|
|
115
|
-
style:
|
|
116
|
-
className:
|
|
117
|
-
ref:
|
|
111
|
+
style: n.style,
|
|
112
|
+
className: H,
|
|
113
|
+
ref: S,
|
|
118
114
|
role: "treeitem",
|
|
119
|
-
"aria-disabled":
|
|
115
|
+
"aria-disabled": b,
|
|
120
116
|
"aria-expanded": d,
|
|
121
|
-
"aria-level":
|
|
117
|
+
"aria-level": n._level,
|
|
122
118
|
children: [
|
|
123
|
-
/* @__PURE__ */ r("span", { className: `${
|
|
119
|
+
/* @__PURE__ */ r("span", { className: `${t}-indent`, "aria-hidden": !0, children: [...Array(n._level)].map((e, a) => /* @__PURE__ */ r(
|
|
124
120
|
"span",
|
|
125
121
|
{
|
|
126
|
-
className:
|
|
127
|
-
[`${
|
|
122
|
+
className: D(`${t}-indent-block`, {
|
|
123
|
+
[`${t}-indent-block-lineless`]: n._lineless && n._lineless[a]
|
|
128
124
|
})
|
|
129
125
|
},
|
|
130
126
|
a
|
|
@@ -132,85 +128,81 @@ function se(i, U) {
|
|
|
132
128
|
/* @__PURE__ */ r(
|
|
133
129
|
"span",
|
|
134
130
|
{
|
|
135
|
-
className:
|
|
136
|
-
[`${
|
|
131
|
+
className: D(`${t}-switcher`, {
|
|
132
|
+
[`${t}-switcher-expanded`]: d
|
|
137
133
|
}),
|
|
138
|
-
children:
|
|
134
|
+
children: M()
|
|
139
135
|
}
|
|
140
136
|
),
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
w ? /* @__PURE__ */ r(
|
|
138
|
+
ee,
|
|
143
139
|
{
|
|
144
|
-
disabled:
|
|
140
|
+
disabled: Y || b,
|
|
145
141
|
value: h,
|
|
146
|
-
indeterminate:
|
|
147
|
-
checked:
|
|
148
|
-
onChange:
|
|
142
|
+
indeterminate: n.indeterminated,
|
|
143
|
+
checked: n.checked,
|
|
144
|
+
onChange: T
|
|
149
145
|
}
|
|
150
146
|
) : null,
|
|
151
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ N(
|
|
152
148
|
"span",
|
|
153
149
|
{
|
|
154
|
-
"aria-grabbed":
|
|
155
|
-
ref:
|
|
156
|
-
className:
|
|
157
|
-
[`${
|
|
158
|
-
[`${
|
|
159
|
-
[`${
|
|
160
|
-
[`${
|
|
161
|
-
[`${
|
|
162
|
-
[`${
|
|
150
|
+
"aria-grabbed": o.isDragging,
|
|
151
|
+
ref: C,
|
|
152
|
+
className: D(`${t}-title`, {
|
|
153
|
+
[`${t}-title-draggable`]: l,
|
|
154
|
+
[`${t}-title-gap-top`]: o.isDragOver && o.isAllowDrop && o.dragPosition < 0,
|
|
155
|
+
[`${t}-title-gap-bottom`]: o.isDragOver && o.isAllowDrop && o.dragPosition > 0,
|
|
156
|
+
[`${t}-title-highlight`]: !o.isDragging && o.isDragOver && o.isAllowDrop && o.dragPosition === 0,
|
|
157
|
+
[`${t}-title-dragging`]: o.isDragging,
|
|
158
|
+
[`${t}-title-block`]: n.blockNode
|
|
163
159
|
}),
|
|
164
|
-
onClick:
|
|
160
|
+
onClick: j,
|
|
165
161
|
draggable: l,
|
|
166
162
|
onDrop: (e) => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
...t,
|
|
163
|
+
e.stopPropagation(), e.preventDefault(), i.onNodeDrop?.(e, n, o.dragPosition), u.cancel(), f({
|
|
164
|
+
...o,
|
|
170
165
|
isDragOver: !1,
|
|
171
166
|
dragPosition: 0
|
|
172
167
|
});
|
|
173
168
|
},
|
|
174
169
|
onDragStart: (e) => {
|
|
175
|
-
var a;
|
|
176
170
|
if (l) {
|
|
177
|
-
e.stopPropagation(), f({ ...
|
|
171
|
+
e.stopPropagation(), f({ ...o, isDragging: !0 });
|
|
178
172
|
try {
|
|
179
173
|
e.dataTransfer.setData("text/plain", "");
|
|
180
|
-
} catch (
|
|
181
|
-
console.error(
|
|
174
|
+
} catch (a) {
|
|
175
|
+
console.error(a);
|
|
182
176
|
}
|
|
183
|
-
|
|
177
|
+
i.onNodeDragStart?.(e, n);
|
|
184
178
|
}
|
|
185
179
|
},
|
|
186
180
|
onDragEnd: (e) => {
|
|
187
|
-
|
|
188
|
-
l && (e.stopPropagation(), u.cancel(), f({ ...t, isDragOver: !1, isDragging: !1 }), (a = n.onNodeDragEnd) == null || a.call(n, e, i));
|
|
181
|
+
l && (e.stopPropagation(), u.cancel(), f({ ...o, isDragOver: !1, isDragging: !1 }), i.onNodeDragEnd?.(e, n));
|
|
189
182
|
},
|
|
190
183
|
onDragOver: (e) => {
|
|
191
184
|
e.preventDefault(), e.stopPropagation(), e.persist(), u(e);
|
|
192
185
|
},
|
|
193
186
|
onDragLeave: (e) => {
|
|
194
|
-
|
|
195
|
-
l && (e.stopPropagation(), u.cancel(), f({ ...t, isDragOver: !1 }), (a = n.onNodeDragLeave) == null || a.call(n, e, i));
|
|
187
|
+
l && (e.stopPropagation(), u.cancel(), f({ ...o, isDragOver: !1 }), i.onNodeDragLeave?.(e, n));
|
|
196
188
|
},
|
|
197
189
|
children: [
|
|
198
|
-
|
|
199
|
-
/* @__PURE__ */ r("span", { className: `${
|
|
200
|
-
l && /* @__PURE__ */ r("span", { className: `${
|
|
190
|
+
k && /* @__PURE__ */ r("span", { className: `${t}-icon ${t}-custom-icon`, children: k }),
|
|
191
|
+
/* @__PURE__ */ r("span", { className: `${t}-title-text`, children: m(i.renderTitle) ? i.renderTitle(n) : _ }),
|
|
192
|
+
l && /* @__PURE__ */ r("span", { className: `${t}-icon ${t}-drag-icon`, children: "dragIcon" in c ? c.dragIcon : /* @__PURE__ */ r(G, {}) })
|
|
201
193
|
]
|
|
202
194
|
}
|
|
203
195
|
),
|
|
204
|
-
m(
|
|
196
|
+
m(i.renderExtra) && i.renderExtra(n)
|
|
205
197
|
]
|
|
206
198
|
}
|
|
207
199
|
),
|
|
208
|
-
|
|
200
|
+
i.animation && /* @__PURE__ */ r(ie, { ...n })
|
|
209
201
|
] });
|
|
210
202
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
const
|
|
203
|
+
const L = W(re);
|
|
204
|
+
L.displayName = "TreeNode";
|
|
205
|
+
const ke = Q.memo(L);
|
|
214
206
|
export {
|
|
215
|
-
|
|
207
|
+
ke as default
|
|
216
208
|
};
|
package/tree/NodeList.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { scrollIntoView as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
function H(
|
|
7
|
-
return
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as M, useRef as y, useMemo as p, useImperativeHandle as R, createElement as D } from "react";
|
|
3
|
+
import { scrollIntoView as V } from "../components/common/utils/scrollIntoView.js";
|
|
4
|
+
import b from "../virtual-list/VirtualList.js";
|
|
5
|
+
import I from "./Node.js";
|
|
6
|
+
function H(n) {
|
|
7
|
+
return n.key || n._key;
|
|
8
8
|
}
|
|
9
|
-
function j(
|
|
9
|
+
function j(n, N) {
|
|
10
10
|
const {
|
|
11
|
-
className:
|
|
12
|
-
style:
|
|
13
|
-
filterNode:
|
|
14
|
-
virtualListProps:
|
|
11
|
+
className: h,
|
|
12
|
+
style: m,
|
|
13
|
+
filterNode: i,
|
|
14
|
+
virtualListProps: K,
|
|
15
15
|
expandedKeys: w,
|
|
16
|
-
currentExpandKeys:
|
|
17
|
-
nodeList:
|
|
18
|
-
getNodeProps:
|
|
19
|
-
getDataSet:
|
|
20
|
-
} =
|
|
21
|
-
const e = /* @__PURE__ */ new Set(),
|
|
22
|
-
return
|
|
23
|
-
(
|
|
24
|
-
(r) => !
|
|
25
|
-
) && e.add(
|
|
16
|
+
currentExpandKeys: P,
|
|
17
|
+
nodeList: a,
|
|
18
|
+
getNodeProps: k,
|
|
19
|
+
getDataSet: g
|
|
20
|
+
} = n, L = K?.threshold !== null, l = y(), u = y(), S = y(), v = p(() => new Set(w), [w]), c = p(() => {
|
|
21
|
+
const e = /* @__PURE__ */ new Set(), s = new Set(P);
|
|
22
|
+
return a.forEach((t) => {
|
|
23
|
+
(t.pathParentKeys || []).every(
|
|
24
|
+
(r) => !s.has(r) && v.has(r)
|
|
25
|
+
) && e.add(t._key);
|
|
26
26
|
}), e;
|
|
27
|
-
}, [
|
|
28
|
-
return
|
|
27
|
+
}, [v, P, a]), E = () => a.filter((e) => !!((!i || i?.(e)) && c.has(e.key))), d = p(() => E(), [a, i, c]);
|
|
28
|
+
return R(N, () => ({
|
|
29
29
|
// index: 第几个dom元素, 如果传入的是字符串,会作为 node 的 key去查找。
|
|
30
30
|
// nodeProps: _index 是 key 时,对应的node
|
|
31
|
-
scrollIntoView: (e,
|
|
32
|
-
let
|
|
31
|
+
scrollIntoView: (e, s) => {
|
|
32
|
+
let t = e;
|
|
33
33
|
if (typeof e == "string") {
|
|
34
34
|
let r = e;
|
|
35
|
-
!
|
|
35
|
+
!c.has(e) && s?.pathParentKeys && (r = [...s.pathParentKeys].reverse().find((o) => c.has(o)) || t), t = d.findIndex(({ _key: o }) => o === r);
|
|
36
36
|
}
|
|
37
|
-
if (!
|
|
38
|
-
const r =
|
|
39
|
-
o &&
|
|
37
|
+
if (!L && u.current) {
|
|
38
|
+
const r = u.current, o = r ? r.children[t] : null;
|
|
39
|
+
o && V(o, {
|
|
40
40
|
boundary: r.parentElement
|
|
41
41
|
});
|
|
42
|
-
} else l.current && l.current.scrollTo({ index:
|
|
42
|
+
} else l.current && l.current.scrollTo({ index: t });
|
|
43
43
|
}
|
|
44
|
-
})),
|
|
45
|
-
|
|
44
|
+
})), L ? /* @__PURE__ */ x(
|
|
45
|
+
b,
|
|
46
46
|
{
|
|
47
|
-
className:
|
|
48
|
-
style:
|
|
47
|
+
className: h,
|
|
48
|
+
style: m,
|
|
49
49
|
ref: l,
|
|
50
50
|
data: d,
|
|
51
51
|
isStaticItemHeight: !1,
|
|
52
52
|
itemKey: H,
|
|
53
|
-
onMouseDown:
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
children: (e,
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
return /* @__PURE__ */
|
|
53
|
+
onMouseDown: n.onMouseDown,
|
|
54
|
+
...n.ariaProps,
|
|
55
|
+
...K,
|
|
56
|
+
children: (e, s, { itemIndex: t }) => {
|
|
57
|
+
t === 0 && (S.current = g());
|
|
58
|
+
const f = k(e, S.current);
|
|
59
|
+
return /* @__PURE__ */ D(I, { ...e, key: e.key, ...f });
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
) : /* @__PURE__ */
|
|
62
|
+
) : /* @__PURE__ */ x(
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
65
65
|
role: "tree",
|
|
66
66
|
tabIndex: 0,
|
|
67
|
-
className:
|
|
68
|
-
style:
|
|
69
|
-
ref:
|
|
70
|
-
...
|
|
71
|
-
onMouseDown:
|
|
67
|
+
className: h,
|
|
68
|
+
style: m,
|
|
69
|
+
ref: u,
|
|
70
|
+
...n.ariaProps,
|
|
71
|
+
onMouseDown: n.onMouseDown,
|
|
72
72
|
children: d.map((e) => {
|
|
73
|
-
const
|
|
74
|
-
return /* @__PURE__ */
|
|
73
|
+
const s = k(e);
|
|
74
|
+
return /* @__PURE__ */ D(I, { ...s, key: e.key });
|
|
75
75
|
})
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
const z =
|
|
79
|
+
const z = M(j);
|
|
80
80
|
export {
|
|
81
81
|
z as default
|
|
82
82
|
};
|