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
@@ -3,12 +3,16 @@
|
|
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/es.array.to-sorted.js");
|
6
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
8
|
+
require("core-js/modules/esnext.iterator.every.js");
|
7
9
|
require("core-js/modules/esnext.iterator.filter.js");
|
8
10
|
require("core-js/modules/esnext.iterator.find.js");
|
11
|
+
require("core-js/modules/esnext.iterator.map.js");
|
9
12
|
require("core-js/modules/esnext.iterator.reduce.js");
|
10
13
|
var _handsontableEditor = require("../handsontableEditor");
|
11
14
|
var _array = require("../../helpers/array");
|
15
|
+
var _object = require("../../helpers/object");
|
12
16
|
var _element = require("../../helpers/dom/element");
|
13
17
|
var _mixed = require("../../helpers/mixed");
|
14
18
|
var _string = require("../../helpers/string");
|
@@ -70,72 +74,6 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
70
74
|
_classPrivateFieldInitSpec(this, _focusDebounced, (0, _function.debounce)(() => {
|
71
75
|
this.focus();
|
72
76
|
}, 100));
|
73
|
-
/**
|
74
|
-
* Filters and sorts by relevance.
|
75
|
-
*
|
76
|
-
* @param {*} value The selected value.
|
77
|
-
* @param {string[]} choices The list of available choices.
|
78
|
-
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
79
|
-
* @returns {number[]} Array of indexes in original choices array.
|
80
|
-
*/
|
81
|
-
_defineProperty(this, "sortByRelevance", function (value, choices, caseSensitive) {
|
82
|
-
const choicesRelevance = [];
|
83
|
-
const result = [];
|
84
|
-
const valueLength = value.length;
|
85
|
-
let choicesCount = choices.length;
|
86
|
-
let charsLeft;
|
87
|
-
let currentItem;
|
88
|
-
let i;
|
89
|
-
let valueIndex;
|
90
|
-
if (valueLength === 0) {
|
91
|
-
for (i = 0; i < choicesCount; i++) {
|
92
|
-
result.push(i);
|
93
|
-
}
|
94
|
-
return result;
|
95
|
-
}
|
96
|
-
for (i = 0; i < choicesCount; i++) {
|
97
|
-
currentItem = (0, _string.stripTags)((0, _mixed.stringify)(choices[i]));
|
98
|
-
if (caseSensitive) {
|
99
|
-
valueIndex = currentItem.indexOf(value);
|
100
|
-
} else {
|
101
|
-
const locale = this.cellProperties.locale;
|
102
|
-
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
103
|
-
}
|
104
|
-
if (valueIndex !== -1) {
|
105
|
-
charsLeft = currentItem.length - valueIndex - valueLength;
|
106
|
-
choicesRelevance.push({
|
107
|
-
baseIndex: i,
|
108
|
-
index: valueIndex,
|
109
|
-
charsLeft,
|
110
|
-
value: currentItem
|
111
|
-
});
|
112
|
-
}
|
113
|
-
}
|
114
|
-
choicesRelevance.sort((a, b) => {
|
115
|
-
if (b.index === -1) {
|
116
|
-
return -1;
|
117
|
-
}
|
118
|
-
if (a.index === -1) {
|
119
|
-
return 1;
|
120
|
-
}
|
121
|
-
if (a.index < b.index) {
|
122
|
-
return -1;
|
123
|
-
} else if (b.index < a.index) {
|
124
|
-
return 1;
|
125
|
-
} else if (a.index === b.index) {
|
126
|
-
if (a.charsLeft < b.charsLeft) {
|
127
|
-
return -1;
|
128
|
-
} else if (a.charsLeft > b.charsLeft) {
|
129
|
-
return 1;
|
130
|
-
}
|
131
|
-
}
|
132
|
-
return 0;
|
133
|
-
});
|
134
|
-
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
135
|
-
result.push(choicesRelevance[i].baseIndex);
|
136
|
-
}
|
137
|
-
return result;
|
138
|
-
});
|
139
77
|
}
|
140
78
|
static get EDITOR_TYPE() {
|
141
79
|
return EDITOR_TYPE;
|
@@ -148,13 +86,14 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
148
86
|
getValue() {
|
149
87
|
const selectedValue = this.rawChoices.find(value => {
|
150
88
|
const strippedValue = this.stripValueIfNeeded(value);
|
151
|
-
return strippedValue === this.TEXTAREA.value;
|
89
|
+
return (_assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, strippedValue) ? strippedValue.value : strippedValue) === this.TEXTAREA.value;
|
152
90
|
});
|
153
91
|
if ((0, _mixed.isDefined)(selectedValue)) {
|
154
92
|
return selectedValue;
|
155
93
|
}
|
156
94
|
return this.TEXTAREA.value;
|
157
95
|
}
|
96
|
+
|
158
97
|
/**
|
159
98
|
* Creates an editor's elements and adds necessary CSS classnames.
|
160
99
|
*/
|
@@ -182,6 +121,10 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
182
121
|
if (this.hot.getSettings().ariaTags) {
|
183
122
|
(0, _element.setAttribute)(this.TEXTAREA, [(0, _a11y.A11Y_EXPANDED)('false'), (0, _a11y.A11Y_CONTROLS)(`${_classPrivateFieldGet(_idPrefix, this)}-listbox-${row}-${col}`)]);
|
184
123
|
}
|
124
|
+
this.htOptions = {
|
125
|
+
...this.htOptions,
|
126
|
+
valueGetter: cellValue => _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, cellValue) ? cellValue.value : cellValue
|
127
|
+
};
|
185
128
|
}
|
186
129
|
|
187
130
|
/**
|
@@ -314,31 +257,32 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
314
257
|
const endPos = (0, _element.getSelectionEndPosition)(this.TEXTAREA);
|
315
258
|
const sortByRelevanceSetting = this.cellProperties.sortByRelevance;
|
316
259
|
const filterSetting = this.cellProperties.filter;
|
317
|
-
|
260
|
+
const value = this.stripValueIfNeeded(this.getValue());
|
261
|
+
const comparableValue = _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, value) ? value.value : value;
|
318
262
|
let highlightIndex = null;
|
319
263
|
let choices = choicesList;
|
320
|
-
if (sortByRelevanceSetting) {
|
321
|
-
|
264
|
+
if (!sortByRelevanceSetting) {
|
265
|
+
choices = choices.toSorted();
|
322
266
|
}
|
323
|
-
const
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
const
|
330
|
-
|
331
|
-
|
267
|
+
const filteredChoiceIndexes = [];
|
268
|
+
const locale = this.cellProperties.locale;
|
269
|
+
const filteringCaseSensitive = this.cellProperties.filteringCaseSensitive;
|
270
|
+
const valueToMatch = filteringCaseSensitive ? comparableValue : comparableValue.toLocaleLowerCase(locale);
|
271
|
+
for (let i = 0; i < choices.length; i++) {
|
272
|
+
const currentItem = _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, choices[i]) ? (0, _string.stripTags)((0, _mixed.stringify)(choices[i].value)) : (0, _string.stripTags)((0, _mixed.stringify)(choices[i]));
|
273
|
+
const itemToMatch = filteringCaseSensitive ? currentItem : currentItem.toLocaleLowerCase(locale);
|
274
|
+
if (itemToMatch.indexOf(valueToMatch) !== -1) {
|
275
|
+
filteredChoiceIndexes.push(i);
|
276
|
+
if (filterSetting === false) {
|
332
277
|
break;
|
333
278
|
}
|
334
|
-
if (orderByRelevanceLength) {
|
335
|
-
sorted.push(choices[orderByRelevance[i]]);
|
336
|
-
} else {
|
337
|
-
sorted.push(choices[i]);
|
338
|
-
}
|
339
279
|
}
|
340
|
-
|
341
|
-
|
280
|
+
}
|
281
|
+
if (filterSetting === false) {
|
282
|
+
highlightIndex = filteredChoiceIndexes[0];
|
283
|
+
} else {
|
284
|
+
choices = filteredChoiceIndexes.map(index => choices[index]);
|
285
|
+
highlightIndex = choices.indexOf(valueToMatch) > -1 ? choices.indexOf(valueToMatch) : 0;
|
342
286
|
}
|
343
287
|
this.strippedChoices = choices;
|
344
288
|
if (choices.length === 0) {
|
@@ -398,6 +342,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
398
342
|
this.setDropdownHeight(tempHeight - lastRowHeight);
|
399
343
|
}
|
400
344
|
}
|
345
|
+
|
401
346
|
/**
|
402
347
|
* Updates width and height of the internal Handsontable's instance.
|
403
348
|
*
|
@@ -497,39 +442,23 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
497
442
|
*
|
498
443
|
* @private
|
499
444
|
* @param {string[]} values The value to sanitize.
|
500
|
-
* @returns {string
|
445
|
+
* @returns {Array<string|{key: string, value: string}>}
|
501
446
|
*/
|
502
447
|
stripValuesIfNeeded(values) {
|
503
448
|
const {
|
504
449
|
allowHtml
|
505
450
|
} = this.cellProperties;
|
506
|
-
const
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
* @private
|
515
|
-
* @param {number} keyCode The keyboard keycode.
|
516
|
-
* @returns {boolean}
|
517
|
-
*/
|
518
|
-
allowKeyEventPropagation(keyCode) {
|
519
|
-
const selectedRange = this.htEditor.getSelectedRangeLast();
|
520
|
-
const selected = {
|
521
|
-
row: selectedRange ? selectedRange.from.row : -1
|
522
|
-
};
|
523
|
-
let allowed = false;
|
524
|
-
if (keyCode === _unicode.KEY_CODES.ARROW_DOWN && selected.row > 0 && selected.row < this.htEditor.countRows() - 1) {
|
525
|
-
allowed = true;
|
526
|
-
}
|
527
|
-
if (keyCode === _unicode.KEY_CODES.ARROW_UP && selected.row > -1) {
|
528
|
-
allowed = true;
|
451
|
+
const processValue = value => (0, _mixed.stringify)(allowHtml ? value : (0, _string.stripTags)(value));
|
452
|
+
if (values.every(value => _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, value))) {
|
453
|
+
return values.map(value => {
|
454
|
+
return {
|
455
|
+
key: processValue(value.key),
|
456
|
+
value: processValue(value.value)
|
457
|
+
};
|
458
|
+
});
|
529
459
|
}
|
530
|
-
return
|
460
|
+
return values.map(value => processValue(value));
|
531
461
|
}
|
532
|
-
|
533
462
|
/**
|
534
463
|
* OnBeforeKeyDown callback.
|
535
464
|
*
|
@@ -566,4 +495,13 @@ function _fixDropdownWidth() {
|
|
566
495
|
width: this.getTargetEditorWidth() + (0, _element.getScrollbarWidth)(this.hot.rootDocument)
|
567
496
|
});
|
568
497
|
}
|
498
|
+
}
|
499
|
+
/**
|
500
|
+
* Checks if the value is a key/value object.
|
501
|
+
*
|
502
|
+
* @param {*} value The value to check.
|
503
|
+
* @returns {boolean}
|
504
|
+
*/
|
505
|
+
function _isKeyValueObject(value) {
|
506
|
+
return (0, _object.isObject)(value) && (0, _mixed.isDefined)(value.key) && (0, _mixed.isDefined)(value.value);
|
569
507
|
}
|
@@ -1,8 +1,11 @@
|
|
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/es.array.to-sorted.js";
|
3
4
|
import "core-js/modules/esnext.iterator.constructor.js";
|
5
|
+
import "core-js/modules/esnext.iterator.every.js";
|
4
6
|
import "core-js/modules/esnext.iterator.filter.js";
|
5
7
|
import "core-js/modules/esnext.iterator.find.js";
|
8
|
+
import "core-js/modules/esnext.iterator.map.js";
|
6
9
|
import "core-js/modules/esnext.iterator.reduce.js";
|
7
10
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
8
11
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
@@ -13,7 +16,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
13
16
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
14
17
|
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"); }
|
15
18
|
import { HandsontableEditor } from "../handsontableEditor/index.mjs";
|
16
|
-
import {
|
19
|
+
import { pivot } from "../../helpers/array.mjs";
|
20
|
+
import { isObject } from "../../helpers/object.mjs";
|
17
21
|
import { addClass, getCaretPosition, getFractionalScalingCompensation, getScrollbarWidth, getSelectionEndPosition, outerWidth, setAttribute, setCaretPosition } from "../../helpers/dom/element.mjs";
|
18
22
|
import { isDefined, stringify } from "../../helpers/mixed.mjs";
|
19
23
|
import { stripTags } from "../../helpers/string.mjs";
|
@@ -67,72 +71,6 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
67
71
|
_classPrivateFieldInitSpec(this, _focusDebounced, debounce(() => {
|
68
72
|
this.focus();
|
69
73
|
}, 100));
|
70
|
-
/**
|
71
|
-
* Filters and sorts by relevance.
|
72
|
-
*
|
73
|
-
* @param {*} value The selected value.
|
74
|
-
* @param {string[]} choices The list of available choices.
|
75
|
-
* @param {boolean} caseSensitive Indicates if it's sorted by case.
|
76
|
-
* @returns {number[]} Array of indexes in original choices array.
|
77
|
-
*/
|
78
|
-
_defineProperty(this, "sortByRelevance", function (value, choices, caseSensitive) {
|
79
|
-
const choicesRelevance = [];
|
80
|
-
const result = [];
|
81
|
-
const valueLength = value.length;
|
82
|
-
let choicesCount = choices.length;
|
83
|
-
let charsLeft;
|
84
|
-
let currentItem;
|
85
|
-
let i;
|
86
|
-
let valueIndex;
|
87
|
-
if (valueLength === 0) {
|
88
|
-
for (i = 0; i < choicesCount; i++) {
|
89
|
-
result.push(i);
|
90
|
-
}
|
91
|
-
return result;
|
92
|
-
}
|
93
|
-
for (i = 0; i < choicesCount; i++) {
|
94
|
-
currentItem = stripTags(stringify(choices[i]));
|
95
|
-
if (caseSensitive) {
|
96
|
-
valueIndex = currentItem.indexOf(value);
|
97
|
-
} else {
|
98
|
-
const locale = this.cellProperties.locale;
|
99
|
-
valueIndex = currentItem.toLocaleLowerCase(locale).indexOf(value.toLocaleLowerCase(locale));
|
100
|
-
}
|
101
|
-
if (valueIndex !== -1) {
|
102
|
-
charsLeft = currentItem.length - valueIndex - valueLength;
|
103
|
-
choicesRelevance.push({
|
104
|
-
baseIndex: i,
|
105
|
-
index: valueIndex,
|
106
|
-
charsLeft,
|
107
|
-
value: currentItem
|
108
|
-
});
|
109
|
-
}
|
110
|
-
}
|
111
|
-
choicesRelevance.sort((a, b) => {
|
112
|
-
if (b.index === -1) {
|
113
|
-
return -1;
|
114
|
-
}
|
115
|
-
if (a.index === -1) {
|
116
|
-
return 1;
|
117
|
-
}
|
118
|
-
if (a.index < b.index) {
|
119
|
-
return -1;
|
120
|
-
} else if (b.index < a.index) {
|
121
|
-
return 1;
|
122
|
-
} else if (a.index === b.index) {
|
123
|
-
if (a.charsLeft < b.charsLeft) {
|
124
|
-
return -1;
|
125
|
-
} else if (a.charsLeft > b.charsLeft) {
|
126
|
-
return 1;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
return 0;
|
130
|
-
});
|
131
|
-
for (i = 0, choicesCount = choicesRelevance.length; i < choicesCount; i++) {
|
132
|
-
result.push(choicesRelevance[i].baseIndex);
|
133
|
-
}
|
134
|
-
return result;
|
135
|
-
});
|
136
74
|
}
|
137
75
|
static get EDITOR_TYPE() {
|
138
76
|
return EDITOR_TYPE;
|
@@ -145,13 +83,14 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
145
83
|
getValue() {
|
146
84
|
const selectedValue = this.rawChoices.find(value => {
|
147
85
|
const strippedValue = this.stripValueIfNeeded(value);
|
148
|
-
return strippedValue === this.TEXTAREA.value;
|
86
|
+
return (_assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, strippedValue) ? strippedValue.value : strippedValue) === this.TEXTAREA.value;
|
149
87
|
});
|
150
88
|
if (isDefined(selectedValue)) {
|
151
89
|
return selectedValue;
|
152
90
|
}
|
153
91
|
return this.TEXTAREA.value;
|
154
92
|
}
|
93
|
+
|
155
94
|
/**
|
156
95
|
* Creates an editor's elements and adds necessary CSS classnames.
|
157
96
|
*/
|
@@ -179,6 +118,10 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
179
118
|
if (this.hot.getSettings().ariaTags) {
|
180
119
|
setAttribute(this.TEXTAREA, [A11Y_EXPANDED('false'), A11Y_CONTROLS(`${_classPrivateFieldGet(_idPrefix, this)}-listbox-${row}-${col}`)]);
|
181
120
|
}
|
121
|
+
this.htOptions = {
|
122
|
+
...this.htOptions,
|
123
|
+
valueGetter: cellValue => _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, cellValue) ? cellValue.value : cellValue
|
124
|
+
};
|
182
125
|
}
|
183
126
|
|
184
127
|
/**
|
@@ -311,31 +254,32 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
311
254
|
const endPos = getSelectionEndPosition(this.TEXTAREA);
|
312
255
|
const sortByRelevanceSetting = this.cellProperties.sortByRelevance;
|
313
256
|
const filterSetting = this.cellProperties.filter;
|
314
|
-
|
257
|
+
const value = this.stripValueIfNeeded(this.getValue());
|
258
|
+
const comparableValue = _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, value) ? value.value : value;
|
315
259
|
let highlightIndex = null;
|
316
260
|
let choices = choicesList;
|
317
|
-
if (sortByRelevanceSetting) {
|
318
|
-
|
261
|
+
if (!sortByRelevanceSetting) {
|
262
|
+
choices = choices.toSorted();
|
319
263
|
}
|
320
|
-
const
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
const
|
327
|
-
|
328
|
-
|
264
|
+
const filteredChoiceIndexes = [];
|
265
|
+
const locale = this.cellProperties.locale;
|
266
|
+
const filteringCaseSensitive = this.cellProperties.filteringCaseSensitive;
|
267
|
+
const valueToMatch = filteringCaseSensitive ? comparableValue : comparableValue.toLocaleLowerCase(locale);
|
268
|
+
for (let i = 0; i < choices.length; i++) {
|
269
|
+
const currentItem = _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, choices[i]) ? stripTags(stringify(choices[i].value)) : stripTags(stringify(choices[i]));
|
270
|
+
const itemToMatch = filteringCaseSensitive ? currentItem : currentItem.toLocaleLowerCase(locale);
|
271
|
+
if (itemToMatch.indexOf(valueToMatch) !== -1) {
|
272
|
+
filteredChoiceIndexes.push(i);
|
273
|
+
if (filterSetting === false) {
|
329
274
|
break;
|
330
275
|
}
|
331
|
-
if (orderByRelevanceLength) {
|
332
|
-
sorted.push(choices[orderByRelevance[i]]);
|
333
|
-
} else {
|
334
|
-
sorted.push(choices[i]);
|
335
|
-
}
|
336
276
|
}
|
337
|
-
|
338
|
-
|
277
|
+
}
|
278
|
+
if (filterSetting === false) {
|
279
|
+
highlightIndex = filteredChoiceIndexes[0];
|
280
|
+
} else {
|
281
|
+
choices = filteredChoiceIndexes.map(index => choices[index]);
|
282
|
+
highlightIndex = choices.indexOf(valueToMatch) > -1 ? choices.indexOf(valueToMatch) : 0;
|
339
283
|
}
|
340
284
|
this.strippedChoices = choices;
|
341
285
|
if (choices.length === 0) {
|
@@ -395,6 +339,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
395
339
|
this.setDropdownHeight(tempHeight - lastRowHeight);
|
396
340
|
}
|
397
341
|
}
|
342
|
+
|
398
343
|
/**
|
399
344
|
* Updates width and height of the internal Handsontable's instance.
|
400
345
|
*
|
@@ -494,39 +439,23 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
494
439
|
*
|
495
440
|
* @private
|
496
441
|
* @param {string[]} values The value to sanitize.
|
497
|
-
* @returns {string
|
442
|
+
* @returns {Array<string|{key: string, value: string}>}
|
498
443
|
*/
|
499
444
|
stripValuesIfNeeded(values) {
|
500
445
|
const {
|
501
446
|
allowHtml
|
502
447
|
} = this.cellProperties;
|
503
|
-
const
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
* @private
|
512
|
-
* @param {number} keyCode The keyboard keycode.
|
513
|
-
* @returns {boolean}
|
514
|
-
*/
|
515
|
-
allowKeyEventPropagation(keyCode) {
|
516
|
-
const selectedRange = this.htEditor.getSelectedRangeLast();
|
517
|
-
const selected = {
|
518
|
-
row: selectedRange ? selectedRange.from.row : -1
|
519
|
-
};
|
520
|
-
let allowed = false;
|
521
|
-
if (keyCode === KEY_CODES.ARROW_DOWN && selected.row > 0 && selected.row < this.htEditor.countRows() - 1) {
|
522
|
-
allowed = true;
|
523
|
-
}
|
524
|
-
if (keyCode === KEY_CODES.ARROW_UP && selected.row > -1) {
|
525
|
-
allowed = true;
|
448
|
+
const processValue = value => stringify(allowHtml ? value : stripTags(value));
|
449
|
+
if (values.every(value => _assertClassBrand(_AutocompleteEditor_brand, this, _isKeyValueObject).call(this, value))) {
|
450
|
+
return values.map(value => {
|
451
|
+
return {
|
452
|
+
key: processValue(value.key),
|
453
|
+
value: processValue(value.value)
|
454
|
+
};
|
455
|
+
});
|
526
456
|
}
|
527
|
-
return
|
457
|
+
return values.map(value => processValue(value));
|
528
458
|
}
|
529
|
-
|
530
459
|
/**
|
531
460
|
* OnBeforeKeyDown callback.
|
532
461
|
*
|
@@ -562,4 +491,13 @@ function _fixDropdownWidth() {
|
|
562
491
|
width: this.getTargetEditorWidth() + getScrollbarWidth(this.hot.rootDocument)
|
563
492
|
});
|
564
493
|
}
|
494
|
+
}
|
495
|
+
/**
|
496
|
+
* Checks if the value is a key/value object.
|
497
|
+
*
|
498
|
+
* @param {*} value The value to check.
|
499
|
+
* @returns {boolean}
|
500
|
+
*/
|
501
|
+
function _isKeyValueObject(value) {
|
502
|
+
return isObject(value) && isDefined(value.key) && isDefined(value.value);
|
565
503
|
}
|
@@ -196,11 +196,13 @@ class BaseEditor {
|
|
196
196
|
|
197
197
|
// if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells)
|
198
198
|
if (ctrlDown) {
|
199
|
-
const
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
const activeRange = this.hot.getSelectedRangeActive();
|
200
|
+
const topStartCorner = activeRange.getTopStartCorner();
|
201
|
+
const bottomEndCorner = activeRange.getBottomEndCorner();
|
202
|
+
visualRowFrom = topStartCorner.row;
|
203
|
+
visualColumnFrom = topStartCorner.col;
|
204
|
+
visualRowTo = bottomEndCorner.row;
|
205
|
+
visualColumnTo = bottomEndCorner.col;
|
204
206
|
} else {
|
205
207
|
[visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
|
206
208
|
}
|
@@ -234,7 +236,8 @@ class BaseEditor {
|
|
234
236
|
// Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
|
235
237
|
// otherwise IME (editor for Asia users) doesn't work.
|
236
238
|
if (this.isInFullEditMode()) {
|
237
|
-
const
|
239
|
+
const originalValue = this.cellProperties.valueGetter ? this.cellProperties.valueGetter(this.originalValue) : this.originalValue;
|
240
|
+
const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : (0, _mixed.stringify)(originalValue);
|
238
241
|
this.setValue(stringifiedInitialValue);
|
239
242
|
}
|
240
243
|
this.open(event);
|
@@ -251,6 +254,7 @@ class BaseEditor {
|
|
251
254
|
this.hot.removeHook('afterScroll', openEditor);
|
252
255
|
openEditor();
|
253
256
|
}
|
257
|
+
this.addHook('beforeDialogShow', () => this.cancelChanges());
|
254
258
|
}
|
255
259
|
|
256
260
|
/**
|
@@ -192,11 +192,13 @@ export class BaseEditor {
|
|
192
192
|
|
193
193
|
// if ctrl+enter and multiple cells selected, behave like Excel (finish editing and apply to all cells)
|
194
194
|
if (ctrlDown) {
|
195
|
-
const
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
195
|
+
const activeRange = this.hot.getSelectedRangeActive();
|
196
|
+
const topStartCorner = activeRange.getTopStartCorner();
|
197
|
+
const bottomEndCorner = activeRange.getBottomEndCorner();
|
198
|
+
visualRowFrom = topStartCorner.row;
|
199
|
+
visualColumnFrom = topStartCorner.col;
|
200
|
+
visualRowTo = bottomEndCorner.row;
|
201
|
+
visualColumnTo = bottomEndCorner.col;
|
200
202
|
} else {
|
201
203
|
[visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
|
202
204
|
}
|
@@ -230,7 +232,8 @@ export class BaseEditor {
|
|
230
232
|
// Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
|
231
233
|
// otherwise IME (editor for Asia users) doesn't work.
|
232
234
|
if (this.isInFullEditMode()) {
|
233
|
-
const
|
235
|
+
const originalValue = this.cellProperties.valueGetter ? this.cellProperties.valueGetter(this.originalValue) : this.originalValue;
|
236
|
+
const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : stringify(originalValue);
|
234
237
|
this.setValue(stringifiedInitialValue);
|
235
238
|
}
|
236
239
|
this.open(event);
|
@@ -247,6 +250,7 @@ export class BaseEditor {
|
|
247
250
|
this.hot.removeHook('afterScroll', openEditor);
|
248
251
|
openEditor();
|
249
252
|
}
|
253
|
+
this.addHook('beforeDialogShow', () => this.cancelChanges());
|
250
254
|
}
|
251
255
|
|
252
256
|
/**
|
@@ -168,7 +168,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
168
168
|
// if focus is still in the HOT editor
|
169
169
|
this.hot.listen(); // return the focus to the parent HOT instance
|
170
170
|
}
|
171
|
-
if (this.htEditor && this.htEditor.
|
171
|
+
if (this.htEditor && this.htEditor.getSelectedActive()) {
|
172
172
|
const value = this.htEditor.getValue();
|
173
173
|
if (value !== undefined) {
|
174
174
|
// if the value is undefined then it means we don't want to set the value
|
@@ -387,14 +387,14 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
387
387
|
const innerHOT = this.htEditor;
|
388
388
|
let rowToSelect;
|
389
389
|
let selectedRow;
|
390
|
-
if (!innerHOT.
|
390
|
+
if (!innerHOT.getSelectedActive() && this.isFlippedVertically) {
|
391
391
|
rowToSelect = innerHOT.countRows() - 1;
|
392
|
-
} else if (innerHOT.
|
392
|
+
} else if (innerHOT.getSelectedActive()) {
|
393
393
|
if (this.isFlippedVertically) {
|
394
|
-
selectedRow = innerHOT.
|
394
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
395
395
|
rowToSelect = Math.max(0, selectedRow - 1);
|
396
396
|
} else {
|
397
|
-
selectedRow = innerHOT.
|
397
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
398
398
|
rowToSelect = selectedRow - 1;
|
399
399
|
}
|
400
400
|
}
|
@@ -407,14 +407,14 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
407
407
|
const innerHOT = this.htEditor;
|
408
408
|
let rowToSelect;
|
409
409
|
let selectedRow;
|
410
|
-
if (!innerHOT.
|
410
|
+
if (!innerHOT.getSelectedActive() && !this.isFlippedVertically) {
|
411
411
|
rowToSelect = 0;
|
412
|
-
} else if (innerHOT.
|
412
|
+
} else if (innerHOT.getSelectedActive()) {
|
413
413
|
if (this.isFlippedVertically) {
|
414
|
-
rowToSelect = innerHOT.
|
414
|
+
rowToSelect = innerHOT.getSelectedActive()[0] + 1;
|
415
415
|
} else if (!this.isFlippedVertically) {
|
416
416
|
const lastRow = innerHOT.countRows() - 1;
|
417
|
-
selectedRow = innerHOT.
|
417
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
418
418
|
rowToSelect = Math.min(lastRow, selectedRow + 1);
|
419
419
|
}
|
420
420
|
}
|
@@ -165,7 +165,7 @@ export class HandsontableEditor extends TextEditor {
|
|
165
165
|
// if focus is still in the HOT editor
|
166
166
|
this.hot.listen(); // return the focus to the parent HOT instance
|
167
167
|
}
|
168
|
-
if (this.htEditor && this.htEditor.
|
168
|
+
if (this.htEditor && this.htEditor.getSelectedActive()) {
|
169
169
|
const value = this.htEditor.getValue();
|
170
170
|
if (value !== undefined) {
|
171
171
|
// if the value is undefined then it means we don't want to set the value
|
@@ -384,14 +384,14 @@ export class HandsontableEditor extends TextEditor {
|
|
384
384
|
const innerHOT = this.htEditor;
|
385
385
|
let rowToSelect;
|
386
386
|
let selectedRow;
|
387
|
-
if (!innerHOT.
|
387
|
+
if (!innerHOT.getSelectedActive() && this.isFlippedVertically) {
|
388
388
|
rowToSelect = innerHOT.countRows() - 1;
|
389
|
-
} else if (innerHOT.
|
389
|
+
} else if (innerHOT.getSelectedActive()) {
|
390
390
|
if (this.isFlippedVertically) {
|
391
|
-
selectedRow = innerHOT.
|
391
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
392
392
|
rowToSelect = Math.max(0, selectedRow - 1);
|
393
393
|
} else {
|
394
|
-
selectedRow = innerHOT.
|
394
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
395
395
|
rowToSelect = selectedRow - 1;
|
396
396
|
}
|
397
397
|
}
|
@@ -404,14 +404,14 @@ export class HandsontableEditor extends TextEditor {
|
|
404
404
|
const innerHOT = this.htEditor;
|
405
405
|
let rowToSelect;
|
406
406
|
let selectedRow;
|
407
|
-
if (!innerHOT.
|
407
|
+
if (!innerHOT.getSelectedActive() && !this.isFlippedVertically) {
|
408
408
|
rowToSelect = 0;
|
409
|
-
} else if (innerHOT.
|
409
|
+
} else if (innerHOT.getSelectedActive()) {
|
410
410
|
if (this.isFlippedVertically) {
|
411
|
-
rowToSelect = innerHOT.
|
411
|
+
rowToSelect = innerHOT.getSelectedActive()[0] + 1;
|
412
412
|
} else if (!this.isFlippedVertically) {
|
413
413
|
const lastRow = innerHOT.countRows() - 1;
|
414
|
-
selectedRow = innerHOT.
|
414
|
+
selectedRow = innerHOT.getSelectedActive()[0];
|
415
415
|
rowToSelect = Math.min(lastRow, selectedRow + 1);
|
416
416
|
}
|
417
417
|
}
|
@@ -346,13 +346,6 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
346
346
|
});
|
347
347
|
}
|
348
348
|
|
349
|
-
/**
|
350
|
-
* Ugly hack for autocompleteEditor.
|
351
|
-
*
|
352
|
-
* @private
|
353
|
-
*/
|
354
|
-
allowKeyEventPropagation() {}
|
355
|
-
|
356
349
|
/**
|
357
350
|
* Destroys the internal event manager and clears attached hooks.
|
358
351
|
*
|