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
@@ -16,17 +16,35 @@ import { BaseComponent } from "./_base.mjs";
16
16
  import { MultipleSelectUI } from "../ui/multipleSelect.mjs";
17
17
  import { CONDITION_BY_VALUE, CONDITION_NONE } from "../constants.mjs";
18
18
  import { getConditionDescriptor } from "../conditionRegisterer.mjs";
19
+ import { getRenderedValue as getRenderedNumericValue } from "../../../renderers/numericRenderer/index.mjs";
19
20
  /**
20
21
  * @private
21
22
  * @class ValueComponent
22
23
  */
23
24
  var _onInputKeyDown = /*#__PURE__*/new WeakSet();
25
+ var _triggerModifyMultipleSelectionValueHook = /*#__PURE__*/new WeakSet();
26
+ var _onModifyDisplayedValue = /*#__PURE__*/new WeakSet();
24
27
  export class ValueComponent extends BaseComponent {
25
28
  constructor(hotInstance, options) {
26
29
  super(hotInstance, {
27
30
  id: options.id,
28
31
  stateless: false
29
32
  });
33
+ /**
34
+ * Modify the value displayed in the multiple select list.
35
+ *
36
+ * @param {*} value Cell value.
37
+ * @param {object} meta The cell meta object.
38
+ * @returns {*} Returns the modified value.
39
+ */
40
+ _classPrivateMethodInitSpec(this, _onModifyDisplayedValue);
41
+ /**
42
+ * Trigger the `modifyFiltersMultiSelectValue` hook.
43
+ *
44
+ * @param {object} item Item from the multiple select list.
45
+ * @param {Map} metaMap Map of row meta objects.
46
+ */
47
+ _classPrivateMethodInitSpec(this, _triggerModifyMultipleSelectionValueHook);
30
48
  /**
31
49
  * Key down listener.
32
50
  *
@@ -51,6 +69,7 @@ export class ValueComponent extends BaseComponent {
51
69
  */
52
70
  registerHooks() {
53
71
  this.getMultipleSelectElement().addLocalHook('keydown', event => _classPrivateMethodGet(this, _onInputKeyDown, _onInputKeyDown2).call(this, event)).addLocalHook('listTabKeydown', event => this.runLocalHooks('listTabKeydown', event));
72
+ this.hot.addHook('modifyFiltersMultiSelectValue', (value, meta) => _classPrivateMethodGet(this, _onModifyDisplayedValue, _onModifyDisplayedValue2).call(this, value, meta));
54
73
  }
55
74
 
56
75
  /**
@@ -108,15 +127,19 @@ export class ValueComponent extends BaseComponent {
108
127
  const state = {};
109
128
  const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
110
129
  if (firstByValueCondition) {
111
- const rowValues = unifyColumnValues(arrayMap(filteredRowsFactory(physicalColumn, conditionsStack), row => row.value));
130
+ const filteredRows = filteredRowsFactory(physicalColumn, conditionsStack);
131
+ const rowValues = arrayMap(filteredRows, row => row.value);
132
+ const rowMetaMap = new Map(filteredRows.map(row => [row.value, this.hot.getCellMeta(row.meta.visualRow, row.meta.visualCol)]));
133
+ const unifiedRowValues = unifyColumnValues(rowValues);
112
134
  if (conditionArgsChange) {
113
135
  firstByValueCondition.args[0] = conditionArgsChange;
114
136
  }
115
137
  const selectedValues = [];
116
- const itemsSnapshot = intersectValues(rowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
138
+ const itemsSnapshot = intersectValues(unifiedRowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
117
139
  if (item.checked) {
118
140
  selectedValues.push(item.value);
119
141
  }
142
+ _classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
120
143
  });
121
144
  const column = stateInfo.editedConditionStack.column;
122
145
  state.locale = this.hot.getCellMeta(0, column).locale;
@@ -177,8 +200,13 @@ export class ValueComponent extends BaseComponent {
177
200
  */
178
201
  reset() {
179
202
  const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
180
- const values = unifyColumnValues(this._getColumnVisibleValues());
181
- const items = intersectValues(values, values, defaultBlankCellValue);
203
+ const rowEntries = this._getColumnVisibleValues();
204
+ const rowValues = rowEntries.map(entry => entry.value);
205
+ const rowMetaMap = new Map(rowEntries.map(row => [row.value, row.meta]));
206
+ const values = unifyColumnValues(rowValues);
207
+ const items = intersectValues(values, values, defaultBlankCellValue, item => {
208
+ _classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
209
+ });
182
210
  this.getMultipleSelectElement().setItems(items);
183
211
  super.reset();
184
212
  this.getMultipleSelectElement().setValue(values);
@@ -198,7 +226,12 @@ export class ValueComponent extends BaseComponent {
198
226
  if (selectedColumn === null) {
199
227
  return [];
200
228
  }
201
- return arrayMap(this.hot.getDataAtCol(selectedColumn.visualIndex), v => toEmptyString(v));
229
+ return arrayMap(this.hot.getDataAtCol(selectedColumn.visualIndex), (v, rowIndex) => {
230
+ return {
231
+ value: toEmptyString(v),
232
+ meta: this.hot.getCellMeta(selectedColumn.visualIndex, rowIndex)
233
+ };
234
+ });
202
235
  }
203
236
  }
204
237
  function _onInputKeyDown2(event) {
@@ -206,4 +239,17 @@ function _onInputKeyDown2(event) {
206
239
  this.runLocalHooks('cancel');
207
240
  stopImmediatePropagation(event);
208
241
  }
242
+ }
243
+ function _triggerModifyMultipleSelectionValueHook2(item, metaMap) {
244
+ if (this.hot.hasHook('modifyFiltersMultiSelectValue')) {
245
+ item.visualValue = this.hot.runHooks('modifyFiltersMultiSelectValue', item.visualValue, metaMap.get(item.value));
246
+ }
247
+ }
248
+ function _onModifyDisplayedValue2(value, meta) {
249
+ switch (meta.type) {
250
+ case 'numeric':
251
+ return getRenderedNumericValue(value, meta);
252
+ default:
253
+ return value;
254
+ }
209
255
  }
@@ -77,7 +77,7 @@ function toEmptyString(value) {
77
77
  }
78
78
 
79
79
  /**
80
- * Unify column values (replace `null` and `undefined` values into empty string, unique values and sort them).
80
+ * Unify column values (remove duplicated values and sort them).
81
81
  *
82
82
  * @param {Array} values An array of values.
83
83
  * @returns {Array}
@@ -68,7 +68,7 @@ export function toEmptyString(value) {
68
68
  }
69
69
 
70
70
  /**
71
- * Unify column values (replace `null` and `undefined` values into empty string, unique values and sort them).
71
+ * Unify column values (remove duplicated values and sort them).
72
72
  *
73
73
  * @param {Array} values An array of values.
74
74
  * @returns {Array}
@@ -1031,10 +1031,8 @@ function _onAfterIsMultipleSelection2(isMultiple) {
1031
1031
  if (isMultiple) {
1032
1032
  const mergedCells = this.mergedCellsCollection.mergedCells;
1033
1033
  const selectionRange = this.hot.getSelectedRangeLast();
1034
- const topStartCoords = selectionRange.getTopStartCorner();
1035
- const bottomEndCoords = selectionRange.getBottomEndCorner();
1036
1034
  for (let group = 0; group < mergedCells.length; group += 1) {
1037
- if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
1035
+ if (selectionRange.from.row === mergedCells[group].row && selectionRange.from.col === mergedCells[group].col && selectionRange.to.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && selectionRange.to.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
1038
1036
  return false;
1039
1037
  }
1040
1038
  }
@@ -1026,10 +1026,8 @@ function _onAfterIsMultipleSelection2(isMultiple) {
1026
1026
  if (isMultiple) {
1027
1027
  const mergedCells = this.mergedCellsCollection.mergedCells;
1028
1028
  const selectionRange = this.hot.getSelectedRangeLast();
1029
- const topStartCoords = selectionRange.getTopStartCorner();
1030
- const bottomEndCoords = selectionRange.getBottomEndCorner();
1031
1029
  for (let group = 0; group < mergedCells.length; group += 1) {
1032
- if (topStartCoords.row === mergedCells[group].row && topStartCoords.col === mergedCells[group].col && bottomEndCoords.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && bottomEndCoords.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
1030
+ if (selectionRange.from.row === mergedCells[group].row && selectionRange.from.col === mergedCells[group].col && selectionRange.to.row === mergedCells[group].row + mergedCells[group].rowspan - 1 && selectionRange.to.col === mergedCells[group].col + mergedCells[group].colspan - 1) {
1033
1031
  return false;
1034
1032
  }
1035
1033
  }
@@ -9,7 +9,6 @@ var _element = require("../../helpers/dom/element");
9
9
  var _rootComparator = require("./rootComparator");
10
10
  var _utils2 = require("./utils");
11
11
  var _domHelpers = require("./domHelpers");
12
- var _shortcutContexts = require("../../shortcutContexts");
13
12
  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; }
14
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(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); }
@@ -131,17 +130,12 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
131
130
  if (highlight.row === -1 && highlight.col >= 0) {
132
131
  this.sort(this.getNextSortConfig(highlight.col, _columnSorting.APPEND_COLUMN_CONFIG_STRATEGY));
133
132
  }
134
-
135
- // prevent default Enter behavior (move to the next row within a selection range)
136
- return false;
137
133
  },
138
134
  runOnlyIf: () => {
139
135
  var _this$hot$getSelected;
140
136
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
141
137
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
142
138
  },
143
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
144
- position: 'before',
145
139
  group: SHORTCUTS_GROUP
146
140
  });
147
141
  }
@@ -9,7 +9,6 @@ import { addClass, removeClass } from "../../helpers/dom/element.mjs";
9
9
  import { rootComparator } from "./rootComparator.mjs";
10
10
  import { warnAboutPluginsConflict } from "./utils.mjs";
11
11
  import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
12
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
13
12
  export const PLUGIN_KEY = 'multiColumnSorting';
14
13
  export const PLUGIN_PRIORITY = 170;
15
14
  const CONFLICTED_PLUGIN_KEY = 'columnSorting';
@@ -128,17 +127,12 @@ export class MultiColumnSorting extends ColumnSorting {
128
127
  if (highlight.row === -1 && highlight.col >= 0) {
129
128
  this.sort(this.getNextSortConfig(highlight.col, APPEND_COLUMN_CONFIG_STRATEGY));
130
129
  }
131
-
132
- // prevent default Enter behavior (move to the next row within a selection range)
133
- return false;
134
130
  },
135
131
  runOnlyIf: () => {
136
132
  var _this$hot$getSelected;
137
133
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
138
134
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
139
135
  },
140
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
141
- position: 'before',
142
136
  group: SHORTCUTS_GROUP
143
137
  });
144
138
  }
@@ -364,7 +364,6 @@ class NestedHeaders extends _base.BasePlugin {
364
364
  return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
365
365
  });
366
366
  this.addHook('afterSelection', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
367
- this.addHook('afterSelectionFocusSet', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
368
367
  this.addHook('beforeViewportScrollHorizontally', function () {
369
368
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
370
369
  args[_key8] = arguments[_key8];
@@ -360,7 +360,6 @@ export class NestedHeaders extends BasePlugin {
360
360
  return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
361
361
  });
362
362
  this.addHook('afterSelection', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
363
- this.addHook('afterSelectionFocusSet', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
364
363
  this.addHook('beforeViewportScrollHorizontally', function () {
365
364
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
366
365
  args[_key8] = arguments[_key8];
@@ -11,7 +11,6 @@ var _contextMenu = _interopRequireDefault(require("./ui/contextMenu"));
11
11
  var _console = require("../../helpers/console");
12
12
  var _data = require("../../helpers/data");
13
13
  var _translations = require("../../translations");
14
- var _shortcutContexts = require("../../shortcutContexts");
15
14
  var _rowMoveController = _interopRequireDefault(require("./utils/rowMoveController"));
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -401,18 +400,13 @@ class NestedRows extends _base.BasePlugin {
401
400
  this.collapsingUI.collapseChildren(row);
402
401
  }
403
402
  }
404
-
405
- // prevent default Enter behavior (move to the next row within a selection range)
406
- return false;
407
403
  },
408
404
  runOnlyIf: () => {
409
405
  var _this$hot$getSelected;
410
406
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
411
407
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
412
408
  },
413
- group: SHORTCUTS_GROUP,
414
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
415
- position: 'before'
409
+ group: SHORTCUTS_GROUP
416
410
  });
417
411
  }
418
412
 
@@ -20,7 +20,6 @@ import ContextMenuUI from "./ui/contextMenu.mjs";
20
20
  import { error } from "../../helpers/console.mjs";
21
21
  import { isArrayOfObjects } from "../../helpers/data.mjs";
22
22
  import { TrimmingMap } from "../../translations/index.mjs";
23
- import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
24
23
  import RowMoveController from "./utils/rowMoveController.mjs";
25
24
  export const PLUGIN_KEY = 'nestedRows';
26
25
  export const PLUGIN_PRIORITY = 300;
@@ -397,18 +396,13 @@ export class NestedRows extends BasePlugin {
397
396
  this.collapsingUI.collapseChildren(row);
398
397
  }
399
398
  }
400
-
401
- // prevent default Enter behavior (move to the next row within a selection range)
402
- return false;
403
399
  },
404
400
  runOnlyIf: () => {
405
401
  var _this$hot$getSelected;
406
402
  const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
407
403
  return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
408
404
  },
409
- group: SHORTCUTS_GROUP,
410
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
411
- position: 'before'
405
+ group: SHORTCUTS_GROUP
412
406
  });
413
407
  }
414
408
 
@@ -139,9 +139,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
139
139
  const shortcutManager = hotInstance.getShortcutManager();
140
140
  const gridContext = shortcutManager.getContext('grid');
141
141
  const config = {
142
- group: SHORTCUTS_GROUP,
143
- relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
144
- position: 'before'
142
+ group: SHORTCUTS_GROUP
145
143
  };
146
144
  gridContext.addShortcuts([{
147
145
  keys: [['space']],
@@ -161,7 +159,9 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
161
159
  callback: () => {
162
160
  changeSelectedCheckboxesState(true);
163
161
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
164
- }
162
+ },
163
+ relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
164
+ position: 'before'
165
165
  }], config);
166
166
  }
167
167
 
@@ -134,9 +134,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
134
134
  const shortcutManager = hotInstance.getShortcutManager();
135
135
  const gridContext = shortcutManager.getContext('grid');
136
136
  const config = {
137
- group: SHORTCUTS_GROUP,
138
- relativeToGroup: SHORTCUTS_GROUP_EDITOR,
139
- position: 'before'
137
+ group: SHORTCUTS_GROUP
140
138
  };
141
139
  gridContext.addShortcuts([{
142
140
  keys: [['space']],
@@ -156,7 +154,9 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
156
154
  callback: () => {
157
155
  changeSelectedCheckboxesState(true);
158
156
  return !areSelectedCheckboxCells(); // False blocks next action associated with the keyboard shortcut.
159
- }
157
+ },
158
+ relativeToGroup: SHORTCUTS_GROUP_EDITOR,
159
+ position: 'before'
160
160
  }], config);
161
161
  }
162
162
 
@@ -3,4 +3,5 @@
3
3
  exports.__esModule = true;
4
4
  var _numericRenderer = require("./numericRenderer");
5
5
  exports.RENDERER_TYPE = _numericRenderer.RENDERER_TYPE;
6
- exports.numericRenderer = _numericRenderer.numericRenderer;
6
+ exports.numericRenderer = _numericRenderer.numericRenderer;
7
+ exports.getRenderedValue = _numericRenderer.getRenderedValue;
@@ -1 +1 @@
1
- export { RENDERER_TYPE, numericRenderer } from "./numericRenderer.mjs";
1
+ export { RENDERER_TYPE, numericRenderer, getRenderedValue } from "./numericRenderer.mjs";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.getRenderedValue = getRenderedValue;
4
5
  exports.numericRenderer = numericRenderer;
5
6
  require("core-js/modules/es.array.push.js");
6
7
  var _numbro = _interopRequireDefault(require("numbro"));
@@ -9,6 +10,31 @@ var _number = require("../../helpers/number");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  const RENDERER_TYPE = exports.RENDERER_TYPE = 'numeric';
11
12
 
13
+ /**
14
+ * Get the rendered value.
15
+ *
16
+ * @param {*} value Value to be rendered.
17
+ * @param {CellMeta} cellProperties Cell meta object.
18
+ * @returns {*} Returns the rendered value.
19
+ */
20
+ function getRenderedValue(value, cellProperties) {
21
+ if ((0, _number.isNumeric)(value)) {
22
+ const numericFormat = cellProperties.numericFormat;
23
+ const cellCulture = numericFormat && numericFormat.culture || '-';
24
+ const cellFormatPattern = numericFormat && numericFormat.pattern;
25
+ if (typeof cellCulture !== 'undefined' && !_numbro.default.languages()[cellCulture]) {
26
+ const shortTag = cellCulture.replace('-', '');
27
+ const langData = _numbro.default.allLanguages ? _numbro.default.allLanguages[cellCulture] : _numbro.default[shortTag];
28
+ if (langData) {
29
+ _numbro.default.registerLanguage(langData);
30
+ }
31
+ }
32
+ _numbro.default.setLanguage(cellCulture);
33
+ value = (0, _numbro.default)(value).format(cellFormatPattern || '0');
34
+ }
35
+ return value;
36
+ }
37
+
12
38
  /**
13
39
  * Numeric cell renderer.
14
40
  *
@@ -24,20 +50,9 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'numeric';
24
50
  function numericRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
25
51
  let newValue = value;
26
52
  if ((0, _number.isNumeric)(newValue)) {
27
- const numericFormat = cellProperties.numericFormat;
28
- const cellCulture = numericFormat && numericFormat.culture || '-';
29
- const cellFormatPattern = numericFormat && numericFormat.pattern;
30
53
  const className = cellProperties.className || '';
31
54
  const classArr = className.length ? className.split(' ') : [];
32
- if (typeof cellCulture !== 'undefined' && !_numbro.default.languages()[cellCulture]) {
33
- const shortTag = cellCulture.replace('-', '');
34
- const langData = _numbro.default.allLanguages ? _numbro.default.allLanguages[cellCulture] : _numbro.default[shortTag];
35
- if (langData) {
36
- _numbro.default.registerLanguage(langData);
37
- }
38
- }
39
- _numbro.default.setLanguage(cellCulture);
40
- newValue = (0, _numbro.default)(newValue).format(cellFormatPattern || '0');
55
+ newValue = getRenderedValue(newValue, cellProperties);
41
56
  if (classArr.indexOf('htLeft') < 0 && classArr.indexOf('htCenter') < 0 && classArr.indexOf('htRight') < 0 && classArr.indexOf('htJustify') < 0) {
42
57
  classArr.push('htRight');
43
58
  }
@@ -4,6 +4,31 @@ import { textRenderer } from "../textRenderer/index.mjs";
4
4
  import { isNumeric } from "../../helpers/number.mjs";
5
5
  export const RENDERER_TYPE = 'numeric';
6
6
 
7
+ /**
8
+ * Get the rendered value.
9
+ *
10
+ * @param {*} value Value to be rendered.
11
+ * @param {CellMeta} cellProperties Cell meta object.
12
+ * @returns {*} Returns the rendered value.
13
+ */
14
+ export function getRenderedValue(value, cellProperties) {
15
+ if (isNumeric(value)) {
16
+ const numericFormat = cellProperties.numericFormat;
17
+ const cellCulture = numericFormat && numericFormat.culture || '-';
18
+ const cellFormatPattern = numericFormat && numericFormat.pattern;
19
+ if (typeof cellCulture !== 'undefined' && !numbro.languages()[cellCulture]) {
20
+ const shortTag = cellCulture.replace('-', '');
21
+ const langData = numbro.allLanguages ? numbro.allLanguages[cellCulture] : numbro[shortTag];
22
+ if (langData) {
23
+ numbro.registerLanguage(langData);
24
+ }
25
+ }
26
+ numbro.setLanguage(cellCulture);
27
+ value = numbro(value).format(cellFormatPattern || '0');
28
+ }
29
+ return value;
30
+ }
31
+
7
32
  /**
8
33
  * Numeric cell renderer.
9
34
  *
@@ -19,20 +44,9 @@ export const RENDERER_TYPE = 'numeric';
19
44
  export function numericRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
20
45
  let newValue = value;
21
46
  if (isNumeric(newValue)) {
22
- const numericFormat = cellProperties.numericFormat;
23
- const cellCulture = numericFormat && numericFormat.culture || '-';
24
- const cellFormatPattern = numericFormat && numericFormat.pattern;
25
47
  const className = cellProperties.className || '';
26
48
  const classArr = className.length ? className.split(' ') : [];
27
- if (typeof cellCulture !== 'undefined' && !numbro.languages()[cellCulture]) {
28
- const shortTag = cellCulture.replace('-', '');
29
- const langData = numbro.allLanguages ? numbro.allLanguages[cellCulture] : numbro[shortTag];
30
- if (langData) {
31
- numbro.registerLanguage(langData);
32
- }
33
- }
34
- numbro.setLanguage(cellCulture);
35
- newValue = numbro(newValue).format(cellFormatPattern || '0');
49
+ newValue = getRenderedValue(newValue, cellProperties);
36
50
  if (classArr.indexOf('htLeft') < 0 && classArr.indexOf('htCenter') < 0 && classArr.indexOf('htRight') < 0 && classArr.indexOf('htJustify') < 0) {
37
51
  classArr.push('htRight');
38
52
  }