@unicom-cloud/ui 0.8.107 → 0.8.108
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/ColorPicker.js +15 -14
- package/Constant.js +4 -0
- package/Copy.js +4 -3
- package/Countdown.js +25 -0
- package/Grid.js +8 -10
- package/LiquidFill.js +4 -3
- package/List.js +7 -6
- package/Marquee.js +4 -3
- package/PageHeader.js +3 -2
- package/QrCode.js +4 -3
- package/RowCol.js +8 -0
- package/Segmented.js +14 -4
- package/Statistic.js +5 -4
- package/Tour.js +4 -3
- package/Transfer.js +4 -2
- package/anchor/Link.js +1 -1
- package/avatar/Group.js +1 -1
- package/button/index.js +52 -51
- package/calendar/Lunar.js +21 -21
- package/cascader/base/node.js +22 -20
- package/cascader/base/store.js +10 -10
- package/cascader/util.js +29 -27
- package/color-picker/Mode.js +8 -7
- package/color-picker/hooks/useColorPicker.js +56 -55
- package/color-picker/index.js +54 -53
- package/color-picker/utils.js +58 -57
- package/components/common/empty/index.js +2 -2
- package/components/common/flex/index.js +64 -55
- package/components/common/flex/interface.js +6 -6
- package/components/common/hooks/useInterval.js +6 -6
- package/components/common/space/index.js +53 -53
- package/components/common/utils/dayjs.js +75 -62
- package/components/common/utils/toArray.js +7 -5
- package/constant/index.js +4 -0
- package/copy/index.js +2 -1
- package/countdown/index.js +113 -0
- package/countdown/interface.js +1 -0
- package/countdown/util.js +29 -0
- package/descriptions/index.js +26 -26
- package/dropdown/Button.js +1 -1
- package/flex/index.js +30 -29
- package/form/FormItem.js +126 -122
- package/grid/Grid.js +40 -41
- package/grid/Item.js +37 -37
- package/grid/context.js +2 -3
- package/grid/index.js +6 -8
- package/hooks/useResponsiveState.js +54 -0
- package/index.js +614 -610
- package/input/InputElement.js +25 -24
- package/layout/Sider.js +1 -1
- package/liquid-fill/index.js +4 -3
- package/list/Item.js +21 -21
- package/list/index.js +53 -52
- package/marquee/index.js +20 -19
- package/marquee-/index.js +4 -3
- package/mentions/util.js +9 -8
- package/package.json +1 -1
- package/page-header/index.js +57 -56
- package/pagination/Pagination.js +89 -92
- package/qr-code/index.js +4 -3
- package/radio/Group.js +1 -1
- package/row-col/Col-.js +88 -0
- package/row-col/Col.js +159 -0
- package/row-col/Row.js +73 -0
- package/row-col/context.js +5 -0
- package/row-col/index.js +11 -0
- package/row-col/interface.js +1 -0
- package/segmented/index.js +257 -206
- package/select/Select.js +191 -191
- package/select/util.js +50 -50
- package/space/index.js +15 -13
- package/statistic/index.js +56 -55
- package/statistic/interface.js +4 -1
- package/style.css +1 -1
- package/table/hook/useColumns.js +27 -26
- package/table/hook/useStickyClassNames.js +9 -8
- package/table/hook/useThResizable.js +4 -3
- package/table/th-resizable/index.js +11 -10
- package/table/thead/index.js +18 -16
- package/timeline/Item.js +1 -1
- package/tour/index.js +4 -3
- package/transfer/index.js +93 -91
- package/trigger/index.js +66 -66
- package/types/common/flex/index.d.ts +3 -9
- package/types/common/flex/interface.d.ts +15 -4
- package/types/common/space/index.d.ts +3 -5
- package/types/common/space/interface.d.ts +2 -0
- package/types/common/utils/dayjs.d.ts +3 -1
- package/types/pc/button/interface.d.ts +2 -2
- package/types/pc/config-provider/interface.d.ts +16 -11
- package/types/pc/constant/index.d.ts +1 -0
- package/types/pc/countdown/interface.d.ts +65 -0
- package/types/pc/countdown/util.d.ts +7 -0
- package/types/pc/flex/index.d.ts +8 -6
- package/types/pc/flex/interface.d.ts +3 -10
- package/types/pc/form/FormItem.d.ts +1 -1
- package/types/pc/form/interface.d.ts +1 -1
- package/types/pc/grid/Grid.d.ts +1 -2
- package/types/pc/grid/Item.d.ts +1 -2
- package/types/pc/grid/context.d.ts +0 -5
- package/types/pc/grid/index.d.ts +4 -6
- package/types/pc/grid/interface.d.ts +7 -125
- package/types/pc/hooks/useResponsiveState.d.ts +3 -0
- package/types/pc/index.d.ts +7 -3
- package/types/pc/list/interface.d.ts +2 -1
- package/types/pc/pagination/PageOption.d.ts +0 -1
- package/types/pc/pagination/interface.d.ts +5 -6
- package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
- package/types/pc/{grid → row-col}/Col.d.ts +1 -2
- package/types/pc/{grid → row-col}/Row.d.ts +1 -2
- package/types/pc/row-col/context.d.ts +6 -0
- package/types/pc/row-col/index.d.ts +7 -0
- package/types/pc/row-col/interface.d.ts +112 -0
- package/types/pc/segmented/index.d.ts +3 -7
- package/types/pc/segmented/interface.d.ts +38 -5
- package/types/pc/space/index.d.ts +5 -7
- package/types/pc/space/interface.d.ts +3 -10
- package/types/pc/statistic/index.d.ts +1 -1
- package/types/pc/statistic/interface.d.ts +1 -49
- package/types/pc/utils/names.d.ts +121 -113
- package/types/pc/utils/responsiveObserve.d.ts +8 -8
- package/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +4 -3
- package/utils/dayjs.js +13 -11
- package/utils/index.js +244 -242
- package/utils/names.js +15 -10
- package/utils/responsiveObserve.js +43 -36
- package/version/index.js +1 -1
- package/grid/Col-.js +0 -86
- package/grid/Col.js +0 -169
- package/grid/Row.js +0 -96
- package/grid/hook/useResponsiveState.js +0 -35
- package/statistic/Countdown.js +0 -56
- package/statistic/util.js +0 -33
- package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
- package/types/pc/statistic/util.d.ts +0 -1
- /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/row-col/Col.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx as U } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as W, useContext as S, useMemo as h, useEffect as X } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
4
|
+
import { COLS as v } from "../constant/index.js";
|
|
5
|
+
import Y from "../components/common/hooks/useMergeProps.js";
|
|
6
|
+
import { useResponsive as Z, isResponsiveValue as tt } from "../hooks/useResponsiveState.js";
|
|
7
|
+
import et from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import "../components/common/utils/is.js";
|
|
9
|
+
import { responsiveArray as P } from "../utils/responsiveObserve.js";
|
|
10
|
+
import { RowContext as rt } from "./context.js";
|
|
11
|
+
import ot from "../config-provider/context.js";
|
|
12
|
+
import { isNil as st, isNumber as f, isPlainObject as G, isArray as nt, isString as it } from "@unicom-cloud/utils/is";
|
|
13
|
+
function ft(I, z) {
|
|
14
|
+
const { getPrefixCls: E, componentConfig: N, rtl: x } = S(ot), o = E?.("col"), F = Y(I, {
|
|
15
|
+
span: v
|
|
16
|
+
// 默认占据 24 列
|
|
17
|
+
}, {
|
|
18
|
+
...N?.Col,
|
|
19
|
+
...N?.GridCol
|
|
20
|
+
}), V = S(rt), { gutter: C, div: l } = V, {
|
|
21
|
+
className: q,
|
|
22
|
+
style: B,
|
|
23
|
+
children: D,
|
|
24
|
+
span: g = v,
|
|
25
|
+
offset: c,
|
|
26
|
+
order: u,
|
|
27
|
+
pull: m,
|
|
28
|
+
push: $,
|
|
29
|
+
xs: k,
|
|
30
|
+
sm: w,
|
|
31
|
+
md: R,
|
|
32
|
+
lg: _,
|
|
33
|
+
xl: L,
|
|
34
|
+
xxl: j,
|
|
35
|
+
xxxl: A,
|
|
36
|
+
flex: y,
|
|
37
|
+
breakpoints: M,
|
|
38
|
+
...H
|
|
39
|
+
} = F, b = !st(y), O = Z(), a = h(() => ({ ...M, xs: k, sm: w, md: R, lg: _, xl: L, xxl: j, xxxl: A }), [M, _, R, w, L, k, j, A]), J = h(() => {
|
|
40
|
+
const t = {
|
|
41
|
+
[`${o}`]: !l,
|
|
42
|
+
[`${o}-order-${u}`]: u,
|
|
43
|
+
[`${o}-${g}`]: !l && !tt(a),
|
|
44
|
+
[`${o}-offset-${c}`]: c,
|
|
45
|
+
[`${o}-pull-${m}`]: m,
|
|
46
|
+
[`${o}-push-${$}`]: $,
|
|
47
|
+
[`${o}-rtl`]: x
|
|
48
|
+
};
|
|
49
|
+
for (const s in a) {
|
|
50
|
+
const i = a[s];
|
|
51
|
+
if (f(i))
|
|
52
|
+
t[`${o}-${s}-${i}`] = !0;
|
|
53
|
+
else if (G(i)) {
|
|
54
|
+
const {
|
|
55
|
+
span: r,
|
|
56
|
+
offset: d,
|
|
57
|
+
order: e,
|
|
58
|
+
pull: p,
|
|
59
|
+
push: n
|
|
60
|
+
} = i;
|
|
61
|
+
t[`${o}-${s}-${r}`] = r, t[`${o}-${s}-offset-${d}`] = d, t[`${o}-${s}-order-${e}`] = e, t[`${o}-${s}-pull-${p}`] = p, t[`${o}-${s}-push-${n}`] = n;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}, [o, l, u, g, a, c, m, $, x]), K = h(() => {
|
|
66
|
+
const t = {};
|
|
67
|
+
if (l)
|
|
68
|
+
return t;
|
|
69
|
+
if (nt(C)) {
|
|
70
|
+
const [s, i] = C;
|
|
71
|
+
if (s) {
|
|
72
|
+
let r = f(s) ? `${s}px` : s;
|
|
73
|
+
r = `calc(${r} / 2)`, t.paddingLeft = r, t.paddingRight = r;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}, [C, l]), Q = h(() => {
|
|
78
|
+
const t = {};
|
|
79
|
+
if (b) {
|
|
80
|
+
const e = y;
|
|
81
|
+
return t.flex = e, it(e) && (["auto", "none"].includes(e) ? t.flex = e : /\d+\w{1,}/.test(e) && (t.flex = `0 0 ${e}`)), f(e) && (t.flex = e), t;
|
|
82
|
+
}
|
|
83
|
+
if (l)
|
|
84
|
+
return t;
|
|
85
|
+
function s(e) {
|
|
86
|
+
return `${100 / v * e}%`;
|
|
87
|
+
}
|
|
88
|
+
function i(e, p) {
|
|
89
|
+
const n = s(p);
|
|
90
|
+
if (x) {
|
|
91
|
+
const T = {
|
|
92
|
+
left: "right",
|
|
93
|
+
right: "left",
|
|
94
|
+
marginLeft: "marginRight",
|
|
95
|
+
marginRight: "marginLeft"
|
|
96
|
+
};
|
|
97
|
+
t[T[e]] = n;
|
|
98
|
+
} else
|
|
99
|
+
t[e] = n;
|
|
100
|
+
}
|
|
101
|
+
const r = {
|
|
102
|
+
span: g,
|
|
103
|
+
offset: c,
|
|
104
|
+
order: u,
|
|
105
|
+
pull: m,
|
|
106
|
+
push: $
|
|
107
|
+
}, d = P.findIndex((e, p, n) => O[e]);
|
|
108
|
+
if (d !== -1) for (let e = d; e < P.length; e++) {
|
|
109
|
+
const p = P[e], n = a[p];
|
|
110
|
+
if (n !== void 0) {
|
|
111
|
+
if (G(n)) {
|
|
112
|
+
Object.assign(r, n);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (f(n)) {
|
|
116
|
+
r.span = n;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (f(r.span)) {
|
|
122
|
+
const e = s(r.span);
|
|
123
|
+
t.width = e, t.flex = `0 0 ${e}`;
|
|
124
|
+
}
|
|
125
|
+
return f(r.offset) && i("marginLeft", r.offset), f(r.pull) && i("right", r.pull), f(r.push) && i("left", r.push), f(r.order) && (t.order = r.order), t;
|
|
126
|
+
}, [
|
|
127
|
+
a,
|
|
128
|
+
l,
|
|
129
|
+
y,
|
|
130
|
+
b,
|
|
131
|
+
c,
|
|
132
|
+
u,
|
|
133
|
+
m,
|
|
134
|
+
$,
|
|
135
|
+
x,
|
|
136
|
+
O,
|
|
137
|
+
g
|
|
138
|
+
]);
|
|
139
|
+
return X(() => () => {
|
|
140
|
+
}, []), /* @__PURE__ */ U(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
ref: z,
|
|
144
|
+
...H,
|
|
145
|
+
style: {
|
|
146
|
+
...B,
|
|
147
|
+
...K,
|
|
148
|
+
...Q
|
|
149
|
+
},
|
|
150
|
+
className: et(b ? o : J, q),
|
|
151
|
+
children: D
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
const lt = W(ft);
|
|
156
|
+
lt.displayName = "Col";
|
|
157
|
+
export {
|
|
158
|
+
lt as default
|
|
159
|
+
};
|
package/row-col/Row.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as N, useContext as h, useEffect as v } from "react";
|
|
3
|
+
import "../config-provider/ConfigProvider.js";
|
|
4
|
+
import P from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import { useResponsiveState as c } from "../hooks/useResponsiveState.js";
|
|
6
|
+
import j from "@unicom-cloud/utils/class-name";
|
|
7
|
+
import "../components/common/utils/is.js";
|
|
8
|
+
import { RowContext as z } from "./context.js";
|
|
9
|
+
import G from "../config-provider/context.js";
|
|
10
|
+
import { isArray as p, isNumber as H } from "@unicom-cloud/utils/is";
|
|
11
|
+
function b(u, g) {
|
|
12
|
+
const { getPrefixCls: d, componentConfig: n, rtl: w } = h(G), r = d?.("row"), R = P(u, {
|
|
13
|
+
gutter: 0,
|
|
14
|
+
align: "start",
|
|
15
|
+
justify: "start"
|
|
16
|
+
}, {
|
|
17
|
+
...n?.Row,
|
|
18
|
+
...n?.GridRow
|
|
19
|
+
}), {
|
|
20
|
+
style: $,
|
|
21
|
+
className: x,
|
|
22
|
+
children: y,
|
|
23
|
+
div: s,
|
|
24
|
+
align: a,
|
|
25
|
+
justify: m,
|
|
26
|
+
gutter: t = 0,
|
|
27
|
+
...C
|
|
28
|
+
} = R, o = c(
|
|
29
|
+
p(t) ? t[0] : t
|
|
30
|
+
), i = c(
|
|
31
|
+
p(t) ? t[1] : 0
|
|
32
|
+
), e = {};
|
|
33
|
+
if (!s) {
|
|
34
|
+
if (o) {
|
|
35
|
+
const f = `calc((${H(o) ? `${o}px` : o} / 2) * -1)`;
|
|
36
|
+
e.marginLeft = f, e.marginRight = f;
|
|
37
|
+
}
|
|
38
|
+
i && (e.rowGap = i);
|
|
39
|
+
}
|
|
40
|
+
return v(() => () => {
|
|
41
|
+
}, []), /* @__PURE__ */ l(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref: g,
|
|
45
|
+
...C,
|
|
46
|
+
style: {
|
|
47
|
+
...$,
|
|
48
|
+
...e
|
|
49
|
+
},
|
|
50
|
+
className: j(
|
|
51
|
+
{
|
|
52
|
+
[`${r}`]: !s,
|
|
53
|
+
[`${r}-align-${a}`]: a,
|
|
54
|
+
[`${r}-justify-${m}`]: m,
|
|
55
|
+
[`${r}-rtl`]: w
|
|
56
|
+
},
|
|
57
|
+
x
|
|
58
|
+
),
|
|
59
|
+
children: /* @__PURE__ */ l(
|
|
60
|
+
z.Provider,
|
|
61
|
+
{
|
|
62
|
+
value: { gutter: [o, i], div: s },
|
|
63
|
+
children: y
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
const A = N(b);
|
|
70
|
+
A.displayName = "Row";
|
|
71
|
+
export {
|
|
72
|
+
A as default
|
|
73
|
+
};
|
package/row-col/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|