@unicom-cloud/ui 0.8.106 → 0.8.107
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/App.js +7 -0
- package/BackTop.js +2 -4
- package/Calendar.js +2 -2
- package/Modal.js +4 -2
- package/app/App.js +26 -0
- package/app/context.js +9 -0
- package/app/index.js +9 -0
- package/app/interface.js +1 -0
- package/app/useApp.js +8 -0
- package/back-top/index.js +44 -56
- package/calendar/Lunar.js +71 -0
- package/calendar/index.js +11 -11
- package/color-picker/index.js +34 -34
- package/components/common/flex/index.js +4 -4
- package/components/common/icons/file/index.js +13 -11
- package/components/common/utils/dayjs.js +99 -124
- package/components/common/utils/is.js +98 -104
- package/components/common/utils/setDir.js +12 -0
- package/components/common/utils/setTheme.js +13 -13
- package/config-provider/ConfigProvider.js +32 -30
- package/descriptions/index.js +32 -32
- package/divider/index.js +28 -20
- package/empty/index.js +1 -1
- package/grid/Grid.js +55 -88
- package/grid/Item.js +40 -61
- package/grid/context.js +1 -4
- package/grid/hook/useResponsiveState.js +22 -25
- package/grid/util.js +6 -44
- package/index.js +462 -457
- package/input/Button.js +12 -12
- package/input/Group.js +11 -12
- package/input/Input.js +112 -102
- package/input/Search.js +24 -24
- package/modal/Confirm.js +17 -17
- package/modal/Modal.js +247 -237
- package/modal/index.js +4 -2
- package/modal/use-modal/index.js +2 -2
- package/package.json +1 -1
- package/select-view/Core.js +31 -28
- package/splitter/SplitBar.js +44 -46
- package/style.css +1 -1
- package/table/Table.js +198 -210
- package/table/th-resizable/index.js +9 -10
- package/time-picker/util.js +20 -30
- package/types/common/development/interface.d.ts +3 -3
- package/types/common/utils/is.d.ts +3 -4
- package/types/common/utils/setDir.d.ts +2 -0
- package/types/pc/app/App.d.ts +6 -0
- package/types/pc/app/context.d.ts +4 -0
- package/types/pc/app/index.d.ts +5 -0
- package/types/pc/app/interface.d.ts +17 -0
- package/types/pc/app/useApp.d.ts +3 -0
- package/types/pc/back-top/interface.d.ts +4 -17
- package/types/pc/calendar/Lunar.d.ts +17 -0
- package/types/pc/calendar/index.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +1 -1
- package/types/pc/divider/interface.d.ts +1 -0
- package/types/pc/grid/Grid.d.ts +1 -2
- package/types/pc/grid/Item.d.ts +2 -5
- package/types/pc/grid/context.d.ts +4 -10
- package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
- package/types/pc/grid/interface.d.ts +9 -19
- package/types/pc/grid/util.d.ts +1 -10
- package/types/pc/index.d.ts +3 -1
- package/types/pc/input/Button.d.ts +2 -2
- package/types/pc/message/index.d.ts +1 -9
- package/types/pc/message/interface.d.ts +8 -0
- package/types/pc/message/useMessage.d.ts +1 -2
- package/types/pc/modal/Modal.d.ts +1 -0
- package/types/pc/modal/config.d.ts +1 -2
- package/types/pc/modal/index.d.ts +2 -1
- package/types/pc/modal/interface.d.ts +17 -5
- package/types/pc/notification/index.d.ts +2 -9
- package/types/pc/notification/interface.d.ts +7 -0
- package/types/pc/notification/useNotification.d.ts +1 -2
- package/types/pc/select-view/Core.d.ts +1 -8
- package/types/pc/select-view/index.d.ts +1 -8
- package/types/pc/select-view/interface.d.ts +9 -2
- package/types/pc/utils/is.d.ts +1 -1
- package/types/pc/utils/names.d.ts +303 -0
- package/utils/index.js +58 -59
- package/utils/is.js +65 -66
- package/utils/names.js +298 -144
- package/version/index.js +1 -1
|
@@ -1,58 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import b from "@unicom-cloud/icons/context";
|
|
3
3
|
import { UI_PC_PREFIX as e } from "@unicom-cloud/utils/constant/ui";
|
|
4
|
-
import
|
|
4
|
+
import d from "lodash/merge";
|
|
5
5
|
import { useEffect as t } from "react";
|
|
6
|
+
import { setDir as D } from "../components/common/utils/setDir.js";
|
|
6
7
|
import { setTheme as E } from "../components/common/utils/setTheme.js";
|
|
7
8
|
import G from "../components/common/hooks/useMergeProps.js";
|
|
8
9
|
import R from "../message/index.js";
|
|
9
10
|
import { setConfigProviderProps as _ } from "../modal/config.js";
|
|
10
11
|
import $ from "../notification/index.js";
|
|
11
|
-
import
|
|
12
|
+
import n, { ConfigProviderDefaultProps as j } from "./context.js";
|
|
12
13
|
const k = j;
|
|
13
|
-
let
|
|
14
|
+
let f = {};
|
|
14
15
|
const y = {};
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
function P(x) {
|
|
17
|
+
const m = G(
|
|
18
|
+
x,
|
|
18
19
|
k,
|
|
19
20
|
y
|
|
20
21
|
), {
|
|
21
|
-
theme:
|
|
22
|
+
theme: s,
|
|
22
23
|
prefixCls: o = e,
|
|
23
|
-
locale:
|
|
24
|
+
locale: p,
|
|
24
25
|
rtl: r,
|
|
25
26
|
effectGlobalNotice: c = !0,
|
|
26
|
-
effectGlobalModal:
|
|
27
|
-
} =
|
|
28
|
-
children:
|
|
29
|
-
isRootConfig:
|
|
30
|
-
keepConfig:
|
|
27
|
+
effectGlobalModal: l = !0
|
|
28
|
+
} = m, {
|
|
29
|
+
children: C,
|
|
30
|
+
isRootConfig: i,
|
|
31
|
+
keepConfig: v,
|
|
31
32
|
// 潘启宝添加
|
|
32
|
-
...
|
|
33
|
-
} =
|
|
34
|
-
(
|
|
35
|
-
const h =
|
|
33
|
+
...g
|
|
34
|
+
} = m;
|
|
35
|
+
(i || v) && (f = d({}, f, g));
|
|
36
|
+
const h = d({}, f, g, {
|
|
36
37
|
getPrefixCls: I
|
|
37
38
|
});
|
|
38
39
|
function I(M, N) {
|
|
39
40
|
return `${N || o || e}-${M}`;
|
|
40
41
|
}
|
|
41
|
-
t(() => (
|
|
42
|
-
}), [
|
|
42
|
+
t(() => (i && D({ prefix: e, dir: r ? "rtl" : "ltr" }), () => {
|
|
43
|
+
}), [i, r]), t(() => (E({ prefix: e, ...s }), () => {
|
|
44
|
+
}), [s]), t(() => {
|
|
43
45
|
c && (R.config({ prefixCls: o, rtl: r }), $.config({ prefixCls: o, rtl: r }));
|
|
44
46
|
}, [o, r, c]), t(() => {
|
|
45
|
-
|
|
46
|
-
}, [
|
|
47
|
-
let
|
|
48
|
-
return o && o !== e && (
|
|
47
|
+
l && _({ locale: p, prefixCls: o, rtl: r });
|
|
48
|
+
}, [p, o, r, l]);
|
|
49
|
+
let u = C;
|
|
50
|
+
return o && o !== e && (u = /* @__PURE__ */ a(b.Provider, { value: { prefixCls: o }, children: C })), /* @__PURE__ */ a(n.Provider, { value: h, children: u });
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
52
|
+
P.ConfigContext = n;
|
|
53
|
+
P.displayName = "ConfigProvider";
|
|
54
|
+
const L = n.Consumer;
|
|
53
55
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
L as ConfigConsumer,
|
|
57
|
+
n as ConfigContext,
|
|
56
58
|
j as ConfigProviderDefaultProps,
|
|
57
|
-
|
|
59
|
+
P as default
|
|
58
60
|
};
|
package/descriptions/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import C from "lodash/isArray";
|
|
3
3
|
import V from "lodash/isNumber";
|
|
4
4
|
import q from "lodash/isPlainObject";
|
|
@@ -30,8 +30,8 @@ function Y(u) {
|
|
|
30
30
|
title: v,
|
|
31
31
|
data: b,
|
|
32
32
|
border: O,
|
|
33
|
-
labelStyle:
|
|
34
|
-
valueStyle:
|
|
33
|
+
labelStyle: $,
|
|
34
|
+
valueStyle: y,
|
|
35
35
|
colon: N,
|
|
36
36
|
layout: m,
|
|
37
37
|
size: g,
|
|
@@ -53,20 +53,20 @@ function Y(u) {
|
|
|
53
53
|
const i = [];
|
|
54
54
|
if (C(b) && b.length > 0 && l) {
|
|
55
55
|
b.forEach((e) => {
|
|
56
|
-
const o = i[i.length - 1],
|
|
57
|
-
|
|
56
|
+
const o = i[i.length - 1], r = z(o);
|
|
57
|
+
r === 0 ? i.push([
|
|
58
58
|
{
|
|
59
59
|
...e,
|
|
60
60
|
span: e.span ? e.span > l ? l : e.span : 1
|
|
61
61
|
}
|
|
62
|
-
]) :
|
|
62
|
+
]) : r === l ? i.push([
|
|
63
63
|
{
|
|
64
64
|
...e,
|
|
65
65
|
span: e.span ? e.span > l ? l : e.span : 1
|
|
66
66
|
}
|
|
67
67
|
]) : o.push({
|
|
68
68
|
...e,
|
|
69
|
-
span: e.span ? e.span +
|
|
69
|
+
span: e.span ? e.span + r > l ? l - r : e.span : 1
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
const s = i[i.length - 1], t = z(s);
|
|
@@ -74,14 +74,14 @@ function Y(u) {
|
|
|
74
74
|
}
|
|
75
75
|
function F(s, t) {
|
|
76
76
|
return /* @__PURE__ */ c(x, { children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
const
|
|
77
|
+
/* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
|
|
78
|
+
const r = e.span > 1 ? { colSpan: e.span } : {};
|
|
79
79
|
return /* @__PURE__ */ c(
|
|
80
80
|
"td",
|
|
81
81
|
{
|
|
82
82
|
className: `${n}-item-label`,
|
|
83
|
-
...
|
|
84
|
-
style:
|
|
83
|
+
...r,
|
|
84
|
+
style: $,
|
|
85
85
|
children: [
|
|
86
86
|
e.label,
|
|
87
87
|
N
|
|
@@ -90,14 +90,14 @@ function Y(u) {
|
|
|
90
90
|
`${e.key || o}_label`
|
|
91
91
|
);
|
|
92
92
|
}) }),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
const
|
|
95
|
-
return /* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
|
|
94
|
+
const r = e.span > 1 ? { colSpan: e.span } : {};
|
|
95
|
+
return /* @__PURE__ */ a(
|
|
96
96
|
"td",
|
|
97
97
|
{
|
|
98
98
|
className: `${n}-item-value`,
|
|
99
|
-
...
|
|
100
|
-
style:
|
|
99
|
+
...r,
|
|
100
|
+
style: y,
|
|
101
101
|
children: e.value
|
|
102
102
|
},
|
|
103
103
|
`${e.key || o}_value`
|
|
@@ -106,19 +106,19 @@ function Y(u) {
|
|
|
106
106
|
] }, t);
|
|
107
107
|
}
|
|
108
108
|
function H(s, t) {
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
const
|
|
109
|
+
return /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
|
|
110
|
+
const r = e.span > 1 ? { colSpan: e.span * 2 - 1 } : {};
|
|
111
111
|
return /* @__PURE__ */ c(x, { children: [
|
|
112
|
-
/* @__PURE__ */ c("td", { className: `${n}-item-label`, style:
|
|
112
|
+
/* @__PURE__ */ c("td", { className: `${n}-item-label`, style: $, children: [
|
|
113
113
|
e.label,
|
|
114
114
|
N
|
|
115
115
|
] }),
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ a(
|
|
117
117
|
"td",
|
|
118
118
|
{
|
|
119
119
|
className: `${n}-item-value`,
|
|
120
|
-
...
|
|
121
|
-
style:
|
|
120
|
+
...r,
|
|
121
|
+
style: y,
|
|
122
122
|
children: e.value
|
|
123
123
|
}
|
|
124
124
|
)
|
|
@@ -126,30 +126,30 @@ function Y(u) {
|
|
|
126
126
|
}) }, t);
|
|
127
127
|
}
|
|
128
128
|
function M(s, t) {
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
const
|
|
129
|
+
return /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
|
|
130
|
+
const r = e.span > 1 ? { colSpan: e.span } : {};
|
|
131
131
|
return /* @__PURE__ */ c(
|
|
132
132
|
"td",
|
|
133
133
|
{
|
|
134
|
-
...
|
|
134
|
+
...r,
|
|
135
135
|
className: `${n}-item`,
|
|
136
136
|
children: [
|
|
137
137
|
/* @__PURE__ */ c(
|
|
138
138
|
"div",
|
|
139
139
|
{
|
|
140
140
|
className: `${n}-item-label-inline`,
|
|
141
|
-
style:
|
|
141
|
+
style: $,
|
|
142
142
|
children: [
|
|
143
143
|
e.label,
|
|
144
144
|
N
|
|
145
145
|
]
|
|
146
146
|
}
|
|
147
147
|
),
|
|
148
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ a(
|
|
149
149
|
"div",
|
|
150
150
|
{
|
|
151
151
|
className: `${n}-item-value-inline`,
|
|
152
|
-
style:
|
|
152
|
+
style: y,
|
|
153
153
|
children: e.value
|
|
154
154
|
}
|
|
155
155
|
)
|
|
@@ -168,14 +168,14 @@ function Y(u) {
|
|
|
168
168
|
[`${n}-border`]: O,
|
|
169
169
|
[`${n}-layout-${m}`]: m,
|
|
170
170
|
[`${n}-size-${g || d}`]: g || d,
|
|
171
|
-
[`${n}-table-layout-fixed`]: j === "fixed"
|
|
172
|
-
[`${n}-rtl`]: I
|
|
171
|
+
[`${n}-table-layout-fixed`]: j === "fixed"
|
|
173
172
|
},
|
|
173
|
+
I ? `${n}-rtl` : `${n}-ltr`,
|
|
174
174
|
L
|
|
175
175
|
);
|
|
176
176
|
return /* @__PURE__ */ c("div", { className: T, style: D, children: [
|
|
177
|
-
v && /* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
177
|
+
v && /* @__PURE__ */ a("div", { className: `${n}-title`, children: v }),
|
|
178
|
+
/* @__PURE__ */ a("div", { className: `${n}-body`, children: /* @__PURE__ */ a("table", { className: `${n}-table`, cellPadding: 0, cellSpacing: 0, children: /* @__PURE__ */ a("tbody", { children: i.map((s, t) => R(s, t)) }) }) })
|
|
179
179
|
] });
|
|
180
180
|
}
|
|
181
181
|
Y.displayName = "Descriptions";
|
package/divider/index.js
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as f, useContext as
|
|
2
|
+
import { forwardRef as f, useContext as D, useMemo as g } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import P from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
6
6
|
import w from "../config-provider/context.js";
|
|
7
7
|
const z = {
|
|
8
8
|
type: "horizontal",
|
|
9
9
|
orientation: "center"
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
const { getPrefixCls:
|
|
11
|
+
function V(n, l) {
|
|
12
|
+
const { getPrefixCls: x, componentConfig: u } = D(w), h = P(
|
|
13
13
|
n,
|
|
14
14
|
z,
|
|
15
|
-
|
|
15
|
+
u?.Divider
|
|
16
16
|
), {
|
|
17
17
|
children: o,
|
|
18
18
|
style: m,
|
|
19
|
-
|
|
19
|
+
textStyle: $,
|
|
20
|
+
className: v,
|
|
20
21
|
type: p,
|
|
21
|
-
orientation:
|
|
22
|
+
orientation: a,
|
|
22
23
|
borderStyle: r,
|
|
23
24
|
// 潘启宝添加
|
|
24
25
|
borderWidth: i,
|
|
25
26
|
// 潘启宝添加
|
|
26
|
-
...
|
|
27
|
-
} = h, s = p === "horizontal", t =
|
|
27
|
+
...N
|
|
28
|
+
} = h, s = p === "horizontal", t = x?.("divider"), C = S(
|
|
28
29
|
t,
|
|
29
30
|
`${t}-${p}`,
|
|
30
31
|
{
|
|
31
32
|
[`${t}-with-text`]: o,
|
|
32
|
-
[`${t}-with-text-${
|
|
33
|
+
[`${t}-with-text-${a}`]: o && a
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
-
),
|
|
35
|
+
v
|
|
36
|
+
), b = g(() => {
|
|
36
37
|
const e = { ...m };
|
|
37
38
|
return r && (s ? e.borderBottomStyle = r : e.borderLeftStyle = r), i && (s ? e.borderBottomWidth = i : e.borderLeftWidth = i), e;
|
|
38
39
|
}, [r, i, s, m]);
|
|
@@ -40,19 +41,26 @@ function S(n, a) {
|
|
|
40
41
|
"div",
|
|
41
42
|
{
|
|
42
43
|
role: "separator",
|
|
43
|
-
ref:
|
|
44
|
-
style:
|
|
45
|
-
className:
|
|
46
|
-
...
|
|
47
|
-
children: o && s ? /* @__PURE__ */ c(
|
|
44
|
+
ref: l,
|
|
45
|
+
style: b,
|
|
46
|
+
className: C,
|
|
47
|
+
...N,
|
|
48
|
+
children: o && s ? /* @__PURE__ */ c(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
style: $,
|
|
52
|
+
className: `${t}-text ${t}-text-${a}`,
|
|
53
|
+
children: o
|
|
54
|
+
}
|
|
55
|
+
) : null
|
|
48
56
|
}
|
|
49
57
|
);
|
|
50
58
|
}
|
|
51
59
|
const d = f(
|
|
52
|
-
|
|
60
|
+
V
|
|
53
61
|
);
|
|
54
62
|
d.displayName = "Divider";
|
|
55
|
-
const y = f((n,
|
|
63
|
+
const y = f((n, l) => /* @__PURE__ */ c(d, { ref: l, type: "vertical", ...n }));
|
|
56
64
|
y.displayName = "DividerVertical";
|
|
57
65
|
d.Vertical = y;
|
|
58
66
|
export {
|
package/empty/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function E(o, t) {
|
|
|
13
13
|
o,
|
|
14
14
|
{},
|
|
15
15
|
e?.Empty
|
|
16
|
-
), { ...n } = p, s = m?.("empty"), i = r
|
|
16
|
+
), { ...n } = p, s = m?.("empty"), i = r?.Empty?.noData;
|
|
17
17
|
return /* @__PURE__ */ a(y, { ref: t, prefixCls: s, description: i, ...n });
|
|
18
18
|
}
|
|
19
19
|
const g = f(c(E));
|
package/grid/Grid.js
CHANGED
|
@@ -1,108 +1,75 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import g, { forwardRef as Q, useState as V, useContext as k } from "react";
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import _ from "lodash/isArray";
|
|
3
|
+
import c from "lodash/isNil";
|
|
4
|
+
import { forwardRef as A, useContext as M } from "react";
|
|
6
5
|
import "../config-provider/ConfigProvider.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
collapsedRows: 1,
|
|
6
|
+
import O from "../components/common/hooks/useMergeProps.js";
|
|
7
|
+
import k from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import "../components/common/utils/is.js";
|
|
9
|
+
import { GridContext as q } from "./context.js";
|
|
10
|
+
import { useResponsiveState as f } from "./hook/useResponsiveState.js";
|
|
11
|
+
import z from "../config-provider/context.js";
|
|
12
|
+
import { isNumber as G, isPlainObject as B } from "@unicom-cloud/utils/is";
|
|
13
|
+
const D = {
|
|
16
14
|
cols: 24,
|
|
17
15
|
gap: 0
|
|
18
16
|
};
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
w,
|
|
24
|
-
O,
|
|
17
|
+
function E(C, u) {
|
|
18
|
+
const { getPrefixCls: g, componentConfig: N, rtl: $ } = M(z), y = O(
|
|
19
|
+
C,
|
|
20
|
+
D,
|
|
25
21
|
N?.Grid
|
|
26
22
|
), {
|
|
27
|
-
children:
|
|
28
|
-
className:
|
|
29
|
-
style:
|
|
30
|
-
cols:
|
|
31
|
-
gap:
|
|
32
|
-
colGap:
|
|
33
|
-
rowGap:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
collapsed: G,
|
|
54
|
-
collapsedRows: $,
|
|
55
|
-
itemDataList: j
|
|
56
|
-
});
|
|
57
|
-
return /* @__PURE__ */ i(
|
|
23
|
+
children: w,
|
|
24
|
+
className: P,
|
|
25
|
+
style: v,
|
|
26
|
+
cols: R,
|
|
27
|
+
gap: e,
|
|
28
|
+
colGap: l,
|
|
29
|
+
rowGap: m
|
|
30
|
+
} = y;
|
|
31
|
+
let t = m, s = l;
|
|
32
|
+
const b = c(e), h = c(m), j = c(l);
|
|
33
|
+
b || (_(e) ? (t = e[0], s = e[1] ?? e[0]) : t = s = e), h || (t = m), j || (s = l);
|
|
34
|
+
const o = f(R, 24), a = f(t, 0), n = f(s, 0), r = {};
|
|
35
|
+
if (a && (r.rowGap = a), n && (r.columnGap = n), G(o))
|
|
36
|
+
r.gridTemplateColumns = `repeat(${o}, minmax(0px, 1fr))`;
|
|
37
|
+
else if (o && B(o) && "type" in o) {
|
|
38
|
+
const T = o.type;
|
|
39
|
+
let i = o.max ?? "1fr";
|
|
40
|
+
G(i) && (i = `${i}px`);
|
|
41
|
+
let p = o.min ?? "0px";
|
|
42
|
+
G(p) && (p = `${p}px`), r.gridTemplateColumns = `repeat(${T}, minmax(${p}, ${i}))`;
|
|
43
|
+
}
|
|
44
|
+
const d = g?.("grid"), S = {
|
|
45
|
+
[`${d}`]: !0,
|
|
46
|
+
[`${d}-rtl`]: $
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ x(
|
|
58
49
|
"div",
|
|
59
50
|
{
|
|
60
|
-
ref:
|
|
61
|
-
className:
|
|
51
|
+
ref: u,
|
|
52
|
+
className: k(S, P),
|
|
62
53
|
style: {
|
|
63
|
-
...
|
|
64
|
-
...
|
|
54
|
+
...r,
|
|
55
|
+
...v
|
|
65
56
|
},
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
|
|
57
|
+
children: /* @__PURE__ */ x(
|
|
58
|
+
q.Provider,
|
|
68
59
|
{
|
|
69
60
|
value: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
removeItemData(e) {
|
|
74
|
-
o.delete(e), c(new Map([...o]));
|
|
75
|
-
}
|
|
61
|
+
cols: o,
|
|
62
|
+
rowGap: a,
|
|
63
|
+
colGap: n
|
|
76
64
|
},
|
|
77
|
-
children:
|
|
78
|
-
H.Provider,
|
|
79
|
-
{
|
|
80
|
-
value: {
|
|
81
|
-
cols: l,
|
|
82
|
-
colGap: u,
|
|
83
|
-
collapsed: G,
|
|
84
|
-
overflow: C.overflow,
|
|
85
|
-
displayIndexList: C.displayIndexList
|
|
86
|
-
},
|
|
87
|
-
children: g.Children.map(y, (e, s) => {
|
|
88
|
-
if (e) {
|
|
89
|
-
const p = {
|
|
90
|
-
__index__: s,
|
|
91
|
-
...e.props
|
|
92
|
-
};
|
|
93
|
-
return g.cloneElement(e, p);
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}).filter((e) => A(e, "type.__PQB_GRID_ITEM__"))
|
|
97
|
-
}
|
|
98
|
-
)
|
|
65
|
+
children: w
|
|
99
66
|
}
|
|
100
67
|
)
|
|
101
68
|
}
|
|
102
69
|
);
|
|
103
70
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
71
|
+
const F = A(E);
|
|
72
|
+
F.displayName = "Grid";
|
|
106
73
|
export {
|
|
107
|
-
|
|
74
|
+
F as default
|
|
108
75
|
};
|
package/grid/Item.js
CHANGED
|
@@ -1,76 +1,55 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import T from "lodash/isString";
|
|
4
|
-
import m, { forwardRef as V, useContext as p, useMemo as c, useEffect as k } from "react";
|
|
1
|
+
import { jsx as R } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w, useContext as p } from "react";
|
|
5
3
|
import "../config-provider/ConfigProvider.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import O from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import b from "@unicom-cloud/utils/class-name";
|
|
6
|
+
import "../components/common/utils/is.js";
|
|
7
|
+
import { GridContext as h } from "./context.js";
|
|
8
|
+
import { useResponsiveState as a } from "./hook/useResponsiveState.js";
|
|
9
|
+
import { resolveItemData as j } from "./util.js";
|
|
10
|
+
import D from "../config-provider/context.js";
|
|
11
|
+
import { isNumber as e } from "@unicom-cloud/utils/is";
|
|
12
|
+
const E = {
|
|
14
13
|
offset: 0,
|
|
15
14
|
span: 1
|
|
16
15
|
};
|
|
17
|
-
function
|
|
18
|
-
const { getPrefixCls:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
function F(f, c) {
|
|
17
|
+
const { getPrefixCls: l, componentConfig: d, rtl: C } = p(D), g = O(
|
|
18
|
+
f,
|
|
19
|
+
E,
|
|
20
|
+
d?.["Grid.Item"]
|
|
22
21
|
), {
|
|
23
|
-
children:
|
|
24
|
-
className:
|
|
25
|
-
style:
|
|
22
|
+
children: u,
|
|
23
|
+
className: x,
|
|
24
|
+
style: $,
|
|
26
25
|
offset: N,
|
|
27
|
-
span:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
32
|
-
[`${
|
|
33
|
-
[`${
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
E(s);
|
|
41
|
-
}), [s, e]);
|
|
42
|
-
const F = c(() => {
|
|
43
|
-
const { offset: t, span: o } = e;
|
|
44
|
-
return t > 0 ? {
|
|
45
|
-
marginLeft: `calc((${`(100% - ${f * (o - 1)}px) / ${o}`} * ${t}) + ${f * t}px)`
|
|
46
|
-
} : {};
|
|
47
|
-
}, [e, f]), L = c(() => {
|
|
48
|
-
const { suffix: t, span: o } = e;
|
|
49
|
-
return t ? `${l - o + 1}` : `span ${o}`;
|
|
50
|
-
}, [e, l]), j = !w || r === 0 ? { display: "none" } : {}, B = {
|
|
51
|
-
gridColumn: `${L} / span ${r}`,
|
|
52
|
-
...F,
|
|
53
|
-
...j
|
|
54
|
-
};
|
|
55
|
-
return /* @__PURE__ */ O(
|
|
26
|
+
span: n
|
|
27
|
+
} = g, G = p(h), { colGap: r, cols: m } = G, I = a(N, 0), S = a(n, 1), { span: t, offset: o } = e(m) ? j(m, {
|
|
28
|
+
span: S,
|
|
29
|
+
offset: I
|
|
30
|
+
}) : {}, i = l?.("grid-item"), y = {
|
|
31
|
+
[`${i}`]: !0,
|
|
32
|
+
[`${i}-rtl`]: C
|
|
33
|
+
}, v = b(y, x), s = {};
|
|
34
|
+
if (e(t) && (s.gridColumnStart = `span ${t}`, e(r) && e(o) && o > 0)) {
|
|
35
|
+
const P = `(100% - ${r * (t - 1)}px) / ${t}`;
|
|
36
|
+
s.marginLeft = `calc(${P} * ${o} + ${r * o}px)`;
|
|
37
|
+
}
|
|
38
|
+
return s.gridColumnEnd = `span ${n}`, /* @__PURE__ */ R(
|
|
56
39
|
"div",
|
|
57
40
|
{
|
|
58
|
-
ref:
|
|
59
|
-
className:
|
|
41
|
+
ref: c,
|
|
42
|
+
className: v,
|
|
60
43
|
style: {
|
|
61
|
-
...
|
|
62
|
-
|
|
44
|
+
...s,
|
|
45
|
+
...$
|
|
63
46
|
},
|
|
64
|
-
children:
|
|
65
|
-
overflow: u,
|
|
66
|
-
...t.props
|
|
67
|
-
}) : t)
|
|
47
|
+
children: u
|
|
68
48
|
}
|
|
69
49
|
);
|
|
70
50
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
I.__PQB_GRID_ITEM__ = !0;
|
|
51
|
+
const L = w(F), M = L;
|
|
52
|
+
M.displayName = "Grid.Item";
|
|
74
53
|
export {
|
|
75
|
-
|
|
54
|
+
M as default
|
|
76
55
|
};
|