handsontable 14.1.0 → 14.2.0-next-4873a35-20240228

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/3rdparty/walkontable/src/core/_base.js +12 -0
  2. package/3rdparty/walkontable/src/core/_base.mjs +12 -0
  3. package/3rdparty/walkontable/src/scroll.js +131 -98
  4. package/3rdparty/walkontable/src/scroll.mjs +133 -100
  5. package/3rdparty/walkontable/src/selection/border/border.js +3 -3
  6. package/3rdparty/walkontable/src/selection/border/border.mjs +3 -3
  7. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
  8. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
  9. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
  10. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
  11. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
  12. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
  13. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
  14. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
  15. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
  16. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
  17. package/3rdparty/walkontable/src/table.js +2 -0
  18. package/3rdparty/walkontable/src/table.mjs +2 -0
  19. package/3rdparty/walkontable/src/viewport.js +9 -0
  20. package/3rdparty/walkontable/src/viewport.mjs +10 -1
  21. package/CHANGELOG.md +38 -0
  22. package/base.js +2 -2
  23. package/base.mjs +2 -2
  24. package/core/index.js +6 -0
  25. package/core/index.mjs +2 -1
  26. package/core/viewportScroll/index.js +65 -0
  27. package/core/viewportScroll/index.mjs +61 -0
  28. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
  29. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
  30. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
  31. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
  32. package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
  33. package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
  34. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
  35. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
  36. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
  37. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
  38. package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
  39. package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
  40. package/core.d.ts +1 -1
  41. package/core.js +11 -52
  42. package/core.mjs +12 -53
  43. package/dataMap/metaManager/index.js +1 -1
  44. package/dataMap/metaManager/index.mjs +1 -1
  45. package/dataMap/metaManager/metaLayers/cellMeta.js +6 -1
  46. package/dataMap/metaManager/metaLayers/cellMeta.mjs +6 -1
  47. package/dataMap/metaManager/metaSchema.js +36 -12
  48. package/dataMap/metaManager/metaSchema.mjs +36 -12
  49. package/dist/handsontable.css +2 -2
  50. package/dist/handsontable.full.css +2 -2
  51. package/dist/handsontable.full.js +2996 -1928
  52. package/dist/handsontable.full.min.css +2 -2
  53. package/dist/handsontable.full.min.js +42 -42
  54. package/dist/handsontable.js +2998 -1930
  55. package/dist/handsontable.min.css +2 -2
  56. package/dist/handsontable.min.js +25 -25
  57. package/dist/languages/all.js +130 -25
  58. package/dist/languages/all.min.js +1 -1
  59. package/dist/languages/hr-HR.js +167 -0
  60. package/dist/languages/hr-HR.min.js +1 -0
  61. package/editorManager.js +15 -4
  62. package/editorManager.mjs +15 -4
  63. package/editors/autocompleteEditor/autocompleteEditor.js +2 -2
  64. package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -2
  65. package/editors/baseEditor/baseEditor.js +1 -1
  66. package/editors/baseEditor/baseEditor.mjs +1 -1
  67. package/editors/checkboxEditor/checkboxEditor.js +5 -4
  68. package/editors/checkboxEditor/checkboxEditor.mjs +5 -4
  69. package/editors/dateEditor/dateEditor.js +1 -1
  70. package/editors/dateEditor/dateEditor.mjs +1 -1
  71. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  72. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  73. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  74. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  75. package/editors/selectEditor/selectEditor.js +1 -1
  76. package/editors/selectEditor/selectEditor.mjs +1 -1
  77. package/editors/textEditor/textEditor.js +1 -2
  78. package/editors/textEditor/textEditor.mjs +1 -2
  79. package/editors/timeEditor/timeEditor.js +1 -1
  80. package/editors/timeEditor/timeEditor.mjs +1 -1
  81. package/helpers/mixed.js +2 -2
  82. package/helpers/mixed.mjs +2 -2
  83. package/helpers/moves.js +86 -0
  84. package/helpers/moves.mjs +82 -0
  85. package/i18n/languages/hr-HR.js +96 -0
  86. package/i18n/languages/hr-HR.mjs +90 -0
  87. package/i18n/languages/index.js +2 -0
  88. package/i18n/languages/index.mjs +2 -1
  89. package/languages/all.js +130 -25
  90. package/languages/hr-HR.js +167 -0
  91. package/languages/hr-HR.mjs +92 -0
  92. package/languages/index.js +130 -25
  93. package/languages/index.mjs +2 -1
  94. package/package.json +11 -1
  95. package/pluginHooks.d.ts +4 -2
  96. package/pluginHooks.js +33 -3
  97. package/pluginHooks.mjs +33 -3
  98. package/plugins/autoColumnSize/autoColumnSize.js +6 -1
  99. package/plugins/autoColumnSize/autoColumnSize.mjs +6 -1
  100. package/plugins/autoRowSize/autoRowSize.js +5 -0
  101. package/plugins/autoRowSize/autoRowSize.mjs +5 -0
  102. package/plugins/autofill/autofill.js +3 -2
  103. package/plugins/autofill/autofill.mjs +3 -2
  104. package/plugins/dropdownMenu/dropdownMenu.js +58 -4
  105. package/plugins/dropdownMenu/dropdownMenu.mjs +58 -4
  106. package/plugins/filters/component/value.js +51 -5
  107. package/plugins/filters/component/value.mjs +51 -5
  108. package/plugins/filters/utils.js +1 -1
  109. package/plugins/filters/utils.mjs +1 -1
  110. package/plugins/formulas/formulas.js +10 -1
  111. package/plugins/formulas/formulas.mjs +10 -1
  112. package/plugins/formulas/indexSyncer/axisSyncer.js +3 -75
  113. package/plugins/formulas/indexSyncer/axisSyncer.mjs +3 -75
  114. package/plugins/manualColumnResize/manualColumnResize.js +3 -0
  115. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -0
  116. package/plugins/mergeCells/cellsCollection.js +1 -1
  117. package/plugins/mergeCells/cellsCollection.mjs +1 -1
  118. package/plugins/mergeCells/mergeCells.js +30 -0
  119. package/plugins/mergeCells/mergeCells.mjs +30 -0
  120. package/plugins/undoRedo/undoRedo.js +61 -14
  121. package/plugins/undoRedo/undoRedo.mjs +61 -14
  122. package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
  123. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
  124. package/renderers/baseRenderer/baseRenderer.js +1 -1
  125. package/renderers/baseRenderer/baseRenderer.mjs +1 -1
  126. package/renderers/checkboxRenderer/checkboxRenderer.js +36 -8
  127. package/renderers/checkboxRenderer/checkboxRenderer.mjs +36 -8
  128. package/renderers/dateRenderer/dateRenderer.js +1 -1
  129. package/renderers/dateRenderer/dateRenderer.mjs +1 -1
  130. package/renderers/dropdownRenderer/dropdownRenderer.js +1 -1
  131. package/renderers/dropdownRenderer/dropdownRenderer.mjs +1 -1
  132. package/renderers/handsontableRenderer/handsontableRenderer.js +1 -1
  133. package/renderers/handsontableRenderer/handsontableRenderer.mjs +1 -1
  134. package/renderers/htmlRenderer/htmlRenderer.js +1 -1
  135. package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
  136. package/renderers/numericRenderer/index.js +2 -1
  137. package/renderers/numericRenderer/index.mjs +1 -1
  138. package/renderers/numericRenderer/numericRenderer.js +28 -13
  139. package/renderers/numericRenderer/numericRenderer.mjs +27 -13
  140. package/renderers/passwordRenderer/passwordRenderer.js +1 -1
  141. package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
  142. package/renderers/selectRenderer/selectRenderer.js +1 -1
  143. package/renderers/selectRenderer/selectRenderer.mjs +1 -1
  144. package/renderers/textRenderer/textRenderer.js +1 -1
  145. package/renderers/textRenderer/textRenderer.mjs +1 -1
  146. package/renderers/timeRenderer/timeRenderer.js +1 -1
  147. package/renderers/timeRenderer/timeRenderer.mjs +1 -1
  148. package/selection/mouseEventHandler.js +4 -0
  149. package/selection/mouseEventHandler.mjs +4 -0
  150. package/selection/selection.js +64 -5
  151. package/selection/selection.mjs +64 -5
  152. package/shortcuts/recorder.js +27 -8
  153. package/shortcuts/recorder.mjs +27 -8
  154. package/tableView.js +86 -5
  155. package/tableView.mjs +87 -6
  156. package/utils/autoResize.js +0 -1
  157. package/utils/autoResize.mjs +0 -1
  158. package/utils/ghostTable.js +6 -6
  159. package/utils/ghostTable.mjs +6 -6
  160. package/utils/parseTable.js +9 -1
  161. package/utils/parseTable.mjs +9 -1
@@ -318,12 +318,18 @@ class CoreAbstract {
318
318
  get startColumnVisible() {
319
319
  return wot.wtViewport.columnsVisibleCalculator.startColumn;
320
320
  },
321
+ get startColumnPartiallyVisible() {
322
+ return wot.wtViewport.columnsPartiallyVisibleCalculator.startColumn;
323
+ },
321
324
  get endColumnRendered() {
322
325
  return wot.wtViewport.columnsRenderCalculator.endColumn;
323
326
  },
324
327
  get endColumnVisible() {
325
328
  return wot.wtViewport.columnsVisibleCalculator.endColumn;
326
329
  },
330
+ get endColumnPartiallyVisible() {
331
+ return wot.wtViewport.columnsPartiallyVisibleCalculator.endColumn;
332
+ },
327
333
  get countColumnsRendered() {
328
334
  return wot.wtViewport.columnsRenderCalculator.count;
329
335
  },
@@ -336,12 +342,18 @@ class CoreAbstract {
336
342
  get startRowVisible() {
337
343
  return wot.wtViewport.rowsVisibleCalculator.startRow;
338
344
  },
345
+ get startRowPartiallyVisible() {
346
+ return wot.wtViewport.rowsPartiallyVisibleCalculator.startRow;
347
+ },
339
348
  get endRowRendered() {
340
349
  return wot.wtViewport.rowsRenderCalculator.endRow;
341
350
  },
342
351
  get endRowVisible() {
343
352
  return wot.wtViewport.rowsVisibleCalculator.endRow;
344
353
  },
354
+ get endRowPartiallyVisible() {
355
+ return wot.wtViewport.rowsPartiallyVisibleCalculator.endRow;
356
+ },
345
357
  get countRowsRendered() {
346
358
  return wot.wtViewport.rowsRenderCalculator.count;
347
359
  },
@@ -314,12 +314,18 @@ export default class CoreAbstract {
314
314
  get startColumnVisible() {
315
315
  return wot.wtViewport.columnsVisibleCalculator.startColumn;
316
316
  },
317
+ get startColumnPartiallyVisible() {
318
+ return wot.wtViewport.columnsPartiallyVisibleCalculator.startColumn;
319
+ },
317
320
  get endColumnRendered() {
318
321
  return wot.wtViewport.columnsRenderCalculator.endColumn;
319
322
  },
320
323
  get endColumnVisible() {
321
324
  return wot.wtViewport.columnsVisibleCalculator.endColumn;
322
325
  },
326
+ get endColumnPartiallyVisible() {
327
+ return wot.wtViewport.columnsPartiallyVisibleCalculator.endColumn;
328
+ },
323
329
  get countColumnsRendered() {
324
330
  return wot.wtViewport.columnsRenderCalculator.count;
325
331
  },
@@ -332,12 +338,18 @@ export default class CoreAbstract {
332
338
  get startRowVisible() {
333
339
  return wot.wtViewport.rowsVisibleCalculator.startRow;
334
340
  },
341
+ get startRowPartiallyVisible() {
342
+ return wot.wtViewport.rowsPartiallyVisibleCalculator.startRow;
343
+ },
335
344
  get endRowRendered() {
336
345
  return wot.wtViewport.rowsRenderCalculator.endRow;
337
346
  },
338
347
  get endRowVisible() {
339
348
  return wot.wtViewport.rowsVisibleCalculator.endRow;
340
349
  },
350
+ get endRowPartiallyVisible() {
351
+ return wot.wtViewport.rowsPartiallyVisibleCalculator.endRow;
352
+ },
341
353
  get countRowsRendered() {
342
354
  return wot.wtViewport.rowsRenderCalculator.count;
343
355
  },
@@ -3,40 +3,43 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _element = require("../../../helpers/dom/element");
6
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
8
10
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
9
12
  /**
10
13
  * @class Scroll
11
14
  */
15
+ var _getLastColumnIndex = /*#__PURE__*/new WeakSet();
16
+ var _getLastRowIndex = /*#__PURE__*/new WeakSet();
12
17
  class Scroll {
13
18
  /**
14
19
  * @param {ScrollDao} dataAccessObject Tha data access object.
15
20
  */
16
21
  constructor(dataAccessObject) {
17
22
  /**
18
- * The data access object.
23
+ * Get last visible row based on virtual dom and how table is visible in browser window viewport.
19
24
  *
20
- * @protected
21
- * @type {ScrollDao}
25
+ * @param {number} lastRowIndex The last visible row index.
26
+ * @returns {number}
22
27
  */
23
- _defineProperty(this, "dataAccessObject", void 0);
28
+ _classPrivateMethodInitSpec(this, _getLastRowIndex);
24
29
  /**
25
- * Holds the last column reached by the scroll, which determines the scroll snapping direction
26
- * (left or right) for a next horizontal scroll.
30
+ * Get last visible column based on virtual dom and how table is visible in browser window viewport.
27
31
  *
28
- * @protected
29
- * @type {number}
32
+ * @param {number} lastColumnIndex The last visible column index.
33
+ * @returns {number}
30
34
  */
31
- _defineProperty(this, "lastScrolledColumnPos", -1);
35
+ _classPrivateMethodInitSpec(this, _getLastColumnIndex);
32
36
  /**
33
- * Holds the last row reached by the scroll, which determines the scroll snapping direction
34
- * (top or bottom) for a next vertical scroll.
37
+ * The data access object.
35
38
  *
36
39
  * @protected
37
- * @type {number}
40
+ * @type {ScrollDao}
38
41
  */
39
- _defineProperty(this, "lastScrolledRowPos", -1);
42
+ _defineProperty(this, "dataAccessObject", void 0);
40
43
  this.dataAccessObject = dataAccessObject;
41
44
  }
42
45
 
@@ -74,8 +77,6 @@ class Scroll {
74
77
  if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
75
78
  return false;
76
79
  }
77
- const firstVisibleColumn = this.getFirstVisibleColumn();
78
- const lastVisibleColumn = this.getLastVisibleColumn();
79
80
  const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
80
81
  const {
81
82
  fixedColumnsStart,
@@ -87,20 +88,17 @@ class Scroll {
87
88
  if (autoSnapping && column < fixedColumnsStart) {
88
89
  return false;
89
90
  }
90
- let result = false;
91
91
  column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
92
-
93
- // if there is no fully visible columns use the supporting variable (lastScrolledColumnPos) to
94
- // determine the snapping direction (left or right)
95
- if (firstVisibleColumn === -1) {
96
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column > this.lastScrolledColumnPos : snapToRight);
97
- } else if (autoSnapping && (column < firstVisibleColumn || column > lastVisibleColumn) || !autoSnapping) {
92
+ if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
93
+ return false;
94
+ }
95
+ const firstColumn = this.getFirstVisibleColumn();
96
+ const lastColumn = this.getLastVisibleColumn();
97
+ let result = false;
98
+ if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
98
99
  // if there is at least one fully visible column determine the snapping direction based on
99
100
  // that columns or by snapToRight/snapToLeft flags, if provided.
100
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column > lastVisibleColumn : snapToRight);
101
- }
102
- if (result) {
103
- this.lastScrolledColumnPos = column;
101
+ result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
104
102
  }
105
103
  return result;
106
104
  }
@@ -123,8 +121,6 @@ class Scroll {
123
121
  if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
124
122
  return false;
125
123
  }
126
- const firstVisibleRow = this.getFirstVisibleRow();
127
- const lastVisibleRow = this.getLastVisibleRow();
128
124
  const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
129
125
  const {
130
126
  fixedRowsBottom,
@@ -137,20 +133,17 @@ class Scroll {
137
133
  if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
138
134
  return false;
139
135
  }
140
- let result = false;
141
136
  row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
142
-
143
- // if there is no fully visible rows use the supporting variable (lastScrolledRowPos) to
144
- // determine the snapping direction (top or bottom)
145
- if (firstVisibleRow === -1) {
146
- result = topOverlay.scrollTo(row, autoSnapping ? row > this.lastScrolledRowPos : snapToBottom);
147
- } else if (autoSnapping && (row < firstVisibleRow || row > lastVisibleRow) || !autoSnapping) {
137
+ if (!Number.isInteger(row) || row < 0 || row > totalRows) {
138
+ return false;
139
+ }
140
+ const firstRow = this.getFirstVisibleRow();
141
+ const lastRow = this.getLastVisibleRow();
142
+ let result = false;
143
+ if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
148
144
  // if there is at least one fully visible row determine the snapping direction based on
149
145
  // that rows or by snapToTop/snapToBottom flags, if provided.
150
- result = topOverlay.scrollTo(row, autoSnapping ? row > lastVisibleRow : snapToBottom);
151
- }
152
- if (result) {
153
- this.lastScrolledRowPos = row;
146
+ result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
154
147
  }
155
148
  return result;
156
149
  }
@@ -170,33 +163,25 @@ class Scroll {
170
163
  * @returns {number}
171
164
  */
172
165
  getLastVisibleRow() {
173
- const {
174
- topOverlay,
175
- wtTable,
176
- wtViewport,
177
- totalRows,
178
- rootWindow
179
- } = this.dataAccessObject;
180
- let lastVisibleRow = wtTable.getLastVisibleRow();
181
- if (topOverlay.mainTableScrollableElement === rootWindow) {
182
- const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
183
- const windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow);
166
+ return _classPrivateMethodGet(this, _getLastRowIndex, _getLastRowIndex2).call(this, this.dataAccessObject.wtTable.getLastVisibleRow());
167
+ }
184
168
 
185
- // Only calculate lastVisibleRow when table didn't filled (from bottom) whole viewport space
186
- if (rootElementOffset.top > windowScrollTop) {
187
- const windowHeight = (0, _element.innerHeight)(rootWindow);
188
- let rowsHeight = wtViewport.getColumnHeaderHeight();
189
- for (let row = 1; row <= totalRows; row++) {
190
- rowsHeight += topOverlay.sumCellSizes(row - 1, row);
191
- if (rootElementOffset.top + rowsHeight - windowScrollTop >= windowHeight) {
192
- // Return physical row - 1 (-2 because rangeEach gives row index + 1 - sumCellSizes requirements)
193
- lastVisibleRow = row - 2;
194
- break;
195
- }
196
- }
197
- }
198
- }
199
- return lastVisibleRow;
169
+ /**
170
+ * Get first partially visible row based on virtual dom and how table is visible in browser window viewport.
171
+ *
172
+ * @returns {number}
173
+ */
174
+ getFirstPartiallyVisibleRow() {
175
+ return this.dataAccessObject.wtTable.getFirstPartiallyVisibleRow();
176
+ }
177
+
178
+ /**
179
+ * Get last visible row based on virtual dom and how table is visible in browser window viewport.
180
+ *
181
+ * @returns {number}
182
+ */
183
+ getLastPartiallyVisibleRow() {
184
+ return _classPrivateMethodGet(this, _getLastRowIndex, _getLastRowIndex2).call(this, this.dataAccessObject.wtTable.getLastPartiallyVisibleRow());
200
185
  }
201
186
 
202
187
  /**
@@ -214,44 +199,92 @@ class Scroll {
214
199
  * @returns {number}
215
200
  */
216
201
  getLastVisibleColumn() {
217
- const {
218
- wtSettings,
219
- inlineStartOverlay,
220
- wtTable,
221
- wtViewport,
222
- totalColumns,
223
- rootWindow
224
- } = this.dataAccessObject;
225
- let lastVisibleColumn = wtTable.getLastVisibleColumn();
226
- if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
227
- const isRtl = wtSettings.getSetting('rtlMode');
228
- let inlineStartRootElementOffset = null;
229
- if (isRtl) {
230
- const tableRect = wtTable.TABLE.getBoundingClientRect();
231
- const rootDocument = this.dataAccessObject.rootWindow.document;
232
- const docOffsetWidth = rootDocument.documentElement.offsetWidth;
233
- inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
234
- } else {
235
- const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
236
- inlineStartRootElementOffset = rootElementOffset.left;
202
+ return _classPrivateMethodGet(this, _getLastColumnIndex, _getLastColumnIndex2).call(this, this.dataAccessObject.wtTable.getLastVisibleColumn());
203
+ }
204
+
205
+ /**
206
+ * Get first partially visible column based on virtual dom and how table is visible in browser window viewport.
207
+ *
208
+ * @returns {number}
209
+ */
210
+ getFirstPartiallyVisibleColumn() {
211
+ return this.dataAccessObject.wtTable.getFirstPartiallyVisibleColumn();
212
+ }
213
+
214
+ /**
215
+ * Get last partially visible column based on virtual dom and how table is visible in browser window viewport.
216
+ *
217
+ * @returns {number}
218
+ */
219
+ getLastPartiallyVisibleColumn() {
220
+ return _classPrivateMethodGet(this, _getLastColumnIndex, _getLastColumnIndex2).call(this, this.dataAccessObject.wtTable.getLastPartiallyVisibleColumn());
221
+ }
222
+ }
223
+ function _getLastColumnIndex2(lastColumnIndex) {
224
+ const {
225
+ wtSettings,
226
+ inlineStartOverlay,
227
+ wtTable,
228
+ wtViewport,
229
+ totalColumns,
230
+ rootWindow
231
+ } = this.dataAccessObject;
232
+ if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
233
+ const isRtl = wtSettings.getSetting('rtlMode');
234
+ let inlineStartRootElementOffset = null;
235
+ if (isRtl) {
236
+ const tableRect = wtTable.TABLE.getBoundingClientRect();
237
+ const rootDocument = this.dataAccessObject.rootWindow.document;
238
+ const docOffsetWidth = rootDocument.documentElement.offsetWidth;
239
+ inlineStartRootElementOffset = Math.abs(tableRect.right - docOffsetWidth);
240
+ } else {
241
+ const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
242
+ inlineStartRootElementOffset = rootElementOffset.left;
243
+ }
244
+ const windowScrollLeft = Math.abs((0, _element.getScrollLeft)(rootWindow, rootWindow));
245
+
246
+ // Only calculate lastColumnIndex when table didn't filled (from right) whole viewport space
247
+ if (inlineStartRootElementOffset > windowScrollLeft) {
248
+ const windowWidth = (0, _element.innerWidth)(rootWindow);
249
+ let columnsWidth = wtViewport.getRowHeaderWidth();
250
+ for (let column = 1; column <= totalColumns; column++) {
251
+ columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
252
+ if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
253
+ // Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
254
+ lastColumnIndex = column - 2;
255
+ break;
256
+ }
237
257
  }
238
- const windowScrollLeft = Math.abs((0, _element.getScrollLeft)(rootWindow, rootWindow));
258
+ }
259
+ }
260
+ return lastColumnIndex;
261
+ }
262
+ function _getLastRowIndex2(lastRowIndex) {
263
+ const {
264
+ topOverlay,
265
+ wtTable,
266
+ wtViewport,
267
+ totalRows,
268
+ rootWindow
269
+ } = this.dataAccessObject;
270
+ if (topOverlay.mainTableScrollableElement === rootWindow) {
271
+ const rootElementOffset = (0, _element.offset)(wtTable.wtRootElement);
272
+ const windowScrollTop = (0, _element.getScrollTop)(rootWindow, rootWindow);
239
273
 
240
- // Only calculate lastVisibleColumn when table didn't filled (from right) whole viewport space
241
- if (inlineStartRootElementOffset > windowScrollLeft) {
242
- const windowWidth = (0, _element.innerWidth)(rootWindow);
243
- let columnsWidth = wtViewport.getRowHeaderWidth();
244
- for (let column = 1; column <= totalColumns; column++) {
245
- columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
246
- if (inlineStartRootElementOffset + columnsWidth - windowScrollLeft >= windowWidth) {
247
- // Return physical column - 1 (-2 because rangeEach gives column index + 1 - sumCellSizes requirements)
248
- lastVisibleColumn = column - 2;
249
- break;
250
- }
274
+ // Only calculate lastRowIndex when table didn't filled (from bottom) whole viewport space
275
+ if (rootElementOffset.top > windowScrollTop) {
276
+ const windowHeight = (0, _element.innerHeight)(rootWindow);
277
+ let rowsHeight = wtViewport.getColumnHeaderHeight();
278
+ for (let row = 1; row <= totalRows; row++) {
279
+ rowsHeight += topOverlay.sumCellSizes(row - 1, row);
280
+ if (rootElementOffset.top + rowsHeight - windowScrollTop >= windowHeight) {
281
+ // Return physical row - 1 (-2 because rangeEach gives row index + 1 - sumCellSizes requirements)
282
+ lastRowIndex = row - 2;
283
+ break;
251
284
  }
252
285
  }
253
286
  }
254
- return lastVisibleColumn;
255
287
  }
288
+ return lastRowIndex;
256
289
  }
257
290
  var _default = exports.default = Scroll;