@unicom-cloud/ui 0.8.100 → 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/Details.js +13 -2
- package/Divider.js +3 -2
- package/Flex.js +14 -4
- package/Loading.js +16 -3
- package/Space.js +3 -3
- package/Splitter.js +4 -3
- package/SuspenseFallbackTest.js +2 -4
- package/alert/index.js +60 -62
- package/back-top/index.js +32 -33
- 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/details/index.js +102 -62
- 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/icon/interface.js +1 -0
- package/icon-hover/interface.js +1 -0
- package/index.js +537 -536
- package/loading/index.js +72 -53
- package/loading/interface.js +1 -0
- package/modal/Modal.js +73 -74
- package/package.json +1 -1
- package/portal/interface.js +1 -0
- package/segmented/index.js +47 -47
- package/space/index.js +41 -35
- package/speech-synthesis/interface.js +1 -0
- package/splitter/Splitter.js +85 -89
- package/splitter/hooks/useItems.js +1 -1
- package/splitter/index.js +5 -4
- 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/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/toArray.d.ts +13 -0
- package/types/pc/alert/index.d.ts +2 -1
- package/types/pc/alert/interface.d.ts +7 -1
- package/types/pc/badge/Count.d.ts +1 -1
- 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/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/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/FormList.d.ts +1 -1
- package/types/pc/form/IconSymbol.d.ts +1 -1
- 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/index.d.ts +5 -4
- package/types/pc/splitter/interface.d.ts +16 -16
- 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/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/list/index.d.ts +1 -1
- package/types/pc/utils/toArray.d.ts +1 -5
- 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/utils/index.js +1 -1
- package/utils/toArray.js +3 -10
- package/version/index.js +1 -1
- package/virtual-list/interface.js +1 -0
- package/components/common/space/toArray.js +0 -11
- 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/pc/flex/utils.d.ts +0 -9
- 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/segmented/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as D, jsx as w, Fragment 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
4
|
import ae from "../components/common/hooks/useMergeProps.js";
|
|
5
|
-
import
|
|
6
|
-
import { resizeObserver as
|
|
7
|
-
import
|
|
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
8
|
const ce = {
|
|
9
9
|
options: [],
|
|
10
10
|
size: "medium",
|
|
@@ -14,12 +14,12 @@ const ce = {
|
|
|
14
14
|
direction: "horizontal",
|
|
15
15
|
showIndicator: !0,
|
|
16
16
|
animationDuration: 300
|
|
17
|
-
},
|
|
18
|
-
(
|
|
19
|
-
const { getPrefixCls:
|
|
20
|
-
|
|
17
|
+
}, ue = ne(
|
|
18
|
+
(B, d) => {
|
|
19
|
+
const { getPrefixCls: E, componentConfig: M, rtl: K } = re(le), L = ae(
|
|
20
|
+
B,
|
|
21
21
|
ce,
|
|
22
|
-
|
|
22
|
+
M?.Segmented
|
|
23
23
|
), {
|
|
24
24
|
style: U,
|
|
25
25
|
className: F,
|
|
@@ -36,7 +36,7 @@ const ce = {
|
|
|
36
36
|
name: x,
|
|
37
37
|
onChange: C,
|
|
38
38
|
...G
|
|
39
|
-
} = L,
|
|
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
42
|
[`${r}-block`]: _,
|
|
@@ -46,24 +46,24 @@ const ce = {
|
|
|
46
46
|
[`${r}-${p}`]: p
|
|
47
47
|
},
|
|
48
48
|
F
|
|
49
|
-
), h = R !== void 0, i = h ? R : J, b =
|
|
50
|
-
if (!$ || !
|
|
51
|
-
m((
|
|
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
61
|
const o = k.current[e];
|
|
62
62
|
if (!o) {
|
|
63
|
-
m((
|
|
63
|
+
m((a) => ({ ...a, opacity: 0 }));
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
const n =
|
|
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,
|
|
@@ -75,14 +75,14 @@ const ce = {
|
|
|
75
75
|
// 水平模式下高度撑满
|
|
76
76
|
};
|
|
77
77
|
m({
|
|
78
|
-
...
|
|
78
|
+
...l,
|
|
79
79
|
opacity: 1
|
|
80
80
|
});
|
|
81
|
-
}, [i,
|
|
82
|
-
o || f || (h ||
|
|
81
|
+
}, [i, s, $, p]), z = (e, o) => {
|
|
82
|
+
o || f || (h || S(e), C?.(e));
|
|
83
83
|
}, W = (e, o) => {
|
|
84
84
|
if (f) return;
|
|
85
|
-
const n =
|
|
85
|
+
const n = s.length;
|
|
86
86
|
if (n === 0) return;
|
|
87
87
|
let t = o;
|
|
88
88
|
switch (e.key) {
|
|
@@ -103,26 +103,26 @@ const ce = {
|
|
|
103
103
|
default:
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
for (; t !== o &&
|
|
106
|
+
for (; t !== o && s[t]?.disabled; )
|
|
107
107
|
t = (t + (e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1) + n) % n;
|
|
108
|
-
const
|
|
109
|
-
|
|
108
|
+
const l = s[t]?.value;
|
|
109
|
+
l && l !== i && (z(l), k.current[t]?.focus());
|
|
110
110
|
};
|
|
111
111
|
A(() => {
|
|
112
|
-
if (!
|
|
113
|
-
|
|
112
|
+
if (!V.current) {
|
|
113
|
+
V.current = !0;
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (!
|
|
117
|
-
const e =
|
|
118
|
-
h ||
|
|
116
|
+
if (!s.some((e) => e.value === i)) {
|
|
117
|
+
const e = s[0]?.value || "";
|
|
118
|
+
h || S(e), C?.(e);
|
|
119
119
|
}
|
|
120
|
-
}, [
|
|
120
|
+
}, [s, i, h, C]), A(() => {
|
|
121
121
|
b();
|
|
122
|
-
}, [i,
|
|
123
|
-
if (!
|
|
124
|
-
const e =
|
|
125
|
-
[
|
|
122
|
+
}, [i, s, b]), A(() => {
|
|
123
|
+
if (!c.current) return;
|
|
124
|
+
const e = ie(
|
|
125
|
+
[c.current],
|
|
126
126
|
() => {
|
|
127
127
|
b();
|
|
128
128
|
}
|
|
@@ -135,7 +135,7 @@ const ce = {
|
|
|
135
135
|
if (e.render)
|
|
136
136
|
return e.render(e, o);
|
|
137
137
|
const n = !e.label && !!e.icon;
|
|
138
|
-
return /* @__PURE__ */ D(
|
|
138
|
+
return /* @__PURE__ */ D(te, { children: [
|
|
139
139
|
e.icon && /* @__PURE__ */ w("span", { className: `${r}-option-icon`, children: e.icon }),
|
|
140
140
|
!n && e.label && /* @__PURE__ */ w("span", { className: `${r}-option-label`, children: e.label })
|
|
141
141
|
] });
|
|
@@ -144,28 +144,28 @@ const ce = {
|
|
|
144
144
|
"div",
|
|
145
145
|
{
|
|
146
146
|
ref: (e) => {
|
|
147
|
-
typeof d == "function" ? d(e) : d && (d.current = e),
|
|
147
|
+
typeof d == "function" ? d(e) : d && (d.current = e), c.current = e;
|
|
148
148
|
},
|
|
149
149
|
...G,
|
|
150
150
|
style: U,
|
|
151
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
156
|
const {
|
|
157
157
|
value: n,
|
|
158
158
|
label: t,
|
|
159
|
-
disabled:
|
|
160
|
-
icon:
|
|
161
|
-
render:
|
|
159
|
+
disabled: l,
|
|
160
|
+
icon: a,
|
|
161
|
+
render: fe,
|
|
162
162
|
...Y
|
|
163
|
-
} = e, u = n === i, g =
|
|
163
|
+
} = e, u = n === i, g = l || f, Z = !t && !!a, ee = [t, n, o].filter(Boolean).join("-");
|
|
164
164
|
return /* @__PURE__ */ D(
|
|
165
165
|
"button",
|
|
166
166
|
{
|
|
167
167
|
ref: (I) => k.current[o] = I,
|
|
168
|
-
className:
|
|
168
|
+
className: j(
|
|
169
169
|
`${r}-option`,
|
|
170
170
|
`${r}-option-${H}`,
|
|
171
171
|
`${r}-option-${v}`,
|
|
@@ -201,7 +201,7 @@ const ce = {
|
|
|
201
201
|
X(e, u)
|
|
202
202
|
]
|
|
203
203
|
},
|
|
204
|
-
|
|
204
|
+
ee
|
|
205
205
|
);
|
|
206
206
|
}),
|
|
207
207
|
$ && /* @__PURE__ */ w(
|
|
@@ -219,7 +219,7 @@ const ce = {
|
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
);
|
|
222
|
-
|
|
222
|
+
ue.displayName = "Segmented";
|
|
223
223
|
export {
|
|
224
|
-
|
|
224
|
+
ue as default
|
|
225
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/splitter/Splitter.js
CHANGED
|
@@ -1,126 +1,122 @@
|
|
|
1
|
-
import { jsxs as I, jsx as
|
|
2
|
-
import p, { useState as
|
|
1
|
+
import { jsxs as I, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import p, { 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
|
|
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
7
|
import m from "./hooks/useEvent.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { InternalPanel as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const
|
|
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(N, P) {
|
|
19
|
+
const { getPrefixCls: O, componentConfig: x, rtl: l } = p.useContext(he), y = ce(
|
|
20
|
+
N,
|
|
21
|
+
ge,
|
|
22
|
+
x?.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: $,
|
|
25
|
+
className: k,
|
|
26
|
+
style: H,
|
|
27
|
+
layout: g = "horizontal",
|
|
28
|
+
children: U,
|
|
29
|
+
onResizeStart: j,
|
|
30
|
+
onResize: M,
|
|
31
|
+
onResizeEnd: u,
|
|
32
|
+
lazy: w,
|
|
33
|
+
...B
|
|
34
|
+
} = y, n = O?.("splitter", $), c = g === "vertical", r = pe(U), [z, D] = re(), o = ie(null), V = () => {
|
|
35
|
+
const t = o.current?.offsetWidth, e = o.current?.offsetHeight, s = c ? e : t;
|
|
36
|
+
s !== 0 && D(s);
|
|
38
37
|
}, [
|
|
39
|
-
|
|
38
|
+
W,
|
|
39
|
+
S,
|
|
40
40
|
C,
|
|
41
|
-
|
|
42
|
-
M,
|
|
41
|
+
R,
|
|
43
42
|
b,
|
|
44
|
-
|
|
45
|
-
] =
|
|
43
|
+
F
|
|
44
|
+
] = Se(r, z), v = ue(r, S, l), [_, q, A, G, E] = ze(
|
|
46
45
|
r,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
}),
|
|
46
|
+
v,
|
|
47
|
+
C,
|
|
48
|
+
z,
|
|
49
|
+
F,
|
|
50
|
+
l
|
|
51
|
+
), J = m((t) => {
|
|
52
|
+
_(t), j?.(S);
|
|
53
|
+
}), K = m(
|
|
55
54
|
(t, e, s) => {
|
|
56
|
-
const a =
|
|
57
|
-
s ?
|
|
55
|
+
const a = q(t, e);
|
|
56
|
+
s ? u?.(a) : M?.(a);
|
|
58
57
|
}
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
}),
|
|
58
|
+
), L = m((t) => {
|
|
59
|
+
A(), t || u?.(S);
|
|
60
|
+
}), Q = m(
|
|
62
61
|
(t, e) => {
|
|
63
|
-
const s =
|
|
64
|
-
|
|
62
|
+
const s = G(t, e);
|
|
63
|
+
M?.(s), u?.(s);
|
|
65
64
|
}
|
|
66
|
-
),
|
|
65
|
+
), T = fe(
|
|
67
66
|
n,
|
|
68
|
-
|
|
69
|
-
`${n}-${
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
D
|
|
74
|
-
), E = `${n}-mask`, i = p.useMemo(() => {
|
|
67
|
+
k,
|
|
68
|
+
`${n}-${g}`,
|
|
69
|
+
l && [`${n}-rtl`]
|
|
70
|
+
), i = p.useMemo(() => {
|
|
75
71
|
const t = [];
|
|
76
72
|
let e = 0;
|
|
77
73
|
for (let s = 0; s < r.length; s += 1)
|
|
78
|
-
e +=
|
|
74
|
+
e += C[s], t.push(e);
|
|
79
75
|
return t;
|
|
80
|
-
}, [
|
|
81
|
-
return
|
|
82
|
-
const t =
|
|
83
|
-
|
|
76
|
+
}, [C]);
|
|
77
|
+
return ae(() => {
|
|
78
|
+
const t = me([o.current], () => {
|
|
79
|
+
V();
|
|
84
80
|
});
|
|
85
81
|
return () => {
|
|
86
82
|
t();
|
|
87
83
|
};
|
|
88
|
-
}, [o.current]),
|
|
84
|
+
}, [o.current]), le(P, () => ({ dom: o.current })), /* @__PURE__ */ I("div", { style: H, className: T, ref: o, ...B, children: [
|
|
89
85
|
r.map((t, e) => {
|
|
90
|
-
const s = /* @__PURE__ */
|
|
91
|
-
|
|
86
|
+
const s = /* @__PURE__ */ h(
|
|
87
|
+
Ce,
|
|
92
88
|
{
|
|
93
89
|
...t,
|
|
94
90
|
prefixCls: n,
|
|
95
|
-
size:
|
|
91
|
+
size: W[e]
|
|
96
92
|
}
|
|
97
93
|
);
|
|
98
94
|
let a = null;
|
|
99
|
-
const f =
|
|
95
|
+
const f = v[e];
|
|
100
96
|
if (f) {
|
|
101
|
-
const
|
|
102
|
-
a = /* @__PURE__ */
|
|
103
|
-
|
|
97
|
+
const X = (i[e - 1] || 0) + R[e], Y = (i[e + 1] || 100) - b[e + 1], Z = (i[e - 1] || 0) + b[e], ee = (i[e + 1] || 100) - R[e + 1];
|
|
98
|
+
a = /* @__PURE__ */ h(
|
|
99
|
+
de,
|
|
104
100
|
{
|
|
105
|
-
lazy:
|
|
101
|
+
lazy: w,
|
|
106
102
|
index: e,
|
|
107
|
-
active:
|
|
103
|
+
active: E === e,
|
|
108
104
|
prefixCls: n,
|
|
109
|
-
vertical:
|
|
105
|
+
vertical: c,
|
|
110
106
|
resizable: f.resizable,
|
|
111
107
|
ariaNow: i[e] * 100,
|
|
112
|
-
ariaMin: Math.max(
|
|
113
|
-
ariaMax: Math.min(
|
|
108
|
+
ariaMin: Math.max(X, Y) * 100,
|
|
109
|
+
ariaMax: Math.min(Z, ee) * 100,
|
|
114
110
|
startCollapsible: f.startCollapsible,
|
|
115
111
|
endCollapsible: f.endCollapsible,
|
|
116
|
-
onOffsetStart:
|
|
117
|
-
onOffsetUpdate: (
|
|
118
|
-
let
|
|
119
|
-
|
|
112
|
+
onOffsetStart: J,
|
|
113
|
+
onOffsetUpdate: (te, se, ne, oe) => {
|
|
114
|
+
let d = c ? ne : se;
|
|
115
|
+
l && !c && (d = -d), K(te, d, oe);
|
|
120
116
|
},
|
|
121
|
-
onOffsetEnd:
|
|
122
|
-
onCollapse:
|
|
123
|
-
containerSize:
|
|
117
|
+
onOffsetEnd: L,
|
|
118
|
+
onCollapse: Q,
|
|
119
|
+
containerSize: z || 0
|
|
124
120
|
}
|
|
125
121
|
);
|
|
126
122
|
}
|
|
@@ -129,11 +125,11 @@ function Ne(O, $) {
|
|
|
129
125
|
a
|
|
130
126
|
] }, `split-panel-${e}`);
|
|
131
127
|
}),
|
|
132
|
-
typeof
|
|
128
|
+
typeof E == "number" && /* @__PURE__ */ h("div", { "aria-hidden": !0, className: `${n}-mask` })
|
|
133
129
|
] });
|
|
134
130
|
}
|
|
135
|
-
const
|
|
136
|
-
process.env.NODE_ENV !== "production" && (
|
|
131
|
+
const Re = p.forwardRef(Me);
|
|
132
|
+
process.env.NODE_ENV !== "production" && (Re.displayName = "Splitter");
|
|
137
133
|
export {
|
|
138
|
-
|
|
134
|
+
Re as default
|
|
139
135
|
};
|
package/splitter/index.js
CHANGED