@odoo/o-spreadsheet 18.1.30 → 18.1.31

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.1.30
6
- * @date 2025-07-28T13:37:30.885Z
7
- * @hash d42e484
5
+ * @version 18.1.31
6
+ * @date 2025-08-04T06:52:11.010Z
7
+ * @hash 4f581fb
8
8
  */
9
9
 
10
10
  'use strict';
@@ -10479,6 +10479,7 @@ class ChartJsComponent extends owl.Component {
10479
10479
  }
10480
10480
  setup() {
10481
10481
  owl.onMounted(() => {
10482
+ registerChartJSExtensions();
10482
10483
  const runtime = this.chartRuntime;
10483
10484
  this.currentRuntime = runtime;
10484
10485
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11144,31 +11145,40 @@ autoCompleteProviders.add("dataValidation", {
11144
11145
  if (!this.composer.currentEditedCell) {
11145
11146
  return [];
11146
11147
  }
11147
- const position = this.composer.currentEditedCell;
11148
- const rule = this.getters.getValidationRuleForCell(position);
11149
- if (!rule ||
11150
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11151
- return [];
11152
- }
11153
- let values;
11154
- if (rule.criterion.type === "isValueInList") {
11155
- values = rule.criterion.values;
11156
- }
11157
- else {
11158
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11159
- values = Array.from(new Set(this.getters
11160
- .getRangeValues(range)
11161
- .filter(isNotNull)
11162
- .map((value) => value.toString())
11163
- .filter((val) => val !== "")));
11164
- }
11165
- return values.map((value) => ({ text: value }));
11148
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11149
+ text: value.value?.toString() || "",
11150
+ htmlContent: [{ value: value.label }],
11151
+ fuzzySearchKey: value.label,
11152
+ }));
11166
11153
  },
11167
11154
  selectProposal(tokenAtCursor, value) {
11168
11155
  this.composer.setCurrentContent(value);
11169
11156
  this.composer.stopEdition();
11170
11157
  },
11171
11158
  });
11159
+ function getProposedValues(getters, position) {
11160
+ const rule = getters.getValidationRuleForCell(position);
11161
+ if (!rule ||
11162
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11163
+ return [];
11164
+ }
11165
+ let values = [];
11166
+ if (rule.criterion.type === "isValueInList") {
11167
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11168
+ }
11169
+ else {
11170
+ const labelsSet = new Set();
11171
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11172
+ for (const p of positions(range.zone)) {
11173
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11174
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11175
+ labelsSet.add(cell.formattedValue);
11176
+ values.push({ label: cell.formattedValue, value: cell.value });
11177
+ }
11178
+ }
11179
+ }
11180
+ return values;
11181
+ }
11172
11182
 
11173
11183
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11174
11184
  const pendingHtmlContent = [];
@@ -42467,7 +42477,8 @@ class ConditionalFormattingEditor extends owl.Component {
42467
42477
  static props = {
42468
42478
  editedCf: Object,
42469
42479
  onCancel: Function,
42470
- onSave: Function,
42480
+ onExit: Function,
42481
+ isNewCf: Boolean,
42471
42482
  };
42472
42483
  static components = {
42473
42484
  SelectionInput,
@@ -42486,6 +42497,7 @@ class ConditionalFormattingEditor extends owl.Component {
42486
42497
  getTextDecoration = getTextDecoration;
42487
42498
  colorNumberString = colorNumberString;
42488
42499
  state;
42500
+ hasEditedCf = this.props.isNewCf;
42489
42501
  setup() {
42490
42502
  this.state = owl.useState({
42491
42503
  errors: [],
@@ -42543,6 +42555,9 @@ class ConditionalFormattingEditor extends owl.Component {
42543
42555
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42544
42556
  sheetId,
42545
42557
  });
42558
+ if (result.isSuccessful) {
42559
+ this.hasEditedCf = true;
42560
+ }
42546
42561
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42547
42562
  if (!newCf.suppressErrors) {
42548
42563
  this.state.errors = reasons;
@@ -42564,7 +42579,15 @@ class ConditionalFormattingEditor extends owl.Component {
42564
42579
  onSave() {
42565
42580
  const result = this.updateConditionalFormat({});
42566
42581
  if (result.length === 0) {
42567
- this.props.onSave();
42582
+ this.props.onExit();
42583
+ }
42584
+ }
42585
+ onCancel() {
42586
+ if (this.hasEditedCf) {
42587
+ this.props.onCancel();
42588
+ }
42589
+ else {
42590
+ this.props.onExit();
42568
42591
  }
42569
42592
  }
42570
42593
  getDefaultRules() {
@@ -72245,7 +72268,6 @@ class Spreadsheet extends owl.Component {
72245
72268
  this.checkViewportSize();
72246
72269
  stores.on("store-updated", this, render);
72247
72270
  resizeObserver.observe(this.spreadsheetRef.el);
72248
- registerChartJSExtensions();
72249
72271
  });
72250
72272
  owl.onWillUnmount(() => {
72251
72273
  this.unbindModelEvents();
@@ -76756,6 +76778,6 @@ exports.tokenColors = tokenColors;
76756
76778
  exports.tokenize = tokenize;
76757
76779
 
76758
76780
 
76759
- __info__.version = "18.1.30";
76760
- __info__.date = "2025-07-28T13:37:30.885Z";
76761
- __info__.hash = "d42e484";
76781
+ __info__.version = "18.1.31";
76782
+ __info__.date = "2025-08-04T06:52:11.010Z";
76783
+ __info__.hash = "4f581fb";
@@ -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.1.30
6
- * @date 2025-07-28T13:37:30.885Z
7
- * @hash d42e484
5
+ * @version 18.1.31
6
+ * @date 2025-08-04T06:52:11.010Z
7
+ * @hash 4f581fb
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -10477,6 +10477,7 @@ class ChartJsComponent extends Component {
10477
10477
  }
10478
10478
  setup() {
10479
10479
  onMounted(() => {
10480
+ registerChartJSExtensions();
10480
10481
  const runtime = this.chartRuntime;
10481
10482
  this.currentRuntime = runtime;
10482
10483
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11142,31 +11143,40 @@ autoCompleteProviders.add("dataValidation", {
11142
11143
  if (!this.composer.currentEditedCell) {
11143
11144
  return [];
11144
11145
  }
11145
- const position = this.composer.currentEditedCell;
11146
- const rule = this.getters.getValidationRuleForCell(position);
11147
- if (!rule ||
11148
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11149
- return [];
11150
- }
11151
- let values;
11152
- if (rule.criterion.type === "isValueInList") {
11153
- values = rule.criterion.values;
11154
- }
11155
- else {
11156
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11157
- values = Array.from(new Set(this.getters
11158
- .getRangeValues(range)
11159
- .filter(isNotNull)
11160
- .map((value) => value.toString())
11161
- .filter((val) => val !== "")));
11162
- }
11163
- return values.map((value) => ({ text: value }));
11146
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11147
+ text: value.value?.toString() || "",
11148
+ htmlContent: [{ value: value.label }],
11149
+ fuzzySearchKey: value.label,
11150
+ }));
11164
11151
  },
11165
11152
  selectProposal(tokenAtCursor, value) {
11166
11153
  this.composer.setCurrentContent(value);
11167
11154
  this.composer.stopEdition();
11168
11155
  },
11169
11156
  });
11157
+ function getProposedValues(getters, position) {
11158
+ const rule = getters.getValidationRuleForCell(position);
11159
+ if (!rule ||
11160
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11161
+ return [];
11162
+ }
11163
+ let values = [];
11164
+ if (rule.criterion.type === "isValueInList") {
11165
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11166
+ }
11167
+ else {
11168
+ const labelsSet = new Set();
11169
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11170
+ for (const p of positions(range.zone)) {
11171
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11172
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11173
+ labelsSet.add(cell.formattedValue);
11174
+ values.push({ label: cell.formattedValue, value: cell.value });
11175
+ }
11176
+ }
11177
+ }
11178
+ return values;
11179
+ }
11170
11180
 
11171
11181
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11172
11182
  const pendingHtmlContent = [];
@@ -42465,7 +42475,8 @@ class ConditionalFormattingEditor extends Component {
42465
42475
  static props = {
42466
42476
  editedCf: Object,
42467
42477
  onCancel: Function,
42468
- onSave: Function,
42478
+ onExit: Function,
42479
+ isNewCf: Boolean,
42469
42480
  };
42470
42481
  static components = {
42471
42482
  SelectionInput,
@@ -42484,6 +42495,7 @@ class ConditionalFormattingEditor extends Component {
42484
42495
  getTextDecoration = getTextDecoration;
42485
42496
  colorNumberString = colorNumberString;
42486
42497
  state;
42498
+ hasEditedCf = this.props.isNewCf;
42487
42499
  setup() {
42488
42500
  this.state = useState({
42489
42501
  errors: [],
@@ -42541,6 +42553,9 @@ class ConditionalFormattingEditor extends Component {
42541
42553
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42542
42554
  sheetId,
42543
42555
  });
42556
+ if (result.isSuccessful) {
42557
+ this.hasEditedCf = true;
42558
+ }
42544
42559
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42545
42560
  if (!newCf.suppressErrors) {
42546
42561
  this.state.errors = reasons;
@@ -42562,7 +42577,15 @@ class ConditionalFormattingEditor extends Component {
42562
42577
  onSave() {
42563
42578
  const result = this.updateConditionalFormat({});
42564
42579
  if (result.length === 0) {
42565
- this.props.onSave();
42580
+ this.props.onExit();
42581
+ }
42582
+ }
42583
+ onCancel() {
42584
+ if (this.hasEditedCf) {
42585
+ this.props.onCancel();
42586
+ }
42587
+ else {
42588
+ this.props.onExit();
42566
42589
  }
42567
42590
  }
42568
42591
  getDefaultRules() {
@@ -72243,7 +72266,6 @@ class Spreadsheet extends Component {
72243
72266
  this.checkViewportSize();
72244
72267
  stores.on("store-updated", this, render);
72245
72268
  resizeObserver.observe(this.spreadsheetRef.el);
72246
- registerChartJSExtensions();
72247
72269
  });
72248
72270
  onWillUnmount(() => {
72249
72271
  this.unbindModelEvents();
@@ -76710,6 +76732,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
76710
76732
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, 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 };
76711
76733
 
76712
76734
 
76713
- __info__.version = "18.1.30";
76714
- __info__.date = "2025-07-28T13:37:30.885Z";
76715
- __info__.hash = "d42e484";
76735
+ __info__.version = "18.1.31";
76736
+ __info__.date = "2025-08-04T06:52:11.010Z";
76737
+ __info__.hash = "4f581fb";
@@ -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.1.30
6
- * @date 2025-07-28T13:37:30.885Z
7
- * @hash d42e484
5
+ * @version 18.1.31
6
+ * @date 2025-08-04T06:52:11.010Z
7
+ * @hash 4f581fb
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -10478,6 +10478,7 @@ stores.inject(MyMetaStore, storeInstance);
10478
10478
  }
10479
10479
  setup() {
10480
10480
  owl.onMounted(() => {
10481
+ registerChartJSExtensions();
10481
10482
  const runtime = this.chartRuntime;
10482
10483
  this.currentRuntime = runtime;
10483
10484
  // Note: chartJS modify the runtime in place, so it's important to give it a copy
@@ -11143,31 +11144,40 @@ stores.inject(MyMetaStore, storeInstance);
11143
11144
  if (!this.composer.currentEditedCell) {
11144
11145
  return [];
11145
11146
  }
11146
- const position = this.composer.currentEditedCell;
11147
- const rule = this.getters.getValidationRuleForCell(position);
11148
- if (!rule ||
11149
- (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11150
- return [];
11151
- }
11152
- let values;
11153
- if (rule.criterion.type === "isValueInList") {
11154
- values = rule.criterion.values;
11155
- }
11156
- else {
11157
- const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11158
- values = Array.from(new Set(this.getters
11159
- .getRangeValues(range)
11160
- .filter(isNotNull)
11161
- .map((value) => value.toString())
11162
- .filter((val) => val !== "")));
11163
- }
11164
- return values.map((value) => ({ text: value }));
11147
+ return getProposedValues(this.getters, this.composer.currentEditedCell).map((value) => ({
11148
+ text: value.value?.toString() || "",
11149
+ htmlContent: [{ value: value.label }],
11150
+ fuzzySearchKey: value.label,
11151
+ }));
11165
11152
  },
11166
11153
  selectProposal(tokenAtCursor, value) {
11167
11154
  this.composer.setCurrentContent(value);
11168
11155
  this.composer.stopEdition();
11169
11156
  },
11170
11157
  });
11158
+ function getProposedValues(getters, position) {
11159
+ const rule = getters.getValidationRuleForCell(position);
11160
+ if (!rule ||
11161
+ (rule.criterion.type !== "isValueInList" && rule.criterion.type !== "isValueInRange")) {
11162
+ return [];
11163
+ }
11164
+ let values = [];
11165
+ if (rule.criterion.type === "isValueInList") {
11166
+ values = rule.criterion.values.map((value) => ({ label: value, value }));
11167
+ }
11168
+ else {
11169
+ const labelsSet = new Set();
11170
+ const range = getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
11171
+ for (const p of positions(range.zone)) {
11172
+ const cell = getters.getEvaluatedCell({ ...p, sheetId: range.sheetId });
11173
+ if (cell.formattedValue && !labelsSet.has(cell.formattedValue)) {
11174
+ labelsSet.add(cell.formattedValue);
11175
+ values.push({ label: cell.formattedValue, value: cell.value });
11176
+ }
11177
+ }
11178
+ }
11179
+ return values;
11180
+ }
11171
11181
 
11172
11182
  function getHtmlContentFromPattern(pattern, value, highlightColor, className) {
11173
11183
  const pendingHtmlContent = [];
@@ -42466,7 +42476,8 @@ stores.inject(MyMetaStore, storeInstance);
42466
42476
  static props = {
42467
42477
  editedCf: Object,
42468
42478
  onCancel: Function,
42469
- onSave: Function,
42479
+ onExit: Function,
42480
+ isNewCf: Boolean,
42470
42481
  };
42471
42482
  static components = {
42472
42483
  SelectionInput,
@@ -42485,6 +42496,7 @@ stores.inject(MyMetaStore, storeInstance);
42485
42496
  getTextDecoration = getTextDecoration;
42486
42497
  colorNumberString = colorNumberString;
42487
42498
  state;
42499
+ hasEditedCf = this.props.isNewCf;
42488
42500
  setup() {
42489
42501
  this.state = owl.useState({
42490
42502
  errors: [],
@@ -42542,6 +42554,9 @@ stores.inject(MyMetaStore, storeInstance);
42542
42554
  ranges: ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42543
42555
  sheetId,
42544
42556
  });
42557
+ if (result.isSuccessful) {
42558
+ this.hasEditedCf = true;
42559
+ }
42545
42560
  const reasons = result.reasons.filter((r) => r !== "NoChanges" /* CommandResult.NoChanges */);
42546
42561
  if (!newCf.suppressErrors) {
42547
42562
  this.state.errors = reasons;
@@ -42563,7 +42578,15 @@ stores.inject(MyMetaStore, storeInstance);
42563
42578
  onSave() {
42564
42579
  const result = this.updateConditionalFormat({});
42565
42580
  if (result.length === 0) {
42566
- this.props.onSave();
42581
+ this.props.onExit();
42582
+ }
42583
+ }
42584
+ onCancel() {
42585
+ if (this.hasEditedCf) {
42586
+ this.props.onCancel();
42587
+ }
42588
+ else {
42589
+ this.props.onExit();
42567
42590
  }
42568
42591
  }
42569
42592
  getDefaultRules() {
@@ -72244,7 +72267,6 @@ stores.inject(MyMetaStore, storeInstance);
72244
72267
  this.checkViewportSize();
72245
72268
  stores.on("store-updated", this, render);
72246
72269
  resizeObserver.observe(this.spreadsheetRef.el);
72247
- registerChartJSExtensions();
72248
72270
  });
72249
72271
  owl.onWillUnmount(() => {
72250
72272
  this.unbindModelEvents();
@@ -76755,9 +76777,9 @@ stores.inject(MyMetaStore, storeInstance);
76755
76777
  exports.tokenize = tokenize;
76756
76778
 
76757
76779
 
76758
- __info__.version = "18.1.30";
76759
- __info__.date = "2025-07-28T13:37:30.885Z";
76760
- __info__.hash = "d42e484";
76780
+ __info__.version = "18.1.31";
76781
+ __info__.date = "2025-08-04T06:52:11.010Z";
76782
+ __info__.hash = "4f581fb";
76761
76783
 
76762
76784
 
76763
76785
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);