@odoo/o-spreadsheet 17.4.0-alpha.2 → 17.4.0-alpha.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.4.0-alpha.2
7
- * @date 2024-06-06T13:31:21.327Z
8
- * @hash e07794d
6
+ * @version 17.4.0-alpha.3
7
+ * @date 2024-06-10T09:38:53.982Z
8
+ * @hash a45ed6a
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
@@ -25342,8 +25345,7 @@ function zoneToRect(zone) {
25342
25345
  */
25343
25346
  function useSpreadsheetRect() {
25344
25347
  const position = useState({ x: 0, y: 0, width: 0, height: 0 });
25345
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
25346
- updatePosition();
25348
+ let spreadsheetElement = null;
25347
25349
  function updatePosition() {
25348
25350
  if (!spreadsheetElement) {
25349
25351
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -34547,6 +34549,33 @@ class EditableName extends Component {
34547
34549
  }
34548
34550
  }
34549
34551
 
34552
+ css /* scss */ `
34553
+ .pivot-defer-update {
34554
+ min-height: 35px;
34555
+ background-color: #f8f9fa;
34556
+ }
34557
+ `;
34558
+ class PivotDeferUpdate extends Component {
34559
+ static template = "o-spreadsheet-PivotDeferUpdate";
34560
+ static props = {
34561
+ deferUpdate: Boolean,
34562
+ isDirty: Boolean,
34563
+ toggleDeferUpdate: Function,
34564
+ discard: Function,
34565
+ apply: Function,
34566
+ };
34567
+ static components = {
34568
+ Section,
34569
+ Checkbox,
34570
+ };
34571
+ get deferUpdatesLabel() {
34572
+ return _t("Defer updates");
34573
+ }
34574
+ get deferUpdatesTooltip() {
34575
+ return _t("Changing the pivot definition requires to reload the data. It may take some time.");
34576
+ }
34577
+ }
34578
+
34550
34579
  function useAutofocus({ refName }) {
34551
34580
  const ref = useRef(refName);
34552
34581
  useEffect((el) => {
@@ -36002,6 +36031,7 @@ class PivotSpreadsheetSidePanel extends Component {
36002
36031
  SelectionInput,
36003
36032
  EditableName,
36004
36033
  Checkbox,
36034
+ PivotDeferUpdate,
36005
36035
  };
36006
36036
  store;
36007
36037
  state;
@@ -36039,12 +36069,6 @@ class PivotSpreadsheetSidePanel extends Component {
36039
36069
  get definition() {
36040
36070
  return this.store.definition;
36041
36071
  }
36042
- get deferUpdatesLabel() {
36043
- return _t("Defer updates");
36044
- }
36045
- get deferUpdatesTooltip() {
36046
- return _t("Changing the pivot definition requires to reload the data. It may take some time.");
36047
- }
36048
36072
  onSelectionChanged(ranges) {
36049
36073
  this.state.rangeHasChanged = true;
36050
36074
  this.state.range = ranges[0];
@@ -54619,17 +54643,18 @@ class PivotUIPlugin extends UIPlugin {
54619
54643
  if (pivotCell.type === "EMPTY") {
54620
54644
  return undefined;
54621
54645
  }
54622
- const domain = pivotCell.domain;
54646
+ let domain = pivotCell.domain;
54623
54647
  if (domain.at(-1)?.field === "measure") {
54624
- return domain.slice(0, -1);
54648
+ domain = domain.slice(0, -1);
54625
54649
  }
54626
- return domain;
54650
+ return { domainArgs: domain, isHeader: pivotCell.type === "HEADER" };
54627
54651
  }
54628
- const domain = toPivotDomain(args.slice(functionName === "PIVOT.VALUE" ? 2 : 1).map((x) => `${x}`));
54652
+ let domain = toPivotDomain(args.slice(functionName === "PIVOT.VALUE" ? 2 : 1).map((x) => `${x}`));
54629
54653
  if (domain.at(-1)?.field === "measure") {
54630
- return domain.slice(0, -1);
54654
+ domain = domain.slice(0, -1);
54631
54655
  }
54632
- return domain;
54656
+ const isHeader = functionName === "PIVOT.HEADER";
54657
+ return { domainArgs: domain, isHeader };
54633
54658
  }
54634
54659
  getPivot(pivotId) {
54635
54660
  return this.pivots[pivotId];
@@ -66982,6 +67007,7 @@ const components = {
66982
67007
  PivotDimension,
66983
67008
  PivotLayoutConfigurator,
66984
67009
  EditableName,
67010
+ PivotDeferUpdate,
66985
67011
  };
66986
67012
  const hooks = {
66987
67013
  useDragAndDropListItems,
@@ -67022,6 +67048,6 @@ const constants = {
67022
67048
  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 };
67023
67049
 
67024
67050
 
67025
- __info__.version = "17.4.0-alpha.2";
67026
- __info__.date = "2024-06-06T13:31:21.327Z";
67027
- __info__.hash = "e07794d";
67051
+ __info__.version = "17.4.0-alpha.3";
67052
+ __info__.date = "2024-06-10T09:38:53.982Z";
67053
+ __info__.hash = "a45ed6a";
@@ -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.4.0-alpha.2
7
- * @date 2024-06-06T13:31:21.327Z
8
- * @hash e07794d
6
+ * @version 17.4.0-alpha.3
7
+ * @date 2024-06-10T09:38:53.982Z
8
+ * @hash a45ed6a
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
@@ -25343,8 +25346,7 @@ stores.inject(MyMetaStore, storeInstance);
25343
25346
  */
25344
25347
  function useSpreadsheetRect() {
25345
25348
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
25346
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
25347
- updatePosition();
25349
+ let spreadsheetElement = null;
25348
25350
  function updatePosition() {
25349
25351
  if (!spreadsheetElement) {
25350
25352
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -34548,6 +34550,33 @@ stores.inject(MyMetaStore, storeInstance);
34548
34550
  }
34549
34551
  }
34550
34552
 
34553
+ css /* scss */ `
34554
+ .pivot-defer-update {
34555
+ min-height: 35px;
34556
+ background-color: #f8f9fa;
34557
+ }
34558
+ `;
34559
+ class PivotDeferUpdate extends owl.Component {
34560
+ static template = "o-spreadsheet-PivotDeferUpdate";
34561
+ static props = {
34562
+ deferUpdate: Boolean,
34563
+ isDirty: Boolean,
34564
+ toggleDeferUpdate: Function,
34565
+ discard: Function,
34566
+ apply: Function,
34567
+ };
34568
+ static components = {
34569
+ Section,
34570
+ Checkbox,
34571
+ };
34572
+ get deferUpdatesLabel() {
34573
+ return _t("Defer updates");
34574
+ }
34575
+ get deferUpdatesTooltip() {
34576
+ return _t("Changing the pivot definition requires to reload the data. It may take some time.");
34577
+ }
34578
+ }
34579
+
34551
34580
  function useAutofocus({ refName }) {
34552
34581
  const ref = owl.useRef(refName);
34553
34582
  owl.useEffect((el) => {
@@ -36003,6 +36032,7 @@ stores.inject(MyMetaStore, storeInstance);
36003
36032
  SelectionInput,
36004
36033
  EditableName,
36005
36034
  Checkbox,
36035
+ PivotDeferUpdate,
36006
36036
  };
36007
36037
  store;
36008
36038
  state;
@@ -36040,12 +36070,6 @@ stores.inject(MyMetaStore, storeInstance);
36040
36070
  get definition() {
36041
36071
  return this.store.definition;
36042
36072
  }
36043
- get deferUpdatesLabel() {
36044
- return _t("Defer updates");
36045
- }
36046
- get deferUpdatesTooltip() {
36047
- return _t("Changing the pivot definition requires to reload the data. It may take some time.");
36048
- }
36049
36073
  onSelectionChanged(ranges) {
36050
36074
  this.state.rangeHasChanged = true;
36051
36075
  this.state.range = ranges[0];
@@ -54620,17 +54644,18 @@ stores.inject(MyMetaStore, storeInstance);
54620
54644
  if (pivotCell.type === "EMPTY") {
54621
54645
  return undefined;
54622
54646
  }
54623
- const domain = pivotCell.domain;
54647
+ let domain = pivotCell.domain;
54624
54648
  if (domain.at(-1)?.field === "measure") {
54625
- return domain.slice(0, -1);
54649
+ domain = domain.slice(0, -1);
54626
54650
  }
54627
- return domain;
54651
+ return { domainArgs: domain, isHeader: pivotCell.type === "HEADER" };
54628
54652
  }
54629
- const domain = toPivotDomain(args.slice(functionName === "PIVOT.VALUE" ? 2 : 1).map((x) => `${x}`));
54653
+ let domain = toPivotDomain(args.slice(functionName === "PIVOT.VALUE" ? 2 : 1).map((x) => `${x}`));
54630
54654
  if (domain.at(-1)?.field === "measure") {
54631
- return domain.slice(0, -1);
54655
+ domain = domain.slice(0, -1);
54632
54656
  }
54633
- return domain;
54657
+ const isHeader = functionName === "PIVOT.HEADER";
54658
+ return { domainArgs: domain, isHeader };
54634
54659
  }
54635
54660
  getPivot(pivotId) {
54636
54661
  return this.pivots[pivotId];
@@ -66983,6 +67008,7 @@ stores.inject(MyMetaStore, storeInstance);
66983
67008
  PivotDimension,
66984
67009
  PivotLayoutConfigurator,
66985
67010
  EditableName,
67011
+ PivotDeferUpdate,
66986
67012
  };
66987
67013
  const hooks = {
66988
67014
  useDragAndDropListItems,
@@ -67066,9 +67092,9 @@ stores.inject(MyMetaStore, storeInstance);
67066
67092
  exports.tokenize = tokenize;
67067
67093
 
67068
67094
 
67069
- __info__.version = "17.4.0-alpha.2";
67070
- __info__.date = "2024-06-06T13:31:21.327Z";
67071
- __info__.hash = "e07794d";
67095
+ __info__.version = "17.4.0-alpha.3";
67096
+ __info__.date = "2024-06-10T09:38:53.982Z";
67097
+ __info__.hash = "a45ed6a";
67072
67098
 
67073
67099
 
67074
67100
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);