@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/anchor/Anchor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as mt, jsx as w } from "react/jsx-runtime";
|
|
2
2
|
import { compute as pt } from "../dist/compute-scroll-into-view/src/index.js";
|
|
3
3
|
import dt from "../dist/scroll-into-view-if-needed/src/index.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import j from "lodash/isFunction";
|
|
5
|
+
import b from "lodash/isNumber";
|
|
6
6
|
import gt from "lodash/throttle";
|
|
7
7
|
import { forwardRef as ht, useContext as Ct, useRef as k, useState as kt, useEffect as A, useCallback as N, useImperativeHandle as xt } from "react";
|
|
8
8
|
import Lt from "../affix/index.js";
|
|
@@ -15,7 +15,7 @@ import { on as Nt, off as St } from "../components/common/utils/dom.js";
|
|
|
15
15
|
import { isWindow as $t } from "../components/common/utils/is.js";
|
|
16
16
|
import Tt from "./context.js";
|
|
17
17
|
import vt from "./Link.js";
|
|
18
|
-
import { findNode as P, getContainerElement as bt, getContainer as
|
|
18
|
+
import { findNode as P, getContainerElement as bt, getContainer as Pt, getScrollParent as Mt, slide as Et } from "./util.js";
|
|
19
19
|
import Ft from "../config-provider/context.js";
|
|
20
20
|
const It = {
|
|
21
21
|
animation: !0,
|
|
@@ -23,11 +23,11 @@ const It = {
|
|
|
23
23
|
hash: !0,
|
|
24
24
|
boundary: "start"
|
|
25
25
|
};
|
|
26
|
-
function Ht(
|
|
27
|
-
const { getPrefixCls:
|
|
28
|
-
|
|
26
|
+
function Ht(_, q) {
|
|
27
|
+
const { getPrefixCls: G, componentConfig: J, rtl: M } = Ct(Ft), K = Rt(
|
|
28
|
+
_,
|
|
29
29
|
It,
|
|
30
|
-
|
|
30
|
+
J?.Anchor
|
|
31
31
|
), {
|
|
32
32
|
className: Q,
|
|
33
33
|
style: X,
|
|
@@ -38,41 +38,41 @@ function Ht(G, J) {
|
|
|
38
38
|
affixStyle: tt,
|
|
39
39
|
offsetBottom: et,
|
|
40
40
|
offsetTop: nt,
|
|
41
|
-
hash:
|
|
41
|
+
hash: E = !0,
|
|
42
42
|
boundary: i = "start",
|
|
43
|
-
targetOffset:
|
|
43
|
+
targetOffset: S,
|
|
44
44
|
children: rt,
|
|
45
45
|
direction: L = "vertical",
|
|
46
|
-
onSelect:
|
|
47
|
-
onChange:
|
|
46
|
+
onSelect: F,
|
|
47
|
+
onChange: $,
|
|
48
48
|
...ot
|
|
49
|
-
} = K, f =
|
|
49
|
+
} = K, f = G?.("anchor"), it = At(f, Q, {
|
|
50
50
|
[`${f}-lineless`]: x,
|
|
51
|
-
[`${f}-rtl`]:
|
|
51
|
+
[`${f}-rtl`]: M,
|
|
52
52
|
[`${f}-horizontal`]: L === "horizontal"
|
|
53
|
-
}), s = k(null), p = k(null), a = k(/* @__PURE__ */ new Map()),
|
|
54
|
-
function
|
|
55
|
-
let t =
|
|
56
|
-
return m || (t =
|
|
53
|
+
}), s = k(null), p = k(null), a = k(/* @__PURE__ */ new Map()), T = k(!1), d = k(null), [st, I] = kt(0), [o, ct] = wt(""), lt = yt();
|
|
54
|
+
function H() {
|
|
55
|
+
let t = Pt(m);
|
|
56
|
+
return m || (t = Mt(s.current)), t;
|
|
57
57
|
}
|
|
58
58
|
A(() => {
|
|
59
|
-
const t =
|
|
59
|
+
const t = H();
|
|
60
60
|
d.current = t;
|
|
61
61
|
}, [m]);
|
|
62
|
-
const ft = N(() =>
|
|
62
|
+
const ft = N(() => H(), [m]);
|
|
63
63
|
xt(
|
|
64
|
-
|
|
64
|
+
q,
|
|
65
65
|
() => ({
|
|
66
66
|
dom: s.current,
|
|
67
67
|
getRootDOMNode: () => s.current
|
|
68
68
|
}),
|
|
69
69
|
[]
|
|
70
70
|
);
|
|
71
|
-
function
|
|
72
|
-
t && (a.current.set(t, e),
|
|
71
|
+
function O(t, e) {
|
|
72
|
+
t && (a.current.set(t, e), I(Math.random()));
|
|
73
73
|
}
|
|
74
74
|
function at(t) {
|
|
75
|
-
a.current.delete(t),
|
|
75
|
+
a.current.delete(t), I(Math.random());
|
|
76
76
|
}
|
|
77
77
|
const y = N(
|
|
78
78
|
(t) => {
|
|
@@ -80,7 +80,7 @@ function Ht(G, J) {
|
|
|
80
80
|
return;
|
|
81
81
|
if (!a.current.has(t)) {
|
|
82
82
|
const n = P(s.current, `a[data-href='${t}']`);
|
|
83
|
-
n &&
|
|
83
|
+
n && O(t, n);
|
|
84
84
|
}
|
|
85
85
|
const e = a.current.get(t);
|
|
86
86
|
e && t !== o && (dt(e, {
|
|
@@ -89,35 +89,35 @@ function Ht(G, J) {
|
|
|
89
89
|
scrollMode: "if-needed",
|
|
90
90
|
boundary: s.current
|
|
91
91
|
}), ct(t).then(() => {
|
|
92
|
-
|
|
92
|
+
j($) && $(t, o);
|
|
93
93
|
}));
|
|
94
94
|
},
|
|
95
|
-
[o,
|
|
96
|
-
),
|
|
95
|
+
[o, $]
|
|
96
|
+
), z = N(() => {
|
|
97
97
|
let t;
|
|
98
|
-
const e =
|
|
99
|
-
return [...a.current.keys()].some((
|
|
100
|
-
const c = P(document,
|
|
98
|
+
const e = b(i) ? i : 0, n = d.current, h = bt(n).getBoundingClientRect(), R = document.documentElement.clientHeight;
|
|
99
|
+
return [...a.current.keys()].some((v) => {
|
|
100
|
+
const c = P(document, v);
|
|
101
101
|
let u = !1;
|
|
102
102
|
if (c) {
|
|
103
103
|
const { top: r, height: C } = c.getBoundingClientRect();
|
|
104
104
|
if ($t(n)) {
|
|
105
|
-
const l =
|
|
105
|
+
const l = S ?? R / 2;
|
|
106
106
|
u = r >= e && r <= l || r <= e && r + C >= l;
|
|
107
107
|
} else {
|
|
108
|
-
const l = r - h.top - e,
|
|
109
|
-
u = l >= 0 && l <=
|
|
108
|
+
const l = r - h.top - e, W = S ?? h.height / 2;
|
|
109
|
+
u = l >= 0 && l <= W || l <= 0 && l + C >= W;
|
|
110
110
|
}
|
|
111
111
|
u && (t = c);
|
|
112
112
|
}
|
|
113
113
|
return u;
|
|
114
114
|
}), t;
|
|
115
|
-
}, [i,
|
|
115
|
+
}, [i, S]), g = N(
|
|
116
116
|
gt(
|
|
117
117
|
(t) => {
|
|
118
|
-
if (
|
|
118
|
+
if (T.current)
|
|
119
119
|
return;
|
|
120
|
-
const e =
|
|
120
|
+
const e = z();
|
|
121
121
|
if (e && e.id) {
|
|
122
122
|
const n = `#${e.id}`;
|
|
123
123
|
y(n);
|
|
@@ -126,29 +126,29 @@ function Ht(G, J) {
|
|
|
126
126
|
30,
|
|
127
127
|
{ trailing: !0 }
|
|
128
128
|
),
|
|
129
|
-
[
|
|
129
|
+
[z, y]
|
|
130
130
|
);
|
|
131
|
-
function
|
|
131
|
+
function B(t) {
|
|
132
132
|
if (t)
|
|
133
133
|
try {
|
|
134
134
|
const e = P(document, t);
|
|
135
135
|
if (!e)
|
|
136
136
|
return;
|
|
137
|
-
const n =
|
|
137
|
+
const n = b(i) ? "start" : i, V = b(i) ? i : 0, h = pt(e, { block: n });
|
|
138
138
|
if (!h.length)
|
|
139
139
|
return;
|
|
140
140
|
let R = !1;
|
|
141
|
-
const
|
|
141
|
+
const v = h.map(({ el: c, top: u }) => new Promise((r) => {
|
|
142
142
|
if (!R) {
|
|
143
143
|
c === d.current && (R = !0);
|
|
144
|
-
const C = u -
|
|
145
|
-
return Y ?
|
|
144
|
+
const C = u - V;
|
|
145
|
+
return Y ? Et(c, C, r) : (E || (c.scrollTop = C), r(null));
|
|
146
146
|
}
|
|
147
147
|
r(null);
|
|
148
148
|
}));
|
|
149
|
-
|
|
149
|
+
T.current = !0, Promise.all(v).then(() => {
|
|
150
150
|
setTimeout(() => {
|
|
151
|
-
|
|
151
|
+
T.current = !1;
|
|
152
152
|
}, 27);
|
|
153
153
|
});
|
|
154
154
|
} catch (e) {
|
|
@@ -156,18 +156,18 @@ function Ht(G, J) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function ut(t, e) {
|
|
159
|
-
|
|
159
|
+
E || t.preventDefault(), y(e), B(e), j(F) && F(e, o);
|
|
160
160
|
}
|
|
161
161
|
A(() => {
|
|
162
162
|
const t = decodeURIComponent(location.hash);
|
|
163
|
-
t ? (y(t),
|
|
163
|
+
t ? (y(t), B(t)) : g(null);
|
|
164
164
|
}, []), A(() => (lt || g(null), Nt(d.current, "scroll", g), () => {
|
|
165
165
|
St(d.current, "scroll", g);
|
|
166
166
|
}), [m, g]), A(() => {
|
|
167
167
|
const t = a.current.get(o);
|
|
168
168
|
t && !x && p.current && (L === "horizontal" ? (p.current.style.left = `${t.offsetLeft}px`, p.current.style.width = `${t.clientWidth}px`) : p.current.style.top = `${t.offsetTop}px`);
|
|
169
|
-
}, [o, x, L,
|
|
170
|
-
const
|
|
169
|
+
}, [o, x, L, M, st]);
|
|
170
|
+
const U = /* @__PURE__ */ mt("div", { className: it, style: X, ref: s, ...ot, children: [
|
|
171
171
|
!x && o && /* @__PURE__ */ w("div", { className: `${f}-line-slider`, ref: p }),
|
|
172
172
|
/* @__PURE__ */ w(
|
|
173
173
|
Tt.Provider,
|
|
@@ -175,7 +175,7 @@ function Ht(G, J) {
|
|
|
175
175
|
value: {
|
|
176
176
|
direction: L,
|
|
177
177
|
currentLink: o,
|
|
178
|
-
addLink:
|
|
178
|
+
addLink: O,
|
|
179
179
|
removeLink: at,
|
|
180
180
|
onLinkClick: ut
|
|
181
181
|
},
|
|
@@ -190,14 +190,14 @@ function Ht(G, J) {
|
|
|
190
190
|
offsetBottom: et,
|
|
191
191
|
style: tt,
|
|
192
192
|
target: ft,
|
|
193
|
-
children:
|
|
193
|
+
children: U
|
|
194
194
|
}
|
|
195
|
-
) :
|
|
195
|
+
) : U;
|
|
196
196
|
}
|
|
197
|
-
const Ot = ht(Ht),
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
const Ot = ht(Ht), D = Ot;
|
|
198
|
+
D.displayName = "Anchor";
|
|
199
|
+
D.Link = vt;
|
|
200
200
|
export {
|
|
201
201
|
vt as AnchorLink,
|
|
202
|
-
|
|
202
|
+
D as default
|
|
203
203
|
};
|
package/anchor/Link.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsxs as A, jsx as P } from "react/jsx-runtime";
|
|
2
|
+
import g from "lodash/isNull";
|
|
3
|
+
import j from "lodash/isPlainObject";
|
|
4
|
+
import v from "lodash/isString";
|
|
5
|
+
import R from "lodash/isUndefined";
|
|
6
|
+
import E, { forwardRef as O, useContext as c, useRef as $, useImperativeHandle as b, useEffect as w, isValidElement as I } from "react";
|
|
7
7
|
import "../config-provider/ConfigProvider.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import M from "../components/common/hooks/useMergeProps.js";
|
|
9
|
+
import S from "@unicom-cloud/utils/class-name";
|
|
10
10
|
import z from "./context.js";
|
|
11
11
|
import D from "../config-provider/context.js";
|
|
12
|
-
const
|
|
12
|
+
const a = "AnchorLink", H = {
|
|
13
13
|
href: "#"
|
|
14
14
|
};
|
|
15
|
-
function U(
|
|
16
|
-
return
|
|
15
|
+
function U(t) {
|
|
16
|
+
return j(t) && Object.prototype.hasOwnProperty.call(t, "displayName");
|
|
17
17
|
}
|
|
18
|
-
function V(
|
|
19
|
-
const { getPrefixCls:
|
|
20
|
-
|
|
18
|
+
function V(t, l) {
|
|
19
|
+
const { getPrefixCls: m, componentConfig: f } = c(D), { className: p, style: d, href: e, title: n, children: s, ...u } = M(
|
|
20
|
+
t,
|
|
21
21
|
H,
|
|
22
|
-
|
|
23
|
-
),
|
|
24
|
-
|
|
22
|
+
f?.["Anchor.Link"]
|
|
23
|
+
), h = c(z), { currentLink: C, addLink: k, removeLink: N, onLinkClick: x, direction: L } = h, o = m?.("anchor-link"), y = S(
|
|
24
|
+
o,
|
|
25
25
|
{
|
|
26
|
-
[`${
|
|
26
|
+
[`${o}-active`]: C === e
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
),
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
}), [
|
|
33
|
-
!
|
|
28
|
+
p
|
|
29
|
+
), i = $(null);
|
|
30
|
+
return b(l, () => i.current, []), w(() => (k?.(e, i.current), () => {
|
|
31
|
+
N?.(e);
|
|
32
|
+
}), [e]), /* @__PURE__ */ A("div", { className: y, style: d, ref: i, ...u, children: [
|
|
33
|
+
!R(n) && !g(n) && /* @__PURE__ */ P(
|
|
34
34
|
"a",
|
|
35
35
|
{
|
|
36
|
-
className: `${
|
|
37
|
-
title:
|
|
38
|
-
href:
|
|
39
|
-
"data-href":
|
|
40
|
-
onClick: (
|
|
41
|
-
|
|
36
|
+
className: `${o}-title`,
|
|
37
|
+
title: v(n) ? n : "",
|
|
38
|
+
href: e,
|
|
39
|
+
"data-href": e,
|
|
40
|
+
onClick: (r) => {
|
|
41
|
+
x?.(r, e);
|
|
42
42
|
},
|
|
43
|
-
children:
|
|
43
|
+
children: n
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
-
|
|
46
|
+
s && L !== "horizontal" && E.Children.map(s, (r) => I(r) && U(r.type) && r.type.displayName === a && r)
|
|
47
47
|
] });
|
|
48
48
|
}
|
|
49
|
-
const Y =
|
|
50
|
-
Y.displayName =
|
|
49
|
+
const Y = O(V);
|
|
50
|
+
Y.displayName = a;
|
|
51
51
|
export {
|
|
52
52
|
Y as default
|
|
53
53
|
};
|
package/anchor/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tween as u } from "../dist/tween/src/tween.js";
|
|
2
|
-
import { quartOut as
|
|
2
|
+
import { quartOut as c } from "../dist/tween/src/easing.js";
|
|
3
3
|
import i from "lodash/isString";
|
|
4
|
-
import { isWindow as
|
|
4
|
+
import { isWindow as l } from "../components/common/utils/is.js";
|
|
5
5
|
function s(o, n) {
|
|
6
6
|
const r = i(n) && n[0] === "#" ? `[id='${n.replace("#", "")}']` : n;
|
|
7
7
|
try {
|
|
@@ -18,13 +18,13 @@ function w(o, n, r) {
|
|
|
18
18
|
to: {
|
|
19
19
|
scrollTop: n
|
|
20
20
|
},
|
|
21
|
-
easing:
|
|
21
|
+
easing: c,
|
|
22
22
|
duration: 300,
|
|
23
23
|
onUpdate: (e) => {
|
|
24
24
|
o.scrollTop = e.scrollTop;
|
|
25
25
|
},
|
|
26
26
|
onFinish: () => {
|
|
27
|
-
r
|
|
27
|
+
r?.();
|
|
28
28
|
}
|
|
29
29
|
}).start();
|
|
30
30
|
}
|
|
@@ -32,7 +32,7 @@ function g(o) {
|
|
|
32
32
|
return i(o) ? s(document, o) : o || window;
|
|
33
33
|
}
|
|
34
34
|
function S(o) {
|
|
35
|
-
return
|
|
35
|
+
return l(o) ? document.documentElement || document.body : o;
|
|
36
36
|
}
|
|
37
37
|
function d(o) {
|
|
38
38
|
if (o == null)
|
package/auto-complete/index.js
CHANGED
|
@@ -1,156 +1,150 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import Y from "@unicom-cloud/icons/IconUiLoading";
|
|
3
|
+
import u, { useContext as Z, useState as ee, useRef as x, isValidElement as te, useImperativeHandle as oe } from "react";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { isSelectOption as
|
|
10
|
-
import
|
|
11
|
-
import { Enter as
|
|
12
|
-
import { omit as
|
|
13
|
-
import { pickDataAttributes as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
5
|
+
import re from "../components/common/hooks/useMergeProps.js";
|
|
6
|
+
import ne from "../components/common/hooks/useMergeValue.js";
|
|
7
|
+
import se from "../input/Input.js";
|
|
8
|
+
import c from "../select/Select.js";
|
|
9
|
+
import { isSelectOption as le, isSelectOptGroup as ie } from "../select/util.js";
|
|
10
|
+
import pe from "@unicom-cloud/utils/class-name";
|
|
11
|
+
import { Enter as ue, Esc as ce } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
12
|
+
import { omit as ae } from "../components/common/utils/omit.js";
|
|
13
|
+
import { pickDataAttributes as fe } from "../components/common/utils/pick.js";
|
|
14
|
+
import me from "../config-provider/context.js";
|
|
15
|
+
const de = `Autocomplete_${Math.random()}`, { Option: N } = c, ge = {
|
|
16
16
|
defaultActiveFirstOption: !0,
|
|
17
|
-
triggerElement: /* @__PURE__ */
|
|
17
|
+
triggerElement: /* @__PURE__ */ n(se, {})
|
|
18
18
|
};
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
O == null ? void 0 : O.AutoComplete
|
|
19
|
+
function Ce(S, F) {
|
|
20
|
+
const { getPrefixCls: V, componentConfig: w } = Z(me), r = re(
|
|
21
|
+
S,
|
|
22
|
+
ge,
|
|
23
|
+
w?.AutoComplete
|
|
25
24
|
), {
|
|
26
|
-
style:
|
|
27
|
-
className:
|
|
28
|
-
children:
|
|
29
|
-
data:
|
|
30
|
-
defaultValue:
|
|
31
|
-
value:
|
|
32
|
-
placeholder:
|
|
33
|
-
error:
|
|
34
|
-
disabled:
|
|
35
|
-
strict:
|
|
36
|
-
allowClear:
|
|
37
|
-
loading:
|
|
38
|
-
defaultActiveFirstOption:
|
|
39
|
-
triggerElement:
|
|
40
|
-
getPopupContainer:
|
|
41
|
-
dropdownRender:
|
|
42
|
-
virtualListProps:
|
|
43
|
-
onFocus:
|
|
44
|
-
onBlur:
|
|
45
|
-
onChange:
|
|
46
|
-
onSearch:
|
|
47
|
-
onSelect:
|
|
48
|
-
onPressEnter:
|
|
49
|
-
inputProps:
|
|
50
|
-
} =
|
|
51
|
-
defaultValue:
|
|
52
|
-
value:
|
|
53
|
-
}), [
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
if (
|
|
25
|
+
style: I,
|
|
26
|
+
className: v,
|
|
27
|
+
children: a,
|
|
28
|
+
data: l,
|
|
29
|
+
defaultValue: b,
|
|
30
|
+
value: k,
|
|
31
|
+
placeholder: L,
|
|
32
|
+
error: R,
|
|
33
|
+
disabled: B,
|
|
34
|
+
strict: G,
|
|
35
|
+
allowClear: M,
|
|
36
|
+
loading: $,
|
|
37
|
+
defaultActiveFirstOption: D,
|
|
38
|
+
triggerElement: f,
|
|
39
|
+
getPopupContainer: j,
|
|
40
|
+
dropdownRender: H,
|
|
41
|
+
virtualListProps: K,
|
|
42
|
+
onFocus: T,
|
|
43
|
+
onBlur: U,
|
|
44
|
+
onChange: O,
|
|
45
|
+
onSearch: _,
|
|
46
|
+
onSelect: q,
|
|
47
|
+
onPressEnter: y,
|
|
48
|
+
inputProps: o
|
|
49
|
+
} = r, [m, A] = ne("", {
|
|
50
|
+
defaultValue: b,
|
|
51
|
+
value: k
|
|
52
|
+
}), [z, P] = ee(!1), i = x(null), s = x(null), E = V?.("autocomplete"), J = "filterOption" in r ? r.filterOption : (e, t) => G ? t.props.value.indexOf(e) > -1 : t.props.value.toLowerCase().indexOf(e.toLowerCase()) > -1, d = u.Children.toArray(a);
|
|
53
|
+
let g = null;
|
|
54
|
+
d.length && (le(d[0]) || ie(d[0])) ? g = a : l && l.length && (g = l.map((e, t) => {
|
|
55
|
+
if (te(e))
|
|
57
56
|
return e;
|
|
58
57
|
if (typeof e == "string")
|
|
59
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ n(N, { value: e, children: e }, t);
|
|
60
59
|
if (typeof e == "object") {
|
|
61
|
-
const { value:
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
60
|
+
const { value: p, name: X } = e;
|
|
61
|
+
return /* @__PURE__ */ n(
|
|
62
|
+
N,
|
|
64
63
|
{
|
|
65
|
-
value:
|
|
66
|
-
extra:
|
|
67
|
-
children:
|
|
64
|
+
value: p,
|
|
65
|
+
extra: ae(e, ["value", "name"]),
|
|
66
|
+
children: X
|
|
68
67
|
},
|
|
69
|
-
|
|
68
|
+
t
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
return null;
|
|
73
|
-
})),
|
|
74
|
-
const
|
|
72
|
+
})), oe(F, () => i.current);
|
|
73
|
+
const C = typeof f == "function" ? f({ value: m }) : f, Q = u.cloneElement(C, {
|
|
75
74
|
ref: (e) => {
|
|
76
|
-
|
|
77
|
-
const { ref:
|
|
78
|
-
typeof
|
|
75
|
+
i.current = e;
|
|
76
|
+
const { ref: t } = C;
|
|
77
|
+
typeof t == "function" && t(e);
|
|
79
78
|
},
|
|
80
|
-
className:
|
|
81
|
-
`${
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
className: pe(
|
|
80
|
+
`${E}`,
|
|
81
|
+
o && o.className,
|
|
82
|
+
v
|
|
84
83
|
),
|
|
85
|
-
style:
|
|
86
|
-
value:
|
|
87
|
-
placeholder:
|
|
88
|
-
error:
|
|
89
|
-
status:
|
|
90
|
-
disabled:
|
|
91
|
-
allowClear:
|
|
92
|
-
...
|
|
93
|
-
...
|
|
84
|
+
style: I,
|
|
85
|
+
value: m,
|
|
86
|
+
placeholder: L,
|
|
87
|
+
error: R,
|
|
88
|
+
status: r.status,
|
|
89
|
+
disabled: B,
|
|
90
|
+
allowClear: M,
|
|
91
|
+
...o,
|
|
92
|
+
...fe(r),
|
|
94
93
|
// Empty tag to ensure the consistency of the dom structure of input, such that input won't accidentally lose focus due to structure change on input.
|
|
95
|
-
suffix:
|
|
94
|
+
suffix: $ ? /* @__PURE__ */ n(Y, {}) : C?.type?.displayName === "Search" ? void 0 : o?.suffix || /* @__PURE__ */ n("i", {}),
|
|
96
95
|
onFocus: (e) => {
|
|
97
|
-
|
|
98
|
-
b(!0), h == null || h(e), (o = t == null ? void 0 : t.onFocus) == null || o.call(t, e);
|
|
96
|
+
P(!0), T?.(e), o?.onFocus?.(e);
|
|
99
97
|
},
|
|
100
98
|
onBlur: (e) => {
|
|
101
|
-
|
|
102
|
-
b(!1), A == null || A(e), (o = t == null ? void 0 : t.onBlur) == null || o.call(t, e);
|
|
99
|
+
P(!1), U?.(e), o?.onBlur?.(e);
|
|
103
100
|
},
|
|
104
101
|
onKeyDown: (e) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
)), v(e, M);
|
|
102
|
+
const t = e.key;
|
|
103
|
+
if (s.current?.hotkeyHandler?.(e), t === ue.key && y) {
|
|
104
|
+
let p;
|
|
105
|
+
s.current && (p = s.current.getOptionInfoByValue(
|
|
106
|
+
s.current.activeOptionValue
|
|
107
|
+
)), y(e, p);
|
|
112
108
|
}
|
|
113
|
-
|
|
109
|
+
t === ce.key && i.current?.blur?.(), o?.onKeyDown?.(e);
|
|
114
110
|
},
|
|
115
|
-
onChange: (e,
|
|
116
|
-
|
|
117
|
-
F(e), E == null || E(e), c == null || c(e), (r = t == null ? void 0 : t.onChange) == null || r.call(t, e, o);
|
|
111
|
+
onChange: (e, t) => {
|
|
112
|
+
A(e), _?.(e), O?.(e), o?.onChange?.(e, t);
|
|
118
113
|
}
|
|
119
|
-
}),
|
|
120
|
-
popupVisible: !!(
|
|
121
|
-
...
|
|
114
|
+
}), W = {
|
|
115
|
+
popupVisible: !!(z && (l?.length || u.Children.count(a))),
|
|
116
|
+
...r.triggerProps,
|
|
122
117
|
// Other trigger types are not supported yet
|
|
123
118
|
trigger: "focus",
|
|
124
|
-
className: [`${
|
|
119
|
+
className: [`${E}-popup`].concat(r?.triggerProps?.className)
|
|
125
120
|
};
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
triggerElement:
|
|
121
|
+
return /* @__PURE__ */ n(c, { ref: s, ...{
|
|
122
|
+
triggerElement: Q,
|
|
128
123
|
// Guarantee that onChange can always be triggered
|
|
129
|
-
value:
|
|
130
|
-
inputValue:
|
|
131
|
-
defaultActiveFirstOption:
|
|
132
|
-
triggerProps:
|
|
133
|
-
getPopupContainer:
|
|
134
|
-
dropdownRender:
|
|
135
|
-
filterOption:
|
|
136
|
-
virtualListProps:
|
|
124
|
+
value: de,
|
|
125
|
+
inputValue: m,
|
|
126
|
+
defaultActiveFirstOption: D,
|
|
127
|
+
triggerProps: W,
|
|
128
|
+
getPopupContainer: j,
|
|
129
|
+
dropdownRender: H,
|
|
130
|
+
filterOption: J,
|
|
131
|
+
virtualListProps: K,
|
|
137
132
|
notFoundContent: null,
|
|
138
|
-
onChange: (e,
|
|
139
|
-
|
|
140
|
-
F(e), c == null || c(e, o), e && (N == null || N(e, o)), (n = (r = f.current) == null ? void 0 : r.blur) == null || n.call(r);
|
|
133
|
+
onChange: (e, t) => {
|
|
134
|
+
A(e), O?.(e, t), e && q?.(e, t), i.current?.blur?.();
|
|
141
135
|
}
|
|
142
|
-
}, children:
|
|
136
|
+
}, children: g });
|
|
143
137
|
}
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const [
|
|
147
|
-
|
|
148
|
-
|
|
138
|
+
const he = u.forwardRef(Ce), h = he;
|
|
139
|
+
h.displayName = "AutoComplete";
|
|
140
|
+
const [Oe, ye] = [
|
|
141
|
+
c.Option,
|
|
142
|
+
c.OptGroup
|
|
149
143
|
];
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
h.Option = Oe;
|
|
145
|
+
h.OptGroup = ye;
|
|
152
146
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
ye as AutoCompleteOptGroup,
|
|
148
|
+
Oe as AutoCompleteOption,
|
|
149
|
+
h as default
|
|
156
150
|
};
|