handsontable 14.3.0-next-dda3c4b-20240415 → 14.4.0-next-f62dd73-20240521

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  3. package/3rdparty/walkontable/src/core/_base.js +1 -1
  4. package/3rdparty/walkontable/src/core/_base.mjs +1 -1
  5. package/3rdparty/walkontable/src/overlay/_base.js +24 -20
  6. package/3rdparty/walkontable/src/overlay/_base.mjs +24 -20
  7. package/3rdparty/walkontable/src/overlay/bottom.js +3 -6
  8. package/3rdparty/walkontable/src/overlay/bottom.mjs +3 -6
  9. package/3rdparty/walkontable/src/overlay/inlineStart.js +22 -19
  10. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +22 -19
  11. package/3rdparty/walkontable/src/overlay/top.js +13 -12
  12. package/3rdparty/walkontable/src/overlay/top.mjs +13 -12
  13. package/3rdparty/walkontable/src/overlays.js +46 -24
  14. package/3rdparty/walkontable/src/overlays.mjs +46 -24
  15. package/3rdparty/walkontable/src/selection/manager.js +7 -0
  16. package/3rdparty/walkontable/src/selection/manager.mjs +7 -0
  17. package/3rdparty/walkontable/src/selection/scanner.js +7 -0
  18. package/3rdparty/walkontable/src/selection/scanner.mjs +7 -0
  19. package/3rdparty/walkontable/src/table.js +10 -11
  20. package/3rdparty/walkontable/src/table.mjs +10 -11
  21. package/3rdparty/walkontable/src/utils/columnStretching.js +4 -0
  22. package/3rdparty/walkontable/src/utils/columnStretching.mjs +4 -0
  23. package/3rdparty/walkontable/src/viewport.js +18 -10
  24. package/3rdparty/walkontable/src/viewport.mjs +18 -10
  25. package/CHANGELOG.md +56 -12
  26. package/base.js +2 -2
  27. package/base.mjs +2 -2
  28. package/core.d.ts +2 -2
  29. package/core.js +93 -162
  30. package/core.mjs +93 -162
  31. package/dataMap/dataMap.js +10 -4
  32. package/dataMap/dataMap.mjs +10 -4
  33. package/dataMap/dataSource.js +16 -3
  34. package/dataMap/dataSource.mjs +16 -3
  35. package/dataMap/metaManager/lazyFactoryMap.js +7 -0
  36. package/dataMap/metaManager/lazyFactoryMap.mjs +7 -0
  37. package/dataMap/metaManager/metaSchema.js +38 -0
  38. package/dataMap/metaManager/metaSchema.mjs +38 -0
  39. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -0
  40. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -0
  41. package/dataMap/metaManager/mods/extendMetaProperties.js +44 -31
  42. package/dataMap/metaManager/mods/extendMetaProperties.mjs +44 -31
  43. package/dataMap/metaManager/utils.js +7 -0
  44. package/dataMap/metaManager/utils.mjs +7 -0
  45. package/dist/handsontable.css +4 -5
  46. package/dist/handsontable.full.css +4 -5
  47. package/dist/handsontable.full.js +5878 -4657
  48. package/dist/handsontable.full.min.css +4 -4
  49. package/dist/handsontable.full.min.js +59 -59
  50. package/dist/handsontable.js +5383 -4277
  51. package/dist/handsontable.min.css +4 -4
  52. package/dist/handsontable.min.js +20 -20
  53. package/editorManager.js +0 -67
  54. package/editorManager.mjs +0 -67
  55. package/editors/autocompleteEditor/autocompleteEditor.js +6 -4
  56. package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -4
  57. package/editors/baseEditor/baseEditor.js +1 -36
  58. package/editors/baseEditor/baseEditor.mjs +2 -37
  59. package/editors/dateEditor/dateEditor.js +4 -1
  60. package/editors/dateEditor/dateEditor.mjs +4 -1
  61. package/editors/dropdownEditor/dropdownEditor.js +8 -5
  62. package/editors/dropdownEditor/dropdownEditor.mjs +8 -5
  63. package/editors/handsontableEditor/handsontableEditor.js +2 -2
  64. package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
  65. package/editors/selectEditor/selectEditor.js +1 -9
  66. package/editors/selectEditor/selectEditor.mjs +1 -9
  67. package/editors/textEditor/textEditor.js +2 -11
  68. package/editors/textEditor/textEditor.mjs +2 -11
  69. package/focusManager.js +3 -5
  70. package/focusManager.mjs +3 -5
  71. package/helpers/array.js +7 -0
  72. package/helpers/array.mjs +7 -0
  73. package/helpers/mixed.js +2 -2
  74. package/helpers/mixed.mjs +2 -2
  75. package/helpers/number.js +12 -2
  76. package/helpers/number.mjs +12 -2
  77. package/package.json +3 -3
  78. package/pluginHooks.d.ts +1 -1
  79. package/pluginHooks.js +79 -2
  80. package/pluginHooks.mjs +79 -2
  81. package/plugins/autoColumnSize/autoColumnSize.js +7 -0
  82. package/plugins/autoColumnSize/autoColumnSize.mjs +7 -0
  83. package/plugins/autoRowSize/autoRowSize.js +2 -2
  84. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  85. package/plugins/autofill/autofill.js +1 -1
  86. package/plugins/autofill/autofill.mjs +1 -1
  87. package/plugins/base/base.d.ts +1 -1
  88. package/plugins/base/base.js +6 -2
  89. package/plugins/base/base.mjs +6 -2
  90. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
  91. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
  92. package/plugins/columnSorting/sortFunction/date.js +2 -46
  93. package/plugins/columnSorting/sortFunction/date.mjs +2 -45
  94. package/plugins/columnSorting/sortFunction/time.js +17 -0
  95. package/plugins/columnSorting/sortFunction/time.mjs +13 -0
  96. package/plugins/columnSorting/sortService/registry.js +4 -2
  97. package/plugins/columnSorting/sortService/registry.mjs +3 -1
  98. package/plugins/columnSorting/utils.js +64 -0
  99. package/plugins/columnSorting/utils.mjs +62 -0
  100. package/plugins/columnSummary/columnSummary.js +27 -10
  101. package/plugins/columnSummary/columnSummary.mjs +27 -10
  102. package/plugins/columnSummary/endpoints.js +15 -0
  103. package/plugins/columnSummary/endpoints.mjs +15 -0
  104. package/plugins/comments/comments.js +2 -8
  105. package/plugins/comments/comments.mjs +2 -8
  106. package/plugins/comments/contextMenuItem/addEditComment.js +0 -1
  107. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -1
  108. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  109. package/plugins/copyPaste/copyPaste.js +9 -2
  110. package/plugins/copyPaste/copyPaste.mjs +9 -2
  111. package/plugins/copyPaste/pasteEvent.js +1 -0
  112. package/plugins/copyPaste/pasteEvent.mjs +1 -0
  113. package/plugins/filters/filters.js +1 -1
  114. package/plugins/filters/filters.mjs +1 -1
  115. package/plugins/filters/ui/multipleSelect.js +22 -14
  116. package/plugins/filters/ui/multipleSelect.mjs +22 -14
  117. package/plugins/filters/utils.js +7 -0
  118. package/plugins/filters/utils.mjs +7 -0
  119. package/plugins/formulas/formulas.d.ts +10 -0
  120. package/plugins/formulas/formulas.js +11 -2
  121. package/plugins/formulas/formulas.mjs +11 -2
  122. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
  123. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
  124. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
  125. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
  126. package/plugins/hiddenColumns/hiddenColumns.js +8 -1
  127. package/plugins/hiddenColumns/hiddenColumns.mjs +8 -1
  128. package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
  129. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
  130. package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
  131. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
  132. package/plugins/hiddenRows/hiddenRows.js +7 -0
  133. package/plugins/hiddenRows/hiddenRows.mjs +7 -0
  134. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  135. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  136. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  137. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  138. package/plugins/manualColumnMove/manualColumnMove.js +1 -1
  139. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
  140. package/plugins/manualColumnResize/manualColumnResize.js +3 -3
  141. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
  142. package/plugins/manualRowMove/manualRowMove.js +1 -1
  143. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  144. package/plugins/manualRowResize/manualRowResize.d.ts +1 -0
  145. package/plugins/manualRowResize/manualRowResize.js +11 -2
  146. package/plugins/manualRowResize/manualRowResize.mjs +11 -2
  147. package/plugins/mergeCells/cellsCollection.js +7 -0
  148. package/plugins/mergeCells/cellsCollection.mjs +7 -0
  149. package/plugins/mergeCells/mergeCells.js +7 -0
  150. package/plugins/mergeCells/mergeCells.mjs +7 -0
  151. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +7 -0
  152. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +7 -0
  153. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +7 -0
  154. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +7 -0
  155. package/plugins/nestedRows/nestedRows.js +7 -0
  156. package/plugins/nestedRows/nestedRows.mjs +7 -0
  157. package/plugins/trimRows/trimRows.js +7 -0
  158. package/plugins/trimRows/trimRows.mjs +7 -0
  159. package/selection/selection.js +163 -4
  160. package/selection/selection.mjs +163 -4
  161. package/selection/utils.js +7 -0
  162. package/selection/utils.mjs +7 -0
  163. package/settings.d.ts +1 -0
  164. package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
  165. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
  166. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
  167. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
  168. package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
  169. package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
  170. package/shortcutContexts/commands/editor/index.js +3 -1
  171. package/shortcutContexts/commands/editor/index.mjs +3 -1
  172. package/shortcutContexts/editor.js +9 -1
  173. package/shortcutContexts/editor.mjs +9 -1
  174. package/shortcutContexts/index.js +1 -1
  175. package/shortcutContexts/index.mjs +1 -1
  176. package/shortcuts/keyObserver.js +7 -0
  177. package/shortcuts/keyObserver.mjs +7 -0
  178. package/shortcuts/utils.js +7 -0
  179. package/shortcuts/utils.mjs +7 -0
  180. package/tableView.js +1 -4
  181. package/tableView.mjs +1 -4
  182. package/translations/changesObservable/observable.js +7 -0
  183. package/translations/changesObservable/observable.mjs +7 -0
  184. package/translations/indexMapper.js +7 -0
  185. package/translations/indexMapper.mjs +8 -1
  186. package/utils/dataStructures/uniqueSet.js +7 -0
  187. package/utils/dataStructures/uniqueSet.mjs +7 -0
  188. package/utils/ghostTable.js +0 -4
  189. package/utils/ghostTable.mjs +0 -4
  190. package/utils/paginator.js +7 -0
  191. package/utils/paginator.mjs +7 -0
  192. package/validators/dateValidator/dateValidator.js +1 -3
  193. package/validators/dateValidator/dateValidator.mjs +1 -3
  194. package/validators/timeValidator/timeValidator.js +1 -3
  195. package/validators/timeValidator/timeValidator.mjs +1 -3
package/CHANGELOG.md CHANGED
@@ -9,25 +9,69 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
10
  <!-- UNVERSIONED -->
11
11
 
12
+ ## [14.4.0] - 2024-05-28
13
+
14
+ ### Added
15
+ - Improved UX for column filtering [#10454](https://github.com/handsontable/handsontable/issues/10454)
16
+ - Extended the `manualRowResize` plugin with a method that retrieves the row height value from the last attempt at manually changing said row height. [#10941](https://github.com/handsontable/handsontable/pull/10941)
17
+ - Added an option to place the hook callbacks in a different order. [#10970](https://github.com/handsontable/handsontable/pull/10970)
18
+ - Add new `dataDotNotation` option which, when set as `false` allows using object keys with dots. [#10973](https://github.com/handsontable/handsontable/pull/10973)
19
+
20
+ ### Changed
21
+ - Improved editor's behavior after dataset altering [#10963](https://github.com/handsontable/handsontable/pull/10963)
22
+ - React: Synchronized the `rollup` version between the wrappers and updated the `rollup` plugin dependencies. [#10962](https://github.com/handsontable/handsontable/pull/10962)
23
+
24
+ ### Fixed
25
+ - Fixed unwanted table re-rerender for oversized rows/columns. [#10912](https://github.com/handsontable/handsontable/pull/10912)
26
+ - Fixed `Ctrl/Cmd` + `Enter` keyboard shortcut for comments [#10920](https://github.com/handsontable/handsontable/pull/10920)
27
+ - Fixed rows and columns unfreeze issue when headers are disabled [#10926](https://github.com/handsontable/handsontable/pull/10926)
28
+ - Fixed `imeFastEdit` option being reset after `updateSettings` call [#10933](https://github.com/handsontable/handsontable/pull/10933)
29
+ - Added horizontal scroll to the Filter's "by value" component [#10940](https://github.com/handsontable/handsontable/pull/10940)
30
+ - Improved fast typing values between editors [#10947](https://github.com/handsontable/handsontable/pull/10947)
31
+ - Removed double borders for column headers [#10948](https://github.com/handsontable/handsontable/pull/10948)
32
+ - Fixed column widths calculations when `stretchH: 'all'` option was used. [#10954](https://github.com/handsontable/handsontable/pull/10954)
33
+ - Fixed columns summary cell meta missing state after calling the `updateSettings` method. [#10955](https://github.com/handsontable/handsontable/pull/10955)
34
+ - Fixed sorting of the time of the `time` column types [#10956](https://github.com/handsontable/handsontable/pull/10956)
35
+ - Fixed data populate error when `correctFormat` was used [#10957](https://github.com/handsontable/handsontable/pull/10957)
36
+ - Fixed cell meta coordinates overwrite by _GhostTable_ [#10961](https://github.com/handsontable/handsontable/pull/10961)
37
+ - Fixed a problem where `setDataAtRowProp` threw an error when trying to save data into a trimmed-out column. [#10964](https://github.com/handsontable/handsontable/pull/10964)
38
+ - Fixed a problem where the table scrolled all the way right after inserting a new row over a table-wide selection. [#10965](https://github.com/handsontable/handsontable/pull/10965)
39
+ - Fixed a bug that prevents copy/cut/paste from outside elements [#10976](https://github.com/handsontable/handsontable/pull/10976)
40
+ - Fixed a problem where the autocomplete dropdown was not displayed with the right dimensions after previously filtering out all the choices. [#10977](https://github.com/handsontable/handsontable/pull/10977)
41
+ - Fixed a bug related to not clearing the dataset correctly for formulas [#10983](https://github.com/handsontable/handsontable/pull/10983)
42
+ - Improved typings for the ContextMenu plugin. [#10984](https://github.com/handsontable/handsontable/pull/10984)
43
+ - Added missing type for `namedExpressions` [#10986](https://github.com/handsontable/handsontable/pull/10986)
44
+ - Fixed double borders for row/column headers [#10988](https://github.com/handsontable/handsontable/pull/10988)
45
+ - Fixed a problem, where trying to render a hidden instance made it render all of its rows by disabling the rendering for hidden instances. [#10989](https://github.com/handsontable/handsontable/pull/10989)
46
+ - Fixed an error in numeric cell types that occur after entering non-numeric values. [#10931](https://github.com/handsontable/handsontable/pull/10931)
47
+ - React: Prevented the react wrapper from throwing errors on updating component props when the component had any init-only settings pre-declared. [#10921](https://github.com/handsontable/handsontable/pull/10921)
48
+
12
49
  ## [14.3.0] - 2024-04-16
13
50
 
14
51
  ### Added
15
- - Added new feature which is navigation and edit cells within a range [#10732](https://github.com/handsontable/handsontable/pull/10732)
52
+ - Added new feature, Navigation within selection and edit cells within a range [#10732](https://github.com/handsontable/handsontable/pull/10732)
16
53
 
17
54
  ### Changed
18
- - Stopped using `dtslint` in favor of `@typescript-eslint/eslint-plugin`. [#10841](https://github.com/handsontable/handsontable/pull/10841)
19
- - Made the cursor turn to `grabbing` for all the elements in the table while moving the columns or rows. [#10852](https://github.com/handsontable/handsontable/pull/10852)
55
+ - Updated dependencies based on npm audit, most notably we upgraded to angular 17.0 [#10889](https://github.com/handsontable/handsontable/pull/10889)
20
56
 
21
57
  ### Fixed
22
- - Fixed a problem, where `TAB` would not move the selection when the select-typed cell was being edited in the "fast edit" mode. [#10849](https://github.com/handsontable/handsontable/pull/10849)
23
- - Blocked the `Cmd/Ctrl + A` action for situations where the focus is placed on the headers. [#10853](https://github.com/handsontable/handsontable/pull/10853)
24
- - Unified the `source` arguments of the `beforeChange`/`afterChange` hooks when being triggered by the Merge Cells plugin. [#10857](https://github.com/handsontable/handsontable/pull/10857)
25
- - Maintain focus after column collapsing. [#10865](https://github.com/handsontable/handsontable/pull/10865)
26
- - Fixed a problem where the bottom/right cell borders were not visible in the viewport after scrolling from the absolute top/left positions of the table using the API. [#10887](https://github.com/handsontable/handsontable/pull/10887)
27
- - Fixed Dropdown plugin logic that in some cases could block click events coming from custom editors. [#10888](https://github.com/handsontable/handsontable/pull/10888)
28
- - Fixed datepicker position of the date cell type. [#10892](https://github.com/handsontable/handsontable/pull/10892)
29
- - Vue: Fixed a problem where updating the hook callback in the Vue and Vue3 wrappers did not update the underlying instance's settings. [#10686](https://github.com/handsontable/handsontable/issues/10686)
30
- - Vue: Fixed a problem where the Vue/Vue3 wrappers' `simpleEqual` helper return incorrect result when comparing identical objects. [#10896](https://github.com/handsontable/handsontable/pull/10896)
58
+
59
+ - Ensured the cursor changes to 'grabbing' for all table elements during column or row movement[#10852](https://github.com/handsontable/handsontable/pull/10852)
60
+ - Resolved an issue where the `TAB` key failed to move selection when editing select-type cells in 'fast edit' mode. [#10849](https://github.com/handsontable/handsontable/pull/10849)
61
+ - Prevent the `Cmd/Ctrl + A` action when the focus is on headers. [#10853](https://github.com/handsontable/handsontable/pull/10853)
62
+ - Unified `source` arguments in `beforeChange` and `afterChange` hooks triggered by the Merge Cells plugin. [#10857](https://github.com/handsontable/handsontable/pull/10857)
63
+ - Ensured focus retention after column collapsing. [#10865](https://github.com/handsontable/handsontable/pull/10865)
64
+ - Fixed visibility issue with bottom/right cell borders after scrolling from the absolute top/left positions using the api. [#10887](https://github.com/handsontable/handsontable/pull/10887)
65
+ - Fixed Dropdown plugin logic to prevent blocking click events from custom editors. [#10888](https://github.com/handsontable/handsontable/pull/10888)
66
+ - Fixed datepicker position for the date cell type. [#10892](https://github.com/handsontable/handsontable/pull/10892)
67
+ - Vue: Fixed an issue in the Vue and Vue3 wrappers where updating the hook callback didn't reflect changes in the underlying instance's settings. [#10686](https://github.com/handsontable/handsontable/issues/10686)
68
+ - Vue: Fixed the behavior of the Vue/Vue3 wrappers' `simpleEqual` helper, which previously returned incorrect results when comparing identical objects. [#10896](https://github.com/handsontable/handsontable/pull/10896)
69
+
70
+ For more information on Handsontable 14.3.0, see:
71
+
72
+ - [Blog post (14.3.0)](https://handsontable.com/blog/handsontable-14.3.0-enhanced-navigation-and-bug-fixes)
73
+ - [Documentation (14.3)](https://handsontable.com/docs/14.3)
74
+ - [Release notes (14.3.0)](https://handsontable.com/docs/release-notes/#_14-3-0)
31
75
 
32
76
  ## [14.2.0] - 2024-03-06
33
77
 
package/base.js CHANGED
@@ -45,8 +45,8 @@ Handsontable.hooks = _pluginHooks.default.getSingleton();
45
45
  Handsontable.CellCoords = _src.CellCoords;
46
46
  Handsontable.CellRange = _src.CellRange;
47
47
  Handsontable.packageName = 'handsontable';
48
- Handsontable.buildDate = "15/04/2024 20:43:14";
49
- Handsontable.version = "14.3.0-next-dda3c4b-20240415";
48
+ Handsontable.buildDate = "21/05/2024 10:09:58";
49
+ Handsontable.version = "14.4.0-next-f62dd73-20240521";
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 = "15/04/2024 20:43:20";
39
- Handsontable.version = "14.3.0-next-dda3c4b-20240415";
38
+ Handsontable.buildDate = "21/05/2024 10:10:04";
39
+ Handsontable.version = "14.4.0-next-f62dd73-20240521";
40
40
  Handsontable.languages = {
41
41
  dictionaryKeys,
42
42
  getLanguageDictionary,
package/core.d.ts CHANGED
@@ -25,8 +25,8 @@ type AlterActions = 'insert_row_above' | 'insert_row_below' |
25
25
  'remove_row' | 'remove_col';
26
26
 
27
27
  export default class Core {
28
- addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>): void;
29
- addHookOnce<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>): void;
28
+ addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
29
+ addHookOnce<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
30
30
  alter(action: AlterActions, index?: number | Array<[number, number]>, amount?: number, source?: string, keepEmptyRows?: boolean): void;
31
31
  batch<R>(wrappedOperations: () => R): R;
32
32
  batchExecution<R>(wrappedOperations: () => R, forceFlushChanges: boolean): R;
package/core.js CHANGED
@@ -4,6 +4,13 @@ exports.__esModule = true;
4
4
  exports.default = Core;
5
5
  require("core-js/modules/es.error.cause.js");
6
6
  require("core-js/modules/es.array.push.js");
7
+ require("core-js/modules/esnext.set.difference.v2.js");
8
+ require("core-js/modules/esnext.set.intersection.v2.js");
9
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
10
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
11
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
12
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
13
+ require("core-js/modules/esnext.set.union.v2.js");
7
14
  require("core-js/modules/web.immediate.js");
8
15
  var _element = require("./helpers/dom/element");
9
16
  var _function = require("./helpers/function");
@@ -330,7 +337,7 @@ function Core(rootElement, userSettings) {
330
337
  hiddenIndexesChanged
331
338
  } = _ref;
332
339
  if (hiddenIndexesChanged) {
333
- this.selection.refresh();
340
+ this.selection.commit();
334
341
  }
335
342
  };
336
343
  this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
@@ -365,7 +372,11 @@ function Core(rootElement, userSettings) {
365
372
  } else {
366
373
  (0, _element.removeClass)(this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
367
374
  }
368
- this._refreshBorders(null);
375
+ if (selection.getSelectionSource() !== 'shift') {
376
+ editorManager.closeEditor(null);
377
+ }
378
+ instance.view.render();
379
+ editorManager.prepareEditor();
369
380
  });
370
381
  this.selection.addLocalHook('beforeSetFocus', cellCoords => {
371
382
  this.runHooks('beforeSelectionFocusSet', cellCoords.row, cellCoords.col);
@@ -376,7 +387,9 @@ function Core(rootElement, userSettings) {
376
387
  if (!preventScrolling.isTouched() || preventScrolling.isTouched() && !preventScrolling.value) {
377
388
  viewportScroller.scrollTo(cellCoords);
378
389
  }
379
- this._refreshBorders(null);
390
+ editorManager.closeEditor();
391
+ instance.view.render();
392
+ editorManager.prepareEditor();
380
393
  });
381
394
  this.selection.addLocalHook('afterSelectionFinished', cellRanges => {
382
395
  const selectionLayerLevel = cellRanges.length - 1;
@@ -394,8 +407,8 @@ function Core(rootElement, userSettings) {
394
407
  }
395
408
  });
396
409
  this.selection.addLocalHook('afterDeselect', () => {
397
- editorManager.destroyEditor();
398
- this._refreshBorders();
410
+ editorManager.closeEditor();
411
+ instance.view.render();
399
412
  (0, _element.removeClass)(this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
400
413
  this.runHooks('afterDeselect');
401
414
  });
@@ -550,39 +563,7 @@ function Core(rootElement, userSettings) {
550
563
  source,
551
564
  mode: insertRowMode
552
565
  });
553
- if (rowDelta) {
554
- const currentSelectedRange = selection.selectedRange.current();
555
- const currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
556
- const currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
557
- const startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
558
- if (selection.isSelectedByCorner()) {
559
- selection.selectAll(true, true, {
560
- disableHeadersHighlight: true
561
- });
562
- } else if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= startVisualRowIndex) {
563
- // Moving the selection (if it exists) downward – it should be applied to the "old" row.
564
- // TODO: The logic here should be handled by selection module.
565
- const {
566
- row: currentToRow,
567
- col: currentToColumn
568
- } = currentSelectedRange.to;
569
- let currentFromColumn = currentFromRange.col;
570
-
571
- // Workaround: headers are not stored inside selection.
572
- if (selection.isSelectedByRowHeader()) {
573
- currentFromColumn = -1;
574
- }
575
-
576
- // Remove from the stack the last added selection as that selection below will be
577
- // replaced by new transformed selection.
578
- selection.getSelectedRange().pop();
579
- // I can't use transforms as they don't work in negative indexes.
580
- selection.setRangeStartOnly(instance._createCellCoords(currentFromRow + rowDelta, currentFromColumn), true);
581
- selection.setRangeEnd(instance._createCellCoords(currentToRow + rowDelta, currentToColumn)); // will call render() internally
582
- } else {
583
- instance._refreshBorders(); // it will call render and prepare methods
584
- }
585
- }
566
+ selection.shiftRows(instance.toVisualRow(startRowPhysicalIndex), rowDelta);
586
567
  break;
587
568
  case 'insert_col_start':
588
569
  case 'insert_col_end':
@@ -605,38 +586,7 @@ function Core(rootElement, userSettings) {
605
586
  spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
606
587
  Array.prototype.splice.apply(tableMeta.colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array
607
588
  }
608
- const currentSelectedRange = selection.selectedRange.current();
609
- const currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
610
- const currentFromColumn = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.col;
611
- const startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
612
- if (selection.isSelectedByCorner()) {
613
- selection.selectAll(true, true, {
614
- disableHeadersHighlight: true
615
- });
616
- } else if ((0, _mixed.isDefined)(currentFromColumn) && currentFromColumn >= startVisualColumnIndex) {
617
- // Moving the selection (if it exists) rightward – it should be applied to the "old" column.
618
- // TODO: The logic here should be handled by selection module.
619
- const {
620
- row: currentToRow,
621
- col: currentToColumn
622
- } = currentSelectedRange.to;
623
- let currentFromRow = currentFromRange.row;
624
-
625
- // Workaround: headers are not stored inside selection.
626
- if (selection.isSelectedByColumnHeader()) {
627
- currentFromRow = -1;
628
- }
629
-
630
- // Remove from the stack the last added selection as that selection below will be
631
- // replaced by new transformed selection.
632
- selection.getSelectedRange().pop();
633
-
634
- // I can't use transforms as they don't work in negative indexes.
635
- selection.setRangeStartOnly(instance._createCellCoords(currentFromRow, currentFromColumn + colDelta), true);
636
- selection.setRangeEnd(instance._createCellCoords(currentToRow, currentToColumn + colDelta)); // will call render() internally
637
- } else {
638
- instance._refreshBorders(); // it will call render and prepare methods
639
- }
589
+ selection.shiftColumns(instance.toVisualColumn(startColumnPhysicalIndex), colDelta);
640
590
  }
641
591
  break;
642
592
  case 'remove_row':
@@ -661,7 +611,22 @@ function Core(rootElement, userSettings) {
661
611
  if (!wasRemoved) {
662
612
  return;
663
613
  }
614
+ if (selection.isSelected()) {
615
+ const {
616
+ row
617
+ } = instance.getSelectedRangeLast().highlight;
618
+ if (row >= groupIndex && row <= groupIndex + groupAmount - 1) {
619
+ editorManager.closeEditor(true);
620
+ }
621
+ }
664
622
  const totalRows = instance.countRows();
623
+ if (totalRows === 0) {
624
+ selection.deselect();
625
+ } else if (source === 'ContextMenu.removeRow') {
626
+ selection.refresh();
627
+ } else {
628
+ selection.shiftRows(groupIndex, -groupAmount);
629
+ }
665
630
  const fixedRowsTop = tableMeta.fixedRowsTop;
666
631
  if (fixedRowsTop >= calcIndex + 1) {
667
632
  tableMeta.fixedRowsTop -= Math.min(groupAmount, fixedRowsTop - calcIndex);
@@ -678,8 +643,6 @@ function Core(rootElement, userSettings) {
678
643
  } else {
679
644
  removeRow([[index, amount]]);
680
645
  }
681
- grid.adjustRowsAndCols();
682
- instance._refreshBorders(); // it will call render and prepare methods
683
646
  break;
684
647
  case 'remove_col':
685
648
  const removeCol = indexes => {
@@ -704,6 +667,22 @@ function Core(rootElement, userSettings) {
704
667
  if (!wasRemoved) {
705
668
  return;
706
669
  }
670
+ if (selection.isSelected()) {
671
+ const {
672
+ col
673
+ } = instance.getSelectedRangeLast().highlight;
674
+ if (col >= groupIndex && col <= groupIndex + groupAmount - 1) {
675
+ editorManager.closeEditor(true);
676
+ }
677
+ }
678
+ const totalColumns = instance.countCols();
679
+ if (totalColumns === 0) {
680
+ selection.deselect();
681
+ } else if (source === 'ContextMenu.removeColumn') {
682
+ selection.refresh();
683
+ } else {
684
+ selection.shiftColumns(groupIndex, -groupAmount);
685
+ }
707
686
  const fixedColumnsStart = tableMeta.fixedColumnsStart;
708
687
  if (fixedColumnsStart >= calcIndex + 1) {
709
688
  tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
@@ -722,13 +701,11 @@ function Core(rootElement, userSettings) {
722
701
  } else {
723
702
  removeCol([[index, amount]]);
724
703
  }
725
- grid.adjustRowsAndCols();
726
- instance._refreshBorders(); // it will call render and prepare methods
727
-
728
704
  break;
729
705
  default:
730
706
  throw new Error(`There is no such action "${action}"`);
731
707
  }
708
+ instance.view.render();
732
709
  if (!keepEmptyRows) {
733
710
  grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh
734
711
  }
@@ -743,9 +720,6 @@ function Core(rootElement, userSettings) {
743
720
  const minSpareRows = tableMeta.minSpareRows;
744
721
  const minCols = tableMeta.minCols;
745
722
  const minSpareCols = tableMeta.minSpareCols;
746
- if (instance.countRows() === 0 && instance.countCols() === 0) {
747
- selection.deselect();
748
- }
749
723
  if (minRows) {
750
724
  // should I add empty rows to data source to meet minRows?
751
725
  const nrOfRows = instance.countRows();
@@ -804,55 +778,6 @@ function Core(rootElement, userSettings) {
804
778
  });
805
779
  }
806
780
  }
807
- if (selection.isSelected()) {
808
- const rowCount = instance.countRows();
809
- const colCount = instance.countCols();
810
- (0, _array.arrayEach)(selection.selectedRange, range => {
811
- let selectionChanged = false;
812
- let fromRow = range.from.row;
813
- let fromCol = range.from.col;
814
- let toRow = range.to.row;
815
- let toCol = range.to.col;
816
-
817
- // if selection is outside, move selection to last row
818
- if (fromRow > rowCount - 1) {
819
- fromRow = rowCount - 1;
820
- selectionChanged = true;
821
- if (toRow > fromRow) {
822
- toRow = fromRow;
823
- }
824
- } else if (toRow > rowCount - 1) {
825
- toRow = rowCount - 1;
826
- selectionChanged = true;
827
- if (fromRow > toRow) {
828
- fromRow = toRow;
829
- }
830
- }
831
- // if selection is outside, move selection to last row
832
- if (fromCol > colCount - 1) {
833
- fromCol = colCount - 1;
834
- selectionChanged = true;
835
- if (toCol > fromCol) {
836
- toCol = fromCol;
837
- }
838
- } else if (toCol > colCount - 1) {
839
- toCol = colCount - 1;
840
- selectionChanged = true;
841
- if (fromCol > toCol) {
842
- fromCol = toCol;
843
- }
844
- }
845
- if (selectionChanged) {
846
- if (fromCol < 0) {
847
- instance.selectRows(fromRow, toRow, fromCol);
848
- } else if (fromRow < 0) {
849
- instance.selectColumns(fromCol, toCol, fromRow);
850
- } else {
851
- instance.selectCell(fromRow, fromCol, toRow, toCol);
852
- }
853
- }
854
- });
855
- }
856
781
  if (instance.view) {
857
782
  instance.view.adjustElementsSize();
858
783
  }
@@ -1197,8 +1122,18 @@ function Core(rootElement, userSettings) {
1197
1122
  };
1198
1123
  for (let i = changes.length - 1; i >= 0; i--) {
1199
1124
  const [row, prop,, newValue] = changes[i];
1200
- const col = datamap.propToCol(prop);
1201
- const cellProperties = instance.getCellMeta(row, col);
1125
+ const visualCol = datamap.propToCol(prop);
1126
+ let cellProperties;
1127
+ if (Number.isInteger(visualCol)) {
1128
+ cellProperties = instance.getCellMeta(row, visualCol);
1129
+ } else {
1130
+ // If there's no requested visual column, we can use the table meta as the cell properties when retrieving
1131
+ // the cell validator.
1132
+ cellProperties = {
1133
+ ...Object.getPrototypeOf(tableMeta),
1134
+ ...tableMeta
1135
+ };
1136
+ }
1202
1137
  if (cellProperties.type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
1203
1138
  changes[i][3] = getParsedNumber(newValue);
1204
1139
  }
@@ -1289,9 +1224,9 @@ function Core(rootElement, userSettings) {
1289
1224
  instance.forceFullRender = true; // used when data was changed
1290
1225
  grid.adjustRowsAndCols();
1291
1226
  instance.runHooks('beforeChangeRender', changes, source);
1292
- editorManager.lockEditor();
1293
- instance._refreshBorders(null);
1294
- editorManager.unlockEditor();
1227
+ editorManager.closeEditor();
1228
+ instance.view.render();
1229
+ editorManager.prepareEditor();
1295
1230
  instance.view.adjustElementsSize();
1296
1231
  instance.runHooks('afterChange', changes, source || 'edit');
1297
1232
  const activeEditor = instance.getActiveEditor();
@@ -1502,6 +1437,9 @@ function Core(rootElement, userSettings) {
1502
1437
  for (i = 0, ilen = input.length; i < ilen; i++) {
1503
1438
  changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1504
1439
  }
1440
+
1441
+ // TODO: I don't think `prop` should be used as `changeSource` here, but removing it would be a breaking change.
1442
+ // We should remove it with the next major release.
1505
1443
  if (!changeSource && typeof row === 'object') {
1506
1444
  changeSource = prop;
1507
1445
  }
@@ -1568,7 +1506,11 @@ function Core(rootElement, userSettings) {
1568
1506
  this.destroyEditor = function () {
1569
1507
  let revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1570
1508
  let prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1571
- instance._refreshBorders(revertOriginal, prepareEditorIfNeeded);
1509
+ editorManager.closeEditor(revertOriginal);
1510
+ instance.view.render();
1511
+ if (prepareEditorIfNeeded && selection.isSelected()) {
1512
+ editorManager.prepareEditor();
1513
+ }
1572
1514
  };
1573
1515
 
1574
1516
  /**
@@ -1831,7 +1773,7 @@ function Core(rootElement, userSettings) {
1831
1773
  if (this.renderCall) {
1832
1774
  this.render();
1833
1775
  } else {
1834
- this._refreshBorders(null);
1776
+ instance.view.render();
1835
1777
  }
1836
1778
  }
1837
1779
  };
@@ -1852,9 +1794,7 @@ function Core(rootElement, userSettings) {
1852
1794
  this.forceFullRender = true; // used when data was changed
1853
1795
 
1854
1796
  if (!this.isRenderSuspended()) {
1855
- editorManager.lockEditor();
1856
- this._refreshBorders(null);
1857
- editorManager.unlockEditor();
1797
+ instance.view.render();
1858
1798
  }
1859
1799
  }
1860
1800
  };
@@ -2121,6 +2061,7 @@ function Core(rootElement, userSettings) {
2121
2061
  instance.columnIndexMapper.fitToLength(this.getInitialColumnCount());
2122
2062
  instance.rowIndexMapper.fitToLength(this.countSourceRows());
2123
2063
  grid.adjustRowsAndCols();
2064
+ selection.refresh();
2124
2065
  }, {
2125
2066
  hotInstance: instance,
2126
2067
  dataMap: datamap,
@@ -2161,6 +2102,7 @@ function Core(rootElement, userSettings) {
2161
2102
  metaManager.clearCellsCache();
2162
2103
  instance.initIndexMappers();
2163
2104
  grid.adjustRowsAndCols();
2105
+ selection.refresh();
2164
2106
  if (firstRun) {
2165
2107
  firstRun = [null, 'loadData'];
2166
2108
  }
@@ -2448,10 +2390,8 @@ function Core(rootElement, userSettings) {
2448
2390
  grid.adjustRowsAndCols();
2449
2391
  if (instance.view && !firstRun) {
2450
2392
  instance.forceFullRender = true; // used when data was changed
2451
- editorManager.lockEditor();
2452
- instance._refreshBorders(null);
2393
+ instance.view.render();
2453
2394
  instance.view._wt.wtOverlays.adjustElementsSize();
2454
- editorManager.unlockEditor();
2455
2395
  }
2456
2396
  if (!init && instance.view && (currentHeight === '' || height === '' || height === undefined) && currentHeight !== height) {
2457
2397
  instance.view._wt.wtOverlays.updateMainScrollableElements();
@@ -2603,7 +2543,7 @@ function Core(rootElement, userSettings) {
2603
2543
  }
2604
2544
  renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(row);
2605
2545
  }
2606
- if (renderableRowIndex === null || renderableColumnIndex === null) {
2546
+ if (renderableRowIndex === null || renderableColumnIndex === null || renderableRowIndex === undefined || renderableColumnIndex === undefined) {
2607
2547
  return null;
2608
2548
  }
2609
2549
  return instance.view.getCellAtCoords(instance._createCellCoords(renderableRowIndex, renderableColumnIndex), topmost);
@@ -4349,13 +4289,17 @@ function Core(rootElement, userSettings) {
4349
4289
  * @see Hooks#add
4350
4290
  * @param {string} key Hook name (see {@link Hooks}).
4351
4291
  * @param {Function|Array} callback Function or array of functions.
4292
+ * @param {number} [orderIndex] Order index of the callback.
4293
+ * If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
4294
+ * If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
4295
+ * If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
4352
4296
  * @example
4353
4297
  * ```js
4354
4298
  * hot.addHook('beforeInit', myCallback);
4355
4299
  * ```
4356
4300
  */
4357
- this.addHook = function (key, callback) {
4358
- _pluginHooks.default.getSingleton().add(key, callback, instance);
4301
+ this.addHook = function (key, callback, orderIndex) {
4302
+ _pluginHooks.default.getSingleton().add(key, callback, instance, orderIndex);
4359
4303
  };
4360
4304
 
4361
4305
  /**
@@ -4386,13 +4330,17 @@ function Core(rootElement, userSettings) {
4386
4330
  * @see Hooks#once
4387
4331
  * @param {string} key Hook name (see {@link Hooks}).
4388
4332
  * @param {Function|Array} callback Function or array of functions.
4333
+ * @param {number} [orderIndex] Order index of the callback.
4334
+ * If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
4335
+ * If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
4336
+ * If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
4389
4337
  * @example
4390
4338
  * ```js
4391
4339
  * hot.addHookOnce('beforeInit', myCallback);
4392
4340
  * ```
4393
4341
  */
4394
- this.addHookOnce = function (key, callback) {
4395
- _pluginHooks.default.getSingleton().once(key, callback, instance);
4342
+ this.addHookOnce = function (key, callback, orderIndex) {
4343
+ _pluginHooks.default.getSingleton().once(key, callback, instance, orderIndex);
4396
4344
  };
4397
4345
 
4398
4346
  /**
@@ -4529,23 +4477,6 @@ function Core(rootElement, userSettings) {
4529
4477
  });
4530
4478
  };
4531
4479
 
4532
- /**
4533
- * Refresh selection borders. This is temporary method relic after selection rewrite.
4534
- *
4535
- * @private
4536
- * @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
4537
- * @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
4538
- */
4539
- this._refreshBorders = function () {
4540
- let revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4541
- let prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4542
- editorManager.destroyEditor(revertOriginal);
4543
- instance.view.render();
4544
- if (prepareEditorIfNeeded && selection.isSelected()) {
4545
- editorManager.prepareEditor();
4546
- }
4547
- };
4548
-
4549
4480
  /**
4550
4481
  * Gets the instance of the EditorManager.
4551
4482
  *