@unicom-cloud/ui 0.8.106 → 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/App.js +7 -0
- package/BackTop.js +2 -4
- package/Calendar.js +2 -2
- 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/Modal.js +4 -2
- 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/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/avatar/Group.js +1 -1
- package/back-top/index.js +44 -56
- package/button/index.js +52 -51
- package/calendar/Lunar.js +71 -0
- package/calendar/index.js +11 -11
- 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 +49 -48
- 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/icons/file/index.js +13 -11
- package/components/common/space/index.js +53 -53
- package/components/common/utils/dayjs.js +114 -126
- 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/components/common/utils/toArray.js +7 -5
- package/config-provider/ConfigProvider.js +32 -30
- 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 +45 -45
- package/divider/index.js +28 -20
- package/dropdown/Button.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +30 -29
- package/form/FormItem.js +126 -122
- package/grid/Grid.js +56 -90
- package/grid/Item.js +44 -65
- package/grid/context.js +2 -6
- package/grid/index.js +6 -8
- package/grid/util.js +6 -44
- package/hooks/useResponsiveState.js +54 -0
- package/index.js +614 -605
- package/input/Button.js +12 -12
- package/input/Group.js +11 -12
- package/input/Input.js +112 -102
- package/input/InputElement.js +25 -24
- package/input/Search.js +24 -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/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/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/select-view/Core.js +31 -28
- package/space/index.js +15 -13
- package/splitter/SplitBar.js +44 -46
- package/statistic/index.js +56 -55
- package/statistic/interface.js +4 -1
- package/style.css +1 -1
- package/table/Table.js +198 -210
- 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 +2 -2
- package/table/thead/index.js +18 -16
- package/time-picker/util.js +20 -30
- 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/development/interface.d.ts +3 -3
- 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/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/button/interface.d.ts +2 -2
- 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 +17 -12
- 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/divider/interface.d.ts +1 -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 +2 -4
- package/types/pc/grid/Item.d.ts +1 -5
- package/types/pc/grid/context.d.ts +4 -15
- package/types/pc/grid/index.d.ts +4 -6
- package/types/pc/grid/interface.d.ts +14 -142
- package/types/pc/grid/util.d.ts +1 -10
- package/types/pc/hooks/useResponsiveState.d.ts +3 -0
- package/types/pc/index.d.ts +10 -4
- package/types/pc/input/Button.d.ts +2 -2
- package/types/pc/list/interface.d.ts +2 -1
- 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/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/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/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/is.d.ts +1 -1
- package/types/pc/utils/names.d.ts +422 -111
- 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 +245 -244
- package/utils/is.js +65 -66
- package/utils/names.js +309 -150
- 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 -38
- 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/form/FormItem.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsx as i, jsxs as q, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import W, { forwardRef as ae, useContext as F, useState as _, useRef as me, useEffect as de, useMemo as z, createElement as H, cloneElement as K } from "react";
|
|
3
|
+
import ce from "lodash/isArray";
|
|
4
|
+
import pe from "lodash/isFunction";
|
|
5
|
+
import C from "lodash/isPlainObject";
|
|
6
6
|
import x from "lodash/isUndefined";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
|
-
import "../
|
|
9
|
-
import fe from "../
|
|
8
|
+
import ue from "../components/common/hooks/useMergeProps.js";
|
|
9
|
+
import fe from "../row-col/index.js";
|
|
10
10
|
import { PqbCSSTransition as be } from "../components/common/utils/PqbCSSTransition.js";
|
|
11
|
-
import
|
|
12
|
-
import { omit as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { FormItemContext as
|
|
16
|
-
import { VALIDATE_STATUS as
|
|
11
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
12
|
+
import { omit as he } from "../components/common/utils/omit.js";
|
|
13
|
+
import I from "./Control.js";
|
|
14
|
+
import ge from "./FormLabel.js";
|
|
15
|
+
import { FormItemContext as B, FormListContext as Ce, FormContext as G } from "./context.js";
|
|
16
|
+
import { VALIDATE_STATUS as T } from "./interface.js";
|
|
17
17
|
import { formatValidateMsg as xe } from "./util.js";
|
|
18
18
|
import ye from "../config-provider/context.js";
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
help: b,
|
|
19
|
+
import J from "../row-col/Col.js";
|
|
20
|
+
const ve = ({
|
|
21
|
+
prefixCls: b,
|
|
22
|
+
help: h,
|
|
24
23
|
errors: e,
|
|
25
|
-
warnings:
|
|
24
|
+
warnings: N
|
|
26
25
|
}) => {
|
|
27
|
-
const g = e.map((
|
|
28
|
-
if (
|
|
29
|
-
return /* @__PURE__ */ i("div", { role: "alert", children:
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */ i("div", { role: "alert", className: `${
|
|
26
|
+
const g = e.map((u, d) => {
|
|
27
|
+
if (u)
|
|
28
|
+
return /* @__PURE__ */ i("div", { role: "alert", children: u.message }, d);
|
|
29
|
+
}), p = [];
|
|
30
|
+
N.map((u, d) => {
|
|
31
|
+
p.push(
|
|
32
|
+
/* @__PURE__ */ i("div", { role: "alert", className: `${b}-message-help-warning`, children: u }, d)
|
|
34
33
|
);
|
|
35
34
|
});
|
|
36
|
-
const y = !x(
|
|
37
|
-
return
|
|
35
|
+
const y = !x(h) || !!p.length, f = y || !!g.length;
|
|
36
|
+
return f && /* @__PURE__ */ i(
|
|
38
37
|
be,
|
|
39
38
|
{
|
|
40
|
-
in:
|
|
39
|
+
in: f,
|
|
41
40
|
appear: !0,
|
|
42
41
|
classNames: "formblink",
|
|
43
42
|
timeout: 300,
|
|
@@ -45,109 +44,96 @@ const we = ({
|
|
|
45
44
|
children: /* @__PURE__ */ i(
|
|
46
45
|
"div",
|
|
47
46
|
{
|
|
48
|
-
className:
|
|
49
|
-
[`${
|
|
47
|
+
className: S(`${b}-message`, {
|
|
48
|
+
[`${b}-message-help`]: y
|
|
50
49
|
}),
|
|
51
|
-
children: x(
|
|
50
|
+
children: x(h) ? /* @__PURE__ */ q(ie, { children: [
|
|
52
51
|
g.length > 0 && g,
|
|
53
|
-
|
|
54
|
-
] }) :
|
|
52
|
+
p.length > 0 && p
|
|
53
|
+
] }) : h
|
|
55
54
|
}
|
|
56
55
|
)
|
|
57
56
|
}
|
|
58
57
|
);
|
|
59
|
-
},
|
|
58
|
+
}, we = {
|
|
60
59
|
trigger: "onChange",
|
|
61
60
|
triggerPropName: "value"
|
|
62
|
-
}, $e = (
|
|
63
|
-
const e =
|
|
64
|
-
if (
|
|
61
|
+
}, $e = (b, h) => {
|
|
62
|
+
const e = ue(b, we), { getPrefixCls: N, prefixCls: g } = F(ye), p = F(B), y = F(Ce), [f, u] = _(null), [d, A] = _(null), r = F(G), c = r.prefixCls || N?.("form"), l = `${c}-item`, D = e.layout || r.layout, Q = e.labelAlign || r.labelAlign, P = me(!1), L = !e.labelCol && !r.labelCol, M = !e.wrapperCol && !r.wrapperCol, X = (n, o = {}) => {
|
|
63
|
+
if (P.current)
|
|
65
64
|
return;
|
|
66
|
-
const { errors: m, warnings: s } =
|
|
67
|
-
|
|
68
|
-
const a = { ...
|
|
65
|
+
const { errors: m, warnings: s } = o || {};
|
|
66
|
+
u((t) => {
|
|
67
|
+
const a = { ...t || {} };
|
|
69
68
|
return m ? a[n] = m : delete a[n], a;
|
|
70
|
-
}),
|
|
71
|
-
const a = { ...
|
|
69
|
+
}), A((t) => {
|
|
70
|
+
const a = { ...t || {} };
|
|
72
71
|
return s && s.length ? a[n] = s : delete a[n], a;
|
|
73
72
|
});
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
}, Y = C(e.noStyle) && e.noStyle.showErrorTip && p.updateFormItem ? p.updateFormItem : X;
|
|
74
|
+
de(() => (P.current = !1, () => {
|
|
75
|
+
P.current = !0, u(null), A(null);
|
|
77
76
|
}), []);
|
|
78
|
-
const
|
|
77
|
+
const Z = {
|
|
79
78
|
...r,
|
|
80
79
|
validateMessages: r.validateMessages && xe(r.validateMessages, {
|
|
81
80
|
label: e.label
|
|
82
81
|
}),
|
|
83
|
-
prefixCls:
|
|
84
|
-
updateFormItem:
|
|
82
|
+
prefixCls: c,
|
|
83
|
+
updateFormItem: Y,
|
|
85
84
|
disabled: "disabled" in e ? e.disabled : r.disabled
|
|
86
|
-
}, { label:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
return
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[`${l}-item-status-${w}`]: w,
|
|
100
|
-
[`${l}-item-has-help`]: V,
|
|
101
|
-
[`${l}-item-hidden`]: re,
|
|
102
|
-
[`${l}-item-has-feedback`]: w && e.hasFeedback
|
|
103
|
-
},
|
|
104
|
-
`${l}-layout-${q}`,
|
|
105
|
-
Z
|
|
106
|
-
), O = () => {
|
|
107
|
-
const { field: n, children: t } = e, m = "disabled" in e ? e.disabled : r.disabled;
|
|
108
|
-
if (ue(t)) {
|
|
109
|
-
const { key: s, ...o } = e ?? {};
|
|
110
|
-
return /* @__PURE__ */ z(
|
|
111
|
-
$,
|
|
85
|
+
}, { label: v, extra: j, className: ee, style: re, validateStatus: w, hidden: oe, ...te } = e, V = f ? Object.values(f) : [], k = d ? Object.values(d).reduce((n, o) => n.concat(o), []) : [], $ = z(() => {
|
|
86
|
+
if (w)
|
|
87
|
+
return w;
|
|
88
|
+
if (V.length)
|
|
89
|
+
return T.error;
|
|
90
|
+
if (k.length)
|
|
91
|
+
return T.warning;
|
|
92
|
+
}, [f, d, w]), O = z(() => !x(e.help) || k.length > 0, [e.help, d]), R = () => {
|
|
93
|
+
const { field: n, children: o } = e, m = "disabled" in e ? e.disabled : r.disabled;
|
|
94
|
+
if (pe(o)) {
|
|
95
|
+
const { key: s, ...t } = e ?? {};
|
|
96
|
+
return /* @__PURE__ */ H(
|
|
97
|
+
I,
|
|
112
98
|
{
|
|
113
99
|
disabled: m,
|
|
114
|
-
...
|
|
100
|
+
...t,
|
|
115
101
|
key: n || s,
|
|
116
102
|
_key: n || s
|
|
117
103
|
},
|
|
118
|
-
(...a) =>
|
|
104
|
+
(...a) => o(
|
|
119
105
|
...a
|
|
120
106
|
)
|
|
121
107
|
);
|
|
122
108
|
}
|
|
123
|
-
if (
|
|
124
|
-
const s =
|
|
125
|
-
const
|
|
126
|
-
return
|
|
109
|
+
if (ce(o)) {
|
|
110
|
+
const s = W.Children.map(o, (t, a) => {
|
|
111
|
+
const U = C(t) && t.key || a, ne = C(t) && "disabled" in t.props, se = !x(m) && !ne ? { key: U, disabled: m } : { key: U };
|
|
112
|
+
return C(t) ? K(t, se) : t;
|
|
127
113
|
});
|
|
128
|
-
return /* @__PURE__ */ i(
|
|
114
|
+
return /* @__PURE__ */ i(I, { ...e, field: void 0, children: s });
|
|
129
115
|
}
|
|
130
|
-
if (
|
|
116
|
+
if (W.Children.count(o) == 1) {
|
|
131
117
|
if (n) {
|
|
132
118
|
const s = y?.getItemKey?.(n) || n;
|
|
133
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ H(I, { disabled: m, ...e, key: s, _key: s }, o);
|
|
134
120
|
}
|
|
135
|
-
if (
|
|
136
|
-
if (
|
|
137
|
-
return
|
|
138
|
-
const
|
|
139
|
-
return /* @__PURE__ */ i(
|
|
121
|
+
if (C(o)) {
|
|
122
|
+
if (o.type?.isFormControl)
|
|
123
|
+
return o;
|
|
124
|
+
const t = !("disabled" in o.props) && !x(m) ? { disabled: m } : null;
|
|
125
|
+
return /* @__PURE__ */ i(I, { ...e, field: void 0, children: t ? K(o, t) : o });
|
|
140
126
|
}
|
|
141
127
|
}
|
|
142
|
-
return
|
|
143
|
-
},
|
|
128
|
+
return o;
|
|
129
|
+
}, le = B, E = {
|
|
144
130
|
...r
|
|
145
131
|
};
|
|
146
|
-
return e.noStyle || (
|
|
147
|
-
|
|
132
|
+
return e.noStyle || (E.wrapperCol = void 0, E.labelCol = void 0), /* @__PURE__ */ i(G.Provider, { value: E, children: /* @__PURE__ */ i(le.Provider, { value: Z, children: e.noStyle ? R() : /* @__PURE__ */ q(
|
|
133
|
+
fe,
|
|
148
134
|
{
|
|
149
|
-
ref:
|
|
150
|
-
...
|
|
135
|
+
ref: h,
|
|
136
|
+
...he(te, [
|
|
151
137
|
"tooltip",
|
|
152
138
|
"children",
|
|
153
139
|
"prefixCls",
|
|
@@ -177,29 +163,43 @@ const we = ({
|
|
|
177
163
|
"requiredSymbol",
|
|
178
164
|
"isFormList"
|
|
179
165
|
]),
|
|
180
|
-
className:
|
|
181
|
-
|
|
182
|
-
|
|
166
|
+
className: S(
|
|
167
|
+
l,
|
|
168
|
+
{
|
|
169
|
+
[`${l}-error`]: O || !w && $ === T.error,
|
|
170
|
+
[`${l}-status-${$}`]: $,
|
|
171
|
+
[`${l}-has-help`]: O,
|
|
172
|
+
[`${l}-hidden`]: oe,
|
|
173
|
+
[`${l}-has-feedback`]: $ && e.hasFeedback
|
|
174
|
+
},
|
|
175
|
+
`${c}-layout-${D}`,
|
|
176
|
+
v ? `${l}-has-label` : `${l}-no-label`,
|
|
177
|
+
ee
|
|
178
|
+
),
|
|
179
|
+
div: D !== "horizontal",
|
|
180
|
+
style: re,
|
|
183
181
|
children: [
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
!!v && /* @__PURE__ */ i(
|
|
183
|
+
J,
|
|
186
184
|
{
|
|
187
|
-
className:
|
|
188
|
-
|
|
185
|
+
className: S(
|
|
186
|
+
`${l}-label`,
|
|
187
|
+
`${c}-label-item`,
|
|
189
188
|
e.labelCol?.className,
|
|
190
189
|
r.labelCol?.className,
|
|
191
190
|
{
|
|
192
|
-
[`${
|
|
191
|
+
[`${c}-label-item-left`]: Q === "left",
|
|
192
|
+
[`${c}-label-item-flex`]: L
|
|
193
193
|
}
|
|
194
194
|
),
|
|
195
|
-
flex:
|
|
195
|
+
flex: L ? 0 : void 0,
|
|
196
196
|
...e.labelCol || r.labelCol,
|
|
197
197
|
children: /* @__PURE__ */ i(
|
|
198
|
-
|
|
198
|
+
ge,
|
|
199
199
|
{
|
|
200
200
|
tooltip: e.tooltip,
|
|
201
201
|
htmlFor: e.field && r?.getFormElementId?.(e.field),
|
|
202
|
-
label:
|
|
202
|
+
label: v,
|
|
203
203
|
prefix: g,
|
|
204
204
|
requiredSymbol: "requiredSymbol" in e ? e.requiredSymbol : r.requiredSymbol,
|
|
205
205
|
required: e.required,
|
|
@@ -208,35 +208,39 @@ const we = ({
|
|
|
208
208
|
}
|
|
209
209
|
)
|
|
210
210
|
}
|
|
211
|
-
)
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ q(
|
|
213
|
+
J,
|
|
214
214
|
{
|
|
215
|
-
className:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
className: S(
|
|
216
|
+
`${l}-wrapper`,
|
|
217
|
+
{
|
|
218
|
+
[`${l}-wrapper-flex`]: M
|
|
219
|
+
},
|
|
220
|
+
v ? `${l}-wrapper-has-label` : `${l}-wrapper-no-label`
|
|
221
|
+
),
|
|
222
|
+
flex: M ? 1 : void 0,
|
|
219
223
|
...e.wrapperCol || r.wrapperCol,
|
|
220
224
|
children: [
|
|
221
|
-
|
|
225
|
+
R(),
|
|
222
226
|
/* @__PURE__ */ i(
|
|
223
|
-
|
|
227
|
+
ve,
|
|
224
228
|
{
|
|
225
|
-
prefixCls:
|
|
229
|
+
prefixCls: c,
|
|
226
230
|
help: e.help,
|
|
227
|
-
errors:
|
|
228
|
-
warnings:
|
|
231
|
+
errors: V,
|
|
232
|
+
warnings: k
|
|
229
233
|
}
|
|
230
234
|
),
|
|
231
|
-
|
|
235
|
+
j && /* @__PURE__ */ i("div", { className: `${c}-extra`, children: j })
|
|
232
236
|
]
|
|
233
237
|
}
|
|
234
238
|
)
|
|
235
239
|
]
|
|
236
240
|
}
|
|
237
241
|
) }) });
|
|
238
|
-
},
|
|
239
|
-
|
|
242
|
+
}, Fe = ae($e);
|
|
243
|
+
Fe.displayName = "FormItem";
|
|
240
244
|
export {
|
|
241
|
-
|
|
245
|
+
Fe as default
|
|
242
246
|
};
|
package/grid/Grid.js
CHANGED
|
@@ -1,108 +1,74 @@
|
|
|
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 O from "lodash/isArray";
|
|
3
|
+
import f from "lodash/isNil";
|
|
4
|
+
import { forwardRef as _, useContext as A } from "react";
|
|
6
5
|
import "../config-provider/ConfigProvider.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
cols:
|
|
6
|
+
import { COLS as g } from "../constant/index.js";
|
|
7
|
+
import L from "../components/common/hooks/useMergeProps.js";
|
|
8
|
+
import { useResponsiveState as c } from "../hooks/useResponsiveState.js";
|
|
9
|
+
import M from "@unicom-cloud/utils/class-name";
|
|
10
|
+
import "../components/common/utils/is.js";
|
|
11
|
+
import { GridContext as k } from "./context.js";
|
|
12
|
+
import q from "../config-provider/context.js";
|
|
13
|
+
import { isString as z, isNumber as d, isPlainObject as B } from "@unicom-cloud/utils/is";
|
|
14
|
+
const D = {
|
|
15
|
+
cols: g,
|
|
17
16
|
gap: 0
|
|
18
17
|
};
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
O,
|
|
25
|
-
N?.Grid
|
|
18
|
+
function E(u, C) {
|
|
19
|
+
const { getPrefixCls: N, componentConfig: P, rtl: y } = A(q), G = N?.("grid"), $ = L(
|
|
20
|
+
u,
|
|
21
|
+
D,
|
|
22
|
+
P?.Grid
|
|
26
23
|
), {
|
|
27
|
-
|
|
28
|
-
className:
|
|
29
|
-
|
|
30
|
-
cols:
|
|
31
|
-
gap:
|
|
32
|
-
colGap:
|
|
33
|
-
rowGap:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
gridTemplateColumns
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})(), C = J({
|
|
52
|
-
cols: l,
|
|
53
|
-
collapsed: G,
|
|
54
|
-
collapsedRows: $,
|
|
55
|
-
itemDataList: j
|
|
56
|
-
});
|
|
57
|
-
return /* @__PURE__ */ i(
|
|
24
|
+
style: w,
|
|
25
|
+
className: v,
|
|
26
|
+
children: S,
|
|
27
|
+
cols: R,
|
|
28
|
+
gap: r,
|
|
29
|
+
colGap: l,
|
|
30
|
+
rowGap: m
|
|
31
|
+
} = $;
|
|
32
|
+
let i = m, t = l;
|
|
33
|
+
const T = f(r), b = f(m), h = f(l);
|
|
34
|
+
T || (O(r) ? (i = r[0], t = r[1] ?? r[0]) : i = t = r), b || (i = m), h || (t = l);
|
|
35
|
+
const o = c(R, g), a = c(i, 0), n = c(t, 0), e = {};
|
|
36
|
+
if (a && (e.rowGap = a), n && (e.columnGap = n), z(o))
|
|
37
|
+
e.gridTemplateColumns = o;
|
|
38
|
+
else if (d(o))
|
|
39
|
+
e.gridTemplateColumns = `repeat(${o}, minmax(0px, 1fr))`;
|
|
40
|
+
else if (B(o) && "type" in o) {
|
|
41
|
+
const j = o.type;
|
|
42
|
+
let s = o.max ?? "1fr";
|
|
43
|
+
d(s) && (s = `${s}px`);
|
|
44
|
+
let p = o.min ?? "0px";
|
|
45
|
+
d(p) && (p = `${p}px`), e.gridTemplateColumns = `repeat(${j}, minmax(${p}, ${s}))`;
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ x(
|
|
58
48
|
"div",
|
|
59
49
|
{
|
|
60
|
-
ref:
|
|
61
|
-
className:
|
|
50
|
+
ref: C,
|
|
51
|
+
className: M(G, y && `${G}-rtl`, v),
|
|
62
52
|
style: {
|
|
63
|
-
...
|
|
64
|
-
...
|
|
53
|
+
...e,
|
|
54
|
+
...w
|
|
65
55
|
},
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
|
|
56
|
+
children: /* @__PURE__ */ x(
|
|
57
|
+
k.Provider,
|
|
68
58
|
{
|
|
69
59
|
value: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
removeItemData(e) {
|
|
74
|
-
o.delete(e), c(new Map([...o]));
|
|
75
|
-
}
|
|
60
|
+
cols: o,
|
|
61
|
+
rowGap: a,
|
|
62
|
+
colGap: n
|
|
76
63
|
},
|
|
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
|
-
)
|
|
64
|
+
children: S
|
|
99
65
|
}
|
|
100
66
|
)
|
|
101
67
|
}
|
|
102
68
|
);
|
|
103
69
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
70
|
+
const F = _(E);
|
|
71
|
+
F.displayName = "Grid";
|
|
106
72
|
export {
|
|
107
|
-
|
|
73
|
+
F as default
|
|
108
74
|
};
|
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 S } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useContext as i } from "react";
|
|
5
3
|
import "../config-provider/ConfigProvider.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
import R from "../components/common/hooks/useMergeProps.js";
|
|
5
|
+
import { useResponsiveState as a } from "../hooks/useResponsiveState.js";
|
|
6
|
+
import b from "@unicom-cloud/utils/class-name";
|
|
7
|
+
import "../components/common/utils/is.js";
|
|
8
|
+
import { GridContext as h } from "./context.js";
|
|
9
|
+
import { resolveItemData as j } from "./util.js";
|
|
10
|
+
import w from "../config-provider/context.js";
|
|
11
|
+
import { isNumber as t } from "@unicom-cloud/utils/is";
|
|
12
|
+
function D(c, l) {
|
|
13
|
+
const { getPrefixCls: d, componentConfig: u, rtl: C } = i(w), n = d?.("grid-item"), x = R(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
offset: 0,
|
|
17
|
+
span: 1
|
|
18
|
+
},
|
|
19
|
+
u?.GridItem
|
|
22
20
|
), {
|
|
23
|
-
|
|
24
|
-
className:
|
|
25
|
-
|
|
26
|
-
offset:
|
|
27
|
-
span:
|
|
28
|
-
|
|
29
|
-
} = a,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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(
|
|
21
|
+
style: $,
|
|
22
|
+
className: g,
|
|
23
|
+
children: N,
|
|
24
|
+
offset: P,
|
|
25
|
+
span: m,
|
|
26
|
+
order: p
|
|
27
|
+
} = x, { colGap: e, cols: f } = i(h), G = a(P, 0), y = a(m, 1), { span: s, offset: r } = t(f) ? j(f, {
|
|
28
|
+
span: y,
|
|
29
|
+
offset: G
|
|
30
|
+
}) : {}, o = {};
|
|
31
|
+
if (t(p) && (o.order = p), t(s)) {
|
|
32
|
+
if (o.gridColumnStart = `span ${s}`, t(e) && t(r) && r > 0) {
|
|
33
|
+
const I = `(100% - ${e * (s - 1)}px) / ${s}`;
|
|
34
|
+
o.marginLeft = `calc(${I} * ${r} + ${e * r}px)`;
|
|
35
|
+
}
|
|
36
|
+
o.gridColumnEnd = `span ${m}`;
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ S(
|
|
56
39
|
"div",
|
|
57
40
|
{
|
|
58
|
-
ref:
|
|
59
|
-
className: b,
|
|
41
|
+
ref: l,
|
|
60
42
|
style: {
|
|
61
|
-
...
|
|
62
|
-
|
|
43
|
+
...o,
|
|
44
|
+
...$
|
|
63
45
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...t.props
|
|
67
|
-
}) : t)
|
|
46
|
+
className: b(n, C && `${n}-rtl`, g),
|
|
47
|
+
children: N
|
|
68
48
|
}
|
|
69
49
|
);
|
|
70
50
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
I.__PQB_GRID_ITEM__ = !0;
|
|
51
|
+
const E = v(D);
|
|
52
|
+
E.displayName = "Grid.Item";
|
|
74
53
|
export {
|
|
75
|
-
|
|
54
|
+
E as default
|
|
76
55
|
};
|