name:
src/main/js/models/common/SheetColumnRowKey.ts
-rw-r--r--
645
1import { ColumnRowKey } from "./ColumnRowKey";
2
3/**
4 * Represents a single location in a 3D grid: {column=x, row=y, grid=z}.
5 */
6export class SheetColumnRowKey extends ColumnRowKey {
7 readonly sheet: string;
8
9 constructor(sheet: string, column: number, row: number) {
10 super(column, row);
11 this.sheet = sheet;
12 }
13
14 get hashKey(): string {
15 return JSON.stringify([this.sheet, this.column, this.row]);
16 }
17
18 static from(grid: string, key: ColumnRowKey): SheetColumnRowKey {
19 return new SheetColumnRowKey(grid, key.column, key.row);
20 }
21
22 toColumnRowKey(): ColumnRowKey {
23 return new ColumnRowKey(this.column, this.row);
24 }
25}