{"version":3,"sources":["kendo.treeview.draganddrop.js"],"names":["f","define","$","undefined","kendo","window","ui","proxy","extend","VISIBILITY","KSTATEHOVER","INPUTSELECTOR","DROPHINTTEMPLATE","HierarchicalDragAndDrop","Class","init","element","options","this","hovered","dragstart","noop","drag","drop","dragend","_draggable","Draggable","ignore","filter","autoScroll","cursorOffset","left","top","support","mobileOS","zoomLevel","hint","_hint","dragcancel","$angular","hintText","_removeTouchHover","touch","find","removeClass","_hintStatus","newStatus","statusElement","className","trim","replace","e","source","currentTarget","closest","itemSelector","preventDefault","dropHint","reorderable","css","appendTo","hoveredItem","itemHeight","itemTop","itemContent","delta","insertOnTop","insertOnBottom","addChild","itemData","position","status","target","dropTarget","eventTarget","container","allowedContainers","length","contains","itemFromTarget","item","_outerHeight","content","getOffset","y","location","_lastHover","toggleClass","dropHintContainer","first","last","originalEvent","pageY","pageX","x","substring","setStatus","value","indexOf","remove","destination","eventArgs","dropPrevented","dropPositionFrom","valid","setValid","newValid","dropped","destroy","jQuery","amd","a1","a2","a3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CAwBC,SAAUA,EAAGC,QACVA,OAAO,8BACH,aACA,qBACDD,IACL,WAyME,MA9LC,UAAUE,EAAGC,GAAb,GACOC,GAAQC,OAAOD,MACfE,EAAKF,EAAME,GACXC,EAAQL,EAAEK,MACVC,EAASN,EAAEM,OACXC,EAAa,aACbC,EAAc,gBACdC,EAAgB,8KAChBC,EAAmB,wHACvBN,GAAGO,wBAA0BT,EAAMU,MAAMN,QACrCO,KAAM,SAAUC,EAASC,GACrBC,KAAKF,QAAUA,EACfE,KAAKC,QAAUH,EACfE,KAAKD,QAAUT,GACXY,UAAWlB,EAAEmB,KACbC,KAAMpB,EAAEmB,KACRE,KAAMrB,EAAEmB,KACRG,QAAStB,EAAEmB,MACZJ,GACHC,KAAKO,WAAa,GAAInB,GAAGoB,UAAUV,GAC/BW,OAAQhB,EACRiB,OAAQX,EAAQW,OAChBC,WAAYZ,EAAQY,WAC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F,cAG1BvG,OAAOD,MAAMyG,QACRxG,OAAOD,OACE,kBAAVH,SAAwBA,OAAO6G,IAAM7G,OAAS,SAAU8G,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.treeview.draganddrop.min.js","sourcesContent":["/*!\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('kendo.treeview.draganddrop', [\n 'kendo.data',\n 'kendo.draganddrop'\n ], f);\n}(function () {\n var __meta__ = {\n id: 'treeview.draganddrop',\n name: 'Hierarchical Drag & Drop',\n category: 'framework',\n depends: [\n 'core',\n 'draganddrop'\n ],\n advanced: true\n };\n (function ($, undefined) {\n var kendo = window.kendo;\n var ui = kendo.ui;\n var proxy = $.proxy;\n var extend = $.extend;\n var VISIBILITY = 'visibility';\n var KSTATEHOVER = 'k-state-hover';\n var INPUTSELECTOR = 'input,a:not(.k-in),textarea,.k-multiselect-wrap,select,button,a.k-button>.k-icon,button.k-button>.k-icon,span.k-icon.k-i-arrow-60-right,span.k-icon.k-i-arrow-45-down-right';\n var DROPHINTTEMPLATE = '
' + '
' + '
' + '
';\n ui.HierarchicalDragAndDrop = kendo.Class.extend({\n init: function (element, options) {\n this.element = element;\n this.hovered = element;\n this.options = extend({\n dragstart: $.noop,\n drag: $.noop,\n drop: $.noop,\n dragend: $.noop\n }, options);\n this._draggable = new ui.Draggable(element, {\n ignore: INPUTSELECTOR,\n filter: options.filter,\n autoScroll: options.autoScroll,\n cursorOffset: {\n left: 10,\n top: kendo.support.mobileOS ? -40 / kendo.support.zoomLevel() : 10\n },\n hint: proxy(this._hint, this),\n dragstart: proxy(this.dragstart, this),\n dragcancel: proxy(this.dragcancel, this),\n drag: proxy(this.drag, this),\n dragend: proxy(this.dragend, this),\n $angular: options.$angular\n });\n },\n _hint: function (element) {\n return '
' + '' + this.options.hintText(element) + '
';\n },\n _removeTouchHover: function () {\n if (kendo.support.touch && this.hovered) {\n this.hovered.find('.' + KSTATEHOVER).removeClass(KSTATEHOVER);\n this.hovered = false;\n }\n },\n _hintStatus: function (newStatus) {\n var statusElement = this._draggable.hint.find('.k-drag-status')[0];\n if (newStatus) {\n statusElement.className = 'k-icon k-drag-status ' + newStatus;\n } else {\n return kendo.trim(statusElement.className.replace(/(p|k)-(icon|drag-status)/g, ''));\n }\n },\n dragstart: function (e) {\n this.source = e.currentTarget.closest(this.options.itemSelector);\n if (this.options.dragstart(this.source)) {\n e.preventDefault();\n }\n if (this.options.reorderable) {\n this.dropHint = $(DROPHINTTEMPLATE).css(VISIBILITY, 'hidden').appendTo(this.element);\n } else {\n this.dropHint = $();\n }\n },\n drag: function (e) {\n var options = this.options;\n var source = this.source;\n var target = this.dropTarget = $(kendo.eventTarget(e));\n var container = target.closest(options.allowedContainers);\n var hoveredItem, itemHeight, itemTop, itemContent, delta;\n var insertOnTop, insertOnBottom, addChild;\n var itemData, position, status;\n if (!container.length) {\n status = 'k-i-cancel';\n this._removeTouchHover();\n } else if (source[0] == target[0] || options.contains(source[0], target[0])) {\n status = 'k-i-cancel';\n } else {\n status = 'k-i-insert-middle';\n itemData = options.itemFromTarget(target);\n hoveredItem = itemData.item;\n if (hoveredItem.length) {\n this._removeTouchHover();\n itemHeight = kendo._outerHeight(hoveredItem);\n itemContent = itemData.content;\n if (options.reorderable) {\n delta = itemHeight / (itemContent.length > 0 ? 4 : 2);\n itemTop = kendo.getOffset(hoveredItem).top;\n insertOnTop = e.y.location < itemTop + delta;\n insertOnBottom = itemTop + itemHeight - delta < e.y.location;\n addChild = itemContent.length && !insertOnTop && !insertOnBottom;\n } else {\n addChild = true;\n insertOnTop = false;\n insertOnBottom = false;\n }\n this.hovered = addChild ? container : false;\n this.dropHint.css(VISIBILITY, addChild ? 'hidden' : 'visible');\n if (this._lastHover && this._lastHover[0] != itemContent[0]) {\n this._lastHover.removeClass(KSTATEHOVER);\n }\n this._lastHover = itemContent.toggleClass(KSTATEHOVER, addChild);\n if (addChild) {\n status = 'k-i-plus';\n } else {\n position = hoveredItem.position();\n position.top += insertOnTop ? 0 : itemHeight;\n this.dropHint.css(position)[insertOnTop ? 'prependTo' : 'appendTo'](options.dropHintContainer(hoveredItem));\n if (insertOnTop && itemData.first) {\n status = 'k-i-insert-up';\n }\n if (insertOnBottom && itemData.last) {\n status = 'k-i-insert-down';\n }\n }\n } else if (target[0] != this.dropHint[0]) {\n if (this._lastHover) {\n this._lastHover.removeClass(KSTATEHOVER);\n }\n if (!$.contains(this.element[0], container[0])) {\n status = 'k-i-plus';\n } else {\n status = 'k-i-cancel';\n }\n }\n }\n this.options.drag({\n originalEvent: e.originalEvent,\n source: source,\n target: target,\n pageY: e.y.location,\n pageX: e.x.location,\n status: status.substring(2),\n setStatus: function (value) {\n status = value;\n }\n });\n if (status.indexOf('k-i-insert') !== 0) {\n this.dropHint.css(VISIBILITY, 'hidden');\n }\n this._hintStatus(status);\n },\n dragcancel: function () {\n this.dropHint.remove();\n },\n dragend: function (e) {\n var position = 'over', source = this.source, destination, dropHint = this.dropHint, dropTarget = this.dropTarget, eventArgs, dropPrevented;\n if (dropHint.css(VISIBILITY) == 'visible') {\n position = this.options.dropPositionFrom(dropHint);\n destination = dropHint.closest(this.options.itemSelector);\n } else if (dropTarget) {\n destination = dropTarget.closest(this.options.itemSelector);\n if (!destination.length) {\n destination = dropTarget.closest(this.options.allowedContainers);\n }\n }\n eventArgs = {\n originalEvent: e.originalEvent,\n source: source[0],\n destination: destination[0],\n valid: this._hintStatus() != 'k-i-cancel',\n setValid: function (newValid) {\n this.valid = newValid;\n },\n dropTarget: dropTarget[0],\n position: position\n };\n dropPrevented = this.options.drop(eventArgs);\n dropHint.remove();\n this._removeTouchHover();\n if (this._lastHover) {\n this._lastHover.removeClass(KSTATEHOVER);\n }\n if (!eventArgs.valid || dropPrevented) {\n this._draggable.dropped = eventArgs.valid;\n return;\n }\n this._draggable.dropped = true;\n this.options.dragend({\n originalEvent: e.originalEvent,\n source: source,\n destination: destination,\n position: position\n });\n },\n destroy: function () {\n this._lastHover = this.hovered = null;\n this._draggable.destroy();\n }\n });\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"]}