handsontable 14.0.0-next-bdc44e7-20231115 → 14.0.0-next-ae5997a-20231116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -388,6 +388,7 @@ class TextEditor extends _baseEditor.BaseEditor {
388
388
  registerShortcuts() {
389
389
  const shortcutManager = this.hot.getShortcutManager();
390
390
  const editorContext = shortcutManager.getContext('editor');
391
+ const gridContext = shortcutManager.getContext('grid');
391
392
  const contextConfig = {
392
393
  runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
393
394
  group: SHORTCUTS_GROUP
@@ -396,21 +397,9 @@ class TextEditor extends _baseEditor.BaseEditor {
396
397
  this.hot.rootDocument.execCommand('insertText', false, '\n');
397
398
  };
398
399
  editorContext.addShortcuts([{
399
- keys: [['Tab']],
400
- // TODO: Duplicated part of code (callback to shortcut).
401
- callback: event => {
402
- const tableMeta = this.hot.getSettings();
403
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
404
- this.hot.selection.transformStart(tabMoves.row, tabMoves.col, true);
405
- }
406
- }, {
407
- keys: [['Shift', 'Tab']],
408
- // TODO: Duplicated part of code (callback to shortcut).
409
- callback: event => {
410
- const tableMeta = this.hot.getSettings();
411
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
412
- this.hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
413
- }
400
+ keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
401
+ forwardToContext: gridContext,
402
+ callback: () => {}
414
403
  }, {
415
404
  keys: [['Control', 'Enter']],
416
405
  callback: () => {
@@ -436,18 +425,6 @@ class TextEditor extends _baseEditor.BaseEditor {
436
425
  insertNewLine();
437
426
  return false; // Will block closing editor.
438
427
  }
439
- }, {
440
- // TODO: Duplicated part of code (callback to shortcut)
441
- keys: [['PageUp']],
442
- callback: () => {
443
- this.hot.selection.transformStart(-this.hot.countVisibleRows(), 0);
444
- }
445
- }, {
446
- // TODO: Duplicated part of code (callback to shortcut)
447
- keys: [['PageDown']],
448
- callback: () => {
449
- this.hot.selection.transformStart(this.hot.countVisibleRows(), 0);
450
- }
451
428
  }, {
452
429
  keys: [['Home']],
453
430
  callback: (event, _ref) => {
@@ -384,6 +384,7 @@ export class TextEditor extends BaseEditor {
384
384
  registerShortcuts() {
385
385
  const shortcutManager = this.hot.getShortcutManager();
386
386
  const editorContext = shortcutManager.getContext('editor');
387
+ const gridContext = shortcutManager.getContext('grid');
387
388
  const contextConfig = {
388
389
  runOnlyIf: () => isDefined(this.hot.getSelected()),
389
390
  group: SHORTCUTS_GROUP
@@ -392,21 +393,9 @@ export class TextEditor extends BaseEditor {
392
393
  this.hot.rootDocument.execCommand('insertText', false, '\n');
393
394
  };
394
395
  editorContext.addShortcuts([{
395
- keys: [['Tab']],
396
- // TODO: Duplicated part of code (callback to shortcut).
397
- callback: event => {
398
- const tableMeta = this.hot.getSettings();
399
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
400
- this.hot.selection.transformStart(tabMoves.row, tabMoves.col, true);
401
- }
402
- }, {
403
- keys: [['Shift', 'Tab']],
404
- // TODO: Duplicated part of code (callback to shortcut).
405
- callback: event => {
406
- const tableMeta = this.hot.getSettings();
407
- const tabMoves = typeof tableMeta.tabMoves === 'function' ? tableMeta.tabMoves(event) : tableMeta.tabMoves;
408
- this.hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
409
- }
396
+ keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
397
+ forwardToContext: gridContext,
398
+ callback: () => {}
410
399
  }, {
411
400
  keys: [['Control', 'Enter']],
412
401
  callback: () => {
@@ -432,18 +421,6 @@ export class TextEditor extends BaseEditor {
432
421
  insertNewLine();
433
422
  return false; // Will block closing editor.
434
423
  }
435
- }, {
436
- // TODO: Duplicated part of code (callback to shortcut)
437
- keys: [['PageUp']],
438
- callback: () => {
439
- this.hot.selection.transformStart(-this.hot.countVisibleRows(), 0);
440
- }
441
- }, {
442
- // TODO: Duplicated part of code (callback to shortcut)
443
- keys: [['PageDown']],
444
- callback: () => {
445
- this.hot.selection.transformStart(this.hot.countVisibleRows(), 0);
446
- }
447
424
  }, {
448
425
  keys: [['Home']],
449
426
  callback: (event, _ref) => {
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "14.0.0-next-bdc44e7-20231115";
137
+ const hotVersion = "14.0.0-next-ae5997a-20231116";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "14.0.0-next-bdc44e7-20231115";
127
+ const hotVersion = "14.0.0-next-ae5997a-20231116";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let 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": "14.0.0-next-bdc44e7-20231115",
13
+ "version": "14.0.0-next-ae5997a-20231116",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.d.ts CHANGED
@@ -166,7 +166,7 @@ export interface Events {
166
166
  beforeColumnMove?: (movedColumns: number[], finalIndex: number, dropIndex: number | undefined, movePossible: boolean) => void | boolean;
167
167
  beforeColumnResize?: (newSize: number, column: number, isDoubleClick: boolean) => void | number;
168
168
  beforeColumnSort?: (currentSortConfig: ColumnSortingConfig[], destinationSortConfigs: ColumnSortingConfig[]) => void | boolean;
169
- beforeColumnWrap?: (isAutoWrapEnabled: boolean, newCoords: CellCoords, isColumnFlipped: boolean) => void;
169
+ beforeColumnWrap?: (isActionInterrupted: { value: boolean }, newCoords: CellCoords, isColumnFlipped: boolean) => void;
170
170
  beforeColumnUnfreeze?: (columnIndex: number, isUnfreezingPerformed: boolean) => void | boolean;
171
171
  beforeContextMenuSetItems?: (menuItems: ContextMenuMenuItemConfig[]) => void;
172
172
  beforeContextMenuShow?: (context: ContextMenu) => void;
@@ -207,7 +207,7 @@ export interface Events {
207
207
  beforeRenderer?: (TD: HTMLTableCellElement, row: number, column: number, prop: string | number, value: CellValue, cellProperties: CellProperties) => void;
208
208
  beforeRowMove?: (movedRows: number[], finalIndex: number, dropIndex: number | undefined, movePossible: boolean) => void;
209
209
  beforeRowResize?: (newSize: number, row: number, isDoubleClick: boolean) => number | void;
210
- beforeRowWrap?: (isAutoWrapEnabled: boolean, newCoords: CellCoords, isRowFlipped: boolean) => void;
210
+ beforeRowWrap?: (isActionInterrupted: { value: boolean }, newCoords: CellCoords, isRowFlipped: boolean) => void;
211
211
  beforeSelectColumns?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
212
212
  beforeSelectionHighlightSet?: () => void;
213
213
  beforeSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
@@ -147,39 +147,39 @@ class Transformation {
147
147
  const autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
148
148
  const zeroBasedCoords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
149
149
  if (zeroBasedCoords.row >= height) {
150
- const autoInsertingMode = createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0;
151
- const isWrapEnabled = !autoInsertingMode && autoWrapCol;
150
+ const isActionInterrupted = (0, _object.createObjectPropListener)(createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0);
152
151
  const nextColumn = zeroBasedCoords.col + 1;
153
152
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(zeroBasedCoords.row - height, nextColumn >= width ? nextColumn - width : nextColumn);
154
- this.runLocalHooks('beforeColumnWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
155
- if (autoInsertingMode) {
153
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
154
+ if (isActionInterrupted.value) {
156
155
  this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
157
- } else if (isWrapEnabled) {
156
+ } else if (autoWrapCol) {
158
157
  zeroBasedCoords.assign(newCoords);
159
158
  }
160
159
  } else if (zeroBasedCoords.row < 0) {
160
+ const isActionInterrupted = (0, _object.createObjectPropListener)(autoWrapCol);
161
161
  const previousColumn = zeroBasedCoords.col - 1;
162
162
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(height + zeroBasedCoords.row, previousColumn < 0 ? width + previousColumn : previousColumn);
163
- this.runLocalHooks('beforeColumnWrap', autoWrapCol, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
163
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
164
164
  if (autoWrapCol) {
165
165
  zeroBasedCoords.assign(newCoords);
166
166
  }
167
167
  }
168
168
  if (zeroBasedCoords.col >= width) {
169
- const autoInsertingMode = createMissingRecords && minSpareCols > 0;
170
- const isWrapEnabled = !autoInsertingMode && autoWrapRow;
169
+ const isActionInterrupted = (0, _object.createObjectPropListener)(createMissingRecords && minSpareCols > 0);
171
170
  const nextRow = zeroBasedCoords.row + 1;
172
171
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(nextRow >= height ? nextRow - height : nextRow, zeroBasedCoords.col - width);
173
- this.runLocalHooks('beforeRowWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
174
- if (autoInsertingMode) {
172
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
173
+ if (isActionInterrupted.value) {
175
174
  this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
176
- } else if (isWrapEnabled) {
175
+ } else if (autoWrapRow) {
177
176
  zeroBasedCoords.assign(newCoords);
178
177
  }
179
178
  } else if (zeroBasedCoords.col < 0) {
179
+ const isActionInterrupted = (0, _object.createObjectPropListener)(autoWrapRow);
180
180
  const previousRow = zeroBasedCoords.row - 1;
181
181
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(previousRow < 0 ? height + previousRow : previousRow, width + zeroBasedCoords.col);
182
- this.runLocalHooks('beforeRowWrap', autoWrapRow, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
182
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
183
183
  if (autoWrapRow) {
184
184
  zeroBasedCoords.assign(newCoords);
185
185
  }
@@ -8,7 +8,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
8
8
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
9
9
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
10
10
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
11
- import { mixin } from "../helpers/object.mjs";
11
+ import { mixin, createObjectPropListener } from "../helpers/object.mjs";
12
12
  import localHooks from "./../mixins/localHooks.mjs";
13
13
  /**
14
14
  * The Transformation class implements algorithms for transforming coordinates based on current settings
@@ -143,39 +143,39 @@ class Transformation {
143
143
  const autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
144
144
  const zeroBasedCoords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
145
145
  if (zeroBasedCoords.row >= height) {
146
- const autoInsertingMode = createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0;
147
- const isWrapEnabled = !autoInsertingMode && autoWrapCol;
146
+ const isActionInterrupted = createObjectPropListener(createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0);
148
147
  const nextColumn = zeroBasedCoords.col + 1;
149
148
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(zeroBasedCoords.row - height, nextColumn >= width ? nextColumn - width : nextColumn);
150
- this.runLocalHooks('beforeColumnWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
151
- if (autoInsertingMode) {
149
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
150
+ if (isActionInterrupted.value) {
152
151
  this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
153
- } else if (isWrapEnabled) {
152
+ } else if (autoWrapCol) {
154
153
  zeroBasedCoords.assign(newCoords);
155
154
  }
156
155
  } else if (zeroBasedCoords.row < 0) {
156
+ const isActionInterrupted = createObjectPropListener(autoWrapCol);
157
157
  const previousColumn = zeroBasedCoords.col - 1;
158
158
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(height + zeroBasedCoords.row, previousColumn < 0 ? width + previousColumn : previousColumn);
159
- this.runLocalHooks('beforeColumnWrap', autoWrapCol, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
159
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
160
160
  if (autoWrapCol) {
161
161
  zeroBasedCoords.assign(newCoords);
162
162
  }
163
163
  }
164
164
  if (zeroBasedCoords.col >= width) {
165
- const autoInsertingMode = createMissingRecords && minSpareCols > 0;
166
- const isWrapEnabled = !autoInsertingMode && autoWrapRow;
165
+ const isActionInterrupted = createObjectPropListener(createMissingRecords && minSpareCols > 0);
167
166
  const nextRow = zeroBasedCoords.row + 1;
168
167
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(nextRow >= height ? nextRow - height : nextRow, zeroBasedCoords.col - width);
169
- this.runLocalHooks('beforeRowWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
170
- if (autoInsertingMode) {
168
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
169
+ if (isActionInterrupted.value) {
171
170
  this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
172
- } else if (isWrapEnabled) {
171
+ } else if (autoWrapRow) {
173
172
  zeroBasedCoords.assign(newCoords);
174
173
  }
175
174
  } else if (zeroBasedCoords.col < 0) {
175
+ const isActionInterrupted = createObjectPropListener(autoWrapRow);
176
176
  const previousRow = zeroBasedCoords.row - 1;
177
177
  const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(previousRow < 0 ? height + previousRow : previousRow, width + zeroBasedCoords.col);
178
- this.runLocalHooks('beforeRowWrap', autoWrapRow, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
178
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
179
179
  if (autoWrapRow) {
180
180
  zeroBasedCoords.assign(newCoords);
181
181
  }
@@ -6,6 +6,6 @@ const command = exports.command = {
6
6
  callback(hot, event) {
7
7
  const settings = hot.getSettings();
8
8
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
9
- hot.selection.transformStart(tabMoves.row, tabMoves.col, true);
9
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
10
10
  }
11
11
  };
@@ -3,6 +3,6 @@ export const command = {
3
3
  callback(hot, event) {
4
4
  const settings = hot.getSettings();
5
5
  const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
6
- hot.selection.transformStart(tabMoves.row, tabMoves.col, true);
6
+ hot.selection.transformStart(tabMoves.row, tabMoves.col);
7
7
  }
8
8
  };