handsontable 0.0.0-next-3c64093-20240723 → 0.0.0-next-5b6e8d3-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 (59) 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 +2513 -1984
  42. package/dist/handsontable.full.min.css +2 -2
  43. package/dist/handsontable.full.min.js +148 -148
  44. package/dist/handsontable.js +2514 -1985
  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/copyPaste/copyPaste.js +8 -14
  53. package/plugins/copyPaste/copyPaste.mjs +8 -14
  54. package/plugins/manualRowResize/manualRowResize.js +1 -1
  55. package/plugins/manualRowResize/manualRowResize.mjs +2 -2
  56. package/utils/ghostTable.js +11 -9
  57. package/utils/ghostTable.mjs +12 -10
  58. package/3rdparty/walkontable/src/calculator/constants.js +0 -26
  59. package/3rdparty/walkontable/src/calculator/constants.mjs +0 -23
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-3c64093-20240723";
137
+ const hotVersion = "0.0.0-next-5b6e8d3-20240724";
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-3c64093-20240723";
127
+ const hotVersion = "0.0.0-next-5b6e8d3-20240724";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
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-3c64093-20240723",
13
+ "version": "0.0.0-next-5b6e8d3-20240724",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -482,7 +482,7 @@ class AutoColumnSize extends _base.BasePlugin {
482
482
  if (width === undefined) {
483
483
  width = this.columnWidthsMap.getValueAtIndex(this.hot.toPhysicalColumn(column));
484
484
  if (keepMinimum && typeof width === 'number') {
485
- width = Math.max(width, _src.ViewportColumnsCalculator.DEFAULT_WIDTH);
485
+ width = Math.max(width, _src.DEFAULT_COLUMN_WIDTH);
486
486
  }
487
487
  }
488
488
  return width;
@@ -17,7 +17,7 @@ import { isObject, hasOwnProperty } from "../../helpers/object.mjs";
17
17
  import { valueAccordingPercent, rangeEach } from "../../helpers/number.mjs";
18
18
  import SamplesGenerator from "../../utils/samplesGenerator.mjs";
19
19
  import { isPercentValue } from "../../helpers/string.mjs";
20
- import { ViewportColumnsCalculator } from "../../3rdparty/walkontable/src/index.mjs";
20
+ import { DEFAULT_COLUMN_WIDTH } from "../../3rdparty/walkontable/src/index.mjs";
21
21
  import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
22
22
  Hooks.getSingleton().register('modifyAutoColumnSizeSeed');
23
23
  export const PLUGIN_KEY = 'autoColumnSize';
@@ -478,7 +478,7 @@ export class AutoColumnSize extends BasePlugin {
478
478
  if (width === undefined) {
479
479
  width = this.columnWidthsMap.getValueAtIndex(this.hot.toPhysicalColumn(column));
480
480
  if (keepMinimum && typeof width === 'number') {
481
- width = Math.max(width, ViewportColumnsCalculator.DEFAULT_WIDTH);
481
+ width = Math.max(width, DEFAULT_COLUMN_WIDTH);
482
482
  }
483
483
  }
484
484
  return width;
@@ -553,12 +553,11 @@ class CopyPaste extends _base.BasePlugin {
553
553
  * @private
554
554
  */
555
555
  onCopy(event) {
556
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
557
- return;
558
- }
559
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
556
+ var _event$target;
557
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || (_event$target = event.target) !== null && _event$target !== void 0 && _event$target.hasAttribute('data-hot-input') || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
560
558
  return;
561
559
  }
560
+ event.preventDefault();
562
561
  this.setCopyableText();
563
562
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
564
563
  const data = this.getRangedData(this.copyableRanges);
@@ -576,7 +575,6 @@ class CopyPaste extends _base.BasePlugin {
576
575
  this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);
577
576
  }
578
577
  _classPrivateFieldSet(_copyMode, this, 'cells-only');
579
- event.preventDefault();
580
578
  }
581
579
 
582
580
  /**
@@ -586,12 +584,11 @@ class CopyPaste extends _base.BasePlugin {
586
584
  * @private
587
585
  */
588
586
  onCut(event) {
589
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
590
- return;
591
- }
592
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
587
+ var _event$target2;
588
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || (_event$target2 = event.target) !== null && _event$target2 !== void 0 && _event$target2.hasAttribute('data-hot-input') || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
593
589
  return;
594
590
  }
591
+ event.preventDefault();
595
592
  this.setCopyableText();
596
593
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
597
594
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -608,7 +605,6 @@ class CopyPaste extends _base.BasePlugin {
608
605
  this.hot.emptySelectedCells('CopyPaste.cut');
609
606
  this.hot.runHooks('afterCut', rangedData, this.copyableRanges);
610
607
  }
611
- event.preventDefault();
612
608
  }
613
609
 
614
610
  /**
@@ -618,10 +614,8 @@ class CopyPaste extends _base.BasePlugin {
618
614
  * @private
619
615
  */
620
616
  onPaste(event) {
621
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
622
- return;
623
- }
624
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
617
+ var _event$target3;
618
+ if (!this.hot.isListening() || this.isEditorOpened() || (_event$target3 = event.target) !== null && _event$target3 !== void 0 && _event$target3.hasAttribute('data-hot-input') || !this.hot.getSelected() || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
625
619
  return;
626
620
  }
627
621
  event.preventDefault();
@@ -549,12 +549,11 @@ export class CopyPaste extends BasePlugin {
549
549
  * @private
550
550
  */
551
551
  onCopy(event) {
552
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
553
- return;
554
- }
555
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
552
+ var _event$target;
553
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || (_event$target = event.target) !== null && _event$target !== void 0 && _event$target.hasAttribute('data-hot-input') || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
556
554
  return;
557
555
  }
556
+ event.preventDefault();
558
557
  this.setCopyableText();
559
558
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
560
559
  const data = this.getRangedData(this.copyableRanges);
@@ -572,7 +571,6 @@ export class CopyPaste extends BasePlugin {
572
571
  this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);
573
572
  }
574
573
  _classPrivateFieldSet(_copyMode, this, 'cells-only');
575
- event.preventDefault();
576
574
  }
577
575
 
578
576
  /**
@@ -582,12 +580,11 @@ export class CopyPaste extends BasePlugin {
582
580
  * @private
583
581
  */
584
582
  onCut(event) {
585
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
586
- return;
587
- }
588
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
583
+ var _event$target2;
584
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || (_event$target2 = event.target) !== null && _event$target2 !== void 0 && _event$target2.hasAttribute('data-hot-input') || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
589
585
  return;
590
586
  }
587
+ event.preventDefault();
591
588
  this.setCopyableText();
592
589
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
593
590
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -604,7 +601,6 @@ export class CopyPaste extends BasePlugin {
604
601
  this.hot.emptySelectedCells('CopyPaste.cut');
605
602
  this.hot.runHooks('afterCut', rangedData, this.copyableRanges);
606
603
  }
607
- event.preventDefault();
608
604
  }
609
605
 
610
606
  /**
@@ -614,10 +610,8 @@ export class CopyPaste extends BasePlugin {
614
610
  * @private
615
611
  */
616
612
  onPaste(event) {
617
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
618
- return;
619
- }
620
- if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
613
+ var _event$target3;
614
+ if (!this.hot.isListening() || this.isEditorOpened() || (_event$target3 = event.target) !== null && _event$target3 !== void 0 && _event$target3.hasAttribute('data-hot-input') || !this.hot.getSelected() || !this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
621
615
  return;
622
616
  }
623
617
  event.preventDefault();
@@ -227,7 +227,7 @@ class ManualRowResize extends _base.BasePlugin {
227
227
  */
228
228
  setManualSize(row, height) {
229
229
  const physicalRow = this.hot.toPhysicalRow(row);
230
- const newHeight = Math.max(height, _src.ViewportRowsCalculator.DEFAULT_HEIGHT);
230
+ const newHeight = Math.max(height, _src.DEFAULT_ROW_HEIGHT);
231
231
  _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
232
232
  return newHeight;
233
233
  }
@@ -11,7 +11,7 @@ import { addClass, closest, hasClass, removeClass, outerWidth, isDetached } from
11
11
  import { arrayEach } from "../../helpers/array.mjs";
12
12
  import { rangeEach } from "../../helpers/number.mjs";
13
13
  import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
14
- import { ViewportRowsCalculator } from "../../3rdparty/walkontable/src/index.mjs"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
14
+ import { DEFAULT_ROW_HEIGHT } from "../../3rdparty/walkontable/src/index.mjs"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
15
15
  export const PLUGIN_KEY = 'manualRowResize';
16
16
  export const PLUGIN_PRIORITY = 30;
17
17
  const PERSISTENT_STATE_KEY = 'manualRowHeights';
@@ -222,7 +222,7 @@ export class ManualRowResize extends BasePlugin {
222
222
  */
223
223
  setManualSize(row, height) {
224
224
  const physicalRow = this.hot.toPhysicalRow(row);
225
- const newHeight = Math.max(height, ViewportRowsCalculator.DEFAULT_HEIGHT);
225
+ const newHeight = Math.max(height, DEFAULT_ROW_HEIGHT);
226
226
  _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
227
227
  return newHeight;
228
228
  }
@@ -148,8 +148,15 @@ class GhostTable {
148
148
  this.injectTable();
149
149
  }
150
150
  (0, _array.arrayEach)(this.rows, row => {
151
+ // In cases when the cell's content produces the height with a decimal point, the height
152
+ // needs to be rounded up to make sure that there will be a space for the cell's content.
153
+ // The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
154
+ const {
155
+ height
156
+ } = row.table.getBoundingClientRect();
157
+
151
158
  // -1 <- reduce border-top from table
152
- callback(row.row, (0, _element.outerHeight)(row.table) - 1);
159
+ callback(row.row, Math.ceil(height) - 1);
153
160
  });
154
161
  }
155
162
 
@@ -163,14 +170,9 @@ class GhostTable {
163
170
  this.injectTable();
164
171
  }
165
172
  (0, _array.arrayEach)(this.columns, column => {
166
- // The GhostTable class is responsible for calculating the columns' width based on the
167
- // contents rendered in the cells. In some cases, when the column's width calculated by
168
- // the browser is a decimal point with a fractional component. For example, 35.32px.
169
- // The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
170
- // The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
171
- // would cause the text to not fit in the cell, thus increasing the row height.
172
- // That's why the `getBoundingClientRect` method is used. The method returns the number
173
- // that is rounded up to make sure that there will be a space for the cell's content.
173
+ // In cases when the cell's content produces the width with a decimal point, the width
174
+ // needs to be rounded up to make sure that there will be a space for the cell's content.
175
+ // The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
174
176
  const {
175
177
  width
176
178
  } = column.table.getBoundingClientRect();
@@ -3,7 +3,7 @@ import "core-js/modules/es.array.push.js";
3
3
  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; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  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); }
6
- import { addClass, outerHeight } from "./../helpers/dom/element.mjs";
6
+ import { addClass } from "./../helpers/dom/element.mjs";
7
7
  import { arrayEach } from "./../helpers/array.mjs";
8
8
  /**
9
9
  * @class GhostTable
@@ -145,8 +145,15 @@ class GhostTable {
145
145
  this.injectTable();
146
146
  }
147
147
  arrayEach(this.rows, row => {
148
+ // In cases when the cell's content produces the height with a decimal point, the height
149
+ // needs to be rounded up to make sure that there will be a space for the cell's content.
150
+ // The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
151
+ const {
152
+ height
153
+ } = row.table.getBoundingClientRect();
154
+
148
155
  // -1 <- reduce border-top from table
149
- callback(row.row, outerHeight(row.table) - 1);
156
+ callback(row.row, Math.ceil(height) - 1);
150
157
  });
151
158
  }
152
159
 
@@ -160,14 +167,9 @@ class GhostTable {
160
167
  this.injectTable();
161
168
  }
162
169
  arrayEach(this.columns, column => {
163
- // The GhostTable class is responsible for calculating the columns' width based on the
164
- // contents rendered in the cells. In some cases, when the column's width calculated by
165
- // the browser is a decimal point with a fractional component. For example, 35.32px.
166
- // The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
167
- // The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
168
- // would cause the text to not fit in the cell, thus increasing the row height.
169
- // That's why the `getBoundingClientRect` method is used. The method returns the number
170
- // that is rounded up to make sure that there will be a space for the cell's content.
170
+ // In cases when the cell's content produces the width with a decimal point, the width
171
+ // needs to be rounded up to make sure that there will be a space for the cell's content.
172
+ // The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
171
173
  const {
172
174
  width
173
175
  } = column.table.getBoundingClientRect();
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- /**
5
- * Render type calculation calculates how many DOM nodes should be created and where placed
6
- * based on `startRow` and `endRow` properties.
7
- *
8
- * @type {number}
9
- */
10
- const RENDER_TYPE = exports.RENDER_TYPE = 1;
11
- /**
12
- * Fully visible type calculation calculates rows that are fully visible in the viewport.
13
- * This type of calculation is used in scrolling by arrow keys navigation.
14
- *
15
- * @type {number}
16
- */
17
- const FULLY_VISIBLE_TYPE = exports.FULLY_VISIBLE_TYPE = 2;
18
- /**
19
- * Partially visible type calculation calculates rows that are fully and partially visible in
20
- * the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
21
- * calculated in render calculator. If checking met the criteria slow render is
22
- * performed (which render calculator with new data).
23
- *
24
- * @type {number}
25
- */
26
- const PARTIALLY_VISIBLE_TYPE = exports.PARTIALLY_VISIBLE_TYPE = 3;
@@ -1,23 +0,0 @@
1
- /**
2
- * Render type calculation calculates how many DOM nodes should be created and where placed
3
- * based on `startRow` and `endRow` properties.
4
- *
5
- * @type {number}
6
- */
7
- export const RENDER_TYPE = 1;
8
- /**
9
- * Fully visible type calculation calculates rows that are fully visible in the viewport.
10
- * This type of calculation is used in scrolling by arrow keys navigation.
11
- *
12
- * @type {number}
13
- */
14
- export const FULLY_VISIBLE_TYPE = 2;
15
- /**
16
- * Partially visible type calculation calculates rows that are fully and partially visible in
17
- * the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
18
- * calculated in render calculator. If checking met the criteria slow render is
19
- * performed (which render calculator with new data).
20
- *
21
- * @type {number}
22
- */
23
- export const PARTIALLY_VISIBLE_TYPE = 3;