antd-mobile 5.14.1 → 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 +216 -197
- package/2x/bundle/antd-mobile.es.js +211 -192
- package/2x/bundle/css-vars-patch.css +53 -53
- 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.d.ts +7 -2
- package/2x/cjs/components/form/form-subscribe.js +28 -16
- package/2x/cjs/components/form/form.d.ts +1 -1
- package/2x/cjs/components/form/index.d.ts +2 -2
- package/2x/cjs/components/infinite-scroll/infinite-scroll.js +13 -4
- 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/toast/toast.js +6 -2
- package/2x/cjs/components/water-mark/water-mark.js +3 -2
- package/2x/cjs/global/css-vars-patch.css +53 -53
- 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.d.ts +7 -2
- package/2x/es/components/form/form-subscribe.js +21 -14
- package/2x/es/components/form/form.d.ts +1 -1
- package/2x/es/components/form/index.d.ts +2 -2
- package/2x/es/components/infinite-scroll/infinite-scroll.js +14 -5
- 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/toast/toast.js +6 -2
- package/2x/es/components/water-mark/water-mark.js +3 -2
- package/2x/es/global/css-vars-patch.css +53 -53
- 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 +5 -5
- package/2x/umd/antd-mobile.js +1 -1
- package/README.md +1 -2
- package/bundle/antd-mobile.cjs.js +216 -197
- package/bundle/antd-mobile.es.js +211 -192
- 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.d.ts +7 -2
- package/cjs/components/form/form-subscribe.js +28 -16
- package/cjs/components/form/form.d.ts +1 -1
- package/cjs/components/form/index.d.ts +2 -2
- package/cjs/components/infinite-scroll/infinite-scroll.js +13 -4
- 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/toast/toast.js +6 -2
- 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.d.ts +7 -2
- package/es/components/form/form-subscribe.js +21 -14
- package/es/components/form/form.d.ts +1 -1
- package/es/components/form/index.d.ts +2 -2
- package/es/components/infinite-scroll/infinite-scroll.js +14 -5
- 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/toast/toast.js +6 -2
- 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 +5 -5
- 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
package/bundle/style.css
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
--adm-font-size-8: 16px;
|
|
13
13
|
--adm-font-size-9: 17px;
|
|
14
14
|
--adm-font-size-10: 18px;
|
|
15
|
-
--adm-hd: 1;
|
|
16
15
|
--adm-color-primary: #1677ff;
|
|
17
16
|
--adm-color-success: #00b578;
|
|
18
17
|
--adm-color-warning: #ff8f1f;
|
|
@@ -189,14 +188,15 @@ div.adm-px-tester {
|
|
|
189
188
|
z-index: 1;
|
|
190
189
|
}
|
|
191
190
|
.adm-safe-area {
|
|
191
|
+
--multiple: var(--adm-safe-area-multiple, 1);
|
|
192
192
|
display: block;
|
|
193
193
|
width: 100%;
|
|
194
194
|
}
|
|
195
195
|
.adm-safe-area-position-top {
|
|
196
|
-
padding-top: calc(env(safe-area-inset-top) * var(--
|
|
196
|
+
padding-top: calc(env(safe-area-inset-top) * var(--multiple));
|
|
197
197
|
}
|
|
198
198
|
.adm-safe-area-position-bottom {
|
|
199
|
-
padding-bottom: calc(env(safe-area-inset-bottom) * var(--
|
|
199
|
+
padding-bottom: calc(env(safe-area-inset-bottom) * var(--multiple));
|
|
200
200
|
}
|
|
201
201
|
.adm-auto-center {
|
|
202
202
|
display: flex;
|
|
@@ -219,7 +219,7 @@ div.adm-px-tester {
|
|
|
219
219
|
width: 100%;
|
|
220
220
|
display: block;
|
|
221
221
|
}
|
|
222
|
-
.adm-badge-
|
|
222
|
+
.adm-badge-wrapper {
|
|
223
223
|
display: inline-block;
|
|
224
224
|
position: relative;
|
|
225
225
|
}
|
|
@@ -875,6 +875,7 @@ div.adm-px-tester {
|
|
|
875
875
|
--padding-left: 12px;
|
|
876
876
|
--padding-right: 12px;
|
|
877
877
|
--font-size: var(--adm-font-size-9);
|
|
878
|
+
--extra-max-width: 70%;
|
|
878
879
|
}
|
|
879
880
|
.adm-list-header {
|
|
880
881
|
color: var(--adm-color-weak);
|
|
@@ -931,9 +932,11 @@ div.adm-px-tester {
|
|
|
931
932
|
padding: 12px 0;
|
|
932
933
|
}
|
|
933
934
|
.adm-list-item-content-extra {
|
|
935
|
+
flex: none;
|
|
934
936
|
padding-left: 12px;
|
|
935
937
|
font-size: var(--adm-font-size-7);
|
|
936
938
|
color: var(--adm-color-weak);
|
|
939
|
+
max-width: var(--extra-max-width);
|
|
937
940
|
}
|
|
938
941
|
.adm-list-item-content-arrow {
|
|
939
942
|
flex: none;
|
|
@@ -2859,14 +2862,14 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
2859
2862
|
.adm-rate {
|
|
2860
2863
|
--star-size: 24px;
|
|
2861
2864
|
--active-color: #ffd21e;
|
|
2862
|
-
--inactive-color: var(--adm-color-
|
|
2865
|
+
--inactive-color: var(--adm-color-border);
|
|
2863
2866
|
display: inline-flex;
|
|
2864
2867
|
}
|
|
2865
2868
|
.adm-rate-box {
|
|
2866
2869
|
position: relative;
|
|
2867
2870
|
}
|
|
2868
2871
|
.adm-rate-star {
|
|
2869
|
-
padding:
|
|
2872
|
+
padding: 0.125em;
|
|
2870
2873
|
line-height: var(--star-size);
|
|
2871
2874
|
font-size: var(--star-size);
|
|
2872
2875
|
color: var(--inactive-color);
|
|
@@ -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>;
|
|
@@ -36,7 +36,8 @@ const Badge = props => {
|
|
|
36
36
|
className: `${classPrefix}-content`
|
|
37
37
|
}, content))) : null;
|
|
38
38
|
return children ? _react.default.createElement("div", {
|
|
39
|
-
className: `${classPrefix}-
|
|
39
|
+
className: (0, _classnames.default)(`${classPrefix}-wrapper`, props.wrapperClassName),
|
|
40
|
+
style: props.wrapperStyle
|
|
40
41
|
}, children, element) : element;
|
|
41
42
|
};
|
|
42
43
|
|
|
@@ -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,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
2
|
import type { FormInstance } from 'rc-field-form';
|
|
3
3
|
import type { NamePath } from 'rc-field-form/es/interface';
|
|
4
4
|
declare type RenderChildren<Values = any> = (changedValues: Record<string, any>, form: FormInstance<Values>) => React.ReactNode;
|
|
@@ -7,5 +7,10 @@ export interface FormSubscribeProps {
|
|
|
7
7
|
to: NamePath[];
|
|
8
8
|
children: ChildrenType;
|
|
9
9
|
}
|
|
10
|
-
export declare const FormSubscribe:
|
|
10
|
+
export declare const FormSubscribe: FC<FormSubscribeProps>;
|
|
11
|
+
export declare const Watcher: React.NamedExoticComponent<{
|
|
12
|
+
form: FormInstance;
|
|
13
|
+
namePath: NamePath;
|
|
14
|
+
onChange: () => void;
|
|
15
|
+
}>;
|
|
11
16
|
export {};
|
|
@@ -3,25 +3,37 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.FormSubscribe = void 0;
|
|
6
|
+
exports.Watcher = exports.FormSubscribe = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _rcFieldForm = require("rc-field-form");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _ahooks = require("ahooks");
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
|
|
15
|
+
|
|
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); }
|
|
17
|
+
|
|
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; }
|
|
19
|
+
|
|
20
|
+
const FormSubscribe = props => {
|
|
21
|
+
const update = (0, _ahooks.useUpdate)();
|
|
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, {
|
|
24
|
+
key: namePath.toString(),
|
|
25
|
+
form: form,
|
|
26
|
+
namePath: namePath,
|
|
27
|
+
onChange: update
|
|
28
|
+
})));
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
exports.FormSubscribe = FormSubscribe;
|
|
31
|
+
exports.FormSubscribe = FormSubscribe;
|
|
32
|
+
const Watcher = (0, _react.memo)(props => {
|
|
33
|
+
const value = (0, _rcFieldForm.useWatch)(props.namePath, props.form);
|
|
34
|
+
(0, _useIsomorphicUpdateLayoutEffect.useIsomorphicUpdateLayoutEffect)(() => {
|
|
35
|
+
props.onChange();
|
|
36
|
+
}, [value]);
|
|
37
|
+
return null;
|
|
38
|
+
});
|
|
39
|
+
exports.Watcher = Watcher;
|
|
@@ -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,12 +7,12 @@ 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>> & {
|
|
14
14
|
Item: import("react").FC<import("./form-item").FormItemProps>;
|
|
15
|
-
Subscribe: import("react").
|
|
15
|
+
Subscribe: import("react").FC<import("./form-subscribe").FormSubscribeProps>;
|
|
16
16
|
Header: import("react").FC<{
|
|
17
17
|
children?: import("react").ReactNode;
|
|
18
18
|
}>;
|
|
@@ -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,8 +103,11 @@ const InfiniteScroll = p => {
|
|
|
97
103
|
}, [scrollParent]);
|
|
98
104
|
|
|
99
105
|
function retry() {
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
return (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
107
|
+
setFailed(false);
|
|
108
|
+
yield doLoadMore(true);
|
|
109
|
+
setFlag(nextFlagRef.current);
|
|
110
|
+
});
|
|
102
111
|
}
|
|
103
112
|
|
|
104
113
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
--padding-left: 12px;
|
|
11
11
|
--padding-right: 12px;
|
|
12
12
|
--font-size: var(--adm-font-size-9);
|
|
13
|
+
--extra-max-width: 70%;
|
|
13
14
|
}
|
|
14
15
|
.adm-list-header {
|
|
15
16
|
color: var(--adm-color-weak);
|
|
@@ -66,9 +67,11 @@
|
|
|
66
67
|
padding: 12px 0;
|
|
67
68
|
}
|
|
68
69
|
.adm-list-item-content-extra {
|
|
70
|
+
flex: none;
|
|
69
71
|
padding-left: 12px;
|
|
70
72
|
font-size: var(--adm-font-size-7);
|
|
71
73
|
color: var(--adm-color-weak);
|
|
74
|
+
max-width: var(--extra-max-width);
|
|
72
75
|
}
|
|
73
76
|
.adm-list-item-content-arrow {
|
|
74
77
|
flex: none;
|
|
@@ -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,14 +1,14 @@
|
|
|
1
1
|
.adm-rate {
|
|
2
2
|
--star-size: 24px;
|
|
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
|
.adm-rate-box {
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
.adm-rate-star {
|
|
11
|
-
padding:
|
|
11
|
+
padding: 0.125em;
|
|
12
12
|
line-height: var(--star-size);
|
|
13
13
|
font-size: var(--star-size);
|
|
14
14
|
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,10 +1,11 @@
|
|
|
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
|
.adm-safe-area-position-top {
|
|
6
|
-
padding-top: calc(env(safe-area-inset-top) * var(--
|
|
7
|
+
padding-top: calc(env(safe-area-inset-top) * var(--multiple));
|
|
7
8
|
}
|
|
8
9
|
.adm-safe-area-position-bottom {
|
|
9
|
-
padding-bottom: calc(env(safe-area-inset-bottom) * var(--
|
|
10
|
+
padding-bottom: calc(env(safe-area-inset-bottom) * var(--multiple));
|
|
10
11
|
}
|
|
@@ -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) {
|
|
@@ -44,10 +44,14 @@ const InternalToast = p => {
|
|
|
44
44
|
|
|
45
45
|
switch (icon) {
|
|
46
46
|
case 'success':
|
|
47
|
-
return _react.default.createElement(_antdMobileIcons.CheckOutline,
|
|
47
|
+
return _react.default.createElement(_antdMobileIcons.CheckOutline, {
|
|
48
|
+
className: `${classPrefix}-icon-success`
|
|
49
|
+
});
|
|
48
50
|
|
|
49
51
|
case 'fail':
|
|
50
|
-
return _react.default.createElement(_antdMobileIcons.CloseOutline,
|
|
52
|
+
return _react.default.createElement(_antdMobileIcons.CloseOutline, {
|
|
53
|
+
className: `${classPrefix}-icon-fail`
|
|
54
|
+
});
|
|
51
55
|
|
|
52
56
|
case 'loading':
|
|
53
57
|
return _react.default.createElement(_spinLoading.default, {
|