antd-mobile 5.42.3 → 5.43.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 +2383 -2054
- package/2x/bundle/antd-mobile.cjs.js +8 -7
- package/2x/bundle/antd-mobile.es.development.js +1545 -1216
- package/2x/bundle/antd-mobile.es.js +9230 -8978
- package/2x/bundle/antd-mobile.umd.development.js +2380 -2051
- package/2x/bundle/antd-mobile.umd.js +8 -7
- package/2x/bundle/style.css +116 -90
- package/2x/cjs/components/cascader/cascader.css +5 -0
- package/2x/cjs/components/cascader/cascader.d.ts +5 -3
- package/2x/cjs/components/cascader/cascader.js +6 -7
- package/2x/cjs/components/cascader/index.d.ts +2 -1
- package/2x/cjs/components/cascader-view/cascader-view.d.ts +8 -2
- package/2x/cjs/components/cascader-view/cascader-view.js +13 -10
- package/2x/cjs/components/cascader-view/index.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-date-utils.js +4 -10
- package/2x/cjs/components/date-picker/date-picker-week-utils.js +4 -4
- package/2x/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/2x/cjs/components/date-picker/index.d.ts +1 -1
- package/2x/cjs/components/dropdown/dropdown.d.ts +6 -0
- package/2x/cjs/components/dropdown/dropdown.js +38 -7
- package/2x/cjs/components/dropdown/index.d.ts +3 -0
- package/2x/cjs/components/error-block/create-error-block.d.ts +3 -4
- package/2x/cjs/components/error-block/create-error-block.js +2 -2
- package/2x/cjs/components/error-block/images/busy.js +94 -89
- package/2x/cjs/components/error-block/images/default.js +170 -165
- package/2x/cjs/components/error-block/images/disconnected.js +127 -122
- package/2x/cjs/components/error-block/images/empty.js +123 -118
- package/2x/cjs/components/error-block/images/index.d.ts +1 -1
- package/2x/cjs/components/error-block/images/index.js +2 -2
- package/2x/cjs/components/floating-panel/floating-panel.d.ts +2 -0
- package/2x/cjs/components/floating-panel/floating-panel.js +7 -3
- package/2x/cjs/components/form/form-item.js +19 -11
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/input/input.d.ts +4 -2
- package/2x/cjs/components/input/input.js +6 -4
- package/2x/cjs/components/list/list-item.js +1 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +2 -1
- package/2x/cjs/components/passcode-input/passcode-input.css +20 -0
- package/2x/cjs/components/passcode-input/passcode-input.d.ts +2 -0
- package/2x/cjs/components/passcode-input/passcode-input.js +6 -3
- package/2x/cjs/components/popover/popover.js +11 -1
- package/2x/cjs/components/popover/use-showing-guard.d.ts +12 -0
- package/2x/cjs/components/popover/use-showing-guard.js +40 -0
- package/2x/cjs/components/search-bar/search-bar.js +4 -5
- package/2x/cjs/components/segmented/segmented.css +1 -0
- package/2x/cjs/components/swipe-action/swipe-action.js +37 -21
- package/2x/cjs/components/swiper/index.d.ts +3 -1
- package/2x/cjs/components/swiper/swiper.d.ts +9 -2
- package/2x/cjs/components/swiper/swiper.js +36 -18
- package/2x/cjs/components/text-area/text-area.d.ts +1 -1
- package/2x/cjs/components/text-area/text-area.js +4 -3
- package/2x/cjs/components/virtual-input/use-click-outside.js +6 -4
- package/2x/cjs/utils/convert-px.js +7 -2
- package/2x/es/components/cascader/cascader.css +5 -0
- package/2x/es/components/cascader/cascader.d.ts +5 -3
- package/2x/es/components/cascader/cascader.js +7 -8
- package/2x/es/components/cascader/index.d.ts +2 -1
- package/2x/es/components/cascader-view/cascader-view.d.ts +8 -2
- package/2x/es/components/cascader-view/cascader-view.js +12 -9
- package/2x/es/components/cascader-view/index.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-date-utils.js +4 -9
- package/2x/es/components/date-picker/date-picker-week-utils.js +4 -4
- package/2x/es/components/date-picker/date-picker.d.ts +1 -1
- package/2x/es/components/date-picker/index.d.ts +1 -1
- package/2x/es/components/dropdown/dropdown.d.ts +6 -0
- package/2x/es/components/dropdown/dropdown.js +39 -8
- package/2x/es/components/dropdown/index.d.ts +3 -0
- package/2x/es/components/error-block/create-error-block.d.ts +3 -4
- package/2x/es/components/error-block/create-error-block.js +2 -2
- package/2x/es/components/error-block/images/busy.js +94 -89
- package/2x/es/components/error-block/images/default.js +170 -165
- package/2x/es/components/error-block/images/disconnected.js +127 -122
- package/2x/es/components/error-block/images/empty.js +123 -118
- package/2x/es/components/error-block/images/index.d.ts +1 -1
- package/2x/es/components/error-block/images/index.js +2 -2
- package/2x/es/components/floating-panel/floating-panel.d.ts +2 -0
- package/2x/es/components/floating-panel/floating-panel.js +7 -3
- package/2x/es/components/form/form-item.js +19 -11
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/input/input.d.ts +4 -2
- package/2x/es/components/input/input.js +6 -4
- package/2x/es/components/list/list-item.js +1 -1
- package/2x/es/components/notice-bar/notice-bar.js +2 -1
- package/2x/es/components/passcode-input/passcode-input.css +20 -0
- package/2x/es/components/passcode-input/passcode-input.d.ts +2 -0
- package/2x/es/components/passcode-input/passcode-input.js +6 -3
- package/2x/es/components/popover/popover.js +11 -1
- package/2x/es/components/popover/use-showing-guard.d.ts +12 -0
- package/2x/es/components/popover/use-showing-guard.js +34 -0
- package/2x/es/components/search-bar/search-bar.js +4 -5
- package/2x/es/components/segmented/segmented.css +1 -0
- package/2x/es/components/swipe-action/swipe-action.js +37 -21
- package/2x/es/components/swiper/index.d.ts +3 -1
- package/2x/es/components/swiper/swiper.d.ts +9 -2
- package/2x/es/components/swiper/swiper.js +35 -19
- package/2x/es/components/text-area/text-area.d.ts +1 -1
- package/2x/es/components/text-area/text-area.js +4 -3
- package/2x/es/components/virtual-input/use-click-outside.js +7 -4
- package/2x/es/utils/convert-px.js +7 -2
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +2383 -2054
- package/bundle/antd-mobile.cjs.js +8 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +1545 -1216
- package/bundle/antd-mobile.es.js +9230 -8978
- package/bundle/antd-mobile.umd.development.js +2380 -2051
- package/bundle/antd-mobile.umd.js +8 -7
- package/bundle/style.css +1 -1
- package/cjs/components/cascader/cascader.css +4 -0
- package/cjs/components/cascader/cascader.d.ts +5 -3
- package/cjs/components/cascader/cascader.js +6 -7
- package/cjs/components/cascader/index.d.ts +2 -1
- package/cjs/components/cascader-view/cascader-view.d.ts +8 -2
- package/cjs/components/cascader-view/cascader-view.js +13 -10
- package/cjs/components/cascader-view/index.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-date-utils.js +4 -10
- package/cjs/components/date-picker/date-picker-week-utils.js +4 -4
- package/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/cjs/components/date-picker/index.d.ts +1 -1
- package/cjs/components/dropdown/dropdown.d.ts +6 -0
- package/cjs/components/dropdown/dropdown.js +38 -7
- package/cjs/components/dropdown/index.d.ts +3 -0
- package/cjs/components/error-block/create-error-block.d.ts +3 -4
- package/cjs/components/error-block/create-error-block.js +2 -2
- package/cjs/components/error-block/images/busy.js +94 -89
- package/cjs/components/error-block/images/default.js +170 -165
- package/cjs/components/error-block/images/disconnected.js +127 -122
- package/cjs/components/error-block/images/empty.js +123 -118
- package/cjs/components/error-block/images/index.d.ts +1 -1
- package/cjs/components/error-block/images/index.js +2 -2
- package/cjs/components/floating-panel/floating-panel.d.ts +2 -0
- package/cjs/components/floating-panel/floating-panel.js +7 -3
- package/cjs/components/form/form-item.js +19 -11
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/input/input.d.ts +4 -2
- package/cjs/components/input/input.js +6 -4
- package/cjs/components/list/list-item.js +1 -1
- package/cjs/components/notice-bar/notice-bar.js +2 -1
- package/cjs/components/passcode-input/passcode-input.css +15 -0
- package/cjs/components/passcode-input/passcode-input.d.ts +2 -0
- package/cjs/components/passcode-input/passcode-input.js +6 -3
- package/cjs/components/popover/popover.js +11 -1
- package/cjs/components/popover/use-showing-guard.d.ts +12 -0
- package/cjs/components/popover/use-showing-guard.js +40 -0
- package/cjs/components/search-bar/search-bar.js +4 -5
- package/cjs/components/segmented/segmented.css +1 -0
- package/cjs/components/swipe-action/swipe-action.js +37 -21
- package/cjs/components/swiper/index.d.ts +3 -1
- package/cjs/components/swiper/swiper.d.ts +9 -2
- package/cjs/components/swiper/swiper.js +36 -18
- package/cjs/components/text-area/text-area.d.ts +1 -1
- package/cjs/components/text-area/text-area.js +4 -3
- package/cjs/components/virtual-input/use-click-outside.js +6 -4
- package/cjs/utils/convert-px.js +7 -2
- package/es/components/cascader/cascader.css +4 -0
- package/es/components/cascader/cascader.d.ts +5 -3
- package/es/components/cascader/cascader.js +7 -8
- package/es/components/cascader/index.d.ts +2 -1
- package/es/components/cascader-view/cascader-view.d.ts +8 -2
- package/es/components/cascader-view/cascader-view.js +12 -9
- package/es/components/cascader-view/index.d.ts +1 -1
- package/es/components/date-picker/date-picker-date-utils.js +4 -9
- package/es/components/date-picker/date-picker-week-utils.js +4 -4
- package/es/components/date-picker/date-picker.d.ts +1 -1
- package/es/components/date-picker/index.d.ts +1 -1
- package/es/components/dropdown/dropdown.d.ts +6 -0
- package/es/components/dropdown/dropdown.js +39 -8
- package/es/components/dropdown/index.d.ts +3 -0
- package/es/components/error-block/create-error-block.d.ts +3 -4
- package/es/components/error-block/create-error-block.js +2 -2
- package/es/components/error-block/images/busy.js +94 -89
- package/es/components/error-block/images/default.js +170 -165
- package/es/components/error-block/images/disconnected.js +127 -122
- package/es/components/error-block/images/empty.js +123 -118
- package/es/components/error-block/images/index.d.ts +1 -1
- package/es/components/error-block/images/index.js +2 -2
- package/es/components/floating-panel/floating-panel.d.ts +2 -0
- package/es/components/floating-panel/floating-panel.js +7 -3
- package/es/components/form/form-item.js +19 -11
- package/es/components/form/index.d.ts +1 -1
- package/es/components/input/input.d.ts +4 -2
- package/es/components/input/input.js +6 -4
- package/es/components/list/list-item.js +1 -1
- package/es/components/notice-bar/notice-bar.js +2 -1
- package/es/components/passcode-input/passcode-input.css +15 -0
- package/es/components/passcode-input/passcode-input.d.ts +2 -0
- package/es/components/passcode-input/passcode-input.js +6 -3
- package/es/components/popover/popover.js +11 -1
- package/es/components/popover/use-showing-guard.d.ts +12 -0
- package/es/components/popover/use-showing-guard.js +34 -0
- package/es/components/search-bar/search-bar.js +4 -5
- package/es/components/segmented/segmented.css +1 -0
- package/es/components/swipe-action/swipe-action.js +37 -21
- package/es/components/swiper/index.d.ts +3 -1
- package/es/components/swiper/swiper.d.ts +9 -2
- package/es/components/swiper/swiper.js +35 -19
- package/es/components/text-area/text-area.d.ts +1 -1
- package/es/components/text-area/text-area.js +4 -3
- package/es/components/virtual-input/use-click-outside.js +7 -4
- package/es/utils/convert-px.js +7 -2
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -19,14 +19,16 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
const classPrefix = 'adm-floating-panel';
|
|
21
21
|
const defaultProps = {
|
|
22
|
-
handleDraggingOfContent: true
|
|
22
|
+
handleDraggingOfContent: true,
|
|
23
|
+
inertiaFactor: 50
|
|
23
24
|
};
|
|
24
25
|
const FloatingPanel = (0, _react2.forwardRef)((p, ref) => {
|
|
25
26
|
var _a, _b;
|
|
26
27
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
27
28
|
const {
|
|
28
29
|
anchors,
|
|
29
|
-
placement = 'bottom'
|
|
30
|
+
placement = 'bottom',
|
|
31
|
+
inertiaFactor
|
|
30
32
|
} = props;
|
|
31
33
|
const maxHeight = (_a = anchors[anchors.length - 1]) !== null && _a !== void 0 ? _a : window.innerHeight;
|
|
32
34
|
const isBottomPlacement = placement !== 'top';
|
|
@@ -86,7 +88,9 @@ const FloatingPanel = (0, _react2.forwardRef)((p, ref) => {
|
|
|
86
88
|
if (state.last) {
|
|
87
89
|
pullingRef.current = false;
|
|
88
90
|
setPulling(false);
|
|
89
|
-
|
|
91
|
+
const [, vy] = state.velocity;
|
|
92
|
+
const [, dy] = state.direction;
|
|
93
|
+
nextY = (0, _nearest.nearest)(possibles, offsetY + dy * vy * (inertiaFactor !== null && inertiaFactor !== void 0 ? inertiaFactor : 0));
|
|
90
94
|
}
|
|
91
95
|
api.start({
|
|
92
96
|
y: nextY
|
|
@@ -23,6 +23,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
const NAME_SPLIT = '__SPLIT__';
|
|
26
|
+
function useChildren(children) {
|
|
27
|
+
if (typeof children === 'function') {
|
|
28
|
+
return children;
|
|
29
|
+
}
|
|
30
|
+
const childList = (0, _utils.toArray)(children);
|
|
31
|
+
return childList.length <= 1 ? childList[0] : childList;
|
|
32
|
+
}
|
|
26
33
|
const classPrefix = `adm-form-item`;
|
|
27
34
|
const MemoInput = _react.default.memo(({
|
|
28
35
|
children
|
|
@@ -147,6 +154,7 @@ const FormItem = props => {
|
|
|
147
154
|
arrowIcon
|
|
148
155
|
} = props,
|
|
149
156
|
fieldProps = (0, _tslib.__rest)(props, ["style", "label", "help", "helpIcon", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow", "arrowIcon"]);
|
|
157
|
+
const mergedChildren = useChildren(children);
|
|
150
158
|
const {
|
|
151
159
|
name: formName
|
|
152
160
|
} = (0, _react.useContext)(_context.FormContext);
|
|
@@ -217,9 +225,9 @@ const FormItem = props => {
|
|
|
217
225
|
value: onSubMetaChange
|
|
218
226
|
}, baseChildren)));
|
|
219
227
|
}
|
|
220
|
-
const isRenderProps = typeof
|
|
228
|
+
const isRenderProps = typeof mergedChildren === 'function';
|
|
221
229
|
if (!name && !isRenderProps && !props.dependencies) {
|
|
222
|
-
return renderLayout(
|
|
230
|
+
return renderLayout(mergedChildren);
|
|
223
231
|
}
|
|
224
232
|
let Variables = {};
|
|
225
233
|
Variables.label = typeof label === 'string' ? label : '';
|
|
@@ -252,7 +260,7 @@ const FormItem = props => {
|
|
|
252
260
|
}
|
|
253
261
|
if (isRenderProps) {
|
|
254
262
|
if ((shouldUpdate || dependencies) && !name) {
|
|
255
|
-
childNode =
|
|
263
|
+
childNode = mergedChildren(context);
|
|
256
264
|
} else {
|
|
257
265
|
if (!(shouldUpdate || dependencies)) {
|
|
258
266
|
(0, _devLog.devWarning)('Form.Item', '`children` of render props only work with `shouldUpdate` or `dependencies`.');
|
|
@@ -264,14 +272,14 @@ const FormItem = props => {
|
|
|
264
272
|
// not render props
|
|
265
273
|
} else if (dependencies && !name) {
|
|
266
274
|
(0, _devLog.devWarning)('Form.Item', 'Must set `name` or use render props when `dependencies` is set.');
|
|
267
|
-
} else if (_react.default.isValidElement(
|
|
268
|
-
if (
|
|
275
|
+
} else if (_react.default.isValidElement(mergedChildren)) {
|
|
276
|
+
if (mergedChildren.props.defaultValue) {
|
|
269
277
|
(0, _devLog.devWarning)('Form.Item', '`defaultValue` will not work on controlled Field. You should use `initialValues` of Form instead.');
|
|
270
278
|
}
|
|
271
|
-
const childProps = Object.assign(Object.assign({},
|
|
272
|
-
if ((0, _utils.isSafeSetRefComponent)(
|
|
279
|
+
const childProps = Object.assign(Object.assign({}, mergedChildren.props), control);
|
|
280
|
+
if ((0, _utils.isSafeSetRefComponent)(mergedChildren)) {
|
|
273
281
|
childProps.ref = instance => {
|
|
274
|
-
const originRef =
|
|
282
|
+
const originRef = mergedChildren.ref;
|
|
275
283
|
if (originRef) {
|
|
276
284
|
if (typeof originRef === 'function') {
|
|
277
285
|
originRef(instance);
|
|
@@ -292,18 +300,18 @@ const FormItem = props => {
|
|
|
292
300
|
childProps[eventName] = (...args) => {
|
|
293
301
|
var _a, _b, _c;
|
|
294
302
|
(_a = control[eventName]) === null || _a === void 0 ? void 0 : _a.call(control, ...args);
|
|
295
|
-
(_c = (_b =
|
|
303
|
+
(_c = (_b = mergedChildren.props)[eventName]) === null || _c === void 0 ? void 0 : _c.call(_b, ...args);
|
|
296
304
|
};
|
|
297
305
|
});
|
|
298
306
|
childNode = _react.default.createElement(MemoInput, {
|
|
299
307
|
value: control[props.valuePropName || 'value'],
|
|
300
308
|
update: updateRef.current
|
|
301
|
-
}, _react.default.cloneElement(
|
|
309
|
+
}, _react.default.cloneElement(mergedChildren, childProps));
|
|
302
310
|
} else {
|
|
303
311
|
if (name) {
|
|
304
312
|
(0, _devLog.devWarning)('Form.Item', '`name` is only used for validate React element. If you are using Form.Item as layout display, please remove `name` instead.');
|
|
305
313
|
}
|
|
306
|
-
childNode =
|
|
314
|
+
childNode = mergedChildren;
|
|
307
315
|
}
|
|
308
316
|
return renderLayout(childNode, fieldId, meta, isRequired);
|
|
309
317
|
});
|
|
@@ -4,7 +4,7 @@ export declare type FormLayout = 'vertical' | 'horizontal';
|
|
|
4
4
|
export type { FormProps, FormInstance } from './form';
|
|
5
5
|
export type { FormItemProps } from './form-item';
|
|
6
6
|
export type { FormSubscribeProps } from './form-subscribe';
|
|
7
|
-
export type { ValidateMessages, FieldData, NamePath, Rule, RuleObject, RuleRender, } from 'rc-field-form/es/interface';
|
|
7
|
+
export type { ValidateMessages, ValidateOptions, FieldData, NamePath, Rule, RuleObject, RuleRender, } from 'rc-field-form/es/interface';
|
|
8
8
|
export type { FormArrayField, FormArrayOperation, FormArrayProps, } from './form-array';
|
|
9
9
|
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "form" | "children" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
10
10
|
className?: string | undefined;
|
|
@@ -4,7 +4,8 @@ declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttribute
|
|
|
4
4
|
declare type AriaProps = {
|
|
5
5
|
role?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'onPaste' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'step' | 'id' | 'placeholder' | 'readOnly' | 'disabled'
|
|
7
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'onPaste' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'step' | 'id' | 'placeholder' | 'readOnly' | 'disabled'> & {
|
|
8
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
8
9
|
value?: string;
|
|
9
10
|
defaultValue?: string;
|
|
10
11
|
onChange?: (val: string) => void;
|
|
@@ -22,7 +23,8 @@ export declare type InputRef = {
|
|
|
22
23
|
blur: () => void;
|
|
23
24
|
nativeElement: HTMLInputElement | null;
|
|
24
25
|
};
|
|
25
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "
|
|
26
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "name" | "type" | "onPaste" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoFocus" | "autoCorrect" | "inputMode" | "autoComplete" | "maxLength" | "minLength" | "placeholder" | "readOnly" | "step"> & {
|
|
27
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
26
28
|
value?: string | undefined;
|
|
27
29
|
defaultValue?: string | undefined;
|
|
28
30
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -76,7 +76,7 @@ const Input = (0, _react.forwardRef)((props, ref) => {
|
|
|
76
76
|
})();
|
|
77
77
|
return (0, _nativeProps.withNativeProps)(mergedProps, _react.default.createElement("div", {
|
|
78
78
|
className: (0, _classnames.default)(`${classPrefix}`, mergedProps.disabled && `${classPrefix}-disabled`)
|
|
79
|
-
}, _react.default.createElement("input", {
|
|
79
|
+
}, _react.default.createElement("input", Object.assign({
|
|
80
80
|
ref: nativeInputRef,
|
|
81
81
|
className: `${classPrefix}-element`,
|
|
82
82
|
value: value,
|
|
@@ -103,8 +103,10 @@ const Input = (0, _react.forwardRef)((props, ref) => {
|
|
|
103
103
|
minLength: mergedProps.minLength,
|
|
104
104
|
max: mergedProps.max,
|
|
105
105
|
min: mergedProps.min,
|
|
106
|
-
autoComplete: mergedProps.autoComplete
|
|
107
|
-
|
|
106
|
+
autoComplete: mergedProps.autoComplete
|
|
107
|
+
}, {
|
|
108
|
+
enterKeyHint: mergedProps.enterKeyHint
|
|
109
|
+
}, {
|
|
108
110
|
autoFocus: mergedProps.autoFocus,
|
|
109
111
|
pattern: mergedProps.pattern,
|
|
110
112
|
inputMode: mergedProps.inputMode,
|
|
@@ -131,7 +133,7 @@ const Input = (0, _react.forwardRef)((props, ref) => {
|
|
|
131
133
|
"aria-valuemax": mergedProps['aria-valuemax'],
|
|
132
134
|
"aria-valuemin": mergedProps['aria-valuemin'],
|
|
133
135
|
"aria-label": mergedProps['aria-label']
|
|
134
|
-
}), shouldShowClear && _react.default.createElement("div", {
|
|
136
|
+
})), shouldShowClear && _react.default.createElement("div", {
|
|
135
137
|
className: `${classPrefix}-clear`,
|
|
136
138
|
onMouseDown: e => {
|
|
137
139
|
e.preventDefault();
|
|
@@ -24,7 +24,7 @@ const ListItem = props => {
|
|
|
24
24
|
} = (0, _configProvider.useConfig)();
|
|
25
25
|
const clickable = (_a = props.clickable) !== null && _a !== void 0 ? _a : !!props.onClick;
|
|
26
26
|
const showArrow = (_b = arrow !== null && arrow !== void 0 ? arrow : arrowIcon) !== null && _b !== void 0 ? _b : clickable;
|
|
27
|
-
const mergedArrowIcon = (0, _withDefaultProps.mergeProp)(componentConfig.arrowIcon, arrow !== true ? arrow :
|
|
27
|
+
const mergedArrowIcon = (0, _withDefaultProps.mergeProp)(componentConfig.arrowIcon, arrow !== true ? arrow : undefined, arrowIcon !== true ? arrowIcon : undefined);
|
|
28
28
|
const content = _react.default.createElement("div", {
|
|
29
29
|
className: `${classPrefix}-content`
|
|
30
30
|
}, (0, _isNodeWithContent.isNodeWithContent)(props.prefix) && _react.default.createElement("div", {
|
|
@@ -102,8 +102,9 @@ const NoticeBar = (0, _react.memo)(props => {
|
|
|
102
102
|
className: `${classPrefix}-right`
|
|
103
103
|
}, mergedProps.extra, mergedProps.closeable && _react.default.createElement("div", {
|
|
104
104
|
className: `${classPrefix}-close`,
|
|
105
|
-
onClick:
|
|
105
|
+
onClick: e => {
|
|
106
106
|
var _a;
|
|
107
|
+
e.stopPropagation();
|
|
107
108
|
setVisible(false);
|
|
108
109
|
(_a = mergedProps.onClose) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
109
110
|
}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
vertical-align: top;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
.adm-passcode-input.adm-passcode-input-rtl .adm-passcode-input-cell-container {
|
|
17
|
+
flex-direction: row-reverse;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
.adm-passcode-input-cell {
|
|
17
21
|
flex: none;
|
|
18
22
|
display: flex;
|
|
@@ -61,6 +65,22 @@
|
|
|
61
65
|
box-shadow: 0 0 4px 0 var(--adm-color-primary);
|
|
62
66
|
}
|
|
63
67
|
|
|
68
|
+
.adm-passcode-input.adm-passcode-input-rtl:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:first-child {
|
|
69
|
+
border-right: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.adm-passcode-input.adm-passcode-input-rtl:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:last-child {
|
|
73
|
+
border-right: 2px solid var(--border-color);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.adm-passcode-input.adm-passcode-input-rtl.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:first-child {
|
|
77
|
+
margin-right: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.adm-passcode-input.adm-passcode-input-rtl.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:last-child {
|
|
81
|
+
margin-right: var(--cell-gap);
|
|
82
|
+
}
|
|
83
|
+
|
|
64
84
|
.adm-passcode-input-seperated.adm-passcode-input-focused {
|
|
65
85
|
outline: none;
|
|
66
86
|
}
|
|
@@ -12,6 +12,7 @@ export declare type PasscodeInputProps = {
|
|
|
12
12
|
seperated?: boolean;
|
|
13
13
|
keyboard?: ReactElement<NumberKeyboardProps>;
|
|
14
14
|
inputMode?: 'numeric' | 'text';
|
|
15
|
+
direction?: 'ltr' | 'rtl';
|
|
15
16
|
onBlur?: () => void;
|
|
16
17
|
onFocus?: () => void;
|
|
17
18
|
onChange?: (val: string) => void;
|
|
@@ -31,6 +32,7 @@ export declare const PasscodeInput: React.ForwardRefExoticComponent<{
|
|
|
31
32
|
seperated?: boolean | undefined;
|
|
32
33
|
keyboard?: ReactElement<NumberKeyboardProps, string | React.JSXElementConstructor<any>> | undefined;
|
|
33
34
|
inputMode?: "text" | "numeric" | undefined;
|
|
35
|
+
direction?: "ltr" | "rtl" | undefined;
|
|
34
36
|
onBlur?: (() => void) | undefined;
|
|
35
37
|
onFocus?: (() => void) | undefined;
|
|
36
38
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -22,7 +22,8 @@ const defaultProps = {
|
|
|
22
22
|
error: false,
|
|
23
23
|
seperated: false,
|
|
24
24
|
caret: true,
|
|
25
|
-
inputMode: 'numeric'
|
|
25
|
+
inputMode: 'numeric',
|
|
26
|
+
direction: 'ltr'
|
|
26
27
|
};
|
|
27
28
|
const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
28
29
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
@@ -79,10 +80,11 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
79
80
|
(_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
80
81
|
}
|
|
81
82
|
}));
|
|
83
|
+
const isRTL = props.direction === 'rtl';
|
|
82
84
|
const renderCells = () => {
|
|
83
85
|
const cells = [];
|
|
84
86
|
const chars = value.split('');
|
|
85
|
-
const caretIndex = chars.length;
|
|
87
|
+
const caretIndex = chars.length;
|
|
86
88
|
const focusedIndex = (0, _bound.bound)(chars.length, 0, cellLength - 1);
|
|
87
89
|
for (let i = 0; i < cellLength; i++) {
|
|
88
90
|
cells.push(_react.default.createElement("div", {
|
|
@@ -99,7 +101,8 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
99
101
|
const cls = (0, _classnames.default)(classPrefix, {
|
|
100
102
|
[`${classPrefix}-focused`]: focused,
|
|
101
103
|
[`${classPrefix}-error`]: props.error,
|
|
102
|
-
[`${classPrefix}-seperated`]: props.seperated
|
|
104
|
+
[`${classPrefix}-seperated`]: props.seperated,
|
|
105
|
+
[`${classPrefix}-rtl`]: isRTL
|
|
103
106
|
});
|
|
104
107
|
return _react.default.createElement(_react.default.Fragment, null, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
105
108
|
ref: rootRef,
|
|
@@ -18,6 +18,7 @@ var _withDefaultProps = require("../../utils/with-default-props");
|
|
|
18
18
|
var _withStopPropagation = require("../../utils/with-stop-propagation");
|
|
19
19
|
var _arrow = require("./arrow");
|
|
20
20
|
var _normalizePlacement = require("./normalize-placement");
|
|
21
|
+
var _useShowingGuard = require("./use-showing-guard");
|
|
21
22
|
var _wrapper = require("./wrapper");
|
|
22
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -38,8 +39,16 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
38
39
|
defaultValue: props.defaultVisible,
|
|
39
40
|
onChange: props.onVisibleChange
|
|
40
41
|
});
|
|
42
|
+
const {
|
|
43
|
+
markShowing,
|
|
44
|
+
isShowing
|
|
45
|
+
} = (0, _useShowingGuard.useShowingGuard)();
|
|
41
46
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
42
|
-
show: () =>
|
|
47
|
+
show: () => {
|
|
48
|
+
// 标记进入 show() 触发链,避免同一次点击事件冒泡到 document 时被 useClickAway 立即关闭
|
|
49
|
+
markShowing();
|
|
50
|
+
setVisible(true);
|
|
51
|
+
},
|
|
43
52
|
hide: () => setVisible(false),
|
|
44
53
|
visible
|
|
45
54
|
}), [visible]);
|
|
@@ -140,6 +149,7 @@ const Popover = (0, _react.forwardRef)((p, ref) => {
|
|
|
140
149
|
}, [targetElement, visible]);
|
|
141
150
|
(0, _ahooks.useClickAway)(() => {
|
|
142
151
|
if (!props.trigger) return;
|
|
152
|
+
if (isShowing()) return; // 跳过 show() 触发链上的 click-away
|
|
143
153
|
setVisible(false);
|
|
144
154
|
}, [() => {
|
|
145
155
|
var _a;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 保证通过 `ref.show()` 打开的 Popover 不会被同一次交互立即关闭。
|
|
3
|
+
*
|
|
4
|
+
* 当外部元素的点击回调调用 `ref.show()` 时,当前点击事件仍会继续冒泡到
|
|
5
|
+
* document,并触发 `useClickAway`。因此需要在当前事件任务结束前保持 guarding
|
|
6
|
+
* 状态,让 click-away 跳过这一次关闭;进入下一个任务后再解除 guarding,保证
|
|
7
|
+
* 后续的外部点击仍能正常关闭 Popover。
|
|
8
|
+
*/
|
|
9
|
+
export declare function useShowingGuard(): {
|
|
10
|
+
markShowing: () => void;
|
|
11
|
+
isShowing: () => boolean;
|
|
12
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useShowingGuard = useShowingGuard;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* 保证通过 `ref.show()` 打开的 Popover 不会被同一次交互立即关闭。
|
|
10
|
+
*
|
|
11
|
+
* 当外部元素的点击回调调用 `ref.show()` 时,当前点击事件仍会继续冒泡到
|
|
12
|
+
* document,并触发 `useClickAway`。因此需要在当前事件任务结束前保持 guarding
|
|
13
|
+
* 状态,让 click-away 跳过这一次关闭;进入下一个任务后再解除 guarding,保证
|
|
14
|
+
* 后续的外部点击仍能正常关闭 Popover。
|
|
15
|
+
*/
|
|
16
|
+
function useShowingGuard() {
|
|
17
|
+
const showingRef = (0, _react.useRef)(false);
|
|
18
|
+
const timerRef = (0, _react.useRef)();
|
|
19
|
+
const markShowing = () => {
|
|
20
|
+
// 使用 ref 而不是 state,确保同一次事件冒泡到 document 时可以同步读取到标记。
|
|
21
|
+
showingRef.current = true;
|
|
22
|
+
// 连续调用 show() 时重置保护窗口,避免旧定时器提前清除最新一次的标记。
|
|
23
|
+
clearTimeout(timerRef.current);
|
|
24
|
+
timerRef.current = setTimeout(() => {
|
|
25
|
+
// 定时器会在当前事件任务完成后执行,此时可以恢复正常的 click-away 行为。
|
|
26
|
+
showingRef.current = false;
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const isShowing = () => showingRef.current;
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
// 组件卸载后不再需要更新 guarding 标记,同时清理未执行的定时器。
|
|
33
|
+
clearTimeout(timerRef.current);
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
return {
|
|
37
|
+
markShowing,
|
|
38
|
+
isShowing
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -36,7 +36,6 @@ const SearchBar = (0, _react.forwardRef)((props, ref) => {
|
|
|
36
36
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(mergedProps);
|
|
37
37
|
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
38
38
|
const inputRef = (0, _react.useRef)(null);
|
|
39
|
-
const composingRef = (0, _react.useRef)(false);
|
|
40
39
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
41
40
|
clear: () => {
|
|
42
41
|
var _a;
|
|
@@ -113,9 +112,11 @@ const SearchBar = (0, _react.forwardRef)((props, ref) => {
|
|
|
113
112
|
onClear: mergedProps.onClear,
|
|
114
113
|
type: 'search',
|
|
115
114
|
enterKeyHint: 'search',
|
|
116
|
-
onEnterPress:
|
|
115
|
+
onEnterPress: e => {
|
|
117
116
|
var _a, _b;
|
|
118
|
-
|
|
117
|
+
// Use nativeEvent.isComposing to check IME composition state
|
|
118
|
+
// This is more reliable than maintaining a manual ref
|
|
119
|
+
if (!e.nativeEvent.isComposing) {
|
|
119
120
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
120
121
|
(_b = mergedProps.onSearch) === null || _b === void 0 ? void 0 : _b.call(mergedProps, value);
|
|
121
122
|
}
|
|
@@ -123,12 +124,10 @@ const SearchBar = (0, _react.forwardRef)((props, ref) => {
|
|
|
123
124
|
"aria-label": locale.SearchBar.name,
|
|
124
125
|
onCompositionStart: e => {
|
|
125
126
|
var _a;
|
|
126
|
-
composingRef.current = true;
|
|
127
127
|
(_a = mergedProps.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
128
128
|
},
|
|
129
129
|
onCompositionEnd: e => {
|
|
130
130
|
var _a;
|
|
131
|
-
composingRef.current = false;
|
|
132
131
|
(_a = mergedProps.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
133
132
|
}
|
|
134
133
|
})), renderCancelButton()));
|
|
@@ -55,6 +55,19 @@ const SwipeAction = (0, _react2.forwardRef)((p, ref) => {
|
|
|
55
55
|
(_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
|
|
56
56
|
draggingRef.current = false;
|
|
57
57
|
}
|
|
58
|
+
function open(side) {
|
|
59
|
+
var _a;
|
|
60
|
+
if (side === 'right') {
|
|
61
|
+
api.start({
|
|
62
|
+
x: -getRightWidth()
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
api.start({
|
|
66
|
+
x: getLeftWidth()
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, side);
|
|
70
|
+
}
|
|
58
71
|
const bind = (0, _react.useDrag)(state => {
|
|
59
72
|
var _a;
|
|
60
73
|
dragCancelRef.current = state.cancel;
|
|
@@ -118,36 +131,33 @@ const SwipeAction = (0, _react2.forwardRef)((p, ref) => {
|
|
|
118
131
|
};
|
|
119
132
|
(0, _react2.useImperativeHandle)(ref, () => ({
|
|
120
133
|
show: (side = 'right') => {
|
|
121
|
-
|
|
122
|
-
if (side === 'right') {
|
|
123
|
-
api.start({
|
|
124
|
-
x: -getRightWidth()
|
|
125
|
-
});
|
|
126
|
-
} else if (side === 'left') {
|
|
127
|
-
api.start({
|
|
128
|
-
x: getLeftWidth()
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, side);
|
|
134
|
+
open(side);
|
|
132
135
|
},
|
|
133
136
|
close
|
|
134
137
|
}));
|
|
135
138
|
(0, _react2.useEffect)(() => {
|
|
136
139
|
if (!props.closeOnTouchOutside) return;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
const root = rootRef.current;
|
|
141
|
+
if (!root) return;
|
|
142
|
+
function onTouchOutside(e) {
|
|
143
|
+
if (x.goal === 0) return;
|
|
144
|
+
if (!(root === null || root === void 0 ? void 0 : root.contains(e.target))) {
|
|
145
|
+
close();
|
|
140
146
|
}
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
}
|
|
148
|
+
function onFocusOutside(e) {
|
|
149
|
+
if (x.goal === 0) return;
|
|
150
|
+
if (!(root === null || root === void 0 ? void 0 : root.contains(e.relatedTarget))) {
|
|
143
151
|
close();
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
|
-
document.addEventListener('touchstart',
|
|
154
|
+
document.addEventListener('touchstart', onTouchOutside);
|
|
155
|
+
root.addEventListener('focusout', onFocusOutside);
|
|
147
156
|
return () => {
|
|
148
|
-
document.removeEventListener('touchstart',
|
|
157
|
+
document.removeEventListener('touchstart', onTouchOutside);
|
|
158
|
+
root.removeEventListener('focusout', onFocusOutside);
|
|
149
159
|
};
|
|
150
|
-
}, [props.closeOnTouchOutside]);
|
|
160
|
+
}, [props.closeOnTouchOutside, props.onClose]);
|
|
151
161
|
function renderAction(action) {
|
|
152
162
|
var _a, _b;
|
|
153
163
|
const color = (_a = action.color) !== null && _a !== void 0 ? _a : 'light';
|
|
@@ -184,7 +194,10 @@ const SwipeAction = (0, _react2.forwardRef)((p, ref) => {
|
|
|
184
194
|
}
|
|
185
195
|
}, (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, _react2.default.createElement("div", {
|
|
186
196
|
className: `${classPrefix}-actions ${classPrefix}-actions-left`,
|
|
187
|
-
ref: leftRef
|
|
197
|
+
ref: leftRef,
|
|
198
|
+
onFocus: () => {
|
|
199
|
+
if (x.goal !== getLeftWidth()) open('left');
|
|
200
|
+
}
|
|
188
201
|
}, props.leftActions.map(renderAction))), _react2.default.createElement("div", {
|
|
189
202
|
className: `${classPrefix}-content`,
|
|
190
203
|
onClickCapture: e => {
|
|
@@ -200,7 +213,10 @@ const SwipeAction = (0, _react2.forwardRef)((p, ref) => {
|
|
|
200
213
|
}
|
|
201
214
|
}, props.children)), (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, _react2.default.createElement("div", {
|
|
202
215
|
className: `${classPrefix}-actions ${classPrefix}-actions-right`,
|
|
203
|
-
ref: rightRef
|
|
216
|
+
ref: rightRef,
|
|
217
|
+
onFocus: () => {
|
|
218
|
+
if (x.goal !== -getRightWidth()) open('right');
|
|
219
|
+
}
|
|
204
220
|
}, props.rightActions.map(renderAction))))));
|
|
205
221
|
});
|
|
206
222
|
exports.SwipeAction = SwipeAction;
|
|
@@ -7,7 +7,9 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
7
7
|
autoplayInterval?: number | undefined;
|
|
8
8
|
loop?: boolean | undefined;
|
|
9
9
|
direction?: "vertical" | "horizontal" | undefined;
|
|
10
|
-
onIndexChange?: ((index: number
|
|
10
|
+
onIndexChange?: ((index: number, info: {
|
|
11
|
+
source: import("./swiper").SwiperIndexChangeSource;
|
|
12
|
+
}) => void) | undefined;
|
|
11
13
|
indicatorProps?: Pick<import("../page-indicator").PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
12
14
|
indicator?: false | ((total: number, current: number) => import("react").ReactNode) | undefined;
|
|
13
15
|
slideSize?: number | undefined;
|
|
@@ -13,6 +13,7 @@ export declare type SwiperRef = {
|
|
|
13
13
|
swipeNext: () => void;
|
|
14
14
|
swipePrev: () => void;
|
|
15
15
|
};
|
|
16
|
+
export declare type SwiperIndexChangeSource = 'auto' | 'swipe' | 'resize';
|
|
16
17
|
export declare type SwiperProps = {
|
|
17
18
|
defaultIndex?: number;
|
|
18
19
|
allowTouchMove?: boolean;
|
|
@@ -20,7 +21,9 @@ export declare type SwiperProps = {
|
|
|
20
21
|
autoplayInterval?: number;
|
|
21
22
|
loop?: boolean;
|
|
22
23
|
direction?: 'horizontal' | 'vertical';
|
|
23
|
-
onIndexChange?: (index: number
|
|
24
|
+
onIndexChange?: (index: number, info: {
|
|
25
|
+
source: SwiperIndexChangeSource;
|
|
26
|
+
}) => void;
|
|
24
27
|
indicatorProps?: Pick<PageIndicatorProps, 'color' | 'style' | 'className'>;
|
|
25
28
|
indicator?: false | ((total: number, current: number) => ReactNode);
|
|
26
29
|
slideSize?: number;
|
|
@@ -44,7 +47,9 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
44
47
|
autoplayInterval?: number | undefined;
|
|
45
48
|
loop?: boolean | undefined;
|
|
46
49
|
direction?: "vertical" | "horizontal" | undefined;
|
|
47
|
-
onIndexChange?: ((index: number
|
|
50
|
+
onIndexChange?: ((index: number, info: {
|
|
51
|
+
source: SwiperIndexChangeSource;
|
|
52
|
+
}) => void) | undefined;
|
|
48
53
|
indicatorProps?: Pick<PageIndicatorProps, "style" | "className" | "color"> | undefined;
|
|
49
54
|
indicator?: false | ((total: number, current: number) => ReactNode) | undefined;
|
|
50
55
|
slideSize?: number | undefined;
|
|
@@ -65,4 +70,6 @@ export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
|
65
70
|
style?: (CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
|
|
66
71
|
tabIndex?: number | undefined;
|
|
67
72
|
} & React.AriaAttributes & React.RefAttributes<SwiperRef>>;
|
|
73
|
+
export declare function modulus(value: number, division: number): number;
|
|
74
|
+
export declare function getSwipeToPosition(current: number, targetIndex: number, total: number): number;
|
|
68
75
|
export {};
|