handsontable 16.0.1-next-eee5f08-20250710 → 16.1.0-next-abd8f2e-20250904
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/walkontable/src/overlays.js +12 -2
- package/3rdparty/walkontable/src/overlays.mjs +12 -2
- package/3rdparty/walkontable/src/viewport.js +2 -6
- package/3rdparty/walkontable/src/viewport.mjs +2 -6
- package/CHANGELOG.md +32 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/autocompleteType/accessors/index.js +7 -0
- package/cellTypes/autocompleteType/accessors/index.mjs +2 -0
- package/cellTypes/autocompleteType/accessors/valueGetter.js +14 -0
- package/cellTypes/autocompleteType/accessors/valueGetter.mjs +10 -0
- package/cellTypes/autocompleteType/accessors/valueSetter.js +25 -0
- package/cellTypes/autocompleteType/accessors/valueSetter.mjs +21 -0
- package/cellTypes/autocompleteType/autocompleteType.js +4 -1
- package/cellTypes/autocompleteType/autocompleteType.mjs +4 -1
- package/cellTypes/checkboxType/accessors/index.js +5 -0
- package/cellTypes/checkboxType/accessors/index.mjs +1 -0
- package/cellTypes/checkboxType/accessors/valueSetter.js +26 -0
- package/cellTypes/checkboxType/accessors/valueSetter.mjs +22 -0
- package/cellTypes/checkboxType/checkboxType.js +3 -1
- package/cellTypes/checkboxType/checkboxType.mjs +3 -1
- package/cellTypes/dropdownType/accessors/index.js +7 -0
- package/cellTypes/dropdownType/accessors/index.mjs +2 -0
- package/cellTypes/dropdownType/accessors/valueGetter.js +14 -0
- package/cellTypes/dropdownType/accessors/valueGetter.mjs +10 -0
- package/cellTypes/dropdownType/accessors/valueSetter.js +17 -0
- package/cellTypes/dropdownType/accessors/valueSetter.mjs +13 -0
- package/cellTypes/dropdownType/dropdownType.js +4 -1
- package/cellTypes/dropdownType/dropdownType.mjs +4 -1
- package/cellTypes/numericType/accessors/index.js +5 -0
- package/cellTypes/numericType/accessors/index.mjs +1 -0
- package/cellTypes/numericType/accessors/valueSetter.js +19 -0
- package/cellTypes/numericType/accessors/valueSetter.mjs +15 -0
- package/cellTypes/numericType/numericType.js +3 -1
- package/cellTypes/numericType/numericType.mjs +3 -1
- package/core/focusCatcher/index.js +37 -112
- package/core/focusCatcher/index.mjs +35 -110
- package/core/focusCatcher/utils.js +31 -0
- package/core/focusCatcher/utils.mjs +27 -0
- package/core/hooks/constants.js +242 -0
- package/core/hooks/constants.mjs +242 -0
- package/core/hooks/index.d.ts +22 -0
- package/core/viewportScroll/scrollStrategies/focusScroll.js +5 -1
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +5 -1
- package/core/viewportScroll/utils.js +1 -1
- package/core/viewportScroll/utils.mjs +1 -1
- package/core.d.ts +4 -0
- package/core.js +237 -139
- package/core.mjs +240 -142
- package/dataMap/dataMap.js +13 -3
- package/dataMap/dataMap.mjs +14 -4
- package/dataMap/dataSource.js +16 -0
- package/dataMap/dataSource.mjs +16 -0
- package/dataMap/metaManager/lazyFactoryMap.js +4 -3
- package/dataMap/metaManager/lazyFactoryMap.mjs +2 -1
- package/dataMap/metaManager/metaLayers/cellMeta.js +3 -2
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +3 -2
- package/dataMap/metaManager/metaSchema.js +289 -4
- package/dataMap/metaManager/metaSchema.mjs +289 -4
- package/dataMap/metaManager/utils.js +0 -11
- package/dataMap/metaManager/utils.mjs +0 -10
- package/dataMap/replaceData.js +1 -0
- package/dataMap/replaceData.mjs +1 -0
- package/dist/handsontable.css +281 -4
- package/dist/handsontable.full.css +281 -4
- package/dist/handsontable.full.js +7844 -2990
- package/dist/handsontable.full.min.css +4 -5
- package/dist/handsontable.full.min.js +167 -165
- package/dist/handsontable.js +9639 -4806
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +52 -50
- package/dist/languages/all.js +231 -21
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.js +11 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.js +11 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.js +11 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.js +11 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.js +11 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.js +11 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fa-IR.js +11 -1
- package/dist/languages/fa-IR.min.js +1 -1
- package/dist/languages/fr-FR.js +11 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.js +11 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.js +11 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.js +11 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.js +11 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.js +11 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.js +11 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.js +11 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.js +11 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.js +11 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.js +11 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.js +11 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.js +11 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.js +11 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +4 -4
- package/editorManager.mjs +4 -4
- package/editors/autocompleteEditor/autocompleteEditor.js +50 -112
- package/editors/autocompleteEditor/autocompleteEditor.mjs +51 -113
- package/editors/baseEditor/baseEditor.js +10 -6
- package/editors/baseEditor/baseEditor.mjs +10 -6
- package/editors/handsontableEditor/handsontableEditor.js +9 -9
- package/editors/handsontableEditor/handsontableEditor.mjs +9 -9
- package/editors/textEditor/textEditor.js +0 -7
- package/editors/textEditor/textEditor.mjs +0 -7
- package/focusManager.js +2 -2
- package/focusManager.mjs +2 -2
- package/helpers/a11y.js +15 -2
- package/helpers/a11y.mjs +10 -2
- package/helpers/console.js +12 -0
- package/helpers/console.mjs +11 -0
- package/helpers/dom/element.js +4 -4
- package/helpers/dom/element.mjs +4 -4
- package/helpers/mixed.js +65 -2
- package/helpers/mixed.mjs +63 -2
- package/helpers/number.js +28 -0
- package/helpers/number.mjs +26 -0
- package/helpers/object.js +35 -0
- package/helpers/object.mjs +34 -0
- package/helpers/string.js +19 -0
- package/helpers/string.mjs +18 -0
- package/helpers/templateLiteralTag.js +57 -1
- package/helpers/templateLiteralTag.mjs +56 -1
- package/i18n/constants.js +13 -1
- package/i18n/constants.mjs +13 -1
- package/i18n/languages/ar-AR.js +11 -1
- package/i18n/languages/ar-AR.mjs +11 -1
- package/i18n/languages/cs-CZ.js +11 -1
- package/i18n/languages/cs-CZ.mjs +11 -1
- package/i18n/languages/de-CH.js +11 -1
- package/i18n/languages/de-CH.mjs +11 -1
- package/i18n/languages/de-DE.js +11 -1
- package/i18n/languages/de-DE.mjs +11 -1
- package/i18n/languages/en-US.js +11 -1
- package/i18n/languages/en-US.mjs +11 -1
- package/i18n/languages/es-MX.js +11 -1
- package/i18n/languages/es-MX.mjs +11 -1
- package/i18n/languages/fa-IR.js +11 -1
- package/i18n/languages/fa-IR.mjs +11 -1
- package/i18n/languages/fr-FR.js +11 -1
- package/i18n/languages/fr-FR.mjs +11 -1
- package/i18n/languages/hr-HR.js +11 -1
- package/i18n/languages/hr-HR.mjs +11 -1
- package/i18n/languages/it-IT.js +11 -1
- package/i18n/languages/it-IT.mjs +11 -1
- package/i18n/languages/ja-JP.js +11 -1
- package/i18n/languages/ja-JP.mjs +11 -1
- package/i18n/languages/ko-KR.js +11 -1
- package/i18n/languages/ko-KR.mjs +11 -1
- package/i18n/languages/lv-LV.js +11 -1
- package/i18n/languages/lv-LV.mjs +11 -1
- package/i18n/languages/nb-NO.js +11 -1
- package/i18n/languages/nb-NO.mjs +11 -1
- package/i18n/languages/nl-NL.js +11 -1
- package/i18n/languages/nl-NL.mjs +11 -1
- package/i18n/languages/pl-PL.js +11 -1
- package/i18n/languages/pl-PL.mjs +11 -1
- package/i18n/languages/pt-BR.js +11 -1
- package/i18n/languages/pt-BR.mjs +11 -1
- package/i18n/languages/ru-RU.js +11 -1
- package/i18n/languages/ru-RU.mjs +11 -1
- package/i18n/languages/sr-SP.js +11 -1
- package/i18n/languages/sr-SP.mjs +11 -1
- package/i18n/languages/zh-CN.js +11 -1
- package/i18n/languages/zh-CN.mjs +11 -1
- package/i18n/languages/zh-TW.js +11 -1
- package/i18n/languages/zh-TW.mjs +11 -1
- package/i18n/phraseFormatters/index.js +3 -1
- package/i18n/phraseFormatters/index.mjs +3 -1
- package/i18n/registry.js +5 -6
- package/i18n/registry.mjs +5 -6
- package/index.d.ts +27 -0
- package/languages/all.js +231 -21
- package/languages/ar-AR.js +11 -1
- package/languages/ar-AR.mjs +11 -1
- package/languages/cs-CZ.js +11 -1
- package/languages/cs-CZ.mjs +11 -1
- package/languages/de-CH.js +11 -1
- package/languages/de-CH.mjs +11 -1
- package/languages/de-DE.js +11 -1
- package/languages/de-DE.mjs +11 -1
- package/languages/en-US.js +11 -1
- package/languages/en-US.mjs +11 -1
- package/languages/es-MX.js +11 -1
- package/languages/es-MX.mjs +11 -1
- package/languages/fa-IR.js +11 -1
- package/languages/fa-IR.mjs +11 -1
- package/languages/fr-FR.js +11 -1
- package/languages/fr-FR.mjs +11 -1
- package/languages/hr-HR.js +11 -1
- package/languages/hr-HR.mjs +11 -1
- package/languages/index.js +231 -21
- package/languages/it-IT.js +11 -1
- package/languages/it-IT.mjs +11 -1
- package/languages/ja-JP.js +11 -1
- package/languages/ja-JP.mjs +11 -1
- package/languages/ko-KR.js +11 -1
- package/languages/ko-KR.mjs +11 -1
- package/languages/lv-LV.js +11 -1
- package/languages/lv-LV.mjs +11 -1
- package/languages/nb-NO.js +11 -1
- package/languages/nb-NO.mjs +11 -1
- package/languages/nl-NL.js +11 -1
- package/languages/nl-NL.mjs +11 -1
- package/languages/pl-PL.js +11 -1
- package/languages/pl-PL.mjs +11 -1
- package/languages/pt-BR.js +11 -1
- package/languages/pt-BR.mjs +11 -1
- package/languages/ru-RU.js +11 -1
- package/languages/ru-RU.mjs +11 -1
- package/languages/sr-SP.js +11 -1
- package/languages/sr-SP.mjs +11 -1
- package/languages/zh-CN.js +11 -1
- package/languages/zh-CN.mjs +11 -1
- package/languages/zh-TW.js +11 -1
- package/languages/zh-TW.mjs +11 -1
- package/mixins/localHooks.js +16 -0
- package/mixins/localHooks.mjs +16 -0
- package/package.json +19 -1
- package/plugins/autoRowSize/autoRowSize.js +43 -6
- package/plugins/autoRowSize/autoRowSize.mjs +43 -6
- package/plugins/autofill/autofill.js +50 -3
- package/plugins/autofill/autofill.mjs +50 -3
- package/plugins/base/base.js +86 -15
- package/plugins/base/base.mjs +87 -16
- package/plugins/collapsibleColumns/collapsibleColumns.js +4 -4
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -4
- package/plugins/columnSorting/columnSorting.js +3 -3
- package/plugins/columnSorting/columnSorting.mjs +3 -3
- package/plugins/comments/comments.js +52 -22
- package/plugins/comments/comments.mjs +52 -22
- package/plugins/comments/contextMenuItem/addEditComment.js +3 -3
- package/plugins/comments/contextMenuItem/addEditComment.mjs +3 -3
- package/plugins/comments/contextMenuItem/readOnlyComment.js +2 -2
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +2 -2
- package/plugins/comments/contextMenuItem/removeComment.js +2 -2
- package/plugins/comments/contextMenuItem/removeComment.mjs +2 -2
- package/plugins/contextMenu/contextMenu.js +4 -5
- package/plugins/contextMenu/contextMenu.mjs +4 -5
- package/plugins/contextMenu/menu/cursor.js +1 -1
- package/plugins/contextMenu/menu/cursor.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +5 -5
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +5 -5
- package/plugins/contextMenu/menu/menu.js +3 -3
- package/plugins/contextMenu/menu/menu.mjs +3 -3
- package/plugins/contextMenu/menu/positioner.js +1 -1
- package/plugins/contextMenu/menu/positioner.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/alignment.js +1 -1
- package/plugins/contextMenu/predefinedItems/alignment.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -3
- package/plugins/contextMenu/predefinedItems/columnRight.js +3 -3
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -3
- package/plugins/contextMenu/predefinedItems/readOnly.js +1 -1
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -3
- package/plugins/copyPaste/contextMenuItem/copy.js +1 -1
- package/plugins/copyPaste/contextMenuItem/copy.mjs +1 -1
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +3 -3
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +3 -3
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +3 -3
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +3 -3
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +3 -3
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +3 -3
- package/plugins/copyPaste/contextMenuItem/cut.js +1 -1
- package/plugins/copyPaste/contextMenuItem/cut.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +75 -40
- package/plugins/copyPaste/copyPaste.mjs +76 -41
- package/plugins/customBorders/customBorders.js +1 -1
- package/plugins/customBorders/customBorders.mjs +1 -1
- package/plugins/dialog/dialog.d.ts +23 -0
- package/plugins/dialog/dialog.js +489 -0
- package/plugins/dialog/dialog.mjs +485 -0
- package/plugins/dialog/index.d.ts +1 -0
- package/plugins/dialog/index.js +7 -0
- package/plugins/dialog/index.mjs +1 -0
- package/plugins/dialog/ui.js +264 -0
- package/plugins/dialog/ui.mjs +259 -0
- package/plugins/dropdownMenu/dropdownMenu.js +5 -4
- package/plugins/dropdownMenu/dropdownMenu.mjs +5 -4
- package/plugins/filters/filters.js +2 -2
- package/plugins/filters/filters.mjs +2 -2
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +3 -3
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +3 -3
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +4 -4
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +4 -4
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +3 -3
- package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +3 -3
- package/plugins/hiddenRows/contextMenuItem/showRow.js +4 -4
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +4 -4
- package/plugins/index.d.ts +9 -0
- package/plugins/index.js +9 -0
- package/plugins/index.mjs +7 -1
- package/plugins/loading/content.js +36 -0
- package/plugins/loading/content.mjs +31 -0
- package/plugins/loading/index.d.ts +1 -0
- package/plugins/loading/index.js +7 -0
- package/plugins/loading/index.mjs +1 -0
- package/plugins/loading/loading.d.ts +19 -0
- package/plugins/loading/loading.js +292 -0
- package/plugins/loading/loading.mjs +287 -0
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +3 -3
- package/plugins/manualColumnMove/manualColumnMove.mjs +3 -3
- package/plugins/manualColumnResize/manualColumnResize.js +3 -3
- package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
- package/plugins/manualRowMove/manualRowMove.js +4 -4
- package/plugins/manualRowMove/manualRowMove.mjs +4 -4
- package/plugins/manualRowResize/manualRowResize.js +5 -2
- package/plugins/manualRowResize/manualRowResize.mjs +5 -2
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +15 -15
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +15 -15
- package/plugins/mergeCells/focusOrder.js +75 -39
- package/plugins/mergeCells/focusOrder.mjs +75 -39
- package/plugins/mergeCells/mergeCells.js +26 -19
- package/plugins/mergeCells/mergeCells.mjs +26 -19
- package/plugins/mergeCells/renderer.js +14 -8
- package/plugins/mergeCells/renderer.mjs +14 -8
- package/plugins/multiColumnSorting/multiColumnSorting.js +3 -3
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +3 -3
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +3 -3
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +3 -3
- package/plugins/nestedHeaders/nestedHeaders.js +47 -41
- package/plugins/nestedHeaders/nestedHeaders.mjs +47 -41
- package/plugins/nestedRows/nestedRows.js +3 -3
- package/plugins/nestedRows/nestedRows.mjs +3 -3
- package/plugins/nestedRows/ui/collapsing.js +1 -2
- package/plugins/nestedRows/ui/collapsing.mjs +1 -2
- package/plugins/nestedRows/ui/contextMenu.js +4 -4
- package/plugins/nestedRows/ui/contextMenu.mjs +4 -4
- package/plugins/nestedRows/ui/headers.js +4 -1
- package/plugins/nestedRows/ui/headers.mjs +4 -1
- package/plugins/pagination/focusController.js +27 -0
- package/plugins/pagination/focusController.mjs +23 -0
- package/plugins/pagination/index.d.ts +1 -0
- package/plugins/pagination/index.js +7 -0
- package/plugins/pagination/index.mjs +1 -0
- package/plugins/pagination/pagination.d.ts +52 -0
- package/plugins/pagination/pagination.js +1034 -0
- package/plugins/pagination/pagination.mjs +1030 -0
- package/plugins/pagination/strategies/autoPageSize.js +96 -0
- package/plugins/pagination/strategies/autoPageSize.mjs +92 -0
- package/plugins/pagination/strategies/fixedPageSize.js +88 -0
- package/plugins/pagination/strategies/fixedPageSize.mjs +84 -0
- package/plugins/pagination/strategies/index.js +22 -0
- package/plugins/pagination/strategies/index.mjs +18 -0
- package/plugins/pagination/ui.js +449 -0
- package/plugins/pagination/ui.mjs +443 -0
- package/plugins/pagination/utils.js +28 -0
- package/plugins/pagination/utils.mjs +24 -0
- package/plugins/stretchColumns/calculator.js +4 -0
- package/plugins/stretchColumns/calculator.mjs +4 -0
- package/plugins/stretchColumns/stretchColumns.js +1 -1
- package/plugins/stretchColumns/stretchColumns.mjs +1 -1
- package/plugins/undoRedo/actions/dataChange.js +17 -15
- package/plugins/undoRedo/actions/dataChange.mjs +17 -15
- package/renderers/checkboxRenderer/checkboxRenderer.js +3 -3
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +3 -3
- package/selection/range.js +11 -0
- package/selection/range.mjs +11 -0
- package/selection/selection.js +163 -124
- package/selection/selection.mjs +163 -124
- package/selection/transformation/_base.js +448 -0
- package/selection/transformation/_base.mjs +443 -0
- package/selection/transformation/extender.js +55 -0
- package/selection/transformation/extender.mjs +51 -0
- package/selection/transformation/focus.js +77 -0
- package/selection/transformation/focus.mjs +73 -0
- package/selection/transformation/index.js +7 -0
- package/selection/transformation/index.mjs +2 -0
- package/selection/utils.js +2 -1
- package/selection/utils.mjs +2 -1
- package/settings.d.ts +10 -1
- package/shortcutContexts/commands/editor/fastOpen.js +1 -1
- package/shortcutContexts/commands/editor/fastOpen.mjs +1 -1
- package/shortcutContexts/commands/editor/open.js +10 -4
- package/shortcutContexts/commands/editor/open.mjs +10 -4
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +2 -2
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +2 -2
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +2 -2
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +2 -2
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +2 -2
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +2 -2
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +5 -2
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +5 -2
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +5 -2
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +5 -2
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +1 -1
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -2
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -2
- package/shortcutContexts/commands/scrollToFocusedCell.js +1 -1
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +1 -1
- package/shortcutContexts/grid.js +3 -3
- package/shortcutContexts/grid.mjs +3 -3
- package/shortcuts/context.js +4 -1
- package/shortcuts/context.mjs +4 -1
- package/shortcuts/manager.js +17 -3
- package/shortcuts/manager.mjs +17 -3
- package/styles/handsontable.css +288 -22
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-classic.css +828 -0
- package/styles/ht-theme-classic.min.css +30 -0
- package/styles/ht-theme-horizon.css +122 -26
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main.css +124 -28
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +61 -25
- package/tableView.mjs +61 -25
- package/utils/a11yAnnouncer.js +70 -0
- package/utils/a11yAnnouncer.mjs +64 -0
- package/{core/focusCatcher → utils}/focusDetector.js +30 -12
- package/{core/focusCatcher → utils}/focusDetector.mjs +30 -12
- package/utils/samplesGenerator.js +17 -1
- package/utils/samplesGenerator.mjs +17 -1
- package/utils/stylesHandler.js +23 -8
- package/utils/stylesHandler.mjs +23 -8
- package/utils/valueAccessors.js +45 -0
- package/utils/valueAccessors.mjs +40 -0
- package/validators/autocompleteValidator/autocompleteValidator.js +2 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +2 -1
- package/selection/transformation.js +0 -335
- package/selection/transformation.mjs +0 -331
package/core.mjs
CHANGED
@@ -15,7 +15,7 @@ import "core-js/modules/esnext.iterator.map.js";
|
|
15
15
|
import "core-js/modules/web.immediate.js";
|
16
16
|
import { addClass, empty, observeVisibilityChangeOnce, removeClass } from "./helpers/dom/element.mjs";
|
17
17
|
import { isFunction } from "./helpers/function.mjs";
|
18
|
-
import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty
|
18
|
+
import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty } from "./helpers/mixed.mjs";
|
19
19
|
import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
|
20
20
|
import EditorManager from "./editorManager.mjs";
|
21
21
|
import EventManager from "./eventManager.mjs";
|
@@ -29,7 +29,7 @@ import { getRenderer } from "./renderers/registry.mjs";
|
|
29
29
|
import { getEditor } from "./editors/registry.mjs";
|
30
30
|
import { getValidator } from "./validators/registry.mjs";
|
31
31
|
import { randomString, toUpperCaseFirst } from "./helpers/string.mjs";
|
32
|
-
import { rangeEach, rangeEachReverse
|
32
|
+
import { rangeEach, rangeEachReverse } from "./helpers/number.mjs";
|
33
33
|
import TableView from "./tableView.mjs";
|
34
34
|
import DataSource from "./dataMap/dataSource.mjs";
|
35
35
|
import { spreadsheetColumnLabel } from "./helpers/data.mjs";
|
@@ -47,8 +47,10 @@ import { createShortcutManager } from "./shortcuts/index.mjs";
|
|
47
47
|
import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
|
48
48
|
import { getThemeClassName } from "./helpers/themes.mjs";
|
49
49
|
import { StylesHandler } from "./utils/stylesHandler.mjs";
|
50
|
-
import { warn } from "./helpers/console.mjs";
|
50
|
+
import { deprecatedWarn, warn } from "./helpers/console.mjs";
|
51
51
|
import { CellRangeToRenderableMapper } from "./core/coordsMapper/rangeToRenderableMapper.mjs";
|
52
|
+
import { install as installAccessibilityAnnouncer, uninstall as uninstallAccessibilityAnnouncer } from "./utils/a11yAnnouncer.mjs";
|
53
|
+
import { getValueSetterValue } from "./utils/valueAccessors.mjs";
|
52
54
|
let activeGuid = null;
|
53
55
|
|
54
56
|
/**
|
@@ -158,7 +160,8 @@ const deprecationWarns = new Set();
|
|
158
160
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
159
161
|
*/
|
160
162
|
export default function Core(rootContainer, userSettings) {
|
161
|
-
var
|
163
|
+
var _mergedUserSettings$l,
|
164
|
+
_this$rootWrapperElem,
|
162
165
|
_this = this;
|
163
166
|
let rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
164
167
|
let instance = this;
|
@@ -170,6 +173,10 @@ export default function Core(rootContainer, userSettings) {
|
|
170
173
|
let focusManager;
|
171
174
|
let viewportScroller;
|
172
175
|
let firstRun = true;
|
176
|
+
const mergedUserSettings = {
|
177
|
+
...userSettings.initialState,
|
178
|
+
...userSettings
|
179
|
+
};
|
173
180
|
if (hasValidParameter(rootInstanceSymbol)) {
|
174
181
|
registerAsRootInstance(this);
|
175
182
|
}
|
@@ -190,6 +197,14 @@ export default function Core(rootContainer, userSettings) {
|
|
190
197
|
*/
|
191
198
|
this.rootWrapperElement = undefined;
|
192
199
|
|
200
|
+
/**
|
201
|
+
* Reference to the grid element.
|
202
|
+
*
|
203
|
+
* @private
|
204
|
+
* @type {HTMLElement}
|
205
|
+
*/
|
206
|
+
this.rootGridElement = undefined;
|
207
|
+
|
193
208
|
/**
|
194
209
|
* Reference to the portal element.
|
195
210
|
*
|
@@ -224,10 +239,13 @@ export default function Core(rootContainer, userSettings) {
|
|
224
239
|
this.rootWindow = this.rootDocument.defaultView;
|
225
240
|
if (isRootInstance(this)) {
|
226
241
|
this.rootWrapperElement = this.rootDocument.createElement('div');
|
242
|
+
this.rootGridElement = this.rootDocument.createElement('div');
|
227
243
|
this.rootPortalElement = this.rootDocument.createElement('div');
|
228
|
-
addClass(this.rootElement, 'ht-wrapper');
|
244
|
+
addClass(this.rootElement, ['ht-wrapper', 'handsontable']);
|
229
245
|
addClass(this.rootWrapperElement, 'ht-root-wrapper');
|
230
|
-
|
246
|
+
addClass(this.rootGridElement, 'ht-grid');
|
247
|
+
this.rootGridElement.appendChild(this.rootElement);
|
248
|
+
this.rootWrapperElement.appendChild(this.rootGridElement);
|
231
249
|
this.rootContainer.appendChild(this.rootWrapperElement);
|
232
250
|
addClass(this.rootPortalElement, 'ht-portal');
|
233
251
|
this.rootDocument.body.appendChild(this.rootPortalElement);
|
@@ -264,9 +282,10 @@ export default function Core(rootContainer, userSettings) {
|
|
264
282
|
* @type {number}
|
265
283
|
*/
|
266
284
|
this.executionSuspendedCounter = 0;
|
267
|
-
const layoutDirection = (
|
285
|
+
const layoutDirection = (_mergedUserSettings$l = mergedUserSettings === null || mergedUserSettings === void 0 ? void 0 : mergedUserSettings.layoutDirection) !== null && _mergedUserSettings$l !== void 0 ? _mergedUserSettings$l : 'inherit';
|
268
286
|
const rootElementDirection = ['rtl', 'ltr'].includes(layoutDirection) ? layoutDirection : this.rootWindow.getComputedStyle(this.rootElement).direction;
|
269
287
|
this.rootElement.setAttribute('dir', rootElementDirection);
|
288
|
+
(_this$rootWrapperElem = this.rootWrapperElement) === null || _this$rootWrapperElem === void 0 || _this$rootWrapperElem.setAttribute('dir', rootElementDirection);
|
270
289
|
|
271
290
|
/**
|
272
291
|
* Checks if the grid is rendered using the right-to-left layout direction.
|
@@ -310,9 +329,26 @@ export default function Core(rootContainer, userSettings) {
|
|
310
329
|
* @private
|
311
330
|
* @type {StylesHandler}
|
312
331
|
*/
|
313
|
-
this.stylesHandler = new StylesHandler(
|
314
|
-
|
315
|
-
|
332
|
+
this.stylesHandler = new StylesHandler({
|
333
|
+
rootElement: instance.rootElement,
|
334
|
+
rootDocument: instance.rootDocument,
|
335
|
+
onThemeChange: validThemeName => {
|
336
|
+
if (isRootInstance(this)) {
|
337
|
+
removeClass(this.rootWrapperElement, /ht-theme-.*/g);
|
338
|
+
removeClass(this.rootPortalElement, /ht-theme-.*/g);
|
339
|
+
if (validThemeName) {
|
340
|
+
addClass(this.rootWrapperElement, validThemeName);
|
341
|
+
addClass(this.rootPortalElement, validThemeName);
|
342
|
+
if (!getComputedStyle(this.rootWrapperElement).getPropertyValue('--ht-line-height')) {
|
343
|
+
warn(`The "${validThemeName}" theme is enabled, but its stylesheets are missing or not imported correctly. \
|
344
|
+
Import the correct CSS files in order to use that theme.`);
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
});
|
350
|
+
mergedUserSettings.language = getValidLanguageCode(mergedUserSettings.language);
|
351
|
+
const settingsWithoutHooks = Object.fromEntries(Object.entries(mergedUserSettings).filter(_ref => {
|
316
352
|
let [key] = _ref;
|
317
353
|
return !(Hooks.getSingleton().isRegistered(key) || Hooks.getSingleton().isDeprecated(key));
|
318
354
|
}));
|
@@ -322,9 +358,6 @@ export default function Core(rootContainer, userSettings) {
|
|
322
358
|
const pluginsRegistry = createUniqueMap();
|
323
359
|
this.container = this.rootDocument.createElement('div');
|
324
360
|
this.rootElement.insertBefore(this.container, this.rootElement.firstChild);
|
325
|
-
if (isRootInstance(this)) {
|
326
|
-
_injectProductInfo(userSettings.licenseKey, this.rootWrapperElement);
|
327
|
-
}
|
328
361
|
this.guid = `ht_${randomString()}`; // this is the namespace for global events
|
329
362
|
|
330
363
|
foreignHotInstances.set(this.guid, this);
|
@@ -557,45 +590,55 @@ export default function Core(rootContainer, userSettings) {
|
|
557
590
|
args[_key7] = arguments[_key7];
|
558
591
|
}
|
559
592
|
return _this.runHooks('afterSelectRows', ...args);
|
560
|
-
}).addLocalHook('
|
593
|
+
}).addLocalHook('beforeSelectAll', function () {
|
561
594
|
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
562
595
|
args[_key8] = arguments[_key8];
|
563
596
|
}
|
564
|
-
return _this.runHooks('
|
565
|
-
}).addLocalHook('
|
597
|
+
return _this.runHooks('beforeSelectAll', ...args);
|
598
|
+
}).addLocalHook('afterSelectAll', function () {
|
566
599
|
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
567
600
|
args[_key9] = arguments[_key9];
|
568
601
|
}
|
569
|
-
return _this.runHooks('
|
570
|
-
}).addLocalHook('
|
602
|
+
return _this.runHooks('afterSelectAll', ...args);
|
603
|
+
}).addLocalHook('beforeModifyTransformStart', function () {
|
571
604
|
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
572
605
|
args[_key0] = arguments[_key0];
|
573
606
|
}
|
574
|
-
return _this.runHooks('
|
575
|
-
}).addLocalHook('
|
607
|
+
return _this.runHooks('modifyTransformStart', ...args);
|
608
|
+
}).addLocalHook('afterModifyTransformStart', function () {
|
576
609
|
for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
577
610
|
args[_key1] = arguments[_key1];
|
578
611
|
}
|
579
|
-
return _this.runHooks('
|
580
|
-
}).addLocalHook('
|
612
|
+
return _this.runHooks('afterModifyTransformStart', ...args);
|
613
|
+
}).addLocalHook('beforeModifyTransformFocus', function () {
|
581
614
|
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
582
615
|
args[_key10] = arguments[_key10];
|
583
616
|
}
|
584
|
-
return _this.runHooks('
|
585
|
-
}).addLocalHook('
|
617
|
+
return _this.runHooks('modifyTransformFocus', ...args);
|
618
|
+
}).addLocalHook('afterModifyTransformFocus', function () {
|
586
619
|
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
587
620
|
args[_key11] = arguments[_key11];
|
588
621
|
}
|
589
|
-
return _this.runHooks('
|
590
|
-
}).addLocalHook('
|
622
|
+
return _this.runHooks('afterModifyTransformFocus', ...args);
|
623
|
+
}).addLocalHook('beforeModifyTransformEnd', function () {
|
591
624
|
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
592
625
|
args[_key12] = arguments[_key12];
|
593
626
|
}
|
594
|
-
return _this.runHooks('
|
595
|
-
}).addLocalHook('
|
627
|
+
return _this.runHooks('modifyTransformEnd', ...args);
|
628
|
+
}).addLocalHook('afterModifyTransformEnd', function () {
|
596
629
|
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
597
630
|
args[_key13] = arguments[_key13];
|
598
631
|
}
|
632
|
+
return _this.runHooks('afterModifyTransformEnd', ...args);
|
633
|
+
}).addLocalHook('beforeRowWrap', function () {
|
634
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
635
|
+
args[_key14] = arguments[_key14];
|
636
|
+
}
|
637
|
+
return _this.runHooks('beforeRowWrap', ...args);
|
638
|
+
}).addLocalHook('beforeColumnWrap', function () {
|
639
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
640
|
+
args[_key15] = arguments[_key15];
|
641
|
+
}
|
599
642
|
return _this.runHooks('beforeColumnWrap', ...args);
|
600
643
|
}).addLocalHook('insertRowRequire', totalRows => this.alter('insert_row_above', totalRows, 1, 'auto')).addLocalHook('insertColRequire', totalCols => this.alter('insert_col_start', totalCols, 1, 'auto'));
|
601
644
|
grid = {
|
@@ -723,7 +766,7 @@ export default function Core(rootContainer, userSettings) {
|
|
723
766
|
if (selection.isSelected()) {
|
724
767
|
const {
|
725
768
|
row
|
726
|
-
} = instance.
|
769
|
+
} = instance.getSelectedRangeActive().highlight;
|
727
770
|
if (row >= groupIndex && row <= groupIndex + groupAmount - 1) {
|
728
771
|
editorManager.closeEditor(true);
|
729
772
|
}
|
@@ -782,7 +825,7 @@ export default function Core(rootContainer, userSettings) {
|
|
782
825
|
if (selection.isSelected()) {
|
783
826
|
const {
|
784
827
|
col
|
785
|
-
} = instance.
|
828
|
+
} = instance.getSelectedRangeActive().highlight;
|
786
829
|
if (col >= groupIndex && col <= groupIndex + groupAmount - 1) {
|
787
830
|
editorManager.closeEditor(true);
|
788
831
|
}
|
@@ -823,8 +866,8 @@ export default function Core(rootContainer, userSettings) {
|
|
823
866
|
if (!keepEmptyRows) {
|
824
867
|
grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh
|
825
868
|
}
|
826
|
-
instance.view.render();
|
827
869
|
instance.view.adjustElementsSize();
|
870
|
+
instance.view.render();
|
828
871
|
},
|
829
872
|
/**
|
830
873
|
* Makes sure there are empty rows at the bottom of the table.
|
@@ -1033,6 +1076,7 @@ export default function Core(rootContainer, userSettings) {
|
|
1033
1076
|
}
|
1034
1077
|
skippedColumn = 0;
|
1035
1078
|
for (c = 0; c < clen; c++) {
|
1079
|
+
var _instance$getSourceDa;
|
1036
1080
|
if (end && current.col > end.col && colSelectionLength > colInputLength || !tableMeta.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= tableMeta.maxCols) {
|
1037
1081
|
break;
|
1038
1082
|
}
|
@@ -1049,8 +1093,9 @@ export default function Core(rootContainer, userSettings) {
|
|
1049
1093
|
continue;
|
1050
1094
|
}
|
1051
1095
|
const visualColumn = c - skippedColumn;
|
1096
|
+
const hasValueSetter = !!cellMeta.valueSetter;
|
1052
1097
|
let value = getInputValue(visualRow, visualColumn);
|
1053
|
-
let orgValue = instance.
|
1098
|
+
let orgValue = (_instance$getSourceDa = instance.getSourceDataAtCell(current.row, current.col)) !== null && _instance$getSourceDa !== void 0 ? _instance$getSourceDa : null;
|
1054
1099
|
if (value !== null && typeof value === 'object') {
|
1055
1100
|
// when 'value' is array and 'orgValue' is null, set 'orgValue' to
|
1056
1101
|
// an empty array so that the null value can be compared to 'value'
|
@@ -1058,20 +1103,23 @@ export default function Core(rootContainer, userSettings) {
|
|
1058
1103
|
if (Array.isArray(value) && orgValue === null) {
|
1059
1104
|
orgValue = [];
|
1060
1105
|
}
|
1061
|
-
if (
|
1106
|
+
if (!hasValueSetter && (typeof orgValue !== 'object' || orgValue === null)) {
|
1062
1107
|
pushData = false;
|
1063
|
-
} else {
|
1108
|
+
} else if (orgValue !== null) {
|
1064
1109
|
const orgValueSchema = duckSchema(Array.isArray(orgValue) ? orgValue : orgValue[0] || orgValue);
|
1065
1110
|
const valueSchema = duckSchema(Array.isArray(value) ? value : value[0] || value);
|
1066
1111
|
|
1067
1112
|
// Allow overwriting values with the same object-based schema or any array-based schema.
|
1068
|
-
if (
|
1113
|
+
if (hasValueSetter ||
|
1114
|
+
// If the cell has a value setter, we don't know the value schema (it's dynamic)
|
1115
|
+
|
1116
|
+
isObjectEqual(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
|
1069
1117
|
value = deepClone(value);
|
1070
1118
|
} else {
|
1071
1119
|
pushData = false;
|
1072
1120
|
}
|
1073
1121
|
}
|
1074
|
-
} else if (orgValue !== null && typeof orgValue === 'object') {
|
1122
|
+
} else if (!hasValueSetter && orgValue !== null && typeof orgValue === 'object') {
|
1075
1123
|
pushData = false;
|
1076
1124
|
}
|
1077
1125
|
if (pushData) {
|
@@ -1143,17 +1191,15 @@ export default function Core(rootContainer, userSettings) {
|
|
1143
1191
|
if (isMobileBrowser() || isIpadOS()) {
|
1144
1192
|
addClass(instance.rootElement, 'mobile');
|
1145
1193
|
}
|
1146
|
-
this.updateSettings(
|
1194
|
+
this.updateSettings(mergedUserSettings, true);
|
1147
1195
|
this.view = new TableView(this);
|
1148
|
-
const themeName = tableMeta.themeName || getThemeClassName(instance.rootContainer);
|
1149
|
-
|
1150
|
-
// Use the theme defined in the settings object or set as a root container class name (in that order).
|
1151
|
-
instance.useTheme(themeName);
|
1152
1196
|
editorManager = EditorManager.getInstance(instance, tableMeta, selection);
|
1153
1197
|
viewportScroller = createViewportScroller(instance);
|
1154
1198
|
focusManager = new FocusManager(instance);
|
1155
1199
|
if (isRootInstance(this)) {
|
1156
1200
|
installFocusCatcher(instance);
|
1201
|
+
installAccessibilityAnnouncer(instance.rootPortalElement);
|
1202
|
+
_injectProductInfo(mergedUserSettings.licenseKey, this.rootWrapperElement);
|
1157
1203
|
}
|
1158
1204
|
instance.runHooks('init');
|
1159
1205
|
this.render();
|
@@ -1163,8 +1209,8 @@ export default function Core(rootContainer, userSettings) {
|
|
1163
1209
|
observeVisibilityChangeOnce(instance.rootElement, () => {
|
1164
1210
|
// Update the spreader size cache before rendering.
|
1165
1211
|
instance.view._wt.wtOverlays.updateLastSpreaderSize();
|
1166
|
-
instance.render();
|
1167
1212
|
instance.view.adjustElementsSize();
|
1213
|
+
instance.render();
|
1168
1214
|
});
|
1169
1215
|
}
|
1170
1216
|
if (typeof firstRun === 'object') {
|
@@ -1202,23 +1248,6 @@ export default function Core(rootContainer, userSettings) {
|
|
1202
1248
|
};
|
1203
1249
|
}
|
1204
1250
|
|
1205
|
-
/**
|
1206
|
-
* Get parsed number from numeric string.
|
1207
|
-
*
|
1208
|
-
* @private
|
1209
|
-
* @param {string} numericData Float (separated by a dot or a comma) or integer.
|
1210
|
-
* @returns {number} Number if we get data in parsable format, not changed value otherwise.
|
1211
|
-
*/
|
1212
|
-
function getParsedNumber(numericData) {
|
1213
|
-
// Unifying "float like" string. Change from value with comma determiner to value with dot determiner,
|
1214
|
-
// for example from `450,65` to `450.65`.
|
1215
|
-
const unifiedNumericData = numericData.replace(',', '.');
|
1216
|
-
if (isNaN(parseFloat(unifiedNumericData)) === false) {
|
1217
|
-
return parseFloat(unifiedNumericData);
|
1218
|
-
}
|
1219
|
-
return numericData;
|
1220
|
-
}
|
1221
|
-
|
1222
1251
|
/**
|
1223
1252
|
* @ignore
|
1224
1253
|
* @param {Array} changes The 2D array containing information about each of the edited cells.
|
@@ -1240,7 +1269,7 @@ export default function Core(rootContainer, userSettings) {
|
|
1240
1269
|
callback(); // called when async validators are resolved and beforeChange was not async
|
1241
1270
|
};
|
1242
1271
|
for (let i = changes.length - 1; i >= 0; i--) {
|
1243
|
-
const [row, prop] = changes[i];
|
1272
|
+
const [row, prop,, newValue] = changes[i];
|
1244
1273
|
const visualCol = datamap.propToCol(prop);
|
1245
1274
|
let cellProperties;
|
1246
1275
|
if (Number.isInteger(visualCol)) {
|
@@ -1253,19 +1282,20 @@ export default function Core(rootContainer, userSettings) {
|
|
1253
1282
|
...tableMeta
|
1254
1283
|
};
|
1255
1284
|
}
|
1256
|
-
|
1257
|
-
/* eslint-disable no-loop-func */
|
1258
1285
|
if (instance.getCellValidator(cellProperties)) {
|
1286
|
+
/* eslint-disable no-loop-func */
|
1259
1287
|
waitingForValidator.addValidatorToQueue();
|
1260
|
-
instance.validateCell(
|
1288
|
+
instance.validateCell(newValue, cellProperties, function (index, cellPropertiesReference) {
|
1261
1289
|
return function (result) {
|
1262
1290
|
if (typeof result !== 'boolean') {
|
1263
1291
|
throw new Error('Validation error: result is not boolean');
|
1264
1292
|
}
|
1265
1293
|
if (result === false && cellPropertiesReference.allowInvalid === false) {
|
1266
1294
|
shouldBeCanceled = false;
|
1267
|
-
|
1268
|
-
|
1295
|
+
// cancel the change
|
1296
|
+
changes.splice(index, 1);
|
1297
|
+
// we cancelled the change, so cell value is still valid
|
1298
|
+
cellPropertiesReference.valid = true;
|
1269
1299
|
}
|
1270
1300
|
waitingForValidator.removeValidatorFormQueue();
|
1271
1301
|
};
|
@@ -1333,9 +1363,9 @@ export default function Core(rootContainer, userSettings) {
|
|
1333
1363
|
grid.adjustRowsAndCols();
|
1334
1364
|
instance.runHooks('beforeChangeRender', changes, source);
|
1335
1365
|
editorManager.closeEditor();
|
1366
|
+
instance.view.adjustElementsSize();
|
1336
1367
|
instance.render();
|
1337
1368
|
editorManager.prepareEditor();
|
1338
|
-
instance.view.adjustElementsSize();
|
1339
1369
|
instance.runHooks('afterChange', changes, source || 'edit');
|
1340
1370
|
const activeEditor = instance.getActiveEditor();
|
1341
1371
|
if (activeEditor && isDefined(activeEditor.refreshValue)) {
|
@@ -1424,7 +1454,7 @@ export default function Core(rootContainer, userSettings) {
|
|
1424
1454
|
// eslint-disable-next-line no-param-reassign
|
1425
1455
|
value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source);
|
1426
1456
|
|
1427
|
-
// To provide consistent
|
1457
|
+
// To provide consistent behavior, validation should be always asynchronous
|
1428
1458
|
instance._registerImmediate(() => {
|
1429
1459
|
validator.call(cellProperties, value, valid => {
|
1430
1460
|
if (!instance) {
|
@@ -1492,22 +1522,7 @@ export default function Core(rootContainer, userSettings) {
|
|
1492
1522
|
...tableMeta
|
1493
1523
|
};
|
1494
1524
|
}
|
1495
|
-
|
1496
|
-
type,
|
1497
|
-
checkedTemplate,
|
1498
|
-
uncheckedTemplate
|
1499
|
-
} = cellProperties;
|
1500
|
-
if (type === 'numeric' && typeof newValue === 'string' && isNumericLike(newValue)) {
|
1501
|
-
filteredChanges[i][3] = getParsedNumber(newValue);
|
1502
|
-
}
|
1503
|
-
if (type === 'checkbox') {
|
1504
|
-
const stringifiedValue = stringify(newValue);
|
1505
|
-
const isChecked = stringifiedValue === stringify(checkedTemplate);
|
1506
|
-
const isUnchecked = stringifiedValue === stringify(uncheckedTemplate);
|
1507
|
-
if (isChecked || isUnchecked) {
|
1508
|
-
filteredChanges[i][3] = isChecked ? checkedTemplate : uncheckedTemplate;
|
1509
|
-
}
|
1510
|
-
}
|
1525
|
+
filteredChanges[i][3] = getValueSetterValue(newValue, cellProperties);
|
1511
1526
|
}
|
1512
1527
|
return filteredChanges;
|
1513
1528
|
}
|
@@ -1532,18 +1547,19 @@ export default function Core(rootContainer, userSettings) {
|
|
1532
1547
|
let ilen;
|
1533
1548
|
let prop;
|
1534
1549
|
for (i = 0, ilen = input.length; i < ilen; i++) {
|
1550
|
+
const [visualRow, visualColumn, newValue] = input[i];
|
1535
1551
|
if (typeof input[i] !== 'object') {
|
1536
1552
|
throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
|
1537
1553
|
}
|
1538
|
-
if (typeof
|
1554
|
+
if (typeof visualColumn !== 'number') {
|
1539
1555
|
throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); // eslint-disable-line max-len
|
1540
1556
|
}
|
1541
|
-
if (
|
1542
|
-
prop =
|
1557
|
+
if (visualColumn >= this.countCols()) {
|
1558
|
+
prop = visualColumn;
|
1543
1559
|
} else {
|
1544
|
-
prop = datamap.colToProp(
|
1560
|
+
prop = datamap.colToProp(visualColumn);
|
1545
1561
|
}
|
1546
|
-
changes.push([
|
1562
|
+
changes.push([visualRow, prop, dataSource.getAtCell(this.toPhysicalRow(visualRow), visualColumn), newValue]);
|
1547
1563
|
}
|
1548
1564
|
if (!changeSource && typeof row === 'object') {
|
1549
1565
|
changeSource = column;
|
@@ -1574,7 +1590,8 @@ export default function Core(rootContainer, userSettings) {
|
|
1574
1590
|
let i;
|
1575
1591
|
let ilen;
|
1576
1592
|
for (i = 0, ilen = input.length; i < ilen; i++) {
|
1577
|
-
|
1593
|
+
const [visualRow, inputProp, newValue] = input[i];
|
1594
|
+
changes.push([visualRow, inputProp, dataSource.getAtCell(this.toPhysicalRow(visualRow), inputProp), newValue]);
|
1578
1595
|
}
|
1579
1596
|
|
1580
1597
|
// TODO: I don't think `prop` should be used as `changeSource` here, but removing it would be a breaking change.
|
@@ -1691,8 +1708,8 @@ export default function Core(rootContainer, userSettings) {
|
|
1691
1708
|
* @returns {Array} Returns removed portion of columns.
|
1692
1709
|
*/
|
1693
1710
|
this.spliceCol = function (column, index, amount) {
|
1694
|
-
for (var
|
1695
|
-
elements[
|
1711
|
+
for (var _len16 = arguments.length, elements = new Array(_len16 > 3 ? _len16 - 3 : 0), _key16 = 3; _key16 < _len16; _key16++) {
|
1712
|
+
elements[_key16 - 3] = arguments[_key16];
|
1696
1713
|
}
|
1697
1714
|
return datamap.spliceCol(column, index, amount, ...elements);
|
1698
1715
|
};
|
@@ -1709,8 +1726,8 @@ export default function Core(rootContainer, userSettings) {
|
|
1709
1726
|
* @returns {Array} Returns removed portion of rows.
|
1710
1727
|
*/
|
1711
1728
|
this.spliceRow = function (row, index, amount) {
|
1712
|
-
for (var
|
1713
|
-
elements[
|
1729
|
+
for (var _len17 = arguments.length, elements = new Array(_len17 > 3 ? _len17 - 3 : 0), _key17 = 3; _key17 < _len17; _key17++) {
|
1730
|
+
elements[_key17 - 3] = arguments[_key17];
|
1714
1731
|
}
|
1715
1732
|
return datamap.spliceRow(row, index, amount, ...elements);
|
1716
1733
|
};
|
@@ -1758,16 +1775,37 @@ export default function Core(rootContainer, userSettings) {
|
|
1758
1775
|
return result;
|
1759
1776
|
};
|
1760
1777
|
|
1778
|
+
/**
|
1779
|
+
* Returns the range coordinates of the active selection layer as an array. Active selection layer is the layer that
|
1780
|
+
* has visible focus highlight.
|
1781
|
+
*
|
1782
|
+
* @memberof Core#
|
1783
|
+
* @function getSelectedRangeActive
|
1784
|
+
* @since 16.1.0
|
1785
|
+
* @returns {number[]|undefined} Selected range as an array of coordinates or `undefined` if there is no selection.
|
1786
|
+
*/
|
1787
|
+
this.getSelectedActive = function () {
|
1788
|
+
const activeRange = this.getSelectedRangeActive();
|
1789
|
+
if (!activeRange) {
|
1790
|
+
return;
|
1791
|
+
}
|
1792
|
+
const {
|
1793
|
+
from,
|
1794
|
+
to
|
1795
|
+
} = activeRange;
|
1796
|
+
return [from.row, from.col, to.row, to.col];
|
1797
|
+
};
|
1798
|
+
|
1761
1799
|
/**
|
1762
1800
|
* Returns the current selection as an array of CellRange objects.
|
1763
1801
|
*
|
1764
1802
|
* The version 0.36.0 adds a non-consecutive selection feature. Since this version, the method returns an array of arrays.
|
1765
|
-
* Additionally to collect the coordinates of the
|
1766
|
-
* you need to use `
|
1803
|
+
* Additionally to collect the coordinates of the active selected area (as it was previously done by the method)
|
1804
|
+
* you need to use `getSelectedRangeActive()` method.
|
1767
1805
|
*
|
1768
1806
|
* @memberof Core#
|
1769
1807
|
* @function getSelectedRange
|
1770
|
-
* @returns {CellRange[]|undefined} Selected range object or undefined if there is no selection.
|
1808
|
+
* @returns {CellRange[]|undefined} Selected range object or `undefined` if there is no selection.
|
1771
1809
|
*/
|
1772
1810
|
this.getSelectedRange = function () {
|
1773
1811
|
// https://github.com/handsontable/handsontable/issues/44 //cjl
|
@@ -1782,7 +1820,7 @@ export default function Core(rootContainer, userSettings) {
|
|
1782
1820
|
* @memberof Core#
|
1783
1821
|
* @function getSelectedRangeLast
|
1784
1822
|
* @since 0.36.0
|
1785
|
-
* @returns {CellRange|undefined} Selected range object or undefined` if there is no selection.
|
1823
|
+
* @returns {CellRange|undefined} Selected range object or `undefined` if there is no selection.
|
1786
1824
|
*/
|
1787
1825
|
this.getSelectedRangeLast = function () {
|
1788
1826
|
const selectedRange = this.getSelectedRange();
|
@@ -1793,6 +1831,32 @@ export default function Core(rootContainer, userSettings) {
|
|
1793
1831
|
return result;
|
1794
1832
|
};
|
1795
1833
|
|
1834
|
+
/**
|
1835
|
+
* Returns the range coordinates of the active selection layer. Active selection layer is the layer that
|
1836
|
+
* has visible focus highlight.
|
1837
|
+
*
|
1838
|
+
* @memberof Core#
|
1839
|
+
* @function getSelectedRangeActive
|
1840
|
+
* @since 16.1.0
|
1841
|
+
* @returns {CellRange|undefined} Selected range object or `undefined` if there is no selection.
|
1842
|
+
*/
|
1843
|
+
this.getSelectedRangeActive = function () {
|
1844
|
+
return selection.getActiveSelectedRange();
|
1845
|
+
};
|
1846
|
+
|
1847
|
+
/**
|
1848
|
+
* Returns the index of the active selection layer. Active selection layer is the layer that
|
1849
|
+
* has visible focus highlight.
|
1850
|
+
*
|
1851
|
+
* @memberof Core#
|
1852
|
+
* @function getActiveSelectionLayerIndex
|
1853
|
+
* @since 16.1.0
|
1854
|
+
* @returns {number} The index of the active selection layer. `0` to `N` where `0` is the last (oldest) layer and `N` is the first (newest) layer.
|
1855
|
+
*/
|
1856
|
+
this.getActiveSelectionLayerIndex = function () {
|
1857
|
+
return selection.getActiveSelectionLayerIndex();
|
1858
|
+
};
|
1859
|
+
|
1796
1860
|
/**
|
1797
1861
|
* Erases content from cells that have been selected in the table.
|
1798
1862
|
*
|
@@ -2154,8 +2218,8 @@ export default function Core(rootContainer, userSettings) {
|
|
2154
2218
|
}
|
2155
2219
|
if (isSizeChanged || view._wt.wtOverlays.scrollableElement === instance.rootWindow) {
|
2156
2220
|
view.setLastSize(width, height);
|
2157
|
-
instance.render();
|
2158
2221
|
view.adjustElementsSize();
|
2222
|
+
instance.render();
|
2159
2223
|
}
|
2160
2224
|
instance.runHooks('afterRefreshDimensions', {
|
2161
2225
|
width: lastWidth,
|
@@ -2364,6 +2428,20 @@ export default function Core(rootContainer, userSettings) {
|
|
2364
2428
|
return datamap.getCopyable(row, datamap.colToProp(column));
|
2365
2429
|
};
|
2366
2430
|
|
2431
|
+
/**
|
2432
|
+
* Returns the source data's copyable value at specified `row` and `column` index.
|
2433
|
+
*
|
2434
|
+
* @memberof Core#
|
2435
|
+
* @function getCopyableSourceData
|
2436
|
+
* @param {number} row Visual row index.
|
2437
|
+
* @param {number} column Visual column index.
|
2438
|
+
* @since 16.1.0
|
2439
|
+
* @returns {string}
|
2440
|
+
*/
|
2441
|
+
this.getCopyableSourceData = function (row, column) {
|
2442
|
+
return dataSource.getCopyable(row, datamap.colToProp(column));
|
2443
|
+
};
|
2444
|
+
|
2367
2445
|
/**
|
2368
2446
|
* Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
|
2369
2447
|
* structure in the first row.
|
@@ -2419,9 +2497,6 @@ export default function Core(rootContainer, userSettings) {
|
|
2419
2497
|
if (isDefined(settings.ganttChart)) {
|
2420
2498
|
throw new Error('Since 8.0.0 the "ganttChart" setting is no longer supported.');
|
2421
2499
|
}
|
2422
|
-
if (settings.language) {
|
2423
|
-
setLanguage(settings.language);
|
2424
|
-
}
|
2425
2500
|
|
2426
2501
|
// eslint-disable-next-line no-restricted-syntax
|
2427
2502
|
for (i in settings) {
|
@@ -2446,6 +2521,20 @@ export default function Core(rootContainer, userSettings) {
|
|
2446
2521
|
globalMeta[i] = settings[i];
|
2447
2522
|
}
|
2448
2523
|
}
|
2524
|
+
if (init) {
|
2525
|
+
// Use the theme defined in the settings object or set as a root container class name (in that order).
|
2526
|
+
instance.useTheme(tableMeta.themeName || getThemeClassName(instance.rootContainer));
|
2527
|
+
} else {
|
2528
|
+
const currentThemeName = instance.getCurrentThemeName();
|
2529
|
+
const themeNameOptionExists = hasOwnProperty(settings, 'themeName');
|
2530
|
+
if (themeNameOptionExists && currentThemeName !== settings.themeName) {
|
2531
|
+
instance.useTheme(settings.themeName);
|
2532
|
+
}
|
2533
|
+
}
|
2534
|
+
if (instance.stylesHandler.isClassicTheme()) {
|
2535
|
+
// eslint-disable-next-line max-len
|
2536
|
+
deprecatedWarn('Handsontable classic theme is a legacy theme and will be removed in version 17.0. Please update your theme settings to ensure compatibility with future versions.');
|
2537
|
+
}
|
2449
2538
|
|
2450
2539
|
// Load data or create data map
|
2451
2540
|
if (settings.data === undefined && tableMeta.data === undefined) {
|
@@ -2458,6 +2547,9 @@ export default function Core(rootContainer, userSettings) {
|
|
2458
2547
|
// The `column` property has changed - dataset may be expanded or narrowed down. The `loadData` do the same.
|
2459
2548
|
instance.initIndexMappers();
|
2460
2549
|
}
|
2550
|
+
if (!firstRun && settings.language) {
|
2551
|
+
setLanguage(settings.language);
|
2552
|
+
}
|
2461
2553
|
const clen = instance.countCols();
|
2462
2554
|
const columnSetting = tableMeta.columns;
|
2463
2555
|
|
@@ -2492,44 +2584,43 @@ export default function Core(rootContainer, userSettings) {
|
|
2492
2584
|
if (currentHeight !== '') {
|
2493
2585
|
currentHeight = parseInt(instance.rootElement.style.height, 10);
|
2494
2586
|
}
|
2495
|
-
let height = settings.height;
|
2496
|
-
if (isFunction(height)) {
|
2497
|
-
height = height();
|
2498
|
-
}
|
2499
2587
|
if (init) {
|
2500
2588
|
const initialStyle = instance.rootElement.getAttribute('style');
|
2501
2589
|
if (initialStyle) {
|
2502
2590
|
instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style'));
|
2503
2591
|
}
|
2504
2592
|
}
|
2505
|
-
|
2506
|
-
|
2507
|
-
if (
|
2508
|
-
|
2509
|
-
}
|
2510
|
-
|
2511
|
-
|
2593
|
+
let height = settings.height;
|
2594
|
+
if (typeof settings.height !== 'undefined') {
|
2595
|
+
if (isFunction(height)) {
|
2596
|
+
height = height();
|
2597
|
+
}
|
2598
|
+
height = instance.runHooks('beforeHeightChange', height);
|
2599
|
+
if (height === null) {
|
2600
|
+
const initialStyle = instance.rootElement.getAttribute('data-initialstyle');
|
2601
|
+
if (initialStyle && (initialStyle.indexOf('height') > -1 || initialStyle.indexOf('overflow') > -1)) {
|
2602
|
+
instance.rootElement.setAttribute('style', initialStyle);
|
2603
|
+
} else {
|
2604
|
+
instance.rootElement.style.height = '';
|
2605
|
+
instance.rootElement.style.overflow = '';
|
2606
|
+
}
|
2607
|
+
} else if (height !== undefined) {
|
2608
|
+
instance.rootElement.style.height = isNaN(height) ? `${height}` : `${height}px`;
|
2609
|
+
instance.rootElement.style.overflow = 'hidden';
|
2512
2610
|
}
|
2513
|
-
} else if (height !== undefined) {
|
2514
|
-
instance.rootElement.style.height = isNaN(height) ? `${height}` : `${height}px`;
|
2515
|
-
instance.rootElement.style.overflow = 'hidden';
|
2516
2611
|
}
|
2517
2612
|
if (typeof settings.width !== 'undefined') {
|
2518
2613
|
let width = settings.width;
|
2519
2614
|
if (isFunction(width)) {
|
2520
2615
|
width = width();
|
2521
2616
|
}
|
2617
|
+
width = instance.runHooks('beforeWidthChange', width);
|
2522
2618
|
instance.rootElement.style.width = isNaN(width) ? `${width}` : `${width}px`;
|
2523
2619
|
}
|
2524
2620
|
if (!init) {
|
2525
2621
|
if (instance.view) {
|
2526
2622
|
instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
|
2527
2623
|
instance.view._wt.exportSettingsAsClassNames();
|
2528
|
-
const currentThemeName = instance.getCurrentThemeName();
|
2529
|
-
const themeNameOptionExists = hasOwnProperty(settings, 'themeName');
|
2530
|
-
if (themeNameOptionExists && currentThemeName !== settings.themeName) {
|
2531
|
-
instance.useTheme(settings.themeName);
|
2532
|
-
}
|
2533
2624
|
}
|
2534
2625
|
instance.runHooks('afterUpdateSettings', settings);
|
2535
2626
|
}
|
@@ -2553,16 +2644,17 @@ export default function Core(rootContainer, userSettings) {
|
|
2553
2644
|
* @returns {*} The value of the focused cell.
|
2554
2645
|
*/
|
2555
2646
|
this.getValue = function () {
|
2556
|
-
const
|
2647
|
+
const activeSelection = instance.getSelectedRangeActive();
|
2557
2648
|
if (tableMeta.getValue) {
|
2558
2649
|
if (isFunction(tableMeta.getValue)) {
|
2559
2650
|
return tableMeta.getValue.call(instance);
|
2560
|
-
} else if (
|
2561
|
-
return instance.getData()[
|
2651
|
+
} else if (activeSelection) {
|
2652
|
+
return instance.getData()[activeSelection.highlight.row][tableMeta.getValue];
|
2562
2653
|
}
|
2563
|
-
} else if (
|
2564
|
-
return instance.getDataAtCell(
|
2654
|
+
} else if (activeSelection) {
|
2655
|
+
return instance.getDataAtCell(activeSelection.highlight.row, activeSelection.highlight.col);
|
2565
2656
|
}
|
2657
|
+
return null;
|
2566
2658
|
};
|
2567
2659
|
|
2568
2660
|
/**
|
@@ -2963,17 +3055,32 @@ export default function Core(rootContainer, userSettings) {
|
|
2963
3055
|
const input = setDataInputToArray(row, column, value);
|
2964
3056
|
const isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
|
2965
3057
|
const changesForHook = [];
|
3058
|
+
const getCellProperties = (changeRow, changeProp) => {
|
3059
|
+
const visualRow = this.toVisualRow(changeRow);
|
3060
|
+
const visualColumn = this.toVisualColumn(changeProp);
|
3061
|
+
if (Number.isInteger(visualColumn)) {
|
3062
|
+
return this.getCellMeta(visualRow, visualColumn);
|
3063
|
+
}
|
3064
|
+
|
3065
|
+
// If there's no requested visual column, we can use the table meta as the cell properties
|
3066
|
+
return {
|
3067
|
+
...Object.getPrototypeOf(tableMeta),
|
3068
|
+
...tableMeta
|
3069
|
+
};
|
3070
|
+
};
|
2966
3071
|
if (isThereAnySetSourceListener) {
|
2967
3072
|
arrayEach(input, _ref9 => {
|
2968
3073
|
let [changeRow, changeProp, changeValue] = _ref9;
|
3074
|
+
const newValue = getValueSetterValue(changeValue, getCellProperties(changeRow, changeProp));
|
2969
3075
|
changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp),
|
2970
3076
|
// The previous value.
|
2971
|
-
|
3077
|
+
newValue]);
|
2972
3078
|
});
|
2973
3079
|
}
|
2974
3080
|
arrayEach(input, _ref0 => {
|
2975
3081
|
let [changeRow, changeProp, changeValue] = _ref0;
|
2976
|
-
|
3082
|
+
const newValue = getValueSetterValue(changeValue, getCellProperties(changeRow, changeProp));
|
3083
|
+
dataSource.setAtCell(changeRow, changeProp, newValue);
|
2977
3084
|
});
|
2978
3085
|
if (isThereAnySetSourceListener) {
|
2979
3086
|
this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
|
@@ -3110,8 +3217,8 @@ export default function Core(rootContainer, userSettings) {
|
|
3110
3217
|
*/
|
3111
3218
|
this.spliceCellsMeta = function (visualIndex) {
|
3112
3219
|
let deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
3113
|
-
for (var
|
3114
|
-
cellMetaRows[
|
3220
|
+
for (var _len18 = arguments.length, cellMetaRows = new Array(_len18 > 2 ? _len18 - 2 : 0), _key18 = 2; _key18 < _len18; _key18++) {
|
3221
|
+
cellMetaRows[_key18 - 2] = arguments[_key18];
|
3115
3222
|
}
|
3116
3223
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
3117
3224
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
@@ -4293,7 +4400,7 @@ export default function Core(rootContainer, userSettings) {
|
|
4293
4400
|
}
|
4294
4401
|
const {
|
4295
4402
|
highlight
|
4296
|
-
} = this.
|
4403
|
+
} = this.getSelectedRangeActive();
|
4297
4404
|
const isScrolled = this.scrollViewportTo(highlight.toObject());
|
4298
4405
|
if (isScrolled) {
|
4299
4406
|
// fast render triggers `afterScroll` hook
|
@@ -4323,6 +4430,9 @@ export default function Core(rootContainer, userSettings) {
|
|
4323
4430
|
dataSource.destroy();
|
4324
4431
|
}
|
4325
4432
|
dataSource = null;
|
4433
|
+
if (isRootInstance(this)) {
|
4434
|
+
uninstallAccessibilityAnnouncer();
|
4435
|
+
}
|
4326
4436
|
this.getShortcutManager().destroy();
|
4327
4437
|
moduleRegisterer.clear();
|
4328
4438
|
metaManager.clearCache();
|
@@ -4748,18 +4858,6 @@ export default function Core(rootContainer, userSettings) {
|
|
4748
4858
|
const isFirstRun = !!firstRun;
|
4749
4859
|
this.stylesHandler.useTheme(themeName);
|
4750
4860
|
const validThemeName = this.stylesHandler.getThemeName();
|
4751
|
-
if (isRootInstance(this)) {
|
4752
|
-
removeClass(this.rootWrapperElement, /ht-theme-.*/g);
|
4753
|
-
removeClass(this.rootPortalElement, /ht-theme-.*/g);
|
4754
|
-
if (validThemeName) {
|
4755
|
-
addClass(this.rootWrapperElement, validThemeName);
|
4756
|
-
addClass(this.rootPortalElement, validThemeName);
|
4757
|
-
if (!getComputedStyle(this.rootWrapperElement).getPropertyValue('--ht-line-height')) {
|
4758
|
-
warn(`The "${validThemeName}" theme is enabled, but its stylesheets are missing or not imported correctly. \
|
4759
|
-
Import the correct CSS files in order to use that theme.`);
|
4760
|
-
}
|
4761
|
-
}
|
4762
|
-
}
|
4763
4861
|
if (!isFirstRun) {
|
4764
4862
|
instance.render();
|
4765
4863
|
instance.scrollViewportTo(0, 0);
|