antd-mobile 5.17.2 → 5.18.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.js +1127 -1325
- package/2x/bundle/antd-mobile.es.js +1127 -1325
- package/2x/bundle/style.css +9 -0
- package/2x/cjs/components/calendar/calendar.d.ts +2 -2
- package/2x/cjs/components/calendar/index.d.ts +1 -1
- package/2x/cjs/components/form/form-item.js +6 -4
- package/2x/cjs/components/notice-bar/notice-bar.css +9 -0
- package/2x/cjs/components/notice-bar/notice-bar.js +5 -3
- package/2x/cjs/components/rate/rate.js +7 -2
- package/2x/cjs/components/rate/star.js +0 -10
- package/2x/cjs/components/switch/switch.d.ts +2 -1
- package/2x/cjs/components/switch/switch.js +16 -3
- package/2x/cjs/utils/merge-locale.d.ts +1 -1
- package/2x/cjs/utils/merge-locale.js +15 -5
- package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/cjs/utils/use-props-value.js +1 -1
- package/2x/cjs/utils/with-default-props.js +2 -6
- package/2x/es/components/calendar/calendar.d.ts +2 -2
- package/2x/es/components/calendar/index.d.ts +1 -1
- package/2x/es/components/form/form-item.js +5 -4
- package/2x/es/components/notice-bar/notice-bar.css +9 -0
- package/2x/es/components/notice-bar/notice-bar.js +5 -3
- package/2x/es/components/rate/rate.js +7 -2
- package/2x/es/components/rate/star.js +0 -10
- package/2x/es/components/switch/switch.d.ts +2 -1
- package/2x/es/components/switch/switch.js +15 -3
- package/2x/es/utils/merge-locale.d.ts +1 -1
- package/2x/es/utils/merge-locale.js +17 -3
- package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/es/utils/use-props-value.js +1 -1
- package/2x/es/utils/with-default-props.js +2 -4
- package/2x/package.json +4 -4
- package/2x/umd/antd-mobile.js +1 -1
- package/bundle/antd-mobile.cjs.js +1127 -1325
- package/bundle/antd-mobile.es.js +1127 -1325
- package/bundle/style.css +8 -0
- package/cjs/components/calendar/calendar.d.ts +2 -2
- package/cjs/components/calendar/index.d.ts +1 -1
- package/cjs/components/form/form-item.js +6 -4
- package/cjs/components/notice-bar/notice-bar.css +8 -0
- package/cjs/components/notice-bar/notice-bar.js +5 -3
- package/cjs/components/rate/rate.js +7 -2
- package/cjs/components/rate/star.js +0 -10
- package/cjs/components/switch/switch.d.ts +2 -1
- package/cjs/components/switch/switch.js +16 -3
- package/cjs/utils/merge-locale.d.ts +1 -1
- package/cjs/utils/merge-locale.js +15 -5
- package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/cjs/utils/use-props-value.js +1 -1
- package/cjs/utils/with-default-props.js +2 -6
- package/es/components/calendar/calendar.d.ts +2 -2
- package/es/components/calendar/index.d.ts +1 -1
- package/es/components/form/form-item.js +5 -4
- package/es/components/notice-bar/notice-bar.css +8 -0
- package/es/components/notice-bar/notice-bar.js +5 -3
- package/es/components/rate/rate.js +7 -2
- package/es/components/rate/star.js +0 -10
- package/es/components/switch/switch.d.ts +2 -1
- package/es/components/switch/switch.js +15 -3
- package/es/utils/merge-locale.d.ts +1 -1
- package/es/utils/merge-locale.js +17 -3
- package/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/es/utils/use-props-value.js +1 -1
- package/es/utils/with-default-props.js +2 -4
- package/package.json +4 -4
- package/umd/antd-mobile.js +1 -1
package/bundle/style.css
CHANGED
|
@@ -2504,6 +2504,14 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
2504
2504
|
flex-shrink: 0;
|
|
2505
2505
|
margin-left: 12px;
|
|
2506
2506
|
}
|
|
2507
|
+
.adm-notice-bar-close {
|
|
2508
|
+
width: 24px;
|
|
2509
|
+
height: 24px;
|
|
2510
|
+
margin-right: -3px;
|
|
2511
|
+
display: flex;
|
|
2512
|
+
align-items: center;
|
|
2513
|
+
justify-content: center;
|
|
2514
|
+
}
|
|
2507
2515
|
.adm-notice-bar-close-icon {
|
|
2508
2516
|
font-size: var(--adm-font-size-10);
|
|
2509
2517
|
}
|
|
@@ -4,7 +4,7 @@ declare type Page = {
|
|
|
4
4
|
month: number;
|
|
5
5
|
year: number;
|
|
6
6
|
};
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type CalendarRef = {
|
|
8
8
|
jumpTo: (page: Page | ((page: Page) => Page)) => void;
|
|
9
9
|
jumpToToday: () => void;
|
|
10
10
|
};
|
|
@@ -36,5 +36,5 @@ export declare type CalendarProps = {
|
|
|
36
36
|
defaultValue?: [Date, Date] | null;
|
|
37
37
|
onChange?: (val: [Date, Date] | null) => void;
|
|
38
38
|
}) & NativeProps;
|
|
39
|
-
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<
|
|
39
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;
|
|
40
40
|
export {};
|
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
+
var _nativeProps = require("../../utils/native-props");
|
|
15
|
+
|
|
14
16
|
var _rcFieldForm = require("rc-field-form");
|
|
15
17
|
|
|
16
18
|
var _FieldContext = _interopRequireDefault(require("rc-field-form/lib/FieldContext"));
|
|
@@ -114,7 +116,7 @@ const FormItemLayout = props => {
|
|
|
114
116
|
key: `warning-${index}`,
|
|
115
117
|
className: `${classPrefix}-feedback-warning`
|
|
116
118
|
}, warning)))) : null;
|
|
117
|
-
return _react.default.createElement(_list.default.Item, {
|
|
119
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_list.default.Item, {
|
|
118
120
|
style: style,
|
|
119
121
|
title: layout === 'vertical' && labelElement,
|
|
120
122
|
prefix: layout === 'horizontal' && labelElement,
|
|
@@ -132,7 +134,7 @@ const FormItemLayout = props => {
|
|
|
132
134
|
className: (0, _classnames.default)(`${classPrefix}-child`, `${classPrefix}-child-position-${childElementPosition}`)
|
|
133
135
|
}, _react.default.createElement("div", {
|
|
134
136
|
className: (0, _classnames.default)(`${classPrefix}-child-inner`)
|
|
135
|
-
}, children)));
|
|
137
|
+
}, children))));
|
|
136
138
|
};
|
|
137
139
|
|
|
138
140
|
const FormItem = props => {
|
|
@@ -223,7 +225,7 @@ const FormItem = props => {
|
|
|
223
225
|
|
|
224
226
|
return subWarnings;
|
|
225
227
|
}, curWarnings);
|
|
226
|
-
return _react.default.createElement(FormItemLayout, {
|
|
228
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement(FormItemLayout, {
|
|
227
229
|
className: className,
|
|
228
230
|
style: style,
|
|
229
231
|
label: label,
|
|
@@ -244,7 +246,7 @@ const FormItem = props => {
|
|
|
244
246
|
arrow: arrow
|
|
245
247
|
}, _react.default.createElement(_context.NoStyleItemContext.Provider, {
|
|
246
248
|
value: onSubMetaChange
|
|
247
|
-
}, baseChildren));
|
|
249
|
+
}, baseChildren)));
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
const isRenderProps = typeof children === 'function';
|
|
@@ -61,6 +61,14 @@
|
|
|
61
61
|
flex-shrink: 0;
|
|
62
62
|
margin-left: 12px;
|
|
63
63
|
}
|
|
64
|
+
.adm-notice-bar-close {
|
|
65
|
+
width: 24px;
|
|
66
|
+
height: 24px;
|
|
67
|
+
margin-right: -3px;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
64
72
|
.adm-notice-bar-close-icon {
|
|
65
73
|
font-size: var(--adm-font-size-10);
|
|
66
74
|
}
|
|
@@ -103,14 +103,16 @@ const NoticeBar = (0, _react.memo)(p => {
|
|
|
103
103
|
className: `${classPrefix}-content-inner`
|
|
104
104
|
}, props.content)), (props.closeable || props.extra) && _react.default.createElement("span", {
|
|
105
105
|
className: `${classPrefix}-right`
|
|
106
|
-
}, props.extra, props.closeable && _react.default.createElement(
|
|
107
|
-
className: `${classPrefix}-close
|
|
106
|
+
}, props.extra, props.closeable && _react.default.createElement("div", {
|
|
107
|
+
className: `${classPrefix}-close`,
|
|
108
108
|
onClick: () => {
|
|
109
109
|
var _a;
|
|
110
110
|
|
|
111
111
|
setVisible(false);
|
|
112
112
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
113
113
|
}
|
|
114
|
-
}
|
|
114
|
+
}, _react.default.createElement(_antdMobileIcons.CloseOutline, {
|
|
115
|
+
className: `${classPrefix}-close-icon`
|
|
116
|
+
})))));
|
|
115
117
|
});
|
|
116
118
|
exports.NoticeBar = NoticeBar;
|
|
@@ -49,12 +49,17 @@ const Rate = p => {
|
|
|
49
49
|
} else {
|
|
50
50
|
setValue(v);
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
|
+
role: 'radio',
|
|
54
|
+
"aria-checked": value >= v,
|
|
55
|
+
"aria-label": '' + v
|
|
53
56
|
}, props.character);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
57
|
-
className: classPrefix
|
|
60
|
+
className: classPrefix,
|
|
61
|
+
role: 'radiogroup',
|
|
62
|
+
"aria-readonly": props.readOnly
|
|
58
63
|
}, starList.map((_, i) => _react.default.createElement("div", {
|
|
59
64
|
key: i,
|
|
60
65
|
className: (0, _classnames.default)(`${classPrefix}-box`)
|
|
@@ -10,16 +10,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
12
|
const Star = () => {
|
|
13
|
-
// return (
|
|
14
|
-
// <svg height='1em' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'>
|
|
15
|
-
// <title>{'star-fill\u5907\u4EFD 71'}</title>
|
|
16
|
-
// <path
|
|
17
|
-
// d='m24 36-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L42.815 16a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L24 36Z'
|
|
18
|
-
// fill='#E5E5E5'
|
|
19
|
-
// fillRule='evenodd'
|
|
20
|
-
// />
|
|
21
|
-
// </svg>
|
|
22
|
-
// )
|
|
23
13
|
return _react.default.createElement("svg", {
|
|
24
14
|
viewBox: '0 0 42 40',
|
|
25
15
|
height: '1em',
|
|
@@ -5,8 +5,9 @@ export declare type SwitchProps = {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
checked?: boolean;
|
|
7
7
|
defaultChecked?: boolean;
|
|
8
|
+
/** @deprecated use `onChange` instead */
|
|
8
9
|
beforeChange?: (val: boolean) => Promise<void>;
|
|
9
|
-
onChange?: (checked: boolean) => void
|
|
10
|
+
onChange?: (checked: boolean) => void | Promise<void>;
|
|
10
11
|
checkedText?: ReactNode;
|
|
11
12
|
uncheckedText?: ReactNode;
|
|
12
13
|
} & NativeProps<'--checked-color' | '--width' | '--height' | '--border-width'>;
|
|
@@ -21,6 +21,8 @@ var _spinIcon = require("./spin-icon");
|
|
|
21
21
|
|
|
22
22
|
var _configProvider = require("../config-provider");
|
|
23
23
|
|
|
24
|
+
var _validate = require("../../utils/validate");
|
|
25
|
+
|
|
24
26
|
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); }
|
|
25
27
|
|
|
26
28
|
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; }
|
|
@@ -58,14 +60,25 @@ const Switch = p => {
|
|
|
58
60
|
|
|
59
61
|
try {
|
|
60
62
|
yield props.beforeChange(nextChecked);
|
|
61
|
-
setChecked(nextChecked);
|
|
62
63
|
setChanging(false);
|
|
63
64
|
} catch (e) {
|
|
64
65
|
setChanging(false);
|
|
65
66
|
throw e;
|
|
66
67
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const result = setChecked(nextChecked);
|
|
71
|
+
|
|
72
|
+
if ((0, _validate.isPromise)(result)) {
|
|
73
|
+
setChanging(true);
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
yield result;
|
|
77
|
+
setChanging(false);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
setChanging(false);
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
69
82
|
}
|
|
70
83
|
});
|
|
71
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function mergeLocale<T, P>(base: T, patch: P): T;
|
|
1
|
+
export declare function mergeLocale<T extends object, P extends object>(base: T, patch: P): T;
|
|
@@ -5,12 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeLocale = mergeLocale;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function mergeLocale(base, patch) {
|
|
9
|
+
function merge(a, b) {
|
|
10
|
+
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b)) {
|
|
11
|
+
return b !== undefined ? b : a;
|
|
12
|
+
}
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
const result = {};
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
for (const key in a) {
|
|
17
|
+
if (a.hasOwnProperty(key)) {
|
|
18
|
+
result[key] = merge(a[key], b[key]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return merge(base, patch);
|
|
16
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react").ReactDOMAttributes;
|
|
1
|
+
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react/dist/declarations/src/types").ReactDOMAttributes;
|
|
@@ -28,7 +28,7 @@ function usePropsValue(options) {
|
|
|
28
28
|
if (!forceTrigger && nextValue === stateRef.current) return;
|
|
29
29
|
stateRef.current = nextValue;
|
|
30
30
|
update();
|
|
31
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
31
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
32
32
|
});
|
|
33
33
|
return [stateRef.current, setState];
|
|
34
34
|
}
|
|
@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.mergeProps = mergeProps;
|
|
7
7
|
|
|
8
|
-
var _assign = _interopRequireDefault(require("lodash/assign"));
|
|
9
|
-
|
|
10
8
|
var _assignWith = _interopRequireDefault(require("lodash/assignWith"));
|
|
11
9
|
|
|
12
|
-
var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
11
|
|
|
16
12
|
function mergeProps(...items) {
|
|
17
13
|
function customizer(objValue, srcValue) {
|
|
18
|
-
return
|
|
14
|
+
return srcValue === undefined ? objValue : srcValue;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
let ret =
|
|
17
|
+
let ret = Object.assign({}, items[0]);
|
|
22
18
|
|
|
23
19
|
for (let i = 1; i < items.length; i++) {
|
|
24
20
|
ret = (0, _assignWith.default)(ret, items[i], customizer);
|
|
@@ -4,7 +4,7 @@ declare type Page = {
|
|
|
4
4
|
month: number;
|
|
5
5
|
year: number;
|
|
6
6
|
};
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type CalendarRef = {
|
|
8
8
|
jumpTo: (page: Page | ((page: Page) => Page)) => void;
|
|
9
9
|
jumpToToday: () => void;
|
|
10
10
|
};
|
|
@@ -36,5 +36,5 @@ export declare type CalendarProps = {
|
|
|
36
36
|
defaultValue?: [Date, Date] | null;
|
|
37
37
|
onChange?: (val: [Date, Date] | null) => void;
|
|
38
38
|
}) & NativeProps;
|
|
39
|
-
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<
|
|
39
|
+
export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarRef>>;
|
|
40
40
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useContext, useCallback, useState, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
4
5
|
import { Field } from 'rc-field-form';
|
|
5
6
|
import FieldContext from 'rc-field-form/lib/FieldContext';
|
|
6
7
|
import { devWarning } from '../../utils/dev-log';
|
|
@@ -87,7 +88,7 @@ const FormItemLayout = props => {
|
|
|
87
88
|
key: `warning-${index}`,
|
|
88
89
|
className: `${classPrefix}-feedback-warning`
|
|
89
90
|
}, warning)))) : null;
|
|
90
|
-
return React.createElement(List.Item, {
|
|
91
|
+
return withNativeProps(props, React.createElement(List.Item, {
|
|
91
92
|
style: style,
|
|
92
93
|
title: layout === 'vertical' && labelElement,
|
|
93
94
|
prefix: layout === 'horizontal' && labelElement,
|
|
@@ -105,7 +106,7 @@ const FormItemLayout = props => {
|
|
|
105
106
|
className: classNames(`${classPrefix}-child`, `${classPrefix}-child-position-${childElementPosition}`)
|
|
106
107
|
}, React.createElement("div", {
|
|
107
108
|
className: classNames(`${classPrefix}-child-inner`)
|
|
108
|
-
}, children)));
|
|
109
|
+
}, children))));
|
|
109
110
|
};
|
|
110
111
|
|
|
111
112
|
export const FormItem = props => {
|
|
@@ -197,7 +198,7 @@ export const FormItem = props => {
|
|
|
197
198
|
|
|
198
199
|
return subWarnings;
|
|
199
200
|
}, curWarnings);
|
|
200
|
-
return React.createElement(FormItemLayout, {
|
|
201
|
+
return withNativeProps(props, React.createElement(FormItemLayout, {
|
|
201
202
|
className: className,
|
|
202
203
|
style: style,
|
|
203
204
|
label: label,
|
|
@@ -218,7 +219,7 @@ export const FormItem = props => {
|
|
|
218
219
|
arrow: arrow
|
|
219
220
|
}, React.createElement(NoStyleItemContext.Provider, {
|
|
220
221
|
value: onSubMetaChange
|
|
221
|
-
}, baseChildren));
|
|
222
|
+
}, baseChildren)));
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
const isRenderProps = typeof children === 'function';
|
|
@@ -61,6 +61,14 @@
|
|
|
61
61
|
flex-shrink: 0;
|
|
62
62
|
margin-left: 12px;
|
|
63
63
|
}
|
|
64
|
+
.adm-notice-bar-close {
|
|
65
|
+
width: 24px;
|
|
66
|
+
height: 24px;
|
|
67
|
+
margin-right: -3px;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
64
72
|
.adm-notice-bar-close-icon {
|
|
65
73
|
font-size: var(--adm-font-size-10);
|
|
66
74
|
}
|
|
@@ -82,13 +82,15 @@ export const NoticeBar = memo(p => {
|
|
|
82
82
|
className: `${classPrefix}-content-inner`
|
|
83
83
|
}, props.content)), (props.closeable || props.extra) && React.createElement("span", {
|
|
84
84
|
className: `${classPrefix}-right`
|
|
85
|
-
}, props.extra, props.closeable && React.createElement(
|
|
86
|
-
className: `${classPrefix}-close
|
|
85
|
+
}, props.extra, props.closeable && React.createElement("div", {
|
|
86
|
+
className: `${classPrefix}-close`,
|
|
87
87
|
onClick: () => {
|
|
88
88
|
var _a;
|
|
89
89
|
|
|
90
90
|
setVisible(false);
|
|
91
91
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
92
92
|
}
|
|
93
|
-
}
|
|
93
|
+
}, React.createElement(CloseOutline, {
|
|
94
|
+
className: `${classPrefix}-close-icon`
|
|
95
|
+
})))));
|
|
94
96
|
});
|
|
@@ -33,12 +33,17 @@ export const Rate = p => {
|
|
|
33
33
|
} else {
|
|
34
34
|
setValue(v);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
role: 'radio',
|
|
38
|
+
"aria-checked": value >= v,
|
|
39
|
+
"aria-label": '' + v
|
|
37
40
|
}, props.character);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return withNativeProps(props, React.createElement("div", {
|
|
41
|
-
className: classPrefix
|
|
44
|
+
className: classPrefix,
|
|
45
|
+
role: 'radiogroup',
|
|
46
|
+
"aria-readonly": props.readOnly
|
|
42
47
|
}, starList.map((_, i) => React.createElement("div", {
|
|
43
48
|
key: i,
|
|
44
49
|
className: classNames(`${classPrefix}-box`)
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export const Star = () => {
|
|
3
|
-
// return (
|
|
4
|
-
// <svg height='1em' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'>
|
|
5
|
-
// <title>{'star-fill\u5907\u4EFD 71'}</title>
|
|
6
|
-
// <path
|
|
7
|
-
// d='m24 36-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L42.815 16a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L24 36Z'
|
|
8
|
-
// fill='#E5E5E5'
|
|
9
|
-
// fillRule='evenodd'
|
|
10
|
-
// />
|
|
11
|
-
// </svg>
|
|
12
|
-
// )
|
|
13
3
|
return React.createElement("svg", {
|
|
14
4
|
viewBox: '0 0 42 40',
|
|
15
5
|
height: '1em',
|
|
@@ -5,8 +5,9 @@ export declare type SwitchProps = {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
checked?: boolean;
|
|
7
7
|
defaultChecked?: boolean;
|
|
8
|
+
/** @deprecated use `onChange` instead */
|
|
8
9
|
beforeChange?: (val: boolean) => Promise<void>;
|
|
9
|
-
onChange?: (checked: boolean) => void
|
|
10
|
+
onChange?: (checked: boolean) => void | Promise<void>;
|
|
10
11
|
checkedText?: ReactNode;
|
|
11
12
|
uncheckedText?: ReactNode;
|
|
12
13
|
} & NativeProps<'--checked-color' | '--width' | '--height' | '--border-width'>;
|
|
@@ -6,6 +6,7 @@ import { usePropsValue } from '../../utils/use-props-value';
|
|
|
6
6
|
import { mergeProps } from '../../utils/with-default-props';
|
|
7
7
|
import { SpinIcon } from './spin-icon';
|
|
8
8
|
import { useConfig } from '../config-provider';
|
|
9
|
+
import { isPromise } from '../../utils/validate';
|
|
9
10
|
const classPrefix = `adm-switch`;
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
defaultChecked: false
|
|
@@ -36,14 +37,25 @@ export const Switch = p => {
|
|
|
36
37
|
|
|
37
38
|
try {
|
|
38
39
|
yield props.beforeChange(nextChecked);
|
|
39
|
-
setChecked(nextChecked);
|
|
40
40
|
setChanging(false);
|
|
41
41
|
} catch (e) {
|
|
42
42
|
setChanging(false);
|
|
43
43
|
throw e;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const result = setChecked(nextChecked);
|
|
48
|
+
|
|
49
|
+
if (isPromise(result)) {
|
|
50
|
+
setChanging(true);
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
yield result;
|
|
54
|
+
setChanging(false);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
setChanging(false);
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
});
|
|
49
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function mergeLocale<T, P>(base: T, patch: P): T;
|
|
1
|
+
export declare function mergeLocale<T extends object, P extends object>(base: T, patch: P): T;
|
package/es/utils/merge-locale.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
import merge from 'lodash/merge';
|
|
3
1
|
export function mergeLocale(base, patch) {
|
|
4
|
-
|
|
2
|
+
function merge(a, b) {
|
|
3
|
+
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b)) {
|
|
4
|
+
return b !== undefined ? b : a;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const result = {};
|
|
8
|
+
|
|
9
|
+
for (const key in a) {
|
|
10
|
+
if (a.hasOwnProperty(key)) {
|
|
11
|
+
result[key] = merge(a[key], b[key]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return merge(base, patch);
|
|
5
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react").ReactDOMAttributes;
|
|
1
|
+
export declare const useDragAndPinch: <Config extends import("@use-gesture/react").UserGestureConfig = import("@use-gesture/react").UserGestureConfig>(_handlers: Partial<import("@use-gesture/react").NativeHandlers<import("@use-gesture/react").EventTypes> & import("@use-gesture/react").UserHandlers<import("@use-gesture/react").EventTypes>>, _config?: Config | undefined) => Config["target"] extends object ? void : (...args: any[]) => import("@use-gesture/react/dist/declarations/src/types").ReactDOMAttributes;
|
|
@@ -19,7 +19,7 @@ export function usePropsValue(options) {
|
|
|
19
19
|
if (!forceTrigger && nextValue === stateRef.current) return;
|
|
20
20
|
stateRef.current = nextValue;
|
|
21
21
|
update();
|
|
22
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
22
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
23
23
|
});
|
|
24
24
|
return [stateRef.current, setState];
|
|
25
25
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import assign from 'lodash/assign';
|
|
2
1
|
import assignWith from 'lodash/assignWith';
|
|
3
|
-
import isUndefined from 'lodash/isUndefined';
|
|
4
2
|
export function mergeProps(...items) {
|
|
5
3
|
function customizer(objValue, srcValue) {
|
|
6
|
-
return
|
|
4
|
+
return srcValue === undefined ? objValue : srcValue;
|
|
7
5
|
}
|
|
8
6
|
|
|
9
|
-
let ret = assign({}, items[0]);
|
|
7
|
+
let ret = Object.assign({}, items[0]);
|
|
10
8
|
|
|
11
9
|
for (let i = 1; i < items.length; i++) {
|
|
12
10
|
ret = assignWith(ret, items[i], customizer);
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-mobile",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@floating-ui/dom": "^0.5.2",
|
|
6
6
|
"@react-spring/web": "^9.4.5",
|
|
7
|
-
"@use-gesture/react": "10.2.
|
|
8
|
-
"ahooks": "^3.
|
|
7
|
+
"@use-gesture/react": "10.2.16",
|
|
8
|
+
"ahooks": "^3.5.2",
|
|
9
9
|
"antd-mobile-icons": "^0.3.0",
|
|
10
10
|
"antd-mobile-v5-count": "^1.0.1",
|
|
11
11
|
"big.js": "^6.1.1",
|
|
12
12
|
"classnames": "^2.3.1",
|
|
13
13
|
"dayjs": "^1.11.3",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
|
-
"rc-field-form": "~1.
|
|
15
|
+
"rc-field-form": "~1.27.0",
|
|
16
16
|
"react-is": "^17.0.2",
|
|
17
17
|
"staged-components": "^1.1.3",
|
|
18
18
|
"tslib": "^2.4.0",
|