cherry picking for lodash

This commit is contained in:
VLE2FE
2020-07-30 14:23:51 +02:00
parent 0f3c921221
commit 2fb5d846d6
14 changed files with 52 additions and 46 deletions

View File

@ -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));
}
}
}