@odoo/o-spreadsheet 17.0.17 → 17.0.18

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.17
6
- * @date 2024-04-05T13:59:37.139Z
7
- * @hash 33f09d7
5
+ * @version 17.0.18
6
+ * @date 2024-04-10T13:28:23.664Z
7
+ * @hash 6294758
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -649,7 +649,7 @@
649
649
  if (typeof o1 !== typeof o2)
650
650
  return false;
651
651
  if (typeof o1 !== "object")
652
- return o1 === o2;
652
+ return false;
653
653
  // Objects can have different keys if the values are undefined
654
654
  for (const key in o2) {
655
655
  if (!(key in o1) && o2[key] !== undefined) {
@@ -26963,6 +26963,11 @@
26963
26963
  }
26964
26964
  }
26965
26965
  }
26966
+ onContextMenu(ev) {
26967
+ if (this.env.model.getters.getEditionMode() === "inactive") {
26968
+ this.props.onInputContextMenu?.(ev);
26969
+ }
26970
+ }
26966
26971
  // ---------------------------------------------------------------------------
26967
26972
  // Private
26968
26973
  // ---------------------------------------------------------------------------
@@ -27200,6 +27205,7 @@
27200
27205
  onComposerCellFocused: { type: Function, optional: true },
27201
27206
  onComposerContentFocused: Function,
27202
27207
  isDefaultFocus: { type: Boolean, optional: true },
27208
+ onInputContextMenu: { type: Function, optional: true },
27203
27209
  };
27204
27210
 
27205
27211
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
@@ -27275,6 +27281,7 @@
27275
27281
  isDefaultFocus: true,
27276
27282
  onComposerContentFocused: this.props.onComposerContentFocused,
27277
27283
  onComposerCellFocused: this.props.onComposerCellFocused,
27284
+ onInputContextMenu: this.props.onInputContextMenu,
27278
27285
  };
27279
27286
  }
27280
27287
  get containerStyle() {
@@ -27363,6 +27370,7 @@
27363
27370
  onComposerContentFocused: Function,
27364
27371
  gridDims: Object,
27365
27372
  onComposerCellFocused: Function,
27373
+ onInputContextMenu: Function,
27366
27374
  };
27367
27375
 
27368
27376
  const CSS$1 = css /* scss */ `
@@ -31316,29 +31324,12 @@
31316
31324
  return width;
31317
31325
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
31318
31326
  }
31319
- function convertBorderDescr(descr) {
31320
- if (!descr) {
31321
- return undefined;
31322
- }
31323
- return {
31324
- style: descr.style,
31325
- color: { rgb: descr.color },
31326
- };
31327
- }
31328
31327
  function extractStyle(cell, data) {
31329
31328
  let style = {};
31330
31329
  if (cell.style) {
31331
31330
  style = data.styles[cell.style];
31332
31331
  }
31333
31332
  const format = extractFormat(cell, data);
31334
- const exportedBorder = {};
31335
- if (cell.border) {
31336
- const border = data.borders[cell.border];
31337
- exportedBorder.left = convertBorderDescr(border.left);
31338
- exportedBorder.right = convertBorderDescr(border.right);
31339
- exportedBorder.bottom = convertBorderDescr(border.bottom);
31340
- exportedBorder.top = convertBorderDescr(border.top);
31341
- }
31342
31333
  const styles = {
31343
31334
  font: {
31344
31335
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -31352,7 +31343,7 @@
31352
31343
  }
31353
31344
  : { reservedAttribute: "none" },
31354
31345
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
31355
- border: exportedBorder || {},
31346
+ border: cell.border || 0,
31356
31347
  alignment: {
31357
31348
  horizontal: style.align,
31358
31349
  vertical: style.verticalAlign
@@ -31374,15 +31365,12 @@
31374
31365
  return undefined;
31375
31366
  }
31376
31367
  function normalizeStyle(construct, styles) {
31377
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
31378
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
31379
- const { id: borderId } = pushElement(styles["border"], construct.borders);
31380
31368
  // Normalize this
31381
31369
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
31382
31370
  const style = {
31383
- fontId,
31384
- fillId,
31385
- borderId,
31371
+ fontId: pushElement(styles.font, construct.fonts),
31372
+ fillId: pushElement(styles.fill, construct.fills),
31373
+ borderId: styles.border,
31386
31374
  numFmtId,
31387
31375
  alignment: {
31388
31376
  vertical: styles.alignment.vertical,
@@ -31390,8 +31378,7 @@
31390
31378
  wrapText: styles.alignment.wrapText,
31391
31379
  },
31392
31380
  };
31393
- const { id } = pushElement(style, construct.styles);
31394
- return id;
31381
+ return pushElement(style, construct.styles);
31395
31382
  }
31396
31383
  function convertFormat(format, numFmtStructure) {
31397
31384
  if (!format) {
@@ -31399,8 +31386,7 @@
31399
31386
  }
31400
31387
  let formatId = XLSX_FORMAT_MAP[format.format];
31401
31388
  if (!formatId) {
31402
- const { id } = pushElement(format, numFmtStructure);
31403
- formatId = id + FIRST_NUMFMT_ID;
31389
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
31404
31390
  }
31405
31391
  return formatId;
31406
31392
  }
@@ -31425,20 +31411,15 @@
31425
31411
  return id;
31426
31412
  }
31427
31413
  function pushElement(property, propertyList) {
31428
- for (let [key, value] of Object.entries(propertyList)) {
31429
- if (JSON.stringify(value) === JSON.stringify(property)) {
31430
- return { id: parseInt(key, 10), list: propertyList };
31414
+ let len = propertyList.length;
31415
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
31416
+ for (let i = 0; i < len; i++) {
31417
+ if (operator(property, propertyList[i])) {
31418
+ return i;
31431
31419
  }
31432
31420
  }
31433
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
31434
- if (elemId === -1) {
31435
- propertyList.push(property);
31436
- elemId = propertyList.length - 1;
31437
- }
31438
- return {
31439
- id: elemId,
31440
- list: propertyList,
31441
- };
31421
+ propertyList[propertyList.length] = property;
31422
+ return propertyList.length - 1;
31442
31423
  }
31443
31424
  const chartIds = [];
31444
31425
  /**
@@ -32159,7 +32140,25 @@
32159
32140
  }
32160
32141
  return document;
32161
32142
  }
32162
- function getDefaultXLSXStructure() {
32143
+ function convertBorderDescr(descr) {
32144
+ if (!descr) {
32145
+ return undefined;
32146
+ }
32147
+ return {
32148
+ style: descr.style,
32149
+ color: { rgb: descr.color },
32150
+ };
32151
+ }
32152
+ function getDefaultXLSXStructure(data) {
32153
+ const xlsxBorders = Object.values(data.borders).map((border) => {
32154
+ return {
32155
+ left: convertBorderDescr(border.left),
32156
+ right: convertBorderDescr(border.right),
32157
+ bottom: convertBorderDescr(border.bottom),
32158
+ top: convertBorderDescr(border.top),
32159
+ };
32160
+ });
32161
+ const borders = [{}, ...xlsxBorders];
32163
32162
  return {
32164
32163
  relsFiles: [],
32165
32164
  sharedStrings: [],
@@ -32182,7 +32181,7 @@
32182
32181
  },
32183
32182
  ],
32184
32183
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
32185
- borders: [{}],
32184
+ borders,
32186
32185
  numFmts: [],
32187
32186
  dxfs: [],
32188
32187
  };
@@ -37368,7 +37367,17 @@
37368
37367
  }
37369
37368
  }
37370
37369
  exportForExcel(data) {
37371
- this.export(data);
37370
+ for (const sheet of data.sheets) {
37371
+ for (const filterTable of this.getFilterTables(sheet.id)) {
37372
+ if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
37373
+ continue;
37374
+ }
37375
+ sheet.filterTables.push({
37376
+ range: zoneToXc(filterTable.zone),
37377
+ filters: [],
37378
+ });
37379
+ }
37380
+ }
37372
37381
  }
37373
37382
  }
37374
37383
 
@@ -41097,7 +41106,9 @@
41097
41106
  this.blockedArrayFormulas = new Set();
41098
41107
  this.spreadingRelations = new SpreadingRelation();
41099
41108
  this.formulaDependencies = lazy(() => {
41100
- const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId).map((range) => ({
41109
+ const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
41110
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
41111
+ .map((range) => ({
41101
41112
  data: positionId,
41102
41113
  boundingBox: {
41103
41114
  zone: range.zone,
@@ -55235,8 +55246,7 @@
55235
55246
  attrs.push(["t", "b"]);
55236
55247
  }
55237
55248
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
55238
- const { id } = pushElement(content, sharedStrings);
55239
- value = id.toString();
55249
+ value = pushElement(content, sharedStrings);
55240
55250
  attrs.push(["t", "s"]);
55241
55251
  }
55242
55252
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -55361,8 +55371,7 @@
55361
55371
  if (rule.style.fillColor) {
55362
55372
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
55363
55373
  }
55364
- const { id } = pushElement(dxf, dxfs);
55365
- ruleAttributes.push(["dxfId", id]);
55374
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
55366
55375
  return escapeXml /*xml*/ `
55367
55376
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
55368
55377
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -56171,7 +56180,7 @@
56171
56180
  */
56172
56181
  function getXLSX(data) {
56173
56182
  const files = [];
56174
- const construct = getDefaultXLSXStructure();
56183
+ const construct = getDefaultXLSXStructure(data);
56175
56184
  files.push(createWorkbook(data, construct));
56176
56185
  files.push(...createWorksheets(data, construct));
56177
56186
  files.push(createStylesSheet(construct));
@@ -57051,9 +57060,9 @@
57051
57060
  exports.tokenize = tokenize;
57052
57061
 
57053
57062
 
57054
- __info__.version = "17.0.17";
57055
- __info__.date = "2024-04-05T13:59:37.139Z";
57056
- __info__.hash = "33f09d7";
57063
+ __info__.version = "17.0.18";
57064
+ __info__.date = "2024-04-10T13:28:23.664Z";
57065
+ __info__.hash = "6294758";
57057
57066
 
57058
57067
 
57059
57068
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);