@unicom-cloud/ui 0.8.95 → 0.8.97
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/Message.js +1 -1
- package/Notification.js +1 -1
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/QrCode.js +57 -0
- package/Switch.js +1 -1
- package/Tour.js +63 -0
- package/Trigger.js +2 -2
- 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 +52 -51
- 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 +126 -130
- 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/useForceUpdate.js +6 -2
- package/components/common/hooks/useId.js +4 -4
- 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 +11 -10
- package/components/common/utils/PqbCSSTransition.js +1 -1
- 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 +55 -56
- package/development/index.js +9 -9
- package/dist/react-transition-group/src/CSSTransition.js +1 -1
- package/dist/react-transition-group/src/SwitchTransition.js +1 -1
- package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
- package/dist/tween/src/tween.js +24 -25
- 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/index.js +50 -52
- 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 +682 -679
- 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 +223 -231
- 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 +189 -0
- package/liquid-fill/LiquidFill2.js +3 -0
- package/liquid-fill/index.js +4 -0
- package/liquid-fill/interface.js +1 -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 +97 -100
- 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 +61 -66
- 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 +108 -108
- package/slider/util.js +1 -1
- 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 +61 -61
- package/steps/Step.js +42 -42
- package/steps/index.js +54 -54
- package/style.css +1 -1
- package/switch/index.js +78 -79
- 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/time-picker/util.js +4 -4
- 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 +338 -347
- 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/math.d.ts +1 -1
- package/types/common/utils/mutationObserver.d.ts +2 -0
- package/types/common/utils/resizeObserver.d.ts +2 -0
- package/types/pc/alert/interface.d.ts +2 -2
- package/types/pc/details/interface.d.ts +2 -2
- package/types/pc/hooks/index.d.ts +0 -1
- package/types/pc/index.d.ts +3 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +30 -0
- package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
- package/types/pc/liquid-fill/index.d.ts +4 -0
- package/types/pc/liquid-fill/interface.d.ts +0 -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/math.d.ts +1 -1
- 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 +78 -75
- 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 +49 -50
- 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 +274 -275
- package/utils/intersectionObserver.js +4 -0
- package/utils/math.js +7 -11
- package/utils/mutationObserver.js +4 -0
- package/utils/names.js +12 -0
- package/utils/reactTransitionGroup.js +1 -1
- 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/hooks/useComputedState.js +0 -11
- package/components/common/utils/resizeObserverEffect.js +0 -23
- package/hooks/useComputedState.js +0 -4
- package/types/common/hooks/useComputedState.d.ts +0 -4
- package/types/common/utils/resizeObserverEffect.d.ts +0 -2
- package/types/pc/hooks/useComputedState.d.ts +0 -1
- package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
- package/utils/resizeObserverEffect.js +0 -4
- /package/dist/react-transition-group/chunk/{C6QwjD4L.js → CPfP7aNL.js} +0 -0
package/resize-box/SplitGroup.js
CHANGED
|
@@ -1,190 +1,184 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsx as B, jsxs as pt } from "react/jsx-runtime";
|
|
2
|
+
import vt from "lodash/isFunction";
|
|
3
|
+
import ht from "lodash/isNumber";
|
|
4
|
+
import x from "lodash/isPlainObject";
|
|
5
|
+
import wt from "lodash/isString";
|
|
6
|
+
import G from "lodash/isUndefined";
|
|
7
|
+
import dt, { forwardRef as Mt, useContext as Ot, useRef as S, useState as b, useEffect as V, useImperativeHandle as Ct } from "react";
|
|
8
8
|
import "../config-provider/ConfigProvider.js";
|
|
9
|
-
import
|
|
10
|
-
import { on as
|
|
11
|
-
import { omit as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
function
|
|
9
|
+
import xt from "@unicom-cloud/utils/class-name";
|
|
10
|
+
import { on as z, off as P } from "../components/common/utils/dom.js";
|
|
11
|
+
import { omit as St } from "../components/common/utils/omit.js";
|
|
12
|
+
import zt from "./ResizeTrigger.js";
|
|
13
|
+
import Pt from "../config-provider/context.js";
|
|
14
|
+
const D = "horizontal", W = "vertical";
|
|
15
|
+
function Rt(v, L) {
|
|
16
16
|
const {
|
|
17
17
|
panes: f,
|
|
18
|
-
style:
|
|
19
|
-
className:
|
|
20
|
-
component:
|
|
21
|
-
direction:
|
|
22
|
-
icon:
|
|
23
|
-
...
|
|
24
|
-
} =
|
|
18
|
+
style: Y,
|
|
19
|
+
className: _,
|
|
20
|
+
component: J = "div",
|
|
21
|
+
direction: U = "horizontal",
|
|
22
|
+
icon: Z,
|
|
23
|
+
...q
|
|
24
|
+
} = v, { getPrefixCls: K, rtl: j } = Ot(Pt), Q = 1 / f.length, m = S(), y = S(
|
|
25
25
|
new Array(f.length).fill({
|
|
26
26
|
moving: !1,
|
|
27
27
|
startOffset: 0,
|
|
28
28
|
startPosition: 0
|
|
29
29
|
})
|
|
30
|
-
),
|
|
31
|
-
new Array(f.length).fill(
|
|
32
|
-
), [
|
|
30
|
+
), tt = S([]), R = S(0), N = S([]), [a, A] = b(
|
|
31
|
+
new Array(f.length).fill(Q)
|
|
32
|
+
), [et, k] = b(!1), [E, nt] = b(
|
|
33
33
|
new Array(f.length).fill(0)
|
|
34
|
-
), [
|
|
34
|
+
), [h, ot] = b(
|
|
35
35
|
new Array(Math.max(f.length - 1, 0)).fill({ prev: !1, next: !1 })
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
`${
|
|
39
|
-
{ [`${
|
|
40
|
-
{ [`${
|
|
41
|
-
|
|
42
|
-
),
|
|
36
|
+
), w = K?.("resizebox-split-group"), g = U === D, rt = g && j, I = !g, st = xt(
|
|
37
|
+
w,
|
|
38
|
+
`${w}-${g ? D : W}`,
|
|
39
|
+
{ [`${w}-moving`]: et },
|
|
40
|
+
{ [`${w}-rtl`]: j },
|
|
41
|
+
_
|
|
42
|
+
), ct = J, it = () => {
|
|
43
43
|
let t = [];
|
|
44
44
|
f.forEach((o) => {
|
|
45
45
|
const { size: s } = o;
|
|
46
|
-
|
|
46
|
+
G(s) ? t.push(void 0) : t.push(d(s));
|
|
47
47
|
});
|
|
48
48
|
const e = t.filter((o) => !o), r = (1 - t.reduce((o, s) => (o || 0) + (s || 0), 0)) / e.length;
|
|
49
|
-
return t = t.map((o) =>
|
|
50
|
-
},
|
|
51
|
-
const e =
|
|
52
|
-
return `calc(${
|
|
49
|
+
return t = t.map((o) => G(o) ? r : o), t;
|
|
50
|
+
}, ft = (t) => {
|
|
51
|
+
const e = E[t - 1] || 0, n = E[t];
|
|
52
|
+
return `calc(${a[t] * 100}% - ${(e + n) / 2}px)`;
|
|
53
53
|
};
|
|
54
|
-
function
|
|
55
|
-
const e =
|
|
56
|
-
if (!t ||
|
|
54
|
+
function d(t) {
|
|
55
|
+
const e = g ? m.current.offsetWidth : m.current.offsetHeight;
|
|
56
|
+
if (!t || ht(t) && t < 0)
|
|
57
57
|
return 0;
|
|
58
|
-
const n =
|
|
58
|
+
const n = wt(t) ? parseFloat(t) / e : t;
|
|
59
59
|
return Math.min(n, 1);
|
|
60
60
|
}
|
|
61
|
-
const
|
|
62
|
-
const e = Math.min(t + 1, f.length - 1), n =
|
|
63
|
-
let o =
|
|
64
|
-
const s =
|
|
65
|
-
let
|
|
66
|
-
return o = Math.min(n - s, o),
|
|
61
|
+
const H = (t) => {
|
|
62
|
+
const e = Math.min(t + 1, f.length - 1), n = a[t] + a[e], r = d(f[t].min) || 0;
|
|
63
|
+
let o = d(f[t].max) || n;
|
|
64
|
+
const s = d(f[e].min) || 0;
|
|
65
|
+
let c = d(f[e].max) || n;
|
|
66
|
+
return o = Math.min(n - s, o), c = Math.min(n - r, c), {
|
|
67
67
|
currentMin: r,
|
|
68
68
|
currentMax: o,
|
|
69
69
|
nextMin: s,
|
|
70
|
-
nextMax:
|
|
70
|
+
nextMax: c
|
|
71
71
|
};
|
|
72
|
-
},
|
|
73
|
-
const r =
|
|
74
|
-
let
|
|
75
|
-
return
|
|
72
|
+
}, at = (t, e, n) => {
|
|
73
|
+
const r = R.current, o = r + 1, s = [...a], c = rt ? -1 : 1, p = a[r], O = a[o], C = p + O, { currentMin: u, currentMax: i } = H(r);
|
|
74
|
+
let l = t + d(`${(n - e) * c}px`);
|
|
75
|
+
return l = Math.max(u, l), l = Math.min(i, l), s[r] = l, s[o] = C - l, s;
|
|
76
76
|
};
|
|
77
|
-
function
|
|
78
|
-
const { contentRect: n } = t[0], r = n[
|
|
79
|
-
o[e] = r,
|
|
77
|
+
function lt(t, e) {
|
|
78
|
+
const { contentRect: n } = t[0], r = n[I ? "height" : "width"], o = [...E];
|
|
79
|
+
o[e] = r, nt(o);
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const ut = (t) => {
|
|
82
82
|
let e = f[t].collapsible;
|
|
83
|
-
|
|
83
|
+
x(e) || (e = e ? { prev: !0, next: !0 } : {});
|
|
84
84
|
const { prev: n, next: r } = e;
|
|
85
85
|
if (!n && !r)
|
|
86
86
|
return {};
|
|
87
|
-
if (!
|
|
87
|
+
if (!h[t])
|
|
88
88
|
return {};
|
|
89
|
-
const o = !!n || !n &&
|
|
89
|
+
const o = !!n || !n && h[t].next, s = !!r || !r && h[t].prev;
|
|
90
90
|
return { hasPrev: o, hasNext: s };
|
|
91
91
|
};
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
n.moving = !0, n.startOffset = l[e], n.startPosition = v ? t.pageX : t.pageY, F(!0), R(window, "mousemove", T), R(window, "touchmove", T), R(window, "mouseup", O), R(window, "touchend", O), R(window, "contextmenu", O), document.body.style.cursor = H ? "row-resize" : "col-resize";
|
|
92
|
+
function mt(t, e) {
|
|
93
|
+
v.onMovingStart?.(e), R.current = e;
|
|
94
|
+
const n = y.current[e];
|
|
95
|
+
n.moving = !0, n.startOffset = a[e], n.startPosition = g ? t.pageX : t.pageY, k(!0), z(window, "mousemove", T), z(window, "touchmove", T), z(window, "mouseup", M), z(window, "touchend", M), z(window, "contextmenu", M), document.body.style.cursor = I ? "row-resize" : "col-resize";
|
|
97
96
|
}
|
|
98
97
|
function T(t) {
|
|
99
|
-
|
|
100
|
-
const e = P.current, n = A.current[e], r = v ? g.current.offsetWidth : g.current.offsetHeight;
|
|
98
|
+
const e = R.current, n = y.current[e], r = g ? m.current.offsetWidth : m.current.offsetHeight;
|
|
101
99
|
if (n.moving) {
|
|
102
|
-
const
|
|
100
|
+
const o = at(
|
|
103
101
|
n.startOffset,
|
|
104
102
|
n.startPosition,
|
|
105
|
-
|
|
103
|
+
g ? t.pageX : t.pageY
|
|
106
104
|
);
|
|
107
|
-
|
|
108
|
-
c,
|
|
105
|
+
A(o), N.current = o, v?.onMoving?.(
|
|
109
106
|
t,
|
|
110
|
-
|
|
107
|
+
o.map((s) => `${s * r}px`),
|
|
111
108
|
e
|
|
112
109
|
);
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
A.current[t].moving = !1, F(!1), N(window, "mousemove", T), N(window, "touchmove", T), N(window, "mouseup", O), N(window, "touchend", O), N(window, "contextmenu", O), document.body.style.cursor = "default", (e = c.onMovingEnd) == null || e.call(c, t);
|
|
112
|
+
function M() {
|
|
113
|
+
const t = R.current;
|
|
114
|
+
y.current[t].moving = !1, k(!1), P(window, "mousemove", T), P(window, "touchmove", T), P(window, "mouseup", M), P(window, "touchend", M), P(window, "contextmenu", M), document.body.style.cursor = "default", v.onMovingEnd?.(t);
|
|
119
115
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
n === "prev" ? (h !== a || $ === a) && (u = m, $ = C - m, B = !0) : (i !== m || u === m) && (u = C - a, $ = a, B = !0), s[e] = u, s[o] = $, (V = c == null ? void 0 : c.onMoving) == null || V.call(
|
|
125
|
-
c,
|
|
116
|
+
function F(t, e, n, r) {
|
|
117
|
+
const o = e + 1, s = [...a], c = a[e], p = a[o], O = c + p, C = g ? m.current.offsetWidth : m.current.offsetHeight, { currentMin: u, nextMin: i } = H(e);
|
|
118
|
+
let l = N.current[e], $ = N.current[o], X = h[e][n];
|
|
119
|
+
n === "prev" ? (p !== i || $ === i) && (l = u, $ = O - u, X = !0) : (c !== u || l === u) && (l = O - i, $ = i, X = !0), s[e] = l, s[o] = $, v?.onMoving?.(
|
|
126
120
|
t,
|
|
127
|
-
s.map((
|
|
121
|
+
s.map((gt) => `${gt * C}px`),
|
|
128
122
|
e
|
|
129
|
-
),
|
|
123
|
+
), v.onMovingEnd?.(e), A(s), vt(r) && r(t, e, n, X);
|
|
130
124
|
}
|
|
131
|
-
return
|
|
132
|
-
const t =
|
|
133
|
-
|
|
134
|
-
}, [JSON.stringify(f.map((t) => t.size))]),
|
|
125
|
+
return V(() => {
|
|
126
|
+
const t = it();
|
|
127
|
+
A(t), N.current = t;
|
|
128
|
+
}, [JSON.stringify(f.map((t) => t.size))]), Ct(L, () => m.current, []), V(() => {
|
|
135
129
|
const t = [];
|
|
136
|
-
|
|
137
|
-
const r = { prev: !1, next: !1 }, o = n + 1, { currentMin: s, nextMin:
|
|
138
|
-
e === s ? r.prev = !0 :
|
|
139
|
-
}),
|
|
140
|
-
}, [
|
|
141
|
-
|
|
130
|
+
a.forEach((e, n) => {
|
|
131
|
+
const r = { prev: !1, next: !1 }, o = n + 1, { currentMin: s, nextMin: c } = H(n);
|
|
132
|
+
e === s ? r.prev = !0 : a[o] === c && (r.next = !0), t.push(r);
|
|
133
|
+
}), ot(t);
|
|
134
|
+
}, [a]), /* @__PURE__ */ B(
|
|
135
|
+
ct,
|
|
142
136
|
{
|
|
143
|
-
...
|
|
137
|
+
...St(q, [
|
|
144
138
|
"onMovingStart",
|
|
145
139
|
"onPaneResize",
|
|
146
140
|
"onMoving",
|
|
147
141
|
"onMovingEnd"
|
|
148
142
|
]),
|
|
149
|
-
style:
|
|
150
|
-
className:
|
|
151
|
-
ref:
|
|
143
|
+
style: Y,
|
|
144
|
+
className: st,
|
|
145
|
+
ref: m,
|
|
152
146
|
children: f.map((t, e) => {
|
|
153
147
|
const {
|
|
154
148
|
content: n,
|
|
155
149
|
disabled: r,
|
|
156
150
|
trigger: o,
|
|
157
151
|
resizable: s = !0,
|
|
158
|
-
collapsible:
|
|
159
|
-
} = t, { hasPrev:
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
/* @__PURE__ */
|
|
152
|
+
collapsible: c = {}
|
|
153
|
+
} = t, { hasPrev: p, hasNext: O } = ut(e), C = x(c) && x(c.prev) ? c.prev : {}, u = x(c) && x(c.next) ? c.next : {};
|
|
154
|
+
return /* @__PURE__ */ pt(dt.Fragment, { children: [
|
|
155
|
+
/* @__PURE__ */ B(
|
|
162
156
|
"div",
|
|
163
157
|
{
|
|
164
|
-
className: `${
|
|
165
|
-
style: { flexBasis:
|
|
166
|
-
ref: (
|
|
158
|
+
className: `${w}-pane`,
|
|
159
|
+
style: { flexBasis: ft(e) },
|
|
160
|
+
ref: (i) => tt.current[e] = i,
|
|
167
161
|
children: n
|
|
168
162
|
}
|
|
169
163
|
),
|
|
170
|
-
!r && e !== f.length - 1 && /* @__PURE__ */
|
|
171
|
-
|
|
164
|
+
!r && e !== f.length - 1 && /* @__PURE__ */ B(
|
|
165
|
+
zt,
|
|
172
166
|
{
|
|
173
|
-
className: `${
|
|
174
|
-
direction:
|
|
175
|
-
icon:
|
|
176
|
-
onResize: (
|
|
177
|
-
onMouseDown: (
|
|
167
|
+
className: `${w}-trigger`,
|
|
168
|
+
direction: I ? D : W,
|
|
169
|
+
icon: Z,
|
|
170
|
+
onResize: (i) => lt(i, e),
|
|
171
|
+
onMouseDown: (i) => mt(i, e),
|
|
178
172
|
collapsible: {
|
|
179
|
-
prev:
|
|
180
|
-
onClick: (
|
|
181
|
-
icon:
|
|
182
|
-
collapsed:
|
|
173
|
+
prev: p ? {
|
|
174
|
+
onClick: (i) => F(i, e, "prev", C.onClick),
|
|
175
|
+
icon: C.icon,
|
|
176
|
+
collapsed: h[e].prev
|
|
183
177
|
} : void 0,
|
|
184
|
-
next:
|
|
185
|
-
onClick: (
|
|
186
|
-
icon:
|
|
187
|
-
collapsed:
|
|
178
|
+
next: O ? {
|
|
179
|
+
onClick: (i) => F(i, e, "next", u.onClick),
|
|
180
|
+
icon: u.icon,
|
|
181
|
+
collapsed: h[e].next
|
|
188
182
|
} : void 0
|
|
189
183
|
},
|
|
190
184
|
resizable: s,
|
|
@@ -196,8 +190,8 @@ function Tt(c, J) {
|
|
|
196
190
|
}
|
|
197
191
|
);
|
|
198
192
|
}
|
|
199
|
-
const
|
|
200
|
-
|
|
193
|
+
const Nt = Mt(Rt);
|
|
194
|
+
Nt.displayName = "ResizeBoxSplitGroup";
|
|
201
195
|
export {
|
|
202
|
-
|
|
196
|
+
Nt as default
|
|
203
197
|
};
|
package/resize-box/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as et, jsx as ot } from "react/jsx-runtime";
|
|
2
|
+
import O from "lodash/isNumber";
|
|
3
|
+
import { forwardRef as rt, useContext as nt, useState as st, useRef as D, useImperativeHandle as it } from "react";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { on as
|
|
9
|
-
import { omit as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
],
|
|
5
|
+
import ct from "../components/common/hooks/useMergeProps.js";
|
|
6
|
+
import B from "../components/common/hooks/useMergeValue.js";
|
|
7
|
+
import at from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import { on as u, off as m } from "../components/common/utils/dom.js";
|
|
9
|
+
import { omit as ut } from "../components/common/utils/omit.js";
|
|
10
|
+
import mt from "./ResizeTrigger.js";
|
|
11
|
+
import pt from "./Split.js";
|
|
12
|
+
import dt from "./SplitGroup.js";
|
|
13
|
+
import gt from "../config-provider/context.js";
|
|
14
|
+
const E = "left", w = "right", v = "top", R = "bottom", lt = [
|
|
15
|
+
E,
|
|
16
|
+
w,
|
|
17
|
+
v,
|
|
18
|
+
R
|
|
19
|
+
], ft = {
|
|
20
20
|
component: "div",
|
|
21
21
|
directions: ["right"],
|
|
22
22
|
resizeIcons: {},
|
|
23
23
|
resizeTriggers: {}
|
|
24
|
-
},
|
|
25
|
-
switch (
|
|
24
|
+
}, ht = (p) => {
|
|
25
|
+
switch (p) {
|
|
26
26
|
case "left":
|
|
27
27
|
return "right";
|
|
28
28
|
case "right":
|
|
29
29
|
return "left";
|
|
30
30
|
default:
|
|
31
|
-
return
|
|
31
|
+
return p;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
function
|
|
35
|
-
const { getPrefixCls:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
function wt(p, W) {
|
|
35
|
+
const { getPrefixCls: $, componentConfig: X, rtl: b } = nt(gt), d = ct(
|
|
36
|
+
p,
|
|
37
|
+
ft,
|
|
38
|
+
X?.ResizeBox
|
|
39
39
|
), {
|
|
40
|
-
style:
|
|
41
|
-
className:
|
|
42
|
-
component:
|
|
43
|
-
directions:
|
|
44
|
-
resizeIcons:
|
|
45
|
-
children:
|
|
46
|
-
resizeTriggers:
|
|
47
|
-
width:
|
|
48
|
-
height:
|
|
49
|
-
...
|
|
50
|
-
} =
|
|
40
|
+
style: Y,
|
|
41
|
+
className: P,
|
|
42
|
+
component: k,
|
|
43
|
+
directions: x,
|
|
44
|
+
resizeIcons: G,
|
|
45
|
+
children: _,
|
|
46
|
+
resizeTriggers: A,
|
|
47
|
+
width: j,
|
|
48
|
+
height: F,
|
|
49
|
+
...q
|
|
50
|
+
} = d, K = b ? x.map((t) => ht(t)) : x, f = $?.("resizebox"), L = at(f, { [`${f}-rtl`]: b }, P), [U, V] = st({}), [y, C] = B(void 0, { value: j }), [T, I] = B(void 0, { value: F }), o = D({
|
|
51
51
|
startX: 0,
|
|
52
52
|
startY: 0,
|
|
53
53
|
startWidth: 0,
|
|
54
54
|
startHeight: 0,
|
|
55
|
-
direction:
|
|
55
|
+
direction: w,
|
|
56
56
|
moving: !1,
|
|
57
57
|
padding: {
|
|
58
58
|
top: 0,
|
|
@@ -60,110 +60,107 @@ function vt(f, Y) {
|
|
|
60
60
|
left: 0,
|
|
61
61
|
right: 0
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
return [
|
|
63
|
+
}), g = D();
|
|
64
|
+
it(W, () => g.current, []);
|
|
65
|
+
function h(t) {
|
|
66
|
+
return [v, R].indexOf(t) > -1;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function N(t, e) {
|
|
69
69
|
if (t === 0)
|
|
70
70
|
return 0;
|
|
71
|
-
const
|
|
72
|
-
return
|
|
71
|
+
const r = t - e;
|
|
72
|
+
return r <= 0 ? 0 : r;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function S(t) {
|
|
75
75
|
const e = "data-pqb-origin-cursor";
|
|
76
76
|
if (t)
|
|
77
77
|
document.body.setAttribute(e, document.body.style.cursor), document.body.style.cursor = t;
|
|
78
78
|
else {
|
|
79
|
-
const
|
|
80
|
-
document.body.style.cursor =
|
|
79
|
+
const r = document.body.getAttribute(e);
|
|
80
|
+
document.body.style.cursor = r || "", document.body.removeAttribute(e);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
z(t) ? "row-resize" : "col-resize"
|
|
83
|
+
function J(t, e) {
|
|
84
|
+
d.onMovingStart?.(), o.current.moving = !0, o.current.startX = e.pageX, o.current.startY = e.pageY, o.current.direction = t;
|
|
85
|
+
const { top: r, left: s, right: i, bottom: n } = o.current.padding;
|
|
86
|
+
o.current.startWidth = N(
|
|
87
|
+
g.current?.clientWidth,
|
|
88
|
+
s + i
|
|
89
|
+
), o.current.startHeight = N(
|
|
90
|
+
g.current?.clientHeight,
|
|
91
|
+
r + n
|
|
92
|
+
), u(window, "mousemove", l), u(window, "touchmove", l), u(window, "mouseup", a), u(window, "touchend", a), u(window, "contextmenu", a), S(
|
|
93
|
+
h(t) ? "row-resize" : "col-resize"
|
|
95
94
|
);
|
|
96
95
|
}
|
|
97
|
-
function
|
|
98
|
-
var B;
|
|
96
|
+
function l(t) {
|
|
99
97
|
if (!o.current.moving)
|
|
100
98
|
return !1;
|
|
101
|
-
const { startX: e, startY:
|
|
102
|
-
let
|
|
103
|
-
const
|
|
99
|
+
const { startX: e, startY: r, startWidth: s, startHeight: i } = o.current;
|
|
100
|
+
let n = s, c = i;
|
|
101
|
+
const H = t.pageX - e, M = t.pageY - r;
|
|
104
102
|
switch (o.current.direction) {
|
|
105
|
-
case
|
|
106
|
-
|
|
103
|
+
case E:
|
|
104
|
+
n = s - H, C(n);
|
|
107
105
|
break;
|
|
108
|
-
case
|
|
109
|
-
|
|
106
|
+
case w:
|
|
107
|
+
n = s + H, C(n);
|
|
110
108
|
break;
|
|
111
|
-
case
|
|
112
|
-
|
|
109
|
+
case v:
|
|
110
|
+
c = i - M, I(c);
|
|
113
111
|
break;
|
|
114
|
-
case
|
|
115
|
-
|
|
112
|
+
case R:
|
|
113
|
+
c = i + M, I(c);
|
|
116
114
|
break;
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
width:
|
|
120
|
-
height:
|
|
116
|
+
d.onMoving?.(t, {
|
|
117
|
+
width: n,
|
|
118
|
+
height: c
|
|
121
119
|
});
|
|
122
120
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
o.current.moving = !1, Z(), D(), (t = r.onMovingEnd) == null || t.call(r);
|
|
121
|
+
function a() {
|
|
122
|
+
o.current.moving = !1, Q(), S(), d.onMovingEnd?.();
|
|
126
123
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
124
|
+
function Q() {
|
|
125
|
+
m(window, "mousemove", l), m(window, "touchmove", l), m(window, "mouseup", a), m(window, "touchend", a), m(window, "contextmenu", a);
|
|
129
126
|
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
o.current.padding[t] =
|
|
133
|
-
...
|
|
134
|
-
[`padding${
|
|
127
|
+
function Z(t, e) {
|
|
128
|
+
const r = h(t), { contentRect: s } = e[0], i = `${t.slice(0, 1).toUpperCase()}${t.slice(1)}`, n = s[r ? "height" : "width"];
|
|
129
|
+
o.current.padding[t] = n, V((c) => ({
|
|
130
|
+
...c,
|
|
131
|
+
[`padding${i}`]: n
|
|
135
132
|
}));
|
|
136
133
|
}
|
|
137
|
-
const
|
|
138
|
-
...
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
...
|
|
134
|
+
const tt = {
|
|
135
|
+
...U,
|
|
136
|
+
...Y || {},
|
|
137
|
+
...O(y) ? { width: y } : {},
|
|
138
|
+
...O(T) ? { height: T } : {}
|
|
142
139
|
};
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
140
|
+
return /* @__PURE__ */ et(
|
|
141
|
+
k,
|
|
145
142
|
{
|
|
146
|
-
...
|
|
147
|
-
style:
|
|
148
|
-
className:
|
|
149
|
-
ref:
|
|
143
|
+
...ut(q, ["onMovingStart", "onMoving", "onMovingEnd"]),
|
|
144
|
+
style: tt,
|
|
145
|
+
className: L,
|
|
146
|
+
ref: g,
|
|
150
147
|
children: [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
|
|
148
|
+
_,
|
|
149
|
+
K.map((t) => {
|
|
150
|
+
if (lt.indexOf(t) !== -1)
|
|
151
|
+
return /* @__PURE__ */ ot(
|
|
152
|
+
mt,
|
|
156
153
|
{
|
|
157
|
-
className: `${
|
|
158
|
-
direction:
|
|
159
|
-
icon:
|
|
154
|
+
className: `${f}-direction-${t}`,
|
|
155
|
+
direction: h(t) ? "horizontal" : "vertical",
|
|
156
|
+
icon: G[t],
|
|
160
157
|
onMouseDown: (e) => {
|
|
161
|
-
|
|
158
|
+
J(t, e);
|
|
162
159
|
},
|
|
163
160
|
onResize: (e) => {
|
|
164
|
-
|
|
161
|
+
Z(t, e);
|
|
165
162
|
},
|
|
166
|
-
children:
|
|
163
|
+
children: A[t]
|
|
167
164
|
},
|
|
168
165
|
t
|
|
169
166
|
);
|
|
@@ -172,12 +169,12 @@ function vt(f, Y) {
|
|
|
172
169
|
}
|
|
173
170
|
);
|
|
174
171
|
}
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
const vt = rt(wt), z = vt;
|
|
173
|
+
z.Split = pt;
|
|
174
|
+
z.SplitGroup = dt;
|
|
175
|
+
z.displayName = "ResizeBox";
|
|
179
176
|
export {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
pt as ResizeBoxSplit,
|
|
178
|
+
dt as ResizeBoxSplitGroup,
|
|
179
|
+
z as default
|
|
183
180
|
};
|