handsontable 15.0.1-next-ab94a4c-20250207 → 15.1.0-next-5e493ee-20250207
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/index.js +2 -0
- package/3rdparty/walkontable/src/index.mjs +2 -1
- package/3rdparty/walkontable/src/overlays.js +2 -39
- package/3rdparty/walkontable/src/overlays.mjs +2 -39
- package/3rdparty/walkontable/src/renderer/_base.js +3 -4
- package/3rdparty/walkontable/src/renderer/_base.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/cells.js +7 -11
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -9
- package/3rdparty/walkontable/src/renderer/colGroup.js +6 -7
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +5 -5
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +4 -5
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +3 -3
- package/3rdparty/walkontable/src/renderer/index.js +18 -19
- package/3rdparty/walkontable/src/renderer/index.mjs +6 -6
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -7
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -5
- package/3rdparty/walkontable/src/renderer/rows.js +23 -11
- package/3rdparty/walkontable/src/renderer/rows.mjs +23 -10
- package/3rdparty/walkontable/src/renderer/table.js +1 -1
- package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
- package/3rdparty/walkontable/src/selection/border/border.js +10 -2
- package/3rdparty/walkontable/src/selection/border/border.mjs +10 -2
- package/3rdparty/walkontable/src/utils/nodesPool.js +21 -6
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +21 -6
- package/3rdparty/walkontable/src/utils/orderView/index.js +4 -5
- package/3rdparty/walkontable/src/utils/orderView/index.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/sharedView.js +3 -4
- package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.js +60 -76
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +59 -74
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.js +138 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.mjs +135 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +72 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +68 -0
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +4 -5
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +3 -3
- package/CHANGELOG.md +48 -2
- package/README.md +3 -3
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/dropdownType/dropdownType.js +4 -2
- package/cellTypes/dropdownType/dropdownType.mjs +4 -2
- package/core.js +39 -38
- package/core.mjs +36 -35
- package/dataMap/dataMap.js +8 -0
- package/dataMap/dataMap.mjs +8 -0
- package/dataMap/dataSource.js +4 -0
- package/dataMap/dataSource.mjs +4 -0
- package/dataMap/metaManager/lazyFactoryMap.js +8 -5
- package/dataMap/metaManager/lazyFactoryMap.mjs +8 -5
- package/dataMap/metaManager/metaSchema.js +24 -9
- package/dataMap/metaManager/metaSchema.mjs +24 -9
- package/dist/handsontable.css +6 -2
- package/dist/handsontable.full.css +6 -2
- package/dist/handsontable.full.js +8026 -6927
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +530 -528
- package/dist/handsontable.js +3833 -2914
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +35 -33
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -3
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -3
- package/editors/dateEditor/dateEditor.js +4 -0
- package/editors/dateEditor/dateEditor.mjs +4 -0
- package/editors/dropdownEditor/dropdownEditor.js +3 -16
- package/editors/dropdownEditor/dropdownEditor.mjs +3 -16
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/focusManager.js +1 -1
- package/focusManager.mjs +1 -1
- package/helpers/dom/element.d.ts +0 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/object.js +4 -0
- package/helpers/object.mjs +4 -0
- package/package.json +2 -2
- package/plugins/base/base.js +0 -7
- package/plugins/base/base.mjs +0 -7
- package/plugins/comments/comments.js +12 -3
- package/plugins/comments/comments.mjs +12 -3
- package/plugins/contextMenu/contextMenu.js +2 -7
- package/plugins/contextMenu/contextMenu.mjs +2 -7
- package/plugins/contextMenu/menu/menu.js +2 -2
- package/plugins/contextMenu/menu/menu.mjs +2 -2
- package/plugins/contextMenu/predefinedItems/clearColumn.js +15 -4
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +15 -4
- package/plugins/copyPaste/copyPaste.js +6 -12
- package/plugins/copyPaste/copyPaste.mjs +6 -12
- package/plugins/filters/conditionCollection.js +8 -7
- package/plugins/filters/conditionCollection.mjs +8 -7
- package/plugins/filters/filters.js +26 -16
- package/plugins/filters/filters.mjs +26 -16
- package/plugins/filters/utils.js +7 -24
- package/plugins/filters/utils.mjs +7 -24
- package/plugins/hiddenColumns/hiddenColumns.js +1 -3
- package/plugins/hiddenColumns/hiddenColumns.mjs +1 -3
- package/plugins/hiddenRows/hiddenRows.js +1 -3
- package/plugins/hiddenRows/hiddenRows.mjs +1 -3
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/mergeCells/calculations/autofill.js +60 -44
- package/plugins/mergeCells/calculations/autofill.mjs +60 -44
- package/plugins/mergeCells/cellsCollection.js +25 -8
- package/plugins/mergeCells/cellsCollection.mjs +25 -8
- package/plugins/mergeCells/mergeCells.js +15 -16
- package/plugins/mergeCells/mergeCells.mjs +15 -16
- package/plugins/nestedHeaders/nestedHeaders.js +6 -1
- package/plugins/nestedHeaders/nestedHeaders.mjs +6 -1
- package/plugins/nestedHeaders/stateManager/index.js +1 -2
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -2
- package/plugins/nestedHeaders/utils/ghostTable.js +4 -0
- package/plugins/nestedHeaders/utils/ghostTable.mjs +4 -0
- package/plugins/nestedRows/utils/rowMoveController.js +1 -6
- package/plugins/nestedRows/utils/rowMoveController.mjs +1 -6
- package/plugins/undoRedo/actions/_base.js +19 -0
- package/plugins/undoRedo/actions/_base.mjs +15 -0
- package/plugins/undoRedo/actions/cellAlignment.js +85 -0
- package/plugins/undoRedo/actions/cellAlignment.mjs +81 -0
- package/plugins/undoRedo/actions/columnMove.js +84 -0
- package/plugins/undoRedo/actions/columnMove.mjs +80 -0
- package/plugins/undoRedo/actions/columnSort.js +73 -0
- package/plugins/undoRedo/actions/columnSort.mjs +69 -0
- package/plugins/undoRedo/actions/createColumn.js +60 -0
- package/plugins/undoRedo/actions/createColumn.mjs +56 -0
- package/plugins/undoRedo/actions/createRow.js +65 -0
- package/plugins/undoRedo/actions/createRow.mjs +61 -0
- package/plugins/undoRedo/actions/dataChange.js +123 -0
- package/plugins/undoRedo/actions/dataChange.mjs +119 -0
- package/plugins/undoRedo/actions/filters.js +66 -0
- package/plugins/undoRedo/actions/filters.mjs +62 -0
- package/plugins/undoRedo/actions/index.js +27 -0
- package/plugins/undoRedo/actions/index.mjs +23 -0
- package/plugins/undoRedo/actions/mergeCells.js +63 -0
- package/plugins/undoRedo/actions/mergeCells.mjs +59 -0
- package/plugins/undoRedo/actions/removeColumn.js +176 -0
- package/plugins/undoRedo/actions/removeColumn.mjs +172 -0
- package/plugins/undoRedo/actions/removeRow.js +119 -0
- package/plugins/undoRedo/actions/removeRow.mjs +115 -0
- package/plugins/undoRedo/actions/rowMove.js +84 -0
- package/plugins/undoRedo/actions/rowMove.mjs +80 -0
- package/plugins/undoRedo/actions/unmergeCells.js +56 -0
- package/plugins/undoRedo/actions/unmergeCells.mjs +52 -0
- package/plugins/undoRedo/index.js +3 -4
- package/plugins/undoRedo/index.mjs +1 -2
- package/plugins/undoRedo/undoRedo.js +277 -879
- package/plugins/undoRedo/undoRedo.mjs +277 -880
- package/plugins/undoRedo/utils.js +37 -0
- package/plugins/undoRedo/utils.mjs +33 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +8 -1
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -1
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +1 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +1 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -1
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -1
- package/styles/handsontable.css +75 -103
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +2 -2
- package/styles/ht-theme-horizon.min.css +2 -2
- package/styles/ht-theme-main.css +2 -2
- package/styles/ht-theme-main.min.css +2 -2
- package/tableView.js +17 -1
- package/tableView.mjs +17 -1
- package/utils/autoResize.js +1 -1
- package/utils/autoResize.mjs +1 -1
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
@@ -4,9 +4,10 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
6
|
require("core-js/modules/esnext.iterator.constructor.js");
|
7
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
7
8
|
require("core-js/modules/esnext.iterator.map.js");
|
9
|
+
require("core-js/modules/esnext.iterator.reduce.js");
|
8
10
|
require("core-js/modules/esnext.iterator.some.js");
|
9
|
-
var _array = require("../../helpers/array");
|
10
11
|
var _object = require("../../helpers/object");
|
11
12
|
var _templateLiteralTag = require("../../helpers/templateLiteralTag");
|
12
13
|
var _localHooks = _interopRequireDefault(require("../../mixins/localHooks"));
|
@@ -121,7 +122,7 @@ class ConditionCollection {
|
|
121
122
|
let operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _conjunction.OPERATION_ID;
|
122
123
|
let position = arguments.length > 3 ? arguments[3] : undefined;
|
123
124
|
const localeForColumn = this.hot.getCellMeta(0, column).locale;
|
124
|
-
const args =
|
125
|
+
const args = conditionDefinition.args.map(v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
|
125
126
|
const name = conditionDefinition.name || conditionDefinition.command.key;
|
126
127
|
|
127
128
|
// If there's no previous condition stack defined (which means the condition stack was not cleared after the
|
@@ -215,7 +216,7 @@ class ConditionCollection {
|
|
215
216
|
* @returns {Array}
|
216
217
|
*/
|
217
218
|
exportAllConditions() {
|
218
|
-
return
|
219
|
+
return this.filteringStates.getEntries().reduce((allConditions, _ref2) => {
|
219
220
|
let [column, {
|
220
221
|
operation,
|
221
222
|
conditions
|
@@ -223,14 +224,14 @@ class ConditionCollection {
|
|
223
224
|
allConditions.push({
|
224
225
|
column,
|
225
226
|
operation,
|
226
|
-
conditions:
|
227
|
+
conditions: conditions.map(_ref3 => {
|
227
228
|
let {
|
228
229
|
name,
|
229
230
|
args
|
230
231
|
} = _ref3;
|
231
232
|
return {
|
232
233
|
name,
|
233
|
-
args
|
234
|
+
args: [...args]
|
234
235
|
};
|
235
236
|
})
|
236
237
|
});
|
@@ -245,8 +246,8 @@ class ConditionCollection {
|
|
245
246
|
*/
|
246
247
|
importAllConditions(conditions) {
|
247
248
|
this.clean();
|
248
|
-
|
249
|
-
|
249
|
+
conditions.forEach(stack => {
|
250
|
+
stack.conditions.forEach(condition => this.addCondition(stack.column, condition));
|
250
251
|
});
|
251
252
|
}
|
252
253
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
3
|
import "core-js/modules/esnext.iterator.constructor.js";
|
4
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
4
5
|
import "core-js/modules/esnext.iterator.map.js";
|
6
|
+
import "core-js/modules/esnext.iterator.reduce.js";
|
5
7
|
import "core-js/modules/esnext.iterator.some.js";
|
6
8
|
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; }
|
7
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
8
10
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
-
import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
|
10
11
|
import { mixin } from "../../helpers/object.mjs";
|
11
12
|
import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
|
12
13
|
import localHooks from "../../mixins/localHooks.mjs";
|
@@ -117,7 +118,7 @@ class ConditionCollection {
|
|
117
118
|
let operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OPERATION_AND;
|
118
119
|
let position = arguments.length > 3 ? arguments[3] : undefined;
|
119
120
|
const localeForColumn = this.hot.getCellMeta(0, column).locale;
|
120
|
-
const args =
|
121
|
+
const args = conditionDefinition.args.map(v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
|
121
122
|
const name = conditionDefinition.name || conditionDefinition.command.key;
|
122
123
|
|
123
124
|
// If there's no previous condition stack defined (which means the condition stack was not cleared after the
|
@@ -211,7 +212,7 @@ class ConditionCollection {
|
|
211
212
|
* @returns {Array}
|
212
213
|
*/
|
213
214
|
exportAllConditions() {
|
214
|
-
return
|
215
|
+
return this.filteringStates.getEntries().reduce((allConditions, _ref2) => {
|
215
216
|
let [column, {
|
216
217
|
operation,
|
217
218
|
conditions
|
@@ -219,14 +220,14 @@ class ConditionCollection {
|
|
219
220
|
allConditions.push({
|
220
221
|
column,
|
221
222
|
operation,
|
222
|
-
conditions:
|
223
|
+
conditions: conditions.map(_ref3 => {
|
223
224
|
let {
|
224
225
|
name,
|
225
226
|
args
|
226
227
|
} = _ref3;
|
227
228
|
return {
|
228
229
|
name,
|
229
|
-
args
|
230
|
+
args: [...args]
|
230
231
|
};
|
231
232
|
})
|
232
233
|
});
|
@@ -241,8 +242,8 @@ class ConditionCollection {
|
|
241
242
|
*/
|
242
243
|
importAllConditions(conditions) {
|
243
244
|
this.clean();
|
244
|
-
|
245
|
-
|
245
|
+
conditions.forEach(stack => {
|
246
|
+
stack.conditions.forEach(condition => this.addCondition(stack.column, condition));
|
246
247
|
});
|
247
248
|
}
|
248
249
|
|
@@ -101,8 +101,10 @@ class Filters extends _base.BasePlugin {
|
|
101
101
|
*/
|
102
102
|
|
103
103
|
constructor(hotInstance) {
|
104
|
-
|
104
|
+
var _this;
|
105
105
|
// One listener for the enable/disable functionality
|
106
|
+
super(hotInstance);
|
107
|
+
_this = this;
|
106
108
|
/**
|
107
109
|
* `afterChange` listener.
|
108
110
|
*
|
@@ -150,7 +152,12 @@ class Filters extends _base.BasePlugin {
|
|
150
152
|
* @type {WeakSet<Menu>}
|
151
153
|
*/
|
152
154
|
_classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());
|
153
|
-
this.hot.addHook('afterGetColHeader',
|
155
|
+
this.hot.addHook('afterGetColHeader', function () {
|
156
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
157
|
+
args[_key] = arguments[_key];
|
158
|
+
}
|
159
|
+
return _assertClassBrand(_Filters_brand, _this, _onAfterGetColHeader).call(_this, ...args);
|
160
|
+
});
|
154
161
|
}
|
155
162
|
|
156
163
|
/**
|
@@ -168,7 +175,7 @@ class Filters extends _base.BasePlugin {
|
|
168
175
|
* Enables the plugin functionality for this Handsontable instance.
|
169
176
|
*/
|
170
177
|
enablePlugin() {
|
171
|
-
var
|
178
|
+
var _this2 = this;
|
172
179
|
if (this.enabled) {
|
173
180
|
return;
|
174
181
|
}
|
@@ -231,10 +238,10 @@ class Filters extends _base.BasePlugin {
|
|
231
238
|
}
|
232
239
|
this.components.forEach(component => component.show());
|
233
240
|
this.addHook('afterDropdownMenuDefaultOptions', function () {
|
234
|
-
for (var
|
235
|
-
args[
|
241
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
242
|
+
args[_key2] = arguments[_key2];
|
236
243
|
}
|
237
|
-
return _assertClassBrand(_Filters_brand,
|
244
|
+
return _assertClassBrand(_Filters_brand, _this2, _onAfterDropdownMenuDefaultOptions).call(_this2, ...args);
|
238
245
|
});
|
239
246
|
this.addHook('beforeDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onBeforeDropdownMenuShow).call(this));
|
240
247
|
this.addHook('afterDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuShow).call(this));
|
@@ -689,6 +696,9 @@ class Filters extends _base.BasePlugin {
|
|
689
696
|
*
|
690
697
|
* @param {number} col Visual column index.
|
691
698
|
* @param {HTMLTableCellElement} TH Header's TH element.
|
699
|
+
* @param {number} headerLevel The index of header level counting from the top (positive
|
700
|
+
* values counting from 0 to N).
|
701
|
+
*
|
692
702
|
*/
|
693
703
|
|
694
704
|
/**
|
@@ -724,8 +734,8 @@ class Filters extends _base.BasePlugin {
|
|
724
734
|
return indexes;
|
725
735
|
}
|
726
736
|
const menu = this.dropdownMenuPlugin.menu;
|
727
|
-
for (var
|
728
|
-
components[
|
737
|
+
for (var _len3 = arguments.length, components = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
738
|
+
components[_key3] = arguments[_key3];
|
729
739
|
}
|
730
740
|
(0, _array.arrayEach)(components, component => {
|
731
741
|
(0, _array.arrayEach)(menu.menuItems, (item, index) => {
|
@@ -752,8 +762,8 @@ class Filters extends _base.BasePlugin {
|
|
752
762
|
const menu = this.dropdownMenuPlugin.menu;
|
753
763
|
const hotMenu = menu.hotMenu;
|
754
764
|
const hiddenRows = hotMenu.getPlugin('hiddenRows');
|
755
|
-
for (var
|
756
|
-
components[
|
765
|
+
for (var _len4 = arguments.length, components = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
766
|
+
components[_key4 - 1] = arguments[_key4];
|
757
767
|
}
|
758
768
|
const indexes = this.getIndexesOfComponents(...components);
|
759
769
|
if (visible) {
|
@@ -771,8 +781,8 @@ class Filters extends _base.BasePlugin {
|
|
771
781
|
* @param {...BaseComponent} components List of components.
|
772
782
|
*/
|
773
783
|
hideComponents() {
|
774
|
-
for (var
|
775
|
-
components[
|
784
|
+
for (var _len5 = arguments.length, components = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
785
|
+
components[_key5] = arguments[_key5];
|
776
786
|
}
|
777
787
|
this.changeComponentsVisibility(false, ...components);
|
778
788
|
}
|
@@ -784,8 +794,8 @@ class Filters extends _base.BasePlugin {
|
|
784
794
|
* @param {...BaseComponent} components List of components.
|
785
795
|
*/
|
786
796
|
showComponents() {
|
787
|
-
for (var
|
788
|
-
components[
|
797
|
+
for (var _len6 = arguments.length, components = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
798
|
+
components[_key6] = arguments[_key6];
|
789
799
|
}
|
790
800
|
this.changeComponentsVisibility(true, ...components);
|
791
801
|
}
|
@@ -913,9 +923,9 @@ function _onComponentChange(component, command) {
|
|
913
923
|
function _onSelectUIClosed() {
|
914
924
|
this.setListeningDropdownMenu();
|
915
925
|
}
|
916
|
-
function _onAfterGetColHeader(col, TH) {
|
926
|
+
function _onAfterGetColHeader(col, TH, headerLevel) {
|
917
927
|
const physicalColumn = this.hot.toPhysicalColumn(col);
|
918
|
-
if (this.enabled && this.conditionCollection.hasConditions(physicalColumn)) {
|
928
|
+
if (this.enabled && this.conditionCollection.hasConditions(physicalColumn) && headerLevel === this.hot.view.getColumnHeadersCount() - 1) {
|
919
929
|
(0, _element.addClass)(TH, 'htFiltersActive');
|
920
930
|
} else {
|
921
931
|
(0, _element.removeClass)(TH, 'htFiltersActive');
|
@@ -95,8 +95,10 @@ export class Filters extends BasePlugin {
|
|
95
95
|
*/
|
96
96
|
|
97
97
|
constructor(hotInstance) {
|
98
|
-
|
98
|
+
var _this;
|
99
99
|
// One listener for the enable/disable functionality
|
100
|
+
super(hotInstance);
|
101
|
+
_this = this;
|
100
102
|
/**
|
101
103
|
* `afterChange` listener.
|
102
104
|
*
|
@@ -144,7 +146,12 @@ export class Filters extends BasePlugin {
|
|
144
146
|
* @type {WeakSet<Menu>}
|
145
147
|
*/
|
146
148
|
_classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());
|
147
|
-
this.hot.addHook('afterGetColHeader',
|
149
|
+
this.hot.addHook('afterGetColHeader', function () {
|
150
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
151
|
+
args[_key] = arguments[_key];
|
152
|
+
}
|
153
|
+
return _assertClassBrand(_Filters_brand, _this, _onAfterGetColHeader).call(_this, ...args);
|
154
|
+
});
|
148
155
|
}
|
149
156
|
|
150
157
|
/**
|
@@ -162,7 +169,7 @@ export class Filters extends BasePlugin {
|
|
162
169
|
* Enables the plugin functionality for this Handsontable instance.
|
163
170
|
*/
|
164
171
|
enablePlugin() {
|
165
|
-
var
|
172
|
+
var _this2 = this;
|
166
173
|
if (this.enabled) {
|
167
174
|
return;
|
168
175
|
}
|
@@ -225,10 +232,10 @@ export class Filters extends BasePlugin {
|
|
225
232
|
}
|
226
233
|
this.components.forEach(component => component.show());
|
227
234
|
this.addHook('afterDropdownMenuDefaultOptions', function () {
|
228
|
-
for (var
|
229
|
-
args[
|
235
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
236
|
+
args[_key2] = arguments[_key2];
|
230
237
|
}
|
231
|
-
return _assertClassBrand(_Filters_brand,
|
238
|
+
return _assertClassBrand(_Filters_brand, _this2, _onAfterDropdownMenuDefaultOptions).call(_this2, ...args);
|
232
239
|
});
|
233
240
|
this.addHook('beforeDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onBeforeDropdownMenuShow).call(this));
|
234
241
|
this.addHook('afterDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuShow).call(this));
|
@@ -683,6 +690,9 @@ export class Filters extends BasePlugin {
|
|
683
690
|
*
|
684
691
|
* @param {number} col Visual column index.
|
685
692
|
* @param {HTMLTableCellElement} TH Header's TH element.
|
693
|
+
* @param {number} headerLevel The index of header level counting from the top (positive
|
694
|
+
* values counting from 0 to N).
|
695
|
+
*
|
686
696
|
*/
|
687
697
|
|
688
698
|
/**
|
@@ -718,8 +728,8 @@ export class Filters extends BasePlugin {
|
|
718
728
|
return indexes;
|
719
729
|
}
|
720
730
|
const menu = this.dropdownMenuPlugin.menu;
|
721
|
-
for (var
|
722
|
-
components[
|
731
|
+
for (var _len3 = arguments.length, components = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
732
|
+
components[_key3] = arguments[_key3];
|
723
733
|
}
|
724
734
|
arrayEach(components, component => {
|
725
735
|
arrayEach(menu.menuItems, (item, index) => {
|
@@ -746,8 +756,8 @@ export class Filters extends BasePlugin {
|
|
746
756
|
const menu = this.dropdownMenuPlugin.menu;
|
747
757
|
const hotMenu = menu.hotMenu;
|
748
758
|
const hiddenRows = hotMenu.getPlugin('hiddenRows');
|
749
|
-
for (var
|
750
|
-
components[
|
759
|
+
for (var _len4 = arguments.length, components = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
760
|
+
components[_key4 - 1] = arguments[_key4];
|
751
761
|
}
|
752
762
|
const indexes = this.getIndexesOfComponents(...components);
|
753
763
|
if (visible) {
|
@@ -765,8 +775,8 @@ export class Filters extends BasePlugin {
|
|
765
775
|
* @param {...BaseComponent} components List of components.
|
766
776
|
*/
|
767
777
|
hideComponents() {
|
768
|
-
for (var
|
769
|
-
components[
|
778
|
+
for (var _len5 = arguments.length, components = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
779
|
+
components[_key5] = arguments[_key5];
|
770
780
|
}
|
771
781
|
this.changeComponentsVisibility(false, ...components);
|
772
782
|
}
|
@@ -778,8 +788,8 @@ export class Filters extends BasePlugin {
|
|
778
788
|
* @param {...BaseComponent} components List of components.
|
779
789
|
*/
|
780
790
|
showComponents() {
|
781
|
-
for (var
|
782
|
-
components[
|
791
|
+
for (var _len6 = arguments.length, components = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
792
|
+
components[_key6] = arguments[_key6];
|
783
793
|
}
|
784
794
|
this.changeComponentsVisibility(true, ...components);
|
785
795
|
}
|
@@ -906,9 +916,9 @@ function _onComponentChange(component, command) {
|
|
906
916
|
function _onSelectUIClosed() {
|
907
917
|
this.setListeningDropdownMenu();
|
908
918
|
}
|
909
|
-
function _onAfterGetColHeader(col, TH) {
|
919
|
+
function _onAfterGetColHeader(col, TH, headerLevel) {
|
910
920
|
const physicalColumn = this.hot.toPhysicalColumn(col);
|
911
|
-
if (this.enabled && this.conditionCollection.hasConditions(physicalColumn)) {
|
921
|
+
if (this.enabled && this.conditionCollection.hasConditions(physicalColumn) && headerLevel === this.hot.view.getColumnHeadersCount() - 1) {
|
912
922
|
addClass(TH, 'htFiltersActive');
|
913
923
|
} else {
|
914
924
|
removeClass(TH, 'htFiltersActive');
|
package/plugins/filters/utils.js
CHANGED
@@ -15,8 +15,10 @@ require("core-js/modules/es.set.is-subset-of.v2.js");
|
|
15
15
|
require("core-js/modules/es.set.is-superset-of.v2.js");
|
16
16
|
require("core-js/modules/es.set.symmetric-difference.v2.js");
|
17
17
|
require("core-js/modules/es.set.union.v2.js");
|
18
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
19
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
20
|
+
require("core-js/modules/esnext.iterator.map.js");
|
18
21
|
var _feature = require("../../helpers/feature");
|
19
|
-
var _array = require("../../helpers/array");
|
20
22
|
const sortCompare = (0, _feature.getComparisonFunction)();
|
21
23
|
|
22
24
|
/**
|
@@ -47,8 +49,6 @@ function toVisualValue(value, defaultEmptyValue) {
|
|
47
49
|
}
|
48
50
|
return visualValue;
|
49
51
|
}
|
50
|
-
const SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1);
|
51
|
-
const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function';
|
52
52
|
|
53
53
|
/**
|
54
54
|
* Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf).
|
@@ -57,19 +57,9 @@ const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'fu
|
|
57
57
|
* @returns {Function}
|
58
58
|
*/
|
59
59
|
function createArrayAssertion(initialData) {
|
60
|
-
|
61
|
-
if (SUPPORT_SET_CONSTRUCTOR) {
|
62
|
-
dataset = new Set(dataset);
|
63
|
-
}
|
60
|
+
const dataset = new Set(initialData);
|
64
61
|
return function (value) {
|
65
|
-
|
66
|
-
if (SUPPORT_SET_CONSTRUCTOR) {
|
67
|
-
result = dataset.has(value);
|
68
|
-
} else {
|
69
|
-
/* eslint-disable no-bitwise */
|
70
|
-
result = !!~dataset.indexOf(value);
|
71
|
-
}
|
72
|
-
return result;
|
62
|
+
return dataset.has(value);
|
73
63
|
};
|
74
64
|
}
|
75
65
|
|
@@ -90,13 +80,7 @@ function toEmptyString(value) {
|
|
90
80
|
* @returns {Array}
|
91
81
|
*/
|
92
82
|
function unifyColumnValues(values) {
|
93
|
-
|
94
|
-
if (SUPPORT_FAST_DEDUPE) {
|
95
|
-
unifiedValues = Array.from(new Set(unifiedValues));
|
96
|
-
} else {
|
97
|
-
unifiedValues = (0, _array.arrayUnique)(unifiedValues);
|
98
|
-
}
|
99
|
-
unifiedValues = unifiedValues.sort((a, b) => {
|
83
|
+
return Array.from(new Set(values)).map(value => toEmptyString(value)).sort((a, b) => {
|
100
84
|
if (typeof a === 'number' && typeof b === 'number') {
|
101
85
|
return a - b;
|
102
86
|
}
|
@@ -105,7 +89,6 @@ function unifyColumnValues(values) {
|
|
105
89
|
}
|
106
90
|
return a > b ? 1 : -1;
|
107
91
|
});
|
108
|
-
return unifiedValues;
|
109
92
|
}
|
110
93
|
|
111
94
|
/**
|
@@ -124,7 +107,7 @@ function intersectValues(base, selected, defaultEmptyValue, callback) {
|
|
124
107
|
if (!same) {
|
125
108
|
selectedItemsAssertion = createArrayAssertion(selected);
|
126
109
|
}
|
127
|
-
|
110
|
+
base.forEach(value => {
|
128
111
|
let checked = false;
|
129
112
|
if (same || selectedItemsAssertion(value)) {
|
130
113
|
checked = true;
|
@@ -6,8 +6,10 @@ import "core-js/modules/es.set.is-subset-of.v2.js";
|
|
6
6
|
import "core-js/modules/es.set.is-superset-of.v2.js";
|
7
7
|
import "core-js/modules/es.set.symmetric-difference.v2.js";
|
8
8
|
import "core-js/modules/es.set.union.v2.js";
|
9
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
10
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
11
|
+
import "core-js/modules/esnext.iterator.map.js";
|
9
12
|
import { getComparisonFunction } from "../../helpers/feature.mjs";
|
10
|
-
import { arrayUnique, arrayEach } from "../../helpers/array.mjs";
|
11
13
|
const sortCompare = getComparisonFunction();
|
12
14
|
|
13
15
|
/**
|
@@ -38,8 +40,6 @@ export function toVisualValue(value, defaultEmptyValue) {
|
|
38
40
|
}
|
39
41
|
return visualValue;
|
40
42
|
}
|
41
|
-
const SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1);
|
42
|
-
const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function';
|
43
43
|
|
44
44
|
/**
|
45
45
|
* Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf).
|
@@ -48,19 +48,9 @@ const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'fu
|
|
48
48
|
* @returns {Function}
|
49
49
|
*/
|
50
50
|
export function createArrayAssertion(initialData) {
|
51
|
-
|
52
|
-
if (SUPPORT_SET_CONSTRUCTOR) {
|
53
|
-
dataset = new Set(dataset);
|
54
|
-
}
|
51
|
+
const dataset = new Set(initialData);
|
55
52
|
return function (value) {
|
56
|
-
|
57
|
-
if (SUPPORT_SET_CONSTRUCTOR) {
|
58
|
-
result = dataset.has(value);
|
59
|
-
} else {
|
60
|
-
/* eslint-disable no-bitwise */
|
61
|
-
result = !!~dataset.indexOf(value);
|
62
|
-
}
|
63
|
-
return result;
|
53
|
+
return dataset.has(value);
|
64
54
|
};
|
65
55
|
}
|
66
56
|
|
@@ -81,13 +71,7 @@ export function toEmptyString(value) {
|
|
81
71
|
* @returns {Array}
|
82
72
|
*/
|
83
73
|
export function unifyColumnValues(values) {
|
84
|
-
|
85
|
-
if (SUPPORT_FAST_DEDUPE) {
|
86
|
-
unifiedValues = Array.from(new Set(unifiedValues));
|
87
|
-
} else {
|
88
|
-
unifiedValues = arrayUnique(unifiedValues);
|
89
|
-
}
|
90
|
-
unifiedValues = unifiedValues.sort((a, b) => {
|
74
|
+
return Array.from(new Set(values)).map(value => toEmptyString(value)).sort((a, b) => {
|
91
75
|
if (typeof a === 'number' && typeof b === 'number') {
|
92
76
|
return a - b;
|
93
77
|
}
|
@@ -96,7 +80,6 @@ export function unifyColumnValues(values) {
|
|
96
80
|
}
|
97
81
|
return a > b ? 1 : -1;
|
98
82
|
});
|
99
|
-
return unifiedValues;
|
100
83
|
}
|
101
84
|
|
102
85
|
/**
|
@@ -115,7 +98,7 @@ export function intersectValues(base, selected, defaultEmptyValue, callback) {
|
|
115
98
|
if (!same) {
|
116
99
|
selectedItemsAssertion = createArrayAssertion(selected);
|
117
100
|
}
|
118
|
-
|
101
|
+
base.forEach(value => {
|
119
102
|
let checked = false;
|
120
103
|
if (same || selectedItemsAssertion(value)) {
|
121
104
|
checked = true;
|
@@ -368,9 +368,7 @@ class HiddenColumns extends _base.BasePlugin {
|
|
368
368
|
*/
|
369
369
|
resetCellsMeta() {
|
370
370
|
(0, _array.arrayEach)(this.hot.getCellsMeta(), meta => {
|
371
|
-
|
372
|
-
meta.skipColumnOnPaste = false;
|
373
|
-
}
|
371
|
+
meta.skipColumnOnPaste = false;
|
374
372
|
});
|
375
373
|
}
|
376
374
|
/**
|
@@ -555,7 +555,7 @@ function _onBeforeOnCellMouseDown(event, coords, TD, controller) {
|
|
555
555
|
_classPrivateFieldGet(_target, this).TD = TD;
|
556
556
|
_classPrivateFieldSet(_rowsToMove, this, this.prepareRowsToMoving());
|
557
557
|
const leftPos = wtTable.holder.scrollLeft + wtViewport.getRowHeaderWidth();
|
558
|
-
const topOffset = this.getRowsHeight(start, coords.row - 1) + event.
|
558
|
+
const topOffset = this.getRowsHeight(start, coords.row - 1) + (event.clientY - TD.getBoundingClientRect().top);
|
559
559
|
_classPrivateFieldGet(_backlight, this).setPosition(null, leftPos);
|
560
560
|
_classPrivateFieldGet(_backlight, this).setSize(wtTable.hider.offsetWidth - leftPos, this.getRowsHeight(start, end));
|
561
561
|
_classPrivateFieldGet(_backlight, this).setOffset(-topOffset, null);
|
@@ -550,7 +550,7 @@ function _onBeforeOnCellMouseDown(event, coords, TD, controller) {
|
|
550
550
|
_classPrivateFieldGet(_target, this).TD = TD;
|
551
551
|
_classPrivateFieldSet(_rowsToMove, this, this.prepareRowsToMoving());
|
552
552
|
const leftPos = wtTable.holder.scrollLeft + wtViewport.getRowHeaderWidth();
|
553
|
-
const topOffset = this.getRowsHeight(start, coords.row - 1) + event.
|
553
|
+
const topOffset = this.getRowsHeight(start, coords.row - 1) + (event.clientY - TD.getBoundingClientRect().top);
|
554
554
|
_classPrivateFieldGet(_backlight, this).setPosition(null, leftPos);
|
555
555
|
_classPrivateFieldGet(_backlight, this).setSize(wtTable.hider.offsetWidth - leftPos, this.getRowsHeight(start, end));
|
556
556
|
_classPrivateFieldGet(_backlight, this).setOffset(-topOffset, null);
|