@odoo/o-spreadsheet 17.2.2 → 17.2.3

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.2
7
- * @date 2024-04-05T14:01:19.824Z
8
- * @hash c15836d
6
+ * @version 17.2.3
7
+ * @date 2024-04-10T12:28:36.552Z
8
+ * @hash ab5e22d
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -561,7 +561,7 @@
561
561
  if (typeof o1 !== typeof o2)
562
562
  return false;
563
563
  if (typeof o1 !== "object")
564
- return o1 === o2;
564
+ return false;
565
565
  // Objects can have different keys if the values are undefined
566
566
  for (const key in o2) {
567
567
  if (!(key in o1) && o2[key] !== undefined) {
@@ -31968,6 +31968,7 @@ stores.inject(MyMetaStore, storeInstance);
31968
31968
  onComposerCellFocused: { type: Function, optional: true },
31969
31969
  onComposerContentFocused: Function,
31970
31970
  isDefaultFocus: { type: Boolean, optional: true },
31971
+ onInputContextMenu: { type: Function, optional: true },
31971
31972
  };
31972
31973
  static components = { TextValueProvider, FunctionDescriptionProvider };
31973
31974
  static defaultProps = {
@@ -32018,6 +32019,9 @@ stores.inject(MyMetaStore, storeInstance);
32018
32019
  assistantStyle.right = `0px`;
32019
32020
  }
32020
32021
  }
32022
+ else if (this.props.delimitation) {
32023
+ assistantStyle["max-height"] = `${this.props.delimitation.height}px`;
32024
+ }
32021
32025
  return cssPropertiesToCss(assistantStyle);
32022
32026
  }
32023
32027
  // we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
@@ -32304,6 +32308,11 @@ stores.inject(MyMetaStore, storeInstance);
32304
32308
  }
32305
32309
  }
32306
32310
  }
32311
+ onContextMenu(ev) {
32312
+ if (this.composerStore.editionMode === "inactive") {
32313
+ this.props.onInputContextMenu?.(ev);
32314
+ }
32315
+ }
32307
32316
  // ---------------------------------------------------------------------------
32308
32317
  // Private
32309
32318
  // ---------------------------------------------------------------------------
@@ -32525,6 +32534,7 @@ stores.inject(MyMetaStore, storeInstance);
32525
32534
  static template = "o-spreadsheet-GridComposer";
32526
32535
  static props = {
32527
32536
  gridDims: Object,
32537
+ onInputContextMenu: Function,
32528
32538
  };
32529
32539
  static components = { Composer };
32530
32540
  rect = this.defaultRect;
@@ -32572,6 +32582,7 @@ stores.inject(MyMetaStore, storeInstance);
32572
32582
  isDefaultFocus: true,
32573
32583
  onComposerContentFocused: () => this.composerFocusStore.focusGridComposerContent(),
32574
32584
  onComposerCellFocused: (content) => this.composerFocusStore.focusGridComposerCell(content),
32585
+ onInputContextMenu: this.props.onInputContextMenu,
32575
32586
  };
32576
32587
  }
32577
32588
  get containerStyle() {
@@ -37294,29 +37305,12 @@ stores.inject(MyMetaStore, storeInstance);
37294
37305
  return width;
37295
37306
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
37296
37307
  }
37297
- function convertBorderDescr(descr) {
37298
- if (!descr) {
37299
- return undefined;
37300
- }
37301
- return {
37302
- style: descr.style,
37303
- color: { rgb: descr.color },
37304
- };
37305
- }
37306
37308
  function extractStyle(cell, data) {
37307
37309
  let style = {};
37308
37310
  if (cell.style) {
37309
37311
  style = data.styles[cell.style];
37310
37312
  }
37311
37313
  const format = extractFormat(cell, data);
37312
- const exportedBorder = {};
37313
- if (cell.border) {
37314
- const border = data.borders[cell.border];
37315
- exportedBorder.left = convertBorderDescr(border.left);
37316
- exportedBorder.right = convertBorderDescr(border.right);
37317
- exportedBorder.bottom = convertBorderDescr(border.bottom);
37318
- exportedBorder.top = convertBorderDescr(border.top);
37319
- }
37320
37314
  const styles = {
37321
37315
  font: {
37322
37316
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -37330,7 +37324,7 @@ stores.inject(MyMetaStore, storeInstance);
37330
37324
  }
37331
37325
  : { reservedAttribute: "none" },
37332
37326
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
37333
- border: exportedBorder || {},
37327
+ border: cell.border || 0,
37334
37328
  alignment: {
37335
37329
  horizontal: style.align,
37336
37330
  vertical: style.verticalAlign
@@ -37352,15 +37346,12 @@ stores.inject(MyMetaStore, storeInstance);
37352
37346
  return undefined;
37353
37347
  }
37354
37348
  function normalizeStyle(construct, styles) {
37355
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
37356
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
37357
- const { id: borderId } = pushElement(styles["border"], construct.borders);
37358
37349
  // Normalize this
37359
37350
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
37360
37351
  const style = {
37361
- fontId,
37362
- fillId,
37363
- borderId,
37352
+ fontId: pushElement(styles.font, construct.fonts),
37353
+ fillId: pushElement(styles.fill, construct.fills),
37354
+ borderId: styles.border,
37364
37355
  numFmtId,
37365
37356
  alignment: {
37366
37357
  vertical: styles.alignment.vertical,
@@ -37368,8 +37359,7 @@ stores.inject(MyMetaStore, storeInstance);
37368
37359
  wrapText: styles.alignment.wrapText,
37369
37360
  },
37370
37361
  };
37371
- const { id } = pushElement(style, construct.styles);
37372
- return id;
37362
+ return pushElement(style, construct.styles);
37373
37363
  }
37374
37364
  function convertFormat(format, numFmtStructure) {
37375
37365
  if (!format) {
@@ -37377,8 +37367,7 @@ stores.inject(MyMetaStore, storeInstance);
37377
37367
  }
37378
37368
  let formatId = XLSX_FORMAT_MAP[format.format];
37379
37369
  if (!formatId) {
37380
- const { id } = pushElement(format, numFmtStructure);
37381
- formatId = id + FIRST_NUMFMT_ID;
37370
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
37382
37371
  }
37383
37372
  return formatId;
37384
37373
  }
@@ -37403,20 +37392,15 @@ stores.inject(MyMetaStore, storeInstance);
37403
37392
  return id;
37404
37393
  }
37405
37394
  function pushElement(property, propertyList) {
37406
- for (let [key, value] of Object.entries(propertyList)) {
37407
- if (JSON.stringify(value) === JSON.stringify(property)) {
37408
- return { id: parseInt(key, 10), list: propertyList };
37395
+ let len = propertyList.length;
37396
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
37397
+ for (let i = 0; i < len; i++) {
37398
+ if (operator(property, propertyList[i])) {
37399
+ return i;
37409
37400
  }
37410
37401
  }
37411
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
37412
- if (elemId === -1) {
37413
- propertyList.push(property);
37414
- elemId = propertyList.length - 1;
37415
- }
37416
- return {
37417
- id: elemId,
37418
- list: propertyList,
37419
- };
37402
+ propertyList[propertyList.length] = property;
37403
+ return propertyList.length - 1;
37420
37404
  }
37421
37405
  const chartIds = [];
37422
37406
  /**
@@ -38211,7 +38195,25 @@ stores.inject(MyMetaStore, storeInstance);
38211
38195
  }
38212
38196
  return document;
38213
38197
  }
38214
- function getDefaultXLSXStructure() {
38198
+ function convertBorderDescr(descr) {
38199
+ if (!descr) {
38200
+ return undefined;
38201
+ }
38202
+ return {
38203
+ style: descr.style,
38204
+ color: { rgb: descr.color },
38205
+ };
38206
+ }
38207
+ function getDefaultXLSXStructure(data) {
38208
+ const xlsxBorders = Object.values(data.borders).map((border) => {
38209
+ return {
38210
+ left: convertBorderDescr(border.left),
38211
+ right: convertBorderDescr(border.right),
38212
+ bottom: convertBorderDescr(border.bottom),
38213
+ top: convertBorderDescr(border.top),
38214
+ };
38215
+ });
38216
+ const borders = [{}, ...xlsxBorders];
38215
38217
  return {
38216
38218
  relsFiles: [],
38217
38219
  sharedStrings: [],
@@ -38234,7 +38236,7 @@ stores.inject(MyMetaStore, storeInstance);
38234
38236
  },
38235
38237
  ],
38236
38238
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
38237
- borders: [{}],
38239
+ borders,
38238
38240
  numFmts: [],
38239
38241
  dxfs: [],
38240
38242
  };
@@ -45271,7 +45273,15 @@ stores.inject(MyMetaStore, storeInstance);
45271
45273
  }
45272
45274
  }
45273
45275
  exportForExcel(data) {
45274
- this.export(data);
45276
+ for (const sheet of data.sheets) {
45277
+ for (const table of this.getTables(sheet.id)) {
45278
+ if (zoneToDimension(table.range.zone).numberOfRows === 1) {
45279
+ continue;
45280
+ }
45281
+ const tableData = { range: zoneToXc(table.range.zone), filters: [] };
45282
+ sheet.tables.push(tableData);
45283
+ }
45284
+ }
45275
45285
  }
45276
45286
  }
45277
45287
 
@@ -47043,7 +47053,9 @@ stores.inject(MyMetaStore, storeInstance);
47043
47053
  this.blockedArrayFormulas = this.createEmptyPositionSet();
47044
47054
  this.spreadingRelations = new SpreadingRelation(this.createEmptyPositionSet.bind(this));
47045
47055
  this.formulaDependencies = lazy(() => {
47046
- const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position).map((range) => ({
47056
+ const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position)
47057
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
47058
+ .map((range) => ({
47047
47059
  data: position,
47048
47060
  boundingBox: {
47049
47061
  zone: range.zone,
@@ -55688,6 +55700,13 @@ stores.inject(MyMetaStore, storeInstance);
55688
55700
  "border-color": SELECTION_BORDER_COLOR,
55689
55701
  });
55690
55702
  }
55703
+ get delimitation() {
55704
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
55705
+ return {
55706
+ width,
55707
+ height,
55708
+ };
55709
+ }
55691
55710
  onFocus(selection) {
55692
55711
  this.composerFocusStore.focusTopBarComposer(selection);
55693
55712
  }
@@ -58319,8 +58338,7 @@ stores.inject(MyMetaStore, storeInstance);
58319
58338
  attrs.push(["t", "b"]);
58320
58339
  }
58321
58340
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
58322
- const { id } = pushElement(content, sharedStrings);
58323
- value = id.toString();
58341
+ value = pushElement(content, sharedStrings);
58324
58342
  attrs.push(["t", "s"]);
58325
58343
  }
58326
58344
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -58445,8 +58463,7 @@ stores.inject(MyMetaStore, storeInstance);
58445
58463
  if (rule.style.fillColor) {
58446
58464
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
58447
58465
  }
58448
- const { id } = pushElement(dxf, dxfs);
58449
- ruleAttributes.push(["dxfId", id]);
58466
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
58450
58467
  return escapeXml /*xml*/ `
58451
58468
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
58452
58469
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -59276,7 +59293,7 @@ stores.inject(MyMetaStore, storeInstance);
59276
59293
  */
59277
59294
  function getXLSX(data) {
59278
59295
  const files = [];
59279
- const construct = getDefaultXLSXStructure();
59296
+ const construct = getDefaultXLSXStructure(data);
59280
59297
  files.push(createWorkbook(data, construct));
59281
59298
  files.push(...createWorksheets(data, construct));
59282
59299
  files.push(createStylesSheet(construct));
@@ -60211,9 +60228,9 @@ stores.inject(MyMetaStore, storeInstance);
60211
60228
  exports.tokenize = tokenize;
60212
60229
 
60213
60230
 
60214
- __info__.version = "17.2.2";
60215
- __info__.date = "2024-04-05T14:01:19.824Z";
60216
- __info__.hash = "c15836d";
60231
+ __info__.version = "17.2.3";
60232
+ __info__.date = "2024-04-10T12:28:36.552Z";
60233
+ __info__.hash = "ab5e22d";
60217
60234
 
60218
60235
 
60219
60236
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);