Contains the following commits https://github.com/odoo/o-spreadsheet/commit/96166819 [REF] evaluation: decouple evaluation from core plugin https://github.com/odoo/o-spreadsheet/commit/a5a67d88 [IMP] find & replace: displays 0 match https://github.com/odoo/o-spreadsheet/commit/2e2d878f [FIX] overflowing cell with border rendering https://github.com/odoo/o-spreadsheet/commit/40dfc80c [FIX] interactive merge: remove useless user confirmation https://github.com/odoo/o-spreadsheet/commit/050e64f3 [IMP] format: support additional date formats closes odoo/odoo#105997 Related: odoo/enterprise#34097 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com> Co-authored-by: Lucas Lefèvre <lul@odoo.com>
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
/** @odoo-module */
|
|
|
|
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
|
|
|
|
const { toCartesian } = spreadsheet.helpers;
|
|
|
|
/**
|
|
* Get the value of the given cell
|
|
*/
|
|
export function getCellValue(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
|
const { col, row } = toCartesian(xc);
|
|
const cell = model.getters.getEvaluatedCell({ sheetId, col, row });
|
|
return cell.value;
|
|
}
|
|
|
|
/**
|
|
* Get the cell of the given xc
|
|
*/
|
|
export function getCell(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
|
const { col, row } = toCartesian(xc);
|
|
return model.getters.getCell(sheetId, col, row);
|
|
}
|
|
|
|
export function getEvaluatedCell(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
|
const { col, row } = toCartesian(xc);
|
|
return model.getters.getEvaluatedCell({ sheetId, col, row });
|
|
}
|
|
|
|
/**
|
|
* Get the cells of the given sheet (or active sheet if not provided)
|
|
*/
|
|
export function getCells(model, sheetId = model.getters.getActiveSheetId()) {
|
|
return model.getters.getCells(sheetId);
|
|
}
|
|
|
|
/**
|
|
* Get the formula of the given xc
|
|
*/
|
|
export function getCellFormula(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
|
const cell = getCell(model, xc, sheetId);
|
|
return cell && cell.isFormula ? model.getters.getFormulaCellContent(sheetId, cell) : "";
|
|
}
|
|
|
|
/**
|
|
* Get the content of the given xc
|
|
*/
|
|
export function getCellContent(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
|
const { col, row } = toCartesian(xc);
|
|
return model.getters.getCellText({ sheetId, col, row }, true);
|
|
}
|
|
|
|
/**
|
|
* Get the list of the merges (["A1:A2"]) of the sheet
|
|
*/
|
|
export function getMerges(model, sheetId = model.getters.getActiveSheetId()) {
|
|
return model.exportData().sheets.find((sheet) => sheet.id === sheetId).merges;
|
|
}
|