UNPKG

@duoduo-oba/ng-devui

Version:

DevUI components based on Angular

15 lines (13 loc) 69.6 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("ng-devui/overlay-container"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-devui/dragdrop",["exports","@angular/core","rxjs","ng-devui/overlay-container","rxjs/operators","@angular/common"],t):t(((e=e||self)["ng-devui"]=e["ng-devui"]||{},e["ng-devui"].dragdrop={}),e.ng.core,e.rxjs,e["ng-devui"]["overlay-container"],e.rxjs.operators,e.ng.common)}(this,(function(e,t,r,i,o,n){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function s(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function d(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var l=function(){function e(){var t=this;if(this.lastClick=0,this.touchstart=function(r){if(t.shouldHandle(r)){if(Date.now()-t.lastClick<e.DBLCLICK&&t.dispatchEvent(r,"dblclick",r.target))return r.preventDefault(),void t.reset();t.reset();var i=t.closestDraggable(r.target);i&&(t.dragSource=i,t.ptDown=t.getPoint(r),t.lastTouch=r,e.IS_PRESS_HOLD_MODE?t.pressHoldInterval=setTimeout((function(){t.bindTouchmoveTouchend(r),t.isDragEnabled=!0,t.touchmove(r)}),e.PRESS_HOLD_AWAIT):(r.preventDefault(),t.bindTouchmoveTouchend(r)))}},this.touchmoveOnDocument=function(e){t.shouldCancelPressHoldMove(e)&&t.reset()},this.touchmove=function(e){if(t.shouldCancelPressHoldMove(e))t.reset();else if(t.shouldHandleMove(e)||t.shouldHandlePressHoldMove(e)){var r=t.getTarget(e);t.dragSource&&!t.img&&t.shouldStartDragging(e)&&(t.dispatchEvent(e,"dragstart",t.dragSource),t.createImage(e)),t.img&&(t.clearDragoverInterval(),t.lastTouch=e,e.preventDefault(),r!==t.lastTarget&&(t.dispatchEvent(e,"dragenter",r),t.dispatchEvent(t.lastTouch,"dragleave",t.lastTarget),t.lastTarget=r),t.moveImage(e),t.isDropZone=t.dispatchEvent(e,"dragover",r),t.setDragoverInterval(e))}},this.touchendOnDocument=function(e){t.shouldHandle(e)&&(t.img||(t.dragSource=null,t.lastClick=Date.now()),t.destroyImage(),t.dragSource&&t.reset())},this.touchend=function(e){t.shouldHandle(e)&&(t.img||(t.dragSource=null,t.lastClick=Date.now()),t.destroyImage(),t.dragSource&&(e.type.indexOf("cancel")<0&&t.isDropZone&&t.dispatchEvent(t.lastTouch,"drop",t.lastTarget),t.dispatchEvent(t.lastTouch,"dragend",t.dragSource),t.reset()))},e.instance)throw new Error("DragDropTouch instance already created.");var r=!1;if(document.addEventListener("test",(function(){}),{get passive(){return r=!0,!0}}),e.isTouchDevice()){var i=document,o=this.touchstart,n=this.touchmoveOnDocument,a=this.touchendOnDocument,s=!!r&&{passive:!1,capture:!1},d=!!r&&{passive:!0};i.addEventListener("touchstart",o,s),i.addEventListener("touchmove",n,d),i.addEventListener("touchend",a),i.addEventListener("touchcancel",a),this.touchmoveListener=this.touchmove,this.touchendListener=this.touchend,this.listenerOpt=s}}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.isTouchDevice=function(){var e,t=document,r=window;if("ontouchstart"in t||"ontouchstart"in r||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch)e=!0;else{var i=document.createElement("fakebody");i.innerHTML+="\n <style>\n @media (touch-enabled),(-webkit-touch-enabled),(-moz-touch-enabled),(-o-touch-enabled){\n #touch_test {\n top: 42px;\n position: absolute;\n }\n }\n </style>",document.documentElement.appendChild(i);var o=document.createElement("div");o.id="touch_test",i.appendChild(o),e=42===o.offsetTop,i.parentElement.removeChild(i)}return e},e.prototype.bindTouchmoveTouchend=function(e){this.touchTarget=e.target,e.target.addEventListener("touchmove",this.touchmoveListener,this.listenerOpt),e.target.addEventListener("touchend",this.touchendListener),e.target.addEventListener("touchcancel",this.touchendListener)},e.prototype.removeTouchmoveTouchend=function(){this.touchTarget&&(this.touchTarget.removeEventListener("touchmove",this.touchmoveListener),this.touchTarget.removeEventListener("touchend",this.touchendListener),this.touchTarget.removeEventListener("touchcancel",this.touchendListener),this.touchTarget=void 0)},e.prototype.shouldHandle=function(e){return e&&!e.defaultPrevented&&e.touches&&e.touches.length<2},e.prototype.shouldHandleMove=function(t){return!e.IS_PRESS_HOLD_MODE&&this.shouldHandle(t)},e.prototype.shouldHandlePressHoldMove=function(t){return e.IS_PRESS_HOLD_MODE&&this.isDragEnabled&&t&&t.touches&&t.touches.length},e.prototype.shouldCancelPressHoldMove=function(t){return e.IS_PRESS_HOLD_MODE&&!this.isDragEnabled&&this.getDelta(t)>e.PRESS_HOLD_MARGIN},e.prototype.shouldStartDragging=function(t){var r=this.getDragHandle();if(r&&!this.matchSelector(t.target,r))return!1;var i=this.getDelta(t);return i>e.THRESHOLD||e.IS_PRESS_HOLD_MODE&&i>=e.PRESS_HOLD_THRESHOLD},e.prototype.getDragHandle=function(){return this.dragSource&&this.dragSource.getAttribute(e.DRAG_HANDLE_ATTR)||""},e.prototype.matchSelector=function(e,t){if(t){var r=Element.prototype;return(r.matches||r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;--r>=0&&t.item(r)!==this;);return r>-1}).call(e,t)}return!0},e.prototype.reset=function(){this.removeTouchmoveTouchend(),this.destroyImage(),this.dragSource=null,this.lastTouch=null,this.lastTarget=null,this.ptDown=null,this.isDragEnabled=!1,this.isDropZone=!1,this.dataTransfer=new e.DataTransfer,clearInterval(this.pressHoldInterval),this.clearDragoverInterval()},e.prototype.getPoint=function(e,t){return e&&e.touches&&(e=e.touches[0]),{x:t?e.pageX:e.clientX,y:t?e.pageY:e.clientY}},e.prototype.getDelta=function(t){if(e.IS_PRESS_HOLD_MODE&&!this.ptDown)return 0;var r=this.getPoint(t);return Math.abs(r.x-this.ptDown.x)+Math.abs(r.y-this.ptDown.y)},e.prototype.getTarget=function(e){for(var t=this.getPoint(e),r=document.elementFromPoint(t.x,t.y);r&&"none"===getComputedStyle(r).pointerEvents;)r=r.parentElement;return(r)},e.prototype.createImage=function(t){this.img&&this.destroyImage();var r=this.imgCustom||this.dragSource;if(this.img=r.cloneNode(!0),this.copyStyle(r,this.img),this.img.style.top=this.img.style.left="-9999px",!this.imgCustom){var i=r.getBoundingClientRect(),o=this.getPoint(t);this.imgOffset={x:o.x-i.left,y:o.y-i.top},this.img.style.opacity=e.OPACITY.toString()}this.moveImage(t),document.body.appendChild(this.img)},e.prototype.destroyImage=function(){this.img&&this.img.parentElement&&this.img.parentElement.removeChild(this.img),this.img=null,this.imgCustom=null},e.prototype.moveImage=function(e){var t=this;requestAnimationFrame((function(){if(t.img){var r=t.getPoint(e,!0),i=t.img.style;i.position="absolute",i.pointerEvents="none",i.zIndex="999999",i.left=Math.round(r.x-t.imgOffset.x)+"px",i.top=Math.round(r.y-t.imgOffset.y)+"px"}}))},e.prototype.copyProps=function(e,t,r){for(var i=0;i<r.length;i++){var o=r[i];e[o]=t[o]}},e.prototype.copyStyle=function(t,r){if(e.rmvAttrs.forEach((function(e){r.removeAttribute(e)})),t instanceof HTMLCanvasElement){var i=t,o=r;o.width=i.width,o.height=i.height,o.getContext("2d").drawImage(i,0,0)}var n=t.querySelectorAll("canvas");if(n.length>0)for(var a=r.querySelectorAll("canvas"),s=0;s<a.length;s++){var d=n[s];a[s].getContext("2d").drawImage(d,0,0)}var l=getComputedStyle(t);for(s=0;s<l.length;s++){var c=l[s];c.indexOf("transition")<0&&(r.style[c]=l[c])}r.style.pointerEvents="none";for(s=0;s<t.children.length;s++)this.copyStyle(t.children[s],r.children[s])},e.prototype.dispatchEvent=function(t,r,i){if(t&&i){var o=document.createEvent("Event"),n=t.touches?t.touches[0]:t;o.initEvent(r,!0,!0);var a={button:0,which:0,buttons:1,dataTransfer:this.dataTransfer};return this.copyProps(o,t,e.kbdProps),this.copyProps(o,n,e.ptProps),this.copyProps(o,{fromTouch:!0},["fromTouch"]),this.copyProps(o,a,Object.keys(a)),i.dispatchEvent(o),o.defaultPrevented}return!1},e.prototype.closestDraggable=function(e){for(;e;e=e.parentElement)if(e.hasAttribute("draggable")&&e.draggable)return e;return null},e.prototype.setDragoverInterval=function(t){var r=this;this.dragoverTimer=setInterval((function(){var e=r.getTarget(t);e!==r.lastTarget&&(r.dispatchEvent(t,"dragenter",e),r.dispatchEvent(t,"dragleave",r.lastTarget),r.lastTarget=e),r.isDropZone=r.dispatchEvent(t,"dragover",e)}),e.DRAG_OVER_TIME)},e.prototype.clearDragoverInterval=function(){this.dragoverTimer&&(clearInterval(this.dragoverTimer),this.dragoverTimer=void 0)},e.THRESHOLD=5,e.OPACITY=.5,e.DBLCLICK=500,e.DRAG_OVER_TIME=300,e.CTX_MENU=900,e.IS_PRESS_HOLD_MODE=!0,e.PRESS_HOLD_AWAIT=400,e.PRESS_HOLD_MARGIN=25,e.PRESS_HOLD_THRESHOLD=0,e.DRAG_HANDLE_ATTR="data-drag-handle-selector",e.rmvAttrs="id,class,style,draggable".split(","),e.kbdProps="altKey,ctrlKey,metaKey,shiftKey".split(","),e.ptProps="pageX,pageY,clientX,clientY,screenX,screenY".split(","),e.instance=null,e}();(function(e){var t=function(){function t(){this._dropEffect="move",this._effectAllowed="all",this._data={}}return Object.defineProperty(t.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(e){this._dropEffect=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(e){this._effectAllowed=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0}),t.prototype.clearData=function(e){null!==e?delete this._data[e]:this._data=null},t.prototype.getData=function(e){return this._data[e]||""},t.prototype.setData=function(e,t){this._data[e]=t},t.prototype.setDragImage=function(t,r,i){var o=e.getInstance();o.imgCustom=t,o.imgOffset={x:r,y:i}},t}();e.DataTransfer=t})(l||(l={}));var c=function(){function e(){}return e.matches=function(e,t){var r=Element.prototype;return(r.matches||r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;--r>=0&&t.item(r)!==this;);return r>-1}).call(e,t)},e.addClass=function(e,t){if(void 0!==t){var r=this.getElementWithValidClassList(e);r&&r.classList.add(t)}},e.removeClass=function(e,t){if(void 0!==t){var r=this.getElementWithValidClassList(e);r&&r.classList.remove(t)}},e.getElementWithValidClassList=function(e){var r=e instanceof t.ElementRef?e.nativeElement:e;return void 0!==r.classList&&null!==r.classList?r:null},e.slice=function(e,t,r){var i=[],o=e.length;if(0===o)return i;var n=t<0?Math.max(0,t+o):t||0;for(void 0!==r&&(o=r<0?r+o:r);o-- >n;)i[o-n]=e[o];return i},e.addElStyles=function(e,t){if(t instanceof Object){var r=function(r){t.hasOwnProperty(r)&&(Array.isArray(t[r])?t[r].forEach((function(t){e.style[r]=t})):e.style[r]=t[r])};for(var i in t)r(i)}},e}(),h=function(){function e(e){var t=this;this.ngZone=e,this.dropTargets=[],this.dropEvent=new r.Subject,this.dragEndEvent=new r.Subject,this.dragStartEvent=new r.Subject,this.subscription=r.Observable.create().subscribe(),this.dragEmptyImage=new Image,this.dragItemParentName="",this.dragItemChildrenName="",this.intersectionObserver=null,this.dragElShowHideEvent=new r.Subject,this.followMouse4CloneNode=function(e){var r=t.dragOffset,i=r.offsetLeft,o=r.offsetTop,n=e.clientX,a=e.clientY;requestAnimationFrame((function(){t.dragCloneNode&&(t.dragCloneNode.style.left=n-i+"px",t.dragCloneNode.style.top=a-o+"px")}))},this.touchInstance=l.getInstance(),this.dragEmptyImage.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg=="}return e.prototype.newSubscription=function(){return this.subscription.unsubscribe(),this.subscription=r.Observable.create().subscribe()},e.prototype.enableDraggedCloneNodeFollowMouse=function(){var e=this;if(!this.dragCloneNode){if(this.dragItemContainer=this.draggedEl.parentElement,this.dragPreviewDirective&&this.dragPreviewDirective.dragPreviewTemplate?(this.dragPreviewDirective.createPreview(),this.dragCloneNode=this.dragPreviewDirective.getPreviewElement(),this.dragItemContainer=document.body):this.dragCloneNode=this.draggedEl.cloneNode(!0),this.dragCloneNode.style.margin="0",this.dragFollowOptions&&this.dragFollowOptions.appendToBody&&(this.dragItemContainer=document.body,this.copyStyle(this.draggedEl,this.dragCloneNode)),""!==this.dragItemChildrenName){var t=""===this.dragItemParentName?this.dragCloneNode:document.querySelector(this.dragItemParentName),r=t.querySelectorAll(this.dragItemChildrenName);this.interceptChildNode(t,r)}var i=this.draggedEl.querySelectorAll("canvas"),o=this.dragCloneNode.querySelectorAll("canvas");if([].forEach.call(o,(function(e,t){e.getContext("2d").drawImage(i[t],0,0)})),this.ngZone.runOutsideAngular((function(){document.addEventListener("dragover",e.followMouse4CloneNode,{capture:!0,passive:!0})})),this.dragCloneNode.style.width=this.dragOffset.width+"px",this.dragCloneNode.style.height=this.dragOffset.height+"px",!(this.dragPreviewDirective&&this.dragPreviewDirective.dragPreviewTemplate&&this.dragPreviewDirective.dragPreviewOptions&&this.dragPreviewDirective.dragPreviewOptions.skipBatchPreview)&&this.batchDragging&&this.batchDragData&&this.batchDragData.length>1){var n=document.createElement("div");if(n.appendChild(this.dragCloneNode),n.classList.add("batch-dragged-node"),this.batchDragStyle&&this.batchDragStyle.length&&this.batchDragStyle.indexOf("badge")>-1){var a=document.createElement("div");a.innerText=this.batchDragData.length+"",a.classList.add("batch-dragged-node-count"),n.style.position="relative";c.addElStyles(a,{position:"absolute",right:"5px",top:"-12px",height:"24px",width:"24px",borderRadius:"12px",fontSize:"14px",lineHeight:"24px",textAlign:"center",color:"#fff",background:["#5170ff","var(--brand-1, #5170ff)"]}),n.appendChild(a)}if(this.batchDragStyle&&this.batchDragStyle.length&&this.batchDragStyle.indexOf("stack")>-1){var s=2;2===this.batchDragData.length&&(s=1);for(var d=0;d<s;d++){var l=this.dragCloneNode.cloneNode(!1),h={position:"absolute",left:-5*(d+1)+"px",top:-5*(d+1)+"px",zIndex:-(d+1)+"",width:this.dragOffset.width+"px",height:this.dragOffset.height+"px",background:"#fff",border:["1px solid #5170ff","1px solid var(--brand-1, #5170ff)"]};c.addElStyles(l,h),n.appendChild(l)}}this.dragCloneNode=n}this.dragCloneNode.classList.add("drag-clone-node"),this.dragPreviewDirective&&this.dragPreviewDirective.dragPreviewTemplate||(this.dragCloneNode.style.width=this.dragOffset.width+"px",this.dragCloneNode.style.height=this.dragOffset.height+"px"),this.dragCloneNode.style.position="fixed",this.dragCloneNode.style.zIndex="1090",this.dragCloneNode.style.pointerEvents="none",this.dragCloneNode.style.top=this.dragOffset.top+"px",this.dragCloneNode.style.left=this.dragOffset.left+"px",this.dragCloneNode.style.willChange="left, top",this.dragItemContainer.appendChild(this.dragCloneNode),this.ngZone.runOutsideAngular((function(){setTimeout((function(){e.draggedEl&&(e.draggedEl.style.display="none",e.dragElShowHideEvent.next(!1),e.dragOriginPlaceholder&&(e.dragOriginPlaceholder.style.display="block"))}))}))}},e.prototype.disableDraggedCloneNodeFollowMouse=function(){this.dragCloneNode&&(document.removeEventListener("dragover",this.followMouse4CloneNode,{capture:!0}),this.dragItemContainer.removeChild(this.dragCloneNode),this.draggedEl.style.display="",this.dragElShowHideEvent.next(!0)),this.dragPreviewDirective&&this.dragPreviewDirective.dragPreviewTemplate&&this.dragPreviewDirective.destroyPreview(),this.dragCloneNode=void 0,this.dragItemContainer=void 0,this.intersectionObserver&&this.intersectionObserver.disconnect()},e.prototype.interceptChildNode=function(e,t){var r=this,i={root:e};this.intersectionObserver=new IntersectionObserver(this.setChildNodeHide,i),[].forEach.call(t,(function(e){r.intersectionObserver.observe(e)}))},e.prototype.setChildNodeHide=function(e){e.forEach((function(e){var t=e.isIntersecting,r=e.target;r.style.display=t?"block":"none"}))},e.prototype.getBatchDragData=function(e,t){void 0===t&&(t="draggedElFirst");var r=this.batchDragData.map((function(e){return e.dragData}));if("function"==typeof t)r.sort(t);else if("draggedElFirst"===t){var i=this.dragData;if(e)i=this.batchDragData.filter((function(t){return t.identity===e})).pop().dragData;r.splice(r.indexOf(i),1),r.splice(0,0,i)}return r},e.prototype.cleanBatchDragData=function(){var e=this.batchDragData;return this.batchDragData&&(this.batchDragData.filter((function(e){return e.draggable})).map((function(e){return e.draggable})).forEach((function(e){return e.batchDraggable.dragData=void 0})),this.batchDragData=void 0,this.batchDragGroup=void 0),e},e.prototype.copyStyle=function(e,t){["id","class","style","draggable"].forEach((function(e){t.removeAttribute(e)}));for(var r=getComputedStyle(e),i=0;i<r.length;i++){var o=r[i];o.indexOf("transition")<0&&(t.style[o]=r[o])}t.style.pointerEvents="none";for(i=0;i<e.children.length;i++)this.copyStyle(e.children[i],t.children[i])},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:t.NgZone}]},e}();var g=function(e){function t(t){void 0===t&&(t=!1);var r=e.call(this,t)||this;return r._isAsync=t,r}return s(t,e),Object.defineProperty(t.prototype,"schedulerFns",{get:function(){return this._schedulerFns},enumerable:!0,configurable:!0}),t.prototype.forceCallback=function(e,t){void 0===t&&(t=!1),this.schedulerFns&&this.schedulerFns.size&&(this.schedulerFns.forEach((function(t){t(e)})),t&&this.cleanCallbackFn())},t.prototype.cleanCallbackFn=function(){this._schedulerFns=void 0},t.prototype.emit=function(t){e.prototype.emit.call(this,t)},t.prototype.subscribe=function(t,r,i){var o;return o=t&&"object"==typeof t?this._isAsync?function(e){setTimeout((function(){return t.next(e)}))}:function(e){t.next(e)}:this._isAsync?function(e){setTimeout((function(){return t(e)}))}:function(e){t(e)},this._schedulerFns||(this._schedulerFns=new Set),this._schedulerFns.add(o),e.prototype.subscribe.call(this,t,r,i)},t}(t.EventEmitter);var p=function(){function e(e,t){this.el=e,this.cdr=t,this.element=e.nativeElement}return e.prototype.updateTemplate=function(){this.cdr.detectChanges()},e.decorators=[{type:t.Component,args:[{selector:"d-drag-preview",template:'<ng-template\r\n [ngTemplateOutlet]="templateRef"\r\n [ngTemplateOutletContext]="{\r\n data: data,\r\n draggedEl: draggedEl,\r\n dragData: dragData,\r\n batchDragData: batchDragData,\r\n dragSyncDOMElements: dragSyncDOMElements\r\n }"\r\n>\r\n</ng-template>\r\n'}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.ChangeDetectorRef}]},e}();var u=function(){function e(e,t,r){this.componentFactoryResolver=e,this.overlayContainerRef=t,this.dragDropService=r,this.dragPreviewOptions={skipBatchPreview:!1}}return e.prototype.createPreview=function(){var e=this.componentFactoryResolver,t=this.overlayContainerRef.createComponent(e.resolveComponentFactory(p));return this.previewRef=t,this.updateData(),this.previewRef},e.prototype.updateData=function(){Object.assign(this.previewRef.instance,{templateRef:this.dragPreviewTemplate,data:this.dragPreviewData,draggedEl:this.dragDropService.draggedEl,dragData:this.dragDropService.dragData,batchDragData:this.dragDropService.batchDragData&&this.dragDropService.getBatchDragData(),dragSyncDOMElements:this.dragDropService.dragSyncGroupDirectives&&this.getDragSyncDOMElements()}),this.previewRef.instance.updateTemplate()},e.prototype.destroyPreview=function(){this.previewRef&&this.previewRef.hostView.destroy()},e.prototype.getPreviewElement=function(){return this.previewRef&&this.previewRef.instance.element},e.prototype.getDragSyncDOMElements=function(){return this.dragDropService.dragSyncGroupDirectives.map((function(e){return e.el.nativeElement}))},e.decorators=[{type:t.Directive,args:[{selector:"[dDraggable][dDragPreview]",exportAs:"dDragPreview"}]}],e.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:i.OverlayContainerRef},{type:h}]},e.propDecorators={dragPreviewTemplate:[{type:t.Input,args:["dDragPreview"]}],dragPreviewData:[{type:t.Input}],dragPreviewOptions:[{type:t.Input}]},e}();var v=function(){function e(e,i,o,n,a){var s=this;this.el=e,this.renderer=i,this.dragDropService=o,this.ngZone=n,this.dragPreviewDirective=a,this.draggable=!0,this.dragEffect="move",this.dragScope="default",this.dragHandleClass="drag-handle",this.dragStartEvent=new t.EventEmitter,this.dragEvent=new g,this.dragEndEvent=new t.EventEmitter,this.dropEndEvent=new g,this.enableDragFollow=!1,this.dragItemParentName="",this.dragItemChildrenName="",this.dragsSub=new r.Subscription,this.destroyDragEndSub=new r.Subscription,this.dragElShowHideEvent=new r.Subject,this.beforeDragStartEvent=new r.Subject,this.insertOriginPlaceholder=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),s.delayRemoveOriginPlaceholderTimer&&(clearTimeout(s.delayRemoveOriginPlaceholderTimer),s.delayRemoveOriginPlaceholderTimer=void 0);var r=document.createElement(s.originPlaceholder.tag||"div"),i=s.el.nativeElement.getBoundingClientRect();if(r.style.display=e?"block":"none",r.style.width=i.width+"px",r.style.height=i.height+"px",r.classList.add("drag-origin-placeholder"),s.originPlaceholder.text&&(r.innerText=s.originPlaceholder.text),s.originPlaceholder.style&&c.addElStyles(r,s.originPlaceholder.style),t)s.dragDropService.dragOriginPlaceholder=r,s.dragDropService.dragOriginPlaceholderNextSibling=s.el.nativeElement.nextSibling;else{r.classList.add("side-drag-origin-placeholder");var o=s.el.nativeElement.cloneNode(!0);o.style.margin=0,o.style.pointerEvents="none",o.style.opacity="0.3",r.appendChild(o)}s.dragOriginPlaceholder=r,s.dragOriginPlaceholderNextSibling=s.el.nativeElement.nextSibling,s.el.nativeElement.parentElement.insertBefore(r,s.el.nativeElement.nextSibling)},this.removeOriginPlaceholder=function(e){void 0===e&&(e=!0),s.dragOriginPlaceholder&&s.dragOriginPlaceholder.parentElement.removeChild(s.dragOriginPlaceholder),e&&(s.dragDropService.dragOriginPlaceholder=void 0,s.dragDropService.dragOriginPlaceholderNextSibling=void 0),s.dragOriginPlaceholder=void 0,s.dragOriginPlaceholderNextSibling=void 0},this.delayRemoveOriginPlaceholder=function(e){void 0===e&&(e=!0);var t=s.originPlaceholder.removeDelay,r=s.dragOriginPlaceholder,i=s.findNextSibling(s.dragOriginPlaceholderNextSibling);r.parentElement.contains(i)&&r.parentElement.insertBefore(r,i),setTimeout((function(){r.parentElement.contains(i)&&r.parentElement.insertBefore(r,i),r.classList.add("delay-deletion"),s.delayRemoveOriginPlaceholderTimer=setTimeout((function(){r.parentElement.removeChild(r),document.body.contains(s.el.nativeElement)&&(s.el.nativeElement.style.display="",s.dragDropService.dragElShowHideEvent.next(!1))}),t),e&&(s.dragDropService.dragOriginPlaceholder=void 0,s.dragDropService.dragOriginPlaceholderNextSibling=void 0),s.dragOriginPlaceholder=void 0,s.dragOriginPlaceholderNextSibling=void 0}))}}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=e,this.draggable=!this._disabled},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.ngZone.runOutsideAngular((function(){e.dragsSub.add(r.fromEvent(e.el.nativeElement,"mouseover").subscribe((function(t){return e.mouseover(t)}))),e.dragsSub.add(r.fromEvent(e.el.nativeElement,"dragstart").subscribe((function(t){return e.dragStart(t)}))),e.dragsSub.add(r.fromEvent(e.el.nativeElement,"dragend").subscribe((function(t){return e.dragEnd(t)})))}))},e.prototype.dropSubscription=function(){var e=this;this.dragDropService.newSubscription().add(this.dragDropService.dropEvent.subscribe((function(t){e.mouseOverElement=void 0,e.renderer.removeClass(e.el.nativeElement,e.dragOverClass),e.dropEndEvent.emit(t),e.isDestroyed&&e.dropEndEvent.schedulerFns&&e.dropEndEvent.schedulerFns.size>0&&e.dropEndEvent.forceCallback(t,!0),e.dragDropService.dragOriginPlaceholder&&(e.originPlaceholder&&e.originPlaceholder.removeDelay>0&&!e.dragDropService.dropOnOrigin?e.delayRemoveOriginPlaceholder():e.removeOriginPlaceholder(),e.dragDropService.draggedElIdentity=void 0),e.dragDropService.subscription.unsubscribe()}))).add(this.dragDropService.dragElShowHideEvent.subscribe(this.dragElShowHideEvent))},e.prototype.ngAfterViewInit=function(){this.applyDragHandleClass(),this.dragIdentity&&this.dragDropService.draggedEl&&this.dragIdentity===this.dragDropService.draggedElIdentity&&(this.originPlaceholder&&!1!==this.originPlaceholder.show&&this.insertOriginPlaceholder(),this.dragDropService.draggedEl=this.el.nativeElement,this.el.nativeElement.style.display="none")},e.prototype.ngOnDestroy=function(){var e=this;this.isDestroyed=!0,this.dragDropService.draggedEl===this.el.nativeElement&&(this.destroyDragEndSub=new r.Subscription,this.destroyDragEndSub.add(r.fromEvent(this.el.nativeElement,"dragend").subscribe((function(t){e.dragEnd(t),e.dropEndEvent.schedulerFns&&e.dropEndEvent.schedulerFns.size>0&&e.dropEndEvent.forceCallback(t,!0),e.destroyDragEndSub.unsubscribe(),e.destroyDragEndSub=void 0}))),this.originPlaceholder&&!1!==this.originPlaceholder.show&&this.dragDropService.dragOriginPlaceholder&&this.dragDropService.draggedElIdentity&&this.removeOriginPlaceholder()),this.dragsSub.unsubscribe()},e.prototype.dragStart=function(e){var t=this;if(this.allowDrag(e)){if(this.renderer.addClass(this.el.nativeElement,this.dragOverClass),this.dragDropService.dragData=this.dragData,this.dragDropService.scope=this.dragScope,this.dragDropService.draggedEl=this.el.nativeElement,this.dragDropService.draggedElIdentity=this.dragIdentity,this.dragDropService.dragFollow=this.enableDragFollow,this.dragDropService.dragFollowOptions=this.dragFollowOptions,this.dragDropService.dragItemParentName=this.dragItemParentName,this.dragDropService.dragItemChildrenName=this.dragItemChildrenName,this.beforeDragStartEvent.next(),this.dragPreviewDirective&&this.dragPreviewDirective.dragPreviewTemplate&&(this.dragDropService.dragFollow=!0,this.dragDropService.dragPreviewDirective=this.dragPreviewDirective),this.batchDraggable)if(this.batchDraggable.dragData)this.dragDropService.batchDragData&&this.dragDropService.batchDragData.length>1&&(this.dragDropService.batchDragging=!0,this.dragDropService.batchDragStyle=this.batchDraggable.batchDragStyle);else if(this.batchDraggable.batchDragLastOneAutoActiveEventKeys){this.batchDraggable.batchDragLastOneAutoActiveEventKeys.map((function(t){return e[t]})).some((function(e){return!0===e}))&&this.dragDropService.batchDragData&&this.dragDropService.batchDragData.length>0&&(this.batchDraggable.active(),this.batchDraggable.dragData||this.batchDraggable.addToBatchGroup(),this.dragDropService.batchDragData.some((function(e){return e.draggable===t}))&&(this.dragDropService.batchDragging=!0,this.dragDropService.batchDragStyle=this.batchDraggable.batchDragStyle))}var r=this.el.nativeElement.getBoundingClientRect();if(this.dragDropService.dragFollow){var i=this.mousePosition(e),o=this.checkAndGetViewPointChange(this.el.nativeElement);this.dragDropService.dragOffset={left:r.left,top:r.top,offsetLeft:i.x-r.left+o.offsetX,offsetTop:i.y-r.top+o.offsetY,width:r.width,height:r.height},this.dragDropService.enableDraggedCloneNodeFollowMouse()}else this.dragDropService.dragOffset={left:r.left,top:r.top,offsetLeft:null,offsetTop:null,width:r.width,height:r.height};this.originPlaceholder&&!1!==this.originPlaceholder.show&&this.insertOriginPlaceholder(!1),this.dragDropService.batchDragging&&this.dragDropService.batchDragData&&this.dragDropService.batchDragData.length>1&&this.dragDropService.batchDragData.map((function(e){return e.draggable})).filter((function(e){return e&&e!==t})).forEach((function(e){e.originPlaceholder&&!1!==e.originPlaceholder.show?(e.insertOriginPlaceholder(!0,!1),e.el.nativeElement.style.display="none"):setTimeout((function(){e.el.nativeElement.style.display="none"}))})),null!=e.dataTransfer&&e.dataTransfer.setData("text",""),e.dataTransfer.effectAllowed=this.dragEffect,this.dropSubscription(),this.dragDropService.dragFollow&&("function"==typeof DataTransfer.prototype.setDragImage?e.dataTransfer.setDragImage(this.dragDropService.dragEmptyImage,0,0):(e.srcElement.style.display="none",this.dragDropService.dragElShowHideEvent.next(!1))),e.stopPropagation(),this.dragStartEvent.emit(e),this.dragDropService.dragStartEvent.next(e)}else e.preventDefault()},e.prototype.dragEnd=function(e){var t=this;this.renderer.removeClass(this.el.nativeElement,this.dragOverClass),this.dragDropService.dragEndEvent.next(e),this.mouseOverElement=void 0,this.dragDropService.draggedEl&&(this.dragDropService.dragFollow&&this.dragDropService.disableDraggedCloneNodeFollowMouse(),this.dragDropService.dragOriginPlaceholder&&this.removeOriginPlaceholder(),this.dragDropService.batchDragging&&this.dragDropService.batchDragData&&this.dragDropService.batchDragData.length>1&&this.dragDropService.batchDragData.map((function(e){return e.draggable})).filter((function(e){return e&&e!==t})).forEach((function(e){e.originPlaceholder&&!1!==e.originPlaceholder.show?(e.el.nativeElement.style.display="",e.removeOriginPlaceholder()):e.el.nativeElement.style.display=""})),this.batchDraggable&&!this.batchDraggable.batchDragActive&&(this.batchDraggable.removeFromBatchGroup(),this.dragDropService.batchDragging=!1,this.dragDropService.batchDragStyle=void 0),this.dragDropService.subscription&&this.dragDropService.subscription.unsubscribe(),this.dragDropService.dragData=void 0,this.dragDropService.scope=void 0,this.dragDropService.draggedEl=void 0,this.dragDropService.dragFollow=void 0,this.dragDropService.dragFollowOptions=void 0,this.dragDropService.dragOffset=void 0,this.dragDropService.draggedElIdentity=void 0,this.dragDropService.dragPreviewDirective=void 0),e.stopPropagation(),e.preventDefault(),this.dragEndEvent.emit(e)},e.prototype.mouseover=function(e){this.mouseOverElement=e.target},e.prototype.allowDrag=function(e){return!!this.draggable&&(!(this.batchDraggable&&!this.batchDraggable.allowAddToBatchGroup())&&(!this.dragHandle||(!(!e||!e.fromTouch)||!!this.mouseOverElement&&c.matches(this.mouseOverElement,this.dragHandle))))},e.prototype.applyDragHandleClass=function(){var e=this.getDragHandleElement();e&&(this.draggable?c.addClass(e,this.dragHandleClass):c.removeClass(this.el,this.dragHandleClass))},e.prototype.getDragHandleElement=function(){var e=this.el;return this.dragHandle&&(e=this.el.nativeElement.querySelector(this.dragHandle)),e},e.prototype.mousePosition=function(e){return{x:e.clientX,y:e.clientY}},e.prototype.findNextSibling=function(e){return this.dragDropService.batchDragData?(this.dragDropService.batchDragData.map((function(e){return e.draggable&&e.draggable.el.nativeElement})).indexOf(e)>-1&&(e=e.nextSibling),e):e},e.prototype.checkAndGetViewPointChange=function(e){if(!e.parentNode)return null;var t=e.getBoundingClientRect(),r=document.createElement("div");c.addElStyles(r,{opacity:"0",position:"fixed",top:t.top+"px",left:t.left+"px",width:"1px",height:"1px",zIndex:"-999999"}),e.parentNode.appendChild(r);var i=r.getBoundingClientRect();return e.parentNode.removeChild(r),{offsetX:i.left-t.left,offsetY:i.top-t.top}},e.decorators=[{type:t.Directive,args:[{selector:"[dDraggable]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:h},{type:t.NgZone},{type:u,decorators:[{type:t.Optional},{type:t.Self}]}]},e.propDecorators={draggable:[{type:t.HostBinding,args:["draggable"]}],dragData:[{type:t.Input}],dragHandle:[{type:t.HostBinding,args:["attr.data-drag-handle-selector"]},{type:t.Input}],dragEffect:[{type:t.Input}],dragScope:[{type:t.Input}],dragHandleClass:[{type:t.Input}],dragOverClass:[{type:t.Input}],dragStartEvent:[{type:t.Output}],dragEvent:[{type:t.Output}],dragEndEvent:[{type:t.Output}],dropEndEvent:[{type:t.Output}],disabled:[{type:t.Input}],enableDragFollow:[{type:t.Input}],dragFollowOptions:[{type:t.Input}],originPlaceholder:[{type:t.Input}],dragIdentity:[{type:t.Input}],dragItemParentName:[{type:t.Input}],dragItemChildrenName:[{type:t.Input}]},e}();var f=function(e,t,r,i,o,n,a,s){this.nativeEvent=e,this.dragData=t,this.dropSubject=r,this.dropIndex=i,this.dragFromIndex=o,this.dropOnItem=n,this.dropOnOrigin=a,this.batchDragData=s};var D=function(){function e(e,i,o,n){var a=this;this.el=e,this.renderer=i,this.dragDropService=o,this.ngZone=n,this.dragEnterEvent=new t.EventEmitter,this.dragOverEvent=new t.EventEmitter,this.dragLeaveEvent=new t.EventEmitter,this.dropEvent=new t.EventEmitter,this.dropScope="default",this.placeholderTag="div",this.placeholderStyle={backgroundColor:["#6A98E3","var(--brand-4, '#859bff')"],opacity:".4"},this.placeholderText="",this.allowDropOnItem=!1,this.switchWhileCrossEdge=!1,this.defaultDropPosition="closest",this.dragCount=0,this.dropIndex=void 0,this.placeholderInsertionEvent=new r.Subject,this.placeholderRenderEvent=new r.Subject,this.dropSortCountSelectorFilterFn=function(e){return c.matches(e,a.dropSortCountSelector)||e.contains(a.placeholder)||e===a.dragDropService.dragOriginPlaceholder},this.setPlaceholder=function(){a.ngZone.runOutsideAngular((function(){a.placeholder.style.width=a.dragDropService.dragOffset.width+"px",a.placeholder.style.height=a.dragDropService.dragOffset.height+"px",c.addElStyles(a.placeholder,a.placeholderStyle),a.placeholderRenderEvent.next({width:a.dragDropService.dragOffset.width,height:a.dragDropService.dragOffset.height})}))}}return e.prototype.ngOnInit=function(){var e=this;this.placeholder=document.createElement(this.placeholderTag),this.placeholder.className="drag-placeholder",this.placeholder.innerText=this.placeholderText,this.dragStartSubscription=this.dragDropService.dragStartEvent.subscribe((function(){return e.setPlaceholder()})),this.dragDropService.draggedEl&&this.setPlaceholder(),this.dropEndSubscription=this.dragDropService.dropEvent.subscribe((function(){e.dragDropService.draggedEl&&(e.dragDropService.dragFollow||(e.renderer.setStyle(e.dragDropService.draggedEl,"display",""),e.dragDropService.dragElShowHideEvent.next(!0))),e.removePlaceholder(),e.overElement=void 0,e.allowDropCache=void 0,e.dragElIndex=void 0,e.dropIndex=void 0})),this.dragEndSubscription=this.dragDropService.dragEndEvent.subscribe((function(){e.dragDropService.draggedEl&&(e.dragDropService.dragFollow||(e.renderer.setStyle(e.dragDropService.draggedEl,"display",""),e.dragDropService.dragElShowHideEvent.next(!0))),e.removePlaceholder(),e.dragCount=0,e.overElement=void 0,e.allowDropCache=void 0,e.dragElIndex=void 0,e.dropIndex=void 0})),this.ngZone.runOutsideAngular((function(){e.dragPartEventSub=new r.Subscription,e.dragPartEventSub.add(r.fromEvent(e.el.nativeElement,"dragover").pipe(o.filter((function(t){return e.allowDrop(t)})),o.distinctUntilChanged((function(e,t){var r=e.clientX===t.clientX&&e.clientY===t.clientY&&e.target===t.target;return r&&(t.preventDefault(),t.stopPropagation()),r}))).subscribe((function(t){return e.dragOver(t)}))),e.dragPartEventSub.add(r.fromEvent(e.el.nativeElement,"dragenter").subscribe((function(t){return e.dragEnter(t)}))),e.dragPartEventSub.add(r.fromEvent(e.el.nativeElement,"dragleave").subscribe((function(t){return e.dragLeave(t)})))}))},e.prototype.ngAfterViewInit=function(){this.el.nativeElement.hasAttribute("d-sortable")?this.sortContainer=this.el.nativeElement:this.sortContainer=this.el.nativeElement.querySelector("[d-sortable]"),this.sortDirection=this.sortContainer&&this.sortContainer.getAttribute("dsortable")||"v",this.sortDirectionZMode=this.sortContainer&&"true"===this.sortContainer.getAttribute("d-sortable-zmode")||!1},e.prototype.ngOnDestroy=function(){this.dragStartSubscription.unsubscribe(),this.dragEndSubscription.unsubscribe(),this.dropEndSubscription.unsubscribe(),this.dragPartEventSub&&this.dragPartEventSub.unsubscribe()},e.prototype.dragEnter=function(e){this.dragCount++,e.preventDefault(),this.dragEnterEvent.emit(e)},e.prototype.dragOver=function(e){var t=this;if(this.allowDrop(e)){-1===this.dragDropService.dropTargets.indexOf(this.el)&&(this.dragDropService.dropTargets.forEach((function(e){var r=e.nativeElement.querySelector(".drag-placeholder");r&&r.parentElement.removeChild(r),c.removeClass(e,t.dragOverClass),t.removeDragoverItemClass(e.nativeElement)})),this.dragDropService.dropTargets=[this.el],this.overElement=void 0),c.addClass(this.el,this.dragOverClass);var r=this.dragDropService.dragOriginPlaceholder&&this.dragDropService.dragOriginPlaceholder.contains(e.target);if(this.sortContainer&&(r&&void 0===this.overElement||!e.target.contains(this.placeholder)&&!r||this.switchWhileCrossEdge&&!this.placeholder.contains(e.target)&&!r||!this.sortContainer.contains(e.target)&&"closest"===this.defaultDropPosition)){var i=this.findSortableEl(e);this.overElement&&i&&this.overElement.index===i.index&&(!this.allowDropOnItem||this.overElement.position===i.position||"inside"!==this.overElement.position&&"inside"!==i.position)?this.overElement=i:(this.overElement=i,this.insertPlaceholder(i),this.removeDragoverItemClass(this.sortContainer,i),"inside"===i.position&&this.dragOverItemClass&&c.addClass(i.el,this.dragOverItemClass))}else this.sortContainer&&this.overElement&&this.overElement.el&&(this.overElement.el.contains(e.target)?this.overElement.realEl=void 0:this.overElement.realEl=e.target);this.dragDropService.draggedEl&&(this.dragDropService.dragFollow||(this.renderer.setStyle(this.dragDropService.draggedEl,"display","none"),this.dragDropService.dragElShowHideEvent.next(!1),this.dragDropService.dragOriginPlaceholder&&this.renderer.setStyle(this.dragDropService.dragOriginPlaceholder,"display","block"))),e.preventDefault(),e.stopPropagation(),this.dragOverEvent.emit(e)}},e.prototype.dragLeave=function(e){this.dragCount--,0===this.dragCount&&(-1!==this.dragDropService.dropTargets.indexOf(this.el)&&(this.dragDropService.dropTargets=[]),c.removeClass(this.el,this.dragOverClass),this.removePlaceholder(),this.removeDragoverItemClass(this.el.nativeElement),this.overElement=void 0,this.dragElIndex=void 0,this.dropIndex=void 0),e.preventDefault(),this.dragLeaveEvent.emit(e)},e.prototype.drop=function(e){var t=this;if(this.allowDrop(e)){this.dragCount=0,c.removeClass(this.el,this.dragOverClass),this.removeDragoverItemClass(this.sortContainer),this.removePlaceholder(),e.preventDefault(),e.stopPropagation(),this.dragDropService.dropOnOrigin=this.isDragPlaceholderPosition(this.dropIndex);var r=this.dragDropService.draggedElIdentity;this.dragDropService.draggedElIdentity=void 0;var i=[];this.dragDropService.batchDragData&&this.dragDropService.batchDragData.length>1&&(i=this.dragDropService.batchDragData.map((function(e){return e.draggable})).filter((function(e){return e&&e.el.nativeElement!==t.dragDropService.draggedEl}))),this.dropEvent.emit(new f(e,this.dragDropService.dragData,this.dragDropService.dropEvent,this.dropSortVirtualScrollOption?this.getRealIndex(this.dropIndex,this.dropFlag):this.dropIndex,this.sortContainer?this.checkSelfFromIndex(this.dragDropService.draggedEl):-1,this.dragDropService.dropOnItem,this.dragDropService.dropOnOrigin,this.dragDropService.batchDragging?this.dragDropService.getBatchDragData(r):void 0)),this.dragDropService.dragFollow?this.dragDropService.disableDraggedCloneNodeFollowMouse():(this.renderer.setStyle(this.dragDropService.draggedEl,"display",""),this.dragDropService.dragElShowHideEvent.next(!1)),i.length>0&&this.dragDropService.batchDragging&&i.forEach((function(e){e.originPlaceholder&&!1!==e.originPlaceholder.show?e.originPlaceholder.removeDelay>0&&!t.dragDropService.dropOnOrigin?e.delayRemoveOriginPlaceholder(!1):(e.el.nativeElement.style.display="",e.removeOriginPlaceholder(!1)):e.el.nativeElement.style.display=""})),this.dragDropService.dropEvent.next(e),this.dragDropService.dragData=void 0,this.dragDropService.scope=void 0,this.dragDropService.draggedEl=void 0,this.dragDropService.dragFollow=void 0,this.dragDropService.dragFollowOptions=void 0,this.dragDropService.dragOffset=void 0,this.dragDropService.dropOnOrigin=void 0,this.dragDropService.batchDragging=!1,this.dragDropService.batchDragStyle=void 0,this.dragDropService.dragPreviewDirective=void 0}},e.prototype.allowDrop=function(e){var t=this;if(!e)return!1;if(void 0!==this.allowDropCache)return this.allowDropCache;var r=!1;return"string"==typeof this.dropScope&&("string"==typeof this.dragDropService.scope&&(r=this.dragDropService.scope===this.dropScope),this.dragDropService.scope instanceof Array&&(r=this.dragDropService.scope.indexOf(this.dropScope)>-1)),this.dropScope instanceof Array&&("string"==typeof this.dragDropService.scope&&(r=this.dropScope.indexOf(this.dragDropService.scope)>-1),this.dragDropService.scope instanceof Array&&(r=this.dropScope.filter((function(e){return-1!==t.dragDropService.scope.indexOf(e)})).length>0)),this.allowDropCache=r,r},e.prototype.findSortableEl=function(e){var t=this,r=e.target,i=null;if(!this.sortContainer)return i;i={index:0,el:null,position:"before"},this.dropIndex=0,this.dropFlag=void 0;var o=c.slice(this.sortContainer.children);if(this.dropSortCountSelector&&(o=o.filter(this.dropSortCountSelectorFilterFn)),o.some((function(e){return e!==t.dragDropService.dragOriginPlaceholder&&e.classList.contains("drag-origin-placeholder")}))&&(o=o.filter((function(e){return!(e.classList.contains("drag-origin-placeholder")&&e!==t.dragDropService.dragOriginPlaceholder)}))),this.dragDropService.dragFollow&&this.dragDropService.dragCloneNode){var n=o.findIndex((function(e){return e===t.dragDropService.dragCloneNode}));-1!==n&&o.splice(n,1)}if(this.dragDropService.dragOriginPlaceholder){var a=o.findIndex((function(e){return e===t.dragDropService.dragOriginPlaceholder}));-1!==a?(this.dragElIndex=a-1,o.splice(a,1)):this.dragElIndex=-1}else this.dragElIndex=-1;var s=o.findIndex((function(e){return e.contains(t.placeholder)}));-1!==s&&o.splice(s,1),-1!==s&&-1!==this.dragElIndex&&s<this.dragElIndex&&this.dragElIndex--;var d=-1!==s?s:this.dragElIndex,l=o.findIndex((function(e){return e.contains(r)||e.nextElementSibling===r&&e.nextElementSibling.classList.contains("drag-origin-placeholder")}));if(this.switchWhileCrossEdge&&!this.allowDropOnItem&&o.length&&-1!==d&&l>-1){var h=d,g=this.overElement&&(this.overElement.realEl||this.overElement.el);return-1!==l&&g===o[l]?(this.dropIndex=this.overElement.index,this.overElement):(i={index:h>l?l:l+1,el:o[l],position:h>l?"before":"after"},this.dragDropService.dropOnItem=!1,this.dropIndex=i.index,i)}if(r===this.sortContainer||r.classList.contains("drag-origin-placeholder")||r===(this.dragDropService&&this.dragDropService.dragOriginPlaceholder)||!this.sortContainer.contains(r)&&"closest"===this.defaultDropPosition){if(!o.length)return this.dropIndex=0,this.dragDropService.dropOnItem=!1,i;for(var p=!1,u=0;u<o.length;u++){var v=o[u];if(o[u].nextSibling===r&&r.classList.contains("drag-origin-placeholder")){var f=this.calcPosition(e,r);return this.dragDropService.dropOnItem="inside"===f,i={index:"after"===f?u+1:u,el:o[u],position:f},this.dropIndex=i.index,i}var D=this.calcPositionOutside(e,v);if("before"===D){this.dragDropService.dropOnItem=!1,i={index:u,el:o[u],position:D,realEl:r},this.dropIndex=i.index,p=!0;break}}return p||(this.dragDropService.dropOnItem=!1,i={index:o.length,el:o[o.length-1],position:"after",realEl:r},this.dropIndex=o.length),i}if(!this.sortContainer.contains(r))return"before"===this.defaultDropPosition?(i={index:0,el:o.length?o[0]:null,position:"before",realEl:r},this.dropFlag="beforeAll"):(i={index:o.length,el:o.length?o[o.length-1]:null,position:"after",realEl:r},this.dropFlag="afterAll"),this.dropIndex=i.index,i;var y=!1;for(u=0;u<o.length;u++)if(o[u].contains(r)){v=o[u],f=this.calcPosition(e,v);this.dragDropService.dropOnItem="inside"===f,i={index:"after"===f?u+1:u,el:o[u],position:f},this.dropIndex=i.index,y=!0;break}return y||(o.length&&(i={index:o.length,el:o[o.length-1],position:"after"}),this.dropIndex=o.length,this.dragDropService.dropOnItem=!1),i},e.prototype.calcPosition=function(e,t){var r=t.getBoundingClientRect(),i=e.clientY-(r.y||r.top),o=e.clientX-(r.x||r.left);if(this.allowDropOnItem){var n={height:this.nestingTargetRect&&this.nestingTargetRect.height||r.height,width:this.nestingTargetRect&&this.nestingTargetRect.width||r.width},a=3*n.height/4,s=3*n.width/4,d=1*n.height/4,l=1*n.width/4;if(this.sortDirectionZMode){var c=i/n.height+o/n.width;if(c>.3&&c<=.7)return"inside";if(c>.7&&(i-r.height+n.height)/n.height+(o-r.width+n.width)/n.width<=.7)return"inside"}if("v"===this.sortDirection&&i>d&&i<=a||"v"!==this.sortDirection&&o>l&&o<=s)return"inside";if("v"===this.sortDirection&&i>a&&i<=r.height-d||"v"!==this.sortDirection&&o>s&&o<=r.width-l)return"inside"}return this.sortDirectionZMode?i/r.height+o/r.width<1?"before":"after":"v"===this.sortDirection&&i>r.height/2||"v"!==this.sortDirection&&o>r.width/2?"after":"before"},e.prototype.calcPositionOutside=function(e,t){var r=this.getBoundingRectAndRealPosition(t),i=e.clientY-(r.y||r.top),o=e.clientX-(r.x||r.left);return this.sortDirectionZMode?"v"===this.sortDirection&&(i<0||i<r.height&&o<0)||"v"!==this.sortDirection&&(o<0||o<r.width&&i<0)?"before":"notsure":"v"===this.sortDirection&&i<r.height/2||"v"!==this.sortDirection&&o<r.width/2?"before":"notsure"},e.prototype.insertPlaceholder=function(e){var t,r=this,i=this.sortContainer.scrollTop,o=this.sortContainer.scrollLeft,n=!1,a=function(e,t,r){var i=e.indexOf(t);return i>-1?i:r};if(null!==e){var s=c.slice(this.sortContainer.children).filter((function(e){return e!==r.dragDropService.dragCloneNode}));null===e.el?(t={command:"append"},this.sortContainer.appendChild(this.placeholder)):"inside"===e.position?(t={command:"remove"},this.removePlaceholder()):this.dragDropService.dragOriginPlaceholder&&this.isDragPlaceholderPosition(e.index)?(t={command:"remove"},this.removePlaceholder(),n=!0):"after"===e.position?e.el.nextSibling&&e.el.nextSibling.classList&&e.el.nextSibling.classList.contains("drag-origin-placeholder")?(t={command:"insertBefore",index:a(s,e.el.nextSibling.nextSibling,s.length)},this.sortContainer.insertBefore(this.placeholder,e.el.nextSibling.nextSibling)):(t={command:"insertBefore",index:a(s,e.el.nextSibling,s.length)},this.sortContainer.insertBefore(this.placeholder,e.el.nextSibling)):(t={command:"insertBefore",index:a(s,e.el,s.length)},this.sortContainer.insertBefore(this.placeholder,e.el))}this.placeholderInsertionEvent.next(t),this.sortContainer.scrollTop=i,this.sortContainer.scrollLeft=o,this.dragDropService.dragOriginPlaceholder&&(n?this.hitDragOriginPlaceholder():this.hitDragOriginPlaceholder(!1))},e.prototype.isDragPlaceholderPosition=function(e){return this.dragElIndex>-1&&(e===this.dragElIndex||e===this.dragElIndex+1)},e.prototype.hitDragOriginPlaceholder=function(e){void 0===e&&(e=!0);var t=this.dragDropService.dragOriginPlaceholder;e?t.classList.add("hit-origin-placeholder"):t.classList.remove("hit-origin-placeholder")},e.prototype.removePlaceholder=function(){this.sortContainer&&this.sortContainer.contains(this.placeholder)&&(this.sortContainer.removeChild(this.placeholder),this.placeholderInsertionEvent.next({command:"remove"}))},e.prototype.removeDragoverItemClass=function(e,t){var r,i;if(this.dragOverItemClass){var o=e.querySelectorAll("."+this.dragOverItemClass);if(o&&o.length>0)try{for(var n=d(o),a=n.next();!a.done;a=n.next()){var s=a.value;t&&s===t.el&&"inside"===t.position||c.removeClass(s,this.dragOverItemClass)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}}},e.prototype.checkSelfFromIndex=function(e){var t=-1;if(!this.sortContainer.contains(e))return t;var r=c.slice(this.sortContainer.children);this.dropSortCountSelector&&(r=r.filter(this.dropSortCountSelectorFilterFn));for(var i=0;i<r.length;i++)if(r[i].contains(this.dragDropService.draggedEl)){t=i;break}return this.getRealIndex(t)},e.prototype.getRealIndex=function(e,t){var r=this.dropSortVirtualScrollOption&&this.dropSortVirtualScrollOption.startIndex||0,i=this.dropSortVirtualScrollOption&&this.dropSortVirtualScrollOption.totalLength;return"beforeAll"===t?0:"afterAll"===t?i||e:r+e},e.prototype.getBoundingRectAndRealPosition=function(e){var t=e.getBoundingClientRect(),r=t.bottom,i=t.right,o=t.width,n=t.height;if(0===t.width&&0===t.height&&("none"===e.style.display||"none"===getComputedStyle(e).display)&&e.nextElementSibling){var a=e.nextElementSibling.getBoundingClientRect(),s=a.top,d=a.left;t={x:d,y:s,top:s,left:d,bottom:r,right:i,width:o,height:n}}return t},e.prototype.getSortContainer=function(){return this.sortContainer},e.decorators=[{type:t.Directive,args:[{selector:"[dDroppable]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Ren