antd-mobile 5.11.1 → 5.12.1
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.js +2 -2
- 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-uploader/image-uploader.js +10 -4
- 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-item.js +7 -5
- package/2x/cjs/components/list/list.css +1 -0
- package/2x/cjs/components/mask/mask.js +1 -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.js +1 -1
- package/2x/cjs/components/swipe-action/swipe-action.js +1 -1
- package/2x/cjs/components/tabs/tabs.css +1 -0
- 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/virtual-input/virtual-input.js +2 -1
- package/2x/cjs/locales/base.d.ts +1 -0
- package/2x/cjs/locales/base.js +2 -1
- package/2x/cjs/locales/en-US.d.ts +1 -0
- package/2x/cjs/locales/es-ES.d.ts +1 -0
- package/2x/cjs/locales/fa-IR.d.ts +1 -0
- package/2x/cjs/locales/ko-KR.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.js +2 -1
- package/2x/cjs/locales/zh-HK.d.ts +1 -0
- package/2x/cjs/locales/zh-TW.d.ts +1 -0
- package/2x/cjs/utils/is-node-with-content.d.ts +4 -0
- package/2x/cjs/utils/is-node-with-content.js +10 -0
- 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.js +2 -2
- 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-uploader/image-uploader.js +9 -4
- 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-item.js +6 -5
- package/2x/es/components/list/list.css +1 -0
- package/2x/es/components/mask/mask.js +1 -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.js +1 -1
- package/2x/es/components/swipe-action/swipe-action.js +1 -1
- package/2x/es/components/tabs/tabs.css +1 -0
- 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/virtual-input/virtual-input.js +2 -1
- package/2x/es/locales/base.d.ts +1 -0
- package/2x/es/locales/base.js +2 -1
- package/2x/es/locales/en-US.d.ts +1 -0
- package/2x/es/locales/es-ES.d.ts +1 -0
- package/2x/es/locales/fa-IR.d.ts +1 -0
- package/2x/es/locales/ko-KR.d.ts +1 -0
- package/2x/es/locales/zh-CN.d.ts +1 -0
- package/2x/es/locales/zh-CN.js +2 -1
- package/2x/es/locales/zh-HK.d.ts +1 -0
- package/2x/es/locales/zh-TW.d.ts +1 -0
- package/2x/es/utils/is-node-with-content.d.ts +4 -0
- package/2x/es/utils/is-node-with-content.js +3 -0
- 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 +8 -8
- package/bundle/antd-mobile.cjs.js +5072 -4312
- package/bundle/antd-mobile.es.js +5073 -4313
- package/bundle/style.css +4 -0
- 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.js +2 -2
- 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-uploader/image-uploader.js +10 -4
- 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-item.js +7 -5
- package/cjs/components/list/list.css +1 -0
- package/cjs/components/mask/mask.js +1 -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.js +1 -1
- package/cjs/components/swipe-action/swipe-action.js +1 -1
- package/cjs/components/tabs/tabs.css +1 -0
- 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/virtual-input/virtual-input.js +2 -1
- package/cjs/locales/base.d.ts +1 -0
- package/cjs/locales/base.js +2 -1
- package/cjs/locales/en-US.d.ts +1 -0
- package/cjs/locales/es-ES.d.ts +1 -0
- package/cjs/locales/fa-IR.d.ts +1 -0
- package/cjs/locales/ko-KR.d.ts +1 -0
- package/cjs/locales/zh-CN.d.ts +1 -0
- package/cjs/locales/zh-CN.js +2 -1
- package/cjs/locales/zh-HK.d.ts +1 -0
- package/cjs/locales/zh-TW.d.ts +1 -0
- package/cjs/utils/is-node-with-content.d.ts +4 -0
- package/cjs/utils/is-node-with-content.js +10 -0
- 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.js +2 -2
- 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-uploader/image-uploader.js +9 -4
- 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-item.js +6 -5
- package/es/components/list/list.css +1 -0
- package/es/components/mask/mask.js +1 -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.js +1 -1
- package/es/components/swipe-action/swipe-action.js +1 -1
- package/es/components/tabs/tabs.css +1 -0
- 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/virtual-input/virtual-input.js +2 -1
- package/es/locales/base.d.ts +1 -0
- package/es/locales/base.js +2 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/es-ES.d.ts +1 -0
- package/es/locales/fa-IR.d.ts +1 -0
- package/es/locales/ko-KR.d.ts +1 -0
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-HK.d.ts +1 -0
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/utils/is-node-with-content.d.ts +4 -0
- package/es/utils/is-node-with-content.js +3 -0
- 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 +8 -8
- package/umd/antd-mobile.js +1 -1
|
@@ -9,6 +9,10 @@ export declare type CalenderRef = {
|
|
|
9
9
|
jumpToToday: () => void;
|
|
10
10
|
};
|
|
11
11
|
export declare type CalendarProps = {
|
|
12
|
+
prevMonthButton?: React.ReactNode;
|
|
13
|
+
prevYearButton?: React.ReactNode;
|
|
14
|
+
nextMonthButton?: React.ReactNode;
|
|
15
|
+
nextYearButton?: React.ReactNode;
|
|
12
16
|
onPageChange?: (year: number, month: number) => void;
|
|
13
17
|
weekStartsOn?: 'Monday' | 'Sunday';
|
|
14
18
|
renderLabel?: (date: Date) => string | null | undefined;
|
|
@@ -41,7 +41,11 @@ const classPrefix = 'adm-calendar';
|
|
|
41
41
|
const defaultProps = {
|
|
42
42
|
weekStartsOn: 'Sunday',
|
|
43
43
|
defaultValue: null,
|
|
44
|
-
allowClear: true
|
|
44
|
+
allowClear: true,
|
|
45
|
+
prevMonthButton: _react.default.createElement(_arrowLeft.ArrowLeft, null),
|
|
46
|
+
prevYearButton: _react.default.createElement(_arrowLeftDouble.ArrowLeftDouble, null),
|
|
47
|
+
nextMonthButton: _react.default.createElement(_arrowLeft.ArrowLeft, null),
|
|
48
|
+
nextYearButton: _react.default.createElement(_arrowLeftDouble.ArrowLeftDouble, null)
|
|
45
49
|
};
|
|
46
50
|
const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
47
51
|
const today = (0, _dayjs.default)();
|
|
@@ -99,28 +103,28 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
|
99
103
|
const header = _react.default.createElement("div", {
|
|
100
104
|
className: `${classPrefix}-header`
|
|
101
105
|
}, _react.default.createElement("a", {
|
|
102
|
-
className: `${classPrefix}-arrow-button`,
|
|
106
|
+
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-year`,
|
|
103
107
|
onClick: () => {
|
|
104
108
|
setCurrent(current.subtract(1, 'year'));
|
|
105
109
|
}
|
|
106
|
-
},
|
|
107
|
-
className: `${classPrefix}-arrow-button`,
|
|
110
|
+
}, props.prevYearButton), _react.default.createElement("a", {
|
|
111
|
+
className: `${classPrefix}-arrow-button ${classPrefix}-arrow-button-month`,
|
|
108
112
|
onClick: () => {
|
|
109
113
|
setCurrent(current.subtract(1, 'month'));
|
|
110
114
|
}
|
|
111
|
-
},
|
|
115
|
+
}, props.prevMonthButton), _react.default.createElement("div", {
|
|
112
116
|
className: `${classPrefix}-title`
|
|
113
117
|
}, locale.Calendar.renderYearAndMonth(current.year(), current.month() + 1)), _react.default.createElement("a", {
|
|
114
|
-
className: `${classPrefix}-arrow-button
|
|
118
|
+
className: (0, _classnames.default)(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-month`),
|
|
115
119
|
onClick: () => {
|
|
116
120
|
setCurrent(current.add(1, 'month'));
|
|
117
121
|
}
|
|
118
|
-
},
|
|
119
|
-
className: `${classPrefix}-arrow-button
|
|
122
|
+
}, props.nextMonthButton), _react.default.createElement("a", {
|
|
123
|
+
className: (0, _classnames.default)(`${classPrefix}-arrow-button`, `${classPrefix}-arrow-button-right`, `${classPrefix}-arrow-button-right-year`),
|
|
120
124
|
onClick: () => {
|
|
121
125
|
setCurrent(current.add(1, 'year'));
|
|
122
126
|
}
|
|
123
|
-
},
|
|
127
|
+
}, props.nextYearButton));
|
|
124
128
|
|
|
125
129
|
const maxDay = (0, _react.useMemo)(() => props.max && (0, _dayjs.default)(props.max), [props.max]);
|
|
126
130
|
const minDay = (0, _react.useMemo)(() => props.min && (0, _dayjs.default)(props.min), [props.min]);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { PickerProps } from '../picker';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PickerProps, PickerRef } from '../picker';
|
|
3
|
+
export declare type CascadePickerRef = PickerRef;
|
|
3
4
|
export declare type CascadePickerOption = {
|
|
4
5
|
label: string;
|
|
5
6
|
value: string;
|
|
@@ -8,4 +9,6 @@ export declare type CascadePickerOption = {
|
|
|
8
9
|
export declare type CascadePickerProps = Omit<PickerProps, 'columns'> & {
|
|
9
10
|
options: CascadePickerOption[];
|
|
10
11
|
};
|
|
11
|
-
export declare const CascadePicker:
|
|
12
|
+
export declare const CascadePicker: React.ForwardRefExoticComponent<Omit<PickerProps, "columns"> & {
|
|
13
|
+
options: CascadePickerOption[];
|
|
14
|
+
} & React.RefAttributes<import("../picker").PickerActions>>;
|
|
@@ -7,7 +7,7 @@ exports.CascadePicker = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
10
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
12
|
var _picker = _interopRequireDefault(require("../picker"));
|
|
13
13
|
|
|
@@ -15,15 +15,19 @@ var _cascadePickerUtils = require("./cascade-picker-utils");
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
const CascadePicker = (0, _react.forwardRef)((props, ref) => {
|
|
19
23
|
const {
|
|
20
24
|
options
|
|
21
25
|
} = props,
|
|
22
26
|
pickerProps = (0, _tslib.__rest)(props, ["options"]);
|
|
23
27
|
const columnsFn = (0, _cascadePickerUtils.useColumnsFn)(options);
|
|
24
28
|
return _react.default.createElement(_picker.default, Object.assign({}, pickerProps, {
|
|
29
|
+
ref: ref,
|
|
25
30
|
columns: columnsFn
|
|
26
31
|
}));
|
|
27
|
-
};
|
|
28
|
-
|
|
32
|
+
});
|
|
29
33
|
exports.CascadePicker = CascadePicker;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { prompt } from './prompt';
|
|
3
|
-
export type { CascadePickerProps, CascadePickerOption } from './cascade-picker';
|
|
4
|
-
declare const _default: import("react").
|
|
3
|
+
export type { CascadePickerProps, CascadePickerRef, CascadePickerOption, } from './cascade-picker';
|
|
4
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<import("../picker").PickerProps, "columns"> & {
|
|
5
|
+
options: import("./cascade-picker").CascadePickerOption[];
|
|
6
|
+
} & import("react").RefAttributes<import("../picker").PickerActions>> & {
|
|
5
7
|
prompt: typeof prompt;
|
|
6
8
|
};
|
|
7
9
|
export default _default;
|
|
@@ -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>>;
|
|
@@ -35,8 +35,7 @@ const defaultProps = {
|
|
|
35
35
|
renderLabel: _datePickerUtils.defaultRenderLabel,
|
|
36
36
|
defaultValue: null
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
const DatePicker = p => {
|
|
38
|
+
const DatePicker = (0, _react.forwardRef)((p, ref) => {
|
|
40
39
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
41
40
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)({
|
|
42
41
|
value: props.value,
|
|
@@ -65,6 +64,7 @@ const DatePicker = p => {
|
|
|
65
64
|
});
|
|
66
65
|
const columns = (0, _react.useCallback)(selected => (0, _datePickerUtils.generateDatePickerColumns)(selected, props.min, props.max, props.precision, props.renderLabel, props.filter), [props.min, props.max, props.precision, props.renderLabel]);
|
|
67
66
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement(_picker.default, {
|
|
67
|
+
ref: ref,
|
|
68
68
|
columns: columns,
|
|
69
69
|
value: pickerValue,
|
|
70
70
|
onCancel: props.onCancel,
|
|
@@ -82,11 +82,10 @@ const DatePicker = p => {
|
|
|
82
82
|
title: props.title,
|
|
83
83
|
stopPropagation: props.stopPropagation,
|
|
84
84
|
mouseWheel: props.mouseWheel
|
|
85
|
-
}, () => {
|
|
85
|
+
}, (_, actions) => {
|
|
86
86
|
var _a;
|
|
87
87
|
|
|
88
|
-
return (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
88
|
+
return (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, value, actions);
|
|
89
89
|
}));
|
|
90
|
-
};
|
|
91
|
-
|
|
90
|
+
});
|
|
92
91
|
exports.DatePicker = DatePicker;
|
|
@@ -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;
|
|
@@ -117,7 +117,7 @@ const Dialog = p => {
|
|
|
117
117
|
const node = (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
118
118
|
className: cls(),
|
|
119
119
|
style: {
|
|
120
|
-
display: active ?
|
|
120
|
+
display: active ? undefined : 'none'
|
|
121
121
|
}
|
|
122
122
|
}, _react.default.createElement(_mask.default, {
|
|
123
123
|
visible: props.visible,
|
|
@@ -128,7 +128,7 @@ const Dialog = p => {
|
|
|
128
128
|
}), _react.default.createElement("div", {
|
|
129
129
|
className: cls('wrap'),
|
|
130
130
|
style: {
|
|
131
|
-
pointerEvents: props.visible ?
|
|
131
|
+
pointerEvents: props.visible ? undefined : 'none'
|
|
132
132
|
}
|
|
133
133
|
}, _react.default.createElement(_web.animated.div, {
|
|
134
134
|
style: style
|
|
@@ -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 {};
|
|
@@ -175,9 +175,8 @@ const FormItem = props => {
|
|
|
175
175
|
validateTrigger: contextValidateTrigger
|
|
176
176
|
} = (0, _react.useContext)(_FieldContext.default);
|
|
177
177
|
const mergedValidateTrigger = (0, _undefinedFallback.undefinedFallback)(validateTrigger, contextValidateTrigger, trigger);
|
|
178
|
-
|
|
179
|
-
const updateRef = _react.
|
|
180
|
-
|
|
178
|
+
const widgetRef = (0, _react.useRef)(null);
|
|
179
|
+
const updateRef = (0, _react.useRef)(0);
|
|
181
180
|
updateRef.current += 1;
|
|
182
181
|
const [subMetas, setSubMetas] = (0, _react.useState)({});
|
|
183
182
|
const onSubMetaChange = (0, _react.useCallback)((subMeta, namePath) => {
|
|
@@ -239,7 +238,7 @@ const FormItem = props => {
|
|
|
239
238
|
htmlFor: fieldId,
|
|
240
239
|
errors: errors,
|
|
241
240
|
warnings: warnings,
|
|
242
|
-
onClick: onClick,
|
|
241
|
+
onClick: onClick && (e => onClick(e, widgetRef)),
|
|
243
242
|
hidden: hidden,
|
|
244
243
|
layout: layout,
|
|
245
244
|
childElementPosition: childElementPosition,
|
|
@@ -316,6 +315,24 @@ const FormItem = props => {
|
|
|
316
315
|
|
|
317
316
|
const childProps = Object.assign(Object.assign({}, children.props), control);
|
|
318
317
|
|
|
318
|
+
if ((0, _utils.isSafeSetRefComponent)(children)) {
|
|
319
|
+
childProps.ref = instance => {
|
|
320
|
+
const originRef = children.ref;
|
|
321
|
+
|
|
322
|
+
if (originRef) {
|
|
323
|
+
if (typeof originRef === 'function') {
|
|
324
|
+
originRef(instance);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if ('current' in originRef) {
|
|
328
|
+
originRef.current = instance;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
widgetRef.current = instance;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
319
336
|
if (!childProps.id) {
|
|
320
337
|
childProps.id = fieldId;
|
|
321
338
|
} // We should keep user origin event handler
|
|
@@ -3,9 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.isSafeSetRefComponent = isSafeSetRefComponent;
|
|
6
7
|
exports.toArray = toArray;
|
|
7
8
|
|
|
9
|
+
var _reactIs = require("react-is");
|
|
10
|
+
|
|
8
11
|
function toArray(candidate) {
|
|
9
12
|
if (candidate === undefined || candidate === false) return [];
|
|
10
13
|
return Array.isArray(candidate) ? candidate : [candidate];
|
|
14
|
+
} // eslint-disable-next-line @typescript-eslint/ban-types
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
function shouldConstruct(Component) {
|
|
18
|
+
const prototype = Component.prototype;
|
|
19
|
+
return !!(prototype && prototype.isReactComponent);
|
|
20
|
+
} // https://github.com/facebook/react/blob/ce13860281f833de8a3296b7a3dad9caced102e9/packages/react-reconciler/src/ReactFiber.new.js#L225
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function isSimpleFunctionComponent(type) {
|
|
24
|
+
return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isSafeSetRefComponent(component) {
|
|
28
|
+
if ((0, _reactIs.isFragment)(component)) return false;
|
|
29
|
+
if ((0, _reactIs.isMemo)(component)) return isSafeSetRefComponent(component.type);
|
|
30
|
+
return !isSimpleFunctionComponent(component.type);
|
|
11
31
|
}
|
|
@@ -25,6 +25,8 @@ var _space = _interopRequireDefault(require("../space"));
|
|
|
25
25
|
|
|
26
26
|
var _nativeProps = require("../../utils/native-props");
|
|
27
27
|
|
|
28
|
+
var _configProvider = require("../config-provider");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -46,6 +48,9 @@ const defaultProps = {
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
const ImageUploader = p => {
|
|
51
|
+
const {
|
|
52
|
+
locale
|
|
53
|
+
} = (0, _configProvider.useConfig)();
|
|
49
54
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
50
55
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)(props);
|
|
51
56
|
const updateValue = (0, _ahooks.useMemoizedFn)(updater => {
|
|
@@ -85,6 +90,7 @@ const ImageUploader = p => {
|
|
|
85
90
|
} = e.target;
|
|
86
91
|
if (!rawFiles) return;
|
|
87
92
|
let files = [].slice.call(rawFiles);
|
|
93
|
+
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
88
94
|
|
|
89
95
|
if (props.beforeUpload) {
|
|
90
96
|
const postFiles = files.map(file => {
|
|
@@ -114,8 +120,6 @@ const ImageUploader = p => {
|
|
|
114
120
|
file
|
|
115
121
|
}));
|
|
116
122
|
setTasks(prev => [...prev, ...newTasks]);
|
|
117
|
-
e.target.value = ''; // HACK: fix the same file doesn't trigger onChange
|
|
118
|
-
|
|
119
123
|
yield Promise.all(newTasks.map(currentTask => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
120
124
|
try {
|
|
121
125
|
const result = yield props.upload(currentTask.file);
|
|
@@ -218,7 +222,8 @@ const ImageUploader = p => {
|
|
|
218
222
|
className: `${classPrefix}-upload-button-wrap`
|
|
219
223
|
}, props.children ? props.children : _react.default.createElement("span", {
|
|
220
224
|
className: `${classPrefix}-cell ${classPrefix}-upload-button`,
|
|
221
|
-
role: 'button'
|
|
225
|
+
role: 'button',
|
|
226
|
+
"aria-label": locale.ImageUploader.upload
|
|
222
227
|
}, _react.default.createElement("span", {
|
|
223
228
|
className: `${classPrefix}-upload-button-icon`
|
|
224
229
|
}, _react.default.createElement(_antdMobileIcons.AddOutline, null))), !props.disableUpload && _react.default.createElement("input", {
|
|
@@ -227,7 +232,8 @@ const ImageUploader = p => {
|
|
|
227
232
|
multiple: props.multiple,
|
|
228
233
|
type: 'file',
|
|
229
234
|
className: `${classPrefix}-input`,
|
|
230
|
-
onChange: onChange
|
|
235
|
+
onChange: onChange,
|
|
236
|
+
"aria-hidden": true
|
|
231
237
|
})))));
|
|
232
238
|
};
|
|
233
239
|
|
|
@@ -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;
|
|
@@ -137,6 +137,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
137
137
|
pattern: props.pattern,
|
|
138
138
|
inputMode: props.inputMode,
|
|
139
139
|
type: props.type,
|
|
140
|
+
name: props.name,
|
|
140
141
|
autoCapitalize: props.autoCapitalize,
|
|
141
142
|
autoCorrect: props.autoCorrect,
|
|
142
143
|
onKeyDown: handleKeydown,
|
|
@@ -13,6 +13,8 @@ var _antdMobileIcons = require("antd-mobile-icons");
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
+
var _isNodeWithContent = require("../../utils/is-node-with-content");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
const classPrefix = `adm-list-item`;
|
|
@@ -25,17 +27,17 @@ const ListItem = props => {
|
|
|
25
27
|
|
|
26
28
|
const content = _react.default.createElement("div", {
|
|
27
29
|
className: `${classPrefix}-content`
|
|
28
|
-
}, props.prefix && _react.default.createElement("div", {
|
|
30
|
+
}, (0, _isNodeWithContent.isNodeWithContent)(props.prefix) && _react.default.createElement("div", {
|
|
29
31
|
className: `${classPrefix}-content-prefix`
|
|
30
32
|
}, props.prefix), _react.default.createElement("div", {
|
|
31
33
|
className: `${classPrefix}-content-main`
|
|
32
|
-
}, props.title && _react.default.createElement("div", {
|
|
34
|
+
}, (0, _isNodeWithContent.isNodeWithContent)(props.title) && _react.default.createElement("div", {
|
|
33
35
|
className: `${classPrefix}-title`
|
|
34
|
-
}, props.title), props.children, props.description && _react.default.createElement("div", {
|
|
36
|
+
}, props.title), props.children, (0, _isNodeWithContent.isNodeWithContent)(props.description) && _react.default.createElement("div", {
|
|
35
37
|
className: `${classPrefix}-description`
|
|
36
|
-
}, props.description)), props.extra && _react.default.createElement("div", {
|
|
38
|
+
}, props.description)), (0, _isNodeWithContent.isNodeWithContent)(props.extra) && _react.default.createElement("div", {
|
|
37
39
|
className: `${classPrefix}-content-extra`
|
|
38
|
-
}, props.extra), arrow && _react.default.createElement("div", {
|
|
40
|
+
}, props.extra), (0, _isNodeWithContent.isNodeWithContent)(arrow) && _react.default.createElement("div", {
|
|
39
41
|
className: `${classPrefix}-content-arrow`
|
|
40
42
|
}, arrow === true ? _react.default.createElement(_antdMobileIcons.RightOutline, null) : arrow));
|
|
41
43
|
|
|
@@ -123,7 +123,7 @@ const Modal = p => {
|
|
|
123
123
|
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
124
124
|
className: cls(),
|
|
125
125
|
style: {
|
|
126
|
-
display: active ?
|
|
126
|
+
display: active ? undefined : 'none'
|
|
127
127
|
}
|
|
128
128
|
}, _react.default.createElement(_mask.default, {
|
|
129
129
|
visible: props.visible,
|
|
@@ -134,7 +134,7 @@ const Modal = p => {
|
|
|
134
134
|
}), _react.default.createElement("div", {
|
|
135
135
|
className: cls('wrap'),
|
|
136
136
|
style: {
|
|
137
|
-
pointerEvents: props.visible ?
|
|
137
|
+
pointerEvents: props.visible ? undefined : 'none'
|
|
138
138
|
}
|
|
139
139
|
}, _react.default.createElement(_web.animated.div, {
|
|
140
140
|
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>>>;
|