antd-mobile 5.17.2 → 5.20.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 +47 -19174
- package/2x/bundle/antd-mobile.compatible.umd.js +25815 -0
- package/2x/bundle/antd-mobile.es.js +16532 -17127
- package/2x/bundle/antd-mobile.umd.js +64 -0
- package/2x/bundle/style.css +237 -273
- package/2x/cjs/components/action-sheet/action-sheet.d.ts +1 -1
- package/2x/cjs/components/button/button.js +1 -1
- package/2x/cjs/components/calendar/calendar.d.ts +3 -3
- package/2x/cjs/components/calendar/index.d.ts +1 -1
- package/2x/cjs/components/cascader/cascader.d.ts +2 -0
- package/2x/cjs/components/cascader/index.d.ts +1 -0
- package/2x/cjs/components/cascader-view/cascader-view.d.ts +2 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +2 -1
- package/2x/cjs/components/dialog/show.d.ts +1 -1
- package/2x/cjs/components/form/context.d.ts +1 -1
- package/2x/cjs/components/form/form-item.js +9 -4
- package/2x/cjs/components/image/test/image.test.js +57 -8
- package/2x/cjs/components/image-viewer/slide.js +75 -56
- package/2x/cjs/components/input/input.js +9 -2
- package/2x/cjs/components/modal/show.d.ts +1 -1
- 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/number-keyboard/number-keyboard.css +11 -15
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/cjs/components/number-keyboard/number-keyboard.js +19 -17
- package/2x/cjs/components/passcode-input/index.d.ts +1 -1
- package/2x/cjs/components/passcode-input/passcode-input.css +12 -12
- package/2x/cjs/components/passcode-input/passcode-input.js +16 -8
- package/2x/cjs/components/rate/rate.css +1 -0
- package/2x/cjs/components/rate/rate.js +38 -5
- package/2x/cjs/components/rate/star.js +0 -10
- package/2x/cjs/components/result/result.d.ts +1 -1
- package/2x/cjs/components/result/result.js +7 -1
- package/2x/cjs/components/search-bar/search-bar.js +12 -2
- package/2x/cjs/components/swipe-action/swipe-action.d.ts +2 -0
- package/2x/cjs/components/swipe-action/swipe-action.js +34 -6
- package/2x/cjs/components/swiper/swiper.js +14 -0
- package/2x/cjs/components/switch/switch.d.ts +2 -1
- package/2x/cjs/components/switch/switch.js +16 -3
- package/2x/cjs/locales/base.d.ts +9 -0
- package/2x/cjs/locales/base.js +9 -0
- package/2x/cjs/locales/en-US.d.ts +9 -0
- package/2x/cjs/locales/es-ES.d.ts +9 -0
- package/2x/cjs/locales/fa-IR.d.ts +9 -0
- package/2x/cjs/locales/fr-FR.d.ts +9 -0
- package/2x/cjs/locales/id-ID.d.ts +9 -0
- package/2x/cjs/locales/id-ID.js +13 -0
- package/2x/cjs/locales/kk-KZ.d.ts +9 -0
- package/2x/cjs/locales/ko-KR.d.ts +9 -0
- package/2x/cjs/locales/zh-CN.d.ts +9 -0
- package/2x/cjs/locales/zh-CN.js +9 -0
- package/2x/cjs/locales/zh-HK.d.ts +9 -0
- package/2x/cjs/locales/zh-TW.d.ts +9 -0
- package/2x/cjs/utils/matrix.d.ts +10 -0
- package/2x/cjs/utils/matrix.js +60 -0
- 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/use-resize-effect.js +3 -1
- package/2x/cjs/utils/with-default-props.js +2 -6
- package/2x/es/components/action-sheet/action-sheet.d.ts +1 -1
- package/2x/es/components/button/button.js +1 -1
- package/2x/es/components/calendar/calendar.d.ts +3 -3
- package/2x/es/components/calendar/index.d.ts +1 -1
- package/2x/es/components/cascader/cascader.d.ts +2 -0
- package/2x/es/components/cascader/index.d.ts +1 -0
- package/2x/es/components/cascader-view/cascader-view.d.ts +2 -1
- package/2x/es/components/cascader-view/cascader-view.js +2 -1
- package/2x/es/components/dialog/show.d.ts +1 -1
- package/2x/es/components/form/context.d.ts +1 -1
- package/2x/es/components/form/form-item.js +8 -4
- package/2x/es/components/image/test/image.test.js +54 -8
- package/2x/es/components/image-viewer/slide.js +73 -56
- package/2x/es/components/input/input.js +8 -2
- package/2x/es/components/modal/show.d.ts +1 -1
- 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/number-keyboard/number-keyboard.css +11 -15
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +19 -17
- package/2x/es/components/passcode-input/index.d.ts +1 -1
- package/2x/es/components/passcode-input/passcode-input.css +12 -12
- package/2x/es/components/passcode-input/passcode-input.js +15 -8
- package/2x/es/components/rate/rate.css +1 -0
- package/2x/es/components/rate/rate.js +32 -5
- package/2x/es/components/rate/star.js +0 -10
- package/2x/es/components/result/result.d.ts +1 -1
- package/2x/es/components/result/result.js +6 -1
- package/2x/es/components/search-bar/search-bar.js +12 -2
- package/2x/es/components/swipe-action/swipe-action.d.ts +2 -0
- package/2x/es/components/swipe-action/swipe-action.js +34 -6
- package/2x/es/components/swiper/swiper.js +14 -0
- package/2x/es/components/switch/switch.d.ts +2 -1
- package/2x/es/components/switch/switch.js +15 -3
- package/2x/es/locales/base.d.ts +9 -0
- package/2x/es/locales/base.js +9 -0
- package/2x/es/locales/en-US.d.ts +9 -0
- package/2x/es/locales/es-ES.d.ts +9 -0
- package/2x/es/locales/fa-IR.d.ts +9 -0
- package/2x/es/locales/fr-FR.d.ts +9 -0
- package/2x/es/locales/id-ID.d.ts +9 -0
- package/2x/es/locales/id-ID.js +13 -0
- package/2x/es/locales/kk-KZ.d.ts +9 -0
- package/2x/es/locales/ko-KR.d.ts +9 -0
- package/2x/es/locales/zh-CN.d.ts +9 -0
- package/2x/es/locales/zh-CN.js +9 -0
- package/2x/es/locales/zh-HK.d.ts +9 -0
- package/2x/es/locales/zh-TW.d.ts +9 -0
- package/2x/es/utils/matrix.d.ts +10 -0
- package/2x/es/utils/matrix.js +27 -0
- 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/use-resize-effect.js +3 -1
- package/2x/es/utils/with-default-props.js +2 -4
- package/2x/package.json +6 -6
- package/2x/umd/antd-mobile.js +25815 -2
- package/bundle/antd-mobile.cjs.js +47 -19174
- package/bundle/antd-mobile.compatible.umd.js +25815 -0
- package/bundle/antd-mobile.es.js +16532 -17127
- package/bundle/antd-mobile.umd.js +64 -0
- package/bundle/style.css +1 -4080
- package/cjs/components/action-sheet/action-sheet.d.ts +1 -1
- package/cjs/components/button/button.js +1 -1
- package/cjs/components/calendar/calendar.d.ts +3 -3
- package/cjs/components/calendar/index.d.ts +1 -1
- package/cjs/components/cascader/cascader.d.ts +2 -0
- package/cjs/components/cascader/index.d.ts +1 -0
- package/cjs/components/cascader-view/cascader-view.d.ts +2 -1
- package/cjs/components/cascader-view/cascader-view.js +2 -1
- package/cjs/components/dialog/show.d.ts +1 -1
- package/cjs/components/form/context.d.ts +1 -1
- package/cjs/components/form/form-item.js +9 -4
- package/cjs/components/image/test/image.test.js +57 -8
- package/cjs/components/image-viewer/slide.js +75 -56
- package/cjs/components/input/input.js +9 -2
- package/cjs/components/modal/show.d.ts +1 -1
- package/cjs/components/notice-bar/notice-bar.css +8 -0
- package/cjs/components/notice-bar/notice-bar.js +5 -3
- package/cjs/components/number-keyboard/number-keyboard.css +11 -14
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/cjs/components/number-keyboard/number-keyboard.js +19 -17
- package/cjs/components/passcode-input/index.d.ts +1 -1
- package/cjs/components/passcode-input/passcode-input.css +12 -12
- package/cjs/components/passcode-input/passcode-input.js +16 -8
- package/cjs/components/rate/rate.css +1 -0
- package/cjs/components/rate/rate.js +38 -5
- package/cjs/components/rate/star.js +0 -10
- package/cjs/components/result/result.d.ts +1 -1
- package/cjs/components/result/result.js +7 -1
- package/cjs/components/search-bar/search-bar.js +12 -2
- package/cjs/components/swipe-action/swipe-action.d.ts +2 -0
- package/cjs/components/swipe-action/swipe-action.js +34 -6
- package/cjs/components/swiper/swiper.js +14 -0
- package/cjs/components/switch/switch.d.ts +2 -1
- package/cjs/components/switch/switch.js +16 -3
- package/cjs/locales/base.d.ts +9 -0
- package/cjs/locales/base.js +9 -0
- package/cjs/locales/en-US.d.ts +9 -0
- package/cjs/locales/es-ES.d.ts +9 -0
- package/cjs/locales/fa-IR.d.ts +9 -0
- package/cjs/locales/fr-FR.d.ts +9 -0
- package/cjs/locales/id-ID.d.ts +9 -0
- package/cjs/locales/id-ID.js +13 -0
- package/cjs/locales/kk-KZ.d.ts +9 -0
- package/cjs/locales/ko-KR.d.ts +9 -0
- package/cjs/locales/zh-CN.d.ts +9 -0
- package/cjs/locales/zh-CN.js +9 -0
- package/cjs/locales/zh-HK.d.ts +9 -0
- package/cjs/locales/zh-TW.d.ts +9 -0
- package/cjs/utils/matrix.d.ts +10 -0
- package/cjs/utils/matrix.js +60 -0
- 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/use-resize-effect.js +3 -1
- package/cjs/utils/with-default-props.js +2 -6
- package/es/components/action-sheet/action-sheet.d.ts +1 -1
- package/es/components/button/button.js +1 -1
- package/es/components/calendar/calendar.d.ts +3 -3
- package/es/components/calendar/index.d.ts +1 -1
- package/es/components/cascader/cascader.d.ts +2 -0
- package/es/components/cascader/index.d.ts +1 -0
- package/es/components/cascader-view/cascader-view.d.ts +2 -1
- package/es/components/cascader-view/cascader-view.js +2 -1
- package/es/components/dialog/show.d.ts +1 -1
- package/es/components/form/context.d.ts +1 -1
- package/es/components/form/form-item.js +8 -4
- package/es/components/image/test/image.test.js +54 -8
- package/es/components/image-viewer/slide.js +73 -56
- package/es/components/input/input.js +8 -2
- package/es/components/modal/show.d.ts +1 -1
- package/es/components/notice-bar/notice-bar.css +8 -0
- package/es/components/notice-bar/notice-bar.js +5 -3
- package/es/components/number-keyboard/number-keyboard.css +11 -14
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/es/components/number-keyboard/number-keyboard.js +19 -17
- package/es/components/passcode-input/index.d.ts +1 -1
- package/es/components/passcode-input/passcode-input.css +12 -12
- package/es/components/passcode-input/passcode-input.js +15 -8
- package/es/components/rate/rate.css +1 -0
- package/es/components/rate/rate.js +32 -5
- package/es/components/rate/star.js +0 -10
- package/es/components/result/result.d.ts +1 -1
- package/es/components/result/result.js +6 -1
- package/es/components/search-bar/search-bar.js +12 -2
- package/es/components/swipe-action/swipe-action.d.ts +2 -0
- package/es/components/swipe-action/swipe-action.js +34 -6
- package/es/components/swiper/swiper.js +14 -0
- package/es/components/switch/switch.d.ts +2 -1
- package/es/components/switch/switch.js +15 -3
- package/es/locales/base.d.ts +9 -0
- package/es/locales/base.js +9 -0
- package/es/locales/en-US.d.ts +9 -0
- package/es/locales/es-ES.d.ts +9 -0
- package/es/locales/fa-IR.d.ts +9 -0
- package/es/locales/fr-FR.d.ts +9 -0
- package/es/locales/id-ID.d.ts +9 -0
- package/es/locales/id-ID.js +13 -0
- package/es/locales/kk-KZ.d.ts +9 -0
- package/es/locales/ko-KR.d.ts +9 -0
- package/es/locales/zh-CN.d.ts +9 -0
- package/es/locales/zh-CN.js +9 -0
- package/es/locales/zh-HK.d.ts +9 -0
- package/es/locales/zh-TW.d.ts +9 -0
- package/es/utils/matrix.d.ts +10 -0
- package/es/utils/matrix.js +27 -0
- 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/use-resize-effect.js +3 -1
- package/es/utils/with-default-props.js +2 -4
- package/package.json +6 -6
- package/umd/antd-mobile.js +1 -1
- package/2x/umd/antd-mobile.js.LICENSE.txt +0 -35
|
@@ -57,13 +57,18 @@ const NumberKeyboard = p => {
|
|
|
57
57
|
const keys = (0, _react.useMemo)(() => {
|
|
58
58
|
const defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
59
59
|
const keyList = randomOrder ? (0, _shuffle.shuffle)(defaultKeys) : defaultKeys;
|
|
60
|
+
const customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
60
61
|
keyList.push('0');
|
|
61
62
|
|
|
62
63
|
if (confirmText) {
|
|
63
|
-
|
|
64
|
+
if (customKeys.length === 2) {
|
|
65
|
+
keyList.splice(9, 0, customKeys.pop());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
keyList.push(customKeys[0] || '');
|
|
64
69
|
} else {
|
|
65
|
-
keyList.splice(9, 0,
|
|
66
|
-
keyList.push('BACKSPACE');
|
|
70
|
+
keyList.splice(9, 0, customKeys[0] || '');
|
|
71
|
+
keyList.push(customKeys[1] || 'BACKSPACE');
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
return keyList;
|
|
@@ -86,8 +91,7 @@ const NumberKeyboard = p => {
|
|
|
86
91
|
const onBackspacePressEnd = () => {
|
|
87
92
|
clearTimeout(timeoutRef.current);
|
|
88
93
|
clearInterval(intervalRef.current);
|
|
89
|
-
};
|
|
90
|
-
|
|
94
|
+
};
|
|
91
95
|
|
|
92
96
|
const onKeyPress = (e, key) => {
|
|
93
97
|
var _a, _b;
|
|
@@ -109,18 +113,17 @@ const NumberKeyboard = p => {
|
|
|
109
113
|
break;
|
|
110
114
|
|
|
111
115
|
default:
|
|
112
|
-
//
|
|
116
|
+
// onInput should't be called when customKey doesn't exist
|
|
113
117
|
if (key !== '') onInput === null || onInput === void 0 ? void 0 : onInput(key);
|
|
114
118
|
break;
|
|
115
119
|
}
|
|
116
|
-
};
|
|
117
|
-
|
|
120
|
+
};
|
|
118
121
|
|
|
119
122
|
const renderHeader = () => {
|
|
120
123
|
if (!showCloseButton && !title) return null;
|
|
121
124
|
return _react.default.createElement("div", {
|
|
122
125
|
className: (0, _classnames.default)(`${classPrefix}-header`, {
|
|
123
|
-
|
|
126
|
+
[`${classPrefix}-header-with-title`]: !!title
|
|
124
127
|
})
|
|
125
128
|
}, title && _react.default.createElement("div", {
|
|
126
129
|
className: `${classPrefix}-title`
|
|
@@ -134,15 +137,14 @@ const NumberKeyboard = p => {
|
|
|
134
137
|
role: 'button',
|
|
135
138
|
title: 'CLOSE'
|
|
136
139
|
}, _react.default.createElement(_antdMobileIcons.DownOutline, null)));
|
|
137
|
-
};
|
|
138
|
-
|
|
140
|
+
};
|
|
139
141
|
|
|
140
142
|
const renderKey = (key, index) => {
|
|
141
143
|
const isNumberKey = /^\d$/.test(key);
|
|
142
144
|
const className = (0, _classnames.default)(`${classPrefix}-key`, {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
[`${classPrefix}-key-number`]: isNumberKey,
|
|
146
|
+
[`${classPrefix}-key-sign`]: !isNumberKey && key,
|
|
147
|
+
[`${classPrefix}-key-mid`]: index === 9 && !!confirmText && keys.length < 12
|
|
146
148
|
});
|
|
147
149
|
const ariaProps = key ? {
|
|
148
150
|
role: 'button',
|
|
@@ -186,12 +188,12 @@ const NumberKeyboard = p => {
|
|
|
186
188
|
className: `${classPrefix}-wrapper`
|
|
187
189
|
}, _react.default.createElement("div", {
|
|
188
190
|
className: (0, _classnames.default)(`${classPrefix}-main`, {
|
|
189
|
-
|
|
191
|
+
[`${classPrefix}-main-confirmed-style`]: !!confirmText
|
|
190
192
|
})
|
|
191
193
|
}, keys.map(renderKey)), !!confirmText && _react.default.createElement("div", {
|
|
192
194
|
className: `${classPrefix}-confirm`
|
|
193
195
|
}, _react.default.createElement("div", {
|
|
194
|
-
className: `${classPrefix}-key
|
|
196
|
+
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-bs`,
|
|
195
197
|
onTouchStart: () => {
|
|
196
198
|
onBackspacePressStart();
|
|
197
199
|
},
|
|
@@ -202,7 +204,7 @@ const NumberKeyboard = p => {
|
|
|
202
204
|
title: 'BACKSPACE',
|
|
203
205
|
role: 'button'
|
|
204
206
|
}, _react.default.createElement(_antdMobileIcons.TextDeletionOutline, null)), _react.default.createElement("div", {
|
|
205
|
-
className: `${classPrefix}-key
|
|
207
|
+
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
|
|
206
208
|
onTouchEnd: e => onKeyPress(e, 'OK'),
|
|
207
209
|
role: 'button'
|
|
208
210
|
}, confirmText))), props.safeArea && _react.default.createElement("div", {
|
|
@@ -25,56 +25,56 @@
|
|
|
25
25
|
background: var(--adm-color-background);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.adm-passcode-input:not(.seperated) {
|
|
28
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated) {
|
|
29
29
|
border-radius: var(--border-radius);
|
|
30
30
|
overflow: hidden;
|
|
31
31
|
border: 2px solid var(--border-color);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
|
|
34
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated) .adm-passcode-input-cell:not(:last-child) {
|
|
35
35
|
border-right: 2px solid var(--border-color);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.adm-passcode-input:not(.seperated).focused {
|
|
38
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-focused {
|
|
39
39
|
border-color: var(--adm-color-primary);
|
|
40
40
|
box-shadow: 0 0 4px 0 var(--adm-color-primary);
|
|
41
41
|
outline: none;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.adm-passcode-input:not(.seperated).error {
|
|
44
|
+
.adm-passcode-input:not(.adm-passcode-input-seperated).adm-passcode-input-error {
|
|
45
45
|
border-color: var(--adm-color-danger);
|
|
46
46
|
box-shadow: 0 0 4px 0 var(--adm-color-danger);
|
|
47
47
|
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell {
|
|
50
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell {
|
|
51
51
|
border-radius: var(--border-radius);
|
|
52
52
|
border: 2px solid var(--border-color);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
|
|
55
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell:not(:last-child) {
|
|
56
56
|
margin-right: var(--cell-gap);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.adm-passcode-input.seperated .adm-passcode-input-cell
|
|
59
|
+
.adm-passcode-input.adm-passcode-input-seperated .adm-passcode-input-cell-focused {
|
|
60
60
|
border-color: var(--adm-color-primary);
|
|
61
61
|
box-shadow: 0 0 4px 0 var(--adm-color-primary);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.adm-passcode-input
|
|
64
|
+
.adm-passcode-input-seperated.adm-passcode-input-focused {
|
|
65
65
|
outline: none;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.adm-passcode-input.seperated.error {
|
|
68
|
+
.adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error {
|
|
69
69
|
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.adm-passcode-input.seperated.error .adm-passcode-input-cell {
|
|
72
|
+
.adm-passcode-input.adm-passcode-input-seperated.adm-passcode-input-error .adm-passcode-input-cell {
|
|
73
73
|
border-color: var(--adm-color-danger);
|
|
74
74
|
box-shadow: 0 0 4px 0 var(--adm-color-danger);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
.adm-passcode-input-cell
|
|
77
|
+
.adm-passcode-input-cell-dot::before {
|
|
78
78
|
content: '';
|
|
79
79
|
width: var(--dot-size);
|
|
80
80
|
height: var(--dot-size);
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
background: var(--adm-color-text);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.adm-passcode-input-cell
|
|
85
|
+
.adm-passcode-input-cell-caret::after {
|
|
86
86
|
content: '';
|
|
87
87
|
width: 4px;
|
|
88
88
|
height: 1.1em;
|
|
@@ -17,6 +17,8 @@ var _bound = require("../../utils/bound");
|
|
|
17
17
|
|
|
18
18
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
19
19
|
|
|
20
|
+
var _configProvider = require("../config-provider");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
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); }
|
|
@@ -36,6 +38,9 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
36
38
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p); // 防止 length 值不合法
|
|
37
39
|
|
|
38
40
|
const cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
|
|
41
|
+
const {
|
|
42
|
+
locale
|
|
43
|
+
} = (0, _configProvider.useConfig)();
|
|
39
44
|
const [focused, setFocused] = (0, _react.useState)(false);
|
|
40
45
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
41
46
|
const rootRef = (0, _react.useRef)(null);
|
|
@@ -106,9 +111,9 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
106
111
|
for (let i = 0; i < cellLength; i++) {
|
|
107
112
|
cells.push(_react.default.createElement("div", {
|
|
108
113
|
className: (0, _classnames.default)(`${classPrefix}-cell`, {
|
|
109
|
-
caret: props.caret && caretIndex === i && focused,
|
|
110
|
-
focused: focusedIndex === i && focused,
|
|
111
|
-
dot: !props.plain && chars[i]
|
|
114
|
+
[`${classPrefix}-cell-caret`]: props.caret && caretIndex === i && focused,
|
|
115
|
+
[`${classPrefix}-cell-focused`]: focusedIndex === i && focused,
|
|
116
|
+
[`${classPrefix}-cell-dot`]: !props.plain && chars[i]
|
|
112
117
|
}),
|
|
113
118
|
key: i
|
|
114
119
|
}, chars[i] && props.plain ? chars[i] : ''));
|
|
@@ -118,16 +123,18 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
118
123
|
};
|
|
119
124
|
|
|
120
125
|
const cls = (0, _classnames.default)(classPrefix, {
|
|
121
|
-
focused: focused,
|
|
122
|
-
error: props.error,
|
|
123
|
-
seperated: props.seperated
|
|
126
|
+
[`${classPrefix}-focused`]: focused,
|
|
127
|
+
[`${classPrefix}-error`]: props.error,
|
|
128
|
+
[`${classPrefix}-seperated`]: props.seperated
|
|
124
129
|
});
|
|
125
130
|
return _react.default.createElement(_react.default.Fragment, null, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
126
131
|
ref: rootRef,
|
|
127
132
|
tabIndex: 0,
|
|
128
133
|
className: cls,
|
|
129
134
|
onFocus: onFocus,
|
|
130
|
-
onBlur: onBlur
|
|
135
|
+
onBlur: onBlur,
|
|
136
|
+
role: 'button',
|
|
137
|
+
"aria-label": locale.PasscodeInput.name
|
|
131
138
|
}, _react.default.createElement("div", {
|
|
132
139
|
className: `${classPrefix}-cell-container`
|
|
133
140
|
}, renderCells()), _react.default.createElement("input", {
|
|
@@ -139,7 +146,8 @@ const PasscodeInput = (0, _react.forwardRef)((p, ref) => {
|
|
|
139
146
|
inputMode: 'numeric',
|
|
140
147
|
onChange: e => {
|
|
141
148
|
setValue(e.target.value.slice(0, props.length));
|
|
142
|
-
}
|
|
149
|
+
},
|
|
150
|
+
"aria-hidden": true
|
|
143
151
|
}))), props.keyboard && _react.default.cloneElement(props.keyboard, {
|
|
144
152
|
visible: focused,
|
|
145
153
|
onInput: v => {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Rate = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
@@ -17,8 +17,16 @@ var _usePropsValue = require("../../utils/use-props-value");
|
|
|
17
17
|
|
|
18
18
|
var _star = require("./star");
|
|
19
19
|
|
|
20
|
+
var _react2 = require("@use-gesture/react");
|
|
21
|
+
|
|
22
|
+
var _bound = require("../../utils/bound");
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
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); }
|
|
27
|
+
|
|
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; }
|
|
29
|
+
|
|
22
30
|
const classPrefix = `adm-rate`;
|
|
23
31
|
const defaultProps = {
|
|
24
32
|
count: 5,
|
|
@@ -32,6 +40,7 @@ const defaultProps = {
|
|
|
32
40
|
const Rate = p => {
|
|
33
41
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
34
42
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
43
|
+
const containerRef = (0, _react.useRef)(null);
|
|
35
44
|
const starList = Array(props.count).fill(null);
|
|
36
45
|
|
|
37
46
|
function renderStar(v, half) {
|
|
@@ -49,13 +58,37 @@ const Rate = p => {
|
|
|
49
58
|
} else {
|
|
50
59
|
setValue(v);
|
|
51
60
|
}
|
|
52
|
-
}
|
|
61
|
+
},
|
|
62
|
+
role: 'radio',
|
|
63
|
+
"aria-checked": value >= v,
|
|
64
|
+
"aria-label": '' + v
|
|
53
65
|
}, props.character);
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
const bind = (0, _react2.useDrag)(state => {
|
|
69
|
+
if (props.readOnly) return;
|
|
70
|
+
const {
|
|
71
|
+
xy: [clientX]
|
|
72
|
+
} = state;
|
|
73
|
+
const container = containerRef.current;
|
|
74
|
+
if (!container) return;
|
|
75
|
+
const rect = container.getBoundingClientRect();
|
|
76
|
+
const rawValue = (clientX - rect.left) / rect.width * props.count;
|
|
77
|
+
const roundedValue = props.allowHalf ? Math.round(rawValue * 2) / 2 : Math.round(rawValue);
|
|
78
|
+
setValue((0, _bound.bound)(roundedValue, 0, props.count));
|
|
79
|
+
}, {
|
|
80
|
+
axis: 'x',
|
|
81
|
+
preventScroll: true,
|
|
82
|
+
pointer: {
|
|
83
|
+
touch: true
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", Object.assign({
|
|
87
|
+
className: classPrefix,
|
|
88
|
+
role: 'radiogroup',
|
|
89
|
+
"aria-readonly": props.readOnly,
|
|
90
|
+
ref: containerRef
|
|
91
|
+
}, bind()), starList.map((_, i) => _react.default.createElement("div", {
|
|
59
92
|
key: i,
|
|
60
93
|
className: (0, _classnames.default)(`${classPrefix}-box`)
|
|
61
94
|
}, props.allowHalf && renderStar(i + 0.5, true), renderStar(i + 1, false)))));
|
|
@@ -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',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type ResultProps = {
|
|
4
|
-
status
|
|
4
|
+
status?: 'success' | 'error' | 'info' | 'waiting' | 'warning';
|
|
5
5
|
title: ReactNode;
|
|
6
6
|
description?: ReactNode;
|
|
7
7
|
icon?: ReactNode;
|
|
@@ -13,6 +13,8 @@ var _antdMobileIcons = require("antd-mobile-icons");
|
|
|
13
13
|
|
|
14
14
|
var _nativeProps = require("../../utils/native-props");
|
|
15
15
|
|
|
16
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const classPrefix = `adm-result`;
|
|
@@ -23,8 +25,12 @@ const iconRecord = {
|
|
|
23
25
|
waiting: _antdMobileIcons.ClockCircleFill,
|
|
24
26
|
warning: _antdMobileIcons.ExclamationCircleFill
|
|
25
27
|
};
|
|
28
|
+
const defaultProps = {
|
|
29
|
+
status: 'info'
|
|
30
|
+
};
|
|
26
31
|
|
|
27
|
-
const Result =
|
|
32
|
+
const Result = p => {
|
|
33
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
28
34
|
const {
|
|
29
35
|
status,
|
|
30
36
|
title,
|
|
@@ -48,6 +48,7 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
48
48
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
49
49
|
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
50
50
|
const inputRef = (0, _react.useRef)(null);
|
|
51
|
+
const composingRef = (0, _react.useRef)(false);
|
|
51
52
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
52
53
|
clear: () => {
|
|
53
54
|
var _a;
|
|
@@ -140,8 +141,17 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
140
141
|
onEnterPress: () => {
|
|
141
142
|
var _a, _b;
|
|
142
143
|
|
|
143
|
-
(
|
|
144
|
-
|
|
144
|
+
if (!composingRef.current) {
|
|
145
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
146
|
+
(_b = props.onSearch) === null || _b === void 0 ? void 0 : _b.call(props, value);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"aria-label": locale.SearchBar.name,
|
|
150
|
+
onCompositionStart: () => {
|
|
151
|
+
composingRef.current = true;
|
|
152
|
+
},
|
|
153
|
+
onCompositionEnd: () => {
|
|
154
|
+
composingRef.current = false;
|
|
145
155
|
}
|
|
146
156
|
})), renderCancelButton()));
|
|
147
157
|
});
|
|
@@ -20,6 +20,7 @@ export declare type SwipeActionProps = {
|
|
|
20
20
|
closeOnAction?: boolean;
|
|
21
21
|
children: ReactNode;
|
|
22
22
|
stopPropagation?: PropagationEvent[];
|
|
23
|
+
onActionsReveal?: (side: 'left' | 'right') => void;
|
|
23
24
|
} & NativeProps<'--background'>;
|
|
24
25
|
export declare const SwipeAction: React.ForwardRefExoticComponent<{
|
|
25
26
|
rightActions?: Action[] | undefined;
|
|
@@ -29,6 +30,7 @@ export declare const SwipeAction: React.ForwardRefExoticComponent<{
|
|
|
29
30
|
closeOnAction?: boolean | undefined;
|
|
30
31
|
children: ReactNode;
|
|
31
32
|
stopPropagation?: "click"[] | undefined;
|
|
33
|
+
onActionsReveal?: ((side: 'left' | 'right') => void) | undefined;
|
|
32
34
|
} & {
|
|
33
35
|
className?: string | undefined;
|
|
34
36
|
style?: (React.CSSProperties & Partial<Record<"--background", string>>) | undefined;
|
|
@@ -65,8 +65,26 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
65
65
|
}
|
|
66
66
|
}), []);
|
|
67
67
|
const draggingRef = (0, _react.useRef)(false);
|
|
68
|
+
const dragCancelRef = (0, _react.useRef)(null);
|
|
69
|
+
|
|
70
|
+
function forceCancelDrag() {
|
|
71
|
+
var _a;
|
|
72
|
+
|
|
73
|
+
(_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
|
|
74
|
+
draggingRef.current = false;
|
|
75
|
+
}
|
|
76
|
+
|
|
68
77
|
const bind = (0, _react2.useDrag)(state => {
|
|
69
|
-
|
|
78
|
+
var _a;
|
|
79
|
+
|
|
80
|
+
dragCancelRef.current = state.cancel;
|
|
81
|
+
if (!state.intentional) return;
|
|
82
|
+
|
|
83
|
+
if (state.down) {
|
|
84
|
+
draggingRef.current = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!draggingRef.current) return;
|
|
70
88
|
const [offsetX] = state.offset;
|
|
71
89
|
|
|
72
90
|
if (state.last) {
|
|
@@ -82,9 +100,15 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
82
100
|
position = 0;
|
|
83
101
|
}
|
|
84
102
|
|
|
103
|
+
const targetX = (0, _nearest.nearest)([-rightWidth, 0, leftWidth], position);
|
|
85
104
|
api.start({
|
|
86
|
-
x:
|
|
105
|
+
x: targetX
|
|
87
106
|
});
|
|
107
|
+
|
|
108
|
+
if (targetX !== 0) {
|
|
109
|
+
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, targetX > 0 ? 'left' : 'right');
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
window.setTimeout(() => {
|
|
89
113
|
draggingRef.current = false;
|
|
90
114
|
});
|
|
@@ -109,17 +133,21 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
109
133
|
preventScroll: true,
|
|
110
134
|
pointer: {
|
|
111
135
|
touch: true
|
|
112
|
-
}
|
|
136
|
+
},
|
|
137
|
+
triggerAllEvents: true
|
|
113
138
|
});
|
|
114
139
|
|
|
115
140
|
function close() {
|
|
116
141
|
api.start({
|
|
117
142
|
x: 0
|
|
118
143
|
});
|
|
144
|
+
forceCancelDrag();
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
122
148
|
show: (side = 'right') => {
|
|
149
|
+
var _a;
|
|
150
|
+
|
|
123
151
|
if (side === 'right') {
|
|
124
152
|
api.start({
|
|
125
153
|
x: -getRightWidth()
|
|
@@ -129,6 +157,8 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
129
157
|
x: getLeftWidth()
|
|
130
158
|
});
|
|
131
159
|
}
|
|
160
|
+
|
|
161
|
+
(_a = p.onActionsReveal) === null || _a === void 0 ? void 0 : _a.call(p, side);
|
|
132
162
|
},
|
|
133
163
|
close
|
|
134
164
|
}));
|
|
@@ -200,9 +230,7 @@ const SwipeAction = (0, _react.forwardRef)((p, ref) => {
|
|
|
200
230
|
if (x.goal !== 0) {
|
|
201
231
|
e.preventDefault();
|
|
202
232
|
e.stopPropagation();
|
|
203
|
-
|
|
204
|
-
x: 0
|
|
205
|
-
});
|
|
233
|
+
close();
|
|
206
234
|
}
|
|
207
235
|
}
|
|
208
236
|
}, _react.default.createElement(_web.animated.div, {
|
|
@@ -141,7 +141,18 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
}), [count]);
|
|
144
|
+
const dragCancelRef = (0, _react.useRef)(null);
|
|
145
|
+
|
|
146
|
+
function forceCancelDrag() {
|
|
147
|
+
var _a;
|
|
148
|
+
|
|
149
|
+
(_a = dragCancelRef.current) === null || _a === void 0 ? void 0 : _a.call(dragCancelRef);
|
|
150
|
+
draggingRef.current = false;
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
const bind = (0, _react2.useDrag)(state => {
|
|
154
|
+
dragCancelRef.current = state.cancel;
|
|
155
|
+
if (!state.intentional) return;
|
|
145
156
|
const slidePixels = getSlidePixels();
|
|
146
157
|
if (!slidePixels) return;
|
|
147
158
|
const paramIndex = isVertical ? 1 : 0;
|
|
@@ -170,6 +181,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
170
181
|
const slidePixels = getSlidePixels();
|
|
171
182
|
return [position.get() / 100 * slidePixels, position.get() / 100 * slidePixels];
|
|
172
183
|
},
|
|
184
|
+
triggerAllEvents: true,
|
|
173
185
|
bounds: () => {
|
|
174
186
|
if (loop) return {};
|
|
175
187
|
const slidePixels = getSlidePixels();
|
|
@@ -284,6 +296,8 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
284
296
|
if (draggingRef.current) {
|
|
285
297
|
e.stopPropagation();
|
|
286
298
|
}
|
|
299
|
+
|
|
300
|
+
forceCancelDrag();
|
|
287
301
|
}
|
|
288
302
|
}, props.allowTouchMove ? bind() : {}), renderTrackInner()), props.indicator === undefined ? _react.default.createElement("div", {
|
|
289
303
|
className: `${classPrefix}-indicator`
|
|
@@ -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
|
}
|
package/2x/cjs/locales/base.d.ts
CHANGED
|
@@ -93,17 +93,26 @@ export declare const base: {
|
|
|
93
93
|
failedToLoad: string;
|
|
94
94
|
retry: string;
|
|
95
95
|
};
|
|
96
|
+
Input: {
|
|
97
|
+
clear: string;
|
|
98
|
+
};
|
|
96
99
|
Mask: {
|
|
97
100
|
name: string;
|
|
98
101
|
};
|
|
99
102
|
Modal: {
|
|
100
103
|
ok: string;
|
|
101
104
|
};
|
|
105
|
+
PasscodeInput: {
|
|
106
|
+
name: string;
|
|
107
|
+
};
|
|
102
108
|
PullToRefresh: {
|
|
103
109
|
pulling: string;
|
|
104
110
|
canRelease: string;
|
|
105
111
|
complete: string;
|
|
106
112
|
};
|
|
113
|
+
SearchBar: {
|
|
114
|
+
name: string;
|
|
115
|
+
};
|
|
107
116
|
Slider: {
|
|
108
117
|
name: string;
|
|
109
118
|
};
|
package/2x/cjs/locales/base.js
CHANGED
|
@@ -100,17 +100,26 @@ const base = {
|
|
|
100
100
|
failedToLoad: 'Failed to load',
|
|
101
101
|
retry: 'Retry'
|
|
102
102
|
},
|
|
103
|
+
Input: {
|
|
104
|
+
clear: 'clear'
|
|
105
|
+
},
|
|
103
106
|
Mask: {
|
|
104
107
|
name: 'Mask'
|
|
105
108
|
},
|
|
106
109
|
Modal: {
|
|
107
110
|
ok: 'OK'
|
|
108
111
|
},
|
|
112
|
+
PasscodeInput: {
|
|
113
|
+
name: 'Passcode Input'
|
|
114
|
+
},
|
|
109
115
|
PullToRefresh: {
|
|
110
116
|
pulling: 'Scroll down to refresh',
|
|
111
117
|
canRelease: 'Release to refresh immediately',
|
|
112
118
|
complete: 'Refresh successful'
|
|
113
119
|
},
|
|
120
|
+
SearchBar: {
|
|
121
|
+
name: 'Search Bar'
|
|
122
|
+
},
|
|
114
123
|
Slider: {
|
|
115
124
|
name: 'Slider'
|
|
116
125
|
},
|