-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path124-bc4eac5649ec72ccd951.js
1 lines (1 loc) · 37.1 KB
/
124-bc4eac5649ec72ccd951.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[124],{737:function(n,a,s){"use strict";s.r(a),s.d(a,"default",function(){return R});var t=s(580),o=s.n(t),e=s(23),p=s.n(e),c=s(24),l=s.n(c),u=s(25),i=s.n(u),r=s(26),k=s.n(r),d=s(32),m=s.n(d),f=s(27),h=s.n(f),g=s(28),w=s.n(g),y=s(0),C=s.n(y),v=s(111),b=s(82),E=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"showAlertInfo",function(){b.vb.alert({content:"Here comes the main content",parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.showAlertInfo},"Message Dialog")}}]),a}(C.a.Component);return C.a.createElement(n,null)},D=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"onConfirm",function(){b.db.success("I know.")}),w()(m()(s),"onCancel",function(){b.db.error("Canceled.")}),w()(m()(s),"showAlertConfirm",function(){b.vb.confirm({content:C.a.createElement("p",null,"This is content."),onConfirm:s.onConfirm,onCancel:s.onCancel,parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.showAlertConfirm},"Message Dialog")}}]),a}(C.a.Component);return C.a.createElement(n,null)},A=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"autoCloseConfirm",function(){var n=b.vb.confirm({content:C.a.createElement("p",null,"Close automatically after one second"),parentComponent:m()(s)});setTimeout(n,1e3)}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.autoCloseConfirm},"Self-closing dialog")}}]),a}(C.a.Component);return C.a.createElement(n,null)},S=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"promiseConfirm",function(){b.vb.confirm({content:"Click confirm, close automatically after 3 seconds",title:"onConfirm returns Promise",onConfirm:function(){return new Promise(function(n){setTimeout(function(){n()},3e3)})},parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.promiseConfirm},"Self-closing with Promise")}}]),a}(C.a.Component);return C.a.createElement(n,null)},B=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"showAlertInfo",function(){b.vb.alert({type:"info",content:"Here comes the main content.",title:"This is a Dialog title.",parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.showAlertInfo},"Dialog with icon")}}]),a}(C.a.Component);return C.a.createElement(n,null)},T=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"showAlertConfirm",function(){b.vb.confirm({confirmType:"danger",confirmText:"Delete",cancelText:"Cancel",content:"Confirm to delete?",title:"Confirm",parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.showAlertConfirm,type:"danger"},"Remove")}}]),a}(C.a.Component);return C.a.createElement(n,null)},x=function(){var n=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"showAlertInfo",function(){b.vb.alert({closeBtn:!0,maskClosable:!0,content:"Here comes the main content",parentComponent:m()(s)})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){return C.a.createElement(b.i,{onClick:this.showAlertInfo},"With close button")}}]),a}(C.a.Component);return C.a.createElement(n,null)};function N(n){return C.a.createElement(n.tag,o()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function z(n){return C.a.createElement(N,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function I(n){return C.a.createElement(N,{tag:"style",html:n.style})}var W=function(n){function a(){var n,s;p()(this,a);for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return s=i()(this,(n=k()(a)).call.apply(n,[this].concat(o))),w()(m()(s),"state",{showCode:!1}),w()(m()(s),"toggle",function(){s.setState({showCode:!s.state.showCode})}),s}return h()(a,n),l()(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,o=a.children;return C.a.createElement("div",{className:"zandoc-react-demo"},C.a.createElement("div",{className:"zandoc-react-demo__preview"},o),C.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},C.a.createElement("div",{className:"zandoc-react-demo__title"},C.a.createElement("p",null,s||"")),C.a.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&C.a.createElement("pre",{className:"zandoc-react-demo__code"},C.a.createElement(N,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(y.Component),R=function(n){function a(){return p()(this,a),i()(this,k()(a).apply(this,arguments))}return h()(a,n),l()(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(v.a)(document.documentElement,0,function n(a,s){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(s+=a.offsetTop),n(a.parentNode,s);return s}(a,-9))}}},{key:"render",value:function(){return C.a.createElement("div",{className:"zandoc-react-container",key:null},C.a.createElement(I,{style:""}),C.a.createElement(z,{html:'<h2 class="anchor-heading"><a href="#sweetalert">¶</a><a href="javascript:void(0)" id="sweetalert" class="anchor-point"></a>Sweetalert</h2>\n<p>Sweetalert is a function used for arouse a Dialog rapidly.</p>\n<h3 class="anchor-heading"><a href="#guides">¶</a><a href="javascript:void(0)" id="guides" class="anchor-point"></a>Guides</h3>\n<ul>\n<li>Sweetalert has no custom option, use Dialog instead if needed.</li>\n</ul>\n<h3 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h3>'}),C.a.createElement(W,{title:"Basic Usage",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">showAlertInfo</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Here comes the main content\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>showAlertInfo<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>Message Dialog<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(E)),C.a.createElement(W,{title:"With Confirm and Cancel Button",id:"Demowithbuttons",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button<span class="token punctuation">,</span> Notify <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">onConfirm</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span><span class="token string">\'I know.\'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onCancel</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">error</span><span class="token punctuation">(</span><span class="token string">\'Canceled.\'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">showAlertConfirm</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>This is content<span class="token punctuation">.</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n onConfirm<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>onConfirm<span class="token punctuation">,</span>\n onCancel<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>onCancel<span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>showAlertConfirm<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>Message Dialog<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(D)),C.a.createElement(W,{title:"Self-closing",id:"Democlosedexternal",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">autoCloseConfirm</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> close <span class="token operator">=</span> Sweetalert<span class="token punctuation">.</span><span class="token function">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>Close automatically after one second<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token function">setTimeout</span><span class="token punctuation">(</span>close<span class="token punctuation">,</span> <span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>autoCloseConfirm<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>Self<span class="token operator">-</span>closing dialog<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(A)),C.a.createElement(W,{title:"callback returns Promise",id:"Demoreturnpromise",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">promiseConfirm</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Click confirm, close automatically after 3 seconds\'</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'onConfirm returns Promise\'</span><span class="token punctuation">,</span>\n onConfirm<span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span>resolve<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">resolve</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">3000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>promiseConfirm<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>Self<span class="token operator">-</span>closing <span class="token keyword">with</span> Promise<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(S)),C.a.createElement(W,{title:"Dialog with icon next to the title.",id:"Demowithicon",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">showAlertInfo</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n type<span class="token punctuation">:</span> <span class="token string">\'info\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Here comes the main content.\'</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'This is a Dialog title.\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>showAlertInfo<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>Dialog <span class="token keyword">with</span> icon<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(B)),C.a.createElement(W,{title:"The type of button in Dialog is settable.",id:"Demobuttontype",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">showAlertConfirm</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n confirmType<span class="token punctuation">:</span> <span class="token string">\'danger\'</span><span class="token punctuation">,</span>\n confirmText<span class="token punctuation">:</span> <span class="token string">\'Delete\'</span><span class="token punctuation">,</span>\n cancelText<span class="token punctuation">:</span> <span class="token string">\'Cancel\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Confirm to delete?\'</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Confirm\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>showAlertConfirm<span class="token punctuation">}</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>danger<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Remove<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(T)),C.a.createElement(W,{title:"With close button",id:"Demowithclosebtn",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Sweetalert<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Wrapper</span> <span class="token keyword">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>\n <span class="token function-variable function">showAlertInfo</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Sweetalert<span class="token punctuation">.</span><span class="token function">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n closeBtn<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n maskClosable<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'Here comes the main content\'</span><span class="token punctuation">,</span>\n parentComponent<span class="token punctuation">:</span> <span class="token keyword">this</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Button</span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>showAlertInfo<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>With close button<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Button</span><span class="token punctuation">></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Wrapper</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},C.a.createElement(x)),C.a.createElement(z,{html:"<h3 class=\"anchor-heading\"><a href=\"#api\">¶</a><a href=\"javascript:void(0)\" id=\"api\" class=\"anchor-point\"></a>API</h3>\n<h4 class=\"anchor-heading\"><a href=\"#sweetalert-alert\">¶</a><a href=\"javascript:void(0)\" id=\"sweetalert-alert\" class=\"anchor-point\"></a>Sweetalert.alert</h4>\n<table class=\"table\">\n<thead>\n<tr>\n<th>Props</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Alternatives</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>content</td>\n<td>main content of the dialog</td>\n<td>node</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>type</td>\n<td>dialog type, will show an icon on the left side of title if this prop is set.</td>\n<td>string</td>\n<td><code>''</code></td>\n<td><code>'info'</code>\n, \n<code>'success'</code>\n, \n<code>'error'</code>\n, \n<code>'warning'</code></td>\n</tr>\n<tr>\n<td>title</td>\n<td>title of the dialog</td>\n<td>node</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onConfirm</td>\n<td>callback of confirm operation</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>confirmText</td>\n<td>text of confirm button</td>\n<td>string</td>\n<td><code>'OK'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>confirmType</td>\n<td>type of confirm button</td>\n<td>string</td>\n<td><code>'primary'</code></td>\n<td><code>'default'</code>\n、\n<code>'primary'</code>\n、\n<code>'danger'</code>\n、\n<code>'success'</code></td>\n</tr>\n<tr>\n<td>closeBtn</td>\n<td>visibility of the close button at the upper right corner</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>maskClosable</td>\n<td>wether click on the mask is to close the dialog</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>parentComponent</td>\n<td>Parent component instance,i18n needs this to pass context through</td>\n<td>ReactInstance</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>custom classname</td>\n<td>string</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>custom prefix</td>\n<td>string</td>\n<td><code>'zent'</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class=\"anchor-heading\"><a href=\"#sweetalert-confirm\">¶</a><a href=\"javascript:void(0)\" id=\"sweetalert-confirm\" class=\"anchor-point\"></a>Sweetalert.confirm</h4>\n<table class=\"table\">\n<thead>\n<tr>\n<th>Props</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Alternatives</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>content</td>\n<td>main content of the dialog</td>\n<td>node</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>type</td>\n<td>dialog type, will show an icon on the left side of title if this prop is set.</td>\n<td>string</td>\n<td><code>''</code></td>\n<td><code>'info'</code>\n, \n<code>'success'</code>\n, \n<code>'error'</code>\n, \n<code>'warning'</code></td>\n</tr>\n<tr>\n<td>title</td>\n<td>title of the dialog</td>\n<td>node</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onCancel</td>\n<td>callback of cancel operation</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onConfirm</td>\n<td>callback of confirm operation</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>cancelText</td>\n<td>text of cancel button</td>\n<td>string</td>\n<td><code>'Cancel'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>confirmText</td>\n<td>text of confirm button</td>\n<td>string</td>\n<td><code>'Confirm'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>confirmType</td>\n<td>type of confirm button</td>\n<td>string</td>\n<td><code>'primary'</code></td>\n<td><code>'default'</code>\n、\n<code>'primary'</code>\n、\n<code>'danger'</code>\n、\n<code>'success'</code></td>\n</tr>\n<tr>\n<td>closeBtn</td>\n<td>visibility of the close button at the upper right corner</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>maskClosable</td>\n<td>wether click on the mask is to close the dialog</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>custom classname</td>\n<td>string</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>custom prefix</td>\n<td>string</td>\n<td><code>'zent'</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<ul>\n<li>The returned value of <code>Sweetalert.alert</code> and <code>Sweetalert.confirm</code> are functions which can be used to close the dialog manually.</li>\n<li>If <code>onConfirm</code> return a <code>Promise</code>, the corresponding button will stay loading when <code>Promise</code> is pending; The dialog won't be closed when <code>Promise</code> rejected, and will be closed if <code>Promise</code> resolved.</li>\n<li>If <code>onConfirm</code> has no parameter and returned a <code>false</code>, the dialog won't be closed.</li>\n<li>If <code>onConfirm</code> has one parameter <code>close</code>, it need to be triggered manually to close the dialog.</li>\n</ul>"}))}}]),a}(y.Component)}}]);