handsontable 0.0.0-next-86a38ef-20240724 → 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.

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-86a38ef-20240724";
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-86a38ef-20240724";
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-86a38ef-20240724",
13
+ "version": "0.0.0-next-5b6e8d3-20240724",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -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();
@@ -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();