@unicom-cloud/ui 0.8.96 → 0.8.98
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/Affix.js +1 -1
- package/Carousel.js +1 -1
- package/LiquidFill.js +4 -0
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/QrCode.js +57 -0
- package/Tour.js +63 -0
- package/Trigger.js +1 -1
- package/_virtual/_commonjsHelpers.js +6 -0
- package/_virtual/index.js +7 -0
- package/_virtual/index2.js +4 -0
- package/affix/index.js +70 -72
- package/alert/index.js +56 -56
- package/anchor/Anchor.js +55 -55
- package/anchor/Link.js +34 -34
- package/anchor/util.js +5 -5
- package/auto-complete/index.js +116 -122
- package/avatar/Avatar.js +33 -33
- package/avatar/Group.js +26 -26
- package/back-top/index.js +58 -61
- package/badge/index.js +46 -46
- package/breadcrumb/Item.js +42 -43
- package/breadcrumb/index.js +47 -47
- package/button/Group.js +6 -6
- package/button/index.js +91 -91
- package/calendar/Month.js +75 -75
- package/calendar/Year.js +35 -35
- package/calendar/header/index.js +25 -25
- package/calendar/index.js +103 -103
- package/card/Grid.js +8 -8
- package/card/Meta.js +16 -16
- package/card/index.js +49 -49
- package/carousel/Arrow.js +19 -19
- package/carousel/Indicator.js +26 -26
- package/carousel/index.js +108 -108
- package/cascader/Cascader.js +178 -191
- package/cascader/base/node.js +133 -136
- package/cascader/base/store.js +82 -85
- package/cascader/panel/List.js +125 -129
- package/cascader/panel/Search.js +79 -81
- package/cascader/util.js +13 -13
- package/checkbox/Checkbox.js +94 -96
- package/checkbox/Group.js +54 -56
- package/checkbox/GroupBlock.js +28 -29
- package/collapse/Collapse.js +45 -45
- package/collapse/Item.js +53 -55
- package/color-picker/ControlBar.js +43 -43
- package/color-picker/InputAlpha.js +12 -12
- package/color-picker/InputHex.js +30 -31
- package/color-picker/InputRgb.js +24 -24
- package/color-picker/Palette.js +18 -18
- package/color-picker/Panel.js +122 -125
- package/color-picker/hooks/useColorPicker.js +85 -88
- package/color-picker/hooks/useControlBlock.js +38 -40
- package/color-picker/index.js +47 -47
- package/comment/index.js +29 -29
- package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
- package/components/common/hooks/useId.js +8 -8
- package/components/common/hooks/useInView.js +16 -16
- package/components/common/hooks/useIntersectionObserver.js +1 -1
- package/components/common/hooks/useKeyboardEvent.js +9 -10
- package/components/common/hooks/useOverflowHidden.js +1 -4
- package/components/common/hooks/usePersistCallback.js +7 -7
- package/components/common/hooks/useStateCallback.js +9 -10
- package/components/common/hooks/useWindowSize.js +8 -8
- package/components/common/space/index.js +9 -7
- package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/components/common/utils/dom.js +27 -29
- package/components/common/utils/findScrollParent.js +17 -0
- package/components/common/utils/intersectionObserver.js +21 -0
- package/components/common/utils/is.js +99 -109
- package/components/common/utils/mutationObserver.js +19 -0
- package/components/common/utils/reactDOM.js +34 -34
- package/components/common/utils/resizeObserver.js +21 -0
- package/copy/index.js +38 -40
- package/date-picker/Picker.js +290 -295
- package/date-picker/RangePicker.js +367 -372
- package/date-picker/index.js +33 -35
- package/date-picker/panel/Body.js +46 -47
- package/date-picker/panel/Header.js +33 -33
- package/date-picker/panel/Shortcut.js +31 -31
- package/date-picker/panel/date/index.js +85 -85
- package/date-picker/panel/month/index.js +59 -59
- package/date-picker/panel/quarter/index.js +67 -70
- package/date-picker/panel/range/index.js +101 -101
- package/date-picker/panel/year/index.js +39 -39
- package/date-picker/util.js +17 -18
- package/descriptions/index.js +62 -62
- package/details/index.js +53 -55
- package/development/index.js +9 -9
- package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
- package/dist/validate/src/index.js +5 -5
- package/dist/validate/src/util.js +1 -1
- package/divider/index.js +21 -21
- package/draggable/Item.js +35 -35
- package/draggable/index.js +22 -22
- package/drawer/Drawer.js +142 -147
- package/dropdown/Button.js +48 -48
- package/dropdown/index.js +88 -92
- package/empty/index.js +16 -16
- package/form/Control.js +211 -225
- package/form/Form.js +109 -113
- package/form/FormItem.js +118 -120
- package/form/FormList.js +60 -66
- package/form/FormProvider.js +31 -34
- package/form/hook/useContext.js +17 -19
- package/form/hook/useState.js +22 -23
- package/form/hook/useWatch.js +26 -27
- package/form/promisify.js +14 -18
- package/form/store.js +304 -316
- package/form/util.js +14 -15
- package/grid/Col.js +64 -64
- package/grid/Grid.js +51 -51
- package/grid/GridItem.js +48 -48
- package/grid/Row.js +39 -39
- package/hooks/useVerificationCode.js +41 -43
- package/hooks/useWatermark.js +89 -92
- package/icon/index.js +23 -24
- package/icon-hover/index.js +16 -16
- package/icons/file.js +11 -11
- package/image/Image.js +140 -141
- package/image/ImagePreview.js +252 -255
- package/image/ImagePreviewArrow.js +25 -25
- package/image/ImagePreviewGroup.js +62 -62
- package/image/util/getScale.js +25 -28
- package/index.js +684 -675
- package/input/Button.js +48 -50
- package/input/Group.js +9 -9
- package/input/Input.js +145 -154
- package/input/InputElement.js +108 -115
- package/input/Password.js +38 -38
- package/input/Search.js +51 -55
- package/input/Textarea.js +80 -81
- package/input/useComposition.js +23 -23
- package/input-number/decimal.js +59 -62
- package/input-number/index.js +139 -141
- package/input-tag/InputTag.js +222 -230
- package/layout/Content.js +6 -6
- package/layout/Footer.js +8 -8
- package/layout/Header.js +7 -7
- package/layout/Sider.js +88 -90
- package/layout/index.js +30 -30
- package/link/index.js +45 -46
- package/liquid-fill/LiquidFill.js +226 -0
- package/liquid-fill/LiquidFill2.js +3 -0
- package/liquid-fill/index.js +4 -0
- package/list/Item.js +28 -28
- package/list/Meta.js +12 -12
- package/list/index.js +146 -148
- package/mentions/index.js +75 -76
- package/menu/Item.js +58 -58
- package/menu/Menu.js +125 -127
- package/menu/OverflowWrap.js +39 -40
- package/menu/sub-menu/Inline.js +45 -45
- package/menu/util.js +26 -28
- package/message/index.js +96 -99
- package/message/useMessage.js +26 -27
- package/modal/Confirm.js +47 -49
- package/modal/Modal.js +250 -257
- package/modal/use-modal/Hook.js +26 -28
- package/modal/use-modal/index.js +46 -49
- package/notice/index.js +89 -90
- package/notification/index.js +60 -65
- package/notification/withNotification.js +35 -35
- package/overflow-ellipsis/OverflowItem.js +19 -20
- package/overflow-ellipsis/index.js +45 -46
- package/package.json +1 -1
- package/page-header/index.js +45 -45
- package/pagination/PageItem.js +87 -91
- package/pagination/PageJumper.js +40 -41
- package/pagination/PageOption.js +31 -35
- package/pagination/Pagination.js +162 -163
- package/picker/Input.js +90 -96
- package/picker/InputRange.js +115 -122
- package/popconfirm/index.js +98 -100
- package/popover/index.js +28 -28
- package/portal/Portal.js +10 -11
- package/progress/index.js +36 -36
- package/qr-code/index.js +99 -0
- package/qr-code/interface.js +1 -0
- package/radio/Group.js +48 -48
- package/radio/GroupBlock.js +32 -33
- package/radio/Radio.js +62 -64
- package/rate/index.js +88 -88
- package/resize-box/ResizeTrigger.js +39 -39
- package/resize-box/Split.js +92 -96
- package/resize-box/SplitGroup.js +116 -122
- package/resize-box/index.js +112 -115
- package/result/index.js +44 -44
- package/select/Option.js +53 -56
- package/select/Select.js +365 -381
- package/select/util.js +95 -99
- package/select-view/Core.js +159 -160
- package/skeleton/index.js +23 -23
- package/slider/Button.js +84 -92
- package/slider/Input.js +47 -49
- package/slider/Tick.js +28 -31
- package/slider/index.js +107 -107
- package/space/index.js +26 -26
- package/space-/index.js +51 -51
- package/spin/DotLoading.js +8 -8
- package/spin/index.js +47 -47
- package/statistic/Countdown.js +37 -37
- package/statistic/index.js +58 -58
- package/steps/Step.js +42 -42
- package/steps/index.js +54 -54
- package/style.css +1 -1
- package/switch/index.js +77 -78
- package/table/ColGroup.js +36 -37
- package/table/Table.js +447 -450
- package/table/hook/useExpand.js +24 -24
- package/table/hook/useRowSelection.js +62 -62
- package/table/summary/Row.js +16 -17
- package/table/tbody/Td.js +119 -118
- package/table/tbody/Tr.js +119 -121
- package/table/tbody/index.js +62 -63
- package/table/th-resizable/index.js +30 -30
- package/table/thead/Column.js +148 -148
- package/table/thead/index.js +87 -88
- package/tabs/Tab.js +55 -55
- package/tabs/TabContent.js +8 -8
- package/tabs/TabPane.js +15 -15
- package/tabs/hook/useHeaderScroll.js +36 -36
- package/tabs/tab-header/TabInk.js +31 -33
- package/tabs/tab-header/TabNavIcon.js +34 -35
- package/tabs/tab-header/index.js +192 -195
- package/tag/index.js +94 -97
- package/time-picker/Picker.js +167 -172
- package/time-picker/RangePicker.js +28 -28
- package/time-picker/TimePicker.js +146 -146
- package/timeline/Item.js +46 -46
- package/timeline/Timeline.js +52 -52
- package/tooltip/index.js +89 -95
- package/tour/index.js +289 -0
- package/transfer/Item.js +54 -54
- package/transfer/List.js +134 -136
- package/transfer/index.js +91 -91
- package/tree/Animation.js +49 -52
- package/tree/Node.js +114 -122
- package/tree/NodeList.js +51 -51
- package/tree/Tree.js +386 -393
- package/tree-select/List.js +71 -72
- package/tree-select/Select.js +135 -143
- package/tree-select/hook/useKeyCache.js +39 -39
- package/tree-select/hook/useStateValue.js +12 -12
- package/trigger/getPopupStyle.js +60 -61
- package/trigger/index.js +337 -346
- package/types/common/space/interface.d.ts +1 -1
- package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/common/utils/findScrollParent.d.ts +2 -0
- package/types/common/utils/index.d.ts +5 -0
- package/types/common/utils/intersectionObserver.d.ts +2 -0
- package/types/common/utils/mutationObserver.d.ts +2 -0
- package/types/common/utils/resizeObserver.d.ts +2 -0
- package/types/pc/config-provider/interface.d.ts +6 -0
- package/types/pc/index.d.ts +3 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
- package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
- package/types/pc/liquid-fill/index.d.ts +2 -0
- package/types/pc/qr-code/index.d.ts +34 -0
- package/types/pc/qr-code/interface.d.ts +39 -0
- package/types/pc/table/interface.d.ts +2 -2
- package/types/pc/tour/index.d.ts +42 -0
- package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/pc/utils/findScrollParent.d.ts +2 -0
- package/types/pc/utils/index.d.ts +5 -0
- package/types/pc/utils/intersectionObserver.d.ts +2 -0
- package/types/pc/utils/mutationObserver.d.ts +2 -0
- package/types/pc/utils/names.d.ts +18 -0
- package/types/pc/utils/resizeObserver.d.ts +2 -0
- package/typography/Base.js +79 -81
- package/typography/EditContent.js +30 -33
- package/typography/Ellipsis.js +77 -73
- package/typography/Operations.js +50 -52
- package/typography/Paragraph.js +7 -7
- package/typography/Typography.js +7 -7
- package/typography/useEllipsis.js +105 -106
- package/upload/TriggerNode.js +69 -76
- package/upload/Upload.js +84 -87
- package/upload/Uploader.js +115 -118
- package/upload/list/PictureItem.js +61 -71
- package/upload/list/TextItem.js +61 -67
- package/upload/list/UploadProgress.js +42 -49
- package/upload/list/index.js +48 -49
- package/upload/request_.js +37 -38
- package/upload/util.js +39 -39
- package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/utils/findScrollParent.js +4 -0
- package/utils/index.js +281 -278
- package/utils/intersectionObserver.js +4 -0
- package/utils/mutationObserver.js +4 -0
- package/utils/names.js +12 -0
- package/utils/resizeObserver.js +4 -0
- package/verification-code/VerificationCode.js +50 -51
- package/version/index.js +1 -1
- package/virtual-list/VirtualList.js +243 -244
- package/virtual-list/util/item.js +3 -4
- package/watermark/Watermark.js +27 -31
- package/components/common/utils/resizeObserverEffect.js +0 -23
- package/types/common/utils/resizeObserverEffect.d.ts +0 -2
- package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
- package/utils/resizeObserverEffect.js +0 -4
package/form/util.js
CHANGED
|
@@ -14,29 +14,28 @@ function F(t) {
|
|
|
14
14
|
return n;
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
const G = (t, n) => h(t, (
|
|
18
|
-
if (S(
|
|
19
|
-
return (s) =>
|
|
17
|
+
const G = (t, n) => h(t, (r) => {
|
|
18
|
+
if (S(r))
|
|
19
|
+
return (s) => r(s, n);
|
|
20
20
|
});
|
|
21
|
-
function H(t, n,
|
|
22
|
-
return E(t, n, F(
|
|
21
|
+
function H(t, n, r) {
|
|
22
|
+
return E(t, n, F(r)), t;
|
|
23
23
|
}
|
|
24
24
|
function L(t, n = "") {
|
|
25
|
-
const
|
|
26
|
-
Object.keys(
|
|
25
|
+
const r = /* @__PURE__ */ new Set(), s = (e, o = "") => e ? r.has(e) ? [] : (r.add(e), g(
|
|
26
|
+
Object.keys(e).map((i) => (d(e[i]) || y(e[i])) && Object.keys(e[i]).length && !O.isValidElement(e[i]) ? s(e[i], `${o + i}.`) : o + i)
|
|
27
27
|
)) : [];
|
|
28
28
|
return s(t, n);
|
|
29
29
|
}
|
|
30
30
|
function R(t) {
|
|
31
|
-
|
|
32
|
-
return ((n = t == null ? void 0 : t.constructor) == null ? void 0 : n.name) === "SyntheticEvent" || (t == null ? void 0 : t.nativeEvent) instanceof Event;
|
|
31
|
+
return t?.constructor?.name === "SyntheticEvent" || t?.nativeEvent instanceof Event;
|
|
33
32
|
}
|
|
34
|
-
async function U(t, n,
|
|
35
|
-
const
|
|
33
|
+
async function U(t, n, r, s) {
|
|
34
|
+
const e = [...r || []];
|
|
36
35
|
let o = 0;
|
|
37
36
|
return new Promise(async (i) => {
|
|
38
37
|
const a = [], f = async (u) => {
|
|
39
|
-
const p = () => o <
|
|
38
|
+
const p = () => o < e.length - 1 ? (o++, f(e[o])) : i({ error: null, warning: a });
|
|
40
39
|
if (!u)
|
|
41
40
|
return p();
|
|
42
41
|
const c = { ...u };
|
|
@@ -55,12 +54,12 @@ async function U(t, n, e, s) {
|
|
|
55
54
|
return p();
|
|
56
55
|
});
|
|
57
56
|
};
|
|
58
|
-
f(
|
|
57
|
+
f(e[o]);
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
function X(t, n) {
|
|
62
|
-
const
|
|
63
|
-
return n.some((s) => v(
|
|
61
|
+
const r = w({}, t, void 0, Object);
|
|
62
|
+
return n.some((s) => v(r, s));
|
|
64
63
|
}
|
|
65
64
|
const $ = "_input";
|
|
66
65
|
export {
|
package/grid/Col.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
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
5
|
import "../config-provider/ConfigProvider.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { RowContext as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
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
11
|
span: 24
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function S(i) {
|
|
14
14
|
return typeof i == "string" && /\d+[px|%|em|rem|]{1}/.test(i) ? `0 0 ${i}` : i;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const { getPrefixCls:
|
|
16
|
+
function U(i, v) {
|
|
17
|
+
const { getPrefixCls: w, componentConfig: A, rtl: C } = R(K), G = D(
|
|
18
18
|
i,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
), { gutter: p, div:
|
|
22
|
-
className:
|
|
23
|
-
style:
|
|
24
|
-
children:
|
|
25
|
-
span:
|
|
26
|
-
offset:
|
|
27
|
-
order:
|
|
28
|
-
pull:
|
|
29
|
-
push:
|
|
30
|
-
xs:
|
|
19
|
+
Q,
|
|
20
|
+
A?.["Grid.Col"]
|
|
21
|
+
), { gutter: p, div: l } = R(J), {
|
|
22
|
+
className: L,
|
|
23
|
+
style: M,
|
|
24
|
+
children: N,
|
|
25
|
+
span: O,
|
|
26
|
+
offset: d,
|
|
27
|
+
order: a,
|
|
28
|
+
pull: u,
|
|
29
|
+
push: c,
|
|
30
|
+
xs: m,
|
|
31
31
|
sm: g,
|
|
32
|
-
md:
|
|
33
|
-
lg:
|
|
34
|
-
xl:
|
|
35
|
-
xxl:
|
|
36
|
-
xxxl:
|
|
37
|
-
flex:
|
|
38
|
-
...
|
|
39
|
-
} =
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
return Object.keys(
|
|
43
|
-
const t =
|
|
44
|
-
|
|
32
|
+
md: x,
|
|
33
|
+
lg: y,
|
|
34
|
+
xl: h,
|
|
35
|
+
xxl: P,
|
|
36
|
+
xxxl: b,
|
|
37
|
+
flex: f,
|
|
38
|
+
...V
|
|
39
|
+
} = G;
|
|
40
|
+
function k(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
45
|
}), o;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
let
|
|
49
|
-
[`${
|
|
50
|
-
[`${
|
|
51
|
-
[`${
|
|
52
|
-
[`${
|
|
53
|
-
[`${
|
|
54
|
-
[`${
|
|
55
|
-
[`${
|
|
47
|
+
const n = w?.("col");
|
|
48
|
+
let $ = {
|
|
49
|
+
[`${n}`]: !l,
|
|
50
|
+
[`${n}-order-${a}`]: a,
|
|
51
|
+
[`${n}-${O}`]: !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`]: C
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
if (Array.isArray(p) && !
|
|
57
|
+
$ = k(n, $);
|
|
58
|
+
const z = I(f ? n : $, L), e = {};
|
|
59
|
+
if (Array.isArray(p) && !l) {
|
|
60
60
|
const r = p[0] && p[0] / 2 || 0, o = p[1] && p[1] / 2 || 0;
|
|
61
|
-
r && (
|
|
61
|
+
r && (e.paddingLeft = r, e.paddingRight = r), o && (e.paddingTop = o, e.paddingBottom = o);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
() =>
|
|
65
|
-
[
|
|
63
|
+
const B = q(
|
|
64
|
+
() => S(f) ? { flex: S(f) } : {},
|
|
65
|
+
[f]
|
|
66
66
|
);
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ E(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
|
-
ref:
|
|
71
|
-
...
|
|
70
|
+
ref: v,
|
|
71
|
+
...V,
|
|
72
72
|
style: {
|
|
73
|
-
...
|
|
74
|
-
|
|
75
|
-
...
|
|
73
|
+
...M,
|
|
74
|
+
...e,
|
|
75
|
+
...B
|
|
76
76
|
},
|
|
77
|
-
className:
|
|
78
|
-
children:
|
|
77
|
+
className: z,
|
|
78
|
+
children: N
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const W = T(U);
|
|
83
|
+
W.displayName = "Col";
|
|
84
84
|
export {
|
|
85
|
-
|
|
85
|
+
W as default
|
|
86
86
|
};
|
package/grid/Grid.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import L from "lodash/get";
|
|
3
|
+
import d, { forwardRef as h, useState as S, useContext as E } from "react";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
5
|
import T from "../components/common/hooks/useMergeProps.js";
|
|
6
6
|
import b from "@unicom-cloud/utils/class-name";
|
|
7
7
|
import { GridDataCollectorContext as j, GridContext as B } from "./context.js";
|
|
8
|
-
import { useResponsiveState as
|
|
8
|
+
import { useResponsiveState as l } from "./hook/useResponsiveState.js";
|
|
9
9
|
import { setItemVisible as Q } from "./util.js";
|
|
10
10
|
import V from "../config-provider/context.js";
|
|
11
11
|
const k = {
|
|
@@ -15,80 +15,80 @@ const k = {
|
|
|
15
15
|
colGap: 0,
|
|
16
16
|
rowGap: 0
|
|
17
17
|
};
|
|
18
|
-
function q(
|
|
19
|
-
const [
|
|
18
|
+
function q(f, u) {
|
|
19
|
+
const [t, p] = S(
|
|
20
20
|
/* @__PURE__ */ new Map()
|
|
21
|
-
), { getPrefixCls:
|
|
22
|
-
|
|
21
|
+
), { getPrefixCls: x, componentConfig: G, rtl: C } = E(V), w = T(
|
|
22
|
+
f,
|
|
23
23
|
k,
|
|
24
|
-
|
|
24
|
+
G?.Grid
|
|
25
25
|
), {
|
|
26
|
-
children:
|
|
27
|
-
className:
|
|
28
|
-
style:
|
|
29
|
-
cols:
|
|
30
|
-
colGap:
|
|
26
|
+
children: g,
|
|
27
|
+
className: I,
|
|
28
|
+
style: D,
|
|
29
|
+
cols: _,
|
|
30
|
+
colGap: v,
|
|
31
31
|
rowGap: y,
|
|
32
|
-
collapsed:
|
|
32
|
+
collapsed: n,
|
|
33
33
|
collapsedRows: M
|
|
34
|
-
} =
|
|
35
|
-
gap: `${
|
|
36
|
-
gridTemplateColumns: `repeat(${
|
|
37
|
-
},
|
|
38
|
-
[`${
|
|
39
|
-
[`${
|
|
40
|
-
},
|
|
41
|
-
const
|
|
42
|
-
for (const [o,
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
})(),
|
|
46
|
-
cols:
|
|
47
|
-
collapsed:
|
|
34
|
+
} = w, r = l(_, 24), i = l(v, 0), N = {
|
|
35
|
+
gap: `${l(y, 0)}px ${i}px`,
|
|
36
|
+
gridTemplateColumns: `repeat(${r}, minmax(0px, 1fr))`
|
|
37
|
+
}, m = x?.("grid"), P = {
|
|
38
|
+
[`${m}`]: !0,
|
|
39
|
+
[`${m}-rtl`]: C
|
|
40
|
+
}, R = b(P, I), $ = (() => {
|
|
41
|
+
const e = [];
|
|
42
|
+
for (const [o, s] of t.entries())
|
|
43
|
+
e[o] = s;
|
|
44
|
+
return e;
|
|
45
|
+
})(), c = Q({
|
|
46
|
+
cols: r,
|
|
47
|
+
collapsed: n,
|
|
48
48
|
collapsedRows: M,
|
|
49
|
-
itemDataList:
|
|
49
|
+
itemDataList: $
|
|
50
50
|
});
|
|
51
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ a(
|
|
52
52
|
"div",
|
|
53
53
|
{
|
|
54
|
-
ref:
|
|
55
|
-
className:
|
|
54
|
+
ref: u,
|
|
55
|
+
className: R,
|
|
56
56
|
style: {
|
|
57
57
|
...N,
|
|
58
|
-
...
|
|
58
|
+
...D
|
|
59
59
|
},
|
|
60
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ a(
|
|
61
61
|
j.Provider,
|
|
62
62
|
{
|
|
63
63
|
value: {
|
|
64
|
-
collectItemData(
|
|
65
|
-
|
|
64
|
+
collectItemData(e, o) {
|
|
65
|
+
t.set(e, o), p(new Map([...t]));
|
|
66
66
|
},
|
|
67
|
-
removeItemData(
|
|
68
|
-
|
|
67
|
+
removeItemData(e) {
|
|
68
|
+
t.delete(e), p(new Map([...t]));
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ a(
|
|
72
72
|
B.Provider,
|
|
73
73
|
{
|
|
74
74
|
value: {
|
|
75
|
-
cols:
|
|
76
|
-
colGap:
|
|
77
|
-
collapsed:
|
|
78
|
-
overflow:
|
|
79
|
-
displayIndexList:
|
|
75
|
+
cols: r,
|
|
76
|
+
colGap: i,
|
|
77
|
+
collapsed: n,
|
|
78
|
+
overflow: c.overflow,
|
|
79
|
+
displayIndexList: c.displayIndexList
|
|
80
80
|
},
|
|
81
|
-
children:
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
81
|
+
children: d.Children.map(g, (e, o) => {
|
|
82
|
+
if (e) {
|
|
83
|
+
const s = {
|
|
84
84
|
__index__: o,
|
|
85
|
-
...
|
|
85
|
+
...e.props
|
|
86
86
|
};
|
|
87
|
-
return
|
|
87
|
+
return d.cloneElement(e, s);
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
}).filter(
|
|
91
|
-
(
|
|
91
|
+
(e) => L(e, "type.__PQB_GRID_ITEM__")
|
|
92
92
|
)
|
|
93
93
|
}
|
|
94
94
|
)
|
package/grid/GridItem.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import Q from "lodash/isFunction";
|
|
3
|
+
import T from "lodash/isString";
|
|
4
|
+
import m, { forwardRef as V, useContext as p, useMemo as c, useEffect as k } from "react";
|
|
5
5
|
import "../config-provider/ConfigProvider.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { GridContext as
|
|
9
|
-
import { useResponsiveState as
|
|
10
|
-
import { resolveItemData as
|
|
11
|
-
import
|
|
6
|
+
import q from "../components/common/hooks/useMergeProps.js";
|
|
7
|
+
import z from "@unicom-cloud/utils/class-name";
|
|
8
|
+
import { GridContext as A, GridDataCollectorContext as H } from "./context.js";
|
|
9
|
+
import { useResponsiveState as C } from "./hook/useResponsiveState.js";
|
|
10
|
+
import { resolveItemData as J } from "./util.js";
|
|
11
|
+
import K from "../config-provider/context.js";
|
|
12
12
|
const U = {
|
|
13
13
|
suffix: !1,
|
|
14
14
|
offset: 0,
|
|
15
15
|
span: 1
|
|
16
16
|
};
|
|
17
|
-
function W(
|
|
18
|
-
const { getPrefixCls:
|
|
19
|
-
|
|
17
|
+
function W($, g) {
|
|
18
|
+
const { getPrefixCls: G, componentConfig: _, rtl: y } = p(K), i = q(
|
|
19
|
+
$,
|
|
20
20
|
U,
|
|
21
|
-
|
|
21
|
+
_?.["Grid.GridItem"]
|
|
22
22
|
), {
|
|
23
|
-
children:
|
|
24
|
-
className:
|
|
25
|
-
style:
|
|
26
|
-
offset:
|
|
27
|
-
span:
|
|
23
|
+
children: a,
|
|
24
|
+
className: S,
|
|
25
|
+
style: v,
|
|
26
|
+
offset: N,
|
|
27
|
+
span: D,
|
|
28
28
|
__index__: s
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
), { colGap:
|
|
32
|
-
[`${
|
|
33
|
-
[`${
|
|
34
|
-
},
|
|
35
|
-
suffix: !!
|
|
29
|
+
} = i, r = p(A), { collectItemData: R, removeItemData: E } = p(
|
|
30
|
+
H
|
|
31
|
+
), { colGap: f, cols: l, displayIndexList: P, overflow: u } = r, d = C(N, 0), n = C(D, 1), x = G?.("grid-item"), w = P?.includes(s), M = {
|
|
32
|
+
[`${x}`]: !0,
|
|
33
|
+
[`${x}-rtl`]: y
|
|
34
|
+
}, b = z(M, S), e = c(() => J(r.cols, {
|
|
35
|
+
suffix: !!i.suffix,
|
|
36
36
|
span: n,
|
|
37
|
-
offset:
|
|
38
|
-
}), [r.cols,
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
offset: d
|
|
38
|
+
}), [r.cols, i.suffix, n, d]);
|
|
39
|
+
k(() => (R(s, e), () => {
|
|
40
|
+
E(s);
|
|
41
41
|
}), [s, e]);
|
|
42
|
-
const
|
|
42
|
+
const F = c(() => {
|
|
43
43
|
const { offset: t, span: o } = e;
|
|
44
44
|
return t > 0 ? {
|
|
45
|
-
marginLeft: `calc((${`(100% - ${
|
|
45
|
+
marginLeft: `calc((${`(100% - ${f * (o - 1)}px) / ${o}`} * ${t}) + ${f * t}px)`
|
|
46
46
|
} : {};
|
|
47
|
-
}, [e,
|
|
47
|
+
}, [e, f]), L = c(() => {
|
|
48
48
|
const { suffix: t, span: o } = e;
|
|
49
|
-
return t ? `${
|
|
50
|
-
}, [e,
|
|
51
|
-
gridColumn: `${
|
|
52
|
-
...
|
|
53
|
-
...
|
|
49
|
+
return t ? `${l - o + 1}` : `span ${o}`;
|
|
50
|
+
}, [e, l]), j = !w || n === 0 ? { display: "none" } : {}, B = {
|
|
51
|
+
gridColumn: `${L} / span ${n}`,
|
|
52
|
+
...F,
|
|
53
|
+
...j
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ O(
|
|
56
56
|
"div",
|
|
57
57
|
{
|
|
58
58
|
ref: g,
|
|
59
|
-
className:
|
|
59
|
+
className: b,
|
|
60
60
|
style: {
|
|
61
|
-
...
|
|
62
|
-
...
|
|
61
|
+
...B,
|
|
62
|
+
...v
|
|
63
63
|
},
|
|
64
|
-
children:
|
|
65
|
-
overflow:
|
|
64
|
+
children: Q(a) ? a({ overflow: u }) : m.Children.map(a, (t) => t && r.collapsed && m.isValidElement(t) && !T(t.type) ? m.cloneElement(t, {
|
|
65
|
+
overflow: u,
|
|
66
66
|
...t.props
|
|
67
67
|
}) : t)
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
const X =
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const X = V(W), I = X;
|
|
72
|
+
I.displayName = "GridItem";
|
|
73
|
+
I.__PQB_GRID_ITEM__ = !0;
|
|
74
74
|
export {
|
|
75
|
-
|
|
75
|
+
I as default
|
|
76
76
|
};
|
package/grid/Row.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, useContext as z, useState as G, useRef as H, useEffect as V } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
4
|
import B from "../components/common/hooks/useMergeProps.js";
|
|
5
5
|
import E from "@unicom-cloud/utils/class-name";
|
|
6
6
|
import { omit as L } from "../components/common/utils/omit.js";
|
|
7
|
-
import { responsiveObserve as
|
|
7
|
+
import { responsiveObserve as y, responsiveArray as x } from "../utils/responsiveObserve.js";
|
|
8
8
|
import { RowContext as M } from "./context.js";
|
|
9
9
|
import O from "../config-provider/context.js";
|
|
10
10
|
const T = {
|
|
@@ -12,12 +12,12 @@ const T = {
|
|
|
12
12
|
align: "start",
|
|
13
13
|
justify: "start"
|
|
14
14
|
};
|
|
15
|
-
function q(
|
|
16
|
-
const { getPrefixCls:
|
|
17
|
-
|
|
15
|
+
function q(d, b) {
|
|
16
|
+
const { getPrefixCls: A, componentConfig: j, rtl: v } = z(O), C = B(
|
|
17
|
+
d,
|
|
18
18
|
T,
|
|
19
|
-
|
|
20
|
-
), { className:
|
|
19
|
+
j?.["Grid.Row"]
|
|
20
|
+
), { className: R, style: w, children: $, div: i, align: m, justify: l, gutter: t, ...N } = C, [h, P] = G({
|
|
21
21
|
xs: !0,
|
|
22
22
|
sm: !0,
|
|
23
23
|
md: !0,
|
|
@@ -25,62 +25,62 @@ function q(A, j) {
|
|
|
25
25
|
xl: !0,
|
|
26
26
|
xxl: !0,
|
|
27
27
|
xxxl: !0
|
|
28
|
-
}),
|
|
29
|
-
V(() => (
|
|
30
|
-
(!Array.isArray(
|
|
28
|
+
}), u = H();
|
|
29
|
+
V(() => (u.current = y.subscribe((r) => {
|
|
30
|
+
(!Array.isArray(t) && typeof t == "object" || Array.isArray(t) && (typeof t[0] == "object" || typeof t[1] == "object")) && P(r);
|
|
31
31
|
}), () => {
|
|
32
|
-
|
|
32
|
+
y.unsubscribe(u.current);
|
|
33
33
|
}), []);
|
|
34
|
-
function
|
|
34
|
+
function p(r) {
|
|
35
35
|
let e = 0;
|
|
36
|
-
if (typeof
|
|
37
|
-
for (let
|
|
38
|
-
const f =
|
|
39
|
-
if (
|
|
40
|
-
e =
|
|
36
|
+
if (typeof r == "object")
|
|
37
|
+
for (let c = 0; c < x.length; c++) {
|
|
38
|
+
const f = x[c];
|
|
39
|
+
if (h[f] && r[f] !== void 0) {
|
|
40
|
+
e = r[f];
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else
|
|
45
|
-
e =
|
|
45
|
+
e = r;
|
|
46
46
|
return e;
|
|
47
47
|
}
|
|
48
|
-
const s =
|
|
48
|
+
const s = A?.("row"), k = E(
|
|
49
49
|
{
|
|
50
|
-
[`${s}`]: !
|
|
51
|
-
[`${s}-align-${
|
|
52
|
-
[`${s}-justify-${
|
|
50
|
+
[`${s}`]: !i,
|
|
51
|
+
[`${s}-align-${m}`]: m,
|
|
52
|
+
[`${s}-justify-${l}`]: l,
|
|
53
53
|
[`${s}-rtl`]: v
|
|
54
54
|
},
|
|
55
|
-
|
|
56
|
-
), o = {},
|
|
57
|
-
Array.isArray(
|
|
58
|
-
),
|
|
59
|
-
if ((
|
|
60
|
-
const
|
|
61
|
-
|
|
55
|
+
R
|
|
56
|
+
), o = {}, n = p(
|
|
57
|
+
Array.isArray(t) ? t[0] : t
|
|
58
|
+
), a = p(Array.isArray(t) ? t[1] : 0);
|
|
59
|
+
if ((n || a) && !i) {
|
|
60
|
+
const r = -n / 2, e = -a / 2;
|
|
61
|
+
r && (o.marginLeft = r, o.marginRight = r), e && (o.marginTop = e, o.marginBottom = e);
|
|
62
62
|
}
|
|
63
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ g(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
|
-
ref:
|
|
67
|
-
...L(
|
|
66
|
+
ref: b,
|
|
67
|
+
...L(N, ["gutter"]),
|
|
68
68
|
style: {
|
|
69
|
-
|
|
69
|
+
...w,
|
|
70
70
|
...o
|
|
71
71
|
},
|
|
72
|
-
className:
|
|
73
|
-
children: /* @__PURE__ */
|
|
72
|
+
className: k,
|
|
73
|
+
children: /* @__PURE__ */ g(
|
|
74
74
|
M.Provider,
|
|
75
75
|
{
|
|
76
|
-
value: { gutter: [
|
|
77
|
-
children:
|
|
76
|
+
value: { gutter: [n, a], div: i },
|
|
77
|
+
children: $
|
|
78
78
|
}
|
|
79
79
|
)
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
|
-
const D =
|
|
83
|
+
const D = S(q);
|
|
84
84
|
D.displayName = "Row";
|
|
85
85
|
export {
|
|
86
86
|
D as default
|