@unicom-cloud/ui 0.8.100 → 0.8.102
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/Badge.js +7 -54
- package/Copy.js +5 -4
- package/Details.js +13 -2
- package/Divider.js +3 -2
- package/Flex.js +14 -4
- package/LiquidFill.js +5 -4
- package/List.js +1 -1
- package/Loading.js +16 -3
- package/Marquee.js +5 -4
- package/QrCode.js +5 -4
- package/Space.js +3 -3
- package/Splitter.js +4 -3
- package/SuspenseFallbackTest.js +2 -4
- package/Tooltip.js +3 -4
- package/Tour.js +5 -4
- package/alert/index.js +60 -62
- package/anchor/Anchor.js +12 -12
- package/anchor/util.js +10 -10
- package/back-top/index.js +33 -34
- package/badge/index.js +109 -162
- package/calendar/index.js +85 -84
- package/card/index.js +63 -43
- package/color-picker/InputHex.js +3 -4
- package/color-picker/InputRgb.js +7 -8
- package/color-picker/Palette.js +3 -4
- package/color-picker/Panel.js +3 -4
- package/color-picker/colors.js +5 -5
- package/color-picker/hooks/useColorPicker.js +3 -4
- package/color-picker/utils.js +14 -15
- 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/PqbCSSTransition.js +1 -1
- package/components/common/utils/constant.js +6 -3
- package/components/common/utils/reactDOM.js +6 -4
- package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
- package/components/common/utils/setPrimaryColor.js +18 -18
- package/components/common/utils/setTheme.js +8 -9
- package/components/common/utils/toArray.js +12 -0
- package/copy/index.js +3 -2
- package/details/index.js +102 -62
- package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
- package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
- package/dist/scroll-into-view-if-needed/src/index.js +19 -19
- package/divider/index.js +27 -21
- package/empty/index.js +13 -13
- package/flex/index.js +43 -55
- package/flex/interface.js +1 -34
- package/form/FormItem.js +69 -65
- package/form/context.js +6 -7
- package/grid/Col-.js +86 -0
- package/grid/Col.js +156 -73
- package/grid/Grid.js +71 -67
- package/grid/Row.js +3 -3
- package/grid/index.js +13 -13
- package/icon/interface.js +1 -0
- package/icon-hover/interface.js +1 -0
- package/index.js +641 -663
- package/input/Textarea.js +1 -1
- package/input/autoSizeTextAreaHeight.js +7 -7
- package/liquid-fill/index.js +5 -4
- package/list/index.js +1 -1
- package/loading/index.js +72 -53
- package/loading/interface.js +1 -0
- package/marquee/index.js +5 -4
- package/menu/Item.js +9 -9
- package/modal/Modal.js +73 -74
- package/package.json +1 -1
- package/portal/interface.js +1 -0
- package/qr-code/index.js +5 -4
- package/segmented/index.js +47 -47
- package/space/index.js +41 -35
- package/speech-synthesis/interface.js +1 -0
- package/splitter/SplitBar.js +81 -79
- package/splitter/Splitter.js +92 -104
- package/splitter/hooks/useItems.js +1 -1
- package/splitter/hooks/useResizable.js +9 -18
- package/splitter/hooks/useResize.js +10 -10
- package/splitter/hooks/useSizes.js +28 -28
- package/splitter/index.js +5 -4
- package/statistic/index.js +10 -10
- 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 +376 -377
- package/table/hook/useThResizable.js +5 -4
- package/table/th-resizable/index.js +12 -11
- package/time-picker/util.js +8 -8
- package/tooltip/index.js +1 -2
- package/tour/index.js +5 -4
- package/tree/NodeList.js +1 -1
- 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 -4
- 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/constant.d.ts +1 -0
- package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
- package/types/common/utils/toArray.d.ts +13 -0
- package/types/common/utils/tree.d.ts +1 -0
- package/types/common/utils/tween.d.ts +1 -0
- package/types/pc/alert/index.d.ts +2 -1
- package/types/pc/alert/interface.d.ts +7 -1
- package/types/pc/anchor/util.d.ts +1 -1
- package/types/pc/badge/Count.d.ts +1 -1
- package/types/pc/badge/interface.d.ts +2 -0
- package/types/pc/breadcrumb/Item.d.ts +1 -1
- 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/card/interface.d.ts +8 -0
- package/types/pc/cascader/interface.d.ts +1 -1
- 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/color-picker/InputRgb.d.ts +1 -1
- package/types/pc/color-picker/Palette.d.ts +1 -1
- package/types/pc/color-picker/hooks/useColorPicker.d.ts +7 -2
- package/types/pc/color-picker/utils.d.ts +6 -1
- package/types/pc/config-provider/ConfigProvider.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +4 -0
- package/types/pc/copy/index.d.ts +1 -1
- 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/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/flex/index.d.ts +4 -4
- package/types/pc/flex/interface.d.ts +8 -53
- package/types/pc/form/Control.d.ts +1 -1
- package/types/pc/form/FormItem.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/grid/Col-.d.ts +4 -0
- package/types/pc/grid/Col.d.ts +3 -2
- package/types/pc/grid/Grid.d.ts +2 -2
- package/types/pc/grid/Item.d.ts +3 -3
- package/types/pc/grid/Row.d.ts +2 -2
- package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
- package/types/pc/grid/interface.d.ts +13 -7
- 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/index.d.ts +60 -51
- 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/sub-menu/Inline.d.ts +1 -1
- package/types/pc/menu/sub-menu/Pop.d.ts +1 -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/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/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/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/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/space/index.d.ts +6 -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/splitter/SplitBar.d.ts +0 -1
- package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
- package/types/pc/splitter/hooks/useResize.d.ts +1 -2
- package/types/pc/splitter/index.d.ts +5 -4
- package/types/pc/splitter/interface.d.ts +16 -24
- 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/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/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/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/tour/index.d.ts +1 -1
- package/types/pc/transfer/Item.d.ts +1 -1
- package/types/pc/transfer/List.d.ts +1 -1
- package/types/pc/tree/Animation.d.ts +1 -1
- package/types/pc/typography/Operations.d.ts +1 -1
- package/types/pc/upload/interface.d.ts +1 -0
- package/types/pc/upload/list/index.d.ts +1 -1
- package/types/pc/utils/constant.d.ts +1 -2
- package/types/pc/utils/dayjs.d.ts +2 -1
- package/types/pc/utils/index.d.ts +2 -5
- package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
- package/types/pc/utils/toArray.d.ts +1 -5
- package/types/pc/utils/tree.d.ts +2 -1
- package/types/pc/utils/tween.d.ts +1 -1
- package/types/pc/verification-code/VerificationCode.d.ts +1 -1
- 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/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +5 -4
- package/upload/request.js +12 -13
- package/upload/request_.js +2 -3
- package/utils/constant.js +5 -5
- package/utils/dayjs.js +13 -12
- package/utils/index.js +261 -284
- package/utils/scrollIntoViewIfNeeded.js +12 -0
- package/utils/toArray.js +3 -10
- package/utils/tree.js +11 -9
- package/utils/tween.js +5 -5
- package/version/index.js +1 -1
- package/virtual-list/interface.js +1 -0
- package/components/common/space/toArray.js +0 -11
- package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
- package/dist/compute-scroll-into-view/src/index.js +0 -126
- package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
- package/dist/tinycolor/customize/index.js +0 -12
- package/dist/tinycolor/src/conversion.js +0 -143
- package/dist/tinycolor/src/css-color-names.js +0 -153
- package/dist/tinycolor/src/format-input.js +0 -77
- package/dist/tinycolor/src/index.js +0 -388
- package/dist/tinycolor/src/util.js +0 -32
- package/flex/utils.js +0 -13
- package/loading/style/index.module.less.js +0 -4
- package/types/common/space/toArray.d.ts +0 -3
- package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
- package/types/common/utils/scrollIntoView.d.ts +0 -4
- package/types/common/utils/tinycolor.d.ts +0 -1
- package/types/pc/flex/utils.d.ts +0 -9
- package/types/pc/suspense-fallback-test/style/index.d.ts +0 -1
- package/types/pc/utils/color.d.ts +0 -1
- package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
- package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
- package/types/pc/utils/scrollIntoView.d.ts +0 -3
- package/types/pc/utils/tinycolor.d.ts +0 -1
- package/utils/color.js +0 -4
- package/utils/computeScrollIntoView.js +0 -6
- package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
- package/utils/scrollIntoView.js +0 -6
- package/utils/tinycolor.js +0 -29
- /package/{suspense-fallback-test/style/index.less.js → development/interface.js} +0 -0
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/splitter/SplitBar.js
CHANGED
|
@@ -1,127 +1,129 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsxs as G, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import H from "@unicom-cloud/icons/IconUiDown";
|
|
3
|
+
import J from "@unicom-cloud/icons/IconUiLeft";
|
|
4
|
+
import K from "@unicom-cloud/icons/IconUiRight";
|
|
5
|
+
import Q from "@unicom-cloud/icons/IconUiUp";
|
|
6
|
+
import E from "react";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
function
|
|
12
|
-
return typeof
|
|
8
|
+
import f from "@unicom-cloud/utils/class-name";
|
|
9
|
+
import Y from "./hooks/useEvent.js";
|
|
10
|
+
import W from "../config-provider/context.js";
|
|
11
|
+
function O(d) {
|
|
12
|
+
return typeof d == "number" && !Number.isNaN(d) ? Math.round(d) : 0;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const { getPrefixCls:
|
|
14
|
+
const ie = (d) => {
|
|
15
|
+
const { getPrefixCls: y } = E.useContext(W), {
|
|
16
16
|
prefixCls: I,
|
|
17
|
-
vertical:
|
|
18
|
-
index:
|
|
19
|
-
active:
|
|
17
|
+
vertical: s,
|
|
18
|
+
index: n,
|
|
19
|
+
active: z,
|
|
20
20
|
ariaNow: $,
|
|
21
|
-
ariaMin:
|
|
22
|
-
ariaMax:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
onCollapse: S,
|
|
21
|
+
ariaMin: M,
|
|
22
|
+
ariaMax: N,
|
|
23
|
+
startCollapsible: T,
|
|
24
|
+
endCollapsible: j,
|
|
25
|
+
onOffsetStart: S,
|
|
26
|
+
onOffsetUpdate: v,
|
|
27
|
+
onOffsetEnd: h,
|
|
28
|
+
onCollapse: P,
|
|
30
29
|
lazy: a,
|
|
31
30
|
containerSize: m
|
|
32
|
-
} =
|
|
31
|
+
} = d, e = y?.("bar", I), [r, w] = E.useState(
|
|
33
32
|
null
|
|
34
|
-
), [
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
if (
|
|
33
|
+
), [g, U] = E.useState(0), k = s ? 0 : g, A = s ? g : 0, D = (t) => {
|
|
34
|
+
t.currentTarget && (w([t.pageX, t.pageY]), S(n));
|
|
35
|
+
}, R = (t) => {
|
|
36
|
+
if (t.touches.length === 1) {
|
|
38
37
|
const o = t.touches[0];
|
|
39
|
-
|
|
38
|
+
w([o.pageX, o.pageY]), S(n);
|
|
40
39
|
}
|
|
41
|
-
},
|
|
42
|
-
const o = m * $ / 100, c = o + t,
|
|
43
|
-
return Math.max(
|
|
44
|
-
},
|
|
45
|
-
const c =
|
|
46
|
-
|
|
40
|
+
}, V = (t) => {
|
|
41
|
+
const o = m * $ / 100, c = o + t, x = Math.max(0, m * M / 100), i = Math.min(m, m * N / 100);
|
|
42
|
+
return Math.max(x, Math.min(i, c)) - o;
|
|
43
|
+
}, L = Y((t, o) => {
|
|
44
|
+
const c = V(
|
|
45
|
+
s ? o : t
|
|
47
46
|
);
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
|
|
47
|
+
U(c);
|
|
48
|
+
}), b = Y(() => {
|
|
49
|
+
v(n, k, A, !0), U(0), h(!0);
|
|
51
50
|
});
|
|
52
|
-
|
|
51
|
+
E.useEffect(() => {
|
|
53
52
|
if (r) {
|
|
54
53
|
const t = (i) => {
|
|
55
|
-
const { pageX: u, pageY:
|
|
56
|
-
a ?
|
|
54
|
+
const { pageX: u, pageY: C } = i, p = u - r[0], X = C - r[1];
|
|
55
|
+
a ? L(p, X) : v(n, p, X);
|
|
57
56
|
}, o = () => {
|
|
58
|
-
a ?
|
|
57
|
+
a ? b() : h(), w(null);
|
|
59
58
|
}, c = (i) => {
|
|
60
59
|
if (i.touches.length === 1) {
|
|
61
|
-
const u = i.touches[0],
|
|
62
|
-
a ?
|
|
60
|
+
const u = i.touches[0], C = u.pageX - r[0], p = u.pageY - r[1];
|
|
61
|
+
a ? L(C, p) : v(n, C, p);
|
|
63
62
|
}
|
|
64
|
-
},
|
|
65
|
-
a ?
|
|
63
|
+
}, x = () => {
|
|
64
|
+
a ? b() : h(), w(null);
|
|
66
65
|
};
|
|
67
|
-
return window.addEventListener("touchmove", c), window.addEventListener("touchend",
|
|
68
|
-
window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend",
|
|
66
|
+
return window.addEventListener("touchmove", c), window.addEventListener("touchend", x), window.addEventListener("mousemove", t), window.addEventListener("mouseup", o), () => {
|
|
67
|
+
window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", x);
|
|
69
68
|
};
|
|
70
69
|
}
|
|
71
70
|
}, [
|
|
72
71
|
r,
|
|
73
72
|
a,
|
|
74
|
-
n,
|
|
75
73
|
s,
|
|
74
|
+
n,
|
|
76
75
|
m,
|
|
77
76
|
$,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
M,
|
|
78
|
+
N,
|
|
79
|
+
L,
|
|
80
|
+
v,
|
|
81
|
+
b,
|
|
82
|
+
h
|
|
80
83
|
]);
|
|
81
|
-
const
|
|
82
|
-
[`--${e}-preview-offset`]: `${
|
|
83
|
-
},
|
|
84
|
-
return /* @__PURE__ */
|
|
84
|
+
const B = {
|
|
85
|
+
[`--${e}-preview-offset`]: `${g}px`
|
|
86
|
+
}, q = s ? Q : J, F = s ? H : K;
|
|
87
|
+
return /* @__PURE__ */ G(
|
|
85
88
|
"div",
|
|
86
89
|
{
|
|
87
90
|
className: e,
|
|
88
91
|
role: "separator",
|
|
89
|
-
"aria-valuenow":
|
|
90
|
-
"aria-valuemin":
|
|
91
|
-
"aria-valuemax":
|
|
92
|
+
"aria-valuenow": O($),
|
|
93
|
+
"aria-valuemin": O(M),
|
|
94
|
+
"aria-valuemax": O(N),
|
|
92
95
|
children: [
|
|
93
96
|
a && /* @__PURE__ */ l(
|
|
94
97
|
"div",
|
|
95
98
|
{
|
|
96
|
-
className:
|
|
97
|
-
[`${e}-preview-active`]: !!
|
|
99
|
+
className: f(`${e}-preview`, {
|
|
100
|
+
[`${e}-preview-active`]: !!g
|
|
98
101
|
}),
|
|
99
|
-
style:
|
|
102
|
+
style: B
|
|
100
103
|
}
|
|
101
104
|
),
|
|
102
105
|
/* @__PURE__ */ l(
|
|
103
106
|
"div",
|
|
104
107
|
{
|
|
105
|
-
className:
|
|
106
|
-
[`${e}-dragger-
|
|
107
|
-
[`${e}-dragger-active`]: T
|
|
108
|
+
className: f(`${e}-dragger`, {
|
|
109
|
+
[`${e}-dragger-active`]: z
|
|
108
110
|
}),
|
|
109
|
-
onMouseDown:
|
|
110
|
-
onTouchStart:
|
|
111
|
+
onMouseDown: D,
|
|
112
|
+
onTouchStart: R
|
|
111
113
|
}
|
|
112
114
|
),
|
|
113
|
-
|
|
115
|
+
T && /* @__PURE__ */ l(
|
|
114
116
|
"div",
|
|
115
117
|
{
|
|
116
|
-
className:
|
|
118
|
+
className: f(
|
|
117
119
|
`${e}-collapse-bar`,
|
|
118
120
|
`${e}-collapse-bar-start`
|
|
119
121
|
),
|
|
120
|
-
onClick: () =>
|
|
122
|
+
onClick: () => P(n, "start"),
|
|
121
123
|
children: /* @__PURE__ */ l(
|
|
122
|
-
|
|
124
|
+
q,
|
|
123
125
|
{
|
|
124
|
-
className:
|
|
126
|
+
className: f(
|
|
125
127
|
`${e}-collapse-icon`,
|
|
126
128
|
`${e}-collapse-start`
|
|
127
129
|
)
|
|
@@ -129,18 +131,18 @@ const le = (f) => {
|
|
|
129
131
|
)
|
|
130
132
|
}
|
|
131
133
|
),
|
|
132
|
-
|
|
134
|
+
j && /* @__PURE__ */ l(
|
|
133
135
|
"div",
|
|
134
136
|
{
|
|
135
|
-
className:
|
|
137
|
+
className: f(
|
|
136
138
|
`${e}-collapse-bar`,
|
|
137
139
|
`${e}-collapse-bar-end`
|
|
138
140
|
),
|
|
139
|
-
onClick: () =>
|
|
141
|
+
onClick: () => P(n, "end"),
|
|
140
142
|
children: /* @__PURE__ */ l(
|
|
141
|
-
|
|
143
|
+
F,
|
|
142
144
|
{
|
|
143
|
-
className:
|
|
145
|
+
className: f(
|
|
144
146
|
`${e}-collapse-icon`,
|
|
145
147
|
`${e}-collapse-end`
|
|
146
148
|
)
|
|
@@ -153,5 +155,5 @@ const le = (f) => {
|
|
|
153
155
|
);
|
|
154
156
|
};
|
|
155
157
|
export {
|
|
156
|
-
|
|
158
|
+
ie as default
|
|
157
159
|
};
|
package/splitter/Splitter.js
CHANGED
|
@@ -1,139 +1,127 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as v, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import m, { useState as re, useRef as ie, useEffect as ae, useImperativeHandle as le } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { resizeObserver as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { InternalPanel as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
4
|
+
import ce from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import fe from "@unicom-cloud/utils/class-name";
|
|
6
|
+
import { resizeObserver as me } from "../components/common/utils/resizeObserver.js";
|
|
7
|
+
import f from "./hooks/useEvent.js";
|
|
8
|
+
import pe from "./hooks/useItems.js";
|
|
9
|
+
import ue from "./hooks/useResizable.js";
|
|
10
|
+
import ze from "./hooks/useResize.js";
|
|
11
|
+
import Se from "./hooks/useSizes.js";
|
|
12
|
+
import { InternalPanel as Ce } from "./Panel.js";
|
|
13
|
+
import de from "./SplitBar.js";
|
|
14
|
+
import he from "../config-provider/context.js";
|
|
15
|
+
const ge = {
|
|
16
16
|
layout: "horizontal"
|
|
17
17
|
};
|
|
18
|
-
function
|
|
19
|
-
const { getPrefixCls:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
function Me(P, E) {
|
|
19
|
+
const { getPrefixCls: N, componentConfig: O, rtl: l } = m.useContext(he), x = ce(
|
|
20
|
+
P,
|
|
21
|
+
ge,
|
|
22
|
+
O?.Splitter
|
|
23
23
|
), {
|
|
24
|
-
prefixCls:
|
|
25
|
-
className:
|
|
26
|
-
style:
|
|
27
|
-
layout:
|
|
28
|
-
children:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
s !== 0 && L(s);
|
|
24
|
+
prefixCls: y,
|
|
25
|
+
className: $,
|
|
26
|
+
style: k,
|
|
27
|
+
layout: g = "horizontal",
|
|
28
|
+
children: H,
|
|
29
|
+
onResizeStart: U,
|
|
30
|
+
onResize: M,
|
|
31
|
+
onResizeEnd: p,
|
|
32
|
+
lazy: j,
|
|
33
|
+
...w
|
|
34
|
+
} = x, s = N?.("splitter", y), c = g === "vertical", o = pe(H), [u, B] = re(), r = ie(null), W = () => {
|
|
35
|
+
const t = r.current?.offsetWidth, e = r.current?.offsetHeight, n = c ? e : t;
|
|
36
|
+
n !== 0 && B(n);
|
|
38
37
|
}, [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
d,
|
|
42
|
-
M,
|
|
43
|
-
b,
|
|
44
|
-
q
|
|
45
|
-
] = he(r, S), N = Ce(r, C, c), [A, G, J, K, v] = de(
|
|
46
|
-
r,
|
|
47
|
-
N,
|
|
48
|
-
d,
|
|
38
|
+
D,
|
|
39
|
+
z,
|
|
49
40
|
S,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
R,
|
|
42
|
+
I,
|
|
43
|
+
F
|
|
44
|
+
] = Se(o, u), V = ue(o, z, l), [q, A, G, J, b] = ze(o, S, u, F, l), K = f((t) => {
|
|
45
|
+
q(t), U?.(z);
|
|
46
|
+
}), L = f(
|
|
47
|
+
(t, e, n) => {
|
|
48
|
+
const a = A(t, e);
|
|
49
|
+
n ? p?.(a) : M?.(a);
|
|
58
50
|
}
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
}),
|
|
51
|
+
), Q = f((t) => {
|
|
52
|
+
G(), t || p?.(z);
|
|
53
|
+
}), T = f(
|
|
62
54
|
(t, e) => {
|
|
63
|
-
const
|
|
64
|
-
|
|
55
|
+
const n = J(t, e);
|
|
56
|
+
M?.(n), p?.(n);
|
|
65
57
|
}
|
|
66
|
-
),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`${
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
D
|
|
74
|
-
), E = `${n}-mask`, i = p.useMemo(() => {
|
|
58
|
+
), X = fe(
|
|
59
|
+
s,
|
|
60
|
+
$,
|
|
61
|
+
`${s}-${g}`,
|
|
62
|
+
l && [`${s}-rtl`]
|
|
63
|
+
), i = m.useMemo(() => {
|
|
75
64
|
const t = [];
|
|
76
65
|
let e = 0;
|
|
77
|
-
for (let
|
|
78
|
-
e +=
|
|
66
|
+
for (let n = 0; n < o.length; n += 1)
|
|
67
|
+
e += S[n], t.push(e);
|
|
79
68
|
return t;
|
|
80
|
-
}, [
|
|
81
|
-
return
|
|
82
|
-
const t =
|
|
83
|
-
|
|
69
|
+
}, [S, o.length]);
|
|
70
|
+
return ae(() => {
|
|
71
|
+
const t = me([r.current], () => {
|
|
72
|
+
W();
|
|
84
73
|
});
|
|
85
74
|
return () => {
|
|
86
75
|
t();
|
|
87
76
|
};
|
|
88
|
-
}, [
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
77
|
+
}, [r.current]), le(E, () => ({ dom: r.current })), /* @__PURE__ */ v("div", { style: k, className: X, ref: r, ...w, children: [
|
|
78
|
+
o.map((t, e) => {
|
|
79
|
+
const n = /* @__PURE__ */ h(
|
|
80
|
+
Ce,
|
|
92
81
|
{
|
|
93
82
|
...t,
|
|
94
|
-
prefixCls:
|
|
95
|
-
size:
|
|
83
|
+
prefixCls: s,
|
|
84
|
+
size: D[e]
|
|
96
85
|
}
|
|
97
86
|
);
|
|
98
87
|
let a = null;
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
a = /* @__PURE__ */
|
|
103
|
-
|
|
88
|
+
const C = V[e];
|
|
89
|
+
if (C) {
|
|
90
|
+
const Y = (i[e - 1] || 0) + R[e], Z = (i[e + 1] || 100) - I[e + 1], _ = (i[e - 1] || 0) + I[e], ee = (i[e + 1] || 100) - R[e + 1];
|
|
91
|
+
a = /* @__PURE__ */ h(
|
|
92
|
+
de,
|
|
104
93
|
{
|
|
105
|
-
lazy:
|
|
94
|
+
lazy: j,
|
|
106
95
|
index: e,
|
|
107
|
-
active:
|
|
108
|
-
prefixCls:
|
|
109
|
-
vertical:
|
|
110
|
-
resizable: f.resizable,
|
|
96
|
+
active: b === e,
|
|
97
|
+
prefixCls: s,
|
|
98
|
+
vertical: c,
|
|
111
99
|
ariaNow: i[e] * 100,
|
|
112
|
-
ariaMin: Math.max(
|
|
113
|
-
ariaMax: Math.min(
|
|
114
|
-
startCollapsible:
|
|
115
|
-
endCollapsible:
|
|
116
|
-
onOffsetStart:
|
|
117
|
-
onOffsetUpdate: (
|
|
118
|
-
let
|
|
119
|
-
|
|
100
|
+
ariaMin: Math.max(Y, Z) * 100,
|
|
101
|
+
ariaMax: Math.min(_, ee) * 100,
|
|
102
|
+
startCollapsible: C.startCollapsible,
|
|
103
|
+
endCollapsible: C.endCollapsible,
|
|
104
|
+
onOffsetStart: K,
|
|
105
|
+
onOffsetUpdate: (te, ne, se, oe) => {
|
|
106
|
+
let d = c ? se : ne;
|
|
107
|
+
l && !c && (d = -d), L(te, d, oe);
|
|
120
108
|
},
|
|
121
|
-
onOffsetEnd:
|
|
122
|
-
onCollapse:
|
|
123
|
-
containerSize:
|
|
109
|
+
onOffsetEnd: Q,
|
|
110
|
+
onCollapse: T,
|
|
111
|
+
containerSize: u || 0
|
|
124
112
|
}
|
|
125
113
|
);
|
|
126
114
|
}
|
|
127
|
-
return /* @__PURE__ */
|
|
128
|
-
|
|
115
|
+
return /* @__PURE__ */ v(m.Fragment, { children: [
|
|
116
|
+
n,
|
|
129
117
|
a
|
|
130
118
|
] }, `split-panel-${e}`);
|
|
131
119
|
}),
|
|
132
|
-
typeof
|
|
120
|
+
typeof b == "number" && /* @__PURE__ */ h("div", { "aria-hidden": !0, className: `${s}-mask` })
|
|
133
121
|
] });
|
|
134
122
|
}
|
|
135
|
-
const
|
|
136
|
-
|
|
123
|
+
const Re = m.forwardRef(Me);
|
|
124
|
+
Re.displayName = "Splitter";
|
|
137
125
|
export {
|
|
138
|
-
|
|
126
|
+
Re as default
|
|
139
127
|
};
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
import C from "react";
|
|
2
|
+
function v(t, l, n) {
|
|
3
|
+
return C.useMemo(() => {
|
|
4
4
|
const r = [];
|
|
5
|
-
for (let e = 0; e <
|
|
6
|
-
const
|
|
7
|
-
resizable: z = !0,
|
|
8
|
-
min: d,
|
|
9
|
-
collapsible: a
|
|
10
|
-
} = p, {
|
|
11
|
-
resizable: C = !0,
|
|
12
|
-
min: f,
|
|
13
|
-
collapsible: i
|
|
14
|
-
} = u, m = z && C && (t !== 0 || !d) && (n !== 0 || !f), b = a.end && t > 0 || i.start && n === 0 && t > 0, c = i.start && n > 0 || a.end && t === 0 && n > 0;
|
|
5
|
+
for (let e = 0; e < t.length - 1; e += 1) {
|
|
6
|
+
const b = t[e], u = t[e + 1], o = l[e], s = l[e + 1], { min: d, collapsible: a } = b, { min: f, collapsible: c } = u, i = a.end && o > 0 || c.start && s === 0 && o > 0, p = c.start && s > 0 || a.end && o === 0 && s > 0;
|
|
15
7
|
r[e] = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
endCollapsible: !!(o ? b : c)
|
|
8
|
+
startCollapsible: !!(n ? p : i),
|
|
9
|
+
endCollapsible: !!(n ? i : p)
|
|
19
10
|
};
|
|
20
11
|
}
|
|
21
12
|
return r;
|
|
22
|
-
}, [
|
|
13
|
+
}, [l, t, n]);
|
|
23
14
|
}
|
|
24
15
|
export {
|
|
25
|
-
|
|
16
|
+
v as default
|
|
26
17
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import x from "react";
|
|
2
|
-
import { getPtg as
|
|
3
|
-
function
|
|
4
|
-
const i =
|
|
2
|
+
import { getPtg as T } from "./useSizes.js";
|
|
3
|
+
function H(v, P, b, C, j) {
|
|
4
|
+
const i = v.map((t) => [t.min, t.max]), S = b || 0, M = (t) => t * S;
|
|
5
5
|
function a(t, f) {
|
|
6
|
-
return typeof t == "string" ? M(
|
|
6
|
+
return typeof t == "string" ? M(T(t)) : t ?? f;
|
|
7
7
|
}
|
|
8
|
-
const [O,
|
|
8
|
+
const [O, k] = x.useState([]), I = x.useRef([]), [g, p] = x.useState(null), U = () => P.map(M);
|
|
9
9
|
return [
|
|
10
10
|
(t) => {
|
|
11
|
-
|
|
11
|
+
k(U()), p({
|
|
12
12
|
index: t,
|
|
13
13
|
confirmed: !1
|
|
14
14
|
});
|
|
@@ -23,7 +23,7 @@ function J(b, v, P, j, C, k) {
|
|
|
23
23
|
});
|
|
24
24
|
else
|
|
25
25
|
for (let r = t; r >= 0; r -= 1)
|
|
26
|
-
if (O[r] > 0
|
|
26
|
+
if (O[r] > 0) {
|
|
27
27
|
n = r, p({
|
|
28
28
|
index: r,
|
|
29
29
|
confirmed: !0
|
|
@@ -45,7 +45,7 @@ function J(b, v, P, j, C, k) {
|
|
|
45
45
|
p(null);
|
|
46
46
|
},
|
|
47
47
|
(t, f) => {
|
|
48
|
-
const n = U(), c =
|
|
48
|
+
const n = U(), c = j ? f === "start" ? "end" : "start" : f, e = c === "start" ? t : t + 1, s = c === "start" ? t + 1 : t, l = n[e], d = n[s];
|
|
49
49
|
if (l !== 0 && d !== 0)
|
|
50
50
|
n[e] = 0, n[s] += l, I.current[t] = l;
|
|
51
51
|
else {
|
|
@@ -55,7 +55,7 @@ function J(b, v, P, j, C, k) {
|
|
|
55
55
|
), r = a(i[s][0], 0), E = a(
|
|
56
56
|
i[s][1],
|
|
57
57
|
S
|
|
58
|
-
),
|
|
58
|
+
), y = Math.max(m, u - E), L = Math.min(o, u - r), R = r || (L - y) / 2, z = I.current[t], h = u - z;
|
|
59
59
|
z && z <= E && z >= r && h <= o && h >= m ? (n[s] = z, n[e] = h) : (n[e] -= R, n[s] += R);
|
|
60
60
|
}
|
|
61
61
|
return C(n), n;
|
|
@@ -64,5 +64,5 @@ function J(b, v, P, j, C, k) {
|
|
|
64
64
|
];
|
|
65
65
|
}
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
H as default
|
|
68
68
|
};
|