handsontable 12.3.1-next-712715f-20230130 → 12.3.1-next-75db455-20230202

Sign up to get free protection for your applications and to get access to all the features.
package/helpers/mixed.js CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
152
152
  function _injectProductInfo(key, element) {
153
153
  var hasValidType = !isEmpty(key);
154
154
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
155
- var hotVersion = "12.3.1-next-712715f-20230130";
155
+ var hotVersion = "12.3.1-next-75db455-20230202";
156
156
  var keyValidityDate;
157
157
  var consoleMessageState = 'invalid';
158
158
  var domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
142
142
  export function _injectProductInfo(key, element) {
143
143
  var hasValidType = !isEmpty(key);
144
144
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
145
- var hotVersion = "12.3.1-next-712715f-20230130";
145
+ var hotVersion = "12.3.1-next-75db455-20230202";
146
146
  var keyValidityDate;
147
147
  var consoleMessageState = 'invalid';
148
148
  var 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": "12.3.1-next-712715f-20230130",
13
+ "version": "12.3.1-next-75db455-20230202",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -392,6 +392,9 @@ var AutofillCalculations = /*#__PURE__*/function () {
392
392
  } while (inBounds(current, fillOffset));
393
393
  this.currentFillData = null;
394
394
  this.plugin.hot.render();
395
+ if (foundMergedCells.length > 0) {
396
+ this.plugin.ifChromeForceRepaint();
397
+ }
395
398
  }
396
399
 
397
400
  /**
@@ -388,6 +388,9 @@ var AutofillCalculations = /*#__PURE__*/function () {
388
388
  } while (inBounds(current, fillOffset));
389
389
  this.currentFillData = null;
390
390
  this.plugin.hot.render();
391
+ if (foundMergedCells.length > 0) {
392
+ this.plugin.ifChromeForceRepaint();
393
+ }
391
394
  }
392
395
 
393
396
  /**
@@ -12,8 +12,8 @@ require("core-js/modules/es.symbol.js");
12
12
  require("core-js/modules/es.symbol.description.js");
13
13
  require("core-js/modules/es.number.constructor.js");
14
14
  require("core-js/modules/es.symbol.iterator.js");
15
- require("core-js/modules/es.array.slice.js");
16
15
  require("core-js/modules/es.array.from.js");
16
+ require("core-js/modules/es.array.slice.js");
17
17
  exports.__esModule = true;
18
18
  exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.MergeCells = void 0;
19
19
  require("core-js/modules/es.array.iterator.js");
@@ -21,15 +21,14 @@ require("core-js/modules/es.object.to-string.js");
21
21
  require("core-js/modules/es.string.iterator.js");
22
22
  require("core-js/modules/es.weak-map.js");
23
23
  require("core-js/modules/web.dom-collections.iterator.js");
24
- require("core-js/modules/es.array.includes.js");
25
- require("core-js/modules/es.string.includes.js");
26
- require("core-js/modules/es.weak-set.js");
27
24
  require("core-js/modules/web.dom-collections.for-each.js");
28
25
  require("core-js/modules/es.set.js");
29
26
  require("core-js/modules/es.array.map.js");
30
27
  require("core-js/modules/es.function.name.js");
31
28
  require("core-js/modules/es.regexp.exec.js");
32
29
  require("core-js/modules/es.string.replace.js");
30
+ require("core-js/modules/es.array.includes.js");
31
+ require("core-js/modules/es.string.includes.js");
33
32
  var _base = require("../base");
34
33
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
35
34
  var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
@@ -45,16 +44,16 @@ var _utils = require("./utils");
45
44
  var _element = require("../../helpers/dom/element");
46
45
  var _browser = require("../../helpers/browser");
47
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
49
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
50
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
48
51
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
49
52
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
53
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
50
54
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
51
55
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
52
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
53
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
54
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
55
56
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
56
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
57
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
58
57
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
59
58
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
60
59
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -69,9 +68,6 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
69
68
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
70
69
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
71
70
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
72
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
73
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
74
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
75
71
  _pluginHooks.default.getSingleton().register('beforeMergeCells');
76
72
  _pluginHooks.default.getSingleton().register('afterMergeCells');
77
73
  _pluginHooks.default.getSingleton().register('beforeUnmergeCells');
@@ -120,7 +116,6 @@ var SHORTCUTS_GROUP = PLUGIN_KEY;
120
116
  * ```
121
117
  * :::
122
118
  */
123
- var _ifChromeForceRepaint = /*#__PURE__*/new WeakSet();
124
119
  var MergeCells = /*#__PURE__*/function (_BasePlugin) {
125
120
  _inherits(MergeCells, _BasePlugin);
126
121
  var _super = _createSuper(MergeCells);
@@ -128,7 +123,6 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
128
123
  var _this;
129
124
  _classCallCheck(this, MergeCells);
130
125
  _this = _super.call(this, hotInstance);
131
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _ifChromeForceRepaint);
132
126
  privatePool.set(_assertThisInitialized(_this), {
133
127
  lastDesiredCoords: null
134
128
  });
@@ -297,8 +291,48 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
297
291
  * @private
298
292
  */
299
293
  }, {
300
- key: "validateSetting",
301
- value:
294
+ key: "ifChromeForceRepaint",
295
+ value: function ifChromeForceRepaint() {
296
+ var _this3 = this;
297
+ if (!(0, _browser.isChrome)()) {
298
+ return;
299
+ }
300
+ var rowsToRefresh = [];
301
+ var rowIndexesToRefresh = [];
302
+ this.mergedCellsCollection.mergedCells.forEach(function (mergedCell) {
303
+ var row = mergedCell.row,
304
+ rowspan = mergedCell.rowspan;
305
+ for (var r = row + 1; r < row + rowspan; r++) {
306
+ rowIndexesToRefresh.push(r);
307
+ }
308
+ });
309
+
310
+ // Remove duplicates
311
+ rowIndexesToRefresh = _toConsumableArray(new Set(rowIndexesToRefresh));
312
+ rowIndexesToRefresh.forEach(function (rowIndex) {
313
+ var renderableRowIndex = _this3.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
314
+ _this3.hot.view._wt.wtOverlays.getOverlays(true).map(function (overlay) {
315
+ return (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable;
316
+ }).forEach(function (wtTableRef) {
317
+ var rowToRefresh = wtTableRef.getRow(renderableRowIndex);
318
+ if (rowToRefresh) {
319
+ // Modify the TR's `background` property to later modify it asynchronously.
320
+ // The background color is getting modified only with the alpha, so the change should not be visible (and is
321
+ // covered by the TDs' background color).
322
+ rowToRefresh.style.background = (0, _element.getStyle)(rowToRefresh, 'backgroundColor').replace(')', ', 0.99)');
323
+ rowsToRefresh.push(rowToRefresh);
324
+ }
325
+ });
326
+ });
327
+
328
+ // Asynchronously revert the TRs' `background` property to force a fresh repaint.
329
+ this.hot._registerTimeout(function () {
330
+ rowsToRefresh.forEach(function (rowElement) {
331
+ rowElement.style.background = (0, _element.getStyle)(rowElement, 'backgroundColor').replace(', 0.99)', ')');
332
+ });
333
+ }, 1);
334
+ }
335
+
302
336
  /**
303
337
  * Validates a single setting object, represented by a single merged cell information object.
304
338
  *
@@ -306,7 +340,9 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
306
340
  * @param {object} setting An object with `row`, `col`, `rowspan` and `colspan` properties.
307
341
  * @returns {boolean}
308
342
  */
309
- function validateSetting(setting) {
343
+ }, {
344
+ key: "validateSetting",
345
+ value: function validateSetting(setting) {
310
346
  var valid = true;
311
347
  if (!setting) {
312
348
  return false;
@@ -336,19 +372,19 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
336
372
  }, {
337
373
  key: "generateFromSettings",
338
374
  value: function generateFromSettings(settings) {
339
- var _this3 = this;
375
+ var _this4 = this;
340
376
  if (Array.isArray(settings)) {
341
377
  var populatedNulls = [];
342
378
  (0, _array.arrayEach)(settings, function (setting) {
343
- if (!_this3.validateSetting(setting)) {
379
+ if (!_this4.validateSetting(setting)) {
344
380
  return;
345
381
  }
346
- var highlight = _this3.hot._createCellCoords(setting.row, setting.col);
347
- var rangeEnd = _this3.hot._createCellCoords(setting.row + setting.rowspan - 1, setting.col + setting.colspan - 1);
348
- var mergeRange = _this3.hot._createCellRange(highlight, highlight, rangeEnd);
382
+ var highlight = _this4.hot._createCellCoords(setting.row, setting.col);
383
+ var rangeEnd = _this4.hot._createCellCoords(setting.row + setting.rowspan - 1, setting.col + setting.colspan - 1);
384
+ var mergeRange = _this4.hot._createCellRange(highlight, highlight, rangeEnd);
349
385
 
350
386
  // Merging without data population.
351
- _this3.mergeRange(mergeRange, true, true);
387
+ _this4.mergeRange(mergeRange, true, true);
352
388
  (0, _number.rangeEach)(setting.row, setting.row + setting.rowspan - 1, function (rowIndex) {
353
389
  (0, _number.rangeEach)(setting.col, setting.col + setting.colspan - 1, function (columnIndex) {
354
390
  // Not resetting a cell representing a merge area's value.
@@ -464,7 +500,7 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
464
500
  }, {
465
501
  key: "mergeRange",
466
502
  value: function mergeRange(cellRange) {
467
- var _this4 = this;
503
+ var _this5 = this;
468
504
  var auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
469
505
  var preventPopulation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
470
506
  var topStart = cellRange.getTopStartCorner();
@@ -488,9 +524,9 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
488
524
  clearedData[i] = [];
489
525
  }
490
526
  if (i === 0 && j === 0) {
491
- clearedValue = _this4.hot.getSourceDataAtCell(_this4.hot.toPhysicalRow(mergeParent.row), _this4.hot.toPhysicalColumn(mergeParent.col));
527
+ clearedValue = _this5.hot.getSourceDataAtCell(_this5.hot.toPhysicalRow(mergeParent.row), _this5.hot.toPhysicalColumn(mergeParent.col));
492
528
  } else {
493
- _this4.hot.setCellMeta(mergeParent.row + i, mergeParent.col + j, 'hidden', true);
529
+ _this5.hot.setCellMeta(mergeParent.row + i, mergeParent.col + j, 'hidden', true);
494
530
  }
495
531
  clearedData[i][j] = clearedValue;
496
532
  });
@@ -504,7 +540,7 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
504
540
  this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, void 0, void 0, this.pluginName);
505
541
  }
506
542
  if (!auto) {
507
- _classPrivateMethodGet(this, _ifChromeForceRepaint, _ifChromeForceRepaint2).call(this);
543
+ this.ifChromeForceRepaint();
508
544
  }
509
545
  this.hot.runHooks('afterMergeCells', cellRange, mergeParent, auto);
510
546
  return populationInfo;
@@ -525,7 +561,7 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
525
561
  }, {
526
562
  key: "unmergeRange",
527
563
  value: function unmergeRange(cellRange) {
528
- var _this5 = this;
564
+ var _this6 = this;
529
565
  var auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
530
566
  var mergedCells = this.mergedCellsCollection.getWithinRange(cellRange);
531
567
  if (!mergedCells) {
@@ -533,13 +569,13 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
533
569
  }
534
570
  this.hot.runHooks('beforeUnmergeCells', cellRange, auto);
535
571
  (0, _array.arrayEach)(mergedCells, function (currentCollection) {
536
- _this5.mergedCellsCollection.remove(currentCollection.row, currentCollection.col);
572
+ _this6.mergedCellsCollection.remove(currentCollection.row, currentCollection.col);
537
573
  (0, _number.rangeEach)(0, currentCollection.rowspan - 1, function (i) {
538
574
  (0, _number.rangeEach)(0, currentCollection.colspan - 1, function (j) {
539
- _this5.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
575
+ _this6.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
540
576
  });
541
577
  });
542
- _this5.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
578
+ _this6.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
543
579
  });
544
580
  this.hot.runHooks('afterUnmergeCells', cellRange, auto);
545
581
  this.hot.render();
@@ -619,14 +655,14 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
619
655
  }, {
620
656
  key: "registerShortcuts",
621
657
  value: function registerShortcuts() {
622
- var _this6 = this;
658
+ var _this7 = this;
623
659
  var shortcutManager = this.hot.getShortcutManager();
624
660
  var gridContext = shortcutManager.getContext('grid');
625
661
  gridContext.addShortcut({
626
662
  keys: [['Control', 'm']],
627
663
  callback: function callback() {
628
- _this6.toggleMerge(_this6.hot.getSelectedRangeLast());
629
- _this6.hot.render();
664
+ _this7.toggleMerge(_this7.hot.getSelectedRangeLast());
665
+ _this7.hot.render();
630
666
  },
631
667
  runOnlyIf: function runOnlyIf(event) {
632
668
  return !event.altKey;
@@ -747,7 +783,7 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
747
783
  }, {
748
784
  key: "onModifyTransformEnd",
749
785
  value: function onModifyTransformEnd(delta) {
750
- var _this7 = this;
786
+ var _this8 = this;
751
787
  var currentSelectionRange = this.hot.getSelectedRangeLast();
752
788
  var newDelta = (0, _object.clone)(delta);
753
789
  var newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
@@ -757,7 +793,7 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
757
793
  tempDelta = (0, _object.clone)(newDelta);
758
794
  this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
759
795
  (0, _array.arrayEach)(mergedCellsWithinRange, function (mergedCell) {
760
- _this7.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
796
+ _this8.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
761
797
  });
762
798
  } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
763
799
  delta.row = newDelta.row;
@@ -1329,44 +1365,4 @@ var MergeCells = /*#__PURE__*/function (_BasePlugin) {
1329
1365
  }]);
1330
1366
  return MergeCells;
1331
1367
  }(_base.BasePlugin);
1332
- exports.MergeCells = MergeCells;
1333
- function _ifChromeForceRepaint2() {
1334
- var _this8 = this;
1335
- if (!(0, _browser.isChrome)()) {
1336
- return;
1337
- }
1338
- var rowsToRefresh = [];
1339
- var rowIndexesToRefresh = [];
1340
- this.mergedCellsCollection.mergedCells.forEach(function (mergedCell) {
1341
- var row = mergedCell.row,
1342
- rowspan = mergedCell.rowspan;
1343
- for (var r = row + 1; r < row + rowspan; r++) {
1344
- rowIndexesToRefresh.push(r);
1345
- }
1346
- });
1347
-
1348
- // Remove duplicates
1349
- rowIndexesToRefresh = _toConsumableArray(new Set(rowIndexesToRefresh));
1350
- rowIndexesToRefresh.forEach(function (rowIndex) {
1351
- var renderableRowIndex = _this8.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
1352
- _this8.hot.view._wt.wtOverlays.getOverlays(true).map(function (overlay) {
1353
- return (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable;
1354
- }).forEach(function (wtTableRef) {
1355
- var rowToRefresh = wtTableRef.getRow(renderableRowIndex);
1356
- if (rowToRefresh) {
1357
- // Modify the TR's `background` property to later modify it asynchronously.
1358
- // The background color is getting modified only with the alpha, so the change should not be visible (and is
1359
- // covered by the TDs' background color).
1360
- rowToRefresh.style.background = (0, _element.getStyle)(rowToRefresh, 'backgroundColor').replace(')', ', 0.99)');
1361
- rowsToRefresh.push(rowToRefresh);
1362
- }
1363
- });
1364
- });
1365
-
1366
- // Asynchronously revert the TRs' `background` property to force a fresh repaint.
1367
- this.hot._registerTimeout(function () {
1368
- rowsToRefresh.forEach(function (rowElement) {
1369
- rowElement.style.background = (0, _element.getStyle)(rowElement, 'backgroundColor').replace(', 0.99)', ')');
1370
- });
1371
- }, 1);
1372
- }
1368
+ exports.MergeCells = MergeCells;
@@ -1,14 +1,14 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
5
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2
6
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
7
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
9
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
10
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
11
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
13
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
14
14
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -23,23 +23,19 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
23
23
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
24
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
25
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
26
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
27
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
28
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
29
26
  import "core-js/modules/es.array.iterator.js";
30
27
  import "core-js/modules/es.object.to-string.js";
31
28
  import "core-js/modules/es.string.iterator.js";
32
29
  import "core-js/modules/es.weak-map.js";
33
30
  import "core-js/modules/web.dom-collections.iterator.js";
34
- import "core-js/modules/es.array.includes.js";
35
- import "core-js/modules/es.string.includes.js";
36
- import "core-js/modules/es.weak-set.js";
37
31
  import "core-js/modules/web.dom-collections.for-each.js";
38
32
  import "core-js/modules/es.set.js";
39
33
  import "core-js/modules/es.array.map.js";
40
34
  import "core-js/modules/es.function.name.js";
41
35
  import "core-js/modules/es.regexp.exec.js";
42
36
  import "core-js/modules/es.string.replace.js";
37
+ import "core-js/modules/es.array.includes.js";
38
+ import "core-js/modules/es.string.includes.js";
43
39
  import "core-js/modules/es.object.set-prototype-of.js";
44
40
  import "core-js/modules/es.object.get-prototype-of.js";
45
41
  import "core-js/modules/es.reflect.construct.js";
@@ -51,8 +47,8 @@ import "core-js/modules/es.symbol.js";
51
47
  import "core-js/modules/es.symbol.description.js";
52
48
  import "core-js/modules/es.number.constructor.js";
53
49
  import "core-js/modules/es.symbol.iterator.js";
54
- import "core-js/modules/es.array.slice.js";
55
50
  import "core-js/modules/es.array.from.js";
51
+ import "core-js/modules/es.array.slice.js";
56
52
  import { BasePlugin } from "../base/index.mjs";
57
53
  import Hooks from "../../pluginHooks.mjs";
58
54
  import MergedCellsCollection from "./cellsCollection.mjs";
@@ -113,7 +109,6 @@ var SHORTCUTS_GROUP = PLUGIN_KEY;
113
109
  * ```
114
110
  * :::
115
111
  */
116
- var _ifChromeForceRepaint = /*#__PURE__*/new WeakSet();
117
112
  export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
118
113
  _inherits(MergeCells, _BasePlugin);
119
114
  var _super = _createSuper(MergeCells);
@@ -121,7 +116,6 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
121
116
  var _this;
122
117
  _classCallCheck(this, MergeCells);
123
118
  _this = _super.call(this, hotInstance);
124
- _classPrivateMethodInitSpec(_assertThisInitialized(_this), _ifChromeForceRepaint);
125
119
  privatePool.set(_assertThisInitialized(_this), {
126
120
  lastDesiredCoords: null
127
121
  });
@@ -290,8 +284,48 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
290
284
  * @private
291
285
  */
292
286
  }, {
293
- key: "validateSetting",
294
- value:
287
+ key: "ifChromeForceRepaint",
288
+ value: function ifChromeForceRepaint() {
289
+ var _this3 = this;
290
+ if (!isChrome()) {
291
+ return;
292
+ }
293
+ var rowsToRefresh = [];
294
+ var rowIndexesToRefresh = [];
295
+ this.mergedCellsCollection.mergedCells.forEach(function (mergedCell) {
296
+ var row = mergedCell.row,
297
+ rowspan = mergedCell.rowspan;
298
+ for (var r = row + 1; r < row + rowspan; r++) {
299
+ rowIndexesToRefresh.push(r);
300
+ }
301
+ });
302
+
303
+ // Remove duplicates
304
+ rowIndexesToRefresh = _toConsumableArray(new Set(rowIndexesToRefresh));
305
+ rowIndexesToRefresh.forEach(function (rowIndex) {
306
+ var renderableRowIndex = _this3.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
307
+ _this3.hot.view._wt.wtOverlays.getOverlays(true).map(function (overlay) {
308
+ return (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable;
309
+ }).forEach(function (wtTableRef) {
310
+ var rowToRefresh = wtTableRef.getRow(renderableRowIndex);
311
+ if (rowToRefresh) {
312
+ // Modify the TR's `background` property to later modify it asynchronously.
313
+ // The background color is getting modified only with the alpha, so the change should not be visible (and is
314
+ // covered by the TDs' background color).
315
+ rowToRefresh.style.background = getStyle(rowToRefresh, 'backgroundColor').replace(')', ', 0.99)');
316
+ rowsToRefresh.push(rowToRefresh);
317
+ }
318
+ });
319
+ });
320
+
321
+ // Asynchronously revert the TRs' `background` property to force a fresh repaint.
322
+ this.hot._registerTimeout(function () {
323
+ rowsToRefresh.forEach(function (rowElement) {
324
+ rowElement.style.background = getStyle(rowElement, 'backgroundColor').replace(', 0.99)', ')');
325
+ });
326
+ }, 1);
327
+ }
328
+
295
329
  /**
296
330
  * Validates a single setting object, represented by a single merged cell information object.
297
331
  *
@@ -299,7 +333,9 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
299
333
  * @param {object} setting An object with `row`, `col`, `rowspan` and `colspan` properties.
300
334
  * @returns {boolean}
301
335
  */
302
- function validateSetting(setting) {
336
+ }, {
337
+ key: "validateSetting",
338
+ value: function validateSetting(setting) {
303
339
  var valid = true;
304
340
  if (!setting) {
305
341
  return false;
@@ -329,19 +365,19 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
329
365
  }, {
330
366
  key: "generateFromSettings",
331
367
  value: function generateFromSettings(settings) {
332
- var _this3 = this;
368
+ var _this4 = this;
333
369
  if (Array.isArray(settings)) {
334
370
  var populatedNulls = [];
335
371
  arrayEach(settings, function (setting) {
336
- if (!_this3.validateSetting(setting)) {
372
+ if (!_this4.validateSetting(setting)) {
337
373
  return;
338
374
  }
339
- var highlight = _this3.hot._createCellCoords(setting.row, setting.col);
340
- var rangeEnd = _this3.hot._createCellCoords(setting.row + setting.rowspan - 1, setting.col + setting.colspan - 1);
341
- var mergeRange = _this3.hot._createCellRange(highlight, highlight, rangeEnd);
375
+ var highlight = _this4.hot._createCellCoords(setting.row, setting.col);
376
+ var rangeEnd = _this4.hot._createCellCoords(setting.row + setting.rowspan - 1, setting.col + setting.colspan - 1);
377
+ var mergeRange = _this4.hot._createCellRange(highlight, highlight, rangeEnd);
342
378
 
343
379
  // Merging without data population.
344
- _this3.mergeRange(mergeRange, true, true);
380
+ _this4.mergeRange(mergeRange, true, true);
345
381
  rangeEach(setting.row, setting.row + setting.rowspan - 1, function (rowIndex) {
346
382
  rangeEach(setting.col, setting.col + setting.colspan - 1, function (columnIndex) {
347
383
  // Not resetting a cell representing a merge area's value.
@@ -457,7 +493,7 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
457
493
  }, {
458
494
  key: "mergeRange",
459
495
  value: function mergeRange(cellRange) {
460
- var _this4 = this;
496
+ var _this5 = this;
461
497
  var auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
462
498
  var preventPopulation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
463
499
  var topStart = cellRange.getTopStartCorner();
@@ -481,9 +517,9 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
481
517
  clearedData[i] = [];
482
518
  }
483
519
  if (i === 0 && j === 0) {
484
- clearedValue = _this4.hot.getSourceDataAtCell(_this4.hot.toPhysicalRow(mergeParent.row), _this4.hot.toPhysicalColumn(mergeParent.col));
520
+ clearedValue = _this5.hot.getSourceDataAtCell(_this5.hot.toPhysicalRow(mergeParent.row), _this5.hot.toPhysicalColumn(mergeParent.col));
485
521
  } else {
486
- _this4.hot.setCellMeta(mergeParent.row + i, mergeParent.col + j, 'hidden', true);
522
+ _this5.hot.setCellMeta(mergeParent.row + i, mergeParent.col + j, 'hidden', true);
487
523
  }
488
524
  clearedData[i][j] = clearedValue;
489
525
  });
@@ -497,7 +533,7 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
497
533
  this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, void 0, void 0, this.pluginName);
498
534
  }
499
535
  if (!auto) {
500
- _classPrivateMethodGet(this, _ifChromeForceRepaint, _ifChromeForceRepaint2).call(this);
536
+ this.ifChromeForceRepaint();
501
537
  }
502
538
  this.hot.runHooks('afterMergeCells', cellRange, mergeParent, auto);
503
539
  return populationInfo;
@@ -518,7 +554,7 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
518
554
  }, {
519
555
  key: "unmergeRange",
520
556
  value: function unmergeRange(cellRange) {
521
- var _this5 = this;
557
+ var _this6 = this;
522
558
  var auto = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
523
559
  var mergedCells = this.mergedCellsCollection.getWithinRange(cellRange);
524
560
  if (!mergedCells) {
@@ -526,13 +562,13 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
526
562
  }
527
563
  this.hot.runHooks('beforeUnmergeCells', cellRange, auto);
528
564
  arrayEach(mergedCells, function (currentCollection) {
529
- _this5.mergedCellsCollection.remove(currentCollection.row, currentCollection.col);
565
+ _this6.mergedCellsCollection.remove(currentCollection.row, currentCollection.col);
530
566
  rangeEach(0, currentCollection.rowspan - 1, function (i) {
531
567
  rangeEach(0, currentCollection.colspan - 1, function (j) {
532
- _this5.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
568
+ _this6.hot.removeCellMeta(currentCollection.row + i, currentCollection.col + j, 'hidden');
533
569
  });
534
570
  });
535
- _this5.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
571
+ _this6.hot.removeCellMeta(currentCollection.row, currentCollection.col, 'spanned');
536
572
  });
537
573
  this.hot.runHooks('afterUnmergeCells', cellRange, auto);
538
574
  this.hot.render();
@@ -612,14 +648,14 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
612
648
  }, {
613
649
  key: "registerShortcuts",
614
650
  value: function registerShortcuts() {
615
- var _this6 = this;
651
+ var _this7 = this;
616
652
  var shortcutManager = this.hot.getShortcutManager();
617
653
  var gridContext = shortcutManager.getContext('grid');
618
654
  gridContext.addShortcut({
619
655
  keys: [['Control', 'm']],
620
656
  callback: function callback() {
621
- _this6.toggleMerge(_this6.hot.getSelectedRangeLast());
622
- _this6.hot.render();
657
+ _this7.toggleMerge(_this7.hot.getSelectedRangeLast());
658
+ _this7.hot.render();
623
659
  },
624
660
  runOnlyIf: function runOnlyIf(event) {
625
661
  return !event.altKey;
@@ -740,7 +776,7 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
740
776
  }, {
741
777
  key: "onModifyTransformEnd",
742
778
  value: function onModifyTransformEnd(delta) {
743
- var _this7 = this;
779
+ var _this8 = this;
744
780
  var currentSelectionRange = this.hot.getSelectedRangeLast();
745
781
  var newDelta = clone(delta);
746
782
  var newSelectionRange = this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, delta);
@@ -750,7 +786,7 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
750
786
  tempDelta = clone(newDelta);
751
787
  this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
752
788
  arrayEach(mergedCellsWithinRange, function (mergedCell) {
753
- _this7.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
789
+ _this8.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
754
790
  });
755
791
  } while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
756
792
  delta.row = newDelta.row;
@@ -1321,44 +1357,4 @@ export var MergeCells = /*#__PURE__*/function (_BasePlugin) {
1321
1357
  }
1322
1358
  }]);
1323
1359
  return MergeCells;
1324
- }(BasePlugin);
1325
- function _ifChromeForceRepaint2() {
1326
- var _this8 = this;
1327
- if (!isChrome()) {
1328
- return;
1329
- }
1330
- var rowsToRefresh = [];
1331
- var rowIndexesToRefresh = [];
1332
- this.mergedCellsCollection.mergedCells.forEach(function (mergedCell) {
1333
- var row = mergedCell.row,
1334
- rowspan = mergedCell.rowspan;
1335
- for (var r = row + 1; r < row + rowspan; r++) {
1336
- rowIndexesToRefresh.push(r);
1337
- }
1338
- });
1339
-
1340
- // Remove duplicates
1341
- rowIndexesToRefresh = _toConsumableArray(new Set(rowIndexesToRefresh));
1342
- rowIndexesToRefresh.forEach(function (rowIndex) {
1343
- var renderableRowIndex = _this8.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
1344
- _this8.hot.view._wt.wtOverlays.getOverlays(true).map(function (overlay) {
1345
- return (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable;
1346
- }).forEach(function (wtTableRef) {
1347
- var rowToRefresh = wtTableRef.getRow(renderableRowIndex);
1348
- if (rowToRefresh) {
1349
- // Modify the TR's `background` property to later modify it asynchronously.
1350
- // The background color is getting modified only with the alpha, so the change should not be visible (and is
1351
- // covered by the TDs' background color).
1352
- rowToRefresh.style.background = getStyle(rowToRefresh, 'backgroundColor').replace(')', ', 0.99)');
1353
- rowsToRefresh.push(rowToRefresh);
1354
- }
1355
- });
1356
- });
1357
-
1358
- // Asynchronously revert the TRs' `background` property to force a fresh repaint.
1359
- this.hot._registerTimeout(function () {
1360
- rowsToRefresh.forEach(function (rowElement) {
1361
- rowElement.style.background = getStyle(rowElement, 'backgroundColor').replace(', 0.99)', ')');
1362
- });
1363
- }, 1);
1364
- }
1360
+ }(BasePlugin);