@hi-ui/table 4.3.1 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/lib/cjs/BaseTable.js +136 -189
  3. package/lib/cjs/ColGroupContent.js +5 -28
  4. package/lib/cjs/SettingDrawer.js +76 -127
  5. package/lib/cjs/Table.js +107 -171
  6. package/lib/cjs/TableAdvancedFilter.js +49 -85
  7. package/lib/cjs/TableBody.js +33 -69
  8. package/lib/cjs/TableCell.js +56 -102
  9. package/lib/cjs/TableColumnMenu.js +39 -77
  10. package/lib/cjs/TableEmbedRow.js +11 -38
  11. package/lib/cjs/TableHeader.js +8 -33
  12. package/lib/cjs/TableRow.js +48 -88
  13. package/lib/cjs/TableSettingMenu.js +48 -94
  14. package/lib/cjs/TbodyContent.js +28 -56
  15. package/lib/cjs/TheadContent.js +20 -49
  16. package/lib/cjs/_virtual/index.js +0 -3
  17. package/lib/cjs/_virtual/index2.js +0 -3
  18. package/lib/cjs/_virtual/react-is.development.js +0 -3
  19. package/lib/cjs/_virtual/react-is.production.min.js +0 -3
  20. package/lib/cjs/context.js +0 -9
  21. package/lib/cjs/hooks/use-async-switch.js +13 -51
  22. package/lib/cjs/hooks/use-check.js +47 -77
  23. package/lib/cjs/hooks/use-col-hidden.js +16 -28
  24. package/lib/cjs/hooks/use-col-set.js +5 -18
  25. package/lib/cjs/hooks/use-col-sorter.js +18 -32
  26. package/lib/cjs/hooks/use-col-width.js +21 -57
  27. package/lib/cjs/hooks/use-colgroup.js +63 -85
  28. package/lib/cjs/hooks/use-drag.js +10 -31
  29. package/lib/cjs/hooks/use-embed-expand.js +23 -68
  30. package/lib/cjs/hooks/use-expand.js +32 -64
  31. package/lib/cjs/hooks/use-pagination.js +19 -50
  32. package/lib/cjs/hooks/use-queue.js +2 -14
  33. package/lib/cjs/icons/index.js +4 -21
  34. package/lib/cjs/index.js +0 -4
  35. package/lib/cjs/node_modules/classnames/index.js +2 -11
  36. package/lib/cjs/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -227
  37. package/lib/cjs/node_modules/rc-resize-observer/es/index.js +10 -68
  38. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -17
  39. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
  40. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -25
  41. package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +1 -5
  42. package/lib/cjs/node_modules/rc-util/es/Dom/canUseDom.js +0 -2
  43. package/lib/cjs/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
  44. package/lib/cjs/node_modules/rc-util/es/hooks/useLayoutEffect.js +2 -9
  45. package/lib/cjs/node_modules/rc-util/es/raf.js +0 -11
  46. package/lib/cjs/node_modules/rc-virtual-list/es/Filler.js +6 -25
  47. package/lib/cjs/node_modules/rc-virtual-list/es/Item.js +3 -14
  48. package/lib/cjs/node_modules/rc-virtual-list/es/List.js +103 -194
  49. package/lib/cjs/node_modules/rc-virtual-list/es/ScrollBar.js +16 -96
  50. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useChildren.js +2 -11
  51. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +8 -34
  52. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -10
  53. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useHeights.js +6 -39
  54. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -16
  55. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -9
  56. package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +3 -28
  57. package/lib/cjs/node_modules/rc-virtual-list/es/index.js +0 -2
  58. package/lib/cjs/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -9
  59. package/lib/cjs/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +0 -15
  60. package/lib/cjs/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -2
  61. package/lib/cjs/node_modules/react-is/cjs/react-is.development.js +3 -29
  62. package/lib/cjs/node_modules/react-is/cjs/react-is.production.min.js +19 -45
  63. package/lib/cjs/node_modules/react-is/index.js +0 -5
  64. package/lib/cjs/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +83 -248
  65. package/lib/cjs/packages/hooks/use-merge-refs/lib/esm/index.js +3 -14
  66. package/lib/cjs/packages/ui/scrollbar/lib/esm/Scrollbar.js +48 -86
  67. package/lib/cjs/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -15
  68. package/lib/cjs/packages/ui/scrollbar/lib/esm/utils/index.js +0 -13
  69. package/lib/cjs/styles/index.scss.js +1 -4
  70. package/lib/cjs/use-table.js +268 -355
  71. package/lib/cjs/utils/index.js +11 -45
  72. package/lib/esm/BaseTable.js +117 -138
  73. package/lib/esm/ColGroupContent.js +3 -9
  74. package/lib/esm/SettingDrawer.js +64 -83
  75. package/lib/esm/Table.js +97 -124
  76. package/lib/esm/TableAdvancedFilter.js +37 -47
  77. package/lib/esm/TableBody.js +24 -34
  78. package/lib/esm/TableCell.js +48 -72
  79. package/lib/esm/TableColumnMenu.js +24 -38
  80. package/lib/esm/TableEmbedRow.js +8 -15
  81. package/lib/esm/TableHeader.js +5 -11
  82. package/lib/esm/TableRow.js +36 -51
  83. package/lib/esm/TableSettingMenu.js +33 -49
  84. package/lib/esm/TbodyContent.js +20 -27
  85. package/lib/esm/TheadContent.js +14 -21
  86. package/lib/esm/context.js +0 -4
  87. package/lib/esm/hooks/use-async-switch.js +9 -28
  88. package/lib/esm/hooks/use-check.js +42 -55
  89. package/lib/esm/hooks/use-col-hidden.js +16 -21
  90. package/lib/esm/hooks/use-col-set.js +5 -13
  91. package/lib/esm/hooks/use-col-sorter.js +18 -23
  92. package/lib/esm/hooks/use-col-width.js +14 -34
  93. package/lib/esm/hooks/use-colgroup.js +60 -66
  94. package/lib/esm/hooks/use-drag.js +9 -13
  95. package/lib/esm/hooks/use-embed-expand.js +20 -42
  96. package/lib/esm/hooks/use-expand.js +32 -56
  97. package/lib/esm/hooks/use-pagination.js +13 -25
  98. package/lib/esm/hooks/use-queue.js +2 -10
  99. package/lib/esm/node_modules/classnames/index.js +2 -9
  100. package/lib/esm/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -228
  101. package/lib/esm/node_modules/rc-resize-observer/es/index.js +3 -26
  102. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +0 -3
  103. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
  104. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +0 -8
  105. package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +0 -5
  106. package/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +0 -1
  107. package/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
  108. package/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +1 -0
  109. package/lib/esm/node_modules/rc-util/es/raf.js +0 -10
  110. package/lib/esm/node_modules/rc-virtual-list/es/Filler.js +4 -15
  111. package/lib/esm/node_modules/rc-virtual-list/es/Item.js +1 -3
  112. package/lib/esm/node_modules/rc-virtual-list/es/List.js +101 -174
  113. package/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +14 -86
  114. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +0 -2
  115. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +6 -25
  116. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -6
  117. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +4 -28
  118. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -13
  119. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -8
  120. package/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +1 -19
  121. package/lib/esm/node_modules/rc-virtual-list/es/index.js +1 -1
  122. package/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -8
  123. package/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +1 -12
  124. package/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -1
  125. package/lib/esm/node_modules/react-is/cjs/react-is.development.js +4 -27
  126. package/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +20 -44
  127. package/lib/esm/node_modules/react-is/index.js +0 -1
  128. package/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +82 -248
  129. package/lib/esm/packages/hooks/use-merge-refs/lib/esm/index.js +3 -9
  130. package/lib/esm/packages/ui/scrollbar/lib/esm/Scrollbar.js +47 -64
  131. package/lib/esm/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -3
  132. package/lib/esm/packages/ui/scrollbar/lib/esm/utils/index.js +0 -10
  133. package/lib/esm/styles/index.scss.js +1 -3
  134. package/lib/esm/use-table.js +261 -318
  135. package/lib/esm/utils/index.js +11 -41
  136. package/lib/types/BaseTable.d.ts +2 -2
  137. package/package.json +33 -33
@@ -12,19 +12,12 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  var React = require('react');
17
-
18
16
  var findDOMNode = require('../../../rc-util/es/Dom/findDOMNode.js');
19
-
20
17
  var raf = require('../../../rc-util/es/raf.js');
21
-
22
18
  var CacheMap = require('../utils/CacheMap.js');
23
-
24
- function _interopNamespace(e) {
25
- if (e && e.__esModule) return e;
19
+ function _interopNamespaceDefault(e) {
26
20
  var n = Object.create(null);
27
-
28
21
  if (e) {
29
22
  Object.keys(e).forEach(function (k) {
30
23
  if (k !== 'default') {
@@ -38,21 +31,16 @@ function _interopNamespace(e) {
38
31
  }
39
32
  });
40
33
  }
41
-
42
34
  n["default"] = e;
43
35
  return Object.freeze(n);
44
36
  }
45
-
46
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
-
37
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
48
38
  function _slicedToArray(arr, i) {
49
39
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
50
40
  }
51
-
52
41
  function _nonIterableRest() {
53
42
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
43
  }
55
-
56
44
  function _unsupportedIterableToArray(o, minLen) {
57
45
  if (!o) return;
58
46
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -61,31 +49,23 @@ function _unsupportedIterableToArray(o, minLen) {
61
49
  if (n === "Map" || n === "Set") return Array.from(o);
62
50
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
63
51
  }
64
-
65
52
  function _arrayLikeToArray(arr, len) {
66
53
  if (len == null || len > arr.length) len = arr.length;
67
-
68
54
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
69
55
  arr2[i] = arr[i];
70
56
  }
71
-
72
57
  return arr2;
73
58
  }
74
-
75
59
  function _iterableToArrayLimit(arr, i) {
76
60
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
77
-
78
61
  if (_i == null) return;
79
62
  var _arr = [];
80
63
  var _n = true;
81
64
  var _d = false;
82
-
83
65
  var _s, _e;
84
-
85
66
  try {
86
67
  for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
87
68
  _arr.push(_s.value);
88
-
89
69
  if (i && _arr.length === i) break;
90
70
  }
91
71
  } catch (err) {
@@ -98,18 +78,15 @@ function _iterableToArrayLimit(arr, i) {
98
78
  if (_d) throw _e;
99
79
  }
100
80
  }
101
-
102
81
  return _arr;
103
82
  }
104
-
105
83
  function _arrayWithHoles(arr) {
106
84
  if (Array.isArray(arr)) return arr;
107
85
  }
86
+
108
87
  /**
109
88
  * To get exact height to avoid scrolling deviation
110
89
  */
111
-
112
-
113
90
  function getOuterHeight(el) {
114
91
  var height = el.offsetHeight;
115
92
  var computedStyle = window.getComputedStyle(el);
@@ -117,21 +94,17 @@ function getOuterHeight(el) {
117
94
  height += parseInt(computedStyle.marginBottom, 10);
118
95
  return height;
119
96
  }
120
-
121
97
  function useHeights(getKey, onItemAdd, onItemRemove) {
122
98
  var _React$useState = React__namespace.useState(0),
123
- _React$useState2 = _slicedToArray(_React$useState, 2),
124
- updatedMark = _React$useState2[0],
125
- setUpdatedMark = _React$useState2[1];
126
-
99
+ _React$useState2 = _slicedToArray(_React$useState, 2),
100
+ updatedMark = _React$useState2[0],
101
+ setUpdatedMark = _React$useState2[1];
127
102
  var instanceRef = React.useRef(new Map());
128
103
  var heightsRef = React.useRef(new CacheMap["default"]());
129
104
  var collectRafRef = React.useRef();
130
-
131
105
  function cancelRaf() {
132
106
  raf["default"].cancel(collectRafRef.current);
133
107
  }
134
-
135
108
  function collectHeight() {
136
109
  cancelRaf();
137
110
  collectRafRef.current = raf["default"](function () {
@@ -139,7 +112,6 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
139
112
  if (element && element.offsetParent) {
140
113
  var htmlElement = findDOMNode["default"](element);
141
114
  var outerHeight = getOuterHeight(htmlElement);
142
-
143
115
  if (heightsRef.current.get(key) !== outerHeight) {
144
116
  heightsRef.current.set(key, outerHeight);
145
117
  }
@@ -151,11 +123,9 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
151
123
  });
152
124
  });
153
125
  }
154
-
155
126
  function setInstanceRef(item, instance) {
156
127
  var key = getKey(item);
157
128
  var origin = instanceRef.current.get(key);
158
-
159
129
  if (instance) {
160
130
  instanceRef.current.set(key, instance);
161
131
  collectHeight();
@@ -163,7 +133,6 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
163
133
  instanceRef.current["delete"](key);
164
134
  } // Instance changed
165
135
 
166
-
167
136
  if (!origin !== !instance) {
168
137
  if (instance) {
169
138
  onItemAdd === null || onItemAdd === void 0 ? void 0 : onItemAdd(item);
@@ -172,11 +141,9 @@ function useHeights(getKey, onItemAdd, onItemRemove) {
172
141
  }
173
142
  }
174
143
  }
175
-
176
144
  React.useEffect(function () {
177
145
  return cancelRaf;
178
146
  }, []);
179
147
  return [setInstanceRef, collectHeight, heightsRef.current, updatedMark];
180
148
  }
181
-
182
149
  exports["default"] = useHeights;
@@ -12,13 +12,9 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  var React = require('react');
17
-
18
16
  var useLayoutEffect = require('../../../rc-util/es/hooks/useLayoutEffect.js');
19
-
20
17
  var SMOOTH_PTG = 14 / 15;
21
-
22
18
  function useMobileTouchMove(inVirtual, listRef, callback) {
23
19
  var touchedRef = React.useRef(false);
24
20
  var touchYRef = React.useRef(0);
@@ -28,37 +24,30 @@ function useMobileTouchMove(inVirtual, listRef, callback) {
28
24
  /* eslint-disable prefer-const */
29
25
 
30
26
  var cleanUpEvents;
31
-
32
27
  var onTouchMove = function onTouchMove(e) {
33
28
  if (touchedRef.current) {
34
29
  var currentY = Math.ceil(e.touches[0].pageY);
35
30
  var offsetY = touchYRef.current - currentY;
36
31
  touchYRef.current = currentY;
37
-
38
32
  if (callback(offsetY)) {
39
33
  e.preventDefault();
40
34
  } // Smooth interval
41
35
 
42
-
43
36
  clearInterval(intervalRef.current);
44
37
  intervalRef.current = setInterval(function () {
45
38
  offsetY *= SMOOTH_PTG;
46
-
47
39
  if (!callback(offsetY, true) || Math.abs(offsetY) <= 0.1) {
48
40
  clearInterval(intervalRef.current);
49
41
  }
50
42
  }, 16);
51
43
  }
52
44
  };
53
-
54
45
  var onTouchEnd = function onTouchEnd() {
55
46
  touchedRef.current = false;
56
47
  cleanUpEvents();
57
48
  };
58
-
59
49
  var onTouchStart = function onTouchStart(e) {
60
50
  cleanUpEvents();
61
-
62
51
  if (e.touches.length === 1 && !touchedRef.current) {
63
52
  touchedRef.current = true;
64
53
  touchYRef.current = Math.ceil(e.touches[0].pageY);
@@ -67,27 +56,22 @@ function useMobileTouchMove(inVirtual, listRef, callback) {
67
56
  elementRef.current.addEventListener('touchend', onTouchEnd);
68
57
  }
69
58
  };
70
-
71
59
  cleanUpEvents = function cleanUpEvents() {
72
60
  if (elementRef.current) {
73
61
  elementRef.current.removeEventListener('touchmove', onTouchMove);
74
62
  elementRef.current.removeEventListener('touchend', onTouchEnd);
75
63
  }
76
64
  };
77
-
78
65
  useLayoutEffect["default"](function () {
79
66
  if (inVirtual) {
80
67
  listRef.current.addEventListener('touchstart', onTouchStart);
81
68
  }
82
-
83
69
  return function () {
84
70
  var _listRef$current;
85
-
86
71
  (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.removeEventListener('touchstart', onTouchStart);
87
72
  cleanUpEvents();
88
73
  clearInterval(intervalRef.current);
89
74
  };
90
75
  }, [inVirtual]);
91
76
  }
92
-
93
77
  exports["default"] = useMobileTouchMove;
@@ -12,14 +12,11 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  var React = require('react');
17
-
18
16
  var useOriginScroll = function useOriginScroll(isScrollAtTop, isScrollAtBottom) {
19
17
  // Do lock for a wheel when scrolling
20
18
  var lockRef = React.useRef(false);
21
19
  var lockTimeoutRef = React.useRef(null);
22
-
23
20
  function lockScroll() {
24
21
  clearTimeout(lockTimeoutRef.current);
25
22
  lockRef.current = true;
@@ -28,7 +25,6 @@ var useOriginScroll = function useOriginScroll(isScrollAtTop, isScrollAtBottom)
28
25
  }, 50);
29
26
  } // Pass to ref since global add is in closure
30
27
 
31
-
32
28
  var scrollPingRef = React.useRef({
33
29
  top: isScrollAtTop,
34
30
  bottom: isScrollAtBottom
@@ -37,10 +33,11 @@ var useOriginScroll = function useOriginScroll(isScrollAtTop, isScrollAtBottom)
37
33
  scrollPingRef.current.bottom = isScrollAtBottom;
38
34
  return function (deltaY) {
39
35
  var smoothOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
40
- var originScroll = // Pass origin wheel when on the top
41
- deltaY < 0 && scrollPingRef.current.top || // Pass origin wheel when on the bottom
36
+ var originScroll =
37
+ // Pass origin wheel when on the top
38
+ deltaY < 0 && scrollPingRef.current.top ||
39
+ // Pass origin wheel when on the bottom
42
40
  deltaY > 0 && scrollPingRef.current.bottom;
43
-
44
41
  if (smoothOffset && originScroll) {
45
42
  // No need lock anymore when it's smooth offset from touchMove interval
46
43
  clearTimeout(lockTimeoutRef.current);
@@ -48,9 +45,7 @@ var useOriginScroll = function useOriginScroll(isScrollAtTop, isScrollAtBottom)
48
45
  } else if (!originScroll || lockRef.current) {
49
46
  lockScroll();
50
47
  }
51
-
52
48
  return !lockRef.current && originScroll;
53
49
  };
54
50
  };
55
-
56
51
  exports["default"] = useOriginScroll;
@@ -12,15 +12,10 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  var React = require('react');
17
-
18
16
  var raf = require('../../../rc-util/es/raf.js');
19
-
20
- function _interopNamespace(e) {
21
- if (e && e.__esModule) return e;
17
+ function _interopNamespaceDefault(e) {
22
18
  var n = Object.create(null);
23
-
24
19
  if (e) {
25
20
  Object.keys(e).forEach(function (k) {
26
21
  if (k !== 'default') {
@@ -34,13 +29,10 @@ function _interopNamespace(e) {
34
29
  }
35
30
  });
36
31
  }
37
-
38
32
  n["default"] = e;
39
33
  return Object.freeze(n);
40
34
  }
41
-
42
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
43
-
35
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
44
36
  function _typeof(obj) {
45
37
  "@babel/helpers - typeof";
46
38
 
@@ -50,7 +42,6 @@ function _typeof(obj) {
50
42
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
51
43
  }, _typeof(obj);
52
44
  }
53
-
54
45
  function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHeight, syncScrollTop, triggerFlash) {
55
46
  var scrollRef = React__namespace.useRef();
56
47
  return function (arg) {
@@ -60,15 +51,12 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
60
51
  return;
61
52
  } // Normal scroll logic
62
53
 
63
-
64
54
  raf["default"].cancel(scrollRef.current);
65
-
66
55
  if (typeof arg === 'number') {
67
56
  syncScrollTop(arg);
68
57
  } else if (arg && _typeof(arg) === 'object') {
69
58
  var index;
70
59
  var align = arg.align;
71
-
72
60
  if ('index' in arg) {
73
61
  index = arg.index;
74
62
  } else {
@@ -76,9 +64,8 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
76
64
  return getKey(item) === arg.key;
77
65
  });
78
66
  }
79
-
80
67
  var _arg$offset = arg.offset,
81
- offset = _arg$offset === void 0 ? 0 : _arg$offset; // We will retry 3 times in case dynamic height shaking
68
+ offset = _arg$offset === void 0 ? 0 : _arg$offset; // We will retry 3 times in case dynamic height shaking
82
69
 
83
70
  var syncScroll = function syncScroll(times, targetAlign) {
84
71
  if (times < 0 || !containerRef.current) return;
@@ -93,36 +80,29 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
93
80
  var itemTop = 0;
94
81
  var itemBottom = 0;
95
82
  var maxLen = Math.min(data.length, index);
96
-
97
83
  for (var i = 0; i <= maxLen; i += 1) {
98
84
  var key = getKey(data[i]);
99
85
  itemTop = stackTop;
100
86
  var cacheHeight = heights.get(key);
101
87
  itemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight);
102
88
  stackTop = itemBottom;
103
-
104
89
  if (i === index && cacheHeight === undefined) {
105
90
  needCollectHeight = true;
106
91
  }
107
92
  } // Scroll to
108
93
 
109
-
110
94
  var targetTop = null;
111
-
112
95
  switch (mergedAlign) {
113
96
  case 'top':
114
97
  targetTop = itemTop - offset;
115
98
  break;
116
-
117
99
  case 'bottom':
118
100
  targetTop = itemBottom - height + offset;
119
101
  break;
120
-
121
102
  default:
122
103
  {
123
104
  var scrollTop = containerRef.current.scrollTop;
124
105
  var scrollBottom = scrollTop + height;
125
-
126
106
  if (itemTop < scrollTop) {
127
107
  newTargetAlign = 'top';
128
108
  } else if (itemBottom > scrollBottom) {
@@ -130,25 +110,20 @@ function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHei
130
110
  }
131
111
  }
132
112
  }
133
-
134
113
  if (targetTop !== null && targetTop !== containerRef.current.scrollTop) {
135
114
  syncScrollTop(targetTop);
136
115
  }
137
116
  } // We will retry since element may not sync height as it described
138
117
 
139
-
140
118
  scrollRef.current = raf["default"](function () {
141
119
  if (needCollectHeight) {
142
120
  collectHeight();
143
121
  }
144
-
145
122
  syncScroll(times - 1, newTargetAlign);
146
123
  });
147
124
  };
148
-
149
125
  syncScroll(3);
150
126
  }
151
127
  };
152
128
  }
153
-
154
129
  exports["default"] = useScrollTo;
@@ -12,7 +12,5 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  var List = require('./List.js');
17
-
18
16
  exports["default"] = List["default"];
@@ -12,13 +12,11 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  function _classCallCheck(instance, Constructor) {
17
16
  if (!(instance instanceof Constructor)) {
18
17
  throw new TypeError("Cannot call a class as a function");
19
18
  }
20
19
  }
21
-
22
20
  function _defineProperties(target, props) {
23
21
  for (var i = 0; i < props.length; i++) {
24
22
  var descriptor = props[i];
@@ -28,7 +26,6 @@ function _defineProperties(target, props) {
28
26
  Object.defineProperty(target, descriptor.key, descriptor);
29
27
  }
30
28
  }
31
-
32
29
  function _createClass(Constructor, protoProps, staticProps) {
33
30
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
34
31
  if (staticProps) _defineProperties(Constructor, staticProps);
@@ -36,17 +33,15 @@ function _createClass(Constructor, protoProps, staticProps) {
36
33
  writable: false
37
34
  });
38
35
  return Constructor;
39
- } // Firefox has low performance of map.
40
-
36
+ }
41
37
 
38
+ // Firefox has low performance of map.
42
39
  var CacheMap = /*#__PURE__*/function () {
43
40
  function CacheMap() {
44
41
  _classCallCheck(this, CacheMap);
45
-
46
42
  this.maps = void 0;
47
43
  this.maps = Object.create(null);
48
44
  }
49
-
50
45
  _createClass(CacheMap, [{
51
46
  key: "set",
52
47
  value: function set(key, value) {
@@ -58,8 +53,6 @@ var CacheMap = /*#__PURE__*/function () {
58
53
  return this.maps[key];
59
54
  }
60
55
  }]);
61
-
62
56
  return CacheMap;
63
57
  }();
64
-
65
58
  exports["default"] = CacheMap;
@@ -9,9 +9,6 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
- Object.defineProperty(exports, '__esModule', {
13
- value: true
14
- });
15
12
  /**
16
13
  * Get index with specific start index one by one. e.g.
17
14
  * min: 3, max: 9, start: 6
@@ -25,22 +22,18 @@ Object.defineProperty(exports, '__esModule', {
25
22
  * [5]: 9
26
23
  * [6]: 3
27
24
  */
28
-
29
25
  /**
30
26
  * We assume that 2 list has only 1 item diff and others keeping the order.
31
27
  * So we can use dichotomy algorithm to find changed one.
32
28
  */
33
-
34
29
  function findListDiffIndex(originList, targetList, getKey) {
35
30
  var originLen = originList.length;
36
31
  var targetLen = targetList.length;
37
32
  var shortList;
38
33
  var longList;
39
-
40
34
  if (originLen === 0 && targetLen === 0) {
41
35
  return null;
42
36
  }
43
-
44
37
  if (originLen < targetLen) {
45
38
  shortList = originList;
46
39
  longList = targetList;
@@ -48,38 +41,30 @@ function findListDiffIndex(originList, targetList, getKey) {
48
41
  shortList = targetList;
49
42
  longList = originList;
50
43
  }
51
-
52
44
  var notExistKey = {
53
45
  __EMPTY_ITEM__: true
54
46
  };
55
-
56
47
  function getItemKey(item) {
57
48
  if (item !== undefined) {
58
49
  return getKey(item);
59
50
  }
60
-
61
51
  return notExistKey;
62
52
  } // Loop to find diff one
63
53
 
64
-
65
54
  var diffIndex = null;
66
55
  var multiple = Math.abs(originLen - targetLen) !== 1;
67
-
68
56
  for (var i = 0; i < longList.length; i += 1) {
69
57
  var shortKey = getItemKey(shortList[i]);
70
58
  var longKey = getItemKey(longList[i]);
71
-
72
59
  if (shortKey !== longKey) {
73
60
  diffIndex = i;
74
61
  multiple = multiple || shortKey !== getItemKey(longList[i + 1]);
75
62
  break;
76
63
  }
77
64
  }
78
-
79
65
  return diffIndex === null ? null : {
80
66
  index: diffIndex,
81
67
  multiple: multiple
82
68
  };
83
69
  }
84
-
85
70
  exports.findListDiffIndex = findListDiffIndex;
@@ -12,7 +12,6 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
-
16
15
  function _typeof(obj) {
17
16
  "@babel/helpers - typeof";
18
17
 
@@ -22,6 +21,5 @@ function _typeof(obj) {
22
21
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
23
22
  }, _typeof(obj);
24
23
  }
25
-
26
24
  var isFF = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && /Firefox/i.test(navigator.userAgent);
27
25
  exports["default"] = isFF;
@@ -10,12 +10,11 @@
10
10
  'use strict';
11
11
 
12
12
  var _typeof = require("@babel/runtime/helpers/typeof");
13
-
14
13
  Object.defineProperty(exports, '__esModule', {
15
14
  value: true
16
15
  });
17
-
18
16
  var reactIs_development = require('../../../_virtual/react-is.development.js');
17
+
19
18
  /** @license React v16.13.1
20
19
  * react-is.development.js
21
20
  *
@@ -25,7 +24,6 @@ var reactIs_development = require('../../../_virtual/react-is.development.js');
25
24
  * LICENSE file in the root directory of this source tree.
26
25
  */
27
26
 
28
-
29
27
  if (process.env.NODE_ENV !== "production") {
30
28
  (function () {
31
29
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
@@ -51,20 +49,17 @@ if (process.env.NODE_ENV !== "production") {
51
49
  var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
52
50
  var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
53
51
  var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
54
-
55
52
  function isValidElementType(type) {
56
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
53
+ return typeof type === 'string' || typeof type === 'function' ||
54
+ // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
57
55
  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
58
56
  }
59
-
60
57
  function typeOf(object) {
61
58
  if (_typeof(object) === 'object' && object !== null) {
62
59
  var $$typeof = object.$$typeof;
63
-
64
60
  switch ($$typeof) {
65
61
  case REACT_ELEMENT_TYPE:
66
62
  var type = object.type;
67
-
68
63
  switch (type) {
69
64
  case REACT_ASYNC_MODE_TYPE:
70
65
  case REACT_CONCURRENT_MODE_TYPE:
@@ -73,10 +68,8 @@ if (process.env.NODE_ENV !== "production") {
73
68
  case REACT_STRICT_MODE_TYPE:
74
69
  case REACT_SUSPENSE_TYPE:
75
70
  return type;
76
-
77
71
  default:
78
72
  var $$typeofType = type && type.$$typeof;
79
-
80
73
  switch ($$typeofType) {
81
74
  case REACT_CONTEXT_TYPE:
82
75
  case REACT_FORWARD_REF_TYPE:
@@ -84,22 +77,17 @@ if (process.env.NODE_ENV !== "production") {
84
77
  case REACT_MEMO_TYPE:
85
78
  case REACT_PROVIDER_TYPE:
86
79
  return $$typeofType;
87
-
88
80
  default:
89
81
  return $$typeof;
90
82
  }
91
-
92
83
  }
93
-
94
84
  case REACT_PORTAL_TYPE:
95
85
  return $$typeof;
96
86
  }
97
87
  }
98
-
99
88
  return undefined;
100
89
  } // AsyncMode is deprecated along with isAsyncMode
101
90
 
102
-
103
91
  var AsyncMode = REACT_ASYNC_MODE_TYPE;
104
92
  var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
105
93
  var ContextConsumer = REACT_CONTEXT_TYPE;
@@ -125,55 +113,42 @@ if (process.env.NODE_ENV !== "production") {
125
113
  }
126
114
  return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
127
115
  }
128
-
129
116
  function isConcurrentMode(object) {
130
117
  return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
131
118
  }
132
-
133
119
  function isContextConsumer(object) {
134
120
  return typeOf(object) === REACT_CONTEXT_TYPE;
135
121
  }
136
-
137
122
  function isContextProvider(object) {
138
123
  return typeOf(object) === REACT_PROVIDER_TYPE;
139
124
  }
140
-
141
125
  function isElement(object) {
142
126
  return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
143
127
  }
144
-
145
128
  function isForwardRef(object) {
146
129
  return typeOf(object) === REACT_FORWARD_REF_TYPE;
147
130
  }
148
-
149
131
  function isFragment(object) {
150
132
  return typeOf(object) === REACT_FRAGMENT_TYPE;
151
133
  }
152
-
153
134
  function isLazy(object) {
154
135
  return typeOf(object) === REACT_LAZY_TYPE;
155
136
  }
156
-
157
137
  function isMemo(object) {
158
138
  return typeOf(object) === REACT_MEMO_TYPE;
159
139
  }
160
-
161
140
  function isPortal(object) {
162
141
  return typeOf(object) === REACT_PORTAL_TYPE;
163
142
  }
164
-
165
143
  function isProfiler(object) {
166
144
  return typeOf(object) === REACT_PROFILER_TYPE;
167
145
  }
168
-
169
146
  function isStrictMode(object) {
170
147
  return typeOf(object) === REACT_STRICT_MODE_TYPE;
171
148
  }
172
-
173
149
  function isSuspense(object) {
174
150
  return typeOf(object) === REACT_SUSPENSE_TYPE;
175
151
  }
176
-
177
152
  reactIs_development.__exports.AsyncMode = AsyncMode;
178
153
  reactIs_development.__exports.ConcurrentMode = ConcurrentMode;
179
154
  reactIs_development.__exports.ContextConsumer = ContextConsumer;
@@ -204,5 +179,4 @@ if (process.env.NODE_ENV !== "production") {
204
179
  reactIs_development.__exports.typeOf = typeOf;
205
180
  })();
206
181
  }
207
-
208
182
  exports["default"] = reactIs_development.__exports;