handsontable 14.0.0-next-07c0a60-20231107 → 14.0.0-next-7ee54cb-20231108
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/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/cell/coords.js +7 -5
- package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +31 -26
- package/core.mjs +31 -26
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7337 -6394
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +154 -154
- package/dist/handsontable.js +7336 -6393
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +98 -102
- package/plugins/autofill/autofill.mjs +97 -101
- package/plugins/base/base.js +61 -28
- package/plugins/base/base.mjs +60 -28
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +107 -99
- package/plugins/columnSorting/columnSorting.mjs +106 -98
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +96 -102
- package/plugins/contextMenu/contextMenu.mjs +95 -101
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +57 -50
- package/plugins/customBorders/customBorders.mjs +56 -49
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +136 -131
- package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +328 -279
- package/plugins/nestedRows/nestedRows.mjs +327 -278
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/highlight/highlight.js +1 -4
- package/selection/highlight/highlight.mjs +1 -4
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +28 -10
- package/selection/selection.mjs +28 -10
- package/selection/utils.js +24 -14
- package/selection/utils.mjs +25 -15
- package/shortcuts/manager.js +1 -1
- package/shortcuts/manager.mjs +1 -1
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -9,7 +9,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'time';
|
|
9
9
|
* Default time renderer.
|
10
10
|
*
|
11
11
|
* @private
|
12
|
-
* @param {Core}
|
12
|
+
* @param {Core} hotInstance The Handsontable instance.
|
13
13
|
* @param {HTMLTableCellElement} TD The rendered cell element.
|
14
14
|
* @param {number} row The visual row index.
|
15
15
|
* @param {number} col The visual column index.
|
@@ -17,8 +17,8 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'time';
|
|
17
17
|
* @param {*} value The rendered value.
|
18
18
|
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
19
19
|
*/
|
20
|
-
function timeRenderer(
|
21
|
-
_textRenderer.textRenderer.apply(this, [
|
20
|
+
function timeRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
|
21
|
+
_textRenderer.textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
|
22
22
|
TD.dir = 'ltr';
|
23
23
|
}
|
24
24
|
timeRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -5,7 +5,7 @@ export const RENDERER_TYPE = 'time';
|
|
5
5
|
* Default time renderer.
|
6
6
|
*
|
7
7
|
* @private
|
8
|
-
* @param {Core}
|
8
|
+
* @param {Core} hotInstance The Handsontable instance.
|
9
9
|
* @param {HTMLTableCellElement} TD The rendered cell element.
|
10
10
|
* @param {number} row The visual row index.
|
11
11
|
* @param {number} col The visual column index.
|
@@ -13,8 +13,8 @@ export const RENDERER_TYPE = 'time';
|
|
13
13
|
* @param {*} value The rendered value.
|
14
14
|
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
15
15
|
*/
|
16
|
-
export function timeRenderer(
|
17
|
-
textRenderer.apply(this, [
|
16
|
+
export function timeRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
|
17
|
+
textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
|
18
18
|
TD.dir = 'ltr';
|
19
19
|
}
|
20
20
|
timeRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -179,10 +179,7 @@ class Highlight {
|
|
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 =
|
183
|
-
if (coords.isCell()) {
|
184
|
-
disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
185
|
-
}
|
182
|
+
let disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
186
183
|
if (typeof disableHighlight === 'string') {
|
187
184
|
disableHighlight = [disableHighlight];
|
188
185
|
}
|
@@ -170,10 +170,7 @@ class Highlight {
|
|
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 =
|
174
|
-
if (coords.isCell()) {
|
175
|
-
disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
176
|
-
}
|
173
|
+
let disableHighlight = this.options.disabledCellSelection(coords.row, coords.col);
|
177
174
|
if (typeof disableHighlight === 'string') {
|
178
175
|
disableHighlight = [disableHighlight];
|
179
176
|
}
|
package/selection/range.js
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
require("core-js/modules/es.error.cause.js");
|
3
4
|
exports.__esModule = true;
|
4
5
|
require("core-js/modules/es.array.push.js");
|
6
|
+
let _Symbol$iterator;
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
9
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
10
|
+
_Symbol$iterator = Symbol.iterator;
|
5
11
|
/**
|
6
12
|
* The SelectionRange class is a simple CellRanges collection designed for easy manipulation of the multiple
|
7
13
|
* consecutive and non-consecutive selections.
|
@@ -16,7 +22,11 @@ class SelectionRange {
|
|
16
22
|
*
|
17
23
|
* @type {CellRange[]}
|
18
24
|
*/
|
19
|
-
this
|
25
|
+
_defineProperty(this, "ranges", []);
|
26
|
+
/**
|
27
|
+
* @type {function(CellCoords): CellRange}
|
28
|
+
*/
|
29
|
+
_defineProperty(this, "createCellRange", void 0);
|
20
30
|
this.createCellRange = createCellRange;
|
21
31
|
}
|
22
32
|
|
@@ -126,7 +136,7 @@ class SelectionRange {
|
|
126
136
|
}
|
127
137
|
return cellRange;
|
128
138
|
}
|
129
|
-
[
|
139
|
+
[_Symbol$iterator]() {
|
130
140
|
return this.ranges[Symbol.iterator]();
|
131
141
|
}
|
132
142
|
}
|
package/selection/range.mjs
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
let _Symbol$iterator;
|
1
3
|
import "core-js/modules/es.array.push.js";
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
7
|
+
_Symbol$iterator = Symbol.iterator;
|
2
8
|
/**
|
3
9
|
* The SelectionRange class is a simple CellRanges collection designed for easy manipulation of the multiple
|
4
10
|
* consecutive and non-consecutive selections.
|
@@ -13,7 +19,11 @@ class SelectionRange {
|
|
13
19
|
*
|
14
20
|
* @type {CellRange[]}
|
15
21
|
*/
|
16
|
-
this
|
22
|
+
_defineProperty(this, "ranges", []);
|
23
|
+
/**
|
24
|
+
* @type {function(CellCoords): CellRange}
|
25
|
+
*/
|
26
|
+
_defineProperty(this, "createCellRange", void 0);
|
17
27
|
this.createCellRange = createCellRange;
|
18
28
|
}
|
19
29
|
|
@@ -123,7 +133,7 @@ class SelectionRange {
|
|
123
133
|
}
|
124
134
|
return cellRange;
|
125
135
|
}
|
126
|
-
[
|
136
|
+
[_Symbol$iterator]() {
|
127
137
|
return this.ranges[Symbol.iterator]();
|
128
138
|
}
|
129
139
|
}
|
package/selection/selection.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
-
var _src = require("./../3rdparty/walkontable/src");
|
6
5
|
var _highlight = _interopRequireWildcard(require("./highlight/highlight"));
|
7
6
|
var _range = _interopRequireDefault(require("./range"));
|
8
7
|
var _object = require("./../helpers/object");
|
@@ -561,6 +560,18 @@ class Selection {
|
|
561
560
|
return this.settings.fillHandle && !this.tableProps.isEditorOpened() && !this.isMultiple();
|
562
561
|
}
|
563
562
|
|
563
|
+
/**
|
564
|
+
* Returns `true` if the cell coordinates are visible (renderable).
|
565
|
+
*
|
566
|
+
* @private
|
567
|
+
* @param {CellCoords} coords The cell coordinates to check.
|
568
|
+
* @returns {boolean}
|
569
|
+
*/
|
570
|
+
isCellVisible(coords) {
|
571
|
+
const renderableCoords = this.tableProps.visualToRenderableCoords(coords);
|
572
|
+
return renderableCoords.row !== null && renderableCoords.col !== null;
|
573
|
+
}
|
574
|
+
|
564
575
|
/**
|
565
576
|
* Returns `true` if the area corner should be visible.
|
566
577
|
*
|
@@ -641,7 +652,7 @@ class Selection {
|
|
641
652
|
const startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
|
642
653
|
const endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
|
643
654
|
this.clear();
|
644
|
-
this.setRangeStartOnly(startCoords,
|
655
|
+
this.setRangeStartOnly(startCoords, undefined, highlight);
|
645
656
|
if (columnFrom < 0) {
|
646
657
|
this.selectedByRowHeader.add(this.getLayerLevel());
|
647
658
|
}
|
@@ -663,6 +674,7 @@ class Selection {
|
|
663
674
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
664
675
|
*/
|
665
676
|
selectCells(selectionRanges) {
|
677
|
+
var _this2 = this;
|
666
678
|
const selectionType = (0, _utils.detectSelectionType)(selectionRanges);
|
667
679
|
if (selectionType === _utils.SELECTION_TYPE_EMPTY) {
|
668
680
|
return false;
|
@@ -672,6 +684,12 @@ class Selection {
|
|
672
684
|
columnEnd/columnPropEnd]]) or as an array of CellRange objects.`);
|
673
685
|
}
|
674
686
|
const selectionSchemaNormalizer = (0, _utils.normalizeSelectionFactory)(selectionType, {
|
687
|
+
createCellCoords: function () {
|
688
|
+
return _this2.tableProps.createCellCoords(...arguments);
|
689
|
+
},
|
690
|
+
createCellRange: function () {
|
691
|
+
return _this2.tableProps.createCellRange(...arguments);
|
692
|
+
},
|
675
693
|
propToCol: prop => this.tableProps.propToCol(prop),
|
676
694
|
keepDirection: true
|
677
695
|
});
|
@@ -724,9 +742,9 @@ class Selection {
|
|
724
742
|
const countCols = this.tableProps.countCols();
|
725
743
|
const countColHeaders = this.tableProps.countColHeaders();
|
726
744
|
const columnHeaderLastIndex = countColHeaders === 0 ? 0 : -countColHeaders;
|
727
|
-
const fromCoords =
|
728
|
-
const toCoords =
|
729
|
-
const isValid =
|
745
|
+
const fromCoords = this.tableProps.createCellCoords(columnHeaderLastIndex, start);
|
746
|
+
const toCoords = this.tableProps.createCellCoords(countRows - 1, end);
|
747
|
+
const isValid = this.tableProps.createCellRange(fromCoords, fromCoords, toCoords).isValid({
|
730
748
|
countRows,
|
731
749
|
countCols,
|
732
750
|
countRowHeaders: 0,
|
@@ -743,7 +761,7 @@ class Selection {
|
|
743
761
|
// disallow modifying row axis for that hooks
|
744
762
|
from.row = fromRow;
|
745
763
|
to.row = toRow;
|
746
|
-
this.setRangeStartOnly(from,
|
764
|
+
this.setRangeStartOnly(from, undefined, highlight);
|
747
765
|
this.selectedByColumnHeader.add(this.getLayerLevel());
|
748
766
|
this.setRangeEnd(to);
|
749
767
|
this.runLocalHooks('afterSelectColumns', from, to, highlight);
|
@@ -769,9 +787,9 @@ class Selection {
|
|
769
787
|
const countCols = this.tableProps.countCols();
|
770
788
|
const countRowHeaders = this.tableProps.countRowHeaders();
|
771
789
|
const rowHeaderLastIndex = countRowHeaders === 0 ? 0 : -countRowHeaders;
|
772
|
-
const fromCoords =
|
773
|
-
const toCoords =
|
774
|
-
const isValid =
|
790
|
+
const fromCoords = this.tableProps.createCellCoords(startRow, rowHeaderLastIndex);
|
791
|
+
const toCoords = this.tableProps.createCellCoords(endRow, countCols - 1);
|
792
|
+
const isValid = this.tableProps.createCellRange(fromCoords, fromCoords, toCoords).isValid({
|
775
793
|
countRows,
|
776
794
|
countCols,
|
777
795
|
countRowHeaders,
|
@@ -788,7 +806,7 @@ class Selection {
|
|
788
806
|
// disallow modifying column axis for that hooks
|
789
807
|
from.col = fromColumn;
|
790
808
|
to.col = toColumn;
|
791
|
-
this.setRangeStartOnly(from,
|
809
|
+
this.setRangeStartOnly(from, undefined, highlight);
|
792
810
|
this.selectedByRowHeader.add(this.getLayerLevel());
|
793
811
|
this.setRangeEnd(to);
|
794
812
|
this.runLocalHooks('afterSelectRows', from, to, highlight);
|
package/selection/selection.mjs
CHANGED
@@ -9,7 +9,6 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
|
|
9
9
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
10
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
11
11
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
12
|
-
import { CellCoords, CellRange } from "./../3rdparty/walkontable/src/index.mjs";
|
13
12
|
import Highlight, { AREA_TYPE, HEADER_TYPE, FOCUS_TYPE } from "./highlight/highlight.mjs";
|
14
13
|
import SelectionRange from "./range.mjs";
|
15
14
|
import { createObjectPropListener, mixin } from "./../helpers/object.mjs";
|
@@ -555,6 +554,18 @@ class Selection {
|
|
555
554
|
return this.settings.fillHandle && !this.tableProps.isEditorOpened() && !this.isMultiple();
|
556
555
|
}
|
557
556
|
|
557
|
+
/**
|
558
|
+
* Returns `true` if the cell coordinates are visible (renderable).
|
559
|
+
*
|
560
|
+
* @private
|
561
|
+
* @param {CellCoords} coords The cell coordinates to check.
|
562
|
+
* @returns {boolean}
|
563
|
+
*/
|
564
|
+
isCellVisible(coords) {
|
565
|
+
const renderableCoords = this.tableProps.visualToRenderableCoords(coords);
|
566
|
+
return renderableCoords.row !== null && renderableCoords.col !== null;
|
567
|
+
}
|
568
|
+
|
558
569
|
/**
|
559
570
|
* Returns `true` if the area corner should be visible.
|
560
571
|
*
|
@@ -635,7 +646,7 @@ class Selection {
|
|
635
646
|
const startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
|
636
647
|
const endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
|
637
648
|
this.clear();
|
638
|
-
this.setRangeStartOnly(startCoords,
|
649
|
+
this.setRangeStartOnly(startCoords, undefined, highlight);
|
639
650
|
if (columnFrom < 0) {
|
640
651
|
this.selectedByRowHeader.add(this.getLayerLevel());
|
641
652
|
}
|
@@ -657,6 +668,7 @@ class Selection {
|
|
657
668
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
658
669
|
*/
|
659
670
|
selectCells(selectionRanges) {
|
671
|
+
var _this2 = this;
|
660
672
|
const selectionType = detectSelectionType(selectionRanges);
|
661
673
|
if (selectionType === SELECTION_TYPE_EMPTY) {
|
662
674
|
return false;
|
@@ -666,6 +678,12 @@ class Selection {
|
|
666
678
|
columnEnd/columnPropEnd]]) or as an array of CellRange objects.`);
|
667
679
|
}
|
668
680
|
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
|
681
|
+
createCellCoords: function () {
|
682
|
+
return _this2.tableProps.createCellCoords(...arguments);
|
683
|
+
},
|
684
|
+
createCellRange: function () {
|
685
|
+
return _this2.tableProps.createCellRange(...arguments);
|
686
|
+
},
|
669
687
|
propToCol: prop => this.tableProps.propToCol(prop),
|
670
688
|
keepDirection: true
|
671
689
|
});
|
@@ -718,9 +736,9 @@ class Selection {
|
|
718
736
|
const countCols = this.tableProps.countCols();
|
719
737
|
const countColHeaders = this.tableProps.countColHeaders();
|
720
738
|
const columnHeaderLastIndex = countColHeaders === 0 ? 0 : -countColHeaders;
|
721
|
-
const fromCoords =
|
722
|
-
const toCoords =
|
723
|
-
const isValid =
|
739
|
+
const fromCoords = this.tableProps.createCellCoords(columnHeaderLastIndex, start);
|
740
|
+
const toCoords = this.tableProps.createCellCoords(countRows - 1, end);
|
741
|
+
const isValid = this.tableProps.createCellRange(fromCoords, fromCoords, toCoords).isValid({
|
724
742
|
countRows,
|
725
743
|
countCols,
|
726
744
|
countRowHeaders: 0,
|
@@ -737,7 +755,7 @@ class Selection {
|
|
737
755
|
// disallow modifying row axis for that hooks
|
738
756
|
from.row = fromRow;
|
739
757
|
to.row = toRow;
|
740
|
-
this.setRangeStartOnly(from,
|
758
|
+
this.setRangeStartOnly(from, undefined, highlight);
|
741
759
|
this.selectedByColumnHeader.add(this.getLayerLevel());
|
742
760
|
this.setRangeEnd(to);
|
743
761
|
this.runLocalHooks('afterSelectColumns', from, to, highlight);
|
@@ -763,9 +781,9 @@ class Selection {
|
|
763
781
|
const countCols = this.tableProps.countCols();
|
764
782
|
const countRowHeaders = this.tableProps.countRowHeaders();
|
765
783
|
const rowHeaderLastIndex = countRowHeaders === 0 ? 0 : -countRowHeaders;
|
766
|
-
const fromCoords =
|
767
|
-
const toCoords =
|
768
|
-
const isValid =
|
784
|
+
const fromCoords = this.tableProps.createCellCoords(startRow, rowHeaderLastIndex);
|
785
|
+
const toCoords = this.tableProps.createCellCoords(endRow, countCols - 1);
|
786
|
+
const isValid = this.tableProps.createCellRange(fromCoords, fromCoords, toCoords).isValid({
|
769
787
|
countRows,
|
770
788
|
countCols,
|
771
789
|
countRowHeaders,
|
@@ -782,7 +800,7 @@ class Selection {
|
|
782
800
|
// disallow modifying column axis for that hooks
|
783
801
|
from.col = fromColumn;
|
784
802
|
to.col = toColumn;
|
785
|
-
this.setRangeStartOnly(from,
|
803
|
+
this.setRangeStartOnly(from, undefined, highlight);
|
786
804
|
this.selectedByRowHeader.add(this.getLayerLevel());
|
787
805
|
this.setRangeEnd(to);
|
788
806
|
this.runLocalHooks('afterSelectRows', from, to, highlight);
|
package/selection/utils.js
CHANGED
@@ -59,7 +59,9 @@ function detectSelectionType(selectionRanges) {
|
|
59
59
|
* Factory function designed for normalization data schema from different data structures of the selection ranges.
|
60
60
|
*
|
61
61
|
* @param {number} type Selection type which will be processed.
|
62
|
-
* @param {object}
|
62
|
+
* @param {object} options The normalization options.
|
63
|
+
* @param {function(number, number): CellCoords} options.createCellCoords The factory function that returns an instance of the `CellCoords` class.
|
64
|
+
* @param {function(CellCoords, CellCoords, CellCoords): CellRange} options.createCellRange The factory function that returns an instance of the `CellRange` class.
|
63
65
|
* @param {boolean} [options.keepDirection=false] If `true`, the coordinates which contain the direction of the
|
64
66
|
* selected cells won't be changed. Otherwise, the selection will be
|
65
67
|
* normalized to values starting from top-left to bottom-right.
|
@@ -69,6 +71,8 @@ function detectSelectionType(selectionRanges) {
|
|
69
71
|
*/
|
70
72
|
function normalizeSelectionFactory(type) {
|
71
73
|
let {
|
74
|
+
createCellCoords,
|
75
|
+
createCellRange,
|
72
76
|
keepDirection = false,
|
73
77
|
propToCol
|
74
78
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -105,9 +109,9 @@ function normalizeSelectionFactory(type) {
|
|
105
109
|
rowEnd = Math.max(origRowStart, origRowEnd);
|
106
110
|
columnEnd = Math.max(origColumnStart, origColumnEnd);
|
107
111
|
}
|
108
|
-
const from =
|
109
|
-
const to =
|
110
|
-
return
|
112
|
+
const from = createCellCoords(rowStart, columnStart);
|
113
|
+
const to = createCellCoords(rowEnd, columnEnd);
|
114
|
+
return createCellRange(from, from, to);
|
111
115
|
};
|
112
116
|
}
|
113
117
|
|
@@ -117,22 +121,25 @@ function normalizeSelectionFactory(type) {
|
|
117
121
|
* contains an array of arrays. The single item contains at index 0 visual column index from the selection was
|
118
122
|
* started and at index 1 distance as a count of selected columns.
|
119
123
|
*
|
120
|
-
* @param {
|
124
|
+
* @param {Core} hotInstance The Handsontable instance.
|
121
125
|
* @returns {Array[]} Returns an array of arrays with ranges defines in that schema:
|
122
126
|
* `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`.
|
123
127
|
* The column distances are always created starting from the left (zero index) to the
|
124
128
|
* right (the latest column index).
|
125
129
|
*/
|
126
|
-
function transformSelectionToColumnDistance(
|
127
|
-
const selectionType = detectSelectionType(
|
130
|
+
function transformSelectionToColumnDistance(hotInstance) {
|
131
|
+
const selectionType = detectSelectionType(hotInstance.getSelected());
|
128
132
|
if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) {
|
129
133
|
return [];
|
130
134
|
}
|
131
|
-
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType
|
135
|
+
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
|
136
|
+
createCellCoords: hotInstance._createCellCoords.bind(hotInstance),
|
137
|
+
createCellRange: hotInstance._createCellRange.bind(hotInstance)
|
138
|
+
});
|
132
139
|
const unorderedIndexes = new Set();
|
133
140
|
|
134
141
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
135
|
-
(0, _array.arrayEach)(
|
142
|
+
(0, _array.arrayEach)(hotInstance.getSelected(), selection => {
|
136
143
|
const {
|
137
144
|
from,
|
138
145
|
to
|
@@ -165,22 +172,25 @@ function transformSelectionToColumnDistance(selectionRanges) {
|
|
165
172
|
* contains an array of arrays. The single item contains at index 0 visual column index from the selection was
|
166
173
|
* started and at index 1 distance as a count of selected columns.
|
167
174
|
*
|
168
|
-
* @param {
|
175
|
+
* @param {Core} hotInstance The Handsontable instance.
|
169
176
|
* @returns {Array[]} Returns an array of arrays with ranges defines in that schema:
|
170
177
|
* `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`.
|
171
178
|
* The column distances are always created starting from the left (zero index) to the
|
172
179
|
* right (the latest column index).
|
173
180
|
*/
|
174
|
-
function transformSelectionToRowDistance(
|
175
|
-
const selectionType = detectSelectionType(
|
181
|
+
function transformSelectionToRowDistance(hotInstance) {
|
182
|
+
const selectionType = detectSelectionType(hotInstance.getSelected());
|
176
183
|
if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) {
|
177
184
|
return [];
|
178
185
|
}
|
179
|
-
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType
|
186
|
+
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
|
187
|
+
createCellCoords: hotInstance._createCellCoords.bind(hotInstance),
|
188
|
+
createCellRange: hotInstance._createCellRange.bind(hotInstance)
|
189
|
+
});
|
180
190
|
const unorderedIndexes = new Set();
|
181
191
|
|
182
192
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
183
|
-
(0, _array.arrayEach)(
|
193
|
+
(0, _array.arrayEach)(hotInstance.getSelected(), selection => {
|
184
194
|
const {
|
185
195
|
from,
|
186
196
|
to
|
package/selection/utils.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
|
-
import { CellRange
|
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
6
|
export const SELECTION_TYPE_UNRECOGNIZED = 0;
|
@@ -52,7 +52,9 @@ export function detectSelectionType(selectionRanges) {
|
|
52
52
|
* Factory function designed for normalization data schema from different data structures of the selection ranges.
|
53
53
|
*
|
54
54
|
* @param {number} type Selection type which will be processed.
|
55
|
-
* @param {object}
|
55
|
+
* @param {object} options The normalization options.
|
56
|
+
* @param {function(number, number): CellCoords} options.createCellCoords The factory function that returns an instance of the `CellCoords` class.
|
57
|
+
* @param {function(CellCoords, CellCoords, CellCoords): CellRange} options.createCellRange The factory function that returns an instance of the `CellRange` class.
|
56
58
|
* @param {boolean} [options.keepDirection=false] If `true`, the coordinates which contain the direction of the
|
57
59
|
* selected cells won't be changed. Otherwise, the selection will be
|
58
60
|
* normalized to values starting from top-left to bottom-right.
|
@@ -62,6 +64,8 @@ export function detectSelectionType(selectionRanges) {
|
|
62
64
|
*/
|
63
65
|
export function normalizeSelectionFactory(type) {
|
64
66
|
let {
|
67
|
+
createCellCoords,
|
68
|
+
createCellRange,
|
65
69
|
keepDirection = false,
|
66
70
|
propToCol
|
67
71
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -98,9 +102,9 @@ export function normalizeSelectionFactory(type) {
|
|
98
102
|
rowEnd = Math.max(origRowStart, origRowEnd);
|
99
103
|
columnEnd = Math.max(origColumnStart, origColumnEnd);
|
100
104
|
}
|
101
|
-
const from =
|
102
|
-
const to =
|
103
|
-
return
|
105
|
+
const from = createCellCoords(rowStart, columnStart);
|
106
|
+
const to = createCellCoords(rowEnd, columnEnd);
|
107
|
+
return createCellRange(from, from, to);
|
104
108
|
};
|
105
109
|
}
|
106
110
|
|
@@ -110,22 +114,25 @@ export function normalizeSelectionFactory(type) {
|
|
110
114
|
* contains an array of arrays. The single item contains at index 0 visual column index from the selection was
|
111
115
|
* started and at index 1 distance as a count of selected columns.
|
112
116
|
*
|
113
|
-
* @param {
|
117
|
+
* @param {Core} hotInstance The Handsontable instance.
|
114
118
|
* @returns {Array[]} Returns an array of arrays with ranges defines in that schema:
|
115
119
|
* `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`.
|
116
120
|
* The column distances are always created starting from the left (zero index) to the
|
117
121
|
* right (the latest column index).
|
118
122
|
*/
|
119
|
-
export function transformSelectionToColumnDistance(
|
120
|
-
const selectionType = detectSelectionType(
|
123
|
+
export function transformSelectionToColumnDistance(hotInstance) {
|
124
|
+
const selectionType = detectSelectionType(hotInstance.getSelected());
|
121
125
|
if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) {
|
122
126
|
return [];
|
123
127
|
}
|
124
|
-
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType
|
128
|
+
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
|
129
|
+
createCellCoords: hotInstance._createCellCoords.bind(hotInstance),
|
130
|
+
createCellRange: hotInstance._createCellRange.bind(hotInstance)
|
131
|
+
});
|
125
132
|
const unorderedIndexes = new Set();
|
126
133
|
|
127
134
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
128
|
-
arrayEach(
|
135
|
+
arrayEach(hotInstance.getSelected(), selection => {
|
129
136
|
const {
|
130
137
|
from,
|
131
138
|
to
|
@@ -158,22 +165,25 @@ export function transformSelectionToColumnDistance(selectionRanges) {
|
|
158
165
|
* contains an array of arrays. The single item contains at index 0 visual column index from the selection was
|
159
166
|
* started and at index 1 distance as a count of selected columns.
|
160
167
|
*
|
161
|
-
* @param {
|
168
|
+
* @param {Core} hotInstance The Handsontable instance.
|
162
169
|
* @returns {Array[]} Returns an array of arrays with ranges defines in that schema:
|
163
170
|
* `[[visualColumnStart, distance], [visualColumnStart, distance], ...]`.
|
164
171
|
* The column distances are always created starting from the left (zero index) to the
|
165
172
|
* right (the latest column index).
|
166
173
|
*/
|
167
|
-
export function transformSelectionToRowDistance(
|
168
|
-
const selectionType = detectSelectionType(
|
174
|
+
export function transformSelectionToRowDistance(hotInstance) {
|
175
|
+
const selectionType = detectSelectionType(hotInstance.getSelected());
|
169
176
|
if (selectionType === SELECTION_TYPE_UNRECOGNIZED || selectionType === SELECTION_TYPE_EMPTY) {
|
170
177
|
return [];
|
171
178
|
}
|
172
|
-
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType
|
179
|
+
const selectionSchemaNormalizer = normalizeSelectionFactory(selectionType, {
|
180
|
+
createCellCoords: hotInstance._createCellCoords.bind(hotInstance),
|
181
|
+
createCellRange: hotInstance._createCellRange.bind(hotInstance)
|
182
|
+
});
|
173
183
|
const unorderedIndexes = new Set();
|
174
184
|
|
175
185
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
176
|
-
arrayEach(
|
186
|
+
arrayEach(hotInstance.getSelected(), selection => {
|
177
187
|
const {
|
178
188
|
from,
|
179
189
|
to
|
package/shortcuts/manager.js
CHANGED
@@ -131,7 +131,7 @@ const createShortcutManager = _ref => {
|
|
131
131
|
captureCtrl,
|
132
132
|
forwardToContext
|
133
133
|
} = shortcuts[index];
|
134
|
-
if (runOnlyIf(event)
|
134
|
+
if (runOnlyIf(event) === true) {
|
135
135
|
isCtrlKeySilenced = captureCtrl;
|
136
136
|
isExecutionCancelled = callback(event, keys) === false;
|
137
137
|
isCtrlKeySilenced = false;
|
package/shortcuts/manager.mjs
CHANGED
@@ -128,7 +128,7 @@ export const createShortcutManager = _ref => {
|
|
128
128
|
captureCtrl,
|
129
129
|
forwardToContext
|
130
130
|
} = shortcuts[index];
|
131
|
-
if (runOnlyIf(event)
|
131
|
+
if (runOnlyIf(event) === true) {
|
132
132
|
isCtrlKeySilenced = captureCtrl;
|
133
133
|
isExecutionCancelled = callback(event, keys) === false;
|
134
134
|
isCtrlKeySilenced = false;
|