@odoo/o-spreadsheet 17.0.9 → 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.9
6
- * @date 2024-01-29T13:53:22.963Z
7
- * @hash 3c1209a
5
+ * @version 17.0.10
6
+ * @date 2024-02-02T13:48:28.727Z
7
+ * @hash be06aa9
8
8
  */
9
9
 
10
10
  'use strict';
@@ -4934,14 +4934,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
4934
4934
  : undefined));
4935
4935
  }
4936
4936
  }
4937
- else if (zone.left === zone.right && zone.top === zone.bottom) {
4938
- // A single cell. If it's only the title, the dataset is not added.
4939
- if (!dataSetsHaveTitle) {
4940
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
4941
- }
4942
- }
4943
4937
  else {
4944
- /* 1 row or 1 column */
4938
+ /* 1 cell, 1 row or 1 column */
4945
4939
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
4946
4940
  ? {
4947
4941
  top: zone.top,
@@ -4990,8 +4984,10 @@ function toExcelDataset(getters, ds) {
4990
4984
  }
4991
4985
  const dataRange = ds.dataRange.clone({ zone: dataZone });
4992
4986
  return {
4993
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
4994
- 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 }),
4995
4991
  };
4996
4992
  }
4997
4993
  function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
@@ -5004,7 +5000,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
5004
5000
  zone.top = zone.top + 1;
5005
5001
  }
5006
5002
  const range = labelRange.clone({ zone });
5007
- return getters.getRangeString(range, "forceSheetReference");
5003
+ return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
5008
5004
  }
5009
5005
  /**
5010
5006
  * Transform a chart definition which supports dataSets (dataSets and LabelRange)
@@ -8594,7 +8590,7 @@ class BarChart extends AbstractChart {
8594
8590
  return undefined;
8595
8591
  const dataSets = this.dataSets
8596
8592
  .map((ds) => toExcelDataset(this.getters, ds))
8597
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8593
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
8598
8594
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
8599
8595
  return {
8600
8596
  ...this.getDefinition(),
@@ -9172,7 +9168,7 @@ class LineChart extends AbstractChart {
9172
9168
  return undefined;
9173
9169
  const dataSets = this.dataSets
9174
9170
  .map((ds) => toExcelDataset(this.getters, ds))
9175
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9171
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9176
9172
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9177
9173
  return {
9178
9174
  ...this.getDefinition(),
@@ -9478,7 +9474,7 @@ class PieChart extends AbstractChart {
9478
9474
  return undefined;
9479
9475
  const dataSets = this.dataSets
9480
9476
  .map((ds) => toExcelDataset(this.getters, ds))
9481
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9477
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9482
9478
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9483
9479
  return {
9484
9480
  ...this.getDefinition(),
@@ -19921,19 +19917,20 @@ const formatNumberPercent = createFormatActionSpec({
19921
19917
  const formatNumberCurrency = createFormatActionSpec({
19922
19918
  name: _t("Currency"),
19923
19919
  descriptionValue: 1000.12,
19924
- format: (env) => env.model.config.defaultCurrencyFormat,
19920
+ format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
19925
19921
  });
19926
19922
  const formatNumberCurrencyRounded = {
19927
19923
  ...createFormatActionSpec({
19928
19924
  name: _t("Currency rounded"),
19929
19925
  descriptionValue: 1000,
19930
- format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
19926
+ format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
19931
19927
  }),
19932
19928
  isVisible: (env) => {
19933
19929
  const currencyFormat = env.model.config.defaultCurrencyFormat;
19934
- return currencyFormat !== roundFormat(currencyFormat);
19930
+ return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
19935
19931
  },
19936
19932
  };
19933
+ const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
19937
19934
  const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
19938
19935
  const formatCustomCurrency = {
19939
19936
  name: _t("Custom currency"),
@@ -29353,6 +29350,7 @@ const registries$1 = {
29353
29350
  GROUP_HEADERS: groupHeadersMenuRegistry,
29354
29351
  UNGROUP_HEADERS: unGroupHeadersMenuRegistry,
29355
29352
  };
29353
+ const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
29356
29354
  // -----------------------------------------------------------------------------
29357
29355
  // JS
29358
29356
  // -----------------------------------------------------------------------------
@@ -29725,16 +29723,15 @@ class Grid extends owl.Component {
29725
29723
  }
29726
29724
  }
29727
29725
  onKeydown(ev) {
29728
- const eventKey = ev.key.toUpperCase();
29729
29726
  let keyDownString = "";
29730
- if (isCtrlKey(ev) && eventKey !== "CTRL")
29731
- keyDownString += "CTRL+";
29732
- if (ev.metaKey)
29733
- keyDownString += "CTRL+";
29734
- if (ev.altKey && eventKey !== "ALT")
29735
- keyDownString += "ALT+";
29736
- if (ev.shiftKey && eventKey !== "SHIFT")
29737
- 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
+ }
29738
29735
  keyDownString += ev.key.toUpperCase();
29739
29736
  let handler = this.keyDownMapping[keyDownString];
29740
29737
  if (handler) {
@@ -35572,6 +35569,9 @@ class CellPlugin extends CorePlugin {
35572
35569
  format: cell.format ? getItemId(cell.format, formats) : undefined,
35573
35570
  content: cell.content || undefined,
35574
35571
  };
35572
+ if (cell instanceof FormulaCellWithDependencies) {
35573
+ cells[xc].content = cell.contentWithFixedReferences || undefined;
35574
+ }
35575
35575
  }
35576
35576
  _sheet.cells = cells;
35577
35577
  }
@@ -35615,13 +35615,13 @@ class CellPlugin extends CorePlugin {
35615
35615
  /*
35616
35616
  * Reconstructs the original formula string based on a normalized form and its dependencies
35617
35617
  */
35618
- getFormulaCellContent(sheetId, compiledFormula, dependencies) {
35618
+ getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
35619
35619
  const ranges = dependencies || compiledFormula.dependencies;
35620
35620
  let rangeIndex = 0;
35621
35621
  return concat(compiledFormula.tokens.map((token) => {
35622
35622
  if (token.type === "REFERENCE") {
35623
35623
  const range = ranges[rangeIndex++];
35624
- return this.getters.getRangeString(range, sheetId);
35624
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
35625
35625
  }
35626
35626
  return token.value;
35627
35627
  }));
@@ -35890,6 +35890,18 @@ class FormulaCellWithDependencies {
35890
35890
  get content() {
35891
35891
  return concat(this.compiledFormula.tokens.map((token) => token.value));
35892
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
+ }
35893
35905
  }
35894
35906
  class RangeReferenceToken {
35895
35907
  getValue;
@@ -36194,7 +36206,13 @@ class ConditionalFormatPlugin extends CorePlugin {
36194
36206
  }
36195
36207
  }
36196
36208
  exportForExcel(data) {
36197
- 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
+ }
36198
36216
  }
36199
36217
  // ---------------------------------------------------------------------------
36200
36218
  // Getters
@@ -36259,11 +36277,11 @@ class ConditionalFormatPlugin extends CorePlugin {
36259
36277
  // ---------------------------------------------------------------------------
36260
36278
  // Private
36261
36279
  // ---------------------------------------------------------------------------
36262
- mapToConditionalFormat(sheetId, cf) {
36280
+ mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
36263
36281
  return {
36264
36282
  ...cf,
36265
36283
  ranges: cf.ranges.map((range) => {
36266
- return this.getters.getRangeString(range, sheetId);
36284
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
36267
36285
  }),
36268
36286
  };
36269
36287
  }
@@ -38331,8 +38349,10 @@ class RangeAdapter {
38331
38349
  *
38332
38350
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
38333
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
38334
38354
  */
38335
- getRangeString(range, forSheetId) {
38355
+ getRangeString(range, forSheetId, options = { useFixedReference: false }) {
38336
38356
  if (!range) {
38337
38357
  return INCORRECT_RANGE_STRING;
38338
38358
  }
@@ -38359,7 +38379,7 @@ class RangeAdapter {
38359
38379
  if (prefixSheet && !sheetName) {
38360
38380
  return INCORRECT_RANGE_STRING;
38361
38381
  }
38362
- let rangeString = this.getRangePartString(rangeImpl, 0);
38382
+ let rangeString = this.getRangePartString(rangeImpl, 0, options);
38363
38383
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
38364
38384
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
38365
38385
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -38369,7 +38389,7 @@ class RangeAdapter {
38369
38389
  rangeImpl.parts[1].rowFixed ||
38370
38390
  rangeImpl.parts[1].colFixed) {
38371
38391
  rangeString += ":";
38372
- rangeString += this.getRangePartString(rangeImpl, 1);
38392
+ rangeString += this.getRangePartString(rangeImpl, 1, options);
38373
38393
  }
38374
38394
  }
38375
38395
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -38410,13 +38430,13 @@ class RangeAdapter {
38410
38430
  /**
38411
38431
  * Get a Xc string that represent a part of a range
38412
38432
  */
38413
- getRangePartString(range, part) {
38433
+ getRangePartString(range, part, options = { useFixedReference: false }) {
38414
38434
  const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
38415
38435
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
38416
38436
  const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
38417
38437
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
38418
38438
  let str = "";
38419
- if (range.isFullCol) {
38439
+ if (range.isFullCol && !options.useFixedReference) {
38420
38440
  if (part === 0 && range.unboundedZone.hasHeader) {
38421
38441
  str = colFixed + col + rowFixed + row;
38422
38442
  }
@@ -38424,7 +38444,7 @@ class RangeAdapter {
38424
38444
  str = colFixed + col;
38425
38445
  }
38426
38446
  }
38427
- else if (range.isFullRow) {
38447
+ else if (range.isFullRow && !options.useFixedReference) {
38428
38448
  if (part === 0 && range.unboundedZone.hasHeader) {
38429
38449
  str = colFixed + col + rowFixed + row;
38430
38450
  }
@@ -54951,12 +54971,7 @@ function addFormula(cell) {
54951
54971
  attrs.push(["t", "str"]);
54952
54972
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
54953
54973
  }
54954
- node = escapeXml /*xml*/ `
54955
- <f>
54956
- ${XlsxFormula}
54957
- </f>
54958
- ${cycle}
54959
- `;
54974
+ node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
54960
54975
  return { attrs, node };
54961
54976
  }
54962
54977
  function addContent(content, sharedStrings, forceString = false) {
@@ -55775,11 +55790,10 @@ function addRows(construct, data, sheet) {
55775
55790
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
55776
55791
  }
55777
55792
  attributes.push(...additionalAttrs);
55778
- cellNodes.push(escapeXml /*xml*/ `
55779
- <c ${formatAttributes(attributes)}>
55780
- ${cellNode}
55781
- </c>
55782
- `);
55793
+ // prettier-ignore
55794
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
55795
+ ${cellNode}
55796
+ </c>`);
55783
55797
  }
55784
55798
  }
55785
55799
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -56375,7 +56389,6 @@ class Model extends EventBus {
56375
56389
  ...config,
56376
56390
  mode: config.mode || "normal",
56377
56391
  custom: config.custom || {},
56378
- defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
56379
56392
  external: this.setupExternalConfig(config.external || {}),
56380
56393
  transportService,
56381
56394
  client,
@@ -56413,6 +56426,7 @@ class Model extends EventBus {
56413
56426
  custom: this.config.custom,
56414
56427
  uiActions: this.config,
56415
56428
  session: this.session,
56429
+ defaultCurrencyFormat: this.config.defaultCurrencyFormat,
56416
56430
  };
56417
56431
  }
56418
56432
  // ---------------------------------------------------------------------------
@@ -56785,6 +56799,6 @@ exports.setTranslationMethod = setTranslationMethod;
56785
56799
  exports.tokenize = tokenize;
56786
56800
 
56787
56801
 
56788
- __info__.version = "17.0.9";
56789
- __info__.date = "2024-01-29T13:53:22.963Z";
56790
- __info__.hash = "3c1209a";
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;
@@ -3197,8 +3198,12 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
3197
3198
  *
3198
3199
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
3199
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
3200
3203
  */
3201
- getRangeString(range: Range, forSheetId: UID): string;
3204
+ getRangeString(range: Range, forSheetId: UID, options?: {
3205
+ useFixedReference: boolean;
3206
+ }): string;
3202
3207
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
3203
3208
  getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
3204
3209
  getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
@@ -3418,7 +3423,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3418
3423
  * starting an async evaluation even if it has been moved or re-allocated
3419
3424
  */
3420
3425
  getCellById(cellId: UID): Cell | undefined;
3421
- getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[]): string;
3426
+ getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[], useFixedReference?: boolean): string;
3422
3427
  getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3423
3428
  getCellStyle(position: CellPosition): Style;
3424
3429
  /**
@@ -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.9
6
- * @date 2024-01-29T13:53:22.963Z
7
- * @hash 3c1209a
5
+ * @version 17.0.10
6
+ * @date 2024-02-02T13:48:28.727Z
7
+ * @hash be06aa9
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -4932,14 +4932,8 @@ function createDataSets(getters, dataSetsString, sheetId, dataSetsHaveTitle) {
4932
4932
  : undefined));
4933
4933
  }
4934
4934
  }
4935
- else if (zone.left === zone.right && zone.top === zone.bottom) {
4936
- // A single cell. If it's only the title, the dataset is not added.
4937
- if (!dataSetsHaveTitle) {
4938
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
4939
- }
4940
- }
4941
4935
  else {
4942
- /* 1 row or 1 column */
4936
+ /* 1 cell, 1 row or 1 column */
4943
4937
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
4944
4938
  ? {
4945
4939
  top: zone.top,
@@ -4988,8 +4982,10 @@ function toExcelDataset(getters, ds) {
4988
4982
  }
4989
4983
  const dataRange = ds.dataRange.clone({ zone: dataZone });
4990
4984
  return {
4991
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
4992
- range: getters.getRangeString(dataRange, "forceSheetReference"),
4985
+ label: ds.labelCell
4986
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", { useFixedReference: true })
4987
+ : undefined,
4988
+ range: getters.getRangeString(dataRange, "forceSheetReference", { useFixedReference: true }),
4993
4989
  };
4994
4990
  }
4995
4991
  function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
@@ -5002,7 +4998,7 @@ function toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel) {
5002
4998
  zone.top = zone.top + 1;
5003
4999
  }
5004
5000
  const range = labelRange.clone({ zone });
5005
- return getters.getRangeString(range, "forceSheetReference");
5001
+ return getters.getRangeString(range, "forceSheetReference", { useFixedReference: true });
5006
5002
  }
5007
5003
  /**
5008
5004
  * Transform a chart definition which supports dataSets (dataSets and LabelRange)
@@ -8592,7 +8588,7 @@ class BarChart extends AbstractChart {
8592
8588
  return undefined;
8593
8589
  const dataSets = this.dataSets
8594
8590
  .map((ds) => toExcelDataset(this.getters, ds))
8595
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
8591
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
8596
8592
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
8597
8593
  return {
8598
8594
  ...this.getDefinition(),
@@ -9170,7 +9166,7 @@ class LineChart extends AbstractChart {
9170
9166
  return undefined;
9171
9167
  const dataSets = this.dataSets
9172
9168
  .map((ds) => toExcelDataset(this.getters, ds))
9173
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9169
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9174
9170
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9175
9171
  return {
9176
9172
  ...this.getDefinition(),
@@ -9476,7 +9472,7 @@ class PieChart extends AbstractChart {
9476
9472
  return undefined;
9477
9473
  const dataSets = this.dataSets
9478
9474
  .map((ds) => toExcelDataset(this.getters, ds))
9479
- .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
9475
+ .filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
9480
9476
  const labelRange = toExcelLabelRange(this.getters, this.labelRange, shouldRemoveFirstLabel(this.labelRange, this.dataSets[0], this.dataSetsHaveTitle));
9481
9477
  return {
9482
9478
  ...this.getDefinition(),
@@ -19919,19 +19915,20 @@ const formatNumberPercent = createFormatActionSpec({
19919
19915
  const formatNumberCurrency = createFormatActionSpec({
19920
19916
  name: _t("Currency"),
19921
19917
  descriptionValue: 1000.12,
19922
- format: (env) => env.model.config.defaultCurrencyFormat,
19918
+ format: (env) => env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT,
19923
19919
  });
19924
19920
  const formatNumberCurrencyRounded = {
19925
19921
  ...createFormatActionSpec({
19926
19922
  name: _t("Currency rounded"),
19927
19923
  descriptionValue: 1000,
19928
- format: (env) => roundFormat(env.model.config.defaultCurrencyFormat),
19924
+ format: (env) => roundFormat(env.model.config.defaultCurrencyFormat ?? DEFAULT_CURRENCY_FORMAT),
19929
19925
  }),
19930
19926
  isVisible: (env) => {
19931
19927
  const currencyFormat = env.model.config.defaultCurrencyFormat;
19932
- return currencyFormat !== roundFormat(currencyFormat);
19928
+ return currencyFormat !== roundFormat(currencyFormat ?? DEFAULT_CURRENCY_FORMAT);
19933
19929
  },
19934
19930
  };
19931
+ const DEFAULT_CURRENCY_FORMAT = "[$$]#,##0.00";
19935
19932
  const EXAMPLE_DATE = parseLiteral("2023/09/26 10:43:00 PM", DEFAULT_LOCALE);
19936
19933
  const formatCustomCurrency = {
19937
19934
  name: _t("Custom currency"),
@@ -29351,6 +29348,7 @@ const registries$1 = {
29351
29348
  GROUP_HEADERS: groupHeadersMenuRegistry,
29352
29349
  UNGROUP_HEADERS: unGroupHeadersMenuRegistry,
29353
29350
  };
29351
+ const MODIFIER_KEYS = ["Shift", "Control", "Alt", "Meta"];
29354
29352
  // -----------------------------------------------------------------------------
29355
29353
  // JS
29356
29354
  // -----------------------------------------------------------------------------
@@ -29723,16 +29721,15 @@ class Grid extends Component {
29723
29721
  }
29724
29722
  }
29725
29723
  onKeydown(ev) {
29726
- const eventKey = ev.key.toUpperCase();
29727
29724
  let keyDownString = "";
29728
- if (isCtrlKey(ev) && eventKey !== "CTRL")
29729
- keyDownString += "CTRL+";
29730
- if (ev.metaKey)
29731
- keyDownString += "CTRL+";
29732
- if (ev.altKey && eventKey !== "ALT")
29733
- keyDownString += "ALT+";
29734
- if (ev.shiftKey && eventKey !== "SHIFT")
29735
- keyDownString += "SHIFT+";
29725
+ if (!MODIFIER_KEYS.includes(ev.key)) {
29726
+ if (isCtrlKey(ev))
29727
+ keyDownString += "CTRL+";
29728
+ if (ev.altKey)
29729
+ keyDownString += "ALT+";
29730
+ if (ev.shiftKey)
29731
+ keyDownString += "SHIFT+";
29732
+ }
29736
29733
  keyDownString += ev.key.toUpperCase();
29737
29734
  let handler = this.keyDownMapping[keyDownString];
29738
29735
  if (handler) {
@@ -35570,6 +35567,9 @@ class CellPlugin extends CorePlugin {
35570
35567
  format: cell.format ? getItemId(cell.format, formats) : undefined,
35571
35568
  content: cell.content || undefined,
35572
35569
  };
35570
+ if (cell instanceof FormulaCellWithDependencies) {
35571
+ cells[xc].content = cell.contentWithFixedReferences || undefined;
35572
+ }
35573
35573
  }
35574
35574
  _sheet.cells = cells;
35575
35575
  }
@@ -35613,13 +35613,13 @@ class CellPlugin extends CorePlugin {
35613
35613
  /*
35614
35614
  * Reconstructs the original formula string based on a normalized form and its dependencies
35615
35615
  */
35616
- getFormulaCellContent(sheetId, compiledFormula, dependencies) {
35616
+ getFormulaCellContent(sheetId, compiledFormula, dependencies, useFixedReference = false) {
35617
35617
  const ranges = dependencies || compiledFormula.dependencies;
35618
35618
  let rangeIndex = 0;
35619
35619
  return concat(compiledFormula.tokens.map((token) => {
35620
35620
  if (token.type === "REFERENCE") {
35621
35621
  const range = ranges[rangeIndex++];
35622
- return this.getters.getRangeString(range, sheetId);
35622
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
35623
35623
  }
35624
35624
  return token.value;
35625
35625
  }));
@@ -35888,6 +35888,18 @@ class FormulaCellWithDependencies {
35888
35888
  get content() {
35889
35889
  return concat(this.compiledFormula.tokens.map((token) => token.value));
35890
35890
  }
35891
+ get contentWithFixedReferences() {
35892
+ let rangeIndex = 0;
35893
+ return concat(this.compiledFormula.tokens.map((token) => {
35894
+ if (token.type === "REFERENCE") {
35895
+ const index = rangeIndex++;
35896
+ return this.getRangeString(this.compiledFormula.dependencies[index], this.sheetId, {
35897
+ useFixedReference: true,
35898
+ });
35899
+ }
35900
+ return token.value;
35901
+ }));
35902
+ }
35891
35903
  }
35892
35904
  class RangeReferenceToken {
35893
35905
  getValue;
@@ -36192,7 +36204,13 @@ class ConditionalFormatPlugin extends CorePlugin {
36192
36204
  }
36193
36205
  }
36194
36206
  exportForExcel(data) {
36195
- this.export(data);
36207
+ if (data.sheets) {
36208
+ for (let sheet of data.sheets) {
36209
+ if (this.cfRules[sheet.id]) {
36210
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
36211
+ }
36212
+ }
36213
+ }
36196
36214
  }
36197
36215
  // ---------------------------------------------------------------------------
36198
36216
  // Getters
@@ -36257,11 +36275,11 @@ class ConditionalFormatPlugin extends CorePlugin {
36257
36275
  // ---------------------------------------------------------------------------
36258
36276
  // Private
36259
36277
  // ---------------------------------------------------------------------------
36260
- mapToConditionalFormat(sheetId, cf) {
36278
+ mapToConditionalFormat(sheetId, cf, { useFixedReference } = { useFixedReference: false }) {
36261
36279
  return {
36262
36280
  ...cf,
36263
36281
  ranges: cf.ranges.map((range) => {
36264
- return this.getters.getRangeString(range, sheetId);
36282
+ return this.getters.getRangeString(range, sheetId, { useFixedReference });
36265
36283
  }),
36266
36284
  };
36267
36285
  }
@@ -38329,8 +38347,10 @@ class RangeAdapter {
38329
38347
  *
38330
38348
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
38331
38349
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
38350
+ * @param options
38351
+ * @param options.useFixedReference if true, the range will be returned with fixed row and column
38332
38352
  */
38333
- getRangeString(range, forSheetId) {
38353
+ getRangeString(range, forSheetId, options = { useFixedReference: false }) {
38334
38354
  if (!range) {
38335
38355
  return INCORRECT_RANGE_STRING;
38336
38356
  }
@@ -38357,7 +38377,7 @@ class RangeAdapter {
38357
38377
  if (prefixSheet && !sheetName) {
38358
38378
  return INCORRECT_RANGE_STRING;
38359
38379
  }
38360
- let rangeString = this.getRangePartString(rangeImpl, 0);
38380
+ let rangeString = this.getRangePartString(rangeImpl, 0, options);
38361
38381
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
38362
38382
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
38363
38383
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -38367,7 +38387,7 @@ class RangeAdapter {
38367
38387
  rangeImpl.parts[1].rowFixed ||
38368
38388
  rangeImpl.parts[1].colFixed) {
38369
38389
  rangeString += ":";
38370
- rangeString += this.getRangePartString(rangeImpl, 1);
38390
+ rangeString += this.getRangePartString(rangeImpl, 1, options);
38371
38391
  }
38372
38392
  }
38373
38393
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -38408,13 +38428,13 @@ class RangeAdapter {
38408
38428
  /**
38409
38429
  * Get a Xc string that represent a part of a range
38410
38430
  */
38411
- getRangePartString(range, part) {
38431
+ getRangePartString(range, part, options = { useFixedReference: false }) {
38412
38432
  const colFixed = range.parts && range.parts[part]?.colFixed ? "$" : "";
38413
38433
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
38414
38434
  const rowFixed = range.parts && range.parts[part]?.rowFixed ? "$" : "";
38415
38435
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
38416
38436
  let str = "";
38417
- if (range.isFullCol) {
38437
+ if (range.isFullCol && !options.useFixedReference) {
38418
38438
  if (part === 0 && range.unboundedZone.hasHeader) {
38419
38439
  str = colFixed + col + rowFixed + row;
38420
38440
  }
@@ -38422,7 +38442,7 @@ class RangeAdapter {
38422
38442
  str = colFixed + col;
38423
38443
  }
38424
38444
  }
38425
- else if (range.isFullRow) {
38445
+ else if (range.isFullRow && !options.useFixedReference) {
38426
38446
  if (part === 0 && range.unboundedZone.hasHeader) {
38427
38447
  str = colFixed + col + rowFixed + row;
38428
38448
  }
@@ -54949,12 +54969,7 @@ function addFormula(cell) {
54949
54969
  attrs.push(["t", "str"]);
54950
54970
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
54951
54971
  }
54952
- node = escapeXml /*xml*/ `
54953
- <f>
54954
- ${XlsxFormula}
54955
- </f>
54956
- ${cycle}
54957
- `;
54972
+ node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
54958
54973
  return { attrs, node };
54959
54974
  }
54960
54975
  function addContent(content, sharedStrings, forceString = false) {
@@ -55773,11 +55788,10 @@ function addRows(construct, data, sheet) {
55773
55788
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
55774
55789
  }
55775
55790
  attributes.push(...additionalAttrs);
55776
- cellNodes.push(escapeXml /*xml*/ `
55777
- <c ${formatAttributes(attributes)}>
55778
- ${cellNode}
55779
- </c>
55780
- `);
55791
+ // prettier-ignore
55792
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
55793
+ ${cellNode}
55794
+ </c>`);
55781
55795
  }
55782
55796
  }
55783
55797
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -56373,7 +56387,6 @@ class Model extends EventBus {
56373
56387
  ...config,
56374
56388
  mode: config.mode || "normal",
56375
56389
  custom: config.custom || {},
56376
- defaultCurrencyFormat: config.defaultCurrencyFormat || "[$$]#,##0.00",
56377
56390
  external: this.setupExternalConfig(config.external || {}),
56378
56391
  transportService,
56379
56392
  client,
@@ -56411,6 +56424,7 @@ class Model extends EventBus {
56411
56424
  custom: this.config.custom,
56412
56425
  uiActions: this.config,
56413
56426
  session: this.session,
56427
+ defaultCurrencyFormat: this.config.defaultCurrencyFormat,
56414
56428
  };
56415
56429
  }
56416
56430
  // ---------------------------------------------------------------------------
@@ -56748,6 +56762,6 @@ const constants = {
56748
56762
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
56749
56763
 
56750
56764
 
56751
- __info__.version = "17.0.9";
56752
- __info__.date = "2024-01-29T13:53:22.963Z";
56753
- __info__.hash = "3c1209a";
56765
+ __info__.version = "17.0.10";
56766
+ __info__.date = "2024-02-02T13:48:28.727Z";
56767
+ __info__.hash = "be06aa9";