demo20230512/Scripts/kendo/2014.2.716/kendo.splitter.min.js

16 lines
11 KiB
JavaScript
Raw Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,define){define(["./kendo.resizable.min"],e)}(function(){return function(e,t){function n(e){return g.test(e)}function i(e){return m.test(e)||/^\d+$/.test(e)}function r(e){return!n(e)&&!i(e)}function o(e,n){return function(i,r){var o,a=this.element.find(i).data(D);return 1==arguments.length?a[e]:(a[e]=r,n&&(o=this.element.data("kendo"+this.options.name),o.resize(!0)),t)}}function a(e){var t=this,n=e.orientation;t.owner=e,t._element=e.element,t.orientation=n,p(t,n===C?l:s),t._resizable=new d.ui.Resizable(e.element,{orientation:n,handle:".k-splitbar-draggable-"+n+"[data-marker="+e._marker+"]",hint:f(t._createHint,t),start:f(t._start,t),max:f(t._max,t),min:f(t._min,t),invalidClass:"k-restricted-size-"+n,resizeend:f(t._stop,t)})}var s,l,d=window.kendo,c=d.ui,u=d.keys,p=e.extend,f=e.proxy,h=c.Widget,m=/^\d+(\.\d+)?px$/i,g=/^\d+(\.\d+)?%$/i,v=".kendoSplitter",_="expand",k="collapse",b="contentLoad",w="error",y="resize",x="layoutChange",C="horizontal",T="vertical",S="mouseenter",F="click",D="pane",E="mouseleave",A="k-state-focused",I="k-"+D,H="."+I,N=h.extend({init:function(e,t){var n,i=this;h.fn.init.call(i,e,t),i.wrapper=i.element,n=i.options.orientation.toLowerCase()!=T,i.orientation=n?C:T,i._dimension=n?"width":"height",i._keys={decrease:n?u.LEFT:u.UP,increase:n?u.RIGHT:u.DOWN},i._resizeStep=10,i._marker=d.guid().substring(0,8),i._initPanes(),i.resizing=new a(i),i.element.triggerHandler("init"+v)},events:[_,k,b,w,y,x],_attachEvents:function(){var t=this,n=t.options.orientation;t.element.children(".k-splitbar-draggable-"+n).on("keydown"+v,e.proxy(t._keydown,t)).on("mousedown"+v,function(e){e.currentTarget.focus()}).on("focus"+v,function(t){e(t.currentTarget).addClass(A)}).on("blur"+v,function(n){e(n.currentTarget).removeClass(A),t.resizing&&t.resizing.end()}).on(S+v,function(){e(this).addClass("k-splitbar-"+t.orientation+"-hover")}).on(E+v,function(){e(this).removeClass("k-splitbar-"+t.orientation+"-hover")}).on("mousedown"+v,function(){t._panes().append("<div class='k-splitter-overlay k-overlay' />")}).on("mouseup"+v,function(){t._panes().children(".k-splitter-overlay").remove()}).end().children(".k-splitbar").on("dblclick"+v,f(t._togglePane,t)).children(".k-collapse-next, .k-collapse-prev").on(F+v,t._arrowClick(k)).end().children(".k-expand-next, .k-expand-prev").on(F+v,t._arrowClick(_)).end().end(),e(window).on("resize"+v+t._marker,f(t.resize,t))},_detachEvents:function(){var t=this;t.element.children(".k-splitbar-draggable-"+t.orientation).off(v).end().children(".k-splitbar").off("dblclick"+v).children(".k-collapse-next, .k-collapse-prev, .k-expand-next, .k-expand-prev").off(v),e(window).off("resize"+v+t._marker)},options:{name:"Splitter",orientation:C,panes:[]},destroy:function(){h.fn.destroy.call(this),this._detachEvents(),this.resizing&&this.resizing.destroy(),d.destroy(this.element),this.wrapper=this.element=null},_keydown:function(t){var n,i=this,r=t.keyCode,o=i.resizing,a=e(t.currentTarget),s=i._keys,l=r===s.increase,d=r===s.decrease;l||d?(t.ctrlKey?(n=a[d?"next":"prev"](),o&&o.isResizing()&&o.end(),n[i._dimension]()?i._triggerAction(k,a[d?"prev":"next"]()):i._triggerAction(_,n)):o&&o.move((d?-1:1)*i._resizeStep,a),t.preventDefault()):r===u.ENTER&&o&&(o.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(D,n?n:{}).toggleClass("k-scrollable",n?n.scrollable!==!1:!0),this.ajaxRequest(t)},ajaxRequest:function(e,t,n){var i,r=this;e=r.element.find(e),i=e.data(D),t=t||i.contentUrl,t&&(e.append("<span class='k-icon k-loading k-pane-loading' />"),d.isLocalUrl(t)?jQuery.ajax({url:t,data:n||{},type:"GET",dataType:"html",success:function(t){r.angular("cleanup",function(){return{elements:e.get()}}),e.html(t),r.angular("compile",function(){return{elements:e.get()}}),r.trigger(b,{pane:e[0]})},error:function(t,n){r.trigger(w,{pane:e[0],status:n,xhr:t})}}):e.rem