antd-mobile 5.36.0 → 5.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/bundle/antd-mobile.cjs.development.js +393 -295
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +393 -295
- package/2x/bundle/antd-mobile.es.js +5619 -5550
- package/2x/bundle/antd-mobile.umd.development.js +393 -295
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/style.css +5 -8
- package/2x/cjs/components/card/card.css +5 -5
- package/2x/cjs/components/card/card.patch.css +21 -0
- package/2x/cjs/components/center-popup/center-popup.js +46 -43
- package/2x/cjs/components/check-list/check-list.js +15 -11
- package/2x/cjs/components/collapse/collapse.d.ts +10 -2
- package/2x/cjs/components/collapse/collapse.js +54 -39
- package/2x/cjs/components/config-provider/config-provider.d.ts +40 -2
- package/2x/cjs/components/dropdown/context.d.ts +2 -0
- package/2x/cjs/components/dropdown/context.js +10 -0
- package/2x/cjs/components/dropdown/dropdown.d.ts +11 -3
- package/2x/cjs/components/dropdown/dropdown.js +23 -16
- package/2x/cjs/components/dropdown/index.d.ts +1 -0
- package/2x/cjs/components/dropdown/item.d.ts +5 -1
- package/2x/cjs/components/dropdown/item.js +22 -8
- package/2x/cjs/components/form/form-item.d.ts +6 -5
- package/2x/cjs/components/form/form-item.js +25 -17
- package/2x/cjs/components/form/form.d.ts +1 -1
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/input/input.d.ts +3 -1
- package/2x/cjs/components/input/input.js +53 -51
- package/2x/cjs/components/list/list-item.d.ts +6 -2
- package/2x/cjs/components/list/list-item.js +16 -6
- package/2x/cjs/components/nav-bar/nav-bar.d.ts +4 -0
- package/2x/cjs/components/nav-bar/nav-bar.js +18 -13
- package/2x/cjs/components/notice-bar/notice-bar.css +0 -3
- package/2x/cjs/components/notice-bar/notice-bar.d.ts +3 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +30 -25
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/cjs/components/number-keyboard/number-keyboard.js +14 -13
- package/2x/cjs/components/popup/popup-base-props.d.ts +3 -2
- package/2x/cjs/components/popup/popup-base-props.js +4 -0
- package/2x/cjs/components/popup/popup.js +5 -5
- package/2x/cjs/components/result/result.js +3 -10
- package/2x/cjs/components/result/use-result-icon.d.ts +3 -0
- package/2x/cjs/components/result/use-result-icon.js +37 -0
- package/2x/cjs/components/result-page/result-page.js +3 -10
- package/2x/cjs/components/search-bar/search-bar.d.ts +10 -2
- package/2x/cjs/components/search-bar/search-bar.js +34 -33
- package/2x/cjs/components/toast/toast.d.ts +2 -2
- package/2x/cjs/components/toast/toast.js +4 -4
- package/2x/cjs/components/virtual-input/virtual-input.d.ts +5 -5
- package/2x/cjs/components/virtual-input/virtual-input.js +26 -24
- package/2x/cjs/locales/ar-SA.js +2 -2
- package/2x/cjs/locales/de-DE.js +3 -3
- package/2x/cjs/locales/es-ES.js +2 -2
- package/2x/cjs/locales/fr-FR.js +1 -1
- package/2x/cjs/locales/in-ID.d.ts +139 -0
- package/2x/cjs/locales/in-ID.js +149 -0
- package/2x/cjs/locales/ja-JP.js +2 -2
- package/2x/cjs/locales/th-TH.js +2 -2
- package/2x/cjs/utils/is-node-with-content.d.ts +3 -0
- package/2x/cjs/utils/is-node-with-content.js +3 -0
- package/2x/cjs/utils/use-mutation-effect.d.ts +1 -0
- package/2x/cjs/utils/use-mutation-effect.js +20 -9
- package/2x/cjs/utils/with-default-props.d.ts +7 -0
- package/2x/cjs/utils/with-default-props.js +21 -5
- package/2x/es/components/card/card.css +5 -5
- package/2x/es/components/card/card.patch.css +21 -0
- package/2x/es/components/center-popup/center-popup.js +45 -42
- package/2x/es/components/check-list/check-list.js +15 -11
- package/2x/es/components/collapse/collapse.d.ts +10 -2
- package/2x/es/components/collapse/collapse.js +53 -38
- package/2x/es/components/config-provider/config-provider.d.ts +40 -2
- package/2x/es/components/dropdown/context.d.ts +2 -0
- package/2x/es/components/dropdown/context.js +2 -0
- package/2x/es/components/dropdown/dropdown.d.ts +11 -3
- package/2x/es/components/dropdown/dropdown.js +24 -17
- package/2x/es/components/dropdown/index.d.ts +1 -0
- package/2x/es/components/dropdown/item.d.ts +5 -1
- package/2x/es/components/dropdown/item.js +22 -8
- package/2x/es/components/form/form-item.d.ts +6 -5
- package/2x/es/components/form/form-item.js +24 -16
- package/2x/es/components/form/form.d.ts +1 -1
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/input/input.d.ts +3 -1
- package/2x/es/components/input/input.js +52 -50
- package/2x/es/components/list/list-item.d.ts +6 -2
- package/2x/es/components/list/list-item.js +16 -6
- package/2x/es/components/nav-bar/nav-bar.d.ts +4 -0
- package/2x/es/components/nav-bar/nav-bar.js +18 -13
- package/2x/es/components/notice-bar/notice-bar.css +0 -3
- package/2x/es/components/notice-bar/notice-bar.d.ts +3 -1
- package/2x/es/components/notice-bar/notice-bar.js +29 -24
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +13 -12
- package/2x/es/components/popup/popup-base-props.d.ts +3 -2
- package/2x/es/components/popup/popup-base-props.js +3 -0
- package/2x/es/components/popup/popup.js +5 -5
- package/2x/es/components/result/result.js +3 -10
- package/2x/es/components/result/use-result-icon.d.ts +3 -0
- package/2x/es/components/result/use-result-icon.js +29 -0
- package/2x/es/components/result-page/result-page.js +3 -10
- package/2x/es/components/search-bar/search-bar.d.ts +10 -2
- package/2x/es/components/search-bar/search-bar.js +33 -32
- package/2x/es/components/toast/toast.d.ts +2 -2
- package/2x/es/components/toast/toast.js +3 -3
- package/2x/es/components/virtual-input/virtual-input.d.ts +5 -5
- package/2x/es/components/virtual-input/virtual-input.js +25 -23
- package/2x/es/locales/ar-SA.js +2 -2
- package/2x/es/locales/de-DE.js +3 -3
- package/2x/es/locales/es-ES.js +2 -2
- package/2x/es/locales/fr-FR.js +1 -1
- package/2x/es/locales/in-ID.d.ts +139 -0
- package/2x/es/locales/in-ID.js +142 -0
- package/2x/es/locales/ja-JP.js +2 -2
- package/2x/es/locales/th-TH.js +2 -2
- package/2x/es/utils/is-node-with-content.d.ts +3 -0
- package/2x/es/utils/is-node-with-content.js +3 -0
- package/2x/es/utils/use-mutation-effect.d.ts +1 -0
- package/2x/es/utils/use-mutation-effect.js +19 -9
- package/2x/es/utils/with-default-props.d.ts +7 -0
- package/2x/es/utils/with-default-props.js +20 -5
- package/2x/package.json +3 -2
- package/bundle/antd-mobile.cjs.development.js +393 -295
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +393 -295
- package/bundle/antd-mobile.es.js +5619 -5550
- package/bundle/antd-mobile.umd.development.js +393 -295
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/style.css +1 -1
- package/cjs/components/card/card.css +5 -5
- package/cjs/components/card/card.patch.css +17 -0
- package/cjs/components/center-popup/center-popup.js +46 -43
- package/cjs/components/check-list/check-list.js +15 -11
- package/cjs/components/collapse/collapse.d.ts +10 -2
- package/cjs/components/collapse/collapse.js +54 -39
- package/cjs/components/config-provider/config-provider.d.ts +40 -2
- package/cjs/components/dropdown/context.d.ts +2 -0
- package/cjs/components/dropdown/context.js +10 -0
- package/cjs/components/dropdown/dropdown.d.ts +11 -3
- package/cjs/components/dropdown/dropdown.js +23 -16
- package/cjs/components/dropdown/index.d.ts +1 -0
- package/cjs/components/dropdown/item.d.ts +5 -1
- package/cjs/components/dropdown/item.js +22 -8
- package/cjs/components/form/form-item.d.ts +6 -5
- package/cjs/components/form/form-item.js +25 -17
- package/cjs/components/form/form.d.ts +1 -1
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/input/input.d.ts +3 -1
- package/cjs/components/input/input.js +53 -51
- package/cjs/components/list/list-item.d.ts +6 -2
- package/cjs/components/list/list-item.js +16 -6
- package/cjs/components/nav-bar/nav-bar.d.ts +4 -0
- package/cjs/components/nav-bar/nav-bar.js +18 -13
- package/cjs/components/notice-bar/notice-bar.css +0 -2
- package/cjs/components/notice-bar/notice-bar.d.ts +3 -1
- package/cjs/components/notice-bar/notice-bar.js +30 -25
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/cjs/components/number-keyboard/number-keyboard.js +14 -13
- package/cjs/components/popup/popup-base-props.d.ts +3 -2
- package/cjs/components/popup/popup-base-props.js +4 -0
- package/cjs/components/popup/popup.js +5 -5
- package/cjs/components/result/result.js +3 -10
- package/cjs/components/result/use-result-icon.d.ts +3 -0
- package/cjs/components/result/use-result-icon.js +37 -0
- package/cjs/components/result-page/result-page.js +3 -10
- package/cjs/components/search-bar/search-bar.d.ts +10 -2
- package/cjs/components/search-bar/search-bar.js +34 -33
- package/cjs/components/toast/toast.css +1 -1
- package/cjs/components/toast/toast.d.ts +2 -2
- package/cjs/components/toast/toast.js +4 -4
- package/cjs/components/virtual-input/virtual-input.d.ts +5 -5
- package/cjs/components/virtual-input/virtual-input.js +26 -24
- package/cjs/locales/ar-SA.js +2 -2
- package/cjs/locales/de-DE.js +3 -3
- package/cjs/locales/es-ES.js +2 -2
- package/cjs/locales/fr-FR.js +1 -1
- package/cjs/locales/in-ID.d.ts +139 -0
- package/cjs/locales/in-ID.js +149 -0
- package/cjs/locales/ja-JP.js +2 -2
- package/cjs/locales/th-TH.js +2 -2
- package/cjs/utils/is-node-with-content.d.ts +3 -0
- package/cjs/utils/is-node-with-content.js +3 -0
- package/cjs/utils/use-mutation-effect.d.ts +1 -0
- package/cjs/utils/use-mutation-effect.js +20 -9
- package/cjs/utils/with-default-props.d.ts +7 -0
- package/cjs/utils/with-default-props.js +21 -5
- package/es/components/card/card.css +5 -5
- package/es/components/card/card.patch.css +17 -0
- package/es/components/center-popup/center-popup.js +45 -42
- package/es/components/check-list/check-list.js +15 -11
- package/es/components/collapse/collapse.d.ts +10 -2
- package/es/components/collapse/collapse.js +53 -38
- package/es/components/config-provider/config-provider.d.ts +40 -2
- package/es/components/dropdown/context.d.ts +2 -0
- package/es/components/dropdown/context.js +2 -0
- package/es/components/dropdown/dropdown.d.ts +11 -3
- package/es/components/dropdown/dropdown.js +24 -17
- package/es/components/dropdown/index.d.ts +1 -0
- package/es/components/dropdown/item.d.ts +5 -1
- package/es/components/dropdown/item.js +22 -8
- package/es/components/form/form-item.d.ts +6 -5
- package/es/components/form/form-item.js +24 -16
- package/es/components/form/form.d.ts +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/input/input.d.ts +3 -1
- package/es/components/input/input.js +52 -50
- package/es/components/list/list-item.d.ts +6 -2
- package/es/components/list/list-item.js +16 -6
- package/es/components/nav-bar/nav-bar.d.ts +4 -0
- package/es/components/nav-bar/nav-bar.js +18 -13
- package/es/components/notice-bar/notice-bar.css +0 -2
- package/es/components/notice-bar/notice-bar.d.ts +3 -1
- package/es/components/notice-bar/notice-bar.js +29 -24
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/es/components/number-keyboard/number-keyboard.js +13 -12
- package/es/components/popup/popup-base-props.d.ts +3 -2
- package/es/components/popup/popup-base-props.js +3 -0
- package/es/components/popup/popup.js +5 -5
- package/es/components/result/result.js +3 -10
- package/es/components/result/use-result-icon.d.ts +3 -0
- package/es/components/result/use-result-icon.js +29 -0
- package/es/components/result-page/result-page.js +3 -10
- package/es/components/search-bar/search-bar.d.ts +10 -2
- package/es/components/search-bar/search-bar.js +33 -32
- package/es/components/toast/toast.css +1 -1
- package/es/components/toast/toast.d.ts +2 -2
- package/es/components/toast/toast.js +3 -3
- package/es/components/virtual-input/virtual-input.d.ts +5 -5
- package/es/components/virtual-input/virtual-input.js +25 -23
- package/es/locales/ar-SA.js +2 -2
- package/es/locales/de-DE.js +3 -3
- package/es/locales/es-ES.js +2 -2
- package/es/locales/fr-FR.js +1 -1
- package/es/locales/in-ID.d.ts +139 -0
- package/es/locales/in-ID.js +142 -0
- package/es/locales/ja-JP.js +2 -2
- package/es/locales/th-TH.js +2 -2
- package/es/utils/is-node-with-content.d.ts +3 -0
- package/es/utils/is-node-with-content.js +3 -0
- package/es/utils/use-mutation-effect.d.ts +1 -0
- package/es/utils/use-mutation-effect.js +19 -9
- package/es/utils/with-default-props.d.ts +7 -0
- package/es/utils/with-default-props.js +20 -5
- package/package.json +3 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { FC, ReactNode, MutableRefObject } from 'react';
|
|
3
|
-
import { NativeProps } from '../../utils/native-props';
|
|
4
1
|
import { FormInstance } from 'rc-field-form';
|
|
5
2
|
import type { FieldProps } from 'rc-field-form/lib/Field';
|
|
6
|
-
import type {
|
|
3
|
+
import type { FC, MutableRefObject, ReactNode } from 'react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { NativeProps } from '../../utils/native-props';
|
|
7
6
|
import { ListItemProps } from '../list';
|
|
7
|
+
import type { FormLayout } from './index';
|
|
8
8
|
declare type RenderChildren<Values = any> = (form: FormInstance<Values>) => ReactNode;
|
|
9
9
|
declare type ChildrenType<Values = any> = RenderChildren<Values> | ReactNode;
|
|
10
10
|
declare type RcFieldProps = Omit<FieldProps, 'children'>;
|
|
11
|
-
export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue' | 'getValueFromEvent' | 'getValueProps' | 'normalize' | 'preserve' | 'validateFirst'> & Pick<ListItemProps, 'style' | 'extra' | 'clickable' | 'arrow' | 'description'> & {
|
|
11
|
+
export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue' | 'getValueFromEvent' | 'getValueProps' | 'normalize' | 'preserve' | 'validateFirst'> & Pick<ListItemProps, 'style' | 'extra' | 'clickable' | 'arrow' | 'arrowIcon' | 'description'> & {
|
|
12
12
|
label?: ReactNode;
|
|
13
13
|
help?: ReactNode;
|
|
14
|
+
helpIcon?: ReactNode;
|
|
14
15
|
hasFeedback?: boolean;
|
|
15
16
|
required?: boolean;
|
|
16
17
|
noStyle?: boolean;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import
|
|
2
|
+
import { QuestionCircleOutline } from 'antd-mobile-icons';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { withNativeProps } from '../../utils/native-props';
|
|
5
4
|
import { Field } from 'rc-field-form';
|
|
6
5
|
import FieldContext from 'rc-field-form/lib/FieldContext';
|
|
6
|
+
import React, { useCallback, useContext, useRef, useState } from 'react';
|
|
7
7
|
import { devWarning } from '../../utils/dev-log';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
9
|
+
import { undefinedFallback } from '../../utils/undefined-fallback';
|
|
10
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
11
|
+
import { useConfig } from '../config-provider';
|
|
10
12
|
import List from '../list';
|
|
11
13
|
import Popover from '../popover';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { undefinedFallback } from '../../utils/undefined-fallback';
|
|
14
|
+
import { FormContext, NoStyleItemContext } from './context';
|
|
15
|
+
import { isSafeSetRefComponent, toArray } from './utils';
|
|
15
16
|
const NAME_SPLIT = '__SPLIT__';
|
|
16
17
|
const classPrefix = `adm-form-item`;
|
|
17
18
|
const MemoInput = React.memo(({
|
|
@@ -19,22 +20,25 @@ const MemoInput = React.memo(({
|
|
|
19
20
|
}) => children, (prev, next) => prev.value === next.value && prev.update === next.update);
|
|
20
21
|
const FormItemLayout = props => {
|
|
21
22
|
var _a;
|
|
23
|
+
const {
|
|
24
|
+
locale,
|
|
25
|
+
form: componentConfig = {}
|
|
26
|
+
} = useConfig();
|
|
22
27
|
const {
|
|
23
28
|
style,
|
|
24
29
|
extra,
|
|
25
30
|
label,
|
|
26
31
|
help,
|
|
32
|
+
helpIcon,
|
|
27
33
|
required,
|
|
28
34
|
children,
|
|
29
35
|
htmlFor,
|
|
30
36
|
hidden,
|
|
31
37
|
arrow,
|
|
38
|
+
arrowIcon,
|
|
32
39
|
childElementPosition = 'normal'
|
|
33
|
-
} = props;
|
|
40
|
+
} = mergeProps(componentConfig, props);
|
|
34
41
|
const context = useContext(FormContext);
|
|
35
|
-
const {
|
|
36
|
-
locale
|
|
37
|
-
} = useConfig();
|
|
38
42
|
const hasFeedback = props.hasFeedback !== undefined ? props.hasFeedback : context.hasFeedback;
|
|
39
43
|
const layout = props.layout || context.layout;
|
|
40
44
|
const disabled = (_a = props.disabled) !== null && _a !== void 0 ? _a : context.disabled;
|
|
@@ -74,7 +78,7 @@ const FormItemLayout = props => {
|
|
|
74
78
|
e.stopPropagation();
|
|
75
79
|
e.preventDefault();
|
|
76
80
|
}
|
|
77
|
-
}, React.createElement(QuestionCircleOutline, null))));
|
|
81
|
+
}, helpIcon || React.createElement(QuestionCircleOutline, null))));
|
|
78
82
|
const description = (!!props.description || hasFeedback) && React.createElement(React.Fragment, null, props.description, hasFeedback && React.createElement(React.Fragment, null, props.errors.map((error, index) => React.createElement("div", {
|
|
79
83
|
key: `error-${index}`,
|
|
80
84
|
className: `${classPrefix}-feedback-error`
|
|
@@ -95,7 +99,7 @@ const FormItemLayout = props => {
|
|
|
95
99
|
disabled: disabled,
|
|
96
100
|
onClick: props.onClick,
|
|
97
101
|
clickable: props.clickable,
|
|
98
|
-
|
|
102
|
+
arrowIcon: arrowIcon || arrow
|
|
99
103
|
}, React.createElement("div", {
|
|
100
104
|
className: classNames(`${classPrefix}-child`, `${classPrefix}-child-position-${childElementPosition}`)
|
|
101
105
|
}, React.createElement("div", {
|
|
@@ -109,6 +113,7 @@ export const FormItem = props => {
|
|
|
109
113
|
// FormItem 相关
|
|
110
114
|
label,
|
|
111
115
|
help,
|
|
116
|
+
helpIcon,
|
|
112
117
|
extra,
|
|
113
118
|
hasFeedback,
|
|
114
119
|
name,
|
|
@@ -129,9 +134,10 @@ export const FormItem = props => {
|
|
|
129
134
|
shouldUpdate,
|
|
130
135
|
dependencies,
|
|
131
136
|
clickable,
|
|
132
|
-
arrow
|
|
137
|
+
arrow,
|
|
138
|
+
arrowIcon
|
|
133
139
|
} = props,
|
|
134
|
-
fieldProps = __rest(props, ["style", "label", "help", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow"]);
|
|
140
|
+
fieldProps = __rest(props, ["style", "label", "help", "helpIcon", "extra", "hasFeedback", "name", "required", "noStyle", "hidden", "layout", "childElementPosition", "description", "disabled", "rules", "children", "messageVariables", "trigger", "validateTrigger", "onClick", "shouldUpdate", "dependencies", "clickable", "arrow", "arrowIcon"]);
|
|
135
141
|
const {
|
|
136
142
|
name: formName
|
|
137
143
|
} = useContext(FormContext);
|
|
@@ -183,6 +189,7 @@ export const FormItem = props => {
|
|
|
183
189
|
label: label,
|
|
184
190
|
extra: extra,
|
|
185
191
|
help: help,
|
|
192
|
+
helpIcon: helpIcon,
|
|
186
193
|
description: description,
|
|
187
194
|
required: isRequired,
|
|
188
195
|
disabled: disabled,
|
|
@@ -195,7 +202,8 @@ export const FormItem = props => {
|
|
|
195
202
|
layout: layout,
|
|
196
203
|
childElementPosition: childElementPosition,
|
|
197
204
|
clickable: clickable,
|
|
198
|
-
arrow: arrow
|
|
205
|
+
arrow: arrow,
|
|
206
|
+
arrowIcon: arrowIcon
|
|
199
207
|
}, React.createElement(NoStyleItemContext.Provider, {
|
|
200
208
|
value: onSubMetaChange
|
|
201
209
|
}, baseChildren)));
|
|
@@ -9,7 +9,7 @@ export declare type FormProps = Pick<RcFormProps, 'form' | 'initialValues' | 'na
|
|
|
9
9
|
footer?: ReactNode;
|
|
10
10
|
mode?: ListProps['mode'];
|
|
11
11
|
};
|
|
12
|
-
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "
|
|
12
|
+
export declare const Form: React.ForwardRefExoticComponent<Pick<RcFormProps<any>, "form" | "children" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
13
13
|
className?: string | undefined;
|
|
14
14
|
style?: (React.CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top" | "--prefix-width", string>>) | undefined;
|
|
15
15
|
tabIndex?: number | undefined;
|
|
@@ -6,7 +6,7 @@ export type { FormItemProps } from './form-item';
|
|
|
6
6
|
export type { FormSubscribeProps } from './form-subscribe';
|
|
7
7
|
export type { ValidateMessages, FieldData, NamePath, Rule, RuleObject, RuleRender, } from 'rc-field-form/es/interface';
|
|
8
8
|
export type { FormArrayField, FormArrayOperation, FormArrayProps, } from './form-array';
|
|
9
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "
|
|
9
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "form" | "children" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
10
10
|
className?: string | undefined;
|
|
11
11
|
style?: (import("react").CSSProperties & Partial<Record<"--border-bottom" | "--border-inner" | "--border-top" | "--prefix-width", string>>) | undefined;
|
|
12
12
|
tabIndex?: number | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
4
|
declare type AriaProps = {
|
|
@@ -9,6 +9,7 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
9
9
|
defaultValue?: string;
|
|
10
10
|
onChange?: (val: string) => void;
|
|
11
11
|
clearable?: boolean;
|
|
12
|
+
clearIcon?: ReactNode;
|
|
12
13
|
onlyShowClearWhenFocus?: boolean;
|
|
13
14
|
onClear?: () => void;
|
|
14
15
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
@@ -26,6 +27,7 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProp
|
|
|
26
27
|
defaultValue?: string | undefined;
|
|
27
28
|
onChange?: ((val: string) => void) | undefined;
|
|
28
29
|
clearable?: boolean | undefined;
|
|
30
|
+
clearIcon?: ReactNode;
|
|
29
31
|
onlyShowClearWhenFocus?: boolean | undefined;
|
|
30
32
|
onClear?: (() => void) | undefined;
|
|
31
33
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import React, { useState, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { usePropsValue } from '../../utils/use-props-value';
|
|
3
1
|
import { CloseCircleFill } from 'antd-mobile-icons';
|
|
4
|
-
import { withNativeProps } from '../../utils/native-props';
|
|
5
|
-
import { mergeProps } from '../../utils/with-default-props';
|
|
6
2
|
import classNames from 'classnames';
|
|
3
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
7
4
|
import { bound } from '../../utils/bound';
|
|
5
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
6
|
+
import { usePropsValue } from '../../utils/use-props-value';
|
|
8
7
|
import { isIOS } from '../../utils/validate';
|
|
8
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
9
9
|
import { useConfig } from '../config-provider';
|
|
10
10
|
import useInputHandleKeyDown from './useInputHandleKeyDown';
|
|
11
11
|
const classPrefix = `adm-input`;
|
|
12
12
|
const defaultProps = {
|
|
13
13
|
defaultValue: '',
|
|
14
|
+
clearIcon: React.createElement(CloseCircleFill, null),
|
|
14
15
|
onlyShowClearWhenFocus: true
|
|
15
16
|
};
|
|
16
|
-
export const Input = forwardRef((
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
export const Input = forwardRef((props, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
locale,
|
|
20
|
+
input: componentConfig = {}
|
|
21
|
+
} = useConfig();
|
|
22
|
+
const mergedProps = mergeProps(defaultProps, componentConfig, props);
|
|
23
|
+
const [value, setValue] = usePropsValue(mergedProps);
|
|
19
24
|
const [hasFocus, setHasFocus] = useState(false);
|
|
20
25
|
const compositionStartRef = useRef(false);
|
|
21
26
|
const nativeInputRef = useRef(null);
|
|
22
|
-
const {
|
|
23
|
-
locale
|
|
24
|
-
} = useConfig();
|
|
25
27
|
const handleKeydown = useInputHandleKeyDown({
|
|
26
|
-
onEnterPress:
|
|
27
|
-
onKeyDown:
|
|
28
|
+
onEnterPress: mergedProps.onEnterPress,
|
|
29
|
+
onKeyDown: mergedProps.onKeyDown,
|
|
28
30
|
nativeInputRef,
|
|
29
|
-
enterKeyHint:
|
|
31
|
+
enterKeyHint: mergedProps.enterKeyHint
|
|
30
32
|
});
|
|
31
33
|
useImperativeHandle(ref, () => ({
|
|
32
34
|
clear: () => {
|
|
@@ -46,8 +48,8 @@ export const Input = forwardRef((p, ref) => {
|
|
|
46
48
|
}));
|
|
47
49
|
function checkValue() {
|
|
48
50
|
let nextValue = value;
|
|
49
|
-
if (
|
|
50
|
-
const boundValue = nextValue && bound(parseFloat(nextValue),
|
|
51
|
+
if (mergedProps.type === 'number') {
|
|
52
|
+
const boundValue = nextValue && bound(parseFloat(nextValue), mergedProps.min, mergedProps.max).toString();
|
|
51
53
|
// fix the display issue of numbers starting with 0
|
|
52
54
|
if (Number(nextValue) !== Number(boundValue)) {
|
|
53
55
|
nextValue = boundValue;
|
|
@@ -58,15 +60,15 @@ export const Input = forwardRef((p, ref) => {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
const shouldShowClear = (() => {
|
|
61
|
-
if (!
|
|
62
|
-
if (
|
|
63
|
+
if (!mergedProps.clearable || !value || mergedProps.readOnly) return false;
|
|
64
|
+
if (mergedProps.onlyShowClearWhenFocus) {
|
|
63
65
|
return hasFocus;
|
|
64
66
|
} else {
|
|
65
67
|
return true;
|
|
66
68
|
}
|
|
67
69
|
})();
|
|
68
|
-
return withNativeProps(
|
|
69
|
-
className: classNames(`${classPrefix}`,
|
|
70
|
+
return withNativeProps(mergedProps, React.createElement("div", {
|
|
71
|
+
className: classNames(`${classPrefix}`, mergedProps.disabled && `${classPrefix}-disabled`)
|
|
70
72
|
}, React.createElement("input", {
|
|
71
73
|
ref: nativeInputRef,
|
|
72
74
|
className: `${classPrefix}-element`,
|
|
@@ -77,50 +79,50 @@ export const Input = forwardRef((p, ref) => {
|
|
|
77
79
|
onFocus: e => {
|
|
78
80
|
var _a;
|
|
79
81
|
setHasFocus(true);
|
|
80
|
-
(_a =
|
|
82
|
+
(_a = mergedProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
81
83
|
},
|
|
82
84
|
onBlur: e => {
|
|
83
85
|
var _a;
|
|
84
86
|
setHasFocus(false);
|
|
85
87
|
checkValue();
|
|
86
|
-
(_a =
|
|
88
|
+
(_a = mergedProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
87
89
|
},
|
|
88
|
-
id:
|
|
89
|
-
placeholder:
|
|
90
|
-
disabled:
|
|
91
|
-
readOnly:
|
|
92
|
-
maxLength:
|
|
93
|
-
minLength:
|
|
94
|
-
max:
|
|
95
|
-
min:
|
|
96
|
-
autoComplete:
|
|
97
|
-
enterKeyHint:
|
|
98
|
-
autoFocus:
|
|
99
|
-
pattern:
|
|
100
|
-
inputMode:
|
|
101
|
-
type:
|
|
102
|
-
name:
|
|
103
|
-
autoCapitalize:
|
|
104
|
-
autoCorrect:
|
|
90
|
+
id: mergedProps.id,
|
|
91
|
+
placeholder: mergedProps.placeholder,
|
|
92
|
+
disabled: mergedProps.disabled,
|
|
93
|
+
readOnly: mergedProps.readOnly,
|
|
94
|
+
maxLength: mergedProps.maxLength,
|
|
95
|
+
minLength: mergedProps.minLength,
|
|
96
|
+
max: mergedProps.max,
|
|
97
|
+
min: mergedProps.min,
|
|
98
|
+
autoComplete: mergedProps.autoComplete,
|
|
99
|
+
enterKeyHint: mergedProps.enterKeyHint,
|
|
100
|
+
autoFocus: mergedProps.autoFocus,
|
|
101
|
+
pattern: mergedProps.pattern,
|
|
102
|
+
inputMode: mergedProps.inputMode,
|
|
103
|
+
type: mergedProps.type,
|
|
104
|
+
name: mergedProps.name,
|
|
105
|
+
autoCapitalize: mergedProps.autoCapitalize,
|
|
106
|
+
autoCorrect: mergedProps.autoCorrect,
|
|
105
107
|
onKeyDown: handleKeydown,
|
|
106
|
-
onKeyUp:
|
|
108
|
+
onKeyUp: mergedProps.onKeyUp,
|
|
107
109
|
onCompositionStart: e => {
|
|
108
110
|
var _a;
|
|
109
111
|
compositionStartRef.current = true;
|
|
110
|
-
(_a =
|
|
112
|
+
(_a = mergedProps.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
111
113
|
},
|
|
112
114
|
onCompositionEnd: e => {
|
|
113
115
|
var _a;
|
|
114
116
|
compositionStartRef.current = false;
|
|
115
|
-
(_a =
|
|
117
|
+
(_a = mergedProps.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
116
118
|
},
|
|
117
|
-
onClick:
|
|
118
|
-
step:
|
|
119
|
-
role:
|
|
120
|
-
"aria-valuenow":
|
|
121
|
-
"aria-valuemax":
|
|
122
|
-
"aria-valuemin":
|
|
123
|
-
"aria-label":
|
|
119
|
+
onClick: mergedProps.onClick,
|
|
120
|
+
step: mergedProps.step,
|
|
121
|
+
role: mergedProps.role,
|
|
122
|
+
"aria-valuenow": mergedProps['aria-valuenow'],
|
|
123
|
+
"aria-valuemax": mergedProps['aria-valuemax'],
|
|
124
|
+
"aria-valuemin": mergedProps['aria-valuemin'],
|
|
125
|
+
"aria-label": mergedProps['aria-label']
|
|
124
126
|
}), shouldShowClear && React.createElement("div", {
|
|
125
127
|
className: `${classPrefix}-clear`,
|
|
126
128
|
onMouseDown: e => {
|
|
@@ -129,7 +131,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
129
131
|
onClick: () => {
|
|
130
132
|
var _a, _b;
|
|
131
133
|
setValue('');
|
|
132
|
-
(_a =
|
|
134
|
+
(_a = mergedProps.onClear) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
133
135
|
// https://github.com/ant-design/ant-design-mobile/issues/5212
|
|
134
136
|
if (isIOS() && compositionStartRef.current) {
|
|
135
137
|
compositionStartRef.current = false;
|
|
@@ -137,5 +139,5 @@ export const Input = forwardRef((p, ref) => {
|
|
|
137
139
|
}
|
|
138
140
|
},
|
|
139
141
|
"aria-label": locale.Input.clear
|
|
140
|
-
},
|
|
142
|
+
}, mergedProps.clearIcon)));
|
|
141
143
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type ListItemProps = {
|
|
5
5
|
title?: ReactNode;
|
|
@@ -8,8 +8,12 @@ export declare type ListItemProps = {
|
|
|
8
8
|
prefix?: ReactNode;
|
|
9
9
|
extra?: ReactNode;
|
|
10
10
|
clickable?: boolean;
|
|
11
|
-
|
|
11
|
+
arrowIcon?: boolean | ReactNode;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated use `arrowIcon` instead
|
|
16
|
+
*/
|
|
17
|
+
arrow?: boolean | ReactNode;
|
|
14
18
|
} & NativeProps<'--prefix-width' | '--align-items' | '--active-background-color'>;
|
|
15
19
|
export declare const ListItem: FC<ListItemProps>;
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { withNativeProps } from '../../utils/native-props';
|
|
3
1
|
import { RightOutline } from 'antd-mobile-icons';
|
|
4
2
|
import classNames from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { isNodeWithContent } from '../../utils/is-node-with-content';
|
|
5
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
6
|
+
import { mergeProp } from '../../utils/with-default-props';
|
|
7
|
+
import { useConfig } from '../config-provider';
|
|
6
8
|
const classPrefix = `adm-list-item`;
|
|
7
9
|
export const ListItem = props => {
|
|
8
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const {
|
|
12
|
+
arrow,
|
|
13
|
+
arrowIcon
|
|
14
|
+
} = props;
|
|
15
|
+
const {
|
|
16
|
+
list: componentConfig = {}
|
|
17
|
+
} = useConfig();
|
|
9
18
|
const clickable = (_a = props.clickable) !== null && _a !== void 0 ? _a : !!props.onClick;
|
|
10
|
-
const
|
|
19
|
+
const showArrow = (_b = arrow !== null && arrow !== void 0 ? arrow : arrowIcon) !== null && _b !== void 0 ? _b : clickable;
|
|
20
|
+
const mergedArrowIcon = mergeProp(componentConfig.arrowIcon, arrow !== true ? arrow : null, arrowIcon !== true ? arrowIcon : null);
|
|
11
21
|
const content = React.createElement("div", {
|
|
12
22
|
className: `${classPrefix}-content`
|
|
13
23
|
}, isNodeWithContent(props.prefix) && React.createElement("div", {
|
|
@@ -20,9 +30,9 @@ export const ListItem = props => {
|
|
|
20
30
|
className: `${classPrefix}-description`
|
|
21
31
|
}, props.description)), isNodeWithContent(props.extra) && React.createElement("div", {
|
|
22
32
|
className: `${classPrefix}-content-extra`
|
|
23
|
-
}, props.extra),
|
|
33
|
+
}, props.extra), showArrow && React.createElement("div", {
|
|
24
34
|
className: `${classPrefix}-content-arrow`
|
|
25
|
-
},
|
|
35
|
+
}, mergedArrowIcon || React.createElement(RightOutline, null)));
|
|
26
36
|
return withNativeProps(props, React.createElement(clickable ? 'a' : 'div', {
|
|
27
37
|
className: classNames(`${classPrefix}`, clickable ? ['adm-plain-anchor'] : [], props.disabled && `${classPrefix}-disabled`),
|
|
28
38
|
onClick: props.disabled ? undefined : props.onClick
|
|
@@ -2,6 +2,10 @@ import type { FC, ReactNode } from 'react';
|
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type NavBarProps = {
|
|
4
4
|
back?: ReactNode;
|
|
5
|
+
backIcon?: boolean | ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use `backIcon` instead
|
|
8
|
+
*/
|
|
5
9
|
backArrow?: boolean | ReactNode;
|
|
6
10
|
left?: ReactNode;
|
|
7
11
|
right?: ReactNode;
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
1
|
import { LeftOutline } from 'antd-mobile-icons';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { mergeProps } from '../../utils/with-default-props';
|
|
6
|
+
import { useConfig } from '../config-provider';
|
|
6
7
|
const classPrefix = `adm-nav-bar`;
|
|
7
8
|
const defaultProps = {
|
|
8
|
-
|
|
9
|
+
backIcon: true
|
|
9
10
|
};
|
|
10
|
-
export const NavBar =
|
|
11
|
-
const
|
|
11
|
+
export const NavBar = props => {
|
|
12
|
+
const {
|
|
13
|
+
navBar: componentConfig = {}
|
|
14
|
+
} = useConfig();
|
|
15
|
+
const mergedProps = mergeProps(defaultProps, componentConfig, props);
|
|
12
16
|
const {
|
|
13
17
|
back,
|
|
18
|
+
backIcon,
|
|
14
19
|
backArrow
|
|
15
|
-
} =
|
|
16
|
-
return withNativeProps(
|
|
20
|
+
} = mergedProps;
|
|
21
|
+
return withNativeProps(mergedProps, React.createElement("div", {
|
|
17
22
|
className: classNames(classPrefix)
|
|
18
23
|
}, React.createElement("div", {
|
|
19
24
|
className: `${classPrefix}-left`,
|
|
20
25
|
role: 'button'
|
|
21
26
|
}, back !== null && React.createElement("div", {
|
|
22
27
|
className: `${classPrefix}-back`,
|
|
23
|
-
onClick:
|
|
24
|
-
}, backArrow && React.createElement("span", {
|
|
28
|
+
onClick: mergedProps.onBack
|
|
29
|
+
}, (backIcon || backArrow) && React.createElement("span", {
|
|
25
30
|
className: `${classPrefix}-back-arrow`
|
|
26
|
-
}, backArrow === true ? React.createElement(LeftOutline, null) : backArrow), React.createElement("span", {
|
|
31
|
+
}, backIcon === true || backArrow === true ? componentConfig.backIcon || React.createElement(LeftOutline, null) : backIcon || backArrow), React.createElement("span", {
|
|
27
32
|
"aria-hidden": 'true'
|
|
28
|
-
}, back)),
|
|
33
|
+
}, back)), mergedProps.left), React.createElement("div", {
|
|
29
34
|
className: `${classPrefix}-title`
|
|
30
|
-
},
|
|
35
|
+
}, mergedProps.children), React.createElement("div", {
|
|
31
36
|
className: `${classPrefix}-right`
|
|
32
|
-
},
|
|
37
|
+
}, mergedProps.right)));
|
|
33
38
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type NoticeBarProps = {
|
|
5
5
|
/** The type of the NoticeBar */
|
|
@@ -12,6 +12,8 @@ export declare type NoticeBarProps = {
|
|
|
12
12
|
content: ReactNode;
|
|
13
13
|
/** Whether it can be closed */
|
|
14
14
|
closeable?: boolean;
|
|
15
|
+
/** Custom close icon */
|
|
16
|
+
closeIcon?: ReactNode;
|
|
15
17
|
/** Callback when closed */
|
|
16
18
|
onClose?: () => void;
|
|
17
19
|
/** Event when click */
|
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
import React, { useState, useRef, memo } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { CloseOutline, SoundOutline } from 'antd-mobile-icons';
|
|
4
1
|
import { useTimeout } from 'ahooks';
|
|
5
|
-
import {
|
|
2
|
+
import { CloseOutline, SoundOutline } from 'antd-mobile-icons';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import React, { memo, useRef, useState } from 'react';
|
|
6
5
|
import { withNativeProps } from '../../utils/native-props';
|
|
7
|
-
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
8
6
|
import { useMutationEffect } from '../../utils/use-mutation-effect';
|
|
7
|
+
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
8
|
+
import { mergeProp, mergeProps } from '../../utils/with-default-props';
|
|
9
|
+
import { useConfig } from '../config-provider';
|
|
9
10
|
const classPrefix = `adm-notice-bar`;
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
color: 'default',
|
|
12
13
|
delay: 2000,
|
|
13
14
|
speed: 50,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
icon: React.createElement(SoundOutline, null),
|
|
16
|
+
wrap: false
|
|
16
17
|
};
|
|
17
|
-
export const NoticeBar = memo(
|
|
18
|
-
const
|
|
18
|
+
export const NoticeBar = memo(props => {
|
|
19
|
+
const {
|
|
20
|
+
noticeBar: componentConfig = {}
|
|
21
|
+
} = useConfig();
|
|
22
|
+
const mergedProps = mergeProps(defaultProps, componentConfig, props);
|
|
23
|
+
const closeIcon = mergeProp(React.createElement(CloseOutline, {
|
|
24
|
+
className: `${classPrefix}-close-icon`
|
|
25
|
+
}), componentConfig.closeIcon, props.closeIcon);
|
|
19
26
|
const containerRef = useRef(null);
|
|
20
27
|
const textRef = useRef(null);
|
|
21
28
|
const [visible, setVisible] = useState(true);
|
|
22
|
-
const speed =
|
|
29
|
+
const speed = mergedProps.speed;
|
|
23
30
|
const delayLockRef = useRef(true);
|
|
24
31
|
const animatingRef = useRef(false);
|
|
25
32
|
function start() {
|
|
26
|
-
if (delayLockRef.current ||
|
|
33
|
+
if (delayLockRef.current || mergedProps.wrap) return;
|
|
27
34
|
const container = containerRef.current;
|
|
28
35
|
const text = textRef.current;
|
|
29
36
|
if (!container || !text) return;
|
|
@@ -49,7 +56,7 @@ export const NoticeBar = memo(p => {
|
|
|
49
56
|
useTimeout(() => {
|
|
50
57
|
delayLockRef.current = false;
|
|
51
58
|
start();
|
|
52
|
-
},
|
|
59
|
+
}, mergedProps.delay);
|
|
53
60
|
useResizeEffect(() => {
|
|
54
61
|
start();
|
|
55
62
|
}, containerRef);
|
|
@@ -61,14 +68,14 @@ export const NoticeBar = memo(p => {
|
|
|
61
68
|
characterData: true
|
|
62
69
|
});
|
|
63
70
|
if (!visible) return null;
|
|
64
|
-
return withNativeProps(
|
|
65
|
-
className: classNames(classPrefix, `${classPrefix}-${
|
|
66
|
-
[`${classPrefix}-wrap`]:
|
|
71
|
+
return withNativeProps(mergedProps, React.createElement("div", {
|
|
72
|
+
className: classNames(classPrefix, `${classPrefix}-${mergedProps.color}`, {
|
|
73
|
+
[`${classPrefix}-wrap`]: mergedProps.wrap
|
|
67
74
|
}),
|
|
68
|
-
onClick:
|
|
69
|
-
},
|
|
75
|
+
onClick: mergedProps.onClick
|
|
76
|
+
}, mergedProps.icon && React.createElement("span", {
|
|
70
77
|
className: `${classPrefix}-left`
|
|
71
|
-
},
|
|
78
|
+
}, mergedProps.icon), React.createElement("span", {
|
|
72
79
|
ref: containerRef,
|
|
73
80
|
className: `${classPrefix}-content`
|
|
74
81
|
}, React.createElement("span", {
|
|
@@ -78,16 +85,14 @@ export const NoticeBar = memo(p => {
|
|
|
78
85
|
},
|
|
79
86
|
ref: textRef,
|
|
80
87
|
className: `${classPrefix}-content-inner`
|
|
81
|
-
},
|
|
88
|
+
}, mergedProps.content)), (mergedProps.closeable || mergedProps.extra) && React.createElement("span", {
|
|
82
89
|
className: `${classPrefix}-right`
|
|
83
|
-
},
|
|
90
|
+
}, mergedProps.extra, mergedProps.closeable && React.createElement("div", {
|
|
84
91
|
className: `${classPrefix}-close`,
|
|
85
92
|
onClick: () => {
|
|
86
93
|
var _a;
|
|
87
94
|
setVisible(false);
|
|
88
|
-
(_a =
|
|
95
|
+
(_a = mergedProps.onClose) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
89
96
|
}
|
|
90
|
-
},
|
|
91
|
-
className: `${classPrefix}-close-icon`
|
|
92
|
-
})))));
|
|
97
|
+
}, closeIcon))));
|
|
93
98
|
});
|