@unicom-cloud/ui 0.8.98 → 0.8.99
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 +53 -7
- package/LiquidFill.js +59 -2
- package/Marquee.js +61 -0
- package/QrCode.js +13 -9
- package/Segmented.js +11 -0
- package/Space.js +14 -6
- package/Splitter.js +7 -0
- package/Tour.js +13 -9
- package/badge/index.js +177 -84
- package/collapse/Collapse.js +54 -48
- package/components/common/space/index.js +90 -106
- package/index.js +356 -353
- package/liquid-fill/index.js +255 -2
- package/marquee/index.js +282 -0
- package/menu/Item.js +17 -16
- package/package.json +1 -1
- package/qr-code/index.js +53 -36
- package/rate/index.js +8 -8
- package/segmented/index.js +217 -0
- package/space/index.js +28 -29
- package/splitter/index.js +117 -0
- package/splitter/interface.js +1 -0
- package/style.css +1 -1
- package/tour/index.js +110 -88
- package/types/common/hooks/useMergeProps.d.ts +1 -1
- package/types/common/space/index.d.ts +6 -5
- package/types/common/space/interface.d.ts +29 -16
- package/types/pc/badge/index.d.ts +4 -4
- package/types/pc/badge/interface.d.ts +26 -0
- package/types/pc/collapse/interface.d.ts +4 -0
- package/types/pc/config-provider/interface.d.ts +7 -1
- package/types/pc/date-picker/RangePicker.d.ts +1 -1
- package/types/pc/index.d.ts +10 -4
- package/types/pc/liquid-fill/index.d.ts +114 -1
- package/types/pc/marquee/index.d.ts +61 -0
- package/types/pc/menu/context.d.ts +1 -1
- package/types/pc/qr-code/index.d.ts +1 -1
- package/types/pc/rate/index.d.ts +2 -2
- package/types/pc/segmented/index.d.ts +8 -0
- package/types/pc/segmented/interface.d.ts +88 -0
- package/types/pc/space/index.d.ts +3 -1
- package/types/pc/space/interface.d.ts +6 -10
- package/types/pc/splitter/index.d.ts +4 -0
- package/types/pc/splitter/interface.d.ts +70 -0
- package/types/pc/tour/index.d.ts +6 -1
- package/types/pc/utils/names.d.ts +18 -0
- package/typography/Ellipsis.js +1 -1
- package/utils/names.js +12 -0
- package/version/index.js +1 -1
- package/_virtual/_commonjsHelpers.js +0 -6
- package/_virtual/index.js +0 -7
- package/_virtual/index2.js +0 -4
- package/liquid-fill/LiquidFill.js +0 -226
- package/liquid-fill/LiquidFill2.js +0 -3
- package/space-/index.js +0 -93
- package/types/common/utils/color.d.ts +0 -1
- package/types/common/utils/computeScrollIntoView.d.ts +0 -1
- package/types/common/utils/index.d.ts +0 -45
- package/types/common/utils/math.d.ts +0 -1
- package/types/common/utils/reactTransitionGroup.d.ts +0 -1
- package/types/common/utils/tree.d.ts +0 -1
- package/types/common/utils/tween.d.ts +0 -1
- package/types/common/utils/uuid.d.ts +0 -1
- package/types/common/utils/validate.d.ts +0 -1
- package/types/pc/liquid-fill/LiquidFill.d.ts +0 -115
- package/types/pc/liquid-fill/LiquidFill2.d.ts +0 -1
- package/types/pc/space-/index.d.ts +0 -6
- package/types/pc/space-/interface.d.ts +0 -38
- /package/{space- → components/common/space}/toArray.js +0 -0
- /package/{space- → segmented}/interface.js +0 -0
- /package/types/{pc/space- → common/space}/toArray.d.ts +0 -0
package/qr-code/index.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { useContext as z } from "react";
|
|
2
|
+
import { QRCodeCanvas as b, QRCodeSVG as P } from "qrcode.react";
|
|
3
|
+
import { useContext as Q } from "react";
|
|
5
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
|
+
import "lodash/isEqualWith";
|
|
6
|
+
import "../components/common/utils/is.js";
|
|
7
|
+
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
8
|
+
import "lodash/isNumber";
|
|
9
|
+
import "lodash/merge";
|
|
10
|
+
import "../components/common/utils/dom.js";
|
|
11
|
+
import "../components/common/hooks/useIntersectionObserver.js";
|
|
12
|
+
import R from "../components/common/hooks/useMergeProps.js";
|
|
13
|
+
import "../components/common/utils/reactDOM.js";
|
|
14
|
+
import "@unicom-cloud/utils/constant";
|
|
15
|
+
import "lodash/debounce";
|
|
6
16
|
import "@unicom-cloud/utils/case-name";
|
|
7
|
-
import
|
|
17
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
8
18
|
import "../dist/tinycolor/chunk/BOzCVdr0.js";
|
|
9
19
|
import "@unicom-cloud/utils/constant/ui";
|
|
10
20
|
import "../utils/contextHolder.js";
|
|
11
21
|
import "@unicom-cloud/utils/dayjs";
|
|
12
22
|
import "@unicom-cloud/utils/clipboard-copy";
|
|
13
23
|
import "../components/common/utils/dayjs.js";
|
|
14
|
-
import "../components/common/utils/dom.js";
|
|
15
24
|
import "@unicom-cloud/utils/file/fileToURL";
|
|
16
25
|
import "lodash/escapeRegExp";
|
|
17
26
|
import "lodash/isArray";
|
|
18
|
-
import "lodash/isNumber";
|
|
19
27
|
import "lodash/isString";
|
|
20
28
|
import "lodash/isFunction";
|
|
21
29
|
import "lodash/throttle";
|
|
22
|
-
import "../components/common/utils/is.js";
|
|
23
30
|
import "lodash/camelCase";
|
|
24
31
|
import "lodash/capitalize";
|
|
25
32
|
import "lodash/cloneDeep";
|
|
26
|
-
import "lodash/debounce";
|
|
27
33
|
import "lodash/get";
|
|
28
34
|
import "lodash/has";
|
|
29
35
|
import "lodash/kebabCase";
|
|
@@ -41,7 +47,6 @@ import "../dist/react-transition-group/src/ReplaceTransition.js";
|
|
|
41
47
|
import "../dist/react-transition-group/src/SwitchTransition.js";
|
|
42
48
|
import "../dist/react-transition-group/chunk/CPfP7aNL.js";
|
|
43
49
|
import "../dist/react-transition-group/src/TransitionGroup.js";
|
|
44
|
-
import "../components/common/utils/reactDOM.js";
|
|
45
50
|
import "@unicom-cloud/utils/file/saveAs";
|
|
46
51
|
import "@unicom-cloud/utils/screenfull";
|
|
47
52
|
import "@unicom-cloud/utils/constant/ui.js";
|
|
@@ -49,40 +54,52 @@ import "@unicom-cloud/utils/tree";
|
|
|
49
54
|
import "@unicom-cloud/utils/is";
|
|
50
55
|
import "uuid";
|
|
51
56
|
import "../dist/validate/src/index.js";
|
|
52
|
-
import "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
import h from "../config-provider/context.js";
|
|
58
|
+
const q = {
|
|
59
|
+
renderAs: "svg",
|
|
60
|
+
size: 160,
|
|
61
|
+
bordered: !0,
|
|
62
|
+
errorLevel: "M",
|
|
63
|
+
fgColor: "#000000",
|
|
64
|
+
bgColor: "#ffffff",
|
|
65
|
+
marginSize: 0,
|
|
66
|
+
value: "qr-code"
|
|
67
|
+
}, Mo = (e) => {
|
|
68
|
+
const { getPrefixCls: s, componentConfig: n } = Q(h), d = R(
|
|
69
|
+
e,
|
|
70
|
+
q,
|
|
71
|
+
n?.QRCode
|
|
72
|
+
), {
|
|
73
|
+
value: l,
|
|
74
|
+
renderAs: t,
|
|
75
|
+
size: o,
|
|
76
|
+
bordered: i,
|
|
77
|
+
errorLevel: a,
|
|
78
|
+
fgColor: c,
|
|
79
|
+
bgColor: f,
|
|
80
|
+
marginSize: C = 0,
|
|
81
|
+
imageSettings: g,
|
|
82
|
+
className: u,
|
|
66
83
|
style: v
|
|
67
|
-
} =
|
|
84
|
+
} = d, m = s?.("qrcode"), x = o - (i ? 12 : 0), z = () => {
|
|
68
85
|
const p = {
|
|
69
|
-
value:
|
|
70
|
-
size:
|
|
86
|
+
value: l,
|
|
87
|
+
size: x,
|
|
71
88
|
level: a,
|
|
72
89
|
fgColor: c,
|
|
73
|
-
bgColor:
|
|
74
|
-
marginSize:
|
|
75
|
-
imageSettings:
|
|
90
|
+
bgColor: f,
|
|
91
|
+
marginSize: C,
|
|
92
|
+
imageSettings: g
|
|
76
93
|
};
|
|
77
|
-
return t === "canvas" ? /* @__PURE__ */ r(
|
|
94
|
+
return t === "canvas" ? /* @__PURE__ */ r(b, { ...p }) : /* @__PURE__ */ r(P, { ...p });
|
|
78
95
|
};
|
|
79
96
|
return /* @__PURE__ */ r(
|
|
80
97
|
"div",
|
|
81
98
|
{
|
|
82
|
-
className:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
className: S(
|
|
100
|
+
m,
|
|
101
|
+
i && `${m}-bordered`,
|
|
102
|
+
u,
|
|
86
103
|
`qrcode-${t}`
|
|
87
104
|
),
|
|
88
105
|
style: {
|
|
@@ -90,10 +107,10 @@ const bo = (e) => {
|
|
|
90
107
|
height: o,
|
|
91
108
|
...v
|
|
92
109
|
},
|
|
93
|
-
children:
|
|
110
|
+
children: z()
|
|
94
111
|
}
|
|
95
112
|
);
|
|
96
113
|
};
|
|
97
114
|
export {
|
|
98
|
-
|
|
115
|
+
Mo as default
|
|
99
116
|
};
|
package/rate/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r, jsxs as Y } from "react/jsx-runtime";
|
|
2
2
|
import Z from "@unicom-cloud/icons/IconUiFaceFrownFill";
|
|
3
|
-
import
|
|
3
|
+
import R from "@unicom-cloud/icons/IconUiFaceMehFill";
|
|
4
4
|
import x from "@unicom-cloud/icons/IconUiFaceSmileFill";
|
|
5
5
|
import ee from "@unicom-cloud/icons/IconUiStarFill";
|
|
6
6
|
import { times as oe, div as te } from "@unicom-cloud/utils/math";
|
|
@@ -49,30 +49,30 @@ function ie(H, U) {
|
|
|
49
49
|
}, w = (e, s) => {
|
|
50
50
|
const o = s && a ? e + 0.5 : e + 1;
|
|
51
51
|
o !== f && (P(o), F?.(o));
|
|
52
|
-
},
|
|
52
|
+
}, V = (e, s) => {
|
|
53
53
|
const o = s && a ? e + 0.5 : e + 1;
|
|
54
54
|
M(!0), o !== c ? (I(o), y?.(o)) : T && (I(0), y?.(0), b());
|
|
55
55
|
}, G = (e) => {
|
|
56
56
|
const s = a ? oe(+te(c || 0, 0.5).toFixed(0), 0.5) : Math.round(c), o = f || s;
|
|
57
57
|
let n = typeof l == "function" ? l(e) : l;
|
|
58
|
-
N && (o <= 2 ? n = /* @__PURE__ */ r(Z, {}) : o <= 3 ? n = /* @__PURE__ */ r(
|
|
58
|
+
N && (o <= 2 ? n = /* @__PURE__ */ r(Z, {}) : o <= 3 ? n = /* @__PURE__ */ r(R, {}) : n = /* @__PURE__ */ r(x, {}), o <= e && (n = /* @__PURE__ */ r(R, {})));
|
|
59
59
|
const J = k(`${t}-character`, {
|
|
60
60
|
[`${t}-character-half`]: a && e + 0.5 === o,
|
|
61
61
|
[`${t}-character-full`]: e + 1 <= o,
|
|
62
62
|
[`${t}-character-scale`]: p && e + 1 < c
|
|
63
63
|
}), K = i || m ? {} : {
|
|
64
64
|
onMouseEnter: w.bind(this, e, !0),
|
|
65
|
-
onClick:
|
|
65
|
+
onClick: V.bind(this, e, !0)
|
|
66
66
|
}, O = i || m ? {} : {
|
|
67
67
|
onMouseEnter: w.bind(this, e, !1),
|
|
68
|
-
onClick:
|
|
68
|
+
onClick: V.bind(this, e, !1)
|
|
69
69
|
}, u = $ && $[e], Q = u ? se : E.Fragment, X = u ? { content: u } : {};
|
|
70
|
-
function h(
|
|
70
|
+
function h(A) {
|
|
71
71
|
return {
|
|
72
72
|
role: "radio",
|
|
73
|
-
"aria-checked": e + (
|
|
73
|
+
"aria-checked": e + (A ? 0.5 : 1) <= o,
|
|
74
74
|
"aria-setsize": v,
|
|
75
|
-
"aria-posinset": e + (
|
|
75
|
+
"aria-posinset": e + (A ? 0.5 : 1)
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
return /* @__PURE__ */ r(Q, { ...X, children: /* @__PURE__ */ Y(
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { jsxs as C, jsx as b, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as X, useContext as Y, useMemo as Z, useState as V, useRef as k, useCallback as _, useEffect as I } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
4
|
+
import ee from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
6
|
+
import { resizeObserver as te } from "../components/common/utils/resizeObserver.js";
|
|
7
|
+
import ne from "../config-provider/context.js";
|
|
8
|
+
const re = {
|
|
9
|
+
options: [],
|
|
10
|
+
size: "medium",
|
|
11
|
+
mode: "default",
|
|
12
|
+
disabled: !1,
|
|
13
|
+
block: !1,
|
|
14
|
+
direction: "horizontal",
|
|
15
|
+
showIndicator: !0,
|
|
16
|
+
animationDuration: 300
|
|
17
|
+
}, ae = X(
|
|
18
|
+
(z, u) => {
|
|
19
|
+
const { getPrefixCls: P, componentConfig: E, rtl: M } = Y(ne), j = ee(
|
|
20
|
+
z,
|
|
21
|
+
re,
|
|
22
|
+
E?.Segmented
|
|
23
|
+
), {
|
|
24
|
+
style: B,
|
|
25
|
+
className: K,
|
|
26
|
+
options: D = [],
|
|
27
|
+
defaultValue: v,
|
|
28
|
+
value: N,
|
|
29
|
+
size: L,
|
|
30
|
+
mode: g,
|
|
31
|
+
disabled: d,
|
|
32
|
+
block: U,
|
|
33
|
+
direction: f,
|
|
34
|
+
showIndicator: w,
|
|
35
|
+
animationDuration: F,
|
|
36
|
+
name: A,
|
|
37
|
+
onChange: y,
|
|
38
|
+
...H
|
|
39
|
+
} = j, o = Z(() => D.map((e) => typeof e == "string" ? { value: e, label: e } : e), [D]), [q, O] = V(() => v && o.some((e) => e.value === v) ? v : o[0]?.value || ""), [G, m] = V({}), c = k(null), $ = k([]), R = k(!1), r = P?.("segmented"), J = S(
|
|
40
|
+
r,
|
|
41
|
+
{
|
|
42
|
+
[`${r}-block`]: U,
|
|
43
|
+
[`${r}-disabled`]: d,
|
|
44
|
+
[`${r}-rtl`]: M,
|
|
45
|
+
[`${r}-${g}`]: g,
|
|
46
|
+
[`${r}-${f}`]: f
|
|
47
|
+
},
|
|
48
|
+
K
|
|
49
|
+
), p = N !== void 0, i = p ? N : q, h = _(() => {
|
|
50
|
+
if (!w || !c.current) {
|
|
51
|
+
m((s) => ({ ...s, opacity: 0 }));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const e = o.findIndex(
|
|
55
|
+
(s) => s?.value === i
|
|
56
|
+
);
|
|
57
|
+
if (e === -1) {
|
|
58
|
+
m((s) => ({ ...s, opacity: 0 }));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const a = $.current[e];
|
|
62
|
+
if (!a) {
|
|
63
|
+
m((s) => ({ ...s, opacity: 0 }));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const n = c.current.getBoundingClientRect(), t = a.getBoundingClientRect(), l = f === "vertical" ? {
|
|
67
|
+
width: t.width,
|
|
68
|
+
// 垂直模式下宽度撑满
|
|
69
|
+
top: t.top - n.top,
|
|
70
|
+
height: t.height
|
|
71
|
+
} : {
|
|
72
|
+
width: t.width,
|
|
73
|
+
left: t.left - n.left,
|
|
74
|
+
height: t.height
|
|
75
|
+
// 水平模式下高度撑满
|
|
76
|
+
};
|
|
77
|
+
m({
|
|
78
|
+
...l,
|
|
79
|
+
opacity: 1
|
|
80
|
+
});
|
|
81
|
+
}, [i, o, w, f]), x = (e, a) => {
|
|
82
|
+
a || d || (p || O(e), y?.(e));
|
|
83
|
+
}, Q = (e, a) => {
|
|
84
|
+
if (d) return;
|
|
85
|
+
const n = o.length;
|
|
86
|
+
if (n === 0) return;
|
|
87
|
+
let t = a;
|
|
88
|
+
switch (e.key) {
|
|
89
|
+
case "ArrowLeft":
|
|
90
|
+
case "ArrowUp":
|
|
91
|
+
e.preventDefault(), t = (a - 1 + n) % n;
|
|
92
|
+
break;
|
|
93
|
+
case "ArrowRight":
|
|
94
|
+
case "ArrowDown":
|
|
95
|
+
e.preventDefault(), t = (a + 1) % n;
|
|
96
|
+
break;
|
|
97
|
+
case "Home":
|
|
98
|
+
e.preventDefault(), t = 0;
|
|
99
|
+
break;
|
|
100
|
+
case "End":
|
|
101
|
+
e.preventDefault(), t = n - 1;
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
for (; t !== a && o[t]?.disabled; )
|
|
107
|
+
t = (t + (e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1) + n) % n;
|
|
108
|
+
const l = o[t]?.value;
|
|
109
|
+
l && l !== i && (x(l), $.current[t]?.focus());
|
|
110
|
+
};
|
|
111
|
+
I(() => {
|
|
112
|
+
if (!R.current) {
|
|
113
|
+
R.current = !0;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!o.some((e) => e.value === i)) {
|
|
117
|
+
const e = o[0]?.value || "";
|
|
118
|
+
p || O(e), y?.(e);
|
|
119
|
+
}
|
|
120
|
+
}, [o, i, p, y]), I(() => {
|
|
121
|
+
h();
|
|
122
|
+
}, [i, o, h]), I(() => {
|
|
123
|
+
if (!c.current) return;
|
|
124
|
+
const e = te(
|
|
125
|
+
[c.current],
|
|
126
|
+
() => {
|
|
127
|
+
h();
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
return () => {
|
|
131
|
+
e();
|
|
132
|
+
};
|
|
133
|
+
}, [h]);
|
|
134
|
+
const T = (e, a) => {
|
|
135
|
+
if (e.render)
|
|
136
|
+
return e.render(e, a);
|
|
137
|
+
const n = !e.label && !!e.icon;
|
|
138
|
+
return /* @__PURE__ */ C(W, { children: [
|
|
139
|
+
e.icon && /* @__PURE__ */ b("span", { className: `${r}-option-icon`, children: e.icon }),
|
|
140
|
+
!n && e.label && /* @__PURE__ */ b("span", { className: `${r}-option-label`, children: e.label })
|
|
141
|
+
] });
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ C(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
ref: (e) => {
|
|
147
|
+
typeof u == "function" ? u(e) : u && (u.current = e), c.current = e;
|
|
148
|
+
},
|
|
149
|
+
...H,
|
|
150
|
+
style: B,
|
|
151
|
+
className: J,
|
|
152
|
+
role: "radiogroup",
|
|
153
|
+
children: [
|
|
154
|
+
!Array.isArray(o) || o.length === 0 ? null : o.map((e, a) => {
|
|
155
|
+
if (!e) return null;
|
|
156
|
+
const n = e.value === i, t = e.disabled || d, l = !e.label && !!e.icon;
|
|
157
|
+
return /* @__PURE__ */ C(
|
|
158
|
+
"button",
|
|
159
|
+
{
|
|
160
|
+
ref: (s) => $.current[a] = s,
|
|
161
|
+
className: S(
|
|
162
|
+
`${r}-option`,
|
|
163
|
+
`${r}-option-${L}`,
|
|
164
|
+
`${r}-option-${g}`,
|
|
165
|
+
{
|
|
166
|
+
[`${r}-option-active`]: n,
|
|
167
|
+
[`${r}-option-disabled`]: t,
|
|
168
|
+
[`${r}-option-icon-only`]: l
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
onClick: () => x(e.value, t),
|
|
172
|
+
onKeyDown: (s) => Q(s, a),
|
|
173
|
+
disabled: t,
|
|
174
|
+
role: "radio",
|
|
175
|
+
"aria-checked": n,
|
|
176
|
+
"aria-disabled": t,
|
|
177
|
+
tabIndex: n ? 0 : -1,
|
|
178
|
+
children: [
|
|
179
|
+
A && /* @__PURE__ */ b(
|
|
180
|
+
"input",
|
|
181
|
+
{
|
|
182
|
+
type: "radio",
|
|
183
|
+
name: A,
|
|
184
|
+
value: e.value,
|
|
185
|
+
checked: n,
|
|
186
|
+
onChange: () => {
|
|
187
|
+
},
|
|
188
|
+
className: `${r}-input`,
|
|
189
|
+
tabIndex: -1,
|
|
190
|
+
"aria-hidden": "true"
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
T(e, n)
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
e.value || a
|
|
197
|
+
);
|
|
198
|
+
}),
|
|
199
|
+
w && /* @__PURE__ */ b(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
className: `${r}-indicator`,
|
|
203
|
+
style: {
|
|
204
|
+
...G,
|
|
205
|
+
transitionDuration: `${F}ms`
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
ae.displayName = "Segmented";
|
|
215
|
+
export {
|
|
216
|
+
ae as default
|
|
217
|
+
};
|
package/space/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { SpaceVertical as J } from "../components/common/space/index.js";
|
|
2
|
+
import { forwardRef as C, useContext as d } from "react";
|
|
3
|
+
import u, { SpaceVertical as x } from "../components/common/space/index.js";
|
|
5
4
|
import "../config-provider/ConfigProvider.js";
|
|
6
5
|
import "lodash/isEqualWith";
|
|
7
6
|
import "../components/common/utils/is.js";
|
|
@@ -10,43 +9,43 @@ import "lodash/isNumber";
|
|
|
10
9
|
import "lodash/merge";
|
|
11
10
|
import "../components/common/utils/dom.js";
|
|
12
11
|
import "../components/common/hooks/useIntersectionObserver.js";
|
|
13
|
-
import
|
|
12
|
+
import N from "../components/common/hooks/useMergeProps.js";
|
|
14
13
|
import "../components/common/utils/reactDOM.js";
|
|
15
14
|
import "@unicom-cloud/utils/constant";
|
|
16
15
|
import "lodash/debounce";
|
|
17
|
-
import
|
|
16
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
18
17
|
import $ from "../config-provider/context.js";
|
|
19
|
-
const
|
|
20
|
-
|
|
18
|
+
const g = {
|
|
19
|
+
size: "small",
|
|
21
20
|
direction: "horizontal"
|
|
22
21
|
};
|
|
23
|
-
function
|
|
24
|
-
const { getPrefixCls:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
), { className:
|
|
29
|
-
e && (o.gap = e), i && (o.alignItems = i);
|
|
30
|
-
const r = s?.("space");
|
|
22
|
+
function w(e, i) {
|
|
23
|
+
const { getPrefixCls: m, componentConfig: s, rtl: a } = d($), c = N(
|
|
24
|
+
e,
|
|
25
|
+
g,
|
|
26
|
+
s?.Space
|
|
27
|
+
), { className: n, direction: o, wrap: t, ...f } = c, r = m?.("space");
|
|
31
28
|
return /* @__PURE__ */ l(
|
|
32
|
-
|
|
29
|
+
u,
|
|
33
30
|
{
|
|
34
|
-
ref:
|
|
35
|
-
className:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
`${r}-${
|
|
39
|
-
|
|
31
|
+
ref: i,
|
|
32
|
+
className: S(
|
|
33
|
+
r,
|
|
34
|
+
t && `${r}-wrap`,
|
|
35
|
+
o && `${r}-${o}`,
|
|
36
|
+
n
|
|
40
37
|
),
|
|
41
|
-
direction:
|
|
42
|
-
wrap:
|
|
43
|
-
|
|
38
|
+
direction: o,
|
|
39
|
+
wrap: t,
|
|
40
|
+
rtl: a,
|
|
41
|
+
...f
|
|
44
42
|
}
|
|
45
43
|
);
|
|
46
44
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
45
|
+
const p = C(w);
|
|
46
|
+
p.displayName = "Space";
|
|
47
|
+
p.Vertical = x;
|
|
49
48
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
x as SpaceVertical,
|
|
50
|
+
p as default
|
|
52
51
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsxs as k, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as P, useRef as m, useCallback as i, useEffect as C } from "react";
|
|
3
|
+
const I = {
|
|
4
|
+
direction: "horizontal",
|
|
5
|
+
initialSize: 0.5,
|
|
6
|
+
minSize: "10%",
|
|
7
|
+
maxSize: "90%",
|
|
8
|
+
gutterSize: 8,
|
|
9
|
+
disabled: !1
|
|
10
|
+
}, A = (b) => {
|
|
11
|
+
const {
|
|
12
|
+
direction: e,
|
|
13
|
+
initialSize: D,
|
|
14
|
+
minSize: M,
|
|
15
|
+
maxSize: E,
|
|
16
|
+
gutterSize: c,
|
|
17
|
+
gutterStyle: W,
|
|
18
|
+
disabled: a,
|
|
19
|
+
onDragStart: h,
|
|
20
|
+
onDragEnd: z,
|
|
21
|
+
onDrag: p,
|
|
22
|
+
firstPane: L,
|
|
23
|
+
secondPane: N,
|
|
24
|
+
style: H,
|
|
25
|
+
className: R
|
|
26
|
+
} = { ...I, ...b }, [o, j] = P(D), [r, S] = P(!1), n = m(null), g = m(0), v = m(0), y = i(
|
|
27
|
+
(t) => {
|
|
28
|
+
if (typeof t == "string") {
|
|
29
|
+
if (t.endsWith("%"))
|
|
30
|
+
return parseFloat(t) / 100;
|
|
31
|
+
if (t.endsWith("px") && n.current) {
|
|
32
|
+
const w = parseFloat(t), d = e === "horizontal" ? n.current.offsetWidth : n.current.offsetHeight;
|
|
33
|
+
return w / d;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
},
|
|
38
|
+
[e]
|
|
39
|
+
), x = y(M), $ = y(E), F = i(
|
|
40
|
+
(t) => {
|
|
41
|
+
a || (S(!0), g.current = e === "horizontal" ? t.clientX : t.clientY, v.current = o, document.body.style.cursor = e === "horizontal" ? "col-resize" : "row-resize", document.body.style.userSelect = "none", h?.());
|
|
42
|
+
},
|
|
43
|
+
[e, a, o, h]
|
|
44
|
+
), l = i(
|
|
45
|
+
(t) => {
|
|
46
|
+
if (!r || !n.current) return;
|
|
47
|
+
const d = (e === "horizontal" ? t.clientX : t.clientY) - g.current, Y = e === "horizontal" ? n.current.offsetWidth : n.current.offsetHeight;
|
|
48
|
+
let s = v.current + d / Y;
|
|
49
|
+
s = Math.max(x, Math.min($, s)), j(s), p?.(s);
|
|
50
|
+
},
|
|
51
|
+
[r, e, x, $, p]
|
|
52
|
+
), u = i(() => {
|
|
53
|
+
r && (S(!1), document.body.style.cursor = "", document.body.style.userSelect = "", z?.(o));
|
|
54
|
+
}, [r, o, z]);
|
|
55
|
+
C(() => (document.addEventListener("mousemove", l), document.addEventListener("mouseup", u), () => {
|
|
56
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", u);
|
|
57
|
+
}), [l, u]);
|
|
58
|
+
const V = `calc(${o * 100}% - ${c / 2}px)`, X = `calc(${(1 - o) * 100}% - ${c / 2}px)`;
|
|
59
|
+
return /* @__PURE__ */ k(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
ref: n,
|
|
63
|
+
className: `splitter-container ${e} ${R}`,
|
|
64
|
+
style: {
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: e === "horizontal" ? "row" : "column",
|
|
67
|
+
width: "100%",
|
|
68
|
+
height: "100%",
|
|
69
|
+
overflow: "hidden",
|
|
70
|
+
...H
|
|
71
|
+
},
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ f(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "splitter-pane first",
|
|
77
|
+
style: {
|
|
78
|
+
flex: `0 0 ${V}`,
|
|
79
|
+
overflow: "auto",
|
|
80
|
+
minWidth: 0,
|
|
81
|
+
minHeight: 0
|
|
82
|
+
},
|
|
83
|
+
children: L
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ f(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: `splitter-gutter ${e} ${r ? "active" : ""} ${a ? "disabled" : ""}`,
|
|
90
|
+
style: {
|
|
91
|
+
[e === "horizontal" ? "width" : "height"]: c,
|
|
92
|
+
...W
|
|
93
|
+
},
|
|
94
|
+
onMouseDown: F
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ f(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: "splitter-pane second",
|
|
101
|
+
style: {
|
|
102
|
+
flex: `0 0 ${X}`,
|
|
103
|
+
overflow: "auto",
|
|
104
|
+
minWidth: 0,
|
|
105
|
+
minHeight: 0
|
|
106
|
+
},
|
|
107
|
+
children: N
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
A as Splitter,
|
|
116
|
+
A as default
|
|
117
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|