handsontable 0.0.0-next-c3d199b-20230626 → 0.0.0-next-208afb8-20230627

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

package/editorManager.js CHANGED
@@ -255,13 +255,7 @@ var EditorManager = /*#__PURE__*/function () {
255
255
  return;
256
256
  }
257
257
  if (!this.activeEditor) {
258
- var _this$instance$getSel2 = this.instance.getSelectedRangeLast().highlight,
259
- row = _this$instance$getSel2.row,
260
- col = _this$instance$getSel2.col;
261
- var renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
262
- var renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
263
- this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
264
- this.instance.view.render();
258
+ this.instance.scrollToFocusedCell();
265
259
  this.prepareEditor();
266
260
  }
267
261
  if (this.activeEditor) {
@@ -336,9 +330,9 @@ var EditorManager = /*#__PURE__*/function () {
336
330
  key: "isCellEditable",
337
331
  value: function isCellEditable() {
338
332
  var editorClass = this.instance.getCellEditor(this.cellProperties);
339
- var _this$instance$getSel3 = this.instance.getSelectedRangeLast().highlight,
340
- row = _this$instance$getSel3.row,
341
- col = _this$instance$getSel3.col;
333
+ var _this$instance$getSel2 = this.instance.getSelectedRangeLast().highlight,
334
+ row = _this$instance$getSel2.row,
335
+ col = _this$instance$getSel2.col;
342
336
  var _this$instance = this.instance,
343
337
  rowIndexMapper = _this$instance.rowIndexMapper,
344
338
  columnIndexMapper = _this$instance.columnIndexMapper;
package/editorManager.mjs CHANGED
@@ -249,13 +249,7 @@ var EditorManager = /*#__PURE__*/function () {
249
249
  return;
250
250
  }
251
251
  if (!this.activeEditor) {
252
- var _this$instance$getSel2 = this.instance.getSelectedRangeLast().highlight,
253
- row = _this$instance$getSel2.row,
254
- col = _this$instance$getSel2.col;
255
- var renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
256
- var renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
257
- this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
258
- this.instance.view.render();
252
+ this.instance.scrollToFocusedCell();
259
253
  this.prepareEditor();
260
254
  }
261
255
  if (this.activeEditor) {
@@ -330,9 +324,9 @@ var EditorManager = /*#__PURE__*/function () {
330
324
  key: "isCellEditable",
331
325
  value: function isCellEditable() {
332
326
  var editorClass = this.instance.getCellEditor(this.cellProperties);
333
- var _this$instance$getSel3 = this.instance.getSelectedRangeLast().highlight,
334
- row = _this$instance$getSel3.row,
335
- col = _this$instance$getSel3.col;
327
+ var _this$instance$getSel2 = this.instance.getSelectedRangeLast().highlight,
328
+ row = _this$instance$getSel2.row,
329
+ col = _this$instance$getSel2.col;
336
330
  var _this$instance = this.instance,
337
331
  rowIndexMapper = _this$instance.rowIndexMapper,
338
332
  columnIndexMapper = _this$instance.columnIndexMapper;
package/helpers/mixed.js CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
152
152
  function _injectProductInfo(key, element) {
153
153
  var hasValidType = !isEmpty(key);
154
154
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
155
- var hotVersion = "0.0.0-next-c3d199b-20230626";
155
+ var hotVersion = "0.0.0-next-208afb8-20230627";
156
156
  var keyValidityDate;
157
157
  var consoleMessageState = 'invalid';
158
158
  var domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
142
142
  export function _injectProductInfo(key, element) {
143
143
  var hasValidType = !isEmpty(key);
144
144
  var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
145
- var hotVersion = "0.0.0-next-c3d199b-20230626";
145
+ var hotVersion = "0.0.0-next-208afb8-20230627";
146
146
  var keyValidityDate;
147
147
  var consoleMessageState = 'invalid';
148
148
  var domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-c3d199b-20230626",
13
+ "version": "0.0.0-next-208afb8-20230627",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.d.ts CHANGED
@@ -128,6 +128,7 @@ export interface Events {
128
128
  afterRowSequenceChange?: (source: 'init' | 'move' | 'insert' | 'remove' | 'update') => void;
129
129
  afterScrollHorizontally?: () => void;
130
130
  afterScrollVertically?: () => void;
131
+ afterScroll?: () => void;
131
132
  afterSelectColumns?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
132
133
  afterSelection?: (row: number, column: number, row2: number, column2: number, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
133
134
  afterSelectionByProp?: (row: number, prop: string, row2: number, prop2: string, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
package/pluginHooks.js CHANGED
@@ -577,6 +577,13 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
577
577
  * @event Hooks#afterScrollVertically
578
578
  */
579
579
  'afterScrollVertically',
580
+ /**
581
+ * Fired after the vertical or horizontal scroll event.
582
+ *
583
+ * @since 14.0.0
584
+ * @event Hooks#afterScroll
585
+ */
586
+ 'afterScroll',
580
587
  /**
581
588
  * Fired after one or more cells are selected (e.g. During mouse move).
582
589
  *
@@ -683,7 +690,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
683
690
  /**
684
691
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
685
692
  *
686
- * @since 13.0.0
693
+ * @since 14.0.0
687
694
  * @event Hooks#beforeSelectColumns
688
695
  * @param {CellCoords} from Selection start coords object.
689
696
  * @param {CellCoords} to Selection end coords object.
@@ -717,7 +724,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
717
724
  /**
718
725
  * Fired after one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
719
726
  *
720
- * @since 13.0.0
727
+ * @since 14.0.0
721
728
  * @event Hooks#afterSelectColumns
722
729
  * @param {CellCoords} from Selection start coords object.
723
730
  * @param {CellCoords} to Selection end coords object.
@@ -727,7 +734,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
727
734
  /**
728
735
  * Fired before one or more rows are selected (e.g. During mouse header click or {@link Core#selectRows} API call).
729
736
  *
730
- * @since 13.0.0
737
+ * @since 14.0.0
731
738
  * @event Hooks#beforeSelectRows
732
739
  * @param {CellCoords} from Selection start coords object.
733
740
  * @param {CellCoords} to Selection end coords object.
@@ -761,7 +768,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
761
768
  /**
762
769
  * Fired after one or more rows are selected (e.g. During mouse header click or {@link Core#selectRows} API call).
763
770
  *
764
- * @since 13.0.0
771
+ * @since 14.0.0
765
772
  * @event Hooks#afterSelectRows
766
773
  * @param {CellCoords} from Selection start coords object.
767
774
  * @param {CellCoords} to Selection end coords object.
package/pluginHooks.mjs CHANGED
@@ -574,6 +574,13 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
574
574
  * @event Hooks#afterScrollVertically
575
575
  */
576
576
  'afterScrollVertically',
577
+ /**
578
+ * Fired after the vertical or horizontal scroll event.
579
+ *
580
+ * @since 14.0.0
581
+ * @event Hooks#afterScroll
582
+ */
583
+ 'afterScroll',
577
584
  /**
578
585
  * Fired after one or more cells are selected (e.g. During mouse move).
579
586
  *
@@ -680,7 +687,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
680
687
  /**
681
688
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
682
689
  *
683
- * @since 13.0.0
690
+ * @since 14.0.0
684
691
  * @event Hooks#beforeSelectColumns
685
692
  * @param {CellCoords} from Selection start coords object.
686
693
  * @param {CellCoords} to Selection end coords object.
@@ -714,7 +721,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
714
721
  /**
715
722
  * Fired after one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
716
723
  *
717
- * @since 13.0.0
724
+ * @since 14.0.0
718
725
  * @event Hooks#afterSelectColumns
719
726
  * @param {CellCoords} from Selection start coords object.
720
727
  * @param {CellCoords} to Selection end coords object.
@@ -724,7 +731,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
724
731
  /**
725
732
  * Fired before one or more rows are selected (e.g. During mouse header click or {@link Core#selectRows} API call).
726
733
  *
727
- * @since 13.0.0
734
+ * @since 14.0.0
728
735
  * @event Hooks#beforeSelectRows
729
736
  * @param {CellCoords} from Selection start coords object.
730
737
  * @param {CellCoords} to Selection end coords object.
@@ -758,7 +765,7 @@ var REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-sen
758
765
  /**
759
766
  * Fired after one or more rows are selected (e.g. During mouse header click or {@link Core#selectRows} API call).
760
767
  *
761
- * @since 13.0.0
768
+ * @since 14.0.0
762
769
  * @event Hooks#afterSelectRows
763
770
  * @param {CellCoords} from Selection start coords object.
764
771
  * @param {CellCoords} to Selection end coords object.
@@ -162,6 +162,7 @@ var SHORTCUTS_CONTEXT_NAME = "plugin:".concat(PLUGIN_KEY);
162
162
  var _editor = /*#__PURE__*/new WeakMap();
163
163
  var _displaySwitch = /*#__PURE__*/new WeakMap();
164
164
  var _preventEditorAutoSwitch = /*#__PURE__*/new WeakMap();
165
+ var _preventEditorHiding = /*#__PURE__*/new WeakMap();
165
166
  var _tempEditorDimensions = /*#__PURE__*/new WeakMap();
166
167
  var _cellBelowCursor = /*#__PURE__*/new WeakMap();
167
168
  var _commentValueBeforeSave = /*#__PURE__*/new WeakMap();
@@ -218,6 +219,17 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
218
219
  writable: true,
219
220
  value: false
220
221
  });
222
+ /**
223
+ * Prevents hiding editor when the table viewport is scrolled and that scroll is triggered by the
224
+ * keyboard shortcut that insert or edits the comment.
225
+ *
226
+ * @private
227
+ * @type {boolean}
228
+ */
229
+ _classPrivateFieldInitSpec(_assertThisInitialized(_this), _preventEditorHiding, {
230
+ writable: true,
231
+ value: false
232
+ });
221
233
  /**
222
234
  * The property for holding editor dimensions for further processing.
223
235
  *
@@ -288,11 +300,8 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
288
300
  this.addHook('afterRenderer', function (TD, row, col, prop, value, cellProperties) {
289
301
  return _this2.onAfterRenderer(TD, cellProperties);
290
302
  });
291
- this.addHook('afterScrollHorizontally', function () {
292
- return _this2.hide();
293
- });
294
- this.addHook('afterScrollVertically', function () {
295
- return _this2.hide();
303
+ this.addHook('afterScroll', function () {
304
+ return _this2.onAfterScroll();
296
305
  });
297
306
  this.addHook('afterBeginEditing', function () {
298
307
  return _this2.hide();
@@ -350,10 +359,16 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
350
359
  keys: [['Control', 'Alt', 'M']],
351
360
  callback: function callback() {
352
361
  var range = _this3.hot.getSelectedRangeLast();
353
- _this3.setRange(range);
354
- _this3.show();
355
- _this3.focusEditor();
356
- manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
362
+ _classPrivateFieldSet(_this3, _preventEditorHiding, true);
363
+ _this3.hot.scrollToFocusedCell(function () {
364
+ _this3.setRange(range);
365
+ _this3.show();
366
+ _this3.focusEditor();
367
+ manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
368
+ _this3.hot._registerTimeout(function () {
369
+ _classPrivateFieldSet(_this3, _preventEditorHiding, false);
370
+ });
371
+ });
357
372
  },
358
373
  stopPropagation: true,
359
374
  runOnlyIf: function runOnlyIf() {
@@ -915,6 +930,17 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
915
930
  }
916
931
  }
917
932
 
933
+ /**
934
+ * Observes the changes in the scroll position if triggered it hides the comment editor.
935
+ */
936
+ }, {
937
+ key: "onAfterScroll",
938
+ value: function onAfterScroll() {
939
+ if (!_classPrivateFieldGet(this, _preventEditorHiding)) {
940
+ this.hide();
941
+ }
942
+ }
943
+
918
944
  /**
919
945
  * Add Comments plugin options to the Context Menu.
920
946
  *
@@ -151,6 +151,7 @@ var SHORTCUTS_CONTEXT_NAME = "plugin:".concat(PLUGIN_KEY);
151
151
  var _editor = /*#__PURE__*/new WeakMap();
152
152
  var _displaySwitch = /*#__PURE__*/new WeakMap();
153
153
  var _preventEditorAutoSwitch = /*#__PURE__*/new WeakMap();
154
+ var _preventEditorHiding = /*#__PURE__*/new WeakMap();
154
155
  var _tempEditorDimensions = /*#__PURE__*/new WeakMap();
155
156
  var _cellBelowCursor = /*#__PURE__*/new WeakMap();
156
157
  var _commentValueBeforeSave = /*#__PURE__*/new WeakMap();
@@ -207,6 +208,17 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
207
208
  writable: true,
208
209
  value: false
209
210
  });
211
+ /**
212
+ * Prevents hiding editor when the table viewport is scrolled and that scroll is triggered by the
213
+ * keyboard shortcut that insert or edits the comment.
214
+ *
215
+ * @private
216
+ * @type {boolean}
217
+ */
218
+ _classPrivateFieldInitSpec(_assertThisInitialized(_this), _preventEditorHiding, {
219
+ writable: true,
220
+ value: false
221
+ });
210
222
  /**
211
223
  * The property for holding editor dimensions for further processing.
212
224
  *
@@ -277,11 +289,8 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
277
289
  this.addHook('afterRenderer', function (TD, row, col, prop, value, cellProperties) {
278
290
  return _this2.onAfterRenderer(TD, cellProperties);
279
291
  });
280
- this.addHook('afterScrollHorizontally', function () {
281
- return _this2.hide();
282
- });
283
- this.addHook('afterScrollVertically', function () {
284
- return _this2.hide();
292
+ this.addHook('afterScroll', function () {
293
+ return _this2.onAfterScroll();
285
294
  });
286
295
  this.addHook('afterBeginEditing', function () {
287
296
  return _this2.hide();
@@ -339,10 +348,16 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
339
348
  keys: [['Control', 'Alt', 'M']],
340
349
  callback: function callback() {
341
350
  var range = _this3.hot.getSelectedRangeLast();
342
- _this3.setRange(range);
343
- _this3.show();
344
- _this3.focusEditor();
345
- manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
351
+ _classPrivateFieldSet(_this3, _preventEditorHiding, true);
352
+ _this3.hot.scrollToFocusedCell(function () {
353
+ _this3.setRange(range);
354
+ _this3.show();
355
+ _this3.focusEditor();
356
+ manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
357
+ _this3.hot._registerTimeout(function () {
358
+ _classPrivateFieldSet(_this3, _preventEditorHiding, false);
359
+ });
360
+ });
346
361
  },
347
362
  stopPropagation: true,
348
363
  runOnlyIf: function runOnlyIf() {
@@ -904,6 +919,17 @@ export var Comments = /*#__PURE__*/function (_BasePlugin) {
904
919
  }
905
920
  }
906
921
 
922
+ /**
923
+ * Observes the changes in the scroll position if triggered it hides the comment editor.
924
+ */
925
+ }, {
926
+ key: "onAfterScroll",
927
+ value: function onAfterScroll() {
928
+ if (!_classPrivateFieldGet(this, _preventEditorHiding)) {
929
+ this.hide();
930
+ }
931
+ }
932
+
907
933
  /**
908
934
  * Add Comments plugin options to the Context Menu.
909
935
  *
@@ -218,6 +218,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
218
218
  callback: function callback() {
219
219
  var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
220
220
  highlight = _this3$hot$getSelecte.highlight;
221
+ _this3.hot.scrollToFocusedCell();
221
222
  var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
222
223
  var offset = (0, _utils.getDocumentOffsetByElement)(_this3.menu.container, _this3.hot.rootDocument);
223
224
  _this3.open({
@@ -211,6 +211,7 @@ export var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
211
211
  callback: function callback() {
212
212
  var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
213
213
  highlight = _this3$hot$getSelecte.highlight;
214
+ _this3.hot.scrollToFocusedCell();
214
215
  var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
215
216
  var offset = getDocumentOffsetByElement(_this3.menu.container, _this3.hot.rootDocument);
216
217
  _this3.open({
package/tableView.js CHANGED
@@ -915,10 +915,12 @@ var TableView = /*#__PURE__*/function () {
915
915
  return _this2.afterRender(force);
916
916
  },
917
917
  onScrollVertically: function onScrollVertically() {
918
- return _this2.instance.runHooks('afterScrollVertically');
918
+ _this2.instance.runHooks('afterScrollVertically');
919
+ _this2.instance.runHooks('afterScroll');
919
920
  },
920
921
  onScrollHorizontally: function onScrollHorizontally() {
921
- return _this2.instance.runHooks('afterScrollHorizontally');
922
+ _this2.instance.runHooks('afterScrollHorizontally');
923
+ _this2.instance.runHooks('afterScroll');
922
924
  },
923
925
  onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
924
926
  return _this2.instance.runHooks('beforeRemoveCellClassNames');
package/tableView.mjs CHANGED
@@ -910,10 +910,12 @@ var TableView = /*#__PURE__*/function () {
910
910
  return _this2.afterRender(force);
911
911
  },
912
912
  onScrollVertically: function onScrollVertically() {
913
- return _this2.instance.runHooks('afterScrollVertically');
913
+ _this2.instance.runHooks('afterScrollVertically');
914
+ _this2.instance.runHooks('afterScroll');
914
915
  },
915
916
  onScrollHorizontally: function onScrollHorizontally() {
916
- return _this2.instance.runHooks('afterScrollHorizontally');
917
+ _this2.instance.runHooks('afterScrollHorizontally');
918
+ _this2.instance.runHooks('afterScroll');
917
919
  },
918
920
  onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
919
921
  return _this2.instance.runHooks('beforeRemoveCellClassNames');