antd-mobile 5.27.0 → 5.28.1
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/bundle/antd-mobile.cjs.development.js +681 -950
- package/2x/bundle/antd-mobile.cjs.js +9 -9
- package/2x/bundle/antd-mobile.es.development.js +681 -950
- package/2x/bundle/antd-mobile.es.js +5047 -5350
- package/2x/bundle/antd-mobile.umd.development.js +677 -946
- package/2x/bundle/antd-mobile.umd.js +9 -9
- package/2x/bundle/css-vars-patch.css +4 -0
- package/2x/bundle/style.css +0 -1
- package/2x/cjs/components/calendar/calendar.d.ts +1 -0
- package/2x/cjs/components/calendar/calendar.js +1 -1
- package/2x/cjs/components/cascader/cascader.patch.css +3 -0
- package/2x/cjs/components/ellipsis/ellipsis.d.ts +1 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +3 -2
- package/2x/cjs/components/footer/footer.js +3 -3
- package/2x/cjs/components/input/input.js +1 -0
- package/2x/cjs/components/nav-bar/nav-bar.d.ts +2 -2
- package/2x/cjs/components/popup/popup.js +7 -1
- package/2x/cjs/components/steps/steps.css +0 -1
- package/2x/cjs/components/swiper/index.d.ts +1 -0
- package/2x/cjs/components/swiper/swiper.d.ts +9 -0
- package/2x/cjs/components/swiper/swiper.js +24 -5
- package/2x/cjs/components/text-area/text-area.js +4 -1
- package/2x/cjs/global/css-vars-patch.css +4 -0
- package/2x/cjs/locales/base.d.ts +1 -0
- package/2x/cjs/locales/base.js +2 -1
- package/2x/cjs/locales/en-US.d.ts +1 -0
- package/2x/cjs/locales/es-ES.d.ts +1 -0
- package/2x/cjs/locales/fa-IR.d.ts +1 -0
- package/2x/cjs/locales/fr-FR.d.ts +1 -0
- package/2x/cjs/locales/id-ID.d.ts +1 -0
- package/2x/cjs/locales/ja-JP.d.ts +1 -0
- package/2x/cjs/locales/kk-KZ.d.ts +1 -0
- package/2x/cjs/locales/ko-KR.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.js +2 -1
- package/2x/cjs/locales/zh-HK.d.ts +1 -0
- package/2x/cjs/locales/zh-HK.js +2 -1
- package/2x/cjs/locales/zh-TW.d.ts +1 -0
- package/2x/cjs/locales/zh-TW.js +2 -1
- package/2x/cjs/utils/with-func-props.d.ts +5 -0
- package/2x/cjs/utils/with-func-props.js +25 -0
- package/2x/es/components/calendar/calendar.d.ts +1 -0
- package/2x/es/components/calendar/calendar.js +1 -1
- package/2x/es/components/cascader/cascader.patch.css +3 -0
- package/2x/es/components/ellipsis/ellipsis.d.ts +1 -0
- package/2x/es/components/ellipsis/ellipsis.js +3 -2
- package/2x/es/components/footer/footer.js +1 -1
- package/2x/es/components/input/input.js +1 -0
- package/2x/es/components/nav-bar/nav-bar.d.ts +2 -2
- package/2x/es/components/popup/popup.js +7 -1
- package/2x/es/components/steps/steps.css +0 -1
- package/2x/es/components/swiper/index.d.ts +1 -0
- package/2x/es/components/swiper/swiper.d.ts +9 -0
- package/2x/es/components/swiper/swiper.js +24 -5
- package/2x/es/components/text-area/text-area.js +4 -1
- package/2x/es/global/css-vars-patch.css +4 -0
- package/2x/es/locales/base.d.ts +1 -0
- package/2x/es/locales/base.js +2 -1
- package/2x/es/locales/en-US.d.ts +1 -0
- package/2x/es/locales/es-ES.d.ts +1 -0
- package/2x/es/locales/fa-IR.d.ts +1 -0
- package/2x/es/locales/fr-FR.d.ts +1 -0
- package/2x/es/locales/id-ID.d.ts +1 -0
- package/2x/es/locales/ja-JP.d.ts +1 -0
- package/2x/es/locales/kk-KZ.d.ts +1 -0
- package/2x/es/locales/ko-KR.d.ts +1 -0
- package/2x/es/locales/zh-CN.d.ts +1 -0
- package/2x/es/locales/zh-CN.js +2 -1
- package/2x/es/locales/zh-HK.d.ts +1 -0
- package/2x/es/locales/zh-HK.js +2 -1
- package/2x/es/locales/zh-TW.d.ts +1 -0
- package/2x/es/locales/zh-TW.js +2 -1
- package/2x/es/utils/with-func-props.d.ts +5 -0
- package/2x/es/utils/with-func-props.js +19 -0
- package/2x/package.json +2 -2
- package/README.md +1 -1
- package/bundle/antd-mobile.cjs.development.js +681 -950
- package/bundle/antd-mobile.cjs.js +9 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +681 -950
- package/bundle/antd-mobile.es.js +5047 -5350
- package/bundle/antd-mobile.umd.development.js +677 -946
- package/bundle/antd-mobile.umd.js +9 -9
- package/bundle/css-vars-patch.css +3 -0
- package/bundle/style.css +1 -1
- package/cjs/components/calendar/calendar.d.ts +1 -0
- package/cjs/components/calendar/calendar.js +1 -1
- package/cjs/components/cascader/cascader.patch.css +3 -0
- package/cjs/components/ellipsis/ellipsis.d.ts +1 -0
- package/cjs/components/ellipsis/ellipsis.js +3 -2
- package/cjs/components/footer/footer.js +3 -3
- package/cjs/components/input/input.js +1 -0
- package/cjs/components/nav-bar/nav-bar.d.ts +2 -2
- package/cjs/components/popup/popup.js +7 -1
- package/cjs/components/steps/steps.css +0 -1
- package/cjs/components/swiper/index.d.ts +1 -0
- package/cjs/components/swiper/swiper.d.ts +9 -0
- package/cjs/components/swiper/swiper.js +24 -5
- package/cjs/components/text-area/text-area.js +4 -1
- package/cjs/global/css-vars-patch.css +3 -0
- package/cjs/locales/base.d.ts +1 -0
- package/cjs/locales/base.js +2 -1
- package/cjs/locales/en-US.d.ts +1 -0
- package/cjs/locales/es-ES.d.ts +1 -0
- package/cjs/locales/fa-IR.d.ts +1 -0
- package/cjs/locales/fr-FR.d.ts +1 -0
- package/cjs/locales/id-ID.d.ts +1 -0
- package/cjs/locales/ja-JP.d.ts +1 -0
- package/cjs/locales/kk-KZ.d.ts +1 -0
- package/cjs/locales/ko-KR.d.ts +1 -0
- package/cjs/locales/zh-CN.d.ts +1 -0
- package/cjs/locales/zh-CN.js +2 -1
- package/cjs/locales/zh-HK.d.ts +1 -0
- package/cjs/locales/zh-HK.js +2 -1
- package/cjs/locales/zh-TW.d.ts +1 -0
- package/cjs/locales/zh-TW.js +2 -1
- package/cjs/utils/with-func-props.d.ts +5 -0
- package/cjs/utils/with-func-props.js +25 -0
- package/es/components/calendar/calendar.d.ts +1 -0
- package/es/components/calendar/calendar.js +1 -1
- package/es/components/cascader/cascader.patch.css +3 -0
- package/es/components/ellipsis/ellipsis.d.ts +1 -0
- package/es/components/ellipsis/ellipsis.js +3 -2
- package/es/components/footer/footer.js +1 -1
- package/es/components/input/input.js +1 -0
- package/es/components/nav-bar/nav-bar.d.ts +2 -2
- package/es/components/popup/popup.js +7 -1
- package/es/components/steps/steps.css +0 -1
- package/es/components/swiper/index.d.ts +1 -0
- package/es/components/swiper/swiper.d.ts +9 -0
- package/es/components/swiper/swiper.js +24 -5
- package/es/components/text-area/text-area.js +4 -1
- package/es/global/css-vars-patch.css +3 -0
- package/es/locales/base.d.ts +1 -0
- package/es/locales/base.js +2 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/es-ES.d.ts +1 -0
- package/es/locales/fa-IR.d.ts +1 -0
- package/es/locales/fr-FR.d.ts +1 -0
- package/es/locales/id-ID.d.ts +1 -0
- package/es/locales/ja-JP.d.ts +1 -0
- package/es/locales/kk-KZ.d.ts +1 -0
- package/es/locales/ko-KR.d.ts +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-HK.d.ts +1 -0
- package/es/locales/zh-HK.js +2 -1
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +2 -1
- package/es/utils/with-func-props.d.ts +5 -0
- package/es/utils/with-func-props.js +19 -0
- package/package.json +2 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PageIndicatorProps } from '../page-indicator';
|
|
4
|
+
declare const eventToPropRecord: {
|
|
5
|
+
readonly mousedown: "onMouseDown";
|
|
6
|
+
readonly mousemove: "onMouseMove";
|
|
7
|
+
readonly mouseup: "onMouseUp";
|
|
8
|
+
};
|
|
9
|
+
declare type PropagationEvent = keyof typeof eventToPropRecord;
|
|
4
10
|
export declare type SwiperRef = {
|
|
5
11
|
swipeTo: (index: number) => void;
|
|
6
12
|
swipeNext: () => void;
|
|
@@ -20,6 +26,7 @@ export declare type SwiperProps = {
|
|
|
20
26
|
trackOffset?: number;
|
|
21
27
|
stuckAtBoundary?: boolean;
|
|
22
28
|
rubberband?: boolean;
|
|
29
|
+
stopPropagation?: PropagationEvent[];
|
|
23
30
|
children?: ReactElement | ReactElement[];
|
|
24
31
|
} & NativeProps<'--height' | '--width' | '--border-radius' | '--track-padding'>;
|
|
25
32
|
export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
@@ -36,9 +43,11 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
36
43
|
trackOffset?: number | undefined;
|
|
37
44
|
stuckAtBoundary?: boolean | undefined;
|
|
38
45
|
rubberband?: boolean | undefined;
|
|
46
|
+
stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
|
|
39
47
|
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | undefined;
|
|
40
48
|
} & {
|
|
41
49
|
className?: string | undefined;
|
|
42
50
|
style?: (React.CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
43
51
|
tabIndex?: number | undefined;
|
|
44
52
|
} & React.AriaAttributes & React.RefAttributes<SwiperRef>>;
|
|
53
|
+
export {};
|
|
@@ -11,7 +11,13 @@ import { staged } from 'staged-components';
|
|
|
11
11
|
import { useRefState } from '../../utils/use-ref-state';
|
|
12
12
|
import { bound } from '../../utils/bound';
|
|
13
13
|
import { useIsomorphicLayoutEffect, useUpdateEffect } from 'ahooks';
|
|
14
|
+
import { mergeFuncProps } from '../../utils/with-func-props';
|
|
14
15
|
const classPrefix = `adm-swiper`;
|
|
16
|
+
const eventToPropRecord = {
|
|
17
|
+
'mousedown': 'onMouseDown',
|
|
18
|
+
'mousemove': 'onMouseMove',
|
|
19
|
+
'mouseup': 'onMouseUp'
|
|
20
|
+
};
|
|
15
21
|
const defaultProps = {
|
|
16
22
|
defaultIndex: 0,
|
|
17
23
|
allowTouchMove: true,
|
|
@@ -22,7 +28,8 @@ const defaultProps = {
|
|
|
22
28
|
slideSize: 100,
|
|
23
29
|
trackOffset: 0,
|
|
24
30
|
stuckAtBoundary: true,
|
|
25
|
-
rubberband: true
|
|
31
|
+
rubberband: true,
|
|
32
|
+
stopPropagation: []
|
|
26
33
|
};
|
|
27
34
|
let currentUid;
|
|
28
35
|
export const Swiper = forwardRef(staged((p, ref) => {
|
|
@@ -196,11 +203,14 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
196
203
|
} = props;
|
|
197
204
|
useEffect(() => {
|
|
198
205
|
if (!autoplay || dragging) return;
|
|
199
|
-
|
|
206
|
+
let interval;
|
|
207
|
+
function tick() {
|
|
208
|
+
interval = window.setTimeout(tick, autoplayInterval);
|
|
200
209
|
swipeNext();
|
|
201
|
-
}
|
|
210
|
+
}
|
|
211
|
+
interval = window.setTimeout(tick, autoplayInterval);
|
|
202
212
|
return () => {
|
|
203
|
-
window.
|
|
213
|
+
if (interval) window.clearTimeout(interval);
|
|
204
214
|
};
|
|
205
215
|
}, [autoplay, autoplayInterval, dragging, count]);
|
|
206
216
|
function renderTrackInner() {
|
|
@@ -239,6 +249,15 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
239
249
|
'--slide-size': `${props.slideSize}%`,
|
|
240
250
|
'--track-offset': `${props.trackOffset}%`
|
|
241
251
|
};
|
|
252
|
+
const dragProps = Object.assign({}, props.allowTouchMove ? bind() : {});
|
|
253
|
+
const stopPropagationProps = {};
|
|
254
|
+
for (const key of props.stopPropagation) {
|
|
255
|
+
const prop = eventToPropRecord[key];
|
|
256
|
+
stopPropagationProps[prop] = function (e) {
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const mergedProps = mergeFuncProps(dragProps, stopPropagationProps);
|
|
242
261
|
return withNativeProps(props, React.createElement("div", {
|
|
243
262
|
className: classNames(classPrefix, `${classPrefix}-${props.direction}`),
|
|
244
263
|
style: style
|
|
@@ -253,7 +272,7 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
253
272
|
}
|
|
254
273
|
forceCancelDrag();
|
|
255
274
|
}
|
|
256
|
-
},
|
|
275
|
+
}, mergedProps), renderTrackInner()), props.indicator === undefined ? React.createElement("div", {
|
|
257
276
|
className: `${classPrefix}-indicator`
|
|
258
277
|
}, React.createElement(PageIndicator, Object.assign({}, props.indicatorProps, {
|
|
259
278
|
total: count,
|
|
@@ -25,6 +25,8 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
25
25
|
devError('TextArea', '`value` prop on `TextArea` should not be `null`. Consider using an empty string to clear the component.');
|
|
26
26
|
}
|
|
27
27
|
const nativeTextAreaRef = useRef(null);
|
|
28
|
+
// https://github.com/ant-design/ant-design-mobile/issues/5961
|
|
29
|
+
const heightRef = useRef('auto');
|
|
28
30
|
useImperativeHandle(ref, () => ({
|
|
29
31
|
clear: () => {
|
|
30
32
|
setValue('');
|
|
@@ -45,7 +47,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
45
47
|
if (!autoSize) return;
|
|
46
48
|
const textArea = nativeTextAreaRef.current;
|
|
47
49
|
if (!textArea) return;
|
|
48
|
-
textArea.style.height =
|
|
50
|
+
textArea.style.height = heightRef.current;
|
|
49
51
|
let height = textArea.scrollHeight;
|
|
50
52
|
if (typeof autoSize === 'object') {
|
|
51
53
|
const computedStyle = window.getComputedStyle(textArea);
|
|
@@ -57,6 +59,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
57
59
|
height = Math.min(height, autoSize.maxRows * lineHeight);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
62
|
+
heightRef.current = `${height}px`;
|
|
60
63
|
textArea.style.height = `${height}px`;
|
|
61
64
|
}, [value, autoSize]);
|
|
62
65
|
const compositingRef = useRef(false);
|
package/2x/es/locales/base.d.ts
CHANGED
package/2x/es/locales/base.js
CHANGED
package/2x/es/locales/en-US.d.ts
CHANGED
package/2x/es/locales/es-ES.d.ts
CHANGED
package/2x/es/locales/fa-IR.d.ts
CHANGED
package/2x/es/locales/fr-FR.d.ts
CHANGED
package/2x/es/locales/id-ID.d.ts
CHANGED
package/2x/es/locales/ja-JP.d.ts
CHANGED
package/2x/es/locales/kk-KZ.d.ts
CHANGED
package/2x/es/locales/ko-KR.d.ts
CHANGED
package/2x/es/locales/zh-CN.d.ts
CHANGED
package/2x/es/locales/zh-CN.js
CHANGED
package/2x/es/locales/zh-HK.d.ts
CHANGED
package/2x/es/locales/zh-HK.js
CHANGED
package/2x/es/locales/zh-TW.d.ts
CHANGED
package/2x/es/locales/zh-TW.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function mergeFuncProps(p1, p2) {
|
|
2
|
+
const p1Keys = Object.keys(p1);
|
|
3
|
+
const p2Keys = Object.keys(p2);
|
|
4
|
+
const keys = new Set([...p1Keys, ...p2Keys]);
|
|
5
|
+
const res = {};
|
|
6
|
+
keys.forEach(key => {
|
|
7
|
+
const p1Value = p1[key];
|
|
8
|
+
const p2Value = p2[key];
|
|
9
|
+
if (typeof p1Value === 'function' && typeof p2Value === 'function') {
|
|
10
|
+
res[key] = function (...args) {
|
|
11
|
+
p1Value(...args);
|
|
12
|
+
p2Value(...args);
|
|
13
|
+
};
|
|
14
|
+
} else {
|
|
15
|
+
res[key] = p1Value || p2Value;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return res;
|
|
19
|
+
}
|
package/2x/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.28.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@floating-ui/dom": "^1.0.6",
|
|
6
6
|
"@rc-component/mini-decimal": "^1.0.1",
|
|
7
|
-
"@react-spring/web": "
|
|
7
|
+
"@react-spring/web": "~9.6.0",
|
|
8
8
|
"@use-gesture/react": "10.2.20",
|
|
9
9
|
"ahooks": "^3.7.2",
|
|
10
10
|
"antd-mobile-icons": "^0.3.0",
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Essential UI blocks for building mobile web apps.
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
|
-
[](https://www.npmjs.com/package/antd-mobile) [](https://github.com/ant-design/ant-design-mobile/releases) [](https://www.npmjs.com/package/antd-mobile) [](https://www.npmjs.com/package/antd-mobile) [](https://www.jsdelivr.com/package/npm/antd-mobile) [](https://unpkg.com/browse/antd-mobile@5/umd/antd-mobile.js) [](https://github.com/ant-design/ant-design-mobile/graphs/contributors) [](https://github.com/ant-design/ant-design-mobile/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) ](https://img.shields.io/npm/v/antd-mobile)](https://www.npmjs.com/package/antd-mobile) [](https://github.com/ant-design/ant-design-mobile/releases) [](https://www.npmjs.com/package/antd-mobile) [](https://www.npmjs.com/package/antd-mobile) [](https://www.jsdelivr.com/package/npm/antd-mobile) [](https://unpkg.com/browse/antd-mobile@5/umd/antd-mobile.js) [](https://github.com/ant-design/ant-design-mobile/graphs/contributors) [](https://github.com/ant-design/ant-design-mobile/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)  [](https://codecov.io/gh/ant-design/ant-design-mobile) [](https://github.com/ant-design/ant-design-mobile)
|
|
11
11
|
|
|
12
12
|
<h4>
|
|
13
13
|
<a href="https://mobile.ant.design">English Doc</a>
|