UNPKG

ng-zorro-antd

Version:

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

2 lines 8.27 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="undefined"!=typeof globalThis?globalThis: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,n,r,i,o,s,c,a){"use strict";var u=function(){},d=u,g=function(){function e(e,t){var r=this;this.ngZone=e,this.rendererFactory2=t,this.resizeSource$=new n.Subject,this.listeners=0,this.disposeHandle=u,this.handler=function(){r.ngZone.run((function(){r.resizeSource$.next()}))},this.renderer=this.rendererFactory2.createRenderer(null,null)}return e.prototype.subscribe=function(){var e=this;return this.registerListener(),this.resizeSource$.pipe(r.auditTime(16),r.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}();g.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new g(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.RendererFactory2))},token:g,providedIn:"root"}),g.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],g.ctorParameters=function(){return[{type:t.NgZone},{type:t.RendererFactory2}]};var l=new Map,p=function(){function e(){this._singletonRegistry=new Map}return Object.defineProperty(e.prototype,"singletonRegistry",{get:function(){return i.environment.isTestMode?l:this._singletonRegistry},enumerable:!1,configurable:!0}),e.prototype.registerSingletonWithKey=function(e,t){var n=this.singletonRegistry.has(e),r=n?this.singletonRegistry.get(e):this.withNewTarget(t);n||this.singletonRegistry.set(e,r)},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}();p.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new p},token:p,providedIn:"root"}),p.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var h=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 n.Subject,this.currentDraggingSequence.pipe(r.map((function(e){return{x:e.pageX-t.currentStartingPoint.x,y:e.pageY-t.currentStartingPoint.y}})),r.filter((function(e){return Math.abs(e.x)>t.draggingThreshold||Math.abs(e.y)>t.draggingThreshold})),r.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}();function f(e,t,n,r){var i=n-t,o=e/(r/2);return o<1?i/2*o*o*o+t:i/2*((o-=2)*o*o+2)+t}h.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new h(t.ɵɵinject(t.RendererFactory2))},token:h,providedIn:"root"}),h.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],h.ctorParameters=function(){return[{type:t.RendererFactory2}]};var m,y=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 n=e.getBoundingClientRect();if(n.width||n.height){var r=e.ownerDocument.documentElement;t.top=n.top-r.clientTop,t.left=n.left-r.clientLeft}else t.top=n.top,t.left=n.left;return t},e.prototype.getScroll=function(e,t){if(void 0===t&&(t=!0),"undefined"==typeof window)return 0;var n=t?"scrollTop":"scrollLeft",r=0;return this.isWindow(e)?r=e[t?"pageYOffset":"pageXOffset"]:e instanceof Document?r=e.documentElement[n]:e&&(r=e[n]),e&&!this.isWindow(e)&&"number"!=typeof r&&(r=(e.ownerDocument||e).documentElement[n]),r},e.prototype.isWindow=function(e){return null!=e&&e===e.window},e.prototype.scrollTo=function(e,t,n){var r=this;void 0===t&&(t=0),void 0===n&&(n={});var i=e||window,o=this.getScroll(i),s=Date.now(),a=n.easing,u=n.callback,d=n.duration,g=void 0===d?450:d,l=function(){var e=Date.now()-s,n=(a||f)(e>g?g:e,o,t,g);r.isWindow(i)?i.scrollTo(window.pageXOffset,n):i instanceof HTMLDocument||"HTMLDocument"===i.constructor.name?i.documentElement.scrollTop=n:i.scrollTop=n,e<g?c.reqAnimFrame(l):"function"==typeof u&&u()};c.reqAnimFrame(l)},e}();y.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new y(t.ɵɵinject(s.DOCUMENT))},token:y,providedIn:"root"}),y.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],y.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[s.DOCUMENT]}]}]},e.NzBreakpointEnum=void 0,(m=e.NzBreakpointEnum||(e.NzBreakpointEnum={})).xxl="xxl",m.xl="xl",m.lg="lg",m.md="md",m.sm="sm",m.xs="xs";var v={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)"},w=function(){function t(e,t){this.resizeService=e,this.mediaMatcher=t,this.resizeService.subscribe().subscribe((function(){}))}return t.prototype.subscribe=function(e,t){var n=this;if(t){var i=function(){return n.matchMedia(e,!0)};return this.resizeService.subscribe().pipe(r.map(i),r.startWith(i()),r.distinctUntilChanged((function(e,t){return e[0]===t[0]})),r.map((function(e){return e[1]})))}i=function(){return n.matchMedia(e)};return this.resizeService.subscribe().pipe(r.map(i),r.startWith(i()),r.distinctUntilChanged())},t.prototype.matchMedia=function(t,n){var r=this,i=e.NzBreakpointEnum.md,o={};return Object.keys(t).map((function(e){var t=e,n=r.mediaMatcher.matchMedia(v[t]).matches;o[e]=n,n&&(i=t)})),n?[i,o]:i},t}();w.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new w(t.ɵɵinject(g),t.ɵɵinject(a.MediaMatcher))},token:w,providedIn:"root"}),w.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[{type:g},{type:a.MediaMatcher}]},e.NzBreakpointService=w,e.NzDragService=h,e.NzResizeService=g,e.NzScrollService=y,e.NzSingletonService=p,e.gridResponsiveMap=v,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)"},e.ɵ0=d,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-core-services.umd.min.js.map