handsontable 14.2.0 → 14.3.0-next-3fa6b18-20240410
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/calculator/renderAllColumns.js +1 -1
- package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +1 -1
- package/3rdparty/walkontable/src/calculator/renderAllRows.js +1 -1
- package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +1 -1
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +13 -18
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +13 -18
- package/3rdparty/walkontable/src/calculator/viewportRows.js +11 -16
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +11 -16
- package/3rdparty/walkontable/src/cell/coords.js +13 -18
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -18
- package/3rdparty/walkontable/src/cell/range.d.ts +2 -1
- package/3rdparty/walkontable/src/cell/range.js +42 -30
- package/3rdparty/walkontable/src/cell/range.mjs +42 -30
- package/3rdparty/walkontable/src/core/_base.js +2 -2
- package/3rdparty/walkontable/src/core/_base.mjs +2 -2
- package/3rdparty/walkontable/src/core/clone.js +1 -1
- package/3rdparty/walkontable/src/core/clone.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +72 -104
- package/3rdparty/walkontable/src/event.mjs +72 -104
- package/3rdparty/walkontable/src/filter/column.js +1 -1
- package/3rdparty/walkontable/src/filter/column.mjs +1 -1
- package/3rdparty/walkontable/src/filter/row.js +1 -1
- package/3rdparty/walkontable/src/filter/row.mjs +1 -1
- package/3rdparty/walkontable/src/index.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +15 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +16 -2
- package/3rdparty/walkontable/src/overlay/top.js +12 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +13 -2
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +1 -1
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +1 -1
- package/3rdparty/walkontable/src/overlays.js +47 -5
- package/3rdparty/walkontable/src/overlays.mjs +47 -5
- package/3rdparty/walkontable/src/renderer/_base.js +1 -1
- package/3rdparty/walkontable/src/renderer/_base.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/cells.js +1 -1
- package/3rdparty/walkontable/src/renderer/cells.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +1 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/rows.js +1 -1
- package/3rdparty/walkontable/src/renderer/rows.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/table.js +1 -1
- package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
- package/3rdparty/walkontable/src/scroll.js +16 -18
- package/3rdparty/walkontable/src/scroll.mjs +16 -18
- package/3rdparty/walkontable/src/selection/manager.js +48 -69
- package/3rdparty/walkontable/src/selection/manager.mjs +48 -69
- package/3rdparty/walkontable/src/selection/scanner.js +33 -42
- package/3rdparty/walkontable/src/selection/scanner.mjs +33 -42
- package/3rdparty/walkontable/src/settings.js +1 -1
- package/3rdparty/walkontable/src/settings.mjs +1 -1
- package/3rdparty/walkontable/src/table.js +1 -1
- package/3rdparty/walkontable/src/table.mjs +1 -1
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/utils/columnStretching.js +28 -45
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +28 -45
- package/3rdparty/walkontable/src/utils/nodesPool.js +1 -1
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +1 -1
- package/3rdparty/walkontable/src/utils/orderView/view.js +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +2 -2
- 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 +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +1 -1
- package/3rdparty/walkontable/src/utils/row.js +1 -1
- package/3rdparty/walkontable/src/utils/row.mjs +1 -1
- package/CHANGELOG.md +20 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +4 -1
- package/core/viewportScroll/index.mjs +4 -1
- package/core/viewportScroll/scrollStrategies/focusScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +11 -0
- package/core.d.ts +4 -3
- package/core.js +98 -43
- package/core.mjs +98 -43
- package/dataMap/dataMap.js +1 -1
- package/dataMap/dataMap.mjs +1 -1
- package/dataMap/dataSource.js +2 -2
- package/dataMap/dataSource.mjs +2 -2
- package/dataMap/metaManager/lazyFactoryMap.js +3 -5
- package/dataMap/metaManager/lazyFactoryMap.mjs +2 -4
- package/dataMap/metaManager/metaLayers/cellMeta.js +2 -2
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -2
- package/dataMap/metaManager/metaLayers/columnMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +1 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +1 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +1 -1
- package/dataMap/metaManager/metaSchema.js +272 -272
- package/dataMap/metaManager/metaSchema.mjs +272 -272
- package/dataMap/metaManager/mods/dynamicCellMeta.js +1 -1
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
- package/dataMap/metaManager/mods/extendMetaProperties.js +1 -1
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +1 -1
- package/dataMap/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +4 -4
- package/dist/handsontable.full.css +4 -4
- package/dist/handsontable.full.js +9814 -10020
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +7484 -7056
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +25 -25
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +26 -24
- package/editorManager.mjs +26 -24
- package/editors/autocompleteEditor/autocompleteEditor.js +7 -11
- package/editors/autocompleteEditor/autocompleteEditor.mjs +7 -11
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +49 -11
- package/editors/dateEditor/dateEditor.mjs +49 -11
- package/editors/selectEditor/selectEditor.js +20 -19
- package/editors/selectEditor/selectEditor.mjs +20 -19
- package/editors/textEditor/textEditor.js +1 -1
- package/editors/textEditor/textEditor.mjs +1 -1
- package/eventManager.js +2 -2
- package/eventManager.mjs +2 -2
- package/focusManager.js +64 -82
- package/focusManager.mjs +64 -82
- package/helpers/dom/element.js +23 -1
- package/helpers/dom/element.mjs +21 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/object.js +2 -2
- package/helpers/object.mjs +2 -2
- package/i18n/languages/ar-AR.d.ts +5 -0
- package/i18n/languages/ar-AR.js +1 -1
- package/i18n/languages/cs-CZ.d.ts +5 -0
- package/i18n/languages/cs-CZ.js +1 -1
- package/i18n/languages/de-CH.js +1 -1
- package/i18n/languages/de-DE.js +1 -1
- package/i18n/languages/en-US.js +1 -1
- package/i18n/languages/es-MX.js +1 -1
- package/i18n/languages/fr-FR.js +1 -1
- package/i18n/languages/hr-HR.d.ts +5 -0
- package/i18n/languages/hr-HR.js +1 -1
- package/i18n/languages/it-IT.js +1 -1
- package/i18n/languages/ja-JP.js +1 -1
- package/i18n/languages/ko-KR.js +1 -1
- package/i18n/languages/lv-LV.js +1 -1
- package/i18n/languages/nb-NO.js +1 -1
- package/i18n/languages/nl-NL.js +1 -1
- package/i18n/languages/pl-PL.js +1 -1
- package/i18n/languages/pt-BR.js +1 -1
- package/i18n/languages/ru-RU.js +1 -1
- package/i18n/languages/sr-SP.d.ts +5 -0
- package/i18n/languages/sr-SP.js +1 -1
- package/i18n/languages/zh-CN.js +1 -1
- package/i18n/languages/zh-TW.js +1 -1
- package/i18n/registry.js +1 -1
- package/index.d.ts +10 -0
- package/index.js +1 -1
- package/package.json +14 -10
- package/pluginHooks.d.ts +4 -3
- package/pluginHooks.js +143 -82
- package/pluginHooks.mjs +143 -82
- package/plugins/autoColumnSize/autoColumnSize.js +50 -66
- package/plugins/autoColumnSize/autoColumnSize.mjs +50 -66
- package/plugins/autoRowSize/autoRowSize.js +29 -35
- package/plugins/autoRowSize/autoRowSize.mjs +29 -35
- package/plugins/autofill/autofill.js +31 -39
- package/plugins/autofill/autofill.mjs +31 -39
- package/plugins/base/base.js +13 -18
- package/plugins/base/base.mjs +13 -18
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +6 -6
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +6 -6
- package/plugins/collapsibleColumns/collapsibleColumns.js +60 -51
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +60 -51
- package/plugins/columnSorting/columnSorting.js +50 -46
- package/plugins/columnSorting/columnSorting.mjs +50 -46
- package/plugins/columnSorting/columnStatesManager.js +1 -1
- package/plugins/columnSorting/columnStatesManager.mjs +1 -1
- package/plugins/columnSummary/columnSummary.js +36 -40
- package/plugins/columnSummary/columnSummary.mjs +36 -40
- package/plugins/columnSummary/endpoints.js +1 -1
- package/plugins/columnSummary/endpoints.mjs +1 -1
- package/plugins/comments/commentEditor.js +1 -1
- package/plugins/comments/commentEditor.mjs +1 -1
- package/plugins/comments/comments.js +117 -159
- package/plugins/comments/comments.mjs +117 -159
- package/plugins/comments/contextMenuItem/addEditComment.js +1 -1
- package/plugins/comments/contextMenuItem/readOnlyComment.js +1 -1
- package/plugins/comments/contextMenuItem/removeComment.js +1 -1
- package/plugins/comments/displaySwitch.js +1 -1
- package/plugins/comments/displaySwitch.mjs +1 -1
- package/plugins/contextMenu/commandExecutor.js +1 -1
- package/plugins/contextMenu/commandExecutor.mjs +1 -1
- package/plugins/contextMenu/contextMenu.js +24 -30
- package/plugins/contextMenu/contextMenu.mjs +24 -30
- package/plugins/contextMenu/itemsFactory.js +2 -2
- package/plugins/contextMenu/itemsFactory.mjs +2 -2
- package/plugins/contextMenu/menu/cursor.js +1 -1
- package/plugins/contextMenu/menu/cursor.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +26 -10
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +26 -10
- package/plugins/contextMenu/menu/menu.js +14 -22
- package/plugins/contextMenu/menu/menu.mjs +14 -22
- package/plugins/contextMenu/menu/positioner.js +41 -58
- package/plugins/contextMenu/menu/positioner.mjs +41 -58
- package/plugins/contextMenu/predefinedItems/alignment.js +1 -1
- package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/columnLeft.js +1 -1
- package/plugins/contextMenu/predefinedItems/columnRight.js +1 -1
- package/plugins/contextMenu/predefinedItems/index.js +1 -1
- package/plugins/contextMenu/predefinedItems/readOnly.js +1 -1
- package/plugins/contextMenu/predefinedItems/redo.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/rowAbove.js +1 -1
- package/plugins/contextMenu/predefinedItems/rowBelow.js +1 -1
- package/plugins/contextMenu/predefinedItems/undo.js +1 -1
- package/plugins/copyPaste/contextMenuItem/cut.js +1 -1
- package/plugins/copyPaste/copyPaste.js +120 -161
- package/plugins/copyPaste/copyPaste.mjs +120 -161
- package/plugins/copyPaste/copyableRanges.js +43 -66
- package/plugins/copyPaste/copyableRanges.mjs +43 -66
- package/plugins/customBorders/contextMenuItem/bottom.js +1 -1
- package/plugins/customBorders/contextMenuItem/left.js +1 -1
- package/plugins/customBorders/contextMenuItem/noBorders.js +1 -1
- package/plugins/customBorders/contextMenuItem/right.js +1 -1
- package/plugins/customBorders/contextMenuItem/top.js +1 -1
- package/plugins/customBorders/customBorders.js +14 -16
- package/plugins/customBorders/customBorders.mjs +13 -15
- package/plugins/dragToScroll/dragToScroll.js +7 -7
- package/plugins/dragToScroll/dragToScroll.mjs +7 -7
- package/plugins/dropdownMenu/dropdownMenu.js +84 -110
- package/plugins/dropdownMenu/dropdownMenu.mjs +84 -110
- package/plugins/exportFile/dataProvider.js +2 -2
- package/plugins/exportFile/dataProvider.mjs +2 -2
- package/plugins/exportFile/exportFile.js +2 -2
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +1 -1
- package/plugins/exportFile/types/_base.mjs +1 -1
- package/plugins/filters/component/_base.js +1 -1
- package/plugins/filters/component/_base.mjs +1 -1
- package/plugins/filters/component/actionBar.js +11 -11
- package/plugins/filters/component/actionBar.mjs +9 -9
- package/plugins/filters/component/condition.js +15 -17
- package/plugins/filters/component/condition.mjs +14 -16
- package/plugins/filters/component/operators.js +7 -7
- package/plugins/filters/component/operators.mjs +7 -7
- package/plugins/filters/component/value.js +26 -30
- package/plugins/filters/component/value.mjs +25 -29
- package/plugins/filters/condition/beginsWith.js +1 -1
- package/plugins/filters/condition/between.js +1 -1
- package/plugins/filters/condition/contains.js +1 -1
- package/plugins/filters/condition/date/after.js +1 -1
- package/plugins/filters/condition/date/before.js +1 -1
- package/plugins/filters/condition/date/today.js +1 -1
- package/plugins/filters/condition/date/tomorrow.js +1 -1
- package/plugins/filters/condition/date/yesterday.js +1 -1
- package/plugins/filters/condition/empty.js +1 -1
- package/plugins/filters/condition/endsWith.js +1 -1
- package/plugins/filters/condition/equal.js +1 -1
- package/plugins/filters/condition/greaterThan.js +1 -1
- package/plugins/filters/condition/greaterThanOrEqual.js +1 -1
- package/plugins/filters/condition/lessThan.js +1 -1
- package/plugins/filters/condition/lessThanOrEqual.js +1 -1
- package/plugins/filters/condition/none.js +1 -1
- package/plugins/filters/condition/notBetween.js +1 -1
- package/plugins/filters/condition/notContains.js +1 -1
- package/plugins/filters/condition/notEmpty.js +1 -1
- package/plugins/filters/condition/notEqual.js +1 -1
- package/plugins/filters/conditionCollection.js +1 -1
- package/plugins/filters/conditionCollection.mjs +1 -1
- package/plugins/filters/conditionUpdateObserver.js +23 -25
- package/plugins/filters/conditionUpdateObserver.mjs +23 -25
- package/plugins/filters/dataFilter.js +2 -2
- package/plugins/filters/dataFilter.mjs +2 -2
- package/plugins/filters/filters.js +84 -98
- package/plugins/filters/filters.mjs +83 -97
- package/plugins/filters/logicalOperations/conjunction.js +1 -1
- package/plugins/filters/logicalOperations/disjunction.js +1 -1
- package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +1 -1
- package/plugins/filters/ui/_base.js +2 -2
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/ui/input.js +13 -19
- package/plugins/filters/ui/input.mjs +13 -19
- package/plugins/filters/ui/link.js +8 -13
- package/plugins/filters/ui/link.mjs +8 -13
- package/plugins/filters/ui/multipleSelect.js +86 -113
- package/plugins/filters/ui/multipleSelect.mjs +85 -112
- package/plugins/filters/ui/radioInput.js +12 -20
- package/plugins/filters/ui/radioInput.mjs +12 -20
- package/plugins/filters/ui/select.js +51 -73
- package/plugins/filters/ui/select.mjs +49 -71
- package/plugins/formulas/formulas.js +270 -328
- package/plugins/formulas/formulas.mjs +271 -329
- package/plugins/formulas/indexSyncer/axisSyncer.js +38 -61
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +38 -61
- package/plugins/formulas/indexSyncer/index.js +25 -48
- package/plugins/formulas/indexSyncer/index.mjs +25 -48
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +68 -87
- package/plugins/hiddenColumns/hiddenColumns.mjs +68 -87
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
- package/plugins/hiddenRows/hiddenRows.js +67 -86
- package/plugins/hiddenRows/hiddenRows.mjs +67 -86
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +24 -32
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +25 -33
- package/plugins/manualColumnMove/manualColumnMove.js +133 -177
- package/plugins/manualColumnMove/manualColumnMove.mjs +133 -177
- package/plugins/manualColumnMove/ui/_base.js +1 -1
- package/plugins/manualColumnMove/ui/_base.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +169 -230
- package/plugins/manualColumnResize/manualColumnResize.mjs +169 -230
- package/plugins/manualRowMove/manualRowMove.js +106 -135
- package/plugins/manualRowMove/manualRowMove.mjs +106 -135
- package/plugins/manualRowMove/ui/_base.js +1 -1
- package/plugins/manualRowMove/ui/_base.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +150 -209
- package/plugins/manualRowResize/manualRowResize.mjs +150 -209
- package/plugins/mergeCells/calculations/autofill.js +1 -1
- package/plugins/mergeCells/calculations/autofill.mjs +1 -1
- package/plugins/mergeCells/calculations/selection.js +3 -72
- package/plugins/mergeCells/calculations/selection.mjs +3 -72
- package/plugins/mergeCells/cellCoords.js +1 -1
- package/plugins/mergeCells/cellCoords.mjs +1 -1
- package/plugins/mergeCells/cellsCollection.js +118 -2
- package/plugins/mergeCells/cellsCollection.mjs +118 -2
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +12 -2
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +11 -1
- package/plugins/mergeCells/focusOrder.js +305 -0
- package/plugins/mergeCells/focusOrder.mjs +300 -0
- package/plugins/mergeCells/mergeCells.js +500 -398
- package/plugins/mergeCells/mergeCells.mjs +500 -398
- package/plugins/multiColumnSorting/multiColumnSorting.js +9 -3
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +9 -3
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +2 -2
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +2 -2
- package/plugins/nestedHeaders/nestedHeaders.js +206 -254
- package/plugins/nestedHeaders/nestedHeaders.mjs +207 -255
- package/plugins/nestedHeaders/stateManager/headersTree.js +21 -32
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +21 -32
- package/plugins/nestedHeaders/stateManager/index.js +30 -41
- package/plugins/nestedHeaders/stateManager/index.mjs +30 -41
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -30
- package/plugins/nestedHeaders/utils/ghostTable.js +1 -1
- package/plugins/nestedHeaders/utils/ghostTable.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +2 -2
- package/plugins/nestedRows/data/dataManager.mjs +2 -2
- package/plugins/nestedRows/nestedRows.js +154 -185
- package/plugins/nestedRows/nestedRows.mjs +155 -186
- package/plugins/nestedRows/ui/_base.js +1 -1
- package/plugins/nestedRows/ui/_base.mjs +1 -1
- package/plugins/nestedRows/ui/contextMenu.js +13 -17
- package/plugins/nestedRows/ui/contextMenu.mjs +11 -15
- package/plugins/nestedRows/utils/rowMoveController.js +6 -6
- package/plugins/nestedRows/utils/rowMoveController.mjs +6 -6
- package/plugins/persistentState/persistentState.js +1 -1
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/persistentState/storage.js +3 -3
- package/plugins/persistentState/storage.mjs +3 -3
- package/plugins/search/search.js +8 -8
- package/plugins/search/search.mjs +8 -8
- package/plugins/touchScroll/touchScroll.js +16 -20
- package/plugins/touchScroll/touchScroll.mjs +17 -21
- package/plugins/trimRows/trimRows.js +7 -7
- package/plugins/trimRows/trimRows.mjs +7 -7
- package/plugins/undoRedo/index.js +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +8 -5
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -5
- package/selection/highlight/highlight.js +16 -18
- package/selection/highlight/highlight.mjs +15 -17
- package/selection/highlight/visualSelection.js +3 -1
- package/selection/highlight/visualSelection.mjs +3 -1
- package/selection/range.js +3 -5
- package/selection/range.mjs +2 -4
- package/selection/selection.js +227 -69
- package/selection/selection.mjs +225 -67
- package/selection/transformation.js +149 -118
- package/selection/transformation.mjs +149 -118
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +18 -3
- package/shortcutContexts/commands/editor/open.mjs +18 -3
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +9 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +10 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +6 -1
- package/shortcutContexts/grid.js +9 -3
- package/shortcutContexts/grid.mjs +9 -3
- package/shortcuts/context.js +3 -2
- package/shortcuts/context.mjs +3 -2
- package/shortcuts/manager.js +2 -2
- package/shortcuts/manager.mjs +2 -2
- package/tableView.js +53 -79
- package/tableView.mjs +53 -79
- package/translations/changesObservable/observable.js +21 -38
- package/translations/changesObservable/observable.mjs +21 -38
- package/translations/changesObservable/observer.js +7 -12
- package/translations/changesObservable/observer.mjs +6 -11
- package/translations/indexMapper.js +1 -1
- package/translations/indexMapper.mjs +1 -1
- package/translations/mapCollections/aggregatedCollection.js +2 -2
- package/translations/mapCollections/aggregatedCollection.mjs +2 -2
- package/translations/mapCollections/mapCollection.js +1 -1
- package/translations/mapCollections/mapCollection.mjs +1 -1
- package/translations/maps/indexMap.js +2 -2
- package/translations/maps/indexMap.mjs +2 -2
- package/translations/maps/linkedPhysicalIndexToValueMap.js +1 -1
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +1 -1
- package/utils/dataStructures/linkedList.js +7 -2
- package/utils/dataStructures/linkedList.mjs +7 -2
- package/utils/dataStructures/tree.js +2 -2
- package/utils/dataStructures/tree.mjs +2 -2
- package/utils/ghostTable.js +1 -1
- package/utils/ghostTable.mjs +1 -1
- package/utils/interval.js +27 -45
- package/utils/interval.mjs +27 -45
- package/utils/samplesGenerator.js +1 -1
- package/utils/samplesGenerator.mjs +1 -1
@@ -1,17 +1,14 @@
|
|
1
|
-
import "core-js/modules/es.array.push.js";
|
2
1
|
import "core-js/modules/es.error.cause.js";
|
2
|
+
import "core-js/modules/es.array.push.js";
|
3
3
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
4
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
5
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
6
6
|
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; }
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
8
8
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
-
function _classPrivateFieldSet(
|
10
|
-
function
|
11
|
-
function
|
12
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
14
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
9
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
10
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
11
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
15
12
|
import { BasePlugin } from "../base/index.mjs";
|
16
13
|
import Hooks from "../../pluginHooks.mjs";
|
17
14
|
import MergedCellsCollection from "./cellsCollection.mjs";
|
@@ -26,6 +23,7 @@ import { rangeEach } from "../../helpers/number.mjs";
|
|
26
23
|
import { applySpanProperties } from "./utils.mjs";
|
27
24
|
import { getStyle } from "../../helpers/dom/element.mjs";
|
28
25
|
import { isChrome } from "../../helpers/browser.mjs";
|
26
|
+
import { FocusOrder } from "./focusOrder.mjs";
|
29
27
|
Hooks.getSingleton().register('beforeMergeCells');
|
30
28
|
Hooks.getSingleton().register('afterMergeCells');
|
31
29
|
Hooks.getSingleton().register('beforeUnmergeCells');
|
@@ -71,207 +69,17 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
71
69
|
* ```
|
72
70
|
* :::
|
73
71
|
*/
|
74
|
-
var
|
75
|
-
var
|
76
|
-
var
|
77
|
-
var
|
78
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
79
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
80
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
81
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
82
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
|
84
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
85
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
86
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
89
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
90
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
72
|
+
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
73
|
+
var _lastFocusDelta = /*#__PURE__*/new WeakMap();
|
74
|
+
var _focusOrder = /*#__PURE__*/new WeakMap();
|
75
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
98
76
|
export class MergeCells extends BasePlugin {
|
99
77
|
constructor() {
|
100
78
|
super(...arguments);
|
101
|
-
/**
|
102
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
103
|
-
*
|
104
|
-
* @param {number} row Visual row index of the edited cell.
|
105
|
-
* @param {number} column Visual column index of the edited cell.
|
106
|
-
* @param {string | null} initialValue The initial editor value.
|
107
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
108
|
-
* @returns {boolean | undefined}
|
109
|
-
*/
|
110
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
111
|
-
/**
|
112
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
113
|
-
*
|
114
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
115
|
-
* all the cells in the table.
|
116
|
-
*/
|
117
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
118
|
-
/**
|
119
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
120
|
-
*
|
121
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
122
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
123
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
124
|
-
* endColumn]`.
|
125
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
126
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
127
|
-
* processed cell.
|
128
|
-
*/
|
129
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
130
|
-
/**
|
131
|
-
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
132
|
-
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
133
|
-
*
|
134
|
-
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
135
|
-
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
136
|
-
* down).
|
137
|
-
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
138
|
-
* down).
|
139
|
-
*/
|
140
|
-
_classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
|
141
|
-
/**
|
142
|
-
* `beforeDrawAreaBorders` hook callback.
|
143
|
-
*
|
144
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
145
|
-
* @param {string} className Class name for the area.
|
146
|
-
*/
|
147
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
148
|
-
/**
|
149
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
150
|
-
*
|
151
|
-
* @param {Array} changes The changes array.
|
152
|
-
* @param {string} source Determines the source of the change.
|
153
|
-
*/
|
154
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
155
|
-
/**
|
156
|
-
* `afterRemoveRow` hook callback.
|
157
|
-
*
|
158
|
-
* @param {number} row Row index.
|
159
|
-
* @param {number} count Number of removed rows.
|
160
|
-
*/
|
161
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
162
|
-
/**
|
163
|
-
* `afterCreateRow` hook callback.
|
164
|
-
*
|
165
|
-
* @param {number} row Row index.
|
166
|
-
* @param {number} count Number of created rows.
|
167
|
-
* @param {string} source Source of change.
|
168
|
-
*/
|
169
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
170
|
-
/**
|
171
|
-
* `afterRemoveCol` hook callback.
|
172
|
-
*
|
173
|
-
* @param {number} column Column index.
|
174
|
-
* @param {number} count Number of removed columns.
|
175
|
-
*/
|
176
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
177
|
-
/**
|
178
|
-
* `afterCreateCol` hook callback.
|
179
|
-
*
|
180
|
-
* @param {number} column Column index.
|
181
|
-
* @param {number} count Number of created columns.
|
182
|
-
*/
|
183
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
184
|
-
/**
|
185
|
-
* The `modifyAutofillRange` hook callback.
|
186
|
-
*
|
187
|
-
* @param {Array} drag The drag area coordinates.
|
188
|
-
* @param {Array} select The selection information.
|
189
|
-
* @returns {Array} The new drag area.
|
190
|
-
*/
|
191
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
192
|
-
/**
|
193
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
194
|
-
*
|
195
|
-
* @param {object} calc The column calculator object.
|
196
|
-
*/
|
197
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
198
|
-
/**
|
199
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
200
|
-
*
|
201
|
-
* @param {object} calc The row calculator object.
|
202
|
-
*/
|
203
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
204
|
-
/**
|
205
|
-
* The `afterGetCellMeta` hook callback.
|
206
|
-
*
|
207
|
-
* @param {number} row Row index.
|
208
|
-
* @param {number} col Column index.
|
209
|
-
* @param {object} cellProperties The cell properties object.
|
210
|
-
*/
|
211
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
212
|
-
/**
|
213
|
-
* `beforeSetRangeEnd` hook callback.
|
214
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
215
|
-
* merged cell.
|
216
|
-
*
|
217
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
218
|
-
*
|
219
|
-
* @param {object} coords Cell coords.
|
220
|
-
*/
|
221
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
|
222
|
-
/**
|
223
|
-
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
224
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
225
|
-
*
|
226
|
-
* @param {object} coords Cell coords.
|
227
|
-
*/
|
228
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
229
|
-
/**
|
230
|
-
* `afterRenderer` hook callback.
|
231
|
-
*
|
232
|
-
* @param {HTMLElement} TD The cell to be modified.
|
233
|
-
* @param {number} row Row index.
|
234
|
-
* @param {number} col Visual column index.
|
235
|
-
*/
|
236
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
237
|
-
/**
|
238
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
239
|
-
*
|
240
|
-
* @param {object} defaultOptions The default context menu options.
|
241
|
-
*/
|
242
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
243
|
-
/**
|
244
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
245
|
-
*
|
246
|
-
* @param {number} row Row index.
|
247
|
-
* @param {number} column Visual column index.
|
248
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
249
|
-
*/
|
250
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
251
|
-
/**
|
252
|
-
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
253
|
-
*
|
254
|
-
* @param {object} delta The transformation delta.
|
255
|
-
*/
|
256
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
257
|
-
/**
|
258
|
-
* `modifyTransformStart` hook callback.
|
259
|
-
*
|
260
|
-
* @param {object} delta The transformation delta.
|
261
|
-
*/
|
262
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
263
|
-
/**
|
264
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
265
|
-
* hook callback.
|
266
|
-
*
|
267
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
268
|
-
* @returns {boolean}
|
269
|
-
*/
|
270
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
271
79
|
/**
|
272
80
|
* `afterInit` hook callback.
|
273
81
|
*/
|
274
|
-
_classPrivateMethodInitSpec(this,
|
82
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
275
83
|
/**
|
276
84
|
* A container for all the merged cells.
|
277
85
|
*
|
@@ -294,12 +102,32 @@ export class MergeCells extends BasePlugin {
|
|
294
102
|
*/
|
295
103
|
_defineProperty(this, "selectionCalculations", null);
|
296
104
|
/**
|
105
|
+
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
106
|
+
* focus is moved out of the merged cell.
|
107
|
+
*
|
297
108
|
* @type {CellCoords}
|
298
109
|
*/
|
299
|
-
_classPrivateFieldInitSpec(this,
|
300
|
-
|
301
|
-
|
110
|
+
_classPrivateFieldInitSpec(this, _lastSelectedFocus, null);
|
111
|
+
/**
|
112
|
+
* The last used transformation delta.
|
113
|
+
*
|
114
|
+
* @type {{ row: number, col: number }}
|
115
|
+
*/
|
116
|
+
_classPrivateFieldInitSpec(this, _lastFocusDelta, {
|
117
|
+
row: 0,
|
118
|
+
col: 0
|
302
119
|
});
|
120
|
+
/**
|
121
|
+
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
122
|
+
* contains merged cells.
|
123
|
+
*
|
124
|
+
* @type {FocusOrder}
|
125
|
+
*/
|
126
|
+
_classPrivateFieldInitSpec(this, _focusOrder, new FocusOrder({
|
127
|
+
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
128
|
+
rowIndexMapper: this.hot.rowIndexMapper,
|
129
|
+
columnIndexMapper: this.hot.columnIndexMapper
|
130
|
+
}));
|
303
131
|
}
|
304
132
|
static get PLUGIN_KEY() {
|
305
133
|
return PLUGIN_KEY;
|
@@ -332,145 +160,163 @@ export class MergeCells extends BasePlugin {
|
|
332
160
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
333
161
|
args[_key] = arguments[_key];
|
334
162
|
}
|
335
|
-
return
|
163
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
336
164
|
});
|
337
|
-
this.addHook('
|
165
|
+
this.addHook('modifyTransformFocus', function () {
|
338
166
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
339
167
|
args[_key2] = arguments[_key2];
|
340
168
|
}
|
341
|
-
return
|
169
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);
|
342
170
|
});
|
343
|
-
this.addHook('
|
171
|
+
this.addHook('modifyTransformStart', function () {
|
344
172
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
345
173
|
args[_key3] = arguments[_key3];
|
346
174
|
}
|
347
|
-
return
|
175
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
348
176
|
});
|
349
177
|
this.addHook('modifyTransformEnd', function () {
|
350
178
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
351
179
|
args[_key4] = arguments[_key4];
|
352
180
|
}
|
353
|
-
return
|
181
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
354
182
|
});
|
355
|
-
this.addHook('
|
183
|
+
this.addHook('beforeSelectionHighlightSet', function () {
|
356
184
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
357
185
|
args[_key5] = arguments[_key5];
|
358
186
|
}
|
359
|
-
return
|
187
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
|
360
188
|
});
|
361
189
|
this.addHook('beforeSetRangeStart', function () {
|
362
190
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
363
191
|
args[_key6] = arguments[_key6];
|
364
192
|
}
|
365
|
-
return
|
193
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
366
194
|
});
|
367
195
|
this.addHook('beforeSetRangeStartOnly', function () {
|
368
196
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
369
197
|
args[_key7] = arguments[_key7];
|
370
198
|
}
|
371
|
-
return
|
199
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
372
200
|
});
|
373
|
-
this.addHook('
|
201
|
+
this.addHook('beforeSelectionFocusSet', function () {
|
374
202
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
375
203
|
args[_key8] = arguments[_key8];
|
376
204
|
}
|
377
|
-
return
|
205
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);
|
378
206
|
});
|
379
|
-
this.addHook('
|
207
|
+
this.addHook('afterSelectionFocusSet', function () {
|
380
208
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
381
209
|
args[_key9] = arguments[_key9];
|
382
210
|
}
|
383
|
-
return
|
211
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);
|
384
212
|
});
|
385
|
-
this.addHook('
|
213
|
+
this.addHook('afterSelectionEnd', function () {
|
386
214
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
387
215
|
args[_key10] = arguments[_key10];
|
388
216
|
}
|
389
|
-
return
|
217
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);
|
390
218
|
});
|
391
|
-
this.addHook('
|
219
|
+
this.addHook('modifyGetCellCoords', function () {
|
392
220
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
393
221
|
args[_key11] = arguments[_key11];
|
394
222
|
}
|
395
|
-
return
|
223
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
396
224
|
});
|
397
|
-
this.addHook('
|
225
|
+
this.addHook('afterIsMultipleSelection', function () {
|
398
226
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
399
227
|
args[_key12] = arguments[_key12];
|
400
228
|
}
|
401
|
-
return
|
229
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
402
230
|
});
|
403
|
-
this.addHook('
|
231
|
+
this.addHook('afterRenderer', function () {
|
404
232
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
405
233
|
args[_key13] = arguments[_key13];
|
406
234
|
}
|
407
|
-
return
|
235
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
408
236
|
});
|
409
|
-
this.addHook('
|
237
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
410
238
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
411
239
|
args[_key14] = arguments[_key14];
|
412
240
|
}
|
413
|
-
return
|
241
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
414
242
|
});
|
415
|
-
this.addHook('
|
243
|
+
this.addHook('afterGetCellMeta', function () {
|
416
244
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
417
245
|
args[_key15] = arguments[_key15];
|
418
246
|
}
|
419
|
-
return
|
247
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
420
248
|
});
|
421
|
-
this.addHook('
|
249
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
422
250
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
423
251
|
args[_key16] = arguments[_key16];
|
424
252
|
}
|
425
|
-
return
|
253
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
426
254
|
});
|
427
|
-
this.addHook('
|
255
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
428
256
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
429
257
|
args[_key17] = arguments[_key17];
|
430
258
|
}
|
431
|
-
return
|
259
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
432
260
|
});
|
433
|
-
this.addHook('
|
261
|
+
this.addHook('modifyAutofillRange', function () {
|
434
262
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
435
263
|
args[_key18] = arguments[_key18];
|
436
264
|
}
|
437
|
-
return
|
265
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
438
266
|
});
|
439
|
-
this.addHook('
|
267
|
+
this.addHook('afterCreateCol', function () {
|
440
268
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
441
269
|
args[_key19] = arguments[_key19];
|
442
270
|
}
|
443
|
-
return
|
271
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
444
272
|
});
|
445
|
-
this.addHook('
|
273
|
+
this.addHook('afterRemoveCol', function () {
|
446
274
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
447
275
|
args[_key20] = arguments[_key20];
|
448
276
|
}
|
449
|
-
return
|
277
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
450
278
|
});
|
451
|
-
this.addHook('
|
279
|
+
this.addHook('afterCreateRow', function () {
|
452
280
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
453
281
|
args[_key21] = arguments[_key21];
|
454
282
|
}
|
455
|
-
return
|
283
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
456
284
|
});
|
457
|
-
this.addHook('
|
285
|
+
this.addHook('afterRemoveRow', function () {
|
458
286
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
459
287
|
args[_key22] = arguments[_key22];
|
460
288
|
}
|
461
|
-
return
|
289
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
462
290
|
});
|
463
|
-
this.addHook('
|
291
|
+
this.addHook('afterChange', function () {
|
464
292
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
465
293
|
args[_key23] = arguments[_key23];
|
466
294
|
}
|
467
|
-
return
|
295
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
468
296
|
});
|
469
|
-
this.addHook('
|
297
|
+
this.addHook('beforeDrawBorders', function () {
|
470
298
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
471
299
|
args[_key24] = arguments[_key24];
|
472
300
|
}
|
473
|
-
return
|
301
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
302
|
+
});
|
303
|
+
this.addHook('afterDrawSelection', function () {
|
304
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
305
|
+
args[_key25] = arguments[_key25];
|
306
|
+
}
|
307
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
308
|
+
});
|
309
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
310
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
311
|
+
args[_key26] = arguments[_key26];
|
312
|
+
}
|
313
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
314
|
+
});
|
315
|
+
this.addHook('beforeBeginEditing', function () {
|
316
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
317
|
+
args[_key27] = arguments[_key27];
|
318
|
+
}
|
319
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
474
320
|
});
|
475
321
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
476
322
|
if (source === 'MergeCells') {
|
@@ -614,7 +460,9 @@ export class MergeCells extends BasePlugin {
|
|
614
460
|
if (populatedNulls.length === 0) {
|
615
461
|
return;
|
616
462
|
}
|
617
|
-
|
463
|
+
|
464
|
+
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
465
|
+
this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);
|
618
466
|
}
|
619
467
|
}
|
620
468
|
|
@@ -638,25 +486,6 @@ export class MergeCells extends BasePlugin {
|
|
638
486
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
639
487
|
}
|
640
488
|
|
641
|
-
/**
|
642
|
-
* Merge or unmerge, based on last selected range.
|
643
|
-
*
|
644
|
-
* @private
|
645
|
-
*/
|
646
|
-
toggleMergeOnSelection() {
|
647
|
-
const currentRange = this.hot.getSelectedRangeLast();
|
648
|
-
if (!currentRange) {
|
649
|
-
return;
|
650
|
-
}
|
651
|
-
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
652
|
-
const {
|
653
|
-
from,
|
654
|
-
to
|
655
|
-
} = currentRange;
|
656
|
-
this.toggleMerge(currentRange);
|
657
|
-
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
658
|
-
}
|
659
|
-
|
660
489
|
/**
|
661
490
|
* Merges the selection provided as a cell range.
|
662
491
|
*
|
@@ -745,6 +574,7 @@ export class MergeCells extends BasePlugin {
|
|
745
574
|
if (preventPopulation) {
|
746
575
|
populationInfo = [mergeParent.row, mergeParent.col, clearedData];
|
747
576
|
} else {
|
577
|
+
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
748
578
|
this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
|
749
579
|
}
|
750
580
|
if (!auto) {
|
@@ -867,6 +697,15 @@ export class MergeCells extends BasePlugin {
|
|
867
697
|
const gridContext = shortcutManager.getContext('grid');
|
868
698
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
869
699
|
}
|
700
|
+
|
701
|
+
/**
|
702
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
703
|
+
* hook callback.
|
704
|
+
*
|
705
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
706
|
+
* @returns {boolean}
|
707
|
+
*/
|
708
|
+
|
870
709
|
/**
|
871
710
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
872
711
|
*
|
@@ -923,6 +762,13 @@ export class MergeCells extends BasePlugin {
|
|
923
762
|
}
|
924
763
|
}
|
925
764
|
}
|
765
|
+
|
766
|
+
/**
|
767
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
768
|
+
*
|
769
|
+
* @param {object} calc The column calculator object.
|
770
|
+
*/
|
771
|
+
|
926
772
|
/**
|
927
773
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
928
774
|
*
|
@@ -1017,95 +863,217 @@ export class MergeCells extends BasePlugin {
|
|
1017
863
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1018
864
|
return [renderableRow, renderableColumn];
|
1019
865
|
}
|
866
|
+
|
867
|
+
/**
|
868
|
+
* The `modifyAutofillRange` hook callback.
|
869
|
+
*
|
870
|
+
* @param {Array} drag The drag area coordinates.
|
871
|
+
* @param {Array} select The selection information.
|
872
|
+
* @returns {Array} The new drag area.
|
873
|
+
*/
|
1020
874
|
}
|
1021
|
-
function
|
875
|
+
function _onAfterInit() {
|
1022
876
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1023
877
|
this.hot.render();
|
1024
878
|
}
|
1025
|
-
function
|
879
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1026
880
|
if (isMultiple) {
|
1027
881
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1028
882
|
const selectionRange = this.hot.getSelectedRangeLast();
|
883
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
884
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1029
885
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1030
|
-
if (
|
886
|
+
if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
|
1031
887
|
return false;
|
1032
888
|
}
|
1033
889
|
}
|
1034
890
|
}
|
1035
891
|
return isMultiple;
|
1036
892
|
}
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
893
|
+
/**
|
894
|
+
* `modifyTransformFocus` hook callback.
|
895
|
+
*
|
896
|
+
* @param {object} delta The transformation delta.
|
897
|
+
*/
|
898
|
+
function _onModifyTransformFocus(delta) {
|
899
|
+
_classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
|
900
|
+
_classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
|
901
|
+
}
|
902
|
+
/**
|
903
|
+
* `modifyTransformStart` hook callback.
|
904
|
+
*
|
905
|
+
* @param {object} delta The transformation delta.
|
906
|
+
*/
|
907
|
+
function _onModifyTransformStart(delta) {
|
908
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
909
|
+
const {
|
910
|
+
highlight
|
911
|
+
} = selectedRange;
|
912
|
+
const {
|
913
|
+
columnIndexMapper,
|
914
|
+
rowIndexMapper
|
915
|
+
} = this.hot;
|
916
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
|
917
|
+
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
|
918
|
+
highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
|
919
|
+
}
|
920
|
+
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
|
921
|
+
highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
|
922
|
+
}
|
923
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
924
|
+
}
|
925
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
926
|
+
if (!mergedParent) {
|
927
|
+
return;
|
928
|
+
}
|
929
|
+
const visualColumnIndexStart = mergedParent.col;
|
930
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
931
|
+
if (delta.col < 0) {
|
932
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
933
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
934
|
+
if (notHiddenColumnIndex === null) {
|
935
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
936
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
937
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
938
|
+
} else {
|
939
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
940
|
+
}
|
941
|
+
} else if (delta.col > 0) {
|
942
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
943
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
944
|
+
if (notHiddenColumnIndex === null) {
|
945
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
946
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
947
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
948
|
+
} else {
|
949
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
950
|
+
}
|
951
|
+
}
|
952
|
+
const visualRowIndexStart = mergedParent.row;
|
953
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
954
|
+
if (delta.row < 0) {
|
955
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
956
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
957
|
+
if (notHiddenRowIndex === null) {
|
958
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
959
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
960
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
961
|
+
} else {
|
962
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
963
|
+
}
|
964
|
+
} else if (delta.row > 0) {
|
965
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
966
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
967
|
+
if (notHiddenRowIndex === null) {
|
968
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
969
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
970
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
971
|
+
} else {
|
972
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
973
|
+
}
|
974
|
+
}
|
975
|
+
}
|
976
|
+
/**
|
977
|
+
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
978
|
+
* The logic here handles "jumping over" merged merged cells, while selecting.
|
979
|
+
*
|
980
|
+
* @param {{ row: number, col: number }} delta The transformation delta.
|
981
|
+
*/
|
982
|
+
function _onModifyTransformEnd(delta) {
|
983
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
984
|
+
const cloneRange = selectedRange.clone();
|
985
|
+
const {
|
986
|
+
to
|
987
|
+
} = selectedRange;
|
988
|
+
const {
|
989
|
+
columnIndexMapper,
|
990
|
+
rowIndexMapper
|
991
|
+
} = this.hot;
|
992
|
+
const expandCloneRange = (row, col) => {
|
993
|
+
cloneRange.expand(this.hot._createCellCoords(row, col));
|
994
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
995
|
+
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
996
|
+
}
|
1042
997
|
};
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
998
|
+
if (delta.col < 0) {
|
999
|
+
let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
|
1000
|
+
expandCloneRange(to.row, nextColumn);
|
1001
|
+
if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
|
1002
|
+
nextColumn = cloneRange.getTopStartCorner().col;
|
1003
|
+
}
|
1004
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1005
|
+
if (notHiddenColumnIndex !== null) {
|
1006
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1007
|
+
}
|
1008
|
+
} else if (delta.col > 0) {
|
1009
|
+
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1010
|
+
expandCloneRange(to.row, nextColumn);
|
1011
|
+
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1012
|
+
nextColumn = cloneRange.getBottomEndCorner().col;
|
1013
|
+
}
|
1014
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1015
|
+
if (notHiddenColumnIndex !== null) {
|
1016
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1017
|
+
}
|
1048
1018
|
}
|
1049
|
-
if (
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
|
1055
|
-
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1019
|
+
if (delta.row < 0) {
|
1020
|
+
let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
|
1021
|
+
expandCloneRange(nextRow, to.col);
|
1022
|
+
if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
|
1023
|
+
nextRow = cloneRange.getTopStartCorner().row;
|
1056
1024
|
}
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
// moving down
|
1061
|
-
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
1062
|
-
} else if (delta.row < 0) {
|
1063
|
-
// moving up
|
1064
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1025
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1026
|
+
if (notHiddenRowIndex !== null) {
|
1027
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1065
1028
|
}
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1029
|
+
} else if (delta.row > 0) {
|
1030
|
+
let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
|
1031
|
+
expandCloneRange(nextRow, to.col);
|
1032
|
+
if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
|
1033
|
+
nextRow = cloneRange.getBottomStartCorner().row;
|
1034
|
+
}
|
1035
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1036
|
+
if (notHiddenRowIndex !== null) {
|
1037
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1072
1038
|
}
|
1073
1039
|
}
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1040
|
+
}
|
1041
|
+
/**
|
1042
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
1043
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
1044
|
+
*/
|
1045
|
+
function _onBeforeSelectionHighlightSet() {
|
1046
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1047
|
+
const {
|
1048
|
+
highlight
|
1049
|
+
} = selectedRange;
|
1050
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1051
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1052
|
+
return;
|
1084
1053
|
}
|
1085
|
-
|
1086
|
-
|
1054
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1055
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1087
1056
|
}
|
1088
|
-
|
1089
|
-
|
1057
|
+
// TODO: This is a workaround for an issue with the selection not being extended properly.
|
1058
|
+
// In some cases when the merge cells are defined in random order the selection is not
|
1059
|
+
// extended in that way that it covers all overlapped merge cells.
|
1060
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1061
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1062
|
+
}
|
1063
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1064
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1065
|
+
if (mergedParent) {
|
1066
|
+
highlight.assign(mergedParent);
|
1090
1067
|
}
|
1091
1068
|
}
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
1101
|
-
arrayEach(mergedCellsWithinRange, mergedCell => {
|
1102
|
-
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
1103
|
-
});
|
1104
|
-
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
1105
|
-
delta.row = newDelta.row;
|
1106
|
-
delta.col = newDelta.col;
|
1107
|
-
}
|
1108
|
-
function _onModifyGetCellCoords2(row, column) {
|
1069
|
+
/**
|
1070
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
1071
|
+
*
|
1072
|
+
* @param {number} row Row index.
|
1073
|
+
* @param {number} column Visual column index.
|
1074
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
1075
|
+
*/
|
1076
|
+
function _onModifyGetCellCoords(row, column) {
|
1109
1077
|
if (row < 0 || column < 0) {
|
1110
1078
|
return;
|
1111
1079
|
}
|
@@ -1125,12 +1093,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1125
1093
|
// Most bottom-right merged cell coords.
|
1126
1094
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1127
1095
|
}
|
1128
|
-
|
1096
|
+
/**
|
1097
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
1098
|
+
*
|
1099
|
+
* @param {object} defaultOptions The default context menu options.
|
1100
|
+
*/
|
1101
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1129
1102
|
defaultOptions.items.push({
|
1130
1103
|
name: '---------'
|
1131
1104
|
}, toggleMergeItem(this));
|
1132
1105
|
}
|
1133
|
-
|
1106
|
+
/**
|
1107
|
+
* `afterRenderer` hook callback.
|
1108
|
+
*
|
1109
|
+
* @param {HTMLElement} TD The cell to be modified.
|
1110
|
+
* @param {number} row Row index.
|
1111
|
+
* @param {number} col Visual column index.
|
1112
|
+
*/
|
1113
|
+
function _onAfterRenderer(TD, row, col) {
|
1134
1114
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1135
1115
|
// We shouldn't override data in the collection.
|
1136
1116
|
const mergedCellCopy = isObject(mergedCell) ? clone(mergedCell) : undefined;
|
@@ -1162,39 +1142,114 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1162
1142
|
}
|
1163
1143
|
applySpanProperties(TD, mergedCellCopy, row, col);
|
1164
1144
|
}
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
// and what was idea for flipping direction inside `expandByRange` method.
|
1171
|
-
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1172
|
-
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1173
|
-
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1174
|
-
}
|
1145
|
+
/**
|
1146
|
+
* Clears the last selected coordinates before setting a new selection range.
|
1147
|
+
*/
|
1148
|
+
function _onBeforeSetRangeStart() {
|
1149
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
1175
1150
|
}
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
if (
|
1151
|
+
/**
|
1152
|
+
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
1153
|
+
* computations.
|
1154
|
+
*/
|
1155
|
+
function _onBeforeSelectionFocusSet() {
|
1156
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
|
1182
1157
|
return;
|
1183
1158
|
}
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1159
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1160
|
+
const verticalDir = selectedRange.getVerticalDirection();
|
1161
|
+
const horizontalDir = selectedRange.getHorizontalDirection();
|
1162
|
+
const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
|
1163
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
|
1164
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1165
|
+
_classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
|
1166
|
+
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1167
|
+
_classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
/**
|
1171
|
+
* Changes the focus selection to the next or previous cell or merged cell position.
|
1172
|
+
*
|
1173
|
+
* @param {number} row The visual row index.
|
1174
|
+
* @param {number} column The visual column index.
|
1175
|
+
*/
|
1176
|
+
function _onAfterSelectionFocusSet(row, column) {
|
1177
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1178
|
+
const {
|
1179
|
+
columnIndexMapper,
|
1180
|
+
rowIndexMapper
|
1181
|
+
} = this.hot;
|
1182
|
+
let notHiddenRowIndex = null;
|
1183
|
+
let notHiddenColumnIndex = null;
|
1184
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
|
1185
|
+
const {
|
1186
|
+
rowEnd,
|
1187
|
+
colEnd
|
1188
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
|
1189
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1190
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1191
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1192
|
+
const {
|
1193
|
+
rowStart,
|
1194
|
+
colStart
|
1195
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
|
1196
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1197
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1198
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1199
|
+
const {
|
1200
|
+
rowEnd,
|
1201
|
+
colEnd
|
1202
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
|
1203
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1204
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1205
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
|
1206
|
+
const {
|
1207
|
+
rowStart,
|
1208
|
+
colStart
|
1209
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
|
1210
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1211
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1212
|
+
}
|
1213
|
+
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1214
|
+
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1215
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1216
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
1217
|
+
row = coords.row;
|
1218
|
+
column = coords.col;
|
1219
|
+
if (mergeParent) {
|
1220
|
+
selectedRange.highlight.assign({
|
1221
|
+
row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
|
1222
|
+
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
|
1223
|
+
});
|
1224
|
+
} else {
|
1225
|
+
selectedRange.highlight.assign(coords);
|
1194
1226
|
}
|
1195
|
-
|
1227
|
+
focusHighlight.clear();
|
1228
|
+
focusHighlight.add(coords).commit();
|
1229
|
+
}
|
1230
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
|
1231
|
+
_classPrivateFieldSet(_lastFocusDelta, this, {
|
1232
|
+
row: 0,
|
1233
|
+
col: 0
|
1234
|
+
});
|
1196
1235
|
}
|
1197
|
-
|
1236
|
+
/**
|
1237
|
+
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
1238
|
+
*/
|
1239
|
+
function _onAfterSelectionEnd() {
|
1240
|
+
const selection = this.hot.getSelectedRangeLast();
|
1241
|
+
if (!selection.isHeader()) {
|
1242
|
+
_classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
|
1243
|
+
}
|
1244
|
+
}
|
1245
|
+
/**
|
1246
|
+
* The `afterGetCellMeta` hook callback.
|
1247
|
+
*
|
1248
|
+
* @param {number} row Row index.
|
1249
|
+
* @param {number} col Column index.
|
1250
|
+
* @param {object} cellProperties The cell properties object.
|
1251
|
+
*/
|
1252
|
+
function _onAfterGetCellMeta(row, col, cellProperties) {
|
1198
1253
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1199
1254
|
if (mergeParent) {
|
1200
1255
|
if (mergeParent.row !== row || mergeParent.col !== col) {
|
@@ -1205,17 +1260,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
|
|
1205
1260
|
}
|
1206
1261
|
}
|
1207
1262
|
}
|
1208
|
-
|
1263
|
+
/**
|
1264
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
1265
|
+
*
|
1266
|
+
* @param {object} calc The row calculator object.
|
1267
|
+
*/
|
1268
|
+
function _onAfterViewportRowCalculatorOverride(calc) {
|
1209
1269
|
const nrOfColumns = this.hot.countCols();
|
1210
1270
|
this.modifyViewportRowStart(calc, nrOfColumns);
|
1211
1271
|
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1212
1272
|
}
|
1213
|
-
function
|
1273
|
+
function _onAfterViewportColumnCalculatorOverride(calc) {
|
1214
1274
|
const nrOfRows = this.hot.countRows();
|
1215
1275
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1216
1276
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1217
1277
|
}
|
1218
|
-
function
|
1278
|
+
function _onModifyAutofillRange(drag, select) {
|
1219
1279
|
this.autofillCalculations.correctSelectionAreaSize(select);
|
1220
1280
|
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1221
1281
|
let dragArea = drag;
|
@@ -1239,28 +1299,65 @@ function _onModifyAutofillRange2(drag, select) {
|
|
1239
1299
|
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1240
1300
|
return dragArea;
|
1241
1301
|
}
|
1242
|
-
|
1302
|
+
/**
|
1303
|
+
* `afterCreateCol` hook callback.
|
1304
|
+
*
|
1305
|
+
* @param {number} column Column index.
|
1306
|
+
* @param {number} count Number of created columns.
|
1307
|
+
*/
|
1308
|
+
function _onAfterCreateCol(column, count) {
|
1243
1309
|
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1244
1310
|
}
|
1245
|
-
|
1311
|
+
/**
|
1312
|
+
* `afterRemoveCol` hook callback.
|
1313
|
+
*
|
1314
|
+
* @param {number} column Column index.
|
1315
|
+
* @param {number} count Number of removed columns.
|
1316
|
+
*/
|
1317
|
+
function _onAfterRemoveCol(column, count) {
|
1246
1318
|
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1247
1319
|
}
|
1248
|
-
|
1320
|
+
/**
|
1321
|
+
* `afterCreateRow` hook callback.
|
1322
|
+
*
|
1323
|
+
* @param {number} row Row index.
|
1324
|
+
* @param {number} count Number of created rows.
|
1325
|
+
* @param {string} source Source of change.
|
1326
|
+
*/
|
1327
|
+
function _onAfterCreateRow(row, count, source) {
|
1249
1328
|
if (source === 'auto') {
|
1250
1329
|
return;
|
1251
1330
|
}
|
1252
1331
|
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1253
1332
|
}
|
1254
|
-
|
1333
|
+
/**
|
1334
|
+
* `afterRemoveRow` hook callback.
|
1335
|
+
*
|
1336
|
+
* @param {number} row Row index.
|
1337
|
+
* @param {number} count Number of removed rows.
|
1338
|
+
*/
|
1339
|
+
function _onAfterRemoveRow(row, count) {
|
1255
1340
|
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1256
1341
|
}
|
1257
|
-
|
1342
|
+
/**
|
1343
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1344
|
+
*
|
1345
|
+
* @param {Array} changes The changes array.
|
1346
|
+
* @param {string} source Determines the source of the change.
|
1347
|
+
*/
|
1348
|
+
function _onAfterChange(changes, source) {
|
1258
1349
|
if (source !== 'Autofill.fill') {
|
1259
1350
|
return;
|
1260
1351
|
}
|
1261
1352
|
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1262
1353
|
}
|
1263
|
-
|
1354
|
+
/**
|
1355
|
+
* `beforeDrawAreaBorders` hook callback.
|
1356
|
+
*
|
1357
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
1358
|
+
* @param {string} className Class name for the area.
|
1359
|
+
*/
|
1360
|
+
function _onBeforeDrawAreaBorders(corners, className) {
|
1264
1361
|
if (className && className === 'area') {
|
1265
1362
|
const selectedRange = this.hot.getSelectedRangeLast();
|
1266
1363
|
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
@@ -1272,38 +1369,43 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1272
1369
|
});
|
1273
1370
|
}
|
1274
1371
|
}
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1288
|
-
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1289
|
-
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1290
|
-
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1291
|
-
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1292
|
-
coords.row = mergedCellAtCoords.row;
|
1293
|
-
coords.col = mergedCellAtCoords.col;
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1372
|
+
/**
|
1373
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1374
|
+
*
|
1375
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
1376
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
1377
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
1378
|
+
* endColumn]`.
|
1379
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
1380
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
1381
|
+
* processed cell.
|
1382
|
+
*/
|
1383
|
+
function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1297
1384
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1298
1385
|
if (!cornersOfSelection) {
|
1299
1386
|
return;
|
1300
1387
|
}
|
1301
1388
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1302
1389
|
}
|
1303
|
-
|
1390
|
+
/**
|
1391
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1392
|
+
*
|
1393
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1394
|
+
* all the cells in the table.
|
1395
|
+
*/
|
1396
|
+
function _onBeforeRemoveCellClassNames() {
|
1304
1397
|
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1305
1398
|
}
|
1306
|
-
|
1399
|
+
/**
|
1400
|
+
* Allows to prevent opening the editor while more than one merged cell is selected.
|
1401
|
+
*
|
1402
|
+
* @param {number} row Visual row index of the edited cell.
|
1403
|
+
* @param {number} column Visual column index of the edited cell.
|
1404
|
+
* @param {string | null} initialValue The initial editor value.
|
1405
|
+
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
1406
|
+
* @returns {boolean | undefined}
|
1407
|
+
*/
|
1408
|
+
function _onBeforeBeginEditing(row, column, initialValue, event) {
|
1307
1409
|
if (!(event instanceof MouseEvent)) {
|
1308
1410
|
return;
|
1309
1411
|
}
|