16 lines
3.8 KiB
JavaScript
16 lines
3.8 KiB
JavaScript
/**
|
|
* 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.popup.min","./kendo.mobile.pane.min"],e)}(function(){return function(e){var t=window.kendo,n=t.mobile,i=n.ui,r="hide",o="open",a="close",s='<div class="km-popup-wrapper" />',l='<div class="km-popup-arrow" />',u='<div class="km-popup-overlay" />',c="km-up km-down km-left km-right",d=i.Widget,p={down:{origin:"bottom center",position:"top center"},up:{origin:"top center",position:"bottom center"},left:{origin:"center left",position:"center right",collision:"fit flip"},right:{origin:"center right",position:"center left",collision:"fit flip"}},f={animation:{open:{effects:"fade:in",duration:0},close:{effects:"fade:out",duration:400}}},h={horizontal:{offset:"top",size:"height"},vertical:{offset:"left",size:"width"}},g={up:"down",down:"up",left:"right",right:"left"},m=d.extend({init:function(n,i){var o,a,c=this,g=n.closest(".km-modalview-wrapper"),m=n.closest(".km-root").children(".km-pane").first(),v=g[0]?g:m;i.viewport?m=i.viewport:m[0]||(m=window),i.container?v=i.container:v[0]||(v=document.body),o={viewport:m,copyAnchorStyles:!1,autosize:!0,open:function(){c.overlay.show()},activate:e.proxy(c._activate,c),deactivate:function(){c.overlay.hide(),c._apiCall||c.trigger(r),c._apiCall=!1}},d.fn.init.call(c,n,i),n=c.element,i=c.options,n.wrap(s).addClass("km-popup").show(),a=c.options.direction.match(/left|right/)?"horizontal":"vertical",c.dimensions=h[a],c.wrapper=n.parent().css({width:i.width,height:i.height}).addClass("km-popup-wrapper km-"+i.direction).hide(),c.arrow=e(l).prependTo(c.wrapper).hide(),c.overlay=e(u).appendTo(v).hide(),o.appendTo=c.overlay,i.className&&c.overlay.addClass(i.className),c.popup=new t.ui.Popup(c.wrapper,e.extend(!0,o,f,p[i.direction]))},options:{name:"Popup",width:240,height:"",direction:"down",container:null,viewport:null},events:[r],show:function(t){this.popup.options.anchor=e(t),this.popup.open()},hide:function(){this._apiCall=!0,this.popup.close()},destroy:function(){d.fn.destroy.call(this),this.popup.destroy(),this.overlay.remove()},target:function(){return this.popup.options.anchor},_activate:function(){var t=this,n=t.options.direction,i=t.dimensions,r=i.offset,o=t.popup,a=o.options.anchor,s=e(a).offset(),l=e(o.element).offset(),u=o.flipped?g[n]:n,d=2*t.arrow[i.size](),p=t.element[i.size]()-t.arrow[i.size](),f=e(a)[i.size](),h=s[r]-l[r]+f/2;d>h&&(h=d),h>p&&(h=p),t.wrapper.removeClass(c).addClass("km-"+u),t.arrow.css(r,h).show()}}),v=d.extend({init:function(n,r){var o,s=this;s.initialOpen=!1,d.fn.init.call(s,n,r),o=e.extend({className:"km-popover-root",hide:function(){s.trigger(a)}},this.options.popup),s.popup=new m(s.element,o),s.popup.overlay.on("move",!1),s.pane=new i.Pane(s.element,this.options.pane),s.pane.navigateToInitial(),t.notify(s,i)},options:{name:"PopOver",popup:{},pane:{}},events:[o,a],open:function(e){this.popup.show(e),this.initialOpen||(this.pane.navigate(""),this.popup.popup._position(),this.initialOpen=!0)},openFor:function(e){this.open(e),this.trigger(o,{target:this.popup.target()})},close:function(){this.popup.hide()},destroy:function(){d.fn.destroy.call(this),this.pane.destroy(),this.popup.destroy(),t.destroy(this.element)}});i.plugin(m),i.plugin(v)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()}); |