antd-mobile 5.29.1 → 5.30.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 +3753 -3728
- package/2x/bundle/antd-mobile.cjs.js +9 -9
- package/2x/bundle/antd-mobile.es.development.js +3741 -3716
- package/2x/bundle/antd-mobile.es.js +6791 -6784
- package/2x/bundle/antd-mobile.umd.development.js +3753 -3728
- package/2x/bundle/antd-mobile.umd.js +9 -9
- package/2x/bundle/style.css +4 -2
- package/2x/cjs/components/collapse/collapse.js +3 -1
- package/2x/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-utils.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/2x/cjs/components/dropdown/dropdown.d.ts +3 -0
- package/2x/cjs/components/dropdown/dropdown.js +4 -1
- package/2x/cjs/components/dropdown/index.d.ts +1 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -1
- package/2x/cjs/components/footer/footer.css +1 -1
- package/2x/cjs/components/form/form-subscribe.js +4 -1
- package/2x/cjs/components/form/form.js +1 -1
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/image/image.js +9 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +4 -5
- package/2x/cjs/components/page-indicator/page-indicator.css +1 -1
- package/2x/cjs/components/picker-view/picker-view.d.ts +2 -2
- package/2x/cjs/components/popup/popup.js +27 -16
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/2x/cjs/components/search-bar/search-bar.js +6 -2
- package/2x/cjs/components/steps/steps.css +2 -0
- package/2x/cjs/components/swiper/swiper.js +7 -5
- package/2x/cjs/components/text-area/text-area.js +5 -3
- package/2x/es/components/collapse/collapse.js +3 -1
- package/2x/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-utils.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/2x/es/components/dropdown/dropdown.d.ts +3 -0
- package/2x/es/components/dropdown/dropdown.js +4 -1
- package/2x/es/components/dropdown/index.d.ts +1 -0
- package/2x/es/components/ellipsis/ellipsis.js +1 -1
- package/2x/es/components/footer/footer.css +1 -1
- package/2x/es/components/form/form-subscribe.js +4 -1
- package/2x/es/components/form/form.js +1 -1
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/image/image.js +10 -1
- package/2x/es/components/image-uploader/image-uploader.js +4 -5
- package/2x/es/components/page-indicator/page-indicator.css +1 -1
- package/2x/es/components/picker-view/picker-view.d.ts +2 -2
- package/2x/es/components/popup/popup.js +27 -16
- package/2x/es/components/search-bar/search-bar.d.ts +2 -2
- package/2x/es/components/search-bar/search-bar.js +6 -2
- package/2x/es/components/steps/steps.css +2 -0
- package/2x/es/components/swiper/swiper.js +8 -6
- package/2x/es/components/text-area/text-area.js +4 -3
- package/2x/package.json +9 -9
- package/bundle/antd-mobile.cjs.development.js +3753 -3728
- package/bundle/antd-mobile.cjs.js +9 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +3741 -3716
- package/bundle/antd-mobile.es.js +6791 -6784
- package/bundle/antd-mobile.umd.development.js +3753 -3728
- package/bundle/antd-mobile.umd.js +9 -9
- package/bundle/style.css +1 -1
- package/cjs/components/collapse/collapse.js +3 -1
- package/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-utils.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/cjs/components/dropdown/dropdown.d.ts +3 -0
- package/cjs/components/dropdown/dropdown.js +4 -1
- package/cjs/components/dropdown/index.d.ts +1 -0
- package/cjs/components/ellipsis/ellipsis.js +1 -1
- package/cjs/components/footer/footer.css +1 -1
- package/cjs/components/form/form-subscribe.js +4 -1
- package/cjs/components/form/form.js +1 -1
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/image/image.js +9 -0
- package/cjs/components/image-uploader/image-uploader.js +4 -5
- package/cjs/components/page-indicator/page-indicator.css +1 -1
- package/cjs/components/picker-view/picker-view.d.ts +2 -2
- package/cjs/components/popup/popup.js +27 -16
- package/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/cjs/components/search-bar/search-bar.js +6 -2
- package/cjs/components/steps/steps.css +2 -0
- package/cjs/components/swiper/swiper.js +7 -5
- package/cjs/components/text-area/text-area.js +5 -3
- package/es/components/collapse/collapse.js +3 -1
- package/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/es/components/date-picker/date-picker-utils.d.ts +1 -1
- package/es/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/es/components/dropdown/dropdown.d.ts +3 -0
- package/es/components/dropdown/dropdown.js +4 -1
- package/es/components/dropdown/index.d.ts +1 -0
- package/es/components/ellipsis/ellipsis.js +1 -1
- package/es/components/footer/footer.css +1 -1
- package/es/components/form/form-subscribe.js +4 -1
- package/es/components/form/form.js +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/image/image.js +10 -1
- package/es/components/image-uploader/image-uploader.js +4 -5
- package/es/components/page-indicator/page-indicator.css +1 -1
- package/es/components/picker-view/picker-view.d.ts +2 -2
- package/es/components/popup/popup.js +27 -16
- package/es/components/search-bar/search-bar.d.ts +2 -2
- package/es/components/search-bar/search-bar.js +6 -2
- package/es/components/steps/steps.css +2 -0
- package/es/components/swiper/swiper.js +8 -6
- package/es/components/text-area/text-area.js +4 -3
- package/package.json +9 -9
- package/umd/antd-mobile.js +1 -1
|
@@ -127,9 +127,11 @@ const ImageUploader = p => {
|
|
|
127
127
|
file
|
|
128
128
|
}));
|
|
129
129
|
setTasks(prev => [...getFinalTasks(prev), ...newTasks]);
|
|
130
|
-
|
|
130
|
+
const newVal = [];
|
|
131
|
+
yield Promise.all(newTasks.map((currentTask, index) => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
131
132
|
try {
|
|
132
133
|
const result = yield props.upload(currentTask.file);
|
|
134
|
+
newVal[index] = result;
|
|
133
135
|
setTasks(prev => {
|
|
134
136
|
return prev.map(task => {
|
|
135
137
|
if (task.id === currentTask.id) {
|
|
@@ -141,10 +143,6 @@ const ImageUploader = p => {
|
|
|
141
143
|
return task;
|
|
142
144
|
});
|
|
143
145
|
});
|
|
144
|
-
setValue(prev => {
|
|
145
|
-
const newVal = Object.assign({}, result);
|
|
146
|
-
return [...prev, newVal];
|
|
147
|
-
});
|
|
148
146
|
} catch (e) {
|
|
149
147
|
setTasks(prev => {
|
|
150
148
|
return prev.map(task => {
|
|
@@ -159,6 +157,7 @@ const ImageUploader = p => {
|
|
|
159
157
|
throw e;
|
|
160
158
|
}
|
|
161
159
|
}))).catch(error => console.error(error));
|
|
160
|
+
setValue(prev => prev.concat(newVal));
|
|
162
161
|
});
|
|
163
162
|
}
|
|
164
163
|
const imageViewerHandlerRef = (0, _react.useRef)(null);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PickerProps } from '../picker';
|
|
4
|
-
export declare type PickerValue = string | null;
|
|
4
|
+
export declare type PickerValue = string | number | null;
|
|
5
5
|
export declare type PickerValueExtend = {
|
|
6
6
|
columns: PickerColumnItem[][];
|
|
7
7
|
items: (PickerColumnItem | null)[];
|
|
8
8
|
};
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
|
-
value: string;
|
|
11
|
+
value: string | number;
|
|
12
12
|
key?: string | number;
|
|
13
13
|
};
|
|
14
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
@@ -19,6 +19,7 @@ var _antdMobileIcons = require("antd-mobile-icons");
|
|
|
19
19
|
var _popupBaseProps = require("./popup-base-props");
|
|
20
20
|
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
21
21
|
var _configProvider = require("../config-provider");
|
|
22
|
+
var _react2 = require("@use-gesture/react");
|
|
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; }
|
|
24
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -62,14 +63,26 @@ const Popup = p => {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
});
|
|
66
|
+
const bind = (0, _react2.useDrag)(({
|
|
67
|
+
swipe: [, swipeY]
|
|
68
|
+
}) => {
|
|
69
|
+
var _a;
|
|
70
|
+
if (swipeY === 1 && props.position === 'bottom' || swipeY === -1 && props.position === 'top') {
|
|
71
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
axis: 'y',
|
|
75
|
+
enabled: ['top', 'bottom'].includes(props.position)
|
|
76
|
+
});
|
|
65
77
|
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && props.visible);
|
|
66
|
-
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
78
|
+
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", Object.assign({
|
|
67
79
|
className: classPrefix,
|
|
68
80
|
onClick: props.onClick,
|
|
69
81
|
style: {
|
|
70
|
-
display: active ? undefined : 'none'
|
|
82
|
+
display: active ? undefined : 'none',
|
|
83
|
+
touchAction: ['top', 'bottom'].includes(props.position) ? 'none' : 'auto'
|
|
71
84
|
}
|
|
72
|
-
}, props.mask && _react.default.createElement(_mask.default, {
|
|
85
|
+
}, bind()), props.mask && _react.default.createElement(_mask.default, {
|
|
73
86
|
visible: maskVisible,
|
|
74
87
|
forceRender: props.forceRender,
|
|
75
88
|
destroyOnClose: props.destroyOnClose,
|
|
@@ -88,19 +101,17 @@ const Popup = p => {
|
|
|
88
101
|
className: bodyCls,
|
|
89
102
|
style: Object.assign(Object.assign({}, props.bodyStyle), {
|
|
90
103
|
transform: percent.to(v => {
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return `translate(${v}%, 0)`;
|
|
103
|
-
}
|
|
104
|
+
if (props.position === 'bottom') {
|
|
105
|
+
return `translate(0, ${v}%)`;
|
|
106
|
+
}
|
|
107
|
+
if (props.position === 'top') {
|
|
108
|
+
return `translate(0, -${v}%)`;
|
|
109
|
+
}
|
|
110
|
+
if (props.position === 'left') {
|
|
111
|
+
return `translate(-${v}%, 0)`;
|
|
112
|
+
}
|
|
113
|
+
if (props.position === 'right') {
|
|
114
|
+
return `translate(${v}%, 0)`;
|
|
104
115
|
}
|
|
105
116
|
return 'none';
|
|
106
117
|
})
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { InputRef, InputProps } from '../input';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type SearchBarRef = InputRef;
|
|
5
|
-
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear'> & {
|
|
5
|
+
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
6
6
|
value?: string;
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
maxLength?: number;
|
|
@@ -17,7 +17,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
|
|
|
17
17
|
onChange?: (val: string) => void;
|
|
18
18
|
onCancel?: () => void;
|
|
19
19
|
} & NativeProps<'--background' | '--border-radius' | '--placeholder-color' | '--height' | '--padding-left'>;
|
|
20
|
-
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onFocus" | "onBlur" | "onClear"> & {
|
|
20
|
+
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onClear"> & {
|
|
21
21
|
value?: string | undefined;
|
|
22
22
|
defaultValue?: string | undefined;
|
|
23
23
|
maxLength?: number | undefined;
|
|
@@ -119,11 +119,15 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
"aria-label": locale.SearchBar.name,
|
|
122
|
-
onCompositionStart:
|
|
122
|
+
onCompositionStart: e => {
|
|
123
|
+
var _a;
|
|
123
124
|
composingRef.current = true;
|
|
125
|
+
(_a = props.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
124
126
|
},
|
|
125
|
-
onCompositionEnd:
|
|
127
|
+
onCompositionEnd: e => {
|
|
128
|
+
var _a;
|
|
126
129
|
composingRef.current = false;
|
|
130
|
+
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
127
131
|
}
|
|
128
132
|
})), renderCancelButton()));
|
|
129
133
|
});
|
|
@@ -83,10 +83,6 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
83
83
|
return trackPixels * props.slideSize / 100;
|
|
84
84
|
}
|
|
85
85
|
const [current, setCurrent] = (0, _react.useState)(props.defaultIndex);
|
|
86
|
-
(0, _ahooks.useUpdateEffect)(() => {
|
|
87
|
-
var _a;
|
|
88
|
-
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, current);
|
|
89
|
-
}, [current]);
|
|
90
86
|
const [dragging, setDragging, draggingRef] = (0, _useRefState.useRefState)(false);
|
|
91
87
|
function boundIndex(current) {
|
|
92
88
|
let min = 0;
|
|
@@ -181,9 +177,13 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
181
177
|
}
|
|
182
178
|
});
|
|
183
179
|
function swipeTo(index, immediate = false) {
|
|
180
|
+
var _a;
|
|
184
181
|
const roundedIndex = Math.round(index);
|
|
185
182
|
const targetIndex = loop ? modulus(roundedIndex, count) : (0, _bound.bound)(roundedIndex, 0, count - 1);
|
|
186
183
|
setCurrent(targetIndex);
|
|
184
|
+
if (targetIndex !== current) {
|
|
185
|
+
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, targetIndex);
|
|
186
|
+
}
|
|
187
187
|
api.start({
|
|
188
188
|
position: (loop ? roundedIndex : boundIndex(roundedIndex)) * 100,
|
|
189
189
|
immediate
|
|
@@ -228,7 +228,9 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
228
228
|
className: `${classPrefix}-track-inner`
|
|
229
229
|
}, _react.default.Children.map(validChildren, (child, index) => {
|
|
230
230
|
return _react.default.createElement(_web.animated.div, {
|
|
231
|
-
className: `${classPrefix}-slide`,
|
|
231
|
+
className: (0, _classnames.default)(`${classPrefix}-slide`, {
|
|
232
|
+
[`${classPrefix}-slide-active`]: current === index
|
|
233
|
+
}),
|
|
232
234
|
style: {
|
|
233
235
|
[isVertical ? 'y' : 'x']: position.to(position => {
|
|
234
236
|
let finalPosition = -position + index * 100;
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TextArea = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _ahooks = require("ahooks");
|
|
9
|
+
var _runes = _interopRequireDefault(require("runes2"));
|
|
9
10
|
var _nativeProps = require("../../utils/native-props");
|
|
10
11
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
11
12
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
12
13
|
var _devLog = require("../../utils/dev-log");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
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); }
|
|
14
16
|
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; }
|
|
15
17
|
const classPrefix = 'adm-text-area';
|
|
@@ -76,7 +78,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
76
78
|
}, [value, autoSize]);
|
|
77
79
|
const compositingRef = (0, _react.useRef)(false);
|
|
78
80
|
let count;
|
|
79
|
-
const valueLength =
|
|
81
|
+
const valueLength = (0, _runes.default)(value).length;
|
|
80
82
|
if (typeof showCount === 'function') {
|
|
81
83
|
count = showCount(valueLength, maxLength);
|
|
82
84
|
} else if (showCount) {
|
|
@@ -95,7 +97,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
95
97
|
onChange: e => {
|
|
96
98
|
let v = e.target.value;
|
|
97
99
|
if (maxLength && !compositingRef.current) {
|
|
98
|
-
v =
|
|
100
|
+
v = (0, _runes.default)(v).slice(0, maxLength).join('');
|
|
99
101
|
}
|
|
100
102
|
setValue(v);
|
|
101
103
|
},
|
|
@@ -110,7 +112,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
110
112
|
compositingRef.current = false;
|
|
111
113
|
if (maxLength) {
|
|
112
114
|
const v = e.target.value;
|
|
113
|
-
setValue(
|
|
115
|
+
setValue((0, _runes.default)(v).slice(0, maxLength).join(''));
|
|
114
116
|
}
|
|
115
117
|
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
116
118
|
},
|
|
@@ -60,7 +60,9 @@ const CollapsePanelContent = props => {
|
|
|
60
60
|
}
|
|
61
61
|
}, [visible]);
|
|
62
62
|
return React.createElement(animated.div, {
|
|
63
|
-
className: `${classPrefix}-panel-content`,
|
|
63
|
+
className: classNames(`${classPrefix}-panel-content`, {
|
|
64
|
+
[`${classPrefix}-panel-content-active`]: visible
|
|
65
|
+
}),
|
|
64
66
|
style: {
|
|
65
67
|
height: height.to(v => {
|
|
66
68
|
if (height.idle && visible) {
|
|
@@ -4,4 +4,4 @@ import { RenderLabel } from '../date-picker-view/date-picker-view';
|
|
|
4
4
|
export declare type DatePrecision = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
|
|
5
5
|
export declare function generateDatePickerColumns(selected: string[], min: Date, max: Date, precision: DatePrecision, renderLabel: RenderLabel, filter: DatePickerFilter | undefined, tillNow?: boolean): PickerColumn[];
|
|
6
6
|
export declare function convertDateToStringArray(date: Date | undefined | null): string[];
|
|
7
|
-
export declare function convertStringArrayToDate
|
|
7
|
+
export declare function convertStringArrayToDate<T extends string | number | null | undefined>(value: T[]): Date;
|
|
@@ -6,5 +6,5 @@ export declare type DatePickerFilter = Partial<Record<Precision, (val: number, e
|
|
|
6
6
|
date: Date;
|
|
7
7
|
}) => boolean>>;
|
|
8
8
|
export declare const convertDateToStringArray: (date: Date | undefined | null, precision: Precision) => string[];
|
|
9
|
-
export declare const convertStringArrayToDate:
|
|
9
|
+
export declare const convertStringArrayToDate: <T extends string | number | null | undefined>(value: T[], precision: Precision) => Date;
|
|
10
10
|
export declare const generateDatePickerColumns: (selected: string[], min: Date, max: Date, precision: Precision, renderLabel: RenderLabel, filter: DatePickerFilter | undefined, tillNow?: boolean | undefined) => import("../picker-view").PickerColumn[];
|
|
@@ -4,4 +4,4 @@ import type { DatePickerFilter } from './date-picker-utils';
|
|
|
4
4
|
export declare type WeekPrecision = 'year' | 'week' | 'week-day';
|
|
5
5
|
export declare function generateDatePickerColumns(selected: string[], min: Date, max: Date, precision: WeekPrecision, renderLabel: (type: WeekPrecision, data: number) => ReactNode, filter: DatePickerFilter | undefined): PickerColumn[];
|
|
6
6
|
export declare function convertDateToStringArray(date: Date | undefined | null): string[];
|
|
7
|
-
export declare function convertStringArrayToDate
|
|
7
|
+
export declare function convertStringArrayToDate<T extends string | number | null | undefined>(value: T[]): Date;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PopupProps } from '../popup';
|
|
2
3
|
import { NativeProps } from '../../utils/native-props';
|
|
3
4
|
export declare type DropdownProps = {
|
|
4
5
|
activeKey?: string | null;
|
|
@@ -7,6 +8,7 @@ export declare type DropdownProps = {
|
|
|
7
8
|
closeOnClickAway?: boolean;
|
|
8
9
|
onChange?: (key: string | null) => void;
|
|
9
10
|
arrow?: React.ReactNode;
|
|
11
|
+
getContainer?: PopupProps['getContainer'];
|
|
10
12
|
} & NativeProps;
|
|
11
13
|
export declare type DropdownRef = {
|
|
12
14
|
close: () => void;
|
|
@@ -18,6 +20,7 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
18
20
|
closeOnClickAway?: boolean | undefined;
|
|
19
21
|
onChange?: ((key: string | null) => void) | undefined;
|
|
20
22
|
arrow?: React.ReactNode;
|
|
23
|
+
getContainer?: PopupProps['getContainer'];
|
|
21
24
|
} & {
|
|
22
25
|
className?: string | undefined;
|
|
23
26
|
style?: (React.CSSProperties & Partial<Record<never, string>>) | undefined;
|
|
@@ -6,11 +6,13 @@ import { ItemChildrenWrap } from './item';
|
|
|
6
6
|
import { withNativeProps } from '../../utils/native-props';
|
|
7
7
|
import { mergeProps } from '../../utils/with-default-props';
|
|
8
8
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
9
|
+
import { defaultPopupBaseProps } from '../popup/popup-base-props';
|
|
9
10
|
const classPrefix = `adm-dropdown`;
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
defaultActiveKey: null,
|
|
12
13
|
closeOnMaskClick: true,
|
|
13
|
-
closeOnClickAway: false
|
|
14
|
+
closeOnClickAway: false,
|
|
15
|
+
getContainer: defaultPopupBaseProps['getContainer']
|
|
14
16
|
};
|
|
15
17
|
const Dropdown = forwardRef((p, ref) => {
|
|
16
18
|
const props = mergeProps(defaultProps, p);
|
|
@@ -78,6 +80,7 @@ const Dropdown = forwardRef((p, ref) => {
|
|
|
78
80
|
}, navs), React.createElement(Popup, {
|
|
79
81
|
visible: !!value,
|
|
80
82
|
position: 'top',
|
|
83
|
+
getContainer: props.getContainer,
|
|
81
84
|
className: `${classPrefix}-popup`,
|
|
82
85
|
maskClassName: `${classPrefix}-popup-mask`,
|
|
83
86
|
bodyClassName: `${classPrefix}-popup-body`,
|
|
@@ -8,6 +8,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
8
8
|
closeOnClickAway?: boolean | undefined;
|
|
9
9
|
onChange?: ((key: string | null) => void) | undefined;
|
|
10
10
|
arrow?: import("react").ReactNode;
|
|
11
|
+
getContainer?: import("../../utils/render-to-container").GetContainer | undefined;
|
|
11
12
|
} & {
|
|
12
13
|
className?: string | undefined;
|
|
13
14
|
style?: (import("react").CSSProperties & Partial<Record<never, string>>) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
-
import runes from '
|
|
2
|
+
import runes from 'runes2';
|
|
3
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
@@ -5,7 +5,10 @@ import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-upda
|
|
|
5
5
|
export const FormSubscribe = props => {
|
|
6
6
|
const update = useUpdate();
|
|
7
7
|
const form = useContext(FieldContext);
|
|
8
|
-
|
|
8
|
+
const value = form.getFieldsValue(props.to);
|
|
9
|
+
// Memo to avoid useless render
|
|
10
|
+
const childNode = React.useMemo(() => props.children(value, form), [JSON.stringify(value)]);
|
|
11
|
+
return React.createElement(React.Fragment, null, childNode, props.to.map(namePath => React.createElement(Watcher, {
|
|
9
12
|
key: namePath.toString(),
|
|
10
13
|
form: form,
|
|
11
14
|
namePath: namePath,
|
|
@@ -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, } from 'rc-field-form/es/interface';
|
|
7
|
+
export type { ValidateMessages, 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>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
10
10
|
className?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mergeProps } from '../../utils/with-default-props';
|
|
2
|
-
import React, { useState, useRef } from 'react';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
4
|
import { staged } from 'staged-components';
|
|
5
5
|
import { toCSSLength } from '../../utils/to-css-length';
|
|
@@ -24,6 +24,7 @@ export const Image = staged(p => {
|
|
|
24
24
|
const [loaded, setLoaded] = useState(false);
|
|
25
25
|
const [failed, setFailed] = useState(false);
|
|
26
26
|
const ref = useRef(null);
|
|
27
|
+
const imgRef = useRef(null);
|
|
27
28
|
let src = props.src;
|
|
28
29
|
let srcSet = props.srcSet;
|
|
29
30
|
const [initialized, setInitialized] = useState(!props.lazy);
|
|
@@ -33,11 +34,19 @@ export const Image = staged(p => {
|
|
|
33
34
|
setLoaded(false);
|
|
34
35
|
setFailed(false);
|
|
35
36
|
}, [src]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
// for nextjs ssr
|
|
40
|
+
if ((_a = imgRef.current) === null || _a === void 0 ? void 0 : _a.complete) {
|
|
41
|
+
setLoaded(true);
|
|
42
|
+
}
|
|
43
|
+
}, []);
|
|
36
44
|
function renderInner() {
|
|
37
45
|
if (failed) {
|
|
38
46
|
return React.createElement(React.Fragment, null, props.fallback);
|
|
39
47
|
}
|
|
40
48
|
const img = React.createElement("img", {
|
|
49
|
+
ref: imgRef,
|
|
41
50
|
className: `${classPrefix}-img`,
|
|
42
51
|
src: src,
|
|
43
52
|
alt: props.alt,
|
|
@@ -118,9 +118,11 @@ export const ImageUploader = p => {
|
|
|
118
118
|
file
|
|
119
119
|
}));
|
|
120
120
|
setTasks(prev => [...getFinalTasks(prev), ...newTasks]);
|
|
121
|
-
|
|
121
|
+
const newVal = [];
|
|
122
|
+
yield Promise.all(newTasks.map((currentTask, index) => __awaiter(this, void 0, void 0, function* () {
|
|
122
123
|
try {
|
|
123
124
|
const result = yield props.upload(currentTask.file);
|
|
125
|
+
newVal[index] = result;
|
|
124
126
|
setTasks(prev => {
|
|
125
127
|
return prev.map(task => {
|
|
126
128
|
if (task.id === currentTask.id) {
|
|
@@ -132,10 +134,6 @@ export const ImageUploader = p => {
|
|
|
132
134
|
return task;
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
|
-
setValue(prev => {
|
|
136
|
-
const newVal = Object.assign({}, result);
|
|
137
|
-
return [...prev, newVal];
|
|
138
|
-
});
|
|
139
137
|
} catch (e) {
|
|
140
138
|
setTasks(prev => {
|
|
141
139
|
return prev.map(task => {
|
|
@@ -150,6 +148,7 @@ export const ImageUploader = p => {
|
|
|
150
148
|
throw e;
|
|
151
149
|
}
|
|
152
150
|
}))).catch(error => console.error(error));
|
|
151
|
+
setValue(prev => prev.concat(newVal));
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
const imageViewerHandlerRef = useRef(null);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PickerProps } from '../picker';
|
|
4
|
-
export declare type PickerValue = string | null;
|
|
4
|
+
export declare type PickerValue = string | number | null;
|
|
5
5
|
export declare type PickerValueExtend = {
|
|
6
6
|
columns: PickerColumnItem[][];
|
|
7
7
|
items: (PickerColumnItem | null)[];
|
|
8
8
|
};
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
|
-
value: string;
|
|
11
|
+
value: string | number;
|
|
12
12
|
key?: string | number;
|
|
13
13
|
};
|
|
14
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
@@ -13,6 +13,7 @@ import { CloseOutline } from 'antd-mobile-icons';
|
|
|
13
13
|
import { defaultPopupBaseProps } from './popup-base-props';
|
|
14
14
|
import { useInnerVisible } from '../../utils/use-inner-visible';
|
|
15
15
|
import { useConfig } from '../config-provider';
|
|
16
|
+
import { useDrag } from '@use-gesture/react';
|
|
16
17
|
const classPrefix = `adm-popup`;
|
|
17
18
|
const defaultProps = Object.assign(Object.assign({}, defaultPopupBaseProps), {
|
|
18
19
|
position: 'bottom'
|
|
@@ -53,14 +54,26 @@ export const Popup = p => {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
const bind = useDrag(({
|
|
58
|
+
swipe: [, swipeY]
|
|
59
|
+
}) => {
|
|
60
|
+
var _a;
|
|
61
|
+
if (swipeY === 1 && props.position === 'bottom' || swipeY === -1 && props.position === 'top') {
|
|
62
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
axis: 'y',
|
|
66
|
+
enabled: ['top', 'bottom'].includes(props.position)
|
|
67
|
+
});
|
|
56
68
|
const maskVisible = useInnerVisible(active && props.visible);
|
|
57
|
-
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
|
|
69
|
+
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", Object.assign({
|
|
58
70
|
className: classPrefix,
|
|
59
71
|
onClick: props.onClick,
|
|
60
72
|
style: {
|
|
61
|
-
display: active ? undefined : 'none'
|
|
73
|
+
display: active ? undefined : 'none',
|
|
74
|
+
touchAction: ['top', 'bottom'].includes(props.position) ? 'none' : 'auto'
|
|
62
75
|
}
|
|
63
|
-
}, props.mask && React.createElement(Mask, {
|
|
76
|
+
}, bind()), props.mask && React.createElement(Mask, {
|
|
64
77
|
visible: maskVisible,
|
|
65
78
|
forceRender: props.forceRender,
|
|
66
79
|
destroyOnClose: props.destroyOnClose,
|
|
@@ -79,19 +92,17 @@ export const Popup = p => {
|
|
|
79
92
|
className: bodyCls,
|
|
80
93
|
style: Object.assign(Object.assign({}, props.bodyStyle), {
|
|
81
94
|
transform: percent.to(v => {
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return `translate(${v}%, 0)`;
|
|
94
|
-
}
|
|
95
|
+
if (props.position === 'bottom') {
|
|
96
|
+
return `translate(0, ${v}%)`;
|
|
97
|
+
}
|
|
98
|
+
if (props.position === 'top') {
|
|
99
|
+
return `translate(0, -${v}%)`;
|
|
100
|
+
}
|
|
101
|
+
if (props.position === 'left') {
|
|
102
|
+
return `translate(-${v}%, 0)`;
|
|
103
|
+
}
|
|
104
|
+
if (props.position === 'right') {
|
|
105
|
+
return `translate(${v}%, 0)`;
|
|
95
106
|
}
|
|
96
107
|
return 'none';
|
|
97
108
|
})
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { InputRef, InputProps } from '../input';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type SearchBarRef = InputRef;
|
|
5
|
-
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear'> & {
|
|
5
|
+
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
6
6
|
value?: string;
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
maxLength?: number;
|
|
@@ -17,7 +17,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
|
|
|
17
17
|
onChange?: (val: string) => void;
|
|
18
18
|
onCancel?: () => void;
|
|
19
19
|
} & NativeProps<'--background' | '--border-radius' | '--placeholder-color' | '--height' | '--padding-left'>;
|
|
20
|
-
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onFocus" | "onBlur" | "onClear"> & {
|
|
20
|
+
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onClear"> & {
|
|
21
21
|
value?: string | undefined;
|
|
22
22
|
defaultValue?: string | undefined;
|
|
23
23
|
maxLength?: number | undefined;
|
|
@@ -110,11 +110,15 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"aria-label": locale.SearchBar.name,
|
|
113
|
-
onCompositionStart:
|
|
113
|
+
onCompositionStart: e => {
|
|
114
|
+
var _a;
|
|
114
115
|
composingRef.current = true;
|
|
116
|
+
(_a = props.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
115
117
|
},
|
|
116
|
-
onCompositionEnd:
|
|
118
|
+
onCompositionEnd: e => {
|
|
119
|
+
var _a;
|
|
117
120
|
composingRef.current = false;
|
|
121
|
+
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
118
122
|
}
|
|
119
123
|
})), renderCancelButton()));
|
|
120
124
|
});
|