@beppla/tapas-ui 1.0.70 → 1.0.71

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 (263) hide show
  1. package/commonjs/Alert/Alert.js +67 -46
  2. package/commonjs/Alert/Alert.js.map +1 -2
  3. package/commonjs/AnimatedNavItem/AnimatedNavItem.js +0 -71
  4. package/commonjs/AnimatedNavItem/AnimatedNavItem.js.map +0 -1
  5. package/commonjs/AnimatedNavItem/index.js +9 -15
  6. package/commonjs/BarChart/BarChart.js.map +2 -1
  7. package/commonjs/Button/Button.js +78 -96
  8. package/commonjs/Button/Button.js.map +2 -1
  9. package/commonjs/Button/ButtonGroup.js.map +2 -1
  10. package/commonjs/Calendar/Calendar.base.js +190 -162
  11. package/commonjs/Calendar/Calendar.base.js.map +2 -1
  12. package/commonjs/Calendar/Calendar.js +102 -86
  13. package/commonjs/Calendar/Calendar.js.map +1 -2
  14. package/commonjs/Calendar/DaySelector.js +113 -115
  15. package/commonjs/Calendar/DaySelector.js.map +1 -2
  16. package/commonjs/Calendar/TimeSelector.js +223 -274
  17. package/commonjs/Calendar/WeekDaySelector.js.map +1 -2
  18. package/commonjs/Calendar/helper.js +68 -68
  19. package/commonjs/Calendar/helper.js.map +1 -2
  20. package/commonjs/Calendar/types.js +11 -11
  21. package/commonjs/Calendar/types.js.map +2 -1
  22. package/commonjs/Card/Card.js +158 -231
  23. package/commonjs/Card/Card.js.map +1 -1
  24. package/commonjs/CheckBox/CheckBoxItem.js +36 -86
  25. package/commonjs/CheckBox/CheckBoxItem.js.map +1 -1
  26. package/commonjs/CheckBox/GroupCheckBox.js +67 -80
  27. package/commonjs/CheckBox/GroupCheckBox.js.map +2 -1
  28. package/commonjs/DashboardCard/DashboardCard.js +94 -74
  29. package/commonjs/DashboardCard/DashboardCard.js.map +1 -1
  30. package/commonjs/DataCell/DataCell.js +235 -289
  31. package/commonjs/DataCell/DataCell.js.map +1 -2
  32. package/commonjs/DataCell/index.js.map +2 -1
  33. package/commonjs/DataTable/DataTable.js +144 -70
  34. package/commonjs/DataTable/DataTable.js.map +1 -2
  35. package/commonjs/DataTable/index.js.map +1 -2
  36. package/commonjs/DeviceSelectionModal/DeviceSelectionModal.js +244 -242
  37. package/commonjs/DeviceSelectionModal/DeviceSelectionModal.js.map +1 -1
  38. package/commonjs/DraggableFlatList/DraggableFlatList.js +1 -1
  39. package/commonjs/Dropdown/Dropdown.js +461 -493
  40. package/commonjs/Dropdown/Dropdown.js.map +1 -2
  41. package/commonjs/Dropdown/InputDropdown.js +114 -123
  42. package/commonjs/ExternalLink/ExternalLink.js +58 -50
  43. package/commonjs/ExternalLink/ExternalLink.js.map +1 -2
  44. package/commonjs/Gantt/helper.js.map +1 -2
  45. package/commonjs/Grid/Grid.base.js +401 -336
  46. package/commonjs/Grid/Grid.base.js.map +2 -1
  47. package/commonjs/Grid/VariableSizeGrid.js +113 -120
  48. package/commonjs/Grid/VariableSizeGrid.js.map +1 -2
  49. package/commonjs/Grid/helper.js +16 -11
  50. package/commonjs/Header/Header.js +177 -166
  51. package/commonjs/Header/Header.js.map +1 -2
  52. package/commonjs/HelloWave/HelloWave.js +53 -46
  53. package/commonjs/HelloWave/HelloWave.js.map +2 -1
  54. package/commonjs/Icons/TapasIcon.js +100 -99
  55. package/commonjs/Icons/TapasIcon.js.map +2 -1
  56. package/commonjs/Icons/TapasIconExpo.js +94 -101
  57. package/commonjs/Icons/smartFontLoader.js +222 -266
  58. package/commonjs/Icons/smartFontLoader.js.map +1 -2
  59. package/commonjs/Image/Image.js +106 -96
  60. package/commonjs/Image/Image.js.map +1 -2
  61. package/commonjs/Image/PreviewImg.js.map +2 -1
  62. package/commonjs/Layout/DrawerContext.js +35 -49
  63. package/commonjs/Layout/DrawerContext.js.map +2 -1
  64. package/commonjs/Layout/Layout.js.map +1 -2
  65. package/commonjs/Layout/ToastContext.js +46 -34
  66. package/commonjs/Layout/ToastContext.js.map +1 -2
  67. package/commonjs/Layout/index.js +38 -34
  68. package/commonjs/Layout/index.js.map +1 -2
  69. package/commonjs/LineChart/index.js +3 -4
  70. package/commonjs/ListItem/ListItem.js +108 -80
  71. package/commonjs/ListItem/ListItem.js.map +1 -2
  72. package/commonjs/MultiSelector/MultiSelector.js +225 -250
  73. package/commonjs/MultiSelector/MultiSelector.js.map +1 -2
  74. package/commonjs/Navigation/Navigation.js +117 -114
  75. package/commonjs/Navigation/Navigation.js.map +1 -2
  76. package/commonjs/Notification/Notification.js +66 -135
  77. package/commonjs/Notification/Notification.js.map +1 -1
  78. package/commonjs/Notification/index.js.map +1 -2
  79. package/commonjs/NumericInput/NumericInput.js +85 -71
  80. package/commonjs/NumericInput/NumericInput.js.map +1 -2
  81. package/commonjs/Overlay/Overlay.js +45 -24
  82. package/commonjs/Overlay/Overlay.js.map +1 -1
  83. package/commonjs/Popover/Popover.js +137 -112
  84. package/commonjs/Popover/Popover.js.map +2 -1
  85. package/commonjs/Progress/Progress.js +48 -54
  86. package/commonjs/Progress/Progress.js.map +2 -1
  87. package/commonjs/Quantity/Quantity.js +70 -0
  88. package/commonjs/Quantity/Quantity.js.map +1 -0
  89. package/commonjs/RadioButton/RadioButton.js +94 -46
  90. package/commonjs/RadioButton/RadioButton.js.map +1 -1
  91. package/commonjs/ReasonModal/index.js +14 -9
  92. package/commonjs/ReasonModal/index.js.map +2 -1
  93. package/commonjs/SheetTitle/SheetTitle.js +34 -31
  94. package/commonjs/SheetTitle/SheetTitle.js.map +1 -1
  95. package/commonjs/Shell/Shell.js +92 -84
  96. package/commonjs/Shell/Shell.js.map +1 -2
  97. package/commonjs/Shell/styles.js +3 -3
  98. package/commonjs/Shell/styles.js.map +2 -1
  99. package/commonjs/Shell/types.js.map +2 -1
  100. package/commonjs/StatisticCard/StatisticCard.js +47 -41
  101. package/commonjs/Status/Status.js +35 -31
  102. package/commonjs/Status/Status.js.map +2 -1
  103. package/commonjs/Steps/Steps.js +40 -41
  104. package/commonjs/Steps/Steps.js.map +1 -1
  105. package/commonjs/TabTitle/TabTitle.js +54 -48
  106. package/commonjs/TabTitle/index.js +1 -0
  107. package/commonjs/TabTitle/index.js.map +1 -0
  108. package/commonjs/Tag/Tag.js +88 -34
  109. package/commonjs/Tag/Tag.js.map +1 -1
  110. package/commonjs/Task/Task.js +112 -201
  111. package/commonjs/Task/Task.js.map +1 -2
  112. package/commonjs/Task/type.js +4 -4
  113. package/commonjs/Text/Text.js +96 -56
  114. package/commonjs/Text/Text.js.map +1 -1
  115. package/commonjs/Theme/ThemeProvider.js +16 -18
  116. package/commonjs/Timeline/Timeline.js +0 -23
  117. package/commonjs/Timeline/Timeline.js.map +0 -1
  118. package/commonjs/Toast/Toast.js +83 -62
  119. package/commonjs/Toast/Toast.js.map +1 -2
  120. package/commonjs/UserSwitcher/index.js +8 -14
  121. package/commonjs/UserSwitcher/index.js.map +1 -2
  122. package/commonjs/common.js +5 -4
  123. package/commonjs/common.js.map +2 -1
  124. package/commonjs/index.js +336 -426
  125. package/module/AnimatedNavItem/AnimatedNavItem.js +124 -159
  126. package/module/AnimatedNavItem/index.js +3 -7
  127. package/module/AnimatedNavItem/index.js.map +2 -1
  128. package/module/BarChart/index.js.map +1 -2
  129. package/module/Button/Button.js +71 -80
  130. package/module/Button/Button.js.map +2 -1
  131. package/module/Button/ButtonGroup.js +129 -120
  132. package/module/Button/ButtonGroup.js.map +2 -1
  133. package/module/Calendar/Calendar.base.js +226 -149
  134. package/module/Calendar/Calendar.base.js.map +2 -1
  135. package/module/Calendar/Calendar.js +76 -80
  136. package/module/Calendar/Calendar.js.map +1 -2
  137. package/module/Calendar/ConcreteTimeSelector.js.map +1 -2
  138. package/module/Calendar/CustomRange.js.map +2 -1
  139. package/module/Calendar/DaySelector.js +95 -118
  140. package/module/Calendar/TimeSelector.js.map +2 -1
  141. package/module/Calendar/WeekDaySelector.js.map +1 -2
  142. package/module/Calendar/helper.js +74 -74
  143. package/module/Calendar/helper.js.map +2 -1
  144. package/module/Calendar/local.js +7 -7
  145. package/module/Calendar/local.js.map +1 -2
  146. package/module/Calendar/types.js +13 -13
  147. package/module/CheckBox/CheckBox.js +93 -89
  148. package/module/CheckBox/CheckBox.js.map +1 -2
  149. package/module/CheckBox/CheckBoxItem.js +69 -84
  150. package/module/CheckBox/CheckBoxItem.js.map +1 -1
  151. package/module/CheckBox/GroupCheckBox.js +66 -76
  152. package/module/CheckBox/GroupCheckBox.js.map +1 -2
  153. package/module/CircularProgress/CircularProgress.js +22 -0
  154. package/module/CircularProgress/CircularProgress.js.map +1 -0
  155. package/module/Collapsible/Collapsible.js +54 -64
  156. package/module/Collapsible/Collapsible.js.map +1 -2
  157. package/module/DataCell/DataCell.js +311 -224
  158. package/module/DataCell/index.js +4 -3
  159. package/module/DataCell/index.js.map +1 -2
  160. package/module/DataTable/index.js +2 -4
  161. package/module/DataTable/index.js.map +2 -1
  162. package/module/DeviceSelectionModal/DeviceSelectionModal.js +178 -241
  163. package/module/DeviceSelectionModal/DeviceSelectionModal.js.map +1 -2
  164. package/module/DraggableFlatList/DraggableFlatList.js +0 -9
  165. package/module/DraggableFlatList/DraggableFlatList.js.map +0 -1
  166. package/module/Drawer/Drawer.js +167 -139
  167. package/module/Drawer/Drawer.js.map +2 -1
  168. package/module/Dropdown/CustomDropdown.js +56 -0
  169. package/module/Dropdown/CustomDropdown.js.map +1 -0
  170. package/module/Dropdown/InputDropdown.js +116 -134
  171. package/module/Dropdown/InputDropdown.js.map +1 -2
  172. package/module/ExternalLink/ExternalLink.js +150 -0
  173. package/module/ExternalLink/ExternalLink.js.map +1 -0
  174. package/module/Gantt/Accessories.js +183 -124
  175. package/module/Gantt/Gantt.js +139 -152
  176. package/module/Gantt/Gantt.js.map +1 -2
  177. package/module/Gantt/types.js +4 -8
  178. package/module/Gantt/types.js.map +2 -1
  179. package/module/Grid/FixedSizeGrid.js +86 -80
  180. package/module/Grid/FixedSizeGrid.js.map +2 -1
  181. package/module/Grid/Grid.base.js +401 -339
  182. package/module/Grid/Grid.base.js.map +2 -1
  183. package/module/Grid/StaticFixedSizeGrid.js +192 -255
  184. package/module/Grid/VariableSizeGrid.js +121 -118
  185. package/module/Grid/VariableSizeGrid.js.map +2 -1
  186. package/module/Grid/helper.js.map +1 -2
  187. package/module/Grid/timer.js +14 -16
  188. package/module/Grid/timer.js.map +2 -1
  189. package/module/Header/Header.js +167 -183
  190. package/module/Header/Header.js.map +1 -2
  191. package/module/IconText/IconText.js +63 -88
  192. package/module/IconText/IconText.js.map +1 -2
  193. package/module/Icons/TapasIcon.js +120 -96
  194. package/module/Icons/TapasIcon.js.map +2 -1
  195. package/module/Icons/TapasIconExpo.js +78 -98
  196. package/module/Icons/TapasIconExpo.js.map +1 -2
  197. package/module/Icons/fontLoader.js +213 -182
  198. package/module/Icons/index.js +9 -10
  199. package/module/Icons/smartFontLoader.js.map +1 -2
  200. package/module/Layout/Layout.js +100 -100
  201. package/module/Layout/ToastContext.js +27 -15
  202. package/module/Layout/ToastContext.js.map +2 -1
  203. package/module/Layout/index.js.map +1 -2
  204. package/module/LineChart/LineChart.js +121 -157
  205. package/module/LineChart/LineChart.js.map +2 -1
  206. package/module/MultiSelector/MultiSelector.js.map +1 -2
  207. package/module/Notification/Notification.js +101 -105
  208. package/module/Notification/Notification.js.map +1 -2
  209. package/module/Notification/index.js +2 -3
  210. package/module/Notification/index.js.map +2 -1
  211. package/module/NumericInput/NumericInput.js +0 -54
  212. package/module/Pagination/Pagination.js +72 -0
  213. package/module/Pagination/Pagination.js.map +1 -0
  214. package/module/PieChart/PieChart.js +76 -101
  215. package/module/PieChart/index.js.map +0 -1
  216. package/module/Popover/Popover.js +97 -125
  217. package/module/Popover/Popover.js.map +1 -1
  218. package/module/Progress/Progress.js +51 -57
  219. package/module/Progress/Progress.js.map +1 -2
  220. package/module/Quantity/Quantity.js +112 -129
  221. package/module/Quantity/Quantity.js.map +1 -2
  222. package/module/Quantity/index.js +3 -2
  223. package/module/Quantity/index.js.map +1 -2
  224. package/module/ReasonModal/ReasonModal.js.map +2 -1
  225. package/module/ReasonModal/index.js +5 -3
  226. package/module/ReasonModal/index.js.map +1 -2
  227. package/module/ScanButton/ScanButton.js +77 -53
  228. package/module/ScanButton/ScanButton.js.map +2 -1
  229. package/module/SearchInput/SearchInput.js +83 -93
  230. package/module/SearchInput/SearchInput.js.map +1 -2
  231. package/module/SheetTitle/SheetTitle.js +29 -39
  232. package/module/SheetTitle/SheetTitle.js.map +2 -1
  233. package/module/Shell/Shell.js +92 -79
  234. package/module/Shell/Shell.js.map +2 -1
  235. package/module/Shell/styles.js +8 -8
  236. package/module/Shell/styles.js.map +2 -1
  237. package/module/Shell/types.js +4 -2
  238. package/module/Shell/types.js.map +1 -2
  239. package/module/StatisticCard/StatisticCard.js +48 -79
  240. package/module/StatisticCard/StatisticCard.js.map +1 -2
  241. package/module/Status/Status.js.map +0 -1
  242. package/module/Steps/Steps.js +36 -41
  243. package/module/Steps/Steps.js.map +1 -2
  244. package/module/TabTitle/TabTitle.js.map +2 -1
  245. package/module/TableColumnHeader/TableColumnHeader.js +126 -153
  246. package/module/TableColumnHeader/index.js +8 -3
  247. package/module/TableColumnHeader/index.js.map +1 -2
  248. package/module/Tag/Tag.js +72 -87
  249. package/module/Tag/Tag.js.map +1 -2
  250. package/module/Task/Task.js +207 -113
  251. package/module/Task/Task.js.map +2 -1
  252. package/module/Task/type.js +8 -4
  253. package/module/Task/type.js.map +2 -1
  254. package/module/Text/Text.js +70 -80
  255. package/module/Text/Text.js.map +2 -1
  256. package/module/Theme/ThemeProvider.js.map +1 -2
  257. package/module/Toast/Toast.js +66 -77
  258. package/module/Toast/Toast.js.map +1 -2
  259. package/module/UserSwitcher/UserSwitcher.js +130 -171
  260. package/module/UserSwitcher/UserSwitcher.js.map +1 -2
  261. package/module/index.js +120 -131
  262. package/module/index.js.map +2 -1
  263. package/package.json +1 -1
@@ -1,61 +1,24 @@
1
- "use strict";
1
+ import memoize from 'memoize-one';
2
+ import { createElement, PureComponent } from 'react';
3
+ import { cancelTimeout, requestTimeout } from './timer';
4
+ import { getScrollbarSize, getRTLOffsetType } from './helper';
5
+
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
7
+ /* eslint-disable no-console */
8
+
9
+ const IS_SCROLLING_DEBOUNCE_INTERVAL = 150;
2
10
 
3
- var __extends = this && this.__extends || function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf || {
6
- __proto__: []
7
- } instanceof Array && function (d, b) {
8
- d.__proto__ = b;
9
- } || function (d, b) {
10
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
11
- };
12
- return extendStatics(d, b);
13
- };
14
- return function (d, b) {
15
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
16
- extendStatics(d, b);
17
- function __() {
18
- this.constructor = d;
19
- }
20
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21
- };
22
- }();
23
- var __assign = this && this.__assign || function () {
24
- __assign = Object.assign || function (t) {
25
- for (var s, i = 1, n = arguments.length; i < n; i++) {
26
- s = arguments[i];
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
28
- }
29
- return t;
30
- };
31
- return __assign.apply(this, arguments);
32
- };
33
- var __importDefault = this && this.__importDefault || function (mod) {
34
- return mod && mod.__esModule ? mod : {
35
- "default": mod
36
- };
37
- };
38
- Object.defineProperty(exports, "__esModule", {
39
- value: true
40
- });
41
- exports.default = createGridComponent;
42
- var memoize_one_1 = __importDefault(require("memoize-one"));
43
- var react_1 = require("react");
44
- var timer_1 = require("./timer");
45
- var helper_1 = require("./helper");
46
- var IS_SCROLLING_DEBOUNCE_INTERVAL = 150;
47
11
  // @ts-ignore
48
- var defaultItemKey = function (_a) {
49
- var columnIndex = _a.columnIndex,
50
- _data = _a.data,
51
- rowIndex = _a.rowIndex;
52
- return "".concat(rowIndex, ":").concat(columnIndex);
53
- };
12
+ const defaultItemKey = ({
13
+ columnIndex,
14
+ data: _data,
15
+ rowIndex
16
+ }) => `${rowIndex}:${columnIndex}`;
54
17
  // In DEV mode, this Set helps us only log a warning once per component instance.
55
18
  // This avoids spamming the console every time a render happens.
56
- var devWarningsOverscanCount = null;
57
- var devWarningsOverscanRowsColumnsCount = null;
58
- var devWarningsTagName = null;
19
+ let devWarningsOverscanCount = null;
20
+ let devWarningsOverscanRowsColumnsCount = null;
21
+ let devWarningsTagName = null;
59
22
  if (process.env.NODE_ENV !== 'production') {
60
23
  if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
61
24
  devWarningsOverscanCount = new WeakSet();
@@ -63,175 +26,63 @@ if (process.env.NODE_ENV !== 'production') {
63
26
  devWarningsTagName = new WeakSet();
64
27
  }
65
28
  }
66
- function createGridComponent(_a) {
67
- var _b;
68
- var getColumnOffset = _a.getColumnOffset,
69
- getColumnStartIndexForOffset = _a.getColumnStartIndexForOffset,
70
- getColumnStopIndexForStartIndex = _a.getColumnStopIndexForStartIndex,
71
- getColumnWidth = _a.getColumnWidth,
72
- getEstimatedTotalHeight = _a.getEstimatedTotalHeight,
73
- getEstimatedTotalWidth = _a.getEstimatedTotalWidth,
74
- getOffsetForColumnAndAlignment = _a.getOffsetForColumnAndAlignment,
75
- getOffsetForRowAndAlignment = _a.getOffsetForRowAndAlignment,
76
- getRowHeight = _a.getRowHeight,
77
- getRowOffset = _a.getRowOffset,
78
- getRowStartIndexForOffset = _a.getRowStartIndexForOffset,
79
- getRowStopIndexForStartIndex = _a.getRowStopIndexForStartIndex,
80
- initInstanceProps = _a.initInstanceProps,
81
- shouldResetStyleCacheOnItemSizeChange = _a.shouldResetStyleCacheOnItemSizeChange,
82
- validateProps = _a.validateProps;
83
- return _b = /** @class */function (_super) {
84
- __extends(Grid, _super);
29
+ export default function createGridComponent({
30
+ getColumnOffset,
31
+ getColumnStartIndexForOffset,
32
+ getColumnStopIndexForStartIndex,
33
+ getColumnWidth,
34
+ getEstimatedTotalHeight,
35
+ getEstimatedTotalWidth,
36
+ getOffsetForColumnAndAlignment,
37
+ getOffsetForRowAndAlignment,
38
+ getRowHeight,
39
+ getRowOffset,
40
+ getRowStartIndexForOffset,
41
+ getRowStopIndexForStartIndex,
42
+ initInstanceProps,
43
+ shouldResetStyleCacheOnItemSizeChange,
44
+ validateProps
45
+ }) {
46
+ return class Grid extends PureComponent {
47
+ _instanceProps = initInstanceProps(this.props, this);
48
+ _resetIsScrollingTimeoutId = null;
49
+ static defaultProps = {
50
+ direction: 'ltr',
51
+ itemData: undefined,
52
+ useIsScrolling: false
53
+ };
54
+ state = {
55
+ instance: this,
56
+ isScrolling: false,
57
+ horizontalScrollDirection: 'forward',
58
+ scrollLeft: typeof this.props.initialScrollLeft === 'number' ? this.props.initialScrollLeft : 0,
59
+ scrollTop: typeof this.props.initialScrollTop === 'number' ? this.props.initialScrollTop : 0,
60
+ scrollUpdateWasRequested: false,
61
+ verticalScrollDirection: 'forward'
62
+ };
63
+
85
64
  // Always use explicit constructor for React components.
86
65
  // It produces less code after transpilation. (#26)
87
66
  // eslint-disable-next-line no-useless-constructor
88
- function Grid(props) {
89
- var _this = _super.call(this, props) || this;
90
- _this._instanceProps = initInstanceProps(_this.props, _this);
91
- _this._resetIsScrollingTimeoutId = null;
92
- _this.state = {
93
- instance: _this,
94
- isScrolling: false,
95
- horizontalScrollDirection: 'forward',
96
- scrollLeft: typeof _this.props.initialScrollLeft === 'number' ? _this.props.initialScrollLeft : 0,
97
- scrollTop: typeof _this.props.initialScrollTop === 'number' ? _this.props.initialScrollTop : 0,
98
- scrollUpdateWasRequested: false,
99
- verticalScrollDirection: 'forward'
100
- };
101
- _this._outerRefSetter = function (ref) {
102
- var outerRef = _this.props.outerRef;
103
- _this._outerRef = ref;
104
- if (typeof outerRef === 'function') {
105
- outerRef(ref);
106
- } else if (outerRef != null && typeof outerRef === 'object' && Object.prototype.hasOwnProperty.call(outerRef, 'current')) {
107
- outerRef.current = ref;
108
- }
109
- };
110
- _this._onScroll = function (event) {
111
- var _a = event.currentTarget,
112
- clientHeight = _a.clientHeight,
113
- clientWidth = _a.clientWidth,
114
- scrollLeft = _a.scrollLeft,
115
- scrollTop = _a.scrollTop,
116
- scrollHeight = _a.scrollHeight,
117
- scrollWidth = _a.scrollWidth;
118
- _this.setState(function (prevState) {
119
- if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
120
- // Scroll position may have been updated by cDM/cDU,
121
- // In which case we don't need to trigger another render,
122
- // And we don't want to update state.isScrolling.
123
- return null;
124
- }
125
- var direction = _this.props.direction;
126
- // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
127
- // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
128
- // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
129
- // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
130
- var calculatedScrollLeft = scrollLeft;
131
- if (direction === 'rtl') {
132
- switch ((0, helper_1.getRTLOffsetType)()) {
133
- case 'negative':
134
- calculatedScrollLeft = -scrollLeft;
135
- break;
136
- case 'positive-descending':
137
- calculatedScrollLeft = scrollWidth - clientWidth - scrollLeft;
138
- break;
139
- }
140
- }
141
- // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
142
- calculatedScrollLeft = Math.max(0, Math.min(calculatedScrollLeft, scrollWidth - clientWidth));
143
- var calculatedScrollTop = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
144
- return {
145
- isScrolling: true,
146
- horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
147
- scrollLeft: calculatedScrollLeft,
148
- scrollTop: calculatedScrollTop,
149
- verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward',
150
- scrollUpdateWasRequested: false
151
- };
152
- }, _this._resetIsScrollingDebounced);
153
- };
154
- _this._getItemStyle = function (rowIndex, columnIndex) {
155
- var _a = _this.props,
156
- columnWidth = _a.columnWidth,
157
- direction = _a.direction,
158
- rowHeight = _a.rowHeight;
159
- var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && columnWidth, shouldResetStyleCacheOnItemSizeChange && direction, shouldResetStyleCacheOnItemSizeChange && rowHeight);
160
- var key = "".concat(rowIndex, ":").concat(columnIndex);
161
- var style;
162
- if (Object.prototype.hasOwnProperty.call(itemStyleCache, key)) {
163
- style = itemStyleCache[key];
164
- } else {
165
- var offset = getColumnOffset(_this.props, columnIndex, _this._instanceProps);
166
- var isRtl = direction === 'rtl';
167
- itemStyleCache[key] = style = {
168
- position: 'absolute',
169
- left: isRtl ? undefined : offset,
170
- right: isRtl ? offset : undefined,
171
- top: getRowOffset(_this.props, rowIndex, _this._instanceProps),
172
- height: getRowHeight(_this.props, rowIndex, _this._instanceProps),
173
- width: getColumnWidth(_this.props, columnIndex, _this._instanceProps)
174
- };
175
- }
176
- return style || {};
177
- };
178
- _this._callOnScroll = (0, memoize_one_1.default)(function (scrollLeft, scrollTop, horizontalScrollDirection, verticalScrollDirection, scrollUpdateWasRequested) {
179
- return _this.props.onScroll({
180
- horizontalScrollDirection: horizontalScrollDirection,
181
- scrollLeft: scrollLeft,
182
- scrollTop: scrollTop,
183
- verticalScrollDirection: verticalScrollDirection,
184
- scrollUpdateWasRequested: scrollUpdateWasRequested
185
- });
186
- });
187
- _this._callOnItemsRendered = (0, memoize_one_1.default)(function (overscanColumnStartIndex, overscanColumnStopIndex, overscanRowStartIndex, overscanRowStopIndex, visibleColumnStartIndex, visibleColumnStopIndex, visibleRowStartIndex, visibleRowStopIndex) {
188
- return _this.props.onItemsRendered({
189
- overscanColumnStartIndex: overscanColumnStartIndex,
190
- overscanColumnStopIndex: overscanColumnStopIndex,
191
- overscanRowStartIndex: overscanRowStartIndex,
192
- overscanRowStopIndex: overscanRowStopIndex,
193
- visibleColumnStartIndex: visibleColumnStartIndex,
194
- visibleColumnStopIndex: visibleColumnStopIndex,
195
- visibleRowStartIndex: visibleRowStartIndex,
196
- visibleRowStopIndex: visibleRowStopIndex
197
- });
198
- });
199
- _this._resetIsScrollingDebounced = function () {
200
- if (_this._resetIsScrollingTimeoutId !== null) {
201
- (0, timer_1.cancelTimeout)(_this._resetIsScrollingTimeoutId);
202
- }
203
- _this._resetIsScrollingTimeoutId = (0, timer_1.requestTimeout)(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL);
204
- };
205
- _this._resetIsScrolling = function () {
206
- _this._resetIsScrollingTimeoutId = null;
207
- _this.setState({
208
- isScrolling: false
209
- }, function () {
210
- // Clear style cache after state update has been committed.
211
- // This way we don't break pure sCU for items that don't use isScrolling param.
212
- _this._getItemStyleCache(-1);
213
- });
214
- };
215
- _this._getItemStyleCache = (0, memoize_one_1.default)(function (_, __, ___) {
216
- return {};
217
- });
218
- return _this;
67
+ constructor(props) {
68
+ super(props);
219
69
  }
220
- Grid.getDerivedStateFromProps = function (nextProps, prevState) {
70
+ static getDerivedStateFromProps(nextProps, prevState) {
221
71
  validateSharedProps(nextProps, prevState);
222
72
  validateProps(nextProps);
223
73
  return null;
224
- };
225
- Grid.prototype.scrollTo = function (_a) {
226
- var scrollLeft = _a.scrollLeft,
227
- scrollTop = _a.scrollTop;
74
+ }
75
+ scrollTo({
76
+ scrollLeft,
77
+ scrollTop
78
+ }) {
228
79
  if (scrollLeft !== undefined) {
229
80
  scrollLeft = Math.max(0, scrollLeft);
230
81
  }
231
82
  if (scrollTop !== undefined) {
232
83
  scrollTop = Math.max(0, scrollTop);
233
84
  }
234
- this.setState(function (prevState) {
85
+ this.setState(prevState => {
235
86
  if (scrollLeft === undefined) {
236
87
  scrollLeft = prevState.scrollLeft;
237
88
  }
@@ -243,51 +94,55 @@ function createGridComponent(_a) {
243
94
  }
244
95
  return {
245
96
  horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
246
- scrollLeft: scrollLeft,
247
- scrollTop: scrollTop,
97
+ scrollLeft,
98
+ scrollTop,
248
99
  scrollUpdateWasRequested: true,
249
100
  verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward'
250
101
  };
251
102
  }, this._resetIsScrollingDebounced);
252
- };
253
- Grid.prototype.scrollToItem = function (_a) {
254
- var _c = _a.align,
255
- align = _c === void 0 ? 'auto' : _c,
256
- columnIndex = _a.columnIndex,
257
- rowIndex = _a.rowIndex;
258
- var _d = this.props,
259
- columnCount = _d.columnCount,
260
- height = _d.height,
261
- rowCount = _d.rowCount,
262
- width = _d.width;
263
- var _e = this.state,
264
- scrollLeft = _e.scrollLeft,
265
- scrollTop = _e.scrollTop;
266
- var scrollbarSize = (0, helper_1.getScrollbarSize)();
103
+ }
104
+ scrollToItem({
105
+ align = 'auto',
106
+ columnIndex,
107
+ rowIndex
108
+ }) {
109
+ const {
110
+ columnCount,
111
+ height,
112
+ rowCount,
113
+ width
114
+ } = this.props;
115
+ const {
116
+ scrollLeft,
117
+ scrollTop
118
+ } = this.state;
119
+ const scrollbarSize = getScrollbarSize();
267
120
  if (columnIndex !== undefined) {
268
121
  columnIndex = Math.max(0, Math.min(columnIndex, columnCount - 1));
269
122
  }
270
123
  if (rowIndex !== undefined) {
271
124
  rowIndex = Math.max(0, Math.min(rowIndex, rowCount - 1));
272
125
  }
273
- var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
274
- var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
126
+ const estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
127
+ const estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
128
+
275
129
  // The scrollbar size should be considered when scrolling an item into view,
276
130
  // to ensure it's fully visible.
277
131
  // But we only need to account for its size when it's actually visible.
278
- var horizontalScrollbarSize = estimatedTotalWidth > width ? scrollbarSize : 0;
279
- var verticalScrollbarSize = estimatedTotalHeight > height ? scrollbarSize : 0;
132
+ const horizontalScrollbarSize = estimatedTotalWidth > width ? scrollbarSize : 0;
133
+ const verticalScrollbarSize = estimatedTotalHeight > height ? scrollbarSize : 0;
280
134
  this.scrollTo({
281
135
  scrollLeft: columnIndex !== undefined ? getOffsetForColumnAndAlignment(this.props, columnIndex, align, scrollLeft, this._instanceProps, verticalScrollbarSize) : scrollLeft,
282
136
  scrollTop: rowIndex !== undefined ? getOffsetForRowAndAlignment(this.props, rowIndex, align, scrollTop, this._instanceProps, horizontalScrollbarSize) : scrollTop
283
137
  });
284
- };
285
- Grid.prototype.componentDidMount = function () {
286
- var _a = this.props,
287
- initialScrollLeft = _a.initialScrollLeft,
288
- initialScrollTop = _a.initialScrollTop;
138
+ }
139
+ componentDidMount() {
140
+ const {
141
+ initialScrollLeft,
142
+ initialScrollTop
143
+ } = this.props;
289
144
  if (this._outerRef != null) {
290
- var outerRef = this._outerRef;
145
+ const outerRef = this._outerRef;
291
146
  if (typeof initialScrollLeft === 'number') {
292
147
  outerRef.scrollLeft = initialScrollLeft;
293
148
  }
@@ -296,20 +151,23 @@ function createGridComponent(_a) {
296
151
  }
297
152
  }
298
153
  this._callPropsCallbacks();
299
- };
300
- Grid.prototype.componentDidUpdate = function () {
301
- var direction = this.props.direction;
302
- var _a = this.state,
303
- scrollLeft = _a.scrollLeft,
304
- scrollTop = _a.scrollTop,
305
- scrollUpdateWasRequested = _a.scrollUpdateWasRequested;
154
+ }
155
+ componentDidUpdate() {
156
+ const {
157
+ direction
158
+ } = this.props;
159
+ const {
160
+ scrollLeft,
161
+ scrollTop,
162
+ scrollUpdateWasRequested
163
+ } = this.state;
306
164
  if (scrollUpdateWasRequested && this._outerRef != null) {
307
165
  // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
308
166
  // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
309
167
  // So we need to determine which browser behavior we're dealing with, and mimic it.
310
- var outerRef = this._outerRef;
168
+ const outerRef = this._outerRef;
311
169
  if (direction === 'rtl') {
312
- switch ((0, helper_1.getRTLOffsetType)()) {
170
+ switch (getRTLOffsetType()) {
313
171
  case 'negative':
314
172
  outerRef.scrollLeft = -scrollLeft;
315
173
  break;
@@ -318,8 +176,10 @@ function createGridComponent(_a) {
318
176
  break;
319
177
  default:
320
178
  {
321
- var clientWidth = outerRef.clientWidth,
322
- scrollWidth = outerRef.scrollWidth;
179
+ const {
180
+ clientWidth,
181
+ scrollWidth
182
+ } = outerRef;
323
183
  outerRef.scrollLeft = scrollWidth - clientWidth - scrollLeft;
324
184
  break;
325
185
  }
@@ -330,80 +190,81 @@ function createGridComponent(_a) {
330
190
  outerRef.scrollTop = Math.max(0, scrollTop);
331
191
  }
332
192
  this._callPropsCallbacks();
333
- };
334
- Grid.prototype.componentWillUnmount = function () {
193
+ }
194
+ componentWillUnmount() {
335
195
  if (this._resetIsScrollingTimeoutId !== null) {
336
- (0, timer_1.cancelTimeout)(this._resetIsScrollingTimeoutId);
196
+ cancelTimeout(this._resetIsScrollingTimeoutId);
337
197
  }
338
- };
339
- Grid.prototype.render = function () {
340
- var _a = this.props,
341
- children = _a.children,
342
- className = _a.className,
343
- columnCount = _a.columnCount,
344
- direction = _a.direction,
345
- height = _a.height,
346
- innerRef = _a.innerRef,
347
- innerElementType = _a.innerElementType,
348
- innerTagName = _a.innerTagName,
349
- itemData = _a.itemData,
350
- _c = _a.itemKey,
351
- itemKey = _c === void 0 ? defaultItemKey : _c,
352
- outerElementType = _a.outerElementType,
353
- outerTagName = _a.outerTagName,
354
- rowCount = _a.rowCount,
355
- style = _a.style,
356
- testID = _a.testID,
357
- useIsScrolling = _a.useIsScrolling,
358
- width = _a.width;
359
- var isScrolling = this.state.isScrolling;
360
- var _d = this._getHorizontalRangeToRender(),
361
- columnStartIndex = _d[0],
362
- columnStopIndex = _d[1];
363
- var _e = this._getVerticalRangeToRender(),
364
- rowStartIndex = _e[0],
365
- rowStopIndex = _e[1];
366
- var items = [];
198
+ }
199
+ render() {
200
+ const {
201
+ children,
202
+ className,
203
+ columnCount,
204
+ direction,
205
+ height,
206
+ innerRef,
207
+ innerElementType,
208
+ innerTagName,
209
+ itemData,
210
+ itemKey = defaultItemKey,
211
+ outerElementType,
212
+ outerTagName,
213
+ rowCount,
214
+ style,
215
+ testID,
216
+ useIsScrolling,
217
+ width
218
+ } = this.props;
219
+ const {
220
+ isScrolling
221
+ } = this.state;
222
+ const [columnStartIndex, columnStopIndex] = this._getHorizontalRangeToRender();
223
+ const [rowStartIndex, rowStopIndex] = this._getVerticalRangeToRender();
224
+ const items = [];
367
225
  if (columnCount > 0 && rowCount) {
368
- for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
369
- for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
370
- items.push((0, react_1.createElement)(children, {
371
- columnIndex: columnIndex,
226
+ for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
227
+ for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
228
+ items.push(/*#__PURE__*/createElement(children, {
229
+ columnIndex,
372
230
  data: itemData,
373
231
  isScrolling: useIsScrolling ? isScrolling : undefined,
374
232
  key: itemKey({
375
- columnIndex: columnIndex,
233
+ columnIndex,
376
234
  data: itemData,
377
- rowIndex: rowIndex
235
+ rowIndex
378
236
  }),
379
- rowIndex: rowIndex,
237
+ rowIndex,
380
238
  style: this._getItemStyle(rowIndex, columnIndex)
381
239
  }));
382
240
  }
383
241
  }
384
242
  }
243
+
385
244
  // Read this value AFTER items have been created,
386
245
  // So their actual sizes (if variable) are taken into consideration.
387
- var estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
388
- var estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
389
- var outerRefSetter = __assign({
390
- className: className,
246
+ const estimatedTotalHeight = getEstimatedTotalHeight(this.props, this._instanceProps);
247
+ const estimatedTotalWidth = getEstimatedTotalWidth(this.props, this._instanceProps);
248
+ const outerRefSetter = {
249
+ className,
391
250
  onScroll: this._onScroll,
392
251
  ref: this._outerRefSetter,
393
- style: __assign({
252
+ style: {
394
253
  position: 'relative',
395
- height: height,
396
- width: width,
254
+ height,
255
+ width,
397
256
  overflow: 'auto',
398
257
  WebkitOverflowScrolling: 'touch',
399
258
  willChange: 'transform',
400
- direction: direction
401
- }, style),
402
- children: undefined
403
- }, testID && {
404
- testID: testID
405
- });
406
- var innerElement = {
259
+ direction,
260
+ ...style
261
+ },
262
+ children: undefined,
263
+ ...(testID && {
264
+ testID
265
+ })
266
+ };
267
+ const innerElement = {
407
268
  children: items,
408
269
  ref: innerRef,
409
270
  style: {
@@ -412,57 +273,258 @@ function createGridComponent(_a) {
412
273
  width: estimatedTotalWidth || 0
413
274
  }
414
275
  };
415
- return (0, react_1.createElement)(outerElementType || outerTagName || 'div', outerRefSetter, (0, react_1.createElement)(innerElementType || innerTagName || 'div', innerElement));
276
+ return /*#__PURE__*/createElement(outerElementType || outerTagName || 'div', outerRefSetter, /*#__PURE__*/createElement(innerElementType || innerTagName || 'div', innerElement));
277
+ }
278
+ _outerRefSetter = ref => {
279
+ const {
280
+ outerRef
281
+ } = this.props;
282
+ this._outerRef = ref;
283
+ if (typeof outerRef === 'function') {
284
+ outerRef(ref);
285
+ } else if (outerRef != null && typeof outerRef === 'object' && Object.prototype.hasOwnProperty.call(outerRef, 'current')) {
286
+ outerRef.current = ref;
287
+ }
416
288
  };
417
- Grid.prototype._callPropsCallbacks = function () {
418
- var _a = this.props,
419
- columnCount = _a.columnCount,
420
- onItemsRendered = _a.onItemsRendered,
421
- onScroll = _a.onScroll,
422
- rowCount = _a.rowCount;
289
+ _onScroll = event => {
290
+ const {
291
+ clientHeight,
292
+ clientWidth,
293
+ scrollLeft,
294
+ scrollTop,
295
+ scrollHeight,
296
+ scrollWidth
297
+ } = event.currentTarget;
298
+ this.setState(prevState => {
299
+ if (prevState.scrollLeft === scrollLeft && prevState.scrollTop === scrollTop) {
300
+ // Scroll position may have been updated by cDM/cDU,
301
+ // In which case we don't need to trigger another render,
302
+ // And we don't want to update state.isScrolling.
303
+ return null;
304
+ }
305
+ const {
306
+ direction
307
+ } = this.props;
308
+
309
+ // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
310
+ // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
311
+ // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
312
+ // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
313
+ let calculatedScrollLeft = scrollLeft;
314
+ if (direction === 'rtl') {
315
+ switch (getRTLOffsetType()) {
316
+ case 'negative':
317
+ calculatedScrollLeft = -scrollLeft;
318
+ break;
319
+ case 'positive-descending':
320
+ calculatedScrollLeft = scrollWidth - clientWidth - scrollLeft;
321
+ break;
322
+ }
323
+ }
324
+
325
+ // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
326
+ calculatedScrollLeft = Math.max(0, Math.min(calculatedScrollLeft, scrollWidth - clientWidth));
327
+ const calculatedScrollTop = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
328
+ return {
329
+ isScrolling: true,
330
+ horizontalScrollDirection: prevState.scrollLeft < scrollLeft ? 'forward' : 'backward',
331
+ scrollLeft: calculatedScrollLeft,
332
+ scrollTop: calculatedScrollTop,
333
+ verticalScrollDirection: prevState.scrollTop < scrollTop ? 'forward' : 'backward',
334
+ scrollUpdateWasRequested: false
335
+ };
336
+ }, this._resetIsScrollingDebounced);
337
+ };
338
+ _getItemStyle = (rowIndex, columnIndex) => {
339
+ const {
340
+ columnWidth,
341
+ direction,
342
+ rowHeight
343
+ } = this.props;
344
+ const itemStyleCache = this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && columnWidth, shouldResetStyleCacheOnItemSizeChange && direction, shouldResetStyleCacheOnItemSizeChange && rowHeight);
345
+ const key = `${rowIndex}:${columnIndex}`;
346
+ let style;
347
+ if (Object.prototype.hasOwnProperty.call(itemStyleCache, key)) {
348
+ style = itemStyleCache[key];
349
+ } else {
350
+ const offset = getColumnOffset(this.props, columnIndex, this._instanceProps);
351
+ const isRtl = direction === 'rtl';
352
+ itemStyleCache[key] = style = {
353
+ position: 'absolute',
354
+ left: isRtl ? undefined : offset,
355
+ right: isRtl ? offset : undefined,
356
+ top: getRowOffset(this.props, rowIndex, this._instanceProps),
357
+ height: getRowHeight(this.props, rowIndex, this._instanceProps),
358
+ width: getColumnWidth(this.props, columnIndex, this._instanceProps)
359
+ };
360
+ }
361
+ return style || {};
362
+ };
363
+ _callPropsCallbacks() {
364
+ const {
365
+ columnCount,
366
+ onItemsRendered,
367
+ onScroll,
368
+ rowCount
369
+ } = this.props;
423
370
  if (typeof onItemsRendered === 'function') {
424
371
  if (columnCount > 0 && rowCount > 0) {
425
- var _c = this._getHorizontalRangeToRender(),
426
- overscanColumnStartIndex = _c[0],
427
- overscanColumnStopIndex = _c[1],
428
- visibleColumnStartIndex = _c[2],
429
- visibleColumnStopIndex = _c[3];
430
- var _d = this._getVerticalRangeToRender(),
431
- overscanRowStartIndex = _d[0],
432
- overscanRowStopIndex = _d[1],
433
- visibleRowStartIndex = _d[2],
434
- visibleRowStopIndex = _d[3];
372
+ const [overscanColumnStartIndex, overscanColumnStopIndex, visibleColumnStartIndex, visibleColumnStopIndex] = this._getHorizontalRangeToRender();
373
+ const [overscanRowStartIndex, overscanRowStopIndex, visibleRowStartIndex, visibleRowStopIndex] = this._getVerticalRangeToRender();
435
374
  this._callOnItemsRendered(overscanColumnStartIndex, overscanColumnStopIndex, overscanRowStartIndex, overscanRowStopIndex, visibleColumnStartIndex, visibleColumnStopIndex, visibleRowStartIndex, visibleRowStopIndex);
436
375
  }
437
376
  }
438
377
  if (typeof onScroll === 'function') {
439
- var _e = this.state,
440
- horizontalScrollDirection = _e.horizontalScrollDirection,
441
- scrollLeft = _e.scrollLeft,
442
- scrollTop = _e.scrollTop,
443
- scrollUpdateWasRequested = _e.scrollUpdateWasRequested,
444
- verticalScrollDirection = _e.verticalScrollDirection;
378
+ const {
379
+ horizontalScrollDirection,
380
+ scrollLeft,
381
+ scrollTop,
382
+ scrollUpdateWasRequested,
383
+ verticalScrollDirection
384
+ } = this.state;
445
385
  this._callOnScroll(scrollLeft, scrollTop, horizontalScrollDirection, verticalScrollDirection, scrollUpdateWasRequested);
446
386
  }
447
- };
448
- Grid.prototype._getVerticalRangeToRender = function () {
449
- var _a = this.props,
450
- columnCount = _a.columnCount,
451
- overscanCount = _a.overscanCount,
452
- overscanRowCount = _a.overscanRowCount,
453
- overscanRowsCount = _a.overscanRowsCount,
454
- rowCount = _a.rowCount;
455
- var _c = this.state,
456
- isScrolling = _c.isScrolling,
457
- verticalScrollDirection = _c.verticalScrollDirection,
458
- scrollTop = _c.scrollTop;
459
- var overscanCountResolved = overscanRowCount || overscanRowsCount || overscanCount || 1;
387
+ }
388
+ _callOnScroll = memoize((scrollLeft, scrollTop, horizontalScrollDirection, verticalScrollDirection, scrollUpdateWasRequested) => this.props.onScroll({
389
+ horizontalScrollDirection,
390
+ scrollLeft,
391
+ scrollTop,
392
+ verticalScrollDirection,
393
+ scrollUpdateWasRequested
394
+ }));
395
+ _callOnItemsRendered = memoize((overscanColumnStartIndex, overscanColumnStopIndex, overscanRowStartIndex, overscanRowStopIndex, visibleColumnStartIndex, visibleColumnStopIndex, visibleRowStartIndex, visibleRowStopIndex) => this.props.onItemsRendered({
396
+ overscanColumnStartIndex,
397
+ overscanColumnStopIndex,
398
+ overscanRowStartIndex,
399
+ overscanRowStopIndex,
400
+ visibleColumnStartIndex,
401
+ visibleColumnStopIndex,
402
+ visibleRowStartIndex,
403
+ visibleRowStopIndex
404
+ }));
405
+ _getVerticalRangeToRender() {
406
+ const {
407
+ columnCount,
408
+ overscanCount,
409
+ overscanRowCount,
410
+ overscanRowsCount,
411
+ rowCount
412
+ } = this.props;
413
+ const {
414
+ isScrolling,
415
+ verticalScrollDirection,
416
+ scrollTop
417
+ } = this.state;
418
+ const overscanCountResolved = overscanRowCount || overscanRowsCount || overscanCount || 1;
460
419
  if (columnCount === 0 || rowCount === 0) {
461
420
  return [0, 0, 0, 0];
462
421
  }
463
- var startIndex = getRowStartIndexForOffset(this.props, scrollTop, this._instanceProps);
464
- var stopIndex = getRowStopIndexForStartIndex(this.props, startIndex, scrollTop, this._instanceProps);
422
+ const startIndex = getRowStartIndexForOffset(this.props, scrollTop, this._instanceProps);
423
+ const stopIndex = getRowStopIndexForStartIndex(this.props, startIndex, scrollTop, this._instanceProps);
424
+
465
425
  // Overscan by one item in each direction so that tab/focus works.
426
+ // If there isn't at least one extra item, tab loops back around.
427
+ const overscanBackward = !isScrolling || verticalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
428
+ const overscanForward = !isScrolling || verticalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
429
+ return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(rowCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
430
+ }
431
+ _getHorizontalRangeToRender() {
432
+ const {
433
+ columnCount,
434
+ overscanColumnCount,
435
+ overscanColumnsCount,
436
+ overscanCount,
437
+ rowCount
438
+ } = this.props;
439
+ const {
440
+ horizontalScrollDirection,
441
+ isScrolling,
442
+ scrollLeft
443
+ } = this.state;
444
+ const overscanCountResolved = overscanColumnCount || overscanColumnsCount || overscanCount || 1;
445
+ if (columnCount === 0 || rowCount === 0) {
446
+ return [0, 0, 0, 0];
447
+ }
448
+ const startIndex = getColumnStartIndexForOffset(this.props, scrollLeft, this._instanceProps);
449
+ const stopIndex = getColumnStopIndexForStartIndex(this.props, startIndex, scrollLeft, this._instanceProps);
450
+
451
+ // Overscan by one item in each direction so that tab/focus works.
452
+ // If there isn't at least one extra item, tab loops back around.
453
+ const overscanBackward = !isScrolling || horizontalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
454
+ const overscanForward = !isScrolling || horizontalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;
455
+ return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(columnCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
456
+ }
457
+ _resetIsScrollingDebounced = () => {
458
+ if (this._resetIsScrollingTimeoutId !== null) {
459
+ cancelTimeout(this._resetIsScrollingTimeoutId);
460
+ }
461
+ this._resetIsScrollingTimeoutId = requestTimeout(this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL);
462
+ };
463
+ _resetIsScrolling = () => {
464
+ this._resetIsScrollingTimeoutId = null;
465
+ this.setState({
466
+ isScrolling: false
467
+ }, () => {
468
+ // Clear style cache after state update has been committed.
469
+ // This way we don't break pure sCU for items that don't use isScrolling param.
470
+ this._getItemStyleCache(-1);
471
+ });
472
+ };
473
+ _getItemStyleCache = memoize((_, __, ___) => ({}));
474
+ };
475
+ }
476
+ const validateSharedProps = ({
477
+ children,
478
+ direction,
479
+ height,
480
+ innerTagName,
481
+ outerTagName,
482
+ overscanColumnsCount,
483
+ overscanCount,
484
+ overscanRowsCount,
485
+ width
486
+ }, {
487
+ instance
488
+ }) => {
489
+ if (process.env.NODE_ENV !== 'production') {
490
+ if (typeof overscanCount === 'number') {
491
+ if (devWarningsOverscanCount && !devWarningsOverscanCount.has(instance)) {
492
+ devWarningsOverscanCount.add(instance);
493
+ console.warn('The overscanCount prop has been deprecated. ' + 'Please use the overscanColumnCount and overscanRowCount props instead.');
494
+ }
495
+ }
496
+ if (typeof overscanColumnsCount === 'number' || typeof overscanRowsCount === 'number') {
497
+ if (devWarningsOverscanRowsColumnsCount && !devWarningsOverscanRowsColumnsCount.has(instance)) {
498
+ devWarningsOverscanRowsColumnsCount.add(instance);
499
+ console.warn('The overscanColumnsCount and overscanRowsCount props have been deprecated. ' + 'Please use the overscanColumnCount and overscanRowCount props instead.');
500
+ }
501
+ }
502
+ if (innerTagName != null || outerTagName != null) {
503
+ if (devWarningsTagName && !devWarningsTagName.has(instance)) {
504
+ devWarningsTagName.add(instance);
505
+ console.warn('The innerTagName and outerTagName props have been deprecated. ' + 'Please use the innerElementType and outerElementType props instead.');
506
+ }
507
+ }
508
+ if (children == null) {
509
+ throw Error('An invalid "children" prop has been specified. ' + 'Value should be a React component. ' + `"${children === null ? 'null' : typeof children}" was specified.`);
510
+ }
511
+ switch (direction) {
512
+ case 'ltr':
513
+ case 'rtl':
514
+ // Valid values
515
+ break;
516
+ default:
517
+ throw Error('An invalid "direction" prop has been specified. ' + 'Value should be either "ltr" or "rtl". ' + `"${direction}" was specified.`);
518
+ }
519
+ if (typeof width !== 'number') {
520
+ throw Error('An invalid "width" prop has been specified. ' + 'Grids must specify a number for width. ' + `"${width === null ? 'null' : typeof width}" was specified.`);
521
+ }
522
+ if (typeof height !== 'number') {
523
+ throw Error('An invalid "height" prop has been specified. ' + 'Grids must specify a number for height. ' + `"${height === null ? 'null' : typeof height}" was specified.`);
524
+ }
525
+ }
526
+ };
527
+ //# sourceMappingURL=Grid.base.js.mapdirection so that tab/focus works.
466
528
  // If there isn't at least one extra item, tab loops back around.
467
529
  var overscanBackward = !isScrolling || verticalScrollDirection === 'backward' ? Math.max(1, overscanCountResolved) : 1;
468
530
  var overscanForward = !isScrolling || verticalScrollDirection === 'forward' ? Math.max(1, overscanCountResolved) : 1;