@arco-design/mobile-react 2.21.2 → 2.22.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/CHANGELOG.md +30 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/index.d.ts +1 -0
- package/cjs/_helpers/index.js +9 -0
- package/cjs/_helpers/react-dom.d.ts +13 -0
- package/cjs/_helpers/react-dom.js +65 -0
- package/cjs/_helpers/render.d.ts +10 -0
- package/cjs/_helpers/render.js +40 -0
- package/cjs/action-sheet/index.d.ts +1 -1
- package/cjs/ellipsis/components/js-ellipsis.js +7 -1
- package/cjs/image-picker/index.js +0 -1
- package/cjs/image-picker/style/css/index.d.ts +1 -0
- package/cjs/image-picker/style/css/index.js +2 -0
- package/cjs/image-picker/style/index.d.ts +1 -0
- package/cjs/image-picker/style/index.js +2 -0
- package/cjs/image-preview/index.d.ts +2 -10
- package/cjs/image-preview/methods.js +4 -11
- package/cjs/masking/index.d.ts +10 -0
- package/cjs/masking/methods.js +4 -11
- package/cjs/notify/methods.js +6 -9
- package/cjs/popover/hooks/useEvent.js +6 -6
- package/cjs/swipe-action/index.js +21 -3
- package/cjs/tabs/index.d.ts +3 -463
- package/cjs/tabs/index.js +15 -2
- package/cjs/tabs/tab-cell-underline.d.ts +4 -0
- package/cjs/tabs/tab-cell-underline.js +234 -0
- package/cjs/tabs/tab-cell.d.ts +1 -85
- package/cjs/tabs/tab-cell.js +57 -201
- package/cjs/tabs/tab-pane.d.ts +2 -38
- package/cjs/tabs/type.d.ts +601 -0
- package/cjs/tabs/type.js +3 -0
- package/cjs/toast/methods.js +9 -12
- package/dist/index.js +439 -271
- package/dist/index.min.js +3 -3
- package/esm/_helpers/index.d.ts +1 -0
- package/esm/_helpers/index.js +1 -0
- package/esm/_helpers/react-dom.d.ts +13 -0
- package/esm/_helpers/react-dom.js +57 -0
- package/esm/_helpers/render.d.ts +10 -0
- package/esm/_helpers/render.js +29 -0
- package/esm/action-sheet/index.d.ts +1 -1
- package/esm/ellipsis/components/js-ellipsis.js +7 -1
- package/esm/image-picker/index.js +0 -1
- package/esm/image-picker/style/css/index.d.ts +1 -0
- package/esm/image-picker/style/css/index.js +1 -0
- package/esm/image-picker/style/index.d.ts +1 -0
- package/esm/image-picker/style/index.js +1 -0
- package/esm/image-preview/index.d.ts +2 -10
- package/esm/image-preview/methods.js +3 -9
- package/esm/masking/index.d.ts +10 -0
- package/esm/masking/methods.js +3 -9
- package/esm/notify/methods.js +6 -7
- package/esm/popover/hooks/useEvent.js +6 -6
- package/esm/swipe-action/index.js +21 -3
- package/esm/tabs/index.d.ts +3 -463
- package/esm/tabs/index.js +7 -3
- package/esm/tabs/tab-cell-underline.d.ts +4 -0
- package/esm/tabs/tab-cell-underline.js +218 -0
- package/esm/tabs/tab-cell.d.ts +1 -85
- package/esm/tabs/tab-cell.js +59 -204
- package/esm/tabs/tab-pane.d.ts +2 -38
- package/esm/tabs/type.d.ts +601 -0
- package/esm/tabs/type.js +1 -0
- package/esm/toast/methods.js +8 -9
- package/package.json +3 -3
- package/umd/_helpers/index.d.ts +1 -0
- package/umd/_helpers/index.js +10 -4
- package/umd/_helpers/react-dom.d.ts +13 -0
- package/umd/_helpers/react-dom.js +78 -0
- package/umd/_helpers/render.d.ts +10 -0
- package/umd/_helpers/render.js +51 -0
- package/umd/action-sheet/index.d.ts +1 -1
- package/umd/ellipsis/components/js-ellipsis.js +7 -1
- package/umd/image-picker/index.js +0 -1
- package/umd/image-picker/style/css/index.d.ts +1 -0
- package/umd/image-picker/style/css/index.js +4 -4
- package/umd/image-picker/style/index.d.ts +1 -0
- package/umd/image-picker/style/index.js +4 -4
- package/umd/image-preview/index.d.ts +2 -10
- package/umd/image-preview/methods.js +6 -13
- package/umd/masking/index.d.ts +10 -0
- package/umd/masking/methods.js +6 -13
- package/umd/notify/methods.js +9 -12
- package/umd/popover/hooks/useEvent.js +6 -6
- package/umd/swipe-action/index.js +21 -3
- package/umd/tabs/index.d.ts +3 -463
- package/umd/tabs/index.js +16 -6
- package/umd/tabs/tab-cell-underline.d.ts +4 -0
- package/umd/tabs/tab-cell-underline.js +242 -0
- package/umd/tabs/tab-cell.d.ts +1 -85
- package/umd/tabs/tab-cell.js +60 -205
- package/umd/tabs/tab-pane.d.ts +2 -38
- package/umd/tabs/type.d.ts +601 -0
- package/umd/tabs/type.js +17 -0
- package/umd/toast/methods.js +11 -14
package/umd/tabs/tab-cell.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers"], factory);
|
3
|
+
define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers", "./tab-cell-underline"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"));
|
5
|
+
factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"), require("./tab-cell-underline"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers);
|
10
|
+
factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers, global.tabCellUnderline);
|
11
11
|
global.tabCell = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers) {
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers, _tabCellUnderline) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
@@ -19,6 +19,7 @@
|
|
19
19
|
_exports.default = void 0;
|
20
20
|
_extends2 = _interopRequireDefault(_extends2);
|
21
21
|
_react = _interopRequireWildcard(_react);
|
22
|
+
_tabCellUnderline = _interopRequireDefault(_tabCellUnderline);
|
22
23
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
25
|
|
@@ -69,46 +70,33 @@
|
|
69
70
|
renderTabBarInner = props.renderTabBarInner,
|
70
71
|
tabBarStyle = props.tabBarStyle,
|
71
72
|
tabBarClass = props.tabBarClass,
|
72
|
-
translateZ = props.translateZ
|
73
|
+
translateZ = props.translateZ,
|
74
|
+
tabBarStopPropagation = props.tabBarStopPropagation;
|
73
75
|
var prefix = prefixCls + "-tab-cell";
|
74
76
|
var domRef = (0, _react.useRef)(null);
|
75
|
-
var
|
76
|
-
var timeRef = (0, _react.useRef)(0);
|
77
|
+
var underlineRef = (0, _react.useRef)(null);
|
77
78
|
var allCellRectRef = (0, _react.useRef)([]);
|
78
79
|
|
79
|
-
var _useState = (0, _react.useState)(
|
80
|
-
|
81
|
-
|
80
|
+
var _useState = (0, _react.useState)(false),
|
81
|
+
showLine = _useState[0],
|
82
|
+
setShowLine = _useState[1];
|
82
83
|
|
83
|
-
var
|
84
|
-
|
85
|
-
|
86
|
-
setCaterpillar = _useRefState[2];
|
84
|
+
var _useState2 = (0, _react.useState)(false),
|
85
|
+
hasOverflow = _useState2[0],
|
86
|
+
setHasOverflow = _useState2[1];
|
87
87
|
|
88
|
-
var
|
89
|
-
caterpillarDelay = _useState2[0],
|
90
|
-
setCaterpillarDelay = _useState2[1];
|
91
|
-
|
92
|
-
var _useState3 = (0, _react.useState)(false),
|
93
|
-
hasOverflow = _useState3[0],
|
94
|
-
setHasOverflow = _useState3[1];
|
95
|
-
|
96
|
-
var _useState4 = (0, _react.useState)(function () {
|
88
|
+
var _useState3 = (0, _react.useState)(function () {
|
97
89
|
return tabs.length < overflowThreshold ? tabBarArrange : 'start';
|
98
90
|
}),
|
99
|
-
originArrange =
|
100
|
-
setOriginArrange =
|
91
|
+
originArrange = _useState3[0],
|
92
|
+
setOriginArrange = _useState3[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
|
101
93
|
|
102
94
|
|
103
|
-
var
|
95
|
+
var _useState4 = (0, _react.useState)(function () {
|
104
96
|
return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
|
105
97
|
}),
|
106
|
-
showTab =
|
107
|
-
setShowTab =
|
108
|
-
|
109
|
-
var _useState6 = (0, _react.useState)(false),
|
110
|
-
showLine = _useState6[0],
|
111
|
-
setShowLine = _useState6[1];
|
98
|
+
showTab = _useState4[0],
|
99
|
+
setShowTab = _useState4[1];
|
112
100
|
|
113
101
|
var isVertical = tabDirection === 'vertical';
|
114
102
|
var isLine = (type || '').indexOf('line') !== -1;
|
@@ -122,42 +110,7 @@
|
|
122
110
|
var cellGutter = isCard ? void 0 : tabBarGutter;
|
123
111
|
var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
|
124
112
|
var wrapSize = isVertical ? wrapWidth : wrapHeight;
|
125
|
-
var translateZStr = translateZ ? ' translateZ(0)' : '';
|
126
113
|
var system = (0, _helpers.useSystem)();
|
127
|
-
var maxScaleWithDefault = caterpillarMaxScale || 2;
|
128
|
-
var animationKey = (0, _react.useMemo)(function () {
|
129
|
-
if (!showUnderline || !useCaterpillar) {
|
130
|
-
return '';
|
131
|
-
}
|
132
|
-
|
133
|
-
if (caterpillarProperty === 'size') {
|
134
|
-
return "tabsCaterpillar" + (isVertical ? 'W' : 'H') + maxScaleWithDefault;
|
135
|
-
}
|
136
|
-
|
137
|
-
if (caterpillarMaxScale) {
|
138
|
-
return "tabsCaterpillar" + (isVertical ? 'X' : 'Y') + caterpillarMaxScale;
|
139
|
-
}
|
140
|
-
|
141
|
-
return '';
|
142
|
-
}, [showUnderline, useCaterpillar, isVertical, caterpillarMaxScale, caterpillarProperty]);
|
143
|
-
(0, _react.useEffect)(function () {
|
144
|
-
if (!animationKey) {
|
145
|
-
return;
|
146
|
-
}
|
147
|
-
|
148
|
-
var dir = isVertical ? 'X' : 'Y';
|
149
|
-
|
150
|
-
if (caterpillarProperty === 'size') {
|
151
|
-
var attr = isVertical ? 'width' : 'height';
|
152
|
-
(0, _mobileUtils.addCssKeyframes)(animationKey, "{\n 0% {\n " + attr + ": 100%;\n }\n 50% {\n " + attr + ": " + 100 * maxScaleWithDefault + "%;\n }\n 100% {\n " + attr + ": 100%;\n }\n }");
|
153
|
-
return;
|
154
|
-
}
|
155
|
-
|
156
|
-
(0, _mobileUtils.addCssKeyframes)(animationKey, "{\n 0% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n 50% {\n transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n -webkit-transform: scale" + dir + "(" + caterpillarMaxScale + ")" + translateZStr + ";\n }\n 100% {\n transform: scale" + dir + "(1)" + translateZStr + ";\n -webkit-transform: scale" + dir + "(1)" + translateZStr + ";\n }\n }");
|
157
|
-
return function () {
|
158
|
-
(0, _mobileUtils.removeCssStyleDom)(animationKey);
|
159
|
-
};
|
160
|
-
}, [animationKey]);
|
161
114
|
(0, _react.useEffect)(function () {
|
162
115
|
(0, _mobileUtils.nextTick)(function () {
|
163
116
|
setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
|
@@ -170,12 +123,11 @@
|
|
170
123
|
setShowLine(true);
|
171
124
|
});
|
172
125
|
}, [domRef.current, wrapSize, tabs]);
|
173
|
-
(0, _react.useEffect)(function () {
|
174
|
-
resetUnderlineStyle();
|
175
|
-
}, [useCaterpillar, caterpillar, cellTrans, duration, tabDirection, wrapWidth, wrapHeight, distance, animationKey, caterpillarDelay]);
|
176
126
|
(0, _react.useEffect)(function () {
|
177
127
|
(0, _mobileUtils.nextTick)(function () {
|
178
|
-
|
128
|
+
var _underlineRef$current;
|
129
|
+
|
130
|
+
(_underlineRef$current = underlineRef.current) == null ? void 0 : _underlineRef$current.resetUnderlineStyle();
|
179
131
|
});
|
180
132
|
}, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
|
181
133
|
(0, _react.useImperativeHandle)(ref, function () {
|
@@ -184,10 +136,18 @@
|
|
184
136
|
scrollTo: scrollTo,
|
185
137
|
scrollToCenter: scrollToCenter,
|
186
138
|
hasOverflow: hasOverflow,
|
187
|
-
setCaterpillarAnimate: setCaterpillarAnimate
|
188
|
-
|
139
|
+
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
140
|
+
var _underlineRef$current2;
|
141
|
+
|
142
|
+
return (_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.setCaterpillarAnimate(ratio);
|
143
|
+
},
|
144
|
+
resetUnderlineStyle: function resetUnderlineStyle() {
|
145
|
+
var _underlineRef$current3;
|
146
|
+
|
147
|
+
return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.resetUnderlineStyle();
|
148
|
+
}
|
189
149
|
};
|
190
|
-
}, [scrollToCenter, scrollTo, hasOverflow
|
150
|
+
}, [scrollToCenter, scrollTo, hasOverflow]);
|
191
151
|
(0, _react.useEffect)(function () {
|
192
152
|
if (wrapSize && tabBarScrollChance !== 'none') {
|
193
153
|
setTimeout(function () {
|
@@ -203,28 +163,18 @@
|
|
203
163
|
return e.stopPropagation();
|
204
164
|
};
|
205
165
|
|
206
|
-
if (isVertical && hasOverflow && domRef.current) {
|
166
|
+
if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
|
207
167
|
domRef.current.addEventListener('touchstart', stopFunc);
|
208
168
|
domRef.current.addEventListener('touchmove', stopFunc);
|
209
169
|
}
|
210
170
|
|
211
171
|
return function () {
|
212
|
-
if (isVertical && hasOverflow && domRef.current) {
|
172
|
+
if (isVertical && hasOverflow && domRef.current && tabBarStopPropagation) {
|
213
173
|
domRef.current.removeEventListener('touchstart', stopFunc);
|
214
174
|
domRef.current.removeEventListener('touchmove', stopFunc);
|
215
175
|
}
|
216
176
|
};
|
217
177
|
}, [hasOverflow]);
|
218
|
-
(0, _react.useEffect)(function () {
|
219
|
-
if (jumpingDis && useCaterpillar && system !== 'ios') {
|
220
|
-
var movedRatio = wrapWidth ? jumpingDis / wrapWidth : 0;
|
221
|
-
setCaterpillarAnimate(movedRatio);
|
222
|
-
}
|
223
|
-
}, [jumpingDis]);
|
224
|
-
|
225
|
-
function resetUnderlineStyle() {
|
226
|
-
setUnderlineStyle(getUnderlineStyle());
|
227
|
-
}
|
228
178
|
|
229
179
|
function setCellOverflow() {
|
230
180
|
var overflow = false;
|
@@ -292,69 +242,6 @@
|
|
292
242
|
}
|
293
243
|
}
|
294
244
|
|
295
|
-
function getUnderlineStyle() {
|
296
|
-
var transStyle = {};
|
297
|
-
|
298
|
-
if (useCaterpillar) {
|
299
|
-
transStyle.animationDuration = duration + "ms";
|
300
|
-
}
|
301
|
-
|
302
|
-
if (caterpillarRef.current && animationKey) {
|
303
|
-
transStyle.animationName = animationKey;
|
304
|
-
}
|
305
|
-
|
306
|
-
if (caterpillarDelay) {
|
307
|
-
transStyle.animationDelay = "-" + caterpillarDelay + "ms";
|
308
|
-
}
|
309
|
-
|
310
|
-
var lineStyle = getLineStyle();
|
311
|
-
return {
|
312
|
-
outer: (0, _helpers.getStyleWithVendor)((0, _extends2.default)({
|
313
|
-
transitionDuration: cellTrans ? duration + "ms" : '0ms'
|
314
|
-
}, lineStyle.outer || {})),
|
315
|
-
inner: (0, _helpers.getStyleWithVendor)((0, _extends2.default)({}, transStyle, lineStyle.inner || {}))
|
316
|
-
};
|
317
|
-
}
|
318
|
-
|
319
|
-
function getLineStyle() {
|
320
|
-
var _ref;
|
321
|
-
|
322
|
-
if (!lineRef.current || !domRef.current) {
|
323
|
-
return {};
|
324
|
-
}
|
325
|
-
|
326
|
-
var currentLeft = getLineLeft(activeIndex);
|
327
|
-
var descIndex = getDescIndex();
|
328
|
-
var descLeft = getLineLeft(descIndex);
|
329
|
-
var moveRatio = wrapWidth ? distance / wrapWidth : 0;
|
330
|
-
var leftOffset = moveRatio * (currentLeft - descLeft);
|
331
|
-
var direc = isVertical ? 'X' : 'Y';
|
332
|
-
var transStyle = useCaterpillar && !jumpingDis ? caterpillarProperty === 'size' ? (_ref = {}, _ref[isVertical ? 'width' : 'height'] = 100 * getLineScale(moveRatio) + "%", _ref.willChange = 'width', _ref) : {
|
333
|
-
transform: "scale" + direc + "(" + getLineScale(moveRatio) + ")"
|
334
|
-
} : {};
|
335
|
-
var outerSize = isVertical ? {
|
336
|
-
width: underlineSize,
|
337
|
-
height: underlineThick
|
338
|
-
} : {
|
339
|
-
height: underlineSize,
|
340
|
-
width: underlineThick
|
341
|
-
};
|
342
|
-
return {
|
343
|
-
outer: (0, _extends2.default)({
|
344
|
-
transform: "translate" + direc + "(" + (distance > 0 ? currentLeft - leftOffset : currentLeft + leftOffset) + "px)" + translateZStr
|
345
|
-
}, outerSize),
|
346
|
-
inner: (0, _extends2.default)({}, transStyle)
|
347
|
-
};
|
348
|
-
}
|
349
|
-
|
350
|
-
function getLineLeft(index) {
|
351
|
-
var _lineRef$current, _lineRef$current2;
|
352
|
-
|
353
|
-
var offsetSize = isVertical ? (_lineRef$current = lineRef.current) == null ? void 0 : _lineRef$current.offsetWidth : (_lineRef$current2 = lineRef.current) == null ? void 0 : _lineRef$current2.offsetHeight;
|
354
|
-
var lineWidth = offsetSize || 0;
|
355
|
-
return getTabCenterLeft(index) - lineWidth / 2;
|
356
|
-
}
|
357
|
-
|
358
245
|
function getTabCenterLeft(index) {
|
359
246
|
var currentTab = allCellRectRef.current[index] || {};
|
360
247
|
var currentTabWidth = (isVertical ? currentTab.width : currentTab.height) || 0;
|
@@ -362,48 +249,6 @@
|
|
362
249
|
return currentTabLeft + currentTabWidth / 2;
|
363
250
|
}
|
364
251
|
|
365
|
-
function getLineScale(ratio) {
|
366
|
-
var absRatio = Math.abs(ratio);
|
367
|
-
return absRatio > 0.5 ? (1 - absRatio) * 2 * (maxScaleWithDefault - 1) + 1 : absRatio * 2 * (maxScaleWithDefault - 1) + 1;
|
368
|
-
}
|
369
|
-
|
370
|
-
function getDescIndex() {
|
371
|
-
if (distance > 0) {
|
372
|
-
return activeIndex - 1;
|
373
|
-
}
|
374
|
-
|
375
|
-
if (distance < 0) {
|
376
|
-
return activeIndex + 1;
|
377
|
-
}
|
378
|
-
|
379
|
-
return activeIndex;
|
380
|
-
}
|
381
|
-
|
382
|
-
function setCaterpillarAnimate(movedRatio) {
|
383
|
-
if (movedRatio === void 0) {
|
384
|
-
movedRatio = 0;
|
385
|
-
}
|
386
|
-
|
387
|
-
if (!duration) {
|
388
|
-
return;
|
389
|
-
}
|
390
|
-
|
391
|
-
var movedTime = (duration || 0) * Math.abs(movedRatio);
|
392
|
-
setCaterpillarDelay(movedTime);
|
393
|
-
(0, _mobileUtils.nextTick)(function () {
|
394
|
-
setCaterpillar(true);
|
395
|
-
});
|
396
|
-
|
397
|
-
if (timeRef.current) {
|
398
|
-
clearTimeout(timeRef.current);
|
399
|
-
}
|
400
|
-
|
401
|
-
timeRef.current = window.setTimeout(function () {
|
402
|
-
setCaterpillar(false);
|
403
|
-
setCaterpillarDelay(0);
|
404
|
-
}, (duration || 0) - movedTime + 20);
|
405
|
-
}
|
406
|
-
|
407
252
|
function getCellPadding(pType) {
|
408
253
|
if (typeof cellPadding === 'object') {
|
409
254
|
return cellPadding[pType];
|
@@ -444,20 +289,30 @@
|
|
444
289
|
return null;
|
445
290
|
}
|
446
291
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
292
|
+
var lineProps = {
|
293
|
+
prefix: prefix,
|
294
|
+
showLine: showLine,
|
295
|
+
useCaterpillar: useCaterpillar,
|
296
|
+
distance: distance,
|
297
|
+
tabDirection: tabDirection,
|
298
|
+
underlineInnerStyle: underlineInnerStyle,
|
299
|
+
cellTrans: cellTrans,
|
300
|
+
duration: duration,
|
301
|
+
activeIndex: activeIndex,
|
302
|
+
wrapWidth: wrapWidth,
|
303
|
+
wrapHeight: wrapHeight,
|
304
|
+
jumpingDis: jumpingDis,
|
305
|
+
caterpillarMaxScale: caterpillarMaxScale,
|
306
|
+
caterpillarProperty: caterpillarProperty,
|
307
|
+
translateZ: translateZ,
|
308
|
+
underlineSize: underlineSize,
|
309
|
+
underlineThick: underlineThick,
|
310
|
+
renderUnderline: renderUnderline
|
311
|
+
};
|
312
|
+
return /*#__PURE__*/_react.default.createElement(_tabCellUnderline.default, (0, _extends2.default)({
|
313
|
+
ref: underlineRef,
|
314
|
+
getTabCenterLeft: getTabCenterLeft
|
315
|
+
}, lineProps));
|
461
316
|
}
|
462
317
|
|
463
318
|
var cellInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabs.map(function (tab, index) {
|
package/umd/tabs/tab-pane.d.ts
CHANGED
@@ -1,40 +1,4 @@
|
|
1
|
-
import React
|
2
|
-
import {
|
3
|
-
export interface TabPaneProps extends Pick<TabsProps, 'duration' | 'transitionDuration' | 'lazyloadCount' | 'hideContentStyle' | 'renderHideContent' | 'mode' | 'tabPaneClass' | 'tabPaneStyle' | 'tabPaneExtra' | 'getScrollContainer' | 'scrollThrottle' | 'scrollOffset' | 'goLastWhenScrollBottom' | 'scrollVertical' | 'translateZ' | 'fullScreen' | 'autoHeight' | 'onScroll'> {
|
4
|
-
prefixCls?: string;
|
5
|
-
panes: ReactNodeArray;
|
6
|
-
activeIndex: number;
|
7
|
-
activeIndexRef: React.MutableRefObject<number>;
|
8
|
-
tabDirection: 'horizontal' | 'vertical';
|
9
|
-
distance: number;
|
10
|
-
wrapWidth: number;
|
11
|
-
wrapHeight: number;
|
12
|
-
handlePaneTouchEnd: (e: any) => void;
|
13
|
-
paneTrans: boolean;
|
14
|
-
swipeable: boolean;
|
15
|
-
changeIndex: (newIndex: number, from?: string) => void;
|
16
|
-
}
|
17
|
-
export interface TabPaneRef {
|
18
|
-
/**
|
19
|
-
* 外层元素 DOM
|
20
|
-
* @en Outer element DOM
|
21
|
-
*/
|
22
|
-
dom: HTMLDivElement | null;
|
23
|
-
/**
|
24
|
-
* 获取当前 transitionDuration
|
25
|
-
* @en Get the current transitionDuration
|
26
|
-
*/
|
27
|
-
getTransition: () => number;
|
28
|
-
/**
|
29
|
-
* 滚动到指定 Tab,仅滚动监听模式下可用
|
30
|
-
* @en Scroll to the specified Tab, only available in scroll monitor mode
|
31
|
-
*/
|
32
|
-
scrollToIndex: (index: number, rightNow?: boolean) => void;
|
33
|
-
/**
|
34
|
-
* autoHeight=true时,更新当前tabpane高度
|
35
|
-
* @en Update the current tabpane height, which takes effect when autoHeight=true
|
36
|
-
*/
|
37
|
-
setCurrentHeight: () => void;
|
38
|
-
}
|
1
|
+
import React from 'react';
|
2
|
+
import { TabPaneProps, TabPaneRef } from './type';
|
39
3
|
declare const TabPane: React.ForwardRefExoticComponent<TabPaneProps & React.RefAttributes<TabPaneRef>>;
|
40
4
|
export default TabPane;
|