@odoo/o-spreadsheet 17.1.10 → 17.1.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.1.10
6
- * @date 2024-04-05T14:00:03.890Z
7
- * @hash edc821c
5
+ * @version 17.1.11
6
+ * @date 2024-04-10T12:27:11.107Z
7
+ * @hash 246caf7
8
8
  */
9
9
 
10
10
  'use strict';
@@ -551,7 +551,7 @@ function deepEquals(o1, o2) {
551
551
  if (typeof o1 !== typeof o2)
552
552
  return false;
553
553
  if (typeof o1 !== "object")
554
- return o1 === o2;
554
+ return false;
555
555
  // Objects can have different keys if the values are undefined
556
556
  for (const key in o2) {
557
557
  if (!(key in o1) && o2[key] !== undefined) {
@@ -8465,7 +8465,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale })
8465
8465
  const xLabel = tooltipItem.dataset?.label || tooltipItem.label;
8466
8466
  // tooltipItem.parsed.y can be an object or a number for pie charts
8467
8467
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
8468
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
8468
+ const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
8469
8469
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
8470
8470
  return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
8471
8471
  },
@@ -8752,7 +8752,10 @@ function getBarConfiguration(chart, labels, localeFormat) {
8752
8752
  if (isNaN(value))
8753
8753
  return value;
8754
8754
  const { locale, format } = localeFormat;
8755
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
8755
+ return formatValue(value, {
8756
+ locale,
8757
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
8758
+ });
8756
8759
  },
8757
8760
  },
8758
8761
  },
@@ -9403,7 +9406,10 @@ function getLineConfiguration(chart, labels, localeFormat) {
9403
9406
  if (isNaN(value))
9404
9407
  return value;
9405
9408
  const { locale, format } = localeFormat;
9406
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
9409
+ return formatValue(value, {
9410
+ locale,
9411
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
9412
+ });
9407
9413
  },
9408
9414
  },
9409
9415
  },
@@ -9630,7 +9636,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
9630
9636
  const percentage = calculatePercentage(data, dataIndex);
9631
9637
  const xLabel = tooltipItem.label || tooltipItem.dataset.label;
9632
9638
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
9633
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
9639
+ const toolTipFormat = !format && yLabel >= 1000 ? "#,##" : format;
9634
9640
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
9635
9641
  return xLabel ? `${xLabel}: ${yLabelStr} (${percentage}%)` : `${yLabelStr} (${percentage}%)`;
9636
9642
  };
@@ -27103,6 +27109,7 @@ class Composer extends owl.Component {
27103
27109
  onComposerCellFocused: { type: Function, optional: true },
27104
27110
  onComposerContentFocused: Function,
27105
27111
  isDefaultFocus: { type: Boolean, optional: true },
27112
+ onInputContextMenu: { type: Function, optional: true },
27106
27113
  };
27107
27114
  static components = { TextValueProvider, FunctionDescriptionProvider };
27108
27115
  static defaultProps = {
@@ -27461,6 +27468,11 @@ class Composer extends owl.Component {
27461
27468
  }
27462
27469
  }
27463
27470
  }
27471
+ onContextMenu(ev) {
27472
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27473
+ this.props.onInputContextMenu?.(ev);
27474
+ }
27475
+ }
27464
27476
  // ---------------------------------------------------------------------------
27465
27477
  // Private
27466
27478
  // ---------------------------------------------------------------------------
@@ -27728,6 +27740,7 @@ class GridComposer extends owl.Component {
27728
27740
  onComposerCellFocused: Function,
27729
27741
  onComposerContentFocused: Function,
27730
27742
  gridDims: Object,
27743
+ onInputContextMenu: Function,
27731
27744
  };
27732
27745
  static components = { Composer };
27733
27746
  rect = this.defaultRect;
@@ -27772,6 +27785,7 @@ class GridComposer extends owl.Component {
27772
27785
  isDefaultFocus: true,
27773
27786
  onComposerContentFocused: this.props.onComposerContentFocused,
27774
27787
  onComposerCellFocused: this.props.onComposerCellFocused,
27788
+ onInputContextMenu: this.props.onInputContextMenu,
27775
27789
  };
27776
27790
  }
27777
27791
  get containerStyle() {
@@ -31769,29 +31783,12 @@ function convertWidthFromExcel(width) {
31769
31783
  return width;
31770
31784
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
31771
31785
  }
31772
- function convertBorderDescr(descr) {
31773
- if (!descr) {
31774
- return undefined;
31775
- }
31776
- return {
31777
- style: descr.style,
31778
- color: { rgb: descr.color },
31779
- };
31780
- }
31781
31786
  function extractStyle(cell, data) {
31782
31787
  let style = {};
31783
31788
  if (cell.style) {
31784
31789
  style = data.styles[cell.style];
31785
31790
  }
31786
31791
  const format = extractFormat(cell, data);
31787
- const exportedBorder = {};
31788
- if (cell.border) {
31789
- const border = data.borders[cell.border];
31790
- exportedBorder.left = convertBorderDescr(border.left);
31791
- exportedBorder.right = convertBorderDescr(border.right);
31792
- exportedBorder.bottom = convertBorderDescr(border.bottom);
31793
- exportedBorder.top = convertBorderDescr(border.top);
31794
- }
31795
31792
  const styles = {
31796
31793
  font: {
31797
31794
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -31805,7 +31802,7 @@ function extractStyle(cell, data) {
31805
31802
  }
31806
31803
  : { reservedAttribute: "none" },
31807
31804
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
31808
- border: exportedBorder || {},
31805
+ border: cell.border || 0,
31809
31806
  alignment: {
31810
31807
  horizontal: style.align,
31811
31808
  vertical: style.verticalAlign
@@ -31827,15 +31824,12 @@ function extractFormat(cell, data) {
31827
31824
  return undefined;
31828
31825
  }
31829
31826
  function normalizeStyle(construct, styles) {
31830
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
31831
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
31832
- const { id: borderId } = pushElement(styles["border"], construct.borders);
31833
31827
  // Normalize this
31834
31828
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
31835
31829
  const style = {
31836
- fontId,
31837
- fillId,
31838
- borderId,
31830
+ fontId: pushElement(styles.font, construct.fonts),
31831
+ fillId: pushElement(styles.fill, construct.fills),
31832
+ borderId: styles.border,
31839
31833
  numFmtId,
31840
31834
  alignment: {
31841
31835
  vertical: styles.alignment.vertical,
@@ -31843,8 +31837,7 @@ function normalizeStyle(construct, styles) {
31843
31837
  wrapText: styles.alignment.wrapText,
31844
31838
  },
31845
31839
  };
31846
- const { id } = pushElement(style, construct.styles);
31847
- return id;
31840
+ return pushElement(style, construct.styles);
31848
31841
  }
31849
31842
  function convertFormat(format, numFmtStructure) {
31850
31843
  if (!format) {
@@ -31852,8 +31845,7 @@ function convertFormat(format, numFmtStructure) {
31852
31845
  }
31853
31846
  let formatId = XLSX_FORMAT_MAP[format.format];
31854
31847
  if (!formatId) {
31855
- const { id } = pushElement(format, numFmtStructure);
31856
- formatId = id + FIRST_NUMFMT_ID;
31848
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
31857
31849
  }
31858
31850
  return formatId;
31859
31851
  }
@@ -31878,20 +31870,15 @@ function addRelsToFile(relsFiles, path, rel) {
31878
31870
  return id;
31879
31871
  }
31880
31872
  function pushElement(property, propertyList) {
31881
- for (let [key, value] of Object.entries(propertyList)) {
31882
- if (JSON.stringify(value) === JSON.stringify(property)) {
31883
- return { id: parseInt(key, 10), list: propertyList };
31873
+ let len = propertyList.length;
31874
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
31875
+ for (let i = 0; i < len; i++) {
31876
+ if (operator(property, propertyList[i])) {
31877
+ return i;
31884
31878
  }
31885
31879
  }
31886
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
31887
- if (elemId === -1) {
31888
- propertyList.push(property);
31889
- elemId = propertyList.length - 1;
31890
- }
31891
- return {
31892
- id: elemId,
31893
- list: propertyList,
31894
- };
31880
+ propertyList[propertyList.length] = property;
31881
+ return propertyList.length - 1;
31895
31882
  }
31896
31883
  const chartIds = [];
31897
31884
  /**
@@ -32618,7 +32605,25 @@ function parseXML(xmlString, mimeType = "text/xml") {
32618
32605
  }
32619
32606
  return document;
32620
32607
  }
32621
- function getDefaultXLSXStructure() {
32608
+ function convertBorderDescr(descr) {
32609
+ if (!descr) {
32610
+ return undefined;
32611
+ }
32612
+ return {
32613
+ style: descr.style,
32614
+ color: { rgb: descr.color },
32615
+ };
32616
+ }
32617
+ function getDefaultXLSXStructure(data) {
32618
+ const xlsxBorders = Object.values(data.borders).map((border) => {
32619
+ return {
32620
+ left: convertBorderDescr(border.left),
32621
+ right: convertBorderDescr(border.right),
32622
+ bottom: convertBorderDescr(border.bottom),
32623
+ top: convertBorderDescr(border.top),
32624
+ };
32625
+ });
32626
+ const borders = [{}, ...xlsxBorders];
32622
32627
  return {
32623
32628
  relsFiles: [],
32624
32629
  sharedStrings: [],
@@ -32641,7 +32646,7 @@ function getDefaultXLSXStructure() {
32641
32646
  },
32642
32647
  ],
32643
32648
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
32644
- borders: [{}],
32649
+ borders,
32645
32650
  numFmts: [],
32646
32651
  dxfs: [],
32647
32652
  };
@@ -37837,7 +37842,17 @@ class FiltersPlugin extends CorePlugin {
37837
37842
  }
37838
37843
  }
37839
37844
  exportForExcel(data) {
37840
- this.export(data);
37845
+ for (const sheet of data.sheets) {
37846
+ for (const filterTable of this.getFilterTables(sheet.id)) {
37847
+ if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
37848
+ continue;
37849
+ }
37850
+ sheet.filterTables.push({
37851
+ range: zoneToXc(filterTable.zone),
37852
+ filters: [],
37853
+ });
37854
+ }
37855
+ }
37841
37856
  }
37842
37857
  }
37843
37858
 
@@ -41557,7 +41572,9 @@ class Evaluator {
41557
41572
  this.blockedArrayFormulas = new Set();
41558
41573
  this.spreadingRelations = new SpreadingRelation();
41559
41574
  this.formulaDependencies = lazy(() => {
41560
- const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId).map((range) => ({
41575
+ const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
41576
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
41577
+ .map((range) => ({
41561
41578
  data: positionId,
41562
41579
  boundingBox: {
41563
41580
  zone: range.zone,
@@ -55531,8 +55548,7 @@ function addContent(content, sharedStrings, forceString = false) {
55531
55548
  attrs.push(["t", "b"]);
55532
55549
  }
55533
55550
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
55534
- const { id } = pushElement(content, sharedStrings);
55535
- value = id.toString();
55551
+ value = pushElement(content, sharedStrings);
55536
55552
  attrs.push(["t", "s"]);
55537
55553
  }
55538
55554
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -55657,8 +55673,7 @@ function addCellIsRule(cf, rule, dxfs) {
55657
55673
  if (rule.style.fillColor) {
55658
55674
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
55659
55675
  }
55660
- const { id } = pushElement(dxf, dxfs);
55661
- ruleAttributes.push(["dxfId", id]);
55676
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
55662
55677
  return escapeXml /*xml*/ `
55663
55678
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
55664
55679
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -56468,7 +56483,7 @@ function addSheetViews(sheet) {
56468
56483
  */
56469
56484
  function getXLSX(data) {
56470
56485
  const files = [];
56471
- const construct = getDefaultXLSXStructure();
56486
+ const construct = getDefaultXLSXStructure(data);
56472
56487
  files.push(createWorkbook(data, construct));
56473
56488
  files.push(...createWorksheets(data, construct));
56474
56489
  files.push(createStylesSheet(construct));
@@ -57357,6 +57372,6 @@ exports.setTranslationMethod = setTranslationMethod;
57357
57372
  exports.tokenize = tokenize;
57358
57373
 
57359
57374
 
57360
- __info__.version = "17.1.10";
57361
- __info__.date = "2024-04-05T14:00:03.890Z";
57362
- __info__.hash = "edc821c";
57375
+ __info__.version = "17.1.11";
57376
+ __info__.date = "2024-04-10T12:27:11.107Z";
57377
+ __info__.hash = "246caf7";
@@ -7838,6 +7838,7 @@ interface ComposerProps {
7838
7838
  delimitation?: DOMDimension;
7839
7839
  onComposerContentFocused: () => void;
7840
7840
  onComposerCellFocused?: (content: String) => void;
7841
+ onInputContextMenu?: (event: MouseEvent) => void;
7841
7842
  isDefaultFocus?: boolean;
7842
7843
  }
7843
7844
  interface ComposerState$1 {
@@ -7884,6 +7885,10 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7884
7885
  type: BooleanConstructor;
7885
7886
  optional: boolean;
7886
7887
  };
7888
+ onInputContextMenu: {
7889
+ type: FunctionConstructor;
7890
+ optional: boolean;
7891
+ };
7887
7892
  };
7888
7893
  static components: {
7889
7894
  TextValueProvider: typeof TextValueProvider;
@@ -7938,6 +7943,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7938
7943
  onMousedown(ev: MouseEvent): void;
7939
7944
  onClick(): void;
7940
7945
  onDblClick(): void;
7946
+ onContextMenu(ev: MouseEvent): void;
7941
7947
  private processContent;
7942
7948
  /**
7943
7949
  * Get the HTML content corresponding to the current composer token, divided by lines.
@@ -8148,6 +8154,7 @@ interface Props$5 {
8148
8154
  onComposerContentFocused: () => void;
8149
8155
  onComposerCellFocused: () => void;
8150
8156
  gridDims: DOMDimension;
8157
+ onInputContextMenu: (event: MouseEvent) => void;
8151
8158
  }
8152
8159
  /**
8153
8160
  * This component is a composer which positions itself on the grid at the anchor cell.
@@ -8162,6 +8169,7 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
8162
8169
  onComposerCellFocused: FunctionConstructor;
8163
8170
  onComposerContentFocused: FunctionConstructor;
8164
8171
  gridDims: ObjectConstructor;
8172
+ onInputContextMenu: FunctionConstructor;
8165
8173
  };
8166
8174
  static components: {
8167
8175
  Composer: typeof Composer;
@@ -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.1.10
6
- * @date 2024-04-05T14:00:03.890Z
7
- * @hash edc821c
5
+ * @version 17.1.11
6
+ * @date 2024-04-10T12:27:11.107Z
7
+ * @hash 246caf7
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';
@@ -549,7 +549,7 @@ function deepEquals(o1, o2) {
549
549
  if (typeof o1 !== typeof o2)
550
550
  return false;
551
551
  if (typeof o1 !== "object")
552
- return o1 === o2;
552
+ return false;
553
553
  // Objects can have different keys if the values are undefined
554
554
  for (const key in o2) {
555
555
  if (!(key in o1) && o2[key] !== undefined) {
@@ -8463,7 +8463,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale })
8463
8463
  const xLabel = tooltipItem.dataset?.label || tooltipItem.label;
8464
8464
  // tooltipItem.parsed.y can be an object or a number for pie charts
8465
8465
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
8466
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
8466
+ const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
8467
8467
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
8468
8468
  return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
8469
8469
  },
@@ -8750,7 +8750,10 @@ function getBarConfiguration(chart, labels, localeFormat) {
8750
8750
  if (isNaN(value))
8751
8751
  return value;
8752
8752
  const { locale, format } = localeFormat;
8753
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
8753
+ return formatValue(value, {
8754
+ locale,
8755
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
8756
+ });
8754
8757
  },
8755
8758
  },
8756
8759
  },
@@ -9401,7 +9404,10 @@ function getLineConfiguration(chart, labels, localeFormat) {
9401
9404
  if (isNaN(value))
9402
9405
  return value;
9403
9406
  const { locale, format } = localeFormat;
9404
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
9407
+ return formatValue(value, {
9408
+ locale,
9409
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
9410
+ });
9405
9411
  },
9406
9412
  },
9407
9413
  },
@@ -9628,7 +9634,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
9628
9634
  const percentage = calculatePercentage(data, dataIndex);
9629
9635
  const xLabel = tooltipItem.label || tooltipItem.dataset.label;
9630
9636
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
9631
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
9637
+ const toolTipFormat = !format && yLabel >= 1000 ? "#,##" : format;
9632
9638
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
9633
9639
  return xLabel ? `${xLabel}: ${yLabelStr} (${percentage}%)` : `${yLabelStr} (${percentage}%)`;
9634
9640
  };
@@ -27101,6 +27107,7 @@ class Composer extends Component {
27101
27107
  onComposerCellFocused: { type: Function, optional: true },
27102
27108
  onComposerContentFocused: Function,
27103
27109
  isDefaultFocus: { type: Boolean, optional: true },
27110
+ onInputContextMenu: { type: Function, optional: true },
27104
27111
  };
27105
27112
  static components = { TextValueProvider, FunctionDescriptionProvider };
27106
27113
  static defaultProps = {
@@ -27459,6 +27466,11 @@ class Composer extends Component {
27459
27466
  }
27460
27467
  }
27461
27468
  }
27469
+ onContextMenu(ev) {
27470
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27471
+ this.props.onInputContextMenu?.(ev);
27472
+ }
27473
+ }
27462
27474
  // ---------------------------------------------------------------------------
27463
27475
  // Private
27464
27476
  // ---------------------------------------------------------------------------
@@ -27726,6 +27738,7 @@ class GridComposer extends Component {
27726
27738
  onComposerCellFocused: Function,
27727
27739
  onComposerContentFocused: Function,
27728
27740
  gridDims: Object,
27741
+ onInputContextMenu: Function,
27729
27742
  };
27730
27743
  static components = { Composer };
27731
27744
  rect = this.defaultRect;
@@ -27770,6 +27783,7 @@ class GridComposer extends Component {
27770
27783
  isDefaultFocus: true,
27771
27784
  onComposerContentFocused: this.props.onComposerContentFocused,
27772
27785
  onComposerCellFocused: this.props.onComposerCellFocused,
27786
+ onInputContextMenu: this.props.onInputContextMenu,
27773
27787
  };
27774
27788
  }
27775
27789
  get containerStyle() {
@@ -31767,29 +31781,12 @@ function convertWidthFromExcel(width) {
31767
31781
  return width;
31768
31782
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
31769
31783
  }
31770
- function convertBorderDescr(descr) {
31771
- if (!descr) {
31772
- return undefined;
31773
- }
31774
- return {
31775
- style: descr.style,
31776
- color: { rgb: descr.color },
31777
- };
31778
- }
31779
31784
  function extractStyle(cell, data) {
31780
31785
  let style = {};
31781
31786
  if (cell.style) {
31782
31787
  style = data.styles[cell.style];
31783
31788
  }
31784
31789
  const format = extractFormat(cell, data);
31785
- const exportedBorder = {};
31786
- if (cell.border) {
31787
- const border = data.borders[cell.border];
31788
- exportedBorder.left = convertBorderDescr(border.left);
31789
- exportedBorder.right = convertBorderDescr(border.right);
31790
- exportedBorder.bottom = convertBorderDescr(border.bottom);
31791
- exportedBorder.top = convertBorderDescr(border.top);
31792
- }
31793
31790
  const styles = {
31794
31791
  font: {
31795
31792
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -31803,7 +31800,7 @@ function extractStyle(cell, data) {
31803
31800
  }
31804
31801
  : { reservedAttribute: "none" },
31805
31802
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
31806
- border: exportedBorder || {},
31803
+ border: cell.border || 0,
31807
31804
  alignment: {
31808
31805
  horizontal: style.align,
31809
31806
  vertical: style.verticalAlign
@@ -31825,15 +31822,12 @@ function extractFormat(cell, data) {
31825
31822
  return undefined;
31826
31823
  }
31827
31824
  function normalizeStyle(construct, styles) {
31828
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
31829
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
31830
- const { id: borderId } = pushElement(styles["border"], construct.borders);
31831
31825
  // Normalize this
31832
31826
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
31833
31827
  const style = {
31834
- fontId,
31835
- fillId,
31836
- borderId,
31828
+ fontId: pushElement(styles.font, construct.fonts),
31829
+ fillId: pushElement(styles.fill, construct.fills),
31830
+ borderId: styles.border,
31837
31831
  numFmtId,
31838
31832
  alignment: {
31839
31833
  vertical: styles.alignment.vertical,
@@ -31841,8 +31835,7 @@ function normalizeStyle(construct, styles) {
31841
31835
  wrapText: styles.alignment.wrapText,
31842
31836
  },
31843
31837
  };
31844
- const { id } = pushElement(style, construct.styles);
31845
- return id;
31838
+ return pushElement(style, construct.styles);
31846
31839
  }
31847
31840
  function convertFormat(format, numFmtStructure) {
31848
31841
  if (!format) {
@@ -31850,8 +31843,7 @@ function convertFormat(format, numFmtStructure) {
31850
31843
  }
31851
31844
  let formatId = XLSX_FORMAT_MAP[format.format];
31852
31845
  if (!formatId) {
31853
- const { id } = pushElement(format, numFmtStructure);
31854
- formatId = id + FIRST_NUMFMT_ID;
31846
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
31855
31847
  }
31856
31848
  return formatId;
31857
31849
  }
@@ -31876,20 +31868,15 @@ function addRelsToFile(relsFiles, path, rel) {
31876
31868
  return id;
31877
31869
  }
31878
31870
  function pushElement(property, propertyList) {
31879
- for (let [key, value] of Object.entries(propertyList)) {
31880
- if (JSON.stringify(value) === JSON.stringify(property)) {
31881
- return { id: parseInt(key, 10), list: propertyList };
31871
+ let len = propertyList.length;
31872
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
31873
+ for (let i = 0; i < len; i++) {
31874
+ if (operator(property, propertyList[i])) {
31875
+ return i;
31882
31876
  }
31883
31877
  }
31884
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
31885
- if (elemId === -1) {
31886
- propertyList.push(property);
31887
- elemId = propertyList.length - 1;
31888
- }
31889
- return {
31890
- id: elemId,
31891
- list: propertyList,
31892
- };
31878
+ propertyList[propertyList.length] = property;
31879
+ return propertyList.length - 1;
31893
31880
  }
31894
31881
  const chartIds = [];
31895
31882
  /**
@@ -32616,7 +32603,25 @@ function parseXML(xmlString, mimeType = "text/xml") {
32616
32603
  }
32617
32604
  return document;
32618
32605
  }
32619
- function getDefaultXLSXStructure() {
32606
+ function convertBorderDescr(descr) {
32607
+ if (!descr) {
32608
+ return undefined;
32609
+ }
32610
+ return {
32611
+ style: descr.style,
32612
+ color: { rgb: descr.color },
32613
+ };
32614
+ }
32615
+ function getDefaultXLSXStructure(data) {
32616
+ const xlsxBorders = Object.values(data.borders).map((border) => {
32617
+ return {
32618
+ left: convertBorderDescr(border.left),
32619
+ right: convertBorderDescr(border.right),
32620
+ bottom: convertBorderDescr(border.bottom),
32621
+ top: convertBorderDescr(border.top),
32622
+ };
32623
+ });
32624
+ const borders = [{}, ...xlsxBorders];
32620
32625
  return {
32621
32626
  relsFiles: [],
32622
32627
  sharedStrings: [],
@@ -32639,7 +32644,7 @@ function getDefaultXLSXStructure() {
32639
32644
  },
32640
32645
  ],
32641
32646
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
32642
- borders: [{}],
32647
+ borders,
32643
32648
  numFmts: [],
32644
32649
  dxfs: [],
32645
32650
  };
@@ -37835,7 +37840,17 @@ class FiltersPlugin extends CorePlugin {
37835
37840
  }
37836
37841
  }
37837
37842
  exportForExcel(data) {
37838
- this.export(data);
37843
+ for (const sheet of data.sheets) {
37844
+ for (const filterTable of this.getFilterTables(sheet.id)) {
37845
+ if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
37846
+ continue;
37847
+ }
37848
+ sheet.filterTables.push({
37849
+ range: zoneToXc(filterTable.zone),
37850
+ filters: [],
37851
+ });
37852
+ }
37853
+ }
37839
37854
  }
37840
37855
  }
37841
37856
 
@@ -41555,7 +41570,9 @@ class Evaluator {
41555
41570
  this.blockedArrayFormulas = new Set();
41556
41571
  this.spreadingRelations = new SpreadingRelation();
41557
41572
  this.formulaDependencies = lazy(() => {
41558
- const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId).map((range) => ({
41573
+ const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
41574
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
41575
+ .map((range) => ({
41559
41576
  data: positionId,
41560
41577
  boundingBox: {
41561
41578
  zone: range.zone,
@@ -55529,8 +55546,7 @@ function addContent(content, sharedStrings, forceString = false) {
55529
55546
  attrs.push(["t", "b"]);
55530
55547
  }
55531
55548
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
55532
- const { id } = pushElement(content, sharedStrings);
55533
- value = id.toString();
55549
+ value = pushElement(content, sharedStrings);
55534
55550
  attrs.push(["t", "s"]);
55535
55551
  }
55536
55552
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -55655,8 +55671,7 @@ function addCellIsRule(cf, rule, dxfs) {
55655
55671
  if (rule.style.fillColor) {
55656
55672
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
55657
55673
  }
55658
- const { id } = pushElement(dxf, dxfs);
55659
- ruleAttributes.push(["dxfId", id]);
55674
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
55660
55675
  return escapeXml /*xml*/ `
55661
55676
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
55662
55677
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -56466,7 +56481,7 @@ function addSheetViews(sheet) {
56466
56481
  */
56467
56482
  function getXLSX(data) {
56468
56483
  const files = [];
56469
- const construct = getDefaultXLSXStructure();
56484
+ const construct = getDefaultXLSXStructure(data);
56470
56485
  files.push(createWorkbook(data, construct));
56471
56486
  files.push(...createWorksheets(data, construct));
56472
56487
  files.push(createStylesSheet(construct));
@@ -57319,6 +57334,6 @@ const constants = {
57319
57334
  export { AbstractChart, CellErrorType, 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 };
57320
57335
 
57321
57336
 
57322
- __info__.version = "17.1.10";
57323
- __info__.date = "2024-04-05T14:00:03.890Z";
57324
- __info__.hash = "edc821c";
57337
+ __info__.version = "17.1.11";
57338
+ __info__.date = "2024-04-10T12:27:11.107Z";
57339
+ __info__.hash = "246caf7";