diff --git a/src/lib-dev/link/template.html b/src/lib-dev/link/template.html index 2cfad54a6..ce17a47af 100644 --- a/src/lib-dev/link/template.html +++ b/src/lib-dev/link/template.html @@ -4,21 +4,21 @@ Normal - Сохранить - Сохранить + Сохранить + Сохранить - Сохранить - Сохранить + Сохранить + Сохранить - + Сохранить - + Сохранить @@ -26,13 +26,13 @@ - + Сохранить - + Сохранить @@ -40,26 +40,26 @@ - + Сохранить - + Сохранить - + Сохранить - + Сохранить diff --git a/src/lib/link/_link-theme.scss b/src/lib/link/_link-theme.scss index 769f0b970..1d632ea9d 100644 --- a/src/lib/link/_link-theme.scss +++ b/src/lib/link/_link-theme.scss @@ -51,7 +51,6 @@ box-shadow: 0 0 0 2px mc-color($link, 500); } - &.mc-disabled, &[disabled] { color: $link-disabled !important; box-shadow: none; @@ -87,7 +86,6 @@ } } - &.mc-disabled, &[disabled] { & > .mc-link__text { @include _mc-link-dashes_mixin($link-disabled, 100%, 0.32*0.3); @@ -119,7 +117,6 @@ } } - &.mc-disabled, &[disabled] { & > .mc-link__text { @include _mc-link-dashes_mixin($link-disabled, 66%, 0.32*0.3); diff --git a/src/lib/link/link.component.ts b/src/lib/link/link.component.ts index 58dfbc135..a9cb5a1e3 100644 --- a/src/lib/link/link.component.ts +++ b/src/lib/link/link.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, OnDestroy, ViewEncapsulation } from '@angular/core'; +import { Component, ElementRef, OnDestroy, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core'; import { FocusMonitor } from '@ptsecurity/cdk/a11y'; @@ -6,11 +6,20 @@ import { FocusMonitor } from '@ptsecurity/cdk/a11y'; @Component({ selector: 'a.mc-link', template: ``, + changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, - styleUrls: ['./link.css'] + styleUrls: ['./link.css'], + inputs: ['disabled', 'tabindex'], + host: { + '[attr.disabled]': 'disabled || null', + '[attr.tabindex]': 'disabled ? -1 : tabindex ? tabindex : 0' + } }) export class McLink implements OnDestroy { + disabled: boolean; + tabindex: number; + constructor(private elementRef: ElementRef, private _focusMonitor: FocusMonitor) { this._focusMonitor.monitor(elementRef.nativeElement, true); diff --git a/src/lib/link/link.scss b/src/lib/link/link.scss index 6460f5737..8938b79e9 100644 --- a/src/lib/link/link.scss +++ b/src/lib/link/link.scss @@ -35,7 +35,6 @@ border-radius: $link-border-radius; } - &.mc-disabled, &[disabled] { pointer-events: none; cursor: $link-cursor-disabled;