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
package/editorManager.js CHANGED
@@ -120,7 +120,7 @@ class EditorManager {
120
120
  row,
121
121
  col
122
122
  } = highlight;
123
- const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
123
+ const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col, false, 'meta');
124
124
  let visualRowToCheck = row;
125
125
  let visualColumnToCheck = col;
126
126
  if (Array.isArray(modifiedCellCoords)) {
@@ -174,7 +174,7 @@ class EditorManager {
174
174
  const selection = this.hot.getSelectedRangeLast();
175
175
  let allowOpening = this.hot.runHooks('beforeBeginEditing', selection.highlight.row, selection.highlight.col, newInitialValue, event, enableFullEditMode);
176
176
 
177
- // If the above hook does not return boolean apply default behavior which disallows opening
177
+ // If the above hook does not return boolean then the default behavior is applied which disallows opening
178
178
  // an editor after double mouse click for non-contiguous selection (while pressing Ctrl/Cmd) and
179
179
  // for multiple selected cells (while pressing SHIFT).
180
180
  if (event instanceof MouseEvent && typeof allowOpening !== 'boolean') {
package/editorManager.mjs CHANGED
@@ -116,7 +116,7 @@ class EditorManager {
116
116
  row,
117
117
  col
118
118
  } = highlight;
119
- const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
119
+ const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col, false, 'meta');
120
120
  let visualRowToCheck = row;
121
121
  let visualColumnToCheck = col;
122
122
  if (Array.isArray(modifiedCellCoords)) {
@@ -170,7 +170,7 @@ class EditorManager {
170
170
  const selection = this.hot.getSelectedRangeLast();
171
171
  let allowOpening = this.hot.runHooks('beforeBeginEditing', selection.highlight.row, selection.highlight.col, newInitialValue, event, enableFullEditMode);
172
172
 
173
- // If the above hook does not return boolean apply default behavior which disallows opening
173
+ // If the above hook does not return boolean then the default behavior is applied which disallows opening
174
174
  // an editor after double mouse click for non-contiguous selection (while pressing Ctrl/Cmd) and
175
175
  // for multiple selected cells (while pressing SHIFT).
176
176
  if (event instanceof MouseEvent && typeof allowOpening !== 'boolean') {
@@ -204,7 +204,7 @@ class BaseEditor {
204
204
  } else {
205
205
  [visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
206
206
  }
207
- const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom);
207
+ const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom, false, 'meta');
208
208
  if (Array.isArray(modifiedCellCoords)) {
209
209
  [visualRowFrom, visualColumnFrom] = modifiedCellCoords;
210
210
  }
@@ -228,22 +228,29 @@ class BaseEditor {
228
228
  // due to hidden columns don't participate in the rendering process
229
229
  const renderableRowIndex = hotInstance.rowIndexMapper.getRenderableFromVisualIndex(this.row);
230
230
  const renderableColumnIndex = hotInstance.columnIndexMapper.getRenderableFromVisualIndex(this.col);
231
- hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
232
- this.state = EDITOR_STATE.EDITING;
233
-
234
- // Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
235
- // otherwise IME (editor for Asia users) doesn't work.
236
- if (this.isInFullEditMode()) {
237
- const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : (0, _mixed.stringify)(this.originalValue);
238
- this.setValue(stringifiedInitialValue);
239
- }
240
- this.open(event);
241
- this._opened = true;
242
- this.focus();
231
+ const openEditor = () => {
232
+ this.state = EDITOR_STATE.EDITING;
243
233
 
244
- // only rerender the selections (FillHandle should disappear when beginEditing is triggered)
245
- hotInstance.view.render();
246
- hotInstance.runHooks('afterBeginEditing', this.row, this.col);
234
+ // Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
235
+ // otherwise IME (editor for Asia users) doesn't work.
236
+ if (this.isInFullEditMode()) {
237
+ const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : (0, _mixed.stringify)(this.originalValue);
238
+ this.setValue(stringifiedInitialValue);
239
+ }
240
+ this.open(event);
241
+ this._opened = true;
242
+ this.focus();
243
+
244
+ // only rerender the selections (FillHandle should disappear when beginEditing is triggered)
245
+ hotInstance.view.render();
246
+ hotInstance.runHooks('afterBeginEditing', this.row, this.col);
247
+ };
248
+ this.hot.addHookOnce('afterScroll', openEditor);
249
+ const wasScroll = hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
250
+ if (!wasScroll) {
251
+ this.hot.removeHook('afterScroll', openEditor);
252
+ openEditor();
253
+ }
247
254
  }
248
255
 
249
256
  /**
@@ -200,7 +200,7 @@ export class BaseEditor {
200
200
  } else {
201
201
  [visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
202
202
  }
203
- const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom);
203
+ const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom, false, 'meta');
204
204
  if (Array.isArray(modifiedCellCoords)) {
205
205
  [visualRowFrom, visualColumnFrom] = modifiedCellCoords;
206
206
  }
@@ -224,22 +224,29 @@ export class BaseEditor {
224
224
  // due to hidden columns don't participate in the rendering process
225
225
  const renderableRowIndex = hotInstance.rowIndexMapper.getRenderableFromVisualIndex(this.row);
226
226
  const renderableColumnIndex = hotInstance.columnIndexMapper.getRenderableFromVisualIndex(this.col);
227
- hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
228
- this.state = EDITOR_STATE.EDITING;
229
-
230
- // Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
231
- // otherwise IME (editor for Asia users) doesn't work.
232
- if (this.isInFullEditMode()) {
233
- const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : stringify(this.originalValue);
234
- this.setValue(stringifiedInitialValue);
235
- }
236
- this.open(event);
237
- this._opened = true;
238
- this.focus();
227
+ const openEditor = () => {
228
+ this.state = EDITOR_STATE.EDITING;
239
229
 
240
- // only rerender the selections (FillHandle should disappear when beginEditing is triggered)
241
- hotInstance.view.render();
242
- hotInstance.runHooks('afterBeginEditing', this.row, this.col);
230
+ // Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
231
+ // otherwise IME (editor for Asia users) doesn't work.
232
+ if (this.isInFullEditMode()) {
233
+ const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : stringify(this.originalValue);
234
+ this.setValue(stringifiedInitialValue);
235
+ }
236
+ this.open(event);
237
+ this._opened = true;
238
+ this.focus();
239
+
240
+ // only rerender the selections (FillHandle should disappear when beginEditing is triggered)
241
+ hotInstance.view.render();
242
+ hotInstance.runHooks('afterBeginEditing', this.row, this.col);
243
+ };
244
+ this.hot.addHookOnce('afterScroll', openEditor);
245
+ const wasScroll = hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
246
+ if (!wasScroll) {
247
+ this.hot.removeHook('afterScroll', openEditor);
248
+ openEditor();
249
+ }
243
250
  }
244
251
 
245
252
  /**
@@ -2,8 +2,7 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  var _autocompleteEditor = require("../autocompleteEditor");
5
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
5
+ var _hooks = require("../../core/hooks");
7
6
  const EDITOR_TYPE = exports.EDITOR_TYPE = 'dropdown';
8
7
 
9
8
  /**
@@ -30,7 +29,7 @@ class DropdownEditor extends _autocompleteEditor.AutocompleteEditor {
30
29
  }
31
30
  }
32
31
  exports.DropdownEditor = DropdownEditor;
33
- _pluginHooks.default.getSingleton().add('beforeValidate', function (value, row, col) {
32
+ _hooks.Hooks.getSingleton().add('beforeValidate', function (value, row, col) {
34
33
  const visualColumnIndex = this.propToCol(col);
35
34
  if (Number.isInteger(visualColumnIndex)) {
36
35
  const cellMeta = this.getCellMeta(row, visualColumnIndex);
@@ -1,5 +1,5 @@
1
1
  import { AutocompleteEditor } from "../autocompleteEditor/index.mjs";
2
- import Hooks from "../../pluginHooks.mjs";
2
+ import { Hooks } from "../../core/hooks/index.mjs";
3
3
  export const EDITOR_TYPE = 'dropdown';
4
4
 
5
5
  /**
@@ -6,7 +6,7 @@ exports.getEditorInstance = exports._getEditorInstance = _getEditorInstance;
6
6
  exports.getEditor = _getItem;
7
7
  exports.registerEditor = _register;
8
8
  require("core-js/modules/es.error.cause.js");
9
- var _pluginHooks = _interopRequireDefault(require("../pluginHooks"));
9
+ var _hooks = require("../core/hooks");
10
10
  var _staticRegister = _interopRequireDefault(require("../utils/staticRegister"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  /**
@@ -40,7 +40,7 @@ function RegisteredEditor(editorClass) {
40
40
  }
41
41
  return instances[hotInstance.guid];
42
42
  };
43
- _pluginHooks.default.getSingleton().add('afterDestroy', function () {
43
+ _hooks.Hooks.getSingleton().add('afterDestroy', function () {
44
44
  instances[this.guid] = null;
45
45
  });
46
46
  }
@@ -2,7 +2,7 @@ import "core-js/modules/es.error.cause.js";
2
2
  /**
3
3
  * Utility to register editors and common namespace for keeping reference to all editor classes.
4
4
  */
5
- import Hooks from "../pluginHooks.mjs";
5
+ import { Hooks } from "../core/hooks/index.mjs";
6
6
  import staticRegister from "../utils/staticRegister.mjs";
7
7
  const registeredEditorClasses = new WeakMap();
8
8
  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-8f89e29-20241003";
137
+ const hotVersion = "0.0.0-next-3d1a0ea-20241007";
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-8f89e29-20241003";
127
+ const hotVersion = "0.0.0-next-3d1a0ea-20241007";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/index.d.ts CHANGED
@@ -78,7 +78,7 @@ import * as dom from './helpers/dom';
78
78
  import CellCoords from './3rdparty/walkontable/src/cell/coords';
79
79
  import CellRange from './3rdparty/walkontable/src/cell/range';
80
80
  import EventManager from './eventManager';
81
- import { Hooks } from './pluginHooks';
81
+ import { Hooks, Events } from './core/hooks';
82
82
  // plugins
83
83
  import {
84
84
  AutoColumnSize as _AutoColumnSize,
@@ -547,5 +547,6 @@ declare class Handsontable extends Core {
547
547
  export {
548
548
  CellCoords,
549
549
  CellRange,
550
+ Events,
550
551
  };
551
552
  export default Handsontable;
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-8f89e29-20241003",
13
+ "version": "0.0.0-next-3d1a0ea-20241007",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -6,7 +6,7 @@ require("core-js/modules/es.array.push.js");
6
6
  var _base = require("../base");
7
7
  var _feature = require("../../helpers/feature");
8
8
  var _ghostTable = _interopRequireDefault(require("../../utils/ghostTable"));
9
- var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
9
+ var _hooks = require("../../core/hooks");
10
10
  var _object = require("../../helpers/object");
11
11
  var _number = require("../../helpers/number");
12
12
  var _samplesGenerator = _interopRequireDefault(require("../../utils/samplesGenerator"));
@@ -23,7 +23,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
23
23
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
24
24
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
25
25
  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"); }
26
- _pluginHooks.default.getSingleton().register('modifyAutoColumnSizeSeed');
26
+ _hooks.Hooks.getSingleton().register('modifyAutoColumnSizeSeed');
27
27
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'autoColumnSize';
28
28
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 10;
29
29
  const COLUMN_SIZE_MAP_NAME = 'autoColumnSize';
@@ -138,6 +138,13 @@ class AutoColumnSize extends _base.BasePlugin {
138
138
  static get SETTING_KEYS() {
139
139
  return true;
140
140
  }
141
+ static get DEFAULT_SETTINGS() {
142
+ return {
143
+ useHeaders: true,
144
+ samplingRatio: null,
145
+ allowSampleDuplicates: false
146
+ };
147
+ }
141
148
  static get CALCULATION_STEP() {
142
149
  return 50;
143
150
  }
@@ -245,11 +252,12 @@ class AutoColumnSize extends _base.BasePlugin {
245
252
  if (this.enabled) {
246
253
  return;
247
254
  }
248
- const setting = this.hot.getSettings()[PLUGIN_KEY];
249
- if (setting && setting.useHeaders !== null && setting.useHeaders !== undefined) {
250
- this.ghostTable.setSetting('useHeaders', setting.useHeaders);
255
+ this.ghostTable.setSetting('useHeaders', this.getSetting('useHeaders'));
256
+ this.samplesGenerator.setAllowDuplicates(this.getSetting('allowSampleDuplicates'));
257
+ const samplingRatio = this.getSetting('samplingRatio');
258
+ if (samplingRatio && !isNaN(samplingRatio)) {
259
+ this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
251
260
  }
252
- this.setSamplingOptions();
253
261
  this.addHook('afterLoadData', function () {
254
262
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
255
263
  args[_key] = arguments[_key];
@@ -416,23 +424,6 @@ class AutoColumnSize extends _base.BasePlugin {
416
424
  this.inProgress = false;
417
425
  }
418
426
  }
419
- /**
420
- * Sets the sampling options.
421
- *
422
- * @private
423
- */
424
- setSamplingOptions() {
425
- const setting = this.hot.getSettings()[PLUGIN_KEY];
426
- const samplingRatio = setting && (0, _object.hasOwnProperty)(setting, 'samplingRatio') ? setting.samplingRatio : undefined;
427
- const allowSampleDuplicates = setting && (0, _object.hasOwnProperty)(setting, 'allowSampleDuplicates') ? setting.allowSampleDuplicates : undefined;
428
- if (samplingRatio && !isNaN(samplingRatio)) {
429
- this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
430
- }
431
- if (allowSampleDuplicates) {
432
- this.samplesGenerator.setAllowDuplicates(allowSampleDuplicates);
433
- }
434
- }
435
-
436
427
  /**
437
428
  * Recalculates all columns width (overwrite cache values).
438
429
  */
@@ -494,8 +485,8 @@ class AutoColumnSize extends _base.BasePlugin {
494
485
  * @returns {number} Returns visual column index, -1 if table is not rendered or if there are no columns to base the the calculations on.
495
486
  */
496
487
  getFirstVisibleColumn() {
497
- var _this$hot$view$getFir;
498
- return (_this$hot$view$getFir = this.hot.view.getFirstRenderedVisibleColumn()) !== null && _this$hot$view$getFir !== void 0 ? _this$hot$view$getFir : -1;
488
+ var _this$hot$getFirstRen;
489
+ return (_this$hot$getFirstRen = this.hot.getFirstRenderedVisibleColumn()) !== null && _this$hot$getFirstRen !== void 0 ? _this$hot$getFirstRen : -1;
499
490
  }
500
491
 
501
492
  /**
@@ -504,8 +495,8 @@ class AutoColumnSize extends _base.BasePlugin {
504
495
  * @returns {number} Returns visual column index or -1 if table is not rendered.
505
496
  */
506
497
  getLastVisibleColumn() {
507
- var _this$hot$view$getLas;
508
- return (_this$hot$view$getLas = this.hot.view.getLastRenderedVisibleColumn()) !== null && _this$hot$view$getLas !== void 0 ? _this$hot$view$getLas : -1;
498
+ var _this$hot$getLastRend;
499
+ return (_this$hot$getLastRend = this.hot.getLastRenderedVisibleColumn()) !== null && _this$hot$getLastRend !== void 0 ? _this$hot$getLastRend : -1;
509
500
  }
510
501
 
511
502
  /**
@@ -12,8 +12,8 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
12
12
  import { BasePlugin } from "../base/index.mjs";
13
13
  import { cancelAnimationFrame, requestAnimationFrame } from "../../helpers/feature.mjs";
14
14
  import GhostTable from "../../utils/ghostTable.mjs";
15
- import Hooks from "../../pluginHooks.mjs";
16
- import { isObject, hasOwnProperty } from "../../helpers/object.mjs";
15
+ import { Hooks } from "../../core/hooks/index.mjs";
16
+ import { isObject } from "../../helpers/object.mjs";
17
17
  import { valueAccordingPercent, rangeEach } from "../../helpers/number.mjs";
18
18
  import SamplesGenerator from "../../utils/samplesGenerator.mjs";
19
19
  import { isPercentValue } from "../../helpers/string.mjs";
@@ -134,6 +134,13 @@ export class AutoColumnSize extends BasePlugin {
134
134
  static get SETTING_KEYS() {
135
135
  return true;
136
136
  }
137
+ static get DEFAULT_SETTINGS() {
138
+ return {
139
+ useHeaders: true,
140
+ samplingRatio: null,
141
+ allowSampleDuplicates: false
142
+ };
143
+ }
137
144
  static get CALCULATION_STEP() {
138
145
  return 50;
139
146
  }
@@ -241,11 +248,12 @@ export class AutoColumnSize extends BasePlugin {
241
248
  if (this.enabled) {
242
249
  return;
243
250
  }
244
- const setting = this.hot.getSettings()[PLUGIN_KEY];
245
- if (setting && setting.useHeaders !== null && setting.useHeaders !== undefined) {
246
- this.ghostTable.setSetting('useHeaders', setting.useHeaders);
251
+ this.ghostTable.setSetting('useHeaders', this.getSetting('useHeaders'));
252
+ this.samplesGenerator.setAllowDuplicates(this.getSetting('allowSampleDuplicates'));
253
+ const samplingRatio = this.getSetting('samplingRatio');
254
+ if (samplingRatio && !isNaN(samplingRatio)) {
255
+ this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
247
256
  }
248
- this.setSamplingOptions();
249
257
  this.addHook('afterLoadData', function () {
250
258
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
251
259
  args[_key] = arguments[_key];
@@ -412,23 +420,6 @@ export class AutoColumnSize extends BasePlugin {
412
420
  this.inProgress = false;
413
421
  }
414
422
  }
415
- /**
416
- * Sets the sampling options.
417
- *
418
- * @private
419
- */
420
- setSamplingOptions() {
421
- const setting = this.hot.getSettings()[PLUGIN_KEY];
422
- const samplingRatio = setting && hasOwnProperty(setting, 'samplingRatio') ? setting.samplingRatio : undefined;
423
- const allowSampleDuplicates = setting && hasOwnProperty(setting, 'allowSampleDuplicates') ? setting.allowSampleDuplicates : undefined;
424
- if (samplingRatio && !isNaN(samplingRatio)) {
425
- this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
426
- }
427
- if (allowSampleDuplicates) {
428
- this.samplesGenerator.setAllowDuplicates(allowSampleDuplicates);
429
- }
430
- }
431
-
432
423
  /**
433
424
  * Recalculates all columns width (overwrite cache values).
434
425
  */
@@ -490,8 +481,8 @@ export class AutoColumnSize extends BasePlugin {
490
481
  * @returns {number} Returns visual column index, -1 if table is not rendered or if there are no columns to base the the calculations on.
491
482
  */
492
483
  getFirstVisibleColumn() {
493
- var _this$hot$view$getFir;
494
- return (_this$hot$view$getFir = this.hot.view.getFirstRenderedVisibleColumn()) !== null && _this$hot$view$getFir !== void 0 ? _this$hot$view$getFir : -1;
484
+ var _this$hot$getFirstRen;
485
+ return (_this$hot$getFirstRen = this.hot.getFirstRenderedVisibleColumn()) !== null && _this$hot$getFirstRen !== void 0 ? _this$hot$getFirstRen : -1;
495
486
  }
496
487
 
497
488
  /**
@@ -500,8 +491,8 @@ export class AutoColumnSize extends BasePlugin {
500
491
  * @returns {number} Returns visual column index or -1 if table is not rendered.
501
492
  */
502
493
  getLastVisibleColumn() {
503
- var _this$hot$view$getLas;
504
- return (_this$hot$view$getLas = this.hot.view.getLastRenderedVisibleColumn()) !== null && _this$hot$view$getLas !== void 0 ? _this$hot$view$getLas : -1;
494
+ var _this$hot$getLastRend;
495
+ return (_this$hot$getLastRend = this.hot.getLastRenderedVisibleColumn()) !== null && _this$hot$getLastRend !== void 0 ? _this$hot$getLastRend : -1;
505
496
  }
506
497
 
507
498
  /**
@@ -120,6 +120,13 @@ class AutoRowSize extends _base.BasePlugin {
120
120
  static get SETTING_KEYS() {
121
121
  return true;
122
122
  }
123
+ static get DEFAULT_SETTINGS() {
124
+ return {
125
+ useHeaders: true,
126
+ samplingRatio: null,
127
+ allowSampleDuplicates: false
128
+ };
129
+ }
123
130
  static get CALCULATION_STEP() {
124
131
  return 50;
125
132
  }
@@ -230,7 +237,11 @@ class AutoRowSize extends _base.BasePlugin {
230
237
  if (this.enabled) {
231
238
  return;
232
239
  }
233
- this.setSamplingOptions();
240
+ this.samplesGenerator.setAllowDuplicates(this.getSetting('allowSampleDuplicates'));
241
+ const samplingRatio = this.getSetting('samplingRatio');
242
+ if (samplingRatio && !isNaN(samplingRatio)) {
243
+ this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
244
+ }
234
245
  this.addHook('afterLoadData', function () {
235
246
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
236
247
  args[_key] = arguments[_key];
@@ -408,23 +419,6 @@ class AutoRowSize extends _base.BasePlugin {
408
419
  this.hot.view.adjustElementsSize();
409
420
  }
410
421
  }
411
- /**
412
- * Sets the sampling options.
413
- *
414
- * @private
415
- */
416
- setSamplingOptions() {
417
- const setting = this.hot.getSettings()[PLUGIN_KEY];
418
- const samplingRatio = setting && (0, _object.hasOwnProperty)(setting, 'samplingRatio') ? setting.samplingRatio : undefined;
419
- const allowSampleDuplicates = setting && (0, _object.hasOwnProperty)(setting, 'allowSampleDuplicates') ? setting.allowSampleDuplicates : undefined;
420
- if (samplingRatio && !isNaN(samplingRatio)) {
421
- this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
422
- }
423
- if (allowSampleDuplicates) {
424
- this.samplesGenerator.setAllowDuplicates(allowSampleDuplicates);
425
- }
426
- }
427
-
428
422
  /**
429
423
  * Recalculates all rows height (overwrite cache values).
430
424
  */
@@ -497,8 +491,8 @@ class AutoRowSize extends _base.BasePlugin {
497
491
  * @returns {number} Returns row index, -1 if table is not rendered or if there are no rows to base the the calculations on.
498
492
  */
499
493
  getFirstVisibleRow() {
500
- var _this$hot$view$getFir;
501
- return (_this$hot$view$getFir = this.hot.view.getFirstRenderedVisibleRow()) !== null && _this$hot$view$getFir !== void 0 ? _this$hot$view$getFir : -1;
494
+ var _this$hot$getFirstRen;
495
+ return (_this$hot$getFirstRen = this.hot.getFirstRenderedVisibleRow()) !== null && _this$hot$getFirstRen !== void 0 ? _this$hot$getFirstRen : -1;
502
496
  }
503
497
 
504
498
  /**
@@ -507,8 +501,8 @@ class AutoRowSize extends _base.BasePlugin {
507
501
  * @returns {number} Returns row index or -1 if table is not rendered.
508
502
  */
509
503
  getLastVisibleRow() {
510
- var _this$hot$view$getLas;
511
- return (_this$hot$view$getLas = this.hot.view.getLastRenderedVisibleRow()) !== null && _this$hot$view$getLas !== void 0 ? _this$hot$view$getLas : -1;
504
+ var _this$hot$getLastRend;
505
+ return (_this$hot$getLastRend = this.hot.getLastRenderedVisibleRow()) !== null && _this$hot$getLastRend !== void 0 ? _this$hot$getLastRend : -1;
512
506
  }
513
507
 
514
508
  /**
@@ -12,7 +12,7 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
12
12
  import { BasePlugin } from "../base/index.mjs";
13
13
  import { cancelAnimationFrame, requestAnimationFrame } from "../../helpers/feature.mjs";
14
14
  import GhostTable from "../../utils/ghostTable.mjs";
15
- import { isObject, hasOwnProperty } from "../../helpers/object.mjs";
15
+ import { isObject } from "../../helpers/object.mjs";
16
16
  import { valueAccordingPercent, rangeEach } from "../../helpers/number.mjs";
17
17
  import SamplesGenerator from "../../utils/samplesGenerator.mjs";
18
18
  import { isPercentValue } from "../../helpers/string.mjs";
@@ -116,6 +116,13 @@ export class AutoRowSize extends BasePlugin {
116
116
  static get SETTING_KEYS() {
117
117
  return true;
118
118
  }
119
+ static get DEFAULT_SETTINGS() {
120
+ return {
121
+ useHeaders: true,
122
+ samplingRatio: null,
123
+ allowSampleDuplicates: false
124
+ };
125
+ }
119
126
  static get CALCULATION_STEP() {
120
127
  return 50;
121
128
  }
@@ -226,7 +233,11 @@ export class AutoRowSize extends BasePlugin {
226
233
  if (this.enabled) {
227
234
  return;
228
235
  }
229
- this.setSamplingOptions();
236
+ this.samplesGenerator.setAllowDuplicates(this.getSetting('allowSampleDuplicates'));
237
+ const samplingRatio = this.getSetting('samplingRatio');
238
+ if (samplingRatio && !isNaN(samplingRatio)) {
239
+ this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
240
+ }
230
241
  this.addHook('afterLoadData', function () {
231
242
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
232
243
  args[_key] = arguments[_key];
@@ -404,23 +415,6 @@ export class AutoRowSize extends BasePlugin {
404
415
  this.hot.view.adjustElementsSize();
405
416
  }
406
417
  }
407
- /**
408
- * Sets the sampling options.
409
- *
410
- * @private
411
- */
412
- setSamplingOptions() {
413
- const setting = this.hot.getSettings()[PLUGIN_KEY];
414
- const samplingRatio = setting && hasOwnProperty(setting, 'samplingRatio') ? setting.samplingRatio : undefined;
415
- const allowSampleDuplicates = setting && hasOwnProperty(setting, 'allowSampleDuplicates') ? setting.allowSampleDuplicates : undefined;
416
- if (samplingRatio && !isNaN(samplingRatio)) {
417
- this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
418
- }
419
- if (allowSampleDuplicates) {
420
- this.samplesGenerator.setAllowDuplicates(allowSampleDuplicates);
421
- }
422
- }
423
-
424
418
  /**
425
419
  * Recalculates all rows height (overwrite cache values).
426
420
  */
@@ -493,8 +487,8 @@ export class AutoRowSize extends BasePlugin {
493
487
  * @returns {number} Returns row index, -1 if table is not rendered or if there are no rows to base the the calculations on.
494
488
  */
495
489
  getFirstVisibleRow() {
496
- var _this$hot$view$getFir;
497
- return (_this$hot$view$getFir = this.hot.view.getFirstRenderedVisibleRow()) !== null && _this$hot$view$getFir !== void 0 ? _this$hot$view$getFir : -1;
490
+ var _this$hot$getFirstRen;
491
+ return (_this$hot$getFirstRen = this.hot.getFirstRenderedVisibleRow()) !== null && _this$hot$getFirstRen !== void 0 ? _this$hot$getFirstRen : -1;
498
492
  }
499
493
 
500
494
  /**
@@ -503,8 +497,8 @@ export class AutoRowSize extends BasePlugin {
503
497
  * @returns {number} Returns row index or -1 if table is not rendered.
504
498
  */
505
499
  getLastVisibleRow() {
506
- var _this$hot$view$getLas;
507
- return (_this$hot$view$getLas = this.hot.view.getLastRenderedVisibleRow()) !== null && _this$hot$view$getLas !== void 0 ? _this$hot$view$getLas : -1;
500
+ var _this$hot$getLastRend;
501
+ return (_this$hot$getLastRend = this.hot.getLastRenderedVisibleRow()) !== null && _this$hot$getLastRend !== void 0 ? _this$hot$getLastRend : -1;
508
502
  }
509
503
 
510
504
  /**
@@ -4,21 +4,20 @@ 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 _element = require("../../helpers/dom/element");
9
9
  var _array = require("../../helpers/array");
10
10
  var _mixed = require("../../helpers/mixed");
11
11
  var _utils = require("./utils");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
14
13
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
15
14
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
16
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
17
  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"); }
19
- _pluginHooks.default.getSingleton().register('modifyAutofillRange');
20
- _pluginHooks.default.getSingleton().register('beforeAutofill');
21
- _pluginHooks.default.getSingleton().register('afterAutofill');
18
+ _hooks.Hooks.getSingleton().register('modifyAutofillRange');
19
+ _hooks.Hooks.getSingleton().register('beforeAutofill');
20
+ _hooks.Hooks.getSingleton().register('afterAutofill');
22
21
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'autofill';
23
22
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 20;
24
23
  const SETTING_KEYS = ['fillHandle'];
@@ -7,7 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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 { offset, outerHeight, outerWidth } from "../../helpers/dom/element.mjs";
12
12
  import { arrayEach, arrayMap } from "../../helpers/array.mjs";
13
13
  import { isEmpty } from "../../helpers/mixed.mjs";
@@ -1,5 +1,5 @@
1
1
  import Core from '../../core';
2
- import { Events } from '../../pluginHooks';
2
+ import { Events } from '../../core/hooks';
3
3
 
4
4
  export class BasePlugin {
5
5
  readonly hot: Core;