antd-mobile 5.24.1 → 5.25.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 +349 -230
- package/2x/bundle/antd-mobile.cjs.js +8 -8
- package/2x/bundle/antd-mobile.es.development.js +349 -230
- package/2x/bundle/antd-mobile.es.js +6581 -6524
- package/2x/bundle/antd-mobile.umd.development.js +349 -230
- package/2x/bundle/antd-mobile.umd.js +8 -8
- package/2x/bundle/style.css +2 -0
- package/2x/cjs/components/cascader-view/cascader-view.d.ts +1 -1
- package/2x/cjs/components/cascader-view/cascader-view.js +3 -4
- package/2x/cjs/components/image-uploader/image-uploader.js +8 -7
- package/2x/cjs/components/image-viewer/image-viewer.d.ts +1 -1
- package/2x/cjs/components/image-viewer/slide.d.ts +1 -1
- package/2x/cjs/components/image-viewer/slide.js +9 -2
- package/2x/cjs/components/picker-view/picker-view.css +1 -0
- package/2x/cjs/components/popup/popup.css +1 -0
- package/2x/cjs/components/slider/slider.js +1 -1
- package/2x/cjs/components/slider/thumb.js +3 -2
- package/2x/cjs/index.d.ts +81 -1
- package/2x/cjs/index.js +1 -1
- package/2x/es/components/cascader-view/cascader-view.d.ts +1 -1
- package/2x/es/components/cascader-view/cascader-view.js +3 -4
- package/2x/es/components/image-uploader/image-uploader.js +8 -7
- package/2x/es/components/image-viewer/image-viewer.d.ts +1 -1
- package/2x/es/components/image-viewer/slide.d.ts +1 -1
- package/2x/es/components/image-viewer/slide.js +9 -2
- package/2x/es/components/picker-view/picker-view.css +1 -0
- package/2x/es/components/popup/popup.css +1 -0
- package/2x/es/components/slider/slider.js +1 -1
- package/2x/es/components/slider/thumb.js +1 -1
- package/2x/es/index.d.ts +81 -1
- package/2x/es/index.js +1 -1
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +349 -230
- package/bundle/antd-mobile.cjs.js +8 -8
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +349 -230
- package/bundle/antd-mobile.es.js +6581 -6524
- package/bundle/antd-mobile.umd.development.js +349 -230
- package/bundle/antd-mobile.umd.js +8 -8
- package/bundle/style.css +1 -1
- package/cjs/components/cascader-view/cascader-view.d.ts +1 -1
- package/cjs/components/cascader-view/cascader-view.js +3 -4
- package/cjs/components/image-uploader/image-uploader.js +8 -7
- package/cjs/components/image-viewer/image-viewer.d.ts +1 -1
- package/cjs/components/image-viewer/slide.d.ts +1 -1
- package/cjs/components/image-viewer/slide.js +9 -2
- package/cjs/components/picker-view/picker-view.css +1 -0
- package/cjs/components/popup/popup.css +1 -0
- package/cjs/components/slider/slider.js +1 -1
- package/cjs/components/slider/thumb.js +3 -2
- package/cjs/index.d.ts +81 -1
- package/cjs/index.js +1 -1
- package/es/components/cascader-view/cascader-view.d.ts +1 -1
- package/es/components/cascader-view/cascader-view.js +3 -4
- package/es/components/image-uploader/image-uploader.js +8 -7
- package/es/components/image-viewer/image-viewer.d.ts +1 -1
- package/es/components/image-viewer/slide.d.ts +1 -1
- package/es/components/image-viewer/slide.js +9 -2
- package/es/components/picker-view/picker-view.css +1 -0
- package/es/components/popup/popup.css +1 -0
- package/es/components/slider/slider.js +1 -1
- package/es/components/slider/thumb.js +1 -1
- package/es/index.d.ts +81 -1
- package/es/index.js +1 -1
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
- package/2x/bundle/css-vars-patch.css +0 -399
- package/bundle/css-vars-patch.css +0 -312
package/2x/bundle/style.css
CHANGED
|
@@ -223,6 +223,7 @@ div.adm-px-tester {
|
|
|
223
223
|
cursor: pointer;
|
|
224
224
|
padding: 8px;
|
|
225
225
|
font-size: 36px;
|
|
226
|
+
line-height: 1;
|
|
226
227
|
color: var(--adm-color-weak);
|
|
227
228
|
}
|
|
228
229
|
|
|
@@ -913,6 +914,7 @@ div.adm-px-tester {
|
|
|
913
914
|
display: flex;
|
|
914
915
|
flex-direction: column;
|
|
915
916
|
position: relative;
|
|
917
|
+
top: calc(var(--item-height) * -1);
|
|
916
918
|
z-index: 0;
|
|
917
919
|
padding-bottom: 2px;
|
|
918
920
|
}
|
|
@@ -16,7 +16,7 @@ export declare type CascaderViewProps = {
|
|
|
16
16
|
value?: CascaderValue[];
|
|
17
17
|
defaultValue?: CascaderValue[];
|
|
18
18
|
onChange?: (value: CascaderValue[], extend: CascaderValueExtend) => void;
|
|
19
|
-
placeholder?: string;
|
|
19
|
+
placeholder?: string | ((index: number) => string);
|
|
20
20
|
onTabsChange?: (index: number) => void;
|
|
21
21
|
activeIcon?: ReactNode;
|
|
22
22
|
} & NativeProps<'--height'>;
|
|
@@ -27,9 +27,8 @@ const CascaderView = p => {
|
|
|
27
27
|
const {
|
|
28
28
|
locale
|
|
29
29
|
} = (0, _configProvider.useConfig)();
|
|
30
|
-
const props = (0, _withDefaultProps.mergeProps)(defaultProps,
|
|
31
|
-
|
|
32
|
-
}, p);
|
|
30
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
31
|
+
const placeholder = props.placeholder || locale.Cascader.placeholder;
|
|
33
32
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(Object.assign(Object.assign({}, props), {
|
|
34
33
|
onChange: val => {
|
|
35
34
|
var _a;
|
|
@@ -98,7 +97,7 @@ const CascaderView = p => {
|
|
|
98
97
|
key: index.toString(),
|
|
99
98
|
title: _react.default.createElement("div", {
|
|
100
99
|
className: `${classPrefix}-header-title`
|
|
101
|
-
}, selected ? selected.label :
|
|
100
|
+
}, selected ? selected.label : typeof placeholder === 'function' ? placeholder(index) : placeholder),
|
|
102
101
|
forceRender: true
|
|
103
102
|
}, _react.default.createElement("div", {
|
|
104
103
|
className: `${classPrefix}-content`
|
|
@@ -67,6 +67,9 @@ const ImageUploader = p => {
|
|
|
67
67
|
return transformedFile;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
function getFinalTasks(tasks) {
|
|
71
|
+
return props.showFailed ? tasks : tasks.filter(task => task.status !== 'fail');
|
|
72
|
+
}
|
|
70
73
|
function onChange(e) {
|
|
71
74
|
var _a;
|
|
72
75
|
return (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
@@ -100,7 +103,7 @@ const ImageUploader = p => {
|
|
|
100
103
|
status: 'pending',
|
|
101
104
|
file
|
|
102
105
|
}));
|
|
103
|
-
setTasks(prev => [...prev, ...newTasks]);
|
|
106
|
+
setTasks(prev => [...getFinalTasks(prev), ...newTasks]);
|
|
104
107
|
yield Promise.all(newTasks.map(currentTask => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
105
108
|
try {
|
|
106
109
|
const result = yield props.upload(currentTask.file);
|
|
@@ -149,7 +152,8 @@ const ImageUploader = p => {
|
|
|
149
152
|
var _a;
|
|
150
153
|
(_a = imageViewerHandlerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
151
154
|
});
|
|
152
|
-
const
|
|
155
|
+
const finalTasks = getFinalTasks(tasks);
|
|
156
|
+
const showUpload = props.showUpload && (maxCount === 0 || value.length + finalTasks.length < maxCount);
|
|
153
157
|
const renderImages = () => {
|
|
154
158
|
return value.map((fileItem, index) => {
|
|
155
159
|
var _a, _b;
|
|
@@ -180,10 +184,7 @@ const ImageUploader = p => {
|
|
|
180
184
|
className: `${classPrefix}-space`,
|
|
181
185
|
wrap: true,
|
|
182
186
|
block: true
|
|
183
|
-
}, renderImages(),
|
|
184
|
-
if (!props.showFailed && task.status === 'fail') {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
+
}, renderImages(), finalTasks.map(task => {
|
|
187
188
|
return _react.default.createElement(_previewItem.default, {
|
|
188
189
|
key: task.id,
|
|
189
190
|
file: task.file,
|
|
@@ -191,7 +192,7 @@ const ImageUploader = p => {
|
|
|
191
192
|
status: task.status,
|
|
192
193
|
imageFit: props.imageFit,
|
|
193
194
|
onDelete: () => {
|
|
194
|
-
setTasks(
|
|
195
|
+
setTasks(prev => prev.filter(x => x.id !== task.id));
|
|
195
196
|
}
|
|
196
197
|
});
|
|
197
198
|
}), showUpload && _react.default.createElement("div", {
|
|
@@ -3,7 +3,7 @@ import { GetContainer } from '../../utils/render-to-container';
|
|
|
3
3
|
import { SlidesRef } from './slides';
|
|
4
4
|
export declare type ImageViewerProps = {
|
|
5
5
|
image?: string;
|
|
6
|
-
maxZoom?: number;
|
|
6
|
+
maxZoom?: number | 'auto';
|
|
7
7
|
getContainer?: GetContainer;
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
onClose?: () => void;
|
|
@@ -16,7 +16,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
const classPrefix = `adm-image-viewer`;
|
|
17
17
|
const Slide = props => {
|
|
18
18
|
const {
|
|
19
|
-
dragLockRef
|
|
19
|
+
dragLockRef,
|
|
20
|
+
maxZoom
|
|
20
21
|
} = props;
|
|
21
22
|
const controlRef = (0, _react.useRef)(null);
|
|
22
23
|
const imgRef = (0, _react.useRef)(null);
|
|
@@ -98,7 +99,13 @@ const Slide = props => {
|
|
|
98
99
|
pinchLockRef.current = !state.last;
|
|
99
100
|
const [d] = state.offset;
|
|
100
101
|
if (d < 0) return;
|
|
101
|
-
|
|
102
|
+
let mergedMaxZoom;
|
|
103
|
+
if (maxZoom === 'auto') {
|
|
104
|
+
mergedMaxZoom = controlSize && imgSize ? Math.max(controlSize.height / imgSize.height, controlSize.width / imgSize.width) : 1;
|
|
105
|
+
} else {
|
|
106
|
+
mergedMaxZoom = maxZoom;
|
|
107
|
+
}
|
|
108
|
+
const nextZoom = state.last ? (0, _bound.bound)(d, 1, mergedMaxZoom) : d;
|
|
102
109
|
(_a = props.onZoomChange) === null || _a === void 0 ? void 0 : _a.call(props, nextZoom);
|
|
103
110
|
if (state.last && nextZoom <= 1) {
|
|
104
111
|
api.start({
|
|
@@ -84,7 +84,7 @@ const Slider = p => {
|
|
|
84
84
|
return Object.keys(marks).map(parseFloat).sort((a, b) => a - b);
|
|
85
85
|
} else {
|
|
86
86
|
const points = [];
|
|
87
|
-
for (let i = (0, _big.default)(min); i.
|
|
87
|
+
for (let i = (0, _big.default)(min); i.lte(max); i = i.plus(step)) {
|
|
88
88
|
points.push(i.toNumber());
|
|
89
89
|
}
|
|
90
90
|
return points;
|
|
@@ -7,8 +7,9 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _react2 = require("@use-gesture/react");
|
|
9
9
|
var _thumbIcon = require("./thumb-icon");
|
|
10
|
-
var _popover = require("../popover
|
|
10
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
11
11
|
var _configProvider = require("../config-provider");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
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); }
|
|
13
14
|
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; }
|
|
14
15
|
const classPrefix = `adm-slider`;
|
|
@@ -67,7 +68,7 @@ const Thumb = props => {
|
|
|
67
68
|
"aria-valuemin": min,
|
|
68
69
|
"aria-valuenow": value,
|
|
69
70
|
"aria-disabled": disabled
|
|
70
|
-
}), renderPopoverContent ? _react.default.createElement(_popover.
|
|
71
|
+
}), renderPopoverContent ? _react.default.createElement(_popover.default, {
|
|
71
72
|
content: renderPopoverContent(value),
|
|
72
73
|
placement: 'top',
|
|
73
74
|
visible: residentPopover || dragging,
|
package/2x/cjs/index.d.ts
CHANGED
|
@@ -1,84 +1,164 @@
|
|
|
1
1
|
import './global';
|
|
2
2
|
export { setDefaultConfig } from './components/config-provider';
|
|
3
3
|
export { default as ActionSheet } from './components/action-sheet';
|
|
4
|
+
export type { ActionSheetProps } from './components/action-sheet';
|
|
4
5
|
export { default as AutoCenter } from './components/auto-center';
|
|
6
|
+
export type { AutoCenterProps } from './components/auto-center';
|
|
5
7
|
export { default as Avatar } from './components/avatar';
|
|
8
|
+
export type { AvatarProps } from './components/avatar';
|
|
6
9
|
export { default as Badge } from './components/badge';
|
|
10
|
+
export type { BadgeProps } from './components/badge';
|
|
7
11
|
export { default as Button } from './components/button';
|
|
12
|
+
export type { ButtonProps, ButtonRef } from './components/button';
|
|
8
13
|
export { default as Calendar } from './components/calendar';
|
|
14
|
+
export type { CalendarProps, CalendarRef } from './components/calendar';
|
|
9
15
|
export { default as CapsuleTabs } from './components/capsule-tabs';
|
|
16
|
+
export type { CapsuleTabsProps, CapsuleTabProps, } from './components/capsule-tabs';
|
|
10
17
|
export { default as Card } from './components/card';
|
|
18
|
+
export type { CardProps } from './components/card';
|
|
11
19
|
export { default as CascadePicker } from './components/cascade-picker';
|
|
20
|
+
export type { CascadePickerProps, CascadePickerOption, CascadePickerRef, } from './components/cascade-picker';
|
|
12
21
|
export { default as CascadePickerView } from './components/cascade-picker-view';
|
|
22
|
+
export type { CascadePickerViewProps } from './components/cascade-picker-view';
|
|
13
23
|
export { default as Cascader } from './components/cascader';
|
|
24
|
+
export type { CascaderProps, CascaderRef } from './components/cascader';
|
|
14
25
|
export { default as CascaderView } from './components/cascader-view';
|
|
26
|
+
export type { CascaderViewProps, CascaderOption, } from './components/cascader-view';
|
|
15
27
|
export { default as CenterPopup } from './components/center-popup';
|
|
28
|
+
export type { CenterPopupProps } from './components/center-popup';
|
|
16
29
|
export { default as CheckList } from './components/check-list';
|
|
30
|
+
export type { CheckListProps, CheckListItemProps, } from './components/check-list';
|
|
17
31
|
export { default as Checkbox } from './components/checkbox';
|
|
32
|
+
export type { CheckboxProps, CheckboxGroupProps, CheckboxRef, } from './components/checkbox';
|
|
18
33
|
export { default as Collapse } from './components/collapse';
|
|
34
|
+
export type { CollapseProps, CollapsePanelProps } from './components/collapse';
|
|
19
35
|
export { default as ConfigProvider } from './components/config-provider';
|
|
36
|
+
export type { ConfigProviderProps } from './components/config-provider';
|
|
20
37
|
export { default as DatePicker } from './components/date-picker';
|
|
38
|
+
export type { DatePickerProps, DatePickerRef } from './components/date-picker';
|
|
21
39
|
export { default as DatePickerView } from './components/date-picker-view';
|
|
40
|
+
export type { DatePickerViewProps } from './components/date-picker-view';
|
|
22
41
|
export { default as Dialog } from './components/dialog';
|
|
42
|
+
export type { DialogProps, DialogShowProps, DialogAlertProps, DialogConfirmProps, } from './components/dialog';
|
|
23
43
|
export { default as Divider } from './components/divider';
|
|
44
|
+
export type { DividerProps } from './components/divider';
|
|
24
45
|
export { default as DotLoading } from './components/dot-loading';
|
|
46
|
+
export type { DotLoadingProps } from './components/dot-loading';
|
|
25
47
|
export { default as Dropdown } from './components/dropdown';
|
|
48
|
+
export type { DropdownProps, DropdownItemProps, DropdownRef, } from './components/dropdown';
|
|
26
49
|
export { default as Ellipsis } from './components/ellipsis';
|
|
50
|
+
export type { EllipsisProps } from './components/ellipsis';
|
|
27
51
|
export { default as Empty } from './components/empty';
|
|
52
|
+
export type { EmptyProps } from './components/empty';
|
|
28
53
|
export { default as ErrorBlock } from './components/error-block';
|
|
54
|
+
export type { ErrorBlockProps, ErrorBlockStatus, } from './components/error-block';
|
|
29
55
|
export { default as FloatingBubble } from './components/floating-bubble';
|
|
56
|
+
export type { FloatingBubbleProps } from './components/floating-bubble';
|
|
30
57
|
export { default as FloatingPanel } from './components/floating-panel';
|
|
58
|
+
export type { FloatingPanelProps, FloatingPanelRef, } from './components/floating-panel';
|
|
31
59
|
export { default as Form } from './components/form';
|
|
60
|
+
export type { FormProps, FormItemProps } from './components/form';
|
|
32
61
|
export { default as Grid } from './components/grid';
|
|
62
|
+
export type { GridProps, GridItemProps } from './components/grid';
|
|
33
63
|
export { default as Image } from './components/image';
|
|
64
|
+
export type { ImageProps } from './components/image';
|
|
34
65
|
export { default as ImageUploader } from './components/image-uploader';
|
|
66
|
+
export type { ImageUploaderProps, ImageUploadItem, } from './components/image-uploader';
|
|
35
67
|
export { default as ImageViewer } from './components/image-viewer';
|
|
68
|
+
export type { ImageViewerProps, MultiImageViewerProps, MultiImageViewerRef, } from './components/image-viewer';
|
|
36
69
|
export { default as IndexBar } from './components/index-bar';
|
|
70
|
+
export type { IndexBarProps, IndexBarPanelProps, IndexBarRef, } from './components/index-bar';
|
|
37
71
|
export { default as InfiniteScroll } from './components/infinite-scroll';
|
|
72
|
+
export type { InfiniteScrollProps } from './components/infinite-scroll';
|
|
38
73
|
export { default as Input } from './components/input';
|
|
74
|
+
export type { InputProps, InputRef } from './components/input';
|
|
39
75
|
export { default as JumboTabs } from './components/jumbo-tabs';
|
|
76
|
+
export type { JumboTabsProps, JumboTabProps } from './components/jumbo-tabs';
|
|
40
77
|
export { default as List } from './components/list';
|
|
78
|
+
export type { ListProps, ListItemProps, ListRef } from './components/list';
|
|
41
79
|
export { default as Loading } from './components/loading';
|
|
80
|
+
export type { LoadingProps } from './components/loading';
|
|
42
81
|
export { default as Mask } from './components/mask';
|
|
82
|
+
export type { MaskProps } from './components/mask';
|
|
43
83
|
export { default as Modal } from './components/modal';
|
|
84
|
+
export type { ModalProps, ModalShowProps, ModalAlertProps, ModalConfirmProps, } from './components/modal';
|
|
44
85
|
export { default as NavBar } from './components/nav-bar';
|
|
86
|
+
export type { NavBarProps } from './components/nav-bar';
|
|
45
87
|
export { default as NoticeBar } from './components/notice-bar';
|
|
88
|
+
export type { NoticeBarProps } from './components/notice-bar';
|
|
46
89
|
export { default as NumberKeyboard } from './components/number-keyboard';
|
|
90
|
+
export type { NumberKeyboardProps } from './components/number-keyboard';
|
|
47
91
|
export { default as PageIndicator } from './components/page-indicator';
|
|
92
|
+
export type { PageIndicatorProps } from './components/page-indicator';
|
|
48
93
|
export { default as PasscodeInput } from './components/passcode-input';
|
|
94
|
+
export type { PasscodeInputProps, PasscodeInputRef, } from './components/passcode-input';
|
|
49
95
|
export { default as Picker } from './components/picker';
|
|
96
|
+
export type { PickerProps, PickerRef } from './components/picker';
|
|
50
97
|
export { default as PickerView } from './components/picker-view';
|
|
98
|
+
export type { PickerViewProps } from './components/picker-view';
|
|
51
99
|
export { default as Popover } from './components/popover';
|
|
100
|
+
export type { PopoverProps, PopoverMenuProps, PopoverRef, } from './components/popover';
|
|
52
101
|
export { default as Popup } from './components/popup';
|
|
102
|
+
export type { PopupProps } from './components/popup';
|
|
53
103
|
export { default as ProgressBar } from './components/progress-bar';
|
|
104
|
+
export type { ProgressBarProps } from './components/progress-bar';
|
|
54
105
|
export { default as ProgressCircle } from './components/progress-circle';
|
|
106
|
+
export type { ProgressCircleProps } from './components/progress-circle';
|
|
55
107
|
export { default as PullToRefresh } from './components/pull-to-refresh';
|
|
108
|
+
export type { PullToRefreshProps } from './components/pull-to-refresh';
|
|
56
109
|
export { default as Radio } from './components/radio';
|
|
110
|
+
export type { RadioProps, RadioGroupProps } from './components/radio';
|
|
57
111
|
export { default as Rate } from './components/rate';
|
|
112
|
+
export type { RateProps } from './components/rate';
|
|
58
113
|
export { default as Result } from './components/result';
|
|
114
|
+
export type { ResultProps } from './components/result';
|
|
59
115
|
export { default as ResultPage } from './components/result-page';
|
|
116
|
+
export type { ResultPageProps } from './components/result-page';
|
|
60
117
|
export { default as SafeArea } from './components/safe-area';
|
|
118
|
+
export type { SafeAreaProps } from './components/safe-area';
|
|
61
119
|
export { default as ScrollMask } from './components/scroll-mask';
|
|
120
|
+
export type { ScrollMaskProps } from './components/scroll-mask';
|
|
62
121
|
export { default as SearchBar } from './components/search-bar';
|
|
122
|
+
export type { SearchBarProps, SearchBarRef } from './components/search-bar';
|
|
63
123
|
export { default as Selector } from './components/selector';
|
|
124
|
+
export type { SelectorProps, SelectorOption } from './components/selector';
|
|
64
125
|
export { default as SideBar } from './components/side-bar';
|
|
126
|
+
export type { SideBarProps, SideBarItemProps } from './components/side-bar';
|
|
65
127
|
export { default as Skeleton } from './components/skeleton';
|
|
128
|
+
export type { SkeletonProps, SkeletonTitleProps } from './components/skeleton';
|
|
66
129
|
export { default as Slider } from './components/slider';
|
|
130
|
+
export type { SliderProps } from './components/slider';
|
|
67
131
|
export { default as Space } from './components/space';
|
|
132
|
+
export type { SpaceProps } from './components/space';
|
|
68
133
|
export { default as SpinLoading } from './components/spin-loading';
|
|
69
|
-
export {
|
|
134
|
+
export type { SpinLoadingProps } from './components/spin-loading';
|
|
135
|
+
export { default as Stepper } from './components/stepper';
|
|
136
|
+
export type { StepperProps } from './components/stepper';
|
|
70
137
|
export { default as Steps } from './components/steps';
|
|
138
|
+
export type { StepsProps, StepProps } from './components/steps';
|
|
71
139
|
export { default as SwipeAction } from './components/swipe-action';
|
|
140
|
+
export type { SwipeActionProps, SwipeActionRef, } from './components/swipe-action';
|
|
72
141
|
export { default as Swiper } from './components/swiper';
|
|
142
|
+
export type { SwiperProps, SwiperRef } from './components/swiper';
|
|
73
143
|
export { default as Switch } from './components/switch';
|
|
144
|
+
export type { SwitchProps } from './components/switch';
|
|
74
145
|
export { default as TabBar } from './components/tab-bar';
|
|
146
|
+
export type { TabBarProps, TabBarItemProps } from './components/tab-bar';
|
|
75
147
|
export { default as Tabs } from './components/tabs';
|
|
148
|
+
export type { TabsProps, TabProps } from './components/tabs';
|
|
76
149
|
export { default as Tag } from './components/tag';
|
|
150
|
+
export type { TagProps } from './components/tag';
|
|
77
151
|
export { default as TextArea } from './components/text-area';
|
|
152
|
+
export type { TextAreaProps, TextAreaRef } from './components/text-area';
|
|
78
153
|
export { default as Toast } from './components/toast';
|
|
154
|
+
export type { ToastShowProps } from './components/toast';
|
|
79
155
|
export { default as TreeSelect } from './components/tree-select';
|
|
156
|
+
export type { TreeSelectProps, TreeSelectOption, } from './components/tree-select';
|
|
80
157
|
export { default as VirtualInput } from './components/virtual-input';
|
|
158
|
+
export type { VirtualInputProps, VirtualInputRef, } from './components/virtual-input';
|
|
81
159
|
export { default as WaterMark } from './components/water-mark';
|
|
160
|
+
export type { WaterMarkProps } from './components/water-mark';
|
|
82
161
|
export { default as Footer } from './components/footer';
|
|
162
|
+
export type { FooterProps } from './components/footer';
|
|
83
163
|
export { createErrorBlock } from './components/error-block';
|
|
84
164
|
export { reduceMotion, restoreMotion } from './utils/reduce-and-restore-motion';
|
package/2x/cjs/index.js
CHANGED
|
@@ -574,7 +574,7 @@ var _skeleton = _interopRequireDefault(require("./components/skeleton"));
|
|
|
574
574
|
var _slider = _interopRequireDefault(require("./components/slider"));
|
|
575
575
|
var _space = _interopRequireDefault(require("./components/space"));
|
|
576
576
|
var _spinLoading = _interopRequireDefault(require("./components/spin-loading"));
|
|
577
|
-
var _stepper = _interopRequireDefault(require("./components
|
|
577
|
+
var _stepper = _interopRequireDefault(require("./components/stepper"));
|
|
578
578
|
var _steps = _interopRequireDefault(require("./components/steps"));
|
|
579
579
|
var _swipeAction = _interopRequireDefault(require("./components/swipe-action"));
|
|
580
580
|
var _swiper = _interopRequireDefault(require("./components/swiper"));
|
|
@@ -16,7 +16,7 @@ export declare type CascaderViewProps = {
|
|
|
16
16
|
value?: CascaderValue[];
|
|
17
17
|
defaultValue?: CascaderValue[];
|
|
18
18
|
onChange?: (value: CascaderValue[], extend: CascaderValueExtend) => void;
|
|
19
|
-
placeholder?: string;
|
|
19
|
+
placeholder?: string | ((index: number) => string);
|
|
20
20
|
onTabsChange?: (index: number) => void;
|
|
21
21
|
activeIcon?: ReactNode;
|
|
22
22
|
} & NativeProps<'--height'>;
|
|
@@ -18,9 +18,8 @@ export const CascaderView = p => {
|
|
|
18
18
|
const {
|
|
19
19
|
locale
|
|
20
20
|
} = useConfig();
|
|
21
|
-
const props = mergeProps(defaultProps,
|
|
22
|
-
|
|
23
|
-
}, p);
|
|
21
|
+
const props = mergeProps(defaultProps, p);
|
|
22
|
+
const placeholder = props.placeholder || locale.Cascader.placeholder;
|
|
24
23
|
const [value, setValue] = usePropsValue(Object.assign(Object.assign({}, props), {
|
|
25
24
|
onChange: val => {
|
|
26
25
|
var _a;
|
|
@@ -89,7 +88,7 @@ export const CascaderView = p => {
|
|
|
89
88
|
key: index.toString(),
|
|
90
89
|
title: React.createElement("div", {
|
|
91
90
|
className: `${classPrefix}-header-title`
|
|
92
|
-
}, selected ? selected.label :
|
|
91
|
+
}, selected ? selected.label : typeof placeholder === 'function' ? placeholder(index) : placeholder),
|
|
93
92
|
forceRender: true
|
|
94
93
|
}, React.createElement("div", {
|
|
95
94
|
className: `${classPrefix}-content`
|
|
@@ -58,6 +58,9 @@ export const ImageUploader = p => {
|
|
|
58
58
|
return transformedFile;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
+
function getFinalTasks(tasks) {
|
|
62
|
+
return props.showFailed ? tasks : tasks.filter(task => task.status !== 'fail');
|
|
63
|
+
}
|
|
61
64
|
function onChange(e) {
|
|
62
65
|
var _a;
|
|
63
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -91,7 +94,7 @@ export const ImageUploader = p => {
|
|
|
91
94
|
status: 'pending',
|
|
92
95
|
file
|
|
93
96
|
}));
|
|
94
|
-
setTasks(prev => [...prev, ...newTasks]);
|
|
97
|
+
setTasks(prev => [...getFinalTasks(prev), ...newTasks]);
|
|
95
98
|
yield Promise.all(newTasks.map(currentTask => __awaiter(this, void 0, void 0, function* () {
|
|
96
99
|
try {
|
|
97
100
|
const result = yield props.upload(currentTask.file);
|
|
@@ -140,7 +143,8 @@ export const ImageUploader = p => {
|
|
|
140
143
|
var _a;
|
|
141
144
|
(_a = imageViewerHandlerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
142
145
|
});
|
|
143
|
-
const
|
|
146
|
+
const finalTasks = getFinalTasks(tasks);
|
|
147
|
+
const showUpload = props.showUpload && (maxCount === 0 || value.length + finalTasks.length < maxCount);
|
|
144
148
|
const renderImages = () => {
|
|
145
149
|
return value.map((fileItem, index) => {
|
|
146
150
|
var _a, _b;
|
|
@@ -171,10 +175,7 @@ export const ImageUploader = p => {
|
|
|
171
175
|
className: `${classPrefix}-space`,
|
|
172
176
|
wrap: true,
|
|
173
177
|
block: true
|
|
174
|
-
}, renderImages(),
|
|
175
|
-
if (!props.showFailed && task.status === 'fail') {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
+
}, renderImages(), finalTasks.map(task => {
|
|
178
179
|
return React.createElement(PreviewItem, {
|
|
179
180
|
key: task.id,
|
|
180
181
|
file: task.file,
|
|
@@ -182,7 +183,7 @@ export const ImageUploader = p => {
|
|
|
182
183
|
status: task.status,
|
|
183
184
|
imageFit: props.imageFit,
|
|
184
185
|
onDelete: () => {
|
|
185
|
-
setTasks(
|
|
186
|
+
setTasks(prev => prev.filter(x => x.id !== task.id));
|
|
186
187
|
}
|
|
187
188
|
});
|
|
188
189
|
}), showUpload && React.createElement("div", {
|
|
@@ -3,7 +3,7 @@ import { GetContainer } from '../../utils/render-to-container';
|
|
|
3
3
|
import { SlidesRef } from './slides';
|
|
4
4
|
export declare type ImageViewerProps = {
|
|
5
5
|
image?: string;
|
|
6
|
-
maxZoom?: number;
|
|
6
|
+
maxZoom?: number | 'auto';
|
|
7
7
|
getContainer?: GetContainer;
|
|
8
8
|
visible?: boolean;
|
|
9
9
|
onClose?: () => void;
|
|
@@ -8,7 +8,8 @@ import * as mat from '../../utils/matrix';
|
|
|
8
8
|
const classPrefix = `adm-image-viewer`;
|
|
9
9
|
export const Slide = props => {
|
|
10
10
|
const {
|
|
11
|
-
dragLockRef
|
|
11
|
+
dragLockRef,
|
|
12
|
+
maxZoom
|
|
12
13
|
} = props;
|
|
13
14
|
const controlRef = useRef(null);
|
|
14
15
|
const imgRef = useRef(null);
|
|
@@ -90,7 +91,13 @@ export const Slide = props => {
|
|
|
90
91
|
pinchLockRef.current = !state.last;
|
|
91
92
|
const [d] = state.offset;
|
|
92
93
|
if (d < 0) return;
|
|
93
|
-
|
|
94
|
+
let mergedMaxZoom;
|
|
95
|
+
if (maxZoom === 'auto') {
|
|
96
|
+
mergedMaxZoom = controlSize && imgSize ? Math.max(controlSize.height / imgSize.height, controlSize.width / imgSize.width) : 1;
|
|
97
|
+
} else {
|
|
98
|
+
mergedMaxZoom = maxZoom;
|
|
99
|
+
}
|
|
100
|
+
const nextZoom = state.last ? bound(d, 1, mergedMaxZoom) : d;
|
|
94
101
|
(_a = props.onZoomChange) === null || _a === void 0 ? void 0 : _a.call(props, nextZoom);
|
|
95
102
|
if (state.last && nextZoom <= 1) {
|
|
96
103
|
api.start({
|
|
@@ -75,7 +75,7 @@ export const Slider = p => {
|
|
|
75
75
|
return Object.keys(marks).map(parseFloat).sort((a, b) => a - b);
|
|
76
76
|
} else {
|
|
77
77
|
const points = [];
|
|
78
|
-
for (let i = Big(min); i.
|
|
78
|
+
for (let i = Big(min); i.lte(max); i = i.plus(step)) {
|
|
79
79
|
points.push(i.toNumber());
|
|
80
80
|
}
|
|
81
81
|
return points;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import { useDrag } from '@use-gesture/react';
|
|
3
3
|
import { ThumbIcon } from './thumb-icon';
|
|
4
|
-
import
|
|
4
|
+
import Popover from '../popover';
|
|
5
5
|
import { useConfig } from '../config-provider';
|
|
6
6
|
const classPrefix = `adm-slider`;
|
|
7
7
|
const Thumb = props => {
|