handsontable 0.0.0-next-fd9f817-20241125 → 0.0.0-next-fcb9b77-20241126

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 (114) hide show
  1. package/3rdparty/walkontable/src/calculator/index.js +2 -1
  2. package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  5. package/3rdparty/walkontable/src/core/_base.js +19 -26
  6. package/3rdparty/walkontable/src/core/_base.mjs +19 -26
  7. package/3rdparty/walkontable/src/core/clone.js +0 -1
  8. package/3rdparty/walkontable/src/core/clone.mjs +0 -1
  9. package/3rdparty/walkontable/src/core/core.js +0 -2
  10. package/3rdparty/walkontable/src/core/core.mjs +0 -2
  11. package/3rdparty/walkontable/src/facade/core.js +6 -9
  12. package/3rdparty/walkontable/src/facade/core.mjs +6 -9
  13. package/3rdparty/walkontable/src/index.js +1 -0
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/overlay/_base.js +1 -3
  16. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
  17. package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
  18. package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  21. package/3rdparty/walkontable/src/renderer/index.js +2 -4
  22. package/3rdparty/walkontable/src/renderer/index.mjs +2 -4
  23. package/3rdparty/walkontable/src/renderer/table.js +3 -12
  24. package/3rdparty/walkontable/src/renderer/table.mjs +3 -12
  25. package/3rdparty/walkontable/src/scroll.js +46 -37
  26. package/3rdparty/walkontable/src/scroll.mjs +46 -37
  27. package/3rdparty/walkontable/src/settings.js +2 -0
  28. package/3rdparty/walkontable/src/settings.mjs +2 -0
  29. package/3rdparty/walkontable/src/table.js +9 -17
  30. package/3rdparty/walkontable/src/table.mjs +9 -17
  31. package/3rdparty/walkontable/src/types.js +0 -1
  32. package/3rdparty/walkontable/src/types.mjs +0 -1
  33. package/3rdparty/walkontable/src/utils/column.js +1 -1
  34. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  35. package/3rdparty/walkontable/src/viewport.js +0 -1
  36. package/3rdparty/walkontable/src/viewport.mjs +0 -1
  37. package/base.js +2 -2
  38. package/base.mjs +2 -2
  39. package/core/hooks/constants.js +7 -9
  40. package/core/hooks/constants.mjs +7 -9
  41. package/core/hooks/index.d.ts +2 -3
  42. package/core.d.ts +0 -2
  43. package/core.js +3 -64
  44. package/core.mjs +3 -64
  45. package/dataMap/metaManager/metaSchema.js +3 -23
  46. package/dataMap/metaManager/metaSchema.mjs +3 -23
  47. package/dist/handsontable.css +9 -17
  48. package/dist/handsontable.full.css +240 -249
  49. package/dist/handsontable.full.js +4386 -4760
  50. package/dist/handsontable.full.min.css +9 -11
  51. package/dist/handsontable.full.min.js +53 -53
  52. package/dist/handsontable.js +4087 -4467
  53. package/dist/handsontable.min.css +4 -5
  54. package/dist/handsontable.min.js +33 -33
  55. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  56. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  57. package/editors/baseEditor/baseEditor.js +1 -1
  58. package/editors/baseEditor/baseEditor.mjs +1 -1
  59. package/editors/dateEditor/dateEditor.js +0 -9
  60. package/editors/dateEditor/dateEditor.mjs +1 -10
  61. package/editors/handsontableEditor/handsontableEditor.js +1 -7
  62. package/editors/handsontableEditor/handsontableEditor.mjs +1 -7
  63. package/editors/selectEditor/selectEditor.js +9 -20
  64. package/editors/selectEditor/selectEditor.mjs +9 -20
  65. package/editors/textEditor/textEditor.js +11 -4
  66. package/editors/textEditor/textEditor.mjs +11 -4
  67. package/helpers/dom/element.js +1 -32
  68. package/helpers/dom/element.mjs +1 -31
  69. package/helpers/mixed.js +2 -2
  70. package/helpers/mixed.mjs +2 -2
  71. package/package.json +3 -10
  72. package/plugins/comments/commentEditor.js +0 -9
  73. package/plugins/comments/commentEditor.mjs +0 -9
  74. package/plugins/comments/comments.js +0 -14
  75. package/plugins/comments/comments.mjs +1 -15
  76. package/plugins/contextMenu/menu/menu.js +4 -9
  77. package/plugins/contextMenu/menu/menu.mjs +4 -9
  78. package/plugins/contextMenu/predefinedItems/alignment.js +7 -84
  79. package/plugins/contextMenu/predefinedItems/alignment.mjs +8 -85
  80. package/plugins/contextMenu/utils.js +0 -10
  81. package/plugins/contextMenu/utils.mjs +0 -9
  82. package/plugins/filters/ui/multipleSelect.js +0 -6
  83. package/plugins/filters/ui/multipleSelect.mjs +0 -6
  84. package/plugins/manualRowMove/manualRowMove.js +1 -1
  85. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  86. package/plugins/manualRowResize/manualRowResize.js +2 -1
  87. package/plugins/manualRowResize/manualRowResize.mjs +3 -2
  88. package/plugins/mergeCells/mergeCells.js +1 -1
  89. package/plugins/mergeCells/mergeCells.mjs +1 -1
  90. package/plugins/nestedHeaders/nestedHeaders.js +60 -15
  91. package/plugins/nestedHeaders/nestedHeaders.mjs +60 -15
  92. package/plugins/nestedRows/ui/headers.js +1 -7
  93. package/plugins/nestedRows/ui/headers.mjs +1 -7
  94. package/plugins/stretchColumns/calculator.js +1 -2
  95. package/plugins/stretchColumns/calculator.mjs +2 -3
  96. package/selection/selection.js +4 -2
  97. package/selection/selection.mjs +4 -2
  98. package/settings.d.ts +0 -1
  99. package/tableView.js +23 -64
  100. package/tableView.mjs +24 -65
  101. package/utils/autoResize.js +1 -4
  102. package/utils/autoResize.mjs +1 -4
  103. package/utils/ghostTable.js +3 -5
  104. package/utils/ghostTable.mjs +3 -5
  105. package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -287
  106. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -283
  107. package/helpers/themes.js +0 -17
  108. package/helpers/themes.mjs +0 -13
  109. package/styles/handsontable.css +0 -2187
  110. package/styles/handsontable.min.css +0 -30
  111. package/styles/ht-theme-horizon.css +0 -607
  112. package/styles/ht-theme-horizon.min.css +0 -30
  113. package/styles/ht-theme-main.css +0 -613
  114. package/styles/ht-theme-main.min.css +0 -30
@@ -3,6 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _element = require("../../../helpers/dom/element");
6
+ var _object = require("../../../helpers/object");
6
7
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
7
8
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
8
9
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -39,15 +40,20 @@ class Scroll {
39
40
  * Scrolls viewport to a cell.
40
41
  *
41
42
  * @param {CellCoords} coords The cell coordinates.
42
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
43
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
44
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
45
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
43
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
44
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
45
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
46
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
47
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
48
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
46
49
  * @returns {boolean}
47
50
  */
48
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
49
- const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, snapToRight, snapToLeft);
50
- const scrolledVertically = this.scrollViewportVertically(coords.row, snapToTop, snapToBottom);
51
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
52
+ if (coords.col < 0 || coords.row < 0) {
53
+ return false;
54
+ }
55
+ const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, horizontalSnap);
56
+ const scrolledVertically = this.scrollViewportVertically(coords.row, verticalSnap);
51
57
  return scrolledHorizontally || scrolledVertically;
52
58
  }
53
59
 
@@ -55,42 +61,43 @@ class Scroll {
55
61
  * Scrolls viewport to a column.
56
62
  *
57
63
  * @param {number} column Visual column index.
58
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
59
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
64
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
65
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
66
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
60
67
  * @returns {boolean}
61
68
  */
62
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
69
+ scrollViewportHorizontally(column) {
70
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
63
71
  const {
64
72
  drawn,
65
73
  totalColumns
66
74
  } = this.dataAccessObject;
67
-
68
- // do not scroll the viewport when the column points to a range outside of the dataset
69
- if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
75
+ if (!drawn) {
76
+ return false;
77
+ }
78
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
79
+ column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column, snappingObject);
80
+ if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
70
81
  return false;
71
82
  }
72
- const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
83
+ snapping = snappingObject.value;
73
84
  const {
74
85
  fixedColumnsStart,
75
86
  inlineStartOverlay
76
87
  } = this.dataAccessObject;
88
+ const autoSnapping = snapping === 'auto';
77
89
 
78
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
79
- // when the columns points to the overlays
90
+ // for auto-snapping do not scroll the viewport when the columns points to the overlays
80
91
  if (autoSnapping && column < fixedColumnsStart) {
81
92
  return false;
82
93
  }
83
- column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
84
- if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
85
- return false;
86
- }
87
94
  const firstColumn = this.getFirstVisibleColumn();
88
95
  const lastColumn = this.getLastVisibleColumn();
89
96
  let result = false;
90
97
  if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
91
98
  // if there is at least one fully visible column determine the snapping direction based on
92
- // that columns or by snapToRight/snapToLeft flags, if provided.
93
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
99
+ // that columns or by snapping flag, if provided.
100
+ result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapping === 'end');
94
101
  }
95
102
  return result;
96
103
  }
@@ -99,43 +106,45 @@ class Scroll {
99
106
  * Scrolls viewport to a row.
100
107
  *
101
108
  * @param {number} row Visual row index.
102
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
103
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
109
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
110
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
111
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
112
+ * the viewport.
104
113
  * @returns {boolean}
105
114
  */
106
- scrollViewportVertically(row, snapToTop, snapToBottom) {
115
+ scrollViewportVertically(row) {
116
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
107
117
  const {
108
118
  drawn,
109
119
  totalRows
110
120
  } = this.dataAccessObject;
111
-
112
- // do not scroll the viewport when the row points to a range outside of the dataset
113
- if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
121
+ if (!drawn) {
122
+ return false;
123
+ }
124
+ const snappingObject = (0, _object.createObjectPropListener)(snapping);
125
+ row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row, snappingObject);
126
+ if (!Number.isInteger(row) || row < 0 || row > totalRows) {
114
127
  return false;
115
128
  }
116
- const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
129
+ snapping = snappingObject.value;
117
130
  const {
118
131
  fixedRowsBottom,
119
132
  fixedRowsTop,
120
133
  topOverlay
121
134
  } = this.dataAccessObject;
135
+ const autoSnapping = snapping === 'auto';
122
136
 
123
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
124
- // when the rows points to the overlays
137
+ // for auto-snapping do not scroll the viewport when the rows points to the overlays
125
138
  if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
126
139
  return false;
127
140
  }
128
- row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
129
- if (!Number.isInteger(row) || row < 0 || row > totalRows) {
130
- return false;
131
- }
132
141
  const firstRow = this.getFirstVisibleRow();
133
142
  const lastRow = this.getLastVisibleRow();
134
143
  let result = false;
135
144
  if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
136
145
  // if there is at least one fully visible row determine the snapping direction based on
137
- // that rows or by snapToTop/snapToBottom flags, if provided.
138
- result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
146
+ // that rows or by snapping flag, if provided.
147
+ result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapping === 'bottom');
139
148
  }
140
149
  return result;
141
150
  }
@@ -6,6 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  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); }
7
7
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
8
8
  import { innerHeight, innerWidth, getScrollLeft, getScrollTop, offset } from "../../../helpers/dom/element.mjs";
9
+ import { createObjectPropListener } from "../../../helpers/object.mjs";
9
10
  /**
10
11
  * @class Scroll
11
12
  */
@@ -36,15 +37,20 @@ class Scroll {
36
37
  * Scrolls viewport to a cell.
37
38
  *
38
39
  * @param {CellCoords} coords The cell coordinates.
39
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
40
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
41
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
42
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
40
+ * @param {'auto' | 'start' | 'end'} [horizontalSnap='auto'] If `'start'`, viewport is scrolled to show
41
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
42
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
43
+ * @param {'auto' | 'top' | 'bottom'} [verticalSnap='auto'] If `'top'`, viewport is scrolled to show
44
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
45
+ * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
43
46
  * @returns {boolean}
44
47
  */
45
- scrollViewport(coords, snapToTop, snapToRight, snapToBottom, snapToLeft) {
46
- const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, snapToRight, snapToLeft);
47
- const scrolledVertically = this.scrollViewportVertically(coords.row, snapToTop, snapToBottom);
48
+ scrollViewport(coords, horizontalSnap, verticalSnap) {
49
+ if (coords.col < 0 || coords.row < 0) {
50
+ return false;
51
+ }
52
+ const scrolledHorizontally = this.scrollViewportHorizontally(coords.col, horizontalSnap);
53
+ const scrolledVertically = this.scrollViewportVertically(coords.row, verticalSnap);
48
54
  return scrolledHorizontally || scrolledVertically;
49
55
  }
50
56
 
@@ -52,42 +58,43 @@ class Scroll {
52
58
  * Scrolls viewport to a column.
53
59
  *
54
60
  * @param {number} column Visual column index.
55
- * @param {boolean} [snapToRight] If `true`, viewport is scrolled to show the cell on the right of the table.
56
- * @param {boolean} [snapToLeft] If `true`, viewport is scrolled to show the cell on the left of the table.
61
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
62
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
63
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
57
64
  * @returns {boolean}
58
65
  */
59
- scrollViewportHorizontally(column, snapToRight, snapToLeft) {
66
+ scrollViewportHorizontally(column) {
67
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
60
68
  const {
61
69
  drawn,
62
70
  totalColumns
63
71
  } = this.dataAccessObject;
64
-
65
- // do not scroll the viewport when the column points to a range outside of the dataset
66
- if (!drawn || !Number.isInteger(column) || column < 0 || column > totalColumns) {
72
+ if (!drawn) {
73
+ return false;
74
+ }
75
+ const snappingObject = createObjectPropListener(snapping);
76
+ column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column, snappingObject);
77
+ if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
67
78
  return false;
68
79
  }
69
- const autoSnapping = snapToRight === undefined && snapToLeft === undefined;
80
+ snapping = snappingObject.value;
70
81
  const {
71
82
  fixedColumnsStart,
72
83
  inlineStartOverlay
73
84
  } = this.dataAccessObject;
85
+ const autoSnapping = snapping === 'auto';
74
86
 
75
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
76
- // when the columns points to the overlays
87
+ // for auto-snapping do not scroll the viewport when the columns points to the overlays
77
88
  if (autoSnapping && column < fixedColumnsStart) {
78
89
  return false;
79
90
  }
80
- column = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollHorizontally', column);
81
- if (!Number.isInteger(column) || column < 0 || column > totalColumns) {
82
- return false;
83
- }
84
91
  const firstColumn = this.getFirstVisibleColumn();
85
92
  const lastColumn = this.getLastVisibleColumn();
86
93
  let result = false;
87
94
  if (autoSnapping && (column < firstColumn || column > lastColumn) || !autoSnapping) {
88
95
  // if there is at least one fully visible column determine the snapping direction based on
89
- // that columns or by snapToRight/snapToLeft flags, if provided.
90
- result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapToRight);
96
+ // that columns or by snapping flag, if provided.
97
+ result = inlineStartOverlay.scrollTo(column, autoSnapping ? column >= this.getLastPartiallyVisibleColumn() : snapping === 'end');
91
98
  }
92
99
  return result;
93
100
  }
@@ -96,43 +103,45 @@ class Scroll {
96
103
  * Scrolls viewport to a row.
97
104
  *
98
105
  * @param {number} row Visual row index.
99
- * @param {boolean} [snapToTop] If `true`, viewport is scrolled to show the cell on the top of the table.
100
- * @param {boolean} [snapToBottom] If `true`, viewport is scrolled to show the cell on the bottom of the table.
106
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
107
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
108
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
109
+ * the viewport.
101
110
  * @returns {boolean}
102
111
  */
103
- scrollViewportVertically(row, snapToTop, snapToBottom) {
112
+ scrollViewportVertically(row) {
113
+ let snapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
104
114
  const {
105
115
  drawn,
106
116
  totalRows
107
117
  } = this.dataAccessObject;
108
-
109
- // do not scroll the viewport when the row points to a range outside of the dataset
110
- if (!drawn || !Number.isInteger(row) || row < 0 || row > totalRows) {
118
+ if (!drawn) {
119
+ return false;
120
+ }
121
+ const snappingObject = createObjectPropListener(snapping);
122
+ row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row, snappingObject);
123
+ if (!Number.isInteger(row) || row < 0 || row > totalRows) {
111
124
  return false;
112
125
  }
113
- const autoSnapping = snapToTop === undefined && snapToBottom === undefined;
126
+ snapping = snappingObject.value;
114
127
  const {
115
128
  fixedRowsBottom,
116
129
  fixedRowsTop,
117
130
  topOverlay
118
131
  } = this.dataAccessObject;
132
+ const autoSnapping = snapping === 'auto';
119
133
 
120
- // for auto-snapping (both snap* arguments are undefined) do not scroll the viewport
121
- // when the rows points to the overlays
134
+ // for auto-snapping do not scroll the viewport when the rows points to the overlays
122
135
  if (autoSnapping && (row < fixedRowsTop || row > totalRows - fixedRowsBottom - 1)) {
123
136
  return false;
124
137
  }
125
- row = this.dataAccessObject.wtSettings.getSetting('onBeforeViewportScrollVertically', row);
126
- if (!Number.isInteger(row) || row < 0 || row > totalRows) {
127
- return false;
128
- }
129
138
  const firstRow = this.getFirstVisibleRow();
130
139
  const lastRow = this.getLastVisibleRow();
131
140
  let result = false;
132
141
  if (autoSnapping && (row < firstRow || row > lastRow) || !autoSnapping) {
133
142
  // if there is at least one fully visible row determine the snapping direction based on
134
- // that rows or by snapToTop/snapToBottom flags, if provided.
135
- result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapToBottom);
143
+ // that rows or by snapping flag, if provided.
144
+ result = topOverlay.scrollTo(row, autoSnapping ? row >= this.getLastPartiallyVisibleRow() : snapping === 'bottom');
136
145
  }
137
146
  return result;
138
147
  }
@@ -19,6 +19,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
19
19
  * @property {Option} currentRowClassName Option `currentRowClassName`.
20
20
  * @property {Option} data Option `data`.
21
21
  * @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
22
+ * @property {Option} defaultRowHeight Option `defaultRowHeight`.
22
23
  * @property {Option} externalRowCalculator Option `externalRowCalculator`.
23
24
  * @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
24
25
  * @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
@@ -184,6 +185,7 @@ class Settings {
184
185
  rowHeightByOverlayName() {
185
186
  // return undefined means use default size for the rendered cell content
186
187
  },
188
+ defaultRowHeight: 23,
187
189
  defaultColumnWidth: 50,
188
190
  selections: null,
189
191
  hideBorderOnMouseDownOver: false,
@@ -16,6 +16,7 @@ import { objectEach } from "../../../helpers/object.mjs";
16
16
  * @property {Option} currentRowClassName Option `currentRowClassName`.
17
17
  * @property {Option} data Option `data`.
18
18
  * @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
19
+ * @property {Option} defaultRowHeight Option `defaultRowHeight`.
19
20
  * @property {Option} externalRowCalculator Option `externalRowCalculator`.
20
21
  * @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
21
22
  * @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
@@ -179,6 +180,7 @@ export default class Settings {
179
180
  rowHeightByOverlayName() {
180
181
  // return undefined means use default size for the rendered cell content
181
182
  },
183
+ defaultRowHeight: 23,
182
184
  defaultColumnWidth: 50,
183
185
  selections: null,
184
186
  hideBorderOnMouseDownOver: false,
@@ -117,8 +117,7 @@ class Table {
117
117
  TBODY: this.TBODY,
118
118
  rowUtils: this.rowUtils,
119
119
  columnUtils: this.columnUtils,
120
- cellRenderer: this.wtSettings.getSettingPure('cellRenderer'),
121
- stylesHandler: this.dataAccessObject.stylesHandler
120
+ cellRenderer: this.wtSettings.getSettingPure('cellRenderer')
122
121
  });
123
122
  }
124
123
 
@@ -354,7 +353,7 @@ class Table {
354
353
  markIfOversizedColumnHeader(col) {
355
354
  const sourceColIndex = this.columnFilter.renderedToSource(col);
356
355
  let level = this.wtSettings.getSetting('columnHeaders').length;
357
- const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
356
+ const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
358
357
  let previousColHeaderHeight;
359
358
  let currentHeader;
360
359
  let currentHeaderHeight;
@@ -632,14 +631,10 @@ class Table {
632
631
  return;
633
632
  }
634
633
  let rowCount = this.TBODY.childNodes.length;
635
- const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
634
+ const expectedTableHeight = rowCount * this.wtSettings.getSetting('defaultRowHeight');
636
635
  const actualTableHeight = (0, _element.innerHeight)(this.TBODY) - 1;
637
- const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
638
- const rowHeightFn = borderBoxSizing ? _element.outerHeight : _element.innerHeight;
639
- const borderCompensation = borderBoxSizing ? 0 : 1;
640
- const firstRowBorderCompensation = borderBoxSizing ? 1 : 0;
641
636
  let previousRowHeight;
642
- let rowCurrentHeight;
637
+ let rowInnerHeight;
643
638
  let sourceRowIndex;
644
639
  let currentTr;
645
640
  let rowHeader;
@@ -653,17 +648,14 @@ class Table {
653
648
  previousRowHeight = this.getRowHeight(sourceRowIndex);
654
649
  currentTr = this.getTrForRow(sourceRowIndex);
655
650
  rowHeader = currentTr.querySelector('th');
656
- const topBorderCompensation = sourceRowIndex === 0 ? firstRowBorderCompensation : 0;
657
651
  if (rowHeader) {
658
- rowCurrentHeight = rowHeightFn(rowHeader);
652
+ rowInnerHeight = (0, _element.innerHeight)(rowHeader);
659
653
  } else {
660
- rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
654
+ rowInnerHeight = (0, _element.innerHeight)(currentTr) - 1;
661
655
  }
662
- if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight - topBorderCompensation || previousRowHeight < rowCurrentHeight) {
663
- if (!borderBoxSizing) {
664
- rowCurrentHeight += 1;
665
- }
666
- this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
656
+ if (!previousRowHeight && this.wtSettings.getSetting('defaultRowHeight') < rowInnerHeight || previousRowHeight < rowInnerHeight) {
657
+ rowInnerHeight += 1;
658
+ this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight;
667
659
  }
668
660
  }
669
661
  }
@@ -113,8 +113,7 @@ class Table {
113
113
  TBODY: this.TBODY,
114
114
  rowUtils: this.rowUtils,
115
115
  columnUtils: this.columnUtils,
116
- cellRenderer: this.wtSettings.getSettingPure('cellRenderer'),
117
- stylesHandler: this.dataAccessObject.stylesHandler
116
+ cellRenderer: this.wtSettings.getSettingPure('cellRenderer')
118
117
  });
119
118
  }
120
119
 
@@ -350,7 +349,7 @@ class Table {
350
349
  markIfOversizedColumnHeader(col) {
351
350
  const sourceColIndex = this.columnFilter.renderedToSource(col);
352
351
  let level = this.wtSettings.getSetting('columnHeaders').length;
353
- const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
352
+ const defaultRowHeight = this.wtSettings.getSetting('defaultRowHeight');
354
353
  let previousColHeaderHeight;
355
354
  let currentHeader;
356
355
  let currentHeaderHeight;
@@ -628,14 +627,10 @@ class Table {
628
627
  return;
629
628
  }
630
629
  let rowCount = this.TBODY.childNodes.length;
631
- const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
630
+ const expectedTableHeight = rowCount * this.wtSettings.getSetting('defaultRowHeight');
632
631
  const actualTableHeight = innerHeight(this.TBODY) - 1;
633
- const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
634
- const rowHeightFn = borderBoxSizing ? outerHeight : innerHeight;
635
- const borderCompensation = borderBoxSizing ? 0 : 1;
636
- const firstRowBorderCompensation = borderBoxSizing ? 1 : 0;
637
632
  let previousRowHeight;
638
- let rowCurrentHeight;
633
+ let rowInnerHeight;
639
634
  let sourceRowIndex;
640
635
  let currentTr;
641
636
  let rowHeader;
@@ -649,17 +644,14 @@ class Table {
649
644
  previousRowHeight = this.getRowHeight(sourceRowIndex);
650
645
  currentTr = this.getTrForRow(sourceRowIndex);
651
646
  rowHeader = currentTr.querySelector('th');
652
- const topBorderCompensation = sourceRowIndex === 0 ? firstRowBorderCompensation : 0;
653
647
  if (rowHeader) {
654
- rowCurrentHeight = rowHeightFn(rowHeader);
648
+ rowInnerHeight = innerHeight(rowHeader);
655
649
  } else {
656
- rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
650
+ rowInnerHeight = innerHeight(currentTr) - 1;
657
651
  }
658
- if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight - topBorderCompensation || previousRowHeight < rowCurrentHeight) {
659
- if (!borderBoxSizing) {
660
- rowCurrentHeight += 1;
661
- }
662
- this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
652
+ if (!previousRowHeight && this.wtSettings.getSetting('defaultRowHeight') < rowInnerHeight || previousRowHeight < rowInnerHeight) {
653
+ rowInnerHeight += 1;
654
+ this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowInnerHeight;
663
655
  }
664
656
  }
665
657
  }
@@ -66,7 +66,6 @@
66
66
  * @property {Walkontable} cloneSource CloneSource.
67
67
  * @property {Walkontable} wot Wot.
68
68
  * @property {number} parentTableOffset ParentTableOffset.
69
- * @property {StylesHandler} stylesHandler StylesHandler.
70
69
  * @property {number|null} startColumnRendered StartColumnRendered.
71
70
  * @property {number|null} startColumnVisible StartColumnVisible.
72
71
  * @property {number|null} endColumnRendered EndColumnRendered.
@@ -66,7 +66,6 @@
66
66
  * @property {Walkontable} cloneSource CloneSource.
67
67
  * @property {Walkontable} wot Wot.
68
68
  * @property {number} parentTableOffset ParentTableOffset.
69
- * @property {StylesHandler} stylesHandler StylesHandler.
70
69
  * @property {number|null} startColumnRendered StartColumnRendered.
71
70
  * @property {number|null} startColumnVisible StartColumnVisible.
72
71
  * @property {number|null} endColumnRendered EndColumnRendered.
@@ -50,7 +50,7 @@ class ColumnUtils {
50
50
  * @returns {number}
51
51
  */
52
52
  getHeaderHeight(level) {
53
- let height = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
53
+ let height = this.wtSettings.getSetting('defaultRowHeight');
54
54
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
55
55
  if (oversizedHeight !== undefined) {
56
56
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -47,7 +47,7 @@ export default class ColumnUtils {
47
47
  * @returns {number}
48
48
  */
49
49
  getHeaderHeight(level) {
50
- let height = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
50
+ let height = this.wtSettings.getSetting('defaultRowHeight');
51
51
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
52
52
  if (oversizedHeight !== undefined) {
53
53
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -264,7 +264,6 @@ class Viewport {
264
264
  viewportHeight: height,
265
265
  scrollOffset: pos,
266
266
  totalRows: wtSettings.getSetting('totalRows'),
267
- defaultRowHeight: this.instance.stylesHandler.getDefaultRowHeight(),
268
267
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
269
268
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
270
269
  horizontalScrollbarHeight: scrollbarHeight
@@ -261,7 +261,6 @@ class Viewport {
261
261
  viewportHeight: height,
262
262
  scrollOffset: pos,
263
263
  totalRows: wtSettings.getSetting('totalRows'),
264
- defaultRowHeight: this.instance.stylesHandler.getDefaultRowHeight(),
265
264
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
266
265
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
267
266
  horizontalScrollbarHeight: scrollbarHeight
package/base.js CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
45
45
  Handsontable.CellCoords = _src.CellCoords;
46
46
  Handsontable.CellRange = _src.CellRange;
47
47
  Handsontable.packageName = 'handsontable';
48
- Handsontable.buildDate = "25/11/2024 07:07:59";
49
- Handsontable.version = "0.0.0-next-fd9f817-20241125";
48
+ Handsontable.buildDate = "26/11/2024 09:17:14";
49
+ Handsontable.version = "0.0.0-next-fcb9b77-20241126";
50
50
  Handsontable.languages = {
51
51
  dictionaryKeys: _registry.dictionaryKeys,
52
52
  getLanguageDictionary: _registry.getLanguageDictionary,
package/base.mjs CHANGED
@@ -35,8 +35,8 @@ Handsontable.hooks = Hooks.getSingleton();
35
35
  Handsontable.CellCoords = CellCoords;
36
36
  Handsontable.CellRange = CellRange;
37
37
  Handsontable.packageName = 'handsontable';
38
- Handsontable.buildDate = "25/11/2024 07:08:05";
39
- Handsontable.version = "0.0.0-next-fd9f817-20241125";
38
+ Handsontable.buildDate = "26/11/2024 09:17:20";
39
+ Handsontable.version = "0.0.0-next-fcb9b77-20241126";
40
40
  Handsontable.languages = {
41
41
  dictionaryKeys,
42
42
  getLanguageDictionary,
@@ -543,6 +543,10 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
543
543
  * @since 14.0.0
544
544
  * @event Hooks#beforeViewportScrollVertically
545
545
  * @param {number} visualRow Visual row index.
546
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
547
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
548
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
549
+ * the viewport.
546
550
  * @returns {number | boolean} Returns modified row index (or the same as passed in the method argument) to which
547
551
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
548
552
  */
@@ -554,6 +558,9 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
554
558
  * @since 14.0.0
555
559
  * @event Hooks#beforeViewportScrollHorizontally
556
560
  * @param {number} visualColumn Visual column index.
561
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
562
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
563
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
557
564
  * @returns {number | boolean} Returns modified column index (or the same as passed in the method argument) to which
558
565
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
559
566
  */
@@ -865,15 +872,6 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
865
872
  * @param {string} [source] String that identifies source of hook call.
866
873
  */
867
874
  'afterSetSourceDataAtCell',
868
- /**
869
- * Fired after a theme is enabled, changed, or disabled.
870
- *
871
- * @since 15.0.0
872
- * @event Hooks#afterSetTheme
873
- * @param {string|boolean|undefined} themeName The theme name.
874
- * @param {boolean} firstRun `true` if it's the initial setting of the theme, `false` otherwise.
875
- */
876
- 'afterSetTheme',
877
875
  /**
878
876
  * Fired after calling the [`updateSettings`](@/api/core.md#updatesettings) method.
879
877
  *
@@ -540,6 +540,10 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
540
540
  * @since 14.0.0
541
541
  * @event Hooks#beforeViewportScrollVertically
542
542
  * @param {number} visualRow Visual row index.
543
+ * @param {'auto' | 'top' | 'bottom'} [snapping='auto'] If `'top'`, viewport is scrolled to show
544
+ * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
545
+ * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
546
+ * the viewport.
543
547
  * @returns {number | boolean} Returns modified row index (or the same as passed in the method argument) to which
544
548
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
545
549
  */
@@ -551,6 +555,9 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
551
555
  * @since 14.0.0
552
556
  * @event Hooks#beforeViewportScrollHorizontally
553
557
  * @param {number} visualColumn Visual column index.
558
+ * @param {'auto' | 'start' | 'end'} [snapping='auto'] If `'start'`, viewport is scrolled to show
559
+ * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
560
+ * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
554
561
  * @returns {number | boolean} Returns modified column index (or the same as passed in the method argument) to which
555
562
  * the viewport will be scrolled. If the returned value is `false`, the scrolling will be canceled.
556
563
  */
@@ -862,15 +869,6 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
862
869
  * @param {string} [source] String that identifies source of hook call.
863
870
  */
864
871
  'afterSetSourceDataAtCell',
865
- /**
866
- * Fired after a theme is enabled, changed, or disabled.
867
- *
868
- * @since 15.0.0
869
- * @event Hooks#afterSetTheme
870
- * @param {string|boolean|undefined} themeName The theme name.
871
- * @param {boolean} firstRun `true` if it's the initial setting of the theme, `false` otherwise.
872
- */
873
- 'afterSetTheme',
874
872
  /**
875
873
  * Fired after calling the [`updateSettings`](@/api/core.md#updatesettings) method.
876
874
  *