UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

3 lines (2 loc) 2.19 kB
!function(e){"function"==typeof define&&define.amd?define(["kendo.mobile.popover.min","kendo.mobile.shim.min"],e):e()}((function(){var e,t,i,n,o,a,s,c,r,l,h,p,d;e=window.kendo.jQuery,t=window.kendo,i=t.support,n=t.mobile.ui,o=n.Shim,a=n.Popup,s=n.Widget,c="open",r="close",l="command",h="li>a",p=t.template((function(e){var i=e.cancel;return'<li class="km-actionsheet-cancel"><a href="#">'+t.htmlEncode(i)+"</a></li>"})),d=s.extend({init:function(c,r){var l,d,m,u=this,f=i.mobileOS;s.fn.init.call(u,c,r),m=(r=u.options).type,c=u.element,l=(d="auto"===m?f&&f.tablet:"tablet"===m)?a:o,r.cancelTemplate&&(p=t.template(r.cancelTemplate)),c.addClass("km-actionsheet").append(p({cancel:u.options.cancel})).wrap('<div class="km-actionsheet-wrapper"></div>').on("up",h,"_click").on("click",h,t.preventDefault),u.view().bind("destroy",(function(){u.destroy()})),u.wrapper=c.parent().addClass(m?" km-actionsheet-"+m:""),u.shim=new l(u.wrapper,e.extend({modal:f.ios&&f.majorVersion<7,className:"km-actionsheet-root"},u.options.popup)),u._closeProxy=u._close.bind(u),u._shimHideProxy=u._shimHide.bind(u),u.shim.bind("hide",u._shimHideProxy),d&&t.onResize(u._closeProxy),t.notify(u,n)},events:[c,r,l],options:{name:"ActionSheet",cancel:"Cancel",type:"auto",popup:{height:"auto"}},open:function(t,i){var n=this;n.target=e(t),n.context=i,n.shim.show(t)},close:function(){this.context=this.target=null,this.shim.hide()},openFor:function(e){var t=e.data("actionsheetContext");this.open(e,t),this.trigger(c,{target:e,context:t})},destroy:function(){s.fn.destroy.call(this),t.unbindResize(this._closeProxy),this.shim.destroy()},_click:function(i){if(!i.isDefaultPrevented()){var n=e(i.currentTarget),o=n.data("action");if(o){var a={target:this.target,context:this.context},s=this.options.$angular;s?this.element.injector().get("$parse")(o)(s[0])(a):t.getter(o)(window)(a)}this.trigger(l,{target:this.target,context:this.context,currentTarget:n}),i.preventDefault(),this._close()}},_shimHide:function(e){this.trigger(r)?e.preventDefault():this.context=this.target=null},_close:function(e){this.trigger(r)?e.preventDefault():this.close()}}),n.plugin(d)})); //# sourceMappingURL=kendo.mobile.actionsheet.min.js.map