@arco-design/mobile-react 2.30.8 → 2.30.10
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 +25 -0
- package/README.en-US.md +70 -2
- package/README.md +69 -2
- package/cjs/_helpers/render.d.ts +6 -1
- package/cjs/_helpers/render.js +24 -2
- package/cjs/carousel/index.js +3 -0
- package/cjs/image/style/index.less +2 -4
- package/cjs/image-preview/methods.js +2 -7
- package/cjs/masking/methods.js +12 -6
- package/cjs/picker/index.js +3 -2
- package/cjs/picker/type.d.ts +1 -1
- package/cjs/picker-view/components/cascader.d.ts +1 -0
- package/cjs/picker-view/components/cascader.js +8 -1
- package/cjs/picker-view/components/picker-cell.d.ts +1 -0
- package/cjs/picker-view/components/picker-cell.js +6 -1
- package/cjs/picker-view/index.d.ts +6 -1
- package/cjs/picker-view/index.js +25 -13
- package/cjs/skeleton/type.d.ts +1 -1
- package/cjs/skeleton/type.js +1 -6
- package/cjs/tabs/tab-cell.js +54 -29
- package/cjs/tabs/type.d.ts +5 -0
- package/dist/index.js +137 -58
- package/dist/index.min.js +3 -3
- package/esm/_helpers/render.d.ts +6 -1
- package/esm/_helpers/render.js +21 -1
- package/esm/carousel/index.js +3 -0
- package/esm/image/style/index.less +2 -4
- package/esm/image-preview/methods.js +2 -7
- package/esm/masking/methods.js +13 -7
- package/esm/picker/index.js +3 -2
- package/esm/picker/type.d.ts +1 -1
- package/esm/picker-view/components/cascader.d.ts +1 -0
- package/esm/picker-view/components/cascader.js +8 -1
- package/esm/picker-view/components/picker-cell.d.ts +1 -0
- package/esm/picker-view/components/picker-cell.js +6 -1
- package/esm/picker-view/index.d.ts +6 -1
- package/esm/picker-view/index.js +26 -13
- package/esm/skeleton/type.d.ts +1 -1
- package/esm/skeleton/type.js +1 -2
- package/esm/tabs/tab-cell.js +55 -29
- package/esm/tabs/type.d.ts +5 -0
- package/package.json +3 -3
- package/umd/_helpers/render.d.ts +6 -1
- package/umd/_helpers/render.js +23 -2
- package/umd/carousel/index.js +3 -0
- package/umd/image/style/index.less +2 -4
- package/umd/image-preview/methods.js +2 -7
- package/umd/masking/methods.js +12 -6
- package/umd/picker/index.js +3 -2
- package/umd/picker/type.d.ts +1 -1
- package/umd/picker-view/components/cascader.d.ts +1 -0
- package/umd/picker-view/components/cascader.js +8 -1
- package/umd/picker-view/components/picker-cell.d.ts +1 -0
- package/umd/picker-view/components/picker-cell.js +6 -1
- package/umd/picker-view/index.d.ts +6 -1
- package/umd/picker-view/index.js +25 -13
- package/umd/skeleton/type.d.ts +1 -1
- package/umd/skeleton/type.js +4 -6
- package/umd/tabs/tab-cell.js +54 -29
- package/umd/tabs/type.d.ts +5 -0
package/cjs/tabs/tab-cell.js
CHANGED
@@ -90,14 +90,18 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
90
90
|
return tabs.length < overflowThreshold ? tabBarArrange : 'start';
|
91
91
|
}),
|
92
92
|
originArrange = _useState3[0],
|
93
|
-
setOriginArrange = _useState3[1];
|
93
|
+
setOriginArrange = _useState3[1];
|
94
94
|
|
95
|
+
var _useState4 = (0, _react.useState)(false),
|
96
|
+
forceUpdate = _useState4[0],
|
97
|
+
setForceUpdate = _useState4[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
|
95
98
|
|
96
|
-
|
99
|
+
|
100
|
+
var _useState5 = (0, _react.useState)(function () {
|
97
101
|
return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
|
98
102
|
}),
|
99
|
-
showTab =
|
100
|
-
setShowTab =
|
103
|
+
showTab = _useState5[0],
|
104
|
+
setShowTab = _useState5[1];
|
101
105
|
|
102
106
|
var isVertical = tabDirection === 'vertical';
|
103
107
|
var isLine = (type || '').indexOf('line') !== -1;
|
@@ -112,6 +116,15 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
112
116
|
var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
|
113
117
|
var wrapSize = isVertical ? wrapWidth : wrapHeight;
|
114
118
|
var system = (0, _helpers.useSystem)();
|
119
|
+
|
120
|
+
var updateScrollPosition = function updateScrollPosition() {
|
121
|
+
if (wrapSize && tabBarScrollChance !== 'none') {
|
122
|
+
setTimeout(function () {
|
123
|
+
scrollToCenter();
|
124
|
+
}, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
115
128
|
(0, _react.useEffect)(function () {
|
116
129
|
(0, _mobileUtils.nextTick)(function () {
|
117
130
|
setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
|
@@ -131,31 +144,16 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
131
144
|
(_underlineRef$current = underlineRef.current) == null ? void 0 : _underlineRef$current.resetUnderlineStyle();
|
132
145
|
});
|
133
146
|
}, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
|
134
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
135
|
-
return {
|
136
|
-
dom: domRef.current,
|
137
|
-
scrollTo: scrollTo,
|
138
|
-
scrollToCenter: scrollToCenter,
|
139
|
-
hasOverflow: hasOverflow,
|
140
|
-
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
141
|
-
var _underlineRef$current2;
|
142
|
-
|
143
|
-
return (_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.setCaterpillarAnimate(ratio);
|
144
|
-
},
|
145
|
-
resetUnderlineStyle: function resetUnderlineStyle() {
|
146
|
-
var _underlineRef$current3;
|
147
|
-
|
148
|
-
return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.resetUnderlineStyle();
|
149
|
-
}
|
150
|
-
};
|
151
|
-
}, [scrollToCenter, scrollTo, hasOverflow]);
|
152
147
|
(0, _react.useEffect)(function () {
|
153
|
-
|
154
|
-
setTimeout(function () {
|
155
|
-
scrollToCenter();
|
156
|
-
}, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
|
157
|
-
}
|
148
|
+
updateScrollPosition();
|
158
149
|
}, [activeIndex, wrapSize]);
|
150
|
+
(0, _react.useEffect)(function () {
|
151
|
+
var _underlineRef$current2;
|
152
|
+
|
153
|
+
setCellOverflow();
|
154
|
+
(_underlineRef$current2 = underlineRef.current) == null ? void 0 : _underlineRef$current2.resetUnderlineStyle();
|
155
|
+
updateScrollPosition();
|
156
|
+
}, [forceUpdate]);
|
159
157
|
(0, _react.useEffect)(function () {
|
160
158
|
tabBarScrollChance !== 'none' && scrollToCenter(true); // TabCell左右可滚动时,防止触发父级touchmove事件导致滚不动
|
161
159
|
// @en When the TabCell can be scrolled left and right, prevent the parent touchmove event from being triggered which result in inability to scroll
|
@@ -296,7 +294,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
296
294
|
return typeof tab === 'string' ? tab : tab.title;
|
297
295
|
}
|
298
296
|
|
299
|
-
function renderTabUnderline() {
|
297
|
+
var renderTabUnderline = function renderTabUnderline() {
|
300
298
|
if (!showUnderline || !isLine) {
|
301
299
|
return null;
|
302
300
|
}
|
@@ -327,7 +325,7 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
327
325
|
getTabCenterLeft: getTabCenterLeft,
|
328
326
|
getTabRect: getTabRect
|
329
327
|
}, lineProps));
|
330
|
-
}
|
328
|
+
};
|
331
329
|
|
332
330
|
var cellInner = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tabs.map(function (tab, index) {
|
333
331
|
return /*#__PURE__*/_react.default.createElement("div", {
|
@@ -370,6 +368,33 @@ var TabCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
370
368
|
}
|
371
369
|
}) : null);
|
372
370
|
|
371
|
+
var _updateLayout = function updateLayout() {
|
372
|
+
setForceUpdate(function (val) {
|
373
|
+
return !val;
|
374
|
+
});
|
375
|
+
};
|
376
|
+
|
377
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
378
|
+
return {
|
379
|
+
dom: domRef.current,
|
380
|
+
scrollTo: scrollTo,
|
381
|
+
scrollToCenter: scrollToCenter,
|
382
|
+
hasOverflow: hasOverflow,
|
383
|
+
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
384
|
+
var _underlineRef$current3;
|
385
|
+
|
386
|
+
return (_underlineRef$current3 = underlineRef.current) == null ? void 0 : _underlineRef$current3.setCaterpillarAnimate(ratio);
|
387
|
+
},
|
388
|
+
resetUnderlineStyle: function resetUnderlineStyle() {
|
389
|
+
var _underlineRef$current4;
|
390
|
+
|
391
|
+
return (_underlineRef$current4 = underlineRef.current) == null ? void 0 : _underlineRef$current4.resetUnderlineStyle();
|
392
|
+
},
|
393
|
+
updateLayout: function updateLayout() {
|
394
|
+
return _updateLayout();
|
395
|
+
}
|
396
|
+
};
|
397
|
+
}, [scrollToCenter, scrollTo, hasOverflow]);
|
373
398
|
return /*#__PURE__*/_react.default.createElement("div", {
|
374
399
|
className: (0, _mobileUtils.cls)(prefix + "-container-wrap", tabDirection, "type-" + type, tabBarClass, system),
|
375
400
|
style: tabBarStyle
|
package/cjs/tabs/type.d.ts
CHANGED
@@ -565,6 +565,11 @@ export interface TabCellRef {
|
|
565
565
|
* @en Recalculate underline style
|
566
566
|
*/
|
567
567
|
resetUnderlineStyle: () => void;
|
568
|
+
/**
|
569
|
+
* 强制更新 tab-cell
|
570
|
+
* @en Force update tab-cell
|
571
|
+
*/
|
572
|
+
updateLayout: () => void;
|
568
573
|
}
|
569
574
|
export interface TabPaneProps extends Pick<TabsProps, 'duration' | 'transitionDuration' | 'lazyloadCount' | 'hideContentStyle' | 'renderHideContent' | 'mode' | 'tabPaneClass' | 'tabPaneStyle' | 'tabPaneExtra' | 'getScrollContainer' | 'scrollThrottle' | 'scrollOffset' | 'goLastWhenScrollBottom' | 'scrollVertical' | 'translateZ' | 'fullScreen' | 'autoHeight' | 'onScroll' | 'swipeEnergySaving'> {
|
570
575
|
prefixCls?: string;
|
package/dist/index.js
CHANGED
@@ -126,7 +126,7 @@
|
|
126
126
|
* ```
|
127
127
|
*/
|
128
128
|
|
129
|
-
function isArray(obj) {
|
129
|
+
function isArray$1(obj) {
|
130
130
|
return opt.call(obj) === '[object Array]';
|
131
131
|
}
|
132
132
|
/**
|
@@ -237,7 +237,7 @@
|
|
237
237
|
*/
|
238
238
|
|
239
239
|
function isEmptyArray(obj) {
|
240
|
-
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
240
|
+
return isArray$1(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
241
241
|
}
|
242
242
|
/**
|
243
243
|
* 深比较两个对象是否相等
|
@@ -312,7 +312,7 @@
|
|
312
312
|
|
313
313
|
if (isString(v)) {
|
314
314
|
classNames.push(v);
|
315
|
-
} else if (isArray(v)) {
|
315
|
+
} else if (isArray$1(v)) {
|
316
316
|
classNames = classNames.concat(v);
|
317
317
|
} else if (isObject$2(v)) {
|
318
318
|
Object.keys(v).forEach(function (k) {
|
@@ -3652,7 +3652,7 @@
|
|
3652
3652
|
Object.keys(this.rules).forEach(function (key) {
|
3653
3653
|
var spPromiseGroup = [];
|
3654
3654
|
|
3655
|
-
if (isArray(_this.rules[key])) {
|
3655
|
+
if (isArray$1(_this.rules[key])) {
|
3656
3656
|
for (var i = 0; i < _this.rules[key].length; i++) {
|
3657
3657
|
var rule = _this.rules[key][i];
|
3658
3658
|
|
@@ -5132,14 +5132,18 @@
|
|
5132
5132
|
return tabs.length < overflowThreshold ? tabBarArrange : 'start';
|
5133
5133
|
}),
|
5134
5134
|
originArrange = _d[0],
|
5135
|
-
setOriginArrange = _d[1];
|
5135
|
+
setOriginArrange = _d[1];
|
5136
|
+
|
5137
|
+
var _e = React.useState(false),
|
5138
|
+
forceUpdate = _e[0],
|
5139
|
+
setForceUpdate = _e[1]; // 默认tab小于overflowThreshold个时不开启加载前隐藏,大于overflowThreshold个时开启
|
5136
5140
|
|
5137
5141
|
|
5138
|
-
var
|
5142
|
+
var _f = React.useState(function () {
|
5139
5143
|
return hideTabBarBeforeMounted === void 0 ? tabs.length < overflowThreshold || activeIndex === 0 : !hideTabBarBeforeMounted;
|
5140
5144
|
}),
|
5141
|
-
showTab =
|
5142
|
-
setShowTab =
|
5145
|
+
showTab = _f[0],
|
5146
|
+
setShowTab = _f[1];
|
5143
5147
|
|
5144
5148
|
var isVertical = tabDirection === 'vertical';
|
5145
5149
|
var isLine = (type || '').indexOf('line') !== -1;
|
@@ -5154,6 +5158,15 @@
|
|
5154
5158
|
var hasDivider = tabBarHasDivider === void 0 ? isLine : tabBarHasDivider;
|
5155
5159
|
var wrapSize = isVertical ? wrapWidth : wrapHeight;
|
5156
5160
|
var system = useSystem();
|
5161
|
+
|
5162
|
+
var updateScrollPosition = function updateScrollPosition() {
|
5163
|
+
if (wrapSize && tabBarScrollChance !== 'none') {
|
5164
|
+
setTimeout(function () {
|
5165
|
+
scrollToCenter();
|
5166
|
+
}, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
|
5167
|
+
}
|
5168
|
+
};
|
5169
|
+
|
5157
5170
|
React.useEffect(function () {
|
5158
5171
|
nextTick(function () {
|
5159
5172
|
setCellOverflow(); // dom出来之后originArrange置空,交由tabBarArrange控制
|
@@ -5173,31 +5186,16 @@
|
|
5173
5186
|
(_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
|
5174
5187
|
});
|
5175
5188
|
}, [activeIndex, tabs, getCellPadding('left'), getCellPadding('right'), tabBarGutter, tabDirection]);
|
5176
|
-
React.useImperativeHandle(ref, function () {
|
5177
|
-
return {
|
5178
|
-
dom: domRef.current,
|
5179
|
-
scrollTo: scrollTo,
|
5180
|
-
scrollToCenter: scrollToCenter,
|
5181
|
-
hasOverflow: hasOverflow,
|
5182
|
-
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
5183
|
-
var _a;
|
5184
|
-
|
5185
|
-
return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.setCaterpillarAnimate(ratio);
|
5186
|
-
},
|
5187
|
-
resetUnderlineStyle: function resetUnderlineStyle() {
|
5188
|
-
var _a;
|
5189
|
-
|
5190
|
-
return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
|
5191
|
-
}
|
5192
|
-
};
|
5193
|
-
}, [scrollToCenter, scrollTo, hasOverflow]);
|
5194
5189
|
React.useEffect(function () {
|
5195
|
-
|
5196
|
-
setTimeout(function () {
|
5197
|
-
scrollToCenter();
|
5198
|
-
}, tabBarScrollChance === 'after-jump' ? Math.max(transitionDuration || 0, duration || 0) : 0);
|
5199
|
-
}
|
5190
|
+
updateScrollPosition();
|
5200
5191
|
}, [activeIndex, wrapSize]);
|
5192
|
+
React.useEffect(function () {
|
5193
|
+
var _a;
|
5194
|
+
|
5195
|
+
setCellOverflow();
|
5196
|
+
(_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
|
5197
|
+
updateScrollPosition();
|
5198
|
+
}, [forceUpdate]);
|
5201
5199
|
React.useEffect(function () {
|
5202
5200
|
tabBarScrollChance !== 'none' && scrollToCenter(true); // TabCell左右可滚动时,防止触发父级touchmove事件导致滚不动
|
5203
5201
|
// @en When the TabCell can be scrolled left and right, prevent the parent touchmove event from being triggered which result in inability to scroll
|
@@ -5336,7 +5334,7 @@
|
|
5336
5334
|
return typeof tab === 'string' ? tab : tab.title;
|
5337
5335
|
}
|
5338
5336
|
|
5339
|
-
function renderTabUnderline() {
|
5337
|
+
var renderTabUnderline = function renderTabUnderline() {
|
5340
5338
|
if (!showUnderline || !isLine) {
|
5341
5339
|
return null;
|
5342
5340
|
}
|
@@ -5367,7 +5365,7 @@
|
|
5367
5365
|
getTabCenterLeft: getTabCenterLeft,
|
5368
5366
|
getTabRect: getTabRect
|
5369
5367
|
}, lineProps));
|
5370
|
-
}
|
5368
|
+
};
|
5371
5369
|
|
5372
5370
|
var cellInner = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, tabs.map(function (tab, index) {
|
5373
5371
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -5409,6 +5407,34 @@
|
|
5409
5407
|
height: '100%'
|
5410
5408
|
}
|
5411
5409
|
}) : null);
|
5410
|
+
|
5411
|
+
var _updateLayout = function updateLayout() {
|
5412
|
+
setForceUpdate(function (val) {
|
5413
|
+
return !val;
|
5414
|
+
});
|
5415
|
+
};
|
5416
|
+
|
5417
|
+
React.useImperativeHandle(ref, function () {
|
5418
|
+
return {
|
5419
|
+
dom: domRef.current,
|
5420
|
+
scrollTo: scrollTo,
|
5421
|
+
scrollToCenter: scrollToCenter,
|
5422
|
+
hasOverflow: hasOverflow,
|
5423
|
+
setCaterpillarAnimate: function setCaterpillarAnimate(ratio) {
|
5424
|
+
var _a;
|
5425
|
+
|
5426
|
+
return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.setCaterpillarAnimate(ratio);
|
5427
|
+
},
|
5428
|
+
resetUnderlineStyle: function resetUnderlineStyle() {
|
5429
|
+
var _a;
|
5430
|
+
|
5431
|
+
return (_a = underlineRef.current) === null || _a === void 0 ? void 0 : _a.resetUnderlineStyle();
|
5432
|
+
},
|
5433
|
+
updateLayout: function updateLayout() {
|
5434
|
+
return _updateLayout();
|
5435
|
+
}
|
5436
|
+
};
|
5437
|
+
}, [scrollToCenter, scrollTo, hasOverflow]);
|
5412
5438
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
5413
5439
|
className: cls(prefix + "-container-wrap", tabDirection, "type-" + type, tabBarClass, system),
|
5414
5440
|
style: tabBarStyle
|
@@ -8556,10 +8582,13 @@
|
|
8556
8582
|
});
|
8557
8583
|
}
|
8558
8584
|
|
8585
|
+
var renderRootCache = {};
|
8586
|
+
|
8559
8587
|
var ReactDOMRender =
|
8560
8588
|
/** @class */
|
8561
8589
|
function () {
|
8562
|
-
function ReactDOMRender(app, container, context
|
8590
|
+
function ReactDOMRender(app, container, context, rootCacheId, // root id in cache
|
8591
|
+
root) {
|
8563
8592
|
var _this = this;
|
8564
8593
|
|
8565
8594
|
this.render = function (props) {
|
@@ -8576,16 +8605,32 @@
|
|
8576
8605
|
}
|
8577
8606
|
};
|
8578
8607
|
|
8608
|
+
this.setRootCache = function () {
|
8609
|
+
if (_this.rootCacheId) {
|
8610
|
+
renderRootCache[_this.rootCacheId] = _this.root;
|
8611
|
+
}
|
8612
|
+
};
|
8613
|
+
|
8614
|
+
this.clearRootCache = function () {
|
8615
|
+
if (_this.rootCacheId) {
|
8616
|
+
delete renderRootCache[_this.rootCacheId];
|
8617
|
+
}
|
8618
|
+
};
|
8619
|
+
|
8579
8620
|
this.unmount = function () {
|
8580
8621
|
var _a;
|
8581
8622
|
|
8582
8623
|
(_a = _this.root) === null || _a === void 0 ? void 0 : _a._unmount();
|
8583
8624
|
_this.root = undefined;
|
8625
|
+
|
8626
|
+
_this.clearRootCache();
|
8584
8627
|
};
|
8585
8628
|
|
8586
8629
|
this.app = app;
|
8587
8630
|
this.container = container;
|
8588
8631
|
this.context = context;
|
8632
|
+
this.rootCacheId = rootCacheId;
|
8633
|
+
this.root = root;
|
8589
8634
|
}
|
8590
8635
|
|
8591
8636
|
return ReactDOMRender;
|
@@ -8608,9 +8653,14 @@
|
|
8608
8653
|
|
8609
8654
|
|
8610
8655
|
var id = "_" + (containerId || 'ARCO_MASKING') + "_DIV_" + (config.key || '') + "_";
|
8611
|
-
var
|
8656
|
+
var existedDiv = baseProps.unmountOnExit ? null : document.getElementById(id);
|
8657
|
+
var div = existedDiv || appendElementById(id, baseProps.getContainer).child;
|
8612
8658
|
var leaving = false;
|
8613
|
-
|
8659
|
+
|
8660
|
+
var _a = new ReactDOMRender(Component, div, context, id, existedDiv ? renderRootCache[id] : undefined),
|
8661
|
+
render = _a.render,
|
8662
|
+
unmount = _a.unmount,
|
8663
|
+
setRootCache = _a.setRootCache;
|
8614
8664
|
|
8615
8665
|
var dynamicProps = __assign$3(__assign$3({}, baseProps), {
|
8616
8666
|
getContainer: function getContainer() {
|
@@ -8635,11 +8685,17 @@
|
|
8635
8685
|
baseProps.onClose && baseProps.onClose(scene);
|
8636
8686
|
|
8637
8687
|
if (baseProps.unmountOnExit) {
|
8688
|
+
unmount();
|
8638
8689
|
removeElement(div);
|
8639
8690
|
}
|
8640
8691
|
};
|
8641
8692
|
|
8642
8693
|
render(dynamicProps);
|
8694
|
+
|
8695
|
+
if (!baseProps.unmountOnExit) {
|
8696
|
+
setRootCache();
|
8697
|
+
}
|
8698
|
+
|
8643
8699
|
nextTick(function () {
|
8644
8700
|
if (leaving) return;
|
8645
8701
|
dynamicProps.visible = true;
|
@@ -10687,6 +10743,9 @@
|
|
10687
10743
|
|
10688
10744
|
function getFakeChild() {
|
10689
10745
|
if (noLoop) {
|
10746
|
+
// 循环状态从有到无时,重置 transforms
|
10747
|
+
// @en reset transforms when loop status changes to false
|
10748
|
+
setTransforms([]);
|
10690
10749
|
return;
|
10691
10750
|
}
|
10692
10751
|
|
@@ -12768,6 +12827,10 @@
|
|
12768
12827
|
return (_a = data[currentIndex]) === null || _a === void 0 ? void 0 : _a.value;
|
12769
12828
|
}
|
12770
12829
|
|
12830
|
+
function getCurrentCellData() {
|
12831
|
+
return data[currentIndex];
|
12832
|
+
}
|
12833
|
+
|
12771
12834
|
function _clearTimer() {
|
12772
12835
|
timeRef.current && clearTimeout(timeRef.current);
|
12773
12836
|
timeRef.current = null;
|
@@ -12835,7 +12898,8 @@
|
|
12835
12898
|
return {
|
12836
12899
|
movingStatus: movingStatusRef.current,
|
12837
12900
|
scrollToCurrentIndex: scrollToCurrentIndex,
|
12838
|
-
getCurrentCellValue: getCurrentCellValue
|
12901
|
+
getCurrentCellValue: getCurrentCellValue,
|
12902
|
+
getCurrentCellData: getCurrentCellData
|
12839
12903
|
};
|
12840
12904
|
});
|
12841
12905
|
return !hideEmptyCols || data && data.length ? /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -12886,7 +12950,8 @@
|
|
12886
12950
|
return {
|
12887
12951
|
getCellMovingStatus: getCellMovingStatus,
|
12888
12952
|
scrollToCurrentIndex: scrollToCurrentIndex,
|
12889
|
-
getAllCellsValue: getAllCellsValue
|
12953
|
+
getAllCellsValue: getAllCellsValue,
|
12954
|
+
getAllCellsData: getAllCellsData
|
12890
12955
|
};
|
12891
12956
|
});
|
12892
12957
|
|
@@ -12908,6 +12973,12 @@
|
|
12908
12973
|
});
|
12909
12974
|
}
|
12910
12975
|
|
12976
|
+
function getAllCellsData() {
|
12977
|
+
return pickerCellsRef.current.map(function (cell) {
|
12978
|
+
return cell.getCurrentCellData();
|
12979
|
+
});
|
12980
|
+
}
|
12981
|
+
|
12911
12982
|
function _onValueChange(value, index, newData) {
|
12912
12983
|
var children = arrayTreeFilter(data, function (item, level) {
|
12913
12984
|
return level <= index && item.value === value[level];
|
@@ -12976,6 +13047,14 @@
|
|
12976
13047
|
}));
|
12977
13048
|
});
|
12978
13049
|
|
13050
|
+
var isArray = function isArray(dt) {
|
13051
|
+
return dt ? Array.isArray(dt[0]) : false;
|
13052
|
+
};
|
13053
|
+
|
13054
|
+
var isStrOrNum = function isStrOrNum(dt) {
|
13055
|
+
return typeof dt[0][0] === 'string' || typeof dt[0][0] === 'number';
|
13056
|
+
};
|
13057
|
+
|
12979
13058
|
var PickerView = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
12980
13059
|
var _a = props.className,
|
12981
13060
|
className = _a === void 0 ? '' : _a,
|
@@ -13025,14 +13104,6 @@
|
|
13025
13104
|
var innerData = React.useMemo(function () {
|
13026
13105
|
var newData;
|
13027
13106
|
|
13028
|
-
var isArray = function isArray(dt) {
|
13029
|
-
return dt ? Array.isArray(dt[0]) : false;
|
13030
|
-
};
|
13031
|
-
|
13032
|
-
var isStrOrNum = function isStrOrNum(dt) {
|
13033
|
-
return typeof dt[0][0] === 'string' || typeof dt[0][0] === 'number';
|
13034
|
-
};
|
13035
|
-
|
13036
13107
|
if (isArray(data)) {
|
13037
13108
|
if (isStrOrNum(data)) {
|
13038
13109
|
newData = data.map(function (item) {
|
@@ -13066,6 +13137,17 @@
|
|
13066
13137
|
});
|
13067
13138
|
};
|
13068
13139
|
|
13140
|
+
var getAllColumnData = function getAllColumnData() {
|
13141
|
+
var _a;
|
13142
|
+
|
13143
|
+
var curValues = cascade ? ((_a = cascaderRef.current) === null || _a === void 0 ? void 0 : _a.getAllCellsData()) || [] : pickerCellsRef.current.map(function (cell) {
|
13144
|
+
return cell.getCurrentCellData();
|
13145
|
+
});
|
13146
|
+
return curValues.filter(function (v) {
|
13147
|
+
return v !== undefined;
|
13148
|
+
});
|
13149
|
+
};
|
13150
|
+
|
13069
13151
|
function getColumnValue(index) {
|
13070
13152
|
if (index === void 0) {
|
13071
13153
|
index = 0;
|
@@ -13103,7 +13185,8 @@
|
|
13103
13185
|
getColumnValue: getColumnValue,
|
13104
13186
|
updateLayout: updateLayout,
|
13105
13187
|
resetValue: resetValue,
|
13106
|
-
scrollToCurrentIndex: scrollToCurrentIndex
|
13188
|
+
scrollToCurrentIndex: scrollToCurrentIndex,
|
13189
|
+
getAllColumnData: getAllColumnData
|
13107
13190
|
};
|
13108
13191
|
});
|
13109
13192
|
|
@@ -13304,12 +13387,13 @@
|
|
13304
13387
|
|
13305
13388
|
(_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.scrollToCurrentIndex();
|
13306
13389
|
nextTick(function () {
|
13307
|
-
var _a;
|
13390
|
+
var _a, _b;
|
13308
13391
|
|
13309
13392
|
var val = ((_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.getAllColumnValues()) || scrollValueRef.current || [];
|
13393
|
+
var selectedData = ((_b = pickerViewRef.current) === null || _b === void 0 ? void 0 : _b.getAllColumnData()) || [];
|
13310
13394
|
|
13311
13395
|
if (onOk) {
|
13312
|
-
onOk(val);
|
13396
|
+
onOk(val, selectedData);
|
13313
13397
|
}
|
13314
13398
|
|
13315
13399
|
if (onChange) {
|
@@ -14427,7 +14511,7 @@
|
|
14427
14511
|
* */
|
14428
14512
|
|
14429
14513
|
function isCascadeArray(options) {
|
14430
|
-
return typeof options[0] === 'object' && !isArray(options[0]);
|
14514
|
+
return typeof options[0] === 'object' && !isArray$1(options[0]);
|
14431
14515
|
}
|
14432
14516
|
/**
|
14433
14517
|
* 格式化传入的数组
|
@@ -20680,9 +20764,7 @@
|
|
20680
20764
|
|
20681
20765
|
function open$1(Component) {
|
20682
20766
|
return function (config, context) {
|
20683
|
-
var baseProps = __assign$3(__assign$3({
|
20684
|
-
unmountOnExit: true
|
20685
|
-
}, config || {}), {
|
20767
|
+
var baseProps = __assign$3(__assign$3({}, config || {}), {
|
20686
20768
|
close: function close() {}
|
20687
20769
|
}); // 不同的key用不同的容器挂载
|
20688
20770
|
// @en Different keys are mounted in different containers
|
@@ -20714,10 +20796,7 @@
|
|
20714
20796
|
|
20715
20797
|
dynamicProps.onClose = function () {
|
20716
20798
|
baseProps.onClose && baseProps.onClose();
|
20717
|
-
|
20718
|
-
if (baseProps.unmountOnExit) {
|
20719
|
-
removeElement(div);
|
20720
|
-
}
|
20799
|
+
removeElement(div);
|
20721
20800
|
};
|
20722
20801
|
|
20723
20802
|
dynamicProps.openIndex = -1;
|
@@ -27316,7 +27395,7 @@
|
|
27316
27395
|
});
|
27317
27396
|
|
27318
27397
|
var getWidth = function getWidth(idx) {
|
27319
|
-
if (isArray(width)) {
|
27398
|
+
if (isArray$1(width)) {
|
27320
27399
|
return width[idx];
|
27321
27400
|
}
|
27322
27401
|
|