antd-mobile 5.29.0 → 5.30.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 +3752 -3725
- package/2x/bundle/antd-mobile.cjs.js +9 -9
- package/2x/bundle/antd-mobile.es.development.js +3740 -3713
- package/2x/bundle/antd-mobile.es.js +6805 -6784
- package/2x/bundle/antd-mobile.umd.development.js +3752 -3725
- package/2x/bundle/antd-mobile.umd.js +9 -9
- package/2x/bundle/style.css +4 -2
- package/2x/cjs/components/calendar/calendar.js +1 -1
- package/2x/cjs/components/collapse/collapse.js +3 -1
- package/2x/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-utils.d.ts +1 -1
- package/2x/cjs/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/2x/cjs/components/dropdown/dropdown.d.ts +3 -0
- package/2x/cjs/components/dropdown/dropdown.js +4 -1
- package/2x/cjs/components/dropdown/index.d.ts +1 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +1 -1
- package/2x/cjs/components/footer/footer.css +1 -1
- package/2x/cjs/components/form/form-subscribe.js +4 -1
- package/2x/cjs/components/form/form.js +1 -1
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/image/image.js +9 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +4 -5
- package/2x/cjs/components/number-keyboard/number-keyboard.js +5 -3
- package/2x/cjs/components/page-indicator/page-indicator.css +1 -1
- package/2x/cjs/components/picker-view/picker-view.d.ts +2 -2
- package/2x/cjs/components/popup/popup.js +16 -3
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/2x/cjs/components/search-bar/search-bar.js +6 -2
- package/2x/cjs/components/steps/steps.css +2 -0
- package/2x/cjs/components/swiper/swiper.js +7 -5
- package/2x/cjs/components/text-area/text-area.js +6 -3
- package/2x/cjs/components/virtual-input/virtual-input.js +1 -2
- package/2x/cjs/locales/da-DK.d.ts +134 -0
- package/2x/cjs/locales/da-DK.js +132 -0
- package/2x/cjs/locales/it-IT.d.ts +134 -0
- package/2x/cjs/locales/it-IT.js +144 -0
- package/2x/cjs/locales/nb-NO.d.ts +134 -0
- package/2x/cjs/locales/nb-NO.js +144 -0
- package/2x/cjs/locales/nl-NL.d.ts +134 -0
- package/2x/cjs/locales/nl-NL.js +144 -0
- package/2x/es/components/calendar/calendar.js +1 -1
- package/2x/es/components/collapse/collapse.js +3 -1
- package/2x/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-utils.d.ts +1 -1
- package/2x/es/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/2x/es/components/dropdown/dropdown.d.ts +3 -0
- package/2x/es/components/dropdown/dropdown.js +4 -1
- package/2x/es/components/dropdown/index.d.ts +1 -0
- package/2x/es/components/ellipsis/ellipsis.js +1 -1
- package/2x/es/components/footer/footer.css +1 -1
- package/2x/es/components/form/form-subscribe.js +4 -1
- package/2x/es/components/form/form.js +1 -1
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/image/image.js +10 -1
- package/2x/es/components/image-uploader/image-uploader.js +4 -5
- package/2x/es/components/number-keyboard/number-keyboard.js +5 -3
- package/2x/es/components/page-indicator/page-indicator.css +1 -1
- package/2x/es/components/picker-view/picker-view.d.ts +2 -2
- package/2x/es/components/popup/popup.js +16 -3
- package/2x/es/components/search-bar/search-bar.d.ts +2 -2
- package/2x/es/components/search-bar/search-bar.js +6 -2
- package/2x/es/components/steps/steps.css +2 -0
- package/2x/es/components/swiper/swiper.js +8 -6
- package/2x/es/components/text-area/text-area.js +5 -3
- package/2x/es/components/virtual-input/virtual-input.js +1 -2
- package/2x/es/locales/da-DK.d.ts +134 -0
- package/2x/es/locales/da-DK.js +125 -0
- package/2x/es/locales/it-IT.d.ts +134 -0
- package/2x/es/locales/it-IT.js +137 -0
- package/2x/es/locales/nb-NO.d.ts +134 -0
- package/2x/es/locales/nb-NO.js +137 -0
- package/2x/es/locales/nl-NL.d.ts +134 -0
- package/2x/es/locales/nl-NL.js +137 -0
- package/2x/package.json +9 -9
- package/bundle/antd-mobile.cjs.development.js +3752 -3725
- package/bundle/antd-mobile.cjs.js +9 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +3740 -3713
- package/bundle/antd-mobile.es.js +6805 -6784
- package/bundle/antd-mobile.umd.development.js +3752 -3725
- package/bundle/antd-mobile.umd.js +9 -9
- package/bundle/style.css +1 -1
- package/cjs/components/calendar/calendar.js +1 -1
- package/cjs/components/collapse/collapse.js +3 -1
- package/cjs/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-utils.d.ts +1 -1
- package/cjs/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/cjs/components/dropdown/dropdown.d.ts +3 -0
- package/cjs/components/dropdown/dropdown.js +4 -1
- package/cjs/components/dropdown/index.d.ts +1 -0
- package/cjs/components/ellipsis/ellipsis.js +1 -1
- package/cjs/components/footer/footer.css +1 -1
- package/cjs/components/form/form-subscribe.js +4 -1
- package/cjs/components/form/form.js +1 -1
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/image/image.js +9 -0
- package/cjs/components/image-uploader/image-uploader.js +4 -5
- package/cjs/components/number-keyboard/number-keyboard.js +5 -3
- package/cjs/components/page-indicator/page-indicator.css +1 -1
- package/cjs/components/picker-view/picker-view.d.ts +2 -2
- package/cjs/components/popup/popup.js +16 -3
- package/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/cjs/components/search-bar/search-bar.js +6 -2
- package/cjs/components/steps/steps.css +2 -0
- package/cjs/components/swiper/swiper.js +7 -5
- package/cjs/components/text-area/text-area.js +6 -3
- package/cjs/components/virtual-input/virtual-input.js +1 -2
- package/cjs/locales/da-DK.d.ts +134 -0
- package/cjs/locales/da-DK.js +132 -0
- package/cjs/locales/it-IT.d.ts +134 -0
- package/cjs/locales/it-IT.js +144 -0
- package/cjs/locales/nb-NO.d.ts +134 -0
- package/cjs/locales/nb-NO.js +144 -0
- package/cjs/locales/nl-NL.d.ts +134 -0
- package/cjs/locales/nl-NL.js +144 -0
- package/es/components/calendar/calendar.js +1 -1
- package/es/components/collapse/collapse.js +3 -1
- package/es/components/date-picker/date-picker-date-utils.d.ts +1 -1
- package/es/components/date-picker/date-picker-utils.d.ts +1 -1
- package/es/components/date-picker/date-picker-week-utils.d.ts +1 -1
- package/es/components/dropdown/dropdown.d.ts +3 -0
- package/es/components/dropdown/dropdown.js +4 -1
- package/es/components/dropdown/index.d.ts +1 -0
- package/es/components/ellipsis/ellipsis.js +1 -1
- package/es/components/footer/footer.css +1 -1
- package/es/components/form/form-subscribe.js +4 -1
- package/es/components/form/form.js +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/image/image.js +10 -1
- package/es/components/image-uploader/image-uploader.js +4 -5
- package/es/components/number-keyboard/number-keyboard.js +5 -3
- package/es/components/page-indicator/page-indicator.css +1 -1
- package/es/components/picker-view/picker-view.d.ts +2 -2
- package/es/components/popup/popup.js +16 -3
- package/es/components/search-bar/search-bar.d.ts +2 -2
- package/es/components/search-bar/search-bar.js +6 -2
- package/es/components/steps/steps.css +2 -0
- package/es/components/swiper/swiper.js +8 -6
- package/es/components/text-area/text-area.js +5 -3
- package/es/components/virtual-input/virtual-input.js +1 -2
- package/es/locales/da-DK.d.ts +134 -0
- package/es/locales/da-DK.js +125 -0
- package/es/locales/it-IT.d.ts +134 -0
- package/es/locales/it-IT.js +137 -0
- package/es/locales/nb-NO.d.ts +134 -0
- package/es/locales/nb-NO.js +137 -0
- package/es/locales/nl-NL.d.ts +134 -0
- package/es/locales/nl-NL.js +137 -0
- package/package.json +9 -9
- package/umd/antd-mobile.js +1 -1
|
@@ -60,7 +60,9 @@ const CollapsePanelContent = props => {
|
|
|
60
60
|
}
|
|
61
61
|
}, [visible]);
|
|
62
62
|
return React.createElement(animated.div, {
|
|
63
|
-
className: `${classPrefix}-panel-content`,
|
|
63
|
+
className: classNames(`${classPrefix}-panel-content`, {
|
|
64
|
+
[`${classPrefix}-panel-content-active`]: visible
|
|
65
|
+
}),
|
|
64
66
|
style: {
|
|
65
67
|
height: height.to(v => {
|
|
66
68
|
if (height.idle && visible) {
|
|
@@ -4,4 +4,4 @@ import { RenderLabel } from '../date-picker-view/date-picker-view';
|
|
|
4
4
|
export declare type DatePrecision = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
|
|
5
5
|
export declare function generateDatePickerColumns(selected: string[], min: Date, max: Date, precision: DatePrecision, renderLabel: RenderLabel, filter: DatePickerFilter | undefined, tillNow?: boolean): PickerColumn[];
|
|
6
6
|
export declare function convertDateToStringArray(date: Date | undefined | null): string[];
|
|
7
|
-
export declare function convertStringArrayToDate
|
|
7
|
+
export declare function convertStringArrayToDate<T extends string | number | null | undefined>(value: T[]): Date;
|
|
@@ -6,5 +6,5 @@ export declare type DatePickerFilter = Partial<Record<Precision, (val: number, e
|
|
|
6
6
|
date: Date;
|
|
7
7
|
}) => boolean>>;
|
|
8
8
|
export declare const convertDateToStringArray: (date: Date | undefined | null, precision: Precision) => string[];
|
|
9
|
-
export declare const convertStringArrayToDate:
|
|
9
|
+
export declare const convertStringArrayToDate: <T extends string | number | null | undefined>(value: T[], precision: Precision) => Date;
|
|
10
10
|
export declare const generateDatePickerColumns: (selected: string[], min: Date, max: Date, precision: Precision, renderLabel: RenderLabel, filter: DatePickerFilter | undefined, tillNow?: boolean | undefined) => import("../picker-view").PickerColumn[];
|
|
@@ -4,4 +4,4 @@ import type { DatePickerFilter } from './date-picker-utils';
|
|
|
4
4
|
export declare type WeekPrecision = 'year' | 'week' | 'week-day';
|
|
5
5
|
export declare function generateDatePickerColumns(selected: string[], min: Date, max: Date, precision: WeekPrecision, renderLabel: (type: WeekPrecision, data: number) => ReactNode, filter: DatePickerFilter | undefined): PickerColumn[];
|
|
6
6
|
export declare function convertDateToStringArray(date: Date | undefined | null): string[];
|
|
7
|
-
export declare function convertStringArrayToDate
|
|
7
|
+
export declare function convertStringArrayToDate<T extends string | number | null | undefined>(value: T[]): Date;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PopupProps } from '../popup';
|
|
2
3
|
import { NativeProps } from '../../utils/native-props';
|
|
3
4
|
export declare type DropdownProps = {
|
|
4
5
|
activeKey?: string | null;
|
|
@@ -7,6 +8,7 @@ export declare type DropdownProps = {
|
|
|
7
8
|
closeOnClickAway?: boolean;
|
|
8
9
|
onChange?: (key: string | null) => void;
|
|
9
10
|
arrow?: React.ReactNode;
|
|
11
|
+
getContainer?: PopupProps['getContainer'];
|
|
10
12
|
} & NativeProps;
|
|
11
13
|
export declare type DropdownRef = {
|
|
12
14
|
close: () => void;
|
|
@@ -18,6 +20,7 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
18
20
|
closeOnClickAway?: boolean | undefined;
|
|
19
21
|
onChange?: ((key: string | null) => void) | undefined;
|
|
20
22
|
arrow?: React.ReactNode;
|
|
23
|
+
getContainer?: PopupProps['getContainer'];
|
|
21
24
|
} & {
|
|
22
25
|
className?: string | undefined;
|
|
23
26
|
style?: (React.CSSProperties & Partial<Record<never, string>>) | undefined;
|
|
@@ -6,11 +6,13 @@ import { ItemChildrenWrap } from './item';
|
|
|
6
6
|
import { withNativeProps } from '../../utils/native-props';
|
|
7
7
|
import { mergeProps } from '../../utils/with-default-props';
|
|
8
8
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
9
|
+
import { defaultPopupBaseProps } from '../popup/popup-base-props';
|
|
9
10
|
const classPrefix = `adm-dropdown`;
|
|
10
11
|
const defaultProps = {
|
|
11
12
|
defaultActiveKey: null,
|
|
12
13
|
closeOnMaskClick: true,
|
|
13
|
-
closeOnClickAway: false
|
|
14
|
+
closeOnClickAway: false,
|
|
15
|
+
getContainer: defaultPopupBaseProps['getContainer']
|
|
14
16
|
};
|
|
15
17
|
const Dropdown = forwardRef((p, ref) => {
|
|
16
18
|
const props = mergeProps(defaultProps, p);
|
|
@@ -78,6 +80,7 @@ const Dropdown = forwardRef((p, ref) => {
|
|
|
78
80
|
}, navs), React.createElement(Popup, {
|
|
79
81
|
visible: !!value,
|
|
80
82
|
position: 'top',
|
|
83
|
+
getContainer: props.getContainer,
|
|
81
84
|
className: `${classPrefix}-popup`,
|
|
82
85
|
maskClassName: `${classPrefix}-popup-mask`,
|
|
83
86
|
bodyClassName: `${classPrefix}-popup-body`,
|
|
@@ -8,6 +8,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
8
8
|
closeOnClickAway?: boolean | undefined;
|
|
9
9
|
onChange?: ((key: string | null) => void) | undefined;
|
|
10
10
|
arrow?: import("react").ReactNode;
|
|
11
|
+
getContainer?: import("../../utils/render-to-container").GetContainer | undefined;
|
|
11
12
|
} & {
|
|
12
13
|
className?: string | undefined;
|
|
13
14
|
style?: (import("react").CSSProperties & Partial<Record<never, string>>) | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
-
import runes from '
|
|
2
|
+
import runes from 'runes2';
|
|
3
3
|
import { mergeProps } from '../../utils/with-default-props';
|
|
4
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
5
5
|
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
@@ -5,7 +5,10 @@ import { useIsomorphicUpdateLayoutEffect } from '../../utils/use-isomorphic-upda
|
|
|
5
5
|
export const FormSubscribe = props => {
|
|
6
6
|
const update = useUpdate();
|
|
7
7
|
const form = useContext(FieldContext);
|
|
8
|
-
|
|
8
|
+
const value = form.getFieldsValue(props.to);
|
|
9
|
+
// Memo to avoid useless render
|
|
10
|
+
const childNode = React.useMemo(() => props.children(value, form), [JSON.stringify(value)]);
|
|
11
|
+
return React.createElement(React.Fragment, null, childNode, props.to.map(namePath => React.createElement(Watcher, {
|
|
9
12
|
key: namePath.toString(),
|
|
10
13
|
form: form,
|
|
11
14
|
namePath: namePath,
|
|
@@ -4,7 +4,7 @@ export declare type FormLayout = 'vertical' | 'horizontal';
|
|
|
4
4
|
export type { FormProps, FormInstance } from './form';
|
|
5
5
|
export type { FormItemProps } from './form-item';
|
|
6
6
|
export type { FormSubscribeProps } from './form-subscribe';
|
|
7
|
-
export type { ValidateMessages, FieldData, NamePath, } from 'rc-field-form/es/interface';
|
|
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
9
|
declare const _default: import("react").ForwardRefExoticComponent<Pick<import("rc-field-form").FormProps<any>, "children" | "form" | "name" | "initialValues" | "preserve" | "validateMessages" | "validateTrigger" | "onFieldsChange" | "onFinish" | "onFinishFailed" | "onValuesChange"> & {
|
|
10
10
|
className?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mergeProps } from '../../utils/with-default-props';
|
|
2
|
-
import React, { useState, useRef } from 'react';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
4
|
import { staged } from 'staged-components';
|
|
5
5
|
import { toCSSLength } from '../../utils/to-css-length';
|
|
@@ -24,6 +24,7 @@ export const Image = staged(p => {
|
|
|
24
24
|
const [loaded, setLoaded] = useState(false);
|
|
25
25
|
const [failed, setFailed] = useState(false);
|
|
26
26
|
const ref = useRef(null);
|
|
27
|
+
const imgRef = useRef(null);
|
|
27
28
|
let src = props.src;
|
|
28
29
|
let srcSet = props.srcSet;
|
|
29
30
|
const [initialized, setInitialized] = useState(!props.lazy);
|
|
@@ -33,11 +34,19 @@ export const Image = staged(p => {
|
|
|
33
34
|
setLoaded(false);
|
|
34
35
|
setFailed(false);
|
|
35
36
|
}, [src]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
// for nextjs ssr
|
|
40
|
+
if ((_a = imgRef.current) === null || _a === void 0 ? void 0 : _a.complete) {
|
|
41
|
+
setLoaded(true);
|
|
42
|
+
}
|
|
43
|
+
}, []);
|
|
36
44
|
function renderInner() {
|
|
37
45
|
if (failed) {
|
|
38
46
|
return React.createElement(React.Fragment, null, props.fallback);
|
|
39
47
|
}
|
|
40
48
|
const img = React.createElement("img", {
|
|
49
|
+
ref: imgRef,
|
|
41
50
|
className: `${classPrefix}-img`,
|
|
42
51
|
src: src,
|
|
43
52
|
alt: props.alt,
|
|
@@ -118,9 +118,11 @@ export const ImageUploader = p => {
|
|
|
118
118
|
file
|
|
119
119
|
}));
|
|
120
120
|
setTasks(prev => [...getFinalTasks(prev), ...newTasks]);
|
|
121
|
-
|
|
121
|
+
const newVal = [];
|
|
122
|
+
yield Promise.all(newTasks.map((currentTask, index) => __awaiter(this, void 0, void 0, function* () {
|
|
122
123
|
try {
|
|
123
124
|
const result = yield props.upload(currentTask.file);
|
|
125
|
+
newVal[index] = result;
|
|
124
126
|
setTasks(prev => {
|
|
125
127
|
return prev.map(task => {
|
|
126
128
|
if (task.id === currentTask.id) {
|
|
@@ -132,10 +134,6 @@ export const ImageUploader = p => {
|
|
|
132
134
|
return task;
|
|
133
135
|
});
|
|
134
136
|
});
|
|
135
|
-
setValue(prev => {
|
|
136
|
-
const newVal = Object.assign({}, result);
|
|
137
|
-
return [...prev, newVal];
|
|
138
|
-
});
|
|
139
137
|
} catch (e) {
|
|
140
138
|
setTasks(prev => {
|
|
141
139
|
return prev.map(task => {
|
|
@@ -150,6 +148,7 @@ export const ImageUploader = p => {
|
|
|
150
148
|
throw e;
|
|
151
149
|
}
|
|
152
150
|
}))).catch(error => console.error(error));
|
|
151
|
+
setValue(prev => prev.concat(newVal));
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
const imageViewerHandlerRef = useRef(null);
|
|
@@ -97,7 +97,7 @@ export const NumberKeyboard = p => {
|
|
|
97
97
|
var _a;
|
|
98
98
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
99
99
|
},
|
|
100
|
-
role: '
|
|
100
|
+
role: 'grid',
|
|
101
101
|
title: 'CLOSE',
|
|
102
102
|
tabIndex: -1
|
|
103
103
|
}, React.createElement(DownOutline, null)));
|
|
@@ -164,11 +164,13 @@ export const NumberKeyboard = p => {
|
|
|
164
164
|
onBackspacePressEnd();
|
|
165
165
|
},
|
|
166
166
|
title: 'BACKSPACE',
|
|
167
|
-
role: '
|
|
167
|
+
role: 'grid',
|
|
168
|
+
tabIndex: -1
|
|
168
169
|
}, React.createElement(TextDeletionOutline, null)), React.createElement("div", {
|
|
169
170
|
className: `${classPrefix}-key ${classPrefix}-key-extra ${classPrefix}-key-ok`,
|
|
170
171
|
onTouchEnd: e => onKeyPress(e, 'OK'),
|
|
171
|
-
role: '
|
|
172
|
+
role: 'grid',
|
|
173
|
+
tabIndex: -1,
|
|
172
174
|
"aria-label": confirmText
|
|
173
175
|
}, confirmText))), props.safeArea && React.createElement("div", {
|
|
174
176
|
className: `${classPrefix}-footer`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
import { PickerProps } from '../picker';
|
|
4
|
-
export declare type PickerValue = string | null;
|
|
4
|
+
export declare type PickerValue = string | number | null;
|
|
5
5
|
export declare type PickerValueExtend = {
|
|
6
6
|
columns: PickerColumnItem[][];
|
|
7
7
|
items: (PickerColumnItem | null)[];
|
|
8
8
|
};
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
|
-
value: string;
|
|
11
|
+
value: string | number;
|
|
12
12
|
key?: string | number;
|
|
13
13
|
};
|
|
14
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
@@ -13,6 +13,7 @@ import { CloseOutline } from 'antd-mobile-icons';
|
|
|
13
13
|
import { defaultPopupBaseProps } from './popup-base-props';
|
|
14
14
|
import { useInnerVisible } from '../../utils/use-inner-visible';
|
|
15
15
|
import { useConfig } from '../config-provider';
|
|
16
|
+
import { useDrag } from '@use-gesture/react';
|
|
16
17
|
const classPrefix = `adm-popup`;
|
|
17
18
|
const defaultProps = Object.assign(Object.assign({}, defaultPopupBaseProps), {
|
|
18
19
|
position: 'bottom'
|
|
@@ -53,14 +54,26 @@ export const Popup = p => {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
});
|
|
57
|
+
const bind = useDrag(({
|
|
58
|
+
swipe: [, swipeY]
|
|
59
|
+
}) => {
|
|
60
|
+
var _a;
|
|
61
|
+
if (swipeY === 1 && props.position === 'bottom' || swipeY === -1 && props.position === 'top') {
|
|
62
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
axis: 'y',
|
|
66
|
+
enabled: ['top', 'bottom'].includes(props.position)
|
|
67
|
+
});
|
|
56
68
|
const maskVisible = useInnerVisible(active && props.visible);
|
|
57
|
-
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", {
|
|
69
|
+
const node = withStopPropagation(props.stopPropagation, withNativeProps(props, React.createElement("div", Object.assign({
|
|
58
70
|
className: classPrefix,
|
|
59
71
|
onClick: props.onClick,
|
|
60
72
|
style: {
|
|
61
|
-
display: active ? undefined : 'none'
|
|
73
|
+
display: active ? undefined : 'none',
|
|
74
|
+
touchAction: ['top', 'bottom'].includes(props.position) ? 'none' : 'auto'
|
|
62
75
|
}
|
|
63
|
-
}, props.mask && React.createElement(Mask, {
|
|
76
|
+
}, bind()), props.mask && React.createElement(Mask, {
|
|
64
77
|
visible: maskVisible,
|
|
65
78
|
forceRender: props.forceRender,
|
|
66
79
|
destroyOnClose: props.destroyOnClose,
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import { InputRef, InputProps } from '../input';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type SearchBarRef = InputRef;
|
|
5
|
-
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear'> & {
|
|
5
|
+
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
6
6
|
value?: string;
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
maxLength?: number;
|
|
@@ -17,7 +17,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
|
|
|
17
17
|
onChange?: (val: string) => void;
|
|
18
18
|
onCancel?: () => void;
|
|
19
19
|
} & NativeProps<'--background' | '--border-radius' | '--placeholder-color' | '--height' | '--padding-left'>;
|
|
20
|
-
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onFocus" | "onBlur" | "onClear"> & {
|
|
20
|
+
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onClear"> & {
|
|
21
21
|
value?: string | undefined;
|
|
22
22
|
defaultValue?: string | undefined;
|
|
23
23
|
maxLength?: number | undefined;
|
|
@@ -110,11 +110,15 @@ export const SearchBar = forwardRef((p, ref) => {
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"aria-label": locale.SearchBar.name,
|
|
113
|
-
onCompositionStart:
|
|
113
|
+
onCompositionStart: e => {
|
|
114
|
+
var _a;
|
|
114
115
|
composingRef.current = true;
|
|
116
|
+
(_a = props.onCompositionStart) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
115
117
|
},
|
|
116
|
-
onCompositionEnd:
|
|
118
|
+
onCompositionEnd: e => {
|
|
119
|
+
var _a;
|
|
117
120
|
composingRef.current = false;
|
|
121
|
+
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
118
122
|
}
|
|
119
123
|
})), renderCancelButton()));
|
|
120
124
|
});
|
|
@@ -10,7 +10,7 @@ import PageIndicator from '../page-indicator';
|
|
|
10
10
|
import { staged } from 'staged-components';
|
|
11
11
|
import { useRefState } from '../../utils/use-ref-state';
|
|
12
12
|
import { bound } from '../../utils/bound';
|
|
13
|
-
import { useIsomorphicLayoutEffect
|
|
13
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
14
14
|
import { mergeFuncProps } from '../../utils/with-func-props';
|
|
15
15
|
const classPrefix = `adm-swiper`;
|
|
16
16
|
const eventToPropRecord = {
|
|
@@ -74,10 +74,6 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
74
74
|
return trackPixels * props.slideSize / 100;
|
|
75
75
|
}
|
|
76
76
|
const [current, setCurrent] = useState(props.defaultIndex);
|
|
77
|
-
useUpdateEffect(() => {
|
|
78
|
-
var _a;
|
|
79
|
-
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, current);
|
|
80
|
-
}, [current]);
|
|
81
77
|
const [dragging, setDragging, draggingRef] = useRefState(false);
|
|
82
78
|
function boundIndex(current) {
|
|
83
79
|
let min = 0;
|
|
@@ -172,9 +168,13 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
172
168
|
}
|
|
173
169
|
});
|
|
174
170
|
function swipeTo(index, immediate = false) {
|
|
171
|
+
var _a;
|
|
175
172
|
const roundedIndex = Math.round(index);
|
|
176
173
|
const targetIndex = loop ? modulus(roundedIndex, count) : bound(roundedIndex, 0, count - 1);
|
|
177
174
|
setCurrent(targetIndex);
|
|
175
|
+
if (targetIndex !== current) {
|
|
176
|
+
(_a = props.onIndexChange) === null || _a === void 0 ? void 0 : _a.call(props, targetIndex);
|
|
177
|
+
}
|
|
178
178
|
api.start({
|
|
179
179
|
position: (loop ? roundedIndex : boundIndex(roundedIndex)) * 100,
|
|
180
180
|
immediate
|
|
@@ -219,7 +219,9 @@ export const Swiper = forwardRef(staged((p, ref) => {
|
|
|
219
219
|
className: `${classPrefix}-track-inner`
|
|
220
220
|
}, React.Children.map(validChildren, (child, index) => {
|
|
221
221
|
return React.createElement(animated.div, {
|
|
222
|
-
className: `${classPrefix}-slide`,
|
|
222
|
+
className: classNames(`${classPrefix}-slide`, {
|
|
223
|
+
[`${classPrefix}-slide-active`]: current === index
|
|
224
|
+
}),
|
|
223
225
|
style: {
|
|
224
226
|
[isVertical ? 'y' : 'x']: position.to(position => {
|
|
225
227
|
let finalPosition = -position + index * 100;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
2
|
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
3
|
+
import runes from 'runes2';
|
|
3
4
|
import { withNativeProps } from '../../utils/native-props';
|
|
4
5
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
5
6
|
import { mergeProps } from '../../utils/with-default-props';
|
|
@@ -68,7 +69,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
68
69
|
}, [value, autoSize]);
|
|
69
70
|
const compositingRef = useRef(false);
|
|
70
71
|
let count;
|
|
71
|
-
const valueLength =
|
|
72
|
+
const valueLength = runes(value).length;
|
|
72
73
|
if (typeof showCount === 'function') {
|
|
73
74
|
count = showCount(valueLength, maxLength);
|
|
74
75
|
} else if (showCount) {
|
|
@@ -87,7 +88,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
87
88
|
onChange: e => {
|
|
88
89
|
let v = e.target.value;
|
|
89
90
|
if (maxLength && !compositingRef.current) {
|
|
90
|
-
v =
|
|
91
|
+
v = runes(v).slice(0, maxLength).join('');
|
|
91
92
|
}
|
|
92
93
|
setValue(v);
|
|
93
94
|
},
|
|
@@ -102,7 +103,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
102
103
|
compositingRef.current = false;
|
|
103
104
|
if (maxLength) {
|
|
104
105
|
const v = e.target.value;
|
|
105
|
-
setValue(
|
|
106
|
+
setValue(runes(v).slice(0, maxLength).join(''));
|
|
106
107
|
}
|
|
107
108
|
(_a = props.onCompositionEnd) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
108
109
|
},
|
|
@@ -118,6 +119,7 @@ export const TextArea = forwardRef((p, ref) => {
|
|
|
118
119
|
ref: hiddenTextAreaRef,
|
|
119
120
|
className: `${classPrefix}-element ${classPrefix}-element-hidden`,
|
|
120
121
|
value: value,
|
|
122
|
+
rows: props.rows,
|
|
121
123
|
"aria-hidden": true,
|
|
122
124
|
readOnly: true
|
|
123
125
|
})));
|
|
@@ -83,14 +83,13 @@ export const VirtualInput = forwardRef((p, ref) => {
|
|
|
83
83
|
[`${classPrefix}-disabled`]: props.disabled
|
|
84
84
|
}),
|
|
85
85
|
tabIndex: props.disabled ? undefined : 0,
|
|
86
|
+
role: 'option',
|
|
86
87
|
onFocus: onFocus,
|
|
87
88
|
onBlur: onBlur,
|
|
88
89
|
onClick: props.onClick
|
|
89
90
|
}, React.createElement("div", {
|
|
90
91
|
className: `${classPrefix}-content`,
|
|
91
92
|
ref: contentRef,
|
|
92
|
-
role: 'option',
|
|
93
|
-
tabIndex: props.disabled ? undefined : 0,
|
|
94
93
|
"aria-disabled": props.disabled,
|
|
95
94
|
"aria-label": props.placeholder
|
|
96
95
|
}, value, React.createElement("div", {
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
declare const daDK: {
|
|
2
|
+
locale: string;
|
|
3
|
+
common: {
|
|
4
|
+
confirm: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
loading: string;
|
|
7
|
+
close: string;
|
|
8
|
+
};
|
|
9
|
+
Calendar: {
|
|
10
|
+
markItems: string[];
|
|
11
|
+
renderYearAndMonth: (year: number, month: number) => string;
|
|
12
|
+
};
|
|
13
|
+
Cascader: {
|
|
14
|
+
placeholder: string;
|
|
15
|
+
};
|
|
16
|
+
Dialog: {
|
|
17
|
+
ok: string;
|
|
18
|
+
};
|
|
19
|
+
DatePicker: {
|
|
20
|
+
tillNow: string;
|
|
21
|
+
};
|
|
22
|
+
ErrorBlock: {
|
|
23
|
+
default: {
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
busy: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
disconnected: {
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
empty: {
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
Form: {
|
|
41
|
+
required: string;
|
|
42
|
+
optional: string;
|
|
43
|
+
defaultValidateMessages: {
|
|
44
|
+
default: string;
|
|
45
|
+
required: string;
|
|
46
|
+
enum: string;
|
|
47
|
+
whitespace: string;
|
|
48
|
+
date: {
|
|
49
|
+
format: string;
|
|
50
|
+
parse: string;
|
|
51
|
+
invalid: string;
|
|
52
|
+
};
|
|
53
|
+
types: {
|
|
54
|
+
string: string;
|
|
55
|
+
method: string;
|
|
56
|
+
array: string;
|
|
57
|
+
object: string;
|
|
58
|
+
number: string;
|
|
59
|
+
date: string;
|
|
60
|
+
boolean: string;
|
|
61
|
+
integer: string;
|
|
62
|
+
float: string;
|
|
63
|
+
regexp: string;
|
|
64
|
+
email: string;
|
|
65
|
+
url: string;
|
|
66
|
+
hex: string;
|
|
67
|
+
};
|
|
68
|
+
string: {
|
|
69
|
+
len: string;
|
|
70
|
+
min: string;
|
|
71
|
+
max: string;
|
|
72
|
+
range: string;
|
|
73
|
+
};
|
|
74
|
+
number: {
|
|
75
|
+
len: string;
|
|
76
|
+
min: string;
|
|
77
|
+
max: string;
|
|
78
|
+
range: string;
|
|
79
|
+
};
|
|
80
|
+
array: {
|
|
81
|
+
len: string;
|
|
82
|
+
min: string;
|
|
83
|
+
max: string;
|
|
84
|
+
range: string;
|
|
85
|
+
};
|
|
86
|
+
pattern: {
|
|
87
|
+
mismatch: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
ImageUploader: {
|
|
92
|
+
uploading: string;
|
|
93
|
+
upload: string;
|
|
94
|
+
};
|
|
95
|
+
InfiniteScroll: {
|
|
96
|
+
noMore: string;
|
|
97
|
+
failedToLoad: string;
|
|
98
|
+
retry: string;
|
|
99
|
+
};
|
|
100
|
+
Input: {
|
|
101
|
+
clear: string;
|
|
102
|
+
};
|
|
103
|
+
Mask: {
|
|
104
|
+
name: string;
|
|
105
|
+
};
|
|
106
|
+
Modal: {
|
|
107
|
+
ok: string;
|
|
108
|
+
};
|
|
109
|
+
PasscodeInput: {
|
|
110
|
+
name: string;
|
|
111
|
+
};
|
|
112
|
+
PullToRefresh: {
|
|
113
|
+
pulling: string;
|
|
114
|
+
canRelease: string;
|
|
115
|
+
complete: string;
|
|
116
|
+
};
|
|
117
|
+
SearchBar: {
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
120
|
+
Slider: {
|
|
121
|
+
name: string;
|
|
122
|
+
};
|
|
123
|
+
Stepper: {
|
|
124
|
+
decrease: string;
|
|
125
|
+
increase: string;
|
|
126
|
+
};
|
|
127
|
+
Switch: {
|
|
128
|
+
name: string;
|
|
129
|
+
};
|
|
130
|
+
Selector: {
|
|
131
|
+
name: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export default daDK;
|