UNPKG

ngx-dynamic-tabindex

Version:
2 lines 1.56 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-dynamic-tabindex",["exports","@angular/core"],t):t((e=e||self)["ngx-dynamic-tabindex"]={},e.ng.core)}(this,(function(e,t){"use strict";var n=function(){function e(e){this.hostEl=e,this.attributeName="tabindex"}return e.prototype.ngAfterViewInit=function(){var e=this;this.applyIndexes(),this.mutationObserver=new MutationObserver((function(){return e.applyIndexes()})),this.mutationObserver.observe(this.hostEl.nativeElement,{childList:!0,subtree:!0})},e.prototype.ngOnDestroy=function(){this.mutationObserver.disconnect()},e.prototype.applyIndexes=function(){var e,t,n=this,r=!!this.hostEl.nativeElement.querySelector("[tabIndexAheadOffset]");this.hostEl.nativeElement.querySelectorAll("["+this.attributeName+"]").forEach((function(i,o){if(r){var a=parseInt(i.getAttribute("tabIndexAheadOffset"),10);a?(e=a,t=n.getTabIndex(o+a+1)):e>=1?(t=n.getTabIndex(o),e--):t=n.getTabIndex(o+1)}else t=n.getTabIndex(o+1);i.setAttribute(n.attributeName,t)}))},e.prototype.getTabIndex=function(e){return e.toString()},e}();n.decorators=[{type:t.Directive,args:[{selector:"[applyTabIndexes]"}]}],n.ctorParameters=function(){return[{type:t.ElementRef}]};var r=function(){};r.decorators=[{type:t.NgModule,args:[{declarations:[n],imports:[],exports:[n]}]}],e.NgxDynamicTabindexDirective=n,e.NgxDynamicTabindexModule=r,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-dynamic-tabindex.umd.min.js.map