cherry picking for lodash
This commit is contained in:
@ -10,7 +10,7 @@ import {
|
||||
TemplateRef
|
||||
} from '@angular/core';
|
||||
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
|
||||
import _ from 'lodash';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import {ArrayInputHelperService} from './array-input-helper.service';
|
||||
|
||||
|
||||
@ -87,7 +87,6 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
|
||||
else {
|
||||
this.values[data.index] = data.value;
|
||||
}
|
||||
console.log(111, this.values);
|
||||
this.updateArray();
|
||||
});
|
||||
}, 0);
|
||||
@ -104,7 +103,7 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
|
||||
}
|
||||
// add element if last all are filled
|
||||
else if (this.values.filter(e => e[this.pushPath] !== '').length === this.values.length) {
|
||||
this.values.push(_.cloneDeep(this.pushTemplate));
|
||||
this.values.push(cloneDeep(this.pushTemplate));
|
||||
}
|
||||
res = this.values.filter(e => e[this.pushPath] !== '');
|
||||
}
|
||||
@ -114,7 +113,7 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
|
||||
this.values.pop();
|
||||
}
|
||||
else if (this.values.filter(e => e !== '').length === this.values.length) { // add element if all are is filled
|
||||
this.values.push(_.cloneDeep(this.pushTemplate));
|
||||
this.values.push(cloneDeep(this.pushTemplate));
|
||||
}
|
||||
res = this.values.filter(e => e !== '');
|
||||
}
|
||||
@ -134,7 +133,7 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
|
||||
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));
|
||||
this.values.push(cloneDeep(this.pushTemplate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user