@odoo/o-spreadsheet 17.0.8 → 17.0.10

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 17.0.8
6
- * @date 2024-01-17T10:27:32.736Z
7
- * @hash 0f2d46e
5
+ * @version 17.0.10
6
+ * @date 2024-02-02T13:48:28.727Z
7
+ * @hash be06aa9
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2122,6 +2122,7 @@ exports.CommandResult = void 0;
2122
2122
  CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
2123
2123
  CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
2124
2124
  CommandResult["NoChanges"] = "NoChanges";
2125
+ CommandResult["InvalidInputId"] = "InvalidInputId";
2125
2126
  })(exports.CommandResult || (exports.CommandResult = {}));
2126
2127
 
2127
2128
  const DEFAULT_LOCALES = [
@@ -3266,27 +3267,30 @@ function roundFormat(format) {
3266
3267
  }
3267
3268
  function createLargeNumberFormat(format, magnitude, postFix, locale) {
3268
3269
  const internalFormat = parseFormat(format || "#,##0");
3269
- const largeNumberFormat = internalFormat
3270
- .map((formatPart) => {
3271
- if (formatPart.type === "NUMBER") {
3272
- return [
3273
- {
3274
- ...formatPart,
3275
- format: {
3276
- ...formatPart.format,
3277
- magnitude,
3278
- decimalPart: undefined,
3279
- },
3280
- },
3281
- {
3282
- type: "STRING",
3283
- format: postFix,
3284
- },
3285
- ];
3270
+ const largeNumberFormat = [];
3271
+ for (let i = 0; i < internalFormat.length; i++) {
3272
+ const formatPart = internalFormat[i];
3273
+ if (formatPart.type !== "NUMBER") {
3274
+ largeNumberFormat.push(formatPart);
3275
+ continue;
3286
3276
  }
3287
- return formatPart;
3288
- })
3289
- .flat();
3277
+ largeNumberFormat.push({
3278
+ ...formatPart,
3279
+ format: {
3280
+ ...formatPart.format,
3281
+ magnitude,
3282
+ decimalPart: undefined,
3283
+ },
3284
+ });
3285
+ largeNumberFormat.push({
3286
+ type: "STRING",
3287
+ format: postFix,
3288
+ });
3289
+ const nextFormatPart = internalFormat[i + 1];
3290
+ if (nextFormatPart?.type === "STRING" && ["k", "m", "b"].includes(nextFormatPart.format)) {
3291
+ i++;
3292
+ }
3293
+ }
3290
3294
  return convertInternalFormatToFormat(largeNumberFormat);
3291
3295
  }
3292
3296
  function changeDecimalPlaces(format, step, locale) {
@@ -4930,14 +4934,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
4930
4934
  : undefined));
4931
4935
  }
4932
4936
  }
4933
- else if (zone.left === zone.right && zone.top === zone.bottom) {
4934
- // A single cell. If it's only the title, the dataset is not added.
4935
- if (!dataSetsHaveTitle) {
4936
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
4937
- }
4938
- }
4939
4937
  else {
4940
- /* 1 row or 1 column */
4938
+ /* 1 cell, 1 row or 1 column */
4941
4939
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
4942
4940
  ? {
4943
4941
  top: zone.top,
@@ -4986,8 +4984,10 @@ function toExcelDataset(getters, ds) {
4986
4984
  }
4987
4985
  const dataRange = ds.dataRange.clone({ zone: dataZone });
4988
4986
  return {
4989
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
4990
- range: getters.getRangeString(dataRange, "forceSheetReference"),
4987
+ label: ds.labelCell
4988
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
4989
+ : undefined,
4990
+ range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
4991
4991
  };
4992
4992
  }
4993
4993
  function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
@@ -5000,7 +5000,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
5000
5000
  zone.top = zone.top + 1;
5001
5001
  }
5002
5002
  const range = labelRange.clone({ zone });
5003
- return getters.getRangeString(range, "forceSheetReference");
5003
+ return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
5004
5004
  }
5005
5005
  /**
5006
5006
  * Transform a chart definition which supports dataSets (dataSets and LabelRange)
@@ -8590,7 +8590,7 @@ class BarChart extends AbstractChart {
8590
8590
  return undefined;
8591
8591
  const dataSets = this.dataSets
8592
8592
  .map((ds) => toExcelDataset(this.getters, ds))
8593
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8593
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
8594
8594
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
8595
8595
  return {
8596
8596
  ...this.getDefinition(),
@@ -9168,7 +9168,7 @@ class LineChart extends AbstractChart {
9168
9168
  return undefined;
9169
9169
  const dataSets = this.dataSets
9170
9170
  .map((ds) => toExcelDataset(this.getters, ds))
9171
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9171
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9172
9172
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9173
9173
  return {
9174
9174
  ...this.getDefinition(),
@@ -9474,7 +9474,7 @@ class PieChart extends AbstractChart {
9474
9474
  return undefined;
9475
9475
  const dataSets = this.dataSets
9476
9476
  .map((ds) => toExcelDataset(this.getters, ds))
9477
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9477
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9478
9478
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9479
9479
  return {
9480
9480
  ...this.getDefinition(),
@@ -19917,19 +19917,20 @@ const formatNumberPercent = createFormatActionSpec({
19917
19917
  const formatNumberCurrency = createFormatActionSpec({
19918
19918
  name: _t("Currency"),
19919
19919
  descriptionValue: 1000.12,
19920
- format: (env) => env.model.config.defaultCurrencyFormat,
19920
+ format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
19921
19921
  });
19922
19922
  const formatNumberCurrencyRounded = {
19923
19923
  ...createFormatActionSpec({
19924
19924
  name: _t("Currency rounded"),
19925
19925
  descriptionValue: 1000,
19926
- format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
19926
+ format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
19927
19927
  }),
19928
19928
  isVisible: (env) => {
19929
19929
  const currencyFormat = env.model.config.defaultCurrencyFormat;
19930
- return currencyFormat !== roundFormat(currencyFormat);
19930
+ return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
19931
19931
  },
19932
19932
  };
19933
+ const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
19933
19934
  const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
19934
19935
  const formatCustomCurrency = {
19935
19936
  name: _t("Custom currency"),
@@ -26808,6 +26809,9 @@ class Composer extends owl.Component {
26808
26809
  const token = tokens.filter((token) => token.value.includes(currentSelectedText) &&
26809
26810
  token.start <= currentSelection.start &&
26810
26811
  token.end >= currentSelection.end)[0];
26812
+ if (!token) {
26813
+ return;
26814
+ }
26811
26815
  if (token.type === "REFERENCE") {
26812
26816
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", {
26813
26817
  start: token.start,
@@ -29346,6 +29350,7 @@ const registries$1 = {
29346
29350
  GROUP_HEADERS: groupHeadersMenuRegistry,
29347
29351
  UNGROUP_HEADERS: unGroupHeadersMenuRegistry,
29348
29352
  };
29353
+ const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
29349
29354
  // -----------------------------------------------------------------------------
29350
29355
  // JS
29351
29356
  // -----------------------------------------------------------------------------
@@ -29718,16 +29723,15 @@ class Grid extends owl.Component {
29718
29723
  }
29719
29724
  }
29720
29725
  onKeydown(ev) {
29721
- const eventKey = ev.key.toUpperCase();
29722
29726
  let keyDownString = "";
29723
- if (isCtrlKey(ev) && eventKey !== "CTRL")
29724
- keyDownString += "CTRL+";
29725
- if (ev.metaKey)
29726
- keyDownString += "CTRL+";
29727
- if (ev.altKey && eventKey !== "ALT")
29728
- keyDownString += "ALT+";
29729
- if (ev.shiftKey && eventKey !== "SHIFT")
29730
- keyDownString += "SHIFT+";
29727
+ if (!MODIFIER_KEYS.includes(ev.key)) {
29728
+ if (isCtrlKey(ev))
29729
+ keyDownString += "CTRL+";
29730
+ if (ev.altKey)
29731
+ keyDownString += "ALT+";
29732
+ if (ev.shiftKey)
29733
+ keyDownString += "SHIFT+";
29734
+ }
29731
29735
  keyDownString += ev.key.toUpperCase();
29732
29736
  let handler = this.keyDownMapping[keyDownString];
29733
29737
  if (handler) {
@@ -35565,6 +35569,9 @@ class CellPlugin extends CorePlugin {
35565
35569
  format: cell.format ? getItemId(cell.format, formats) : undefined,
35566
35570
  content: cell.content || undefined,
35567
35571
  };
35572
+ if (cell instanceof FormulaCellWithDependencies) {
35573
+ cells[xc].content = cell.contentWithFixedReferences || undefined;
35574
+ }
35568
35575
  }
35569
35576
  _sheet.cells = cells;
35570
35577
  }
@@ -35608,13 +35615,13 @@ class CellPlugin extends CorePlugin {
35608
35615
  /*
35609
35616
  * Reconstructs the original formula string based on a normalized form and its dependencies
35610
35617
  */
35611
- getFormulaCellContent(sheetId, compiledFormula, dependencies) {
35618
+ getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
35612
35619
  const ranges = dependencies || compiledFormula.dependencies;
35613
35620
  let rangeIndex = 0;
35614
35621
  return concat(compiledFormula.tokens.map((token) => {
35615
35622
  if (token.type === "REFERENCE") {
35616
35623
  const range = ranges[rangeIndex++];
35617
- return this.getters.getRangeString(range, sheetId);
35624
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
35618
35625
  }
35619
35626
  return token.value;
35620
35627
  }));
@@ -35883,6 +35890,18 @@ class FormulaCellWithDependencies {
35883
35890
  get content() {
35884
35891
  return concat(this.compiledFormula.tokens.map((token) => token.value));
35885
35892
  }
35893
+ get contentWithFixedReferences() {
35894
+ let rangeIndex = 0;
35895
+ return concat(this.compiledFormula.tokens.map((token) => {
35896
+ if (token.type === "REFERENCE") {
35897
+ const index = rangeIndex++;
35898
+ return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
35899
+ useFixedReference: true,
35900
+ });
35901
+ }
35902
+ return token.value;
35903
+ }));
35904
+ }
35886
35905
  }
35887
35906
  class RangeReferenceToken {
35888
35907
  getValue;
@@ -36187,7 +36206,13 @@ class ConditionalFormatPlugin extends CorePlugin {
36187
36206
  }
36188
36207
  }
36189
36208
  exportForExcel(data) {
36190
- this.export(data);
36209
+ if (data.sheets) {
36210
+ for (let sheet of data.sheets) {
36211
+ if (this.cfRules[sheet.id]) {
36212
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
36213
+ }
36214
+ }
36215
+ }
36191
36216
  }
36192
36217
  // ---------------------------------------------------------------------------
36193
36218
  // Getters
@@ -36252,11 +36277,11 @@ class ConditionalFormatPlugin extends CorePlugin {
36252
36277
  // ---------------------------------------------------------------------------
36253
36278
  // Private
36254
36279
  // ---------------------------------------------------------------------------
36255
- mapToConditionalFormat(sheetId, cf) {
36280
+ mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
36256
36281
  return {
36257
36282
  ...cf,
36258
36283
  ranges: cf.ranges.map((range) => {
36259
- return this.getters.getRangeString(range, sheetId);
36284
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
36260
36285
  }),
36261
36286
  };
36262
36287
  }
@@ -38324,8 +38349,10 @@ class RangeAdapter {
38324
38349
  *
38325
38350
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
38326
38351
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
38352
+ * @param options
38353
+ * @param options.useFixedReference if true, the range will be returned with fixed row and column
38327
38354
  */
38328
- getRangeString(range, forSheetId) {
38355
+ getRangeString(range, forSheetId, options = { useFixedReference: false }) {
38329
38356
  if (!range) {
38330
38357
  return INCORRECT_RANGE_STRING;
38331
38358
  }
@@ -38352,7 +38379,7 @@ class RangeAdapter {
38352
38379
  if (prefixSheet && !sheetName) {
38353
38380
  return INCORRECT_RANGE_STRING;
38354
38381
  }
38355
- let rangeString = this.getRangePartString(rangeImpl, 0);
38382
+ let rangeString = this.getRangePartString(rangeImpl, 0, options);
38356
38383
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
38357
38384
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
38358
38385
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -38362,7 +38389,7 @@ class RangeAdapter {
38362
38389
  rangeImpl.parts[1].rowFixed ||
38363
38390
  rangeImpl.parts[1].colFixed) {
38364
38391
  rangeString += ":";
38365
- rangeString += this.getRangePartString(rangeImpl, 1);
38392
+ rangeString += this.getRangePartString(rangeImpl, 1, options);
38366
38393
  }
38367
38394
  }
38368
38395
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -38403,13 +38430,13 @@ class RangeAdapter {
38403
38430
  /**
38404
38431
  * Get a Xc string that represent a part of a range
38405
38432
  */
38406
- getRangePartString(range, part) {
38433
+ getRangePartString(range, part, options = { useFixedReference: false }) {
38407
38434
  const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
38408
38435
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
38409
38436
  const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
38410
38437
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
38411
38438
  let str = "";
38412
- if (range.isFullCol) {
38439
+ if (range.isFullCol && !options.useFixedReference) {
38413
38440
  if (part === 0 && range.unboundedZone.hasHeader) {
38414
38441
  str = colFixed + col + rowFixed + row;
38415
38442
  }
@@ -38417,7 +38444,7 @@ class RangeAdapter {
38417
38444
  str = colFixed + col;
38418
38445
  }
38419
38446
  }
38420
- else if (range.isFullRow) {
38447
+ else if (range.isFullRow && !options.useFixedReference) {
38421
38448
  if (part === 0 && range.unboundedZone.hasHeader) {
38422
38449
  str = colFixed + col + rowFixed + row;
38423
38450
  }
@@ -39838,22 +39865,17 @@ class CompilationParametersBuilder {
39838
39865
  * The `compute` of the formula's function must process it completely
39839
39866
  */
39840
39867
  refFn(range, isMeta, functionName, paramNumber) {
39868
+ this.assertRangeValid(range);
39841
39869
  if (isMeta) {
39842
39870
  // Use zoneToXc of zone instead of getRangeString to avoid sending unbounded ranges
39843
39871
  return { value: zoneToXc(range.zone) };
39844
39872
  }
39845
- if (!isZoneValid(range.zone)) {
39846
- throw new InvalidReferenceError();
39847
- }
39848
39873
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
39849
39874
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
39850
39875
  throw new Error(paramNumber
39851
39876
  ? _t("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
39852
39877
  : _t("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
39853
39878
  }
39854
- if (range.invalidSheetName) {
39855
- throw new Error(_t("Invalid sheet name: %s", range.invalidSheetName));
39856
- }
39857
39879
  const position = { sheetId: range.sheetId, col: range.zone.left, row: range.zone.top };
39858
39880
  return this.readCell(position);
39859
39881
  }
@@ -39888,10 +39910,10 @@ class CompilationParametersBuilder {
39888
39910
  * Note that each col is possibly sparse: it only contain the values of cells
39889
39911
  * that are actually present in the grid.
39890
39912
  */
39891
- range({ sheetId, zone }) {
39892
- if (!isZoneValid(zone)) {
39893
- throw new InvalidReferenceError();
39894
- }
39913
+ range(range) {
39914
+ this.assertRangeValid(range);
39915
+ const sheetId = range.sheetId;
39916
+ const zone = range.zone;
39895
39917
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
39896
39918
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
39897
39919
  const sheetZone = this.getters.getSheetZone(sheetId);
@@ -39928,6 +39950,14 @@ class CompilationParametersBuilder {
39928
39950
  this.rangeCache[cacheKey] = matrix;
39929
39951
  return matrix;
39930
39952
  }
39953
+ assertRangeValid(range) {
39954
+ if (!isZoneValid(range.zone)) {
39955
+ throw new InvalidReferenceError();
39956
+ }
39957
+ if (range.invalidSheetName) {
39958
+ throw new Error(_t("Invalid sheet name: %s", range.invalidSheetName));
39959
+ }
39960
+ }
39931
39961
  }
39932
39962
 
39933
39963
  function quickselect(arr, k, left, right, compare) {
@@ -46000,27 +46030,6 @@ class SelectionInputPlugin extends UIPlugin {
46000
46030
  // ---------------------------------------------------------------------------
46001
46031
  // Command Handling
46002
46032
  // ---------------------------------------------------------------------------
46003
- allowDispatch(cmd) {
46004
- switch (cmd.type) {
46005
- case "ADD_RANGE":
46006
- case "ADD_EMPTY_RANGE":
46007
- if (this.inputHasSingleRange && this.ranges.length === 1) {
46008
- return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
46009
- }
46010
- break;
46011
- case "REMOVE_RANGE":
46012
- if (this.ranges.length === 1) {
46013
- return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
46014
- }
46015
- break;
46016
- case "CHANGE_RANGE":
46017
- if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
46018
- return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
46019
- }
46020
- break;
46021
- }
46022
- return "Success" /* CommandResult.Success */;
46023
- }
46024
46033
  handleEvent(event) {
46025
46034
  if (this.focusedRangeIndex === null) {
46026
46035
  return;
@@ -46258,6 +46267,15 @@ class SelectionInputsManagerPlugin extends UIPlugin {
46258
46267
  // Command Handling
46259
46268
  // ---------------------------------------------------------------------------
46260
46269
  allowDispatch(cmd) {
46270
+ switch (cmd.type) {
46271
+ case "FOCUS_RANGE":
46272
+ case "CHANGE_RANGE":
46273
+ case "ADD_EMPTY_RANGE":
46274
+ case "REMOVE_RANGE":
46275
+ if (!this.inputs[cmd.id]) {
46276
+ return "InvalidInputId" /* CommandResult.InvalidInputId */;
46277
+ }
46278
+ }
46261
46279
  switch (cmd.type) {
46262
46280
  case "FOCUS_RANGE":
46263
46281
  const index = this.currentInput?.getIndex(cmd.rangeId);
@@ -46265,9 +46283,25 @@ class SelectionInputsManagerPlugin extends UIPlugin {
46265
46283
  return "InputAlreadyFocused" /* CommandResult.InputAlreadyFocused */;
46266
46284
  }
46267
46285
  break;
46268
- }
46269
- if (this.currentInput) {
46270
- return this.currentInput.allowDispatch(cmd);
46286
+ case "ADD_RANGE":
46287
+ case "ADD_EMPTY_RANGE":
46288
+ const input = this.inputs[cmd.id];
46289
+ if (input.inputHasSingleRange && input.ranges.length === 1) {
46290
+ return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
46291
+ }
46292
+ break;
46293
+ case "REMOVE_RANGE":
46294
+ if (this.inputs[cmd.id].ranges.length === 1) {
46295
+ return "MinimumRangesReached" /* CommandResult.MinimumRangesReached */;
46296
+ }
46297
+ break;
46298
+ case "CHANGE_RANGE": {
46299
+ const input = this.inputs[cmd.id];
46300
+ if (input.inputHasSingleRange && cmd.value.split(",").length > 1) {
46301
+ return "MaximumRangesReached" /* CommandResult.MaximumRangesReached */;
46302
+ }
46303
+ break;
46304
+ }
46271
46305
  }
46272
46306
  return "Success" /* CommandResult.Success */;
46273
46307
  }
@@ -48576,9 +48610,10 @@ class EditionPlugin extends UIPlugin {
48576
48610
  */
48577
48611
  getReferencedRanges() {
48578
48612
  const editionSheetId = this.getters.getCurrentEditedCell().sheetId;
48579
- return this.currentTokens
48613
+ const referenceRanges = this.currentTokens
48580
48614
  .filter((token) => token.type === "REFERENCE")
48581
48615
  .map((token) => this.getters.getRangeFromSheetXC(editionSheetId, token.value));
48616
+ return referenceRanges.filter((range) => !range.invalidSheetName && !range.invalidXc);
48582
48617
  }
48583
48618
  getAutoCompleteDataValidationValues() {
48584
48619
  if (this.mode === "inactive") {
@@ -54936,12 +54971,7 @@ function addFormula(cell) {
54936
54971
  attrs.push(["t", "str"]);
54937
54972
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
54938
54973
  }
54939
- node = escapeXml /*xml*/ `
54940
- <f>
54941
- ${XlsxFormula}
54942
- </f>
54943
- ${cycle}
54944
- `;
54974
+ node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
54945
54975
  return { attrs, node };
54946
54976
  }
54947
54977
  function addContent(content, sharedStrings, forceString = false) {
@@ -55760,11 +55790,10 @@ function addRows(construct, data, sheet) {
55760
55790
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
55761
55791
  }
55762
55792
  attributes.push(...additionalAttrs);
55763
- cellNodes.push(escapeXml /*xml*/ `
55764
- <c ${formatAttributes(attributes)}>
55765
- ${cellNode}
55766
- </c>
55767
- `);
55793
+ // prettier-ignore
55794
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
55795
+ ${cellNode}
55796
+ </c>`);
55768
55797
  }
55769
55798
  }
55770
55799
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -56360,7 +56389,6 @@ class Model extends EventBus {
56360
56389
  ...config,
56361
56390
  mode: config.mode || "normal",
56362
56391
  custom: config.custom || {},
56363
- defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
56364
56392
  external: this.setupExternalConfig(config.external || {}),
56365
56393
  transportService,
56366
56394
  client,
@@ -56398,6 +56426,7 @@ class Model extends EventBus {
56398
56426
  custom: this.config.custom,
56399
56427
  uiActions: this.config,
56400
56428
  session: this.session,
56429
+ defaultCurrencyFormat: this.config.defaultCurrencyFormat,
56401
56430
  };
56402
56431
  }
56403
56432
  // ---------------------------------------------------------------------------
@@ -56770,6 +56799,6 @@ exports.setTranslationMethod = setTranslationMethod;
56770
56799
  exports.tokenize = tokenize;
56771
56800
 
56772
56801
 
56773
- __info__.version = "17.0.8";
56774
- __info__.date = "2024-01-17T10:27:32.736Z";
56775
- __info__.hash = "0f2d46e";
56802
+ __info__.version = "17.0.10";
56803
+ __info__.date = "2024-02-02T13:48:28.727Z";
56804
+ __info__.hash = "be06aa9";
@@ -1190,7 +1190,7 @@ interface ModelConfig {
1190
1190
  readonly custom: Readonly<{
1191
1191
  [key: string]: any;
1192
1192
  }>;
1193
- readonly defaultCurrencyFormat: Format;
1193
+ readonly defaultCurrencyFormat?: Format;
1194
1194
  /**
1195
1195
  * External dependencies required to enable some features
1196
1196
  * such as uploading images.
@@ -1441,6 +1441,7 @@ interface UIPluginConfig {
1441
1441
  readonly uiActions: UIActions;
1442
1442
  readonly custom: ModelConfig["custom"];
1443
1443
  readonly session: Session;
1444
+ readonly defaultCurrencyFormat?: Format;
1444
1445
  }
1445
1446
  interface UIPluginConstructor {
1446
1447
  new (config: UIPluginConfig): UIPlugin;
@@ -2531,7 +2532,8 @@ declare const enum CommandResult {
2531
2532
  InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
2532
2533
  BlockingValidationRule = "BlockingValidationRule",
2533
2534
  InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
2534
- NoChanges = "NoChanges"
2535
+ NoChanges = "NoChanges",
2536
+ InvalidInputId = "InvalidInputId"
2535
2537
  }
2536
2538
  interface CommandHandler<T> {
2537
2539
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -3196,8 +3198,12 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
3196
3198
  *
3197
3199
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
3198
3200
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
3201
+ * @param options
3202
+ * @param options.useFixedReference if true, the range will be returned with fixed row and column
3199
3203
  */
3200
- getRangeString(range: Range, forSheetId: UID): string;
3204
+ getRangeString(range: Range, forSheetId: UID, options?: {
3205
+ useFixedReference: boolean;
3206
+ }): string;
3201
3207
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
3202
3208
  getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
3203
3209
  getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
@@ -3417,7 +3423,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3417
3423
  * starting an async evaluation even if it has been moved or re-allocated
3418
3424
  */
3419
3425
  getCellById(cellId: UID): Cell | undefined;
3420
- getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[]): string;
3426
+ getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[], useFixedReference?: boolean): string;
3421
3427
  getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3422
3428
  getCellStyle(position: CellPosition): Style;
3423
3429
  /**
@@ -4603,14 +4609,13 @@ interface RangeInputValue {
4603
4609
  * This plugin handles this internal state.
4604
4610
  */
4605
4611
  declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4606
- private readonly inputHasSingleRange;
4612
+ readonly inputHasSingleRange: boolean;
4607
4613
  static layers: LAYERS[];
4608
4614
  static getters: never[];
4609
4615
  ranges: RangeInputValue[];
4610
4616
  focusedRangeIndex: number | null;
4611
4617
  private inputSheetId;
4612
4618
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4613
- allowDispatch(cmd: LocalCommand): CommandResult;
4614
4619
  handleEvent(event: SelectionEvent): void;
4615
4620
  handle(cmd: Command): void;
4616
4621
  getSelectionInputValue(): string[];