handsontable 0.0.0-next-fad35d5-20240924 → 0.0.0-next-ffdf116-20240926
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.
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -23
- package/3rdparty/walkontable/src/core/_base.js +0 -7
- package/3rdparty/walkontable/src/core/_base.mjs +0 -7
- package/3rdparty/walkontable/src/facade/core.js +0 -3
- package/3rdparty/walkontable/src/facade/core.mjs +0 -3
- package/3rdparty/walkontable/src/overlay/_base.js +0 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +0 -3
- package/3rdparty/walkontable/src/selection/border/border.js +45 -33
- package/3rdparty/walkontable/src/selection/border/border.mjs +46 -34
- package/3rdparty/walkontable/src/selection/scanner.js +11 -46
- package/3rdparty/walkontable/src/selection/scanner.mjs +11 -46
- package/3rdparty/walkontable/src/settings.js +0 -8
- package/3rdparty/walkontable/src/settings.mjs +0 -8
- package/3rdparty/walkontable/src/table/master.js +1 -1
- package/3rdparty/walkontable/src/table/master.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +3 -6
- package/3rdparty/walkontable/src/table.mjs +3 -6
- package/3rdparty/walkontable/src/viewport.js +4 -26
- package/3rdparty/walkontable/src/viewport.mjs +4 -26
- package/base.js +4 -4
- package/base.mjs +3 -3
- package/core.d.ts +1 -1
- package/core.js +12 -13
- package/core.mjs +4 -5
- package/dataMap/metaManager/metaSchema.js +2 -68
- package/dataMap/metaManager/metaSchema.mjs +2 -68
- package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2685 -3046
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +60 -60
- package/dist/handsontable.js +2687 -3048
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +18 -18
- package/editorManager.js +2 -2
- package/editorManager.mjs +2 -2
- package/editors/autocompleteEditor/autocompleteEditor.js +31 -14
- package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -14
- package/editors/baseEditor/baseEditor.js +17 -24
- package/editors/baseEditor/baseEditor.mjs +18 -25
- package/editors/dropdownEditor/dropdownEditor.js +3 -2
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +24 -0
- package/editors/handsontableEditor/handsontableEditor.mjs +24 -0
- package/editors/registry.js +2 -2
- package/editors/registry.mjs +1 -1
- package/editors/textEditor/textEditor.js +2 -2
- package/editors/textEditor/textEditor.mjs +3 -3
- package/helpers/dom/element.js +4 -17
- package/helpers/dom/element.mjs +4 -16
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/index.d.ts +1 -2
- package/package.json +1 -1
- package/{core/hooks/index.d.ts → pluginHooks.d.ts} +21 -17
- package/{core/hooks/constants.mjs → pluginHooks.js} +489 -16
- package/{core/hooks/constants.js → pluginHooks.mjs} +486 -20
- package/plugins/autoColumnSize/autoColumnSize.js +27 -18
- package/plugins/autoColumnSize/autoColumnSize.mjs +27 -18
- package/plugins/autoRowSize/autoRowSize.js +22 -16
- package/plugins/autoRowSize/autoRowSize.mjs +23 -17
- package/plugins/autofill/autofill.js +5 -4
- package/plugins/autofill/autofill.mjs +1 -1
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +0 -39
- package/plugins/base/base.mjs +1 -40
- package/plugins/base/index.js +1 -2
- package/plugins/base/index.mjs +1 -1
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -2
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -2
- package/plugins/columnSorting/columnSorting.js +4 -3
- package/plugins/columnSorting/columnSorting.mjs +1 -1
- package/plugins/comments/comments.js +15 -7
- package/plugins/comments/comments.mjs +16 -8
- package/plugins/contextMenu/contextMenu.js +7 -6
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/plugins/contextMenu/menu/menu.js +1 -1
- package/plugins/contextMenu/menu/menu.mjs +2 -2
- package/plugins/contextMenu/menu/positioner.js +4 -2
- package/plugins/contextMenu/menu/positioner.mjs +4 -2
- package/plugins/copyPaste/copyPaste.js +23 -29
- package/plugins/copyPaste/copyPaste.mjs +15 -21
- package/plugins/dropdownMenu/dropdownMenu.js +7 -6
- package/plugins/dropdownMenu/dropdownMenu.mjs +1 -1
- package/plugins/formulas/formulas.js +7 -7
- package/plugins/formulas/formulas.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +30 -19
- package/plugins/hiddenColumns/hiddenColumns.mjs +26 -15
- package/plugins/hiddenRows/hiddenRows.js +29 -18
- package/plugins/hiddenRows/hiddenRows.mjs +25 -14
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +5 -5
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +3 -3
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualRowMove/manualRowMove.js +5 -5
- package/plugins/manualRowMove/manualRowMove.mjs +3 -3
- package/plugins/mergeCells/cellsCollection.js +3 -15
- package/plugins/mergeCells/cellsCollection.mjs +4 -16
- package/plugins/mergeCells/mergeCells.d.ts +2 -6
- package/plugins/mergeCells/mergeCells.js +55 -78
- package/plugins/mergeCells/mergeCells.mjs +53 -76
- package/plugins/mergeCells/renderer.js +3 -13
- package/plugins/mergeCells/renderer.mjs +3 -13
- package/plugins/persistentState/persistentState.js +4 -4
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/undoRedo/undoRedo.js +5 -4
- package/plugins/undoRedo/undoRedo.mjs +3 -3
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/settings.d.ts +1 -3
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/scrollToFocusedCell.js +4 -4
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +4 -4
- package/tableView.js +43 -38
- package/tableView.mjs +43 -38
- package/core/hooks/bucket.js +0 -180
- package/core/hooks/bucket.mjs +0 -176
- package/core/hooks/index.js +0 -385
- package/core/hooks/index.mjs +0 -381
@@ -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
|
16
|
-
import { isObject } from "../../helpers/object.mjs";
|
15
|
+
import Hooks from "../../pluginHooks.mjs";
|
16
|
+
import { isObject, hasOwnProperty } 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,13 +134,6 @@ 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
|
-
}
|
144
137
|
static get CALCULATION_STEP() {
|
145
138
|
return 50;
|
146
139
|
}
|
@@ -248,12 +241,11 @@ export class AutoColumnSize extends BasePlugin {
|
|
248
241
|
if (this.enabled) {
|
249
242
|
return;
|
250
243
|
}
|
251
|
-
this.
|
252
|
-
|
253
|
-
|
254
|
-
if (samplingRatio && !isNaN(samplingRatio)) {
|
255
|
-
this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
|
244
|
+
const setting = this.hot.getSettings()[PLUGIN_KEY];
|
245
|
+
if (setting && setting.useHeaders !== null && setting.useHeaders !== undefined) {
|
246
|
+
this.ghostTable.setSetting('useHeaders', setting.useHeaders);
|
256
247
|
}
|
248
|
+
this.setSamplingOptions();
|
257
249
|
this.addHook('afterLoadData', function () {
|
258
250
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
259
251
|
args[_key] = arguments[_key];
|
@@ -420,6 +412,23 @@ export class AutoColumnSize extends BasePlugin {
|
|
420
412
|
this.inProgress = false;
|
421
413
|
}
|
422
414
|
}
|
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
|
+
|
423
432
|
/**
|
424
433
|
* Recalculates all columns width (overwrite cache values).
|
425
434
|
*/
|
@@ -481,8 +490,8 @@ export class AutoColumnSize extends BasePlugin {
|
|
481
490
|
* @returns {number} Returns visual column index, -1 if table is not rendered or if there are no columns to base the the calculations on.
|
482
491
|
*/
|
483
492
|
getFirstVisibleColumn() {
|
484
|
-
var _this$hot$
|
485
|
-
return (_this$hot$
|
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;
|
486
495
|
}
|
487
496
|
|
488
497
|
/**
|
@@ -491,8 +500,8 @@ export class AutoColumnSize extends BasePlugin {
|
|
491
500
|
* @returns {number} Returns visual column index or -1 if table is not rendered.
|
492
501
|
*/
|
493
502
|
getLastVisibleColumn() {
|
494
|
-
var _this$hot$
|
495
|
-
return (_this$hot$
|
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;
|
496
505
|
}
|
497
506
|
|
498
507
|
/**
|
@@ -120,13 +120,6 @@ 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
|
-
}
|
130
123
|
static get CALCULATION_STEP() {
|
131
124
|
return 50;
|
132
125
|
}
|
@@ -237,11 +230,7 @@ class AutoRowSize extends _base.BasePlugin {
|
|
237
230
|
if (this.enabled) {
|
238
231
|
return;
|
239
232
|
}
|
240
|
-
this.
|
241
|
-
const samplingRatio = this.getSetting('samplingRatio');
|
242
|
-
if (samplingRatio && !isNaN(samplingRatio)) {
|
243
|
-
this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
|
244
|
-
}
|
233
|
+
this.setSamplingOptions();
|
245
234
|
this.addHook('afterLoadData', function () {
|
246
235
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
247
236
|
args[_key] = arguments[_key];
|
@@ -419,6 +408,23 @@ class AutoRowSize extends _base.BasePlugin {
|
|
419
408
|
this.hot.view.adjustElementsSize();
|
420
409
|
}
|
421
410
|
}
|
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
|
+
|
422
428
|
/**
|
423
429
|
* Recalculates all rows height (overwrite cache values).
|
424
430
|
*/
|
@@ -491,8 +497,8 @@ class AutoRowSize extends _base.BasePlugin {
|
|
491
497
|
* @returns {number} Returns row index, -1 if table is not rendered or if there are no rows to base the the calculations on.
|
492
498
|
*/
|
493
499
|
getFirstVisibleRow() {
|
494
|
-
var _this$hot$
|
495
|
-
return (_this$hot$
|
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;
|
496
502
|
}
|
497
503
|
|
498
504
|
/**
|
@@ -501,8 +507,8 @@ class AutoRowSize extends _base.BasePlugin {
|
|
501
507
|
* @returns {number} Returns row index or -1 if table is not rendered.
|
502
508
|
*/
|
503
509
|
getLastVisibleRow() {
|
504
|
-
var _this$hot$
|
505
|
-
return (_this$hot$
|
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;
|
506
512
|
}
|
507
513
|
|
508
514
|
/**
|
@@ -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 } from "../../helpers/object.mjs";
|
15
|
+
import { isObject, hasOwnProperty } 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,13 +116,6 @@ 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
|
-
}
|
126
119
|
static get CALCULATION_STEP() {
|
127
120
|
return 50;
|
128
121
|
}
|
@@ -233,11 +226,7 @@ export class AutoRowSize extends BasePlugin {
|
|
233
226
|
if (this.enabled) {
|
234
227
|
return;
|
235
228
|
}
|
236
|
-
this.
|
237
|
-
const samplingRatio = this.getSetting('samplingRatio');
|
238
|
-
if (samplingRatio && !isNaN(samplingRatio)) {
|
239
|
-
this.samplesGenerator.setSampleCount(parseInt(samplingRatio, 10));
|
240
|
-
}
|
229
|
+
this.setSamplingOptions();
|
241
230
|
this.addHook('afterLoadData', function () {
|
242
231
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
243
232
|
args[_key] = arguments[_key];
|
@@ -415,6 +404,23 @@ export class AutoRowSize extends BasePlugin {
|
|
415
404
|
this.hot.view.adjustElementsSize();
|
416
405
|
}
|
417
406
|
}
|
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
|
+
|
418
424
|
/**
|
419
425
|
* Recalculates all rows height (overwrite cache values).
|
420
426
|
*/
|
@@ -487,8 +493,8 @@ export class AutoRowSize extends BasePlugin {
|
|
487
493
|
* @returns {number} Returns row index, -1 if table is not rendered or if there are no rows to base the the calculations on.
|
488
494
|
*/
|
489
495
|
getFirstVisibleRow() {
|
490
|
-
var _this$hot$
|
491
|
-
return (_this$hot$
|
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;
|
492
498
|
}
|
493
499
|
|
494
500
|
/**
|
@@ -497,8 +503,8 @@ export class AutoRowSize extends BasePlugin {
|
|
497
503
|
* @returns {number} Returns row index or -1 if table is not rendered.
|
498
504
|
*/
|
499
505
|
getLastVisibleRow() {
|
500
|
-
var _this$hot$
|
501
|
-
return (_this$hot$
|
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;
|
502
508
|
}
|
503
509
|
|
504
510
|
/**
|
@@ -4,20 +4,21 @@ 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
|
7
|
+
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
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 }; }
|
12
13
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
13
14
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
14
15
|
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; }
|
15
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
16
17
|
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); }
|
17
18
|
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"); }
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
_pluginHooks.default.getSingleton().register('modifyAutofillRange');
|
20
|
+
_pluginHooks.default.getSingleton().register('beforeAutofill');
|
21
|
+
_pluginHooks.default.getSingleton().register('afterAutofill');
|
21
22
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'autofill';
|
22
23
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 20;
|
23
24
|
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
|
10
|
+
import Hooks from "../../pluginHooks.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";
|
package/plugins/base/base.d.ts
CHANGED
package/plugins/base/base.js
CHANGED
@@ -21,7 +21,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
21
21
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
22
22
|
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"); }
|
23
23
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', _registry.hasPlugin], ['cell-type', _registry2.hasCellType], ['editor', _registry3.hasEditor], ['renderer', _registry4.hasRenderer], ['validator', _registry5.hasValidator]]);
|
24
|
-
const defaultMainSettingSymbol = exports.defaultMainSettingSymbol = Symbol('mainSetting');
|
25
24
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'base';
|
26
25
|
const missingDepsMsgs = [];
|
27
26
|
let initializedPlugins = null;
|
@@ -50,15 +49,6 @@ class BasePlugin {
|
|
50
49
|
return [this.PLUGIN_KEY];
|
51
50
|
}
|
52
51
|
|
53
|
-
/**
|
54
|
-
* The `DEFAULT_SETTINGS` getter defines the plugin default settings.
|
55
|
-
*
|
56
|
-
* @returns {object}
|
57
|
-
*/
|
58
|
-
static get DEFAULT_SETTINGS() {
|
59
|
-
return {};
|
60
|
-
}
|
61
|
-
|
62
52
|
/**
|
63
53
|
* The instance of the {@link EventManager} class.
|
64
54
|
*
|
@@ -159,7 +149,6 @@ class BasePlugin {
|
|
159
149
|
if (isAllPluginsAreInitialized) {
|
160
150
|
if (missingDepsMsgs.length > 0) {
|
161
151
|
const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
|
162
|
-
missingDepsMsgs.length = 0;
|
163
152
|
throw new Error(errorMsg);
|
164
153
|
}
|
165
154
|
this.hot.runHooks('afterPluginsInitialized');
|
@@ -184,34 +173,6 @@ class BasePlugin {
|
|
184
173
|
this.enabled = false;
|
185
174
|
}
|
186
175
|
|
187
|
-
/**
|
188
|
-
* Gets the plugin settings. If there is no setting under the provided key, it returns the default setting
|
189
|
-
* provided by the DEFAULT_SETTINGS static property of the class.
|
190
|
-
*
|
191
|
-
* @param {string} [settingName] The setting name. If the setting name is not provided, it returns
|
192
|
-
* the whole plugin's settings object.
|
193
|
-
* @returns {*}
|
194
|
-
*/
|
195
|
-
getSetting(settingName) {
|
196
|
-
const pluginSettings = this.hot.getSettings()[this.constructor.PLUGIN_KEY];
|
197
|
-
if (settingName === undefined) {
|
198
|
-
return pluginSettings;
|
199
|
-
}
|
200
|
-
const defaultSettings = this.constructor.DEFAULT_SETTINGS;
|
201
|
-
if ((Array.isArray(pluginSettings) || (0, _object.isObject)(pluginSettings)) && defaultSettings[defaultMainSettingSymbol] === settingName) {
|
202
|
-
var _pluginSettings$setti;
|
203
|
-
if (Array.isArray(pluginSettings)) {
|
204
|
-
return pluginSettings;
|
205
|
-
}
|
206
|
-
return (_pluginSettings$setti = pluginSettings[settingName]) !== null && _pluginSettings$setti !== void 0 ? _pluginSettings$setti : defaultSettings[settingName];
|
207
|
-
}
|
208
|
-
if ((0, _object.isObject)(pluginSettings)) {
|
209
|
-
var _pluginSettings$setti2;
|
210
|
-
return (_pluginSettings$setti2 = pluginSettings[settingName]) !== null && _pluginSettings$setti2 !== void 0 ? _pluginSettings$setti2 : defaultSettings[settingName];
|
211
|
-
}
|
212
|
-
return defaultSettings[settingName];
|
213
|
-
}
|
214
|
-
|
215
176
|
/**
|
216
177
|
* Add listener to plugin hooks system.
|
217
178
|
*
|
package/plugins/base/base.mjs
CHANGED
@@ -8,7 +8,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
8
8
|
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); }
|
9
9
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
10
10
|
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"); }
|
11
|
-
import { defineGetter, objectEach
|
11
|
+
import { defineGetter, objectEach } from "../../helpers/object.mjs";
|
12
12
|
import { arrayEach } from "../../helpers/array.mjs";
|
13
13
|
import { getPluginsNames, hasPlugin } from "../registry.mjs";
|
14
14
|
import { hasCellType } from "../../cellTypes/registry.mjs";
|
@@ -17,7 +17,6 @@ import { hasRenderer } from "../../renderers/registry.mjs";
|
|
17
17
|
import { hasValidator } from "../../validators/registry.mjs";
|
18
18
|
import EventManager from "../../eventManager.mjs";
|
19
19
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', hasPlugin], ['cell-type', hasCellType], ['editor', hasEditor], ['renderer', hasRenderer], ['validator', hasValidator]]);
|
20
|
-
export const defaultMainSettingSymbol = Symbol('mainSetting');
|
21
20
|
export const PLUGIN_KEY = 'base';
|
22
21
|
const missingDepsMsgs = [];
|
23
22
|
let initializedPlugins = null;
|
@@ -46,15 +45,6 @@ export class BasePlugin {
|
|
46
45
|
return [this.PLUGIN_KEY];
|
47
46
|
}
|
48
47
|
|
49
|
-
/**
|
50
|
-
* The `DEFAULT_SETTINGS` getter defines the plugin default settings.
|
51
|
-
*
|
52
|
-
* @returns {object}
|
53
|
-
*/
|
54
|
-
static get DEFAULT_SETTINGS() {
|
55
|
-
return {};
|
56
|
-
}
|
57
|
-
|
58
48
|
/**
|
59
49
|
* The instance of the {@link EventManager} class.
|
60
50
|
*
|
@@ -155,7 +145,6 @@ export class BasePlugin {
|
|
155
145
|
if (isAllPluginsAreInitialized) {
|
156
146
|
if (missingDepsMsgs.length > 0) {
|
157
147
|
const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
|
158
|
-
missingDepsMsgs.length = 0;
|
159
148
|
throw new Error(errorMsg);
|
160
149
|
}
|
161
150
|
this.hot.runHooks('afterPluginsInitialized');
|
@@ -180,34 +169,6 @@ export class BasePlugin {
|
|
180
169
|
this.enabled = false;
|
181
170
|
}
|
182
171
|
|
183
|
-
/**
|
184
|
-
* Gets the plugin settings. If there is no setting under the provided key, it returns the default setting
|
185
|
-
* provided by the DEFAULT_SETTINGS static property of the class.
|
186
|
-
*
|
187
|
-
* @param {string} [settingName] The setting name. If the setting name is not provided, it returns
|
188
|
-
* the whole plugin's settings object.
|
189
|
-
* @returns {*}
|
190
|
-
*/
|
191
|
-
getSetting(settingName) {
|
192
|
-
const pluginSettings = this.hot.getSettings()[this.constructor.PLUGIN_KEY];
|
193
|
-
if (settingName === undefined) {
|
194
|
-
return pluginSettings;
|
195
|
-
}
|
196
|
-
const defaultSettings = this.constructor.DEFAULT_SETTINGS;
|
197
|
-
if ((Array.isArray(pluginSettings) || isObject(pluginSettings)) && defaultSettings[defaultMainSettingSymbol] === settingName) {
|
198
|
-
var _pluginSettings$setti;
|
199
|
-
if (Array.isArray(pluginSettings)) {
|
200
|
-
return pluginSettings;
|
201
|
-
}
|
202
|
-
return (_pluginSettings$setti = pluginSettings[settingName]) !== null && _pluginSettings$setti !== void 0 ? _pluginSettings$setti : defaultSettings[settingName];
|
203
|
-
}
|
204
|
-
if (isObject(pluginSettings)) {
|
205
|
-
var _pluginSettings$setti2;
|
206
|
-
return (_pluginSettings$setti2 = pluginSettings[settingName]) !== null && _pluginSettings$setti2 !== void 0 ? _pluginSettings$setti2 : defaultSettings[settingName];
|
207
|
-
}
|
208
|
-
return defaultSettings[settingName];
|
209
|
-
}
|
210
|
-
|
211
172
|
/**
|
212
173
|
* Add listener to plugin hooks system.
|
213
174
|
*
|
package/plugins/base/index.js
CHANGED
package/plugins/base/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { PLUGIN_KEY, BasePlugin
|
1
|
+
export { PLUGIN_KEY, BasePlugin } from "./base.mjs";
|
@@ -88,11 +88,14 @@ class BindRowsWithHeaders extends _base.BasePlugin {
|
|
88
88
|
* Enables the plugin functionality for this Handsontable instance.
|
89
89
|
*/
|
90
90
|
enablePlugin() {
|
91
|
-
var _bindTypeToMapStrateg;
|
92
91
|
if (this.enabled) {
|
93
92
|
return;
|
94
93
|
}
|
95
|
-
|
94
|
+
let bindType = this.hot.getSettings()[PLUGIN_KEY];
|
95
|
+
if (typeof bindType !== 'string') {
|
96
|
+
bindType = DEFAULT_BIND;
|
97
|
+
}
|
98
|
+
const MapStrategy = bindTypeToMapStrategy.get(bindType);
|
96
99
|
this.headerIndexes = this.hot.rowIndexMapper.registerMap('bindRowsWithHeaders', new MapStrategy());
|
97
100
|
this.addHook('modifyRowHeader', row => _assertClassBrand(_BindRowsWithHeaders_brand, this, _onModifyRowHeader).call(this, row));
|
98
101
|
super.enablePlugin();
|
@@ -84,11 +84,14 @@ export class BindRowsWithHeaders extends BasePlugin {
|
|
84
84
|
* Enables the plugin functionality for this Handsontable instance.
|
85
85
|
*/
|
86
86
|
enablePlugin() {
|
87
|
-
var _bindTypeToMapStrateg;
|
88
87
|
if (this.enabled) {
|
89
88
|
return;
|
90
89
|
}
|
91
|
-
|
90
|
+
let bindType = this.hot.getSettings()[PLUGIN_KEY];
|
91
|
+
if (typeof bindType !== 'string') {
|
92
|
+
bindType = DEFAULT_BIND;
|
93
|
+
}
|
94
|
+
const MapStrategy = bindTypeToMapStrategy.get(bindType);
|
92
95
|
this.headerIndexes = this.hot.rowIndexMapper.registerMap('bindRowsWithHeaders', new MapStrategy());
|
93
96
|
this.addHook('modifyRowHeader', row => _assertClassBrand(_BindRowsWithHeaders_brand, this, _onModifyRowHeader).call(this, row));
|
94
97
|
super.enablePlugin();
|
@@ -10,7 +10,7 @@ var _function = require("../../helpers/function");
|
|
10
10
|
var _array = require("../../helpers/array");
|
11
11
|
var _base = require("../base");
|
12
12
|
var _translations = require("../../translations");
|
13
|
-
var
|
13
|
+
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
14
14
|
var _columnStatesManager = require("./columnStatesManager");
|
15
15
|
var _shortcutContexts = require("../../shortcutContexts");
|
16
16
|
var _utils = require("./utils");
|
@@ -18,6 +18,7 @@ var _domHelpers = require("./domHelpers");
|
|
18
18
|
var _rootComparator = require("./rootComparator");
|
19
19
|
var _sortService = require("./sortService");
|
20
20
|
var _a11y = require("../../helpers/a11y");
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
21
22
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
22
23
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
23
24
|
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; }
|
@@ -30,8 +31,8 @@ const APPEND_COLUMN_CONFIG_STRATEGY = exports.APPEND_COLUMN_CONFIG_STRATEGY = 'a
|
|
30
31
|
const REPLACE_COLUMN_CONFIG_STRATEGY = exports.REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
|
31
32
|
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
32
33
|
(0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
|
33
|
-
|
34
|
-
|
34
|
+
_pluginHooks.default.getSingleton().register('beforeColumnSort');
|
35
|
+
_pluginHooks.default.getSingleton().register('afterColumnSort');
|
35
36
|
|
36
37
|
// DIFF - MultiColumnSorting & ColumnSorting: changed configuration documentation.
|
37
38
|
/**
|
@@ -13,7 +13,7 @@ import { isFunction } from "../../helpers/function.mjs";
|
|
13
13
|
import { arrayMap } from "../../helpers/array.mjs";
|
14
14
|
import { BasePlugin } from "../base/index.mjs";
|
15
15
|
import { IndexesSequence, PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
|
16
|
-
import
|
16
|
+
import Hooks from "../../pluginHooks.mjs";
|
17
17
|
import { ColumnStatesManager } from "./columnStatesManager.mjs";
|
18
18
|
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
19
19
|
import { HEADER_SPAN_CLASS, getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLevelColumnHeader, wasHeaderClickedProperly } from "./utils.mjs";
|
@@ -194,11 +194,6 @@ class Comments extends _base.BasePlugin {
|
|
194
194
|
static get PLUGIN_PRIORITY() {
|
195
195
|
return PLUGIN_PRIORITY;
|
196
196
|
}
|
197
|
-
static get DEFAULT_SETTINGS() {
|
198
|
-
return {
|
199
|
-
displayDelay: 250
|
200
|
-
};
|
201
|
-
}
|
202
197
|
/**
|
203
198
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
204
199
|
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
@@ -227,7 +222,7 @@ class Comments extends _base.BasePlugin {
|
|
227
222
|
});
|
228
223
|
}
|
229
224
|
if (!_classPrivateFieldGet(_displaySwitch, this)) {
|
230
|
-
_classPrivateFieldSet(_displaySwitch, this, new _displaySwitch2.default(this.
|
225
|
+
_classPrivateFieldSet(_displaySwitch, this, new _displaySwitch2.default(this.getDisplayDelaySetting()));
|
231
226
|
}
|
232
227
|
this.addHook('afterContextMenuDefaultOptions', options => this.addToContextMenu(options));
|
233
228
|
this.addHook('afterRenderer', (TD, row, col, prop, value, cellProperties) => _assertClassBrand(_Comments_brand, this, _onAfterRenderer).call(this, TD, cellProperties));
|
@@ -248,7 +243,7 @@ class Comments extends _base.BasePlugin {
|
|
248
243
|
* - [`comments`](@/api/options.md#comments)
|
249
244
|
*/
|
250
245
|
updatePlugin() {
|
251
|
-
_classPrivateFieldGet(_displaySwitch, this).updateDelay(this.
|
246
|
+
_classPrivateFieldGet(_displaySwitch, this).updateDelay(this.getDisplayDelaySetting());
|
252
247
|
super.updatePlugin();
|
253
248
|
}
|
254
249
|
|
@@ -665,6 +660,19 @@ class Comments extends _base.BasePlugin {
|
|
665
660
|
}, (0, _addEditComment.default)(this), (0, _removeComment.default)(this), (0, _readOnlyComment.default)(this));
|
666
661
|
}
|
667
662
|
|
663
|
+
/**
|
664
|
+
* Get `displayDelay` setting of comment plugin.
|
665
|
+
*
|
666
|
+
* @private
|
667
|
+
* @returns {number|undefined}
|
668
|
+
*/
|
669
|
+
getDisplayDelaySetting() {
|
670
|
+
const commentSetting = this.hot.getSettings()[PLUGIN_KEY];
|
671
|
+
if ((0, _object.isObject)(commentSetting)) {
|
672
|
+
return commentSetting.displayDelay;
|
673
|
+
}
|
674
|
+
}
|
675
|
+
|
668
676
|
/**
|
669
677
|
* Gets the editors input element.
|
670
678
|
*
|
@@ -11,7 +11,7 @@ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
11
11
|
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"); }
|
12
12
|
import { addClass, closest, isChildOf, hasClass, outerHeight } from "../../helpers/dom/element.mjs";
|
13
13
|
import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
|
14
|
-
import { deepClone, deepExtend } from "../../helpers/object.mjs";
|
14
|
+
import { deepClone, deepExtend, isObject } from "../../helpers/object.mjs";
|
15
15
|
import { BasePlugin } from "../base/index.mjs";
|
16
16
|
import CommentEditor from "./commentEditor.mjs";
|
17
17
|
import DisplaySwitch from "./displaySwitch.mjs";
|
@@ -190,11 +190,6 @@ export class Comments extends BasePlugin {
|
|
190
190
|
static get PLUGIN_PRIORITY() {
|
191
191
|
return PLUGIN_PRIORITY;
|
192
192
|
}
|
193
|
-
static get DEFAULT_SETTINGS() {
|
194
|
-
return {
|
195
|
-
displayDelay: 250
|
196
|
-
};
|
197
|
-
}
|
198
193
|
/**
|
199
194
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
200
195
|
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
@@ -223,7 +218,7 @@ export class Comments extends BasePlugin {
|
|
223
218
|
});
|
224
219
|
}
|
225
220
|
if (!_classPrivateFieldGet(_displaySwitch, this)) {
|
226
|
-
_classPrivateFieldSet(_displaySwitch, this, new DisplaySwitch(this.
|
221
|
+
_classPrivateFieldSet(_displaySwitch, this, new DisplaySwitch(this.getDisplayDelaySetting()));
|
227
222
|
}
|
228
223
|
this.addHook('afterContextMenuDefaultOptions', options => this.addToContextMenu(options));
|
229
224
|
this.addHook('afterRenderer', (TD, row, col, prop, value, cellProperties) => _assertClassBrand(_Comments_brand, this, _onAfterRenderer).call(this, TD, cellProperties));
|
@@ -244,7 +239,7 @@ export class Comments extends BasePlugin {
|
|
244
239
|
* - [`comments`](@/api/options.md#comments)
|
245
240
|
*/
|
246
241
|
updatePlugin() {
|
247
|
-
_classPrivateFieldGet(_displaySwitch, this).updateDelay(this.
|
242
|
+
_classPrivateFieldGet(_displaySwitch, this).updateDelay(this.getDisplayDelaySetting());
|
248
243
|
super.updatePlugin();
|
249
244
|
}
|
250
245
|
|
@@ -661,6 +656,19 @@ export class Comments extends BasePlugin {
|
|
661
656
|
}, addEditCommentItem(this), removeCommentItem(this), readOnlyCommentItem(this));
|
662
657
|
}
|
663
658
|
|
659
|
+
/**
|
660
|
+
* Get `displayDelay` setting of comment plugin.
|
661
|
+
*
|
662
|
+
* @private
|
663
|
+
* @returns {number|undefined}
|
664
|
+
*/
|
665
|
+
getDisplayDelaySetting() {
|
666
|
+
const commentSetting = this.hot.getSettings()[PLUGIN_KEY];
|
667
|
+
if (isObject(commentSetting)) {
|
668
|
+
return commentSetting.displayDelay;
|
669
|
+
}
|
670
|
+
}
|
671
|
+
|
664
672
|
/**
|
665
673
|
* Gets the editors input element.
|
666
674
|
*
|