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
@@ -0,0 +1,176 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/es.array.to-sorted.js";
4
+ import "core-js/modules/es.set.difference.v2.js";
5
+ import "core-js/modules/es.set.intersection.v2.js";
6
+ import "core-js/modules/es.set.is-disjoint-from.v2.js";
7
+ import "core-js/modules/es.set.is-subset-of.v2.js";
8
+ import "core-js/modules/es.set.is-superset-of.v2.js";
9
+ import "core-js/modules/es.set.symmetric-difference.v2.js";
10
+ import "core-js/modules/es.set.union.v2.js";
11
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
12
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
13
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
14
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
15
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
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
+ import { REGISTERED_HOOKS } from "./constants.mjs";
18
+ /**
19
+ * @typedef {object} HookEntry
20
+ * @property {Function} callback The callback function.
21
+ * @property {number} orderIndex The order index.
22
+ * @property {boolean} runOnce Indicates if the hook should run only once.
23
+ * @property {boolean} initialHook Indicates if it is an initial hook - which means that the hook
24
+ * always stays at the same index position even after update.
25
+ * @property {boolean} skip Indicates if the hook was removed.
26
+ */
27
+ /**
28
+ * The maximum number of hooks that can be skipped before the bucket is cleaned up.
29
+ */
30
+ const MAX_SKIPPED_HOOKS_COUNT = 100;
31
+
32
+ /**
33
+ * The class represents a collection that allows to manage hooks (add, remove).
34
+ *
35
+ * @class HooksBucket
36
+ */
37
+ var _hooks = /*#__PURE__*/new WeakMap();
38
+ var _skippedHooksCount = /*#__PURE__*/new WeakMap();
39
+ var _needsSort = /*#__PURE__*/new WeakMap();
40
+ var _HooksBucket_brand = /*#__PURE__*/new WeakSet();
41
+ export class HooksBucket {
42
+ constructor() {
43
+ /**
44
+ * Creates a initial collection for the provided hook name.
45
+ *
46
+ * @param {string} hookName The name of the hook.
47
+ */
48
+ _classPrivateMethodInitSpec(this, _HooksBucket_brand);
49
+ /**
50
+ * A map that stores hooks.
51
+ *
52
+ * @type {Map<string, HookEntry>}
53
+ */
54
+ _classPrivateFieldInitSpec(this, _hooks, new Map());
55
+ /**
56
+ * A map that stores the number of skipped hooks.
57
+ */
58
+ _classPrivateFieldInitSpec(this, _skippedHooksCount, new Map());
59
+ /**
60
+ * A set that stores hook names that need to be re-sorted.
61
+ */
62
+ _classPrivateFieldInitSpec(this, _needsSort, new Set());
63
+ REGISTERED_HOOKS.forEach(hookName => _assertClassBrand(_HooksBucket_brand, this, _createHooksCollection).call(this, hookName));
64
+ }
65
+
66
+ /**
67
+ * Gets all hooks for the provided hook name.
68
+ *
69
+ * @param {string} hookName The name of the hook.
70
+ * @returns {HookEntry[]}
71
+ */
72
+ getHooks(hookName) {
73
+ var _classPrivateFieldGet2;
74
+ return (_classPrivateFieldGet2 = _classPrivateFieldGet(_hooks, this).get(hookName)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : [];
75
+ }
76
+
77
+ /**
78
+ * Adds a new hook to the collection.
79
+ *
80
+ * @param {string} hookName The name of the hook.
81
+ * @param {Function} callback The callback function to add.
82
+ * @param {{ orderIndex?: number, runOnce?: boolean, initialHook?: boolean }} options The options object.
83
+ */
84
+ add(hookName, callback) {
85
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
86
+ if (!_classPrivateFieldGet(_hooks, this).has(hookName)) {
87
+ _assertClassBrand(_HooksBucket_brand, this, _createHooksCollection).call(this, hookName);
88
+ REGISTERED_HOOKS.push(hookName);
89
+ }
90
+ const hooks = _classPrivateFieldGet(_hooks, this).get(hookName);
91
+ if (hooks.find(hook => hook.callback === callback)) {
92
+ // adding the same hook twice is now silently ignored
93
+ return;
94
+ }
95
+ const orderIndex = Number.isInteger(options.orderIndex) ? options.orderIndex : 0;
96
+ const runOnce = !!options.runOnce;
97
+ const initialHook = !!options.initialHook;
98
+ let foundInitialHook = false;
99
+ if (initialHook) {
100
+ const initialHookEntry = hooks.find(hook => hook.initialHook);
101
+ if (initialHookEntry) {
102
+ initialHookEntry.callback = callback;
103
+ foundInitialHook = true;
104
+ }
105
+ }
106
+ if (!foundInitialHook) {
107
+ hooks.push({
108
+ callback,
109
+ orderIndex,
110
+ runOnce,
111
+ initialHook,
112
+ skip: false
113
+ });
114
+ let needsSort = _classPrivateFieldGet(_needsSort, this).has(hookName);
115
+ if (!needsSort && orderIndex !== 0) {
116
+ needsSort = true;
117
+ _classPrivateFieldGet(_needsSort, this).add(hookName);
118
+ }
119
+ if (needsSort && hooks.length > 1) {
120
+ _classPrivateFieldGet(_hooks, this).set(hookName, hooks.toSorted((a, b) => a.orderIndex - b.orderIndex));
121
+ }
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Checks if there are any hooks for the provided hook name.
127
+ *
128
+ * @param {string} hookName The name of the hook.
129
+ * @returns {boolean}
130
+ */
131
+ has(hookName) {
132
+ return _classPrivateFieldGet(_hooks, this).has(hookName) && _classPrivateFieldGet(_hooks, this).get(hookName).length > 0;
133
+ }
134
+
135
+ /**
136
+ * Removes a hook from the collection. If the hook was found and removed,
137
+ * the method returns `true`, otherwise `false`.
138
+ *
139
+ * @param {string} hookName The name of the hook.
140
+ * @param {*} callback The callback function to remove.
141
+ * @returns {boolean}
142
+ */
143
+ remove(hookName, callback) {
144
+ if (!_classPrivateFieldGet(_hooks, this).has(hookName)) {
145
+ return false;
146
+ }
147
+ const hooks = _classPrivateFieldGet(_hooks, this).get(hookName);
148
+ const hookEntry = hooks.find(hook => hook.callback === callback);
149
+ if (hookEntry) {
150
+ let skippedHooksCount = _classPrivateFieldGet(_skippedHooksCount, this).get(hookName);
151
+ hookEntry.skip = true;
152
+ skippedHooksCount += 1;
153
+ if (skippedHooksCount > MAX_SKIPPED_HOOKS_COUNT) {
154
+ _classPrivateFieldGet(_hooks, this).set(hookName, hooks.filter(hook => !hook.skip));
155
+ skippedHooksCount = 0;
156
+ }
157
+ _classPrivateFieldGet(_skippedHooksCount, this).set(hookName, skippedHooksCount);
158
+ return true;
159
+ }
160
+ return false;
161
+ }
162
+
163
+ /**
164
+ * Destroys the bucket.
165
+ */
166
+ destroy() {
167
+ _classPrivateFieldGet(_hooks, this).clear();
168
+ _classPrivateFieldGet(_skippedHooksCount, this).clear();
169
+ _classPrivateFieldSet(_hooks, this, null);
170
+ _classPrivateFieldSet(_skippedHooksCount, this, null);
171
+ }
172
+ }
173
+ function _createHooksCollection(hookName) {
174
+ _classPrivateFieldGet(_hooks, this).set(hookName, []);
175
+ _classPrivateFieldGet(_skippedHooksCount, this).set(hookName, 0);
176
+ }