handsontable 0.0.0-next-fad35d5-20240924 → 0.0.0-next-d7edb4b-20240927

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 (127) hide show
  1. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -23
  2. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -23
  3. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -23
  4. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -23
  5. package/3rdparty/walkontable/src/core/_base.js +0 -7
  6. package/3rdparty/walkontable/src/core/_base.mjs +0 -7
  7. package/3rdparty/walkontable/src/facade/core.js +0 -3
  8. package/3rdparty/walkontable/src/facade/core.mjs +0 -3
  9. package/3rdparty/walkontable/src/overlay/_base.js +0 -3
  10. package/3rdparty/walkontable/src/overlay/_base.mjs +0 -3
  11. package/3rdparty/walkontable/src/selection/border/border.js +45 -33
  12. package/3rdparty/walkontable/src/selection/border/border.mjs +46 -34
  13. package/3rdparty/walkontable/src/selection/scanner.js +11 -46
  14. package/3rdparty/walkontable/src/selection/scanner.mjs +11 -46
  15. package/3rdparty/walkontable/src/settings.js +0 -8
  16. package/3rdparty/walkontable/src/settings.mjs +0 -8
  17. package/3rdparty/walkontable/src/table/master.js +1 -1
  18. package/3rdparty/walkontable/src/table/master.mjs +2 -2
  19. package/3rdparty/walkontable/src/table.js +3 -6
  20. package/3rdparty/walkontable/src/table.mjs +3 -6
  21. package/3rdparty/walkontable/src/viewport.js +4 -26
  22. package/3rdparty/walkontable/src/viewport.mjs +4 -26
  23. package/base.js +4 -4
  24. package/base.mjs +3 -3
  25. package/core.d.ts +1 -1
  26. package/core.js +12 -13
  27. package/core.mjs +4 -5
  28. package/dataMap/metaManager/metaSchema.js +2 -68
  29. package/dataMap/metaManager/metaSchema.mjs +2 -68
  30. package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
  31. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
  32. package/dist/handsontable.css +2 -2
  33. package/dist/handsontable.full.css +2 -2
  34. package/dist/handsontable.full.js +2685 -3046
  35. package/dist/handsontable.full.min.css +2 -2
  36. package/dist/handsontable.full.min.js +75 -75
  37. package/dist/handsontable.js +2687 -3048
  38. package/dist/handsontable.min.css +2 -2
  39. package/dist/handsontable.min.js +18 -18
  40. package/editorManager.js +2 -2
  41. package/editorManager.mjs +2 -2
  42. package/editors/autocompleteEditor/autocompleteEditor.js +31 -14
  43. package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -14
  44. package/editors/baseEditor/baseEditor.js +17 -24
  45. package/editors/baseEditor/baseEditor.mjs +18 -25
  46. package/editors/dropdownEditor/dropdownEditor.js +3 -2
  47. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  48. package/editors/handsontableEditor/handsontableEditor.js +24 -0
  49. package/editors/handsontableEditor/handsontableEditor.mjs +24 -0
  50. package/editors/registry.js +2 -2
  51. package/editors/registry.mjs +1 -1
  52. package/editors/textEditor/textEditor.js +2 -2
  53. package/editors/textEditor/textEditor.mjs +3 -3
  54. package/helpers/dom/element.js +4 -17
  55. package/helpers/dom/element.mjs +4 -16
  56. package/helpers/mixed.js +1 -1
  57. package/helpers/mixed.mjs +1 -1
  58. package/index.d.ts +1 -2
  59. package/package.json +1 -1
  60. package/{core/hooks/index.d.ts → pluginHooks.d.ts} +21 -17
  61. package/{core/hooks/constants.mjs → pluginHooks.js} +489 -16
  62. package/{core/hooks/constants.js → pluginHooks.mjs} +486 -20
  63. package/plugins/autoColumnSize/autoColumnSize.js +27 -18
  64. package/plugins/autoColumnSize/autoColumnSize.mjs +27 -18
  65. package/plugins/autoRowSize/autoRowSize.js +22 -16
  66. package/plugins/autoRowSize/autoRowSize.mjs +23 -17
  67. package/plugins/autofill/autofill.js +5 -4
  68. package/plugins/autofill/autofill.mjs +1 -1
  69. package/plugins/base/base.d.ts +1 -1
  70. package/plugins/base/base.js +0 -39
  71. package/plugins/base/base.mjs +1 -40
  72. package/plugins/base/index.js +1 -2
  73. package/plugins/base/index.mjs +1 -1
  74. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -2
  75. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -2
  76. package/plugins/columnSorting/columnSorting.js +4 -3
  77. package/plugins/columnSorting/columnSorting.mjs +1 -1
  78. package/plugins/comments/comments.js +15 -7
  79. package/plugins/comments/comments.mjs +16 -8
  80. package/plugins/contextMenu/contextMenu.js +7 -6
  81. package/plugins/contextMenu/contextMenu.mjs +1 -1
  82. package/plugins/contextMenu/menu/menu.js +1 -1
  83. package/plugins/contextMenu/menu/menu.mjs +2 -2
  84. package/plugins/contextMenu/menu/positioner.js +4 -2
  85. package/plugins/contextMenu/menu/positioner.mjs +4 -2
  86. package/plugins/copyPaste/copyPaste.js +23 -29
  87. package/plugins/copyPaste/copyPaste.mjs +15 -21
  88. package/plugins/dropdownMenu/dropdownMenu.js +7 -6
  89. package/plugins/dropdownMenu/dropdownMenu.mjs +1 -1
  90. package/plugins/formulas/formulas.js +7 -7
  91. package/plugins/formulas/formulas.mjs +1 -1
  92. package/plugins/hiddenColumns/hiddenColumns.js +30 -19
  93. package/plugins/hiddenColumns/hiddenColumns.mjs +26 -15
  94. package/plugins/hiddenRows/hiddenRows.js +29 -18
  95. package/plugins/hiddenRows/hiddenRows.mjs +25 -14
  96. package/plugins/manualColumnFreeze/manualColumnFreeze.js +5 -5
  97. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +1 -1
  98. package/plugins/manualColumnMove/manualColumnMove.js +3 -3
  99. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
  100. package/plugins/manualRowMove/manualRowMove.js +5 -5
  101. package/plugins/manualRowMove/manualRowMove.mjs +3 -3
  102. package/plugins/mergeCells/cellsCollection.js +3 -15
  103. package/plugins/mergeCells/cellsCollection.mjs +4 -16
  104. package/plugins/mergeCells/mergeCells.d.ts +2 -6
  105. package/plugins/mergeCells/mergeCells.js +55 -78
  106. package/plugins/mergeCells/mergeCells.mjs +53 -76
  107. package/plugins/mergeCells/renderer.js +3 -13
  108. package/plugins/mergeCells/renderer.mjs +3 -13
  109. package/plugins/persistentState/persistentState.js +4 -4
  110. package/plugins/persistentState/persistentState.mjs +1 -1
  111. package/plugins/undoRedo/undoRedo.js +5 -4
  112. package/plugins/undoRedo/undoRedo.mjs +3 -3
  113. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  114. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  115. package/settings.d.ts +1 -3
  116. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +1 -1
  117. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +1 -1
  118. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +1 -1
  119. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +1 -1
  120. package/shortcutContexts/commands/scrollToFocusedCell.js +4 -4
  121. package/shortcutContexts/commands/scrollToFocusedCell.mjs +4 -4
  122. package/tableView.js +43 -38
  123. package/tableView.mjs +43 -38
  124. package/core/hooks/bucket.js +0 -180
  125. package/core/hooks/bucket.mjs +0 -176
  126. package/core/hooks/index.js +0 -385
  127. package/core/hooks/index.mjs +0 -381
@@ -1,381 +0,0 @@
1
- import "core-js/modules/es.error.cause.js";
2
- import "core-js/modules/es.array.push.js";
3
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import { arrayEach } from "../../helpers/array.mjs";
7
- import { substitute } from "../../helpers/string.mjs";
8
- import { warn } from "../../helpers/console.mjs";
9
- import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
10
- import { fastCall } from "../../helpers/function.mjs";
11
- import { REGISTERED_HOOKS, REMOVED_HOOKS, DEPRECATED_HOOKS } from "./constants.mjs";
12
- import { HooksBucket } from "./bucket.mjs";
13
- /**
14
- * Template warning message for removed hooks.
15
- *
16
- * @type {string}
17
- */
18
- const REMOVED_MESSAGE = toSingleLine`The plugin hook "[hookName]" was removed in Handsontable [removedInVersion].\x20
19
- Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\x20
20
- learn about the migration path.`;
21
- export class Hooks {
22
- constructor() {
23
- /**
24
- * @type {HooksBucket}
25
- */
26
- _defineProperty(this, "globalBucket", new HooksBucket());
27
- }
28
- static getSingleton() {
29
- return getGlobalSingleton();
30
- }
31
- /**
32
- * Get hook bucket based on the context of the object or if argument is missing, get the global hook bucket.
33
- *
34
- * @param {object} [context=null] A Handsontable instance.
35
- * @returns {HooksBucket} Returns a global or Handsontable instance bucket.
36
- */
37
- getBucket() {
38
- let context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
39
- if (context) {
40
- if (!context.pluginHookBucket) {
41
- context.pluginHookBucket = new HooksBucket();
42
- }
43
- return context.pluginHookBucket;
44
- }
45
- return this.globalBucket;
46
- }
47
-
48
- /**
49
- * Adds a listener (globally or locally) to a specified hook name.
50
- * If the `context` parameter is provided, the hook will be added only to the instance it references.
51
- * Otherwise, the callback will be used every time the hook fires on any Handsontable instance.
52
- * You can provide an array of callback functions as the `callback` argument, this way they will all be fired
53
- * once the hook is triggered.
54
- *
55
- * @param {string} key Hook name.
56
- * @param {Function|Function[]} callback Callback function or an array of functions.
57
- * @param {object} [context=null] The context for the hook callback to be added - a Handsontable instance or leave empty.
58
- * @param {number} [orderIndex] Order index of the callback.
59
- * If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
60
- * If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
61
- * If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
62
- * @returns {Hooks} Instance of Hooks.
63
- *
64
- * @example
65
- * ```js
66
- * // single callback, added locally
67
- * Handsontable.hooks.add('beforeInit', myCallback, hotInstance);
68
- *
69
- * // single callback, added globally
70
- * Handsontable.hooks.add('beforeInit', myCallback);
71
- *
72
- * // multiple callbacks, added locally
73
- * Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback], hotInstance);
74
- *
75
- * // multiple callbacks, added globally
76
- * Handsontable.hooks.add('beforeInit', [myCallback, anotherCallback]);
77
- * ```
78
- */
79
- add(key, callback) {
80
- let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
81
- let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
82
- if (Array.isArray(callback)) {
83
- arrayEach(callback, c => this.add(key, c, context));
84
- } else {
85
- if (REMOVED_HOOKS.has(key)) {
86
- warn(substitute(REMOVED_MESSAGE, {
87
- hookName: key,
88
- removedInVersion: REMOVED_HOOKS.get(key)
89
- }));
90
- }
91
- if (DEPRECATED_HOOKS.has(key)) {
92
- warn(DEPRECATED_HOOKS.get(key));
93
- }
94
- this.getBucket(context).add(key, callback, {
95
- orderIndex,
96
- runOnce: false
97
- });
98
- }
99
- return this;
100
- }
101
-
102
- /**
103
- * Adds a listener to a specified hook. After the hook runs this listener will be automatically removed from the bucket.
104
- *
105
- * @param {string} key Hook/Event name.
106
- * @param {Function|Function[]} callback Callback function.
107
- * @param {object} [context=null] A Handsontable instance.
108
- * @param {number} [orderIndex] Order index of the callback.
109
- * If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
110
- * If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
111
- * If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
112
- * @returns {Hooks} Instance of Hooks.
113
- *
114
- * @example
115
- * ```js
116
- * Handsontable.hooks.once('beforeInit', myCallback, hotInstance);
117
- * ```
118
- */
119
- once(key, callback) {
120
- let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
121
- let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
122
- if (Array.isArray(callback)) {
123
- arrayEach(callback, c => this.once(key, c, context));
124
- } else {
125
- this.getBucket(context).add(key, callback, {
126
- orderIndex,
127
- runOnce: true
128
- });
129
- }
130
- return this;
131
- }
132
-
133
- /**
134
- * Adds a listener to a specified hook. The added hook stays in the bucket at specified index position even after
135
- * adding another one with the same hook name.
136
- *
137
- * @param {string} key Hook/Event name.
138
- * @param {Function|Function[]} callback Callback function.
139
- * @param {object} [context=null] A Handsontable instance.
140
- * @returns {Hooks} Instance of Hooks.
141
- *
142
- * @example
143
- * ```js
144
- * Handsontable.hooks.addAsFixed('beforeInit', myCallback, hotInstance);
145
- * ```
146
- */
147
- addAsFixed(key, callback) {
148
- let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
149
- if (Array.isArray(callback)) {
150
- arrayEach(callback, c => this.addAsFixed(key, c, context));
151
- } else {
152
- this.getBucket(context).add(key, callback, {
153
- initialHook: true
154
- });
155
- }
156
- return this;
157
- }
158
-
159
- /**
160
- * Removes a listener from a hook with a given name. If the `context` argument is provided, it removes a listener from a local hook assigned to the given Handsontable instance.
161
- *
162
- * @param {string} key Hook/Event name.
163
- * @param {Function} callback Callback function (needs the be the function that was previously added to the hook).
164
- * @param {object} [context=null] Handsontable instance.
165
- * @returns {boolean} Returns `true` if hook was removed, `false` otherwise.
166
- *
167
- * @example
168
- * ```js
169
- * Handsontable.hooks.remove('beforeInit', myCallback);
170
- * ```
171
- */
172
- remove(key, callback) {
173
- let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
174
- return this.getBucket(context).remove(key, callback);
175
- }
176
-
177
- /**
178
- * Checks whether there are any registered listeners for the provided hook name.
179
- * If the `context` parameter is provided, it only checks for listeners assigned to the given Handsontable instance.
180
- *
181
- * @param {string} key Hook name.
182
- * @param {object} [context=null] A Handsontable instance.
183
- * @returns {boolean} `true` for success, `false` otherwise.
184
- */
185
- has(key) {
186
- let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
187
- return this.getBucket(context).has(key);
188
- }
189
-
190
- /**
191
- * Runs all local and global callbacks assigned to the hook identified by the `key` parameter.
192
- * It returns either a return value from the last called callback or the first parameter (`p1`) passed to the `run` function.
193
- *
194
- * @param {object} context Handsontable instance.
195
- * @param {string} key Hook/Event name.
196
- * @param {*} [p1] Parameter to be passed as an argument to the callback function.
197
- * @param {*} [p2] Parameter to be passed as an argument to the callback function.
198
- * @param {*} [p3] Parameter to be passed as an argument to the callback function.
199
- * @param {*} [p4] Parameter to be passed as an argument to the callback function.
200
- * @param {*} [p5] Parameter to be passed as an argument to the callback function.
201
- * @param {*} [p6] Parameter to be passed as an argument to the callback function.
202
- * @returns {*} Either a return value from the last called callback or `p1`.
203
- *
204
- * @example
205
- * ```js
206
- * Handsontable.hooks.run(hot, 'beforeInit');
207
- * ```
208
- */
209
- run(context, key, p1, p2, p3, p4, p5, p6) {
210
- {
211
- const globalHandlers = this.getBucket().getHooks(key);
212
- const length = globalHandlers ? globalHandlers.length : 0;
213
- let index = 0;
214
- if (length) {
215
- // Do not optimize this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC.
216
- while (index < length) {
217
- if (!globalHandlers[index] || globalHandlers[index].skip) {
218
- index += 1;
219
- /* eslint-disable no-continue */
220
- continue;
221
- }
222
- const res = fastCall(globalHandlers[index].callback, context, p1, p2, p3, p4, p5, p6);
223
- if (res !== undefined) {
224
- // eslint-disable-next-line no-param-reassign
225
- p1 = res;
226
- }
227
- if (globalHandlers[index] && globalHandlers[index].runOnce) {
228
- this.remove(key, globalHandlers[index].callback);
229
- }
230
- index += 1;
231
- }
232
- }
233
- }
234
- {
235
- const localHandlers = this.getBucket(context).getHooks(key);
236
- const length = localHandlers ? localHandlers.length : 0;
237
- let index = 0;
238
- if (length) {
239
- // Do not optimize this loop with arrayEach or arrow function! If you do You'll decrease perf because of GC.
240
- while (index < length) {
241
- if (!localHandlers[index] || localHandlers[index].skip) {
242
- index += 1;
243
- /* eslint-disable no-continue */
244
- continue;
245
- }
246
- const res = fastCall(localHandlers[index].callback, context, p1, p2, p3, p4, p5, p6);
247
- if (res !== undefined) {
248
- // eslint-disable-next-line no-param-reassign
249
- p1 = res;
250
- }
251
- if (localHandlers[index] && localHandlers[index].runOnce) {
252
- this.remove(key, localHandlers[index].callback, context);
253
- }
254
- index += 1;
255
- }
256
- }
257
- }
258
- return p1;
259
- }
260
-
261
- /**
262
- * Destroy all listeners connected to the context. If no context is provided, the global listeners will be destroyed.
263
- *
264
- * @param {object} [context=null] A Handsontable instance.
265
- * @example
266
- * ```js
267
- * // destroy the global listeners
268
- * Handsontable.hooks.destroy();
269
- *
270
- * // destroy the local listeners
271
- * Handsontable.hooks.destroy(hotInstance);
272
- * ```
273
- */
274
- destroy() {
275
- let context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
276
- this.getBucket(context).destroy();
277
- }
278
-
279
- /**
280
- * Registers a hook name (adds it to the list of the known hook names). Used by plugins.
281
- * It is not necessary to call register, but if you use it, your plugin hook will be used returned by
282
- * the `getRegistered` method. (which itself is used in the [demo](@/guides/getting-started/events-and-hooks/events-and-hooks.md)).
283
- *
284
- * @param {string} key The hook name.
285
- *
286
- * @example
287
- * ```js
288
- * Handsontable.hooks.register('myHook');
289
- * ```
290
- */
291
- register(key) {
292
- if (!this.isRegistered(key)) {
293
- REGISTERED_HOOKS.push(key);
294
- }
295
- }
296
-
297
- /**
298
- * Deregisters a hook name (removes it from the list of known hook names).
299
- *
300
- * @param {string} key The hook name.
301
- *
302
- * @example
303
- * ```js
304
- * Handsontable.hooks.deregister('myHook');
305
- * ```
306
- */
307
- deregister(key) {
308
- if (this.isRegistered(key)) {
309
- REGISTERED_HOOKS.splice(REGISTERED_HOOKS.indexOf(key), 1);
310
- }
311
- }
312
-
313
- /**
314
- * Returns a boolean value depending on if a hook by such name has been removed or deprecated.
315
- *
316
- * @param {string} hookName The hook name to check.
317
- * @returns {boolean} Returns `true` if the provided hook name was marked as deprecated or
318
- * removed from API, `false` otherwise.
319
- * @example
320
- * ```js
321
- * Handsontable.hooks.isDeprecated('skipLengthCache');
322
- *
323
- * // Results:
324
- * true
325
- * ```
326
- */
327
- isDeprecated(hookName) {
328
- return DEPRECATED_HOOKS.has(hookName) || REMOVED_HOOKS.has(hookName);
329
- }
330
-
331
- /**
332
- * Returns a boolean depending on if a hook by such name has been registered.
333
- *
334
- * @param {string} hookName The hook name to check.
335
- * @returns {boolean} `true` for success, `false` otherwise.
336
- * @example
337
- * ```js
338
- * Handsontable.hooks.isRegistered('beforeInit');
339
- *
340
- * // Results:
341
- * true
342
- * ```
343
- */
344
- isRegistered(hookName) {
345
- return REGISTERED_HOOKS.indexOf(hookName) >= 0;
346
- }
347
-
348
- /**
349
- * Returns an array of registered hooks.
350
- *
351
- * @returns {Array} An array of registered hooks.
352
- *
353
- * @example
354
- * ```js
355
- * Handsontable.hooks.getRegistered();
356
- *
357
- * // Results:
358
- * [
359
- * ...
360
- * 'beforeInit',
361
- * 'beforeRender',
362
- * 'beforeSetRangeEnd',
363
- * 'beforeDrawBorders',
364
- * 'beforeChange',
365
- * ...
366
- * ]
367
- * ```
368
- */
369
- getRegistered() {
370
- return REGISTERED_HOOKS;
371
- }
372
- }
373
- const globalSingleton = new Hooks();
374
-
375
- /**
376
- * @returns {Hooks}
377
- */
378
- function getGlobalSingleton() {
379
- return globalSingleton;
380
- }
381
- export default Hooks;