antd-mobile 5.9.5 → 5.10.2
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/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/2x/cjs/components/collapse/collapse.js +3 -3
- package/2x/cjs/components/divider/divider.css +19 -8
- package/2x/cjs/components/divider/divider.d.ts +1 -0
- package/2x/cjs/components/divider/divider.js +3 -2
- package/2x/cjs/components/form/form.js +3 -2
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +6 -2
- package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/cjs/components/image-uploader/preview-item.js +3 -2
- package/2x/cjs/components/index-bar/index-bar.js +3 -3
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/2x/cjs/components/mask/mask.css +1 -0
- package/2x/cjs/components/mask/mask.js +8 -1
- package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/2x/cjs/components/picker-view/wheel.js +3 -1
- package/2x/cjs/components/popover/popover-menu.js +2 -1
- package/2x/cjs/components/safe-area/safe-area.css +2 -2
- package/2x/cjs/components/side-bar/side-bar.js +3 -3
- package/2x/cjs/components/stepper/stepper.js +16 -9
- package/2x/cjs/components/swiper/swiper.js +1 -0
- package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
- package/2x/cjs/components/tabs/tabs.js +3 -3
- package/2x/cjs/components/tree-select/multiple.js +2 -1
- package/2x/cjs/global/global.css +1 -0
- package/2x/cjs/global/theme.css +1 -0
- package/2x/cjs/locales/ko-KR.d.ts +102 -0
- package/2x/cjs/locales/ko-KR.js +115 -0
- package/2x/cjs/locales/zh-HK.js +56 -0
- package/2x/cjs/locales/zh-TW.js +56 -0
- package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
- package/2x/cjs/utils/traverse-react-node.js +29 -0
- package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/2x/es/components/collapse/collapse.js +2 -1
- package/2x/es/components/divider/divider.css +19 -8
- package/2x/es/components/divider/divider.d.ts +1 -0
- package/2x/es/components/divider/divider.js +3 -2
- package/2x/es/components/form/form.js +2 -1
- package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/es/components/image-uploader/image-uploader.js +6 -2
- package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/es/components/image-uploader/preview-item.js +3 -2
- package/2x/es/components/index-bar/index-bar.js +2 -1
- package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/2x/es/components/mask/mask.css +1 -0
- package/2x/es/components/mask/mask.js +8 -1
- package/2x/es/components/picker-view/picker-view.d.ts +1 -0
- package/2x/es/components/picker-view/wheel.js +3 -1
- package/2x/es/components/popover/popover-menu.js +2 -1
- package/2x/es/components/safe-area/safe-area.css +2 -2
- package/2x/es/components/side-bar/side-bar.js +2 -1
- package/2x/es/components/stepper/stepper.js +15 -9
- package/2x/es/components/swiper/swiper.js +1 -0
- package/2x/es/components/tab-bar/tab-bar.js +2 -1
- package/2x/es/components/tabs/tabs.js +2 -1
- package/2x/es/components/tree-select/multiple.js +2 -1
- package/2x/es/global/global.css +1 -0
- package/2x/es/global/theme.css +1 -0
- package/2x/es/locales/ko-KR.d.ts +102 -0
- package/2x/es/locales/ko-KR.js +105 -0
- package/2x/es/locales/zh-HK.js +56 -0
- package/2x/es/locales/zh-TW.js +56 -0
- package/2x/es/utils/traverse-react-node.d.ts +2 -0
- package/2x/es/utils/traverse-react-node.js +18 -0
- package/2x/package.json +5 -1
- package/bundle/antd-mobile.cjs.js +60 -25
- package/bundle/antd-mobile.es.js +59 -25
- package/bundle/style.css +22 -10
- package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/cjs/components/collapse/collapse.js +3 -3
- package/cjs/components/divider/divider.css +18 -8
- package/cjs/components/divider/divider.d.ts +1 -0
- package/cjs/components/divider/divider.js +3 -2
- package/cjs/components/form/form.js +3 -2
- package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/cjs/components/image-uploader/image-uploader.js +6 -2
- package/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/cjs/components/image-uploader/preview-item.js +3 -2
- package/cjs/components/index-bar/index-bar.js +3 -3
- package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/cjs/components/mask/mask.css +1 -0
- package/cjs/components/mask/mask.js +8 -1
- package/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/cjs/components/picker-view/wheel.js +3 -1
- package/cjs/components/popover/popover-menu.js +2 -1
- package/cjs/components/safe-area/safe-area.css +2 -2
- package/cjs/components/side-bar/side-bar.js +3 -3
- package/cjs/components/stepper/stepper.js +16 -9
- package/cjs/components/swiper/swiper.js +1 -0
- package/cjs/components/tab-bar/tab-bar.js +3 -3
- package/cjs/components/tabs/tabs.js +3 -3
- package/cjs/components/tree-select/multiple.js +2 -1
- package/cjs/global/global.css +1 -0
- package/cjs/global/theme.css +1 -0
- package/cjs/locales/ko-KR.d.ts +102 -0
- package/cjs/locales/ko-KR.js +115 -0
- package/cjs/locales/zh-HK.js +56 -0
- package/cjs/locales/zh-TW.js +56 -0
- package/cjs/utils/traverse-react-node.d.ts +2 -0
- package/cjs/utils/traverse-react-node.js +29 -0
- package/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/es/components/collapse/collapse.js +2 -1
- package/es/components/divider/divider.css +18 -8
- package/es/components/divider/divider.d.ts +1 -0
- package/es/components/divider/divider.js +3 -2
- package/es/components/form/form.js +2 -1
- package/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/es/components/image-uploader/image-uploader.js +6 -2
- package/es/components/image-uploader/preview-item.d.ts +2 -0
- package/es/components/image-uploader/preview-item.js +3 -2
- package/es/components/index-bar/index-bar.js +2 -1
- package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/es/components/mask/mask.css +1 -0
- package/es/components/mask/mask.js +8 -1
- package/es/components/picker-view/picker-view.d.ts +1 -0
- package/es/components/picker-view/wheel.js +3 -1
- package/es/components/popover/popover-menu.js +2 -1
- package/es/components/safe-area/safe-area.css +2 -2
- package/es/components/side-bar/side-bar.js +2 -1
- package/es/components/stepper/stepper.js +15 -9
- package/es/components/swiper/swiper.js +1 -0
- package/es/components/tab-bar/tab-bar.js +2 -1
- package/es/components/tabs/tabs.js +2 -1
- package/es/components/tree-select/multiple.js +2 -1
- package/es/global/global.css +1 -0
- package/es/global/theme.css +1 -0
- package/es/locales/ko-KR.d.ts +102 -0
- package/es/locales/ko-KR.js +105 -0
- package/es/locales/zh-HK.js +56 -0
- package/es/locales/zh-TW.js +56 -0
- package/es/utils/traverse-react-node.d.ts +2 -0
- package/es/utils/traverse-react-node.js +18 -0
- package/package.json +5 -1
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +9 -0
|
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
|
|
|
23
23
|
|
|
24
24
|
var _shouldRender = require("../../utils/should-render");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
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); }
|
|
@@ -45,8 +47,7 @@ const CapsuleTabs = props => {
|
|
|
45
47
|
const keyToIndexRecord = {};
|
|
46
48
|
let firstActiveKey = null;
|
|
47
49
|
const panes = [];
|
|
48
|
-
|
|
49
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
50
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
50
51
|
if (!_react.default.isValidElement(child)) return;
|
|
51
52
|
const key = child.key;
|
|
52
53
|
if (typeof key !== 'string') return;
|
|
@@ -58,7 +59,6 @@ const CapsuleTabs = props => {
|
|
|
58
59
|
const length = panes.push(child);
|
|
59
60
|
keyToIndexRecord[key] = length - 1;
|
|
60
61
|
});
|
|
61
|
-
|
|
62
62
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
63
63
|
value: props.activeKey,
|
|
64
64
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -25,6 +25,8 @@ var _shouldRender = require("../../utils/should-render");
|
|
|
25
25
|
|
|
26
26
|
var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
|
|
27
27
|
|
|
28
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
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); }
|
|
@@ -107,14 +109,12 @@ const Collapse = props => {
|
|
|
107
109
|
var _a;
|
|
108
110
|
|
|
109
111
|
const panels = [];
|
|
110
|
-
|
|
111
|
-
_react.default.Children.forEach(props.children, child => {
|
|
112
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
112
113
|
if (!_react.default.isValidElement(child)) return;
|
|
113
114
|
const key = child.key;
|
|
114
115
|
if (typeof key !== 'string') return;
|
|
115
116
|
panels.push(child);
|
|
116
117
|
});
|
|
117
|
-
|
|
118
118
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)(props.accordion ? {
|
|
119
119
|
value: props.activeKey === undefined ? undefined : props.activeKey === null ? [] : [props.activeKey],
|
|
120
120
|
defaultValue: props.defaultActiveKey === undefined || props.defaultActiveKey === null ? [] : [props.defaultActiveKey],
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
.adm-divider {
|
|
1
|
+
.adm-divider-horizontal {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
margin: 32px 0;
|
|
5
|
-
color: var(--adm-color-weak);
|
|
6
|
-
font-size: 28px;
|
|
7
5
|
border-width: 0;
|
|
8
6
|
border-color: var(--adm-border-color);
|
|
9
7
|
border-style: solid;
|
|
8
|
+
color: var(--adm-color-weak);
|
|
9
|
+
font-size: 28px;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.adm-divider-left.adm-divider::before {
|
|
12
|
+
.adm-divider-left.adm-divider-horizontal::before {
|
|
13
13
|
max-width: 10%;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.adm-divider-right.adm-divider::after {
|
|
16
|
+
.adm-divider-right.adm-divider-horizontal::after {
|
|
17
17
|
max-width: 10%;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.adm-divider::after,
|
|
21
|
-
.adm-divider::before {
|
|
20
|
+
.adm-divider-horizontal::after,
|
|
21
|
+
.adm-divider-horizontal::before {
|
|
22
22
|
flex: auto;
|
|
23
23
|
display: block;
|
|
24
24
|
content: '';
|
|
@@ -27,7 +27,18 @@
|
|
|
27
27
|
border-width: 2px 0 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.adm-divider-content {
|
|
30
|
+
.adm-divider-horizontal .adm-divider-content {
|
|
31
31
|
flex: none;
|
|
32
32
|
padding: 0 32px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.adm-divider-vertical {
|
|
36
|
+
position: relative;
|
|
37
|
+
top: -0.06em;
|
|
38
|
+
display: inline-block;
|
|
39
|
+
height: 0.9em;
|
|
40
|
+
margin: 0 32px;
|
|
41
|
+
vertical-align: middle;
|
|
42
|
+
border-top: 0;
|
|
43
|
+
border-left: 2px solid var(--adm-border-color);
|
|
33
44
|
}
|
|
@@ -2,5 +2,6 @@ import { FC } from 'react';
|
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type DividerProps = {
|
|
4
4
|
contentPosition?: 'left' | 'right' | 'center';
|
|
5
|
+
direction?: 'horizontal' | 'vertical';
|
|
5
6
|
} & NativeProps;
|
|
6
7
|
export declare const Divider: FC<DividerProps>;
|
|
@@ -17,13 +17,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
|
|
18
18
|
const classPrefix = `adm-divider`;
|
|
19
19
|
const defaultProps = {
|
|
20
|
-
contentPosition: 'center'
|
|
20
|
+
contentPosition: 'center',
|
|
21
|
+
direction: 'horizontal'
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const Divider = p => {
|
|
24
25
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
25
26
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
26
|
-
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${props.contentPosition}`)
|
|
27
|
+
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${props.direction}`, `${classPrefix}-${props.contentPosition}`)
|
|
27
28
|
}, props.children && _react.default.createElement("div", {
|
|
28
29
|
className: `${classPrefix}-content`
|
|
29
30
|
}, props.children)));
|
|
@@ -27,6 +27,8 @@ var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
|
27
27
|
|
|
28
28
|
var _formArray = require("./form-array");
|
|
29
29
|
|
|
30
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
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); }
|
|
@@ -68,7 +70,7 @@ const Form = (0, _react.forwardRef)((p, ref) => {
|
|
|
68
70
|
items = [];
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
72
74
|
if (_react.default.isValidElement(child)) {
|
|
73
75
|
if (child.type === _header.Header) {
|
|
74
76
|
collect();
|
|
@@ -85,7 +87,6 @@ const Form = (0, _react.forwardRef)((p, ref) => {
|
|
|
85
87
|
|
|
86
88
|
items.push(child);
|
|
87
89
|
});
|
|
88
|
-
|
|
89
90
|
collect();
|
|
90
91
|
return _react.default.createElement(_rcFieldForm.default, Object.assign({
|
|
91
92
|
className: (0, _classnames.default)(classPrefix, className),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, InputHTMLAttributes } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
export declare type TaskStatus = 'pending' | 'fail';
|
|
4
5
|
export interface ImageUploadItem {
|
|
5
6
|
key?: string | number;
|
|
@@ -25,5 +26,6 @@ export declare type ImageUploaderProps = {
|
|
|
25
26
|
onDelete?: (item: ImageUploadItem) => boolean | Promise<boolean> | void;
|
|
26
27
|
preview?: boolean;
|
|
27
28
|
showFailed?: boolean;
|
|
29
|
+
imageFit?: ImageProps['fit'];
|
|
28
30
|
} & NativeProps<'--cell-size'>;
|
|
29
31
|
export declare const ImageUploader: FC<ImageUploaderProps>;
|
|
@@ -41,7 +41,8 @@ const defaultProps = {
|
|
|
41
41
|
defaultValue: [],
|
|
42
42
|
accept: 'image/*',
|
|
43
43
|
preview: true,
|
|
44
|
-
showFailed: true
|
|
44
|
+
showFailed: true,
|
|
45
|
+
imageFit: 'cover'
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const ImageUploader = p => {
|
|
@@ -113,6 +114,8 @@ const ImageUploader = p => {
|
|
|
113
114
|
file
|
|
114
115
|
}));
|
|
115
116
|
setTasks(prev => [...prev, ...newTasks]);
|
|
117
|
+
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
118
|
+
|
|
116
119
|
yield Promise.all(newTasks.map(currentTask => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
117
120
|
try {
|
|
118
121
|
const result = yield props.upload(currentTask.file);
|
|
@@ -146,7 +149,6 @@ const ImageUploader = p => {
|
|
|
146
149
|
throw e;
|
|
147
150
|
}
|
|
148
151
|
}))).catch(error => console.error(error));
|
|
149
|
-
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
150
152
|
});
|
|
151
153
|
}
|
|
152
154
|
|
|
@@ -181,6 +183,7 @@ const ImageUploader = p => {
|
|
|
181
183
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
|
|
182
184
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
183
185
|
deletable: props.deletable,
|
|
186
|
+
imageFit: props.imageFit,
|
|
184
187
|
onClick: () => {
|
|
185
188
|
if (props.preview) {
|
|
186
189
|
previewImage(index);
|
|
@@ -206,6 +209,7 @@ const ImageUploader = p => {
|
|
|
206
209
|
file: task.file,
|
|
207
210
|
deletable: task.status !== 'pending',
|
|
208
211
|
status: task.status,
|
|
212
|
+
imageFit: props.imageFit,
|
|
209
213
|
onDelete: () => {
|
|
210
214
|
setTasks(tasks.filter(x => x.id !== task.id));
|
|
211
215
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TaskStatus } from './image-uploader';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
declare type Props = {
|
|
4
5
|
onClick?: () => void;
|
|
5
6
|
onDelete?: () => void;
|
|
@@ -7,6 +8,7 @@ declare type Props = {
|
|
|
7
8
|
url?: string;
|
|
8
9
|
file?: File;
|
|
9
10
|
status?: TaskStatus;
|
|
11
|
+
imageFit: ImageProps['fit'];
|
|
10
12
|
};
|
|
11
13
|
declare const PreviewItem: FC<Props>;
|
|
12
14
|
export default PreviewItem;
|
|
@@ -33,7 +33,8 @@ const PreviewItem = props => {
|
|
|
33
33
|
url,
|
|
34
34
|
file,
|
|
35
35
|
deletable,
|
|
36
|
-
onDelete
|
|
36
|
+
onDelete,
|
|
37
|
+
imageFit
|
|
37
38
|
} = props;
|
|
38
39
|
const src = (0, _react.useMemo)(() => {
|
|
39
40
|
if (url) {
|
|
@@ -73,7 +74,7 @@ const PreviewItem = props => {
|
|
|
73
74
|
}, _react.default.createElement(_image.default, {
|
|
74
75
|
className: `${classPrefix}-cell-image`,
|
|
75
76
|
src: src,
|
|
76
|
-
fit:
|
|
77
|
+
fit: imageFit,
|
|
77
78
|
onClick: props.onClick
|
|
78
79
|
}), renderLoading(), renderDelete());
|
|
79
80
|
};
|
|
@@ -23,6 +23,8 @@ var _panel = require("./panel");
|
|
|
23
23
|
|
|
24
24
|
var _devLog = require("../../utils/dev-log");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
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); }
|
|
@@ -39,8 +41,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
39
41
|
const bodyRef = (0, _react.useRef)(null);
|
|
40
42
|
const indexItems = [];
|
|
41
43
|
const panels = [];
|
|
42
|
-
|
|
43
|
-
_react.default.Children.forEach(props.children, child => {
|
|
44
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
44
45
|
var _a;
|
|
45
46
|
|
|
46
47
|
if (!_react.default.isValidElement(child)) return;
|
|
@@ -62,7 +63,6 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
62
63
|
className: `${classPrefix}-anchor-title`
|
|
63
64
|
}, child.props.title || child.props.index), child.props.children)));
|
|
64
65
|
});
|
|
65
|
-
|
|
66
66
|
const [activeIndex, setActiveIndex] = (0, _react.useState)(() => {
|
|
67
67
|
const firstItem = indexItems[0];
|
|
68
68
|
return firstItem ? firstItem.index : null;
|
|
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
|
|
|
23
23
|
|
|
24
24
|
var _shouldRender = require("../../utils/should-render");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
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); }
|
|
@@ -45,8 +47,7 @@ const JumboTabs = props => {
|
|
|
45
47
|
const keyToIndexRecord = {};
|
|
46
48
|
let firstActiveKey = null;
|
|
47
49
|
const panes = [];
|
|
48
|
-
|
|
49
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
50
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
50
51
|
if (!_react.default.isValidElement(child)) return;
|
|
51
52
|
const key = child.key;
|
|
52
53
|
if (typeof key !== 'string') return;
|
|
@@ -58,7 +59,6 @@ const JumboTabs = props => {
|
|
|
58
59
|
const length = panes.push(child);
|
|
59
60
|
keyToIndexRecord[key] = length - 1;
|
|
60
61
|
});
|
|
61
|
-
|
|
62
62
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
63
63
|
value: props.activeKey,
|
|
64
64
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -98,7 +98,14 @@ const Mask = p => {
|
|
|
98
98
|
opacity
|
|
99
99
|
}, props.style), {
|
|
100
100
|
display: active ? 'unset' : 'none'
|
|
101
|
-
})
|
|
101
|
+
}),
|
|
102
|
+
onClick: e => {
|
|
103
|
+
var _a;
|
|
104
|
+
|
|
105
|
+
if (e.target === e.currentTarget) {
|
|
106
|
+
(_a = props.onMaskClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
102
109
|
}, props.onMaskClick && _react.default.createElement("div", {
|
|
103
110
|
className: `${classPrefix}-aria-button`,
|
|
104
111
|
role: 'button',
|
|
@@ -9,6 +9,7 @@ export declare type PickerValueExtend = {
|
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
11
|
value: string;
|
|
12
|
+
key?: string | number;
|
|
12
13
|
};
|
|
13
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
14
15
|
export declare type PickerViewProps = {
|
|
@@ -161,6 +161,8 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
161
161
|
className: `${classPrefix}-column-wheel`,
|
|
162
162
|
"aria-hidden": true
|
|
163
163
|
}, column.map((item, index) => {
|
|
164
|
+
var _a;
|
|
165
|
+
|
|
164
166
|
const selected = props.value === item.value;
|
|
165
167
|
if (selected) selectedIndex = index;
|
|
166
168
|
|
|
@@ -170,7 +172,7 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
return _react.default.createElement("div", {
|
|
173
|
-
key: item.value,
|
|
175
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
174
176
|
"data-selected": item.value === value,
|
|
175
177
|
className: `${classPrefix}-column-item`,
|
|
176
178
|
onClick: handleClick,
|
|
@@ -19,7 +19,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
const classPrefix = `adm-popover-menu`;
|
|
21
21
|
const PopoverMenu = (0, _react.forwardRef)((props, ref) => {
|
|
22
|
-
const innerRef = (0, _react.useRef)(null);
|
|
22
|
+
const innerRef = (0, _react.useRef)(null); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
|
|
23
24
|
(0, _react.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
24
25
|
const onClick = (0, _react.useCallback)(e => {
|
|
25
26
|
var _a;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.adm-safe-area-position-top {
|
|
7
|
-
padding-top: env(safe-area-inset-top);
|
|
7
|
+
padding-top: calc(env(safe-area-inset-top) * var(--adm-hd));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.adm-safe-area-position-bottom {
|
|
11
|
-
padding-bottom: env(safe-area-inset-bottom);
|
|
11
|
+
padding-bottom: calc(env(safe-area-inset-bottom) * var(--adm-hd));
|
|
12
12
|
}
|
|
@@ -17,6 +17,8 @@ var _usePropsValue = require("../../utils/use-props-value");
|
|
|
17
17
|
|
|
18
18
|
var _corner = require("./corner");
|
|
19
19
|
|
|
20
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
const classPrefix = `adm-side-bar`;
|
|
@@ -32,8 +34,7 @@ const SideBar = props => {
|
|
|
32
34
|
|
|
33
35
|
let firstActiveKey = null;
|
|
34
36
|
const items = [];
|
|
35
|
-
|
|
36
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
37
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
37
38
|
if (!_react.default.isValidElement(child)) return;
|
|
38
39
|
const key = child.key;
|
|
39
40
|
if (typeof key !== 'string') return;
|
|
@@ -44,7 +45,6 @@ const SideBar = props => {
|
|
|
44
45
|
|
|
45
46
|
items.push(child);
|
|
46
47
|
});
|
|
47
|
-
|
|
48
48
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
49
49
|
value: props.activeKey,
|
|
50
50
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -23,6 +23,8 @@ var _input = _interopRequireDefault(require("../input"));
|
|
|
23
23
|
|
|
24
24
|
var _button = _interopRequireDefault(require("../button"));
|
|
25
25
|
|
|
26
|
+
var _big = _interopRequireDefault(require("big.js"));
|
|
27
|
+
|
|
26
28
|
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
29
|
|
|
28
30
|
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; }
|
|
@@ -47,13 +49,13 @@ const Stepper = p => {
|
|
|
47
49
|
inputReadOnly
|
|
48
50
|
} = props;
|
|
49
51
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
50
|
-
const [inputValue, setInputValue] = (0, _react.useState)(() => convertValueToText(value));
|
|
52
|
+
const [inputValue, setInputValue] = (0, _react.useState)(() => convertValueToText(value, props.digits));
|
|
51
53
|
|
|
52
54
|
function setValueWithCheck(v) {
|
|
53
55
|
if (isNaN(v)) return;
|
|
54
56
|
let target = (0, _bound.bound)(v, props.min, props.max);
|
|
55
57
|
|
|
56
|
-
if (props.digits
|
|
58
|
+
if (props.digits !== undefined) {
|
|
57
59
|
target = parseFloat(target.toFixed(props.digits));
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -63,14 +65,14 @@ const Stepper = p => {
|
|
|
63
65
|
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
64
66
|
(0, _react.useEffect)(() => {
|
|
65
67
|
if (!hasFocus) {
|
|
66
|
-
setInputValue(convertValueToText(value));
|
|
68
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
67
69
|
}
|
|
68
70
|
}, [hasFocus]);
|
|
69
71
|
(0, _react.useEffect)(() => {
|
|
70
72
|
if (!hasFocus) {
|
|
71
|
-
setInputValue(convertValueToText(value));
|
|
73
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
72
74
|
}
|
|
73
|
-
}, [value]);
|
|
75
|
+
}, [value, props.digits]);
|
|
74
76
|
|
|
75
77
|
const handleInputChange = v => {
|
|
76
78
|
setInputValue(v);
|
|
@@ -88,11 +90,11 @@ const Stepper = p => {
|
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
const handleMinus = () => {
|
|
91
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
93
|
+
setValueWithCheck((0, _big.default)(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
92
94
|
};
|
|
93
95
|
|
|
94
96
|
const handlePlus = () => {
|
|
95
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
97
|
+
setValueWithCheck((0, _big.default)(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
const minusDisabled = () => {
|
|
@@ -162,9 +164,14 @@ const Stepper = p => {
|
|
|
162
164
|
|
|
163
165
|
exports.Stepper = Stepper;
|
|
164
166
|
|
|
165
|
-
function convertValueToText(value) {
|
|
167
|
+
function convertValueToText(value, digits) {
|
|
166
168
|
if (value === null) return '';
|
|
167
|
-
|
|
169
|
+
|
|
170
|
+
if (digits !== undefined) {
|
|
171
|
+
return value.toFixed(digits);
|
|
172
|
+
} else {
|
|
173
|
+
return value.toString();
|
|
174
|
+
}
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
function convertTextToValue(text) {
|
|
@@ -129,6 +129,7 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
129
129
|
},
|
|
130
130
|
onRest: () => {
|
|
131
131
|
if (draggingRef.current) return;
|
|
132
|
+
if (!loop) return;
|
|
132
133
|
const rawX = position.get();
|
|
133
134
|
const totalWidth = 100 * count;
|
|
134
135
|
const standardPosition = modulus(rawX, totalWidth);
|
|
@@ -19,6 +19,8 @@ var _safeArea = _interopRequireDefault(require("../safe-area"));
|
|
|
19
19
|
|
|
20
20
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
21
21
|
|
|
22
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
const TabBarItem = () => {
|
|
@@ -37,8 +39,7 @@ const TabBar = p => {
|
|
|
37
39
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
38
40
|
let firstActiveKey = null;
|
|
39
41
|
const items = [];
|
|
40
|
-
|
|
41
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
42
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
42
43
|
if (!_react.default.isValidElement(child)) return;
|
|
43
44
|
const key = child.key;
|
|
44
45
|
if (typeof key !== 'string') return;
|
|
@@ -49,7 +50,6 @@ const TabBar = p => {
|
|
|
49
50
|
|
|
50
51
|
items.push(child);
|
|
51
52
|
});
|
|
52
|
-
|
|
53
53
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
54
54
|
value: props.activeKey,
|
|
55
55
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -29,6 +29,8 @@ var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-updat
|
|
|
29
29
|
|
|
30
30
|
var _shouldRender = require("../../utils/should-render");
|
|
31
31
|
|
|
32
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
33
|
+
|
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
35
|
|
|
34
36
|
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); }
|
|
@@ -56,8 +58,7 @@ const Tabs = p => {
|
|
|
56
58
|
const keyToIndexRecord = {};
|
|
57
59
|
let firstActiveKey = null;
|
|
58
60
|
const panes = [];
|
|
59
|
-
|
|
60
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
61
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
61
62
|
if (!_react.default.isValidElement(child)) return;
|
|
62
63
|
const key = child.key;
|
|
63
64
|
if (typeof key !== 'string') return;
|
|
@@ -69,7 +70,6 @@ const Tabs = p => {
|
|
|
69
70
|
const length = panes.push(child);
|
|
70
71
|
keyToIndexRecord[key] = length - 1;
|
|
71
72
|
});
|
|
72
|
-
|
|
73
73
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
74
74
|
value: props.activeKey,
|
|
75
75
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -159,7 +159,8 @@ const Multiple = p => {
|
|
|
159
159
|
walker(groupKeys);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
groupKeys = groupKeys.filter(i => !unusedKeys.includes(i));
|
|
162
|
+
groupKeys = groupKeys.filter(i => !unusedKeys.includes(i)); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
163
|
+
|
|
163
164
|
const groupOptions = groupKeys.map(i => optionsMap.get(i));
|
|
164
165
|
setValue(groupKeys);
|
|
165
166
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, groupKeys, groupOptions);
|
package/2x/cjs/global/global.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
--adm-border-color: #eeeeee;
|
|
10
10
|
--adm-font-size-main: 26px;
|
|
11
11
|
--adm-color-text: #333333;
|
|
12
|
+
--adm-hd: 2;
|
|
12
13
|
--adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',
|
|
13
14
|
helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',
|
|
14
15
|
'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
|
package/2x/cjs/global/theme.css
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
--adm-border-color: #eeeeee;
|
|
10
10
|
--adm-font-size-main: 26px;
|
|
11
11
|
--adm-color-text: #333333;
|
|
12
|
+
--adm-hd: 2;
|
|
12
13
|
--adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',
|
|
13
14
|
helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',
|
|
14
15
|
'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
|