antd-mobile 5.4.0 → 5.6.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/cjs/components/action-sheet/action-sheet.d.ts +5 -5
- package/2x/cjs/components/action-sheet/action-sheet.js +6 -46
- package/2x/cjs/components/action-sheet/index.d.ts +1 -1
- package/2x/cjs/components/badge/badge.js +1 -1
- package/2x/cjs/components/cascader-view/cascader-view.d.ts +1 -0
- package/2x/cjs/components/cascader-view/cascader-view.js +7 -0
- package/2x/cjs/components/cascader-view/use-cascader-value-extend.js +23 -0
- package/2x/cjs/components/check-list/check-list-item.js +1 -1
- package/2x/cjs/components/checkbox/checkbox.js +4 -8
- package/2x/cjs/components/checkbox/native-input.d.ts +10 -0
- package/2x/cjs/components/checkbox/native-input.js +42 -0
- package/2x/cjs/components/dialog/index.d.ts +1 -1
- package/2x/cjs/components/dialog/show.d.ts +2 -4
- package/2x/cjs/components/dialog/show.js +9 -47
- package/2x/cjs/components/dot-loading/dot-loading.js +1 -2
- package/2x/cjs/components/error-block/error-block.js +4 -2
- package/2x/cjs/components/floating-bubble/floating-bubble.css +2 -1
- package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/2x/cjs/components/floating-bubble/floating-bubble.js +14 -5
- package/2x/cjs/components/form/form-array.d.ts +19 -0
- package/2x/cjs/components/form/form-array.js +52 -0
- package/2x/cjs/components/form/form-item.css +6 -1
- package/2x/cjs/components/form/form-item.js +24 -8
- package/2x/cjs/components/form/form.css +5 -0
- package/2x/cjs/components/form/form.js +16 -5
- package/2x/cjs/components/form/index.css +11 -1
- package/2x/cjs/components/form/index.d.ts +2 -0
- package/2x/cjs/components/form/index.js +3 -0
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +1 -1
- package/2x/cjs/components/image-uploader/image-uploader.js +17 -1
- package/2x/cjs/components/image-viewer/index.d.ts +1 -1
- package/2x/cjs/components/image-viewer/methods.d.ts +3 -4
- package/2x/cjs/components/image-viewer/methods.js +41 -56
- package/2x/cjs/components/modal/index.d.ts +1 -1
- package/2x/cjs/components/modal/show.d.ts +2 -4
- package/2x/cjs/components/modal/show.js +9 -47
- package/2x/cjs/components/popover/index.d.ts +7 -2
- package/2x/cjs/components/popover/normalize-placement.d.ts +2 -0
- package/2x/cjs/components/popover/normalize-placement.js +22 -0
- package/2x/cjs/components/popover/popover.css +0 -104
- package/2x/cjs/components/popover/popover.d.ts +11 -5
- package/2x/cjs/components/popover/popover.js +127 -22
- package/2x/cjs/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/2x/cjs/components/popover/temp-floating-ui.min.js +1 -0
- package/2x/cjs/components/popover/wrapper.d.ts +7 -0
- package/2x/cjs/components/popover/wrapper.js +41 -0
- package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +24 -9
- package/2x/cjs/components/radio/radio.js +4 -8
- package/2x/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -1
- package/2x/cjs/components/tab-bar/tab-bar.js +1 -1
- package/2x/cjs/components/tree-select/tree-select.js +2 -2
- package/2x/cjs/utils/render-imperatively.d.ts +10 -0
- package/2x/cjs/utils/render-imperatively.js +58 -0
- package/2x/cjs/utils/use-props-value.d.ts +2 -1
- package/2x/cjs/utils/use-props-value.js +4 -2
- package/2x/es/components/action-sheet/action-sheet.d.ts +5 -5
- package/2x/es/components/action-sheet/action-sheet.js +5 -41
- package/2x/es/components/action-sheet/index.d.ts +1 -1
- package/2x/es/components/badge/badge.js +1 -1
- package/2x/es/components/cascader-view/cascader-view.d.ts +1 -0
- package/2x/es/components/cascader-view/cascader-view.js +7 -0
- package/2x/es/components/cascader-view/use-cascader-value-extend.js +23 -0
- package/2x/es/components/check-list/check-list-item.js +1 -1
- package/2x/es/components/checkbox/checkbox.js +3 -8
- package/2x/es/components/checkbox/native-input.d.ts +10 -0
- package/2x/es/components/checkbox/native-input.js +28 -0
- package/2x/es/components/dialog/index.d.ts +1 -1
- package/2x/es/components/dialog/show.d.ts +2 -4
- package/2x/es/components/dialog/show.js +8 -44
- package/2x/es/components/dot-loading/dot-loading.js +1 -2
- package/2x/es/components/error-block/error-block.js +4 -2
- package/2x/es/components/floating-bubble/floating-bubble.css +2 -1
- package/2x/es/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/2x/es/components/floating-bubble/floating-bubble.js +14 -5
- package/2x/es/components/form/form-array.d.ts +19 -0
- package/2x/es/components/form/form-array.js +38 -0
- package/2x/es/components/form/form-item.css +6 -1
- package/2x/es/components/form/form-item.js +22 -8
- package/2x/es/components/form/form.css +5 -0
- package/2x/es/components/form/form.js +15 -5
- package/2x/es/components/form/index.css +11 -1
- package/2x/es/components/form/index.d.ts +2 -0
- package/2x/es/components/form/index.js +2 -0
- package/2x/es/components/image-uploader/image-uploader.d.ts +1 -1
- package/2x/es/components/image-uploader/image-uploader.js +17 -1
- package/2x/es/components/image-viewer/index.d.ts +1 -1
- package/2x/es/components/image-viewer/methods.d.ts +3 -4
- package/2x/es/components/image-viewer/methods.js +38 -57
- package/2x/es/components/modal/index.d.ts +1 -1
- package/2x/es/components/modal/show.d.ts +2 -4
- package/2x/es/components/modal/show.js +8 -44
- package/2x/es/components/popover/index.d.ts +7 -2
- package/2x/es/components/popover/normalize-placement.d.ts +2 -0
- package/2x/es/components/popover/normalize-placement.js +15 -0
- package/2x/es/components/popover/popover.css +0 -104
- package/2x/es/components/popover/popover.d.ts +11 -5
- package/2x/es/components/popover/popover.js +119 -22
- package/2x/es/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/2x/es/components/popover/temp-floating-ui.min.js +1 -0
- package/2x/es/components/popover/wrapper.d.ts +7 -0
- package/2x/es/components/popover/wrapper.js +28 -0
- package/2x/es/components/pull-to-refresh/pull-to-refresh.js +24 -9
- package/2x/es/components/radio/radio.js +3 -8
- package/2x/es/components/search-bar/search-bar.d.ts +1 -1
- package/2x/es/components/tab-bar/tab-bar.d.ts +1 -1
- package/2x/es/components/tab-bar/tab-bar.js +1 -1
- package/2x/es/components/tree-select/tree-select.js +2 -2
- package/2x/es/utils/render-imperatively.d.ts +10 -0
- package/2x/es/utils/render-imperatively.js +45 -0
- package/2x/es/utils/use-props-value.d.ts +2 -1
- package/2x/es/utils/use-props-value.js +4 -2
- package/2x/package.json +3 -4
- package/cjs/components/action-sheet/action-sheet.d.ts +5 -5
- package/cjs/components/action-sheet/action-sheet.js +6 -46
- package/cjs/components/action-sheet/index.d.ts +1 -1
- package/cjs/components/badge/badge.js +1 -1
- package/cjs/components/cascader-view/cascader-view.d.ts +1 -0
- package/cjs/components/cascader-view/cascader-view.js +7 -0
- package/cjs/components/cascader-view/use-cascader-value-extend.js +23 -0
- package/cjs/components/check-list/check-list-item.js +1 -1
- package/cjs/components/checkbox/checkbox.js +4 -8
- package/cjs/components/checkbox/native-input.d.ts +10 -0
- package/cjs/components/checkbox/native-input.js +42 -0
- package/cjs/components/dialog/index.d.ts +1 -1
- package/cjs/components/dialog/show.d.ts +2 -4
- package/cjs/components/dialog/show.js +9 -47
- package/cjs/components/dot-loading/dot-loading.js +1 -2
- package/cjs/components/error-block/error-block.js +4 -2
- package/cjs/components/floating-bubble/floating-bubble.css +2 -1
- package/cjs/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/cjs/components/floating-bubble/floating-bubble.js +14 -5
- package/cjs/components/form/form-array.d.ts +19 -0
- package/cjs/components/form/form-array.js +52 -0
- package/cjs/components/form/form-item.css +5 -1
- package/cjs/components/form/form-item.js +24 -8
- package/cjs/components/form/form.css +4 -0
- package/cjs/components/form/form.js +16 -5
- package/cjs/components/form/index.css +9 -1
- package/cjs/components/form/index.d.ts +2 -0
- package/cjs/components/form/index.js +3 -0
- package/cjs/components/image-uploader/image-uploader.d.ts +1 -1
- package/cjs/components/image-uploader/image-uploader.js +17 -1
- package/cjs/components/image-viewer/index.d.ts +1 -1
- package/cjs/components/image-viewer/methods.d.ts +3 -4
- package/cjs/components/image-viewer/methods.js +41 -56
- package/cjs/components/modal/index.d.ts +1 -1
- package/cjs/components/modal/show.d.ts +2 -4
- package/cjs/components/modal/show.js +9 -47
- package/cjs/components/popover/index.d.ts +7 -2
- package/cjs/components/popover/normalize-placement.d.ts +2 -0
- package/cjs/components/popover/normalize-placement.js +22 -0
- package/cjs/components/popover/popover.css +0 -84
- package/cjs/components/popover/popover.d.ts +11 -5
- package/cjs/components/popover/popover.js +127 -22
- package/cjs/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/cjs/components/popover/temp-floating-ui.min.js +1 -0
- package/cjs/components/popover/wrapper.d.ts +7 -0
- package/cjs/components/popover/wrapper.js +41 -0
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +24 -9
- package/cjs/components/radio/radio.js +4 -8
- package/cjs/components/search-bar/search-bar.d.ts +1 -1
- package/cjs/components/tab-bar/tab-bar.d.ts +1 -1
- package/cjs/components/tab-bar/tab-bar.js +1 -1
- package/cjs/components/tree-select/tree-select.js +2 -2
- package/cjs/utils/render-imperatively.d.ts +10 -0
- package/cjs/utils/render-imperatively.js +58 -0
- package/cjs/utils/use-props-value.d.ts +2 -1
- package/cjs/utils/use-props-value.js +4 -2
- package/es/components/action-sheet/action-sheet.d.ts +5 -5
- package/es/components/action-sheet/action-sheet.js +5 -41
- package/es/components/action-sheet/index.d.ts +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/cascader-view/cascader-view.d.ts +1 -0
- package/es/components/cascader-view/cascader-view.js +7 -0
- package/es/components/cascader-view/use-cascader-value-extend.js +23 -0
- package/es/components/check-list/check-list-item.js +1 -1
- package/es/components/checkbox/checkbox.js +3 -8
- package/es/components/checkbox/native-input.d.ts +10 -0
- package/es/components/checkbox/native-input.js +28 -0
- package/es/components/dialog/index.d.ts +1 -1
- package/es/components/dialog/show.d.ts +2 -4
- package/es/components/dialog/show.js +8 -44
- package/es/components/dot-loading/dot-loading.js +1 -2
- package/es/components/error-block/error-block.js +4 -2
- package/es/components/floating-bubble/floating-bubble.css +2 -1
- package/es/components/floating-bubble/floating-bubble.d.ts +1 -1
- package/es/components/floating-bubble/floating-bubble.js +14 -5
- package/es/components/form/form-array.d.ts +19 -0
- package/es/components/form/form-array.js +38 -0
- package/es/components/form/form-item.css +5 -1
- package/es/components/form/form-item.js +22 -8
- package/es/components/form/form.css +4 -0
- package/es/components/form/form.js +15 -5
- package/es/components/form/index.css +9 -1
- package/es/components/form/index.d.ts +2 -0
- package/es/components/form/index.js +2 -0
- package/es/components/image-uploader/image-uploader.d.ts +1 -1
- package/es/components/image-uploader/image-uploader.js +17 -1
- package/es/components/image-viewer/index.d.ts +1 -1
- package/es/components/image-viewer/methods.d.ts +3 -4
- package/es/components/image-viewer/methods.js +38 -57
- package/es/components/modal/index.d.ts +1 -1
- package/es/components/modal/show.d.ts +2 -4
- package/es/components/modal/show.js +8 -44
- package/es/components/popover/index.d.ts +7 -2
- package/es/components/popover/normalize-placement.d.ts +2 -0
- package/es/components/popover/normalize-placement.js +15 -0
- package/es/components/popover/popover.css +0 -84
- package/es/components/popover/popover.d.ts +11 -5
- package/es/components/popover/popover.js +119 -22
- package/es/components/popover/temp-floating-ui.min.d.ts +1 -0
- package/es/components/popover/temp-floating-ui.min.js +1 -0
- package/es/components/popover/wrapper.d.ts +7 -0
- package/es/components/popover/wrapper.js +28 -0
- package/es/components/pull-to-refresh/pull-to-refresh.js +24 -9
- package/es/components/radio/radio.js +3 -8
- package/es/components/search-bar/search-bar.d.ts +1 -1
- package/es/components/tab-bar/tab-bar.d.ts +1 -1
- package/es/components/tab-bar/tab-bar.js +1 -1
- package/es/components/tree-select/tree-select.js +2 -2
- package/es/utils/render-imperatively.d.ts +10 -0
- package/es/utils/render-imperatively.js +45 -0
- package/es/utils/use-props-value.d.ts +2 -1
- package/es/utils/use-props-value.js +4 -2
- package/package.json +3 -4
- package/umd/antd-mobile.js +1 -1
|
@@ -10,7 +10,7 @@ export declare type Action = {
|
|
|
10
10
|
onClick?: () => void;
|
|
11
11
|
};
|
|
12
12
|
export declare type ActionSheetProps = {
|
|
13
|
-
visible
|
|
13
|
+
visible?: boolean;
|
|
14
14
|
actions: Action[];
|
|
15
15
|
extra?: React.ReactNode;
|
|
16
16
|
cancelText?: React.ReactNode;
|
|
@@ -22,11 +22,11 @@ export declare type ActionSheetProps = {
|
|
|
22
22
|
closeOnMaskClick?: boolean;
|
|
23
23
|
getContainer?: GetContainer;
|
|
24
24
|
safeArea?: boolean;
|
|
25
|
+
popupClassName?: string;
|
|
26
|
+
popupStyle?: React.CSSProperties;
|
|
25
27
|
} & NativeProps;
|
|
26
28
|
export declare const ActionSheet: FC<ActionSheetProps>;
|
|
27
|
-
export declare type
|
|
28
|
-
close: () => void;
|
|
29
|
-
};
|
|
30
|
-
export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): {
|
|
29
|
+
export declare type ActionSheetShowHandler = {
|
|
31
30
|
close: () => void;
|
|
32
31
|
};
|
|
32
|
+
export declare function showActionSheet(props: Omit<ActionSheetProps, 'visible'>): ActionSheetShowHandler;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ActionSheet = void 0;
|
|
7
7
|
exports.showActionSheet = showActionSheet;
|
|
8
8
|
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
|
|
11
11
|
var _nativeProps = require("../../utils/native-props");
|
|
12
12
|
|
|
@@ -18,15 +18,11 @@ var _popup = _interopRequireDefault(require("../popup"));
|
|
|
18
18
|
|
|
19
19
|
var _button = _interopRequireDefault(require("../button"));
|
|
20
20
|
|
|
21
|
-
var _renderToBody = require("../../utils/render-to-body");
|
|
22
|
-
|
|
23
21
|
var _safeArea = _interopRequireDefault(require("../safe-area"));
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
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
|
+
var _renderImperatively = require("../../utils/render-imperatively");
|
|
28
24
|
|
|
29
|
-
function
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
26
|
|
|
31
27
|
const classPrefix = `adm-action-sheet`;
|
|
32
28
|
const defaultProps = {
|
|
@@ -52,7 +48,8 @@ const ActionSheet = p => {
|
|
|
52
48
|
}
|
|
53
49
|
},
|
|
54
50
|
afterClose: props.afterClose,
|
|
55
|
-
className: `${classPrefix}-popup`,
|
|
51
|
+
className: (0, _classnames.default)(`${classPrefix}-popup`, props.popupClassName),
|
|
52
|
+
style: props.popupStyle,
|
|
56
53
|
getContainer: props.getContainer
|
|
57
54
|
}, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
58
55
|
className: classPrefix
|
|
@@ -109,42 +106,5 @@ const ActionSheet = p => {
|
|
|
109
106
|
exports.ActionSheet = ActionSheet;
|
|
110
107
|
|
|
111
108
|
function showActionSheet(props) {
|
|
112
|
-
|
|
113
|
-
const [visible, setVisible] = (0, _react.useState)(false);
|
|
114
|
-
(0, _react.useEffect)(() => {
|
|
115
|
-
setVisible(true);
|
|
116
|
-
}, []);
|
|
117
|
-
|
|
118
|
-
function handleClose() {
|
|
119
|
-
var _a;
|
|
120
|
-
|
|
121
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
122
|
-
setVisible(false);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
126
|
-
close: handleClose
|
|
127
|
-
}));
|
|
128
|
-
return _react.default.createElement(ActionSheet, Object.assign({}, props, {
|
|
129
|
-
visible: visible,
|
|
130
|
-
onClose: handleClose,
|
|
131
|
-
afterClose: () => {
|
|
132
|
-
var _a;
|
|
133
|
-
|
|
134
|
-
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
135
|
-
unmount();
|
|
136
|
-
}
|
|
137
|
-
}));
|
|
138
|
-
});
|
|
139
|
-
const ref = (0, _react.createRef)();
|
|
140
|
-
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
141
|
-
ref: ref
|
|
142
|
-
}));
|
|
143
|
-
return {
|
|
144
|
-
close: () => {
|
|
145
|
-
var _a;
|
|
146
|
-
|
|
147
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
148
|
-
}
|
|
149
|
-
};
|
|
109
|
+
return (0, _renderImperatively.renderImperatively)(_react.default.createElement(ActionSheet, Object.assign({}, props)));
|
|
150
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './action-sheet.less';
|
|
3
3
|
import { showActionSheet } from './action-sheet';
|
|
4
|
-
export type { Action, ActionSheetProps,
|
|
4
|
+
export type { Action, ActionSheetProps, ActionSheetShowHandler, } from './action-sheet';
|
|
5
5
|
declare const _default: import("react").FC<import("./action-sheet").ActionSheetProps> & {
|
|
6
6
|
show: typeof showActionSheet;
|
|
7
7
|
};
|
|
@@ -25,7 +25,7 @@ const Badge = props => {
|
|
|
25
25
|
} = props;
|
|
26
26
|
const isDot = content === dot;
|
|
27
27
|
const badgeCls = (0, _classnames.default)(classPrefix, !!children && `${classPrefix}-fixed`, isDot && `${classPrefix}-dot`, props.bordered && `${classPrefix}-bordered`);
|
|
28
|
-
const element = content ? (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
28
|
+
const element = content || content === 0 ? (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
29
29
|
className: badgeCls,
|
|
30
30
|
style: {
|
|
31
31
|
'--color': color
|
|
@@ -86,6 +86,13 @@ const CascaderView = p => {
|
|
|
86
86
|
(0, _react.useEffect)(() => {
|
|
87
87
|
setTabActiveKey(levels.length - 1);
|
|
88
88
|
}, [value]);
|
|
89
|
+
(0, _react.useEffect)(() => {
|
|
90
|
+
const max = levels.length - 1;
|
|
91
|
+
|
|
92
|
+
if (tabActiveKey > max) {
|
|
93
|
+
setTabActiveKey(max);
|
|
94
|
+
}
|
|
95
|
+
}, [tabActiveKey, levels]);
|
|
89
96
|
|
|
90
97
|
const onItemSelect = (selectValue, depth) => {
|
|
91
98
|
const next = value.slice(0, depth);
|
|
@@ -32,11 +32,34 @@ function useCascaderValueExtend(options) {
|
|
|
32
32
|
return ret;
|
|
33
33
|
}, val => JSON.stringify(val));
|
|
34
34
|
}, [options]);
|
|
35
|
+
const generateIsLeaf = (0, _react.useMemo)(() => {
|
|
36
|
+
return (0, _memoize.default)(val => {
|
|
37
|
+
var _a;
|
|
38
|
+
|
|
39
|
+
let isLeaf = false;
|
|
40
|
+
|
|
41
|
+
for (const v of val) {
|
|
42
|
+
const target = options.find(option => option.value === v);
|
|
43
|
+
|
|
44
|
+
if (!target) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
isLeaf = ((_a = target.children) === null || _a === void 0 ? void 0 : _a.length) === val.length;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return isLeaf;
|
|
52
|
+
}, val => JSON.stringify(val));
|
|
53
|
+
}, [options]);
|
|
35
54
|
|
|
36
55
|
function generateValueExtend(val) {
|
|
37
56
|
return {
|
|
38
57
|
get items() {
|
|
39
58
|
return generateItems(val);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
get isLeaf() {
|
|
62
|
+
return generateIsLeaf(val);
|
|
40
63
|
}
|
|
41
64
|
|
|
42
65
|
};
|
|
@@ -42,7 +42,7 @@ const CheckListItem = props => {
|
|
|
42
42
|
|
|
43
43
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_list.default.Item, {
|
|
44
44
|
title: props.title,
|
|
45
|
-
className: (0, _classnames.default)(classPrefix, readOnly && `${classPrefix}-readonly`),
|
|
45
|
+
className: (0, _classnames.default)(classPrefix, readOnly && `${classPrefix}-readonly`, active && `${classPrefix}-active`),
|
|
46
46
|
description: props.description,
|
|
47
47
|
prefix: props.prefix,
|
|
48
48
|
onClick: e => {
|
|
@@ -25,6 +25,8 @@ var _indeterminateIcon = require("./indeterminate-icon");
|
|
|
25
25
|
|
|
26
26
|
var _isDev = require("../../utils/is-dev");
|
|
27
27
|
|
|
28
|
+
var _nativeInput = require("./native-input");
|
|
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); }
|
|
@@ -97,16 +99,10 @@ const Checkbox = p => {
|
|
|
97
99
|
[`${classPrefix}-disabled`]: disabled,
|
|
98
100
|
[`${classPrefix}-block`]: props.block
|
|
99
101
|
})
|
|
100
|
-
}, _react.default.createElement(
|
|
102
|
+
}, _react.default.createElement(_nativeInput.NativeInput, {
|
|
101
103
|
type: 'checkbox',
|
|
102
104
|
checked: checked,
|
|
103
|
-
onChange:
|
|
104
|
-
setChecked(e.target.checked);
|
|
105
|
-
},
|
|
106
|
-
onClick: e => {
|
|
107
|
-
e.stopPropagation();
|
|
108
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
109
|
-
},
|
|
105
|
+
onChange: setChecked,
|
|
110
106
|
disabled: disabled,
|
|
111
107
|
id: props.id
|
|
112
108
|
}), renderIcon(), props.children && _react.default.createElement("div", {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NativeInput = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
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); }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
const NativeInput = props => {
|
|
15
|
+
const inputRef = (0, _react.useRef)(null);
|
|
16
|
+
(0, _react.useEffect)(() => {
|
|
17
|
+
if (props.disabled) return;
|
|
18
|
+
if (!inputRef.current) return;
|
|
19
|
+
const input = inputRef.current;
|
|
20
|
+
|
|
21
|
+
function handleClick(e) {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
e.stopImmediatePropagation();
|
|
24
|
+
props.onChange(input.checked);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
input.addEventListener('click', handleClick);
|
|
28
|
+
return () => {
|
|
29
|
+
input.removeEventListener('click', handleClick);
|
|
30
|
+
};
|
|
31
|
+
}, [props.disabled, props.onChange]);
|
|
32
|
+
return _react.default.createElement("input", {
|
|
33
|
+
ref: inputRef,
|
|
34
|
+
type: 'checkbox',
|
|
35
|
+
checked: props.checked,
|
|
36
|
+
onChange: () => {},
|
|
37
|
+
disabled: props.disabled,
|
|
38
|
+
id: props.id
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.NativeInput = NativeInput;
|
|
@@ -6,7 +6,7 @@ import { confirm } from './confirm';
|
|
|
6
6
|
import { clear } from './clear';
|
|
7
7
|
export type { DialogProps } from './dialog';
|
|
8
8
|
export type { Action } from './dialog-action-button';
|
|
9
|
-
export type { DialogShowProps,
|
|
9
|
+
export type { DialogShowProps, DialogShowHandler } from './show';
|
|
10
10
|
export type { DialogAlertProps } from './alert';
|
|
11
11
|
export type { DialogConfirmProps } from './confirm';
|
|
12
12
|
declare const _default: import("react").FC<import("./dialog").DialogProps> & {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { DialogProps } from './dialog';
|
|
2
2
|
export declare type DialogShowProps = Omit<DialogProps, 'visible'>;
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type DialogShowHandler = {
|
|
4
4
|
close: () => void;
|
|
5
5
|
};
|
|
6
6
|
export declare const closeFnSet: Set<() => void>;
|
|
7
|
-
export declare function show(props: DialogShowProps):
|
|
8
|
-
close: () => void;
|
|
9
|
-
};
|
|
7
|
+
export declare function show(props: DialogShowProps): DialogShowHandler;
|
|
@@ -6,64 +6,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.closeFnSet = void 0;
|
|
7
7
|
exports.show = show;
|
|
8
8
|
|
|
9
|
-
var _react =
|
|
10
|
-
|
|
11
|
-
var _renderToBody = require("../../utils/render-to-body");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
10
|
|
|
13
11
|
var _dialog = require("./dialog");
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
var _renderImperatively = require("../../utils/render-imperatively");
|
|
16
14
|
|
|
17
|
-
function
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
16
|
|
|
19
17
|
const closeFnSet = new Set();
|
|
20
18
|
exports.closeFnSet = closeFnSet;
|
|
21
19
|
|
|
22
20
|
function show(props) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
(0, _react.useEffect)(() => {
|
|
26
|
-
setVisible(true);
|
|
27
|
-
}, []);
|
|
28
|
-
|
|
29
|
-
function handleClose() {
|
|
30
|
-
var _a;
|
|
31
|
-
|
|
32
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
33
|
-
setVisible(false);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
37
|
-
close: handleClose
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
function handleAfterClose() {
|
|
21
|
+
const handler = (0, _renderImperatively.renderImperatively)(_react.default.createElement(_dialog.Dialog, Object.assign({}, props, {
|
|
22
|
+
afterClose: () => {
|
|
41
23
|
var _a;
|
|
42
24
|
|
|
25
|
+
closeFnSet.delete(handler.close);
|
|
43
26
|
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
44
|
-
unmount();
|
|
45
|
-
closeFnSet.delete(close);
|
|
46
27
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onClose: handleClose,
|
|
51
|
-
afterClose: handleAfterClose
|
|
52
|
-
}));
|
|
53
|
-
});
|
|
54
|
-
const ref = (0, _react.createRef)();
|
|
55
|
-
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
56
|
-
ref: ref
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
const close = () => {
|
|
60
|
-
var _a;
|
|
61
|
-
|
|
62
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
closeFnSet.add(close);
|
|
66
|
-
return {
|
|
67
|
-
close
|
|
68
|
-
};
|
|
28
|
+
})));
|
|
29
|
+
closeFnSet.add(handler.close);
|
|
30
|
+
return handler;
|
|
69
31
|
}
|
|
@@ -70,8 +70,7 @@ const DotLoading = (0, _react.memo)(p => {
|
|
|
70
70
|
begin: `${i * 0.2}s`,
|
|
71
71
|
repeatCount: 'indefinite',
|
|
72
72
|
values: '16; 6; 26; 16; 16',
|
|
73
|
-
keyTimes: '0; 0.1; 0.3; 0.4; 1'
|
|
74
|
-
id: 'circ-anim'
|
|
73
|
+
keyTimes: '0; 0.1; 0.3; 0.4; 1'
|
|
75
74
|
}))))))))));
|
|
76
75
|
});
|
|
77
76
|
exports.DotLoading = DotLoading;
|
|
@@ -35,13 +35,15 @@ const ErrorBlock = p => {
|
|
|
35
35
|
const title = 'title' in props ? props.title : contentPack.title;
|
|
36
36
|
|
|
37
37
|
let imageNode = _react.default.createElement("img", {
|
|
38
|
-
src: icon
|
|
38
|
+
src: icon,
|
|
39
|
+
alt: 'error block image'
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
if (props.image) {
|
|
42
43
|
if (typeof props.image === 'string') {
|
|
43
44
|
imageNode = _react.default.createElement("img", {
|
|
44
|
-
src: props.image
|
|
45
|
+
src: props.image,
|
|
46
|
+
alt: 'error block image'
|
|
45
47
|
});
|
|
46
48
|
} else {
|
|
47
49
|
imageNode = props.image;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
--edge-distance: 0;
|
|
8
8
|
--size: 96px;
|
|
9
9
|
--border-radius: 50%;
|
|
10
|
+
--background: var(--adm-color-primary);
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.adm-floating-bubble-boundary-outer {
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
transition: opacity ease 0.15s;
|
|
44
45
|
user-select: none;
|
|
45
46
|
touch-action: none;
|
|
46
|
-
background: var(--
|
|
47
|
+
background: var(--background);
|
|
47
48
|
color: var(--adm-color-white);
|
|
48
49
|
border-radius: var(--border-radius);
|
|
49
50
|
z-index: var(--z-index);
|
|
@@ -4,5 +4,5 @@ export declare type FloatingBubbleProps = {
|
|
|
4
4
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
5
5
|
axis?: 'x' | 'y' | 'xy' | 'lock';
|
|
6
6
|
magnetic?: 'x' | 'y';
|
|
7
|
-
} & NativeProps<'--initial-position-left' | '--initial-position-right' | '--initial-position-top' | '--initial-position-bottom' | '--z-index' | '--edge-distance' | '--size' | '--border-radius'>;
|
|
7
|
+
} & NativeProps<'--initial-position-left' | '--initial-position-right' | '--initial-position-top' | '--initial-position-bottom' | '--z-index' | '--edge-distance' | '--size' | '--border-radius' | '--background'>;
|
|
8
8
|
export declare const FloatingBubble: FC<FloatingBubbleProps>;
|
|
@@ -47,15 +47,15 @@ const FloatingBubble = p => {
|
|
|
47
47
|
let nextX = state.offset[0];
|
|
48
48
|
let nextY = state.offset[1];
|
|
49
49
|
|
|
50
|
-
if (state.last) {
|
|
50
|
+
if (state.last && props.magnetic) {
|
|
51
51
|
const boundary = boundaryRef.current;
|
|
52
52
|
const button = buttonRef.current;
|
|
53
53
|
if (!boundary || !button) return;
|
|
54
|
+
const boundaryRect = boundary.getBoundingClientRect();
|
|
55
|
+
const buttonRect = button.getBoundingClientRect();
|
|
54
56
|
|
|
55
57
|
if (props.magnetic === 'x') {
|
|
56
58
|
const compensation = x.goal - x.get();
|
|
57
|
-
const boundaryRect = boundary.getBoundingClientRect();
|
|
58
|
-
const buttonRect = button.getBoundingClientRect();
|
|
59
59
|
const leftDistance = buttonRect.left + compensation - boundaryRect.left;
|
|
60
60
|
const rightDistance = boundaryRect.right - (buttonRect.right + compensation);
|
|
61
61
|
|
|
@@ -64,13 +64,22 @@ const FloatingBubble = p => {
|
|
|
64
64
|
} else {
|
|
65
65
|
nextX -= leftDistance;
|
|
66
66
|
}
|
|
67
|
+
} else if (props.magnetic === 'y') {
|
|
68
|
+
const compensation = y.goal - y.get();
|
|
69
|
+
const topDistance = buttonRect.top + compensation - boundaryRect.top;
|
|
70
|
+
const bottomDistance = boundaryRect.bottom - (buttonRect.bottom + compensation);
|
|
71
|
+
|
|
72
|
+
if (bottomDistance <= topDistance) {
|
|
73
|
+
nextY += bottomDistance;
|
|
74
|
+
} else {
|
|
75
|
+
nextY -= topDistance;
|
|
76
|
+
}
|
|
67
77
|
}
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
api.start({
|
|
71
81
|
x: nextX,
|
|
72
|
-
y: nextY
|
|
73
|
-
|
|
82
|
+
y: nextY
|
|
74
83
|
}); // active status
|
|
75
84
|
|
|
76
85
|
api.start({
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { StoreValue } from 'rc-field-form/es/interface';
|
|
3
|
+
export interface FormArrayField {
|
|
4
|
+
index: number;
|
|
5
|
+
key: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FormArrayOperation {
|
|
8
|
+
add: (defaultValue?: StoreValue, insertIndex?: number) => void;
|
|
9
|
+
remove: (index: number | number[]) => void;
|
|
10
|
+
move: (from: number, to: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface FormArrayProps {
|
|
13
|
+
name: string | number | (string | number)[];
|
|
14
|
+
initialValue?: any[];
|
|
15
|
+
renderHeader?: (field: FormArrayField, operation: FormArrayOperation) => ReactNode;
|
|
16
|
+
renderAdd?: () => ReactNode;
|
|
17
|
+
children: (fields: FormArrayField[], operation: FormArrayOperation) => ReactElement[];
|
|
18
|
+
}
|
|
19
|
+
export declare const FormArray: React.FC<FormArrayProps>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FormArray = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _rcFieldForm = require("rc-field-form");
|
|
11
|
+
|
|
12
|
+
var _list = _interopRequireDefault(require("../list"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const FormArray = props => {
|
|
17
|
+
return _react.default.createElement(_rcFieldForm.List, {
|
|
18
|
+
name: props.name,
|
|
19
|
+
initialValue: props.initialValue
|
|
20
|
+
}, (rcFields, operation) => {
|
|
21
|
+
const fields = rcFields.map(field => ({
|
|
22
|
+
index: field.name,
|
|
23
|
+
key: field.key
|
|
24
|
+
}));
|
|
25
|
+
const children = props.children(fields, operation).map((child, index) => {
|
|
26
|
+
var _a;
|
|
27
|
+
|
|
28
|
+
return _react.default.createElement(_list.default, {
|
|
29
|
+
key: fields[index].key,
|
|
30
|
+
mode: 'card',
|
|
31
|
+
header: (_a = props.renderHeader) === null || _a === void 0 ? void 0 : _a.call(props, fields[index], operation)
|
|
32
|
+
}, child);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (props.renderAdd) {
|
|
36
|
+
children.push(_react.default.createElement(_list.default, {
|
|
37
|
+
key: 'add',
|
|
38
|
+
mode: 'card'
|
|
39
|
+
}, _react.default.createElement(_list.default.Item, {
|
|
40
|
+
className: 'adm-form-list-operation',
|
|
41
|
+
onClick: () => {
|
|
42
|
+
operation.add();
|
|
43
|
+
},
|
|
44
|
+
arrow: false
|
|
45
|
+
}, props.renderAdd())));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return _react.default.createElement(_react.default.Fragment, null, children);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.FormArray = FormArray;
|
|
@@ -50,11 +50,16 @@
|
|
|
50
50
|
flex: none;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.adm-form-item-
|
|
53
|
+
.adm-form-item-feedback-error {
|
|
54
54
|
color: var(--adm-color-danger);
|
|
55
55
|
margin-top: 8px;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
.adm-form-item-feedback-warning {
|
|
59
|
+
color: var(--adm-color-warning);
|
|
60
|
+
margin-top: 8px;
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
.adm-form-item.adm-form-item-hidden {
|
|
59
64
|
display: none;
|
|
60
65
|
}
|
|
@@ -54,9 +54,7 @@ const FormItemLayout = props => {
|
|
|
54
54
|
children,
|
|
55
55
|
htmlFor,
|
|
56
56
|
hidden,
|
|
57
|
-
errors,
|
|
58
57
|
arrow,
|
|
59
|
-
description,
|
|
60
58
|
childElementPosition = 'normal'
|
|
61
59
|
} = props;
|
|
62
60
|
const context = (0, _react.useContext)(_context.FormContext);
|
|
@@ -65,7 +63,6 @@ const FormItemLayout = props => {
|
|
|
65
63
|
} = (0, _configProvider.useConfig)();
|
|
66
64
|
const hasFeedback = props.hasFeedback !== undefined ? props.hasFeedback : context.hasFeedback;
|
|
67
65
|
const layout = props.layout || context.layout;
|
|
68
|
-
const feedback = hasFeedback && errors && errors.length > 0 ? errors[0] : null;
|
|
69
66
|
|
|
70
67
|
const requiredMark = (() => {
|
|
71
68
|
const {
|
|
@@ -103,15 +100,21 @@ const FormItemLayout = props => {
|
|
|
103
100
|
mode: 'dark',
|
|
104
101
|
trigger: 'click'
|
|
105
102
|
}, _react.default.createElement(_antdMobileIcons.QuestionCircleOutline, null)))) : null;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
|
|
104
|
+
const description = _react.default.createElement(_react.default.Fragment, null, props.description, hasFeedback && _react.default.createElement(_react.default.Fragment, null, props.errors.map((error, index) => _react.default.createElement("div", {
|
|
105
|
+
key: `error-${index}`,
|
|
106
|
+
className: `${classPrefix}-feedback-error`
|
|
107
|
+
}, error)), props.warnings.map((warning, index) => _react.default.createElement("div", {
|
|
108
|
+
key: `warning-${index}`,
|
|
109
|
+
className: `${classPrefix}-feedback-warning`
|
|
110
|
+
}, warning))));
|
|
111
|
+
|
|
109
112
|
return _react.default.createElement(_list.default.Item, {
|
|
110
113
|
style: style,
|
|
111
114
|
title: layout === 'vertical' && labelElement,
|
|
112
115
|
prefix: layout === 'horizontal' && labelElement,
|
|
113
116
|
extra: extra,
|
|
114
|
-
description:
|
|
117
|
+
description: description,
|
|
115
118
|
className: (0, _classnames.default)(classPrefix, className, `${classPrefix}-${layout}`, {
|
|
116
119
|
[`${classPrefix}-hidden`]: hidden
|
|
117
120
|
}),
|
|
@@ -182,7 +185,7 @@ const FormItem = props => {
|
|
|
182
185
|
}, [setSubMetas]);
|
|
183
186
|
|
|
184
187
|
function renderLayout(baseChildren, fieldId, meta, isRequired) {
|
|
185
|
-
var _a;
|
|
188
|
+
var _a, _b;
|
|
186
189
|
|
|
187
190
|
if (noStyle && !hidden) {
|
|
188
191
|
return baseChildren;
|
|
@@ -200,6 +203,18 @@ const FormItem = props => {
|
|
|
200
203
|
|
|
201
204
|
return subErrors;
|
|
202
205
|
}, curErrors);
|
|
206
|
+
const curWarnings = (_b = meta === null || meta === void 0 ? void 0 : meta.warnings) !== null && _b !== void 0 ? _b : [];
|
|
207
|
+
const warnings = Object.keys(subMetas).reduce((subWarnings, key) => {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
|
|
210
|
+
const warnings = (_b = (_a = subMetas[key]) === null || _a === void 0 ? void 0 : _a.warnings) !== null && _b !== void 0 ? _b : [];
|
|
211
|
+
|
|
212
|
+
if (warnings.length) {
|
|
213
|
+
subWarnings = [...subWarnings, ...warnings];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return subWarnings;
|
|
217
|
+
}, curWarnings);
|
|
203
218
|
return _react.default.createElement(FormItemLayout, {
|
|
204
219
|
className: className,
|
|
205
220
|
style: style,
|
|
@@ -212,6 +227,7 @@ const FormItem = props => {
|
|
|
212
227
|
hasFeedback: hasFeedback,
|
|
213
228
|
htmlFor: fieldId,
|
|
214
229
|
errors: errors,
|
|
230
|
+
warnings: warnings,
|
|
215
231
|
onClick: onClick,
|
|
216
232
|
hidden: hidden,
|
|
217
233
|
layout: layout,
|