@odoo/o-spreadsheet 17.2.9 → 17.2.10

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.9
7
- * @date 2024-06-03T14:56:21.684Z
8
- * @hash 086af6d
6
+ * @version 17.2.10
7
+ * @date 2024-06-10T09:38:54.354Z
8
+ * @hash 14317ee
9
9
  */
10
10
 
11
11
  'use strict';
@@ -295,7 +295,10 @@ function deepCopy(obj) {
295
295
  * Check if the object is a plain old javascript object.
296
296
  */
297
297
  function isPlainObject(obj) {
298
- return typeof obj === "object" && obj?.constructor === Object;
298
+ return (typeof obj === "object" &&
299
+ obj !== null &&
300
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
301
+ (obj?.constructor === Object || obj?.constructor === undefined));
299
302
  }
300
303
  /**
301
304
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -19774,7 +19777,7 @@ function chartToImage(runtime, figure, type) {
19774
19777
  if ("chartJsConfig" in runtime) {
19775
19778
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
19776
19779
  // @ts-ignore
19777
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
19780
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
19778
19781
  const imgContent = chart.toBase64Image();
19779
19782
  chart.destroy();
19780
19783
  div.remove();
@@ -21720,8 +21723,7 @@ function zoneToRect(zone) {
21720
21723
  */
21721
21724
  function useSpreadsheetRect() {
21722
21725
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
21723
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
21724
- updatePosition();
21726
+ let spreadsheetElement = null;
21725
21727
  function updatePosition() {
21726
21728
  if (!spreadsheetElement) {
21727
21729
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -32432,8 +32434,15 @@ class Composer extends owl.Component {
32432
32434
  }
32433
32435
  onPaste(ev) {
32434
32436
  if (this.composerStore.editionMode !== "inactive") {
32437
+ // let the browser clipboard work
32435
32438
  ev.stopPropagation();
32436
32439
  }
32440
+ else {
32441
+ // the user meant to paste in the sheet, not open the composer with the pasted content
32442
+ // While we're not editing, we still have the focus and should therefore prevent
32443
+ // the native "paste" to occur.
32444
+ ev.preventDefault();
32445
+ }
32437
32446
  }
32438
32447
  /*
32439
32448
  * Triggered automatically by the content-editable between the keydown and key up
@@ -32442,9 +32451,6 @@ class Composer extends owl.Component {
32442
32451
  if (!this.shouldProcessInputEvents) {
32443
32452
  return;
32444
32453
  }
32445
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
32446
- return;
32447
- }
32448
32454
  ev.stopPropagation();
32449
32455
  let content;
32450
32456
  if (this.composerStore.editionMode === "inactive") {
@@ -32811,10 +32817,7 @@ class GridComposer extends owl.Component {
32811
32817
  }
32812
32818
  get containerStyle() {
32813
32819
  if (this.composerStore.editionMode === "inactive") {
32814
- return `
32815
- position: absolute;
32816
- z-index: -1000;
32817
- `;
32820
+ return `z-index: -1000;`;
32818
32821
  }
32819
32822
  const isFormula = this.composerStore.currentContent.startsWith("=");
32820
32823
  const cell = this.env.model.getters.getActiveCell();
@@ -60767,6 +60770,6 @@ exports.tokenColors = tokenColors;
60767
60770
  exports.tokenize = tokenize;
60768
60771
 
60769
60772
 
60770
- __info__.version = "17.2.9";
60771
- __info__.date = "2024-06-03T14:56:21.684Z";
60772
- __info__.hash = "086af6d";
60773
+ __info__.version = "17.2.10";
60774
+ __info__.date = "2024-06-10T09:38:54.354Z";
60775
+ __info__.hash = "14317ee";
@@ -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.9
7
- * @date 2024-06-03T14:56:21.684Z
8
- * @hash 086af6d
6
+ * @version 17.2.10
7
+ * @date 2024-06-10T09:38:54.354Z
8
+ * @hash 14317ee
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 } from '@odoo/owl';
@@ -293,7 +293,10 @@ function deepCopy(obj) {
293
293
  * Check if the object is a plain old javascript object.
294
294
  */
295
295
  function isPlainObject(obj) {
296
- return typeof obj === "object" && obj?.constructor === Object;
296
+ return (typeof obj === "object" &&
297
+ obj !== null &&
298
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
299
+ (obj?.constructor === Object || obj?.constructor === undefined));
297
300
  }
298
301
  /**
299
302
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -19772,7 +19775,7 @@ function chartToImage(runtime, figure, type) {
19772
19775
  if ("chartJsConfig" in runtime) {
19773
19776
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
19774
19777
  // @ts-ignore
19775
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
19778
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
19776
19779
  const imgContent = chart.toBase64Image();
19777
19780
  chart.destroy();
19778
19781
  div.remove();
@@ -21718,8 +21721,7 @@ function zoneToRect(zone) {
21718
21721
  */
21719
21722
  function useSpreadsheetRect() {
21720
21723
  const position = useState({ x: 0, y: 0, width: 0, height: 0 });
21721
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
21722
- updatePosition();
21724
+ let spreadsheetElement = null;
21723
21725
  function updatePosition() {
21724
21726
  if (!spreadsheetElement) {
21725
21727
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -32430,8 +32432,15 @@ class Composer extends Component {
32430
32432
  }
32431
32433
  onPaste(ev) {
32432
32434
  if (this.composerStore.editionMode !== "inactive") {
32435
+ // let the browser clipboard work
32433
32436
  ev.stopPropagation();
32434
32437
  }
32438
+ else {
32439
+ // the user meant to paste in the sheet, not open the composer with the pasted content
32440
+ // While we're not editing, we still have the focus and should therefore prevent
32441
+ // the native "paste" to occur.
32442
+ ev.preventDefault();
32443
+ }
32435
32444
  }
32436
32445
  /*
32437
32446
  * Triggered automatically by the content-editable between the keydown and key up
@@ -32440,9 +32449,6 @@ class Composer extends Component {
32440
32449
  if (!this.shouldProcessInputEvents) {
32441
32450
  return;
32442
32451
  }
32443
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
32444
- return;
32445
- }
32446
32452
  ev.stopPropagation();
32447
32453
  let content;
32448
32454
  if (this.composerStore.editionMode === "inactive") {
@@ -32809,10 +32815,7 @@ class GridComposer extends Component {
32809
32815
  }
32810
32816
  get containerStyle() {
32811
32817
  if (this.composerStore.editionMode === "inactive") {
32812
- return `
32813
- position: absolute;
32814
- z-index: -1000;
32815
- `;
32818
+ return `z-index: -1000;`;
32816
32819
  }
32817
32820
  const isFormula = this.composerStore.currentContent.startsWith("=");
32818
32821
  const cell = this.env.model.getters.getActiveCell();
@@ -60724,6 +60727,6 @@ const constants = {
60724
60727
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, 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 };
60725
60728
 
60726
60729
 
60727
- __info__.version = "17.2.9";
60728
- __info__.date = "2024-06-03T14:56:21.684Z";
60729
- __info__.hash = "086af6d";
60730
+ __info__.version = "17.2.10";
60731
+ __info__.date = "2024-06-10T09:38:54.354Z";
60732
+ __info__.hash = "14317ee";
@@ -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.9
7
- * @date 2024-06-03T14:56:21.684Z
8
- * @hash 086af6d
6
+ * @version 17.2.10
7
+ * @date 2024-06-10T09:38:54.354Z
8
+ * @hash 14317ee
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -294,7 +294,10 @@
294
294
  * Check if the object is a plain old javascript object.
295
295
  */
296
296
  function isPlainObject(obj) {
297
- return typeof obj === "object" && obj?.constructor === Object;
297
+ return (typeof obj === "object" &&
298
+ obj !== null &&
299
+ // obj.constructor can be undefined when there's no prototype (`Object.create(null, {})`)
300
+ (obj?.constructor === Object || obj?.constructor === undefined));
298
301
  }
299
302
  /**
300
303
  * Sanitize the name of a sheet, by eventually removing quotes
@@ -19773,7 +19776,7 @@ stores.inject(MyMetaStore, storeInstance);
19773
19776
  if ("chartJsConfig" in runtime) {
19774
19777
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
19775
19778
  // @ts-ignore
19776
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
19779
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
19777
19780
  const imgContent = chart.toBase64Image();
19778
19781
  chart.destroy();
19779
19782
  div.remove();
@@ -21719,8 +21722,7 @@ stores.inject(MyMetaStore, storeInstance);
21719
21722
  */
21720
21723
  function useSpreadsheetRect() {
21721
21724
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
21722
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
21723
- updatePosition();
21725
+ let spreadsheetElement = null;
21724
21726
  function updatePosition() {
21725
21727
  if (!spreadsheetElement) {
21726
21728
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -32431,8 +32433,15 @@ stores.inject(MyMetaStore, storeInstance);
32431
32433
  }
32432
32434
  onPaste(ev) {
32433
32435
  if (this.composerStore.editionMode !== "inactive") {
32436
+ // let the browser clipboard work
32434
32437
  ev.stopPropagation();
32435
32438
  }
32439
+ else {
32440
+ // the user meant to paste in the sheet, not open the composer with the pasted content
32441
+ // While we're not editing, we still have the focus and should therefore prevent
32442
+ // the native "paste" to occur.
32443
+ ev.preventDefault();
32444
+ }
32436
32445
  }
32437
32446
  /*
32438
32447
  * Triggered automatically by the content-editable between the keydown and key up
@@ -32441,9 +32450,6 @@ stores.inject(MyMetaStore, storeInstance);
32441
32450
  if (!this.shouldProcessInputEvents) {
32442
32451
  return;
32443
32452
  }
32444
- if (ev.inputType === "insertFromPaste" && this.composerStore.editionMode === "inactive") {
32445
- return;
32446
- }
32447
32453
  ev.stopPropagation();
32448
32454
  let content;
32449
32455
  if (this.composerStore.editionMode === "inactive") {
@@ -32810,10 +32816,7 @@ stores.inject(MyMetaStore, storeInstance);
32810
32816
  }
32811
32817
  get containerStyle() {
32812
32818
  if (this.composerStore.editionMode === "inactive") {
32813
- return `
32814
- position: absolute;
32815
- z-index: -1000;
32816
- `;
32819
+ return `z-index: -1000;`;
32817
32820
  }
32818
32821
  const isFormula = this.composerStore.currentContent.startsWith("=");
32819
32822
  const cell = this.env.model.getters.getActiveCell();
@@ -60766,9 +60769,9 @@ stores.inject(MyMetaStore, storeInstance);
60766
60769
  exports.tokenize = tokenize;
60767
60770
 
60768
60771
 
60769
- __info__.version = "17.2.9";
60770
- __info__.date = "2024-06-03T14:56:21.684Z";
60771
- __info__.hash = "086af6d";
60772
+ __info__.version = "17.2.10";
60773
+ __info__.date = "2024-06-10T09:38:54.354Z";
60774
+ __info__.hash = "14317ee";
60772
60775
 
60773
60776
 
60774
60777
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);