@odoo/o-spreadsheet 17.1.17 → 17.1.18

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.1.17
6
- * @date 2024-06-03T14:54:06.711Z
7
- * @hash 7dedb2f
5
+ * @version 17.1.18
6
+ * @date 2024-06-10T09:34:55.045Z
7
+ * @hash 0e756ce
8
8
  */
9
9
 
10
10
  '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
@@ -6841,8 +6844,7 @@ function isCtrlKey(ev) {
6841
6844
  */
6842
6845
  function useSpreadsheetRect() {
6843
6846
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
6844
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
6845
- updatePosition();
6847
+ let spreadsheetElement = null;
6846
6848
  function updatePosition() {
6847
6849
  if (!spreadsheetElement) {
6848
6850
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -8606,7 +8608,7 @@ function chartToImage(runtime, figure, type) {
8606
8608
  if ("chartJsConfig" in runtime) {
8607
8609
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
8608
8610
  // @ts-ignore
8609
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
8611
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
8610
8612
  const imgContent = chart.toBase64Image();
8611
8613
  chart.destroy();
8612
8614
  div.remove();
@@ -27375,8 +27377,15 @@ class Composer extends owl.Component {
27375
27377
  }
27376
27378
  onPaste(ev) {
27377
27379
  if (this.env.model.getters.getEditionMode() !== "inactive") {
27380
+ // let the browser clipboard work
27378
27381
  ev.stopPropagation();
27379
27382
  }
27383
+ else {
27384
+ // the user meant to paste in the sheet, not open the composer with the pasted content
27385
+ // While we're not editing, we still have the focus and should therefore prevent
27386
+ // the native "paste" to occur.
27387
+ ev.preventDefault();
27388
+ }
27380
27389
  }
27381
27390
  /*
27382
27391
  * Triggered automatically by the content-editable between the keydown and key up
@@ -27385,10 +27394,6 @@ class Composer extends owl.Component {
27385
27394
  if (!this.shouldProcessInputEvents) {
27386
27395
  return;
27387
27396
  }
27388
- if (ev.inputType === "insertFromPaste" &&
27389
- this.env.model.getters.getEditionMode() === "inactive") {
27390
- return;
27391
- }
27392
27397
  ev.stopPropagation();
27393
27398
  let content;
27394
27399
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -27829,10 +27834,7 @@ class GridComposer extends owl.Component {
27829
27834
  }
27830
27835
  get containerStyle() {
27831
27836
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
27832
- return `
27833
- position: absolute;
27834
- z-index: -1000;
27835
- `;
27837
+ return `z-index: -1000;`;
27836
27838
  }
27837
27839
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
27838
27840
  const cell = this.env.model.getters.getActiveCell();
@@ -57775,6 +57777,6 @@ exports.setTranslationMethod = setTranslationMethod;
57775
57777
  exports.tokenize = tokenize;
57776
57778
 
57777
57779
 
57778
- __info__.version = "17.1.17";
57779
- __info__.date = "2024-06-03T14:54:06.711Z";
57780
- __info__.hash = "7dedb2f";
57780
+ __info__.version = "17.1.18";
57781
+ __info__.date = "2024-06-10T09:34:55.045Z";
57782
+ __info__.hash = "0e756ce";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.1.17
6
- * @date 2024-06-03T14:54:06.711Z
7
- * @hash 7dedb2f
5
+ * @version 17.1.18
6
+ * @date 2024-06-10T09:34:55.045Z
7
+ * @hash 0e756ce
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, onWillUnmount, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillStart, xml, useChildSubEnv, useSubEnv, 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
@@ -6839,8 +6842,7 @@ function isCtrlKey(ev) {
6839
6842
  */
6840
6843
  function useSpreadsheetRect() {
6841
6844
  const position = useState({ x: 0, y: 0, width: 0, height: 0 });
6842
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
6843
- updatePosition();
6845
+ let spreadsheetElement = null;
6844
6846
  function updatePosition() {
6845
6847
  if (!spreadsheetElement) {
6846
6848
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -8604,7 +8606,7 @@ function chartToImage(runtime, figure, type) {
8604
8606
  if ("chartJsConfig" in runtime) {
8605
8607
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
8606
8608
  // @ts-ignore
8607
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
8609
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
8608
8610
  const imgContent = chart.toBase64Image();
8609
8611
  chart.destroy();
8610
8612
  div.remove();
@@ -27373,8 +27375,15 @@ class Composer extends Component {
27373
27375
  }
27374
27376
  onPaste(ev) {
27375
27377
  if (this.env.model.getters.getEditionMode() !== "inactive") {
27378
+ // let the browser clipboard work
27376
27379
  ev.stopPropagation();
27377
27380
  }
27381
+ else {
27382
+ // the user meant to paste in the sheet, not open the composer with the pasted content
27383
+ // While we're not editing, we still have the focus and should therefore prevent
27384
+ // the native "paste" to occur.
27385
+ ev.preventDefault();
27386
+ }
27378
27387
  }
27379
27388
  /*
27380
27389
  * Triggered automatically by the content-editable between the keydown and key up
@@ -27383,10 +27392,6 @@ class Composer extends Component {
27383
27392
  if (!this.shouldProcessInputEvents) {
27384
27393
  return;
27385
27394
  }
27386
- if (ev.inputType === "insertFromPaste" &&
27387
- this.env.model.getters.getEditionMode() === "inactive") {
27388
- return;
27389
- }
27390
27395
  ev.stopPropagation();
27391
27396
  let content;
27392
27397
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -27827,10 +27832,7 @@ class GridComposer extends Component {
27827
27832
  }
27828
27833
  get containerStyle() {
27829
27834
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
27830
- return `
27831
- position: absolute;
27832
- z-index: -1000;
27833
- `;
27835
+ return `z-index: -1000;`;
27834
27836
  }
27835
27837
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
27836
27838
  const cell = this.env.model.getters.getActiveCell();
@@ -57737,6 +57739,6 @@ const constants = {
57737
57739
  export { AbstractChart, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57738
57740
 
57739
57741
 
57740
- __info__.version = "17.1.17";
57741
- __info__.date = "2024-06-03T14:54:06.711Z";
57742
- __info__.hash = "7dedb2f";
57742
+ __info__.version = "17.1.18";
57743
+ __info__.date = "2024-06-10T09:34:55.045Z";
57744
+ __info__.hash = "0e756ce";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.1.17
6
- * @date 2024-06-03T14:54:06.711Z
7
- * @hash 7dedb2f
5
+ * @version 17.1.18
6
+ * @date 2024-06-10T09:34:55.045Z
7
+ * @hash 0e756ce
8
8
  */
9
9
 
10
10
  (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
@@ -6840,8 +6843,7 @@
6840
6843
  */
6841
6844
  function useSpreadsheetRect() {
6842
6845
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
6843
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
6844
- updatePosition();
6846
+ let spreadsheetElement = null;
6845
6847
  function updatePosition() {
6846
6848
  if (!spreadsheetElement) {
6847
6849
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -8605,7 +8607,7 @@
8605
8607
  if ("chartJsConfig" in runtime) {
8606
8608
  runtime.chartJsConfig.plugins = [backgroundColorChartJSPlugin];
8607
8609
  // @ts-ignore
8608
- const chart = new window.Chart(canvas, runtime.chartJsConfig);
8610
+ const chart = new window.Chart(canvas, deepCopy(runtime.chartJsConfig));
8609
8611
  const imgContent = chart.toBase64Image();
8610
8612
  chart.destroy();
8611
8613
  div.remove();
@@ -27374,8 +27376,15 @@
27374
27376
  }
27375
27377
  onPaste(ev) {
27376
27378
  if (this.env.model.getters.getEditionMode() !== "inactive") {
27379
+ // let the browser clipboard work
27377
27380
  ev.stopPropagation();
27378
27381
  }
27382
+ else {
27383
+ // the user meant to paste in the sheet, not open the composer with the pasted content
27384
+ // While we're not editing, we still have the focus and should therefore prevent
27385
+ // the native "paste" to occur.
27386
+ ev.preventDefault();
27387
+ }
27379
27388
  }
27380
27389
  /*
27381
27390
  * Triggered automatically by the content-editable between the keydown and key up
@@ -27384,10 +27393,6 @@
27384
27393
  if (!this.shouldProcessInputEvents) {
27385
27394
  return;
27386
27395
  }
27387
- if (ev.inputType === "insertFromPaste" &&
27388
- this.env.model.getters.getEditionMode() === "inactive") {
27389
- return;
27390
- }
27391
27396
  ev.stopPropagation();
27392
27397
  let content;
27393
27398
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -27828,10 +27833,7 @@
27828
27833
  }
27829
27834
  get containerStyle() {
27830
27835
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
27831
- return `
27832
- position: absolute;
27833
- z-index: -1000;
27834
- `;
27836
+ return `z-index: -1000;`;
27835
27837
  }
27836
27838
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
27837
27839
  const cell = this.env.model.getters.getActiveCell();
@@ -57774,9 +57776,9 @@
57774
57776
  exports.tokenize = tokenize;
57775
57777
 
57776
57778
 
57777
- __info__.version = "17.1.17";
57778
- __info__.date = "2024-06-03T14:54:06.711Z";
57779
- __info__.hash = "7dedb2f";
57779
+ __info__.version = "17.1.18";
57780
+ __info__.date = "2024-06-10T09:34:55.045Z";
57781
+ __info__.hash = "0e756ce";
57780
57782
 
57781
57783
 
57782
57784
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);