handsontable 0.0.0-next-2c41c5b-20250814 → 0.0.0-next-fce5825-20250822

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (126) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/cellTypes/autocompleteType/autocompleteType.js +1 -4
  4. package/cellTypes/autocompleteType/autocompleteType.mjs +1 -4
  5. package/cellTypes/checkboxType/checkboxType.js +1 -3
  6. package/cellTypes/checkboxType/checkboxType.mjs +1 -3
  7. package/cellTypes/dropdownType/dropdownType.js +1 -4
  8. package/cellTypes/dropdownType/dropdownType.mjs +1 -4
  9. package/cellTypes/numericType/numericType.js +1 -3
  10. package/cellTypes/numericType/numericType.mjs +1 -3
  11. package/core/focusCatcher/index.js +37 -20
  12. package/core/focusCatcher/index.mjs +37 -20
  13. package/core/focusCatcher/utils.js +3 -64
  14. package/core/focusCatcher/utils.mjs +1 -60
  15. package/core/hooks/constants.js +58 -0
  16. package/core/hooks/constants.mjs +58 -0
  17. package/core/hooks/index.d.ts +7 -0
  18. package/core.d.ts +0 -1
  19. package/core.js +59 -55
  20. package/core.mjs +61 -57
  21. package/dataMap/dataMap.js +3 -13
  22. package/dataMap/dataMap.mjs +4 -14
  23. package/dataMap/dataSource.js +0 -16
  24. package/dataMap/dataSource.mjs +0 -16
  25. package/dataMap/metaManager/lazyFactoryMap.js +3 -4
  26. package/dataMap/metaManager/lazyFactoryMap.mjs +1 -2
  27. package/dataMap/metaManager/metaLayers/cellMeta.js +2 -3
  28. package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -3
  29. package/dataMap/metaManager/metaSchema.js +97 -68
  30. package/dataMap/metaManager/metaSchema.mjs +97 -68
  31. package/dataMap/metaManager/utils.js +11 -0
  32. package/dataMap/metaManager/utils.mjs +10 -0
  33. package/dist/handsontable.css +103 -5
  34. package/dist/handsontable.full.css +103 -5
  35. package/dist/handsontable.full.js +2770 -1954
  36. package/dist/handsontable.full.min.css +3 -3
  37. package/dist/handsontable.full.min.js +67 -67
  38. package/dist/handsontable.js +2772 -1956
  39. package/dist/handsontable.min.css +3 -3
  40. package/dist/handsontable.min.js +27 -27
  41. package/editors/autocompleteEditor/autocompleteEditor.js +8 -33
  42. package/editors/autocompleteEditor/autocompleteEditor.mjs +9 -34
  43. package/editors/baseEditor/baseEditor.js +2 -2
  44. package/editors/baseEditor/baseEditor.mjs +2 -2
  45. package/helpers/a11y.js +5 -1
  46. package/helpers/a11y.mjs +3 -1
  47. package/helpers/mixed.js +64 -1
  48. package/helpers/mixed.mjs +62 -1
  49. package/helpers/number.js +0 -28
  50. package/helpers/number.mjs +0 -26
  51. package/helpers/string.js +0 -19
  52. package/helpers/string.mjs +0 -18
  53. package/index.d.ts +9 -0
  54. package/package.json +6 -1
  55. package/plugins/autofill/autofill.js +3 -50
  56. package/plugins/autofill/autofill.mjs +3 -50
  57. package/plugins/base/base.js +75 -14
  58. package/plugins/base/base.mjs +75 -14
  59. package/plugins/contextMenu/contextMenu.js +1 -0
  60. package/plugins/contextMenu/contextMenu.mjs +1 -0
  61. package/plugins/copyPaste/copyPaste.js +28 -61
  62. package/plugins/copyPaste/copyPaste.mjs +29 -62
  63. package/plugins/dialog/dialog.d.ts +23 -0
  64. package/plugins/dialog/dialog.js +469 -0
  65. package/plugins/dialog/dialog.mjs +465 -0
  66. package/plugins/dialog/index.d.ts +1 -0
  67. package/plugins/dialog/index.js +7 -0
  68. package/plugins/dialog/index.mjs +1 -0
  69. package/plugins/dialog/ui.js +240 -0
  70. package/plugins/dialog/ui.mjs +235 -0
  71. package/plugins/dropdownMenu/dropdownMenu.js +1 -0
  72. package/plugins/dropdownMenu/dropdownMenu.mjs +1 -0
  73. package/plugins/index.d.ts +3 -0
  74. package/plugins/index.js +3 -0
  75. package/plugins/index.mjs +3 -1
  76. package/plugins/pagination/focusController.js +27 -0
  77. package/plugins/pagination/focusController.mjs +23 -0
  78. package/plugins/pagination/pagination.js +165 -18
  79. package/plugins/pagination/pagination.mjs +165 -18
  80. package/plugins/pagination/ui.js +101 -62
  81. package/plugins/pagination/ui.mjs +102 -63
  82. package/selection/range.js +11 -0
  83. package/selection/range.mjs +11 -0
  84. package/selection/selection.js +63 -2
  85. package/selection/selection.mjs +63 -2
  86. package/selection/utils.js +2 -1
  87. package/selection/utils.mjs +2 -1
  88. package/settings.d.ts +3 -3
  89. package/shortcuts/context.js +4 -1
  90. package/shortcuts/context.mjs +4 -1
  91. package/shortcuts/manager.js +17 -3
  92. package/shortcuts/manager.mjs +17 -3
  93. package/styles/handsontable.css +106 -22
  94. package/styles/handsontable.min.css +3 -3
  95. package/styles/ht-theme-horizon.css +24 -6
  96. package/styles/ht-theme-horizon.min.css +3 -3
  97. package/styles/ht-theme-main.css +52 -34
  98. package/styles/ht-theme-main.min.css +3 -3
  99. package/tableView.js +7 -2
  100. package/tableView.mjs +7 -2
  101. package/{core/focusCatcher → utils}/focusDetector.js +29 -11
  102. package/{core/focusCatcher → utils}/focusDetector.mjs +29 -11
  103. package/validators/autocompleteValidator/autocompleteValidator.js +1 -2
  104. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -2
  105. package/cellTypes/autocompleteType/accessors/index.js +0 -7
  106. package/cellTypes/autocompleteType/accessors/index.mjs +0 -2
  107. package/cellTypes/autocompleteType/accessors/valueGetter.js +0 -14
  108. package/cellTypes/autocompleteType/accessors/valueGetter.mjs +0 -10
  109. package/cellTypes/autocompleteType/accessors/valueSetter.js +0 -25
  110. package/cellTypes/autocompleteType/accessors/valueSetter.mjs +0 -21
  111. package/cellTypes/checkboxType/accessors/index.js +0 -5
  112. package/cellTypes/checkboxType/accessors/index.mjs +0 -1
  113. package/cellTypes/checkboxType/accessors/valueSetter.js +0 -26
  114. package/cellTypes/checkboxType/accessors/valueSetter.mjs +0 -22
  115. package/cellTypes/dropdownType/accessors/index.js +0 -7
  116. package/cellTypes/dropdownType/accessors/index.mjs +0 -2
  117. package/cellTypes/dropdownType/accessors/valueGetter.js +0 -14
  118. package/cellTypes/dropdownType/accessors/valueGetter.mjs +0 -10
  119. package/cellTypes/dropdownType/accessors/valueSetter.js +0 -17
  120. package/cellTypes/dropdownType/accessors/valueSetter.mjs +0 -13
  121. package/cellTypes/numericType/accessors/index.js +0 -5
  122. package/cellTypes/numericType/accessors/index.mjs +0 -1
  123. package/cellTypes/numericType/accessors/valueSetter.js +0 -19
  124. package/cellTypes/numericType/accessors/valueSetter.mjs +0 -15
  125. package/utils/valueAccessors.js +0 -45
  126. package/utils/valueAccessors.mjs +0 -40
package/base.js CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
45
45
  Handsontable.CellCoords = _src.CellCoords;
46
46
  Handsontable.CellRange = _src.CellRange;
47
47
  Handsontable.packageName = 'handsontable';
48
- Handsontable.buildDate = "14/08/2025 13:37:18";
49
- Handsontable.version = "0.0.0-next-2c41c5b-20250814";
48
+ Handsontable.buildDate = "22/08/2025 10:29:56";
49
+ Handsontable.version = "0.0.0-next-fce5825-20250822";
50
50
  Handsontable.languages = {
51
51
  dictionaryKeys: _registry.dictionaryKeys,
52
52
  getLanguageDictionary: _registry.getLanguageDictionary,
package/base.mjs CHANGED
@@ -35,8 +35,8 @@ Handsontable.hooks = Hooks.getSingleton();
35
35
  Handsontable.CellCoords = CellCoords;
36
36
  Handsontable.CellRange = CellRange;
37
37
  Handsontable.packageName = 'handsontable';
38
- Handsontable.buildDate = "14/08/2025 13:37:24";
39
- Handsontable.version = "0.0.0-next-2c41c5b-20250814";
38
+ Handsontable.buildDate = "22/08/2025 10:30:02";
39
+ Handsontable.version = "0.0.0-next-fce5825-20250822";
40
40
  Handsontable.languages = {
41
41
  dictionaryKeys,
42
42
  getLanguageDictionary,
@@ -4,13 +4,10 @@ exports.__esModule = true;
4
4
  var _autocompleteEditor = require("../../editors/autocompleteEditor");
5
5
  var _autocompleteRenderer = require("../../renderers/autocompleteRenderer");
6
6
  var _autocompleteValidator = require("../../validators/autocompleteValidator");
7
- var _accessors = require("./accessors");
8
7
  const CELL_TYPE = exports.CELL_TYPE = 'autocomplete';
9
8
  const AutocompleteCellType = exports.AutocompleteCellType = {
10
9
  CELL_TYPE,
11
10
  editor: _autocompleteEditor.AutocompleteEditor,
12
11
  renderer: _autocompleteRenderer.autocompleteRenderer,
13
- validator: _autocompleteValidator.autocompleteValidator,
14
- valueGetter: _accessors.valueGetter,
15
- valueSetter: _accessors.valueSetter
12
+ validator: _autocompleteValidator.autocompleteValidator
16
13
  };
@@ -1,13 +1,10 @@
1
1
  import { AutocompleteEditor } from "../../editors/autocompleteEditor/index.mjs";
2
2
  import { autocompleteRenderer } from "../../renderers/autocompleteRenderer/index.mjs";
3
3
  import { autocompleteValidator } from "../../validators/autocompleteValidator/index.mjs";
4
- import { valueGetter, valueSetter } from "./accessors/index.mjs";
5
4
  export const CELL_TYPE = 'autocomplete';
6
5
  export const AutocompleteCellType = {
7
6
  CELL_TYPE,
8
7
  editor: AutocompleteEditor,
9
8
  renderer: autocompleteRenderer,
10
- validator: autocompleteValidator,
11
- valueGetter,
12
- valueSetter
9
+ validator: autocompleteValidator
13
10
  };
@@ -3,11 +3,9 @@
3
3
  exports.__esModule = true;
4
4
  var _checkboxEditor = require("../../editors/checkboxEditor");
5
5
  var _checkboxRenderer = require("../../renderers/checkboxRenderer");
6
- var _accessors = require("./accessors");
7
6
  const CELL_TYPE = exports.CELL_TYPE = 'checkbox';
8
7
  const CheckboxCellType = exports.CheckboxCellType = {
9
8
  CELL_TYPE,
10
9
  editor: _checkboxEditor.CheckboxEditor,
11
- renderer: _checkboxRenderer.checkboxRenderer,
12
- valueSetter: _accessors.valueSetter
10
+ renderer: _checkboxRenderer.checkboxRenderer
13
11
  };
@@ -1,10 +1,8 @@
1
1
  import { CheckboxEditor } from "../../editors/checkboxEditor/index.mjs";
2
2
  import { checkboxRenderer } from "../../renderers/checkboxRenderer/index.mjs";
3
- import { valueSetter } from "./accessors/index.mjs";
4
3
  export const CELL_TYPE = 'checkbox';
5
4
  export const CheckboxCellType = {
6
5
  CELL_TYPE,
7
6
  editor: CheckboxEditor,
8
- renderer: checkboxRenderer,
9
- valueSetter
7
+ renderer: checkboxRenderer
10
8
  };
@@ -4,7 +4,6 @@ exports.__esModule = true;
4
4
  var _dropdownEditor = require("../../editors/dropdownEditor");
5
5
  var _dropdownRenderer = require("../../renderers/dropdownRenderer");
6
6
  var _dropdownValidator = require("../../validators/dropdownValidator");
7
- var _accessors = require("./accessors");
8
7
  const CELL_TYPE = exports.CELL_TYPE = 'dropdown';
9
8
  const DropdownCellType = exports.DropdownCellType = {
10
9
  CELL_TYPE,
@@ -13,7 +12,5 @@ const DropdownCellType = exports.DropdownCellType = {
13
12
  // displays small gray arrow on right side of the cell
14
13
  validator: _dropdownValidator.dropdownValidator,
15
14
  filter: false,
16
- strict: true,
17
- valueGetter: _accessors.valueGetter,
18
- valueSetter: _accessors.valueSetter
15
+ strict: true
19
16
  };
@@ -1,7 +1,6 @@
1
1
  import { DropdownEditor } from "../../editors/dropdownEditor/index.mjs";
2
2
  import { dropdownRenderer } from "../../renderers/dropdownRenderer/index.mjs";
3
3
  import { dropdownValidator } from "../../validators/dropdownValidator/index.mjs";
4
- import { valueGetter, valueSetter } from "./accessors/index.mjs";
5
4
  export const CELL_TYPE = 'dropdown';
6
5
  export const DropdownCellType = {
7
6
  CELL_TYPE,
@@ -10,7 +9,5 @@ export const DropdownCellType = {
10
9
  // displays small gray arrow on right side of the cell
11
10
  validator: dropdownValidator,
12
11
  filter: false,
13
- strict: true,
14
- valueGetter,
15
- valueSetter
12
+ strict: true
16
13
  };
@@ -4,13 +4,11 @@ exports.__esModule = true;
4
4
  var _numericEditor = require("../../editors/numericEditor");
5
5
  var _numericRenderer = require("../../renderers/numericRenderer");
6
6
  var _numericValidator = require("../../validators/numericValidator");
7
- var _accessors = require("./accessors");
8
7
  const CELL_TYPE = exports.CELL_TYPE = 'numeric';
9
8
  const NumericCellType = exports.NumericCellType = {
10
9
  CELL_TYPE,
11
10
  editor: _numericEditor.NumericEditor,
12
11
  renderer: _numericRenderer.numericRenderer,
13
12
  validator: _numericValidator.numericValidator,
14
- dataType: 'number',
15
- valueSetter: _accessors.valueSetter
13
+ dataType: 'number'
16
14
  };
@@ -1,13 +1,11 @@
1
1
  import { NumericEditor } from "../../editors/numericEditor/index.mjs";
2
2
  import { numericRenderer } from "../../renderers/numericRenderer/index.mjs";
3
3
  import { numericValidator } from "../../validators/numericValidator/index.mjs";
4
- import { valueSetter } from "./accessors/index.mjs";
5
4
  export const CELL_TYPE = 'numeric';
6
5
  export const NumericCellType = {
7
6
  CELL_TYPE,
8
7
  editor: NumericEditor,
9
8
  renderer: numericRenderer,
10
9
  validator: numericValidator,
11
- dataType: 'number',
12
- valueSetter
10
+ dataType: 'number'
13
11
  };
@@ -3,8 +3,9 @@
3
3
  exports.__esModule = true;
4
4
  exports.installFocusCatcher = installFocusCatcher;
5
5
  var _shortcutContexts = require("../../shortcutContexts");
6
- var _focusDetector = require("./focusDetector");
6
+ var _focusDetector = require("../../utils/focusDetector");
7
7
  var _utils = require("./utils");
8
+ var _mixed = require("../../helpers/mixed");
8
9
  /**
9
10
  * Installs a focus catcher module. The module observes when the table is focused and depending on
10
11
  * from the which side it was focused on it selects a specified cell or releases the TAB navigation
@@ -18,22 +19,26 @@ function installFocusCatcher(hot) {
18
19
  const {
19
20
  activate,
20
21
  deactivate
21
- } = (0, _focusDetector.installFocusDetector)(hot, {
22
- onFocusFromTop() {
23
- var _clampCoordsIfNeeded;
24
- const mostTopStartCoords = (_clampCoordsIfNeeded = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded !== void 0 ? _clampCoordsIfNeeded : (0, _utils.getMostTopStartPosition)(hot);
25
- if (mostTopStartCoords) {
26
- hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
27
- hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
28
- }
29
- hot.listen();
30
- },
31
- onFocusFromBottom() {
32
- var _clampCoordsIfNeeded2;
33
- const mostBottomEndCoords = (_clampCoordsIfNeeded2 = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded2 !== void 0 ? _clampCoordsIfNeeded2 : (0, _utils.getMostBottomEndPosition)(hot);
34
- if (mostBottomEndCoords) {
35
- hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
36
- hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
22
+ } = (0, _focusDetector.installFocusDetector)(hot, hot.rootGridElement, {
23
+ onFocus(from) {
24
+ if (from === 'from_above') {
25
+ var _clampCoordsIfNeeded;
26
+ const mostTopStartCoords = (_clampCoordsIfNeeded = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded !== void 0 ? _clampCoordsIfNeeded : (0, _mixed.getMostTopStartPosition)(hot);
27
+ if (mostTopStartCoords) {
28
+ const result = hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
29
+ if (result !== false) {
30
+ hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
31
+ }
32
+ }
33
+ } else {
34
+ var _clampCoordsIfNeeded2;
35
+ const mostBottomEndCoords = (_clampCoordsIfNeeded2 = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded2 !== void 0 ? _clampCoordsIfNeeded2 : (0, _mixed.getMostBottomEndPosition)(hot);
36
+ if (mostBottomEndCoords) {
37
+ const result = hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
38
+ if (result !== false) {
39
+ hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
40
+ }
41
+ }
37
42
  }
38
43
  hot.listen();
39
44
  }
@@ -45,8 +50,20 @@ function installFocusCatcher(hot) {
45
50
  let isSavingCoordsEnabled = true;
46
51
  let isTabOrShiftTabPressed = false;
47
52
  let preventViewportScroll = false;
48
- hot.addHook('afterListen', () => deactivate());
49
- hot.addHook('afterUnlisten', () => activate());
53
+ hot.addHook('afterListen', () => {
54
+ const activeContextName = hot.getShortcutManager().getActiveContextName();
55
+ const activeContext = hot.getShortcutManager().getContext(activeContextName);
56
+ if ((activeContext === null || activeContext === void 0 ? void 0 : activeContext.scope) === 'table') {
57
+ deactivate();
58
+ }
59
+ });
60
+ hot.addHook('afterUnlisten', () => {
61
+ const activeContextName = hot.getShortcutManager().getActiveContextName();
62
+ const activeContext = hot.getShortcutManager().getContext(activeContextName);
63
+ if ((activeContext === null || activeContext === void 0 ? void 0 : activeContext.scope) === 'table') {
64
+ activate();
65
+ }
66
+ });
50
67
  hot.addHook('afterSelection', (row, column, row2, column2, preventScrolling) => {
51
68
  if (isTabOrShiftTabPressed && (rowWrapState.wrapped && rowWrapState.flipped || preventViewportScroll)) {
52
69
  preventViewportScroll = false;
@@ -104,7 +121,7 @@ function installFocusCatcher(hot) {
104
121
  isSavingCoordsEnabled = true;
105
122
  if (!tabNavigation || !hot.selection.isSelected() || autoWrapRow && rowWrapState.wrapped && rowWrapState.flipped || !autoWrapRow && rowWrapState.wrapped) {
106
123
  if (autoWrapRow && rowWrapState.wrapped && rowWrapState.flipped) {
107
- recentlyAddedFocusCoords = event.shiftKey ? (0, _utils.getMostTopStartPosition)(hot) : (0, _utils.getMostBottomEndPosition)(hot);
124
+ recentlyAddedFocusCoords = event.shiftKey ? (0, _mixed.getMostTopStartPosition)(hot) : (0, _mixed.getMostBottomEndPosition)(hot);
108
125
  }
109
126
  deactivateTable();
110
127
  return false;
@@ -1,6 +1,7 @@
1
1
  import { GRID_GROUP } from "../../shortcutContexts/index.mjs";
2
- import { installFocusDetector } from "./focusDetector.mjs";
3
- import { normalizeCoordsIfNeeded, getMostTopStartPosition, getMostBottomEndPosition } from "./utils.mjs";
2
+ import { installFocusDetector } from "../../utils/focusDetector.mjs";
3
+ import { normalizeCoordsIfNeeded } from "./utils.mjs";
4
+ import { getMostTopStartPosition, getMostBottomEndPosition } from "../../helpers/mixed.mjs";
4
5
  /**
5
6
  * Installs a focus catcher module. The module observes when the table is focused and depending on
6
7
  * from the which side it was focused on it selects a specified cell or releases the TAB navigation
@@ -14,22 +15,26 @@ export function installFocusCatcher(hot) {
14
15
  const {
15
16
  activate,
16
17
  deactivate
17
- } = installFocusDetector(hot, {
18
- onFocusFromTop() {
19
- var _clampCoordsIfNeeded;
20
- const mostTopStartCoords = (_clampCoordsIfNeeded = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded !== void 0 ? _clampCoordsIfNeeded : getMostTopStartPosition(hot);
21
- if (mostTopStartCoords) {
22
- hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
23
- hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
24
- }
25
- hot.listen();
26
- },
27
- onFocusFromBottom() {
28
- var _clampCoordsIfNeeded2;
29
- const mostBottomEndCoords = (_clampCoordsIfNeeded2 = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded2 !== void 0 ? _clampCoordsIfNeeded2 : getMostBottomEndPosition(hot);
30
- if (mostBottomEndCoords) {
31
- hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
32
- hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
18
+ } = installFocusDetector(hot, hot.rootGridElement, {
19
+ onFocus(from) {
20
+ if (from === 'from_above') {
21
+ var _clampCoordsIfNeeded;
22
+ const mostTopStartCoords = (_clampCoordsIfNeeded = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded !== void 0 ? _clampCoordsIfNeeded : getMostTopStartPosition(hot);
23
+ if (mostTopStartCoords) {
24
+ const result = hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
25
+ if (result !== false) {
26
+ hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
27
+ }
28
+ }
29
+ } else {
30
+ var _clampCoordsIfNeeded2;
31
+ const mostBottomEndCoords = (_clampCoordsIfNeeded2 = clampCoordsIfNeeded(recentlyAddedFocusCoords)) !== null && _clampCoordsIfNeeded2 !== void 0 ? _clampCoordsIfNeeded2 : getMostBottomEndPosition(hot);
32
+ if (mostBottomEndCoords) {
33
+ const result = hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
34
+ if (result !== false) {
35
+ hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
36
+ }
37
+ }
33
38
  }
34
39
  hot.listen();
35
40
  }
@@ -41,8 +46,20 @@ export function installFocusCatcher(hot) {
41
46
  let isSavingCoordsEnabled = true;
42
47
  let isTabOrShiftTabPressed = false;
43
48
  let preventViewportScroll = false;
44
- hot.addHook('afterListen', () => deactivate());
45
- hot.addHook('afterUnlisten', () => activate());
49
+ hot.addHook('afterListen', () => {
50
+ const activeContextName = hot.getShortcutManager().getActiveContextName();
51
+ const activeContext = hot.getShortcutManager().getContext(activeContextName);
52
+ if ((activeContext === null || activeContext === void 0 ? void 0 : activeContext.scope) === 'table') {
53
+ deactivate();
54
+ }
55
+ });
56
+ hot.addHook('afterUnlisten', () => {
57
+ const activeContextName = hot.getShortcutManager().getActiveContextName();
58
+ const activeContext = hot.getShortcutManager().getContext(activeContextName);
59
+ if ((activeContext === null || activeContext === void 0 ? void 0 : activeContext.scope) === 'table') {
60
+ activate();
61
+ }
62
+ });
46
63
  hot.addHook('afterSelection', (row, column, row2, column2, preventScrolling) => {
47
64
  if (isTabOrShiftTabPressed && (rowWrapState.wrapped && rowWrapState.flipped || preventViewportScroll)) {
48
65
  preventViewportScroll = false;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.getMostBottomEndPosition = getMostBottomEndPosition;
5
- exports.getMostTopStartPosition = getMostTopStartPosition;
6
4
  exports.normalizeCoordsIfNeeded = normalizeCoordsIfNeeded;
7
5
  var _number = require("../../helpers/number");
6
+ var _mixed = require("../../helpers/mixed");
8
7
  /**
9
8
  * Normalizes the coordinates (clamps to nearest visible cell position within dataset range).
10
9
  *
@@ -23,70 +22,10 @@ function normalizeCoordsIfNeeded(hot) {
23
22
  if (rowIndexMapper.isHidden(coords.row) || columnIndexMapper.isHidden(coords.col)) {
24
23
  return null;
25
24
  }
26
- const mostTopStartCoords = getMostTopStartPosition(hot);
27
- const mostBottomEndCoords = getMostBottomEndPosition(hot);
25
+ const mostTopStartCoords = (0, _mixed.getMostTopStartPosition)(hot);
26
+ const mostBottomEndCoords = (0, _mixed.getMostBottomEndPosition)(hot);
28
27
  coords.row = (0, _number.clamp)(coords.row, mostTopStartCoords.row, mostBottomEndCoords.row);
29
28
  coords.col = (0, _number.clamp)(coords.col, mostTopStartCoords.col, mostBottomEndCoords.col);
30
29
  return coords;
31
30
  };
32
- }
33
-
34
- /**
35
- * Gets the coordinates of the most top-start cell or header (depends on the table settings and its size).
36
- *
37
- * @param {Core} hot The Handsontable instance.
38
- * @returns {CellCoords|null}
39
- */
40
- function getMostTopStartPosition(hot) {
41
- const {
42
- rowIndexMapper,
43
- columnIndexMapper
44
- } = hot;
45
- const {
46
- navigableHeaders
47
- } = hot.getSettings();
48
- let topRow = navigableHeaders && hot.countColHeaders() > 0 ? -hot.countColHeaders() : 0;
49
- let startColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -hot.countRowHeaders() : 0;
50
- if (topRow === 0) {
51
- topRow = rowIndexMapper.getVisualFromRenderableIndex(topRow);
52
- }
53
- if (startColumn === 0) {
54
- startColumn = columnIndexMapper.getVisualFromRenderableIndex(startColumn);
55
- }
56
- if (topRow === null || startColumn === null) {
57
- return null;
58
- }
59
- return hot._createCellCoords(topRow, startColumn);
60
- }
61
-
62
- /**
63
- * Gets the coordinates of the most bottom-end cell or header (depends on the table settings and its size).
64
- *
65
- * @param {Core} hot The Handsontable instance.
66
- * @returns {CellCoords|null}
67
- */
68
- function getMostBottomEndPosition(hot) {
69
- var _rowIndexMapper$getVi, _columnIndexMapper$ge;
70
- const {
71
- rowIndexMapper,
72
- columnIndexMapper
73
- } = hot;
74
- const {
75
- navigableHeaders
76
- } = hot.getSettings();
77
- let bottomRow = rowIndexMapper.getRenderableIndexesLength() - 1;
78
- let endColumn = columnIndexMapper.getRenderableIndexesLength() - 1;
79
- if (bottomRow < 0) {
80
- if (!navigableHeaders || hot.countColHeaders() === 0) {
81
- return null;
82
- }
83
- bottomRow = -1;
84
- }
85
- if (endColumn < 0) {
86
- if (!navigableHeaders || hot.countColHeaders() === 0) {
87
- return null;
88
- }
89
- endColumn = -1;
90
- }
91
- return hot._createCellCoords((_rowIndexMapper$getVi = rowIndexMapper.getVisualFromRenderableIndex(bottomRow)) !== null && _rowIndexMapper$getVi !== void 0 ? _rowIndexMapper$getVi : bottomRow, (_columnIndexMapper$ge = columnIndexMapper.getVisualFromRenderableIndex(endColumn)) !== null && _columnIndexMapper$ge !== void 0 ? _columnIndexMapper$ge : endColumn);
92
31
  }
@@ -1,4 +1,5 @@
1
1
  import { clamp } from "../../helpers/number.mjs";
2
+ import { getMostTopStartPosition, getMostBottomEndPosition } from "../../helpers/mixed.mjs";
2
3
  /**
3
4
  * Normalizes the coordinates (clamps to nearest visible cell position within dataset range).
4
5
  *
@@ -23,64 +24,4 @@ export function normalizeCoordsIfNeeded(hot) {
23
24
  coords.col = clamp(coords.col, mostTopStartCoords.col, mostBottomEndCoords.col);
24
25
  return coords;
25
26
  };
26
- }
27
-
28
- /**
29
- * Gets the coordinates of the most top-start cell or header (depends on the table settings and its size).
30
- *
31
- * @param {Core} hot The Handsontable instance.
32
- * @returns {CellCoords|null}
33
- */
34
- export function getMostTopStartPosition(hot) {
35
- const {
36
- rowIndexMapper,
37
- columnIndexMapper
38
- } = hot;
39
- const {
40
- navigableHeaders
41
- } = hot.getSettings();
42
- let topRow = navigableHeaders && hot.countColHeaders() > 0 ? -hot.countColHeaders() : 0;
43
- let startColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -hot.countRowHeaders() : 0;
44
- if (topRow === 0) {
45
- topRow = rowIndexMapper.getVisualFromRenderableIndex(topRow);
46
- }
47
- if (startColumn === 0) {
48
- startColumn = columnIndexMapper.getVisualFromRenderableIndex(startColumn);
49
- }
50
- if (topRow === null || startColumn === null) {
51
- return null;
52
- }
53
- return hot._createCellCoords(topRow, startColumn);
54
- }
55
-
56
- /**
57
- * Gets the coordinates of the most bottom-end cell or header (depends on the table settings and its size).
58
- *
59
- * @param {Core} hot The Handsontable instance.
60
- * @returns {CellCoords|null}
61
- */
62
- export function getMostBottomEndPosition(hot) {
63
- var _rowIndexMapper$getVi, _columnIndexMapper$ge;
64
- const {
65
- rowIndexMapper,
66
- columnIndexMapper
67
- } = hot;
68
- const {
69
- navigableHeaders
70
- } = hot.getSettings();
71
- let bottomRow = rowIndexMapper.getRenderableIndexesLength() - 1;
72
- let endColumn = columnIndexMapper.getRenderableIndexesLength() - 1;
73
- if (bottomRow < 0) {
74
- if (!navigableHeaders || hot.countColHeaders() === 0) {
75
- return null;
76
- }
77
- bottomRow = -1;
78
- }
79
- if (endColumn < 0) {
80
- if (!navigableHeaders || hot.countColHeaders() === 0) {
81
- return null;
82
- }
83
- endColumn = -1;
84
- }
85
- return hot._createCellCoords((_rowIndexMapper$getVi = rowIndexMapper.getVisualFromRenderableIndex(bottomRow)) !== null && _rowIndexMapper$getVi !== void 0 ? _rowIndexMapper$getVi : bottomRow, (_columnIndexMapper$ge = columnIndexMapper.getVisualFromRenderableIndex(endColumn)) !== null && _columnIndexMapper$ge !== void 0 ? _columnIndexMapper$ge : endColumn);
86
27
  }
@@ -1767,6 +1767,7 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
1767
1767
  * @param {'from_above' | 'from_below'} tabActivationDir The browsers Tab navigation direction. Depending on
1768
1768
  * whether the user activated the table from the element above or below, another cell can be selected.
1769
1769
  * @param {CellCoords} visualCoords The coords that will be used to select a cell.
1770
+ * @returns {undefined|boolean} If `false` is returned, the table will not be focused.
1770
1771
  */
1771
1772
  'modifyFocusOnTabNavigation',
1772
1773
  /**
@@ -2937,6 +2938,63 @@ const REGISTERED_HOOKS = exports.REGISTERED_HOOKS = [/* eslint-disable jsdoc/req
2937
2938
  * Returning `true` removes those restrictions.
2938
2939
  */
2939
2940
  'beforeBeginEditing',
2941
+ /**
2942
+ * Fired by {@link Dialog} plugin after hiding the dialog. This hook is fired when {@link Options#dialog}
2943
+ * option is enabled.
2944
+ *
2945
+ * @since 16.1.0
2946
+ * @event Hooks#afterDialogHide
2947
+ */
2948
+ 'afterDialogHide',
2949
+ /**
2950
+ * Fired by {@link Dialog} plugin after showing the dialog. This hook is fired when {@link Options#dialog}
2951
+ * option is enabled.
2952
+ *
2953
+ * @since 16.1.0
2954
+ * @event Hooks#afterDialogShow
2955
+ */
2956
+ 'afterDialogShow',
2957
+ /**
2958
+ * Fired by {@link Dialog} plugin before hiding the dialog. This hook is fired when {@link Options#dialog}
2959
+ * option is enabled.
2960
+ *
2961
+ * @since 16.1.0
2962
+ * @event Hooks#beforeDialogHide
2963
+ */
2964
+ 'beforeDialogHide',
2965
+ /**
2966
+ * Fired by {@link Dialog} plugin before showing the dialog. This hook is fired when {@link Options#dialog}
2967
+ * option is enabled.
2968
+ *
2969
+ * @since 16.1.0
2970
+ * @event Hooks#beforeDialogShow
2971
+ */
2972
+ 'beforeDialogShow',
2973
+ /**
2974
+ * Fired by {@link Dialog} plugin before focusing the previous element. This hook is fired when {@link Options#dialog}
2975
+ * option is enabled.
2976
+ *
2977
+ * @since 16.1.0
2978
+ * @event Hooks#dialogFocusPreviousElement
2979
+ */
2980
+ 'dialogFocusPreviousElement',
2981
+ /**
2982
+ * Fired by {@link Dialog} plugin before focusing the next element. This hook is fired when {@link Options#dialog}
2983
+ * option is enabled.
2984
+ *
2985
+ * @since 16.1.0
2986
+ * @event Hooks#dialogFocusNextElement
2987
+ */
2988
+ 'dialogFocusNextElement',
2989
+ /**
2990
+ * Fired by {@link Dialog} plugin when the focus is set. This hook is fired when {@link Options#dialog}
2991
+ * option is enabled.
2992
+ *
2993
+ * @since 16.1.0
2994
+ * @event Hooks#afterDialogFocus
2995
+ * @param {'tab_from_above' | 'tab_from_below' | 'click' | 'show'} focusSource The source of the focus.
2996
+ */
2997
+ 'afterDialogFocus',
2940
2998
  /**
2941
2999
  * Fired after the editor is opened and rendered.
2942
3000
  *
@@ -1764,6 +1764,7 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
1764
1764
  * @param {'from_above' | 'from_below'} tabActivationDir The browsers Tab navigation direction. Depending on
1765
1765
  * whether the user activated the table from the element above or below, another cell can be selected.
1766
1766
  * @param {CellCoords} visualCoords The coords that will be used to select a cell.
1767
+ * @returns {undefined|boolean} If `false` is returned, the table will not be focused.
1767
1768
  */
1768
1769
  'modifyFocusOnTabNavigation',
1769
1770
  /**
@@ -2934,6 +2935,63 @@ export const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-com
2934
2935
  * Returning `true` removes those restrictions.
2935
2936
  */
2936
2937
  'beforeBeginEditing',
2938
+ /**
2939
+ * Fired by {@link Dialog} plugin after hiding the dialog. This hook is fired when {@link Options#dialog}
2940
+ * option is enabled.
2941
+ *
2942
+ * @since 16.1.0
2943
+ * @event Hooks#afterDialogHide
2944
+ */
2945
+ 'afterDialogHide',
2946
+ /**
2947
+ * Fired by {@link Dialog} plugin after showing the dialog. This hook is fired when {@link Options#dialog}
2948
+ * option is enabled.
2949
+ *
2950
+ * @since 16.1.0
2951
+ * @event Hooks#afterDialogShow
2952
+ */
2953
+ 'afterDialogShow',
2954
+ /**
2955
+ * Fired by {@link Dialog} plugin before hiding the dialog. This hook is fired when {@link Options#dialog}
2956
+ * option is enabled.
2957
+ *
2958
+ * @since 16.1.0
2959
+ * @event Hooks#beforeDialogHide
2960
+ */
2961
+ 'beforeDialogHide',
2962
+ /**
2963
+ * Fired by {@link Dialog} plugin before showing the dialog. This hook is fired when {@link Options#dialog}
2964
+ * option is enabled.
2965
+ *
2966
+ * @since 16.1.0
2967
+ * @event Hooks#beforeDialogShow
2968
+ */
2969
+ 'beforeDialogShow',
2970
+ /**
2971
+ * Fired by {@link Dialog} plugin before focusing the previous element. This hook is fired when {@link Options#dialog}
2972
+ * option is enabled.
2973
+ *
2974
+ * @since 16.1.0
2975
+ * @event Hooks#dialogFocusPreviousElement
2976
+ */
2977
+ 'dialogFocusPreviousElement',
2978
+ /**
2979
+ * Fired by {@link Dialog} plugin before focusing the next element. This hook is fired when {@link Options#dialog}
2980
+ * option is enabled.
2981
+ *
2982
+ * @since 16.1.0
2983
+ * @event Hooks#dialogFocusNextElement
2984
+ */
2985
+ 'dialogFocusNextElement',
2986
+ /**
2987
+ * Fired by {@link Dialog} plugin when the focus is set. This hook is fired when {@link Options#dialog}
2988
+ * option is enabled.
2989
+ *
2990
+ * @since 16.1.0
2991
+ * @event Hooks#afterDialogFocus
2992
+ * @param {'tab_from_above' | 'tab_from_below' | 'click' | 'show'} focusSource The source of the focus.
2993
+ */
2994
+ 'afterDialogFocus',
2937
2995
  /**
2938
2996
  * Fired after the editor is opened and rendered.
2939
2997
  *
@@ -68,6 +68,9 @@ export interface Events {
68
68
  afterContextMenuHide?: (context: ContextMenu) => void;
69
69
  afterContextMenuShow?: (context: ContextMenu) => void;
70
70
  afterCopy?: (data: CellValue[][], coords: RangeType[], copiedHeadersCount: { columnHeadersCount: number }) => void;
71
+ afterDialogFocus?: (focusSource: 'tab_from_above' | 'tab_from_below' | 'click' | 'show') => void;
72
+ afterDialogHide?: () => void;
73
+ afterDialogShow?: () => void;
71
74
  afterCopyLimit?: (selectedRows: number, selectedColumns: number, copyRowsLimit: number, copyColumnsLimit: number) => void;
72
75
  afterCreateCol?: (index: number, amount: number, source?: ChangeSource) => void;
73
76
  afterCreateRow?: (index: number, amount: number, source?: ChangeSource) => void;
@@ -178,6 +181,8 @@ export interface Events {
178
181
  beforeContextMenuShow?: (context: ContextMenu) => void;
179
182
  beforeCopy?: (data: CellValue[][], coords: RangeType[], copiedHeadersCount: { columnHeadersCount: number }) => void | boolean;
180
183
  beforeCreateCol?: (index: number, amount: number, source?: ChangeSource) => void | boolean;
184
+ beforeDialogHide?: () => void;
185
+ beforeDialogShow?: () => void;
181
186
  beforeCreateRow?: (index: number, amount: number, source?: ChangeSource) => void | boolean;
182
187
  beforeCut?: (data: CellValue[][], coords: RangeType[]) => void | boolean;
183
188
  beforeDetachChild?: (parent: RowObject, element: RowObject) => void;
@@ -244,6 +249,8 @@ export interface Events {
244
249
  beforeViewRender?: (isForced: boolean, skipRender: { skipRender?: boolean }) => void;
245
250
  beforeWidthChange?: (width: number | string) => number | string;
246
251
  construct?: () => void;
252
+ dialogFocusNextElement?: () => void;
253
+ dialogFocusPreviousElement?: () => void;
247
254
  init?: () => void;
248
255
  modifyAutoColumnSizeSeed?: (seed: string, cellProperties: CellProperties, cellValue: CellValue) => string | void;
249
256
  modifyAutofillRange?: (startArea: Array<[number, number, number, number]>, entireArea: Array<[number, number, number, number]>) => void;
package/core.d.ts CHANGED
@@ -73,7 +73,6 @@ export default class Core {
73
73
  getColWidth(column: number, source?: string): number;
74
74
  getCoords(element: Element | null): CellCoords;
75
75
  getCopyableData(row: number, column: number): string;
76
- getCopyableSourceData(row: number, column: number): string;
77
76
  getCopyableText(startRow: number, startColumn: number, endRow: number, endColumn: number): string;
78
77
  getCurrentThemeName(): string | undefined;
79
78
  getData(row?: number, column?: number, row2?: number, column2?: number): CellValue[];