handsontable 14.1.0 → 14.2.0-next-7ae341f-20240229

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.
Files changed (161) hide show
  1. package/3rdparty/walkontable/src/core/_base.js +12 -0
  2. package/3rdparty/walkontable/src/core/_base.mjs +12 -0
  3. package/3rdparty/walkontable/src/scroll.js +131 -98
  4. package/3rdparty/walkontable/src/scroll.mjs +133 -100
  5. package/3rdparty/walkontable/src/selection/border/border.js +3 -3
  6. package/3rdparty/walkontable/src/selection/border/border.mjs +3 -3
  7. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
  8. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
  9. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
  10. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
  11. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
  12. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
  13. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
  14. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
  15. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
  16. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
  17. package/3rdparty/walkontable/src/table.js +2 -0
  18. package/3rdparty/walkontable/src/table.mjs +2 -0
  19. package/3rdparty/walkontable/src/viewport.js +9 -0
  20. package/3rdparty/walkontable/src/viewport.mjs +10 -1
  21. package/CHANGELOG.md +36 -0
  22. package/base.js +2 -2
  23. package/base.mjs +2 -2
  24. package/core/index.js +6 -0
  25. package/core/index.mjs +2 -1
  26. package/core/viewportScroll/index.js +65 -0
  27. package/core/viewportScroll/index.mjs +61 -0
  28. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
  29. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
  30. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
  31. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
  32. package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
  33. package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
  34. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
  35. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
  36. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
  37. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
  38. package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
  39. package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
  40. package/core.d.ts +1 -1
  41. package/core.js +11 -52
  42. package/core.mjs +12 -53
  43. package/dataMap/metaManager/index.js +1 -1
  44. package/dataMap/metaManager/index.mjs +1 -1
  45. package/dataMap/metaManager/metaLayers/cellMeta.js +6 -1
  46. package/dataMap/metaManager/metaLayers/cellMeta.mjs +6 -1
  47. package/dataMap/metaManager/metaSchema.js +36 -12
  48. package/dataMap/metaManager/metaSchema.mjs +36 -12
  49. package/dist/handsontable.css +2 -2
  50. package/dist/handsontable.full.css +2 -2
  51. package/dist/handsontable.full.js +2996 -1928
  52. package/dist/handsontable.full.min.css +2 -2
  53. package/dist/handsontable.full.min.js +42 -42
  54. package/dist/handsontable.js +2998 -1930
  55. package/dist/handsontable.min.css +2 -2
  56. package/dist/handsontable.min.js +25 -25
  57. package/dist/languages/all.js +130 -25
  58. package/dist/languages/all.min.js +1 -1
  59. package/dist/languages/hr-HR.js +167 -0
  60. package/dist/languages/hr-HR.min.js +1 -0
  61. package/editorManager.js +15 -4
  62. package/editorManager.mjs +15 -4
  63. package/editors/autocompleteEditor/autocompleteEditor.js +2 -2
  64. package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -2
  65. package/editors/baseEditor/baseEditor.js +1 -1
  66. package/editors/baseEditor/baseEditor.mjs +1 -1
  67. package/editors/checkboxEditor/checkboxEditor.js +5 -4
  68. package/editors/checkboxEditor/checkboxEditor.mjs +5 -4
  69. package/editors/dateEditor/dateEditor.js +1 -1
  70. package/editors/dateEditor/dateEditor.mjs +1 -1
  71. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  72. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  73. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  74. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  75. package/editors/selectEditor/selectEditor.js +1 -1
  76. package/editors/selectEditor/selectEditor.mjs +1 -1
  77. package/editors/textEditor/textEditor.js +1 -2
  78. package/editors/textEditor/textEditor.mjs +1 -2
  79. package/editors/timeEditor/timeEditor.js +1 -1
  80. package/editors/timeEditor/timeEditor.mjs +1 -1
  81. package/helpers/mixed.js +2 -2
  82. package/helpers/mixed.mjs +2 -2
  83. package/helpers/moves.js +86 -0
  84. package/helpers/moves.mjs +82 -0
  85. package/i18n/languages/hr-HR.js +96 -0
  86. package/i18n/languages/hr-HR.mjs +90 -0
  87. package/i18n/languages/index.js +2 -0
  88. package/i18n/languages/index.mjs +2 -1
  89. package/languages/all.js +130 -25
  90. package/languages/hr-HR.js +167 -0
  91. package/languages/hr-HR.mjs +92 -0
  92. package/languages/index.js +130 -25
  93. package/languages/index.mjs +2 -1
  94. package/package.json +11 -1
  95. package/pluginHooks.d.ts +4 -2
  96. package/pluginHooks.js +33 -3
  97. package/pluginHooks.mjs +33 -3
  98. package/plugins/autoColumnSize/autoColumnSize.js +6 -1
  99. package/plugins/autoColumnSize/autoColumnSize.mjs +6 -1
  100. package/plugins/autoRowSize/autoRowSize.js +5 -0
  101. package/plugins/autoRowSize/autoRowSize.mjs +5 -0
  102. package/plugins/autofill/autofill.js +3 -2
  103. package/plugins/autofill/autofill.mjs +3 -2
  104. package/plugins/dropdownMenu/dropdownMenu.js +58 -4
  105. package/plugins/dropdownMenu/dropdownMenu.mjs +58 -4
  106. package/plugins/filters/component/value.js +51 -5
  107. package/plugins/filters/component/value.mjs +51 -5
  108. package/plugins/filters/utils.js +1 -1
  109. package/plugins/filters/utils.mjs +1 -1
  110. package/plugins/formulas/formulas.js +10 -1
  111. package/plugins/formulas/formulas.mjs +10 -1
  112. package/plugins/formulas/indexSyncer/axisSyncer.js +3 -75
  113. package/plugins/formulas/indexSyncer/axisSyncer.mjs +3 -75
  114. package/plugins/manualColumnResize/manualColumnResize.js +3 -0
  115. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -0
  116. package/plugins/mergeCells/cellsCollection.js +1 -1
  117. package/plugins/mergeCells/cellsCollection.mjs +1 -1
  118. package/plugins/mergeCells/mergeCells.js +30 -0
  119. package/plugins/mergeCells/mergeCells.mjs +30 -0
  120. package/plugins/undoRedo/undoRedo.js +61 -14
  121. package/plugins/undoRedo/undoRedo.mjs +61 -14
  122. package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
  123. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
  124. package/renderers/baseRenderer/baseRenderer.js +1 -1
  125. package/renderers/baseRenderer/baseRenderer.mjs +1 -1
  126. package/renderers/checkboxRenderer/checkboxRenderer.js +36 -8
  127. package/renderers/checkboxRenderer/checkboxRenderer.mjs +36 -8
  128. package/renderers/dateRenderer/dateRenderer.js +1 -1
  129. package/renderers/dateRenderer/dateRenderer.mjs +1 -1
  130. package/renderers/dropdownRenderer/dropdownRenderer.js +1 -1
  131. package/renderers/dropdownRenderer/dropdownRenderer.mjs +1 -1
  132. package/renderers/handsontableRenderer/handsontableRenderer.js +1 -1
  133. package/renderers/handsontableRenderer/handsontableRenderer.mjs +1 -1
  134. package/renderers/htmlRenderer/htmlRenderer.js +1 -1
  135. package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
  136. package/renderers/numericRenderer/index.js +2 -1
  137. package/renderers/numericRenderer/index.mjs +1 -1
  138. package/renderers/numericRenderer/numericRenderer.js +28 -13
  139. package/renderers/numericRenderer/numericRenderer.mjs +27 -13
  140. package/renderers/passwordRenderer/passwordRenderer.js +1 -1
  141. package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
  142. package/renderers/selectRenderer/selectRenderer.js +1 -1
  143. package/renderers/selectRenderer/selectRenderer.mjs +1 -1
  144. package/renderers/textRenderer/textRenderer.js +1 -1
  145. package/renderers/textRenderer/textRenderer.mjs +1 -1
  146. package/renderers/timeRenderer/timeRenderer.js +1 -1
  147. package/renderers/timeRenderer/timeRenderer.mjs +1 -1
  148. package/selection/mouseEventHandler.js +4 -0
  149. package/selection/mouseEventHandler.mjs +4 -0
  150. package/selection/selection.js +64 -5
  151. package/selection/selection.mjs +64 -5
  152. package/shortcuts/recorder.js +27 -8
  153. package/shortcuts/recorder.mjs +27 -8
  154. package/tableView.js +86 -5
  155. package/tableView.mjs +87 -6
  156. package/utils/autoResize.js +0 -1
  157. package/utils/autoResize.mjs +0 -1
  158. package/utils/ghostTable.js +6 -6
  159. package/utils/ghostTable.mjs +6 -6
  160. package/utils/parseTable.js +9 -1
  161. package/utils/parseTable.mjs +9 -1
@@ -56,7 +56,7 @@ _pluginHooks.default.getSingleton().add('modifyAutoColumnSizeSeed', function (bu
56
56
  * @param {number} col The visual column index.
57
57
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
58
58
  * @param {*} value The rendered value.
59
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
59
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
60
60
  */
61
61
  function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
62
62
  const {
@@ -174,6 +174,9 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
174
174
  function changeSelectedCheckboxesState() {
175
175
  let uncheckCheckbox = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
176
176
  const selRange = hotInstance.getSelectedRange();
177
+ const changesPerSubSelection = [];
178
+ let changes = [];
179
+ let changeCounter = 0;
177
180
  if (!selRange) {
178
181
  return;
179
182
  }
@@ -186,10 +189,13 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
186
189
  row: endRow,
187
190
  col: endColumn
188
191
  } = selRange[key].getBottomEndCorner();
189
- const changes = [];
190
192
  for (let visualRow = startRow; visualRow <= endRow; visualRow += 1) {
191
193
  for (let visualColumn = startColumn; visualColumn <= endColumn; visualColumn += 1) {
192
194
  const cachedCellProperties = hotInstance.getCellMeta(visualRow, visualColumn);
195
+ const templates = {
196
+ checkedTemplate: cachedCellProperties.checkedTemplate,
197
+ uncheckedTemplate: cachedCellProperties.uncheckedTemplate
198
+ };
193
199
  if (cachedCellProperties.type !== 'checkbox') {
194
200
  return;
195
201
  }
@@ -208,19 +214,41 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
208
214
  if (uncheckCheckbox === false) {
209
215
  if ([cachedCellProperties.checkedTemplate, cachedCellProperties.checkedTemplate.toString()].includes(dataAtCell)) {
210
216
  // eslint-disable-line max-len
211
- changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate]);
217
+ changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate, templates]);
212
218
  } else if ([cachedCellProperties.uncheckedTemplate, cachedCellProperties.uncheckedTemplate.toString(), null, undefined].includes(dataAtCell)) {
213
219
  // eslint-disable-line max-len
214
- changes.push([visualRow, visualColumn, cachedCellProperties.checkedTemplate]);
220
+ changes.push([visualRow, visualColumn, cachedCellProperties.checkedTemplate, templates]);
215
221
  }
216
222
  } else {
217
- changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate]);
223
+ changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate, templates]);
218
224
  }
225
+ changeCounter += 1;
219
226
  }
220
227
  }
221
- if (changes.length > 0) {
222
- hotInstance.setDataAtCell(changes);
223
- }
228
+ changesPerSubSelection.push(changeCounter);
229
+ changeCounter = 0;
230
+ }
231
+ if (!changes.every(_ref => {
232
+ let [,, cellValue] = _ref;
233
+ return cellValue === changes[0][2];
234
+ })) {
235
+ changes = changes.map(_ref2 => {
236
+ let [visualRow, visualColumn,, templates] = _ref2;
237
+ return [visualRow, visualColumn, templates.checkedTemplate];
238
+ });
239
+ } else {
240
+ changes = changes.map(_ref3 => {
241
+ let [visualRow, visualColumn, cellValue] = _ref3;
242
+ return [visualRow, visualColumn, cellValue];
243
+ });
244
+ }
245
+ if (changes.length > 0) {
246
+ // TODO: This is workaround for handsontable/dev-handsontable#1747 not being a breaking change.
247
+ // Technically, the changes don't need to be split into chunks when sent to `setDataAtCell`.
248
+ changesPerSubSelection.forEach(changesCount => {
249
+ const changesChunk = changes.splice(0, changesCount);
250
+ hotInstance.setDataAtCell(changesChunk);
251
+ });
224
252
  }
225
253
  }
226
254
 
@@ -51,7 +51,7 @@ Hooks.getSingleton().add('modifyAutoColumnSizeSeed', function (bundleSeed, cellM
51
51
  * @param {number} col The visual column index.
52
52
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
53
53
  * @param {*} value The rendered value.
54
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
54
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
55
55
  */
56
56
  export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
57
57
  const {
@@ -169,6 +169,9 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
169
169
  function changeSelectedCheckboxesState() {
170
170
  let uncheckCheckbox = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
171
171
  const selRange = hotInstance.getSelectedRange();
172
+ const changesPerSubSelection = [];
173
+ let changes = [];
174
+ let changeCounter = 0;
172
175
  if (!selRange) {
173
176
  return;
174
177
  }
@@ -181,10 +184,13 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
181
184
  row: endRow,
182
185
  col: endColumn
183
186
  } = selRange[key].getBottomEndCorner();
184
- const changes = [];
185
187
  for (let visualRow = startRow; visualRow <= endRow; visualRow += 1) {
186
188
  for (let visualColumn = startColumn; visualColumn <= endColumn; visualColumn += 1) {
187
189
  const cachedCellProperties = hotInstance.getCellMeta(visualRow, visualColumn);
190
+ const templates = {
191
+ checkedTemplate: cachedCellProperties.checkedTemplate,
192
+ uncheckedTemplate: cachedCellProperties.uncheckedTemplate
193
+ };
188
194
  if (cachedCellProperties.type !== 'checkbox') {
189
195
  return;
190
196
  }
@@ -203,19 +209,41 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
203
209
  if (uncheckCheckbox === false) {
204
210
  if ([cachedCellProperties.checkedTemplate, cachedCellProperties.checkedTemplate.toString()].includes(dataAtCell)) {
205
211
  // eslint-disable-line max-len
206
- changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate]);
212
+ changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate, templates]);
207
213
  } else if ([cachedCellProperties.uncheckedTemplate, cachedCellProperties.uncheckedTemplate.toString(), null, undefined].includes(dataAtCell)) {
208
214
  // eslint-disable-line max-len
209
- changes.push([visualRow, visualColumn, cachedCellProperties.checkedTemplate]);
215
+ changes.push([visualRow, visualColumn, cachedCellProperties.checkedTemplate, templates]);
210
216
  }
211
217
  } else {
212
- changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate]);
218
+ changes.push([visualRow, visualColumn, cachedCellProperties.uncheckedTemplate, templates]);
213
219
  }
220
+ changeCounter += 1;
214
221
  }
215
222
  }
216
- if (changes.length > 0) {
217
- hotInstance.setDataAtCell(changes);
218
- }
223
+ changesPerSubSelection.push(changeCounter);
224
+ changeCounter = 0;
225
+ }
226
+ if (!changes.every(_ref => {
227
+ let [,, cellValue] = _ref;
228
+ return cellValue === changes[0][2];
229
+ })) {
230
+ changes = changes.map(_ref2 => {
231
+ let [visualRow, visualColumn,, templates] = _ref2;
232
+ return [visualRow, visualColumn, templates.checkedTemplate];
233
+ });
234
+ } else {
235
+ changes = changes.map(_ref3 => {
236
+ let [visualRow, visualColumn, cellValue] = _ref3;
237
+ return [visualRow, visualColumn, cellValue];
238
+ });
239
+ }
240
+ if (changes.length > 0) {
241
+ // TODO: This is workaround for handsontable/dev-handsontable#1747 not being a breaking change.
242
+ // Technically, the changes don't need to be split into chunks when sent to `setDataAtCell`.
243
+ changesPerSubSelection.forEach(changesCount => {
244
+ const changesChunk = changes.splice(0, changesCount);
245
+ hotInstance.setDataAtCell(changesChunk);
246
+ });
219
247
  }
220
248
  }
221
249
 
@@ -15,7 +15,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'date';
15
15
  * @param {number} col The visual column index.
16
16
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
17
17
  * @param {*} value The rendered value.
18
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
18
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
19
19
  */
20
20
  function dateRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
21
  _autocompleteRenderer.autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -11,7 +11,7 @@ export const RENDERER_TYPE = 'date';
11
11
  * @param {number} col The visual column index.
12
12
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
13
13
  * @param {*} value The rendered value.
14
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
14
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
15
15
  */
16
16
  export function dateRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
17
  autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -15,7 +15,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'dropdown';
15
15
  * @param {number} col The visual column index.
16
16
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
17
17
  * @param {*} value The rendered value.
18
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
18
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
19
19
  */
20
20
  function dropdownRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
21
  _autocompleteRenderer.autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -11,7 +11,7 @@ export const RENDERER_TYPE = 'dropdown';
11
11
  * @param {number} col The visual column index.
12
12
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
13
13
  * @param {*} value The rendered value.
14
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
14
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
15
15
  */
16
16
  export function dropdownRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
17
  autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -15,7 +15,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'handsontable';
15
15
  * @param {number} col The visual column index.
16
16
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
17
17
  * @param {*} value The rendered value.
18
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
18
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
19
19
  */
20
20
  function handsontableRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
21
  _autocompleteRenderer.autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -11,7 +11,7 @@ export const RENDERER_TYPE = 'handsontable';
11
11
  * @param {number} col The visual column index.
12
12
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
13
13
  * @param {*} value The rendered value.
14
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
14
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
15
15
  */
16
16
  export function handsontableRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
17
  autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -14,7 +14,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'html';
14
14
  * @param {number} col The visual column index.
15
15
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
16
16
  * @param {*} value The rendered value.
17
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
17
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
18
18
  */
19
19
  function htmlRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
20
20
  _baseRenderer.baseRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -10,7 +10,7 @@ export const RENDERER_TYPE = 'html';
10
10
  * @param {number} col The visual column index.
11
11
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
12
12
  * @param {*} value The rendered value.
13
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
13
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
14
14
  */
15
15
  export function htmlRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
16
16
  baseRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -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
  *
@@ -19,25 +45,14 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'numeric';
19
45
  * @param {number} col The visual column index.
20
46
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
21
47
  * @param {*} value The rendered value.
22
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
48
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
23
49
  */
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
  *
@@ -14,25 +39,14 @@ export const RENDERER_TYPE = 'numeric';
14
39
  * @param {number} col The visual column index.
15
40
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
16
41
  * @param {*} value The rendered value.
17
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
42
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
18
43
  */
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
  }
@@ -15,7 +15,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'password';
15
15
  * @param {number} col The visual column index.
16
16
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
17
17
  * @param {*} value The rendered value.
18
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
18
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
19
19
  */
20
20
  function passwordRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
21
  _textRenderer.textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -11,7 +11,7 @@ export const RENDERER_TYPE = 'password';
11
11
  * @param {number} col The visual column index.
12
12
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
13
13
  * @param {*} value The rendered value.
14
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
14
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
15
15
  */
16
16
  export function passwordRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
17
  textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -13,7 +13,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'select';
13
13
  * @param {number} col The visual column index.
14
14
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
15
15
  * @param {*} value The rendered value.
16
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
16
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
17
17
  */
18
18
  function selectRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
19
19
  _textRenderer.textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -9,7 +9,7 @@ export const RENDERER_TYPE = 'select';
9
9
  * @param {number} col The visual column index.
10
10
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
11
11
  * @param {*} value The rendered value.
12
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
12
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
13
13
  */
14
14
  export function selectRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
15
15
  textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -17,7 +17,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'text';
17
17
  * @param {number} col The visual column index.
18
18
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
19
19
  * @param {*} value The rendered value.
20
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
20
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
21
21
  */
22
22
  function textRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
23
23
  _baseRenderer.baseRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -13,7 +13,7 @@ export const RENDERER_TYPE = 'text';
13
13
  * @param {number} col The visual column index.
14
14
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
15
15
  * @param {*} value The rendered value.
16
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
16
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
17
17
  */
18
18
  export function textRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
19
19
  baseRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -15,7 +15,7 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'time';
15
15
  * @param {number} col The visual column index.
16
16
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
17
17
  * @param {*} value The rendered value.
18
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
18
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
19
19
  */
20
20
  function timeRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
21
  _textRenderer.textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -11,7 +11,7 @@ export const RENDERER_TYPE = 'time';
11
11
  * @param {number} col The visual column index.
12
12
  * @param {number|string} prop The column property (passed when datasource is an array of objects).
13
13
  * @param {*} value The rendered value.
14
- * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
14
+ * @param {object} cellProperties The cell meta object (see {@link Core#getCellMeta}).
15
15
  */
16
16
  export function timeRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
17
  textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
@@ -31,6 +31,7 @@ function mouseDown(_ref) {
31
31
  const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
32
32
  const selectedCorner = selection.isSelectedByCorner();
33
33
  const selectedRow = selection.isSelectedByRowHeader();
34
+ selection.markSource('mouse');
34
35
  if (isShiftKey && currentSelection) {
35
36
  if (coords.row >= 0 && coords.col >= 0 && !controller.cell) {
36
37
  selection.setRangeEnd(coords);
@@ -74,6 +75,7 @@ function mouseDown(_ref) {
74
75
  });
75
76
  }
76
77
  }
78
+ selection.markEndSource();
77
79
  }
78
80
 
79
81
  /**
@@ -102,6 +104,7 @@ function mouseOver(_ref2) {
102
104
  const selectedColumn = selection.isSelectedByColumnHeader();
103
105
  const countCols = selection.tableProps.countCols();
104
106
  const countRows = selection.tableProps.countRows();
107
+ selection.markSource('mouse');
105
108
  if (selectedColumn && !controller.column) {
106
109
  selection.setRangeEnd(cellCoordsFactory(countRows - 1, coords.col));
107
110
  } else if (selectedRow && !controller.row) {
@@ -109,6 +112,7 @@ function mouseOver(_ref2) {
109
112
  } else if (!controller.cell) {
110
113
  selection.setRangeEnd(coords);
111
114
  }
115
+ selection.markEndSource();
112
116
  }
113
117
  const handlers = new Map([['mousedown', mouseDown], ['mouseover', mouseOver], ['touchstart', mouseDown]]);
114
118
 
@@ -25,6 +25,7 @@ export function mouseDown(_ref) {
25
25
  const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
26
26
  const selectedCorner = selection.isSelectedByCorner();
27
27
  const selectedRow = selection.isSelectedByRowHeader();
28
+ selection.markSource('mouse');
28
29
  if (isShiftKey && currentSelection) {
29
30
  if (coords.row >= 0 && coords.col >= 0 && !controller.cell) {
30
31
  selection.setRangeEnd(coords);
@@ -68,6 +69,7 @@ export function mouseDown(_ref) {
68
69
  });
69
70
  }
70
71
  }
72
+ selection.markEndSource();
71
73
  }
72
74
 
73
75
  /**
@@ -96,6 +98,7 @@ export function mouseOver(_ref2) {
96
98
  const selectedColumn = selection.isSelectedByColumnHeader();
97
99
  const countCols = selection.tableProps.countCols();
98
100
  const countRows = selection.tableProps.countRows();
101
+ selection.markSource('mouse');
99
102
  if (selectedColumn && !controller.column) {
100
103
  selection.setRangeEnd(cellCoordsFactory(countRows - 1, coords.col));
101
104
  } else if (selectedRow && !controller.row) {
@@ -103,6 +106,7 @@ export function mouseOver(_ref2) {
103
106
  } else if (!controller.cell) {
104
107
  selection.setRangeEnd(coords);
105
108
  }
109
+ selection.markEndSource();
106
110
  }
107
111
  const handlers = new Map([['mousedown', mouseDown], ['mouseover', mouseOver], ['touchstart', mouseDown]]);
108
112