@progress/kendo-angular-popup
Advanced tools
Comparing version 0.14.2 to 0.14.3
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/operator/auditTime"),require("rxjs/add/observable/merge"),require("@angular/common")):"function"==typeof define&&define.amd?define(["@angular/core","rxjs/Observable","rxjs/add/observable/fromEvent","rxjs/add/operator/auditTime","rxjs/add/observable/merge","@angular/common"],e):"object"==typeof exports?exports.KendoAngularPopup=e(require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/operator/auditTime"),require("rxjs/add/observable/merge"),require("@angular/common")):t.KendoAngularPopup=e(t["@angular/core"],t["rxjs/Observable"],t["rxjs/add/observable/fromEvent"],t["rxjs/add/operator/auditTime"],t["rxjs/add/observable/merge"],t["@angular/common"])}(this,function(t,e,n,o,i,r){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var o=n(1);e.PopupComponent=o.PopupComponent;var i=n(14);e.PopupModule=i.PopupModule},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(3),c=n(4),l=n(7),a=n(8),f=n(12),u=n(6),p={left:0,top:0},d=function(){function t(t,e,n,o,i,s,c){this._alignService=t,this.container=e,this._cdr=n,this._positionService=o,this._resizeService=i,this._scrollableService=s,this._renderer=c,this.animate=!0,this.anchorAlign={horizontal:"left",vertical:"bottom"},this.collision={horizontal:"fit",vertical:"flip"},this.popupAlign={horizontal:"left",vertical:"top"},this.offset=p,this.anchorViewportLeave=new r.EventEmitter,this.direction="down",this.currentOffset=p,this.resolvedPromised=Promise.resolve(null),c.setElementClass(e.nativeElement,"k-animation-container",!0),c.setElementClass(e.nativeElement,"k-animation-container-fixed",!0)}return Object.defineProperty(t.prototype,"offsetLeft",{get:function(){return this.currentOffset.left},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"offsetTop",{get:function(){return this.currentOffset.top},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this.reposition.bind(this);this._resizeService.subscribe(t),this._scrollableService.forElement(this.anchor||this.container).subscribe(this.onScroll.bind(this))},t.prototype.ngAfterViewChecked=function(){var t=this,e=this.position(),n=e.flipped,o=e.offset,i=this.getDirection(n);(this.direction!==i||u.isDifferentOffset(this.currentOffset,o))&&this.resolvedPromised.then(function(){t.currentOffset=o,t.direction=i,t._cdr.markForCheck()})},t.prototype.ngOnDestroy=function(){this._resizeService.unsubscribe(),this._scrollableService.unsubscribe()},t.prototype.reposition=function(){if(u.isDocumentAvailable()){var t=this.position(),e=t.flipped,n=t.offset;this.direction=this.getDirection(e),this.currentOffset=n}},t.prototype.position=function(){var t=this._alignService.alignElement({anchor:this.anchor,anchorAlign:this.anchorAlign,element:this.container,elementAlign:this.popupAlign,offset:this.offset});return this._positionService.positionElement({anchor:this.anchor,anchorAlign:this.anchorAlign,collisions:this.collision,currentLocation:t,element:this.container,elementAlign:this.popupAlign})},t.prototype.getDirection=function(t){return this.animate?t?"up":"down":"none"},t.prototype.onScroll=function(t){t?this.reposition():this.anchorViewportLeave.emit()},o([r.Input(),i("design:type",Boolean)],t.prototype,"animate",void 0),o([r.Input(),i("design:type",r.ElementRef)],t.prototype,"anchor",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"anchorAlign",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"collision",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"popupAlign",void 0),o([r.Input(),i("design:type",String)],t.prototype,"popupClass",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"offset",void 0),o([r.Output(),i("design:type",r.EventEmitter)],t.prototype,"anchorViewportLeave",void 0),o([r.HostBinding("style.left.px"),i("design:type",Number)],t.prototype,"offsetLeft",null),o([r.HostBinding("style.top.px"),i("design:type",Number)],t.prototype,"offsetTop",null),t=o([r.Component({animations:[r.trigger("toggle",[r.transition("void => down, up => down",[r.style({transform:"translateY(-100%)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(0)"}))]),r.transition("down => void",[r.style({transform:"translateY(0)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(-100%)"}))]),r.transition("void => up, down => up",[r.style({transform:"translateY(100%)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(0)"}))]),r.transition("up => void",[r.style({transform:"translateY(0)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(100%)"}))])])],exportAs:"kendo-popup",providers:[s.AlignService,c.DOMService,l.PositionService,a.ResizeService,f.ScrollableService],selector:"kendo-popup",template:'\n <div class="k-popup" [ngClass]="popupClass" [@toggle]="direction">\n <ng-content></ng-content>\n </div>\n '}),i("design:paramtypes",[s.AlignService,r.ElementRef,r.ChangeDetectorRef,l.PositionService,a.ResizeService,f.ScrollableService,r.Renderer])],t)}();e.PopupComponent=d},function(e,n){e.exports=t},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(4),c=n(6),l=function(){function t(t){this._dom=t}return t.prototype.alignElement=function(t){var e=t.anchor,n=t.element,o=t.anchorAlign,i=t.elementAlign,r=t.offset,s=c.eitherRect(this._dom.offset(e),r);return e||(s=this._dom.removeScroll(s,this._dom.scrollPosition(n))),this._dom.align({anchorAlign:o,anchorRect:s,elementAlign:i,elementRect:this._dom.offset(n)})},t=o([r.Injectable(),i("design:paramtypes",[s.DOMService])],t)}();e.AlignService=l},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(5),c=n(6),l=function(){function t(){}return t.prototype.addOffset=function(t,e){return{left:t.left+e.left,top:t.top+e.top}},t.prototype.align=function(t){return s.align(t)},t.prototype.boundingOffset=function(t){return s.boundingOffset(this.nativeElement(t))},t.prototype.getWindow=function(){return c.isWindowAvailable()?window:null},t.prototype.isBodyOffset=function(t){return s.isBodyOffset(this.nativeElement(t))},t.prototype.offset=function(t){return t?s.offset(this.nativeElement(t)):null},t.prototype.nativeElement=function(t){return t?t.nativeElement||t:null},t.prototype.position=function(t){return t?s.position(this.nativeElement(t)):null},t.prototype.relativeOffset=function(t,e){return s.applyLocationOffset(this.offset(t),e,this.isBodyOffset(t))},t.prototype.removeScroll=function(t,e){return s.removeScroll(t,e)},t.prototype.restrictToView=function(t){return s.restrictToView(t)},t.prototype.scrollPosition=function(t){return s.scrollPosition(this.nativeElement(t))},t.prototype.scrollableParents=function(t){return c.scrollableParents(this.nativeElement(t))},t.prototype.windowViewPort=function(t){return s.getWindowViewPort(this.nativeElement(t))},t=o([r.Injectable(),i("design:paramtypes",[])],t)}();e.DOMService=l},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={bottom:"bottom",center:"center",middle:"middle",left:"left",right:"right",top:"top"},o=function(t){var e=t.anchorRect,o=t.anchorAlign,i=t.elementRect,r=t.elementAlign,s=o.horizontal,c=o.vertical,l=r.horizontal,a=r.vertical,f=e.top,u=e.left;return c===n.bottom&&(f+=e.height),c!==n.center&&c!==n.middle||(f+=Math.round(e.height/2)),a===n.bottom&&(f-=i.height),a!==n.center&&a!==n.middle||(f-=Math.round(i.height/2)),s===n.right&&(u+=e.width),s!==n.center&&s!==n.middle||(u+=Math.round(e.width/2)),l===n.right&&(u-=i.width),l!==n.center&&l!==n.middle||(u-=Math.round(i.width/2)),{top:f,left:u}},i=function(t,e,n){var o=t.top,i=t.left;return n&&(i=0,o=0),{top:o+e.top,left:i+e.left,height:t.height,width:t.width}},r=function(t){if(!t.getBoundingClientRect)return{bottom:t.innerHeight,left:0,right:t.innerWidth,top:0};var e=t.getBoundingClientRect(),n=e.bottom,o=e.left,i=e.right,r=e.top;return{bottom:n,left:o,right:i,top:r}},s={fit:"fit",flip:"flip"},c=function(t){return t.ownerDocument.documentElement},l=function(t){for(var e=t.offsetParent;e&&"static"===e.style.position;)e=e.offsetParent;return e||c(t)},a=function(t){return l(t)===t.ownerDocument.body},f=function(t){var e=t.style,n=e.display,o=e.left,i=e.position;t.style.display="",t.style.left="-10000px",t.style.position="absolute";var r=t.getBoundingClientRect();return t.style.display=n,t.style.left=o,t.style.position=i,r},u=function(t){var e=t.getBoundingClientRect(),n=e.left,o=e.top;return e.height||e.width||(e=f(t),n=e.left,o=e.top),{top:o,left:n,height:e.height,width:e.width}},p=function(t){return t.ownerDocument.defaultView},d=function(t){var e=p(t),n=e.getComputedStyle(t),o=u(t),i=l(t),r=e.getComputedStyle(i),s={top:0,left:0};return"fixed"!==n.position&&i!==t.ownerDocument.body&&(s=u(i),s.top+=parseInt(r.borderTopWidth,10),s.left+=parseInt(r.borderLeftWidth,10)),{top:o.top-s.top-parseInt(n.marginTop,10),left:o.left-s.left-parseInt(n.marginLeft,10),height:o.height,width:o.width}},h=function(t,e){return{top:t.top-e.y,left:t.left-e.x,height:t.height,width:t.width}},m=function(t,e,n){var o=0;return t+e>n&&(o=n-(t+e)),t<0&&(o=-t),o},g=function(t){var e=t.offset,o=t.size,i=t.anchorSize,r=t.viewPortSize,s=t.anchorAlignPoint,c=t.elementAlignPoint,l=0,a=c===n.center||c===n.middle,f=s===n.center||s===n.middle;return c===s||a||f||(e+o>r&&(l+=-(i+o)),e+l<0&&(l+=i+o)),l},v=function(t){var e=t.anchorRect,n=t.anchorAlign,o=t.elementRect,i=t.elementAlign,r=t.collisions,c=t.viewPort,l=o.top,a=o.left,f=o.height,u=o.width,p=c.height,d=c.width,h=0,v=0,b=r.horizontal===s.flip,y=r.vertical===s.flip;return r.vertical===s.fit&&(v+=m(l,f,p)),r.horizontal===s.fit&&(h+=m(a,u,d)),y&&(v+=g({offset:l,size:f,anchorSize:e.height,viewPortSize:p,anchorAlignPoint:n.vertical,elementAlignPoint:i.vertical})),b&&(h+=g({offset:a,size:u,anchorSize:e.width,viewPortSize:d,anchorAlignPoint:n.horizontal,elementAlignPoint:i.horizontal})),{flipped:b&&0!==h||y&&0!==v,offset:{left:h,top:v}}},b=function(t){var e=c(t),n=p(t);return{x:n.pageXOffset||e.scrollLeft||0,y:n.pageYOffset||e.scrollTop||0}},y=function(t){var e=p(t);return{height:e.innerHeight,width:e.innerWidth}};e.align=o,e.AlignPoint=n,e.applyLocationOffset=i,e.boundingOffset=r,e.Collision=s,e.getDocumentElement=c,e.isBodyOffset=a,e.offsetParent=l,e.offset=u,e.position=d,e.removeScroll=h,e.restrictToView=v,e.scrollPosition=b,e.getWindow=p,e.getWindowViewPort=y},function(t,e){"use strict";var n=function(t,e){return t?t:{height:0,left:e.left,top:e.top,width:0}};e.eitherRect=n;var o=function(t,e){var n=t.left,o=t.top,i=e.left,r=e.top;return n!==i||o!==r};e.isDifferentOffset=o;var i=function(){return"undefined"!=typeof document};e.isDocumentAvailable=i;var r=function(){return"undefined"!=typeof window};e.isWindowAvailable=r;var s=function(t){return!!t.getBoundingClientRect};e.hasBoundingRect=s;var c=/auto|scroll/,l=function(t){var e=[];if(!i()||!r())return e;for(var n=t.parentElement;n;)c.test(window.getComputedStyle(n).overflow)&&e.push(n),n=n.parentElement;return e.push(window),e};e.scrollableParents=l;var a=1e3/60;e.FRAME_DURATION=a},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(4),c=n(6),l=function(){function t(t){this._dom=t}return t.prototype.positionElement=function(t){var e=t.anchor,n=t.currentLocation,o=t.element,i=t.anchorAlign,r=t.elementAlign,s=t.collisions,l=t.viewPort||this._dom.windowViewPort(o),a=c.eitherRect(this._dom.offset(e),n),f=this._dom.offset(o),u={height:f.height,left:n.left,top:n.top,width:f.width},p=this._dom.restrictToView({anchorAlign:i,anchorRect:a,collisions:s,elementAlign:r,elementRect:u,viewPort:l});return{flipped:p.flipped,offset:this._dom.addOffset(u,p.offset)}},t=o([r.Injectable(),i("design:paramtypes",[s.DOMService])],t)}();e.PositionService=l},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(9);n(10),n(11);var c=n(6),l=n(4),a=function(){function t(t,e){this._dom=t,this._zone=e}return t.prototype.subscribe=function(t){var e=this;c.isDocumentAvailable()&&this._zone.runOutsideAngular(function(){e.subscription=s.Observable.fromEvent(e._dom.getWindow(),"resize").auditTime(c.FRAME_DURATION).subscribe(function(){return e._zone.run(function(){return t()})})})},t.prototype.unsubscribe=function(){this.subscription&&this.subscription.unsubscribe()},t.prototype.isUnsubscribed=function(){return this.subscription&&this.subscription.closed},t=o([r.Injectable(),i("design:paramtypes",[l.DOMService,r.NgZone])],t)}();e.ResizeService=a},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=o},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(9);n(10),n(13),n(11);var c=n(4),l=n(6),a=function(){function t(t,e){this._dom=t,this._zone=e}return t.prototype.forElement=function(t){return this.unsubscribe(),this.element=t,this},t.prototype.subscribe=function(t){var e=this;if(t&&l.isDocumentAvailable()&&this.element){var n=this._dom.nativeElement(this.element),o=this._dom.scrollableParents(this.element);this._zone.runOutsideAngular(function(){var i=o.map(function(t){return s.Observable.fromEvent(t,"scroll").auditTime(l.FRAME_DURATION)}),r=function(o){return e._zone.run(function(){return t(e.isVisible(n,o.target))})};e.subscription=s.Observable.merge.apply(s.Observable,i).subscribe(r)})}},t.prototype.unsubscribe=function(){this.subscription&&this.subscription.unsubscribe()},t.prototype.isVisible=function(t,e){var n=this._dom.boundingOffset(t),o=this._dom.boundingOffset(e);return!(n.bottom<o.top)&&(!(n.bottom>o.bottom)&&(!(n.right>o.right)&&!(n.left<o.left)))},t=o([r.Injectable(),i("design:paramtypes",[c.DOMService,r.NgZone])],t)}();e.ScrollableService=a},function(t,e){t.exports=i},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var c=t.length-1;c>=0;c--)(i=t[c])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(15),c=n(1),l=[c.PopupComponent],a=function(){function t(){}return t=o([r.NgModule({declarations:[l],exports:[l],imports:[s.CommonModule]}),i("design:paramtypes",[])],t)}();e.PopupModule=a},function(t,e){t.exports=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/operator/auditTime"),require("rxjs/add/observable/merge"),require("@angular/common")):"function"==typeof define&&define.amd?define(["@angular/core","rxjs/Observable","rxjs/add/observable/fromEvent","rxjs/add/operator/auditTime","rxjs/add/observable/merge","@angular/common"],e):"object"==typeof exports?exports.KendoAngularPopup=e(require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/operator/auditTime"),require("rxjs/add/observable/merge"),require("@angular/common")):t.KendoAngularPopup=e(t["@angular/core"],t["rxjs/Observable"],t["rxjs/add/observable/fromEvent"],t["rxjs/add/operator/auditTime"],t["rxjs/add/observable/merge"],t["@angular/common"])}(this,function(t,e,n,o,i,r){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return t[o].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var o=n(1);e.PopupComponent=o.PopupComponent;var i=n(14);e.PopupModule=i.PopupModule},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(3),l=n(4),c=n(7),a=n(8),f=n(12),u=n(6),p={left:0,top:0},d=function(){function t(t,e,n,o,i,s,l){this._alignService=t,this.container=e,this._cdr=n,this._positionService=o,this._resizeService=i,this._scrollableService=s,this._renderer=l,this.animate=!0,this.anchorAlign={horizontal:"left",vertical:"bottom"},this.collision={horizontal:"fit",vertical:"flip"},this.popupAlign={horizontal:"left",vertical:"top"},this.offset=p,this.anchorViewportLeave=new r.EventEmitter,this.direction="down",this.currentOffset=p,this.resolvedPromised=Promise.resolve(null),l.setElementClass(e.nativeElement,"k-animation-container",!0),l.setElementClass(e.nativeElement,"k-animation-container-fixed",!0)}return Object.defineProperty(t.prototype,"offsetLeft",{get:function(){return this.currentOffset.left},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"offsetTop",{get:function(){return this.currentOffset.top},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this.reposition.bind(this);this._resizeService.subscribe(t),this._scrollableService.forElement(this.anchor||this.container).subscribe(this.onScroll.bind(this))},t.prototype.ngAfterViewChecked=function(){var t=this,e=this.position(),n=e.flipped,o=e.offset,i=this.getDirection(n);(this.direction!==i||u.isDifferentOffset(this.currentOffset,o))&&this.resolvedPromised.then(function(){t.currentOffset=o,t.direction=i,t._cdr.markForCheck()})},t.prototype.ngOnDestroy=function(){this._resizeService.unsubscribe(),this._scrollableService.unsubscribe()},t.prototype.reposition=function(){if(u.isDocumentAvailable()){var t=this.position(),e=t.flipped,n=t.offset;this.direction=this.getDirection(e),this.currentOffset=n}},t.prototype.position=function(){var t=this._alignService.alignElement({anchor:this.anchor,anchorAlign:this.anchorAlign,element:this.container,elementAlign:this.popupAlign,offset:this.offset});return this._positionService.positionElement({anchor:this.anchor,anchorAlign:this.anchorAlign,collisions:this.collision,currentLocation:t,element:this.container,elementAlign:this.popupAlign})},t.prototype.getDirection=function(t){return this.animate?t?"up":"down":"none"},t.prototype.onScroll=function(t){t?this.reposition():this.anchorViewportLeave.emit()},o([r.Input(),i("design:type",Boolean)],t.prototype,"animate",void 0),o([r.Input(),i("design:type",r.ElementRef)],t.prototype,"anchor",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"anchorAlign",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"collision",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"popupAlign",void 0),o([r.Input(),i("design:type",String)],t.prototype,"popupClass",void 0),o([r.Input(),i("design:type",Object)],t.prototype,"offset",void 0),o([r.Output(),i("design:type",r.EventEmitter)],t.prototype,"anchorViewportLeave",void 0),o([r.HostBinding("style.left.px"),i("design:type",Number)],t.prototype,"offsetLeft",null),o([r.HostBinding("style.top.px"),i("design:type",Number)],t.prototype,"offsetTop",null),t=o([r.Component({animations:[r.trigger("toggle",[r.transition("void => down, up => down",[r.style({transform:"translateY(-100%)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(0)"}))]),r.transition("down => void",[r.style({transform:"translateY(0)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(-100%)"}))]),r.transition("void => up, down => up",[r.style({transform:"translateY(100%)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(0)"}))]),r.transition("up => void",[r.style({transform:"translateY(0)"}),r.animate("0.2s ease-in",r.style({transform:"translateY(100%)"}))])])],exportAs:"kendo-popup",providers:[s.AlignService,l.DOMService,c.PositionService,a.ResizeService,f.ScrollableService],selector:"kendo-popup",template:'\n <div class="k-popup" [ngClass]="popupClass" [@toggle]="direction">\n <ng-content></ng-content>\n </div>\n '}),i("design:paramtypes",[s.AlignService,r.ElementRef,r.ChangeDetectorRef,c.PositionService,a.ResizeService,f.ScrollableService,r.Renderer])],t)}();e.PopupComponent=d},function(e,n){e.exports=t},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(4),l=n(6),c=function(){function t(t){this._dom=t}return t.prototype.alignElement=function(t){var e=t.anchor,n=t.element,o=t.anchorAlign,i=t.elementAlign,r=t.offset,s=l.eitherRect(this._dom.normalizedOffset(e),r),c=this._dom.normalizedOffset(n);return e||(s=this._dom.removeScroll(s,this._dom.scrollPosition(n))),this._dom.align({anchorAlign:o,anchorRect:s,elementAlign:i,elementRect:c})},t=o([r.Injectable(),i("design:paramtypes",[s.DOMService])],t)}();e.AlignService=c},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(5),l=n(6),c=function(){function t(){}return t.prototype.addOffset=function(t,e){return{left:t.left+e.left,top:t.top+e.top}},t.prototype.align=function(t){return s.align(t)},t.prototype.boundingOffset=function(t){return s.boundingOffset(this.nativeElement(t))},t.prototype.getWindow=function(){return l.isWindowAvailable()?window:null},t.prototype.isBodyOffset=function(t){return s.isBodyOffset(this.nativeElement(t))},t.prototype.offset=function(t){return t?s.offset(this.nativeElement(t)):null},t.prototype.nativeElement=function(t){return t?t.nativeElement||t:null},t.prototype.normalizedOffset=function(t){var e=this.offset(t);return e&&this.useRelativePosition(t)&&(e.left=0,e.top=0),e},t.prototype.position=function(t){return t?s.position(this.nativeElement(t)):null},t.prototype.relativeOffset=function(t,e){return s.applyLocationOffset(this.offset(t),e,this.isBodyOffset(t))},t.prototype.removeScroll=function(t,e){return s.removeScroll(t,e)},t.prototype.restrictToView=function(t){return s.restrictToView(t)},t.prototype.scrollPosition=function(t){return s.scrollPosition(this.nativeElement(t))},t.prototype.scrollableParents=function(t){return l.scrollableParents(this.nativeElement(t))},t.prototype.useRelativePosition=function(t){if(!t||!l.RELATIVE_STACKING_CONTEXT)return!1;for(var e,n=this.nativeElement(t).parentElement;n;){if(e=window.getComputedStyle(n).transform,e&&"none"!==e)return!0;n=n.parentElement}return!1},t.prototype.windowViewPort=function(t){return s.getWindowViewPort(this.nativeElement(t))},t=o([r.Injectable(),i("design:paramtypes",[])],t)}();e.DOMService=c},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={bottom:"bottom",center:"center",middle:"middle",left:"left",right:"right",top:"top"},o=function(t){var e=t.anchorRect,o=t.anchorAlign,i=t.elementRect,r=t.elementAlign,s=o.horizontal,l=o.vertical,c=r.horizontal,a=r.vertical,f=e.top,u=e.left;return l===n.bottom&&(f+=e.height),l!==n.center&&l!==n.middle||(f+=Math.round(e.height/2)),a===n.bottom&&(f-=i.height),a!==n.center&&a!==n.middle||(f-=Math.round(i.height/2)),s===n.right&&(u+=e.width),s!==n.center&&s!==n.middle||(u+=Math.round(e.width/2)),c===n.right&&(u-=i.width),c!==n.center&&c!==n.middle||(u-=Math.round(i.width/2)),{top:f,left:u}},i=function(t,e,n){var o=t.top,i=t.left;return n&&(i=0,o=0),{top:o+e.top,left:i+e.left,height:t.height,width:t.width}},r=function(t){if(!t.getBoundingClientRect)return{bottom:t.innerHeight,left:0,right:t.innerWidth,top:0};var e=t.getBoundingClientRect(),n=e.bottom,o=e.left,i=e.right,r=e.top;return{bottom:n,left:o,right:i,top:r}},s={fit:"fit",flip:"flip"},l=function(t){return t.ownerDocument.documentElement},c=function(t){for(var e=t.offsetParent;e&&"static"===e.style.position;)e=e.offsetParent;return e||l(t)},a=function(t){return c(t)===t.ownerDocument.body},f=function(t){var e=t.style,n=e.display,o=e.left,i=e.position;t.style.display="",t.style.left="-10000px",t.style.position="absolute";var r=t.getBoundingClientRect();return t.style.display=n,t.style.left=o,t.style.position=i,r},u=function(t){var e=t.getBoundingClientRect(),n=e.left,o=e.top;return e.height||e.width||(e=f(t),n=e.left,o=e.top),{top:o,left:n,height:e.height,width:e.width}},p=function(t){return t.ownerDocument.defaultView},d=function(t){var e=p(t),n=e.getComputedStyle(t),o=u(t),i=c(t),r=e.getComputedStyle(i),s={top:0,left:0};return"fixed"!==n.position&&i!==t.ownerDocument.body&&(s=u(i),s.top+=parseInt(r.borderTopWidth,10),s.left+=parseInt(r.borderLeftWidth,10)),{top:o.top-s.top-parseInt(n.marginTop,10),left:o.left-s.left-parseInt(n.marginLeft,10),height:o.height,width:o.width}},h=function(t,e){return{top:t.top-e.y,left:t.left-e.x,height:t.height,width:t.width}},m=function(t,e,n){var o=0;return t+e>n&&(o=n-(t+e)),t<0&&(o=-t),o},v=function(t){var e=t.offset,o=t.size,i=t.anchorSize,r=t.viewPortSize,s=t.anchorAlignPoint,l=t.elementAlignPoint,c=0,a=l===n.center||l===n.middle,f=s===n.center||s===n.middle;return l===s||a||f||(e+o>r&&(c+=-(i+o)),e+c<0&&(c+=i+o)),c},g=function(t){var e=t.anchorRect,n=t.anchorAlign,o=t.elementRect,i=t.elementAlign,r=t.collisions,l=t.viewPort,c=o.top,a=o.left,f=o.height,u=o.width,p=l.height,d=l.width,h=0,g=0,b=r.horizontal===s.flip,y=r.vertical===s.flip;return r.vertical===s.fit&&(g+=m(c,f,p)),r.horizontal===s.fit&&(h+=m(a,u,d)),y&&(g+=v({offset:c,size:f,anchorSize:e.height,viewPortSize:p,anchorAlignPoint:n.vertical,elementAlignPoint:i.vertical})),b&&(h+=v({offset:a,size:u,anchorSize:e.width,viewPortSize:d,anchorAlignPoint:n.horizontal,elementAlignPoint:i.horizontal})),{flipped:b&&0!==h||y&&0!==g,offset:{left:h,top:g}}},b=function(t){var e=l(t),n=p(t);return{x:n.pageXOffset||e.scrollLeft||0,y:n.pageYOffset||e.scrollTop||0}},y=function(t){var e=p(t);return{height:e.innerHeight,width:e.innerWidth}};e.align=o,e.AlignPoint=n,e.applyLocationOffset=i,e.boundingOffset=r,e.Collision=s,e.getDocumentElement=l,e.isBodyOffset=a,e.offsetParent=c,e.offset=u,e.position=d,e.removeScroll=h,e.restrictToView=g,e.scrollPosition=b,e.getWindow=p,e.getWindowViewPort=y},function(t,e){"use strict";var n=function(t,e){return t?t:{height:0,left:e.left,top:e.top,width:0}};e.eitherRect=n;var o=function(t,e){if(!e)return t;var n={height:t.height,left:e.left,top:e.top,width:t.width};return n};e.replaceOffset=o;var i=function(t,e){var n=t.left,o=t.top,i=e.left,r=e.top;return n!==i||o!==r};e.isDifferentOffset=i;var r=function(){return"undefined"!=typeof document};e.isDocumentAvailable=r;var s=function(){return"undefined"!=typeof window};e.isWindowAvailable=s;var l=function(t){return!!t.getBoundingClientRect};e.hasBoundingRect=l;var c=/auto|scroll/,a=function(t){var e=[];if(!r()||!s())return e;for(var n=t.parentElement;n;)c.test(window.getComputedStyle(n).overflow)&&e.push(n),n=n.parentElement;return e.push(window),e};e.scrollableParents=a;var f=1e3/60;e.FRAME_DURATION=f;var u=function(){if(!r())return!1;var t=10,e=document.createElement("div");e.style.transform="matrix(10, 0, 0, 10, 0, 0)",e.innerHTML='<div style="position: fixed; top: '+t+'px;">child</div>',document.body.appendChild(e);var n=e.children[0].getBoundingClientRect().top!==t;return document.body.removeChild(e),n},p=u();e.RELATIVE_STACKING_CONTEXT=p},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(4),l=n(6),c=function(){function t(t){this._dom=t}return t.prototype.positionElement=function(t){var e=t.anchor,n=t.currentLocation,o=t.element,i=t.anchorAlign,r=t.elementAlign,s=t.collisions,c=this._dom.useRelativePosition(o),a=t.viewPort||this._dom.windowViewPort(o),f=l.eitherRect(this._dom.offset(e),n),u=c?null:n,p=c?n:null,d=l.replaceOffset(this._dom.offset(o),u),h=this._dom.restrictToView({anchorAlign:i,anchorRect:f,collisions:s,elementAlign:r,elementRect:d,viewPort:a});return{flipped:h.flipped,offset:this._dom.addOffset(l.replaceOffset(d,p),h.offset)}},t=o([r.Injectable(),i("design:paramtypes",[s.DOMService])],t)}();e.PositionService=c},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(9);n(10),n(11);var l=n(6),c=n(4),a=function(){function t(t,e){this._dom=t,this._zone=e}return t.prototype.subscribe=function(t){var e=this;l.isDocumentAvailable()&&this._zone.runOutsideAngular(function(){e.subscription=s.Observable.fromEvent(e._dom.getWindow(),"resize").auditTime(l.FRAME_DURATION).subscribe(function(){return e._zone.run(function(){return t()})})})},t.prototype.unsubscribe=function(){this.subscription&&this.subscription.unsubscribe()},t.prototype.isUnsubscribed=function(){return this.subscription&&this.subscription.closed},t=o([r.Injectable(),i("design:paramtypes",[c.DOMService,r.NgZone])],t)}();e.ResizeService=a},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=o},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(9);n(10),n(13),n(11);var l=n(4),c=n(6),a=function(){function t(t,e){this._dom=t,this._zone=e}return t.prototype.forElement=function(t){return this.unsubscribe(),this.element=t,this},t.prototype.subscribe=function(t){var e=this;if(t&&c.isDocumentAvailable()&&this.element){var n=this._dom.nativeElement(this.element),o=this._dom.scrollableParents(this.element);this._zone.runOutsideAngular(function(){var i=o.map(function(t){return s.Observable.fromEvent(t,"scroll").auditTime(c.FRAME_DURATION)}),r=function(o){return e._zone.run(function(){return t(e.isVisible(n,o.target))})};e.subscription=s.Observable.merge.apply(s.Observable,i).subscribe(r)})}},t.prototype.unsubscribe=function(){this.subscription&&this.subscription.unsubscribe()},t.prototype.isVisible=function(t,e){var n=this._dom.boundingOffset(t),o=this._dom.boundingOffset(e);return!(n.bottom<o.top)&&(!(n.bottom>o.bottom)&&(!(n.right>o.right)&&!(n.left<o.left)))},t=o([r.Injectable(),i("design:paramtypes",[l.DOMService,r.NgZone])],t)}();e.ScrollableService=a},function(t,e){t.exports=i},function(t,e,n){"use strict";var o=this&&this.__decorate||function(t,e,n,o){var i,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(s=(r<3?i(s):r>3?i(e,n,s):i(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(2),s=n(15),l=n(1),c=[l.PopupComponent],a=function(){function t(){}return t=o([r.NgModule({declarations:[c],exports:[c],imports:[s.CommonModule]}),i("design:paramtypes",[])],t)}();e.PopupModule=a},function(t,e){t.exports=r}])}); |
@@ -13,3 +13,4 @@ import { Injectable } from '@angular/core'; | ||
var anchor = settings.anchor, element = settings.element, anchorAlign = settings.anchorAlign, elementAlign = settings.elementAlign, offset = settings.offset; | ||
var anchorRect = eitherRect(this._dom.offset(anchor), offset); | ||
var anchorRect = eitherRect(this._dom.normalizedOffset(anchor), offset); | ||
var elementRect = this._dom.normalizedOffset(element); | ||
if (!anchor) { | ||
@@ -22,3 +23,3 @@ anchorRect = this._dom.removeScroll(anchorRect, this._dom.scrollPosition(element)); | ||
elementAlign: elementAlign, | ||
elementRect: this._dom.offset(element) | ||
elementRect: elementRect | ||
}); | ||
@@ -25,0 +26,0 @@ }; |
@@ -15,2 +15,3 @@ import { ElementRef } from '@angular/core'; | ||
nativeElement(el: ElementRef): HTMLElement; | ||
normalizedOffset(el: ElementRef): ElementRect; | ||
position(el: ElementRef): ElementRect; | ||
@@ -22,3 +23,4 @@ relativeOffset(el: ElementRef, currentLocation: OffsetPosition): ElementRect; | ||
scrollableParents(el: ElementRef): Array<HTMLElement>; | ||
useRelativePosition(el: ElementRef): boolean; | ||
windowViewPort(el: ElementRef): ViewPort; | ||
} |
import { Injectable } from '@angular/core'; | ||
import { align, applyLocationOffset, boundingOffset, getWindowViewPort, isBodyOffset, offset, position, restrictToView, removeScroll, scrollPosition } from '@progress/kendo-popup-common'; | ||
import { isWindowAvailable, scrollableParents } from '../util'; | ||
import { isWindowAvailable, RELATIVE_STACKING_CONTEXT, scrollableParents } from '../util'; | ||
/** | ||
@@ -40,2 +40,10 @@ * @hidden | ||
}; | ||
DOMService.prototype.normalizedOffset = function (el) { | ||
var rect = this.offset(el); | ||
if (rect && this.useRelativePosition(el)) { | ||
rect.left = 0; | ||
rect.top = 0; | ||
} | ||
return rect; | ||
}; | ||
DOMService.prototype.position = function (el) { | ||
@@ -62,2 +70,17 @@ if (!el) { | ||
}; | ||
DOMService.prototype.useRelativePosition = function (el) { | ||
if (!el || !RELATIVE_STACKING_CONTEXT) { | ||
return false; | ||
} | ||
var parent = this.nativeElement(el).parentElement; | ||
var transform; | ||
while (parent) { | ||
transform = window.getComputedStyle(parent).transform; | ||
if (transform && transform !== 'none') { | ||
return true; | ||
} | ||
parent = parent.parentElement; | ||
} | ||
return false; | ||
}; | ||
DOMService.prototype.windowViewPort = function (el) { | ||
@@ -64,0 +87,0 @@ return getWindowViewPort(this.nativeElement(el)); |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"DOMService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"addOffset":[{"__symbolic":"method"}],"align":[{"__symbolic":"method"}],"boundingOffset":[{"__symbolic":"method"}],"getWindow":[{"__symbolic":"method"}],"isBodyOffset":[{"__symbolic":"method"}],"offset":[{"__symbolic":"method"}],"nativeElement":[{"__symbolic":"method"}],"position":[{"__symbolic":"method"}],"relativeOffset":[{"__symbolic":"method"}],"removeScroll":[{"__symbolic":"method"}],"restrictToView":[{"__symbolic":"method"}],"scrollPosition":[{"__symbolic":"method"}],"scrollableParents":[{"__symbolic":"method"}],"windowViewPort":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"DOMService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"addOffset":[{"__symbolic":"method"}],"align":[{"__symbolic":"method"}],"boundingOffset":[{"__symbolic":"method"}],"getWindow":[{"__symbolic":"method"}],"isBodyOffset":[{"__symbolic":"method"}],"offset":[{"__symbolic":"method"}],"nativeElement":[{"__symbolic":"method"}],"normalizedOffset":[{"__symbolic":"method"}],"position":[{"__symbolic":"method"}],"relativeOffset":[{"__symbolic":"method"}],"removeScroll":[{"__symbolic":"method"}],"restrictToView":[{"__symbolic":"method"}],"scrollPosition":[{"__symbolic":"method"}],"scrollableParents":[{"__symbolic":"method"}],"useRelativePosition":[{"__symbolic":"method"}],"windowViewPort":[{"__symbolic":"method"}]}}}} |
import { Injectable } from '@angular/core'; | ||
import { DOMService } from './dom.service'; | ||
import { eitherRect } from '../util'; | ||
import { eitherRect, replaceOffset } from '../util'; | ||
/** | ||
@@ -13,11 +13,8 @@ * @hidden | ||
var anchor = settings.anchor, currentLocation = settings.currentLocation, element = settings.element, anchorAlign = settings.anchorAlign, elementAlign = settings.elementAlign, collisions = settings.collisions; | ||
var relative = this._dom.useRelativePosition(element); | ||
var viewPort = settings.viewPort || this._dom.windowViewPort(element); | ||
var anchorRect = eitherRect(this._dom.offset(anchor), currentLocation); | ||
var tempRect = this._dom.offset(element); | ||
var elementRect = { | ||
height: tempRect.height, | ||
left: currentLocation.left, | ||
top: currentLocation.top, | ||
width: tempRect.width | ||
}; | ||
var beforeRestrictionOffset = !relative ? currentLocation : null; | ||
var afterRestrictionOffset = relative ? currentLocation : null; | ||
var elementRect = replaceOffset(this._dom.offset(element), beforeRestrictionOffset); | ||
var result = this._dom.restrictToView({ | ||
@@ -33,3 +30,3 @@ anchorAlign: anchorAlign, | ||
flipped: result.flipped, | ||
offset: this._dom.addOffset(elementRect, result.offset) | ||
offset: this._dom.addOffset(replaceOffset(elementRect, afterRestrictionOffset), result.offset) | ||
}; | ||
@@ -36,0 +33,0 @@ }; |
import { ElementRect } from '@progress/kendo-popup-common'; | ||
declare const eitherRect: (rect: ElementRect, offset: ElementRect) => ElementRect; | ||
declare const replaceOffset: (rect: ElementRect, offset: ElementRect) => ElementRect; | ||
declare const isDifferentOffset: (oldOffset: ElementRect, newOffset: ElementRect) => boolean; | ||
@@ -9,2 +10,3 @@ declare const isDocumentAvailable: () => boolean; | ||
declare const FRAME_DURATION: number; | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, scrollableParents }; | ||
declare const RELATIVE_STACKING_CONTEXT: boolean; | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, replaceOffset, RELATIVE_STACKING_CONTEXT, scrollableParents }; |
@@ -7,2 +7,14 @@ var eitherRect = function (rect, offset) { | ||
}; | ||
var replaceOffset = function (rect, offset) { | ||
if (!offset) { | ||
return rect; | ||
} | ||
var result = { | ||
height: rect.height, | ||
left: offset.left, | ||
top: offset.top, | ||
width: rect.width | ||
}; | ||
return result; | ||
}; | ||
var isDifferentOffset = function (oldOffset, newOffset) { | ||
@@ -38,2 +50,16 @@ var oldLeft = oldOffset.left, oldTop = oldOffset.top; | ||
var FRAME_DURATION = 1000 / 60; //1000ms divided by 60fps | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, scrollableParents }; | ||
var relativeStackingContext = function () { | ||
if (!isDocumentAvailable()) { | ||
return false; | ||
} | ||
var top = 10; | ||
var parent = document.createElement("div"); | ||
parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)"; | ||
parent.innerHTML = "<div style=\"position: fixed; top: " + top + "px;\">child</div>"; | ||
document.body.appendChild(parent); | ||
var isDifferent = parent.children[0].getBoundingClientRect().top !== top; | ||
document.body.removeChild(parent); | ||
return isDifferent; | ||
}; | ||
var RELATIVE_STACKING_CONTEXT = relativeStackingContext(); | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, replaceOffset, RELATIVE_STACKING_CONTEXT, scrollableParents }; |
@@ -14,3 +14,4 @@ "use strict"; | ||
var anchor = settings.anchor, element = settings.element, anchorAlign = settings.anchorAlign, elementAlign = settings.elementAlign, offset = settings.offset; | ||
var anchorRect = util_1.eitherRect(this._dom.offset(anchor), offset); | ||
var anchorRect = util_1.eitherRect(this._dom.normalizedOffset(anchor), offset); | ||
var elementRect = this._dom.normalizedOffset(element); | ||
if (!anchor) { | ||
@@ -23,3 +24,3 @@ anchorRect = this._dom.removeScroll(anchorRect, this._dom.scrollPosition(element)); | ||
elementAlign: elementAlign, | ||
elementRect: this._dom.offset(element) | ||
elementRect: elementRect | ||
}); | ||
@@ -26,0 +27,0 @@ }; |
@@ -15,2 +15,3 @@ import { ElementRef } from '@angular/core'; | ||
nativeElement(el: ElementRef): HTMLElement; | ||
normalizedOffset(el: ElementRef): ElementRect; | ||
position(el: ElementRef): ElementRect; | ||
@@ -22,3 +23,4 @@ relativeOffset(el: ElementRef, currentLocation: OffsetPosition): ElementRect; | ||
scrollableParents(el: ElementRef): Array<HTMLElement>; | ||
useRelativePosition(el: ElementRef): boolean; | ||
windowViewPort(el: ElementRef): ViewPort; | ||
} |
@@ -41,2 +41,10 @@ "use strict"; | ||
}; | ||
DOMService.prototype.normalizedOffset = function (el) { | ||
var rect = this.offset(el); | ||
if (rect && this.useRelativePosition(el)) { | ||
rect.left = 0; | ||
rect.top = 0; | ||
} | ||
return rect; | ||
}; | ||
DOMService.prototype.position = function (el) { | ||
@@ -63,2 +71,17 @@ if (!el) { | ||
}; | ||
DOMService.prototype.useRelativePosition = function (el) { | ||
if (!el || !util_1.RELATIVE_STACKING_CONTEXT) { | ||
return false; | ||
} | ||
var parent = this.nativeElement(el).parentElement; | ||
var transform; | ||
while (parent) { | ||
transform = window.getComputedStyle(parent).transform; | ||
if (transform && transform !== 'none') { | ||
return true; | ||
} | ||
parent = parent.parentElement; | ||
} | ||
return false; | ||
}; | ||
DOMService.prototype.windowViewPort = function (el) { | ||
@@ -65,0 +88,0 @@ return kendo_popup_common_1.getWindowViewPort(this.nativeElement(el)); |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"DOMService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"addOffset":[{"__symbolic":"method"}],"align":[{"__symbolic":"method"}],"boundingOffset":[{"__symbolic":"method"}],"getWindow":[{"__symbolic":"method"}],"isBodyOffset":[{"__symbolic":"method"}],"offset":[{"__symbolic":"method"}],"nativeElement":[{"__symbolic":"method"}],"position":[{"__symbolic":"method"}],"relativeOffset":[{"__symbolic":"method"}],"removeScroll":[{"__symbolic":"method"}],"restrictToView":[{"__symbolic":"method"}],"scrollPosition":[{"__symbolic":"method"}],"scrollableParents":[{"__symbolic":"method"}],"windowViewPort":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"DOMService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"addOffset":[{"__symbolic":"method"}],"align":[{"__symbolic":"method"}],"boundingOffset":[{"__symbolic":"method"}],"getWindow":[{"__symbolic":"method"}],"isBodyOffset":[{"__symbolic":"method"}],"offset":[{"__symbolic":"method"}],"nativeElement":[{"__symbolic":"method"}],"normalizedOffset":[{"__symbolic":"method"}],"position":[{"__symbolic":"method"}],"relativeOffset":[{"__symbolic":"method"}],"removeScroll":[{"__symbolic":"method"}],"restrictToView":[{"__symbolic":"method"}],"scrollPosition":[{"__symbolic":"method"}],"scrollableParents":[{"__symbolic":"method"}],"useRelativePosition":[{"__symbolic":"method"}],"windowViewPort":[{"__symbolic":"method"}]}}}} |
@@ -14,11 +14,8 @@ "use strict"; | ||
var anchor = settings.anchor, currentLocation = settings.currentLocation, element = settings.element, anchorAlign = settings.anchorAlign, elementAlign = settings.elementAlign, collisions = settings.collisions; | ||
var relative = this._dom.useRelativePosition(element); | ||
var viewPort = settings.viewPort || this._dom.windowViewPort(element); | ||
var anchorRect = util_1.eitherRect(this._dom.offset(anchor), currentLocation); | ||
var tempRect = this._dom.offset(element); | ||
var elementRect = { | ||
height: tempRect.height, | ||
left: currentLocation.left, | ||
top: currentLocation.top, | ||
width: tempRect.width | ||
}; | ||
var beforeRestrictionOffset = !relative ? currentLocation : null; | ||
var afterRestrictionOffset = relative ? currentLocation : null; | ||
var elementRect = util_1.replaceOffset(this._dom.offset(element), beforeRestrictionOffset); | ||
var result = this._dom.restrictToView({ | ||
@@ -34,3 +31,3 @@ anchorAlign: anchorAlign, | ||
flipped: result.flipped, | ||
offset: this._dom.addOffset(elementRect, result.offset) | ||
offset: this._dom.addOffset(util_1.replaceOffset(elementRect, afterRestrictionOffset), result.offset) | ||
}; | ||
@@ -37,0 +34,0 @@ }; |
import { ElementRect } from '@progress/kendo-popup-common'; | ||
declare const eitherRect: (rect: ElementRect, offset: ElementRect) => ElementRect; | ||
declare const replaceOffset: (rect: ElementRect, offset: ElementRect) => ElementRect; | ||
declare const isDifferentOffset: (oldOffset: ElementRect, newOffset: ElementRect) => boolean; | ||
@@ -9,2 +10,3 @@ declare const isDocumentAvailable: () => boolean; | ||
declare const FRAME_DURATION: number; | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, scrollableParents }; | ||
declare const RELATIVE_STACKING_CONTEXT: boolean; | ||
export { eitherRect, FRAME_DURATION, hasBoundingRect, isDifferentOffset, isDocumentAvailable, isWindowAvailable, replaceOffset, RELATIVE_STACKING_CONTEXT, scrollableParents }; |
@@ -9,2 +9,15 @@ "use strict"; | ||
exports.eitherRect = eitherRect; | ||
var replaceOffset = function (rect, offset) { | ||
if (!offset) { | ||
return rect; | ||
} | ||
var result = { | ||
height: rect.height, | ||
left: offset.left, | ||
top: offset.top, | ||
width: rect.width | ||
}; | ||
return result; | ||
}; | ||
exports.replaceOffset = replaceOffset; | ||
var isDifferentOffset = function (oldOffset, newOffset) { | ||
@@ -46,1 +59,16 @@ var oldLeft = oldOffset.left, oldTop = oldOffset.top; | ||
exports.FRAME_DURATION = FRAME_DURATION; //1000ms divided by 60fps | ||
var relativeStackingContext = function () { | ||
if (!isDocumentAvailable()) { | ||
return false; | ||
} | ||
var top = 10; | ||
var parent = document.createElement("div"); | ||
parent.style.transform = "matrix(10, 0, 0, 10, 0, 0)"; | ||
parent.innerHTML = "<div style=\"position: fixed; top: " + top + "px;\">child</div>"; | ||
document.body.appendChild(parent); | ||
var isDifferent = parent.children[0].getBoundingClientRect().top !== top; | ||
document.body.removeChild(parent); | ||
return isDifferent; | ||
}; | ||
var RELATIVE_STACKING_CONTEXT = relativeStackingContext(); | ||
exports.RELATIVE_STACKING_CONTEXT = RELATIVE_STACKING_CONTEXT; |
{ | ||
"name": "@progress/kendo-angular-popup", | ||
"description": "Kendo UI Angular 2 Popup component", | ||
"version": "0.14.2", | ||
"version": "0.14.3", | ||
"publishConfig": { | ||
@@ -6,0 +6,0 @@ "registry": "https://registry.npm.telerik.com" |
125437
1898