handsontable 0.0.0-next-b66c79f-20230713 → 0.0.0-next-08765b9-20230714
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.
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
package/editorManager.js
CHANGED
@@ -2,16 +2,14 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
var _unicode = require("./helpers/unicode");
|
5
|
-
var _event = require("./helpers/dom/event");
|
6
5
|
var _element = require("./helpers/dom/element");
|
6
|
+
var _event = require("./helpers/dom/event");
|
7
7
|
var _registry = require("./editors/registry");
|
8
8
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
9
9
|
var _mixed = require("./helpers/mixed");
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
11
|
const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
12
12
|
exports.SHORTCUTS_GROUP_NAVIGATION = SHORTCUTS_GROUP_NAVIGATION;
|
13
|
-
const SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
14
|
-
exports.SHORTCUTS_GROUP_EDITOR = SHORTCUTS_GROUP_EDITOR;
|
15
13
|
class EditorManager {
|
16
14
|
/**
|
17
15
|
* @param {Core} instance The Handsontable instance.
|
@@ -74,9 +72,6 @@ class EditorManager {
|
|
74
72
|
* @type {object}
|
75
73
|
*/
|
76
74
|
this.cellProperties = void 0;
|
77
|
-
const shortcutManager = this.instance.getShortcutManager();
|
78
|
-
shortcutManager.addContext('editor');
|
79
|
-
this.registerShortcuts();
|
80
75
|
this.instance.addHook('afterDocumentKeyDown', event => this.onAfterDocumentKeyDown(event));
|
81
76
|
|
82
77
|
// Open editor when text composition is started (IME editor)
|
@@ -88,62 +83,6 @@ class EditorManager {
|
|
88
83
|
this.instance.view._wt.update('onCellDblClick', (event, coords, elem) => this.onCellDblClick(event, coords, elem));
|
89
84
|
}
|
90
85
|
|
91
|
-
/**
|
92
|
-
* Register shortcuts responsible for handling some actions related to an editor.
|
93
|
-
*
|
94
|
-
* @private
|
95
|
-
*/
|
96
|
-
registerShortcuts() {
|
97
|
-
const shortcutManager = this.instance.getShortcutManager();
|
98
|
-
const gridContext = shortcutManager.getContext('grid');
|
99
|
-
const editorContext = shortcutManager.getContext('editor');
|
100
|
-
const config = {
|
101
|
-
group: SHORTCUTS_GROUP_EDITOR
|
102
|
-
};
|
103
|
-
editorContext.addShortcuts([{
|
104
|
-
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
105
|
-
callback: (event, keys) => {
|
106
|
-
this.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
107
|
-
this.moveSelectionAfterEnter(keys.includes('shift'));
|
108
|
-
}
|
109
|
-
}, {
|
110
|
-
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
111
|
-
callback: () => {
|
112
|
-
this.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
113
|
-
this.activeEditor.focus();
|
114
|
-
}
|
115
|
-
}], config);
|
116
|
-
gridContext.addShortcuts([{
|
117
|
-
keys: [['F2']],
|
118
|
-
callback: event => {
|
119
|
-
this.openEditor(null, event, true);
|
120
|
-
}
|
121
|
-
}, {
|
122
|
-
keys: [['Backspace'], ['Delete']],
|
123
|
-
callback: () => {
|
124
|
-
this.instance.emptySelectedCells();
|
125
|
-
this.prepareEditor();
|
126
|
-
}
|
127
|
-
}, {
|
128
|
-
keys: [['Enter'], ['Enter', 'Shift']],
|
129
|
-
callback: (event, keys) => {
|
130
|
-
if (this.instance.getSettings().enterBeginsEditing) {
|
131
|
-
if (this.cellProperties.readOnly) {
|
132
|
-
this.moveSelectionAfterEnter();
|
133
|
-
} else {
|
134
|
-
this.openEditor(null, event, true);
|
135
|
-
}
|
136
|
-
} else {
|
137
|
-
this.moveSelectionAfterEnter(keys.includes('shift'));
|
138
|
-
}
|
139
|
-
(0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
|
140
|
-
}
|
141
|
-
}], {
|
142
|
-
...config,
|
143
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.instance.getSelected())
|
144
|
-
});
|
145
|
-
}
|
146
|
-
|
147
86
|
/**
|
148
87
|
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
149
88
|
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
@@ -196,10 +135,16 @@ class EditorManager {
|
|
196
135
|
});
|
197
136
|
return;
|
198
137
|
}
|
138
|
+
const {
|
139
|
+
highlight
|
140
|
+
} = this.instance.getSelectedRangeLast();
|
141
|
+
if (highlight.isHeader()) {
|
142
|
+
return;
|
143
|
+
}
|
199
144
|
const {
|
200
145
|
row,
|
201
146
|
col
|
202
|
-
} =
|
147
|
+
} = highlight;
|
203
148
|
const modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
204
149
|
let visualRowToCheck = row;
|
205
150
|
let visualColumnToCheck = col;
|
@@ -263,14 +208,7 @@ class EditorManager {
|
|
263
208
|
return;
|
264
209
|
}
|
265
210
|
if (!this.activeEditor) {
|
266
|
-
|
267
|
-
row,
|
268
|
-
col
|
269
|
-
} = this.instance.getSelectedRangeLast().highlight;
|
270
|
-
const renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
|
271
|
-
const renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
|
272
|
-
this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
273
|
-
this.instance.view.render();
|
211
|
+
this.instance.scrollToFocusedCell();
|
274
212
|
this.prepareEditor();
|
275
213
|
}
|
276
214
|
if (this.activeEditor) {
|
@@ -374,15 +312,13 @@ class EditorManager {
|
|
374
312
|
* @param {KeyboardEvent} event The keyboard event object.
|
375
313
|
*/
|
376
314
|
onAfterDocumentKeyDown(event) {
|
377
|
-
|
315
|
+
const selection = this.instance.getSelectedRangeLast();
|
316
|
+
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
|
378
317
|
return;
|
379
318
|
}
|
380
319
|
const {
|
381
320
|
keyCode
|
382
321
|
} = event;
|
383
|
-
if (!this.selection.isSelected()) {
|
384
|
-
return;
|
385
|
-
}
|
386
322
|
|
387
323
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
388
324
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
package/editorManager.mjs
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
2
|
-
import { stopImmediatePropagation } from "./helpers/dom/event.mjs";
|
3
2
|
import { isOutsideInput } from "./helpers/dom/element.mjs";
|
3
|
+
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
4
4
|
import { getEditorInstance } from "./editors/registry.mjs";
|
5
5
|
import EventManager from "./eventManager.mjs";
|
6
6
|
import { isDefined } from "./helpers/mixed.mjs";
|
7
7
|
export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
8
|
-
export const SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
9
8
|
class EditorManager {
|
10
9
|
/**
|
11
10
|
* @param {Core} instance The Handsontable instance.
|
@@ -68,9 +67,6 @@ class EditorManager {
|
|
68
67
|
* @type {object}
|
69
68
|
*/
|
70
69
|
this.cellProperties = void 0;
|
71
|
-
const shortcutManager = this.instance.getShortcutManager();
|
72
|
-
shortcutManager.addContext('editor');
|
73
|
-
this.registerShortcuts();
|
74
70
|
this.instance.addHook('afterDocumentKeyDown', event => this.onAfterDocumentKeyDown(event));
|
75
71
|
|
76
72
|
// Open editor when text composition is started (IME editor)
|
@@ -82,62 +78,6 @@ class EditorManager {
|
|
82
78
|
this.instance.view._wt.update('onCellDblClick', (event, coords, elem) => this.onCellDblClick(event, coords, elem));
|
83
79
|
}
|
84
80
|
|
85
|
-
/**
|
86
|
-
* Register shortcuts responsible for handling some actions related to an editor.
|
87
|
-
*
|
88
|
-
* @private
|
89
|
-
*/
|
90
|
-
registerShortcuts() {
|
91
|
-
const shortcutManager = this.instance.getShortcutManager();
|
92
|
-
const gridContext = shortcutManager.getContext('grid');
|
93
|
-
const editorContext = shortcutManager.getContext('editor');
|
94
|
-
const config = {
|
95
|
-
group: SHORTCUTS_GROUP_EDITOR
|
96
|
-
};
|
97
|
-
editorContext.addShortcuts([{
|
98
|
-
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
99
|
-
callback: (event, keys) => {
|
100
|
-
this.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
101
|
-
this.moveSelectionAfterEnter(keys.includes('shift'));
|
102
|
-
}
|
103
|
-
}, {
|
104
|
-
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
105
|
-
callback: () => {
|
106
|
-
this.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
107
|
-
this.activeEditor.focus();
|
108
|
-
}
|
109
|
-
}], config);
|
110
|
-
gridContext.addShortcuts([{
|
111
|
-
keys: [['F2']],
|
112
|
-
callback: event => {
|
113
|
-
this.openEditor(null, event, true);
|
114
|
-
}
|
115
|
-
}, {
|
116
|
-
keys: [['Backspace'], ['Delete']],
|
117
|
-
callback: () => {
|
118
|
-
this.instance.emptySelectedCells();
|
119
|
-
this.prepareEditor();
|
120
|
-
}
|
121
|
-
}, {
|
122
|
-
keys: [['Enter'], ['Enter', 'Shift']],
|
123
|
-
callback: (event, keys) => {
|
124
|
-
if (this.instance.getSettings().enterBeginsEditing) {
|
125
|
-
if (this.cellProperties.readOnly) {
|
126
|
-
this.moveSelectionAfterEnter();
|
127
|
-
} else {
|
128
|
-
this.openEditor(null, event, true);
|
129
|
-
}
|
130
|
-
} else {
|
131
|
-
this.moveSelectionAfterEnter(keys.includes('shift'));
|
132
|
-
}
|
133
|
-
stopImmediatePropagation(event); // required by HandsontableEditor
|
134
|
-
}
|
135
|
-
}], {
|
136
|
-
...config,
|
137
|
-
runOnlyIf: () => isDefined(this.instance.getSelected())
|
138
|
-
});
|
139
|
-
}
|
140
|
-
|
141
81
|
/**
|
142
82
|
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
143
83
|
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
@@ -190,10 +130,16 @@ class EditorManager {
|
|
190
130
|
});
|
191
131
|
return;
|
192
132
|
}
|
133
|
+
const {
|
134
|
+
highlight
|
135
|
+
} = this.instance.getSelectedRangeLast();
|
136
|
+
if (highlight.isHeader()) {
|
137
|
+
return;
|
138
|
+
}
|
193
139
|
const {
|
194
140
|
row,
|
195
141
|
col
|
196
|
-
} =
|
142
|
+
} = highlight;
|
197
143
|
const modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
198
144
|
let visualRowToCheck = row;
|
199
145
|
let visualColumnToCheck = col;
|
@@ -257,14 +203,7 @@ class EditorManager {
|
|
257
203
|
return;
|
258
204
|
}
|
259
205
|
if (!this.activeEditor) {
|
260
|
-
|
261
|
-
row,
|
262
|
-
col
|
263
|
-
} = this.instance.getSelectedRangeLast().highlight;
|
264
|
-
const renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
|
265
|
-
const renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
|
266
|
-
this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
267
|
-
this.instance.view.render();
|
206
|
+
this.instance.scrollToFocusedCell();
|
268
207
|
this.prepareEditor();
|
269
208
|
}
|
270
209
|
if (this.activeEditor) {
|
@@ -368,15 +307,13 @@ class EditorManager {
|
|
368
307
|
* @param {KeyboardEvent} event The keyboard event object.
|
369
308
|
*/
|
370
309
|
onAfterDocumentKeyDown(event) {
|
371
|
-
|
310
|
+
const selection = this.instance.getSelectedRangeLast();
|
311
|
+
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
|
372
312
|
return;
|
373
313
|
}
|
374
314
|
const {
|
375
315
|
keyCode
|
376
316
|
} = event;
|
377
|
-
if (!this.selection.isSelected()) {
|
378
|
-
return;
|
379
|
-
}
|
380
317
|
|
381
318
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
382
319
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _handsontableEditor = require("../handsontableEditor");
|
6
7
|
var _array = require("../../helpers/array");
|
7
8
|
var _element = require("../../helpers/dom/element");
|
@@ -9,6 +10,9 @@ var _mixed = require("../../helpers/mixed");
|
|
9
10
|
var _string = require("../../helpers/string");
|
10
11
|
var _unicode = require("../../helpers/unicode");
|
11
12
|
var _textRenderer = require("../../renderers/textRenderer");
|
13
|
+
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; }
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
15
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
12
16
|
const privatePool = new WeakMap();
|
13
17
|
const EDITOR_TYPE = 'autocomplete';
|
14
18
|
|
@@ -28,6 +32,72 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
28
32
|
*
|
29
33
|
* @type {string}
|
30
34
|
*/
|
35
|
+
/**
|
36
|
+
* Filters and sorts by relevance.
|
37
|
+
*
|
38
|
+
* @param {*} value The selected value.
|
39
|
+
* @param {string[]} choices The list of available choices.
|
40
|
+
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
41
|
+
* @returns {number[]} Array of indexes in original choices array.
|
42
|
+
*/
|
43
|
+
_defineProperty(this, "sortByRelevance", function (value, choices, caseSensitive) {
|
44
|
+
const choicesRelevance = [];
|
45
|
+
const result = [];
|
46
|
+
const valueLength = value.length;
|
47
|
+
let choicesCount = choices.length;
|
48
|
+
let charsLeft;
|
49
|
+
let currentItem;
|
50
|
+
let i;
|
51
|
+
let valueIndex;
|
52
|
+
if (valueLength === 0) {
|
53
|
+
for (i = 0; i < choicesCount; i++) {
|
54
|
+
result.push(i);
|
55
|
+
}
|
56
|
+
return result;
|
57
|
+
}
|
58
|
+
for (i = 0; i < choicesCount; i++) {
|
59
|
+
currentItem = (0, _string.stripTags)((0, _mixed.stringify)(choices[i]));
|
60
|
+
if (caseSensitive) {
|
61
|
+
valueIndex = currentItem.indexOf(value);
|
62
|
+
} else {
|
63
|
+
const locale = this.cellProperties.locale;
|
64
|
+
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
65
|
+
}
|
66
|
+
if (valueIndex !== -1) {
|
67
|
+
charsLeft = currentItem.length - valueIndex - valueLength;
|
68
|
+
choicesRelevance.push({
|
69
|
+
baseIndex: i,
|
70
|
+
index: valueIndex,
|
71
|
+
charsLeft,
|
72
|
+
value: currentItem
|
73
|
+
});
|
74
|
+
}
|
75
|
+
}
|
76
|
+
choicesRelevance.sort((a, b) => {
|
77
|
+
if (b.index === -1) {
|
78
|
+
return -1;
|
79
|
+
}
|
80
|
+
if (a.index === -1) {
|
81
|
+
return 1;
|
82
|
+
}
|
83
|
+
if (a.index < b.index) {
|
84
|
+
return -1;
|
85
|
+
} else if (b.index < a.index) {
|
86
|
+
return 1;
|
87
|
+
} else if (a.index === b.index) {
|
88
|
+
if (a.charsLeft < b.charsLeft) {
|
89
|
+
return -1;
|
90
|
+
} else if (a.charsLeft > b.charsLeft) {
|
91
|
+
return 1;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return 0;
|
95
|
+
});
|
96
|
+
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
97
|
+
result.push(choicesRelevance[i].baseIndex);
|
98
|
+
}
|
99
|
+
return result;
|
100
|
+
});
|
31
101
|
this.query = null;
|
32
102
|
/**
|
33
103
|
* Contains stripped choices.
|
@@ -426,72 +496,5 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
426
496
|
}
|
427
497
|
}
|
428
498
|
}
|
429
|
-
|
430
|
-
/**
|
431
|
-
* Filters and sorts by relevance.
|
432
|
-
*
|
433
|
-
* @param {*} value The selected value.
|
434
|
-
* @param {string[]} choices The list of available choices.
|
435
|
-
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
436
|
-
* @returns {number[]} Array of indexes in original choices array.
|
437
|
-
*/
|
438
|
-
sortByRelevance = function (value, choices, caseSensitive) {
|
439
|
-
const choicesRelevance = [];
|
440
|
-
const result = [];
|
441
|
-
const valueLength = value.length;
|
442
|
-
let choicesCount = choices.length;
|
443
|
-
let charsLeft;
|
444
|
-
let currentItem;
|
445
|
-
let i;
|
446
|
-
let valueIndex;
|
447
|
-
if (valueLength === 0) {
|
448
|
-
for (i = 0; i < choicesCount; i++) {
|
449
|
-
result.push(i);
|
450
|
-
}
|
451
|
-
return result;
|
452
|
-
}
|
453
|
-
for (i = 0; i < choicesCount; i++) {
|
454
|
-
currentItem = (0, _string.stripTags)((0, _mixed.stringify)(choices[i]));
|
455
|
-
if (caseSensitive) {
|
456
|
-
valueIndex = currentItem.indexOf(value);
|
457
|
-
} else {
|
458
|
-
const locale = this.cellProperties.locale;
|
459
|
-
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
460
|
-
}
|
461
|
-
if (valueIndex !== -1) {
|
462
|
-
charsLeft = currentItem.length - valueIndex - valueLength;
|
463
|
-
choicesRelevance.push({
|
464
|
-
baseIndex: i,
|
465
|
-
index: valueIndex,
|
466
|
-
charsLeft,
|
467
|
-
value: currentItem
|
468
|
-
});
|
469
|
-
}
|
470
|
-
}
|
471
|
-
choicesRelevance.sort((a, b) => {
|
472
|
-
if (b.index === -1) {
|
473
|
-
return -1;
|
474
|
-
}
|
475
|
-
if (a.index === -1) {
|
476
|
-
return 1;
|
477
|
-
}
|
478
|
-
if (a.index < b.index) {
|
479
|
-
return -1;
|
480
|
-
} else if (b.index < a.index) {
|
481
|
-
return 1;
|
482
|
-
} else if (a.index === b.index) {
|
483
|
-
if (a.charsLeft < b.charsLeft) {
|
484
|
-
return -1;
|
485
|
-
} else if (a.charsLeft > b.charsLeft) {
|
486
|
-
return 1;
|
487
|
-
}
|
488
|
-
}
|
489
|
-
return 0;
|
490
|
-
});
|
491
|
-
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
492
|
-
result.push(choicesRelevance[i].baseIndex);
|
493
|
-
}
|
494
|
-
return result;
|
495
|
-
};
|
496
499
|
}
|
497
500
|
exports.AutocompleteEditor = AutocompleteEditor;
|
@@ -1,4 +1,8 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
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; }
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
2
6
|
import { HandsontableEditor } from "../handsontableEditor/index.mjs";
|
3
7
|
import { arrayMap, pivot } from "../../helpers/array.mjs";
|
4
8
|
import { addClass, getCaretPosition, getScrollbarWidth, getSelectionEndPosition, getTrimmingContainer, offset, outerHeight, outerWidth, setCaretPosition } from "../../helpers/dom/element.mjs";
|
@@ -24,6 +28,72 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
24
28
|
*
|
25
29
|
* @type {string}
|
26
30
|
*/
|
31
|
+
/**
|
32
|
+
* Filters and sorts by relevance.
|
33
|
+
*
|
34
|
+
* @param {*} value The selected value.
|
35
|
+
* @param {string[]} choices The list of available choices.
|
36
|
+
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
37
|
+
* @returns {number[]} Array of indexes in original choices array.
|
38
|
+
*/
|
39
|
+
_defineProperty(this, "sortByRelevance", function (value, choices, caseSensitive) {
|
40
|
+
const choicesRelevance = [];
|
41
|
+
const result = [];
|
42
|
+
const valueLength = value.length;
|
43
|
+
let choicesCount = choices.length;
|
44
|
+
let charsLeft;
|
45
|
+
let currentItem;
|
46
|
+
let i;
|
47
|
+
let valueIndex;
|
48
|
+
if (valueLength === 0) {
|
49
|
+
for (i = 0; i < choicesCount; i++) {
|
50
|
+
result.push(i);
|
51
|
+
}
|
52
|
+
return result;
|
53
|
+
}
|
54
|
+
for (i = 0; i < choicesCount; i++) {
|
55
|
+
currentItem = stripTags(stringify(choices[i]));
|
56
|
+
if (caseSensitive) {
|
57
|
+
valueIndex = currentItem.indexOf(value);
|
58
|
+
} else {
|
59
|
+
const locale = this.cellProperties.locale;
|
60
|
+
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
61
|
+
}
|
62
|
+
if (valueIndex !== -1) {
|
63
|
+
charsLeft = currentItem.length - valueIndex - valueLength;
|
64
|
+
choicesRelevance.push({
|
65
|
+
baseIndex: i,
|
66
|
+
index: valueIndex,
|
67
|
+
charsLeft,
|
68
|
+
value: currentItem
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
choicesRelevance.sort((a, b) => {
|
73
|
+
if (b.index === -1) {
|
74
|
+
return -1;
|
75
|
+
}
|
76
|
+
if (a.index === -1) {
|
77
|
+
return 1;
|
78
|
+
}
|
79
|
+
if (a.index < b.index) {
|
80
|
+
return -1;
|
81
|
+
} else if (b.index < a.index) {
|
82
|
+
return 1;
|
83
|
+
} else if (a.index === b.index) {
|
84
|
+
if (a.charsLeft < b.charsLeft) {
|
85
|
+
return -1;
|
86
|
+
} else if (a.charsLeft > b.charsLeft) {
|
87
|
+
return 1;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return 0;
|
91
|
+
});
|
92
|
+
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
93
|
+
result.push(choicesRelevance[i].baseIndex);
|
94
|
+
}
|
95
|
+
return result;
|
96
|
+
});
|
27
97
|
this.query = null;
|
28
98
|
/**
|
29
99
|
* Contains stripped choices.
|
@@ -422,71 +492,4 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
422
492
|
}
|
423
493
|
}
|
424
494
|
}
|
425
|
-
|
426
|
-
/**
|
427
|
-
* Filters and sorts by relevance.
|
428
|
-
*
|
429
|
-
* @param {*} value The selected value.
|
430
|
-
* @param {string[]} choices The list of available choices.
|
431
|
-
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
432
|
-
* @returns {number[]} Array of indexes in original choices array.
|
433
|
-
*/
|
434
|
-
sortByRelevance = function (value, choices, caseSensitive) {
|
435
|
-
const choicesRelevance = [];
|
436
|
-
const result = [];
|
437
|
-
const valueLength = value.length;
|
438
|
-
let choicesCount = choices.length;
|
439
|
-
let charsLeft;
|
440
|
-
let currentItem;
|
441
|
-
let i;
|
442
|
-
let valueIndex;
|
443
|
-
if (valueLength === 0) {
|
444
|
-
for (i = 0; i < choicesCount; i++) {
|
445
|
-
result.push(i);
|
446
|
-
}
|
447
|
-
return result;
|
448
|
-
}
|
449
|
-
for (i = 0; i < choicesCount; i++) {
|
450
|
-
currentItem = stripTags(stringify(choices[i]));
|
451
|
-
if (caseSensitive) {
|
452
|
-
valueIndex = currentItem.indexOf(value);
|
453
|
-
} else {
|
454
|
-
const locale = this.cellProperties.locale;
|
455
|
-
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
456
|
-
}
|
457
|
-
if (valueIndex !== -1) {
|
458
|
-
charsLeft = currentItem.length - valueIndex - valueLength;
|
459
|
-
choicesRelevance.push({
|
460
|
-
baseIndex: i,
|
461
|
-
index: valueIndex,
|
462
|
-
charsLeft,
|
463
|
-
value: currentItem
|
464
|
-
});
|
465
|
-
}
|
466
|
-
}
|
467
|
-
choicesRelevance.sort((a, b) => {
|
468
|
-
if (b.index === -1) {
|
469
|
-
return -1;
|
470
|
-
}
|
471
|
-
if (a.index === -1) {
|
472
|
-
return 1;
|
473
|
-
}
|
474
|
-
if (a.index < b.index) {
|
475
|
-
return -1;
|
476
|
-
} else if (b.index < a.index) {
|
477
|
-
return 1;
|
478
|
-
} else if (a.index === b.index) {
|
479
|
-
if (a.charsLeft < b.charsLeft) {
|
480
|
-
return -1;
|
481
|
-
} else if (a.charsLeft > b.charsLeft) {
|
482
|
-
return 1;
|
483
|
-
}
|
484
|
-
}
|
485
|
-
return 0;
|
486
|
-
});
|
487
|
-
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
488
|
-
result.push(choicesRelevance[i].baseIndex);
|
489
|
-
}
|
490
|
-
return result;
|
491
|
-
};
|
492
495
|
}
|
@@ -452,7 +452,7 @@ class BaseEditor {
|
|
452
452
|
const gridMostRightPos = rootWindow.innerWidth - containerOffset.left - containerWidth;
|
453
453
|
const {
|
454
454
|
wtTable: overlayTable
|
455
|
-
} = (_wtOverlays$getParent = wtOverlays.getParentOverlay(TD))
|
455
|
+
} = (_wtOverlays$getParent = wtOverlays.getParentOverlay(TD)) !== null && _wtOverlays$getParent !== void 0 ? _wtOverlays$getParent : this.hot.view._wt;
|
456
456
|
const overlayName = overlayTable.name;
|
457
457
|
const scrollTop = ['master', 'inline_start'].includes(overlayName) ? containerScrollTop : 0;
|
458
458
|
const scrollLeft = ['master', 'top', 'bottom'].includes(overlayName) ? containerScrollLeft : 0;
|
@@ -445,7 +445,7 @@ export class BaseEditor {
|
|
445
445
|
const gridMostRightPos = rootWindow.innerWidth - containerOffset.left - containerWidth;
|
446
446
|
const {
|
447
447
|
wtTable: overlayTable
|
448
|
-
} = (_wtOverlays$getParent = wtOverlays.getParentOverlay(TD))
|
448
|
+
} = (_wtOverlays$getParent = wtOverlays.getParentOverlay(TD)) !== null && _wtOverlays$getParent !== void 0 ? _wtOverlays$getParent : this.hot.view._wt;
|
449
449
|
const overlayName = overlayTable.name;
|
450
450
|
const scrollTop = ['master', 'inline_start'].includes(overlayName) ? containerScrollTop : 0;
|
451
451
|
const scrollLeft = ['master', 'top', 'bottom'].includes(overlayName) ? containerScrollLeft : 0;
|
@@ -125,10 +125,11 @@ class DateEditor extends _textEditor.TextEditor {
|
|
125
125
|
* Close editor.
|
126
126
|
*/
|
127
127
|
close() {
|
128
|
+
var _this$$datePicker;
|
128
129
|
this._opened = false;
|
129
130
|
|
130
131
|
// If the date picker was never initialized (e.g. during autofill), there's nothing to destroy.
|
131
|
-
if (this.$datePicker
|
132
|
+
if ((_this$$datePicker = this.$datePicker) !== null && _this$$datePicker !== void 0 && _this$$datePicker.destroy) {
|
132
133
|
this.$datePicker.destroy();
|
133
134
|
}
|
134
135
|
this.instance._registerTimeout(() => {
|
@@ -120,10 +120,11 @@ export class DateEditor extends TextEditor {
|
|
120
120
|
* Close editor.
|
121
121
|
*/
|
122
122
|
close() {
|
123
|
+
var _this$$datePicker;
|
123
124
|
this._opened = false;
|
124
125
|
|
125
126
|
// If the date picker was never initialized (e.g. during autofill), there's nothing to destroy.
|
126
|
-
if (this.$datePicker
|
127
|
+
if ((_this$$datePicker = this.$datePicker) !== null && _this$$datePicker !== void 0 && _this$$datePicker.destroy) {
|
127
128
|
this.$datePicker.destroy();
|
128
129
|
}
|
129
130
|
this.instance._registerTimeout(() => {
|
@@ -416,9 +416,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
416
416
|
runOnlyIf: event => !this.hot.selection.isMultiple() &&
|
417
417
|
// We trigger a data population for multiple selection.
|
418
418
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
419
|
-
!event.altKey
|
420
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
421
|
-
position: 'before'
|
419
|
+
!event.altKey
|
422
420
|
}, {
|
423
421
|
keys: [['Meta', 'Enter']],
|
424
422
|
callback: () => {
|
@@ -426,19 +424,13 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
426
424
|
return false; // Will block closing editor.
|
427
425
|
},
|
428
426
|
|
429
|
-
runOnlyIf: () => !this.hot.selection.isMultiple()
|
430
|
-
// We trigger a data population for multiple selection.
|
431
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
432
|
-
position: 'before'
|
427
|
+
runOnlyIf: () => !this.hot.selection.isMultiple() // We trigger a data population for multiple selection.
|
433
428
|
}, {
|
434
429
|
keys: [['Alt', 'Enter']],
|
435
430
|
callback: () => {
|
436
431
|
insertNewLine();
|
437
432
|
return false; // Will block closing editor.
|
438
|
-
}
|
439
|
-
|
440
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
441
|
-
position: 'before'
|
433
|
+
}
|
442
434
|
}, {
|
443
435
|
// TODO: Duplicated part of code (callback to shortcut)
|
444
436
|
keys: [['PageUp']],
|