@odoo/o-spreadsheet 18.2.22 → 18.2.23

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.23
6
+ * @date 2025-07-30T11:19:55.262Z
7
+ * @hash 4419b30
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) {
@@ -11317,31 +11317,40 @@ autoCompleteProviders.add("dataValidation", {
11317
11317
  if (!this.composer.currentEditedCell) {
11318
11318
  return [];
11319
11319
  }
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 }));
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
+ }));
11339
11325
  },
11340
11326
  selectProposal(tokenAtCursor, value) {
11341
11327
  this.composer.setCurrentContent(value);
11342
11328
  this.composer.stopEdition();
11343
11329
  },
11344
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
+ }
11345
11354
 
11346
11355
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11347
11356
  const pendingHtmlContent = [];
@@ -42812,7 +42821,8 @@ class ConditionalFormattingEditor extends owl.Component {
42812
42821
  static props = {
42813
42822
  editedCf: Object,
42814
42823
  onCancel: Function,
42815
- onSave: Function,
42824
+ onExit: Function,
42825
+ isNewCf: Boolean,
42816
42826
  };
42817
42827
  static components = {
42818
42828
  SelectionInput,
@@ -42831,6 +42841,7 @@ class ConditionalFormattingEditor extends owl.Component {
42831
42841
  getTextDecoration = getTextDecoration;
42832
42842
  colorNumberString = colorNumberString;
42833
42843
  state;
42844
+ hasEditedCf = this.props.isNewCf;
42834
42845
  setup() {
42835
42846
  this.state = owl.useState({
42836
42847
  errors: [],
@@ -42888,6 +42899,9 @@ class ConditionalFormattingEditor extends owl.Component {
42888
42899
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42889
42900
  sheetId,
42890
42901
  });
42902
+ if (result.isSuccessful) {
42903
+ this.hasEditedCf = true;
42904
+ }
42891
42905
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42892
42906
  if (!newCf.suppressErrors) {
42893
42907
  this.state.errors = reasons;
@@ -42909,7 +42923,15 @@ class ConditionalFormattingEditor extends owl.Component {
42909
42923
  onSave() {
42910
42924
  const result = this.updateConditionalFormat({});
42911
42925
  if (result.length === 0) {
42912
- 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();
42913
42935
  }
42914
42936
  }
42915
42937
  getDefaultRules() {
@@ -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.23";
77263
+ __info__.date = "2025-07-30T11:19:55.262Z";
77264
+ __info__.hash = "4419b30";
@@ -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.23
6
+ * @date 2025-07-30T11:19:55.262Z
7
+ * @hash 4419b30
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) {
@@ -11315,31 +11315,40 @@ autoCompleteProviders.add("dataValidation", {
11315
11315
  if (!this.composer.currentEditedCell) {
11316
11316
  return [];
11317
11317
  }
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 }));
11318
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11319
+ text: value.value?.toString() || "",
11320
+ htmlContent: [{ value: value.label }],
11321
+ fuzzySearchKey: value.label,
11322
+ }));
11337
11323
  },
11338
11324
  selectProposal(tokenAtCursor, value) {
11339
11325
  this.composer.setCurrentContent(value);
11340
11326
  this.composer.stopEdition();
11341
11327
  },
11342
11328
  });
11329
+ function getProposedValues(getters, position) {
11330
+ const rule = getters.getValidationRuleForCell(position);
11331
+ if (!rule ||
11332
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11333
+ return [];
11334
+ }
11335
+ let values = [];
11336
+ if (rule.criterion.type === "isValueInList") {
11337
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11338
+ }
11339
+ else {
11340
+ const labelsSet = new Set();
11341
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11342
+ for (const p of positions(range.zone)) {
11343
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11344
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11345
+ labelsSet.add(cell.formattedValue);
11346
+ values.push({ label: cell.formattedValue, value: cell.value });
11347
+ }
11348
+ }
11349
+ }
11350
+ return values;
11351
+ }
11343
11352
 
11344
11353
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11345
11354
  const pendingHtmlContent = [];
@@ -42810,7 +42819,8 @@ class ConditionalFormattingEditor extends Component {
42810
42819
  static props = {
42811
42820
  editedCf: Object,
42812
42821
  onCancel: Function,
42813
- onSave: Function,
42822
+ onExit: Function,
42823
+ isNewCf: Boolean,
42814
42824
  };
42815
42825
  static components = {
42816
42826
  SelectionInput,
@@ -42829,6 +42839,7 @@ class ConditionalFormattingEditor extends Component {
42829
42839
  getTextDecoration = getTextDecoration;
42830
42840
  colorNumberString = colorNumberString;
42831
42841
  state;
42842
+ hasEditedCf = this.props.isNewCf;
42832
42843
  setup() {
42833
42844
  this.state = useState({
42834
42845
  errors: [],
@@ -42886,6 +42897,9 @@ class ConditionalFormattingEditor extends Component {
42886
42897
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42887
42898
  sheetId,
42888
42899
  });
42900
+ if (result.isSuccessful) {
42901
+ this.hasEditedCf = true;
42902
+ }
42889
42903
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42890
42904
  if (!newCf.suppressErrors) {
42891
42905
  this.state.errors = reasons;
@@ -42907,7 +42921,15 @@ class ConditionalFormattingEditor extends Component {
42907
42921
  onSave() {
42908
42922
  const result = this.updateConditionalFormat({});
42909
42923
  if (result.length === 0) {
42910
- this.props.onSave();
42924
+ this.props.onExit();
42925
+ }
42926
+ }
42927
+ onCancel() {
42928
+ if (this.hasEditedCf) {
42929
+ this.props.onCancel();
42930
+ }
42931
+ else {
42932
+ this.props.onExit();
42911
42933
  }
42912
42934
  }
42913
42935
  getDefaultRules() {
@@ -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.23";
77216
+ __info__.date = "2025-07-30T11:19:55.262Z";
77217
+ __info__.hash = "4419b30";
@@ -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.23
6
+ * @date 2025-07-30T11:19:55.262Z
7
+ * @hash 4419b30
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) {
@@ -11316,31 +11316,40 @@ stores.inject(MyMetaStore, storeInstance);
11316
11316
  if (!this.composer.currentEditedCell) {
11317
11317
  return [];
11318
11318
  }
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 }));
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
+ }));
11338
11324
  },
11339
11325
  selectProposal(tokenAtCursor, value) {
11340
11326
  this.composer.setCurrentContent(value);
11341
11327
  this.composer.stopEdition();
11342
11328
  },
11343
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
+ }
11344
11353
 
11345
11354
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11346
11355
  const pendingHtmlContent = [];
@@ -42811,7 +42820,8 @@ stores.inject(MyMetaStore, storeInstance);
42811
42820
  static props = {
42812
42821
  editedCf: Object,
42813
42822
  onCancel: Function,
42814
- onSave: Function,
42823
+ onExit: Function,
42824
+ isNewCf: Boolean,
42815
42825
  };
42816
42826
  static components = {
42817
42827
  SelectionInput,
@@ -42830,6 +42840,7 @@ stores.inject(MyMetaStore, storeInstance);
42830
42840
  getTextDecoration = getTextDecoration;
42831
42841
  colorNumberString = colorNumberString;
42832
42842
  state;
42843
+ hasEditedCf = this.props.isNewCf;
42833
42844
  setup() {
42834
42845
  this.state = owl.useState({
42835
42846
  errors: [],
@@ -42887,6 +42898,9 @@ stores.inject(MyMetaStore, storeInstance);
42887
42898
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42888
42899
  sheetId,
42889
42900
  });
42901
+ if (result.isSuccessful) {
42902
+ this.hasEditedCf = true;
42903
+ }
42890
42904
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42891
42905
  if (!newCf.suppressErrors) {
42892
42906
  this.state.errors = reasons;
@@ -42908,7 +42922,15 @@ stores.inject(MyMetaStore, storeInstance);
42908
42922
  onSave() {
42909
42923
  const result = this.updateConditionalFormat({});
42910
42924
  if (result.length === 0) {
42911
- 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();
42912
42934
  }
42913
42935
  }
42914
42936
  getDefaultRules() {
@@ -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.23";
77262
+ __info__.date = "2025-07-30T11:19:55.262Z";
77263
+ __info__.hash = "4419b30";
77242
77264
 
77243
77265
 
77244
77266
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);