@odoo/o-spreadsheet 16.3.0 → 16.3.1

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.
@@ -16873,6 +16873,7 @@ const unFreezePane = {
16873
16873
  execute: (env) => env.model.dispatch("UNFREEZE_COLUMNS_ROWS", {
16874
16874
  sheetId: env.model.getters.getActiveSheetId(),
16875
16875
  }),
16876
+ icon: "o-spreadsheet-Icon.UNFREEZE",
16876
16877
  };
16877
16878
  const freezePane = {
16878
16879
  name: _lt("Freeze"),
@@ -17944,6 +17945,18 @@ css /* scss */ `
17944
17945
  grid-template-columns: repeat(${ITEMS_PER_LINE}, 1fr);
17945
17946
  grid-gap: ${ITEM_HORIZONTAL_MARGIN * 2}px;
17946
17947
  }
17948
+ .o-color-picker-toggler-button {
17949
+ display: flex;
17950
+ .o-color-picker-toggler-sign {
17951
+ margin: auto auto;
17952
+ width: 55%;
17953
+ height: 55%;
17954
+ .o-icon {
17955
+ width: 100%;
17956
+ height: 100%;
17957
+ }
17958
+ }
17959
+ }
17947
17960
  .o-color-picker-line-item {
17948
17961
  width: ${ITEM_EDGE_LENGTH}px;
17949
17962
  height: ${ITEM_EDGE_LENGTH}px;
@@ -20616,7 +20629,14 @@ class ContentEditableHelper {
20616
20629
  current = it.next();
20617
20630
  }
20618
20631
  if (current.value !== nodeToFind) {
20619
- throw new Error("Cannot find the node in the children of the element");
20632
+ /** This situation can happen if the code is called while the selection is not currently on the ContentEditableHelper.
20633
+ * In this case, we return 0 because we don't know the size of the text before the selection.
20634
+ *
20635
+ * A known occurence is triggered since the introduction of commit d4663158 (PR #2038).
20636
+ *
20637
+ * FIXME: find a way to test eventhough the selection API is not available in jsDOM.
20638
+ */
20639
+ return 0;
20620
20640
  }
20621
20641
  else {
20622
20642
  if (!current.value.hasChildNodes()) {
@@ -38668,7 +38688,8 @@ class SheetUIPlugin extends UIPlugin {
38668
38688
  getCellWidth(position) {
38669
38689
  const text = this.getCellText(position);
38670
38690
  const style = this.getters.getCellComputedStyle(position);
38671
- let contentWidth = this.getTextWidth(text, style);
38691
+ const multiLineText = text.split(NEWLINE);
38692
+ let contentWidth = Math.max(...multiLineText.map((line) => this.getTextWidth(line, style)));
38672
38693
  const icon = this.getters.getConditionalIcon(position);
38673
38694
  if (icon) {
38674
38695
  contentWidth += computeIconWidth(this.getters.getCellStyle(position));
@@ -43797,6 +43818,10 @@ class Spreadsheet extends owl.Component {
43797
43818
  }
43798
43819
  checkViewportSize() {
43799
43820
  const { xRatio, yRatio } = this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());
43821
+ if (!isFinite(xRatio) || !isFinite(yRatio)) {
43822
+ // before mounting, the ratios can be NaN or Infinity if the viewport size is 0
43823
+ return;
43824
+ }
43800
43825
  if (yRatio > MAXIMAL_FREEZABLE_RATIO || xRatio > MAXIMAL_FREEZABLE_RATIO) {
43801
43826
  if (this.isViewportTooSmall) {
43802
43827
  return;
@@ -47558,6 +47583,6 @@ exports.setTranslationMethod = setTranslationMethod;
47558
47583
  exports.tokenize = tokenize;
47559
47584
 
47560
47585
 
47561
- __info__.version = '16.3.0';
47562
- __info__.date = '2023-05-17T14:44:57.860Z';
47563
- __info__.hash = '33b37e4';
47586
+ __info__.version = '16.3.1';
47587
+ __info__.date = '2023-05-25T13:00:27.320Z';
47588
+ __info__.hash = 'b3cfd2c';
@@ -16869,6 +16869,7 @@ const unFreezePane = {
16869
16869
  execute: (env) => env.model.dispatch("UNFREEZE_COLUMNS_ROWS", {
16870
16870
  sheetId: env.model.getters.getActiveSheetId(),
16871
16871
  }),
16872
+ icon: "o-spreadsheet-Icon.UNFREEZE",
16872
16873
  };
16873
16874
  const freezePane = {
16874
16875
  name: _lt("Freeze"),
@@ -17940,6 +17941,18 @@ css /* scss */ `
17940
17941
  grid-template-columns: repeat(${ITEMS_PER_LINE}, 1fr);
17941
17942
  grid-gap: ${ITEM_HORIZONTAL_MARGIN * 2}px;
17942
17943
  }
17944
+ .o-color-picker-toggler-button {
17945
+ display: flex;
17946
+ .o-color-picker-toggler-sign {
17947
+ margin: auto auto;
17948
+ width: 55%;
17949
+ height: 55%;
17950
+ .o-icon {
17951
+ width: 100%;
17952
+ height: 100%;
17953
+ }
17954
+ }
17955
+ }
17943
17956
  .o-color-picker-line-item {
17944
17957
  width: ${ITEM_EDGE_LENGTH}px;
17945
17958
  height: ${ITEM_EDGE_LENGTH}px;
@@ -20612,7 +20625,14 @@ class ContentEditableHelper {
20612
20625
  current = it.next();
20613
20626
  }
20614
20627
  if (current.value !== nodeToFind) {
20615
- throw new Error("Cannot find the node in the children of the element");
20628
+ /** This situation can happen if the code is called while the selection is not currently on the ContentEditableHelper.
20629
+ * In this case, we return 0 because we don't know the size of the text before the selection.
20630
+ *
20631
+ * A known occurence is triggered since the introduction of commit d4663158 (PR #2038).
20632
+ *
20633
+ * FIXME: find a way to test eventhough the selection API is not available in jsDOM.
20634
+ */
20635
+ return 0;
20616
20636
  }
20617
20637
  else {
20618
20638
  if (!current.value.hasChildNodes()) {
@@ -38664,7 +38684,8 @@ class SheetUIPlugin extends UIPlugin {
38664
38684
  getCellWidth(position) {
38665
38685
  const text = this.getCellText(position);
38666
38686
  const style = this.getters.getCellComputedStyle(position);
38667
- let contentWidth = this.getTextWidth(text, style);
38687
+ const multiLineText = text.split(NEWLINE);
38688
+ let contentWidth = Math.max(...multiLineText.map((line) => this.getTextWidth(line, style)));
38668
38689
  const icon = this.getters.getConditionalIcon(position);
38669
38690
  if (icon) {
38670
38691
  contentWidth += computeIconWidth(this.getters.getCellStyle(position));
@@ -43793,6 +43814,10 @@ class Spreadsheet extends Component {
43793
43814
  }
43794
43815
  checkViewportSize() {
43795
43816
  const { xRatio, yRatio } = this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());
43817
+ if (!isFinite(xRatio) || !isFinite(yRatio)) {
43818
+ // before mounting, the ratios can be NaN or Infinity if the viewport size is 0
43819
+ return;
43820
+ }
43796
43821
  if (yRatio > MAXIMAL_FREEZABLE_RATIO || xRatio > MAXIMAL_FREEZABLE_RATIO) {
43797
43822
  if (this.isViewportTooSmall) {
43798
43823
  return;
@@ -47526,6 +47551,6 @@ function addFunction(functionName, functionDescription) {
47526
47551
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
47527
47552
 
47528
47553
 
47529
- __info__.version = '16.3.0';
47530
- __info__.date = '2023-05-17T14:44:57.860Z';
47531
- __info__.hash = '33b37e4';
47554
+ __info__.version = '16.3.1';
47555
+ __info__.date = '2023-05-25T13:00:27.320Z';
47556
+ __info__.hash = 'b3cfd2c';
@@ -16870,6 +16870,7 @@
16870
16870
  execute: (env) => env.model.dispatch("UNFREEZE_COLUMNS_ROWS", {
16871
16871
  sheetId: env.model.getters.getActiveSheetId(),
16872
16872
  }),
16873
+ icon: "o-spreadsheet-Icon.UNFREEZE",
16873
16874
  };
16874
16875
  const freezePane = {
16875
16876
  name: _lt("Freeze"),
@@ -17941,6 +17942,18 @@
17941
17942
  grid-template-columns: repeat(${ITEMS_PER_LINE}, 1fr);
17942
17943
  grid-gap: ${ITEM_HORIZONTAL_MARGIN * 2}px;
17943
17944
  }
17945
+ .o-color-picker-toggler-button {
17946
+ display: flex;
17947
+ .o-color-picker-toggler-sign {
17948
+ margin: auto auto;
17949
+ width: 55%;
17950
+ height: 55%;
17951
+ .o-icon {
17952
+ width: 100%;
17953
+ height: 100%;
17954
+ }
17955
+ }
17956
+ }
17944
17957
  .o-color-picker-line-item {
17945
17958
  width: ${ITEM_EDGE_LENGTH}px;
17946
17959
  height: ${ITEM_EDGE_LENGTH}px;
@@ -20613,7 +20626,14 @@
20613
20626
  current = it.next();
20614
20627
  }
20615
20628
  if (current.value !== nodeToFind) {
20616
- throw new Error("Cannot find the node in the children of the element");
20629
+ /** This situation can happen if the code is called while the selection is not currently on the ContentEditableHelper.
20630
+ * In this case, we return 0 because we don't know the size of the text before the selection.
20631
+ *
20632
+ * A known occurence is triggered since the introduction of commit d4663158 (PR #2038).
20633
+ *
20634
+ * FIXME: find a way to test eventhough the selection API is not available in jsDOM.
20635
+ */
20636
+ return 0;
20617
20637
  }
20618
20638
  else {
20619
20639
  if (!current.value.hasChildNodes()) {
@@ -38665,7 +38685,8 @@
38665
38685
  getCellWidth(position) {
38666
38686
  const text = this.getCellText(position);
38667
38687
  const style = this.getters.getCellComputedStyle(position);
38668
- let contentWidth = this.getTextWidth(text, style);
38688
+ const multiLineText = text.split(NEWLINE);
38689
+ let contentWidth = Math.max(...multiLineText.map((line) => this.getTextWidth(line, style)));
38669
38690
  const icon = this.getters.getConditionalIcon(position);
38670
38691
  if (icon) {
38671
38692
  contentWidth += computeIconWidth(this.getters.getCellStyle(position));
@@ -43794,6 +43815,10 @@
43794
43815
  }
43795
43816
  checkViewportSize() {
43796
43817
  const { xRatio, yRatio } = this.env.model.getters.getFrozenSheetViewRatio(this.env.model.getters.getActiveSheetId());
43818
+ if (!isFinite(xRatio) || !isFinite(yRatio)) {
43819
+ // before mounting, the ratios can be NaN or Infinity if the viewport size is 0
43820
+ return;
43821
+ }
43797
43822
  if (yRatio > MAXIMAL_FREEZABLE_RATIO || xRatio > MAXIMAL_FREEZABLE_RATIO) {
43798
43823
  if (this.isViewportTooSmall) {
43799
43824
  return;
@@ -47557,9 +47582,9 @@
47557
47582
  Object.defineProperty(exports, '__esModule', { value: true });
47558
47583
 
47559
47584
 
47560
- __info__.version = '16.3.0';
47561
- __info__.date = '2023-05-17T14:44:57.860Z';
47562
- __info__.hash = '33b37e4';
47585
+ __info__.version = '16.3.1';
47586
+ __info__.date = '2023-05-25T13:00:27.320Z';
47587
+ __info__.hash = 'b3cfd2c';
47563
47588
 
47564
47589
 
47565
47590
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);