@unicom-cloud/ui 0.8.100 → 0.8.102
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 +7 -54
- package/Copy.js +5 -4
- package/Details.js +13 -2
- package/Divider.js +3 -2
- package/Flex.js +14 -4
- package/LiquidFill.js +5 -4
- package/List.js +1 -1
- package/Loading.js +16 -3
- package/Marquee.js +5 -4
- package/QrCode.js +5 -4
- package/Space.js +3 -3
- package/Splitter.js +4 -3
- package/SuspenseFallbackTest.js +2 -4
- package/Tooltip.js +3 -4
- package/Tour.js +5 -4
- package/alert/index.js +60 -62
- package/anchor/Anchor.js +12 -12
- package/anchor/util.js +10 -10
- package/back-top/index.js +33 -34
- package/badge/index.js +109 -162
- package/calendar/index.js +85 -84
- package/card/index.js +63 -43
- package/color-picker/InputHex.js +3 -4
- package/color-picker/InputRgb.js +7 -8
- package/color-picker/Palette.js +3 -4
- package/color-picker/Panel.js +3 -4
- package/color-picker/colors.js +5 -5
- package/color-picker/hooks/useColorPicker.js +3 -4
- package/color-picker/utils.js +14 -15
- 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/PqbCSSTransition.js +1 -1
- package/components/common/utils/constant.js +6 -3
- package/components/common/utils/reactDOM.js +6 -4
- package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
- package/components/common/utils/setPrimaryColor.js +18 -18
- package/components/common/utils/setTheme.js +8 -9
- package/components/common/utils/toArray.js +12 -0
- package/copy/index.js +3 -2
- package/details/index.js +102 -62
- package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
- package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
- package/dist/scroll-into-view-if-needed/src/index.js +19 -19
- 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/form/FormItem.js +69 -65
- package/form/context.js +6 -7
- package/grid/Col-.js +86 -0
- package/grid/Col.js +156 -73
- package/grid/Grid.js +71 -67
- package/grid/Row.js +3 -3
- package/grid/index.js +13 -13
- package/icon/interface.js +1 -0
- package/icon-hover/interface.js +1 -0
- package/index.js +641 -663
- package/input/Textarea.js +1 -1
- package/input/autoSizeTextAreaHeight.js +7 -7
- package/liquid-fill/index.js +5 -4
- package/list/index.js +1 -1
- package/loading/index.js +72 -53
- package/loading/interface.js +1 -0
- package/marquee/index.js +5 -4
- package/menu/Item.js +9 -9
- package/modal/Modal.js +73 -74
- package/package.json +1 -1
- package/portal/interface.js +1 -0
- package/qr-code/index.js +5 -4
- package/segmented/index.js +47 -47
- package/space/index.js +41 -35
- package/speech-synthesis/interface.js +1 -0
- package/splitter/SplitBar.js +81 -79
- package/splitter/Splitter.js +92 -104
- package/splitter/hooks/useItems.js +1 -1
- package/splitter/hooks/useResizable.js +9 -18
- package/splitter/hooks/useResize.js +10 -10
- package/splitter/hooks/useSizes.js +28 -28
- package/splitter/index.js +5 -4
- package/statistic/index.js +10 -10
- 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 +376 -377
- package/table/hook/useThResizable.js +5 -4
- package/table/th-resizable/index.js +12 -11
- package/time-picker/util.js +8 -8
- package/tooltip/index.js +1 -2
- package/tour/index.js +5 -4
- package/tree/NodeList.js +1 -1
- 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/constant.d.ts +1 -0
- package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
- package/types/common/utils/toArray.d.ts +13 -0
- package/types/common/utils/tree.d.ts +1 -0
- package/types/common/utils/tween.d.ts +1 -0
- package/types/pc/alert/index.d.ts +2 -1
- package/types/pc/alert/interface.d.ts +7 -1
- package/types/pc/anchor/util.d.ts +1 -1
- package/types/pc/badge/Count.d.ts +1 -1
- package/types/pc/badge/interface.d.ts +2 -0
- 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/card/interface.d.ts +8 -0
- 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/color-picker/hooks/useColorPicker.d.ts +7 -2
- package/types/pc/color-picker/utils.d.ts +6 -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/FormItem.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/grid/Col-.d.ts +4 -0
- package/types/pc/grid/Col.d.ts +3 -2
- package/types/pc/grid/Grid.d.ts +2 -2
- package/types/pc/grid/Item.d.ts +3 -3
- package/types/pc/grid/Row.d.ts +2 -2
- package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
- package/types/pc/grid/interface.d.ts +13 -7
- 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/SplitBar.d.ts +0 -1
- package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
- package/types/pc/splitter/hooks/useResize.d.ts +1 -2
- package/types/pc/splitter/index.d.ts +5 -4
- package/types/pc/splitter/interface.d.ts +16 -24
- 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/tour/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/interface.d.ts +1 -0
- package/types/pc/upload/list/index.d.ts +1 -1
- package/types/pc/utils/constant.d.ts +1 -2
- package/types/pc/utils/dayjs.d.ts +2 -1
- package/types/pc/utils/index.d.ts +2 -5
- package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
- package/types/pc/utils/toArray.d.ts +1 -5
- package/types/pc/utils/tree.d.ts +2 -1
- package/types/pc/utils/tween.d.ts +1 -1
- 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/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +5 -4
- package/upload/request.js +12 -13
- package/upload/request_.js +2 -3
- package/utils/constant.js +5 -5
- package/utils/dayjs.js +13 -12
- package/utils/index.js +261 -284
- package/utils/scrollIntoViewIfNeeded.js +12 -0
- package/utils/toArray.js +3 -10
- package/utils/tree.js +11 -9
- package/utils/tween.js +5 -5
- package/version/index.js +1 -1
- package/virtual-list/interface.js +1 -0
- package/components/common/space/toArray.js +0 -11
- package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
- package/dist/compute-scroll-into-view/src/index.js +0 -126
- package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
- package/dist/tinycolor/customize/index.js +0 -12
- package/dist/tinycolor/src/conversion.js +0 -143
- package/dist/tinycolor/src/css-color-names.js +0 -153
- package/dist/tinycolor/src/format-input.js +0 -77
- package/dist/tinycolor/src/index.js +0 -388
- package/dist/tinycolor/src/util.js +0 -32
- 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/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
- package/types/common/utils/scrollIntoView.d.ts +0 -4
- package/types/common/utils/tinycolor.d.ts +0 -1
- package/types/pc/flex/utils.d.ts +0 -9
- package/types/pc/suspense-fallback-test/style/index.d.ts +0 -1
- package/types/pc/utils/color.d.ts +0 -1
- package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
- package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
- package/types/pc/utils/scrollIntoView.d.ts +0 -3
- package/types/pc/utils/tinycolor.d.ts +0 -1
- package/utils/color.js +0 -4
- package/utils/computeScrollIntoView.js +0 -6
- package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
- package/utils/scrollIntoView.js +0 -6
- package/utils/tinycolor.js +0 -29
- /package/{suspense-fallback-test/style/index.less.js → development/interface.js} +0 -0
package/flex/index.js
CHANGED
|
@@ -1,59 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useContext as x } from "react";
|
|
3
|
+
import d from "../components/common/flex/index.js";
|
|
3
4
|
import "../config-provider/ConfigProvider.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
[`${t}-vertical`]: v
|
|
37
|
-
},
|
|
38
|
-
z(t, l)
|
|
39
|
-
), $ = {
|
|
40
|
-
...g,
|
|
41
|
-
...a ? { flex: a } : {},
|
|
42
|
-
...e && !i(e) ? { gap: e } : {}
|
|
43
|
-
};
|
|
44
|
-
return /* @__PURE__ */ c(F, { ref: o, className: y, style: $, ...P, children: N });
|
|
45
|
-
}
|
|
46
|
-
const s = n(
|
|
47
|
-
j
|
|
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 C from "../components/common/hooks/useMergeProps.js";
|
|
13
|
+
import "../components/common/utils/reactDOM.js";
|
|
14
|
+
import "@unicom-cloud/utils/constant";
|
|
15
|
+
import "lodash/debounce";
|
|
16
|
+
import F from "@unicom-cloud/utils/class-name";
|
|
17
|
+
import u from "../config-provider/context.js";
|
|
18
|
+
const N = {
|
|
19
|
+
children: void 0
|
|
20
|
+
}, r = m(
|
|
21
|
+
(o, t) => {
|
|
22
|
+
const { getPrefixCls: s, componentConfig: p, rtl: l } = x(u), n = C(
|
|
23
|
+
o,
|
|
24
|
+
N,
|
|
25
|
+
p?.Flex
|
|
26
|
+
), { className: a, ...c } = n, f = s?.("flex");
|
|
27
|
+
return /* @__PURE__ */ e(
|
|
28
|
+
d,
|
|
29
|
+
{
|
|
30
|
+
ref: t,
|
|
31
|
+
className: F(f, a),
|
|
32
|
+
rtl: l,
|
|
33
|
+
...c
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
48
37
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
s.Vertical = m;
|
|
38
|
+
r.displayName = "Flex";
|
|
39
|
+
const i = m((o, t) => /* @__PURE__ */ e(r, { ref: t, direction: "column", ...o }));
|
|
40
|
+
i.displayName = "FlexVertical";
|
|
41
|
+
const B = Object.assign(r, {
|
|
42
|
+
Vertical: i
|
|
43
|
+
});
|
|
56
44
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
i as FlexVertical,
|
|
46
|
+
B as default
|
|
59
47
|
};
|
package/flex/interface.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
"wrap",
|
|
3
|
-
"nowrap",
|
|
4
|
-
"wrap-reverse"
|
|
5
|
-
], t = [
|
|
6
|
-
"flex-start",
|
|
7
|
-
"flex-end",
|
|
8
|
-
"start",
|
|
9
|
-
"end",
|
|
10
|
-
"center",
|
|
11
|
-
"space-between",
|
|
12
|
-
"space-around",
|
|
13
|
-
"space-evenly",
|
|
14
|
-
"stretch",
|
|
15
|
-
"normal",
|
|
16
|
-
"left",
|
|
17
|
-
"right"
|
|
18
|
-
], s = [
|
|
19
|
-
"center",
|
|
20
|
-
"start",
|
|
21
|
-
"end",
|
|
22
|
-
"flex-start",
|
|
23
|
-
"flex-end",
|
|
24
|
-
"self-start",
|
|
25
|
-
"self-end",
|
|
26
|
-
"baseline",
|
|
27
|
-
"normal",
|
|
28
|
-
"stretch"
|
|
29
|
-
];
|
|
30
|
-
export {
|
|
31
|
-
s as alignItemsValues,
|
|
32
|
-
e as flexWrapValues,
|
|
33
|
-
t as justifyContentValues
|
|
34
|
-
};
|
|
1
|
+
|
package/form/FormItem.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { jsx as i, jsxs as E, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as i, jsxs as E, Fragment as ae } from "react/jsx-runtime";
|
|
2
|
+
import U, { forwardRef as me, useContext as F, useState as W, useRef as de, useEffect as ce, useMemo as _, createElement as z, cloneElement as H } from "react";
|
|
3
|
+
import pe from "lodash/isArray";
|
|
4
|
+
import ue from "lodash/isFunction";
|
|
5
5
|
import h from "lodash/isPlainObject";
|
|
6
|
-
import
|
|
6
|
+
import x from "lodash/isUndefined";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { PqbCSSTransition as
|
|
8
|
+
import "../grid/index.js";
|
|
9
|
+
import fe from "../components/common/hooks/useMergeProps.js";
|
|
10
|
+
import { PqbCSSTransition as be } from "../components/common/utils/PqbCSSTransition.js";
|
|
11
11
|
import C from "@unicom-cloud/utils/class-name";
|
|
12
|
-
import { omit as
|
|
12
|
+
import { omit as ge } from "../components/common/utils/omit.js";
|
|
13
13
|
import $ from "./Control.js";
|
|
14
|
-
import
|
|
15
|
-
import { FormItemContext as
|
|
14
|
+
import he from "./FormLabel.js";
|
|
15
|
+
import { FormItemContext as K, FormListContext as Ce, FormContext as B } from "./context.js";
|
|
16
16
|
import { VALIDATE_STATUS as k } from "./interface.js";
|
|
17
|
-
import { formatValidateMsg as
|
|
17
|
+
import { formatValidateMsg as xe } from "./util.js";
|
|
18
18
|
import ye from "../config-provider/context.js";
|
|
19
|
-
|
|
19
|
+
import ve from "../grid/Row.js";
|
|
20
|
+
import G from "../grid/Col.js";
|
|
21
|
+
const we = ({
|
|
20
22
|
prefixCls: f,
|
|
21
23
|
help: b,
|
|
22
24
|
errors: e,
|
|
@@ -31,9 +33,9 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
31
33
|
/* @__PURE__ */ i("div", { role: "alert", className: `${f}-message-help-warning`, children: p }, d)
|
|
32
34
|
);
|
|
33
35
|
});
|
|
34
|
-
const
|
|
36
|
+
const y = !x(b) || !!c.length, u = y || !!g.length;
|
|
35
37
|
return u && /* @__PURE__ */ i(
|
|
36
|
-
|
|
38
|
+
be,
|
|
37
39
|
{
|
|
38
40
|
in: u,
|
|
39
41
|
appear: !0,
|
|
@@ -44,9 +46,9 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
44
46
|
"div",
|
|
45
47
|
{
|
|
46
48
|
className: C(`${f}-message`, {
|
|
47
|
-
[`${f}-message-help`]:
|
|
49
|
+
[`${f}-message-help`]: y
|
|
48
50
|
}),
|
|
49
|
-
children:
|
|
51
|
+
children: x(b) ? /* @__PURE__ */ E(ae, { children: [
|
|
50
52
|
g.length > 0 && g,
|
|
51
53
|
c.length > 0 && c
|
|
52
54
|
] }) : b
|
|
@@ -54,11 +56,11 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
54
56
|
)
|
|
55
57
|
}
|
|
56
58
|
);
|
|
57
|
-
},
|
|
59
|
+
}, Fe = {
|
|
58
60
|
trigger: "onChange",
|
|
59
61
|
triggerPropName: "value"
|
|
60
|
-
},
|
|
61
|
-
const e =
|
|
62
|
+
}, $e = (f, b) => {
|
|
63
|
+
const e = fe(f, Fe), { getPrefixCls: I, prefixCls: g } = F(ye), c = F(K), y = F(Ce), [u, p] = W(null), [d, T] = W(null), r = F(B), l = r.prefixCls || I?.("form"), q = e.layout || r.layout, J = e.labelAlign || r.labelAlign, N = de(!1), A = !e.labelCol && !r.labelCol, D = !e.wrapperCol && !r.wrapperCol, Q = (n, t = {}) => {
|
|
62
64
|
if (N.current)
|
|
63
65
|
return;
|
|
64
66
|
const { errors: m, warnings: s } = t || {};
|
|
@@ -69,43 +71,43 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
69
71
|
const a = { ...o || {} };
|
|
70
72
|
return s && s.length ? a[n] = s : delete a[n], a;
|
|
71
73
|
});
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
+
}, X = h(e.noStyle) && e.noStyle.showErrorTip && c.updateFormItem ? c.updateFormItem : Q;
|
|
75
|
+
ce(() => (N.current = !1, () => {
|
|
74
76
|
N.current = !0, p(null), T(null);
|
|
75
77
|
}), []);
|
|
76
|
-
const
|
|
78
|
+
const Y = {
|
|
77
79
|
...r,
|
|
78
|
-
validateMessages: r.validateMessages &&
|
|
80
|
+
validateMessages: r.validateMessages && xe(r.validateMessages, {
|
|
79
81
|
label: e.label
|
|
80
82
|
}),
|
|
81
83
|
prefixCls: l,
|
|
82
|
-
updateFormItem:
|
|
84
|
+
updateFormItem: X,
|
|
83
85
|
disabled: "disabled" in e ? e.disabled : r.disabled
|
|
84
|
-
}, { label:
|
|
85
|
-
[`${l}-label-item-left`]:
|
|
86
|
-
}),
|
|
86
|
+
}, { label: L, extra: M, className: Z, style: ee, validateStatus: v, hidden: re, ...te } = e, oe = C(`${l}-label-item`, {
|
|
87
|
+
[`${l}-label-item-left`]: J === "left"
|
|
88
|
+
}), j = u ? Object.values(u) : [], S = d ? Object.values(d).reduce((n, t) => n.concat(t), []) : [], w = _(() => {
|
|
87
89
|
if (v)
|
|
88
90
|
return v;
|
|
89
|
-
if (
|
|
91
|
+
if (j.length)
|
|
90
92
|
return k.error;
|
|
91
93
|
if (S.length)
|
|
92
94
|
return k.warning;
|
|
93
|
-
}, [u, d, v]),
|
|
95
|
+
}, [u, d, v]), V = _(() => !x(e.help) || S.length > 0, [e.help, d]), le = C(
|
|
94
96
|
`${l}-item`,
|
|
95
97
|
{
|
|
96
|
-
[`${l}-item-error`]:
|
|
98
|
+
[`${l}-item-error`]: V || !v && w === k.error,
|
|
97
99
|
[`${l}-item-status-${w}`]: w,
|
|
98
|
-
[`${l}-item-has-help`]:
|
|
99
|
-
[`${l}-item-hidden`]:
|
|
100
|
+
[`${l}-item-has-help`]: V,
|
|
101
|
+
[`${l}-item-hidden`]: re,
|
|
100
102
|
[`${l}-item-has-feedback`]: w && e.hasFeedback
|
|
101
103
|
},
|
|
102
104
|
`${l}-layout-${q}`,
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
+
Z
|
|
106
|
+
), O = () => {
|
|
105
107
|
const { field: n, children: t } = e, m = "disabled" in e ? e.disabled : r.disabled;
|
|
106
|
-
if (
|
|
108
|
+
if (ue(t)) {
|
|
107
109
|
const { key: s, ...o } = e ?? {};
|
|
108
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ z(
|
|
109
111
|
$,
|
|
110
112
|
{
|
|
111
113
|
disabled: m,
|
|
@@ -118,34 +120,34 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
118
120
|
)
|
|
119
121
|
);
|
|
120
122
|
}
|
|
121
|
-
if (
|
|
122
|
-
const s =
|
|
123
|
-
const R = h(o) && o.key || a,
|
|
124
|
-
return h(o) ?
|
|
123
|
+
if (pe(t)) {
|
|
124
|
+
const s = U.Children.map(t, (o, a) => {
|
|
125
|
+
const R = h(o) && o.key || a, se = h(o) && "disabled" in o.props, ie = !x(m) && !se ? { key: R, disabled: m } : { key: R };
|
|
126
|
+
return h(o) ? H(o, ie) : o;
|
|
125
127
|
});
|
|
126
128
|
return /* @__PURE__ */ i($, { ...e, field: void 0, children: s });
|
|
127
129
|
}
|
|
128
|
-
if (
|
|
130
|
+
if (U.Children.count(t) == 1) {
|
|
129
131
|
if (n) {
|
|
130
|
-
const s =
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
+
const s = y?.getItemKey?.(n) || n;
|
|
133
|
+
return /* @__PURE__ */ z($, { disabled: m, ...e, key: s, _key: s }, t);
|
|
132
134
|
}
|
|
133
135
|
if (h(t)) {
|
|
134
136
|
if (t.type?.isFormControl)
|
|
135
137
|
return t;
|
|
136
|
-
const o = !("disabled" in t.props) && !
|
|
137
|
-
return /* @__PURE__ */ i($, { ...e, field: void 0, children: o ?
|
|
138
|
+
const o = !("disabled" in t.props) && !x(m) ? { disabled: m } : null;
|
|
139
|
+
return /* @__PURE__ */ i($, { ...e, field: void 0, children: o ? H(t, o) : t });
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
return t;
|
|
141
|
-
},
|
|
143
|
+
}, ne = K, P = {
|
|
142
144
|
...r
|
|
143
145
|
};
|
|
144
|
-
return e.noStyle || (P.wrapperCol = void 0, P.labelCol = void 0), /* @__PURE__ */ i(
|
|
145
|
-
|
|
146
|
+
return e.noStyle || (P.wrapperCol = void 0, P.labelCol = void 0), /* @__PURE__ */ i(B.Provider, { value: P, children: /* @__PURE__ */ i(ne.Provider, { value: Y, children: e.noStyle ? O() : /* @__PURE__ */ E(
|
|
147
|
+
ve,
|
|
146
148
|
{
|
|
147
149
|
ref: b,
|
|
148
|
-
...
|
|
150
|
+
...ge(te, [
|
|
149
151
|
"tooltip",
|
|
150
152
|
"children",
|
|
151
153
|
"prefixCls",
|
|
@@ -175,28 +177,29 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
175
177
|
"requiredSymbol",
|
|
176
178
|
"isFormList"
|
|
177
179
|
]),
|
|
178
|
-
className:
|
|
180
|
+
className: le,
|
|
179
181
|
div: q !== "horizontal",
|
|
180
|
-
style:
|
|
182
|
+
style: ee,
|
|
181
183
|
children: [
|
|
182
|
-
|
|
184
|
+
L ? /* @__PURE__ */ i(
|
|
183
185
|
G,
|
|
184
186
|
{
|
|
185
187
|
...e.labelCol || r.labelCol,
|
|
186
188
|
className: C(
|
|
187
|
-
|
|
189
|
+
oe,
|
|
188
190
|
e.labelCol?.className,
|
|
189
191
|
r.labelCol?.className,
|
|
190
192
|
{
|
|
191
|
-
[`${l}-label-item-flex`]:
|
|
193
|
+
[`${l}-label-item-flex`]: A
|
|
192
194
|
}
|
|
193
195
|
),
|
|
196
|
+
flex: A ? 0 : void 0,
|
|
194
197
|
children: /* @__PURE__ */ i(
|
|
195
|
-
|
|
198
|
+
he,
|
|
196
199
|
{
|
|
197
200
|
tooltip: e.tooltip,
|
|
198
201
|
htmlFor: e.field && r?.getFormElementId?.(e.field),
|
|
199
|
-
label:
|
|
202
|
+
label: L,
|
|
200
203
|
prefix: g,
|
|
201
204
|
requiredSymbol: "requiredSymbol" in e ? e.requiredSymbol : r.requiredSymbol,
|
|
202
205
|
required: e.required,
|
|
@@ -210,29 +213,30 @@ const xe = K.Row, G = K.Col, ve = ({
|
|
|
210
213
|
G,
|
|
211
214
|
{
|
|
212
215
|
className: C(`${l}-item-wrapper`, {
|
|
213
|
-
[`${l}-item-wrapper-flex`]:
|
|
216
|
+
[`${l}-item-wrapper-flex`]: D
|
|
214
217
|
}),
|
|
218
|
+
flex: D ? 1 : void 0,
|
|
215
219
|
...e.wrapperCol || r.wrapperCol,
|
|
216
220
|
children: [
|
|
217
|
-
|
|
221
|
+
O(),
|
|
218
222
|
/* @__PURE__ */ i(
|
|
219
|
-
|
|
223
|
+
we,
|
|
220
224
|
{
|
|
221
225
|
prefixCls: l,
|
|
222
226
|
help: e.help,
|
|
223
|
-
errors:
|
|
227
|
+
errors: j,
|
|
224
228
|
warnings: S
|
|
225
229
|
}
|
|
226
230
|
),
|
|
227
|
-
|
|
231
|
+
M && /* @__PURE__ */ i("div", { className: `${l}-extra`, children: M })
|
|
228
232
|
]
|
|
229
233
|
}
|
|
230
234
|
)
|
|
231
235
|
]
|
|
232
236
|
}
|
|
233
237
|
) }) });
|
|
234
|
-
},
|
|
235
|
-
|
|
238
|
+
}, Ie = me($e);
|
|
239
|
+
Ie.displayName = "FormItem";
|
|
236
240
|
export {
|
|
237
|
-
|
|
241
|
+
Ie as default
|
|
238
242
|
};
|
package/form/context.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createContext as t } from "react";
|
|
2
|
-
import "@unicom-cloud/utils/constant/ui";
|
|
3
2
|
import { NOOP as e } from "../components/common/utils/constant.js";
|
|
4
|
-
const
|
|
3
|
+
const o = t({
|
|
5
4
|
layout: "horizontal",
|
|
6
5
|
labelCol: { span: 5, offset: 0 },
|
|
7
6
|
labelAlign: "right",
|
|
@@ -35,10 +34,10 @@ const i = t({
|
|
|
35
34
|
innerGetStoreStatus: e
|
|
36
35
|
})
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), i = t({}), s = t({}), a = t({});
|
|
39
38
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
o as FormContext,
|
|
40
|
+
i as FormItemContext,
|
|
41
|
+
a as FormListContext,
|
|
42
|
+
s as FormProviderContext
|
|
44
43
|
};
|
package/grid/Col-.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import F from "lodash/isNumber";
|
|
3
|
+
import H from "lodash/isPlainObject";
|
|
4
|
+
import { forwardRef as T, useContext as R, useMemo as q } from "react";
|
|
5
|
+
import "../config-provider/ConfigProvider.js";
|
|
6
|
+
import D from "../components/common/hooks/useMergeProps.js";
|
|
7
|
+
import I from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import { RowContext as J } from "./context.js";
|
|
9
|
+
import K from "../config-provider/context.js";
|
|
10
|
+
const Q = {
|
|
11
|
+
span: 24
|
|
12
|
+
};
|
|
13
|
+
function S(i) {
|
|
14
|
+
return typeof i == "string" && /\d+[px|%|em|rem|]{1}/.test(i) ? `0 0 ${i}` : i;
|
|
15
|
+
}
|
|
16
|
+
function U(i, v) {
|
|
17
|
+
const { getPrefixCls: w, componentConfig: A, rtl: G } = R(K), L = D(
|
|
18
|
+
i,
|
|
19
|
+
Q,
|
|
20
|
+
A?.["Grid.Col"]
|
|
21
|
+
), { gutter: p, div: l } = R(J), {
|
|
22
|
+
className: M,
|
|
23
|
+
style: N,
|
|
24
|
+
children: O,
|
|
25
|
+
span: V,
|
|
26
|
+
offset: d,
|
|
27
|
+
order: a,
|
|
28
|
+
pull: u,
|
|
29
|
+
push: c,
|
|
30
|
+
xs: m,
|
|
31
|
+
sm: g,
|
|
32
|
+
md: x,
|
|
33
|
+
lg: y,
|
|
34
|
+
xl: h,
|
|
35
|
+
xxl: P,
|
|
36
|
+
xxxl: b,
|
|
37
|
+
flex: f,
|
|
38
|
+
...k
|
|
39
|
+
} = L;
|
|
40
|
+
function z(r, o) {
|
|
41
|
+
const j = { xs: m, sm: g, md: x, lg: y, xl: h, xxl: P, xxxl: b };
|
|
42
|
+
return Object.keys(j).forEach((s) => {
|
|
43
|
+
const t = j[s];
|
|
44
|
+
F(t) ? t >= 0 && (o[`${r}-${s}-${t}`] = !0) : H(t) && (o[`${r}-${s}-${t.span}`] = t.span, o[`${r}-${s}-offset-${t.offset}`] = t.offset, o[`${r}-${s}-order-${t.order}`] = t.order, o[`${r}-${s}-pull-${t.pull}`] = t.pull, o[`${r}-${s}-push-${t.push}`] = t.push);
|
|
45
|
+
}), o;
|
|
46
|
+
}
|
|
47
|
+
const n = w?.("col");
|
|
48
|
+
let $ = {
|
|
49
|
+
[`${n}`]: !l,
|
|
50
|
+
[`${n}-order-${a}`]: a,
|
|
51
|
+
[`${n}-${V}`]: !l && !m && !g && !x && !y && !h && !P && !b,
|
|
52
|
+
[`${n}-offset-${d}`]: d,
|
|
53
|
+
[`${n}-pull-${u}`]: u,
|
|
54
|
+
[`${n}-push-${c}`]: c,
|
|
55
|
+
[`${n}-rtl`]: G
|
|
56
|
+
};
|
|
57
|
+
$ = z(n, $);
|
|
58
|
+
const B = I(f ? n : $, M), e = {};
|
|
59
|
+
if (Array.isArray(p) && !l) {
|
|
60
|
+
const r = p[0] && p[0] / 2 || 0, o = p[1] && p[1] / 2 || 0;
|
|
61
|
+
r && (e.paddingLeft = r, e.paddingRight = r), o && (e.paddingTop = o, e.paddingBottom = o);
|
|
62
|
+
}
|
|
63
|
+
const C = q(
|
|
64
|
+
() => S(f) ? { flex: S(f) } : {},
|
|
65
|
+
[f]
|
|
66
|
+
);
|
|
67
|
+
return /* @__PURE__ */ E(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
ref: v,
|
|
71
|
+
...k,
|
|
72
|
+
style: {
|
|
73
|
+
...N,
|
|
74
|
+
...e,
|
|
75
|
+
...C
|
|
76
|
+
},
|
|
77
|
+
className: B,
|
|
78
|
+
children: O
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const W = T(U);
|
|
83
|
+
W.displayName = "Col";
|
|
84
|
+
export {
|
|
85
|
+
W as default
|
|
86
|
+
};
|