@odoo/o-spreadsheet 19.0.16 → 19.0.18

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.0.16
6
- * @date 2026-01-07T16:21:15.857Z
7
- * @hash 9f3f13a
5
+ * @version 19.0.18
6
+ * @date 2026-01-21T11:06:57.346Z
7
+ * @hash bd44f59
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, useExternalListener, onWillUpdateProps, onWillStart, onWillPatch, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -40,7 +40,8 @@ function createAction(item) {
40
40
  return children
41
41
  .map((child) => (typeof child === "function" ? child(env) : child))
42
42
  .flat()
43
- .map(createAction);
43
+ .map(createAction)
44
+ .sort((a, b) => a.sequence - b.sequence);
44
45
  }
45
46
  : () => [],
46
47
  isReadonlyAllowed: item.isReadonlyAllowed || false,
@@ -780,6 +781,7 @@ const DEFAULT_STYLE = {
780
781
  fillColor: "",
781
782
  textColor: "",
782
783
  };
784
+ const DEFAULT_NUMBER_STYLE = { ...DEFAULT_STYLE, align: "right" };
783
785
  const DEFAULT_VERTICAL_ALIGN = DEFAULT_STYLE.verticalAlign;
784
786
  const DEFAULT_WRAPPING_MODE = DEFAULT_STYLE.wrapping;
785
787
  // Fonts
@@ -5026,7 +5028,11 @@ function evaluatePredicate(value = "", criterion, locale) {
5026
5028
  if (operator === "<>" || operator === "=") {
5027
5029
  let result;
5028
5030
  if (typeof value === typeof operand) {
5029
- if (typeof value === "string" && typeof operand === "string") {
5031
+ if (value === "" && operand === "") {
5032
+ // fast path to avoid regex evaluation
5033
+ result = true;
5034
+ }
5035
+ else if (typeof value === "string" && typeof operand === "string") {
5030
5036
  result = wildcardToRegExp(operand).test(value);
5031
5037
  }
5032
5038
  else {
@@ -7052,7 +7058,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
7052
7058
  const groups = groupConsecutive(elements);
7053
7059
  return (range) => {
7054
7060
  if (range.sheetId !== cmd.sheetId) {
7055
- return { changeType: "NONE" };
7061
+ return { changeType: "NONE", range };
7056
7062
  }
7057
7063
  let newRange = range;
7058
7064
  let changeType = "NONE";
@@ -7079,10 +7085,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
7079
7085
  newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
7080
7086
  }
7081
7087
  }
7082
- if (changeType !== "NONE") {
7083
- return { changeType, range: newRange };
7084
- }
7085
- return { changeType: "NONE" };
7088
+ return { changeType, range: newRange };
7086
7089
  };
7087
7090
  }
7088
7091
  function getApplyRangeChangeAddColRow(cmd) {
@@ -7091,7 +7094,7 @@ function getApplyRangeChangeAddColRow(cmd) {
7091
7094
  const dimension = cmd.dimension === "COL" ? "columns" : "rows";
7092
7095
  return (range) => {
7093
7096
  if (range.sheetId !== cmd.sheetId) {
7094
- return { changeType: "NONE" };
7097
+ return { changeType: "NONE", range };
7095
7098
  }
7096
7099
  if (cmd.position === "after") {
7097
7100
  if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
@@ -7121,13 +7124,13 @@ function getApplyRangeChangeAddColRow(cmd) {
7121
7124
  };
7122
7125
  }
7123
7126
  }
7124
- return { changeType: "NONE" };
7127
+ return { changeType: "NONE", range };
7125
7128
  };
7126
7129
  }
7127
7130
  function getApplyRangeChangeDeleteSheet(cmd) {
7128
7131
  return (range) => {
7129
7132
  if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
7130
- return { changeType: "NONE" };
7133
+ return { changeType: "NONE", range };
7131
7134
  }
7132
7135
  const invalidSheetName = cmd.sheetName;
7133
7136
  range = {
@@ -7154,14 +7157,14 @@ function getApplyRangeChangeRenameSheet(cmd) {
7154
7157
  const newRange = { ...range, sheetId, invalidSheetName };
7155
7158
  return { changeType: "CHANGE", range: newRange };
7156
7159
  }
7157
- return { changeType: "NONE" };
7160
+ return { changeType: "NONE", range };
7158
7161
  };
7159
7162
  }
7160
7163
  function getApplyRangeChangeMoveRange(cmd) {
7161
7164
  const originZone = cmd.target[0];
7162
7165
  return (range) => {
7163
7166
  if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
7164
- return { changeType: "NONE" };
7167
+ return { changeType: "NONE", range };
7165
7168
  }
7166
7169
  const targetSheetId = cmd.targetSheetId;
7167
7170
  const offsetX = cmd.col - originZone.left;
@@ -7327,11 +7330,20 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
7327
7330
  /**
7328
7331
  * Get the default height of the cell given its style.
7329
7332
  */
7330
- function getDefaultCellHeight(ctx, cell, colSize) {
7333
+ function getDefaultCellHeight(ctx, cell, locale, colSize) {
7331
7334
  if (!cell || (!cell.isFormula && !cell.content)) {
7332
7335
  return DEFAULT_CELL_HEIGHT;
7333
7336
  }
7334
- const content = cell.isFormula ? "" : cell.content;
7337
+ let content = "";
7338
+ try {
7339
+ if (!cell.isFormula) {
7340
+ const localeFormat = { format: cell.format, locale };
7341
+ content = formatValue(parseLiteral(cell.content, locale), localeFormat);
7342
+ }
7343
+ }
7344
+ catch {
7345
+ content = CellErrorType.GenericError;
7346
+ }
7335
7347
  return getCellContentHeight(ctx, content, cell.style, colSize);
7336
7348
  }
7337
7349
  function getCellContentHeight(ctx, content, style, colSize) {
@@ -20098,9 +20110,10 @@ function assertDomainLength(domain) {
20098
20110
  throw new EvaluationError(_t("Function PIVOT takes an even number of arguments."));
20099
20111
  }
20100
20112
  }
20101
- function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
20113
+ function addPivotDependencies(evalContext, pivotId, forMeasures) {
20102
20114
  //TODO This function can be very costly when used with PIVOT.VALUE and PIVOT.HEADER
20103
20115
  const dependencies = [];
20116
+ const coreDefinition = evalContext.getters.getPivotCoreDefinition(pivotId);
20104
20117
  if (coreDefinition.type === "SPREADSHEET" && coreDefinition.dataSet) {
20105
20118
  const { sheetId, zone } = coreDefinition.dataSet;
20106
20119
  const xc = zoneToXc(zone);
@@ -20117,8 +20130,7 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
20117
20130
  }
20118
20131
  for (const measure of forMeasures) {
20119
20132
  if (measure.computedBy) {
20120
- const formula = evalContext.getters.getMeasureCompiledFormula(measure);
20121
- dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
20133
+ dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure));
20122
20134
  }
20123
20135
  }
20124
20136
  const originPosition = evalContext.__originCellPosition;
@@ -20615,7 +20627,7 @@ const PIVOT_VALUE = {
20615
20627
  assertDomainLength(domainArgs);
20616
20628
  const pivot = this.getters.getPivot(pivotId);
20617
20629
  const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
20618
- addPivotDependencies(this, coreDefinition, coreDefinition.measures.filter((m) => m.id === _measure));
20630
+ addPivotDependencies(this, pivotId, coreDefinition.measures.filter((m) => m.id === _measure));
20619
20631
  pivot.init({ reload: pivot.needsReevaluation });
20620
20632
  const error = pivot.assertIsValid({ throwOnError: false });
20621
20633
  if (error) {
@@ -20648,8 +20660,7 @@ const PIVOT_HEADER = {
20648
20660
  const _pivotId = getPivotId(_pivotFormulaId, this.getters);
20649
20661
  assertDomainLength(domainArgs);
20650
20662
  const pivot = this.getters.getPivot(_pivotId);
20651
- const coreDefinition = this.getters.getPivotCoreDefinition(_pivotId);
20652
- addPivotDependencies(this, coreDefinition, []);
20663
+ addPivotDependencies(this, _pivotId, []);
20653
20664
  pivot.init({ reload: pivot.needsReevaluation });
20654
20665
  const error = pivot.assertIsValid({ throwOnError: false });
20655
20666
  if (error) {
@@ -20707,7 +20718,7 @@ const PIVOT = {
20707
20718
  const pivotId = getPivotId(_pivotFormulaId, this.getters);
20708
20719
  const pivot = this.getters.getPivot(pivotId);
20709
20720
  const coreDefinition = this.getters.getPivotCoreDefinition(pivotId);
20710
- addPivotDependencies(this, coreDefinition, coreDefinition.measures);
20721
+ addPivotDependencies(this, pivotId, coreDefinition.measures);
20711
20722
  pivot.init({ reload: pivot.needsReevaluation });
20712
20723
  const error = pivot.assertIsValid({ throwOnError: false });
20713
20724
  if (error) {
@@ -22226,7 +22237,16 @@ function createComputeFunction(descr) {
22226
22237
  }
22227
22238
  acceptToVectorize.push(!argDefinition.acceptMatrix);
22228
22239
  }
22229
- return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
22240
+ return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
22241
+ }
22242
+ function replaceErrorPlaceholderInResult(result) {
22243
+ if (!isMatrix(result)) {
22244
+ replaceFunctionNamePlaceholder(result, descr.name);
22245
+ }
22246
+ else {
22247
+ matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
22248
+ }
22249
+ return result;
22230
22250
  }
22231
22251
  function errorHandlingCompute(...args) {
22232
22252
  for (let i = 0; i < args.length; i++) {
@@ -22255,13 +22275,12 @@ function createComputeFunction(descr) {
22255
22275
  const result = descr.compute.apply(this, args);
22256
22276
  if (!isMatrix(result)) {
22257
22277
  if (typeof result === "object" && result !== null && "value" in result) {
22258
- replaceFunctionNamePlaceholder(result, descr.name);
22259
22278
  return result;
22260
22279
  }
22280
+ descr.name;
22261
22281
  return { value: result };
22262
22282
  }
22263
22283
  if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
22264
- matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
22265
22284
  return result;
22266
22285
  }
22267
22286
  return matrixMap(result, (row) => ({ value: row }));
@@ -22774,7 +22793,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
22774
22793
  continue;
22775
22794
  }
22776
22795
  const sheetXC = tokens[tokenIdx].value;
22777
- const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
22796
+ const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
22778
22797
  if (sheetXC !== newSheetXC) {
22779
22798
  tokens[tokenIdx] = {
22780
22799
  value: newSheetXC,
@@ -22784,23 +22803,30 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
22784
22803
  }
22785
22804
  return concat$1(tokens.map((token) => token.value));
22786
22805
  }
22787
- function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
22806
+ function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
22788
22807
  const sheetName = splitReference(sheetXC).sheetName;
22789
22808
  if (sheetName
22790
- ? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
22791
- : defaultSheetId !== applyChange.sheetId) {
22792
- return sheetXC;
22809
+ ? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
22810
+ : defaultSheetId !== rangeAdapter.sheetId) {
22811
+ return { changeType: "NONE", range: sheetXC };
22793
22812
  }
22794
- const sheetId = sheetName ? applyChange.sheetId : defaultSheetId;
22813
+ const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
22795
22814
  const range = getRange(sheetXC, sheetId);
22796
22815
  if (range.invalidXc) {
22797
- return sheetXC;
22816
+ return { changeType: "NONE", range: sheetXC };
22798
22817
  }
22799
- const change = applyChange.applyChange(range);
22818
+ const change = rangeAdapter.applyChange(range);
22800
22819
  if (change.changeType === "NONE" || change.changeType === "REMOVE") {
22801
- return sheetXC;
22820
+ return { changeType: change.changeType, range: sheetXC };
22802
22821
  }
22803
- return getRangeString(change.range, defaultSheetId, getSheetNameGetter(applyChange));
22822
+ const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
22823
+ if (rangeStr === CellErrorType.InvalidReference) {
22824
+ return { changeType: "REMOVE", range: rangeStr };
22825
+ }
22826
+ return {
22827
+ changeType: change.changeType,
22828
+ range: rangeStr,
22829
+ };
22804
22830
  }
22805
22831
  function getSheetNameGetter(applyChange) {
22806
22832
  return (sheetId) => {
@@ -22905,8 +22931,6 @@ function adaptChartRange(range, applyChange) {
22905
22931
  }
22906
22932
  const change = applyChange(range);
22907
22933
  switch (change.changeType) {
22908
- case "NONE":
22909
- return range;
22910
22934
  case "REMOVE":
22911
22935
  return undefined;
22912
22936
  default:
@@ -23058,16 +23082,16 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
23058
23082
  function transformChartDefinitionWithDataSetsWithZone(chartSheetId, definition, applyChange) {
23059
23083
  let labelRange;
23060
23084
  if (definition.labelRange) {
23061
- const adaptedRange = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
23062
- if (adaptedRange !== CellErrorType.InvalidReference) {
23085
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.labelRange, applyChange);
23086
+ if (changeType !== "REMOVE") {
23063
23087
  labelRange = adaptedRange;
23064
23088
  }
23065
23089
  }
23066
23090
  const dataSets = [];
23067
23091
  for (const dataSet of definition.dataSets) {
23068
23092
  const newDataSet = { ...dataSet };
23069
- const adaptedRange = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
23070
- if (adaptedRange !== CellErrorType.InvalidReference) {
23093
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, dataSet.dataRange, applyChange);
23094
+ if (changeType !== "REMOVE") {
23071
23095
  newDataSet.dataRange = adaptedRange;
23072
23096
  dataSets.push(newDataSet);
23073
23097
  }
@@ -24466,14 +24490,14 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
24466
24490
  let baseline;
24467
24491
  let keyValue;
24468
24492
  if (definition.baseline) {
24469
- const adaptedRange = adaptStringRange(chartSheetId, definition.baseline, applyChange);
24470
- if (adaptedRange !== CellErrorType.InvalidReference) {
24493
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.baseline, applyChange);
24494
+ if (changeType !== "REMOVE") {
24471
24495
  baseline = adaptedRange;
24472
24496
  }
24473
24497
  }
24474
24498
  if (definition.keyValue) {
24475
- const adaptedRange = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
24476
- if (adaptedRange !== CellErrorType.InvalidReference) {
24499
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.keyValue, applyChange);
24500
+ if (changeType !== "REMOVE") {
24477
24501
  keyValue = adaptedRange;
24478
24502
  }
24479
24503
  }
@@ -24530,7 +24554,7 @@ let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
24530
24554
  // This kind of graph is not exportable in Excel
24531
24555
  return undefined;
24532
24556
  }
24533
- updateRanges(applyChange) {
24557
+ updateRanges({ applyChange }) {
24534
24558
  const baseline = adaptChartRange(this.baseline, applyChange);
24535
24559
  const keyValue = adaptChartRange(this.keyValue, applyChange);
24536
24560
  if (this.baseline === baseline && this.keyValue === keyValue) {
@@ -27696,7 +27720,7 @@ class BarChart extends AbstractChart {
27696
27720
  verticalAxis: getDefinedAxis(definition),
27697
27721
  };
27698
27722
  }
27699
- updateRanges(applyChange) {
27723
+ updateRanges({ applyChange }) {
27700
27724
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
27701
27725
  if (!isStale) {
27702
27726
  return this;
@@ -28902,7 +28926,7 @@ class ComboChart extends AbstractChart {
28902
28926
  verticalAxis: getDefinedAxis(definition),
28903
28927
  };
28904
28928
  }
28905
- updateRanges(applyChange) {
28929
+ updateRanges({ applyChange }) {
28906
28930
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
28907
28931
  if (!isStale) {
28908
28932
  return this;
@@ -29078,7 +29102,7 @@ class FunnelChart extends AbstractChart {
29078
29102
  getDefinitionForExcel() {
29079
29103
  return undefined;
29080
29104
  }
29081
- updateRanges(applyChange) {
29105
+ updateRanges({ applyChange }) {
29082
29106
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
29083
29107
  if (!isStale) {
29084
29108
  return this;
@@ -29189,8 +29213,8 @@ class GaugeChart extends AbstractChart {
29189
29213
  static transformDefinition(chartSheetId, definition, applyChange) {
29190
29214
  let dataRange;
29191
29215
  if (definition.dataRange) {
29192
- const adaptedRange = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
29193
- if (adaptedRange !== CellErrorType.InvalidReference) {
29216
+ const { changeType, range: adaptedRange } = adaptStringRange(chartSheetId, definition.dataRange, applyChange);
29217
+ if (changeType !== "REMOVE") {
29194
29218
  dataRange = adaptedRange;
29195
29219
  }
29196
29220
  }
@@ -29267,13 +29291,9 @@ class GaugeChart extends AbstractChart {
29267
29291
  : undefined,
29268
29292
  };
29269
29293
  }
29270
- updateRanges(applyChange, sheetId, adaptSheetName) {
29294
+ updateRanges({ applyChange, adaptFormulaString }) {
29271
29295
  const dataRange = adaptChartRange(this.dataRange, applyChange);
29272
- const adaptFormula = (formula) => adaptFormulaStringRanges(this.sheetId, formula, {
29273
- applyChange,
29274
- sheetId,
29275
- sheetName: adaptSheetName,
29276
- });
29296
+ const adaptFormula = (formula) => adaptFormulaString(this.sheetId, formula);
29277
29297
  const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
29278
29298
  const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
29279
29299
  return new GaugeChart(definition, this.sheetId, this.getters);
@@ -29501,7 +29521,7 @@ class GeoChart extends AbstractChart {
29501
29521
  getDefinitionForExcel() {
29502
29522
  return undefined;
29503
29523
  }
29504
- updateRanges(applyChange) {
29524
+ updateRanges({ applyChange }) {
29505
29525
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
29506
29526
  if (!isStale) {
29507
29527
  return this;
@@ -29643,7 +29663,7 @@ class LineChart extends AbstractChart {
29643
29663
  : undefined,
29644
29664
  };
29645
29665
  }
29646
- updateRanges(applyChange) {
29666
+ updateRanges({ applyChange }) {
29647
29667
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
29648
29668
  if (!isStale) {
29649
29669
  return this;
@@ -29800,7 +29820,7 @@ class PieChart extends AbstractChart {
29800
29820
  labelRange,
29801
29821
  };
29802
29822
  }
29803
- updateRanges(applyChange) {
29823
+ updateRanges({ applyChange }) {
29804
29824
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
29805
29825
  if (!isStale) {
29806
29826
  return this;
@@ -29955,7 +29975,7 @@ class PyramidChart extends AbstractChart {
29955
29975
  maxValue,
29956
29976
  };
29957
29977
  }
29958
- updateRanges(applyChange) {
29978
+ updateRanges({ applyChange }) {
29959
29979
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
29960
29980
  if (!isStale) {
29961
29981
  return this;
@@ -30105,7 +30125,7 @@ class RadarChart extends AbstractChart {
30105
30125
  labelRange,
30106
30126
  };
30107
30127
  }
30108
- updateRanges(applyChange) {
30128
+ updateRanges({ applyChange }) {
30109
30129
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
30110
30130
  if (!isStale) {
30111
30131
  return this;
@@ -30233,7 +30253,7 @@ class ScatterChart extends AbstractChart {
30233
30253
  : undefined,
30234
30254
  };
30235
30255
  }
30236
- updateRanges(applyChange) {
30256
+ updateRanges({ applyChange }) {
30237
30257
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
30238
30258
  if (!isStale) {
30239
30259
  return this;
@@ -30400,7 +30420,7 @@ class SunburstChart extends AbstractChart {
30400
30420
  getDefinitionForExcel() {
30401
30421
  return undefined;
30402
30422
  }
30403
- updateRanges(applyChange) {
30423
+ updateRanges({ applyChange }) {
30404
30424
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
30405
30425
  if (!isStale) {
30406
30426
  return this;
@@ -30550,7 +30570,7 @@ class TreeMapChart extends AbstractChart {
30550
30570
  getDefinitionForExcel() {
30551
30571
  return undefined;
30552
30572
  }
30553
- updateRanges(applyChange) {
30573
+ updateRanges({ applyChange }) {
30554
30574
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
30555
30575
  if (!isStale) {
30556
30576
  return this;
@@ -30711,7 +30731,7 @@ class WaterfallChart extends AbstractChart {
30711
30731
  // TODO: implement export excel
30712
30732
  return undefined;
30713
30733
  }
30714
- updateRanges(applyChange) {
30734
+ updateRanges({ applyChange }) {
30715
30735
  const { dataSets, labelRange, isStale } = updateChartRangesWithDataSets(this.getters, applyChange, this.dataSets, this.labelRange);
30716
30736
  if (!isStale) {
30717
30737
  return this;
@@ -35228,7 +35248,6 @@ class AbstractComposerStore extends SpreadsheetStore {
35228
35248
  });
35229
35249
  }
35230
35250
  handleEvent(event) {
35231
- this.hideHelp();
35232
35251
  const sheetId = this.getters.getActiveSheetId();
35233
35252
  let unboundedZone;
35234
35253
  if (event.options.unbounded) {
@@ -35482,7 +35501,7 @@ class AbstractComposerStore extends SpreadsheetStore {
35482
35501
  }
35483
35502
  captureSelection(zone, col, row) {
35484
35503
  this.model.selection.capture(this, {
35485
- cell: { col: col ?? zone.left, row: row ?? zone.right },
35504
+ cell: { col: col ?? zone.left, row: row ?? zone.top },
35486
35505
  zone,
35487
35506
  }, {
35488
35507
  handleEvent: this.handleEvent.bind(this),
@@ -35576,6 +35595,7 @@ class AbstractComposerStore extends SpreadsheetStore {
35576
35595
  this.colorIndexByRange = {};
35577
35596
  this.hoveredTokens = [];
35578
35597
  this.hoveredContentEvaluation = "";
35598
+ this.hideHelp();
35579
35599
  }
35580
35600
  /**
35581
35601
  * Reset the current content to the active cell content
@@ -40818,6 +40838,7 @@ function extractStyle(data, content, styleId, formatId, borderId) {
40818
40838
  ? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
40819
40839
  : undefined,
40820
40840
  wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
40841
+ shrinkToFit: style.wrapping === "clip" ? true : undefined,
40821
40842
  },
40822
40843
  };
40823
40844
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -40838,6 +40859,7 @@ function normalizeStyle(construct, styles) {
40838
40859
  vertical: styles.alignment.vertical,
40839
40860
  horizontal: styles.alignment.horizontal,
40840
40861
  wrapText: styles.alignment.wrapText,
40862
+ shrinkToFit: styles.alignment.shrinkToFit,
40841
40863
  },
40842
40864
  };
40843
40865
  return pushElement(style, construct.styles);
@@ -47888,8 +47910,6 @@ function adaptPivotRange(range, applyChange) {
47888
47910
  }
47889
47911
  const change = applyChange(range);
47890
47912
  switch (change.changeType) {
47891
- case "NONE":
47892
- return range;
47893
47913
  case "REMOVE":
47894
47914
  return undefined;
47895
47915
  default:
@@ -55455,7 +55475,7 @@ class GaugeChartConfigPanel extends Component {
55455
55475
  });
55456
55476
  dataRange = this.props.definition.dataRange;
55457
55477
  get configurationErrorMessages() {
55458
- const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])];
55478
+ const cancelledReasons = [...(this.state.dataRangeDispatchResult?.reasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
55459
55479
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
55460
55480
  }
55461
55481
  get isDataRangeInvalid() {
@@ -55541,7 +55561,7 @@ class GaugeChartDesignPanel extends Component {
55541
55561
  });
55542
55562
  }
55543
55563
  get designErrorMessages() {
55544
- const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])];
55564
+ const cancelledReasons = [...(this.state.sectionRuleCancelledReasons || [])].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
55545
55565
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
55546
55566
  }
55547
55567
  get isRangeMinInvalid() {
@@ -55913,7 +55933,7 @@ class ScorecardChartConfigPanel extends Component {
55913
55933
  const cancelledReasons = [
55914
55934
  ...(this.state.keyValueDispatchResult?.reasons || []),
55915
55935
  ...(this.state.baselineDispatchResult?.reasons || []),
55916
- ];
55936
+ ].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
55917
55937
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
55918
55938
  }
55919
55939
  get isKeyValueInvalid() {
@@ -57875,6 +57895,12 @@ class FindAndReplaceStore extends SpreadsheetStore {
57875
57895
  case "ACTIVATE_SHEET":
57876
57896
  this.isSearchDirty = true;
57877
57897
  this.shouldFinalizeUpdateSelection = true;
57898
+ if (this.searchOptions.specificRange) {
57899
+ this.searchOptions.specificRange = {
57900
+ ...this.searchOptions.specificRange,
57901
+ sheetId: this.getters.getActiveSheetId(),
57902
+ };
57903
+ }
57878
57904
  break;
57879
57905
  case "REPLACE_SEARCH":
57880
57906
  for (const match of cmd.matches) {
@@ -58294,9 +58320,20 @@ class FindAndReplacePanel extends Component {
58294
58320
  const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
58295
58321
  this.store.updateSearchOptions({ specificRange });
58296
58322
  }
58323
+ get specificRange() {
58324
+ const range = this.store.searchOptions.specificRange;
58325
+ return range ? this.env.model.getters.getRangeString(range, "forceSheetReference") : "";
58326
+ }
58297
58327
  get pendingSearch() {
58298
58328
  return this.updateSearchContent.isDebouncePending();
58299
58329
  }
58330
+ get selectionInputKey() {
58331
+ // Selections input are made to work with objects linked to a sheet id. They store the active sheet id at their creation,
58332
+ // and have specific behaviour linked to it (eg. go back to the initial sheet after confirmation).
58333
+ // We don't want all those behaviors here, so we force the recreation of the component when the active sheet changes.
58334
+ // The only drawback is that the input loses focus when changing sheet.
58335
+ return this.env.model.getters.getActiveSheetId();
58336
+ }
58300
58337
  }
58301
58338
 
58302
58339
  css /* scss */ `
@@ -62202,7 +62239,7 @@ class CorePlugin extends BasePlugin {
62202
62239
  * @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
62203
62240
  * @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
62204
62241
  */
62205
- adaptRanges(applyChange, sheetId, sheetName) { }
62242
+ adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
62206
62243
  /**
62207
62244
  * Implement this method to clean unused external resources, such as images
62208
62245
  * stored on a server which have been deleted.
@@ -62281,7 +62318,7 @@ class BordersPlugin extends CorePlugin {
62281
62318
  }
62282
62319
  }
62283
62320
  }
62284
- adaptRanges(applyChange, sheetId) {
62321
+ adaptRanges({ applyChange }, sheetId) {
62285
62322
  const newBorders = [];
62286
62323
  for (const border of this.borders[sheetId] ?? []) {
62287
62324
  const change = applyChange(this.getters.getRangeFromZone(sheetId, border.zone));
@@ -62644,7 +62681,7 @@ class CellPlugin extends CorePlugin {
62644
62681
  ];
62645
62682
  nextId = 1;
62646
62683
  cells = {};
62647
- adaptRanges(applyChange, sheetId, sheetName) {
62684
+ adaptRanges({ applyChange }, sheetId, sheetName) {
62648
62685
  for (const sheet of Object.keys(this.cells)) {
62649
62686
  for (const cell of Object.values(this.cells[sheet] || {})) {
62650
62687
  if (cell.isFormula) {
@@ -62866,7 +62903,7 @@ class CellPlugin extends CorePlugin {
62866
62903
  for (const position of positions) {
62867
62904
  const cell = this.getters.getCell(position);
62868
62905
  const xc = toXC(position.col, position.row);
62869
- const style = this.removeDefaultStyleValues(cell.style);
62906
+ const style = this.extractCustomStyle(cell);
62870
62907
  if (Object.keys(style).length) {
62871
62908
  const styleId = getItemId(style, styles);
62872
62909
  positionsByStyle[styleId] ??= [];
@@ -62912,10 +62949,14 @@ class CellPlugin extends CorePlugin {
62912
62949
  }
62913
62950
  }
62914
62951
  }
62915
- removeDefaultStyleValues(style) {
62916
- const cleanedStyle = { ...style };
62917
- for (const property in DEFAULT_STYLE) {
62918
- if (cleanedStyle[property] === DEFAULT_STYLE[property]) {
62952
+ extractCustomStyle(cell) {
62953
+ const cleanedStyle = { ...cell.style };
62954
+ const defaultStyle = isNumber(cell.content, DEFAULT_LOCALE)
62955
+ ? DEFAULT_NUMBER_STYLE
62956
+ : DEFAULT_STYLE;
62957
+ for (const property in cleanedStyle) {
62958
+ if ((property !== "align" || !cell.isFormula) &&
62959
+ cleanedStyle[property] === defaultStyle[property]) {
62919
62960
  delete cleanedStyle[property];
62920
62961
  }
62921
62962
  }
@@ -63266,12 +63307,12 @@ class ChartPlugin extends CorePlugin {
63266
63307
  charts = {};
63267
63308
  createChart = chartFactory(this.getters);
63268
63309
  validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
63269
- adaptRanges(applyChange, sheetId, adaptSheetName) {
63310
+ adaptRanges(rangeAdapters) {
63270
63311
  for (const [chartId, chart] of Object.entries(this.charts)) {
63271
63312
  if (!chart) {
63272
63313
  continue;
63273
63314
  }
63274
- const newChart = chart.chart.updateRanges(applyChange, sheetId, adaptSheetName);
63315
+ const newChart = chart.chart.updateRanges(rangeAdapters);
63275
63316
  this.history.update("charts", chartId, newChart ? { figureId: chart.figureId, chart: newChart } : undefined);
63276
63317
  }
63277
63318
  }
@@ -63526,7 +63567,7 @@ class ConditionalFormatPlugin extends CorePlugin {
63526
63567
  "getAdaptedCfRanges",
63527
63568
  ];
63528
63569
  cfRules = {};
63529
- adaptCFFormulas(applyChange) {
63570
+ adaptCFFormulas({ applyChange, adaptFormulaString }) {
63530
63571
  for (const sheetId in this.cfRules) {
63531
63572
  for (const rule of this.cfRules[sheetId]) {
63532
63573
  if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
@@ -63550,7 +63591,7 @@ class ConditionalFormatPlugin extends CorePlugin {
63550
63591
  for (let i = 0; i < rule.rule.values.length; i++) {
63551
63592
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
63552
63593
  //@ts-expect-error
63553
- "values", i, this.getters.adaptFormulaStringDependencies(sheetId, rule.rule.values[i], applyChange));
63594
+ "values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
63554
63595
  }
63555
63596
  }
63556
63597
  else if (rule.rule.type === "IconSetRule") {
@@ -63558,7 +63599,7 @@ class ConditionalFormatPlugin extends CorePlugin {
63558
63599
  if (rule.rule[inflectionPoint].type === "formula") {
63559
63600
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
63560
63601
  //@ts-expect-error
63561
- inflectionPoint, "value", this.getters.adaptFormulaStringDependencies(sheetId, rule.rule[inflectionPoint].value, applyChange));
63602
+ inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
63562
63603
  }
63563
63604
  }
63564
63605
  }
@@ -63568,14 +63609,14 @@ class ConditionalFormatPlugin extends CorePlugin {
63568
63609
  if (ruleValue?.type === "formula" && ruleValue?.value) {
63569
63610
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
63570
63611
  //@ts-expect-error
63571
- value, "value", this.getters.adaptFormulaStringDependencies(sheetId, ruleValue.value, applyChange));
63612
+ value, "value", adaptFormulaString(sheetId, ruleValue.value));
63572
63613
  }
63573
63614
  }
63574
63615
  }
63575
63616
  }
63576
63617
  }
63577
63618
  }
63578
- adaptCFRanges(sheetId, applyChange) {
63619
+ adaptCFRanges(sheetId, { applyChange }) {
63579
63620
  for (const rule of this.cfRules[sheetId]) {
63580
63621
  for (const range of rule.ranges) {
63581
63622
  const change = applyChange(range);
@@ -63599,12 +63640,12 @@ class ConditionalFormatPlugin extends CorePlugin {
63599
63640
  }
63600
63641
  }
63601
63642
  }
63602
- adaptRanges(applyChange, sheetId) {
63643
+ adaptRanges(rangeAdapters, sheetId) {
63603
63644
  const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
63604
63645
  for (const sheetId of sheetIds) {
63605
- this.adaptCFRanges(sheetId, applyChange);
63646
+ this.adaptCFRanges(sheetId, rangeAdapters);
63606
63647
  }
63607
- this.adaptCFFormulas(applyChange);
63648
+ this.adaptCFFormulas(rangeAdapters);
63608
63649
  }
63609
63650
  // ---------------------------------------------------------------------------
63610
63651
  // Command Handling
@@ -63981,23 +64022,23 @@ class DataValidationPlugin extends CorePlugin {
63981
64022
  "getValidationRuleForCell",
63982
64023
  ];
63983
64024
  rules = {};
63984
- adaptRanges(applyChange, sheetId) {
63985
- this.adaptDVRanges(sheetId, applyChange);
63986
- this.adaptDVFormulas(applyChange);
64025
+ adaptRanges(rangeAdapters, sheetId) {
64026
+ this.adaptDVRanges(sheetId, rangeAdapters);
64027
+ this.adaptDVFormulas(rangeAdapters);
63987
64028
  }
63988
- adaptDVFormulas(applyChange) {
64029
+ adaptDVFormulas({ adaptFormulaString }) {
63989
64030
  for (const sheetId in this.rules) {
63990
64031
  const rules = this.rules[sheetId];
63991
64032
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
63992
64033
  const rule = this.rules[sheetId][ruleIndex];
63993
64034
  for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
63994
- const value = this.getters.adaptFormulaStringDependencies(sheetId, rule.criterion.values[valueIndex], applyChange);
64035
+ const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
63995
64036
  this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
63996
64037
  }
63997
64038
  }
63998
64039
  }
63999
64040
  }
64000
- adaptDVRanges(sheetId, applyChange) {
64041
+ adaptDVRanges(sheetId, { applyChange }) {
64001
64042
  const rules = this.rules[sheetId];
64002
64043
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
64003
64044
  const rule = this.rules[sheetId][ruleIndex];
@@ -64271,7 +64312,7 @@ class FigurePlugin extends CorePlugin {
64271
64312
  // ---------------------------------------------------------------------------
64272
64313
  // Command Handling
64273
64314
  // ---------------------------------------------------------------------------
64274
- adaptRanges(applyChange, sheetId) {
64315
+ adaptRanges({ applyChange }, sheetId) {
64275
64316
  for (const figure of this.getFigures(sheetId)) {
64276
64317
  const change = applyChange(this.getters.getRangeFromZone(sheetId, {
64277
64318
  left: figure.col,
@@ -65102,8 +65143,8 @@ class MergePlugin extends CorePlugin {
65102
65143
  break;
65103
65144
  }
65104
65145
  }
65105
- adaptRanges(applyChange, sheetId) {
65106
- this.applyRangeChangeOnSheet(sheetId, applyChange);
65146
+ adaptRanges(rangeAdapters, sheetId) {
65147
+ this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
65107
65148
  }
65108
65149
  // ---------------------------------------------------------------------------
65109
65150
  // Getters
@@ -65405,7 +65446,7 @@ class MergePlugin extends CorePlugin {
65405
65446
  /**
65406
65447
  * Apply a range change on merges of a particular sheet.
65407
65448
  */
65408
- applyRangeChangeOnSheet(sheetId, applyChange) {
65449
+ applyRangeChangeOnSheet(sheetId, { applyChange }) {
65409
65450
  const merges = Object.entries(this.merges[sheetId] || {});
65410
65451
  for (const [mergeId, range] of merges) {
65411
65452
  if (range) {
@@ -65479,7 +65520,7 @@ function rangeToMerge(mergeId, range) {
65479
65520
  };
65480
65521
  }
65481
65522
 
65482
- class RangeAdapter {
65523
+ class RangeAdapterPlugin {
65483
65524
  getters;
65484
65525
  providers = [];
65485
65526
  isAdaptingRanges = false;
@@ -65487,7 +65528,6 @@ class RangeAdapter {
65487
65528
  this.getters = getters;
65488
65529
  }
65489
65530
  static getters = [
65490
- "adaptFormulaStringDependencies",
65491
65531
  "copyFormulaStringForSheet",
65492
65532
  "extendRange",
65493
65533
  "getRangeString",
@@ -65518,8 +65558,8 @@ class RangeAdapter {
65518
65558
  throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
65519
65559
  }
65520
65560
  const rangeAdapter = getRangeAdapter(cmd);
65521
- if (rangeAdapter?.applyChange) {
65522
- this.executeOnAllRanges(rangeAdapter.applyChange, rangeAdapter.sheetId, rangeAdapter.sheetName);
65561
+ if (rangeAdapter) {
65562
+ this.executeOnAllRanges(rangeAdapter);
65523
65563
  }
65524
65564
  }
65525
65565
  finalize() { }
@@ -65538,11 +65578,15 @@ class RangeAdapter {
65538
65578
  return result;
65539
65579
  };
65540
65580
  }
65541
- executeOnAllRanges(adaptRange, sheetId, sheetName) {
65581
+ executeOnAllRanges(rangeAdapter) {
65542
65582
  this.isAdaptingRanges = true;
65543
- const func = this.verifyRangeRemoved(adaptRange);
65583
+ const adapterFunctions = {
65584
+ applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
65585
+ adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
65586
+ adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
65587
+ };
65544
65588
  for (const provider of this.providers) {
65545
- provider(func, sheetId, sheetName);
65589
+ provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
65546
65590
  }
65547
65591
  this.isAdaptingRanges = false;
65548
65592
  }
@@ -65710,18 +65754,6 @@ class RangeAdapter {
65710
65754
  const unionOfZones = unionUnboundedZones(...zones);
65711
65755
  return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
65712
65756
  }
65713
- adaptFormulaStringDependencies(sheetId, formula, applyChange) {
65714
- if (!formula.startsWith("=")) {
65715
- return formula;
65716
- }
65717
- const compiledFormula = compile(formula);
65718
- const updatedDependencies = compiledFormula.dependencies.map((dep) => {
65719
- const range = this.getters.getRangeFromSheetXC(sheetId, dep);
65720
- const changedRange = applyChange(range);
65721
- return changedRange.changeType === "NONE" ? range : changedRange.range;
65722
- });
65723
- return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
65724
- }
65725
65757
  /**
65726
65758
  * Copy a formula string to another sheet.
65727
65759
  *
@@ -66609,7 +66641,7 @@ class TablePlugin extends CorePlugin {
66609
66641
  static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
66610
66642
  tables = {};
66611
66643
  nextTableId = 1;
66612
- adaptRanges(applyChange, sheetId) {
66644
+ adaptRanges({ applyChange }, sheetId) {
66613
66645
  for (const table of this.getCoreTables(sheetId)) {
66614
66646
  this.applyRangeChangeOnTable(sheetId, table, applyChange);
66615
66647
  }
@@ -67606,6 +67638,7 @@ class PivotCorePlugin extends CorePlugin {
67606
67638
  "getMeasureCompiledFormula",
67607
67639
  "getPivotName",
67608
67640
  "isExistingPivot",
67641
+ "getMeasureFullDependencies",
67609
67642
  ];
67610
67643
  nextFormulaId = 1;
67611
67644
  pivots = {};
@@ -67688,12 +67721,12 @@ class PivotCorePlugin extends CorePlugin {
67688
67721
  }
67689
67722
  case "UPDATE_PIVOT": {
67690
67723
  this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
67691
- this.compileCalculatedMeasures(cmd.pivot.measures);
67724
+ this.compileCalculatedMeasures(cmd.pivotId, cmd.pivot.measures);
67692
67725
  break;
67693
67726
  }
67694
67727
  }
67695
67728
  }
67696
- adaptRanges(applyChange) {
67729
+ adaptRanges({ applyChange, adaptFormulaString }) {
67697
67730
  for (const pivotId in this.pivots) {
67698
67731
  const definition = deepCopy(this.pivots[pivotId]?.definition);
67699
67732
  if (!definition) {
@@ -67706,22 +67739,22 @@ class PivotCorePlugin extends CorePlugin {
67706
67739
  this.history.update("pivots", pivotId, "definition", newDefinition);
67707
67740
  }
67708
67741
  }
67709
- for (const sheetId in this.compiledMeasureFormulas) {
67710
- for (const formulaString in this.compiledMeasureFormulas[sheetId]) {
67711
- const compiledFormula = this.compiledMeasureFormulas[sheetId][formulaString];
67712
- const newDependencies = [];
67713
- for (const range of compiledFormula.dependencies) {
67714
- const change = applyChange(range);
67715
- if (change.changeType === "NONE") {
67716
- newDependencies.push(range);
67717
- }
67718
- else {
67719
- newDependencies.push(change.range);
67720
- }
67742
+ for (const pivotId in this.compiledMeasureFormulas) {
67743
+ for (const measureId in this.compiledMeasureFormulas[pivotId]) {
67744
+ const measure = this.pivots[pivotId]?.definition.measures.find((m) => m.id === measureId);
67745
+ if (!measure || !measure.computedBy) {
67746
+ continue;
67721
67747
  }
67722
- const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
67723
- if (newFormulaString !== formulaString) {
67724
- this.replaceMeasureFormula(sheetId, formulaString, newFormulaString);
67748
+ const sheetId = measure.computedBy.sheetId;
67749
+ const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
67750
+ // adapt direct dependencies
67751
+ this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
67752
+ // adapt all dependencies (including indirect)
67753
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
67754
+ const oldFormulaString = measure.computedBy.formula;
67755
+ const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
67756
+ if (newFormulaString !== oldFormulaString) {
67757
+ this.replaceMeasureFormula(pivotId, measure, newFormulaString);
67725
67758
  }
67726
67759
  }
67727
67760
  }
@@ -67759,31 +67792,60 @@ class PivotCorePlugin extends CorePlugin {
67759
67792
  isExistingPivot(pivotId) {
67760
67793
  return pivotId in this.pivots;
67761
67794
  }
67762
- getMeasureCompiledFormula(measure) {
67795
+ getMeasureCompiledFormula(pivotId, measure) {
67763
67796
  if (!measure.computedBy) {
67764
67797
  throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
67765
67798
  }
67766
- const sheetId = measure.computedBy.sheetId;
67767
- return this.compiledMeasureFormulas[sheetId][measure.computedBy.formula];
67799
+ return this.compiledMeasureFormulas[pivotId][measure.id].formula;
67800
+ }
67801
+ getMeasureFullDependencies(pivotId, measure) {
67802
+ if (!measure.computedBy) {
67803
+ throw new Error(`Measure ${measure.fieldName} is not computed by formula`);
67804
+ }
67805
+ return this.compiledMeasureFormulas[pivotId][measure.id].dependencies;
67768
67806
  }
67769
67807
  // -------------------------------------------------------------------------
67770
67808
  // Private
67771
67809
  // -------------------------------------------------------------------------
67772
67810
  addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
67773
67811
  this.history.update("pivots", pivotId, { definition: deepCopy(pivot), formulaId });
67774
- this.compileCalculatedMeasures(pivot.measures);
67812
+ this.compileCalculatedMeasures(pivotId, pivot.measures);
67775
67813
  this.history.update("formulaIds", formulaId, pivotId);
67776
67814
  this.history.update("nextFormulaId", this.nextFormulaId + 1);
67777
67815
  }
67778
- compileCalculatedMeasures(measures) {
67816
+ compileCalculatedMeasures(pivotId, measures) {
67779
67817
  for (const measure of measures) {
67780
67818
  if (measure.computedBy) {
67781
- const sheetId = measure.computedBy.sheetId;
67782
67819
  const compiledFormula = this.compileMeasureFormula(measure.computedBy.sheetId, measure.computedBy.formula);
67783
- this.history.update("compiledMeasureFormulas", sheetId, measure.computedBy.formula, compiledFormula);
67820
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "formula", compiledFormula);
67821
+ }
67822
+ }
67823
+ for (const measure of measures) {
67824
+ if (measure.computedBy) {
67825
+ const dependencies = this.computeMeasureFullDependencies(pivotId, measure);
67826
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", dependencies);
67784
67827
  }
67785
67828
  }
67786
67829
  }
67830
+ computeMeasureFullDependencies(pivotId, measure, exploredMeasures = new Set()) {
67831
+ const rangeDependencies = [];
67832
+ const definition = this.getPivotCoreDefinition(pivotId);
67833
+ const formula = this.getMeasureCompiledFormula(pivotId, measure);
67834
+ exploredMeasures.add(measure.id);
67835
+ for (const token of formula.tokens) {
67836
+ if (token.type !== "SYMBOL") {
67837
+ continue;
67838
+ }
67839
+ const otherMeasure = definition.measures.find((measureCandidate) => getCanonicalSymbolName(measureCandidate.id) === token.value &&
67840
+ measure.id !== measureCandidate.id);
67841
+ if (!otherMeasure || exploredMeasures.has(otherMeasure.id) || !otherMeasure.computedBy) {
67842
+ continue;
67843
+ }
67844
+ rangeDependencies.push(...this.computeMeasureFullDependencies(pivotId, otherMeasure, exploredMeasures));
67845
+ }
67846
+ rangeDependencies.push(...formula.dependencies.filter((range) => !range.invalidXc));
67847
+ return rangeDependencies;
67848
+ }
67787
67849
  insertPivot(position, formulaId, table) {
67788
67850
  this.resizeSheet(position.sheetId, position, table);
67789
67851
  const pivotCells = table.getPivotCells();
@@ -67842,21 +67904,16 @@ class PivotCorePlugin extends CorePlugin {
67842
67904
  dependencies: rangeDependencies,
67843
67905
  };
67844
67906
  }
67845
- replaceMeasureFormula(sheetId, formulaString, newFormulaString) {
67846
- this.history.update("compiledMeasureFormulas", sheetId, formulaString, undefined);
67847
- this.history.update("compiledMeasureFormulas", sheetId, newFormulaString, this.compileMeasureFormula(sheetId, newFormulaString));
67848
- for (const pivotId in this.pivots) {
67849
- const pivot = this.pivots[pivotId];
67850
- if (!pivot) {
67851
- continue;
67852
- }
67853
- for (const measure of pivot.definition.measures) {
67854
- if (measure.computedBy?.formula === formulaString) {
67855
- const measureIndex = pivot.definition.measures.indexOf(measure);
67856
- this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
67857
- }
67858
- }
67907
+ replaceMeasureFormula(pivotId, measure, newFormulaString) {
67908
+ const pivot = this.pivots[pivotId];
67909
+ if (!pivot) {
67910
+ return;
67859
67911
  }
67912
+ const measureIndex = pivot.definition.measures.indexOf(measure);
67913
+ this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", {
67914
+ formula: newFormulaString,
67915
+ sheetId: measure.computedBy.sheetId,
67916
+ });
67860
67917
  }
67861
67918
  checkSortedColumnInMeasures(definition) {
67862
67919
  const measures = definition.measures.map((measure) => measure.id);
@@ -69502,11 +69559,16 @@ class SpreadingRelation {
69502
69559
  return this.arrayFormulasToResults.get(formulasPosition);
69503
69560
  }
69504
69561
  /**
69505
- * Remove a node, also remove it from other nodes adjacency list
69562
+ * Remove a spreading relation for a given array formula position
69563
+ * and its result zone
69506
69564
  */
69507
69565
  removeNode(position) {
69566
+ const resultZone = this.arrayFormulasToResults.get(position);
69567
+ if (!resultZone) {
69568
+ return;
69569
+ }
69508
69570
  this.resultsToArrayFormulas.remove({
69509
- boundingBox: { sheetId: position.sheetId, zone: positionToZone(position) },
69571
+ boundingBox: { sheetId: position.sheetId, zone: resultZone },
69510
69572
  data: position,
69511
69573
  });
69512
69574
  this.arrayFormulasToResults.delete(position);
@@ -69819,6 +69881,10 @@ class Evaluator {
69819
69881
  // empty matrix
69820
69882
  return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
69821
69883
  }
69884
+ if (nbRows === 1 && nbColumns === 1) {
69885
+ // single value matrix
69886
+ return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
69887
+ }
69822
69888
  const resultZone = {
69823
69889
  top: formulaPosition.row,
69824
69890
  bottom: formulaPosition.row + nbRows - 1,
@@ -71538,6 +71604,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
71538
71604
  handle(cmd) {
71539
71605
  switch (cmd.type) {
71540
71606
  case "START":
71607
+ case "UPDATE_LOCALE":
71541
71608
  for (const sheetId of this.getters.getSheetIds()) {
71542
71609
  this.initializeSheet(sheetId);
71543
71610
  }
@@ -71659,7 +71726,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
71659
71726
  }
71660
71727
  const cell = this.getters.getCell(position);
71661
71728
  const colSize = this.getters.getColSize(position.sheetId, position.col);
71662
- return getDefaultCellHeight(this.ctx, cell, colSize);
71729
+ return getDefaultCellHeight(this.ctx, cell, this.getters.getLocale(), colSize);
71663
71730
  }
71664
71731
  isInMultiRowMerge(position) {
71665
71732
  const merge = this.getters.getMerge(position);
@@ -71706,14 +71773,16 @@ const PERCENT_FORMAT = "0.00%";
71706
71773
  function withPivotPresentationLayer (PivotClass) {
71707
71774
  class PivotPresentationLayer extends PivotClass {
71708
71775
  getters;
71776
+ pivotId;
71709
71777
  cache = {};
71710
71778
  rankAsc = {};
71711
71779
  rankDesc = {};
71712
71780
  runningTotal = {};
71713
71781
  runningTotalInPercent = {};
71714
- constructor(custom, params) {
71782
+ constructor(pivotId, custom, params) {
71715
71783
  super(custom, params);
71716
71784
  this.getters = params.getters;
71785
+ this.pivotId = pivotId;
71717
71786
  }
71718
71787
  markAsDirtyForEvaluation() {
71719
71788
  this.cache = {};
@@ -71763,7 +71832,7 @@ function withPivotPresentationLayer (PivotClass) {
71763
71832
  return handleError(error, measure.aggregator.toUpperCase());
71764
71833
  }
71765
71834
  }
71766
- const formula = this.getters.getMeasureCompiledFormula(measure);
71835
+ const formula = this.getters.getMeasureCompiledFormula(this.pivotId, measure);
71767
71836
  const getSymbolValue = (symbolName) => {
71768
71837
  const { columns, rows } = this.definition;
71769
71838
  if (columns.find((col) => col.nameWithGranularity === symbolName)) {
@@ -72518,7 +72587,7 @@ class PivotUIPlugin extends CoreViewPlugin {
72518
72587
  const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
72519
72588
  if (!(pivotId in this.pivots)) {
72520
72589
  const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
72521
- this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
72590
+ this.pivots[pivotId] = new Pivot(pivotId, this.custom, { definition, getters: this.getters });
72522
72591
  }
72523
72592
  else if (recreate) {
72524
72593
  this.pivots[pivotId].onDefinitionChange(definition);
@@ -73980,7 +74049,7 @@ function addConditionalFormatCommandAdaptRange(cmd, applyChange) {
73980
74049
  cmd.cf.rule = {
73981
74050
  ...rule,
73982
74051
  rangeValues: rule.rangeValues
73983
- ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
74052
+ ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
73984
74053
  : undefined,
73985
74054
  };
73986
74055
  }
@@ -87600,6 +87669,9 @@ function addStyles(styles) {
87600
87669
  if (style.alignment && style.alignment.wrapText) {
87601
87670
  alignAttrs.push(["wrapText", "1"]);
87602
87671
  }
87672
+ if (style.alignment && style.alignment.shrinkToFit) {
87673
+ alignAttrs.push(["shrinkToFit", "1"]);
87674
+ }
87603
87675
  if (alignAttrs.length > 0) {
87604
87676
  attributes.push(["applyAlignment", "1"]); // for Libre Office
87605
87677
  styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
@@ -88370,7 +88442,7 @@ class Model extends EventBus {
88370
88442
  this.config = this.setupConfig(config);
88371
88443
  this.session = this.setupSession(workbookData.revisionId);
88372
88444
  this.coreGetters = {};
88373
- this.range = new RangeAdapter(this.coreGetters);
88445
+ this.range = new RangeAdapterPlugin(this.coreGetters);
88374
88446
  this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
88375
88447
  this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
88376
88448
  this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
@@ -88384,8 +88456,6 @@ class Model extends EventBus {
88384
88456
  this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
88385
88457
  this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
88386
88458
  this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
88387
- this.coreGetters.adaptFormulaStringDependencies =
88388
- this.range.adaptFormulaStringDependencies.bind(this.range);
88389
88459
  this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
88390
88460
  this.getters = {
88391
88461
  isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
@@ -89073,6 +89143,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
89073
89143
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
89074
89144
 
89075
89145
 
89076
- __info__.version = "19.0.16";
89077
- __info__.date = "2026-01-07T16:21:15.857Z";
89078
- __info__.hash = "9f3f13a";
89146
+ __info__.version = "19.0.18";
89147
+ __info__.date = "2026-01-21T11:06:57.346Z";
89148
+ __info__.hash = "bd44f59";