antd-mobile 5.28.0 → 5.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/bundle/antd-mobile.cjs.development.js +341 -284
- package/2x/bundle/antd-mobile.cjs.js +10 -9
- package/2x/bundle/antd-mobile.es.development.js +341 -284
- package/2x/bundle/antd-mobile.es.js +4969 -4923
- package/2x/bundle/antd-mobile.umd.development.js +341 -284
- package/2x/bundle/antd-mobile.umd.js +10 -9
- package/2x/bundle/css-vars-patch.css +1 -0
- package/2x/bundle/style.css +9 -2
- package/2x/cjs/components/ellipsis/ellipsis.d.ts +1 -0
- package/2x/cjs/components/ellipsis/ellipsis.js +3 -2
- package/2x/cjs/components/nav-bar/nav-bar.d.ts +2 -2
- package/2x/cjs/components/popover/popover.css +1 -1
- package/2x/cjs/components/popover/popover.patch.css +1 -0
- package/2x/cjs/components/popup/popup.js +7 -1
- package/2x/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
- package/2x/cjs/components/stepper/index.d.ts +1 -1
- package/2x/cjs/components/stepper/stepper.d.ts +4 -2
- package/2x/cjs/components/stepper/stepper.js +21 -3
- package/2x/cjs/components/steps/steps.css +0 -1
- package/2x/cjs/components/swiper/swiper.js +6 -3
- package/2x/cjs/components/text-area/text-area.css +8 -0
- package/2x/cjs/components/text-area/text-area.js +16 -3
- package/2x/cjs/global/css-vars-patch.css +1 -0
- package/2x/cjs/index.d.ts +1 -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/fr-FR.d.ts +1 -0
- package/2x/cjs/locales/id-ID.d.ts +1 -0
- package/2x/cjs/locales/ja-JP.d.ts +1 -0
- package/2x/cjs/locales/kk-KZ.d.ts +1 -0
- package/2x/cjs/locales/ko-KR.d.ts +1 -0
- package/2x/cjs/locales/ko-KR.js +31 -2
- 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-HK.js +2 -1
- package/2x/cjs/locales/zh-TW.d.ts +1 -0
- package/2x/cjs/locales/zh-TW.js +2 -1
- package/2x/cjs/utils/reduce-and-restore-motion.js +7 -6
- package/2x/cjs/utils/render-imperatively.js +9 -3
- package/2x/es/components/ellipsis/ellipsis.d.ts +1 -0
- package/2x/es/components/ellipsis/ellipsis.js +3 -2
- package/2x/es/components/nav-bar/nav-bar.d.ts +2 -2
- package/2x/es/components/popover/popover.css +1 -1
- package/2x/es/components/popover/popover.patch.css +1 -0
- package/2x/es/components/popup/popup.js +7 -1
- package/2x/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
- package/2x/es/components/stepper/index.d.ts +1 -1
- package/2x/es/components/stepper/stepper.d.ts +4 -2
- package/2x/es/components/stepper/stepper.js +19 -3
- package/2x/es/components/steps/steps.css +0 -1
- package/2x/es/components/swiper/swiper.js +6 -3
- package/2x/es/components/text-area/text-area.css +8 -0
- package/2x/es/components/text-area/text-area.js +16 -3
- package/2x/es/global/css-vars-patch.css +1 -0
- package/2x/es/index.d.ts +1 -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/fr-FR.d.ts +1 -0
- package/2x/es/locales/id-ID.d.ts +1 -0
- package/2x/es/locales/ja-JP.d.ts +1 -0
- package/2x/es/locales/kk-KZ.d.ts +1 -0
- package/2x/es/locales/ko-KR.d.ts +1 -0
- package/2x/es/locales/ko-KR.js +31 -2
- 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-HK.js +2 -1
- package/2x/es/locales/zh-TW.d.ts +1 -0
- package/2x/es/locales/zh-TW.js +2 -1
- package/2x/es/utils/reduce-and-restore-motion.js +7 -6
- package/2x/es/utils/render-imperatively.js +9 -3
- package/2x/package.json +3 -3
- package/bundle/antd-mobile.cjs.development.js +341 -284
- package/bundle/antd-mobile.cjs.js +10 -9
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +341 -284
- package/bundle/antd-mobile.es.js +4969 -4923
- package/bundle/antd-mobile.umd.development.js +341 -284
- package/bundle/antd-mobile.umd.js +10 -9
- package/bundle/css-vars-patch.css +1 -0
- package/bundle/style.css +1 -1
- package/cjs/components/ellipsis/ellipsis.d.ts +1 -0
- package/cjs/components/ellipsis/ellipsis.js +3 -2
- package/cjs/components/nav-bar/nav-bar.d.ts +2 -2
- package/cjs/components/popover/popover.css +1 -1
- package/cjs/components/popover/popover.patch.css +1 -0
- package/cjs/components/popup/popup.js +7 -1
- package/cjs/components/pull-to-refresh/pull-to-refresh.js +15 -16
- package/cjs/components/stepper/index.d.ts +1 -1
- package/cjs/components/stepper/stepper.d.ts +4 -2
- package/cjs/components/stepper/stepper.js +21 -3
- package/cjs/components/steps/steps.css +0 -1
- package/cjs/components/swiper/swiper.js +6 -3
- package/cjs/components/text-area/text-area.css +7 -0
- package/cjs/components/text-area/text-area.js +16 -3
- package/cjs/global/css-vars-patch.css +1 -0
- package/cjs/index.d.ts +1 -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/fr-FR.d.ts +1 -0
- package/cjs/locales/id-ID.d.ts +1 -0
- package/cjs/locales/ja-JP.d.ts +1 -0
- package/cjs/locales/kk-KZ.d.ts +1 -0
- package/cjs/locales/ko-KR.d.ts +1 -0
- package/cjs/locales/ko-KR.js +31 -2
- 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-HK.js +2 -1
- package/cjs/locales/zh-TW.d.ts +1 -0
- package/cjs/locales/zh-TW.js +2 -1
- package/cjs/utils/reduce-and-restore-motion.js +7 -6
- package/cjs/utils/render-imperatively.js +9 -3
- package/es/components/ellipsis/ellipsis.d.ts +1 -0
- package/es/components/ellipsis/ellipsis.js +3 -2
- package/es/components/nav-bar/nav-bar.d.ts +2 -2
- package/es/components/popover/popover.css +1 -1
- package/es/components/popover/popover.patch.css +1 -0
- package/es/components/popup/popup.js +7 -1
- package/es/components/pull-to-refresh/pull-to-refresh.js +15 -16
- package/es/components/stepper/index.d.ts +1 -1
- package/es/components/stepper/stepper.d.ts +4 -2
- package/es/components/stepper/stepper.js +19 -3
- package/es/components/steps/steps.css +0 -1
- package/es/components/swiper/swiper.js +6 -3
- package/es/components/text-area/text-area.css +7 -0
- package/es/components/text-area/text-area.js +16 -3
- package/es/global/css-vars-patch.css +1 -0
- package/es/index.d.ts +1 -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/fr-FR.d.ts +1 -0
- package/es/locales/id-ID.d.ts +1 -0
- package/es/locales/ja-JP.d.ts +1 -0
- package/es/locales/kk-KZ.d.ts +1 -0
- package/es/locales/ko-KR.d.ts +1 -0
- package/es/locales/ko-KR.js +31 -2
- 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-HK.js +2 -1
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +2 -1
- package/es/utils/reduce-and-restore-motion.js +7 -6
- package/es/utils/render-imperatively.js +9 -3
- package/package.json +3 -3
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +5 -4
package/2x/bundle/style.css
CHANGED
|
@@ -2036,7 +2036,7 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
2036
2036
|
--background: #ffffff;
|
|
2037
2037
|
--arrow-size: 16px;
|
|
2038
2038
|
--content-padding: 16px 24px;
|
|
2039
|
-
color:
|
|
2039
|
+
color: var(--adm-color-text);
|
|
2040
2040
|
position: absolute;
|
|
2041
2041
|
top: 0;
|
|
2042
2042
|
left: 0;
|
|
@@ -4213,7 +4213,6 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
4213
4213
|
.adm-step .adm-step-indicator .adm-step-icon-container {
|
|
4214
4214
|
position: absolute;
|
|
4215
4215
|
z-index: 1;
|
|
4216
|
-
background: var(--adm-color-background);
|
|
4217
4216
|
color: var(--icon-color);
|
|
4218
4217
|
}
|
|
4219
4218
|
|
|
@@ -4756,6 +4755,14 @@ a.adm-list-item:active:not(.adm-list-item-disabled):after {
|
|
|
4756
4755
|
pointer-events: none;
|
|
4757
4756
|
}
|
|
4758
4757
|
|
|
4758
|
+
.adm-text-area-element-hidden {
|
|
4759
|
+
visibility: hidden;
|
|
4760
|
+
position: absolute;
|
|
4761
|
+
top: 0;
|
|
4762
|
+
left: 0;
|
|
4763
|
+
z-index: -1000;
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4759
4766
|
.adm-text-area-count {
|
|
4760
4767
|
text-align: var(--count-text-align);
|
|
4761
4768
|
color: var(--adm-color-weak);
|
|
@@ -9,5 +9,6 @@ export declare type EllipsisProps = {
|
|
|
9
9
|
collapseText?: string;
|
|
10
10
|
stopPropagationForActionButtons?: PropagationEvent[];
|
|
11
11
|
onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
12
|
+
defaultExpanded?: boolean;
|
|
12
13
|
} & NativeProps;
|
|
13
14
|
export declare const Ellipsis: FC<EllipsisProps>;
|
|
@@ -22,13 +22,14 @@ const defaultProps = {
|
|
|
22
22
|
content: '',
|
|
23
23
|
collapseText: '',
|
|
24
24
|
stopPropagationForActionButtons: [],
|
|
25
|
-
onContentClick: () => {}
|
|
25
|
+
onContentClick: () => {},
|
|
26
|
+
defaultExpanded: false
|
|
26
27
|
};
|
|
27
28
|
const Ellipsis = p => {
|
|
28
29
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
29
30
|
const rootRef = (0, _react.useRef)(null);
|
|
30
31
|
const [ellipsised, setEllipsised] = (0, _react.useState)({});
|
|
31
|
-
const [expanded, setExpanded] = (0, _react.useState)(
|
|
32
|
+
const [expanded, setExpanded] = (0, _react.useState)(props.defaultExpanded);
|
|
32
33
|
const [exceeded, setExceeded] = (0, _react.useState)(false);
|
|
33
34
|
const chars = (0, _react.useMemo)(() => (0, _runes.default)(props.content), [props.content]);
|
|
34
35
|
function getSubString(start, end) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type NavBarProps = {
|
|
4
4
|
back?: ReactNode;
|
|
@@ -6,6 +6,6 @@ export declare type NavBarProps = {
|
|
|
6
6
|
left?: ReactNode;
|
|
7
7
|
right?: ReactNode;
|
|
8
8
|
onBack?: () => void;
|
|
9
|
-
children?:
|
|
9
|
+
children?: ReactNode;
|
|
10
10
|
} & NativeProps<'--height' | '--border-bottom'>;
|
|
11
11
|
export declare const NavBar: FC<NavBarProps>;
|
|
@@ -18,6 +18,7 @@ var _shouldRender = require("../../utils/should-render");
|
|
|
18
18
|
var _antdMobileIcons = require("antd-mobile-icons");
|
|
19
19
|
var _popupBaseProps = require("./popup-base-props");
|
|
20
20
|
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
21
|
+
var _configProvider = require("../config-provider");
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -27,6 +28,9 @@ const defaultProps = Object.assign(Object.assign({}, _popupBaseProps.defaultPopu
|
|
|
27
28
|
});
|
|
28
29
|
const Popup = p => {
|
|
29
30
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
31
|
+
const {
|
|
32
|
+
locale
|
|
33
|
+
} = (0, _configProvider.useConfig)();
|
|
30
34
|
const bodyCls = (0, _classnames.default)(`${classPrefix}-body`, props.bodyClassName, `${classPrefix}-body-position-${props.position}`);
|
|
31
35
|
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
32
36
|
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
@@ -105,7 +109,9 @@ const Popup = p => {
|
|
|
105
109
|
onClick: () => {
|
|
106
110
|
var _a;
|
|
107
111
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
108
|
-
}
|
|
112
|
+
},
|
|
113
|
+
role: 'button',
|
|
114
|
+
"aria-label": locale.common.close
|
|
109
115
|
}, _react.default.createElement(_antdMobileIcons.CloseOutline, null)), props.children))));
|
|
110
116
|
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
111
117
|
active: active,
|
|
@@ -59,6 +59,19 @@ const PullToRefresh = p => {
|
|
|
59
59
|
var _a;
|
|
60
60
|
(_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('touchmove', () => {});
|
|
61
61
|
}, []);
|
|
62
|
+
const reset = () => {
|
|
63
|
+
return new Promise(resolve => {
|
|
64
|
+
api.start({
|
|
65
|
+
to: {
|
|
66
|
+
height: 0
|
|
67
|
+
},
|
|
68
|
+
onResolve() {
|
|
69
|
+
setStatus('pulling');
|
|
70
|
+
resolve();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
};
|
|
62
75
|
function doRefresh() {
|
|
63
76
|
return (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
64
77
|
api.start({
|
|
@@ -69,27 +82,13 @@ const PullToRefresh = p => {
|
|
|
69
82
|
yield props.onRefresh();
|
|
70
83
|
setStatus('complete');
|
|
71
84
|
} catch (e) {
|
|
72
|
-
|
|
73
|
-
to: next => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
74
|
-
yield next({
|
|
75
|
-
height: 0
|
|
76
|
-
});
|
|
77
|
-
setStatus('pulling');
|
|
78
|
-
})
|
|
79
|
-
});
|
|
85
|
+
reset();
|
|
80
86
|
throw e;
|
|
81
87
|
}
|
|
82
88
|
if (props.completeDelay > 0) {
|
|
83
89
|
yield (0, _sleep.sleep)(props.completeDelay);
|
|
84
90
|
}
|
|
85
|
-
|
|
86
|
-
to: next => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
87
|
-
yield next({
|
|
88
|
-
height: 0
|
|
89
|
-
});
|
|
90
|
-
setStatus('pulling');
|
|
91
|
-
})
|
|
92
|
-
});
|
|
91
|
+
reset();
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
94
|
(0, _react.useDrag)(state => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
-
import { InputProps } from '../input';
|
|
3
|
+
import { InputProps, InputRef } from '../input';
|
|
4
4
|
declare type ValueProps<ValueType> = {
|
|
5
5
|
allowEmpty: true;
|
|
6
6
|
value?: ValueType | null;
|
|
@@ -30,5 +30,7 @@ export declare type StringStepperProps = BaseStepperProps<string> & {
|
|
|
30
30
|
stringMode: true;
|
|
31
31
|
};
|
|
32
32
|
export declare type StepperProps = NumberStepperProps | StringStepperProps;
|
|
33
|
-
export declare
|
|
33
|
+
export declare type StepperRef = Pick<InputRef, 'blur' | 'focus' | 'nativeElement'>;
|
|
34
|
+
export declare function InnerStepper<ValueType extends number | string>(p: StepperProps, ref: React.ForwardedRef<StepperRef>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
35
|
+
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<StepperRef>>;
|
|
34
36
|
export {};
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.InnerStepper = InnerStepper;
|
|
7
|
+
exports.Stepper = void 0;
|
|
7
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _antdMobileIcons = require("antd-mobile-icons");
|
|
@@ -23,7 +24,7 @@ const defaultProps = {
|
|
|
23
24
|
disabled: false,
|
|
24
25
|
allowEmpty: false
|
|
25
26
|
};
|
|
26
|
-
function
|
|
27
|
+
function InnerStepper(p, ref) {
|
|
27
28
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
28
29
|
const {
|
|
29
30
|
defaultValue = 0,
|
|
@@ -42,6 +43,21 @@ function Stepper(p) {
|
|
|
42
43
|
const {
|
|
43
44
|
locale
|
|
44
45
|
} = (0, _configProvider.useConfig)();
|
|
46
|
+
// ========================== Ref ==========================
|
|
47
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
48
|
+
focus: () => {
|
|
49
|
+
var _a;
|
|
50
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
51
|
+
},
|
|
52
|
+
blur: () => {
|
|
53
|
+
var _a;
|
|
54
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
55
|
+
},
|
|
56
|
+
get nativeElement() {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
return (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.nativeElement) !== null && _b !== void 0 ? _b : null;
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
45
61
|
// ========================== Parse / Format ==========================
|
|
46
62
|
const fixedValue = value => {
|
|
47
63
|
const fixedValue = digits !== undefined ? (0, _miniDecimal.toFixed)(value.toString(), '.', digits) : value;
|
|
@@ -209,4 +225,6 @@ function Stepper(p) {
|
|
|
209
225
|
color: 'primary',
|
|
210
226
|
"aria-label": locale.Stepper.increase
|
|
211
227
|
}, _react.default.createElement(_antdMobileIcons.AddOutline, null))));
|
|
212
|
-
}
|
|
228
|
+
}
|
|
229
|
+
const Stepper = (0, _react.forwardRef)(InnerStepper);
|
|
230
|
+
exports.Stepper = Stepper;
|
|
@@ -212,11 +212,14 @@ const Swiper = (0, _react.forwardRef)((0, _stagedComponents.staged)((p, ref) =>
|
|
|
212
212
|
} = props;
|
|
213
213
|
(0, _react.useEffect)(() => {
|
|
214
214
|
if (!autoplay || dragging) return;
|
|
215
|
-
|
|
215
|
+
let interval;
|
|
216
|
+
function tick() {
|
|
217
|
+
interval = window.setTimeout(tick, autoplayInterval);
|
|
216
218
|
swipeNext();
|
|
217
|
-
}
|
|
219
|
+
}
|
|
220
|
+
interval = window.setTimeout(tick, autoplayInterval);
|
|
218
221
|
return () => {
|
|
219
|
-
window.
|
|
222
|
+
if (interval) window.clearTimeout(interval);
|
|
220
223
|
};
|
|
221
224
|
}, [autoplay, autoplayInterval, dragging, count]);
|
|
222
225
|
function renderTrackInner() {
|
|
@@ -70,6 +70,14 @@
|
|
|
70
70
|
pointer-events: none;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
.adm-text-area-element-hidden {
|
|
74
|
+
visibility: hidden;
|
|
75
|
+
position: absolute;
|
|
76
|
+
top: 0;
|
|
77
|
+
left: 0;
|
|
78
|
+
z-index: -1000;
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
.adm-text-area-count {
|
|
74
82
|
text-align: var(--count-text-align);
|
|
75
83
|
color: var(--adm-color-weak);
|
|
@@ -33,6 +33,10 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
33
33
|
(0, _devLog.devError)('TextArea', '`value` prop on `TextArea` should not be `null`. Consider using an empty string to clear the component.');
|
|
34
34
|
}
|
|
35
35
|
const nativeTextAreaRef = (0, _react.useRef)(null);
|
|
36
|
+
// https://github.com/ant-design/ant-design-mobile/issues/5961
|
|
37
|
+
const heightRef = (0, _react.useRef)('auto');
|
|
38
|
+
// https://github.com/ant-design/ant-design-mobile/issues/6051
|
|
39
|
+
const hiddenTextAreaRef = (0, _react.useRef)(null);
|
|
36
40
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
37
41
|
clear: () => {
|
|
38
42
|
setValue('');
|
|
@@ -52,9 +56,11 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
52
56
|
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
53
57
|
if (!autoSize) return;
|
|
54
58
|
const textArea = nativeTextAreaRef.current;
|
|
59
|
+
const hiddenTextArea = hiddenTextAreaRef.current;
|
|
55
60
|
if (!textArea) return;
|
|
56
|
-
textArea.style.height =
|
|
57
|
-
|
|
61
|
+
textArea.style.height = heightRef.current;
|
|
62
|
+
if (!hiddenTextArea) return;
|
|
63
|
+
let height = hiddenTextArea.scrollHeight;
|
|
58
64
|
if (typeof autoSize === 'object') {
|
|
59
65
|
const computedStyle = window.getComputedStyle(textArea);
|
|
60
66
|
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
@@ -65,6 +71,7 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
65
71
|
height = Math.min(height, autoSize.maxRows * lineHeight);
|
|
66
72
|
}
|
|
67
73
|
}
|
|
74
|
+
heightRef.current = `${height}px`;
|
|
68
75
|
textArea.style.height = `${height}px`;
|
|
69
76
|
}, [value, autoSize]);
|
|
70
77
|
const compositingRef = (0, _react.useRef)(false);
|
|
@@ -115,7 +122,13 @@ const TextArea = (0, _react.forwardRef)((p, ref) => {
|
|
|
115
122
|
onFocus: props.onFocus,
|
|
116
123
|
onBlur: props.onBlur,
|
|
117
124
|
onClick: props.onClick
|
|
118
|
-
}), count
|
|
125
|
+
}), count, autoSize && _react.default.createElement("textarea", {
|
|
126
|
+
ref: hiddenTextAreaRef,
|
|
127
|
+
className: `${classPrefix}-element ${classPrefix}-element-hidden`,
|
|
128
|
+
value: value,
|
|
129
|
+
"aria-hidden": true,
|
|
130
|
+
readOnly: true
|
|
131
|
+
})));
|
|
119
132
|
});
|
|
120
133
|
exports.TextArea = TextArea;
|
|
121
134
|
TextArea.defaultProps = defaultProps;
|
package/2x/cjs/index.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export type { SpaceProps } from './components/space';
|
|
|
133
133
|
export { default as SpinLoading } from './components/spin-loading';
|
|
134
134
|
export type { SpinLoadingProps } from './components/spin-loading';
|
|
135
135
|
export { default as Stepper } from './components/stepper';
|
|
136
|
-
export type { StepperProps } from './components/stepper';
|
|
136
|
+
export type { StepperProps, StepperRef } from './components/stepper';
|
|
137
137
|
export { default as Steps } from './components/steps';
|
|
138
138
|
export type { StepsProps, StepProps } from './components/steps';
|
|
139
139
|
export { default as SwipeAction } from './components/swipe-action';
|
package/2x/cjs/locales/base.d.ts
CHANGED
package/2x/cjs/locales/base.js
CHANGED
package/2x/cjs/locales/ko-KR.js
CHANGED
|
@@ -12,7 +12,8 @@ const koKR = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
|
12
12
|
common: {
|
|
13
13
|
confirm: '확인',
|
|
14
14
|
cancel: '취소',
|
|
15
|
-
loading: '로딩중'
|
|
15
|
+
loading: '로딩중',
|
|
16
|
+
close: '닫기'
|
|
16
17
|
},
|
|
17
18
|
Calendar: {
|
|
18
19
|
markItems: ['월', '화', '수', '목', '금', '토', '일'],
|
|
@@ -24,6 +25,9 @@ const koKR = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
|
24
25
|
Dialog: {
|
|
25
26
|
ok: '확인'
|
|
26
27
|
},
|
|
28
|
+
DatePicker: {
|
|
29
|
+
tillNow: '지금까지'
|
|
30
|
+
},
|
|
27
31
|
ErrorBlock: {
|
|
28
32
|
default: {
|
|
29
33
|
title: '문제가 발생했습니다',
|
|
@@ -94,7 +98,16 @@ const koKR = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
|
94
98
|
}
|
|
95
99
|
},
|
|
96
100
|
ImageUploader: {
|
|
97
|
-
uploading: '업로드 중...'
|
|
101
|
+
uploading: '업로드 중...',
|
|
102
|
+
upload: '업로드'
|
|
103
|
+
},
|
|
104
|
+
InfiniteScroll: {
|
|
105
|
+
noMore: '불러올 데이터 없음',
|
|
106
|
+
failedToLoad: '불러오기 실패',
|
|
107
|
+
retry: '재시도'
|
|
108
|
+
},
|
|
109
|
+
Input: {
|
|
110
|
+
clear: '지우기'
|
|
98
111
|
},
|
|
99
112
|
Mask: {
|
|
100
113
|
name: '마스크'
|
|
@@ -102,10 +115,26 @@ const koKR = (0, _mergeLocale.mergeLocale)(_base.base, {
|
|
|
102
115
|
Modal: {
|
|
103
116
|
ok: '확인'
|
|
104
117
|
},
|
|
118
|
+
PasscodeInput: {
|
|
119
|
+
name: '비밀번호 입력'
|
|
120
|
+
},
|
|
105
121
|
PullToRefresh: {
|
|
106
122
|
pulling: '스크롤을 당겨서 새로고침하십시오',
|
|
107
123
|
canRelease: '새로고침 하려면 놓으십시오',
|
|
108
124
|
complete: '새로고침 완료'
|
|
125
|
+
},
|
|
126
|
+
SearchBar: {
|
|
127
|
+
name: '검색바'
|
|
128
|
+
},
|
|
129
|
+
Slider: {
|
|
130
|
+
name: '슬라이더'
|
|
131
|
+
},
|
|
132
|
+
Stepper: {
|
|
133
|
+
decrease: '감소',
|
|
134
|
+
increase: '증가'
|
|
135
|
+
},
|
|
136
|
+
Switch: {
|
|
137
|
+
name: '스위치'
|
|
109
138
|
}
|
|
110
139
|
});
|
|
111
140
|
var _default = koKR;
|
package/2x/cjs/locales/zh-CN.js
CHANGED
package/2x/cjs/locales/zh-HK.js
CHANGED
package/2x/cjs/locales/zh-TW.js
CHANGED
|
@@ -33,11 +33,12 @@ function restoreMotion() {
|
|
|
33
33
|
function isMotionReduced() {
|
|
34
34
|
return reduced;
|
|
35
35
|
}
|
|
36
|
+
function subscribe(onStoreChange) {
|
|
37
|
+
subscribers.add(onStoreChange);
|
|
38
|
+
return () => {
|
|
39
|
+
subscribers.delete(onStoreChange);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
36
42
|
function useMotionReduced() {
|
|
37
|
-
return (0, _shim.useSyncExternalStore)(
|
|
38
|
-
subscribers.add(onStoreChange);
|
|
39
|
-
return () => {
|
|
40
|
-
subscribers.delete(onStoreChange);
|
|
41
|
-
};
|
|
42
|
-
}, isMotionReduced);
|
|
43
|
+
return (0, _shim.useSyncExternalStore)(subscribe, isMotionReduced);
|
|
43
44
|
}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.renderImperatively = renderImperatively;
|
|
7
|
+
var _tslib = require("tslib");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _renderToBody = require("./render-to-body");
|
|
9
10
|
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); }
|
|
@@ -53,10 +54,15 @@ function renderImperatively(element) {
|
|
|
53
54
|
ref: wrapperRef
|
|
54
55
|
}));
|
|
55
56
|
return {
|
|
56
|
-
close: () => {
|
|
57
|
+
close: () => (0, _tslib.__awaiter)(this, void 0, void 0, function* () {
|
|
57
58
|
var _a;
|
|
58
|
-
(
|
|
59
|
-
|
|
59
|
+
if (!wrapperRef.current) {
|
|
60
|
+
// it means the wrapper is not mounted yet, call `unmount` directly
|
|
61
|
+
unmount();
|
|
62
|
+
} else {
|
|
63
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
60
66
|
replace: element => {
|
|
61
67
|
var _a;
|
|
62
68
|
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.replace(element);
|
|
@@ -9,5 +9,6 @@ export declare type EllipsisProps = {
|
|
|
9
9
|
collapseText?: string;
|
|
10
10
|
stopPropagationForActionButtons?: PropagationEvent[];
|
|
11
11
|
onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
12
|
+
defaultExpanded?: boolean;
|
|
12
13
|
} & NativeProps;
|
|
13
14
|
export declare const Ellipsis: FC<EllipsisProps>;
|
|
@@ -13,13 +13,14 @@ const defaultProps = {
|
|
|
13
13
|
content: '',
|
|
14
14
|
collapseText: '',
|
|
15
15
|
stopPropagationForActionButtons: [],
|
|
16
|
-
onContentClick: () => {}
|
|
16
|
+
onContentClick: () => {},
|
|
17
|
+
defaultExpanded: false
|
|
17
18
|
};
|
|
18
19
|
export const Ellipsis = p => {
|
|
19
20
|
const props = mergeProps(defaultProps, p);
|
|
20
21
|
const rootRef = useRef(null);
|
|
21
22
|
const [ellipsised, setEllipsised] = useState({});
|
|
22
|
-
const [expanded, setExpanded] = useState(
|
|
23
|
+
const [expanded, setExpanded] = useState(props.defaultExpanded);
|
|
23
24
|
const [exceeded, setExceeded] = useState(false);
|
|
24
25
|
const chars = useMemo(() => runes(props.content), [props.content]);
|
|
25
26
|
function getSubString(start, end) {
|