handsontable 14.3.0 → 14.4.0-next-0a79a1f-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 +37 -0
  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/editorManager.js CHANGED
@@ -6,7 +6,6 @@ var _unicode = require("./helpers/unicode");
6
6
  var _event = require("./helpers/dom/event");
7
7
  var _registry = require("./editors/registry");
8
8
  var _eventManager = _interopRequireDefault(require("./eventManager"));
9
- var _mixed = require("./helpers/mixed");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
12
11
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -14,7 +13,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
14
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
15
14
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
15
  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"); }
17
- const SHORTCUTS_GROUP_NAVIGATION = exports.SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
18
16
  var _EditorManager_brand = /*#__PURE__*/new WeakSet();
19
17
  class EditorManager {
20
18
  /**
@@ -64,13 +62,6 @@ class EditorManager {
64
62
  * @type {boolean}
65
63
  */
66
64
  _defineProperty(this, "destroyed", false);
67
- /**
68
- * Determines if EditorManager is locked.
69
- *
70
- * @private
71
- * @type {boolean}
72
- */
73
- _defineProperty(this, "lock", false);
74
65
  /**
75
66
  * A reference to an instance of the activeEditor.
76
67
  *
@@ -99,34 +90,6 @@ class EditorManager {
99
90
  this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
100
91
  }
101
92
 
102
- /**
103
- * Lock the editor from being prepared and closed. Locking the editor prevents its closing and
104
- * reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
105
- */
106
- lockEditor() {
107
- this.lock = true;
108
- }
109
-
110
- /**
111
- * Unlock the editor from being prepared and closed. This method restores the original behavior of
112
- * the editors where for every new selection its instances are closed.
113
- */
114
- unlockEditor() {
115
- this.lock = false;
116
- }
117
-
118
- /**
119
- * Destroy current editor, if exists.
120
- *
121
- * @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
122
- * then an editor won't be closed until validation is passed.
123
- */
124
- destroyEditor(revertOriginal) {
125
- if (!this.lock) {
126
- this.closeEditor(revertOriginal);
127
- }
128
- }
129
-
130
93
  /**
131
94
  * Get active editor.
132
95
  *
@@ -141,9 +104,6 @@ class EditorManager {
141
104
  */
142
105
  prepareEditor() {
143
106
  var _this$hot$getSelected;
144
- if (this.lock) {
145
- return;
146
- }
147
107
  if (this.activeEditor && this.activeEditor.isWaiting()) {
148
108
  this.closeEditor(false, false, dataSaved => {
149
109
  if (dataSaved) {
@@ -350,33 +310,6 @@ function _onAfterDocumentKeyDown(event) {
350
310
  const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
351
311
  if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
352
312
  if (!(0, _unicode.isFunctionKey)(keyCode) && !(0, _unicode.isCtrlMetaKey)(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
353
- const shortcutManager = this.hot.getShortcutManager();
354
- const editorContext = shortcutManager.getContext('editor');
355
- const runOnlySelectedConfig = {
356
- runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
357
- group: SHORTCUTS_GROUP_NAVIGATION
358
- };
359
- editorContext.addShortcuts([{
360
- keys: [['ArrowUp']],
361
- callback: () => {
362
- this.hot.selection.transformStart(-1, 0);
363
- }
364
- }, {
365
- keys: [['ArrowDown']],
366
- callback: () => {
367
- this.hot.selection.transformStart(1, 0);
368
- }
369
- }, {
370
- keys: [['ArrowLeft']],
371
- callback: () => {
372
- this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
373
- }
374
- }, {
375
- keys: [['ArrowRight']],
376
- callback: () => {
377
- this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
378
- }
379
- }], runOnlySelectedConfig);
380
313
  this.openEditor('', event);
381
314
  }
382
315
  }
package/editorManager.mjs CHANGED
@@ -9,8 +9,6 @@ import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
9
9
  import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
10
10
  import { getEditorInstance } from "./editors/registry.mjs";
11
11
  import EventManager from "./eventManager.mjs";
12
- import { isDefined } from "./helpers/mixed.mjs";
13
- export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
14
12
  var _EditorManager_brand = /*#__PURE__*/new WeakSet();
15
13
  class EditorManager {
16
14
  /**
@@ -60,13 +58,6 @@ class EditorManager {
60
58
  * @type {boolean}
61
59
  */
62
60
  _defineProperty(this, "destroyed", false);
63
- /**
64
- * Determines if EditorManager is locked.
65
- *
66
- * @private
67
- * @type {boolean}
68
- */
69
- _defineProperty(this, "lock", false);
70
61
  /**
71
62
  * A reference to an instance of the activeEditor.
72
63
  *
@@ -95,34 +86,6 @@ class EditorManager {
95
86
  this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
96
87
  }
97
88
 
98
- /**
99
- * Lock the editor from being prepared and closed. Locking the editor prevents its closing and
100
- * reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
101
- */
102
- lockEditor() {
103
- this.lock = true;
104
- }
105
-
106
- /**
107
- * Unlock the editor from being prepared and closed. This method restores the original behavior of
108
- * the editors where for every new selection its instances are closed.
109
- */
110
- unlockEditor() {
111
- this.lock = false;
112
- }
113
-
114
- /**
115
- * Destroy current editor, if exists.
116
- *
117
- * @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
118
- * then an editor won't be closed until validation is passed.
119
- */
120
- destroyEditor(revertOriginal) {
121
- if (!this.lock) {
122
- this.closeEditor(revertOriginal);
123
- }
124
- }
125
-
126
89
  /**
127
90
  * Get active editor.
128
91
  *
@@ -137,9 +100,6 @@ class EditorManager {
137
100
  */
138
101
  prepareEditor() {
139
102
  var _this$hot$getSelected;
140
- if (this.lock) {
141
- return;
142
- }
143
103
  if (this.activeEditor && this.activeEditor.isWaiting()) {
144
104
  this.closeEditor(false, false, dataSaved => {
145
105
  if (dataSaved) {
@@ -346,33 +306,6 @@ function _onAfterDocumentKeyDown(event) {
346
306
  const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
347
307
  if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
348
308
  if (!isFunctionKey(keyCode) && !isCtrlMetaKey(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
349
- const shortcutManager = this.hot.getShortcutManager();
350
- const editorContext = shortcutManager.getContext('editor');
351
- const runOnlySelectedConfig = {
352
- runOnlyIf: () => isDefined(this.hot.getSelected()),
353
- group: SHORTCUTS_GROUP_NAVIGATION
354
- };
355
- editorContext.addShortcuts([{
356
- keys: [['ArrowUp']],
357
- callback: () => {
358
- this.hot.selection.transformStart(-1, 0);
359
- }
360
- }, {
361
- keys: [['ArrowDown']],
362
- callback: () => {
363
- this.hot.selection.transformStart(1, 0);
364
- }
365
- }, {
366
- keys: [['ArrowLeft']],
367
- callback: () => {
368
- this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
369
- }
370
- }, {
371
- keys: [['ArrowRight']],
372
- callback: () => {
373
- this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
374
- }
375
- }], runOnlySelectedConfig);
376
309
  this.openEditor('', event);
377
310
  }
378
311
  }
@@ -318,12 +318,14 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
318
318
  choices = sorted;
319
319
  }
320
320
  this.strippedChoices = choices;
321
- this.htEditor.loadData((0, _array.pivot)([choices]));
322
321
  if (choices.length === 0) {
323
322
  this.htEditor.rootElement.style.display = 'none';
324
323
  } else {
325
324
  this.htEditor.rootElement.style.display = '';
326
- this.updateDropdownHeight();
325
+ }
326
+ this.htEditor.loadData((0, _array.pivot)([choices]));
327
+ if (choices.length > 0) {
328
+ this.updateDropdownDimensions();
327
329
  this.flipDropdownIfNeeded();
328
330
  if (this.cellProperties.strict === true) {
329
331
  this.highlightBestMatchingChoice(highlightIndex);
@@ -384,7 +386,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
384
386
  } while (tempHeight < spaceAvailable);
385
387
  height = tempHeight - lastRowHeight;
386
388
  if (this.htEditor.flipped) {
387
- this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`; // eslint-disable-line max-len
389
+ this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
388
390
  }
389
391
  this.setDropdownHeight(tempHeight - lastRowHeight);
390
392
  }
@@ -420,7 +422,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
420
422
  *
421
423
  * @private
422
424
  */
423
- updateDropdownHeight() {
425
+ updateDropdownDimensions() {
424
426
  const currentDropdownWidth = this.htEditor.getColWidth(0) + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 2;
425
427
  const trimDropdown = this.cellProperties.trimDropdown;
426
428
  this.htEditor.updateSettings({
@@ -315,12 +315,14 @@ export class AutocompleteEditor extends HandsontableEditor {
315
315
  choices = sorted;
316
316
  }
317
317
  this.strippedChoices = choices;
318
- this.htEditor.loadData(pivot([choices]));
319
318
  if (choices.length === 0) {
320
319
  this.htEditor.rootElement.style.display = 'none';
321
320
  } else {
322
321
  this.htEditor.rootElement.style.display = '';
323
- this.updateDropdownHeight();
322
+ }
323
+ this.htEditor.loadData(pivot([choices]));
324
+ if (choices.length > 0) {
325
+ this.updateDropdownDimensions();
324
326
  this.flipDropdownIfNeeded();
325
327
  if (this.cellProperties.strict === true) {
326
328
  this.highlightBestMatchingChoice(highlightIndex);
@@ -381,7 +383,7 @@ export class AutocompleteEditor extends HandsontableEditor {
381
383
  } while (tempHeight < spaceAvailable);
382
384
  height = tempHeight - lastRowHeight;
383
385
  if (this.htEditor.flipped) {
384
- this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`; // eslint-disable-line max-len
386
+ this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
385
387
  }
386
388
  this.setDropdownHeight(tempHeight - lastRowHeight);
387
389
  }
@@ -417,7 +419,7 @@ export class AutocompleteEditor extends HandsontableEditor {
417
419
  *
418
420
  * @private
419
421
  */
420
- updateDropdownHeight() {
422
+ updateDropdownDimensions() {
421
423
  const currentDropdownWidth = this.htEditor.getColWidth(0) + getScrollbarWidth(this.hot.rootDocument) + 2;
422
424
  const trimDropdown = this.cellProperties.trimDropdown;
423
425
  this.htEditor.updateSettings({
@@ -4,7 +4,6 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _mixed = require("../../helpers/mixed");
6
6
  var _object = require("../../helpers/object");
7
- var _editorManager = require("../../editorManager");
8
7
  var _hooksRefRegisterer = _interopRequireDefault(require("../../mixins/hooksRefRegisterer"));
9
8
  var _element = require("../../helpers/dom/element");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -20,7 +19,6 @@ const EDITOR_STATE = exports.EDITOR_STATE = Object.freeze({
20
19
  // waiting for async validation
21
20
  FINISHED: 'STATE_FINISHED'
22
21
  });
23
- const SHORTCUTS_GROUP_EDITOR = exports.SHORTCUTS_GROUP_EDITOR = 'baseEditor';
24
22
 
25
23
  /**
26
24
  * @class BaseEditor
@@ -172,7 +170,7 @@ class BaseEditor {
172
170
  this.prop = prop;
173
171
  this.originalValue = value;
174
172
  this.cellProperties = cellProperties;
175
- this.state = EDITOR_STATE.VIRGIN;
173
+ this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
176
174
  }
177
175
 
178
176
  /**
@@ -210,35 +208,6 @@ class BaseEditor {
210
208
  if (Array.isArray(modifiedCellCoords)) {
211
209
  [visualRowFrom, visualColumnFrom] = modifiedCellCoords;
212
210
  }
213
- const shortcutManager = this.hot.getShortcutManager();
214
- const editorContext = shortcutManager.getContext('editor');
215
- const contextConfig = {
216
- runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
217
- group: SHORTCUTS_GROUP_EDITOR
218
- };
219
- if (this.isInFullEditMode()) {
220
- editorContext.addShortcuts([{
221
- keys: [['ArrowUp']],
222
- callback: () => {
223
- this.hot.selection.transformStart(-1, 0);
224
- }
225
- }, {
226
- keys: [['ArrowDown']],
227
- callback: () => {
228
- this.hot.selection.transformStart(1, 0);
229
- }
230
- }, {
231
- keys: [['ArrowLeft']],
232
- callback: () => {
233
- this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
234
- }
235
- }, {
236
- keys: [['ArrowRight']],
237
- callback: () => {
238
- this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
239
- }
240
- }], contextConfig);
241
- }
242
211
 
243
212
  // Saving values using the modified coordinates.
244
213
  this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
@@ -299,10 +268,6 @@ class BaseEditor {
299
268
  if (this.isWaiting()) {
300
269
  return;
301
270
  }
302
- const shortcutManager = this.hot.getShortcutManager();
303
- const editorContext = shortcutManager.getContext('editor');
304
- editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
305
- editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
306
271
  if (this.state === EDITOR_STATE.VIRGIN) {
307
272
  this.hot._registerTimeout(() => {
308
273
  this._fireCallbacks(true);
@@ -2,9 +2,8 @@ import "core-js/modules/es.error.cause.js";
2
2
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
4
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
- import { isDefined, stringify } from "../../helpers/mixed.mjs";
5
+ import { stringify } from "../../helpers/mixed.mjs";
6
6
  import { mixin } from "../../helpers/object.mjs";
7
- import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
8
7
  import hooksRefRegisterer from "../../mixins/hooksRefRegisterer.mjs";
9
8
  import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight, getComputedStyle } from "../../helpers/dom/element.mjs";
10
9
  export const EDITOR_TYPE = 'base';
@@ -16,7 +15,6 @@ export const EDITOR_STATE = Object.freeze({
16
15
  // waiting for async validation
17
16
  FINISHED: 'STATE_FINISHED'
18
17
  });
19
- export const SHORTCUTS_GROUP_EDITOR = 'baseEditor';
20
18
 
21
19
  /**
22
20
  * @class BaseEditor
@@ -168,7 +166,7 @@ export class BaseEditor {
168
166
  this.prop = prop;
169
167
  this.originalValue = value;
170
168
  this.cellProperties = cellProperties;
171
- this.state = EDITOR_STATE.VIRGIN;
169
+ this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
172
170
  }
173
171
 
174
172
  /**
@@ -206,35 +204,6 @@ export class BaseEditor {
206
204
  if (Array.isArray(modifiedCellCoords)) {
207
205
  [visualRowFrom, visualColumnFrom] = modifiedCellCoords;
208
206
  }
209
- const shortcutManager = this.hot.getShortcutManager();
210
- const editorContext = shortcutManager.getContext('editor');
211
- const contextConfig = {
212
- runOnlyIf: () => isDefined(this.hot.getSelected()),
213
- group: SHORTCUTS_GROUP_EDITOR
214
- };
215
- if (this.isInFullEditMode()) {
216
- editorContext.addShortcuts([{
217
- keys: [['ArrowUp']],
218
- callback: () => {
219
- this.hot.selection.transformStart(-1, 0);
220
- }
221
- }, {
222
- keys: [['ArrowDown']],
223
- callback: () => {
224
- this.hot.selection.transformStart(1, 0);
225
- }
226
- }, {
227
- keys: [['ArrowLeft']],
228
- callback: () => {
229
- this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
230
- }
231
- }, {
232
- keys: [['ArrowRight']],
233
- callback: () => {
234
- this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
235
- }
236
- }], contextConfig);
237
- }
238
207
 
239
208
  // Saving values using the modified coordinates.
240
209
  this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
@@ -295,10 +264,6 @@ export class BaseEditor {
295
264
  if (this.isWaiting()) {
296
265
  return;
297
266
  }
298
- const shortcutManager = this.hot.getShortcutManager();
299
- const editorContext = shortcutManager.getContext('editor');
300
- editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
301
- editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_NAVIGATION);
302
267
  if (this.state === EDITOR_STATE.VIRGIN) {
303
268
  this.hot._registerTimeout(() => {
304
269
  this._fireCallbacks(true);
@@ -155,7 +155,10 @@ class DateEditor extends _textEditor.TextEditor {
155
155
  this.$datePicker.destroy();
156
156
  }
157
157
  this.hot._registerTimeout(() => {
158
- this.hot._refreshBorders();
158
+ const editorManager = this.hot._getEditorManager();
159
+ editorManager.closeEditor();
160
+ this.hot.view.render();
161
+ editorManager.prepareEditor();
159
162
  });
160
163
  const shortcutManager = this.hot.getShortcutManager();
161
164
  const editorContext = shortcutManager.getContext('editor');
@@ -151,7 +151,10 @@ export class DateEditor extends TextEditor {
151
151
  this.$datePicker.destroy();
152
152
  }
153
153
  this.hot._registerTimeout(() => {
154
- this.hot._refreshBorders();
154
+ const editorManager = this.hot._getEditorManager();
155
+ editorManager.closeEditor();
156
+ this.hot.view.render();
157
+ editorManager.prepareEditor();
155
158
  });
156
159
  const shortcutManager = this.hot.getShortcutManager();
157
160
  const editorContext = shortcutManager.getContext('editor');
@@ -31,11 +31,14 @@ class DropdownEditor extends _autocompleteEditor.AutocompleteEditor {
31
31
  }
32
32
  exports.DropdownEditor = DropdownEditor;
33
33
  _pluginHooks.default.getSingleton().add('beforeValidate', function (value, row, col) {
34
- const cellMeta = this.getCellMeta(row, this.propToCol(col));
35
- if (cellMeta.editor === DropdownEditor) {
36
- if (cellMeta.strict === undefined) {
37
- cellMeta.filter = false;
38
- cellMeta.strict = true;
34
+ const visualColumnIndex = this.propToCol(col);
35
+ if (Number.isInteger(visualColumnIndex)) {
36
+ const cellMeta = this.getCellMeta(row, visualColumnIndex);
37
+ if (cellMeta.editor === DropdownEditor) {
38
+ if (cellMeta.strict === undefined) {
39
+ cellMeta.filter = false;
40
+ cellMeta.strict = true;
41
+ }
39
42
  }
40
43
  }
41
44
  });
@@ -26,11 +26,14 @@ export class DropdownEditor extends AutocompleteEditor {
26
26
  }
27
27
  }
28
28
  Hooks.getSingleton().add('beforeValidate', function (value, row, col) {
29
- const cellMeta = this.getCellMeta(row, this.propToCol(col));
30
- if (cellMeta.editor === DropdownEditor) {
31
- if (cellMeta.strict === undefined) {
32
- cellMeta.filter = false;
33
- cellMeta.strict = true;
29
+ const visualColumnIndex = this.propToCol(col);
30
+ if (Number.isInteger(visualColumnIndex)) {
31
+ const cellMeta = this.getCellMeta(row, visualColumnIndex);
32
+ if (cellMeta.editor === DropdownEditor) {
33
+ if (cellMeta.strict === undefined) {
34
+ cellMeta.filter = false;
35
+ cellMeta.strict = true;
36
+ }
34
37
  }
35
38
  }
36
39
  });
@@ -5,7 +5,7 @@ var _textEditor = require("../textEditor");
5
5
  var _element = require("../../helpers/dom/element");
6
6
  var _event = require("../../helpers/dom/event");
7
7
  var _object = require("../../helpers/object");
8
- var _editorManager = require("../../editorManager");
8
+ var _shortcutContexts = require("../../shortcutContexts");
9
9
  const SHORTCUTS_GROUP = 'handsontableEditor';
10
10
  const EDITOR_TYPE = exports.EDITOR_TYPE = 'handsontable';
11
11
 
@@ -171,7 +171,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
171
171
  super.registerShortcuts();
172
172
  const contextConfig = {
173
173
  group: SHORTCUTS_GROUP,
174
- relativeToGroup: _editorManager.SHORTCUTS_GROUP_NAVIGATION,
174
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
175
175
  position: 'before'
176
176
  };
177
177
  const action = (rowToSelect, event) => {
@@ -2,7 +2,7 @@ import { TextEditor } from "../textEditor/index.mjs";
2
2
  import { setCaretPosition } from "../../helpers/dom/element.mjs";
3
3
  import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
4
4
  import { extend } from "../../helpers/object.mjs";
5
- import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
5
+ import { EDITOR_EDIT_GROUP } from "../../shortcutContexts/index.mjs";
6
6
  const SHORTCUTS_GROUP = 'handsontableEditor';
7
7
  export const EDITOR_TYPE = 'handsontable';
8
8
 
@@ -168,7 +168,7 @@ export class HandsontableEditor extends TextEditor {
168
168
  super.registerShortcuts();
169
169
  const contextConfig = {
170
170
  group: SHORTCUTS_GROUP,
171
- relativeToGroup: SHORTCUTS_GROUP_NAVIGATION,
171
+ relativeToGroup: EDITOR_EDIT_GROUP,
172
172
  position: 'before'
173
173
  };
174
174
  const action = (rowToSelect, event) => {
@@ -189,18 +189,10 @@ class SelectEditor extends _baseEditor.BaseEditor {
189
189
  registerShortcuts() {
190
190
  const shortcutManager = this.hot.getShortcutManager();
191
191
  const editorContext = shortcutManager.getContext('editor');
192
- const gridContext = shortcutManager.getContext('grid');
193
192
  const contextConfig = {
194
193
  group: SHORTCUTS_GROUP
195
194
  };
196
-
197
- // The `TAB`-related shortcuts should work both in full and fast edit modes.
198
- editorContext.addShortcuts([{
199
- keys: [['Tab'], ['Shift', 'Tab']],
200
- forwardToContext: gridContext,
201
- callback: () => {}
202
- }], contextConfig);
203
- if (this.isInFullEditMode() === true) {
195
+ if (this.isInFullEditMode()) {
204
196
  // The arrow-related shortcuts should work only in full edit mode.
205
197
  editorContext.addShortcuts([{
206
198
  keys: [['ArrowUp']],
@@ -186,18 +186,10 @@ export class SelectEditor extends BaseEditor {
186
186
  registerShortcuts() {
187
187
  const shortcutManager = this.hot.getShortcutManager();
188
188
  const editorContext = shortcutManager.getContext('editor');
189
- const gridContext = shortcutManager.getContext('grid');
190
189
  const contextConfig = {
191
190
  group: SHORTCUTS_GROUP
192
191
  };
193
-
194
- // The `TAB`-related shortcuts should work both in full and fast edit modes.
195
- editorContext.addShortcuts([{
196
- keys: [['Tab'], ['Shift', 'Tab']],
197
- forwardToContext: gridContext,
198
- callback: () => {}
199
- }], contextConfig);
200
- if (this.isInFullEditMode() === true) {
192
+ if (this.isInFullEditMode()) {
201
193
  // The arrow-related shortcuts should work only in full edit mode.
202
194
  editorContext.addShortcuts([{
203
195
  keys: [['ArrowUp']],
@@ -9,8 +9,6 @@ var _element = require("../../helpers/dom/element");
9
9
  var _number = require("../../helpers/number");
10
10
  var _autoResize = require("../../utils/autoResize");
11
11
  var _mixed = require("../../helpers/mixed");
12
- var _editorManager = require("../../editorManager");
13
- var _baseEditor2 = require("../baseEditor/baseEditor");
14
12
  var _caretPositioner = require("./caretPositioner");
15
13
  var _a11y = require("../../helpers/a11y");
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -150,12 +148,12 @@ class TextEditor extends _baseEditor.BaseEditor {
150
148
  const {
151
149
  allowInvalid
152
150
  } = cellProperties;
153
- if (allowInvalid) {
151
+ if (allowInvalid && !this.isOpened()) {
154
152
  // Remove an empty space from textarea (added by copyPaste plugin to make copy/paste
155
153
  // functionality work with IME)
156
154
  this.TEXTAREA.value = '';
157
155
  }
158
- if (previousState !== _baseEditor.EDITOR_STATE.FINISHED) {
156
+ if (previousState !== _baseEditor.EDITOR_STATE.FINISHED && !this.isOpened()) {
159
157
  this.hideEditableElement();
160
158
  }
161
159
  }
@@ -381,7 +379,6 @@ class TextEditor extends _baseEditor.BaseEditor {
381
379
  registerShortcuts() {
382
380
  const shortcutManager = this.hot.getShortcutManager();
383
381
  const editorContext = shortcutManager.getContext('editor');
384
- const gridContext = shortcutManager.getContext('grid');
385
382
  const contextConfig = {
386
383
  runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
387
384
  group: SHORTCUTS_GROUP
@@ -390,10 +387,6 @@ class TextEditor extends _baseEditor.BaseEditor {
390
387
  this.hot.rootDocument.execCommand('insertText', false, '\n');
391
388
  };
392
389
  editorContext.addShortcuts([{
393
- keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
394
- forwardToContext: gridContext,
395
- callback: () => {}
396
- }, {
397
390
  keys: [['Control', 'Enter']],
398
391
  callback: () => {
399
392
  insertNewLine();
@@ -439,9 +432,7 @@ class TextEditor extends _baseEditor.BaseEditor {
439
432
  unregisterShortcuts() {
440
433
  const shortcutManager = this.hot.getShortcutManager();
441
434
  const editorContext = shortcutManager.getContext('editor');
442
- editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
443
435
  editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
444
- editorContext.removeShortcutsByGroup(_baseEditor2.SHORTCUTS_GROUP_EDITOR);
445
436
  }
446
437
  }
447
438
  exports.TextEditor = TextEditor;