@odoo/o-spreadsheet 18.2.22 → 18.2.24

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.2.22
6
- * @date 2025-07-28T13:37:29.067Z
7
- * @hash 0e414b1
5
+ * @version 18.2.24
6
+ * @date 2025-08-04T06:52:37.759Z
7
+ * @hash 5709b1b
8
8
  */
9
9
 
10
10
  'use strict';
@@ -8367,12 +8367,12 @@ const AGGREGATOR_NAMES = {
8367
8367
  avg: _t("Average"),
8368
8368
  sum: _t("Sum"),
8369
8369
  };
8370
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8370
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8371
8371
  const AGGREGATORS_BY_FIELD_TYPE = {
8372
- integer: NUMBER_CHAR_AGGREGATORS,
8373
- char: NUMBER_CHAR_AGGREGATORS,
8372
+ integer: DEFAULT_AGGREGATORS,
8373
+ char: DEFAULT_AGGREGATORS,
8374
+ datetime: DEFAULT_AGGREGATORS,
8374
8375
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8375
- datetime: ["max", "min", "count_distinct", "count"],
8376
8376
  };
8377
8377
  const AGGREGATORS = {};
8378
8378
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -10652,6 +10652,7 @@ class ChartJsComponent extends owl.Component {
10652
10652
  }
10653
10653
  setup() {
10654
10654
  owl.onMounted(() => {
10655
+ registerChartJSExtensions();
10655
10656
  const runtime = this.chartRuntime;
10656
10657
  this.currentRuntime = runtime;
10657
10658
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11317,31 +11318,40 @@ autoCompleteProviders.add("dataValidation", {
11317
11318
  if (!this.composer.currentEditedCell) {
11318
11319
  return [];
11319
11320
  }
11320
- const position = this.composer.currentEditedCell;
11321
- const rule = this.getters.getValidationRuleForCell(position);
11322
- if (!rule ||
11323
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11324
- return [];
11325
- }
11326
- let values;
11327
- if (rule.criterion.type === "isValueInList") {
11328
- values = rule.criterion.values;
11329
- }
11330
- else {
11331
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11332
- values = Array.from(new Set(this.getters
11333
- .getRangeValues(range)
11334
- .filter(isNotNull)
11335
- .map((value) => value.toString())
11336
- .filter((val) => val !== "")));
11337
- }
11338
- return values.map((value) => ({ text: value }));
11321
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11322
+ text: value.value?.toString() || "",
11323
+ htmlContent: [{ value: value.label }],
11324
+ fuzzySearchKey: value.label,
11325
+ }));
11339
11326
  },
11340
11327
  selectProposal(tokenAtCursor, value) {
11341
11328
  this.composer.setCurrentContent(value);
11342
11329
  this.composer.stopEdition();
11343
11330
  },
11344
11331
  });
11332
+ function getProposedValues(getters, position) {
11333
+ const rule = getters.getValidationRuleForCell(position);
11334
+ if (!rule ||
11335
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11336
+ return [];
11337
+ }
11338
+ let values = [];
11339
+ if (rule.criterion.type === "isValueInList") {
11340
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11341
+ }
11342
+ else {
11343
+ const labelsSet = new Set();
11344
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11345
+ for (const p of positions(range.zone)) {
11346
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11347
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11348
+ labelsSet.add(cell.formattedValue);
11349
+ values.push({ label: cell.formattedValue, value: cell.value });
11350
+ }
11351
+ }
11352
+ }
11353
+ return values;
11354
+ }
11345
11355
 
11346
11356
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11347
11357
  const pendingHtmlContent = [];
@@ -42812,7 +42822,8 @@ class ConditionalFormattingEditor extends owl.Component {
42812
42822
  static props = {
42813
42823
  editedCf: Object,
42814
42824
  onCancel: Function,
42815
- onSave: Function,
42825
+ onExit: Function,
42826
+ isNewCf: Boolean,
42816
42827
  };
42817
42828
  static components = {
42818
42829
  SelectionInput,
@@ -42831,6 +42842,7 @@ class ConditionalFormattingEditor extends owl.Component {
42831
42842
  getTextDecoration = getTextDecoration;
42832
42843
  colorNumberString = colorNumberString;
42833
42844
  state;
42845
+ hasEditedCf = this.props.isNewCf;
42834
42846
  setup() {
42835
42847
  this.state = owl.useState({
42836
42848
  errors: [],
@@ -42888,6 +42900,9 @@ class ConditionalFormattingEditor extends owl.Component {
42888
42900
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42889
42901
  sheetId,
42890
42902
  });
42903
+ if (result.isSuccessful) {
42904
+ this.hasEditedCf = true;
42905
+ }
42891
42906
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42892
42907
  if (!newCf.suppressErrors) {
42893
42908
  this.state.errors = reasons;
@@ -42909,7 +42924,15 @@ class ConditionalFormattingEditor extends owl.Component {
42909
42924
  onSave() {
42910
42925
  const result = this.updateConditionalFormat({});
42911
42926
  if (result.length === 0) {
42912
- this.props.onSave();
42927
+ this.props.onExit();
42928
+ }
42929
+ }
42930
+ onCancel() {
42931
+ if (this.hasEditedCf) {
42932
+ this.props.onCancel();
42933
+ }
42934
+ else {
42935
+ this.props.onExit();
42913
42936
  }
42914
42937
  }
42915
42938
  getDefaultRules() {
@@ -72693,7 +72716,6 @@ class Spreadsheet extends owl.Component {
72693
72716
  this.checkViewportSize();
72694
72717
  stores.on("store-updated", this, render);
72695
72718
  resizeObserver.observe(this.spreadsheetRef.el);
72696
- registerChartJSExtensions();
72697
72719
  });
72698
72720
  owl.onWillUnmount(() => {
72699
72721
  this.unbindModelEvents();
@@ -77237,6 +77259,6 @@ exports.tokenColors = tokenColors;
77237
77259
  exports.tokenize = tokenize;
77238
77260
 
77239
77261
 
77240
- __info__.version = "18.2.22";
77241
- __info__.date = "2025-07-28T13:37:29.067Z";
77242
- __info__.hash = "0e414b1";
77262
+ __info__.version = "18.2.24";
77263
+ __info__.date = "2025-08-04T06:52:37.759Z";
77264
+ __info__.hash = "5709b1b";
@@ -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.2.22
6
- * @date 2025-07-28T13:37:29.067Z
7
- * @hash 0e414b1
5
+ * @version 18.2.24
6
+ * @date 2025-08-04T06:52:37.759Z
7
+ * @hash 5709b1b
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';
@@ -8365,12 +8365,12 @@ const AGGREGATOR_NAMES = {
8365
8365
  avg: _t("Average"),
8366
8366
  sum: _t("Sum"),
8367
8367
  };
8368
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8368
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8369
8369
  const AGGREGATORS_BY_FIELD_TYPE = {
8370
- integer: NUMBER_CHAR_AGGREGATORS,
8371
- char: NUMBER_CHAR_AGGREGATORS,
8370
+ integer: DEFAULT_AGGREGATORS,
8371
+ char: DEFAULT_AGGREGATORS,
8372
+ datetime: DEFAULT_AGGREGATORS,
8372
8373
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8373
- datetime: ["max", "min", "count_distinct", "count"],
8374
8374
  };
8375
8375
  const AGGREGATORS = {};
8376
8376
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -10650,6 +10650,7 @@ class ChartJsComponent extends Component {
10650
10650
  }
10651
10651
  setup() {
10652
10652
  onMounted(() => {
10653
+ registerChartJSExtensions();
10653
10654
  const runtime = this.chartRuntime;
10654
10655
  this.currentRuntime = runtime;
10655
10656
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11315,31 +11316,40 @@ autoCompleteProviders.add("dataValidation", {
11315
11316
  if (!this.composer.currentEditedCell) {
11316
11317
  return [];
11317
11318
  }
11318
- const position = this.composer.currentEditedCell;
11319
- const rule = this.getters.getValidationRuleForCell(position);
11320
- if (!rule ||
11321
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11322
- return [];
11323
- }
11324
- let values;
11325
- if (rule.criterion.type === "isValueInList") {
11326
- values = rule.criterion.values;
11327
- }
11328
- else {
11329
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11330
- values = Array.from(new Set(this.getters
11331
- .getRangeValues(range)
11332
- .filter(isNotNull)
11333
- .map((value) => value.toString())
11334
- .filter((val) => val !== "")));
11335
- }
11336
- return values.map((value) => ({ text: value }));
11319
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11320
+ text: value.value?.toString() || "",
11321
+ htmlContent: [{ value: value.label }],
11322
+ fuzzySearchKey: value.label,
11323
+ }));
11337
11324
  },
11338
11325
  selectProposal(tokenAtCursor, value) {
11339
11326
  this.composer.setCurrentContent(value);
11340
11327
  this.composer.stopEdition();
11341
11328
  },
11342
11329
  });
11330
+ function getProposedValues(getters, position) {
11331
+ const rule = getters.getValidationRuleForCell(position);
11332
+ if (!rule ||
11333
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11334
+ return [];
11335
+ }
11336
+ let values = [];
11337
+ if (rule.criterion.type === "isValueInList") {
11338
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11339
+ }
11340
+ else {
11341
+ const labelsSet = new Set();
11342
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11343
+ for (const p of positions(range.zone)) {
11344
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11345
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11346
+ labelsSet.add(cell.formattedValue);
11347
+ values.push({ label: cell.formattedValue, value: cell.value });
11348
+ }
11349
+ }
11350
+ }
11351
+ return values;
11352
+ }
11343
11353
 
11344
11354
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11345
11355
  const pendingHtmlContent = [];
@@ -42810,7 +42820,8 @@ class ConditionalFormattingEditor extends Component {
42810
42820
  static props = {
42811
42821
  editedCf: Object,
42812
42822
  onCancel: Function,
42813
- onSave: Function,
42823
+ onExit: Function,
42824
+ isNewCf: Boolean,
42814
42825
  };
42815
42826
  static components = {
42816
42827
  SelectionInput,
@@ -42829,6 +42840,7 @@ class ConditionalFormattingEditor extends Component {
42829
42840
  getTextDecoration = getTextDecoration;
42830
42841
  colorNumberString = colorNumberString;
42831
42842
  state;
42843
+ hasEditedCf = this.props.isNewCf;
42832
42844
  setup() {
42833
42845
  this.state = useState({
42834
42846
  errors: [],
@@ -42886,6 +42898,9 @@ class ConditionalFormattingEditor extends Component {
42886
42898
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42887
42899
  sheetId,
42888
42900
  });
42901
+ if (result.isSuccessful) {
42902
+ this.hasEditedCf = true;
42903
+ }
42889
42904
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42890
42905
  if (!newCf.suppressErrors) {
42891
42906
  this.state.errors = reasons;
@@ -42907,7 +42922,15 @@ class ConditionalFormattingEditor extends Component {
42907
42922
  onSave() {
42908
42923
  const result = this.updateConditionalFormat({});
42909
42924
  if (result.length === 0) {
42910
- this.props.onSave();
42925
+ this.props.onExit();
42926
+ }
42927
+ }
42928
+ onCancel() {
42929
+ if (this.hasEditedCf) {
42930
+ this.props.onCancel();
42931
+ }
42932
+ else {
42933
+ this.props.onExit();
42911
42934
  }
42912
42935
  }
42913
42936
  getDefaultRules() {
@@ -72691,7 +72714,6 @@ class Spreadsheet extends Component {
72691
72714
  this.checkViewportSize();
72692
72715
  stores.on("store-updated", this, render);
72693
72716
  resizeObserver.observe(this.spreadsheetRef.el);
72694
- registerChartJSExtensions();
72695
72717
  });
72696
72718
  onWillUnmount(() => {
72697
72719
  this.unbindModelEvents();
@@ -77190,6 +77212,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
77190
77212
  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, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
77191
77213
 
77192
77214
 
77193
- __info__.version = "18.2.22";
77194
- __info__.date = "2025-07-28T13:37:29.067Z";
77195
- __info__.hash = "0e414b1";
77215
+ __info__.version = "18.2.24";
77216
+ __info__.date = "2025-08-04T06:52:37.759Z";
77217
+ __info__.hash = "5709b1b";
@@ -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.2.22
6
- * @date 2025-07-28T13:37:29.067Z
7
- * @hash 0e414b1
5
+ * @version 18.2.24
6
+ * @date 2025-08-04T06:52:37.759Z
7
+ * @hash 5709b1b
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -8366,12 +8366,12 @@
8366
8366
  avg: _t("Average"),
8367
8367
  sum: _t("Sum"),
8368
8368
  };
8369
- const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8369
+ const DEFAULT_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
8370
8370
  const AGGREGATORS_BY_FIELD_TYPE = {
8371
- integer: NUMBER_CHAR_AGGREGATORS,
8372
- char: NUMBER_CHAR_AGGREGATORS,
8371
+ integer: DEFAULT_AGGREGATORS,
8372
+ char: DEFAULT_AGGREGATORS,
8373
+ datetime: DEFAULT_AGGREGATORS,
8373
8374
  boolean: ["count_distinct", "count", "bool_and", "bool_or"],
8374
- datetime: ["max", "min", "count_distinct", "count"],
8375
8375
  };
8376
8376
  const AGGREGATORS = {};
8377
8377
  for (const type in AGGREGATORS_BY_FIELD_TYPE) {
@@ -10651,6 +10651,7 @@ stores.inject(MyMetaStore, storeInstance);
10651
10651
  }
10652
10652
  setup() {
10653
10653
  owl.onMounted(() => {
10654
+ registerChartJSExtensions();
10654
10655
  const runtime = this.chartRuntime;
10655
10656
  this.currentRuntime = runtime;
10656
10657
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11316,31 +11317,40 @@ stores.inject(MyMetaStore, storeInstance);
11316
11317
  if (!this.composer.currentEditedCell) {
11317
11318
  return [];
11318
11319
  }
11319
- const position = this.composer.currentEditedCell;
11320
- const rule = this.getters.getValidationRuleForCell(position);
11321
- if (!rule ||
11322
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11323
- return [];
11324
- }
11325
- let values;
11326
- if (rule.criterion.type === "isValueInList") {
11327
- values = rule.criterion.values;
11328
- }
11329
- else {
11330
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11331
- values = Array.from(new Set(this.getters
11332
- .getRangeValues(range)
11333
- .filter(isNotNull)
11334
- .map((value) => value.toString())
11335
- .filter((val) => val !== "")));
11336
- }
11337
- return values.map((value) => ({ text: value }));
11320
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11321
+ text: value.value?.toString() || "",
11322
+ htmlContent: [{ value: value.label }],
11323
+ fuzzySearchKey: value.label,
11324
+ }));
11338
11325
  },
11339
11326
  selectProposal(tokenAtCursor, value) {
11340
11327
  this.composer.setCurrentContent(value);
11341
11328
  this.composer.stopEdition();
11342
11329
  },
11343
11330
  });
11331
+ function getProposedValues(getters, position) {
11332
+ const rule = getters.getValidationRuleForCell(position);
11333
+ if (!rule ||
11334
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11335
+ return [];
11336
+ }
11337
+ let values = [];
11338
+ if (rule.criterion.type === "isValueInList") {
11339
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11340
+ }
11341
+ else {
11342
+ const labelsSet = new Set();
11343
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11344
+ for (const p of positions(range.zone)) {
11345
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11346
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11347
+ labelsSet.add(cell.formattedValue);
11348
+ values.push({ label: cell.formattedValue, value: cell.value });
11349
+ }
11350
+ }
11351
+ }
11352
+ return values;
11353
+ }
11344
11354
 
11345
11355
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11346
11356
  const pendingHtmlContent = [];
@@ -42811,7 +42821,8 @@ stores.inject(MyMetaStore, storeInstance);
42811
42821
  static props = {
42812
42822
  editedCf: Object,
42813
42823
  onCancel: Function,
42814
- onSave: Function,
42824
+ onExit: Function,
42825
+ isNewCf: Boolean,
42815
42826
  };
42816
42827
  static components = {
42817
42828
  SelectionInput,
@@ -42830,6 +42841,7 @@ stores.inject(MyMetaStore, storeInstance);
42830
42841
  getTextDecoration = getTextDecoration;
42831
42842
  colorNumberString = colorNumberString;
42832
42843
  state;
42844
+ hasEditedCf = this.props.isNewCf;
42833
42845
  setup() {
42834
42846
  this.state = owl.useState({
42835
42847
  errors: [],
@@ -42887,6 +42899,9 @@ stores.inject(MyMetaStore, storeInstance);
42887
42899
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42888
42900
  sheetId,
42889
42901
  });
42902
+ if (result.isSuccessful) {
42903
+ this.hasEditedCf = true;
42904
+ }
42890
42905
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42891
42906
  if (!newCf.suppressErrors) {
42892
42907
  this.state.errors = reasons;
@@ -42908,7 +42923,15 @@ stores.inject(MyMetaStore, storeInstance);
42908
42923
  onSave() {
42909
42924
  const result = this.updateConditionalFormat({});
42910
42925
  if (result.length === 0) {
42911
- this.props.onSave();
42926
+ this.props.onExit();
42927
+ }
42928
+ }
42929
+ onCancel() {
42930
+ if (this.hasEditedCf) {
42931
+ this.props.onCancel();
42932
+ }
42933
+ else {
42934
+ this.props.onExit();
42912
42935
  }
42913
42936
  }
42914
42937
  getDefaultRules() {
@@ -72692,7 +72715,6 @@ stores.inject(MyMetaStore, storeInstance);
72692
72715
  this.checkViewportSize();
72693
72716
  stores.on("store-updated", this, render);
72694
72717
  resizeObserver.observe(this.spreadsheetRef.el);
72695
- registerChartJSExtensions();
72696
72718
  });
72697
72719
  owl.onWillUnmount(() => {
72698
72720
  this.unbindModelEvents();
@@ -77236,9 +77258,9 @@ stores.inject(MyMetaStore, storeInstance);
77236
77258
  exports.tokenize = tokenize;
77237
77259
 
77238
77260
 
77239
- __info__.version = "18.2.22";
77240
- __info__.date = "2025-07-28T13:37:29.067Z";
77241
- __info__.hash = "0e414b1";
77261
+ __info__.version = "18.2.24";
77262
+ __info__.date = "2025-08-04T06:52:37.759Z";
77263
+ __info__.hash = "5709b1b";
77242
77264
 
77243
77265
 
77244
77266
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);