antd-mobile 5.35.0 → 5.36.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 +45 -175
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +45 -175
- package/2x/bundle/antd-mobile.es.js +5189 -5319
- package/2x/bundle/antd-mobile.umd.development.js +45 -175
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/cjs/components/button/button.d.ts +2 -2
- package/2x/cjs/components/input/input.d.ts +2 -4
- package/2x/cjs/components/input/input.js +8 -17
- package/2x/cjs/components/input/useInputHandleKeyDown.d.ts +8 -0
- package/2x/cjs/components/input/useInputHandleKeyDown.js +29 -0
- package/2x/cjs/components/result-page/result-page.d.ts +1 -1
- package/2x/cjs/components/swiper/index.d.ts +1 -1
- package/2x/cjs/components/swiper/swiper.d.ts +2 -2
- package/2x/cjs/components/swiper/swiper.js +5 -1
- package/2x/cjs/components/text-area/text-area.d.ts +6 -2
- package/2x/cjs/components/text-area/text-area.js +9 -1
- package/2x/cjs/locales/ar-SA.d.ts +139 -0
- package/2x/cjs/locales/ar-SA.js +149 -0
- package/2x/cjs/locales/de-DE.d.ts +139 -0
- package/2x/cjs/locales/de-DE.js +149 -0
- package/2x/cjs/locales/ms-MY.d.ts +139 -0
- package/2x/cjs/locales/ms-MY.js +149 -0
- package/2x/cjs/locales/pt-BR.d.ts +139 -0
- package/2x/cjs/locales/pt-BR.js +144 -0
- package/2x/cjs/locales/vi-VN.d.ts +139 -0
- package/2x/cjs/locales/vi-VN.js +149 -0
- package/2x/cjs/locales/zh-CN.d.ts +2 -138
- package/2x/cjs/locales/zh-CN.js +2 -4
- package/2x/cjs/locales/zh-CN.test.d.ts +1 -0
- package/2x/cjs/locales/zh-CN.test.js +19 -0
- package/2x/es/components/button/button.d.ts +2 -2
- package/2x/es/components/input/input.d.ts +2 -4
- package/2x/es/components/input/input.js +8 -17
- package/2x/es/components/input/useInputHandleKeyDown.d.ts +8 -0
- package/2x/es/components/input/useInputHandleKeyDown.js +23 -0
- package/2x/es/components/result-page/result-page.d.ts +1 -1
- package/2x/es/components/swiper/index.d.ts +1 -1
- package/2x/es/components/swiper/swiper.d.ts +2 -2
- package/2x/es/components/swiper/swiper.js +5 -1
- package/2x/es/components/text-area/text-area.d.ts +6 -2
- package/2x/es/components/text-area/text-area.js +9 -1
- package/2x/es/locales/ar-SA.d.ts +139 -0
- package/2x/es/locales/ar-SA.js +142 -0
- package/2x/es/locales/de-DE.d.ts +139 -0
- package/2x/es/locales/de-DE.js +142 -0
- package/2x/es/locales/ms-MY.d.ts +139 -0
- package/2x/es/locales/ms-MY.js +142 -0
- package/2x/es/locales/pt-BR.d.ts +139 -0
- package/2x/es/locales/pt-BR.js +137 -0
- package/2x/es/locales/vi-VN.d.ts +139 -0
- package/2x/es/locales/vi-VN.js +142 -0
- package/2x/es/locales/zh-CN.d.ts +2 -138
- package/2x/es/locales/zh-CN.js +2 -4
- package/2x/es/locales/zh-CN.test.d.ts +1 -0
- package/2x/es/locales/zh-CN.test.js +16 -0
- package/2x/package.json +29 -20
- package/bundle/antd-mobile.cjs.development.js +45 -175
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +45 -175
- package/bundle/antd-mobile.es.js +5189 -5319
- package/bundle/antd-mobile.umd.development.js +45 -175
- package/bundle/antd-mobile.umd.js +7 -7
- package/cjs/components/button/button.d.ts +2 -2
- package/cjs/components/input/input.d.ts +2 -4
- package/cjs/components/input/input.js +8 -17
- package/cjs/components/input/useInputHandleKeyDown.d.ts +8 -0
- package/cjs/components/input/useInputHandleKeyDown.js +29 -0
- package/cjs/components/result-page/result-page.d.ts +1 -1
- package/cjs/components/swiper/index.d.ts +1 -1
- package/cjs/components/swiper/swiper.d.ts +2 -2
- package/cjs/components/swiper/swiper.js +5 -1
- package/cjs/components/text-area/text-area.d.ts +6 -2
- package/cjs/components/text-area/text-area.js +9 -1
- package/cjs/locales/ar-SA.d.ts +139 -0
- package/cjs/locales/ar-SA.js +149 -0
- package/cjs/locales/de-DE.d.ts +139 -0
- package/cjs/locales/de-DE.js +149 -0
- package/cjs/locales/ms-MY.d.ts +139 -0
- package/cjs/locales/ms-MY.js +149 -0
- package/cjs/locales/pt-BR.d.ts +139 -0
- package/cjs/locales/pt-BR.js +144 -0
- package/cjs/locales/vi-VN.d.ts +139 -0
- package/cjs/locales/vi-VN.js +149 -0
- package/cjs/locales/zh-CN.d.ts +2 -138
- package/cjs/locales/zh-CN.js +2 -4
- package/cjs/locales/zh-CN.test.d.ts +1 -0
- package/cjs/locales/zh-CN.test.js +19 -0
- package/es/components/button/button.d.ts +2 -2
- package/es/components/input/input.d.ts +2 -4
- package/es/components/input/input.js +8 -17
- package/es/components/input/useInputHandleKeyDown.d.ts +8 -0
- package/es/components/input/useInputHandleKeyDown.js +23 -0
- package/es/components/result-page/result-page.d.ts +1 -1
- package/es/components/swiper/index.d.ts +1 -1
- package/es/components/swiper/swiper.d.ts +2 -2
- package/es/components/swiper/swiper.js +5 -1
- package/es/components/text-area/text-area.d.ts +6 -2
- package/es/components/text-area/text-area.js +9 -1
- package/es/locales/ar-SA.d.ts +139 -0
- package/es/locales/ar-SA.js +142 -0
- package/es/locales/de-DE.d.ts +139 -0
- package/es/locales/de-DE.js +142 -0
- package/es/locales/ms-MY.d.ts +139 -0
- package/es/locales/ms-MY.js +142 -0
- package/es/locales/pt-BR.d.ts +139 -0
- package/es/locales/pt-BR.js +137 -0
- package/es/locales/vi-VN.d.ts +139 -0
- package/es/locales/vi-VN.js +142 -0
- package/es/locales/zh-CN.d.ts +2 -138
- package/es/locales/zh-CN.js +2 -4
- package/es/locales/zh-CN.test.d.ts +1 -0
- package/es/locales/zh-CN.test.js +16 -0
- package/package.json +29 -20
- package/umd/antd-mobile.js +1 -1
|
@@ -11,7 +11,7 @@ export declare type ButtonProps = {
|
|
|
11
11
|
loadingText?: string;
|
|
12
12
|
loadingIcon?: ReactNode;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void
|
|
14
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
|
|
15
15
|
type?: 'submit' | 'reset' | 'button';
|
|
16
16
|
shape?: 'default' | 'rounded' | 'rectangular';
|
|
17
17
|
children?: ReactNode;
|
|
@@ -28,7 +28,7 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
28
28
|
loadingText?: string | undefined;
|
|
29
29
|
loadingIcon?: ReactNode;
|
|
30
30
|
disabled?: boolean | undefined;
|
|
31
|
-
onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>
|
|
31
|
+
onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
|
|
32
32
|
type?: "reset" | "submit" | "button" | undefined;
|
|
33
33
|
shape?: "default" | "rounded" | "rectangular" | undefined;
|
|
34
34
|
children?: ReactNode;
|
|
@@ -4,7 +4,7 @@ declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttribute
|
|
|
4
4
|
declare type AriaProps = {
|
|
5
5
|
role?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'step' | 'id' | 'placeholder' | 'readOnly' | 'disabled'> & {
|
|
7
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'step' | 'id' | 'placeholder' | 'readOnly' | 'disabled' | 'enterKeyHint'> & {
|
|
8
8
|
value?: string;
|
|
9
9
|
defaultValue?: string;
|
|
10
10
|
onChange?: (val: string) => void;
|
|
@@ -12,7 +12,6 @@ export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength
|
|
|
12
12
|
onlyShowClearWhenFocus?: boolean;
|
|
13
13
|
onClear?: () => void;
|
|
14
14
|
onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
|
-
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
16
15
|
min?: number;
|
|
17
16
|
max?: number;
|
|
18
17
|
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--text-align'> & AriaProps;
|
|
@@ -22,7 +21,7 @@ export declare type InputRef = {
|
|
|
22
21
|
blur: () => void;
|
|
23
22
|
nativeElement: HTMLInputElement | null;
|
|
24
23
|
};
|
|
25
|
-
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "type" | "step" | "autoFocus" | "placeholder" | "autoCapitalize" | "autoCorrect" | "inputMode" | "name" | "readOnly" | "autoComplete" | "maxLength" | "minLength"> & {
|
|
24
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "type" | "step" | "autoFocus" | "placeholder" | "autoCapitalize" | "autoCorrect" | "inputMode" | "name" | "readOnly" | "autoComplete" | "enterKeyHint" | "maxLength" | "minLength"> & {
|
|
26
25
|
value?: string | undefined;
|
|
27
26
|
defaultValue?: string | undefined;
|
|
28
27
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -30,7 +29,6 @@ export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProp
|
|
|
30
29
|
onlyShowClearWhenFocus?: boolean | undefined;
|
|
31
30
|
onClear?: (() => void) | undefined;
|
|
32
31
|
onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
|
|
33
|
-
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
34
32
|
min?: number | undefined;
|
|
35
33
|
max?: number | undefined;
|
|
36
34
|
} & {
|
|
@@ -10,10 +10,10 @@ var _antdMobileIcons = require("antd-mobile-icons");
|
|
|
10
10
|
var _nativeProps = require("../../utils/native-props");
|
|
11
11
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
var _ahooks = require("ahooks");
|
|
14
13
|
var _bound = require("../../utils/bound");
|
|
15
14
|
var _validate = require("../../utils/validate");
|
|
16
15
|
var _configProvider = require("../config-provider");
|
|
16
|
+
var _useInputHandleKeyDown = _interopRequireDefault(require("./useInputHandleKeyDown"));
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
19
|
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; }
|
|
@@ -31,6 +31,12 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
31
31
|
const {
|
|
32
32
|
locale
|
|
33
33
|
} = (0, _configProvider.useConfig)();
|
|
34
|
+
const handleKeydown = (0, _useInputHandleKeyDown.default)({
|
|
35
|
+
onEnterPress: props.onEnterPress,
|
|
36
|
+
onKeyDown: props.onKeyDown,
|
|
37
|
+
nativeInputRef,
|
|
38
|
+
enterKeyHint: props.enterKeyHint
|
|
39
|
+
});
|
|
34
40
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
35
41
|
clear: () => {
|
|
36
42
|
setValue('');
|
|
@@ -47,22 +53,6 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
47
53
|
return nativeInputRef.current;
|
|
48
54
|
}
|
|
49
55
|
}));
|
|
50
|
-
const handleKeydown = e => {
|
|
51
|
-
var _a;
|
|
52
|
-
if (props.onEnterPress && (e.code === 'Enter' || e.keyCode === 13)) {
|
|
53
|
-
props.onEnterPress(e);
|
|
54
|
-
}
|
|
55
|
-
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
56
|
-
};
|
|
57
|
-
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
58
|
-
var _a;
|
|
59
|
-
if (!props.enterKeyHint) return;
|
|
60
|
-
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute('enterkeyhint', props.enterKeyHint);
|
|
61
|
-
return () => {
|
|
62
|
-
var _a;
|
|
63
|
-
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('enterkeyhint');
|
|
64
|
-
};
|
|
65
|
-
}, [props.enterKeyHint]);
|
|
66
56
|
function checkValue() {
|
|
67
57
|
let nextValue = value;
|
|
68
58
|
if (props.type === 'number') {
|
|
@@ -113,6 +103,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
113
103
|
max: props.max,
|
|
114
104
|
min: props.min,
|
|
115
105
|
autoComplete: props.autoComplete,
|
|
106
|
+
enterKeyHint: props.enterKeyHint,
|
|
116
107
|
autoFocus: props.autoFocus,
|
|
117
108
|
pattern: props.pattern,
|
|
118
109
|
inputMode: props.inputMode,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface InputHandleKeyDownType<T> {
|
|
2
|
+
onEnterPress?: (e: React.KeyboardEvent<T>) => void;
|
|
3
|
+
onKeyDown?: (e: React.KeyboardEvent<T>) => void;
|
|
4
|
+
enterKeyHint?: React.InputHTMLAttributes<HTMLInputElement>['enterKeyHint'];
|
|
5
|
+
nativeInputRef: React.RefObject<T>;
|
|
6
|
+
}
|
|
7
|
+
export default function useInputHandleKeyDown<T extends HTMLInputElement | HTMLTextAreaElement>({ onEnterPress, onKeyDown, nativeInputRef, enterKeyHint, }: InputHandleKeyDownType<T>): (e: React.KeyboardEvent<T>) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useInputHandleKeyDown;
|
|
7
|
+
var _ahooks = require("ahooks");
|
|
8
|
+
function useInputHandleKeyDown({
|
|
9
|
+
onEnterPress,
|
|
10
|
+
onKeyDown,
|
|
11
|
+
nativeInputRef,
|
|
12
|
+
enterKeyHint
|
|
13
|
+
}) {
|
|
14
|
+
const handleKeydown = e => {
|
|
15
|
+
if (onEnterPress && (e.code === 'Enter' || e.keyCode === 13)) {
|
|
16
|
+
onEnterPress(e);
|
|
17
|
+
}
|
|
18
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
19
|
+
};
|
|
20
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
21
|
+
const ele = nativeInputRef.current;
|
|
22
|
+
if (!enterKeyHint || !ele) return;
|
|
23
|
+
ele.setAttribute('enterkeyhint', enterKeyHint);
|
|
24
|
+
return () => {
|
|
25
|
+
ele.removeAttribute('enterkeyhint');
|
|
26
|
+
};
|
|
27
|
+
}, [enterKeyHint]);
|
|
28
|
+
return handleKeydown;
|
|
29
|
+
}
|
|
@@ -7,7 +7,7 @@ interface ResultPageDetail {
|
|
|
7
7
|
bold?: boolean;
|
|
8
8
|
}
|
|
9
9
|
declare type ResultPageDetails = ResultPageDetail[];
|
|
10
|
-
declare type OnClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void
|
|
10
|
+
declare type OnClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
|
|
11
11
|
export declare type ResultPageProps = {
|
|
12
12
|
status?: 'success' | 'error' | 'info' | 'waiting' | 'warning';
|
|
13
13
|
title: ReactNode;
|
|
@@ -3,7 +3,7 @@ export type { SwiperProps, SwiperRef } from './swiper';
|
|
|
3
3
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
4
4
|
defaultIndex?: number | undefined;
|
|
5
5
|
allowTouchMove?: boolean | undefined;
|
|
6
|
-
autoplay?: boolean | undefined;
|
|
6
|
+
autoplay?: boolean | "reverse" | undefined;
|
|
7
7
|
autoplayInterval?: number | undefined;
|
|
8
8
|
loop?: boolean | undefined;
|
|
9
9
|
direction?: "vertical" | "horizontal" | undefined;
|
|
@@ -16,7 +16,7 @@ export declare type SwiperRef = {
|
|
|
16
16
|
export declare type SwiperProps = {
|
|
17
17
|
defaultIndex?: number;
|
|
18
18
|
allowTouchMove?: boolean;
|
|
19
|
-
autoplay?: boolean;
|
|
19
|
+
autoplay?: boolean | 'reverse';
|
|
20
20
|
autoplayInterval?: number;
|
|
21
21
|
loop?: boolean;
|
|
22
22
|
direction?: 'horizontal' | 'vertical';
|
|
@@ -40,7 +40,7 @@ export declare type SwiperProps = {
|
|
|
40
40
|
export declare const Swiper: React.ForwardRefExoticComponent<{
|
|
41
41
|
defaultIndex?: number | undefined;
|
|
42
42
|
allowTouchMove?: boolean | undefined;
|
|
43
|
-
autoplay?: boolean | undefined;
|
|
43
|
+
autoplay?: boolean | "reverse" | undefined;
|
|
44
44
|
autoplayInterval?: number | undefined;
|
|
45
45
|
loop?: boolean | undefined;
|
|
46
46
|
direction?: "vertical" | "horizontal" | undefined;
|
|
@@ -228,7 +228,11 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
228
228
|
} = props;
|
|
229
229
|
const runTimeSwiper = () => {
|
|
230
230
|
timeoutRef.current = window.setTimeout(() => {
|
|
231
|
-
|
|
231
|
+
if (autoplay === 'reverse') {
|
|
232
|
+
swipePrev();
|
|
233
|
+
} else {
|
|
234
|
+
swipeNext();
|
|
235
|
+
}
|
|
232
236
|
runTimeSwiper();
|
|
233
237
|
}, autoplayInterval);
|
|
234
238
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
|
-
export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'autoComplete' | 'autoFocus' | 'disabled' | 'readOnly' | 'name' | 'onFocus' | 'onBlur' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick'> & {
|
|
4
|
+
export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'autoComplete' | 'autoFocus' | 'disabled' | 'readOnly' | 'name' | 'onFocus' | 'onBlur' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'onKeyDown'> & {
|
|
5
5
|
onChange?: (val: string) => void;
|
|
6
6
|
value?: string;
|
|
7
7
|
defaultValue?: string;
|
|
@@ -14,6 +14,8 @@ export declare type TextAreaProps = Pick<React.DetailedHTMLProps<React.TextareaH
|
|
|
14
14
|
maxRows?: number;
|
|
15
15
|
};
|
|
16
16
|
id?: string;
|
|
17
|
+
onEnterPress?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
18
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
17
19
|
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--disabled-color' | '--text-align' | '--count-text-align'>;
|
|
18
20
|
export declare type TextAreaRef = {
|
|
19
21
|
clear: () => void;
|
|
@@ -21,7 +23,7 @@ export declare type TextAreaRef = {
|
|
|
21
23
|
blur: () => void;
|
|
22
24
|
nativeElement: HTMLTextAreaElement | null;
|
|
23
25
|
};
|
|
24
|
-
export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "onClick" | "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoFocus" | "name" | "readOnly" | "autoComplete"> & {
|
|
26
|
+
export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "onClick" | "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "autoFocus" | "name" | "readOnly" | "autoComplete"> & {
|
|
25
27
|
onChange?: ((val: string) => void) | undefined;
|
|
26
28
|
value?: string | undefined;
|
|
27
29
|
defaultValue?: string | undefined;
|
|
@@ -34,6 +36,8 @@ export declare const TextArea: React.ForwardRefExoticComponent<Pick<React.Detail
|
|
|
34
36
|
maxRows?: number | undefined;
|
|
35
37
|
} | undefined;
|
|
36
38
|
id?: string | undefined;
|
|
39
|
+
onEnterPress?: ((e: React.KeyboardEvent<HTMLTextAreaElement>) => void) | undefined;
|
|
40
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
|
|
37
41
|
} & {
|
|
38
42
|
className?: string | undefined;
|
|
39
43
|
style?: (React.CSSProperties & Partial<Record<"--color" | "--font-size" | "--placeholder-color" | "--text-align" | "--disabled-color" | "--count-text-align", string>>) | undefined;
|
|
@@ -11,6 +11,7 @@ var _nativeProps = require("../../utils/native-props");
|
|
|
11
11
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
12
12
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
13
13
|
var _devLog = require("../../utils/dev-log");
|
|
14
|
+
var _useInputHandleKeyDown = _interopRequireDefault(require("../../components/input/useInputHandleKeyDown"));
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
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; }
|
|
@@ -39,6 +40,12 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
39
40
|
const heightRef = (0, _react.useRef)('auto');
|
|
40
41
|
// https://github.com/ant-design/ant-design-mobile/issues/6051
|
|
41
42
|
const hiddenTextAreaRef = (0, _react.useRef)(null);
|
|
43
|
+
const handleKeydown = (0, _useInputHandleKeyDown.default)({
|
|
44
|
+
onEnterPress: props.onEnterPress,
|
|
45
|
+
onKeyDown: props.onKeyDown,
|
|
46
|
+
nativeInputRef: nativeTextAreaRef,
|
|
47
|
+
enterKeyHint: props.enterKeyHint
|
|
48
|
+
});
|
|
42
49
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
43
50
|
clear: () => {
|
|
44
51
|
setValue('');
|
|
@@ -132,7 +139,8 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
132
139
|
name: props.name,
|
|
133
140
|
onFocus: props.onFocus,
|
|
134
141
|
onBlur: props.onBlur,
|
|
135
|
-
onClick: props.onClick
|
|
142
|
+
onClick: props.onClick,
|
|
143
|
+
onKeyDown: handleKeydown
|
|
136
144
|
}), count, autoSize && _react.default.createElement("textarea", {
|
|
137
145
|
ref: hiddenTextAreaRef,
|
|
138
146
|
className: `${classPrefix}-element ${classPrefix}-element-hidden`,
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
declare const arSA: {
|
|
2
|
+
locale: string;
|
|
3
|
+
common: {
|
|
4
|
+
confirm: string;
|
|
5
|
+
cancel: string;
|
|
6
|
+
loading: string;
|
|
7
|
+
close: string;
|
|
8
|
+
};
|
|
9
|
+
Calendar: {
|
|
10
|
+
title: string;
|
|
11
|
+
confirm: string;
|
|
12
|
+
start: string;
|
|
13
|
+
end: string;
|
|
14
|
+
today: string;
|
|
15
|
+
markItems: string[];
|
|
16
|
+
yearAndMonth: string;
|
|
17
|
+
};
|
|
18
|
+
Cascader: {
|
|
19
|
+
placeholder: string;
|
|
20
|
+
};
|
|
21
|
+
Dialog: {
|
|
22
|
+
ok: string;
|
|
23
|
+
};
|
|
24
|
+
DatePicker: {
|
|
25
|
+
tillNow: string;
|
|
26
|
+
};
|
|
27
|
+
ErrorBlock: {
|
|
28
|
+
default: {
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
busy: {
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
disconnected: {
|
|
37
|
+
title: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
empty: {
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
Form: {
|
|
46
|
+
required: string;
|
|
47
|
+
optional: string;
|
|
48
|
+
defaultValidateMessages: {
|
|
49
|
+
default: string;
|
|
50
|
+
required: string;
|
|
51
|
+
enum: string;
|
|
52
|
+
whitespace: string;
|
|
53
|
+
date: {
|
|
54
|
+
format: string;
|
|
55
|
+
parse: string;
|
|
56
|
+
invalid: string;
|
|
57
|
+
};
|
|
58
|
+
types: {
|
|
59
|
+
string: string;
|
|
60
|
+
method: string;
|
|
61
|
+
array: string;
|
|
62
|
+
object: string;
|
|
63
|
+
number: string;
|
|
64
|
+
date: string;
|
|
65
|
+
boolean: string;
|
|
66
|
+
integer: string;
|
|
67
|
+
float: string;
|
|
68
|
+
regexp: string;
|
|
69
|
+
email: string;
|
|
70
|
+
url: string;
|
|
71
|
+
hex: string;
|
|
72
|
+
};
|
|
73
|
+
string: {
|
|
74
|
+
len: string;
|
|
75
|
+
min: string;
|
|
76
|
+
max: string;
|
|
77
|
+
range: string;
|
|
78
|
+
};
|
|
79
|
+
number: {
|
|
80
|
+
len: string;
|
|
81
|
+
min: string;
|
|
82
|
+
max: string;
|
|
83
|
+
range: string;
|
|
84
|
+
};
|
|
85
|
+
array: {
|
|
86
|
+
len: string;
|
|
87
|
+
min: string;
|
|
88
|
+
max: string;
|
|
89
|
+
range: string;
|
|
90
|
+
};
|
|
91
|
+
pattern: {
|
|
92
|
+
mismatch: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
ImageUploader: {
|
|
97
|
+
uploading: string;
|
|
98
|
+
upload: string;
|
|
99
|
+
};
|
|
100
|
+
InfiniteScroll: {
|
|
101
|
+
noMore: string;
|
|
102
|
+
failedToLoad: string;
|
|
103
|
+
retry: string;
|
|
104
|
+
};
|
|
105
|
+
Input: {
|
|
106
|
+
clear: string;
|
|
107
|
+
};
|
|
108
|
+
Mask: {
|
|
109
|
+
name: string;
|
|
110
|
+
};
|
|
111
|
+
Modal: {
|
|
112
|
+
ok: string;
|
|
113
|
+
};
|
|
114
|
+
PasscodeInput: {
|
|
115
|
+
name: string;
|
|
116
|
+
};
|
|
117
|
+
PullToRefresh: {
|
|
118
|
+
pulling: string;
|
|
119
|
+
canRelease: string;
|
|
120
|
+
complete: string;
|
|
121
|
+
};
|
|
122
|
+
SearchBar: {
|
|
123
|
+
name: string;
|
|
124
|
+
};
|
|
125
|
+
Slider: {
|
|
126
|
+
name: string;
|
|
127
|
+
};
|
|
128
|
+
Stepper: {
|
|
129
|
+
decrease: string;
|
|
130
|
+
increase: string;
|
|
131
|
+
};
|
|
132
|
+
Switch: {
|
|
133
|
+
name: string;
|
|
134
|
+
};
|
|
135
|
+
Selector: {
|
|
136
|
+
name: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export default arSA;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _mergeLocale = require("../utils/merge-locale");
|
|
8
|
+
var _base = require("./base");
|
|
9
|
+
const typeTemplate = '${label} غير صالح ${type}';
|
|
10
|
+
const arSA = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
11
|
+
'locale': 'ar-SA',
|
|
12
|
+
'common': {
|
|
13
|
+
'confirm': 'نعم',
|
|
14
|
+
'cancel': 'إلغاء',
|
|
15
|
+
'loading': 'جار التحميل',
|
|
16
|
+
'close': 'إغلاق'
|
|
17
|
+
},
|
|
18
|
+
'Calendar': {
|
|
19
|
+
'title': 'اختيار التاريخ',
|
|
20
|
+
'confirm': 'تأكيد',
|
|
21
|
+
'start': 'يبدأ',
|
|
22
|
+
'end': 'ينهي',
|
|
23
|
+
'today': 'اليوم',
|
|
24
|
+
'markItems': ['واحد', 'اثنين', 'ثلاثة', 'أربعة', 'خمسة', 'ستة', 'يوم'],
|
|
25
|
+
'yearAndMonth': '${year} سنة ${month} شهر'
|
|
26
|
+
},
|
|
27
|
+
'Cascader': {
|
|
28
|
+
'placeholder': 'اختر من فضلك'
|
|
29
|
+
},
|
|
30
|
+
'Dialog': {
|
|
31
|
+
'ok': 'عرفت'
|
|
32
|
+
},
|
|
33
|
+
'DatePicker': {
|
|
34
|
+
'tillNow': 'إلى اليوم'
|
|
35
|
+
},
|
|
36
|
+
'ErrorBlock': {
|
|
37
|
+
'default': {
|
|
38
|
+
'title': 'تواجه الصفحة بعض المشكلات البسيطة',
|
|
39
|
+
'description': 'حاول لاحقًا'
|
|
40
|
+
},
|
|
41
|
+
'busy': {
|
|
42
|
+
'title': 'الازدحام في الأمام',
|
|
43
|
+
'description': 'حاول التجديد'
|
|
44
|
+
},
|
|
45
|
+
'disconnected': {
|
|
46
|
+
'title': 'شبكة مشغولة',
|
|
47
|
+
'description': 'مرر أصابعك وساعد ف الإصلاح'
|
|
48
|
+
},
|
|
49
|
+
'empty': {
|
|
50
|
+
'title': 'لم أتمكن من العثور على ما تحتاجه',
|
|
51
|
+
'description': 'البحث عن شيء آخر'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
'Form': {
|
|
55
|
+
'required': 'مطلوب',
|
|
56
|
+
'optional': 'اختياري',
|
|
57
|
+
'defaultValidateMessages': {
|
|
58
|
+
'default': 'خطأ في التحقق من صحة الكلمات ${label}',
|
|
59
|
+
'required': 'يرجى إدخال ${label}',
|
|
60
|
+
'enum': '${label} يجب أن يكون واحدًا منهم [ ${enum} ]',
|
|
61
|
+
'whitespace': '${label} لا يمكن أن يكون حرفًا فارغًا',
|
|
62
|
+
'date': {
|
|
63
|
+
'format': '${label} تنسيق التاريخ غير صالح',
|
|
64
|
+
'parse': '${label} لا يمكن تحويله إلى تاريخ',
|
|
65
|
+
'invalid': '${label} تاريخ غير صالح'
|
|
66
|
+
},
|
|
67
|
+
'types': {
|
|
68
|
+
'string': typeTemplate,
|
|
69
|
+
'method': typeTemplate,
|
|
70
|
+
'array': typeTemplate,
|
|
71
|
+
'object': typeTemplate,
|
|
72
|
+
'number': typeTemplate,
|
|
73
|
+
'date': typeTemplate,
|
|
74
|
+
'boolean': typeTemplate,
|
|
75
|
+
'integer': typeTemplate,
|
|
76
|
+
'float': typeTemplate,
|
|
77
|
+
'regexp': typeTemplate,
|
|
78
|
+
'email': typeTemplate,
|
|
79
|
+
'url': typeTemplate,
|
|
80
|
+
'hex': typeTemplate
|
|
81
|
+
},
|
|
82
|
+
'string': {
|
|
83
|
+
'len': '${label} يجب أن يكون عدد الأحرف ${len}',
|
|
84
|
+
'min': '${label} أحرف على الأقل ${min}',
|
|
85
|
+
'max': '${label} الحد الأقصى لعدد الأحرف ${max}',
|
|
86
|
+
'range': '${label} يجب أن يكون بين ${min} - ${max} حرفًا'
|
|
87
|
+
},
|
|
88
|
+
'number': {
|
|
89
|
+
'len': '${label} يجب أن يساوي ${len}',
|
|
90
|
+
'min': '${label}الحد الأدنى للقيمة هو ${min}',
|
|
91
|
+
'max': '${label}القيمة القصوى هي ${max}',
|
|
92
|
+
'range': '${label} يجب أن يكون بين ${min} - ${max}'
|
|
93
|
+
},
|
|
94
|
+
'array': {
|
|
95
|
+
'len': 'يجب أن يكون ${len} ${label}',
|
|
96
|
+
'min': 'على الأقل ${min} ${label}',
|
|
97
|
+
'max': 'الحد الأقصى ${max} ${label}',
|
|
98
|
+
'range': '${label} يجب أن تكون الكمية بين ${min} - ${max}'
|
|
99
|
+
},
|
|
100
|
+
'pattern': {
|
|
101
|
+
'mismatch': '${label} لا يتطابق مع النمط ${pattern}'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
'ImageUploader': {
|
|
106
|
+
'uploading': 'جارٍ التحميل...',
|
|
107
|
+
'upload': 'تحميل'
|
|
108
|
+
},
|
|
109
|
+
'InfiniteScroll': {
|
|
110
|
+
'noMore': '-لا يوجد أكثر-',
|
|
111
|
+
'failedToLoad': 'فشل التحميل',
|
|
112
|
+
'retry': 'إعادة التحميل'
|
|
113
|
+
},
|
|
114
|
+
'Input': {
|
|
115
|
+
'clear': 'إزالة'
|
|
116
|
+
},
|
|
117
|
+
'Mask': {
|
|
118
|
+
'name': 'قناع الخلفية'
|
|
119
|
+
},
|
|
120
|
+
'Modal': {
|
|
121
|
+
'ok': 'عرفت'
|
|
122
|
+
},
|
|
123
|
+
'PasscodeInput': {
|
|
124
|
+
'name': 'مربع إدخال كلمة المرور'
|
|
125
|
+
},
|
|
126
|
+
'PullToRefresh': {
|
|
127
|
+
'pulling': 'اسحب إلى الأسفل للتحديث',
|
|
128
|
+
'canRelease': 'حرر للتحديث على الفور',
|
|
129
|
+
'complete': 'تم التحديث بنجاح'
|
|
130
|
+
},
|
|
131
|
+
'SearchBar': {
|
|
132
|
+
'name': 'شريط البحث'
|
|
133
|
+
},
|
|
134
|
+
'Slider': {
|
|
135
|
+
'name': 'شريط الإدخال المنزلق'
|
|
136
|
+
},
|
|
137
|
+
'Stepper': {
|
|
138
|
+
'decrease': 'يقلل',
|
|
139
|
+
'increase': 'يزيد'
|
|
140
|
+
},
|
|
141
|
+
'Switch': {
|
|
142
|
+
'name': 'زر الفتح والإغلاق'
|
|
143
|
+
},
|
|
144
|
+
'Selector': {
|
|
145
|
+
'name': 'اختر مجموعة'
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var _default = arSA;
|
|
149
|
+
exports.default = _default;
|