handsontable 0.0.0-next-d3b83d5-20240514 → 0.0.0-next-f0b9f34-20240515
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -2
- package/core.js +12 -4
- package/core.mjs +12 -4
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1806 -1717
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +6 -6
- package/dist/handsontable.js +1808 -1719
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +6 -6
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +79 -2
- package/pluginHooks.mjs +79 -2
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +6 -2
- package/plugins/base/base.mjs +6 -2
- package/plugins/hiddenColumns/hiddenColumns.js +1 -1
- package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +1 -1
- package/plugins/manualColumnResize/manualColumnResize.mjs +1 -1
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-
|
137
|
+
const hotVersion = "0.0.0-next-f0b9f34-20240515";
|
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-
|
127
|
+
const hotVersion = "0.0.0-next-f0b9f34-20240515";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-f0b9f34-20240515",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
package/pluginHooks.d.ts
CHANGED
@@ -261,7 +261,7 @@ export interface Events {
|
|
261
261
|
}
|
262
262
|
|
263
263
|
export class Hooks {
|
264
|
-
add<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, context?: Core): Hooks;
|
264
|
+
add<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, context?: Core, orderIndex?: number): Hooks;
|
265
265
|
createEmptyBucket(): Bucket;
|
266
266
|
deregister(key: string): void;
|
267
267
|
destroy(context?: Core): void;
|
package/pluginHooks.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
|
+
require("core-js/modules/es.array.unscopables.flat-map.js");
|
6
7
|
var _array = require("./helpers/array");
|
7
8
|
var _object = require("./helpers/object");
|
8
9
|
var _string = require("./helpers/string");
|
@@ -2665,6 +2666,7 @@ const REMOVED_HOOKS = new Map([['modifyRow', '8.0.0'], ['modifyCol', '8.0.0'], [
|
|
2665
2666
|
*/
|
2666
2667
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
2667
2668
|
const DEPRECATED_HOOKS = new Map([[]]);
|
2669
|
+
const callbackOrder = new WeakMap();
|
2668
2670
|
class Hooks {
|
2669
2671
|
static getSingleton() {
|
2670
2672
|
return getGlobalSingleton();
|
@@ -2704,7 +2706,10 @@ class Hooks {
|
|
2704
2706
|
const bucket = Object.create(null);
|
2705
2707
|
|
2706
2708
|
// eslint-disable-next-line no-return-assign
|
2707
|
-
(0, _array.arrayEach)(REGISTERED_HOOKS, hook =>
|
2709
|
+
(0, _array.arrayEach)(REGISTERED_HOOKS, hook => {
|
2710
|
+
bucket[hook] = [];
|
2711
|
+
this.initOrderMap(bucket, hook);
|
2712
|
+
});
|
2708
2713
|
return bucket;
|
2709
2714
|
}
|
2710
2715
|
|
@@ -2736,6 +2741,10 @@ class Hooks {
|
|
2736
2741
|
* @param {string} key Hook name.
|
2737
2742
|
* @param {Function|Array} callback Callback function or an array of functions.
|
2738
2743
|
* @param {object} [context=null] The context for the hook callback to be added - a Handsontable instance or leave empty.
|
2744
|
+
* @param {number} [orderIndex] Order index of the callback.
|
2745
|
+
* 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.
|
2746
|
+
* 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.
|
2747
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
2739
2748
|
* @returns {Hooks} Instance of Hooks.
|
2740
2749
|
*
|
2741
2750
|
* @example
|
@@ -2755,6 +2764,7 @@ class Hooks {
|
|
2755
2764
|
*/
|
2756
2765
|
add(key, callback) {
|
2757
2766
|
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
2767
|
+
let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
|
2758
2768
|
if (Array.isArray(callback)) {
|
2759
2769
|
(0, _array.arrayEach)(callback, c => this.add(key, c, context));
|
2760
2770
|
} else {
|
@@ -2771,6 +2781,7 @@ class Hooks {
|
|
2771
2781
|
if (typeof bucket[key] === 'undefined') {
|
2772
2782
|
this.register(key);
|
2773
2783
|
bucket[key] = [];
|
2784
|
+
this.initOrderMap(bucket, key);
|
2774
2785
|
}
|
2775
2786
|
callback.skip = false;
|
2776
2787
|
if (bucket[key].indexOf(callback) === -1) {
|
@@ -2789,6 +2800,8 @@ class Hooks {
|
|
2789
2800
|
bucket[key].push(callback);
|
2790
2801
|
}
|
2791
2802
|
}
|
2803
|
+
this.setCallbackOrderIndex(bucket, key, callback, orderIndex);
|
2804
|
+
this.orderBucketByOrderIndex(bucket, key);
|
2792
2805
|
}
|
2793
2806
|
return this;
|
2794
2807
|
}
|
@@ -2800,6 +2813,10 @@ class Hooks {
|
|
2800
2813
|
* @param {string} key Hook/Event name.
|
2801
2814
|
* @param {Function|Array} callback Callback function.
|
2802
2815
|
* @param {object} [context=null] A Handsontable instance.
|
2816
|
+
* @param {number} [orderIndex] Order index of the callback.
|
2817
|
+
* 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.
|
2818
|
+
* 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.
|
2819
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
2803
2820
|
*
|
2804
2821
|
* @example
|
2805
2822
|
* ```js
|
@@ -2808,11 +2825,12 @@ class Hooks {
|
|
2808
2825
|
*/
|
2809
2826
|
once(key, callback) {
|
2810
2827
|
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
2828
|
+
let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
|
2811
2829
|
if (Array.isArray(callback)) {
|
2812
2830
|
(0, _array.arrayEach)(callback, c => this.once(key, c, context));
|
2813
2831
|
} else {
|
2814
2832
|
callback.runOnce = true;
|
2815
|
-
this.add(key, callback, context);
|
2833
|
+
this.add(key, callback, context, orderIndex);
|
2816
2834
|
}
|
2817
2835
|
}
|
2818
2836
|
|
@@ -3040,6 +3058,65 @@ class Hooks {
|
|
3040
3058
|
getRegistered() {
|
3041
3059
|
return REGISTERED_HOOKS;
|
3042
3060
|
}
|
3061
|
+
|
3062
|
+
/**
|
3063
|
+
* Sets the order index of the callback in the bucket object.
|
3064
|
+
*
|
3065
|
+
* @private
|
3066
|
+
* @param {object} bucket The bucket object.
|
3067
|
+
* @param {string} key Hook name.
|
3068
|
+
* @param {Function} callback Callback function.
|
3069
|
+
* @param {number|undefined} orderIndex Order index of the callback.
|
3070
|
+
*/
|
3071
|
+
setCallbackOrderIndex(bucket, key, callback, orderIndex) {
|
3072
|
+
const normalizedOrderIndex = Number.isInteger(orderIndex) ? orderIndex : 0;
|
3073
|
+
const orderMap = this.getCallbackOrderMap(bucket, key);
|
3074
|
+
orderMap.set(normalizedOrderIndex, [...(orderMap.get(normalizedOrderIndex) || []), callback]);
|
3075
|
+
}
|
3076
|
+
|
3077
|
+
/**
|
3078
|
+
* Reorders the callbacks in the bucket object by their order index.
|
3079
|
+
*
|
3080
|
+
* @private
|
3081
|
+
* @param {objcet} bucket The bucket object.
|
3082
|
+
* @param {string} key Hook name.
|
3083
|
+
*/
|
3084
|
+
orderBucketByOrderIndex(bucket, key) {
|
3085
|
+
const orderMap = this.getCallbackOrderMap(bucket, key);
|
3086
|
+
if (orderMap === undefined || orderMap.size === 0 || orderMap.size === 1 && orderMap.has(0)) {
|
3087
|
+
return;
|
3088
|
+
}
|
3089
|
+
bucket[key] = [...orderMap].sort((a, b) => a[0] - b[0]).flatMap(_ref => {
|
3090
|
+
let [, callbacks] = _ref;
|
3091
|
+
return callbacks;
|
3092
|
+
});
|
3093
|
+
}
|
3094
|
+
|
3095
|
+
/**
|
3096
|
+
* Extends the bucket object with the order property.
|
3097
|
+
*
|
3098
|
+
* @private
|
3099
|
+
* @param {object} bucket The bucket object.
|
3100
|
+
* @param {string} hook The hook name.
|
3101
|
+
*/
|
3102
|
+
initOrderMap(bucket, hook) {
|
3103
|
+
if (!callbackOrder.has(bucket)) {
|
3104
|
+
callbackOrder.set(bucket, []);
|
3105
|
+
}
|
3106
|
+
callbackOrder.get(bucket)[hook] = new Map();
|
3107
|
+
}
|
3108
|
+
|
3109
|
+
/**
|
3110
|
+
* Returns the order map for the provided hook.
|
3111
|
+
*
|
3112
|
+
* @private
|
3113
|
+
* @param {object} bucket The bucket object.
|
3114
|
+
* @param {string} hook The hook name.
|
3115
|
+
* @returns {Map<number, Array<Function>>} Returns the order map for the provided hook.
|
3116
|
+
*/
|
3117
|
+
getCallbackOrderMap(bucket, hook) {
|
3118
|
+
return callbackOrder.get(bucket)[hook];
|
3119
|
+
}
|
3043
3120
|
}
|
3044
3121
|
const globalSingleton = new Hooks();
|
3045
3122
|
|
package/pluginHooks.mjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
|
+
import "core-js/modules/es.array.unscopables.flat-map.js";
|
3
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
5
6
|
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); }
|
@@ -2661,6 +2662,7 @@ const REMOVED_HOOKS = new Map([['modifyRow', '8.0.0'], ['modifyCol', '8.0.0'], [
|
|
2661
2662
|
*/
|
2662
2663
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
2663
2664
|
const DEPRECATED_HOOKS = new Map([[]]);
|
2665
|
+
const callbackOrder = new WeakMap();
|
2664
2666
|
class Hooks {
|
2665
2667
|
static getSingleton() {
|
2666
2668
|
return getGlobalSingleton();
|
@@ -2700,7 +2702,10 @@ class Hooks {
|
|
2700
2702
|
const bucket = Object.create(null);
|
2701
2703
|
|
2702
2704
|
// eslint-disable-next-line no-return-assign
|
2703
|
-
arrayEach(REGISTERED_HOOKS, hook =>
|
2705
|
+
arrayEach(REGISTERED_HOOKS, hook => {
|
2706
|
+
bucket[hook] = [];
|
2707
|
+
this.initOrderMap(bucket, hook);
|
2708
|
+
});
|
2704
2709
|
return bucket;
|
2705
2710
|
}
|
2706
2711
|
|
@@ -2732,6 +2737,10 @@ class Hooks {
|
|
2732
2737
|
* @param {string} key Hook name.
|
2733
2738
|
* @param {Function|Array} callback Callback function or an array of functions.
|
2734
2739
|
* @param {object} [context=null] The context for the hook callback to be added - a Handsontable instance or leave empty.
|
2740
|
+
* @param {number} [orderIndex] Order index of the callback.
|
2741
|
+
* 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.
|
2742
|
+
* 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.
|
2743
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
2735
2744
|
* @returns {Hooks} Instance of Hooks.
|
2736
2745
|
*
|
2737
2746
|
* @example
|
@@ -2751,6 +2760,7 @@ class Hooks {
|
|
2751
2760
|
*/
|
2752
2761
|
add(key, callback) {
|
2753
2762
|
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
2763
|
+
let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
|
2754
2764
|
if (Array.isArray(callback)) {
|
2755
2765
|
arrayEach(callback, c => this.add(key, c, context));
|
2756
2766
|
} else {
|
@@ -2767,6 +2777,7 @@ class Hooks {
|
|
2767
2777
|
if (typeof bucket[key] === 'undefined') {
|
2768
2778
|
this.register(key);
|
2769
2779
|
bucket[key] = [];
|
2780
|
+
this.initOrderMap(bucket, key);
|
2770
2781
|
}
|
2771
2782
|
callback.skip = false;
|
2772
2783
|
if (bucket[key].indexOf(callback) === -1) {
|
@@ -2785,6 +2796,8 @@ class Hooks {
|
|
2785
2796
|
bucket[key].push(callback);
|
2786
2797
|
}
|
2787
2798
|
}
|
2799
|
+
this.setCallbackOrderIndex(bucket, key, callback, orderIndex);
|
2800
|
+
this.orderBucketByOrderIndex(bucket, key);
|
2788
2801
|
}
|
2789
2802
|
return this;
|
2790
2803
|
}
|
@@ -2796,6 +2809,10 @@ class Hooks {
|
|
2796
2809
|
* @param {string} key Hook/Event name.
|
2797
2810
|
* @param {Function|Array} callback Callback function.
|
2798
2811
|
* @param {object} [context=null] A Handsontable instance.
|
2812
|
+
* @param {number} [orderIndex] Order index of the callback.
|
2813
|
+
* 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.
|
2814
|
+
* 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.
|
2815
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
2799
2816
|
*
|
2800
2817
|
* @example
|
2801
2818
|
* ```js
|
@@ -2804,11 +2821,12 @@ class Hooks {
|
|
2804
2821
|
*/
|
2805
2822
|
once(key, callback) {
|
2806
2823
|
let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
2824
|
+
let orderIndex = arguments.length > 3 ? arguments[3] : undefined;
|
2807
2825
|
if (Array.isArray(callback)) {
|
2808
2826
|
arrayEach(callback, c => this.once(key, c, context));
|
2809
2827
|
} else {
|
2810
2828
|
callback.runOnce = true;
|
2811
|
-
this.add(key, callback, context);
|
2829
|
+
this.add(key, callback, context, orderIndex);
|
2812
2830
|
}
|
2813
2831
|
}
|
2814
2832
|
|
@@ -3036,6 +3054,65 @@ class Hooks {
|
|
3036
3054
|
getRegistered() {
|
3037
3055
|
return REGISTERED_HOOKS;
|
3038
3056
|
}
|
3057
|
+
|
3058
|
+
/**
|
3059
|
+
* Sets the order index of the callback in the bucket object.
|
3060
|
+
*
|
3061
|
+
* @private
|
3062
|
+
* @param {object} bucket The bucket object.
|
3063
|
+
* @param {string} key Hook name.
|
3064
|
+
* @param {Function} callback Callback function.
|
3065
|
+
* @param {number|undefined} orderIndex Order index of the callback.
|
3066
|
+
*/
|
3067
|
+
setCallbackOrderIndex(bucket, key, callback, orderIndex) {
|
3068
|
+
const normalizedOrderIndex = Number.isInteger(orderIndex) ? orderIndex : 0;
|
3069
|
+
const orderMap = this.getCallbackOrderMap(bucket, key);
|
3070
|
+
orderMap.set(normalizedOrderIndex, [...(orderMap.get(normalizedOrderIndex) || []), callback]);
|
3071
|
+
}
|
3072
|
+
|
3073
|
+
/**
|
3074
|
+
* Reorders the callbacks in the bucket object by their order index.
|
3075
|
+
*
|
3076
|
+
* @private
|
3077
|
+
* @param {objcet} bucket The bucket object.
|
3078
|
+
* @param {string} key Hook name.
|
3079
|
+
*/
|
3080
|
+
orderBucketByOrderIndex(bucket, key) {
|
3081
|
+
const orderMap = this.getCallbackOrderMap(bucket, key);
|
3082
|
+
if (orderMap === undefined || orderMap.size === 0 || orderMap.size === 1 && orderMap.has(0)) {
|
3083
|
+
return;
|
3084
|
+
}
|
3085
|
+
bucket[key] = [...orderMap].sort((a, b) => a[0] - b[0]).flatMap(_ref => {
|
3086
|
+
let [, callbacks] = _ref;
|
3087
|
+
return callbacks;
|
3088
|
+
});
|
3089
|
+
}
|
3090
|
+
|
3091
|
+
/**
|
3092
|
+
* Extends the bucket object with the order property.
|
3093
|
+
*
|
3094
|
+
* @private
|
3095
|
+
* @param {object} bucket The bucket object.
|
3096
|
+
* @param {string} hook The hook name.
|
3097
|
+
*/
|
3098
|
+
initOrderMap(bucket, hook) {
|
3099
|
+
if (!callbackOrder.has(bucket)) {
|
3100
|
+
callbackOrder.set(bucket, []);
|
3101
|
+
}
|
3102
|
+
callbackOrder.get(bucket)[hook] = new Map();
|
3103
|
+
}
|
3104
|
+
|
3105
|
+
/**
|
3106
|
+
* Returns the order map for the provided hook.
|
3107
|
+
*
|
3108
|
+
* @private
|
3109
|
+
* @param {object} bucket The bucket object.
|
3110
|
+
* @param {string} hook The hook name.
|
3111
|
+
* @returns {Map<number, Array<Function>>} Returns the order map for the provided hook.
|
3112
|
+
*/
|
3113
|
+
getCallbackOrderMap(bucket, hook) {
|
3114
|
+
return callbackOrder.get(bucket)[hook];
|
3115
|
+
}
|
3039
3116
|
}
|
3040
3117
|
const globalSingleton = new Hooks();
|
3041
3118
|
|
package/plugins/base/base.d.ts
CHANGED
@@ -19,7 +19,7 @@ export class BasePlugin {
|
|
19
19
|
enablePlugin(): void;
|
20
20
|
disablePlugin(): void;
|
21
21
|
updatePlugin(): void;
|
22
|
-
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]
|
22
|
+
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
|
23
23
|
removeHooks(name: keyof Events): void;
|
24
24
|
clearHooks(): void;
|
25
25
|
callOnPluginsReady(callback: () => void): void;
|
package/plugins/base/base.js
CHANGED
@@ -178,11 +178,15 @@ class BasePlugin {
|
|
178
178
|
*
|
179
179
|
* @param {string} name The hook name.
|
180
180
|
* @param {Function} callback The listener function to add.
|
181
|
+
* @param {number} [orderIndex] Order index of the callback.
|
182
|
+
* 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.
|
183
|
+
* 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.
|
184
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
181
185
|
*/
|
182
|
-
addHook(name, callback) {
|
186
|
+
addHook(name, callback, orderIndex) {
|
183
187
|
_classPrivateFieldGet(_hooks, this)[name] = _classPrivateFieldGet(_hooks, this)[name] || [];
|
184
188
|
const hooks = _classPrivateFieldGet(_hooks, this)[name];
|
185
|
-
this.hot.addHook(name, callback);
|
189
|
+
this.hot.addHook(name, callback, orderIndex);
|
186
190
|
hooks.push(callback);
|
187
191
|
_classPrivateFieldGet(_hooks, this)[name] = hooks;
|
188
192
|
}
|
package/plugins/base/base.mjs
CHANGED
@@ -174,11 +174,15 @@ export class BasePlugin {
|
|
174
174
|
*
|
175
175
|
* @param {string} name The hook name.
|
176
176
|
* @param {Function} callback The listener function to add.
|
177
|
+
* @param {number} [orderIndex] Order index of the callback.
|
178
|
+
* 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.
|
179
|
+
* 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.
|
180
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
177
181
|
*/
|
178
|
-
addHook(name, callback) {
|
182
|
+
addHook(name, callback, orderIndex) {
|
179
183
|
_classPrivateFieldGet(_hooks, this)[name] = _classPrivateFieldGet(_hooks, this)[name] || [];
|
180
184
|
const hooks = _classPrivateFieldGet(_hooks, this)[name];
|
181
|
-
this.hot.addHook(name, callback);
|
185
|
+
this.hot.addHook(name, callback, orderIndex);
|
182
186
|
hooks.push(callback);
|
183
187
|
_classPrivateFieldGet(_hooks, this)[name] = hooks;
|
184
188
|
}
|
@@ -211,7 +211,7 @@ class HiddenColumns extends _base.BasePlugin {
|
|
211
211
|
return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);
|
212
212
|
});
|
213
213
|
this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenColumns_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));
|
214
|
-
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col));
|
214
|
+
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col), 2);
|
215
215
|
this.addHook('afterGetColHeader', function () {
|
216
216
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
217
217
|
args[_key2] = arguments[_key2];
|
@@ -207,7 +207,7 @@ export class HiddenColumns extends BasePlugin {
|
|
207
207
|
return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);
|
208
208
|
});
|
209
209
|
this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenColumns_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));
|
210
|
-
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col));
|
210
|
+
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col), 2);
|
211
211
|
this.addHook('afterGetColHeader', function () {
|
212
212
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
213
213
|
args[_key2] = arguments[_key2];
|
@@ -168,7 +168,7 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
168
168
|
_classPrivateFieldSet(_columnWidthsMap, this, new _translations.PhysicalIndexToValueMap());
|
169
169
|
_classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
|
170
170
|
this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
|
171
|
-
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col));
|
171
|
+
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col), 1);
|
172
172
|
this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeStretchingColumnWidth).call(this, stretchedWidth, column));
|
173
173
|
this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeColumnResize).call(this, newSize, column, isDoubleClick));
|
174
174
|
this.bindEvents();
|
@@ -163,7 +163,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
163
163
|
_classPrivateFieldSet(_columnWidthsMap, this, new IndexToValueMap());
|
164
164
|
_classPrivateFieldGet(_columnWidthsMap, this).addLocalHook('init', () => _assertClassBrand(_ManualColumnResize_brand, this, _onMapInit).call(this));
|
165
165
|
this.hot.columnIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(_columnWidthsMap, this));
|
166
|
-
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col));
|
166
|
+
this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_ManualColumnResize_brand, this, _onModifyColWidth).call(this, width, col), 1);
|
167
167
|
this.addHook('beforeStretchingColumnWidth', (stretchedWidth, column) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeStretchingColumnWidth).call(this, stretchedWidth, column));
|
168
168
|
this.addHook('beforeColumnResize', (newSize, column, isDoubleClick) => _assertClassBrand(_ManualColumnResize_brand, this, _onBeforeColumnResize).call(this, newSize, column, isDoubleClick));
|
169
169
|
this.bindEvents();
|