@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/cascader/panel/List.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as u, Fragment as q, jsxs as I } from "react/jsx-runtime";
|
|
2
2
|
import "../../dist/react-transition-group/src/CSSTransition.js";
|
|
3
3
|
import "../../dist/react-transition-group/src/ReplaceTransition.js";
|
|
4
4
|
import "../../dist/react-transition-group/src/SwitchTransition.js";
|
|
5
5
|
import "../../dist/react-transition-group/chunk/CPfP7aNL.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { getMultipleCheckValue as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { PqbCSSTransition as
|
|
16
|
-
import
|
|
17
|
-
import { on as
|
|
6
|
+
import K from "../../dist/react-transition-group/src/TransitionGroup.js";
|
|
7
|
+
import z from "lodash/isEqualWith";
|
|
8
|
+
import D from "lodash/isFunction";
|
|
9
|
+
import H from "lodash/isString";
|
|
10
|
+
import G, { useState as J, useCallback as P, useEffect as S } from "react";
|
|
11
|
+
import { getMultipleCheckValue as Q } from "../util.js";
|
|
12
|
+
import X from "../../components/common/hooks/useForceUpdate.js";
|
|
13
|
+
import Y from "../../components/common/hooks/useRefs.js";
|
|
14
|
+
import Z from "../../components/common/hooks/useUpdateEffect.js";
|
|
15
|
+
import { PqbCSSTransition as ee } from "../../components/common/utils/PqbCSSTransition.js";
|
|
16
|
+
import k from "@unicom-cloud/utils/class-name";
|
|
17
|
+
import { on as te, off as _ } from "../../components/common/utils/dom.js";
|
|
18
18
|
import "../../components/common/utils/is.js";
|
|
19
|
-
import { Enter as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { isPlainObject as
|
|
23
|
-
const
|
|
19
|
+
import { Enter as le, ArrowLeft as re, ArrowRight as ie, ArrowUp as ae, ArrowDown as M, Esc as ne } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
20
|
+
import se from "../../virtual-list/VirtualList.js";
|
|
21
|
+
import ce from "./Option.js";
|
|
22
|
+
import { isPlainObject as de } from "@unicom-cloud/utils/is";
|
|
23
|
+
const ue = (l) => {
|
|
24
24
|
for (let n = 0; n < l.length; n++)
|
|
25
25
|
if (!l[n].disabled)
|
|
26
26
|
return l[n];
|
|
27
|
-
},
|
|
27
|
+
}, R = (l) => {
|
|
28
28
|
if (l && l.disabled) {
|
|
29
29
|
let n = l;
|
|
30
30
|
for (; n.parent && n.parent.disabled; )
|
|
@@ -32,127 +32,123 @@ const fe = (l) => {
|
|
|
32
32
|
return n;
|
|
33
33
|
}
|
|
34
34
|
return l;
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
store: u,
|
|
35
|
+
}, F = (l, n) => l < 0 ? n : l > n ? 0 : l, Se = (l) => {
|
|
36
|
+
const [n, T] = Y(), w = X(), {
|
|
37
|
+
store: o,
|
|
39
38
|
prefixCls: s,
|
|
40
|
-
value:
|
|
39
|
+
value: y,
|
|
41
40
|
multiple: f,
|
|
42
|
-
renderFooter:
|
|
43
|
-
renderOption:
|
|
44
|
-
showEmptyChildren:
|
|
41
|
+
renderFooter: V,
|
|
42
|
+
renderOption: N,
|
|
43
|
+
showEmptyChildren: U,
|
|
45
44
|
loadMore: E,
|
|
46
|
-
renderEmpty:
|
|
47
|
-
rtl:
|
|
48
|
-
icons:
|
|
49
|
-
} = l, [
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
e.setLoading(!0), C();
|
|
45
|
+
renderEmpty: $,
|
|
46
|
+
rtl: L,
|
|
47
|
+
icons: W
|
|
48
|
+
} = l, [i, b] = J(
|
|
49
|
+
o.findNodeByValue(y && y[y.length - 1]) || null
|
|
50
|
+
), m = o.getOptions(), A = (e) => {
|
|
51
|
+
l.onChange?.(e);
|
|
52
|
+
}, C = async (e) => {
|
|
53
|
+
if (!e.isLeaf && D(E) && !e.children) {
|
|
54
|
+
e.setLoading(!0), w();
|
|
57
55
|
try {
|
|
58
56
|
const r = await E(
|
|
59
57
|
e.pathValue,
|
|
60
58
|
e.pathValue.length
|
|
61
59
|
);
|
|
62
|
-
|
|
60
|
+
o.appendOptionChildren(e, r), o.setNodeCheckedByValue(l.value);
|
|
63
61
|
} catch (r) {
|
|
64
62
|
console.error(r);
|
|
65
63
|
}
|
|
66
|
-
e.setLoading(!1),
|
|
64
|
+
e.setLoading(!1), w();
|
|
67
65
|
}
|
|
68
|
-
},
|
|
69
|
-
!e || e.disabled || (
|
|
70
|
-
},
|
|
71
|
-
const
|
|
72
|
-
e ===
|
|
73
|
-
},
|
|
74
|
-
(e =
|
|
75
|
-
var i;
|
|
66
|
+
}, h = async (e, r = !0) => {
|
|
67
|
+
!e || e.disabled || (b(e), C(e), !f && r && (l.changeOnSelect || e.isLeaf) && A([e.pathValue]));
|
|
68
|
+
}, x = (e, r) => {
|
|
69
|
+
const a = Q(l.value, o, e, r);
|
|
70
|
+
e === i && w(), b(e), l.changeOnSelect || C(e), A(a);
|
|
71
|
+
}, O = P(
|
|
72
|
+
(e = i) => {
|
|
76
73
|
let r = e;
|
|
77
74
|
for (; r; )
|
|
78
|
-
|
|
75
|
+
n[r._level]?.scrollTo({
|
|
79
76
|
index: r._index,
|
|
80
77
|
options: { block: "nearest" }
|
|
81
78
|
}), r = r._level < 1 ? null : r.parent;
|
|
82
79
|
},
|
|
83
|
-
[
|
|
84
|
-
),
|
|
80
|
+
[i]
|
|
81
|
+
), p = P(
|
|
85
82
|
(e) => {
|
|
86
|
-
var t;
|
|
87
83
|
const r = e.key;
|
|
88
|
-
let
|
|
84
|
+
let a;
|
|
89
85
|
switch (r) {
|
|
90
|
-
case
|
|
91
|
-
e.preventDefault(),
|
|
86
|
+
case ne.key: {
|
|
87
|
+
e.preventDefault(), l.onEsc?.();
|
|
92
88
|
break;
|
|
93
89
|
}
|
|
94
|
-
case
|
|
95
|
-
case
|
|
96
|
-
if (!
|
|
97
|
-
|
|
90
|
+
case M.key:
|
|
91
|
+
case ae.key: {
|
|
92
|
+
if (!i)
|
|
93
|
+
a = ue(m);
|
|
98
94
|
else {
|
|
99
|
-
const
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
const t = R(i), c = t.parent && t.parent.children || m, g = r === M.key ? 1 : -1;
|
|
96
|
+
let d = F(
|
|
97
|
+
t._index + g,
|
|
98
|
+
c.length - 1
|
|
103
99
|
);
|
|
104
|
-
for (;
|
|
105
|
-
|
|
100
|
+
for (; d !== t._index && (a = c[d], a.disabled); )
|
|
101
|
+
d = F(d + g, c.length - 1);
|
|
106
102
|
}
|
|
107
|
-
return
|
|
103
|
+
return O(a), h(a, !1), e.preventDefault(), !1;
|
|
108
104
|
}
|
|
109
|
-
case
|
|
110
|
-
return
|
|
111
|
-
case
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
|
|
105
|
+
case ie.key:
|
|
106
|
+
return i && !i.disabled && (a = (i.children || [])[0] || i, h(a, !1)), e.preventDefault(), !1;
|
|
107
|
+
case re.key: {
|
|
108
|
+
if (i) {
|
|
109
|
+
const t = R(i);
|
|
110
|
+
a = t.parent || t;
|
|
115
111
|
}
|
|
116
|
-
return
|
|
112
|
+
return h(a, !1), e.preventDefault(), !1;
|
|
117
113
|
}
|
|
118
|
-
case
|
|
119
|
-
return
|
|
114
|
+
case le.key:
|
|
115
|
+
return i && (f ? x(i, !i._checked) : h(i)), e.preventDefault(), !1;
|
|
120
116
|
}
|
|
121
117
|
},
|
|
122
|
-
[
|
|
118
|
+
[i]
|
|
123
119
|
);
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
Z(() => {
|
|
121
|
+
b((e) => {
|
|
126
122
|
let r;
|
|
127
123
|
if (e && e.pathValue && e.pathValue.length) {
|
|
128
|
-
const
|
|
129
|
-
let t = { children:
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
124
|
+
const a = e.pathValue;
|
|
125
|
+
let t = { children: m };
|
|
126
|
+
a.map((c) => {
|
|
127
|
+
const d = (t.children || []).find((B) => B.value === c);
|
|
128
|
+
d && (t = d, r = d);
|
|
133
129
|
});
|
|
134
130
|
}
|
|
135
131
|
return r;
|
|
136
132
|
});
|
|
137
|
-
}, [
|
|
138
|
-
l.popupVisible &&
|
|
139
|
-
}, [l.popupVisible]),
|
|
133
|
+
}, [o]), S(() => {
|
|
134
|
+
l.popupVisible && m.length && setTimeout(O);
|
|
135
|
+
}, [l.popupVisible]), S(() => {
|
|
140
136
|
const e = l.getTriggerElement();
|
|
141
137
|
if (e)
|
|
142
|
-
return l.popupVisible ?
|
|
143
|
-
|
|
138
|
+
return l.popupVisible ? te(e, "keydown", p) : _(e, "keydown", p), () => {
|
|
139
|
+
_(e, "keydown", p);
|
|
144
140
|
};
|
|
145
|
-
}, [l.popupVisible,
|
|
146
|
-
const
|
|
147
|
-
const e = [
|
|
148
|
-
return (
|
|
149
|
-
|
|
141
|
+
}, [l.popupVisible, p]);
|
|
142
|
+
const v = (() => {
|
|
143
|
+
const e = [m];
|
|
144
|
+
return (i ? i.getPathNodes() : []).forEach((a) => {
|
|
145
|
+
a && a.children && e.push(a.children);
|
|
150
146
|
}), e;
|
|
151
|
-
})(),
|
|
152
|
-
return !
|
|
153
|
-
const
|
|
154
|
-
return e.length === 0 && !
|
|
155
|
-
|
|
147
|
+
})(), j = D(l.dropdownColumnRender) ? l.dropdownColumnRender : (e) => e;
|
|
148
|
+
return !v.length || !v[0]?.length ? /* @__PURE__ */ u(q, { children: $() }) : /* @__PURE__ */ u(K, { component: G.Fragment, children: v.map((e, r) => {
|
|
149
|
+
const a = V ? V(r, i || null) : null;
|
|
150
|
+
return e.length === 0 && !U ? null : /* @__PURE__ */ u(
|
|
151
|
+
ee,
|
|
156
152
|
{
|
|
157
153
|
timeout: {
|
|
158
154
|
enter: 300,
|
|
@@ -168,48 +164,48 @@ const fe = (l) => {
|
|
|
168
164
|
onEntered: (t) => {
|
|
169
165
|
t && (t.style.marginLeft = "");
|
|
170
166
|
},
|
|
171
|
-
children: /* @__PURE__ */
|
|
167
|
+
children: /* @__PURE__ */ u(
|
|
172
168
|
"div",
|
|
173
169
|
{
|
|
174
|
-
className:
|
|
170
|
+
className: k(`${s}-list-column`, {
|
|
175
171
|
[`${s}-list-column-virtual`]: l.virtualListProps && l.virtualListProps.threshold !== null,
|
|
176
|
-
[`${s}-list-column-rtl`]:
|
|
172
|
+
[`${s}-list-column-rtl`]: L
|
|
177
173
|
}),
|
|
178
174
|
style: {
|
|
179
|
-
zIndex:
|
|
175
|
+
zIndex: v.length - r,
|
|
180
176
|
...l.dropdownMenuColumnStyle
|
|
181
177
|
},
|
|
182
|
-
children:
|
|
183
|
-
/* @__PURE__ */
|
|
178
|
+
children: j(
|
|
179
|
+
/* @__PURE__ */ I(
|
|
184
180
|
"div",
|
|
185
181
|
{
|
|
186
|
-
className:
|
|
187
|
-
[`${s}-list-wrapper-with-footer`]:
|
|
182
|
+
className: k(`${s}-list-wrapper`, {
|
|
183
|
+
[`${s}-list-wrapper-with-footer`]: a !== null
|
|
188
184
|
}),
|
|
189
185
|
children: [
|
|
190
|
-
e.length === 0 ?
|
|
191
|
-
|
|
186
|
+
e.length === 0 ? $?.(l.virtualListProps ? "100%" : 120) : /* @__PURE__ */ u(
|
|
187
|
+
se,
|
|
192
188
|
{
|
|
193
189
|
needFiller: !1,
|
|
194
190
|
threshold: l.virtualListProps ? 100 : null,
|
|
195
191
|
data: e,
|
|
196
192
|
isStaticItemHeight: !0,
|
|
197
193
|
itemKey: "value",
|
|
198
|
-
...
|
|
194
|
+
...de(l.virtualListProps) ? l.virtualListProps : {},
|
|
199
195
|
wrapper: "ul",
|
|
200
196
|
role: "menu",
|
|
201
|
-
ref: (t) =>
|
|
202
|
-
className:
|
|
197
|
+
ref: (t) => T(t, r),
|
|
198
|
+
className: k(
|
|
203
199
|
`${s}-list`,
|
|
204
200
|
`${s}-list-select`,
|
|
205
201
|
{
|
|
206
202
|
[`${s}-list-multiple`]: f,
|
|
207
|
-
[`${s}-list-rtl`]:
|
|
203
|
+
[`${s}-list-rtl`]: L
|
|
208
204
|
}
|
|
209
205
|
),
|
|
210
206
|
children: (t) => {
|
|
211
207
|
let c = !1;
|
|
212
|
-
return
|
|
208
|
+
return i && (c = i.pathValue[r] === t.value), /* @__PURE__ */ u(
|
|
213
209
|
"li",
|
|
214
210
|
{
|
|
215
211
|
tabIndex: 0,
|
|
@@ -217,29 +213,29 @@ const fe = (l) => {
|
|
|
217
213
|
"aria-haspopup": !t.isLeaf,
|
|
218
214
|
"aria-expanded": c && !t.isLeaf,
|
|
219
215
|
"aria-disabled": t.disabled,
|
|
220
|
-
title:
|
|
221
|
-
className:
|
|
216
|
+
title: H(t.label) ? t.label : void 0,
|
|
217
|
+
className: k(`${s}-list-item`, {
|
|
222
218
|
[`${s}-list-item-active`]: c,
|
|
223
219
|
[`${s}-list-item-disabled`]: t.disabled
|
|
224
220
|
}),
|
|
225
|
-
children: /* @__PURE__ */
|
|
226
|
-
|
|
221
|
+
children: /* @__PURE__ */ u(
|
|
222
|
+
ce,
|
|
227
223
|
{
|
|
228
224
|
prefixCls: s,
|
|
229
|
-
rtl:
|
|
225
|
+
rtl: L,
|
|
230
226
|
multiple: f,
|
|
231
227
|
option: t,
|
|
232
|
-
selected: !f && t.isLeaf &&
|
|
233
|
-
icons:
|
|
228
|
+
selected: !f && t.isLeaf && z(l.value, t.pathValue),
|
|
229
|
+
icons: W,
|
|
234
230
|
onMouseEnter: () => {
|
|
235
|
-
t.disabled || l.expandTrigger === "hover" && (
|
|
231
|
+
t.disabled || l.expandTrigger === "hover" && (b(t), !t.isLeaf && C(t));
|
|
236
232
|
},
|
|
237
|
-
renderOption:
|
|
233
|
+
renderOption: N && (() => N(t._data, r)),
|
|
238
234
|
onClickOption: () => {
|
|
239
|
-
t.isLeaf && f && !t.disableCheckbox ?
|
|
235
|
+
t.isLeaf && f && !t.disableCheckbox ? x(t, !t._checked) : h(t);
|
|
240
236
|
},
|
|
241
|
-
onMultipleChecked: (
|
|
242
|
-
|
|
237
|
+
onMultipleChecked: (g) => {
|
|
238
|
+
x(t, g);
|
|
243
239
|
},
|
|
244
240
|
onDoubleClickOption: l.onDoubleClickOption
|
|
245
241
|
}
|
|
@@ -250,14 +246,14 @@ const fe = (l) => {
|
|
|
250
246
|
}
|
|
251
247
|
}
|
|
252
248
|
),
|
|
253
|
-
|
|
249
|
+
a && /* @__PURE__ */ u(
|
|
254
250
|
"div",
|
|
255
251
|
{
|
|
256
252
|
className: `${s}-list-footer`,
|
|
257
253
|
onMouseDown: (t) => {
|
|
258
254
|
t.stopPropagation();
|
|
259
255
|
},
|
|
260
|
-
children:
|
|
256
|
+
children: a
|
|
261
257
|
}
|
|
262
258
|
)
|
|
263
259
|
]
|
|
@@ -273,6 +269,6 @@ const fe = (l) => {
|
|
|
273
269
|
}) });
|
|
274
270
|
};
|
|
275
271
|
export {
|
|
276
|
-
|
|
277
|
-
|
|
272
|
+
Se as default,
|
|
273
|
+
F as getLegalIndex
|
|
278
274
|
};
|
package/cascader/panel/Search.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as f, jsxs as N, Fragment as C } from "react/jsx-runtime";
|
|
2
2
|
import B from "../../dist/scroll-into-view-if-needed/src/index.js";
|
|
3
3
|
import D from "lodash/isEqualWith";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useState as
|
|
4
|
+
import E from "lodash/isFunction";
|
|
5
|
+
import w from "lodash/isString";
|
|
6
|
+
import { useState as O, useRef as P, useEffect as F } from "react";
|
|
7
7
|
import { getMultipleCheckValue as K } from "../util.js";
|
|
8
8
|
import q from "../../checkbox/Checkbox.js";
|
|
9
9
|
import "../../checkbox/Group.js";
|
|
@@ -16,153 +16,151 @@ import { Enter as G, ArrowUp as J, ArrowDown as A, Esc as Q } from "@unicom-clou
|
|
|
16
16
|
import X from "../../virtual-list/VirtualList.js";
|
|
17
17
|
import { isPlainObject as Y } from "@unicom-cloud/utils/is";
|
|
18
18
|
const H = (t, r) => t < 0 ? r : t > r ? 0 : t, Z = (t, r, s) => {
|
|
19
|
-
let
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
|
|
19
|
+
let g = r;
|
|
20
|
+
if (w(r)) {
|
|
21
|
+
const h = r.toUpperCase().indexOf(t.toUpperCase());
|
|
22
|
+
if (h > -1) {
|
|
23
|
+
const m = r.substring(0, h + 1), y = r.substring(h + t.length);
|
|
24
|
+
g = /* @__PURE__ */ N(C, { children: [
|
|
25
|
+
m,
|
|
26
|
+
/* @__PURE__ */ f("span", { className: `${s}-highlight`, children: r.substring(h, t.length + 1) }),
|
|
27
|
+
y
|
|
28
28
|
] });
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return g;
|
|
32
32
|
}, ke = (t) => {
|
|
33
33
|
const {
|
|
34
34
|
store: r,
|
|
35
35
|
prefixCls: s,
|
|
36
|
-
multiple:
|
|
37
|
-
onChange:
|
|
38
|
-
inputValue:
|
|
39
|
-
renderEmpty:
|
|
36
|
+
multiple: g,
|
|
37
|
+
onChange: h,
|
|
38
|
+
inputValue: m,
|
|
39
|
+
renderEmpty: y,
|
|
40
40
|
style: U,
|
|
41
41
|
defaultActiveFirstOption: $,
|
|
42
42
|
rtl: V,
|
|
43
43
|
icons: _
|
|
44
|
-
} = t,
|
|
45
|
-
r.searchNodeByLabel(
|
|
46
|
-
),
|
|
44
|
+
} = t, L = t.value || [], [i, j] = O(
|
|
45
|
+
r.searchNodeByLabel(m) || []
|
|
46
|
+
), b = P(), k = P(), I = T(), [p, v] = O(
|
|
47
47
|
$ ? 0 : -1
|
|
48
|
-
),
|
|
49
|
-
if (
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
48
|
+
), x = (e, o, a) => {
|
|
49
|
+
if (a.stopPropagation(), !e.disabled)
|
|
50
|
+
if (g) {
|
|
51
|
+
const c = K(
|
|
52
52
|
t.value,
|
|
53
53
|
r,
|
|
54
54
|
e,
|
|
55
|
-
|
|
55
|
+
o
|
|
56
56
|
);
|
|
57
|
-
|
|
57
|
+
h?.(c);
|
|
58
58
|
} else
|
|
59
|
-
|
|
59
|
+
h?.([e.pathValue]);
|
|
60
60
|
};
|
|
61
61
|
return M(() => {
|
|
62
|
-
j(r.searchNodeByLabel(
|
|
63
|
-
}, [
|
|
64
|
-
|
|
65
|
-
}, [
|
|
62
|
+
j(r.searchNodeByLabel(m));
|
|
63
|
+
}, [m, r]), M(() => {
|
|
64
|
+
v((e) => e > i.length - 1 ? $ ? 0 : -1 : e);
|
|
65
|
+
}, [i]), F(() => {
|
|
66
66
|
const e = t.getTriggerElement();
|
|
67
67
|
if (!e)
|
|
68
68
|
return;
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
switch (u) {
|
|
69
|
+
const o = (a) => {
|
|
70
|
+
a.stopPropagation();
|
|
71
|
+
const c = a.key;
|
|
72
|
+
switch (c) {
|
|
74
73
|
case Q.key:
|
|
75
|
-
return
|
|
74
|
+
return t.onEsc?.(), !1;
|
|
76
75
|
case A.key:
|
|
77
76
|
case J.key: {
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
p +
|
|
82
|
-
|
|
77
|
+
k.current = !0;
|
|
78
|
+
const n = A.key === c ? 1 : -1;
|
|
79
|
+
let l = H(
|
|
80
|
+
p + n,
|
|
81
|
+
i.length - 1
|
|
83
82
|
);
|
|
84
|
-
for (;
|
|
85
|
-
|
|
86
|
-
return
|
|
83
|
+
for (; l !== p && i[l].disabled; )
|
|
84
|
+
l = H(l + n, i.length - 1);
|
|
85
|
+
return v(l), !1;
|
|
87
86
|
}
|
|
88
87
|
case G.key: {
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
88
|
+
const n = i[p];
|
|
89
|
+
if (n) {
|
|
90
|
+
const l = L.some((d) => D(d, n.pathValue));
|
|
91
|
+
x(n, !l, a);
|
|
93
92
|
}
|
|
94
93
|
return !1;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
};
|
|
98
|
-
return W(e, "keydown",
|
|
99
|
-
z(e, "keydown",
|
|
97
|
+
return W(e, "keydown", o), () => {
|
|
98
|
+
z(e, "keydown", o);
|
|
100
99
|
};
|
|
101
|
-
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
e && (v.current || I) && B(e, {
|
|
100
|
+
}, [i, p, L]), F(() => {
|
|
101
|
+
const e = b.current;
|
|
102
|
+
e && (k.current || I) && B(e, {
|
|
105
103
|
behavior: "auto",
|
|
106
104
|
block: "nearest",
|
|
107
105
|
scrollMode: "if-needed",
|
|
108
|
-
boundary:
|
|
106
|
+
boundary: e.parentNode?.parentNode
|
|
109
107
|
});
|
|
110
|
-
}, [p,
|
|
108
|
+
}, [p, i]), b.current = null, i.length ? /* @__PURE__ */ f("div", { className: `${s}-list-wrapper`, children: /* @__PURE__ */ f(
|
|
111
109
|
X,
|
|
112
110
|
{
|
|
113
111
|
needFiller: !1,
|
|
114
112
|
wrapper: "ul",
|
|
115
113
|
role: "menu",
|
|
116
114
|
style: U,
|
|
117
|
-
data:
|
|
115
|
+
data: i,
|
|
118
116
|
isStaticItemHeight: !0,
|
|
119
117
|
threshold: t.virtualListProps ? 100 : null,
|
|
120
118
|
...Y(t.virtualListProps) ? t.virtualListProps : {},
|
|
121
119
|
onMouseMove: () => {
|
|
122
|
-
|
|
120
|
+
k.current = !1;
|
|
123
121
|
},
|
|
124
122
|
className: S(`${s}-list`, `${s}-list-search`, {
|
|
125
|
-
[`${s}-list-multiple`]:
|
|
123
|
+
[`${s}-list-multiple`]: g,
|
|
126
124
|
[`${s}-list-rtl`]: V
|
|
127
125
|
}),
|
|
128
|
-
children: (e,
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
] }, `${
|
|
133
|
-
return /* @__PURE__ */
|
|
126
|
+
children: (e, o) => {
|
|
127
|
+
const a = e.getPathNodes(), c = a.map((u, R, ee) => /* @__PURE__ */ N("span", { children: [
|
|
128
|
+
u.label,
|
|
129
|
+
a.length === R + 1 ? "" : " / "
|
|
130
|
+
] }, `${u.label}_${u._level}`)), n = e._checked, l = { checked: n }, d = E(t.renderOption) ? t.renderOption(m, e._data, l) : Z(m, c, s);
|
|
131
|
+
return /* @__PURE__ */ f(
|
|
134
132
|
"li",
|
|
135
133
|
{
|
|
136
|
-
title:
|
|
134
|
+
title: w(d) ? d : w(c) ? c : void 0,
|
|
137
135
|
role: "menuitem",
|
|
138
136
|
"aria-disabled": e.disabled,
|
|
139
|
-
ref: (
|
|
140
|
-
|
|
137
|
+
ref: (u) => {
|
|
138
|
+
o === p && (b.current = u), n && !b.current && (b.current = u);
|
|
141
139
|
},
|
|
142
140
|
className: S(`${s}-list-search-item`, {
|
|
143
|
-
[`${s}-list-search-item-active`]:
|
|
144
|
-
[`${s}-list-search-item-hover`]:
|
|
141
|
+
[`${s}-list-search-item-active`]: n,
|
|
142
|
+
[`${s}-list-search-item-hover`]: o === p,
|
|
145
143
|
[`${s}-list-search-item-disabled`]: e.disabled
|
|
146
144
|
}),
|
|
147
|
-
onClick: (
|
|
148
|
-
|
|
145
|
+
onClick: (u) => {
|
|
146
|
+
x(e, !n, u);
|
|
149
147
|
},
|
|
150
148
|
onMouseEnter: () => {
|
|
151
|
-
!
|
|
149
|
+
!k.current && !e.disabled && v(o);
|
|
152
150
|
},
|
|
153
151
|
onMouseLeave: () => {
|
|
154
|
-
!
|
|
152
|
+
!k.current && !e.disabled && v($ ? 0 : -1);
|
|
155
153
|
},
|
|
156
|
-
children: /* @__PURE__ */
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
children: /* @__PURE__ */ f("div", { className: `${s}-list-item-label`, children: E(t.renderOption) ? d : g ? /* @__PURE__ */ f(q, { checked: n, disabled: e.disabled, children: d }) : /* @__PURE__ */ N(C, { children: [
|
|
155
|
+
d,
|
|
156
|
+
n && /* @__PURE__ */ f("span", { className: `${s}-check-icon`, children: _.checked })
|
|
159
157
|
] }) })
|
|
160
158
|
},
|
|
161
|
-
|
|
159
|
+
o
|
|
162
160
|
);
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
|
-
) }) : /* @__PURE__ */
|
|
163
|
+
) }) : /* @__PURE__ */ f(C, { children: y?.() });
|
|
166
164
|
};
|
|
167
165
|
export {
|
|
168
166
|
ke as default,
|