added batch edit
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user