@beppla/tapas-ui 1.0.67 → 1.0.68

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