From b9a12454e143a5749ed7868a9fd0a0236c0c323b Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Thu, 3 Aug 2023 22:31:59 +0200 Subject: [PATCH] chore: removing table.ts leftover --- client/src/app/editor/table.ts | 71 ---------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 client/src/app/editor/table.ts diff --git a/client/src/app/editor/table.ts b/client/src/app/editor/table.ts deleted file mode 100644 index 03c9a19..0000000 --- a/client/src/app/editor/table.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Column, ColumnType } from './models/column' - -export enum TableType { - INPUT = 'In', - OUTPUT = 'Out' -} - -export interface TableInterface { - id: number | undefined - name: string | undefined - data: Array - columns: Array - type: TableType | undefined -} - -export class Table implements TableInterface { - public id: number | undefined - public name: string | undefined - public data: Array - public columns: Array = [] - public type: TableType | undefined - - public static fromPlainObject(obj: any) { - obj.columns = obj.columns.map((column: object) => { - return Column.fromPlainObject(column) - }) - - return Object.assign(new Table(), obj) - } - - constructor( - id?: number, - name?: string, - type?: TableType, - data?: Array, - columns?: Array - ) { - this.id = id - this.name = name - this.type = type - - this.data = data || [{}] - this.columns = columns || [] - } - - public getNextColumnId(): number { - let highestIdColumn: any = this.columns.sort( - (cA: any, cB: any) => cA.id - cB.id - )[this.columns.length - 1] - return (highestIdColumn && highestIdColumn.id + 1) || 0 - } - - public addColumn(column: Column) { - this.columns.push(column) - - this.data.forEach((row: any) => { - if (column.name) { - row[column.name] = column.type === ColumnType.string ? '' : null - } - }) - - return column - } - - public removeColumn(colInd: any) { - this.data.forEach((row) => { - delete row[this.columns[colInd].name!] - }) - this.columns.splice(colInd, 1) - } -}