/* * Kendo UI Beta v2013.2.716 (http://kendoui.com) * Copyright 2013 Telerik AD. All rights reserved. * * Kendo UI Beta license terms available at * http://www.kendoui.com/purchase/license-agreement/kendo-ui-beta.aspx */ ("function"==typeof define&&define.amd?define:function(e,t){return t()})(["./kendo.resizable.min"],function(){!function(e,t){function n(e){return k.test(e)}function i(e){return f.test(e)||/^\d+$/.test(e)}function r(e){return!n(e)&&!i(e)}function s(e,n){return function(i,r){var s,a=this.element.find(i).data(S);return 1==arguments.length?a[e]:(a[e]=r,n&&(s=this.element.data("kendo"+this.options.name),s.trigger(y)),t)}}function a(e){var t=this,n=e.orientation;t.owner=e,t._element=e.element,t.orientation=n,h(t,n===x?l:o),t._resizable=new d.ui.Resizable(e.element,{orientation:n,handle:".k-splitbar-draggable-"+n+"[data-marker="+e._marker+"]",hint:g(t._createHint,t),start:g(t._start,t),max:g(t._max,t),min:g(t._min,t),invalidClass:"k-restricted-size-"+n,resizeend:g(t._stop,t)})}var o,l,d=window.kendo,p=d.ui,c=d.keys,h=e.extend,g=e.proxy,u=p.Widget,f=/^\d+(\.\d+)?px$/i,k=/^\d+(\.\d+)?%$/i,m=".kendoSplitter",_="expand",v="collapse",z="contentLoad",y="resize",b="layoutChange",x="horizontal",P="vertical",w="mouseenter",C="click",S="pane",H="mouseleave",T="k-state-focused",A="k-"+S,E="."+A,D=u.extend({init:function(t,n){var i,r=this;u.fn.init.call(r,t,n),r.wrapper=r.element,i=r.options.orientation.toLowerCase()!=P,r.orientation=i?x:P,r._dimension=i?"width":"height",r._keys={decrease:i?c.LEFT:c.UP,increase:i?c.RIGHT:c.DOWN},r._resizeStep=10,r.bind(y,g(r._resize,r)),r._marker=d.guid().substring(0,8),r._resizeHandler=function(){r.trigger(y)},r._initPanes(),e(window).on("resize",r._resizeHandler),r.element.children(".k-splitbar-draggable-"+r.orientation).length&&(r.resizing=new a(r)),r.element.triggerHandler("init"+m)},events:[_,v,z,y,b],_parentSplitter:function(){return this.element.parent().closest(".k-splitter")},_attachEvents:function(){var t=this,n=t.options.orientation;t.element.children(".k-splitbar-draggable-"+n).on("keydown"+m,e.proxy(t._keydown,t)).on("mousedown"+m,function(e){e.currentTarget.focus()}).on("focus"+m,function(t){e(t.currentTarget).addClass(T)}).on("blur"+m,function(n){e(n.currentTarget).removeClass(T),t.resizing&&t.resizing.end()}).on(w+m,function(){e(this).addClass("k-splitbar-"+t.orientation+"-hover")}).on(H+m,function(){e(this).removeClass("k-splitbar-"+t.orientation+"-hover")}).on("mousedown"+m,function(){t._panes().append("
")}).on("mouseup"+m,function(){t._panes().children(".k-splitter-overlay").remove()}).end().children(".k-splitbar").on("dblclick"+m,g(t._togglePane,t)).children(".k-collapse-next, .k-collapse-prev").on(C+m,t._arrowClick(v)).end().children(".k-expand-next, .k-expand-prev").on(C+m,t._arrowClick(_)).end().end(),t._parentSplitter().each(function(){var n=e(this),i=n.data("kendo"+t.options.name);i?i.bind(y,t._resizeHandler):n.off("init"+m).one("init"+m,function(){e(this).data("kendo"+t.options.name).bind(y,t._resizeHandler),t._resizeHandler()})})},_detachEvents:function(){var e=this,t=e._parentSplitter().data("kendo"+e.options.name);e.element.children(".k-splitbar-draggable-"+e.orientation).off(m).end().children(".k-splitbar").off("dblclick"+m).children(".k-collapse-next, .k-collapse-prev, .k-expand-next, .k-expand-prev").off(m),t&&t.unbind(y,e._resizeHandler)},options:{name:"Splitter",orientation:x,panes:[]},destroy:function(){var t=this;u.fn.destroy.call(t),t._detachEvents(),t.resizing&&t.resizing.destroy(),e(window).off("resize",t._resizeHandler),d.destroy(t.element)},_keydown:function(t){var n,i=this,r=t.keyCode,s=i.resizing,a=e(t.currentTarget),o=i._keys,l=r===o.increase,d=r===o.decrease;l||d?(t.ctrlKey?(n=a[d?"next":"prev"](),s&&s.isResizing()&&s.end(),n[i._dimension]()?i._triggerAction(v,a[d?"prev":"next"]()):i._triggerAction(_,n)):s&&s.move((d?-1:1)*i._resizeStep,a),t.preventDefault()):r===c.ENTER&&s&&(s.end(),t.preventDefault())},_initPanes:function(){var t=this,n=t.options.panes||[];t.element.addClass("k-widget").addClass("k-splitter").children(":not(script)").each(function(i,r){var s=n&&n[i];r=e(r).attr("role","group").addClass(A),r.data(S,s?s:{}).toggleClass("k-scrollable",s?s.scrollable!==!1:!0),t.ajaxRequest(r)}).end(),t.trigger(y)},ajaxRequest:function(e,t,n){var i,r=this;e=r.element.find(e),i=e.data(S),t=t||i.contentUrl,t&&(e.append(""),d.isLocalUrl(t)?jQuery.ajax({url:t,data:n||{},type:"GET",dataType:"html",success:function(t){e.html(t),r.trigger(z,{pane:e[0]})}}):e.removeClass("k-scrollable").html(""))},_triggerAction:function(e,t){this.trigger(e,{pane:t[0]})||this[e](t[0])},_togglePane:function(t){var n,i=this,r=e(t.target);r.closest(".k-splitter")[0]==i.element[0]&&(n=r.children(".k-icon:not(.k-resize-handle)"),1===n.length&&(n.is(".k-collapse-prev")?i._triggerAction(v,r.prev()):n.is(".k-collapse-next")?i._triggerAction(v,r.next()):n.is(".k-expand-prev")?i._triggerAction(_,r.prev()):n.is(".k-expand-next")&&i._triggerAction(_,r.next())))},_arrowClick:function(t){var n=this;return function(i){var r,s=e(i.target);s.closest(".k-splitter")[0]==n.element[0]&&(r=s.is(".k-"+t+"-prev")?s.parent().prev():s.parent().next(),n._triggerAction(t,r))}},_updateSplitBar:function(e,t,n){var i=function(e,t){return t?"":""},r=this.orientation,s=t.resizable!==!1&&n.resizable!==!1,a=t.collapsible,o=t.collapsed,l=n.collapsible,d=n.collapsed;e.addClass("k-splitbar k-state-default k-secondary k-splitbar-"+r).attr("role","separator").attr("aria-expanded",!(o||d)).removeClass("k-splitbar-"+r+"-hover").toggleClass("k-splitbar-draggable-"+r,s&&!o&&!d).toggleClass("k-splitbar-static-"+r,!s&&!a&&!l).html(i("k-collapse-prev",a&&!o&&!d)+i("k-expand-prev",a&&o&&!d)+i("k-resize-handle",s)+i("k-collapse-next",l&&!d&&!o)+i("k-expand-next",l&&d&&!o))},_updateSplitBars:function(){var t=this;this.element.children(".k-splitbar").each(function(){var n=e(this),i=n.prevAll(E).first().data(S),r=n.nextAll(E).first().data(S);r&&t._updateSplitBar(n,i,r)})},_panes:function(){return this.element.children(E)},_resize:function(){var i,s,a,o,l,d,p,c,h,g,u=this,f=u.element,k=f.children(E),m=u.orientation==x,_=f.children(".k-splitbar"),v=_.length,z=m?"width":"height",y=f[z]();0===v?(v=k.length-1,k.slice(0,v).after(""),u._updateSplitBars(),_=f.children(".k-splitbar")):u._updateSplitBars(),_.each(function(){y-=this[m?"offsetWidth":"offsetHeight"]}),i=0,s=0,a=e(),k.css({position:"absolute",top:0})[z](function(){var o,l=e(this).data(S)||{};if(l.collapsed)o=0,e(this).css("overflow","hidden");else{if(r(l.size))return a=a.add(this),t;o=parseInt(l.size,10),n(l.size)&&(o=Math.floor(o*y/100))}return s++,i+=o,o}),y-=i,o=a.length,l=Math.floor(y/o),a.slice(0,o-1).css(z,l).end().eq(o-1).css(z,y-(o-1)*l),d=0,p=m?"height":"width",c=m?"left":"top",h=m?"offsetWidth":"offsetHeight",0===o&&(g=k.filter(function(){return!(e(this).data(S)||{}).collapsed}).last(),g[z](y+g[0][h])),f.children(":not(script)").css(p,f[p]()).each(function(e,t){t.style[c]=Math.floor(d)+"px",d+=t[h]}),u._detachEvents(),u._attachEvents(),u.trigger(b)},toggle:function(e,n){var i;e=this.element.find(e),i=e.data(S),(n||i.collapsible)&&(1==arguments.length&&(n=i.collapsed===t?!1:i.collapsed),i.collapsed=!n,i.collapsed?e.css("overflow","hidden"):e.css("overflow",""),this.trigger(y),this.resizing&&this.resizing.destroy(),this.element.children(".k-splitbar-draggable-"+this.orientation).length&&(this.resizing=new a(this)))},collapse:function(e){this.toggle(e,!1)},expand:function(e){this.toggle(e,!0)},size:s("size",!0),min:s("min"),max:s("max")});p.plugin(D),o={sizingProperty:"height",sizingDomProperty:"offsetHeight",alternateSizingProperty:"width",positioningProperty:"top",mousePositioningProperty:"pageY"},l={sizingProperty:"width",sizingDomProperty:"offsetWidth",alternateSizingProperty:"height",positioningProperty:"left",mousePositioningProperty:"pageX"},a.prototype={press:function(e){this._resizable.press(e)},move:function(e,t){this.pressed||(this.press(t),this.pressed=!0),this._resizable.target||this._resizable.press(t),this._resizable.move(e)},end:function(){this._resizable.end(),this.pressed=!1},destroy:function(){this._resizable.destroy()},isResizing:function(){return this._resizable.resizing},_createHint:function(t){var n=this;return e("").css(n.alternateSizingProperty,t[n.alternateSizingProperty]())},_start:function(t){var n=this,r=e(t.currentTarget),s=r.prev(),a=r.next(),o=s.data(S),l=a.data(S),d=parseInt(s[0].style[n.positioningProperty],10),p=parseInt(a[0].style[n.positioningProperty],10)+a[0][n.sizingDomProperty]-r[0][n.sizingDomProperty],c=parseInt(n._element.css(n.sizingProperty),10),h=function(e){var t=parseInt(e,10);return(i(e)?t:c*t/100)||0},g=h(o.min),u=h(o.max)||p-d,f=h(l.min),k=h(l.max)||p-d;n.previousPane=s,n.nextPane=a,n._maxPosition=Math.min(p-f,d+u),n._minPosition=Math.max(d+g,p-k)},_max:function(){return this._maxPosition},_min:function(){return this._minPosition},_stop:function(t){var n,i,s,a,o,l,p,c,h=this,g=e(t.currentTarget),u=h.owner;return u._panes().children(".k-splitter-overlay").remove(),t.keyCode!==d.keys.ESC&&(n=t.position,i=g.prev(),s=g.next(),a=i.data(S),o=s.data(S),l=n-parseInt(i[0].style[h.positioningProperty],10),p=parseInt(s[0].style[h.positioningProperty],10)+s[0][h.sizingDomProperty]-n-g[0][h.sizingDomProperty],c=h._element.children(E).filter(function(){return r(e(this).data(S).size)}).length,(!r(a.size)||c>1)&&(r(a.size)&&c--,a.size=l+"px"),(!r(o.size)||c>1)&&(o.size=p+"px"),u._resizeHandler()),!1}}}(window.kendo.jQuery)});