antd-mobile 5.0.0-rc.24 → 5.0.0-rc.28
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/2x/README.md +1 -1
- package/2x/cjs/components/button/button.css +2 -2
- package/2x/cjs/components/calendar/calendar.d.ts +1 -0
- package/2x/cjs/components/calendar/calendar.js +8 -1
- package/2x/cjs/components/checkbox/checkbox.js +12 -12
- package/2x/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/2x/cjs/components/dialog/dialog.css +4 -0
- package/2x/cjs/components/dropdown/dropdown.css +0 -4
- package/2x/cjs/components/dropdown/item.js +3 -1
- package/2x/cjs/components/ellipsis/ellipsis.js +3 -1
- package/2x/cjs/components/empty/empty.css +1 -1
- package/2x/cjs/components/floating-bubble/floating-bubble.css +1 -0
- package/2x/cjs/components/floating-panel/floating-panel.d.ts +7 -5
- package/2x/cjs/components/floating-panel/floating-panel.js +11 -1
- package/2x/cjs/components/form/form-item.css +17 -10
- package/2x/cjs/components/form/form-item.d.ts +1 -1
- package/2x/cjs/components/form/form-item.js +17 -8
- package/2x/cjs/components/form/form.css +0 -9
- package/2x/cjs/components/form/form.js +1 -1
- package/2x/cjs/components/form/index.css +17 -19
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +1 -1
- package/2x/cjs/components/image-uploader/image-uploader.js +2 -2
- package/2x/cjs/components/image-viewer/image-viewer.css +2 -0
- package/2x/cjs/components/image-viewer/image-viewer.js +12 -2
- package/2x/cjs/components/image-viewer/slide.js +11 -7
- package/2x/cjs/components/image-viewer/slides.d.ts +1 -1
- package/2x/cjs/components/index-bar/index-bar.css +2 -1
- package/2x/cjs/components/input/input.css +1 -0
- package/2x/cjs/components/input/input.d.ts +6 -2
- package/2x/cjs/components/input/input.js +20 -2
- package/2x/cjs/components/list/list.css +6 -4
- package/2x/cjs/components/picker/picker.d.ts +1 -0
- package/2x/cjs/components/picker/picker.js +3 -1
- package/2x/cjs/components/picker-view/wheel.js +4 -2
- package/2x/cjs/components/popover/index.d.ts +4 -6
- package/2x/cjs/components/popover/popover-menu.d.ts +9 -12
- package/2x/cjs/components/progress-bar/progress-bar.css +1 -1
- package/2x/cjs/components/progress-circle/progress-circle.css +4 -4
- package/2x/cjs/components/progress-circle/progress-circle.js +1 -2
- package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +7 -1
- package/2x/cjs/components/radio/radio.js +16 -3
- package/2x/cjs/components/rate/rate.css +2 -1
- package/2x/cjs/components/rate/rate.d.ts +1 -1
- package/2x/cjs/components/selector/selector.css +14 -6
- package/2x/cjs/components/selector/selector.d.ts +2 -1
- package/2x/cjs/components/selector/selector.js +3 -2
- package/2x/cjs/components/slider/slider.css +12 -7
- package/2x/cjs/components/slider/thumb-icon.d.ts +3 -0
- package/2x/cjs/components/slider/thumb-icon.js +38 -0
- package/2x/cjs/components/slider/thumb.js +5 -1
- package/2x/cjs/components/swiper/swiper.js +1 -1
- package/2x/cjs/components/tabs/tabs.js +5 -5
- package/2x/cjs/components/text-area/text-area.js +11 -1
- package/2x/cjs/components/virtual-input/virtual-input.js +3 -1
- package/2x/cjs/utils/get-scroll-parent.js +1 -1
- package/2x/cjs/utils/is-dev.js +1 -1
- package/2x/cjs/utils/use-ref-state.js +1 -1
- package/2x/cjs/utils/use-resize-effect.js +1 -3
- package/2x/cjs/utils/use-tab-list-scroll.js +1 -3
- package/2x/es/components/button/button.css +2 -2
- package/2x/es/components/calendar/calendar.d.ts +1 -0
- package/2x/es/components/calendar/calendar.js +8 -2
- package/2x/es/components/checkbox/checkbox.js +11 -12
- package/2x/es/components/date-picker/date-picker.d.ts +1 -1
- package/2x/es/components/dialog/dialog.css +4 -0
- package/2x/es/components/dropdown/dropdown.css +0 -4
- package/2x/es/components/dropdown/item.js +3 -1
- package/2x/es/components/ellipsis/ellipsis.js +3 -2
- package/2x/es/components/empty/empty.css +1 -1
- package/2x/es/components/floating-bubble/floating-bubble.css +1 -0
- package/2x/es/components/floating-panel/floating-panel.d.ts +7 -5
- package/2x/es/components/floating-panel/floating-panel.js +9 -1
- package/2x/es/components/form/form-item.css +17 -10
- package/2x/es/components/form/form-item.d.ts +1 -1
- package/2x/es/components/form/form-item.js +15 -6
- package/2x/es/components/form/form.css +0 -9
- package/2x/es/components/form/form.js +1 -1
- package/2x/es/components/form/index.css +17 -19
- package/2x/es/components/image-uploader/image-uploader.d.ts +1 -1
- package/2x/es/components/image-uploader/image-uploader.js +4 -4
- package/2x/es/components/image-viewer/image-viewer.css +2 -0
- package/2x/es/components/image-viewer/image-viewer.js +13 -3
- package/2x/es/components/image-viewer/slide.js +11 -7
- package/2x/es/components/image-viewer/slides.d.ts +1 -1
- package/2x/es/components/index-bar/index-bar.css +2 -1
- package/2x/es/components/input/input.css +1 -0
- package/2x/es/components/input/input.d.ts +6 -2
- package/2x/es/components/input/input.js +19 -3
- package/2x/es/components/list/list.css +6 -4
- package/2x/es/components/picker/picker.d.ts +1 -0
- package/2x/es/components/picker/picker.js +3 -1
- package/2x/es/components/picker-view/wheel.js +4 -3
- package/2x/es/components/popover/index.d.ts +4 -6
- package/2x/es/components/popover/popover-menu.d.ts +9 -12
- package/2x/es/components/progress-bar/progress-bar.css +1 -1
- package/2x/es/components/progress-circle/progress-circle.css +4 -4
- package/2x/es/components/progress-circle/progress-circle.js +1 -2
- package/2x/es/components/pull-to-refresh/pull-to-refresh.js +8 -2
- package/2x/es/components/radio/radio.js +14 -3
- package/2x/es/components/rate/rate.css +2 -1
- package/2x/es/components/rate/rate.d.ts +1 -1
- package/2x/es/components/selector/selector.css +14 -6
- package/2x/es/components/selector/selector.d.ts +2 -1
- package/2x/es/components/selector/selector.js +3 -2
- package/2x/es/components/slider/slider.css +12 -7
- package/2x/es/components/slider/thumb-icon.d.ts +3 -0
- package/2x/es/components/slider/thumb-icon.js +25 -0
- package/2x/es/components/slider/thumb.js +4 -1
- package/2x/es/components/swiper/swiper.js +3 -3
- package/2x/es/components/tabs/tabs.js +7 -7
- package/2x/es/components/text-area/text-area.js +10 -1
- package/2x/es/components/virtual-input/virtual-input.js +3 -2
- package/2x/es/utils/get-scroll-parent.js +1 -1
- package/2x/es/utils/is-dev.js +1 -1
- package/2x/es/utils/use-ref-state.js +2 -2
- package/2x/es/utils/use-resize-effect.js +2 -3
- package/2x/es/utils/use-tab-list-scroll.js +2 -3
- package/2x/package.json +7 -6
- package/README.md +1 -1
- package/cjs/components/button/button.css +2 -2
- package/cjs/components/calendar/calendar.d.ts +1 -0
- package/cjs/components/calendar/calendar.js +8 -1
- package/cjs/components/checkbox/checkbox.js +12 -12
- package/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/cjs/components/dialog/dialog.css +3 -0
- package/cjs/components/dropdown/dropdown.css +0 -3
- package/cjs/components/dropdown/item.js +3 -1
- package/cjs/components/ellipsis/ellipsis.js +3 -1
- package/cjs/components/empty/empty.css +1 -1
- package/cjs/components/floating-bubble/floating-bubble.css +1 -0
- package/cjs/components/floating-panel/floating-panel.d.ts +7 -5
- package/cjs/components/floating-panel/floating-panel.js +11 -1
- package/cjs/components/form/form-item.css +15 -9
- package/cjs/components/form/form-item.d.ts +1 -1
- package/cjs/components/form/form-item.js +17 -8
- package/cjs/components/form/form.css +0 -7
- package/cjs/components/form/form.js +1 -1
- package/cjs/components/form/index.css +15 -16
- package/cjs/components/image-uploader/image-uploader.d.ts +1 -1
- package/cjs/components/image-uploader/image-uploader.js +2 -2
- package/cjs/components/image-viewer/image-viewer.css +2 -0
- package/cjs/components/image-viewer/image-viewer.js +12 -2
- package/cjs/components/image-viewer/slide.js +11 -7
- package/cjs/components/image-viewer/slides.d.ts +1 -1
- package/cjs/components/index-bar/index-bar.css +2 -1
- package/cjs/components/input/input.css +1 -0
- package/cjs/components/input/input.d.ts +6 -2
- package/cjs/components/input/input.js +20 -2
- package/cjs/components/list/list.css +5 -4
- package/cjs/components/picker/picker.d.ts +1 -0
- package/cjs/components/picker/picker.js +3 -1
- package/cjs/components/picker-view/wheel.js +4 -2
- package/cjs/components/popover/index.d.ts +4 -6
- package/cjs/components/popover/popover-menu.d.ts +9 -12
- package/cjs/components/progress-bar/progress-bar.css +1 -1
- package/cjs/components/progress-circle/progress-circle.css +4 -4
- package/cjs/components/progress-circle/progress-circle.js +1 -2
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +7 -1
- package/cjs/components/radio/radio.js +16 -3
- package/cjs/components/rate/rate.css +2 -1
- package/cjs/components/rate/rate.d.ts +1 -1
- package/cjs/components/selector/selector.css +14 -6
- package/cjs/components/selector/selector.d.ts +2 -1
- package/cjs/components/selector/selector.js +3 -2
- package/cjs/components/slider/slider.css +11 -7
- package/cjs/components/slider/thumb-icon.d.ts +3 -0
- package/cjs/components/slider/thumb-icon.js +38 -0
- package/cjs/components/slider/thumb.js +5 -1
- package/cjs/components/swiper/swiper.js +1 -1
- package/cjs/components/tabs/tabs.js +5 -5
- package/cjs/components/text-area/text-area.js +11 -1
- package/cjs/components/virtual-input/virtual-input.js +3 -1
- package/cjs/utils/get-scroll-parent.js +1 -1
- package/cjs/utils/is-dev.js +1 -1
- package/cjs/utils/use-ref-state.js +1 -1
- package/cjs/utils/use-resize-effect.js +1 -3
- package/cjs/utils/use-tab-list-scroll.js +1 -3
- package/es/components/button/button.css +2 -2
- package/es/components/calendar/calendar.d.ts +1 -0
- package/es/components/calendar/calendar.js +8 -2
- package/es/components/checkbox/checkbox.js +11 -12
- package/es/components/date-picker/date-picker.d.ts +1 -1
- package/es/components/dialog/dialog.css +3 -0
- package/es/components/dropdown/dropdown.css +0 -3
- package/es/components/dropdown/item.js +3 -1
- package/es/components/ellipsis/ellipsis.js +3 -2
- package/es/components/empty/empty.css +1 -1
- package/es/components/floating-bubble/floating-bubble.css +1 -0
- package/es/components/floating-panel/floating-panel.d.ts +7 -5
- package/es/components/floating-panel/floating-panel.js +9 -1
- package/es/components/form/form-item.css +15 -9
- package/es/components/form/form-item.d.ts +1 -1
- package/es/components/form/form-item.js +15 -6
- package/es/components/form/form.css +0 -7
- package/es/components/form/form.js +1 -1
- package/es/components/form/index.css +15 -16
- package/es/components/image-uploader/image-uploader.d.ts +1 -1
- package/es/components/image-uploader/image-uploader.js +4 -4
- package/es/components/image-viewer/image-viewer.css +2 -0
- package/es/components/image-viewer/image-viewer.js +13 -3
- package/es/components/image-viewer/slide.js +11 -7
- package/es/components/image-viewer/slides.d.ts +1 -1
- package/es/components/index-bar/index-bar.css +2 -1
- package/es/components/input/input.css +1 -0
- package/es/components/input/input.d.ts +6 -2
- package/es/components/input/input.js +19 -3
- package/es/components/list/list.css +5 -4
- package/es/components/picker/picker.d.ts +1 -0
- package/es/components/picker/picker.js +3 -1
- package/es/components/picker-view/wheel.js +4 -3
- package/es/components/popover/index.d.ts +4 -6
- package/es/components/popover/popover-menu.d.ts +9 -12
- package/es/components/progress-bar/progress-bar.css +1 -1
- package/es/components/progress-circle/progress-circle.css +4 -4
- package/es/components/progress-circle/progress-circle.js +1 -2
- package/es/components/pull-to-refresh/pull-to-refresh.js +8 -2
- package/es/components/radio/radio.js +14 -3
- package/es/components/rate/rate.css +2 -1
- package/es/components/rate/rate.d.ts +1 -1
- package/es/components/selector/selector.css +14 -6
- package/es/components/selector/selector.d.ts +2 -1
- package/es/components/selector/selector.js +3 -2
- package/es/components/slider/slider.css +11 -7
- package/es/components/slider/thumb-icon.d.ts +3 -0
- package/es/components/slider/thumb-icon.js +25 -0
- package/es/components/slider/thumb.js +4 -1
- package/es/components/swiper/swiper.js +3 -3
- package/es/components/tabs/tabs.js +7 -7
- package/es/components/text-area/text-area.js +10 -1
- package/es/components/virtual-input/virtual-input.js +3 -2
- package/es/utils/get-scroll-parent.js +1 -1
- package/es/utils/is-dev.js +1 -1
- package/es/utils/use-ref-state.js +2 -2
- package/es/utils/use-resize-effect.js +2 -3
- package/es/utils/use-tab-list-scroll.js +2 -3
- package/package.json +7 -6
- package/umd/antd-mobile.js +1 -1
- package/2x/assets/slider-thumb.svg +0 -14
- package/2x/cjs/assets/slider-thumb.svg +0 -14
- package/2x/es/assets/slider-thumb.svg +0 -14
- package/assets/slider-thumb.svg +0 -14
- package/cjs/assets/slider-thumb.svg +0 -14
- package/es/assets/slider-thumb.svg +0 -14
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
top: 50%;
|
|
34
34
|
right: 0;
|
|
35
35
|
transform: translateY(-50%);
|
|
36
|
-
z-index:
|
|
36
|
+
z-index: 910;
|
|
37
37
|
overflow: visible;
|
|
38
38
|
color: var(--adm-color-weak);
|
|
39
39
|
font-size: 24px;
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
|
|
90
90
|
.adm-index-bar-sticky .adm-index-bar-anchor-title {
|
|
91
91
|
position: sticky;
|
|
92
|
+
z-index: 900;
|
|
92
93
|
top: var(--sticky-offset-top);
|
|
93
94
|
left: 0;
|
|
94
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | '
|
|
4
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
onChange?: (val: string) => void;
|
|
@@ -13,13 +13,15 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
13
13
|
id?: string;
|
|
14
14
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
15
|
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
16
|
+
min?: number;
|
|
17
|
+
max?: number;
|
|
16
18
|
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--text-align'>;
|
|
17
19
|
export declare type InputRef = {
|
|
18
20
|
clear: () => void;
|
|
19
21
|
focus: () => void;
|
|
20
22
|
blur: () => void;
|
|
21
23
|
};
|
|
22
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "
|
|
24
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "pattern" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength"> & {
|
|
23
25
|
value?: string | undefined;
|
|
24
26
|
defaultValue?: string | undefined;
|
|
25
27
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -31,5 +33,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<React.DetailedH
|
|
|
31
33
|
id?: string | undefined;
|
|
32
34
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
33
35
|
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
36
|
+
min?: number | undefined;
|
|
37
|
+
max?: number | undefined;
|
|
34
38
|
} & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align"> & React.RefAttributes<InputRef>>;
|
|
35
39
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, { useState, forwardRef, useImperativeHandle, useRef
|
|
1
|
+
import React, { useState, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
2
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
3
3
|
import { CloseCircleFill } from 'antd-mobile-icons';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { mergeProps } from '../../utils/with-default-props';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
|
+
import { bound } from '../../utils/bound';
|
|
7
9
|
const classPrefix = `adm-input`;
|
|
8
10
|
const defaultProps = {
|
|
9
11
|
defaultValue: ''
|
|
@@ -39,7 +41,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
39
41
|
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
useIsomorphicLayoutEffect(() => {
|
|
43
45
|
var _a;
|
|
44
46
|
|
|
45
47
|
if (!props.enterKeyHint) return;
|
|
@@ -50,6 +52,19 @@ export const Input = forwardRef((p, ref) => {
|
|
|
50
52
|
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('enterkeyhint');
|
|
51
53
|
};
|
|
52
54
|
}, [props.enterKeyHint]);
|
|
55
|
+
|
|
56
|
+
function checkValue() {
|
|
57
|
+
let nextValue = value;
|
|
58
|
+
|
|
59
|
+
if (props.type === 'number') {
|
|
60
|
+
nextValue = bound(parseFloat(nextValue), props.min, props.max).toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (nextValue !== value) {
|
|
64
|
+
setValue(nextValue);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
return withNativeProps(props, React.createElement("div", {
|
|
54
69
|
className: classNames(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
|
|
55
70
|
}, React.createElement("input", {
|
|
@@ -69,6 +84,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
69
84
|
var _a;
|
|
70
85
|
|
|
71
86
|
setHasFocus(false);
|
|
87
|
+
checkValue();
|
|
72
88
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
73
89
|
},
|
|
74
90
|
id: props.id,
|
|
@@ -89,7 +105,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
89
105
|
onKeyUp: props.onKeyUp,
|
|
90
106
|
onCompositionStart: props.onCompositionStart,
|
|
91
107
|
onCompositionEnd: props.onCompositionEnd
|
|
92
|
-
}), props.clearable && !!value && React.createElement("div", {
|
|
108
|
+
}), props.clearable && !!value && !props.readOnly && React.createElement("div", {
|
|
93
109
|
className: `${classPrefix}-clear`,
|
|
94
110
|
onMouseDown: e => {
|
|
95
111
|
e.preventDefault();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.adm-list {
|
|
2
|
-
--header-font-size:
|
|
2
|
+
--header-font-size: 30px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 24px;
|
|
5
5
|
--align-items: center;
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
.adm-list-header {
|
|
16
16
|
color: var(--adm-color-weak);
|
|
17
17
|
font-size: var(--header-font-size);
|
|
18
|
-
padding
|
|
19
|
-
padding-right: var(--padding-right);
|
|
20
|
-
margin: 32px 0 8px;
|
|
18
|
+
padding: 16px var(--padding-right) 16px var(--padding-left);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.adm-list-body {
|
|
@@ -43,6 +41,10 @@
|
|
|
43
41
|
border-radius: 16px;
|
|
44
42
|
}
|
|
45
43
|
|
|
44
|
+
.adm-list-card .adm-list-header {
|
|
45
|
+
padding-left: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
46
48
|
.adm-list-item {
|
|
47
49
|
display: block;
|
|
48
50
|
padding-left: var(--padding-left);
|
|
@@ -10,6 +10,7 @@ export declare type PickerProps = {
|
|
|
10
10
|
onConfirm?: (value: PickerValue[], extend: PickerValueExtend) => void;
|
|
11
11
|
onCancel?: () => void;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
closeOnMaskClick?: boolean;
|
|
13
14
|
visible?: boolean;
|
|
14
15
|
title?: ReactNode;
|
|
15
16
|
confirmText?: ReactNode;
|
|
@@ -11,7 +11,8 @@ import { useMemoizedFn } from 'ahooks';
|
|
|
11
11
|
import SafeArea from '../safe-area';
|
|
12
12
|
const classPrefix = `adm-picker`;
|
|
13
13
|
const defaultProps = {
|
|
14
|
-
defaultValue: []
|
|
14
|
+
defaultValue: [],
|
|
15
|
+
closeOnMaskClick: true
|
|
15
16
|
};
|
|
16
17
|
export const Picker = memo(p => {
|
|
17
18
|
var _a;
|
|
@@ -89,6 +90,7 @@ export const Picker = memo(p => {
|
|
|
89
90
|
onMaskClick: () => {
|
|
90
91
|
var _a, _b;
|
|
91
92
|
|
|
93
|
+
if (!props.closeOnMaskClick) return;
|
|
92
94
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
93
95
|
(_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
94
96
|
},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { memo,
|
|
1
|
+
import React, { memo, useRef } from 'react';
|
|
2
2
|
import { useSpring, animated } from '@react-spring/web';
|
|
3
3
|
import { useDrag } from '@use-gesture/react';
|
|
4
4
|
import { convertPx } from '../../utils/convert-px';
|
|
5
5
|
import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
|
|
6
6
|
import { bound } from '../../utils/bound';
|
|
7
7
|
import isEqual from 'lodash/isEqual';
|
|
8
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
9
|
const classPrefix = `adm-picker-view`;
|
|
9
10
|
export const Wheel = memo(props => {
|
|
10
11
|
const itemHeight = convertPx(34);
|
|
@@ -29,7 +30,7 @@ export const Wheel = memo(props => {
|
|
|
29
30
|
}
|
|
30
31
|
}));
|
|
31
32
|
const draggingRef = useRef(false);
|
|
32
|
-
|
|
33
|
+
useIsomorphicLayoutEffect(() => {
|
|
33
34
|
if (draggingRef.current) return;
|
|
34
35
|
if (!value) return;
|
|
35
36
|
const targetIndex = column.findIndex(item => item.value === value);
|
|
@@ -40,7 +41,7 @@ export const Wheel = memo(props => {
|
|
|
40
41
|
immediate: y.goal !== finalPosition
|
|
41
42
|
});
|
|
42
43
|
}, [value, column]);
|
|
43
|
-
|
|
44
|
+
useIsomorphicLayoutEffect(() => {
|
|
44
45
|
if (column.length === 0) {
|
|
45
46
|
if (value !== null) {
|
|
46
47
|
onSelect(null);
|
|
@@ -13,11 +13,9 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
13
13
|
stopPropagation?: "click"[] | undefined;
|
|
14
14
|
content: import("react").ReactNode;
|
|
15
15
|
} & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "align" | "defaultVisible" | "onVisibleChange"> & import("../../utils/native-props").NativeProps<"--z-index"> & import("react").RefAttributes<import("./popover").PopoverRef>> & {
|
|
16
|
-
Menu:
|
|
17
|
-
actions:
|
|
18
|
-
onAction?: ((
|
|
19
|
-
} &
|
|
20
|
-
ref?: ((instance: import("./popover").PopoverRef | null) => void) | import("react").RefObject<import("./popover").PopoverRef> | null | undefined;
|
|
21
|
-
}) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
16
|
+
Menu: import("react").ForwardRefExoticComponent<Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "defaultVisible" | "onVisibleChange" | "trigger" | "placement" | "destroyOnHide"> & {
|
|
17
|
+
actions: import("./popover-menu").Action[];
|
|
18
|
+
onAction?: ((item: import("./popover-menu").Action) => void) | undefined;
|
|
19
|
+
} & import("react").RefAttributes<import("./popover").PopoverRef>>;
|
|
22
20
|
};
|
|
23
21
|
export default _default;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PopoverProps, PopoverRef } from './popover';
|
|
3
3
|
export declare type Action = {
|
|
4
4
|
text: React.ReactNode;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
key?: string;
|
|
7
|
+
key?: string | number;
|
|
8
8
|
onClick?: () => void;
|
|
9
|
-
[key: string]: any;
|
|
10
9
|
};
|
|
11
|
-
export declare type PopoverMenuProps
|
|
12
|
-
actions:
|
|
13
|
-
onAction?: (
|
|
10
|
+
export declare type PopoverMenuProps = Omit<PopoverProps, 'content'> & {
|
|
11
|
+
actions: Action[];
|
|
12
|
+
onAction?: (item: Action) => void;
|
|
14
13
|
};
|
|
15
|
-
export declare const PopoverMenu: <
|
|
16
|
-
actions:
|
|
17
|
-
onAction?: ((
|
|
18
|
-
} &
|
|
19
|
-
ref?: ((instance: PopoverRef | null) => void) | React.RefObject<PopoverRef> | null | undefined;
|
|
20
|
-
}) => ReactElement;
|
|
14
|
+
export declare const PopoverMenu: React.ForwardRefExoticComponent<Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "defaultVisible" | "onVisibleChange" | "trigger" | "placement" | "destroyOnHide"> & {
|
|
15
|
+
actions: Action[];
|
|
16
|
+
onAction?: ((item: Action) => void) | undefined;
|
|
17
|
+
} & React.RefAttributes<PopoverRef>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.adm-progress-bar {
|
|
2
2
|
--track-width: var(--adm-progress-bar-track-width, 6px);
|
|
3
3
|
--track-color: var(--adm-progress-bar-track-color, #e5e5e5);
|
|
4
|
-
--fill-color: var(--adm-progress-bar-fill-color,
|
|
4
|
+
--fill-color: var(--adm-progress-bar-fill-color, var(--adm-color-primary));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.adm-progress-bar-trail {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*进度圈*/
|
|
2
2
|
|
|
3
3
|
.adm-progress-circle {
|
|
4
|
-
--track-width: 6px;
|
|
5
|
-
--size: 100px;
|
|
6
|
-
--track-color: #e5e5e5;
|
|
7
|
-
--fill-color:
|
|
4
|
+
--track-width: var(--adm-progress-circle-track-width, 6px);
|
|
5
|
+
--size: var(--adm-progress-circle-size, 100px);
|
|
6
|
+
--track-color: var(--adm-progress-circle-track-color, #e5e5e5);
|
|
7
|
+
--fill-color: var(--adm-progress-circle-fill-color, var(--adm-color-primary));
|
|
8
8
|
--percent: 0;
|
|
9
9
|
--pi: 3.14159265;
|
|
10
10
|
--radius: calc(var(--size) / 2 - var(--track-width) / 2);
|
|
@@ -4,8 +4,7 @@ import { mergeProps } from '../../utils/with-default-props';
|
|
|
4
4
|
const classPrefix = `adm-progress-circle`;
|
|
5
5
|
export const ProgressCircle = p => {
|
|
6
6
|
const props = mergeProps({
|
|
7
|
-
percent: 0
|
|
8
|
-
strokeColor: '#1677FF'
|
|
7
|
+
percent: 0
|
|
9
8
|
}, p);
|
|
10
9
|
const style = {
|
|
11
10
|
'--percent': props.percent.toString()
|
|
@@ -3,7 +3,7 @@ import { mergeProps } from '../../utils/with-default-props';
|
|
|
3
3
|
import { animated, useSpring } from '@react-spring/web';
|
|
4
4
|
import { useDrag } from '@use-gesture/react';
|
|
5
5
|
import { getScrollParent } from '../../utils/get-scroll-parent';
|
|
6
|
-
import React, { useRef, useState } from 'react';
|
|
6
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { supportsPassive } from '../../utils/supports-passive';
|
|
8
8
|
import { convertPx } from '../../utils/convert-px';
|
|
9
9
|
import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
|
|
@@ -36,7 +36,13 @@ export const PullToRefresh = p => {
|
|
|
36
36
|
}
|
|
37
37
|
}));
|
|
38
38
|
const elementRef = useRef(null);
|
|
39
|
-
const pullingRef = useRef(false);
|
|
39
|
+
const pullingRef = useRef(false); //防止下拉时抖动
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
(_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('touchmove', () => {});
|
|
45
|
+
}, []);
|
|
40
46
|
|
|
41
47
|
function doRefresh() {
|
|
42
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -5,6 +5,8 @@ import { RadioGroupContext } from './group-context';
|
|
|
5
5
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
6
6
|
import { mergeProps } from '../../utils/with-default-props';
|
|
7
7
|
import { CheckIcon } from '../checkbox/check-icon';
|
|
8
|
+
import { devWarning } from '../../utils/dev-log';
|
|
9
|
+
import { isDev } from '../../utils/is-dev';
|
|
8
10
|
const classPrefix = `adm-radio`;
|
|
9
11
|
const defaultProps = {
|
|
10
12
|
defaultChecked: false
|
|
@@ -23,6 +25,16 @@ export const Radio = p => {
|
|
|
23
25
|
} = props;
|
|
24
26
|
|
|
25
27
|
if (groupContext && value !== undefined) {
|
|
28
|
+
if (isDev) {
|
|
29
|
+
if (p.checked !== undefined) {
|
|
30
|
+
devWarning('Radio', 'When used within `Radio.Group`, the `checked` prop of `Radio` will not work.');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (p.defaultChecked !== undefined) {
|
|
34
|
+
devWarning('Radio', 'When used within `Radio.Group`, the `defaultChecked` prop of `Radio` will not work.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
checked = groupContext.value.includes(value);
|
|
27
39
|
|
|
28
40
|
setChecked = checked => {
|
|
@@ -53,12 +65,11 @@ export const Radio = p => {
|
|
|
53
65
|
};
|
|
54
66
|
|
|
55
67
|
return withNativeProps(props, React.createElement("label", {
|
|
56
|
-
className: classNames(classPrefix,
|
|
68
|
+
className: classNames(classPrefix, {
|
|
57
69
|
[`${classPrefix}-checked`]: checked,
|
|
58
70
|
[`${classPrefix}-disabled`]: disabled,
|
|
59
71
|
[`${classPrefix}-block`]: props.block
|
|
60
|
-
})
|
|
61
|
-
style: props.style
|
|
72
|
+
})
|
|
62
73
|
}, React.createElement("input", {
|
|
63
74
|
type: 'radio',
|
|
64
75
|
checked: checked,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.adm-rate {
|
|
2
2
|
--star-size: 48px;
|
|
3
3
|
--active-color: #ffd21e;
|
|
4
|
+
--inactive-color: var(--adm-color-light);
|
|
4
5
|
display: inline-flex;
|
|
5
6
|
}
|
|
6
7
|
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
padding: calc(var(--star-size) / 8);
|
|
13
14
|
line-height: var(--star-size);
|
|
14
15
|
font-size: var(--star-size);
|
|
15
|
-
color: var(--
|
|
16
|
+
color: var(--inactive-color);
|
|
16
17
|
text-align: center;
|
|
17
18
|
overflow: hidden;
|
|
18
19
|
cursor: pointer;
|
|
@@ -9,5 +9,5 @@ export declare type RateProps = {
|
|
|
9
9
|
readOnly?: boolean;
|
|
10
10
|
value?: number;
|
|
11
11
|
onChange?: (value: number) => void;
|
|
12
|
-
} & NativeProps<'--star-size' | '--active-color'>;
|
|
12
|
+
} & NativeProps<'--star-size' | '--active-color' | '--inactive-color'>;
|
|
13
13
|
export declare const Rate: FC<RateProps>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
.adm-selector {
|
|
2
|
-
--color:
|
|
2
|
+
--color: #f5f5f5;
|
|
3
3
|
--checked-color: #e7f1ff;
|
|
4
|
+
--text-color: var(--adm-color-text);
|
|
5
|
+
--checked-text-color: var(--adm-color-primary);
|
|
6
|
+
--border: none;
|
|
7
|
+
--checked-border: none;
|
|
8
|
+
--border-radius: 4px;
|
|
9
|
+
--padding: 16px 32px;
|
|
4
10
|
overflow: hidden;
|
|
5
11
|
font-size: 30px;
|
|
6
12
|
line-height: 1.4;
|
|
@@ -11,11 +17,12 @@
|
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
.adm-selector-item {
|
|
14
|
-
padding:
|
|
20
|
+
padding: var(--padding);
|
|
15
21
|
position: relative;
|
|
16
|
-
background-color:
|
|
17
|
-
border
|
|
18
|
-
|
|
22
|
+
background-color: var(--color);
|
|
23
|
+
border: var(--border);
|
|
24
|
+
border-radius: var(--border-radius);
|
|
25
|
+
color: var(--text-color);
|
|
19
26
|
opacity: 1;
|
|
20
27
|
cursor: pointer;
|
|
21
28
|
display: inline-block;
|
|
@@ -31,8 +38,9 @@
|
|
|
31
38
|
|
|
32
39
|
.adm-selector-item-active,
|
|
33
40
|
.adm-selector-item-multiple-active {
|
|
34
|
-
color: var(--
|
|
41
|
+
color: var(--checked-text-color);
|
|
35
42
|
background-color: var(--checked-color);
|
|
43
|
+
border: var(--checked-border);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
.adm-selector-item .adm-selector-check-mark-wrapper {
|
|
@@ -16,5 +16,6 @@ export declare type SelectorProps<V> = {
|
|
|
16
16
|
onChange?: (v: V[], extend: {
|
|
17
17
|
items: SelectorOption<V>[];
|
|
18
18
|
}) => void;
|
|
19
|
-
|
|
19
|
+
showCheckMark?: boolean;
|
|
20
|
+
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding'>;
|
|
20
21
|
export declare const Selector: <V extends string | number>(p: SelectorProps<V>) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
@@ -10,7 +10,8 @@ import { CheckMark } from './check-mark';
|
|
|
10
10
|
const classPrefix = `adm-selector`;
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
multiple: false,
|
|
13
|
-
defaultValue: []
|
|
13
|
+
defaultValue: [],
|
|
14
|
+
showCheckMark: true
|
|
14
15
|
};
|
|
15
16
|
export const Selector = p => {
|
|
16
17
|
const props = mergeProps(defaultProps, p);
|
|
@@ -55,7 +56,7 @@ export const Selector = p => {
|
|
|
55
56
|
}
|
|
56
57
|
}, option.label, option.description && React.createElement("div", {
|
|
57
58
|
className: `${classPrefix}-item-description`
|
|
58
|
-
}, option.description), active && React.createElement("div", {
|
|
59
|
+
}, option.description), active && props.showCheckMark && React.createElement("div", {
|
|
59
60
|
className: `${classPrefix}-check-mark-wrapper`
|
|
60
61
|
}, React.createElement(CheckMark, null)));
|
|
61
62
|
});
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
.adm-slider-fill {
|
|
20
20
|
position: absolute;
|
|
21
|
+
z-index: 1;
|
|
21
22
|
height: 8px;
|
|
22
23
|
background-color: var(--fill-color);
|
|
23
24
|
}
|
|
@@ -44,16 +45,11 @@
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
.adm-slider-thumb {
|
|
47
|
-
touch-action: none;
|
|
48
|
-
position: absolute;
|
|
49
48
|
width: 44px;
|
|
50
49
|
height: 44px;
|
|
50
|
+
margin: 10px;
|
|
51
51
|
border-radius: 50%;
|
|
52
|
-
|
|
53
|
-
top: 50%;
|
|
54
|
-
transform: translate(-50%, -50%);
|
|
55
|
-
background: #fff url('../../assets/slider-thumb.svg') no-repeat center center;
|
|
56
|
-
background-size: 20px 20px;
|
|
52
|
+
background: var(--adm-color-white);
|
|
57
53
|
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.12), 0 3px 6px -4px rgba(0, 0, 0, 0.25);
|
|
58
54
|
}
|
|
59
55
|
|
|
@@ -61,9 +57,18 @@
|
|
|
61
57
|
outline: none;
|
|
62
58
|
}
|
|
63
59
|
|
|
60
|
+
.adm-slider-thumb-icon {
|
|
61
|
+
width: 20px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
margin: 12px;
|
|
64
|
+
user-select: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
64
67
|
.adm-slider-thumb-container {
|
|
68
|
+
cursor: grab;
|
|
65
69
|
touch-action: none;
|
|
66
70
|
position: absolute;
|
|
71
|
+
z-index: 2;
|
|
67
72
|
width: 64px;
|
|
68
73
|
height: 64px;
|
|
69
74
|
border-radius: 50%;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
+
export const ThumbIcon = props => {
|
|
4
|
+
return withNativeProps(props, React.createElement("svg", {
|
|
5
|
+
viewBox: '0 0 20 20'
|
|
6
|
+
}, React.createElement("g", {
|
|
7
|
+
stroke: 'none',
|
|
8
|
+
strokeWidth: '1',
|
|
9
|
+
fill: 'none',
|
|
10
|
+
fillRule: 'evenodd'
|
|
11
|
+
}, React.createElement("g", {
|
|
12
|
+
transform: 'translate(-604.000000, -656.000000)',
|
|
13
|
+
fill: '#999999'
|
|
14
|
+
}, React.createElement("g", {
|
|
15
|
+
transform: 'translate(592.000000, 644.000000)'
|
|
16
|
+
}, React.createElement("g", {
|
|
17
|
+
transform: 'translate(12.000000, 12.000000)'
|
|
18
|
+
}, React.createElement("polygon", {
|
|
19
|
+
points: '0 3.33333333 2.22222222 3.33333333 2.22222222 17.7777778 0 17.7777778'
|
|
20
|
+
}), React.createElement("polygon", {
|
|
21
|
+
points: '17.7777778 3.33333333 20 3.33333333 20 17.7777778 17.7777778 17.7777778'
|
|
22
|
+
}), React.createElement("path", {
|
|
23
|
+
d: 'M10.8888889,0 L9.11111111,0 C8.98888889,0 8.88888889,0.107142857 8.88888889,0.238095238 L8.88888889,19.7619048 C8.88888889,19.8928571 8.98888889,20 9.11111111,20 L10.8888889,20 C11.0111111,20 11.1111111,19.8928571 11.1111111,19.7619048 L11.1111111,0.238095238 C11.1111111,0.107142857 11.0111111,0 10.8888889,0 Z'
|
|
24
|
+
})))))));
|
|
25
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { useDrag } from '@use-gesture/react';
|
|
3
|
+
import { ThumbIcon } from './thumb-icon';
|
|
3
4
|
const classPrefix = `adm-slider`;
|
|
4
5
|
|
|
5
6
|
const Thumb = props => {
|
|
@@ -44,7 +45,9 @@ const Thumb = props => {
|
|
|
44
45
|
style: currentPosition()
|
|
45
46
|
}, bind()), React.createElement("div", {
|
|
46
47
|
className: `${classPrefix}-thumb`
|
|
47
|
-
}
|
|
48
|
+
}, React.createElement(ThumbIcon, {
|
|
49
|
+
className: `${classPrefix}-thumb-icon`
|
|
50
|
+
})));
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
export default Thumb;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, useEffect, useImperativeHandle,
|
|
1
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
4
|
import classNames from 'classnames';
|
|
@@ -10,7 +10,7 @@ import PageIndicator from '../page-indicator';
|
|
|
10
10
|
import { staged } from 'staged-components';
|
|
11
11
|
import { useRefState } from '../../utils/use-ref-state';
|
|
12
12
|
import { bound } from '../../utils/bound';
|
|
13
|
-
import { useUpdateEffect } from 'ahooks';
|
|
13
|
+
import { useIsomorphicLayoutEffect, useUpdateEffect } from 'ahooks';
|
|
14
14
|
const defaultProps = {
|
|
15
15
|
defaultIndex: 0,
|
|
16
16
|
allowTouchMove: true,
|
|
@@ -184,7 +184,7 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
184
184
|
swipeNext,
|
|
185
185
|
swipePrev
|
|
186
186
|
}));
|
|
187
|
-
|
|
187
|
+
useIsomorphicLayoutEffect(() => {
|
|
188
188
|
const maxIndex = validChildren.length - 1;
|
|
189
189
|
|
|
190
190
|
if (current > maxIndex) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useRef
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useSpring, animated } from '@react-spring/web';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
6
6
|
import { bound } from '../../utils/bound';
|
|
7
|
-
import { useUpdateLayoutEffect, useThrottleFn } from 'ahooks';
|
|
7
|
+
import { useUpdateLayoutEffect, useThrottleFn, useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
8
|
import { useMutationEffect } from '../../utils/use-mutation-effect';
|
|
9
9
|
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
10
10
|
import { mergeProps } from '../../utils/with-default-props';
|
|
@@ -134,17 +134,17 @@ export const Tabs = p => {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
animate(
|
|
137
|
+
useIsomorphicLayoutEffect(() => {
|
|
138
|
+
animate(!x.isAnimating);
|
|
139
139
|
}, []);
|
|
140
140
|
useUpdateLayoutEffect(() => {
|
|
141
141
|
animate();
|
|
142
142
|
}, [activeKey]);
|
|
143
143
|
useResizeEffect(() => {
|
|
144
|
-
animate(
|
|
144
|
+
animate(!x.isAnimating);
|
|
145
145
|
}, tabListContainerRef);
|
|
146
146
|
useMutationEffect(() => {
|
|
147
|
-
animate(
|
|
147
|
+
animate(!x.isAnimating);
|
|
148
148
|
}, tabListContainerRef, {
|
|
149
149
|
subtree: true,
|
|
150
150
|
childList: true,
|
|
@@ -168,7 +168,7 @@ export const Tabs = p => {
|
|
|
168
168
|
trailing: true,
|
|
169
169
|
leading: true
|
|
170
170
|
});
|
|
171
|
-
|
|
171
|
+
useIsomorphicLayoutEffect(() => {
|
|
172
172
|
updateMask(true);
|
|
173
173
|
}, []);
|
|
174
174
|
return withNativeProps(props, React.createElement("div", {
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react
|
|
|
2
2
|
import { withNativeProps } from '../../utils/native-props';
|
|
3
3
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
4
4
|
import { mergeProps } from '../../utils/with-default-props';
|
|
5
|
+
import { devError } from '../../utils/dev-log';
|
|
5
6
|
const classPrefix = 'adm-text-area';
|
|
6
7
|
const defaultProps = {
|
|
7
8
|
rows: 2,
|
|
@@ -16,7 +17,14 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
16
17
|
showCount,
|
|
17
18
|
maxLength
|
|
18
19
|
} = props;
|
|
19
|
-
const [value, setValue] = usePropsValue(props)
|
|
20
|
+
const [value, setValue] = usePropsValue(Object.assign(Object.assign({}, props), {
|
|
21
|
+
value: props.value === null ? '' : props.value
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
if (props.value === null) {
|
|
25
|
+
devError('TextArea', '`value` prop on `TextArea` should not be `null`. Consider using an empty string to clear the component.');
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
const nativeTextAreaRef = useRef(null);
|
|
21
29
|
useImperativeHandle(ref, () => ({
|
|
22
30
|
clear: () => {
|
|
@@ -74,6 +82,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
74
82
|
className: `${classPrefix}-element`,
|
|
75
83
|
rows: props.rows,
|
|
76
84
|
value: value,
|
|
85
|
+
placeholder: props.placeholder,
|
|
77
86
|
onChange: e => {
|
|
78
87
|
let v = e.target.value;
|
|
79
88
|
|