handsontable 15.0.0 → 15.1.0-next-dfdf994-20250206
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 +54 -0
- 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 +8020 -6915
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +530 -528
- package/dist/handsontable.js +3827 -2902
- 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/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
@@ -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);
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
6
|
+
require("core-js/modules/esnext.iterator.every.js");
|
5
7
|
var _object = require("../../../helpers/object");
|
6
8
|
var _array = require("../../../helpers/array");
|
7
9
|
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; }
|
@@ -38,35 +40,20 @@ class AutofillCalculations {
|
|
38
40
|
this.mergedCellsCollection = this.plugin.mergedCellsCollection;
|
39
41
|
}
|
40
42
|
|
41
|
-
/**
|
42
|
-
* Correct the provided selection area, so it's not selecting only a part of a merged cell.
|
43
|
-
*
|
44
|
-
* @param {Array} selectionArea The selection to correct.
|
45
|
-
*/
|
46
|
-
correctSelectionAreaSize(selectionArea) {
|
47
|
-
if (selectionArea[0] === selectionArea[2] && selectionArea[1] === selectionArea[3]) {
|
48
|
-
const mergedCell = this.mergedCellsCollection.get(selectionArea[0], selectionArea[1]);
|
49
|
-
if (mergedCell) {
|
50
|
-
selectionArea[2] = selectionArea[0] + mergedCell.rowspan - 1;
|
51
|
-
selectionArea[3] = selectionArea[1] + mergedCell.colspan - 1;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
43
|
/**
|
57
44
|
* Get the direction of the autofill process.
|
58
45
|
*
|
59
|
-
* @param {Array}
|
60
|
-
* @param {Array}
|
46
|
+
* @param {Array} baseArea The selection area.
|
47
|
+
* @param {Array} fullArea The final area (base + drag).
|
61
48
|
* @returns {string} `up`, `down`, `left` or `right`.
|
62
49
|
*/
|
63
|
-
getDirection(
|
50
|
+
getDirection(baseArea, fullArea) {
|
64
51
|
let direction = null;
|
65
|
-
if (
|
52
|
+
if (fullArea[0] === baseArea[0] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
66
53
|
direction = 'down';
|
67
|
-
} else if (
|
54
|
+
} else if (fullArea[2] === baseArea[2] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
68
55
|
direction = 'up';
|
69
|
-
} else if (
|
56
|
+
} else if (fullArea[1] === baseArea[1] && fullArea[2] === baseArea[2]) {
|
70
57
|
direction = 'right';
|
71
58
|
} else {
|
72
59
|
direction = 'left';
|
@@ -78,20 +65,20 @@ class AutofillCalculations {
|
|
78
65
|
* Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells.
|
79
66
|
*
|
80
67
|
* @param {Array} baseArea The base selected area.
|
81
|
-
* @param {Array}
|
68
|
+
* @param {Array} fullArea The drag area.
|
82
69
|
* @param {string} dragDirection The autofill drag direction.
|
83
70
|
* @param {Array} foundMergedCells MergeCellCoords found in the base selection area.
|
84
71
|
* @returns {Array} The new drag area.
|
85
72
|
*/
|
86
|
-
snapDragArea(baseArea,
|
87
|
-
const newDragArea =
|
88
|
-
const fillSize = this.getAutofillSize(baseArea,
|
73
|
+
snapDragArea(baseArea, fullArea, dragDirection, foundMergedCells) {
|
74
|
+
const newDragArea = fullArea.slice(0);
|
75
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, dragDirection);
|
89
76
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
90
77
|
const verticalDirection = ['up', 'down'].indexOf(dragDirection) > -1;
|
91
78
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
92
79
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
93
80
|
const partials = fillSize - fulls;
|
94
|
-
const farthestCollection = this.getFarthestCollection(baseArea,
|
81
|
+
const farthestCollection = this.getFarthestCollection(baseArea, fullArea, dragDirection, foundMergedCells);
|
95
82
|
if (farthestCollection) {
|
96
83
|
if (dragDirection === 'down') {
|
97
84
|
const fill = farthestCollection.row + farthestCollection.rowspan - baseAreaStartRow - partials;
|
@@ -156,13 +143,13 @@ class AutofillCalculations {
|
|
156
143
|
*
|
157
144
|
* @private
|
158
145
|
* @param {Array} baseArea The base selection area.
|
159
|
-
* @param {Array}
|
146
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
160
147
|
* @param {string} direction The drag direction.
|
161
148
|
* @returns {number|null} The "length" (height or width, depending on the direction) of the drag.
|
162
149
|
*/
|
163
|
-
getAutofillSize(baseArea,
|
150
|
+
getAutofillSize(baseArea, fullArea, direction) {
|
164
151
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
165
|
-
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] =
|
152
|
+
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = fullArea;
|
166
153
|
switch (direction) {
|
167
154
|
case 'up':
|
168
155
|
return baseAreaStartRow - dragAreaStartRow;
|
@@ -182,22 +169,30 @@ class AutofillCalculations {
|
|
182
169
|
*
|
183
170
|
* @private
|
184
171
|
* @param {Array} baseArea The base selection area.
|
185
|
-
* @param {Array}
|
172
|
+
* @param {Array} fullArea The base selection area extended by the drag area.
|
186
173
|
* @param {string} direction Drag direction.
|
187
174
|
* @returns {Array|null} Array representing the drag area coordinates.
|
188
175
|
*/
|
189
|
-
getDragArea(baseArea,
|
176
|
+
getDragArea(baseArea, fullArea, direction) {
|
190
177
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
191
|
-
const [
|
178
|
+
const [fullAreaStartRow, fullAreaStartColumn, fullAreaEndRow, fullAreaEndColumn] = fullArea;
|
192
179
|
switch (direction) {
|
193
180
|
case 'up':
|
194
|
-
return [
|
181
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];
|
195
182
|
case 'down':
|
196
|
-
|
183
|
+
{
|
184
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
185
|
+
const rowShift = mergedCell ? mergedCell.rowspan - 1 : 0;
|
186
|
+
return [baseAreaEndRow + 1, baseAreaStartColumn, fullAreaEndRow + rowShift, baseAreaEndColumn];
|
187
|
+
}
|
197
188
|
case 'left':
|
198
|
-
return [
|
189
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];
|
199
190
|
case 'right':
|
200
|
-
|
191
|
+
{
|
192
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
193
|
+
const columnShift = mergedCell ? mergedCell.colspan - 1 : 0;
|
194
|
+
return [baseAreaStartRow, baseAreaEndColumn + columnShift, fullAreaEndRow, fullAreaEndColumn];
|
195
|
+
}
|
201
196
|
default:
|
202
197
|
return null;
|
203
198
|
}
|
@@ -208,17 +203,17 @@ class AutofillCalculations {
|
|
208
203
|
*
|
209
204
|
* @private
|
210
205
|
* @param {Array} baseArea The base selection area.
|
211
|
-
* @param {Array}
|
206
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
212
207
|
* @param {string} direction The drag direction.
|
213
208
|
* @param {Array} mergedCellArray Array of the merged cells found in the base area.
|
214
209
|
* @returns {MergedCellCoords|null}
|
215
210
|
*/
|
216
|
-
getFarthestCollection(baseArea,
|
211
|
+
getFarthestCollection(baseArea, fullArea, direction, mergedCellArray) {
|
217
212
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
218
213
|
const verticalDirection = ['up', 'down'].indexOf(direction) > -1;
|
219
214
|
const baseEnd = verticalDirection ? baseAreaEndRow : baseAreaEndColumn;
|
220
215
|
const baseStart = verticalDirection ? baseAreaStartRow : baseAreaStartColumn;
|
221
|
-
const fillSize = this.getAutofillSize(baseArea,
|
216
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, direction);
|
222
217
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
223
218
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
224
219
|
const partials = fillSize - fulls;
|
@@ -293,7 +288,7 @@ class AutofillCalculations {
|
|
293
288
|
rowspan: current.rowspan,
|
294
289
|
col: current.col,
|
295
290
|
colspan: current.colspan
|
296
|
-
});
|
291
|
+
}, true);
|
297
292
|
break;
|
298
293
|
case 'down':
|
299
294
|
this.plugin.mergedCellsCollection.add({
|
@@ -301,7 +296,7 @@ class AutofillCalculations {
|
|
301
296
|
rowspan: current.rowspan,
|
302
297
|
col: current.col,
|
303
298
|
colspan: current.colspan
|
304
|
-
});
|
299
|
+
}, true);
|
305
300
|
break;
|
306
301
|
case 'left':
|
307
302
|
this.plugin.mergedCellsCollection.add({
|
@@ -309,7 +304,7 @@ class AutofillCalculations {
|
|
309
304
|
rowspan: current.rowspan,
|
310
305
|
col: current.col - fillOffset,
|
311
306
|
colspan: current.colspan
|
312
|
-
});
|
307
|
+
}, true);
|
313
308
|
break;
|
314
309
|
case 'right':
|
315
310
|
this.plugin.mergedCellsCollection.add({
|
@@ -317,7 +312,7 @@ class AutofillCalculations {
|
|
317
312
|
rowspan: current.rowspan,
|
318
313
|
col: current.col + fillOffset,
|
319
314
|
colspan: current.colspan
|
320
|
-
});
|
315
|
+
}, true);
|
321
316
|
break;
|
322
317
|
default:
|
323
318
|
}
|
@@ -392,7 +387,28 @@ class AutofillCalculations {
|
|
392
387
|
const topLeft = this.plugin.hot._createCellCoords(dragAreaStartRow, dragAreaStartColumn);
|
393
388
|
const bottomRight = this.plugin.hot._createCellCoords(dragAreaEndRow, dragAreaEndColumn);
|
394
389
|
const dragRange = this.plugin.hot._createCellRange(topLeft, topLeft, bottomRight);
|
395
|
-
|
390
|
+
const mergedCellsWithPartials = this.mergedCellsCollection.getWithinRange(dragRange, true);
|
391
|
+
if (mergedCellsWithPartials.length === 0) {
|
392
|
+
return false;
|
393
|
+
}
|
394
|
+
const mergedCellsWithoutPartials = this.mergedCellsCollection.getWithinRange(dragRange, false);
|
395
|
+
if (mergedCellsWithoutPartials.length === 0) {
|
396
|
+
return true;
|
397
|
+
}
|
398
|
+
if (direction === 'up' || direction === 'down') {
|
399
|
+
return !mergedCellsWithoutPartials.every(_ref => {
|
400
|
+
let {
|
401
|
+
colspan
|
402
|
+
} = _ref;
|
403
|
+
return colspan === dragRange.getWidth();
|
404
|
+
});
|
405
|
+
}
|
406
|
+
return !mergedCellsWithoutPartials.every(_ref2 => {
|
407
|
+
let {
|
408
|
+
rowspan
|
409
|
+
} = _ref2;
|
410
|
+
return rowspan === dragRange.getHeight();
|
411
|
+
});
|
396
412
|
}
|
397
413
|
}
|
398
414
|
var _default = exports.default = AutofillCalculations;
|