UNPKG

@pepperi/lib

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.

2 lines 3.24 kB
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("@angular/flex-layout"),require("@pepperi/lib"),require("@angular/flex-layout/extended")):"function"==typeof define&&define.amd?define("@pepperi/lib/size-detector",["exports","@angular/core","@angular/common","@angular/forms","@angular/flex-layout","@pepperi/lib","@angular/flex-layout/extended"],o):o(((e=e||self).pepperi=e.pepperi||{},e.pepperi.lib=e.pepperi.lib||{},e.pepperi.lib["size-detector"]={}),e.ng.core,e.ng.common,e.ng.forms,e.ng.flexLayout,e.pepperi.lib,e.ng.flexLayout.extended)}(this,(function(e,o,n,t,i,r,l){"use strict";function s(e,n){if(1&e&&(o.ɵɵelementStart(0,"div",1),o.ɵɵtext(1),o.ɵɵelementEnd()),2&e){var t=n.$implicit,i=o.ɵɵnextContext();o.ɵɵclassMap(t.css+" "+(i.prefix+t.id)),o.ɵɵpropertyInterpolate("fxShow.xs","xs"==t.name),o.ɵɵpropertyInterpolate("fxShow.sm","sm"==t.name),o.ɵɵpropertyInterpolate("fxShow.md","md"==t.name),o.ɵɵpropertyInterpolate("fxShow.lg","lg"==t.name),o.ɵɵpropertyInterpolate("fxShow.xl","xl"==t.name),o.ɵɵadvance(1),o.ɵɵtextInterpolate1("The current screen size is - ",t.name,"\n")}}var d=function(){function e(e,o){this.element=e,this.layoutService=o,this.prefix="is-",this.sizes=[{id:r.SCREEN_SIZE.XS,name:"xs",css:"d-block d-sm-none"},{id:r.SCREEN_SIZE.SM,name:"sm",css:"d-none d-sm-block d-md-none"},{id:r.SCREEN_SIZE.MD,name:"md",css:"d-none d-md-block d-lg-none"},{id:r.SCREEN_SIZE.LG,name:"lg",css:"d-none d-lg-block d-xl-none"},{id:r.SCREEN_SIZE.XL,name:"xl",css:"d-none d-xl-block"}]}return e.prototype.onResize=function(e){this.detectScreenSize()},e.prototype.ngAfterViewInit=function(){this.detectScreenSize()},e.prototype.detectScreenSize=function(){var e=this,o=this.sizes.find((function(o){var n=e.element.nativeElement.querySelector("."+e.prefix+o.id);return"none"!==window.getComputedStyle(n).display}));this.layoutService.onResize(o.id)},e}();d.ɵfac=function(e){return new(e||d)(o.ɵɵdirectiveInject(o.ElementRef),o.ɵɵdirectiveInject(r.LayoutService))},d.ɵcmp=o.ɵɵdefineComponent({type:d,selectors:[["pep-size-detector"]],hostBindings:function(e,n){1&e&&o.ɵɵlistener("resize",(function(e){return n.onResize(e)}),!1,o.ɵɵresolveWindow)},decls:1,vars:1,consts:[[3,"fxShow.xs","fxShow.sm","fxShow.md","fxShow.lg","fxShow.xl","class",4,"ngFor","ngForOf"],[3,"fxShow.xs","fxShow.sm","fxShow.md","fxShow.lg","fxShow.xl"]],template:function(e,n){1&e&&o.ɵɵtemplate(0,s,2,9,"div",0),2&e&&o.ɵɵproperty("ngForOf",n.sizes)},directives:[n.NgForOf,l.DefaultShowHideDirective],encapsulation:2});var p=function(){};p.ɵmod=o.ɵɵdefineNgModule({type:p}),p.ɵinj=o.ɵɵdefineInjector({factory:function(e){return new(e||p)},imports:[[n.CommonModule,t.ReactiveFormsModule,t.FormsModule,i.FlexLayoutModule,r.PepperiModule]]}),("undefined"==typeof ngJitMode||ngJitMode)&&o.ɵɵsetNgModuleScope(p,{declarations:[d],imports:[n.CommonModule,t.ReactiveFormsModule,t.FormsModule,i.FlexLayoutModule,r.PepperiModule],exports:[d]}),e.PepperiSizeDetectorModule=p,e.SizeDetectorComponent=d,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=pepperi-lib-size-detector.umd.min.js.map