@unicom-cloud/ui 0.8.95 → 0.8.97
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/Message.js +1 -1
- package/Notification.js +1 -1
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/QrCode.js +57 -0
- package/Switch.js +1 -1
- package/Tour.js +63 -0
- package/Trigger.js +2 -2
- 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 +52 -51
- 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 +126 -130
- 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/useForceUpdate.js +6 -2
- package/components/common/hooks/useId.js +4 -4
- 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 +11 -10
- package/components/common/utils/PqbCSSTransition.js +1 -1
- 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 +55 -56
- package/development/index.js +9 -9
- package/dist/react-transition-group/src/CSSTransition.js +1 -1
- package/dist/react-transition-group/src/SwitchTransition.js +1 -1
- package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
- package/dist/tween/src/tween.js +24 -25
- 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/index.js +50 -52
- 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 +682 -679
- 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 +223 -231
- 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 +189 -0
- package/liquid-fill/LiquidFill2.js +3 -0
- package/liquid-fill/index.js +4 -0
- package/liquid-fill/interface.js +1 -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 +97 -100
- 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 +61 -66
- 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 +108 -108
- package/slider/util.js +1 -1
- 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 +61 -61
- package/steps/Step.js +42 -42
- package/steps/index.js +54 -54
- package/style.css +1 -1
- package/switch/index.js +78 -79
- 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/time-picker/util.js +4 -4
- 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 +338 -347
- 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/math.d.ts +1 -1
- package/types/common/utils/mutationObserver.d.ts +2 -0
- package/types/common/utils/resizeObserver.d.ts +2 -0
- package/types/pc/alert/interface.d.ts +2 -2
- package/types/pc/details/interface.d.ts +2 -2
- package/types/pc/hooks/index.d.ts +0 -1
- package/types/pc/index.d.ts +3 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +30 -0
- package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
- package/types/pc/liquid-fill/index.d.ts +4 -0
- package/types/pc/liquid-fill/interface.d.ts +0 -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/math.d.ts +1 -1
- 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 +78 -75
- 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 +49 -50
- 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 +274 -275
- package/utils/intersectionObserver.js +4 -0
- package/utils/math.js +7 -11
- package/utils/mutationObserver.js +4 -0
- package/utils/names.js +12 -0
- package/utils/reactTransitionGroup.js +1 -1
- 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/hooks/useComputedState.js +0 -11
- package/components/common/utils/resizeObserverEffect.js +0 -23
- package/hooks/useComputedState.js +0 -4
- package/types/common/hooks/useComputedState.d.ts +0 -4
- package/types/common/utils/resizeObserverEffect.d.ts +0 -2
- package/types/pc/hooks/useComputedState.d.ts +0 -1
- package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
- package/utils/resizeObserverEffect.js +0 -4
- /package/dist/react-transition-group/chunk/{C6QwjD4L.js → CPfP7aNL.js} +0 -0
package/input/Textarea.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as u, jsxs as V } from "react/jsx-runtime";
|
|
2
2
|
import Z from "@unicom-cloud/icons/IconUiClose";
|
|
3
3
|
import _, { useRef as ee, useState as te, useContext as oe, useImperativeHandle as re, useMemo as ne } from "react";
|
|
4
4
|
import "../config-provider/ConfigProvider.js";
|
|
5
5
|
import ae from "../components/common/hooks/useIsomorphicLayoutEffect.js";
|
|
6
6
|
import le from "../components/common/hooks/useMergeValue.js";
|
|
7
7
|
import se from "../icon-hover/index.js";
|
|
8
|
-
import
|
|
8
|
+
import g from "@unicom-cloud/utils/class-name";
|
|
9
9
|
import "../components/common/utils/is.js";
|
|
10
10
|
import { omit as ie } from "../components/common/utils/omit.js";
|
|
11
|
-
import { formatValue as
|
|
11
|
+
import { formatValue as D } from "./Input.js";
|
|
12
12
|
import ce from "./autoSizeTextAreaHeight.js";
|
|
13
13
|
import ue from "./useComposition.js";
|
|
14
14
|
import me from "../config-provider/context.js";
|
|
15
|
-
import { isPlainObject as
|
|
16
|
-
const fe = (n,
|
|
15
|
+
import { isPlainObject as b } from "@unicom-cloud/utils/is";
|
|
16
|
+
const fe = (n, A) => {
|
|
17
17
|
const {
|
|
18
|
-
className:
|
|
19
|
-
style:
|
|
20
|
-
wrapperStyle:
|
|
21
|
-
placeholder:
|
|
18
|
+
className: L,
|
|
19
|
+
style: T,
|
|
20
|
+
wrapperStyle: H,
|
|
21
|
+
placeholder: M,
|
|
22
22
|
disabled: i,
|
|
23
|
-
error:
|
|
23
|
+
error: R,
|
|
24
24
|
maxLength: a,
|
|
25
|
-
showWordLimit:
|
|
26
|
-
allowClear:
|
|
27
|
-
onChange:
|
|
28
|
-
onClear:
|
|
29
|
-
onKeyDown:
|
|
30
|
-
onPressEnter:
|
|
31
|
-
status:
|
|
32
|
-
clearIcon:
|
|
33
|
-
...
|
|
34
|
-
} = n, l =
|
|
35
|
-
defaultValue: "defaultValue" in n ?
|
|
36
|
-
value: "value" in n ?
|
|
25
|
+
showWordLimit: h,
|
|
26
|
+
allowClear: m,
|
|
27
|
+
onChange: k,
|
|
28
|
+
onClear: I,
|
|
29
|
+
onKeyDown: z,
|
|
30
|
+
onPressEnter: E,
|
|
31
|
+
status: P,
|
|
32
|
+
clearIcon: C,
|
|
33
|
+
...W
|
|
34
|
+
} = n, l = b(a) ? a.length : a, r = b(a) ? a.errorOnly ? void 0 : a.length : a, t = ee(), [x, j] = te({}), [s, O] = le("", {
|
|
35
|
+
defaultValue: "defaultValue" in n ? D(n.defaultValue, r) : void 0,
|
|
36
|
+
value: "value" in n ? D(n.value, r) : void 0
|
|
37
37
|
}), {
|
|
38
|
-
compositionValue:
|
|
39
|
-
compositionHandler:
|
|
40
|
-
valueChangeHandler:
|
|
41
|
-
keyDownHandler:
|
|
42
|
-
triggerValueChangeCallback:
|
|
38
|
+
compositionValue: K,
|
|
39
|
+
compositionHandler: f,
|
|
40
|
+
valueChangeHandler: U,
|
|
41
|
+
keyDownHandler: F,
|
|
42
|
+
triggerValueChangeCallback: q
|
|
43
43
|
} = ue({
|
|
44
44
|
value: s,
|
|
45
45
|
maxLength: r,
|
|
46
|
-
onChange:
|
|
47
|
-
onKeyDown:
|
|
48
|
-
onPressEnter:
|
|
46
|
+
onChange: k,
|
|
47
|
+
onKeyDown: z,
|
|
48
|
+
onPressEnter: E,
|
|
49
49
|
beforeTriggerValueChangeCallback: (e) => {
|
|
50
|
-
!("value" in n) && (r === void 0 || e.length <= r) &&
|
|
50
|
+
!("value" in n) && (r === void 0 || e.length <= r) && O(e);
|
|
51
51
|
}
|
|
52
|
-
}),
|
|
53
|
-
i && (
|
|
54
|
-
const
|
|
52
|
+
}), v = K || s || "", { getPrefixCls: B, rtl: d } = oe(me), o = B?.("textarea");
|
|
53
|
+
i && (x.resize = "none");
|
|
54
|
+
const w = () => {
|
|
55
55
|
if (t.current && t.current.focus) {
|
|
56
56
|
if (t.current.setSelectionRange) {
|
|
57
57
|
const e = t.current.textContent.length;
|
|
@@ -59,98 +59,97 @@ const fe = (n, H) => {
|
|
|
59
59
|
}
|
|
60
60
|
t.current.focus();
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, G = () => {
|
|
63
63
|
const e = ce(
|
|
64
64
|
n.autoSize,
|
|
65
65
|
t.current
|
|
66
66
|
);
|
|
67
|
-
e &&
|
|
68
|
-
},
|
|
69
|
-
e.stopPropagation(),
|
|
67
|
+
e && j(e);
|
|
68
|
+
}, y = (e) => {
|
|
69
|
+
e.stopPropagation(), w(), q("", e), I?.();
|
|
70
70
|
};
|
|
71
71
|
ae(() => {
|
|
72
|
-
|
|
73
|
-
}, [
|
|
74
|
-
|
|
72
|
+
G();
|
|
73
|
+
}, [v]), re(
|
|
74
|
+
A,
|
|
75
75
|
() => ({
|
|
76
76
|
dom: t.current,
|
|
77
77
|
focus: () => {
|
|
78
|
-
|
|
78
|
+
w();
|
|
79
79
|
},
|
|
80
80
|
blur: () => {
|
|
81
|
-
|
|
82
|
-
(u = (e = t.current) == null ? void 0 : e.blur) == null || u.call(e);
|
|
81
|
+
t.current?.blur?.();
|
|
83
82
|
},
|
|
84
83
|
getRootDOMNode: () => t.current
|
|
85
84
|
}),
|
|
86
85
|
[]
|
|
87
86
|
);
|
|
88
|
-
const c = s ? s.length : 0,
|
|
87
|
+
const c = s ? s.length : 0, J = l && h || m, S = ne(() => !r && l ? c > l : !1, [c, l, r]), $ = P || (R || S ? "error" : void 0), Q = g(
|
|
89
88
|
o,
|
|
90
89
|
{
|
|
91
|
-
[`${o}-${
|
|
90
|
+
[`${o}-${$}`]: $,
|
|
92
91
|
// [`${prefixCls}-error`]: error || lengthError || status === 'error',
|
|
93
92
|
[`${o}-disabled`]: i,
|
|
94
|
-
[`${o}-rtl`]:
|
|
93
|
+
[`${o}-rtl`]: d
|
|
95
94
|
},
|
|
96
|
-
|
|
97
|
-
),
|
|
95
|
+
L
|
|
96
|
+
), N = /* @__PURE__ */ u(
|
|
98
97
|
"textarea",
|
|
99
98
|
{
|
|
100
|
-
...ie(
|
|
99
|
+
...ie(W, ["autoSize", "defaultValue"]),
|
|
101
100
|
maxLength: r,
|
|
102
101
|
ref: t,
|
|
103
|
-
style: { ...
|
|
104
|
-
className:
|
|
105
|
-
placeholder:
|
|
102
|
+
style: { ...T, ...x },
|
|
103
|
+
className: Q,
|
|
104
|
+
placeholder: M,
|
|
106
105
|
disabled: i,
|
|
107
|
-
value:
|
|
108
|
-
onChange:
|
|
109
|
-
onKeyDown:
|
|
110
|
-
onCompositionStart:
|
|
111
|
-
onCompositionUpdate:
|
|
112
|
-
onCompositionEnd:
|
|
106
|
+
value: v,
|
|
107
|
+
onChange: U,
|
|
108
|
+
onKeyDown: F,
|
|
109
|
+
onCompositionStart: f,
|
|
110
|
+
onCompositionUpdate: f,
|
|
111
|
+
onCompositionEnd: f
|
|
113
112
|
}
|
|
114
113
|
);
|
|
115
|
-
if (
|
|
116
|
-
const e = !i &&
|
|
117
|
-
return /* @__PURE__ */
|
|
114
|
+
if (J) {
|
|
115
|
+
const e = !i && m && s, [X, Y] = d ? [l, c] : [c, l];
|
|
116
|
+
return /* @__PURE__ */ V(
|
|
118
117
|
"div",
|
|
119
118
|
{
|
|
120
|
-
className:
|
|
121
|
-
[`${o}-clear-wrapper`]:
|
|
122
|
-
[`${o}-wrapper-rtl`]:
|
|
119
|
+
className: g(`${o}-wrapper`, {
|
|
120
|
+
[`${o}-clear-wrapper`]: m,
|
|
121
|
+
[`${o}-wrapper-rtl`]: d
|
|
123
122
|
}),
|
|
124
|
-
style:
|
|
123
|
+
style: H,
|
|
125
124
|
children: [
|
|
126
|
-
|
|
127
|
-
e ?
|
|
125
|
+
N,
|
|
126
|
+
e ? C !== void 0 ? /* @__PURE__ */ u(
|
|
128
127
|
"span",
|
|
129
128
|
{
|
|
130
129
|
className: `${o}-clear-icon`,
|
|
131
|
-
onClick:
|
|
132
|
-
onMouseDown: (
|
|
133
|
-
|
|
130
|
+
onClick: y,
|
|
131
|
+
onMouseDown: (p) => {
|
|
132
|
+
p.preventDefault();
|
|
134
133
|
},
|
|
135
|
-
children:
|
|
134
|
+
children: C
|
|
136
135
|
}
|
|
137
|
-
) : /* @__PURE__ */
|
|
136
|
+
) : /* @__PURE__ */ u(se, { className: `${o}-clear-icon`, children: /* @__PURE__ */ u(
|
|
138
137
|
Z,
|
|
139
138
|
{
|
|
140
|
-
onClick:
|
|
141
|
-
onMouseDown: (
|
|
142
|
-
|
|
139
|
+
onClick: y,
|
|
140
|
+
onMouseDown: (p) => {
|
|
141
|
+
p.preventDefault();
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
) }) : null,
|
|
146
|
-
l &&
|
|
145
|
+
l && h && /* @__PURE__ */ V(
|
|
147
146
|
"span",
|
|
148
147
|
{
|
|
149
|
-
className:
|
|
150
|
-
[`${o}-word-limit-error`]:
|
|
148
|
+
className: g(`${o}-word-limit`, {
|
|
149
|
+
[`${o}-word-limit-error`]: S
|
|
151
150
|
}),
|
|
152
151
|
children: [
|
|
153
|
-
|
|
152
|
+
X,
|
|
154
153
|
"/",
|
|
155
154
|
Y
|
|
156
155
|
]
|
|
@@ -160,7 +159,7 @@ const fe = (n, H) => {
|
|
|
160
159
|
}
|
|
161
160
|
);
|
|
162
161
|
}
|
|
163
|
-
return
|
|
162
|
+
return N;
|
|
164
163
|
}, de = _.forwardRef(fe);
|
|
165
164
|
de.displayName = "TextArea";
|
|
166
165
|
export {
|
package/input/useComposition.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { useRef as d, useState as
|
|
1
|
+
import { useRef as d, useState as v } from "react";
|
|
2
2
|
import { Enter as y } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
3
|
-
function
|
|
4
|
-
value:
|
|
5
|
-
maxLength:
|
|
6
|
-
onChange:
|
|
7
|
-
onKeyDown:
|
|
8
|
-
onPressEnter:
|
|
9
|
-
beforeTriggerValueChangeCallback:
|
|
10
|
-
normalizeHandler:
|
|
3
|
+
function C({
|
|
4
|
+
value: u,
|
|
5
|
+
maxLength: i,
|
|
6
|
+
onChange: f,
|
|
7
|
+
onKeyDown: l,
|
|
8
|
+
onPressEnter: m,
|
|
9
|
+
beforeTriggerValueChangeCallback: s,
|
|
10
|
+
normalizeHandler: p
|
|
11
11
|
}) {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const e = d(!1), [a, r] = v(""), n = (t, o) => {
|
|
13
|
+
s && s(t), // Avoid triggering onChange repeatedly for the same value
|
|
14
14
|
// Compositionend is earlier than onchange in Firefox, different with chrome
|
|
15
|
-
t !==
|
|
15
|
+
t !== u && (i === void 0 || t.length <= i) && f?.(t, o);
|
|
16
16
|
};
|
|
17
17
|
return {
|
|
18
|
-
compositionValue:
|
|
19
|
-
triggerValueChangeCallback:
|
|
18
|
+
compositionValue: a,
|
|
19
|
+
triggerValueChangeCallback: n,
|
|
20
20
|
compositionHandler: (t) => {
|
|
21
|
-
|
|
21
|
+
e.current = t.type !== "compositionend", e.current || (r(void 0), n(t.target.value, t));
|
|
22
22
|
},
|
|
23
23
|
valueChangeHandler: (t) => {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const o = t.target.value;
|
|
25
|
+
e.current ? (e.current = !1, r(o)) : (a && r(void 0), n(o, t));
|
|
26
26
|
},
|
|
27
27
|
keyDownHandler: (t) => {
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
28
|
+
const o = t.key;
|
|
29
|
+
if (!e.current && (l?.(t), o === y.key)) {
|
|
30
|
+
m?.(t);
|
|
31
|
+
const c = p?.("onPressEnter");
|
|
32
|
+
c && n(c(t.target.value), t);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
38
|
-
|
|
38
|
+
C as default
|
|
39
39
|
};
|
package/input-number/decimal.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { supportBigInt as f, toSafeString as N, validateNumber as b, trimNumber as c, getNumberPrecision as d } from "./util.js";
|
|
2
|
+
class h {
|
|
3
|
+
isEmpty;
|
|
4
|
+
isNaN;
|
|
5
|
+
isNegative;
|
|
6
|
+
origin = "";
|
|
7
|
+
integer;
|
|
8
|
+
decimal;
|
|
9
|
+
decimalLen;
|
|
6
10
|
constructor(t) {
|
|
7
|
-
s(this, "isEmpty");
|
|
8
|
-
s(this, "isNaN");
|
|
9
|
-
s(this, "isNegative");
|
|
10
|
-
s(this, "origin", "");
|
|
11
|
-
s(this, "integer");
|
|
12
|
-
s(this, "decimal");
|
|
13
|
-
s(this, "decimalLen");
|
|
14
11
|
if (this.origin = String(t), !t && t !== 0 || !this.origin.trim()) {
|
|
15
12
|
this.isEmpty = !0;
|
|
16
13
|
return;
|
|
@@ -19,10 +16,10 @@ class g {
|
|
|
19
16
|
this.isNaN = !0;
|
|
20
17
|
return;
|
|
21
18
|
}
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
const { negative:
|
|
25
|
-
this.isNegative =
|
|
19
|
+
const e = N(t);
|
|
20
|
+
if (b(e)) {
|
|
21
|
+
const { negative: i, trimStr: r } = c(e), [o, n = "0"] = r.split(".");
|
|
22
|
+
this.isNegative = i, this.integer = BigInt(o), this.decimal = BigInt(n), this.decimalLen = n.length;
|
|
26
23
|
} else
|
|
27
24
|
this.isNaN = !0;
|
|
28
25
|
}
|
|
@@ -48,28 +45,28 @@ class g {
|
|
|
48
45
|
}
|
|
49
46
|
negate() {
|
|
50
47
|
const t = this.toString();
|
|
51
|
-
return new
|
|
48
|
+
return new h(
|
|
52
49
|
t.startsWith("-") ? t.slice(1) : `-${t}`
|
|
53
50
|
);
|
|
54
51
|
}
|
|
55
52
|
add(t) {
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
53
|
+
const e = new h(t);
|
|
54
|
+
if (e.isInvalid)
|
|
58
55
|
return this;
|
|
59
56
|
if (this.isInvalid)
|
|
60
|
-
return
|
|
61
|
-
const
|
|
62
|
-
|
|
57
|
+
return e;
|
|
58
|
+
const i = Math.max(this.decimalLen, e.decimalLen), r = this.alignDecimal(i), o = e.alignDecimal(i), n = (r + o).toString(), { negativeStr: m, trimStr: u } = c(n), g = `${m}${u.padStart(
|
|
59
|
+
i + 1,
|
|
63
60
|
"0"
|
|
64
61
|
)}`;
|
|
65
|
-
return new
|
|
66
|
-
`${
|
|
67
|
-
-
|
|
62
|
+
return new h(
|
|
63
|
+
`${g.slice(0, -i)}.${g.slice(
|
|
64
|
+
-i
|
|
68
65
|
)}`
|
|
69
66
|
);
|
|
70
67
|
}
|
|
71
68
|
equals(t) {
|
|
72
|
-
return this.toString() ===
|
|
69
|
+
return this.toString() === t?.toString();
|
|
73
70
|
}
|
|
74
71
|
less(t) {
|
|
75
72
|
return this.isInvalid || t.isInvalid ? !1 : this.add(t.negate().toString()).toNumber() < 0;
|
|
@@ -78,77 +75,77 @@ class g {
|
|
|
78
75
|
return this.isNaN ? NaN : Number(this.toString());
|
|
79
76
|
}
|
|
80
77
|
toString(t = { safe: !0 }) {
|
|
81
|
-
const { safe:
|
|
78
|
+
const { safe: e, precision: i } = t, r = e ? this.isInvalid ? "" : c(
|
|
82
79
|
`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`
|
|
83
80
|
).fullStr : this.origin;
|
|
84
|
-
return typeof
|
|
81
|
+
return typeof i == "number" ? l(r, i) : r;
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
class
|
|
84
|
+
class s {
|
|
85
|
+
isEmpty;
|
|
86
|
+
isNaN;
|
|
87
|
+
origin = "";
|
|
88
|
+
number;
|
|
88
89
|
constructor(t) {
|
|
89
|
-
s(this, "isEmpty");
|
|
90
|
-
s(this, "isNaN");
|
|
91
|
-
s(this, "origin", "");
|
|
92
|
-
s(this, "number");
|
|
93
90
|
this.origin = String(t), this.number = Number(t), !t && t !== 0 || !this.origin.trim() ? this.isEmpty = !0 : this.isNaN = Number.isNaN(this.number);
|
|
94
91
|
}
|
|
95
92
|
get isInvalid() {
|
|
96
93
|
return this.isEmpty || this.isNaN;
|
|
97
94
|
}
|
|
98
95
|
negate() {
|
|
99
|
-
return new
|
|
96
|
+
return new s(-this.toNumber());
|
|
100
97
|
}
|
|
101
98
|
equals(t) {
|
|
102
|
-
return this.toNumber() ===
|
|
99
|
+
return this.toNumber() === t?.toNumber();
|
|
103
100
|
}
|
|
104
101
|
less(t) {
|
|
105
102
|
return this.isInvalid || t.isInvalid ? !1 : this.add(t.negate().toString()).toNumber() < 0;
|
|
106
103
|
}
|
|
107
104
|
add(t) {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
105
|
+
const e = new s(t);
|
|
106
|
+
if (e.isInvalid)
|
|
110
107
|
return this;
|
|
111
108
|
if (this.isInvalid)
|
|
112
|
-
return
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
return new
|
|
116
|
-
if (
|
|
117
|
-
return new
|
|
109
|
+
return e;
|
|
110
|
+
const i = this.number + e.number;
|
|
111
|
+
if (i > Number.MAX_SAFE_INTEGER)
|
|
112
|
+
return new s(Number.MAX_SAFE_INTEGER);
|
|
113
|
+
if (i < Number.MIN_SAFE_INTEGER)
|
|
114
|
+
return new s(Number.MIN_SAFE_INTEGER);
|
|
118
115
|
const r = Math.max(
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
d(this.number),
|
|
117
|
+
d(e.number)
|
|
121
118
|
);
|
|
122
|
-
return new
|
|
119
|
+
return new s(i.toFixed(r));
|
|
123
120
|
}
|
|
124
121
|
toNumber() {
|
|
125
122
|
return this.number;
|
|
126
123
|
}
|
|
127
124
|
toString(t = { safe: !0 }) {
|
|
128
|
-
const { safe:
|
|
129
|
-
return typeof
|
|
125
|
+
const { safe: e, precision: i } = t, r = e ? this.isInvalid ? "" : N(this.number) : this.origin;
|
|
126
|
+
return typeof i == "number" ? l(r, i) : r;
|
|
130
127
|
}
|
|
131
128
|
}
|
|
132
|
-
function
|
|
133
|
-
return
|
|
129
|
+
function I(a) {
|
|
130
|
+
return f() ? new h(a) : new s(a);
|
|
134
131
|
}
|
|
135
|
-
function
|
|
136
|
-
if (
|
|
132
|
+
function l(a, t, e = !1) {
|
|
133
|
+
if (a === "")
|
|
137
134
|
return "";
|
|
138
|
-
const
|
|
135
|
+
const i = ".", { negativeStr: r, integerStr: o, decimalStr: n } = c(a), m = `${i}${n}`, u = `${r}${o}`;
|
|
139
136
|
if (t >= 0) {
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
`${r}0.${"0".repeat(t)}${10 -
|
|
137
|
+
const g = Number(n[t]);
|
|
138
|
+
if (g >= 5 && !e) {
|
|
139
|
+
const S = I(a).add(
|
|
140
|
+
`${r}0.${"0".repeat(t)}${10 - g}`
|
|
144
141
|
);
|
|
145
|
-
return
|
|
142
|
+
return l(S.toString(), t, e);
|
|
146
143
|
}
|
|
147
|
-
return t === 0 ?
|
|
144
|
+
return t === 0 ? u : `${u}${i}${n.padEnd(t, "0").slice(0, t)}`;
|
|
148
145
|
}
|
|
149
|
-
return `${
|
|
146
|
+
return `${u}${m === ".0" ? "" : m}`;
|
|
150
147
|
}
|
|
151
148
|
export {
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
I as getDecimal,
|
|
150
|
+
l as toFixed
|
|
154
151
|
};
|