handsontable 0.0.0-next-d82e84a-20240117 → 0.0.0-next-40cdda4-20240118

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (55) 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 +125 -98
  4. package/3rdparty/walkontable/src/scroll.mjs +127 -100
  5. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
  6. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
  7. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
  8. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
  9. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
  10. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
  11. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
  12. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
  13. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
  14. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
  15. package/3rdparty/walkontable/src/table.js +2 -0
  16. package/3rdparty/walkontable/src/table.mjs +2 -0
  17. package/3rdparty/walkontable/src/viewport.js +9 -0
  18. package/3rdparty/walkontable/src/viewport.mjs +10 -1
  19. package/base.js +2 -2
  20. package/base.mjs +2 -2
  21. package/core/index.js +6 -0
  22. package/core/index.mjs +2 -1
  23. package/core/viewportScroll/index.js +65 -0
  24. package/core/viewportScroll/index.mjs +61 -0
  25. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
  26. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
  27. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
  28. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
  29. package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
  30. package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
  31. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
  32. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
  33. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
  34. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
  35. package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
  36. package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
  37. package/core.js +11 -52
  38. package/core.mjs +12 -53
  39. package/dist/handsontable.css +2 -2
  40. package/dist/handsontable.full.css +2 -2
  41. package/dist/handsontable.full.js +1577 -1073
  42. package/dist/handsontable.full.min.css +2 -2
  43. package/dist/handsontable.full.min.js +41 -41
  44. package/dist/handsontable.js +1579 -1075
  45. package/dist/handsontable.min.css +2 -2
  46. package/dist/handsontable.min.js +16 -16
  47. package/helpers/mixed.js +1 -1
  48. package/helpers/mixed.mjs +1 -1
  49. package/package.json +1 -1
  50. package/selection/mouseEventHandler.js +4 -0
  51. package/selection/mouseEventHandler.mjs +4 -0
  52. package/selection/selection.js +63 -4
  53. package/selection/selection.mjs +63 -4
  54. package/tableView.js +76 -0
  55. package/tableView.mjs +76 -0
package/core.mjs CHANGED
@@ -28,7 +28,7 @@ import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from
28
28
  import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
29
29
  import { Selection } from "./selection/index.mjs";
30
30
  import { MetaManager, DynamicCellMetaMod, ExtendMetaPropertiesMod, replaceData } from "./dataMap/index.mjs";
31
- import { installFocusCatcher } from "./core/index.mjs";
31
+ import { installFocusCatcher, createViewportScroller } from "./core/index.mjs";
32
32
  import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
33
33
  import { createShortcutManager } from "./shortcuts/index.mjs";
34
34
  import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
@@ -105,7 +105,6 @@ export default function Core(rootElement, userSettings) {
105
105
  var _userSettings$layoutD,
106
106
  _this = this;
107
107
  let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
108
- let preventScrollingToCell = false;
109
108
  let instance = this;
110
109
  const eventManager = new EventManager(instance);
111
110
  let datamap;
@@ -113,6 +112,7 @@ export default function Core(rootElement, userSettings) {
113
112
  let grid;
114
113
  let editorManager;
115
114
  let focusManager;
115
+ let viewportScroller;
116
116
  let firstRun = true;
117
117
  if (hasValidParameter(rootInstanceSymbol)) {
118
118
  registerAsRootInstance(this);
@@ -302,7 +302,7 @@ export default function Core(rootElement, userSettings) {
302
302
  };
303
303
  this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
304
304
  this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
305
- this.selection.addLocalHook('afterSetRangeEnd', cellCoords => {
305
+ this.selection.addLocalHook('afterSetRangeEnd', (cellCoords, isLastSelectionLayer) => {
306
306
  const preventScrolling = createObjectPropListener(false);
307
307
  const selectionRange = this.selection.getSelectedRange();
308
308
  const {
@@ -311,53 +311,12 @@ export default function Core(rootElement, userSettings) {
311
311
  } = selectionRange.current();
312
312
  const selectionLayerLevel = selectionRange.size() - 1;
313
313
  this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
314
- this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
315
-
316
- let scrollToCell = true;
317
- if (preventScrollingToCell) {
318
- scrollToCell = false;
319
- }
320
- if (preventScrolling.isTouched()) {
321
- scrollToCell = !preventScrolling.value;
322
- }
323
- const currentSelectedRange = this.selection.selectedRange.current();
324
- const isSelectedByAnyHeader = this.selection.isSelectedByAnyHeader();
325
- const isSelectedByRowHeader = this.selection.isSelectedByRowHeader();
326
- const isSelectedByColumnHeader = this.selection.isSelectedByColumnHeader();
327
- if (scrollToCell !== false) {
328
- if (!isSelectedByAnyHeader) {
329
- if (currentSelectedRange && !this.selection.isMultiple()) {
330
- const {
331
- row,
332
- col
333
- } = currentSelectedRange.from;
334
- if (row < 0 && col >= 0) {
335
- this.scrollViewportTo({
336
- col
337
- });
338
- } else if (col < 0 && row >= 0) {
339
- this.scrollViewportTo({
340
- row
341
- });
342
- } else {
343
- this.scrollViewportTo({
344
- row,
345
- col
346
- });
347
- }
348
- } else {
349
- this.scrollViewportTo(cellCoords.toObject());
350
- }
351
- } else if (isSelectedByRowHeader) {
352
- this.scrollViewportTo({
353
- row: cellCoords.row
354
- });
355
- } else if (isSelectedByColumnHeader) {
356
- this.scrollViewportTo({
357
- col: cellCoords.col
358
- });
359
- }
314
+ this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel);
315
+ if (isLastSelectionLayer && (!preventScrolling.isTouched() || preventScrolling.isTouched() && !preventScrolling.value)) {
316
+ viewportScroller.scrollTo(cellCoords);
360
317
  }
318
+ const isSelectedByRowHeader = selection.isSelectedByRowHeader();
319
+ const isSelectedByColumnHeader = selection.isSelectedByColumnHeader();
361
320
 
362
321
  // @TODO: These CSS classes are no longer needed anymore. They are used only as a indicator of the selected
363
322
  // rows/columns in the MergedCells plugin (via border.js#L520 in the walkontable module). After fixing
@@ -1093,6 +1052,7 @@ export default function Core(rootElement, userSettings) {
1093
1052
  this.updateSettings(tableMeta, true);
1094
1053
  this.view = new TableView(this);
1095
1054
  editorManager = EditorManager.getInstance(instance, tableMeta, selection);
1055
+ viewportScroller = createViewportScroller(instance);
1096
1056
  focusManager = new FocusManager(instance);
1097
1057
  if (isRootInstance(this)) {
1098
1058
  installFocusCatcher(instance);
@@ -3910,13 +3870,13 @@ export default function Core(rootElement, userSettings) {
3910
3870
  let scrollToCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3911
3871
  let changeListener = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3912
3872
  if (scrollToCell === false) {
3913
- preventScrollingToCell = true;
3873
+ viewportScroller.suspend();
3914
3874
  }
3915
3875
  const wasSelected = selection.selectCells(coords);
3916
3876
  if (wasSelected && changeListener) {
3917
3877
  instance.listen();
3918
3878
  }
3919
- preventScrollingToCell = false;
3879
+ viewportScroller.resume();
3920
3880
  return wasSelected;
3921
3881
  };
3922
3882
 
@@ -4048,9 +4008,8 @@ export default function Core(rootElement, userSettings) {
4048
4008
  let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4049
4009
  let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : includeRowHeaders;
4050
4010
  let options = arguments.length > 2 ? arguments[2] : undefined;
4051
- preventScrollingToCell = true;
4011
+ viewportScroller.skipNextScrollCycle();
4052
4012
  selection.selectAll(includeRowHeaders, includeColumnHeaders, options);
4053
- preventScrollingToCell = false;
4054
4013
  };
4055
4014
  const getIndexToScroll = (indexMapper, visualIndex) => {
4056
4015
  // Looking for a visual index on the right and then (when not found) on the left.
@@ -25,8 +25,8 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-d82e84a-20240117
29
- * Release date: 16/01/2024 (built at 17/01/2024 13:49:44)
28
+ * Version: 0.0.0-next-40cdda4-20240118
29
+ * Release date: 16/01/2024 (built at 18/01/2024 13:04:39)
30
30
  */
31
31
  /**
32
32
  * Fix for bootstrap styles
@@ -25,8 +25,8 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-d82e84a-20240117
29
- * Release date: 16/01/2024 (built at 17/01/2024 13:49:44)
28
+ * Version: 0.0.0-next-40cdda4-20240118
29
+ * Release date: 16/01/2024 (built at 18/01/2024 13:04:39)
30
30
  */
31
31
  /**
32
32
  * Fix for bootstrap styles