{"version":3,"sources":["ng-sortable.js"],"names":["angular","module","constant","itemClass","handleClass","placeHolderClass","dragClass","hiddenClass","dragging","factory","$document","$window","height","element","getBoundingClientRect","width","offset","scrollableContainer","boundingClientRect","documentElement","prop","top","pageYOffset","scrollTop","offsetTop","left","pageXOffset","scrollLeft","offsetLeft","eventObj","event","obj","undefined","targetTouches","item","originalEvent","isTouchInvalid","touchInvalid","touches","length","positionStarted","target","pos","offsetX","pageX","this","offsetY","pageY","startX","lastX","startY","lastY","nowX","nowY","distX","distY","dirAx","dirX","dirY","lastDirX","lastDirY","distAxX","distAxY","calculatePosition","newAx","Math","abs","movePosition","container","containerPositioning","bounds","useRelative","x","y","css","dragItem","index","parent","sortableScope","source","targetElement","targetElementOffset","sourceInfo","itemScope","canMove","itemPosition","moveTo","isSameParent","cloning","isOrderChanged","eventArgs","dest","apply","options","clone","insertItem","copy","modelValue","removeItem","allowDuplicates","indexOf","noDrag","attr","findAncestor","el","selector","matches","Element","prototype","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","parentElement","call","document","body","mainModule","controller","$scope","scope","callbacks","type","longTouch","isDisabled","itemData","splice","removedItem","isEmpty","accept","sourceItemHandleScope","destScope","destItemScope","directive","require","restrict","link","attrs","ngModelController","ngModel","$render","$modelValue","data","orderChanged","itemMoved","dragStart","dragMove","dragCancel","dragEnd","destSortableScope","noop","$watch","asSortable","newVal","oldVal","forEach","value","key","isDefined","isUndefined","sortableConfig","$helper","$timeout","itemController","dragElement","placeHolder","placeElement","dragItemInfo","containment","dragListen","isDraggable","placeHolderIndex","bindDrag","unbindDrag","bindEvents","unBindEvents","hasTouch","isIOS","longTouchStart","longTouchCancel","longTouchTimer","dragHandled","createPlaceholder","isPlaceHolderPresent","escapeListen","isLongTouch","insertBefore","targetScope","parentNode","fetchScope","rollbackDragChanges","replaceWith","remove","removeClass","test","navigator","userAgent","MSStream","addClass","$watchGroup","newValues","$on","unbind","placeholder","createElement","startPosition","unbindMoveListen","moveListen","e","preventDefault","clientX","clientY","bind","stopPropagation","tagName","button","which","ctrlClone","ctrlKey","querySelector","additionalPlaceholderClass","after","append","$apply","elementClicked","sourceScope","targetX","targetY","elementFromPoint","placeholderIndex","insertAfter","isParent","possibleParent","elem","nodeName","appendChild","itemElements","i","hasClass","children","cancel","keyCode","$index","ctrl","sortableController"],"mappings":"CA4BC,WACC,aACAA,QAAQC,OAAO,kBACZC,SAAS,kBACRC,UAAW,mBACXC,YAAa,0BACbC,iBAAkB,0BAClBC,UAAW,mBACXC,YAAa,qBACbC,SAAU,yBAThB,GAgBC,WACC,aAEiBR,QAAQC,OAAO,eAKrBQ,QAAQ,WAAY,YAAa,UAC1C,SAAUC,EAAWC,GACnB,OAQEC,OAAQ,SAAUC,GAChB,OAAOA,EAAQ,GAAGC,wBAAwBF,QAS5CG,MAAO,SAAUF,GACf,OAAOA,EAAQ,GAAGC,wBAAwBC,OAU5CC,OAAQ,SAAUH,EAASI,GACzB,IAAIC,EAAqBL,EAAQ,GAAGC,wBAKpC,OAJKG,IACHA,EAAsBP,EAAU,GAAGS,kBAInCJ,MAAOG,EAAmBH,OAASF,EAAQO,KAAK,eAChDR,OAAQM,EAAmBN,QAAUC,EAAQO,KAAK,gBAClDC,IAAKH,EAAmBG,KAAOV,EAAQW,aAAeL,EAAoBM,UAAYN,EAAoBO,WAC1GC,KAAMP,EAAmBO,MAAQd,EAAQe,aAAeT,EAAoBU,WAAaV,EAAoBW,cAUjHC,SAAU,SAAUC,GAClB,IAAIC,EAAMD,EAMV,YAL4BE,IAAxBF,EAAMG,cACRF,EAAMD,EAAMG,cAAcC,KAAK,QACEF,IAAxBF,EAAMK,oBAAqEH,IAAtCF,EAAMK,cAAcF,gBAClEF,EAAMD,EAAMK,cAAcF,cAAcC,KAAK,IAExCH,GASTK,eAAgB,SAAUN,GAExB,IAAIO,GAAe,EAOnB,YANsBL,IAAlBF,EAAMQ,SAAyBR,EAAMQ,QAAQC,OAAS,EACxDF,GAAe,OACkBL,IA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D,EAEbA,EAAOzC,cAAgB,KACvByC,EAAOtB,WAAa,KACpBsB,EAAOG,KAAO,OAOdH,EAAO3C,MAAQ,WACb,OAAO2C,EAAO2H,QAQhB3H,EAAOM,SAAW,WAChB,OAAON,EAAOzC,cAAcmB,WAAWsB,EAAO2H,YAQlD7H,EAAWgB,UAAU,kBAAmB,iBACtC,SAAU2B,GACR,OACE1B,SAAU,cAAe,YACzBC,SAAU,IACVjB,WAAY,qCACZkB,KAAM,SAAUhB,EAAO3G,EAAS4H,EAAO0G,GACrC,IAAIC,EAAqBD,EAAK,GAC1BzG,EAAoByG,EAAK,GACzBnF,EAAe7J,WACjBU,EAAQyL,SAAStC,EAAe7J,WAElCqH,EAAM1C,cAAgBsK,EAAmB5H,MACrCkB,EACFA,EAAkBE,QAAU,WAC1BpB,EAAMvB,WAAayC,EAAkBG,aAGvCrB,EAAMvB,WAAamJ,EAAmB5H,MAAMvB,WAAWuB,EAAM0H,QAE/D1H,EAAM3G,QAAUA,EAChBA,EAAQiI,KAAK,SAAStB,QA9DhC","file":"ng-sortable.js","sourcesContent":["/*\n ng-sortable v1.3.8\n The MIT License (MIT)\n\n Copyright (c) 2014 Muhammed Ashik\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n\n/*jshint indent: 2 */\n/*global angular: false */\n\n(function () {\n 'use strict';\n angular.module('as.sortable', [])\n .constant('sortableConfig', {\n itemClass: 'as-sortable-item',\n handleClass: 'as-sortable-item-handle',\n placeHolderClass: 'as-sortable-placeholder',\n dragClass: 'as-sortable-drag',\n hiddenClass: 'as-sortable-hidden',\n dragging: 'as-sortable-dragging'\n });\n}());\n\n/*jshint indent: 2 */\n/*global angular: false */\n\n(function () {\n 'use strict';\n\n var mainModule = angular.module('as.sortable');\n\n /**\n * Helper factory for sortable.\n */\n mainModule.factory('$helper', ['$document', '$window',\n function ($document, $window) {\n return {\n\n /**\n * Get the height of an element.\n *\n * @param {Object} element Angular element.\n * @returns {String} Height\n */\n height: function (element) {\n return element[0].getBoundingClientRect().height;\n },\n\n /**\n * Get the width of an element.\n *\n * @param {Object} element Angular element.\n * @returns {String} Width\n */\n width: function (element) {\n return element[0].getBoundingClientRect().width;\n },\n\n /**\n * Get the offset values of an element.\n *\n * @param {Object} element Angular element.\n * @param {Object} [scrollableContainer] Scrollable container object for calculating relative top & left (optional, defaults to Document)\n * @returns {Object} Object with properties width, height, top and left\n */\n offset: function (element, scrollableContainer) {\n var boundingClientRect = element[0].getBoundingClientRect();\n if (!scrollableContainer) {\n scrollableContainer = $document[0].documentElement;\n }\n\n return {\n width: boundingClientRect.width || element.prop('offsetWidth'),\n height: boundingClientRect.height || element.prop('offsetHeight'),\n top: boundingClientRect.top + ($window.pageYOffset || scrollableContainer.scrollTop - scrollableContainer.offsetTop),\n left: boundingClientRect.left + ($window.pageXOffset || scrollableContainer.scrollLeft - scrollableContainer.offsetLeft)\n };\n },\n\n /**\n * get the event object for touch.\n *\n * @param {Object} event the touch event\n * @return {Object} the touch event object.\n */\n eventObj: function (event) {\n var obj = event;\n if (event.targetTouches !== undefined) {\n obj = event.targetTouches.item(0);\n } else if (event.originalEvent !== undefined && event.originalEvent.targetTouches !== undefined) {\n obj = event.originalEvent.targetTouches.item(0);\n }\n return obj;\n },\n\n /**\n * Checks whether the touch is valid and multiple.\n *\n * @param event the event object.\n * @returns {boolean} true if touch is multiple.\n */\n isTouchInvalid: function (event) {\n\n var touchInvalid = false;\n if (event.touches !== undefined && event.touches.length > 1) {\n touchInvalid = true;\n } else if (event.originalEvent !== undefined &&\n event.originalEvent.touches !== undefined && event.originalEvent.touches.length > 1) {\n touchInvalid = true;\n }\n return touchInvalid;\n },\n\n /**\n * Get the start position of the target element according to the provided event properties.\n *\n * @param {Object} event Event\n * @param {Object} target Target element\n * @param {Object} [scrollableContainer] (optional) Scrollable container object\n * @returns {Object} Object with properties offsetX, offsetY.\n */\n positionStarted: function (event, target, scrollableContainer) {\n var pos = {};\n pos.offsetX = event.pageX - this.offset(target, scrollableContainer).left;\n pos.offsetY = event.pageY - this.offset(target, scrollableContainer).top;\n pos.startX = pos.lastX = event.pageX;\n pos.startY = pos.lastY = event.pageY;\n pos.nowX = pos.nowY = pos.distX = pos.distY = pos.dirAx = 0;\n pos.dirX = pos.dirY = pos.lastDirX = pos.lastDirY = pos.distAxX = pos.distAxY = 0;\n return pos;\n },\n\n /**\n * Calculates the event position and sets the direction\n * properties.\n *\n * @param pos the current position of the element.\n * @param event the move event.\n */\n calculatePosition: function (pos, event) {\n // mouse position last events\n pos.lastX = pos.nowX;\n pos.lastY = pos.nowY;\n\n // mouse position this events\n pos.nowX = event.pageX;\n pos.nowY = event.pageY;\n\n // distance mouse moved between events\n pos.distX = pos.nowX - pos.lastX;\n pos.distY = pos.nowY - pos.lastY;\n\n // direction mouse was moving\n pos.lastDirX = pos.dirX;\n pos.lastDirY = pos.dirY;\n\n // direction mouse is now moving (on both axis)\n pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;\n pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;\n\n // axis mouse is now moving on\n var newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;\n\n // calc distance moved on this axis (and direction)\n if (pos.dirAx !== newAx) {\n pos.distAxX = 0;\n pos.distAxY = 0;\n } else {\n pos.distAxX += Math.abs(pos.distX);\n if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {\n pos.distAxX = 0;\n }\n\n pos.distAxY += Math.abs(pos.distY);\n if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {\n pos.distAxY = 0;\n }\n }\n pos.dirAx = newAx;\n },\n\n /**\n * Move the position by applying style.\n *\n * @param event the event object\n * @param element - the dom element\n * @param pos - current position\n * @param container - the bounding container.\n * @param containerPositioning - absolute or relative positioning.\n * @param {Object} [scrollableContainer] (optional) Scrollable container object\n */\n movePosition: function (event, element, pos, container, containerPositioning, scrollableContainer) {\n var bounds;\n var useRelative = (containerPositioning === 'relative');\n\n element.x = event.pageX - pos.offsetX;\n element.y = event.pageY - pos.offsetY;\n\n if (container) {\n bounds = this.offset(container, scrollableContainer);\n\n if (useRelative) {\n // reduce positioning by bounds\n element.x -= bounds.left;\n element.y -= bounds.top;\n\n // reset bounds\n bounds.left = 0;\n bounds.top = 0;\n }\n\n if (element.x < bounds.left) {\n element.x = bounds.left;\n } else if (element.x >= bounds.width + bounds.left - this.offset(element).width) {\n element.x = bounds.width + bounds.left - this.offset(element).width;\n }\n if (element.y < bounds.top) {\n element.y = bounds.top;\n } else if (element.y >= bounds.height + bounds.top - this.offset(element).height) {\n element.y = bounds.height + bounds.top - this.offset(element).height;\n }\n }\n\n element.css({\n 'left': element.x + 'px',\n 'top': element.y + 'px'\n });\n\n this.calculatePosition(pos, event);\n },\n\n /**\n * The drag item info and functions.\n * retains the item info before and after move.\n * holds source item and target scope.\n *\n * @param item - the drag item\n * @returns {{index: *, parent: *, source: *,\n * sourceInfo: {index: *, itemScope: (*|.dragItem.sourceInfo.itemScope|$scope.itemScope|itemScope), sortableScope: *},\n * moveTo: moveTo, isSameParent: isSameParent, isOrderChanged: isOrderChanged, eventArgs: eventArgs, apply: apply}}\n */\n dragItem: function (item) {\n\n return {\n index: item.index(),\n parent: item.sortableScope,\n source: item,\n targetElement: null,\n targetElementOffset: null,\n sourceInfo: {\n index: item.index(),\n itemScope: item.itemScope,\n sortableScope: item.sortableScope\n },\n canMove: function(itemPosition, targetElement, targetElementOffset) {\n // return true if targetElement has been changed since last call\n if (this.targetElement !== targetElement) {\n this.targetElement = targetElement;\n this.targetElementOffset = targetElementOffset;\n return true;\n }\n // return true if mouse is moving in the last moving direction of targetElement\n if (itemPosition.dirX * (targetElementOffset.left - this.targetElementOffset.left) > 0 ||\n itemPosition.dirY * (targetElementOffset.top - this.targetElementOffset.top) > 0) {\n this.targetElementOffset = targetElementOffset;\n return true;\n }\n // return false otherwise\n return false;\n },\n moveTo: function (parent, index) {\n // move the item to a new position\n this.parent = parent;\n // if the source item is in the same parent, the target index is after the source index and we're not cloning\n if (this.isSameParent() && this.source.index() < index && !this.sourceInfo.sortableScope.cloning) {\n index = index - 1;\n }\n this.index = index;\n },\n isSameParent: function () {\n return this.parent.element === this.sourceInfo.sortableScope.element;\n },\n isOrderChanged: function () {\n return this.index !== this.sourceInfo.index;\n },\n eventArgs: function () {\n return {\n source: this.sourceInfo,\n dest: {\n index: this.index,\n sortableScope: this.parent\n }\n };\n },\n apply: function () {\n if (!this.sourceInfo.sortableScope.cloning) {\n // if not cloning, remove the item from the source model.\n this.sourceInfo.sortableScope.removeItem(this.sourceInfo.index);\n\n // if the dragged item is not already there, insert the item. This avoids ng-repeat dupes error\n if (this.parent.options.allowDuplicates || this.parent.modelValue.indexOf(this.source.modelValue) < 0) {\n this.parent.insertItem(this.index, this.source.modelValue);\n }\n } else if (!this.parent.options.clone) { // prevent drop inside sortables that specify options.clone = true\n // clone the model value as well\n this.parent.insertItem(this.index, angular.copy(this.source.modelValue));\n }\n }\n };\n },\n\n /**\n * Check the drag is not allowed for the element.\n *\n * @param element - the element to check\n * @returns {boolean} - true if drag is not allowed.\n */\n noDrag: function (element) {\n return element.attr('no-drag') !== undefined || element.attr('data-no-drag') !== undefined;\n },\n\n /**\n * Helper function to find the first ancestor with a given selector\n * @param el - angular element to start looking at\n * @param selector - selector to find the parent\n * @returns {Object} - Angular element of the ancestor or body if not found\n * @private\n */\n findAncestor: function (el, selector) {\n el = el[0];\n var matches = Element.matches || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n while ((el = el.parentElement) && !matches.call(el, selector)) {\n }\n return el ? angular.element(el) : angular.element(document.body);\n }\n };\n }\n ]);\n\n}());\n\n/*jshint undef: false, unused: false, indent: 2*/\n/*global angular: false */\n\n(function () {\n\n 'use strict';\n var mainModule = angular.module('as.sortable');\n\n /**\n * Controller for Sortable.\n * @param $scope - the sortable scope.\n */\n mainModule.controller('as.sortable.sortableController', ['$scope', function ($scope) {\n\n this.scope = $scope;\n\n $scope.modelValue = null; // sortable list.\n $scope.callbacks = null;\n $scope.type = 'sortable';\n $scope.options = {\n longTouch: false\n };\n $scope.isDisabled = false;\n\n /**\n * Inserts the item in to the sortable list.\n *\n * @param index - the item index.\n * @param itemData - the item model data.\n */\n $scope.insertItem = function (index, itemData) {\n if ($scope.options.allowDuplicates) {\n $scope.modelValue.splice(index, 0, angular.copy(itemData));\n } else {\n $scope.modelValue.splice(index, 0, itemData);\n }\n };\n\n /**\n * Removes the item from the sortable list.\n *\n * @param index - index to be removed.\n * @returns {*} - removed item.\n */\n $scope.removeItem = function (index) {\n var removedItem = null;\n if (index > -1) {\n removedItem = $scope.modelValue.splice(index, 1)[0];\n }\n return removedItem;\n };\n\n /**\n * Checks whether the sortable list is empty.\n *\n * @returns {null|*|$scope.modelValue|boolean}\n */\n $scope.isEmpty = function () {\n return ($scope.modelValue && $scope.modelValue.length === 0);\n };\n\n /**\n * Wrapper for the accept callback delegates to callback.\n *\n * @param sourceItemHandleScope - drag item handle scope.\n * @param destScope - sortable target scope.\n * @param destItemScope - sortable destination item scope.\n * @returns {*|boolean} - true if drop is allowed for the drag item in drop target.\n */\n $scope.accept = function (sourceItemHandleScope, destScope, destItemScope) {\n return $scope.callbacks.accept(sourceItemHandleScope, destScope, destItemScope);\n };\n\n }]);\n\n /**\n * Sortable directive - defines callbacks.\n * Parent directive for draggable and sortable items.\n * Sets modelValue, callbacks, element in scope.\n * sortOptions also includes a longTouch option which activates longTouch when set to true (default is false).\n */\n mainModule.directive('asSortable',\n function () {\n return {\n require: 'ngModel', // get a hold of NgModelController\n restrict: 'A',\n scope: true,\n controller: 'as.sortable.sortableController',\n link: function (scope, element, attrs, ngModelController) {\n\n var ngModel, callbacks;\n\n ngModel = ngModelController;\n\n if (!ngModel) {\n return; // do nothing if no ng-model\n }\n\n // Set the model value in to scope.\n ngModel.$render = function () {\n scope.modelValue = ngModel.$modelValue;\n };\n //set the element in scope to be accessed by its sub scope.\n scope.element = element;\n element.data('_scope',scope); // #144, work with angular debugInfoEnabled(false)\n\n callbacks = {accept: null, orderChanged: null, itemMoved: null, dragStart: null, dragMove:null, dragCancel: null, dragEnd: null};\n\n /**\n * Invoked to decide whether to allow drop.\n *\n * @param sourceItemHandleScope - the drag item handle scope.\n * @param destSortableScope - the drop target sortable scope.\n * @param destItemScope - the drop target item scope.\n * @returns {boolean} - true if allowed for drop.\n */\n callbacks.accept = function (sourceItemHandleScope, destSortableScope, destItemScope) {\n return true;\n };\n\n /**\n * Invoked when order of a drag item is changed.\n *\n * @param event - the event object.\n */\n callbacks.orderChanged = function (event) {\n };\n\n /**\n * Invoked when the item is moved to other sortable.\n *\n * @param event - the event object.\n */\n callbacks.itemMoved = function (event) {\n };\n\n /**\n * Invoked when the drag started successfully.\n *\n * @param event - the event object.\n */\n callbacks.dragStart = function (event) {\n };\n\n /**\n * Invoked when the drag move.\n *\n * @param itemPosition - the item position.\n * @param containment - the containment element.\n * @param eventObj - the event object.\n */\n callbacks.dragMove = angular.noop;\n\n /**\n * Invoked when the drag cancelled.\n *\n * @param event - the event object.\n */\n callbacks.dragCancel = function (event) {\n };\n\n /**\n * Invoked when the drag stopped.\n *\n * @param event - the event object.\n */\n callbacks.dragEnd = function (event) {\n };\n\n //Set the sortOptions callbacks else set it to default.\n scope.$watch(attrs.asSortable, function (newVal, oldVal) {\n angular.forEach(newVal, function (value, key) {\n if (callbacks[key]) {\n if (typeof value === 'function') {\n callbacks[key] = value;\n }\n } else {\n scope.options[key] = value;\n }\n });\n scope.callbacks = callbacks;\n }, true);\n\n // Set isDisabled if attr is set, if undefined isDisabled = false\n if (angular.isDefined(attrs.isDisabled)) {\n scope.$watch(attrs.isDisabled, function (newVal, oldVal) {\n if (!angular.isUndefined(newVal)) {\n scope.isDisabled = newVal;\n }\n }, true);\n }\n }\n };\n });\n\n}());\n\n/*jshint indent: 2 */\n/*global angular: false */\n\n(function () {\n\n 'use strict';\n var mainModule = angular.module('as.sortable');\n\n /**\n * Controller for sortableItemHandle\n *\n * @param $scope - item handle scope.\n */\n mainModule.controller('as.sortable.sortableItemHandleController', ['$scope', function ($scope) {\n\n this.scope = $scope;\n\n $scope.itemScope = null;\n $scope.type = 'handle';\n }]);\n\n //Check if a node is parent to another node\n function isParent(possibleParent, elem) {\n if(!elem || elem.nodeName === 'HTML') {\n return false;\n }\n\n if(elem.parentNode === possibleParent) {\n return true;\n }\n\n return isParent(possibleParent, elem.parentNode);\n }\n\n /**\n * Directive for sortable item handle.\n */\n mainModule.directive('asSortableItemHandle', ['sortableConfig', '$helper', '$window', '$document', '$timeout',\n function (sortableConfig, $helper, $window, $document, $timeout) {\n return {\n require: '^asSortableItem',\n scope: true,\n restrict: 'A',\n controller: 'as.sortable.sortableItemHandleController',\n link: function (scope, element, attrs, itemController) {\n\n var dragElement, //drag item element.\n placeHolder, //place holder class element.\n placeElement,//hidden place element.\n itemPosition, //drag item element position.\n dragItemInfo, //drag item data.\n containment,//the drag container.\n containerPositioning, // absolute or relative positioning.\n dragListen,// drag listen event.\n scrollableContainer, //the scrollable container\n dragStart,// drag start event.\n dragMove,//drag move event.\n dragEnd,//drag end event.\n dragCancel,//drag cancel event.\n isDraggable,//is element draggable.\n placeHolderIndex,//placeholder index in items elements.\n bindDrag,//bind drag events.\n unbindDrag,//unbind drag events.\n bindEvents,//bind the drag events.\n unBindEvents,//unbind the drag events.\n hasTouch,// has touch support.\n isIOS,// is iOS device.\n longTouchStart, // long touch start event\n longTouchCancel, // cancel long touch\n longTouchTimer, // timer promise for the long touch on iOS devices\n dragHandled, //drag handled.\n createPlaceholder,//create place holder.\n isPlaceHolderPresent,//is placeholder present.\n isDisabled = false, // drag enabled\n escapeListen, // escape listen event\n isLongTouch = false; //long touch disabled.\n\n hasTouch = 'ontouchstart' in $window;\n isIOS = /iPad|iPhone|iPod/.test($window.navigator.userAgent) && !$window.MSStream;\n\n if (sortableConfig.handleClass) {\n element.addClass(sortableConfig.handleClass);\n }\n\n scope.itemScope = itemController.scope;\n element.data('_scope', scope); // #144, work with angular debugInfoEnabled(false)\n\n scope.$watchGroup(['sortableScope.isDisabled', 'sortableScope.options.longTouch'],\n function (newValues) {\n if (isDisabled !== newValues[0]) {\n isDisabled = newValues[0];\n if (isDisabled) {\n unbindDrag();\n } else {\n bindDrag();\n }\n } else if (isLongTouch !== newValues[1]) {\n isLongTouch = newValues[1];\n unbindDrag();\n bindDrag();\n } else {\n bindDrag();\n }\n });\n\n scope.$on('$destroy', function () {\n angular.element($document[0].body).unbind('keydown', escapeListen);\n });\n\n createPlaceholder = function (itemScope) {\n if (typeof scope.sortableScope.options.placeholder === 'function') {\n return angular.element(scope.sortableScope.options.placeholder(itemScope));\n } else if (typeof scope.sortableScope.options.placeholder === 'string') {\n return angular.element(scope.sortableScope.options.placeholder);\n } else {\n return angular.element($document[0].createElement(itemScope.element.prop('tagName')));\n }\n };\n\n /**\n * Listens for a 10px movement before\n * dragStart is called to allow for\n * a click event on the element.\n *\n * @param event - the event object.\n */\n dragListen = function (event) {\n\n var unbindMoveListen = function () {\n angular.element($document).unbind('mousemove', moveListen);\n angular.element($document).unbind('touchmove', moveListen);\n element.unbind('mouseup', unbindMoveListen);\n element.unbind('touchend', unbindMoveListen);\n element.unbind('touchcancel', unbindMoveListen);\n };\n\n var startPosition;\n var moveListen = function (e) {\n e.preventDefault();\n var eventObj = $helper.eventObj(e);\n if (!startPosition) {\n startPosition = { clientX: eventObj.clientX, clientY: eventObj.clientY };\n }\n if (Math.abs(eventObj.clientX - startPosition.clientX) + Math.abs(eventObj.clientY - startPosition.clientY) > 10) {\n unbindMoveListen();\n dragStart(event);\n }\n };\n\n angular.element($document).bind('mousemove', moveListen);\n angular.element($document).bind('touchmove', moveListen);\n element.bind('mouseup', unbindMoveListen);\n element.bind('touchend', unbindMoveListen);\n element.bind('touchcancel', unbindMoveListen);\n event.stopPropagation();\n };\n\n /**\n * Triggered when drag event starts.\n *\n * @param event the event object.\n */\n dragStart = function (event) {\n\n var eventObj, tagName;\n\n if (!hasTouch && (event.button === 2 || event.which === 3)) {\n // disable right click\n return;\n }\n if (hasTouch && $helper.isTouchInvalid(event)) {\n return;\n }\n if (dragHandled || !isDraggable(event)) {\n // event has already fired in other scope.\n return;\n }\n // Set the flag to prevent other items from inheriting the drag event\n dragHandled = true;\n event.preventDefault();\n eventObj = $helper.eventObj(event);\n scope.sortableScope = scope.sortableScope || scope.itemScope.sortableScope; //isolate directive scope issue.\n scope.callbacks = scope.callbacks || scope.itemScope.callbacks; //isolate directive scope issue.\n\n if (scope.itemScope.sortableScope.options.clone || (scope.itemScope.sortableScope.options.ctrlClone && event.ctrlKey)) {\n // Clone option is true\n // or Ctrl clone option is true & the ctrl key was pressed when the user innitiated drag\n scope.itemScope.sortableScope.cloning = true;\n } else {\n scope.itemScope.sortableScope.cloning = false;\n }\n\n // (optional) Scrollable container as reference for top & left offset calculations, defaults to Document\n scrollableContainer = angular.element($document[0].querySelector(scope.sortableScope.options.scrollableContainer)).length > 0 ?\n $document[0].querySelector(scope.sortableScope.options.scrollableContainer) : $document[0].documentElement;\n\n containment = (scope.sortableScope.options.containment)? $helper.findAncestor(element, scope.sortableScope.options.containment):angular.element($document[0].body);\n //capture mouse move on containment.\n containment.css('cursor', 'move');\n containment.css('cursor', '-webkit-grabbing');\n containment.css('cursor', '-moz-grabbing');\n containment.addClass('as-sortable-un-selectable');\n\n // container positioning\n containerPositioning = scope.sortableScope.options.containerPositioning || 'absolute';\n\n dragItemInfo = $helper.dragItem(scope);\n tagName = scope.itemScope.element.prop('tagName');\n\n dragElement = angular.element($document[0].createElement(scope.sortableScope.element.prop('tagName')))\n .addClass(scope.sortableScope.element.attr('class')).addClass(sortableConfig.dragClass);\n dragElement.css('width', $helper.width(scope.itemScope.element) + 'px');\n dragElement.css('height', $helper.height(scope.itemScope.element) + 'px');\n\n placeHolder = createPlaceholder(scope.itemScope)\n .addClass(sortableConfig.placeHolderClass).addClass(scope.sortableScope.options.additionalPlaceholderClass);\n placeHolder.css('width', $helper.width(scope.itemScope.element) + 'px');\n placeHolder.css('height', $helper.height(scope.itemScope.element) + 'px');\n\n placeElement = angular.element($document[0].createElement(tagName));\n if (sortableConfig.hiddenClass) {\n placeElement.addClass(sortableConfig.hiddenClass);\n }\n\n itemPosition = $helper.positionStarted(eventObj, scope.itemScope.element, scrollableContainer);\n\n // fill the immediate vacuum.\n if (!scope.itemScope.sortableScope.options.clone) {\n scope.itemScope.element.after(placeHolder);\n }\n\n if (scope.itemScope.sortableScope.cloning) {\n // clone option is enabled or triggered, so clone the element.\n dragElement.append(scope.itemScope.element.clone());\n }\n else {\n // add hidden placeholder element in original position.\n scope.itemScope.element.after(placeElement);\n // not cloning, so use the original element.\n dragElement.append(scope.itemScope.element);\n }\n\n containment.append(dragElement);\n $helper.movePosition(eventObj, dragElement, itemPosition, containment, containerPositioning, scrollableContainer);\n\n scope.sortableScope.$apply(function () {\n scope.callbacks.dragStart(dragItemInfo.eventArgs());\n });\n bindEvents();\n };\n\n /**\n * Allow Drag if it is a proper item-handle element.\n *\n * @param event - the event object.\n * @return boolean - true if element is draggable.\n */\n isDraggable = function (event) {\n\n var elementClicked, sourceScope, isDraggable;\n\n elementClicked = angular.element(event.target);\n\n // look for the handle on the current scope or parent scopes\n sourceScope = fetchScope(elementClicked);\n\n isDraggable = (sourceScope && sourceScope.type === 'handle');\n\n //If a 'no-drag' element inside item-handle if any.\n while (isDraggable && elementClicked[0] !== element[0]) {\n if ($helper.noDrag(elementClicked)) {\n isDraggable = false;\n }\n elementClicked = elementClicked.parent();\n }\n return isDraggable;\n };\n\n /**\n * Inserts the placeHolder in to the targetScope.\n *\n * @param targetElement the target element\n * @param targetScope the target scope\n */\n function insertBefore(targetElement, targetScope) {\n // Ensure the placeholder is visible in the target (unless it's a table row)\n if (placeHolder.css('display') !== 'table-row') {\n placeHolder.css('display', 'block');\n }\n if (!targetScope.sortableScope.options.clone) {\n targetElement[0].parentNode.insertBefore(placeHolder[0], targetElement[0]);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index());\n }\n }\n\n /**\n * Inserts the placeHolder next to the targetScope.\n *\n * @param targetElement the target element\n * @param targetScope the target scope\n */\n function insertAfter(targetElement, targetScope) {\n // Ensure the placeholder is visible in the target (unless it's a table row)\n if (placeHolder.css('display') !== 'table-row') {\n placeHolder.css('display', 'block');\n }\n if (!targetScope.sortableScope.options.clone) {\n targetElement.after(placeHolder);\n dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index() + 1);\n }\n }\n\n /**\n * Triggered when drag is moving.\n *\n * @param event - the event object.\n */\n dragMove = function (event) {\n\n var eventObj, targetX, targetY, targetScope, targetElement;\n\n if (hasTouch && $helper.isTouchInvalid(event)) {\n return;\n }\n // Ignore event if not handled\n if (!dragHandled) {\n return;\n }\n if (dragElement) {\n\n event.preventDefault();\n\n eventObj = $helper.eventObj(event);\n\n // checking if dragMove callback exists, to prevent application\n // rerenderings on each mouse move event\n if (scope.callbacks.dragMove !== angular.noop) {\n scope.sortableScope.$apply(function () {\n scope.callbacks.dragMove(itemPosition, containment, eventObj);\n });\n }\n\n targetX = eventObj.pageX - $document[0].documentElement.scrollLeft;\n targetY = eventObj.pageY - ($window.pageYOffset || $document[0].documentElement.scrollTop);\n\n //IE fixes: hide show element, call element from point twice to return pick correct element.\n dragElement.addClass(sortableConfig.hiddenClass);\n targetElement = angular.element($document[0].elementFromPoint(targetX, targetY));\n dragElement.removeClass(sortableConfig.hiddenClass);\n\n $helper.movePosition(eventObj, dragElement, itemPosition, containment, containerPositioning, scrollableContainer);\n\n //Set Class as dragging starts\n dragElement.addClass(sortableConfig.dragging);\n\n targetScope = fetchScope(targetElement);\n\n if (!targetScope || !targetScope.type) {\n return;\n }\n if (targetScope.type === 'handle') {\n targetScope = targetScope.itemScope;\n }\n if (targetScope.type !== 'item' && targetScope.type !== 'sortable') {\n return;\n }\n\n if (targetScope.type === 'item' && targetScope.accept(scope, targetScope.sortableScope, targetScope)) {\n // decide where to insert placeholder based on target element and current placeholder if is present\n targetElement = targetScope.element;\n\n // Fix #241 Drag and drop have trembling with blocks of different size\n var targetElementOffset = $helper.offset(targetElement, scrollableContainer);\n if (!dragItemInfo.canMove(itemPosition, targetElement, targetElementOffset)) {\n return;\n }\n\n var placeholderIndex = placeHolderIndex(targetScope.sortableScope.element);\n if (placeholderIndex < 0) {\n insertBefore(targetElement, targetScope);\n } else {\n if (placeholderIndex <= targetScope.index()) {\n insertAfter(targetElement, targetScope);\n } else {\n insertBefore(targetElement, targetScope);\n }\n }\n }\n\n if (targetScope.type === 'sortable') {//sortable scope.\n if (targetScope.accept(scope, targetScope) &&\n !isParent(targetScope.element[0], targetElement[0])) {\n //moving over sortable bucket. not over item.\n if (!isPlaceHolderPresent(targetElement) && !targetScope.options.clone) {\n targetElement[0].appendChild(placeHolder[0]);\n dragItemInfo.moveTo(targetScope, targetScope.modelValue.length);\n }\n }\n }\n }\n };\n\n\n /**\n * Fetch scope from element or parents\n * @param {object} element Source element\n * @return {object} Scope, or null if not found\n */\n function fetchScope(element) {\n var scope;\n while (!scope && element.length) {\n scope = element.data('_scope');\n if (!scope) {\n element = element.parent();\n }\n }\n return scope;\n }\n\n\n /**\n * Get position of place holder among item elements in itemScope.\n * @param targetElement the target element to check with.\n * @returns {*} -1 if placeholder is not present, index if yes.\n */\n placeHolderIndex = function (targetElement) {\n var itemElements, i;\n // targetElement is placeHolder itself, return index 0\n if (targetElement.hasClass(sortableConfig.placeHolderClass)){\n return 0;\n }\n // find index in target children\n itemElements = targetElement.children();\n for (i = 0; i < itemElements.length; i += 1) {\n //TODO may not be accurate when elements contain other siblings than item elements\n //solve by adding 1 to model index of previous item element\n if (angular.element(itemElements[i]).hasClass(sortableConfig.placeHolderClass)) {\n return i;\n }\n }\n return -1;\n };\n\n\n /**\n * Check there is no place holder placed by itemScope.\n * @param targetElement the target element to check with.\n * @returns {*} true if place holder present.\n */\n isPlaceHolderPresent = function (targetElement) {\n return placeHolderIndex(targetElement) >= 0;\n };\n\n /**\n * Rollback the drag data changes.\n */\n\n function rollbackDragChanges() {\n if (!scope.itemScope.sortableScope.cloning) {\n placeElement.replaceWith(scope.itemScope.element);\n }\n placeHolder.remove();\n dragElement.remove();\n dragElement = null;\n dragHandled = false;\n containment.css('cursor', '');\n containment.removeClass('as-sortable-un-selectable');\n }\n\n /**\n * triggered while drag ends.\n *\n * @param event - the event object.\n */\n dragEnd = function (event) {\n // Ignore event if not handled\n if (!dragHandled) {\n return;\n }\n event.preventDefault();\n if (dragElement) {\n //rollback all the changes.\n rollbackDragChanges();\n // update model data\n dragItemInfo.apply();\n scope.sortableScope.$apply(function () {\n if (dragItemInfo.isSameParent()) {\n if (dragItemInfo.isOrderChanged()) {\n scope.callbacks.orderChanged(dragItemInfo.eventArgs());\n }\n } else {\n scope.callbacks.itemMoved(dragItemInfo.eventArgs());\n }\n });\n scope.sortableScope.$apply(function () {\n scope.callbacks.dragEnd(dragItemInfo.eventArgs());\n });\n dragItemInfo = null;\n }\n unBindEvents();\n };\n\n /**\n * triggered while drag is cancelled.\n *\n * @param event - the event object.\n */\n dragCancel = function (event) {\n // Ignore event if not handled\n if (!dragHandled) {\n return;\n }\n event.preventDefault();\n\n if (dragElement) {\n //rollback all the changes.\n rollbackDragChanges();\n scope.sortableScope.$apply(function () {\n scope.callbacks.dragCancel(dragItemInfo.eventArgs());\n });\n dragItemInfo = null;\n }\n unBindEvents();\n };\n\n /**\n * Binds the drag start events.\n */\n bindDrag = function () {\n if (hasTouch) {\n if (isLongTouch) {\n if (isIOS) {\n element.bind('touchstart', longTouchStart);\n element.bind('touchend', longTouchCancel);\n element.bind('touchmove', longTouchCancel);\n } else {\n element.bind('contextmenu', dragListen);\n }\n } else {\n element.bind('touchstart', dragListen);\n }\n }\n element.bind('mousedown', dragListen);\n };\n\n /**\n * Unbinds the drag start events.\n */\n unbindDrag = function () {\n element.unbind('touchstart', longTouchStart);\n element.unbind('touchend', longTouchCancel);\n element.unbind('touchmove', longTouchCancel);\n element.unbind('contextmenu', dragListen);\n element.unbind('touchstart', dragListen);\n element.unbind('mousedown', dragListen);\n };\n\n /**\n * starts a timer to detect long touch on iOS devices. If touch held for more than 500ms,\n * it would be considered as long touch.\n *\n * @param event - the event object.\n */\n longTouchStart = function(event) {\n longTouchTimer = $timeout(function() {\n dragListen(event);\n }, 500);\n };\n\n /**\n * cancel the long touch and its timer.\n */\n longTouchCancel = function() {\n $timeout.cancel(longTouchTimer);\n };\n\n //bind drag start events.\n //put in a watcher since this method is now depending on the longtouch option from sortable.sortOptions\n //bindDrag();\n\n //Cancel drag on escape press.\n escapeListen = function (event) {\n if (event.keyCode === 27) {\n dragCancel(event);\n }\n };\n angular.element($document[0].body).bind('keydown', escapeListen);\n\n /**\n * Binds the events based on the actions.\n */\n bindEvents = function () {\n angular.element($document).bind('touchmove', dragMove);\n angular.element($document).bind('touchend', dragEnd);\n angular.element($document).bind('touchcancel', dragCancel);\n angular.element($document).bind('mousemove', dragMove);\n angular.element($document).bind('mouseup', dragEnd);\n };\n\n /**\n * Un binds the events for drag support.\n */\n unBindEvents = function () {\n angular.element($document).unbind('touchend', dragEnd);\n angular.element($document).unbind('touchcancel', dragCancel);\n angular.element($document).unbind('touchmove', dragMove);\n angular.element($document).unbind('mouseup', dragEnd);\n angular.element($document).unbind('mousemove', dragMove);\n };\n }\n };\n }]);\n}());\n\n/*jshint indent: 2 */\n/*global angular: false */\n\n(function () {\n\n 'use strict';\n var mainModule = angular.module('as.sortable');\n\n /**\n * Controller for sortable item.\n *\n * @param $scope - drag item scope\n */\n mainModule.controller('as.sortable.sortableItemController', ['$scope', function ($scope) {\n\n this.scope = $scope;\n\n $scope.sortableScope = null;\n $scope.modelValue = null; // sortable item.\n $scope.type = 'item';\n\n /**\n * returns the index of the drag item from the sortable list.\n *\n * @returns {*} - index value.\n */\n $scope.index = function () {\n return $scope.$index;\n };\n\n /**\n * Returns the item model data.\n *\n * @returns {*} - item model value.\n */\n $scope.itemData = function () {\n return $scope.sortableScope.modelValue[$scope.$index];\n };\n\n }]);\n\n /**\n * sortableItem directive.\n */\n mainModule.directive('asSortableItem', ['sortableConfig',\n function (sortableConfig) {\n return {\n require: ['^asSortable', '?ngModel'],\n restrict: 'A',\n controller: 'as.sortable.sortableItemController',\n link: function (scope, element, attrs, ctrl) {\n var sortableController = ctrl[0];\n var ngModelController = ctrl[1];\n if (sortableConfig.itemClass) {\n element.addClass(sortableConfig.itemClass);\n }\n scope.sortableScope = sortableController.scope;\n if (ngModelController) {\n ngModelController.$render = function () {\n scope.modelValue = ngModelController.$modelValue;\n };\n } else {\n scope.modelValue = sortableController.scope.modelValue[scope.$index];\n }\n scope.element = element;\n element.data('_scope',scope); // #144, work with angular debugInfoEnabled(false)\n }\n };\n }]);\n\n}());\n"]}