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
package/tableView.mjs
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
+
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; }
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
7
|
+
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); }
|
8
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
9
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
10
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
11
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
12
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
2
13
|
import { addClass, clearTextSelection, empty, fastInnerHTML, fastInnerText, getScrollbarWidth, hasClass, isChildOf, isInput, isOutsideInput } from "./helpers/dom/element.mjs";
|
3
14
|
import EventManager from "./eventManager.mjs";
|
4
15
|
import { isImmediatePropagationStopped, isRightClick, isLeftClick } from "./helpers/dom/event.mjs";
|
@@ -11,84 +22,91 @@ const privatePool = new WeakMap();
|
|
11
22
|
* @class TableView
|
12
23
|
* @private
|
13
24
|
*/
|
25
|
+
var _columnHeadersCount = /*#__PURE__*/new WeakMap();
|
26
|
+
var _rowHeadersCount = /*#__PURE__*/new WeakMap();
|
14
27
|
class TableView {
|
15
|
-
/**
|
16
|
-
* Instance of {@link Handsontable}.
|
17
|
-
*
|
18
|
-
* @private
|
19
|
-
* @type {Handsontable}
|
20
|
-
*/
|
21
|
-
instance;
|
22
|
-
/**
|
23
|
-
* Instance of {@link EventManager}.
|
24
|
-
*
|
25
|
-
* @private
|
26
|
-
* @type {EventManager}
|
27
|
-
*/
|
28
|
-
eventManager;
|
29
|
-
/**
|
30
|
-
* Current Handsontable's GridSettings object.
|
31
|
-
*
|
32
|
-
* @private
|
33
|
-
* @type {GridSettings}
|
34
|
-
*/
|
35
|
-
settings;
|
36
|
-
/**
|
37
|
-
* Main <THEAD> element.
|
38
|
-
*
|
39
|
-
* @private
|
40
|
-
* @type {HTMLTableSectionElement}
|
41
|
-
*/
|
42
|
-
THEAD;
|
43
|
-
/**
|
44
|
-
* Main <TBODY> element.
|
45
|
-
*
|
46
|
-
* @private
|
47
|
-
* @type {HTMLTableSectionElement}
|
48
|
-
*/
|
49
|
-
TBODY;
|
50
|
-
/**
|
51
|
-
* Main Walkontable instance.
|
52
|
-
*
|
53
|
-
* @private
|
54
|
-
* @type {Walkontable}
|
55
|
-
*/
|
56
|
-
_wt;
|
57
|
-
/**
|
58
|
-
* Main Walkontable instance.
|
59
|
-
*
|
60
|
-
* @private
|
61
|
-
* @type {Walkontable}
|
62
|
-
*/
|
63
|
-
activeWt;
|
64
|
-
/**
|
65
|
-
* The total number of the column header renderers applied to the table through the
|
66
|
-
* `afterGetColumnHeaderRenderers` hook.
|
67
|
-
*
|
68
|
-
* @type {number}
|
69
|
-
*/
|
70
|
-
#columnHeadersCount = 0;
|
71
|
-
/**
|
72
|
-
* The total number of the row header renderers applied to the table through the
|
73
|
-
* `afterGetRowHeaderRenderers` hook.
|
74
|
-
*
|
75
|
-
* @type {number}
|
76
|
-
*/
|
77
|
-
#rowHeadersCount = 0;
|
78
|
-
/**
|
79
|
-
* The flag determines if the `adjustElementsSize` method call was made during
|
80
|
-
* the render suspending. If true, the method has to be triggered once after render
|
81
|
-
* resuming.
|
82
|
-
*
|
83
|
-
* @private
|
84
|
-
* @type {boolean}
|
85
|
-
*/
|
86
|
-
postponedAdjustElementsSize = false;
|
87
|
-
|
88
28
|
/**
|
89
29
|
* @param {Hanstontable} instance Instance of {@link Handsontable}.
|
90
30
|
*/
|
91
31
|
constructor(instance) {
|
32
|
+
/**
|
33
|
+
* Instance of {@link Handsontable}.
|
34
|
+
*
|
35
|
+
* @private
|
36
|
+
* @type {Handsontable}
|
37
|
+
*/
|
38
|
+
_defineProperty(this, "instance", void 0);
|
39
|
+
/**
|
40
|
+
* Instance of {@link EventManager}.
|
41
|
+
*
|
42
|
+
* @private
|
43
|
+
* @type {EventManager}
|
44
|
+
*/
|
45
|
+
_defineProperty(this, "eventManager", void 0);
|
46
|
+
/**
|
47
|
+
* Current Handsontable's GridSettings object.
|
48
|
+
*
|
49
|
+
* @private
|
50
|
+
* @type {GridSettings}
|
51
|
+
*/
|
52
|
+
_defineProperty(this, "settings", void 0);
|
53
|
+
/**
|
54
|
+
* Main <THEAD> element.
|
55
|
+
*
|
56
|
+
* @private
|
57
|
+
* @type {HTMLTableSectionElement}
|
58
|
+
*/
|
59
|
+
_defineProperty(this, "THEAD", void 0);
|
60
|
+
/**
|
61
|
+
* Main <TBODY> element.
|
62
|
+
*
|
63
|
+
* @private
|
64
|
+
* @type {HTMLTableSectionElement}
|
65
|
+
*/
|
66
|
+
_defineProperty(this, "TBODY", void 0);
|
67
|
+
/**
|
68
|
+
* Main Walkontable instance.
|
69
|
+
*
|
70
|
+
* @private
|
71
|
+
* @type {Walkontable}
|
72
|
+
*/
|
73
|
+
_defineProperty(this, "_wt", void 0);
|
74
|
+
/**
|
75
|
+
* Main Walkontable instance.
|
76
|
+
*
|
77
|
+
* @private
|
78
|
+
* @type {Walkontable}
|
79
|
+
*/
|
80
|
+
_defineProperty(this, "activeWt", void 0);
|
81
|
+
/**
|
82
|
+
* The total number of the column header renderers applied to the table through the
|
83
|
+
* `afterGetColumnHeaderRenderers` hook.
|
84
|
+
*
|
85
|
+
* @type {number}
|
86
|
+
*/
|
87
|
+
_classPrivateFieldInitSpec(this, _columnHeadersCount, {
|
88
|
+
writable: true,
|
89
|
+
value: 0
|
90
|
+
});
|
91
|
+
/**
|
92
|
+
* The total number of the row header renderers applied to the table through the
|
93
|
+
* `afterGetRowHeaderRenderers` hook.
|
94
|
+
*
|
95
|
+
* @type {number}
|
96
|
+
*/
|
97
|
+
_classPrivateFieldInitSpec(this, _rowHeadersCount, {
|
98
|
+
writable: true,
|
99
|
+
value: 0
|
100
|
+
});
|
101
|
+
/**
|
102
|
+
* The flag determines if the `adjustElementsSize` method call was made during
|
103
|
+
* the render suspending. If true, the method has to be triggered once after render
|
104
|
+
* resuming.
|
105
|
+
*
|
106
|
+
* @private
|
107
|
+
* @type {boolean}
|
108
|
+
*/
|
109
|
+
_defineProperty(this, "postponedAdjustElementsSize", false);
|
92
110
|
this.instance = instance;
|
93
111
|
this.eventManager = new EventManager(this.instance);
|
94
112
|
this.settings = this.instance.getSettings();
|
@@ -290,11 +308,14 @@ class TableView {
|
|
290
308
|
});
|
291
309
|
this.eventManager.addEventListener(documentElement, 'mouseup', event => {
|
292
310
|
if (selection.isInProgress() && isLeftClick(event)) {
|
293
|
-
// is left mouse button
|
294
311
|
selection.finish();
|
295
312
|
}
|
296
313
|
priv.mouseDown = false;
|
297
|
-
|
314
|
+
const isOutsideInputElement = isOutsideInput(rootDocument.activeElement);
|
315
|
+
if (!isOutsideInputElement) {
|
316
|
+
return;
|
317
|
+
}
|
318
|
+
if (isOutsideInputElement || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !isRightClick(event)) {
|
298
319
|
this.instance.unlisten();
|
299
320
|
}
|
300
321
|
});
|
@@ -528,6 +549,40 @@ class TableView {
|
|
528
549
|
return this.countNotHiddenRowIndexes(visualFixedRowsBottom, 1);
|
529
550
|
}
|
530
551
|
|
552
|
+
/**
|
553
|
+
* The function returns the number of renderable column indexes within the passed range of the visual indexes.
|
554
|
+
*
|
555
|
+
* @param {number} columnStart The column visual start index.
|
556
|
+
* @param {number} columnEnd The column visual end index.
|
557
|
+
* @returns {number}
|
558
|
+
*/
|
559
|
+
countRenderableColumnsInRange(columnStart, columnEnd) {
|
560
|
+
let count = 0;
|
561
|
+
for (let column = columnStart; column <= columnEnd; column++) {
|
562
|
+
if (this.instance.columnIndexMapper.getRenderableFromVisualIndex(column) !== null) {
|
563
|
+
count += 1;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
return count;
|
567
|
+
}
|
568
|
+
|
569
|
+
/**
|
570
|
+
* The function returns the number of renderable row indexes within the passed range of the visual indexes.
|
571
|
+
*
|
572
|
+
* @param {number} rowStart The row visual start index.
|
573
|
+
* @param {number} rowEnd The row visual end index.
|
574
|
+
* @returns {number}
|
575
|
+
*/
|
576
|
+
countRenderableRowsInRange(rowStart, rowEnd) {
|
577
|
+
let count = 0;
|
578
|
+
for (let row = rowStart; row <= rowEnd; row++) {
|
579
|
+
if (this.instance.rowIndexMapper.getRenderableFromVisualIndex(row) !== null) {
|
580
|
+
count += 1;
|
581
|
+
}
|
582
|
+
}
|
583
|
+
return count;
|
584
|
+
}
|
585
|
+
|
531
586
|
/**
|
532
587
|
* Checks if at least one cell than belongs to the main table is not covered by the top, left or
|
533
588
|
* bottom overlay.
|
@@ -591,7 +646,7 @@ class TableView {
|
|
591
646
|
});
|
592
647
|
}
|
593
648
|
this.instance.runHooks('afterGetRowHeaderRenderers', headerRenderers);
|
594
|
-
this
|
649
|
+
_classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
|
595
650
|
return headerRenderers;
|
596
651
|
},
|
597
652
|
columnHeaders: () => {
|
@@ -605,7 +660,7 @@ class TableView {
|
|
605
660
|
});
|
606
661
|
}
|
607
662
|
this.instance.runHooks('afterGetColumnHeaderRenderers', headerRenderers);
|
608
|
-
this
|
663
|
+
_classPrivateFieldSet(this, _columnHeadersCount, headerRenderers.length);
|
609
664
|
return headerRenderers;
|
610
665
|
},
|
611
666
|
columnWidth: renderedColumnIndex => {
|
@@ -747,20 +802,40 @@ class TableView {
|
|
747
802
|
},
|
748
803
|
beforeDraw: (force, skipRender) => this.beforeRender(force, skipRender),
|
749
804
|
onDraw: force => this.afterRender(force),
|
750
|
-
onScrollVertically: () =>
|
751
|
-
|
805
|
+
onScrollVertically: () => {
|
806
|
+
this.instance.runHooks('afterScrollVertically');
|
807
|
+
this.instance.runHooks('afterScroll');
|
808
|
+
},
|
809
|
+
onScrollHorizontally: () => {
|
810
|
+
this.instance.runHooks('afterScrollHorizontally');
|
811
|
+
this.instance.runHooks('afterScroll');
|
812
|
+
},
|
752
813
|
onBeforeRemoveCellClassNames: () => this.instance.runHooks('beforeRemoveCellClassNames'),
|
753
814
|
onBeforeHighlightingRowHeader: (renderableRow, headerLevel, highlightMeta) => {
|
754
815
|
const rowMapper = this.instance.rowIndexMapper;
|
755
|
-
const
|
816
|
+
const areColumnHeadersSelected = renderableRow < 0;
|
817
|
+
let visualRow = renderableRow;
|
818
|
+
if (!areColumnHeadersSelected) {
|
819
|
+
visualRow = rowMapper.getVisualFromRenderableIndex(renderableRow);
|
820
|
+
}
|
756
821
|
const newVisualRow = this.instance.runHooks('beforeHighlightingRowHeader', visualRow, headerLevel, highlightMeta);
|
757
|
-
|
822
|
+
if (!areColumnHeadersSelected) {
|
823
|
+
return rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(newVisualRow, 1));
|
824
|
+
}
|
825
|
+
return newVisualRow;
|
758
826
|
},
|
759
827
|
onBeforeHighlightingColumnHeader: (renderableColumn, headerLevel, highlightMeta) => {
|
760
828
|
const columnMapper = this.instance.columnIndexMapper;
|
761
|
-
const
|
829
|
+
const areRowHeadersSelected = renderableColumn < 0;
|
830
|
+
let visualColumn = renderableColumn;
|
831
|
+
if (!areRowHeadersSelected) {
|
832
|
+
visualColumn = columnMapper.getVisualFromRenderableIndex(renderableColumn);
|
833
|
+
}
|
762
834
|
const newVisualColumn = this.instance.runHooks('beforeHighlightingColumnHeader', visualColumn, headerLevel, highlightMeta);
|
763
|
-
|
835
|
+
if (!areRowHeadersSelected) {
|
836
|
+
return columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(newVisualColumn, 1));
|
837
|
+
}
|
838
|
+
return newVisualColumn;
|
764
839
|
},
|
765
840
|
onAfterDrawSelection: (currentRow, currentColumn, layerLevel) => {
|
766
841
|
let cornersOfSelection;
|
@@ -768,10 +843,7 @@ class TableView {
|
|
768
843
|
const selectedRange = this.instance.selection.getSelectedRange();
|
769
844
|
const selectionRangeSize = selectedRange.size();
|
770
845
|
if (selectionRangeSize > 0) {
|
771
|
-
|
772
|
-
// Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
|
773
|
-
const selectionOffset = (layerLevel != null ? layerLevel : 0) + 1 - selectionRangeSize;
|
774
|
-
const selectionForLayer = selectedRange.peekByIndex(selectionOffset);
|
846
|
+
const selectionForLayer = selectedRange.peekByIndex(layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0);
|
775
847
|
cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
|
776
848
|
}
|
777
849
|
return this.instance.runHooks('afterDrawSelection', visualRowIndex, visualColumnIndex, cornersOfSelection, layerLevel);
|
@@ -923,8 +995,8 @@ class TableView {
|
|
923
995
|
* @returns {boolean}
|
924
996
|
*/
|
925
997
|
isSelectedOnlyCell() {
|
926
|
-
var _this$instance$getSel;
|
927
|
-
return (_this$instance$getSel = this.instance.getSelectedRangeLast()
|
998
|
+
var _this$instance$getSel, _this$instance$getSel2;
|
999
|
+
return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingleCell()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
|
928
1000
|
}
|
929
1001
|
|
930
1002
|
/**
|
@@ -1162,7 +1234,7 @@ class TableView {
|
|
1162
1234
|
* @returns {number}
|
1163
1235
|
*/
|
1164
1236
|
getColumnHeadersCount() {
|
1165
|
-
return this
|
1237
|
+
return _classPrivateFieldGet(this, _columnHeadersCount);
|
1166
1238
|
}
|
1167
1239
|
|
1168
1240
|
/**
|
@@ -1171,7 +1243,7 @@ class TableView {
|
|
1171
1243
|
* @returns {number}
|
1172
1244
|
*/
|
1173
1245
|
getRowHeadersCount() {
|
1174
|
-
return this
|
1246
|
+
return _classPrivateFieldGet(this, _rowHeadersCount);
|
1175
1247
|
}
|
1176
1248
|
|
1177
1249
|
/**
|
@@ -1,8 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
4
5
|
var _observer = require("./observer");
|
5
6
|
var _utils = require("./utils");
|
7
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
8
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
9
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
11
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
12
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
6
14
|
/**
|
7
15
|
* The ChangesObservable module is an object that represents a resource that provides
|
8
16
|
* the ability to observe the changes that happened in the index map indexes during
|
@@ -11,53 +19,73 @@ var _utils = require("./utils");
|
|
11
19
|
* @private
|
12
20
|
* @class ChangesObservable
|
13
21
|
*/
|
22
|
+
var _observers = /*#__PURE__*/new WeakMap();
|
23
|
+
var _indexMatrix = /*#__PURE__*/new WeakMap();
|
24
|
+
var _currentIndexState = /*#__PURE__*/new WeakMap();
|
25
|
+
var _isMatrixIndexesInitialized = /*#__PURE__*/new WeakMap();
|
26
|
+
var _initialIndexValue = /*#__PURE__*/new WeakMap();
|
14
27
|
class ChangesObservable {
|
15
|
-
/**
|
16
|
-
* The list of registered ChangesObserver instances.
|
17
|
-
*
|
18
|
-
* @type {ChangesObserver[]}
|
19
|
-
*/
|
20
|
-
#observers = new Set();
|
21
|
-
/**
|
22
|
-
* An array with default values that act as a base array that will be compared with
|
23
|
-
* the last saved index state. The changes are generated and immediately send through
|
24
|
-
* the newly created ChangesObserver object. Thanks to that, the observer initially has
|
25
|
-
* all information about what indexes are currently changed.
|
26
|
-
*
|
27
|
-
* @type {Array}
|
28
|
-
*/
|
29
|
-
#indexMatrix = [];
|
30
|
-
/**
|
31
|
-
* An array that holds the indexes state that is currently valid. The value is changed on every
|
32
|
-
* index mapper cache update.
|
33
|
-
*
|
34
|
-
* @type {Array}
|
35
|
-
*/
|
36
|
-
#currentIndexState = [];
|
37
|
-
/**
|
38
|
-
* The flag determines if the observable is initialized or not. Not initialized object creates
|
39
|
-
* index matrix once while emitting new changes.
|
40
|
-
*
|
41
|
-
* @type {boolean}
|
42
|
-
*/
|
43
|
-
#isMatrixIndexesInitialized = false;
|
44
|
-
/**
|
45
|
-
* The initial index value allows control from what value the index matrix array will be created.
|
46
|
-
* Changing that value changes how the array diff generates the changes for the initial data
|
47
|
-
* sent to the subscribers. For example, the changes can be triggered by detecting the changes
|
48
|
-
* from `false` to `true` value or vice versa. Generally, it depends on which index map type
|
49
|
-
* the Observable will work with. For "hiding" or "trimming" index types, it will be boolean
|
50
|
-
* values. For various index maps, it can be anything, but I suspect that the most appropriate
|
51
|
-
* initial value will be "undefined" in that case.
|
52
|
-
*
|
53
|
-
* @type {boolean}
|
54
|
-
*/
|
55
|
-
#initialIndexValue = false;
|
56
28
|
constructor() {
|
57
29
|
let {
|
58
30
|
initialIndexValue
|
59
31
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
60
|
-
|
32
|
+
/**
|
33
|
+
* The list of registered ChangesObserver instances.
|
34
|
+
*
|
35
|
+
* @type {ChangesObserver[]}
|
36
|
+
*/
|
37
|
+
_classPrivateFieldInitSpec(this, _observers, {
|
38
|
+
writable: true,
|
39
|
+
value: new Set()
|
40
|
+
});
|
41
|
+
/**
|
42
|
+
* An array with default values that act as a base array that will be compared with
|
43
|
+
* the last saved index state. The changes are generated and immediately send through
|
44
|
+
* the newly created ChangesObserver object. Thanks to that, the observer initially has
|
45
|
+
* all information about what indexes are currently changed.
|
46
|
+
*
|
47
|
+
* @type {Array}
|
48
|
+
*/
|
49
|
+
_classPrivateFieldInitSpec(this, _indexMatrix, {
|
50
|
+
writable: true,
|
51
|
+
value: []
|
52
|
+
});
|
53
|
+
/**
|
54
|
+
* An array that holds the indexes state that is currently valid. The value is changed on every
|
55
|
+
* index mapper cache update.
|
56
|
+
*
|
57
|
+
* @type {Array}
|
58
|
+
*/
|
59
|
+
_classPrivateFieldInitSpec(this, _currentIndexState, {
|
60
|
+
writable: true,
|
61
|
+
value: []
|
62
|
+
});
|
63
|
+
/**
|
64
|
+
* The flag determines if the observable is initialized or not. Not initialized object creates
|
65
|
+
* index matrix once while emitting new changes.
|
66
|
+
*
|
67
|
+
* @type {boolean}
|
68
|
+
*/
|
69
|
+
_classPrivateFieldInitSpec(this, _isMatrixIndexesInitialized, {
|
70
|
+
writable: true,
|
71
|
+
value: false
|
72
|
+
});
|
73
|
+
/**
|
74
|
+
* The initial index value allows control from what value the index matrix array will be created.
|
75
|
+
* Changing that value changes how the array diff generates the changes for the initial data
|
76
|
+
* sent to the subscribers. For example, the changes can be triggered by detecting the changes
|
77
|
+
* from `false` to `true` value or vice versa. Generally, it depends on which index map type
|
78
|
+
* the Observable will work with. For "hiding" or "trimming" index types, it will be boolean
|
79
|
+
* values. For various index maps, it can be anything, but I suspect that the most appropriate
|
80
|
+
* initial value will be "undefined" in that case.
|
81
|
+
*
|
82
|
+
* @type {boolean}
|
83
|
+
*/
|
84
|
+
_classPrivateFieldInitSpec(this, _initialIndexValue, {
|
85
|
+
writable: true,
|
86
|
+
value: false
|
87
|
+
});
|
88
|
+
_classPrivateFieldSet(this, _initialIndexValue, initialIndexValue !== null && initialIndexValue !== void 0 ? initialIndexValue : false);
|
61
89
|
}
|
62
90
|
|
63
91
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
@@ -86,11 +114,11 @@ class ChangesObservable {
|
|
86
114
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
87
115
|
createObserver() {
|
88
116
|
const observer = new _observer.ChangesObserver();
|
89
|
-
this
|
117
|
+
_classPrivateFieldGet(this, _observers).add(observer);
|
90
118
|
observer.addLocalHook('unsubscribe', () => {
|
91
|
-
this
|
119
|
+
_classPrivateFieldGet(this, _observers).delete(observer);
|
92
120
|
});
|
93
|
-
observer._writeInitialChanges((0, _utils.arrayDiff)(this
|
121
|
+
observer._writeInitialChanges((0, _utils.arrayDiff)(_classPrivateFieldGet(this, _indexMatrix), _classPrivateFieldGet(this, _currentIndexState)));
|
94
122
|
return observer;
|
95
123
|
}
|
96
124
|
|
@@ -102,21 +130,21 @@ class ChangesObservable {
|
|
102
130
|
* @param {Array} indexesState An array with index map state.
|
103
131
|
*/
|
104
132
|
emit(indexesState) {
|
105
|
-
let currentIndexState = this
|
106
|
-
if (!this
|
133
|
+
let currentIndexState = _classPrivateFieldGet(this, _currentIndexState);
|
134
|
+
if (!_classPrivateFieldGet(this, _isMatrixIndexesInitialized) || _classPrivateFieldGet(this, _indexMatrix).length !== indexesState.length) {
|
107
135
|
if (indexesState.length === 0) {
|
108
|
-
indexesState = new Array(currentIndexState.length).fill(this
|
136
|
+
indexesState = new Array(currentIndexState.length).fill(_classPrivateFieldGet(this, _initialIndexValue));
|
109
137
|
} else {
|
110
|
-
this
|
138
|
+
_classPrivateFieldSet(this, _indexMatrix, new Array(indexesState.length).fill(_classPrivateFieldGet(this, _initialIndexValue)));
|
111
139
|
}
|
112
|
-
if (!this
|
113
|
-
this
|
114
|
-
currentIndexState = this
|
140
|
+
if (!_classPrivateFieldGet(this, _isMatrixIndexesInitialized)) {
|
141
|
+
_classPrivateFieldSet(this, _isMatrixIndexesInitialized, true);
|
142
|
+
currentIndexState = _classPrivateFieldGet(this, _indexMatrix);
|
115
143
|
}
|
116
144
|
}
|
117
145
|
const changes = (0, _utils.arrayDiff)(currentIndexState, indexesState);
|
118
|
-
this
|
119
|
-
this
|
146
|
+
_classPrivateFieldGet(this, _observers).forEach(observer => observer._write(changes));
|
147
|
+
_classPrivateFieldSet(this, _currentIndexState, indexesState);
|
120
148
|
}
|
121
149
|
}
|
122
150
|
exports.ChangesObservable = ChangesObservable;
|