antd-mobile 5.11.2 → 5.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/cjs/components/calendar/calendar.d.ts +4 -0
- package/2x/cjs/components/calendar/calendar.js +13 -9
- package/2x/cjs/components/capsule-tabs/capsule-tabs.css +1 -0
- package/2x/cjs/components/cascade-picker/cascade-picker.d.ts +6 -3
- package/2x/cjs/components/cascade-picker/cascade-picker.js +8 -4
- package/2x/cjs/components/cascade-picker/index.d.ts +4 -2
- package/2x/cjs/components/date-picker/date-picker.d.ts +18 -4
- package/2x/cjs/components/date-picker/date-picker.js +5 -6
- package/2x/cjs/components/date-picker/index.d.ts +15 -2
- package/2x/cjs/components/dialog/dialog.d.ts +2 -1
- package/2x/cjs/components/dialog/dialog.js +2 -2
- package/2x/cjs/components/dropdown/dropdown.css +1 -1
- package/2x/cjs/components/error-block/images/busy.d.ts +1 -0
- package/2x/cjs/components/error-block/images/default.d.ts +1 -0
- package/2x/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/cjs/components/error-block/images/empty.d.ts +1 -0
- package/2x/cjs/components/form/form-item.d.ts +2 -1
- package/2x/cjs/components/form/form-item.js +21 -4
- package/2x/cjs/components/form/utils.d.ts +1 -0
- package/2x/cjs/components/form/utils.js +20 -0
- package/2x/cjs/components/image/image.d.ts +1 -1
- package/2x/cjs/components/image-uploader/image-uploader.js +1 -2
- package/2x/cjs/components/input/input.d.ts +2 -2
- package/2x/cjs/components/input/input.js +1 -0
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.css +1 -0
- package/2x/cjs/components/list/list.css +1 -0
- package/2x/cjs/components/mask/mask.js +1 -1
- package/2x/cjs/components/modal/modal.d.ts +2 -1
- package/2x/cjs/components/modal/modal.js +2 -2
- package/2x/cjs/components/picker/index.d.ts +44 -3
- package/2x/cjs/components/picker/picker.d.ts +32 -2
- package/2x/cjs/components/picker/picker.js +43 -16
- package/2x/cjs/components/popup/popup.d.ts +2 -1
- package/2x/cjs/components/popup/popup.js +1 -1
- package/2x/cjs/components/search-bar/search-bar.js +2 -8
- package/2x/cjs/components/swipe-action/swipe-action.js +1 -1
- package/2x/cjs/components/tabs/tabs.css +5 -3
- package/2x/cjs/components/tabs/tabs.d.ts +1 -1
- package/2x/cjs/components/text-area/text-area.d.ts +2 -2
- package/2x/cjs/components/text-area/text-area.js +4 -1
- package/2x/cjs/components/toast/methods.js +3 -7
- package/2x/cjs/components/toast/toast.d.ts +2 -1
- package/2x/cjs/utils/render-to-body.js +3 -6
- package/2x/cjs/utils/render.d.ts +9 -0
- package/2x/cjs/utils/render.js +92 -0
- package/2x/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/cjs/utils/use-props-value.d.ts +1 -1
- package/2x/es/components/calendar/calendar.d.ts +4 -0
- package/2x/es/components/calendar/calendar.js +13 -9
- package/2x/es/components/capsule-tabs/capsule-tabs.css +1 -0
- package/2x/es/components/cascade-picker/cascade-picker.d.ts +6 -3
- package/2x/es/components/cascade-picker/cascade-picker.js +4 -3
- package/2x/es/components/cascade-picker/index.d.ts +4 -2
- package/2x/es/components/date-picker/date-picker.d.ts +18 -4
- package/2x/es/components/date-picker/date-picker.js +6 -5
- package/2x/es/components/date-picker/index.d.ts +15 -2
- package/2x/es/components/dialog/dialog.d.ts +2 -1
- package/2x/es/components/dialog/dialog.js +2 -2
- package/2x/es/components/dropdown/dropdown.css +1 -1
- package/2x/es/components/error-block/images/busy.d.ts +1 -0
- package/2x/es/components/error-block/images/default.d.ts +1 -0
- package/2x/es/components/error-block/images/disconnected.d.ts +1 -0
- package/2x/es/components/error-block/images/empty.d.ts +1 -0
- package/2x/es/components/form/form-item.d.ts +2 -1
- package/2x/es/components/form/form-item.js +23 -4
- package/2x/es/components/form/utils.d.ts +1 -0
- package/2x/es/components/form/utils.js +17 -0
- package/2x/es/components/image/image.d.ts +1 -1
- package/2x/es/components/image-uploader/image-uploader.js +1 -2
- package/2x/es/components/input/input.d.ts +2 -2
- package/2x/es/components/input/input.js +1 -0
- package/2x/es/components/jumbo-tabs/jumbo-tabs.css +1 -0
- package/2x/es/components/list/list.css +1 -0
- package/2x/es/components/mask/mask.js +1 -1
- package/2x/es/components/modal/modal.d.ts +2 -1
- package/2x/es/components/modal/modal.js +2 -2
- package/2x/es/components/picker/index.d.ts +44 -3
- package/2x/es/components/picker/picker.d.ts +32 -2
- package/2x/es/components/picker/picker.js +42 -17
- package/2x/es/components/popup/popup.d.ts +2 -1
- package/2x/es/components/popup/popup.js +1 -1
- package/2x/es/components/search-bar/search-bar.js +2 -8
- package/2x/es/components/swipe-action/swipe-action.js +1 -1
- package/2x/es/components/tabs/tabs.css +5 -3
- package/2x/es/components/tabs/tabs.d.ts +1 -1
- package/2x/es/components/text-area/text-area.d.ts +2 -2
- package/2x/es/components/text-area/text-area.js +4 -2
- package/2x/es/components/toast/methods.js +3 -3
- package/2x/es/components/toast/toast.d.ts +2 -1
- package/2x/es/utils/render-to-body.js +3 -3
- package/2x/es/utils/render.d.ts +9 -0
- package/2x/es/utils/render.js +77 -0
- package/2x/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/2x/es/utils/use-props-value.d.ts +1 -1
- package/2x/package.json +9 -14
- package/bundle/antd-mobile.cjs.js +5053 -4310
- package/bundle/antd-mobile.es.js +5055 -4312
- package/bundle/style.css +9 -4
- package/cjs/components/calendar/calendar.d.ts +4 -0
- package/cjs/components/calendar/calendar.js +13 -9
- package/cjs/components/capsule-tabs/capsule-tabs.css +1 -0
- package/cjs/components/cascade-picker/cascade-picker.d.ts +6 -3
- package/cjs/components/cascade-picker/cascade-picker.js +8 -4
- package/cjs/components/cascade-picker/index.d.ts +4 -2
- package/cjs/components/date-picker/date-picker.d.ts +18 -4
- package/cjs/components/date-picker/date-picker.js +5 -6
- package/cjs/components/date-picker/index.d.ts +15 -2
- package/cjs/components/dialog/dialog.d.ts +2 -1
- package/cjs/components/dialog/dialog.js +2 -2
- package/cjs/components/dropdown/dropdown.css +1 -1
- package/cjs/components/error-block/images/busy.d.ts +1 -0
- package/cjs/components/error-block/images/default.d.ts +1 -0
- package/cjs/components/error-block/images/disconnected.d.ts +1 -0
- package/cjs/components/error-block/images/empty.d.ts +1 -0
- package/cjs/components/form/form-item.d.ts +2 -1
- package/cjs/components/form/form-item.js +21 -4
- package/cjs/components/form/utils.d.ts +1 -0
- package/cjs/components/form/utils.js +20 -0
- package/cjs/components/image/image.d.ts +1 -1
- package/cjs/components/image-uploader/image-uploader.js +1 -2
- package/cjs/components/input/input.d.ts +2 -2
- package/cjs/components/input/input.js +1 -0
- package/cjs/components/jumbo-tabs/jumbo-tabs.css +1 -0
- package/cjs/components/list/list.css +1 -0
- package/cjs/components/mask/mask.js +1 -1
- package/cjs/components/modal/modal.d.ts +2 -1
- package/cjs/components/modal/modal.js +2 -2
- package/cjs/components/picker/index.d.ts +44 -3
- package/cjs/components/picker/picker.d.ts +32 -2
- package/cjs/components/picker/picker.js +43 -16
- package/cjs/components/popup/popup.d.ts +2 -1
- package/cjs/components/popup/popup.js +1 -1
- package/cjs/components/search-bar/search-bar.js +2 -8
- package/cjs/components/swipe-action/swipe-action.js +1 -1
- package/cjs/components/tabs/tabs.css +5 -3
- package/cjs/components/tabs/tabs.d.ts +1 -1
- package/cjs/components/text-area/text-area.d.ts +2 -2
- package/cjs/components/text-area/text-area.js +4 -1
- package/cjs/components/toast/methods.js +3 -7
- package/cjs/components/toast/toast.d.ts +2 -1
- package/cjs/utils/render-to-body.js +3 -6
- package/cjs/utils/render.d.ts +9 -0
- package/cjs/utils/render.js +92 -0
- package/cjs/utils/use-drag-and-pinch.d.ts +1 -1
- package/cjs/utils/use-props-value.d.ts +1 -1
- package/es/components/calendar/calendar.d.ts +4 -0
- package/es/components/calendar/calendar.js +13 -9
- package/es/components/capsule-tabs/capsule-tabs.css +1 -0
- package/es/components/cascade-picker/cascade-picker.d.ts +6 -3
- package/es/components/cascade-picker/cascade-picker.js +4 -3
- package/es/components/cascade-picker/index.d.ts +4 -2
- package/es/components/date-picker/date-picker.d.ts +18 -4
- package/es/components/date-picker/date-picker.js +6 -5
- package/es/components/date-picker/index.d.ts +15 -2
- package/es/components/dialog/dialog.d.ts +2 -1
- package/es/components/dialog/dialog.js +2 -2
- package/es/components/dropdown/dropdown.css +1 -1
- package/es/components/error-block/images/busy.d.ts +1 -0
- package/es/components/error-block/images/default.d.ts +1 -0
- package/es/components/error-block/images/disconnected.d.ts +1 -0
- package/es/components/error-block/images/empty.d.ts +1 -0
- package/es/components/form/form-item.d.ts +2 -1
- package/es/components/form/form-item.js +23 -4
- package/es/components/form/utils.d.ts +1 -0
- package/es/components/form/utils.js +17 -0
- package/es/components/image/image.d.ts +1 -1
- package/es/components/image-uploader/image-uploader.js +1 -2
- package/es/components/input/input.d.ts +2 -2
- package/es/components/input/input.js +1 -0
- package/es/components/jumbo-tabs/jumbo-tabs.css +1 -0
- package/es/components/list/list.css +1 -0
- package/es/components/mask/mask.js +1 -1
- package/es/components/modal/modal.d.ts +2 -1
- package/es/components/modal/modal.js +2 -2
- package/es/components/picker/index.d.ts +44 -3
- package/es/components/picker/picker.d.ts +32 -2
- package/es/components/picker/picker.js +42 -17
- package/es/components/popup/popup.d.ts +2 -1
- package/es/components/popup/popup.js +1 -1
- package/es/components/search-bar/search-bar.js +2 -8
- package/es/components/swipe-action/swipe-action.js +1 -1
- package/es/components/tabs/tabs.css +5 -3
- package/es/components/tabs/tabs.d.ts +1 -1
- package/es/components/text-area/text-area.d.ts +2 -2
- package/es/components/text-area/text-area.js +4 -2
- package/es/components/toast/methods.js +3 -3
- package/es/components/toast/toast.d.ts +2 -1
- package/es/utils/render-to-body.js +3 -3
- package/es/utils/render.d.ts +9 -0
- package/es/utils/render.js +77 -0
- package/es/utils/use-drag-and-pinch.d.ts +1 -1
- package/es/utils/use-props-value.d.ts +1 -1
- package/package.json +9 -14
- package/umd/antd-mobile.js +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PickerProps } from '../picker';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { PickerProps, PickerRef, PickerActions } from '../picker';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import type { Precision, DatePickerFilter } from './date-picker-utils';
|
|
5
|
+
export declare type DatePickerRef = PickerRef;
|
|
5
6
|
export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' | 'closeOnMaskClick' | 'visible' | 'confirmText' | 'cancelText' | 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'title' | 'stopPropagation' | 'style' | 'mouseWheel'> & {
|
|
6
7
|
value?: Date | null;
|
|
7
8
|
defaultValue?: Date | null;
|
|
@@ -10,8 +11,21 @@ export declare type DatePickerProps = Pick<PickerProps, 'onCancel' | 'onClose' |
|
|
|
10
11
|
min?: Date;
|
|
11
12
|
max?: Date;
|
|
12
13
|
precision?: Precision;
|
|
13
|
-
children?: (value: Date | null) => ReactNode;
|
|
14
|
+
children?: (value: Date | null, actions: PickerActions) => ReactNode;
|
|
14
15
|
renderLabel?: (type: Precision, data: number) => ReactNode;
|
|
15
16
|
filter?: DatePickerFilter;
|
|
16
17
|
} & NativeProps;
|
|
17
|
-
export declare const DatePicker:
|
|
18
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<Pick<PickerProps, "style" | "title" | "onClick" | "visible" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation" | "onCancel" | "onClose" | "cancelText" | "closeOnMaskClick" | "mouseWheel" | "confirmText"> & {
|
|
19
|
+
value?: Date | null | undefined;
|
|
20
|
+
defaultValue?: Date | null | undefined;
|
|
21
|
+
onSelect?: ((value: Date) => void) | undefined;
|
|
22
|
+
onConfirm?: ((value: Date) => void) | undefined;
|
|
23
|
+
min?: Date | undefined;
|
|
24
|
+
max?: Date | undefined;
|
|
25
|
+
precision?: Precision | undefined;
|
|
26
|
+
children?: ((value: Date | null, actions: PickerActions) => ReactNode) | undefined;
|
|
27
|
+
renderLabel?: ((type: Precision, data: number) => ReactNode) | undefined;
|
|
28
|
+
filter?: Partial<Record<Precision, (val: number, extend: {
|
|
29
|
+
date: Date;
|
|
30
|
+
}) => boolean>> | undefined;
|
|
31
|
+
} & NativeProps<never> & React.RefAttributes<PickerActions>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from 'react';
|
|
1
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useMemoizedFn } from 'ahooks';
|
|
3
3
|
import Picker from '../picker';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
@@ -14,7 +14,7 @@ const defaultProps = {
|
|
|
14
14
|
renderLabel: defaultRenderLabel,
|
|
15
15
|
defaultValue: null
|
|
16
16
|
};
|
|
17
|
-
export const DatePicker = p => {
|
|
17
|
+
export const DatePicker = forwardRef((p, ref) => {
|
|
18
18
|
const props = mergeProps(defaultProps, p);
|
|
19
19
|
const [value, setValue] = usePropsValue({
|
|
20
20
|
value: props.value,
|
|
@@ -43,6 +43,7 @@ export const DatePicker = p => {
|
|
|
43
43
|
});
|
|
44
44
|
const columns = useCallback(selected => generateDatePickerColumns(selected, props.min, props.max, props.precision, props.renderLabel, props.filter), [props.min, props.max, props.precision, props.renderLabel]);
|
|
45
45
|
return withNativeProps(props, React.createElement(Picker, {
|
|
46
|
+
ref: ref,
|
|
46
47
|
columns: columns,
|
|
47
48
|
value: pickerValue,
|
|
48
49
|
onCancel: props.onCancel,
|
|
@@ -60,9 +61,9 @@ export const DatePicker = p => {
|
|
|
60
61
|
title: props.title,
|
|
61
62
|
stopPropagation: props.stopPropagation,
|
|
62
63
|
mouseWheel: props.mouseWheel
|
|
63
|
-
}, () => {
|
|
64
|
+
}, (_, actions) => {
|
|
64
65
|
var _a;
|
|
65
66
|
|
|
66
|
-
return (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
67
|
+
return (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, value, actions);
|
|
67
68
|
}));
|
|
68
|
-
};
|
|
69
|
+
});
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './date-picker.less';
|
|
3
3
|
import { prompt } from './prompt';
|
|
4
|
-
export type { DatePickerProps } from './date-picker';
|
|
4
|
+
export type { DatePickerProps, DatePickerRef } from './date-picker';
|
|
5
5
|
export type { DatePickerFilter } from './date-picker-utils';
|
|
6
|
-
declare const _default: import("react").
|
|
6
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("../picker").PickerProps, "style" | "title" | "onClick" | "visible" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation" | "onCancel" | "onClose" | "cancelText" | "closeOnMaskClick" | "mouseWheel" | "confirmText"> & {
|
|
7
|
+
value?: Date | null | undefined;
|
|
8
|
+
defaultValue?: Date | null | undefined;
|
|
9
|
+
onSelect?: ((value: Date) => void) | undefined;
|
|
10
|
+
onConfirm?: ((value: Date) => void) | undefined;
|
|
11
|
+
min?: Date | undefined;
|
|
12
|
+
max?: Date | undefined;
|
|
13
|
+
precision?: import("./date-picker-utils").Precision | undefined;
|
|
14
|
+
children?: ((value: Date | null, actions: import("../picker").PickerActions) => import("react").ReactNode) | undefined;
|
|
15
|
+
renderLabel?: ((type: import("./date-picker-utils").Precision, data: number) => import("react").ReactNode) | undefined;
|
|
16
|
+
filter?: Partial<Record<import("./date-picker-utils").Precision, (val: number, extend: {
|
|
17
|
+
date: Date;
|
|
18
|
+
}) => boolean>> | undefined;
|
|
19
|
+
} & import("../../utils/native-props").NativeProps<never> & import("react").RefAttributes<import("../picker").PickerActions>> & {
|
|
7
20
|
prompt: typeof prompt;
|
|
8
21
|
};
|
|
9
22
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import type { MaskProps } from '../mask';
|
|
2
3
|
import { Action } from './dialog-action-button';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
@@ -19,7 +20,7 @@ export declare type DialogProps = {
|
|
|
19
20
|
getContainer?: GetContainer;
|
|
20
21
|
bodyStyle?: React.CSSProperties;
|
|
21
22
|
bodyClassName?: string;
|
|
22
|
-
maskStyle?:
|
|
23
|
+
maskStyle?: MaskProps['style'];
|
|
23
24
|
maskClassName?: string;
|
|
24
25
|
stopPropagation?: PropagationEvent[];
|
|
25
26
|
disableBodyScroll?: boolean;
|
|
@@ -88,7 +88,7 @@ export const Dialog = p => {
|
|
|
88
88
|
const node = withNativeProps(props, React.createElement("div", {
|
|
89
89
|
className: cls(),
|
|
90
90
|
style: {
|
|
91
|
-
display: active ?
|
|
91
|
+
display: active ? undefined : 'none'
|
|
92
92
|
}
|
|
93
93
|
}, React.createElement(Mask, {
|
|
94
94
|
visible: props.visible,
|
|
@@ -99,7 +99,7 @@ export const Dialog = p => {
|
|
|
99
99
|
}), React.createElement("div", {
|
|
100
100
|
className: cls('wrap'),
|
|
101
101
|
style: {
|
|
102
|
-
pointerEvents: props.visible ?
|
|
102
|
+
pointerEvents: props.visible ? undefined : 'none'
|
|
103
103
|
}
|
|
104
104
|
}, React.createElement(animated.div, {
|
|
105
105
|
style: style
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
.adm-dropdown-item .adm-dropdown-item-title-arrow {
|
|
33
33
|
color: var(--adm-color-light);
|
|
34
34
|
font-size: 9px;
|
|
35
|
-
transform: rotate(0deg) translateY(
|
|
35
|
+
transform: rotate(0deg) translateY(1px);
|
|
36
36
|
transition: all ease 0.2s;
|
|
37
37
|
}
|
|
38
38
|
.adm-dropdown-item .adm-dropdown-item-title-arrow-active {
|
|
@@ -7,7 +7,7 @@ import type { FormLayout } from './index';
|
|
|
7
7
|
declare type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
|
|
8
8
|
declare type ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;
|
|
9
9
|
declare type RcFieldProps = Omit<FieldProps, 'children'>;
|
|
10
|
-
export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | '
|
|
10
|
+
export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePropName' | 'name' | 'rules' | 'messageVariables' | 'trigger' | 'validateTrigger' | 'shouldUpdate' | 'initialValue'> & Pick<ListItemProps, 'style' | 'extra' | 'clickable' | 'arrow' | 'description'> & {
|
|
11
11
|
label?: React.ReactNode;
|
|
12
12
|
help?: React.ReactNode;
|
|
13
13
|
hasFeedback?: boolean;
|
|
@@ -18,6 +18,7 @@ export declare type FormItemProps = Pick<RcFieldProps, 'dependencies' | 'valuePr
|
|
|
18
18
|
layout?: FormLayout;
|
|
19
19
|
childElementPosition?: 'normal' | 'right';
|
|
20
20
|
children?: ChildrenType;
|
|
21
|
+
onClick?: (e: React.MouseEvent, widgetRef: React.MutableRefObject<any>) => void;
|
|
21
22
|
} & NativeProps;
|
|
22
23
|
export declare const FormItem: FC<FormItemProps>;
|
|
23
24
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useContext, useCallback, useState } from 'react';
|
|
2
|
+
import React, { useContext, useCallback, useState, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Field } from 'rc-field-form';
|
|
5
5
|
import FieldContext from 'rc-field-form/lib/FieldContext';
|
|
6
6
|
import { devWarning } from '../../utils/dev-log';
|
|
7
7
|
import { FormContext, NoStyleItemContext } from './context';
|
|
8
|
-
import { toArray } from './utils';
|
|
8
|
+
import { toArray, isSafeSetRefComponent } from './utils';
|
|
9
9
|
import List from '../list';
|
|
10
10
|
import Popover from '../popover';
|
|
11
11
|
import { QuestionCircleOutline } from 'antd-mobile-icons';
|
|
@@ -147,7 +147,8 @@ export const FormItem = props => {
|
|
|
147
147
|
validateTrigger: contextValidateTrigger
|
|
148
148
|
} = useContext(FieldContext);
|
|
149
149
|
const mergedValidateTrigger = undefinedFallback(validateTrigger, contextValidateTrigger, trigger);
|
|
150
|
-
const
|
|
150
|
+
const widgetRef = useRef(null);
|
|
151
|
+
const updateRef = useRef(0);
|
|
151
152
|
updateRef.current += 1;
|
|
152
153
|
const [subMetas, setSubMetas] = useState({});
|
|
153
154
|
const onSubMetaChange = useCallback((subMeta, namePath) => {
|
|
@@ -209,7 +210,7 @@ export const FormItem = props => {
|
|
|
209
210
|
htmlFor: fieldId,
|
|
210
211
|
errors: errors,
|
|
211
212
|
warnings: warnings,
|
|
212
|
-
onClick: onClick,
|
|
213
|
+
onClick: onClick && (e => onClick(e, widgetRef)),
|
|
213
214
|
hidden: hidden,
|
|
214
215
|
layout: layout,
|
|
215
216
|
childElementPosition: childElementPosition,
|
|
@@ -286,6 +287,24 @@ export const FormItem = props => {
|
|
|
286
287
|
|
|
287
288
|
const childProps = Object.assign(Object.assign({}, children.props), control);
|
|
288
289
|
|
|
290
|
+
if (isSafeSetRefComponent(children)) {
|
|
291
|
+
childProps.ref = instance => {
|
|
292
|
+
const originRef = children.ref;
|
|
293
|
+
|
|
294
|
+
if (originRef) {
|
|
295
|
+
if (typeof originRef === 'function') {
|
|
296
|
+
originRef(instance);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if ('current' in originRef) {
|
|
300
|
+
originRef.current = instance;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
widgetRef.current = instance;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
289
308
|
if (!childProps.id) {
|
|
290
309
|
childProps.id = fieldId;
|
|
291
310
|
} // We should keep user origin event handler
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
+
import { isMemo, isFragment } from 'react-is';
|
|
1
2
|
export function toArray(candidate) {
|
|
2
3
|
if (candidate === undefined || candidate === false) return [];
|
|
3
4
|
return Array.isArray(candidate) ? candidate : [candidate];
|
|
5
|
+
} // eslint-disable-next-line @typescript-eslint/ban-types
|
|
6
|
+
|
|
7
|
+
function shouldConstruct(Component) {
|
|
8
|
+
const prototype = Component.prototype;
|
|
9
|
+
return !!(prototype && prototype.isReactComponent);
|
|
10
|
+
} // https://github.com/facebook/react/blob/ce13860281f833de8a3296b7a3dad9caced102e9/packages/react-reconciler/src/ReactFiber.new.js#L225
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function isSimpleFunctionComponent(type) {
|
|
14
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isSafeSetRefComponent(component) {
|
|
18
|
+
if (isFragment(component)) return false;
|
|
19
|
+
if (isMemo(component)) return isSafeSetRefComponent(component.type);
|
|
20
|
+
return !isSimpleFunctionComponent(component.type);
|
|
4
21
|
}
|
|
@@ -65,6 +65,7 @@ export const ImageUploader = p => {
|
|
|
65
65
|
} = e.target;
|
|
66
66
|
if (!rawFiles) return;
|
|
67
67
|
let files = [].slice.call(rawFiles);
|
|
68
|
+
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
68
69
|
|
|
69
70
|
if (props.beforeUpload) {
|
|
70
71
|
const postFiles = files.map(file => {
|
|
@@ -94,8 +95,6 @@ export const ImageUploader = p => {
|
|
|
94
95
|
file
|
|
95
96
|
}));
|
|
96
97
|
setTasks(prev => [...prev, ...newTasks]);
|
|
97
|
-
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
98
|
-
|
|
99
98
|
yield Promise.all(newTasks.map(currentTask => __awaiter(this, void 0, void 0, function* () {
|
|
100
99
|
try {
|
|
101
100
|
const result = yield props.upload(currentTask.file);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
4
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick'> & {
|
|
4
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick'> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
defaultValue?: string;
|
|
7
7
|
onChange?: (val: string) => void;
|
|
@@ -23,7 +23,7 @@ export declare type InputRef = {
|
|
|
23
23
|
blur: () => void;
|
|
24
24
|
nativeElement: HTMLInputElement | null;
|
|
25
25
|
};
|
|
26
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "onClick" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "autoFocus" | "maxLength" | "minLength"> & {
|
|
26
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "onClick" | "name" | "type" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "autoCapitalize" | "autoCorrect" | "inputMode" | "autoComplete" | "autoFocus" | "maxLength" | "minLength"> & {
|
|
27
27
|
value?: string | undefined;
|
|
28
28
|
defaultValue?: string | undefined;
|
|
29
29
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -116,6 +116,7 @@ export const Input = forwardRef((p, ref) => {
|
|
|
116
116
|
pattern: props.pattern,
|
|
117
117
|
inputMode: props.inputMode,
|
|
118
118
|
type: props.type,
|
|
119
|
+
name: props.name,
|
|
119
120
|
autoCapitalize: props.autoCapitalize,
|
|
120
121
|
autoCorrect: props.autoCorrect,
|
|
121
122
|
onKeyDown: handleKeydown,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from 'react';
|
|
2
|
+
import type { MaskProps } from '../mask';
|
|
2
3
|
import { Action } from './modal-action-button';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
@@ -19,7 +20,7 @@ export declare type ModalProps = {
|
|
|
19
20
|
getContainer?: GetContainer;
|
|
20
21
|
bodyStyle?: React.CSSProperties;
|
|
21
22
|
bodyClassName?: string;
|
|
22
|
-
maskStyle?:
|
|
23
|
+
maskStyle?: MaskProps['style'];
|
|
23
24
|
maskClassName?: string;
|
|
24
25
|
stopPropagation?: PropagationEvent[];
|
|
25
26
|
showCloseButton?: boolean;
|
|
@@ -92,7 +92,7 @@ export const Modal = p => {
|
|
|
92
92
|
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
|
|
93
93
|
className: cls(),
|
|
94
94
|
style: {
|
|
95
|
-
display: active ?
|
|
95
|
+
display: active ? undefined : 'none'
|
|
96
96
|
}
|
|
97
97
|
}, React.createElement(Mask, {
|
|
98
98
|
visible: props.visible,
|
|
@@ -103,7 +103,7 @@ export const Modal = p => {
|
|
|
103
103
|
}), React.createElement("div", {
|
|
104
104
|
className: cls('wrap'),
|
|
105
105
|
style: {
|
|
106
|
-
pointerEvents: props.visible ?
|
|
106
|
+
pointerEvents: props.visible ? undefined : 'none'
|
|
107
107
|
}
|
|
108
108
|
}, React.createElement(animated.div, {
|
|
109
109
|
style: style
|
|
@@ -1,9 +1,50 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import './picker.less';
|
|
3
2
|
import { prompt } from './prompt';
|
|
4
|
-
export type { PickerProps } from './picker';
|
|
3
|
+
export type { PickerProps, PickerRef, PickerActions } from './picker';
|
|
5
4
|
export type { PickerValue, PickerColumnItem, PickerColumn, PickerValueExtend, } from '../picker-view';
|
|
6
|
-
declare const _default: import("react").NamedExoticComponent<
|
|
5
|
+
declare const _default: import("react").NamedExoticComponent<{
|
|
6
|
+
columns: import("../picker-view").PickerColumn[] | ((value: import("../picker-view").PickerValue[]) => import("../picker-view").PickerColumn[]);
|
|
7
|
+
value?: import("../picker-view").PickerValue[] | undefined;
|
|
8
|
+
defaultValue?: import("../picker-view").PickerValue[] | undefined;
|
|
9
|
+
onSelect?: ((value: import("../picker-view").PickerValue[], extend: import("../picker-view").PickerValueExtend) => void) | undefined;
|
|
10
|
+
onConfirm?: ((value: import("../picker-view").PickerValue[], extend: import("../picker-view").PickerValueExtend) => void) | undefined;
|
|
11
|
+
onCancel?: (() => void) | undefined;
|
|
12
|
+
onClose?: (() => void) | undefined;
|
|
13
|
+
closeOnMaskClick?: boolean | undefined;
|
|
14
|
+
visible?: boolean | undefined;
|
|
15
|
+
title?: import("react").ReactNode;
|
|
16
|
+
confirmText?: import("react").ReactNode;
|
|
17
|
+
cancelText?: import("react").ReactNode;
|
|
18
|
+
children?: ((items: (import("../picker-view").PickerColumnItem | null)[], actions: import("./picker").PickerActions) => import("react").ReactNode) | undefined;
|
|
19
|
+
renderLabel?: ((item: import("../picker-view").PickerColumnItem) => import("react").ReactNode) | undefined;
|
|
20
|
+
mouseWheel?: boolean | undefined;
|
|
21
|
+
popupClassName?: string | undefined;
|
|
22
|
+
popupStyle?: import("react").CSSProperties | undefined;
|
|
23
|
+
forceRender?: boolean | undefined;
|
|
24
|
+
destroyOnClose?: boolean | undefined;
|
|
25
|
+
} & Pick<import("../popup").PopupProps, "onClick" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & import("../../utils/native-props").NativeProps<"--item-height" | "--header-button-font-size" | "--title-font-size" | "--item-font-size"> & import("react").RefAttributes<import("./picker").PickerActions>> & {
|
|
26
|
+
readonly type: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
columns: import("../picker-view").PickerColumn[] | ((value: import("../picker-view").PickerValue[]) => import("../picker-view").PickerColumn[]);
|
|
28
|
+
value?: import("../picker-view").PickerValue[] | undefined;
|
|
29
|
+
defaultValue?: import("../picker-view").PickerValue[] | undefined;
|
|
30
|
+
onSelect?: ((value: import("../picker-view").PickerValue[], extend: import("../picker-view").PickerValueExtend) => void) | undefined;
|
|
31
|
+
onConfirm?: ((value: import("../picker-view").PickerValue[], extend: import("../picker-view").PickerValueExtend) => void) | undefined;
|
|
32
|
+
onCancel?: (() => void) | undefined;
|
|
33
|
+
onClose?: (() => void) | undefined;
|
|
34
|
+
closeOnMaskClick?: boolean | undefined;
|
|
35
|
+
visible?: boolean | undefined;
|
|
36
|
+
title?: import("react").ReactNode;
|
|
37
|
+
confirmText?: import("react").ReactNode;
|
|
38
|
+
cancelText?: import("react").ReactNode;
|
|
39
|
+
children?: ((items: (import("../picker-view").PickerColumnItem | null)[], actions: import("./picker").PickerActions) => import("react").ReactNode) | undefined;
|
|
40
|
+
renderLabel?: ((item: import("../picker-view").PickerColumnItem) => import("react").ReactNode) | undefined;
|
|
41
|
+
mouseWheel?: boolean | undefined;
|
|
42
|
+
popupClassName?: string | undefined;
|
|
43
|
+
popupStyle?: import("react").CSSProperties | undefined;
|
|
44
|
+
forceRender?: boolean | undefined;
|
|
45
|
+
destroyOnClose?: boolean | undefined;
|
|
46
|
+
} & Pick<import("../popup").PopupProps, "onClick" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & import("../../utils/native-props").NativeProps<"--item-height" | "--header-button-font-size" | "--title-font-size" | "--item-font-size"> & import("react").RefAttributes<import("./picker").PickerActions>>;
|
|
47
|
+
} & {
|
|
7
48
|
prompt: typeof prompt;
|
|
8
49
|
};
|
|
9
50
|
export default _default;
|
|
@@ -2,6 +2,12 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { PopupProps } from '../popup';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import { PickerColumn, PickerColumnItem, PickerValue, PickerValueExtend } from './index';
|
|
5
|
+
export declare type PickerActions = {
|
|
6
|
+
open: () => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare type PickerRef = PickerActions;
|
|
5
11
|
export declare type PickerProps = {
|
|
6
12
|
columns: PickerColumn[] | ((value: PickerValue[]) => PickerColumn[]);
|
|
7
13
|
value?: PickerValue[];
|
|
@@ -15,8 +21,32 @@ export declare type PickerProps = {
|
|
|
15
21
|
title?: ReactNode;
|
|
16
22
|
confirmText?: ReactNode;
|
|
17
23
|
cancelText?: ReactNode;
|
|
18
|
-
children?: (items: (PickerColumnItem | null)[]) => ReactNode;
|
|
24
|
+
children?: (items: (PickerColumnItem | null)[], actions: PickerActions) => ReactNode;
|
|
19
25
|
renderLabel?: (item: PickerColumnItem) => ReactNode;
|
|
20
26
|
mouseWheel?: boolean;
|
|
27
|
+
popupClassName?: string;
|
|
28
|
+
popupStyle?: React.CSSProperties;
|
|
29
|
+
forceRender?: boolean;
|
|
30
|
+
destroyOnClose?: boolean;
|
|
21
31
|
} & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size' | '--item-height'>;
|
|
22
|
-
export declare const Picker: React.
|
|
32
|
+
export declare const Picker: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
33
|
+
columns: PickerColumn[] | ((value: PickerValue[]) => PickerColumn[]);
|
|
34
|
+
value?: PickerValue[] | undefined;
|
|
35
|
+
defaultValue?: PickerValue[] | undefined;
|
|
36
|
+
onSelect?: ((value: PickerValue[], extend: PickerValueExtend) => void) | undefined;
|
|
37
|
+
onConfirm?: ((value: PickerValue[], extend: PickerValueExtend) => void) | undefined;
|
|
38
|
+
onCancel?: (() => void) | undefined;
|
|
39
|
+
onClose?: (() => void) | undefined;
|
|
40
|
+
closeOnMaskClick?: boolean | undefined;
|
|
41
|
+
visible?: boolean | undefined;
|
|
42
|
+
title?: ReactNode;
|
|
43
|
+
confirmText?: ReactNode;
|
|
44
|
+
cancelText?: ReactNode;
|
|
45
|
+
children?: ((items: (PickerColumnItem | null)[], actions: PickerActions) => ReactNode) | undefined;
|
|
46
|
+
renderLabel?: ((item: PickerColumnItem) => ReactNode) | undefined;
|
|
47
|
+
mouseWheel?: boolean | undefined;
|
|
48
|
+
popupClassName?: string | undefined;
|
|
49
|
+
popupStyle?: React.CSSProperties | undefined;
|
|
50
|
+
forceRender?: boolean | undefined;
|
|
51
|
+
destroyOnClose?: boolean | undefined;
|
|
52
|
+
} & Pick<PopupProps, "onClick" | "getContainer" | "afterShow" | "afterClose" | "stopPropagation"> & NativeProps<"--item-height" | "--header-button-font-size" | "--title-font-size" | "--item-font-size"> & React.RefAttributes<PickerActions>>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect, memo } from 'react';
|
|
1
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle, memo } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
2
3
|
import Popup from '../popup';
|
|
3
4
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
5
|
import { withNativeProps } from '../../utils/native-props';
|
|
@@ -9,13 +10,14 @@ import { useConfig } from '../config-provider';
|
|
|
9
10
|
import { useMemoizedFn } from 'ahooks';
|
|
10
11
|
import SafeArea from '../safe-area';
|
|
11
12
|
import { defaultRenderLabel } from './picker-utils';
|
|
13
|
+
import { useShouldRender } from '../../utils/should-render';
|
|
12
14
|
const classPrefix = `adm-picker`;
|
|
13
15
|
const defaultProps = {
|
|
14
16
|
defaultValue: [],
|
|
15
17
|
closeOnMaskClick: true,
|
|
16
18
|
renderLabel: defaultRenderLabel
|
|
17
19
|
};
|
|
18
|
-
export const Picker = memo(p => {
|
|
20
|
+
export const Picker = memo(forwardRef((p, ref) => {
|
|
19
21
|
var _a;
|
|
20
22
|
|
|
21
23
|
const {
|
|
@@ -25,6 +27,29 @@ export const Picker = memo(p => {
|
|
|
25
27
|
confirmText: locale.common.confirm,
|
|
26
28
|
cancelText: locale.common.cancel
|
|
27
29
|
}, p);
|
|
30
|
+
const [visible, setVisible] = usePropsValue({
|
|
31
|
+
value: props.visible,
|
|
32
|
+
defaultValue: false,
|
|
33
|
+
onChange: v => {
|
|
34
|
+
var _a;
|
|
35
|
+
|
|
36
|
+
if (v === false) {
|
|
37
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const actions = {
|
|
42
|
+
toggle: () => {
|
|
43
|
+
setVisible(v => !v);
|
|
44
|
+
},
|
|
45
|
+
open: () => {
|
|
46
|
+
setVisible(true);
|
|
47
|
+
},
|
|
48
|
+
close: () => {
|
|
49
|
+
setVisible(false);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
useImperativeHandle(ref, () => actions);
|
|
28
53
|
const [value, setValue] = usePropsValue(Object.assign(Object.assign({}, props), {
|
|
29
54
|
onChange: val => {
|
|
30
55
|
var _a;
|
|
@@ -39,9 +64,9 @@ export const Picker = memo(p => {
|
|
|
39
64
|
if (innerValue !== value) {
|
|
40
65
|
setInnerValue(value);
|
|
41
66
|
}
|
|
42
|
-
}, [
|
|
67
|
+
}, [visible]);
|
|
43
68
|
useEffect(() => {
|
|
44
|
-
if (!
|
|
69
|
+
if (!visible) {
|
|
45
70
|
setInnerValue(value);
|
|
46
71
|
}
|
|
47
72
|
}, [value]);
|
|
@@ -50,10 +75,11 @@ export const Picker = memo(p => {
|
|
|
50
75
|
|
|
51
76
|
setInnerValue(val);
|
|
52
77
|
|
|
53
|
-
if (
|
|
78
|
+
if (visible) {
|
|
54
79
|
(_a = props.onSelect) === null || _a === void 0 ? void 0 : _a.call(props, val, ext);
|
|
55
80
|
}
|
|
56
81
|
});
|
|
82
|
+
const shouldRender = useShouldRender(visible, props.forceRender, props.destroyOnClose);
|
|
57
83
|
const pickerElement = withNativeProps(props, React.createElement("div", {
|
|
58
84
|
className: classPrefix
|
|
59
85
|
}, React.createElement("div", {
|
|
@@ -61,20 +87,18 @@ export const Picker = memo(p => {
|
|
|
61
87
|
}, React.createElement("a", {
|
|
62
88
|
className: `${classPrefix}-header-button`,
|
|
63
89
|
onClick: () => {
|
|
64
|
-
var _a
|
|
90
|
+
var _a;
|
|
65
91
|
|
|
66
92
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
67
|
-
(
|
|
93
|
+
setVisible(false);
|
|
68
94
|
}
|
|
69
95
|
}, props.cancelText), React.createElement("div", {
|
|
70
96
|
className: `${classPrefix}-header-title`
|
|
71
97
|
}, props.title), React.createElement("a", {
|
|
72
98
|
className: `${classPrefix}-header-button`,
|
|
73
99
|
onClick: () => {
|
|
74
|
-
var _a;
|
|
75
|
-
|
|
76
100
|
setValue(innerValue);
|
|
77
|
-
(
|
|
101
|
+
setVisible(false);
|
|
78
102
|
}
|
|
79
103
|
}, props.confirmText)), React.createElement("div", {
|
|
80
104
|
className: `${classPrefix}-body`
|
|
@@ -86,15 +110,16 @@ export const Picker = memo(p => {
|
|
|
86
110
|
onChange: onChange
|
|
87
111
|
}))));
|
|
88
112
|
const popupElement = React.createElement(Popup, {
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
style: props.popupStyle,
|
|
114
|
+
className: classNames(`${classPrefix}-popup`, props.popupClassName),
|
|
115
|
+
visible: visible,
|
|
91
116
|
position: 'bottom',
|
|
92
117
|
onMaskClick: () => {
|
|
93
|
-
var _a
|
|
118
|
+
var _a;
|
|
94
119
|
|
|
95
120
|
if (!props.closeOnMaskClick) return;
|
|
96
121
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
97
|
-
(
|
|
122
|
+
setVisible(false);
|
|
98
123
|
},
|
|
99
124
|
getContainer: props.getContainer,
|
|
100
125
|
destroyOnClose: true,
|
|
@@ -103,9 +128,9 @@ export const Picker = memo(p => {
|
|
|
103
128
|
onClick: props.onClick,
|
|
104
129
|
forceRender: true,
|
|
105
130
|
stopPropagation: props.stopPropagation
|
|
106
|
-
}, pickerElement, React.createElement(SafeArea, {
|
|
131
|
+
}, shouldRender && pickerElement, React.createElement(SafeArea, {
|
|
107
132
|
position: 'bottom'
|
|
108
133
|
}));
|
|
109
|
-
return React.createElement(React.Fragment, null, popupElement, (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, extend.items));
|
|
110
|
-
});
|
|
134
|
+
return React.createElement(React.Fragment, null, popupElement, (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, extend.items, actions));
|
|
135
|
+
}));
|
|
111
136
|
Picker.displayName = 'Picker';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { MaskProps } from '../mask';
|
|
3
4
|
import { GetContainer } from '../../utils/render-to-container';
|
|
4
5
|
import { PropagationEvent } from '../../utils/with-stop-propagation';
|
|
5
6
|
export declare type PopupProps = {
|
|
@@ -15,7 +16,7 @@ export declare type PopupProps = {
|
|
|
15
16
|
bodyClassName?: string;
|
|
16
17
|
bodyStyle?: React.CSSProperties;
|
|
17
18
|
maskClassName?: string;
|
|
18
|
-
maskStyle?:
|
|
19
|
+
maskStyle?: MaskProps['style'];
|
|
19
20
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
20
21
|
stopPropagation?: PropagationEvent[];
|
|
21
22
|
children?: React.ReactNode;
|