handsontable 0.0.0-next-2e49e9b-20240105 → 0.0.0-next-d56cd86-20240109

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.

Potentially problematic release.


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

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-2e49e9b-20240105";
137
+ const hotVersion = "0.0.0-next-d56cd86-20240109";
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-2e49e9b-20240105";
127
+ const hotVersion = "0.0.0-next-d56cd86-20240109";
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-2e49e9b-20240105",
13
+ "version": "0.0.0-next-d56cd86-20240109",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -8,7 +8,7 @@ export type DetailedSettings = {
8
8
  reversedRowCoords?: boolean;
9
9
  suppressDataTypeErrors?: boolean;
10
10
  readOnly?: boolean;
11
- roundFloat?: boolean;
11
+ roundFloat?: boolean | number;
12
12
  ranges?: number[][];
13
13
  sourceColumn?: number;
14
14
  } & ({
@@ -27,7 +27,7 @@ export interface Endpoint {
27
27
  reversedRowCoords: boolean;
28
28
  suppressDataTypeErrors: boolean;
29
29
  readOnly: boolean;
30
- roundFloat: boolean;
30
+ roundFloat: boolean | number;
31
31
  ranges: number[][];
32
32
  sourceColumn: number;
33
33
  type: 'sum' | 'min' | 'max' | 'count' | 'average' | 'custom';
@@ -17,6 +17,8 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
17
17
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'columnSummary';
18
18
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 220;
19
19
 
20
+ /* eslint-disable jsdoc/require-description-complete-sentence */
21
+
20
22
  /**
21
23
  * @plugin ColumnSummary
22
24
  * @class ColumnSummary
@@ -40,7 +42,7 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 220;
40
42
  * | `reversedRowCoords` | No | Boolean | `false` | [Reverses row coordinates](@/guides/columns/column-summary.md#step-5-make-room-for-the-destination-cell) |
41
43
  * | `suppressDataTypeErrors` | No | Boolean | `true` | [Suppresses data type errors](@/guides/columns/column-summary.md#throw-data-type-errors) |
42
44
  * | `readOnly` | No | Boolean | `true` | Makes summary cell read-only |
43
- * | `roundFloat` | No | Number | - | [Rounds summary result](@/guides/columns/column-summary.md#round-a-column-summary-result) |
45
+ * | `roundFloat` | No | Number/Boolean | - | [Rounds summary result](@/guides/columns/column-summary.md#round-a-column-summary-result) |
44
46
  * | `customFunction` | No | Function | - | [Lets you add a custom summary function](@/guides/columns/column-summary.md#implement-a-custom-summary-function) |
45
47
  *
46
48
  * @example
@@ -218,6 +220,20 @@ class ColumnSummary extends _base.BasePlugin {
218
220
  this.endpoints = null;
219
221
  this.settings = null;
220
222
  this.currentEndpoint = null;
223
+ super.disablePlugin();
224
+ }
225
+
226
+ /**
227
+ * Updates the plugin's state.
228
+ *
229
+ * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:
230
+ * - [`columnSummary`](@/api/options.md#columnsummary)
231
+ */
232
+ updatePlugin() {
233
+ this.disablePlugin();
234
+ this.enablePlugin();
235
+ this.endpoints.initEndpoints();
236
+ super.updatePlugin();
221
237
  }
222
238
 
223
239
  /**
@@ -453,8 +469,7 @@ class ColumnSummary extends _base.BasePlugin {
453
469
  }
454
470
  exports.ColumnSummary = ColumnSummary;
455
471
  function _onAfterInit2() {
456
- this.endpoints.endpoints = this.endpoints.parseSettings();
457
- this.endpoints.refreshAllEndpoints(true);
472
+ this.endpoints.initEndpoints();
458
473
  }
459
474
  function _onAfterChange2(changes, source) {
460
475
  if (changes && source !== 'ColumnSummary.reset' && source !== 'ColumnSummary.set' && source !== 'loadData') {
@@ -13,6 +13,8 @@ import { isNullishOrNaN } from "./utils.mjs";
13
13
  export const PLUGIN_KEY = 'columnSummary';
14
14
  export const PLUGIN_PRIORITY = 220;
15
15
 
16
+ /* eslint-disable jsdoc/require-description-complete-sentence */
17
+
16
18
  /**
17
19
  * @plugin ColumnSummary
18
20
  * @class ColumnSummary
@@ -36,7 +38,7 @@ export const PLUGIN_PRIORITY = 220;
36
38
  * | `reversedRowCoords` | No | Boolean | `false` | [Reverses row coordinates](@/guides/columns/column-summary.md#step-5-make-room-for-the-destination-cell) |
37
39
  * | `suppressDataTypeErrors` | No | Boolean | `true` | [Suppresses data type errors](@/guides/columns/column-summary.md#throw-data-type-errors) |
38
40
  * | `readOnly` | No | Boolean | `true` | Makes summary cell read-only |
39
- * | `roundFloat` | No | Number | - | [Rounds summary result](@/guides/columns/column-summary.md#round-a-column-summary-result) |
41
+ * | `roundFloat` | No | Number/Boolean | - | [Rounds summary result](@/guides/columns/column-summary.md#round-a-column-summary-result) |
40
42
  * | `customFunction` | No | Function | - | [Lets you add a custom summary function](@/guides/columns/column-summary.md#implement-a-custom-summary-function) |
41
43
  *
42
44
  * @example
@@ -214,6 +216,20 @@ export class ColumnSummary extends BasePlugin {
214
216
  this.endpoints = null;
215
217
  this.settings = null;
216
218
  this.currentEndpoint = null;
219
+ super.disablePlugin();
220
+ }
221
+
222
+ /**
223
+ * Updates the plugin's state.
224
+ *
225
+ * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:
226
+ * - [`columnSummary`](@/api/options.md#columnsummary)
227
+ */
228
+ updatePlugin() {
229
+ this.disablePlugin();
230
+ this.enablePlugin();
231
+ this.endpoints.initEndpoints();
232
+ super.updatePlugin();
217
233
  }
218
234
 
219
235
  /**
@@ -448,8 +464,7 @@ export class ColumnSummary extends BasePlugin {
448
464
  }
449
465
  }
450
466
  function _onAfterInit2() {
451
- this.endpoints.endpoints = this.endpoints.parseSettings();
452
- this.endpoints.refreshAllEndpoints(true);
467
+ this.endpoints.initEndpoints();
453
468
  }
454
469
  function _onAfterChange2(changes, source) {
455
470
  if (changes && source !== 'ColumnSummary.reset' && source !== 'ColumnSummary.set' && source !== 'loadData') {
@@ -67,6 +67,14 @@ class Endpoints {
67
67
  this.settings = settings;
68
68
  }
69
69
 
70
+ /**
71
+ * Initialize the endpoints provided in the settings.
72
+ */
73
+ initEndpoints() {
74
+ this.endpoints = this.parseSettings();
75
+ this.refreshAllEndpoints();
76
+ }
77
+
70
78
  /**
71
79
  * Get a single endpoint object.
72
80
  *
@@ -479,8 +487,15 @@ class Endpoints {
479
487
  cellMeta.className = 'columnSummaryResult';
480
488
  }
481
489
  }
482
- if (endpoint.roundFloat && !isNaN(endpoint.result)) {
483
- endpoint.result = endpoint.result.toFixed(endpoint.roundFloat);
490
+ if ((endpoint.roundFloat === true || Number.isInteger(endpoint.roundFloat)) && !isNaN(endpoint.result)) {
491
+ const roundFloatValue = endpoint.roundFloat;
492
+ let decimalPlacesCount = 0;
493
+
494
+ // `toFixed` method accepts only values between 0 and 100
495
+ if (Number.isInteger(roundFloatValue)) {
496
+ decimalPlacesCount = Math.min(Math.max(0, roundFloatValue), 100);
497
+ }
498
+ endpoint.result = endpoint.result.toFixed(decimalPlacesCount);
484
499
  }
485
500
  if (render) {
486
501
  this.hot.setDataAtCell(visualEndpointRowIndex, endpoint.destinationColumn, endpoint.result, 'ColumnSummary.set');
@@ -64,6 +64,14 @@ class Endpoints {
64
64
  this.settings = settings;
65
65
  }
66
66
 
67
+ /**
68
+ * Initialize the endpoints provided in the settings.
69
+ */
70
+ initEndpoints() {
71
+ this.endpoints = this.parseSettings();
72
+ this.refreshAllEndpoints();
73
+ }
74
+
67
75
  /**
68
76
  * Get a single endpoint object.
69
77
  *
@@ -476,8 +484,15 @@ class Endpoints {
476
484
  cellMeta.className = 'columnSummaryResult';
477
485
  }
478
486
  }
479
- if (endpoint.roundFloat && !isNaN(endpoint.result)) {
480
- endpoint.result = endpoint.result.toFixed(endpoint.roundFloat);
487
+ if ((endpoint.roundFloat === true || Number.isInteger(endpoint.roundFloat)) && !isNaN(endpoint.result)) {
488
+ const roundFloatValue = endpoint.roundFloat;
489
+ let decimalPlacesCount = 0;
490
+
491
+ // `toFixed` method accepts only values between 0 and 100
492
+ if (Number.isInteger(roundFloatValue)) {
493
+ decimalPlacesCount = Math.min(Math.max(0, roundFloatValue), 100);
494
+ }
495
+ endpoint.result = endpoint.result.toFixed(decimalPlacesCount);
481
496
  }
482
497
  if (render) {
483
498
  this.hot.setDataAtCell(visualEndpointRowIndex, endpoint.destinationColumn, endpoint.result, 'ColumnSummary.set');