@raphy/ngx-equalizer
Version:
A library to equalize height and width of elements with Angular4+
2 lines • 3.27 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("@raphy/ngx-equalizer",["exports","@angular/core","@angular/common"],t):t((e.raphy=e.raphy||{},e.raphy["ngx-equalizer"]={}),e.ng.core,e.ng.common)}(this,function(e,n,t){"use strict";var r=function(){function e(){}return e.prototype.equalize=function(r,e,n){void 0===n&&(n={property:"height",reset:!0});var i=0;e.map(function(e){n.reset&&r.setStyle(e.nativeElement,n.property,"initial");var t=e.nativeElement["offset"+n.property[0].toUpperCase()+n.property.slice(1)];i=i<t?t:i}),e.map(function(e){r.setStyle(e.nativeElement,n.property,i+"px")})},e.decorators=[{type:n.Injectable}],e}(),i=function(){function e(e){this._elementRef=e}return Object.defineProperty(e.prototype,"elementRef",{get:function(){return this._elementRef},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e},enumerable:!0,configurable:!0}),e.decorators=[{type:n.Directive,args:[{selector:"[equalizerWatcher]"}]}],e.ctorParameters=function(){return[{type:n.ElementRef}]},e.propDecorators={_id:[{type:n.Input,args:["equalizerWatcher"]}]},e}(),o=function(){function e(e,t,r){this._elementRef=e,this._renderer=t,this._equalizerService=r,this._params="height",this._watchers=new n.QueryList}return Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e,this.equalize()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elementRef",{get:function(){return this._elementRef},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},set:function(e){this._id=e},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewChecked=function(){this.equalize()},e.prototype._onResize=function(){this.equalize()},e.prototype.equalize=function(){var t=this;this._params||(this._params="height");var e=Object.assign({property:"height",reset:!0},"string"==typeof this._params?{property:this._params}:this._params),r=this._watchers.filter(function(e){return console.log("ID matching",e.id,t.id),e.id||t.id?e.id===t.id:e.elementRef.nativeElement!==t._elementRef.nativeElement}).map(function(e){return e.elementRef});this._equalizerService.equalize(this._renderer,r,e)},e.decorators=[{type:n.Directive,args:[{selector:"[equalizer]",exportAs:"equalizer"}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:n.Renderer2},{type:r}]},e.propDecorators={_params:[{type:n.Input,args:["equalizer"]}],_id:[{type:n.Input,args:["equalizerId"]}],_watchers:[{type:n.ContentChildren,args:[i,{read:i}]}],_onResize:[{type:n.HostListener,args:["window:resize"]}]},e}(),a=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[r]}},e.forChild=function(){return{ngModule:e,providers:[r]}},e.decorators=[{type:n.NgModule,args:[{imports:[t.CommonModule],exports:[o,i],declarations:[o,i],providers:[r]}]}],e}();e.EqualizerDirective=o,e.EqualizerWatcherDirective=i,e.EqualizerService=r,e.EqualizerModule=a,e.ɵa=o,e.ɵb=i,e.ɵc=r,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=raphy-ngx-equalizer.umd.min.js.map