antd-mobile 5.14.3 → 5.15.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/README.md +1 -2
- package/2x/bundle/antd-mobile.cjs.js +128 -121
- package/2x/bundle/antd-mobile.es.js +123 -116
- package/2x/bundle/style.css +9 -6
- package/2x/cjs/components/badge/badge.css +1 -1
- package/2x/cjs/components/badge/badge.d.ts +2 -0
- package/2x/cjs/components/badge/badge.js +2 -1
- package/2x/cjs/components/checkbox/checkbox.d.ts +18 -2
- package/2x/cjs/components/checkbox/checkbox.js +14 -4
- package/2x/cjs/components/checkbox/index.d.ts +13 -2
- package/2x/cjs/components/form/form-item.js +2 -4
- package/2x/cjs/components/form/form-subscribe.js +3 -9
- package/2x/cjs/components/form/form.d.ts +1 -1
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/infinite-scroll/infinite-scroll.js +13 -5
- package/2x/cjs/components/list/list.css +3 -0
- package/2x/cjs/components/list/list.d.ts +1 -1
- package/2x/cjs/components/rate/rate.css +2 -2
- package/2x/cjs/components/rate/rate.js +3 -3
- package/2x/cjs/components/rate/star.d.ts +2 -0
- package/2x/cjs/components/rate/star.js +37 -0
- package/2x/cjs/components/safe-area/safe-area.css +3 -2
- package/2x/cjs/components/text-area/text-area.d.ts +1 -0
- package/2x/cjs/components/text-area/text-area.js +5 -0
- package/2x/cjs/components/toast/methods.js +32 -73
- package/2x/cjs/components/water-mark/water-mark.js +3 -2
- package/2x/cjs/global/global.css +0 -1
- package/2x/cjs/global/theme-default.css +0 -1
- package/2x/cjs/utils/render-imperatively.d.ts +4 -1
- package/2x/cjs/utils/render-imperatively.js +23 -11
- package/2x/cjs/utils/use-props-value.js +2 -6
- package/2x/es/components/badge/badge.css +1 -1
- package/2x/es/components/badge/badge.d.ts +2 -0
- package/2x/es/components/badge/badge.js +2 -1
- package/2x/es/components/checkbox/checkbox.d.ts +18 -2
- package/2x/es/components/checkbox/checkbox.js +15 -3
- package/2x/es/components/checkbox/index.d.ts +13 -2
- package/2x/es/components/form/form-item.js +2 -2
- package/2x/es/components/form/form-subscribe.js +5 -8
- package/2x/es/components/form/form.d.ts +1 -1
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/infinite-scroll/infinite-scroll.js +14 -6
- package/2x/es/components/list/list.css +3 -0
- package/2x/es/components/list/list.d.ts +1 -1
- package/2x/es/components/rate/rate.css +2 -2
- package/2x/es/components/rate/rate.js +2 -2
- package/2x/es/components/rate/star.d.ts +2 -0
- package/2x/es/components/rate/star.js +25 -0
- package/2x/es/components/safe-area/safe-area.css +3 -2
- package/2x/es/components/text-area/text-area.d.ts +1 -0
- package/2x/es/components/text-area/text-area.js +5 -0
- package/2x/es/components/toast/methods.js +29 -67
- package/2x/es/components/water-mark/water-mark.js +3 -2
- package/2x/es/global/global.css +0 -1
- package/2x/es/global/theme-default.css +0 -1
- package/2x/es/utils/render-imperatively.d.ts +4 -1
- package/2x/es/utils/render-imperatively.js +23 -11
- package/2x/es/utils/use-props-value.js +2 -6
- package/2x/package.json +3 -3
- package/2x/umd/antd-mobile.js +1 -1
- package/README.md +1 -2
- package/bundle/antd-mobile.cjs.js +128 -121
- package/bundle/antd-mobile.es.js +123 -116
- package/bundle/style.css +9 -6
- package/cjs/components/badge/badge.css +1 -1
- package/cjs/components/badge/badge.d.ts +2 -0
- package/cjs/components/badge/badge.js +2 -1
- package/cjs/components/checkbox/checkbox.d.ts +18 -2
- package/cjs/components/checkbox/checkbox.js +14 -4
- package/cjs/components/checkbox/index.d.ts +13 -2
- package/cjs/components/form/form-item.js +2 -4
- package/cjs/components/form/form-subscribe.js +3 -9
- package/cjs/components/form/form.d.ts +1 -1
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/infinite-scroll/infinite-scroll.js +13 -5
- package/cjs/components/list/list.css +3 -0
- package/cjs/components/list/list.d.ts +1 -1
- package/cjs/components/rate/rate.css +2 -2
- package/cjs/components/rate/rate.js +3 -3
- package/cjs/components/rate/star.d.ts +2 -0
- package/cjs/components/rate/star.js +37 -0
- package/cjs/components/safe-area/safe-area.css +3 -2
- package/cjs/components/text-area/text-area.d.ts +1 -0
- package/cjs/components/text-area/text-area.js +5 -0
- package/cjs/components/toast/methods.js +32 -73
- package/cjs/components/water-mark/water-mark.js +3 -2
- package/cjs/global/global.css +0 -1
- package/cjs/global/theme-default.css +0 -1
- package/cjs/utils/render-imperatively.d.ts +4 -1
- package/cjs/utils/render-imperatively.js +23 -11
- package/cjs/utils/use-props-value.js +2 -6
- package/es/components/badge/badge.css +1 -1
- package/es/components/badge/badge.d.ts +2 -0
- package/es/components/badge/badge.js +2 -1
- package/es/components/checkbox/checkbox.d.ts +18 -2
- package/es/components/checkbox/checkbox.js +15 -3
- package/es/components/checkbox/index.d.ts +13 -2
- package/es/components/form/form-item.js +2 -2
- package/es/components/form/form-subscribe.js +5 -8
- package/es/components/form/form.d.ts +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/infinite-scroll/infinite-scroll.js +14 -6
- package/es/components/list/list.css +3 -0
- package/es/components/list/list.d.ts +1 -1
- package/es/components/rate/rate.css +2 -2
- package/es/components/rate/rate.js +2 -2
- package/es/components/rate/star.d.ts +2 -0
- package/es/components/rate/star.js +25 -0
- package/es/components/safe-area/safe-area.css +3 -2
- package/es/components/text-area/text-area.d.ts +1 -0
- package/es/components/text-area/text-area.js +5 -0
- package/es/components/toast/methods.js +29 -67
- package/es/components/water-mark/water-mark.js +3 -2
- package/es/global/global.css +0 -1
- package/es/global/theme-default.css +0 -1
- package/es/utils/render-imperatively.d.ts +4 -1
- package/es/utils/render-imperatively.js +23 -11
- package/es/utils/use-props-value.js +2 -6
- package/package.json +3 -3
- package/umd/antd-mobile.js +1 -1
- package/2x/cjs/components/form/form-imperative-item.d.ts +0 -5
- package/2x/cjs/components/form/form-imperative-item.js +0 -57
- package/2x/es/components/form/form-imperative-item.d.ts +0 -5
- package/2x/es/components/form/form-imperative-item.js +0 -38
- package/cjs/components/form/form-imperative-item.d.ts +0 -5
- package/cjs/components/form/form-imperative-item.js +0 -57
- package/es/components/form/form-imperative-item.d.ts +0 -5
- package/es/components/form/form-imperative-item.js +0 -38
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type CheckboxValue = string | number;
|
|
4
4
|
export declare type CheckboxProps = {
|
|
@@ -13,4 +13,20 @@ export declare type CheckboxProps = {
|
|
|
13
13
|
icon?: (checked: boolean, indeterminate: boolean) => React.ReactNode;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
} & NativeProps<'--icon-size' | '--font-size' | '--gap'>;
|
|
16
|
-
export declare
|
|
16
|
+
export declare type CheckboxRef = {
|
|
17
|
+
check: () => void;
|
|
18
|
+
uncheck: () => void;
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
22
|
+
checked?: boolean | undefined;
|
|
23
|
+
defaultChecked?: boolean | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
onChange?: ((checked: boolean) => void) | undefined;
|
|
26
|
+
value?: CheckboxValue | undefined;
|
|
27
|
+
indeterminate?: boolean | undefined;
|
|
28
|
+
block?: boolean | undefined;
|
|
29
|
+
id?: string | undefined;
|
|
30
|
+
icon?: ((checked: boolean, indeterminate: boolean) => React.ReactNode) | undefined;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
} & NativeProps<"--font-size" | "--icon-size" | "--gap"> & React.RefAttributes<CheckboxRef>>;
|
|
@@ -38,8 +38,7 @@ const defaultProps = {
|
|
|
38
38
|
defaultChecked: false,
|
|
39
39
|
indeterminate: false
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
const Checkbox = p => {
|
|
41
|
+
const Checkbox = (0, _react.forwardRef)((p, ref) => {
|
|
43
42
|
const groupContext = (0, _react.useContext)(_groupContext.CheckboxGroupContext);
|
|
44
43
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
45
44
|
let [checked, setChecked] = (0, _usePropsValue.usePropsValue)({
|
|
@@ -80,6 +79,18 @@ const Checkbox = p => {
|
|
|
80
79
|
disabled = disabled || groupContext.disabled;
|
|
81
80
|
}
|
|
82
81
|
|
|
82
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
83
|
+
check: () => {
|
|
84
|
+
setChecked(true);
|
|
85
|
+
},
|
|
86
|
+
uncheck: () => {
|
|
87
|
+
setChecked(false);
|
|
88
|
+
},
|
|
89
|
+
toggle: () => {
|
|
90
|
+
setChecked(!checked);
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
|
|
83
94
|
const renderIcon = () => {
|
|
84
95
|
if (props.icon) {
|
|
85
96
|
return _react.default.createElement("div", {
|
|
@@ -108,6 +119,5 @@ const Checkbox = p => {
|
|
|
108
119
|
}), renderIcon(), props.children && _react.default.createElement("div", {
|
|
109
120
|
className: `${classPrefix}-content`
|
|
110
121
|
}, props.children)));
|
|
111
|
-
};
|
|
112
|
-
|
|
122
|
+
});
|
|
113
123
|
exports.Checkbox = Checkbox;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './checkbox.less';
|
|
3
|
-
export type { CheckboxValue, CheckboxProps } from './checkbox';
|
|
3
|
+
export type { CheckboxValue, CheckboxProps, CheckboxRef } from './checkbox';
|
|
4
4
|
export type { CheckboxGroupProps } from './group';
|
|
5
|
-
declare const _default: import("react").
|
|
5
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
checked?: boolean | undefined;
|
|
7
|
+
defaultChecked?: boolean | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
onChange?: ((checked: boolean) => void) | undefined;
|
|
10
|
+
value?: import("./checkbox").CheckboxValue | undefined;
|
|
11
|
+
indeterminate?: boolean | undefined;
|
|
12
|
+
block?: boolean | undefined;
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
icon?: ((checked: boolean, indeterminate: boolean) => import("react").ReactNode) | undefined;
|
|
15
|
+
children?: import("react").ReactNode;
|
|
16
|
+
} & import("../../utils/native-props").NativeProps<"--font-size" | "--icon-size" | "--gap"> & import("react").RefAttributes<import("./checkbox").CheckboxRef>> & {
|
|
6
17
|
Group: import("react").FC<import("./group").CheckboxGroupProps>;
|
|
7
18
|
};
|
|
8
19
|
export default _default;
|
|
@@ -107,15 +107,13 @@ const FormItemLayout = props => {
|
|
|
107
107
|
e.preventDefault();
|
|
108
108
|
}
|
|
109
109
|
}, _react.default.createElement(_antdMobileIcons.QuestionCircleOutline, null)))) : null;
|
|
110
|
-
|
|
111
|
-
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", {
|
|
110
|
+
const description = props.description || hasFeedback ? _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", {
|
|
112
111
|
key: `error-${index}`,
|
|
113
112
|
className: `${classPrefix}-feedback-error`
|
|
114
113
|
}, error)), props.warnings.map((warning, index) => _react.default.createElement("div", {
|
|
115
114
|
key: `warning-${index}`,
|
|
116
115
|
className: `${classPrefix}-feedback-warning`
|
|
117
|
-
}, warning))));
|
|
118
|
-
|
|
116
|
+
}, warning)))) : null;
|
|
119
117
|
return _react.default.createElement(_list.default.Item, {
|
|
120
118
|
style: style,
|
|
121
119
|
title: layout === 'vertical' && labelElement,
|
|
@@ -11,27 +11,21 @@ var _rcFieldForm = require("rc-field-form");
|
|
|
11
11
|
|
|
12
12
|
var _ahooks = require("ahooks");
|
|
13
13
|
|
|
14
|
-
var _ = _interopRequireDefault(require("."));
|
|
15
|
-
|
|
16
14
|
var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
|
|
17
15
|
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
16
|
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); }
|
|
21
17
|
|
|
22
18
|
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; }
|
|
23
19
|
|
|
24
20
|
const FormSubscribe = props => {
|
|
25
21
|
const update = (0, _ahooks.useUpdate)();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
dependencies: props.to
|
|
29
|
-
}, form => _react.default.createElement(_react.default.Fragment, null, props.children(form.getFieldsValue(props.to), form), props.to.map(namePath => _react.default.createElement(Watcher, {
|
|
22
|
+
const form = (0, _react.useContext)(_rcFieldForm.FieldContext);
|
|
23
|
+
return _react.default.createElement(_react.default.Fragment, null, props.children(form.getFieldsValue(props.to), form), props.to.map(namePath => _react.default.createElement(Watcher, {
|
|
30
24
|
key: namePath.toString(),
|
|
31
25
|
form: form,
|
|
32
26
|
namePath: namePath,
|
|
33
27
|
onChange: update
|
|
34
|
-
})))
|
|
28
|
+
})));
|
|
35
29
|
};
|
|
36
30
|
|
|
37
31
|
exports.FormSubscribe = FormSubscribe;
|
|
@@ -8,7 +8,7 @@ export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'na
|
|
|
8
8
|
footer?: ReactNode;
|
|
9
9
|
mode?: ListProps['mode'];
|
|
10
10
|
};
|
|
11
|
-
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & NativeProps<"--border-
|
|
11
|
+
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & NativeProps<"--border-bottom" | "--border-inner" | "--border-top"> & Partial<FormContextType> & {
|
|
12
12
|
footer?: ReactNode;
|
|
13
13
|
mode?: ListProps['mode'];
|
|
14
14
|
} & React.RefAttributes<FormInstance>>;
|
|
@@ -7,7 +7,7 @@ export type { FormItemProps } from './form-item';
|
|
|
7
7
|
export type { FormSubscribeProps } from './form-subscribe';
|
|
8
8
|
export type { ValidateMessages, FieldData, NamePath, } from 'rc-field-form/es/interface';
|
|
9
9
|
export type { FormArrayField, FormArrayOperation, FormArrayProps, } from './form-array';
|
|
10
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & import("../../utils/native-props").NativeProps<"--border-
|
|
10
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & import("../../utils/native-props").NativeProps<"--border-bottom" | "--border-inner" | "--border-top"> & Partial<import("./context").FormContextType> & {
|
|
11
11
|
footer?: import("react").ReactNode;
|
|
12
12
|
mode?: "default" | "card" | undefined;
|
|
13
13
|
} & import("react").RefAttributes<import("./form").FormInstance>> & {
|
|
@@ -57,7 +57,9 @@ const InfiniteScroll = p => {
|
|
|
57
57
|
const [flag, setFlag] = (0, _react.useState)({});
|
|
58
58
|
const nextFlagRef = (0, _react.useRef)(flag);
|
|
59
59
|
const [scrollParent, setScrollParent] = (0, _react.useState)();
|
|
60
|
-
const
|
|
60
|
+
const {
|
|
61
|
+
run: check
|
|
62
|
+
} = (0, _ahooks.useThrottleFn)(() => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
|
|
61
63
|
if (nextFlagRef.current !== flag) return;
|
|
62
64
|
if (!props.hasMore) return;
|
|
63
65
|
const element = elementRef.current;
|
|
@@ -76,7 +78,11 @@ const InfiniteScroll = p => {
|
|
|
76
78
|
yield doLoadMore(false);
|
|
77
79
|
setFlag(nextFlag);
|
|
78
80
|
}
|
|
79
|
-
})
|
|
81
|
+
}), {
|
|
82
|
+
wait: 100,
|
|
83
|
+
leading: true,
|
|
84
|
+
trailing: true
|
|
85
|
+
}); // Make sure to trigger `loadMore` when content changes
|
|
80
86
|
|
|
81
87
|
(0, _react.useEffect)(() => {
|
|
82
88
|
check();
|
|
@@ -97,9 +103,11 @@ const InfiniteScroll = p => {
|
|
|
97
103
|
}, [scrollParent]);
|
|
98
104
|
|
|
99
105
|
function retry() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
return (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
107
|
+
setFailed(false);
|
|
108
|
+
yield doLoadMore(true);
|
|
109
|
+
setFlag(nextFlagRef.current);
|
|
110
|
+
});
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
--padding-left: 24px;
|
|
11
11
|
--padding-right: 24px;
|
|
12
12
|
--font-size: var(--adm-font-size-9);
|
|
13
|
+
--extra-max-width: 70%;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.adm-list-header {
|
|
@@ -79,9 +80,11 @@
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
.adm-list-item-content-extra {
|
|
83
|
+
flex: none;
|
|
82
84
|
padding-left: 24px;
|
|
83
85
|
font-size: var(--adm-font-size-7);
|
|
84
86
|
color: var(--adm-color-weak);
|
|
87
|
+
max-width: var(--extra-max-width);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
.adm-list-item-content-arrow {
|
|
@@ -4,5 +4,5 @@ export declare type ListProps = {
|
|
|
4
4
|
header?: ReactNode;
|
|
5
5
|
mode?: 'default' | 'card';
|
|
6
6
|
children?: ReactNode;
|
|
7
|
-
} & NativeProps<'--
|
|
7
|
+
} & NativeProps<'--active-background-color' | '--align-items' | '--border-bottom' | '--border-inner' | '--border-top' | '--extra-max-width' | '--font-size' | '--header-font-size' | '--padding-left' | '--padding-right' | '--prefix-padding-right' | '--prefix-width'>;
|
|
8
8
|
export declare const List: FC<ListProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.adm-rate {
|
|
2
2
|
--star-size: 48px;
|
|
3
3
|
--active-color: #ffd21e;
|
|
4
|
-
--inactive-color: var(--adm-color-
|
|
4
|
+
--inactive-color: var(--adm-color-border);
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.adm-rate-star {
|
|
13
|
-
padding:
|
|
13
|
+
padding: 0.125em;
|
|
14
14
|
line-height: var(--star-size);
|
|
15
15
|
font-size: var(--star-size);
|
|
16
16
|
color: var(--inactive-color);
|
|
@@ -13,17 +13,17 @@ var _nativeProps = require("../../utils/native-props");
|
|
|
13
13
|
|
|
14
14
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
15
15
|
|
|
16
|
-
var _antdMobileIcons = require("antd-mobile-icons");
|
|
17
|
-
|
|
18
16
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
19
17
|
|
|
18
|
+
var _star = require("./star");
|
|
19
|
+
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
22
|
const classPrefix = `adm-rate`;
|
|
23
23
|
const defaultProps = {
|
|
24
24
|
count: 5,
|
|
25
25
|
allowHalf: false,
|
|
26
|
-
character: _react.default.createElement(
|
|
26
|
+
character: _react.default.createElement(_star.Star, null),
|
|
27
27
|
defaultValue: 0,
|
|
28
28
|
readOnly: false,
|
|
29
29
|
allowClear: true
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Star = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const Star = () => {
|
|
13
|
+
// return (
|
|
14
|
+
// <svg height='1em' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'>
|
|
15
|
+
// <title>{'star-fill\u5907\u4EFD 71'}</title>
|
|
16
|
+
// <path
|
|
17
|
+
// d='m24 36-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L42.815 16a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L24 36Z'
|
|
18
|
+
// fill='#E5E5E5'
|
|
19
|
+
// fillRule='evenodd'
|
|
20
|
+
// />
|
|
21
|
+
// </svg>
|
|
22
|
+
// )
|
|
23
|
+
return _react.default.createElement("svg", {
|
|
24
|
+
viewBox: '0 0 42 40',
|
|
25
|
+
height: '1em',
|
|
26
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
27
|
+
style: {
|
|
28
|
+
verticalAlign: '-0.125em'
|
|
29
|
+
}
|
|
30
|
+
}, _react.default.createElement("path", {
|
|
31
|
+
d: 'm21 34-10.52 5.53a2 2 0 0 1-2.902-2.108l2.01-11.714-8.511-8.296a2 2 0 0 1 1.108-3.411l11.762-1.71 5.26-10.657a2 2 0 0 1 3.586 0l5.26 10.658L39.815 14a2 2 0 0 1 1.108 3.411l-8.51 8.296 2.009 11.714a2 2 0 0 1-2.902 2.109L21 34Z',
|
|
32
|
+
fill: 'currentColor',
|
|
33
|
+
fillRule: 'evenodd'
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.Star = Star;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
.adm-safe-area {
|
|
2
|
+
--multiple: var(--adm-safe-area-multiple, 1);
|
|
2
3
|
display: block;
|
|
3
4
|
width: 100%;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
.adm-safe-area-position-top {
|
|
7
|
-
padding-top: calc(env(safe-area-inset-top) * var(--
|
|
8
|
+
padding-top: calc(env(safe-area-inset-top) * var(--multiple));
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.adm-safe-area-position-bottom {
|
|
11
|
-
padding-bottom: calc(env(safe-area-inset-bottom) * var(--
|
|
12
|
+
padding-bottom: calc(env(safe-area-inset-bottom) * var(--multiple));
|
|
12
13
|
}
|
|
@@ -19,6 +19,7 @@ export declare type TextAreaRef = {
|
|
|
19
19
|
clear: () => void;
|
|
20
20
|
focus: () => void;
|
|
21
21
|
blur: () => void;
|
|
22
|
+
nativeElement: HTMLTextAreaElement | null;
|
|
22
23
|
};
|
|
23
24
|
export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "onClick" | "disabled" | "name" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoComplete" | "autoFocus" | "readOnly"> & {
|
|
24
25
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -57,7 +57,12 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
57
57
|
var _a;
|
|
58
58
|
|
|
59
59
|
(_a = nativeTextAreaRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
get nativeElement() {
|
|
63
|
+
return nativeTextAreaRef.current;
|
|
60
64
|
}
|
|
65
|
+
|
|
61
66
|
}));
|
|
62
67
|
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
63
68
|
if (!autoSize) return;
|
|
@@ -7,100 +7,59 @@ exports.clear = clear;
|
|
|
7
7
|
exports.config = config;
|
|
8
8
|
exports.show = show;
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
11
|
-
|
|
12
|
-
var _getContainer = require("../../utils/get-container");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
11
|
|
|
14
12
|
var _toast = require("./toast");
|
|
15
13
|
|
|
16
14
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
17
15
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
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); }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
16
|
+
var _renderImperatively = require("../../utils/render-imperatively");
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function unmount(container) {
|
|
27
|
-
const unmountResult = (0, _render.unmount)(container);
|
|
28
|
-
|
|
29
|
-
if (unmountResult && container.parentNode) {
|
|
30
|
-
container.parentNode.removeChild(container);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
19
|
|
|
20
|
+
let currentHandler = null;
|
|
21
|
+
let currentTimeout = null;
|
|
34
22
|
const defaultProps = {
|
|
35
23
|
duration: 2000,
|
|
36
24
|
position: 'center',
|
|
37
25
|
maskClickable: true
|
|
38
26
|
};
|
|
39
27
|
|
|
28
|
+
const ToastInner = props => _react.default.createElement(_toast.InternalToast, Object.assign({}, props));
|
|
29
|
+
|
|
40
30
|
function show(p) {
|
|
41
31
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, typeof p === 'string' ? {
|
|
42
32
|
content: p
|
|
43
33
|
} : p);
|
|
44
|
-
|
|
45
|
-
const {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const container = document.createElement('div');
|
|
49
|
-
const bodyContainer = (0, _getContainer.resolveContainer)(getContainer);
|
|
50
|
-
bodyContainer.appendChild(container);
|
|
51
|
-
clear();
|
|
52
|
-
containers.push(container);
|
|
53
|
-
const TempToast = (0, _react.forwardRef)((_, ref) => {
|
|
54
|
-
const [visible, setVisible] = (0, _react.useState)(true);
|
|
55
|
-
(0, _react.useEffect)(() => {
|
|
56
|
-
return () => {
|
|
57
|
-
var _a;
|
|
58
|
-
|
|
59
|
-
(_a = props.afterClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
(0, _react.useEffect)(() => {
|
|
63
|
-
if (props.duration === 0) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
timer = window.setTimeout(() => {
|
|
68
|
-
setVisible(false);
|
|
69
|
-
}, props.duration);
|
|
70
|
-
return () => {
|
|
71
|
-
window.clearTimeout(timer);
|
|
72
|
-
};
|
|
73
|
-
}, []);
|
|
74
|
-
(0, _react.useImperativeHandle)(ref, () => ({
|
|
75
|
-
close: () => setVisible(false)
|
|
76
|
-
}));
|
|
77
|
-
return _react.default.createElement(_toast.InternalToast, Object.assign({}, props, {
|
|
78
|
-
getContainer: () => container,
|
|
79
|
-
visible: visible,
|
|
80
|
-
afterClose: () => {
|
|
81
|
-
unmount(container);
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
const ref = (0, _react.createRef)();
|
|
86
|
-
(0, _render.render)(_react.default.createElement(TempToast, {
|
|
87
|
-
ref: ref
|
|
88
|
-
}), container);
|
|
89
|
-
return {
|
|
90
|
-
close: () => {
|
|
91
|
-
var _a;
|
|
92
|
-
|
|
93
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
34
|
+
|
|
35
|
+
const element = _react.default.createElement(ToastInner, Object.assign({}, props, {
|
|
36
|
+
onClose: () => {
|
|
37
|
+
currentHandler = null;
|
|
94
38
|
}
|
|
95
|
-
};
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
if (currentHandler) {
|
|
42
|
+
currentHandler.replace(element);
|
|
43
|
+
} else {
|
|
44
|
+
currentHandler = (0, _renderImperatively.renderImperatively)(element);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (currentTimeout) {
|
|
48
|
+
window.clearTimeout(currentTimeout);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (props.duration !== 0) {
|
|
52
|
+
currentTimeout = window.setTimeout(() => {
|
|
53
|
+
clear();
|
|
54
|
+
}, props.duration);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return currentHandler;
|
|
96
58
|
}
|
|
97
59
|
|
|
98
60
|
function clear() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!container) break;
|
|
102
|
-
unmount(container);
|
|
103
|
-
}
|
|
61
|
+
currentHandler === null || currentHandler === void 0 ? void 0 : currentHandler.close();
|
|
62
|
+
currentHandler = null;
|
|
104
63
|
}
|
|
105
64
|
|
|
106
65
|
function config(val) {
|
|
@@ -62,13 +62,14 @@ const WaterMark = p => {
|
|
|
62
62
|
const img = new Image();
|
|
63
63
|
img.crossOrigin = 'anonymous';
|
|
64
64
|
img.referrerPolicy = 'no-referrer';
|
|
65
|
-
img.src = image;
|
|
66
65
|
|
|
67
66
|
img.onload = () => {
|
|
68
67
|
ctx.drawImage(img, -imageWidth * ratio / 2, -imageHeight * ratio / 2, imageWidth * ratio, imageHeight * ratio);
|
|
69
68
|
ctx.restore();
|
|
70
69
|
setBase64Url(canvas.toDataURL());
|
|
71
70
|
};
|
|
71
|
+
|
|
72
|
+
img.src = image;
|
|
72
73
|
} else if (content) {
|
|
73
74
|
ctx.textBaseline = 'middle';
|
|
74
75
|
ctx.textAlign = 'center'; // 文字绕中间旋转
|
|
@@ -83,7 +84,7 @@ const WaterMark = p => {
|
|
|
83
84
|
setBase64Url(canvas.toDataURL());
|
|
84
85
|
}
|
|
85
86
|
} else {
|
|
86
|
-
throw new Error('
|
|
87
|
+
throw new Error('Canvas is not supported in the current environment');
|
|
87
88
|
}
|
|
88
89
|
}, [gapX, gapY, rotate, fontStyle, fontWeight, width, height, fontFamily, fontColor, image, content, fontSize]);
|
|
89
90
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
package/2x/cjs/global/global.css
CHANGED
|
@@ -4,7 +4,10 @@ declare type ImperativeProps = {
|
|
|
4
4
|
onClose?: () => void;
|
|
5
5
|
afterClose?: () => void;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
declare type TargetElement = ReactElement<ImperativeProps>;
|
|
8
|
+
export declare type ImperativeHandler = {
|
|
8
9
|
close: () => void;
|
|
10
|
+
replace: (element: TargetElement) => void;
|
|
9
11
|
};
|
|
12
|
+
export declare function renderImperatively(element: TargetElement): ImperativeHandler;
|
|
10
13
|
export {};
|
|
@@ -17,6 +17,8 @@ function renderImperatively(element) {
|
|
|
17
17
|
const Wrapper = _react.default.forwardRef((_, ref) => {
|
|
18
18
|
const [visible, setVisible] = (0, _react.useState)(false);
|
|
19
19
|
const closedRef = (0, _react.useRef)(false);
|
|
20
|
+
const [elementToRender, setElementToRender] = (0, _react.useState)(element);
|
|
21
|
+
const keyRef = (0, _react.useRef)(0);
|
|
20
22
|
(0, _react.useEffect)(() => {
|
|
21
23
|
if (!closedRef.current) {
|
|
22
24
|
setVisible(true);
|
|
@@ -30,20 +32,28 @@ function renderImperatively(element) {
|
|
|
30
32
|
|
|
31
33
|
closedRef.current = true;
|
|
32
34
|
setVisible(false);
|
|
33
|
-
(_b = (_a =
|
|
35
|
+
(_b = (_a = elementToRender.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function afterClose() {
|
|
37
39
|
var _a, _b;
|
|
38
40
|
|
|
39
41
|
unmount();
|
|
40
|
-
(_b = (_a =
|
|
42
|
+
(_b = (_a = elementToRender.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
44
|
-
close: onClose
|
|
46
|
+
close: onClose,
|
|
47
|
+
replace: element => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
|
|
50
|
+
keyRef.current++;
|
|
51
|
+
(_b = (_a = elementToRender.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
52
|
+
setElementToRender(element);
|
|
53
|
+
}
|
|
45
54
|
}));
|
|
46
|
-
return _react.default.cloneElement(
|
|
55
|
+
return _react.default.cloneElement(elementToRender, Object.assign(Object.assign({}, elementToRender.props), {
|
|
56
|
+
key: keyRef.current,
|
|
47
57
|
visible,
|
|
48
58
|
onClose,
|
|
49
59
|
afterClose
|
|
@@ -55,14 +65,16 @@ function renderImperatively(element) {
|
|
|
55
65
|
const unmount = (0, _renderToBody.renderToBody)(_react.default.createElement(Wrapper, {
|
|
56
66
|
ref: wrapperRef
|
|
57
67
|
}));
|
|
68
|
+
return {
|
|
69
|
+
close: () => {
|
|
70
|
+
var _a;
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
72
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
73
|
+
},
|
|
74
|
+
replace: element => {
|
|
75
|
+
var _a;
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.replace(element);
|
|
78
|
+
}
|
|
67
79
|
};
|
|
68
80
|
}
|
|
@@ -24,12 +24,8 @@ function usePropsValue(options) {
|
|
|
24
24
|
|
|
25
25
|
const setState = (0, _ahooks.useMemoizedFn)(v => {
|
|
26
26
|
const nextValue = typeof v === 'function' ? v(stateRef.current) : v;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
stateRef.current = nextValue;
|
|
30
|
-
update();
|
|
31
|
-
}
|
|
32
|
-
|
|
27
|
+
stateRef.current = nextValue;
|
|
28
|
+
update();
|
|
33
29
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
34
30
|
});
|
|
35
31
|
return [stateRef.current, setState];
|
|
@@ -6,5 +6,7 @@ export declare type BadgeProps = {
|
|
|
6
6
|
color?: string;
|
|
7
7
|
bordered?: boolean;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
|
+
wrapperClassName?: string;
|
|
10
|
+
wrapperStyle?: React.CSSProperties;
|
|
9
11
|
} & NativeProps<'--right' | '--top' | '--color'>;
|
|
10
12
|
export declare const Badge: FC<BadgeProps>;
|
|
@@ -20,6 +20,7 @@ export const Badge = props => {
|
|
|
20
20
|
className: `${classPrefix}-content`
|
|
21
21
|
}, content))) : null;
|
|
22
22
|
return children ? React.createElement("div", {
|
|
23
|
-
className: `${classPrefix}-
|
|
23
|
+
className: classNames(`${classPrefix}-wrapper`, props.wrapperClassName),
|
|
24
|
+
style: props.wrapperStyle
|
|
24
25
|
}, children, element) : element;
|
|
25
26
|
};
|