@angular/cdk 11.1.0 → 11.1.1
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/cdk-drag-drop.umd.js +43 -6
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +3 -3
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +1 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +1 -1
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/directives/drag.d.ts +3 -1
- package/drag-drop/drag-ref.d.ts +4 -0
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/drag-drop/directives/drag.js +36 -4
- package/esm2015/drag-drop/drag-ref.js +9 -4
- package/esm2015/overlay/overlay-ref.js +2 -2
- package/esm2015/version.js +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +43 -6
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +1 -1
- package/fesm2015/overlay.js.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
*
|
|
41
41
|
* Use of this source code is governed by an MIT-style license that can be
|
|
42
42
|
* found in the LICENSE file at https://angular.io/license
|
|
43
|
-
*/var w=n.normalizePassiveListenerOptions({passive:!0}),E=n.normalizePassiveListenerOptions({passive:!1}),R=function(){function t(t,e,i,r,n,o){var a=this;this._config=e,this._document=i,this._ngZone=r,this._viewportRuler=n,this._dragDropRegistry=o,this._passiveTransform={x:0,y:0},this._activeTransform={x:0,y:0},this._moveEvents=new s.Subject,this._pointerMoveSubscription=s.Subscription.EMPTY,this._pointerUpSubscription=s.Subscription.EMPTY,this._scrollSubscription=s.Subscription.EMPTY,this._resizeSubscription=s.Subscription.EMPTY,this._boundaryElement=null,this._nativeInteractionsEnabled=!0,this._handles=[],this._disabledHandles=new Set,this._direction="ltr",this.dragStartDelay=0,this._disabled=!1,this.beforeStarted=new s.Subject,this.started=new s.Subject,this.released=new s.Subject,this.ended=new s.Subject,this.entered=new s.Subject,this.exited=new s.Subject,this.dropped=new s.Subject,this.moved=this._moveEvents,this._pointerDown=function(t){if(a.beforeStarted.next(),a._handles.length){var e=a._handles.find((function(e){var i=t.target;return!!i&&(i===e||e.contains(i))}));!e||a._disabledHandles.has(e)||a.disabled||a._initializeDragSequence(e,t)}else a.disabled||a._initializeDragSequence(a._rootElement,t)},this._pointerMove=function(t){var e=a._getPointerPositionOnPage(t);if(a._hasStartedDragging){a._boundaryElement&&(a._previewRect&&(a._previewRect.width||a._previewRect.height)||(a._previewRect=(a._preview||a._rootElement).getBoundingClientRect())),t.preventDefault();var i=a._getConstrainedPointerPosition(e);if(a._hasMoved=!0,a._lastKnownPointerPosition=e,a._updatePointerDirectionDelta(i),a._dropContainer)a._updateActiveDropContainer(i,e);else{var r=a._activeTransform;r.x=i.x-a._pickupPositionOnPage.x+a._passiveTransform.x,r.y=i.y-a._pickupPositionOnPage.y+a._passiveTransform.y,a._applyRootElementTransform(r.x,r.y),"undefined"!=typeof SVGElement&&a._rootElement instanceof SVGElement&&a._rootElement.setAttribute("transform","translate("+r.x+" "+r.y+")")}a._moveEvents.observers.length&&a._ngZone.run((function(){a._moveEvents.next({source:a,pointerPosition:i,event:t,distance:a._getDragDistance(i),delta:a._pointerDirectionDelta})}))}else if(Math.abs(e.x-a._pickupPositionOnPage.x)+Math.abs(e.y-a._pickupPositionOnPage.y)>=a._config.dragStartThreshold){var n=Date.now()>=a._dragStartTime+a._getDragStartDelay(t),o=a._dropContainer;if(!n)return void a._endDragSequence(t);o&&(o.isDragging()||o.isReceiving())||(a._hasStartedDragging=!0,a._ngZone.run((function(){return a._startDragSequence(t)})))}},this._pointerUp=function(t){a._endDragSequence(t)},this.withRootElement(t),this._parentPositions=new v(i,n),o.registerDragItem(this)}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled||!(!this._dropContainer||!this._dropContainer.disabled)},set:function(t){var e=o.coerceBooleanProperty(t);e!==this._disabled&&(this._disabled=e,this._toggleNativeDragInteractions(),this._handles.forEach((function(t){return h(t,e)})))},enumerable:!1,configurable:!0}),t.prototype.getPlaceholderElement=function(){return this._placeholder},t.prototype.getRootElement=function(){return this._rootElement},t.prototype.getVisibleElement=function(){return this.isDragging()?this.getPlaceholderElement():this.getRootElement()},t.prototype.withHandles=function(t){var e=this;this._handles=t.map((function(t){return o.coerceElement(t)})),this._handles.forEach((function(t){return h(t,e.disabled)})),this._toggleNativeDragInteractions();var i=new Set;return this._disabledHandles.forEach((function(t){e._handles.indexOf(t)>-1&&i.add(t)})),this._disabledHandles=i,this},t.prototype.withPreviewTemplate=function(t){return this._previewTemplate=t,this},t.prototype.withPlaceholderTemplate=function(t){return this._placeholderTemplate=t,this},t.prototype.withRootElement=function(t){var e=this,i=o.coerceElement(t);return i!==this._rootElement&&(this._rootElement&&this._removeRootElementListeners(this._rootElement),this._ngZone.runOutsideAngular((function(){i.addEventListener("mousedown",e._pointerDown,E),i.addEventListener("touchstart",e._pointerDown,w)})),this._initialTransform=void 0,this._rootElement=i),"undefined"!=typeof SVGElement&&this._rootElement instanceof SVGElement&&(this._ownerSVGElement=this._rootElement.ownerSVGElement),this},t.prototype.withBoundaryElement=function(t){var e=this;return this._boundaryElement=t?o.coerceElement(t):null,this._resizeSubscription.unsubscribe(),t&&(this._resizeSubscription=this._viewportRuler.change(10).subscribe((function(){return e._containInsideBoundaryOnResize()}))),this},t.prototype.dispose=function(){this._removeRootElementListeners(this._rootElement),this.isDragging()&&C(this._rootElement),C(this._anchor),this._destroyPreview(),this._destroyPlaceholder(),this._dragDropRegistry.removeDragItem(this),this._removeSubscriptions(),this.beforeStarted.complete(),this.started.complete(),this.released.complete(),this.ended.complete(),this.entered.complete(),this.exited.complete(),this.dropped.complete(),this._moveEvents.complete(),this._handles=[],this._disabledHandles.clear(),this._dropContainer=void 0,this._resizeSubscription.unsubscribe(),this._parentPositions.clear(),this._boundaryElement=this._rootElement=this._ownerSVGElement=this._placeholderTemplate=this._previewTemplate=this._anchor=null},t.prototype.isDragging=function(){return this._hasStartedDragging&&this._dragDropRegistry.isDragging(this)},t.prototype.reset=function(){this._rootElement.style.transform=this._initialTransform||"",this._activeTransform={x:0,y:0},this._passiveTransform={x:0,y:0}},t.prototype.disableHandle=function(t){!this._disabledHandles.has(t)&&this._handles.indexOf(t)>-1&&(this._disabledHandles.add(t),h(t,!0))},t.prototype.enableHandle=function(t){this._disabledHandles.has(t)&&(this._disabledHandles.delete(t),h(t,this.disabled))},t.prototype.withDirection=function(t){return this._direction=t,this},t.prototype._withDropContainer=function(t){this._dropContainer=t},t.prototype.getFreeDragPosition=function(){var t=this.isDragging()?this._activeTransform:this._passiveTransform;return{x:t.x,y:t.y}},t.prototype.setFreeDragPosition=function(t){return this._activeTransform={x:0,y:0},this._passiveTransform.x=t.x,this._passiveTransform.y=t.y,this._dropContainer||this._applyRootElementTransform(t.x,t.y),this},t.prototype._sortFromLastPointerPosition=function(){var t=this._lastKnownPointerPosition;t&&this._dropContainer&&this._updateActiveDropContainer(this._getConstrainedPointerPosition(t),t)},t.prototype._removeSubscriptions=function(){this._pointerMoveSubscription.unsubscribe(),this._pointerUpSubscription.unsubscribe(),this._scrollSubscription.unsubscribe()},t.prototype._destroyPreview=function(){this._preview&&C(this._preview),this._previewRef&&this._previewRef.destroy(),this._preview=this._previewRef=null},t.prototype._destroyPlaceholder=function(){this._placeholder&&C(this._placeholder),this._placeholderRef&&this._placeholderRef.destroy(),this._placeholder=this._placeholderRef=null},t.prototype._endDragSequence=function(t){var e=this;this._dragDropRegistry.isDragging(this)&&(this._removeSubscriptions(),this._dragDropRegistry.stopDragging(this),this._toggleNativeDragInteractions(),this._handles&&(this._rootElement.style.webkitTapHighlightColor=this._rootElementTapHighlight),this._hasStartedDragging&&(this.released.next({source:this}),this._dropContainer?(this._dropContainer._stopScrolling(),this._animatePreviewToPlaceholder().then((function(){e._cleanupDragArtifacts(t),e._cleanupCachedDimensions(),e._dragDropRegistry.stopDragging(e)}))):(this._passiveTransform.x=this._activeTransform.x,this._passiveTransform.y=this._activeTransform.y,this._ngZone.run((function(){e.ended.next({source:e,distance:e._getDragDistance(e._getPointerPositionOnPage(t))})})),this._cleanupCachedDimensions(),this._dragDropRegistry.stopDragging(this))))},t.prototype._startDragSequence=function(t){k(t)&&(this._lastTouchEventTime=Date.now()),this._toggleNativeDragInteractions();var e=this._dropContainer;if(e){var i=this._rootElement,r=i.parentNode,n=this._preview=this._createPreviewElement(),o=this._placeholder=this._createPlaceholderElement(),s=this._anchor=this._anchor||this._document.createComment(""),a=this._getShadowRoot();r.insertBefore(s,i),p(i,!1),this._document.body.appendChild(r.replaceChild(o,i)),function c(t,e){return e||t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement||t.body}(this._document,a).appendChild(n),this.started.next({source:this}),e.start(),this._initialContainer=e,this._initialIndex=e.getItemIndex(this)}else this.started.next({source:this}),this._initialContainer=this._initialIndex=void 0;this._parentPositions.cache(e?e.getScrollableParents():[])},t.prototype._initializeDragSequence=function(t,e){var i=this;this._config.parentDragRef&&e.stopPropagation();var r=this.isDragging(),n=k(e),o=!n&&0!==e.button,s=this._rootElement,a=!n&&this._lastTouchEventTime&&this._lastTouchEventTime+800>Date.now();if(e.target&&e.target.draggable&&"mousedown"===e.type&&e.preventDefault(),!(r||o||a)){this._handles.length&&(this._rootElementTapHighlight=s.style.webkitTapHighlightColor||"",s.style.webkitTapHighlightColor="transparent"),this._hasStartedDragging=this._hasMoved=!1,this._removeSubscriptions(),this._pointerMoveSubscription=this._dragDropRegistry.pointerMove.subscribe(this._pointerMove),this._pointerUpSubscription=this._dragDropRegistry.pointerUp.subscribe(this._pointerUp),this._scrollSubscription=this._dragDropRegistry.scroll.subscribe((function(t){i._updateOnScroll(t)})),this._boundaryElement&&(this._boundaryRect=g(this._boundaryElement));var c=this._previewTemplate;this._pickupPositionInElement=c&&c.template&&!c.matchSize?{x:0,y:0}:this._getPointerPositionInElement(t,e);var l=this._pickupPositionOnPage=this._lastKnownPointerPosition=this._getPointerPositionOnPage(e);this._pointerDirectionDelta={x:0,y:0},this._pointerPositionAtLastDirectionChange={x:l.x,y:l.y},this._dragStartTime=Date.now(),this._dragDropRegistry.startDragging(this,e)}},t.prototype._cleanupDragArtifacts=function(t){var e=this;p(this._rootElement,!0),this._anchor.parentNode.replaceChild(this._rootElement,this._anchor),this._destroyPreview(),this._destroyPlaceholder(),this._boundaryRect=this._previewRect=void 0,this._ngZone.run((function(){var i=e._dropContainer,r=i.getItemIndex(e),n=e._getPointerPositionOnPage(t),o=e._getDragDistance(e._getPointerPositionOnPage(t)),s=i._isOverContainer(n.x,n.y);e.ended.next({source:e,distance:o}),e.dropped.next({item:e,currentIndex:r,previousIndex:e._initialIndex,container:i,previousContainer:e._initialContainer,isPointerOverContainer:s,distance:o}),i.drop(e,r,e._initialIndex,e._initialContainer,s,o),e._dropContainer=e._initialContainer}))},t.prototype._updateActiveDropContainer=function(t,e){var i=this,r=t.x,n=t.y,o=e.x,s=e.y,a=this._initialContainer._getSiblingContainerFromPosition(this,r,n);!a&&this._dropContainer!==this._initialContainer&&this._initialContainer._isOverContainer(r,n)&&(a=this._initialContainer),a&&a!==this._dropContainer&&this._ngZone.run((function(){i.exited.next({item:i,container:i._dropContainer}),i._dropContainer.exit(i),i._dropContainer=a,i._dropContainer.enter(i,r,n,a===i._initialContainer&&a.sortingDisabled?i._initialIndex:void 0),i.entered.next({item:i,container:a,currentIndex:a.getItemIndex(i)})})),this._dropContainer._startScrollingIfNecessary(o,s),this._dropContainer._sortItem(this,r,n,this._pointerDirectionDelta),this._preview.style.transform=x(r-this._pickupPositionInElement.x,n-this._pickupPositionInElement.y)},t.prototype._createPreviewElement=function(){var t,e=this._previewTemplate,i=this.previewClass,r=e?e.template:null;if(r&&e){var n=e.matchSize?this._rootElement.getBoundingClientRect():null,o=e.viewContainer.createEmbeddedView(r,e.context);o.detectChanges(),t=T(o,this._document),this._previewRef=o,e.matchSize?O(t,n):t.style.transform=x(this._pickupPositionOnPage.x,this._pickupPositionOnPage.y)}else{var s=this._rootElement;O(t=y(s),s.getBoundingClientRect())}return l(t.style,{pointerEvents:"none",margin:"0",position:"fixed",top:"0",left:"0",zIndex:""+(this._config.zIndex||1e3)}),h(t,!1),t.classList.add("cdk-drag-preview"),t.setAttribute("dir",this._direction),i&&(Array.isArray(i)?i.forEach((function(e){return t.classList.add(e)})):t.classList.add(i)),t},t.prototype._animatePreviewToPlaceholder=function(){var t=this;if(!this._hasMoved)return Promise.resolve();var e=this._placeholder.getBoundingClientRect();this._preview.classList.add("cdk-drag-animating"),this._preview.style.transform=x(e.left,e.top);var i=function r(t){var e=getComputedStyle(t),i=u(e,"transition-property"),r=i.find((function(t){return"transform"===t||"all"===t}));if(!r)return 0;var n=i.indexOf(r),o=u(e,"transition-duration"),s=u(e,"transition-delay");return d(o[n])+d(s[n])}(this._preview);return 0===i?Promise.resolve():this._ngZone.runOutsideAngular((function(){return new Promise((function(e){var r=function(i){(!i||i.target===t._preview&&"transform"===i.propertyName)&&(t._preview.removeEventListener("transitionend",r),e(),clearTimeout(n))},n=setTimeout(r,1.5*i);t._preview.addEventListener("transitionend",r)}))}))},t.prototype._createPlaceholderElement=function(){var t,e=this._placeholderTemplate,i=e?e.template:null;return i?(this._placeholderRef=e.viewContainer.createEmbeddedView(i,e.context),this._placeholderRef.detectChanges(),t=T(this._placeholderRef,this._document)):t=y(this._rootElement),t.classList.add("cdk-drag-placeholder"),t},t.prototype._getPointerPositionInElement=function(t,e){var i=this._rootElement.getBoundingClientRect(),r=t===this._rootElement?null:t,n=r?r.getBoundingClientRect():i,o=k(e)?e.targetTouches[0]:e,s=this._getViewportScrollPosition();return{x:n.left-i.left+(o.pageX-n.left-s.left),y:n.top-i.top+(o.pageY-n.top-s.top)}},t.prototype._getPointerPositionOnPage=function(t){var e=this._getViewportScrollPosition(),i=k(t)?t.touches[0]||t.changedTouches[0]||{pageX:0,pageY:0}:t,r=i.pageX-e.left,n=i.pageY-e.top;if(this._ownerSVGElement){var o=this._ownerSVGElement.getScreenCTM();if(o){var s=this._ownerSVGElement.createSVGPoint();return s.x=r,s.y=n,s.matrixTransform(o.inverse())}}return{x:r,y:n}},t.prototype._getConstrainedPointerPosition=function(t){var e=this._dropContainer?this._dropContainer.lockAxis:null,i=this.constrainPosition?this.constrainPosition(t,this):t,r=i.x,n=i.y;if("x"===this.lockAxis||"x"===e?n=this._pickupPositionOnPage.y:"y"!==this.lockAxis&&"y"!==e||(r=this._pickupPositionOnPage.x),this._boundaryRect){var o=this._pickupPositionInElement,s=o.x,a=o.y,c=this._boundaryRect,l=this._previewRect,h=c.top+a,p=c.bottom-(l.height-a);r=I(r,c.left+s,c.right-(l.width-s)),n=I(n,h,p)}return{x:r,y:n}},t.prototype._updatePointerDirectionDelta=function(t){var e=t.x,i=t.y,r=this._pointerDirectionDelta,n=this._pointerPositionAtLastDirectionChange,o=Math.abs(e-n.x),s=Math.abs(i-n.y);return o>this._config.pointerDirectionChangeThreshold&&(r.x=e>n.x?1:-1,n.x=e),s>this._config.pointerDirectionChangeThreshold&&(r.y=i>n.y?1:-1,n.y=i),r},t.prototype._toggleNativeDragInteractions=function(){if(this._rootElement&&this._handles){var t=this._handles.length>0||!this.isDragging();t!==this._nativeInteractionsEnabled&&(this._nativeInteractionsEnabled=t,h(this._rootElement,t))}},t.prototype._removeRootElementListeners=function(t){t.removeEventListener("mousedown",this._pointerDown,E),t.removeEventListener("touchstart",this._pointerDown,w)},t.prototype._applyRootElementTransform=function(t,e){var i=x(t,e);null==this._initialTransform&&(this._initialTransform=this._rootElement.style.transform||""),this._rootElement.style.transform=this._initialTransform?i+" "+this._initialTransform:i},t.prototype._getDragDistance=function(t){var e=this._pickupPositionOnPage;return e?{x:t.x-e.x,y:t.y-e.y}:{x:0,y:0}},t.prototype._cleanupCachedDimensions=function(){this._boundaryRect=this._previewRect=void 0,this._parentPositions.clear()},t.prototype._containInsideBoundaryOnResize=function(){var t=this._passiveTransform,e=t.x,i=t.y;if(!(0===e&&0===i||this.isDragging())&&this._boundaryElement){var r=this._boundaryElement.getBoundingClientRect(),n=this._rootElement.getBoundingClientRect();if(!(0===r.width&&0===r.height||0===n.width&&0===n.height)){var o=r.left-n.left,s=n.right-r.right,a=r.top-n.top,c=n.bottom-r.bottom;r.width>n.width?(o>0&&(e+=o),s>0&&(e-=s)):e=0,r.height>n.height?(a>0&&(i+=a),c>0&&(i-=c)):i=0,e===this._passiveTransform.x&&i===this._passiveTransform.y||this.setFreeDragPosition({y:i,x:e})}}},t.prototype._getDragStartDelay=function(t){var e=this.dragStartDelay;return"number"==typeof e?e:k(t)?e.touch:e?e.mouse:0},t.prototype._updateOnScroll=function(t){var e=this._parentPositions.handleScroll(t);if(e){var i=t.target;this._boundaryRect&&(i===this._document||i!==this._boundaryElement&&i.contains(this._boundaryElement))&&f(this._boundaryRect,e.top,e.left),this._pickupPositionOnPage.x+=e.left,this._pickupPositionOnPage.y+=e.top,this._dropContainer||(this._activeTransform.x-=e.left,this._activeTransform.y-=e.top,this._applyRootElementTransform(this._activeTransform.x,this._activeTransform.y))}},t.prototype._getViewportScrollPosition=function(){var t=this._parentPositions.positions.get(this._document);return t?t.scrollPosition:this._viewportRuler.getViewportScrollPosition()},t.prototype._getShadowRoot=function(){return void 0===this._cachedShadowRoot&&(this._cachedShadowRoot=n._getShadowRoot(this._rootElement)),this._cachedShadowRoot},t}();function x(t,e){return"translate3d("+Math.round(t)+"px, "+Math.round(e)+"px, 0)"}function I(t,e,i){return Math.max(e,Math.min(i,t))}function C(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function k(t){return"t"===t.type[0]}function T(t,e){var i=t.rootNodes;if(1===i.length&&i[0].nodeType===e.ELEMENT_NODE)return i[0];var r=e.createElement("div");return i.forEach((function(t){return r.appendChild(t)})),r}function O(t,e){t.style.width=e.width+"px",t.style.height=e.height+"px",t.style.transform=x(e.left,e.top)}
|
|
43
|
+
*/var w=n.normalizePassiveListenerOptions({passive:!0}),E=n.normalizePassiveListenerOptions({passive:!1}),R=function(){function t(t,e,i,r,n,o){var a=this;this._config=e,this._document=i,this._ngZone=r,this._viewportRuler=n,this._dragDropRegistry=o,this._passiveTransform={x:0,y:0},this._activeTransform={x:0,y:0},this._moveEvents=new s.Subject,this._pointerMoveSubscription=s.Subscription.EMPTY,this._pointerUpSubscription=s.Subscription.EMPTY,this._scrollSubscription=s.Subscription.EMPTY,this._resizeSubscription=s.Subscription.EMPTY,this._boundaryElement=null,this._nativeInteractionsEnabled=!0,this._handles=[],this._disabledHandles=new Set,this._direction="ltr",this.dragStartDelay=0,this._disabled=!1,this.beforeStarted=new s.Subject,this.started=new s.Subject,this.released=new s.Subject,this.ended=new s.Subject,this.entered=new s.Subject,this.exited=new s.Subject,this.dropped=new s.Subject,this.moved=this._moveEvents,this._pointerDown=function(t){if(a.beforeStarted.next(),a._handles.length){var e=a._handles.find((function(e){var i=t.target;return!!i&&(i===e||e.contains(i))}));!e||a._disabledHandles.has(e)||a.disabled||a._initializeDragSequence(e,t)}else a.disabled||a._initializeDragSequence(a._rootElement,t)},this._pointerMove=function(t){var e=a._getPointerPositionOnPage(t);if(a._hasStartedDragging){a._boundaryElement&&(a._previewRect&&(a._previewRect.width||a._previewRect.height)||(a._previewRect=(a._preview||a._rootElement).getBoundingClientRect())),t.preventDefault();var i=a._getConstrainedPointerPosition(e);if(a._hasMoved=!0,a._lastKnownPointerPosition=e,a._updatePointerDirectionDelta(i),a._dropContainer)a._updateActiveDropContainer(i,e);else{var r=a._activeTransform;r.x=i.x-a._pickupPositionOnPage.x+a._passiveTransform.x,r.y=i.y-a._pickupPositionOnPage.y+a._passiveTransform.y,a._applyRootElementTransform(r.x,r.y),"undefined"!=typeof SVGElement&&a._rootElement instanceof SVGElement&&a._rootElement.setAttribute("transform","translate("+r.x+" "+r.y+")")}a._moveEvents.observers.length&&a._ngZone.run((function(){a._moveEvents.next({source:a,pointerPosition:i,event:t,distance:a._getDragDistance(i),delta:a._pointerDirectionDelta})}))}else if(Math.abs(e.x-a._pickupPositionOnPage.x)+Math.abs(e.y-a._pickupPositionOnPage.y)>=a._config.dragStartThreshold){var n=Date.now()>=a._dragStartTime+a._getDragStartDelay(t),o=a._dropContainer;if(!n)return void a._endDragSequence(t);o&&(o.isDragging()||o.isReceiving())||(a._hasStartedDragging=!0,a._ngZone.run((function(){return a._startDragSequence(t)})))}},this._pointerUp=function(t){a._endDragSequence(t)},this.withRootElement(t).withParent(e.parentDragRef||null),this._parentPositions=new v(i,n),o.registerDragItem(this)}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled||!(!this._dropContainer||!this._dropContainer.disabled)},set:function(t){var e=o.coerceBooleanProperty(t);e!==this._disabled&&(this._disabled=e,this._toggleNativeDragInteractions(),this._handles.forEach((function(t){return h(t,e)})))},enumerable:!1,configurable:!0}),t.prototype.getPlaceholderElement=function(){return this._placeholder},t.prototype.getRootElement=function(){return this._rootElement},t.prototype.getVisibleElement=function(){return this.isDragging()?this.getPlaceholderElement():this.getRootElement()},t.prototype.withHandles=function(t){var e=this;this._handles=t.map((function(t){return o.coerceElement(t)})),this._handles.forEach((function(t){return h(t,e.disabled)})),this._toggleNativeDragInteractions();var i=new Set;return this._disabledHandles.forEach((function(t){e._handles.indexOf(t)>-1&&i.add(t)})),this._disabledHandles=i,this},t.prototype.withPreviewTemplate=function(t){return this._previewTemplate=t,this},t.prototype.withPlaceholderTemplate=function(t){return this._placeholderTemplate=t,this},t.prototype.withRootElement=function(t){var e=this,i=o.coerceElement(t);return i!==this._rootElement&&(this._rootElement&&this._removeRootElementListeners(this._rootElement),this._ngZone.runOutsideAngular((function(){i.addEventListener("mousedown",e._pointerDown,E),i.addEventListener("touchstart",e._pointerDown,w)})),this._initialTransform=void 0,this._rootElement=i),"undefined"!=typeof SVGElement&&this._rootElement instanceof SVGElement&&(this._ownerSVGElement=this._rootElement.ownerSVGElement),this},t.prototype.withBoundaryElement=function(t){var e=this;return this._boundaryElement=t?o.coerceElement(t):null,this._resizeSubscription.unsubscribe(),t&&(this._resizeSubscription=this._viewportRuler.change(10).subscribe((function(){return e._containInsideBoundaryOnResize()}))),this},t.prototype.withParent=function(t){return this._parentDragRef=t,this},t.prototype.dispose=function(){this._removeRootElementListeners(this._rootElement),this.isDragging()&&C(this._rootElement),C(this._anchor),this._destroyPreview(),this._destroyPlaceholder(),this._dragDropRegistry.removeDragItem(this),this._removeSubscriptions(),this.beforeStarted.complete(),this.started.complete(),this.released.complete(),this.ended.complete(),this.entered.complete(),this.exited.complete(),this.dropped.complete(),this._moveEvents.complete(),this._handles=[],this._disabledHandles.clear(),this._dropContainer=void 0,this._resizeSubscription.unsubscribe(),this._parentPositions.clear(),this._boundaryElement=this._rootElement=this._ownerSVGElement=this._placeholderTemplate=this._previewTemplate=this._anchor=this._parentDragRef=null},t.prototype.isDragging=function(){return this._hasStartedDragging&&this._dragDropRegistry.isDragging(this)},t.prototype.reset=function(){this._rootElement.style.transform=this._initialTransform||"",this._activeTransform={x:0,y:0},this._passiveTransform={x:0,y:0}},t.prototype.disableHandle=function(t){!this._disabledHandles.has(t)&&this._handles.indexOf(t)>-1&&(this._disabledHandles.add(t),h(t,!0))},t.prototype.enableHandle=function(t){this._disabledHandles.has(t)&&(this._disabledHandles.delete(t),h(t,this.disabled))},t.prototype.withDirection=function(t){return this._direction=t,this},t.prototype._withDropContainer=function(t){this._dropContainer=t},t.prototype.getFreeDragPosition=function(){var t=this.isDragging()?this._activeTransform:this._passiveTransform;return{x:t.x,y:t.y}},t.prototype.setFreeDragPosition=function(t){return this._activeTransform={x:0,y:0},this._passiveTransform.x=t.x,this._passiveTransform.y=t.y,this._dropContainer||this._applyRootElementTransform(t.x,t.y),this},t.prototype._sortFromLastPointerPosition=function(){var t=this._lastKnownPointerPosition;t&&this._dropContainer&&this._updateActiveDropContainer(this._getConstrainedPointerPosition(t),t)},t.prototype._removeSubscriptions=function(){this._pointerMoveSubscription.unsubscribe(),this._pointerUpSubscription.unsubscribe(),this._scrollSubscription.unsubscribe()},t.prototype._destroyPreview=function(){this._preview&&C(this._preview),this._previewRef&&this._previewRef.destroy(),this._preview=this._previewRef=null},t.prototype._destroyPlaceholder=function(){this._placeholder&&C(this._placeholder),this._placeholderRef&&this._placeholderRef.destroy(),this._placeholder=this._placeholderRef=null},t.prototype._endDragSequence=function(t){var e=this;this._dragDropRegistry.isDragging(this)&&(this._removeSubscriptions(),this._dragDropRegistry.stopDragging(this),this._toggleNativeDragInteractions(),this._handles&&(this._rootElement.style.webkitTapHighlightColor=this._rootElementTapHighlight),this._hasStartedDragging&&(this.released.next({source:this}),this._dropContainer?(this._dropContainer._stopScrolling(),this._animatePreviewToPlaceholder().then((function(){e._cleanupDragArtifacts(t),e._cleanupCachedDimensions(),e._dragDropRegistry.stopDragging(e)}))):(this._passiveTransform.x=this._activeTransform.x,this._passiveTransform.y=this._activeTransform.y,this._ngZone.run((function(){e.ended.next({source:e,distance:e._getDragDistance(e._getPointerPositionOnPage(t))})})),this._cleanupCachedDimensions(),this._dragDropRegistry.stopDragging(this))))},t.prototype._startDragSequence=function(t){k(t)&&(this._lastTouchEventTime=Date.now()),this._toggleNativeDragInteractions();var e=this._dropContainer;if(e){var i=this._rootElement,r=i.parentNode,n=this._preview=this._createPreviewElement(),o=this._placeholder=this._createPlaceholderElement(),s=this._anchor=this._anchor||this._document.createComment(""),a=this._getShadowRoot();r.insertBefore(s,i),p(i,!1),this._document.body.appendChild(r.replaceChild(o,i)),function c(t,e){return e||t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement||t.body}(this._document,a).appendChild(n),this.started.next({source:this}),e.start(),this._initialContainer=e,this._initialIndex=e.getItemIndex(this)}else this.started.next({source:this}),this._initialContainer=this._initialIndex=void 0;this._parentPositions.cache(e?e.getScrollableParents():[])},t.prototype._initializeDragSequence=function(t,e){var i=this;this._parentDragRef&&e.stopPropagation();var r=this.isDragging(),n=k(e),o=!n&&0!==e.button,s=this._rootElement,a=!n&&this._lastTouchEventTime&&this._lastTouchEventTime+800>Date.now();if(e.target&&e.target.draggable&&"mousedown"===e.type&&e.preventDefault(),!(r||o||a)){this._handles.length&&(this._rootElementTapHighlight=s.style.webkitTapHighlightColor||"",s.style.webkitTapHighlightColor="transparent"),this._hasStartedDragging=this._hasMoved=!1,this._removeSubscriptions(),this._pointerMoveSubscription=this._dragDropRegistry.pointerMove.subscribe(this._pointerMove),this._pointerUpSubscription=this._dragDropRegistry.pointerUp.subscribe(this._pointerUp),this._scrollSubscription=this._dragDropRegistry.scroll.subscribe((function(t){i._updateOnScroll(t)})),this._boundaryElement&&(this._boundaryRect=g(this._boundaryElement));var c=this._previewTemplate;this._pickupPositionInElement=c&&c.template&&!c.matchSize?{x:0,y:0}:this._getPointerPositionInElement(t,e);var l=this._pickupPositionOnPage=this._lastKnownPointerPosition=this._getPointerPositionOnPage(e);this._pointerDirectionDelta={x:0,y:0},this._pointerPositionAtLastDirectionChange={x:l.x,y:l.y},this._dragStartTime=Date.now(),this._dragDropRegistry.startDragging(this,e)}},t.prototype._cleanupDragArtifacts=function(t){var e=this;p(this._rootElement,!0),this._anchor.parentNode.replaceChild(this._rootElement,this._anchor),this._destroyPreview(),this._destroyPlaceholder(),this._boundaryRect=this._previewRect=void 0,this._ngZone.run((function(){var i=e._dropContainer,r=i.getItemIndex(e),n=e._getPointerPositionOnPage(t),o=e._getDragDistance(e._getPointerPositionOnPage(t)),s=i._isOverContainer(n.x,n.y);e.ended.next({source:e,distance:o}),e.dropped.next({item:e,currentIndex:r,previousIndex:e._initialIndex,container:i,previousContainer:e._initialContainer,isPointerOverContainer:s,distance:o}),i.drop(e,r,e._initialIndex,e._initialContainer,s,o),e._dropContainer=e._initialContainer}))},t.prototype._updateActiveDropContainer=function(t,e){var i=this,r=t.x,n=t.y,o=e.x,s=e.y,a=this._initialContainer._getSiblingContainerFromPosition(this,r,n);!a&&this._dropContainer!==this._initialContainer&&this._initialContainer._isOverContainer(r,n)&&(a=this._initialContainer),a&&a!==this._dropContainer&&this._ngZone.run((function(){i.exited.next({item:i,container:i._dropContainer}),i._dropContainer.exit(i),i._dropContainer=a,i._dropContainer.enter(i,r,n,a===i._initialContainer&&a.sortingDisabled?i._initialIndex:void 0),i.entered.next({item:i,container:a,currentIndex:a.getItemIndex(i)})})),this._dropContainer._startScrollingIfNecessary(o,s),this._dropContainer._sortItem(this,r,n,this._pointerDirectionDelta),this._preview.style.transform=x(r-this._pickupPositionInElement.x,n-this._pickupPositionInElement.y)},t.prototype._createPreviewElement=function(){var t,e=this._previewTemplate,i=this.previewClass,r=e?e.template:null;if(r&&e){var n=e.matchSize?this._rootElement.getBoundingClientRect():null,o=e.viewContainer.createEmbeddedView(r,e.context);o.detectChanges(),t=T(o,this._document),this._previewRef=o,e.matchSize?O(t,n):t.style.transform=x(this._pickupPositionOnPage.x,this._pickupPositionOnPage.y)}else{var s=this._rootElement;O(t=y(s),s.getBoundingClientRect())}return l(t.style,{pointerEvents:"none",margin:"0",position:"fixed",top:"0",left:"0",zIndex:""+(this._config.zIndex||1e3)}),h(t,!1),t.classList.add("cdk-drag-preview"),t.setAttribute("dir",this._direction),i&&(Array.isArray(i)?i.forEach((function(e){return t.classList.add(e)})):t.classList.add(i)),t},t.prototype._animatePreviewToPlaceholder=function(){var t=this;if(!this._hasMoved)return Promise.resolve();var e=this._placeholder.getBoundingClientRect();this._preview.classList.add("cdk-drag-animating"),this._preview.style.transform=x(e.left,e.top);var i=function r(t){var e=getComputedStyle(t),i=u(e,"transition-property"),r=i.find((function(t){return"transform"===t||"all"===t}));if(!r)return 0;var n=i.indexOf(r),o=u(e,"transition-duration"),s=u(e,"transition-delay");return d(o[n])+d(s[n])}(this._preview);return 0===i?Promise.resolve():this._ngZone.runOutsideAngular((function(){return new Promise((function(e){var r=function(i){(!i||i.target===t._preview&&"transform"===i.propertyName)&&(t._preview.removeEventListener("transitionend",r),e(),clearTimeout(n))},n=setTimeout(r,1.5*i);t._preview.addEventListener("transitionend",r)}))}))},t.prototype._createPlaceholderElement=function(){var t,e=this._placeholderTemplate,i=e?e.template:null;return i?(this._placeholderRef=e.viewContainer.createEmbeddedView(i,e.context),this._placeholderRef.detectChanges(),t=T(this._placeholderRef,this._document)):t=y(this._rootElement),t.classList.add("cdk-drag-placeholder"),t},t.prototype._getPointerPositionInElement=function(t,e){var i=this._rootElement.getBoundingClientRect(),r=t===this._rootElement?null:t,n=r?r.getBoundingClientRect():i,o=k(e)?e.targetTouches[0]:e,s=this._getViewportScrollPosition();return{x:n.left-i.left+(o.pageX-n.left-s.left),y:n.top-i.top+(o.pageY-n.top-s.top)}},t.prototype._getPointerPositionOnPage=function(t){var e=this._getViewportScrollPosition(),i=k(t)?t.touches[0]||t.changedTouches[0]||{pageX:0,pageY:0}:t,r=i.pageX-e.left,n=i.pageY-e.top;if(this._ownerSVGElement){var o=this._ownerSVGElement.getScreenCTM();if(o){var s=this._ownerSVGElement.createSVGPoint();return s.x=r,s.y=n,s.matrixTransform(o.inverse())}}return{x:r,y:n}},t.prototype._getConstrainedPointerPosition=function(t){var e=this._dropContainer?this._dropContainer.lockAxis:null,i=this.constrainPosition?this.constrainPosition(t,this):t,r=i.x,n=i.y;if("x"===this.lockAxis||"x"===e?n=this._pickupPositionOnPage.y:"y"!==this.lockAxis&&"y"!==e||(r=this._pickupPositionOnPage.x),this._boundaryRect){var o=this._pickupPositionInElement,s=o.x,a=o.y,c=this._boundaryRect,l=this._previewRect,h=c.top+a,p=c.bottom-(l.height-a);r=I(r,c.left+s,c.right-(l.width-s)),n=I(n,h,p)}return{x:r,y:n}},t.prototype._updatePointerDirectionDelta=function(t){var e=t.x,i=t.y,r=this._pointerDirectionDelta,n=this._pointerPositionAtLastDirectionChange,o=Math.abs(e-n.x),s=Math.abs(i-n.y);return o>this._config.pointerDirectionChangeThreshold&&(r.x=e>n.x?1:-1,n.x=e),s>this._config.pointerDirectionChangeThreshold&&(r.y=i>n.y?1:-1,n.y=i),r},t.prototype._toggleNativeDragInteractions=function(){if(this._rootElement&&this._handles){var t=this._handles.length>0||!this.isDragging();t!==this._nativeInteractionsEnabled&&(this._nativeInteractionsEnabled=t,h(this._rootElement,t))}},t.prototype._removeRootElementListeners=function(t){t.removeEventListener("mousedown",this._pointerDown,E),t.removeEventListener("touchstart",this._pointerDown,w)},t.prototype._applyRootElementTransform=function(t,e){var i=x(t,e);null==this._initialTransform&&(this._initialTransform=this._rootElement.style.transform||""),this._rootElement.style.transform=this._initialTransform?i+" "+this._initialTransform:i},t.prototype._getDragDistance=function(t){var e=this._pickupPositionOnPage;return e?{x:t.x-e.x,y:t.y-e.y}:{x:0,y:0}},t.prototype._cleanupCachedDimensions=function(){this._boundaryRect=this._previewRect=void 0,this._parentPositions.clear()},t.prototype._containInsideBoundaryOnResize=function(){var t=this._passiveTransform,e=t.x,i=t.y;if(!(0===e&&0===i||this.isDragging())&&this._boundaryElement){var r=this._boundaryElement.getBoundingClientRect(),n=this._rootElement.getBoundingClientRect();if(!(0===r.width&&0===r.height||0===n.width&&0===n.height)){var o=r.left-n.left,s=n.right-r.right,a=r.top-n.top,c=n.bottom-r.bottom;r.width>n.width?(o>0&&(e+=o),s>0&&(e-=s)):e=0,r.height>n.height?(a>0&&(i+=a),c>0&&(i-=c)):i=0,e===this._passiveTransform.x&&i===this._passiveTransform.y||this.setFreeDragPosition({y:i,x:e})}}},t.prototype._getDragStartDelay=function(t){var e=this.dragStartDelay;return"number"==typeof e?e:k(t)?e.touch:e?e.mouse:0},t.prototype._updateOnScroll=function(t){var e=this._parentPositions.handleScroll(t);if(e){var i=t.target;this._boundaryRect&&(i===this._document||i!==this._boundaryElement&&i.contains(this._boundaryElement))&&f(this._boundaryRect,e.top,e.left),this._pickupPositionOnPage.x+=e.left,this._pickupPositionOnPage.y+=e.top,this._dropContainer||(this._activeTransform.x-=e.left,this._activeTransform.y-=e.top,this._applyRootElementTransform(this._activeTransform.x,this._activeTransform.y))}},t.prototype._getViewportScrollPosition=function(){var t=this._parentPositions.positions.get(this._document);return t?t.scrollPosition:this._viewportRuler.getViewportScrollPosition()},t.prototype._getShadowRoot=function(){return void 0===this._cachedShadowRoot&&(this._cachedShadowRoot=n._getShadowRoot(this._rootElement)),this._cachedShadowRoot},t}();function x(t,e){return"translate3d("+Math.round(t)+"px, "+Math.round(e)+"px, 0)"}function I(t,e,i){return Math.max(e,Math.min(i,t))}function C(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function k(t){return"t"===t.type[0]}function T(t,e){var i=t.rootNodes;if(1===i.length&&i[0].nodeType===e.ELEMENT_NODE)return i[0];var r=e.createElement("div");return i.forEach((function(t){return r.appendChild(t)})),r}function O(t,e){t.style.width=e.width+"px",t.style.height=e.height+"px",t.style.transform=x(e.left,e.top)}
|
|
44
44
|
/*! *****************************************************************************
|
|
45
45
|
Copyright (c) Microsoft Corporation.
|
|
46
46
|
|
|
@@ -131,14 +131,14 @@ var it,rt=new e.InjectionToken("CdkDragPlaceholder");(it=function it(t){this.tem
|
|
|
131
131
|
* Use of this source code is governed by an MIT-style license that can be
|
|
132
132
|
* found in the LICENSE file at https://angular.io/license
|
|
133
133
|
*/
|
|
134
|
-
var nt=new e.InjectionToken("CdkDragPreview"),ot=function(){function t(t){this.templateRef=t,this._matchSize=!1}return Object.defineProperty(t.prototype,"matchSize",{get:function(){return this._matchSize},set:function(t){this._matchSize=o.coerceBooleanProperty(t)},enumerable:!1,configurable:!0}),t}();ot.decorators=[{type:e.Directive,args:[{selector:"ng-template[cdkDragPreview]",providers:[{provide:nt,useExisting:ot}]}]}],ot.ctorParameters=function(){return[{type:e.TemplateRef}]},ot.propDecorators={data:[{type:e.Input}],matchSize:[{type:e.Input}]};var st,at=function(){function t(
|
|
134
|
+
var nt=new e.InjectionToken("CdkDragPreview"),ot=function(){function t(t){this.templateRef=t,this._matchSize=!1}return Object.defineProperty(t.prototype,"matchSize",{get:function(){return this._matchSize},set:function(t){this._matchSize=o.coerceBooleanProperty(t)},enumerable:!1,configurable:!0}),t}();ot.decorators=[{type:e.Directive,args:[{selector:"ng-template[cdkDragPreview]",providers:[{provide:nt,useExisting:ot}]}]}],ot.ctorParameters=function(){return[{type:e.TemplateRef}]},ot.propDecorators={data:[{type:e.Input}],matchSize:[{type:e.Input}]};var st,at=function(){function t(i,r,n,o,c,l,h,p,d,u,g){var _=this;this.element=i,this.dropContainer=r,this._ngZone=o,this._viewContainerRef=c,this._dir=h,this._changeDetectorRef=d,this._selfHandle=u,this._parentDrag=g,this._destroyed=new s.Subject,this.started=new e.EventEmitter,this.released=new e.EventEmitter,this.ended=new e.EventEmitter,this.entered=new e.EventEmitter,this.exited=new e.EventEmitter,this.dropped=new e.EventEmitter,this.moved=new s.Observable((function(t){var e=_._dragRef.moved.pipe(a.map((function(t){return{source:_,pointerPosition:t.pointerPosition,event:t.event,delta:t.delta,distance:t.distance}}))).subscribe(t);return function(){e.unsubscribe()}})),this._dragRef=p.createDrag(i,{dragStartThreshold:l&&null!=l.dragStartThreshold?l.dragStartThreshold:5,pointerDirectionChangeThreshold:l&&null!=l.pointerDirectionChangeThreshold?l.pointerDirectionChangeThreshold:5,zIndex:null==l?void 0:l.zIndex}),this._dragRef.data=this,t._dragInstances.push(this),l&&this._assignDefaults(l),r&&(this._dragRef._withDropContainer(r._dropListRef),r.addItem(this)),this._syncInputs(this._dragRef),this._handleEvents(this._dragRef)}return Object.defineProperty(t.prototype,"disabled",{get:function(){return this._disabled||this.dropContainer&&this.dropContainer.disabled},set:function(t){this._disabled=o.coerceBooleanProperty(t),this._dragRef.disabled=this._disabled},enumerable:!1,configurable:!0}),t.prototype.getPlaceholderElement=function(){return this._dragRef.getPlaceholderElement()},t.prototype.getRootElement=function(){return this._dragRef.getRootElement()},t.prototype.reset=function(){this._dragRef.reset()},t.prototype.getFreeDragPosition=function(){return this._dragRef.getFreeDragPosition()},t.prototype.ngAfterViewInit=function(){var t=this;this._ngZone.onStable.pipe(a.take(1),a.takeUntil(this._destroyed)).subscribe((function(){t._updateRootElement(),t._handles.changes.pipe(a.startWith(t._handles),a.tap((function(e){var i=e.filter((function(e){return e._parentDrag===t})).map((function(t){return t.element}));t._selfHandle&&t.rootElementSelector&&i.push(t.element),t._dragRef.withHandles(i)})),a.switchMap((function(t){return s.merge.apply(void 0,A(t.map((function(t){return t._stateChanges.pipe(a.startWith(t))}))))})),a.takeUntil(t._destroyed)).subscribe((function(e){var i=t._dragRef,r=e.element.nativeElement;e.disabled?i.disableHandle(r):i.enableHandle(r)})),t.freeDragPosition&&t._dragRef.setFreeDragPosition(t.freeDragPosition)}))},t.prototype.ngOnChanges=function(t){var e=t.rootElementSelector,i=t.freeDragPosition;e&&!e.firstChange&&this._updateRootElement(),i&&!i.firstChange&&this.freeDragPosition&&this._dragRef.setFreeDragPosition(this.freeDragPosition)},t.prototype.ngOnDestroy=function(){this.dropContainer&&this.dropContainer.removeItem(this);var e=t._dragInstances.indexOf(this);e>-1&&t._dragInstances.splice(e,-1),this._destroyed.next(),this._destroyed.complete(),this._dragRef.dispose()},t.prototype._updateRootElement=function(){var t=this.element.nativeElement,e=this.rootElementSelector?ct(t,this.rootElementSelector):t;this._dragRef.withRootElement(e||t)},t.prototype._getBoundaryElement=function(){var t=this.boundaryElement;return t?"string"==typeof t?ct(this.element.nativeElement,t):o.coerceElement(t):null},t.prototype._syncInputs=function(e){var i=this;e.beforeStarted.subscribe((function(){if(!e.isDragging()){var t=i._dir,r=i.dragStartDelay,n=i._placeholderTemplate?{template:i._placeholderTemplate.templateRef,context:i._placeholderTemplate.data,viewContainer:i._viewContainerRef}:null,s=i._previewTemplate?{template:i._previewTemplate.templateRef,context:i._previewTemplate.data,matchSize:i._previewTemplate.matchSize,viewContainer:i._viewContainerRef}:null;e.disabled=i.disabled,e.lockAxis=i.lockAxis,e.dragStartDelay="object"==typeof r&&r?r:o.coerceNumberProperty(r),e.constrainPosition=i.constrainPosition,e.previewClass=i.previewClass,e.withBoundaryElement(i._getBoundaryElement()).withPlaceholderTemplate(n).withPreviewTemplate(s),t&&e.withDirection(t.value)}})),e.beforeStarted.pipe(a.take(1)).subscribe((function(){var r,n;if(i._parentDrag)e.withParent(i._parentDrag._dragRef);else for(var o=i.element.nativeElement.parentElement;o;){if(null===(r=o.classList)||void 0===r?void 0:r.contains("cdk-drag")){e.withParent((null===(n=t._dragInstances.find((function(t){return t.element.nativeElement===o})))||void 0===n?void 0:n._dragRef)||null);break}o=o.parentElement}}))},t.prototype._handleEvents=function(t){var e=this;t.started.subscribe((function(){e.started.emit({source:e}),e._changeDetectorRef.markForCheck()})),t.released.subscribe((function(){e.released.emit({source:e})})),t.ended.subscribe((function(t){e.ended.emit({source:e,distance:t.distance}),e._changeDetectorRef.markForCheck()})),t.entered.subscribe((function(t){e.entered.emit({container:t.container.data,item:e,currentIndex:t.currentIndex})})),t.exited.subscribe((function(t){e.exited.emit({container:t.container.data,item:e})})),t.dropped.subscribe((function(t){e.dropped.emit({previousIndex:t.previousIndex,currentIndex:t.currentIndex,previousContainer:t.previousContainer.data,container:t.container.data,isPointerOverContainer:t.isPointerOverContainer,item:e,distance:t.distance})}))},t.prototype._assignDefaults=function(t){var e=t.lockAxis,i=t.dragStartDelay,r=t.constrainPosition,n=t.previewClass,o=t.boundaryElement,s=t.draggingDisabled,a=t.rootElementSelector;this.disabled=null!=s&&s,this.dragStartDelay=i||0,e&&(this.lockAxis=e),r&&(this.constrainPosition=r),n&&(this.previewClass=n),o&&(this.boundaryElement=o),a&&(this.rootElementSelector=a)},t}();function ct(t,e){for(var i=t.parentElement;i;){if(i.matches?i.matches(e):i.msMatchesSelector(e))return i;i=i.parentElement}return null}
|
|
135
135
|
/**
|
|
136
136
|
* @license
|
|
137
137
|
* Copyright Google LLC All Rights Reserved.
|
|
138
138
|
*
|
|
139
139
|
* Use of this source code is governed by an MIT-style license that can be
|
|
140
140
|
* found in the LICENSE file at https://angular.io/license
|
|
141
|
-
*/at.decorators=[{type:e.Directive,args:[{selector:"[cdkDrag]",exportAs:"cdkDrag",host:{class:"cdk-drag","[class.cdk-drag-disabled]":"disabled","[class.cdk-drag-dragging]":"_dragRef.isDragging()"},providers:[{provide:W,useExisting:at}]}]}],at.ctorParameters=function(){return[{type:e.ElementRef},{type:void 0,decorators:[{type:e.Inject,args:[Q]},{type:e.Optional},{type:e.SkipSelf}]},{type:void 0,decorators:[{type:e.Inject,args:[i.DOCUMENT]}]},{type:e.NgZone},{type:e.ViewContainerRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[X]}]},{type:c.Directionality,decorators:[{type:e.Optional}]},{type:q},{type:e.ChangeDetectorRef},{type:et,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[tt]}]},{type:at,decorators:[{type:e.Optional},{type:e.SkipSelf},{type:e.Inject,args:[W]}]}]},at.propDecorators={_handles:[{type:e.ContentChildren,args:[tt,{descendants:!0}]}],_previewTemplate:[{type:e.ContentChild,args:[nt]}],_placeholderTemplate:[{type:e.ContentChild,args:[rt]}],data:[{type:e.Input,args:["cdkDragData"]}],lockAxis:[{type:e.Input,args:["cdkDragLockAxis"]}],rootElementSelector:[{type:e.Input,args:["cdkDragRootElement"]}],boundaryElement:[{type:e.Input,args:["cdkDragBoundary"]}],dragStartDelay:[{type:e.Input,args:["cdkDragStartDelay"]}],freeDragPosition:[{type:e.Input,args:["cdkDragFreeDragPosition"]}],disabled:[{type:e.Input,args:["cdkDragDisabled"]}],constrainPosition:[{type:e.Input,args:["cdkDragConstrainPosition"]}],previewClass:[{type:e.Input,args:["cdkDragPreviewClass"]}],started:[{type:e.Output,args:["cdkDragStarted"]}],released:[{type:e.Output,args:["cdkDragReleased"]}],ended:[{type:e.Output,args:["cdkDragEnded"]}],entered:[{type:e.Output,args:["cdkDragEntered"]}],exited:[{type:e.Output,args:["cdkDragExited"]}],dropped:[{type:e.Output,args:["cdkDragDropped"]}],moved:[{type:e.Output,args:["cdkDragMoved"]}]},(st=function st(){}).decorators=[{type:e.NgModule,args:[{declarations:[$,Y,at,et,ot,it],exports:[r.CdkScrollableModule,$,Y,at,et,ot,it],providers:[q]}]}],
|
|
141
|
+
*/at._dragInstances=[],at.decorators=[{type:e.Directive,args:[{selector:"[cdkDrag]",exportAs:"cdkDrag",host:{class:"cdk-drag","[class.cdk-drag-disabled]":"disabled","[class.cdk-drag-dragging]":"_dragRef.isDragging()"},providers:[{provide:W,useExisting:at}]}]}],at.ctorParameters=function(){return[{type:e.ElementRef},{type:void 0,decorators:[{type:e.Inject,args:[Q]},{type:e.Optional},{type:e.SkipSelf}]},{type:void 0,decorators:[{type:e.Inject,args:[i.DOCUMENT]}]},{type:e.NgZone},{type:e.ViewContainerRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[X]}]},{type:c.Directionality,decorators:[{type:e.Optional}]},{type:q},{type:e.ChangeDetectorRef},{type:et,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[tt]}]},{type:at,decorators:[{type:e.Optional},{type:e.SkipSelf},{type:e.Inject,args:[W]}]}]},at.propDecorators={_handles:[{type:e.ContentChildren,args:[tt,{descendants:!0}]}],_previewTemplate:[{type:e.ContentChild,args:[nt]}],_placeholderTemplate:[{type:e.ContentChild,args:[rt]}],data:[{type:e.Input,args:["cdkDragData"]}],lockAxis:[{type:e.Input,args:["cdkDragLockAxis"]}],rootElementSelector:[{type:e.Input,args:["cdkDragRootElement"]}],boundaryElement:[{type:e.Input,args:["cdkDragBoundary"]}],dragStartDelay:[{type:e.Input,args:["cdkDragStartDelay"]}],freeDragPosition:[{type:e.Input,args:["cdkDragFreeDragPosition"]}],disabled:[{type:e.Input,args:["cdkDragDisabled"]}],constrainPosition:[{type:e.Input,args:["cdkDragConstrainPosition"]}],previewClass:[{type:e.Input,args:["cdkDragPreviewClass"]}],started:[{type:e.Output,args:["cdkDragStarted"]}],released:[{type:e.Output,args:["cdkDragReleased"]}],ended:[{type:e.Output,args:["cdkDragEnded"]}],entered:[{type:e.Output,args:["cdkDragEntered"]}],exited:[{type:e.Output,args:["cdkDragExited"]}],dropped:[{type:e.Output,args:["cdkDragDropped"]}],moved:[{type:e.Output,args:["cdkDragMoved"]}]},(st=function st(){}).decorators=[{type:e.NgModule,args:[{declarations:[$,Y,at,et,ot,it],exports:[r.CdkScrollableModule,$,Y,at,et,ot,it],providers:[q]}]}],
|
|
142
142
|
/**
|
|
143
143
|
* @license
|
|
144
144
|
* Copyright Google LLC All Rights Reserved.
|