From b4b3e9a4965f75707ebf660c1c938d3dc561058b Mon Sep 17 00:00:00 2001 From: lskramarov Date: Thu, 20 Feb 2020 18:50:31 +0300 Subject: [PATCH] fix(tags): incorrect validation (UIM-367) (#416) 8x --- packages/mosaic-dev/validation/module.ts | 3 --- packages/mosaic/tags/tag-list.component.ts | 6 +++--- packages/mosaic/tree/tree-selection.component.ts | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/mosaic-dev/validation/module.ts b/packages/mosaic-dev/validation/module.ts index ac3346b86..7a544398b 100644 --- a/packages/mosaic-dev/validation/module.ts +++ b/packages/mosaic-dev/validation/module.ts @@ -11,13 +11,10 @@ import { import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { DateAdapter, MC_DATE_LOCALE } from '@ptsecurity/cdk/datetime'; import { COMMA, ENTER } from '@ptsecurity/cdk/keycodes'; import { CdkTreeModule, FlatTreeControl } from '@ptsecurity/cdk/tree'; -import { MC_MOMENT_DATE_ADAPTER_OPTIONS, MomentDateAdapter } from '@ptsecurity/mosaic-moment-adapter/adapter'; import { McAutocompleteModule } from '@ptsecurity/mosaic/autocomplete'; import { McButtonModule } from '@ptsecurity/mosaic/button'; -import { MC_VALIDATION } from '@ptsecurity/mosaic/core'; import { McFormFieldModule } from '@ptsecurity/mosaic/form-field'; import { McIconModule } from '@ptsecurity/mosaic/icon'; import { McInputModule } from '@ptsecurity/mosaic/input'; diff --git a/packages/mosaic/tags/tag-list.component.ts b/packages/mosaic/tags/tag-list.component.ts index 1d8565da3..4fc20dbaf 100644 --- a/packages/mosaic/tags/tag-list.component.ts +++ b/packages/mosaic/tags/tag-list.component.ts @@ -823,6 +823,8 @@ export class McTagList extends McTagListMixinBase implements McFormFieldControl< // receive focus. if (this.isValidIndex(tagIndex) && tag.hasFocus) { this.lastDestroyedTagIndex = tagIndex; + } else if (this.isValidIndex(tagIndex) && !tag.hasFocus) { + this.focusInput(); } }); } @@ -832,9 +834,7 @@ export class McTagList extends McTagListMixinBase implements McFormFieldControl< let currentElement = event.target as HTMLElement | null; while (currentElement && currentElement !== this.elementRef.nativeElement) { - if (currentElement.classList.contains('mc-tag')) { - return true; - } + if (currentElement.classList.contains('mc-tag')) { return true; } currentElement = currentElement.parentElement; } diff --git a/packages/mosaic/tree/tree-selection.component.ts b/packages/mosaic/tree/tree-selection.component.ts index c4dc4ec37..57e896ebf 100644 --- a/packages/mosaic/tree/tree-selection.component.ts +++ b/packages/mosaic/tree/tree-selection.component.ts @@ -282,7 +282,6 @@ export class McTreeSelection extends CdkTree onKeyDown(event: KeyboardEvent): void { this.keyManager.setFocusOrigin('keyboard'); - console.log('onKeyDown: '); // tslint:disable-line:no-console // tslint:disable-next-line: deprecation const keyCode = event.keyCode;