Current Directory: /home/astoriaah/www/templates/yootheme/vendor/assets/uikit/dist/js/components
Viewing File: /home/astoriaah/www/templates/yootheme/vendor/assets/uikit/dist/js/components/sortable.min.js
/*! UIkit 3.0.0-rc.8 | http://www.getuikit.com | (c) 2014 - 2017 YOOtheme | MIT License */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("uikit-util")):"function"==typeof define&&define.amd?define("uikitsortable",["uikit-util"],e):t.UIkitSortable=e(t.UIkit.util)}(this,function(h){"use strict";var l,d="uk-animation-target";function c(t,e){var i=h.css(t,"zIndex");return!!h.isVisible(t)&&h.assign({display:"",opacity:e?h.css(t,"opacity"):"0",pointerEvents:"none",position:"absolute",zIndex:"auto"===i?h.index(t):i},u(t))}function p(t){h.css(t.children,{height:"",left:"",opacity:"",pointerEvents:"",position:"",top:"",width:""}),h.removeClass(t,d),h.css(t,"height","")}function u(t){var e=t.getBoundingClientRect(),i=e.height,s=e.width,o=h.position(t),n=o.top,r=o.left;return{top:n+=h.toFloat(h.css(t,"marginTop")),left:r,height:i,width:s}}var t,e={mixins:[{connected:function(){h.addClass(this.$el,this.$name)}},{props:{animation:Number},data:{animation:150},computed:{target:function(){return this.$el}},methods:{animate:function(t){var s=this;l||(l=h.append(document.head,"<style>").sheet).insertRule("."+d+" > * {\n margin-top: 0 !important;\n transform: none !important;\n }",0);var o=h.toNodes(this.target.children),n=o.map(function(t){return c(t,!0)}),e=h.height(this.target),i=window.pageYOffset;t(),h.Transition.cancel(this.target),o.forEach(h.Transition.cancel),p(this.target),this.$update(this.target),h.fastdom.flush();var r=h.height(this.target),a=(o=o.concat(h.toNodes(this.target.children).filter(function(t){return!h.includes(o,t)}))).map(function(t,e){return!!(t.parentNode&&e in n)&&(n[e]?h.isVisible(t)?u(t):{opacity:0}:{opacity:h.isVisible(t)?1:0})});return n=a.map(function(t,e){var i=o[e].parentNode===s.target&&(n[e]||c(o[e]));if(i)if(t){if(!("opacity"in t)){i.opacity%1?t.opacity=1:delete i.opacity}}else delete i.opacity;return i}),h.addClass(this.target,d),o.forEach(function(t,e){return n[e]&&h.css(t,n[e])}),h.css(this.target,"height",e),window.scroll(window.pageXOffset,i),h.Promise.all(o.map(function(t,e){return n[e]&&a[e]?h.Transition.start(t,a[e],s.animation,"ease"):h.Promise.resolve()}).concat(h.Transition.start(this.target,{height:r},this.animation,"ease"))).then(function(){o.forEach(function(t,e){return h.css(t,{display:0===a[e].opacity?"none":"",zIndex:""})}),p(s.target),s.$update(s.target),h.fastdom.flush()},h.noop)}}}],props:{group:String,threshold:Number,clsItem:String,clsPlaceholder:String,clsDrag:String,clsDragState:String,clsBase:String,clsNoDrag:String,clsEmpty:String,clsCustom:String,handle:String},data:{group:!1,threshold:5,clsItem:"uk-sortable-item",clsPlaceholder:"uk-sortable-placeholder",clsDrag:"uk-sortable-drag",clsDragState:"uk-drag",clsBase:"uk-sortable",clsNoDrag:"uk-sortable-nodrag",clsEmpty:"uk-sortable-empty",clsCustom:"",handle:!1},init:function(){var n=this;["init","start","move","end"].forEach(function(t){var o=n[t];n[t]=function(t){n.scrollY=window.pageYOffset;var e=h.getPos(t),i=e.x,s=e.y;n.pos={x:i,y:s},o(t)}})},events:(t={},t[h.pointerDown]="init",t),update:{write:function(){if(this.clsEmpty&&h.toggleClass(this.$el,this.clsEmpty,!this.$el.children.length),this.drag){h.offset(this.drag,{top:this.pos.y+this.origin.top,left:this.pos.x+this.origin.left});var t,e=h.offset(this.drag).top,i=e+this.drag.offsetHeight;0<e&&e<this.scrollY?t=this.scrollY-5:i<h.height(document)&&i>h.height(window)+this.scrollY&&(t=this.scrollY+5),t&&setTimeout(function(){return window.scroll(window.pageXOffset,t)},5)}}},methods:{init:function(t){var e=t.target,i=t.button,s=t.defaultPrevented,o=h.toNodes(this.$el.children).filter(function(t){return h.within(e,t)})[0];!o||h.isInput(t.target)||this.handle&&!h.within(e,this.handle)||0<i||h.within(e,"."+this.clsNoDrag)||s||(t.preventDefault(),this.touched=[this],this.placeholder=o,this.origin=h.assign({target:e,index:h.index(o)},this.pos),h.on(document,h.pointerMove,this.move),h.on(document,h.pointerUp,this.end),h.on(window,"scroll",this.scroll),this.threshold||this.start(t))},start:function(t){this.drag=h.append(this.$container,this.placeholder.outerHTML.replace(/^<li/i,"<div").replace(/li>$/i,"div>")),h.css(this.drag,h.assign({boxSizing:"border-box",width:this.placeholder.offsetWidth,height:this.placeholder.offsetHeight},h.css(this.placeholder,["paddingLeft","paddingRight","paddingTop","paddingBottom"]))),h.attr(this.drag,"uk-no-boot",""),h.addClass(this.drag,this.clsDrag,this.clsCustom),h.height(this.drag.firstElementChild,h.height(this.placeholder.firstElementChild));var e=h.offset(this.placeholder),i=e.left,s=e.top;h.assign(this.origin,{left:i-this.pos.x,top:s-this.pos.y}),h.addClass(this.placeholder,this.clsPlaceholder),h.addClass(this.$el.children,this.clsItem),h.addClass(document.documentElement,this.clsDragState),h.trigger(this.$el,"start",[this,this.placeholder]),this.move(t)},move:function(t){if(this.drag){this.$emit();var e="mousemove"===t.type?t.target:document.elementFromPoint(this.pos.x-document.body.scrollLeft,this.pos.y-document.body.scrollTop),i=this.getSortable(e),s=this.getSortable(this.placeholder),o=i!==s;if(i&&!h.within(e,this.placeholder)&&(!o||i.group&&i.group===s.group)){if(e=i.$el===e.parentNode&&e||h.toNodes(i.$el.children).filter(function(t){return h.within(e,t)})[0],o)s.remove(this.placeholder);else if(!e)return;i.insert(this.placeholder,e),h.includes(this.touched,i)||this.touched.push(i)}}else(Math.abs(this.pos.x-this.origin.x)>this.threshold||Math.abs(this.pos.y-this.origin.y)>this.threshold)&&this.start(t)},scroll:function(){var t=window.pageYOffset;t!==this.scrollY&&(this.pos.y+=t-this.scrollY,this.scrollY=t,this.$emit())},end:function(t){if(h.off(document,h.pointerMove,this.move),h.off(document,h.pointerUp,this.end),h.off(window,"scroll",this.scroll),this.drag){h.preventClick();var e=this.getSortable(this.placeholder);this===e?this.origin.index!==h.index(this.placeholder)&&h.trigger(this.$el,"moved",[this,this.placeholder]):(h.trigger(e.$el,"added",[e,this.placeholder]),h.trigger(this.$el,"removed",[this,this.placeholder])),h.trigger(this.$el,"stop",[this,this.placeholder]),h.remove(this.drag),this.drag=null;var i=this.touched.map(function(t){return t.clsPlaceholder+" "+t.clsItem}).join(" ");this.touched.forEach(function(t){return h.removeClass(t.$el.children,i)}),h.removeClass(document.documentElement,this.clsDragState)}else"mouseup"!==t.type&&h.within(t.target,"a[href]")&&(location.href=h.closest(t.target,"a[href]").href)},insert:function(i,s){var o=this;h.addClass(this.$el.children,this.clsItem);var t=function(){var t,e;s?!h.within(i,o.$el)||(e=s,(t=i).parentNode===e.parentNode&&h.index(t)>h.index(e))?h.before(s,i):h.after(s,i):h.append(o.$el,i)};this.animation?this.animate(t):t()},remove:function(t){h.within(t,this.$el)&&(this.animation?this.animate(function(){return h.remove(t)}):h.remove(t))},getSortable:function(t){return t&&(this.$getComponent(t,"sortable")||this.getSortable(t.parentNode))}}};return"undefined"!=typeof window&&window.UIkit&&window.UIkit.component("sortable",e),e});