handsontable 15.1.0 → 15.2.0-next-8670a33-20250312
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.
- package/3rdparty/walkontable/src/selection/border/border.js +16 -3
- package/3rdparty/walkontable/src/selection/border/border.mjs +17 -4
- package/3rdparty/walkontable/src/selection/scanner.js +1 -1
- package/3rdparty/walkontable/src/selection/scanner.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +3 -2
- package/3rdparty/walkontable/src/table.mjs +4 -3
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +1 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +1 -0
- package/3rdparty/walkontable/src/viewport.js +30 -3
- package/3rdparty/walkontable/src/viewport.mjs +30 -3
- package/CHANGELOG.md +40 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +2 -37
- package/core.mjs +2 -37
- package/dataMap/dataMap.js +4 -12
- package/dataMap/dataMap.mjs +4 -12
- package/dataMap/dataSource.js +2 -2
- package/dataMap/dataSource.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +2 -2
- package/dataMap/metaManager/metaSchema.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +494 -400
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +73 -73
- package/dist/handsontable.js +494 -400
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +43 -43
- package/dist/languages/all.js +139 -28
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/fa-IR.js +167 -0
- package/dist/languages/fa-IR.min.js +1 -0
- package/dist/languages/it-IT.js +3 -0
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/sr-SP.js +3 -0
- package/dist/languages/sr-SP.min.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.js +25 -20
- package/editors/autocompleteEditor/autocompleteEditor.mjs +25 -20
- package/editors/dateEditor/dateEditor.d.ts +0 -2
- package/editors/dateEditor/dateEditor.js +18 -7
- package/editors/dateEditor/dateEditor.mjs +17 -6
- package/focusManager.js +5 -3
- package/focusManager.mjs +6 -4
- package/helpers/dom/element.d.ts +1 -0
- package/helpers/dom/element.js +21 -2
- package/helpers/dom/element.mjs +20 -2
- package/helpers/dom/event.js +2 -1
- package/helpers/dom/event.mjs +2 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/number.js +1 -0
- package/helpers/number.mjs +1 -0
- package/i18n/languages/fa-IR.d.ts +5 -0
- package/i18n/languages/fa-IR.js +96 -0
- package/i18n/languages/fa-IR.mjs +90 -0
- package/i18n/languages/index.d.ts +2 -0
- package/i18n/languages/index.js +2 -0
- package/i18n/languages/index.mjs +2 -1
- package/i18n/languages/it-IT.js +3 -0
- package/i18n/languages/it-IT.mjs +3 -0
- package/i18n/languages/sr-SP.js +3 -0
- package/i18n/languages/sr-SP.mjs +3 -0
- package/i18n/phraseFormatters/substituteVariables.js +1 -0
- package/i18n/phraseFormatters/substituteVariables.mjs +1 -0
- package/languages/all.js +139 -28
- package/languages/fa-IR.js +167 -0
- package/languages/fa-IR.mjs +92 -0
- package/languages/index.js +139 -28
- package/languages/index.mjs +2 -1
- package/languages/it-IT.js +3 -0
- package/languages/it-IT.mjs +3 -0
- package/languages/sr-SP.js +3 -0
- package/languages/sr-SP.mjs +3 -0
- package/package.json +13 -2
- package/plugins/columnSorting/columnSorting.js +17 -1
- package/plugins/columnSorting/columnSorting.mjs +18 -2
- package/plugins/columnSorting/columnStatesManager.js +1 -0
- package/plugins/columnSorting/columnStatesManager.mjs +1 -0
- package/plugins/columnSorting/utils.js +14 -0
- package/plugins/columnSorting/utils.mjs +13 -0
- package/plugins/comments/comments.js +5 -2
- package/plugins/comments/comments.mjs +6 -3
- package/plugins/contextMenu/menu/menu.js +9 -3
- package/plugins/contextMenu/menu/menu.mjs +9 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -8
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -8
- package/plugins/contextMenu/predefinedItems/columnRight.js +2 -9
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +2 -9
- package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -8
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -8
- package/plugins/contextMenu/predefinedItems/rowBelow.js +2 -9
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +2 -9
- package/plugins/copyPaste/copyPaste.js +3 -3
- package/plugins/copyPaste/copyPaste.mjs +4 -4
- package/plugins/exportFile/types/csv.js +1 -0
- package/plugins/exportFile/types/csv.mjs +1 -0
- package/plugins/filters/conditionCollection.js +0 -26
- package/plugins/filters/conditionCollection.mjs +0 -26
- package/plugins/filters/filters.d.ts +2 -0
- package/plugins/filters/filters.js +77 -8
- package/plugins/filters/filters.mjs +77 -8
- package/plugins/mergeCells/mergeCells.js +9 -6
- package/plugins/mergeCells/mergeCells.mjs +9 -6
- package/plugins/multiColumnSorting/multiColumnSorting.js +1 -21
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +1 -21
- package/plugins/nestedHeaders/nestedHeaders.js +5 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +5 -3
- package/plugins/nestedHeaders/stateManager/index.js +1 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -0
- package/plugins/undoRedo/actions/_base.js +10 -0
- package/plugins/undoRedo/actions/_base.mjs +10 -0
- package/plugins/undoRedo/actions/cellAlignment.js +1 -1
- package/plugins/undoRedo/actions/cellAlignment.mjs +1 -1
- package/plugins/undoRedo/actions/columnMove.js +1 -1
- package/plugins/undoRedo/actions/columnMove.mjs +1 -1
- package/plugins/undoRedo/actions/columnSort.js +1 -1
- package/plugins/undoRedo/actions/columnSort.mjs +1 -1
- package/plugins/undoRedo/actions/createColumn.js +1 -1
- package/plugins/undoRedo/actions/createColumn.mjs +1 -1
- package/plugins/undoRedo/actions/createRow.js +1 -1
- package/plugins/undoRedo/actions/createRow.mjs +1 -1
- package/plugins/undoRedo/actions/dataChange.js +1 -1
- package/plugins/undoRedo/actions/dataChange.mjs +1 -1
- package/plugins/undoRedo/actions/filters.js +3 -3
- package/plugins/undoRedo/actions/filters.mjs +3 -3
- package/plugins/undoRedo/actions/mergeCells.js +4 -1
- package/plugins/undoRedo/actions/mergeCells.mjs +4 -1
- package/plugins/undoRedo/actions/removeColumn.js +4 -2
- package/plugins/undoRedo/actions/removeColumn.mjs +4 -2
- package/plugins/undoRedo/actions/removeRow.js +1 -1
- package/plugins/undoRedo/actions/removeRow.mjs +1 -1
- package/plugins/undoRedo/actions/rowMove.js +1 -1
- package/plugins/undoRedo/actions/rowMove.mjs +1 -1
- package/plugins/undoRedo/actions/unmergeCells.js +4 -1
- package/plugins/undoRedo/actions/unmergeCells.mjs +4 -1
- package/plugins/undoRedo/undoRedo.d.ts +48 -17
- package/renderers/checkboxRenderer/checkboxRenderer.js +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +2 -2
- package/renderers/numericRenderer/numericRenderer.js +10 -2
- package/renderers/numericRenderer/numericRenderer.mjs +10 -2
- package/renderers/textRenderer/textRenderer.js +3 -12
- package/renderers/textRenderer/textRenderer.mjs +4 -13
- package/shortcuts/utils.js +1 -0
- package/shortcuts/utils.mjs +1 -0
- package/styles/handsontable.css +83 -99
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +14 -2
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main.css +14 -2
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +9 -0
- package/tableView.mjs +9 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.js +1 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +1 -0
- package/translations/maps/utils/physicallyIndexed.js +1 -0
- package/translations/maps/utils/physicallyIndexed.mjs +1 -0
- package/utils/dataStructures/priorityMap.js +1 -0
- package/utils/dataStructures/priorityMap.mjs +1 -0
- package/plugins/multiColumnSorting/utils.js +0 -13
- package/plugins/multiColumnSorting/utils.mjs +0 -9
@@ -75,6 +75,7 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
75
75
|
*/
|
76
76
|
var _menuFocusNavigator = /*#__PURE__*/new WeakMap();
|
77
77
|
var _dropdownMenuTraces = /*#__PURE__*/new WeakMap();
|
78
|
+
var _previousConditionStack = /*#__PURE__*/new WeakMap();
|
78
79
|
var _Filters_brand = /*#__PURE__*/new WeakSet();
|
79
80
|
export class Filters extends BasePlugin {
|
80
81
|
static get PLUGIN_KEY() {
|
@@ -146,6 +147,13 @@ export class Filters extends BasePlugin {
|
|
146
147
|
* @type {WeakSet<Menu>}
|
147
148
|
*/
|
148
149
|
_classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());
|
150
|
+
/**
|
151
|
+
* Stores the previous state of the condition stack before the latest filter operation.
|
152
|
+
* This is used in the `beforeFilter` plugin to allow performing the undo operation.
|
153
|
+
*
|
154
|
+
* @type {Array}
|
155
|
+
*/
|
156
|
+
_classPrivateFieldInitSpec(this, _previousConditionStack, []);
|
149
157
|
this.hot.addHook('afterGetColHeader', function () {
|
150
158
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
151
159
|
args[_key] = arguments[_key];
|
@@ -488,6 +496,51 @@ export class Filters extends BasePlugin {
|
|
488
496
|
}
|
489
497
|
}
|
490
498
|
|
499
|
+
/**
|
500
|
+
* Imports filter conditions to all columns to the plugin. The method accepts
|
501
|
+
* the array of conditions with the same structure as the {@link Filters#exportConditions} method returns.
|
502
|
+
* Importing conditions will replace the current conditions. Once replaced, the state of the condition
|
503
|
+
* will be reflected in the UI. To apply the changes and filter the table, call
|
504
|
+
* the {@link Filters#filter} method eventually.
|
505
|
+
*
|
506
|
+
* @param {Array} conditions Array of conditions.
|
507
|
+
*/
|
508
|
+
importConditions(conditions) {
|
509
|
+
this.conditionCollection.importAllConditions(conditions);
|
510
|
+
}
|
511
|
+
|
512
|
+
/* eslint-disable jsdoc/require-description-complete-sentence */
|
513
|
+
/**
|
514
|
+
* Exports filter conditions for all columns from the plugin.
|
515
|
+
* The array represents the filter state for each column. For example:
|
516
|
+
*
|
517
|
+
* ```js
|
518
|
+
* [
|
519
|
+
* {
|
520
|
+
* column: 1,
|
521
|
+
* operation: 'conjunction',
|
522
|
+
* conditions: [
|
523
|
+
* { name: 'gt', args: [95] },
|
524
|
+
* ]
|
525
|
+
* },
|
526
|
+
* {
|
527
|
+
* column: 7,
|
528
|
+
* operation: 'conjunction',
|
529
|
+
* conditions: [
|
530
|
+
* { name: 'contains', args: ['mike'] },
|
531
|
+
* { name: 'begins_with', args: ['m'] },
|
532
|
+
* ]
|
533
|
+
* },
|
534
|
+
* ]
|
535
|
+
* ```
|
536
|
+
*
|
537
|
+
* @returns {Array}
|
538
|
+
*/
|
539
|
+
/* eslint-enable jsdoc/require-description-complete-sentence */
|
540
|
+
exportConditions() {
|
541
|
+
return this.conditionCollection.exportAllConditions();
|
542
|
+
}
|
543
|
+
|
491
544
|
/**
|
492
545
|
* Filters data based on added filter conditions.
|
493
546
|
*
|
@@ -501,8 +554,8 @@ export class Filters extends BasePlugin {
|
|
501
554
|
const dataFilter = this._createDataFilter();
|
502
555
|
const needToFilter = !this.conditionCollection.isEmpty();
|
503
556
|
let visibleVisualRows = [];
|
504
|
-
const conditions = this.
|
505
|
-
const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this
|
557
|
+
const conditions = this.exportConditions();
|
558
|
+
const allowFiltering = this.hot.runHooks('beforeFilter', conditions, _classPrivateFieldGet(_previousConditionStack, this));
|
506
559
|
if (allowFiltering !== false) {
|
507
560
|
if (needToFilter) {
|
508
561
|
const trimmedRows = [];
|
@@ -525,11 +578,13 @@ export class Filters extends BasePlugin {
|
|
525
578
|
} else {
|
526
579
|
this.filtersRowsMap.clear();
|
527
580
|
}
|
581
|
+
_classPrivateFieldSet(_previousConditionStack, this, this.exportConditions());
|
582
|
+
this.hot.runHooks('afterFilter', conditions);
|
583
|
+
this.hot.view.adjustElementsSize();
|
584
|
+
this.hot.render();
|
585
|
+
} else {
|
586
|
+
this.importConditions(_classPrivateFieldGet(_previousConditionStack, this));
|
528
587
|
}
|
529
|
-
this.hot.runHooks('afterFilter', conditions);
|
530
|
-
this.conditionCollection.setPreviousConditionStack(null);
|
531
|
-
this.hot.view.adjustElementsSize();
|
532
|
-
this.hot.render();
|
533
588
|
if (this.hot.selection.isSelected()) {
|
534
589
|
this.hot.selectCell(navigableHeaders ? -1 : 0, this.hot.getSelectedRangeLast().highlight.col);
|
535
590
|
}
|
@@ -891,7 +946,6 @@ function _onActionBarSubmit(submitType) {
|
|
891
946
|
}
|
892
947
|
this.conditionUpdateObserver.flush();
|
893
948
|
this.components.forEach(component => component.saveState(physicalIndex));
|
894
|
-
this.filtersRowsMap.clear();
|
895
949
|
this.filter();
|
896
950
|
}
|
897
951
|
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 || _this$dropdownMenuPlu3.close();
|
@@ -933,8 +987,23 @@ function _updateComponents(conditionsState) {
|
|
933
987
|
editedConditionStack: {
|
934
988
|
conditions,
|
935
989
|
column
|
936
|
-
}
|
990
|
+
},
|
991
|
+
conditionArgsChange
|
937
992
|
} = conditionsState;
|
993
|
+
if (Array.isArray(conditionArgsChange)) {
|
994
|
+
// update the previous condition stack (only for 'by_value' condition) on each dataset
|
995
|
+
// change to make the undo/redo work properly
|
996
|
+
_classPrivateFieldSet(_previousConditionStack, this, _classPrivateFieldGet(_previousConditionStack, this).map(stack => {
|
997
|
+
if (stack.column === column && conditions.length > 0) {
|
998
|
+
stack.conditions.forEach(condition => {
|
999
|
+
if (condition.name === 'by_value') {
|
1000
|
+
condition.args = [[...conditionArgsChange]];
|
1001
|
+
}
|
1002
|
+
});
|
1003
|
+
}
|
1004
|
+
return stack;
|
1005
|
+
}));
|
1006
|
+
}
|
938
1007
|
const conditionsByValue = conditions.filter(condition => condition.name === CONDITION_BY_VALUE);
|
939
1008
|
const conditionsWithoutByValue = conditions.filter(condition => condition.name !== CONDITION_BY_VALUE);
|
940
1009
|
if (conditionsByValue.length >= 2 || conditionsWithoutByValue.length >= 3) {
|
@@ -1491,14 +1491,17 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1491
1491
|
* @returns {number}
|
1492
1492
|
*/
|
1493
1493
|
function _sumCellsHeights(row, rowspan) {
|
1494
|
-
const
|
1495
|
-
|
1496
|
-
|
1494
|
+
const {
|
1495
|
+
view,
|
1496
|
+
rowIndexMapper
|
1497
|
+
} = this.hot;
|
1498
|
+
const stylesHandler = view.getStylesHandler();
|
1499
|
+
const defaultHeight = view.getDefaultRowHeight();
|
1497
1500
|
let height = 0;
|
1498
1501
|
for (let i = row; i < row + rowspan; i++) {
|
1499
|
-
if (!
|
1500
|
-
var
|
1501
|
-
height += (
|
1502
|
+
if (!rowIndexMapper.isHidden(i)) {
|
1503
|
+
var _this$hot$getRowHeigh;
|
1504
|
+
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
1502
1505
|
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1503
1506
|
height += 1; // border-top-width
|
1504
1507
|
}
|
@@ -1486,14 +1486,17 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1486
1486
|
* @returns {number}
|
1487
1487
|
*/
|
1488
1488
|
function _sumCellsHeights(row, rowspan) {
|
1489
|
-
const
|
1490
|
-
|
1491
|
-
|
1489
|
+
const {
|
1490
|
+
view,
|
1491
|
+
rowIndexMapper
|
1492
|
+
} = this.hot;
|
1493
|
+
const stylesHandler = view.getStylesHandler();
|
1494
|
+
const defaultHeight = view.getDefaultRowHeight();
|
1492
1495
|
let height = 0;
|
1493
1496
|
for (let i = row; i < row + rowspan; i++) {
|
1494
|
-
if (!
|
1495
|
-
var
|
1496
|
-
height += (
|
1497
|
+
if (!rowIndexMapper.isHidden(i)) {
|
1498
|
+
var _this$hot$getRowHeigh;
|
1499
|
+
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
1497
1500
|
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1498
1501
|
height += 1; // border-top-width
|
1499
1502
|
}
|
@@ -7,7 +7,6 @@ var _sortService = require("../columnSorting/sortService");
|
|
7
7
|
var _utils = require("../columnSorting/utils");
|
8
8
|
var _element = require("../../helpers/dom/element");
|
9
9
|
var _rootComparator = require("./rootComparator");
|
10
|
-
var _utils2 = require("./utils");
|
11
10
|
var _domHelpers = require("./domHelpers");
|
12
11
|
var _shortcutContexts = require("../../shortcutContexts");
|
13
12
|
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,7 +14,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
15
14
|
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); }
|
16
15
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'multiColumnSorting';
|
17
16
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 170;
|
18
|
-
const CONFLICTED_PLUGIN_KEY = 'columnSorting';
|
19
17
|
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
20
18
|
(0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
|
21
19
|
|
@@ -95,17 +93,13 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
|
|
95
93
|
* @returns {boolean}
|
96
94
|
*/
|
97
95
|
isEnabled() {
|
98
|
-
return
|
96
|
+
return !!this.hot.getSettings()[this.pluginKey];
|
99
97
|
}
|
100
98
|
|
101
99
|
/**
|
102
100
|
* Enables the plugin functionality for this Handsontable instance.
|
103
101
|
*/
|
104
102
|
enablePlugin() {
|
105
|
-
if (!this.enabled && this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
|
106
|
-
(0, _utils2.warnAboutPluginsConflict)();
|
107
|
-
this.hot.getPlugin(CONFLICTED_PLUGIN_KEY).disablePlugin();
|
108
|
-
}
|
109
103
|
super.enablePlugin();
|
110
104
|
}
|
111
105
|
|
@@ -277,20 +271,6 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
|
|
277
271
|
}
|
278
272
|
}
|
279
273
|
|
280
|
-
/**
|
281
|
-
* Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
|
282
|
-
* for `updateSettings` in specific situations.
|
283
|
-
*
|
284
|
-
* @private
|
285
|
-
* @param {object} newSettings New settings object.
|
286
|
-
*/
|
287
|
-
onUpdateSettings(newSettings) {
|
288
|
-
if (this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
|
289
|
-
(0, _utils2.warnAboutPluginsConflict)();
|
290
|
-
}
|
291
|
-
super.onUpdateSettings(newSettings);
|
292
|
-
}
|
293
|
-
|
294
274
|
/**
|
295
275
|
* Callback for the `onAfterOnCellMouseDown` hook.
|
296
276
|
*
|
@@ -7,12 +7,10 @@ import { registerRootComparator } from "../columnSorting/sortService/index.mjs";
|
|
7
7
|
import { wasHeaderClickedProperly } from "../columnSorting/utils.mjs";
|
8
8
|
import { addClass, removeClass } from "../../helpers/dom/element.mjs";
|
9
9
|
import { rootComparator } from "./rootComparator.mjs";
|
10
|
-
import { warnAboutPluginsConflict } from "./utils.mjs";
|
11
10
|
import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
|
12
11
|
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
13
12
|
export const PLUGIN_KEY = 'multiColumnSorting';
|
14
13
|
export const PLUGIN_PRIORITY = 170;
|
15
|
-
const CONFLICTED_PLUGIN_KEY = 'columnSorting';
|
16
14
|
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
17
15
|
registerRootComparator(PLUGIN_KEY, rootComparator);
|
18
16
|
|
@@ -92,17 +90,13 @@ export class MultiColumnSorting extends ColumnSorting {
|
|
92
90
|
* @returns {boolean}
|
93
91
|
*/
|
94
92
|
isEnabled() {
|
95
|
-
return
|
93
|
+
return !!this.hot.getSettings()[this.pluginKey];
|
96
94
|
}
|
97
95
|
|
98
96
|
/**
|
99
97
|
* Enables the plugin functionality for this Handsontable instance.
|
100
98
|
*/
|
101
99
|
enablePlugin() {
|
102
|
-
if (!this.enabled && this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
|
103
|
-
warnAboutPluginsConflict();
|
104
|
-
this.hot.getPlugin(CONFLICTED_PLUGIN_KEY).disablePlugin();
|
105
|
-
}
|
106
100
|
super.enablePlugin();
|
107
101
|
}
|
108
102
|
|
@@ -274,20 +268,6 @@ export class MultiColumnSorting extends ColumnSorting {
|
|
274
268
|
}
|
275
269
|
}
|
276
270
|
|
277
|
-
/**
|
278
|
-
* Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
|
279
|
-
* for `updateSettings` in specific situations.
|
280
|
-
*
|
281
|
-
* @private
|
282
|
-
* @param {object} newSettings New settings object.
|
283
|
-
*/
|
284
|
-
onUpdateSettings(newSettings) {
|
285
|
-
if (this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
|
286
|
-
warnAboutPluginsConflict();
|
287
|
-
}
|
288
|
-
super.onUpdateSettings(newSettings);
|
289
|
-
}
|
290
|
-
|
291
271
|
/**
|
292
272
|
* Callback for the `onAfterOnCellMouseDown` hook.
|
293
273
|
*
|
@@ -902,9 +902,11 @@ function _onBeforeSelectColumns(from, to, highlight) {
|
|
902
902
|
* @param {Array} renderersArray Array of renderers.
|
903
903
|
*/
|
904
904
|
function _onAfterGetColumnHeaderRenderers(renderersArray) {
|
905
|
-
|
906
|
-
|
907
|
-
|
905
|
+
if (_classPrivateFieldGet(_stateManager, this).getLayersCount() > 0) {
|
906
|
+
renderersArray.length = 0;
|
907
|
+
for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
|
908
|
+
renderersArray.push(this.headerRendererFactory(headerLayer));
|
909
|
+
}
|
908
910
|
}
|
909
911
|
}
|
910
912
|
/**
|
@@ -897,9 +897,11 @@ function _onBeforeSelectColumns(from, to, highlight) {
|
|
897
897
|
* @param {Array} renderersArray Array of renderers.
|
898
898
|
*/
|
899
899
|
function _onAfterGetColumnHeaderRenderers(renderersArray) {
|
900
|
-
|
901
|
-
|
902
|
-
|
900
|
+
if (_classPrivateFieldGet(_stateManager, this).getLayersCount() > 0) {
|
901
|
+
renderersArray.length = 0;
|
902
|
+
for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
|
903
|
+
renderersArray.push(this.headerRendererFactory(headerLayer));
|
904
|
+
}
|
903
905
|
}
|
904
906
|
}
|
905
907
|
/**
|
@@ -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/esnext.iterator.constructor.js");
|
6
7
|
require("core-js/modules/esnext.iterator.map.js");
|
7
8
|
var _array = require("../../../helpers/array");
|
8
9
|
var _sourceSettings2 = _interopRequireDefault(require("./sourceSettings"));
|
@@ -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/esnext.iterator.constructor.js";
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
4
5
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
5
6
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
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; }
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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); }
|
5
8
|
/**
|
6
9
|
* An abstract class that defines the structure of an undo/redo action.
|
7
10
|
*
|
@@ -9,6 +12,13 @@ require("core-js/modules/es.error.cause.js");
|
|
9
12
|
* @private
|
10
13
|
*/
|
11
14
|
class BaseAction {
|
15
|
+
constructor(actionType) {
|
16
|
+
/**
|
17
|
+
* @param {string} actionType The action type.
|
18
|
+
*/
|
19
|
+
_defineProperty(this, "actionType", '');
|
20
|
+
this.actionType = actionType;
|
21
|
+
}
|
12
22
|
undo() {
|
13
23
|
throw new Error('Not implemented');
|
14
24
|
}
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
|
+
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; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
|
+
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); }
|
2
5
|
/**
|
3
6
|
* An abstract class that defines the structure of an undo/redo action.
|
4
7
|
*
|
@@ -6,6 +9,13 @@ import "core-js/modules/es.error.cause.js";
|
|
6
9
|
* @private
|
7
10
|
*/
|
8
11
|
export class BaseAction {
|
12
|
+
constructor(actionType) {
|
13
|
+
/**
|
14
|
+
* @param {string} actionType The action type.
|
15
|
+
*/
|
16
|
+
_defineProperty(this, "actionType", '');
|
17
|
+
this.actionType = actionType;
|
18
|
+
}
|
9
19
|
undo() {
|
10
20
|
throw new Error('Not implemented');
|
11
21
|
}
|
@@ -20,7 +20,7 @@ class FiltersAction extends _base.BaseAction {
|
|
20
20
|
conditionsStack,
|
21
21
|
previousConditionsStack
|
22
22
|
} = _ref;
|
23
|
-
super();
|
23
|
+
super('filter');
|
24
24
|
/**
|
25
25
|
* @param {Array} previousConditionsStack An array of the previous filter conditions.
|
26
26
|
*/
|
@@ -48,7 +48,7 @@ class FiltersAction extends _base.BaseAction {
|
|
48
48
|
undo(hot, undoneCallback) {
|
49
49
|
const filters = hot.getPlugin('filters');
|
50
50
|
hot.addHookOnce('afterViewRender', undoneCallback);
|
51
|
-
filters.
|
51
|
+
filters.importConditions(this.previousConditionsStack);
|
52
52
|
filters.filter();
|
53
53
|
}
|
54
54
|
|
@@ -59,7 +59,7 @@ class FiltersAction extends _base.BaseAction {
|
|
59
59
|
redo(hot, redoneCallback) {
|
60
60
|
const filters = hot.getPlugin('filters');
|
61
61
|
hot.addHookOnce('afterViewRender', redoneCallback);
|
62
|
-
filters.
|
62
|
+
filters.importConditions(this.conditionsStack);
|
63
63
|
filters.filter();
|
64
64
|
}
|
65
65
|
}
|
@@ -17,7 +17,7 @@ export class FiltersAction extends BaseAction {
|
|
17
17
|
conditionsStack,
|
18
18
|
previousConditionsStack
|
19
19
|
} = _ref;
|
20
|
-
super();
|
20
|
+
super('filter');
|
21
21
|
/**
|
22
22
|
* @param {Array} previousConditionsStack An array of the previous filter conditions.
|
23
23
|
*/
|
@@ -45,7 +45,7 @@ export class FiltersAction extends BaseAction {
|
|
45
45
|
undo(hot, undoneCallback) {
|
46
46
|
const filters = hot.getPlugin('filters');
|
47
47
|
hot.addHookOnce('afterViewRender', undoneCallback);
|
48
|
-
filters.
|
48
|
+
filters.importConditions(this.previousConditionsStack);
|
49
49
|
filters.filter();
|
50
50
|
}
|
51
51
|
|
@@ -56,7 +56,7 @@ export class FiltersAction extends BaseAction {
|
|
56
56
|
redo(hot, redoneCallback) {
|
57
57
|
const filters = hot.getPlugin('filters');
|
58
58
|
hot.addHookOnce('afterViewRender', redoneCallback);
|
59
|
-
filters.
|
59
|
+
filters.importConditions(this.conditionsStack);
|
60
60
|
filters.filter();
|
61
61
|
}
|
62
62
|
}
|
@@ -18,7 +18,10 @@ class MergeCellsAction extends _base.BaseAction {
|
|
18
18
|
data,
|
19
19
|
cellRange
|
20
20
|
} = _ref;
|
21
|
-
super();
|
21
|
+
super('merge_cells');
|
22
|
+
/**
|
23
|
+
* @param {CellRange} cellRange The merged cell range.
|
24
|
+
*/
|
22
25
|
_defineProperty(this, "cellRange", void 0);
|
23
26
|
this.cellRange = cellRange;
|
24
27
|
this.data = data;
|
@@ -15,7 +15,10 @@ export class MergeCellsAction extends BaseAction {
|
|
15
15
|
data,
|
16
16
|
cellRange
|
17
17
|
} = _ref;
|
18
|
-
super();
|
18
|
+
super('merge_cells');
|
19
|
+
/**
|
20
|
+
* @param {CellRange} cellRange The merged cell range.
|
21
|
+
*/
|
19
22
|
_defineProperty(this, "cellRange", void 0);
|
20
23
|
this.cellRange = cellRange;
|
21
24
|
this.data = data;
|
@@ -24,13 +24,14 @@ class RemoveColumnAction extends _base.BaseAction {
|
|
24
24
|
index,
|
25
25
|
indexes,
|
26
26
|
data,
|
27
|
+
amount,
|
27
28
|
headers,
|
28
29
|
columnPositions,
|
29
30
|
rowPositions,
|
30
31
|
fixedColumnsStart,
|
31
32
|
removedCellMetas
|
32
33
|
} = _ref;
|
33
|
-
super();
|
34
|
+
super('remove_col');
|
34
35
|
/**
|
35
36
|
* @param {number} index The visual column index.
|
36
37
|
*/
|
@@ -70,7 +71,7 @@ class RemoveColumnAction extends _base.BaseAction {
|
|
70
71
|
this.index = index;
|
71
72
|
this.indexes = indexes;
|
72
73
|
this.data = data;
|
73
|
-
this.amount =
|
74
|
+
this.amount = amount;
|
74
75
|
this.headers = headers;
|
75
76
|
this.columnPositions = columnPositions.slice(0);
|
76
77
|
this.rowPositions = rowPositions.slice(0);
|
@@ -108,6 +109,7 @@ class RemoveColumnAction extends _base.BaseAction {
|
|
108
109
|
index: columnIndex,
|
109
110
|
indexes,
|
110
111
|
data: removedData,
|
112
|
+
amount,
|
111
113
|
headers,
|
112
114
|
columnPositions: columnsMap,
|
113
115
|
rowPositions: rowsMap,
|
@@ -21,13 +21,14 @@ export class RemoveColumnAction extends BaseAction {
|
|
21
21
|
index,
|
22
22
|
indexes,
|
23
23
|
data,
|
24
|
+
amount,
|
24
25
|
headers,
|
25
26
|
columnPositions,
|
26
27
|
rowPositions,
|
27
28
|
fixedColumnsStart,
|
28
29
|
removedCellMetas
|
29
30
|
} = _ref;
|
30
|
-
super();
|
31
|
+
super('remove_col');
|
31
32
|
/**
|
32
33
|
* @param {number} index The visual column index.
|
33
34
|
*/
|
@@ -67,7 +68,7 @@ export class RemoveColumnAction extends BaseAction {
|
|
67
68
|
this.index = index;
|
68
69
|
this.indexes = indexes;
|
69
70
|
this.data = data;
|
70
|
-
this.amount =
|
71
|
+
this.amount = amount;
|
71
72
|
this.headers = headers;
|
72
73
|
this.columnPositions = columnPositions.slice(0);
|
73
74
|
this.rowPositions = rowPositions.slice(0);
|
@@ -105,6 +106,7 @@ export class RemoveColumnAction extends BaseAction {
|
|
105
106
|
index: columnIndex,
|
106
107
|
indexes,
|
107
108
|
data: removedData,
|
109
|
+
amount,
|
108
110
|
headers,
|
109
111
|
columnPositions: columnsMap,
|
110
112
|
rowPositions: rowsMap,
|