@unicom-cloud/ui 0.8.99 → 0.8.101
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/Anchor.js +3 -1
- package/Badge.js +7 -6
- package/Copy.js +49 -2
- package/Details.js +13 -2
- package/Divider.js +3 -2
- package/Flex.js +22 -0
- package/Grid.js +1 -1
- package/LiquidFill.js +3 -2
- package/Loading.js +16 -3
- package/Marquee.js +3 -2
- package/QrCode.js +3 -2
- package/Space.js +3 -3
- package/Splitter.js +5 -5
- package/SuspenseFallbackTest.js +2 -4
- package/Tag.js +3 -2
- package/Tour.js +3 -2
- package/alert/index.js +61 -64
- package/anchor/index.js +5 -3
- package/back-top/index.js +32 -33
- package/badge/index.js +19 -18
- package/calendar/index.js +85 -84
- package/components/common/development/index.js +44 -29
- package/components/common/empty/index.js +35 -23
- package/components/common/flex/index.js +64 -0
- package/components/common/flex/interface.js +9 -0
- package/components/common/higher-order/with-speech-synthesis/index.js +79 -55
- package/components/common/space/index.js +71 -91
- package/components/common/suspense-fallback-test/index.js +16 -0
- package/components/common/utils/toArray.js +12 -0
- package/copy/index.js +83 -35
- package/details/index.js +102 -62
- package/divider/index.js +27 -21
- package/empty/index.js +13 -13
- package/flex/index.js +47 -0
- package/flex/interface.js +1 -0
- package/grid/{GridItem.js → Item.js} +15 -15
- package/grid/index.js +1 -1
- package/icon/interface.js +1 -0
- package/icon-hover/interface.js +1 -0
- package/index.js +610 -599
- package/input/Button.js +39 -34
- package/input/Textarea.js +108 -104
- package/liquid-fill/index.js +3 -2
- package/loading/index.js +72 -53
- package/loading/interface.js +1 -0
- package/marquee/index.js +3 -2
- package/modal/Modal.js +73 -74
- package/package.json +1 -1
- package/portal/interface.js +1 -0
- package/qr-code/index.js +3 -2
- package/segmented/index.js +113 -105
- package/space/index.js +41 -35
- package/speech-synthesis/interface.js +1 -0
- package/spin/index.js +75 -62
- package/splitter/Panel.js +39 -0
- package/splitter/SplitBar.js +157 -0
- package/splitter/Splitter.js +135 -0
- package/splitter/hooks/useEvent.js +12 -0
- package/splitter/hooks/useItems.js +26 -0
- package/splitter/hooks/useResizable.js +26 -0
- package/splitter/hooks/useResize.js +68 -0
- package/splitter/hooks/useSizes.js +60 -0
- package/splitter/index.js +6 -115
- package/style.css +1 -1
- package/suspense-fallback-test/index.js +2 -11
- package/suspense-fallback-test/interface.js +1 -0
- package/table/Table.js +38 -38
- package/table/hook/useThResizable.js +72 -26
- package/table/tbody/Td.js +80 -77
- package/table/th-resizable/index.js +92 -35
- package/tag/index.js +42 -41
- package/tooltip/index.js +89 -82
- package/tour/index.js +5 -6
- package/trigger/index.js +67 -70
- package/types/common/development/index.d.ts +7 -1
- package/types/common/development/interface.d.ts +22 -0
- package/types/common/empty/index.d.ts +2 -1
- package/types/common/flex/index.d.ts +14 -0
- package/types/common/flex/interface.d.ts +62 -0
- package/types/common/higher-order/with-speech-synthesis/index.d.ts +6 -1
- package/types/common/higher-order/with-speech-synthesis/interface.d.ts +13 -0
- package/types/common/space/index.d.ts +4 -3
- package/types/common/space/interface.d.ts +10 -18
- package/types/common/suspense-fallback-test/index.d.ts +7 -0
- package/types/common/suspense-fallback-test/interface.d.ts +1 -0
- package/types/common/utils/PqbCSSTransition.d.ts +1 -1
- package/types/common/utils/toArray.d.ts +13 -0
- package/types/pc/affix/interface.d.ts +0 -2
- package/types/pc/alert/index.d.ts +3 -2
- package/types/pc/alert/interface.d.ts +7 -1
- package/types/pc/anchor/index.d.ts +2 -1
- package/types/pc/anchor/interface.d.ts +0 -2
- package/types/pc/auto-complete/interface.d.ts +0 -6
- package/types/pc/avatar/interface.d.ts +0 -4
- package/types/pc/badge/Count.d.ts +1 -1
- package/types/pc/breadcrumb/Item.d.ts +1 -1
- package/types/pc/breadcrumb/interface.d.ts +0 -3
- package/types/pc/calendar/Month.d.ts +1 -1
- package/types/pc/calendar/WeekList.d.ts +1 -1
- package/types/pc/calendar/Year.d.ts +1 -1
- package/types/pc/calendar/header/Panel.d.ts +1 -1
- package/types/pc/calendar/header/index.d.ts +1 -1
- package/types/pc/calendar/index.d.ts +1 -1
- package/types/pc/calendar/interface.d.ts +2 -1
- package/types/pc/carousel/interface.d.ts +2 -6
- package/types/pc/cascader/interface.d.ts +7 -19
- package/types/pc/cascader/panel/List.d.ts +1 -1
- package/types/pc/cascader/panel/Option.d.ts +1 -1
- package/types/pc/cascader/panel/Search.d.ts +1 -1
- package/types/pc/checkbox/Group.d.ts +2 -2
- package/types/pc/checkbox/GroupBlock.d.ts +1 -1
- package/types/pc/checkbox/IconCheck.d.ts +1 -1
- package/types/pc/checkbox/interface.d.ts +0 -1
- package/types/pc/collapse/interface.d.ts +0 -2
- package/types/pc/color-picker/InputRgb.d.ts +1 -1
- package/types/pc/color-picker/Palette.d.ts +1 -1
- package/types/pc/color-picker/interface.d.ts +0 -2
- package/types/pc/config-provider/ConfigProvider.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +17 -17
- package/types/pc/copy/index.d.ts +1 -1
- package/types/pc/copy/interface.d.ts +2 -1
- package/types/pc/date-picker/interface.d.ts +0 -17
- package/types/pc/date-picker/panel/Body.d.ts +1 -1
- package/types/pc/date-picker/panel/Footer.d.ts +1 -1
- package/types/pc/date-picker/panel/Header.d.ts +1 -1
- package/types/pc/date-picker/panel/WeekList.d.ts +1 -1
- package/types/pc/date-picker/panel/date/index.d.ts +1 -1
- package/types/pc/date-picker/panel/month/index.d.ts +1 -1
- package/types/pc/date-picker/panel/quarter/index.d.ts +1 -1
- package/types/pc/date-picker/panel/range/index.d.ts +1 -1
- package/types/pc/date-picker/panel/week/index.d.ts +1 -1
- package/types/pc/date-picker/panel/year/index.d.ts +1 -1
- package/types/pc/descriptions/index.d.ts +1 -1
- package/types/pc/descriptions/interface.d.ts +0 -1
- package/types/pc/details/index.d.ts +3 -2
- package/types/pc/details/interface.d.ts +16 -0
- package/types/pc/development/index.d.ts +2 -1
- package/types/pc/development/interface.d.ts +15 -0
- package/types/pc/divider/index.d.ts +7 -2
- package/types/pc/draggable/Item.d.ts +1 -1
- package/types/pc/draggable/index.d.ts +1 -1
- package/types/pc/drawer/interface.d.ts +0 -7
- package/types/pc/dropdown/interface.d.ts +0 -1
- package/types/pc/flex/index.d.ts +9 -0
- package/types/pc/flex/interface.d.ts +16 -0
- package/types/pc/form/Control.d.ts +1 -1
- package/types/pc/form/FormList.d.ts +1 -1
- package/types/pc/form/IconSymbol.d.ts +1 -1
- package/types/pc/form/interface.d.ts +9 -22
- package/types/pc/form/util.d.ts +1 -1
- package/types/pc/grid/index.d.ts +3 -3
- package/types/pc/grid/interface.d.ts +1 -6
- package/types/pc/icon/addFromIconFontCn.d.ts +1 -7
- package/types/pc/icon/index.d.ts +2 -7
- package/types/pc/icon/interface.d.ts +13 -0
- package/types/pc/icon-hover/index.d.ts +2 -8
- package/types/pc/icon-hover/interface.d.ts +8 -0
- package/types/pc/image/ImageFooter.d.ts +1 -1
- package/types/pc/image/ImagePreviewArrow.d.ts +1 -1
- package/types/pc/image/TriggerForToolbar.d.ts +1 -1
- package/types/pc/image/interface.d.ts +0 -13
- package/types/pc/index.d.ts +63 -50
- package/types/pc/input/Textarea.d.ts +2 -6
- package/types/pc/input/interface.d.ts +5 -13
- package/types/pc/input-number/interface.d.ts +0 -4
- package/types/pc/input-tag/interface.d.ts +0 -13
- package/types/pc/layout/interface.d.ts +0 -1
- package/types/pc/link/interface.d.ts +0 -1
- package/types/pc/list/interface.d.ts +0 -4
- package/types/pc/loading/index.d.ts +4 -3
- package/types/pc/loading/interface.d.ts +6 -0
- package/types/pc/menu/Indent.d.ts +1 -1
- package/types/pc/menu/OverflowWrap.d.ts +1 -1
- package/types/pc/menu/interface.d.ts +0 -8
- package/types/pc/menu/sub-menu/Inline.d.ts +1 -1
- package/types/pc/menu/sub-menu/Pop.d.ts +1 -1
- package/types/pc/message/interface.d.ts +0 -2
- package/types/pc/modal/interface.d.ts +0 -5
- package/types/pc/notification/interface.d.ts +0 -1
- package/types/pc/overflow-ellipsis/OverflowItem.d.ts +1 -1
- package/types/pc/overflow-ellipsis/index.d.ts +1 -1
- package/types/pc/pagination/PageItem.d.ts +3 -3
- package/types/pc/pagination/PageJumper.d.ts +1 -1
- package/types/pc/pagination/PageOption.d.ts +1 -1
- package/types/pc/pagination/interface.d.ts +0 -2
- package/types/pc/popconfirm/interface.d.ts +8 -10
- package/types/pc/popover/interface.d.ts +0 -1
- package/types/pc/portal/Portal.d.ts +2 -6
- package/types/pc/portal/index.d.ts +2 -9
- package/types/pc/portal/interface.d.ts +14 -0
- package/types/pc/progress/CircleProgress.d.ts +1 -1
- package/types/pc/progress/LineProgess.d.ts +1 -1
- package/types/pc/progress/StepProgress.d.ts +1 -1
- package/types/pc/progress/interface.d.ts +0 -3
- package/types/pc/radio/Group.d.ts +2 -2
- package/types/pc/radio/GroupBlock.d.ts +1 -1
- package/types/pc/radio/Radio.d.ts +1 -1
- package/types/pc/resize-box/ResizeTrigger.d.ts +1 -1
- package/types/pc/resize-box/interface.d.ts +1 -7
- package/types/pc/result/403.d.ts +1 -1
- package/types/pc/result/404.d.ts +1 -1
- package/types/pc/result/500.d.ts +1 -1
- package/types/pc/segmented/interface.d.ts +6 -6
- package/types/pc/select/interface.d.ts +0 -12
- package/types/pc/select-view/interface.d.ts +0 -7
- package/types/pc/skeleton/Image.d.ts +1 -1
- package/types/pc/skeleton/Text.d.ts +2 -1
- package/types/pc/slider/Button.d.ts +1 -1
- package/types/pc/slider/Input.d.ts +1 -1
- package/types/pc/slider/Tick.d.ts +1 -1
- package/types/pc/slider/interface.d.ts +0 -4
- package/types/pc/space/index.d.ts +7 -5
- package/types/pc/speech-synthesis/index.d.ts +3 -1
- package/types/pc/speech-synthesis/interface.d.ts +7 -0
- package/types/pc/spin/DotLoading.d.ts +1 -1
- package/types/pc/spin/interface.d.ts +4 -1
- package/types/pc/splitter/Panel.d.ts +8 -0
- package/types/pc/splitter/SplitBar.d.ts +21 -0
- package/types/pc/splitter/Splitter.d.ts +4 -0
- package/types/pc/splitter/hooks/useEvent.d.ts +3 -0
- package/types/pc/splitter/hooks/useItems.d.ts +10 -0
- package/types/pc/splitter/hooks/useResizable.d.ts +8 -0
- package/types/pc/splitter/hooks/useResize.d.ts +4 -0
- package/types/pc/splitter/hooks/useSizes.d.ts +5 -0
- package/types/pc/splitter/index.d.ts +8 -3
- package/types/pc/splitter/interface.d.ts +181 -38
- package/types/pc/statistic/interface.d.ts +0 -4
- package/types/pc/steps/interface.d.ts +0 -3
- package/types/pc/suspense-fallback-test/index.d.ts +2 -3
- package/types/pc/suspense-fallback-test/interface.d.ts +2 -0
- package/types/pc/table/ColGroup.d.ts +1 -1
- package/types/pc/table/hook/useThResizable.d.ts +2 -2
- package/types/pc/table/interface.d.ts +4 -15
- package/types/pc/table/summary/Cell.d.ts +1 -1
- package/types/pc/table/summary/Row.d.ts +1 -1
- package/types/pc/table/tbody/Td.d.ts +1 -1
- package/types/pc/table/tbody/index.d.ts +1 -1
- package/types/pc/table/tfoot/index.d.ts +1 -1
- package/types/pc/table/th-resizable/index.d.ts +1 -1
- package/types/pc/table/thead/Column.d.ts +1 -1
- package/types/pc/table/thead/index.d.ts +1 -1
- package/types/pc/tabs/TabContent.d.ts +1 -1
- package/types/pc/tabs/interface.d.ts +0 -7
- package/types/pc/tabs/tab-header/DropdownIcon.d.ts +1 -1
- package/types/pc/tabs/tab-header/TabInk.d.ts +1 -1
- package/types/pc/tabs/tab-header/TabNavIcon.d.ts +1 -1
- package/types/pc/tag/index.d.ts +2 -0
- package/types/pc/tag/interface.d.ts +0 -1
- package/types/pc/time-picker/Picker.d.ts +1 -1
- package/types/pc/time-picker/RangePicker.d.ts +1 -1
- package/types/pc/time-picker/TimeColumn.d.ts +1 -1
- package/types/pc/time-picker/TimePicker.d.ts +1 -1
- package/types/pc/time-picker/index.d.ts +1 -1
- package/types/pc/time-picker/interface.d.ts +0 -7
- package/types/pc/tooltip/interface.d.ts +4 -1
- package/types/pc/transfer/Item.d.ts +1 -1
- package/types/pc/transfer/List.d.ts +1 -1
- package/types/pc/transfer/interface.d.ts +2 -9
- package/types/pc/tree/Animation.d.ts +1 -1
- package/types/pc/tree/interface.d.ts +2 -8
- package/types/pc/tree-select/interface.d.ts +0 -8
- package/types/pc/trigger/interface.d.ts +0 -5
- package/types/pc/typography/EditContent.d.ts +2 -1
- package/types/pc/typography/Operations.d.ts +1 -1
- package/types/pc/typography/interface.d.ts +45 -30
- package/types/pc/upload/interface.d.ts +6 -11
- package/types/pc/upload/list/index.d.ts +1 -1
- package/types/pc/utils/index.d.ts +1 -0
- package/types/pc/utils/names.d.ts +6 -0
- package/types/pc/utils/toArray.d.ts +3 -0
- package/types/pc/verification-code/VerificationCode.d.ts +1 -1
- package/types/pc/verification-code/interface.d.ts +0 -2
- package/types/pc/virtual-list/VirtualList.d.ts +2 -38
- package/types/pc/virtual-list/index.d.ts +2 -1
- package/types/pc/virtual-list/interface.d.ts +56 -0
- package/types/pc/watermark/Watermark.d.ts +1 -1
- package/types/pc/watermark/interface.d.ts +0 -2
- package/typography/Base.js +73 -73
- package/typography/EditContent.js +43 -33
- package/typography/Ellipsis.js +117 -184
- package/typography/Operations.js +97 -49
- package/typography/useCssEllipsis.js +7 -6
- package/utils/index.js +117 -115
- package/utils/names.js +4 -0
- package/utils/toArray.js +5 -0
- package/version/index.js +1 -1
- package/virtual-list/interface.js +1 -0
- package/components/common/space/toArray.js +0 -11
- package/loading/style/index.module.less.js +0 -4
- package/types/common/space/toArray.d.ts +0 -3
- package/types/pc/suspense-fallback-test/style/index.d.ts +0 -1
- /package/{suspense-fallback-test/style/index.less.js → development/interface.js} +0 -0
- /package/types/pc/grid/{GridItem.d.ts → Item.d.ts} +0 -0
package/segmented/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as D, jsx as w, Fragment as te } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ne, useContext as re, useMemo as oe, useState as P, useRef as N, useCallback as se, useEffect as A } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { resizeObserver as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
4
|
+
import ae from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import j from "@unicom-cloud/utils/class-name";
|
|
6
|
+
import { resizeObserver as ie } from "../components/common/utils/resizeObserver.js";
|
|
7
|
+
import le from "../config-provider/context.js";
|
|
8
|
+
const ce = {
|
|
9
9
|
options: [],
|
|
10
10
|
size: "medium",
|
|
11
11
|
mode: "default",
|
|
@@ -14,56 +14,56 @@ const re = {
|
|
|
14
14
|
direction: "horizontal",
|
|
15
15
|
showIndicator: !0,
|
|
16
16
|
animationDuration: 300
|
|
17
|
-
},
|
|
18
|
-
(
|
|
19
|
-
const { getPrefixCls:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
}, ue = ne(
|
|
18
|
+
(B, d) => {
|
|
19
|
+
const { getPrefixCls: E, componentConfig: M, rtl: K } = re(le), L = ae(
|
|
20
|
+
B,
|
|
21
|
+
ce,
|
|
22
|
+
M?.Segmented
|
|
23
23
|
), {
|
|
24
|
-
style:
|
|
25
|
-
className:
|
|
26
|
-
options:
|
|
27
|
-
defaultValue:
|
|
28
|
-
value:
|
|
29
|
-
size:
|
|
30
|
-
mode:
|
|
31
|
-
disabled:
|
|
32
|
-
block:
|
|
33
|
-
direction:
|
|
34
|
-
showIndicator:
|
|
35
|
-
animationDuration:
|
|
36
|
-
name:
|
|
37
|
-
onChange:
|
|
38
|
-
...
|
|
39
|
-
} =
|
|
24
|
+
style: U,
|
|
25
|
+
className: F,
|
|
26
|
+
options: O = [],
|
|
27
|
+
defaultValue: y,
|
|
28
|
+
value: R,
|
|
29
|
+
size: H,
|
|
30
|
+
mode: v,
|
|
31
|
+
disabled: f,
|
|
32
|
+
block: _,
|
|
33
|
+
direction: p,
|
|
34
|
+
showIndicator: $,
|
|
35
|
+
animationDuration: q,
|
|
36
|
+
name: x,
|
|
37
|
+
onChange: C,
|
|
38
|
+
...G
|
|
39
|
+
} = L, s = oe(() => O.map((e) => typeof e == "string" ? { value: e, label: e } : e), [O]), [J, S] = P(() => y && s.some((e) => e.value === y) ? y : s[0]?.value || ""), [Q, m] = P({}), c = N(null), k = N([]), V = N(!1), r = E?.("segmented"), T = j(
|
|
40
40
|
r,
|
|
41
41
|
{
|
|
42
|
-
[`${r}-block`]:
|
|
43
|
-
[`${r}-disabled`]:
|
|
44
|
-
[`${r}-rtl`]:
|
|
45
|
-
[`${r}-${
|
|
46
|
-
[`${r}-${
|
|
42
|
+
[`${r}-block`]: _,
|
|
43
|
+
[`${r}-disabled`]: f,
|
|
44
|
+
[`${r}-rtl`]: K,
|
|
45
|
+
[`${r}-${v}`]: v,
|
|
46
|
+
[`${r}-${p}`]: p
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
),
|
|
50
|
-
if (
|
|
51
|
-
m((
|
|
48
|
+
F
|
|
49
|
+
), h = R !== void 0, i = h ? R : J, b = se(() => {
|
|
50
|
+
if (!$ || !c.current) {
|
|
51
|
+
m((a) => ({ ...a, opacity: 0 }));
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const e =
|
|
55
|
-
(
|
|
54
|
+
const e = s.findIndex(
|
|
55
|
+
(a) => a?.value === i
|
|
56
56
|
);
|
|
57
57
|
if (e === -1) {
|
|
58
|
-
m((
|
|
58
|
+
m((a) => ({ ...a, opacity: 0 }));
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
m((
|
|
61
|
+
const o = k.current[e];
|
|
62
|
+
if (!o) {
|
|
63
|
+
m((a) => ({ ...a, opacity: 0 }));
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
const n = c.current.getBoundingClientRect(), t =
|
|
66
|
+
const n = c.current.getBoundingClientRect(), t = o.getBoundingClientRect(), l = p === "vertical" ? {
|
|
67
67
|
width: t.width,
|
|
68
68
|
// 垂直模式下宽度撑满
|
|
69
69
|
top: t.top - n.top,
|
|
@@ -78,21 +78,21 @@ const re = {
|
|
|
78
78
|
...l,
|
|
79
79
|
opacity: 1
|
|
80
80
|
});
|
|
81
|
-
}, [i,
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
if (
|
|
85
|
-
const n =
|
|
81
|
+
}, [i, s, $, p]), z = (e, o) => {
|
|
82
|
+
o || f || (h || S(e), C?.(e));
|
|
83
|
+
}, W = (e, o) => {
|
|
84
|
+
if (f) return;
|
|
85
|
+
const n = s.length;
|
|
86
86
|
if (n === 0) return;
|
|
87
|
-
let t =
|
|
87
|
+
let t = o;
|
|
88
88
|
switch (e.key) {
|
|
89
89
|
case "ArrowLeft":
|
|
90
90
|
case "ArrowUp":
|
|
91
|
-
e.preventDefault(), t = (
|
|
91
|
+
e.preventDefault(), t = (o - 1 + n) % n;
|
|
92
92
|
break;
|
|
93
93
|
case "ArrowRight":
|
|
94
94
|
case "ArrowDown":
|
|
95
|
-
e.preventDefault(), t = (
|
|
95
|
+
e.preventDefault(), t = (o + 1) % n;
|
|
96
96
|
break;
|
|
97
97
|
case "Home":
|
|
98
98
|
e.preventDefault(), t = 0;
|
|
@@ -103,86 +103,94 @@ const re = {
|
|
|
103
103
|
default:
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
for (; t !==
|
|
106
|
+
for (; t !== o && s[t]?.disabled; )
|
|
107
107
|
t = (t + (e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1) + n) % n;
|
|
108
|
-
const l =
|
|
109
|
-
l && l !== i && (
|
|
108
|
+
const l = s[t]?.value;
|
|
109
|
+
l && l !== i && (z(l), k.current[t]?.focus());
|
|
110
110
|
};
|
|
111
|
-
|
|
112
|
-
if (!
|
|
113
|
-
|
|
111
|
+
A(() => {
|
|
112
|
+
if (!V.current) {
|
|
113
|
+
V.current = !0;
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (!
|
|
117
|
-
const e =
|
|
118
|
-
|
|
116
|
+
if (!s.some((e) => e.value === i)) {
|
|
117
|
+
const e = s[0]?.value || "";
|
|
118
|
+
h || S(e), C?.(e);
|
|
119
119
|
}
|
|
120
|
-
}, [
|
|
121
|
-
|
|
122
|
-
}, [i,
|
|
120
|
+
}, [s, i, h, C]), A(() => {
|
|
121
|
+
b();
|
|
122
|
+
}, [i, s, b]), A(() => {
|
|
123
123
|
if (!c.current) return;
|
|
124
|
-
const e =
|
|
124
|
+
const e = ie(
|
|
125
125
|
[c.current],
|
|
126
126
|
() => {
|
|
127
|
-
|
|
127
|
+
b();
|
|
128
128
|
}
|
|
129
129
|
);
|
|
130
130
|
return () => {
|
|
131
131
|
e();
|
|
132
132
|
};
|
|
133
|
-
}, [
|
|
134
|
-
const
|
|
133
|
+
}, [b]);
|
|
134
|
+
const X = (e, o) => {
|
|
135
135
|
if (e.render)
|
|
136
|
-
return e.render(e,
|
|
136
|
+
return e.render(e, o);
|
|
137
137
|
const n = !e.label && !!e.icon;
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
e.icon && /* @__PURE__ */
|
|
140
|
-
!n && e.label && /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ D(te, { children: [
|
|
139
|
+
e.icon && /* @__PURE__ */ w("span", { className: `${r}-option-icon`, children: e.icon }),
|
|
140
|
+
!n && e.label && /* @__PURE__ */ w("span", { className: `${r}-option-label`, children: e.label })
|
|
141
141
|
] });
|
|
142
142
|
};
|
|
143
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ D(
|
|
144
144
|
"div",
|
|
145
145
|
{
|
|
146
146
|
ref: (e) => {
|
|
147
|
-
typeof
|
|
147
|
+
typeof d == "function" ? d(e) : d && (d.current = e), c.current = e;
|
|
148
148
|
},
|
|
149
|
-
...
|
|
150
|
-
style:
|
|
151
|
-
className:
|
|
149
|
+
...G,
|
|
150
|
+
style: U,
|
|
151
|
+
className: T,
|
|
152
152
|
role: "radiogroup",
|
|
153
153
|
children: [
|
|
154
|
-
!Array.isArray(
|
|
154
|
+
!Array.isArray(s) || s.length === 0 ? null : s.map((e, o) => {
|
|
155
155
|
if (!e) return null;
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
const {
|
|
157
|
+
value: n,
|
|
158
|
+
label: t,
|
|
159
|
+
disabled: l,
|
|
160
|
+
icon: a,
|
|
161
|
+
render: fe,
|
|
162
|
+
...Y
|
|
163
|
+
} = e, u = n === i, g = l || f, Z = !t && !!a, ee = [t, n, o].filter(Boolean).join("-");
|
|
164
|
+
return /* @__PURE__ */ D(
|
|
158
165
|
"button",
|
|
159
166
|
{
|
|
160
|
-
ref: (
|
|
161
|
-
className:
|
|
167
|
+
ref: (I) => k.current[o] = I,
|
|
168
|
+
className: j(
|
|
162
169
|
`${r}-option`,
|
|
163
|
-
`${r}-option-${
|
|
164
|
-
`${r}-option-${
|
|
170
|
+
`${r}-option-${H}`,
|
|
171
|
+
`${r}-option-${v}`,
|
|
165
172
|
{
|
|
166
|
-
[`${r}-option-active`]:
|
|
167
|
-
[`${r}-option-disabled`]:
|
|
168
|
-
[`${r}-option-icon-only`]:
|
|
173
|
+
[`${r}-option-active`]: u,
|
|
174
|
+
[`${r}-option-disabled`]: g,
|
|
175
|
+
[`${r}-option-icon-only`]: Z
|
|
169
176
|
}
|
|
170
177
|
),
|
|
171
|
-
onClick: () =>
|
|
172
|
-
onKeyDown: (
|
|
173
|
-
disabled:
|
|
178
|
+
onClick: () => z(n, g),
|
|
179
|
+
onKeyDown: (I) => W(I, o),
|
|
180
|
+
disabled: g,
|
|
174
181
|
role: "radio",
|
|
175
|
-
"aria-checked":
|
|
176
|
-
"aria-disabled":
|
|
177
|
-
tabIndex:
|
|
182
|
+
"aria-checked": u,
|
|
183
|
+
"aria-disabled": g,
|
|
184
|
+
tabIndex: u ? 0 : -1,
|
|
185
|
+
...Y,
|
|
178
186
|
children: [
|
|
179
|
-
|
|
187
|
+
x && /* @__PURE__ */ w(
|
|
180
188
|
"input",
|
|
181
189
|
{
|
|
182
190
|
type: "radio",
|
|
183
|
-
name:
|
|
184
|
-
value:
|
|
185
|
-
checked:
|
|
191
|
+
name: x,
|
|
192
|
+
value: n,
|
|
193
|
+
checked: u,
|
|
186
194
|
onChange: () => {
|
|
187
195
|
},
|
|
188
196
|
className: `${r}-input`,
|
|
@@ -190,19 +198,19 @@ const re = {
|
|
|
190
198
|
"aria-hidden": "true"
|
|
191
199
|
}
|
|
192
200
|
),
|
|
193
|
-
|
|
201
|
+
X(e, u)
|
|
194
202
|
]
|
|
195
203
|
},
|
|
196
|
-
|
|
204
|
+
ee
|
|
197
205
|
);
|
|
198
206
|
}),
|
|
199
|
-
|
|
207
|
+
$ && /* @__PURE__ */ w(
|
|
200
208
|
"div",
|
|
201
209
|
{
|
|
202
210
|
className: `${r}-indicator`,
|
|
203
211
|
style: {
|
|
204
|
-
...
|
|
205
|
-
transitionDuration: `${
|
|
212
|
+
...Q,
|
|
213
|
+
transitionDuration: `${q}ms`
|
|
206
214
|
}
|
|
207
215
|
}
|
|
208
216
|
)
|
|
@@ -211,7 +219,7 @@ const re = {
|
|
|
211
219
|
);
|
|
212
220
|
}
|
|
213
221
|
);
|
|
214
|
-
|
|
222
|
+
ue.displayName = "Segmented";
|
|
215
223
|
export {
|
|
216
|
-
|
|
224
|
+
ue as default
|
|
217
225
|
};
|
package/space/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as s, useContext as S } from "react";
|
|
3
|
+
import x from "../components/common/space/index.js";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
5
|
import "lodash/isEqualWith";
|
|
6
6
|
import "../components/common/utils/is.js";
|
|
@@ -13,39 +13,45 @@ import N from "../components/common/hooks/useMergeProps.js";
|
|
|
13
13
|
import "../components/common/utils/reactDOM.js";
|
|
14
14
|
import "@unicom-cloud/utils/constant";
|
|
15
15
|
import "lodash/debounce";
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
const
|
|
16
|
+
import g from "@unicom-cloud/utils/class-name";
|
|
17
|
+
import u from "../config-provider/context.js";
|
|
18
|
+
const $ = {
|
|
19
19
|
size: "small",
|
|
20
20
|
direction: "horizontal"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
}, i = s(
|
|
22
|
+
(o, t) => {
|
|
23
|
+
const { getPrefixCls: c, componentConfig: n, rtl: l } = S(u), f = N(
|
|
24
|
+
o,
|
|
25
|
+
$,
|
|
26
|
+
n?.Space
|
|
27
|
+
), { className: d, direction: r = "horizontal", wrap: p, ...C } = f, e = c?.("space");
|
|
28
|
+
return /* @__PURE__ */ a(
|
|
29
|
+
x,
|
|
30
|
+
{
|
|
31
|
+
ref: t,
|
|
32
|
+
className: g(
|
|
33
|
+
e,
|
|
34
|
+
{
|
|
35
|
+
[`${e}-wrap`]: p,
|
|
36
|
+
[`${e}-${r}`]: r
|
|
37
|
+
},
|
|
38
|
+
d
|
|
39
|
+
),
|
|
40
|
+
direction: r,
|
|
41
|
+
wrap: p,
|
|
42
|
+
rtl: l,
|
|
43
|
+
...C
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
i.displayName = "Space";
|
|
49
|
+
const m = s((o, t) => /* @__PURE__ */ a(i, { ref: t, direction: "vertical", ...o }));
|
|
50
|
+
m.displayName = "SpaceVertical";
|
|
51
|
+
const E = Object.assign(i, {
|
|
52
|
+
Vertical: m
|
|
53
|
+
});
|
|
48
54
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
m as SpaceVertical,
|
|
56
|
+
E as default
|
|
51
57
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/spin/index.js
CHANGED
|
@@ -1,80 +1,93 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as n, jsxs as $, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import w from "@unicom-cloud/icons/IconUiLoading";
|
|
3
|
+
import P from "lodash/debounce";
|
|
4
|
+
import y, { useContext as _, useState as D, useCallback as F, useRef as H, useImperativeHandle as M, useEffect as U } from "react";
|
|
5
5
|
import "../config-provider/ConfigProvider.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { isEmptyReactNode as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
function
|
|
12
|
-
const { getPrefixCls:
|
|
13
|
-
style:
|
|
14
|
-
className:
|
|
15
|
-
children:
|
|
6
|
+
import q from "../components/common/hooks/useMergeProps.js";
|
|
7
|
+
import a from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import { isEmptyReactNode as A } from "../components/common/utils/is.js";
|
|
9
|
+
import B from "./DotLoading.js";
|
|
10
|
+
import G from "../config-provider/context.js";
|
|
11
|
+
function J(S, C) {
|
|
12
|
+
const { getPrefixCls: x, componentConfig: v } = _(G), L = q(S, {}, v?.Spin), {
|
|
13
|
+
style: b,
|
|
14
|
+
className: z,
|
|
15
|
+
children: r,
|
|
16
16
|
loading: s,
|
|
17
|
-
size:
|
|
18
|
-
icon:
|
|
19
|
-
element:
|
|
20
|
-
tip:
|
|
21
|
-
dot:
|
|
17
|
+
size: o,
|
|
18
|
+
icon: f,
|
|
19
|
+
element: R,
|
|
20
|
+
tip: c,
|
|
21
|
+
dot: k,
|
|
22
22
|
delay: i,
|
|
23
|
-
block:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
F(
|
|
23
|
+
block: E = !1,
|
|
24
|
+
fullscreen: p,
|
|
25
|
+
...I
|
|
26
|
+
} = L, [u, g] = D(i ? !1 : s), l = F(P(g, i), [i]), d = i ? u : s, e = x?.("spin"), N = H(null);
|
|
27
|
+
M(C, () => ({
|
|
27
28
|
// 潘启宝添加于 2023年10月23日 星期一 10时52分55秒 CST
|
|
28
|
-
dom:
|
|
29
|
-
loading:
|
|
30
|
-
setLoading:
|
|
31
|
-
debouncedSetLoading:
|
|
32
|
-
})),
|
|
33
|
-
|
|
29
|
+
dom: N.current,
|
|
30
|
+
loading: u,
|
|
31
|
+
setLoading: g,
|
|
32
|
+
debouncedSetLoading: l
|
|
33
|
+
})), U(() => (i && l(s), () => {
|
|
34
|
+
l && l.cancel();
|
|
34
35
|
}), [s]);
|
|
35
|
-
const
|
|
36
|
-
className:
|
|
36
|
+
const j = /* @__PURE__ */ n("span", { className: `${e}-icon`, children: f ? y.cloneElement(f, {
|
|
37
|
+
className: a(`${e.replace("-spin", "-icon")}-loading`),
|
|
37
38
|
style: {
|
|
38
|
-
fontSize:
|
|
39
|
+
fontSize: o
|
|
39
40
|
}
|
|
40
|
-
}) :
|
|
41
|
-
|
|
41
|
+
}) : R || (k ? /* @__PURE__ */ n(B, { size: o }) : /* @__PURE__ */ n(w, { style: { fontSize: o } })) }), m = /* @__PURE__ */ $(h, { children: [
|
|
42
|
+
j,
|
|
43
|
+
c ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: c }) : null
|
|
44
|
+
] });
|
|
45
|
+
let t;
|
|
46
|
+
return A(r) ? p ? d && (t = /* @__PURE__ */ n(
|
|
42
47
|
"div",
|
|
43
48
|
{
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
className: a(
|
|
50
|
+
`${e}-loading-layer`,
|
|
51
|
+
`${e}-fullscreen`
|
|
52
|
+
),
|
|
53
|
+
style: { fontSize: o },
|
|
54
|
+
children: m
|
|
55
|
+
}
|
|
56
|
+
)) : t = m : t = /* @__PURE__ */ $(h, { children: [
|
|
57
|
+
/* @__PURE__ */ n("div", { className: `${e}-children`, children: r }),
|
|
58
|
+
d && /* @__PURE__ */ n(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: a(
|
|
62
|
+
`${e}-loading-layer`,
|
|
63
|
+
p && `${e}-fullscreen`
|
|
64
|
+
// 潘启宝添加
|
|
65
|
+
),
|
|
66
|
+
style: { fontSize: o },
|
|
67
|
+
children: /* @__PURE__ */ n("span", { className: `${e}-loading-layer-inner`, children: m })
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
] }), /* @__PURE__ */ n(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
ref: N,
|
|
74
|
+
className: a(
|
|
46
75
|
e,
|
|
47
76
|
{
|
|
48
|
-
[`${e}-block`]:
|
|
49
|
-
[`${e}-loading`]:
|
|
50
|
-
[`${e}-with-tip`]:
|
|
77
|
+
[`${e}-block`]: E,
|
|
78
|
+
[`${e}-loading`]: d,
|
|
79
|
+
[`${e}-with-tip`]: c && !r
|
|
51
80
|
},
|
|
52
|
-
|
|
81
|
+
z
|
|
53
82
|
),
|
|
54
|
-
style:
|
|
55
|
-
...
|
|
56
|
-
children:
|
|
57
|
-
g,
|
|
58
|
-
o ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: o }) : null
|
|
59
|
-
] }) : /* @__PURE__ */ r(u, { children: [
|
|
60
|
-
/* @__PURE__ */ n("div", { className: `${e}-children`, children: l }),
|
|
61
|
-
p && /* @__PURE__ */ n(
|
|
62
|
-
"div",
|
|
63
|
-
{
|
|
64
|
-
className: `${e}-loading-layer`,
|
|
65
|
-
style: { fontSize: t },
|
|
66
|
-
children: /* @__PURE__ */ r("span", { className: `${e}-loading-layer-inner`, children: [
|
|
67
|
-
g,
|
|
68
|
-
o ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: o }) : null
|
|
69
|
-
] })
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] })
|
|
83
|
+
style: b,
|
|
84
|
+
...I,
|
|
85
|
+
children: t
|
|
73
86
|
}
|
|
74
87
|
);
|
|
75
88
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
89
|
+
const K = y.forwardRef(J);
|
|
90
|
+
K.displayName = "Spin";
|
|
78
91
|
export {
|
|
79
|
-
|
|
92
|
+
K as default
|
|
80
93
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import p, { forwardRef as x } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
4
|
+
import d from "@unicom-cloud/utils/class-name";
|
|
5
|
+
import C from "../config-provider/context.js";
|
|
6
|
+
const N = x((t, a) => {
|
|
7
|
+
const { getPrefixCls: l } = p.useContext(C), {
|
|
8
|
+
prefixCls: n,
|
|
9
|
+
className: r,
|
|
10
|
+
children: i,
|
|
11
|
+
size: e,
|
|
12
|
+
style: c = {}
|
|
13
|
+
} = t, s = l?.("panel", n), m = d(
|
|
14
|
+
s,
|
|
15
|
+
{
|
|
16
|
+
[`${s}-hidden`]: e === 0
|
|
17
|
+
},
|
|
18
|
+
r
|
|
19
|
+
), o = e !== void 0;
|
|
20
|
+
return /* @__PURE__ */ f(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
ref: a,
|
|
24
|
+
className: m,
|
|
25
|
+
style: {
|
|
26
|
+
...c,
|
|
27
|
+
flexBasis: o ? e : "auto",
|
|
28
|
+
flexGrow: o ? 0 : 1
|
|
29
|
+
},
|
|
30
|
+
children: i
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
process.env.NODE_ENV !== "production" && (N.displayName = "Panel");
|
|
35
|
+
const z = () => null;
|
|
36
|
+
export {
|
|
37
|
+
N as InternalPanel,
|
|
38
|
+
z as default
|
|
39
|
+
};
|