UNPKG

magix-components

Version:
1 lines 2.21 kB
define("mx-popconfirm/index",["magix","$","../mx-monitor/index"],function(t,e,i){var _=t("magix"),o=t("$");_.applyStyle("x",".ej{border-radius:4px;padding:10px;-webkit-box-shadow:0 6px 8px rgba(51,51,51,.08);box-shadow:0 6px 8px rgba(51,51,51,.08);position:absolute;border:1px solid rgba(0,0,0,.1);display:none;max-width:276px;min-width:200px;background-color:#fff}.ek{line-height:22px;padding:9px 14px}.el{border-top:1px solid #e6e6e6;margin-left:10px;padding-top:10px;width:92%;text-align:right}");var n=t("../mx-monitor/index");i.exports=_.View.extend({tmpl:{html:'<div class="ek"><%!$$.content%></div><div class="el"><button type="button" class="al am" mx-click="__ac()"><%=$$.enterText%></button><button type="button" class="al s" mx-click="__a()"><%=$$.cancelText%></button></div>',subs:[]},init:function(t){var e=this;e.__I=t.placement||"left",e.__J=t.align,e.__cR=t.content||"确认执行该操作?",e.__cS=t.enterText||"确定",e.__cT=t.cancelText||"取消",n.__d(),e.on("destroy",function(){e.__h.off("click"),n.__f(e),n.__g()})},__i:function(t){var e=this;return _.inside(t,e.id)||_.inside(t,"popcfm_"+e.id)},render:function(){var t=this;t.endUpdate();var e=o("#"+t.id);t.__h=e,e.on("click",function(e){e.preventDefault(),t.__cU(),t.__e()})},__cU:function(){var t=this;if(!t.__cV){var e="popcfm_"+t.id;t.__h.after('<div class="ej" id="'+e+'" />'),t.updater.to(e),t.updater.digest({content:t.__cR,enterText:t.__cS,cancelText:t.__cT}),t.__cV=o("#"+e)}},__e:function(){var t=this;if(!t.__j){t.__j=!0,n.__k(t);var e=t.__cV,i=t.__h,_=i.offset(),o=i.outerWidth(),a=i.outerHeight();e.css({display:"block"});var c=e.outerWidth(),r=e.outerHeight(),s=void 0,d=void 0;switch(t.__I){case"top":s=_.left-(c-o)/2,d=_.top-r-10;break;case"right":s=_.left+o+10,d=_.top-(r-a)/2;break;case"bottom":s=_.left-(c-o)/2,d=_.top+a+10;break;case"left":s=_.left-c-10,d=_.top-(r-a)/2}switch(t.__J){case"top":d=_.top;break;case"left":s=_.left;break;case"right":s=_.left-c+o;break;case"bottom":d=_.top-r+a}e.offset({left:s,top:d})}},__a:function(){var t=this;t.__j&&(delete t.__j,n.__f(t),t.__cV.css({display:"none"}))},"__ac<click>":function(){var t=this;t.__a(),t.__h.trigger("enter")},"__a<click>":function(){this.__a()}})});