handsontable 0.0.0-next-b96fb9f-20231207 → 0.0.0-next-3d099da-20231208
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/index.js +6 -11
- package/3rdparty/walkontable/src/calculator/index.mjs +3 -5
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +122 -1
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +124 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -1
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -2
- package/3rdparty/walkontable/src/core/_base.js +12 -0
- package/3rdparty/walkontable/src/core/_base.mjs +12 -0
- package/3rdparty/walkontable/src/core/core.js +2 -0
- package/3rdparty/walkontable/src/core/core.mjs +2 -0
- package/3rdparty/walkontable/src/facade/core.js +9 -0
- package/3rdparty/walkontable/src/facade/core.mjs +9 -0
- package/3rdparty/walkontable/src/index.js +4 -3
- package/3rdparty/walkontable/src/index.mjs +2 -1
- package/3rdparty/walkontable/src/overlays.js +3 -0
- package/3rdparty/walkontable/src/overlays.mjs +4 -0
- package/3rdparty/walkontable/src/renderer/colGroup.js +0 -10
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +0 -10
- package/3rdparty/walkontable/src/renderer/rows.js +3 -4
- package/3rdparty/walkontable/src/renderer/rows.mjs +3 -4
- package/3rdparty/walkontable/src/selection/manager.js +1 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +1 -0
- package/3rdparty/walkontable/src/settings.js +0 -3
- package/3rdparty/walkontable/src/settings.mjs +0 -2
- package/3rdparty/walkontable/src/table.js +1 -0
- package/3rdparty/walkontable/src/table.mjs +1 -0
- package/3rdparty/walkontable/src/utils/column.js +12 -27
- package/3rdparty/walkontable/src/utils/column.mjs +12 -27
- package/3rdparty/walkontable/src/viewport.js +17 -22
- package/3rdparty/walkontable/src/viewport.mjs +18 -23
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core/focusCatcher/index.js +6 -44
- package/core/focusCatcher/index.mjs +6 -44
- package/core.js +11 -0
- package/core.mjs +11 -0
- package/dataMap/dataMap.js +0 -1
- package/dataMap/metaManager/metaSchema.js +2 -28
- package/dataMap/metaManager/metaSchema.mjs +2 -28
- package/dataMap/metaManager/mods/extendMetaProperties.js +0 -12
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +0 -12
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3903 -2640
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +70 -66
- package/dist/handsontable.js +3906 -2643
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +39 -35
- package/editorManager.js +4 -3
- package/editorManager.mjs +4 -3
- package/editors/autocompleteEditor/autocompleteEditor.js +2 -0
- package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -0
- package/editors/handsontableEditor/handsontableEditor.js +1 -0
- package/editors/handsontableEditor/handsontableEditor.mjs +1 -0
- package/editors/textEditor/textEditor.js +4 -0
- package/editors/textEditor/textEditor.mjs +4 -0
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +29 -6
- package/pluginHooks.js +123 -65
- package/pluginHooks.mjs +122 -62
- package/plugins/copyPaste/clipboardData/clipboardData.js +588 -0
- package/plugins/copyPaste/clipboardData/clipboardData.mjs +584 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.js +69 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +65 -0
- package/plugins/copyPaste/clipboardData/index.js +9 -0
- package/plugins/copyPaste/clipboardData/index.mjs +4 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.js +81 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +77 -0
- package/plugins/copyPaste/copyPaste.js +51 -129
- package/plugins/copyPaste/copyPaste.mjs +54 -132
- package/plugins/copyPaste/copyableRanges.js +7 -43
- package/plugins/copyPaste/copyableRanges.mjs +7 -42
- package/plugins/copyPaste/pasteEvent.mjs +1 -1
- package/plugins/customBorders/customBorders.js +5 -0
- package/plugins/customBorders/customBorders.mjs +5 -0
- package/plugins/customBorders/utils.js +1 -0
- package/plugins/customBorders/utils.mjs +1 -0
- package/plugins/filters/ui/radioInput.js +1 -1
- package/plugins/filters/ui/radioInput.mjs +1 -1
- package/plugins/formulas/formulas.js +2 -0
- package/plugins/formulas/formulas.mjs +2 -0
- package/plugins/formulas/indexSyncer/axisSyncer.js +1 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +1 -0
- package/plugins/manualColumnResize/manualColumnResize.js +1 -0
- package/plugins/manualColumnResize/manualColumnResize.mjs +1 -0
- package/plugins/mergeCells/mergeCells.js +127 -1
- package/plugins/mergeCells/mergeCells.mjs +127 -1
- package/plugins/nestedHeaders/nestedHeaders.js +87 -41
- package/plugins/nestedHeaders/nestedHeaders.mjs +88 -42
- package/plugins/nestedHeaders/stateManager/headersTree.js +1 -0
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +1 -0
- package/plugins/undoRedo/undoRedo.js +2 -0
- package/plugins/undoRedo/undoRedo.mjs +2 -0
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -0
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -0
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +2 -0
- package/selection/highlight/highlight.js +1 -0
- package/selection/highlight/highlight.mjs +1 -0
- package/selection/index.js +3 -1
- package/selection/index.mjs +2 -2
- package/selection/utils.js +34 -0
- package/selection/utils.mjs +33 -0
- package/settings.d.ts +0 -1
- package/tableView.js +2 -1
- package/tableView.mjs +2 -1
- package/translations/indexMapper.js +1 -2
- package/utils/parseTable.js +538 -84
- package/utils/parseTable.mjs +534 -83
- package/validators/timeValidator/timeValidator.js +1 -0
- package/validators/timeValidator/timeValidator.mjs +1 -0
- package/3rdparty/walkontable/src/calculator/renderAllColumns.js +0 -50
- package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +0 -46
- package/3rdparty/walkontable/src/calculator/renderAllRows.js +0 -50
- package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +0 -46
- package/3rdparty/walkontable/src/utils/columnStretching.js +0 -219
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +0 -215
- package/plugins/copyPaste/clipboardData.js +0 -18
- package/plugins/copyPaste/clipboardData.mjs +0 -14
@@ -17,10 +17,11 @@ import { isNumeric, clamp } from "../../helpers/number.mjs";
|
|
17
17
|
import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
|
18
18
|
import { isLeftClick, isRightClick } from "../../helpers/dom/event.mjs";
|
19
19
|
import { warn } from "../../helpers/console.mjs";
|
20
|
-
import { ACTIVE_HEADER_TYPE, HEADER_TYPE } from "../../selection/index.mjs";
|
20
|
+
import { ACTIVE_HEADER_TYPE, HEADER_TYPE, transformRangeLikeToIndexes } from "../../selection/index.mjs";
|
21
21
|
import { BasePlugin } from "../base/index.mjs";
|
22
22
|
import StateManager from "./stateManager/index.mjs";
|
23
23
|
import GhostTable from "./utils/ghostTable.mjs";
|
24
|
+
import { arrayEach } from "../../helpers/array.mjs";
|
24
25
|
export const PLUGIN_KEY = 'nestedHeaders';
|
25
26
|
export const PLUGIN_PRIORITY = 280;
|
26
27
|
|
@@ -97,6 +98,7 @@ export class NestedHeaders extends BasePlugin {
|
|
97
98
|
/**
|
98
99
|
* Updates the plugin state after new dataset load.
|
99
100
|
*
|
101
|
+
* @private
|
100
102
|
* @param {Array[]} sourceData Array of arrays or array of objects containing data.
|
101
103
|
* @param {boolean} initialLoad Flag that determines whether the data has been loaded
|
102
104
|
* during the initialization.
|
@@ -104,11 +106,14 @@ export class NestedHeaders extends BasePlugin {
|
|
104
106
|
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
105
107
|
/**
|
106
108
|
* Updates the plugin state after HoT initialization.
|
109
|
+
*
|
110
|
+
* @private
|
107
111
|
*/
|
108
112
|
_classPrivateMethodInitSpec(this, _onInit);
|
109
113
|
/**
|
110
114
|
* `modifyFocusedElement` hook callback.
|
111
115
|
*
|
116
|
+
* @private
|
112
117
|
* @param {number} row Row index.
|
113
118
|
* @param {number} column Column index.
|
114
119
|
* @returns {HTMLTableCellElement} The `TH` element to be focused.
|
@@ -118,6 +123,7 @@ export class NestedHeaders extends BasePlugin {
|
|
118
123
|
* Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
|
119
124
|
* the internal state and settings of the plugin.
|
120
125
|
*
|
126
|
+
* @private
|
121
127
|
* @param {string} value The column header value.
|
122
128
|
* @param {number} visualColumnIndex The visual column index.
|
123
129
|
* @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
|
@@ -130,6 +136,7 @@ export class NestedHeaders extends BasePlugin {
|
|
130
136
|
/**
|
131
137
|
* `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.
|
132
138
|
*
|
139
|
+
* @private
|
133
140
|
* @param {number} width Width from hook.
|
134
141
|
* @param {number} column Visual index of an column.
|
135
142
|
* @returns {number}
|
@@ -138,12 +145,14 @@ export class NestedHeaders extends BasePlugin {
|
|
138
145
|
/**
|
139
146
|
* Make the renderer render the first nested column in its entirety.
|
140
147
|
*
|
148
|
+
* @private
|
141
149
|
* @param {object} calc Viewport column calculator.
|
142
150
|
*/
|
143
151
|
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
144
152
|
/**
|
145
153
|
* `afterGetColumnHeader` hook callback - prepares the header structure.
|
146
154
|
*
|
155
|
+
* @private
|
147
156
|
* @param {Array} renderersArray Array of renderers.
|
148
157
|
*/
|
149
158
|
_classPrivateMethodInitSpec(this, _onAfterGetColumnHeaderRenderers);
|
@@ -151,6 +160,7 @@ export class NestedHeaders extends BasePlugin {
|
|
151
160
|
* The hook observes the column selection from the Selection API and modifies the column range to
|
152
161
|
* ensure that the whole nested column will be covered.
|
153
162
|
*
|
163
|
+
* @private
|
154
164
|
* @param {CellCoords} from The coords object where the selection starts.
|
155
165
|
* @param {CellCoords} to The coords object where the selection ends.
|
156
166
|
*/
|
@@ -158,21 +168,27 @@ export class NestedHeaders extends BasePlugin {
|
|
158
168
|
/**
|
159
169
|
* `modifyTransformStart` hook is called every time the keyboard navigation is used.
|
160
170
|
*
|
171
|
+
* @private
|
161
172
|
* @param {object} delta The transformation delta.
|
162
173
|
*/
|
163
174
|
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
164
175
|
/**
|
165
176
|
* The hook checks and ensures that the focus position that depends on the selected columns
|
166
177
|
* range is always positioned within the range.
|
178
|
+
*
|
179
|
+
* @private
|
167
180
|
*/
|
168
181
|
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
169
182
|
/**
|
170
183
|
* Switches internal flag about selection progress to `false`.
|
184
|
+
*
|
185
|
+
* @private
|
171
186
|
*/
|
172
187
|
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseUp);
|
173
188
|
/**
|
174
189
|
* Makes the header-selection properly select the nested headers.
|
175
190
|
*
|
191
|
+
* @private
|
176
192
|
* @param {MouseEvent} event Mouse event.
|
177
193
|
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
178
194
|
* @param {HTMLElement} TD The cell element.
|
@@ -183,6 +199,7 @@ export class NestedHeaders extends BasePlugin {
|
|
183
199
|
/**
|
184
200
|
* Allows to control how the column selection based on the coordinates and the nested headers is made.
|
185
201
|
*
|
202
|
+
* @private
|
186
203
|
* @param {MouseEvent} event Mouse event.
|
187
204
|
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
188
205
|
*/
|
@@ -190,6 +207,7 @@ export class NestedHeaders extends BasePlugin {
|
|
190
207
|
/**
|
191
208
|
* Allows blocking the column selection that is controlled by the core Selection module.
|
192
209
|
*
|
210
|
+
* @private
|
193
211
|
* @param {MouseEvent} event Mouse event.
|
194
212
|
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
195
213
|
* @param {CellCoords} TD The table cell or header element.
|
@@ -203,16 +221,23 @@ export class NestedHeaders extends BasePlugin {
|
|
203
221
|
* of the column.
|
204
222
|
*
|
205
223
|
* @private
|
206
|
-
* @param {
|
207
|
-
* @param {
|
208
|
-
*
|
209
|
-
* @param {
|
210
|
-
*
|
224
|
+
* @param {object} clipboardData Information about already performed copy action.
|
225
|
+
* @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
|
226
|
+
* @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
|
227
|
+
* @param {Function} clipboardData.insertAtRow Insert values at row index.
|
228
|
+
* @param {Function} clipboardData.insertAtColumn Insert values at column index.
|
229
|
+
* @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
|
230
|
+
* @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
|
231
|
+
* @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
|
232
|
+
* @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
|
233
|
+
* @param {Function} clipboardData.setMetaInfo Sets grid settings for copied data.
|
234
|
+
* @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
|
211
235
|
*/
|
212
236
|
_classPrivateMethodInitSpec(this, _onBeforeCopy);
|
213
237
|
/**
|
214
238
|
* Allows to control which header DOM element will be used to highlight.
|
215
239
|
*
|
240
|
+
* @private
|
216
241
|
* @param {number} visualColumn A visual column index of the highlighted row header.
|
217
242
|
* @param {number} headerLevel A row header level that is currently highlighted.
|
218
243
|
* @param {object} highlightMeta An object with meta data that describes the highlight state.
|
@@ -224,6 +249,7 @@ export class NestedHeaders extends BasePlugin {
|
|
224
249
|
* is scrolled to the correct column for the nested header the most left and the most right visual column
|
225
250
|
* indexes are used.
|
226
251
|
*
|
252
|
+
* @private
|
227
253
|
* @param {number} visualColumn A visual column index to which the viewport will be scrolled.
|
228
254
|
* @returns {number}
|
229
255
|
*/
|
@@ -231,6 +257,8 @@ export class NestedHeaders extends BasePlugin {
|
|
231
257
|
/**
|
232
258
|
* Updates the selection focus highlight position to point to the nested header root element (TH)
|
233
259
|
* even when the logical coordinates point in-between the header.
|
260
|
+
*
|
261
|
+
* @private
|
234
262
|
*/
|
235
263
|
_classPrivateMethodInitSpec(this, _updateFocusHighlightPosition);
|
236
264
|
/**
|
@@ -721,42 +749,60 @@ function _onBeforeHighlightingColumnHeader2(visualColumn, headerLevel, highlight
|
|
721
749
|
}
|
722
750
|
return visualColumn;
|
723
751
|
}
|
724
|
-
function _onBeforeCopy2(
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
const
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
752
|
+
function _onBeforeCopy2(clipboardData) {
|
753
|
+
const {
|
754
|
+
rows,
|
755
|
+
columns
|
756
|
+
} = transformRangeLikeToIndexes(clipboardData.getRanges());
|
757
|
+
const headers = rows.filter(row => row < 0);
|
758
|
+
const nestedHeaders = [];
|
759
|
+
headers.forEach(header => {
|
760
|
+
const headersForLevel = [];
|
761
|
+
arrayEach(columns, (column, index) => {
|
762
|
+
const headerSettings = this.getHeaderSettings(header, column);
|
763
|
+
if (headerSettings === null) {
|
764
|
+
headersForLevel.push(this.hot.getColHeader(column, header));
|
765
|
+
return;
|
766
|
+
}
|
767
|
+
const {
|
768
|
+
isPlaceholder
|
769
|
+
} = headerSettings;
|
770
|
+
const columnsToEnd = columns.slice(index).length;
|
771
|
+
const headerTreeNodeData = this.getStateManager().getHeaderTreeNodeData(header, column);
|
772
|
+
if (index === 0 && isPlaceholder === true) {
|
773
|
+
const {
|
774
|
+
label,
|
775
|
+
origColspan: colspan,
|
776
|
+
columnIndex
|
777
|
+
} = headerTreeNodeData;
|
778
|
+
const columnFromStart = column - columnIndex;
|
779
|
+
const reducedColspan = Math.min(colspan - columnFromStart, columnsToEnd);
|
780
|
+
if (reducedColspan > 1) {
|
781
|
+
headersForLevel.push({
|
782
|
+
label,
|
783
|
+
colspan: reducedColspan
|
784
|
+
});
|
785
|
+
} else {
|
786
|
+
headersForLevel.push(label);
|
756
787
|
}
|
788
|
+
} else if (isPlaceholder === false) {
|
789
|
+
const {
|
790
|
+
label,
|
791
|
+
origColspan: colspan,
|
792
|
+
columnIndex
|
793
|
+
} = headerTreeNodeData;
|
794
|
+
const columnFromStart = column - columnIndex;
|
795
|
+
const reducedColspan = Math.min(colspan - columnFromStart, columnsToEnd);
|
796
|
+
headersForLevel.push(reducedColspan > 1 ? {
|
797
|
+
label,
|
798
|
+
colspan: reducedColspan
|
799
|
+
} : label);
|
757
800
|
}
|
758
|
-
}
|
759
|
-
|
801
|
+
});
|
802
|
+
nestedHeaders.push(headersForLevel);
|
803
|
+
});
|
804
|
+
clipboardData.setMetaInfo('colHeaders', null);
|
805
|
+
clipboardData.setMetaInfo('nestedHeaders', nestedHeaders);
|
760
806
|
}
|
761
807
|
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
762
808
|
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
@@ -959,10 +1005,10 @@ function _onModifyColWidth2(width, column) {
|
|
959
1005
|
return width > cachedWidth ? width : cachedWidth;
|
960
1006
|
}
|
961
1007
|
function _onModifyColumnHeaderValue2(value, visualColumnIndex, headerLevel) {
|
962
|
-
var
|
1008
|
+
var _classPrivateFieldGet4;
|
963
1009
|
const {
|
964
1010
|
label
|
965
|
-
} = (
|
1011
|
+
} = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet4 !== void 0 ? _classPrivateFieldGet4 : {
|
966
1012
|
label: ''
|
967
1013
|
};
|
968
1014
|
return label;
|
@@ -396,6 +396,7 @@ UndoRedo.CreateRowAction.prototype.undo = function (instance, undoneCallback) {
|
|
396
396
|
if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
|
397
397
|
this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
|
398
398
|
}
|
399
|
+
|
399
400
|
instance.addHookOnce('afterRemoveRow', undoneCallback);
|
400
401
|
instance.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
|
401
402
|
};
|
@@ -715,6 +716,7 @@ UndoRedo.prototype.registerShortcuts = function () {
|
|
715
716
|
const runOnlyIf = event => {
|
716
717
|
return !event.altKey; // right ALT in some systems triggers ALT+CTR
|
717
718
|
};
|
719
|
+
|
718
720
|
const config = {
|
719
721
|
runOnlyIf,
|
720
722
|
group: SHORTCUTS_GROUP
|
@@ -392,6 +392,7 @@ UndoRedo.CreateRowAction.prototype.undo = function (instance, undoneCallback) {
|
|
392
392
|
if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
|
393
393
|
this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
|
394
394
|
}
|
395
|
+
|
395
396
|
instance.addHookOnce('afterRemoveRow', undoneCallback);
|
396
397
|
instance.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
|
397
398
|
};
|
@@ -711,6 +712,7 @@ UndoRedo.prototype.registerShortcuts = function () {
|
|
711
712
|
const runOnlyIf = event => {
|
712
713
|
return !event.altKey; // right ALT in some systems triggers ALT+CTR
|
713
714
|
};
|
715
|
+
|
714
716
|
const config = {
|
715
717
|
runOnlyIf,
|
716
718
|
group: SHORTCUTS_GROUP
|
@@ -41,6 +41,7 @@ function autocompleteRenderer(hotInstance, TD, row, col, prop, value, cellProper
|
|
41
41
|
TD.appendChild(rootDocument.createTextNode(String.fromCharCode(160))); // workaround for https://github.com/handsontable/handsontable/issues/1946
|
42
42
|
// this is faster than innerHTML. See: https://github.com/handsontable/handsontable/wiki/JavaScript-&-DOM-performance-tips
|
43
43
|
}
|
44
|
+
|
44
45
|
TD.insertBefore(ARROW, TD.firstChild);
|
45
46
|
(0, _element.addClass)(TD, 'htAutocomplete');
|
46
47
|
if (!hotInstance.acArrowListener) {
|
@@ -36,6 +36,7 @@ export function autocompleteRenderer(hotInstance, TD, row, col, prop, value, cel
|
|
36
36
|
TD.appendChild(rootDocument.createTextNode(String.fromCharCode(160))); // workaround for https://github.com/handsontable/handsontable/issues/1946
|
37
37
|
// this is faster than innerHTML. See: https://github.com/handsontable/handsontable/wiki/JavaScript-&-DOM-performance-tips
|
38
38
|
}
|
39
|
+
|
39
40
|
TD.insertBefore(ARROW, TD.firstChild);
|
40
41
|
addClass(TD, 'htAutocomplete');
|
41
42
|
if (!hotInstance.acArrowListener) {
|
@@ -153,6 +153,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
|
|
153
153
|
changeSelectedCheckboxesState();
|
154
154
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
155
155
|
},
|
156
|
+
|
156
157
|
runOnlyIf: () => hotInstance.getSettings().enterBeginsEditing
|
157
158
|
}, {
|
158
159
|
keys: [['delete'], ['backspace']],
|
@@ -160,6 +161,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
|
|
160
161
|
changeSelectedCheckboxesState(true);
|
161
162
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
162
163
|
},
|
164
|
+
|
163
165
|
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
164
166
|
position: 'before'
|
165
167
|
}], config);
|
@@ -148,6 +148,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
|
|
148
148
|
changeSelectedCheckboxesState();
|
149
149
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
150
150
|
},
|
151
|
+
|
151
152
|
runOnlyIf: () => hotInstance.getSettings().enterBeginsEditing
|
152
153
|
}, {
|
153
154
|
keys: [['delete'], ['backspace']],
|
@@ -155,6 +156,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
|
|
155
156
|
changeSelectedCheckboxesState(true);
|
156
157
|
return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
|
157
158
|
},
|
159
|
+
|
158
160
|
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
159
161
|
position: 'before'
|
160
162
|
}], config);
|
@@ -178,6 +178,7 @@ class Highlight {
|
|
178
178
|
if (highlightType === _src.HIGHLIGHT_FOCUS_TYPE) {
|
179
179
|
type = 'current'; // One from settings for `disableVisualSelection` up to Handsontable 0.36/Handsontable Pro 1.16.0.
|
180
180
|
}
|
181
|
+
|
181
182
|
let disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
182
183
|
if (typeof disableHighlight === 'string') {
|
183
184
|
disableHighlight = [disableHighlight];
|
@@ -169,6 +169,7 @@ class Highlight {
|
|
169
169
|
if (highlightType === HIGHLIGHT_FOCUS_TYPE) {
|
170
170
|
type = 'current'; // One from settings for `disableVisualSelection` up to Handsontable 0.36/Handsontable Pro 1.16.0.
|
171
171
|
}
|
172
|
+
|
172
173
|
let disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
173
174
|
if (typeof disableHighlight === 'string') {
|
174
175
|
disableHighlight = [disableHighlight];
|
package/selection/index.js
CHANGED
@@ -5,7 +5,8 @@ var _exportNames = {
|
|
5
5
|
Selection: true,
|
6
6
|
handleMouseEvent: true,
|
7
7
|
detectSelectionType: true,
|
8
|
-
normalizeSelectionFactory: true
|
8
|
+
normalizeSelectionFactory: true,
|
9
|
+
transformRangeLikeToIndexes: true
|
9
10
|
};
|
10
11
|
var _selection = _interopRequireDefault(require("./selection"));
|
11
12
|
exports.Selection = _selection.default;
|
@@ -14,6 +15,7 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
|
|
14
15
|
var _utils = require("./utils");
|
15
16
|
exports.detectSelectionType = _utils.detectSelectionType;
|
16
17
|
exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
|
18
|
+
exports.transformRangeLikeToIndexes = _utils.transformRangeLikeToIndexes;
|
17
19
|
var _highlight = require("./highlight/highlight");
|
18
20
|
Object.keys(_highlight).forEach(function (key) {
|
19
21
|
if (key === "default" || key === "__esModule") return;
|
package/selection/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import Selection from "./selection.mjs";
|
2
2
|
import { handleMouseEvent } from "./mouseEventHandler.mjs";
|
3
|
-
import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
|
3
|
+
import { detectSelectionType, normalizeSelectionFactory, transformRangeLikeToIndexes } from "./utils.mjs";
|
4
4
|
export * from "./highlight/highlight.mjs";
|
5
|
-
export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory };
|
5
|
+
export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory, transformRangeLikeToIndexes };
|
package/selection/utils.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.detectSelectionType = detectSelectionType;
|
5
5
|
exports.normalizeSelectionFactory = normalizeSelectionFactory;
|
6
|
+
exports.transformRangeLikeToIndexes = transformRangeLikeToIndexes;
|
6
7
|
exports.transformSelectionToColumnDistance = transformSelectionToColumnDistance;
|
7
8
|
exports.transformSelectionToRowDistance = transformSelectionToRowDistance;
|
8
9
|
require("core-js/modules/es.error.cause.js");
|
@@ -10,6 +11,7 @@ require("core-js/modules/es.array.push.js");
|
|
10
11
|
var _src = require("./../3rdparty/walkontable/src");
|
11
12
|
var _array = require("./../helpers/array");
|
12
13
|
var _mixed = require("./../helpers/mixed");
|
14
|
+
var _number = require("../helpers/number");
|
13
15
|
const SELECTION_TYPE_UNRECOGNIZED = exports.SELECTION_TYPE_UNRECOGNIZED = 0;
|
14
16
|
const SELECTION_TYPE_EMPTY = exports.SELECTION_TYPE_EMPTY = 1;
|
15
17
|
const SELECTION_TYPE_ARRAY = exports.SELECTION_TYPE_ARRAY = 2;
|
@@ -215,4 +217,36 @@ function transformSelectionToRowDistance(hotInstance) {
|
|
215
217
|
return acc;
|
216
218
|
}, []);
|
217
219
|
return normalizedRowRanges;
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Returns an object with `rows` and `columns` keys. The arrays contains sorted indexes
|
224
|
+
* generated according to the given `ranges` array.
|
225
|
+
*
|
226
|
+
* @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges The range to process.
|
227
|
+
* @returns {{rows: number[], columns: number[]}}
|
228
|
+
*/
|
229
|
+
function transformRangeLikeToIndexes(ranges) {
|
230
|
+
const rows = [];
|
231
|
+
const columns = [];
|
232
|
+
(0, _array.arrayEach)(ranges, range => {
|
233
|
+
const minRow = Math.min(range.startRow, range.endRow);
|
234
|
+
const maxRow = Math.max(range.startRow, range.endRow);
|
235
|
+
(0, _number.rangeEach)(minRow, maxRow, row => {
|
236
|
+
if (rows.indexOf(row) === -1) {
|
237
|
+
rows.push(row);
|
238
|
+
}
|
239
|
+
});
|
240
|
+
const minColumn = Math.min(range.startCol, range.endCol);
|
241
|
+
const maxColumn = Math.max(range.startCol, range.endCol);
|
242
|
+
(0, _number.rangeEach)(minColumn, maxColumn, column => {
|
243
|
+
if (columns.indexOf(column) === -1) {
|
244
|
+
columns.push(column);
|
245
|
+
}
|
246
|
+
});
|
247
|
+
});
|
248
|
+
return {
|
249
|
+
rows,
|
250
|
+
columns
|
251
|
+
};
|
218
252
|
}
|
package/selection/utils.mjs
CHANGED
@@ -3,6 +3,7 @@ import "core-js/modules/es.array.push.js";
|
|
3
3
|
import { CellRange } from "./../3rdparty/walkontable/src/index.mjs";
|
4
4
|
import { arrayEach, arrayReduce } from "./../helpers/array.mjs";
|
5
5
|
import { isUndefined } from "./../helpers/mixed.mjs";
|
6
|
+
import { rangeEach } from "../helpers/number.mjs";
|
6
7
|
export const SELECTION_TYPE_UNRECOGNIZED = 0;
|
7
8
|
export const SELECTION_TYPE_EMPTY = 1;
|
8
9
|
export const SELECTION_TYPE_ARRAY = 2;
|
@@ -208,4 +209,36 @@ export function transformSelectionToRowDistance(hotInstance) {
|
|
208
209
|
return acc;
|
209
210
|
}, []);
|
210
211
|
return normalizedRowRanges;
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Returns an object with `rows` and `columns` keys. The arrays contains sorted indexes
|
216
|
+
* generated according to the given `ranges` array.
|
217
|
+
*
|
218
|
+
* @param {Array<{startRow: number, startCol: number, endRow: number, endCol: number}>} ranges The range to process.
|
219
|
+
* @returns {{rows: number[], columns: number[]}}
|
220
|
+
*/
|
221
|
+
export function transformRangeLikeToIndexes(ranges) {
|
222
|
+
const rows = [];
|
223
|
+
const columns = [];
|
224
|
+
arrayEach(ranges, range => {
|
225
|
+
const minRow = Math.min(range.startRow, range.endRow);
|
226
|
+
const maxRow = Math.max(range.startRow, range.endRow);
|
227
|
+
rangeEach(minRow, maxRow, row => {
|
228
|
+
if (rows.indexOf(row) === -1) {
|
229
|
+
rows.push(row);
|
230
|
+
}
|
231
|
+
});
|
232
|
+
const minColumn = Math.min(range.startCol, range.endCol);
|
233
|
+
const maxColumn = Math.max(range.startCol, range.endCol);
|
234
|
+
rangeEach(minColumn, maxColumn, column => {
|
235
|
+
if (columns.indexOf(column) === -1) {
|
236
|
+
columns.push(column);
|
237
|
+
}
|
238
|
+
});
|
239
|
+
});
|
240
|
+
return {
|
241
|
+
rows,
|
242
|
+
columns
|
243
|
+
};
|
211
244
|
}
|
package/settings.d.ts
CHANGED
@@ -181,7 +181,6 @@ export interface GridSettings extends Events {
|
|
181
181
|
preventWheel?: boolean;
|
182
182
|
readOnly?: boolean;
|
183
183
|
readOnlyCellClassName?: string;
|
184
|
-
renderAllColumns?: boolean;
|
185
184
|
renderAllRows?: boolean;
|
186
185
|
renderer?: RendererType | string | BaseRenderer;
|
187
186
|
rowHeaders?: boolean | string[] | ((index: number) => string);
|
package/tableView.js
CHANGED
@@ -280,6 +280,7 @@ class TableView {
|
|
280
280
|
if (originalStyle) {
|
281
281
|
rootElement.setAttribute('data-originalstyle', originalStyle); // needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions
|
282
282
|
}
|
283
|
+
|
283
284
|
(0, _element.addClass)(rootElement, 'handsontable');
|
284
285
|
_classPrivateFieldSet(this, _table, rootDocument.createElement('TABLE'));
|
285
286
|
(0, _element.addClass)(_classPrivateFieldGet(this, _table), 'htCore');
|
@@ -321,6 +322,7 @@ class TableView {
|
|
321
322
|
rootWindow.focus(); // make sure that window that contains HOT is active. Important when HOT is in iframe.
|
322
323
|
}
|
323
324
|
});
|
325
|
+
|
324
326
|
this.eventManager.addEventListener(rootElement, 'mouseup', () => {
|
325
327
|
_classPrivateFieldSet(this, _selectionMouseDown, false);
|
326
328
|
});
|
@@ -668,7 +670,6 @@ class TableView {
|
|
668
670
|
},
|
669
671
|
minSpareRows: () => this.settings.minSpareRows,
|
670
672
|
renderAllRows: this.settings.renderAllRows,
|
671
|
-
renderAllColumns: this.settings.renderAllColumns,
|
672
673
|
rowHeaders: () => {
|
673
674
|
const headerRenderers = [];
|
674
675
|
if (this.hot.hasRowHeaders()) {
|
package/tableView.mjs
CHANGED
@@ -276,6 +276,7 @@ class TableView {
|
|
276
276
|
if (originalStyle) {
|
277
277
|
rootElement.setAttribute('data-originalstyle', originalStyle); // needed to retrieve original style in jsFiddle link generator in HT examples. may be removed in future versions
|
278
278
|
}
|
279
|
+
|
279
280
|
addClass(rootElement, 'handsontable');
|
280
281
|
_classPrivateFieldSet(this, _table, rootDocument.createElement('TABLE'));
|
281
282
|
addClass(_classPrivateFieldGet(this, _table), 'htCore');
|
@@ -317,6 +318,7 @@ class TableView {
|
|
317
318
|
rootWindow.focus(); // make sure that window that contains HOT is active. Important when HOT is in iframe.
|
318
319
|
}
|
319
320
|
});
|
321
|
+
|
320
322
|
this.eventManager.addEventListener(rootElement, 'mouseup', () => {
|
321
323
|
_classPrivateFieldSet(this, _selectionMouseDown, false);
|
322
324
|
});
|
@@ -664,7 +666,6 @@ class TableView {
|
|
664
666
|
},
|
665
667
|
minSpareRows: () => this.settings.minSpareRows,
|
666
668
|
renderAllRows: this.settings.renderAllRows,
|
667
|
-
renderAllColumns: this.settings.renderAllColumns,
|
668
669
|
rowHeaders: () => {
|
669
670
|
const headerRenderers = [];
|
670
671
|
if (this.hot.hasRowHeaders()) {
|
@@ -17,8 +17,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
17
17
|
* A set of deprecated feature names.
|
18
18
|
*
|
19
19
|
* @type {Set<string>}
|
20
|
-
*/
|
21
|
-
// eslint-disable-next-line no-unused-vars
|
20
|
+
*/ // eslint-disable-next-line no-unused-vars
|
22
21
|
const deprecationWarns = new Set();
|
23
22
|
|
24
23
|
/**
|