handsontable 0.0.0-next-d8141fb-20231207 → 0.0.0-next-abfe462-20231207

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/editorManager.js CHANGED
@@ -149,6 +149,7 @@ class EditorManager {
149
149
  * Prepare text input to be displayed at given grid cell.
150
150
  */
151
151
  prepareEditor() {
152
+ var _this$hot$getSelected;
152
153
  if (this.lock) {
153
154
  return;
154
155
  }
@@ -160,10 +161,8 @@ class EditorManager {
160
161
  });
161
162
  return;
162
163
  }
163
- const {
164
- highlight
165
- } = this.hot.getSelectedRangeLast();
166
- if (highlight.isHeader()) {
164
+ const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
165
+ if (!highlight || highlight.isHeader()) {
167
166
  return;
168
167
  }
169
168
  const {
package/editorManager.mjs CHANGED
@@ -145,6 +145,7 @@ class EditorManager {
145
145
  * Prepare text input to be displayed at given grid cell.
146
146
  */
147
147
  prepareEditor() {
148
+ var _this$hot$getSelected;
148
149
  if (this.lock) {
149
150
  return;
150
151
  }
@@ -156,10 +157,8 @@ class EditorManager {
156
157
  });
157
158
  return;
158
159
  }
159
- const {
160
- highlight
161
- } = this.hot.getSelectedRangeLast();
162
- if (highlight.isHeader()) {
160
+ const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
161
+ if (!highlight || highlight.isHeader()) {
163
162
  return;
164
163
  }
165
164
  const {
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-d8141fb-20231207";
137
+ const hotVersion = "0.0.0-next-abfe462-20231207";
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-d8141fb-20231207";
127
+ const hotVersion = "0.0.0-next-abfe462-20231207";
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-d8141fb-20231207",
13
+ "version": "0.0.0-next-abfe462-20231207",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -86,11 +86,13 @@ var _copyMode = /*#__PURE__*/new WeakMap();
86
86
  var _isTriggeredByCopy = /*#__PURE__*/new WeakMap();
87
87
  var _isTriggeredByCut = /*#__PURE__*/new WeakMap();
88
88
  var _copyableRangesFactory = /*#__PURE__*/new WeakMap();
89
+ var _preventViewportScrollOnPaste = /*#__PURE__*/new WeakMap();
89
90
  var _ensureClipboardEventsGetTriggered = /*#__PURE__*/new WeakSet();
90
91
  var _countCopiedHeaders = /*#__PURE__*/new WeakSet();
91
92
  var _addContentEditableToHighlightedCell = /*#__PURE__*/new WeakSet();
92
93
  var _removeContentEditableFromHighlightedCell = /*#__PURE__*/new WeakSet();
93
94
  var _onAfterContextMenuDefaultOptions = /*#__PURE__*/new WeakSet();
95
+ var _onAfterSelection = /*#__PURE__*/new WeakSet();
94
96
  var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
95
97
  var _onSafariMouseEnter = /*#__PURE__*/new WeakSet();
96
98
  var _onSafariMouseLeave = /*#__PURE__*/new WeakSet();
@@ -116,6 +118,16 @@ class CopyPaste extends _base.BasePlugin {
116
118
  * Force focus on focusableElement after end of the selection.
117
119
  */
118
120
  _classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
121
+ /**
122
+ * Disables the viewport scroll after pasting the data.
123
+ *
124
+ * @param {number} fromRow Selection start row visual index.
125
+ * @param {number} fromColumn Selection start column visual index.
126
+ * @param {number} toRow Selection end row visual index.
127
+ * @param {number} toColumn Selection end column visual index.
128
+ * @param {object} preventScrolling Object with `value` property. If `true`, the viewport scroll will be prevented.
129
+ */
130
+ _classPrivateMethodInitSpec(this, _onAfterSelection);
119
131
  /**
120
132
  * Add copy and cut options to the Context Menu.
121
133
  *
@@ -255,6 +267,15 @@ class CopyPaste extends _base.BasePlugin {
255
267
  countColumnHeaders: () => this.hot.view.getColumnHeadersCount()
256
268
  })
257
269
  });
270
+ /**
271
+ * Flag that indicates if the viewport scroll should be prevented after pasting the data.
272
+ *
273
+ * @type {boolean}
274
+ */
275
+ _classPrivateFieldInitSpec(this, _preventViewportScrollOnPaste, {
276
+ writable: true,
277
+ value: false
278
+ });
258
279
  /**
259
280
  * Ranges of the cells coordinates, which should be used to copy/cut/paste actions.
260
281
  *
@@ -306,6 +327,12 @@ class CopyPaste extends _base.BasePlugin {
306
327
  this.uiContainer = (_settings$uiContainer = settings.uiContainer) !== null && _settings$uiContainer !== void 0 ? _settings$uiContainer : this.uiContainer;
307
328
  }
308
329
  this.addHook('afterContextMenuDefaultOptions', options => _classPrivateMethodGet(this, _onAfterContextMenuDefaultOptions, _onAfterContextMenuDefaultOptions2).call(this, options));
330
+ this.addHook('afterSelection', function () {
331
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
332
+ args[_key] = arguments[_key];
333
+ }
334
+ return _classPrivateMethodGet(_this, _onAfterSelection, _onAfterSelection2).call(_this, ...args);
335
+ });
309
336
  this.addHook('afterSelectionEnd', () => _classPrivateMethodGet(this, _onAfterSelectionEnd, _onAfterSelectionEnd2).call(this));
310
337
  this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {
311
338
  return _this.onCopy(...arguments);
@@ -320,14 +347,14 @@ class CopyPaste extends _base.BasePlugin {
320
347
  // Without this workaround Safari (tested on Safari@16.5.2) does allow copying/cutting from the browser menu.
321
348
  if ((0, _browser.isSafari)()) {
322
349
  this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseenter', function () {
323
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
324
- args[_key] = arguments[_key];
350
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
351
+ args[_key2] = arguments[_key2];
325
352
  }
326
353
  return _classPrivateMethodGet(_this, _onSafariMouseEnter, _onSafariMouseEnter2).call(_this, ...args);
327
354
  });
328
355
  this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseleave', function () {
329
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
330
- args[_key2] = arguments[_key2];
356
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
357
+ args[_key3] = arguments[_key3];
331
358
  }
332
359
  return _classPrivateMethodGet(_this, _onSafariMouseLeave, _onSafariMouseLeave2).call(_this, ...args);
333
360
  });
@@ -597,6 +624,7 @@ class CopyPaste extends _base.BasePlugin {
597
624
  }
598
625
  newRows.push(newRow);
599
626
  }
627
+ _classPrivateFieldSet(this, _preventViewportScrollOnPaste, true);
600
628
  this.hot.populateFromArray(startRow, startColumn, newRows, undefined, undefined, 'CopyPaste.paste', this.pasteMode);
601
629
  return [startRow, startColumn, lastVisualRow, lastVisualColumn];
602
630
  }
@@ -790,6 +818,12 @@ function _onAfterContextMenuDefaultOptions2(options) {
790
818
  }
791
819
  options.items.push((0, _cut.default)(this));
792
820
  }
821
+ function _onAfterSelection2(fromRow, fromColumn, toRow, toColumn, preventScrolling) {
822
+ if (_classPrivateFieldGet(this, _preventViewportScrollOnPaste)) {
823
+ preventScrolling.value = true;
824
+ }
825
+ _classPrivateFieldSet(this, _preventViewportScrollOnPaste, false);
826
+ }
793
827
  function _onAfterSelectionEnd2() {
794
828
  if (this.isEditorOpened()) {
795
829
  return;
@@ -82,11 +82,13 @@ var _copyMode = /*#__PURE__*/new WeakMap();
82
82
  var _isTriggeredByCopy = /*#__PURE__*/new WeakMap();
83
83
  var _isTriggeredByCut = /*#__PURE__*/new WeakMap();
84
84
  var _copyableRangesFactory = /*#__PURE__*/new WeakMap();
85
+ var _preventViewportScrollOnPaste = /*#__PURE__*/new WeakMap();
85
86
  var _ensureClipboardEventsGetTriggered = /*#__PURE__*/new WeakSet();
86
87
  var _countCopiedHeaders = /*#__PURE__*/new WeakSet();
87
88
  var _addContentEditableToHighlightedCell = /*#__PURE__*/new WeakSet();
88
89
  var _removeContentEditableFromHighlightedCell = /*#__PURE__*/new WeakSet();
89
90
  var _onAfterContextMenuDefaultOptions = /*#__PURE__*/new WeakSet();
91
+ var _onAfterSelection = /*#__PURE__*/new WeakSet();
90
92
  var _onAfterSelectionEnd = /*#__PURE__*/new WeakSet();
91
93
  var _onSafariMouseEnter = /*#__PURE__*/new WeakSet();
92
94
  var _onSafariMouseLeave = /*#__PURE__*/new WeakSet();
@@ -112,6 +114,16 @@ export class CopyPaste extends BasePlugin {
112
114
  * Force focus on focusableElement after end of the selection.
113
115
  */
114
116
  _classPrivateMethodInitSpec(this, _onAfterSelectionEnd);
117
+ /**
118
+ * Disables the viewport scroll after pasting the data.
119
+ *
120
+ * @param {number} fromRow Selection start row visual index.
121
+ * @param {number} fromColumn Selection start column visual index.
122
+ * @param {number} toRow Selection end row visual index.
123
+ * @param {number} toColumn Selection end column visual index.
124
+ * @param {object} preventScrolling Object with `value` property. If `true`, the viewport scroll will be prevented.
125
+ */
126
+ _classPrivateMethodInitSpec(this, _onAfterSelection);
115
127
  /**
116
128
  * Add copy and cut options to the Context Menu.
117
129
  *
@@ -251,6 +263,15 @@ export class CopyPaste extends BasePlugin {
251
263
  countColumnHeaders: () => this.hot.view.getColumnHeadersCount()
252
264
  })
253
265
  });
266
+ /**
267
+ * Flag that indicates if the viewport scroll should be prevented after pasting the data.
268
+ *
269
+ * @type {boolean}
270
+ */
271
+ _classPrivateFieldInitSpec(this, _preventViewportScrollOnPaste, {
272
+ writable: true,
273
+ value: false
274
+ });
254
275
  /**
255
276
  * Ranges of the cells coordinates, which should be used to copy/cut/paste actions.
256
277
  *
@@ -302,6 +323,12 @@ export class CopyPaste extends BasePlugin {
302
323
  this.uiContainer = (_settings$uiContainer = settings.uiContainer) !== null && _settings$uiContainer !== void 0 ? _settings$uiContainer : this.uiContainer;
303
324
  }
304
325
  this.addHook('afterContextMenuDefaultOptions', options => _classPrivateMethodGet(this, _onAfterContextMenuDefaultOptions, _onAfterContextMenuDefaultOptions2).call(this, options));
326
+ this.addHook('afterSelection', function () {
327
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
328
+ args[_key] = arguments[_key];
329
+ }
330
+ return _classPrivateMethodGet(_this, _onAfterSelection, _onAfterSelection2).call(_this, ...args);
331
+ });
305
332
  this.addHook('afterSelectionEnd', () => _classPrivateMethodGet(this, _onAfterSelectionEnd, _onAfterSelectionEnd2).call(this));
306
333
  this.eventManager.addEventListener(this.hot.rootDocument, 'copy', function () {
307
334
  return _this.onCopy(...arguments);
@@ -316,14 +343,14 @@ export class CopyPaste extends BasePlugin {
316
343
  // Without this workaround Safari (tested on Safari@16.5.2) does allow copying/cutting from the browser menu.
317
344
  if (isSafari()) {
318
345
  this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseenter', function () {
319
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
320
- args[_key] = arguments[_key];
346
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
347
+ args[_key2] = arguments[_key2];
321
348
  }
322
349
  return _classPrivateMethodGet(_this, _onSafariMouseEnter, _onSafariMouseEnter2).call(_this, ...args);
323
350
  });
324
351
  this.eventManager.addEventListener(this.hot.rootDocument.body, 'mouseleave', function () {
325
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
326
- args[_key2] = arguments[_key2];
352
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
353
+ args[_key3] = arguments[_key3];
327
354
  }
328
355
  return _classPrivateMethodGet(_this, _onSafariMouseLeave, _onSafariMouseLeave2).call(_this, ...args);
329
356
  });
@@ -593,6 +620,7 @@ export class CopyPaste extends BasePlugin {
593
620
  }
594
621
  newRows.push(newRow);
595
622
  }
623
+ _classPrivateFieldSet(this, _preventViewportScrollOnPaste, true);
596
624
  this.hot.populateFromArray(startRow, startColumn, newRows, undefined, undefined, 'CopyPaste.paste', this.pasteMode);
597
625
  return [startRow, startColumn, lastVisualRow, lastVisualColumn];
598
626
  }
@@ -785,6 +813,12 @@ function _onAfterContextMenuDefaultOptions2(options) {
785
813
  }
786
814
  options.items.push(cutItem(this));
787
815
  }
816
+ function _onAfterSelection2(fromRow, fromColumn, toRow, toColumn, preventScrolling) {
817
+ if (_classPrivateFieldGet(this, _preventViewportScrollOnPaste)) {
818
+ preventScrolling.value = true;
819
+ }
820
+ _classPrivateFieldSet(this, _preventViewportScrollOnPaste, false);
821
+ }
788
822
  function _onAfterSelectionEnd2() {
789
823
  if (this.isEditorOpened()) {
790
824
  return;