antd-mobile 5.41.0-alpha.2 → 5.41.0-alpha.4
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/bundle/antd-mobile.cjs.development.js +164 -128
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +164 -128
- package/2x/bundle/antd-mobile.es.js +3988 -3969
- package/2x/bundle/antd-mobile.umd.development.js +164 -128
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/style.css +10 -6
- package/2x/cjs/components/avatar/avatar.d.ts +3 -1
- package/2x/cjs/components/avatar/avatar.js +4 -2
- package/2x/cjs/components/calendar/calendar.js +4 -4
- package/2x/cjs/components/image/image.d.ts +1 -1
- package/2x/cjs/components/image/image.js +5 -5
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +7 -4
- package/2x/cjs/components/image-viewer/index.d.ts +2 -1
- package/2x/cjs/components/image-viewer/methods.js +1 -1
- package/2x/cjs/components/image-viewer/slide.d.ts +3 -2
- package/2x/cjs/components/image-viewer/slide.js +2 -1
- package/2x/cjs/components/image-viewer/slides.d.ts +3 -2
- package/2x/cjs/components/swiper/swiper.d.ts +3 -3
- package/2x/cjs/components/swiper/swiper.js +47 -38
- package/2x/cjs/components/virtual-input/virtual-input.css +10 -6
- package/2x/es/components/avatar/avatar.d.ts +3 -1
- package/2x/es/components/avatar/avatar.js +4 -2
- package/2x/es/components/calendar/calendar.js +4 -4
- package/2x/es/components/image/image.d.ts +1 -1
- package/2x/es/components/image/image.js +6 -6
- package/2x/es/components/image-viewer/image-viewer.d.ts +7 -4
- package/2x/es/components/image-viewer/index.d.ts +2 -1
- package/2x/es/components/image-viewer/methods.js +1 -1
- package/2x/es/components/image-viewer/slide.d.ts +3 -2
- package/2x/es/components/image-viewer/slide.js +2 -1
- package/2x/es/components/image-viewer/slides.d.ts +3 -2
- package/2x/es/components/swiper/swiper.d.ts +3 -3
- package/2x/es/components/swiper/swiper.js +28 -19
- package/2x/es/components/virtual-input/virtual-input.css +10 -6
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +164 -128
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +164 -128
- package/bundle/antd-mobile.es.js +3988 -3969
- package/bundle/antd-mobile.umd.development.js +164 -128
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/style.css +1 -1
- package/cjs/components/avatar/avatar.d.ts +3 -1
- package/cjs/components/avatar/avatar.js +4 -2
- package/cjs/components/calendar/calendar.js +4 -4
- package/cjs/components/image/image.d.ts +1 -1
- package/cjs/components/image/image.js +5 -5
- package/cjs/components/image-viewer/image-viewer.d.ts +7 -4
- package/cjs/components/image-viewer/index.d.ts +2 -1
- package/cjs/components/image-viewer/methods.js +1 -1
- package/cjs/components/image-viewer/slide.d.ts +3 -2
- package/cjs/components/image-viewer/slide.js +2 -1
- package/cjs/components/image-viewer/slides.d.ts +3 -2
- package/cjs/components/swiper/swiper.d.ts +3 -3
- package/cjs/components/swiper/swiper.js +47 -38
- package/cjs/components/virtual-input/virtual-input.css +10 -6
- package/es/components/avatar/avatar.d.ts +3 -1
- package/es/components/avatar/avatar.js +4 -2
- package/es/components/calendar/calendar.js +4 -4
- package/es/components/image/image.d.ts +1 -1
- package/es/components/image/image.js +6 -6
- package/es/components/image-viewer/image-viewer.d.ts +7 -4
- package/es/components/image-viewer/index.d.ts +2 -1
- package/es/components/image-viewer/methods.js +1 -1
- package/es/components/image-viewer/slide.d.ts +3 -2
- package/es/components/image-viewer/slide.js +2 -1
- package/es/components/image-viewer/slides.d.ts +3 -2
- package/es/components/swiper/swiper.d.ts +3 -3
- package/es/components/swiper/swiper.js +28 -19
- package/es/components/virtual-input/virtual-input.css +10 -6
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -8,7 +8,8 @@ declare const _default: import("react").FC<import("./image-viewer").ImageViewerP
|
|
|
8
8
|
defaultIndex?: number | undefined;
|
|
9
9
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
10
10
|
renderFooter?: ((image: string, index: number) => import("react").ReactNode) | undefined;
|
|
11
|
-
imageRender?: ((image: string, { index }: {
|
|
11
|
+
imageRender?: ((image: string, { ref, index }: {
|
|
12
|
+
ref: import("react").RefObject<HTMLImageElement>;
|
|
12
13
|
index: number;
|
|
13
14
|
}) => import("react").ReactNode) | undefined;
|
|
14
15
|
} & import("react").RefAttributes<import("./slides").SlidesRef>> & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ImageViewer, MultiImageViewer } from './image-viewer';
|
|
3
2
|
import { renderImperatively } from '../../utils/render-imperatively';
|
|
3
|
+
import { ImageViewer, MultiImageViewer } from './image-viewer';
|
|
4
4
|
const handlerSet = new Set();
|
|
5
5
|
export function showImageViewer(props) {
|
|
6
6
|
clearImageViewer();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { FC, MutableRefObject, ReactNode } from 'react';
|
|
1
|
+
import type { FC, MutableRefObject, ReactNode, RefObject } from 'react';
|
|
2
2
|
declare type Props = {
|
|
3
3
|
image: string;
|
|
4
4
|
maxZoom: number | 'auto';
|
|
5
5
|
onTap?: () => void;
|
|
6
6
|
onZoomChange?: (zoom: number) => void;
|
|
7
7
|
dragLockRef?: MutableRefObject<boolean>;
|
|
8
|
-
imageRender?: (image: string, { index }: {
|
|
8
|
+
imageRender?: (image: string, { ref, index }: {
|
|
9
|
+
ref: RefObject<HTMLImageElement>;
|
|
9
10
|
index: number;
|
|
10
11
|
}) => ReactNode;
|
|
11
12
|
index?: number;
|
|
@@ -222,7 +222,8 @@ export const Slide = props => {
|
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
const customRendering = typeof imageRender === 'function' && imageRender(props.image, {
|
|
225
|
-
|
|
225
|
+
ref: imgRef,
|
|
226
|
+
index: index !== null && index !== void 0 ? index : 0
|
|
226
227
|
});
|
|
227
228
|
return React.createElement("div", {
|
|
228
229
|
className: `${classPrefix}-slide`
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode, RefObject } from 'react';
|
|
2
2
|
export declare type SlidesType = {
|
|
3
3
|
images: string[];
|
|
4
4
|
onTap?: () => void;
|
|
5
5
|
maxZoom: number;
|
|
6
6
|
defaultIndex: number;
|
|
7
7
|
onIndexChange?: (index: number) => void;
|
|
8
|
-
imageRender?: (image: string, { index }: {
|
|
8
|
+
imageRender?: (image: string, { ref, index }: {
|
|
9
|
+
ref: RefObject<HTMLImageElement>;
|
|
9
10
|
index: number;
|
|
10
11
|
}) => ReactNode;
|
|
11
12
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import type { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import { PageIndicatorProps } from '../page-indicator';
|
|
5
5
|
declare const eventToPropRecord: {
|
|
@@ -59,10 +59,10 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
59
59
|
/**
|
|
60
60
|
* renderProps is only work when `total` used
|
|
61
61
|
*/
|
|
62
|
-
children?:
|
|
62
|
+
children?: ReactElement<any, string | React.JSXElementConstructor<any>> | ReactElement<any, string | React.JSXElementConstructor<any>>[] | ((index: number) => ReactElement) | undefined;
|
|
63
63
|
} & {
|
|
64
64
|
className?: string | undefined;
|
|
65
|
-
style?: (
|
|
65
|
+
style?: (CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
66
66
|
tabIndex?: number | undefined;
|
|
67
67
|
} & React.AriaAttributes & React.RefAttributes<SwiperRef>>;
|
|
68
68
|
export {};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { withNativeProps } from '../../utils/native-props';
|
|
3
|
-
import { mergeProps } from '../../utils/with-default-props';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { SwiperItem } from './swiper-item';
|
|
6
|
-
import { devWarning } from '../../utils/dev-log';
|
|
7
|
-
import { useSpring, animated } from '@react-spring/web';
|
|
1
|
+
import { animated, useSpring } from '@react-spring/web';
|
|
8
2
|
import { useDrag } from '@use-gesture/react';
|
|
9
|
-
import
|
|
3
|
+
import { useGetState, useIsomorphicLayoutEffect } from 'ahooks';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import toArray from 'rc-util/lib/Children/toArray';
|
|
6
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
10
7
|
import { staged } from 'staged-components';
|
|
11
|
-
import { useRefState } from '../../utils/use-ref-state';
|
|
12
8
|
import { bound } from '../../utils/bound';
|
|
13
|
-
import {
|
|
9
|
+
import { devWarning } from '../../utils/dev-log';
|
|
10
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
11
|
+
import { useRefState } from '../../utils/use-ref-state';
|
|
12
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
14
13
|
import { mergeFuncProps } from '../../utils/with-func-props';
|
|
14
|
+
import PageIndicator from '../page-indicator';
|
|
15
|
+
import { SwiperItem } from './swiper-item';
|
|
15
16
|
const classPrefix = `adm-swiper`;
|
|
16
17
|
const eventToPropRecord = {
|
|
17
18
|
'mousedown': 'onMouseDown',
|
|
@@ -56,14 +57,15 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
56
57
|
if (typeof children === 'function') {
|
|
57
58
|
renderChildren = children;
|
|
58
59
|
} else {
|
|
59
|
-
|
|
60
|
+
const childrenArray = toArray(children);
|
|
61
|
+
validChildren = childrenArray.filter(child => {
|
|
60
62
|
if (!React.isValidElement(child)) return null;
|
|
61
63
|
if (child.type !== SwiperItem) {
|
|
62
64
|
devWarning('Swiper', 'The children of `Swiper` must be `Swiper.Item` components.');
|
|
63
|
-
return
|
|
65
|
+
return false;
|
|
64
66
|
}
|
|
65
67
|
count++;
|
|
66
|
-
return
|
|
68
|
+
return true;
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
@@ -236,7 +238,7 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
236
238
|
}, [autoplay, autoplayInterval, dragging, mergedTotal]);
|
|
237
239
|
// ============================== Render ==============================
|
|
238
240
|
// Render Item
|
|
239
|
-
function renderItem(index, child) {
|
|
241
|
+
function renderItem(index, child, key) {
|
|
240
242
|
let itemStyle = {};
|
|
241
243
|
if (loop) {
|
|
242
244
|
itemStyle = {
|
|
@@ -255,10 +257,10 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
255
257
|
[`${classPrefix}-slide-active`]: current === index
|
|
256
258
|
}),
|
|
257
259
|
style: itemStyle,
|
|
258
|
-
key: index
|
|
260
|
+
key: key !== null && key !== void 0 ? key : index
|
|
259
261
|
}, child);
|
|
260
262
|
}
|
|
261
|
-
|
|
263
|
+
const renderStableItems = () => {
|
|
262
264
|
if (renderChildren && total) {
|
|
263
265
|
const offsetCount = 2;
|
|
264
266
|
const startIndex = Math.max(current - offsetCount, 0);
|
|
@@ -274,9 +276,16 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
274
276
|
}
|
|
275
277
|
}), items);
|
|
276
278
|
}
|
|
277
|
-
|
|
278
|
-
return
|
|
279
|
-
|
|
279
|
+
if (validChildren) {
|
|
280
|
+
return validChildren.map((child, index) => {
|
|
281
|
+
var _a;
|
|
282
|
+
return renderItem(index, child, (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : index);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
return null;
|
|
286
|
+
};
|
|
287
|
+
function renderItems() {
|
|
288
|
+
return renderStableItems();
|
|
280
289
|
}
|
|
281
290
|
// Render Track Inner
|
|
282
291
|
function renderTrackInner() {
|
|
@@ -53,19 +53,23 @@
|
|
|
53
53
|
|
|
54
54
|
.adm-virtual-input-caret-container {
|
|
55
55
|
display: inline-block;
|
|
56
|
-
width:
|
|
56
|
+
width: 0;
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0;
|
|
59
|
+
overflow: visible;
|
|
57
60
|
height: 1.3em;
|
|
58
61
|
vertical-align: top;
|
|
59
|
-
|
|
60
|
-
position: absolute;
|
|
62
|
+
position: relative;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
.adm-virtual-input-caret {
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
66
|
+
width: var(--caret-width);
|
|
67
|
+
height: 95%;
|
|
66
68
|
background-color: var(--caret-color);
|
|
67
|
-
position:
|
|
69
|
+
position: absolute;
|
|
68
70
|
top: 5%;
|
|
71
|
+
left: 0;
|
|
72
|
+
z-index: 1;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
.adm-virtual-input:focus {
|
package/2x/package.json
CHANGED