antd-mobile 5.1.0 → 5.2.2
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 +9 -1
- package/2x/cjs/components/calendar/calendar.d.ts +11 -2
- package/2x/cjs/components/calendar/calendar.js +32 -10
- package/2x/cjs/components/calendar/index.d.ts +1 -1
- package/2x/cjs/components/capsule-tabs/capsule-tabs.d.ts +1 -0
- package/2x/cjs/components/capsule-tabs/capsule-tabs.js +14 -17
- package/2x/cjs/components/cascade-picker/prompt.d.ts +2 -1
- package/2x/cjs/components/collapse/collapse.js +5 -3
- package/2x/cjs/components/date-picker/date-picker.js +11 -1
- package/2x/cjs/components/dialog/clear.d.ts +1 -0
- package/2x/cjs/components/dialog/clear.js +14 -0
- package/2x/cjs/components/dialog/dialog.css +27 -18
- package/2x/cjs/components/dialog/dialog.js +39 -42
- package/2x/cjs/components/dialog/index.d.ts +2 -0
- package/2x/cjs/components/dialog/index.js +4 -1
- package/2x/cjs/components/dialog/show.d.ts +1 -0
- package/2x/cjs/components/dialog/show.js +23 -11
- package/2x/cjs/components/dropdown/dropdown.css +2 -1
- package/2x/cjs/components/dropdown/item.js +2 -2
- package/2x/cjs/components/form/form.css +12 -0
- package/2x/cjs/components/form/form.d.ts +4 -4
- package/2x/cjs/components/form/index.css +12 -0
- package/2x/cjs/components/form/index.d.ts +3 -3
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +1 -1
- package/2x/cjs/components/image-viewer/index.d.ts +1 -1
- package/2x/cjs/components/input/input.d.ts +2 -2
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +14 -17
- package/2x/cjs/components/mask/mask.js +2 -2
- package/2x/cjs/components/modal/clear.d.ts +1 -0
- package/2x/cjs/components/modal/clear.js +14 -0
- package/2x/cjs/components/modal/index.d.ts +2 -0
- package/2x/cjs/components/modal/index.js +4 -1
- package/2x/cjs/components/modal/modal.css +27 -21
- package/2x/cjs/components/modal/modal.js +39 -36
- package/2x/cjs/components/modal/show.d.ts +1 -0
- package/2x/cjs/components/modal/show.js +23 -11
- package/2x/cjs/components/passcode-input/passcode-input.d.ts +1 -1
- package/2x/cjs/components/picker/prompt.d.ts +2 -2
- package/2x/cjs/components/picker-view/picker-view.css +0 -10
- package/2x/cjs/components/picker-view/wheel.js +7 -14
- package/2x/cjs/components/popover/arrow.js +1 -2
- package/2x/cjs/components/popover/index.d.ts +3 -3
- package/2x/cjs/components/popover/popover-menu.d.ts +1 -1
- package/2x/cjs/components/popover/popover.d.ts +1 -1
- package/2x/cjs/components/popup/popup.js +2 -2
- package/2x/cjs/components/search-bar/search-bar.js +1 -0
- package/2x/cjs/components/selector/selector.d.ts +3 -1
- package/2x/cjs/components/stepper/stepper.d.ts +12 -2
- package/2x/cjs/components/stepper/stepper.js +43 -16
- package/2x/cjs/components/swiper/index.d.ts +3 -3
- package/2x/cjs/components/swiper/swiper.d.ts +3 -3
- package/2x/cjs/components/switch/spin-icon.d.ts +3 -0
- package/2x/cjs/components/switch/spin-icon.js +37 -0
- package/2x/cjs/components/switch/switch.css +1 -1
- package/2x/cjs/components/switch/switch.js +4 -6
- package/2x/cjs/components/tabs/tabs.d.ts +1 -0
- package/2x/cjs/components/tabs/tabs.js +17 -19
- package/2x/cjs/components/virtual-input/virtual-input.d.ts +2 -2
- package/2x/cjs/utils/measure-css-length.d.ts +1 -0
- package/2x/cjs/utils/measure-css-length.js +28 -0
- package/2x/cjs/utils/native-props.d.ts +1 -1
- package/2x/cjs/utils/render-to-container.d.ts +1 -1
- package/2x/cjs/utils/should-render.d.ts +10 -0
- package/{cjs/utils/use-should-render.js → 2x/cjs/utils/should-render.js} +8 -0
- package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -2
- package/2x/cjs/utils/use-isomorphic-update-layout-effect.js +1 -3
- package/2x/cjs/utils/use-props-value.d.ts +1 -1
- package/2x/cjs/utils/use-tab-list-scroll.js +3 -1
- package/2x/cjs/utils/use-touch.d.ts +0 -1
- package/2x/cjs/utils/validate.js +1 -1
- package/2x/cjs/utils/with-stop-propagation.d.ts +1 -1
- package/2x/es/components/calendar/calendar.d.ts +11 -2
- package/2x/es/components/calendar/calendar.js +33 -9
- package/2x/es/components/calendar/index.d.ts +1 -1
- package/2x/es/components/capsule-tabs/capsule-tabs.d.ts +1 -0
- package/2x/es/components/capsule-tabs/capsule-tabs.js +13 -17
- package/2x/es/components/cascade-picker/prompt.d.ts +2 -1
- package/2x/es/components/collapse/collapse.js +4 -3
- package/2x/es/components/date-picker/date-picker.js +10 -1
- package/2x/es/components/dialog/clear.d.ts +1 -0
- package/2x/es/components/dialog/clear.js +6 -0
- package/2x/es/components/dialog/dialog.css +27 -18
- package/2x/es/components/dialog/dialog.js +37 -41
- package/2x/es/components/dialog/index.d.ts +2 -0
- package/2x/es/components/dialog/index.js +3 -1
- package/2x/es/components/dialog/show.d.ts +1 -0
- package/2x/es/components/dialog/show.js +20 -11
- package/2x/es/components/dropdown/dropdown.css +2 -1
- package/2x/es/components/dropdown/item.js +1 -1
- package/2x/es/components/form/form.css +12 -0
- package/2x/es/components/form/form.d.ts +4 -4
- package/2x/es/components/form/index.css +12 -0
- package/2x/es/components/form/index.d.ts +3 -3
- package/2x/es/components/image-viewer/image-viewer.d.ts +1 -1
- package/2x/es/components/image-viewer/index.d.ts +1 -1
- package/2x/es/components/input/input.d.ts +2 -2
- package/2x/es/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
- package/2x/es/components/jumbo-tabs/jumbo-tabs.js +13 -17
- package/2x/es/components/mask/mask.js +1 -1
- package/2x/es/components/modal/clear.d.ts +1 -0
- package/2x/es/components/modal/clear.js +6 -0
- package/2x/es/components/modal/index.d.ts +2 -0
- package/2x/es/components/modal/index.js +3 -1
- package/2x/es/components/modal/modal.css +27 -21
- package/2x/es/components/modal/modal.js +37 -36
- package/2x/es/components/modal/show.d.ts +1 -0
- package/2x/es/components/modal/show.js +20 -11
- package/2x/es/components/passcode-input/passcode-input.d.ts +1 -1
- package/2x/es/components/picker/prompt.d.ts +2 -2
- package/2x/es/components/picker-view/picker-view.css +0 -10
- package/2x/es/components/picker-view/wheel.js +7 -14
- package/2x/es/components/popover/arrow.js +1 -2
- package/2x/es/components/popover/index.d.ts +3 -3
- package/2x/es/components/popover/popover-menu.d.ts +1 -1
- package/2x/es/components/popover/popover.d.ts +1 -1
- package/2x/es/components/popup/popup.js +1 -1
- package/2x/es/components/search-bar/search-bar.js +1 -0
- package/2x/es/components/selector/selector.d.ts +3 -1
- package/2x/es/components/stepper/stepper.d.ts +12 -2
- package/2x/es/components/stepper/stepper.js +43 -16
- package/2x/es/components/swiper/index.d.ts +3 -3
- package/2x/es/components/swiper/swiper.d.ts +3 -3
- package/2x/es/components/switch/spin-icon.d.ts +3 -0
- package/2x/es/components/switch/spin-icon.js +23 -0
- package/2x/es/components/switch/switch.css +1 -1
- package/2x/es/components/switch/switch.js +3 -5
- package/2x/es/components/tabs/tabs.d.ts +1 -0
- package/2x/es/components/tabs/tabs.js +16 -20
- package/2x/es/components/virtual-input/virtual-input.d.ts +2 -2
- package/2x/es/utils/measure-css-length.d.ts +1 -0
- package/2x/es/utils/measure-css-length.js +19 -0
- package/2x/es/utils/native-props.d.ts +1 -1
- package/2x/es/utils/render-to-container.d.ts +1 -1
- package/2x/es/utils/should-render.d.ts +10 -0
- package/2x/es/utils/{use-should-render.js → should-render.js} +4 -0
- package/2x/es/utils/use-drag-and-pinch.d.ts +1 -2
- package/2x/es/utils/use-isomorphic-update-layout-effect.js +1 -2
- package/2x/es/utils/use-props-value.d.ts +1 -1
- package/2x/es/utils/use-tab-list-scroll.js +3 -2
- package/2x/es/utils/use-touch.d.ts +0 -1
- package/2x/es/utils/validate.js +1 -1
- package/2x/es/utils/with-stop-propagation.d.ts +1 -1
- package/2x/package.json +4 -4
- package/README.md +9 -1
- package/cjs/components/calendar/calendar.d.ts +11 -2
- package/cjs/components/calendar/calendar.js +32 -10
- package/cjs/components/calendar/index.d.ts +1 -1
- package/cjs/components/capsule-tabs/capsule-tabs.d.ts +1 -0
- package/cjs/components/capsule-tabs/capsule-tabs.js +14 -17
- package/cjs/components/cascade-picker/prompt.d.ts +2 -1
- package/cjs/components/collapse/collapse.js +5 -3
- package/cjs/components/date-picker/date-picker.js +11 -1
- package/cjs/components/dialog/clear.d.ts +1 -0
- package/cjs/components/dialog/clear.js +14 -0
- package/cjs/components/dialog/dialog.css +26 -18
- package/cjs/components/dialog/dialog.js +39 -42
- package/cjs/components/dialog/index.d.ts +2 -0
- package/cjs/components/dialog/index.js +4 -1
- package/cjs/components/dialog/show.d.ts +1 -0
- package/cjs/components/dialog/show.js +23 -11
- package/cjs/components/dropdown/dropdown.css +2 -1
- package/cjs/components/dropdown/item.js +2 -2
- package/cjs/components/form/form.css +11 -0
- package/cjs/components/form/form.d.ts +4 -4
- package/cjs/components/form/index.css +11 -0
- package/cjs/components/form/index.d.ts +3 -3
- package/cjs/components/image-viewer/image-viewer.d.ts +1 -1
- package/cjs/components/image-viewer/index.d.ts +1 -1
- package/cjs/components/input/input.d.ts +2 -2
- package/cjs/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
- package/cjs/components/jumbo-tabs/jumbo-tabs.js +14 -17
- package/cjs/components/mask/mask.js +2 -2
- package/cjs/components/modal/clear.d.ts +1 -0
- package/cjs/components/modal/clear.js +14 -0
- package/cjs/components/modal/index.d.ts +2 -0
- package/cjs/components/modal/index.js +4 -1
- package/cjs/components/modal/modal.css +26 -20
- package/cjs/components/modal/modal.js +39 -36
- package/cjs/components/modal/show.d.ts +1 -0
- package/cjs/components/modal/show.js +23 -11
- package/cjs/components/passcode-input/passcode-input.d.ts +1 -1
- package/cjs/components/picker/prompt.d.ts +2 -2
- package/cjs/components/picker-view/picker-view.css +0 -9
- package/cjs/components/picker-view/wheel.js +7 -14
- package/cjs/components/popover/arrow.js +1 -2
- package/cjs/components/popover/index.d.ts +3 -3
- package/cjs/components/popover/popover-menu.d.ts +1 -1
- package/cjs/components/popover/popover.d.ts +1 -1
- package/cjs/components/popup/popup.js +2 -2
- package/cjs/components/search-bar/search-bar.js +1 -0
- package/cjs/components/selector/selector.d.ts +3 -1
- package/cjs/components/stepper/stepper.d.ts +12 -2
- package/cjs/components/stepper/stepper.js +43 -16
- package/cjs/components/swiper/index.d.ts +3 -3
- package/cjs/components/swiper/swiper.d.ts +3 -3
- package/cjs/components/switch/spin-icon.d.ts +3 -0
- package/cjs/components/switch/spin-icon.js +37 -0
- package/cjs/components/switch/switch.css +1 -1
- package/cjs/components/switch/switch.js +4 -6
- package/cjs/components/tabs/tabs.d.ts +1 -0
- package/cjs/components/tabs/tabs.js +17 -19
- package/cjs/components/virtual-input/virtual-input.d.ts +2 -2
- package/cjs/utils/measure-css-length.d.ts +1 -0
- package/cjs/utils/measure-css-length.js +28 -0
- package/cjs/utils/native-props.d.ts +1 -1
- package/cjs/utils/render-to-container.d.ts +1 -1
- package/cjs/utils/should-render.d.ts +10 -0
- package/{2x/cjs/utils/use-should-render.js → cjs/utils/should-render.js} +8 -0
- package/cjs/utils/use-drag-and-pinch.d.ts +1 -2
- package/cjs/utils/use-isomorphic-update-layout-effect.js +1 -3
- package/cjs/utils/use-props-value.d.ts +1 -1
- package/cjs/utils/use-tab-list-scroll.js +3 -1
- package/cjs/utils/use-touch.d.ts +0 -1
- package/cjs/utils/validate.js +1 -1
- package/cjs/utils/with-stop-propagation.d.ts +1 -1
- package/es/components/calendar/calendar.d.ts +11 -2
- package/es/components/calendar/calendar.js +33 -9
- package/es/components/calendar/index.d.ts +1 -1
- package/es/components/capsule-tabs/capsule-tabs.d.ts +1 -0
- package/es/components/capsule-tabs/capsule-tabs.js +13 -17
- package/es/components/cascade-picker/prompt.d.ts +2 -1
- package/es/components/collapse/collapse.js +4 -3
- package/es/components/date-picker/date-picker.js +10 -1
- package/es/components/dialog/clear.d.ts +1 -0
- package/es/components/dialog/clear.js +6 -0
- package/es/components/dialog/dialog.css +26 -18
- package/es/components/dialog/dialog.js +37 -41
- package/es/components/dialog/index.d.ts +2 -0
- package/es/components/dialog/index.js +3 -1
- package/es/components/dialog/show.d.ts +1 -0
- package/es/components/dialog/show.js +20 -11
- package/es/components/dropdown/dropdown.css +2 -1
- package/es/components/dropdown/item.js +1 -1
- package/es/components/form/form.css +11 -0
- package/es/components/form/form.d.ts +4 -4
- package/es/components/form/index.css +11 -0
- package/es/components/form/index.d.ts +3 -3
- package/es/components/image-viewer/image-viewer.d.ts +1 -1
- package/es/components/image-viewer/index.d.ts +1 -1
- package/es/components/input/input.d.ts +2 -2
- package/es/components/jumbo-tabs/jumbo-tabs.d.ts +1 -0
- package/es/components/jumbo-tabs/jumbo-tabs.js +13 -17
- package/es/components/mask/mask.js +1 -1
- package/es/components/modal/clear.d.ts +1 -0
- package/es/components/modal/clear.js +6 -0
- package/es/components/modal/index.d.ts +2 -0
- package/es/components/modal/index.js +3 -1
- package/es/components/modal/modal.css +26 -20
- package/es/components/modal/modal.js +37 -36
- package/es/components/modal/show.d.ts +1 -0
- package/es/components/modal/show.js +20 -11
- package/es/components/passcode-input/passcode-input.d.ts +1 -1
- package/es/components/picker/prompt.d.ts +2 -2
- package/es/components/picker-view/picker-view.css +0 -9
- package/es/components/picker-view/wheel.js +7 -14
- package/es/components/popover/arrow.js +1 -2
- package/es/components/popover/index.d.ts +3 -3
- package/es/components/popover/popover-menu.d.ts +1 -1
- package/es/components/popover/popover.d.ts +1 -1
- package/es/components/popup/popup.js +1 -1
- package/es/components/search-bar/search-bar.js +1 -0
- package/es/components/selector/selector.d.ts +3 -1
- package/es/components/stepper/stepper.d.ts +12 -2
- package/es/components/stepper/stepper.js +43 -16
- package/es/components/swiper/index.d.ts +3 -3
- package/es/components/swiper/swiper.d.ts +3 -3
- package/es/components/switch/spin-icon.d.ts +3 -0
- package/es/components/switch/spin-icon.js +23 -0
- package/es/components/switch/switch.css +1 -1
- package/es/components/switch/switch.js +3 -5
- package/es/components/tabs/tabs.d.ts +1 -0
- package/es/components/tabs/tabs.js +16 -20
- package/es/components/virtual-input/virtual-input.d.ts +2 -2
- package/es/utils/measure-css-length.d.ts +1 -0
- package/es/utils/measure-css-length.js +19 -0
- package/es/utils/native-props.d.ts +1 -1
- package/es/utils/render-to-container.d.ts +1 -1
- package/es/utils/should-render.d.ts +10 -0
- package/es/utils/{use-should-render.js → should-render.js} +4 -0
- package/es/utils/use-drag-and-pinch.d.ts +1 -2
- package/es/utils/use-isomorphic-update-layout-effect.js +1 -2
- package/es/utils/use-props-value.d.ts +1 -1
- package/es/utils/use-tab-list-scroll.js +3 -2
- package/es/utils/use-touch.d.ts +0 -1
- package/es/utils/validate.js +1 -1
- package/es/utils/with-stop-propagation.d.ts +1 -1
- package/package.json +4 -4
- package/umd/antd-mobile.js +1 -1
- package/2x/assets/spin.svg +0 -12
- package/2x/cjs/assets/spin.svg +0 -12
- package/2x/cjs/utils/use-should-render.d.ts +0 -1
- package/2x/es/assets/spin.svg +0 -12
- package/2x/es/utils/use-should-render.d.ts +0 -1
- package/assets/spin.svg +0 -12
- package/cjs/assets/spin.svg +0 -12
- package/cjs/utils/use-should-render.d.ts +0 -1
- package/es/assets/spin.svg +0 -12
- package/es/utils/use-should-render.d.ts +0 -1
|
@@ -5,7 +5,7 @@ import { rubberbandIfOutOfBounds } from '../../utils/rubberband';
|
|
|
5
5
|
import { bound } from '../../utils/bound';
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
8
|
-
import
|
|
8
|
+
import { measureCSSLength } from '../../utils/measure-css-length';
|
|
9
9
|
const classPrefix = `adm-picker-view`;
|
|
10
10
|
export const Wheel = memo(props => {
|
|
11
11
|
const {
|
|
@@ -29,16 +29,12 @@ export const Wheel = memo(props => {
|
|
|
29
29
|
}
|
|
30
30
|
}));
|
|
31
31
|
const draggingRef = useRef(false);
|
|
32
|
-
const
|
|
32
|
+
const rootRef = useRef(null);
|
|
33
33
|
const itemHeight = useRef(34);
|
|
34
34
|
useIsomorphicLayoutEffect(() => {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (rect.height > 0) {
|
|
40
|
-
itemHeight.current = rect.height;
|
|
41
|
-
}
|
|
35
|
+
const root = rootRef.current;
|
|
36
|
+
if (!root) return;
|
|
37
|
+
itemHeight.current = measureCSSLength(window.getComputedStyle(root).getPropertyValue('--item-height'));
|
|
42
38
|
});
|
|
43
39
|
useIsomorphicLayoutEffect(() => {
|
|
44
40
|
if (draggingRef.current) return;
|
|
@@ -134,12 +130,9 @@ export const Wheel = memo(props => {
|
|
|
134
130
|
}
|
|
135
131
|
|
|
136
132
|
return React.createElement("div", Object.assign({
|
|
133
|
+
ref: rootRef,
|
|
137
134
|
className: `${classPrefix}-column`
|
|
138
|
-
}, bind()), React.createElement(
|
|
139
|
-
ref: dummyItemRef,
|
|
140
|
-
className: classNames(`${classPrefix}-column-item`, `${classPrefix}-column-item-dummy`),
|
|
141
|
-
"aria-hidden": true
|
|
142
|
-
}), React.createElement(animated.div, {
|
|
135
|
+
}, bind()), React.createElement(animated.div, {
|
|
143
136
|
style: {
|
|
144
137
|
translateY: y
|
|
145
138
|
},
|
|
@@ -4,9 +4,8 @@ export const Arrow = memo(props => {
|
|
|
4
4
|
return withNativeProps(props, React.createElement("svg", {
|
|
5
5
|
viewBox: '0 0 30 16'
|
|
6
6
|
}, React.createElement("g", {
|
|
7
|
-
transform: 'translate(-1300.000000, -841.000000)',
|
|
8
7
|
fill: 'currentColor'
|
|
9
8
|
}, React.createElement("path", {
|
|
10
|
-
d: '
|
|
9
|
+
d: 'M0,0 L30,0 L18.07289,14.312538 C16.65863,16.009645 14.13637,16.238942 12.43926,14.824685 C12.25341,14.669808 12.08199,14.49839 11.92711,14.312538 L0,0 L0,0 Z'
|
|
11
10
|
}))));
|
|
12
11
|
});
|
|
@@ -4,16 +4,16 @@ import './popover-menu.less';
|
|
|
4
4
|
export type { PopoverProps, PopoverRef } from './popover';
|
|
5
5
|
export type { PopoverMenuProps, Action } from './popover-menu';
|
|
6
6
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
7
|
-
getContainer?:
|
|
7
|
+
getContainer?: import("../../utils/render-to-container").GetContainer | undefined;
|
|
8
8
|
destroyOnHide?: boolean | undefined;
|
|
9
|
-
children: import("react").ReactElement<any, string |
|
|
9
|
+
children: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
10
10
|
mode?: "dark" | "light" | undefined;
|
|
11
11
|
trigger?: "click" | undefined;
|
|
12
12
|
placement?: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
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: import("react").ForwardRefExoticComponent<
|
|
16
|
+
Menu: import("react").ForwardRefExoticComponent<Omit<import("./popover").PopoverProps, "content"> & {
|
|
17
17
|
actions: import("./popover-menu").Action[];
|
|
18
18
|
onAction?: ((item: import("./popover-menu").Action) => void) | undefined;
|
|
19
19
|
} & import("react").RefAttributes<import("./popover").PopoverRef>>;
|
|
@@ -11,7 +11,7 @@ export declare type PopoverMenuProps = Omit<PopoverProps, 'content'> & {
|
|
|
11
11
|
actions: Action[];
|
|
12
12
|
onAction?: (item: Action) => void;
|
|
13
13
|
};
|
|
14
|
-
export declare const PopoverMenu: React.ForwardRefExoticComponent<
|
|
14
|
+
export declare const PopoverMenu: React.ForwardRefExoticComponent<Omit<PopoverProps, "content"> & {
|
|
15
15
|
actions: Action[];
|
|
16
16
|
onAction?: ((item: Action) => void) | undefined;
|
|
17
17
|
} & React.RefAttributes<PopoverRef>>;
|
|
@@ -19,7 +19,7 @@ export declare type PopoverRef = {
|
|
|
19
19
|
visible: boolean;
|
|
20
20
|
};
|
|
21
21
|
export declare const Popover: React.ForwardRefExoticComponent<{
|
|
22
|
-
getContainer?:
|
|
22
|
+
getContainer?: GetContainer | undefined;
|
|
23
23
|
destroyOnHide?: boolean | undefined;
|
|
24
24
|
children: ReactElement;
|
|
25
25
|
mode?: "dark" | "light" | undefined;
|
|
@@ -7,7 +7,7 @@ import Mask from '../mask';
|
|
|
7
7
|
import { useLockScroll } from '../../utils/use-lock-scroll';
|
|
8
8
|
import { renderToContainer } from '../../utils/render-to-container';
|
|
9
9
|
import { useSpring, animated } from '@react-spring/web';
|
|
10
|
-
import { useShouldRender } from '../../utils/
|
|
10
|
+
import { useShouldRender } from '../../utils/should-render';
|
|
11
11
|
import { withStopPropagation } from '../../utils/with-stop-propagation';
|
|
12
12
|
const classPrefix = `adm-popup`;
|
|
13
13
|
const defaultProps = {
|
|
@@ -45,6 +45,7 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
45
45
|
|
|
46
46
|
const renderCancelButton = () => {
|
|
47
47
|
let isShowCancel = false;
|
|
48
|
+
const showCancelButton = props.showCancelButton;
|
|
48
49
|
|
|
49
50
|
if (typeof props.showCancelButton === 'function') {
|
|
50
51
|
isShowCancel = props.showCancelButton(hasFocus, value);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
declare type SelectorValue = string | number;
|
|
3
4
|
export interface SelectorOption<V> {
|
|
4
5
|
label: ReactNode;
|
|
5
6
|
description?: ReactNode;
|
|
@@ -18,4 +19,5 @@ export declare type SelectorProps<V> = {
|
|
|
18
19
|
}) => void;
|
|
19
20
|
showCheckMark?: boolean;
|
|
20
21
|
} & NativeProps<'--color' | '--checked-color' | '--text-color' | '--checked-text-color' | '--border' | '--checked-border' | '--border-radius' | '--padding'>;
|
|
21
|
-
export declare const Selector: <V extends
|
|
22
|
+
export declare const Selector: <V extends SelectorValue>(p: SelectorProps<V>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
23
|
+
export {};
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { InputProps } from '../input';
|
|
4
|
-
|
|
4
|
+
declare type ValueProps = {
|
|
5
|
+
allowEmpty: true;
|
|
6
|
+
value?: number | null;
|
|
7
|
+
defaultValue?: number | null;
|
|
8
|
+
onChange?: (value: number | null) => void;
|
|
9
|
+
};
|
|
10
|
+
declare type ValuePropsWithNull = {
|
|
11
|
+
allowEmpty?: false;
|
|
5
12
|
value?: number;
|
|
6
13
|
defaultValue?: number;
|
|
14
|
+
onChange?: (value: number) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare type StepperProps = Pick<InputProps, 'onFocus' | 'onBlur'> & (ValuePropsWithNull | ValueProps) & {
|
|
7
17
|
min?: number;
|
|
8
18
|
max?: number;
|
|
9
19
|
step?: number;
|
|
10
20
|
digits?: number;
|
|
11
21
|
disabled?: boolean;
|
|
12
22
|
inputReadOnly?: boolean;
|
|
13
|
-
onChange?: (value: number) => void;
|
|
14
23
|
} & NativeProps<'--height' | '--input-width' | '--input-font-size' | '--input-background-color' | '--border-radius' | '--border' | '--border-inner' | '--active-border' | '--button-font-size' | '--button-background-color' | '--button-width' | '--input-font-color' | '--button-text-color'>;
|
|
15
24
|
export declare const Stepper: FC<StepperProps>;
|
|
25
|
+
export {};
|
|
@@ -11,7 +11,8 @@ const classPrefix = `adm-stepper`;
|
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
defaultValue: 0,
|
|
13
13
|
step: 1,
|
|
14
|
-
disabled: false
|
|
14
|
+
disabled: false,
|
|
15
|
+
allowEmpty: false
|
|
15
16
|
};
|
|
16
17
|
export const Stepper = p => {
|
|
17
18
|
const props = mergeProps(defaultProps, p);
|
|
@@ -23,7 +24,7 @@ export const Stepper = p => {
|
|
|
23
24
|
inputReadOnly
|
|
24
25
|
} = props;
|
|
25
26
|
const [value, setValue] = usePropsValue(props);
|
|
26
|
-
const [inputValue, setInputValue] = useState(() => value
|
|
27
|
+
const [inputValue, setInputValue] = useState(() => convertValueToText(value));
|
|
27
28
|
|
|
28
29
|
function setValueWithCheck(v) {
|
|
29
30
|
if (isNaN(v)) return;
|
|
@@ -39,42 +40,58 @@ export const Stepper = p => {
|
|
|
39
40
|
const [hasFocus, setHasFocus] = useState(false);
|
|
40
41
|
useEffect(() => {
|
|
41
42
|
if (!hasFocus) {
|
|
42
|
-
setInputValue(value
|
|
43
|
+
setInputValue(convertValueToText(value));
|
|
43
44
|
}
|
|
44
45
|
}, [hasFocus]);
|
|
45
46
|
useEffect(() => {
|
|
46
47
|
if (!hasFocus) {
|
|
47
|
-
setInputValue(value
|
|
48
|
+
setInputValue(convertValueToText(value));
|
|
48
49
|
}
|
|
49
50
|
}, [value]);
|
|
50
51
|
|
|
51
52
|
const handleInputChange = v => {
|
|
52
53
|
setInputValue(v);
|
|
53
|
-
|
|
54
|
+
const value = convertTextToValue(v);
|
|
55
|
+
|
|
56
|
+
if (value === null) {
|
|
57
|
+
if (props.allowEmpty) {
|
|
58
|
+
setValue(null);
|
|
59
|
+
} else {
|
|
60
|
+
setValue(props.defaultValue);
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
setValueWithCheck(value);
|
|
64
|
+
}
|
|
54
65
|
};
|
|
55
66
|
|
|
56
67
|
const handleMinus = () => {
|
|
57
|
-
setValueWithCheck(value - step);
|
|
68
|
+
setValueWithCheck((value !== null && value !== void 0 ? value : 0) - step);
|
|
58
69
|
};
|
|
59
70
|
|
|
60
71
|
const handlePlus = () => {
|
|
61
|
-
setValueWithCheck(value + step);
|
|
72
|
+
setValueWithCheck((value !== null && value !== void 0 ? value : 0) + step);
|
|
62
73
|
};
|
|
63
74
|
|
|
64
75
|
const minusDisabled = () => {
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
if (disabled) return true;
|
|
77
|
+
if (value === null) return false;
|
|
78
|
+
|
|
79
|
+
if (min !== undefined) {
|
|
80
|
+
return value <= min;
|
|
69
81
|
}
|
|
82
|
+
|
|
83
|
+
return false;
|
|
70
84
|
};
|
|
71
85
|
|
|
72
86
|
const plusDisabled = () => {
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
if (disabled) return true;
|
|
88
|
+
if (value === null) return false;
|
|
89
|
+
|
|
90
|
+
if (max !== undefined) {
|
|
91
|
+
return value >= max;
|
|
77
92
|
}
|
|
93
|
+
|
|
94
|
+
return false;
|
|
78
95
|
};
|
|
79
96
|
|
|
80
97
|
return withNativeProps(props, React.createElement("div", {
|
|
@@ -118,4 +135,14 @@ export const Stepper = p => {
|
|
|
118
135
|
shape: 'rectangular',
|
|
119
136
|
color: 'primary'
|
|
120
137
|
}, React.createElement(AddOutline, null))));
|
|
121
|
-
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
function convertValueToText(value) {
|
|
141
|
+
if (value === null) return '';
|
|
142
|
+
return value.toString();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function convertTextToValue(text) {
|
|
146
|
+
if (text === '') return null;
|
|
147
|
+
return parseFloat(text);
|
|
148
|
+
}
|
|
@@ -7,15 +7,15 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
7
7
|
autoplay?: boolean | undefined;
|
|
8
8
|
autoplayInterval?: number | undefined;
|
|
9
9
|
loop?: boolean | undefined;
|
|
10
|
-
direction?: "
|
|
10
|
+
direction?: "vertical" | "horizontal" | undefined;
|
|
11
11
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
12
|
-
indicatorProps?: Pick<import("../page-indicator").PageIndicatorProps, "style" | "
|
|
12
|
+
indicatorProps?: Pick<import("../page-indicator").PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
13
13
|
indicator?: ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
14
14
|
slideSize?: number | undefined;
|
|
15
15
|
trackOffset?: number | undefined;
|
|
16
16
|
stuckAtBoundary?: boolean | undefined;
|
|
17
17
|
rubberband?: boolean | undefined;
|
|
18
|
-
children?: import("react").ReactElement<any, string |
|
|
18
|
+
children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
19
19
|
} & import("../../utils/native-props").NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & import("react").RefAttributes<import("./swiper").SwiperRef>> & {
|
|
20
20
|
Item: import("react").FC<{
|
|
21
21
|
onClick?: ((e: import("react").MouseEvent<HTMLDivElement, MouseEvent>) => void) | undefined;
|
|
@@ -28,13 +28,13 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
28
28
|
autoplay?: boolean | undefined;
|
|
29
29
|
autoplayInterval?: number | undefined;
|
|
30
30
|
loop?: boolean | undefined;
|
|
31
|
-
direction?: "
|
|
31
|
+
direction?: "vertical" | "horizontal" | undefined;
|
|
32
32
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
33
|
-
indicatorProps?: Pick<PageIndicatorProps, "style" | "
|
|
33
|
+
indicatorProps?: Pick<PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
34
34
|
indicator?: ((total: number, current: number) => ReactNode) | undefined;
|
|
35
35
|
slideSize?: number | undefined;
|
|
36
36
|
trackOffset?: number | undefined;
|
|
37
37
|
stuckAtBoundary?: boolean | undefined;
|
|
38
38
|
rubberband?: boolean | undefined;
|
|
39
|
-
children?: React.ReactElement<any, string |
|
|
39
|
+
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
40
40
|
} & NativeProps<"--border-radius" | "--width" | "--height" | "--track-padding"> & React.RefAttributes<SwiperRef>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
+
export const SpinIcon = memo(props => {
|
|
4
|
+
return withNativeProps(props, React.createElement("svg", {
|
|
5
|
+
width: '28px',
|
|
6
|
+
height: '28px',
|
|
7
|
+
viewBox: '0 0 28 28'
|
|
8
|
+
}, React.createElement("g", {
|
|
9
|
+
stroke: 'none',
|
|
10
|
+
strokeWidth: '1',
|
|
11
|
+
fill: 'none',
|
|
12
|
+
fillRule: 'evenodd'
|
|
13
|
+
}, React.createElement("g", {
|
|
14
|
+
transform: 'translate(-137.000000, -840.000000)',
|
|
15
|
+
fill: '#1576FE'
|
|
16
|
+
}, React.createElement("g", {
|
|
17
|
+
transform: 'translate(80.000000, 823.000000)'
|
|
18
|
+
}, React.createElement("g", {
|
|
19
|
+
transform: 'translate(53.000000, 13.000000)'
|
|
20
|
+
}, React.createElement("path", {
|
|
21
|
+
d: 'M17.9996753,31.5 C10.5556724,31.5 4.5,25.4443275 4.5,18.0003247 C4.5,10.5563219 10.5556724,4.5 17.9996753,4.5 C18.5355492,4.5 18.9702974,4.93474816 18.9702974,5.47062208 C18.9702974,6.006496 18.5355492,6.44124416 17.9996753,6.44124416 C11.6261524,6.44124416 6.44124416,11.6267709 6.44124416,18.0002938 C6.44124416,24.3738167 11.6261524,29.5587249 17.9996753,29.5587249 C24.3731982,29.5587249 29.5587249,24.3738167 29.5587249,18.0002938 C29.5587249,14.7964616 28.2778291,11.8169616 25.9523687,9.61220279 C25.5637302,9.24317094 25.5473089,8.62893223 25.9157222,8.23967523 C26.2841356,7.84976878 26.8989928,7.83461537 27.2882498,8.20302872 C30.0042351,10.7787368 31.5,14.2580826 31.5,18.0002938 C31.5,25.4443275 25.4436781,31.5 17.9996753,31.5 Z'
|
|
22
|
+
})))))));
|
|
23
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import SpinIcon from '../../assets/spin.svg';
|
|
5
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
6
5
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
7
6
|
import { mergeProps } from '../../utils/with-default-props';
|
|
7
|
+
import { SpinIcon } from './spin-icon';
|
|
8
8
|
const classPrefix = `adm-switch`;
|
|
9
9
|
const defaultProps = {
|
|
10
10
|
defaultChecked: false
|
|
@@ -54,10 +54,8 @@ export const Switch = p => {
|
|
|
54
54
|
className: `${classPrefix}-checkbox`
|
|
55
55
|
}, React.createElement("div", {
|
|
56
56
|
className: `${classPrefix}-handle`
|
|
57
|
-
}, (props.loading || changing) && React.createElement(
|
|
58
|
-
|
|
59
|
-
className: `${classPrefix}-icon`,
|
|
60
|
-
alt: 'switch-handle'
|
|
57
|
+
}, (props.loading || changing) && React.createElement(SpinIcon, {
|
|
58
|
+
className: `${classPrefix}-spin-icon`
|
|
61
59
|
})), React.createElement("div", {
|
|
62
60
|
className: `${classPrefix}-inner`
|
|
63
61
|
}, checked ? props.checkedText : props.uncheckedText))));
|
|
@@ -4,10 +4,12 @@ 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 {
|
|
7
|
+
import { 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';
|
|
11
|
+
import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-update-layout-effect';
|
|
12
|
+
import { ShouldRender } from '../../utils/should-render';
|
|
11
13
|
const classPrefix = `adm-tabs`;
|
|
12
14
|
export const Tab = () => {
|
|
13
15
|
return null;
|
|
@@ -137,7 +139,7 @@ export const Tabs = p => {
|
|
|
137
139
|
useIsomorphicLayoutEffect(() => {
|
|
138
140
|
animate(!x.isAnimating);
|
|
139
141
|
}, []);
|
|
140
|
-
|
|
142
|
+
useIsomorphicUpdateLayoutEffect(() => {
|
|
141
143
|
animate();
|
|
142
144
|
}, [activeKey]);
|
|
143
145
|
useResizeEffect(() => {
|
|
@@ -224,23 +226,17 @@ export const Tabs = p => {
|
|
|
224
226
|
return null;
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
display: 'none'
|
|
240
|
-
}
|
|
241
|
-
}, pane.props.children);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return null;
|
|
229
|
+
const active = pane.key === activeKey;
|
|
230
|
+
return React.createElement(ShouldRender, {
|
|
231
|
+
key: pane.key,
|
|
232
|
+
active: active,
|
|
233
|
+
forceRender: pane.props.forceRender,
|
|
234
|
+
destroyOnClose: pane.props.destroyOnClose
|
|
235
|
+
}, React.createElement("div", {
|
|
236
|
+
className: `${classPrefix}-content`,
|
|
237
|
+
style: {
|
|
238
|
+
display: active ? 'block' : 'none'
|
|
239
|
+
}
|
|
240
|
+
}, pane.props.children));
|
|
245
241
|
})));
|
|
246
242
|
};
|
|
@@ -18,7 +18,7 @@ export declare const VirtualInput: React.ForwardRefExoticComponent<{
|
|
|
18
18
|
onFocus?: (() => void) | undefined;
|
|
19
19
|
onBlur?: (() => void) | undefined;
|
|
20
20
|
onClick?: ((e: React.MouseEvent<HTMLDivElement>) => void) | undefined;
|
|
21
|
-
keyboard?: React.ReactElement<NumberKeyboardProps, string |
|
|
21
|
+
keyboard?: React.ReactElement<NumberKeyboardProps, string | React.JSXElementConstructor<any>> | undefined;
|
|
22
22
|
clearable?: boolean | undefined;
|
|
23
23
|
onClear?: (() => void) | undefined;
|
|
24
|
-
} & Pick<InputProps, "value" | "
|
|
24
|
+
} & Pick<InputProps, "value" | "onChange" | "disabled" | "placeholder"> & NativeProps<"--color" | "--font-size" | "--placeholder-color" | "--text-align" | "--disabled-color" | "--caret-width" | "--caret-color"> & React.RefAttributes<VirtualInputRef>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function measureCSSLength(raw: string): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isDev } from './is-dev';
|
|
2
|
+
import { devError } from './dev-log';
|
|
3
|
+
export function measureCSSLength(raw) {
|
|
4
|
+
const withUnit = raw.trim();
|
|
5
|
+
|
|
6
|
+
if (withUnit.endsWith('px')) {
|
|
7
|
+
return parseFloat(withUnit);
|
|
8
|
+
} else if (withUnit.endsWith('rem')) {
|
|
9
|
+
return parseFloat(withUnit) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
10
|
+
} else if (withUnit.endsWith('vw')) {
|
|
11
|
+
return parseFloat(withUnit) * window.innerWidth / 100;
|
|
12
|
+
} else {
|
|
13
|
+
if (isDev) {
|
|
14
|
+
devError('Global', 'You are using a not supported CSS unit. Only `px` `rem` and `vw` are supported.');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -5,4 +5,4 @@ export interface NativeProps<S extends string = never> {
|
|
|
5
5
|
style?: CSSProperties & Partial<Record<S, string>>;
|
|
6
6
|
tabIndex?: number;
|
|
7
7
|
}
|
|
8
|
-
export declare function withNativeProps<P extends NativeProps>(props: P, element: ReactElement): React.ReactElement<any, string |
|
|
8
|
+
export declare function withNativeProps<P extends NativeProps>(props: P, element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
export declare type GetContainer = HTMLElement | (() => HTMLElement) | null;
|
|
3
|
-
export declare function renderToContainer(getContainer: GetContainer, node: ReactElement): ReactElement<any, string |
|
|
3
|
+
export declare function renderToContainer(getContainer: GetContainer, node: ReactElement): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
active: boolean;
|
|
4
|
+
forceRender?: boolean;
|
|
5
|
+
destroyOnClose?: boolean;
|
|
6
|
+
children: ReactElement;
|
|
7
|
+
}
|
|
8
|
+
export declare const ShouldRender: FC<Props>;
|
|
9
|
+
export declare function useShouldRender(active: boolean, forceRender?: boolean, destroyOnClose?: boolean): boolean;
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { useInitialized } from './use-initialized';
|
|
2
|
+
export const ShouldRender = props => {
|
|
3
|
+
const shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose);
|
|
4
|
+
return shouldRender ? props.children : null;
|
|
5
|
+
};
|
|
2
6
|
export function useShouldRender(active, forceRender, destroyOnClose) {
|
|
3
7
|
const initialized = useInitialized(active);
|
|
4
8
|
if (forceRender) return true;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: {} | Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => Pick<import("react").DOMAttributes<EventTarget>, "onClick" | "onChange" | "onPause" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">;
|
|
1
|
+
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: {} | Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react").ReactDOMAttributes;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { createUpdateEffect } from 'ahooks
|
|
2
|
-
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
1
|
+
import { createUpdateEffect, useIsomorphicLayoutEffect } from 'ahooks';
|
|
3
2
|
export const useIsomorphicUpdateLayoutEffect = createUpdateEffect(useIsomorphicLayoutEffect);
|
|
@@ -3,5 +3,5 @@ declare type Options<T> = {
|
|
|
3
3
|
defaultValue: T;
|
|
4
4
|
onChange?: (v: T) => void;
|
|
5
5
|
};
|
|
6
|
-
export declare function usePropsValue<T>(options: Options<T>): readonly [T, (v: T) => void];
|
|
6
|
+
export declare function usePropsValue<T>(options: Options<T>): readonly [T, (this: unknown, v: T) => void];
|
|
7
7
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useSpring } from '@react-spring/web';
|
|
2
2
|
import { useMutationEffect } from './use-mutation-effect';
|
|
3
3
|
import { bound } from './bound';
|
|
4
|
-
import { useIsomorphicLayoutEffect
|
|
4
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
5
|
+
import { useIsomorphicUpdateLayoutEffect } from './use-isomorphic-update-layout-effect';
|
|
5
6
|
export const useTabListScroll = (targetRef, activeIndex) => {
|
|
6
7
|
const [{
|
|
7
8
|
scrollLeft
|
|
@@ -39,7 +40,7 @@ export const useTabListScroll = (targetRef, activeIndex) => {
|
|
|
39
40
|
useIsomorphicLayoutEffect(() => {
|
|
40
41
|
animate(true);
|
|
41
42
|
}, []);
|
|
42
|
-
|
|
43
|
+
useIsomorphicUpdateLayoutEffect(() => {
|
|
43
44
|
animate();
|
|
44
45
|
}, [activeIndex]);
|
|
45
46
|
useMutationEffect(() => {
|
package/es/utils/use-touch.d.ts
CHANGED
package/es/utils/validate.js
CHANGED
|
@@ -6,7 +6,7 @@ export function isObject(val) {
|
|
|
6
6
|
return val !== null && typeof val === 'object';
|
|
7
7
|
}
|
|
8
8
|
export function isPromise(obj) {
|
|
9
|
-
return obj && typeof obj === 'object' && typeof obj.then === 'function';
|
|
9
|
+
return !!obj && typeof obj === 'object' && typeof obj.then === 'function';
|
|
10
10
|
}
|
|
11
11
|
export function isDate(val) {
|
|
12
12
|
return Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN(val.getTime());
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
export declare type PropagationEvent = 'click';
|
|
3
|
-
export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): React.ReactElement<any, string |
|
|
3
|
+
export declare function withStopPropagation(events: PropagationEvent[], element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@react-spring/web": "^9.4.3",
|
|
6
6
|
"@types/resize-observer-browser": "^0.1.7",
|
|
7
7
|
"@use-gesture/react": "^10.2.6",
|
|
8
|
-
"ahooks": "^3.1.
|
|
8
|
+
"ahooks": "^3.1.10",
|
|
9
9
|
"antd-mobile-icons": "^0.2.2",
|
|
10
10
|
"antd-mobile-v5-count": "^1.0.1",
|
|
11
11
|
"classnames": "^2.3.1",
|
|
12
12
|
"dayjs": "^1.10.7",
|
|
13
13
|
"lodash": "^4.17.21",
|
|
14
|
-
"rc-field-form": "^1.
|
|
14
|
+
"rc-field-form": "^1.23.0",
|
|
15
15
|
"rc-tooltip": "^5.1.1",
|
|
16
16
|
"staged-components": "^1.1.2",
|
|
17
|
-
"tslib": "^
|
|
17
|
+
"tslib": "^2.3.1",
|
|
18
18
|
"use-async-memo": "^1.2.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|