@odoo/o-spreadsheet 18.0.2 → 18.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.2
6
- * @date 2024-10-24T08:54:21.934Z
7
- * @hash 788df92
5
+ * @version 18.0.4
6
+ * @date 2024-11-13T15:08:50.620Z
7
+ * @hash 88e1aee
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';
@@ -9320,38 +9320,40 @@ function getFullTrendingLineDataSet(dataset, config, data) {
9320
9320
  const defaultBorderColor = colorToRGBA(dataset.backgroundColor);
9321
9321
  defaultBorderColor.a = 1;
9322
9322
  const borderColor = config.color || lightenColor(rgbaToHex(defaultBorderColor), 0.5);
9323
- const backgroundRGBA = colorToRGBA(borderColor);
9324
- // @ts-expect-error
9325
- if (dataset?.fill) {
9326
- backgroundRGBA.a = LINE_FILL_TRANSPARENCY; // to support area charts
9327
- }
9328
9323
  return {
9329
- ...dataset,
9330
9324
  type: "line",
9331
9325
  xAxisID: TREND_LINE_XAXIS_ID,
9326
+ yAxisID: dataset.yAxisID,
9332
9327
  label: dataset.label ? _t("Trend line for %s", dataset.label) : "",
9333
9328
  data,
9334
9329
  order: -1,
9335
9330
  showLine: true,
9336
9331
  pointRadius: 0,
9337
- backgroundColor: rgbaToHex(backgroundRGBA),
9332
+ backgroundColor: borderColor,
9338
9333
  borderColor,
9339
9334
  borderDash: [5, 5],
9340
9335
  borderWidth: undefined,
9336
+ fill: false,
9337
+ pointBackgroundColor: borderColor,
9341
9338
  };
9342
9339
  }
9343
9340
  function interpolateData(config, values, labels, newLabels) {
9344
9341
  if (values.length < 2 || labels.length < 2 || newLabels.length === 0) {
9345
9342
  return [];
9346
9343
  }
9344
+ const labelMin = Math.min(...labels);
9345
+ const labelMax = Math.max(...labels);
9346
+ const labelRange = labelMax - labelMin;
9347
+ const normalizedLabels = labels.map((v) => (v - labelMin) / labelRange);
9348
+ const normalizedNewLabels = newLabels.map((v) => (v - labelMin) / labelRange);
9347
9349
  switch (config.type) {
9348
9350
  case "polynomial": {
9349
9351
  const order = config.order ?? 2;
9350
9352
  if (order === 1) {
9351
- return predictLinearValues([values], [labels], [newLabels], true)[0];
9353
+ return predictLinearValues([values], [normalizedLabels], [normalizedNewLabels], true)[0];
9352
9354
  }
9353
- const coeffs = polynomialRegression(values, labels, order, true).flat();
9354
- return newLabels.map((v) => evaluatePolynomial(coeffs, v, order));
9355
+ const coeffs = polynomialRegression(values, normalizedLabels, order, true).flat();
9356
+ return normalizedNewLabels.map((v) => evaluatePolynomial(coeffs, v, order));
9355
9357
  }
9356
9358
  case "exponential": {
9357
9359
  const positiveLogValues = [];
@@ -9359,16 +9361,16 @@ function interpolateData(config, values, labels, newLabels) {
9359
9361
  for (let i = 0; i < values.length; i++) {
9360
9362
  if (values[i] > 0) {
9361
9363
  positiveLogValues.push(Math.log(values[i]));
9362
- filteredLabels.push(labels[i]);
9364
+ filteredLabels.push(normalizedLabels[i]);
9363
9365
  }
9364
9366
  }
9365
9367
  if (!filteredLabels.length) {
9366
9368
  return [];
9367
9369
  }
9368
- return expM(predictLinearValues([positiveLogValues], [filteredLabels], [newLabels], true))[0];
9370
+ return expM(predictLinearValues([positiveLogValues], [filteredLabels], [normalizedNewLabels], true))[0];
9369
9371
  }
9370
9372
  case "logarithmic": {
9371
- return predictLinearValues([values], logM([labels]), logM([newLabels]), true)[0];
9373
+ return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
9372
9374
  }
9373
9375
  default:
9374
9376
  return [];
@@ -9504,6 +9506,10 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
9504
9506
  function drawPieChartValues(chart, options, ctx) {
9505
9507
  for (const dataset of chart._metasets) {
9506
9508
  for (let i = 0; i < dataset._parsed.length; i++) {
9509
+ const value = Number(dataset._parsed[i]);
9510
+ if (isNaN(value) || value === 0) {
9511
+ continue;
9512
+ }
9507
9513
  const bar = dataset.data[i];
9508
9514
  const { startAngle, endAngle, innerRadius, outerRadius } = bar;
9509
9515
  const midAngle = (startAngle + endAngle) / 2;
@@ -9512,8 +9518,8 @@ function drawPieChartValues(chart, options, ctx) {
9512
9518
  const y = bar.y + midRadius * Math.sin(midAngle) + 7;
9513
9519
  ctx.fillStyle = chartFontColor(options.background);
9514
9520
  ctx.strokeStyle = options.background || "#ffffff";
9515
- const value = options.callback(dataset._parsed[i]);
9516
- drawTextWithBackground(value, x, y, ctx);
9521
+ const displayValue = options.callback(value);
9522
+ drawTextWithBackground(displayValue, x, y, ctx);
9517
9523
  }
9518
9524
  }
9519
9525
  }
@@ -14592,7 +14598,7 @@ const FILTER = {
14592
14598
  const result = [];
14593
14599
  for (let i = 0; i < _array.length; i++) {
14594
14600
  const row = _array[i];
14595
- if (_conditions.every((c) => c[i])) {
14601
+ if (_conditions.every((c) => (typeof c[i] === "boolean" || typeof c[i] === "number") && c[i])) {
14596
14602
  result.push(row);
14597
14603
  }
14598
14604
  }
@@ -16987,7 +16993,10 @@ function parseOperand(tokens) {
16987
16993
  case "STRING":
16988
16994
  return { type: "STRING", value: removeStringQuotes(current.value) };
16989
16995
  case "INVALID_REFERENCE":
16990
- throw new InvalidReferenceError();
16996
+ return {
16997
+ type: "REFERENCE",
16998
+ value: CellErrorType.InvalidReference,
16999
+ };
16991
17000
  case "REFERENCE":
16992
17001
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
16993
17002
  tokens.shift();
@@ -27871,6 +27880,7 @@ const ChartTerms = {
27871
27880
  StackedBarChart: _t("Stacked bar chart"),
27872
27881
  StackedLineChart: _t("Stacked line chart"),
27873
27882
  StackedAreaChart: _t("Stacked area chart"),
27883
+ StackedColumnChart: _t("Stacked column chart"),
27874
27884
  CumulativeData: _t("Cumulative data"),
27875
27885
  TreatLabelsAsText: _t("Treat labels as text"),
27876
27886
  AggregatedChart: _t("Aggregate"),
@@ -28157,11 +28167,14 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
28157
28167
  function getChartLabelFormat(getters, range) {
28158
28168
  if (!range)
28159
28169
  return undefined;
28160
- return getters.getEvaluatedCell({
28161
- sheetId: range.sheetId,
28162
- col: range.zone.left,
28163
- row: range.zone.top,
28164
- }).format;
28170
+ const { sheetId, zone: { left, top, bottom }, } = range;
28171
+ for (let row = top; row <= bottom; row++) {
28172
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
28173
+ if (format) {
28174
+ return format;
28175
+ }
28176
+ }
28177
+ return undefined;
28165
28178
  }
28166
28179
  function getChartLabelValues(getters, dataSets, labelRange) {
28167
28180
  let labels = { values: [], formattedValues: [] };
@@ -28742,11 +28755,7 @@ function canBeDateChart(labelRange, getters) {
28742
28755
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
28743
28756
  return false;
28744
28757
  }
28745
- const labelFormat = getters.getEvaluatedCell({
28746
- sheetId: labelRange.sheetId,
28747
- col: labelRange.zone.left,
28748
- row: labelRange.zone.top,
28749
- }).format;
28758
+ const labelFormat = getChartLabelFormat(getters, labelRange);
28750
28759
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
28751
28760
  }
28752
28761
  function canBeLinearChart(labelRange, getters) {
@@ -28809,8 +28818,8 @@ function getTrendDatasetForLineChart(config, dataset, axisType, locale) {
28809
28818
  break;
28810
28819
  case "time":
28811
28820
  for (const point of dataset.data) {
28812
- const date = toJsDate({ value: point.x }, locale).getTime();
28813
- if (typeof point.y === "number") {
28821
+ const date = toNumber({ value: point.x }, locale);
28822
+ if (point.y !== null) {
28814
28823
  filteredValues.push(point.y);
28815
28824
  filteredLabels.push(date);
28816
28825
  }
@@ -29042,10 +29051,6 @@ function createLineOrScatterChartRuntime(chart, getters) {
29042
29051
  return {
29043
29052
  chartJsConfig: config,
29044
29053
  background: chart.background || BACKGROUND_CHART_COLOR,
29045
- dataSetsValues,
29046
- labelValues,
29047
- dataSetFormat,
29048
- labelFormat,
29049
29054
  };
29050
29055
  }
29051
29056
 
@@ -36280,6 +36285,12 @@ class GenericChartConfigPanel extends Component {
36280
36285
 
36281
36286
  class BarConfigPanel extends GenericChartConfigPanel {
36282
36287
  static template = "o-spreadsheet-BarConfigPanel";
36288
+ get stackedLabel() {
36289
+ const definition = this.props.definition;
36290
+ return definition.horizontal
36291
+ ? this.chartTerms.StackedBarChart
36292
+ : this.chartTerms.StackedColumnChart;
36293
+ }
36283
36294
  onUpdateStacked(stacked) {
36284
36295
  this.props.updateChart(this.props.figureId, {
36285
36296
  stacked,
@@ -36714,6 +36725,7 @@ class ColorPicker extends Component {
36714
36725
  currentColor: { type: String, optional: true },
36715
36726
  maxHeight: { type: Number, optional: true },
36716
36727
  anchorRect: Object,
36728
+ disableNoColor: { type: Boolean, optional: true },
36717
36729
  };
36718
36730
  static defaultProps = { currentColor: "" };
36719
36731
  static components = { Popover };
@@ -36940,6 +36952,7 @@ class RoundColorPicker extends Component {
36940
36952
  currentColor: { type: String, optional: true },
36941
36953
  title: { type: String, optional: true },
36942
36954
  onColorPicked: Function,
36955
+ disableNoColor: { type: Boolean, optional: true },
36943
36956
  };
36944
36957
  colorPickerButtonRef = useRef("colorPickerButton");
36945
36958
  state;
@@ -37602,7 +37615,9 @@ class LineConfigPanel extends GenericChartConfigPanel {
37602
37615
  }
37603
37616
  get stackedLabel() {
37604
37617
  const definition = this.props.definition;
37605
- return definition.fillArea ? this.chartTerms.StackedAreaChart : this.chartTerms.StackedBarChart;
37618
+ return definition.fillArea
37619
+ ? this.chartTerms.StackedAreaChart
37620
+ : this.chartTerms.StackedLineChart;
37606
37621
  }
37607
37622
  getLabelRangeOptions() {
37608
37623
  const options = super.getLabelRangeOptions();
@@ -39716,6 +39731,9 @@ class ConditionalFormattingEditor extends Component {
39716
39731
  }
39717
39732
  }
39718
39733
  setColorScaleColor(target, color) {
39734
+ if (!isColorValid(color)) {
39735
+ return;
39736
+ }
39719
39737
  const point = this.state.rules.colorScale[target];
39720
39738
  if (point) {
39721
39739
  point.color = Number.parseInt(color.substr(1), 16);
@@ -59616,6 +59634,10 @@ class PivotUIPlugin extends UIPlugin {
59616
59634
  if (!pivot.isValid()) {
59617
59635
  return EMPTY_PIVOT_CELL;
59618
59636
  }
59637
+ if (functionName === "PIVOT" &&
59638
+ !cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
59639
+ return EMPTY_PIVOT_CELL;
59640
+ }
59619
59641
  if (functionName === "PIVOT") {
59620
59642
  const includeTotal = args[2] === false ? false : undefined;
59621
59643
  const includeColumnHeaders = args[3] === false ? false : undefined;
@@ -70389,7 +70411,8 @@ function addFormula(cell) {
70389
70411
  }
70390
70412
  const attrs = [["t", type]];
70391
70413
  const XlsxFormula = adaptFormulaToExcel(formula);
70392
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
70414
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
70415
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
70393
70416
  return { attrs, node };
70394
70417
  }
70395
70418
  function addContent(content, sharedStrings, forceString = false) {
@@ -70424,8 +70447,14 @@ function adaptFormulaToExcel(formulaText) {
70424
70447
  ast = addMissingRequiredArgs(ast);
70425
70448
  return ast;
70426
70449
  });
70450
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
70451
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
70452
+ });
70427
70453
  return ast ? astToFormula(ast) : formulaText;
70428
70454
  }
70455
+ function adaptFormulaValueToExcel(formulaValue) {
70456
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
70457
+ }
70429
70458
  /**
70430
70459
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
70431
70460
  * This adds those missing args.
@@ -72400,11 +72429,12 @@ const constants = {
72400
72429
  PIVOT_TABLE_CONFIG,
72401
72430
  TREND_LINE_XAXIS_ID,
72402
72431
  CHART_AXIS_CHOICES,
72432
+ ChartTerms,
72403
72433
  };
72404
72434
 
72405
72435
  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 };
72406
72436
 
72407
72437
 
72408
- __info__.version = "18.0.2";
72409
- __info__.date = "2024-10-24T08:54:21.934Z";
72410
- __info__.hash = "788df92";
72438
+ __info__.version = "18.0.4";
72439
+ __info__.date = "2024-11-13T15:08:50.620Z";
72440
+ __info__.hash = "88e1aee";
@@ -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 18.0.2
6
- * @date 2024-10-24T08:54:21.934Z
7
- * @hash 788df92
5
+ * @version 18.0.4
6
+ * @date 2024-11-13T15:08:50.620Z
7
+ * @hash 88e1aee
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -9321,38 +9321,40 @@ stores.inject(MyMetaStore, storeInstance);
9321
9321
  const defaultBorderColor = colorToRGBA(dataset.backgroundColor);
9322
9322
  defaultBorderColor.a = 1;
9323
9323
  const borderColor = config.color || lightenColor(rgbaToHex(defaultBorderColor), 0.5);
9324
- const backgroundRGBA = colorToRGBA(borderColor);
9325
- // @ts-expect-error
9326
- if (dataset?.fill) {
9327
- backgroundRGBA.a = LINE_FILL_TRANSPARENCY; // to support area charts
9328
- }
9329
9324
  return {
9330
- ...dataset,
9331
9325
  type: "line",
9332
9326
  xAxisID: TREND_LINE_XAXIS_ID,
9327
+ yAxisID: dataset.yAxisID,
9333
9328
  label: dataset.label ? _t("Trend line for %s", dataset.label) : "",
9334
9329
  data,
9335
9330
  order: -1,
9336
9331
  showLine: true,
9337
9332
  pointRadius: 0,
9338
- backgroundColor: rgbaToHex(backgroundRGBA),
9333
+ backgroundColor: borderColor,
9339
9334
  borderColor,
9340
9335
  borderDash: [5, 5],
9341
9336
  borderWidth: undefined,
9337
+ fill: false,
9338
+ pointBackgroundColor: borderColor,
9342
9339
  };
9343
9340
  }
9344
9341
  function interpolateData(config, values, labels, newLabels) {
9345
9342
  if (values.length < 2 || labels.length < 2 || newLabels.length === 0) {
9346
9343
  return [];
9347
9344
  }
9345
+ const labelMin = Math.min(...labels);
9346
+ const labelMax = Math.max(...labels);
9347
+ const labelRange = labelMax - labelMin;
9348
+ const normalizedLabels = labels.map((v) => (v - labelMin) / labelRange);
9349
+ const normalizedNewLabels = newLabels.map((v) => (v - labelMin) / labelRange);
9348
9350
  switch (config.type) {
9349
9351
  case "polynomial": {
9350
9352
  const order = config.order ?? 2;
9351
9353
  if (order === 1) {
9352
- return predictLinearValues([values], [labels], [newLabels], true)[0];
9354
+ return predictLinearValues([values], [normalizedLabels], [normalizedNewLabels], true)[0];
9353
9355
  }
9354
- const coeffs = polynomialRegression(values, labels, order, true).flat();
9355
- return newLabels.map((v) => evaluatePolynomial(coeffs, v, order));
9356
+ const coeffs = polynomialRegression(values, normalizedLabels, order, true).flat();
9357
+ return normalizedNewLabels.map((v) => evaluatePolynomial(coeffs, v, order));
9356
9358
  }
9357
9359
  case "exponential": {
9358
9360
  const positiveLogValues = [];
@@ -9360,16 +9362,16 @@ stores.inject(MyMetaStore, storeInstance);
9360
9362
  for (let i = 0; i < values.length; i++) {
9361
9363
  if (values[i] > 0) {
9362
9364
  positiveLogValues.push(Math.log(values[i]));
9363
- filteredLabels.push(labels[i]);
9365
+ filteredLabels.push(normalizedLabels[i]);
9364
9366
  }
9365
9367
  }
9366
9368
  if (!filteredLabels.length) {
9367
9369
  return [];
9368
9370
  }
9369
- return expM(predictLinearValues([positiveLogValues], [filteredLabels], [newLabels], true))[0];
9371
+ return expM(predictLinearValues([positiveLogValues], [filteredLabels], [normalizedNewLabels], true))[0];
9370
9372
  }
9371
9373
  case "logarithmic": {
9372
- return predictLinearValues([values], logM([labels]), logM([newLabels]), true)[0];
9374
+ return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
9373
9375
  }
9374
9376
  default:
9375
9377
  return [];
@@ -9505,6 +9507,10 @@ stores.inject(MyMetaStore, storeInstance);
9505
9507
  function drawPieChartValues(chart, options, ctx) {
9506
9508
  for (const dataset of chart._metasets) {
9507
9509
  for (let i = 0; i < dataset._parsed.length; i++) {
9510
+ const value = Number(dataset._parsed[i]);
9511
+ if (isNaN(value) || value === 0) {
9512
+ continue;
9513
+ }
9508
9514
  const bar = dataset.data[i];
9509
9515
  const { startAngle, endAngle, innerRadius, outerRadius } = bar;
9510
9516
  const midAngle = (startAngle + endAngle) / 2;
@@ -9513,8 +9519,8 @@ stores.inject(MyMetaStore, storeInstance);
9513
9519
  const y = bar.y + midRadius * Math.sin(midAngle) + 7;
9514
9520
  ctx.fillStyle = chartFontColor(options.background);
9515
9521
  ctx.strokeStyle = options.background || "#ffffff";
9516
- const value = options.callback(dataset._parsed[i]);
9517
- drawTextWithBackground(value, x, y, ctx);
9522
+ const displayValue = options.callback(value);
9523
+ drawTextWithBackground(displayValue, x, y, ctx);
9518
9524
  }
9519
9525
  }
9520
9526
  }
@@ -14593,7 +14599,7 @@ stores.inject(MyMetaStore, storeInstance);
14593
14599
  const result = [];
14594
14600
  for (let i = 0; i < _array.length; i++) {
14595
14601
  const row = _array[i];
14596
- if (_conditions.every((c) => c[i])) {
14602
+ if (_conditions.every((c) => (typeof c[i] === "boolean" || typeof c[i] === "number") && c[i])) {
14597
14603
  result.push(row);
14598
14604
  }
14599
14605
  }
@@ -16988,7 +16994,10 @@ stores.inject(MyMetaStore, storeInstance);
16988
16994
  case "STRING":
16989
16995
  return { type: "STRING", value: removeStringQuotes(current.value) };
16990
16996
  case "INVALID_REFERENCE":
16991
- throw new InvalidReferenceError();
16997
+ return {
16998
+ type: "REFERENCE",
16999
+ value: CellErrorType.InvalidReference,
17000
+ };
16992
17001
  case "REFERENCE":
16993
17002
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
16994
17003
  tokens.shift();
@@ -27872,6 +27881,7 @@ stores.inject(MyMetaStore, storeInstance);
27872
27881
  StackedBarChart: _t("Stacked bar chart"),
27873
27882
  StackedLineChart: _t("Stacked line chart"),
27874
27883
  StackedAreaChart: _t("Stacked area chart"),
27884
+ StackedColumnChart: _t("Stacked column chart"),
27875
27885
  CumulativeData: _t("Cumulative data"),
27876
27886
  TreatLabelsAsText: _t("Treat labels as text"),
27877
27887
  AggregatedChart: _t("Aggregate"),
@@ -28158,11 +28168,14 @@ stores.inject(MyMetaStore, storeInstance);
28158
28168
  function getChartLabelFormat(getters, range) {
28159
28169
  if (!range)
28160
28170
  return undefined;
28161
- return getters.getEvaluatedCell({
28162
- sheetId: range.sheetId,
28163
- col: range.zone.left,
28164
- row: range.zone.top,
28165
- }).format;
28171
+ const { sheetId, zone: { left, top, bottom }, } = range;
28172
+ for (let row = top; row <= bottom; row++) {
28173
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
28174
+ if (format) {
28175
+ return format;
28176
+ }
28177
+ }
28178
+ return undefined;
28166
28179
  }
28167
28180
  function getChartLabelValues(getters, dataSets, labelRange) {
28168
28181
  let labels = { values: [], formattedValues: [] };
@@ -28743,11 +28756,7 @@ stores.inject(MyMetaStore, storeInstance);
28743
28756
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
28744
28757
  return false;
28745
28758
  }
28746
- const labelFormat = getters.getEvaluatedCell({
28747
- sheetId: labelRange.sheetId,
28748
- col: labelRange.zone.left,
28749
- row: labelRange.zone.top,
28750
- }).format;
28759
+ const labelFormat = getChartLabelFormat(getters, labelRange);
28751
28760
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
28752
28761
  }
28753
28762
  function canBeLinearChart(labelRange, getters) {
@@ -28810,8 +28819,8 @@ stores.inject(MyMetaStore, storeInstance);
28810
28819
  break;
28811
28820
  case "time":
28812
28821
  for (const point of dataset.data) {
28813
- const date = toJsDate({ value: point.x }, locale).getTime();
28814
- if (typeof point.y === "number") {
28822
+ const date = toNumber({ value: point.x }, locale);
28823
+ if (point.y !== null) {
28815
28824
  filteredValues.push(point.y);
28816
28825
  filteredLabels.push(date);
28817
28826
  }
@@ -29043,10 +29052,6 @@ stores.inject(MyMetaStore, storeInstance);
29043
29052
  return {
29044
29053
  chartJsConfig: config,
29045
29054
  background: chart.background || BACKGROUND_CHART_COLOR,
29046
- dataSetsValues,
29047
- labelValues,
29048
- dataSetFormat,
29049
- labelFormat,
29050
29055
  };
29051
29056
  }
29052
29057
 
@@ -36281,6 +36286,12 @@ stores.inject(MyMetaStore, storeInstance);
36281
36286
 
36282
36287
  class BarConfigPanel extends GenericChartConfigPanel {
36283
36288
  static template = "o-spreadsheet-BarConfigPanel";
36289
+ get stackedLabel() {
36290
+ const definition = this.props.definition;
36291
+ return definition.horizontal
36292
+ ? this.chartTerms.StackedBarChart
36293
+ : this.chartTerms.StackedColumnChart;
36294
+ }
36284
36295
  onUpdateStacked(stacked) {
36285
36296
  this.props.updateChart(this.props.figureId, {
36286
36297
  stacked,
@@ -36715,6 +36726,7 @@ stores.inject(MyMetaStore, storeInstance);
36715
36726
  currentColor: { type: String, optional: true },
36716
36727
  maxHeight: { type: Number, optional: true },
36717
36728
  anchorRect: Object,
36729
+ disableNoColor: { type: Boolean, optional: true },
36718
36730
  };
36719
36731
  static defaultProps = { currentColor: "" };
36720
36732
  static components = { Popover };
@@ -36941,6 +36953,7 @@ stores.inject(MyMetaStore, storeInstance);
36941
36953
  currentColor: { type: String, optional: true },
36942
36954
  title: { type: String, optional: true },
36943
36955
  onColorPicked: Function,
36956
+ disableNoColor: { type: Boolean, optional: true },
36944
36957
  };
36945
36958
  colorPickerButtonRef = owl.useRef("colorPickerButton");
36946
36959
  state;
@@ -37603,7 +37616,9 @@ stores.inject(MyMetaStore, storeInstance);
37603
37616
  }
37604
37617
  get stackedLabel() {
37605
37618
  const definition = this.props.definition;
37606
- return definition.fillArea ? this.chartTerms.StackedAreaChart : this.chartTerms.StackedBarChart;
37619
+ return definition.fillArea
37620
+ ? this.chartTerms.StackedAreaChart
37621
+ : this.chartTerms.StackedLineChart;
37607
37622
  }
37608
37623
  getLabelRangeOptions() {
37609
37624
  const options = super.getLabelRangeOptions();
@@ -39717,6 +39732,9 @@ stores.inject(MyMetaStore, storeInstance);
39717
39732
  }
39718
39733
  }
39719
39734
  setColorScaleColor(target, color) {
39735
+ if (!isColorValid(color)) {
39736
+ return;
39737
+ }
39720
39738
  const point = this.state.rules.colorScale[target];
39721
39739
  if (point) {
39722
39740
  point.color = Number.parseInt(color.substr(1), 16);
@@ -59617,6 +59635,10 @@ stores.inject(MyMetaStore, storeInstance);
59617
59635
  if (!pivot.isValid()) {
59618
59636
  return EMPTY_PIVOT_CELL;
59619
59637
  }
59638
+ if (functionName === "PIVOT" &&
59639
+ !cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
59640
+ return EMPTY_PIVOT_CELL;
59641
+ }
59620
59642
  if (functionName === "PIVOT") {
59621
59643
  const includeTotal = args[2] === false ? false : undefined;
59622
59644
  const includeColumnHeaders = args[3] === false ? false : undefined;
@@ -70390,7 +70412,8 @@ stores.inject(MyMetaStore, storeInstance);
70390
70412
  }
70391
70413
  const attrs = [["t", type]];
70392
70414
  const XlsxFormula = adaptFormulaToExcel(formula);
70393
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
70415
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
70416
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
70394
70417
  return { attrs, node };
70395
70418
  }
70396
70419
  function addContent(content, sharedStrings, forceString = false) {
@@ -70425,8 +70448,14 @@ stores.inject(MyMetaStore, storeInstance);
70425
70448
  ast = addMissingRequiredArgs(ast);
70426
70449
  return ast;
70427
70450
  });
70451
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
70452
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
70453
+ });
70428
70454
  return ast ? astToFormula(ast) : formulaText;
70429
70455
  }
70456
+ function adaptFormulaValueToExcel(formulaValue) {
70457
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
70458
+ }
70430
70459
  /**
70431
70460
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
70432
70461
  * This adds those missing args.
@@ -72401,6 +72430,7 @@ stores.inject(MyMetaStore, storeInstance);
72401
72430
  PIVOT_TABLE_CONFIG,
72402
72431
  TREND_LINE_XAXIS_ID,
72403
72432
  CHART_AXIS_CHOICES,
72433
+ ChartTerms,
72404
72434
  };
72405
72435
 
72406
72436
  exports.AbstractCellClipboardHandler = AbstractCellClipboardHandler;
@@ -72449,9 +72479,9 @@ stores.inject(MyMetaStore, storeInstance);
72449
72479
  exports.tokenize = tokenize;
72450
72480
 
72451
72481
 
72452
- __info__.version = "18.0.2";
72453
- __info__.date = "2024-10-24T08:54:21.934Z";
72454
- __info__.hash = "788df92";
72482
+ __info__.version = "18.0.4";
72483
+ __info__.date = "2024-11-13T15:08:50.620Z";
72484
+ __info__.hash = "88e1aee";
72455
72485
 
72456
72486
 
72457
72487
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);