Last Batch before Release (#2899)
This commit is contained in:
parent
8d77b398b2
commit
32bedb4e06
32 changed files with 3302 additions and 124 deletions
|
@ -64,16 +64,26 @@ export class EditListComponent implements OnInit {
|
|||
}
|
||||
|
||||
remove(index: number) {
|
||||
const tokens = this.combinedItems.split(',');
|
||||
const tokenToRemove = tokens[index];
|
||||
|
||||
this.combinedItems = tokens.filter(t => t != tokenToRemove).join(',');
|
||||
for (const [index, [key, value]] of Object.entries(Object.entries(this.form.controls))) {
|
||||
if (key.startsWith('link') && this.form.get(key)?.value === tokenToRemove) {
|
||||
this.form.removeControl('link' + index, {emitEvent: true});
|
||||
}
|
||||
const initialControls = Object.keys(this.form.controls)
|
||||
.filter(key => key.startsWith('link'));
|
||||
|
||||
if (index == 0 && initialControls.length === 1) {
|
||||
this.form.get(initialControls[0])?.setValue('', {emitEvent: true});
|
||||
this.emit();
|
||||
this.cdRef.markForCheck();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the form control explicitly then rebuild the combinedItems
|
||||
this.form.removeControl('link' + index, {emitEvent: true});
|
||||
|
||||
this.combinedItems = Object.keys(this.form.controls)
|
||||
.filter(key => key.startsWith('link'))
|
||||
.map(key => this.form.get(key)?.value)
|
||||
.join(',');
|
||||
|
||||
|
||||
this.emit();
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue