@odoo/o-spreadsheet 17.0.44 → 17.0.45

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.0.44
6
- * @date 2024-12-19T07:46:10.942Z
7
- * @hash 820f3cf
5
+ * @version 17.0.45
6
+ * @date 2025-01-14T11:30:44.730Z
7
+ * @hash 94f8ef9
8
8
  */
9
9
 
10
10
  'use strict';
@@ -31735,7 +31735,7 @@ function convertFigure(figure, id, sheetData) {
31735
31735
  return undefined;
31736
31736
  }
31737
31737
  function isChartData(data) {
31738
- return "dataSets" in data;
31738
+ return "dataSets" in data && data.dataSets.length > 0;
31739
31739
  }
31740
31740
  function isImageData(data) {
31741
31741
  return "imageSrc" in data;
@@ -34549,10 +34549,34 @@ class BordersPlugin extends CorePlugin {
34549
34549
  const elements = [...cmd.elements].sort((a, b) => b - a);
34550
34550
  for (const group of groupConsecutive(elements)) {
34551
34551
  if (cmd.dimension === "COL") {
34552
- this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34552
+ if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
34553
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34554
+ this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
34555
+ }
34556
+ }
34557
+ if (group[group.length - 1] === 0) {
34558
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34559
+ this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
34560
+ }
34561
+ }
34562
+ const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34563
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34564
+ this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
34553
34565
  }
34554
34566
  else {
34555
- this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34567
+ if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
34568
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34569
+ this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
34570
+ }
34571
+ }
34572
+ if (group[group.length - 1] === 0) {
34573
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34574
+ this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
34575
+ }
34576
+ }
34577
+ const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34578
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34579
+ this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
34556
34580
  }
34557
34581
  }
34558
34582
  break;
@@ -34859,6 +34883,18 @@ class BordersPlugin extends CorePlugin {
34859
34883
  }
34860
34884
  }
34861
34885
  }
34886
+ /**
34887
+ * Remove the borders inside of a zone
34888
+ */
34889
+ clearInsideBorders(sheetId, zones) {
34890
+ for (let zone of zones) {
34891
+ for (let row = zone.top; row <= zone.bottom; row++) {
34892
+ for (let col = zone.left; col <= zone.right; col++) {
34893
+ this.history.update("borders", sheetId, col, row, undefined);
34894
+ }
34895
+ }
34896
+ }
34897
+ }
34862
34898
  /**
34863
34899
  * Add a border to the existing one to a cell
34864
34900
  */
@@ -51858,17 +51894,17 @@ class BottomBarSheet extends owl.Component {
51858
51894
  sheetNameRef = owl.useRef("sheetNameSpan");
51859
51895
  editionState = "initializing";
51860
51896
  setup() {
51861
- owl.onMounted(() => {
51862
- if (this.isSheetActive) {
51863
- this.scrollToSheet();
51864
- }
51865
- });
51866
51897
  owl.onPatched(() => {
51867
51898
  if (this.sheetNameRef.el && this.state.isEditing && this.editionState === "initializing") {
51868
51899
  this.editionState = "editing";
51869
51900
  this.focusInputAndSelectContent();
51870
51901
  }
51871
51902
  });
51903
+ owl.useEffect((sheetId) => {
51904
+ if (this.props.sheetId === sheetId) {
51905
+ this.scrollToSheet();
51906
+ }
51907
+ }, () => [this.env.model.getters.getActiveSheetId()]);
51872
51908
  }
51873
51909
  focusInputAndSelectContent() {
51874
51910
  if (!this.state.isEditing || !this.sheetNameRef.el)
@@ -51880,7 +51916,10 @@ class BottomBarSheet extends owl.Component {
51880
51916
  }
51881
51917
  }
51882
51918
  scrollToSheet() {
51883
- this.sheetDivRef.el?.scrollIntoView?.();
51919
+ this.sheetDivRef.el?.scrollIntoView?.({
51920
+ behavior: "smooth",
51921
+ inline: "nearest",
51922
+ });
51884
51923
  }
51885
51924
  onFocusOut() {
51886
51925
  if (this.state.isEditing && this.editionState !== "initializing") {
@@ -57631,6 +57670,8 @@ const helpers = {
57631
57670
  createActions,
57632
57671
  transformRangeData,
57633
57672
  deepEquals,
57673
+ isNumber,
57674
+ isDateTime,
57634
57675
  };
57635
57676
  const links = {
57636
57677
  isMarkdownLink,
@@ -57709,6 +57750,6 @@ exports.setTranslationMethod = setTranslationMethod;
57709
57750
  exports.tokenize = tokenize;
57710
57751
 
57711
57752
 
57712
- __info__.version = "17.0.44";
57713
- __info__.date = "2024-12-19T07:46:10.942Z";
57714
- __info__.hash = "820f3cf";
57753
+ __info__.version = "17.0.45";
57754
+ __info__.date = "2025-01-14T11:30:44.730Z";
57755
+ __info__.hash = "94f8ef9";
@@ -968,6 +968,7 @@ declare class DateTime {
968
968
  setMinutes(minutes: number): number;
969
969
  setSeconds(seconds: number): number;
970
970
  }
971
+ declare function isDateTime(str: string, locale: Locale): boolean;
971
972
 
972
973
  /**
973
974
  * Formats a cell value with its format.
@@ -998,6 +999,13 @@ declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
998
999
  */
999
1000
  declare function deepEquals(o1: any, o2: any): boolean;
1000
1001
 
1002
+ /**
1003
+ * Return true if the argument is a "number string".
1004
+ *
1005
+ * Note that "" (empty string) does not count as a number string
1006
+ */
1007
+ declare function isNumber(value: string | undefined, locale: Locale): boolean;
1008
+
1001
1009
  interface ConstructorArgs {
1002
1010
  readonly zone: Readonly<Zone | UnboundedZone>;
1003
1011
  readonly parts: readonly RangePart[];
@@ -3375,6 +3383,10 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
3375
3383
  * Remove the borders of a zone
3376
3384
  */
3377
3385
  private clearBorders;
3386
+ /**
3387
+ * Remove the borders inside of a zone
3388
+ */
3389
+ private clearInsideBorders;
3378
3390
  /**
3379
3391
  * Add a border to the existing one to a cell
3380
3392
  */
@@ -7956,6 +7968,8 @@ declare const helpers: {
7956
7968
  createActions: typeof createActions;
7957
7969
  transformRangeData: typeof transformRangeData;
7958
7970
  deepEquals: typeof deepEquals;
7971
+ isNumber: typeof isNumber;
7972
+ isDateTime: typeof isDateTime;
7959
7973
  };
7960
7974
  declare const links: {
7961
7975
  isMarkdownLink: typeof isMarkdownLink;
@@ -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.0.44
6
- * @date 2024-12-19T07:46:10.942Z
7
- * @hash 820f3cf
5
+ * @version 17.0.45
6
+ * @date 2025-01-14T11:30:44.730Z
7
+ * @hash 94f8ef9
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -31733,7 +31733,7 @@ function convertFigure(figure, id, sheetData) {
31733
31733
  return undefined;
31734
31734
  }
31735
31735
  function isChartData(data) {
31736
- return "dataSets" in data;
31736
+ return "dataSets" in data && data.dataSets.length > 0;
31737
31737
  }
31738
31738
  function isImageData(data) {
31739
31739
  return "imageSrc" in data;
@@ -34547,10 +34547,34 @@ class BordersPlugin extends CorePlugin {
34547
34547
  const elements = [...cmd.elements].sort((a, b) => b - a);
34548
34548
  for (const group of groupConsecutive(elements)) {
34549
34549
  if (cmd.dimension === "COL") {
34550
- this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34550
+ if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
34551
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34552
+ this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
34553
+ }
34554
+ }
34555
+ if (group[group.length - 1] === 0) {
34556
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34557
+ this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
34558
+ }
34559
+ }
34560
+ const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34561
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34562
+ this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
34551
34563
  }
34552
34564
  else {
34553
- this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34565
+ if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
34566
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34567
+ this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
34568
+ }
34569
+ }
34570
+ if (group[group.length - 1] === 0) {
34571
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34572
+ this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
34573
+ }
34574
+ }
34575
+ const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34576
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34577
+ this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
34554
34578
  }
34555
34579
  }
34556
34580
  break;
@@ -34857,6 +34881,18 @@ class BordersPlugin extends CorePlugin {
34857
34881
  }
34858
34882
  }
34859
34883
  }
34884
+ /**
34885
+ * Remove the borders inside of a zone
34886
+ */
34887
+ clearInsideBorders(sheetId, zones) {
34888
+ for (let zone of zones) {
34889
+ for (let row = zone.top; row <= zone.bottom; row++) {
34890
+ for (let col = zone.left; col <= zone.right; col++) {
34891
+ this.history.update("borders", sheetId, col, row, undefined);
34892
+ }
34893
+ }
34894
+ }
34895
+ }
34860
34896
  /**
34861
34897
  * Add a border to the existing one to a cell
34862
34898
  */
@@ -51856,17 +51892,17 @@ class BottomBarSheet extends Component {
51856
51892
  sheetNameRef = useRef("sheetNameSpan");
51857
51893
  editionState = "initializing";
51858
51894
  setup() {
51859
- onMounted(() => {
51860
- if (this.isSheetActive) {
51861
- this.scrollToSheet();
51862
- }
51863
- });
51864
51895
  onPatched(() => {
51865
51896
  if (this.sheetNameRef.el && this.state.isEditing && this.editionState === "initializing") {
51866
51897
  this.editionState = "editing";
51867
51898
  this.focusInputAndSelectContent();
51868
51899
  }
51869
51900
  });
51901
+ useEffect((sheetId) => {
51902
+ if (this.props.sheetId === sheetId) {
51903
+ this.scrollToSheet();
51904
+ }
51905
+ }, () => [this.env.model.getters.getActiveSheetId()]);
51870
51906
  }
51871
51907
  focusInputAndSelectContent() {
51872
51908
  if (!this.state.isEditing || !this.sheetNameRef.el)
@@ -51878,7 +51914,10 @@ class BottomBarSheet extends Component {
51878
51914
  }
51879
51915
  }
51880
51916
  scrollToSheet() {
51881
- this.sheetDivRef.el?.scrollIntoView?.();
51917
+ this.sheetDivRef.el?.scrollIntoView?.({
51918
+ behavior: "smooth",
51919
+ inline: "nearest",
51920
+ });
51882
51921
  }
51883
51922
  onFocusOut() {
51884
51923
  if (this.state.isEditing && this.editionState !== "initializing") {
@@ -57629,6 +57668,8 @@ const helpers = {
57629
57668
  createActions,
57630
57669
  transformRangeData,
57631
57670
  deepEquals,
57671
+ isNumber,
57672
+ isDateTime,
57632
57673
  };
57633
57674
  const links = {
57634
57675
  isMarkdownLink,
@@ -57672,6 +57713,6 @@ const constants = {
57672
57713
  export { AbstractChart, 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 };
57673
57714
 
57674
57715
 
57675
- __info__.version = "17.0.44";
57676
- __info__.date = "2024-12-19T07:46:10.942Z";
57677
- __info__.hash = "820f3cf";
57716
+ __info__.version = "17.0.45";
57717
+ __info__.date = "2025-01-14T11:30:44.730Z";
57718
+ __info__.hash = "94f8ef9";
@@ -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.0.44
6
- * @date 2024-12-19T07:46:10.942Z
7
- * @hash 820f3cf
5
+ * @version 17.0.45
6
+ * @date 2025-01-14T11:30:44.730Z
7
+ * @hash 94f8ef9
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -31734,7 +31734,7 @@
31734
31734
  return undefined;
31735
31735
  }
31736
31736
  function isChartData(data) {
31737
- return "dataSets" in data;
31737
+ return "dataSets" in data && data.dataSets.length > 0;
31738
31738
  }
31739
31739
  function isImageData(data) {
31740
31740
  return "imageSrc" in data;
@@ -34548,10 +34548,34 @@
34548
34548
  const elements = [...cmd.elements].sort((a, b) => b - a);
34549
34549
  for (const group of groupConsecutive(elements)) {
34550
34550
  if (cmd.dimension === "COL") {
34551
- this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34551
+ if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
34552
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34553
+ this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
34554
+ }
34555
+ }
34556
+ if (group[group.length - 1] === 0) {
34557
+ for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
34558
+ this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
34559
+ }
34560
+ }
34561
+ const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34562
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34563
+ this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
34552
34564
  }
34553
34565
  else {
34554
- this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
34566
+ if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
34567
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34568
+ this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
34569
+ }
34570
+ }
34571
+ if (group[group.length - 1] === 0) {
34572
+ for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
34573
+ this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
34574
+ }
34575
+ }
34576
+ const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
34577
+ this.clearInsideBorders(cmd.sheetId, [zone]);
34578
+ this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
34555
34579
  }
34556
34580
  }
34557
34581
  break;
@@ -34858,6 +34882,18 @@
34858
34882
  }
34859
34883
  }
34860
34884
  }
34885
+ /**
34886
+ * Remove the borders inside of a zone
34887
+ */
34888
+ clearInsideBorders(sheetId, zones) {
34889
+ for (let zone of zones) {
34890
+ for (let row = zone.top; row <= zone.bottom; row++) {
34891
+ for (let col = zone.left; col <= zone.right; col++) {
34892
+ this.history.update("borders", sheetId, col, row, undefined);
34893
+ }
34894
+ }
34895
+ }
34896
+ }
34861
34897
  /**
34862
34898
  * Add a border to the existing one to a cell
34863
34899
  */
@@ -51857,17 +51893,17 @@
51857
51893
  sheetNameRef = owl.useRef("sheetNameSpan");
51858
51894
  editionState = "initializing";
51859
51895
  setup() {
51860
- owl.onMounted(() => {
51861
- if (this.isSheetActive) {
51862
- this.scrollToSheet();
51863
- }
51864
- });
51865
51896
  owl.onPatched(() => {
51866
51897
  if (this.sheetNameRef.el && this.state.isEditing && this.editionState === "initializing") {
51867
51898
  this.editionState = "editing";
51868
51899
  this.focusInputAndSelectContent();
51869
51900
  }
51870
51901
  });
51902
+ owl.useEffect((sheetId) => {
51903
+ if (this.props.sheetId === sheetId) {
51904
+ this.scrollToSheet();
51905
+ }
51906
+ }, () => [this.env.model.getters.getActiveSheetId()]);
51871
51907
  }
51872
51908
  focusInputAndSelectContent() {
51873
51909
  if (!this.state.isEditing || !this.sheetNameRef.el)
@@ -51879,7 +51915,10 @@
51879
51915
  }
51880
51916
  }
51881
51917
  scrollToSheet() {
51882
- this.sheetDivRef.el?.scrollIntoView?.();
51918
+ this.sheetDivRef.el?.scrollIntoView?.({
51919
+ behavior: "smooth",
51920
+ inline: "nearest",
51921
+ });
51883
51922
  }
51884
51923
  onFocusOut() {
51885
51924
  if (this.state.isEditing && this.editionState !== "initializing") {
@@ -57630,6 +57669,8 @@
57630
57669
  createActions,
57631
57670
  transformRangeData,
57632
57671
  deepEquals,
57672
+ isNumber,
57673
+ isDateTime,
57633
57674
  };
57634
57675
  const links = {
57635
57676
  isMarkdownLink,
@@ -57708,9 +57749,9 @@
57708
57749
  exports.tokenize = tokenize;
57709
57750
 
57710
57751
 
57711
- __info__.version = "17.0.44";
57712
- __info__.date = "2024-12-19T07:46:10.942Z";
57713
- __info__.hash = "820f3cf";
57752
+ __info__.version = "17.0.45";
57753
+ __info__.date = "2025-01-14T11:30:44.730Z";
57754
+ __info__.hash = "94f8ef9";
57714
57755
 
57715
57756
 
57716
57757
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);