antd-mobile 5.37.1 → 5.38.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/README.md +2 -2
- package/2x/bundle/antd-mobile.cjs.development.js +2276 -1113
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +2279 -1116
- package/2x/bundle/antd-mobile.es.js +7914 -7141
- package/2x/bundle/antd-mobile.umd.development.js +2276 -1113
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/css-vars-patch.css +42 -0
- package/2x/bundle/style.css +142 -4
- package/2x/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +1 -1
- package/2x/cjs/components/calendar-picker-view/calendar-picker-view.js +31 -10
- package/2x/cjs/components/card/card.css +1 -0
- package/2x/cjs/components/card/card.d.ts +2 -1
- package/2x/cjs/components/card/card.js +7 -3
- package/2x/cjs/components/card/card.patch.css +8 -0
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/2x/cjs/components/date-picker/date-picker-quarter-utils.js +77 -0
- package/2x/cjs/components/date-picker/date-picker-utils.d.ts +3 -2
- package/2x/cjs/components/date-picker/date-picker-utils.js +7 -0
- package/2x/cjs/components/ellipsis/ellipsis.css +1 -0
- package/2x/cjs/components/ellipsis/ellipsis.d.ts +1 -1
- package/2x/cjs/components/ellipsis/ellipsis.js +28 -124
- package/2x/cjs/components/ellipsis/useMeasure.d.ts +2 -0
- package/2x/cjs/components/ellipsis/useMeasure.js +108 -0
- package/2x/cjs/components/ellipsis/~ellipsis.d.ts +15 -0
- package/2x/cjs/components/ellipsis/~ellipsis.js +161 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +2 -2
- package/2x/cjs/components/input/input.d.ts +2 -2
- package/2x/cjs/components/input/input.js +1 -0
- package/2x/cjs/components/notice-bar/notice-bar.css +30 -4
- package/2x/cjs/components/notice-bar/notice-bar.d.ts +5 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +7 -3
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/2x/cjs/components/search-bar/search-bar.js +1 -0
- package/2x/cjs/components/segmented/index.d.ts +4 -0
- package/2x/cjs/components/segmented/index.js +10 -0
- package/2x/cjs/components/segmented/segmented.css +113 -0
- package/2x/cjs/components/segmented/segmented.d.ts +21 -0
- package/2x/cjs/components/segmented/segmented.js +57 -0
- package/2x/cjs/components/segmented/segmented.patch.css +41 -0
- package/2x/cjs/components/tab-bar/tab-bar.d.ts +1 -0
- package/2x/cjs/components/tab-bar/tab-bar.js +2 -0
- package/2x/cjs/components/tabs/tabs.js +1 -1
- package/2x/cjs/components/toast/methods.js +9 -3
- package/2x/cjs/global/css-vars-patch.css +42 -0
- package/2x/cjs/index.d.ts +2 -0
- package/2x/cjs/index.js +7 -0
- package/2x/cjs/locales/cnr-ME.d.ts +139 -0
- package/2x/cjs/locales/cnr-ME.js +149 -0
- package/2x/cjs/locales/hr-HR.d.ts +139 -0
- package/2x/cjs/locales/hr-HR.js +149 -0
- package/2x/cjs/locales/kk-KZ.js +6 -6
- package/2x/cjs/locales/sr-RS.d.ts +139 -0
- package/2x/cjs/locales/sr-RS.js +149 -0
- package/2x/cjs/utils/render-imperatively.d.ts +1 -0
- package/2x/cjs/utils/render-imperatively.js +6 -3
- package/2x/es/components/calendar-picker-view/calendar-picker-view.d.ts +1 -1
- package/2x/es/components/calendar-picker-view/calendar-picker-view.js +32 -11
- package/2x/es/components/card/card.css +1 -0
- package/2x/es/components/card/card.d.ts +2 -1
- package/2x/es/components/card/card.js +7 -3
- package/2x/es/components/card/card.patch.css +8 -0
- package/2x/es/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/2x/es/components/date-picker/date-picker-quarter-utils.js +68 -0
- package/2x/es/components/date-picker/date-picker-utils.d.ts +3 -2
- package/2x/es/components/date-picker/date-picker-utils.js +7 -0
- package/2x/es/components/ellipsis/ellipsis.css +1 -0
- package/2x/es/components/ellipsis/ellipsis.d.ts +1 -1
- package/2x/es/components/ellipsis/ellipsis.js +28 -122
- package/2x/es/components/ellipsis/useMeasure.d.ts +2 -0
- package/2x/es/components/ellipsis/useMeasure.js +101 -0
- package/2x/es/components/ellipsis/~ellipsis.d.ts +15 -0
- package/2x/es/components/ellipsis/~ellipsis.js +151 -0
- package/2x/es/components/image-uploader/image-uploader.js +2 -2
- package/2x/es/components/input/input.d.ts +2 -2
- package/2x/es/components/input/input.js +1 -0
- package/2x/es/components/notice-bar/notice-bar.css +30 -4
- package/2x/es/components/notice-bar/notice-bar.d.ts +5 -1
- package/2x/es/components/notice-bar/notice-bar.js +7 -3
- package/2x/es/components/search-bar/search-bar.d.ts +2 -2
- package/2x/es/components/search-bar/search-bar.js +1 -0
- package/2x/es/components/segmented/index.d.ts +4 -0
- package/2x/es/components/segmented/index.js +3 -0
- package/2x/es/components/segmented/segmented.css +113 -0
- package/2x/es/components/segmented/segmented.d.ts +21 -0
- package/2x/es/components/segmented/segmented.js +48 -0
- package/2x/es/components/segmented/segmented.patch.css +41 -0
- package/2x/es/components/tab-bar/tab-bar.d.ts +1 -0
- package/2x/es/components/tab-bar/tab-bar.js +2 -0
- package/2x/es/components/tabs/tabs.js +1 -1
- package/2x/es/components/toast/methods.js +9 -3
- package/2x/es/global/css-vars-patch.css +42 -0
- package/2x/es/index.d.ts +2 -0
- package/2x/es/index.js +1 -0
- package/2x/es/locales/cnr-ME.d.ts +139 -0
- package/2x/es/locales/cnr-ME.js +142 -0
- package/2x/es/locales/hr-HR.d.ts +139 -0
- package/2x/es/locales/hr-HR.js +142 -0
- package/2x/es/locales/kk-KZ.js +6 -6
- package/2x/es/locales/sr-RS.d.ts +139 -0
- package/2x/es/locales/sr-RS.js +142 -0
- package/2x/es/utils/render-imperatively.d.ts +1 -0
- package/2x/es/utils/render-imperatively.js +6 -3
- package/2x/package.json +3 -2
- package/README.md +2 -2
- package/bundle/antd-mobile.cjs.development.js +2276 -1113
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +2279 -1116
- package/bundle/antd-mobile.es.js +7914 -7141
- package/bundle/antd-mobile.umd.development.js +2276 -1113
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/css-vars-patch.css +32 -0
- package/bundle/style.css +1 -1
- package/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +1 -1
- package/cjs/components/calendar-picker-view/calendar-picker-view.js +31 -10
- package/cjs/components/card/card.css +1 -0
- package/cjs/components/card/card.d.ts +2 -1
- package/cjs/components/card/card.js +7 -3
- package/cjs/components/card/card.patch.css +6 -0
- package/cjs/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/cjs/components/date-picker/date-picker-quarter-utils.js +77 -0
- package/cjs/components/date-picker/date-picker-utils.d.ts +3 -2
- package/cjs/components/date-picker/date-picker-utils.js +7 -0
- package/cjs/components/ellipsis/ellipsis.css +1 -0
- package/cjs/components/ellipsis/ellipsis.d.ts +1 -1
- package/cjs/components/ellipsis/ellipsis.js +28 -124
- package/cjs/components/ellipsis/useMeasure.d.ts +2 -0
- package/cjs/components/ellipsis/useMeasure.js +108 -0
- package/cjs/components/ellipsis/~ellipsis.d.ts +15 -0
- package/cjs/components/ellipsis/~ellipsis.js +161 -0
- package/cjs/components/image-uploader/image-uploader.js +2 -2
- package/cjs/components/input/input.d.ts +2 -2
- package/cjs/components/input/input.js +1 -0
- package/cjs/components/notice-bar/notice-bar.css +25 -4
- package/cjs/components/notice-bar/notice-bar.d.ts +5 -1
- package/cjs/components/notice-bar/notice-bar.js +7 -3
- package/cjs/components/search-bar/search-bar.d.ts +2 -2
- package/cjs/components/search-bar/search-bar.js +1 -0
- package/cjs/components/segmented/index.d.ts +4 -0
- package/cjs/components/segmented/index.js +10 -0
- package/cjs/components/segmented/segmented.css +97 -0
- package/cjs/components/segmented/segmented.d.ts +21 -0
- package/cjs/components/segmented/segmented.js +57 -0
- package/cjs/components/segmented/segmented.patch.css +32 -0
- package/cjs/components/tab-bar/tab-bar.d.ts +1 -0
- package/cjs/components/tab-bar/tab-bar.js +2 -0
- package/cjs/components/tabs/tabs.js +1 -1
- package/cjs/components/toast/methods.js +9 -3
- package/cjs/global/css-vars-patch.css +32 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +7 -0
- package/cjs/locales/cnr-ME.d.ts +139 -0
- package/cjs/locales/cnr-ME.js +149 -0
- package/cjs/locales/hr-HR.d.ts +139 -0
- package/cjs/locales/hr-HR.js +149 -0
- package/cjs/locales/kk-KZ.js +6 -6
- package/cjs/locales/sr-RS.d.ts +139 -0
- package/cjs/locales/sr-RS.js +149 -0
- package/cjs/utils/render-imperatively.d.ts +1 -0
- package/cjs/utils/render-imperatively.js +6 -3
- package/es/components/calendar-picker-view/calendar-picker-view.d.ts +1 -1
- package/es/components/calendar-picker-view/calendar-picker-view.js +32 -11
- package/es/components/card/card.css +1 -0
- package/es/components/card/card.d.ts +2 -1
- package/es/components/card/card.js +7 -3
- package/es/components/card/card.patch.css +6 -0
- package/es/components/date-picker/date-picker-quarter-utils.d.ts +7 -0
- package/es/components/date-picker/date-picker-quarter-utils.js +68 -0
- package/es/components/date-picker/date-picker-utils.d.ts +3 -2
- package/es/components/date-picker/date-picker-utils.js +7 -0
- package/es/components/ellipsis/ellipsis.css +1 -0
- package/es/components/ellipsis/ellipsis.d.ts +1 -1
- package/es/components/ellipsis/ellipsis.js +28 -122
- package/es/components/ellipsis/useMeasure.d.ts +2 -0
- package/es/components/ellipsis/useMeasure.js +101 -0
- package/es/components/ellipsis/~ellipsis.d.ts +15 -0
- package/es/components/ellipsis/~ellipsis.js +151 -0
- package/es/components/image-uploader/image-uploader.js +2 -2
- package/es/components/input/input.d.ts +2 -2
- package/es/components/input/input.js +1 -0
- package/es/components/notice-bar/notice-bar.css +25 -4
- package/es/components/notice-bar/notice-bar.d.ts +5 -1
- package/es/components/notice-bar/notice-bar.js +7 -3
- package/es/components/search-bar/search-bar.d.ts +2 -2
- package/es/components/search-bar/search-bar.js +1 -0
- package/es/components/segmented/index.d.ts +4 -0
- package/es/components/segmented/index.js +3 -0
- package/es/components/segmented/segmented.css +97 -0
- package/es/components/segmented/segmented.d.ts +21 -0
- package/es/components/segmented/segmented.js +48 -0
- package/es/components/segmented/segmented.patch.css +32 -0
- package/es/components/tab-bar/tab-bar.d.ts +1 -0
- package/es/components/tab-bar/tab-bar.js +2 -0
- package/es/components/tabs/tabs.js +1 -1
- package/es/components/toast/methods.js +9 -3
- package/es/global/css-vars-patch.css +32 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +1 -0
- package/es/locales/cnr-ME.d.ts +139 -0
- package/es/locales/cnr-ME.js +142 -0
- package/es/locales/hr-HR.d.ts +139 -0
- package/es/locales/hr-HR.js +142 -0
- package/es/locales/kk-KZ.js +6 -6
- package/es/locales/sr-RS.d.ts +139 -0
- package/es/locales/sr-RS.js +142 -0
- package/es/utils/render-imperatively.d.ts +1 -0
- package/es/utils/render-imperatively.js +6 -3
- package/package.json +3 -2
- package/umd/antd-mobile.js +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
2
|
+
import runes from 'runes2';
|
|
3
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
4
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
5
|
+
import { useResizeEffect } from '../../utils/use-resize-effect';
|
|
6
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
7
|
+
import { withStopPropagation } from '../../utils/with-stop-propagation';
|
|
8
|
+
const classPrefix = `adm-ellipsis`;
|
|
9
|
+
const defaultProps = {
|
|
10
|
+
direction: 'end',
|
|
11
|
+
rows: 1,
|
|
12
|
+
expandText: '',
|
|
13
|
+
content: '',
|
|
14
|
+
collapseText: '',
|
|
15
|
+
stopPropagationForActionButtons: [],
|
|
16
|
+
onContentClick: () => {},
|
|
17
|
+
defaultExpanded: false
|
|
18
|
+
};
|
|
19
|
+
export const Ellipsis = p => {
|
|
20
|
+
const props = mergeProps(defaultProps, p);
|
|
21
|
+
const rootRef = useRef(null);
|
|
22
|
+
const expandElRef = useRef(null);
|
|
23
|
+
const collapseElRef = useRef(null);
|
|
24
|
+
const [ellipsised, setEllipsised] = useState({});
|
|
25
|
+
const [expanded, setExpanded] = useState(props.defaultExpanded);
|
|
26
|
+
const [exceeded, setExceeded] = useState(false);
|
|
27
|
+
const chars = useMemo(() => runes(props.content), [props.content]);
|
|
28
|
+
function getSubString(start, end) {
|
|
29
|
+
return chars.slice(start, end).join('');
|
|
30
|
+
}
|
|
31
|
+
function calcEllipsised() {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const root = rootRef.current;
|
|
34
|
+
if (!root) return;
|
|
35
|
+
const originDisplay = root.style.display;
|
|
36
|
+
root.style.display = 'block';
|
|
37
|
+
const originStyle = window.getComputedStyle(root);
|
|
38
|
+
const container = document.createElement('div');
|
|
39
|
+
const styleNames = Array.prototype.slice.apply(originStyle);
|
|
40
|
+
styleNames.forEach(name => {
|
|
41
|
+
container.style.setProperty(name, originStyle.getPropertyValue(name));
|
|
42
|
+
});
|
|
43
|
+
root.style.display = originDisplay;
|
|
44
|
+
container.style.height = 'auto';
|
|
45
|
+
container.style.minHeight = 'auto';
|
|
46
|
+
container.style.maxHeight = 'auto';
|
|
47
|
+
container.style.textOverflow = 'clip';
|
|
48
|
+
container.style.webkitLineClamp = 'unset';
|
|
49
|
+
container.style.display = 'block';
|
|
50
|
+
const lineHeight = pxToNumber(originStyle.lineHeight);
|
|
51
|
+
const maxHeight = Math.floor(lineHeight * (props.rows + 0.5) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
|
|
52
|
+
container.innerText = props.content;
|
|
53
|
+
document.body.appendChild(container);
|
|
54
|
+
if (container.offsetHeight <= maxHeight) {
|
|
55
|
+
setExceeded(false);
|
|
56
|
+
} else {
|
|
57
|
+
setExceeded(true);
|
|
58
|
+
const end = props.content.length;
|
|
59
|
+
const collapseEl = typeof props.collapseText === 'string' ? props.collapseText : (_a = collapseElRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML;
|
|
60
|
+
const expandEl = typeof props.expandText === 'string' ? props.expandText : (_b = expandElRef.current) === null || _b === void 0 ? void 0 : _b.innerHTML;
|
|
61
|
+
const actionText = expanded ? collapseEl : expandEl;
|
|
62
|
+
function check(left, right) {
|
|
63
|
+
if (right - left <= 1) {
|
|
64
|
+
if (props.direction === 'end') {
|
|
65
|
+
return {
|
|
66
|
+
leading: getSubString(0, left) + '...'
|
|
67
|
+
};
|
|
68
|
+
} else {
|
|
69
|
+
return {
|
|
70
|
+
tailing: '...' + getSubString(right, end)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const middle = Math.round((left + right) / 2);
|
|
75
|
+
if (props.direction === 'end') {
|
|
76
|
+
container.innerHTML = getSubString(0, middle) + '...' + actionText;
|
|
77
|
+
} else {
|
|
78
|
+
container.innerHTML = actionText + '...' + getSubString(middle, end);
|
|
79
|
+
}
|
|
80
|
+
if (container.offsetHeight <= maxHeight) {
|
|
81
|
+
if (props.direction === 'end') {
|
|
82
|
+
return check(middle, right);
|
|
83
|
+
} else {
|
|
84
|
+
return check(left, middle);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
if (props.direction === 'end') {
|
|
88
|
+
return check(left, middle);
|
|
89
|
+
} else {
|
|
90
|
+
return check(middle, right);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function checkMiddle(leftPart, rightPart) {
|
|
95
|
+
if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
|
96
|
+
return {
|
|
97
|
+
leading: getSubString(0, leftPart[0]) + '...',
|
|
98
|
+
tailing: '...' + getSubString(rightPart[1], end)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
|
102
|
+
const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
|
103
|
+
container.innerHTML = getSubString(0, leftPartMiddle) + '...' + actionText + '...' + getSubString(rightPartMiddle, end);
|
|
104
|
+
if (container.offsetHeight <= maxHeight) {
|
|
105
|
+
return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
|
|
106
|
+
} else {
|
|
107
|
+
return checkMiddle([leftPart[0], leftPartMiddle], [rightPartMiddle, rightPart[1]]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const middle = Math.floor((0 + end) / 2);
|
|
111
|
+
const ellipsised = props.direction === 'middle' ? checkMiddle([0, middle], [middle, end]) : check(0, end);
|
|
112
|
+
setEllipsised(ellipsised);
|
|
113
|
+
}
|
|
114
|
+
document.body.removeChild(container);
|
|
115
|
+
}
|
|
116
|
+
useResizeEffect(calcEllipsised, rootRef);
|
|
117
|
+
useIsomorphicLayoutEffect(() => {
|
|
118
|
+
calcEllipsised();
|
|
119
|
+
}, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
|
|
120
|
+
const expandActionElement = !!props.expandText && withStopPropagation(props.stopPropagationForActionButtons, React.createElement("a", {
|
|
121
|
+
ref: expandElRef,
|
|
122
|
+
onClick: () => {
|
|
123
|
+
setExpanded(true);
|
|
124
|
+
}
|
|
125
|
+
}, props.expandText));
|
|
126
|
+
const collapseActionElement = !!props.collapseText && withStopPropagation(props.stopPropagationForActionButtons, React.createElement("a", {
|
|
127
|
+
ref: collapseElRef,
|
|
128
|
+
onClick: () => {
|
|
129
|
+
setExpanded(false);
|
|
130
|
+
}
|
|
131
|
+
}, props.collapseText));
|
|
132
|
+
const renderContent = () => {
|
|
133
|
+
if (!exceeded) return props.content;
|
|
134
|
+
if (expanded) return React.createElement(React.Fragment, null, props.content, collapseActionElement);
|
|
135
|
+
return React.createElement(React.Fragment, null, ellipsised.leading, expandActionElement, ellipsised.tailing);
|
|
136
|
+
};
|
|
137
|
+
return withNativeProps(props, React.createElement("div", {
|
|
138
|
+
ref: rootRef,
|
|
139
|
+
className: classPrefix,
|
|
140
|
+
onClick: e => {
|
|
141
|
+
if (e.target === e.currentTarget) {
|
|
142
|
+
props.onContentClick(e);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, renderContent()));
|
|
146
|
+
};
|
|
147
|
+
function pxToNumber(value) {
|
|
148
|
+
if (!value) return 0;
|
|
149
|
+
const match = value.match(/^\d*(\.\d*)?/);
|
|
150
|
+
return match ? Number(match[0]) : 0;
|
|
151
|
+
}
|
|
@@ -218,14 +218,14 @@ export const ImageUploader = forwardRef((p, ref) => {
|
|
|
218
218
|
}, React.createElement("span", {
|
|
219
219
|
className: `${classPrefix}-upload-button-icon`
|
|
220
220
|
}, React.createElement(AddOutline, null))), !props.disableUpload && React.createElement("input", {
|
|
221
|
+
"aria-label": locale.ImageUploader.upload,
|
|
221
222
|
ref: inputRef,
|
|
222
223
|
capture: props.capture,
|
|
223
224
|
accept: props.accept,
|
|
224
225
|
multiple: props.multiple,
|
|
225
226
|
type: 'file',
|
|
226
227
|
className: `${classPrefix}-input`,
|
|
227
|
-
onChange: onChange
|
|
228
|
-
"aria-hidden": true
|
|
228
|
+
onChange: onChange
|
|
229
229
|
})));
|
|
230
230
|
useImperativeHandle(ref, () => ({
|
|
231
231
|
get nativeElement() {
|
|
@@ -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' | 'enterKeyHint'> & {
|
|
7
|
+
export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'onPaste' | '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;
|
|
@@ -22,7 +22,7 @@ export declare type InputRef = {
|
|
|
22
22
|
blur: () => void;
|
|
23
23
|
nativeElement: HTMLInputElement | null;
|
|
24
24
|
};
|
|
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" | "enterKeyHint" | "maxLength" | "minLength"> & {
|
|
25
|
+
export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "onPaste" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "type" | "step" | "autoFocus" | "placeholder" | "autoCapitalize" | "autoCorrect" | "inputMode" | "name" | "readOnly" | "autoComplete" | "enterKeyHint" | "maxLength" | "minLength"> & {
|
|
26
26
|
value?: string | undefined;
|
|
27
27
|
defaultValue?: string | undefined;
|
|
28
28
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -87,6 +87,7 @@ export const Input = forwardRef((props, ref) => {
|
|
|
87
87
|
checkValue();
|
|
88
88
|
(_a = mergedProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
89
89
|
},
|
|
90
|
+
onPaste: mergedProps.onPaste,
|
|
90
91
|
id: mergedProps.id,
|
|
91
92
|
placeholder: mergedProps.placeholder,
|
|
92
93
|
disabled: mergedProps.disabled,
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
--font-size: var(--adm-font-size-7);
|
|
6
6
|
--icon-font-size: var(--adm-font-size-10);
|
|
7
7
|
--height: 80px;
|
|
8
|
+
--adm-notice-bar-border-radius: 8px;
|
|
9
|
+
--adm-notice-bar-border-width: 2px;
|
|
8
10
|
height: var(--height);
|
|
9
11
|
box-sizing: border-box;
|
|
10
12
|
font-size: var(--font-size);
|
|
@@ -12,9 +14,9 @@
|
|
|
12
14
|
display: flex;
|
|
13
15
|
align-items: center;
|
|
14
16
|
justify-content: space-between;
|
|
15
|
-
border: solid
|
|
16
|
-
border-left:
|
|
17
|
-
border-right:
|
|
17
|
+
border: solid var(--adm-notice-bar-border-width) var(--border-color);
|
|
18
|
+
border-left-width: 0;
|
|
19
|
+
border-right-width: 0;
|
|
18
20
|
background-color: var(--background-color);
|
|
19
21
|
color: var(--text-color);
|
|
20
22
|
}
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
.adm-notice-bar.adm-notice-bar-error {
|
|
33
35
|
--background-color: var(--adm-color-danger);
|
|
34
36
|
--border-color: #d9281e;
|
|
35
|
-
--text-color: #
|
|
37
|
+
--text-color: #fff;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
.adm-notice-bar.adm-notice-bar-info {
|
|
@@ -41,6 +43,12 @@
|
|
|
41
43
|
--text-color: var(--adm-color-primary);
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
.adm-notice-bar.adm-notice-bar-success {
|
|
47
|
+
--background-color: #d1fff0;
|
|
48
|
+
--border-color: #a8f0d8;
|
|
49
|
+
--text-color: var(--adm-color-success);
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
.adm-notice-bar .adm-notice-bar-left {
|
|
45
53
|
flex-shrink: 0;
|
|
46
54
|
margin-right: 16px;
|
|
@@ -89,4 +97,22 @@
|
|
|
89
97
|
padding-top: 16px;
|
|
90
98
|
padding-bottom: 16px;
|
|
91
99
|
line-height: 44px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.adm-notice-bar-neutral {
|
|
103
|
+
border-radius: var(--adm-notice-bar-border-radius);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.adm-notice-bar-rounded {
|
|
107
|
+
border-radius: 2000px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.adm-notice-bar-bordered {
|
|
111
|
+
border-left-width: var(--adm-notice-bar-border-width);
|
|
112
|
+
border-right-width: var(--adm-notice-bar-border-width);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.adm-notice-bar-without-border {
|
|
116
|
+
border-top-width: 0;
|
|
117
|
+
border-bottom-width: 0;
|
|
92
118
|
}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type NoticeBarProps = {
|
|
5
5
|
/** The type of the NoticeBar */
|
|
6
|
-
color?: 'default' | 'alert' | 'error' | 'info';
|
|
6
|
+
color?: 'default' | 'alert' | 'error' | 'success' | 'info';
|
|
7
7
|
/** TDelay to start scrolling, unit ms */
|
|
8
8
|
delay?: number;
|
|
9
9
|
/** Scroll speed, unit px/s */
|
|
@@ -24,5 +24,9 @@ export declare type NoticeBarProps = {
|
|
|
24
24
|
icon?: ReactNode;
|
|
25
25
|
/** Whether to display multiple lines */
|
|
26
26
|
wrap?: boolean;
|
|
27
|
+
/** Block shape */
|
|
28
|
+
shape?: 'rectangular' | 'neutral' | 'rounded';
|
|
29
|
+
/** Border visibility */
|
|
30
|
+
bordered?: 'block' | boolean;
|
|
27
31
|
} & NativeProps<'--background-color' | '--border-color' | '--text-color' | '--font-size' | '--icon-font-size' | '--height'>;
|
|
28
32
|
export declare const NoticeBar: React.NamedExoticComponent<NoticeBarProps>;
|
|
@@ -13,7 +13,9 @@ const defaultProps = {
|
|
|
13
13
|
delay: 2000,
|
|
14
14
|
speed: 50,
|
|
15
15
|
icon: React.createElement(SoundOutline, null),
|
|
16
|
-
wrap: false
|
|
16
|
+
wrap: false,
|
|
17
|
+
shape: 'rectangular',
|
|
18
|
+
bordered: 'block'
|
|
17
19
|
};
|
|
18
20
|
export const NoticeBar = memo(props => {
|
|
19
21
|
const {
|
|
@@ -69,8 +71,10 @@ export const NoticeBar = memo(props => {
|
|
|
69
71
|
});
|
|
70
72
|
if (!visible) return null;
|
|
71
73
|
return withNativeProps(mergedProps, React.createElement("div", {
|
|
72
|
-
className: classNames(classPrefix, `${classPrefix}-${mergedProps.color}`, {
|
|
73
|
-
[`${classPrefix}-wrap`]: mergedProps.wrap
|
|
74
|
+
className: classNames(classPrefix, `${classPrefix}-${mergedProps.color}`, `${classPrefix}-${mergedProps.shape}`, {
|
|
75
|
+
[`${classPrefix}-wrap`]: mergedProps.wrap,
|
|
76
|
+
[`${classPrefix}-bordered`]: mergedProps.bordered === true,
|
|
77
|
+
[`${classPrefix}-without-border`]: mergedProps.bordered === false
|
|
74
78
|
}),
|
|
75
79
|
onClick: mergedProps.onClick
|
|
76
80
|
}, mergedProps.icon && React.createElement("span", {
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
import { InputProps, InputRef } from '../input';
|
|
5
5
|
export declare type SearchBarRef = InputRef;
|
|
6
|
-
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear' | 'onCompositionStart' | 'onCompositionEnd'> & {
|
|
6
|
+
export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'onClear' | 'onCompositionStart' | 'onCompositionEnd' | 'autoFocus'> & {
|
|
7
7
|
value?: string;
|
|
8
8
|
defaultValue?: string;
|
|
9
9
|
maxLength?: number;
|
|
@@ -22,7 +22,7 @@ export declare type SearchBarProps = Pick<InputProps, 'onFocus' | 'onBlur' | 'on
|
|
|
22
22
|
onChange?: (val: string) => void;
|
|
23
23
|
onCancel?: () => void;
|
|
24
24
|
} & NativeProps<'--background' | '--border-radius' | '--placeholder-color' | '--height' | '--padding-left'>;
|
|
25
|
-
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onClear"> & {
|
|
25
|
+
export declare const SearchBar: React.ForwardRefExoticComponent<Pick<InputProps, "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "autoFocus" | "onClear"> & {
|
|
26
26
|
value?: string | undefined;
|
|
27
27
|
defaultValue?: string | undefined;
|
|
28
28
|
maxLength?: number | undefined;
|
|
@@ -87,6 +87,7 @@ export const SearchBar = forwardRef((props, ref) => {
|
|
|
87
87
|
value: value,
|
|
88
88
|
onChange: setValue,
|
|
89
89
|
maxLength: mergedProps.maxLength,
|
|
90
|
+
autoFocus: mergedProps.autoFocus,
|
|
90
91
|
placeholder: mergedProps.placeholder,
|
|
91
92
|
clearable: mergedProps.clearable,
|
|
92
93
|
onlyShowClearWhenFocus: mergedProps.onlyShowClearWhenFocus,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
.adm-segmented {
|
|
2
|
+
--segmented-background: var(--adm-color-fill-content);
|
|
3
|
+
--segmented-item-color: var(--adm-color-text-secondary);
|
|
4
|
+
--segmented-item-selected-background: var(--adm-color-background);
|
|
5
|
+
--segmented-item-selected-color: var(--adm-color-text);
|
|
6
|
+
--segmented-item-disabled-color: var(--adm-color-weak);
|
|
7
|
+
--transition-time-function: cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
8
|
+
display: inline-block;
|
|
9
|
+
padding: 4px;
|
|
10
|
+
color: var(--segmented-item-color);
|
|
11
|
+
background-color: var(--segmented-background);
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
transition: all 0.3s var(--transition-time-function);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.adm-segmented-group {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: stretch;
|
|
20
|
+
justify-items: flex-start;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.adm-segmented.adm-segmented-block {
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.adm-segmented.adm-segmented-block .adm-segmented-item {
|
|
29
|
+
flex: 1;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.adm-segmented-item {
|
|
34
|
+
position: relative;
|
|
35
|
+
text-align: center;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: color 0.3s var(--transition-time-function);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.adm-segmented-item-selected {
|
|
41
|
+
background-color: var(--segmented-item-selected-background);
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
44
|
+
color: var(--segmented-item-selected-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.adm-segmented-item-label {
|
|
48
|
+
min-height: 20px;
|
|
49
|
+
padding: 0 22px;
|
|
50
|
+
line-height: 56px;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
text-overflow: ellipsis;
|
|
54
|
+
word-break: keep-all;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.adm-segmented-item-icon + * {
|
|
58
|
+
margin-left: 12px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.adm-segmented-item-input {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 0;
|
|
64
|
+
left: 0;
|
|
65
|
+
width: 0;
|
|
66
|
+
height: 0;
|
|
67
|
+
opacity: 0;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.adm-segmented-item-disabled {
|
|
72
|
+
color: var(--segmented-item-disabled-color);
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.adm-segmented-thumb {
|
|
77
|
+
background-color: var(--segmented-item-selected-background);
|
|
78
|
+
border-radius: 4px;
|
|
79
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
width: 0;
|
|
84
|
+
height: 100%;
|
|
85
|
+
padding: 8px 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.adm-segmented-thumb-motion-appear-active {
|
|
89
|
+
transition: transform 0.3s var(--transition-time-function), width 0.3s var(--transition-time-function);
|
|
90
|
+
will-change: transform, width;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ---- mixins part starts ---- */
|
|
94
|
+
|
|
95
|
+
.segmented-disabled-item {
|
|
96
|
+
color: var(--segmented-item-disabled-color);
|
|
97
|
+
cursor: not-allowed;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.segmented-item-selected {
|
|
101
|
+
background-color: var(--segmented-item-selected-background);
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.segmented-text-ellipsis {
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
text-overflow: ellipsis;
|
|
110
|
+
word-break: keep-all;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ---- mixins part ends ---- */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SegmentedLabeledOption as RcSegmentedLabeledOption, SegmentedProps as RCSegmentedProps, SegmentedRawOption } from 'rc-segmented';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { NativeProps } from '../../utils/native-props';
|
|
4
|
+
export type { SegmentedValue } from 'rc-segmented';
|
|
5
|
+
interface SegmentedLabeledOptionWithoutIcon extends RcSegmentedLabeledOption {
|
|
6
|
+
label: RcSegmentedLabeledOption['label'];
|
|
7
|
+
}
|
|
8
|
+
interface SegmentedLabeledOptionWithIcon extends Omit<RcSegmentedLabeledOption, 'label'> {
|
|
9
|
+
label?: RcSegmentedLabeledOption['label'];
|
|
10
|
+
/** Set icon for Segmented item */
|
|
11
|
+
icon: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare type SegmentedLabeledOption = SegmentedLabeledOptionWithIcon | SegmentedLabeledOptionWithoutIcon;
|
|
14
|
+
interface InternalSegmentedProps extends Omit<RCSegmentedProps, 'size' | 'options'> {
|
|
15
|
+
options: (SegmentedRawOption | SegmentedLabeledOption)[];
|
|
16
|
+
/** Option to fit width to its parent's width */
|
|
17
|
+
block?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare type SegmentedProps = InternalSegmentedProps & NativeProps<'--segmented-background' | '--segmented-item-color' | '--segmented-item-selected-background' | '--segmented-item-selected-color' | '--segmented-item-disabled-color'>;
|
|
20
|
+
declare const Segmented: React.ForwardRefExoticComponent<Omit<SegmentedProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export { Segmented };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import RcSegmented from 'rc-segmented';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
6
|
+
function isSegmentedLabeledOptionWithIcon(option) {
|
|
7
|
+
return typeof option === 'object' && !!(option === null || option === void 0 ? void 0 : option.icon);
|
|
8
|
+
}
|
|
9
|
+
const classPrefix = `adm-segmented`;
|
|
10
|
+
const Segmented = React.forwardRef((props, ref) => {
|
|
11
|
+
const {
|
|
12
|
+
prefixCls: customizePrefixCls,
|
|
13
|
+
className,
|
|
14
|
+
block,
|
|
15
|
+
options = []
|
|
16
|
+
} = props,
|
|
17
|
+
restProps = __rest(props
|
|
18
|
+
// syntactic sugar to support `icon` for Segmented Item
|
|
19
|
+
, ["prefixCls", "className", "block", "options"]);
|
|
20
|
+
// syntactic sugar to support `icon` for Segmented Item
|
|
21
|
+
const extendedOptions = React.useMemo(() => options.map(option => {
|
|
22
|
+
if (isSegmentedLabeledOptionWithIcon(option)) {
|
|
23
|
+
const {
|
|
24
|
+
icon,
|
|
25
|
+
label
|
|
26
|
+
} = option,
|
|
27
|
+
restOption = __rest(option, ["icon", "label"]);
|
|
28
|
+
return Object.assign(Object.assign({}, restOption), {
|
|
29
|
+
label: React.createElement(React.Fragment, null, React.createElement("span", {
|
|
30
|
+
className: `${classPrefix}-item-icon`
|
|
31
|
+
}, icon), label && React.createElement("span", null, label))
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return option;
|
|
35
|
+
}), [options, classPrefix]);
|
|
36
|
+
return withNativeProps(props, React.createElement(RcSegmented, Object.assign({}, restProps, {
|
|
37
|
+
className: classNames(className, {
|
|
38
|
+
[`${classPrefix}-block`]: block
|
|
39
|
+
}),
|
|
40
|
+
options: extendedOptions,
|
|
41
|
+
ref: ref,
|
|
42
|
+
prefixCls: classPrefix
|
|
43
|
+
})));
|
|
44
|
+
});
|
|
45
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
46
|
+
Segmented.displayName = 'Segmented';
|
|
47
|
+
}
|
|
48
|
+
export { Segmented };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.adm-segmented {
|
|
2
|
+
color: #666;
|
|
3
|
+
background-color: #f5f5f5;
|
|
4
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.adm-segmented-item {
|
|
8
|
+
transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.adm-segmented-item-selected {
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.adm-segmented-item-disabled {
|
|
18
|
+
color: #999;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.adm-segmented-thumb {
|
|
22
|
+
background-color: #fff;
|
|
23
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.adm-segmented-thumb-motion-appear-active {
|
|
27
|
+
transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* ---- mixins part starts ---- */
|
|
31
|
+
|
|
32
|
+
.segmented-disabled-item {
|
|
33
|
+
color: #999;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.segmented-item-selected {
|
|
37
|
+
background-color: #fff;
|
|
38
|
+
box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05), 0 2px 8px -2px rgba(0, 0, 0, 0.07), 0 0 2px 0 rgba(0, 0, 0, 0.08);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ---- mixins part ends ---- */
|
|
@@ -5,6 +5,7 @@ export declare type TabBarItemProps = {
|
|
|
5
5
|
icon?: ReactNode | ((active: boolean) => ReactNode);
|
|
6
6
|
title?: ReactNode | ((active: boolean) => ReactNode);
|
|
7
7
|
badge?: BadgeProps['content'];
|
|
8
|
+
onClick?: () => void;
|
|
8
9
|
} & NativeProps;
|
|
9
10
|
export declare const TabBarItem: FC<TabBarItemProps>;
|
|
10
11
|
export declare type TabBarProps = {
|
|
@@ -66,11 +66,13 @@ export const TabBar = p => {
|
|
|
66
66
|
return withNativeProps(item.props, React.createElement("div", {
|
|
67
67
|
key: item.key,
|
|
68
68
|
onClick: () => {
|
|
69
|
+
var _a, _b;
|
|
69
70
|
const {
|
|
70
71
|
key
|
|
71
72
|
} = item;
|
|
72
73
|
if (key === undefined || key === null) return;
|
|
73
74
|
setActiveKey(key.toString());
|
|
75
|
+
(_b = (_a = item.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
74
76
|
},
|
|
75
77
|
className: classNames(`${classPrefix}-item`, {
|
|
76
78
|
[`${classPrefix}-item-active`]: active
|
|
@@ -153,7 +153,7 @@ export const Tabs = p => {
|
|
|
153
153
|
}, []);
|
|
154
154
|
useIsomorphicUpdateLayoutEffect(() => {
|
|
155
155
|
animate();
|
|
156
|
-
}, [activeKey]);
|
|
156
|
+
}, [activeKey, isRTL, props.activeLineMode]);
|
|
157
157
|
useResizeEffect(() => {
|
|
158
158
|
animate(!x.isAnimating);
|
|
159
159
|
}, tabListContainerRef);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { InternalToast } from './toast';
|
|
3
|
-
import { mergeProps } from '../../utils/with-default-props';
|
|
4
2
|
import { renderImperatively } from '../../utils/render-imperatively';
|
|
3
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
4
|
+
import { InternalToast } from './toast';
|
|
5
5
|
let currentHandler = null;
|
|
6
6
|
let currentTimeout = null;
|
|
7
7
|
const defaultProps = {
|
|
@@ -11,6 +11,7 @@ const defaultProps = {
|
|
|
11
11
|
};
|
|
12
12
|
const ToastInner = props => React.createElement(InternalToast, Object.assign({}, props));
|
|
13
13
|
export function show(p) {
|
|
14
|
+
var _a;
|
|
14
15
|
const props = mergeProps(defaultProps, typeof p === 'string' ? {
|
|
15
16
|
content: p
|
|
16
17
|
} : p);
|
|
@@ -20,7 +21,12 @@ export function show(p) {
|
|
|
20
21
|
}
|
|
21
22
|
}));
|
|
22
23
|
if (currentHandler) {
|
|
23
|
-
currentHandler.
|
|
24
|
+
if ((_a = currentHandler.isRendered) === null || _a === void 0 ? void 0 : _a.call(currentHandler)) {
|
|
25
|
+
currentHandler.replace(element);
|
|
26
|
+
} else {
|
|
27
|
+
currentHandler.close();
|
|
28
|
+
currentHandler = renderImperatively(element);
|
|
29
|
+
}
|
|
24
30
|
} else {
|
|
25
31
|
currentHandler = renderImperatively(element);
|
|
26
32
|
}
|