diff --git a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js index f38f228259e..ffd8a83f615 100644 --- a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js +++ b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.js @@ -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.12 - * @date 2024-02-16T15:05:31.161Z - * @hash 8fa2bab99 + * @version 17.0.13 + * @date 2024-02-28T12:48:27.246Z + * @hash ed67be7d1 */ (function (exports, owl) { @@ -6283,11 +6283,14 @@ * Transform CSS properties into a CSS string. */ function cssPropertiesToCss(attributes) { - const str = Object.entries(attributes) - .filter(([attName, attValue]) => attValue !== undefined) - .map(([attName, attValue]) => `${attName}:${attValue};`) - .join(" "); - return str; + let styleStr = ""; + for (const attName in attributes) { + if (!attributes[attName]) { + continue; + } + styleStr += `${attName}:${attributes[attName]}; `; + } + return styleStr; } function getElementMargins(el) { const style = window.getComputedStyle(el); @@ -12924,6 +12927,18 @@ }, isExported: true, }; + // ----------------------------------------------------------------------------- + // INT + // ----------------------------------------------------------------------------- + const INT = { + description: _t("Rounds a number down to the nearest integer that is less than or equal to it."), + args: [arg("value (number)", _t("The number to round down to the nearest integer."))], + returns: ["NUMBER"], + compute: function (value) { + return Math.floor(toNumber(value, this.locale)); + }, + isExported: true, + }; var math = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -12957,6 +12972,7 @@ FLOOR: FLOOR, FLOOR_MATH: FLOOR_MATH, FLOOR_PRECISE: FLOOR_PRECISE, + INT: INT, ISEVEN: ISEVEN, ISODD: ISODD, ISO_CEILING: ISO_CEILING, @@ -21395,7 +21411,7 @@ ? existingSelectionRanges : this.props.ranges().map((xc, id) => ({ xc, - id, + id: id + 1, isFocused: false, })); return ranges.map((range) => ({ @@ -33828,29 +33844,12 @@ from: 12, to: 12.5, applyMigration(data) { - for (let sheet of data.sheets || []) { - let knownDataFilterZones = []; - for (let filterTable of sheet.filterTables || []) { - const zone = toZone(filterTable.range); - // See commit message for the details - const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone)); - if (intersectZoneIndex !== -1) { - knownDataFilterZones[intersectZoneIndex] = zone; - } - else { - knownDataFilterZones.push(zone); - } - } - sheet.filterTables = knownDataFilterZones.map((zone) => ({ - range: zoneToXc(zone), - })); - } - return data; + return fixOverlappingFilters(data); }, }, { description: "Change Border description structure", - from: 12, + from: 12.5, to: 13, applyMigration(data) { for (const borderId in data.borders) { @@ -33881,6 +33880,14 @@ return data; }, }, + { + description: "Fix datafilter duplication (post saas-16.4)", + from: 14, + to: 14.5, + applyMigration(data) { + return fixOverlappingFilters(data); + }, + }, ]; /** * This function is used to repair faulty data independently of the migration. @@ -34038,6 +34045,26 @@ } return messages; } + function fixOverlappingFilters(data) { + for (let sheet of data.sheets || []) { + let knownDataFilterZones = []; + for (let filterTable of sheet.filterTables || []) { + const zone = toZone(filterTable.range); + // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details + const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone)); + if (intersectZoneIndex !== -1) { + knownDataFilterZones[intersectZoneIndex] = zone; + } + else { + knownDataFilterZones.push(zone); + } + } + sheet.filterTables = knownDataFilterZones.map((zone) => ({ + range: zoneToXc(zone), + })); + } + return data; + } // ----------------------------------------------------------------------------- // Helpers // ----------------------------------------------------------------------------- @@ -46428,19 +46455,17 @@ break; case "FOCUS_RANGE": case "CHANGE_RANGE": - if (cmd.id !== this.focusedInputId) { - const input = this.inputs[cmd.id]; - const range = input.ranges.find((range) => range.id === cmd.rangeId); - if (this.isRangeValid(range?.xc || "A1")) { - const sheetId = this.getters.getActiveSheetId(); - const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone; - this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { - handleEvent: input.handleEvent.bind(input), - release: () => (this.focusedInputId = null), - }); - } - this.focusedInputId = cmd.id; + const input = this.inputs[cmd.id]; + const range = input.ranges.find((range) => range.id === cmd.rangeId); + if (range) { + const sheetId = this.getters.getActiveSheetId(); + const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone; + this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { + handleEvent: input.handleEvent.bind(input), + release: () => (this.focusedInputId = null), + }); } + this.focusedInputId = cmd.id; break; } this.currentInput?.handle(cmd); @@ -56915,9 +56940,9 @@ exports.tokenize = tokenize; - __info__.version = "17.0.12"; - __info__.date = "2024-02-16T15:05:31.161Z"; - __info__.hash = "8fa2bab99"; + __info__.version = "17.0.13"; + __info__.date = "2024-02-28T12:48:27.246Z"; + __info__.hash = "ed67be7d1"; })(this.o_spreadsheet = this.o_spreadsheet || {}, owl); diff --git a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml index 9ebc1c030ac..22b5ca0a414 100644 --- a/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml +++ b/addons/spreadsheet/static/src/o_spreadsheet/o_spreadsheet.xml @@ -1,9 +1,9 @@