handsontable 0.0.0-next-662a118-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 (63) hide show
  1. package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -1
  2. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
  3. package/3rdparty/walkontable/src/overlays.js +7 -6
  4. package/3rdparty/walkontable/src/overlays.mjs +7 -6
  5. package/3rdparty/walkontable/src/renderer/colGroup.js +1 -1
  6. package/3rdparty/walkontable/src/renderer/colGroup.mjs +1 -1
  7. package/3rdparty/walkontable/src/renderer/table.js +1 -1
  8. package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
  9. package/3rdparty/walkontable/src/settings.js +0 -7
  10. package/3rdparty/walkontable/src/settings.mjs +0 -7
  11. package/3rdparty/walkontable/src/table.js +0 -24
  12. package/3rdparty/walkontable/src/table.mjs +0 -24
  13. package/3rdparty/walkontable/src/utils/column.js +0 -42
  14. package/3rdparty/walkontable/src/utils/column.mjs +0 -42
  15. package/3rdparty/walkontable/src/viewport.js +66 -87
  16. package/3rdparty/walkontable/src/viewport.mjs +67 -88
  17. package/base.js +2 -2
  18. package/base.mjs +2 -2
  19. package/core/hooks/constants.js +2 -0
  20. package/core/hooks/constants.mjs +2 -0
  21. package/core/hooks/index.d.ts +2 -2
  22. package/core.d.ts +2 -2
  23. package/core.js +6 -4
  24. package/core.mjs +6 -4
  25. package/dist/handsontable.css +2 -2
  26. package/dist/handsontable.full.css +2 -2
  27. package/dist/handsontable.full.js +2217 -1821
  28. package/dist/handsontable.full.min.css +2 -2
  29. package/dist/handsontable.full.min.js +10 -10
  30. package/dist/handsontable.js +2219 -1823
  31. package/dist/handsontable.min.css +2 -2
  32. package/dist/handsontable.min.js +10 -10
  33. package/helpers/mixed.js +1 -1
  34. package/helpers/mixed.mjs +1 -1
  35. package/index.d.ts +7 -0
  36. package/package.json +6 -1
  37. package/plugins/comments/comments.js +1 -1
  38. package/plugins/comments/comments.mjs +1 -1
  39. package/plugins/index.d.ts +3 -0
  40. package/plugins/index.js +3 -0
  41. package/plugins/index.mjs +3 -1
  42. package/plugins/manualColumnMove/manualColumnMove.js +1 -3
  43. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -3
  44. package/plugins/manualColumnResize/manualColumnResize.js +24 -12
  45. package/plugins/manualColumnResize/manualColumnResize.mjs +24 -12
  46. package/plugins/stretchColumns/calculator.js +159 -0
  47. package/plugins/stretchColumns/calculator.mjs +155 -0
  48. package/plugins/stretchColumns/index.d.ts +1 -0
  49. package/plugins/stretchColumns/index.js +7 -0
  50. package/plugins/stretchColumns/index.mjs +1 -0
  51. package/plugins/stretchColumns/strategies/_base.js +85 -0
  52. package/plugins/stretchColumns/strategies/_base.mjs +81 -0
  53. package/plugins/stretchColumns/strategies/all.js +68 -0
  54. package/plugins/stretchColumns/strategies/all.mjs +64 -0
  55. package/plugins/stretchColumns/strategies/last.js +77 -0
  56. package/plugins/stretchColumns/strategies/last.mjs +73 -0
  57. package/plugins/stretchColumns/stretchColumns.d.ts +11 -0
  58. package/plugins/stretchColumns/stretchColumns.js +211 -0
  59. package/plugins/stretchColumns/stretchColumns.mjs +207 -0
  60. package/tableView.js +39 -6
  61. package/tableView.mjs +39 -6
  62. package/3rdparty/walkontable/src/utils/columnStretching.js +0 -197
  63. package/3rdparty/walkontable/src/utils/columnStretching.mjs +0 -193
@@ -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;
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 07:41:53";
49
- Handsontable.version = "0.0.0-next-662a118-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 07:41:58";
39
- Handsontable.version = "0.0.0-next-662a118-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
  /**
@@ -237,7 +237,7 @@ export interface Events {
237
237
  modifyColHeader?: (column: number) => void;
238
238
  modifyColumnHeaderHeight?: () => void;
239
239
  modifyColumnHeaderValue?: (headerValue: string, visualColumnIndex: number, headerLevel: number) => void | string;
240
- modifyColWidth?: (width: number, column: number) => void;
240
+ modifyColWidth?: (width: number, column: number, source?: string) => void;
241
241
  modifyCopyableRange?: (copyableRanges: RangeType[]) => void;
242
242
  modifyFiltersMultiSelectValue?: (value: string, meta: CellProperties) => void | CellValue;
243
243
  modifyFocusedElement?: (row: number, column: number, focusedElement: HTMLElement) => void | HTMLElement;
@@ -248,7 +248,7 @@ export interface Events {
248
248
  modifyRowData?: (row: number) => void;
249
249
  modifyRowHeader?: (row: number) => void;
250
250
  modifyRowHeaderWidth?: (rowHeaderWidth: number) => void;
251
- modifyRowHeight?: (height: number, row: number) => void | number;
251
+ modifyRowHeight?: (height: number, row: number, source?: string) => void | number;
252
252
  modifyRowHeightByOverlayName?: (height: number, row: number, overlayType: OverlayType) => void | number;
253
253
  modifySourceData?: (row: number, column: number, valueHolder: { value: CellValue }, ioMode: 'get' | 'set') => void;
254
254
  modifyTransformEnd?: (delta: CellCoords) => void;
package/core.d.ts CHANGED
@@ -69,7 +69,7 @@ export default class Core {
69
69
  getColHeader(): Array<number | string>;
70
70
  getColHeader(column: number, headerLevel?: number): number | string;
71
71
  getColumnMeta(column: number): ColumnSettings;
72
- getColWidth(column: number): number;
72
+ getColWidth(column: number, source?: string): number;
73
73
  getCoords(element: Element | null): CellCoords;
74
74
  getCopyableData(row: number, column: number): string;
75
75
  getCopyableText(startRow: number, startColumn: number, endRow: number, endColumn: number): string;
@@ -99,7 +99,7 @@ export default class Core {
99
99
  getPlugin(pluginName: string): Plugins['basePlugin'];
100
100
  getRowHeader(): Array<string | number>;
101
101
  getRowHeader(row: number): string | number;
102
- getRowHeight(row: number): number;
102
+ getRowHeight(row: number, source?: string): number;
103
103
  getSchema(): RowObject;
104
104
  getSelected(): Array<[number, number, number, number]> | undefined;
105
105
  getSelectedLast(): number[] | undefined;
package/core.js CHANGED
@@ -3494,12 +3494,13 @@ function Core(rootElement, userSettings) {
3494
3494
  * @memberof Core#
3495
3495
  * @function getColWidth
3496
3496
  * @param {number} column Visual column index.
3497
+ * @param {string} [source] The source of the call.
3497
3498
  * @returns {number} Column width.
3498
3499
  * @fires Hooks#modifyColWidth
3499
3500
  */
3500
- this.getColWidth = function (column) {
3501
+ this.getColWidth = function (column, source) {
3501
3502
  let width = instance._getColWidthFromSettings(column);
3502
- width = instance.runHooks('modifyColWidth', width, column);
3503
+ width = instance.runHooks('modifyColWidth', width, column, source);
3503
3504
  if (width === undefined) {
3504
3505
  width = _src.DEFAULT_COLUMN_WIDTH;
3505
3506
  }
@@ -3559,12 +3560,13 @@ function Core(rootElement, userSettings) {
3559
3560
  * @memberof Core#
3560
3561
  * @function getRowHeight
3561
3562
  * @param {number} row A visual row index.
3563
+ * @param {string} [source] The source of the call.
3562
3564
  * @returns {number|undefined} The height of the specified row, in pixels.
3563
3565
  * @fires Hooks#modifyRowHeight
3564
3566
  */
3565
- this.getRowHeight = function (row) {
3567
+ this.getRowHeight = function (row, source) {
3566
3568
  let height = instance._getRowHeightFromSettings(row);
3567
- height = instance.runHooks('modifyRowHeight', height, row);
3569
+ height = instance.runHooks('modifyRowHeight', height, row, source);
3568
3570
  return height;
3569
3571
  };
3570
3572
 
package/core.mjs CHANGED
@@ -3489,12 +3489,13 @@ export default function Core(rootElement, userSettings) {
3489
3489
  * @memberof Core#
3490
3490
  * @function getColWidth
3491
3491
  * @param {number} column Visual column index.
3492
+ * @param {string} [source] The source of the call.
3492
3493
  * @returns {number} Column width.
3493
3494
  * @fires Hooks#modifyColWidth
3494
3495
  */
3495
- this.getColWidth = function (column) {
3496
+ this.getColWidth = function (column, source) {
3496
3497
  let width = instance._getColWidthFromSettings(column);
3497
- width = instance.runHooks('modifyColWidth', width, column);
3498
+ width = instance.runHooks('modifyColWidth', width, column, source);
3498
3499
  if (width === undefined) {
3499
3500
  width = DEFAULT_COLUMN_WIDTH;
3500
3501
  }
@@ -3554,12 +3555,13 @@ export default function Core(rootElement, userSettings) {
3554
3555
  * @memberof Core#
3555
3556
  * @function getRowHeight
3556
3557
  * @param {number} row A visual row index.
3558
+ * @param {string} [source] The source of the call.
3557
3559
  * @returns {number|undefined} The height of the specified row, in pixels.
3558
3560
  * @fires Hooks#modifyRowHeight
3559
3561
  */
3560
- this.getRowHeight = function (row) {
3562
+ this.getRowHeight = function (row, source) {
3561
3563
  let height = instance._getRowHeightFromSettings(row);
3562
- height = instance.runHooks('modifyRowHeight', height, row);
3564
+ height = instance.runHooks('modifyRowHeight', height, row, source);
3563
3565
  return height;
3564
3566
  };
3565
3567
 
@@ -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-662a118-20241017
29
- * Release date: 17/10/2024 (built at 17/10/2024 07:42:03)
28
+ * Version: 0.0.0-next-802f59c-20241024
29
+ * Release date: 17/10/2024 (built at 24/10/2024 07:23:15)
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-662a118-20241017
29
- * Release date: 17/10/2024 (built at 17/10/2024 07:42:03)
28
+ * Version: 0.0.0-next-802f59c-20241024
29
+ * Release date: 17/10/2024 (built at 24/10/2024 07:23:15)
30
30
  */
31
31
  /**
32
32
  * Fix for bootstrap styles