You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/app/components/editor/database/columns/columns.component.ts

42 lines
968 B

import {Component, Input, OnInit} from '@angular/core';
import {ModalController} from '@ionic/angular';
@Component({
selector: 'editor-database-columns',
templateUrl: './columns.component.html',
styleUrls: ['./columns.component.scss'],
})
export class ColumnsComponent implements OnInit {
@Input() columnSets: Array<{headerName: string, field: string, Type: string}> = [];
constructor(
protected modals: ModalController
) { }
ngOnInit() {}
onAddColumnClick() {
this.columnSets.push({headerName: '', field: '', Type: ''});
}
dismissModal(doSave = true) {
if ( doSave ) {
this.columnSets = this.columnSets.map(x => {
x.field = x.headerName;
return x;
})
this.modals.dismiss(this.columnSets);
} else {
this.modals.dismiss();
}
}
onDeleteClick(i) {
const newSets = this.columnSets.filter((x, index) => {
return index !== i;
});
this.columnSets = newSets;
}
}