@odoo/o-spreadsheet 18.3.13 → 18.3.14

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 18.3.13
6
- * @date 2025-07-28T13:39:23.645Z
7
- * @hash d30327c
5
+ * @version 18.3.14
6
+ * @date 2025-07-30T11:18:53.973Z
7
+ * @hash 2a7178a
8
8
  */
9
9
 
10
10
  'use strict';
@@ -8669,12 +8669,12 @@ const AGGREGATOR_NAMES = {
8669
8669
  avg: _t("Average"),
8670
8670
  sum: _t("Sum"),
8671
8671
  };
8672
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8672
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8673
8673
  const AGGREGATORS_BY_FIELD_TYPE = {
8674
- integer: NUMBER_CHAR_AGGREGATORS,
8675
- char: NUMBER_CHAR_AGGREGATORS,
8674
+ integer: DEFAULT_AGGREGATORS,
8675
+ char: DEFAULT_AGGREGATORS,
8676
+ datetime: DEFAULT_AGGREGATORS,
8676
8677
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8677
- datetime: ["max", "min", "count_distinct", "count"],
8678
8678
  };
8679
8679
  const AGGREGATORS = {};
8680
8680
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -22635,31 +22635,40 @@ autoCompleteProviders.add("dataValidation", {
22635
22635
  if (!this.composer.currentEditedCell) {
22636
22636
  return [];
22637
22637
  }
22638
- const position = this.composer.currentEditedCell;
22639
- const rule = this.getters.getValidationRuleForCell(position);
22640
- if (!rule ||
22641
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22642
- return [];
22643
- }
22644
- let values;
22645
- if (rule.criterion.type === "isValueInList") {
22646
- values = rule.criterion.values;
22647
- }
22648
- else {
22649
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22650
- values = Array.from(new Set(this.getters
22651
- .getRangeValues(range)
22652
- .filter(isNotNull)
22653
- .map((value) => value.toString())
22654
- .filter((val) => val !== "")));
22655
- }
22656
- return values.map((value) => ({ text: value }));
22638
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
22639
+ text: value.value?.toString() || "",
22640
+ htmlContent: [{ value: value.label }],
22641
+ fuzzySearchKey: value.label,
22642
+ }));
22657
22643
  },
22658
22644
  selectProposal(tokenAtCursor, value) {
22659
22645
  this.composer.setCurrentContent(value);
22660
22646
  this.composer.stopEdition();
22661
22647
  },
22662
22648
  });
22649
+ function getProposedValues(getters, position) {
22650
+ const rule = getters.getValidationRuleForCell(position);
22651
+ if (!rule ||
22652
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22653
+ return [];
22654
+ }
22655
+ let values = [];
22656
+ if (rule.criterion.type === "isValueInList") {
22657
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
22658
+ }
22659
+ else {
22660
+ const labelsSet = new Set();
22661
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22662
+ for (const p of positions(range.zone)) {
22663
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
22664
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
22665
+ labelsSet.add(cell.formattedValue);
22666
+ values.push({ label: cell.formattedValue, value: cell.value });
22667
+ }
22668
+ }
22669
+ }
22670
+ return values;
22671
+ }
22663
22672
 
22664
22673
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22665
22674
  const pendingHtmlContent = [];
@@ -45526,7 +45535,8 @@ class ConditionalFormattingEditor extends owl.Component {
45526
45535
  static props = {
45527
45536
  editedCf: Object,
45528
45537
  onCancel: Function,
45529
- onSave: Function,
45538
+ onExit: Function,
45539
+ isNewCf: Boolean,
45530
45540
  };
45531
45541
  static components = {
45532
45542
  SelectionInput,
@@ -45545,6 +45555,7 @@ class ConditionalFormattingEditor extends owl.Component {
45545
45555
  getTextDecoration = getTextDecoration;
45546
45556
  colorNumberString = colorNumberString;
45547
45557
  state;
45558
+ hasEditedCf = this.props.isNewCf;
45548
45559
  setup() {
45549
45560
  this.state = owl.useState({
45550
45561
  errors: [],
@@ -45602,6 +45613,9 @@ class ConditionalFormattingEditor extends owl.Component {
45602
45613
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45603
45614
  sheetId,
45604
45615
  });
45616
+ if (result.isSuccessful) {
45617
+ this.hasEditedCf = true;
45618
+ }
45605
45619
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45606
45620
  if (!newCf.suppressErrors) {
45607
45621
  this.state.errors = reasons;
@@ -45623,7 +45637,15 @@ class ConditionalFormattingEditor extends owl.Component {
45623
45637
  onSave() {
45624
45638
  const result = this.updateConditionalFormat({});
45625
45639
  if (result.length === 0) {
45626
- this.props.onSave();
45640
+ this.props.onExit();
45641
+ }
45642
+ }
45643
+ onCancel() {
45644
+ if (this.hasEditedCf) {
45645
+ this.props.onCancel();
45646
+ }
45647
+ else {
45648
+ this.props.onExit();
45627
45649
  }
45628
45650
  }
45629
45651
  getDefaultRules() {
@@ -80900,6 +80922,6 @@ exports.tokenColors = tokenColors;
80900
80922
  exports.tokenize = tokenize;
80901
80923
 
80902
80924
 
80903
- __info__.version = "18.3.13";
80904
- __info__.date = "2025-07-28T13:39:23.645Z";
80905
- __info__.hash = "d30327c";
80925
+ __info__.version = "18.3.14";
80926
+ __info__.date = "2025-07-30T11:18:53.973Z";
80927
+ __info__.hash = "2a7178a";
@@ -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 18.3.13
6
- * @date 2025-07-28T13:39:23.645Z
7
- * @hash d30327c
5
+ * @version 18.3.14
6
+ * @date 2025-07-30T11:18:53.973Z
7
+ * @hash 2a7178a
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -8667,12 +8667,12 @@ const AGGREGATOR_NAMES = {
8667
8667
  avg: _t("Average"),
8668
8668
  sum: _t("Sum"),
8669
8669
  };
8670
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8670
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8671
8671
  const AGGREGATORS_BY_FIELD_TYPE = {
8672
- integer: NUMBER_CHAR_AGGREGATORS,
8673
- char: NUMBER_CHAR_AGGREGATORS,
8672
+ integer: DEFAULT_AGGREGATORS,
8673
+ char: DEFAULT_AGGREGATORS,
8674
+ datetime: DEFAULT_AGGREGATORS,
8674
8675
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8675
- datetime: ["max", "min", "count_distinct", "count"],
8676
8676
  };
8677
8677
  const AGGREGATORS = {};
8678
8678
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -22633,31 +22633,40 @@ autoCompleteProviders.add("dataValidation", {
22633
22633
  if (!this.composer.currentEditedCell) {
22634
22634
  return [];
22635
22635
  }
22636
- const position = this.composer.currentEditedCell;
22637
- const rule = this.getters.getValidationRuleForCell(position);
22638
- if (!rule ||
22639
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22640
- return [];
22641
- }
22642
- let values;
22643
- if (rule.criterion.type === "isValueInList") {
22644
- values = rule.criterion.values;
22645
- }
22646
- else {
22647
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22648
- values = Array.from(new Set(this.getters
22649
- .getRangeValues(range)
22650
- .filter(isNotNull)
22651
- .map((value) => value.toString())
22652
- .filter((val) => val !== "")));
22653
- }
22654
- return values.map((value) => ({ text: value }));
22636
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
22637
+ text: value.value?.toString() || "",
22638
+ htmlContent: [{ value: value.label }],
22639
+ fuzzySearchKey: value.label,
22640
+ }));
22655
22641
  },
22656
22642
  selectProposal(tokenAtCursor, value) {
22657
22643
  this.composer.setCurrentContent(value);
22658
22644
  this.composer.stopEdition();
22659
22645
  },
22660
22646
  });
22647
+ function getProposedValues(getters, position) {
22648
+ const rule = getters.getValidationRuleForCell(position);
22649
+ if (!rule ||
22650
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22651
+ return [];
22652
+ }
22653
+ let values = [];
22654
+ if (rule.criterion.type === "isValueInList") {
22655
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
22656
+ }
22657
+ else {
22658
+ const labelsSet = new Set();
22659
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22660
+ for (const p of positions(range.zone)) {
22661
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
22662
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
22663
+ labelsSet.add(cell.formattedValue);
22664
+ values.push({ label: cell.formattedValue, value: cell.value });
22665
+ }
22666
+ }
22667
+ }
22668
+ return values;
22669
+ }
22661
22670
 
22662
22671
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22663
22672
  const pendingHtmlContent = [];
@@ -45524,7 +45533,8 @@ class ConditionalFormattingEditor extends Component {
45524
45533
  static props = {
45525
45534
  editedCf: Object,
45526
45535
  onCancel: Function,
45527
- onSave: Function,
45536
+ onExit: Function,
45537
+ isNewCf: Boolean,
45528
45538
  };
45529
45539
  static components = {
45530
45540
  SelectionInput,
@@ -45543,6 +45553,7 @@ class ConditionalFormattingEditor extends Component {
45543
45553
  getTextDecoration = getTextDecoration;
45544
45554
  colorNumberString = colorNumberString;
45545
45555
  state;
45556
+ hasEditedCf = this.props.isNewCf;
45546
45557
  setup() {
45547
45558
  this.state = useState({
45548
45559
  errors: [],
@@ -45600,6 +45611,9 @@ class ConditionalFormattingEditor extends Component {
45600
45611
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45601
45612
  sheetId,
45602
45613
  });
45614
+ if (result.isSuccessful) {
45615
+ this.hasEditedCf = true;
45616
+ }
45603
45617
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45604
45618
  if (!newCf.suppressErrors) {
45605
45619
  this.state.errors = reasons;
@@ -45621,7 +45635,15 @@ class ConditionalFormattingEditor extends Component {
45621
45635
  onSave() {
45622
45636
  const result = this.updateConditionalFormat({});
45623
45637
  if (result.length === 0) {
45624
- this.props.onSave();
45638
+ this.props.onExit();
45639
+ }
45640
+ }
45641
+ onCancel() {
45642
+ if (this.hasEditedCf) {
45643
+ this.props.onCancel();
45644
+ }
45645
+ else {
45646
+ this.props.onExit();
45625
45647
  }
45626
45648
  }
45627
45649
  getDefaultRules() {
@@ -80852,6 +80874,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
80852
80874
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
80853
80875
 
80854
80876
 
80855
- __info__.version = "18.3.13";
80856
- __info__.date = "2025-07-28T13:39:23.645Z";
80857
- __info__.hash = "d30327c";
80877
+ __info__.version = "18.3.14";
80878
+ __info__.date = "2025-07-30T11:18:53.973Z";
80879
+ __info__.hash = "2a7178a";
@@ -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 18.3.13
6
- * @date 2025-07-28T13:39:23.645Z
7
- * @hash d30327c
5
+ * @version 18.3.14
6
+ * @date 2025-07-30T11:18:53.973Z
7
+ * @hash 2a7178a
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -8668,12 +8668,12 @@
8668
8668
  avg: _t("Average"),
8669
8669
  sum: _t("Sum"),
8670
8670
  };
8671
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8671
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8672
8672
  const AGGREGATORS_BY_FIELD_TYPE = {
8673
- integer: NUMBER_CHAR_AGGREGATORS,
8674
- char: NUMBER_CHAR_AGGREGATORS,
8673
+ integer: DEFAULT_AGGREGATORS,
8674
+ char: DEFAULT_AGGREGATORS,
8675
+ datetime: DEFAULT_AGGREGATORS,
8675
8676
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8676
- datetime: ["max", "min", "count_distinct", "count"],
8677
8677
  };
8678
8678
  const AGGREGATORS = {};
8679
8679
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -22634,31 +22634,40 @@ stores.inject(MyMetaStore, storeInstance);
22634
22634
  if (!this.composer.currentEditedCell) {
22635
22635
  return [];
22636
22636
  }
22637
- const position = this.composer.currentEditedCell;
22638
- const rule = this.getters.getValidationRuleForCell(position);
22639
- if (!rule ||
22640
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22641
- return [];
22642
- }
22643
- let values;
22644
- if (rule.criterion.type === "isValueInList") {
22645
- values = rule.criterion.values;
22646
- }
22647
- else {
22648
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22649
- values = Array.from(new Set(this.getters
22650
- .getRangeValues(range)
22651
- .filter(isNotNull)
22652
- .map((value) => value.toString())
22653
- .filter((val) => val !== "")));
22654
- }
22655
- return values.map((value) => ({ text: value }));
22637
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
22638
+ text: value.value?.toString() || "",
22639
+ htmlContent: [{ value: value.label }],
22640
+ fuzzySearchKey: value.label,
22641
+ }));
22656
22642
  },
22657
22643
  selectProposal(tokenAtCursor, value) {
22658
22644
  this.composer.setCurrentContent(value);
22659
22645
  this.composer.stopEdition();
22660
22646
  },
22661
22647
  });
22648
+ function getProposedValues(getters, position) {
22649
+ const rule = getters.getValidationRuleForCell(position);
22650
+ if (!rule ||
22651
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22652
+ return [];
22653
+ }
22654
+ let values = [];
22655
+ if (rule.criterion.type === "isValueInList") {
22656
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
22657
+ }
22658
+ else {
22659
+ const labelsSet = new Set();
22660
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22661
+ for (const p of positions(range.zone)) {
22662
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
22663
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
22664
+ labelsSet.add(cell.formattedValue);
22665
+ values.push({ label: cell.formattedValue, value: cell.value });
22666
+ }
22667
+ }
22668
+ }
22669
+ return values;
22670
+ }
22662
22671
 
22663
22672
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22664
22673
  const pendingHtmlContent = [];
@@ -45525,7 +45534,8 @@ stores.inject(MyMetaStore, storeInstance);
45525
45534
  static props = {
45526
45535
  editedCf: Object,
45527
45536
  onCancel: Function,
45528
- onSave: Function,
45537
+ onExit: Function,
45538
+ isNewCf: Boolean,
45529
45539
  };
45530
45540
  static components = {
45531
45541
  SelectionInput,
@@ -45544,6 +45554,7 @@ stores.inject(MyMetaStore, storeInstance);
45544
45554
  getTextDecoration = getTextDecoration;
45545
45555
  colorNumberString = colorNumberString;
45546
45556
  state;
45557
+ hasEditedCf = this.props.isNewCf;
45547
45558
  setup() {
45548
45559
  this.state = owl.useState({
45549
45560
  errors: [],
@@ -45601,6 +45612,9 @@ stores.inject(MyMetaStore, storeInstance);
45601
45612
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45602
45613
  sheetId,
45603
45614
  });
45615
+ if (result.isSuccessful) {
45616
+ this.hasEditedCf = true;
45617
+ }
45604
45618
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45605
45619
  if (!newCf.suppressErrors) {
45606
45620
  this.state.errors = reasons;
@@ -45622,7 +45636,15 @@ stores.inject(MyMetaStore, storeInstance);
45622
45636
  onSave() {
45623
45637
  const result = this.updateConditionalFormat({});
45624
45638
  if (result.length === 0) {
45625
- this.props.onSave();
45639
+ this.props.onExit();
45640
+ }
45641
+ }
45642
+ onCancel() {
45643
+ if (this.hasEditedCf) {
45644
+ this.props.onCancel();
45645
+ }
45646
+ else {
45647
+ this.props.onExit();
45626
45648
  }
45627
45649
  }
45628
45650
  getDefaultRules() {
@@ -80899,9 +80921,9 @@ stores.inject(MyMetaStore, storeInstance);
80899
80921
  exports.tokenize = tokenize;
80900
80922
 
80901
80923
 
80902
- __info__.version = "18.3.13";
80903
- __info__.date = "2025-07-28T13:39:23.645Z";
80904
- __info__.hash = "d30327c";
80924
+ __info__.version = "18.3.14";
80925
+ __info__.date = "2025-07-30T11:18:53.973Z";
80926
+ __info__.hash = "2a7178a";
80905
80927
 
80906
80928
 
80907
80929
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);