added batch edit

This commit is contained in:
VLE2FE
2020-08-21 16:11:57 +02:00
parent 433572f819
commit 602dfb51da
11 changed files with 558 additions and 343 deletions

View File

@ -129,13 +129,38 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
}
writeValue(obj: any) { // add empty value on init
this.values = obj ? obj : [];
if (this.values.length === 0 || this.values[0] !== '') {
// add empty last field if pushTemplate is specified
if (obj) {
if (this.pushTemplate !== null) {
this.values.push(cloneDeep(this.pushTemplate));
this.values = [...obj.filter(e => e[this.pushPath] !== ''), cloneDeep(this.pushTemplate)];
}
else {
this.values = obj;
}
}
else {
if (this.pushTemplate !== null) {
this.values = [cloneDeep(this.pushTemplate)];
}
else {
this.values = [''];
}
}
// this.values = obj ? obj : [];
// console.log('-----');
// console.log(obj);
// console.log(this.pushPath);
// if (this.values && this.values.length) {
// this.values = obj.filter(e => this.pushPath ? e[this.pushPath] !== '' : e !== '');
// }
// console.log(this.values);
// // console.log(obj.filter(e => this.pushPath ? e[this.pushPath] !== '' : e !== ''));
// // this.values = obj ? obj.filter(e => this.pushPath ? e[this.pushPath] !== '' : e !== '') : [];
// if (this.values.length === 0 || this.values[0] !== '') {
// // add empty last field if pushTemplate is specified
// if (this.pushTemplate !== null) {
// this.values.push(cloneDeep(this.pushTemplate));
// }
// }
}
registerOnChange(fn: any) {