1- import { booleanAttribute , computed , Directive , effect , input } from '@angular/core' ;
1+ import { booleanAttribute , computed , Directive , effect , input , numberAttribute } from '@angular/core' ;
2+ import { BooleanInput } from '../coreui.types' ;
23
34@Directive ( {
45 selector : '[cNavLink]' ,
@@ -12,6 +13,8 @@ import { booleanAttribute, computed, Directive, effect, input } from '@angular/c
1213 }
1314} )
1415export class NavLinkDirective {
16+ static ngAcceptInputType_disabled : BooleanInput ;
17+
1518 /**
1619 * Sets .nav-link class to the host. [docs]
1720 * @default true
@@ -30,20 +33,25 @@ export class NavLinkDirective {
3033 */
3134 readonly disabled = input ( false , { transform : booleanAttribute } ) ;
3235
36+ /**
37+ * The tabindex attribute specifies the tab order of an element (when the "tab" button is used for navigating).
38+ */
39+ readonly tabindex = input ( undefined , { transform : numberAttribute } ) ;
40+
3341 readonly ariaCurrent = computed ( ( ) => {
3442 return this . active ( ) ? 'page' : null ;
3543 } ) ;
3644
3745 ariaDisabled : boolean | null = null ;
3846 attrDisabled : boolean | string | null = null ;
39- attrTabindex : '-1' | null = null ;
47+ attrTabindex : number | null = null ;
4048 styleCursor : 'pointer' | null = null ;
4149
4250 readonly #disabledEffect = effect ( ( ) => {
4351 const disabled = this . disabled ( ) ;
4452 this . ariaDisabled = disabled || null ;
4553 this . attrDisabled = disabled ? '' : null ;
46- this . attrTabindex = disabled ? '-1' : null ;
54+ this . attrTabindex = disabled ? - 1 : ( this . tabindex ( ) ?? null ) ;
4755 this . styleCursor = disabled ? null : 'pointer' ;
4856 } ) ;
4957
0 commit comments