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

16 lines
19 KiB
JavaScript
Raw Permalink 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.draganddrop.min"],e)}(function(){return function(e,t){function n(e){return t!==e}function i(e,t,n){return Math.max(Math.min(parseInt(e,10),1/0===n?n:parseInt(n,10)),parseInt(t,10))}function r(e,t){return function(){var n=this,i=n.wrapper,r=i[0].style,o=n.options;if(!o.isMaximized&&!o.isMinimized)return n.restoreOptions={width:r.width,height:r.height},i.children(x).hide().end().children(k).find(j).parent().hide().eq(0).before(X.action({name:"Restore"})),t.call(n),"maximize"==e?n.wrapper.children(k).find(Y).parent().hide():n.wrapper.children(k).find(Y).parent().show(),n}}function o(){return!this.type||this.type.toLowerCase().indexOf("script")>=0}function a(e){var t=this;t.owner=e,t._draggable=new c(e.wrapper,{filter:x,group:e.wrapper.id+"-resizing",dragstart:p(t.dragstart,t),drag:p(t.drag,t),dragend:p(t.dragend,t)}),t._draggable.userEvents.bind("press",p(t.addOverlay,t)),t._draggable.userEvents.bind("release",p(t.removeOverlay,t))}function s(e,t){var n=this;n.owner=e,n._draggable=new c(e.wrapper,{filter:t,group:e.wrapper.id+"-moving",dragstart:p(n.dragstart,n),drag:p(n.drag,n),dragend:p(n.dragend,n),dragcancel:p(n.dragcancel,n)}),n._draggable.userEvents.stopPropagation=!1}var l=window.kendo,u=l.ui.Widget,c=l.ui.Draggable,d=e.isPlainObject,f=l._activeElement,p=e.proxy,h=e.extend,g=e.each,m=l.template,v="body",_=".kendoWindow",w=".k-window",b=".k-window-title",k=b+"bar",y=".k-window-content",x=".k-resize-handle",C=".k-overlay",T="k-content-frame",S="k-loading",F="k-state-hover",D="k-state-focused",E="k-window-maximized",M=":visible",I="hidden",H="cursor",z="open",A="activate",O="deactivate",P="close",N="refresh",R="resize",L="dragstart",B="dragend",W="error",q="overflow",V="zIndex",j=".k-window-actions .k-i-minimize,.k-window-actions .k-i-maximize",U=".k-i-pin",$=".k-i-unpin",Y=U+","+$,G=".k-window-titlebar .k-window-action",Q=".k-window-titlebar .k-i-refresh",K=l.isLocalUrl,J=u.extend({init:function(i,r){var a,s,c,f,h,g,m,v=this,x={},C=!1,T=r&&r.actions&&!r.actions.length;u.fn.init.call(v,i,r),r=v.options,f=r.position,i=v.element,h=r.content,T&&(r.actions=[]),v.appendTo=e(r.appendTo),v._animations(),h&&!d(h)&&(h=r.content={url:h}),i.find("script").filter(o).remove(),i.parent().is(v.appendTo)||f.top!==t&&f.left!==t||(i.is(M)?(x=i.offset(),C=!0):(s=i.css("visibility"),c=i.css("display"),i.css({visibility:I,display:""}),x=i.offset(),i.css({visibility:s,display:c})),f.top===t&&(f.top=x.top),f.left===t&&(f.left=x.left)),n(r.visible)&&null!==r.visible||(r.visible=i.is(M)),a=v.wrapper=i.closest(w),i.is(".k-content")&&a[0]||(i.addClass("k-window-content k-content"),v._createWindow(i,r),a=v.wrapper=i.closest(w),v._dimensions()),v._position(),r.pinned&&v.pin(!0),h&&v.refresh(h),r.visible&&v.toFront(),g=a.children(y),v._tabindex(g),r.visible&&r.modal&&v._overlay(a.is(M)).css({opacity:.5}),a.on("mouseenter"+_,G,p(v._buttonEnter,v)).on("mouseleave"+_,G,p(v._buttonLeave,v)).on("click"+_,"> "+G,p(v._windowActionHandler,v)),g.on("keydown"+_,p(v._keydown,v)).on("focus"+_,p(v._focus,v)).on("blur"+_,p(v._blur,v)),this._resizable(),this._draggable(),m=i.attr("id"),m&&(m+="_wnd_title",a.children(k).children(b).attr("id",m),g.attr({role:"dialog","aria-labelledby":m})),a.add(a.children(".k-resize-handle,"+k)).on("mousedown"+_,p(v.toFront,v)),v.touchScroller=l.touchScroller(i),v._resizeHandler=p(v._onDocumentResize,v),e(window).on("resize",v._resizeHandler),r.visible&&(v.trigger(z),v.trigger(A)),l.notify(v)},_buttonEnter:function(t){e(t.currentTarget).addClass(F)},_buttonLeave:function(t){e(t.currentTarget).removeClass(F)},_focus:function(){this.wrapper.addClass(D)},_blur:function(){this.wrapper.removeClass(D)},_dimensions:function(){var e,t,n=this.wrapper,r=this.options,o=r.width,a=r.height,s=r.maxHeight,l=["minWidth","minHeight","maxWidth","maxHeight"];for(this.title(r.title),e=0;l.length>e;e++)t=r[l[e]],t&&1/0!=t&&n.css(l[e],t);s&&1/0!=s&&this.element.css("maxHeight",s),o&&n.width((""+o).indexOf("%")>0?o:i(o,r.minWidth,r.maxWidth)),a&&n.height((""+a).indexOf("%")>0?a:i(a,r.minHeight,r.maxHeight)),r.visible|