handsontable 0.0.0-next-802f59c-20241024 → 0.0.0-next-adeb5a2-20241025

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 +6 -7
  4. package/3rdparty/walkontable/src/overlays.mjs +6 -7
  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 +7 -0
  10. package/3rdparty/walkontable/src/settings.mjs +7 -0
  11. package/3rdparty/walkontable/src/table.js +24 -0
  12. package/3rdparty/walkontable/src/table.mjs +24 -0
  13. package/3rdparty/walkontable/src/utils/column.js +42 -0
  14. package/3rdparty/walkontable/src/utils/column.mjs +42 -0
  15. package/3rdparty/walkontable/src/utils/columnStretching.js +197 -0
  16. package/3rdparty/walkontable/src/utils/columnStretching.mjs +193 -0
  17. package/3rdparty/walkontable/src/viewport.js +87 -66
  18. package/3rdparty/walkontable/src/viewport.mjs +88 -67
  19. package/base.js +2 -2
  20. package/base.mjs +2 -2
  21. package/core/hooks/constants.js +0 -2
  22. package/core/hooks/constants.mjs +0 -2
  23. package/core/hooks/index.d.ts +2 -2
  24. package/core.d.ts +2 -2
  25. package/core.js +4 -6
  26. package/core.mjs +4 -6
  27. package/dist/handsontable.css +2 -2
  28. package/dist/handsontable.full.css +2 -2
  29. package/dist/handsontable.full.js +1821 -2217
  30. package/dist/handsontable.full.min.css +2 -2
  31. package/dist/handsontable.full.min.js +10 -10
  32. package/dist/handsontable.js +1823 -2219
  33. package/dist/handsontable.min.css +2 -2
  34. package/dist/handsontable.min.js +10 -10
  35. package/helpers/mixed.js +1 -1
  36. package/helpers/mixed.mjs +1 -1
  37. package/index.d.ts +0 -7
  38. package/package.json +1 -6
  39. package/plugins/comments/comments.js +1 -1
  40. package/plugins/comments/comments.mjs +1 -1
  41. package/plugins/index.d.ts +0 -3
  42. package/plugins/index.js +0 -3
  43. package/plugins/index.mjs +1 -3
  44. package/plugins/manualColumnMove/manualColumnMove.js +3 -1
  45. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
  46. package/plugins/manualColumnResize/manualColumnResize.js +12 -24
  47. package/plugins/manualColumnResize/manualColumnResize.mjs +12 -24
  48. package/tableView.js +6 -39
  49. package/tableView.mjs +6 -39
  50. package/plugins/stretchColumns/calculator.js +0 -159
  51. package/plugins/stretchColumns/calculator.mjs +0 -155
  52. package/plugins/stretchColumns/index.d.ts +0 -1
  53. package/plugins/stretchColumns/index.js +0 -7
  54. package/plugins/stretchColumns/index.mjs +0 -1
  55. package/plugins/stretchColumns/strategies/_base.js +0 -85
  56. package/plugins/stretchColumns/strategies/_base.mjs +0 -81
  57. package/plugins/stretchColumns/strategies/all.js +0 -68
  58. package/plugins/stretchColumns/strategies/all.mjs +0 -64
  59. package/plugins/stretchColumns/strategies/last.js +0 -77
  60. package/plugins/stretchColumns/strategies/last.mjs +0 -73
  61. package/plugins/stretchColumns/stretchColumns.d.ts +0 -11
  62. package/plugins/stretchColumns/stretchColumns.js +0 -211
  63. package/plugins/stretchColumns/stretchColumns.mjs +0 -207
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-802f59c-20241024";
137
+ const hotVersion = "0.0.0-next-adeb5a2-20241025";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-802f59c-20241024";
127
+ const hotVersion = "0.0.0-next-adeb5a2-20241025";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/index.d.ts CHANGED
@@ -220,9 +220,6 @@ import {
220
220
  SearchCallback,
221
221
  SearchQueryMethod,
222
222
  } from './plugins/search';
223
- import {
224
- Settings as StretchColumnsSettings,
225
- } from './plugins/stretchColumns';
226
223
  import {
227
224
  TouchScroll as _TouchScroll,
228
225
  Settings as TouchScrollSettings,
@@ -526,10 +523,6 @@ declare namespace Handsontable {
526
523
  export { SearchQueryMethod };
527
524
  }
528
525
 
529
- export namespace StretchColumns {
530
- export { StretchColumnsSettings as Settings };
531
- }
532
-
533
526
  export namespace TouchScroll {
534
527
  export { TouchScrollSettings as Settings };
535
528
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-802f59c-20241024",
13
+ "version": "0.0.0-next-adeb5a2-20241025",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -472,11 +472,6 @@
472
472
  "require": "./plugins/search/index.js",
473
473
  "import": "./plugins/search/index.mjs"
474
474
  },
475
- "./plugins/stretchColumns": {
476
- "types": "./plugins/stretchColumns/index.d.ts",
477
- "require": "./plugins/stretchColumns/index.js",
478
- "import": "./plugins/stretchColumns/index.mjs"
479
- },
480
475
  "./plugins/touchScroll": {
481
476
  "types": "./plugins/touchScroll/index.d.ts",
482
477
  "require": "./plugins/touchScroll/index.js",
@@ -575,7 +575,7 @@ class Comments extends _base.BasePlugin {
575
575
  } else {
576
576
  _classPrivateFieldGet(_editor, this).resetSize();
577
577
  }
578
- const lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getColumnWidth(renderableColumn);
578
+ const lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getStretchedColumnWidth(renderableColumn);
579
579
  const lastRowHeight = targetingPreviousRow && !isBeforeRenderedRows ? (0, _element.outerHeight)(TD) : 0;
580
580
  const {
581
581
  left,
@@ -571,7 +571,7 @@ export class Comments extends BasePlugin {
571
571
  } else {
572
572
  _classPrivateFieldGet(_editor, this).resetSize();
573
573
  }
574
- const lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getColumnWidth(renderableColumn);
574
+ const lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getStretchedColumnWidth(renderableColumn);
575
575
  const lastRowHeight = targetingPreviousRow && !isBeforeRenderedRows ? outerHeight(TD) : 0;
576
576
  const {
577
577
  left,
@@ -29,7 +29,6 @@ import { NestedHeaders } from './nestedHeaders';
29
29
  import { NestedRows } from './nestedRows';
30
30
  import { PersistentState } from './persistentState';
31
31
  import { Search } from './search';
32
- import { StretchColumns } from './stretchColumns';
33
32
  import { TouchScroll } from './touchScroll';
34
33
  import { TrimRows } from './trimRows';
35
34
  import { UndoRedo } from './undoRedo';
@@ -66,7 +65,6 @@ export interface Plugins {
66
65
  nestedRows: NestedRows;
67
66
  persistentState: PersistentState;
68
67
  search: Search;
69
- stretchColumns: StretchColumns;
70
68
  touchScroll: TouchScroll;
71
69
  trimRows: TrimRows;
72
70
  undoRedo: UndoRedo;
@@ -107,7 +105,6 @@ export {
107
105
  NestedRows,
108
106
  PersistentState,
109
107
  Search,
110
- StretchColumns,
111
108
  TouchScroll,
112
109
  TrimRows,
113
110
  UndoRedo
package/plugins/index.js CHANGED
@@ -64,8 +64,6 @@ var _persistentState = require("./persistentState");
64
64
  exports.PersistentState = _persistentState.PersistentState;
65
65
  var _search = require("./search");
66
66
  exports.Search = _search.Search;
67
- var _stretchColumns = require("./stretchColumns");
68
- exports.StretchColumns = _stretchColumns.StretchColumns;
69
67
  var _touchScroll = require("./touchScroll");
70
68
  exports.TouchScroll = _touchScroll.TouchScroll;
71
69
  var _trimRows = require("./trimRows");
@@ -110,7 +108,6 @@ function registerAllPlugins() {
110
108
  (0, _registry.registerPlugin)(_nestedRows.NestedRows);
111
109
  (0, _registry.registerPlugin)(_persistentState.PersistentState);
112
110
  (0, _registry.registerPlugin)(_search.Search);
113
- (0, _registry.registerPlugin)(_stretchColumns.StretchColumns);
114
111
  (0, _registry.registerPlugin)(_touchScroll.TouchScroll);
115
112
  (0, _registry.registerPlugin)(_trimRows.TrimRows);
116
113
  (0, _registry.registerPlugin)(_undoRedo.UndoRedo);
package/plugins/index.mjs CHANGED
@@ -29,7 +29,6 @@ import { NestedHeaders } from "./nestedHeaders/index.mjs";
29
29
  import { NestedRows } from "./nestedRows/index.mjs";
30
30
  import { PersistentState } from "./persistentState/index.mjs";
31
31
  import { Search } from "./search/index.mjs";
32
- import { StretchColumns } from "./stretchColumns/index.mjs";
33
32
  import { TouchScroll } from "./touchScroll/index.mjs";
34
33
  import { TrimRows } from "./trimRows/index.mjs";
35
34
  import { UndoRedo } from "./undoRedo/index.mjs";
@@ -68,10 +67,9 @@ export function registerAllPlugins() {
68
67
  registerPlugin(NestedRows);
69
68
  registerPlugin(PersistentState);
70
69
  registerPlugin(Search);
71
- registerPlugin(StretchColumns);
72
70
  registerPlugin(TouchScroll);
73
71
  registerPlugin(TrimRows);
74
72
  registerPlugin(UndoRedo);
75
73
  }
76
- export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, PersistentState, Search, StretchColumns, TouchScroll, TrimRows, UndoRedo };
74
+ export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, PersistentState, Search, TouchScroll, TrimRows, UndoRedo };
77
75
  export { getPlugin, getPluginsNames, registerPlugin } from "./registry.mjs";
@@ -339,11 +339,13 @@ class ManualColumnMove extends _base.BasePlugin {
339
339
  const columnMapper = this.hot.columnIndexMapper;
340
340
  let columnsWidth = 0;
341
341
  for (let visualColumnIndex = fromColumn; visualColumnIndex <= toColumn; visualColumnIndex += 1) {
342
+ // We can't use just `getColWidth` (even without indexes translation) as it doesn't return proper values
343
+ // when column is stretched.
342
344
  const renderableIndex = columnMapper.getRenderableFromVisualIndex(visualColumnIndex);
343
345
  if (visualColumnIndex < 0) {
344
346
  columnsWidth += this.hot.view._wt.wtViewport.getRowHeaderWidth() || 0;
345
347
  } else if (renderableIndex !== null) {
346
- columnsWidth += this.hot.view._wt.wtTable.getColumnWidth(renderableIndex) || 0;
348
+ columnsWidth += this.hot.view._wt.wtTable.getStretchedColumnWidth(renderableIndex) || 0;
347
349
  }
348
350
  }
349
351
  return columnsWidth;
@@ -335,11 +335,13 @@ export class ManualColumnMove extends BasePlugin {
335
335
  const columnMapper = this.hot.columnIndexMapper;
336
336
  let columnsWidth = 0;
337
337
  for (let visualColumnIndex = fromColumn; visualColumnIndex <= toColumn; visualColumnIndex += 1) {
338
+ // We can't use just `getColWidth` (even without indexes translation) as it doesn't return proper values
339
+ // when column is stretched.
338
340
  const renderableIndex = columnMapper.getRenderableFromVisualIndex(visualColumnIndex);
339
341
  if (visualColumnIndex < 0) {
340
342
  columnsWidth += this.hot.view._wt.wtViewport.getRowHeaderWidth() || 0;
341
343
  } else if (renderableIndex !== null) {
342
- columnsWidth += this.hot.view._wt.wtTable.getColumnWidth(renderableIndex) || 0;
344
+ columnsWidth += this.hot.view._wt.wtTable.getStretchedColumnWidth(renderableIndex) || 0;
343
345
  }
344
346
  }
345
347
  return columnsWidth;
@@ -162,31 +162,15 @@ class ManualColumnResize extends _base.BasePlugin {
162
162
  * Enables the plugin functionality for this Handsontable instance.
163
163
  */
164
164
  enablePlugin() {
165
- var _this = this;
166
165
  if (this.enabled) {
167
166
  return;
168
167
  }
169
168
  _classPrivateFieldSet(_columnWidthsMap, this, new _translations.PhysicalIndexToValueMap());
170
169
  _classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
171
170
  this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
172
- this.addHook('modifyColWidth', function () {
173
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
174
- args[_key] = arguments[_key];
175
- }
176
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onModifyColWidth).call(_this, ...args);
177
- }, 1);
178
- this.addHook('beforeStretchingColumnWidth', function () {
179
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
180
- args[_key2] = arguments[_key2];
181
- }
182
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeStretchingColumnWidth).call(_this, ...args);
183
- }, 1);
184
- this.addHook('beforeColumnResize', function () {
185
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
186
- args[_key3] = arguments[_key3];
187
- }
188
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeColumnResize).call(_this, ...args);
189
- });
171
+ this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col), 1);
172
+ this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeStretchingColumnWidth).call(this, stretchedWidth, column));
173
+ this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeColumnResize).call(this, newSize, column, isDoubleClick));
190
174
  this.bindEvents();
191
175
  super.enablePlugin();
192
176
  }
@@ -424,7 +408,11 @@ class ManualColumnResize extends _base.BasePlugin {
424
408
  if (hookNewSize !== undefined) {
425
409
  _classPrivateFieldSet(_newSize, this, hookNewSize);
426
410
  }
427
- this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
411
+ if (this.hot.getSettings().stretchH === 'all') {
412
+ this.clearManualSize(column);
413
+ } else {
414
+ this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
415
+ }
428
416
  this.saveManualColumnWidths();
429
417
  this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, true);
430
418
  if (forceRender) {
@@ -642,11 +630,11 @@ function _onModifyColWidth(width, column) {
642
630
  * @returns {number}
643
631
  */
644
632
  function _onBeforeStretchingColumnWidth(stretchedWidth, column) {
645
- const width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column));
646
- if (typeof width === 'number') {
647
- return width;
633
+ let width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(column);
634
+ if (width === null) {
635
+ width = stretchedWidth;
648
636
  }
649
- return stretchedWidth;
637
+ return width;
650
638
  }
651
639
  /**
652
640
  * `beforeColumnResize` hook callback.
@@ -157,31 +157,15 @@ export class ManualColumnResize extends BasePlugin {
157
157
  * Enables the plugin functionality for this Handsontable instance.
158
158
  */
159
159
  enablePlugin() {
160
- var _this = this;
161
160
  if (this.enabled) {
162
161
  return;
163
162
  }
164
163
  _classPrivateFieldSet(_columnWidthsMap, this, new IndexToValueMap());
165
164
  _classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
166
165
  this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
167
- this.addHook('modifyColWidth', function () {
168
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
169
- args[_key] = arguments[_key];
170
- }
171
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onModifyColWidth).call(_this, ...args);
172
- }, 1);
173
- this.addHook('beforeStretchingColumnWidth', function () {
174
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
175
- args[_key2] = arguments[_key2];
176
- }
177
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeStretchingColumnWidth).call(_this, ...args);
178
- }, 1);
179
- this.addHook('beforeColumnResize', function () {
180
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
181
- args[_key3] = arguments[_key3];
182
- }
183
- return _assertClassBrand(_ManualColumnResize_brand, _this, _onBeforeColumnResize).call(_this, ...args);
184
- });
166
+ this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col), 1);
167
+ this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeStretchingColumnWidth).call(this, stretchedWidth, column));
168
+ this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeColumnResize).call(this, newSize, column, isDoubleClick));
185
169
  this.bindEvents();
186
170
  super.enablePlugin();
187
171
  }
@@ -419,7 +403,11 @@ export class ManualColumnResize extends BasePlugin {
419
403
  if (hookNewSize !== undefined) {
420
404
  _classPrivateFieldSet(_newSize, this, hookNewSize);
421
405
  }
422
- this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
406
+ if (this.hot.getSettings().stretchH === 'all') {
407
+ this.clearManualSize(column);
408
+ } else {
409
+ this.setManualSize(column, _classPrivateFieldGet(_newSize, this)); // double click sets by auto row size plugin
410
+ }
423
411
  this.saveManualColumnWidths();
424
412
  this.hot.runHooks('afterColumnResize', _classPrivateFieldGet(_newSize, this), column, true);
425
413
  if (forceRender) {
@@ -636,11 +624,11 @@ function _onModifyColWidth(width, column) {
636
624
  * @returns {number}
637
625
  */
638
626
  function _onBeforeStretchingColumnWidth(stretchedWidth, column) {
639
- const width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(this.hot.toPhysicalColumn(column));
640
- if (typeof width === 'number') {
641
- return width;
627
+ let width = _classPrivateFieldGet(_columnWidthsMap, this).getValueAtIndex(column);
628
+ if (width === null) {
629
+ width = stretchedWidth;
642
630
  }
643
- return stretchedWidth;
631
+ return width;
644
632
  }
645
633
  /**
646
634
  * `beforeColumnResize` hook callback.
package/tableView.js CHANGED
@@ -158,7 +158,7 @@ class TableView {
158
158
  this.hot.runHooks('beforeRender', this.hot.forceFullRender);
159
159
  if (this.postponedAdjustElementsSize) {
160
160
  this.postponedAdjustElementsSize = false;
161
- this.adjustElementsSize();
161
+ this.adjustElementsSize(true);
162
162
  }
163
163
  this._wt.draw(!this.hot.forceFullRender);
164
164
  this.hot.runHooks('afterRender', this.hot.forceFullRender);
@@ -613,6 +613,7 @@ class TableView {
613
613
  isDataViewInstance: () => (0, _rootInstance.isRootInstance)(this.hot),
614
614
  preventOverflow: () => this.settings.preventOverflow,
615
615
  preventWheel: () => this.settings.preventWheel,
616
+ stretchH: () => this.settings.stretchH,
616
617
  viewportColumnRenderingThreshold: () => this.settings.viewportColumnRenderingThreshold,
617
618
  viewportRowRenderingThreshold: () => this.settings.viewportRowRenderingThreshold,
618
619
  data: (renderableRow, renderableColumn) => {
@@ -911,6 +912,10 @@ class TableView {
911
912
  },
912
913
  onBeforeTouchScroll: () => this.hot.runHooks('beforeTouchScroll'),
913
914
  onAfterMomentumScroll: () => this.hot.runHooks('afterMomentumScroll'),
915
+ onBeforeStretchingColumnWidth: (stretchedWidth, renderedColumnIndex) => {
916
+ const visualColumnIndex = this.hot.columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
917
+ return this.hot.runHooks('beforeStretchingColumnWidth', stretchedWidth, visualColumnIndex);
918
+ },
914
919
  onModifyRowHeaderWidth: rowHeaderWidth => this.hot.runHooks('modifyRowHeaderWidth', rowHeaderWidth),
915
920
  onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost, source) => {
916
921
  const rowMapper = this.hot.rowIndexMapper;
@@ -1534,44 +1539,6 @@ class TableView {
1534
1539
  getTableHeight() {
1535
1540
  return this._wt.wtTable.getHeight();
1536
1541
  }
1537
-
1538
- /**
1539
- * Gets the row header width. If there are multiple row headers, the width of
1540
- * the sum of all of them is returned.
1541
- *
1542
- * @returns {number}
1543
- */
1544
- getRowHeaderWidth() {
1545
- return this._wt.wtViewport.getRowHeaderWidth();
1546
- }
1547
-
1548
- /**
1549
- * Gets the column header height. If there are multiple column headers, the height
1550
- * of the sum of all of them is returned.
1551
- *
1552
- * @returns {number}
1553
- */
1554
- getColumnHeaderHeight() {
1555
- return this._wt.wtViewport.getColumnHeaderHeight();
1556
- }
1557
-
1558
- /**
1559
- * Checks if the table uses the window as a viewport and if there is a vertical scrollbar.
1560
- *
1561
- * @returns {boolean}
1562
- */
1563
- isVerticallyScrollableByWindow() {
1564
- return this._wt.wtViewport.isVerticallyScrollableByWindow();
1565
- }
1566
-
1567
- /**
1568
- * Checks if the table uses the window as a viewport and if there is a horizontal scrollbar.
1569
- *
1570
- * @returns {boolean}
1571
- */
1572
- isHorizontallyScrollableByWindow() {
1573
- return this._wt.wtViewport.isHorizontallyScrollableByWindow();
1574
- }
1575
1542
  /**
1576
1543
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1577
1544
  *
package/tableView.mjs CHANGED
@@ -154,7 +154,7 @@ class TableView {
154
154
  this.hot.runHooks('beforeRender', this.hot.forceFullRender);
155
155
  if (this.postponedAdjustElementsSize) {
156
156
  this.postponedAdjustElementsSize = false;
157
- this.adjustElementsSize();
157
+ this.adjustElementsSize(true);
158
158
  }
159
159
  this._wt.draw(!this.hot.forceFullRender);
160
160
  this.hot.runHooks('afterRender', this.hot.forceFullRender);
@@ -609,6 +609,7 @@ class TableView {
609
609
  isDataViewInstance: () => isRootInstance(this.hot),
610
610
  preventOverflow: () => this.settings.preventOverflow,
611
611
  preventWheel: () => this.settings.preventWheel,
612
+ stretchH: () => this.settings.stretchH,
612
613
  viewportColumnRenderingThreshold: () => this.settings.viewportColumnRenderingThreshold,
613
614
  viewportRowRenderingThreshold: () => this.settings.viewportRowRenderingThreshold,
614
615
  data: (renderableRow, renderableColumn) => {
@@ -907,6 +908,10 @@ class TableView {
907
908
  },
908
909
  onBeforeTouchScroll: () => this.hot.runHooks('beforeTouchScroll'),
909
910
  onAfterMomentumScroll: () => this.hot.runHooks('afterMomentumScroll'),
911
+ onBeforeStretchingColumnWidth: (stretchedWidth, renderedColumnIndex) => {
912
+ const visualColumnIndex = this.hot.columnIndexMapper.getVisualFromRenderableIndex(renderedColumnIndex);
913
+ return this.hot.runHooks('beforeStretchingColumnWidth', stretchedWidth, visualColumnIndex);
914
+ },
910
915
  onModifyRowHeaderWidth: rowHeaderWidth => this.hot.runHooks('modifyRowHeaderWidth', rowHeaderWidth),
911
916
  onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost, source) => {
912
917
  const rowMapper = this.hot.rowIndexMapper;
@@ -1530,44 +1535,6 @@ class TableView {
1530
1535
  getTableHeight() {
1531
1536
  return this._wt.wtTable.getHeight();
1532
1537
  }
1533
-
1534
- /**
1535
- * Gets the row header width. If there are multiple row headers, the width of
1536
- * the sum of all of them is returned.
1537
- *
1538
- * @returns {number}
1539
- */
1540
- getRowHeaderWidth() {
1541
- return this._wt.wtViewport.getRowHeaderWidth();
1542
- }
1543
-
1544
- /**
1545
- * Gets the column header height. If there are multiple column headers, the height
1546
- * of the sum of all of them is returned.
1547
- *
1548
- * @returns {number}
1549
- */
1550
- getColumnHeaderHeight() {
1551
- return this._wt.wtViewport.getColumnHeaderHeight();
1552
- }
1553
-
1554
- /**
1555
- * Checks if the table uses the window as a viewport and if there is a vertical scrollbar.
1556
- *
1557
- * @returns {boolean}
1558
- */
1559
- isVerticallyScrollableByWindow() {
1560
- return this._wt.wtViewport.isVerticallyScrollableByWindow();
1561
- }
1562
-
1563
- /**
1564
- * Checks if the table uses the window as a viewport and if there is a horizontal scrollbar.
1565
- *
1566
- * @returns {boolean}
1567
- */
1568
- isHorizontallyScrollableByWindow() {
1569
- return this._wt.wtViewport.isHorizontallyScrollableByWindow();
1570
- }
1571
1538
  /**
1572
1539
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1573
1540
  *
@@ -1,159 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- require("core-js/modules/es.error.cause.js");
5
- var _src = require("../../3rdparty/walkontable/src");
6
- var _element = require("../../helpers/dom/element");
7
- var _all = require("./strategies/all");
8
- var _last = require("./strategies/last");
9
- function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
10
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
11
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
12
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
13
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
14
- 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"); }
15
- const STRETCH_WIDTH_MAP_NAME = 'stretchColumns';
16
-
17
- /**
18
- * The class responsible for calculating the column widths based on the specified column stretching strategy.
19
- *
20
- * @private
21
- * @class StretchCalculator
22
- */
23
- var _hot = /*#__PURE__*/new WeakMap();
24
- var _widthsMap = /*#__PURE__*/new WeakMap();
25
- var _stretchStrategies = /*#__PURE__*/new WeakMap();
26
- var _activeStrategy = /*#__PURE__*/new WeakMap();
27
- var _StretchCalculator_brand = /*#__PURE__*/new WeakSet();
28
- class StretchCalculator {
29
- constructor(hotInstance) {
30
- /**
31
- * Checks if the vertical scrollbar will appear. Based on the current data and viewport size
32
- * the method calculates if the vertical scrollbar will appear after the table is rendered.
33
- * The method is a workaround for the issue in the Walkontable that returns unstable viewport
34
- * size.
35
- *
36
- * @returns {boolean}
37
- */
38
- _classPrivateMethodInitSpec(this, _StretchCalculator_brand);
39
- /**
40
- * The Handsontable instance.
41
- *
42
- * @type {Core}
43
- */
44
- _classPrivateFieldInitSpec(this, _hot, void 0);
45
- /**
46
- * The map that stores the calculated column widths.
47
- *
48
- * @type {IndexToValueMap}
49
- */
50
- _classPrivateFieldInitSpec(this, _widthsMap, void 0);
51
- /**
52
- * The map that stores the available stretch strategies.
53
- *
54
- * @type {Map<string, StretchAllStrategy | StretchLastStrategy>}
55
- */
56
- _classPrivateFieldInitSpec(this, _stretchStrategies, new Map([['all', new _all.StretchAllStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))], ['last', new _last.StretchLastStrategy(_assertClassBrand(_StretchCalculator_brand, this, _overwriteColumnWidthFn).bind(this))]]));
57
- /**
58
- * The active stretch mode.
59
- *
60
- * @type {'all' | 'last' | 'none'}
61
- */
62
- _classPrivateFieldInitSpec(this, _activeStrategy, 'none');
63
- _classPrivateFieldSet(_hot, this, hotInstance);
64
- _classPrivateFieldSet(_widthsMap, this, _classPrivateFieldGet(_hot, this).columnIndexMapper.createAndRegisterIndexMap(STRETCH_WIDTH_MAP_NAME, 'physicalIndexToValue'));
65
- }
66
-
67
- /**
68
- * Sets the active stretch strategy.
69
- *
70
- * @param {'all' | 'last' | 'none'} strategyName The stretch strategy to use.
71
- */
72
- useStrategy(strategyName) {
73
- _classPrivateFieldSet(_activeStrategy, this, _classPrivateFieldGet(_stretchStrategies, this).has(strategyName) ? strategyName : 'none');
74
- }
75
-
76
- /**
77
- * Recalculates the column widths.
78
- */
79
- refreshStretching() {
80
- if (_classPrivateFieldGet(_activeStrategy, this) === 'none') {
81
- _classPrivateFieldGet(_widthsMap, this).clear();
82
- return;
83
- }
84
- _classPrivateFieldGet(_hot, this).batchExecution(() => {
85
- _classPrivateFieldGet(_widthsMap, this).clear();
86
- const stretchStrategy = _classPrivateFieldGet(_stretchStrategies, this).get(_classPrivateFieldGet(_activeStrategy, this));
87
- const view = _classPrivateFieldGet(_hot, this).view;
88
- let viewportWidth = view.getViewportWidth();
89
- if (_assertClassBrand(_StretchCalculator_brand, this, _willVerticalScrollAppear).call(this)) {
90
- viewportWidth -= (0, _element.getScrollbarWidth)(_classPrivateFieldGet(_hot, this).rootDocument);
91
- }
92
- stretchStrategy.prepare({
93
- viewportWidth
94
- });
95
- for (let columnIndex = 0; columnIndex < _classPrivateFieldGet(_hot, this).countCols(); columnIndex++) {
96
- if (!_classPrivateFieldGet(_hot, this).columnIndexMapper.isHidden(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex))) {
97
- stretchStrategy.setColumnBaseWidth(columnIndex, _assertClassBrand(_StretchCalculator_brand, this, _getWidthWithoutStretching).call(this, columnIndex));
98
- }
99
- }
100
- stretchStrategy.calculate();
101
- stretchStrategy.getWidths().forEach(_ref => {
102
- let [columnIndex, width] = _ref;
103
- _classPrivateFieldGet(_widthsMap, this).setValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnIndex), width);
104
- });
105
- }, true);
106
- }
107
-
108
- /**
109
- * Gets the calculated column width.
110
- *
111
- * @param {number} columnVisualIndex Column visual index.
112
- * @returns {number | null}
113
- */
114
- getStretchedWidth(columnVisualIndex) {
115
- return _classPrivateFieldGet(_widthsMap, this).getValueAtIndex(_classPrivateFieldGet(_hot, this).toPhysicalColumn(columnVisualIndex));
116
- }
117
- }
118
- exports.StretchCalculator = StretchCalculator;
119
- function _willVerticalScrollAppear() {
120
- const {
121
- view
122
- } = _classPrivateFieldGet(_hot, this);
123
- if (view.isVerticallyScrollableByWindow()) {
124
- return false;
125
- }
126
- const viewportHeight = view.getViewportHeight();
127
- const totalRows = _classPrivateFieldGet(_hot, this).countRows();
128
- let totalHeight = 0;
129
- let hasVerticalScroll = false;
130
- for (let row = 0; row < totalRows; row++) {
131
- var _classPrivateFieldGet2;
132
- totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _src.DEFAULT_ROW_HEIGHT) + (row === 0 ? 1 : 0);
133
- if (totalHeight > viewportHeight) {
134
- hasVerticalScroll = true;
135
- break;
136
- }
137
- }
138
- return hasVerticalScroll;
139
- }
140
- /**
141
- * Gets the column width from the Handsontable API without logic related to stretching.
142
- *
143
- * @param {number} columnVisualIndex Column visual index.
144
- * @returns {number}
145
- */
146
- function _getWidthWithoutStretching(columnVisualIndex) {
147
- var _classPrivateFieldGet3;
148
- return (_classPrivateFieldGet3 = _classPrivateFieldGet(_hot, this).getColWidth(columnVisualIndex, 'StretchColumns')) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _src.DEFAULT_COLUMN_WIDTH;
149
- }
150
- /**
151
- * Executes the hook that allows to overwrite the column width.
152
- *
153
- * @param {number} columnWidth The column width.
154
- * @param {number} columnVisualIndex Column visual index.
155
- * @returns {number}
156
- */
157
- function _overwriteColumnWidthFn(columnWidth, columnVisualIndex) {
158
- return _classPrivateFieldGet(_hot, this).runHooks('beforeStretchingColumnWidth', columnWidth, columnVisualIndex);
159
- }