@odoo/o-spreadsheet 17.3.1 → 17.3.2

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.3.1
7
- * @date 2024-06-03T15:28:03.284Z
8
- * @hash 605d098
6
+ * @version 17.3.2
7
+ * @date 2024-06-10T09:38:56.657Z
8
+ * @hash c3b358f
9
9
  */
10
10
 
11
11
  'use strict';
@@ -311,7 +311,10 @@ function deepCopy(obj) {
311
311
  * Check if the object is a plain old javascript object.
312
312
  */
313
313
  function isPlainObject(obj) {
314
- return typeof obj === "object" && obj?.constructor === Object;
314
+ return (typeof obj === "object" &&
315
+ obj !== null &&
316
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
317
+ (obj?.constructor === Object || obj?.constructor === undefined));
315
318
  }
316
319
  /**
317
320
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -20902,8 +20905,15 @@ class Composer extends owl.Component {
20902
20905
  }
20903
20906
  onPaste(ev) {
20904
20907
  if (this.composerStore.editionMode !== "inactive") {
20908
+ // let the browser clipboard work
20905
20909
  ev.stopPropagation();
20906
20910
  }
20911
+ else {
20912
+ // the user meant to paste in the sheet, not open the composer with the pasted content
20913
+ // While we're not editing, we still have the focus and should therefore prevent
20914
+ // the native "paste" to occur.
20915
+ ev.preventDefault();
20916
+ }
20907
20917
  }
20908
20918
  /*
20909
20919
  * Triggered automatically by the content-editable between the keydown and key up
@@ -20912,9 +20922,6 @@ class Composer extends owl.Component {
20912
20922
  if (!this.shouldProcessInputEvents) {
20913
20923
  return;
20914
20924
  }
20915
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
20916
- return;
20917
- }
20918
20925
  ev.stopPropagation();
20919
20926
  let content;
20920
20927
  if (this.composerStore.editionMode === "inactive") {
@@ -25323,8 +25330,7 @@ function zoneToRect(zone) {
25323
25330
  */
25324
25331
  function useSpreadsheetRect() {
25325
25332
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
25326
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
25327
- updatePosition();
25333
+ let spreadsheetElement = null;
25328
25334
  function updatePosition() {
25329
25335
  if (!spreadsheetElement) {
25330
25336
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -37918,10 +37924,7 @@ class GridComposer extends owl.Component {
37918
37924
  }
37919
37925
  get containerStyle() {
37920
37926
  if (this.composerStore.editionMode === "inactive") {
37921
- return `
37922
- position: absolute;
37923
- z-index: -1000;
37924
- `;
37927
+ return `z-index: -1000;`;
37925
37928
  }
37926
37929
  const isFormula = this.composerStore.currentContent.startsWith("=");
37927
37930
  const cell = this.env.model.getters.getActiveCell();
@@ -54568,17 +54571,18 @@ class PivotUIPlugin extends UIPlugin {
54568
54571
  const pivotCol = position.col - mainPosition.col;
54569
54572
  const pivotRow = position.row - mainPosition.row;
54570
54573
  const pivotCell = pivotCells[pivotCol][pivotRow];
54571
- const domain = pivotCell.domain;
54574
+ let domain = pivotCell.domain;
54572
54575
  if (domain?.at(-2) === "measure") {
54573
- return domain.slice(0, -2);
54576
+ domain = domain.slice(0, -2);
54574
54577
  }
54575
- return domain;
54578
+ return { domainArgs: domain, isHeader: pivotCell.isHeader };
54576
54579
  }
54577
- const domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54580
+ let domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54578
54581
  if (domain.at(-2) === "measure") {
54579
- return domain.slice(0, -2);
54582
+ domain = domain.slice(0, -2);
54580
54583
  }
54581
- return domain;
54584
+ const isHeader = functionName === "PIVOT.HEADER";
54585
+ return { domainArgs: domain, isHeader };
54582
54586
  }
54583
54587
  getPivot(pivotId) {
54584
54588
  return this.pivots[pivotId];
@@ -66989,6 +66993,6 @@ exports.tokenColors = tokenColors;
66989
66993
  exports.tokenize = tokenize;
66990
66994
 
66991
66995
 
66992
- __info__.version = "17.3.1";
66993
- __info__.date = "2024-06-03T15:28:03.284Z";
66994
- __info__.hash = "605d098";
66996
+ __info__.version = "17.3.2";
66997
+ __info__.date = "2024-06-10T09:38:56.657Z";
66998
+ __info__.hash = "c3b358f";
@@ -4272,7 +4272,13 @@ declare class PivotUIPlugin extends UIPlugin {
4272
4272
  * If the cell is the result of PIVOT, the result is the domain of the cell
4273
4273
  * as if it was the individual pivot formula
4274
4274
  */
4275
- getPivotDomainArgsFromPosition(position: CellPosition): (CellValue | Matrix<CellValue> | undefined)[] | undefined;
4275
+ getPivotDomainArgsFromPosition(position: CellPosition): {
4276
+ domainArgs: string[] | undefined;
4277
+ isHeader: boolean;
4278
+ } | {
4279
+ domainArgs: (CellValue | Matrix<CellValue> | undefined)[];
4280
+ isHeader: boolean;
4281
+ } | undefined;
4276
4282
  getPivot(pivotId: UID): Pivot<PivotRuntimeDefinition>;
4277
4283
  isPivotUnused(pivotId: UID): boolean;
4278
4284
  /**
@@ -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.3.1
7
- * @date 2024-06-03T15:28:03.284Z
8
- * @hash 605d098
6
+ * @version 17.3.2
7
+ * @date 2024-06-10T09:38:56.657Z
8
+ * @hash c3b358f
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -309,7 +309,10 @@ function deepCopy(obj) {
309
309
  * Check if the object is a plain old javascript object.
310
310
  */
311
311
  function isPlainObject(obj) {
312
- return typeof obj === "object" && obj?.constructor === Object;
312
+ return (typeof obj === "object" &&
313
+ obj !== null &&
314
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
315
+ (obj?.constructor === Object || obj?.constructor === undefined));
313
316
  }
314
317
  /**
315
318
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -20900,8 +20903,15 @@ class Composer extends Component {
20900
20903
  }
20901
20904
  onPaste(ev) {
20902
20905
  if (this.composerStore.editionMode !== "inactive") {
20906
+ // let the browser clipboard work
20903
20907
  ev.stopPropagation();
20904
20908
  }
20909
+ else {
20910
+ // the user meant to paste in the sheet, not open the composer with the pasted content
20911
+ // While we're not editing, we still have the focus and should therefore prevent
20912
+ // the native "paste" to occur.
20913
+ ev.preventDefault();
20914
+ }
20905
20915
  }
20906
20916
  /*
20907
20917
  * Triggered automatically by the content-editable between the keydown and key up
@@ -20910,9 +20920,6 @@ class Composer extends Component {
20910
20920
  if (!this.shouldProcessInputEvents) {
20911
20921
  return;
20912
20922
  }
20913
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
20914
- return;
20915
- }
20916
20923
  ev.stopPropagation();
20917
20924
  let content;
20918
20925
  if (this.composerStore.editionMode === "inactive") {
@@ -25321,8 +25328,7 @@ function zoneToRect(zone) {
25321
25328
  */
25322
25329
  function useSpreadsheetRect() {
25323
25330
  const position = useState({ x: 0, y: 0, width: 0, height: 0 });
25324
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
25325
- updatePosition();
25331
+ let spreadsheetElement = null;
25326
25332
  function updatePosition() {
25327
25333
  if (!spreadsheetElement) {
25328
25334
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -37916,10 +37922,7 @@ class GridComposer extends Component {
37916
37922
  }
37917
37923
  get containerStyle() {
37918
37924
  if (this.composerStore.editionMode === "inactive") {
37919
- return `
37920
- position: absolute;
37921
- z-index: -1000;
37922
- `;
37925
+ return `z-index: -1000;`;
37923
37926
  }
37924
37927
  const isFormula = this.composerStore.currentContent.startsWith("=");
37925
37928
  const cell = this.env.model.getters.getActiveCell();
@@ -54566,17 +54569,18 @@ class PivotUIPlugin extends UIPlugin {
54566
54569
  const pivotCol = position.col - mainPosition.col;
54567
54570
  const pivotRow = position.row - mainPosition.row;
54568
54571
  const pivotCell = pivotCells[pivotCol][pivotRow];
54569
- const domain = pivotCell.domain;
54572
+ let domain = pivotCell.domain;
54570
54573
  if (domain?.at(-2) === "measure") {
54571
- return domain.slice(0, -2);
54574
+ domain = domain.slice(0, -2);
54572
54575
  }
54573
- return domain;
54576
+ return { domainArgs: domain, isHeader: pivotCell.isHeader };
54574
54577
  }
54575
- const domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54578
+ let domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54576
54579
  if (domain.at(-2) === "measure") {
54577
- return domain.slice(0, -2);
54580
+ domain = domain.slice(0, -2);
54578
54581
  }
54579
- return domain;
54582
+ const isHeader = functionName === "PIVOT.HEADER";
54583
+ return { domainArgs: domain, isHeader };
54580
54584
  }
54581
54585
  getPivot(pivotId) {
54582
54586
  return this.pivots[pivotId];
@@ -66944,6 +66948,6 @@ const constants = {
66944
66948
  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 };
66945
66949
 
66946
66950
 
66947
- __info__.version = "17.3.1";
66948
- __info__.date = "2024-06-03T15:28:03.284Z";
66949
- __info__.hash = "605d098";
66951
+ __info__.version = "17.3.2";
66952
+ __info__.date = "2024-06-10T09:38:56.657Z";
66953
+ __info__.hash = "c3b358f";
@@ -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.3.1
7
- * @date 2024-06-03T15:28:03.284Z
8
- * @hash 605d098
6
+ * @version 17.3.2
7
+ * @date 2024-06-10T09:38:56.657Z
8
+ * @hash c3b358f
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -310,7 +310,10 @@
310
310
  * Check if the object is a plain old javascript object.
311
311
  */
312
312
  function isPlainObject(obj) {
313
- return typeof obj === "object" && obj?.constructor === Object;
313
+ return (typeof obj === "object" &&
314
+ obj !== null &&
315
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
316
+ (obj?.constructor === Object || obj?.constructor === undefined));
314
317
  }
315
318
  /**
316
319
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -20901,8 +20904,15 @@ stores.inject(MyMetaStore, storeInstance);
20901
20904
  }
20902
20905
  onPaste(ev) {
20903
20906
  if (this.composerStore.editionMode !== "inactive") {
20907
+ // let the browser clipboard work
20904
20908
  ev.stopPropagation();
20905
20909
  }
20910
+ else {
20911
+ // the user meant to paste in the sheet, not open the composer with the pasted content
20912
+ // While we're not editing, we still have the focus and should therefore prevent
20913
+ // the native "paste" to occur.
20914
+ ev.preventDefault();
20915
+ }
20906
20916
  }
20907
20917
  /*
20908
20918
  * Triggered automatically by the content-editable between the keydown and key up
@@ -20911,9 +20921,6 @@ stores.inject(MyMetaStore, storeInstance);
20911
20921
  if (!this.shouldProcessInputEvents) {
20912
20922
  return;
20913
20923
  }
20914
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
20915
- return;
20916
- }
20917
20924
  ev.stopPropagation();
20918
20925
  let content;
20919
20926
  if (this.composerStore.editionMode === "inactive") {
@@ -25322,8 +25329,7 @@ stores.inject(MyMetaStore, storeInstance);
25322
25329
  */
25323
25330
  function useSpreadsheetRect() {
25324
25331
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
25325
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
25326
- updatePosition();
25332
+ let spreadsheetElement = null;
25327
25333
  function updatePosition() {
25328
25334
  if (!spreadsheetElement) {
25329
25335
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -37917,10 +37923,7 @@ stores.inject(MyMetaStore, storeInstance);
37917
37923
  }
37918
37924
  get containerStyle() {
37919
37925
  if (this.composerStore.editionMode === "inactive") {
37920
- return `
37921
- position: absolute;
37922
- z-index: -1000;
37923
- `;
37926
+ return `z-index: -1000;`;
37924
37927
  }
37925
37928
  const isFormula = this.composerStore.currentContent.startsWith("=");
37926
37929
  const cell = this.env.model.getters.getActiveCell();
@@ -54567,17 +54570,18 @@ stores.inject(MyMetaStore, storeInstance);
54567
54570
  const pivotCol = position.col - mainPosition.col;
54568
54571
  const pivotRow = position.row - mainPosition.row;
54569
54572
  const pivotCell = pivotCells[pivotCol][pivotRow];
54570
- const domain = pivotCell.domain;
54573
+ let domain = pivotCell.domain;
54571
54574
  if (domain?.at(-2) === "measure") {
54572
- return domain.slice(0, -2);
54575
+ domain = domain.slice(0, -2);
54573
54576
  }
54574
- return domain;
54577
+ return { domainArgs: domain, isHeader: pivotCell.isHeader };
54575
54578
  }
54576
- const domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54579
+ let domain = args.slice(functionName === "PIVOT.VALUE" ? 2 : 1);
54577
54580
  if (domain.at(-2) === "measure") {
54578
- return domain.slice(0, -2);
54581
+ domain = domain.slice(0, -2);
54579
54582
  }
54580
- return domain;
54583
+ const isHeader = functionName === "PIVOT.HEADER";
54584
+ return { domainArgs: domain, isHeader };
54581
54585
  }
54582
54586
  getPivot(pivotId) {
54583
54587
  return this.pivots[pivotId];
@@ -66988,9 +66992,9 @@ stores.inject(MyMetaStore, storeInstance);
66988
66992
  exports.tokenize = tokenize;
66989
66993
 
66990
66994
 
66991
- __info__.version = "17.3.1";
66992
- __info__.date = "2024-06-03T15:28:03.284Z";
66993
- __info__.hash = "605d098";
66995
+ __info__.version = "17.3.2";
66996
+ __info__.date = "2024-06-10T09:38:56.657Z";
66997
+ __info__.hash = "c3b358f";
66994
66998
 
66995
66999
 
66996
67000
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);