rails-uikit-sass 2.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/lib/assets/stylesheets/rails-uikit-sass.scss +3 -0
- data/lib/rails-uikit-sass.rb +12 -0
- data/vendor/assets/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/components/accordion.js +180 -0
- data/vendor/assets/javascripts/components/accordion.min.js +2 -0
- data/vendor/assets/javascripts/components/autocomplete.js +340 -0
- data/vendor/assets/javascripts/components/autocomplete.min.js +2 -0
- data/vendor/assets/javascripts/components/datepicker.js +3167 -0
- data/vendor/assets/javascripts/components/datepicker.min.js +3 -0
- data/vendor/assets/javascripts/components/form-password.js +67 -0
- data/vendor/assets/javascripts/components/form-password.min.js +2 -0
- data/vendor/assets/javascripts/components/form-select.js +85 -0
- data/vendor/assets/javascripts/components/form-select.min.js +2 -0
- data/vendor/assets/javascripts/components/grid-parallax.js +168 -0
- data/vendor/assets/javascripts/components/grid-parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/grid.js +540 -0
- data/vendor/assets/javascripts/components/grid.min.js +2 -0
- data/vendor/assets/javascripts/components/htmleditor.js +679 -0
- data/vendor/assets/javascripts/components/htmleditor.min.js +2 -0
- data/vendor/assets/javascripts/components/lightbox.js +588 -0
- data/vendor/assets/javascripts/components/lightbox.min.js +2 -0
- data/vendor/assets/javascripts/components/nestable.js +653 -0
- data/vendor/assets/javascripts/components/nestable.min.js +2 -0
- data/vendor/assets/javascripts/components/notify.js +189 -0
- data/vendor/assets/javascripts/components/notify.min.js +2 -0
- data/vendor/assets/javascripts/components/pagination.js +147 -0
- data/vendor/assets/javascripts/components/pagination.min.js +2 -0
- data/vendor/assets/javascripts/components/parallax.js +462 -0
- data/vendor/assets/javascripts/components/parallax.min.js +2 -0
- data/vendor/assets/javascripts/components/search.js +92 -0
- data/vendor/assets/javascripts/components/search.min.js +2 -0
- data/vendor/assets/javascripts/components/slider.js +552 -0
- data/vendor/assets/javascripts/components/slider.min.js +2 -0
- data/vendor/assets/javascripts/components/slideset.js +523 -0
- data/vendor/assets/javascripts/components/slideset.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow-fx.js +382 -0
- data/vendor/assets/javascripts/components/slideshow-fx.min.js +2 -0
- data/vendor/assets/javascripts/components/slideshow.js +596 -0
- data/vendor/assets/javascripts/components/slideshow.min.js +2 -0
- data/vendor/assets/javascripts/components/sortable.js +688 -0
- data/vendor/assets/javascripts/components/sortable.min.js +2 -0
- data/vendor/assets/javascripts/components/sticky.js +364 -0
- data/vendor/assets/javascripts/components/sticky.min.js +2 -0
- data/vendor/assets/javascripts/components/timepicker.js +192 -0
- data/vendor/assets/javascripts/components/timepicker.min.js +2 -0
- data/vendor/assets/javascripts/components/tooltip.js +235 -0
- data/vendor/assets/javascripts/components/tooltip.min.js +2 -0
- data/vendor/assets/javascripts/components/upload.js +262 -0
- data/vendor/assets/javascripts/components/upload.min.js +2 -0
- data/vendor/assets/javascripts/core/alert.js +66 -0
- data/vendor/assets/javascripts/core/alert.min.js +2 -0
- data/vendor/assets/javascripts/core/button.js +156 -0
- data/vendor/assets/javascripts/core/button.min.js +2 -0
- data/vendor/assets/javascripts/core/core.js +820 -0
- data/vendor/assets/javascripts/core/core.min.js +2 -0
- data/vendor/assets/javascripts/core/cover.js +87 -0
- data/vendor/assets/javascripts/core/cover.min.js +2 -0
- data/vendor/assets/javascripts/core/dropdown.js +534 -0
- data/vendor/assets/javascripts/core/dropdown.min.js +2 -0
- data/vendor/assets/javascripts/core/grid.js +117 -0
- data/vendor/assets/javascripts/core/grid.min.js +2 -0
- data/vendor/assets/javascripts/core/modal.js +387 -0
- data/vendor/assets/javascripts/core/modal.min.js +2 -0
- data/vendor/assets/javascripts/core/nav.js +153 -0
- data/vendor/assets/javascripts/core/nav.min.js +2 -0
- data/vendor/assets/javascripts/core/offcanvas.js +197 -0
- data/vendor/assets/javascripts/core/offcanvas.min.js +2 -0
- data/vendor/assets/javascripts/core/scrollspy.js +209 -0
- data/vendor/assets/javascripts/core/scrollspy.min.js +2 -0
- data/vendor/assets/javascripts/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/core/smooth-scroll.min.js +2 -0
- data/vendor/assets/javascripts/core/switcher.js +307 -0
- data/vendor/assets/javascripts/core/switcher.min.js +2 -0
- data/vendor/assets/javascripts/core/tab.js +169 -0
- data/vendor/assets/javascripts/core/tab.min.js +2 -0
- data/vendor/assets/javascripts/core/toggle.js +124 -0
- data/vendor/assets/javascripts/core/toggle.min.js +2 -0
- data/vendor/assets/javascripts/core/touch.js +175 -0
- data/vendor/assets/javascripts/core/touch.min.js +2 -0
- data/vendor/assets/javascripts/core/utility.js +335 -0
- data/vendor/assets/javascripts/core/utility.min.js +2 -0
- data/vendor/assets/javascripts/uikit.js +3898 -0
- data/vendor/assets/javascripts/uikit.min.js +3 -0
- data/vendor/assets/stylesheets/components/accordion.scss +94 -0
- data/vendor/assets/stylesheets/components/autocomplete.scss +107 -0
- data/vendor/assets/stylesheets/components/datepicker.scss +197 -0
- data/vendor/assets/stylesheets/components/dotnav.scss +212 -0
- data/vendor/assets/stylesheets/components/form-advanced.scss +128 -0
- data/vendor/assets/stylesheets/components/form-file.scss +63 -0
- data/vendor/assets/stylesheets/components/form-password.scss +74 -0
- data/vendor/assets/stylesheets/components/form-select.scss +66 -0
- data/vendor/assets/stylesheets/components/htmleditor.scss +269 -0
- data/vendor/assets/stylesheets/components/nestable.scss +231 -0
- data/vendor/assets/stylesheets/components/notify.scss +190 -0
- data/vendor/assets/stylesheets/components/placeholder.scss +66 -0
- data/vendor/assets/stylesheets/components/progress.scss +173 -0
- data/vendor/assets/stylesheets/components/search.scss +309 -0
- data/vendor/assets/stylesheets/components/slidenav.scss +183 -0
- data/vendor/assets/stylesheets/components/slider.scss +139 -0
- data/vendor/assets/stylesheets/components/slideshow.scss +208 -0
- data/vendor/assets/stylesheets/components/sortable.scss +124 -0
- data/vendor/assets/stylesheets/components/sticky.scss +57 -0
- data/vendor/assets/stylesheets/components/tooltip.scss +178 -0
- data/vendor/assets/stylesheets/components/upload.scss +34 -0
- data/vendor/assets/stylesheets/core/alert.scss +141 -0
- data/vendor/assets/stylesheets/core/animation.scss +599 -0
- data/vendor/assets/stylesheets/core/article.scss +139 -0
- data/vendor/assets/stylesheets/core/badge.scss +110 -0
- data/vendor/assets/stylesheets/core/base.scss +563 -0
- data/vendor/assets/stylesheets/core/block.scss +155 -0
- data/vendor/assets/stylesheets/core/breadcrumb.scss +86 -0
- data/vendor/assets/stylesheets/core/button.scss +406 -0
- data/vendor/assets/stylesheets/core/close.scss +132 -0
- data/vendor/assets/stylesheets/core/column.scss +209 -0
- data/vendor/assets/stylesheets/core/comment.scss +172 -0
- data/vendor/assets/stylesheets/core/contrast.scss +493 -0
- data/vendor/assets/stylesheets/core/cover.scss +70 -0
- data/vendor/assets/stylesheets/core/description-list.scss +71 -0
- data/vendor/assets/stylesheets/core/dropdown.scss +283 -0
- data/vendor/assets/stylesheets/core/flex.scss +320 -0
- data/vendor/assets/stylesheets/core/form.scss +629 -0
- data/vendor/assets/stylesheets/core/grid.scss +731 -0
- data/vendor/assets/stylesheets/core/icon.scss +930 -0
- data/vendor/assets/stylesheets/core/list.scss +102 -0
- data/vendor/assets/stylesheets/core/modal.scss +343 -0
- data/vendor/assets/stylesheets/core/nav.scss +468 -0
- data/vendor/assets/stylesheets/core/navbar.scss +325 -0
- data/vendor/assets/stylesheets/core/offcanvas.scss +203 -0
- data/vendor/assets/stylesheets/core/overlay.scss +534 -0
- data/vendor/assets/stylesheets/core/pagination.scss +197 -0
- data/vendor/assets/stylesheets/core/panel.scss +332 -0
- data/vendor/assets/stylesheets/core/print.scss +61 -0
- data/vendor/assets/stylesheets/core/subnav.scss +213 -0
- data/vendor/assets/stylesheets/core/switcher.scss +38 -0
- data/vendor/assets/stylesheets/core/tab.scss +368 -0
- data/vendor/assets/stylesheets/core/table.scss +147 -0
- data/vendor/assets/stylesheets/core/text.scss +136 -0
- data/vendor/assets/stylesheets/core/thumbnail.scss +122 -0
- data/vendor/assets/stylesheets/core/thumbnav.scss +122 -0
- data/vendor/assets/stylesheets/core/utility.scss +610 -0
- data/vendor/assets/stylesheets/core/variables.scss +23 -0
- data/vendor/assets/stylesheets/uikit-mixins.scss +327 -0
- data/vendor/assets/stylesheets/uikit-variables.scss +819 -0
- data/vendor/assets/stylesheets/uikit.scss +52 -0
- metadata +251 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-slideshow",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";var t,s=0;i.component("slideshow",{defaults:{animation:"fade",duration:500,height:"auto",start:0,autoplay:!1,autoplayInterval:7e3,videoautoplay:!0,videomute:!0,slices:15,pauseOnHover:!0,kenburns:!1,kenburnsanimations:["uk-animation-middle-left","uk-animation-top-right","uk-animation-bottom-left","uk-animation-top-center","","uk-animation-bottom-right"]},current:!1,interval:null,hovering:!1,boot:function(){i.ready(function(t){i.$("[data-uk-slideshow]",t).each(function(){var t=i.$(this);t.data("slideshow")||i.slideshow(t,i.Utils.options(t.attr("data-uk-slideshow")))})})},init:function(){var t=this;this.container=this.element.hasClass("uk-slideshow")?this.element:i.$(this.find(".uk-slideshow:first")),this.current=this.options.start,this.animating=!1,this.fixFullscreen=navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&this.container.hasClass("uk-slideshow-fullscreen"),this.options.kenburns&&(this.kbanimduration=this.options.kenburns===!0?"15s":this.options.kenburns,String(this.kbanimduration).match(/(ms|s)$/)||(this.kbanimduration+="ms"),"string"==typeof this.options.kenburnsanimations&&(this.options.kenburnsanimations=this.options.kenburnsanimations.split(","))),this.update(),this.on("click.uk.slideshow","[data-uk-slideshow-item]",function(s){s.preventDefault();var e=i.$(this).attr("data-uk-slideshow-item");if(t.current!=e){switch(e){case"next":case"previous":t["next"==e?"next":"previous"]();break;default:t.show(parseInt(e,10))}t.stop()}}),i.$win.on("resize load",i.Utils.debounce(function(){t.resize(),t.fixFullscreen&&(t.container.css("height",window.innerHeight),t.slides.css("height",window.innerHeight))},100)),setTimeout(function(){t.resize()},80),this.options.autoplay&&this.start(),this.options.videoautoplay&&this.slides.eq(this.current).data("media")&&this.playmedia(this.slides.eq(this.current).data("media")),this.options.kenburns&&this.applyKenBurns(this.slides.eq(this.current)),this.container.on({mouseenter:function(){t.options.pauseOnHover&&(t.hovering=!0)},mouseleave:function(){t.hovering=!1}}),this.on("swipeRight swipeLeft",function(i){t["swipeLeft"==i.type?"next":"previous"]()}),this.on("display.uk.check",function(){t.element.is(":visible")&&(t.resize(),t.fixFullscreen&&(t.container.css("height",window.innerHeight),t.slides.css("height",window.innerHeight)))}),i.domObserve(this.element,function(){t.container.children(":not([data-slideshow-slide])").not(".uk-slideshow-ghost").length&&t.update(!0)})},update:function(t){var e,a=this,n=0;this.slides=this.container.children(),this.slidesCount=this.slides.length,this.slides.eq(this.current).length||(this.current=0),this.slides.each(function(t){var o=i.$(this);if(!o.data("processed")){var r=o.children("img,video,iframe").eq(0),d="html";if(o.data("media",r),o.data("sizer",r),r.length){var u;switch(d=r[0].nodeName.toLowerCase(),r[0].nodeName){case"IMG":var h=i.$('<div class="uk-cover-background uk-position-cover"></div>').css({"background-image":"url("+r.attr("src")+")"});r.attr("width")&&r.attr("height")&&(u=i.$("<canvas></canvas>").attr({width:r.attr("width"),height:r.attr("height")}),r.replaceWith(u),r=u,u=void 0),r.css({width:"100%",height:"auto",opacity:0}),o.prepend(h).data("cover",h);break;case"IFRAME":var c=r[0].src,l="sw-"+ ++s;r.attr("src","").on("load",function(){if((t!==a.current||t==a.current&&!a.options.videoautoplay)&&a.pausemedia(r),a.options.videomute){a.mutemedia(r);var i=setInterval(function(t){return function(){a.mutemedia(r),++t>=4&&clearInterval(i)}}(0),250)}}).data("slideshow",a).attr("data-player-id",l).attr("src",[c,c.indexOf("?")>-1?"&":"?","enablejsapi=1&api=1&player_id="+l].join("")).addClass("uk-position-absolute"),i.support.touch||r.css("pointer-events","none"),u=!0,i.cover&&(i.cover(r),r.attr("data-uk-cover","{}"));break;case"VIDEO":r.addClass("uk-cover-object uk-position-absolute"),u=!0,a.options.videomute&&a.mutemedia(r)}if(u){e=i.$("<canvas></canvas>").attr({width:r[0].width,height:r[0].height});var p=i.$('<img style="width:100%;height:auto;">').attr("src",e[0].toDataURL());o.prepend(p),o.data("sizer",p)}}else o.data("sizer",o);a.hasKenBurns(o)&&o.data("cover").css({"-webkit-animation-duration":a.kbanimduration,"animation-duration":a.kbanimduration}),o.data("processed",++n),o.attr("data-slideshow-slide",d)}}),n&&(this.triggers=this.find("[data-uk-slideshow-item]"),this.slides.attr("aria-hidden","true").removeClass("uk-active").eq(this.current).addClass("uk-active").attr("aria-hidden","false"),this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass("uk-active")),t&&n&&this.resize()},resize:function(){if(!this.container.hasClass("uk-slideshow-fullscreen")){var t=this.options.height;"auto"===this.options.height&&(t=0,this.slides.css("height","").each(function(){t=Math.max(t,i.$(this).height())})),this.container.css("height",t),this.slides.css("height",t)}},show:function(s,e){if(!this.animating&&this.current!=s){this.animating=!0;var a=this,n=this.slides.eq(this.current),o=this.slides.eq(s),r=e?e:this.current<s?1:-1,d=n.data("media"),u=t[this.options.animation]?this.options.animation:"fade",h=o.data("media"),c=function(){a.animating&&(d&&d.is("video,iframe")&&a.pausemedia(d),h&&h.is("video,iframe")&&a.playmedia(h),o.addClass("uk-active").attr("aria-hidden","false"),n.removeClass("uk-active").attr("aria-hidden","true"),a.animating=!1,a.current=s,i.Utils.checkDisplay(o,'[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)'),a.trigger("show.uk.slideshow",[o,n,a]))};a.applyKenBurns(o),i.support.animation||(u="none"),n=i.$(n),o=i.$(o),a.trigger("beforeshow.uk.slideshow",[o,n,a]),t[u].apply(this,[n,o,r]).then(c),a.triggers.removeClass("uk-active"),a.triggers.filter('[data-uk-slideshow-item="'+s+'"]').addClass("uk-active")}},applyKenBurns:function(i){if(this.hasKenBurns(i)){var t=this.options.kenburnsanimations,s=this.kbindex||0;i.data("cover").attr("class","uk-cover-background uk-position-cover").width(),i.data("cover").addClass(["uk-animation-scale","uk-animation-reverse",t[s].trim()].join(" ")),this.kbindex=t[s+1]?s+1:0}},hasKenBurns:function(i){return this.options.kenburns&&i.data("cover")},next:function(){this.show(this.slides[this.current+1]?this.current+1:0,1)},previous:function(){this.show(this.slides[this.current-1]?this.current-1:this.slides.length-1,-1)},start:function(){this.stop();var i=this;this.interval=setInterval(function(){i.hovering||i.next()},this.options.autoplayInterval)},stop:function(){this.interval&&clearInterval(this.interval)},playmedia:function(i){if(i&&i[0])switch(i[0].nodeName){case"VIDEO":this.options.videomute||(i[0].muted=!1),i[0].play();break;case"IFRAME":this.options.videomute||i[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}',"*"),i[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}',"*")}},pausemedia:function(i){switch(i[0].nodeName){case"VIDEO":i[0].pause();break;case"IFRAME":i[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}',"*")}},mutemedia:function(i){switch(i[0].nodeName){case"VIDEO":i[0].muted=!0;break;case"IFRAME":i[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}',"*")}}}),t={none:function(){var t=i.$.Deferred();return t.resolve(),t.promise()},scroll:function(t,s,e){var a=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1).one(i.support.animation.end,function(){t.css("opacity",0).removeClass(-1==e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),s.removeClass(-1==e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),a.resolve()}.bind(this)),t.addClass(-1==e?"uk-slideshow-scroll-backward-out":"uk-slideshow-scroll-forward-out"),s.addClass(-1==e?"uk-slideshow-scroll-backward-in":"uk-slideshow-scroll-forward-in"),s.width(),a.promise()},swipe:function(t,s,e){var a=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1).one(i.support.animation.end,function(){t.css("opacity",0).removeClass(-1===e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),s.removeClass(-1===e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),a.resolve()}.bind(this)),t.addClass(-1==e?"uk-slideshow-swipe-backward-out":"uk-slideshow-swipe-forward-out"),s.addClass(-1==e?"uk-slideshow-swipe-backward-in":"uk-slideshow-swipe-forward-in"),s.width(),a.promise()},scale:function(t,s){var e=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1),t.one(i.support.animation.end,function(){t.css("opacity",0).removeClass("uk-slideshow-scale-out"),e.resolve()}.bind(this)),t.addClass("uk-slideshow-scale-out"),t.width(),e.promise()},fade:function(t,s){var e=i.$.Deferred();return t.css("animation-duration",this.options.duration+"ms"),s.css("animation-duration",this.options.duration+"ms"),s.css("opacity",1),s.data("cover")||s.data("placeholder")||s.css("opacity",1).one(i.support.animation.end,function(){s.removeClass("uk-slideshow-fade-in")}).addClass("uk-slideshow-fade-in"),t.one(i.support.animation.end,function(){t.css("opacity",0).removeClass("uk-slideshow-fade-out"),e.resolve()}.bind(this)),t.addClass("uk-slideshow-fade-out"),t.width(),e.promise()}},i.slideshow.animations=t,window.addEventListener("message",function(t){var s,e=t.data;if("string"==typeof e)try{e=JSON.parse(e)}catch(a){e={}}t.origin&&t.origin.indexOf("vimeo")>-1&&"ready"==e.event&&e.player_id&&(s=i.$('[data-player-id="'+e.player_id+'"]'),s.length&&s.data("slideshow").mutemedia(s))},!1)});
|
@@ -0,0 +1,688 @@
|
|
1
|
+
/*! UIkit 2.27.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
/*
|
3
|
+
* Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
|
4
|
+
*/
|
5
|
+
(function(addon) {
|
6
|
+
|
7
|
+
var component;
|
8
|
+
|
9
|
+
if (window.UIkit) {
|
10
|
+
component = addon(UIkit);
|
11
|
+
}
|
12
|
+
|
13
|
+
if (typeof define == 'function' && define.amd) {
|
14
|
+
define('uikit-sortable', ['uikit'], function(){
|
15
|
+
return component || addon(UIkit);
|
16
|
+
});
|
17
|
+
}
|
18
|
+
|
19
|
+
})(function(UI){
|
20
|
+
|
21
|
+
"use strict";
|
22
|
+
|
23
|
+
var supportsTouch = ('ontouchstart' in window || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
|
24
|
+
draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement, startEvent;
|
25
|
+
|
26
|
+
var POINTER_DOWN = supportsTouch ? ('MSGesture' in window ? 'pointerdown':'touchstart') : 'mousedown',
|
27
|
+
POINTER_MOVE = supportsTouch ? ('MSGesture' in window ? 'pointermove':'touchmove') : 'mousemove',
|
28
|
+
POINTER_UP = supportsTouch ? ('MSGesture' in window ? 'pointerup':'touchend') : 'mouseup';
|
29
|
+
|
30
|
+
function closestSortable(ele) {
|
31
|
+
|
32
|
+
ele = UI.$(ele);
|
33
|
+
|
34
|
+
do {
|
35
|
+
if (ele.data('sortable')) {
|
36
|
+
return ele;
|
37
|
+
}
|
38
|
+
ele = UI.$(ele).parent();
|
39
|
+
} while(ele.length);
|
40
|
+
|
41
|
+
return ele;
|
42
|
+
}
|
43
|
+
|
44
|
+
UI.component('sortable', {
|
45
|
+
|
46
|
+
defaults: {
|
47
|
+
|
48
|
+
animation : 150,
|
49
|
+
threshold : 10,
|
50
|
+
|
51
|
+
childClass : 'uk-sortable-item',
|
52
|
+
placeholderClass : 'uk-sortable-placeholder',
|
53
|
+
overClass : 'uk-sortable-over',
|
54
|
+
draggingClass : 'uk-sortable-dragged',
|
55
|
+
dragMovingClass : 'uk-sortable-moving',
|
56
|
+
baseClass : 'uk-sortable',
|
57
|
+
noDragClass : 'uk-sortable-nodrag',
|
58
|
+
emptyClass : 'uk-sortable-empty',
|
59
|
+
dragCustomClass : '',
|
60
|
+
handleClass : false,
|
61
|
+
group : false,
|
62
|
+
|
63
|
+
stop : function() {},
|
64
|
+
start : function() {},
|
65
|
+
change : function() {}
|
66
|
+
},
|
67
|
+
|
68
|
+
boot: function() {
|
69
|
+
|
70
|
+
// auto init
|
71
|
+
UI.ready(function(context) {
|
72
|
+
|
73
|
+
UI.$('[data-uk-sortable]', context).each(function(){
|
74
|
+
|
75
|
+
var ele = UI.$(this);
|
76
|
+
|
77
|
+
if(!ele.data('sortable')) {
|
78
|
+
UI.sortable(ele, UI.Utils.options(ele.attr('data-uk-sortable')));
|
79
|
+
}
|
80
|
+
});
|
81
|
+
});
|
82
|
+
|
83
|
+
UI.$html.on(POINTER_MOVE, function(e) {
|
84
|
+
|
85
|
+
if (delayIdle) {
|
86
|
+
|
87
|
+
var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e;
|
88
|
+
|
89
|
+
if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) {
|
90
|
+
delayIdle.apply(src);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
if (draggingPlaceholder) {
|
95
|
+
|
96
|
+
if (!moving) {
|
97
|
+
moving = true;
|
98
|
+
draggingPlaceholder.show();
|
99
|
+
|
100
|
+
draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
|
101
|
+
draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
|
102
|
+
|
103
|
+
UI.$html.addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
|
104
|
+
}
|
105
|
+
|
106
|
+
var offset = draggingPlaceholder.data('mouse-offset'),
|
107
|
+
ev = e.originalEvent.touches && e.originalEvent.touches[0] || e.originalEvent,
|
108
|
+
left = parseInt(ev.pageX, 10) + offset.left,
|
109
|
+
top = parseInt(ev.pageY, 10) + offset.top;
|
110
|
+
|
111
|
+
draggingPlaceholder.css({left: left, top: top });
|
112
|
+
|
113
|
+
// adjust document scrolling
|
114
|
+
|
115
|
+
if (top + (draggingPlaceholder.height()/3) > document.body.offsetHeight) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
|
119
|
+
if (top < UI.$win.scrollTop()) {
|
120
|
+
UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/3));
|
121
|
+
} else if ( (top + (draggingPlaceholder.height()/3)) > (window.innerHeight + UI.$win.scrollTop()) ) {
|
122
|
+
UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/3));
|
123
|
+
}
|
124
|
+
}
|
125
|
+
});
|
126
|
+
|
127
|
+
UI.$html.on(POINTER_UP, function(e) {
|
128
|
+
|
129
|
+
delayIdle = clickedlink = false;
|
130
|
+
|
131
|
+
// dragging?
|
132
|
+
if (!currentlyDraggingElement || !draggingPlaceholder) {
|
133
|
+
// completely reset dragging attempt. will cause weird delay behavior elsewise
|
134
|
+
currentlyDraggingElement = draggingPlaceholder = null;
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
|
138
|
+
// inside or outside of sortable?
|
139
|
+
var sortable = closestSortable(currentlyDraggingElement),
|
140
|
+
component = draggingPlaceholder.$sortable,
|
141
|
+
ev = { type: e.type };
|
142
|
+
|
143
|
+
if (sortable[0]) {
|
144
|
+
component.dragDrop(ev, component.element);
|
145
|
+
}
|
146
|
+
component.dragEnd(ev, component.element);
|
147
|
+
});
|
148
|
+
},
|
149
|
+
|
150
|
+
init: function() {
|
151
|
+
|
152
|
+
var $this = this,
|
153
|
+
element = this.element[0];
|
154
|
+
|
155
|
+
touchedlists = [];
|
156
|
+
|
157
|
+
this.checkEmptyList();
|
158
|
+
|
159
|
+
this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group'));
|
160
|
+
|
161
|
+
var handleDragStart = delegate(function(e) {
|
162
|
+
|
163
|
+
if (e.data && e.data.sortable) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
|
167
|
+
var $target = UI.$(e.target),
|
168
|
+
$link = $target.is('a[href]') ? $target:$target.parents('a[href]');
|
169
|
+
|
170
|
+
if ($target.is(':input')) {
|
171
|
+
return;
|
172
|
+
}
|
173
|
+
|
174
|
+
if ($this.options.handleClass) {
|
175
|
+
var handle = $target.hasClass($this.options.handleClass) ? $target : $target.closest('.'+$this.options.handleClass, $this.element);
|
176
|
+
if (!handle.length) return;
|
177
|
+
}
|
178
|
+
|
179
|
+
e.preventDefault();
|
180
|
+
|
181
|
+
if ($link.length) {
|
182
|
+
|
183
|
+
$link.one('click', function(e){
|
184
|
+
e.preventDefault();
|
185
|
+
}).one(POINTER_UP, function(){
|
186
|
+
|
187
|
+
if (!moved) {
|
188
|
+
$link.trigger('click');
|
189
|
+
if (supportsTouch && $link.attr('href').trim()) {
|
190
|
+
location.href = $link.attr('href');
|
191
|
+
}
|
192
|
+
}
|
193
|
+
});
|
194
|
+
}
|
195
|
+
|
196
|
+
e.data = e.data || {};
|
197
|
+
|
198
|
+
e.data.sortable = element;
|
199
|
+
|
200
|
+
return $this.dragStart(e, this);
|
201
|
+
});
|
202
|
+
|
203
|
+
var handleDragEnter = delegate(UI.Utils.debounce(function(e) {
|
204
|
+
return $this.dragEnter(e, this);
|
205
|
+
}), 40);
|
206
|
+
|
207
|
+
var handleDragLeave = delegate(function(e) {
|
208
|
+
|
209
|
+
// Prevent dragenter on a child from allowing a dragleave on the container
|
210
|
+
var previousCounter = $this.dragenterData(this);
|
211
|
+
$this.dragenterData(this, previousCounter - 1);
|
212
|
+
|
213
|
+
// This is a fix for child elements firing dragenter before the parent fires dragleave
|
214
|
+
if (!$this.dragenterData(this)) {
|
215
|
+
UI.$(this).removeClass($this.options.overClass);
|
216
|
+
$this.dragenterData(this, false);
|
217
|
+
}
|
218
|
+
});
|
219
|
+
|
220
|
+
var handleTouchMove = delegate(function(e) {
|
221
|
+
|
222
|
+
if (!currentlyDraggingElement ||
|
223
|
+
currentlyDraggingElement === this ||
|
224
|
+
currentlyDraggingTarget === this) {
|
225
|
+
return true;
|
226
|
+
}
|
227
|
+
|
228
|
+
$this.element.children().removeClass($this.options.overClass);
|
229
|
+
currentlyDraggingTarget = this;
|
230
|
+
|
231
|
+
$this.moveElementNextTo(currentlyDraggingElement, this);
|
232
|
+
|
233
|
+
return prevent(e);
|
234
|
+
});
|
235
|
+
|
236
|
+
// Bind/unbind standard mouse/touch events as a polyfill.
|
237
|
+
function addDragHandlers() {
|
238
|
+
|
239
|
+
if (supportsTouch && startEvent.touches && startEvent.touches.length) {
|
240
|
+
element.addEventListener(POINTER_MOVE, handleTouchMove, false);
|
241
|
+
} else {
|
242
|
+
element.addEventListener('mouseover', handleDragEnter, false);
|
243
|
+
element.addEventListener('mouseout', handleDragLeave, false);
|
244
|
+
}
|
245
|
+
|
246
|
+
// document.addEventListener("selectstart", prevent, false);
|
247
|
+
}
|
248
|
+
|
249
|
+
function removeDragHandlers() {
|
250
|
+
if (supportsTouch && startEvent.touches && startEvent.touches.length) {
|
251
|
+
element.removeEventListener(POINTER_MOVE, handleTouchMove, false);
|
252
|
+
} else {
|
253
|
+
element.removeEventListener('mouseover', handleDragEnter, false);
|
254
|
+
element.removeEventListener('mouseout', handleDragLeave, false);
|
255
|
+
}
|
256
|
+
|
257
|
+
// document.removeEventListener("selectstart", prevent, false);
|
258
|
+
}
|
259
|
+
|
260
|
+
this.addDragHandlers = addDragHandlers;
|
261
|
+
this.removeDragHandlers = removeDragHandlers;
|
262
|
+
|
263
|
+
function handleDragMove(e) {
|
264
|
+
|
265
|
+
if (!currentlyDraggingElement) {
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
|
269
|
+
$this.dragMove(e, $this);
|
270
|
+
}
|
271
|
+
|
272
|
+
function delegate(fn) {
|
273
|
+
|
274
|
+
return function(e) {
|
275
|
+
|
276
|
+
var touch, target, context;
|
277
|
+
|
278
|
+
startEvent = e;
|
279
|
+
|
280
|
+
if (e) {
|
281
|
+
touch = e.touches && e.touches[0] || e;
|
282
|
+
target = touch.target || e.target;
|
283
|
+
|
284
|
+
// Fix event.target for a touch event
|
285
|
+
if (supportsTouch && document.elementFromPoint) {
|
286
|
+
target = document.elementFromPoint(touch.pageX - document.body.scrollLeft, touch.pageY - document.body.scrollTop);
|
287
|
+
}
|
288
|
+
|
289
|
+
overElement = UI.$(target);
|
290
|
+
}
|
291
|
+
|
292
|
+
if (UI.$(target).hasClass('.'+$this.options.childClass)) {
|
293
|
+
fn.apply(target, [e]);
|
294
|
+
} else if (target !== element) {
|
295
|
+
|
296
|
+
// If a child is initiating the event or ending it, then use the container as context for the callback.
|
297
|
+
context = moveUpToChildNode(element, target);
|
298
|
+
|
299
|
+
if (context) {
|
300
|
+
fn.apply(context, [e]);
|
301
|
+
}
|
302
|
+
}
|
303
|
+
};
|
304
|
+
}
|
305
|
+
|
306
|
+
window.addEventListener(POINTER_MOVE, handleDragMove, false);
|
307
|
+
element.addEventListener(POINTER_DOWN, handleDragStart, false);
|
308
|
+
},
|
309
|
+
|
310
|
+
dragStart: function(e, elem) {
|
311
|
+
|
312
|
+
moved = false;
|
313
|
+
moving = false;
|
314
|
+
dragging = false;
|
315
|
+
|
316
|
+
var $this = this,
|
317
|
+
target = UI.$(e.target);
|
318
|
+
|
319
|
+
if (!supportsTouch && e.button==2) {
|
320
|
+
return;
|
321
|
+
}
|
322
|
+
|
323
|
+
if (target.is('.'+$this.options.noDragClass) || target.closest('.'+$this.options.noDragClass).length) {
|
324
|
+
return;
|
325
|
+
}
|
326
|
+
|
327
|
+
// prevent dragging if taget is a form field
|
328
|
+
if (target.is(':input')) {
|
329
|
+
return;
|
330
|
+
}
|
331
|
+
|
332
|
+
currentlyDraggingElement = elem;
|
333
|
+
|
334
|
+
// init drag placeholder
|
335
|
+
if (draggingPlaceholder) {
|
336
|
+
draggingPlaceholder.remove();
|
337
|
+
}
|
338
|
+
|
339
|
+
var $current = UI.$(currentlyDraggingElement), offset = $current.offset(), ev = e.touches && e.touches[0] || e;
|
340
|
+
|
341
|
+
delayIdle = {
|
342
|
+
|
343
|
+
pos : { x:ev.pageX, y:ev.pageY },
|
344
|
+
threshold : $this.options.handleClass ? 1 : $this.options.threshold,
|
345
|
+
apply : function(evt) {
|
346
|
+
|
347
|
+
draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
|
348
|
+
display : 'none',
|
349
|
+
top : offset.top,
|
350
|
+
left : offset.left,
|
351
|
+
width : $current.width(),
|
352
|
+
height : $current.height(),
|
353
|
+
padding : $current.css('padding')
|
354
|
+
}).data({
|
355
|
+
'mouse-offset': {
|
356
|
+
left : offset.left - parseInt(ev.pageX, 10),
|
357
|
+
top : offset.top - parseInt(ev.pageY, 10)
|
358
|
+
},
|
359
|
+
origin : $this.element,
|
360
|
+
index : $current.index()
|
361
|
+
}).append($current.html()).appendTo('body');
|
362
|
+
|
363
|
+
draggingPlaceholder.$current = $current;
|
364
|
+
draggingPlaceholder.$sortable = $this;
|
365
|
+
|
366
|
+
$current.data({
|
367
|
+
'start-list': $current.parent(),
|
368
|
+
'start-index': $current.index(),
|
369
|
+
'sortable-group': $this.options.group
|
370
|
+
});
|
371
|
+
|
372
|
+
$this.addDragHandlers();
|
373
|
+
|
374
|
+
$this.options.start(this, currentlyDraggingElement);
|
375
|
+
$this.trigger('start.uk.sortable', [$this, currentlyDraggingElement, draggingPlaceholder]);
|
376
|
+
|
377
|
+
moved = true;
|
378
|
+
delayIdle = false;
|
379
|
+
}
|
380
|
+
};
|
381
|
+
},
|
382
|
+
|
383
|
+
dragMove: function(e, elem) {
|
384
|
+
|
385
|
+
overElement = UI.$(document.elementFromPoint(e.pageX - (document.body.scrollLeft || document.scrollLeft || 0), e.pageY - (document.body.scrollTop || document.documentElement.scrollTop || 0)));
|
386
|
+
|
387
|
+
var overRoot = overElement.closest('.'+this.options.baseClass),
|
388
|
+
groupOver = overRoot.data('sortable-group'),
|
389
|
+
$current = UI.$(currentlyDraggingElement),
|
390
|
+
currentRoot = $current.parent(),
|
391
|
+
groupCurrent = $current.data('sortable-group'),
|
392
|
+
overChild;
|
393
|
+
|
394
|
+
if (overRoot[0] !== currentRoot[0] && groupCurrent !== undefined && groupOver === groupCurrent) {
|
395
|
+
|
396
|
+
overRoot.data('sortable').addDragHandlers();
|
397
|
+
|
398
|
+
touchedlists.push(overRoot);
|
399
|
+
overRoot.children().addClass(this.options.childClass);
|
400
|
+
|
401
|
+
// swap root
|
402
|
+
if (overRoot.children().length > 0) {
|
403
|
+
overChild = overElement.closest('.'+this.options.childClass);
|
404
|
+
|
405
|
+
if (overChild.length) {
|
406
|
+
overChild.before($current);
|
407
|
+
} else {
|
408
|
+
overRoot.append($current);
|
409
|
+
}
|
410
|
+
|
411
|
+
} else { // empty list
|
412
|
+
overElement.append($current);
|
413
|
+
}
|
414
|
+
|
415
|
+
UIkit.$doc.trigger('mouseover');
|
416
|
+
}
|
417
|
+
|
418
|
+
this.checkEmptyList();
|
419
|
+
this.checkEmptyList(currentRoot);
|
420
|
+
},
|
421
|
+
|
422
|
+
dragEnter: function(e, elem) {
|
423
|
+
|
424
|
+
if (!currentlyDraggingElement || currentlyDraggingElement === elem) {
|
425
|
+
return true;
|
426
|
+
}
|
427
|
+
|
428
|
+
var previousCounter = this.dragenterData(elem);
|
429
|
+
|
430
|
+
this.dragenterData(elem, previousCounter + 1);
|
431
|
+
|
432
|
+
// Prevent dragenter on a child from allowing a dragleave on the container
|
433
|
+
if (previousCounter === 0) {
|
434
|
+
|
435
|
+
var currentlist = UI.$(elem).parent(),
|
436
|
+
startlist = UI.$(currentlyDraggingElement).data('start-list');
|
437
|
+
|
438
|
+
if (currentlist[0] !== startlist[0]) {
|
439
|
+
|
440
|
+
var groupOver = currentlist.data('sortable-group'),
|
441
|
+
groupCurrent = UI.$(currentlyDraggingElement).data('sortable-group');
|
442
|
+
|
443
|
+
if ((groupOver || groupCurrent) && (groupOver != groupCurrent)) {
|
444
|
+
return false;
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
448
|
+
UI.$(elem).addClass(this.options.overClass);
|
449
|
+
this.moveElementNextTo(currentlyDraggingElement, elem);
|
450
|
+
}
|
451
|
+
|
452
|
+
return false;
|
453
|
+
},
|
454
|
+
|
455
|
+
dragEnd: function(e, elem) {
|
456
|
+
|
457
|
+
var $this = this;
|
458
|
+
|
459
|
+
// avoid triggering event twice
|
460
|
+
if (currentlyDraggingElement) {
|
461
|
+
// TODO: trigger on right element?
|
462
|
+
this.options.stop(elem);
|
463
|
+
this.trigger('stop.uk.sortable', [this]);
|
464
|
+
}
|
465
|
+
|
466
|
+
currentlyDraggingElement = null;
|
467
|
+
currentlyDraggingTarget = null;
|
468
|
+
|
469
|
+
touchedlists.push(this.element);
|
470
|
+
touchedlists.forEach(function(el, i) {
|
471
|
+
UI.$(el).children().each(function() {
|
472
|
+
if (this.nodeType === 1) {
|
473
|
+
UI.$(this).removeClass($this.options.overClass)
|
474
|
+
.removeClass($this.options.placeholderClass)
|
475
|
+
.removeClass($this.options.childClass);
|
476
|
+
$this.dragenterData(this, false);
|
477
|
+
}
|
478
|
+
});
|
479
|
+
});
|
480
|
+
|
481
|
+
touchedlists = [];
|
482
|
+
|
483
|
+
UI.$html.removeClass(this.options.dragMovingClass);
|
484
|
+
|
485
|
+
this.removeDragHandlers();
|
486
|
+
|
487
|
+
if (draggingPlaceholder) {
|
488
|
+
draggingPlaceholder.remove();
|
489
|
+
draggingPlaceholder = null;
|
490
|
+
}
|
491
|
+
},
|
492
|
+
|
493
|
+
dragDrop: function(e, elem) {
|
494
|
+
|
495
|
+
if (e.type === 'drop') {
|
496
|
+
|
497
|
+
if (e.stopPropagation) {
|
498
|
+
e.stopPropagation();
|
499
|
+
}
|
500
|
+
|
501
|
+
if (e.preventDefault) {
|
502
|
+
e.preventDefault();
|
503
|
+
}
|
504
|
+
}
|
505
|
+
|
506
|
+
this.triggerChangeEvents();
|
507
|
+
},
|
508
|
+
|
509
|
+
triggerChangeEvents: function() {
|
510
|
+
|
511
|
+
// trigger events once
|
512
|
+
if (!currentlyDraggingElement) return;
|
513
|
+
|
514
|
+
var $current = UI.$(currentlyDraggingElement),
|
515
|
+
oldRoot = draggingPlaceholder.data('origin'),
|
516
|
+
newRoot = $current.closest('.'+this.options.baseClass),
|
517
|
+
triggers = [],
|
518
|
+
el = UI.$(currentlyDraggingElement);
|
519
|
+
|
520
|
+
// events depending on move inside lists or across lists
|
521
|
+
if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) {
|
522
|
+
triggers.push({sortable: this, mode: 'moved'});
|
523
|
+
} else if (oldRoot[0] != newRoot[0]) {
|
524
|
+
triggers.push({sortable: UI.$(newRoot).data('sortable'), mode: 'added'}, {sortable: UI.$(oldRoot).data('sortable'), mode: 'removed'});
|
525
|
+
}
|
526
|
+
|
527
|
+
triggers.forEach(function (trigger, i) {
|
528
|
+
if (trigger.sortable) {
|
529
|
+
trigger.sortable.element.trigger('change.uk.sortable', [trigger.sortable, el, trigger.mode]);
|
530
|
+
}
|
531
|
+
});
|
532
|
+
},
|
533
|
+
|
534
|
+
dragenterData: function(element, val) {
|
535
|
+
|
536
|
+
element = UI.$(element);
|
537
|
+
|
538
|
+
if (arguments.length == 1) {
|
539
|
+
return parseInt(element.data('child-dragenter'), 10) || 0;
|
540
|
+
} else if (!val) {
|
541
|
+
element.removeData('child-dragenter');
|
542
|
+
} else {
|
543
|
+
element.data('child-dragenter', Math.max(0, val));
|
544
|
+
}
|
545
|
+
},
|
546
|
+
|
547
|
+
moveElementNextTo: function(element, elementToMoveNextTo) {
|
548
|
+
|
549
|
+
dragging = true;
|
550
|
+
|
551
|
+
var $this = this,
|
552
|
+
list = UI.$(element).parent().css('min-height', ''),
|
553
|
+
next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
|
554
|
+
children = list.children(),
|
555
|
+
count = children.length;
|
556
|
+
|
557
|
+
if (!$this.options.animation) {
|
558
|
+
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
559
|
+
UI.Utils.checkDisplay($this.element.parent());
|
560
|
+
return;
|
561
|
+
}
|
562
|
+
|
563
|
+
list.css('min-height', list.height());
|
564
|
+
|
565
|
+
children.stop().each(function(){
|
566
|
+
var ele = UI.$(this),
|
567
|
+
offset = ele.position();
|
568
|
+
|
569
|
+
offset.width = ele.width();
|
570
|
+
|
571
|
+
ele.data('offset-before', offset);
|
572
|
+
});
|
573
|
+
|
574
|
+
elementToMoveNextTo.parentNode.insertBefore(element, next);
|
575
|
+
|
576
|
+
UI.Utils.checkDisplay($this.element.parent());
|
577
|
+
|
578
|
+
children = list.children().each(function() {
|
579
|
+
var ele = UI.$(this);
|
580
|
+
ele.data('offset-after', ele.position());
|
581
|
+
}).each(function() {
|
582
|
+
var ele = UI.$(this),
|
583
|
+
before = ele.data('offset-before');
|
584
|
+
ele.css({position:'absolute', top:before.top, left:before.left, minWidth:before.width });
|
585
|
+
});
|
586
|
+
|
587
|
+
children.each(function(){
|
588
|
+
|
589
|
+
var ele = UI.$(this),
|
590
|
+
before = ele.data('offset-before'),
|
591
|
+
offset = ele.data('offset-after');
|
592
|
+
|
593
|
+
ele.css('pointer-events', 'none').width();
|
594
|
+
|
595
|
+
setTimeout(function(){
|
596
|
+
ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
|
597
|
+
ele.css({position:'',top:'', left:'', minWidth: '', 'pointer-events':''}).removeClass($this.options.overClass).removeData('child-dragenter');
|
598
|
+
count--;
|
599
|
+
if (!count) {
|
600
|
+
list.css('min-height', '');
|
601
|
+
UI.Utils.checkDisplay($this.element.parent());
|
602
|
+
}
|
603
|
+
});
|
604
|
+
}, 0);
|
605
|
+
});
|
606
|
+
},
|
607
|
+
|
608
|
+
serialize: function() {
|
609
|
+
|
610
|
+
var data = [], item, attribute;
|
611
|
+
|
612
|
+
this.element.children().each(function(j, child) {
|
613
|
+
item = {};
|
614
|
+
for (var i = 0, attr, val; i < child.attributes.length; i++) {
|
615
|
+
attribute = child.attributes[i];
|
616
|
+
if (attribute.name.indexOf('data-') === 0) {
|
617
|
+
attr = attribute.name.substr(5);
|
618
|
+
val = UI.Utils.str2json(attribute.value);
|
619
|
+
item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
data.push(item);
|
623
|
+
});
|
624
|
+
|
625
|
+
return data;
|
626
|
+
},
|
627
|
+
|
628
|
+
checkEmptyList: function(list) {
|
629
|
+
|
630
|
+
list = list ? UI.$(list) : this.element;
|
631
|
+
|
632
|
+
if (this.options.emptyClass) {
|
633
|
+
list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
|
634
|
+
}
|
635
|
+
}
|
636
|
+
});
|
637
|
+
|
638
|
+
// helpers
|
639
|
+
|
640
|
+
function isBelow(el1, el2) {
|
641
|
+
|
642
|
+
var parent = el1.parentNode;
|
643
|
+
|
644
|
+
if (el2.parentNode != parent) {
|
645
|
+
return false;
|
646
|
+
}
|
647
|
+
|
648
|
+
var cur = el1.previousSibling;
|
649
|
+
|
650
|
+
while (cur && cur.nodeType !== 9) {
|
651
|
+
if (cur === el2) {
|
652
|
+
return true;
|
653
|
+
}
|
654
|
+
cur = cur.previousSibling;
|
655
|
+
}
|
656
|
+
|
657
|
+
return false;
|
658
|
+
}
|
659
|
+
|
660
|
+
function moveUpToChildNode(parent, child) {
|
661
|
+
var cur = child;
|
662
|
+
if (cur == parent) { return null; }
|
663
|
+
|
664
|
+
while (cur) {
|
665
|
+
if (cur.parentNode === parent) {
|
666
|
+
return cur;
|
667
|
+
}
|
668
|
+
|
669
|
+
cur = cur.parentNode;
|
670
|
+
if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
|
671
|
+
break;
|
672
|
+
}
|
673
|
+
}
|
674
|
+
return null;
|
675
|
+
}
|
676
|
+
|
677
|
+
function prevent(e) {
|
678
|
+
if (e.stopPropagation) {
|
679
|
+
e.stopPropagation();
|
680
|
+
}
|
681
|
+
if (e.preventDefault) {
|
682
|
+
e.preventDefault();
|
683
|
+
}
|
684
|
+
e.returnValue = false;
|
685
|
+
}
|
686
|
+
|
687
|
+
return UI.sortable;
|
688
|
+
});
|