handsontable 0.0.0-next-44bc39b-20250312 → 0.0.0-next-19f5179-20250314

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-44bc39b-20250312";
137
+ const hotVersion = "0.0.0-next-19f5179-20250314";
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-44bc39b-20250312";
127
+ const hotVersion = "0.0.0-next-19f5179-20250314";
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-44bc39b-20250312",
13
+ "version": "0.0.0-next-19f5179-20250314",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -129,6 +129,7 @@ const COLUMN_SIZE_MAP_NAME = 'autoColumnSize';
129
129
  * :::
130
130
  */
131
131
  /* eslint-enable jsdoc/require-description-complete-sentence */
132
+ var _isInitialized = /*#__PURE__*/new WeakMap();
132
133
  var _cachedColumnHeaders = /*#__PURE__*/new WeakMap();
133
134
  var _visualColumnsToRefresh = /*#__PURE__*/new WeakMap();
134
135
  var _AutoColumnSize_brand = /*#__PURE__*/new WeakSet();
@@ -218,6 +219,12 @@ class AutoColumnSize extends _base.BasePlugin {
218
219
  * @type {PhysicalIndexToValueMap}
219
220
  */
220
221
  _defineProperty(this, "columnWidthsMap", new _translations.PhysicalIndexToValueMap());
222
+ /**
223
+ * `true` value indicates that the #onInit() function has been already called.
224
+ *
225
+ * @type {boolean}
226
+ */
227
+ _classPrivateFieldInitSpec(this, _isInitialized, false);
221
228
  /**
222
229
  * Cached column header names. It is used to diff current column headers with previous state and detect which
223
230
  * columns width should be updated.
@@ -356,17 +363,11 @@ class AutoColumnSize extends _base.BasePlugin {
356
363
  physicalColumn = visualColumn;
357
364
  }
358
365
  if (overwriteCache || this.columnWidthsMap.getValueAtIndex(physicalColumn) === null && !this.hot._getColWidthFromSettings(physicalColumn)) {
359
- const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
360
- samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
366
+ _assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
361
367
  }
362
368
  });
363
369
  if (this.ghostTable.columns.length) {
364
- this.hot.batchExecution(() => {
365
- this.ghostTable.getWidths((visualColumn, width) => {
366
- const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
367
- this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
368
- });
369
- }, true);
370
+ _assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
370
371
  this.measuredColumns = columnsRange.to + 1;
371
372
  this.ghostTable.clean();
372
373
  }
@@ -577,20 +578,36 @@ function _calculateSpecificColumnsWidth(visualColumns) {
577
578
  return;
578
579
  }
579
580
  if (!this.hot._getColWidthFromSettings(physicalColumn)) {
580
- const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
581
- samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
581
+ _assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
582
582
  }
583
583
  });
584
584
  if (this.ghostTable.columns.length) {
585
- this.hot.batchExecution(() => {
586
- this.ghostTable.getWidths((visualColumn, width) => {
587
- const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
588
- this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
589
- });
590
- }, true);
585
+ _assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
591
586
  this.ghostTable.clean();
592
587
  }
593
588
  }
589
+ /**
590
+ * Processes a single column for width calculation.
591
+ *
592
+ * @param {number} visualColumn Visual column index.
593
+ * @param {object} rowsRange Range of rows to process.
594
+ */
595
+ function _fillGhostTableWithSamples(visualColumn, rowsRange) {
596
+ const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
597
+ samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
598
+ }
599
+ /**
600
+ * Updates the column widths map with calculated widths from the ghost table.
601
+ *
602
+ */
603
+ function _updateColumnWidthsMapBasedOnGhostTable() {
604
+ this.hot.batchExecution(() => {
605
+ this.ghostTable.getWidths((visualColumn, width) => {
606
+ const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
607
+ this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
608
+ });
609
+ }, true);
610
+ }
594
611
  function _onBeforeRender() {
595
612
  this.calculateVisibleColumnsWidth();
596
613
  if (!this.inProgress) {
@@ -647,6 +664,7 @@ function _onBeforeColumnResize(size, column, isDblClick) {
647
664
  function _onInit() {
648
665
  _classPrivateFieldSet(_cachedColumnHeaders, this, this.hot.getColHeader());
649
666
  this.recalculateAllColumnsWidth();
667
+ _classPrivateFieldSet(_isInitialized, this, true);
650
668
  }
651
669
  /**
652
670
  * After formulas values updated listener.
@@ -654,6 +672,9 @@ function _onInit() {
654
672
  * @param {Array} changes An array of modified data.
655
673
  */
656
674
  function _onAfterFormulasValuesUpdate(changes) {
675
+ if (!_classPrivateFieldGet(_isInitialized, this)) {
676
+ return;
677
+ }
657
678
  const changedColumns = changes.reduce((acc, change) => {
658
679
  var _change$address;
659
680
  const physicalColumn = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.col;
@@ -125,6 +125,7 @@ const COLUMN_SIZE_MAP_NAME = 'autoColumnSize';
125
125
  * :::
126
126
  */
127
127
  /* eslint-enable jsdoc/require-description-complete-sentence */
128
+ var _isInitialized = /*#__PURE__*/new WeakMap();
128
129
  var _cachedColumnHeaders = /*#__PURE__*/new WeakMap();
129
130
  var _visualColumnsToRefresh = /*#__PURE__*/new WeakMap();
130
131
  var _AutoColumnSize_brand = /*#__PURE__*/new WeakSet();
@@ -214,6 +215,12 @@ export class AutoColumnSize extends BasePlugin {
214
215
  * @type {PhysicalIndexToValueMap}
215
216
  */
216
217
  _defineProperty(this, "columnWidthsMap", new IndexToValueMap());
218
+ /**
219
+ * `true` value indicates that the #onInit() function has been already called.
220
+ *
221
+ * @type {boolean}
222
+ */
223
+ _classPrivateFieldInitSpec(this, _isInitialized, false);
217
224
  /**
218
225
  * Cached column header names. It is used to diff current column headers with previous state and detect which
219
226
  * columns width should be updated.
@@ -352,17 +359,11 @@ export class AutoColumnSize extends BasePlugin {
352
359
  physicalColumn = visualColumn;
353
360
  }
354
361
  if (overwriteCache || this.columnWidthsMap.getValueAtIndex(physicalColumn) === null && !this.hot._getColWidthFromSettings(physicalColumn)) {
355
- const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
356
- samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
362
+ _assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
357
363
  }
358
364
  });
359
365
  if (this.ghostTable.columns.length) {
360
- this.hot.batchExecution(() => {
361
- this.ghostTable.getWidths((visualColumn, width) => {
362
- const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
363
- this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
364
- });
365
- }, true);
366
+ _assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
366
367
  this.measuredColumns = columnsRange.to + 1;
367
368
  this.ghostTable.clean();
368
369
  }
@@ -572,20 +573,36 @@ function _calculateSpecificColumnsWidth(visualColumns) {
572
573
  return;
573
574
  }
574
575
  if (!this.hot._getColWidthFromSettings(physicalColumn)) {
575
- const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
576
- samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
576
+ _assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
577
577
  }
578
578
  });
579
579
  if (this.ghostTable.columns.length) {
580
- this.hot.batchExecution(() => {
581
- this.ghostTable.getWidths((visualColumn, width) => {
582
- const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
583
- this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
584
- });
585
- }, true);
580
+ _assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
586
581
  this.ghostTable.clean();
587
582
  }
588
583
  }
584
+ /**
585
+ * Processes a single column for width calculation.
586
+ *
587
+ * @param {number} visualColumn Visual column index.
588
+ * @param {object} rowsRange Range of rows to process.
589
+ */
590
+ function _fillGhostTableWithSamples(visualColumn, rowsRange) {
591
+ const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
592
+ samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
593
+ }
594
+ /**
595
+ * Updates the column widths map with calculated widths from the ghost table.
596
+ *
597
+ */
598
+ function _updateColumnWidthsMapBasedOnGhostTable() {
599
+ this.hot.batchExecution(() => {
600
+ this.ghostTable.getWidths((visualColumn, width) => {
601
+ const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
602
+ this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
603
+ });
604
+ }, true);
605
+ }
589
606
  function _onBeforeRender() {
590
607
  this.calculateVisibleColumnsWidth();
591
608
  if (!this.inProgress) {
@@ -642,6 +659,7 @@ function _onBeforeColumnResize(size, column, isDblClick) {
642
659
  function _onInit() {
643
660
  _classPrivateFieldSet(_cachedColumnHeaders, this, this.hot.getColHeader());
644
661
  this.recalculateAllColumnsWidth();
662
+ _classPrivateFieldSet(_isInitialized, this, true);
645
663
  }
646
664
  /**
647
665
  * After formulas values updated listener.
@@ -649,6 +667,9 @@ function _onInit() {
649
667
  * @param {Array} changes An array of modified data.
650
668
  */
651
669
  function _onAfterFormulasValuesUpdate(changes) {
670
+ if (!_classPrivateFieldGet(_isInitialized, this)) {
671
+ return;
672
+ }
652
673
  const changedColumns = changes.reduce((acc, change) => {
653
674
  var _change$address;
654
675
  const physicalColumn = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.col;
@@ -113,6 +113,7 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
113
113
  */
114
114
  /* eslint-enable jsdoc/require-description-complete-sentence */
115
115
  var _visualRowsToRefresh = /*#__PURE__*/new WeakMap();
116
+ var _isInitialized = /*#__PURE__*/new WeakMap();
116
117
  var _AutoRowSize_brand = /*#__PURE__*/new WeakSet();
117
118
  class AutoRowSize extends _base.BasePlugin {
118
119
  static get PLUGIN_KEY() {
@@ -215,6 +216,12 @@ class AutoRowSize extends _base.BasePlugin {
215
216
  * @type {number[]}
216
217
  */
217
218
  _classPrivateFieldInitSpec(this, _visualRowsToRefresh, []);
219
+ /**
220
+ * `true` value indicates that the #onInit() function has been already called.
221
+ *
222
+ * @type {boolean}
223
+ */
224
+ _classPrivateFieldInitSpec(this, _isInitialized, false);
218
225
  this.hot.rowIndexMapper.registerMap(ROW_WIDTHS_MAP_NAME, this.rowHeightsMap);
219
226
 
220
227
  // Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
@@ -645,6 +652,7 @@ function _onBeforeChange(changes) {
645
652
  */
646
653
  function _onInit() {
647
654
  this.recalculateAllRowsHeight();
655
+ _classPrivateFieldSet(_isInitialized, this, true);
648
656
  }
649
657
  /**
650
658
  * After formulas values updated listener.
@@ -652,6 +660,9 @@ function _onInit() {
652
660
  * @param {Array} changes An array of modified data.
653
661
  */
654
662
  function _onAfterFormulasValuesUpdate(changes) {
663
+ if (!_classPrivateFieldGet(_isInitialized, this)) {
664
+ return;
665
+ }
655
666
  const changedRows = changes.reduce((acc, change) => {
656
667
  var _change$address;
657
668
  const physicalRow = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.row;
@@ -109,6 +109,7 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
109
109
  */
110
110
  /* eslint-enable jsdoc/require-description-complete-sentence */
111
111
  var _visualRowsToRefresh = /*#__PURE__*/new WeakMap();
112
+ var _isInitialized = /*#__PURE__*/new WeakMap();
112
113
  var _AutoRowSize_brand = /*#__PURE__*/new WeakSet();
113
114
  export class AutoRowSize extends BasePlugin {
114
115
  static get PLUGIN_KEY() {
@@ -211,6 +212,12 @@ export class AutoRowSize extends BasePlugin {
211
212
  * @type {number[]}
212
213
  */
213
214
  _classPrivateFieldInitSpec(this, _visualRowsToRefresh, []);
215
+ /**
216
+ * `true` value indicates that the #onInit() function has been already called.
217
+ *
218
+ * @type {boolean}
219
+ */
220
+ _classPrivateFieldInitSpec(this, _isInitialized, false);
214
221
  this.hot.rowIndexMapper.registerMap(ROW_WIDTHS_MAP_NAME, this.rowHeightsMap);
215
222
 
216
223
  // Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
@@ -640,6 +647,7 @@ function _onBeforeChange(changes) {
640
647
  */
641
648
  function _onInit() {
642
649
  this.recalculateAllRowsHeight();
650
+ _classPrivateFieldSet(_isInitialized, this, true);
643
651
  }
644
652
  /**
645
653
  * After formulas values updated listener.
@@ -647,6 +655,9 @@ function _onInit() {
647
655
  * @param {Array} changes An array of modified data.
648
656
  */
649
657
  function _onAfterFormulasValuesUpdate(changes) {
658
+ if (!_classPrivateFieldGet(_isInitialized, this)) {
659
+ return;
660
+ }
650
661
  const changedRows = changes.reduce((acc, change) => {
651
662
  var _change$address;
652
663
  const physicalRow = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.row;
@@ -32,7 +32,7 @@ export class Formulas extends BasePlugin {
32
32
 
33
33
  engine: HyperFormula | null;
34
34
  sheetName: string | null;
35
- get sheetId(): number | null;
35
+ sheetId: number | null;
36
36
 
37
37
  isEnabled(): boolean;
38
38
  addSheet(sheetName?: string | null, sheetData?: CellValue[][]): string | boolean;
@@ -13,7 +13,6 @@ require("core-js/modules/es.set.symmetric-difference.v2.js");
13
13
  require("core-js/modules/es.set.union.v2.js");
14
14
  require("core-js/modules/esnext.iterator.constructor.js");
15
15
  require("core-js/modules/esnext.iterator.every.js");
16
- require("core-js/modules/esnext.iterator.find.js");
17
16
  require("core-js/modules/esnext.iterator.for-each.js");
18
17
  require("core-js/modules/esnext.iterator.map.js");
19
18
  var _base = require("../base");
@@ -74,13 +73,9 @@ class Formulas extends _base.BasePlugin {
74
73
  super(...arguments);
75
74
  _this = this;
76
75
  /**
77
- * The hook allows to translate the formula value to calculated value before it goes to the
78
- * validator function.
76
+ * Update sheetName and sheetId properties.
79
77
  *
80
- * @param {*} value The cell value to validate.
81
- * @param {number} visualRow The visual row index.
82
- * @param {number|string} prop The visual column index or property name of the column.
83
- * @returns {*} Returns value to validate.
78
+ * @param {string} [sheetName] The new sheet name.
84
79
  */
85
80
  _classPrivateMethodInitSpec(this, _Formulas_brand);
86
81
  /**
@@ -147,6 +142,12 @@ class Formulas extends _base.BasePlugin {
147
142
  * @type {HyperFormula|null}
148
143
  */
149
144
  _defineProperty(this, "engine", null);
145
+ /**
146
+ * HyperFormula's sheet id.
147
+ *
148
+ * @type {number|null}
149
+ */
150
+ _defineProperty(this, "sheetId", null);
150
151
  /**
151
152
  * HyperFormula's sheet name.
152
153
  *
@@ -181,15 +182,6 @@ class Formulas extends _base.BasePlugin {
181
182
  static get SETTING_KEYS() {
182
183
  return [PLUGIN_KEY, ...SETTING_KEYS];
183
184
  }
184
- /**
185
- * HyperFormula's sheet id.
186
- *
187
- * @type {number|null}
188
- */
189
- get sheetId() {
190
- return this.sheetName === null ? null : this.engine.getSheetId(this.sheetName);
191
- }
192
-
193
185
  /**
194
186
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
195
187
  * hook and if it returns `true` then the {@link Formulas#enablePlugin} method is called.
@@ -220,7 +212,7 @@ class Formulas extends _base.BasePlugin {
220
212
  if (this.sheetName !== null && !this.engine.doesSheetExist(this.sheetName)) {
221
213
  const newSheetName = this.addSheet(this.sheetName, this.hot.getSourceDataArray());
222
214
  if (newSheetName !== false) {
223
- this.sheetName = newSheetName;
215
+ _assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newSheetName);
224
216
  }
225
217
  }
226
218
  this.addHook('beforeLoadData', function () {
@@ -451,7 +443,8 @@ class Formulas extends _base.BasePlugin {
451
443
  if (sheetName && this.engine.doesSheetExist(sheetName)) {
452
444
  this.switchSheet(this.sheetName);
453
445
  } else {
454
- this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());
446
+ const newSheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());
447
+ _assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newSheetName);
455
448
  }
456
449
  }
457
450
  super.updatePlugin(newSettings);
@@ -471,7 +464,6 @@ class Formulas extends _base.BasePlugin {
471
464
  this.engine = null;
472
465
  super.destroy();
473
466
  }
474
-
475
467
  /**
476
468
  * Add a sheet to the shared HyperFormula instance.
477
469
  *
@@ -514,7 +506,7 @@ class Formulas extends _base.BasePlugin {
514
506
  (0, _console.error)(`The sheet named \`${sheetName}\` does not exist, switch aborted.`);
515
507
  return;
516
508
  }
517
- this.sheetName = sheetName;
509
+ _assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, sheetName);
518
510
  const serialized = this.engine.getSheetSerialized(this.sheetId);
519
511
  if (serialized.length > 0) {
520
512
  this.hot.loadData(serialized, `${(0, _string.toUpperCaseFirst)(PLUGIN_KEY)}.switchSheet`);
@@ -674,8 +666,22 @@ class Formulas extends _base.BasePlugin {
674
666
  }
675
667
  return this.engine.setCellContents(address, newValue);
676
668
  }
669
+
670
+ /**
671
+ * The hook allows to translate the formula value to calculated value before it goes to the
672
+ * validator function.
673
+ *
674
+ * @param {*} value The cell value to validate.
675
+ * @param {number} visualRow The visual row index.
676
+ * @param {number|string} prop The visual column index or property name of the column.
677
+ * @returns {*} Returns value to validate.
678
+ */
677
679
  }
678
680
  exports.Formulas = Formulas;
681
+ function _updateSheetNameAndSheetId(sheetName) {
682
+ this.sheetName = sheetName;
683
+ this.sheetId = this.engine.getSheetId(this.sheetName);
684
+ }
679
685
  function _onBeforeValidate(value, visualRow, prop) {
680
686
  const visualColumn = this.hot.propToCol(prop);
681
687
  if (this.isFormulaCellType(visualRow, visualColumn)) {
@@ -803,29 +809,33 @@ function _onBeforeLoadData(sourceData, initialLoad) {
803
809
  * Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
804
810
  */
805
811
  function _onAfterCellMetaReset() {
812
+ if (_classPrivateFieldGet(_hotWasInitializedWithEmptyData, this)) {
813
+ this.switchSheet(this.sheetName);
814
+ return;
815
+ }
806
816
  const sourceDataArray = this.hot.getSourceDataArray();
807
- let valueChanged = false;
808
817
  sourceDataArray.forEach((rowData, rowIndex) => {
809
818
  rowData.forEach((cellValue, columnIndex) => {
810
- const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex);
819
+ const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex, {
820
+ skipMetaExtension: true
821
+ });
811
822
  const dateFormat = cellMeta.dateFormat;
812
823
  if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
813
- valueChanged = true;
814
824
  if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
815
825
  // Rewriting date in HOT format to HF format.
816
826
  sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
817
- } else if (this.isFormulaCellType(rowIndex, columnIndex) === false) {
827
+ } else if (!cellValue.startsWith('=')) {
818
828
  // Escaping value from date parsing using "'" sign (HF feature).
819
829
  sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
820
830
  }
821
831
  }
822
832
  });
823
833
  });
824
- if (valueChanged === true) {
825
- _classPrivateFieldSet(_internalOperationPending, this, true);
826
- this.engine.setSheetContent(this.sheetId, sourceDataArray);
827
- _classPrivateFieldSet(_internalOperationPending, this, false);
828
- }
834
+ _classPrivateFieldSet(_internalOperationPending, this, true);
835
+ const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
836
+ this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
837
+ this.renderDependentSheets(dependentCells);
838
+ _classPrivateFieldSet(_internalOperationPending, this, false);
829
839
  }
830
840
  /**
831
841
  * `afterLoadData` hook callback.
@@ -839,7 +849,12 @@ function _onAfterLoadData(sourceData, initialLoad) {
839
849
  if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
840
850
  return;
841
851
  }
842
- this.sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
852
+ const sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
853
+ _assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, sheetName);
854
+ if (source === 'updateSettings') {
855
+ // For performance reasons, the initialization will be done in afterCellMetaReset hook
856
+ return;
857
+ }
843
858
  if (!_classPrivateFieldGet(_hotWasInitializedWithEmptyData, this)) {
844
859
  const sourceDataArray = this.hot.getSourceDataArray();
845
860
  if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
@@ -870,17 +885,10 @@ function _onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
870
885
  if (visualRow === null || visualColumn === null) {
871
886
  return;
872
887
  }
873
-
874
- // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
875
- const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
876
- if (!isFormulaCellType) {
877
- const cellType = this.getCellType(visualRow, visualColumn);
878
- if (cellType !== 'ARRAY') {
879
- if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
880
- valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
881
- }
882
- return;
883
- }
888
+ const cellType = this.getCellType(visualRow, visualColumn);
889
+ if (cellType === 'VALUE' || cellType === 'EMPTY') {
890
+ valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
891
+ return;
884
892
  }
885
893
  const address = {
886
894
  row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
@@ -889,21 +897,15 @@ function _onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
889
897
  };
890
898
  let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
891
899
 
892
- // TODO: Workaround. We use HOT's `getCellsMeta` method instead of HOT's `getCellMeta` method. Getting cell meta
893
- // using the second method lead to execution of the `cells` method. Using the `getDataAtCell` (which may be useful)
894
- // in a callback to the `cells` method leads to triggering the `modifyData` hook. Thus, the `onModifyData` callback
895
- // is executed once again and it cause creation of an infinite loop.
896
- let cellMeta = this.hot.getCellsMeta().find(singleCellMeta => singleCellMeta.visualRow === visualRow && singleCellMeta.visualCol === visualColumn);
897
- if (cellMeta === undefined) {
898
- cellMeta = {};
899
- }
900
+ const cellMeta = this.hot.getCellMeta(visualRow, visualColumn, {
901
+ skipMetaExtension: true
902
+ });
900
903
  if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
901
904
  cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
902
905
  }
903
906
 
904
907
  // If `cellValue` is an object it is expected to be an error
905
- const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
906
- valueHolder.value = value;
908
+ valueHolder.value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
907
909
  }
908
910
  /**
909
911
  * `modifySourceData` hook callback.
@@ -923,14 +925,9 @@ function _onModifySourceData(row, columnOrProp, valueHolder, ioMode) {
923
925
  if (visualRow === null || visualColumn === null) {
924
926
  return;
925
927
  }
926
-
927
- // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
928
- const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
929
- if (!isFormulaCellType) {
930
- const cellType = this.getCellType(visualRow, visualColumn);
931
- if (cellType !== 'ARRAY') {
932
- return;
933
- }
928
+ const cellType = this.getCellType(visualRow, visualColumn);
929
+ if (cellType === 'VALUE' || cellType === 'EMPTY') {
930
+ return;
934
931
  }
935
932
  const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
936
933
 
@@ -1239,7 +1236,7 @@ function _onEngineSheetAdded(addedSheetDisplayName) {
1239
1236
  * @param {string} newDisplayName The new name of the sheet.
1240
1237
  */
1241
1238
  function _onEngineSheetRenamed(oldDisplayName, newDisplayName) {
1242
- this.sheetName = newDisplayName;
1239
+ _assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newDisplayName);
1243
1240
  this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
1244
1241
  }
1245
1242
  /**