@progress/kendo-angular-utils 0.1.0 → 0.1.1-dev.202208160834
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-utils.umd.js +1 -1
- package/drag-and-drop/drag-state.service.d.ts +1 -1
- package/drag-and-drop/dragtarget.directive.d.ts +4 -0
- package/drag-and-drop/events/drag-target/drag-event.d.ts +6 -2
- package/drag-and-drop/events/drag-target/end-event.d.ts +3 -4
- package/drag-and-drop/events/drag-target/press-event.d.ts +2 -2
- package/drag-and-drop/events/drag-target/release-event.d.ts +2 -2
- package/drag-and-drop/events/drag-target/start-event.d.ts +2 -2
- package/drag-and-drop/events/drop-target/drop-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/enter-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/leave-event.d.ts +3 -4
- package/drag-and-drop/events/drop-target/over-event.d.ts +3 -4
- package/drag-and-drop/models/coordinates.d.ts +11 -0
- package/drag-and-drop/models/index.d.ts +1 -0
- package/drag-and-drop/util.d.ts +0 -7
- package/esm2015/drag-and-drop/dragtarget.directive.js +39 -14
- package/esm2015/drag-and-drop/events/drag-target/end-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/drop-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/enter-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/leave-event.js +1 -3
- package/esm2015/drag-and-drop/events/drop-target/over-event.js +1 -3
- package/esm2015/drag-and-drop/models/coordinates.js +5 -0
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-utils.js +45 -25
- package/main.d.ts +1 -1
- package/package.json +2 -2
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@progress/kendo-licensing"),require("@progress/kendo-draggable-common"),require("@progress/kendo-angular-common")):"function"==typeof define&&define.amd?define("KendoAngularUtils",["exports","@angular/core","@angular/common","@progress/kendo-licensing","@progress/kendo-draggable-common","@progress/kendo-angular-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoAngularUtils={},t.ng.core,t.ng.common,t.KendoLicensing,t.KendoDraggableCommon,t.KendoAngularCommon)}(this,function(t,s,e,a,r,n){"use strict";function i(n){if(n&&n.__esModule)return n;var r=Object.create(null);return n&&Object.keys(n).forEach(function(t){var e;"default"!==t&&(e=Object.getOwnPropertyDescriptor(n,t),Object.defineProperty(r,t,e.get?e:{enumerable:!0,get:function(){return n[t]}}))}),r.default=n,Object.freeze(r)}var o=i(s),l=i(e),c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}Object.create;function g(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function p(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}Object.create;var d,u={name:"@progress/kendo-angular-utils",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1658922268,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},m=function(t){this.element=t,this.hostClass=!0},f=(m.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:m,deps:[{token:o.ElementRef}],target:o.ɵɵFactoryTarget.Directive}),m.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:m,selector:"[kendoDragHandle]",host:{properties:{"class.k-cursor-pointer":"this.hostClass"}},exportAs:["kendoDragHandle"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:m,decorators:[{type:s.Directive,args:[{selector:"[kendoDragHandle]",exportAs:"kendoDragHandle"}]}],ctorParameters:function(){return[{type:o.ElementRef}]},propDecorators:{hostClass:[{type:s.HostBinding,args:["class.k-cursor-pointer"]}]}}),function(t){Object.assign(this,t)}),v=(h(y,d=n.PreventableEvent),y);function y(t){var e=d.call(this)||this;return Object.assign(e,t),e}var D,b=function(t){Object.assign(this,t)},E=(h(O,D=n.PreventableEvent),O);function O(t){var e=D.call(this)||this;return Object.assign(e,t),e}h(I,T=n.PreventableEvent);var T,S=I;function I(t){var e=T.call(this)||this;return Object.assign(e,t),e}function P(t,e){return{event:t,payload:e}}function R(e,n,r){Object.keys(r).forEach(function(t){e.setStyle(n,t,r[t])})}function C(t){return null!=t}var k=function(t){this.element=t,this.hostClasses=!0,this.zIndex=10,this.touchAction="none"},w=(k.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:k,deps:[{token:o.ElementRef}],target:o.ɵɵFactoryTarget.Component}),k.ɵcmp=o.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:k,selector:"ng-component",inputs:{template:"template",directive:"directive"},host:{properties:{"class.k-pos-absolute":"this.hostClasses","class.k-cursor-grab":"this.hostClasses","style.zIndex":"this.zIndex","style.touch-action":"this.touchAction"}},ngImport:o,template:'\n <ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">\n </ng-container>\n ',isInline:!0,directives:[{type:l.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]}]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:k,decorators:[{type:s.Component,args:[{template:'\n <ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">\n </ng-container>\n '}]}],ctorParameters:function(){return[{type:o.ElementRef}]},propDecorators:{template:[{type:s.Input}],directive:[{type:s.Input}],hostClasses:[{type:s.HostBinding,args:["class.k-pos-absolute"]},{type:s.HostBinding,args:["class.k-cursor-grab"]}],zIndex:[{type:s.HostBinding,args:["style.zIndex"]}],touchAction:[{type:s.HostBinding,args:["style.touch-action"]}]}}),x.prototype.handleDragAndDrop=function(t){this.updateState(),r.dispatchDragAndDrop(this.state,t,this.callbacks)},x.prototype.setPressed=function(t){this.pressed=t},x.prototype.setScrolling=function(t){var e,n=this;(this.isScrolling=t)?(e=r.getScrollableParent(document.elementFromPoint(this.clientOffset.x,this.clientOffset.y)),window.clearInterval(this.scrollInterval),this.scrollInterval=window.setInterval(function(){r.autoScroll(e,{x:n.velocity.x,y:n.velocity.y})},50)):this.scrollInterval&&(window.clearInterval(this.scrollInterval),this.scrollInterval=null)},x.prototype.setVelocity=function(t){this.velocity=t},x.prototype.setOffset=function(t){this.offset=t},x.prototype.setClientOffset=function(t){this.clientOffset=t},x.prototype.setPageOffset=function(t){this.pageOffset=t},x.prototype.setInitialClientOffset=function(t){this.initialClientOffset=t},x.prototype.setScrollOffset=function(t){this.scrollOffset=t},x.prototype.setInitialScrollOffset=function(t){this.initialScrollOffset=t},x.prototype.updateState=function(){this.state={drag:this.dragTarget,drop:this.dropTarget,drags:this.dragTargets,drops:this.dropTargets,pressed:this.pressed,ignoreMouse:this.ignoreMouse,autoScroll:this.autoScroll,isScrolling:this.isScrolling,scrollableParent:this.scrollableParent,autoScrollDirection:this.autoScrollDirection,initialClientOffset:this.initialClientOffset,clientOffset:this.clientOffset,initialScrollOffset:this.initialScrollOffset,scrollOffset:this.scrollOffset,offset:this.offset,pageOffset:this.pageOffset,velocity:this.velocity}},x.prototype.setCallbacks=function(){this.callbacks={onVelocityChange:this.setVelocity.bind(this),onOffsetChange:this.setOffset.bind(this),onClientOffsetChange:this.setClientOffset.bind(this),onPageOffsetChange:this.setPageOffset.bind(this),onInitialClientOffsetChange:this.setInitialClientOffset.bind(this),onScrollOffsetChange:this.setScrollOffset.bind(this),onInitialScrollOffsetChange:this.setInitialScrollOffset.bind(this),onIsPressedChange:this.setPressed.bind(this),onIsScrollingChange:this.setScrolling.bind(this)}},x.prototype.ngOnDestroy=function(){this.scrollInterval&&(window.clearInterval(this.scrollInterval),this.scrollInterval=null)},x);function x(){this.dragTarget=null,this.dropTarget=null,this.dragTargets=[],this.dropTargets=[],this.pressed=!1,this.ignoreMouse=!1,this.autoScroll=!0,this.isScrolling=!1,this.scrollableParent=null,this.autoScrollDirection={horizontal:!0,vertical:!0},this.initialClientOffset={x:0,y:0},this.clientOffset={x:0,y:0},this.initialScrollOffset={x:0,y:0},this.scrollOffset={x:0,y:0},this.offset={x:0,y:0},this.pageOffset={x:0,y:0},this.velocity={x:0,y:0},this.callbacks={},this.scrollInterval=null,this.setCallbacks()}w.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:w,deps:[],target:o.ɵɵFactoryTarget.Injectable}),w.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:w,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:w,decorators:[{type:s.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[]}});Object.defineProperty(A.prototype,"nativeElement",{get:function(){return this.element.nativeElement},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hintElem",{get:function(){return this.hint.instance.element.nativeElement},enumerable:!1,configurable:!0}),A.prototype.onPointerDown=function(t){var e=this;this.dragHandles.length&&!this.isDragHandle(t.target)||(t.preventDefault(),t=P(t,this.dragTarget),this.service.handleDragAndDrop(t),this.service.autoScroll="object"==typeof this.autoScroll?!1!==this.autoScroll.enabled:this.autoScroll,this.service.scrollableParent=this.getAutoScrollContainer(),this.service.autoScrollDirection="object"==typeof this.autoScroll?this.autoScroll.direction:{horizontal:!0,vertical:!0},this.ngZone.runOutsideAngular(function(){e.attachDomHandlers()}))},A.prototype.onPointerMove=function(t){t.preventDefault();t=P(t,this.dragTarget);this.service.handleDragAndDrop(t)},A.prototype.onPointerUp=function(t){var e=this,t=(t.preventDefault(),P(t,this.dragTarget));this.service.handleDragAndDrop(t),this.ngZone.runOutsideAngular(function(){e.attachDomHandlers()})},A.prototype.ngOnInit=function(){this.initializeDraggable()},A.prototype.ngAfterContentInit=function(){var t=this;(C(this.element)||C(this.dragTarget))&&this.ngZone.runOutsideAngular(function(){t.attachDomHandlers(),t.dragHandles.length||t.renderer.addClass(t.nativeElement,"k-cursor-pointer")}),this.service.dragTargets.push(this.dragTarget)},A.prototype.ngOnDestroy=function(){this.domSubscriptions.forEach(function(t){return t()})},A.prototype.handlePress=function(e){var n=this;0<this.dragDelay?this.dragTimeout=setTimeout(function(){n.pressed=!0},this.dragDelay):this.pressed=!0,this.ngZone.run(function(){var t=new f({event:e,element:n.nativeElement});n.press.emit(t)})},A.prototype.handleDragStart=function(e){var n=this;this.pressed?(C(this.hintTemplate)&&(this.createHint(),C(this.hint)&&this.renderer.setStyle(this.nativeElement,"opacity","0.7")),this.dragStarted=0===this.threshold,this.service.dragTarget=this.dragTarget,(this.service.dragTargetDirective=this).initialPosition={x:e.clientX,y:e.clientY},this.ngZone.run(function(){var t=new v({event:e,element:n.nativeElement});n.dragStart.emit(t)})):this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null)},A.prototype.handleDrag=function(e){var t,n,r,i=this;this.pressed&&(t=this.hint?this.hintElem:this.nativeElement,n={x:0,y:0},n="horizontal"===this.restrictByAxis?{x:e.clientX-this.initialPosition.x+e.scrollX,y:0}:"vertical"===this.restrictByAxis?{x:0,y:e.clientY-this.initialPosition.y+e.scrollY}:{x:e.clientX-this.initialPosition.x+e.scrollX,y:e.clientY-this.initialPosition.y+e.scrollY},r=Math.abs(n.x)<this.threshold&&Math.abs(n.y)<this.threshold,!this.dragStarted&&r||(r="translate("+n.x+"px, "+n.y+"px)",R(this.renderer,t,{transform:r,transition:"none"}),!this.dragStarted&&0<this.threshold&&(this.dragStarted=!0),this.ngZone.run(function(){var t=new S({event:e,element:i.nativeElement});i.drag.emit(t)})))},A.prototype.handleRelease=function(e){var n=this;this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null,this.pressed=!1),this.service.dragTarget=null,this.service.dragTargetDirective=null,this.ngZone.run(function(){var t=new b({event:e,element:n.nativeElement});n.release.emit(t)})},A.prototype.handleDragEnd=function(e){var t,n=this;this.dragStarted&&(this.dragStarted=!1,t=this.hint?this.hintElem:this.nativeElement,C(this.hint)&&(this.renderer.removeStyle(this.nativeElement,"opacity"),this.destroyHint()),this.renderer.removeStyle(t,"transform"),R(this.renderer,t,{transition:"transform .3s ease-in-out"}),this.ngZone.run(function(){var t=new E({event:e,element:n.nativeElement});n.dragEnd.emit(t)}))},A.prototype.initializeDraggable=function(){this.dragTarget={element:this.nativeElement,hint:null,onPress:this.handlePress.bind(this),onRelease:this.handleRelease.bind(this),onDragStart:this.handleDragStart.bind(this),onDrag:this.handleDrag.bind(this),onDragEnd:this.handleDragEnd.bind(this)}},A.prototype.attachDomHandlers=function(){var t;0<this.domSubscriptions.length&&this.domSubscriptions.forEach(function(t){return t()}),n.isDocumentAvailable()&&C(this.element)&&(this.service.pressed?(this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),t=r.getScrollableParent(this.nativeElement),this.domSubscriptions=[this.renderer.listen(document,"pointermove",this.onPointerMove),this.renderer.listen(document,"mousemove",this.onPointerMove),this.renderer.listen(document,"touchmove",this.onPointerMove),this.renderer.listen(document,"pointerup",this.onPointerUp),this.renderer.listen(document,"pointercancel",this.onPointerUp),this.renderer.listen(document,"mouseup",this.onPointerUp),this.renderer.listen(document,"contextmenu",this.onPointerUp),this.renderer.listen(document,"touchend",this.onPointerUp),this.renderer.listen(document,"touchcancel",this.onPointerUp)],t&&(t===document.getElementsByTagName("html")[0]&&(t=document),this.domSubscriptions.push(this.renderer.listen(t,"scroll",this.onPointerMove)))):(this.onPointerDown=this.onPointerDown.bind(this),t=this.nativeElement,this.domSubscriptions=[this.renderer.listen(t,"pointerdown",this.onPointerDown),this.renderer.listen(t,"mousedown",this.onPointerDown),this.renderer.listen(t,"touchstart",this.onPointerDown)]))},A.prototype.isDragHandle=function(e){return this.dragHandles.toArray().some(function(t){return n.contains(t.element.nativeElement,e,!0)})},A.prototype.getAutoScrollContainer=function(){return"object"==typeof this.autoScroll&&this.autoScroll.boundaryElementRef&&this.autoScroll.boundaryElementRef.nativeElement?this.autoScroll.boundaryElementRef.nativeElement:null},A.prototype.createHint=function(){var t=this.resolver.resolveComponentFactory(k);this.hint=this.viewContainer.createComponent(t),this.hint.instance.template=this.hintTemplate,(this.hint.instance.directive=this).hint.changeDetectorRef.detectChanges(),this.dragTarget.hint=this.hint.instance.element.nativeElement},A.prototype.destroyHint=function(){this.hint.destroy(),this.hint.changeDetectorRef.detectChanges(),this.hint=null,this.dragTarget.hint=null};l=A;function A(t,e,n,r,i,o){this.element=t,this.renderer=e,this.ngZone=n,this.service=r,this.viewContainer=i,this.resolver=o,this.threshold=0,this.autoScroll=!0,this.dragDelay=0,this.press=new s.EventEmitter,this.dragStart=new s.EventEmitter,this.drag=new s.EventEmitter,this.release=new s.EventEmitter,this.dragEnd=new s.EventEmitter,this.touchAction="none",this.dragTarget=null,this.domSubscriptions=[],this.hint=null,this.initialPosition={x:0,y:0},this.dragStarted=!1,this.pressed=!1,this.dragTimeout=null,a.validatePackage(u)}l.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:l,deps:[{token:o.ElementRef},{token:o.Renderer2},{token:o.NgZone},{token:w},{token:o.ViewContainerRef},{token:o.ComponentFactoryResolver}],target:o.ɵɵFactoryTarget.Directive}),l.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:l,selector:"[kendoDragTarget]",inputs:{hintTemplate:"hintTemplate",threshold:"threshold",autoScroll:"autoScroll",link:"link",dragDelay:"dragDelay",restrictByAxis:"restrictByAxis"},outputs:{press:"press",dragStart:"dragStart",drag:"drag",release:"release",dragEnd:"dragEnd"},host:{properties:{"style.touch-action":"this.touchAction"}},queries:[{propertyName:"dragHandles",predicate:m}],exportAs:["kendoDragTarget"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:l,decorators:[{type:s.Directive,args:[{selector:"[kendoDragTarget]",exportAs:"kendoDragTarget"}]}],ctorParameters:function(){return[{type:o.ElementRef},{type:o.Renderer2},{type:o.NgZone},{type:w},{type:o.ViewContainerRef},{type:o.ComponentFactoryResolver}]},propDecorators:{hintTemplate:[{type:s.Input}],threshold:[{type:s.Input}],autoScroll:[{type:s.Input}],link:[{type:s.Input}],dragDelay:[{type:s.Input}],restrictByAxis:[{type:s.Input}],press:[{type:s.Output}],dragStart:[{type:s.Output}],drag:[{type:s.Output}],release:[{type:s.Output}],dragEnd:[{type:s.Output}],touchAction:[{type:s.HostBinding,args:["style.touch-action"]}],dragHandles:[{type:s.ContentChildren,args:[m]}]}});h(N,F=n.PreventableEvent);var F,Z=N;function N(t){var e=F.call(this)||this;return Object.assign(e,t),e}h(z,U=n.PreventableEvent);var U,_=z;function z(t){var e=U.call(this)||this;return Object.assign(e,t),e}h(K,B=n.PreventableEvent);var B,L=K;function K(t){var e=B.call(this)||this;return Object.assign(e,t),e}h(Y,q=n.PreventableEvent);var q,X=Y;function Y(t){var e=q.call(this)||this;return Object.assign(e,t),e}M.prototype.ngOnInit=function(){this.initializeDropTarget(),this.service.dropTargets.push(this.dropTarget)},M.prototype.handleDragEnter=function(e){var n=this,t=!0;if(C(this.allowedDragTargets))switch(typeof this.allowedDragTargets){case"function":t=this.allowedDragTargets(this.service.dragTargetDirective);break;case"string":t=this.service.dragTargetDirective.link===this.allowedDragTargets;break;default:t=this.allowedDragTargets.some(function(t){return t===n.service.dragTargetDirective.link})}t&&(this.service.dropTarget=this.dropTarget,this.ngZone.run(function(){var t=new Z({event:e,element:n.element.nativeElement});n.dragEnter.emit(t)}))},M.prototype.handleDragLeave=function(e){var n=this;this.service.dropTarget=null,this.ngZone.run(function(){var t=new L({event:e,element:n.element.nativeElement});n.dragLeave.emit(t)})},M.prototype.handleDragOver=function(e){var n=this;this.ngZone.run(function(){var t=new _({event:e,element:n.element.nativeElement});n.dragOver.emit(t)})},M.prototype.handleDrop=function(e){var n=this;this.ngZone.run(function(){var t=new X({event:e,element:n.element.nativeElement});n.drop.emit(t)}),this.service.setScrollOffset({x:0,y:0})},M.prototype.initializeDropTarget=function(){this.dropTarget={element:this.element.nativeElement,onDragEnter:this.handleDragEnter.bind(this),onDragLeave:this.handleDragLeave.bind(this),onDragOver:this.handleDragOver.bind(this),onDrop:this.handleDrop.bind(this)}};var j=M;function M(t,e,n){this.service=t,this.element=e,this.ngZone=n,this.dragEnter=new s.EventEmitter,this.dragOver=new s.EventEmitter,this.dragLeave=new s.EventEmitter,this.drop=new s.EventEmitter,a.validatePackage(u)}j.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:j,deps:[{token:w},{token:o.ElementRef},{token:o.NgZone}],target:o.ɵɵFactoryTarget.Directive}),j.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:j,selector:"[kendoDropTarget]",inputs:{allowedDragTargets:"allowedDragTargets"},outputs:{dragEnter:"dragEnter",dragOver:"dragOver",dragLeave:"dragLeave",drop:"drop"},exportAs:["kendoDropTarget"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:j,decorators:[{type:s.Directive,args:[{selector:"[kendoDropTarget]",exportAs:"kendoDropTarget"}]}],ctorParameters:function(){return[{type:w},{type:o.ElementRef},{type:o.NgZone}]},propDecorators:{allowedDragTargets:[{type:s.Input}],dragEnter:[{type:s.Output}],dragOver:[{type:s.Output}],dragLeave:[{type:s.Output}],drop:[{type:s.Output}]}});var V=[l,m,j,k],H=function(){},V=(H.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,deps:[],target:o.ɵɵFactoryTarget.NgModule}),H.ɵmod=o.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,declarations:[l,m,j,k],imports:[e.CommonModule],exports:[l,m,j,k]}),H.ɵinj=o.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,imports:[[e.CommonModule]]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,decorators:[{type:s.NgModule,args:[{declarations:p([],g(V)),exports:p([],g(V)),imports:[e.CommonModule]}]}]}),function(){});V.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,deps:[],target:o.ɵɵFactoryTarget.NgModule}),V.ɵmod=o.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,exports:[H]}),V.ɵinj=o.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,imports:[H]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,decorators:[{type:s.NgModule,args:[{exports:[H]}]}]}),t.DragAndDropModule=H,t.DragEndEvent=E,t.DragEnterEvent=Z,t.DragEvent=S,t.DragHandleDirective=m,t.DragLeaveEvent=L,t.DragOverEvent=_,t.DragStartEvent=v,t.DragTargetDirective=l,t.DropEvent=X,t.DropTargetDirective=j,t.HintComponent=k,t.PressEvent=f,t.ReleaseEvent=b,t.UtilsModule=V,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
5
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@progress/kendo-licensing"),require("@progress/kendo-draggable-common"),require("@progress/kendo-angular-common")):"function"==typeof define&&define.amd?define("KendoAngularUtils",["exports","@angular/core","@angular/common","@progress/kendo-licensing","@progress/kendo-draggable-common","@progress/kendo-angular-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoAngularUtils={},t.ng.core,t.ng.common,t.KendoLicensing,t.KendoDraggableCommon,t.KendoAngularCommon)}(this,function(t,s,e,a,r,n){"use strict";function i(n){if(n&&n.__esModule)return n;var r=Object.create(null);return n&&Object.keys(n).forEach(function(t){var e;"default"!==t&&(e=Object.getOwnPropertyDescriptor(n,t),Object.defineProperty(r,t,e.get?e:{enumerable:!0,get:function(){return n[t]}}))}),r.default=n,Object.freeze(r)}var o=i(s),l=i(e),c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}Object.create;function g(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function p(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||((r=r||Array.prototype.slice.call(e,0,i))[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}Object.create;var d,u={name:"@progress/kendo-angular-utils",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1660638843,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},m=function(t){this.element=t,this.hostClass=!0},f=(m.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:m,deps:[{token:o.ElementRef}],target:o.ɵɵFactoryTarget.Directive}),m.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:m,selector:"[kendoDragHandle]",host:{properties:{"class.k-cursor-pointer":"this.hostClass"}},exportAs:["kendoDragHandle"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:m,decorators:[{type:s.Directive,args:[{selector:"[kendoDragHandle]",exportAs:"kendoDragHandle"}]}],ctorParameters:function(){return[{type:o.ElementRef}]},propDecorators:{hostClass:[{type:s.HostBinding,args:["class.k-cursor-pointer"]}]}}),function(t){Object.assign(this,t)}),v=(h(y,d=n.PreventableEvent),y);function y(t){var e=d.call(this)||this;return Object.assign(e,t),e}var D,E=function(t){Object.assign(this,t)},O=function(t){Object.assign(this,t)},b=(h(T,D=n.PreventableEvent),T);function T(t){var e=D.call(this)||this;return Object.assign(e,t),e}function S(t,e){return{event:t,payload:e}}function I(e,n,r){Object.keys(r).forEach(function(t){e.setStyle(n,t,r[t])})}function C(t){return null!=t}var P=function(t){this.element=t,this.hostClasses=!0,this.zIndex=10,this.touchAction="none"},k=(P.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:P,deps:[{token:o.ElementRef}],target:o.ɵɵFactoryTarget.Component}),P.ɵcmp=o.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:P,selector:"ng-component",inputs:{template:"template",directive:"directive"},host:{properties:{"class.k-pos-absolute":"this.hostClasses","class.k-cursor-grab":"this.hostClasses","style.zIndex":"this.zIndex","style.touch-action":"this.touchAction"}},ngImport:o,template:'\n <ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">\n </ng-container>\n ',isInline:!0,directives:[{type:l.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]}]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:P,decorators:[{type:s.Component,args:[{template:'\n <ng-container *ngTemplateOutlet="template; context: { $implicit: directive }">\n </ng-container>\n '}]}],ctorParameters:function(){return[{type:o.ElementRef}]},propDecorators:{template:[{type:s.Input}],directive:[{type:s.Input}],hostClasses:[{type:s.HostBinding,args:["class.k-pos-absolute"]},{type:s.HostBinding,args:["class.k-cursor-grab"]}],zIndex:[{type:s.HostBinding,args:["style.zIndex"]}],touchAction:[{type:s.HostBinding,args:["style.touch-action"]}]}}),w.prototype.handleDragAndDrop=function(t){this.updateState(),r.dispatchDragAndDrop(this.state,t,this.callbacks)},w.prototype.setPressed=function(t){this.pressed=t},w.prototype.setScrolling=function(t){var e,n=this;(this.isScrolling=t)?(e=r.getScrollableParent(document.elementFromPoint(this.clientOffset.x,this.clientOffset.y)),window.clearInterval(this.scrollInterval),this.scrollInterval=window.setInterval(function(){r.autoScroll(e,{x:n.velocity.x,y:n.velocity.y})},50)):this.scrollInterval&&(window.clearInterval(this.scrollInterval),this.scrollInterval=null)},w.prototype.setVelocity=function(t){this.velocity=t},w.prototype.setOffset=function(t){this.offset=t},w.prototype.setClientOffset=function(t){this.clientOffset=t},w.prototype.setPageOffset=function(t){this.pageOffset=t},w.prototype.setInitialClientOffset=function(t){this.initialClientOffset=t},w.prototype.setScrollOffset=function(t){this.scrollOffset=t},w.prototype.setInitialScrollOffset=function(t){this.initialScrollOffset=t},w.prototype.updateState=function(){this.state={drag:this.dragTarget,drop:this.dropTarget,drags:this.dragTargets,drops:this.dropTargets,pressed:this.pressed,ignoreMouse:this.ignoreMouse,autoScroll:this.autoScroll,isScrolling:this.isScrolling,scrollableParent:this.scrollableParent,autoScrollDirection:this.autoScrollDirection,initialClientOffset:this.initialClientOffset,clientOffset:this.clientOffset,initialScrollOffset:this.initialScrollOffset,scrollOffset:this.scrollOffset,offset:this.offset,pageOffset:this.pageOffset,velocity:this.velocity}},w.prototype.setCallbacks=function(){this.callbacks={onVelocityChange:this.setVelocity.bind(this),onOffsetChange:this.setOffset.bind(this),onClientOffsetChange:this.setClientOffset.bind(this),onPageOffsetChange:this.setPageOffset.bind(this),onInitialClientOffsetChange:this.setInitialClientOffset.bind(this),onScrollOffsetChange:this.setScrollOffset.bind(this),onInitialScrollOffsetChange:this.setInitialScrollOffset.bind(this),onIsPressedChange:this.setPressed.bind(this),onIsScrollingChange:this.setScrolling.bind(this)}},w.prototype.ngOnDestroy=function(){this.scrollInterval&&(window.clearInterval(this.scrollInterval),this.scrollInterval=null)},w);function w(){this.dragTarget=null,this.dropTarget=null,this.dragTargets=[],this.dropTargets=[],this.pressed=!1,this.ignoreMouse=!1,this.autoScroll=!0,this.isScrolling=!1,this.scrollableParent=null,this.autoScrollDirection={horizontal:!0,vertical:!0},this.initialClientOffset={x:0,y:0},this.clientOffset={x:0,y:0},this.initialScrollOffset={x:0,y:0},this.scrollOffset={x:0,y:0},this.offset={x:0,y:0},this.pageOffset={x:0,y:0},this.velocity={x:0,y:0},this.callbacks={},this.scrollInterval=null,this.setCallbacks()}k.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:k,deps:[],target:o.ɵɵFactoryTarget.Injectable}),k.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:k,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:k,decorators:[{type:s.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[]}});var x=!1,R=!1,l=(Object.defineProperty(A.prototype,"nativeElement",{get:function(){return this.element.nativeElement},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"hintElem",{get:function(){return this.hint.instance.element.nativeElement},enumerable:!1,configurable:!0}),A.prototype.onPointerDown=function(t){var e=this;this.dragHandles.length&&!this.isDragHandle(t.target)||(t.preventDefault(),t=S(t,this.dragTarget),this.service.handleDragAndDrop(t),this.service.autoScroll="object"==typeof this.autoScroll?!1!==this.autoScroll.enabled:this.autoScroll,this.service.scrollableParent=this.getAutoScrollContainer(),this.service.autoScrollDirection="object"==typeof this.autoScroll?this.autoScroll.direction:{horizontal:!0,vertical:!0},this.ngZone.runOutsideAngular(function(){e.attachDomHandlers()}))},A.prototype.onPointerMove=function(t){t.preventDefault();t=S(t,this.dragTarget);this.service.handleDragAndDrop(t)},A.prototype.onPointerUp=function(t){var e=this,t=(t.preventDefault(),S(t,this.dragTarget));this.service.handleDragAndDrop(t),this.ngZone.runOutsideAngular(function(){e.attachDomHandlers()})},A.prototype.ngOnInit=function(){this.initializeDraggable()},A.prototype.ngAfterContentInit=function(){var t=this;(C(this.element)||C(this.dragTarget))&&this.ngZone.runOutsideAngular(function(){t.attachDomHandlers(),t.dragHandles.length||t.renderer.addClass(t.nativeElement,"k-cursor-pointer")}),this.service.dragTargets.push(this.dragTarget)},A.prototype.ngOnDestroy=function(){this.domSubscriptions.forEach(function(t){return t()})},A.prototype.handlePress=function(e){var n=this;0<this.dragDelay?this.dragTimeout=setTimeout(function(){n.pressed=!0},this.dragDelay):this.pressed=!0,this.ngZone.run(function(){var t=new f({normalizedEvent:e,hostElement:n.nativeElement});n.press.emit(t)})},A.prototype.handleDragStart=function(t){var e=this;this.pressed?x||(this.ngZone.run(function(){x=e.emitEvent("dragStart",{normalizedEvent:t,hostElement:e.nativeElement}).isDefaultPrevented()}),C(this.hintTemplate)&&(this.createHint(),C(this.hint)&&this.renderer.setStyle(this.nativeElement,"opacity","0.7")),this.dragStarted=0===this.threshold,this.service.dragTarget=this.dragTarget,(this.service.dragTargetDirective=this).initialPosition={x:t.clientX,y:t.clientY}):this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null)},A.prototype.handleDrag=function(t){var e,n,r,i=this;this.pressed&&(e=this.hint?this.hintElem:this.nativeElement,n=e===this.nativeElement?{normalizedEvent:t,hostElement:this.nativeElement}:{normalizedEvent:t,hostElement:this.nativeElement,hintElement:e},this.ngZone.run(function(){R=i.emitEvent("drag",n).isDefaultPrevented()}),R||(r={x:0,y:0},r="horizontal"===this.restrictByAxis?{x:t.clientX-this.initialPosition.x+t.scrollX,y:0}:"vertical"===this.restrictByAxis?{x:0,y:t.clientY-this.initialPosition.y+t.scrollY}:{x:t.clientX-this.initialPosition.x+t.scrollX,y:t.clientY-this.initialPosition.y+t.scrollY},t=Math.abs(r.x)<this.threshold&&Math.abs(r.y)<this.threshold,!this.dragStarted&&t||(!this.dragStarted&&0<this.threshold&&(this.dragStarted=!0),t="translate("+r.x+"px, "+r.y+"px)",I(this.renderer,e,{transform:t,transition:"none"}))))},A.prototype.handleRelease=function(e){var n=this;this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null,this.pressed=!1),this.service.dragTarget=null,this.service.dragTargetDirective=null,this.ngZone.run(function(){var t=new E({normalizedEvent:e,hostElement:n.nativeElement});n.release.emit(t)})},A.prototype.handleDragEnd=function(e){var t,n=this;this.dragStarted&&(this.dragStarted=!1,t=this.hint?this.hintElem:this.nativeElement,C(this.hint)&&(this.renderer.removeStyle(this.nativeElement,"opacity"),this.destroyHint()),this.renderer.removeStyle(t,"transform"),I(this.renderer,t,{transition:"transform .3s ease-in-out"}),this.ngZone.run(function(){var t=new O({normalizedEvent:e,hostElement:n.nativeElement});n.dragEnd.emit(t)}))},A.prototype.initializeDraggable=function(){this.dragTarget={element:this.nativeElement,hint:null,onPress:this.handlePress.bind(this),onRelease:this.handleRelease.bind(this),onDragStart:this.handleDragStart.bind(this),onDrag:this.handleDrag.bind(this),onDragEnd:this.handleDragEnd.bind(this)}},A.prototype.attachDomHandlers=function(){var t;0<this.domSubscriptions.length&&this.domSubscriptions.forEach(function(t){return t()}),n.isDocumentAvailable()&&C(this.element)&&(this.service.pressed?(this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),t=r.getScrollableParent(this.nativeElement),this.domSubscriptions=[this.renderer.listen(document,"pointermove",this.onPointerMove),this.renderer.listen(document,"mousemove",this.onPointerMove),this.renderer.listen(document,"touchmove",this.onPointerMove),this.renderer.listen(document,"pointerup",this.onPointerUp),this.renderer.listen(document,"pointercancel",this.onPointerUp),this.renderer.listen(document,"mouseup",this.onPointerUp),this.renderer.listen(document,"contextmenu",this.onPointerUp),this.renderer.listen(document,"touchend",this.onPointerUp),this.renderer.listen(document,"touchcancel",this.onPointerUp)],t&&(t===document.getElementsByTagName("html")[0]&&(t=document),this.domSubscriptions.push(this.renderer.listen(t,"scroll",this.onPointerMove)))):(this.onPointerDown=this.onPointerDown.bind(this),t=this.nativeElement,this.domSubscriptions=[this.renderer.listen(t,"pointerdown",this.onPointerDown),this.renderer.listen(t,"mousedown",this.onPointerDown),this.renderer.listen(t,"touchstart",this.onPointerDown)]))},A.prototype.isDragHandle=function(e){return this.dragHandles.toArray().some(function(t){return n.contains(t.element.nativeElement,e,!0)})},A.prototype.getAutoScrollContainer=function(){return"object"==typeof this.autoScroll&&this.autoScroll.boundaryElementRef&&this.autoScroll.boundaryElementRef.nativeElement?this.autoScroll.boundaryElementRef.nativeElement:null},A.prototype.createHint=function(){var t=this.resolver.resolveComponentFactory(P);this.hint=this.viewContainer.createComponent(t),this.hint.instance.template=this.hintTemplate,(this.hint.instance.directive=this).hint.changeDetectorRef.detectChanges(),this.dragTarget.hint=this.hint.instance.element.nativeElement},A.prototype.destroyHint=function(){this.hint.destroy(),this.hint.changeDetectorRef.detectChanges(),this.hint=null,this.dragTarget.hint=null},A.prototype.emitEvent=function(t,e){var n;switch(t){case"dragStart":n=new v(e);break;case"drag":n=new b(e)}return this[t].emit(n),n},A);function A(t,e,n,r,i,o){this.element=t,this.renderer=e,this.ngZone=n,this.service=r,this.viewContainer=i,this.resolver=o,this.threshold=0,this.autoScroll=!0,this.dragDelay=0,this.press=new s.EventEmitter,this.dragStart=new s.EventEmitter,this.drag=new s.EventEmitter,this.release=new s.EventEmitter,this.dragEnd=new s.EventEmitter,this.touchAction="none",this.dragTarget=null,this.domSubscriptions=[],this.hint=null,this.initialPosition={x:0,y:0},this.dragStarted=!1,this.pressed=!1,this.dragTimeout=null,a.validatePackage(u)}l.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:l,deps:[{token:o.ElementRef},{token:o.Renderer2},{token:o.NgZone},{token:k},{token:o.ViewContainerRef},{token:o.ComponentFactoryResolver}],target:o.ɵɵFactoryTarget.Directive}),l.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:l,selector:"[kendoDragTarget]",inputs:{hintTemplate:"hintTemplate",threshold:"threshold",autoScroll:"autoScroll",link:"link",dragDelay:"dragDelay",restrictByAxis:"restrictByAxis"},outputs:{press:"press",dragStart:"dragStart",drag:"drag",release:"release",dragEnd:"dragEnd"},host:{properties:{"style.touch-action":"this.touchAction"}},queries:[{propertyName:"dragHandles",predicate:m}],exportAs:["kendoDragTarget"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:l,decorators:[{type:s.Directive,args:[{selector:"[kendoDragTarget]",exportAs:"kendoDragTarget"}]}],ctorParameters:function(){return[{type:o.ElementRef},{type:o.Renderer2},{type:o.NgZone},{type:k},{type:o.ViewContainerRef},{type:o.ComponentFactoryResolver}]},propDecorators:{hintTemplate:[{type:s.Input}],threshold:[{type:s.Input}],autoScroll:[{type:s.Input}],link:[{type:s.Input}],dragDelay:[{type:s.Input}],restrictByAxis:[{type:s.Input}],press:[{type:s.Output}],dragStart:[{type:s.Output}],drag:[{type:s.Output}],release:[{type:s.Output}],dragEnd:[{type:s.Output}],touchAction:[{type:s.HostBinding,args:["style.touch-action"]}],dragHandles:[{type:s.ContentChildren,args:[m]}]}});var z=function(t){Object.assign(this,t)},F=function(t){Object.assign(this,t)},Z=function(t){Object.assign(this,t)},N=function(t){Object.assign(this,t)},j=(M.prototype.ngOnInit=function(){this.initializeDropTarget(),this.service.dropTargets.push(this.dropTarget)},M.prototype.handleDragEnter=function(e){var n=this,t=!0;if(C(this.allowedDragTargets))switch(typeof this.allowedDragTargets){case"function":t=this.allowedDragTargets(this.service.dragTargetDirective);break;case"string":t=this.service.dragTargetDirective.link===this.allowedDragTargets;break;default:t=this.allowedDragTargets.some(function(t){return t===n.service.dragTargetDirective.link})}t&&(this.service.dropTarget=this.dropTarget,this.ngZone.run(function(){var t=new z({event:e,element:n.element.nativeElement});n.dragEnter.emit(t)}))},M.prototype.handleDragLeave=function(e){var n=this;this.service.dropTarget=null,this.ngZone.run(function(){var t=new Z({event:e,element:n.element.nativeElement});n.dragLeave.emit(t)})},M.prototype.handleDragOver=function(e){var n=this;this.ngZone.run(function(){var t=new F({event:e,element:n.element.nativeElement});n.dragOver.emit(t)})},M.prototype.handleDrop=function(e){var n=this;this.ngZone.run(function(){var t=new N({event:e,element:n.element.nativeElement});n.drop.emit(t)}),this.service.setScrollOffset({x:0,y:0})},M.prototype.initializeDropTarget=function(){this.dropTarget={element:this.element.nativeElement,onDragEnter:this.handleDragEnter.bind(this),onDragLeave:this.handleDragLeave.bind(this),onDragOver:this.handleDragOver.bind(this),onDrop:this.handleDrop.bind(this)}},M);function M(t,e,n){this.service=t,this.element=e,this.ngZone=n,this.dragEnter=new s.EventEmitter,this.dragOver=new s.EventEmitter,this.dragLeave=new s.EventEmitter,this.drop=new s.EventEmitter,a.validatePackage(u)}j.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:j,deps:[{token:k},{token:o.ElementRef},{token:o.NgZone}],target:o.ɵɵFactoryTarget.Directive}),j.ɵdir=o.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:j,selector:"[kendoDropTarget]",inputs:{allowedDragTargets:"allowedDragTargets"},outputs:{dragEnter:"dragEnter",dragOver:"dragOver",dragLeave:"dragLeave",drop:"drop"},exportAs:["kendoDropTarget"],ngImport:o}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:j,decorators:[{type:s.Directive,args:[{selector:"[kendoDropTarget]",exportAs:"kendoDropTarget"}]}],ctorParameters:function(){return[{type:k},{type:o.ElementRef},{type:o.NgZone}]},propDecorators:{allowedDragTargets:[{type:s.Input}],dragEnter:[{type:s.Output}],dragOver:[{type:s.Output}],dragLeave:[{type:s.Output}],drop:[{type:s.Output}]}});var V=[l,m,j,P],H=function(){},V=(H.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,deps:[],target:o.ɵɵFactoryTarget.NgModule}),H.ɵmod=o.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,declarations:[l,m,j,P],imports:[e.CommonModule],exports:[l,m,j,P]}),H.ɵinj=o.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,imports:[[e.CommonModule]]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:H,decorators:[{type:s.NgModule,args:[{declarations:p([],g(V)),exports:p([],g(V)),imports:[e.CommonModule]}]}]}),function(){});V.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,deps:[],target:o.ɵɵFactoryTarget.NgModule}),V.ɵmod=o.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,exports:[H]}),V.ɵinj=o.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,imports:[H]}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:V,decorators:[{type:s.NgModule,args:[{exports:[H]}]}]}),t.DragAndDropModule=H,t.DragEndEvent=O,t.DragEnterEvent=z,t.DragEvent=b,t.DragHandleDirective=m,t.DragLeaveEvent=Z,t.DragOverEvent=F,t.DragStartEvent=v,t.DragTargetDirective=l,t.DropEvent=N,t.DropTargetDirective=j,t.HintComponent=P,t.PressEvent=f,t.ReleaseEvent=E,t.UtilsModule=V,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { OnDestroy } from '@angular/core';
|
|
6
6
|
import { DragTarget, DropTarget, DragAndDropState, DragAndDropAction } from '@progress/kendo-draggable-common';
|
|
7
7
|
import { DragTargetDirective } from './dragtarget.directive';
|
|
8
|
-
import { Coordinates } from './
|
|
8
|
+
import { Coordinates } from './models/index';
|
|
9
9
|
import { ScrollDirection } from './models';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
/**
|
|
@@ -150,6 +150,10 @@ export declare class DragTargetDirective implements OnInit, AfterContentInit, On
|
|
|
150
150
|
* @hidden
|
|
151
151
|
*/
|
|
152
152
|
private destroyHint;
|
|
153
|
+
/**
|
|
154
|
+
* @hidden
|
|
155
|
+
*/
|
|
156
|
+
private emitEvent;
|
|
153
157
|
static ɵfac: i0.ɵɵFactoryDeclaration<DragTargetDirective, never>;
|
|
154
158
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DragTargetDirective, "[kendoDragTarget]", ["kendoDragTarget"], { "hintTemplate": "hintTemplate"; "threshold": "threshold"; "autoScroll": "autoScroll"; "link": "link"; "dragDelay": "dragDelay"; "restrictByAxis": "restrictByAxis"; }, { "press": "press"; "dragStart": "dragStart"; "drag": "drag"; "release": "release"; "dragEnd": "dragEnd"; }, ["dragHandles"]>;
|
|
155
159
|
}
|
|
@@ -11,11 +11,15 @@ export declare class DragEvent extends PreventableEvent {
|
|
|
11
11
|
/**
|
|
12
12
|
* The normalized drag event.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
15
|
/**
|
|
16
16
|
* The DOM element that is being dragged.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
hostElement: HTMLElement;
|
|
19
|
+
/**
|
|
20
|
+
* The hint of the DragTarget.
|
|
21
|
+
*/
|
|
22
|
+
hintElement?: HTMLElement;
|
|
19
23
|
/**
|
|
20
24
|
* @hidden
|
|
21
25
|
*/
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
7
6
|
/**
|
|
8
7
|
* Arguments for the dragEnd event of the DragTarget.
|
|
9
8
|
*/
|
|
10
|
-
export declare class DragEndEvent
|
|
9
|
+
export declare class DragEndEvent {
|
|
11
10
|
/**
|
|
12
11
|
* The normalized drag event.
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
14
|
/**
|
|
16
15
|
* The DOM element that was dragged.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
19
18
|
/**
|
|
20
19
|
* @hidden
|
|
21
20
|
*/
|
|
@@ -10,11 +10,11 @@ export declare class PressEvent {
|
|
|
10
10
|
/**
|
|
11
11
|
* The normalized event.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
14
14
|
/**
|
|
15
15
|
* The DOM element that is pressed.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
18
18
|
/**
|
|
19
19
|
* @hidden
|
|
20
20
|
*/
|
|
@@ -10,11 +10,11 @@ export declare class ReleaseEvent {
|
|
|
10
10
|
/**
|
|
11
11
|
* The normalized event.
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
14
14
|
/**
|
|
15
15
|
* The DOM element that is released.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
18
18
|
/**
|
|
19
19
|
* @hidden
|
|
20
20
|
*/
|
|
@@ -11,11 +11,11 @@ export declare class DragStartEvent extends PreventableEvent {
|
|
|
11
11
|
/**
|
|
12
12
|
* The normalized drag event.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
15
|
/**
|
|
16
16
|
* The DOM element that will be dragged.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
hostElement: HTMLElement;
|
|
19
19
|
/**
|
|
20
20
|
* @hidden
|
|
21
21
|
*/
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
7
6
|
/**
|
|
8
7
|
* Arguments for the drop event of the DropTarget.
|
|
9
8
|
*/
|
|
10
|
-
export declare class DropEvent
|
|
9
|
+
export declare class DropEvent {
|
|
11
10
|
/**
|
|
12
11
|
* The normalized drag event.
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
14
|
/**
|
|
16
15
|
* The DropTarget DOM element.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
19
18
|
/**
|
|
20
19
|
* @hidden
|
|
21
20
|
*/
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
7
6
|
/**
|
|
8
7
|
* Arguments for the dragEnter event of the DropTarget.
|
|
9
8
|
*/
|
|
10
|
-
export declare class DragEnterEvent
|
|
9
|
+
export declare class DragEnterEvent {
|
|
11
10
|
/**
|
|
12
11
|
* The normalized drag event.
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
14
|
/**
|
|
16
15
|
* The DropTarget DOM element.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
19
18
|
/**
|
|
20
19
|
* @hidden
|
|
21
20
|
*/
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
7
6
|
/**
|
|
8
7
|
* Arguments for the dragLeave event of the DropTarget.
|
|
9
8
|
*/
|
|
10
|
-
export declare class DragLeaveEvent
|
|
9
|
+
export declare class DragLeaveEvent {
|
|
11
10
|
/**
|
|
12
11
|
* The normalized drag event.
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
14
|
/**
|
|
16
15
|
* The DropTarget DOM element.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
19
18
|
/**
|
|
20
19
|
* @hidden
|
|
21
20
|
*/
|
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
7
6
|
/**
|
|
8
7
|
* Arguments for the dragOver event of the DropTarget.
|
|
9
8
|
*/
|
|
10
|
-
export declare class DragOverEvent
|
|
9
|
+
export declare class DragOverEvent {
|
|
11
10
|
/**
|
|
12
11
|
* The normalized drag event.
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
normalizedEvent: NormalizedDragEvent;
|
|
15
14
|
/**
|
|
16
15
|
* The DropTarget DOM element.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
hostElement: HTMLElement;
|
|
19
18
|
/**
|
|
20
19
|
* @hidden
|
|
21
20
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents a unified type for all coordinates.
|
|
7
|
+
*/
|
|
8
|
+
export interface Coordinates {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
package/drag-and-drop/util.d.ts
CHANGED
|
@@ -8,13 +8,6 @@ import { DragAndDropAction, DragTarget } from "@progress/kendo-draggable-common"
|
|
|
8
8
|
* @hidden
|
|
9
9
|
*/
|
|
10
10
|
export declare const dragTargetTransition = "transform .3s ease-in-out";
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
export interface Coordinates {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
}
|
|
18
11
|
/**
|
|
19
12
|
* @hidden
|
|
20
13
|
*/
|
|
@@ -13,6 +13,8 @@ import { contains, isDocumentAvailable } from "@progress/kendo-angular-common";
|
|
|
13
13
|
import { HintComponent } from "./hint.component";
|
|
14
14
|
import * as i0 from "@angular/core";
|
|
15
15
|
import * as i1 from "./drag-state.service";
|
|
16
|
+
let isDragStartPrevented = false;
|
|
17
|
+
let isDragPrevented = false;
|
|
16
18
|
/**
|
|
17
19
|
* Represents the Kendo UI DragTarget directive for Angular.
|
|
18
20
|
*/
|
|
@@ -155,7 +157,7 @@ export class DragTargetDirective {
|
|
|
155
157
|
this.pressed = true;
|
|
156
158
|
}
|
|
157
159
|
this.ngZone.run(() => {
|
|
158
|
-
const eventArgs = new PressEvent({ event,
|
|
160
|
+
const eventArgs = new PressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
159
161
|
this.press.emit(eventArgs);
|
|
160
162
|
});
|
|
161
163
|
}
|
|
@@ -170,6 +172,12 @@ export class DragTargetDirective {
|
|
|
170
172
|
}
|
|
171
173
|
return;
|
|
172
174
|
}
|
|
175
|
+
if (isDragStartPrevented) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this.ngZone.run(() => {
|
|
179
|
+
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
180
|
+
});
|
|
173
181
|
if (isPresent(this.hintTemplate)) {
|
|
174
182
|
this.createHint();
|
|
175
183
|
if (isPresent(this.hint)) {
|
|
@@ -180,10 +188,6 @@ export class DragTargetDirective {
|
|
|
180
188
|
this.service.dragTarget = this.dragTarget;
|
|
181
189
|
this.service.dragTargetDirective = this;
|
|
182
190
|
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
183
|
-
this.ngZone.run(() => {
|
|
184
|
-
const eventArgs = new DragStartEvent({ event, element: this.nativeElement });
|
|
185
|
-
this.dragStart.emit(eventArgs);
|
|
186
|
-
});
|
|
187
191
|
}
|
|
188
192
|
/**
|
|
189
193
|
* @hidden
|
|
@@ -193,6 +197,13 @@ export class DragTargetDirective {
|
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
195
199
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
200
|
+
const eventArgsProps = elem === this.nativeElement ? { normalizedEvent: event, hostElement: this.nativeElement } : { normalizedEvent: event, hostElement: this.nativeElement, hintElement: elem };
|
|
201
|
+
this.ngZone.run(() => {
|
|
202
|
+
isDragPrevented = this.emitEvent('drag', eventArgsProps).isDefaultPrevented();
|
|
203
|
+
});
|
|
204
|
+
if (isDragPrevented) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
196
207
|
let coordinates = { x: 0, y: 0 };
|
|
197
208
|
if (this.restrictByAxis === 'horizontal') {
|
|
198
209
|
coordinates = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
@@ -207,18 +218,14 @@ export class DragTargetDirective {
|
|
|
207
218
|
if (!this.dragStarted && thresholdNotReached) {
|
|
208
219
|
return;
|
|
209
220
|
}
|
|
221
|
+
if (!this.dragStarted && this.threshold > 0) {
|
|
222
|
+
this.dragStarted = true;
|
|
223
|
+
}
|
|
210
224
|
const transform = `translate(${coordinates.x}px, ${coordinates.y}px)`;
|
|
211
225
|
setElementStyles(this.renderer, elem, {
|
|
212
226
|
transform: transform,
|
|
213
227
|
transition: 'none'
|
|
214
228
|
});
|
|
215
|
-
if (!this.dragStarted && this.threshold > 0) {
|
|
216
|
-
this.dragStarted = true;
|
|
217
|
-
}
|
|
218
|
-
this.ngZone.run(() => {
|
|
219
|
-
const eventArgs = new DragEvent({ event, element: this.nativeElement });
|
|
220
|
-
this.drag.emit(eventArgs);
|
|
221
|
-
});
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* @hidden
|
|
@@ -232,7 +239,7 @@ export class DragTargetDirective {
|
|
|
232
239
|
this.service.dragTarget = null;
|
|
233
240
|
this.service.dragTargetDirective = null;
|
|
234
241
|
this.ngZone.run(() => {
|
|
235
|
-
const eventArgs = new ReleaseEvent({ event,
|
|
242
|
+
const eventArgs = new ReleaseEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
236
243
|
this.release.emit(eventArgs);
|
|
237
244
|
});
|
|
238
245
|
}
|
|
@@ -254,7 +261,7 @@ export class DragTargetDirective {
|
|
|
254
261
|
transition: dragTargetTransition
|
|
255
262
|
});
|
|
256
263
|
this.ngZone.run(() => {
|
|
257
|
-
const eventArgs = new DragEndEvent({ event,
|
|
264
|
+
const eventArgs = new DragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
258
265
|
this.dragEnd.emit(eventArgs);
|
|
259
266
|
});
|
|
260
267
|
}
|
|
@@ -349,6 +356,24 @@ export class DragTargetDirective {
|
|
|
349
356
|
this.hint = null;
|
|
350
357
|
this.dragTarget.hint = null;
|
|
351
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* @hidden
|
|
361
|
+
*/
|
|
362
|
+
emitEvent(event, args) {
|
|
363
|
+
let eventArgs;
|
|
364
|
+
switch (event) {
|
|
365
|
+
case 'dragStart':
|
|
366
|
+
eventArgs = new DragStartEvent(args);
|
|
367
|
+
break;
|
|
368
|
+
case 'drag':
|
|
369
|
+
eventArgs = new DragEvent(args);
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
this[event].emit(eventArgs);
|
|
375
|
+
return eventArgs;
|
|
376
|
+
}
|
|
352
377
|
}
|
|
353
378
|
DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
354
379
|
DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hintTemplate: "hintTemplate", threshold: "threshold", autoScroll: "autoScroll", link: "link", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis" }, outputs: { press: "press", dragStart: "dragStart", drag: "drag", release: "release", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
6
5
|
/**
|
|
7
6
|
* Arguments for the dragEnd event of the DragTarget.
|
|
8
7
|
*/
|
|
9
|
-
export class DragEndEvent
|
|
8
|
+
export class DragEndEvent {
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
12
11
|
*/
|
|
13
12
|
constructor(args) {
|
|
14
|
-
super();
|
|
15
13
|
Object.assign(this, args);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
6
5
|
/**
|
|
7
6
|
* Arguments for the drop event of the DropTarget.
|
|
8
7
|
*/
|
|
9
|
-
export class DropEvent
|
|
8
|
+
export class DropEvent {
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
12
11
|
*/
|
|
13
12
|
constructor(args) {
|
|
14
|
-
super();
|
|
15
13
|
Object.assign(this, args);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
6
5
|
/**
|
|
7
6
|
* Arguments for the dragEnter event of the DropTarget.
|
|
8
7
|
*/
|
|
9
|
-
export class DragEnterEvent
|
|
8
|
+
export class DragEnterEvent {
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
12
11
|
*/
|
|
13
12
|
constructor(args) {
|
|
14
|
-
super();
|
|
15
13
|
Object.assign(this, args);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
6
5
|
/**
|
|
7
6
|
* Arguments for the dragLeave event of the DropTarget.
|
|
8
7
|
*/
|
|
9
|
-
export class DragLeaveEvent
|
|
8
|
+
export class DragLeaveEvent {
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
12
11
|
*/
|
|
13
12
|
constructor(args) {
|
|
14
|
-
super();
|
|
15
13
|
Object.assign(this, args);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { PreventableEvent } from '@progress/kendo-angular-common';
|
|
6
5
|
/**
|
|
7
6
|
* Arguments for the dragOver event of the DropTarget.
|
|
8
7
|
*/
|
|
9
|
-
export class DragOverEvent
|
|
8
|
+
export class DragOverEvent {
|
|
10
9
|
/**
|
|
11
10
|
* @hidden
|
|
12
11
|
*/
|
|
13
12
|
constructor(args) {
|
|
14
|
-
super();
|
|
15
13
|
Object.assign(this, args);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-utils',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1660638843,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -17,7 +17,7 @@ const packageMetadata = {
|
|
|
17
17
|
name: '@progress/kendo-angular-utils',
|
|
18
18
|
productName: 'Kendo UI for Angular',
|
|
19
19
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
20
|
-
publishDate:
|
|
20
|
+
publishDate: 1660638843,
|
|
21
21
|
version: '',
|
|
22
22
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
23
23
|
};
|
|
@@ -84,12 +84,11 @@ class ReleaseEvent {
|
|
|
84
84
|
/**
|
|
85
85
|
* Arguments for the dragEnd event of the DragTarget.
|
|
86
86
|
*/
|
|
87
|
-
class DragEndEvent
|
|
87
|
+
class DragEndEvent {
|
|
88
88
|
/**
|
|
89
89
|
* @hidden
|
|
90
90
|
*/
|
|
91
91
|
constructor(args) {
|
|
92
|
-
super();
|
|
93
92
|
Object.assign(this, args);
|
|
94
93
|
}
|
|
95
94
|
}
|
|
@@ -297,6 +296,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
297
296
|
}]
|
|
298
297
|
}], ctorParameters: function () { return []; } });
|
|
299
298
|
|
|
299
|
+
let isDragStartPrevented = false;
|
|
300
|
+
let isDragPrevented = false;
|
|
300
301
|
/**
|
|
301
302
|
* Represents the Kendo UI DragTarget directive for Angular.
|
|
302
303
|
*/
|
|
@@ -439,7 +440,7 @@ class DragTargetDirective {
|
|
|
439
440
|
this.pressed = true;
|
|
440
441
|
}
|
|
441
442
|
this.ngZone.run(() => {
|
|
442
|
-
const eventArgs = new PressEvent({ event,
|
|
443
|
+
const eventArgs = new PressEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
443
444
|
this.press.emit(eventArgs);
|
|
444
445
|
});
|
|
445
446
|
}
|
|
@@ -454,6 +455,12 @@ class DragTargetDirective {
|
|
|
454
455
|
}
|
|
455
456
|
return;
|
|
456
457
|
}
|
|
458
|
+
if (isDragStartPrevented) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
this.ngZone.run(() => {
|
|
462
|
+
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
463
|
+
});
|
|
457
464
|
if (isPresent(this.hintTemplate)) {
|
|
458
465
|
this.createHint();
|
|
459
466
|
if (isPresent(this.hint)) {
|
|
@@ -464,10 +471,6 @@ class DragTargetDirective {
|
|
|
464
471
|
this.service.dragTarget = this.dragTarget;
|
|
465
472
|
this.service.dragTargetDirective = this;
|
|
466
473
|
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
467
|
-
this.ngZone.run(() => {
|
|
468
|
-
const eventArgs = new DragStartEvent({ event, element: this.nativeElement });
|
|
469
|
-
this.dragStart.emit(eventArgs);
|
|
470
|
-
});
|
|
471
474
|
}
|
|
472
475
|
/**
|
|
473
476
|
* @hidden
|
|
@@ -477,6 +480,13 @@ class DragTargetDirective {
|
|
|
477
480
|
return;
|
|
478
481
|
}
|
|
479
482
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
483
|
+
const eventArgsProps = elem === this.nativeElement ? { normalizedEvent: event, hostElement: this.nativeElement } : { normalizedEvent: event, hostElement: this.nativeElement, hintElement: elem };
|
|
484
|
+
this.ngZone.run(() => {
|
|
485
|
+
isDragPrevented = this.emitEvent('drag', eventArgsProps).isDefaultPrevented();
|
|
486
|
+
});
|
|
487
|
+
if (isDragPrevented) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
480
490
|
let coordinates = { x: 0, y: 0 };
|
|
481
491
|
if (this.restrictByAxis === 'horizontal') {
|
|
482
492
|
coordinates = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
@@ -491,18 +501,14 @@ class DragTargetDirective {
|
|
|
491
501
|
if (!this.dragStarted && thresholdNotReached) {
|
|
492
502
|
return;
|
|
493
503
|
}
|
|
504
|
+
if (!this.dragStarted && this.threshold > 0) {
|
|
505
|
+
this.dragStarted = true;
|
|
506
|
+
}
|
|
494
507
|
const transform = `translate(${coordinates.x}px, ${coordinates.y}px)`;
|
|
495
508
|
setElementStyles(this.renderer, elem, {
|
|
496
509
|
transform: transform,
|
|
497
510
|
transition: 'none'
|
|
498
511
|
});
|
|
499
|
-
if (!this.dragStarted && this.threshold > 0) {
|
|
500
|
-
this.dragStarted = true;
|
|
501
|
-
}
|
|
502
|
-
this.ngZone.run(() => {
|
|
503
|
-
const eventArgs = new DragEvent({ event, element: this.nativeElement });
|
|
504
|
-
this.drag.emit(eventArgs);
|
|
505
|
-
});
|
|
506
512
|
}
|
|
507
513
|
/**
|
|
508
514
|
* @hidden
|
|
@@ -516,7 +522,7 @@ class DragTargetDirective {
|
|
|
516
522
|
this.service.dragTarget = null;
|
|
517
523
|
this.service.dragTargetDirective = null;
|
|
518
524
|
this.ngZone.run(() => {
|
|
519
|
-
const eventArgs = new ReleaseEvent({ event,
|
|
525
|
+
const eventArgs = new ReleaseEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
520
526
|
this.release.emit(eventArgs);
|
|
521
527
|
});
|
|
522
528
|
}
|
|
@@ -538,7 +544,7 @@ class DragTargetDirective {
|
|
|
538
544
|
transition: dragTargetTransition
|
|
539
545
|
});
|
|
540
546
|
this.ngZone.run(() => {
|
|
541
|
-
const eventArgs = new DragEndEvent({ event,
|
|
547
|
+
const eventArgs = new DragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
542
548
|
this.dragEnd.emit(eventArgs);
|
|
543
549
|
});
|
|
544
550
|
}
|
|
@@ -633,6 +639,24 @@ class DragTargetDirective {
|
|
|
633
639
|
this.hint = null;
|
|
634
640
|
this.dragTarget.hint = null;
|
|
635
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* @hidden
|
|
644
|
+
*/
|
|
645
|
+
emitEvent(event, args) {
|
|
646
|
+
let eventArgs;
|
|
647
|
+
switch (event) {
|
|
648
|
+
case 'dragStart':
|
|
649
|
+
eventArgs = new DragStartEvent(args);
|
|
650
|
+
break;
|
|
651
|
+
case 'drag':
|
|
652
|
+
eventArgs = new DragEvent(args);
|
|
653
|
+
break;
|
|
654
|
+
default:
|
|
655
|
+
break;
|
|
656
|
+
}
|
|
657
|
+
this[event].emit(eventArgs);
|
|
658
|
+
return eventArgs;
|
|
659
|
+
}
|
|
636
660
|
}
|
|
637
661
|
DragTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: DragStateService }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Directive });
|
|
638
662
|
DragTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DragTargetDirective, selector: "[kendoDragTarget]", inputs: { hintTemplate: "hintTemplate", threshold: "threshold", autoScroll: "autoScroll", link: "link", dragDelay: "dragDelay", restrictByAxis: "restrictByAxis" }, outputs: { press: "press", dragStart: "dragStart", drag: "drag", release: "release", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
@@ -675,12 +699,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
675
699
|
/**
|
|
676
700
|
* Arguments for the dragEnter event of the DropTarget.
|
|
677
701
|
*/
|
|
678
|
-
class DragEnterEvent
|
|
702
|
+
class DragEnterEvent {
|
|
679
703
|
/**
|
|
680
704
|
* @hidden
|
|
681
705
|
*/
|
|
682
706
|
constructor(args) {
|
|
683
|
-
super();
|
|
684
707
|
Object.assign(this, args);
|
|
685
708
|
}
|
|
686
709
|
}
|
|
@@ -688,12 +711,11 @@ class DragEnterEvent extends PreventableEvent {
|
|
|
688
711
|
/**
|
|
689
712
|
* Arguments for the dragOver event of the DropTarget.
|
|
690
713
|
*/
|
|
691
|
-
class DragOverEvent
|
|
714
|
+
class DragOverEvent {
|
|
692
715
|
/**
|
|
693
716
|
* @hidden
|
|
694
717
|
*/
|
|
695
718
|
constructor(args) {
|
|
696
|
-
super();
|
|
697
719
|
Object.assign(this, args);
|
|
698
720
|
}
|
|
699
721
|
}
|
|
@@ -701,12 +723,11 @@ class DragOverEvent extends PreventableEvent {
|
|
|
701
723
|
/**
|
|
702
724
|
* Arguments for the dragLeave event of the DropTarget.
|
|
703
725
|
*/
|
|
704
|
-
class DragLeaveEvent
|
|
726
|
+
class DragLeaveEvent {
|
|
705
727
|
/**
|
|
706
728
|
* @hidden
|
|
707
729
|
*/
|
|
708
730
|
constructor(args) {
|
|
709
|
-
super();
|
|
710
731
|
Object.assign(this, args);
|
|
711
732
|
}
|
|
712
733
|
}
|
|
@@ -714,12 +735,11 @@ class DragLeaveEvent extends PreventableEvent {
|
|
|
714
735
|
/**
|
|
715
736
|
* Arguments for the drop event of the DropTarget.
|
|
716
737
|
*/
|
|
717
|
-
class DropEvent
|
|
738
|
+
class DropEvent {
|
|
718
739
|
/**
|
|
719
740
|
* @hidden
|
|
720
741
|
*/
|
|
721
742
|
constructor(args) {
|
|
722
|
-
super();
|
|
723
743
|
Object.assign(this, args);
|
|
724
744
|
}
|
|
725
745
|
}
|
package/main.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export { DragTargetDirective } from './drag-and-drop/dragtarget.directive';
|
|
|
8
8
|
export { DragHandleDirective } from './drag-and-drop/draghandle.directive';
|
|
9
9
|
export { DropTargetDirective } from './drag-and-drop/droptarget.directive';
|
|
10
10
|
export { HintComponent } from './drag-and-drop/hint.component';
|
|
11
|
-
export { DragAxis, AutoScrollOptions, AllowedTargetFn, ScrollDirection } from './drag-and-drop/models/index';
|
|
11
|
+
export { DragAxis, AutoScrollOptions, AllowedTargetFn, ScrollDirection, Coordinates } from './drag-and-drop/models/index';
|
|
12
12
|
export * from './drag-and-drop/events/drag-target';
|
|
13
13
|
export * from './drag-and-drop/events/drop-target';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-dev.202208160834",
|
|
4
4
|
"description": "Kendo UI Angular Utilities package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@progress/kendo-schematics": "^3.0.0",
|
|
26
|
-
"@progress/kendo-draggable-common": "
|
|
26
|
+
"@progress/kendo-draggable-common": "0.2.3",
|
|
27
27
|
"tslib": "^2.3.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|