handsontable 0.0.0-next-a2cc849-20240208 → 0.0.0-next-d255844-20240209

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.

Files changed (69) hide show
  1. package/3rdparty/walkontable/src/cell/range.d.ts +0 -1
  2. package/3rdparty/walkontable/src/cell/range.js +0 -12
  3. package/3rdparty/walkontable/src/cell/range.mjs +0 -12
  4. package/base.js +2 -2
  5. package/base.mjs +2 -2
  6. package/core/viewportScroll/index.js +1 -4
  7. package/core/viewportScroll/index.mjs +1 -4
  8. package/core.js +0 -14
  9. package/core.mjs +0 -14
  10. package/dataMap/metaManager/index.js +1 -1
  11. package/dataMap/metaManager/index.mjs +1 -1
  12. package/dist/handsontable.css +2 -2
  13. package/dist/handsontable.full.css +2 -2
  14. package/dist/handsontable.full.js +1113 -1323
  15. package/dist/handsontable.full.min.css +2 -2
  16. package/dist/handsontable.full.min.js +151 -151
  17. package/dist/handsontable.js +1115 -1325
  18. package/dist/handsontable.min.css +2 -2
  19. package/dist/handsontable.min.js +32 -32
  20. package/editorManager.js +8 -12
  21. package/editorManager.mjs +8 -12
  22. package/helpers/mixed.js +1 -1
  23. package/helpers/mixed.mjs +1 -1
  24. package/package.json +1 -1
  25. package/pluginHooks.d.ts +1 -1
  26. package/pluginHooks.js +11 -43
  27. package/pluginHooks.mjs +11 -43
  28. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -7
  29. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -7
  30. package/plugins/columnSorting/columnSorting.js +0 -6
  31. package/plugins/columnSorting/columnSorting.mjs +0 -6
  32. package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
  33. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
  34. package/plugins/filters/component/value.js +51 -5
  35. package/plugins/filters/component/value.mjs +51 -5
  36. package/plugins/filters/utils.js +1 -1
  37. package/plugins/filters/utils.mjs +1 -1
  38. package/plugins/mergeCells/mergeCells.js +1 -3
  39. package/plugins/mergeCells/mergeCells.mjs +1 -3
  40. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -6
  41. package/plugins/multiColumnSorting/multiColumnSorting.mjs +0 -6
  42. package/plugins/nestedHeaders/nestedHeaders.js +0 -1
  43. package/plugins/nestedHeaders/nestedHeaders.mjs +0 -1
  44. package/plugins/nestedRows/nestedRows.js +1 -7
  45. package/plugins/nestedRows/nestedRows.mjs +1 -7
  46. package/renderers/checkboxRenderer/checkboxRenderer.js +4 -4
  47. package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
  48. package/renderers/numericRenderer/index.js +2 -1
  49. package/renderers/numericRenderer/index.mjs +1 -1
  50. package/renderers/numericRenderer/numericRenderer.js +27 -12
  51. package/renderers/numericRenderer/numericRenderer.mjs +26 -12
  52. package/selection/selection.js +30 -156
  53. package/selection/selection.mjs +29 -155
  54. package/selection/transformation.js +27 -18
  55. package/selection/transformation.mjs +27 -18
  56. package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
  57. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
  58. package/shortcutContexts/commands/editor/open.js +3 -18
  59. package/shortcutContexts/commands/editor/open.mjs +3 -18
  60. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
  61. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
  62. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
  63. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
  64. package/shortcutContexts/grid.js +2 -2
  65. package/shortcutContexts/grid.mjs +2 -2
  66. package/shortcuts/context.js +1 -2
  67. package/shortcuts/context.mjs +1 -2
  68. package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
  69. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
package/editorManager.js CHANGED
@@ -318,22 +318,18 @@ class EditorManager {
318
318
  }
319
319
 
320
320
  /**
321
- * Controls selection's behavior after clicking `Enter`.
321
+ * Controls selection's behaviour after clicking `Enter`.
322
322
  *
323
323
  * @private
324
- * @param {KeyboardEvent} event The keyboard event object.
324
+ * @param {boolean} isShiftPressed If `true`, then the selection will move up after hit enter.
325
325
  */
326
- moveSelectionAfterEnter(event) {
327
- const enterMoves = {
328
- ...(typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves)
329
- };
330
- if (event.shiftKey) {
331
- enterMoves.row = -enterMoves.row;
332
- enterMoves.col = -enterMoves.col;
333
- }
334
- if (this.hot.selection.isMultiple()) {
335
- this.selection.transformFocus(enterMoves.row, enterMoves.col);
326
+ moveSelectionAfterEnter(isShiftPressed) {
327
+ const enterMoves = typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves;
328
+ if (isShiftPressed) {
329
+ // move selection up
330
+ this.selection.transformStart(-enterMoves.row, -enterMoves.col);
336
331
  } else {
332
+ // move selection down (add a new row if needed)
337
333
  this.selection.transformStart(enterMoves.row, enterMoves.col, true);
338
334
  }
339
335
  }
package/editorManager.mjs CHANGED
@@ -314,22 +314,18 @@ class EditorManager {
314
314
  }
315
315
 
316
316
  /**
317
- * Controls selection's behavior after clicking `Enter`.
317
+ * Controls selection's behaviour after clicking `Enter`.
318
318
  *
319
319
  * @private
320
- * @param {KeyboardEvent} event The keyboard event object.
320
+ * @param {boolean} isShiftPressed If `true`, then the selection will move up after hit enter.
321
321
  */
322
- moveSelectionAfterEnter(event) {
323
- const enterMoves = {
324
- ...(typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves)
325
- };
326
- if (event.shiftKey) {
327
- enterMoves.row = -enterMoves.row;
328
- enterMoves.col = -enterMoves.col;
329
- }
330
- if (this.hot.selection.isMultiple()) {
331
- this.selection.transformFocus(enterMoves.row, enterMoves.col);
322
+ moveSelectionAfterEnter(isShiftPressed) {
323
+ const enterMoves = typeof this.tableMeta.enterMoves === 'function' ? this.tableMeta.enterMoves(event) : this.tableMeta.enterMoves;
324
+ if (isShiftPressed) {
325
+ // move selection up
326
+ this.selection.transformStart(-enterMoves.row, -enterMoves.col);
332
327
  } else {
328
+ // move selection down (add a new row if needed)
333
329
  this.selection.transformStart(enterMoves.row, enterMoves.col, true);
334
330
  }
335
331
  }
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 = "0.0.0-next-a2cc849-20240208";
137
+ const hotVersion = "0.0.0-next-d255844-20240209";
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 = "0.0.0-next-a2cc849-20240208";
127
+ const hotVersion = "0.0.0-next-d255844-20240209";
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": "0.0.0-next-a2cc849-20240208",
13
+ "version": "0.0.0-next-d255844-20240209",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
package/pluginHooks.d.ts CHANGED
@@ -133,7 +133,6 @@ export interface Events {
133
133
  afterSelectionByProp?: (row: number, prop: string, row2: number, prop2: string, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
134
134
  afterSelectionEnd?: (row: number, column: number, row2: number, column2: number, selectionLayerLevel: number) => void;
135
135
  afterSelectionEndByProp?: (row: number, prop: string, row2: number, prop2: string, selectionLayerLevel: number) => void;
136
- afterSelectionFocusSet?: (row: number, column: number, preventScrolling: { value: boolean }) => void;
137
136
  afterSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
138
137
  afterSetCellMeta?: (row: number, column: number, key: string, value: any) => void;
139
138
  afterSetDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
@@ -243,6 +242,7 @@ export interface Events {
243
242
  modifyColumnHeaderValue?: (headerValue: string, visualColumnIndex: number, headerLevel: number) => void | string;
244
243
  modifyColWidth?: (width: number, column: number) => void;
245
244
  modifyCopyableRange?: (copyableRanges: RangeType[]) => void;
245
+ modifyFiltersMultiSelectValue?: (value: string, meta: CellProperties) => void | CellValue;
246
246
  modifyFocusedElement?: (row: number, column: number, focusedElement: HTMLElement) => void | HTMLElement;
247
247
  modifyData?: (row: number, column: number, valueHolder: { value: CellValue }, ioMode: 'get' | 'set') => void;
248
248
  modifyFocusOnTabNavigation?: (tabActivationDir: 'from_above' | 'from_below', visualCoords: CellCoords) => void;
package/pluginHooks.js CHANGED
@@ -650,9 +650,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
650
650
  * @param {string} prop Selection start data source object property name.
651
651
  * @param {number} row2 Selection end visual row index.
652
652
  * @param {string} prop2 Selection end data source object property name.
653
- * @param {object} preventScrolling A reference to the observable object with the `value` property.
654
- * Property `preventScrolling.value` expects a boolean value that
655
- * Handsontable uses to control scroll behavior after selection.
653
+ * @param {object} preventScrolling Object with `value` property where its value change will be observed.
656
654
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
657
655
  * @example
658
656
  * ```js
@@ -702,46 +700,6 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
702
700
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
703
701
  */
704
702
  'afterSelectionEndByProp',
705
- /**
706
- * Fired after the focus position within a selected range is changed.
707
- *
708
- * @since 14.2.0
709
- * @event Hooks#afterSelectionFocusSet
710
- * @param {number} row The focus visual row index position.
711
- * @param {number} column The focus visual column index position.
712
- * @param {object} preventScrolling A reference to the observable object with the `value` property.
713
- * Property `preventScrolling.value` expects a boolean value that
714
- * Handsontable uses to control scroll behavior after selection.
715
- * @example
716
- * ```js
717
- * ::: only-for javascript
718
- * new Handsontable(element, {
719
- * afterSelectionFocusSet: (row, column, preventScrolling) => {
720
- * // If set to `false` (default): when focused cell selection is outside the viewport,
721
- * // Handsontable scrolls the viewport to that cell.
722
- * // If set to `true`: when focused cell selection is outside the viewport,
723
- * // Handsontable doesn't scroll the viewport.
724
- * preventScrolling.value = true;
725
- * }
726
- * })
727
- * ```
728
- * :::
729
- *
730
- * ::: only-for react
731
- * ```jsx
732
- * <HotTable
733
- * afterSelectionFocusSet={(row, column, preventScrolling) => {
734
- * // If set to `false` (default): when focused cell selection is outside the viewport,
735
- * // Handsontable scrolls the viewport to that cell.
736
- * // If set to `true`: when focused cell selection is outside the viewport,
737
- * // Handsontable doesn't scroll the viewport.
738
- * preventScrolling.value = true;
739
- * }}
740
- * />
741
- * ```
742
- * :::
743
- */
744
- 'afterSelectionFocusSet',
745
703
  /**
746
704
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
747
705
  *
@@ -1382,6 +1340,16 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1382
1340
  * @param {number} column Visual column index.
1383
1341
  */
1384
1342
  'modifyColWidth',
1343
+ /**
1344
+ * Fired when rendering the list of values in the multiple-selection component of the Filters dropdown.
1345
+ * The hook allows modifying the displayed values in that component.
1346
+ *
1347
+ * @since 14.2.0
1348
+ * @event Hooks#modifyFiltersMultiSelectValue
1349
+ * @param {object} item The item in the list of values.
1350
+ * @param {object} meta The cell properties object.
1351
+ */
1352
+ 'modifyFiltersMultiSelectValue',
1385
1353
  /**
1386
1354
  * Fired when focusing a cell or a header element. Allows replacing the element to be focused by returning a
1387
1355
  * different HTML element.
package/pluginHooks.mjs CHANGED
@@ -646,9 +646,7 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
646
646
  * @param {string} prop Selection start data source object property name.
647
647
  * @param {number} row2 Selection end visual row index.
648
648
  * @param {string} prop2 Selection end data source object property name.
649
- * @param {object} preventScrolling A reference to the observable object with the `value` property.
650
- * Property `preventScrolling.value` expects a boolean value that
651
- * Handsontable uses to control scroll behavior after selection.
649
+ * @param {object} preventScrolling Object with `value` property where its value change will be observed.
652
650
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
653
651
  * @example
654
652
  * ```js
@@ -698,46 +696,6 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
698
696
  * @param {number} selectionLayerLevel The number which indicates what selection layer is currently modified.
699
697
  */
700
698
  'afterSelectionEndByProp',
701
- /**
702
- * Fired after the focus position within a selected range is changed.
703
- *
704
- * @since 14.2.0
705
- * @event Hooks#afterSelectionFocusSet
706
- * @param {number} row The focus visual row index position.
707
- * @param {number} column The focus visual column index position.
708
- * @param {object} preventScrolling A reference to the observable object with the `value` property.
709
- * Property `preventScrolling.value` expects a boolean value that
710
- * Handsontable uses to control scroll behavior after selection.
711
- * @example
712
- * ```js
713
- * ::: only-for javascript
714
- * new Handsontable(element, {
715
- * afterSelectionFocusSet: (row, column, preventScrolling) => {
716
- * // If set to `false` (default): when focused cell selection is outside the viewport,
717
- * // Handsontable scrolls the viewport to that cell.
718
- * // If set to `true`: when focused cell selection is outside the viewport,
719
- * // Handsontable doesn't scroll the viewport.
720
- * preventScrolling.value = true;
721
- * }
722
- * })
723
- * ```
724
- * :::
725
- *
726
- * ::: only-for react
727
- * ```jsx
728
- * <HotTable
729
- * afterSelectionFocusSet={(row, column, preventScrolling) => {
730
- * // If set to `false` (default): when focused cell selection is outside the viewport,
731
- * // Handsontable scrolls the viewport to that cell.
732
- * // If set to `true`: when focused cell selection is outside the viewport,
733
- * // Handsontable doesn't scroll the viewport.
734
- * preventScrolling.value = true;
735
- * }}
736
- * />
737
- * ```
738
- * :::
739
- */
740
- 'afterSelectionFocusSet',
741
699
  /**
742
700
  * Fired before one or more columns are selected (e.g. During mouse header click or {@link Core#selectColumns} API call).
743
701
  *
@@ -1378,6 +1336,16 @@ const REGISTERED_HOOKS = [/* eslint-disable jsdoc/require-description-complete-s
1378
1336
  * @param {number} column Visual column index.
1379
1337
  */
1380
1338
  'modifyColWidth',
1339
+ /**
1340
+ * Fired when rendering the list of values in the multiple-selection component of the Filters dropdown.
1341
+ * The hook allows modifying the displayed values in that component.
1342
+ *
1343
+ * @since 14.2.0
1344
+ * @event Hooks#modifyFiltersMultiSelectValue
1345
+ * @param {object} item The item in the list of values.
1346
+ * @param {object} meta The cell properties object.
1347
+ */
1348
+ 'modifyFiltersMultiSelectValue',
1381
1349
  /**
1382
1350
  * Fired when focusing a cell or a header element. Allows replacing the element to be focused by returning a
1383
1351
  * different HTML element.
@@ -9,7 +9,6 @@ var _number = require("../../helpers/number");
9
9
  var _console = require("../../helpers/console");
10
10
  var _element = require("../../helpers/dom/element");
11
11
  var _event = require("../../helpers/dom/event");
12
- var _shortcutContexts = require("../../shortcutContexts");
13
12
  var _a11y = require("../../helpers/a11y");
14
13
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
15
14
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
@@ -309,17 +308,12 @@ class CollapsibleColumns extends _base.BasePlugin {
309
308
  col: columnIndex
310
309
  });
311
310
  }
312
-
313
- // prevent default Enter behavior (move to the next row within a selection range)
314
- return false;
315
311
  },
316
312
  runOnlyIf: () => {
317
313
  var _this$hot$getSelected;
318
314
  return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
319
315
  },
320
- group: SHORTCUTS_GROUP,
321
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
322
- position: 'before'
316
+ group: SHORTCUTS_GROUP
323
317
  });
324
318
  }
325
319
 
@@ -18,7 +18,6 @@ import { rangeEach } from "../../helpers/number.mjs";
18
18
  import { warn } from "../../helpers/console.mjs";
19
19
  import { addClass, hasClass, removeClass, fastInnerText, removeAttribute, setAttribute } from "../../helpers/dom/element.mjs";
20
20
  import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
21
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
22
21
  import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
23
22
  export const PLUGIN_KEY = 'collapsibleColumns';
24
23
  export const PLUGIN_PRIORITY = 290;
@@ -306,17 +305,12 @@ export class CollapsibleColumns extends BasePlugin {
306
305
  col: columnIndex
307
306
  });
308
307
  }
309
-
310
- // prevent default Enter behavior (move to the next row within a selection range)
311
- return false;
312
308
  },
313
309
  runOnlyIf: () => {
314
310
  var _this$hot$getSelected;
315
311
  return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
316
312
  },
317
- group: SHORTCUTS_GROUP,
318
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
319
- position: 'before'
313
+ group: SHORTCUTS_GROUP
320
314
  });
321
315
  }
322
316
 
@@ -12,7 +12,6 @@ var _base = require("../base");
12
12
  var _translations = require("../../translations");
13
13
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
14
14
  var _columnStatesManager = require("./columnStatesManager");
15
- var _shortcutContexts = require("../../shortcutContexts");
16
15
  var _utils = require("./utils");
17
16
  var _domHelpers = require("./domHelpers");
18
17
  var _rootComparator = require("./rootComparator");
@@ -250,17 +249,12 @@ class ColumnSorting extends _base.BasePlugin {
250
249
  if (highlight.row === -1 && highlight.col >= 0) {
251
250
  this.sort(this.getColumnNextConfig(highlight.col));
252
251
  }
253
-
254
- // prevent default Enter behavior (move to the next row within a selection range)
255
- return false;
256
252
  },
257
253
  runOnlyIf: () => {
258
254
  var _this$hot$getSelected;
259
255
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
260
256
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
261
257
  },
262
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
263
- position: 'before',
264
258
  group: SHORTCUTS_GROUP
265
259
  });
266
260
  }
@@ -15,7 +15,6 @@ import { BasePlugin } from "../base/index.mjs";
15
15
  import { IndexesSequence, PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
16
16
  import Hooks from "../../pluginHooks.mjs";
17
17
  import { ColumnStatesManager } from "./columnStatesManager.mjs";
18
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
19
18
  import { HEADER_SPAN_CLASS, getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLevelColumnHeader, wasHeaderClickedProperly } from "./utils.mjs";
20
19
  import { getClassesToRemove, getClassesToAdd } from "./domHelpers.mjs";
21
20
  import { rootComparator } from "./rootComparator.mjs";
@@ -246,17 +245,12 @@ export class ColumnSorting extends BasePlugin {
246
245
  if (highlight.row === -1 && highlight.col >= 0) {
247
246
  this.sort(this.getColumnNextConfig(highlight.col));
248
247
  }
249
-
250
- // prevent default Enter behavior (move to the next row within a selection range)
251
- return false;
252
248
  },
253
249
  runOnlyIf: () => {
254
250
  var _this$hot$getSelected;
255
251
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
256
252
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
257
253
  },
258
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
259
- position: 'before',
260
254
  group: SHORTCUTS_GROUP
261
255
  });
262
256
  }
@@ -9,26 +9,10 @@ exports.createDefaultShortcutsList = createDefaultShortcutsList;
9
9
  * @returns {KeyboardShortcut[]}
10
10
  */
11
11
  function createDefaultShortcutsList(menu) {
12
- const {
13
- hot,
14
- hotMenu
15
- } = menu;
16
12
  return [{
17
- keys: [['Control/Meta', 'A']],
18
- forwardToContext: hot.getShortcutManager().getContext('grid'),
13
+ keys: [['Tab'], ['Shift', 'Tab'], ['Control/Meta', 'A']],
14
+ forwardToContext: menu.hot.getShortcutManager().getContext('grid'),
19
15
  callback: () => menu.close(true)
20
- }, {
21
- keys: [['Tab'], ['Shift', 'Tab']],
22
- callback: (event, keys) => {
23
- const settings = hot.getSettings();
24
- const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
25
- if (keys.includes('shift')) {
26
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
27
- } else {
28
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
29
- }
30
- menu.close(true);
31
- }
32
16
  }, {
33
17
  keys: [['Escape']],
34
18
  callback: () => menu.close()
@@ -41,7 +25,7 @@ function createDefaultShortcutsList(menu) {
41
25
  }, {
42
26
  keys: [['ArrowRight']],
43
27
  callback: () => {
44
- const selection = hotMenu.getSelectedLast();
28
+ const selection = menu.hotMenu.getSelectedLast();
45
29
  if (selection) {
46
30
  const subMenu = menu.openSubMenu(selection[0]);
47
31
  if (subMenu) {
@@ -52,7 +36,7 @@ function createDefaultShortcutsList(menu) {
52
36
  }, {
53
37
  keys: [['ArrowLeft']],
54
38
  callback: () => {
55
- const selection = hotMenu.getSelectedLast();
39
+ const selection = menu.hotMenu.getSelectedLast();
56
40
  if (selection && menu.isSubMenu()) {
57
41
  menu.close();
58
42
  if (menu.isSubMenu()) {
@@ -69,11 +53,11 @@ function createDefaultShortcutsList(menu) {
69
53
  }, {
70
54
  keys: [['Enter'], ['Space']],
71
55
  callback: event => {
72
- const selection = hotMenu.getSelectedLast();
56
+ const selection = menu.hotMenu.getSelectedLast();
73
57
  if (!selection) {
74
58
  return;
75
59
  }
76
- if (hotMenu.getSourceDataAtRow(selection[0]).submenu) {
60
+ if (menu.hotMenu.getSourceDataAtRow(selection[0]).submenu) {
77
61
  menu.openSubMenu(selection[0]).getNavigator().toFirstItem();
78
62
  } else {
79
63
  menu.executeCommand(event);
@@ -83,9 +67,9 @@ function createDefaultShortcutsList(menu) {
83
67
  }, {
84
68
  keys: [['PageUp']],
85
69
  callback: () => {
86
- const selection = hotMenu.getSelectedLast();
70
+ const selection = menu.hotMenu.getSelectedLast();
87
71
  if (selection) {
88
- hotMenu.selection.transformStart(-hotMenu.countVisibleRows(), 0);
72
+ menu.hotMenu.selection.transformStart(-menu.hotMenu.countVisibleRows(), 0);
89
73
  } else {
90
74
  menu.getNavigator().toFirstItem();
91
75
  }
@@ -93,9 +77,9 @@ function createDefaultShortcutsList(menu) {
93
77
  }, {
94
78
  keys: [['PageDown']],
95
79
  callback: () => {
96
- const selection = hotMenu.getSelectedLast();
80
+ const selection = menu.hotMenu.getSelectedLast();
97
81
  if (selection) {
98
- hotMenu.selection.transformStart(hotMenu.countVisibleRows(), 0);
82
+ menu.hotMenu.selection.transformStart(menu.hotMenu.countVisibleRows(), 0);
99
83
  } else {
100
84
  menu.getNavigator().toLastItem();
101
85
  }
@@ -5,26 +5,10 @@
5
5
  * @returns {KeyboardShortcut[]}
6
6
  */
7
7
  export function createDefaultShortcutsList(menu) {
8
- const {
9
- hot,
10
- hotMenu
11
- } = menu;
12
8
  return [{
13
- keys: [['Control/Meta', 'A']],
14
- forwardToContext: hot.getShortcutManager().getContext('grid'),
9
+ keys: [['Tab'], ['Shift', 'Tab'], ['Control/Meta', 'A']],
10
+ forwardToContext: menu.hot.getShortcutManager().getContext('grid'),
15
11
  callback: () => menu.close(true)
16
- }, {
17
- keys: [['Tab'], ['Shift', 'Tab']],
18
- callback: (event, keys) => {
19
- const settings = hot.getSettings();
20
- const tabMoves = typeof settings.tabMoves === 'function' ? settings.tabMoves(event) : settings.tabMoves;
21
- if (keys.includes('shift')) {
22
- hot.selection.transformStart(-tabMoves.row, -tabMoves.col);
23
- } else {
24
- hot.selection.transformStart(tabMoves.row, tabMoves.col);
25
- }
26
- menu.close(true);
27
- }
28
12
  }, {
29
13
  keys: [['Escape']],
30
14
  callback: () => menu.close()
@@ -37,7 +21,7 @@ export function createDefaultShortcutsList(menu) {
37
21
  }, {
38
22
  keys: [['ArrowRight']],
39
23
  callback: () => {
40
- const selection = hotMenu.getSelectedLast();
24
+ const selection = menu.hotMenu.getSelectedLast();
41
25
  if (selection) {
42
26
  const subMenu = menu.openSubMenu(selection[0]);
43
27
  if (subMenu) {
@@ -48,7 +32,7 @@ export function createDefaultShortcutsList(menu) {
48
32
  }, {
49
33
  keys: [['ArrowLeft']],
50
34
  callback: () => {
51
- const selection = hotMenu.getSelectedLast();
35
+ const selection = menu.hotMenu.getSelectedLast();
52
36
  if (selection && menu.isSubMenu()) {
53
37
  menu.close();
54
38
  if (menu.isSubMenu()) {
@@ -65,11 +49,11 @@ export function createDefaultShortcutsList(menu) {
65
49
  }, {
66
50
  keys: [['Enter'], ['Space']],
67
51
  callback: event => {
68
- const selection = hotMenu.getSelectedLast();
52
+ const selection = menu.hotMenu.getSelectedLast();
69
53
  if (!selection) {
70
54
  return;
71
55
  }
72
- if (hotMenu.getSourceDataAtRow(selection[0]).submenu) {
56
+ if (menu.hotMenu.getSourceDataAtRow(selection[0]).submenu) {
73
57
  menu.openSubMenu(selection[0]).getNavigator().toFirstItem();
74
58
  } else {
75
59
  menu.executeCommand(event);
@@ -79,9 +63,9 @@ export function createDefaultShortcutsList(menu) {
79
63
  }, {
80
64
  keys: [['PageUp']],
81
65
  callback: () => {
82
- const selection = hotMenu.getSelectedLast();
66
+ const selection = menu.hotMenu.getSelectedLast();
83
67
  if (selection) {
84
- hotMenu.selection.transformStart(-hotMenu.countVisibleRows(), 0);
68
+ menu.hotMenu.selection.transformStart(-menu.hotMenu.countVisibleRows(), 0);
85
69
  } else {
86
70
  menu.getNavigator().toFirstItem();
87
71
  }
@@ -89,9 +73,9 @@ export function createDefaultShortcutsList(menu) {
89
73
  }, {
90
74
  keys: [['PageDown']],
91
75
  callback: () => {
92
- const selection = hotMenu.getSelectedLast();
76
+ const selection = menu.hotMenu.getSelectedLast();
93
77
  if (selection) {
94
- hotMenu.selection.transformStart(hotMenu.countVisibleRows(), 0);
78
+ menu.hotMenu.selection.transformStart(menu.hotMenu.countVisibleRows(), 0);
95
79
  } else {
96
80
  menu.getNavigator().toLastItem();
97
81
  }
@@ -13,6 +13,7 @@ var _base = require("./_base");
13
13
  var _multipleSelect = require("../ui/multipleSelect");
14
14
  var _constants2 = require("../constants");
15
15
  var _conditionRegisterer = require("../conditionRegisterer");
16
+ var _numericRenderer = require("../../../renderers/numericRenderer");
16
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
19
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -26,12 +27,29 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
26
27
  * @class ValueComponent
27
28
  */
28
29
  var _onInputKeyDown = /*#__PURE__*/new WeakSet();
30
+ var _triggerModifyMultipleSelectionValueHook = /*#__PURE__*/new WeakSet();
31
+ var _onModifyDisplayedValue = /*#__PURE__*/new WeakSet();
29
32
  class ValueComponent extends _base.BaseComponent {
30
33
  constructor(hotInstance, options) {
31
34
  super(hotInstance, {
32
35
  id: options.id,
33
36
  stateless: false
34
37
  });
38
+ /**
39
+ * Modify the value displayed in the multiple select list.
40
+ *
41
+ * @param {*} value Cell value.
42
+ * @param {object} meta The cell meta object.
43
+ * @returns {*} Returns the modified value.
44
+ */
45
+ _classPrivateMethodInitSpec(this, _onModifyDisplayedValue);
46
+ /**
47
+ * Trigger the `modifyFiltersMultiSelectValue` hook.
48
+ *
49
+ * @param {object} item Item from the multiple select list.
50
+ * @param {Map} metaMap Map of row meta objects.
51
+ */
52
+ _classPrivateMethodInitSpec(this, _triggerModifyMultipleSelectionValueHook);
35
53
  /**
36
54
  * Key down listener.
37
55
  *
@@ -56,6 +74,7 @@ class ValueComponent extends _base.BaseComponent {
56
74
  */
57
75
  registerHooks() {
58
76
  this.getMultipleSelectElement().addLocalHook('keydown', event => _classPrivateMethodGet(this, _onInputKeyDown, _onInputKeyDown2).call(this, event)).addLocalHook('listTabKeydown', event => this.runLocalHooks('listTabKeydown', event));
77
+ this.hot.addHook('modifyFiltersMultiSelectValue', (value, meta) => _classPrivateMethodGet(this, _onModifyDisplayedValue, _onModifyDisplayedValue2).call(this, value, meta));
59
78
  }
60
79
 
61
80
  /**
@@ -113,15 +132,19 @@ class ValueComponent extends _base.BaseComponent {
113
132
  const state = {};
114
133
  const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
115
134
  if (firstByValueCondition) {
116
- const rowValues = (0, _utils.unifyColumnValues)((0, _array.arrayMap)(filteredRowsFactory(physicalColumn, conditionsStack), row => row.value));
135
+ const filteredRows = filteredRowsFactory(physicalColumn, conditionsStack);
136
+ const rowValues = (0, _array.arrayMap)(filteredRows, row => row.value);
137
+ const rowMetaMap = new Map(filteredRows.map(row => [row.value, this.hot.getCellMeta(row.meta.visualRow, row.meta.visualCol)]));
138
+ const unifiedRowValues = (0, _utils.unifyColumnValues)(rowValues);
117
139
  if (conditionArgsChange) {
118
140
  firstByValueCondition.args[0] = conditionArgsChange;
119
141
  }
120
142
  const selectedValues = [];
121
- const itemsSnapshot = (0, _utils.intersectValues)(rowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
143
+ const itemsSnapshot = (0, _utils.intersectValues)(unifiedRowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
122
144
  if (item.checked) {
123
145
  selectedValues.push(item.value);
124
146
  }
147
+ _classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
125
148
  });
126
149
  const column = stateInfo.editedConditionStack.column;
127
150
  state.locale = this.hot.getCellMeta(0, column).locale;
@@ -182,8 +205,13 @@ class ValueComponent extends _base.BaseComponent {
182
205
  */
183
206
  reset() {
184
207
  const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
185
- const values = (0, _utils.unifyColumnValues)(this._getColumnVisibleValues());
186
- const items = (0, _utils.intersectValues)(values, values, defaultBlankCellValue);
208
+ const rowEntries = this._getColumnVisibleValues();
209
+ const rowValues = rowEntries.map(entry => entry.value);
210
+ const rowMetaMap = new Map(rowEntries.map(row => [row.value, row.meta]));
211
+ const values = (0, _utils.unifyColumnValues)(rowValues);
212
+ const items = (0, _utils.intersectValues)(values, values, defaultBlankCellValue, item => {
213
+ _classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
214
+ });
187
215
  this.getMultipleSelectElement().setItems(items);
188
216
  super.reset();
189
217
  this.getMultipleSelectElement().setValue(values);
@@ -203,7 +231,12 @@ class ValueComponent extends _base.BaseComponent {
203
231
  if (selectedColumn === null) {
204
232
  return [];
205
233
  }
206
- return (0, _array.arrayMap)(this.hot.getDataAtCol(selectedColumn.visualIndex), v => (0, _utils.toEmptyString)(v));
234
+ return (0, _array.arrayMap)(this.hot.getDataAtCol(selectedColumn.visualIndex), (v, rowIndex) => {
235
+ return {
236
+ value: (0, _utils.toEmptyString)(v),
237
+ meta: this.hot.getCellMeta(selectedColumn.visualIndex, rowIndex)
238
+ };
239
+ });
207
240
  }
208
241
  }
209
242
  exports.ValueComponent = ValueComponent;
@@ -212,4 +245,17 @@ function _onInputKeyDown2(event) {
212
245
  this.runLocalHooks('cancel');
213
246
  (0, _event.stopImmediatePropagation)(event);
214
247
  }
248
+ }
249
+ function _triggerModifyMultipleSelectionValueHook2(item, metaMap) {
250
+ if (this.hot.hasHook('modifyFiltersMultiSelectValue')) {
251
+ item.visualValue = this.hot.runHooks('modifyFiltersMultiSelectValue', item.visualValue, metaMap.get(item.value));
252
+ }
253
+ }
254
+ function _onModifyDisplayedValue2(value, meta) {
255
+ switch (meta.type) {
256
+ case 'numeric':
257
+ return (0, _numericRenderer.getRenderedValue)(value, meta);
258
+ default:
259
+ return value;
260
+ }
215
261
  }