handsontable 14.3.0 → 14.4.0-next-f62dd73-20240521
Sign up to get free protection for your applications and to get access to all the features.
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/_base.js +24 -20
- package/3rdparty/walkontable/src/overlay/_base.mjs +24 -20
- package/3rdparty/walkontable/src/overlay/bottom.js +3 -6
- package/3rdparty/walkontable/src/overlay/bottom.mjs +3 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.js +22 -19
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +22 -19
- package/3rdparty/walkontable/src/overlay/top.js +13 -12
- package/3rdparty/walkontable/src/overlay/top.mjs +13 -12
- package/3rdparty/walkontable/src/overlays.js +46 -24
- package/3rdparty/walkontable/src/overlays.mjs +46 -24
- package/3rdparty/walkontable/src/selection/manager.js +7 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +7 -0
- package/3rdparty/walkontable/src/selection/scanner.js +7 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +7 -0
- package/3rdparty/walkontable/src/table.js +10 -11
- package/3rdparty/walkontable/src/table.mjs +10 -11
- package/3rdparty/walkontable/src/utils/columnStretching.js +4 -0
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +4 -0
- package/3rdparty/walkontable/src/viewport.js +18 -10
- package/3rdparty/walkontable/src/viewport.mjs +18 -10
- package/CHANGELOG.md +37 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -2
- package/core.js +93 -162
- package/core.mjs +93 -162
- package/dataMap/dataMap.js +10 -4
- package/dataMap/dataMap.mjs +10 -4
- package/dataMap/dataSource.js +16 -3
- package/dataMap/dataSource.mjs +16 -3
- package/dataMap/metaManager/lazyFactoryMap.js +7 -0
- package/dataMap/metaManager/lazyFactoryMap.mjs +7 -0
- package/dataMap/metaManager/metaSchema.js +38 -0
- package/dataMap/metaManager/metaSchema.mjs +38 -0
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -0
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -0
- package/dataMap/metaManager/mods/extendMetaProperties.js +44 -31
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +44 -31
- package/dataMap/metaManager/utils.js +7 -0
- package/dataMap/metaManager/utils.mjs +7 -0
- package/dist/handsontable.css +4 -5
- package/dist/handsontable.full.css +4 -5
- package/dist/handsontable.full.js +5878 -4657
- package/dist/handsontable.full.min.css +4 -4
- package/dist/handsontable.full.min.js +59 -59
- package/dist/handsontable.js +5383 -4277
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +20 -20
- package/editorManager.js +0 -67
- package/editorManager.mjs +0 -67
- package/editors/autocompleteEditor/autocompleteEditor.js +6 -4
- package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -4
- package/editors/baseEditor/baseEditor.js +1 -36
- package/editors/baseEditor/baseEditor.mjs +2 -37
- package/editors/dateEditor/dateEditor.js +4 -1
- package/editors/dateEditor/dateEditor.mjs +4 -1
- package/editors/dropdownEditor/dropdownEditor.js +8 -5
- package/editors/dropdownEditor/dropdownEditor.mjs +8 -5
- package/editors/handsontableEditor/handsontableEditor.js +2 -2
- package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
- package/editors/selectEditor/selectEditor.js +1 -9
- package/editors/selectEditor/selectEditor.mjs +1 -9
- package/editors/textEditor/textEditor.js +2 -11
- package/editors/textEditor/textEditor.mjs +2 -11
- package/focusManager.js +3 -5
- package/focusManager.mjs +3 -5
- package/helpers/array.js +7 -0
- package/helpers/array.mjs +7 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/number.js +12 -2
- package/helpers/number.mjs +12 -2
- package/package.json +3 -3
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +79 -2
- package/pluginHooks.mjs +79 -2
- package/plugins/autoColumnSize/autoColumnSize.js +7 -0
- package/plugins/autoColumnSize/autoColumnSize.mjs +7 -0
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/autofill/autofill.js +1 -1
- package/plugins/autofill/autofill.mjs +1 -1
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +6 -2
- package/plugins/base/base.mjs +6 -2
- package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
- package/plugins/columnSorting/sortFunction/date.js +2 -46
- package/plugins/columnSorting/sortFunction/date.mjs +2 -45
- package/plugins/columnSorting/sortFunction/time.js +17 -0
- package/plugins/columnSorting/sortFunction/time.mjs +13 -0
- package/plugins/columnSorting/sortService/registry.js +4 -2
- package/plugins/columnSorting/sortService/registry.mjs +3 -1
- package/plugins/columnSorting/utils.js +64 -0
- package/plugins/columnSorting/utils.mjs +62 -0
- package/plugins/columnSummary/columnSummary.js +27 -10
- package/plugins/columnSummary/columnSummary.mjs +27 -10
- package/plugins/columnSummary/endpoints.js +15 -0
- package/plugins/columnSummary/endpoints.mjs +15 -0
- package/plugins/comments/comments.js +2 -8
- package/plugins/comments/comments.mjs +2 -8
- package/plugins/comments/contextMenuItem/addEditComment.js +0 -1
- package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -1
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/copyPaste/copyPaste.js +9 -2
- package/plugins/copyPaste/copyPaste.mjs +9 -2
- package/plugins/copyPaste/pasteEvent.js +1 -0
- package/plugins/copyPaste/pasteEvent.mjs +1 -0
- package/plugins/filters/filters.js +1 -1
- package/plugins/filters/filters.mjs +1 -1
- package/plugins/filters/ui/multipleSelect.js +22 -14
- package/plugins/filters/ui/multipleSelect.mjs +22 -14
- package/plugins/filters/utils.js +7 -0
- package/plugins/filters/utils.mjs +7 -0
- package/plugins/formulas/formulas.d.ts +10 -0
- package/plugins/formulas/formulas.js +11 -2
- package/plugins/formulas/formulas.mjs +11 -2
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +8 -1
- package/plugins/hiddenColumns/hiddenColumns.mjs +8 -1
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
- package/plugins/hiddenRows/hiddenRows.js +7 -0
- package/plugins/hiddenRows/hiddenRows.mjs +7 -0
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +1 -1
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +3 -3
- package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.d.ts +1 -0
- package/plugins/manualRowResize/manualRowResize.js +11 -2
- package/plugins/manualRowResize/manualRowResize.mjs +11 -2
- package/plugins/mergeCells/cellsCollection.js +7 -0
- package/plugins/mergeCells/cellsCollection.mjs +7 -0
- package/plugins/mergeCells/mergeCells.js +7 -0
- package/plugins/mergeCells/mergeCells.mjs +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +7 -0
- package/plugins/nestedRows/nestedRows.js +7 -0
- package/plugins/nestedRows/nestedRows.mjs +7 -0
- package/plugins/trimRows/trimRows.js +7 -0
- package/plugins/trimRows/trimRows.mjs +7 -0
- package/selection/selection.js +163 -4
- package/selection/selection.mjs +163 -4
- package/selection/utils.js +7 -0
- package/selection/utils.mjs +7 -0
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
- package/shortcutContexts/commands/editor/index.js +3 -1
- package/shortcutContexts/commands/editor/index.mjs +3 -1
- package/shortcutContexts/editor.js +9 -1
- package/shortcutContexts/editor.mjs +9 -1
- package/shortcutContexts/index.js +1 -1
- package/shortcutContexts/index.mjs +1 -1
- package/shortcuts/keyObserver.js +7 -0
- package/shortcuts/keyObserver.mjs +7 -0
- package/shortcuts/utils.js +7 -0
- package/shortcuts/utils.mjs +7 -0
- package/tableView.js +1 -4
- package/tableView.mjs +1 -4
- package/translations/changesObservable/observable.js +7 -0
- package/translations/changesObservable/observable.mjs +7 -0
- package/translations/indexMapper.js +7 -0
- package/translations/indexMapper.mjs +8 -1
- package/utils/dataStructures/uniqueSet.js +7 -0
- package/utils/dataStructures/uniqueSet.mjs +7 -0
- package/utils/ghostTable.js +0 -4
- package/utils/ghostTable.mjs +0 -4
- package/utils/paginator.js +7 -0
- package/utils/paginator.mjs +7 -0
- package/validators/dateValidator/dateValidator.js +1 -3
- package/validators/dateValidator/dateValidator.mjs +1 -3
- package/validators/timeValidator/timeValidator.js +1 -3
- package/validators/timeValidator/timeValidator.mjs +1 -3
package/base.js
CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _pluginHooks.default.getSingleton();
|
|
45
45
|
Handsontable.CellCoords = _src.CellCoords;
|
46
46
|
Handsontable.CellRange = _src.CellRange;
|
47
47
|
Handsontable.packageName = 'handsontable';
|
48
|
-
Handsontable.buildDate = "
|
49
|
-
Handsontable.version = "14.
|
48
|
+
Handsontable.buildDate = "21/05/2024 10:09:58";
|
49
|
+
Handsontable.version = "14.4.0-next-f62dd73-20240521";
|
50
50
|
Handsontable.languages = {
|
51
51
|
dictionaryKeys: _registry.dictionaryKeys,
|
52
52
|
getLanguageDictionary: _registry.getLanguageDictionary,
|
package/base.mjs
CHANGED
@@ -35,8 +35,8 @@ Handsontable.hooks = Hooks.getSingleton();
|
|
35
35
|
Handsontable.CellCoords = CellCoords;
|
36
36
|
Handsontable.CellRange = CellRange;
|
37
37
|
Handsontable.packageName = 'handsontable';
|
38
|
-
Handsontable.buildDate = "
|
39
|
-
Handsontable.version = "14.
|
38
|
+
Handsontable.buildDate = "21/05/2024 10:10:04";
|
39
|
+
Handsontable.version = "14.4.0-next-f62dd73-20240521";
|
40
40
|
Handsontable.languages = {
|
41
41
|
dictionaryKeys,
|
42
42
|
getLanguageDictionary,
|
package/core.d.ts
CHANGED
@@ -25,8 +25,8 @@ type AlterActions = 'insert_row_above' | 'insert_row_below' |
|
|
25
25
|
'remove_row' | 'remove_col';
|
26
26
|
|
27
27
|
export default class Core {
|
28
|
-
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]
|
29
|
-
addHookOnce<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]
|
28
|
+
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
|
29
|
+
addHookOnce<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
|
30
30
|
alter(action: AlterActions, index?: number | Array<[number, number]>, amount?: number, source?: string, keepEmptyRows?: boolean): void;
|
31
31
|
batch<R>(wrappedOperations: () => R): R;
|
32
32
|
batchExecution<R>(wrappedOperations: () => R, forceFlushChanges: boolean): R;
|
package/core.js
CHANGED
@@ -4,6 +4,13 @@ exports.__esModule = true;
|
|
4
4
|
exports.default = Core;
|
5
5
|
require("core-js/modules/es.error.cause.js");
|
6
6
|
require("core-js/modules/es.array.push.js");
|
7
|
+
require("core-js/modules/esnext.set.difference.v2.js");
|
8
|
+
require("core-js/modules/esnext.set.intersection.v2.js");
|
9
|
+
require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
|
10
|
+
require("core-js/modules/esnext.set.is-subset-of.v2.js");
|
11
|
+
require("core-js/modules/esnext.set.is-superset-of.v2.js");
|
12
|
+
require("core-js/modules/esnext.set.symmetric-difference.v2.js");
|
13
|
+
require("core-js/modules/esnext.set.union.v2.js");
|
7
14
|
require("core-js/modules/web.immediate.js");
|
8
15
|
var _element = require("./helpers/dom/element");
|
9
16
|
var _function = require("./helpers/function");
|
@@ -330,7 +337,7 @@ function Core(rootElement, userSettings) {
|
|
330
337
|
hiddenIndexesChanged
|
331
338
|
} = _ref;
|
332
339
|
if (hiddenIndexesChanged) {
|
333
|
-
this.selection.
|
340
|
+
this.selection.commit();
|
334
341
|
}
|
335
342
|
};
|
336
343
|
this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
|
@@ -365,7 +372,11 @@ function Core(rootElement, userSettings) {
|
|
365
372
|
} else {
|
366
373
|
(0, _element.removeClass)(this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
367
374
|
}
|
368
|
-
|
375
|
+
if (selection.getSelectionSource() !== 'shift') {
|
376
|
+
editorManager.closeEditor(null);
|
377
|
+
}
|
378
|
+
instance.view.render();
|
379
|
+
editorManager.prepareEditor();
|
369
380
|
});
|
370
381
|
this.selection.addLocalHook('beforeSetFocus', cellCoords => {
|
371
382
|
this.runHooks('beforeSelectionFocusSet', cellCoords.row, cellCoords.col);
|
@@ -376,7 +387,9 @@ function Core(rootElement, userSettings) {
|
|
376
387
|
if (!preventScrolling.isTouched() || preventScrolling.isTouched() && !preventScrolling.value) {
|
377
388
|
viewportScroller.scrollTo(cellCoords);
|
378
389
|
}
|
379
|
-
|
390
|
+
editorManager.closeEditor();
|
391
|
+
instance.view.render();
|
392
|
+
editorManager.prepareEditor();
|
380
393
|
});
|
381
394
|
this.selection.addLocalHook('afterSelectionFinished', cellRanges => {
|
382
395
|
const selectionLayerLevel = cellRanges.length - 1;
|
@@ -394,8 +407,8 @@ function Core(rootElement, userSettings) {
|
|
394
407
|
}
|
395
408
|
});
|
396
409
|
this.selection.addLocalHook('afterDeselect', () => {
|
397
|
-
editorManager.
|
398
|
-
|
410
|
+
editorManager.closeEditor();
|
411
|
+
instance.view.render();
|
399
412
|
(0, _element.removeClass)(this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
400
413
|
this.runHooks('afterDeselect');
|
401
414
|
});
|
@@ -550,39 +563,7 @@ function Core(rootElement, userSettings) {
|
|
550
563
|
source,
|
551
564
|
mode: insertRowMode
|
552
565
|
});
|
553
|
-
|
554
|
-
const currentSelectedRange = selection.selectedRange.current();
|
555
|
-
const currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
556
|
-
const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
557
|
-
const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
|
558
|
-
if (selection.isSelectedByCorner()) {
|
559
|
-
selection.selectAll(true, true, {
|
560
|
-
disableHeadersHighlight: true
|
561
|
-
});
|
562
|
-
} else if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= startVisualRowIndex) {
|
563
|
-
// Moving the selection (if it exists) downward – it should be applied to the "old" row.
|
564
|
-
// TODO: The logic here should be handled by selection module.
|
565
|
-
const {
|
566
|
-
row: currentToRow,
|
567
|
-
col: currentToColumn
|
568
|
-
} = currentSelectedRange.to;
|
569
|
-
let currentFromColumn = currentFromRange.col;
|
570
|
-
|
571
|
-
// Workaround: headers are not stored inside selection.
|
572
|
-
if (selection.isSelectedByRowHeader()) {
|
573
|
-
currentFromColumn = -1;
|
574
|
-
}
|
575
|
-
|
576
|
-
// Remove from the stack the last added selection as that selection below will be
|
577
|
-
// replaced by new transformed selection.
|
578
|
-
selection.getSelectedRange().pop();
|
579
|
-
// I can't use transforms as they don't work in negative indexes.
|
580
|
-
selection.setRangeStartOnly(instance._createCellCoords(currentFromRow + rowDelta, currentFromColumn), true);
|
581
|
-
selection.setRangeEnd(instance._createCellCoords(currentToRow + rowDelta, currentToColumn)); // will call render() internally
|
582
|
-
} else {
|
583
|
-
instance._refreshBorders(); // it will call render and prepare methods
|
584
|
-
}
|
585
|
-
}
|
566
|
+
selection.shiftRows(instance.toVisualRow(startRowPhysicalIndex), rowDelta);
|
586
567
|
break;
|
587
568
|
case 'insert_col_start':
|
588
569
|
case 'insert_col_end':
|
@@ -605,38 +586,7 @@ function Core(rootElement, userSettings) {
|
|
605
586
|
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
606
587
|
Array.prototype.splice.apply(tableMeta.colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array
|
607
588
|
}
|
608
|
-
|
609
|
-
const currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
610
|
-
const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
|
611
|
-
const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
|
612
|
-
if (selection.isSelectedByCorner()) {
|
613
|
-
selection.selectAll(true, true, {
|
614
|
-
disableHeadersHighlight: true
|
615
|
-
});
|
616
|
-
} else if ((0, _mixed.isDefined)(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
|
617
|
-
// Moving the selection (if it exists) rightward – it should be applied to the "old" column.
|
618
|
-
// TODO: The logic here should be handled by selection module.
|
619
|
-
const {
|
620
|
-
row: currentToRow,
|
621
|
-
col: currentToColumn
|
622
|
-
} = currentSelectedRange.to;
|
623
|
-
let currentFromRow = currentFromRange.row;
|
624
|
-
|
625
|
-
// Workaround: headers are not stored inside selection.
|
626
|
-
if (selection.isSelectedByColumnHeader()) {
|
627
|
-
currentFromRow = -1;
|
628
|
-
}
|
629
|
-
|
630
|
-
// Remove from the stack the last added selection as that selection below will be
|
631
|
-
// replaced by new transformed selection.
|
632
|
-
selection.getSelectedRange().pop();
|
633
|
-
|
634
|
-
// I can't use transforms as they don't work in negative indexes.
|
635
|
-
selection.setRangeStartOnly(instance._createCellCoords(currentFromRow, currentFromColumn + colDelta), true);
|
636
|
-
selection.setRangeEnd(instance._createCellCoords(currentToRow, currentToColumn + colDelta)); // will call render() internally
|
637
|
-
} else {
|
638
|
-
instance._refreshBorders(); // it will call render and prepare methods
|
639
|
-
}
|
589
|
+
selection.shiftColumns(instance.toVisualColumn(startColumnPhysicalIndex), colDelta);
|
640
590
|
}
|
641
591
|
break;
|
642
592
|
case 'remove_row':
|
@@ -661,7 +611,22 @@ function Core(rootElement, userSettings) {
|
|
661
611
|
if (!wasRemoved) {
|
662
612
|
return;
|
663
613
|
}
|
614
|
+
if (selection.isSelected()) {
|
615
|
+
const {
|
616
|
+
row
|
617
|
+
} = instance.getSelectedRangeLast().highlight;
|
618
|
+
if (row >= groupIndex && row <= groupIndex + groupAmount - 1) {
|
619
|
+
editorManager.closeEditor(true);
|
620
|
+
}
|
621
|
+
}
|
664
622
|
const totalRows = instance.countRows();
|
623
|
+
if (totalRows === 0) {
|
624
|
+
selection.deselect();
|
625
|
+
} else if (source === 'ContextMenu.removeRow') {
|
626
|
+
selection.refresh();
|
627
|
+
} else {
|
628
|
+
selection.shiftRows(groupIndex, -groupAmount);
|
629
|
+
}
|
665
630
|
const fixedRowsTop = tableMeta.fixedRowsTop;
|
666
631
|
if (fixedRowsTop >= calcIndex + 1) {
|
667
632
|
tableMeta.fixedRowsTop -= Math.min(groupAmount, fixedRowsTop - calcIndex);
|
@@ -678,8 +643,6 @@ function Core(rootElement, userSettings) {
|
|
678
643
|
} else {
|
679
644
|
removeRow([[index, amount]]);
|
680
645
|
}
|
681
|
-
grid.adjustRowsAndCols();
|
682
|
-
instance._refreshBorders(); // it will call render and prepare methods
|
683
646
|
break;
|
684
647
|
case 'remove_col':
|
685
648
|
const removeCol = indexes => {
|
@@ -704,6 +667,22 @@ function Core(rootElement, userSettings) {
|
|
704
667
|
if (!wasRemoved) {
|
705
668
|
return;
|
706
669
|
}
|
670
|
+
if (selection.isSelected()) {
|
671
|
+
const {
|
672
|
+
col
|
673
|
+
} = instance.getSelectedRangeLast().highlight;
|
674
|
+
if (col >= groupIndex && col <= groupIndex + groupAmount - 1) {
|
675
|
+
editorManager.closeEditor(true);
|
676
|
+
}
|
677
|
+
}
|
678
|
+
const totalColumns = instance.countCols();
|
679
|
+
if (totalColumns === 0) {
|
680
|
+
selection.deselect();
|
681
|
+
} else if (source === 'ContextMenu.removeColumn') {
|
682
|
+
selection.refresh();
|
683
|
+
} else {
|
684
|
+
selection.shiftColumns(groupIndex, -groupAmount);
|
685
|
+
}
|
707
686
|
const fixedColumnsStart = tableMeta.fixedColumnsStart;
|
708
687
|
if (fixedColumnsStart >= calcIndex + 1) {
|
709
688
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
@@ -722,13 +701,11 @@ function Core(rootElement, userSettings) {
|
|
722
701
|
} else {
|
723
702
|
removeCol([[index, amount]]);
|
724
703
|
}
|
725
|
-
grid.adjustRowsAndCols();
|
726
|
-
instance._refreshBorders(); // it will call render and prepare methods
|
727
|
-
|
728
704
|
break;
|
729
705
|
default:
|
730
706
|
throw new Error(`There is no such action "${action}"`);
|
731
707
|
}
|
708
|
+
instance.view.render();
|
732
709
|
if (!keepEmptyRows) {
|
733
710
|
grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh
|
734
711
|
}
|
@@ -743,9 +720,6 @@ function Core(rootElement, userSettings) {
|
|
743
720
|
const minSpareRows = tableMeta.minSpareRows;
|
744
721
|
const minCols = tableMeta.minCols;
|
745
722
|
const minSpareCols = tableMeta.minSpareCols;
|
746
|
-
if (instance.countRows() === 0 && instance.countCols() === 0) {
|
747
|
-
selection.deselect();
|
748
|
-
}
|
749
723
|
if (minRows) {
|
750
724
|
// should I add empty rows to data source to meet minRows?
|
751
725
|
const nrOfRows = instance.countRows();
|
@@ -804,55 +778,6 @@ function Core(rootElement, userSettings) {
|
|
804
778
|
});
|
805
779
|
}
|
806
780
|
}
|
807
|
-
if (selection.isSelected()) {
|
808
|
-
const rowCount = instance.countRows();
|
809
|
-
const colCount = instance.countCols();
|
810
|
-
(0, _array.arrayEach)(selection.selectedRange, range => {
|
811
|
-
let selectionChanged = false;
|
812
|
-
let fromRow = range.from.row;
|
813
|
-
let fromCol = range.from.col;
|
814
|
-
let toRow = range.to.row;
|
815
|
-
let toCol = range.to.col;
|
816
|
-
|
817
|
-
// if selection is outside, move selection to last row
|
818
|
-
if (fromRow > rowCount - 1) {
|
819
|
-
fromRow = rowCount - 1;
|
820
|
-
selectionChanged = true;
|
821
|
-
if (toRow > fromRow) {
|
822
|
-
toRow = fromRow;
|
823
|
-
}
|
824
|
-
} else if (toRow > rowCount - 1) {
|
825
|
-
toRow = rowCount - 1;
|
826
|
-
selectionChanged = true;
|
827
|
-
if (fromRow > toRow) {
|
828
|
-
fromRow = toRow;
|
829
|
-
}
|
830
|
-
}
|
831
|
-
// if selection is outside, move selection to last row
|
832
|
-
if (fromCol > colCount - 1) {
|
833
|
-
fromCol = colCount - 1;
|
834
|
-
selectionChanged = true;
|
835
|
-
if (toCol > fromCol) {
|
836
|
-
toCol = fromCol;
|
837
|
-
}
|
838
|
-
} else if (toCol > colCount - 1) {
|
839
|
-
toCol = colCount - 1;
|
840
|
-
selectionChanged = true;
|
841
|
-
if (fromCol > toCol) {
|
842
|
-
fromCol = toCol;
|
843
|
-
}
|
844
|
-
}
|
845
|
-
if (selectionChanged) {
|
846
|
-
if (fromCol < 0) {
|
847
|
-
instance.selectRows(fromRow, toRow, fromCol);
|
848
|
-
} else if (fromRow < 0) {
|
849
|
-
instance.selectColumns(fromCol, toCol, fromRow);
|
850
|
-
} else {
|
851
|
-
instance.selectCell(fromRow, fromCol, toRow, toCol);
|
852
|
-
}
|
853
|
-
}
|
854
|
-
});
|
855
|
-
}
|
856
781
|
if (instance.view) {
|
857
782
|
instance.view.adjustElementsSize();
|
858
783
|
}
|
@@ -1197,8 +1122,18 @@ function Core(rootElement, userSettings) {
|
|
1197
1122
|
};
|
1198
1123
|
for (let i = changes.length - 1; i >= 0; i--) {
|
1199
1124
|
const [row, prop,, newValue] = changes[i];
|
1200
|
-
const
|
1201
|
-
|
1125
|
+
const visualCol = datamap.propToCol(prop);
|
1126
|
+
let cellProperties;
|
1127
|
+
if (Number.isInteger(visualCol)) {
|
1128
|
+
cellProperties = instance.getCellMeta(row, visualCol);
|
1129
|
+
} else {
|
1130
|
+
// If there's no requested visual column, we can use the table meta as the cell properties when retrieving
|
1131
|
+
// the cell validator.
|
1132
|
+
cellProperties = {
|
1133
|
+
...Object.getPrototypeOf(tableMeta),
|
1134
|
+
...tableMeta
|
1135
|
+
};
|
1136
|
+
}
|
1202
1137
|
if (cellProperties.type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
|
1203
1138
|
changes[i][3] = getParsedNumber(newValue);
|
1204
1139
|
}
|
@@ -1289,9 +1224,9 @@ function Core(rootElement, userSettings) {
|
|
1289
1224
|
instance.forceFullRender = true; // used when data was changed
|
1290
1225
|
grid.adjustRowsAndCols();
|
1291
1226
|
instance.runHooks('beforeChangeRender', changes, source);
|
1292
|
-
editorManager.
|
1293
|
-
instance.
|
1294
|
-
editorManager.
|
1227
|
+
editorManager.closeEditor();
|
1228
|
+
instance.view.render();
|
1229
|
+
editorManager.prepareEditor();
|
1295
1230
|
instance.view.adjustElementsSize();
|
1296
1231
|
instance.runHooks('afterChange', changes, source || 'edit');
|
1297
1232
|
const activeEditor = instance.getActiveEditor();
|
@@ -1502,6 +1437,9 @@ function Core(rootElement, userSettings) {
|
|
1502
1437
|
for (i = 0, ilen = input.length; i < ilen; i++) {
|
1503
1438
|
changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
|
1504
1439
|
}
|
1440
|
+
|
1441
|
+
// TODO: I don't think `prop` should be used as `changeSource` here, but removing it would be a breaking change.
|
1442
|
+
// We should remove it with the next major release.
|
1505
1443
|
if (!changeSource && typeof row === 'object') {
|
1506
1444
|
changeSource = prop;
|
1507
1445
|
}
|
@@ -1568,7 +1506,11 @@ function Core(rootElement, userSettings) {
|
|
1568
1506
|
this.destroyEditor = function () {
|
1569
1507
|
let revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1570
1508
|
let prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1571
|
-
|
1509
|
+
editorManager.closeEditor(revertOriginal);
|
1510
|
+
instance.view.render();
|
1511
|
+
if (prepareEditorIfNeeded && selection.isSelected()) {
|
1512
|
+
editorManager.prepareEditor();
|
1513
|
+
}
|
1572
1514
|
};
|
1573
1515
|
|
1574
1516
|
/**
|
@@ -1831,7 +1773,7 @@ function Core(rootElement, userSettings) {
|
|
1831
1773
|
if (this.renderCall) {
|
1832
1774
|
this.render();
|
1833
1775
|
} else {
|
1834
|
-
|
1776
|
+
instance.view.render();
|
1835
1777
|
}
|
1836
1778
|
}
|
1837
1779
|
};
|
@@ -1852,9 +1794,7 @@ function Core(rootElement, userSettings) {
|
|
1852
1794
|
this.forceFullRender = true; // used when data was changed
|
1853
1795
|
|
1854
1796
|
if (!this.isRenderSuspended()) {
|
1855
|
-
|
1856
|
-
this._refreshBorders(null);
|
1857
|
-
editorManager.unlockEditor();
|
1797
|
+
instance.view.render();
|
1858
1798
|
}
|
1859
1799
|
}
|
1860
1800
|
};
|
@@ -2121,6 +2061,7 @@ function Core(rootElement, userSettings) {
|
|
2121
2061
|
instance.columnIndexMapper.fitToLength(this.getInitialColumnCount());
|
2122
2062
|
instance.rowIndexMapper.fitToLength(this.countSourceRows());
|
2123
2063
|
grid.adjustRowsAndCols();
|
2064
|
+
selection.refresh();
|
2124
2065
|
}, {
|
2125
2066
|
hotInstance: instance,
|
2126
2067
|
dataMap: datamap,
|
@@ -2161,6 +2102,7 @@ function Core(rootElement, userSettings) {
|
|
2161
2102
|
metaManager.clearCellsCache();
|
2162
2103
|
instance.initIndexMappers();
|
2163
2104
|
grid.adjustRowsAndCols();
|
2105
|
+
selection.refresh();
|
2164
2106
|
if (firstRun) {
|
2165
2107
|
firstRun = [null, 'loadData'];
|
2166
2108
|
}
|
@@ -2448,10 +2390,8 @@ function Core(rootElement, userSettings) {
|
|
2448
2390
|
grid.adjustRowsAndCols();
|
2449
2391
|
if (instance.view && !firstRun) {
|
2450
2392
|
instance.forceFullRender = true; // used when data was changed
|
2451
|
-
|
2452
|
-
instance._refreshBorders(null);
|
2393
|
+
instance.view.render();
|
2453
2394
|
instance.view._wt.wtOverlays.adjustElementsSize();
|
2454
|
-
editorManager.unlockEditor();
|
2455
2395
|
}
|
2456
2396
|
if (!init && instance.view && (currentHeight === '' || height === '' || height === undefined) && currentHeight !== height) {
|
2457
2397
|
instance.view._wt.wtOverlays.updateMainScrollableElements();
|
@@ -2603,7 +2543,7 @@ function Core(rootElement, userSettings) {
|
|
2603
2543
|
}
|
2604
2544
|
renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(row);
|
2605
2545
|
}
|
2606
|
-
if (renderableRowIndex === null || renderableColumnIndex === null) {
|
2546
|
+
if (renderableRowIndex === null || renderableColumnIndex === null || renderableRowIndex === undefined || renderableColumnIndex === undefined) {
|
2607
2547
|
return null;
|
2608
2548
|
}
|
2609
2549
|
return instance.view.getCellAtCoords(instance._createCellCoords(renderableRowIndex, renderableColumnIndex), topmost);
|
@@ -4349,13 +4289,17 @@ function Core(rootElement, userSettings) {
|
|
4349
4289
|
* @see Hooks#add
|
4350
4290
|
* @param {string} key Hook name (see {@link Hooks}).
|
4351
4291
|
* @param {Function|Array} callback Function or array of functions.
|
4292
|
+
* @param {number} [orderIndex] Order index of the callback.
|
4293
|
+
* 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.
|
4294
|
+
* 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.
|
4295
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
4352
4296
|
* @example
|
4353
4297
|
* ```js
|
4354
4298
|
* hot.addHook('beforeInit', myCallback);
|
4355
4299
|
* ```
|
4356
4300
|
*/
|
4357
|
-
this.addHook = function (key, callback) {
|
4358
|
-
_pluginHooks.default.getSingleton().add(key, callback, instance);
|
4301
|
+
this.addHook = function (key, callback, orderIndex) {
|
4302
|
+
_pluginHooks.default.getSingleton().add(key, callback, instance, orderIndex);
|
4359
4303
|
};
|
4360
4304
|
|
4361
4305
|
/**
|
@@ -4386,13 +4330,17 @@ function Core(rootElement, userSettings) {
|
|
4386
4330
|
* @see Hooks#once
|
4387
4331
|
* @param {string} key Hook name (see {@link Hooks}).
|
4388
4332
|
* @param {Function|Array} callback Function or array of functions.
|
4333
|
+
* @param {number} [orderIndex] Order index of the callback.
|
4334
|
+
* 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.
|
4335
|
+
* 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.
|
4336
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
4389
4337
|
* @example
|
4390
4338
|
* ```js
|
4391
4339
|
* hot.addHookOnce('beforeInit', myCallback);
|
4392
4340
|
* ```
|
4393
4341
|
*/
|
4394
|
-
this.addHookOnce = function (key, callback) {
|
4395
|
-
_pluginHooks.default.getSingleton().once(key, callback, instance);
|
4342
|
+
this.addHookOnce = function (key, callback, orderIndex) {
|
4343
|
+
_pluginHooks.default.getSingleton().once(key, callback, instance, orderIndex);
|
4396
4344
|
};
|
4397
4345
|
|
4398
4346
|
/**
|
@@ -4529,23 +4477,6 @@ function Core(rootElement, userSettings) {
|
|
4529
4477
|
});
|
4530
4478
|
};
|
4531
4479
|
|
4532
|
-
/**
|
4533
|
-
* Refresh selection borders. This is temporary method relic after selection rewrite.
|
4534
|
-
*
|
4535
|
-
* @private
|
4536
|
-
* @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
|
4537
|
-
* @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
|
4538
|
-
*/
|
4539
|
-
this._refreshBorders = function () {
|
4540
|
-
let revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
4541
|
-
let prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4542
|
-
editorManager.destroyEditor(revertOriginal);
|
4543
|
-
instance.view.render();
|
4544
|
-
if (prepareEditorIfNeeded && selection.isSelected()) {
|
4545
|
-
editorManager.prepareEditor();
|
4546
|
-
}
|
4547
|
-
};
|
4548
|
-
|
4549
4480
|
/**
|
4550
4481
|
* Gets the instance of the EditorManager.
|
4551
4482
|
*
|