@odoo/o-spreadsheet 18.3.13 → 18.3.15

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.15
6
+ * @date 2025-08-04T06:51:38.674Z
7
+ * @hash 9499d98
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) {
@@ -21964,6 +21964,7 @@ class ChartJsComponent extends owl.Component {
21964
21964
  }
21965
21965
  setup() {
21966
21966
  owl.onMounted(() => {
21967
+ registerChartJSExtensions();
21967
21968
  const runtime = this.chartRuntime;
21968
21969
  this.currentRuntime = runtime;
21969
21970
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -22635,31 +22636,40 @@ autoCompleteProviders.add("dataValidation", {
22635
22636
  if (!this.composer.currentEditedCell) {
22636
22637
  return [];
22637
22638
  }
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 }));
22639
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
22640
+ text: value.value?.toString() || "",
22641
+ htmlContent: [{ value: value.label }],
22642
+ fuzzySearchKey: value.label,
22643
+ }));
22657
22644
  },
22658
22645
  selectProposal(tokenAtCursor, value) {
22659
22646
  this.composer.setCurrentContent(value);
22660
22647
  this.composer.stopEdition();
22661
22648
  },
22662
22649
  });
22650
+ function getProposedValues(getters, position) {
22651
+ const rule = getters.getValidationRuleForCell(position);
22652
+ if (!rule ||
22653
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
22654
+ return [];
22655
+ }
22656
+ let values = [];
22657
+ if (rule.criterion.type === "isValueInList") {
22658
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
22659
+ }
22660
+ else {
22661
+ const labelsSet = new Set();
22662
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
22663
+ for (const p of positions(range.zone)) {
22664
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
22665
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
22666
+ labelsSet.add(cell.formattedValue);
22667
+ values.push({ label: cell.formattedValue, value: cell.value });
22668
+ }
22669
+ }
22670
+ }
22671
+ return values;
22672
+ }
22663
22673
 
22664
22674
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22665
22675
  const pendingHtmlContent = [];
@@ -45526,7 +45536,8 @@ class ConditionalFormattingEditor extends owl.Component {
45526
45536
  static props = {
45527
45537
  editedCf: Object,
45528
45538
  onCancel: Function,
45529
- onSave: Function,
45539
+ onExit: Function,
45540
+ isNewCf: Boolean,
45530
45541
  };
45531
45542
  static components = {
45532
45543
  SelectionInput,
@@ -45545,6 +45556,7 @@ class ConditionalFormattingEditor extends owl.Component {
45545
45556
  getTextDecoration = getTextDecoration;
45546
45557
  colorNumberString = colorNumberString;
45547
45558
  state;
45559
+ hasEditedCf = this.props.isNewCf;
45548
45560
  setup() {
45549
45561
  this.state = owl.useState({
45550
45562
  errors: [],
@@ -45602,6 +45614,9 @@ class ConditionalFormattingEditor extends owl.Component {
45602
45614
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45603
45615
  sheetId,
45604
45616
  });
45617
+ if (result.isSuccessful) {
45618
+ this.hasEditedCf = true;
45619
+ }
45605
45620
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45606
45621
  if (!newCf.suppressErrors) {
45607
45622
  this.state.errors = reasons;
@@ -45623,7 +45638,15 @@ class ConditionalFormattingEditor extends owl.Component {
45623
45638
  onSave() {
45624
45639
  const result = this.updateConditionalFormat({});
45625
45640
  if (result.length === 0) {
45626
- this.props.onSave();
45641
+ this.props.onExit();
45642
+ }
45643
+ }
45644
+ onCancel() {
45645
+ if (this.hasEditedCf) {
45646
+ this.props.onCancel();
45647
+ }
45648
+ else {
45649
+ this.props.onExit();
45627
45650
  }
45628
45651
  }
45629
45652
  getDefaultRules() {
@@ -76344,7 +76367,6 @@ class Spreadsheet extends owl.Component {
76344
76367
  this.checkViewportSize();
76345
76368
  stores.on("store-updated", this, render);
76346
76369
  resizeObserver.observe(this.spreadsheetRef.el);
76347
- registerChartJSExtensions();
76348
76370
  });
76349
76371
  owl.onWillUnmount(() => {
76350
76372
  this.unbindModelEvents();
@@ -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.15";
80926
+ __info__.date = "2025-08-04T06:51:38.674Z";
80927
+ __info__.hash = "9499d98";
@@ -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.15
6
+ * @date 2025-08-04T06:51:38.674Z
7
+ * @hash 9499d98
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) {
@@ -21962,6 +21962,7 @@ class ChartJsComponent extends Component {
21962
21962
  }
21963
21963
  setup() {
21964
21964
  onMounted(() => {
21965
+ registerChartJSExtensions();
21965
21966
  const runtime = this.chartRuntime;
21966
21967
  this.currentRuntime = runtime;
21967
21968
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -22633,31 +22634,40 @@ autoCompleteProviders.add("dataValidation", {
22633
22634
  if (!this.composer.currentEditedCell) {
22634
22635
  return [];
22635
22636
  }
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 }));
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
+ }));
22655
22642
  },
22656
22643
  selectProposal(tokenAtCursor, value) {
22657
22644
  this.composer.setCurrentContent(value);
22658
22645
  this.composer.stopEdition();
22659
22646
  },
22660
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
+ }
22661
22671
 
22662
22672
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22663
22673
  const pendingHtmlContent = [];
@@ -45524,7 +45534,8 @@ class ConditionalFormattingEditor extends Component {
45524
45534
  static props = {
45525
45535
  editedCf: Object,
45526
45536
  onCancel: Function,
45527
- onSave: Function,
45537
+ onExit: Function,
45538
+ isNewCf: Boolean,
45528
45539
  };
45529
45540
  static components = {
45530
45541
  SelectionInput,
@@ -45543,6 +45554,7 @@ class ConditionalFormattingEditor extends Component {
45543
45554
  getTextDecoration = getTextDecoration;
45544
45555
  colorNumberString = colorNumberString;
45545
45556
  state;
45557
+ hasEditedCf = this.props.isNewCf;
45546
45558
  setup() {
45547
45559
  this.state = useState({
45548
45560
  errors: [],
@@ -45600,6 +45612,9 @@ class ConditionalFormattingEditor extends Component {
45600
45612
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45601
45613
  sheetId,
45602
45614
  });
45615
+ if (result.isSuccessful) {
45616
+ this.hasEditedCf = true;
45617
+ }
45603
45618
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45604
45619
  if (!newCf.suppressErrors) {
45605
45620
  this.state.errors = reasons;
@@ -45621,7 +45636,15 @@ class ConditionalFormattingEditor extends Component {
45621
45636
  onSave() {
45622
45637
  const result = this.updateConditionalFormat({});
45623
45638
  if (result.length === 0) {
45624
- 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();
45625
45648
  }
45626
45649
  }
45627
45650
  getDefaultRules() {
@@ -76342,7 +76365,6 @@ class Spreadsheet extends Component {
76342
76365
  this.checkViewportSize();
76343
76366
  stores.on("store-updated", this, render);
76344
76367
  resizeObserver.observe(this.spreadsheetRef.el);
76345
- registerChartJSExtensions();
76346
76368
  });
76347
76369
  onWillUnmount(() => {
76348
76370
  this.unbindModelEvents();
@@ -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.15";
80878
+ __info__.date = "2025-08-04T06:51:38.674Z";
80879
+ __info__.hash = "9499d98";
@@ -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.15
6
+ * @date 2025-08-04T06:51:38.674Z
7
+ * @hash 9499d98
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) {
@@ -21963,6 +21963,7 @@ stores.inject(MyMetaStore, storeInstance);
21963
21963
  }
21964
21964
  setup() {
21965
21965
  owl.onMounted(() => {
21966
+ registerChartJSExtensions();
21966
21967
  const runtime = this.chartRuntime;
21967
21968
  this.currentRuntime = runtime;
21968
21969
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -22634,31 +22635,40 @@ stores.inject(MyMetaStore, storeInstance);
22634
22635
  if (!this.composer.currentEditedCell) {
22635
22636
  return [];
22636
22637
  }
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 }));
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
+ }));
22656
22643
  },
22657
22644
  selectProposal(tokenAtCursor, value) {
22658
22645
  this.composer.setCurrentContent(value);
22659
22646
  this.composer.stopEdition();
22660
22647
  },
22661
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
+ }
22662
22672
 
22663
22673
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
22664
22674
  const pendingHtmlContent = [];
@@ -45525,7 +45535,8 @@ stores.inject(MyMetaStore, storeInstance);
45525
45535
  static props = {
45526
45536
  editedCf: Object,
45527
45537
  onCancel: Function,
45528
- onSave: Function,
45538
+ onExit: Function,
45539
+ isNewCf: Boolean,
45529
45540
  };
45530
45541
  static components = {
45531
45542
  SelectionInput,
@@ -45544,6 +45555,7 @@ stores.inject(MyMetaStore, storeInstance);
45544
45555
  getTextDecoration = getTextDecoration;
45545
45556
  colorNumberString = colorNumberString;
45546
45557
  state;
45558
+ hasEditedCf = this.props.isNewCf;
45547
45559
  setup() {
45548
45560
  this.state = owl.useState({
45549
45561
  errors: [],
@@ -45601,6 +45613,9 @@ stores.inject(MyMetaStore, storeInstance);
45601
45613
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
45602
45614
  sheetId,
45603
45615
  });
45616
+ if (result.isSuccessful) {
45617
+ this.hasEditedCf = true;
45618
+ }
45604
45619
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
45605
45620
  if (!newCf.suppressErrors) {
45606
45621
  this.state.errors = reasons;
@@ -45622,7 +45637,15 @@ stores.inject(MyMetaStore, storeInstance);
45622
45637
  onSave() {
45623
45638
  const result = this.updateConditionalFormat({});
45624
45639
  if (result.length === 0) {
45625
- 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();
45626
45649
  }
45627
45650
  }
45628
45651
  getDefaultRules() {
@@ -76343,7 +76366,6 @@ stores.inject(MyMetaStore, storeInstance);
76343
76366
  this.checkViewportSize();
76344
76367
  stores.on("store-updated", this, render);
76345
76368
  resizeObserver.observe(this.spreadsheetRef.el);
76346
- registerChartJSExtensions();
76347
76369
  });
76348
76370
  owl.onWillUnmount(() => {
76349
76371
  this.unbindModelEvents();
@@ -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.15";
80925
+ __info__.date = "2025-08-04T06:51:38.674Z";
80926
+ __info__.hash = "9499d98";
80905
80927
 
80906
80928
 
80907
80929
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);