[FIX] spreadsheet: update o_spreadsheet to latest version
### Contains the following commits: https://github.com/odoo/o-spreadsheet/commit/62947587b [REL] 17.0.18 https://github.com/odoo/o-spreadsheet/commit/0d8547c82 [FIX] misc: faster `deepEquals` https://github.com/odoo/o-spreadsheet/commit/b934dcafc [FIX] xlsx: Shortcut `deepEquals` for primitive types in `pushElement` Task: 3733743 https://github.com/odoo/o-spreadsheet/commit/0b2be2266 [FIX]xlsx: replace json.stringify with deepEquals Task: 3733743 https://github.com/odoo/o-spreadsheet/commit/0e0f31a38 [FIX] xlsx: remove useless normalization Task: 3733743 https://github.com/odoo/o-spreadsheet/commit/a87b0d0b5 [FIX] XLSX: simplify `pushElement` helper Task: 3733743 https://github.com/odoo/o-spreadsheet/commit/9f6996086 [FIX] Evaluation: ignore invalid ranges in dependency graph https://github.com/odoo/o-spreadsheet/commit/c678905b3 [FIX] Grid: Context menu position was broken https://github.com/odoo/o-spreadsheet/commit/fe8161032 [FIX]: Filters: Do not export 1-row filters to xlsx files Task: 3839556 closes odoo/odoo#161367 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
||||
* @see https://github.com/odoo/o-spreadsheet
|
||||
* @version 17.0.17
|
||||
* @date 2024-04-05T14:13:49.946Z
|
||||
* @hash 33f09d7c4
|
||||
* @version 17.0.18
|
||||
* @date 2024-04-10T16:20:17.573Z
|
||||
* @hash 62947587b
|
||||
*/
|
||||
|
||||
(function (exports, owl) {
|
||||
@@ -649,7 +649,7 @@
|
||||
if (typeof o1 !== typeof o2)
|
||||
return false;
|
||||
if (typeof o1 !== "object")
|
||||
return o1 === o2;
|
||||
return false;
|
||||
// Objects can have different keys if the values are undefined
|
||||
for (const key in o2) {
|
||||
if (!(key in o1) && o2[key] !== undefined) {
|
||||
@@ -26963,6 +26963,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
onContextMenu(ev) {
|
||||
if (this.env.model.getters.getEditionMode() === "inactive") {
|
||||
this.props.onInputContextMenu?.(ev);
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -27200,6 +27205,7 @@
|
||||
onComposerCellFocused: { type: Function, optional: true },
|
||||
onComposerContentFocused: Function,
|
||||
isDefaultFocus: { type: Boolean, optional: true },
|
||||
onInputContextMenu: { type: Function, optional: true },
|
||||
};
|
||||
|
||||
const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
|
||||
@@ -27275,6 +27281,7 @@
|
||||
isDefaultFocus: true,
|
||||
onComposerContentFocused: this.props.onComposerContentFocused,
|
||||
onComposerCellFocused: this.props.onComposerCellFocused,
|
||||
onInputContextMenu: this.props.onInputContextMenu,
|
||||
};
|
||||
}
|
||||
get containerStyle() {
|
||||
@@ -27363,6 +27370,7 @@
|
||||
onComposerContentFocused: Function,
|
||||
gridDims: Object,
|
||||
onComposerCellFocused: Function,
|
||||
onInputContextMenu: Function,
|
||||
};
|
||||
|
||||
const CSS$1 = css /* scss */ `
|
||||
@@ -31316,29 +31324,12 @@
|
||||
return width;
|
||||
return Math.round((width / WIDTH_FACTOR) * 100) / 100;
|
||||
}
|
||||
function convertBorderDescr(descr) {
|
||||
if (!descr) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
style: descr.style,
|
||||
color: { rgb: descr.color },
|
||||
};
|
||||
}
|
||||
function extractStyle(cell, data) {
|
||||
let style = {};
|
||||
if (cell.style) {
|
||||
style = data.styles[cell.style];
|
||||
}
|
||||
const format = extractFormat(cell, data);
|
||||
const exportedBorder = {};
|
||||
if (cell.border) {
|
||||
const border = data.borders[cell.border];
|
||||
exportedBorder.left = convertBorderDescr(border.left);
|
||||
exportedBorder.right = convertBorderDescr(border.right);
|
||||
exportedBorder.bottom = convertBorderDescr(border.bottom);
|
||||
exportedBorder.top = convertBorderDescr(border.top);
|
||||
}
|
||||
const styles = {
|
||||
font: {
|
||||
size: style?.fontSize || DEFAULT_FONT_SIZE,
|
||||
@@ -31352,7 +31343,7 @@
|
||||
}
|
||||
: { reservedAttribute: "none" },
|
||||
numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
|
||||
border: exportedBorder || {},
|
||||
border: cell.border || 0,
|
||||
alignment: {
|
||||
horizontal: style.align,
|
||||
vertical: style.verticalAlign
|
||||
@@ -31374,15 +31365,12 @@
|
||||
return undefined;
|
||||
}
|
||||
function normalizeStyle(construct, styles) {
|
||||
const { id: fontId } = pushElement(styles["font"], construct.fonts);
|
||||
const { id: fillId } = pushElement(styles["fill"], construct.fills);
|
||||
const { id: borderId } = pushElement(styles["border"], construct.borders);
|
||||
// Normalize this
|
||||
const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
|
||||
const style = {
|
||||
fontId,
|
||||
fillId,
|
||||
borderId,
|
||||
fontId: pushElement(styles.font, construct.fonts),
|
||||
fillId: pushElement(styles.fill, construct.fills),
|
||||
borderId: styles.border,
|
||||
numFmtId,
|
||||
alignment: {
|
||||
vertical: styles.alignment.vertical,
|
||||
@@ -31390,8 +31378,7 @@
|
||||
wrapText: styles.alignment.wrapText,
|
||||
},
|
||||
};
|
||||
const { id } = pushElement(style, construct.styles);
|
||||
return id;
|
||||
return pushElement(style, construct.styles);
|
||||
}
|
||||
function convertFormat(format, numFmtStructure) {
|
||||
if (!format) {
|
||||
@@ -31399,8 +31386,7 @@
|
||||
}
|
||||
let formatId = XLSX_FORMAT_MAP[format.format];
|
||||
if (!formatId) {
|
||||
const { id } = pushElement(format, numFmtStructure);
|
||||
formatId = id + FIRST_NUMFMT_ID;
|
||||
formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
|
||||
}
|
||||
return formatId;
|
||||
}
|
||||
@@ -31425,20 +31411,15 @@
|
||||
return id;
|
||||
}
|
||||
function pushElement(property, propertyList) {
|
||||
for (let [key, value] of Object.entries(propertyList)) {
|
||||
if (JSON.stringify(value) === JSON.stringify(property)) {
|
||||
return { id: parseInt(key, 10), list: propertyList };
|
||||
let len = propertyList.length;
|
||||
const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (operator(property, propertyList[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
|
||||
if (elemId === -1) {
|
||||
propertyList.push(property);
|
||||
elemId = propertyList.length - 1;
|
||||
}
|
||||
return {
|
||||
id: elemId,
|
||||
list: propertyList,
|
||||
};
|
||||
propertyList[propertyList.length] = property;
|
||||
return propertyList.length - 1;
|
||||
}
|
||||
const chartIds = [];
|
||||
/**
|
||||
@@ -32159,7 +32140,25 @@
|
||||
}
|
||||
return document;
|
||||
}
|
||||
function getDefaultXLSXStructure() {
|
||||
function convertBorderDescr(descr) {
|
||||
if (!descr) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
style: descr.style,
|
||||
color: { rgb: descr.color },
|
||||
};
|
||||
}
|
||||
function getDefaultXLSXStructure(data) {
|
||||
const xlsxBorders = Object.values(data.borders).map((border) => {
|
||||
return {
|
||||
left: convertBorderDescr(border.left),
|
||||
right: convertBorderDescr(border.right),
|
||||
bottom: convertBorderDescr(border.bottom),
|
||||
top: convertBorderDescr(border.top),
|
||||
};
|
||||
});
|
||||
const borders = [{}, ...xlsxBorders];
|
||||
return {
|
||||
relsFiles: [],
|
||||
sharedStrings: [],
|
||||
@@ -32182,7 +32181,7 @@
|
||||
},
|
||||
],
|
||||
fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
|
||||
borders: [{}],
|
||||
borders,
|
||||
numFmts: [],
|
||||
dxfs: [],
|
||||
};
|
||||
@@ -37368,7 +37367,17 @@
|
||||
}
|
||||
}
|
||||
exportForExcel(data) {
|
||||
this.export(data);
|
||||
for (const sheet of data.sheets) {
|
||||
for (const filterTable of this.getFilterTables(sheet.id)) {
|
||||
if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
|
||||
continue;
|
||||
}
|
||||
sheet.filterTables.push({
|
||||
range: zoneToXc(filterTable.zone),
|
||||
filters: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41097,7 +41106,9 @@
|
||||
this.blockedArrayFormulas = new Set();
|
||||
this.spreadingRelations = new SpreadingRelation();
|
||||
this.formulaDependencies = lazy(() => {
|
||||
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId).map((range) => ({
|
||||
const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
|
||||
.filter((range) => !range.invalidSheetName && !range.invalidXc)
|
||||
.map((range) => ({
|
||||
data: positionId,
|
||||
boundingBox: {
|
||||
zone: range.zone,
|
||||
@@ -55235,8 +55246,7 @@
|
||||
attrs.push(["t", "b"]);
|
||||
}
|
||||
else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
|
||||
const { id } = pushElement(content, sharedStrings);
|
||||
value = id.toString();
|
||||
value = pushElement(content, sharedStrings);
|
||||
attrs.push(["t", "s"]);
|
||||
}
|
||||
return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
|
||||
@@ -55361,8 +55371,7 @@
|
||||
if (rule.style.fillColor) {
|
||||
dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
|
||||
}
|
||||
const { id } = pushElement(dxf, dxfs);
|
||||
ruleAttributes.push(["dxfId", id]);
|
||||
ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
|
||||
return escapeXml /*xml*/ `
|
||||
<conditionalFormatting sqref="${cf.ranges.join(" ")}">
|
||||
<cfRule ${formatAttributes(ruleAttributes)}>
|
||||
@@ -56171,7 +56180,7 @@
|
||||
*/
|
||||
function getXLSX(data) {
|
||||
const files = [];
|
||||
const construct = getDefaultXLSXStructure();
|
||||
const construct = getDefaultXLSXStructure(data);
|
||||
files.push(createWorkbook(data, construct));
|
||||
files.push(...createWorksheets(data, construct));
|
||||
files.push(createStylesSheet(construct));
|
||||
@@ -57051,9 +57060,9 @@
|
||||
exports.tokenize = tokenize;
|
||||
|
||||
|
||||
__info__.version = "17.0.17";
|
||||
__info__.date = "2024-04-05T14:13:49.946Z";
|
||||
__info__.hash = "33f09d7c4";
|
||||
__info__.version = "17.0.18";
|
||||
__info__.date = "2024-04-10T16:20:17.573Z";
|
||||
__info__.hash = "62947587b";
|
||||
|
||||
|
||||
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!--
|
||||
This file is generated by o-spreadsheet build tools. Do not edit it.
|
||||
@see https://github.com/odoo/o-spreadsheet
|
||||
@version 17.0.17
|
||||
@date 2024-04-05T14:13:52.721Z
|
||||
@hash 33f09d7c4
|
||||
@version 17.0.18
|
||||
@date 2024-04-10T16:20:19.251Z
|
||||
@hash 62947587b
|
||||
-->
|
||||
<odoo>
|
||||
<t t-name="o-spreadsheet-ActionButton">
|
||||
@@ -471,6 +471,7 @@
|
||||
t-on-compositionstart="onCompositionStart"
|
||||
t-on-compositionend="onCompositionEnd"
|
||||
t-on-dblclick="onDblClick"
|
||||
t-on-contextmenu="onContextMenu"
|
||||
/>
|
||||
|
||||
<div
|
||||
@@ -950,7 +951,6 @@
|
||||
t-on-click="focusDefaultElement"
|
||||
t-on-keydown="onKeydown"
|
||||
t-on-wheel="onMouseWheel"
|
||||
t-on-contextmenu="onInputContextMenu"
|
||||
t-ref="grid">
|
||||
<GridOverlay
|
||||
onCellClicked.bind="onCellClicked"
|
||||
@@ -968,6 +968,7 @@
|
||||
onComposerContentFocused="props.onComposerContentFocused"
|
||||
onComposerCellFocused="props.onGridComposerCellFocused"
|
||||
gridDims="env.model.getters.getSheetViewDimensionWithHeaders()"
|
||||
onInputContextMenu.bind="onInputContextMenu"
|
||||
/>
|
||||
<canvas t-ref="canvas"/>
|
||||
<t
|
||||
|
||||
Reference in New Issue
Block a user