handsontable 0.0.0-next-8f89e29-20241003 → 0.0.0-next-3d1a0ea-20241007

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 (113) hide show
  1. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +23 -0
  2. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +23 -0
  3. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +23 -0
  4. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +23 -0
  5. package/3rdparty/walkontable/src/core/_base.js +7 -0
  6. package/3rdparty/walkontable/src/core/_base.mjs +7 -0
  7. package/3rdparty/walkontable/src/facade/core.js +3 -0
  8. package/3rdparty/walkontable/src/facade/core.mjs +3 -0
  9. package/3rdparty/walkontable/src/overlay/_base.js +3 -0
  10. package/3rdparty/walkontable/src/overlay/_base.mjs +3 -0
  11. package/3rdparty/walkontable/src/selection/border/border.js +32 -44
  12. package/3rdparty/walkontable/src/selection/border/border.mjs +32 -44
  13. package/3rdparty/walkontable/src/selection/scanner.js +46 -11
  14. package/3rdparty/walkontable/src/selection/scanner.mjs +46 -11
  15. package/3rdparty/walkontable/src/settings.js +8 -0
  16. package/3rdparty/walkontable/src/settings.mjs +8 -0
  17. package/3rdparty/walkontable/src/table.js +6 -3
  18. package/3rdparty/walkontable/src/table.mjs +6 -3
  19. package/3rdparty/walkontable/src/viewport.js +26 -4
  20. package/3rdparty/walkontable/src/viewport.mjs +26 -4
  21. package/base.js +4 -4
  22. package/base.mjs +3 -3
  23. package/core/hooks/bucket.js +180 -0
  24. package/core/hooks/bucket.mjs +176 -0
  25. package/{pluginHooks.mjs → core/hooks/constants.js} +20 -486
  26. package/{pluginHooks.js → core/hooks/constants.mjs} +16 -489
  27. package/{pluginHooks.d.ts → core/hooks/index.d.ts} +17 -21
  28. package/core/hooks/index.js +385 -0
  29. package/core/hooks/index.mjs +381 -0
  30. package/core.d.ts +1 -1
  31. package/core.js +13 -12
  32. package/core.mjs +5 -4
  33. package/dataMap/metaManager/metaSchema.js +68 -2
  34. package/dataMap/metaManager/metaSchema.mjs +68 -2
  35. package/dataMap/metaManager/mods/dynamicCellMeta.js +2 -3
  36. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
  37. package/dist/handsontable.css +2 -2
  38. package/dist/handsontable.full.css +2 -2
  39. package/dist/handsontable.full.js +3009 -2582
  40. package/dist/handsontable.full.min.css +2 -2
  41. package/dist/handsontable.full.min.js +79 -79
  42. package/dist/handsontable.js +3011 -2584
  43. package/dist/handsontable.min.css +2 -2
  44. package/dist/handsontable.min.js +18 -18
  45. package/editorManager.js +2 -2
  46. package/editorManager.mjs +2 -2
  47. package/editors/baseEditor/baseEditor.js +23 -16
  48. package/editors/baseEditor/baseEditor.mjs +23 -16
  49. package/editors/dropdownEditor/dropdownEditor.js +2 -3
  50. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  51. package/editors/registry.js +2 -2
  52. package/editors/registry.mjs +1 -1
  53. package/helpers/mixed.js +1 -1
  54. package/helpers/mixed.mjs +1 -1
  55. package/index.d.ts +2 -1
  56. package/package.json +1 -1
  57. package/plugins/autoColumnSize/autoColumnSize.js +18 -27
  58. package/plugins/autoColumnSize/autoColumnSize.mjs +18 -27
  59. package/plugins/autoRowSize/autoRowSize.js +16 -22
  60. package/plugins/autoRowSize/autoRowSize.mjs +17 -23
  61. package/plugins/autofill/autofill.js +4 -5
  62. package/plugins/autofill/autofill.mjs +1 -1
  63. package/plugins/base/base.d.ts +1 -1
  64. package/plugins/base/base.js +39 -0
  65. package/plugins/base/base.mjs +40 -1
  66. package/plugins/base/index.js +2 -1
  67. package/plugins/base/index.mjs +1 -1
  68. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +2 -5
  69. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +2 -5
  70. package/plugins/columnSorting/columnSorting.js +3 -4
  71. package/plugins/columnSorting/columnSorting.mjs +1 -1
  72. package/plugins/comments/comments.js +7 -15
  73. package/plugins/comments/comments.mjs +8 -16
  74. package/plugins/contextMenu/contextMenu.js +6 -7
  75. package/plugins/contextMenu/contextMenu.mjs +1 -1
  76. package/plugins/copyPaste/copyPaste.js +29 -23
  77. package/plugins/copyPaste/copyPaste.mjs +21 -15
  78. package/plugins/dropdownMenu/dropdownMenu.js +6 -7
  79. package/plugins/dropdownMenu/dropdownMenu.mjs +1 -1
  80. package/plugins/formulas/formulas.js +7 -7
  81. package/plugins/formulas/formulas.mjs +1 -1
  82. package/plugins/hiddenColumns/hiddenColumns.js +19 -30
  83. package/plugins/hiddenColumns/hiddenColumns.mjs +15 -26
  84. package/plugins/hiddenRows/hiddenRows.js +18 -29
  85. package/plugins/hiddenRows/hiddenRows.mjs +14 -25
  86. package/plugins/manualColumnFreeze/manualColumnFreeze.js +5 -5
  87. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +1 -1
  88. package/plugins/manualColumnMove/manualColumnMove.js +3 -3
  89. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
  90. package/plugins/manualRowMove/manualRowMove.js +5 -5
  91. package/plugins/manualRowMove/manualRowMove.mjs +3 -3
  92. package/plugins/mergeCells/cellsCollection.js +15 -3
  93. package/plugins/mergeCells/cellsCollection.mjs +16 -4
  94. package/plugins/mergeCells/mergeCells.d.ts +6 -2
  95. package/plugins/mergeCells/mergeCells.js +78 -55
  96. package/plugins/mergeCells/mergeCells.mjs +76 -53
  97. package/plugins/mergeCells/renderer.js +13 -3
  98. package/plugins/mergeCells/renderer.mjs +13 -3
  99. package/plugins/persistentState/persistentState.js +4 -4
  100. package/plugins/persistentState/persistentState.mjs +1 -1
  101. package/plugins/undoRedo/undoRedo.js +4 -5
  102. package/plugins/undoRedo/undoRedo.mjs +3 -3
  103. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  104. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  105. package/settings.d.ts +3 -1
  106. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +1 -1
  107. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +1 -1
  108. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +1 -1
  109. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +1 -1
  110. package/shortcutContexts/commands/scrollToFocusedCell.js +4 -4
  111. package/shortcutContexts/commands/scrollToFocusedCell.mjs +4 -4
  112. package/tableView.js +40 -9
  113. package/tableView.mjs +40 -9
@@ -14,10 +14,8 @@ var _base = require("../base");
14
14
  var _element = require("../../helpers/dom/element");
15
15
  var _number = require("../../helpers/number");
16
16
  var _array = require("../../helpers/array");
17
- var _object = require("../../helpers/object");
18
- var _mixed = require("../../helpers/mixed");
19
17
  var _predefinedItems = require("../contextMenu/predefinedItems");
20
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
18
+ var _hooks = require("../../core/hooks");
21
19
  var _hideColumn = _interopRequireDefault(require("./contextMenuItem/hideColumn"));
22
20
  var _showColumn = _interopRequireDefault(require("./contextMenuItem/showColumn"));
23
21
  var _translations = require("../../translations");
@@ -28,10 +26,10 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
28
26
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
29
27
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
30
28
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
31
- _pluginHooks.default.getSingleton().register('beforeHideColumns');
32
- _pluginHooks.default.getSingleton().register('afterHideColumns');
33
- _pluginHooks.default.getSingleton().register('beforeUnhideColumns');
34
- _pluginHooks.default.getSingleton().register('afterUnhideColumns');
29
+ _hooks.Hooks.getSingleton().register('beforeHideColumns');
30
+ _hooks.Hooks.getSingleton().register('afterHideColumns');
31
+ _hooks.Hooks.getSingleton().register('beforeUnhideColumns');
32
+ _hooks.Hooks.getSingleton().register('afterUnhideColumns');
35
33
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'hiddenColumns';
36
34
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 310;
37
35
 
@@ -141,7 +139,6 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 310;
141
139
  * ```
142
140
  * :::
143
141
  */
144
- var _settings = /*#__PURE__*/new WeakMap();
145
142
  var _hiddenColumnsMap = /*#__PURE__*/new WeakMap();
146
143
  var _HiddenColumns_brand = /*#__PURE__*/new WeakSet();
147
144
  class HiddenColumns extends _base.BasePlugin {
@@ -155,13 +152,6 @@ class HiddenColumns extends _base.BasePlugin {
155
152
  * @returns {number}
156
153
  */
157
154
  _classPrivateMethodInitSpec(this, _HiddenColumns_brand);
158
- /**
159
- * Cached plugin settings.
160
- *
161
- * @private
162
- * @type {object}
163
- */
164
- _classPrivateFieldInitSpec(this, _settings, {});
165
155
  /**
166
156
  * Map of hidden columns by the plugin.
167
157
  *
@@ -176,6 +166,13 @@ class HiddenColumns extends _base.BasePlugin {
176
166
  static get PLUGIN_PRIORITY() {
177
167
  return PLUGIN_PRIORITY;
178
168
  }
169
+ static get DEFAULT_SETTINGS() {
170
+ return {
171
+ copyPasteEnabled: true,
172
+ indicators: false,
173
+ columns: []
174
+ };
175
+ }
179
176
  /**
180
177
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
181
178
  * hook and if it returns `true` then the {@link HiddenColumns#enablePlugin} method is called.
@@ -194,13 +191,6 @@ class HiddenColumns extends _base.BasePlugin {
194
191
  if (this.enabled) {
195
192
  return;
196
193
  }
197
- const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
198
- if ((0, _object.isObject)(pluginSettings)) {
199
- _classPrivateFieldSet(_settings, this, pluginSettings);
200
- if ((0, _mixed.isUndefined)(pluginSettings.copyPasteEnabled)) {
201
- pluginSettings.copyPasteEnabled = true;
202
- }
203
- }
204
194
  _classPrivateFieldSet(_hiddenColumnsMap, this, new _translations.HidingMap());
205
195
  _classPrivateFieldGet(_hiddenColumnsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenColumns_brand, this, _onMapInit).call(this));
206
196
  this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenColumnsMap, this));
@@ -239,7 +229,6 @@ class HiddenColumns extends _base.BasePlugin {
239
229
  */
240
230
  disablePlugin() {
241
231
  this.hot.columnIndexMapper.unregisterMap(this.pluginName);
242
- _classPrivateFieldSet(_settings, this, {});
243
232
  super.disablePlugin();
244
233
  this.resetCellsMeta();
245
234
  }
@@ -385,7 +374,6 @@ class HiddenColumns extends _base.BasePlugin {
385
374
  * Destroys the plugin instance.
386
375
  */
387
376
  destroy() {
388
- _classPrivateFieldSet(_settings, this, null);
389
377
  _classPrivateFieldSet(_hiddenColumnsMap, this, null);
390
378
  super.destroy();
391
379
  }
@@ -397,7 +385,7 @@ function _onModifyColWidth(width, column) {
397
385
  if (this.isHidden(column)) {
398
386
  return 0;
399
387
  }
400
- if (_classPrivateFieldGet(_settings, this).indicators && (this.isHidden(column + 1) || this.isHidden(column - 1))) {
388
+ if (this.getSetting('indicators') && (this.isHidden(column + 1) || this.isHidden(column - 1))) {
401
389
  // Add additional space for hidden column indicator.
402
390
  if (typeof width === 'number' && this.hot.hasColHeaders()) {
403
391
  return width + 15;
@@ -412,7 +400,7 @@ function _onModifyColWidth(width, column) {
412
400
  * @param {object} cellProperties Object containing the cell properties.
413
401
  */
414
402
  function _onAfterGetCellMeta(row, column, cellProperties) {
415
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(column)) {
403
+ if (this.getSetting('copyPasteEnabled') === false && this.isHidden(column)) {
416
404
  // Cell property handled by the `Autofill` and the `CopyPaste` plugins.
417
405
  cellProperties.skipColumnOnPaste = true;
418
406
  }
@@ -440,7 +428,7 @@ function _onAfterGetCellMeta(row, column, cellProperties) {
440
428
  */
441
429
  function _onModifyCopyableRange(ranges) {
442
430
  // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).
443
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {
431
+ if (this.getSetting('copyPasteEnabled')) {
444
432
  return ranges;
445
433
  }
446
434
  const newRanges = [];
@@ -481,7 +469,7 @@ function _onModifyCopyableRange(ranges) {
481
469
  * @param {HTMLElement} TH Header's TH element.
482
470
  */
483
471
  function _onAfterGetColHeader(column, TH) {
484
- if (!_classPrivateFieldGet(_settings, this).indicators || column < 0) {
472
+ if (!this.getSetting('indicators') || column < 0) {
485
473
  return;
486
474
  }
487
475
  const classList = [];
@@ -507,7 +495,8 @@ function _onAfterContextMenuDefaultOptions(options) {
507
495
  * On map initialized hook callback.
508
496
  */
509
497
  function _onMapInit() {
510
- if (Array.isArray(_classPrivateFieldGet(_settings, this).columns)) {
511
- this.hideColumns(_classPrivateFieldGet(_settings, this).columns);
498
+ const columns = this.getSetting('columns');
499
+ if (Array.isArray(columns)) {
500
+ this.hideColumns(columns);
512
501
  }
513
502
  }
@@ -17,10 +17,8 @@ import { BasePlugin } from "../base/index.mjs";
17
17
  import { addClass } from "../../helpers/dom/element.mjs";
18
18
  import { rangeEach } from "../../helpers/number.mjs";
19
19
  import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
20
- import { isObject } from "../../helpers/object.mjs";
21
- import { isUndefined } from "../../helpers/mixed.mjs";
22
20
  import { SEPARATOR } from "../contextMenu/predefinedItems/index.mjs";
23
- import Hooks from "../../pluginHooks.mjs";
21
+ import { Hooks } from "../../core/hooks/index.mjs";
24
22
  import hideColumnItem from "./contextMenuItem/hideColumn.mjs";
25
23
  import showColumnItem from "./contextMenuItem/showColumn.mjs";
26
24
  import { HidingMap } from "../../translations/index.mjs";
@@ -137,7 +135,6 @@ export const PLUGIN_PRIORITY = 310;
137
135
  * ```
138
136
  * :::
139
137
  */
140
- var _settings = /*#__PURE__*/new WeakMap();
141
138
  var _hiddenColumnsMap = /*#__PURE__*/new WeakMap();
142
139
  var _HiddenColumns_brand = /*#__PURE__*/new WeakSet();
143
140
  export class HiddenColumns extends BasePlugin {
@@ -151,13 +148,6 @@ export class HiddenColumns extends BasePlugin {
151
148
  * @returns {number}
152
149
  */
153
150
  _classPrivateMethodInitSpec(this, _HiddenColumns_brand);
154
- /**
155
- * Cached plugin settings.
156
- *
157
- * @private
158
- * @type {object}
159
- */
160
- _classPrivateFieldInitSpec(this, _settings, {});
161
151
  /**
162
152
  * Map of hidden columns by the plugin.
163
153
  *
@@ -172,6 +162,13 @@ export class HiddenColumns extends BasePlugin {
172
162
  static get PLUGIN_PRIORITY() {
173
163
  return PLUGIN_PRIORITY;
174
164
  }
165
+ static get DEFAULT_SETTINGS() {
166
+ return {
167
+ copyPasteEnabled: true,
168
+ indicators: false,
169
+ columns: []
170
+ };
171
+ }
175
172
  /**
176
173
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
177
174
  * hook and if it returns `true` then the {@link HiddenColumns#enablePlugin} method is called.
@@ -190,13 +187,6 @@ export class HiddenColumns extends BasePlugin {
190
187
  if (this.enabled) {
191
188
  return;
192
189
  }
193
- const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
194
- if (isObject(pluginSettings)) {
195
- _classPrivateFieldSet(_settings, this, pluginSettings);
196
- if (isUndefined(pluginSettings.copyPasteEnabled)) {
197
- pluginSettings.copyPasteEnabled = true;
198
- }
199
- }
200
190
  _classPrivateFieldSet(_hiddenColumnsMap, this, new HidingMap());
201
191
  _classPrivateFieldGet(_hiddenColumnsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenColumns_brand, this, _onMapInit).call(this));
202
192
  this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenColumnsMap, this));
@@ -235,7 +225,6 @@ export class HiddenColumns extends BasePlugin {
235
225
  */
236
226
  disablePlugin() {
237
227
  this.hot.columnIndexMapper.unregisterMap(this.pluginName);
238
- _classPrivateFieldSet(_settings, this, {});
239
228
  super.disablePlugin();
240
229
  this.resetCellsMeta();
241
230
  }
@@ -381,7 +370,6 @@ export class HiddenColumns extends BasePlugin {
381
370
  * Destroys the plugin instance.
382
371
  */
383
372
  destroy() {
384
- _classPrivateFieldSet(_settings, this, null);
385
373
  _classPrivateFieldSet(_hiddenColumnsMap, this, null);
386
374
  super.destroy();
387
375
  }
@@ -392,7 +380,7 @@ function _onModifyColWidth(width, column) {
392
380
  if (this.isHidden(column)) {
393
381
  return 0;
394
382
  }
395
- if (_classPrivateFieldGet(_settings, this).indicators && (this.isHidden(column + 1) || this.isHidden(column - 1))) {
383
+ if (this.getSetting('indicators') && (this.isHidden(column + 1) || this.isHidden(column - 1))) {
396
384
  // Add additional space for hidden column indicator.
397
385
  if (typeof width === 'number' && this.hot.hasColHeaders()) {
398
386
  return width + 15;
@@ -407,7 +395,7 @@ function _onModifyColWidth(width, column) {
407
395
  * @param {object} cellProperties Object containing the cell properties.
408
396
  */
409
397
  function _onAfterGetCellMeta(row, column, cellProperties) {
410
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(column)) {
398
+ if (this.getSetting('copyPasteEnabled') === false && this.isHidden(column)) {
411
399
  // Cell property handled by the `Autofill` and the `CopyPaste` plugins.
412
400
  cellProperties.skipColumnOnPaste = true;
413
401
  }
@@ -435,7 +423,7 @@ function _onAfterGetCellMeta(row, column, cellProperties) {
435
423
  */
436
424
  function _onModifyCopyableRange(ranges) {
437
425
  // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).
438
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {
426
+ if (this.getSetting('copyPasteEnabled')) {
439
427
  return ranges;
440
428
  }
441
429
  const newRanges = [];
@@ -476,7 +464,7 @@ function _onModifyCopyableRange(ranges) {
476
464
  * @param {HTMLElement} TH Header's TH element.
477
465
  */
478
466
  function _onAfterGetColHeader(column, TH) {
479
- if (!_classPrivateFieldGet(_settings, this).indicators || column < 0) {
467
+ if (!this.getSetting('indicators') || column < 0) {
480
468
  return;
481
469
  }
482
470
  const classList = [];
@@ -502,7 +490,8 @@ function _onAfterContextMenuDefaultOptions(options) {
502
490
  * On map initialized hook callback.
503
491
  */
504
492
  function _onMapInit() {
505
- if (Array.isArray(_classPrivateFieldGet(_settings, this).columns)) {
506
- this.hideColumns(_classPrivateFieldGet(_settings, this).columns);
493
+ const columns = this.getSetting('columns');
494
+ if (Array.isArray(columns)) {
495
+ this.hideColumns(columns);
507
496
  }
508
497
  }
@@ -14,10 +14,8 @@ var _base = require("../base");
14
14
  var _element = require("../../helpers/dom/element");
15
15
  var _number = require("../../helpers/number");
16
16
  var _array = require("../../helpers/array");
17
- var _object = require("../../helpers/object");
18
- var _mixed = require("../../helpers/mixed");
19
17
  var _predefinedItems = require("../contextMenu/predefinedItems");
20
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
18
+ var _hooks = require("../../core/hooks");
21
19
  var _hideRow = _interopRequireDefault(require("./contextMenuItem/hideRow"));
22
20
  var _showRow = _interopRequireDefault(require("./contextMenuItem/showRow"));
23
21
  var _translations = require("../../translations");
@@ -28,10 +26,10 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
28
26
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
29
27
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
30
28
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
31
- _pluginHooks.default.getSingleton().register('beforeHideRows');
32
- _pluginHooks.default.getSingleton().register('afterHideRows');
33
- _pluginHooks.default.getSingleton().register('beforeUnhideRows');
34
- _pluginHooks.default.getSingleton().register('afterUnhideRows');
29
+ _hooks.Hooks.getSingleton().register('beforeHideRows');
30
+ _hooks.Hooks.getSingleton().register('afterHideRows');
31
+ _hooks.Hooks.getSingleton().register('beforeUnhideRows');
32
+ _hooks.Hooks.getSingleton().register('afterUnhideRows');
35
33
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'hiddenRows';
36
34
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 320;
37
35
 
@@ -141,7 +139,6 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 320;
141
139
  * ```
142
140
  * :::
143
141
  */
144
- var _settings = /*#__PURE__*/new WeakMap();
145
142
  var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
146
143
  var _HiddenRows_brand = /*#__PURE__*/new WeakSet();
147
144
  class HiddenRows extends _base.BasePlugin {
@@ -155,13 +152,6 @@ class HiddenRows extends _base.BasePlugin {
155
152
  * @returns {number}
156
153
  */
157
154
  _classPrivateMethodInitSpec(this, _HiddenRows_brand);
158
- /**
159
- * Cached settings from Handsontable settings.
160
- *
161
- * @private
162
- * @type {object}
163
- */
164
- _classPrivateFieldInitSpec(this, _settings, {});
165
155
  /**
166
156
  * Map of hidden rows by the plugin.
167
157
  *
@@ -176,6 +166,13 @@ class HiddenRows extends _base.BasePlugin {
176
166
  static get PLUGIN_PRIORITY() {
177
167
  return PLUGIN_PRIORITY;
178
168
  }
169
+ static get DEFAULT_SETTINGS() {
170
+ return {
171
+ copyPasteEnabled: true,
172
+ indicators: false,
173
+ rows: []
174
+ };
175
+ }
179
176
  /**
180
177
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
181
178
  * hook and if it returns `true` then the {@link HiddenRows#enablePlugin} method is called.
@@ -194,13 +191,6 @@ class HiddenRows extends _base.BasePlugin {
194
191
  if (this.enabled) {
195
192
  return;
196
193
  }
197
- const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
198
- if ((0, _object.isObject)(pluginSettings)) {
199
- _classPrivateFieldSet(_settings, this, pluginSettings);
200
- if ((0, _mixed.isUndefined)(pluginSettings.copyPasteEnabled)) {
201
- pluginSettings.copyPasteEnabled = true;
202
- }
203
- }
204
194
  _classPrivateFieldSet(_hiddenRowsMap, this, new _translations.HidingMap());
205
195
  _classPrivateFieldGet(_hiddenRowsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenRows_brand, this, _onMapInit).call(this));
206
196
  this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenRowsMap, this));
@@ -239,7 +229,6 @@ class HiddenRows extends _base.BasePlugin {
239
229
  */
240
230
  disablePlugin() {
241
231
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
242
- _classPrivateFieldSet(_settings, this, {});
243
232
  super.disablePlugin();
244
233
  this.resetCellsMeta();
245
234
  }
@@ -382,7 +371,6 @@ class HiddenRows extends _base.BasePlugin {
382
371
  * Destroys the plugin instance.
383
372
  */
384
373
  destroy() {
385
- _classPrivateFieldSet(_settings, this, null);
386
374
  _classPrivateFieldSet(_hiddenRowsMap, this, null);
387
375
  super.destroy();
388
376
  }
@@ -404,7 +392,7 @@ function _onModifyRowHeight(height, row) {
404
392
  * @param {object} cellProperties Object containing the cell properties.
405
393
  */
406
394
  function _onAfterGetCellMeta(row, column, cellProperties) {
407
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(row)) {
395
+ if (this.getSetting('copyPasteEnabled') === false && this.isHidden(row)) {
408
396
  // Cell property handled by the `Autofill` and the `CopyPaste` plugins.
409
397
  cellProperties.skipRowOnPaste = true;
410
398
  }
@@ -432,7 +420,7 @@ function _onAfterGetCellMeta(row, column, cellProperties) {
432
420
  */
433
421
  function _onModifyCopyableRange(ranges) {
434
422
  // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).
435
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {
423
+ if (this.getSetting('copyPasteEnabled')) {
436
424
  return ranges;
437
425
  }
438
426
  const newRanges = [];
@@ -473,7 +461,7 @@ function _onModifyCopyableRange(ranges) {
473
461
  * @param {HTMLElement} TH Header's TH element.
474
462
  */
475
463
  function _onAfterGetRowHeader(row, TH) {
476
- if (!_classPrivateFieldGet(_settings, this).indicators || row < 0) {
464
+ if (!this.getSetting('indicators') || row < 0) {
477
465
  return;
478
466
  }
479
467
  const classList = [];
@@ -499,7 +487,8 @@ function _onAfterContextMenuDefaultOptions(options) {
499
487
  * On map initialized hook callback.
500
488
  */
501
489
  function _onMapInit() {
502
- if (Array.isArray(_classPrivateFieldGet(_settings, this).rows)) {
503
- this.hideRows(_classPrivateFieldGet(_settings, this).rows);
490
+ const rows = this.getSetting('rows');
491
+ if (Array.isArray(rows)) {
492
+ this.hideRows(rows);
504
493
  }
505
494
  }
@@ -17,10 +17,8 @@ import { BasePlugin } from "../base/index.mjs";
17
17
  import { addClass } from "../../helpers/dom/element.mjs";
18
18
  import { rangeEach } from "../../helpers/number.mjs";
19
19
  import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
20
- import { isObject } from "../../helpers/object.mjs";
21
- import { isUndefined } from "../../helpers/mixed.mjs";
22
20
  import { SEPARATOR } from "../contextMenu/predefinedItems/index.mjs";
23
- import Hooks from "../../pluginHooks.mjs";
21
+ import { Hooks } from "../../core/hooks/index.mjs";
24
22
  import hideRowItem from "./contextMenuItem/hideRow.mjs";
25
23
  import showRowItem from "./contextMenuItem/showRow.mjs";
26
24
  import { HidingMap } from "../../translations/index.mjs";
@@ -137,7 +135,6 @@ export const PLUGIN_PRIORITY = 320;
137
135
  * ```
138
136
  * :::
139
137
  */
140
- var _settings = /*#__PURE__*/new WeakMap();
141
138
  var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
142
139
  var _HiddenRows_brand = /*#__PURE__*/new WeakSet();
143
140
  export class HiddenRows extends BasePlugin {
@@ -151,13 +148,6 @@ export class HiddenRows extends BasePlugin {
151
148
  * @returns {number}
152
149
  */
153
150
  _classPrivateMethodInitSpec(this, _HiddenRows_brand);
154
- /**
155
- * Cached settings from Handsontable settings.
156
- *
157
- * @private
158
- * @type {object}
159
- */
160
- _classPrivateFieldInitSpec(this, _settings, {});
161
151
  /**
162
152
  * Map of hidden rows by the plugin.
163
153
  *
@@ -172,6 +162,13 @@ export class HiddenRows extends BasePlugin {
172
162
  static get PLUGIN_PRIORITY() {
173
163
  return PLUGIN_PRIORITY;
174
164
  }
165
+ static get DEFAULT_SETTINGS() {
166
+ return {
167
+ copyPasteEnabled: true,
168
+ indicators: false,
169
+ rows: []
170
+ };
171
+ }
175
172
  /**
176
173
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
177
174
  * hook and if it returns `true` then the {@link HiddenRows#enablePlugin} method is called.
@@ -190,13 +187,6 @@ export class HiddenRows extends BasePlugin {
190
187
  if (this.enabled) {
191
188
  return;
192
189
  }
193
- const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
194
- if (isObject(pluginSettings)) {
195
- _classPrivateFieldSet(_settings, this, pluginSettings);
196
- if (isUndefined(pluginSettings.copyPasteEnabled)) {
197
- pluginSettings.copyPasteEnabled = true;
198
- }
199
- }
200
190
  _classPrivateFieldSet(_hiddenRowsMap, this, new HidingMap());
201
191
  _classPrivateFieldGet(_hiddenRowsMap, this).addLocalHook('init', () => _assertClassBrand(_HiddenRows_brand, this, _onMapInit).call(this));
202
192
  this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_hiddenRowsMap, this));
@@ -235,7 +225,6 @@ export class HiddenRows extends BasePlugin {
235
225
  */
236
226
  disablePlugin() {
237
227
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
238
- _classPrivateFieldSet(_settings, this, {});
239
228
  super.disablePlugin();
240
229
  this.resetCellsMeta();
241
230
  }
@@ -378,7 +367,6 @@ export class HiddenRows extends BasePlugin {
378
367
  * Destroys the plugin instance.
379
368
  */
380
369
  destroy() {
381
- _classPrivateFieldSet(_settings, this, null);
382
370
  _classPrivateFieldSet(_hiddenRowsMap, this, null);
383
371
  super.destroy();
384
372
  }
@@ -399,7 +387,7 @@ function _onModifyRowHeight(height, row) {
399
387
  * @param {object} cellProperties Object containing the cell properties.
400
388
  */
401
389
  function _onAfterGetCellMeta(row, column, cellProperties) {
402
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled === false && this.isHidden(row)) {
390
+ if (this.getSetting('copyPasteEnabled') === false && this.isHidden(row)) {
403
391
  // Cell property handled by the `Autofill` and the `CopyPaste` plugins.
404
392
  cellProperties.skipRowOnPaste = true;
405
393
  }
@@ -427,7 +415,7 @@ function _onAfterGetCellMeta(row, column, cellProperties) {
427
415
  */
428
416
  function _onModifyCopyableRange(ranges) {
429
417
  // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).
430
- if (_classPrivateFieldGet(_settings, this).copyPasteEnabled) {
418
+ if (this.getSetting('copyPasteEnabled')) {
431
419
  return ranges;
432
420
  }
433
421
  const newRanges = [];
@@ -468,7 +456,7 @@ function _onModifyCopyableRange(ranges) {
468
456
  * @param {HTMLElement} TH Header's TH element.
469
457
  */
470
458
  function _onAfterGetRowHeader(row, TH) {
471
- if (!_classPrivateFieldGet(_settings, this).indicators || row < 0) {
459
+ if (!this.getSetting('indicators') || row < 0) {
472
460
  return;
473
461
  }
474
462
  const classList = [];
@@ -494,7 +482,8 @@ function _onAfterContextMenuDefaultOptions(options) {
494
482
  * On map initialized hook callback.
495
483
  */
496
484
  function _onMapInit() {
497
- if (Array.isArray(_classPrivateFieldGet(_settings, this).rows)) {
498
- this.hideRows(_classPrivateFieldGet(_settings, this).rows);
485
+ const rows = this.getSetting('rows');
486
+ if (Array.isArray(rows)) {
487
+ this.hideRows(rows);
499
488
  }
500
489
  }
@@ -4,7 +4,7 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  var _base = require("../base");
7
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
7
+ var _hooks = require("../../core/hooks");
8
8
  var _freezeColumn = _interopRequireDefault(require("./contextMenuItem/freezeColumn"));
9
9
  var _unfreezeColumn = _interopRequireDefault(require("./contextMenuItem/unfreezeColumn"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -14,10 +14,10 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
14
14
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
15
15
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
16
16
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
17
- _pluginHooks.default.getSingleton().register('beforeColumnFreeze');
18
- _pluginHooks.default.getSingleton().register('afterColumnFreeze');
19
- _pluginHooks.default.getSingleton().register('beforeColumnUnfreeze');
20
- _pluginHooks.default.getSingleton().register('afterColumnUnfreeze');
17
+ _hooks.Hooks.getSingleton().register('beforeColumnFreeze');
18
+ _hooks.Hooks.getSingleton().register('afterColumnFreeze');
19
+ _hooks.Hooks.getSingleton().register('beforeColumnUnfreeze');
20
+ _hooks.Hooks.getSingleton().register('afterColumnUnfreeze');
21
21
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'manualColumnFreeze';
22
22
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 110;
23
23
 
@@ -7,7 +7,7 @@ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
7
7
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
8
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  import { BasePlugin } from "../base/index.mjs";
10
- import Hooks from "../../pluginHooks.mjs";
10
+ import { Hooks } from "../../core/hooks/index.mjs";
11
11
  import freezeColumnItem from "./contextMenuItem/freezeColumn.mjs";
12
12
  import unfreezeColumnItem from "./contextMenuItem/unfreezeColumn.mjs";
13
13
  Hooks.getSingleton().register('beforeColumnFreeze');
@@ -4,7 +4,7 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  var _base = require("../base");
7
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
7
+ var _hooks = require("../../core/hooks");
8
8
  var _array = require("../../helpers/array");
9
9
  var _element = require("../../helpers/dom/element");
10
10
  var _event = require("../../helpers/dom/event");
@@ -18,8 +18,8 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
18
18
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
19
19
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
20
20
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
21
- _pluginHooks.default.getSingleton().register('beforeColumnMove');
22
- _pluginHooks.default.getSingleton().register('afterColumnMove');
21
+ _hooks.Hooks.getSingleton().register('beforeColumnMove');
22
+ _hooks.Hooks.getSingleton().register('afterColumnMove');
23
23
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'manualColumnMove';
24
24
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 120;
25
25
  const CSS_PLUGIN = 'ht__manualColumnMove';
@@ -7,7 +7,7 @@ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a),
7
7
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
8
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  import { BasePlugin } from "../base/index.mjs";
10
- import Hooks from "../../pluginHooks.mjs";
10
+ import { Hooks } from "../../core/hooks/index.mjs";
11
11
  import { arrayReduce } from "../../helpers/array.mjs";
12
12
  import { addClass, removeClass, offset, hasClass, outerWidth } from "../../helpers/dom/element.mjs";
13
13
  import { offsetRelativeTo } from "../../helpers/dom/event.mjs";
@@ -4,7 +4,7 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  var _base = require("../base");
7
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
7
+ var _hooks = require("../../core/hooks");
8
8
  var _array = require("../../helpers/array");
9
9
  var _element = require("../../helpers/dom/element");
10
10
  var _number = require("../../helpers/number");
@@ -17,8 +17,8 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
17
17
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
18
18
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
19
19
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
20
- _pluginHooks.default.getSingleton().register('beforeRowMove');
21
- _pluginHooks.default.getSingleton().register('afterRowMove');
20
+ _hooks.Hooks.getSingleton().register('beforeRowMove');
21
+ _hooks.Hooks.getSingleton().register('afterRowMove');
22
22
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'manualRowMove';
23
23
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 140;
24
24
  const CSS_PLUGIN = 'ht__manualRowMove';
@@ -417,8 +417,8 @@ class ManualRowMove extends _base.BasePlugin {
417
417
  */
418
418
  refreshPositions() {
419
419
  const coords = _classPrivateFieldGet(_target, this).coords;
420
- const firstVisible = this.hot.view.getFirstFullyVisibleRow();
421
- const lastVisible = this.hot.view.getLastFullyVisibleRow();
420
+ const firstVisible = this.hot.getFirstFullyVisibleRow();
421
+ const lastVisible = this.hot.getLastFullyVisibleRow();
422
422
  const countRows = this.hot.countRows();
423
423
  if (this.isFixedRowTop(coords.row) && firstVisible > 0) {
424
424
  this.hot.scrollViewportTo(this.hot.rowIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1));
@@ -7,7 +7,7 @@ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a),
7
7
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
8
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  import { BasePlugin } from "../base/index.mjs";
10
- import Hooks from "../../pluginHooks.mjs";
10
+ import { Hooks } from "../../core/hooks/index.mjs";
11
11
  import { arrayReduce } from "../../helpers/array.mjs";
12
12
  import { addClass, removeClass, offset, getTrimmingContainer } from "../../helpers/dom/element.mjs";
13
13
  import { rangeEach } from "../../helpers/number.mjs";
@@ -413,8 +413,8 @@ export class ManualRowMove extends BasePlugin {
413
413
  */
414
414
  refreshPositions() {
415
415
  const coords = _classPrivateFieldGet(_target, this).coords;
416
- const firstVisible = this.hot.view.getFirstFullyVisibleRow();
417
- const lastVisible = this.hot.view.getLastFullyVisibleRow();
416
+ const firstVisible = this.hot.getFirstFullyVisibleRow();
417
+ const lastVisible = this.hot.getLastFullyVisibleRow();
418
418
  const countRows = this.hot.countRows();
419
419
  if (this.isFixedRowTop(coords.row) && firstVisible > 0) {
420
420
  this.hot.scrollViewportTo(this.hot.rowIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1));
@@ -302,9 +302,21 @@ class MergedCellsCollection {
302
302
  */
303
303
  isFirstRenderableMergedCell(row, column) {
304
304
  const mergeParent = this.get(row, column);
305
-
306
- // Return if row and column indexes are within merge area and if they are first rendered indexes within the area.
307
- return mergeParent && this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1) === row && this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1) === column;
305
+ if (!mergeParent) {
306
+ return false;
307
+ }
308
+ const {
309
+ row: mergeRow,
310
+ col: mergeColumn,
311
+ rowspan,
312
+ colspan
313
+ } = mergeParent;
314
+ const overlayName = this.hot.view.getActiveOverlayName();
315
+ const firstRenderedRow = ['top', 'top_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleRow();
316
+ const firstRenderedColumn = ['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName) ? 0 : this.hot.getFirstRenderedVisibleColumn();
317
+ const mergeCellsTopRow = (0, _number.clamp)(firstRenderedRow, mergeRow, mergeRow + rowspan - 1);
318
+ const mergeCellsStartColumn = (0, _number.clamp)(firstRenderedColumn, mergeColumn, mergeColumn + colspan - 1);
319
+ return this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeCellsTopRow, 1) === row && this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeCellsStartColumn, 1) === column;
308
320
  }
309
321
 
310
322
  /**