Skip to content

Commit 4b73941

Browse files
LucasLefevreanhe-odoolaa-odoodhrp-odoohokolomopo
committed
[FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits: odoo/o-spreadsheet@c1d64fba1 [REL] 18.0.33 [Task: 0](https://www.odoo.com/odoo/2328/tasks/0) odoo/o-spreadsheet@c8a291e80 [PERF] table: faster table extend check [Task: 4864420](https://www.odoo.com/odoo/2328/tasks/4864420) odoo/o-spreadsheet@e7b4ff760 [FIX] Table: avoid triggering an unecessary evaluation [Task: 4862862](https://www.odoo.com/odoo/2328/tasks/4862862) odoo/o-spreadsheet@3de4362fd [FIX] filter: fix horrible performances with huge data filters [Task: 4658998](https://www.odoo.com/odoo/2328/tasks/4658998) odoo/o-spreadsheet@d1cc0590d [FIX] Formats: text format should not mark the cell as non-empty [Task: 4856923](https://www.odoo.com/odoo/2328/tasks/4856923) odoo/o-spreadsheet@c98a9beeb [FIX] pie chart: prevent overlapping shown values [Task: 4639810](https://www.odoo.com/odoo/2328/tasks/4639810) odoo/o-spreadsheet@0f8b34976 [FIX] base_extractor: properly handle 0 as default value [Task: 4730308](https://www.odoo.com/odoo/2328/tasks/4730308) closes odoo#213946 Signed-off-by: Pierre Rousseau (pro) <[email protected]> Co-authored-by: Anthony Hendrickx (anhe) <[email protected]> Co-authored-by: Alexis Lacroix (laa) <[email protected]> Co-authored-by: Lucas Lefèvre (lul) <[email protected]> Co-authored-by: Dhrutik Patel (dhrp) <[email protected]> Co-authored-by: Adrien Minne (adrm) <[email protected]> Co-authored-by: Mehdi Rachico (mera) <[email protected]> Co-authored-by: Florian Damhaut (flda) <[email protected]> Co-authored-by: Rémi Rahir (rar) <[email protected]> Co-authored-by: Pierre Rousseau (pro) <[email protected]> Co-authored-by: Vincent Schippefilt (vsc) <[email protected]>
1 parent 5be6e28 commit 4b73941

File tree

2 files changed

+65
-39
lines changed

2 files changed

+65
-39
lines changed

addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js

Lines changed: 62 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/**
33
* This file is generated by o-spreadsheet build tools. Do not edit it.
44
* @see https://github.com/odoo/o-spreadsheet
5-
* @version 18.0.32
6-
* @date 2025-06-06T09:49:11.215Z
7-
* @hash bef1e2bd5
5+
* @version 18.0.33
6+
* @date 2025-06-12T10:52:55.981Z
7+
* @hash c1d64fba1
88
*/
99

1010
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -5676,7 +5676,9 @@ function isTextFormat(format) {
56765676
}
56775677

56785678
function evaluateLiteral(literalCell, localeFormat) {
5679-
const value = isTextFormat(localeFormat.format) ? literalCell.content : literalCell.parsedValue;
5679+
const value = isTextFormat(localeFormat.format) && literalCell.parsedValue !== null
5680+
? literalCell.content
5681+
: literalCell.parsedValue;
56805682
const functionResult = { value, format: localeFormat.format };
56815683
return createEvaluatedCell(functionResult, localeFormat.locale);
56825684
}
@@ -5725,16 +5727,16 @@ function _createEvaluatedCell(functionResult, locale, cell) {
57255727
if (isEvaluationError(value)) {
57265728
return errorCell(value, message);
57275729
}
5730+
if (value === null) {
5731+
return emptyCell(format);
5732+
}
57285733
if (isTextFormat(format)) {
57295734
// TO DO:
57305735
// with the next line, the value of the cell is transformed depending on the format.
57315736
// This shouldn't happen, by doing this, the formulas handling numbers are not able
57325737
// to interpret the value as a number.
57335738
return textCell(toString(value), format, formattedValue);
57345739
}
5735-
if (value === null) {
5736-
return emptyCell(format);
5737-
}
57385740
if (typeof value === "number") {
57395741
if (isDateTimeFormat(format || "")) {
57405742
return dateTimeCell(value, format, formattedValue);
@@ -10170,10 +10172,22 @@ function drawPieChartValues(chart, options, ctx) {
1017010172
const midAngle = (startAngle + endAngle) / 2;
1017110173
const midRadius = (innerRadius + outerRadius) / 2;
1017210174
const x = bar.x + midRadius * Math.cos(midAngle);
10173-
const y = bar.y + midRadius * Math.sin(midAngle) + 7;
10175+
const y = bar.y + midRadius * Math.sin(midAngle);
10176+
const displayValue = options.callback(value, dataset, i);
10177+
const textHeight = 12; // ChartJS default
10178+
const textWidth = computeTextWidth(ctx, displayValue, { fontSize: textHeight }, "px");
10179+
const radius = outerRadius - innerRadius;
10180+
// Check if the text fits in the slice. Not perfect, but good enough heuristic.
10181+
if (textWidth >= radius || radius < textHeight) {
10182+
continue;
10183+
}
10184+
const sliceAngle = endAngle - startAngle;
10185+
const midWidth = 2 * midRadius * Math.tan(sliceAngle / 2);
10186+
if (sliceAngle < Math.PI / 2 && (textWidth >= midWidth || midWidth < textHeight)) {
10187+
continue;
10188+
}
1017410189
ctx.fillStyle = chartFontColor(options.background);
1017510190
ctx.strokeStyle = options.background || "#ffffff";
10176-
const displayValue = options.callback(value, dataset, i);
1017710191
drawTextWithBackground(displayValue, x, y, ctx);
1017810192
}
1017910193
}
@@ -13390,7 +13404,7 @@ class XlsxBaseExtractor {
1339013404
*/
1339113405
handleMissingValue(parentElement, missingElementName, optionalArgs) {
1339213406
if (optionalArgs?.required) {
13393-
if (optionalArgs?.default) {
13407+
if (optionalArgs?.default !== undefined) {
1339413408
this.warningManager.addParsingWarning(`Missing required ${missingElementName} in element <${parentElement.tagName}> of ${this.currentFile}, replacing it by the default value ${optionalArgs.default}`);
1339513409
}
1339613410
else {
@@ -32516,19 +32530,26 @@ class FilterMenu extends Component {
3251632530
.filter(({ row }) => !this.env.model.getters.isRowHidden(sheetId, row))
3251732531
.map(({ col, row }) => this.env.model.getters.getEvaluatedCell({ sheetId, col, row }).formattedValue);
3251832532
const filterValues = this.env.model.getters.getFilterHiddenValues({ sheetId, ...position });
32519-
const strValues = [...cellValues, ...filterValues];
32520-
const normalizedFilteredValues = filterValues.map(toLowerCase);
32521-
// Set with lowercase values to avoid duplicates
32522-
const normalizedValues = [...new Set(strValues.map(toLowerCase))];
32523-
const sortedValues = normalizedValues.sort((val1, val2) => val1.localeCompare(val2, undefined, { numeric: true, sensitivity: "base" }));
32524-
return sortedValues.map((normalizedValue) => {
32525-
const checked = normalizedFilteredValues.findIndex((filteredValue) => filteredValue === normalizedValue) ===
32526-
-1;
32527-
return {
32528-
checked,
32529-
string: strValues.find((val) => toLowerCase(val) === normalizedValue) || "",
32530-
};
32531-
});
32533+
const normalizedFilteredValues = new Set(filterValues.map(toLowerCase));
32534+
const set = new Set();
32535+
const values = [];
32536+
const addValue = (value) => {
32537+
const normalizedValue = toLowerCase(value);
32538+
if (!set.has(normalizedValue)) {
32539+
values.push({
32540+
string: value || "",
32541+
checked: !normalizedFilteredValues.has(normalizedValue),
32542+
normalizedValue,
32543+
});
32544+
set.add(normalizedValue);
32545+
}
32546+
};
32547+
cellValues.forEach(addValue);
32548+
filterValues.forEach(addValue);
32549+
return values.sort((val1, val2) => val1.normalizedValue.localeCompare(val2.normalizedValue, undefined, {
32550+
numeric: true,
32551+
sensitivity: "base",
32552+
}));
3253232553
}
3253332554
checkValue(value) {
3253432555
this.state.selectedValue = value.string;
@@ -56027,7 +56048,9 @@ class TablePlugin extends CorePlugin {
5602756048
const ranges = cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData));
5602856049
const union = this.getters.getRangesUnion(ranges);
5602956050
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
56030-
this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
56051+
if (mergesInTarget.length) {
56052+
this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
56053+
}
5603156054
const id = this.uuidGenerator.smallUuid();
5603256055
const config = cmd.config || DEFAULT_TABLE_CONFIG;
5603356056
const newTable = cmd.tableType === "dynamic"
@@ -56138,14 +56161,16 @@ class TablePlugin extends CorePlugin {
5613856161
const zoneToCheckIfEmpty = direction === "down"
5613956162
? { ...zone, bottom: zone.bottom + 1, top: zone.bottom + 1 }
5614056163
: { ...zone, right: zone.right + 1, left: zone.right + 1 };
56141-
for (const position of positions(zoneToCheckIfEmpty)) {
56142-
const cellPosition = { sheetId, ...position };
56143-
// Since this plugin is loaded before CellPlugin, the getters still give us the old cell content
56144-
const cellContent = this.getters.getCell(cellPosition)?.content;
56145-
if (cellContent ||
56146-
this.getters.isInMerge(cellPosition) ||
56147-
this.getTablesOverlappingZones(sheetId, [positionToZone(position)]).length) {
56148-
return "none";
56164+
for (let row = zoneToCheckIfEmpty.top; row <= zoneToCheckIfEmpty.bottom; row++) {
56165+
for (let col = zoneToCheckIfEmpty.left; col <= zoneToCheckIfEmpty.right; col++) {
56166+
const cellPosition = { sheetId, col, row };
56167+
// Since this plugin is loaded before CellPlugin, the getters still give us the old cell content
56168+
const cellContent = this.getters.getCell(cellPosition)?.content;
56169+
if (cellContent ||
56170+
this.getters.isInMerge(cellPosition) ||
56171+
this.getTablesOverlappingZones(sheetId, [positionToZone(cellPosition)]).length) {
56172+
return "none";
56173+
}
5614956174
}
5615056175
}
5615156176
return direction;
@@ -65470,9 +65495,10 @@ class FilterEvaluationPlugin extends UIPlugin {
6547065495
const filteredZone = filter.filteredRange?.zone;
6547165496
if (!filteredValues || !filteredZone)
6547265497
continue;
65498+
const filteredValuesSet = new Set(filteredValues);
6547365499
for (let row = filteredZone.top; row <= filteredZone.bottom; row++) {
6547465500
const value = this.getCellValueAsString(sheetId, filter.col, row);
65475-
if (filteredValues.includes(value)) {
65501+
if (filteredValuesSet.has(value)) {
6547665502
hiddenRows.add(row);
6547765503
}
6547865504
}
@@ -74376,7 +74402,7 @@ const constants = {
7437674402
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
7437774403

7437874404

74379-
__info__.version = "18.0.32";
74380-
__info__.date = "2025-06-06T09:49:11.215Z";
74381-
__info__.hash = "bef1e2bd5";
74405+
__info__.version = "18.0.33";
74406+
__info__.date = "2025-06-12T10:52:55.981Z";
74407+
__info__.hash = "c1d64fba1";
7438274408
//# sourceMappingURL=o_spreadsheet.js.map

addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!--
22
This file is generated by o-spreadsheet build tools. Do not edit it.
33
@see https://github.com/odoo/o-spreadsheet
4-
@version 18.0.32
5-
@date 2025-06-06T09:49:17.730Z
6-
@hash bef1e2bd5
4+
@version 18.0.33
5+
@date 2025-06-12T10:53:00.735Z
6+
@hash c1d64fba1
77
-->
88
<odoo>
99
<t t-name="o-spreadsheet-ActionButton">

0 commit comments

Comments
 (0)