@para-ui/core 4.0.20 → 4.0.21
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/Breadcrumbs/index.js +2 -2
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.js +2 -2
- package/ButtonGroup/index.js +2 -2
- package/Cascader/OptionList/Column.d.ts +1 -1
- package/Cascader/index.js +5 -5
- package/ColorPicker/chromePicker/index.d.ts +1 -2
- package/ColorPicker/compactPicker/index.d.ts +1 -2
- package/ColorPicker/sketchPicker/index.d.ts +1 -2
- package/ColorPicker/swatchesPicker/index.d.ts +1 -2
- package/ComboSelect/index.js +4 -4
- package/Container/index.d.ts +1 -1
- package/CopyText/index.js +2 -2
- package/CycleSelector/index.js +4 -4
- package/DatePicker/PickerButton.d.ts +1 -2
- package/DatePicker/PickerTag.d.ts +1 -2
- package/DatePicker/index.js +3 -3
- package/Descriptions/index.js +2 -2
- package/Desktop/index.js +3 -3
- package/DragVerify/index.js +3 -2
- package/Drawer/index.js +2 -2
- package/DynamicMultiBox/formItem.d.ts +1 -2
- package/DynamicMultiBox/index.js +7 -7
- package/DynamicMultiBox/interface.d.ts +1 -1
- package/DynamicMultiBox/rowForm.d.ts +1 -1
- package/Empty/images/index.d.ts +2 -3
- package/Empty/index.js +4 -3
- package/Form/index.js +5 -5
- package/FormItem/index.js +5 -5
- package/FunctionModal/index.js +4 -5
- package/FunctionModal/modalContext.d.ts +1 -2
- package/GlobalContext/index.js +3 -39
- package/InputLang/index.js +3 -3
- package/Message/index.d.ts +1 -1
- package/Modal/index.js +3 -4
- package/MultiBox/index.js +3 -3
- package/OperateBtn/index.js +2 -2
- package/PageHeader/index.js +2 -2
- package/Pagination/index.js +4 -4
- package/ParauiProvider/index.d.ts +2 -2
- package/ParauiProvider/index.js +2 -2
- package/PopConfirm/index.js +2 -2
- package/Prompt/index.d.ts +1 -1
- package/Querying/images/index.d.ts +2 -3
- package/Querying/index.js +4 -3
- package/QuickReply/index.js +5 -5
- package/README.md +4 -0
- package/Search/index.js +2 -2
- package/Select/index.js +3 -3
- package/SelectInput/index.js +4 -4
- package/Selector/index.js +6 -6
- package/SelectorPicker/index.js +3 -3
- package/SingleBox/index.js +3 -3
- package/Switch/index.js +3 -2
- package/Table/index.js +3 -3
- package/Tabs/index.js +2 -2
- package/TextEditor/index.js +2 -2
- package/TextField/index.js +2 -2
- package/TimePicker/index.js +3 -3
- package/Timeline/TimelineItem.d.ts +1 -1
- package/ToggleButton/index.js +2 -2
- package/Tooltip/utils.d.ts +1 -1
- package/Transfer/box.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +4 -4
- package/Tree/index.js +5 -5
- package/Tree/utils/treeUtil.d.ts +1 -1
- package/Upload/index.js +3 -4
- package/_verture/defineProperty-6f62bb2a.js +34 -0
- package/_verture/{index-9bef932a.js → index-0f5ee6f7.js} +1 -1
- package/_verture/{index-02b7a0b7.js → index-c77ccb98.js} +1 -1
- package/_verture/{intl-f2f27722.js → index-ca413216.js} +54 -1
- package/_verture/{index-cc76d8d5.js → index-f59b0bc0.js} +228 -119
- package/_verture/{index-356d88fa.js → index-fa1ee687.js} +1 -1
- package/_verture/{sortable.esm-49896035.js → sortable.esm-76fe46a4.js} +597 -1029
- package/_verture/{useFormatMessage-eb13cf56.js → useFormatMessage-1fc7c957.js} +1 -1
- package/_verture/{useGlobalProps-1e416658.js → useGlobalProps-4ae1a007.js} +1 -1
- package/index.js +10 -13
- package/package.json +12 -17
- package/umd/AutoBox.js +11 -11
- package/umd/AutoTips.js +11 -11
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +11 -11
- package/umd/Button.js +11 -11
- package/umd/ButtonGroup.js +11 -11
- package/umd/Carousel.js +9 -9
- package/umd/Cascader.js +11 -11
- package/umd/Checkbox.js +11 -11
- package/umd/CheckboxGroup.js +11 -11
- package/umd/Collapse.js +10 -10
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +11 -11
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +11 -11
- package/umd/CycleSelector.js +11 -11
- package/umd/DatePicker.js +11 -11
- package/umd/Descriptions.js +11 -11
- package/umd/Desktop.js +11 -11
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +11 -11
- package/umd/Dropdown.js +8 -8
- package/umd/DynamicMultiBox.js +14 -14
- package/umd/Empty.js +1 -1
- package/umd/Form.js +11 -11
- package/umd/FormItem.js +11 -11
- package/umd/FunctionModal.js +11 -11
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +11 -11
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +11 -11
- package/umd/InputNumber.js +11 -11
- package/umd/Label.js +11 -11
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +11 -11
- package/umd/Message.js +4 -4
- package/umd/Modal.js +11 -11
- package/umd/MultiBox.js +11 -11
- package/umd/Notification.js +10 -10
- package/umd/OperateBtn.js +11 -11
- package/umd/PageHeader.js +11 -11
- package/umd/Pagination.js +11 -11
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +11 -11
- package/umd/PopMenu.js +11 -11
- package/umd/Popover.js +11 -11
- package/umd/Progress.js +9 -9
- package/umd/Prompt.js +4 -4
- package/umd/Querying.js +1 -1
- package/umd/QuickReply.js +14 -14
- package/umd/Radio.js +11 -11
- package/umd/RadioGroup.js +11 -11
- package/umd/Search.js +11 -11
- package/umd/Select.js +11 -11
- package/umd/SelectInput.js +11 -11
- package/umd/Selector.js +11 -11
- package/umd/SelectorPicker.js +11 -11
- package/umd/SingleBox.js +11 -11
- package/umd/Slider.js +8 -8
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +11 -11
- package/umd/Switch.js +11 -11
- package/umd/Table.js +11 -11
- package/umd/Tabs.js +11 -11
- package/umd/Tag.js +11 -11
- package/umd/TextEditor.js +24 -24
- package/umd/TextField.js +11 -11
- package/umd/TimePicker.js +11 -11
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +11 -11
- package/umd/ToggleButton.js +11 -11
- package/umd/Tooltip.js +11 -11
- package/umd/Transfer.js +13 -13
- package/umd/Tree.js +11 -11
- package/umd/Upload.js +12 -12
- package/umd/Utils.js +1 -1
- package/_verture/defineProperty-1d116156.js +0 -34
- package/_verture/index-c568f272.js +0 -18
- /package/_verture/{modalContext-3ba6ca8f.js → modalContext-c8cc3107.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-55ed4bd2.js';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { _ as _toConsumableArray, a as _iterableToArray } from './toConsumableArray-8f4c9589.js';
|
|
4
|
-
import { _ as _defineProperty,
|
|
4
|
+
import { _ as _defineProperty, t as toPropertyKey } from './defineProperty-6f62bb2a.js';
|
|
5
5
|
import { _ as _slicedToArray, a as _arrayWithHoles, b as _nonIterableRest } from './slicedToArray-a8206399.js';
|
|
6
6
|
import { _ as _typeof$1 } from './typeof-adeedc13.js';
|
|
7
7
|
import * as React$4 from 'react';
|
|
@@ -21,7 +21,7 @@ import { Forbid } from '@para-ui/icons';
|
|
|
21
21
|
import { $ as $prefixCls } from './constant-5317fc89.js';
|
|
22
22
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
23
23
|
import AutoTips from '../AutoTips/index.js';
|
|
24
|
-
import { u as useFormatMessage } from './useFormatMessage-
|
|
24
|
+
import { u as useFormatMessage } from './useFormatMessage-1fc7c957.js';
|
|
25
25
|
import { UUID } from '@paraview/lib';
|
|
26
26
|
import { s as styleInject } from './style-inject.es-300983ab.js';
|
|
27
27
|
|
|
@@ -231,8 +231,19 @@ var preWarningFns = [];
|
|
|
231
231
|
var preMessage = function preMessage(fn) {
|
|
232
232
|
preWarningFns.push(fn);
|
|
233
233
|
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Warning if condition not match.
|
|
237
|
+
* @param valid Condition
|
|
238
|
+
* @param message Warning message
|
|
239
|
+
* @example
|
|
240
|
+
* ```js
|
|
241
|
+
* warning(false, 'some error'); // print some error
|
|
242
|
+
* warning(true, 'some error'); // print nothing
|
|
243
|
+
* warning(1 === 2, 'some error'); // print some error
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
234
246
|
function warning(valid, message) {
|
|
235
|
-
// Support uglify
|
|
236
247
|
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
237
248
|
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
238
249
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
|
|
@@ -242,8 +253,9 @@ function warning(valid, message) {
|
|
|
242
253
|
}
|
|
243
254
|
}
|
|
244
255
|
}
|
|
256
|
+
|
|
257
|
+
/** @see Similar to {@link warning} */
|
|
245
258
|
function note(valid, message) {
|
|
246
|
-
// Support uglify
|
|
247
259
|
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
248
260
|
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
249
261
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
|
|
@@ -262,16 +274,19 @@ function call(method, valid, message) {
|
|
|
262
274
|
warned[message] = true;
|
|
263
275
|
}
|
|
264
276
|
}
|
|
277
|
+
|
|
278
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
265
279
|
function warningOnce(valid, message) {
|
|
266
280
|
call(warning, valid, message);
|
|
267
281
|
}
|
|
282
|
+
|
|
283
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
268
284
|
function noteOnce(valid, message) {
|
|
269
285
|
call(note, valid, message);
|
|
270
286
|
}
|
|
271
287
|
warningOnce.preMessage = preMessage;
|
|
272
288
|
warningOnce.resetWarned = resetWarned;
|
|
273
289
|
warningOnce.noteOnce = noteOnce;
|
|
274
|
-
/* eslint-enable */
|
|
275
290
|
|
|
276
291
|
var classnames = {exports: {}};
|
|
277
292
|
|
|
@@ -288,39 +303,57 @@ var classnames = {exports: {}};
|
|
|
288
303
|
|
|
289
304
|
var hasOwn = {}.hasOwnProperty;
|
|
290
305
|
|
|
291
|
-
function classNames() {
|
|
292
|
-
var classes =
|
|
306
|
+
function classNames () {
|
|
307
|
+
var classes = '';
|
|
293
308
|
|
|
294
309
|
for (var i = 0; i < arguments.length; i++) {
|
|
295
310
|
var arg = arguments[i];
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
var argType = typeof arg;
|
|
299
|
-
|
|
300
|
-
if (argType === 'string' || argType === 'number') {
|
|
301
|
-
classes.push(arg);
|
|
302
|
-
} else if (Array.isArray(arg)) {
|
|
303
|
-
if (arg.length) {
|
|
304
|
-
var inner = classNames.apply(null, arg);
|
|
305
|
-
if (inner) {
|
|
306
|
-
classes.push(inner);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
} else if (argType === 'object') {
|
|
310
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
311
|
-
classes.push(arg.toString());
|
|
312
|
-
continue;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
for (var key in arg) {
|
|
316
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
317
|
-
classes.push(key);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
311
|
+
if (arg) {
|
|
312
|
+
classes = appendClass(classes, parseValue(arg));
|
|
320
313
|
}
|
|
321
314
|
}
|
|
322
315
|
|
|
323
|
-
return classes
|
|
316
|
+
return classes;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function parseValue (arg) {
|
|
320
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
321
|
+
return arg;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (typeof arg !== 'object') {
|
|
325
|
+
return '';
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (Array.isArray(arg)) {
|
|
329
|
+
return classNames.apply(null, arg);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
333
|
+
return arg.toString();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
var classes = '';
|
|
337
|
+
|
|
338
|
+
for (var key in arg) {
|
|
339
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
340
|
+
classes = appendClass(classes, key);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return classes;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function appendClass (value, newClass) {
|
|
348
|
+
if (!newClass) {
|
|
349
|
+
return value;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (value) {
|
|
353
|
+
return value + ' ' + newClass;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return value + newClass;
|
|
324
357
|
}
|
|
325
358
|
|
|
326
359
|
if (module.exports) {
|
|
@@ -1198,12 +1231,12 @@ function supportRef(nodeOrComponent) {
|
|
|
1198
1231
|
var type = reactIs.exports.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
|
|
1199
1232
|
|
|
1200
1233
|
// Function component node
|
|
1201
|
-
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
|
|
1234
|
+
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== reactIs.exports.ForwardRef) {
|
|
1202
1235
|
return false;
|
|
1203
1236
|
}
|
|
1204
1237
|
|
|
1205
1238
|
// Class component
|
|
1206
|
-
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
|
|
1239
|
+
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== reactIs.exports.ForwardRef) {
|
|
1207
1240
|
return false;
|
|
1208
1241
|
}
|
|
1209
1242
|
return true;
|
|
@@ -2466,7 +2499,7 @@ function _defineProperties(target, props) {
|
|
|
2466
2499
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
2467
2500
|
descriptor.configurable = true;
|
|
2468
2501
|
if ("value" in descriptor) descriptor.writable = true;
|
|
2469
|
-
Object.defineProperty(target,
|
|
2502
|
+
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
|
2470
2503
|
}
|
|
2471
2504
|
}
|
|
2472
2505
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -2511,15 +2544,12 @@ function _getPrototypeOf(o) {
|
|
|
2511
2544
|
}
|
|
2512
2545
|
|
|
2513
2546
|
function _isNativeReflectConstruct() {
|
|
2514
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
2515
|
-
if (Reflect.construct.sham) return false;
|
|
2516
|
-
if (typeof Proxy === "function") return true;
|
|
2517
2547
|
try {
|
|
2518
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
return
|
|
2522
|
-
}
|
|
2548
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
2549
|
+
} catch (t) {}
|
|
2550
|
+
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
2551
|
+
return !!t;
|
|
2552
|
+
})();
|
|
2523
2553
|
}
|
|
2524
2554
|
|
|
2525
2555
|
function _assertThisInitialized(self) {
|
|
@@ -3903,7 +3933,7 @@ function injectCSS(css) {
|
|
|
3903
3933
|
if (prepend) {
|
|
3904
3934
|
// If is queue `prepend`, it will prepend first style and then append rest style
|
|
3905
3935
|
if (isPrependQueue) {
|
|
3906
|
-
var existStyle = findStyles(container).filter(function (node) {
|
|
3936
|
+
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
|
|
3907
3937
|
// Ignore style which not injected by rc-util with prepend
|
|
3908
3938
|
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
3909
3939
|
return false;
|
|
@@ -3929,7 +3959,7 @@ function injectCSS(css) {
|
|
|
3929
3959
|
function findExistNode(key) {
|
|
3930
3960
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3931
3961
|
var container = getContainer(option);
|
|
3932
|
-
return findStyles(container).find(function (node) {
|
|
3962
|
+
return (option.styles || findStyles(container)).find(function (node) {
|
|
3933
3963
|
return node.getAttribute(getMark(option)) === key;
|
|
3934
3964
|
});
|
|
3935
3965
|
}
|
|
@@ -3957,8 +3987,12 @@ function syncRealContainer(container, option) {
|
|
|
3957
3987
|
}
|
|
3958
3988
|
}
|
|
3959
3989
|
function updateCSS(css, key) {
|
|
3960
|
-
var
|
|
3961
|
-
var container = getContainer(
|
|
3990
|
+
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3991
|
+
var container = getContainer(originOption);
|
|
3992
|
+
var styles = findStyles(container);
|
|
3993
|
+
var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
|
|
3994
|
+
styles: styles
|
|
3995
|
+
});
|
|
3962
3996
|
|
|
3963
3997
|
// Sync real parent
|
|
3964
3998
|
syncRealContainer(container, option);
|
|
@@ -3980,43 +4014,60 @@ function updateCSS(css, key) {
|
|
|
3980
4014
|
}
|
|
3981
4015
|
|
|
3982
4016
|
/* eslint-disable no-param-reassign */
|
|
4017
|
+
function measureScrollbarSize(ele) {
|
|
4018
|
+
var randomId = "rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7));
|
|
4019
|
+
var measureEle = document.createElement('div');
|
|
4020
|
+
measureEle.id = randomId;
|
|
4021
|
+
|
|
4022
|
+
// Create Style
|
|
4023
|
+
var measureStyle = measureEle.style;
|
|
4024
|
+
measureStyle.position = 'absolute';
|
|
4025
|
+
measureStyle.left = '0';
|
|
4026
|
+
measureStyle.top = '0';
|
|
4027
|
+
measureStyle.width = '100px';
|
|
4028
|
+
measureStyle.height = '100px';
|
|
4029
|
+
measureStyle.overflow = 'scroll';
|
|
4030
|
+
|
|
4031
|
+
// Clone Style if needed
|
|
4032
|
+
var fallbackWidth;
|
|
4033
|
+
var fallbackHeight;
|
|
4034
|
+
if (ele) {
|
|
4035
|
+
var targetStyle = getComputedStyle(ele);
|
|
4036
|
+
measureStyle.scrollbarColor = targetStyle.scrollbarColor;
|
|
4037
|
+
measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;
|
|
4038
|
+
|
|
4039
|
+
// Set Webkit style
|
|
4040
|
+
var webkitScrollbarStyle = getComputedStyle(ele, '::-webkit-scrollbar');
|
|
4041
|
+
var width = parseInt(webkitScrollbarStyle.width, 10);
|
|
4042
|
+
var height = parseInt(webkitScrollbarStyle.height, 10);
|
|
4043
|
+
|
|
4044
|
+
// Try wrap to handle CSP case
|
|
4045
|
+
try {
|
|
4046
|
+
var widthStyle = width ? "width: ".concat(webkitScrollbarStyle.width, ";") : '';
|
|
4047
|
+
var heightStyle = height ? "height: ".concat(webkitScrollbarStyle.height, ";") : '';
|
|
4048
|
+
updateCSS("\n#".concat(randomId, "::-webkit-scrollbar {\n").concat(widthStyle, "\n").concat(heightStyle, "\n}"), randomId);
|
|
4049
|
+
} catch (e) {
|
|
4050
|
+
// Can't wrap, just log error
|
|
4051
|
+
console.error(e);
|
|
4052
|
+
|
|
4053
|
+
// Get from style directly
|
|
4054
|
+
fallbackWidth = width;
|
|
4055
|
+
fallbackHeight = height;
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
document.body.appendChild(measureEle);
|
|
4059
|
+
|
|
4060
|
+
// Measure. Get fallback style if provided
|
|
4061
|
+
var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;
|
|
4062
|
+
var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;
|
|
3983
4063
|
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
inner.style.width = '100%';
|
|
3992
|
-
inner.style.height = '200px';
|
|
3993
|
-
var outer = document.createElement('div');
|
|
3994
|
-
var outerStyle = outer.style;
|
|
3995
|
-
outerStyle.position = 'absolute';
|
|
3996
|
-
outerStyle.top = '0';
|
|
3997
|
-
outerStyle.left = '0';
|
|
3998
|
-
outerStyle.pointerEvents = 'none';
|
|
3999
|
-
outerStyle.visibility = 'hidden';
|
|
4000
|
-
outerStyle.width = '200px';
|
|
4001
|
-
outerStyle.height = '150px';
|
|
4002
|
-
outerStyle.overflow = 'hidden';
|
|
4003
|
-
outer.appendChild(inner);
|
|
4004
|
-
document.body.appendChild(outer);
|
|
4005
|
-
var widthContained = inner.offsetWidth;
|
|
4006
|
-
outer.style.overflow = 'scroll';
|
|
4007
|
-
var widthScroll = inner.offsetWidth;
|
|
4008
|
-
if (widthContained === widthScroll) {
|
|
4009
|
-
widthScroll = outer.clientWidth;
|
|
4010
|
-
}
|
|
4011
|
-
document.body.removeChild(outer);
|
|
4012
|
-
cached = widthContained - widthScroll;
|
|
4013
|
-
}
|
|
4014
|
-
return cached;
|
|
4015
|
-
}
|
|
4016
|
-
function ensureSize(str) {
|
|
4017
|
-
var match = str.match(/^(.*)px$/);
|
|
4018
|
-
var value = Number(match === null || match === void 0 ? void 0 : match[1]);
|
|
4019
|
-
return Number.isNaN(value) ? getScrollBarSize() : value;
|
|
4064
|
+
// Clean up
|
|
4065
|
+
document.body.removeChild(measureEle);
|
|
4066
|
+
removeCSS(randomId);
|
|
4067
|
+
return {
|
|
4068
|
+
width: scrollWidth,
|
|
4069
|
+
height: scrollHeight
|
|
4070
|
+
};
|
|
4020
4071
|
}
|
|
4021
4072
|
function getTargetScrollBarSize(target) {
|
|
4022
4073
|
if (typeof document === 'undefined' || !target || !(target instanceof Element)) {
|
|
@@ -4025,13 +4076,7 @@ function getTargetScrollBarSize(target) {
|
|
|
4025
4076
|
height: 0
|
|
4026
4077
|
};
|
|
4027
4078
|
}
|
|
4028
|
-
|
|
4029
|
-
width = _getComputedStyle.width,
|
|
4030
|
-
height = _getComputedStyle.height;
|
|
4031
|
-
return {
|
|
4032
|
-
width: ensureSize(width),
|
|
4033
|
-
height: ensureSize(height)
|
|
4034
|
-
};
|
|
4079
|
+
return measureScrollbarSize(target);
|
|
4035
4080
|
}
|
|
4036
4081
|
|
|
4037
4082
|
/**
|
|
@@ -5355,7 +5400,9 @@ var _excluded$6 = ["prefixCls", "children", "action", "showAction", "hideAction"
|
|
|
5355
5400
|
// Removed Props List
|
|
5356
5401
|
// Seems this can be auto
|
|
5357
5402
|
// getDocument?: (element?: HTMLElement) => Document;
|
|
5403
|
+
|
|
5358
5404
|
// New version will not wrap popup with `rc-trigger-popup-content` when multiple children
|
|
5405
|
+
|
|
5359
5406
|
function generateTrigger() {
|
|
5360
5407
|
var PortalComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Portal;
|
|
5361
5408
|
var Trigger = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
@@ -5703,9 +5750,9 @@ function generateTrigger() {
|
|
|
5703
5750
|
wrapperAction('onPointerEnter', true, mouseEnterDelay, function (event) {
|
|
5704
5751
|
setMousePosByEvent(event);
|
|
5705
5752
|
});
|
|
5706
|
-
onPopupMouseEnter = function onPopupMouseEnter() {
|
|
5753
|
+
onPopupMouseEnter = function onPopupMouseEnter(event) {
|
|
5707
5754
|
// Only trigger re-open when popup is visible
|
|
5708
|
-
if (mergedOpen || inMotion) {
|
|
5755
|
+
if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
|
|
5709
5756
|
triggerOpen(true, mouseEnterDelay);
|
|
5710
5757
|
}
|
|
5711
5758
|
};
|
|
@@ -6930,16 +6977,15 @@ var Filler = /*#__PURE__*/React$4.forwardRef(function (_ref, ref) {
|
|
|
6930
6977
|
flexDirection: 'column'
|
|
6931
6978
|
};
|
|
6932
6979
|
if (offsetY !== undefined) {
|
|
6933
|
-
var _objectSpread2$1;
|
|
6934
6980
|
// Not set `width` since this will break `sticky: right`
|
|
6935
6981
|
outerStyle = {
|
|
6936
6982
|
height: height,
|
|
6937
6983
|
position: 'relative',
|
|
6938
6984
|
overflow: 'hidden'
|
|
6939
6985
|
};
|
|
6940
|
-
innerStyle = _objectSpread2(_objectSpread2({}, innerStyle), {}, (
|
|
6986
|
+
innerStyle = _objectSpread2(_objectSpread2({}, innerStyle), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
6941
6987
|
transform: "translateY(".concat(offsetY, "px)")
|
|
6942
|
-
},
|
|
6988
|
+
}, rtl ? 'marginRight' : 'marginLeft', -offsetX), "position", 'absolute'), "left", 0), "right", 0), "top", 0));
|
|
6943
6989
|
}
|
|
6944
6990
|
return /*#__PURE__*/React$4.createElement("div", {
|
|
6945
6991
|
style: outerStyle
|
|
@@ -6963,7 +7009,6 @@ function getPageXY(e, horizontal) {
|
|
|
6963
7009
|
return obj[horizontal ? 'pageX' : 'pageY'];
|
|
6964
7010
|
}
|
|
6965
7011
|
var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
6966
|
-
var _classNames;
|
|
6967
7012
|
var prefixCls = props.prefixCls,
|
|
6968
7013
|
rtl = props.rtl,
|
|
6969
7014
|
scrollOffset = props.scrollOffset,
|
|
@@ -6989,9 +7034,11 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
6989
7034
|
startTop = _React$useState6[0],
|
|
6990
7035
|
setStartTop = _React$useState6[1];
|
|
6991
7036
|
var isLTR = !rtl;
|
|
7037
|
+
|
|
6992
7038
|
// ========================= Refs =========================
|
|
6993
7039
|
var scrollbarRef = React$4.useRef();
|
|
6994
7040
|
var thumbRef = React$4.useRef();
|
|
7041
|
+
|
|
6995
7042
|
// ======================= Visible ========================
|
|
6996
7043
|
var _React$useState7 = React$4.useState(false),
|
|
6997
7044
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
@@ -7005,11 +7052,11 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7005
7052
|
setVisible(false);
|
|
7006
7053
|
}, 3000);
|
|
7007
7054
|
};
|
|
7055
|
+
|
|
7008
7056
|
// ======================== Range =========================
|
|
7009
7057
|
var enableScrollRange = scrollRange - containerSize || 0;
|
|
7010
7058
|
var enableOffsetRange = containerSize - spinSize || 0;
|
|
7011
|
-
|
|
7012
|
-
var canScroll = enableScrollRange > 0;
|
|
7059
|
+
|
|
7013
7060
|
// ========================= Top ==========================
|
|
7014
7061
|
var top = React$4.useMemo(function () {
|
|
7015
7062
|
if (scrollOffset === 0 || enableScrollRange === 0) {
|
|
@@ -7018,11 +7065,13 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7018
7065
|
var ptg = scrollOffset / enableScrollRange;
|
|
7019
7066
|
return ptg * enableOffsetRange;
|
|
7020
7067
|
}, [scrollOffset, enableScrollRange, enableOffsetRange]);
|
|
7068
|
+
|
|
7021
7069
|
// ====================== Container =======================
|
|
7022
7070
|
var onContainerMouseDown = function onContainerMouseDown(e) {
|
|
7023
7071
|
e.stopPropagation();
|
|
7024
7072
|
e.preventDefault();
|
|
7025
7073
|
};
|
|
7074
|
+
|
|
7026
7075
|
// ======================== Thumb =========================
|
|
7027
7076
|
var stateRef = React$4.useRef({
|
|
7028
7077
|
top: top,
|
|
@@ -7044,7 +7093,9 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7044
7093
|
e.stopPropagation();
|
|
7045
7094
|
e.preventDefault();
|
|
7046
7095
|
};
|
|
7096
|
+
|
|
7047
7097
|
// ======================== Effect ========================
|
|
7098
|
+
|
|
7048
7099
|
// React make event as passive, but we need to preventDefault
|
|
7049
7100
|
// Add event on dom directly instead.
|
|
7050
7101
|
// ref: https://github.com/facebook/react/issues/9809
|
|
@@ -7061,6 +7112,7 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7061
7112
|
thumbEle.removeEventListener('touchstart', onThumbMouseDown);
|
|
7062
7113
|
};
|
|
7063
7114
|
}, []);
|
|
7115
|
+
|
|
7064
7116
|
// Pass to effect
|
|
7065
7117
|
var enableScrollRangeRef = React$4.useRef();
|
|
7066
7118
|
enableScrollRangeRef.current = enableScrollRange;
|
|
@@ -7114,17 +7166,19 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7114
7166
|
React$4.useEffect(function () {
|
|
7115
7167
|
delayHidden();
|
|
7116
7168
|
}, [scrollOffset]);
|
|
7169
|
+
|
|
7117
7170
|
// ====================== Imperative ======================
|
|
7118
7171
|
React$4.useImperativeHandle(ref, function () {
|
|
7119
7172
|
return {
|
|
7120
7173
|
delayHidden: delayHidden
|
|
7121
7174
|
};
|
|
7122
7175
|
});
|
|
7176
|
+
|
|
7123
7177
|
// ======================== Render ========================
|
|
7124
7178
|
var scrollbarPrefixCls = "".concat(prefixCls, "-scrollbar");
|
|
7125
7179
|
var containerStyle = {
|
|
7126
7180
|
position: 'absolute',
|
|
7127
|
-
visibility: visible
|
|
7181
|
+
visibility: visible ? null : 'hidden'
|
|
7128
7182
|
};
|
|
7129
7183
|
var thumbStyle = {
|
|
7130
7184
|
position: 'absolute',
|
|
@@ -7139,6 +7193,7 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7139
7193
|
containerStyle.left = 0;
|
|
7140
7194
|
containerStyle.right = 0;
|
|
7141
7195
|
containerStyle.bottom = 0;
|
|
7196
|
+
|
|
7142
7197
|
// Thumb
|
|
7143
7198
|
thumbStyle.height = '100%';
|
|
7144
7199
|
thumbStyle.width = spinSize;
|
|
@@ -7157,6 +7212,7 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7157
7212
|
} else {
|
|
7158
7213
|
containerStyle.left = 0;
|
|
7159
7214
|
}
|
|
7215
|
+
|
|
7160
7216
|
// Thumb
|
|
7161
7217
|
thumbStyle.width = '100%';
|
|
7162
7218
|
thumbStyle.height = spinSize;
|
|
@@ -7164,7 +7220,7 @@ var ScrollBar = /*#__PURE__*/React$4.forwardRef(function (props, ref) {
|
|
|
7164
7220
|
}
|
|
7165
7221
|
return /*#__PURE__*/React$4.createElement("div", {
|
|
7166
7222
|
ref: scrollbarRef,
|
|
7167
|
-
className: classNames(scrollbarPrefixCls, (
|
|
7223
|
+
className: classNames(scrollbarPrefixCls, _defineProperty(_defineProperty(_defineProperty({}, "".concat(scrollbarPrefixCls, "-horizontal"), horizontal), "".concat(scrollbarPrefixCls, "-vertical"), !horizontal), "".concat(scrollbarPrefixCls, "-visible"), visible)),
|
|
7168
7224
|
style: _objectSpread2(_objectSpread2({}, containerStyle), style),
|
|
7169
7225
|
onMouseDown: onContainerMouseDown,
|
|
7170
7226
|
onMouseMove: delayHidden
|
|
@@ -7213,10 +7269,10 @@ function useChildren(list, startIndex, endIndex, scrollWidth, setNodeRef, render
|
|
|
7213
7269
|
var CacheMap = /*#__PURE__*/function () {
|
|
7214
7270
|
function CacheMap() {
|
|
7215
7271
|
_classCallCheck(this, CacheMap);
|
|
7216
|
-
this
|
|
7272
|
+
_defineProperty(this, "maps", void 0);
|
|
7217
7273
|
// Used for cache key
|
|
7218
7274
|
// `useMemo` no need to update if `id` not change
|
|
7219
|
-
this
|
|
7275
|
+
_defineProperty(this, "id", 0);
|
|
7220
7276
|
this.maps = Object.create(null);
|
|
7221
7277
|
}
|
|
7222
7278
|
_createClass(CacheMap, [{
|
|
@@ -7258,6 +7314,7 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
|
|
|
7258
7314
|
}
|
|
7259
7315
|
}
|
|
7260
7316
|
});
|
|
7317
|
+
|
|
7261
7318
|
// Always trigger update mark to tell parent that should re-calculate heights when resized
|
|
7262
7319
|
setUpdatedMark(function (c) {
|
|
7263
7320
|
return c + 1;
|
|
@@ -7278,12 +7335,13 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
|
|
|
7278
7335
|
} else {
|
|
7279
7336
|
instanceRef.current.delete(key);
|
|
7280
7337
|
}
|
|
7338
|
+
|
|
7281
7339
|
// Instance changed
|
|
7282
7340
|
if (!origin !== !instance) {
|
|
7283
7341
|
if (instance) {
|
|
7284
|
-
onItemAdd === null || onItemAdd === void 0
|
|
7342
|
+
onItemAdd === null || onItemAdd === void 0 || onItemAdd(item);
|
|
7285
7343
|
} else {
|
|
7286
|
-
onItemRemove === null || onItemRemove === void 0
|
|
7344
|
+
onItemRemove === null || onItemRemove === void 0 || onItemRemove(item);
|
|
7287
7345
|
}
|
|
7288
7346
|
}
|
|
7289
7347
|
}
|
|
@@ -7300,6 +7358,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7300
7358
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
7301
7359
|
syncState = _React$useState2[0],
|
|
7302
7360
|
setSyncState = _React$useState2[1];
|
|
7361
|
+
|
|
7303
7362
|
// ========================== Sync Scroll ==========================
|
|
7304
7363
|
useLayoutEffect$3(function () {
|
|
7305
7364
|
if (syncState && syncState.times < MAX_TIMES) {
|
|
@@ -7319,9 +7378,11 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7319
7378
|
var needCollectHeight = false;
|
|
7320
7379
|
var newTargetAlign = targetAlign;
|
|
7321
7380
|
var targetTop = null;
|
|
7381
|
+
|
|
7322
7382
|
// Go to next frame if height not exist
|
|
7323
7383
|
if (height) {
|
|
7324
7384
|
var mergedAlign = targetAlign || originAlign;
|
|
7385
|
+
|
|
7325
7386
|
// Get top & bottom
|
|
7326
7387
|
var stackTop = 0;
|
|
7327
7388
|
var itemTop = 0;
|
|
@@ -7334,6 +7395,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7334
7395
|
itemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight);
|
|
7335
7396
|
stackTop = itemBottom;
|
|
7336
7397
|
}
|
|
7398
|
+
|
|
7337
7399
|
// Check if need sync height (visible range has item not record height)
|
|
7338
7400
|
var leftHeight = mergedAlign === 'top' ? offset : height - offset;
|
|
7339
7401
|
for (var _i = maxLen; _i >= 0; _i -= 1) {
|
|
@@ -7348,6 +7410,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7348
7410
|
break;
|
|
7349
7411
|
}
|
|
7350
7412
|
}
|
|
7413
|
+
|
|
7351
7414
|
// Scroll to
|
|
7352
7415
|
switch (mergedAlign) {
|
|
7353
7416
|
case 'top':
|
|
@@ -7370,11 +7433,13 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7370
7433
|
if (targetTop !== null) {
|
|
7371
7434
|
syncScrollTop(targetTop);
|
|
7372
7435
|
}
|
|
7436
|
+
|
|
7373
7437
|
// One more time for sync
|
|
7374
7438
|
if (targetTop !== syncState.lastTop) {
|
|
7375
7439
|
needCollectHeight = true;
|
|
7376
7440
|
}
|
|
7377
7441
|
}
|
|
7442
|
+
|
|
7378
7443
|
// Trigger next effect
|
|
7379
7444
|
if (needCollectHeight) {
|
|
7380
7445
|
setSyncState(_objectSpread2(_objectSpread2({}, syncState), {}, {
|
|
@@ -7387,6 +7452,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7387
7452
|
warningOnce(false, 'Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.');
|
|
7388
7453
|
}
|
|
7389
7454
|
}, [syncState, containerRef.current]);
|
|
7455
|
+
|
|
7390
7456
|
// =========================== Scroll To ===========================
|
|
7391
7457
|
return function (arg) {
|
|
7392
7458
|
// When not argument provided, we think dev may want to show the scrollbar
|
|
@@ -7394,6 +7460,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7394
7460
|
triggerFlash();
|
|
7395
7461
|
return;
|
|
7396
7462
|
}
|
|
7463
|
+
|
|
7397
7464
|
// Normal scroll logic
|
|
7398
7465
|
wrapperRaf.cancel(scrollRef.current);
|
|
7399
7466
|
if (typeof arg === 'number') {
|
|
@@ -7433,6 +7500,7 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
|
|
|
7433
7500
|
* [5]: 9
|
|
7434
7501
|
* [6]: 3
|
|
7435
7502
|
*/
|
|
7503
|
+
|
|
7436
7504
|
/**
|
|
7437
7505
|
* We assume that 2 list has only 1 item diff and others keeping the order.
|
|
7438
7506
|
* So we can use dichotomy algorithm to find changed one.
|
|
@@ -7461,6 +7529,7 @@ function findListDiffIndex(originList, targetList, getKey) {
|
|
|
7461
7529
|
}
|
|
7462
7530
|
return notExistKey;
|
|
7463
7531
|
}
|
|
7532
|
+
|
|
7464
7533
|
// Loop to find diff one
|
|
7465
7534
|
var diffIndex = null;
|
|
7466
7535
|
var multiple = Math.abs(originLen - targetLen) !== 1;
|
|
@@ -7491,7 +7560,7 @@ function useDiffItem(data, getKey, onDiff) {
|
|
|
7491
7560
|
React$4.useEffect(function () {
|
|
7492
7561
|
var diff = findListDiffIndex(prevData || [], data || [], getKey);
|
|
7493
7562
|
if ((diff === null || diff === void 0 ? void 0 : diff.index) !== undefined) {
|
|
7494
|
-
onDiff === null || onDiff === void 0
|
|
7563
|
+
onDiff === null || onDiff === void 0 || onDiff(diff.index);
|
|
7495
7564
|
setDiffItem(data[diff.index]);
|
|
7496
7565
|
}
|
|
7497
7566
|
setPrevData(data);
|
|
@@ -7512,6 +7581,7 @@ var useOriginScroll = (function (isScrollAtTop, isScrollAtBottom) {
|
|
|
7512
7581
|
lockRef.current = false;
|
|
7513
7582
|
}, 50);
|
|
7514
7583
|
}
|
|
7584
|
+
|
|
7515
7585
|
// Pass to ref since global add is in closure
|
|
7516
7586
|
var scrollPingRef = useRef({
|
|
7517
7587
|
top: isScrollAtTop,
|
|
@@ -7544,17 +7614,21 @@ function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, horizontalScr
|
|
|
7544
7614
|
onWheelDelta) {
|
|
7545
7615
|
var offsetRef = useRef(0);
|
|
7546
7616
|
var nextFrameRef = useRef(null);
|
|
7617
|
+
|
|
7547
7618
|
// Firefox patch
|
|
7548
7619
|
var wheelValueRef = useRef(null);
|
|
7549
7620
|
var isMouseScrollRef = useRef(false);
|
|
7621
|
+
|
|
7550
7622
|
// Scroll status sync
|
|
7551
7623
|
var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
|
|
7552
7624
|
function onWheelY(event, deltaY) {
|
|
7553
7625
|
wrapperRaf.cancel(nextFrameRef.current);
|
|
7554
7626
|
offsetRef.current += deltaY;
|
|
7555
7627
|
wheelValueRef.current = deltaY;
|
|
7628
|
+
|
|
7556
7629
|
// Do nothing when scroll at the edge, Skip check when is in scroll
|
|
7557
7630
|
if (originScroll(deltaY)) return;
|
|
7631
|
+
|
|
7558
7632
|
// Proxy of scroll events
|
|
7559
7633
|
if (!isFF) {
|
|
7560
7634
|
event.preventDefault();
|
|
@@ -7573,11 +7647,13 @@ onWheelDelta) {
|
|
|
7573
7647
|
event.preventDefault();
|
|
7574
7648
|
}
|
|
7575
7649
|
}
|
|
7650
|
+
|
|
7576
7651
|
// Check for which direction does wheel do. `sx` means `shift + wheel`
|
|
7577
7652
|
var wheelDirectionRef = useRef(null);
|
|
7578
7653
|
var wheelDirectionCleanRef = useRef(null);
|
|
7579
7654
|
function onWheel(event) {
|
|
7580
7655
|
if (!inVirtual) return;
|
|
7656
|
+
|
|
7581
7657
|
// Wait for 2 frame to clean direction
|
|
7582
7658
|
wrapperRaf.cancel(wheelDirectionCleanRef.current);
|
|
7583
7659
|
wheelDirectionCleanRef.current = wrapperRaf(function () {
|
|
@@ -7604,6 +7680,7 @@ onWheelDelta) {
|
|
|
7604
7680
|
onWheelX(event, mergedDeltaX);
|
|
7605
7681
|
}
|
|
7606
7682
|
}
|
|
7683
|
+
|
|
7607
7684
|
// A patch for firefox
|
|
7608
7685
|
function onFireFoxScroll(event) {
|
|
7609
7686
|
if (!inVirtual) return;
|
|
@@ -7617,23 +7694,26 @@ function useMobileTouchMove(inVirtual, listRef, callback) {
|
|
|
7617
7694
|
var touchedRef = useRef(false);
|
|
7618
7695
|
var touchYRef = useRef(0);
|
|
7619
7696
|
var elementRef = useRef(null);
|
|
7697
|
+
|
|
7620
7698
|
// Smooth scroll
|
|
7621
7699
|
var intervalRef = useRef(null);
|
|
7700
|
+
|
|
7622
7701
|
/* eslint-disable prefer-const */
|
|
7623
7702
|
var cleanUpEvents;
|
|
7624
7703
|
var onTouchMove = function onTouchMove(e) {
|
|
7625
7704
|
if (touchedRef.current) {
|
|
7626
7705
|
var currentY = Math.ceil(e.touches[0].pageY);
|
|
7627
|
-
var
|
|
7706
|
+
var _offsetY = touchYRef.current - currentY;
|
|
7628
7707
|
touchYRef.current = currentY;
|
|
7629
|
-
if (callback(
|
|
7708
|
+
if (callback(_offsetY)) {
|
|
7630
7709
|
e.preventDefault();
|
|
7631
7710
|
}
|
|
7711
|
+
|
|
7632
7712
|
// Smooth interval
|
|
7633
7713
|
clearInterval(intervalRef.current);
|
|
7634
7714
|
intervalRef.current = setInterval(function () {
|
|
7635
|
-
|
|
7636
|
-
if (!callback(
|
|
7715
|
+
_offsetY *= SMOOTH_PTG;
|
|
7716
|
+
if (!callback(_offsetY, true) || Math.abs(_offsetY) <= 0.1) {
|
|
7637
7717
|
clearInterval(intervalRef.current);
|
|
7638
7718
|
}
|
|
7639
7719
|
}, 16);
|
|
@@ -7665,7 +7745,7 @@ function useMobileTouchMove(inVirtual, listRef, callback) {
|
|
|
7665
7745
|
}
|
|
7666
7746
|
return function () {
|
|
7667
7747
|
var _listRef$current;
|
|
7668
|
-
(_listRef$current = listRef.current) === null || _listRef$current === void 0
|
|
7748
|
+
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.removeEventListener('touchstart', onTouchStart);
|
|
7669
7749
|
cleanUpEvents();
|
|
7670
7750
|
clearInterval(intervalRef.current);
|
|
7671
7751
|
};
|
|
@@ -7676,12 +7756,11 @@ var MIN_SIZE = 20;
|
|
|
7676
7756
|
function getSpinSize() {
|
|
7677
7757
|
var containerSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
7678
7758
|
var scrollRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
7679
|
-
var baseSize = containerSize / scrollRange *
|
|
7759
|
+
var baseSize = containerSize / scrollRange * containerSize;
|
|
7680
7760
|
if (isNaN(baseSize)) {
|
|
7681
7761
|
baseSize = 0;
|
|
7682
7762
|
}
|
|
7683
7763
|
baseSize = Math.max(baseSize, MIN_SIZE);
|
|
7684
|
-
baseSize = Math.min(baseSize, containerSize / 2);
|
|
7685
7764
|
return Math.floor(baseSize);
|
|
7686
7765
|
}
|
|
7687
7766
|
|
|
@@ -7701,6 +7780,7 @@ function useGetSize(mergedData, getKey, heights, itemHeight) {
|
|
|
7701
7780
|
// Get from cache first
|
|
7702
7781
|
var startIndex = key2Index.get(startKey);
|
|
7703
7782
|
var endIndex = key2Index.get(endKey);
|
|
7783
|
+
|
|
7704
7784
|
// Loop to fill the cache
|
|
7705
7785
|
if (startIndex === undefined || endIndex === undefined) {
|
|
7706
7786
|
var dataLen = mergedData.length;
|
|
@@ -7760,6 +7840,7 @@ function RawList(props, ref) {
|
|
|
7760
7840
|
extraRender = props.extraRender,
|
|
7761
7841
|
styles = props.styles,
|
|
7762
7842
|
restProps = _objectWithoutProperties(props, _excluded$2);
|
|
7843
|
+
|
|
7763
7844
|
// ================================= MISC =================================
|
|
7764
7845
|
var useVirtual = !!(virtual !== false && height && itemHeight);
|
|
7765
7846
|
var inVirtual = useVirtual && data && (itemHeight * data.length > height || !!scrollWidth);
|
|
@@ -7768,7 +7849,9 @@ function RawList(props, ref) {
|
|
|
7768
7849
|
var mergedData = data || EMPTY_DATA;
|
|
7769
7850
|
var componentRef = useRef();
|
|
7770
7851
|
var fillerInnerRef = useRef();
|
|
7852
|
+
|
|
7771
7853
|
// =============================== Item Key ===============================
|
|
7854
|
+
|
|
7772
7855
|
var _useState = useState$1(0),
|
|
7773
7856
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7774
7857
|
offsetTop = _useState2[0],
|
|
@@ -7787,6 +7870,7 @@ function RawList(props, ref) {
|
|
|
7787
7870
|
var onScrollbarStopMove = function onScrollbarStopMove() {
|
|
7788
7871
|
setScrollMoving(false);
|
|
7789
7872
|
};
|
|
7873
|
+
|
|
7790
7874
|
// =============================== Item Key ===============================
|
|
7791
7875
|
var getKey = React$4.useCallback(function (item) {
|
|
7792
7876
|
if (typeof itemKey === 'function') {
|
|
@@ -7797,6 +7881,7 @@ function RawList(props, ref) {
|
|
|
7797
7881
|
var sharedConfig = {
|
|
7798
7882
|
getKey: getKey
|
|
7799
7883
|
};
|
|
7884
|
+
|
|
7800
7885
|
// ================================ Scroll ================================
|
|
7801
7886
|
function syncScrollTop(newTop) {
|
|
7802
7887
|
setOffsetTop(function (origin) {
|
|
@@ -7811,6 +7896,7 @@ function RawList(props, ref) {
|
|
|
7811
7896
|
return alignedTop;
|
|
7812
7897
|
});
|
|
7813
7898
|
}
|
|
7899
|
+
|
|
7814
7900
|
// ================================ Legacy ================================
|
|
7815
7901
|
// Put ref here since the range is generate by follow
|
|
7816
7902
|
var rangeRef = useRef({
|
|
@@ -7822,6 +7908,7 @@ function RawList(props, ref) {
|
|
|
7822
7908
|
_useDiffItem2 = _slicedToArray(_useDiffItem, 1),
|
|
7823
7909
|
diffItem = _useDiffItem2[0];
|
|
7824
7910
|
diffItemRef.current = diffItem;
|
|
7911
|
+
|
|
7825
7912
|
// ================================ Height ================================
|
|
7826
7913
|
var _useHeights = useHeights(getKey, null, null),
|
|
7827
7914
|
_useHeights2 = _slicedToArray(_useHeights, 4),
|
|
@@ -7829,6 +7916,7 @@ function RawList(props, ref) {
|
|
|
7829
7916
|
collectHeight = _useHeights2[1],
|
|
7830
7917
|
heights = _useHeights2[2],
|
|
7831
7918
|
heightUpdatedMark = _useHeights2[3];
|
|
7919
|
+
|
|
7832
7920
|
// ========================== Visible Calculation =========================
|
|
7833
7921
|
var _React$useMemo = React$4.useMemo(function () {
|
|
7834
7922
|
if (!useVirtual) {
|
|
@@ -7839,6 +7927,7 @@ function RawList(props, ref) {
|
|
|
7839
7927
|
offset: undefined
|
|
7840
7928
|
};
|
|
7841
7929
|
}
|
|
7930
|
+
|
|
7842
7931
|
// Always use virtual scroll bar in avoid shaking
|
|
7843
7932
|
if (!inVirtual) {
|
|
7844
7933
|
var _fillerInnerRef$curre;
|
|
@@ -7855,21 +7944,24 @@ function RawList(props, ref) {
|
|
|
7855
7944
|
var endIndex;
|
|
7856
7945
|
var dataLen = mergedData.length;
|
|
7857
7946
|
for (var i = 0; i < dataLen; i += 1) {
|
|
7858
|
-
var
|
|
7859
|
-
var key = getKey(
|
|
7947
|
+
var _item = mergedData[i];
|
|
7948
|
+
var key = getKey(_item);
|
|
7860
7949
|
var cacheHeight = heights.get(key);
|
|
7861
7950
|
var currentItemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight);
|
|
7951
|
+
|
|
7862
7952
|
// Check item top in the range
|
|
7863
7953
|
if (currentItemBottom >= offsetTop && startIndex === undefined) {
|
|
7864
7954
|
startIndex = i;
|
|
7865
7955
|
startOffset = itemTop;
|
|
7866
7956
|
}
|
|
7957
|
+
|
|
7867
7958
|
// Check item bottom in the range. We will render additional one item for motion usage
|
|
7868
7959
|
if (currentItemBottom > offsetTop + height && endIndex === undefined) {
|
|
7869
7960
|
endIndex = i;
|
|
7870
7961
|
}
|
|
7871
7962
|
itemTop = currentItemBottom;
|
|
7872
7963
|
}
|
|
7964
|
+
|
|
7873
7965
|
// When scrollTop at the end but data cut to small count will reach this
|
|
7874
7966
|
if (startIndex === undefined) {
|
|
7875
7967
|
startIndex = 0;
|
|
@@ -7879,6 +7971,7 @@ function RawList(props, ref) {
|
|
|
7879
7971
|
if (endIndex === undefined) {
|
|
7880
7972
|
endIndex = mergedData.length - 1;
|
|
7881
7973
|
}
|
|
7974
|
+
|
|
7882
7975
|
// Give cache to improve scroll experience
|
|
7883
7976
|
endIndex = Math.min(endIndex + 1, mergedData.length - 1);
|
|
7884
7977
|
return {
|
|
@@ -7894,6 +7987,7 @@ function RawList(props, ref) {
|
|
|
7894
7987
|
fillerOffset = _React$useMemo.offset;
|
|
7895
7988
|
rangeRef.current.start = start;
|
|
7896
7989
|
rangeRef.current.end = end;
|
|
7990
|
+
|
|
7897
7991
|
// ================================= Size =================================
|
|
7898
7992
|
var _React$useState = React$4.useState({
|
|
7899
7993
|
width: 0,
|
|
@@ -7908,6 +8002,7 @@ function RawList(props, ref) {
|
|
|
7908
8002
|
height: sizeInfo.height || sizeInfo.offsetHeight
|
|
7909
8003
|
});
|
|
7910
8004
|
};
|
|
8005
|
+
|
|
7911
8006
|
// Hack on scrollbar to enable flash call
|
|
7912
8007
|
var verticalScrollBarRef = useRef();
|
|
7913
8008
|
var horizontalScrollBarRef = useRef();
|
|
@@ -7917,6 +8012,7 @@ function RawList(props, ref) {
|
|
|
7917
8012
|
var verticalScrollBarSpinSize = React$4.useMemo(function () {
|
|
7918
8013
|
return getSpinSize(size.height, scrollHeight);
|
|
7919
8014
|
}, [size.height, scrollHeight]);
|
|
8015
|
+
|
|
7920
8016
|
// =============================== In Range ===============================
|
|
7921
8017
|
var maxScrollHeight = scrollHeight - height;
|
|
7922
8018
|
var maxScrollHeightRef = useRef(maxScrollHeight);
|
|
@@ -7932,6 +8028,7 @@ function RawList(props, ref) {
|
|
|
7932
8028
|
var isScrollAtTop = offsetTop <= 0;
|
|
7933
8029
|
var isScrollAtBottom = offsetTop >= maxScrollHeight;
|
|
7934
8030
|
var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
|
|
8031
|
+
|
|
7935
8032
|
// ================================ Scroll ================================
|
|
7936
8033
|
var getVirtualScrollInfo = function getVirtualScrollInfo() {
|
|
7937
8034
|
return {
|
|
@@ -7943,6 +8040,7 @@ function RawList(props, ref) {
|
|
|
7943
8040
|
var triggerScroll = useEvent$2(function () {
|
|
7944
8041
|
if (onVirtualScroll) {
|
|
7945
8042
|
var nextInfo = getVirtualScrollInfo();
|
|
8043
|
+
|
|
7946
8044
|
// Trigger when offset changed
|
|
7947
8045
|
if (lastVirtualScrollInfoRef.current.x !== nextInfo.x || lastVirtualScrollInfoRef.current.y !== nextInfo.y) {
|
|
7948
8046
|
onVirtualScroll(nextInfo);
|
|
@@ -7961,14 +8059,16 @@ function RawList(props, ref) {
|
|
|
7961
8059
|
syncScrollTop(newOffset);
|
|
7962
8060
|
}
|
|
7963
8061
|
}
|
|
8062
|
+
|
|
7964
8063
|
// When data size reduce. It may trigger native scroll event back to fit scroll position
|
|
7965
8064
|
function onFallbackScroll(e) {
|
|
7966
8065
|
var newScrollTop = e.currentTarget.scrollTop;
|
|
7967
8066
|
if (newScrollTop !== offsetTop) {
|
|
7968
8067
|
syncScrollTop(newScrollTop);
|
|
7969
8068
|
}
|
|
8069
|
+
|
|
7970
8070
|
// Trigger origin onScroll
|
|
7971
|
-
onScroll === null || onScroll === void 0
|
|
8071
|
+
onScroll === null || onScroll === void 0 || onScroll(e);
|
|
7972
8072
|
triggerScroll();
|
|
7973
8073
|
}
|
|
7974
8074
|
var keepInHorizontalRange = function keepInHorizontalRange(nextOffsetLeft) {
|
|
@@ -7981,6 +8081,7 @@ function RawList(props, ref) {
|
|
|
7981
8081
|
var onWheelDelta = useEvent$2(function (offsetXY, fromHorizontal) {
|
|
7982
8082
|
if (fromHorizontal) {
|
|
7983
8083
|
// Horizontal scroll no need sync virtual position
|
|
8084
|
+
|
|
7984
8085
|
flushSync(function () {
|
|
7985
8086
|
setOffsetLeft(function (left) {
|
|
7986
8087
|
var nextOffsetLeft = left + (isRTL ? -offsetXY : offsetXY);
|
|
@@ -7995,11 +8096,13 @@ function RawList(props, ref) {
|
|
|
7995
8096
|
});
|
|
7996
8097
|
}
|
|
7997
8098
|
});
|
|
8099
|
+
|
|
7998
8100
|
// Since this added in global,should use ref to keep update
|
|
7999
8101
|
var _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, !!scrollWidth, onWheelDelta),
|
|
8000
8102
|
_useFrameWheel2 = _slicedToArray(_useFrameWheel, 2),
|
|
8001
8103
|
onRawWheel = _useFrameWheel2[0],
|
|
8002
8104
|
onFireFoxScroll = _useFrameWheel2[1];
|
|
8105
|
+
|
|
8003
8106
|
// Mobile touch move
|
|
8004
8107
|
useMobileTouchMove(useVirtual, componentRef, function (deltaY, smoothOffset) {
|
|
8005
8108
|
if (originScroll(deltaY, smoothOffset)) {
|
|
@@ -8028,6 +8131,7 @@ function RawList(props, ref) {
|
|
|
8028
8131
|
componentEle.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll);
|
|
8029
8132
|
};
|
|
8030
8133
|
}, [useVirtual]);
|
|
8134
|
+
|
|
8031
8135
|
// Sync scroll left
|
|
8032
8136
|
useLayoutEffect$3(function () {
|
|
8033
8137
|
if (scrollWidth) {
|
|
@@ -8036,11 +8140,12 @@ function RawList(props, ref) {
|
|
|
8036
8140
|
});
|
|
8037
8141
|
}
|
|
8038
8142
|
}, [size.width, scrollWidth]);
|
|
8143
|
+
|
|
8039
8144
|
// ================================= Ref ==================================
|
|
8040
8145
|
var delayHideScrollBar = function delayHideScrollBar() {
|
|
8041
8146
|
var _verticalScrollBarRef, _horizontalScrollBarR;
|
|
8042
|
-
(_verticalScrollBarRef = verticalScrollBarRef.current) === null || _verticalScrollBarRef === void 0
|
|
8043
|
-
(_horizontalScrollBarR = horizontalScrollBarRef.current) === null || _horizontalScrollBarR === void 0
|
|
8147
|
+
(_verticalScrollBarRef = verticalScrollBarRef.current) === null || _verticalScrollBarRef === void 0 || _verticalScrollBarRef.delayHidden();
|
|
8148
|
+
(_horizontalScrollBarR = horizontalScrollBarRef.current) === null || _horizontalScrollBarR === void 0 || _horizontalScrollBarR.delayHidden();
|
|
8044
8149
|
};
|
|
8045
8150
|
var _scrollTo = useScrollTo(componentRef, mergedData, heights, itemHeight, getKey, function () {
|
|
8046
8151
|
return collectHeight(true);
|
|
@@ -8057,6 +8162,7 @@ function RawList(props, ref) {
|
|
|
8057
8162
|
if (config.left !== undefined) {
|
|
8058
8163
|
setOffsetLeft(keepInHorizontalRange(config.left));
|
|
8059
8164
|
}
|
|
8165
|
+
|
|
8060
8166
|
// Scroll Y
|
|
8061
8167
|
_scrollTo(config.top);
|
|
8062
8168
|
} else {
|
|
@@ -8065,6 +8171,7 @@ function RawList(props, ref) {
|
|
|
8065
8171
|
}
|
|
8066
8172
|
};
|
|
8067
8173
|
});
|
|
8174
|
+
|
|
8068
8175
|
// ================================ Effect ================================
|
|
8069
8176
|
/** We need told outside that some list not rendered */
|
|
8070
8177
|
useLayoutEffect$3(function () {
|
|
@@ -8073,6 +8180,7 @@ function RawList(props, ref) {
|
|
|
8073
8180
|
onVisibleChange(renderList, mergedData);
|
|
8074
8181
|
}
|
|
8075
8182
|
}, [start, end, mergedData]);
|
|
8183
|
+
|
|
8076
8184
|
// ================================ Extra =================================
|
|
8077
8185
|
var getSize = useGetSize(mergedData, getKey, heights, itemHeight);
|
|
8078
8186
|
var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({
|
|
@@ -8084,6 +8192,7 @@ function RawList(props, ref) {
|
|
|
8084
8192
|
rtl: isRTL,
|
|
8085
8193
|
getSize: getSize
|
|
8086
8194
|
});
|
|
8195
|
+
|
|
8087
8196
|
// ================================ Render ================================
|
|
8088
8197
|
var listChildren = useChildren(mergedData, start, end, scrollWidth, setInstanceRef, children, sharedConfig);
|
|
8089
8198
|
var componentStyle = null;
|
|
@@ -8140,7 +8249,7 @@ function RawList(props, ref) {
|
|
|
8140
8249
|
containerSize: size.height,
|
|
8141
8250
|
style: styles === null || styles === void 0 ? void 0 : styles.verticalScrollBar,
|
|
8142
8251
|
thumbStyle: styles === null || styles === void 0 ? void 0 : styles.verticalScrollBarThumb
|
|
8143
|
-
}), inVirtual && scrollWidth && /*#__PURE__*/React$4.createElement(ScrollBar, {
|
|
8252
|
+
}), inVirtual && scrollWidth > size.width && /*#__PURE__*/React$4.createElement(ScrollBar, {
|
|
8144
8253
|
ref: horizontalScrollBarRef,
|
|
8145
8254
|
prefixCls: prefixCls,
|
|
8146
8255
|
scrollOffset: offsetLeft,
|
|
@@ -9286,7 +9395,7 @@ var interopRequireWildcard = {exports: {}};
|
|
|
9286
9395
|
__proto__: null
|
|
9287
9396
|
},
|
|
9288
9397
|
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
9289
|
-
for (var u in e) if ("default" !== u &&
|
|
9398
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
9290
9399
|
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
9291
9400
|
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
9292
9401
|
}
|