diff --git a/README.md b/README.md index 9f4c213..befa2dc 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ | Angular Version | NPM Package Version | |-----------------|---------------------| -| ^16.1.4 | 16.1.9 | +| ^16.1.4 | 16.1.10 | | 15.0.4 | 15.0.6 | | 13.2.3 | 13.0.22 | | < 13.0.0 | 0.0.77 | diff --git a/package.json b/package.json index d857a18..b187806 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mprisma/components", - "version": "16.1.9", + "version": "16.1.10", "repository": { "type": "git", "url": "https://github.com/gabriel-gn/prisma-components.git" diff --git a/src/components/inputs/multi-select/multi-select.component.ts b/src/components/inputs/multi-select/multi-select.component.ts index 16c44c9..71c6234 100644 --- a/src/components/inputs/multi-select/multi-select.component.ts +++ b/src/components/inputs/multi-select/multi-select.component.ts @@ -177,12 +177,15 @@ export class MultiSelectComponent implements OnInit, AfterViewInit, ControlValue } public selectOption(option: any): void { - this.selectedOptions.push(option); + const currentOptions = this.selectedOptions; + currentOptions.push(option); if (this.sortSelectedItems) { - this.selectedOptions = this.selectedOptions.sort((a, b) => { + this.selectedOptions = currentOptions.sort((a, b) => { return this.options.indexOf(a) - this.options.indexOf(b); }); + } else { + this.selectedOptions = currentOptions; } this.blurInputSelect(); }