Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { useSubEnv } = owl.hooks;
const Spreadsheet = o_spreadsheet.Spreadsheet;
const menuItemRegistry = o_spreadsheet.registries.topbarMenuRegistry;

menuItemRegistry.add("file", { name: "File", sequence: 10 });
menuItemRegistry.addChild("save", ["file"], {
name: "Save",
sequence: 30,
Expand Down
3 changes: 0 additions & 3 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ export function createEmptyWorkbookData(): WorkbookData {

export function createEmptyWorkbook(): Workbook {
return {
rows: [],
cols: [],
cells: {},
visibleSheets: [],
sheets: {},
activeSheet: null as any,
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class ClipboardPlugin extends BasePlugin {
}

private pasteZone(width: number, height: number, col: number, row: number) {
const { cols, rows } = this.workbook;
const { cols, rows } = this.workbook.activeSheet;
// first, add missing cols/rows if needed
const missingRows = height + row - rows.length;
if (missingRows > 0) {
Expand Down Expand Up @@ -304,7 +304,7 @@ export class ClipboardPlugin extends BasePlugin {
}

pasteCell(origin: Cell | null, col: number, row: number, cut?: boolean) {
const { cols, rows } = this.workbook;
const { cols, rows } = this.workbook.activeSheet;
const targetCell = this.getters.getCell(col, row);
if (origin) {
let content: string | undefined = origin.content || "";
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/conditional_format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class ConditionalFormatPlugin extends BasePlugin {
const zone: Zone = toZone(range);
for (let row = zone.top; row <= zone.bottom; row++) {
for (let col = zone.left; col <= zone.right; col++) {
const cell = this.workbook.rows[row].cells[col];
const cell = this.workbook.activeSheet.rows[row].cells[col];
if (cell && cell.value && !Number.isNaN(Number.parseFloat(cell.value))) {
const r = Math.round(
((rule.minimum.color >> 16) % 256) - colorDiffUnitR * (cell.value - minValue)
Expand Down Expand Up @@ -316,7 +316,7 @@ export class ConditionalFormatPlugin extends BasePlugin {
for (let row = zone.top; row <= zone.bottom; row++) {
for (let col = zone.left; col <= zone.right; col++) {
const pr = this.rulePredicate[cf.rule.type];
let cell = this.workbook.rows[row].cells[col];
let cell = this.workbook.activeSheet.rows[row].cells[col];
let xc = toXC(col, row);
if (pr && pr(cell, cf.rule)) {
// we must combine all the properties of all the CF rules applied to the given cell
Expand Down
Loading