|
|
@@ -67,9 +67,7 @@ export class OptionValueInputComponent implements ControlValueAccessor {
|
|
|
switch (event.key) {
|
|
|
case ',':
|
|
|
case 'Enter':
|
|
|
- this.options = unique([...this.options, ...this.parseInputIntoOptions(this.input)]);
|
|
|
- this.input = '';
|
|
|
- this.onChangeFn(this.options);
|
|
|
+ this.addOptionValue();
|
|
|
event.preventDefault();
|
|
|
break;
|
|
|
case 'Backspace':
|
|
|
@@ -85,6 +83,17 @@ export class OptionValueInputComponent implements ControlValueAccessor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ handleBlur() {
|
|
|
+ this.isFocussed = false;
|
|
|
+ this.addOptionValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ private addOptionValue() {
|
|
|
+ this.options = unique([...this.options, ...this.parseInputIntoOptions(this.input)]);
|
|
|
+ this.input = '';
|
|
|
+ this.onChangeFn(this.options);
|
|
|
+ }
|
|
|
+
|
|
|
private parseInputIntoOptions(input: string): string[] {
|
|
|
return input
|
|
|
.split(/[,\n]/)
|