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