EOS/Scripts/kendo/2015.3.1111/kendo.splitter.min.js
Nidhi Bhargava f0c1ab20e1 code push
2025-09-04 16:25:07 +05:30

9 lines
11 KiB
JavaScript

/*
* Kendo UI v2015.3.1111 (http://www.telerik.com/kendo-ui)
* Copyright 2015 Telerik AD. All rights reserved.
*
* Kendo UI commercial licenses may be obtained at
* http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(e,define){define(["./kendo.resizable.min"],e)}(function(){return function(e,t){function n(e){return v.test(e)}function i(e){return m.test(e)||/^\d+$/.test(e)}function o(e){return!n(e)&&!i(e)}function r(e,t){var i=parseInt(e,10);return n(e)&&(i=Math.floor(i*t/100)),i}function a(e,n){return function(i,o){var r,a=this.element.find(i).data(E);return 1==arguments.length?a[e]:(a[e]=o,n&&(r=this.element.data("kendo"+this.options.name),r.resize(!0)),t)}}function s(e){var t=this,n=e.orientation;t.owner=e,t._element=e.element,t.orientation=n,f(t,n===S?c:l),t._resizable=new u.ui.Resizable(e.element,{orientation:n,handle:".k-splitbar-draggable-"+n+"[data-marker="+e._marker+"]",hint:p(t._createHint,t),start:p(t._start,t),max:p(t._max,t),min:p(t._min,t),invalidClass:"k-restricted-size-"+n,resizeend:p(t._stop,t)})}var l,c,u=window.kendo,d=u.ui,h=u.keys,f=e.extend,p=e.proxy,g=d.Widget,m=/^\d+(\.\d+)?px$/i,v=/^\d+(\.\d+)?%$/i,_=".kendoSplitter",w="expand",y="collapse",b="contentLoad",x="error",k="resize",C="layoutChange",S="horizontal",T="vertical",D="mouseenter",A="click",E="pane",M="mouseleave",P="k-state-focused",I="k-"+E,R="."+I,z=g.extend({init:function(e,t){var n,i=this;g.fn.init.call(i,e,t),i.wrapper=i.element,n=i.options.orientation.toLowerCase()!=T,i.orientation=n?S:T,i._dimension=n?"width":"height",i._keys={decrease:n?h.LEFT:h.UP,increase:n?h.RIGHT:h.DOWN},i._resizeStep=10,i._marker=u.guid().substring(0,8),i._initPanes(),i.resizing=new s(i),i.element.triggerHandler("init"+_)},events:[w,y,b,x,k,C],_addOverlays:function(){this._panes().append("<div class='k-splitter-overlay k-overlay' />")},_removeOverlays:function(){this._panes().children(".k-splitter-overlay").remove()},_attachEvents:function(){var t=this,n=t.options.orientation;t.element.children(".k-splitbar-draggable-"+n).on("keydown"+_,p(t._keydown,t)).on("mousedown"+_,function(e){e.currentTarget.focus()}).on("focus"+_,function(t){e(t.currentTarget).addClass(P)}).on("blur"+_,function(n){e(n.currentTarget).removeClass(P),t.resizing&&t.resizing.end()}).on(D+_,function(){e(this).addClass("k-splitbar-"+t.orientation+"-hover")}).on(M+_,function(){e(this).removeClass("k-splitbar-"+t.orientation+"-hover")}).on("mousedown"+_,p(t._addOverlays,t)).end().children(".k-splitbar").on("dblclick"+_,p(t._togglePane,t)).children(".k-collapse-next, .k-collapse-prev").on(A+_,t._arrowClick(y)).end().children(".k-expand-next, .k-expand-prev").on(A+_,t._arrowClick(w)).end().end(),e(window).on("resize"+_+t._marker,p(t.resize,t,!1)),e(document).on("mouseup"+_+t._marker,p(t._removeOverlays,t))},_detachEvents:function(){var t=this;t.element.children(".k-splitbar-draggable-"+t.orientation).off(_).end().children(".k-splitbar").off("dblclick"+_).children(".k-collapse-next, .k-collapse-prev, .k-expand-next, .k-expand-prev").off(_),e(window).off(_+t._marker),e(document).off(_+t._marker)},options:{name:"Splitter",orientation:S,panes:[]},destroy:function(){g.fn.destroy.call(this),this._detachEvents(),this.resizing&&this.resizing.destroy(),u.destroy(this.element),this.wrapper=this.element=null},_keydown:function(t){var n,i=this,o=t.keyCode,r=i.resizing,a=e(t.currentTarget),s=i._keys,l=o===s.increase,c=o===s.decrease;l||c?(t.ctrlKey?(n=a[c?"next":"prev"](),r&&r.isResizing()&&r.end(),n[i._dimension]()?i._triggerAction(y,a[c?"prev":"next"]()):i._triggerAction(w,n)):r&&r.move((c?-1:1)*i._resizeStep,a),t.preventDefault()):o===h.ENTER&&r&&(r.end(),t.preventDefault())},_initPanes:function(){var e=this.options.panes||[],t=this;this.element.addClass("k-widget").addClass("k-splitter").children().each(function(n,i){"script"!=i.nodeName.toLowerCase()&&t._initPane(i,e[n])}),this.resize()},_initPane:function(t,n){t=e(t).attr("role","group").addClass(I),t.data(E,n?n:{}).toggleClass("k-scrollable",n?n.scrollable!==!1:!0),this.ajaxRequest(t)},ajaxRequest:function(e,t,n){var i,o=this;e=o.element.find(e),i=e.data(E),t=t||i.contentUrl,t&&(e.append("<span class='k-icon k-loading k-pane-loading' />"),u.isLocalUrl(t)?jQuery.ajax({url:t,data:n||{},type:"GET",dataType:"html",success:function(t){o.angular("cleanup",function(){return{elements:e.get()}}),e.html(t),o.angular("compile",function(){return{elements:e.get()}}),o.trigger(b,{pane:e[0]})},error:function(t,n){o.trigger(x,{pane:e[0],status:n,xhr:t})}}):e.removeClass("k-scrollable").html("<iframe src='"+t+"' frameborder='0' class='k-content-frame'>This page requires frames in order to show content</iframe>"))},_triggerAction:function(e,t){this.trigger(e,{pane:t[0]})||this[e](t[0])},_togglePane:function(t){var n,i=this,o=e(t.target);o.closest(".k-splitter")[0]==i.element[0]&&(n=o.children(".k-icon:not(.k-resize-handle)"),1===n.length&&(n.is(".k-collapse-prev")?i._triggerAction(y,o.prev()):n.is(".k-collapse-next")?i._triggerAction(y,o.next()):n.is(".k-expand-prev")?i._triggerAction(w,o.prev()):n.is(".k-expand-next")&&i._triggerAction(w,o.next())))},_arrowClick:function(t){var n=this;return function(i){var o,r=e(i.target);r.closest(".k-splitter")[0]==n.element[0]&&(o=r.is(".k-"+t+"-prev")?r.parent().prev():r.parent().next(),n._triggerAction(t,o))}},_updateSplitBar:function(e,t,n){var i=function(e,t){return t?"<div class='k-icon "+e+"' />":""},o=this.orientation,r=t.resizable!==!1&&n.resizable!==!1,a=t.collapsible,s=t.collapsed,l=n.collapsible,c=n.collapsed;e.addClass("k-splitbar k-state-default k-splitbar-"+o).attr("role","separator").attr("aria-expanded",!(s||c)).removeClass("k-splitbar-"+o+"-hover").toggleClass("k-splitbar-draggable-"+o,r&&!s&&!c).toggleClass("k-splitbar-static-"+o,!r&&!a&&!l).html(i("k-collapse-prev",a&&!s&&!c)+i("k-expand-prev",a&&s&&!c)+i("k-resize-handle",r)+i("k-collapse-next",l&&!c&&!s)+i("k-expand-next",l&&c&&!s)),r||a||l||e.removeAttr("tabindex")},_updateSplitBars:function(){var t=this;this.element.children(".k-splitbar").each(function(){var n=e(this),i=n.prevAll(R).first().data(E),o=n.nextAll(R).first().data(E);o&&t._updateSplitBar(n,i,o)})},_removeSplitBars:function(){this.element.children(".k-splitbar").remove()},_panes:function(){return this.element?this.element.children(R):e()},_resize:function(){var n,i,a,s,l,c,d,h,f,p,g=this,m=g.element,v=m.children(R),_=g.orientation==S,w=m.children(".k-splitbar"),y=w.length,b=_?"width":"height",x=m[b]();g.wrapper.addClass("k-splitter-resizing"),0===y?(y=v.length-1,v.slice(0,y).after("<div tabindex='0' class='k-splitbar' data-marker='"+g._marker+"' />"),g._updateSplitBars(),w=m.children(".k-splitbar")):g._updateSplitBars(),w.each(function(){x-=this[_?"offsetWidth":"offsetHeight"]}),n=0,i=0,a=e(),v.css({position:"absolute",top:0})[b](function(){var s,l=e(this),c=l.data(E)||{};if(l.removeClass("k-state-collapsed"),c.collapsed)s=c.collapsedSize?r(c.collapsedSize,x):0,l.css("overflow","hidden").addClass("k-state-collapsed");else{if(o(c.size))return a=a.add(this),t;s=r(c.size,x)}return i++,n+=s,s}),x-=n,s=a.length,l=Math.floor(x/s),a.slice(0,s-1).css(b,l).end().eq(s-1).css(b,x-(s-1)*l),c=0,d=_?"height":"width",h=_?"left":"top",f=_?"offsetWidth":"offsetHeight",0===s&&(p=v.filter(function(){return!(e(this).data(E)||{}).collapsed}).last(),p[b](x+p[0][f])),m.children().css(d,m[d]()).each(function(e,t){"script"!=t.tagName.toLowerCase()&&(t.style[h]=Math.floor(c)+"px",c+=t[f])}),g._detachEvents(),g._attachEvents(),g.wrapper.removeClass("k-splitter-resizing"),u.resize(v),g.trigger(C)},toggle:function(e,n){var i,o=this;e=o.element.find(e),i=e.data(E),(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",""),o.resize(!0))},collapse:function(e){this.toggle(e,!1)},expand:function(e){this.toggle(e,!0)},_addPane:function(e,t,n){var i=this;return n.length&&(i.options.panes.splice(t,0,e),i._initPane(n,e),i._removeSplitBars(),i.resize(!0)),n},append:function(t){t=t||{};var n=this,i=e("<div />").appendTo(n.element);return n._addPane(t,n.options.panes.length,i)},insertBefore:function(t,n){n=e(n),t=t||{};var i=this,o=i.wrapper.children(".k-pane").index(n),r=e("<div />").insertBefore(e(n));return i._addPane(t,o,r)},insertAfter:function(t,n){n=e(n),t=t||{};var i=this,o=i.wrapper.children(".k-pane").index(n),r=e("<div />").insertAfter(e(n));return i._addPane(t,o+1,r)},remove:function(t){t=e(t);var n=this;return t.length&&(u.destroy(t),t.each(function(t,i){n.options.panes.splice(n.wrapper.children(".k-pane").index(i),1),e(i).remove()}),n._removeSplitBars(),n.options.panes.length&&n.resize(!0)),n},size:a("size",!0),min:a("min"),max:a("max")});d.plugin(z),l={sizingProperty:"height",sizingDomProperty:"offsetHeight",alternateSizingProperty:"width",positioningProperty:"top",mousePositioningProperty:"pageY"},c={sizingProperty:"width",sizingDomProperty:"offsetWidth",alternateSizingProperty:"height",positioningProperty:"left",mousePositioningProperty:"pageX"},s.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(),this._resizable=this._element=this.owner=null},isResizing:function(){return this._resizable.resizing},_createHint:function(t){var n=this;return e("<div class='k-ghost-splitbar k-ghost-splitbar-"+n.orientation+" k-state-default' />").css(n.alternateSizingProperty,t[n.alternateSizingProperty]())},_start:function(t){var n=this,o=e(t.currentTarget),r=o.prev(),a=o.next(),s=r.data(E),l=a.data(E),c=parseInt(r[0].style[n.positioningProperty],10),u=parseInt(a[0].style[n.positioningProperty],10)+a[0][n.sizingDomProperty]-o[0][n.sizingDomProperty],d=parseInt(n._element.css(n.sizingProperty),10),h=function(e){var t=parseInt(e,10);return(i(e)?t:d*t/100)||0},f=h(s.min),p=h(s.max)||u-c,g=h(l.min),m=h(l.max)||u-c;n.previousPane=r,n.nextPane=a,n._maxPosition=Math.min(u-g,c+p),n._minPosition=Math.max(c+f,u-m)},_max:function(){return this._maxPosition},_min:function(){return this._minPosition},_stop:function(t){var n,i,r,a,s,l,c,d,h=this,f=e(t.currentTarget),p=h.owner;return p._panes().children(".k-splitter-overlay").remove(),t.keyCode!==u.keys.ESC&&(n=t.position,i=f.prev(),r=f.next(),a=i.data(E),s=r.data(E),l=n-parseInt(i[0].style[h.positioningProperty],10),c=parseInt(r[0].style[h.positioningProperty],10)+r[0][h.sizingDomProperty]-n-f[0][h.sizingDomProperty],d=h._element.children(R).filter(function(){return o(e(this).data(E).size)}).length,(!o(a.size)||d>1)&&(o(a.size)&&d--,a.size=l+"px"),(!o(s.size)||d>1)&&(s.size=c+"px"),p.resize(!0)),!1}}}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});