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

16 lines
7.7 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.core.min"],e)}(function(){return function(e){function t(t,n){return t===n||e.contains(t,n)}var n=window.kendo,i=n.ui,r=i.Widget,o=n.support,a=n.getOffset,s=n._activeElement,l="open",u="close",d="deactivate",c="activate",f="center",h="left",p="right",g="top",m="bottom",v="absolute",_="hidden",y="body",b="location",w="position",x="visible",k="effects",T="k-state-active",C="k-state-border",S=/k-state-border-(\w+)/,F=".k-picker-wrap, .k-dropdown-wrap, .k-link",M="down",D=e(document.documentElement),E="resize scroll",z=o.transitions.css,O=z+"transform",P=e.extend,A=".kendoPopup",N=["font-size","font-family","font-stretch","font-style","font-weight","line-height"],H=r.extend({init:function(t,i){var o,a=this;i=i||{},i.isRtl&&(i.origin=i.origin||m+" "+p,i.position=i.position||g+" "+p),r.fn.init.call(a,t,i),t=a.element,i=a.options,a.collisions=i.collision?i.collision.split(" "):[],a.downEvent=n.applyEventMap(M,n.guid()),1===a.collisions.length&&a.collisions.push(a.collisions[0]),o=e(a.options.anchor).closest(".k-popup,.k-group").filter(":not([class^=km-])"),i.appendTo=e(e(i.appendTo)[0]||o[0]||y),a.element.hide().addClass("k-popup k-group k-reset").toggleClass("k-rtl",!!i.isRtl).css({position:v}).appendTo(i.appendTo).on("mouseenter"+A,function(){a._hovered=!0}).on("mouseleave"+A,function(){a._hovered=!1}),a.wrapper=e(),i.animation===!1&&(i.animation={open:{effects:{}},close:{hide:!0,effects:{}}}),P(i.animation.open,{complete:function(){a.wrapper.css({overflow:x}),a._trigger(c)}}),P(i.animation.close,{complete:function(){a._animationClose()}}),a._mousedownProxy=function(e){a._mousedown(e)},a._resizeProxy=function(e){a._resize(e)},i.toggleTarget&&e(i.toggleTarget).on(i.toggleEvent+A,e.proxy(a.toggle,a))},events:[l,c,u,d],options:{name:"Popup",toggleEvent:"click",origin:m+" "+h,position:g+" "+h,anchor:y,appendTo:null,collision:"flip fit",viewport:window,copyAnchorStyles:!0,autosize:!1,modal:!1,animation:{open:{effects:"slideIn:down",transition:!0,duration:200},close:{duration:100,hide:!0}}},_animationClose:function(){var t,i,r,o,a=this,s=a.options;a.wrapper.hide(),t=a.wrapper.data(b),i=e(s.anchor),t&&a.wrapper.css(t),s.anchor!=y&&(r=(i[0].className.match(S)||["","down"])[1],o=C+"-"+r,i.removeClass(o).children(F).removeClass(T).removeClass(o),a.element.removeClass(C+"-"+n.directions[r].reverse)),a._closing=!1,a._trigger(d)},destroy:function(){var t,i=this,o=i.options,a=i.element.off(A);r.fn.destroy.call(i),o.toggleTarget&&e(o.toggleTarget).off(A),o.modal||(D.unbind(i.downEvent,i._mousedownProxy),i._scrollableParents().unbind(E,i._resizeProxy)),n.destroy(i.element.children()),a.removeData(),o.appendTo[0]===document.body&&(t=a.parent(".k-animation-container"),t[0]?t.remove():a.remove())},open:function(t,i){var r,a,s,u=this,d={isFixed:!isNaN(parseInt(i,10)),x:t,y:i},c=u.element,f=u.options,h="down",p=e(f.anchor),m=c[0]&&c.hasClass("km-widget");if(!u.visible()){if(f.copyAnchorStyles&&(m&&"font-size"==N[0]&&N.shift(),c.css(n.getComputedStyles(p[0],N))),c.data("animating")||u._trigger(l))return;f.modal||(D.unbind(u.downEvent,u._mousedownProxy).bind(u.downEvent,u._mousedownProxy),o.mobileOS.ios||o.mobileOS.android||this._scrollableParents().unbind(E,u._resizeProxy).bind(E,u._resizeProxy)),u.wrapper=a=n.wrap(c,f.autosize).css({overflow:_,display:"block",position:v}),o.mobileOS.android&&a.css(O,"translatez(0)"),a.css(w),e(f.appendTo)[0]==document.body&&a.css(g,"-10000px"),r=P(!0,{},f.animation.open),u.flipped=u._position(d),r.effects=n.parseEffects(r.effects,u.flipped),h=r.effects.slideIn?r.effects.slideIn.direction:h,f.anchor!=y&&(s=C+"-"+h,c.addClass(C+"-"+n.directions[h].reverse),p.addClass(s).children(F).addClass(T).addClass(s)),c.data(k,r.effects).kendoStop(!0).kendoAnimate(r)}},toggle:function(){var e=this;e[e.visible()?u:l]()},visible:function(){return this.element.is(":"+x)},close:function(t){var i,r,o,a,s=this,l=s.options;if(s.visible()){if(i=s.wrapper[0]?s.wrapper:n.wrap(s.element).hide(),s._closing||s._trigger(u))return;s.element.find(".k-popup").each(function(){var n=e(this),i=n.data("kendoPop