handsontable 0.0.0-next-3e0b40d-20241017 → 0.0.0-next-802f59c-20241024

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 (116) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -5
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +2 -5
  3. package/3rdparty/walkontable/src/core/clone.js +0 -1
  4. package/3rdparty/walkontable/src/core/clone.mjs +0 -1
  5. package/3rdparty/walkontable/src/core/core.js +0 -2
  6. package/3rdparty/walkontable/src/core/core.mjs +0 -2
  7. package/3rdparty/walkontable/src/overlay/_base.js +1 -3
  8. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
  9. package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
  10. package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
  11. package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -1
  12. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
  13. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  14. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  15. package/3rdparty/walkontable/src/overlays.js +7 -6
  16. package/3rdparty/walkontable/src/overlays.mjs +7 -6
  17. package/3rdparty/walkontable/src/renderer/colGroup.js +1 -1
  18. package/3rdparty/walkontable/src/renderer/colGroup.mjs +1 -1
  19. package/3rdparty/walkontable/src/renderer/table.js +1 -1
  20. package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
  21. package/3rdparty/walkontable/src/settings.js +2 -7
  22. package/3rdparty/walkontable/src/settings.mjs +2 -7
  23. package/3rdparty/walkontable/src/table.js +8 -35
  24. package/3rdparty/walkontable/src/table.mjs +8 -35
  25. package/3rdparty/walkontable/src/utils/column.js +1 -43
  26. package/3rdparty/walkontable/src/utils/column.mjs +1 -43
  27. package/3rdparty/walkontable/src/viewport.js +66 -88
  28. package/3rdparty/walkontable/src/viewport.mjs +67 -89
  29. package/CHANGELOG.md +5 -0
  30. package/base.js +2 -2
  31. package/base.mjs +2 -2
  32. package/core/hooks/constants.js +2 -0
  33. package/core/hooks/constants.mjs +2 -0
  34. package/core/hooks/index.d.ts +2 -2
  35. package/core.d.ts +2 -2
  36. package/core.js +6 -15
  37. package/core.mjs +6 -15
  38. package/dataMap/metaManager/metaSchema.js +0 -17
  39. package/dataMap/metaManager/metaSchema.mjs +0 -17
  40. package/dist/handsontable.css +5 -236
  41. package/dist/handsontable.full.css +3 -3
  42. package/dist/handsontable.full.js +4539 -4231
  43. package/dist/handsontable.full.min.css +3 -4
  44. package/dist/handsontable.full.min.js +26 -26
  45. package/dist/handsontable.js +4230 -3928
  46. package/dist/handsontable.min.css +4 -9
  47. package/dist/handsontable.min.js +24 -24
  48. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  49. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  50. package/editors/baseEditor/baseEditor.js +1 -1
  51. package/editors/baseEditor/baseEditor.mjs +1 -1
  52. package/editors/dateEditor/dateEditor.js +0 -2
  53. package/editors/dateEditor/dateEditor.mjs +0 -2
  54. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  55. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  56. package/editors/passwordEditor/passwordEditor.js +0 -4
  57. package/editors/passwordEditor/passwordEditor.mjs +1 -5
  58. package/editors/selectEditor/selectEditor.js +9 -20
  59. package/editors/selectEditor/selectEditor.mjs +9 -20
  60. package/editors/textEditor/textEditor.js +11 -7
  61. package/editors/textEditor/textEditor.mjs +12 -8
  62. package/helpers/mixed.js +3 -3
  63. package/helpers/mixed.mjs +3 -3
  64. package/index.d.ts +7 -0
  65. package/package.json +8 -10
  66. package/plugins/comments/commentEditor.js +1 -8
  67. package/plugins/comments/commentEditor.mjs +1 -8
  68. package/plugins/comments/comments.js +2 -2
  69. package/plugins/comments/comments.mjs +2 -2
  70. package/plugins/contextMenu/menu/menu.js +4 -4
  71. package/plugins/contextMenu/menu/menu.mjs +4 -4
  72. package/plugins/index.d.ts +3 -0
  73. package/plugins/index.js +3 -0
  74. package/plugins/index.mjs +3 -1
  75. package/plugins/manualColumnMove/manualColumnMove.js +1 -3
  76. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -3
  77. package/plugins/manualColumnResize/manualColumnResize.js +24 -12
  78. package/plugins/manualColumnResize/manualColumnResize.mjs +24 -12
  79. package/plugins/manualRowMove/manualRowMove.js +1 -1
  80. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  81. package/plugins/mergeCells/mergeCells.js +1 -1
  82. package/plugins/mergeCells/mergeCells.mjs +1 -1
  83. package/plugins/nestedRows/ui/headers.js +1 -3
  84. package/plugins/nestedRows/ui/headers.mjs +1 -3
  85. package/plugins/stretchColumns/calculator.js +159 -0
  86. package/plugins/stretchColumns/calculator.mjs +155 -0
  87. package/plugins/stretchColumns/index.d.ts +1 -0
  88. package/plugins/stretchColumns/index.js +7 -0
  89. package/plugins/stretchColumns/index.mjs +1 -0
  90. package/plugins/stretchColumns/strategies/_base.js +85 -0
  91. package/plugins/stretchColumns/strategies/_base.mjs +81 -0
  92. package/plugins/stretchColumns/strategies/all.js +68 -0
  93. package/plugins/stretchColumns/strategies/all.mjs +64 -0
  94. package/plugins/stretchColumns/strategies/last.js +77 -0
  95. package/plugins/stretchColumns/strategies/last.mjs +73 -0
  96. package/plugins/stretchColumns/stretchColumns.d.ts +11 -0
  97. package/plugins/stretchColumns/stretchColumns.js +211 -0
  98. package/plugins/stretchColumns/stretchColumns.mjs +207 -0
  99. package/tableView.js +39 -39
  100. package/tableView.mjs +39 -39
  101. package/utils/autoResize.js +1 -4
  102. package/utils/autoResize.mjs +1 -4
  103. package/utils/ghostTable.js +1 -1
  104. package/utils/ghostTable.mjs +1 -1
  105. package/3rdparty/walkontable/src/utils/columnStretching.js +0 -197
  106. package/3rdparty/walkontable/src/utils/columnStretching.mjs +0 -193
  107. package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -185
  108. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -181
  109. package/helpers/themes.js +0 -17
  110. package/helpers/themes.mjs +0 -13
  111. package/styles/handsontable.css +0 -1920
  112. package/styles/handsontable.min.css +0 -30
  113. package/styles/ht-theme-gemini.css +0 -690
  114. package/styles/ht-theme-gemini.min.css +0 -30
  115. package/styles/ht-theme-main.css +0 -712
  116. package/styles/ht-theme-main.min.css +0 -30
@@ -2,8 +2,6 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
- var _element = require("./../../../../helpers/dom/element");
6
- var _columnStretching = require("./columnStretching");
7
5
  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; }
8
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
9
7
  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); }
@@ -30,18 +28,8 @@ class ColumnUtils {
30
28
  * @type {Map<number, number>}
31
29
  */
32
30
  _defineProperty(this, "headerWidths", new Map());
33
- /**
34
- * @type {ColumnStretching}
35
- */
36
- _defineProperty(this, "stretching", void 0);
37
31
  this.dataAccessObject = dataAccessObject;
38
32
  this.wtSettings = wtSettings;
39
- this.stretching = new _columnStretching.ColumnStretching({
40
- totalColumns: () => this.wtSettings.getSetting('totalColumns'),
41
- stretchMode: () => this.wtSettings.getSetting('stretchH'),
42
- stretchingColumnWidthFn: (stretchedWidth, column) => this.wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column),
43
- columnWidthFn: sourceCol => this.dataAccessObject.wtTable.getColumnWidth(sourceCol)
44
- });
45
33
  }
46
34
 
47
35
  /**
@@ -55,21 +43,6 @@ class ColumnUtils {
55
43
  return width;
56
44
  }
57
45
 
58
- /**
59
- * Returns stretched column width based on passed source index.
60
- *
61
- * @param {number} sourceIndex Column source index.
62
- * @returns {number}
63
- */
64
- getStretchedColumnWidth(sourceIndex) {
65
- let width = this.getWidth(sourceIndex);
66
- const stretchedWidth = this.stretching.getStretchedColumnWidth(sourceIndex, width);
67
- if (stretchedWidth) {
68
- width = stretchedWidth;
69
- }
70
- return width;
71
- }
72
-
73
46
  /**
74
47
  * Returns column header height based on passed header level.
75
48
  *
@@ -77,7 +50,7 @@ class ColumnUtils {
77
50
  * @returns {number}
78
51
  */
79
52
  getHeaderHeight(level) {
80
- let height = this.dataAccessObject.wot.stylesHandler.getDefaultRowHeight();
53
+ let height = this.wtSettings.getSetting('defaultRowHeight');
81
54
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
82
55
  if (oversizedHeight !== undefined) {
83
56
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -95,20 +68,6 @@ class ColumnUtils {
95
68
  return this.headerWidths.get(this.dataAccessObject.wtTable.columnFilter.sourceToRendered(sourceIndex));
96
69
  }
97
70
 
98
- /**
99
- * Refreshes the stretching column width by recalculating the widths of the columns.
100
- */
101
- refreshStretching() {
102
- const {
103
- wtTable,
104
- wtViewport,
105
- cloneSource
106
- } = this.dataAccessObject;
107
- const mainHolder = cloneSource ? cloneSource.wtTable.holder : wtTable.holder;
108
- const scrollbarCompensation = mainHolder.offsetHeight < mainHolder.scrollHeight ? (0, _element.getScrollbarWidth)() : 0;
109
- this.stretching.refreshStretching(wtViewport.getViewportWidth() - scrollbarCompensation);
110
- }
111
-
112
71
  /**
113
72
  * Calculates column header widths that can be retrieved from the cache.
114
73
  */
@@ -117,7 +76,6 @@ class ColumnUtils {
117
76
  wtSettings
118
77
  } = this;
119
78
  let rowHeaderWidthSetting = wtSettings.getSetting('rowHeaderWidth');
120
- this.refreshStretching();
121
79
  rowHeaderWidthSetting = wtSettings.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting);
122
80
  if (rowHeaderWidthSetting !== null && rowHeaderWidthSetting !== undefined) {
123
81
  const rowHeadersCount = wtSettings.getSetting('rowHeaders').length;
@@ -2,8 +2,6 @@ import "core-js/modules/es.error.cause.js";
2
2
  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; }
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
4
  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); }
5
- import { getScrollbarWidth } from "./../../../../helpers/dom/element.mjs";
6
- import { ColumnStretching } from "./columnStretching.mjs";
7
5
  /**
8
6
  * Column utils class contains all necessary information about sizes of the columns.
9
7
  *
@@ -27,18 +25,8 @@ export default class ColumnUtils {
27
25
  * @type {Map<number, number>}
28
26
  */
29
27
  _defineProperty(this, "headerWidths", new Map());
30
- /**
31
- * @type {ColumnStretching}
32
- */
33
- _defineProperty(this, "stretching", void 0);
34
28
  this.dataAccessObject = dataAccessObject;
35
29
  this.wtSettings = wtSettings;
36
- this.stretching = new ColumnStretching({
37
- totalColumns: () => this.wtSettings.getSetting('totalColumns'),
38
- stretchMode: () => this.wtSettings.getSetting('stretchH'),
39
- stretchingColumnWidthFn: (stretchedWidth, column) => this.wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column),
40
- columnWidthFn: sourceCol => this.dataAccessObject.wtTable.getColumnWidth(sourceCol)
41
- });
42
30
  }
43
31
 
44
32
  /**
@@ -52,21 +40,6 @@ export default class ColumnUtils {
52
40
  return width;
53
41
  }
54
42
 
55
- /**
56
- * Returns stretched column width based on passed source index.
57
- *
58
- * @param {number} sourceIndex Column source index.
59
- * @returns {number}
60
- */
61
- getStretchedColumnWidth(sourceIndex) {
62
- let width = this.getWidth(sourceIndex);
63
- const stretchedWidth = this.stretching.getStretchedColumnWidth(sourceIndex, width);
64
- if (stretchedWidth) {
65
- width = stretchedWidth;
66
- }
67
- return width;
68
- }
69
-
70
43
  /**
71
44
  * Returns column header height based on passed header level.
72
45
  *
@@ -74,7 +47,7 @@ export default class ColumnUtils {
74
47
  * @returns {number}
75
48
  */
76
49
  getHeaderHeight(level) {
77
- let height = this.dataAccessObject.wot.stylesHandler.getDefaultRowHeight();
50
+ let height = this.wtSettings.getSetting('defaultRowHeight');
78
51
  const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
79
52
  if (oversizedHeight !== undefined) {
80
53
  height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
@@ -92,20 +65,6 @@ export default class ColumnUtils {
92
65
  return this.headerWidths.get(this.dataAccessObject.wtTable.columnFilter.sourceToRendered(sourceIndex));
93
66
  }
94
67
 
95
- /**
96
- * Refreshes the stretching column width by recalculating the widths of the columns.
97
- */
98
- refreshStretching() {
99
- const {
100
- wtTable,
101
- wtViewport,
102
- cloneSource
103
- } = this.dataAccessObject;
104
- const mainHolder = cloneSource ? cloneSource.wtTable.holder : wtTable.holder;
105
- const scrollbarCompensation = mainHolder.offsetHeight < mainHolder.scrollHeight ? getScrollbarWidth() : 0;
106
- this.stretching.refreshStretching(wtViewport.getViewportWidth() - scrollbarCompensation);
107
- }
108
-
109
68
  /**
110
69
  * Calculates column header widths that can be retrieved from the cache.
111
70
  */
@@ -114,7 +73,6 @@ export default class ColumnUtils {
114
73
  wtSettings
115
74
  } = this;
116
75
  let rowHeaderWidthSetting = wtSettings.getSetting('rowHeaderWidth');
117
- this.refreshStretching();
118
76
  rowHeaderWidthSetting = wtSettings.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting);
119
77
  if (rowHeaderWidthSetting !== null && rowHeaderWidthSetting !== undefined) {
120
78
  const rowHeadersCount = wtSettings.getSetting('rowHeaders').length;
@@ -27,7 +27,6 @@ class Viewport {
27
27
  this.oversizedColumnHeaders = [];
28
28
  this.hasOversizedColumnHeadersMarked = {};
29
29
  this.clientHeight = 0;
30
- this.containerWidth = NaN;
31
30
  this.rowHeaderWidth = NaN;
32
31
  this.rowsVisibleCalculator = null;
33
32
  this.columnsVisibleCalculator = null;
@@ -56,55 +55,65 @@ class Viewport {
56
55
  }
57
56
  return height;
58
57
  }
58
+
59
+ /**
60
+ * @returns {number}
61
+ */
62
+ getViewportHeight() {
63
+ let containerHeight = this.getWorkspaceHeight();
64
+ if (containerHeight === Infinity) {
65
+ return containerHeight;
66
+ }
67
+ const columnHeaderHeight = this.getColumnHeaderHeight();
68
+ if (columnHeaderHeight > 0) {
69
+ containerHeight -= columnHeaderHeight;
70
+ }
71
+ return containerHeight;
72
+ }
73
+
74
+ /**
75
+ * Gets the width of the table workspace (in pixels). The workspace size in the current
76
+ * implementation returns the width of the table holder element including scrollbar width when
77
+ * the table has defined size and the width of the window excluding scrollbar width when
78
+ * the table has no defined size (the window is a scrollable container).
79
+ *
80
+ * This is a bug, as the method should always return stable values, always without scrollbar width.
81
+ * Changing this behavior would break the column calculators, which would also need to be adjusted.
82
+ *
83
+ * @returns {number}
84
+ */
59
85
  getWorkspaceWidth() {
60
- const {
61
- wtSettings
62
- } = this;
63
86
  const {
64
87
  rootDocument,
65
88
  rootWindow
66
89
  } = this.domBindings;
67
90
  const trimmingContainer = this.dataAccessObject.inlineStartOverlayTrimmingContainer;
68
- const docOffsetWidth = rootDocument.documentElement.offsetWidth;
69
- const totalColumns = wtSettings.getSetting('totalColumns');
70
- const preventOverflow = wtSettings.getSetting('preventOverflow');
71
- const isRtl = wtSettings.getSetting('rtlMode');
72
- const tableRect = this.wtTable.TABLE.getBoundingClientRect();
73
- const inlineStart = isRtl ? tableRect.right - docOffsetWidth : tableRect.left;
74
- const tableOffset = docOffsetWidth - inlineStart;
75
91
  let width;
76
- let overflow;
77
- if (preventOverflow) {
78
- return (0, _element.outerWidth)(this.wtTable.wtRootElement);
79
- }
80
- if (wtSettings.getSetting('freezeOverlays')) {
81
- width = Math.min(tableOffset, docOffsetWidth);
92
+ if (trimmingContainer === rootWindow) {
93
+ const totalColumns = this.wtSettings.getSetting('totalColumns');
94
+ width = this.wtTable.holder.offsetWidth;
95
+ if (this.getRowHeaderWidth() + this.sumColumnWidths(0, totalColumns) > width) {
96
+ width = rootDocument.documentElement.clientWidth;
97
+ }
82
98
  } else {
83
- width = Math.min(this.getContainerFillWidth(), tableOffset, docOffsetWidth);
99
+ width = trimmingContainer.clientWidth;
84
100
  }
85
- if (trimmingContainer === rootWindow && totalColumns > 0 && this.sumColumnWidths(0, totalColumns - 1) > width) {
86
- // in case sum of column widths is higher than available stylesheet width, let's assume using the whole window
87
- // otherwise continue below, which will allow stretching
88
- // this is used in `scroll_window.html`
89
- // TODO test me
90
- return rootDocument.documentElement.clientWidth;
91
- }
92
- if (trimmingContainer !== rootWindow) {
93
- overflow = (0, _element.getStyle)(this.dataAccessObject.inlineStartOverlayTrimmingContainer, 'overflow', rootWindow);
94
- if (overflow === 'scroll' || overflow === 'hidden' || overflow === 'auto') {
95
- // this is used in `scroll.html`
96
- // TODO test me
97
- return Math.max(width, trimmingContainer.clientWidth);
98
- }
101
+ return width;
102
+ }
103
+
104
+ /**
105
+ * @returns {number}
106
+ */
107
+ getViewportWidth() {
108
+ const containerWidth = this.getWorkspaceWidth();
109
+ if (containerWidth === Infinity) {
110
+ return containerWidth;
99
111
  }
100
- const stretchSetting = wtSettings.getSetting('stretchH');
101
- if (stretchSetting === 'none' || !stretchSetting) {
102
- // if no stretching is used, return the maximum used workspace width
103
- return Math.max(width, (0, _element.outerWidth)(this.wtTable.TABLE));
112
+ const rowHeaderWidth = this.getRowHeaderWidth();
113
+ if (rowHeaderWidth > 0) {
114
+ return containerWidth - rowHeaderWidth;
104
115
  }
105
-
106
- // if stretching is used, return the actual container width, so the columns can fit inside it
107
- return width;
116
+ return containerWidth;
108
117
  }
109
118
 
110
119
  /**
@@ -125,6 +134,24 @@ class Viewport {
125
134
  return this.wtTable.hider.offsetWidth > this.getWorkspaceWidth();
126
135
  }
127
136
 
137
+ /**
138
+ * Checks if the table uses the window as a viewport and if there is a vertical scrollbar.
139
+ *
140
+ * @returns {boolean}
141
+ */
142
+ isVerticallyScrollableByWindow() {
143
+ return this.dataAccessObject.topOverlayTrimmingContainer === this.domBindings.rootWindow;
144
+ }
145
+
146
+ /**
147
+ * Checks if the table uses the window as a viewport and if there is a horizontal scrollbar.
148
+ *
149
+ * @returns {boolean}
150
+ */
151
+ isHorizontallyScrollableByWindow() {
152
+ return this.dataAccessObject.inlineStartOverlayTrimmingContainer === this.domBindings.rootWindow;
153
+ }
154
+
128
155
  /**
129
156
  * @param {number} from The visual column index from the width sum is start calculated.
130
157
  * @param {number} length The length of the column to traverse.
@@ -140,24 +167,6 @@ class Viewport {
140
167
  return sum;
141
168
  }
142
169
 
143
- /**
144
- * @returns {number}
145
- */
146
- getContainerFillWidth() {
147
- if (this.containerWidth) {
148
- return this.containerWidth;
149
- }
150
- const mainContainer = this.wtTable.holder;
151
- const dummyElement = this.domBindings.rootDocument.createElement('div');
152
- dummyElement.style.width = '100%';
153
- dummyElement.style.height = '1px';
154
- mainContainer.appendChild(dummyElement);
155
- const fillWidth = dummyElement.offsetWidth;
156
- this.containerWidth = fillWidth;
157
- mainContainer.removeChild(dummyElement);
158
- return fillWidth;
159
- }
160
-
161
170
  /**
162
171
  * @returns {number}
163
172
  */
@@ -178,21 +187,6 @@ class Viewport {
178
187
  return this.columnHeaderHeight;
179
188
  }
180
189
 
181
- /**
182
- * @returns {number}
183
- */
184
- getViewportHeight() {
185
- let containerHeight = this.getWorkspaceHeight();
186
- if (containerHeight === Infinity) {
187
- return containerHeight;
188
- }
189
- const columnHeaderHeight = this.getColumnHeaderHeight();
190
- if (columnHeaderHeight > 0) {
191
- containerHeight -= columnHeaderHeight;
192
- }
193
- return containerHeight;
194
- }
195
-
196
190
  /**
197
191
  * @returns {number}
198
192
  */
@@ -227,21 +221,6 @@ class Viewport {
227
221
  return this.rowHeaderWidth;
228
222
  }
229
223
 
230
- /**
231
- * @returns {number}
232
- */
233
- getViewportWidth() {
234
- const containerWidth = this.getWorkspaceWidth();
235
- if (containerWidth === Infinity) {
236
- return containerWidth;
237
- }
238
- const rowHeaderWidth = this.getRowHeaderWidth();
239
- if (rowHeaderWidth > 0) {
240
- return containerWidth - rowHeaderWidth;
241
- }
242
- return containerWidth;
243
- }
244
-
245
224
  /**
246
225
  * Creates rows calculators. The type of the calculations can be chosen from the list:
247
226
  * - 'rendered' Calculates rows that should be rendered within the current table's viewport;
@@ -284,7 +263,6 @@ class Viewport {
284
263
  viewportHeight: height,
285
264
  scrollOffset: pos,
286
265
  totalRows: wtSettings.getSetting('totalRows'),
287
- defaultRowHeight: this.wot.stylesHandler.getDefaultRowHeight(),
288
266
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
289
267
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
290
268
  horizontalScrollbarHeight: scrollbarHeight
@@ -1,4 +1,4 @@
1
- import { getScrollbarWidth, getStyle, offset, outerHeight, outerWidth } from "../../../helpers/dom/element.mjs";
1
+ import { getScrollbarWidth, offset, outerHeight, outerWidth } from "../../../helpers/dom/element.mjs";
2
2
  import { objectEach } from "../../../helpers/object.mjs";
3
3
  import { FullyVisibleColumnsCalculationType, FullyVisibleRowsCalculationType, PartiallyVisibleColumnsCalculationType, PartiallyVisibleRowsCalculationType, RenderedAllColumnsCalculationType, RenderedAllRowsCalculationType, RenderedColumnsCalculationType, RenderedRowsCalculationType, ViewportColumnsCalculator, ViewportRowsCalculator } from "./calculator/index.mjs";
4
4
  /**
@@ -24,7 +24,6 @@ class Viewport {
24
24
  this.oversizedColumnHeaders = [];
25
25
  this.hasOversizedColumnHeadersMarked = {};
26
26
  this.clientHeight = 0;
27
- this.containerWidth = NaN;
28
27
  this.rowHeaderWidth = NaN;
29
28
  this.rowsVisibleCalculator = null;
30
29
  this.columnsVisibleCalculator = null;
@@ -53,55 +52,65 @@ class Viewport {
53
52
  }
54
53
  return height;
55
54
  }
55
+
56
+ /**
57
+ * @returns {number}
58
+ */
59
+ getViewportHeight() {
60
+ let containerHeight = this.getWorkspaceHeight();
61
+ if (containerHeight === Infinity) {
62
+ return containerHeight;
63
+ }
64
+ const columnHeaderHeight = this.getColumnHeaderHeight();
65
+ if (columnHeaderHeight > 0) {
66
+ containerHeight -= columnHeaderHeight;
67
+ }
68
+ return containerHeight;
69
+ }
70
+
71
+ /**
72
+ * Gets the width of the table workspace (in pixels). The workspace size in the current
73
+ * implementation returns the width of the table holder element including scrollbar width when
74
+ * the table has defined size and the width of the window excluding scrollbar width when
75
+ * the table has no defined size (the window is a scrollable container).
76
+ *
77
+ * This is a bug, as the method should always return stable values, always without scrollbar width.
78
+ * Changing this behavior would break the column calculators, which would also need to be adjusted.
79
+ *
80
+ * @returns {number}
81
+ */
56
82
  getWorkspaceWidth() {
57
- const {
58
- wtSettings
59
- } = this;
60
83
  const {
61
84
  rootDocument,
62
85
  rootWindow
63
86
  } = this.domBindings;
64
87
  const trimmingContainer = this.dataAccessObject.inlineStartOverlayTrimmingContainer;
65
- const docOffsetWidth = rootDocument.documentElement.offsetWidth;
66
- const totalColumns = wtSettings.getSetting('totalColumns');
67
- const preventOverflow = wtSettings.getSetting('preventOverflow');
68
- const isRtl = wtSettings.getSetting('rtlMode');
69
- const tableRect = this.wtTable.TABLE.getBoundingClientRect();
70
- const inlineStart = isRtl ? tableRect.right - docOffsetWidth : tableRect.left;
71
- const tableOffset = docOffsetWidth - inlineStart;
72
88
  let width;
73
- let overflow;
74
- if (preventOverflow) {
75
- return outerWidth(this.wtTable.wtRootElement);
76
- }
77
- if (wtSettings.getSetting('freezeOverlays')) {
78
- width = Math.min(tableOffset, docOffsetWidth);
89
+ if (trimmingContainer === rootWindow) {
90
+ const totalColumns = this.wtSettings.getSetting('totalColumns');
91
+ width = this.wtTable.holder.offsetWidth;
92
+ if (this.getRowHeaderWidth() + this.sumColumnWidths(0, totalColumns) > width) {
93
+ width = rootDocument.documentElement.clientWidth;
94
+ }
79
95
  } else {
80
- width = Math.min(this.getContainerFillWidth(), tableOffset, docOffsetWidth);
96
+ width = trimmingContainer.clientWidth;
81
97
  }
82
- if (trimmingContainer === rootWindow && totalColumns > 0 && this.sumColumnWidths(0, totalColumns - 1) > width) {
83
- // in case sum of column widths is higher than available stylesheet width, let's assume using the whole window
84
- // otherwise continue below, which will allow stretching
85
- // this is used in `scroll_window.html`
86
- // TODO test me
87
- return rootDocument.documentElement.clientWidth;
88
- }
89
- if (trimmingContainer !== rootWindow) {
90
- overflow = getStyle(this.dataAccessObject.inlineStartOverlayTrimmingContainer, 'overflow', rootWindow);
91
- if (overflow === 'scroll' || overflow === 'hidden' || overflow === 'auto') {
92
- // this is used in `scroll.html`
93
- // TODO test me
94
- return Math.max(width, trimmingContainer.clientWidth);
95
- }
98
+ return width;
99
+ }
100
+
101
+ /**
102
+ * @returns {number}
103
+ */
104
+ getViewportWidth() {
105
+ const containerWidth = this.getWorkspaceWidth();
106
+ if (containerWidth === Infinity) {
107
+ return containerWidth;
96
108
  }
97
- const stretchSetting = wtSettings.getSetting('stretchH');
98
- if (stretchSetting === 'none' || !stretchSetting) {
99
- // if no stretching is used, return the maximum used workspace width
100
- return Math.max(width, outerWidth(this.wtTable.TABLE));
109
+ const rowHeaderWidth = this.getRowHeaderWidth();
110
+ if (rowHeaderWidth > 0) {
111
+ return containerWidth - rowHeaderWidth;
101
112
  }
102
-
103
- // if stretching is used, return the actual container width, so the columns can fit inside it
104
- return width;
113
+ return containerWidth;
105
114
  }
106
115
 
107
116
  /**
@@ -122,6 +131,24 @@ class Viewport {
122
131
  return this.wtTable.hider.offsetWidth > this.getWorkspaceWidth();
123
132
  }
124
133
 
134
+ /**
135
+ * Checks if the table uses the window as a viewport and if there is a vertical scrollbar.
136
+ *
137
+ * @returns {boolean}
138
+ */
139
+ isVerticallyScrollableByWindow() {
140
+ return this.dataAccessObject.topOverlayTrimmingContainer === this.domBindings.rootWindow;
141
+ }
142
+
143
+ /**
144
+ * Checks if the table uses the window as a viewport and if there is a horizontal scrollbar.
145
+ *
146
+ * @returns {boolean}
147
+ */
148
+ isHorizontallyScrollableByWindow() {
149
+ return this.dataAccessObject.inlineStartOverlayTrimmingContainer === this.domBindings.rootWindow;
150
+ }
151
+
125
152
  /**
126
153
  * @param {number} from The visual column index from the width sum is start calculated.
127
154
  * @param {number} length The length of the column to traverse.
@@ -137,24 +164,6 @@ class Viewport {
137
164
  return sum;
138
165
  }
139
166
 
140
- /**
141
- * @returns {number}
142
- */
143
- getContainerFillWidth() {
144
- if (this.containerWidth) {
145
- return this.containerWidth;
146
- }
147
- const mainContainer = this.wtTable.holder;
148
- const dummyElement = this.domBindings.rootDocument.createElement('div');
149
- dummyElement.style.width = '100%';
150
- dummyElement.style.height = '1px';
151
- mainContainer.appendChild(dummyElement);
152
- const fillWidth = dummyElement.offsetWidth;
153
- this.containerWidth = fillWidth;
154
- mainContainer.removeChild(dummyElement);
155
- return fillWidth;
156
- }
157
-
158
167
  /**
159
168
  * @returns {number}
160
169
  */
@@ -175,21 +184,6 @@ class Viewport {
175
184
  return this.columnHeaderHeight;
176
185
  }
177
186
 
178
- /**
179
- * @returns {number}
180
- */
181
- getViewportHeight() {
182
- let containerHeight = this.getWorkspaceHeight();
183
- if (containerHeight === Infinity) {
184
- return containerHeight;
185
- }
186
- const columnHeaderHeight = this.getColumnHeaderHeight();
187
- if (columnHeaderHeight > 0) {
188
- containerHeight -= columnHeaderHeight;
189
- }
190
- return containerHeight;
191
- }
192
-
193
187
  /**
194
188
  * @returns {number}
195
189
  */
@@ -224,21 +218,6 @@ class Viewport {
224
218
  return this.rowHeaderWidth;
225
219
  }
226
220
 
227
- /**
228
- * @returns {number}
229
- */
230
- getViewportWidth() {
231
- const containerWidth = this.getWorkspaceWidth();
232
- if (containerWidth === Infinity) {
233
- return containerWidth;
234
- }
235
- const rowHeaderWidth = this.getRowHeaderWidth();
236
- if (rowHeaderWidth > 0) {
237
- return containerWidth - rowHeaderWidth;
238
- }
239
- return containerWidth;
240
- }
241
-
242
221
  /**
243
222
  * Creates rows calculators. The type of the calculations can be chosen from the list:
244
223
  * - 'rendered' Calculates rows that should be rendered within the current table's viewport;
@@ -281,7 +260,6 @@ class Viewport {
281
260
  viewportHeight: height,
282
261
  scrollOffset: pos,
283
262
  totalRows: wtSettings.getSetting('totalRows'),
284
- defaultRowHeight: this.wot.stylesHandler.getDefaultRowHeight(),
285
263
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
286
264
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
287
265
  horizontalScrollbarHeight: scrollbarHeight
package/CHANGELOG.md CHANGED
@@ -9,6 +9,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
10
  <!-- UNVERSIONED -->
11
11
 
12
+ ## [14.6.1] - 2024-10-17
13
+
14
+ ### Removed
15
+ - Removed `aria-hidden` from the TextEditor and PasswordEditor's `TEXTAREA` elements. [#11218](https://github.com/handsontable/handsontable/pull/11218)
16
+
12
17
  ## [14.6.0] - 2024-10-01
13
18
 
14
19
  ### Added
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 = "17/10/2024 06:56:07";
49
- Handsontable.version = "0.0.0-next-3e0b40d-20241017";
48
+ Handsontable.buildDate = "24/10/2024 07:23:05";
49
+ Handsontable.version = "0.0.0-next-802f59c-20241024";
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 = "17/10/2024 06:56:13";
39
- Handsontable.version = "0.0.0-next-3e0b40d-20241017";
38
+ Handsontable.buildDate = "24/10/2024 07:23:11";
39
+ Handsontable.version = "0.0.0-next-802f59c-20241024";
40
40
  Handsontable.languages = {
41
41
  dictionaryKeys,
42
42
  getLanguageDictionary,
@@ -1368,6 +1368,7 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
1368
1368
  * @event Hooks#modifyColWidth
1369
1369
  * @param {number} width Current column width.
1370
1370
  * @param {number} column Visual column index.
1371
+ * @param {string} [source] String that identifies source of hook call.
1371
1372
  */
1372
1373
  'modifyColWidth',
1373
1374
  /**
@@ -1404,6 +1405,7 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
1404
1405
  * @event Hooks#modifyRowHeight
1405
1406
  * @param {number} height Row height.
1406
1407
  * @param {number} row Visual row index.
1408
+ * @param {string} [source] String that identifies source of hook call.
1407
1409
  */
1408
1410
  'modifyRowHeight',
1409
1411
  /**
@@ -1365,6 +1365,7 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
1365
1365
  * @event Hooks#modifyColWidth
1366
1366
  * @param {number} width Current column width.
1367
1367
  * @param {number} column Visual column index.
1368
+ * @param {string} [source] String that identifies source of hook call.
1368
1369
  */
1369
1370
  'modifyColWidth',
1370
1371
  /**
@@ -1401,6 +1402,7 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
1401
1402
  * @event Hooks#modifyRowHeight
1402
1403
  * @param {number} height Row height.
1403
1404
  * @param {number} row Visual row index.
1405
+ * @param {string} [source] String that identifies source of hook call.
1404
1406
  */
1405
1407
  'modifyRowHeight',
1406
1408
  /**