@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/menu/Item.js
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as N, jsx as o, Fragment as D } from "react/jsx-runtime";
|
|
2
2
|
import F from "../dist/scroll-into-view-if-needed/src/index.js";
|
|
3
3
|
import { forwardRef as O, useContext as j, useRef as B, useEffect as K } from "react";
|
|
4
4
|
import U from "../components/common/hooks/useIsFirstRender.js";
|
|
5
5
|
import z from "../tooltip/index.js";
|
|
6
6
|
import A from "@unicom-cloud/utils/class-name";
|
|
7
7
|
import { Enter as H } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
8
|
-
import { omit as
|
|
8
|
+
import { omit as h } from "../components/common/utils/omit.js";
|
|
9
9
|
import V from "./Indent.js";
|
|
10
10
|
import W from "./context.js";
|
|
11
11
|
import { PROPS_NEED_TO_BE_PASSED_IN_SUBMENU as q } from "./util.js";
|
|
12
|
-
function G(
|
|
12
|
+
function G(b, c) {
|
|
13
13
|
const {
|
|
14
|
-
_key:
|
|
15
|
-
children:
|
|
16
|
-
level:
|
|
14
|
+
_key: a,
|
|
15
|
+
children: s,
|
|
16
|
+
level: i,
|
|
17
17
|
disabled: l,
|
|
18
|
-
className:
|
|
19
|
-
style:
|
|
20
|
-
wrapper:
|
|
21
|
-
onClick:
|
|
22
|
-
renderItemInTooltip:
|
|
23
|
-
|
|
24
|
-
} =
|
|
18
|
+
className: x,
|
|
19
|
+
style: E,
|
|
20
|
+
wrapper: T = "div",
|
|
21
|
+
onClick: _,
|
|
22
|
+
renderItemInTooltip: d,
|
|
23
|
+
...$
|
|
24
|
+
} = b, {
|
|
25
25
|
prefixCls: t,
|
|
26
|
-
mode:
|
|
27
|
-
collapse:
|
|
28
|
-
inDropdown:
|
|
29
|
-
levelIndent:
|
|
30
|
-
selectedKeys:
|
|
31
|
-
autoScrollIntoView:
|
|
32
|
-
scrollConfig:
|
|
33
|
-
tooltipProps:
|
|
34
|
-
onClickMenuItem:
|
|
35
|
-
} = j(W),
|
|
26
|
+
mode: p,
|
|
27
|
+
collapse: m,
|
|
28
|
+
inDropdown: M,
|
|
29
|
+
levelIndent: P,
|
|
30
|
+
selectedKeys: f,
|
|
31
|
+
autoScrollIntoView: u,
|
|
32
|
+
scrollConfig: S,
|
|
33
|
+
tooltipProps: y,
|
|
34
|
+
onClickMenuItem: w
|
|
35
|
+
} = j(W), r = B(null), R = U(), I = p === "vertical" && i > 1, v = m && !M && i === 1, n = f && ~f.indexOf(a);
|
|
36
36
|
K(() => {
|
|
37
|
-
const e =
|
|
38
|
-
|
|
37
|
+
const e = n && u;
|
|
38
|
+
r.current && e && setTimeout(
|
|
39
39
|
() => {
|
|
40
|
-
|
|
40
|
+
r.current && F(r.current, {
|
|
41
41
|
behavior: "smooth",
|
|
42
42
|
block: "start",
|
|
43
43
|
scrollMode: "if-needed",
|
|
44
44
|
boundary: document.body,
|
|
45
|
-
...
|
|
45
|
+
...S
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
|
-
|
|
48
|
+
R ? 500 : 0
|
|
49
49
|
);
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
l || (
|
|
53
|
-
},
|
|
54
|
-
|
|
50
|
+
}, [n, u]);
|
|
51
|
+
const k = (e) => {
|
|
52
|
+
l || (w?.(a, e), _?.(e));
|
|
53
|
+
}, g = /* @__PURE__ */ N(
|
|
54
|
+
T,
|
|
55
55
|
{
|
|
56
56
|
tabIndex: l ? -1 : 0,
|
|
57
57
|
role: "menuitem",
|
|
58
58
|
ref: (e) => {
|
|
59
|
-
|
|
59
|
+
c = e, r.current = c;
|
|
60
60
|
},
|
|
61
|
-
style:
|
|
61
|
+
style: E,
|
|
62
62
|
className: A(
|
|
63
63
|
`${t}-item`,
|
|
64
64
|
{
|
|
65
65
|
[`${t}-disabled`]: l,
|
|
66
|
-
[`${t}-selected`]:
|
|
66
|
+
[`${t}-selected`]: n,
|
|
67
67
|
// 存在缩进dom
|
|
68
|
-
[`${t}-item-indented`]:
|
|
68
|
+
[`${t}-item-indented`]: I && !m
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
x
|
|
71
71
|
),
|
|
72
|
-
onClick:
|
|
72
|
+
onClick: k,
|
|
73
73
|
onKeyDown: (e) => {
|
|
74
|
-
e.key === H.key &&
|
|
74
|
+
e.key === H.key && k(e);
|
|
75
75
|
},
|
|
76
|
-
...
|
|
77
|
-
|
|
76
|
+
...h(
|
|
77
|
+
$,
|
|
78
78
|
["key", "_key"].concat(q)
|
|
79
79
|
),
|
|
80
80
|
children: [
|
|
81
|
-
|
|
81
|
+
I && !m ? /* @__PURE__ */ N(D, { children: [
|
|
82
82
|
/* @__PURE__ */ o(
|
|
83
83
|
V,
|
|
84
84
|
{
|
|
85
85
|
prefixCls: t,
|
|
86
|
-
levelIndent:
|
|
87
|
-
level:
|
|
86
|
+
levelIndent: P,
|
|
87
|
+
level: i
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
90
|
/* @__PURE__ */ o(
|
|
@@ -94,32 +94,32 @@ function G(T, p) {
|
|
|
94
94
|
style: {
|
|
95
95
|
display: "block"
|
|
96
96
|
},
|
|
97
|
-
children:
|
|
97
|
+
children: s
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
|
-
] }) :
|
|
101
|
-
|
|
100
|
+
] }) : s,
|
|
101
|
+
n && p === "horizontal" ? /* @__PURE__ */ o("div", { className: `${t}-selected-label` }) : null
|
|
102
102
|
]
|
|
103
103
|
}
|
|
104
104
|
);
|
|
105
|
-
return
|
|
105
|
+
return v ? /* @__PURE__ */ o(
|
|
106
106
|
z,
|
|
107
107
|
{
|
|
108
108
|
trigger: "hover",
|
|
109
109
|
position: "right",
|
|
110
|
-
content: typeof
|
|
110
|
+
content: typeof d == "function" ? d() : /* @__PURE__ */ o("span", { children: s }),
|
|
111
111
|
triggerProps: {
|
|
112
112
|
className: `${t}-item-tooltip`,
|
|
113
|
-
...
|
|
113
|
+
...y?.triggerProps || {}
|
|
114
114
|
},
|
|
115
|
-
...
|
|
116
|
-
children:
|
|
115
|
+
...h(y, ["triggerProps"]),
|
|
116
|
+
children: g
|
|
117
117
|
}
|
|
118
|
-
) :
|
|
118
|
+
) : g;
|
|
119
119
|
}
|
|
120
|
-
const J = O(G),
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const J = O(G), C = J;
|
|
121
|
+
C.displayName = "MenuItem";
|
|
122
|
+
C.menuType = "MenuItem";
|
|
123
123
|
export {
|
|
124
|
-
|
|
124
|
+
C as default
|
|
125
125
|
};
|
package/menu/Menu.js
CHANGED
|
@@ -1,184 +1,182 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as c, jsxs as me, Fragment as de } from "react/jsx-runtime";
|
|
2
|
+
import fe from "@unicom-cloud/icons/IconUiMenuFold";
|
|
3
|
+
import Ce from "@unicom-cloud/icons/IconUiMenuUnfold";
|
|
4
|
+
import Me from "lodash/isPlainObject";
|
|
5
|
+
import { forwardRef as he, useContext as I, useRef as $, useMemo as Ie, useEffect as xe } from "react";
|
|
6
6
|
import "../config-provider/ConfigProvider.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { SiderContext as
|
|
13
|
-
import
|
|
14
|
-
import { omit as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { generateInfoMap as
|
|
21
|
-
import
|
|
22
|
-
const
|
|
7
|
+
import ve from "../components/common/hooks/useForceUpdate.js";
|
|
8
|
+
import be from "../components/common/hooks/useId.js";
|
|
9
|
+
import ge from "../components/common/hooks/useKeyboardEvent.js";
|
|
10
|
+
import Ke from "../components/common/hooks/useMergeProps.js";
|
|
11
|
+
import x from "../components/common/hooks/useMergeValue.js";
|
|
12
|
+
import { SiderContext as ye } from "../layout/Sider.js";
|
|
13
|
+
import Se from "@unicom-cloud/utils/class-name";
|
|
14
|
+
import { omit as Pe } from "../components/common/utils/omit.js";
|
|
15
|
+
import O from "./context.js";
|
|
16
|
+
import $e from "./Item.js";
|
|
17
|
+
import Oe from "./ItemGroup.js";
|
|
18
|
+
import Ee from "./OverflowWrap.js";
|
|
19
|
+
import we from "./sub-menu/index.js";
|
|
20
|
+
import { generateInfoMap as Ne, processChildren as Be } from "./util.js";
|
|
21
|
+
import Ue from "../config-provider/context.js";
|
|
22
|
+
const _e = "light", Fe = {
|
|
23
23
|
mode: "vertical",
|
|
24
24
|
selectable: !0,
|
|
25
25
|
ellipsis: !0
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
const { getPrefixCls:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
function ze(E, w) {
|
|
28
|
+
const { getPrefixCls: N, componentConfig: B, rtl: U } = I(Ue), _ = Ke(
|
|
29
|
+
E,
|
|
30
|
+
Fe,
|
|
31
|
+
B?.Menu
|
|
32
32
|
), {
|
|
33
|
-
style:
|
|
34
|
-
children:
|
|
35
|
-
className:
|
|
36
|
-
prefixCls:
|
|
37
|
-
mode:
|
|
38
|
-
theme:
|
|
33
|
+
style: F,
|
|
34
|
+
children: f,
|
|
35
|
+
className: z,
|
|
36
|
+
prefixCls: T,
|
|
37
|
+
mode: r,
|
|
38
|
+
theme: V,
|
|
39
39
|
icons: p,
|
|
40
|
-
levelIndent:
|
|
41
|
-
collapse:
|
|
40
|
+
levelIndent: j,
|
|
41
|
+
collapse: A,
|
|
42
42
|
inDropdown: u,
|
|
43
|
-
selectable:
|
|
44
|
-
triggerProps:
|
|
45
|
-
tooltipProps:
|
|
43
|
+
selectable: D,
|
|
44
|
+
triggerProps: G,
|
|
45
|
+
tooltipProps: H,
|
|
46
46
|
ellipsis: C,
|
|
47
|
-
accordion:
|
|
48
|
-
autoOpen:
|
|
49
|
-
autoScrollIntoView:
|
|
50
|
-
scrollConfig:
|
|
51
|
-
hasCollapseButton:
|
|
52
|
-
defaultOpenKeys:
|
|
53
|
-
defaultSelectedKeys:
|
|
54
|
-
openKeys:
|
|
55
|
-
selectedKeys:
|
|
56
|
-
onClickSubMenu:
|
|
57
|
-
onClickMenuItem:
|
|
58
|
-
onCollapseChange:
|
|
47
|
+
accordion: M,
|
|
48
|
+
autoOpen: R,
|
|
49
|
+
autoScrollIntoView: L,
|
|
50
|
+
scrollConfig: k,
|
|
51
|
+
hasCollapseButton: Q,
|
|
52
|
+
defaultOpenKeys: W,
|
|
53
|
+
defaultSelectedKeys: q,
|
|
54
|
+
openKeys: J,
|
|
55
|
+
selectedKeys: X,
|
|
56
|
+
onClickSubMenu: Y,
|
|
57
|
+
onClickMenuItem: Z,
|
|
58
|
+
onCollapseChange: ee,
|
|
59
59
|
onEllipsisChange: oe,
|
|
60
|
-
|
|
61
|
-
} =
|
|
62
|
-
defaultValue:
|
|
63
|
-
value:
|
|
64
|
-
}), [
|
|
65
|
-
defaultValue:
|
|
66
|
-
value:
|
|
67
|
-
}), [m,
|
|
68
|
-
value:
|
|
69
|
-
}),
|
|
60
|
+
...v
|
|
61
|
+
} = _, [l, b] = x([], {
|
|
62
|
+
defaultValue: W,
|
|
63
|
+
value: J
|
|
64
|
+
}), [te, ne] = x([], {
|
|
65
|
+
defaultValue: q,
|
|
66
|
+
value: X
|
|
67
|
+
}), [m, re] = x(!1, {
|
|
68
|
+
value: A
|
|
69
|
+
}), se = I(O), { siderCollapsed: le } = I(ye), t = T || N?.("menu"), d = le || m || u || r === "popButton", g = V || se.theme || _e, i = $([]), K = $([]), ie = ve(), ce = ge(), y = Ie(() => Ne(f), [f]), pe = be(`${t}-`), h = v.id || pe;
|
|
70
70
|
xe(() => {
|
|
71
|
-
let e =
|
|
72
|
-
(
|
|
71
|
+
let e = l.filter(
|
|
72
|
+
(o) => i.current.indexOf(o) !== -1
|
|
73
73
|
);
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
(
|
|
74
|
+
if (R) {
|
|
75
|
+
const o = i.current.filter(
|
|
76
|
+
(s) => K.current.indexOf(s) === -1
|
|
77
77
|
);
|
|
78
|
-
e =
|
|
78
|
+
e = l.concat(o);
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
b(M ? e.slice(0, 1) : e), K.current = i.current.slice();
|
|
81
81
|
}, [i.current.toString()]);
|
|
82
|
-
const
|
|
83
|
-
const e =
|
|
84
|
-
const
|
|
85
|
-
|
|
82
|
+
const S = r !== "horizontal" && r !== "popButton" && !u && Q, ae = () => {
|
|
83
|
+
const e = Be(f, { level: 1 }), o = m ? p && p.collapseActive || /* @__PURE__ */ c(Ce, {}) : p && p.collapseDefault || /* @__PURE__ */ c(fe, {}), s = () => {
|
|
84
|
+
const n = !m;
|
|
85
|
+
re(n), ee?.(n);
|
|
86
86
|
};
|
|
87
|
-
return /* @__PURE__ */ de
|
|
88
|
-
/* @__PURE__ */ c("div", { className: `${
|
|
89
|
-
|
|
87
|
+
return /* @__PURE__ */ me(de, { children: [
|
|
88
|
+
/* @__PURE__ */ c("div", { className: `${t}-inner`, children: r === "horizontal" && C !== !1 ? /* @__PURE__ */ c(
|
|
89
|
+
Ee,
|
|
90
90
|
{
|
|
91
|
-
ellipsisText:
|
|
91
|
+
ellipsisText: Me(C) ? C.text : "···",
|
|
92
92
|
onEllipsisChange: oe,
|
|
93
93
|
children: e
|
|
94
94
|
}
|
|
95
95
|
) : e }),
|
|
96
|
-
|
|
96
|
+
S && /* @__PURE__ */ c(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
99
99
|
tabIndex: 0,
|
|
100
100
|
role: "button",
|
|
101
|
-
"aria-controls":
|
|
101
|
+
"aria-controls": h,
|
|
102
102
|
"aria-expanded": !m,
|
|
103
|
-
className: `${
|
|
104
|
-
onClick:
|
|
105
|
-
...
|
|
106
|
-
children:
|
|
103
|
+
className: `${t}-collapse-button`,
|
|
104
|
+
onClick: s,
|
|
105
|
+
...ce({ onPressEnter: s }),
|
|
106
|
+
children: o
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
] });
|
|
110
|
-
},
|
|
111
|
-
return d && !u && delete
|
|
110
|
+
}, P = { ...F };
|
|
111
|
+
return d && !u && delete P.width, /* @__PURE__ */ c(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
|
-
id:
|
|
114
|
+
id: S ? h : void 0,
|
|
115
115
|
role: "menu",
|
|
116
|
-
...
|
|
117
|
-
ref:
|
|
118
|
-
style:
|
|
119
|
-
className:
|
|
120
|
-
|
|
121
|
-
`${
|
|
122
|
-
`${
|
|
116
|
+
...Pe(v, ["isMenu"]),
|
|
117
|
+
ref: w,
|
|
118
|
+
style: P,
|
|
119
|
+
className: Se(
|
|
120
|
+
t,
|
|
121
|
+
`${t}-${g}`,
|
|
122
|
+
`${t}-${r === "horizontal" ? "horizontal" : "vertical"}`,
|
|
123
123
|
{
|
|
124
|
-
[`${
|
|
124
|
+
[`${t}-collapse`]: d,
|
|
125
125
|
// 缩起状态自动变成 pop 模式
|
|
126
|
-
[`${
|
|
127
|
-
[`${
|
|
128
|
-
[`${
|
|
126
|
+
[`${t}-pop`]: r === "pop" || d,
|
|
127
|
+
[`${t}-pop-button`]: r === "popButton",
|
|
128
|
+
[`${t}-rtl`]: U
|
|
129
129
|
},
|
|
130
|
-
|
|
130
|
+
z
|
|
131
131
|
),
|
|
132
132
|
children: /* @__PURE__ */ c(
|
|
133
|
-
|
|
133
|
+
O.Provider,
|
|
134
134
|
{
|
|
135
135
|
value: {
|
|
136
|
-
mode:
|
|
137
|
-
theme:
|
|
136
|
+
mode: r,
|
|
137
|
+
theme: g,
|
|
138
138
|
collapse: d,
|
|
139
|
-
levelIndent:
|
|
139
|
+
levelIndent: j,
|
|
140
140
|
inDropdown: u,
|
|
141
|
-
selectedKeys:
|
|
142
|
-
openKeys:
|
|
141
|
+
selectedKeys: te,
|
|
142
|
+
openKeys: l,
|
|
143
143
|
icons: p,
|
|
144
|
-
triggerProps:
|
|
145
|
-
tooltipProps:
|
|
146
|
-
autoScrollIntoView:
|
|
147
|
-
scrollConfig:
|
|
144
|
+
triggerProps: G,
|
|
145
|
+
tooltipProps: H,
|
|
146
|
+
autoScrollIntoView: L,
|
|
147
|
+
scrollConfig: k,
|
|
148
148
|
// pass props directly
|
|
149
|
-
id:
|
|
150
|
-
prefixCls:
|
|
151
|
-
collectInlineMenuKeys: (e,
|
|
152
|
-
|
|
153
|
-
(
|
|
154
|
-
) : i.current.push(e),
|
|
149
|
+
id: h,
|
|
150
|
+
prefixCls: t,
|
|
151
|
+
collectInlineMenuKeys: (e, o) => {
|
|
152
|
+
o ? i.current = i.current.filter(
|
|
153
|
+
(s) => s !== e
|
|
154
|
+
) : i.current.push(e), ie();
|
|
155
155
|
},
|
|
156
|
-
onClickMenuItem: (e,
|
|
157
|
-
|
|
158
|
-
L && re([e]), x == null || x(e, t, (n = E[e]) == null ? void 0 : n.keyPath);
|
|
156
|
+
onClickMenuItem: (e, o) => {
|
|
157
|
+
D && ne([e]), Z?.(e, o, y[e]?.keyPath);
|
|
159
158
|
},
|
|
160
|
-
onClickSubMenu: (e,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
n === "inline" && ((r == null ? void 0 : r.indexOf(e)) > -1 ? v && t === 1 ? s = [] : s = r.filter((me) => me !== e) : v && t === 1 ? s = [e] : s = r.concat([e])), g(s), I == null || I(e, s, (B = E[e]) == null ? void 0 : B.keyPath);
|
|
159
|
+
onClickSubMenu: (e, o, s) => {
|
|
160
|
+
let n = [...l];
|
|
161
|
+
s === "inline" && (l?.indexOf(e) > -1 ? M && o === 1 ? n = [] : n = l.filter((ue) => ue !== e) : M && o === 1 ? n = [e] : n = l.concat([e])), b(n), Y?.(e, n, y[e]?.keyPath);
|
|
164
162
|
}
|
|
165
163
|
},
|
|
166
|
-
children:
|
|
164
|
+
children: ae()
|
|
167
165
|
}
|
|
168
166
|
)
|
|
169
167
|
}
|
|
170
168
|
);
|
|
171
169
|
}
|
|
172
|
-
const
|
|
170
|
+
const Te = he(ze), a = Te;
|
|
173
171
|
a.displayName = "Menu";
|
|
174
|
-
a.Item =
|
|
175
|
-
a.SubMenu =
|
|
176
|
-
a.ItemGroup =
|
|
172
|
+
a.Item = $e;
|
|
173
|
+
a.SubMenu = we;
|
|
174
|
+
a.ItemGroup = Oe;
|
|
177
175
|
a.__PQB_MENU__ = !0;
|
|
178
176
|
export {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
$e as MenuItem,
|
|
178
|
+
Oe as MenuItemGroup,
|
|
179
|
+
we as MenuSubMenu,
|
|
180
|
+
we as SubMenu,
|
|
183
181
|
a as default
|
|
184
182
|
};
|
package/menu/OverflowWrap.js
CHANGED
|
@@ -1,89 +1,88 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import a, { useContext as $, useRef as T, useState as k, useEffect as A } from "react";
|
|
3
3
|
import H from "@unicom-cloud/utils/class-name";
|
|
4
|
-
import {
|
|
5
|
-
import { getStyle as
|
|
4
|
+
import { resizeObserver as U } from "../components/common/utils/resizeObserver.js";
|
|
5
|
+
import { getStyle as C } from "../components/common/utils/style.js";
|
|
6
6
|
import j from "./context.js";
|
|
7
7
|
import q from "./sub-menu/index.js";
|
|
8
8
|
const z = 5;
|
|
9
|
-
function
|
|
9
|
+
function S(o) {
|
|
10
10
|
return o && Math.ceil(+o.getBoundingClientRect().width);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return isNaN(
|
|
12
|
+
function g(o) {
|
|
13
|
+
const l = Number(o.replace("px", ""));
|
|
14
|
+
return isNaN(l) ? 0 : l;
|
|
15
15
|
}
|
|
16
16
|
const K = (o) => {
|
|
17
|
-
const { children:
|
|
18
|
-
if (e !==
|
|
19
|
-
const t =
|
|
20
|
-
|
|
17
|
+
const { children: l, ellipsisText: x = "···", onEllipsisChange: O } = o, { prefixCls: d } = $(j), i = T(null), [c, E] = k(null), v = `${d}-overflow-sub-menu`, R = `${d}-overflow-hidden-menu-item`, w = `${d}-overflow-sub-menu-mirror`, b = (e) => {
|
|
18
|
+
if (e !== c) {
|
|
19
|
+
const t = a.Children.toArray(l), n = e === null;
|
|
20
|
+
O?.({
|
|
21
21
|
lastVisibleIndex: n ? t.length - 1 : e,
|
|
22
22
|
overflowNodes: n ? [] : t.slice(e + 1)
|
|
23
23
|
}), E(e);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
function y() {
|
|
27
|
-
if (!
|
|
27
|
+
if (!i.current)
|
|
28
28
|
return;
|
|
29
|
-
const e =
|
|
30
|
-
let
|
|
31
|
-
for (let
|
|
32
|
-
const
|
|
29
|
+
const e = i.current, t = S(e) - z, n = [].slice.call(e.children);
|
|
30
|
+
let s = 0, u = 0, f = 0;
|
|
31
|
+
for (let m = 0; m < n.length; m++) {
|
|
32
|
+
const r = n[m], N = r.className.split(" "), L = N.indexOf(v) > -1, W = N.indexOf(w) > -1;
|
|
33
33
|
if (L)
|
|
34
34
|
continue;
|
|
35
|
-
const
|
|
35
|
+
const p = S(r) + g(C(r, "marginLeft")) + g(C(r, "marginRight"));
|
|
36
36
|
if (W) {
|
|
37
|
-
|
|
37
|
+
f = p;
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
40
|
+
if (u += p, u > t) {
|
|
41
|
+
b(
|
|
42
42
|
// 判断如果将最后一个菜单项换为 ... 是否会超出宽度
|
|
43
|
-
|
|
43
|
+
s - (u - p + f <= t ? 1 : 2)
|
|
44
44
|
);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
s++;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
b(null);
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const M = (e, t = !1) => /* @__PURE__ */ h(
|
|
52
52
|
q,
|
|
53
53
|
{
|
|
54
|
-
title: /* @__PURE__ */
|
|
55
|
-
className: t ?
|
|
54
|
+
title: /* @__PURE__ */ h("span", { children: x }),
|
|
55
|
+
className: t ? w : v,
|
|
56
56
|
children: e
|
|
57
57
|
},
|
|
58
58
|
`pqb-menu-overflow-sub-menu${t ? "-mirror" : ""}`
|
|
59
59
|
), I = () => {
|
|
60
60
|
let e = null;
|
|
61
|
-
const t =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (f !== null && (l > f && (m = p.cloneElement(r, {
|
|
61
|
+
const t = M(null, !0), n = a.Children.map(l, (s, u) => {
|
|
62
|
+
let f = s;
|
|
63
|
+
if (c !== null && (u > c && (f = a.cloneElement(s, {
|
|
65
64
|
className: H(
|
|
66
65
|
R,
|
|
67
|
-
|
|
66
|
+
s?.props?.className
|
|
68
67
|
)
|
|
69
|
-
})),
|
|
70
|
-
const
|
|
71
|
-
(
|
|
72
|
-
key:
|
|
68
|
+
})), u === c + 1)) {
|
|
69
|
+
const m = a.Children.toArray(l).slice(c + 1).map(
|
|
70
|
+
(r) => a.cloneElement(r, {
|
|
71
|
+
key: r.props._key
|
|
73
72
|
})
|
|
74
73
|
);
|
|
75
|
-
e =
|
|
74
|
+
e = M(m);
|
|
76
75
|
}
|
|
77
|
-
return
|
|
76
|
+
return f;
|
|
78
77
|
}) ?? [];
|
|
79
78
|
return [t, ...n, e];
|
|
80
79
|
};
|
|
81
80
|
return A(() => {
|
|
82
|
-
const e = U([
|
|
81
|
+
const e = U([i.current], y);
|
|
83
82
|
return () => {
|
|
84
83
|
e();
|
|
85
84
|
};
|
|
86
|
-
}, [
|
|
85
|
+
}, [i.current]), /* @__PURE__ */ h("div", { className: `${d}-overflow-wrap`, ref: i, children: I() });
|
|
87
86
|
};
|
|
88
87
|
export {
|
|
89
88
|
K as default
|