handsontable 0.0.0-next-b66c79f-20230713 → 0.0.0-next-08765b9-20230714
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +87 -33
- package/3rdparty/walkontable/src/cell/coords.mjs +87 -33
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +92 -46
- package/3rdparty/walkontable/src/cell/range.mjs +92 -46
- package/3rdparty/walkontable/src/core/_base.js +41 -33
- package/3rdparty/walkontable/src/core/_base.mjs +41 -33
- package/3rdparty/walkontable/src/core/clone.js +8 -5
- package/3rdparty/walkontable/src/core/clone.mjs +8 -5
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +9 -8
- package/3rdparty/walkontable/src/event.mjs +9 -8
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +11 -9
- package/3rdparty/walkontable/src/overlay/_base.mjs +11 -9
- package/3rdparty/walkontable/src/overlay/bottom.js +10 -8
- package/3rdparty/walkontable/src/overlay/bottom.mjs +10 -8
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
- package/3rdparty/walkontable/src/overlay/top.js +12 -14
- package/3rdparty/walkontable/src/overlay/top.mjs +12 -14
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +16 -13
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +16 -13
- package/3rdparty/walkontable/src/overlays.js +75 -80
- package/3rdparty/walkontable/src/overlays.mjs +75 -80
- package/3rdparty/walkontable/src/scroll.js +27 -24
- package/3rdparty/walkontable/src/scroll.mjs +27 -24
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
- package/3rdparty/walkontable/src/selection/constants.js +62 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +26 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +259 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +254 -0
- package/3rdparty/walkontable/src/selection/scanner.js +270 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
- package/3rdparty/walkontable/src/selection/selection.js +101 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
- package/3rdparty/walkontable/src/settings.js +18 -17
- package/3rdparty/walkontable/src/settings.mjs +18 -17
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +48 -115
- package/3rdparty/walkontable/src/table.mjs +49 -116
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/focusDetector.js +58 -0
- package/core/focusCatcher/focusDetector.mjs +54 -0
- package/core/focusCatcher/index.js +142 -0
- package/core/focusCatcher/index.mjs +138 -0
- package/core/index.js +9 -0
- package/core/index.mjs +1 -0
- package/core.d.ts +6 -3
- package/core.js +181 -298
- package/core.mjs +181 -298
- package/dataMap/metaManager/metaLayers/cellMeta.js +2 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +1 -1
- package/dataMap/metaManager/metaSchema.js +41 -0
- package/dataMap/metaManager/metaSchema.mjs +41 -0
- package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +3 -2
- package/dataMap/metaManager/utils.js +4 -2
- package/dataMap/metaManager/utils.mjs +4 -2
- package/dist/handsontable.css +19 -3
- package/dist/handsontable.full.css +19 -3
- package/dist/handsontable.full.js +10739 -7037
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +25 -25
- package/dist/handsontable.js +24884 -21182
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +11 -75
- package/editorManager.mjs +11 -74
- package/editors/autocompleteEditor/autocompleteEditor.js +70 -67
- package/editors/autocompleteEditor/autocompleteEditor.mjs +70 -67
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +2 -1
- package/editors/dateEditor/dateEditor.mjs +2 -1
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/helpers/object.js +1 -0
- package/helpers/object.mjs +1 -0
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +1 -1
- package/pluginHooks.d.ts +7 -1
- package/pluginHooks.js +106 -1
- package/pluginHooks.mjs +106 -1
- package/plugins/autoColumnSize/autoColumnSize.js +4 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +4 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +110 -40
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +110 -40
- package/plugins/columnSorting/columnSorting.js +40 -1
- package/plugins/columnSorting/columnSorting.mjs +40 -3
- package/plugins/columnSorting/columnStatesManager.js +2 -1
- package/plugins/columnSorting/columnStatesManager.mjs +2 -1
- package/plugins/columnSorting/index.js +3 -1
- package/plugins/columnSorting/index.mjs +1 -1
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +253 -191
- package/plugins/comments/comments.mjs +252 -192
- package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
- package/plugins/comments/contextMenuItem/removeComment.js +38 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +72 -30
- package/plugins/contextMenu/contextMenu.mjs +73 -31
- package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
- package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
- package/plugins/contextMenu/utils.js +28 -16
- package/plugins/contextMenu/utils.mjs +27 -15
- package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
- package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
- package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
- package/plugins/copyPaste/copyPaste.js +12 -6
- package/plugins/copyPaste/copyPaste.mjs +12 -6
- package/plugins/customBorders/customBorders.js +36 -29
- package/plugins/customBorders/customBorders.mjs +37 -30
- package/plugins/customBorders/utils.js +3 -3
- package/plugins/customBorders/utils.mjs +3 -3
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +89 -32
- package/plugins/dropdownMenu/dropdownMenu.mjs +89 -32
- package/plugins/filters/conditionCollection.js +6 -5
- package/plugins/filters/conditionCollection.mjs +6 -5
- package/plugins/filters/filters.js +44 -21
- package/plugins/filters/filters.mjs +43 -20
- package/plugins/formulas/engine/register.js +3 -3
- package/plugins/formulas/engine/register.mjs +3 -3
- package/plugins/formulas/engine/settings.js +6 -3
- package/plugins/formulas/engine/settings.mjs +6 -3
- package/plugins/formulas/formulas.js +151 -143
- package/plugins/formulas/formulas.mjs +151 -143
- package/plugins/formulas/indexSyncer/axisSyncer.js +115 -79
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +115 -79
- package/plugins/formulas/indexSyncer/index.js +100 -64
- package/plugins/formulas/indexSyncer/index.mjs +100 -64
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +2 -2
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +2 -2
- package/plugins/hiddenColumns/hiddenColumns.js +51 -34
- package/plugins/hiddenColumns/hiddenColumns.mjs +51 -34
- package/plugins/hiddenRows/contextMenuItem/showRow.js +2 -2
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +2 -2
- package/plugins/hiddenRows/hiddenRows.js +50 -33
- package/plugins/hiddenRows/hiddenRows.mjs +50 -33
- package/plugins/manualRowResize/manualRowResize.js +2 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -1
- package/plugins/mergeCells/mergeCells.js +6 -17
- package/plugins/mergeCells/mergeCells.mjs +6 -17
- package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
- package/plugins/nestedHeaders/nestedHeaders.js +209 -75
- package/plugins/nestedHeaders/nestedHeaders.mjs +208 -74
- package/plugins/nestedHeaders/stateManager/headersTree.js +58 -38
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +58 -38
- package/plugins/nestedHeaders/stateManager/index.js +107 -49
- package/plugins/nestedHeaders/stateManager/index.mjs +105 -47
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +1 -1
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +57 -37
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +57 -37
- package/plugins/nestedHeaders/utils/ghostTable.js +39 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +39 -35
- package/plugins/nestedRows/data/dataManager.js +4 -2
- package/plugins/nestedRows/data/dataManager.mjs +4 -2
- package/plugins/nestedRows/nestedRows.js +41 -0
- package/plugins/nestedRows/nestedRows.mjs +41 -0
- package/plugins/persistentState/storage.js +1 -0
- package/plugins/persistentState/storage.mjs +1 -0
- package/plugins/undoRedo/undoRedo.js +2 -1
- package/plugins/undoRedo/undoRedo.mjs +2 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +256 -71
- package/selection/highlight/highlight.mjs +250 -71
- package/selection/highlight/types/activeHeader.js +10 -8
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +6 -18
- package/selection/highlight/types/area.mjs +6 -18
- package/selection/highlight/types/areaLayered.js +31 -0
- package/selection/highlight/types/areaLayered.mjs +26 -0
- package/selection/highlight/types/column.js +27 -0
- package/selection/highlight/types/column.mjs +22 -0
- package/selection/highlight/types/customSelection.js +7 -9
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -7
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -7
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +9 -18
- package/selection/highlight/types/header.mjs +9 -18
- package/selection/highlight/types/row.js +27 -0
- package/selection/highlight/types/row.mjs +22 -0
- package/selection/highlight/visualSelection.js +41 -33
- package/selection/highlight/visualSelection.mjs +41 -33
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +290 -154
- package/selection/selection.mjs +287 -153
- package/selection/transformation.js +232 -90
- package/selection/transformation.mjs +232 -90
- package/selection/utils.js +15 -21
- package/selection/utils.mjs +16 -21
- package/settings.d.ts +2 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +27 -0
- package/shortcutContexts/commands/editor/open.mjs +23 -0
- package/shortcutContexts/commands/emptySelectedCells.js +11 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/index.js +35 -0
- package/shortcutContexts/commands/index.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +36 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +32 -0
- package/shortcutContexts/commands/selectAll.js +10 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +13 -0
- package/shortcutContexts/constants.mjs +8 -0
- package/shortcutContexts/editor.js +25 -0
- package/shortcutContexts/editor.mjs +21 -0
- package/shortcutContexts/grid.js +163 -0
- package/shortcutContexts/grid.mjs +159 -0
- package/shortcutContexts/index.js +24 -0
- package/shortcutContexts/index.mjs +11 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -0
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +19 -5
- package/shortcuts/utils.mjs +18 -4
- package/tableView.js +163 -91
- package/tableView.mjs +163 -91
- package/translations/changesObservable/observable.js +82 -54
- package/translations/changesObservable/observable.mjs +82 -54
- package/translations/changesObservable/observer.js +24 -11
- package/translations/changesObservable/observer.mjs +24 -11
- package/translations/maps/linkedPhysicalIndexToValueMap.js +14 -8
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +14 -8
- package/utils/dataStructures/tree.js +21 -18
- package/utils/dataStructures/tree.mjs +21 -18
- package/3rdparty/walkontable/src/selection.js +0 -295
- package/3rdparty/walkontable/src/selection.mjs +0 -290
- package/selection/highlight/constants.js +0 -15
- package/selection/highlight/constants.mjs +0 -6
- package/selection/highlight/types/index.js +0 -35
- package/selection/highlight/types/index.mjs +0 -31
@@ -1,6 +1,8 @@
|
|
1
1
|
import { BasePlugin } from "../base/index.mjs";
|
2
2
|
import { arrayEach } from "../../helpers/array.mjs";
|
3
|
+
import { objectEach } from "../../helpers/object.mjs";
|
3
4
|
import CommandExecutor from "../contextMenu/commandExecutor.mjs";
|
5
|
+
import { getDocumentOffsetByElement } from "../contextMenu/utils.mjs";
|
4
6
|
import EventManager from "../../eventManager.mjs";
|
5
7
|
import { hasClass } from "../../helpers/dom/element.mjs";
|
6
8
|
import ItemsFactory from "../contextMenu/itemsFactory.mjs";
|
@@ -15,6 +17,7 @@ Hooks.getSingleton().register('afterDropdownMenuExecute');
|
|
15
17
|
export const PLUGIN_KEY = 'dropdownMenu';
|
16
18
|
export const PLUGIN_PRIORITY = 230;
|
17
19
|
const BUTTON_CLASS_NAME = 'changeType';
|
20
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
18
21
|
|
19
22
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
20
23
|
/**
|
@@ -151,6 +154,7 @@ export class DropdownMenu extends BasePlugin {
|
|
151
154
|
if (typeof settings.callback === 'function') {
|
152
155
|
this.commandExecutor.setCommonCallback(settings.callback);
|
153
156
|
}
|
157
|
+
this.registerShortcuts();
|
154
158
|
super.enablePlugin();
|
155
159
|
this.callOnPluginsReady(() => {
|
156
160
|
this.hot.runHooks('afterDropdownMenuDefaultOptions', predefinedItems);
|
@@ -201,9 +205,68 @@ export class DropdownMenu extends BasePlugin {
|
|
201
205
|
if (this.menu) {
|
202
206
|
this.menu.destroy();
|
203
207
|
}
|
208
|
+
this.unregisterShortcuts();
|
204
209
|
super.disablePlugin();
|
205
210
|
}
|
206
211
|
|
212
|
+
/**
|
213
|
+
* Register shortcuts responsible for toggling dropdown menu.
|
214
|
+
*
|
215
|
+
* @private
|
216
|
+
*/
|
217
|
+
registerShortcuts() {
|
218
|
+
const context = this.hot.getShortcutManager().getContext('grid');
|
219
|
+
const callback = () => {
|
220
|
+
const {
|
221
|
+
highlight
|
222
|
+
} = this.hot.getSelectedRangeLast();
|
223
|
+
if ((highlight.isHeader() && highlight.row === -1 || highlight.isCell()) && highlight.col >= 0) {
|
224
|
+
this.hot.selectColumns(highlight.col, highlight.col, -1);
|
225
|
+
const {
|
226
|
+
from
|
227
|
+
} = this.hot.getSelectedRangeLast();
|
228
|
+
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
229
|
+
const target = this.hot.getCell(-1, from.col, true);
|
230
|
+
const rect = target.getBoundingClientRect();
|
231
|
+
this.open({
|
232
|
+
left: rect.left + offset.left,
|
233
|
+
top: rect.top + target.offsetHeight + offset.top
|
234
|
+
}, {
|
235
|
+
left: rect.width
|
236
|
+
});
|
237
|
+
this.hot._registerTimeout(() => {
|
238
|
+
this.menu.selectFirstCell();
|
239
|
+
});
|
240
|
+
}
|
241
|
+
};
|
242
|
+
context.addShortcuts([{
|
243
|
+
keys: [['Shift', 'Alt', 'ArrowDown'], ['Shift', 'Enter']],
|
244
|
+
callback,
|
245
|
+
runOnlyIf: () => {
|
246
|
+
var _this$hot$getSelected;
|
247
|
+
return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader()) && !this.menu.isOpened();
|
248
|
+
},
|
249
|
+
group: SHORTCUTS_GROUP
|
250
|
+
}, {
|
251
|
+
keys: [['Shift', 'Alt', 'ArrowDown']],
|
252
|
+
callback,
|
253
|
+
runOnlyIf: () => {
|
254
|
+
var _this$hot$getSelected2;
|
255
|
+
return ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isCell()) && !this.menu.isOpened();
|
256
|
+
},
|
257
|
+
group: SHORTCUTS_GROUP
|
258
|
+
}]);
|
259
|
+
}
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Unregister shortcuts responsible for toggling dropdown menu.
|
263
|
+
*
|
264
|
+
* @private
|
265
|
+
*/
|
266
|
+
unregisterShortcuts() {
|
267
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
268
|
+
}
|
269
|
+
|
207
270
|
/**
|
208
271
|
* Registers the DOM listeners.
|
209
272
|
*
|
@@ -216,23 +279,30 @@ export class DropdownMenu extends BasePlugin {
|
|
216
279
|
/**
|
217
280
|
* Opens menu and re-position it based on the passed coordinates.
|
218
281
|
*
|
219
|
-
* @param {
|
220
|
-
*
|
221
|
-
*
|
222
|
-
*
|
223
|
-
*
|
282
|
+
* @param {{ top: number, left: number }|Event} position An object with `top` and `left` properties
|
283
|
+
* which contains coordinates relative to the browsers viewport (without included scroll offsets).
|
284
|
+
* Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`
|
285
|
+
* coordinates.
|
286
|
+
* @param {{ above: number, below: number, left: number, right: number }} offset An object allows applying
|
287
|
+
* the offset to the menu position.
|
224
288
|
* @fires Hooks#beforeDropdownMenuShow
|
225
289
|
* @fires Hooks#afterDropdownMenuShow
|
226
290
|
*/
|
227
|
-
|
228
291
|
open(position) {
|
229
|
-
|
292
|
+
var _this$menu;
|
293
|
+
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
294
|
+
above: 0,
|
295
|
+
below: 0,
|
296
|
+
left: 0,
|
297
|
+
right: 0
|
298
|
+
};
|
299
|
+
if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {
|
230
300
|
return;
|
231
301
|
}
|
232
302
|
this.menu.open();
|
233
|
-
|
234
|
-
this.menu.setOffset(
|
235
|
-
}
|
303
|
+
objectEach(offset, (value, key) => {
|
304
|
+
this.menu.setOffset(key, value);
|
305
|
+
});
|
236
306
|
this.menu.setPosition(position);
|
237
307
|
}
|
238
308
|
|
@@ -240,10 +310,8 @@ export class DropdownMenu extends BasePlugin {
|
|
240
310
|
* Closes dropdown menu.
|
241
311
|
*/
|
242
312
|
close() {
|
243
|
-
|
244
|
-
|
245
|
-
}
|
246
|
-
this.menu.close();
|
313
|
+
var _this$menu2;
|
314
|
+
(_this$menu2 = this.menu) === null || _this$menu2 === void 0 ? void 0 : _this$menu2.close();
|
247
315
|
}
|
248
316
|
|
249
317
|
/**
|
@@ -308,26 +376,14 @@ export class DropdownMenu extends BasePlugin {
|
|
308
376
|
*/
|
309
377
|
onTableClick(event) {
|
310
378
|
event.stopPropagation();
|
311
|
-
if (hasClass(event.target, BUTTON_CLASS_NAME)
|
312
|
-
|
313
|
-
let offsetLeft = 0;
|
314
|
-
if (this.hot.rootDocument !== this.menu.container.ownerDocument) {
|
315
|
-
const {
|
316
|
-
frameElement
|
317
|
-
} = this.hot.rootWindow;
|
318
|
-
const {
|
319
|
-
top,
|
320
|
-
left
|
321
|
-
} = frameElement.getBoundingClientRect();
|
322
|
-
offsetTop = top;
|
323
|
-
offsetLeft = left;
|
324
|
-
}
|
379
|
+
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
380
|
+
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
325
381
|
const rect = event.target.getBoundingClientRect();
|
326
382
|
this.open({
|
327
|
-
left: rect.left +
|
328
|
-
top: rect.top + event.target.offsetHeight + 3 +
|
329
|
-
|
330
|
-
|
383
|
+
left: rect.left + offset.left,
|
384
|
+
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
385
|
+
}, {
|
386
|
+
left: rect.width
|
331
387
|
});
|
332
388
|
}
|
333
389
|
}
|
@@ -366,6 +422,7 @@ export class DropdownMenu extends BasePlugin {
|
|
366
422
|
const button = this.hot.rootDocument.createElement('button');
|
367
423
|
button.className = BUTTON_CLASS_NAME;
|
368
424
|
button.type = 'button';
|
425
|
+
button.tabIndex = -1;
|
369
426
|
|
370
427
|
// prevent page reload on button click
|
371
428
|
button.onclick = function () {
|
@@ -68,8 +68,8 @@ class ConditionCollection {
|
|
68
68
|
isMatch(value, column) {
|
69
69
|
var _stateForColumn$condi;
|
70
70
|
const stateForColumn = this.filteringStates.getValueAtIndex(column);
|
71
|
-
const conditions = (_stateForColumn$condi = stateForColumn
|
72
|
-
const operation = stateForColumn
|
71
|
+
const conditions = (_stateForColumn$condi = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.conditions) !== null && _stateForColumn$condi !== void 0 ? _stateForColumn$condi : [];
|
72
|
+
const operation = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.operation;
|
73
73
|
return this.isMatchInConditions(conditions, value, operation);
|
74
74
|
}
|
75
75
|
|
@@ -150,8 +150,8 @@ class ConditionCollection {
|
|
150
150
|
* @returns {Array} Returns conditions collection as an array.
|
151
151
|
*/
|
152
152
|
getConditions(column) {
|
153
|
-
var _this$filteringStates;
|
154
|
-
return (_this$filteringStates = this.filteringStates.getValueAtIndex(column)
|
153
|
+
var _this$filteringStates, _this$filteringStates2;
|
154
|
+
return (_this$filteringStates = (_this$filteringStates2 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates2 === void 0 ? void 0 : _this$filteringStates2.conditions) !== null && _this$filteringStates !== void 0 ? _this$filteringStates : [];
|
155
155
|
}
|
156
156
|
|
157
157
|
/**
|
@@ -161,7 +161,8 @@ class ConditionCollection {
|
|
161
161
|
* @returns {string|undefined}
|
162
162
|
*/
|
163
163
|
getOperation(column) {
|
164
|
-
|
164
|
+
var _this$filteringStates3;
|
165
|
+
return (_this$filteringStates3 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates3 === void 0 ? void 0 : _this$filteringStates3.operation;
|
165
166
|
}
|
166
167
|
|
167
168
|
/**
|
@@ -64,8 +64,8 @@ class ConditionCollection {
|
|
64
64
|
isMatch(value, column) {
|
65
65
|
var _stateForColumn$condi;
|
66
66
|
const stateForColumn = this.filteringStates.getValueAtIndex(column);
|
67
|
-
const conditions = (_stateForColumn$condi = stateForColumn
|
68
|
-
const operation = stateForColumn
|
67
|
+
const conditions = (_stateForColumn$condi = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.conditions) !== null && _stateForColumn$condi !== void 0 ? _stateForColumn$condi : [];
|
68
|
+
const operation = stateForColumn === null || stateForColumn === void 0 ? void 0 : stateForColumn.operation;
|
69
69
|
return this.isMatchInConditions(conditions, value, operation);
|
70
70
|
}
|
71
71
|
|
@@ -146,8 +146,8 @@ class ConditionCollection {
|
|
146
146
|
* @returns {Array} Returns conditions collection as an array.
|
147
147
|
*/
|
148
148
|
getConditions(column) {
|
149
|
-
var _this$filteringStates;
|
150
|
-
return (_this$filteringStates = this.filteringStates.getValueAtIndex(column)
|
149
|
+
var _this$filteringStates, _this$filteringStates2;
|
150
|
+
return (_this$filteringStates = (_this$filteringStates2 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates2 === void 0 ? void 0 : _this$filteringStates2.conditions) !== null && _this$filteringStates !== void 0 ? _this$filteringStates : [];
|
151
151
|
}
|
152
152
|
|
153
153
|
/**
|
@@ -157,7 +157,8 @@ class ConditionCollection {
|
|
157
157
|
* @returns {string|undefined}
|
158
158
|
*/
|
159
159
|
getOperation(column) {
|
160
|
-
|
160
|
+
var _this$filteringStates3;
|
161
|
+
return (_this$filteringStates3 = this.filteringStates.getValueAtIndex(column)) === null || _this$filteringStates3 === void 0 ? void 0 : _this$filteringStates3.operation;
|
161
162
|
}
|
162
163
|
|
163
164
|
/**
|
@@ -27,6 +27,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
27
27
|
const PLUGIN_KEY = 'filters';
|
28
28
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
29
29
|
const PLUGIN_PRIORITY = 250;
|
30
|
+
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
31
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
30
32
|
|
31
33
|
/**
|
32
34
|
* @plugin Filters
|
@@ -63,7 +65,6 @@ const PLUGIN_PRIORITY = 250;
|
|
63
65
|
* ```
|
64
66
|
* :::
|
65
67
|
*/
|
66
|
-
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
67
68
|
class Filters extends _base.BasePlugin {
|
68
69
|
static get PLUGIN_KEY() {
|
69
70
|
return PLUGIN_KEY;
|
@@ -210,6 +211,7 @@ class Filters extends _base.BasePlugin {
|
|
210
211
|
this.dropdownMenuPlugin.disablePlugin();
|
211
212
|
this.dropdownMenuPlugin.enablePlugin();
|
212
213
|
}
|
214
|
+
this.registerShortcuts();
|
213
215
|
super.enablePlugin();
|
214
216
|
}
|
215
217
|
|
@@ -218,7 +220,8 @@ class Filters extends _base.BasePlugin {
|
|
218
220
|
*/
|
219
221
|
disablePlugin() {
|
220
222
|
if (this.enabled) {
|
221
|
-
|
223
|
+
var _this$dropdownMenuPlu;
|
224
|
+
if ((_this$dropdownMenuPlu = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu !== void 0 && _this$dropdownMenuPlu.enabled) {
|
222
225
|
this.dropdownMenuPlugin.menu.clearLocalHooks();
|
223
226
|
}
|
224
227
|
this.components.forEach((component, key) => {
|
@@ -229,9 +232,36 @@ class Filters extends _base.BasePlugin {
|
|
229
232
|
this.conditionCollection = null;
|
230
233
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
231
234
|
}
|
235
|
+
this.unregisterShortcuts();
|
232
236
|
super.disablePlugin();
|
233
237
|
}
|
234
238
|
|
239
|
+
/**
|
240
|
+
* Register shortcuts responsible for clearing the filters.
|
241
|
+
*
|
242
|
+
* @private
|
243
|
+
*/
|
244
|
+
registerShortcuts() {
|
245
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
246
|
+
keys: [['Alt', 'A']],
|
247
|
+
stopPropagation: true,
|
248
|
+
callback: () => {
|
249
|
+
this.clearConditions();
|
250
|
+
this.filter();
|
251
|
+
},
|
252
|
+
group: SHORTCUTS_GROUP
|
253
|
+
});
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* Unregister shortcuts responsible for clearing the filters.
|
258
|
+
*
|
259
|
+
* @private
|
260
|
+
*/
|
261
|
+
unregisterShortcuts() {
|
262
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
263
|
+
}
|
264
|
+
|
235
265
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
236
266
|
/**
|
237
267
|
* @memberof Filters#
|
@@ -421,7 +451,6 @@ class Filters extends _base.BasePlugin {
|
|
421
451
|
this.hot.runHooks('afterFilter', conditions);
|
422
452
|
this.hot.view.adjustElementsSize(true);
|
423
453
|
this.hot.render();
|
424
|
-
this.clearColumnSelection();
|
425
454
|
}
|
426
455
|
|
427
456
|
/**
|
@@ -432,7 +461,8 @@ class Filters extends _base.BasePlugin {
|
|
432
461
|
* the index of the column.
|
433
462
|
*/
|
434
463
|
getSelectedColumn() {
|
435
|
-
|
464
|
+
var _this$hot$getSelected;
|
465
|
+
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
436
466
|
if (!highlight) {
|
437
467
|
return null;
|
438
468
|
}
|
@@ -442,18 +472,6 @@ class Filters extends _base.BasePlugin {
|
|
442
472
|
};
|
443
473
|
}
|
444
474
|
|
445
|
-
/**
|
446
|
-
* Clears column selection.
|
447
|
-
*
|
448
|
-
* @private
|
449
|
-
*/
|
450
|
-
clearColumnSelection() {
|
451
|
-
const selectedColumn = this.getSelectedColumn();
|
452
|
-
if (selectedColumn !== null) {
|
453
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
454
|
-
}
|
455
|
-
}
|
456
|
-
|
457
475
|
/**
|
458
476
|
* Returns handsontable source data with cell meta based on current selection.
|
459
477
|
*
|
@@ -475,7 +493,7 @@ class Filters extends _base.BasePlugin {
|
|
475
493
|
dateFormat,
|
476
494
|
locale
|
477
495
|
} = this.hot.getCellMeta(rowIndex, visualColumn);
|
478
|
-
const dataValue = (_this$hot$getDataAtCe = this.hot.getDataAtCell(this.hot.toVisualRow(rowIndex), visualColumn))
|
496
|
+
const dataValue = (_this$hot$getDataAtCe = this.hot.getDataAtCell(this.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this$hot$getDataAtCe !== void 0 ? _this$hot$getDataAtCe : value;
|
479
497
|
data.push({
|
480
498
|
meta: {
|
481
499
|
row,
|
@@ -530,7 +548,8 @@ class Filters extends _base.BasePlugin {
|
|
530
548
|
* @param {Array} components List of components.
|
531
549
|
*/
|
532
550
|
restoreComponents(components) {
|
533
|
-
|
551
|
+
var _this$getSelectedColu;
|
552
|
+
const physicalIndex = (_this$getSelectedColu = this.getSelectedColumn()) === null || _this$getSelectedColu === void 0 ? void 0 : _this$getSelectedColu.physicalIndex;
|
534
553
|
components.forEach(component => {
|
535
554
|
if (component.isHidden()) {
|
536
555
|
return;
|
@@ -618,10 +637,12 @@ class Filters extends _base.BasePlugin {
|
|
618
637
|
* @param {string} submitType The submit type.
|
619
638
|
*/
|
620
639
|
onActionBarSubmit(submitType) {
|
640
|
+
var _this$dropdownMenuPlu3;
|
621
641
|
if (submitType === 'accept') {
|
622
642
|
const selectedColumn = this.getSelectedColumn();
|
623
643
|
if (selectedColumn === null) {
|
624
|
-
|
644
|
+
var _this$dropdownMenuPlu2;
|
645
|
+
(_this$dropdownMenuPlu2 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu2 === void 0 ? void 0 : _this$dropdownMenuPlu2.close();
|
625
646
|
return;
|
626
647
|
}
|
627
648
|
const {
|
@@ -650,8 +671,9 @@ class Filters extends _base.BasePlugin {
|
|
650
671
|
this.components.forEach(component => component.saveState(physicalIndex));
|
651
672
|
this.filtersRowsMap.clear();
|
652
673
|
this.filter();
|
674
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
653
675
|
}
|
654
|
-
this.dropdownMenuPlugin
|
676
|
+
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
655
677
|
}
|
656
678
|
|
657
679
|
/**
|
@@ -744,7 +766,8 @@ class Filters extends _base.BasePlugin {
|
|
744
766
|
* @param {object} conditionsState An object with the state generated by UI components.
|
745
767
|
*/
|
746
768
|
updateComponents(conditionsState) {
|
747
|
-
|
769
|
+
var _this$dropdownMenuPlu4;
|
770
|
+
if (!((_this$dropdownMenuPlu4 = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu4 !== void 0 && _this$dropdownMenuPlu4.enabled)) {
|
748
771
|
return;
|
749
772
|
}
|
750
773
|
const {
|
@@ -20,6 +20,7 @@ import { CONDITION_NONE, CONDITION_BY_VALUE, OPERATION_AND, OPERATION_OR, OPERAT
|
|
20
20
|
import { TrimmingMap } from "../../translations/index.mjs";
|
21
21
|
export const PLUGIN_KEY = 'filters';
|
22
22
|
export const PLUGIN_PRIORITY = 250;
|
23
|
+
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
23
24
|
|
24
25
|
/**
|
25
26
|
* @plugin Filters
|
@@ -202,6 +203,7 @@ export class Filters extends BasePlugin {
|
|
202
203
|
this.dropdownMenuPlugin.disablePlugin();
|
203
204
|
this.dropdownMenuPlugin.enablePlugin();
|
204
205
|
}
|
206
|
+
this.registerShortcuts();
|
205
207
|
super.enablePlugin();
|
206
208
|
}
|
207
209
|
|
@@ -210,7 +212,8 @@ export class Filters extends BasePlugin {
|
|
210
212
|
*/
|
211
213
|
disablePlugin() {
|
212
214
|
if (this.enabled) {
|
213
|
-
|
215
|
+
var _this$dropdownMenuPlu;
|
216
|
+
if ((_this$dropdownMenuPlu = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu !== void 0 && _this$dropdownMenuPlu.enabled) {
|
214
217
|
this.dropdownMenuPlugin.menu.clearLocalHooks();
|
215
218
|
}
|
216
219
|
this.components.forEach((component, key) => {
|
@@ -221,9 +224,36 @@ export class Filters extends BasePlugin {
|
|
221
224
|
this.conditionCollection = null;
|
222
225
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
223
226
|
}
|
227
|
+
this.unregisterShortcuts();
|
224
228
|
super.disablePlugin();
|
225
229
|
}
|
226
230
|
|
231
|
+
/**
|
232
|
+
* Register shortcuts responsible for clearing the filters.
|
233
|
+
*
|
234
|
+
* @private
|
235
|
+
*/
|
236
|
+
registerShortcuts() {
|
237
|
+
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
238
|
+
keys: [['Alt', 'A']],
|
239
|
+
stopPropagation: true,
|
240
|
+
callback: () => {
|
241
|
+
this.clearConditions();
|
242
|
+
this.filter();
|
243
|
+
},
|
244
|
+
group: SHORTCUTS_GROUP
|
245
|
+
});
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Unregister shortcuts responsible for clearing the filters.
|
250
|
+
*
|
251
|
+
* @private
|
252
|
+
*/
|
253
|
+
unregisterShortcuts() {
|
254
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
255
|
+
}
|
256
|
+
|
227
257
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
228
258
|
/**
|
229
259
|
* @memberof Filters#
|
@@ -413,7 +443,6 @@ export class Filters extends BasePlugin {
|
|
413
443
|
this.hot.runHooks('afterFilter', conditions);
|
414
444
|
this.hot.view.adjustElementsSize(true);
|
415
445
|
this.hot.render();
|
416
|
-
this.clearColumnSelection();
|
417
446
|
}
|
418
447
|
|
419
448
|
/**
|
@@ -424,7 +453,8 @@ export class Filters extends BasePlugin {
|
|
424
453
|
* the index of the column.
|
425
454
|
*/
|
426
455
|
getSelectedColumn() {
|
427
|
-
|
456
|
+
var _this$hot$getSelected;
|
457
|
+
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
428
458
|
if (!highlight) {
|
429
459
|
return null;
|
430
460
|
}
|
@@ -434,18 +464,6 @@ export class Filters extends BasePlugin {
|
|
434
464
|
};
|
435
465
|
}
|
436
466
|
|
437
|
-
/**
|
438
|
-
* Clears column selection.
|
439
|
-
*
|
440
|
-
* @private
|
441
|
-
*/
|
442
|
-
clearColumnSelection() {
|
443
|
-
const selectedColumn = this.getSelectedColumn();
|
444
|
-
if (selectedColumn !== null) {
|
445
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
446
|
-
}
|
447
|
-
}
|
448
|
-
|
449
467
|
/**
|
450
468
|
* Returns handsontable source data with cell meta based on current selection.
|
451
469
|
*
|
@@ -467,7 +485,7 @@ export class Filters extends BasePlugin {
|
|
467
485
|
dateFormat,
|
468
486
|
locale
|
469
487
|
} = this.hot.getCellMeta(rowIndex, visualColumn);
|
470
|
-
const dataValue = (_this$hot$getDataAtCe = this.hot.getDataAtCell(this.hot.toVisualRow(rowIndex), visualColumn))
|
488
|
+
const dataValue = (_this$hot$getDataAtCe = this.hot.getDataAtCell(this.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this$hot$getDataAtCe !== void 0 ? _this$hot$getDataAtCe : value;
|
471
489
|
data.push({
|
472
490
|
meta: {
|
473
491
|
row,
|
@@ -522,7 +540,8 @@ export class Filters extends BasePlugin {
|
|
522
540
|
* @param {Array} components List of components.
|
523
541
|
*/
|
524
542
|
restoreComponents(components) {
|
525
|
-
|
543
|
+
var _this$getSelectedColu;
|
544
|
+
const physicalIndex = (_this$getSelectedColu = this.getSelectedColumn()) === null || _this$getSelectedColu === void 0 ? void 0 : _this$getSelectedColu.physicalIndex;
|
526
545
|
components.forEach(component => {
|
527
546
|
if (component.isHidden()) {
|
528
547
|
return;
|
@@ -610,10 +629,12 @@ export class Filters extends BasePlugin {
|
|
610
629
|
* @param {string} submitType The submit type.
|
611
630
|
*/
|
612
631
|
onActionBarSubmit(submitType) {
|
632
|
+
var _this$dropdownMenuPlu3;
|
613
633
|
if (submitType === 'accept') {
|
614
634
|
const selectedColumn = this.getSelectedColumn();
|
615
635
|
if (selectedColumn === null) {
|
616
|
-
|
636
|
+
var _this$dropdownMenuPlu2;
|
637
|
+
(_this$dropdownMenuPlu2 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu2 === void 0 ? void 0 : _this$dropdownMenuPlu2.close();
|
617
638
|
return;
|
618
639
|
}
|
619
640
|
const {
|
@@ -642,8 +663,9 @@ export class Filters extends BasePlugin {
|
|
642
663
|
this.components.forEach(component => component.saveState(physicalIndex));
|
643
664
|
this.filtersRowsMap.clear();
|
644
665
|
this.filter();
|
666
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
645
667
|
}
|
646
|
-
this.dropdownMenuPlugin
|
668
|
+
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
647
669
|
}
|
648
670
|
|
649
671
|
/**
|
@@ -736,7 +758,8 @@ export class Filters extends BasePlugin {
|
|
736
758
|
* @param {object} conditionsState An object with the state generated by UI components.
|
737
759
|
*/
|
738
760
|
updateComponents(conditionsState) {
|
739
|
-
|
761
|
+
var _this$dropdownMenuPlu4;
|
762
|
+
if (!((_this$dropdownMenuPlu4 = this.dropdownMenuPlugin) !== null && _this$dropdownMenuPlu4 !== void 0 && _this$dropdownMenuPlu4.enabled)) {
|
740
763
|
return;
|
741
764
|
}
|
742
765
|
const {
|
@@ -56,7 +56,7 @@ function getSharedEngineUsageRegistry() {
|
|
56
56
|
function setupEngine(hotInstance) {
|
57
57
|
const hotSettings = hotInstance.getSettings();
|
58
58
|
const pluginSettings = hotSettings[_formulas.PLUGIN_KEY];
|
59
|
-
const engineConfigItem = pluginSettings
|
59
|
+
const engineConfigItem = pluginSettings === null || pluginSettings === void 0 ? void 0 : pluginSettings.engine;
|
60
60
|
if (pluginSettings === true) {
|
61
61
|
return null;
|
62
62
|
}
|
@@ -67,7 +67,7 @@ function setupEngine(hotInstance) {
|
|
67
67
|
// `engine.hyperformula` or `engine` is the engine class
|
68
68
|
if (typeof engineConfigItem.hyperformula === 'function' || typeof engineConfigItem === 'function') {
|
69
69
|
var _engineConfigItem$hyp;
|
70
|
-
return registerEngine((_engineConfigItem$hyp = engineConfigItem.hyperformula)
|
70
|
+
return registerEngine((_engineConfigItem$hyp = engineConfigItem.hyperformula) !== null && _engineConfigItem$hyp !== void 0 ? _engineConfigItem$hyp : engineConfigItem, hotSettings, hotInstance);
|
71
71
|
|
72
72
|
// `engine` is the engine instance
|
73
73
|
} else if (typeof engineConfigItem === 'object' && (0, _mixed.isUndefined)(engineConfigItem.hyperformula)) {
|
@@ -137,7 +137,7 @@ function registerEngine(engineClass, hotSettings, hotInstance) {
|
|
137
137
|
function getRegisteredHotInstances(engine) {
|
138
138
|
var _engineRegistry$get;
|
139
139
|
const engineRegistry = getEngineRelationshipRegistry();
|
140
|
-
const hotInstances = engineRegistry.size === 0 ? [] : Array.from((_engineRegistry$get = engineRegistry.get(engine))
|
140
|
+
const hotInstances = engineRegistry.size === 0 ? [] : Array.from((_engineRegistry$get = engineRegistry.get(engine)) !== null && _engineRegistry$get !== void 0 ? _engineRegistry$get : []);
|
141
141
|
return new Map(hotInstances.map(hot => [hot.getPlugin('formulas').sheetId, hot]));
|
142
142
|
}
|
143
143
|
|
@@ -44,7 +44,7 @@ function getSharedEngineUsageRegistry() {
|
|
44
44
|
export function setupEngine(hotInstance) {
|
45
45
|
const hotSettings = hotInstance.getSettings();
|
46
46
|
const pluginSettings = hotSettings[PLUGIN_KEY];
|
47
|
-
const engineConfigItem = pluginSettings
|
47
|
+
const engineConfigItem = pluginSettings === null || pluginSettings === void 0 ? void 0 : pluginSettings.engine;
|
48
48
|
if (pluginSettings === true) {
|
49
49
|
return null;
|
50
50
|
}
|
@@ -55,7 +55,7 @@ export function setupEngine(hotInstance) {
|
|
55
55
|
// `engine.hyperformula` or `engine` is the engine class
|
56
56
|
if (typeof engineConfigItem.hyperformula === 'function' || typeof engineConfigItem === 'function') {
|
57
57
|
var _engineConfigItem$hyp;
|
58
|
-
return registerEngine((_engineConfigItem$hyp = engineConfigItem.hyperformula)
|
58
|
+
return registerEngine((_engineConfigItem$hyp = engineConfigItem.hyperformula) !== null && _engineConfigItem$hyp !== void 0 ? _engineConfigItem$hyp : engineConfigItem, hotSettings, hotInstance);
|
59
59
|
|
60
60
|
// `engine` is the engine instance
|
61
61
|
} else if (typeof engineConfigItem === 'object' && isUndefined(engineConfigItem.hyperformula)) {
|
@@ -125,7 +125,7 @@ export function registerEngine(engineClass, hotSettings, hotInstance) {
|
|
125
125
|
export function getRegisteredHotInstances(engine) {
|
126
126
|
var _engineRegistry$get;
|
127
127
|
const engineRegistry = getEngineRelationshipRegistry();
|
128
|
-
const hotInstances = engineRegistry.size === 0 ? [] : Array.from((_engineRegistry$get = engineRegistry.get(engine))
|
128
|
+
const hotInstances = engineRegistry.size === 0 ? [] : Array.from((_engineRegistry$get = engineRegistry.get(engine)) !== null && _engineRegistry$get !== void 0 ? _engineRegistry$get : []);
|
129
129
|
return new Map(hotInstances.map(hot => [hot.getPlugin('formulas').sheetId, hot]));
|
130
130
|
}
|
131
131
|
|
@@ -43,10 +43,11 @@ const DEFAULT_SETTINGS = {
|
|
43
43
|
*/
|
44
44
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
45
45
|
function getEngineSettingsOverrides(hotSettings) {
|
46
|
+
var _hotSettings$PLUGIN_K;
|
46
47
|
return {
|
47
48
|
maxColumns: hotSettings.maxColumns,
|
48
49
|
maxRows: hotSettings.maxRows,
|
49
|
-
language: hotSettings[_formulas.PLUGIN_KEY]
|
50
|
+
language: (_hotSettings$PLUGIN_K = hotSettings[_formulas.PLUGIN_KEY]) === null || _hotSettings$PLUGIN_K === void 0 || (_hotSettings$PLUGIN_K = _hotSettings$PLUGIN_K.language) === null || _hotSettings$PLUGIN_K === void 0 ? void 0 : _hotSettings$PLUGIN_K.langCode
|
50
51
|
};
|
51
52
|
}
|
52
53
|
|
@@ -82,8 +83,9 @@ function cleanEngineSettings(pluginSettings) {
|
|
82
83
|
* @returns {object} The final engine settings.
|
83
84
|
*/
|
84
85
|
function getEngineSettingsWithDefaultsAndOverrides(hotSettings) {
|
86
|
+
var _pluginSettings$engin;
|
85
87
|
const pluginSettings = hotSettings[_formulas.PLUGIN_KEY];
|
86
|
-
const userSettings = cleanEngineSettings(pluginSettings
|
88
|
+
const userSettings = cleanEngineSettings(pluginSettings !== null && pluginSettings !== void 0 && (_pluginSettings$engin = pluginSettings.engine) !== null && _pluginSettings$engin !== void 0 && _pluginSettings$engin.hyperformula ? pluginSettings.engine : {});
|
87
89
|
const overrides = getEngineSettingsOverrides(hotSettings);
|
88
90
|
return {
|
89
91
|
...DEFAULT_SETTINGS,
|
@@ -99,8 +101,9 @@ function getEngineSettingsWithDefaultsAndOverrides(hotSettings) {
|
|
99
101
|
* @returns {object}
|
100
102
|
*/
|
101
103
|
function getEngineSettingsWithOverrides(hotSettings) {
|
104
|
+
var _pluginSettings$engin2;
|
102
105
|
const pluginSettings = hotSettings[_formulas.PLUGIN_KEY];
|
103
|
-
const userSettings = cleanEngineSettings(pluginSettings
|
106
|
+
const userSettings = cleanEngineSettings(pluginSettings !== null && pluginSettings !== void 0 && (_pluginSettings$engin2 = pluginSettings.engine) !== null && _pluginSettings$engin2 !== void 0 && _pluginSettings$engin2.hyperformula ? pluginSettings.engine : {});
|
104
107
|
const overrides = getEngineSettingsOverrides(hotSettings);
|
105
108
|
return {
|
106
109
|
...userSettings,
|