@odoo/o-spreadsheet 16.2.3 → 16.2.5

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.
@@ -1004,6 +1004,10 @@ function deepEquals(o1, o2) {
1004
1004
  }
1005
1005
  return true;
1006
1006
  }
1007
+ /** Check if the given array contains all the values of the other array. */
1008
+ function includesAll(arr, values) {
1009
+ return values.every((value) => arr.includes(value));
1010
+ }
1007
1011
  /**
1008
1012
  * Return an object with all the keys in the object that have a falsy value removed.
1009
1013
  */
@@ -1677,12 +1681,77 @@ const numberRepresentation = [];
1677
1681
  * - all digit stored in the decimal part of the number
1678
1682
  *
1679
1683
  * The 'maxDecimal' parameter allows to indicate the number of digits to not
1680
- * exceed in the decimal part, in which case digits are rounded
1684
+ * exceed in the decimal part, in which case digits are rounded.
1681
1685
  *
1682
- * Intl.Numberformat is used to properly handle all the roundings.
1683
- * e.g. 1234.7 with format ### (<> maxDecimals=0) should become 1235, not 1234
1684
1686
  **/
1685
1687
  function splitNumber(value, maxDecimals = MAX_DECIMAL_PLACES) {
1688
+ const asString = value.toString();
1689
+ if (asString.includes("e"))
1690
+ return splitNumberIntl(value, maxDecimals);
1691
+ if (Number.isInteger(value)) {
1692
+ return { integerDigits: asString, decimalDigits: undefined };
1693
+ }
1694
+ const indexOfDot = asString.indexOf(".");
1695
+ let integerDigits = asString.substring(0, indexOfDot);
1696
+ let decimalDigits = asString.substring(indexOfDot + 1);
1697
+ if (maxDecimals === 0) {
1698
+ if (Number(decimalDigits[0]) >= 5) {
1699
+ integerDigits = (Number(integerDigits) + 1).toString();
1700
+ }
1701
+ return { integerDigits, decimalDigits: undefined };
1702
+ }
1703
+ if (decimalDigits.length > maxDecimals) {
1704
+ const { integerDigits: roundedIntegerDigits, decimalDigits: roundedDecimalDigits } = limitDecimalDigits(decimalDigits, maxDecimals);
1705
+ decimalDigits = roundedDecimalDigits;
1706
+ if (roundedIntegerDigits !== "0") {
1707
+ integerDigits = (Number(integerDigits) + Number(roundedIntegerDigits)).toString();
1708
+ }
1709
+ }
1710
+ return { integerDigits, decimalDigits: removeTrailingZeroes(decimalDigits || "") };
1711
+ }
1712
+ /**
1713
+ * Return the given string minus the trailing "0" characters.
1714
+ *
1715
+ * @param numberString : a string of integers
1716
+ * @returns the numberString, minus the eventual zeroes at the end
1717
+ */
1718
+ function removeTrailingZeroes(numberString) {
1719
+ let i = numberString.length - 1;
1720
+ while (i >= 0 && numberString[i] === "0") {
1721
+ i--;
1722
+ }
1723
+ return numberString.slice(0, i + 1) || undefined;
1724
+ }
1725
+ /**
1726
+ * Limit the size of the decimal part of a number to the given number of digits.
1727
+ */
1728
+ function limitDecimalDigits(decimalDigits, maxDecimals) {
1729
+ let integerDigits = "0";
1730
+ let resultDecimalDigits = decimalDigits;
1731
+ // Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
1732
+ // but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
1733
+ let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
1734
+ const i = maxDecimals;
1735
+ if (Number(Number(decimalDigits[i]) < 5)) {
1736
+ return { integerDigits, decimalDigits: slicedDecimalDigits };
1737
+ }
1738
+ // round up
1739
+ const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
1740
+ if (slicedRoundedUp.length > slicedDecimalDigits.length) {
1741
+ integerDigits = (Number(integerDigits) + 1).toString();
1742
+ resultDecimalDigits = undefined;
1743
+ }
1744
+ else {
1745
+ resultDecimalDigits = slicedRoundedUp;
1746
+ }
1747
+ return { integerDigits, decimalDigits: resultDecimalDigits };
1748
+ }
1749
+ /**
1750
+ * Split numbers into decimal/integer digits using Intl.NumberFormat.
1751
+ * Supports numbers with a lot of digits that are transformed to scientific notation by
1752
+ * number.toString(), but is slow.
1753
+ */
1754
+ function splitNumberIntl(value, maxDecimals = MAX_DECIMAL_PLACES) {
1686
1755
  let formatter = numberRepresentation[maxDecimals];
1687
1756
  if (!formatter) {
1688
1757
  formatter = new Intl.NumberFormat("en-US", {
@@ -4200,6 +4269,8 @@ var CommandResult;
4200
4269
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
4201
4270
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
4202
4271
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
4272
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
4273
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4203
4274
  })(CommandResult || (CommandResult = {}));
4204
4275
 
4205
4276
  var DIRECTION;
@@ -9131,6 +9202,11 @@ colMenuRegistry
9131
9202
  name: REMOVE_COLUMNS_NAME,
9132
9203
  sequence: 90,
9133
9204
  action: REMOVE_COLUMNS_ACTION,
9205
+ isVisible: (env) => {
9206
+ const sheetId = env.model.getters.getActiveSheetId();
9207
+ const selectedCols = env.model.getters.getElementsFromSelection("COL");
9208
+ return env.model.getters.canRemoveHeaders(sheetId, "COL", selectedCols);
9209
+ },
9134
9210
  })
9135
9211
  .add("clear_column", {
9136
9212
  name: DELETE_CONTENT_COLUMNS_NAME,
@@ -9143,9 +9219,8 @@ colMenuRegistry
9143
9219
  action: HIDE_COLUMNS_ACTION,
9144
9220
  isVisible: (env) => {
9145
9221
  const sheetId = env.model.getters.getActiveSheetId();
9146
- const hiddenCols = env.model.getters.getHiddenColsGroups(sheetId).flat();
9147
- return (env.model.getters.getNumberCols(sheetId) >
9148
- hiddenCols.length + env.model.getters.getElementsFromSelection("COL").length);
9222
+ const selectedCols = env.model.getters.getElementsFromSelection("COL");
9223
+ return env.model.getters.canRemoveHeaders(sheetId, "COL", selectedCols);
9149
9224
  },
9150
9225
  separator: true,
9151
9226
  })
@@ -9219,6 +9294,11 @@ rowMenuRegistry
9219
9294
  name: REMOVE_ROWS_NAME,
9220
9295
  sequence: 70,
9221
9296
  action: REMOVE_ROWS_ACTION,
9297
+ isVisible: (env) => {
9298
+ const sheetId = env.model.getters.getActiveSheetId();
9299
+ const selectedRows = env.model.getters.getElementsFromSelection("ROW");
9300
+ return env.model.getters.canRemoveHeaders(sheetId, "ROW", selectedRows);
9301
+ },
9222
9302
  })
9223
9303
  .add("clear_row", {
9224
9304
  name: DELETE_CONTENT_ROWS_NAME,
@@ -9231,9 +9311,8 @@ rowMenuRegistry
9231
9311
  action: HIDE_ROWS_ACTION,
9232
9312
  isVisible: (env) => {
9233
9313
  const sheetId = env.model.getters.getActiveSheetId();
9234
- const hiddenRows = env.model.getters.getHiddenRowsGroups(sheetId).flat();
9235
- return (env.model.getters.getNumberRows(sheetId) >
9236
- hiddenRows.length + env.model.getters.getElementsFromSelection("ROW").length);
9314
+ const selectedRows = env.model.getters.getElementsFromSelection("ROW");
9315
+ return env.model.getters.canRemoveHeaders(sheetId, "ROW", selectedRows);
9237
9316
  },
9238
9317
  separator: true,
9239
9318
  })
@@ -21969,8 +22048,8 @@ class Grid extends Component {
21969
22048
  },
21970
22049
  "CTRL+END": () => {
21971
22050
  const sheetId = this.env.model.getters.getActiveSheetId();
21972
- const col = this.env.model.getters.findVisibleHeader(sheetId, "COL", range(0, this.env.model.getters.getNumberCols(sheetId)).reverse());
21973
- const row = this.env.model.getters.findVisibleHeader(sheetId, "ROW", range(0, this.env.model.getters.getNumberRows(sheetId)).reverse());
22051
+ const col = this.env.model.getters.findVisibleHeader(sheetId, "COL", this.env.model.getters.getNumberCols(sheetId) - 1, 0);
22052
+ const row = this.env.model.getters.findVisibleHeader(sheetId, "ROW", this.env.model.getters.getNumberRows(sheetId) - 1, 0);
21974
22053
  this.env.model.selection.selectCell(col, row);
21975
22054
  },
21976
22055
  "SHIFT+ ": () => {
@@ -22050,9 +22129,10 @@ class Grid extends Component {
22050
22129
  this.focus();
22051
22130
  }
22052
22131
  focus() {
22132
+ var _a;
22053
22133
  if (!this.env.model.getters.getSelectedFigureId() &&
22054
22134
  this.env.model.getters.getEditionMode() === "inactive") {
22055
- this.hiddenInput.el.focus();
22135
+ (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
22056
22136
  }
22057
22137
  }
22058
22138
  get gridEl() {
@@ -25947,7 +26027,7 @@ function load(data, verboseImport) {
25947
26027
  }
25948
26028
  }
25949
26029
  }
25950
- data = JSON.parse(JSON.stringify(data));
26030
+ data = deepCopy(data);
25951
26031
  // apply migrations, if needed
25952
26032
  if ("version" in data) {
25953
26033
  if (data.version < CURRENT_VERSION) {
@@ -29390,7 +29470,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
29390
29470
  allowDispatch(cmd) {
29391
29471
  switch (cmd.type) {
29392
29472
  case "HIDE_COLUMNS_ROWS": {
29393
- if (!this.hiddenHeaders[cmd.sheetId]) {
29473
+ if (!this.getters.tryGetSheet(cmd.sheetId)) {
29394
29474
  return 27 /* CommandResult.InvalidSheetId */;
29395
29475
  }
29396
29476
  const hiddenGroup = cmd.dimension === "COL"
@@ -29399,10 +29479,25 @@ class HeaderVisibilityPlugin extends CorePlugin {
29399
29479
  const elements = cmd.dimension === "COL"
29400
29480
  ? this.getters.getNumberCols(cmd.sheetId)
29401
29481
  : this.getters.getNumberRows(cmd.sheetId);
29402
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29403
- ? 0 /* CommandResult.Success */
29404
- : 66 /* CommandResult.TooManyHiddenElements */;
29482
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29483
+ if (hiddenElements.size >= elements) {
29484
+ return 66 /* CommandResult.TooManyHiddenElements */;
29485
+ }
29486
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29487
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29488
+ }
29489
+ else {
29490
+ return 0 /* CommandResult.Success */;
29491
+ }
29405
29492
  }
29493
+ case "REMOVE_COLUMNS_ROWS":
29494
+ if (!this.getters.tryGetSheet(cmd.sheetId)) {
29495
+ return 27 /* CommandResult.InvalidSheetId */;
29496
+ }
29497
+ if (!this.canRemoveHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
29498
+ return 8 /* CommandResult.NotEnoughElements */;
29499
+ }
29500
+ return 0 /* CommandResult.Success */;
29406
29501
  }
29407
29502
  return 0 /* CommandResult.Success */;
29408
29503
  }
@@ -29449,6 +29544,10 @@ class HeaderVisibilityPlugin extends CorePlugin {
29449
29544
  }
29450
29545
  return;
29451
29546
  }
29547
+ canRemoveHeaders(sheetId, dimension, elements) {
29548
+ const visibleHeaders = this.getAllVisibleHeaders(sheetId, dimension);
29549
+ return !includesAll(elements, visibleHeaders);
29550
+ }
29452
29551
  isRowHiddenByUser(sheetId, index) {
29453
29552
  return this.hiddenHeaders[sheetId].ROW[index];
29454
29553
  }
@@ -29493,6 +29592,9 @@ class HeaderVisibilityPlugin extends CorePlugin {
29493
29592
  }
29494
29593
  return consecutiveIndexes;
29495
29594
  }
29595
+ getAllVisibleHeaders(sheetId, dimension) {
29596
+ return range(0, this.hiddenHeaders[sheetId][dimension].length).filter((i) => !this.hiddenHeaders[sheetId][dimension][i]);
29597
+ }
29496
29598
  import(data) {
29497
29599
  var _a, _b;
29498
29600
  for (let sheet of data.sheets) {
@@ -29540,6 +29642,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
29540
29642
  }
29541
29643
  }
29542
29644
  HeaderVisibilityPlugin.getters = [
29645
+ "canRemoveHeaders",
29543
29646
  "getHiddenColsGroups",
29544
29647
  "getHiddenRowsGroups",
29545
29648
  "isRowHiddenByUser",
@@ -30558,13 +30661,27 @@ class SheetPlugin extends CorePlugin {
30558
30661
  return this.orderedSheetIds.length > 1
30559
30662
  ? 0 /* CommandResult.Success */
30560
30663
  : 9 /* CommandResult.NotEnoughSheets */;
30664
+ case "ADD_COLUMNS_ROWS":
30665
+ const elements = cmd.dimension === "COL"
30666
+ ? this.getNumberCols(cmd.sheetId)
30667
+ : this.getNumberRows(cmd.sheetId);
30668
+ if (cmd.base < 0 || cmd.base > elements) {
30669
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30670
+ }
30671
+ else if (cmd.quantity <= 0) {
30672
+ return 87 /* CommandResult.InvalidQuantity */;
30673
+ }
30674
+ return 0 /* CommandResult.Success */;
30561
30675
  case "REMOVE_COLUMNS_ROWS": {
30562
- const length = cmd.dimension === "COL"
30676
+ const elements = cmd.dimension === "COL"
30563
30677
  ? this.getNumberCols(cmd.sheetId)
30564
30678
  : this.getNumberRows(cmd.sheetId);
30565
- return length > cmd.elements.length
30566
- ? 0 /* CommandResult.Success */
30567
- : 8 /* CommandResult.NotEnoughElements */;
30679
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30680
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30681
+ }
30682
+ else {
30683
+ return 0 /* CommandResult.Success */;
30684
+ }
30568
30685
  }
30569
30686
  case "FREEZE_ROWS": {
30570
30687
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
@@ -31032,7 +31149,7 @@ class SheetPlugin extends CorePlugin {
31032
31149
  duplicateSheet(fromId, toId) {
31033
31150
  const sheet = this.getSheet(fromId);
31034
31151
  const toName = this.getDuplicateSheetName(sheet.name);
31035
- const newSheet = JSON.parse(JSON.stringify(sheet));
31152
+ const newSheet = deepCopy(sheet);
31036
31153
  newSheet.id = toId;
31037
31154
  newSheet.name = toName;
31038
31155
  for (let col = 0; col <= newSheet.numberOfCols; col++) {
@@ -31159,10 +31276,10 @@ class SheetPlugin extends CorePlugin {
31159
31276
  }
31160
31277
  }
31161
31278
  moveCellOnColumnsDeletion(sheet, deletedColumn) {
31162
- for (let [index, row] of Object.entries(sheet.rows)) {
31163
- const rowIndex = parseInt(index, 10);
31279
+ for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
31280
+ const row = sheet.rows[rowIndex];
31164
31281
  for (let i in row.cells) {
31165
- const colIndex = parseInt(i, 10);
31282
+ const colIndex = Number(i);
31166
31283
  const cellId = row.cells[i];
31167
31284
  if (cellId) {
31168
31285
  if (colIndex === deletedColumn) {
@@ -31189,11 +31306,11 @@ class SheetPlugin extends CorePlugin {
31189
31306
  */
31190
31307
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
31191
31308
  const commands = [];
31192
- for (const [index, row] of Object.entries(sheet.rows)) {
31193
- const rowIndex = parseInt(index, 10);
31309
+ for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
31310
+ const row = sheet.rows[rowIndex];
31194
31311
  if (dimension !== "rows" || rowIndex >= addedElement) {
31195
31312
  for (let i in row.cells) {
31196
- const colIndex = parseInt(i, 10);
31313
+ const colIndex = Number(i);
31197
31314
  const cellId = row.cells[i];
31198
31315
  if (cellId) {
31199
31316
  if (dimension === "rows" || colIndex >= addedElement) {
@@ -31223,11 +31340,11 @@ class SheetPlugin extends CorePlugin {
31223
31340
  */
31224
31341
  moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
31225
31342
  const numberRows = deleteToRow - deleteFromRow + 1;
31226
- for (let [index, row] of Object.entries(sheet.rows)) {
31227
- const rowIndex = parseInt(index, 10);
31343
+ for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
31344
+ const row = sheet.rows[rowIndex];
31228
31345
  if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
31229
31346
  for (let i in row.cells) {
31230
- const colIndex = parseInt(i, 10);
31347
+ const colIndex = Number(i);
31231
31348
  const cellId = row.cells[i];
31232
31349
  if (cellId) {
31233
31350
  this.dispatch("CLEAR_CELL", {
@@ -31240,7 +31357,7 @@ class SheetPlugin extends CorePlugin {
31240
31357
  }
31241
31358
  if (rowIndex > deleteToRow) {
31242
31359
  for (let i in row.cells) {
31243
- const colIndex = parseInt(i, 10);
31360
+ const colIndex = Number(i);
31244
31361
  const cellId = row.cells[i];
31245
31362
  if (cellId) {
31246
31363
  this.dispatch("UPDATE_CELL_POSITION", {
@@ -31258,7 +31375,7 @@ class SheetPlugin extends CorePlugin {
31258
31375
  const rows = [];
31259
31376
  const cellsQueue = sheet.rows.map((row) => row.cells);
31260
31377
  for (let i in sheet.rows) {
31261
- if (parseInt(i, 10) === index) {
31378
+ if (Number(i) === index) {
31262
31379
  continue;
31263
31380
  }
31264
31381
  rows.push({
@@ -32429,13 +32546,11 @@ class FilterEvaluationPlugin extends UIPlugin {
32429
32546
  return Boolean(id && ((_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[id]) === null || _b === void 0 ? void 0 : _b.length));
32430
32547
  }
32431
32548
  intersectZoneWithViewport(sheetId, zone) {
32432
- const colsRange = range(zone.left, zone.right + 1);
32433
- const rowsRange = range(zone.top, zone.bottom + 1);
32434
32549
  return {
32435
- left: this.getters.findVisibleHeader(sheetId, "COL", colsRange),
32436
- right: this.getters.findVisibleHeader(sheetId, "COL", colsRange.reverse()),
32437
- top: this.getters.findVisibleHeader(sheetId, "ROW", rowsRange),
32438
- bottom: this.getters.findVisibleHeader(sheetId, "ROW", rowsRange.reverse()),
32550
+ left: this.getters.findVisibleHeader(sheetId, "COL", zone.left, zone.right),
32551
+ right: this.getters.findVisibleHeader(sheetId, "COL", zone.right, zone.left),
32552
+ top: this.getters.findVisibleHeader(sheetId, "ROW", zone.top, zone.bottom),
32553
+ bottom: this.getters.findVisibleHeader(sheetId, "ROW", zone.bottom, zone.top),
32439
32554
  };
32440
32555
  }
32441
32556
  updateFilter({ col, row, values, sheetId }) {
@@ -34542,13 +34657,33 @@ class HeaderVisibilityUIPlugin extends UIPlugin {
34542
34657
  getNextVisibleCellPosition({ sheetId, col, row }) {
34543
34658
  return {
34544
34659
  sheetId,
34545
- col: this.findVisibleHeader(sheetId, "COL", range(col, this.getters.getNumberCols(sheetId))),
34546
- row: this.findVisibleHeader(sheetId, "ROW", range(row, this.getters.getNumberRows(sheetId))),
34660
+ col: this.findVisibleHeader(sheetId, "COL", col, this.getters.getNumberCols(sheetId) - 1),
34661
+ row: this.findVisibleHeader(sheetId, "ROW", row, this.getters.getNumberRows(sheetId) - 1),
34547
34662
  };
34548
34663
  }
34549
- findVisibleHeader(sheetId, dimension, indexes) {
34550
- return indexes.find((index) => this.getters.doesHeaderExist(sheetId, dimension, index) &&
34551
- !this.isHeaderHidden(sheetId, dimension, index));
34664
+ /**
34665
+ * Find the first visible header in the range [`from` => `to`].
34666
+ *
34667
+ * Both `from` and `to` are inclusive.
34668
+ */
34669
+ findVisibleHeader(sheetId, dimension, from, to) {
34670
+ if (from <= to) {
34671
+ for (let i = from; i <= to; i++) {
34672
+ if (this.getters.doesHeaderExist(sheetId, dimension, i) &&
34673
+ !this.isHeaderHidden(sheetId, dimension, i)) {
34674
+ return i;
34675
+ }
34676
+ }
34677
+ }
34678
+ if (from > to) {
34679
+ for (let i = from; i >= to; i--) {
34680
+ if (this.getters.doesHeaderExist(sheetId, dimension, i) &&
34681
+ !this.isHeaderHidden(sheetId, dimension, i)) {
34682
+ return i;
34683
+ }
34684
+ }
34685
+ }
34686
+ return undefined;
34552
34687
  }
34553
34688
  findLastVisibleColRowIndex(sheetId, dimension, { last, first }) {
34554
34689
  const lastVisibleIndex = range(last, first, -1).find((index) => !this.isHeaderHidden(sheetId, dimension, index));
@@ -34556,7 +34691,7 @@ class HeaderVisibilityUIPlugin extends UIPlugin {
34556
34691
  }
34557
34692
  findFirstVisibleColRowIndex(sheetId, dimension) {
34558
34693
  const numberOfHeaders = this.getters.getNumberHeaders(sheetId, dimension);
34559
- for (let i = 0; i < numberOfHeaders - 1; i++) {
34694
+ for (let i = 0; i < numberOfHeaders; i++) {
34560
34695
  if (dimension === "COL" && !this.isColHidden(sheetId, i)) {
34561
34696
  return i;
34562
34697
  }
@@ -42760,8 +42895,8 @@ class SelectionStreamProcessorImpl {
42760
42895
  }
42761
42896
  const { left, right, top, bottom } = zone;
42762
42897
  const sheetId = this.getters.getActiveSheetId();
42763
- const refCol = this.getters.findVisibleHeader(sheetId, "COL", range(left, right + 1));
42764
- const refRow = this.getters.findVisibleHeader(sheetId, "ROW", range(top, bottom + 1));
42898
+ const refCol = this.getters.findVisibleHeader(sheetId, "COL", left, right);
42899
+ const refRow = this.getters.findVisibleHeader(sheetId, "ROW", top, bottom);
42765
42900
  if (refRow === undefined || refCol === undefined) {
42766
42901
  return 17 /* CommandResult.SelectionOutOfBound */;
42767
42902
  }
@@ -42836,10 +42971,10 @@ class SelectionStreamProcessorImpl {
42836
42971
  const { col: anchorCol, row: anchorRow } = anchor.cell;
42837
42972
  return {
42838
42973
  col: this.getters.isColHidden(sheetId, anchorCol)
42839
- ? this.getters.findVisibleHeader(sheetId, "COL", range(left, right + 1)) || anchorCol
42974
+ ? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
42840
42975
  : anchorCol,
42841
42976
  row: this.getters.isRowHidden(sheetId, anchorRow)
42842
- ? this.getters.findVisibleHeader(sheetId, "ROW", range(top, bottom + 1)) || anchorRow
42977
+ ? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
42843
42978
  : anchorRow,
42844
42979
  };
42845
42980
  }
@@ -44589,6 +44724,8 @@ class Model extends EventBus {
44589
44724
  * Internal status of the model. Important for command handling coordination
44590
44725
  */
44591
44726
  this.status = 0 /* Status.Ready */;
44727
+ this.handlers = [];
44728
+ this.coreHandlers = [];
44592
44729
  /**
44593
44730
  * The dispatch method is the only entry point to manipulate data in the model.
44594
44731
  * This is through this method that commands are dispatched most of the time
@@ -44693,6 +44830,8 @@ class Model extends EventBus {
44693
44830
  this.uuidGenerator.setIsFastStrategy(true);
44694
44831
  // Initiate stream processor
44695
44832
  this.selection = new SelectionStreamProcessorImpl(this.getters);
44833
+ this.coreHandlers.push(this.range);
44834
+ this.handlers.push(this.range);
44696
44835
  this.corePluginConfig = this.setupCorePluginConfig();
44697
44836
  this.uiPluginConfig = this.setupUiPluginConfig();
44698
44837
  // registering plugins
@@ -44701,15 +44840,23 @@ class Model extends EventBus {
44701
44840
  }
44702
44841
  Object.assign(this.getters, this.coreGetters);
44703
44842
  for (let Plugin of statefulUIPluginRegistry.getAll()) {
44704
- this.statefulUIPlugins.push(this.setupUiPlugin(Plugin));
44843
+ const plugin = this.setupUiPlugin(Plugin);
44844
+ this.statefulUIPlugins.push(plugin);
44845
+ this.handlers.push(plugin);
44705
44846
  }
44706
44847
  for (let Plugin of coreViewsPluginRegistry.getAll()) {
44707
- this.coreViewsPlugins.push(this.setupUiPlugin(Plugin));
44848
+ const plugin = this.setupUiPlugin(Plugin);
44849
+ this.coreViewsPlugins.push(plugin);
44850
+ this.handlers.push(plugin);
44851
+ this.coreHandlers.push(plugin);
44708
44852
  }
44709
44853
  for (let Plugin of featurePluginRegistry.getAll()) {
44710
- this.featurePlugins.push(this.setupUiPlugin(Plugin));
44854
+ const plugin = this.setupUiPlugin(Plugin);
44855
+ this.featurePlugins.push(plugin);
44856
+ this.handlers.push(plugin);
44711
44857
  }
44712
44858
  this.uuidGenerator.setIsFastStrategy(false);
44859
+ this.handlers.push(this.history);
44713
44860
  // starting plugins
44714
44861
  this.dispatch("START");
44715
44862
  // Model should be the last permanent subscriber in the list since he should render
@@ -44731,12 +44878,6 @@ class Model extends EventBus {
44731
44878
  // by owl, since we do not rely on reactivity
44732
44879
  markRaw(this);
44733
44880
  }
44734
- get handlers() {
44735
- return [this.range, ...this.corePlugins, ...this.allUIPlugins, this.history];
44736
- }
44737
- get allUIPlugins() {
44738
- return [...this.statefulUIPlugins, ...this.coreViewsPlugins, ...this.featurePlugins];
44739
- }
44740
44881
  joinSession() {
44741
44882
  this.session.join(this.config.client);
44742
44883
  }
@@ -44778,6 +44919,8 @@ class Model extends EventBus {
44778
44919
  }
44779
44920
  plugin.import(data);
44780
44921
  this.corePlugins.push(plugin);
44922
+ this.coreHandlers.push(plugin);
44923
+ this.handlers.push(plugin);
44781
44924
  }
44782
44925
  onRemoteRevisionReceived({ commands }) {
44783
44926
  for (let command of commands) {
@@ -44920,7 +45063,7 @@ class Model extends EventBus {
44920
45063
  }
44921
45064
  }
44922
45065
  data.revisionId = this.session.getRevisionId() || DEFAULT_REVISION_ID;
44923
- data = JSON.parse(JSON.stringify(data));
45066
+ data = deepCopy(data);
44924
45067
  return data;
44925
45068
  }
44926
45069
  updateMode(mode) {
@@ -44948,7 +45091,7 @@ class Model extends EventBus {
44948
45091
  handler.exportForExcel(data);
44949
45092
  }
44950
45093
  }
44951
- data = JSON.parse(JSON.stringify(data));
45094
+ data = deepCopy(data);
44952
45095
  return getXLSX(data);
44953
45096
  }
44954
45097
  garbageCollectExternalResources() {
@@ -45060,6 +45203,6 @@ function addFunction(functionName, functionDescription) {
45060
45203
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
45061
45204
 
45062
45205
 
45063
- __info__.version = '16.2.3';
45064
- __info__.date = '2023-04-14T12:47:50.453Z';
45065
- __info__.hash = '4514375';
45206
+ __info__.version = '16.2.5';
45207
+ __info__.date = '2023-04-28T12:25:41.422Z';
45208
+ __info__.hash = 'cc60a52';