@progress/kendo-angular-utils 0.1.1-dev.202208160834 → 0.1.1-dev.202209081521
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/dragtarget.directive.d.ts +8 -14
- package/drag-and-drop/events/drag-target/index.d.ts +0 -1
- package/drag-and-drop/models/allowed-target.d.ts +1 -1
- package/drag-and-drop/models/index.d.ts +1 -0
- package/{esm2015/drag-and-drop/events/drag-target/release-event.js → drag-and-drop/models/normalized-drag-event.d.ts} +2 -11
- package/esm2015/drag-and-drop/dragtarget.directive.js +39 -45
- package/esm2015/drag-and-drop/droptarget.directive.js +13 -5
- package/esm2015/drag-and-drop/events/drag-target/index.js +0 -1
- package/esm2015/drag-and-drop/models/normalized-drag-event.js +5 -0
- package/esm2015/package-metadata.js +1 -1
- package/fesm2015/kendo-angular-utils.js +54 -64
- package/main.d.ts +1 -1
- package/package.json +1 -1
- package/drag-and-drop/events/drag-target/release-event.d.ts +0 -22
|
@@ -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: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
|
+
!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,i){"use strict";function n(n){var r;return n&&n.__esModule?n:(r=Object.create(null),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=n(s),l=n(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 d(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 p,u={name:"@progress/kendo-angular-utils",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1662650462,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,p=i.PreventableEvent),y);function y(t){var e=p.call(this)||this;return Object.assign(e,t),e}var D,E=function(t){Object.assign(this,t)},O=(h(b,D=i.PreventableEvent),b);function b(t){var e=D.call(this)||this;return Object.assign(e,t),e}function T(t,e){return{event:t,payload:e}}function S(e,n,r){Object.keys(r).forEach(function(t){e.setStyle(n,t,r[t])})}function I(t){return null!=t}var C=function(t){this.element=t,this.hostClasses=!0,this.zIndex=10,this.touchAction="none"},P=(C.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:C,deps:[{token:o.ElementRef}],target:o.ɵɵFactoryTarget.Component}),C.ɵcmp=o.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:C,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:C,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"]}]}}),k.prototype.handleDragAndDrop=function(t){this.updateState(),r.dispatchDragAndDrop(this.state,t,this.callbacks)},k.prototype.setPressed=function(t){this.pressed=t},k.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)},k.prototype.setVelocity=function(t){this.velocity=t},k.prototype.setOffset=function(t){this.offset=t},k.prototype.setClientOffset=function(t){this.clientOffset=t},k.prototype.setPageOffset=function(t){this.pageOffset=t},k.prototype.setInitialClientOffset=function(t){this.initialClientOffset=t},k.prototype.setScrollOffset=function(t){this.scrollOffset=t},k.prototype.setInitialScrollOffset=function(t){this.initialScrollOffset=t},k.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}},k.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)}},k.prototype.ngOnDestroy=function(){this.scrollInterval&&(window.clearInterval(this.scrollInterval),this.scrollInterval=null)},k);function k(){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()}P.ɵfac=o.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:P,deps:[],target:o.ɵɵFactoryTarget.Injectable}),P.ɵprov=o.ɵɵngDeclareInjectable({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:P,providedIn:"root"}),o.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:o,type:P,decorators:[{type:s.Injectable,args:[{providedIn:"root"}]}],ctorParameters:function(){return[]}});var w=!1,x=!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=T(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=T(t,this.dragTarget);this.service.handleDragAndDrop(t)},A.prototype.onPointerUp=function(t){var e=this,t=(t.preventDefault(),T(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;(I(this.element)||I(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,n.ngZone.run(function(){n.dragReady.emit()})},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?(this.ngZone.run(function(){w=e.emitEvent("dragStart",{normalizedEvent:t,hostElement:e.nativeElement}).isDefaultPrevented()}),w||(I(this.hintTemplate)&&(this.createHint(),I(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-this.position.x,y:t.clientY-this.position.y})):this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null)},A.prototype.handleDrag=function(t){var e,n,r=this;this.pressed&&!w&&(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(){x=r.emitEvent("drag",n).isDefaultPrevented()}),x||("horizontal"===this.restrictByAxis?this.position={x:t.clientX-this.initialPosition.x+t.scrollX,y:0}:"vertical"===this.restrictByAxis?this.position={x:0,y:t.clientY-this.initialPosition.y+t.scrollY}:this.position={x:t.clientX-this.initialPosition.x+t.scrollX,y:t.clientY-this.initialPosition.y+t.scrollY},t=Math.abs(this.position.x)<this.threshold&&Math.abs(this.position.y)<this.threshold,!this.dragStarted&&t||(!this.dragStarted&&0<this.threshold&&(this.dragStarted=!0),t="translate("+this.position.x+"px, "+this.position.y+"px)",S(this.renderer,e,{transform:t,transition:"none"}))))},A.prototype.handleDragEnd=function(e){var n=this,t=(this.dragTimeout&&(clearTimeout(this.dragTimeout),this.dragTimeout=null,this.pressed=!1),I(this.service.dropTarget)&&!i.contains(this.service.dropTarget,this.service.dragTarget,!0)),r=this.hint?this.hintElem:this.nativeElement;(t||0<this.service.dropTargets.length)&&(this.renderer.removeStyle(r,"transform"),S(this.renderer,r,{transition:"transform .3s ease-in-out"}),this.position={x:0,y:0}),I(this.hint)&&(this.renderer.removeStyle(this.nativeElement,"opacity"),this.destroyHint()),this.service.dragTarget=null,this.service.dragTargetDirective=null,!this.dragStarted||w||x||(this.ngZone.run(function(){var t=new E({normalizedEvent:e,hostElement:n.nativeElement});n.dragEnd.emit(t)}),this.dragStarted=!1)},A.prototype.initializeDraggable=function(){this.dragTarget={element:this.nativeElement,hint:null,onPress:this.handlePress.bind(this),onRelease:this.handleDragEnd.bind(this),onDragStart:this.handleDragStart.bind(this),onDrag:this.handleDrag.bind(this)}},A.prototype.attachDomHandlers=function(){var t;0<this.domSubscriptions.length&&this.domSubscriptions.forEach(function(t){return t()}),i.isDocumentAvailable()&&I(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 i.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(C);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 O(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.dragReady=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,this.position={x:0,y:0},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:P},{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",dragReady:"dragReady",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:P},{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}],dragReady:[{type:s.Output}],dragEnd:[{type:s.Output}],touchAction:[{type:s.HostBinding,args:["style.touch-action"]}],dragHandles:[{type:s.ContentChildren,args:[m]}]}});var R=function(t){Object.assign(this,t)},z=function(t){Object.assign(this,t)},F=function(t){Object.assign(this,t)},Z=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;if(this.service.dragTarget){var t=!0;if(I(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 R({normalizedEvent:e,hostElement:n.element.nativeElement});n.dragEnter.emit(t)}))}},M.prototype.handleDragLeave=function(e){var n=this;this.service.dropTarget=null,this.service.dragTarget&&this.ngZone.run(function(){var t=new F({normalizedEvent:e,hostElement:n.element.nativeElement});n.dragLeave.emit(t)})},M.prototype.handleDragOver=function(e){var n=this;this.service.dragTarget&&this.ngZone.run(function(){var t=new z({normalizedEvent:e,hostElement:n.element.nativeElement});n.dragOver.emit(t)})},M.prototype.handleDrop=function(e){var n=this;this.ngZone.run(function(){var t=new Z({normalizedEvent:e,hostElement:n.element.nativeElement});n.drop.emit(t)})},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:P},{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:P},{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,C],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,C],imports:[e.CommonModule],exports:[l,m,j,C]}),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:d([],g(V)),exports:d([],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=R,t.DragEvent=O,t.DragHandleDirective=m,t.DragLeaveEvent=F,t.DragOverEvent=z,t.DragStartEvent=v,t.DragTargetDirective=l,t.DropEvent=Z,t.DropTargetDirective=j,t.HintComponent=C,t.PressEvent=f,t.UtilsModule=V,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { EventEmitter, AfterContentInit, ElementRef, Renderer2, NgZone, OnInit, OnDestroy, QueryList, TemplateRef, ViewContainerRef, ComponentFactoryResolver } from "@angular/core";
|
|
6
6
|
import { DragHandleDirective } from "./draghandle.directive";
|
|
7
|
-
import { DragStartEvent, DragEndEvent, PressEvent,
|
|
7
|
+
import { DragStartEvent, DragEndEvent, PressEvent, DragEvent } from "./events/drag-target";
|
|
8
8
|
import { DragStateService } from "./drag-state.service";
|
|
9
9
|
import { AutoScrollOptions, DragAxis } from './models';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
@@ -50,27 +50,24 @@ export declare class DragTargetDirective implements OnInit, AfterContentInit, On
|
|
|
50
50
|
restrictByAxis: DragAxis;
|
|
51
51
|
/**
|
|
52
52
|
* Fires when the user presses the DragTarget element.
|
|
53
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
54
53
|
*/
|
|
55
54
|
press: EventEmitter<PressEvent>;
|
|
56
55
|
/**
|
|
57
56
|
* Fires when the dragging of the DragTarget element begins.
|
|
58
|
-
* This event is preventable.
|
|
57
|
+
* This event is preventable.
|
|
59
58
|
*/
|
|
60
59
|
dragStart: EventEmitter<DragStartEvent>;
|
|
61
60
|
/**
|
|
62
61
|
* Fires while the user drags the DragTarget element.
|
|
63
|
-
* This event is preventable.
|
|
62
|
+
* This event is preventable.
|
|
64
63
|
*/
|
|
65
64
|
drag: EventEmitter<DragEvent>;
|
|
66
65
|
/**
|
|
67
|
-
* Fires when the user
|
|
68
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
66
|
+
* Fires when the DragTarget's dragDelay has passed and the user is able to drag the element.
|
|
69
67
|
*/
|
|
70
|
-
|
|
68
|
+
dragReady: EventEmitter<any>;
|
|
71
69
|
/**
|
|
72
|
-
* Fires when the dragging of the DragTarget element
|
|
73
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
70
|
+
* Fires when the dragging of the DragTarget ends and the element is released.
|
|
74
71
|
*/
|
|
75
72
|
dragEnd: EventEmitter<DragEndEvent>;
|
|
76
73
|
touchAction: string;
|
|
@@ -81,6 +78,7 @@ export declare class DragTargetDirective implements OnInit, AfterContentInit, On
|
|
|
81
78
|
private dragStarted;
|
|
82
79
|
private pressed;
|
|
83
80
|
private dragTimeout;
|
|
81
|
+
private position;
|
|
84
82
|
/**
|
|
85
83
|
* @hidden
|
|
86
84
|
*/
|
|
@@ -118,10 +116,6 @@ export declare class DragTargetDirective implements OnInit, AfterContentInit, On
|
|
|
118
116
|
* @hidden
|
|
119
117
|
*/
|
|
120
118
|
private handleDrag;
|
|
121
|
-
/**
|
|
122
|
-
* @hidden
|
|
123
|
-
*/
|
|
124
|
-
private handleRelease;
|
|
125
119
|
/**
|
|
126
120
|
* @hidden
|
|
127
121
|
*/
|
|
@@ -155,5 +149,5 @@ export declare class DragTargetDirective implements OnInit, AfterContentInit, On
|
|
|
155
149
|
*/
|
|
156
150
|
private emitEvent;
|
|
157
151
|
static ɵfac: i0.ɵɵFactoryDeclaration<DragTargetDirective, never>;
|
|
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"; "
|
|
152
|
+
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"; "dragReady": "dragReady"; "dragEnd": "dragEnd"; }, ["dragHandles"]>;
|
|
159
153
|
}
|
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { PressEvent } from './press-event';
|
|
6
6
|
export { DragStartEvent } from './start-event';
|
|
7
|
-
export { ReleaseEvent } from './release-event';
|
|
8
7
|
export { DragEndEvent } from './end-event';
|
|
9
8
|
export { DragEvent } from './drag-event';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { DragTargetDirective } from "../dragtarget.directive";
|
|
6
6
|
/**
|
|
7
7
|
* Represents the callback that is used by the
|
|
8
|
-
* [allowedDragTargets]({% slug api_utils_droptargetdirective %}#toc-alloweddragtargets) property.
|
|
8
|
+
* [`allowedDragTargets`]({% slug api_utils_droptargetdirective %}#toc-alloweddragtargets) property.
|
|
9
9
|
*
|
|
10
10
|
* ```ts-no-run
|
|
11
11
|
* isTargetAllowed(dragTarget) {
|
|
@@ -2,14 +2,5 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
export class ReleaseEvent {
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
constructor(args) {
|
|
13
|
-
Object.assign(this, args);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
5
|
+
import { NormalizedDragEvent as NormalizedEvent } from "@progress/kendo-draggable-common";
|
|
6
|
+
export declare type NormalizedDragEvent = NormalizedEvent;
|
|
@@ -7,7 +7,7 @@ import { validatePackage } from '@progress/kendo-licensing';
|
|
|
7
7
|
import { packageMetadata } from '../package-metadata';
|
|
8
8
|
import { DragHandleDirective } from "./draghandle.directive";
|
|
9
9
|
import { getScrollableParent } from "@progress/kendo-draggable-common";
|
|
10
|
-
import { DragStartEvent, DragEndEvent, PressEvent,
|
|
10
|
+
import { DragStartEvent, DragEndEvent, PressEvent, DragEvent } from "./events/drag-target";
|
|
11
11
|
import { getAction, isPresent, setElementStyles, dragTargetTransition } from './util';
|
|
12
12
|
import { contains, isDocumentAvailable } from "@progress/kendo-angular-common";
|
|
13
13
|
import { HintComponent } from "./hint.component";
|
|
@@ -46,27 +46,24 @@ export class DragTargetDirective {
|
|
|
46
46
|
this.dragDelay = 0;
|
|
47
47
|
/**
|
|
48
48
|
* Fires when the user presses the DragTarget element.
|
|
49
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
50
49
|
*/
|
|
51
50
|
this.press = new EventEmitter();
|
|
52
51
|
/**
|
|
53
52
|
* Fires when the dragging of the DragTarget element begins.
|
|
54
|
-
* This event is preventable.
|
|
53
|
+
* This event is preventable.
|
|
55
54
|
*/
|
|
56
55
|
this.dragStart = new EventEmitter();
|
|
57
56
|
/**
|
|
58
57
|
* Fires while the user drags the DragTarget element.
|
|
59
|
-
* This event is preventable.
|
|
58
|
+
* This event is preventable.
|
|
60
59
|
*/
|
|
61
60
|
this.drag = new EventEmitter();
|
|
62
61
|
/**
|
|
63
|
-
* Fires when the user
|
|
64
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
62
|
+
* Fires when the DragTarget's dragDelay has passed and the user is able to drag the element.
|
|
65
63
|
*/
|
|
66
|
-
this.
|
|
64
|
+
this.dragReady = new EventEmitter();
|
|
67
65
|
/**
|
|
68
|
-
* Fires when the dragging of the DragTarget element
|
|
69
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
66
|
+
* Fires when the dragging of the DragTarget ends and the element is released.
|
|
70
67
|
*/
|
|
71
68
|
this.dragEnd = new EventEmitter();
|
|
72
69
|
this.touchAction = 'none';
|
|
@@ -77,6 +74,7 @@ export class DragTargetDirective {
|
|
|
77
74
|
this.dragStarted = false;
|
|
78
75
|
this.pressed = false;
|
|
79
76
|
this.dragTimeout = null;
|
|
77
|
+
this.position = { x: 0, y: 0 };
|
|
80
78
|
validatePackage(packageMetadata);
|
|
81
79
|
}
|
|
82
80
|
/**
|
|
@@ -151,6 +149,9 @@ export class DragTargetDirective {
|
|
|
151
149
|
if (this.dragDelay > 0) {
|
|
152
150
|
this.dragTimeout = setTimeout(() => {
|
|
153
151
|
this.pressed = true;
|
|
152
|
+
this.ngZone.run(() => {
|
|
153
|
+
this.dragReady.emit();
|
|
154
|
+
});
|
|
154
155
|
}, this.dragDelay);
|
|
155
156
|
}
|
|
156
157
|
else {
|
|
@@ -172,12 +173,12 @@ export class DragTargetDirective {
|
|
|
172
173
|
}
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
|
-
if (isDragStartPrevented) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
176
|
this.ngZone.run(() => {
|
|
179
177
|
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
180
178
|
});
|
|
179
|
+
if (isDragStartPrevented) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
181
182
|
if (isPresent(this.hintTemplate)) {
|
|
182
183
|
this.createHint();
|
|
183
184
|
if (isPresent(this.hint)) {
|
|
@@ -187,13 +188,13 @@ export class DragTargetDirective {
|
|
|
187
188
|
this.dragStarted = this.threshold === 0;
|
|
188
189
|
this.service.dragTarget = this.dragTarget;
|
|
189
190
|
this.service.dragTargetDirective = this;
|
|
190
|
-
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
191
|
+
this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
193
194
|
* @hidden
|
|
194
195
|
*/
|
|
195
196
|
handleDrag(event) {
|
|
196
|
-
if (!this.pressed) {
|
|
197
|
+
if (!this.pressed || isDragStartPrevented) {
|
|
197
198
|
return;
|
|
198
199
|
}
|
|
199
200
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
@@ -204,24 +205,23 @@ export class DragTargetDirective {
|
|
|
204
205
|
if (isDragPrevented) {
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
let coordinates = { x: 0, y: 0 };
|
|
208
208
|
if (this.restrictByAxis === 'horizontal') {
|
|
209
|
-
|
|
209
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
210
210
|
}
|
|
211
211
|
else if (this.restrictByAxis === 'vertical') {
|
|
212
|
-
|
|
212
|
+
this.position = { x: 0, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
213
213
|
}
|
|
214
214
|
else {
|
|
215
|
-
|
|
215
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
216
216
|
}
|
|
217
|
-
const thresholdNotReached = Math.abs(
|
|
217
|
+
const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
|
|
218
218
|
if (!this.dragStarted && thresholdNotReached) {
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
if (!this.dragStarted && this.threshold > 0) {
|
|
222
222
|
this.dragStarted = true;
|
|
223
223
|
}
|
|
224
|
-
const transform = `translate(${
|
|
224
|
+
const transform = `translate(${this.position.x}px, ${this.position.y}px)`;
|
|
225
225
|
setElementStyles(this.renderer, elem, {
|
|
226
226
|
transform: transform,
|
|
227
227
|
transition: 'none'
|
|
@@ -230,40 +230,35 @@ export class DragTargetDirective {
|
|
|
230
230
|
/**
|
|
231
231
|
* @hidden
|
|
232
232
|
*/
|
|
233
|
-
|
|
233
|
+
handleDragEnd(event) {
|
|
234
234
|
if (this.dragTimeout) {
|
|
235
235
|
clearTimeout(this.dragTimeout);
|
|
236
236
|
this.dragTimeout = null;
|
|
237
237
|
this.pressed = false;
|
|
238
238
|
}
|
|
239
|
-
this.service.dragTarget
|
|
240
|
-
this.service.dragTargetDirective = null;
|
|
241
|
-
this.ngZone.run(() => {
|
|
242
|
-
const eventArgs = new ReleaseEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
243
|
-
this.release.emit(eventArgs);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* @hidden
|
|
248
|
-
*/
|
|
249
|
-
handleDragEnd(event) {
|
|
250
|
-
if (!this.dragStarted) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
this.dragStarted = false;
|
|
239
|
+
const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget, this.service.dragTarget, true);
|
|
254
240
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
241
|
+
if (isDroppedOverParentTarget || this.service.dropTargets.length > 0) {
|
|
242
|
+
this.renderer.removeStyle(elem, 'transform');
|
|
243
|
+
setElementStyles(this.renderer, elem, {
|
|
244
|
+
transition: dragTargetTransition
|
|
245
|
+
});
|
|
246
|
+
this.position = { x: 0, y: 0 };
|
|
247
|
+
}
|
|
255
248
|
if (isPresent(this.hint)) {
|
|
256
249
|
this.renderer.removeStyle(this.nativeElement, 'opacity');
|
|
257
250
|
this.destroyHint();
|
|
258
251
|
}
|
|
259
|
-
this.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
this.service.dragTarget = null;
|
|
253
|
+
this.service.dragTargetDirective = null;
|
|
254
|
+
if (!this.dragStarted || isDragStartPrevented || isDragPrevented) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
263
257
|
this.ngZone.run(() => {
|
|
264
258
|
const eventArgs = new DragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
265
259
|
this.dragEnd.emit(eventArgs);
|
|
266
260
|
});
|
|
261
|
+
this.dragStarted = false;
|
|
267
262
|
}
|
|
268
263
|
/**
|
|
269
264
|
* @hidden
|
|
@@ -273,10 +268,9 @@ export class DragTargetDirective {
|
|
|
273
268
|
element: this.nativeElement,
|
|
274
269
|
hint: null,
|
|
275
270
|
onPress: this.handlePress.bind(this),
|
|
276
|
-
onRelease: this.
|
|
271
|
+
onRelease: this.handleDragEnd.bind(this),
|
|
277
272
|
onDragStart: this.handleDragStart.bind(this),
|
|
278
|
-
onDrag: this.handleDrag.bind(this)
|
|
279
|
-
onDragEnd: this.handleDragEnd.bind(this)
|
|
273
|
+
onDrag: this.handleDrag.bind(this)
|
|
280
274
|
};
|
|
281
275
|
}
|
|
282
276
|
/**
|
|
@@ -376,7 +370,7 @@ export class DragTargetDirective {
|
|
|
376
370
|
}
|
|
377
371
|
}
|
|
378
372
|
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 });
|
|
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",
|
|
373
|
+
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", dragReady: "dragReady", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
380
374
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, decorators: [{
|
|
381
375
|
type: Directive,
|
|
382
376
|
args: [{
|
|
@@ -401,7 +395,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
401
395
|
type: Output
|
|
402
396
|
}], drag: [{
|
|
403
397
|
type: Output
|
|
404
|
-
}],
|
|
398
|
+
}], dragReady: [{
|
|
405
399
|
type: Output
|
|
406
400
|
}], dragEnd: [{
|
|
407
401
|
type: Output
|
|
@@ -47,6 +47,9 @@ export class DropTargetDirective {
|
|
|
47
47
|
* @hidden
|
|
48
48
|
*/
|
|
49
49
|
handleDragEnter(event) {
|
|
50
|
+
if (!this.service.dragTarget) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
50
53
|
let allowed = true;
|
|
51
54
|
if (isPresent(this.allowedDragTargets)) {
|
|
52
55
|
switch (typeof this.allowedDragTargets) {
|
|
@@ -66,7 +69,7 @@ export class DropTargetDirective {
|
|
|
66
69
|
if (allowed) {
|
|
67
70
|
this.service.dropTarget = this.dropTarget;
|
|
68
71
|
this.ngZone.run(() => {
|
|
69
|
-
const eventArgs = new DragEnterEvent({ event,
|
|
72
|
+
const eventArgs = new DragEnterEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
70
73
|
this.dragEnter.emit(eventArgs);
|
|
71
74
|
});
|
|
72
75
|
}
|
|
@@ -76,8 +79,11 @@ export class DropTargetDirective {
|
|
|
76
79
|
*/
|
|
77
80
|
handleDragLeave(event) {
|
|
78
81
|
this.service.dropTarget = null;
|
|
82
|
+
if (!this.service.dragTarget) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
79
85
|
this.ngZone.run(() => {
|
|
80
|
-
const eventArgs = new DragLeaveEvent({ event,
|
|
86
|
+
const eventArgs = new DragLeaveEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
81
87
|
this.dragLeave.emit(eventArgs);
|
|
82
88
|
});
|
|
83
89
|
}
|
|
@@ -85,8 +91,11 @@ export class DropTargetDirective {
|
|
|
85
91
|
* @hidden
|
|
86
92
|
*/
|
|
87
93
|
handleDragOver(event) {
|
|
94
|
+
if (!this.service.dragTarget) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
88
97
|
this.ngZone.run(() => {
|
|
89
|
-
const eventArgs = new DragOverEvent({ event,
|
|
98
|
+
const eventArgs = new DragOverEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
90
99
|
this.dragOver.emit(eventArgs);
|
|
91
100
|
});
|
|
92
101
|
}
|
|
@@ -95,10 +104,9 @@ export class DropTargetDirective {
|
|
|
95
104
|
*/
|
|
96
105
|
handleDrop(event) {
|
|
97
106
|
this.ngZone.run(() => {
|
|
98
|
-
const eventArgs = new DropEvent({ event,
|
|
107
|
+
const eventArgs = new DropEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
99
108
|
this.drop.emit(eventArgs);
|
|
100
109
|
});
|
|
101
|
-
this.service.setScrollOffset({ x: 0, y: 0 });
|
|
102
110
|
}
|
|
103
111
|
/**
|
|
104
112
|
* @hidden
|
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { PressEvent } from './press-event';
|
|
6
6
|
export { DragStartEvent } from './start-event';
|
|
7
|
-
export { ReleaseEvent } from './release-event';
|
|
8
7
|
export { DragEndEvent } from './end-event';
|
|
9
8
|
export { DragEvent } from './drag-event';
|
|
@@ -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: 1662650462,
|
|
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
|
};
|
|
@@ -8,7 +8,7 @@ import * as i1 from '@angular/common';
|
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
10
|
import { dispatchDragAndDrop, getScrollableParent, autoScroll } from '@progress/kendo-draggable-common';
|
|
11
|
-
import { PreventableEvent,
|
|
11
|
+
import { PreventableEvent, contains, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @hidden
|
|
@@ -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: 1662650462,
|
|
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
|
};
|
|
@@ -69,18 +69,6 @@ class DragStartEvent extends PreventableEvent {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* Arguments for the release event of the DragTarget.
|
|
74
|
-
*/
|
|
75
|
-
class ReleaseEvent {
|
|
76
|
-
/**
|
|
77
|
-
* @hidden
|
|
78
|
-
*/
|
|
79
|
-
constructor(args) {
|
|
80
|
-
Object.assign(this, args);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
72
|
/**
|
|
85
73
|
* Arguments for the dragEnd event of the DragTarget.
|
|
86
74
|
*/
|
|
@@ -329,27 +317,24 @@ class DragTargetDirective {
|
|
|
329
317
|
this.dragDelay = 0;
|
|
330
318
|
/**
|
|
331
319
|
* Fires when the user presses the DragTarget element.
|
|
332
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
333
320
|
*/
|
|
334
321
|
this.press = new EventEmitter();
|
|
335
322
|
/**
|
|
336
323
|
* Fires when the dragging of the DragTarget element begins.
|
|
337
|
-
* This event is preventable.
|
|
324
|
+
* This event is preventable.
|
|
338
325
|
*/
|
|
339
326
|
this.dragStart = new EventEmitter();
|
|
340
327
|
/**
|
|
341
328
|
* Fires while the user drags the DragTarget element.
|
|
342
|
-
* This event is preventable.
|
|
329
|
+
* This event is preventable.
|
|
343
330
|
*/
|
|
344
331
|
this.drag = new EventEmitter();
|
|
345
332
|
/**
|
|
346
|
-
* Fires when the user
|
|
347
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
333
|
+
* Fires when the DragTarget's dragDelay has passed and the user is able to drag the element.
|
|
348
334
|
*/
|
|
349
|
-
this.
|
|
335
|
+
this.dragReady = new EventEmitter();
|
|
350
336
|
/**
|
|
351
|
-
* Fires when the dragging of the DragTarget element
|
|
352
|
-
* This event is preventable. Preventing it allows full logic customization.
|
|
337
|
+
* Fires when the dragging of the DragTarget ends and the element is released.
|
|
353
338
|
*/
|
|
354
339
|
this.dragEnd = new EventEmitter();
|
|
355
340
|
this.touchAction = 'none';
|
|
@@ -360,6 +345,7 @@ class DragTargetDirective {
|
|
|
360
345
|
this.dragStarted = false;
|
|
361
346
|
this.pressed = false;
|
|
362
347
|
this.dragTimeout = null;
|
|
348
|
+
this.position = { x: 0, y: 0 };
|
|
363
349
|
validatePackage(packageMetadata);
|
|
364
350
|
}
|
|
365
351
|
/**
|
|
@@ -434,6 +420,9 @@ class DragTargetDirective {
|
|
|
434
420
|
if (this.dragDelay > 0) {
|
|
435
421
|
this.dragTimeout = setTimeout(() => {
|
|
436
422
|
this.pressed = true;
|
|
423
|
+
this.ngZone.run(() => {
|
|
424
|
+
this.dragReady.emit();
|
|
425
|
+
});
|
|
437
426
|
}, this.dragDelay);
|
|
438
427
|
}
|
|
439
428
|
else {
|
|
@@ -455,12 +444,12 @@ class DragTargetDirective {
|
|
|
455
444
|
}
|
|
456
445
|
return;
|
|
457
446
|
}
|
|
458
|
-
if (isDragStartPrevented) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
447
|
this.ngZone.run(() => {
|
|
462
448
|
isDragStartPrevented = this.emitEvent('dragStart', { normalizedEvent: event, hostElement: this.nativeElement }).isDefaultPrevented();
|
|
463
449
|
});
|
|
450
|
+
if (isDragStartPrevented) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
464
453
|
if (isPresent(this.hintTemplate)) {
|
|
465
454
|
this.createHint();
|
|
466
455
|
if (isPresent(this.hint)) {
|
|
@@ -470,13 +459,13 @@ class DragTargetDirective {
|
|
|
470
459
|
this.dragStarted = this.threshold === 0;
|
|
471
460
|
this.service.dragTarget = this.dragTarget;
|
|
472
461
|
this.service.dragTargetDirective = this;
|
|
473
|
-
this.initialPosition = { x: event.clientX, y: event.clientY };
|
|
462
|
+
this.initialPosition = { x: event.clientX - this.position.x, y: event.clientY - this.position.y };
|
|
474
463
|
}
|
|
475
464
|
/**
|
|
476
465
|
* @hidden
|
|
477
466
|
*/
|
|
478
467
|
handleDrag(event) {
|
|
479
|
-
if (!this.pressed) {
|
|
468
|
+
if (!this.pressed || isDragStartPrevented) {
|
|
480
469
|
return;
|
|
481
470
|
}
|
|
482
471
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
@@ -487,24 +476,23 @@ class DragTargetDirective {
|
|
|
487
476
|
if (isDragPrevented) {
|
|
488
477
|
return;
|
|
489
478
|
}
|
|
490
|
-
let coordinates = { x: 0, y: 0 };
|
|
491
479
|
if (this.restrictByAxis === 'horizontal') {
|
|
492
|
-
|
|
480
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: 0 };
|
|
493
481
|
}
|
|
494
482
|
else if (this.restrictByAxis === 'vertical') {
|
|
495
|
-
|
|
483
|
+
this.position = { x: 0, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
496
484
|
}
|
|
497
485
|
else {
|
|
498
|
-
|
|
486
|
+
this.position = { x: event.clientX - this.initialPosition.x + event.scrollX, y: event.clientY - this.initialPosition.y + event.scrollY };
|
|
499
487
|
}
|
|
500
|
-
const thresholdNotReached = Math.abs(
|
|
488
|
+
const thresholdNotReached = Math.abs(this.position.x) < this.threshold && Math.abs(this.position.y) < this.threshold;
|
|
501
489
|
if (!this.dragStarted && thresholdNotReached) {
|
|
502
490
|
return;
|
|
503
491
|
}
|
|
504
492
|
if (!this.dragStarted && this.threshold > 0) {
|
|
505
493
|
this.dragStarted = true;
|
|
506
494
|
}
|
|
507
|
-
const transform = `translate(${
|
|
495
|
+
const transform = `translate(${this.position.x}px, ${this.position.y}px)`;
|
|
508
496
|
setElementStyles(this.renderer, elem, {
|
|
509
497
|
transform: transform,
|
|
510
498
|
transition: 'none'
|
|
@@ -513,40 +501,35 @@ class DragTargetDirective {
|
|
|
513
501
|
/**
|
|
514
502
|
* @hidden
|
|
515
503
|
*/
|
|
516
|
-
|
|
504
|
+
handleDragEnd(event) {
|
|
517
505
|
if (this.dragTimeout) {
|
|
518
506
|
clearTimeout(this.dragTimeout);
|
|
519
507
|
this.dragTimeout = null;
|
|
520
508
|
this.pressed = false;
|
|
521
509
|
}
|
|
522
|
-
this.service.dragTarget
|
|
523
|
-
this.service.dragTargetDirective = null;
|
|
524
|
-
this.ngZone.run(() => {
|
|
525
|
-
const eventArgs = new ReleaseEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
526
|
-
this.release.emit(eventArgs);
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* @hidden
|
|
531
|
-
*/
|
|
532
|
-
handleDragEnd(event) {
|
|
533
|
-
if (!this.dragStarted) {
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
this.dragStarted = false;
|
|
510
|
+
const isDroppedOverParentTarget = isPresent(this.service.dropTarget) && !contains(this.service.dropTarget, this.service.dragTarget, true);
|
|
537
511
|
const elem = this.hint ? this.hintElem : this.nativeElement;
|
|
512
|
+
if (isDroppedOverParentTarget || this.service.dropTargets.length > 0) {
|
|
513
|
+
this.renderer.removeStyle(elem, 'transform');
|
|
514
|
+
setElementStyles(this.renderer, elem, {
|
|
515
|
+
transition: dragTargetTransition
|
|
516
|
+
});
|
|
517
|
+
this.position = { x: 0, y: 0 };
|
|
518
|
+
}
|
|
538
519
|
if (isPresent(this.hint)) {
|
|
539
520
|
this.renderer.removeStyle(this.nativeElement, 'opacity');
|
|
540
521
|
this.destroyHint();
|
|
541
522
|
}
|
|
542
|
-
this.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
523
|
+
this.service.dragTarget = null;
|
|
524
|
+
this.service.dragTargetDirective = null;
|
|
525
|
+
if (!this.dragStarted || isDragStartPrevented || isDragPrevented) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
546
528
|
this.ngZone.run(() => {
|
|
547
529
|
const eventArgs = new DragEndEvent({ normalizedEvent: event, hostElement: this.nativeElement });
|
|
548
530
|
this.dragEnd.emit(eventArgs);
|
|
549
531
|
});
|
|
532
|
+
this.dragStarted = false;
|
|
550
533
|
}
|
|
551
534
|
/**
|
|
552
535
|
* @hidden
|
|
@@ -556,10 +539,9 @@ class DragTargetDirective {
|
|
|
556
539
|
element: this.nativeElement,
|
|
557
540
|
hint: null,
|
|
558
541
|
onPress: this.handlePress.bind(this),
|
|
559
|
-
onRelease: this.
|
|
542
|
+
onRelease: this.handleDragEnd.bind(this),
|
|
560
543
|
onDragStart: this.handleDragStart.bind(this),
|
|
561
|
-
onDrag: this.handleDrag.bind(this)
|
|
562
|
-
onDragEnd: this.handleDragEnd.bind(this)
|
|
544
|
+
onDrag: this.handleDrag.bind(this)
|
|
563
545
|
};
|
|
564
546
|
}
|
|
565
547
|
/**
|
|
@@ -659,7 +641,7 @@ class DragTargetDirective {
|
|
|
659
641
|
}
|
|
660
642
|
}
|
|
661
643
|
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 });
|
|
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",
|
|
644
|
+
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", dragReady: "dragReady", dragEnd: "dragEnd" }, host: { properties: { "style.touch-action": "this.touchAction" } }, queries: [{ propertyName: "dragHandles", predicate: DragHandleDirective }], exportAs: ["kendoDragTarget"], ngImport: i0 });
|
|
663
645
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DragTargetDirective, decorators: [{
|
|
664
646
|
type: Directive,
|
|
665
647
|
args: [{
|
|
@@ -684,7 +666,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
684
666
|
type: Output
|
|
685
667
|
}], drag: [{
|
|
686
668
|
type: Output
|
|
687
|
-
}],
|
|
669
|
+
}], dragReady: [{
|
|
688
670
|
type: Output
|
|
689
671
|
}], dragEnd: [{
|
|
690
672
|
type: Output
|
|
@@ -782,6 +764,9 @@ class DropTargetDirective {
|
|
|
782
764
|
* @hidden
|
|
783
765
|
*/
|
|
784
766
|
handleDragEnter(event) {
|
|
767
|
+
if (!this.service.dragTarget) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
785
770
|
let allowed = true;
|
|
786
771
|
if (isPresent(this.allowedDragTargets)) {
|
|
787
772
|
switch (typeof this.allowedDragTargets) {
|
|
@@ -801,7 +786,7 @@ class DropTargetDirective {
|
|
|
801
786
|
if (allowed) {
|
|
802
787
|
this.service.dropTarget = this.dropTarget;
|
|
803
788
|
this.ngZone.run(() => {
|
|
804
|
-
const eventArgs = new DragEnterEvent({ event,
|
|
789
|
+
const eventArgs = new DragEnterEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
805
790
|
this.dragEnter.emit(eventArgs);
|
|
806
791
|
});
|
|
807
792
|
}
|
|
@@ -811,8 +796,11 @@ class DropTargetDirective {
|
|
|
811
796
|
*/
|
|
812
797
|
handleDragLeave(event) {
|
|
813
798
|
this.service.dropTarget = null;
|
|
799
|
+
if (!this.service.dragTarget) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
814
802
|
this.ngZone.run(() => {
|
|
815
|
-
const eventArgs = new DragLeaveEvent({ event,
|
|
803
|
+
const eventArgs = new DragLeaveEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
816
804
|
this.dragLeave.emit(eventArgs);
|
|
817
805
|
});
|
|
818
806
|
}
|
|
@@ -820,8 +808,11 @@ class DropTargetDirective {
|
|
|
820
808
|
* @hidden
|
|
821
809
|
*/
|
|
822
810
|
handleDragOver(event) {
|
|
811
|
+
if (!this.service.dragTarget) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
823
814
|
this.ngZone.run(() => {
|
|
824
|
-
const eventArgs = new DragOverEvent({ event,
|
|
815
|
+
const eventArgs = new DragOverEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
825
816
|
this.dragOver.emit(eventArgs);
|
|
826
817
|
});
|
|
827
818
|
}
|
|
@@ -830,10 +821,9 @@ class DropTargetDirective {
|
|
|
830
821
|
*/
|
|
831
822
|
handleDrop(event) {
|
|
832
823
|
this.ngZone.run(() => {
|
|
833
|
-
const eventArgs = new DropEvent({ event,
|
|
824
|
+
const eventArgs = new DropEvent({ normalizedEvent: event, hostElement: this.element.nativeElement });
|
|
834
825
|
this.drop.emit(eventArgs);
|
|
835
826
|
});
|
|
836
|
-
this.service.setScrollOffset({ x: 0, y: 0 });
|
|
837
827
|
}
|
|
838
828
|
/**
|
|
839
829
|
* @hidden
|
|
@@ -941,5 +931,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
941
931
|
* Generated bundle index. Do not edit.
|
|
942
932
|
*/
|
|
943
933
|
|
|
944
|
-
export { DragAndDropModule, DragEndEvent, DragEnterEvent, DragEvent, DragHandleDirective, DragLeaveEvent, DragOverEvent, DragStartEvent, DragTargetDirective, DropEvent, DropTargetDirective, HintComponent, PressEvent,
|
|
934
|
+
export { DragAndDropModule, DragEndEvent, DragEnterEvent, DragEvent, DragHandleDirective, DragLeaveEvent, DragOverEvent, DragStartEvent, DragTargetDirective, DropEvent, DropTargetDirective, HintComponent, PressEvent, UtilsModule };
|
|
945
935
|
|
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, Coordinates } from './drag-and-drop/models/index';
|
|
11
|
+
export { DragAxis, AutoScrollOptions, AllowedTargetFn, ScrollDirection, Coordinates, NormalizedDragEvent } 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,22 +0,0 @@
|
|
|
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
|
-
import { NormalizedDragEvent } from '@progress/kendo-draggable-common';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the release event of the DragTarget.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ReleaseEvent {
|
|
10
|
-
/**
|
|
11
|
-
* The normalized event.
|
|
12
|
-
*/
|
|
13
|
-
normalizedEvent: NormalizedDragEvent;
|
|
14
|
-
/**
|
|
15
|
-
* The DOM element that is released.
|
|
16
|
-
*/
|
|
17
|
-
hostElement: HTMLElement;
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
constructor(args?: any);
|
|
22
|
-
}
|