handsontable 0.0.0-next-0306a1a-20240826 → 0.0.0-next-eaf150e-20240903
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/fullyVisibleColumns.js +126 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +122 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +119 -0
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +115 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +125 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +121 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +118 -0
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +114 -0
- package/3rdparty/walkontable/src/calculator/{renderAllColumns.js → calculationType/renderedAllColumns.js} +32 -9
- package/3rdparty/walkontable/src/calculator/{renderAllColumns.mjs → calculationType/renderedAllColumns.mjs} +31 -8
- package/3rdparty/walkontable/src/calculator/{renderAllRows.js → calculationType/renderedAllRows.js} +32 -9
- package/3rdparty/walkontable/src/calculator/{renderAllRows.mjs → calculationType/renderedAllRows.mjs} +31 -8
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +37 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +33 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +37 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +33 -0
- package/3rdparty/walkontable/src/calculator/index.js +18 -17
- package/3rdparty/walkontable/src/calculator/index.mjs +11 -6
- package/3rdparty/walkontable/src/calculator/viewportBase.js +92 -0
- package/3rdparty/walkontable/src/calculator/viewportBase.mjs +88 -0
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +51 -145
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +51 -145
- package/3rdparty/walkontable/src/calculator/viewportRows.js +59 -141
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +59 -141
- package/3rdparty/walkontable/src/index.js +2 -0
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +5 -11
- package/3rdparty/walkontable/src/table.mjs +5 -11
- package/3rdparty/walkontable/src/utils/column.js +2 -1
- package/3rdparty/walkontable/src/utils/column.mjs +2 -1
- package/3rdparty/walkontable/src/utils/columnStretching.js +10 -19
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +10 -19
- package/3rdparty/walkontable/src/viewport.js +35 -46
- package/3rdparty/walkontable/src/viewport.mjs +36 -47
- package/CHANGELOG.md +27 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -2
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +5 -6
- package/dataMap/metaManager/metaSchema.mjs +5 -6
- package/dist/handsontable.css +32 -20
- package/dist/handsontable.full.css +32 -20
- package/dist/handsontable.full.js +2741 -2091
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2742 -2092
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +32 -32
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
- package/helpers/a11y.js +2 -0
- package/helpers/a11y.mjs +1 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +1 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/autoRowSize/autoRowSize.js +1 -2
- package/plugins/autoRowSize/autoRowSize.mjs +1 -2
- package/plugins/columnSorting/columnSorting.js +10 -1
- package/plugins/columnSorting/columnSorting.mjs +10 -1
- package/plugins/contextMenu/menu/menuItemRenderer.js +3 -4
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +5 -6
- package/plugins/contextMenu/menu/positioner.js +4 -12
- package/plugins/contextMenu/menu/positioner.mjs +4 -12
- package/plugins/contextMenu/menu/utils.js +11 -0
- package/plugins/contextMenu/menu/utils.mjs +10 -0
- package/plugins/contextMenu/predefinedItems/alignment.js +67 -49
- package/plugins/contextMenu/predefinedItems/alignment.mjs +68 -50
- package/plugins/contextMenu/predefinedItems/readOnly.js +11 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +11 -0
- package/plugins/contextMenu/utils.js +26 -0
- package/plugins/contextMenu/utils.mjs +24 -0
- package/plugins/copyPaste/copyPaste.js +14 -14
- package/plugins/copyPaste/copyPaste.mjs +14 -14
- package/plugins/dropdownMenu/dropdownMenu.js +10 -4
- package/plugins/dropdownMenu/dropdownMenu.mjs +10 -4
- package/plugins/filters/component/condition.js +6 -1
- package/plugins/filters/component/condition.mjs +6 -1
- package/plugins/filters/component/value.js +6 -1
- package/plugins/filters/component/value.mjs +6 -1
- package/plugins/filters/conditionCollection.d.ts +4 -3
- package/plugins/filters/conditionCollection.js +26 -0
- package/plugins/filters/conditionCollection.mjs +26 -0
- package/plugins/filters/filters.js +2 -1
- package/plugins/filters/filters.mjs +2 -1
- package/plugins/filters/ui/multipleSelect.js +7 -9
- package/plugins/filters/ui/multipleSelect.mjs +7 -9
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +11 -9
- package/plugins/mergeCells/cellsCollection.mjs +12 -10
- package/plugins/undoRedo/undoRedo.js +9 -5
- package/plugins/undoRedo/undoRedo.mjs +9 -5
- package/shortcuts/utils.js +3 -1
- package/shortcuts/utils.mjs +3 -1
- package/utils/ghostTable.js +11 -9
- package/utils/ghostTable.mjs +12 -10
- package/3rdparty/walkontable/src/calculator/constants.js +0 -26
- package/3rdparty/walkontable/src/calculator/constants.mjs +0 -23
@@ -41,6 +41,13 @@ class ConditionCollection {
|
|
41
41
|
* @type {LinkedPhysicalIndexToValueMap}
|
42
42
|
*/
|
43
43
|
_defineProperty(this, "filteringStates", new IndexToValueMap());
|
44
|
+
/**
|
45
|
+
* Stores the previous state of the condition stack before the latest filter operation.
|
46
|
+
* This is used in the `beforeFilter` plugin to allow performing the undo operation.
|
47
|
+
*
|
48
|
+
* @type {null|Array}
|
49
|
+
*/
|
50
|
+
_defineProperty(this, "previousConditionStack", null);
|
44
51
|
this.hot = hot;
|
45
52
|
this.isMapRegistrable = isMapRegistrable;
|
46
53
|
if (this.isMapRegistrable === true) {
|
@@ -109,6 +116,13 @@ class ConditionCollection {
|
|
109
116
|
const localeForColumn = this.hot.getCellMeta(0, column).locale;
|
110
117
|
const args = arrayMap(conditionDefinition.args, v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
|
111
118
|
const name = conditionDefinition.name || conditionDefinition.command.key;
|
119
|
+
|
120
|
+
// If there's no previous condition stack defined (which means the condition stack was not cleared after the
|
121
|
+
// previous filter operation or that there was no filter operation performed yet), store the current conditions as
|
122
|
+
// the previous condition stack.
|
123
|
+
if (this.previousConditionStack === null) {
|
124
|
+
this.setPreviousConditionStack(this.exportAllConditions());
|
125
|
+
}
|
112
126
|
this.runLocalHooks('beforeAdd', column);
|
113
127
|
const columnType = this.getOperation(column);
|
114
128
|
if (columnType) {
|
@@ -237,6 +251,8 @@ class ConditionCollection {
|
|
237
251
|
* @fires ConditionCollection#afterRemove
|
238
252
|
*/
|
239
253
|
removeConditions(column) {
|
254
|
+
// Store the current conditions as the previous condition stack before it's cleared.
|
255
|
+
this.setPreviousConditionStack(this.exportAllConditions());
|
240
256
|
this.runLocalHooks('beforeRemove', column);
|
241
257
|
this.filteringStates.clearValue(column);
|
242
258
|
this.runLocalHooks('afterRemove', column);
|
@@ -270,6 +286,16 @@ class ConditionCollection {
|
|
270
286
|
return conditions.length > 0;
|
271
287
|
}
|
272
288
|
|
289
|
+
/**
|
290
|
+
* Updates the `previousConditionStack` property with the provided stack.
|
291
|
+
* It is used to store the current conditions before they are modified, allowing for undo operations.
|
292
|
+
*
|
293
|
+
* @param {Array|null} previousConditionStack The stack of previous conditions.
|
294
|
+
*/
|
295
|
+
setPreviousConditionStack(previousConditionStack) {
|
296
|
+
this.previousConditionStack = previousConditionStack;
|
297
|
+
}
|
298
|
+
|
273
299
|
/**
|
274
300
|
* Destroy object.
|
275
301
|
*/
|
@@ -483,7 +483,7 @@ class Filters extends _base.BasePlugin {
|
|
483
483
|
const needToFilter = !this.conditionCollection.isEmpty();
|
484
484
|
let visibleVisualRows = [];
|
485
485
|
const conditions = this.conditionCollection.exportAllConditions();
|
486
|
-
const allowFiltering = this.hot.runHooks('beforeFilter', conditions);
|
486
|
+
const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);
|
487
487
|
if (allowFiltering !== false) {
|
488
488
|
if (needToFilter) {
|
489
489
|
const trimmedRows = [];
|
@@ -508,6 +508,7 @@ class Filters extends _base.BasePlugin {
|
|
508
508
|
}
|
509
509
|
}
|
510
510
|
this.hot.runHooks('afterFilter', conditions);
|
511
|
+
this.conditionCollection.setPreviousConditionStack(null);
|
511
512
|
this.hot.view.adjustElementsSize();
|
512
513
|
this.hot.render();
|
513
514
|
if (this.hot.selection.isSelected()) {
|
@@ -477,7 +477,7 @@ export class Filters extends BasePlugin {
|
|
477
477
|
const needToFilter = !this.conditionCollection.isEmpty();
|
478
478
|
let visibleVisualRows = [];
|
479
479
|
const conditions = this.conditionCollection.exportAllConditions();
|
480
|
-
const allowFiltering = this.hot.runHooks('beforeFilter', conditions);
|
480
|
+
const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);
|
481
481
|
if (allowFiltering !== false) {
|
482
482
|
if (needToFilter) {
|
483
483
|
const trimmedRows = [];
|
@@ -502,6 +502,7 @@ export class Filters extends BasePlugin {
|
|
502
502
|
}
|
503
503
|
}
|
504
504
|
this.hot.runHooks('afterFilter', conditions);
|
505
|
+
this.conditionCollection.setPreviousConditionStack(null);
|
505
506
|
this.hot.view.adjustElementsSize();
|
506
507
|
this.hot.render();
|
507
508
|
if (this.hot.selection.isSelected()) {
|
@@ -128,10 +128,9 @@ class MultipleSelectUI extends _base.BaseUI {
|
|
128
128
|
* @param {Array} items Array of objects with `checked` and `label` property.
|
129
129
|
*/
|
130
130
|
setItems(items) {
|
131
|
+
var _classPrivateFieldGet2;
|
131
132
|
_classPrivateFieldSet(_items, this, items);
|
132
|
-
|
133
|
-
_classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
|
134
|
-
}
|
133
|
+
(_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
|
135
134
|
}
|
136
135
|
|
137
136
|
/**
|
@@ -223,13 +222,13 @@ class MultipleSelectUI extends _base.BaseUI {
|
|
223
222
|
this._element.appendChild(selectionControl.element);
|
224
223
|
this._element.appendChild(itemsBoxWrapper);
|
225
224
|
const hotInitializer = wrapper => {
|
225
|
+
var _classPrivateFieldGet3;
|
226
226
|
if (!this._element) {
|
227
227
|
return;
|
228
228
|
}
|
229
|
-
|
230
|
-
_classPrivateFieldGet(_itemsBox, this).destroy();
|
231
|
-
}
|
229
|
+
(_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
|
232
230
|
(0, _element.addClass)(wrapper, 'htUIMultipleSelectHot');
|
231
|
+
|
233
232
|
// Constructs and initializes a new Handsontable instance
|
234
233
|
_classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
|
235
234
|
data: _classPrivateFieldGet(_items, this),
|
@@ -323,9 +322,8 @@ class MultipleSelectUI extends _base.BaseUI {
|
|
323
322
|
* Destroy instance.
|
324
323
|
*/
|
325
324
|
destroy() {
|
326
|
-
|
327
|
-
|
328
|
-
}
|
325
|
+
var _classPrivateFieldGet4;
|
326
|
+
(_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
|
329
327
|
_classPrivateFieldGet(_searchInput, this).destroy();
|
330
328
|
_classPrivateFieldGet(_clearAllUI, this).destroy();
|
331
329
|
_classPrivateFieldGet(_selectAllUI, this).destroy();
|
@@ -123,10 +123,9 @@ export class MultipleSelectUI extends BaseUI {
|
|
123
123
|
* @param {Array} items Array of objects with `checked` and `label` property.
|
124
124
|
*/
|
125
125
|
setItems(items) {
|
126
|
+
var _classPrivateFieldGet2;
|
126
127
|
_classPrivateFieldSet(_items, this, items);
|
127
|
-
|
128
|
-
_classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
|
129
|
-
}
|
128
|
+
(_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
|
130
129
|
}
|
131
130
|
|
132
131
|
/**
|
@@ -218,13 +217,13 @@ export class MultipleSelectUI extends BaseUI {
|
|
218
217
|
this._element.appendChild(selectionControl.element);
|
219
218
|
this._element.appendChild(itemsBoxWrapper);
|
220
219
|
const hotInitializer = wrapper => {
|
220
|
+
var _classPrivateFieldGet3;
|
221
221
|
if (!this._element) {
|
222
222
|
return;
|
223
223
|
}
|
224
|
-
|
225
|
-
_classPrivateFieldGet(_itemsBox, this).destroy();
|
226
|
-
}
|
224
|
+
(_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
|
227
225
|
addClass(wrapper, 'htUIMultipleSelectHot');
|
226
|
+
|
228
227
|
// Constructs and initializes a new Handsontable instance
|
229
228
|
_classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
|
230
229
|
data: _classPrivateFieldGet(_items, this),
|
@@ -318,9 +317,8 @@ export class MultipleSelectUI extends BaseUI {
|
|
318
317
|
* Destroy instance.
|
319
318
|
*/
|
320
319
|
destroy() {
|
321
|
-
|
322
|
-
|
323
|
-
}
|
320
|
+
var _classPrivateFieldGet4;
|
321
|
+
(_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
|
324
322
|
_classPrivateFieldGet(_searchInput, this).destroy();
|
325
323
|
_classPrivateFieldGet(_clearAllUI, this).destroy();
|
326
324
|
_classPrivateFieldGet(_selectAllUI, this).destroy();
|
@@ -227,7 +227,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
227
227
|
*/
|
228
228
|
setManualSize(row, height) {
|
229
229
|
const physicalRow = this.hot.toPhysicalRow(row);
|
230
|
-
const newHeight = Math.max(height, _src.
|
230
|
+
const newHeight = Math.max(height, _src.DEFAULT_ROW_HEIGHT);
|
231
231
|
_classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
|
232
232
|
return newHeight;
|
233
233
|
}
|
@@ -11,7 +11,7 @@ import { addClass, closest, hasClass, removeClass, outerWidth, isDetached } from
|
|
11
11
|
import { arrayEach } from "../../helpers/array.mjs";
|
12
12
|
import { rangeEach } from "../../helpers/number.mjs";
|
13
13
|
import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
|
14
|
-
import {
|
14
|
+
import { DEFAULT_ROW_HEIGHT } from "../../3rdparty/walkontable/src/index.mjs"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
|
15
15
|
export const PLUGIN_KEY = 'manualRowResize';
|
16
16
|
export const PLUGIN_PRIORITY = 30;
|
17
17
|
const PERSISTENT_STATE_KEY = 'manualRowHeights';
|
@@ -222,7 +222,7 @@ export class ManualRowResize extends BasePlugin {
|
|
222
222
|
*/
|
223
223
|
setManualSize(row, height) {
|
224
224
|
const physicalRow = this.hot.toPhysicalRow(row);
|
225
|
-
const newHeight = Math.max(height,
|
225
|
+
const newHeight = Math.max(height, DEFAULT_ROW_HEIGHT);
|
226
226
|
_classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
|
227
227
|
return newHeight;
|
228
228
|
}
|
@@ -424,18 +424,20 @@ class MergedCellsCollection {
|
|
424
424
|
break;
|
425
425
|
default:
|
426
426
|
}
|
427
|
-
|
428
|
-
|
427
|
+
const removedMergedCells = [];
|
428
|
+
this.mergedCells.forEach(currentMerge => {
|
429
429
|
currentMerge.shift(shiftVector, index);
|
430
|
-
|
431
|
-
|
432
|
-
(0, _number.rangeEachReverse)(this.mergedCells.length - 1, 0, i => {
|
433
|
-
const currentMerge = this.mergedCells[i];
|
434
|
-
if (currentMerge && currentMerge.removed) {
|
435
|
-
this.mergedCells.splice(this.mergedCells.indexOf(currentMerge), 1);
|
436
|
-
_assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
|
430
|
+
if (currentMerge.removed) {
|
431
|
+
removedMergedCells.push(currentMerge);
|
437
432
|
}
|
438
433
|
});
|
434
|
+
removedMergedCells.forEach(removedMerge => {
|
435
|
+
this.mergedCells.splice(this.mergedCells.indexOf(removedMerge), 1);
|
436
|
+
});
|
437
|
+
this.mergedCellsMatrix.clear();
|
438
|
+
this.mergedCells.forEach(currentMerge => {
|
439
|
+
_assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, currentMerge);
|
440
|
+
});
|
439
441
|
}
|
440
442
|
|
441
443
|
/**
|
@@ -15,7 +15,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
15
15
|
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
16
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
17
17
|
import MergedCellCoords from "./cellCoords.mjs";
|
18
|
-
import { rangeEach
|
18
|
+
import { rangeEach } from "../../helpers/number.mjs";
|
19
19
|
import { warn } from "../../helpers/console.mjs";
|
20
20
|
import { arrayEach } from "../../helpers/array.mjs";
|
21
21
|
import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
|
@@ -420,18 +420,20 @@ class MergedCellsCollection {
|
|
420
420
|
break;
|
421
421
|
default:
|
422
422
|
}
|
423
|
-
|
424
|
-
|
423
|
+
const removedMergedCells = [];
|
424
|
+
this.mergedCells.forEach(currentMerge => {
|
425
425
|
currentMerge.shift(shiftVector, index);
|
426
|
-
|
427
|
-
|
428
|
-
rangeEachReverse(this.mergedCells.length - 1, 0, i => {
|
429
|
-
const currentMerge = this.mergedCells[i];
|
430
|
-
if (currentMerge && currentMerge.removed) {
|
431
|
-
this.mergedCells.splice(this.mergedCells.indexOf(currentMerge), 1);
|
432
|
-
_assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
|
426
|
+
if (currentMerge.removed) {
|
427
|
+
removedMergedCells.push(currentMerge);
|
433
428
|
}
|
434
429
|
});
|
430
|
+
removedMergedCells.forEach(removedMerge => {
|
431
|
+
this.mergedCells.splice(this.mergedCells.indexOf(removedMerge), 1);
|
432
|
+
});
|
433
|
+
this.mergedCellsMatrix.clear();
|
434
|
+
this.mergedCells.forEach(currentMerge => {
|
435
|
+
_assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, currentMerge);
|
436
|
+
});
|
435
437
|
}
|
436
438
|
|
437
439
|
/**
|
@@ -124,8 +124,8 @@ function UndoRedo(instance) {
|
|
124
124
|
instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
|
125
125
|
plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));
|
126
126
|
});
|
127
|
-
instance.addHook('beforeFilter', conditionsStack => {
|
128
|
-
plugin.done(() => new UndoRedo.FiltersAction(conditionsStack));
|
127
|
+
instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
|
128
|
+
plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));
|
129
129
|
});
|
130
130
|
instance.addHook('beforeRowMove', (rows, finalIndex) => {
|
131
131
|
if (rows === false) {
|
@@ -645,9 +645,11 @@ UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback
|
|
645
645
|
* Filters action.
|
646
646
|
*
|
647
647
|
* @private
|
648
|
-
* @param {Array} conditionsStack An array of the filter
|
648
|
+
* @param {Array} conditionsStack An array of the filter conditions.
|
649
|
+
* @param {Array} previousConditionsStack An array of the previous filter conditions.
|
649
650
|
*/
|
650
|
-
UndoRedo.FiltersAction = function (conditionsStack) {
|
651
|
+
UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
|
652
|
+
this.previousConditionsStack = previousConditionsStack;
|
651
653
|
this.conditionsStack = conditionsStack;
|
652
654
|
this.actionType = 'filter';
|
653
655
|
};
|
@@ -655,7 +657,9 @@ UndoRedo.FiltersAction = function (conditionsStack) {
|
|
655
657
|
UndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {
|
656
658
|
const filters = instance.getPlugin('filters');
|
657
659
|
instance.addHookOnce('afterViewRender', undoneCallback);
|
658
|
-
|
660
|
+
if (this.previousConditionsStack) {
|
661
|
+
filters.conditionCollection.importAllConditions(this.previousConditionsStack);
|
662
|
+
}
|
659
663
|
filters.filter();
|
660
664
|
};
|
661
665
|
UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
|
@@ -120,8 +120,8 @@ function UndoRedo(instance) {
|
|
120
120
|
instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
|
121
121
|
plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));
|
122
122
|
});
|
123
|
-
instance.addHook('beforeFilter', conditionsStack => {
|
124
|
-
plugin.done(() => new UndoRedo.FiltersAction(conditionsStack));
|
123
|
+
instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
|
124
|
+
plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));
|
125
125
|
});
|
126
126
|
instance.addHook('beforeRowMove', (rows, finalIndex) => {
|
127
127
|
if (rows === false) {
|
@@ -641,9 +641,11 @@ UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback
|
|
641
641
|
* Filters action.
|
642
642
|
*
|
643
643
|
* @private
|
644
|
-
* @param {Array} conditionsStack An array of the filter
|
644
|
+
* @param {Array} conditionsStack An array of the filter conditions.
|
645
|
+
* @param {Array} previousConditionsStack An array of the previous filter conditions.
|
645
646
|
*/
|
646
|
-
UndoRedo.FiltersAction = function (conditionsStack) {
|
647
|
+
UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
|
648
|
+
this.previousConditionsStack = previousConditionsStack;
|
647
649
|
this.conditionsStack = conditionsStack;
|
648
650
|
this.actionType = 'filter';
|
649
651
|
};
|
@@ -651,7 +653,9 @@ inherit(UndoRedo.FiltersAction, UndoRedo.Action);
|
|
651
653
|
UndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {
|
652
654
|
const filters = instance.getPlugin('filters');
|
653
655
|
instance.addHookOnce('afterViewRender', undoneCallback);
|
654
|
-
|
656
|
+
if (this.previousConditionsStack) {
|
657
|
+
filters.conditionCollection.importAllConditions(this.previousConditionsStack);
|
658
|
+
}
|
655
659
|
filters.filter();
|
656
660
|
};
|
657
661
|
UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
|
package/shortcuts/utils.js
CHANGED
@@ -36,7 +36,9 @@ const getKeysList = normalizedKeys => {
|
|
36
36
|
return normalizedKeys.split('+');
|
37
37
|
};
|
38
38
|
exports.getKeysList = getKeysList;
|
39
|
-
const specialCharactersSet = new Map([[
|
39
|
+
const specialCharactersSet = new Map([[96, 'numpad0'], [97, 'numpad1'], [98, 'numpad2'], [99, 'numpad3'], [100, 'numpad4'], [101, 'numpad5'], [102, 'numpad6'], [103, 'numpad7'], [104, 'numpad8'], [105, 'numpad9'], [106, 'multiply'], [107, 'add'], [108, 'decimal'],
|
40
|
+
// firefox
|
41
|
+
[109, 'subtract'], [110, 'decimal'], [111, 'divide'], [112, 'f1'], [113, 'f2'], [114, 'f3'], [115, 'f4'], [116, 'f5'], [117, 'f6'], [118, 'f7'], [119, 'f8'], [120, 'f9'], [121, 'f10'], [122, 'f11'], [123, 'f12'], [186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
|
40
42
|
|
41
43
|
/**
|
42
44
|
* Normalizes a keyboard event key value to a key before its modification.
|
package/shortcuts/utils.mjs
CHANGED
@@ -31,7 +31,9 @@ export const normalizeKeys = keys => {
|
|
31
31
|
export const getKeysList = normalizedKeys => {
|
32
32
|
return normalizedKeys.split('+');
|
33
33
|
};
|
34
|
-
const specialCharactersSet = new Map([[
|
34
|
+
const specialCharactersSet = new Map([[96, 'numpad0'], [97, 'numpad1'], [98, 'numpad2'], [99, 'numpad3'], [100, 'numpad4'], [101, 'numpad5'], [102, 'numpad6'], [103, 'numpad7'], [104, 'numpad8'], [105, 'numpad9'], [106, 'multiply'], [107, 'add'], [108, 'decimal'],
|
35
|
+
// firefox
|
36
|
+
[109, 'subtract'], [110, 'decimal'], [111, 'divide'], [112, 'f1'], [113, 'f2'], [114, 'f3'], [115, 'f4'], [116, 'f5'], [117, 'f6'], [118, 'f7'], [119, 'f8'], [120, 'f9'], [121, 'f10'], [122, 'f11'], [123, 'f12'], [186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
|
35
37
|
|
36
38
|
/**
|
37
39
|
* Normalizes a keyboard event key value to a key before its modification.
|
package/utils/ghostTable.js
CHANGED
@@ -148,8 +148,15 @@ class GhostTable {
|
|
148
148
|
this.injectTable();
|
149
149
|
}
|
150
150
|
(0, _array.arrayEach)(this.rows, row => {
|
151
|
+
// In cases when the cell's content produces the height with a decimal point, the height
|
152
|
+
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
153
|
+
// The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
|
154
|
+
const {
|
155
|
+
height
|
156
|
+
} = row.table.getBoundingClientRect();
|
157
|
+
|
151
158
|
// -1 <- reduce border-top from table
|
152
|
-
callback(row.row,
|
159
|
+
callback(row.row, Math.ceil(height) - 1);
|
153
160
|
});
|
154
161
|
}
|
155
162
|
|
@@ -163,14 +170,9 @@ class GhostTable {
|
|
163
170
|
this.injectTable();
|
164
171
|
}
|
165
172
|
(0, _array.arrayEach)(this.columns, column => {
|
166
|
-
//
|
167
|
-
//
|
168
|
-
//
|
169
|
-
// The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
|
170
|
-
// The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
|
171
|
-
// would cause the text to not fit in the cell, thus increasing the row height.
|
172
|
-
// That's why the `getBoundingClientRect` method is used. The method returns the number
|
173
|
-
// that is rounded up to make sure that there will be a space for the cell's content.
|
173
|
+
// In cases when the cell's content produces the width with a decimal point, the width
|
174
|
+
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
175
|
+
// The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
|
174
176
|
const {
|
175
177
|
width
|
176
178
|
} = column.table.getBoundingClientRect();
|
package/utils/ghostTable.mjs
CHANGED
@@ -3,7 +3,7 @@ import "core-js/modules/es.array.push.js";
|
|
3
3
|
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; }
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
5
5
|
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); }
|
6
|
-
import { addClass
|
6
|
+
import { addClass } from "./../helpers/dom/element.mjs";
|
7
7
|
import { arrayEach } from "./../helpers/array.mjs";
|
8
8
|
/**
|
9
9
|
* @class GhostTable
|
@@ -145,8 +145,15 @@ class GhostTable {
|
|
145
145
|
this.injectTable();
|
146
146
|
}
|
147
147
|
arrayEach(this.rows, row => {
|
148
|
+
// In cases when the cell's content produces the height with a decimal point, the height
|
149
|
+
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
150
|
+
// The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
|
151
|
+
const {
|
152
|
+
height
|
153
|
+
} = row.table.getBoundingClientRect();
|
154
|
+
|
148
155
|
// -1 <- reduce border-top from table
|
149
|
-
callback(row.row,
|
156
|
+
callback(row.row, Math.ceil(height) - 1);
|
150
157
|
});
|
151
158
|
}
|
152
159
|
|
@@ -160,14 +167,9 @@ class GhostTable {
|
|
160
167
|
this.injectTable();
|
161
168
|
}
|
162
169
|
arrayEach(this.columns, column => {
|
163
|
-
//
|
164
|
-
//
|
165
|
-
//
|
166
|
-
// The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
|
167
|
-
// The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
|
168
|
-
// would cause the text to not fit in the cell, thus increasing the row height.
|
169
|
-
// That's why the `getBoundingClientRect` method is used. The method returns the number
|
170
|
-
// that is rounded up to make sure that there will be a space for the cell's content.
|
170
|
+
// In cases when the cell's content produces the width with a decimal point, the width
|
171
|
+
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
172
|
+
// The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
|
171
173
|
const {
|
172
174
|
width
|
173
175
|
} = column.table.getBoundingClientRect();
|
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
/**
|
5
|
-
* Render type calculation calculates how many DOM nodes should be created and where placed
|
6
|
-
* based on `startRow` and `endRow` properties.
|
7
|
-
*
|
8
|
-
* @type {number}
|
9
|
-
*/
|
10
|
-
const RENDER_TYPE = exports.RENDER_TYPE = 1;
|
11
|
-
/**
|
12
|
-
* Fully visible type calculation calculates rows that are fully visible in the viewport.
|
13
|
-
* This type of calculation is used in scrolling by arrow keys navigation.
|
14
|
-
*
|
15
|
-
* @type {number}
|
16
|
-
*/
|
17
|
-
const FULLY_VISIBLE_TYPE = exports.FULLY_VISIBLE_TYPE = 2;
|
18
|
-
/**
|
19
|
-
* Partially visible type calculation calculates rows that are fully and partially visible in
|
20
|
-
* the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
|
21
|
-
* calculated in render calculator. If checking met the criteria slow render is
|
22
|
-
* performed (which render calculator with new data).
|
23
|
-
*
|
24
|
-
* @type {number}
|
25
|
-
*/
|
26
|
-
const PARTIALLY_VISIBLE_TYPE = exports.PARTIALLY_VISIBLE_TYPE = 3;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Render type calculation calculates how many DOM nodes should be created and where placed
|
3
|
-
* based on `startRow` and `endRow` properties.
|
4
|
-
*
|
5
|
-
* @type {number}
|
6
|
-
*/
|
7
|
-
export const RENDER_TYPE = 1;
|
8
|
-
/**
|
9
|
-
* Fully visible type calculation calculates rows that are fully visible in the viewport.
|
10
|
-
* This type of calculation is used in scrolling by arrow keys navigation.
|
11
|
-
*
|
12
|
-
* @type {number}
|
13
|
-
*/
|
14
|
-
export const FULLY_VISIBLE_TYPE = 2;
|
15
|
-
/**
|
16
|
-
* Partially visible type calculation calculates rows that are fully and partially visible in
|
17
|
-
* the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
|
18
|
-
* calculated in render calculator. If checking met the criteria slow render is
|
19
|
-
* performed (which render calculator with new data).
|
20
|
-
*
|
21
|
-
* @type {number}
|
22
|
-
*/
|
23
|
-
export const PARTIALLY_VISIBLE_TYPE = 3;
|