@odoo/o-spreadsheet 17.4.10 → 17.4.11

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.4.10
6
- * @date 2024-10-24T08:54:56.262Z
7
- * @hash c82d9c1
5
+ * @version 17.4.11
6
+ * @date 2024-11-08T12:15:26.239Z
7
+ * @hash 2eb3f1c
8
8
  */
9
9
 
10
10
  'use strict';
@@ -7627,7 +7627,10 @@ function parseOperand(tokens) {
7627
7627
  case "STRING":
7628
7628
  return { type: "STRING", value: removeStringQuotes(current.value) };
7629
7629
  case "INVALID_REFERENCE":
7630
- throw new InvalidReferenceError();
7630
+ return {
7631
+ type: "REFERENCE",
7632
+ value: CellErrorType.InvalidReference,
7633
+ };
7631
7634
  case "REFERENCE":
7632
7635
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
7633
7636
  tokens.shift();
@@ -8431,6 +8434,7 @@ const ChartTerms = {
8431
8434
  StackedBarChart: _t("Stacked bar chart"),
8432
8435
  StackedLineChart: _t("Stacked line chart"),
8433
8436
  StackedAreaChart: _t("Stacked area chart"),
8437
+ StackedColumnChart: _t("Stacked column chart"),
8434
8438
  CumulativeData: _t("Cumulative data"),
8435
8439
  TreatLabelsAsText: _t("Treat labels as text"),
8436
8440
  AggregatedChart: _t("Aggregate"),
@@ -10714,6 +10718,10 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
10714
10718
  function drawPieChartValues(chart, options, ctx) {
10715
10719
  for (const dataset of chart._metasets) {
10716
10720
  for (let i = 0; i < dataset._parsed.length; i++) {
10721
+ const value = Number(dataset._parsed[i]);
10722
+ if (isNaN(value) || value === 0) {
10723
+ continue;
10724
+ }
10717
10725
  const bar = dataset.data[i];
10718
10726
  const { startAngle, endAngle, innerRadius, outerRadius } = bar;
10719
10727
  const midAngle = (startAngle + endAngle) / 2;
@@ -10722,8 +10730,8 @@ function drawPieChartValues(chart, options, ctx) {
10722
10730
  const y = bar.y + midRadius * Math.sin(midAngle) + 7;
10723
10731
  ctx.fillStyle = chartFontColor(options.background);
10724
10732
  ctx.strokeStyle = options.background || "#ffffff";
10725
- const value = options.callback(dataset._parsed[i]);
10726
- drawTextWithBackground(value, x, y, ctx);
10733
+ const displayValue = options.callback(value);
10734
+ drawTextWithBackground(displayValue, x, y, ctx);
10727
10735
  }
10728
10736
  }
10729
10737
  }
@@ -31627,6 +31635,12 @@ class GenericChartConfigPanel extends owl.Component {
31627
31635
 
31628
31636
  class BarConfigPanel extends GenericChartConfigPanel {
31629
31637
  static template = "o-spreadsheet-BarConfigPanel";
31638
+ get stackedLabel() {
31639
+ const definition = this.props.definition;
31640
+ return definition.horizontal
31641
+ ? this.chartTerms.StackedBarChart
31642
+ : this.chartTerms.StackedColumnChart;
31643
+ }
31630
31644
  onUpdateStacked(stacked) {
31631
31645
  this.props.updateChart(this.props.figureId, {
31632
31646
  stacked,
@@ -32795,7 +32809,9 @@ class LineConfigPanel extends GenericChartConfigPanel {
32795
32809
  }
32796
32810
  get stackedLabel() {
32797
32811
  const definition = this.props.definition;
32798
- return definition.fillArea ? this.chartTerms.StackedAreaChart : this.chartTerms.StackedBarChart;
32812
+ return definition.fillArea
32813
+ ? this.chartTerms.StackedAreaChart
32814
+ : this.chartTerms.StackedLineChart;
32799
32815
  }
32800
32816
  getLabelRangeOptions() {
32801
32817
  const options = super.getLabelRangeOptions();
@@ -56023,6 +56039,10 @@ class PivotUIPlugin extends UIPlugin {
56023
56039
  if (!pivot.isValid()) {
56024
56040
  return EMPTY_PIVOT_CELL;
56025
56041
  }
56042
+ if (functionName === "PIVOT" &&
56043
+ !cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
56044
+ return EMPTY_PIVOT_CELL;
56045
+ }
56026
56046
  if (functionName === "PIVOT") {
56027
56047
  const includeTotal = args[2] === false ? false : undefined;
56028
56048
  const includeColumnHeaders = args[3] === false ? false : undefined;
@@ -66614,7 +66634,8 @@ function addFormula(cell) {
66614
66634
  }
66615
66635
  const attrs = [["t", type]];
66616
66636
  const XlsxFormula = adaptFormulaToExcel(formula);
66617
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
66637
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
66638
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
66618
66639
  return { attrs, node };
66619
66640
  }
66620
66641
  function addContent(content, sharedStrings, forceString = false) {
@@ -66649,8 +66670,14 @@ function adaptFormulaToExcel(formulaText) {
66649
66670
  ast = addMissingRequiredArgs(ast);
66650
66671
  return ast;
66651
66672
  });
66673
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
66674
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
66675
+ });
66652
66676
  return ast ? astToFormula(ast) : formulaText;
66653
66677
  }
66678
+ function adaptFormulaValueToExcel(formulaValue) {
66679
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
66680
+ }
66654
66681
  /**
66655
66682
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
66656
66683
  * This adds those missing args.
@@ -68651,6 +68678,6 @@ exports.tokenColors = tokenColors;
68651
68678
  exports.tokenize = tokenize;
68652
68679
 
68653
68680
 
68654
- __info__.version = "17.4.10";
68655
- __info__.date = "2024-10-24T08:54:56.262Z";
68656
- __info__.hash = "c82d9c1";
68681
+ __info__.version = "17.4.11";
68682
+ __info__.date = "2024-11-08T12:15:26.239Z";
68683
+ __info__.hash = "2eb3f1c";
@@ -6714,6 +6714,7 @@ declare class GenericChartConfigPanel extends Component<Props$W, SpreadsheetChil
6714
6714
  StackedBarChart: string;
6715
6715
  StackedLineChart: string;
6716
6716
  StackedAreaChart: string;
6717
+ StackedColumnChart: string;
6717
6718
  CumulativeData: string;
6718
6719
  TreatLabelsAsText: string;
6719
6720
  AggregatedChart: string;
@@ -6766,6 +6767,7 @@ declare class GenericChartConfigPanel extends Component<Props$W, SpreadsheetChil
6766
6767
 
6767
6768
  declare class BarConfigPanel extends GenericChartConfigPanel {
6768
6769
  static template: string;
6770
+ get stackedLabel(): string;
6769
6771
  onUpdateStacked(stacked: boolean): void;
6770
6772
  onUpdateAggregated(aggregated: boolean): void;
6771
6773
  }
@@ -11615,6 +11617,7 @@ declare const constants: {
11615
11617
  StackedBarChart: string;
11616
11618
  StackedLineChart: string;
11617
11619
  StackedAreaChart: string;
11620
+ StackedColumnChart: string;
11618
11621
  CumulativeData: string;
11619
11622
  TreatLabelsAsText: string;
11620
11623
  AggregatedChart: string;
@@ -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.4.10
6
- * @date 2024-10-24T08:54:56.262Z
7
- * @hash c82d9c1
5
+ * @version 17.4.11
6
+ * @date 2024-11-08T12:15:26.239Z
7
+ * @hash 2eb3f1c
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -7625,7 +7625,10 @@ function parseOperand(tokens) {
7625
7625
  case "STRING":
7626
7626
  return { type: "STRING", value: removeStringQuotes(current.value) };
7627
7627
  case "INVALID_REFERENCE":
7628
- throw new InvalidReferenceError();
7628
+ return {
7629
+ type: "REFERENCE",
7630
+ value: CellErrorType.InvalidReference,
7631
+ };
7629
7632
  case "REFERENCE":
7630
7633
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
7631
7634
  tokens.shift();
@@ -8429,6 +8432,7 @@ const ChartTerms = {
8429
8432
  StackedBarChart: _t("Stacked bar chart"),
8430
8433
  StackedLineChart: _t("Stacked line chart"),
8431
8434
  StackedAreaChart: _t("Stacked area chart"),
8435
+ StackedColumnChart: _t("Stacked column chart"),
8432
8436
  CumulativeData: _t("Cumulative data"),
8433
8437
  TreatLabelsAsText: _t("Treat labels as text"),
8434
8438
  AggregatedChart: _t("Aggregate"),
@@ -10712,6 +10716,10 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
10712
10716
  function drawPieChartValues(chart, options, ctx) {
10713
10717
  for (const dataset of chart._metasets) {
10714
10718
  for (let i = 0; i < dataset._parsed.length; i++) {
10719
+ const value = Number(dataset._parsed[i]);
10720
+ if (isNaN(value) || value === 0) {
10721
+ continue;
10722
+ }
10715
10723
  const bar = dataset.data[i];
10716
10724
  const { startAngle, endAngle, innerRadius, outerRadius } = bar;
10717
10725
  const midAngle = (startAngle + endAngle) / 2;
@@ -10720,8 +10728,8 @@ function drawPieChartValues(chart, options, ctx) {
10720
10728
  const y = bar.y + midRadius * Math.sin(midAngle) + 7;
10721
10729
  ctx.fillStyle = chartFontColor(options.background);
10722
10730
  ctx.strokeStyle = options.background || "#ffffff";
10723
- const value = options.callback(dataset._parsed[i]);
10724
- drawTextWithBackground(value, x, y, ctx);
10731
+ const displayValue = options.callback(value);
10732
+ drawTextWithBackground(displayValue, x, y, ctx);
10725
10733
  }
10726
10734
  }
10727
10735
  }
@@ -31625,6 +31633,12 @@ class GenericChartConfigPanel extends Component {
31625
31633
 
31626
31634
  class BarConfigPanel extends GenericChartConfigPanel {
31627
31635
  static template = "o-spreadsheet-BarConfigPanel";
31636
+ get stackedLabel() {
31637
+ const definition = this.props.definition;
31638
+ return definition.horizontal
31639
+ ? this.chartTerms.StackedBarChart
31640
+ : this.chartTerms.StackedColumnChart;
31641
+ }
31628
31642
  onUpdateStacked(stacked) {
31629
31643
  this.props.updateChart(this.props.figureId, {
31630
31644
  stacked,
@@ -32793,7 +32807,9 @@ class LineConfigPanel extends GenericChartConfigPanel {
32793
32807
  }
32794
32808
  get stackedLabel() {
32795
32809
  const definition = this.props.definition;
32796
- return definition.fillArea ? this.chartTerms.StackedAreaChart : this.chartTerms.StackedBarChart;
32810
+ return definition.fillArea
32811
+ ? this.chartTerms.StackedAreaChart
32812
+ : this.chartTerms.StackedLineChart;
32797
32813
  }
32798
32814
  getLabelRangeOptions() {
32799
32815
  const options = super.getLabelRangeOptions();
@@ -56021,6 +56037,10 @@ class PivotUIPlugin extends UIPlugin {
56021
56037
  if (!pivot.isValid()) {
56022
56038
  return EMPTY_PIVOT_CELL;
56023
56039
  }
56040
+ if (functionName === "PIVOT" &&
56041
+ !cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
56042
+ return EMPTY_PIVOT_CELL;
56043
+ }
56024
56044
  if (functionName === "PIVOT") {
56025
56045
  const includeTotal = args[2] === false ? false : undefined;
56026
56046
  const includeColumnHeaders = args[3] === false ? false : undefined;
@@ -66612,7 +66632,8 @@ function addFormula(cell) {
66612
66632
  }
66613
66633
  const attrs = [["t", type]];
66614
66634
  const XlsxFormula = adaptFormulaToExcel(formula);
66615
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
66635
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
66636
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
66616
66637
  return { attrs, node };
66617
66638
  }
66618
66639
  function addContent(content, sharedStrings, forceString = false) {
@@ -66647,8 +66668,14 @@ function adaptFormulaToExcel(formulaText) {
66647
66668
  ast = addMissingRequiredArgs(ast);
66648
66669
  return ast;
66649
66670
  });
66671
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
66672
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
66673
+ });
66650
66674
  return ast ? astToFormula(ast) : formulaText;
66651
66675
  }
66676
+ function adaptFormulaValueToExcel(formulaValue) {
66677
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
66678
+ }
66652
66679
  /**
66653
66680
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
66654
66681
  * This adds those missing args.
@@ -68606,6 +68633,6 @@ const constants = {
68606
68633
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
68607
68634
 
68608
68635
 
68609
- __info__.version = "17.4.10";
68610
- __info__.date = "2024-10-24T08:54:56.262Z";
68611
- __info__.hash = "c82d9c1";
68636
+ __info__.version = "17.4.11";
68637
+ __info__.date = "2024-11-08T12:15:26.239Z";
68638
+ __info__.hash = "2eb3f1c";
@@ -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.4.10
6
- * @date 2024-10-24T08:54:56.262Z
7
- * @hash c82d9c1
5
+ * @version 17.4.11
6
+ * @date 2024-11-08T12:15:26.239Z
7
+ * @hash 2eb3f1c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -7626,7 +7626,10 @@
7626
7626
  case "STRING":
7627
7627
  return { type: "STRING", value: removeStringQuotes(current.value) };
7628
7628
  case "INVALID_REFERENCE":
7629
- throw new InvalidReferenceError();
7629
+ return {
7630
+ type: "REFERENCE",
7631
+ value: CellErrorType.InvalidReference,
7632
+ };
7630
7633
  case "REFERENCE":
7631
7634
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
7632
7635
  tokens.shift();
@@ -8430,6 +8433,7 @@
8430
8433
  StackedBarChart: _t("Stacked bar chart"),
8431
8434
  StackedLineChart: _t("Stacked line chart"),
8432
8435
  StackedAreaChart: _t("Stacked area chart"),
8436
+ StackedColumnChart: _t("Stacked column chart"),
8433
8437
  CumulativeData: _t("Cumulative data"),
8434
8438
  TreatLabelsAsText: _t("Treat labels as text"),
8435
8439
  AggregatedChart: _t("Aggregate"),
@@ -10713,6 +10717,10 @@ stores.inject(MyMetaStore, storeInstance);
10713
10717
  function drawPieChartValues(chart, options, ctx) {
10714
10718
  for (const dataset of chart._metasets) {
10715
10719
  for (let i = 0; i < dataset._parsed.length; i++) {
10720
+ const value = Number(dataset._parsed[i]);
10721
+ if (isNaN(value) || value === 0) {
10722
+ continue;
10723
+ }
10716
10724
  const bar = dataset.data[i];
10717
10725
  const { startAngle, endAngle, innerRadius, outerRadius } = bar;
10718
10726
  const midAngle = (startAngle + endAngle) / 2;
@@ -10721,8 +10729,8 @@ stores.inject(MyMetaStore, storeInstance);
10721
10729
  const y = bar.y + midRadius * Math.sin(midAngle) + 7;
10722
10730
  ctx.fillStyle = chartFontColor(options.background);
10723
10731
  ctx.strokeStyle = options.background || "#ffffff";
10724
- const value = options.callback(dataset._parsed[i]);
10725
- drawTextWithBackground(value, x, y, ctx);
10732
+ const displayValue = options.callback(value);
10733
+ drawTextWithBackground(displayValue, x, y, ctx);
10726
10734
  }
10727
10735
  }
10728
10736
  }
@@ -31626,6 +31634,12 @@ stores.inject(MyMetaStore, storeInstance);
31626
31634
 
31627
31635
  class BarConfigPanel extends GenericChartConfigPanel {
31628
31636
  static template = "o-spreadsheet-BarConfigPanel";
31637
+ get stackedLabel() {
31638
+ const definition = this.props.definition;
31639
+ return definition.horizontal
31640
+ ? this.chartTerms.StackedBarChart
31641
+ : this.chartTerms.StackedColumnChart;
31642
+ }
31629
31643
  onUpdateStacked(stacked) {
31630
31644
  this.props.updateChart(this.props.figureId, {
31631
31645
  stacked,
@@ -32794,7 +32808,9 @@ stores.inject(MyMetaStore, storeInstance);
32794
32808
  }
32795
32809
  get stackedLabel() {
32796
32810
  const definition = this.props.definition;
32797
- return definition.fillArea ? this.chartTerms.StackedAreaChart : this.chartTerms.StackedBarChart;
32811
+ return definition.fillArea
32812
+ ? this.chartTerms.StackedAreaChart
32813
+ : this.chartTerms.StackedLineChart;
32798
32814
  }
32799
32815
  getLabelRangeOptions() {
32800
32816
  const options = super.getLabelRangeOptions();
@@ -56022,6 +56038,10 @@ stores.inject(MyMetaStore, storeInstance);
56022
56038
  if (!pivot.isValid()) {
56023
56039
  return EMPTY_PIVOT_CELL;
56024
56040
  }
56041
+ if (functionName === "PIVOT" &&
56042
+ !cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
56043
+ return EMPTY_PIVOT_CELL;
56044
+ }
56025
56045
  if (functionName === "PIVOT") {
56026
56046
  const includeTotal = args[2] === false ? false : undefined;
56027
56047
  const includeColumnHeaders = args[3] === false ? false : undefined;
@@ -66613,7 +66633,8 @@ stores.inject(MyMetaStore, storeInstance);
66613
66633
  }
66614
66634
  const attrs = [["t", type]];
66615
66635
  const XlsxFormula = adaptFormulaToExcel(formula);
66616
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
66636
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
66637
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
66617
66638
  return { attrs, node };
66618
66639
  }
66619
66640
  function addContent(content, sharedStrings, forceString = false) {
@@ -66648,8 +66669,14 @@ stores.inject(MyMetaStore, storeInstance);
66648
66669
  ast = addMissingRequiredArgs(ast);
66649
66670
  return ast;
66650
66671
  });
66672
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
66673
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
66674
+ });
66651
66675
  return ast ? astToFormula(ast) : formulaText;
66652
66676
  }
66677
+ function adaptFormulaValueToExcel(formulaValue) {
66678
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
66679
+ }
66653
66680
  /**
66654
66681
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
66655
66682
  * This adds those missing args.
@@ -68650,9 +68677,9 @@ stores.inject(MyMetaStore, storeInstance);
68650
68677
  exports.tokenize = tokenize;
68651
68678
 
68652
68679
 
68653
- __info__.version = "17.4.10";
68654
- __info__.date = "2024-10-24T08:54:56.262Z";
68655
- __info__.hash = "c82d9c1";
68680
+ __info__.version = "17.4.11";
68681
+ __info__.date = "2024-11-08T12:15:26.239Z";
68682
+ __info__.hash = "2eb3f1c";
68656
68683
 
68657
68684
 
68658
68685
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);