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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
2
2
|
import { mergeProps } from '../../utils/with-default-props';
|
|
3
3
|
import { renderToContainer } from '../../utils/render-to-container';
|
|
4
4
|
import Mask from '../mask';
|
|
@@ -35,6 +35,16 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps), {
|
|
|
35
35
|
});
|
|
36
36
|
export const MultiImageViewer = forwardRef((p, ref) => {
|
|
37
37
|
const props = mergeProps(multiDefaultProps, p);
|
|
38
|
+
const [defaultIndex, setDefaultIndex] = useState(props.defaultIndex);
|
|
39
|
+
const slidesRef = useRef(null);
|
|
40
|
+
useImperativeHandle(ref, () => ({
|
|
41
|
+
swipeTo: (index, immediate) => {
|
|
42
|
+
var _a;
|
|
43
|
+
|
|
44
|
+
setDefaultIndex(index);
|
|
45
|
+
(_a = slidesRef.current) === null || _a === void 0 ? void 0 : _a.swipeTo(index, immediate);
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
38
48
|
const node = React.createElement(Mask, {
|
|
39
49
|
visible: props.visible,
|
|
40
50
|
disableBodyScroll: false,
|
|
@@ -43,8 +53,8 @@ export const MultiImageViewer = forwardRef((p, ref) => {
|
|
|
43
53
|
}, React.createElement("div", {
|
|
44
54
|
className: `${classPrefix}-content`
|
|
45
55
|
}, props.images && React.createElement(Slides, {
|
|
46
|
-
ref:
|
|
47
|
-
defaultIndex:
|
|
56
|
+
ref: slidesRef,
|
|
57
|
+
defaultIndex: defaultIndex,
|
|
48
58
|
onIndexChange: props.onIndexChange,
|
|
49
59
|
images: props.images,
|
|
50
60
|
onTap: () => {
|
|
@@ -22,7 +22,7 @@ export const Slide = props => {
|
|
|
22
22
|
const pinchLockRef = useRef(false);
|
|
23
23
|
useGesture({
|
|
24
24
|
onDrag: state => {
|
|
25
|
-
if (state.tap && state.elapsedTime > 0) {
|
|
25
|
+
if (state.tap && state.elapsedTime > 0 && state.elapsedTime < 1000) {
|
|
26
26
|
// 判断点击时间>0是为了过滤掉非正常操作,例如用户长按选择图片之后的取消操作(也是一次点击)
|
|
27
27
|
props.onTap();
|
|
28
28
|
return;
|
|
@@ -81,13 +81,16 @@ export const Slide = props => {
|
|
|
81
81
|
target: controlRef,
|
|
82
82
|
drag: {
|
|
83
83
|
// filterTaps: true,
|
|
84
|
-
from: () => [x.get(), y.get()]
|
|
84
|
+
from: () => [x.get(), y.get()],
|
|
85
|
+
pointer: {
|
|
86
|
+
touch: true
|
|
87
|
+
}
|
|
85
88
|
},
|
|
86
89
|
pinch: {
|
|
87
|
-
from: () => [zoom.get(), 0]
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
from: () => [zoom.get(), 0],
|
|
91
|
+
pointer: {
|
|
92
|
+
touch: true
|
|
93
|
+
}
|
|
91
94
|
}
|
|
92
95
|
});
|
|
93
96
|
return React.createElement("div", {
|
|
@@ -109,6 +112,7 @@ export const Slide = props => {
|
|
|
109
112
|
}
|
|
110
113
|
}, React.createElement("img", {
|
|
111
114
|
src: props.image,
|
|
112
|
-
draggable: false
|
|
115
|
+
draggable: false,
|
|
116
|
+
alt: props.image
|
|
113
117
|
}))));
|
|
114
118
|
};
|
|
@@ -7,6 +7,6 @@ export declare type SlidesType = {
|
|
|
7
7
|
onIndexChange?: (index: number) => void;
|
|
8
8
|
};
|
|
9
9
|
export declare type SlidesRef = {
|
|
10
|
-
swipeTo: (index: number, immediate
|
|
10
|
+
swipeTo: (index: number, immediate?: boolean) => void;
|
|
11
11
|
};
|
|
12
12
|
export declare const Slides: React.ForwardRefExoticComponent<SlidesType & React.RefAttributes<SlidesRef>>;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
top: 50%;
|
|
30
30
|
right: 0;
|
|
31
31
|
transform: translateY(-50%);
|
|
32
|
-
z-index:
|
|
32
|
+
z-index: 910;
|
|
33
33
|
overflow: visible;
|
|
34
34
|
color: var(--adm-color-weak);
|
|
35
35
|
font-size: 12px;
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
.adm-index-bar-sticky .adm-index-bar-anchor-title {
|
|
80
80
|
position: sticky;
|
|
81
|
+
z-index: 900;
|
|
81
82
|
top: var(--sticky-offset-top);
|
|
82
83
|
left: 0;
|
|
83
84
|
}
|
|
@@ -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: 15px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 12px;
|
|
5
5
|
--align-items: center;
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
.adm-list-header {
|
|
15
15
|
color: var(--adm-color-weak);
|
|
16
16
|
font-size: var(--header-font-size);
|
|
17
|
-
padding
|
|
18
|
-
padding-right: var(--padding-right);
|
|
19
|
-
margin: 16px 0 4px;
|
|
17
|
+
padding: 8px var(--padding-right) 8px var(--padding-left);
|
|
20
18
|
}
|
|
21
19
|
.adm-list-body {
|
|
22
20
|
background-color: #ffffff;
|
|
@@ -36,6 +34,9 @@
|
|
|
36
34
|
.adm-list-card .adm-list-body {
|
|
37
35
|
border-radius: 8px;
|
|
38
36
|
}
|
|
37
|
+
.adm-list-card .adm-list-header {
|
|
38
|
+
padding-left: 0;
|
|
39
|
+
}
|
|
39
40
|
.adm-list-item {
|
|
40
41
|
display: block;
|
|
41
42
|
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, 3px);
|
|
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
|
.adm-progress-bar-trail {
|
|
7
7
|
background: var(--track-color);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*进度圈*/
|
|
2
2
|
.adm-progress-circle {
|
|
3
|
-
--track-width: 3px;
|
|
4
|
-
--size: 50px;
|
|
5
|
-
--track-color: #e5e5e5;
|
|
6
|
-
--fill-color:
|
|
3
|
+
--track-width: var(--adm-progress-circle-track-width, 3px);
|
|
4
|
+
--size: var(--adm-progress-circle-size, 50px);
|
|
5
|
+
--track-color: var(--adm-progress-circle-track-color, #e5e5e5);
|
|
6
|
+
--fill-color: var(--adm-progress-circle-fill-color, var(--adm-color-primary));
|
|
7
7
|
--percent: 0;
|
|
8
8
|
--pi: 3.14159265;
|
|
9
9
|
--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: 24px;
|
|
3
3
|
--active-color: #ffd21e;
|
|
4
|
+
--inactive-color: var(--adm-color-light);
|
|
4
5
|
display: inline-flex;
|
|
5
6
|
}
|
|
6
7
|
.adm-rate-box {
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
padding: calc(var(--star-size) / 8);
|
|
11
12
|
line-height: var(--star-size);
|
|
12
13
|
font-size: var(--star-size);
|
|
13
|
-
color: var(--
|
|
14
|
+
color: var(--inactive-color);
|
|
14
15
|
text-align: center;
|
|
15
16
|
overflow: hidden;
|
|
16
17
|
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: 2px;
|
|
9
|
+
--padding: 8px 16px;
|
|
4
10
|
overflow: hidden;
|
|
5
11
|
font-size: 15px;
|
|
6
12
|
line-height: 1.4;
|
|
@@ -9,11 +15,12 @@
|
|
|
9
15
|
--gap: 12px;
|
|
10
16
|
}
|
|
11
17
|
.adm-selector-item {
|
|
12
|
-
padding:
|
|
18
|
+
padding: var(--padding);
|
|
13
19
|
position: relative;
|
|
14
|
-
background-color:
|
|
15
|
-
border
|
|
16
|
-
|
|
20
|
+
background-color: var(--color);
|
|
21
|
+
border: var(--border);
|
|
22
|
+
border-radius: var(--border-radius);
|
|
23
|
+
color: var(--text-color);
|
|
17
24
|
opacity: 1;
|
|
18
25
|
cursor: pointer;
|
|
19
26
|
display: inline-block;
|
|
@@ -27,8 +34,9 @@
|
|
|
27
34
|
}
|
|
28
35
|
.adm-selector-item-active,
|
|
29
36
|
.adm-selector-item-multiple-active {
|
|
30
|
-
color: var(--
|
|
37
|
+
color: var(--checked-text-color);
|
|
31
38
|
background-color: var(--checked-color);
|
|
39
|
+
border: var(--checked-border);
|
|
32
40
|
}
|
|
33
41
|
.adm-selector-item .adm-selector-check-mark-wrapper {
|
|
34
42
|
position: absolute;
|
|
@@ -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
|
});
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
}
|
|
16
16
|
.adm-slider-fill {
|
|
17
17
|
position: absolute;
|
|
18
|
+
z-index: 1;
|
|
18
19
|
height: 4px;
|
|
19
20
|
background-color: var(--fill-color);
|
|
20
21
|
}
|
|
@@ -37,24 +38,27 @@
|
|
|
37
38
|
background-color: var(--fill-color);
|
|
38
39
|
}
|
|
39
40
|
.adm-slider-thumb {
|
|
40
|
-
touch-action: none;
|
|
41
|
-
position: absolute;
|
|
42
41
|
width: 22px;
|
|
43
42
|
height: 22px;
|
|
43
|
+
margin: 5px;
|
|
44
44
|
border-radius: 50%;
|
|
45
|
-
|
|
46
|
-
top: 50%;
|
|
47
|
-
transform: translate(-50%, -50%);
|
|
48
|
-
background: #fff url('../../assets/slider-thumb.svg') no-repeat center center;
|
|
49
|
-
background-size: 10px 10px;
|
|
45
|
+
background: var(--adm-color-white);
|
|
50
46
|
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.12), 0 1.5px 3px -2px rgba(0, 0, 0, 0.25);
|
|
51
47
|
}
|
|
52
48
|
.adm-slider-thumb:focus {
|
|
53
49
|
outline: none;
|
|
54
50
|
}
|
|
51
|
+
.adm-slider-thumb-icon {
|
|
52
|
+
width: 10px;
|
|
53
|
+
height: 10px;
|
|
54
|
+
margin: 6px;
|
|
55
|
+
user-select: none;
|
|
56
|
+
}
|
|
55
57
|
.adm-slider-thumb-container {
|
|
58
|
+
cursor: grab;
|
|
56
59
|
touch-action: none;
|
|
57
60
|
position: absolute;
|
|
61
|
+
z-index: 2;
|
|
58
62
|
width: 32px;
|
|
59
63
|
height: 32px;
|
|
60
64
|
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) {
|