[IMP] spreadsheet: update o_spreadsheet to latest version

https://github.com/odoo/o-spreadsheet/commit/251a52e98 [REL] 16.4.0-alpha.4
https://github.com/odoo/o-spreadsheet/commit/73409d7eb [FIX] formatting: round floats with leading zeroes Task: 3327899
https://github.com/odoo/o-spreadsheet/commit/b98383f20 [FIX] misc: type of isCloneable interface
https://github.com/odoo/o-spreadsheet/commit/08492ae06 [IMP] ColorPicker: Extend the custom color selection Task: 3272474
https://github.com/odoo/o-spreadsheet/commit/891d82d9d [REF] xlsx: remove useless exported check
tqhttps://github.com/odoo/o-spreadsheet/commit/6f0ca54f1 [IMP] plugins: remove activeSheet from CoreViews Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/2ac86cdaa [IMP] cf evaluation: make cf evaluation lazy Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/6957579fa [FIX] style: fix dependencies of getCellComputedStyle Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/f035db27d [IMP] plugins: add Immutable type Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/735b3ced4 [IMP] plugins: add history to some CoreView plugins Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/f08900e7c [IMP] plugin: make CoreView plugins more core Task: 3288703
https://github.com/odoo/o-spreadsheet/commit/5fbde7277 [FIX] ColorPicker: fix `+` sign position
https://github.com/odoo/o-spreadsheet/commit/565740d89 [IMP] doc: connecting to external API
https://github.com/odoo/o-spreadsheet/commit/2a92e2dfb [IMP] sheet_actions: removed french spacing
https://github.com/odoo/o-spreadsheet/commit/fbf076535 [IMP] charts: dynamic errors in side panel
https://github.com/odoo/o-spreadsheet/commit/5a7435320 [FIX] demoData: fix XSLX demo data
https://github.com/odoo/o-spreadsheet/commit/8b9c9887c [FIX] clipboard: Do not update viewport on `paste`
https://github.com/odoo/o-spreadsheet/commit/1c4aa507f [REF] Selection: Let caller control selection visibilty Task: 3348042
https://github.com/odoo/o-spreadsheet/commit/c7b0d544f [IMP] config: enables type checking for binded functions

closes odoo/odoo#124697

Related: odoo/enterprise#42444
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
This commit is contained in:
Lucas Lefèvre
2023-06-13 12:49:33 +02:00
committed by Rmi Rahir (rar)
parent 7c17e2745a
commit 66e875b031
7 changed files with 2960 additions and 2780 deletions
@@ -5,13 +5,14 @@ import { getFirstListFunction, getNumberOfListFormulas } from "./list_helpers";
export const SEE_RECORD_LIST = async (position, env) => {
const cell = env.model.getters.getCell(position);
const sheetId = position.sheetId;
if (!cell) {
return;
}
const { args } = getFirstListFunction(cell.content);
const evaluatedArgs = args
.map(astToFormula)
.map((arg) => env.model.getters.evaluateFormula(arg));
.map((arg) => env.model.getters.evaluateFormula(sheetId, arg));
const listId = env.model.getters.getListIdFromPosition(position);
const { model } = env.model.getters.getListDefinition(listId);
const dataSource = await env.model.getters.getAsyncListDataSource(listId);
@@ -252,11 +252,12 @@ export default class ListUIPlugin extends spreadsheet.UIPlugin {
*/
getListIdFromPosition(position) {
const cell = this.getters.getCell(position);
const sheetId = position.sheetId;
if (cell && cell.isFormula) {
const listFunction = getFirstListFunction(cell.content);
if (listFunction) {
const content = astToFormula(listFunction.args[0]);
return this.getters.evaluateFormula(content).toString();
return this.getters.evaluateFormula(sheetId, content).toString();
}
}
return undefined;
File diff suppressed because it is too large Load Diff
@@ -313,7 +313,7 @@
<div
t-if="isSameColor(props.currentColor, color)"
align="center"
t-attf-style="color:{{getCheckMarkColor()}}">
t-attf-style="color:{{checkmarkColor}}">
✓
</div>
</div>
@@ -339,38 +339,52 @@
t-attf-style="background-color:{{color}};"
t-on-click="() => this.onColorClick(color)">
<div
t-if="props.currentColor === color"
t-if="isSameColor(props.currentColor, color)"
align="center"
t-attf-style="color:{{getCheckMarkColor()}}">
t-attf-style="color:{{checkmarkColor}}">
✓
</div>
</div>
</div>
<div t-if="state.showGradient" class="o-custom-selector">
<div class="o-magnifier-glass" t-att-style="magnifyingGlassStyle"/>
<div
class="o-gradient"
t-on-click.stop="computeCustomColor"
t-on-mouseout="hideMagnifier"
t-on-mousemove="moveMagnifier"
t-on-mouseover="showMagnifier"
/>
t-on-click.stop=""
t-on-mousedown="dragGradientPointer"
t-att-style="gradientHueStyle">
<div class="saturation w-100 h-100 position-absolute pe-none"/>
<div class="lightness w-100 h-100 position-absolute pe-none"/>
<div class="magnifier pe-none" t-att-style="pointerStyle"/>
</div>
<div class="o-hue-container" t-on-mousedown="dragHuePointer">
<div class="o-hue-picker" t-on-click.stop=""/>
<div class="o-hue-slider pe-none" t-att-style="sliderStyle">
<t t-call="o-spreadsheet-Icon.TRIANGLE_UP"/>
</div>
</div>
<div class="o-custom-input-preview">
<input
type="text"
t-att-class="{'o-wrong-color': state.isCurrentColorInvalid }"
t-att-class="{'o-wrong-color': !isHexColorInputValid }"
t-on-click.stop=""
t-model="state.currentColor"
t-att-value="state.customHexColor"
t-on-input="setHexColor"
maxlength="7"
/>
<div class="o-color-preview" t-attf-style="background-color:{{state.currentColor}}"/>
<div class="o-color-preview" t-att-style="colorPreviewStyle"/>
</div>
<div class="o-custom-input-buttons">
<button class="o-add-button" t-on-click="setCustomColor">Add</button>
<button
class="o-add-button"
t-att-class="{'o-disabled': !state.customHexColor or !isHexColorInputValid}"
t-on-click.stop="addCustomColor">
Add
</button>
</div>
</div>
<div class="o-separator"/>
<div class="o-buttons">
<button t-on-click="resetColor" class="o-cancel">Reset</button>
<button t-on-click="resetColor" class="o-cancel">No Color</button>
</div>
</div>
</Popover>
@@ -2338,10 +2352,9 @@
as headers
</label>
</div>
<div class="o-section o-sidepanel-error" t-if="errorMessages">
<div t-foreach="errorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="errorMessages.length">
<SidePanelErrors messages="errorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -2409,10 +2422,9 @@
onSelectionConfirmed="() => this.updateDataRange()"
/>
</div>
<div class="o-section o-sidepanel-error" t-if="configurationErrorMessages">
<div t-foreach="configurationErrorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="configurationErrorMessages.length">
<SidePanelErrors messages="configurationErrorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -2448,8 +2460,9 @@
<div class="o-subsection-left">
<input
type="text"
t-att-value="props.definition.sectionRule.rangeMin"
t-on-change="updateRangeMin"
t-model="state.sectionRule.rangeMin"
t-on-change="() => this.updateSectionRule(state.sectionRule)"
t-on-input="() => this.canUpdateSectionRule(state.sectionRule)"
class="o-input o-data-range-min"
t-att-class="{ 'o-invalid': isRangeMinInvalid() }"
/>
@@ -2457,8 +2470,9 @@
<div class="o-subsection-right">
<input
type="text"
t-att-value="props.definition.sectionRule.rangeMax"
t-on-change="updateRangeMax"
t-model="state.sectionRule.rangeMax"
t-on-change="() => this.updateSectionRule(state.sectionRule)"
t-on-input="() => this.canUpdateSectionRule(state.sectionRule)"
class="o-input o-data-range-max"
t-att-class="{ 'o-invalid': isRangeMaxInvalid() }"
/>
@@ -2468,14 +2482,12 @@
<div class="o-section">
<div class="o-section-title">Thresholds</div>
<t t-call="o-spreadsheet-GaugeChartColorSectionTemplate">
<t t-set="sectionRule" t-value="props.definition.sectionRule"/>
<t t-set="sectionRule" t-value="state.sectionRule"/>
</t>
</div>
<div class="o-section o-sidepanel-error" t-if="designErrorMessages.length">
<div t-foreach="designErrorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="designErrorMessages.length">
<SidePanelErrors messages="designErrorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -2541,10 +2553,11 @@
<input
type="text"
class="o-input"
t-on-change="(ev) => this.updateInflectionPointValue(inflectionPointName, ev)"
t-model="inflectionPoint.value"
t-on-input="() => this.canUpdateSectionRule(state.sectionRule)"
t-on-change="() => this.updateSectionRule(state.sectionRule)"
t-attf-class="o-input-{{inflectionPointName}}"
t-att-class="{ 'o-invalid': isInvalid }"
t-model="inflectionPoint.value"
/>
</td>
<td>
@@ -2552,7 +2565,7 @@
class="o-input"
name="valueType"
t-model="inflectionPoint.type"
t-on-change="(ev) => this.updateInflectionPointType(inflectionPointName, ev)">
t-on-change="(ev) => this.updateSectionRule(state.sectionRule)">
<option value="number">Number</option>
<option value="percentage">Percentage</option>
</select>
@@ -2604,10 +2617,9 @@
as headers
</label>
</div>
<div class="o-section o-sidepanel-error" t-if="errorMessages">
<div t-foreach="errorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="errorMessages.length">
<SidePanelErrors messages="errorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -2721,10 +2733,9 @@
as headers
</label>
</div>
<div class="o-section o-sidepanel-error" t-if="errorMessages">
<div t-foreach="errorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="errorMessages.length">
<SidePanelErrors messages="errorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -2821,6 +2832,7 @@
definition="definition"
figureId="figureId"
updateChart.bind="updateChart"
canUpdateChart.bind="canUpdateChart"
t-key="figureId + definition.type"
/>
</t>
@@ -2830,6 +2842,7 @@
definition="definition"
figureId="figureId"
updateChart.bind="updateChart"
canUpdateChart.bind="canUpdateChart"
t-key="figureId + definition.type"
/>
</t>
@@ -2869,10 +2882,9 @@
<option value="percentage">Percentage change from key value</option>
</select>
</div>
<div class="o-section o-sidepanel-error" t-if="errorMessages">
<div t-foreach="errorMessages" t-as="error" t-key="error">
<t t-esc="error"/>
</div>
<div class="o-section" t-if="errorMessages.length">
<SidePanelErrors messages="errorMessages" msgType="'error'"/>
</div>
</div>
</t>
@@ -3585,6 +3597,15 @@
</div>
</t>
<t t-name="o-spreadsheet-SidePanelErrors" owl="1">
<t t-foreach="props.messages" t-as="msg" t-key="msg">
<div class="d-flex align-items-center" t-att-class="divClasses">
<t t-call="o-spreadsheet-Icon.TRIANGLE_EXCLAMATION"/>
<span t-esc="msg"/>
</div>
</t>
</t>
<t t-name="o-spreadsheet-SplitIntoColumnsPanel" owl="1">
<div class="o-split-to-cols-panel">
<div class="o-section">
@@ -3632,18 +3653,8 @@
</button>
</div>
<t t-foreach="errorMessages" t-as="error" t-key="error">
<div class="o-sidepanel-error d-flex align-items-center text-danger">
<t t-call="o-spreadsheet-Icon.TRIANGLE_EXCLAMATION"/>
<span t-esc="error"/>
</div>
</t>
<t t-foreach="warningMessages" t-as="warning" t-key="warning">
<div class="o-sidepanel-warning d-flex align-items-center text-warning">
<t t-call="o-spreadsheet-Icon.TRIANGLE_EXCLAMATION"/>
<span t-esc="warning"/>
</div>
</t>
<SidePanelErrors messages="errorMessages" msgType="'error'"/>
<SidePanelErrors messages="warningMessages" msgType="'warning'"/>
</div>
</div>
</t>
@@ -3860,7 +3871,7 @@
</t>
</odoo>
<!--
__info__.version = '16.4.0-alpha.3';
__info__.date = '2023-06-02T10:56:27.729Z';
__info__.hash = '059d66a';
__info__.version = '16.4.0-alpha.4';
__info__.date = '2023-06-12T14:15:15.398Z';
__info__.hash = '251a52e';
-->
@@ -4,13 +4,14 @@ import { getFirstPivotFunction, getNumberOfPivotFormulas } from "./pivot_helpers
export const SEE_RECORDS_PIVOT = async (position, env) => {
const cell = env.model.getters.getCell(position);
const sheetId = position.sheetId;
if (!cell) {
return;
}
const { args, functionName } = getFirstPivotFunction(cell.content);
const evaluatedArgs = args
.map(astToFormula)
.map((arg) => env.model.getters.evaluateFormula(arg));
.map((arg) => env.model.getters.evaluateFormula(sheetId, arg));
const pivotId = env.model.getters.getPivotIdFromPosition(position);
const { model } = env.model.getters.getPivotDefinition(pivotId);
const dataSource = await env.model.getters.getAsyncPivotDataSource(pivotId);
@@ -186,11 +186,12 @@ export default class PivotUIPlugin extends spreadsheet.UIPlugin {
*/
getPivotIdFromPosition(position) {
const cell = this.getters.getCell(position);
const sheetId = position.sheetId;
if (cell && cell.isFormula) {
const pivotFunction = getFirstPivotFunction(cell.content);
if (pivotFunction) {
const content = astToFormula(pivotFunction.args[0]);
return this.getters.evaluateFormula(content).toString();
return this.getters.evaluateFormula(sheetId, content).toString();
}
}
return undefined;
@@ -250,7 +251,6 @@ export default class PivotUIPlugin extends spreadsheet.UIPlugin {
/**
* Get the filter impacted by a pivot formula's argument
*
* @param {string} formula Formula of the pivot cell
*
* @returns {Array<Object>}
@@ -260,10 +260,11 @@ export default class PivotUIPlugin extends spreadsheet.UIPlugin {
if (!functionDescription) {
return [];
}
const sheetId = this.getters.getActiveSheetId();
const { args } = functionDescription;
const evaluatedArgs = args
.map(astToFormula)
.map((arg) => this.getters.evaluateFormula(arg));
.map((arg) => this.getters.evaluateFormula(sheetId, arg));
if (evaluatedArgs.length <= 2) {
return [];
}
@@ -18,11 +18,12 @@ cellMenuRegistry.add("move_lines_see_records", {
sequence: 176,
async execute(env) {
const position = env.model.getters.getActivePosition();
const sheetId = position.sheetId;
const cell = env.model.getters.getCell(position);
const { args } = getFirstAccountFunction(cell.content);
let [codes, date_range, offset, companyId, includeUnposted] = args
.map(astToFormula)
.map((arg) => env.model.getters.evaluateFormula(arg));
.map((arg) => env.model.getters.evaluateFormula(sheetId, arg));
codes = toString(codes).split(",");
const dateRange = parseAccountingDate(date_range);
dateRange.year += offset || 0;