UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

2 lines 7.76 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("ng-zorro-antd/core/environments"),require("ng-zorro-antd/core/util"),require("@angular/common"),require("ng-zorro-antd/core/polyfill"),require("@angular/cdk/layout")):"function"==typeof define&&define.amd?define("ng-zorro-antd/core/services",["exports","@angular/core","rxjs","rxjs/operators","ng-zorro-antd/core/environments","ng-zorro-antd/core/util","@angular/common","ng-zorro-antd/core/polyfill","@angular/cdk/layout"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].core=e["ng-zorro-antd"].core||{},e["ng-zorro-antd"].core.services={}),e.ng.core,e.rxjs,e.rxjs.operators,e["ng-zorro-antd"].core.environments,e["ng-zorro-antd"].core.util,e.ng.common,e["ng-zorro-antd"].core.polyfill,e.ng.cdk.layout)}(this,(function(e,t,r,n,i,o,s,c,a){"use strict";var u=function(){},g=function(){function e(e,t){var n=this;this.ngZone=e,this.rendererFactory2=t,this.resizeSource$=new r.Subject,this.listeners=0,this.disposeHandle=u,this.handler=function(){n.ngZone.run((function(){n.resizeSource$.next()}))},this.renderer=this.rendererFactory2.createRenderer(null,null)}return e.prototype.subscribe=function(){var e=this;return this.registerListener(),this.resizeSource$.pipe(n.auditTime(16),n.finalize((function(){return e.unregisterListener()})))},e.prototype.unsubscribe=function(){this.unregisterListener()},e.prototype.registerListener=function(){var e=this;0===this.listeners&&this.ngZone.runOutsideAngular((function(){e.disposeHandle=e.renderer.listen("window","resize",e.handler)})),this.listeners+=1},e.prototype.unregisterListener=function(){this.listeners-=1,0===this.listeners&&(this.disposeHandle(),this.disposeHandle=u)},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:t.NgZone},{type:t.RendererFactory2}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.RendererFactory2))},token:e,providedIn:"root"}),e}();var d=new Map,l=function(){function e(){this._singletonRegistry=new Map}return Object.defineProperty(e.prototype,"singletonRegistry",{get:function(){return i.environment.isTestMode?d:this._singletonRegistry},enumerable:!0,configurable:!0}),e.prototype.registerSingletonWithKey=function(e,t){var r=this.singletonRegistry.has(e),n=r?this.singletonRegistry.get(e):this.withNewTarget(t);r||this.singletonRegistry.set(e,n)},e.prototype.getSingletonWithKey=function(e){return this.singletonRegistry.has(e)?this.singletonRegistry.get(e).target:null},e.prototype.withNewTarget=function(e){return{target:e}},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var p=function(){function e(e){this.draggingThreshold=5,this.currentDraggingSequence=null,this.currentStartingPoint=null,this.handleRegistry=new Set,this.renderer=e.createRenderer(null,null)}return e.prototype.requestDraggingSequence=function(e){var t=this;return this.handleRegistry.size||this.registerDraggingHandler(o.isTouchEvent(e)),this.currentDraggingSequence&&this.currentDraggingSequence.complete(),this.currentStartingPoint=function(e){var t=o.getEventPosition(e);return{x:t.pageX,y:t.pageY}}(e),this.currentDraggingSequence=new r.Subject,this.currentDraggingSequence.pipe(n.map((function(e){return{x:e.pageX-t.currentStartingPoint.x,y:e.pageY-t.currentStartingPoint.y}})),n.filter((function(e){return Math.abs(e.x)>t.draggingThreshold||Math.abs(e.y)>t.draggingThreshold})),n.finalize((function(){return t.teardownDraggingSequence()})))},e.prototype.registerDraggingHandler=function(e){var t=this;e?(this.handleRegistry.add({teardown:this.renderer.listen("document","touchmove",(function(e){t.currentDraggingSequence&&t.currentDraggingSequence.next(e.touches[0]||e.changedTouches[0])}))}),this.handleRegistry.add({teardown:this.renderer.listen("document","touchend",(function(){t.currentDraggingSequence&&t.currentDraggingSequence.complete()}))})):(this.handleRegistry.add({teardown:this.renderer.listen("document","mousemove",(function(e){t.currentDraggingSequence&&t.currentDraggingSequence.next(e)}))}),this.handleRegistry.add({teardown:this.renderer.listen("document","mouseup",(function(){t.currentDraggingSequence&&t.currentDraggingSequence.complete()}))}))},e.prototype.teardownDraggingSequence=function(){this.currentDraggingSequence=null},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:t.RendererFactory2}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(t.RendererFactory2))},token:e,providedIn:"root"}),e}();function h(e,t,r,n){var i=r-t,o=e/(n/2);return o<1?i/2*o*o*o+t:i/2*((o-=2)*o*o+2)+t}var f=function(){function e(e){this.doc=e}return e.prototype.setScrollTop=function(e,t){void 0===t&&(t=0),e===window?(this.doc.body.scrollTop=t,this.doc.documentElement.scrollTop=t):e.scrollTop=t},e.prototype.getOffset=function(e){var t={top:0,left:0};if(!e||!e.getClientRects().length)return t;var r=e.getBoundingClientRect();if(r.width||r.height){var n=e.ownerDocument.documentElement;t.top=r.top-n.clientTop,t.left=r.left-n.clientLeft}else t.top=r.top,t.left=r.left;return t},e.prototype.getScroll=function(e,t){void 0===t&&(t=!0);var r=e||window,n=t?"scrollTop":"scrollLeft",i=r===window,o=i?r[t?"pageYOffset":"pageXOffset"]:r[n];return i&&"number"!=typeof o&&(o=this.doc.documentElement[n]),o},e.prototype.scrollTo=function(e,t,r,n){var i=this;void 0===t&&(t=0);var o=e||window,s=this.getScroll(o),a=Date.now(),u=function(){var e=Date.now()-a;i.setScrollTop(o,(r||h)(e,s,t,450)),e<450?c.reqAnimFrame(u):n&&n()};c.reqAnimFrame(u)},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]}]},e}();function m(e,t){return t||new f(e)}var y={provide:f,useFactory:m,deps:[s.DOCUMENT,[new t.Optional,new t.SkipSelf,f]]},v={xxl:"xxl",xl:"xl",lg:"lg",md:"md",sm:"sm",xs:"xs"},x={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)"},S=function(){function e(e,t){this.resizeService=e,this.mediaMatcher=t,this.resizeService.subscribe().subscribe((function(){}))}return e.prototype.subscribe=function(e,t){var r=this;if(t){var i=function(){return r.matchMedia(e,!0)};return this.resizeService.subscribe().pipe(n.map(i),n.startWith(i()),n.distinctUntilChanged((function(e,t){return e[0]===t[0]})),n.map((function(e){return e[1]})))}i=function(){return r.matchMedia(e)};return this.resizeService.subscribe().pipe(n.map(i),n.startWith(i()),n.distinctUntilChanged())},e.prototype.matchMedia=function(e,t){var r=this,n=v.md,i={};return Object.keys(e).map((function(e){var t=e,o=r.mediaMatcher.matchMedia(x[t]).matches;i[e]=o,o&&(n=t)})),t?[n,i]:n},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:g},{type:a.MediaMatcher}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(g),t.ɵɵinject(a.MediaMatcher))},token:e,providedIn:"root"}),e}();e.NzBreakpointEnum=v,e.NzBreakpointService=S,e.NzDragService=p,e.NzResizeService=g,e.NzScrollService=f,e.NzSingletonService=l,e.SCROLL_SERVICE_PROVIDER=y,e.SCROLL_SERVICE_PROVIDER_FACTORY=m,e.gridResponsiveMap=x,e.siderResponsiveMap={xs:"(max-width: 479.98px)",sm:"(max-width: 575.98px)",md:"(max-width: 767.98px)",lg:"(max-width: 991.98px)",xl:"(max-width: 1199.98px)",xxl:"(max-width: 1599.98px)"},Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-core-services.umd.min.js.map