antd-mobile 5.33.2 → 5.34.0
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 +1355 -1611
- package/2x/bundle/antd-mobile.cjs.js +7 -15
- package/2x/bundle/antd-mobile.es.development.js +350 -606
- package/2x/bundle/antd-mobile.es.js +8349 -8537
- package/2x/bundle/antd-mobile.umd.development.js +1355 -1611
- package/2x/bundle/antd-mobile.umd.js +7 -15
- package/2x/bundle/style.css +2 -1
- package/2x/cjs/components/stepper/stepper.js +2 -2
- package/2x/cjs/components/swiper/index.d.ts +3 -2
- package/2x/cjs/components/swiper/swiper.css +2 -1
- package/2x/cjs/components/swiper/swiper.d.ts +18 -4
- package/2x/cjs/components/swiper/swiper.js +98 -53
- package/2x/es/components/stepper/stepper.js +1 -1
- package/2x/es/components/swiper/index.d.ts +3 -2
- package/2x/es/components/swiper/swiper.css +2 -1
- package/2x/es/components/swiper/swiper.d.ts +18 -4
- package/2x/es/components/swiper/swiper.js +98 -53
- package/2x/package.json +2 -2
- package/bundle/antd-mobile.cjs.development.js +1355 -1611
- package/bundle/antd-mobile.cjs.js +7 -15
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +350 -606
- package/bundle/antd-mobile.es.js +8349 -8537
- package/bundle/antd-mobile.umd.development.js +1355 -1611
- package/bundle/antd-mobile.umd.js +7 -15
- package/bundle/style.css +1 -1
- package/cjs/components/stepper/stepper.js +2 -2
- package/cjs/components/swiper/index.d.ts +3 -2
- package/cjs/components/swiper/swiper.css +2 -1
- package/cjs/components/swiper/swiper.d.ts +18 -4
- package/cjs/components/swiper/swiper.js +98 -53
- package/es/components/stepper/stepper.js +1 -1
- package/es/components/swiper/index.d.ts +3 -2
- package/es/components/swiper/swiper.css +2 -1
- package/es/components/swiper/swiper.d.ts +18 -4
- package/es/components/swiper/swiper.js +98 -53
- package/package.json +2 -2
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +0 -9
package/2x/bundle/style.css
CHANGED
|
@@ -8,7 +8,7 @@ exports.Stepper = void 0;
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _antdMobileIcons = require("antd-mobile-icons");
|
|
11
|
-
var
|
|
11
|
+
var _rcUtil = require("rc-util");
|
|
12
12
|
var _miniDecimal = _interopRequireWildcard(require("@rc-component/mini-decimal"));
|
|
13
13
|
var _nativeProps = require("../../utils/native-props");
|
|
14
14
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
@@ -77,7 +77,7 @@ function InnerStepper(p, ref) {
|
|
|
77
77
|
return formatter ? formatter(value) : fixedValue(value);
|
|
78
78
|
};
|
|
79
79
|
// ======================== Value & InputValue ========================
|
|
80
|
-
const [mergedValue, setMergedValue] = (0,
|
|
80
|
+
const [mergedValue, setMergedValue] = (0, _rcUtil.useMergedState)(defaultValue, {
|
|
81
81
|
value,
|
|
82
82
|
onChange: nextValue => {
|
|
83
83
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
@@ -9,13 +9,14 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
9
9
|
direction?: "vertical" | "horizontal" | undefined;
|
|
10
10
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
11
11
|
indicatorProps?: Pick<import("../page-indicator").PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
12
|
-
indicator?: ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
12
|
+
indicator?: false | ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
13
13
|
slideSize?: number | undefined;
|
|
14
14
|
trackOffset?: number | undefined;
|
|
15
15
|
stuckAtBoundary?: boolean | undefined;
|
|
16
16
|
rubberband?: boolean | undefined;
|
|
17
17
|
stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
|
|
18
|
-
|
|
18
|
+
total?: number | undefined;
|
|
19
|
+
children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | ((index: number) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
19
20
|
} & {
|
|
20
21
|
className?: string | undefined;
|
|
21
22
|
style?: (import("react").CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
@@ -22,13 +22,20 @@ export declare type SwiperProps = {
|
|
|
22
22
|
direction?: 'horizontal' | 'vertical';
|
|
23
23
|
onIndexChange?: (index: number) => void;
|
|
24
24
|
indicatorProps?: Pick<PageIndicatorProps, 'color' | 'style' | 'className'>;
|
|
25
|
-
indicator?: (total: number, current: number) => ReactNode;
|
|
25
|
+
indicator?: false | ((total: number, current: number) => ReactNode);
|
|
26
26
|
slideSize?: number;
|
|
27
27
|
trackOffset?: number;
|
|
28
28
|
stuckAtBoundary?: boolean;
|
|
29
29
|
rubberband?: boolean;
|
|
30
30
|
stopPropagation?: PropagationEvent[];
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Virtual scroll usage. Should work with renderProps `children`
|
|
33
|
+
*/
|
|
34
|
+
total?: number;
|
|
35
|
+
/**
|
|
36
|
+
* renderProps is only work when `total` used
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactElement | ReactElement[] | ((index: number) => ReactElement);
|
|
32
39
|
} & NativeProps<'--height' | '--width' | '--border-radius' | '--track-padding'>;
|
|
33
40
|
export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
34
41
|
defaultIndex?: number | undefined;
|
|
@@ -39,13 +46,20 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
39
46
|
direction?: "vertical" | "horizontal" | undefined;
|
|
40
47
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
41
48
|
indicatorProps?: Pick<PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
42
|
-
indicator?: ((total: number, current: number) => ReactNode) | undefined;
|
|
49
|
+
indicator?: false | ((total: number, current: number) => ReactNode) | undefined;
|
|
43
50
|
slideSize?: number | undefined;
|
|
44
51
|
trackOffset?: number | undefined;
|
|
45
52
|
stuckAtBoundary?: boolean | undefined;
|
|
46
53
|
rubberband?: boolean | undefined;
|
|
47
54
|
stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
|
|
48
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Virtual scroll usage. Should work with renderProps `children`
|
|
57
|
+
*/
|
|
58
|
+
total?: number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* renderProps is only work when `total` used
|
|
61
|
+
*/
|
|
62
|
+
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | ((index: number) => ReactElement) | undefined;
|
|
49
63
|
} & {
|
|
50
64
|
className?: string | undefined;
|
|
51
65
|
style?: (React.CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
@@ -43,37 +43,52 @@ const defaultProps = {
|
|
|
43
43
|
let currentUid;
|
|
44
44
|
const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) => {
|
|
45
45
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
46
|
+
const {
|
|
47
|
+
direction,
|
|
48
|
+
total,
|
|
49
|
+
children,
|
|
50
|
+
indicator
|
|
51
|
+
} = props;
|
|
46
52
|
const [uid] = (0, _react.useState)({});
|
|
47
53
|
const timeoutRef = (0, _react.useRef)(null);
|
|
48
|
-
const isVertical =
|
|
54
|
+
const isVertical = direction === 'vertical';
|
|
49
55
|
const slideRatio = props.slideSize / 100;
|
|
50
56
|
const offsetRatio = props.trackOffset / 100;
|
|
51
57
|
const {
|
|
52
58
|
validChildren,
|
|
53
|
-
count
|
|
59
|
+
count,
|
|
60
|
+
renderChildren
|
|
54
61
|
} = (0, _react.useMemo)(() => {
|
|
55
62
|
let count = 0;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
let renderChildren = undefined;
|
|
64
|
+
let validChildren = undefined;
|
|
65
|
+
if (typeof children === 'function') {
|
|
66
|
+
renderChildren = children;
|
|
67
|
+
} else {
|
|
68
|
+
validChildren = _react.default.Children.map(children, child => {
|
|
69
|
+
if (!_react.default.isValidElement(child)) return null;
|
|
70
|
+
if (child.type !== _swiperItem.SwiperItem) {
|
|
71
|
+
(0, _devLog.devWarning)('Swiper', 'The children of `Swiper` must be `Swiper.Item` components.');
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
count++;
|
|
75
|
+
return child;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
65
78
|
return {
|
|
79
|
+
renderChildren,
|
|
66
80
|
validChildren,
|
|
67
81
|
count
|
|
68
82
|
};
|
|
69
|
-
}, [
|
|
70
|
-
|
|
83
|
+
}, [children]);
|
|
84
|
+
const mergedTotal = total !== null && total !== void 0 ? total : count;
|
|
85
|
+
if (mergedTotal === 0 || !validChildren && !renderChildren) {
|
|
71
86
|
(0, _devLog.devWarning)('Swiper', '`Swiper` needs at least one child.');
|
|
72
87
|
return null;
|
|
73
88
|
}
|
|
74
89
|
return () => {
|
|
75
90
|
let loop = props.loop;
|
|
76
|
-
if (slideRatio * (
|
|
91
|
+
if (slideRatio * (mergedTotal - 1) < 1) {
|
|
77
92
|
loop = false;
|
|
78
93
|
}
|
|
79
94
|
const trackRef = (0, _react.useRef)(null);
|
|
@@ -87,7 +102,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
87
102
|
const [dragging, setDragging, draggingRef] = (0, _useRefState.useRefState)(false);
|
|
88
103
|
function boundIndex(current) {
|
|
89
104
|
let min = 0;
|
|
90
|
-
let max =
|
|
105
|
+
let max = mergedTotal - 1;
|
|
91
106
|
if (props.stuckAtBoundary) {
|
|
92
107
|
min += offsetRatio / slideRatio;
|
|
93
108
|
max -= (1 - slideRatio - offsetRatio) / slideRatio;
|
|
@@ -106,7 +121,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
106
121
|
if (draggingRef.current) return;
|
|
107
122
|
if (!loop) return;
|
|
108
123
|
const rawX = position.get();
|
|
109
|
-
const totalWidth = 100 *
|
|
124
|
+
const totalWidth = 100 * mergedTotal;
|
|
110
125
|
const standardPosition = modulus(rawX, totalWidth);
|
|
111
126
|
if (standardPosition === rawX) return;
|
|
112
127
|
api.start({
|
|
@@ -114,7 +129,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
114
129
|
immediate: true
|
|
115
130
|
});
|
|
116
131
|
}
|
|
117
|
-
}), [
|
|
132
|
+
}), [mergedTotal]);
|
|
118
133
|
const dragCancelRef = (0, _react.useRef)(null);
|
|
119
134
|
function forceCancelDrag() {
|
|
120
135
|
var _a;
|
|
@@ -161,7 +176,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
161
176
|
if (loop) return {};
|
|
162
177
|
const slidePixels = getSlidePixels();
|
|
163
178
|
const lowerBound = boundIndex(0) * slidePixels;
|
|
164
|
-
const upperBound = boundIndex(
|
|
179
|
+
const upperBound = boundIndex(mergedTotal - 1) * slidePixels;
|
|
165
180
|
return isVertical ? {
|
|
166
181
|
top: lowerBound,
|
|
167
182
|
bottom: upperBound
|
|
@@ -180,7 +195,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
180
195
|
function swipeTo(index, immediate = false) {
|
|
181
196
|
var _a;
|
|
182
197
|
const roundedIndex = Math.round(index);
|
|
183
|
-
const targetIndex = loop ? modulus(roundedIndex,
|
|
198
|
+
const targetIndex = loop ? modulus(roundedIndex, mergedTotal) : (0, _bound.bound)(roundedIndex, 0, mergedTotal - 1);
|
|
184
199
|
if (targetIndex !== getCurrent()) {
|
|
185
200
|
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, targetIndex);
|
|
186
201
|
}
|
|
@@ -202,7 +217,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
202
217
|
swipePrev
|
|
203
218
|
}));
|
|
204
219
|
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
205
|
-
const maxIndex =
|
|
220
|
+
const maxIndex = mergedTotal - 1;
|
|
206
221
|
if (current > maxIndex) {
|
|
207
222
|
swipeTo(maxIndex, true);
|
|
208
223
|
}
|
|
@@ -223,43 +238,67 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
223
238
|
return () => {
|
|
224
239
|
if (timeoutRef.current) window.clearTimeout(timeoutRef.current);
|
|
225
240
|
};
|
|
226
|
-
}, [autoplay, autoplayInterval, dragging,
|
|
241
|
+
}, [autoplay, autoplayInterval, dragging, mergedTotal]);
|
|
242
|
+
// ============================== Render ==============================
|
|
243
|
+
// Render Item
|
|
244
|
+
function renderItem(index, child) {
|
|
245
|
+
let itemStyle = {};
|
|
246
|
+
if (loop) {
|
|
247
|
+
itemStyle = {
|
|
248
|
+
[isVertical ? 'y' : 'x']: position.to(position => {
|
|
249
|
+
let finalPosition = -position + index * 100;
|
|
250
|
+
const totalWidth = mergedTotal * 100;
|
|
251
|
+
const flagWidth = totalWidth / 2;
|
|
252
|
+
finalPosition = modulus(finalPosition + flagWidth, totalWidth) - flagWidth;
|
|
253
|
+
return `${finalPosition}%`;
|
|
254
|
+
}),
|
|
255
|
+
[isVertical ? 'top' : 'left']: `-${index * 100}%`
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
return _react.default.createElement(_web.animated.div, {
|
|
259
|
+
className: (0, _classnames.default)(`${classPrefix}-slide`, {
|
|
260
|
+
[`${classPrefix}-slide-active`]: current === index
|
|
261
|
+
}),
|
|
262
|
+
style: itemStyle,
|
|
263
|
+
key: index
|
|
264
|
+
}, child);
|
|
265
|
+
}
|
|
266
|
+
function renderItems() {
|
|
267
|
+
if (renderChildren && total) {
|
|
268
|
+
const offsetCount = 2;
|
|
269
|
+
const startIndex = Math.max(current - offsetCount, 0);
|
|
270
|
+
const endIndex = Math.min(current + offsetCount, total - 1);
|
|
271
|
+
const items = [];
|
|
272
|
+
for (let index = startIndex; index <= endIndex; index += 1) {
|
|
273
|
+
items.push(renderItem(index, renderChildren(index)));
|
|
274
|
+
}
|
|
275
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
276
|
+
className: `${classPrefix}-slide-placeholder`,
|
|
277
|
+
style: {
|
|
278
|
+
width: `${startIndex * 100}%`
|
|
279
|
+
}
|
|
280
|
+
}), items);
|
|
281
|
+
}
|
|
282
|
+
return _react.default.Children.map(validChildren, (child, index) => {
|
|
283
|
+
return renderItem(index, child);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
// Render Track Inner
|
|
227
287
|
function renderTrackInner() {
|
|
228
288
|
if (loop) {
|
|
229
289
|
return _react.default.createElement("div", {
|
|
230
290
|
className: `${classPrefix}-track-inner`
|
|
231
|
-
},
|
|
232
|
-
return _react.default.createElement(_web.animated.div, {
|
|
233
|
-
className: (0, _classnames.default)(`${classPrefix}-slide`, {
|
|
234
|
-
[`${classPrefix}-slide-active`]: current === index
|
|
235
|
-
}),
|
|
236
|
-
style: {
|
|
237
|
-
[isVertical ? 'y' : 'x']: position.to(position => {
|
|
238
|
-
let finalPosition = -position + index * 100;
|
|
239
|
-
const totalWidth = count * 100;
|
|
240
|
-
const flagWidth = totalWidth / 2;
|
|
241
|
-
finalPosition = modulus(finalPosition + flagWidth, totalWidth) - flagWidth;
|
|
242
|
-
return `${finalPosition}%`;
|
|
243
|
-
}),
|
|
244
|
-
[isVertical ? 'top' : 'left']: `-${index * 100}%`
|
|
245
|
-
}
|
|
246
|
-
}, child);
|
|
247
|
-
}));
|
|
291
|
+
}, renderItems());
|
|
248
292
|
} else {
|
|
249
293
|
return _react.default.createElement(_web.animated.div, {
|
|
250
294
|
className: `${classPrefix}-track-inner`,
|
|
251
295
|
style: {
|
|
252
296
|
[isVertical ? 'y' : 'x']: position.to(position => `${-position}%`)
|
|
253
297
|
}
|
|
254
|
-
},
|
|
255
|
-
return _react.default.createElement("div", {
|
|
256
|
-
className: (0, _classnames.default)(`${classPrefix}-slide`, {
|
|
257
|
-
[`${classPrefix}-slide-active`]: current === index
|
|
258
|
-
})
|
|
259
|
-
}, child);
|
|
260
|
-
}));
|
|
298
|
+
}, renderItems());
|
|
261
299
|
}
|
|
262
300
|
}
|
|
301
|
+
// Render
|
|
263
302
|
const style = {
|
|
264
303
|
'--slide-size': `${props.slideSize}%`,
|
|
265
304
|
'--track-offset': `${props.trackOffset}%`
|
|
@@ -273,8 +312,20 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
273
312
|
};
|
|
274
313
|
}
|
|
275
314
|
const mergedProps = (0, _withFuncProps.mergeFuncProps)(dragProps, stopPropagationProps);
|
|
315
|
+
let indicatorNode = null;
|
|
316
|
+
if (typeof indicator === 'function') {
|
|
317
|
+
indicatorNode = indicator(mergedTotal, current);
|
|
318
|
+
} else if (indicator !== false) {
|
|
319
|
+
indicatorNode = _react.default.createElement("div", {
|
|
320
|
+
className: `${classPrefix}-indicator`
|
|
321
|
+
}, _react.default.createElement(_pageIndicator.default, Object.assign({}, props.indicatorProps, {
|
|
322
|
+
total: mergedTotal,
|
|
323
|
+
current: current,
|
|
324
|
+
direction: direction
|
|
325
|
+
})));
|
|
326
|
+
}
|
|
276
327
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
277
|
-
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${
|
|
328
|
+
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${direction}`),
|
|
278
329
|
style: style
|
|
279
330
|
}, _react.default.createElement("div", Object.assign({
|
|
280
331
|
ref: trackRef,
|
|
@@ -287,13 +338,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
287
338
|
}
|
|
288
339
|
forceCancelDrag();
|
|
289
340
|
}
|
|
290
|
-
}, mergedProps), renderTrackInner()),
|
|
291
|
-
className: `${classPrefix}-indicator`
|
|
292
|
-
}, _react.default.createElement(_pageIndicator.default, Object.assign({}, props.indicatorProps, {
|
|
293
|
-
total: count,
|
|
294
|
-
current: current,
|
|
295
|
-
direction: props.direction
|
|
296
|
-
}))) : props.indicator(count, current)));
|
|
341
|
+
}, mergedProps), renderTrackInner()), indicatorNode));
|
|
297
342
|
};
|
|
298
343
|
}));
|
|
299
344
|
exports.Swiper = Swiper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { MinusOutline, AddOutline } from 'antd-mobile-icons';
|
|
4
|
-
import useMergedState from 'rc-util
|
|
4
|
+
import { useMergedState } from 'rc-util';
|
|
5
5
|
import getMiniDecimal, { toFixed } from '@rc-component/mini-decimal';
|
|
6
6
|
import { withNativeProps } from '../../utils/native-props';
|
|
7
7
|
import { mergeProps } from '../../utils/with-default-props';
|
|
@@ -9,13 +9,14 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
9
9
|
direction?: "vertical" | "horizontal" | undefined;
|
|
10
10
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
11
11
|
indicatorProps?: Pick<import("../page-indicator").PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
12
|
-
indicator?: ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
12
|
+
indicator?: false | ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
13
13
|
slideSize?: number | undefined;
|
|
14
14
|
trackOffset?: number | undefined;
|
|
15
15
|
stuckAtBoundary?: boolean | undefined;
|
|
16
16
|
rubberband?: boolean | undefined;
|
|
17
17
|
stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
|
|
18
|
-
|
|
18
|
+
total?: number | undefined;
|
|
19
|
+
children?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | ((index: number) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) | undefined;
|
|
19
20
|
} & {
|
|
20
21
|
className?: string | undefined;
|
|
21
22
|
style?: (import("react").CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
@@ -22,13 +22,20 @@ export declare type SwiperProps = {
|
|
|
22
22
|
direction?: 'horizontal' | 'vertical';
|
|
23
23
|
onIndexChange?: (index: number) => void;
|
|
24
24
|
indicatorProps?: Pick<PageIndicatorProps, 'color' | 'style' | 'className'>;
|
|
25
|
-
indicator?: (total: number, current: number) => ReactNode;
|
|
25
|
+
indicator?: false | ((total: number, current: number) => ReactNode);
|
|
26
26
|
slideSize?: number;
|
|
27
27
|
trackOffset?: number;
|
|
28
28
|
stuckAtBoundary?: boolean;
|
|
29
29
|
rubberband?: boolean;
|
|
30
30
|
stopPropagation?: PropagationEvent[];
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Virtual scroll usage. Should work with renderProps `children`
|
|
33
|
+
*/
|
|
34
|
+
total?: number;
|
|
35
|
+
/**
|
|
36
|
+
* renderProps is only work when `total` used
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactElement | ReactElement[] | ((index: number) => ReactElement);
|
|
32
39
|
} & NativeProps<'--height' | '--width' | '--border-radius' | '--track-padding'>;
|
|
33
40
|
export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
34
41
|
defaultIndex?: number | undefined;
|
|
@@ -39,13 +46,20 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
39
46
|
direction?: "vertical" | "horizontal" | undefined;
|
|
40
47
|
onIndexChange?: ((index: number) => void) | undefined;
|
|
41
48
|
indicatorProps?: Pick<PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
42
|
-
indicator?: ((total: number, current: number) => ReactNode) | undefined;
|
|
49
|
+
indicator?: false | ((total: number, current: number) => ReactNode) | undefined;
|
|
43
50
|
slideSize?: number | undefined;
|
|
44
51
|
trackOffset?: number | undefined;
|
|
45
52
|
stuckAtBoundary?: boolean | undefined;
|
|
46
53
|
rubberband?: boolean | undefined;
|
|
47
54
|
stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
|
|
48
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Virtual scroll usage. Should work with renderProps `children`
|
|
57
|
+
*/
|
|
58
|
+
total?: number | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* renderProps is only work when `total` used
|
|
61
|
+
*/
|
|
62
|
+
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | ((index: number) => ReactElement) | undefined;
|
|
49
63
|
} & {
|
|
50
64
|
className?: string | undefined;
|
|
51
65
|
style?: (React.CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|