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,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.array.push.js");
|
5
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
require("core-js/modules/es.array.push.js");
|
6
6
|
var _base = require("../base");
|
7
7
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
8
8
|
var _cellsCollection = _interopRequireDefault(require("./cellsCollection"));
|
@@ -17,19 +17,17 @@ var _number = require("../../helpers/number");
|
|
17
17
|
var _utils = require("./utils");
|
18
18
|
var _element = require("../../helpers/dom/element");
|
19
19
|
var _browser = require("../../helpers/browser");
|
20
|
+
var _focusOrder2 = require("./focusOrder");
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
22
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
22
23
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
23
24
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
24
25
|
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; }
|
25
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
26
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
26
27
|
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); }
|
27
|
-
function _classPrivateFieldSet(
|
28
|
-
function
|
29
|
-
function
|
30
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
31
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
32
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
28
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
29
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
30
|
+
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"); }
|
33
31
|
_pluginHooks.default.getSingleton().register('beforeMergeCells');
|
34
32
|
_pluginHooks.default.getSingleton().register('afterMergeCells');
|
35
33
|
_pluginHooks.default.getSingleton().register('beforeUnmergeCells');
|
@@ -75,207 +73,17 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
75
73
|
* ```
|
76
74
|
* :::
|
77
75
|
*/
|
78
|
-
var
|
79
|
-
var
|
80
|
-
var
|
81
|
-
var
|
82
|
-
var _onModifyTransformEnd = /*#__PURE__*/new WeakSet();
|
83
|
-
var _onModifyGetCellCoords = /*#__PURE__*/new WeakSet();
|
84
|
-
var _addMergeActionsToContextMenu = /*#__PURE__*/new WeakSet();
|
85
|
-
var _onAfterRenderer = /*#__PURE__*/new WeakSet();
|
86
|
-
var _onBeforeSetRangeStart = /*#__PURE__*/new WeakSet();
|
87
|
-
var _onBeforeSetRangeEnd = /*#__PURE__*/new WeakSet();
|
88
|
-
var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
|
89
|
-
var _onAfterViewportRowCalculatorOverride = /*#__PURE__*/new WeakSet();
|
90
|
-
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
91
|
-
var _onModifyAutofillRange = /*#__PURE__*/new WeakSet();
|
92
|
-
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
93
|
-
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
94
|
-
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
95
|
-
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
96
|
-
var _onAfterChange = /*#__PURE__*/new WeakSet();
|
97
|
-
var _onBeforeDrawAreaBorders = /*#__PURE__*/new WeakSet();
|
98
|
-
var _onAfterModifyTransformStart = /*#__PURE__*/new WeakSet();
|
99
|
-
var _onAfterDrawSelection = /*#__PURE__*/new WeakSet();
|
100
|
-
var _onBeforeRemoveCellClassNames = /*#__PURE__*/new WeakSet();
|
101
|
-
var _onBeforeBeginEditing = /*#__PURE__*/new WeakSet();
|
76
|
+
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
77
|
+
var _lastFocusDelta = /*#__PURE__*/new WeakMap();
|
78
|
+
var _focusOrder = /*#__PURE__*/new WeakMap();
|
79
|
+
var _MergeCells_brand = /*#__PURE__*/new WeakSet();
|
102
80
|
class MergeCells extends _base.BasePlugin {
|
103
81
|
constructor() {
|
104
82
|
super(...arguments);
|
105
|
-
/**
|
106
|
-
* Allows to prevent opening the editor while more than one merged cell is selected.
|
107
|
-
*
|
108
|
-
* @param {number} row Visual row index of the edited cell.
|
109
|
-
* @param {number} column Visual column index of the edited cell.
|
110
|
-
* @param {string | null} initialValue The initial editor value.
|
111
|
-
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
112
|
-
* @returns {boolean | undefined}
|
113
|
-
*/
|
114
|
-
_classPrivateMethodInitSpec(this, _onBeforeBeginEditing);
|
115
|
-
/**
|
116
|
-
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
117
|
-
*
|
118
|
-
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
119
|
-
* all the cells in the table.
|
120
|
-
*/
|
121
|
-
_classPrivateMethodInitSpec(this, _onBeforeRemoveCellClassNames);
|
122
|
-
/**
|
123
|
-
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
124
|
-
*
|
125
|
-
* @param {number} currentRow Visual row index of the currently processed cell.
|
126
|
-
* @param {number} currentColumn Visual column index of the currently cell.
|
127
|
-
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
128
|
-
* endColumn]`.
|
129
|
-
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
130
|
-
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
131
|
-
* processed cell.
|
132
|
-
*/
|
133
|
-
_classPrivateMethodInitSpec(this, _onAfterDrawSelection);
|
134
|
-
/**
|
135
|
-
* `afterModifyTransformStart` hook callback. Fixes a problem with navigating through merged cells at the edges of
|
136
|
-
* the table with the <kbd>**Enter**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Enter**</kbd>/<kbd>**Tab**</kbd>/<kbd>**Shift**</kbd>+<kbd>**Tab**</kbd> keys.
|
137
|
-
*
|
138
|
-
* @param {CellCoords} coords Coordinates of the to-be-selected cell.
|
139
|
-
* @param {number} rowTransformDir Row transformation direction (negative value = up, 0 = none, positive value =
|
140
|
-
* down).
|
141
|
-
* @param {number} colTransformDir Column transformation direction (negative value = up, 0 = none, positive value =
|
142
|
-
* down).
|
143
|
-
*/
|
144
|
-
_classPrivateMethodInitSpec(this, _onAfterModifyTransformStart);
|
145
|
-
/**
|
146
|
-
* `beforeDrawAreaBorders` hook callback.
|
147
|
-
*
|
148
|
-
* @param {Array} corners Visual coordinates of the area corners.
|
149
|
-
* @param {string} className Class name for the area.
|
150
|
-
*/
|
151
|
-
_classPrivateMethodInitSpec(this, _onBeforeDrawAreaBorders);
|
152
|
-
/**
|
153
|
-
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
154
|
-
*
|
155
|
-
* @param {Array} changes The changes array.
|
156
|
-
* @param {string} source Determines the source of the change.
|
157
|
-
*/
|
158
|
-
_classPrivateMethodInitSpec(this, _onAfterChange);
|
159
|
-
/**
|
160
|
-
* `afterRemoveRow` hook callback.
|
161
|
-
*
|
162
|
-
* @param {number} row Row index.
|
163
|
-
* @param {number} count Number of removed rows.
|
164
|
-
*/
|
165
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
166
|
-
/**
|
167
|
-
* `afterCreateRow` hook callback.
|
168
|
-
*
|
169
|
-
* @param {number} row Row index.
|
170
|
-
* @param {number} count Number of created rows.
|
171
|
-
* @param {string} source Source of change.
|
172
|
-
*/
|
173
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
174
|
-
/**
|
175
|
-
* `afterRemoveCol` hook callback.
|
176
|
-
*
|
177
|
-
* @param {number} column Column index.
|
178
|
-
* @param {number} count Number of removed columns.
|
179
|
-
*/
|
180
|
-
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
181
|
-
/**
|
182
|
-
* `afterCreateCol` hook callback.
|
183
|
-
*
|
184
|
-
* @param {number} column Column index.
|
185
|
-
* @param {number} count Number of created columns.
|
186
|
-
*/
|
187
|
-
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
188
|
-
/**
|
189
|
-
* The `modifyAutofillRange` hook callback.
|
190
|
-
*
|
191
|
-
* @param {Array} drag The drag area coordinates.
|
192
|
-
* @param {Array} select The selection information.
|
193
|
-
* @returns {Array} The new drag area.
|
194
|
-
*/
|
195
|
-
_classPrivateMethodInitSpec(this, _onModifyAutofillRange);
|
196
|
-
/**
|
197
|
-
* `afterViewportColumnCalculatorOverride` hook callback.
|
198
|
-
*
|
199
|
-
* @param {object} calc The column calculator object.
|
200
|
-
*/
|
201
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
202
|
-
/**
|
203
|
-
* `afterViewportRowCalculatorOverride` hook callback.
|
204
|
-
*
|
205
|
-
* @param {object} calc The row calculator object.
|
206
|
-
*/
|
207
|
-
_classPrivateMethodInitSpec(this, _onAfterViewportRowCalculatorOverride);
|
208
|
-
/**
|
209
|
-
* The `afterGetCellMeta` hook callback.
|
210
|
-
*
|
211
|
-
* @param {number} row Row index.
|
212
|
-
* @param {number} col Column index.
|
213
|
-
* @param {object} cellProperties The cell properties object.
|
214
|
-
*/
|
215
|
-
_classPrivateMethodInitSpec(this, _onAfterGetCellMeta);
|
216
|
-
/**
|
217
|
-
* `beforeSetRangeEnd` hook callback.
|
218
|
-
* While selecting cells with keyboard or mouse, make sure that rectangular area is expanded to the extent of the
|
219
|
-
* merged cell.
|
220
|
-
*
|
221
|
-
* Note: Please keep in mind that callback may modify both start and end range coordinates by the reference.
|
222
|
-
*
|
223
|
-
* @param {object} coords Cell coords.
|
224
|
-
*/
|
225
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeEnd);
|
226
|
-
/**
|
227
|
-
* `beforeSetRangeStart` and `beforeSetRangeStartOnly` hook callback.
|
228
|
-
* A selection within merge area should be rewritten to the start of merge area.
|
229
|
-
*
|
230
|
-
* @param {object} coords Cell coords.
|
231
|
-
*/
|
232
|
-
_classPrivateMethodInitSpec(this, _onBeforeSetRangeStart);
|
233
|
-
/**
|
234
|
-
* `afterRenderer` hook callback.
|
235
|
-
*
|
236
|
-
* @param {HTMLElement} TD The cell to be modified.
|
237
|
-
* @param {number} row Row index.
|
238
|
-
* @param {number} col Visual column index.
|
239
|
-
*/
|
240
|
-
_classPrivateMethodInitSpec(this, _onAfterRenderer);
|
241
|
-
/**
|
242
|
-
* `afterContextMenuDefaultOptions` hook callback.
|
243
|
-
*
|
244
|
-
* @param {object} defaultOptions The default context menu options.
|
245
|
-
*/
|
246
|
-
_classPrivateMethodInitSpec(this, _addMergeActionsToContextMenu);
|
247
|
-
/**
|
248
|
-
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
249
|
-
*
|
250
|
-
* @param {number} row Row index.
|
251
|
-
* @param {number} column Visual column index.
|
252
|
-
* @returns {Array|undefined} Visual coordinates of the merge.
|
253
|
-
*/
|
254
|
-
_classPrivateMethodInitSpec(this, _onModifyGetCellCoords);
|
255
|
-
/**
|
256
|
-
* `modifyTransformEnd` hook callback. Needed to handle "jumping over" merged merged cells, while selecting.
|
257
|
-
*
|
258
|
-
* @param {object} delta The transformation delta.
|
259
|
-
*/
|
260
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformEnd);
|
261
|
-
/**
|
262
|
-
* `modifyTransformStart` hook callback.
|
263
|
-
*
|
264
|
-
* @param {object} delta The transformation delta.
|
265
|
-
*/
|
266
|
-
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
267
|
-
/**
|
268
|
-
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
269
|
-
* hook callback.
|
270
|
-
*
|
271
|
-
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
272
|
-
* @returns {boolean}
|
273
|
-
*/
|
274
|
-
_classPrivateMethodInitSpec(this, _onAfterIsMultipleSelection);
|
275
83
|
/**
|
276
84
|
* `afterInit` hook callback.
|
277
85
|
*/
|
278
|
-
_classPrivateMethodInitSpec(this,
|
86
|
+
_classPrivateMethodInitSpec(this, _MergeCells_brand);
|
279
87
|
/**
|
280
88
|
* A container for all the merged cells.
|
281
89
|
*
|
@@ -298,12 +106,32 @@ class MergeCells extends _base.BasePlugin {
|
|
298
106
|
*/
|
299
107
|
_defineProperty(this, "selectionCalculations", null);
|
300
108
|
/**
|
109
|
+
* The holder for the last selected focus coordinates. This allows keeping the correct coordinates in cases after the
|
110
|
+
* focus is moved out of the merged cell.
|
111
|
+
*
|
301
112
|
* @type {CellCoords}
|
302
113
|
*/
|
303
|
-
_classPrivateFieldInitSpec(this,
|
304
|
-
|
305
|
-
|
114
|
+
_classPrivateFieldInitSpec(this, _lastSelectedFocus, null);
|
115
|
+
/**
|
116
|
+
* The last used transformation delta.
|
117
|
+
*
|
118
|
+
* @type {{ row: number, col: number }}
|
119
|
+
*/
|
120
|
+
_classPrivateFieldInitSpec(this, _lastFocusDelta, {
|
121
|
+
row: 0,
|
122
|
+
col: 0
|
306
123
|
});
|
124
|
+
/**
|
125
|
+
* The module responsible for providing the correct focus order (vertical and horizontal) within a selection that
|
126
|
+
* contains merged cells.
|
127
|
+
*
|
128
|
+
* @type {FocusOrder}
|
129
|
+
*/
|
130
|
+
_classPrivateFieldInitSpec(this, _focusOrder, new _focusOrder2.FocusOrder({
|
131
|
+
mergedCellsGetter: (row, column) => this.mergedCellsCollection.get(row, column),
|
132
|
+
rowIndexMapper: this.hot.rowIndexMapper,
|
133
|
+
columnIndexMapper: this.hot.columnIndexMapper
|
134
|
+
}));
|
307
135
|
}
|
308
136
|
static get PLUGIN_KEY() {
|
309
137
|
return PLUGIN_KEY;
|
@@ -336,145 +164,163 @@ class MergeCells extends _base.BasePlugin {
|
|
336
164
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
337
165
|
args[_key] = arguments[_key];
|
338
166
|
}
|
339
|
-
return
|
167
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterInit).call(_this, ...args);
|
340
168
|
});
|
341
|
-
this.addHook('
|
169
|
+
this.addHook('modifyTransformFocus', function () {
|
342
170
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
343
171
|
args[_key2] = arguments[_key2];
|
344
172
|
}
|
345
|
-
return
|
173
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformFocus).call(_this, ...args);
|
346
174
|
});
|
347
|
-
this.addHook('
|
175
|
+
this.addHook('modifyTransformStart', function () {
|
348
176
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
349
177
|
args[_key3] = arguments[_key3];
|
350
178
|
}
|
351
|
-
return
|
179
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformStart).call(_this, ...args);
|
352
180
|
});
|
353
181
|
this.addHook('modifyTransformEnd', function () {
|
354
182
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
355
183
|
args[_key4] = arguments[_key4];
|
356
184
|
}
|
357
|
-
return
|
185
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyTransformEnd).call(_this, ...args);
|
358
186
|
});
|
359
|
-
this.addHook('
|
187
|
+
this.addHook('beforeSelectionHighlightSet', function () {
|
360
188
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
361
189
|
args[_key5] = arguments[_key5];
|
362
190
|
}
|
363
|
-
return
|
191
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
|
364
192
|
});
|
365
193
|
this.addHook('beforeSetRangeStart', function () {
|
366
194
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
367
195
|
args[_key6] = arguments[_key6];
|
368
196
|
}
|
369
|
-
return
|
197
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
370
198
|
});
|
371
199
|
this.addHook('beforeSetRangeStartOnly', function () {
|
372
200
|
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
373
201
|
args[_key7] = arguments[_key7];
|
374
202
|
}
|
375
|
-
return
|
203
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSetRangeStart).call(_this, ...args);
|
376
204
|
});
|
377
|
-
this.addHook('
|
205
|
+
this.addHook('beforeSelectionFocusSet', function () {
|
378
206
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
379
207
|
args[_key8] = arguments[_key8];
|
380
208
|
}
|
381
|
-
return
|
209
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeSelectionFocusSet).call(_this, ...args);
|
382
210
|
});
|
383
|
-
this.addHook('
|
211
|
+
this.addHook('afterSelectionFocusSet', function () {
|
384
212
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
385
213
|
args[_key9] = arguments[_key9];
|
386
214
|
}
|
387
|
-
return
|
215
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionFocusSet).call(_this, ...args);
|
388
216
|
});
|
389
|
-
this.addHook('
|
217
|
+
this.addHook('afterSelectionEnd', function () {
|
390
218
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
391
219
|
args[_key10] = arguments[_key10];
|
392
220
|
}
|
393
|
-
return
|
221
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterSelectionEnd).call(_this, ...args);
|
394
222
|
});
|
395
|
-
this.addHook('
|
223
|
+
this.addHook('modifyGetCellCoords', function () {
|
396
224
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
397
225
|
args[_key11] = arguments[_key11];
|
398
226
|
}
|
399
|
-
return
|
227
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyGetCellCoords).call(_this, ...args);
|
400
228
|
});
|
401
|
-
this.addHook('
|
229
|
+
this.addHook('afterIsMultipleSelection', function () {
|
402
230
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
403
231
|
args[_key12] = arguments[_key12];
|
404
232
|
}
|
405
|
-
return
|
233
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterIsMultipleSelection).call(_this, ...args);
|
406
234
|
});
|
407
|
-
this.addHook('
|
235
|
+
this.addHook('afterRenderer', function () {
|
408
236
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
409
237
|
args[_key13] = arguments[_key13];
|
410
238
|
}
|
411
|
-
return
|
239
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRenderer).call(_this, ...args);
|
412
240
|
});
|
413
|
-
this.addHook('
|
241
|
+
this.addHook('afterContextMenuDefaultOptions', function () {
|
414
242
|
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
415
243
|
args[_key14] = arguments[_key14];
|
416
244
|
}
|
417
|
-
return
|
245
|
+
return _assertClassBrand(_MergeCells_brand, _this, _addMergeActionsToContextMenu).call(_this, ...args);
|
418
246
|
});
|
419
|
-
this.addHook('
|
247
|
+
this.addHook('afterGetCellMeta', function () {
|
420
248
|
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
421
249
|
args[_key15] = arguments[_key15];
|
422
250
|
}
|
423
|
-
return
|
251
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterGetCellMeta).call(_this, ...args);
|
424
252
|
});
|
425
|
-
this.addHook('
|
253
|
+
this.addHook('afterViewportRowCalculatorOverride', function () {
|
426
254
|
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
427
255
|
args[_key16] = arguments[_key16];
|
428
256
|
}
|
429
|
-
return
|
257
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportRowCalculatorOverride).call(_this, ...args);
|
430
258
|
});
|
431
|
-
this.addHook('
|
259
|
+
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
432
260
|
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
433
261
|
args[_key17] = arguments[_key17];
|
434
262
|
}
|
435
|
-
return
|
263
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterViewportColumnCalculatorOverride).call(_this, ...args);
|
436
264
|
});
|
437
|
-
this.addHook('
|
265
|
+
this.addHook('modifyAutofillRange', function () {
|
438
266
|
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
439
267
|
args[_key18] = arguments[_key18];
|
440
268
|
}
|
441
|
-
return
|
269
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onModifyAutofillRange).call(_this, ...args);
|
442
270
|
});
|
443
|
-
this.addHook('
|
271
|
+
this.addHook('afterCreateCol', function () {
|
444
272
|
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
445
273
|
args[_key19] = arguments[_key19];
|
446
274
|
}
|
447
|
-
return
|
275
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateCol).call(_this, ...args);
|
448
276
|
});
|
449
|
-
this.addHook('
|
277
|
+
this.addHook('afterRemoveCol', function () {
|
450
278
|
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
451
279
|
args[_key20] = arguments[_key20];
|
452
280
|
}
|
453
|
-
return
|
281
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveCol).call(_this, ...args);
|
454
282
|
});
|
455
|
-
this.addHook('
|
283
|
+
this.addHook('afterCreateRow', function () {
|
456
284
|
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
457
285
|
args[_key21] = arguments[_key21];
|
458
286
|
}
|
459
|
-
return
|
287
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterCreateRow).call(_this, ...args);
|
460
288
|
});
|
461
|
-
this.addHook('
|
289
|
+
this.addHook('afterRemoveRow', function () {
|
462
290
|
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
463
291
|
args[_key22] = arguments[_key22];
|
464
292
|
}
|
465
|
-
return
|
293
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterRemoveRow).call(_this, ...args);
|
466
294
|
});
|
467
|
-
this.addHook('
|
295
|
+
this.addHook('afterChange', function () {
|
468
296
|
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
469
297
|
args[_key23] = arguments[_key23];
|
470
298
|
}
|
471
|
-
return
|
299
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterChange).call(_this, ...args);
|
472
300
|
});
|
473
|
-
this.addHook('
|
301
|
+
this.addHook('beforeDrawBorders', function () {
|
474
302
|
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
475
303
|
args[_key24] = arguments[_key24];
|
476
304
|
}
|
477
|
-
return
|
305
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeDrawAreaBorders).call(_this, ...args);
|
306
|
+
});
|
307
|
+
this.addHook('afterDrawSelection', function () {
|
308
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
309
|
+
args[_key25] = arguments[_key25];
|
310
|
+
}
|
311
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onAfterDrawSelection).call(_this, ...args);
|
312
|
+
});
|
313
|
+
this.addHook('beforeRemoveCellClassNames', function () {
|
314
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
315
|
+
args[_key26] = arguments[_key26];
|
316
|
+
}
|
317
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeRemoveCellClassNames).call(_this, ...args);
|
318
|
+
});
|
319
|
+
this.addHook('beforeBeginEditing', function () {
|
320
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
321
|
+
args[_key27] = arguments[_key27];
|
322
|
+
}
|
323
|
+
return _assertClassBrand(_MergeCells_brand, _this, _onBeforeBeginEditing).call(_this, ...args);
|
478
324
|
});
|
479
325
|
this.addHook('beforeUndoStackChange', (action, source) => {
|
480
326
|
if (source === 'MergeCells') {
|
@@ -618,7 +464,9 @@ class MergeCells extends _base.BasePlugin {
|
|
618
464
|
if (populatedNulls.length === 0) {
|
619
465
|
return;
|
620
466
|
}
|
621
|
-
|
467
|
+
|
468
|
+
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
469
|
+
this.hot.setDataAtCell(populatedNulls, undefined, undefined, this.pluginName);
|
622
470
|
}
|
623
471
|
}
|
624
472
|
|
@@ -642,25 +490,6 @@ class MergeCells extends _base.BasePlugin {
|
|
642
490
|
return auto ? true : this.validateSetting(newMergedCellInfo);
|
643
491
|
}
|
644
492
|
|
645
|
-
/**
|
646
|
-
* Merge or unmerge, based on last selected range.
|
647
|
-
*
|
648
|
-
* @private
|
649
|
-
*/
|
650
|
-
toggleMergeOnSelection() {
|
651
|
-
const currentRange = this.hot.getSelectedRangeLast();
|
652
|
-
if (!currentRange) {
|
653
|
-
return;
|
654
|
-
}
|
655
|
-
currentRange.setDirection(this.hot.isRtl() ? 'NE-SW' : 'NW-SE');
|
656
|
-
const {
|
657
|
-
from,
|
658
|
-
to
|
659
|
-
} = currentRange;
|
660
|
-
this.toggleMerge(currentRange);
|
661
|
-
this.hot.selectCell(from.row, from.col, to.row, to.col, false);
|
662
|
-
}
|
663
|
-
|
664
493
|
/**
|
665
494
|
* Merges the selection provided as a cell range.
|
666
495
|
*
|
@@ -749,6 +578,7 @@ class MergeCells extends _base.BasePlugin {
|
|
749
578
|
if (preventPopulation) {
|
750
579
|
populationInfo = [mergeParent.row, mergeParent.col, clearedData];
|
751
580
|
} else {
|
581
|
+
// TODO: Change the `source` argument to a more meaningful value, e.g. `${this.pluginName}.clearCells`.
|
752
582
|
this.hot.populateFromArray(mergeParent.row, mergeParent.col, clearedData, undefined, undefined, this.pluginName);
|
753
583
|
}
|
754
584
|
if (!auto) {
|
@@ -871,6 +701,15 @@ class MergeCells extends _base.BasePlugin {
|
|
871
701
|
const gridContext = shortcutManager.getContext('grid');
|
872
702
|
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
873
703
|
}
|
704
|
+
|
705
|
+
/**
|
706
|
+
* Modifies the information on whether the current selection contains multiple cells. The `afterIsMultipleSelection`
|
707
|
+
* hook callback.
|
708
|
+
*
|
709
|
+
* @param {boolean} isMultiple Determines whether the current selection contains multiple cells.
|
710
|
+
* @returns {boolean}
|
711
|
+
*/
|
712
|
+
|
874
713
|
/**
|
875
714
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
876
715
|
*
|
@@ -927,6 +766,13 @@ class MergeCells extends _base.BasePlugin {
|
|
927
766
|
}
|
928
767
|
}
|
929
768
|
}
|
769
|
+
|
770
|
+
/**
|
771
|
+
* `afterViewportColumnCalculatorOverride` hook callback.
|
772
|
+
*
|
773
|
+
* @param {object} calc The column calculator object.
|
774
|
+
*/
|
775
|
+
|
930
776
|
/**
|
931
777
|
* Modify viewport start when needed. We extend viewport when merged cells aren't fully visible.
|
932
778
|
*
|
@@ -1021,96 +867,218 @@ class MergeCells extends _base.BasePlugin {
|
|
1021
867
|
const renderableColumn = parentColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(firstNonHiddenColumn) : parentColumn;
|
1022
868
|
return [renderableRow, renderableColumn];
|
1023
869
|
}
|
870
|
+
|
871
|
+
/**
|
872
|
+
* The `modifyAutofillRange` hook callback.
|
873
|
+
*
|
874
|
+
* @param {Array} drag The drag area coordinates.
|
875
|
+
* @param {Array} select The selection information.
|
876
|
+
* @returns {Array} The new drag area.
|
877
|
+
*/
|
1024
878
|
}
|
1025
879
|
exports.MergeCells = MergeCells;
|
1026
|
-
function
|
880
|
+
function _onAfterInit() {
|
1027
881
|
this.generateFromSettings(this.hot.getSettings()[PLUGIN_KEY]);
|
1028
882
|
this.hot.render();
|
1029
883
|
}
|
1030
|
-
function
|
884
|
+
function _onAfterIsMultipleSelection(isMultiple) {
|
1031
885
|
if (isMultiple) {
|
1032
886
|
const mergedCells = this.mergedCellsCollection.mergedCells;
|
1033
887
|
const selectionRange = this.hot.getSelectedRangeLast();
|
888
|
+
const topStartCoords = selectionRange.getTopStartCorner();
|
889
|
+
const bottomEndCoords = selectionRange.getBottomEndCorner();
|
1034
890
|
for (let group = 0; group < mergedCells.length; group += 1) {
|
1035
|
-
if (
|
891
|
+
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) {
|
1036
892
|
return false;
|
1037
893
|
}
|
1038
894
|
}
|
1039
895
|
}
|
1040
896
|
return isMultiple;
|
1041
897
|
}
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
898
|
+
/**
|
899
|
+
* `modifyTransformFocus` hook callback.
|
900
|
+
*
|
901
|
+
* @param {object} delta The transformation delta.
|
902
|
+
*/
|
903
|
+
function _onModifyTransformFocus(delta) {
|
904
|
+
_classPrivateFieldGet(_lastFocusDelta, this).row = delta.row;
|
905
|
+
_classPrivateFieldGet(_lastFocusDelta, this).col = delta.col;
|
906
|
+
}
|
907
|
+
/**
|
908
|
+
* `modifyTransformStart` hook callback.
|
909
|
+
*
|
910
|
+
* @param {object} delta The transformation delta.
|
911
|
+
*/
|
912
|
+
function _onModifyTransformStart(delta) {
|
913
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
914
|
+
const {
|
915
|
+
highlight
|
916
|
+
} = selectedRange;
|
917
|
+
const {
|
918
|
+
columnIndexMapper,
|
919
|
+
rowIndexMapper
|
920
|
+
} = this.hot;
|
921
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this)) {
|
922
|
+
if (rowIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).row) !== null) {
|
923
|
+
highlight.row = _classPrivateFieldGet(_lastSelectedFocus, this).row;
|
924
|
+
}
|
925
|
+
if (columnIndexMapper.getRenderableFromVisualIndex(_classPrivateFieldGet(_lastSelectedFocus, this).col) !== null) {
|
926
|
+
highlight.col = _classPrivateFieldGet(_lastSelectedFocus, this).col;
|
927
|
+
}
|
928
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
929
|
+
}
|
930
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
931
|
+
if (!mergedParent) {
|
932
|
+
return;
|
933
|
+
}
|
934
|
+
const visualColumnIndexStart = mergedParent.col;
|
935
|
+
const visualColumnIndexEnd = mergedParent.col + mergedParent.colspan - 1;
|
936
|
+
if (delta.col < 0) {
|
937
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
938
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
939
|
+
if (notHiddenColumnIndex === null) {
|
940
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
941
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
942
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
943
|
+
} else {
|
944
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
945
|
+
}
|
946
|
+
} else if (delta.col > 0) {
|
947
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
948
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
949
|
+
if (notHiddenColumnIndex === null) {
|
950
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
951
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
952
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
953
|
+
} else {
|
954
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
955
|
+
}
|
956
|
+
}
|
957
|
+
const visualRowIndexStart = mergedParent.row;
|
958
|
+
const visualRowIndexEnd = mergedParent.row + mergedParent.rowspan - 1;
|
959
|
+
if (delta.row < 0) {
|
960
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexStart - 1 : visualRowIndexEnd;
|
961
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
962
|
+
if (notHiddenRowIndex === null) {
|
963
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
964
|
+
// be processed by the selection Transformer class as a move selection to the previous column (if autoWrapCol is enabled).
|
965
|
+
delta.row = -this.hot.view.countRenderableRowsInRange(0, highlight.row);
|
966
|
+
} else {
|
967
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, highlight.row) - 1, 1);
|
968
|
+
}
|
969
|
+
} else if (delta.row > 0) {
|
970
|
+
const nextRow = highlight.row >= visualRowIndexStart && highlight.row <= visualRowIndexEnd ? visualRowIndexEnd + 1 : visualRowIndexStart;
|
971
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
972
|
+
if (notHiddenRowIndex === null) {
|
973
|
+
// There are no visible rows anymore, so move the selection out of the table edge. This will
|
974
|
+
// be processed by the selection Transformer class as a move selection to the next column (if autoWrapCol is enabled).
|
975
|
+
delta.row = this.hot.view.countRenderableRowsInRange(highlight.row, this.hot.countRows());
|
976
|
+
} else {
|
977
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(highlight.row, notHiddenRowIndex) - 1, 1);
|
978
|
+
}
|
979
|
+
}
|
980
|
+
}
|
981
|
+
/**
|
982
|
+
* The hook allows to modify the delta transformation object necessary for correct selection end transformations.
|
983
|
+
* The logic here handles "jumping over" merged merged cells, while selecting.
|
984
|
+
*
|
985
|
+
* @param {{ row: number, col: number }} delta The transformation delta.
|
986
|
+
*/
|
987
|
+
function _onModifyTransformEnd(delta) {
|
988
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
989
|
+
const cloneRange = selectedRange.clone();
|
990
|
+
const {
|
991
|
+
to
|
992
|
+
} = selectedRange;
|
993
|
+
const {
|
994
|
+
columnIndexMapper,
|
995
|
+
rowIndexMapper
|
996
|
+
} = this.hot;
|
997
|
+
const expandCloneRange = (row, col) => {
|
998
|
+
cloneRange.expand(this.hot._createCellCoords(row, col));
|
999
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1000
|
+
cloneRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange());
|
1001
|
+
}
|
1047
1002
|
};
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1003
|
+
if (delta.col < 0) {
|
1004
|
+
let nextColumn = this.mergedCellsCollection.getStartMostColumnIndex(selectedRange, to.col) + delta.col;
|
1005
|
+
expandCloneRange(to.row, nextColumn);
|
1006
|
+
if (selectedRange.getHorizontalDirection() === 'E-W' && cloneRange.getHorizontalDirection() === 'E-W') {
|
1007
|
+
nextColumn = cloneRange.getTopStartCorner().col;
|
1008
|
+
}
|
1009
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
1010
|
+
if (notHiddenColumnIndex !== null) {
|
1011
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, to.col) - 1, 1);
|
1012
|
+
}
|
1013
|
+
} else if (delta.col > 0) {
|
1014
|
+
let nextColumn = this.mergedCellsCollection.getEndMostColumnIndex(selectedRange, to.col) + delta.col;
|
1015
|
+
expandCloneRange(to.row, nextColumn);
|
1016
|
+
if (selectedRange.getHorizontalDirection() === 'W-E' && cloneRange.getHorizontalDirection() === 'W-E') {
|
1017
|
+
nextColumn = cloneRange.getBottomEndCorner().col;
|
1018
|
+
}
|
1019
|
+
const notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
1020
|
+
if (notHiddenColumnIndex !== null) {
|
1021
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(to.col, notHiddenColumnIndex) - 1, 1);
|
1022
|
+
}
|
1053
1023
|
}
|
1054
|
-
if (
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
if (!mergeRange.includes(_classPrivateFieldGet(this, _lastDesiredCoords))) {
|
1060
|
-
_classPrivateFieldSet(this, _lastDesiredCoords, this.hot._createCellCoords(null, null)); // reset outdated version of lastDesiredCoords
|
1024
|
+
if (delta.row < 0) {
|
1025
|
+
let nextRow = this.mergedCellsCollection.getTopMostRowIndex(selectedRange, to.row) + delta.row;
|
1026
|
+
expandCloneRange(nextRow, to.col);
|
1027
|
+
if (selectedRange.getVerticalDirection() === 'S-N' && cloneRange.getVerticalDirection() === 'S-N') {
|
1028
|
+
nextRow = cloneRange.getTopStartCorner().row;
|
1061
1029
|
}
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
// moving down
|
1066
|
-
newDelta.row = mergedParent.row + mergedParent.rowspan - 1 - currentPosition.row + delta.row;
|
1067
|
-
} else if (delta.row < 0) {
|
1068
|
-
// moving up
|
1069
|
-
newDelta.row = currentPosition.row - mergedParent.row + delta.row;
|
1030
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, 1);
|
1031
|
+
if (notHiddenRowIndex !== null) {
|
1032
|
+
delta.row = -Math.max(this.hot.view.countRenderableRowsInRange(notHiddenRowIndex, to.row) - 1, 1);
|
1070
1033
|
}
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1034
|
+
} else if (delta.row > 0) {
|
1035
|
+
let nextRow = this.mergedCellsCollection.getBottomMostRowIndex(selectedRange, to.row) + delta.row;
|
1036
|
+
expandCloneRange(nextRow, to.col);
|
1037
|
+
if (selectedRange.getVerticalDirection() === 'N-S' && cloneRange.getVerticalDirection() === 'N-S') {
|
1038
|
+
nextRow = cloneRange.getBottomStartCorner().row;
|
1039
|
+
}
|
1040
|
+
const notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(nextRow, -1);
|
1041
|
+
if (notHiddenRowIndex !== null) {
|
1042
|
+
delta.row = Math.max(this.hot.view.countRenderableRowsInRange(to.row, notHiddenRowIndex) - 1, 1);
|
1077
1043
|
}
|
1078
1044
|
}
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1045
|
+
}
|
1046
|
+
/**
|
1047
|
+
* The hook corrects the range (before drawing it) after the selection was made on the merged cells.
|
1048
|
+
* It expands the range to cover the entire area of the selected merged cells.
|
1049
|
+
*/
|
1050
|
+
function _onBeforeSelectionHighlightSet() {
|
1051
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1052
|
+
const {
|
1053
|
+
highlight
|
1054
|
+
} = selectedRange;
|
1055
|
+
if (this.hot.selection.isSelectedByColumnHeader() || this.hot.selection.isSelectedByRowHeader()) {
|
1056
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1057
|
+
return;
|
1089
1058
|
}
|
1090
|
-
|
1091
|
-
|
1059
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1060
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1092
1061
|
}
|
1093
|
-
|
1094
|
-
|
1062
|
+
// TODO: This is a workaround for an issue with the selection not being extended properly.
|
1063
|
+
// In some cases when the merge cells are defined in random order the selection is not
|
1064
|
+
// extended in that way that it covers all overlapped merge cells.
|
1065
|
+
for (let i = 0; i < this.mergedCellsCollection.mergedCells.length; i += 1) {
|
1066
|
+
selectedRange.expandByRange(this.mergedCellsCollection.mergedCells[i].getRange(), false);
|
1067
|
+
}
|
1068
|
+
const mergedParent = this.mergedCellsCollection.get(highlight.row, highlight.col);
|
1069
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, highlight.clone());
|
1070
|
+
if (mergedParent) {
|
1071
|
+
highlight.assign(mergedParent);
|
1095
1072
|
}
|
1096
1073
|
}
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
this.selectionCalculations.getUpdatedSelectionRange(currentSelectionRange, newDelta);
|
1106
|
-
(0, _array.arrayEach)(mergedCellsWithinRange, mergedCell => {
|
1107
|
-
this.selectionCalculations.snapDelta(newDelta, currentSelectionRange, mergedCell);
|
1108
|
-
});
|
1109
|
-
} while (newDelta.row !== tempDelta.row || newDelta.col !== tempDelta.col);
|
1110
|
-
delta.row = newDelta.row;
|
1111
|
-
delta.col = newDelta.col;
|
1112
|
-
}
|
1113
|
-
function _onModifyGetCellCoords2(row, column) {
|
1074
|
+
/**
|
1075
|
+
* `modifyGetCellCoords` hook callback. Swaps the `getCell` coords with the merged parent coords.
|
1076
|
+
*
|
1077
|
+
* @param {number} row Row index.
|
1078
|
+
* @param {number} column Visual column index.
|
1079
|
+
* @returns {Array|undefined} Visual coordinates of the merge.
|
1080
|
+
*/
|
1081
|
+
function _onModifyGetCellCoords(row, column) {
|
1114
1082
|
if (row < 0 || column < 0) {
|
1115
1083
|
return;
|
1116
1084
|
}
|
@@ -1130,12 +1098,24 @@ function _onModifyGetCellCoords2(row, column) {
|
|
1130
1098
|
// Most bottom-right merged cell coords.
|
1131
1099
|
mergeRow + rowspan - 1, mergeColumn + colspan - 1];
|
1132
1100
|
}
|
1133
|
-
|
1101
|
+
/**
|
1102
|
+
* `afterContextMenuDefaultOptions` hook callback.
|
1103
|
+
*
|
1104
|
+
* @param {object} defaultOptions The default context menu options.
|
1105
|
+
*/
|
1106
|
+
function _addMergeActionsToContextMenu(defaultOptions) {
|
1134
1107
|
defaultOptions.items.push({
|
1135
1108
|
name: '---------'
|
1136
1109
|
}, (0, _toggleMerge.default)(this));
|
1137
1110
|
}
|
1138
|
-
|
1111
|
+
/**
|
1112
|
+
* `afterRenderer` hook callback.
|
1113
|
+
*
|
1114
|
+
* @param {HTMLElement} TD The cell to be modified.
|
1115
|
+
* @param {number} row Row index.
|
1116
|
+
* @param {number} col Visual column index.
|
1117
|
+
*/
|
1118
|
+
function _onAfterRenderer(TD, row, col) {
|
1139
1119
|
const mergedCell = this.mergedCellsCollection.get(row, col);
|
1140
1120
|
// We shouldn't override data in the collection.
|
1141
1121
|
const mergedCellCopy = (0, _object.isObject)(mergedCell) ? (0, _object.clone)(mergedCell) : undefined;
|
@@ -1167,39 +1147,114 @@ function _onAfterRenderer2(TD, row, col) {
|
|
1167
1147
|
}
|
1168
1148
|
(0, _utils.applySpanProperties)(TD, mergedCellCopy, row, col);
|
1169
1149
|
}
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
// and what was idea for flipping direction inside `expandByRange` method.
|
1176
|
-
if (this.mergedCellsCollection.isFirstRenderableMergedCell(coords.row, coords.col)) {
|
1177
|
-
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1178
|
-
[coords.row, coords.col] = [mergeParent.row, mergeParent.col];
|
1179
|
-
}
|
1150
|
+
/**
|
1151
|
+
* Clears the last selected coordinates before setting a new selection range.
|
1152
|
+
*/
|
1153
|
+
function _onBeforeSetRangeStart() {
|
1154
|
+
_classPrivateFieldSet(_lastSelectedFocus, this, null);
|
1180
1155
|
}
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
if (
|
1156
|
+
/**
|
1157
|
+
* Detects if the last selected cell was a header cell if so update the order list active node for further
|
1158
|
+
* computations.
|
1159
|
+
*/
|
1160
|
+
function _onBeforeSelectionFocusSet() {
|
1161
|
+
if (_classPrivateFieldGet(_lastSelectedFocus, this).isCell()) {
|
1187
1162
|
return;
|
1188
1163
|
}
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1164
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1165
|
+
const verticalDir = selectedRange.getVerticalDirection();
|
1166
|
+
const horizontalDir = selectedRange.getHorizontalDirection();
|
1167
|
+
const focusCoords = _classPrivateFieldGet(_lastSelectedFocus, this).clone().normalize();
|
1168
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(focusCoords.row, focusCoords.col);
|
1169
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0 || _classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1170
|
+
_classPrivateFieldGet(_focusOrder, this).setPrevNodeAsActive();
|
1171
|
+
} else if (horizontalDir === 'E-W' && _classPrivateFieldGet(_lastFocusDelta, this).col < 0 || verticalDir === 'S-N' && _classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1172
|
+
_classPrivateFieldGet(_focusOrder, this).setNextNodeAsActive();
|
1173
|
+
}
|
1174
|
+
}
|
1175
|
+
/**
|
1176
|
+
* Changes the focus selection to the next or previous cell or merged cell position.
|
1177
|
+
*
|
1178
|
+
* @param {number} row The visual row index.
|
1179
|
+
* @param {number} column The visual column index.
|
1180
|
+
*/
|
1181
|
+
function _onAfterSelectionFocusSet(row, column) {
|
1182
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
1183
|
+
const {
|
1184
|
+
columnIndexMapper,
|
1185
|
+
rowIndexMapper
|
1186
|
+
} = this.hot;
|
1187
|
+
let notHiddenRowIndex = null;
|
1188
|
+
let notHiddenColumnIndex = null;
|
1189
|
+
if (_classPrivateFieldGet(_lastFocusDelta, this).col < 0) {
|
1190
|
+
const {
|
1191
|
+
rowEnd,
|
1192
|
+
colEnd
|
1193
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevHorizontalNode();
|
1194
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1195
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1196
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).col > 0) {
|
1197
|
+
const {
|
1198
|
+
rowStart,
|
1199
|
+
colStart
|
1200
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextHorizontalNode();
|
1201
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1202
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1203
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row < 0) {
|
1204
|
+
const {
|
1205
|
+
rowEnd,
|
1206
|
+
colEnd
|
1207
|
+
} = _classPrivateFieldGet(_focusOrder, this).getPrevVerticalNode();
|
1208
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colEnd, -1);
|
1209
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowEnd, -1);
|
1210
|
+
} else if (_classPrivateFieldGet(_lastFocusDelta, this).row > 0) {
|
1211
|
+
const {
|
1212
|
+
rowStart,
|
1213
|
+
colStart
|
1214
|
+
} = _classPrivateFieldGet(_focusOrder, this).getNextVerticalNode();
|
1215
|
+
notHiddenColumnIndex = columnIndexMapper.getNearestNotHiddenIndex(colStart, 1);
|
1216
|
+
notHiddenRowIndex = rowIndexMapper.getNearestNotHiddenIndex(rowStart, 1);
|
1217
|
+
}
|
1218
|
+
if (notHiddenRowIndex !== null || notHiddenColumnIndex !== null) {
|
1219
|
+
const coords = this.hot._createCellCoords(notHiddenRowIndex, notHiddenColumnIndex);
|
1220
|
+
const mergeParent = this.mergedCellsCollection.get(coords.row, coords.col);
|
1221
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
1222
|
+
row = coords.row;
|
1223
|
+
column = coords.col;
|
1224
|
+
if (mergeParent) {
|
1225
|
+
selectedRange.highlight.assign({
|
1226
|
+
row: this.hot.rowIndexMapper.getNearestNotHiddenIndex(mergeParent.row, 1),
|
1227
|
+
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(mergeParent.col, 1)
|
1228
|
+
});
|
1229
|
+
} else {
|
1230
|
+
selectedRange.highlight.assign(coords);
|
1199
1231
|
}
|
1200
|
-
|
1232
|
+
focusHighlight.clear();
|
1233
|
+
focusHighlight.add(coords).commit();
|
1234
|
+
}
|
1235
|
+
_classPrivateFieldGet(_focusOrder, this).setActiveNode(row, column);
|
1236
|
+
_classPrivateFieldSet(_lastFocusDelta, this, {
|
1237
|
+
row: 0,
|
1238
|
+
col: 0
|
1239
|
+
});
|
1201
1240
|
}
|
1202
|
-
|
1241
|
+
/**
|
1242
|
+
* Creates the horizontal and vertical cells order matrix (linked lists) for focused cell.
|
1243
|
+
*/
|
1244
|
+
function _onAfterSelectionEnd() {
|
1245
|
+
const selection = this.hot.getSelectedRangeLast();
|
1246
|
+
if (!selection.isHeader()) {
|
1247
|
+
_classPrivateFieldGet(_focusOrder, this).buildFocusOrder(this.hot.getSelectedRangeLast());
|
1248
|
+
}
|
1249
|
+
}
|
1250
|
+
/**
|
1251
|
+
* The `afterGetCellMeta` hook callback.
|
1252
|
+
*
|
1253
|
+
* @param {number} row Row index.
|
1254
|
+
* @param {number} col Column index.
|
1255
|
+
* @param {object} cellProperties The cell properties object.
|
1256
|
+
*/
|
1257
|
+
function _onAfterGetCellMeta(row, col, cellProperties) {
|
1203
1258
|
const mergeParent = this.mergedCellsCollection.get(row, col);
|
1204
1259
|
if (mergeParent) {
|
1205
1260
|
if (mergeParent.row !== row || mergeParent.col !== col) {
|
@@ -1210,17 +1265,22 @@ function _onAfterGetCellMeta2(row, col, cellProperties) {
|
|
1210
1265
|
}
|
1211
1266
|
}
|
1212
1267
|
}
|
1213
|
-
|
1268
|
+
/**
|
1269
|
+
* `afterViewportRowCalculatorOverride` hook callback.
|
1270
|
+
*
|
1271
|
+
* @param {object} calc The row calculator object.
|
1272
|
+
*/
|
1273
|
+
function _onAfterViewportRowCalculatorOverride(calc) {
|
1214
1274
|
const nrOfColumns = this.hot.countCols();
|
1215
1275
|
this.modifyViewportRowStart(calc, nrOfColumns);
|
1216
1276
|
this.modifyViewportRowEnd(calc, nrOfColumns);
|
1217
1277
|
}
|
1218
|
-
function
|
1278
|
+
function _onAfterViewportColumnCalculatorOverride(calc) {
|
1219
1279
|
const nrOfRows = this.hot.countRows();
|
1220
1280
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1221
1281
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1222
1282
|
}
|
1223
|
-
function
|
1283
|
+
function _onModifyAutofillRange(drag, select) {
|
1224
1284
|
this.autofillCalculations.correctSelectionAreaSize(select);
|
1225
1285
|
const dragDirection = this.autofillCalculations.getDirection(select, drag);
|
1226
1286
|
let dragArea = drag;
|
@@ -1244,28 +1304,65 @@ function _onModifyAutofillRange2(drag, select) {
|
|
1244
1304
|
dragArea = this.autofillCalculations.snapDragArea(select, dragArea, dragDirection, mergedCellsWithinSelectionArea);
|
1245
1305
|
return dragArea;
|
1246
1306
|
}
|
1247
|
-
|
1307
|
+
/**
|
1308
|
+
* `afterCreateCol` hook callback.
|
1309
|
+
*
|
1310
|
+
* @param {number} column Column index.
|
1311
|
+
* @param {number} count Number of created columns.
|
1312
|
+
*/
|
1313
|
+
function _onAfterCreateCol(column, count) {
|
1248
1314
|
this.mergedCellsCollection.shiftCollections('right', column, count);
|
1249
1315
|
}
|
1250
|
-
|
1316
|
+
/**
|
1317
|
+
* `afterRemoveCol` hook callback.
|
1318
|
+
*
|
1319
|
+
* @param {number} column Column index.
|
1320
|
+
* @param {number} count Number of removed columns.
|
1321
|
+
*/
|
1322
|
+
function _onAfterRemoveCol(column, count) {
|
1251
1323
|
this.mergedCellsCollection.shiftCollections('left', column, count);
|
1252
1324
|
}
|
1253
|
-
|
1325
|
+
/**
|
1326
|
+
* `afterCreateRow` hook callback.
|
1327
|
+
*
|
1328
|
+
* @param {number} row Row index.
|
1329
|
+
* @param {number} count Number of created rows.
|
1330
|
+
* @param {string} source Source of change.
|
1331
|
+
*/
|
1332
|
+
function _onAfterCreateRow(row, count, source) {
|
1254
1333
|
if (source === 'auto') {
|
1255
1334
|
return;
|
1256
1335
|
}
|
1257
1336
|
this.mergedCellsCollection.shiftCollections('down', row, count);
|
1258
1337
|
}
|
1259
|
-
|
1338
|
+
/**
|
1339
|
+
* `afterRemoveRow` hook callback.
|
1340
|
+
*
|
1341
|
+
* @param {number} row Row index.
|
1342
|
+
* @param {number} count Number of removed rows.
|
1343
|
+
*/
|
1344
|
+
function _onAfterRemoveRow(row, count) {
|
1260
1345
|
this.mergedCellsCollection.shiftCollections('up', row, count);
|
1261
1346
|
}
|
1262
|
-
|
1347
|
+
/**
|
1348
|
+
* `afterChange` hook callback. Used to propagate merged cells after using Autofill.
|
1349
|
+
*
|
1350
|
+
* @param {Array} changes The changes array.
|
1351
|
+
* @param {string} source Determines the source of the change.
|
1352
|
+
*/
|
1353
|
+
function _onAfterChange(changes, source) {
|
1263
1354
|
if (source !== 'Autofill.fill') {
|
1264
1355
|
return;
|
1265
1356
|
}
|
1266
1357
|
this.autofillCalculations.recreateAfterDataPopulation(changes);
|
1267
1358
|
}
|
1268
|
-
|
1359
|
+
/**
|
1360
|
+
* `beforeDrawAreaBorders` hook callback.
|
1361
|
+
*
|
1362
|
+
* @param {Array} corners Visual coordinates of the area corners.
|
1363
|
+
* @param {string} className Class name for the area.
|
1364
|
+
*/
|
1365
|
+
function _onBeforeDrawAreaBorders(corners, className) {
|
1269
1366
|
if (className && className === 'area') {
|
1270
1367
|
const selectedRange = this.hot.getSelectedRangeLast();
|
1271
1368
|
const mergedCellsWithinRange = this.mergedCellsCollection.getWithinRange(selectedRange);
|
@@ -1277,38 +1374,43 @@ function _onBeforeDrawAreaBorders2(corners, className) {
|
|
1277
1374
|
});
|
1278
1375
|
}
|
1279
1376
|
}
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
const mergedCellOnBottomEdge = mergedCellAtCoords.row + mergedCellAtCoords.rowspan - 1 === this.hot.countRows() - 1;
|
1293
|
-
const mergedCellOnTopEdge = mergedCellAtCoords.row === 0;
|
1294
|
-
const mergedCellOnRightEdge = mergedCellAtCoords.col + mergedCellAtCoords.colspan - 1 === this.hot.countCols() - 1;
|
1295
|
-
const mergedCellOnLeftEdge = mergedCellAtCoords.col === 0;
|
1296
|
-
if (goingDown && mergedCellOnBottomEdge || goingUp && mergedCellOnTopEdge || goingRight && mergedCellOnRightEdge || goingLeft && mergedCellOnLeftEdge) {
|
1297
|
-
coords.row = mergedCellAtCoords.row;
|
1298
|
-
coords.col = mergedCellAtCoords.col;
|
1299
|
-
}
|
1300
|
-
}
|
1301
|
-
function _onAfterDrawSelection2(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1377
|
+
/**
|
1378
|
+
* `afterDrawSelection` hook callback. Used to add the additional class name for the entirely-selected merged cells.
|
1379
|
+
*
|
1380
|
+
* @param {number} currentRow Visual row index of the currently processed cell.
|
1381
|
+
* @param {number} currentColumn Visual column index of the currently cell.
|
1382
|
+
* @param {Array} cornersOfSelection Array of the current selection in a form of `[startRow, startColumn, endRow,
|
1383
|
+
* endColumn]`.
|
1384
|
+
* @param {number|undefined} layerLevel Number indicating which layer of selection is currently processed.
|
1385
|
+
* @returns {string|undefined} A `String`, which will act as an additional `className` to be added to the currently
|
1386
|
+
* processed cell.
|
1387
|
+
*/
|
1388
|
+
function _onAfterDrawSelection(currentRow, currentColumn, cornersOfSelection, layerLevel) {
|
1302
1389
|
// Nothing's selected (hook might be triggered by the custom borders)
|
1303
1390
|
if (!cornersOfSelection) {
|
1304
1391
|
return;
|
1305
1392
|
}
|
1306
1393
|
return this.selectionCalculations.getSelectedMergedCellClassName(currentRow, currentColumn, cornersOfSelection, layerLevel);
|
1307
1394
|
}
|
1308
|
-
|
1395
|
+
/**
|
1396
|
+
* `beforeRemoveCellClassNames` hook callback. Used to remove additional class name from all cells in the table.
|
1397
|
+
*
|
1398
|
+
* @returns {string[]} An `Array` of `String`s. Each of these strings will act like class names to be removed from
|
1399
|
+
* all the cells in the table.
|
1400
|
+
*/
|
1401
|
+
function _onBeforeRemoveCellClassNames() {
|
1309
1402
|
return this.selectionCalculations.getSelectedMergedCellClassNameToRemove();
|
1310
1403
|
}
|
1311
|
-
|
1404
|
+
/**
|
1405
|
+
* Allows to prevent opening the editor while more than one merged cell is selected.
|
1406
|
+
*
|
1407
|
+
* @param {number} row Visual row index of the edited cell.
|
1408
|
+
* @param {number} column Visual column index of the edited cell.
|
1409
|
+
* @param {string | null} initialValue The initial editor value.
|
1410
|
+
* @param {MouseEvent | KeyboardEvent} event The event which was responsible for opening the editor.
|
1411
|
+
* @returns {boolean | undefined}
|
1412
|
+
*/
|
1413
|
+
function _onBeforeBeginEditing(row, column, initialValue, event) {
|
1312
1414
|
if (!(event instanceof MouseEvent)) {
|
1313
1415
|
return;
|
1314
1416
|
}
|