@odoo/o-spreadsheet 19.1.2 → 19.1.4

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 19.1.2
6
- * @date 2026-01-07T16:21:36.757Z
7
- * @hash febc3e9
5
+ * @version 19.1.4
6
+ * @date 2026-01-21T11:07:17.372Z
7
+ * @hash ceae12a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -179,6 +179,7 @@
179
179
  textColor: "",
180
180
  rotation: 0,
181
181
  };
182
+ const ROTATION_EPSILON = 0.001;
182
183
  const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
183
184
  const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
184
185
  // Fonts
@@ -3841,7 +3842,11 @@
3841
3842
  if (operator === "<>" || operator === "=") {
3842
3843
  let result;
3843
3844
  if (typeof value === typeof operand) {
3844
- if (typeof value === "string" && typeof operand === "string") {
3845
+ if (value === "" && operand === "") {
3846
+ // fast path to avoid regex evaluation
3847
+ result = true;
3848
+ }
3849
+ else if (typeof value === "string" && typeof operand === "string") {
3845
3850
  result = wildcardToRegExp(operand).test(value);
3846
3851
  }
3847
3852
  else {
@@ -4195,7 +4200,16 @@
4195
4200
  }
4196
4201
  acceptToVectorize.push(!argDefinition.acceptMatrix);
4197
4202
  }
4198
- return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
4203
+ return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
4204
+ }
4205
+ function replaceErrorPlaceholderInResult(result) {
4206
+ if (!isMatrix(result)) {
4207
+ replaceFunctionNamePlaceholder(result, descr.name);
4208
+ }
4209
+ else {
4210
+ matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
4211
+ }
4212
+ return result;
4199
4213
  }
4200
4214
  function errorHandlingCompute(...args) {
4201
4215
  for (let i = 0; i < args.length; i++) {
@@ -4224,13 +4238,12 @@
4224
4238
  const result = descr.compute.apply(this, args);
4225
4239
  if (!isMatrix(result)) {
4226
4240
  if (typeof result === "object" && result !== null && "value" in result) {
4227
- replaceFunctionNamePlaceholder(result, descr.name);
4228
4241
  return result;
4229
4242
  }
4243
+ descr.name;
4230
4244
  return { value: result };
4231
4245
  }
4232
4246
  if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
4233
- matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
4234
4247
  return result;
4235
4248
  }
4236
4249
  return matrixMap(result, (row) => ({ value: row }));
@@ -15492,9 +15505,10 @@
15492
15505
  throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
15493
15506
  }
15494
15507
  }
15495
- function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
15508
+ function addPivotDependencies(evalContext, pivotId, forMeasures) {
15496
15509
  //TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
15497
15510
  const dependencies = [];
15511
+ const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
15498
15512
  if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
15499
15513
  const { sheetId, zone } = coreDefinition.dataSet;
15500
15514
  const xc = zoneToXc(zone);
@@ -15511,8 +15525,7 @@
15511
15525
  }
15512
15526
  for (const measure of forMeasures) {
15513
15527
  if (measure.computedBy) {
15514
- const formula = evalContext.getters.getMeasureCompiledFormula(measure);
15515
- dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
15528
+ dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
15516
15529
  }
15517
15530
  }
15518
15531
  const originPosition = evalContext.__originCellPosition;
@@ -16009,7 +16022,7 @@
16009
16022
  assertDomainLength(domainArgs);
16010
16023
  const pivot = this.getters.getPivot(pivotId);
16011
16024
  const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
16012
- addPivotDependencies(this, coreDefinition, coreDefinition.measures.filter((m) => m.id === _measure));
16025
+ addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
16013
16026
  pivot.init({ reload: pivot.needsReevaluation });
16014
16027
  const error = pivot.assertIsValid({ throwOnError: false });
16015
16028
  if (error) {
@@ -16042,8 +16055,7 @@
16042
16055
  const _pivotId = getPivotId(_pivotFormulaId, this.getters);
16043
16056
  assertDomainLength(domainArgs);
16044
16057
  const pivot = this.getters.getPivot(_pivotId);
16045
- const coreDefinition = this.getters.getPivotCoreDefinition(_pivotId);
16046
- addPivotDependencies(this, coreDefinition, []);
16058
+ addPivotDependencies(this, _pivotId, []);
16047
16059
  pivot.init({ reload: pivot.needsReevaluation });
16048
16060
  const error = pivot.assertIsValid({ throwOnError: false });
16049
16061
  if (error) {
@@ -16095,7 +16107,7 @@
16095
16107
  if (pivotStyle.numberOfColumns < 0) {
16096
16108
  return new EvaluationError(_t("The number of columns must be positive."));
16097
16109
  }
16098
- addPivotDependencies(this, coreDefinition, coreDefinition.measures);
16110
+ addPivotDependencies(this, pivotId, coreDefinition.measures);
16099
16111
  pivot.init({ reload: pivot.needsReevaluation });
16100
16112
  const error = pivot.assertIsValid({ throwOnError: false });
16101
16113
  if (error) {
@@ -18342,7 +18354,8 @@
18342
18354
  return children
18343
18355
  .map((child) => (typeof child === "function" ? child(env) : child))
18344
18356
  .flat()
18345
- .map(createAction);
18357
+ .map(createAction)
18358
+ .sort((a, b) => a.sequence - b.sequence);
18346
18359
  }
18347
18360
  : () => [],
18348
18361
  isReadonlyAllowed: item.isReadonlyAllowed || false,
@@ -20003,7 +20016,7 @@ stores.inject(MyMetaStore, storeInstance);
20003
20016
  const groups = groupConsecutive(elements);
20004
20017
  return (range) => {
20005
20018
  if (range.sheetId !== cmd.sheetId) {
20006
- return { changeType: "NONE" };
20019
+ return { changeType: "NONE", range };
20007
20020
  }
20008
20021
  let newRange = range;
20009
20022
  let changeType = "NONE";
@@ -20030,10 +20043,7 @@ stores.inject(MyMetaStore, storeInstance);
20030
20043
  newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
20031
20044
  }
20032
20045
  }
20033
- if (changeType !== "NONE") {
20034
- return { changeType, range: newRange };
20035
- }
20036
- return { changeType: "NONE" };
20046
+ return { changeType, range: newRange };
20037
20047
  };
20038
20048
  }
20039
20049
  function getApplyRangeChangeAddColRow(cmd) {
@@ -20042,7 +20052,7 @@ stores.inject(MyMetaStore, storeInstance);
20042
20052
  const dimension = cmd.dimension === "COL" ? "columns" : "rows";
20043
20053
  return (range) => {
20044
20054
  if (range.sheetId !== cmd.sheetId) {
20045
- return { changeType: "NONE" };
20055
+ return { changeType: "NONE", range };
20046
20056
  }
20047
20057
  if (cmd.position === "after") {
20048
20058
  if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
@@ -20072,13 +20082,13 @@ stores.inject(MyMetaStore, storeInstance);
20072
20082
  };
20073
20083
  }
20074
20084
  }
20075
- return { changeType: "NONE" };
20085
+ return { changeType: "NONE", range };
20076
20086
  };
20077
20087
  }
20078
20088
  function getApplyRangeChangeDeleteSheet(cmd) {
20079
20089
  return (range) => {
20080
20090
  if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
20081
- return { changeType: "NONE" };
20091
+ return { changeType: "NONE", range };
20082
20092
  }
20083
20093
  const invalidSheetName = cmd.sheetName;
20084
20094
  range = {
@@ -20105,14 +20115,14 @@ stores.inject(MyMetaStore, storeInstance);
20105
20115
  const newRange = { ...range, sheetId, invalidSheetName };
20106
20116
  return { changeType: "CHANGE", range: newRange };
20107
20117
  }
20108
- return { changeType: "NONE" };
20118
+ return { changeType: "NONE", range };
20109
20119
  };
20110
20120
  }
20111
20121
  function getApplyRangeChangeMoveRange(cmd) {
20112
20122
  const originZone = cmd.target[0];
20113
20123
  return (range) => {
20114
20124
  if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
20115
- return { changeType: "NONE" };
20125
+ return { changeType: "NONE", range };
20116
20126
  }
20117
20127
  const targetSheetId = cmd.targetSheetId;
20118
20128
  const offsetX = cmd.col - originZone.left;
@@ -20233,11 +20243,20 @@ stores.inject(MyMetaStore, storeInstance);
20233
20243
  /**
20234
20244
  * Get the default height of the cell given its style.
20235
20245
  */
20236
- function getDefaultCellHeight(ctx, cell, style, colSize) {
20246
+ function getDefaultCellHeight(ctx, cell, style, locale, colSize) {
20237
20247
  if (!cell || (!cell.isFormula && !cell.content)) {
20238
20248
  return DEFAULT_CELL_HEIGHT;
20239
20249
  }
20240
- const content = cell.isFormula ? "" : cell.content;
20250
+ let content = "";
20251
+ try {
20252
+ if (!cell.isFormula) {
20253
+ const localeFormat = { format: cell.format, locale };
20254
+ content = formatValue(parseLiteral(cell.content, locale), localeFormat);
20255
+ }
20256
+ }
20257
+ catch {
20258
+ content = CellErrorType.GenericError;
20259
+ }
20241
20260
  return getCellContentHeight(ctx, content, style, colSize);
20242
20261
  }
20243
20262
  function getCellContentHeight(ctx, content, style, colSize) {
@@ -20554,7 +20573,7 @@ stores.inject(MyMetaStore, storeInstance);
20554
20573
  let { x, y } = rect; // top-left when align=left and top-right when align=right, top-center when align=center
20555
20574
  const cos = Math.cos(-style.rotation);
20556
20575
  const sin = Math.sin(-style.rotation);
20557
- const width = rect.textWidth - MIN_CELL_TEXT_MARGIN;
20576
+ const width = rect.textWidth - 2 * MIN_CELL_TEXT_MARGIN;
20558
20577
  const height = rect.textHeight;
20559
20578
  const center = style.align === "center";
20560
20579
  const rotateTowardCellCenter = (style.align === "left") === sin < 0;
@@ -20588,6 +20607,13 @@ stores.inject(MyMetaStore, storeInstance);
20588
20607
  else {
20589
20608
  if (center) {
20590
20609
  x -= sh / 2;
20610
+ y -= height / 2;
20611
+ if (rotateTowardCellCenter) {
20612
+ y += sh;
20613
+ }
20614
+ else {
20615
+ y -= sh;
20616
+ }
20591
20617
  }
20592
20618
  else if (rotateTowardCellCenter) {
20593
20619
  x -= sh;
@@ -21097,7 +21123,7 @@ stores.inject(MyMetaStore, storeInstance);
21097
21123
  continue;
21098
21124
  }
21099
21125
  const sheetXC = tokens[tokenIdx].value;
21100
- const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
21126
+ const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
21101
21127
  if (sheetXC !== newSheetXC) {
21102
21128
  tokens[tokenIdx] = {
21103
21129
  value: newSheetXC,
@@ -21107,23 +21133,30 @@ stores.inject(MyMetaStore, storeInstance);
21107
21133
  }
21108
21134
  return concat$1(tokens.map((token) => token.value));
21109
21135
  }
21110
- function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
21136
+ function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
21111
21137
  const sheetName = splitReference(sheetXC).sheetName;
21112
21138
  if (sheetName
21113
- ? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
21114
- : defaultSheetId !== applyChange.sheetId) {
21115
- return sheetXC;
21139
+ ? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
21140
+ : defaultSheetId !== rangeAdapter.sheetId) {
21141
+ return { changeType: "NONE", range: sheetXC };
21116
21142
  }
21117
- const sheetId = sheetName ? applyChange.sheetId : defaultSheetId;
21143
+ const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
21118
21144
  const range = getRange(sheetXC, sheetId);
21119
21145
  if (range.invalidXc) {
21120
- return sheetXC;
21146
+ return { changeType: "NONE", range: sheetXC };
21121
21147
  }
21122
- const change = applyChange.applyChange(range);
21148
+ const change = rangeAdapter.applyChange(range);
21123
21149
  if (change.changeType === "NONE" || change.changeType === "REMOVE") {
21124
- return sheetXC;
21150
+ return { changeType: change.changeType, range: sheetXC };
21151
+ }
21152
+ const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
21153
+ if (rangeStr === CellErrorType.InvalidReference) {
21154
+ return { changeType: "REMOVE", range: rangeStr };
21125
21155
  }
21126
- return getRangeString(change.range, defaultSheetId, getSheetNameGetter(applyChange));
21156
+ return {
21157
+ changeType: change.changeType,
21158
+ range: rangeStr,
21159
+ };
21127
21160
  }
21128
21161
  function getSheetNameGetter(applyChange) {
21129
21162
  return (sheetId) => {
@@ -21228,8 +21261,6 @@ stores.inject(MyMetaStore, storeInstance);
21228
21261
  }
21229
21262
  const change = applyChange(range);
21230
21263
  switch (change.changeType) {
21231
- case "NONE":
21232
- return range;
21233
21264
  case "REMOVE":
21234
21265
  return undefined;
21235
21266
  default:
@@ -21381,16 +21412,16 @@ stores.inject(MyMetaStore, storeInstance);
21381
21412
  function transformChartDefinitionWithDataSetsWithZone(chartSheetId, definition, applyChange) {
21382
21413
  let labelRange;
21383
21414
  if (definition.labelRange) {
21384
- const adaptedRange = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
21385
- if (adaptedRange !== CellErrorType.InvalidReference) {
21415
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
21416
+ if (changeType !== "REMOVE") {
21386
21417
  labelRange = adaptedRange;
21387
21418
  }
21388
21419
  }
21389
21420
  const dataSets = [];
21390
21421
  for (const dataSet of definition.dataSets) {
21391
21422
  const newDataSet = { ...dataSet };
21392
- const adaptedRange = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
21393
- if (adaptedRange !== CellErrorType.InvalidReference) {
21423
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
21424
+ if (changeType !== "REMOVE") {
21394
21425
  newDataSet.dataRange = adaptedRange;
21395
21426
  dataSets.push(newDataSet);
21396
21427
  }
@@ -31884,7 +31915,7 @@ stores.inject(MyMetaStore, storeInstance);
31884
31915
  cmd.cf.rule = {
31885
31916
  ...rule,
31886
31917
  rangeValues: rule.rangeValues
31887
- ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
31918
+ ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
31888
31919
  : undefined,
31889
31920
  };
31890
31921
  }
@@ -34400,6 +34431,330 @@ stores.inject(MyMetaStore, storeInstance);
34400
34431
  */
34401
34432
  const DEFAULT_SYSTEM_COLOR = "FF000000";
34402
34433
 
34434
+ // -------------------------------------
34435
+ // CF HELPERS
34436
+ // -------------------------------------
34437
+ /**
34438
+ * Convert the conditional formatting o-spreadsheet operator to
34439
+ * the corresponding excel operator.
34440
+ * */
34441
+ function convertOperator(operator) {
34442
+ switch (operator) {
34443
+ case "isNotEmpty":
34444
+ return "notContainsBlanks";
34445
+ case "isEmpty":
34446
+ return "containsBlanks";
34447
+ case "notContainsText":
34448
+ return "notContainsBlanks";
34449
+ case "containsText":
34450
+ return "containsText";
34451
+ case "beginsWithText":
34452
+ return "beginsWith";
34453
+ case "endsWithText":
34454
+ return "endsWith";
34455
+ case "isGreaterThan":
34456
+ return "greaterThan";
34457
+ case "isGreaterOrEqualTo":
34458
+ return "greaterThanOrEqual";
34459
+ case "isLessThan":
34460
+ return "lessThan";
34461
+ case "isLessOrEqualTo":
34462
+ return "lessThanOrEqual";
34463
+ case "isBetween":
34464
+ return "between";
34465
+ case "isNotBetween":
34466
+ return "notBetween";
34467
+ case "isEqual":
34468
+ return "equal";
34469
+ case "isNotEqual":
34470
+ return "notEqual";
34471
+ case "customFormula":
34472
+ return "";
34473
+ case "dateIs":
34474
+ return "";
34475
+ case "dateIsBefore":
34476
+ return "lessThan";
34477
+ case "dateIsAfter":
34478
+ return "greaterThan";
34479
+ case "dateIsOnOrAfter":
34480
+ return "greaterThanOrEqual";
34481
+ case "dateIsOnOrBefore":
34482
+ return "lessThanOrEqual";
34483
+ }
34484
+ }
34485
+ // -------------------------------------
34486
+ // WORKSHEET HELPERS
34487
+ // -------------------------------------
34488
+ function getCellType(value) {
34489
+ switch (typeof value) {
34490
+ case "boolean":
34491
+ return "b";
34492
+ case "string":
34493
+ return "str";
34494
+ case "number":
34495
+ return "n";
34496
+ default:
34497
+ return undefined;
34498
+ }
34499
+ }
34500
+ function convertHeightToExcel(height) {
34501
+ return Math.round(HEIGHT_FACTOR * height * 100) / 100;
34502
+ }
34503
+ function convertWidthToExcel(width) {
34504
+ return Math.round(WIDTH_FACTOR * width * 100) / 100;
34505
+ }
34506
+ function convertHeightFromExcel(height) {
34507
+ if (!height)
34508
+ return height;
34509
+ return Math.round((height / HEIGHT_FACTOR) * 100) / 100;
34510
+ }
34511
+ function convertWidthFromExcel(width) {
34512
+ if (!width)
34513
+ return width;
34514
+ return Math.round((width / WIDTH_FACTOR) * 100) / 100;
34515
+ }
34516
+ function extractStyle(data, content, styleId, formatId, borderId) {
34517
+ const style = styleId ? data.styles[styleId] : {};
34518
+ const format = formatId ? data.formats[formatId] : undefined;
34519
+ const styles = {
34520
+ font: {
34521
+ size: style?.fontSize || DEFAULT_FONT_SIZE,
34522
+ color: { rgb: style?.textColor ? style.textColor : "000000" },
34523
+ family: 2,
34524
+ name: "Arial",
34525
+ },
34526
+ fill: style?.fillColor
34527
+ ? {
34528
+ fgColor: { rgb: style.fillColor },
34529
+ }
34530
+ : { reservedAttribute: "none" },
34531
+ numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
34532
+ border: borderId || 0,
34533
+ alignment: {
34534
+ horizontal: style.align,
34535
+ vertical: style.verticalAlign
34536
+ ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
34537
+ : undefined,
34538
+ wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
34539
+ textRotation: style.rotation ? rotationToXLSX(style.rotation) : undefined,
34540
+ shrinkToFit: style.wrapping === "clip" ? true : undefined,
34541
+ },
34542
+ };
34543
+ styles.font["strike"] = !!style?.strikethrough || undefined;
34544
+ styles.font["underline"] = !!style?.underline || undefined;
34545
+ styles.font["bold"] = !!style?.bold || undefined;
34546
+ styles.font["italic"] = !!style?.italic || undefined;
34547
+ return styles;
34548
+ }
34549
+ function rotationToXLSX(rad) {
34550
+ let deg = Math.round((-rad / Math.PI) * 180) % 180;
34551
+ if (deg > 90) {
34552
+ deg -= 180;
34553
+ }
34554
+ else if (deg < -90) {
34555
+ deg += 180;
34556
+ }
34557
+ if (deg >= 0) {
34558
+ return deg;
34559
+ }
34560
+ else {
34561
+ return 90 - deg;
34562
+ }
34563
+ }
34564
+ function rotationFromXLSX(deg) {
34565
+ if (deg <= 90) {
34566
+ return -(deg / 180) * Math.PI;
34567
+ }
34568
+ else {
34569
+ return (-(90 - deg) / 180) * Math.PI;
34570
+ }
34571
+ }
34572
+ function normalizeStyle(construct, styles) {
34573
+ // Normalize this
34574
+ const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
34575
+ const style = {
34576
+ fontId: pushElement(styles.font, construct.fonts),
34577
+ fillId: pushElement(styles.fill, construct.fills),
34578
+ borderId: styles.border,
34579
+ numFmtId,
34580
+ alignment: {
34581
+ vertical: styles.alignment.vertical,
34582
+ horizontal: styles.alignment.horizontal,
34583
+ wrapText: styles.alignment.wrapText,
34584
+ textRotation: styles.alignment.textRotation,
34585
+ shrinkToFit: styles.alignment.shrinkToFit,
34586
+ },
34587
+ };
34588
+ return pushElement(style, construct.styles);
34589
+ }
34590
+ function convertFormat(format, numFmtStructure) {
34591
+ if (!format) {
34592
+ return 0;
34593
+ }
34594
+ let formatId = XLSX_FORMAT_MAP[format.format];
34595
+ if (!formatId) {
34596
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
34597
+ }
34598
+ return formatId;
34599
+ }
34600
+ /**
34601
+ * Add a relation to the given file and return its id.
34602
+ */
34603
+ function addRelsToFile(relsFiles, path, rel) {
34604
+ const relsFile = relsFiles.find((file) => file.path === path);
34605
+ // the id is a one-based int casted as string
34606
+ let id;
34607
+ if (!relsFile) {
34608
+ id = "rId1";
34609
+ relsFiles.push({ path, rels: [{ ...rel, id }] });
34610
+ }
34611
+ else {
34612
+ id = `rId${(relsFile.rels.length + 1).toString()}`;
34613
+ relsFile.rels.push({
34614
+ ...rel,
34615
+ id,
34616
+ });
34617
+ }
34618
+ return id;
34619
+ }
34620
+ const globalReverseLookup = new WeakMap();
34621
+ function pushElement(property, propertyList) {
34622
+ let reverseLookup = globalReverseLookup.get(propertyList);
34623
+ if (!reverseLookup) {
34624
+ reverseLookup = new Map();
34625
+ for (let i = 0; i < propertyList.length; i++) {
34626
+ const canonical = getCanonicalRepresentation(propertyList[i]);
34627
+ reverseLookup.set(canonical, i);
34628
+ }
34629
+ globalReverseLookup.set(propertyList, reverseLookup);
34630
+ }
34631
+ const canonical = getCanonicalRepresentation(property);
34632
+ if (reverseLookup.has(canonical)) {
34633
+ return reverseLookup.get(canonical);
34634
+ }
34635
+ const maxId = propertyList.length;
34636
+ propertyList.push(property);
34637
+ reverseLookup.set(canonical, maxId);
34638
+ return maxId;
34639
+ }
34640
+ /**
34641
+ * Convert a chart o-spreadsheet id to a xlsx id which
34642
+ * are unsigned integers (starting from 1).
34643
+ */
34644
+ function convertChartId(chartId, construct) {
34645
+ const xlsxId = construct.chartIds.findIndex((id) => id === chartId);
34646
+ if (xlsxId === -1) {
34647
+ construct.chartIds.push(chartId);
34648
+ return construct.chartIds.length;
34649
+ }
34650
+ return xlsxId + 1;
34651
+ }
34652
+ const imageIds = [];
34653
+ /**
34654
+ * Convert a image o-spreadsheet id to a xlsx id which
34655
+ * are unsigned integers (starting from 1).
34656
+ */
34657
+ function convertImageId(imageId) {
34658
+ const xlsxId = imageIds.findIndex((id) => id === imageId);
34659
+ if (xlsxId === -1) {
34660
+ imageIds.push(imageId);
34661
+ return imageIds.length;
34662
+ }
34663
+ return xlsxId + 1;
34664
+ }
34665
+ /**
34666
+ * Convert a value expressed in dot to EMU.
34667
+ * EMU = English Metrical Unit
34668
+ * There are 914400 EMU per inch.
34669
+ *
34670
+ * /!\ A value expressed in EMU cannot be fractional.
34671
+ * See https://docs.microsoft.com/en-us/windows/win32/vml/msdn-online-vml-units#other-units-of-measurement
34672
+ */
34673
+ function convertDotValueToEMU(value) {
34674
+ const DPI = 96;
34675
+ return Math.round((value * 914400) / DPI);
34676
+ }
34677
+ function getRangeSize(reference, defaultSheetIndex, data) {
34678
+ let xc = reference;
34679
+ let sheetName = undefined;
34680
+ ({ xc, sheetName } = splitReference(reference));
34681
+ let rangeSheetIndex;
34682
+ if (sheetName) {
34683
+ const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
34684
+ if (index < 0) {
34685
+ throw new Error("Unable to find a sheet with the name " + sheetName);
34686
+ }
34687
+ rangeSheetIndex = index;
34688
+ }
34689
+ else {
34690
+ rangeSheetIndex = Number(defaultSheetIndex);
34691
+ }
34692
+ const zone = toUnboundedZone(xc);
34693
+ if (zone.right === undefined) {
34694
+ zone.right = data.sheets[rangeSheetIndex].colNumber;
34695
+ }
34696
+ if (zone.bottom === undefined) {
34697
+ zone.bottom = data.sheets[rangeSheetIndex].rowNumber;
34698
+ }
34699
+ return (zone.right - zone.left + 1) * (zone.bottom - zone.top + 1);
34700
+ }
34701
+ function convertEMUToDotValue(value) {
34702
+ const DPI = 96;
34703
+ return Math.round((value * DPI) / 914400);
34704
+ }
34705
+ /**
34706
+ * Get the position of the start of a column in Excel (in px).
34707
+ */
34708
+ function getColPosition(colIndex, sheetData) {
34709
+ let position = 0;
34710
+ for (let i = 0; i < colIndex; i++) {
34711
+ const colAtIndex = sheetData.cols.find((col) => i >= col.min && i <= col.max);
34712
+ if (colAtIndex?.width) {
34713
+ position += colAtIndex.width;
34714
+ }
34715
+ else if (sheetData.sheetFormat?.defaultColWidth) {
34716
+ position += sheetData.sheetFormat.defaultColWidth;
34717
+ }
34718
+ else {
34719
+ position += EXCEL_DEFAULT_COL_WIDTH;
34720
+ }
34721
+ }
34722
+ return position / WIDTH_FACTOR;
34723
+ }
34724
+ /**
34725
+ * Get the position of the start of a row in Excel (in px).
34726
+ */
34727
+ function getRowPosition(rowIndex, sheetData) {
34728
+ let position = 0;
34729
+ for (let i = 0; i < rowIndex; i++) {
34730
+ const rowAtIndex = sheetData.rows.find((row) => row.index - 1 === i);
34731
+ if (rowAtIndex?.height) {
34732
+ position += rowAtIndex.height;
34733
+ }
34734
+ else if (sheetData.sheetFormat?.defaultRowHeight) {
34735
+ position += sheetData.sheetFormat.defaultRowHeight;
34736
+ }
34737
+ else {
34738
+ position += EXCEL_DEFAULT_ROW_HEIGHT;
34739
+ }
34740
+ }
34741
+ return position / HEIGHT_FACTOR;
34742
+ }
34743
+ /**
34744
+ * Convert the o-spreadsheet data validation decimal
34745
+ * criterion type to the corresponding excel operator.
34746
+ */
34747
+ function convertDecimalCriterionTypeToExcelOperator(operator) {
34748
+ return Object.keys(XLSX_DV_DECIMAL_OPERATOR_MAPPING).find((key) => XLSX_DV_DECIMAL_OPERATOR_MAPPING[key] === operator);
34749
+ }
34750
+ /**
34751
+ * Convert the o-spreadsheet data validation date
34752
+ * criterion type to the corresponding excel operator.
34753
+ */
34754
+ function convertDateCriterionTypeToExcelOperator(operator) {
34755
+ return Object.keys(XLSX_DV_DATE_OPERATOR_TO_DV_TYPE_MAPPING).find((key) => XLSX_DV_DATE_OPERATOR_TO_DV_TYPE_MAPPING[key] === operator);
34756
+ }
34757
+
34403
34758
  const XLSX_DATE_FORMAT_REGEX = /^(yy|yyyy|m{1,5}|d{1,4}|h{1,2}|s{1,2}|am\/pm|a\/m|\s|-|\/|\.|:)+$/i;
34404
34759
  /**
34405
34760
  * Convert excel format to o_spreadsheet format
@@ -34499,6 +34854,9 @@ stores.inject(MyMetaStore, storeInstance);
34499
34854
  align: styleStruct.alignment?.horizontal
34500
34855
  ? H_ALIGNMENT_CONVERSION_MAP[styleStruct.alignment.horizontal]
34501
34856
  : undefined,
34857
+ rotation: styleStruct.alignment?.textRotation
34858
+ ? rotationFromXLSX(styleStruct.alignment.textRotation)
34859
+ : undefined,
34502
34860
  // In xlsx fills, bgColor is the color of the fill, and fgColor is the color of the pattern above the background, except in solid fills
34503
34861
  fillColor: styleStruct.fillStyle?.patternType === "solid"
34504
34862
  ? convertColor(styleStruct.fillStyle?.fgColor)
@@ -34798,303 +35156,6 @@ stores.inject(MyMetaStore, storeInstance);
34798
35156
  }
34799
35157
  }
34800
35158
 
34801
- // -------------------------------------
34802
- // CF HELPERS
34803
- // -------------------------------------
34804
- /**
34805
- * Convert the conditional formatting o-spreadsheet operator to
34806
- * the corresponding excel operator.
34807
- * */
34808
- function convertOperator(operator) {
34809
- switch (operator) {
34810
- case "isNotEmpty":
34811
- return "notContainsBlanks";
34812
- case "isEmpty":
34813
- return "containsBlanks";
34814
- case "notContainsText":
34815
- return "notContainsBlanks";
34816
- case "containsText":
34817
- return "containsText";
34818
- case "beginsWithText":
34819
- return "beginsWith";
34820
- case "endsWithText":
34821
- return "endsWith";
34822
- case "isGreaterThan":
34823
- return "greaterThan";
34824
- case "isGreaterOrEqualTo":
34825
- return "greaterThanOrEqual";
34826
- case "isLessThan":
34827
- return "lessThan";
34828
- case "isLessOrEqualTo":
34829
- return "lessThanOrEqual";
34830
- case "isBetween":
34831
- return "between";
34832
- case "isNotBetween":
34833
- return "notBetween";
34834
- case "isEqual":
34835
- return "equal";
34836
- case "isNotEqual":
34837
- return "notEqual";
34838
- case "customFormula":
34839
- return "";
34840
- case "dateIs":
34841
- return "";
34842
- case "dateIsBefore":
34843
- return "lessThan";
34844
- case "dateIsAfter":
34845
- return "greaterThan";
34846
- case "dateIsOnOrAfter":
34847
- return "greaterThanOrEqual";
34848
- case "dateIsOnOrBefore":
34849
- return "lessThanOrEqual";
34850
- }
34851
- }
34852
- // -------------------------------------
34853
- // WORKSHEET HELPERS
34854
- // -------------------------------------
34855
- function getCellType(value) {
34856
- switch (typeof value) {
34857
- case "boolean":
34858
- return "b";
34859
- case "string":
34860
- return "str";
34861
- case "number":
34862
- return "n";
34863
- default:
34864
- return undefined;
34865
- }
34866
- }
34867
- function convertHeightToExcel(height) {
34868
- return Math.round(HEIGHT_FACTOR * height * 100) / 100;
34869
- }
34870
- function convertWidthToExcel(width) {
34871
- return Math.round(WIDTH_FACTOR * width * 100) / 100;
34872
- }
34873
- function convertHeightFromExcel(height) {
34874
- if (!height)
34875
- return height;
34876
- return Math.round((height / HEIGHT_FACTOR) * 100) / 100;
34877
- }
34878
- function convertWidthFromExcel(width) {
34879
- if (!width)
34880
- return width;
34881
- return Math.round((width / WIDTH_FACTOR) * 100) / 100;
34882
- }
34883
- function extractStyle(data, content, styleId, formatId, borderId) {
34884
- const style = styleId ? data.styles[styleId] : {};
34885
- const format = formatId ? data.formats[formatId] : undefined;
34886
- const styles = {
34887
- font: {
34888
- size: style?.fontSize || DEFAULT_FONT_SIZE,
34889
- color: { rgb: style?.textColor ? style.textColor : "000000" },
34890
- family: 2,
34891
- name: "Arial",
34892
- },
34893
- fill: style?.fillColor
34894
- ? {
34895
- fgColor: { rgb: style.fillColor },
34896
- }
34897
- : { reservedAttribute: "none" },
34898
- numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
34899
- border: borderId || 0,
34900
- alignment: {
34901
- horizontal: style.align,
34902
- vertical: style.verticalAlign
34903
- ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
34904
- : undefined,
34905
- wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
34906
- },
34907
- };
34908
- styles.font["strike"] = !!style?.strikethrough || undefined;
34909
- styles.font["underline"] = !!style?.underline || undefined;
34910
- styles.font["bold"] = !!style?.bold || undefined;
34911
- styles.font["italic"] = !!style?.italic || undefined;
34912
- return styles;
34913
- }
34914
- function normalizeStyle(construct, styles) {
34915
- // Normalize this
34916
- const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
34917
- const style = {
34918
- fontId: pushElement(styles.font, construct.fonts),
34919
- fillId: pushElement(styles.fill, construct.fills),
34920
- borderId: styles.border,
34921
- numFmtId,
34922
- alignment: {
34923
- vertical: styles.alignment.vertical,
34924
- horizontal: styles.alignment.horizontal,
34925
- wrapText: styles.alignment.wrapText,
34926
- },
34927
- };
34928
- return pushElement(style, construct.styles);
34929
- }
34930
- function convertFormat(format, numFmtStructure) {
34931
- if (!format) {
34932
- return 0;
34933
- }
34934
- let formatId = XLSX_FORMAT_MAP[format.format];
34935
- if (!formatId) {
34936
- formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
34937
- }
34938
- return formatId;
34939
- }
34940
- /**
34941
- * Add a relation to the given file and return its id.
34942
- */
34943
- function addRelsToFile(relsFiles, path, rel) {
34944
- const relsFile = relsFiles.find((file) => file.path === path);
34945
- // the id is a one-based int casted as string
34946
- let id;
34947
- if (!relsFile) {
34948
- id = "rId1";
34949
- relsFiles.push({ path, rels: [{ ...rel, id }] });
34950
- }
34951
- else {
34952
- id = `rId${(relsFile.rels.length + 1).toString()}`;
34953
- relsFile.rels.push({
34954
- ...rel,
34955
- id,
34956
- });
34957
- }
34958
- return id;
34959
- }
34960
- const globalReverseLookup = new WeakMap();
34961
- function pushElement(property, propertyList) {
34962
- let reverseLookup = globalReverseLookup.get(propertyList);
34963
- if (!reverseLookup) {
34964
- reverseLookup = new Map();
34965
- for (let i = 0; i < propertyList.length; i++) {
34966
- const canonical = getCanonicalRepresentation(propertyList[i]);
34967
- reverseLookup.set(canonical, i);
34968
- }
34969
- globalReverseLookup.set(propertyList, reverseLookup);
34970
- }
34971
- const canonical = getCanonicalRepresentation(property);
34972
- if (reverseLookup.has(canonical)) {
34973
- return reverseLookup.get(canonical);
34974
- }
34975
- const maxId = propertyList.length;
34976
- propertyList.push(property);
34977
- reverseLookup.set(canonical, maxId);
34978
- return maxId;
34979
- }
34980
- /**
34981
- * Convert a chart o-spreadsheet id to a xlsx id which
34982
- * are unsigned integers (starting from 1).
34983
- */
34984
- function convertChartId(chartId, construct) {
34985
- const xlsxId = construct.chartIds.findIndex((id) => id === chartId);
34986
- if (xlsxId === -1) {
34987
- construct.chartIds.push(chartId);
34988
- return construct.chartIds.length;
34989
- }
34990
- return xlsxId + 1;
34991
- }
34992
- const imageIds = [];
34993
- /**
34994
- * Convert a image o-spreadsheet id to a xlsx id which
34995
- * are unsigned integers (starting from 1).
34996
- */
34997
- function convertImageId(imageId) {
34998
- const xlsxId = imageIds.findIndex((id) => id === imageId);
34999
- if (xlsxId === -1) {
35000
- imageIds.push(imageId);
35001
- return imageIds.length;
35002
- }
35003
- return xlsxId + 1;
35004
- }
35005
- /**
35006
- * Convert a value expressed in dot to EMU.
35007
- * EMU = English Metrical Unit
35008
- * There are 914400 EMU per inch.
35009
- *
35010
- * /!\ A value expressed in EMU cannot be fractional.
35011
- * See https://docs.microsoft.com/en-us/windows/win32/vml/msdn-online-vml-units#other-units-of-measurement
35012
- */
35013
- function convertDotValueToEMU(value) {
35014
- const DPI = 96;
35015
- return Math.round((value * 914400) / DPI);
35016
- }
35017
- function getRangeSize(reference, defaultSheetIndex, data) {
35018
- let xc = reference;
35019
- let sheetName = undefined;
35020
- ({ xc, sheetName } = splitReference(reference));
35021
- let rangeSheetIndex;
35022
- if (sheetName) {
35023
- const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
35024
- if (index < 0) {
35025
- throw new Error("Unable to find a sheet with the name " + sheetName);
35026
- }
35027
- rangeSheetIndex = index;
35028
- }
35029
- else {
35030
- rangeSheetIndex = Number(defaultSheetIndex);
35031
- }
35032
- const zone = toUnboundedZone(xc);
35033
- if (zone.right === undefined) {
35034
- zone.right = data.sheets[rangeSheetIndex].colNumber;
35035
- }
35036
- if (zone.bottom === undefined) {
35037
- zone.bottom = data.sheets[rangeSheetIndex].rowNumber;
35038
- }
35039
- return (zone.right - zone.left + 1) * (zone.bottom - zone.top + 1);
35040
- }
35041
- function convertEMUToDotValue(value) {
35042
- const DPI = 96;
35043
- return Math.round((value * DPI) / 914400);
35044
- }
35045
- /**
35046
- * Get the position of the start of a column in Excel (in px).
35047
- */
35048
- function getColPosition(colIndex, sheetData) {
35049
- let position = 0;
35050
- for (let i = 0; i < colIndex; i++) {
35051
- const colAtIndex = sheetData.cols.find((col) => i >= col.min && i <= col.max);
35052
- if (colAtIndex?.width) {
35053
- position += colAtIndex.width;
35054
- }
35055
- else if (sheetData.sheetFormat?.defaultColWidth) {
35056
- position += sheetData.sheetFormat.defaultColWidth;
35057
- }
35058
- else {
35059
- position += EXCEL_DEFAULT_COL_WIDTH;
35060
- }
35061
- }
35062
- return position / WIDTH_FACTOR;
35063
- }
35064
- /**
35065
- * Get the position of the start of a row in Excel (in px).
35066
- */
35067
- function getRowPosition(rowIndex, sheetData) {
35068
- let position = 0;
35069
- for (let i = 0; i < rowIndex; i++) {
35070
- const rowAtIndex = sheetData.rows.find((row) => row.index - 1 === i);
35071
- if (rowAtIndex?.height) {
35072
- position += rowAtIndex.height;
35073
- }
35074
- else if (sheetData.sheetFormat?.defaultRowHeight) {
35075
- position += sheetData.sheetFormat.defaultRowHeight;
35076
- }
35077
- else {
35078
- position += EXCEL_DEFAULT_ROW_HEIGHT;
35079
- }
35080
- }
35081
- return position / HEIGHT_FACTOR;
35082
- }
35083
- /**
35084
- * Convert the o-spreadsheet data validation decimal
35085
- * criterion type to the corresponding excel operator.
35086
- */
35087
- function convertDecimalCriterionTypeToExcelOperator(operator) {
35088
- return Object.keys(XLSX_DV_DECIMAL_OPERATOR_MAPPING).find((key) => XLSX_DV_DECIMAL_OPERATOR_MAPPING[key] === operator);
35089
- }
35090
- /**
35091
- * Convert the o-spreadsheet data validation date
35092
- * criterion type to the corresponding excel operator.
35093
- */
35094
- function convertDateCriterionTypeToExcelOperator(operator) {
35095
- return Object.keys(XLSX_DV_DATE_OPERATOR_TO_DV_TYPE_MAPPING).find((key) => XLSX_DV_DATE_OPERATOR_TO_DV_TYPE_MAPPING[key] === operator);
35096
- }
35097
-
35098
35159
  function convertFigures(sheetData) {
35099
35160
  let id = 1;
35100
35161
  return sheetData.figures
@@ -38809,7 +38870,7 @@ stores.inject(MyMetaStore, storeInstance);
38809
38870
  * @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
38810
38871
  * @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
38811
38872
  */
38812
- adaptRanges(applyChange, sheetId, sheetName) { }
38873
+ adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
38813
38874
  }
38814
38875
 
38815
38876
  class BordersPlugin extends CorePlugin {
@@ -38883,7 +38944,7 @@ stores.inject(MyMetaStore, storeInstance);
38883
38944
  }
38884
38945
  }
38885
38946
  }
38886
- adaptRanges(applyChange, sheetId) {
38947
+ adaptRanges({ applyChange }, sheetId) {
38887
38948
  const newBorders = [];
38888
38949
  for (const border of this.borders[sheetId] ?? []) {
38889
38950
  const change = applyChange(this.getters.getRangeFromZone(sheetId, border.zone));
@@ -39364,7 +39425,7 @@ stores.inject(MyMetaStore, storeInstance);
39364
39425
  ];
39365
39426
  nextId = 1;
39366
39427
  cells = {};
39367
- adaptRanges(applyChange, sheetId, sheetName) {
39428
+ adaptRanges({ applyChange }, sheetId, sheetName) {
39368
39429
  for (const sheet of Object.keys(this.cells)) {
39369
39430
  for (const cell of Object.values(this.cells[sheet] || {})) {
39370
39431
  if (cell.isFormula) {
@@ -39925,12 +39986,12 @@ stores.inject(MyMetaStore, storeInstance);
39925
39986
  charts = {};
39926
39987
  createChart = chartFactory(this.getters);
39927
39988
  validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
39928
- adaptRanges(applyChange, sheetId, adaptSheetName) {
39989
+ adaptRanges(rangeAdapters) {
39929
39990
  for (const [chartId, chart] of Object.entries(this.charts)) {
39930
39991
  if (!chart) {
39931
39992
  continue;
39932
39993
  }
39933
- const newChart = chart.chart.updateRanges(applyChange, sheetId, adaptSheetName);
39994
+ const newChart = chart.chart.updateRanges(rangeAdapters);
39934
39995
  this.history.update("charts", chartId, newChart ? { figureId: chart.figureId, chart: newChart } : undefined);
39935
39996
  }
39936
39997
  }
@@ -40751,7 +40812,7 @@ stores.inject(MyMetaStore, storeInstance);
40751
40812
  "getAdaptedCfRanges",
40752
40813
  ];
40753
40814
  cfRules = {};
40754
- adaptCFFormulas(applyChange) {
40815
+ adaptCFFormulas({ applyChange, adaptFormulaString }) {
40755
40816
  for (const sheetId in this.cfRules) {
40756
40817
  for (const rule of this.cfRules[sheetId]) {
40757
40818
  if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
@@ -40775,7 +40836,7 @@ stores.inject(MyMetaStore, storeInstance);
40775
40836
  for (let i = 0; i < rule.rule.values.length; i++) {
40776
40837
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
40777
40838
  //@ts-expect-error
40778
- "values", i, this.getters.adaptFormulaStringDependencies(sheetId, rule.rule.values[i], applyChange));
40839
+ "values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
40779
40840
  }
40780
40841
  }
40781
40842
  else if (rule.rule.type === "IconSetRule") {
@@ -40783,7 +40844,7 @@ stores.inject(MyMetaStore, storeInstance);
40783
40844
  if (rule.rule[inflectionPoint].type === "formula") {
40784
40845
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
40785
40846
  //@ts-expect-error
40786
- inflectionPoint, "value", this.getters.adaptFormulaStringDependencies(sheetId, rule.rule[inflectionPoint].value, applyChange));
40847
+ inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
40787
40848
  }
40788
40849
  }
40789
40850
  }
@@ -40793,14 +40854,14 @@ stores.inject(MyMetaStore, storeInstance);
40793
40854
  if (ruleValue?.type === "formula" && ruleValue?.value) {
40794
40855
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
40795
40856
  //@ts-expect-error
40796
- value, "value", this.getters.adaptFormulaStringDependencies(sheetId, ruleValue.value, applyChange));
40857
+ value, "value", adaptFormulaString(sheetId, ruleValue.value));
40797
40858
  }
40798
40859
  }
40799
40860
  }
40800
40861
  }
40801
40862
  }
40802
40863
  }
40803
- adaptCFRanges(sheetId, applyChange) {
40864
+ adaptCFRanges(sheetId, { applyChange }) {
40804
40865
  for (const rule of this.cfRules[sheetId]) {
40805
40866
  for (const range of rule.ranges) {
40806
40867
  const change = applyChange(range);
@@ -40824,12 +40885,12 @@ stores.inject(MyMetaStore, storeInstance);
40824
40885
  }
40825
40886
  }
40826
40887
  }
40827
- adaptRanges(applyChange, sheetId) {
40888
+ adaptRanges(rangeAdapters, sheetId) {
40828
40889
  const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
40829
40890
  for (const sheetId of sheetIds) {
40830
- this.adaptCFRanges(sheetId, applyChange);
40891
+ this.adaptCFRanges(sheetId, rangeAdapters);
40831
40892
  }
40832
- this.adaptCFFormulas(applyChange);
40893
+ this.adaptCFFormulas(rangeAdapters);
40833
40894
  }
40834
40895
  // ---------------------------------------------------------------------------
40835
40896
  // Command Handling
@@ -41206,23 +41267,23 @@ stores.inject(MyMetaStore, storeInstance);
41206
41267
  "getValidationRuleForCell",
41207
41268
  ];
41208
41269
  rules = {};
41209
- adaptRanges(applyChange, sheetId) {
41210
- this.adaptDVRanges(sheetId, applyChange);
41211
- this.adaptDVFormulas(applyChange);
41270
+ adaptRanges(rangeAdapters, sheetId) {
41271
+ this.adaptDVRanges(sheetId, rangeAdapters);
41272
+ this.adaptDVFormulas(rangeAdapters);
41212
41273
  }
41213
- adaptDVFormulas(applyChange) {
41274
+ adaptDVFormulas({ adaptFormulaString }) {
41214
41275
  for (const sheetId in this.rules) {
41215
41276
  const rules = this.rules[sheetId];
41216
41277
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
41217
41278
  const rule = this.rules[sheetId][ruleIndex];
41218
41279
  for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
41219
- const value = this.getters.adaptFormulaStringDependencies(sheetId, rule.criterion.values[valueIndex], applyChange);
41280
+ const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
41220
41281
  this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
41221
41282
  }
41222
41283
  }
41223
41284
  }
41224
41285
  }
41225
- adaptDVRanges(sheetId, applyChange) {
41286
+ adaptDVRanges(sheetId, { applyChange }) {
41226
41287
  const rules = this.rules[sheetId];
41227
41288
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
41228
41289
  const rule = this.rules[sheetId][ruleIndex];
@@ -41496,7 +41557,7 @@ stores.inject(MyMetaStore, storeInstance);
41496
41557
  // ---------------------------------------------------------------------------
41497
41558
  // Command Handling
41498
41559
  // ---------------------------------------------------------------------------
41499
- adaptRanges(applyChange, sheetId) {
41560
+ adaptRanges({ applyChange }, sheetId) {
41500
41561
  for (const figure of this.getFigures(sheetId)) {
41501
41562
  const change = applyChange(this.getters.getRangeFromZone(sheetId, {
41502
41563
  left: figure.col,
@@ -42736,8 +42797,8 @@ stores.inject(MyMetaStore, storeInstance);
42736
42797
  break;
42737
42798
  }
42738
42799
  }
42739
- adaptRanges(applyChange, sheetId) {
42740
- this.applyRangeChangeOnSheet(sheetId, applyChange);
42800
+ adaptRanges(rangeAdapters, sheetId) {
42801
+ this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
42741
42802
  }
42742
42803
  // ---------------------------------------------------------------------------
42743
42804
  // Getters
@@ -43037,7 +43098,7 @@ stores.inject(MyMetaStore, storeInstance);
43037
43098
  /**
43038
43099
  * Apply a range change on merges of a particular sheet.
43039
43100
  */
43040
- applyRangeChangeOnSheet(sheetId, applyChange) {
43101
+ applyRangeChangeOnSheet(sheetId, { applyChange }) {
43041
43102
  const merges = Object.entries(this.merges[sheetId] || {});
43042
43103
  for (const [mergeId, range] of merges) {
43043
43104
  if (range) {
@@ -44656,8 +44717,6 @@ stores.inject(MyMetaStore, storeInstance);
44656
44717
  }
44657
44718
  const change = applyChange(range);
44658
44719
  switch (change.changeType) {
44659
- case "NONE":
44660
- return range;
44661
44720
  case "REMOVE":
44662
44721
  return undefined;
44663
44722
  default:
@@ -44675,6 +44734,7 @@ stores.inject(MyMetaStore, storeInstance);
44675
44734
  "getMeasureCompiledFormula",
44676
44735
  "getPivotName",
44677
44736
  "isExistingPivot",
44737
+ "getMeasureFullDependencies",
44678
44738
  ];
44679
44739
  nextFormulaId = 1;
44680
44740
  pivots = {};
@@ -44760,12 +44820,12 @@ stores.inject(MyMetaStore, storeInstance);
44760
44820
  }
44761
44821
  case "UPDATE_PIVOT": {
44762
44822
  this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
44763
- this.compileCalculatedMeasures(cmd.pivot.measures);
44823
+ this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
44764
44824
  break;
44765
44825
  }
44766
44826
  }
44767
44827
  }
44768
- adaptRanges(applyChange) {
44828
+ adaptRanges({ applyChange, adaptFormulaString }) {
44769
44829
  for (const pivotId in this.pivots) {
44770
44830
  const definition = deepCopy(this.pivots[pivotId]?.definition);
44771
44831
  if (!definition) {
@@ -44778,22 +44838,22 @@ stores.inject(MyMetaStore, storeInstance);
44778
44838
  this.history.update("pivots", pivotId, "definition", newDefinition);
44779
44839
  }
44780
44840
  }
44781
- for (const sheetId in this.compiledMeasureFormulas) {
44782
- for (const formulaString in this.compiledMeasureFormulas[sheetId]) {
44783
- const compiledFormula = this.compiledMeasureFormulas[sheetId][formulaString];
44784
- const newDependencies = [];
44785
- for (const range of compiledFormula.dependencies) {
44786
- const change = applyChange(range);
44787
- if (change.changeType === "NONE") {
44788
- newDependencies.push(range);
44789
- }
44790
- else {
44791
- newDependencies.push(change.range);
44792
- }
44841
+ for (const pivotId in this.compiledMeasureFormulas) {
44842
+ for (const measureId in this.compiledMeasureFormulas[pivotId]) {
44843
+ const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
44844
+ if (!measure || !measure.computedBy) {
44845
+ continue;
44793
44846
  }
44794
- const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
44795
- if (newFormulaString !== formulaString) {
44796
- this.replaceMeasureFormula(sheetId, formulaString, newFormulaString);
44847
+ const sheetId = measure.computedBy.sheetId;
44848
+ const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
44849
+ // adapt direct dependencies
44850
+ this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
44851
+ // adapt all dependencies (including indirect)
44852
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
44853
+ const oldFormulaString = measure.computedBy.formula;
44854
+ const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
44855
+ if (newFormulaString !== oldFormulaString) {
44856
+ this.replaceMeasureFormula(pivotId, measure, newFormulaString);
44797
44857
  }
44798
44858
  }
44799
44859
  }
@@ -44831,31 +44891,60 @@ stores.inject(MyMetaStore, storeInstance);
44831
44891
  isExistingPivot(pivotId) {
44832
44892
  return pivotId in this.pivots;
44833
44893
  }
44834
- getMeasureCompiledFormula(measure) {
44894
+ getMeasureCompiledFormula(pivotId, measure) {
44835
44895
  if (!measure.computedBy) {
44836
44896
  throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
44837
44897
  }
44838
- const sheetId = measure.computedBy.sheetId;
44839
- return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
44898
+ return this.compiledMeasureFormulas[pivotId][measure.id].formula;
44899
+ }
44900
+ getMeasureFullDependencies(pivotId, measure) {
44901
+ if (!measure.computedBy) {
44902
+ throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
44903
+ }
44904
+ return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
44840
44905
  }
44841
44906
  // -------------------------------------------------------------------------
44842
44907
  // Private
44843
44908
  // -------------------------------------------------------------------------
44844
44909
  addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
44845
44910
  this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
44846
- this.compileCalculatedMeasures(pivot.measures);
44911
+ this.compileCalculatedMeasures(pivotId, pivot.measures);
44847
44912
  this.history.update("formulaIds", formulaId, pivotId);
44848
44913
  this.history.update("nextFormulaId", this.nextFormulaId + 1);
44849
44914
  }
44850
- compileCalculatedMeasures(measures) {
44915
+ compileCalculatedMeasures(pivotId, measures) {
44851
44916
  for (const measure of measures) {
44852
44917
  if (measure.computedBy) {
44853
- const sheetId = measure.computedBy.sheetId;
44854
44918
  const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
44855
- this.history.update("compiledMeasureFormulas", sheetId, measure.computedBy.formula, compiledFormula);
44919
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
44920
+ }
44921
+ }
44922
+ for (const measure of measures) {
44923
+ if (measure.computedBy) {
44924
+ const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
44925
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
44856
44926
  }
44857
44927
  }
44858
44928
  }
44929
+ computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
44930
+ const rangeDependencies = [];
44931
+ const definition = this.getPivotCoreDefinition(pivotId);
44932
+ const formula = this.getMeasureCompiledFormula(pivotId, measure);
44933
+ exploredMeasures.add(measure.id);
44934
+ for (const token of formula.tokens) {
44935
+ if (token.type !== "SYMBOL") {
44936
+ continue;
44937
+ }
44938
+ const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
44939
+ measure.id !== measureCandidate.id);
44940
+ if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
44941
+ continue;
44942
+ }
44943
+ rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
44944
+ }
44945
+ rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
44946
+ return rangeDependencies;
44947
+ }
44859
44948
  insertPivot(position, formulaId, table) {
44860
44949
  this.resizeSheet(position.sheetId, position, table);
44861
44950
  const pivotCells = table.getPivotCells();
@@ -44914,21 +45003,16 @@ stores.inject(MyMetaStore, storeInstance);
44914
45003
  dependencies: rangeDependencies,
44915
45004
  };
44916
45005
  }
44917
- replaceMeasureFormula(sheetId, formulaString, newFormulaString) {
44918
- this.history.update("compiledMeasureFormulas", sheetId, formulaString, undefined);
44919
- this.history.update("compiledMeasureFormulas", sheetId, newFormulaString, this.compileMeasureFormula(sheetId, newFormulaString));
44920
- for (const pivotId in this.pivots) {
44921
- const pivot = this.pivots[pivotId];
44922
- if (!pivot) {
44923
- continue;
44924
- }
44925
- for (const measure of pivot.definition.measures) {
44926
- if (measure.computedBy?.formula === formulaString) {
44927
- const measureIndex = pivot.definition.measures.indexOf(measure);
44928
- this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
44929
- }
44930
- }
45006
+ replaceMeasureFormula(pivotId, measure, newFormulaString) {
45007
+ const pivot = this.pivots[pivotId];
45008
+ if (!pivot) {
45009
+ return;
44931
45010
  }
45011
+ const measureIndex = pivot.definition.measures.indexOf(measure);
45012
+ this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
45013
+ formula: newFormulaString,
45014
+ sheetId: measure.computedBy.sheetId,
45015
+ });
44932
45016
  }
44933
45017
  checkSortedColumnInMeasures(definition) {
44934
45018
  const measures = definition.measures.map((measure) => measure.id);
@@ -45989,7 +46073,7 @@ stores.inject(MyMetaStore, storeInstance);
45989
46073
  case "UPDATE_CELL":
45990
46074
  if (cmd.style !== undefined) {
45991
46075
  if (cmd.style !== null) {
45992
- this.setStyles(cmd.sheetId, [positionToZone(cmd)], cmd.style);
46076
+ this.setStyles(cmd.sheetId, [positionToZone(cmd)], cmd.style, { force: true });
45993
46077
  }
45994
46078
  else {
45995
46079
  this.clearStyle(cmd.sheetId, [positionToZone(cmd)]);
@@ -46015,7 +46099,7 @@ stores.inject(MyMetaStore, storeInstance);
46015
46099
  break;
46016
46100
  }
46017
46101
  }
46018
- adaptRanges(applyChange, sheetId) {
46102
+ adaptRanges({ applyChange }, sheetId) {
46019
46103
  const newStyles = [];
46020
46104
  for (const style of this.styles[sheetId] ?? []) {
46021
46105
  const change = applyChange(this.getters.getRangeFromZone(sheetId, style.zone));
@@ -46057,16 +46141,22 @@ stores.inject(MyMetaStore, storeInstance);
46057
46141
  }
46058
46142
  }
46059
46143
  styleIsDefault(style) {
46060
- return deepEquals(this.removeDefaultStyleValues(style), {});
46144
+ for (const key in style) {
46145
+ if (DEFAULT_STYLE_NO_ALIGN[key] !== style[key]) {
46146
+ return false;
46147
+ }
46148
+ }
46149
+ return true;
46061
46150
  }
46062
46151
  removeDefaultStyleValues(style) {
46063
46152
  const cleanedStyle = { ...style };
46064
- for (const property in DEFAULT_STYLE_NO_ALIGN) {
46065
- if (cleanedStyle[property] === DEFAULT_STYLE_NO_ALIGN[property]) {
46153
+ for (const property in style) {
46154
+ if (cleanedStyle[property] === undefined ||
46155
+ cleanedStyle[property] === DEFAULT_STYLE_NO_ALIGN[property]) {
46066
46156
  delete cleanedStyle[property];
46067
46157
  }
46068
46158
  }
46069
- return cleanedStyle;
46159
+ return Object.keys(cleanedStyle).length > 0 ? cleanedStyle : undefined;
46070
46160
  }
46071
46161
  onMerge(sheetId, zone) {
46072
46162
  this.setStyle(sheetId, zone, this.getCellStyle({ sheetId, col: zone.left, row: zone.top }), {
@@ -46102,13 +46192,13 @@ stores.inject(MyMetaStore, storeInstance);
46102
46192
  }
46103
46193
  editingZone = recomputeZones(editingZone, [inter]);
46104
46194
  }
46195
+ style = this.removeDefaultStyleValues(style);
46105
46196
  if (style) {
46106
- const newStyle = this.removeDefaultStyleValues(style);
46107
46197
  styles.push(...editingZone.map((zone) => {
46108
- return { zone, style: newStyle };
46198
+ return { zone, style };
46109
46199
  }));
46110
46200
  }
46111
- this.history.update("styles", sheetId, styles.filter((zoneStyle) => !this.styleIsDefault(zoneStyle.style)));
46201
+ this.history.update("styles", sheetId, styles);
46112
46202
  }
46113
46203
  clearStyle(sheetId, zones) {
46114
46204
  this.setStyles(sheetId, zones, undefined, { force: true });
@@ -46522,7 +46612,7 @@ stores.inject(MyMetaStore, storeInstance);
46522
46612
  static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
46523
46613
  tables = {};
46524
46614
  nextTableId = 1;
46525
- adaptRanges(applyChange, sheetId) {
46615
+ adaptRanges({ applyChange }, sheetId) {
46526
46616
  for (const table of this.getCoreTables(sheetId)) {
46527
46617
  this.applyRangeChangeOnTable(sheetId, table, applyChange);
46528
46618
  }
@@ -48354,11 +48444,16 @@ stores.inject(MyMetaStore, storeInstance);
48354
48444
  return this.arrayFormulasToResults.get(formulasPosition);
48355
48445
  }
48356
48446
  /**
48357
- * Remove a node, also remove it from other nodes adjacency list
48447
+ * Remove a spreading relation for a given array formula position
48448
+ * and its result zone
48358
48449
  */
48359
48450
  removeNode(position) {
48451
+ const resultZone = this.arrayFormulasToResults.get(position);
48452
+ if (!resultZone) {
48453
+ return;
48454
+ }
48360
48455
  this.resultsToArrayFormulas.remove({
48361
- boundingBox: { sheetId: position.sheetId, zone: positionToZone(position) },
48456
+ boundingBox: { sheetId: position.sheetId, zone: resultZone },
48362
48457
  data: position,
48363
48458
  });
48364
48459
  this.arrayFormulasToResults.delete(position);
@@ -48685,6 +48780,10 @@ stores.inject(MyMetaStore, storeInstance);
48685
48780
  // empty matrix
48686
48781
  return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
48687
48782
  }
48783
+ if (nbRows === 1 && nbColumns === 1) {
48784
+ // single value matrix
48785
+ return createEvaluatedCell(validateNumberValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
48786
+ }
48688
48787
  const resultZone = {
48689
48788
  top: formulaPosition.row,
48690
48789
  bottom: formulaPosition.row + nbRows - 1,
@@ -50290,14 +50389,14 @@ stores.inject(MyMetaStore, storeInstance);
50290
50389
  let baseline;
50291
50390
  let keyValue;
50292
50391
  if (definition.baseline) {
50293
- const adaptedRange = adaptStringRange(chartSheetId, definition.baseline, applyChange);
50294
- if (adaptedRange !== CellErrorType.InvalidReference) {
50392
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.baseline, applyChange);
50393
+ if (changeType !== "REMOVE") {
50295
50394
  baseline = adaptedRange;
50296
50395
  }
50297
50396
  }
50298
50397
  if (definition.keyValue) {
50299
- const adaptedRange = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
50300
- if (adaptedRange !== CellErrorType.InvalidReference) {
50398
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
50399
+ if (changeType !== "REMOVE") {
50301
50400
  keyValue = adaptedRange;
50302
50401
  }
50303
50402
  }
@@ -50354,7 +50453,7 @@ stores.inject(MyMetaStore, storeInstance);
50354
50453
  // This kind of graph is not exportable in Excel
50355
50454
  return undefined;
50356
50455
  }
50357
- updateRanges(applyChange) {
50456
+ updateRanges({ applyChange }) {
50358
50457
  const baseline = adaptChartRange(this.baseline, applyChange);
50359
50458
  const keyValue = adaptChartRange(this.keyValue, applyChange);
50360
50459
  if (this.baseline === baseline && this.keyValue === keyValue) {
@@ -50807,15 +50906,15 @@ stores.inject(MyMetaStore, storeInstance);
50807
50906
  if (!extensionsLoaded) {
50808
50907
  registerChartJSExtensions();
50809
50908
  }
50810
- if (!globalThis.Chart.registry.controllers.get(type)) {
50811
- console.log(`Chart of type "${type}" is not registered in Chart.js library.`);
50909
+ const config = deepCopy(runtime.chartJsConfig);
50910
+ config.plugins = [backgroundColorChartJSPlugin];
50911
+ if (!globalThis.Chart.registry.controllers.get(config.type)) {
50912
+ console.log(`Chart of type "${config.type}" is not registered in Chart.js library.`);
50812
50913
  if (!extensionsLoaded) {
50813
50914
  unregisterChartJsExtensions();
50814
50915
  }
50815
50916
  return imageUrl;
50816
50917
  }
50817
- const config = deepCopy(runtime.chartJsConfig);
50818
- config.plugins = [backgroundColorChartJSPlugin];
50819
50918
  const chart = new globalThis.Chart(canvas, config);
50820
50919
  try {
50821
50920
  imageUrl = await canvasToObjectUrl(canvas);
@@ -50855,15 +50954,15 @@ stores.inject(MyMetaStore, storeInstance);
50855
50954
  if (!extensionsLoaded) {
50856
50955
  registerChartJSExtensions();
50857
50956
  }
50858
- if (!globalThis.Chart.registry.controllers.get(type)) {
50859
- console.log(`Chart of type "${type}" is not registered in Chart.js library.`);
50957
+ const config = deepCopy(runtime.chartJsConfig);
50958
+ config.plugins = [backgroundColorChartJSPlugin];
50959
+ if (!globalThis.Chart.registry.controllers.get(config.type)) {
50960
+ console.log(`Chart of type "${config.type}" is not registered in Chart.js library.`);
50860
50961
  if (!extensionsLoaded) {
50861
50962
  unregisterChartJsExtensions();
50862
50963
  }
50863
50964
  return chartBlob;
50864
50965
  }
50865
- const config = deepCopy(runtime.chartJsConfig);
50866
- config.plugins = [backgroundColorChartJSPlugin];
50867
50966
  const chart = new globalThis.Chart(canvas, config);
50868
50967
  try {
50869
50968
  chartBlob = await canvasToBlob(canvas);
@@ -51528,6 +51627,7 @@ stores.inject(MyMetaStore, storeInstance);
51528
51627
  handle(cmd) {
51529
51628
  switch (cmd.type) {
51530
51629
  case "START":
51630
+ case "UPDATE_LOCALE":
51531
51631
  for (const sheetId of this.getters.getSheetIds()) {
51532
51632
  this.initializeSheet(sheetId);
51533
51633
  }
@@ -51665,7 +51765,7 @@ stores.inject(MyMetaStore, storeInstance);
51665
51765
  const cell = this.getters.getCell(position);
51666
51766
  const style = this.getters.getCellStyle(position);
51667
51767
  const colSize = this.getters.getColSize(position.sheetId, position.col);
51668
- return getDefaultCellHeight(this.ctx, cell, style, colSize);
51768
+ return getDefaultCellHeight(this.ctx, cell, style, this.getters.getLocale(), colSize);
51669
51769
  }
51670
51770
  isInMultiRowMerge(position) {
51671
51771
  const merge = this.getters.getMerge(position);
@@ -52037,14 +52137,16 @@ stores.inject(MyMetaStore, storeInstance);
52037
52137
  function withPivotPresentationLayer (PivotClass) {
52038
52138
  class PivotPresentationLayer extends PivotClass {
52039
52139
  getters;
52140
+ pivotId;
52040
52141
  cache = {};
52041
52142
  rankAsc = {};
52042
52143
  rankDesc = {};
52043
52144
  runningTotal = {};
52044
52145
  runningTotalInPercent = {};
52045
- constructor(custom, params) {
52146
+ constructor(pivotId, custom, params) {
52046
52147
  super(custom, params);
52047
52148
  this.getters = params.getters;
52149
+ this.pivotId = pivotId;
52048
52150
  }
52049
52151
  markAsDirtyForEvaluation() {
52050
52152
  this.cache = {};
@@ -52094,7 +52196,7 @@ stores.inject(MyMetaStore, storeInstance);
52094
52196
  return handleError(error, measure.aggregator.toUpperCase());
52095
52197
  }
52096
52198
  }
52097
- const formula = this.getters.getMeasureCompiledFormula(measure);
52199
+ const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
52098
52200
  const getSymbolValue = (symbolName) => {
52099
52201
  const { columns, rows } = this.definition;
52100
52202
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
@@ -52841,7 +52943,7 @@ stores.inject(MyMetaStore, storeInstance);
52841
52943
  const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
52842
52944
  if (!(pivotId in this.pivots)) {
52843
52945
  const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
52844
- this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
52946
+ this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
52845
52947
  }
52846
52948
  else if (recreate) {
52847
52949
  this.pivots[pivotId].onDefinitionChange(definition);
@@ -59255,7 +59357,7 @@ stores.inject(MyMetaStore, storeInstance);
59255
59357
  .add("pivot_ui", PivotUIPlugin)
59256
59358
  .add("cell_icon", CellIconPlugin);
59257
59359
 
59258
- class RangeAdapter {
59360
+ class RangeAdapterPlugin {
59259
59361
  getters;
59260
59362
  providers = [];
59261
59363
  isAdaptingRanges = false;
@@ -59263,7 +59365,6 @@ stores.inject(MyMetaStore, storeInstance);
59263
59365
  this.getters = getters;
59264
59366
  }
59265
59367
  static getters = [
59266
- "adaptFormulaStringDependencies",
59267
59368
  "copyFormulaStringForSheet",
59268
59369
  "extendRange",
59269
59370
  "getRangeString",
@@ -59294,8 +59395,8 @@ stores.inject(MyMetaStore, storeInstance);
59294
59395
  throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
59295
59396
  }
59296
59397
  const rangeAdapter = getRangeAdapter(cmd);
59297
- if (rangeAdapter?.applyChange) {
59298
- this.executeOnAllRanges(rangeAdapter.applyChange, rangeAdapter.sheetId, rangeAdapter.sheetName);
59398
+ if (rangeAdapter) {
59399
+ this.executeOnAllRanges(rangeAdapter);
59299
59400
  }
59300
59401
  }
59301
59402
  finalize() { }
@@ -59314,11 +59415,15 @@ stores.inject(MyMetaStore, storeInstance);
59314
59415
  return result;
59315
59416
  };
59316
59417
  }
59317
- executeOnAllRanges(adaptRange, sheetId, sheetName) {
59418
+ executeOnAllRanges(rangeAdapter) {
59318
59419
  this.isAdaptingRanges = true;
59319
- const func = this.verifyRangeRemoved(adaptRange);
59420
+ const adapterFunctions = {
59421
+ applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
59422
+ adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
59423
+ adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
59424
+ };
59320
59425
  for (const provider of this.providers) {
59321
- provider(func, sheetId, sheetName);
59426
+ provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
59322
59427
  }
59323
59428
  this.isAdaptingRanges = false;
59324
59429
  }
@@ -59486,18 +59591,6 @@ stores.inject(MyMetaStore, storeInstance);
59486
59591
  const unionOfZones = unionUnboundedZones(...zones);
59487
59592
  return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
59488
59593
  }
59489
- adaptFormulaStringDependencies(sheetId, formula, applyChange) {
59490
- if (!formula.startsWith("=")) {
59491
- return formula;
59492
- }
59493
- const compiledFormula = compile(formula);
59494
- const updatedDependencies = compiledFormula.dependencies.map((dep) => {
59495
- const range = this.getters.getRangeFromSheetXC(sheetId, dep);
59496
- const changedRange = applyChange(range);
59497
- return changedRange.changeType === "NONE" ? range : changedRange.range;
59498
- });
59499
- return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
59500
- }
59501
59594
  /**
59502
59595
  * Copy a formula string to another sheet.
59503
59596
  *
@@ -61939,6 +62032,12 @@ stores.inject(MyMetaStore, storeInstance);
61939
62032
  if (style.alignment && style.alignment.wrapText) {
61940
62033
  alignAttrs.push(["wrapText", "1"]);
61941
62034
  }
62035
+ if (style.alignment && style.alignment.textRotation) {
62036
+ alignAttrs.push(["textRotation", style.alignment.textRotation]);
62037
+ }
62038
+ if (style.alignment && style.alignment.shrinkToFit) {
62039
+ alignAttrs.push(["shrinkToFit", "1"]);
62040
+ }
61942
62041
  if (alignAttrs.length > 0) {
61943
62042
  attributes.push(["applyAlignment", "1"]); // for Libre Office
61944
62043
  styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
@@ -62733,7 +62832,7 @@ stores.inject(MyMetaStore, storeInstance);
62733
62832
  this.config = this.setupConfig(config);
62734
62833
  this.session = this.setupSession(workbookData.revisionId);
62735
62834
  this.coreGetters = {};
62736
- this.range = new RangeAdapter(this.coreGetters);
62835
+ this.range = new RangeAdapterPlugin(this.coreGetters);
62737
62836
  this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
62738
62837
  this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
62739
62838
  this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
@@ -62747,8 +62846,6 @@ stores.inject(MyMetaStore, storeInstance);
62747
62846
  this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
62748
62847
  this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
62749
62848
  this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
62750
- this.coreGetters.adaptFormulaStringDependencies =
62751
- this.range.adaptFormulaStringDependencies.bind(this.range);
62752
62849
  this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
62753
62850
  this.getters = {
62754
62851
  isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
@@ -66876,7 +66973,7 @@ stores.inject(MyMetaStore, storeInstance);
66876
66973
  verticalAxis: getDefinedAxis(definition),
66877
66974
  };
66878
66975
  }
66879
- updateRanges(applyChange) {
66976
+ updateRanges({ applyChange }) {
66880
66977
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
66881
66978
  if (!isStale) {
66882
66979
  return this;
@@ -66987,8 +67084,8 @@ stores.inject(MyMetaStore, storeInstance);
66987
67084
  static transformDefinition(chartSheetId, definition, applyChange) {
66988
67085
  let dataRange;
66989
67086
  if (definition.dataRange) {
66990
- const adaptedRange = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
66991
- if (adaptedRange !== CellErrorType.InvalidReference) {
67087
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
67088
+ if (changeType !== "REMOVE") {
66992
67089
  dataRange = adaptedRange;
66993
67090
  }
66994
67091
  }
@@ -67065,13 +67162,9 @@ stores.inject(MyMetaStore, storeInstance);
67065
67162
  : undefined,
67066
67163
  };
67067
67164
  }
67068
- updateRanges(applyChange, sheetId, adaptSheetName) {
67165
+ updateRanges({ applyChange, adaptFormulaString }) {
67069
67166
  const dataRange = adaptChartRange(this.dataRange, applyChange);
67070
- const adaptFormula = (formula) => adaptFormulaStringRanges(this.sheetId, formula, {
67071
- applyChange,
67072
- sheetId,
67073
- sheetName: adaptSheetName,
67074
- });
67167
+ const adaptFormula = (formula) => adaptFormulaString(this.sheetId, formula);
67075
67168
  const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
67076
67169
  const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
67077
67170
  return new GaugeChart(definition, this.sheetId, this.getters);
@@ -67313,7 +67406,7 @@ stores.inject(MyMetaStore, storeInstance);
67313
67406
  : undefined,
67314
67407
  };
67315
67408
  }
67316
- updateRanges(applyChange) {
67409
+ updateRanges({ applyChange }) {
67317
67410
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
67318
67411
  if (!isStale) {
67319
67412
  return this;
@@ -67470,7 +67563,7 @@ stores.inject(MyMetaStore, storeInstance);
67470
67563
  labelRange,
67471
67564
  };
67472
67565
  }
67473
- updateRanges(applyChange) {
67566
+ updateRanges({ applyChange }) {
67474
67567
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
67475
67568
  if (!isStale) {
67476
67569
  return this;
@@ -67635,7 +67728,7 @@ stores.inject(MyMetaStore, storeInstance);
67635
67728
  // TODO: implement export excel
67636
67729
  return undefined;
67637
67730
  }
67638
- updateRanges(applyChange) {
67731
+ updateRanges({ applyChange }) {
67639
67732
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
67640
67733
  if (!isStale) {
67641
67734
  return this;
@@ -72011,7 +72104,6 @@ stores.inject(MyMetaStore, storeInstance);
72011
72104
  });
72012
72105
  }
72013
72106
  handleEvent(event) {
72014
- this.hideHelp();
72015
72107
  const sheetId = this.getters.getActiveSheetId();
72016
72108
  let unboundedZone;
72017
72109
  if (event.options.unbounded) {
@@ -72239,7 +72331,7 @@ stores.inject(MyMetaStore, storeInstance);
72239
72331
  }
72240
72332
  captureSelection(zone, col, row) {
72241
72333
  this.model.selection.capture(this, {
72242
- cell: { col: col ?? zone.left, row: row ?? zone.right },
72334
+ cell: { col: col ?? zone.left, row: row ?? zone.top },
72243
72335
  zone,
72244
72336
  }, {
72245
72337
  handleEvent: this.handleEvent.bind(this),
@@ -72333,6 +72425,7 @@ stores.inject(MyMetaStore, storeInstance);
72333
72425
  this.colorIndexByRange = {};
72334
72426
  this.hoveredTokens = [];
72335
72427
  this.hoveredContentEvaluation = "";
72428
+ this.hideHelp();
72336
72429
  }
72337
72430
  /**
72338
72431
  * Reset the current content to the active cell content
@@ -77962,35 +78055,46 @@ stores.inject(MyMetaStore, storeInstance);
77962
78055
  name: _t("Rotation"),
77963
78056
  icon: (env) => getRotationIcon(env),
77964
78057
  };
78058
+ function setRotation(env, rotation) {
78059
+ rotation = Math.trunc(rotation / ROTATION_EPSILON) * ROTATION_EPSILON;
78060
+ setStyle(env, { rotation });
78061
+ }
78062
+ function currentRotationEqual(env, rotation) {
78063
+ const current = env.model.getters.getCurrentStyle().rotation;
78064
+ if (current === undefined) {
78065
+ return rotation === 0;
78066
+ }
78067
+ return Math.abs(current - rotation) < ROTATION_EPSILON;
78068
+ }
77965
78069
  const formatNoRotation = {
77966
78070
  name: _t("No rotation"),
77967
78071
  execute: (env) => setStyle(env, { rotation: 0 }),
77968
78072
  icon: "o-spreadsheet-Icon.ROTATION-0",
77969
- isActive: (env) => env.model.getters.getCurrentStyle().rotation === 0,
78073
+ isActive: (env) => currentRotationEqual(env, 0),
77970
78074
  };
77971
78075
  const formatRotation45 = {
77972
78076
  name: _t("45° rotation"),
77973
- execute: (env) => setStyle(env, { rotation: Math.PI / 4 }),
78077
+ execute: (env) => setRotation(env, Math.PI / 4),
77974
78078
  icon: "o-spreadsheet-Icon.ROTATION-45",
77975
- isActive: (env) => env.model.getters.getCurrentStyle().rotation === Math.PI / 4,
78079
+ isActive: (env) => currentRotationEqual(env, Math.PI / 4),
77976
78080
  };
77977
78081
  const formatRotation90 = {
77978
78082
  name: _t("90° rotation"),
77979
- execute: (env) => setStyle(env, { rotation: Math.PI / 2 }),
78083
+ execute: (env) => setRotation(env, Math.PI / 2),
77980
78084
  icon: "o-spreadsheet-Icon.ROTATION-90",
77981
- isActive: (env) => env.model.getters.getCurrentStyle().rotation === Math.PI / 2,
78085
+ isActive: (env) => currentRotationEqual(env, Math.PI / 2),
77982
78086
  };
77983
78087
  const formatRotation270 = {
77984
78088
  name: _t("-90° rotation"),
77985
- execute: (env) => setStyle(env, { rotation: -Math.PI / 2 }),
78089
+ execute: (env) => setRotation(env, -Math.PI / 2),
77986
78090
  icon: "o-spreadsheet-Icon.ROTATION-270",
77987
- isActive: (env) => env.model.getters.getCurrentStyle().rotation === -Math.PI / 2,
78091
+ isActive: (env) => currentRotationEqual(env, -Math.PI / 2),
77988
78092
  };
77989
78093
  const formatRotation315 = {
77990
78094
  name: _t("-45° rotation"),
77991
- execute: (env) => setStyle(env, { rotation: -Math.PI / 4 }),
78095
+ execute: (env) => setRotation(env, -Math.PI / 4),
77992
78096
  icon: "o-spreadsheet-Icon.ROTATION-315",
77993
- isActive: (env) => env.model.getters.getCurrentStyle().rotation === -Math.PI / 4,
78097
+ isActive: (env) => currentRotationEqual(env, -Math.PI / 4),
77994
78098
  };
77995
78099
  const formatStrikethrough = {
77996
78100
  name: _t("Strikethrough"),
@@ -78156,10 +78260,6 @@ stores.inject(MyMetaStore, storeInstance);
78156
78260
  }
78157
78261
  return DEFAULT_WRAPPING_MODE;
78158
78262
  }
78159
- function getRotation(env) {
78160
- const style = env.model.getters.getCurrentStyle();
78161
- return style.rotation ?? 0;
78162
- }
78163
78263
  function getHorizontalAlignmentIcon(env) {
78164
78264
  const horizontalAlign = getHorizontalAlign(env);
78165
78265
  switch (horizontalAlign) {
@@ -78194,19 +78294,19 @@ stores.inject(MyMetaStore, storeInstance);
78194
78294
  }
78195
78295
  }
78196
78296
  function getRotationIcon(env) {
78197
- const rotation = getRotation(env);
78198
- switch (rotation) {
78199
- case Math.PI / 2:
78200
- return "o-spreadsheet-Icon.ROTATION-90";
78201
- case -Math.PI / 2:
78202
- return "o-spreadsheet-Icon.ROTATION-270";
78203
- case Math.PI / 4:
78204
- return "o-spreadsheet-Icon.ROTATION-45";
78205
- case -Math.PI / 4:
78206
- return "o-spreadsheet-Icon.ROTATION-315";
78207
- default:
78208
- return "o-spreadsheet-Icon.ROTATION-0";
78297
+ if (currentRotationEqual(env, Math.PI / 2)) {
78298
+ return "o-spreadsheet-Icon.ROTATION-90";
78209
78299
  }
78300
+ else if (currentRotationEqual(env, -Math.PI / 2)) {
78301
+ return "o-spreadsheet-Icon.ROTATION-270";
78302
+ }
78303
+ else if (currentRotationEqual(env, Math.PI / 4)) {
78304
+ return "o-spreadsheet-Icon.ROTATION-45";
78305
+ }
78306
+ else if (currentRotationEqual(env, -Math.PI / 4)) {
78307
+ return "o-spreadsheet-Icon.ROTATION-315";
78308
+ }
78309
+ return "o-spreadsheet-Icon.ROTATION-0";
78210
78310
  }
78211
78311
 
78212
78312
  const colMenuRegistry = new MenuItemRegistry();
@@ -84352,7 +84452,7 @@ stores.inject(MyMetaStore, storeInstance);
84352
84452
  });
84353
84453
  dataRange = this.props.definition.dataRange;
84354
84454
  get configurationErrorMessages() {
84355
- const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])];
84455
+ const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
84356
84456
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
84357
84457
  }
84358
84458
  get isDataRangeInvalid() {
@@ -84394,7 +84494,7 @@ stores.inject(MyMetaStore, storeInstance);
84394
84494
  });
84395
84495
  }
84396
84496
  get designErrorMessages() {
84397
- const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])];
84497
+ const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
84398
84498
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
84399
84499
  }
84400
84500
  get isRangeMinInvalid() {
@@ -84770,7 +84870,7 @@ stores.inject(MyMetaStore, storeInstance);
84770
84870
  : undefined,
84771
84871
  };
84772
84872
  }
84773
- updateRanges(applyChange) {
84873
+ updateRanges({ applyChange }) {
84774
84874
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
84775
84875
  if (!isStale) {
84776
84876
  return this;
@@ -84875,7 +84975,7 @@ stores.inject(MyMetaStore, storeInstance);
84875
84975
  const cancelledReasons = [
84876
84976
  ...(this.state.keyValueDispatchResult?.reasons || []),
84877
84977
  ...(this.state.baselineDispatchResult?.reasons || []),
84878
- ];
84978
+ ].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
84879
84979
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
84880
84980
  }
84881
84981
  get isKeyValueInvalid() {
@@ -86418,6 +86518,12 @@ stores.inject(MyMetaStore, storeInstance);
86418
86518
  case "ACTIVATE_SHEET":
86419
86519
  this.isSearchDirty = true;
86420
86520
  this.shouldFinalizeUpdateSelection = true;
86521
+ if (this.searchOptions.specificRange) {
86522
+ this.searchOptions.specificRange = {
86523
+ ...this.searchOptions.specificRange,
86524
+ sheetId: this.getters.getActiveSheetId(),
86525
+ };
86526
+ }
86421
86527
  break;
86422
86528
  case "REPLACE_SEARCH":
86423
86529
  for (const match of cmd.matches) {
@@ -86804,9 +86910,20 @@ stores.inject(MyMetaStore, storeInstance);
86804
86910
  const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
86805
86911
  this.store.updateSearchOptions({ specificRange });
86806
86912
  }
86913
+ get specificRange() {
86914
+ const range = this.store.searchOptions.specificRange;
86915
+ return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
86916
+ }
86807
86917
  get pendingSearch() {
86808
86918
  return this.updateSearchContent.isDebouncePending();
86809
86919
  }
86920
+ get selectionInputKey() {
86921
+ // Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
86922
+ // and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
86923
+ // We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
86924
+ // The only drawback is that the input loses focus when changing sheet.
86925
+ return this.env.model.getters.getActiveSheetId();
86926
+ }
86810
86927
  }
86811
86928
 
86812
86929
  /**
@@ -95372,7 +95489,7 @@ stores.inject(MyMetaStore, storeInstance);
95372
95489
  getDefinitionForExcel() {
95373
95490
  return undefined;
95374
95491
  }
95375
- updateRanges(applyChange) {
95492
+ updateRanges({ applyChange }) {
95376
95493
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
95377
95494
  if (!isStale) {
95378
95495
  return this;
@@ -95500,7 +95617,7 @@ stores.inject(MyMetaStore, storeInstance);
95500
95617
  verticalAxis: getDefinedAxis(definition),
95501
95618
  };
95502
95619
  }
95503
- updateRanges(applyChange) {
95620
+ updateRanges({ applyChange }) {
95504
95621
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
95505
95622
  if (!isStale) {
95506
95623
  return this;
@@ -95676,7 +95793,7 @@ stores.inject(MyMetaStore, storeInstance);
95676
95793
  getDefinitionForExcel() {
95677
95794
  return undefined;
95678
95795
  }
95679
- updateRanges(applyChange) {
95796
+ updateRanges({ applyChange }) {
95680
95797
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
95681
95798
  if (!isStale) {
95682
95799
  return this;
@@ -95807,7 +95924,7 @@ stores.inject(MyMetaStore, storeInstance);
95807
95924
  getDefinitionForExcel() {
95808
95925
  return undefined;
95809
95926
  }
95810
- updateRanges(applyChange) {
95927
+ updateRanges({ applyChange }) {
95811
95928
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
95812
95929
  if (!isStale) {
95813
95930
  return this;
@@ -95958,7 +96075,7 @@ stores.inject(MyMetaStore, storeInstance);
95958
96075
  maxValue,
95959
96076
  };
95960
96077
  }
95961
- updateRanges(applyChange) {
96078
+ updateRanges({ applyChange }) {
95962
96079
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
95963
96080
  if (!isStale) {
95964
96081
  return this;
@@ -96108,7 +96225,7 @@ stores.inject(MyMetaStore, storeInstance);
96108
96225
  labelRange,
96109
96226
  };
96110
96227
  }
96111
- updateRanges(applyChange) {
96228
+ updateRanges({ applyChange }) {
96112
96229
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
96113
96230
  if (!isStale) {
96114
96231
  return this;
@@ -96245,7 +96362,7 @@ stores.inject(MyMetaStore, storeInstance);
96245
96362
  getDefinitionForExcel() {
96246
96363
  return undefined;
96247
96364
  }
96248
- updateRanges(applyChange) {
96365
+ updateRanges({ applyChange }) {
96249
96366
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
96250
96367
  if (!isStale) {
96251
96368
  return this;
@@ -96395,7 +96512,7 @@ stores.inject(MyMetaStore, storeInstance);
96395
96512
  getDefinitionForExcel() {
96396
96513
  return undefined;
96397
96514
  }
96398
- updateRanges(applyChange) {
96515
+ updateRanges({ applyChange }) {
96399
96516
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
96400
96517
  if (!isStale) {
96401
96518
  return this;
@@ -97985,9 +98102,9 @@ stores.inject(MyMetaStore, storeInstance);
97985
98102
  exports.tokenize = tokenize;
97986
98103
 
97987
98104
 
97988
- __info__.version = "19.1.2";
97989
- __info__.date = "2026-01-07T16:21:36.757Z";
97990
- __info__.hash = "febc3e9";
98105
+ __info__.version = "19.1.4";
98106
+ __info__.date = "2026-01-21T11:07:17.372Z";
98107
+ __info__.hash = "ceae12a";
97991
98108
 
97992
98109
 
97993
98110
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);