handsontable 0.0.0-next-3c64093-20240723 → 0.0.0-next-86a38ef-20240724

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

Potentially problematic release.


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

Files changed (55) hide show
  1. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +126 -0
  2. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +122 -0
  3. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +119 -0
  4. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +115 -0
  5. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +125 -0
  6. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +121 -0
  7. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +118 -0
  8. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +114 -0
  9. package/3rdparty/walkontable/src/calculator/{renderAllColumns.js → calculationType/renderedAllColumns.js} +32 -9
  10. package/3rdparty/walkontable/src/calculator/{renderAllColumns.mjs → calculationType/renderedAllColumns.mjs} +31 -8
  11. package/3rdparty/walkontable/src/calculator/{renderAllRows.js → calculationType/renderedAllRows.js} +32 -9
  12. package/3rdparty/walkontable/src/calculator/{renderAllRows.mjs → calculationType/renderedAllRows.mjs} +31 -8
  13. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +37 -0
  14. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +33 -0
  15. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +37 -0
  16. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +33 -0
  17. package/3rdparty/walkontable/src/calculator/index.js +18 -17
  18. package/3rdparty/walkontable/src/calculator/index.mjs +11 -6
  19. package/3rdparty/walkontable/src/calculator/viewportBase.js +92 -0
  20. package/3rdparty/walkontable/src/calculator/viewportBase.mjs +88 -0
  21. package/3rdparty/walkontable/src/calculator/viewportColumns.js +51 -145
  22. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +51 -145
  23. package/3rdparty/walkontable/src/calculator/viewportRows.js +59 -141
  24. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +59 -141
  25. package/3rdparty/walkontable/src/index.js +2 -0
  26. package/3rdparty/walkontable/src/index.mjs +2 -2
  27. package/3rdparty/walkontable/src/table.js +5 -11
  28. package/3rdparty/walkontable/src/table.mjs +5 -11
  29. package/3rdparty/walkontable/src/utils/column.js +2 -1
  30. package/3rdparty/walkontable/src/utils/column.mjs +2 -1
  31. package/3rdparty/walkontable/src/utils/columnStretching.js +10 -19
  32. package/3rdparty/walkontable/src/utils/columnStretching.mjs +10 -19
  33. package/3rdparty/walkontable/src/viewport.js +35 -46
  34. package/3rdparty/walkontable/src/viewport.mjs +36 -47
  35. package/base.js +2 -2
  36. package/base.mjs +2 -2
  37. package/core.js +1 -1
  38. package/core.mjs +2 -2
  39. package/dist/handsontable.css +2 -2
  40. package/dist/handsontable.full.css +2 -2
  41. package/dist/handsontable.full.js +2494 -1961
  42. package/dist/handsontable.full.min.css +2 -2
  43. package/dist/handsontable.full.min.js +148 -148
  44. package/dist/handsontable.js +2495 -1962
  45. package/dist/handsontable.min.css +2 -2
  46. package/dist/handsontable.min.js +32 -32
  47. package/helpers/mixed.js +1 -1
  48. package/helpers/mixed.mjs +1 -1
  49. package/package.json +1 -1
  50. package/plugins/autoColumnSize/autoColumnSize.js +1 -1
  51. package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
  52. package/plugins/manualRowResize/manualRowResize.js +1 -1
  53. package/plugins/manualRowResize/manualRowResize.mjs +2 -2
  54. package/3rdparty/walkontable/src/calculator/constants.js +0 -26
  55. package/3rdparty/walkontable/src/calculator/constants.mjs +0 -23
@@ -1,6 +1,6 @@
1
1
  import { getScrollbarWidth, getStyle, offset, outerHeight, outerWidth } from "../../../helpers/dom/element.mjs";
2
2
  import { objectEach } from "../../../helpers/object.mjs";
3
- import { RENDER_TYPE, FULLY_VISIBLE_TYPE, PARTIALLY_VISIBLE_TYPE, RenderAllColumnsCalculator, RenderAllRowsCalculator, ViewportColumnsCalculator, ViewportRowsCalculator } from "./calculator/index.mjs";
3
+ import { FullyVisibleColumnsCalculationType, FullyVisibleRowsCalculationType, PartiallyVisibleColumnsCalculationType, PartiallyVisibleRowsCalculationType, RenderedAllColumnsCalculationType, RenderedAllRowsCalculationType, RenderedColumnsCalculationType, RenderedRowsCalculationType, ViewportColumnsCalculator, ViewportRowsCalculator } from "./calculator/index.mjs";
4
4
  /**
5
5
  * @class Viewport
6
6
  */
@@ -28,6 +28,8 @@ class Viewport {
28
28
  this.rowHeaderWidth = NaN;
29
29
  this.rowsVisibleCalculator = null;
30
30
  this.columnsVisibleCalculator = null;
31
+ this.rowsCalculatorTypes = new Map([['rendered', () => this.wtSettings.getSetting('renderAllRows') ? new RenderedAllRowsCalculationType() : new RenderedRowsCalculationType()], ['fullyVisible', () => new FullyVisibleRowsCalculationType()], ['partiallyVisible', () => new PartiallyVisibleRowsCalculationType()]]);
32
+ this.columnsCalculatorTypes = new Map([['rendered', () => this.wtSettings.getSetting('renderAllColumns') ? new RenderedAllColumnsCalculationType() : new RenderedColumnsCalculationType()], ['fullyVisible', () => new FullyVisibleColumnsCalculationType()], ['partiallyVisible', () => new PartiallyVisibleColumnsCalculationType()]]);
31
33
  this.eventManager = eventManager;
32
34
  this.eventManager.addEventListener(this.domBindings.rootWindow, 'resize', () => {
33
35
  this.clientHeight = this.getWorkspaceHeight();
@@ -238,25 +240,20 @@ class Viewport {
238
240
  }
239
241
 
240
242
  /**
241
- * Creates:
242
- * - rowsRenderCalculator (before draw, to qualify rows for rendering)
243
- * - rowsVisibleCalculator (after draw, to measure which rows are actually visible).
243
+ * Creates rows calculators. The type of the calculations can be chosen from the list:
244
+ * - 'rendered' Calculates rows that should be rendered within the current table's viewport;
245
+ * - 'fullyVisible' Calculates rows that are fully visible (used mostly for scrolling purposes);
246
+ * - 'partiallyVisible' Calculates rows that are partially visible (used mostly for scrolling purposes).
244
247
  *
245
- * @param {number} calculationType The render type ID, which determines for what type of
246
- * calculation calculator is created.
248
+ * @param {'rendered' | 'fullyVisible' | 'partiallyVisible'} calculatorTypes The list of the calculation types.
247
249
  * @returns {ViewportRowsCalculator}
248
250
  */
249
251
  createRowsCalculator() {
250
- let calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RENDER_TYPE;
252
+ let calculatorTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['rendered', 'fullyVisible', 'partiallyVisible'];
251
253
  const {
252
254
  wtSettings,
253
255
  wtTable
254
256
  } = this;
255
- if (wtSettings.getSetting('renderAllRows') && calculationType === RENDER_TYPE) {
256
- return new RenderAllRowsCalculator({
257
- totalRows: wtSettings.getSetting('totalRows')
258
- });
259
- }
260
257
  let height = this.getViewportHeight();
261
258
  let scrollbarHeight;
262
259
  let fixedRowsHeight;
@@ -280,36 +277,31 @@ class Viewport {
280
277
  scrollbarHeight = getScrollbarWidth(this.domBindings.rootDocument);
281
278
  }
282
279
  return new ViewportRowsCalculator({
280
+ calculationTypes: calculatorTypes.map(type => [type, this.rowsCalculatorTypes.get(type)()]),
283
281
  viewportHeight: height,
284
282
  scrollOffset: pos,
285
283
  totalRows: wtSettings.getSetting('totalRows'),
286
284
  rowHeightFn: sourceRow => wtTable.getRowHeight(sourceRow),
287
285
  overrideFn: wtSettings.getSettingPure('viewportRowCalculatorOverride'),
288
- calculationType,
289
286
  horizontalScrollbarHeight: scrollbarHeight
290
287
  });
291
288
  }
292
289
 
293
290
  /**
294
- * Creates:
295
- * - columnsRenderCalculator (before draw, to qualify columns for rendering)
296
- * - columnsVisibleCalculator (after draw, to measure which columns are actually visible).
291
+ * Creates columns calculators. The type of the calculations can be chosen from the list:
292
+ * - 'rendered' Calculates columns that should be rendered within the current table's viewport;
293
+ * - 'fullyVisible' Calculates columns that are fully visible (used mostly for scrolling purposes);
294
+ * - 'partiallyVisible' Calculates columns that are partially visible (used mostly for scrolling purposes).
297
295
  *
298
- * @param {number} calculationType The render type ID, which determines for what type of
299
- * calculation calculator is created.
296
+ * @param {'rendered' | 'fullyVisible' | 'partiallyVisible'} calculatorTypes The list of the calculation types.
300
297
  * @returns {ViewportColumnsCalculator}
301
298
  */
302
299
  createColumnsCalculator() {
303
- let calculationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RENDER_TYPE;
300
+ let calculatorTypes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['rendered', 'fullyVisible', 'partiallyVisible'];
304
301
  const {
305
302
  wtSettings,
306
303
  wtTable
307
304
  } = this;
308
- if (wtSettings.getSetting('renderAllColumns') && calculationType === RENDER_TYPE) {
309
- return new RenderAllColumnsCalculator({
310
- totalColumns: wtSettings.getSetting('totalColumns')
311
- });
312
- }
313
305
  let width = this.getViewportWidth();
314
306
  let pos = Math.abs(this.dataAccessObject.inlineStartScrollPosition) - this.dataAccessObject.inlineStartParentOffset;
315
307
  this.columnHeaderHeight = NaN;
@@ -323,12 +315,12 @@ class Viewport {
323
315
  width -= getScrollbarWidth(this.domBindings.rootDocument);
324
316
  }
325
317
  return new ViewportColumnsCalculator({
318
+ calculationTypes: calculatorTypes.map(type => [type, this.columnsCalculatorTypes.get(type)()]),
326
319
  viewportWidth: width,
327
320
  scrollOffset: pos,
328
321
  totalColumns: wtSettings.getSetting('totalColumns'),
329
322
  columnWidthFn: sourceCol => wtTable.getColumnWidth(sourceCol),
330
323
  overrideFn: wtSettings.getSettingPure('viewportColumnCalculatorOverride'),
331
- calculationType,
332
324
  inlineStartOffset: this.dataAccessObject.inlineStartParentOffset
333
325
  });
334
326
  }
@@ -341,46 +333,43 @@ class Viewport {
341
333
  * If `false` or `undefined`, will perform a full redraw.
342
334
  * @returns {boolean} The fastDraw value, possibly modified.
343
335
  */
344
- createRenderCalculators() {
336
+ createCalculators() {
345
337
  let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
346
338
  const {
347
339
  wtSettings
348
340
  } = this;
341
+ const rowsCalculator = this.createRowsCalculator();
342
+ const columnsCalculator = this.createColumnsCalculator();
349
343
  if (fastDraw && !wtSettings.getSetting('renderAllRows')) {
350
- const proposedRowsVisibleCalculator = this.createRowsCalculator(FULLY_VISIBLE_TYPE);
344
+ const proposedRowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
351
345
  fastDraw = this.areAllProposedVisibleRowsAlreadyRendered(proposedRowsVisibleCalculator);
352
346
  }
353
347
  if (fastDraw && !wtSettings.getSetting('renderAllColumns')) {
354
- const proposedColumnsVisibleCalculator = this.createColumnsCalculator(FULLY_VISIBLE_TYPE);
348
+ const proposedColumnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
355
349
  fastDraw = this.areAllProposedVisibleColumnsAlreadyRendered(proposedColumnsVisibleCalculator);
356
350
  }
357
351
  if (!fastDraw) {
358
- this.rowsRenderCalculator = this.createRowsCalculator(RENDER_TYPE);
359
- this.columnsRenderCalculator = this.createColumnsCalculator(RENDER_TYPE);
352
+ this.rowsRenderCalculator = rowsCalculator.getResultsFor('rendered');
353
+ this.columnsRenderCalculator = columnsCalculator.getResultsFor('rendered');
360
354
  }
361
-
362
- // delete temporarily to make sure that renderers always use rowsRenderCalculator, not rowsVisibleCalculator
363
- this.rowsVisibleCalculator = null;
364
- this.columnsVisibleCalculator = null;
355
+ this.rowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
356
+ this.columnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
357
+ this.rowsPartiallyVisibleCalculator = rowsCalculator.getResultsFor('partiallyVisible');
358
+ this.columnsPartiallyVisibleCalculator = columnsCalculator.getResultsFor('partiallyVisible');
365
359
  return fastDraw;
366
360
  }
367
361
 
368
362
  /**
369
- * Creates rowsVisibleCalculator and columnsVisibleCalculator (after draw, to determine what are
370
- * the actually fully visible rows and columns).
363
+ * Creates rows and columns calculators (after draw, to determine what are
364
+ * the actually fully visible and partially visible rows and columns).
371
365
  */
372
366
  createVisibleCalculators() {
373
- this.rowsVisibleCalculator = this.createRowsCalculator(FULLY_VISIBLE_TYPE);
374
- this.columnsVisibleCalculator = this.createColumnsCalculator(FULLY_VISIBLE_TYPE);
375
- }
376
-
377
- /**
378
- * Creates rowsPartiallyVisibleCalculator and columnsPartiallyVisibleCalculator (after draw, to determine what are
379
- * the actually partially visible rows and columns).
380
- */
381
- createPartiallyVisibleCalculators() {
382
- this.rowsPartiallyVisibleCalculator = this.createRowsCalculator(PARTIALLY_VISIBLE_TYPE);
383
- this.columnsPartiallyVisibleCalculator = this.createColumnsCalculator(PARTIALLY_VISIBLE_TYPE);
367
+ const rowsCalculator = this.createRowsCalculator(['fullyVisible', 'partiallyVisible']);
368
+ const columnsCalculator = this.createColumnsCalculator(['fullyVisible', 'partiallyVisible']);
369
+ this.rowsVisibleCalculator = rowsCalculator.getResultsFor('fullyVisible');
370
+ this.columnsVisibleCalculator = columnsCalculator.getResultsFor('fullyVisible');
371
+ this.rowsPartiallyVisibleCalculator = rowsCalculator.getResultsFor('partiallyVisible');
372
+ this.columnsPartiallyVisibleCalculator = columnsCalculator.getResultsFor('partiallyVisible');
384
373
  }
385
374
 
386
375
  /**
package/base.js CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _pluginHooks.default.getSingleton();
45
45
  Handsontable.CellCoords = _src.CellCoords;
46
46
  Handsontable.CellRange = _src.CellRange;
47
47
  Handsontable.packageName = 'handsontable';
48
- Handsontable.buildDate = "23/07/2024 10:50:26";
49
- Handsontable.version = "0.0.0-next-3c64093-20240723";
48
+ Handsontable.buildDate = "24/07/2024 09:30:53";
49
+ Handsontable.version = "0.0.0-next-86a38ef-20240724";
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 = "23/07/2024 10:50:32";
39
- Handsontable.version = "0.0.0-next-3c64093-20240723";
38
+ Handsontable.buildDate = "24/07/2024 09:30:59";
39
+ Handsontable.version = "0.0.0-next-86a38ef-20240724";
40
40
  Handsontable.languages = {
41
41
  dictionaryKeys,
42
42
  getLanguageDictionary,
package/core.js CHANGED
@@ -3501,7 +3501,7 @@ function Core(rootElement, userSettings) {
3501
3501
  let width = instance._getColWidthFromSettings(column);
3502
3502
  width = instance.runHooks('modifyColWidth', width, column);
3503
3503
  if (width === undefined) {
3504
- width = _src.ViewportColumnsCalculator.DEFAULT_WIDTH;
3504
+ width = _src.DEFAULT_COLUMN_WIDTH;
3505
3505
  }
3506
3506
  return width;
3507
3507
  };
package/core.mjs CHANGED
@@ -29,7 +29,7 @@ import DataSource from "./dataMap/dataSource.mjs";
29
29
  import { spreadsheetColumnLabel } from "./helpers/data.mjs";
30
30
  import { IndexMapper } from "./translations/index.mjs";
31
31
  import { registerAsRootInstance, hasValidParameter, isRootInstance } from "./utils/rootInstance.mjs";
32
- import { ViewportColumnsCalculator } from "./3rdparty/walkontable/src/index.mjs";
32
+ import { DEFAULT_COLUMN_WIDTH } from "./3rdparty/walkontable/src/index.mjs";
33
33
  import Hooks from "./pluginHooks.mjs";
34
34
  import { hasLanguageDictionary, getValidLanguageCode, getTranslatedPhrase } from "./i18n/registry.mjs";
35
35
  import { warnUserAboutLanguageRegistration, normalizeLanguageCode } from "./i18n/utils.mjs";
@@ -3496,7 +3496,7 @@ export default function Core(rootElement, userSettings) {
3496
3496
  let width = instance._getColWidthFromSettings(column);
3497
3497
  width = instance.runHooks('modifyColWidth', width, column);
3498
3498
  if (width === undefined) {
3499
- width = ViewportColumnsCalculator.DEFAULT_WIDTH;
3499
+ width = DEFAULT_COLUMN_WIDTH;
3500
3500
  }
3501
3501
  return width;
3502
3502
  };
@@ -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-3c64093-20240723
29
- * Release date: 11/06/2024 (built at 23/07/2024 10:50:36)
28
+ * Version: 0.0.0-next-86a38ef-20240724
29
+ * Release date: 11/06/2024 (built at 24/07/2024 09:31:03)
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-3c64093-20240723
29
- * Release date: 11/06/2024 (built at 23/07/2024 10:50:36)
28
+ * Version: 0.0.0-next-86a38ef-20240724
29
+ * Release date: 11/06/2024 (built at 24/07/2024 09:31:03)
30
30
  */
31
31
  /**
32
32
  * Fix for bootstrap styles