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
@@ -21,9 +21,11 @@ import { valueAccordingPercent, rangeEach } from "../../helpers/number.mjs";
|
|
21
21
|
import SamplesGenerator from "../../utils/samplesGenerator.mjs";
|
22
22
|
import { isPercentValue } from "../../helpers/string.mjs";
|
23
23
|
import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
|
24
|
+
import { addClass, removeClass } from "../../helpers/dom/element.mjs";
|
24
25
|
export const PLUGIN_KEY = 'autoRowSize';
|
25
26
|
export const PLUGIN_PRIORITY = 40;
|
26
27
|
const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
|
28
|
+
const FIRST_COLUMN_NOT_RENDERED_CLASS_NAME = 'htFirstDatasetColumnNotRendered';
|
27
29
|
|
28
30
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
29
31
|
/**
|
@@ -210,9 +212,8 @@ export class AutoRowSize extends BasePlugin {
|
|
210
212
|
* @type {SamplesGenerator}
|
211
213
|
*/
|
212
214
|
_defineProperty(this, "samplesGenerator", new SamplesGenerator((row, column) => {
|
213
|
-
const physicalRow = this.hot.toPhysicalRow(row);
|
214
215
|
const physicalColumn = this.hot.toPhysicalColumn(column);
|
215
|
-
if (this.hot.
|
216
|
+
if (this.hot.columnIndexMapper.isHidden(physicalColumn)) {
|
216
217
|
return false;
|
217
218
|
}
|
218
219
|
if (row >= 0 && column >= 0) {
|
@@ -313,6 +314,7 @@ export class AutoRowSize extends BasePlugin {
|
|
313
314
|
}
|
314
315
|
return _assertClassBrand(_AutoRowSize_brand, _this, _onAfterFormulasValuesUpdate).call(_this, ...args);
|
315
316
|
});
|
317
|
+
this.addHook('beforeViewRender', () => _assertClassBrand(_AutoRowSize_brand, this, _onBeforeViewRender).call(this));
|
316
318
|
this.addHook('beforeRender', () => _assertClassBrand(_AutoRowSize_brand, this, _onBeforeRender).call(this));
|
317
319
|
this.addHook('modifyRowHeight', (height, row) => this.getRowHeight(row, height));
|
318
320
|
this.addHook('init', () => _assertClassBrand(_AutoRowSize_brand, this, _onInit).call(this));
|
@@ -327,6 +329,9 @@ export class AutoRowSize extends BasePlugin {
|
|
327
329
|
this.headerHeight = null;
|
328
330
|
super.disablePlugin();
|
329
331
|
|
332
|
+
// Remove the "first dataset column not rendered" class name when the plugin is disabled.
|
333
|
+
_assertClassBrand(_AutoRowSize_brand, this, _toggleFirstDatasetColumnRenderedClassName).call(this, false);
|
334
|
+
|
330
335
|
// Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
|
331
336
|
// This is necessary for height recalculation for resize handler doubleclick (ManualRowResize).
|
332
337
|
this.addHook('beforeRowResize', (size, row, isDblClick) => _assertClassBrand(_AutoRowSize_brand, this, _onBeforeRowResize).call(this, size, row, isDblClick));
|
@@ -514,10 +519,19 @@ export class AutoRowSize extends BasePlugin {
|
|
514
519
|
* @param {number} [defaultHeight] If no height is found, `defaultHeight` is returned instead.
|
515
520
|
* @returns {number} The height of the specified row, in pixels.
|
516
521
|
*/
|
517
|
-
getRowHeight(row
|
518
|
-
|
522
|
+
getRowHeight(row) {
|
523
|
+
let defaultHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.hot.stylesHandler.getDefaultRowHeight();
|
524
|
+
if (row < 0) {
|
525
|
+
var _this$headerHeight;
|
526
|
+
return (_this$headerHeight = this.headerHeight) !== null && _this$headerHeight !== void 0 ? _this$headerHeight : defaultHeight;
|
527
|
+
}
|
528
|
+
const physicalRow = this.hot.toPhysicalRow(row);
|
529
|
+
if (this.hot.rowIndexMapper.isHidden(physicalRow)) {
|
530
|
+
return defaultHeight;
|
531
|
+
}
|
532
|
+
const cachedHeight = this.rowHeightsMap.getValueAtIndex(physicalRow);
|
519
533
|
let height = defaultHeight;
|
520
|
-
if (cachedHeight !== null && cachedHeight >
|
534
|
+
if (cachedHeight !== null && cachedHeight > defaultHeight) {
|
521
535
|
height = cachedHeight;
|
522
536
|
}
|
523
537
|
return height;
|
@@ -601,7 +615,10 @@ export class AutoRowSize extends BasePlugin {
|
|
601
615
|
}
|
602
616
|
|
603
617
|
/**
|
604
|
-
*
|
618
|
+
* Toggles the "first dataset column not rendered" class name.
|
619
|
+
* Used to apply special styling when the first column is visible (used only in the classic (legacy) theme, with the AutoRowSize plugin enabled).
|
620
|
+
*
|
621
|
+
* @param {boolean} [forceState] Force the class to be added or removed (`true` to add, `false` to remove).
|
605
622
|
*/
|
606
623
|
|
607
624
|
/**
|
@@ -633,6 +650,26 @@ function _calculateSpecificRowsHeight(visualRows) {
|
|
633
650
|
this.ghostTable.clean();
|
634
651
|
}
|
635
652
|
}
|
653
|
+
function _toggleFirstDatasetColumnRenderedClassName(forceState) {
|
654
|
+
if (this.hot.stylesHandler.isClassicTheme()) {
|
655
|
+
const firstRenderedColumnVisualIndex = this.hot.getFirstRenderedVisibleColumn();
|
656
|
+
const firstRenderedColumnPhysicalIndex = this.hot.columnIndexMapper.getPhysicalFromVisualIndex(firstRenderedColumnVisualIndex);
|
657
|
+
if (forceState === false || firstRenderedColumnPhysicalIndex === this.hot.columnIndexMapper.getPhysicalFromRenderableIndex(0)) {
|
658
|
+
removeClass(this.hot.rootElement, FIRST_COLUMN_NOT_RENDERED_CLASS_NAME);
|
659
|
+
} else {
|
660
|
+
addClass(this.hot.rootElement, FIRST_COLUMN_NOT_RENDERED_CLASS_NAME);
|
661
|
+
}
|
662
|
+
}
|
663
|
+
}
|
664
|
+
/**
|
665
|
+
* `beforeViewRender` hook listener.
|
666
|
+
*/
|
667
|
+
function _onBeforeViewRender() {
|
668
|
+
_assertClassBrand(_AutoRowSize_brand, this, _toggleFirstDatasetColumnRenderedClassName).call(this);
|
669
|
+
}
|
670
|
+
/**
|
671
|
+
* `beforeRender` hook listener.
|
672
|
+
*/
|
636
673
|
function _onBeforeRender() {
|
637
674
|
this.calculateVisibleRowsHeight();
|
638
675
|
if (!this.inProgress) {
|
@@ -3,9 +3,12 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
7
|
+
require("core-js/modules/esnext.iterator.some.js");
|
6
8
|
var _base = require("../base");
|
7
9
|
var _hooks = require("../../core/hooks");
|
8
10
|
var _element = require("../../helpers/dom/element");
|
11
|
+
var _object = require("../../helpers/object");
|
9
12
|
var _array = require("../../helpers/array");
|
10
13
|
var _mixed = require("../../helpers/mixed");
|
11
14
|
var _utils = require("./utils");
|
@@ -43,9 +46,13 @@ class Autofill extends _base.BasePlugin {
|
|
43
46
|
constructor() {
|
44
47
|
super(...arguments);
|
45
48
|
/**
|
46
|
-
*
|
49
|
+
* Extends the fill data with the source data based on the content of the target cells.
|
47
50
|
*
|
48
|
-
* @
|
51
|
+
* @param {Array} fillData The fill data to extend.
|
52
|
+
* @param {Array} selectionSourceData The source data to extend the fill data with.
|
53
|
+
* @param {CellCoords} startOfDragCoords The start of the drag area.
|
54
|
+
* @param {CellCoords} endOfDragCoords The end of the drag area.
|
55
|
+
* @returns {Array} The extended fill data.
|
49
56
|
*/
|
50
57
|
_classPrivateMethodInitSpec(this, _Autofill_brand);
|
51
58
|
/**
|
@@ -149,9 +156,11 @@ class Autofill extends _base.BasePlugin {
|
|
149
156
|
* Gets selection data.
|
150
157
|
*
|
151
158
|
* @private
|
159
|
+
* @param {boolean} [useSource=false] If `true`, returns copyable source data instead of copyable data.
|
152
160
|
* @returns {object[]} Ranges Array of objects with properties `startRow`, `startCol`, `endRow` and `endCol`.
|
153
161
|
*/
|
154
162
|
getSelectionData() {
|
163
|
+
let useSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
155
164
|
const selection = this.hot.getSelectedRangeLast();
|
156
165
|
const {
|
157
166
|
row: startRow,
|
@@ -185,7 +194,12 @@ class Autofill extends _base.BasePlugin {
|
|
185
194
|
(0, _array.arrayEach)(copyableRows, row => {
|
186
195
|
const rowSet = [];
|
187
196
|
(0, _array.arrayEach)(copyableColumns, column => {
|
188
|
-
|
197
|
+
const sourceDataAtSource = useSource ? this.hot.getSourceDataAtCell(row, column) : null;
|
198
|
+
if (useSource && (0, _object.isObject)(sourceDataAtSource)) {
|
199
|
+
rowSet.push(this.hot.getCopyableSourceData(row, column));
|
200
|
+
} else {
|
201
|
+
rowSet.push(this.hot.getCopyableData(row, column));
|
202
|
+
}
|
189
203
|
});
|
190
204
|
data.push(rowSet);
|
191
205
|
});
|
@@ -224,6 +238,7 @@ class Autofill extends _base.BasePlugin {
|
|
224
238
|
} = (0, _utils.getDragDirectionAndRange)(cornersOfSelectedCells, cornersOfSelectionAndDragAreas, (row, column) => this.hot._createCellCoords(row, column));
|
225
239
|
if (startOfDragCoords && startOfDragCoords.row > -1 && startOfDragCoords.col > -1) {
|
226
240
|
const selectionData = this.getSelectionData();
|
241
|
+
const selectionSourceData = this.getSelectionData(true);
|
227
242
|
const sourceRange = selectionRangeLast.clone();
|
228
243
|
const targetRange = this.hot._createCellRange(startOfDragCoords, startOfDragCoords, endOfDragCoords);
|
229
244
|
const beforeAutofillHookResult = this.hot.runHooks('beforeAutofill', selectionData, sourceRange, targetRange, directionOfDrag);
|
@@ -253,6 +268,14 @@ class Autofill extends _base.BasePlugin {
|
|
253
268
|
}
|
254
269
|
}
|
255
270
|
}
|
271
|
+
|
272
|
+
// If the source data contains objects, we need to check every target cell for the data type.
|
273
|
+
if (selectionSourceData.some(row => row.some(cell => (0, _object.isObject)(cell)))) {
|
274
|
+
const fullFillData = _assertClassBrand(_Autofill_brand, this, _extendFillDataWithSourceData).call(this, fillData, selectionSourceData, startOfDragCoords, endOfDragCoords, directionOfDrag);
|
275
|
+
if (fullFillData.length) {
|
276
|
+
fillData = fullFillData;
|
277
|
+
}
|
278
|
+
}
|
256
279
|
this.hot.populateFromArray(startOfDragCoords.row, startOfDragCoords.col, fillData, endOfDragCoords.row, endOfDragCoords.col, `${this.pluginName}.fill`, null);
|
257
280
|
this.setSelection(cornersOfSelectionAndDragAreas);
|
258
281
|
this.hot.runHooks('afterAutofill', fillData, sourceRange, targetRange, directionOfDrag);
|
@@ -496,6 +519,30 @@ class Autofill extends _base.BasePlugin {
|
|
496
519
|
}
|
497
520
|
}
|
498
521
|
exports.Autofill = Autofill;
|
522
|
+
function _extendFillDataWithSourceData(fillData, selectionSourceData, startOfDragCoords, endOfDragCoords) {
|
523
|
+
const fullFillData = [];
|
524
|
+
for (let rowIndex = Math.min(startOfDragCoords.row, endOfDragCoords.row); rowIndex <= Math.max(startOfDragCoords.row, endOfDragCoords.row); rowIndex += 1) {
|
525
|
+
fullFillData.push([]);
|
526
|
+
for (let columnIndex = Math.min(startOfDragCoords.col, endOfDragCoords.col); columnIndex <= Math.max(startOfDragCoords.col, endOfDragCoords.col); columnIndex += 1) {
|
527
|
+
const sourceCell = this.hot.getSourceDataAtCell(rowIndex, columnIndex);
|
528
|
+
const relativeRowIndex = rowIndex - Math.min(startOfDragCoords.row, endOfDragCoords.row);
|
529
|
+
const relativeColumnIndex = columnIndex - Math.min(startOfDragCoords.col, endOfDragCoords.col);
|
530
|
+
const modRelativeRowIndex = relativeRowIndex % selectionSourceData.length;
|
531
|
+
const modRelativeColumnIndex = relativeColumnIndex % selectionSourceData[0].length;
|
532
|
+
if ((0, _object.isObject)(sourceCell)) {
|
533
|
+
fullFillData[relativeRowIndex][relativeColumnIndex] = selectionSourceData[modRelativeRowIndex][modRelativeColumnIndex];
|
534
|
+
} else {
|
535
|
+
fullFillData[relativeRowIndex][relativeColumnIndex] = fillData[modRelativeRowIndex][modRelativeColumnIndex];
|
536
|
+
}
|
537
|
+
}
|
538
|
+
}
|
539
|
+
return fullFillData;
|
540
|
+
}
|
541
|
+
/**
|
542
|
+
* On cell corner double click callback.
|
543
|
+
*
|
544
|
+
* @private
|
545
|
+
*/
|
499
546
|
function _onCellCornerDblClick() {
|
500
547
|
const selectionApplied = this.selectAdjacent();
|
501
548
|
if (selectionApplied) {
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
4
|
+
import "core-js/modules/esnext.iterator.some.js";
|
3
5
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
4
6
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
5
7
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
@@ -9,6 +11,7 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
|
|
9
11
|
import { BasePlugin } from "../base/index.mjs";
|
10
12
|
import { Hooks } from "../../core/hooks/index.mjs";
|
11
13
|
import { offset, outerHeight, outerWidth } from "../../helpers/dom/element.mjs";
|
14
|
+
import { isObject } from "../../helpers/object.mjs";
|
12
15
|
import { arrayEach, arrayMap } from "../../helpers/array.mjs";
|
13
16
|
import { isEmpty } from "../../helpers/mixed.mjs";
|
14
17
|
import { getDragDirectionAndRange, DIRECTIONS, getMappedFillHandleSetting } from "./utils.mjs";
|
@@ -40,9 +43,13 @@ export class Autofill extends BasePlugin {
|
|
40
43
|
constructor() {
|
41
44
|
super(...arguments);
|
42
45
|
/**
|
43
|
-
*
|
46
|
+
* Extends the fill data with the source data based on the content of the target cells.
|
44
47
|
*
|
45
|
-
* @
|
48
|
+
* @param {Array} fillData The fill data to extend.
|
49
|
+
* @param {Array} selectionSourceData The source data to extend the fill data with.
|
50
|
+
* @param {CellCoords} startOfDragCoords The start of the drag area.
|
51
|
+
* @param {CellCoords} endOfDragCoords The end of the drag area.
|
52
|
+
* @returns {Array} The extended fill data.
|
46
53
|
*/
|
47
54
|
_classPrivateMethodInitSpec(this, _Autofill_brand);
|
48
55
|
/**
|
@@ -146,9 +153,11 @@ export class Autofill extends BasePlugin {
|
|
146
153
|
* Gets selection data.
|
147
154
|
*
|
148
155
|
* @private
|
156
|
+
* @param {boolean} [useSource=false] If `true`, returns copyable source data instead of copyable data.
|
149
157
|
* @returns {object[]} Ranges Array of objects with properties `startRow`, `startCol`, `endRow` and `endCol`.
|
150
158
|
*/
|
151
159
|
getSelectionData() {
|
160
|
+
let useSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
152
161
|
const selection = this.hot.getSelectedRangeLast();
|
153
162
|
const {
|
154
163
|
row: startRow,
|
@@ -182,7 +191,12 @@ export class Autofill extends BasePlugin {
|
|
182
191
|
arrayEach(copyableRows, row => {
|
183
192
|
const rowSet = [];
|
184
193
|
arrayEach(copyableColumns, column => {
|
185
|
-
|
194
|
+
const sourceDataAtSource = useSource ? this.hot.getSourceDataAtCell(row, column) : null;
|
195
|
+
if (useSource && isObject(sourceDataAtSource)) {
|
196
|
+
rowSet.push(this.hot.getCopyableSourceData(row, column));
|
197
|
+
} else {
|
198
|
+
rowSet.push(this.hot.getCopyableData(row, column));
|
199
|
+
}
|
186
200
|
});
|
187
201
|
data.push(rowSet);
|
188
202
|
});
|
@@ -221,6 +235,7 @@ export class Autofill extends BasePlugin {
|
|
221
235
|
} = getDragDirectionAndRange(cornersOfSelectedCells, cornersOfSelectionAndDragAreas, (row, column) => this.hot._createCellCoords(row, column));
|
222
236
|
if (startOfDragCoords && startOfDragCoords.row > -1 && startOfDragCoords.col > -1) {
|
223
237
|
const selectionData = this.getSelectionData();
|
238
|
+
const selectionSourceData = this.getSelectionData(true);
|
224
239
|
const sourceRange = selectionRangeLast.clone();
|
225
240
|
const targetRange = this.hot._createCellRange(startOfDragCoords, startOfDragCoords, endOfDragCoords);
|
226
241
|
const beforeAutofillHookResult = this.hot.runHooks('beforeAutofill', selectionData, sourceRange, targetRange, directionOfDrag);
|
@@ -250,6 +265,14 @@ export class Autofill extends BasePlugin {
|
|
250
265
|
}
|
251
266
|
}
|
252
267
|
}
|
268
|
+
|
269
|
+
// If the source data contains objects, we need to check every target cell for the data type.
|
270
|
+
if (selectionSourceData.some(row => row.some(cell => isObject(cell)))) {
|
271
|
+
const fullFillData = _assertClassBrand(_Autofill_brand, this, _extendFillDataWithSourceData).call(this, fillData, selectionSourceData, startOfDragCoords, endOfDragCoords, directionOfDrag);
|
272
|
+
if (fullFillData.length) {
|
273
|
+
fillData = fullFillData;
|
274
|
+
}
|
275
|
+
}
|
253
276
|
this.hot.populateFromArray(startOfDragCoords.row, startOfDragCoords.col, fillData, endOfDragCoords.row, endOfDragCoords.col, `${this.pluginName}.fill`, null);
|
254
277
|
this.setSelection(cornersOfSelectionAndDragAreas);
|
255
278
|
this.hot.runHooks('afterAutofill', fillData, sourceRange, targetRange, directionOfDrag);
|
@@ -492,6 +515,30 @@ export class Autofill extends BasePlugin {
|
|
492
515
|
super.destroy();
|
493
516
|
}
|
494
517
|
}
|
518
|
+
function _extendFillDataWithSourceData(fillData, selectionSourceData, startOfDragCoords, endOfDragCoords) {
|
519
|
+
const fullFillData = [];
|
520
|
+
for (let rowIndex = Math.min(startOfDragCoords.row, endOfDragCoords.row); rowIndex <= Math.max(startOfDragCoords.row, endOfDragCoords.row); rowIndex += 1) {
|
521
|
+
fullFillData.push([]);
|
522
|
+
for (let columnIndex = Math.min(startOfDragCoords.col, endOfDragCoords.col); columnIndex <= Math.max(startOfDragCoords.col, endOfDragCoords.col); columnIndex += 1) {
|
523
|
+
const sourceCell = this.hot.getSourceDataAtCell(rowIndex, columnIndex);
|
524
|
+
const relativeRowIndex = rowIndex - Math.min(startOfDragCoords.row, endOfDragCoords.row);
|
525
|
+
const relativeColumnIndex = columnIndex - Math.min(startOfDragCoords.col, endOfDragCoords.col);
|
526
|
+
const modRelativeRowIndex = relativeRowIndex % selectionSourceData.length;
|
527
|
+
const modRelativeColumnIndex = relativeColumnIndex % selectionSourceData[0].length;
|
528
|
+
if (isObject(sourceCell)) {
|
529
|
+
fullFillData[relativeRowIndex][relativeColumnIndex] = selectionSourceData[modRelativeRowIndex][modRelativeColumnIndex];
|
530
|
+
} else {
|
531
|
+
fullFillData[relativeRowIndex][relativeColumnIndex] = fillData[modRelativeRowIndex][modRelativeColumnIndex];
|
532
|
+
}
|
533
|
+
}
|
534
|
+
}
|
535
|
+
return fullFillData;
|
536
|
+
}
|
537
|
+
/**
|
538
|
+
* On cell corner double click callback.
|
539
|
+
*
|
540
|
+
* @private
|
541
|
+
*/
|
495
542
|
function _onCellCornerDblClick() {
|
496
543
|
const selectionApplied = this.selectAdjacent();
|
497
544
|
if (selectionApplied) {
|
package/plugins/base/base.js
CHANGED
@@ -13,13 +13,15 @@ var _registry3 = require("../../editors/registry");
|
|
13
13
|
var _registry4 = require("../../renderers/registry");
|
14
14
|
var _registry5 = require("../../validators/registry");
|
15
15
|
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
16
|
+
var _console = require("../../helpers/console");
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
17
18
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
18
|
-
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
19
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
20
19
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
21
20
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
22
21
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
22
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
23
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
24
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
23
25
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
24
26
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
25
27
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', _registry.hasPlugin], ['cell-type', _registry2.hasCellType], ['editor', _registry3.hasEditor], ['renderer', _registry4.hasRenderer], ['validator', _registry5.hasValidator]]);
|
@@ -32,6 +34,7 @@ let initializedPlugins = null;
|
|
32
34
|
* @util
|
33
35
|
* @property {Core} hot Handsontable instance.
|
34
36
|
*/
|
37
|
+
var _pluginSettings = /*#__PURE__*/new WeakMap();
|
35
38
|
var _hooks = /*#__PURE__*/new WeakMap();
|
36
39
|
var _BasePlugin_brand = /*#__PURE__*/new WeakSet();
|
37
40
|
class BasePlugin {
|
@@ -62,9 +65,18 @@ class BasePlugin {
|
|
62
65
|
}
|
63
66
|
|
64
67
|
/**
|
65
|
-
*
|
68
|
+
* Validators for plugin settings.
|
66
69
|
*
|
67
|
-
* @type {
|
70
|
+
* @type {Function|object|null}
|
71
|
+
*/
|
72
|
+
static get SETTINGS_VALIDATORS() {
|
73
|
+
return null;
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Plugin settings.
|
78
|
+
*
|
79
|
+
* @type {object|null}
|
68
80
|
*/
|
69
81
|
|
70
82
|
/**
|
@@ -81,6 +93,12 @@ class BasePlugin {
|
|
81
93
|
* @returns {boolean}
|
82
94
|
*/
|
83
95
|
_classPrivateMethodInitSpec(this, _BasePlugin_brand);
|
96
|
+
_classPrivateFieldInitSpec(this, _pluginSettings, null);
|
97
|
+
/**
|
98
|
+
* The instance of the {@link EventManager} class.
|
99
|
+
*
|
100
|
+
* @type {EventManager}
|
101
|
+
*/
|
84
102
|
_defineProperty(this, "eventManager", new _eventManager.default(this));
|
85
103
|
/**
|
86
104
|
* @type {string}
|
@@ -121,6 +139,7 @@ class BasePlugin {
|
|
121
139
|
}
|
122
140
|
init() {
|
123
141
|
this.pluginName = this.hot.getPluginName(this);
|
142
|
+
this.updatePluginSettings(this.hot.getSettings()[this.constructor.PLUGIN_KEY]);
|
124
143
|
const pluginDeps = this.constructor.PLUGIN_DEPS;
|
125
144
|
const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
|
126
145
|
if (deps.length > 0) {
|
@@ -188,25 +207,75 @@ class BasePlugin {
|
|
188
207
|
* @returns {*}
|
189
208
|
*/
|
190
209
|
getSetting(settingName) {
|
191
|
-
const
|
210
|
+
const defaultSettings = this.constructor.DEFAULT_SETTINGS;
|
192
211
|
if (settingName === undefined) {
|
193
|
-
|
212
|
+
if ((0, _object.isObject)(_classPrivateFieldGet(_pluginSettings, this))) {
|
213
|
+
return (0, _object.assignObjectDefaults)(_classPrivateFieldGet(_pluginSettings, this), defaultSettings);
|
214
|
+
}
|
215
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
194
216
|
}
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
return pluginSettings;
|
217
|
+
if ((Array.isArray(_classPrivateFieldGet(_pluginSettings, this)) || (0, _object.isObject)(_classPrivateFieldGet(_pluginSettings, this))) && defaultSettings[defaultMainSettingSymbol] === settingName) {
|
218
|
+
var _classPrivateFieldGet2;
|
219
|
+
if (Array.isArray(_classPrivateFieldGet(_pluginSettings, this))) {
|
220
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
200
221
|
}
|
201
|
-
return (
|
222
|
+
return (_classPrivateFieldGet2 = _classPrivateFieldGet(_pluginSettings, this)[settingName]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : defaultSettings[settingName];
|
202
223
|
}
|
203
|
-
if ((
|
204
|
-
|
205
|
-
|
224
|
+
if (settingName.includes('.')) {
|
225
|
+
const pluginValue = (0, _object.getProperty)(_classPrivateFieldGet(_pluginSettings, this), settingName);
|
226
|
+
const defaultValue = (0, _object.getProperty)(defaultSettings, settingName);
|
227
|
+
if ((0, _object.isObject)(pluginValue)) {
|
228
|
+
return (0, _object.assignObjectDefaults)(pluginValue, defaultValue);
|
229
|
+
}
|
230
|
+
return pluginValue !== undefined ? pluginValue : defaultValue;
|
231
|
+
}
|
232
|
+
if ((0, _object.isObject)(_classPrivateFieldGet(_pluginSettings, this))) {
|
233
|
+
return (0, _object.assignObjectDefaults)(_classPrivateFieldGet(_pluginSettings, this), defaultSettings)[settingName];
|
206
234
|
}
|
207
235
|
return defaultSettings[settingName];
|
208
236
|
}
|
209
237
|
|
238
|
+
/**
|
239
|
+
* Update plugin settings.
|
240
|
+
*
|
241
|
+
* @param {*} newSettings New settings.
|
242
|
+
* @returns {object} Updated settings object.
|
243
|
+
*/
|
244
|
+
updatePluginSettings(newSettings) {
|
245
|
+
const settingsValidators = this.constructor.SETTINGS_VALIDATORS;
|
246
|
+
if (settingsValidators && typeof settingsValidators === 'function' && typeof newSettings !== 'object') {
|
247
|
+
const isValid = settingsValidators(newSettings);
|
248
|
+
if (isValid === false) {
|
249
|
+
(0, _console.warn)(`${this.pluginName} Plugin: option is not valid and it will be ignored.`);
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
_classPrivateFieldSet(_pluginSettings, this, newSettings);
|
253
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
254
|
+
}
|
255
|
+
if (settingsValidators && typeof settingsValidators === 'object' && typeof newSettings === 'object') {
|
256
|
+
if (_classPrivateFieldGet(_pluginSettings, this) === null || typeof _classPrivateFieldGet(_pluginSettings, this) !== 'object') {
|
257
|
+
_classPrivateFieldSet(_pluginSettings, this, {
|
258
|
+
...this.constructor.DEFAULT_SETTINGS
|
259
|
+
});
|
260
|
+
}
|
261
|
+
Object.keys(settingsValidators).forEach(key => {
|
262
|
+
if (!(key in newSettings)) {
|
263
|
+
return;
|
264
|
+
}
|
265
|
+
const validator = settingsValidators[key];
|
266
|
+
const isValid = validator ? validator(newSettings[key]) : true;
|
267
|
+
if (isValid === false) {
|
268
|
+
(0, _console.warn)(`${this.pluginName} Plugin: "${key}" option is not valid and it will be ignored.`);
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
_classPrivateFieldGet(_pluginSettings, this)[key] = newSettings[key];
|
272
|
+
});
|
273
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
274
|
+
}
|
275
|
+
_classPrivateFieldSet(_pluginSettings, this, newSettings);
|
276
|
+
return newSettings;
|
277
|
+
}
|
278
|
+
|
210
279
|
/**
|
211
280
|
* Add listener to plugin hooks system.
|
212
281
|
*
|
@@ -284,6 +353,7 @@ class BasePlugin {
|
|
284
353
|
this.enablePlugin();
|
285
354
|
}
|
286
355
|
if (this.enabled && this.isEnabled() && relevantToSettings) {
|
356
|
+
this.updatePluginSettings(newSettings[this.constructor.PLUGIN_KEY]);
|
287
357
|
this.updatePlugin(newSettings);
|
288
358
|
}
|
289
359
|
}
|
@@ -301,6 +371,7 @@ class BasePlugin {
|
|
301
371
|
*/
|
302
372
|
destroy() {
|
303
373
|
var _this$eventManager2;
|
374
|
+
_classPrivateFieldSet(_pluginSettings, this, null);
|
304
375
|
(_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
|
305
376
|
this.clearHooks();
|
306
377
|
(0, _object.objectEach)(this, (value, property) => {
|
package/plugins/base/base.mjs
CHANGED
@@ -3,14 +3,15 @@ import "core-js/modules/es.array.push.js";
|
|
3
3
|
import "core-js/modules/esnext.iterator.constructor.js";
|
4
4
|
import "core-js/modules/esnext.iterator.for-each.js";
|
5
5
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
6
|
-
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
7
|
-
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
8
6
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
9
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
10
8
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
10
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
11
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
11
12
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
12
13
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
13
|
-
import { defineGetter, objectEach, isObject } from "../../helpers/object.mjs";
|
14
|
+
import { defineGetter, objectEach, isObject, assignObjectDefaults, getProperty } from "../../helpers/object.mjs";
|
14
15
|
import { arrayEach } from "../../helpers/array.mjs";
|
15
16
|
import { getPluginsNames, hasPlugin } from "../registry.mjs";
|
16
17
|
import { hasCellType } from "../../cellTypes/registry.mjs";
|
@@ -18,6 +19,7 @@ import { hasEditor } from "../../editors/registry.mjs";
|
|
18
19
|
import { hasRenderer } from "../../renderers/registry.mjs";
|
19
20
|
import { hasValidator } from "../../validators/registry.mjs";
|
20
21
|
import EventManager from "../../eventManager.mjs";
|
22
|
+
import { warn } from "../../helpers/console.mjs";
|
21
23
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', hasPlugin], ['cell-type', hasCellType], ['editor', hasEditor], ['renderer', hasRenderer], ['validator', hasValidator]]);
|
22
24
|
export const defaultMainSettingSymbol = Symbol('mainSetting');
|
23
25
|
export const PLUGIN_KEY = 'base';
|
@@ -28,6 +30,7 @@ let initializedPlugins = null;
|
|
28
30
|
* @util
|
29
31
|
* @property {Core} hot Handsontable instance.
|
30
32
|
*/
|
33
|
+
var _pluginSettings = /*#__PURE__*/new WeakMap();
|
31
34
|
var _hooks = /*#__PURE__*/new WeakMap();
|
32
35
|
var _BasePlugin_brand = /*#__PURE__*/new WeakSet();
|
33
36
|
export class BasePlugin {
|
@@ -58,9 +61,18 @@ export class BasePlugin {
|
|
58
61
|
}
|
59
62
|
|
60
63
|
/**
|
61
|
-
*
|
64
|
+
* Validators for plugin settings.
|
62
65
|
*
|
63
|
-
* @type {
|
66
|
+
* @type {Function|object|null}
|
67
|
+
*/
|
68
|
+
static get SETTINGS_VALIDATORS() {
|
69
|
+
return null;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Plugin settings.
|
74
|
+
*
|
75
|
+
* @type {object|null}
|
64
76
|
*/
|
65
77
|
|
66
78
|
/**
|
@@ -77,6 +89,12 @@ export class BasePlugin {
|
|
77
89
|
* @returns {boolean}
|
78
90
|
*/
|
79
91
|
_classPrivateMethodInitSpec(this, _BasePlugin_brand);
|
92
|
+
_classPrivateFieldInitSpec(this, _pluginSettings, null);
|
93
|
+
/**
|
94
|
+
* The instance of the {@link EventManager} class.
|
95
|
+
*
|
96
|
+
* @type {EventManager}
|
97
|
+
*/
|
80
98
|
_defineProperty(this, "eventManager", new EventManager(this));
|
81
99
|
/**
|
82
100
|
* @type {string}
|
@@ -117,6 +135,7 @@ export class BasePlugin {
|
|
117
135
|
}
|
118
136
|
init() {
|
119
137
|
this.pluginName = this.hot.getPluginName(this);
|
138
|
+
this.updatePluginSettings(this.hot.getSettings()[this.constructor.PLUGIN_KEY]);
|
120
139
|
const pluginDeps = this.constructor.PLUGIN_DEPS;
|
121
140
|
const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
|
122
141
|
if (deps.length > 0) {
|
@@ -184,25 +203,75 @@ export class BasePlugin {
|
|
184
203
|
* @returns {*}
|
185
204
|
*/
|
186
205
|
getSetting(settingName) {
|
187
|
-
const
|
206
|
+
const defaultSettings = this.constructor.DEFAULT_SETTINGS;
|
188
207
|
if (settingName === undefined) {
|
189
|
-
|
208
|
+
if (isObject(_classPrivateFieldGet(_pluginSettings, this))) {
|
209
|
+
return assignObjectDefaults(_classPrivateFieldGet(_pluginSettings, this), defaultSettings);
|
210
|
+
}
|
211
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
190
212
|
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
return pluginSettings;
|
213
|
+
if ((Array.isArray(_classPrivateFieldGet(_pluginSettings, this)) || isObject(_classPrivateFieldGet(_pluginSettings, this))) && defaultSettings[defaultMainSettingSymbol] === settingName) {
|
214
|
+
var _classPrivateFieldGet2;
|
215
|
+
if (Array.isArray(_classPrivateFieldGet(_pluginSettings, this))) {
|
216
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
196
217
|
}
|
197
|
-
return (
|
218
|
+
return (_classPrivateFieldGet2 = _classPrivateFieldGet(_pluginSettings, this)[settingName]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : defaultSettings[settingName];
|
198
219
|
}
|
199
|
-
if (
|
200
|
-
|
201
|
-
|
220
|
+
if (settingName.includes('.')) {
|
221
|
+
const pluginValue = getProperty(_classPrivateFieldGet(_pluginSettings, this), settingName);
|
222
|
+
const defaultValue = getProperty(defaultSettings, settingName);
|
223
|
+
if (isObject(pluginValue)) {
|
224
|
+
return assignObjectDefaults(pluginValue, defaultValue);
|
225
|
+
}
|
226
|
+
return pluginValue !== undefined ? pluginValue : defaultValue;
|
227
|
+
}
|
228
|
+
if (isObject(_classPrivateFieldGet(_pluginSettings, this))) {
|
229
|
+
return assignObjectDefaults(_classPrivateFieldGet(_pluginSettings, this), defaultSettings)[settingName];
|
202
230
|
}
|
203
231
|
return defaultSettings[settingName];
|
204
232
|
}
|
205
233
|
|
234
|
+
/**
|
235
|
+
* Update plugin settings.
|
236
|
+
*
|
237
|
+
* @param {*} newSettings New settings.
|
238
|
+
* @returns {object} Updated settings object.
|
239
|
+
*/
|
240
|
+
updatePluginSettings(newSettings) {
|
241
|
+
const settingsValidators = this.constructor.SETTINGS_VALIDATORS;
|
242
|
+
if (settingsValidators && typeof settingsValidators === 'function' && typeof newSettings !== 'object') {
|
243
|
+
const isValid = settingsValidators(newSettings);
|
244
|
+
if (isValid === false) {
|
245
|
+
warn(`${this.pluginName} Plugin: option is not valid and it will be ignored.`);
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
_classPrivateFieldSet(_pluginSettings, this, newSettings);
|
249
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
250
|
+
}
|
251
|
+
if (settingsValidators && typeof settingsValidators === 'object' && typeof newSettings === 'object') {
|
252
|
+
if (_classPrivateFieldGet(_pluginSettings, this) === null || typeof _classPrivateFieldGet(_pluginSettings, this) !== 'object') {
|
253
|
+
_classPrivateFieldSet(_pluginSettings, this, {
|
254
|
+
...this.constructor.DEFAULT_SETTINGS
|
255
|
+
});
|
256
|
+
}
|
257
|
+
Object.keys(settingsValidators).forEach(key => {
|
258
|
+
if (!(key in newSettings)) {
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
const validator = settingsValidators[key];
|
262
|
+
const isValid = validator ? validator(newSettings[key]) : true;
|
263
|
+
if (isValid === false) {
|
264
|
+
warn(`${this.pluginName} Plugin: "${key}" option is not valid and it will be ignored.`);
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
_classPrivateFieldGet(_pluginSettings, this)[key] = newSettings[key];
|
268
|
+
});
|
269
|
+
return _classPrivateFieldGet(_pluginSettings, this);
|
270
|
+
}
|
271
|
+
_classPrivateFieldSet(_pluginSettings, this, newSettings);
|
272
|
+
return newSettings;
|
273
|
+
}
|
274
|
+
|
206
275
|
/**
|
207
276
|
* Add listener to plugin hooks system.
|
208
277
|
*
|
@@ -280,6 +349,7 @@ export class BasePlugin {
|
|
280
349
|
this.enablePlugin();
|
281
350
|
}
|
282
351
|
if (this.enabled && this.isEnabled() && relevantToSettings) {
|
352
|
+
this.updatePluginSettings(newSettings[this.constructor.PLUGIN_KEY]);
|
283
353
|
this.updatePlugin(newSettings);
|
284
354
|
}
|
285
355
|
}
|
@@ -297,6 +367,7 @@ export class BasePlugin {
|
|
297
367
|
*/
|
298
368
|
destroy() {
|
299
369
|
var _this$eventManager2;
|
370
|
+
_classPrivateFieldSet(_pluginSettings, this, null);
|
300
371
|
(_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
|
301
372
|
this.clearHooks();
|
302
373
|
objectEach(this, (value, property) => {
|