text: (self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[8339],{58339:(n,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>j});var t=a(73450),e=a(27378),o=a(57318),p=a(11497),c=a(96681),l=a(23476),i=a(24246);function r(n,s){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);s&&(t=t.filter((function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable}))),a.push.apply(a,t)}return a}function u(n){for(var s=1;s<arguments.length;s++){var a=null!=arguments[s]?arguments[s]:{};s%2?r(Object(a),!0).forEach((function(s){(0,t.Z)(n,s,a[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(a,s))}))}return n}var k=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"showAlertInfo",(()=>{p.Hj.alert({content:"Here comes the main content",parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.showAlertInfo,children:"Message Dialog"})}}return(0,i.jsx)(n,{})},d=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"onConfirm",(()=>{l.g.success("I know.")})),(0,t.Z)(this,"onCancel",(()=>{l.g.error("Canceled.")})),(0,t.Z)(this,"showAlertConfirm",(()=>{p.Hj.confirm({content:(0,i.jsx)("p",{children:"This is content."}),onConfirm:this.onConfirm,onCancel:this.onCancel,parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.showAlertConfirm,children:"Message Dialog"})}}return(0,i.jsx)(n,{})},m=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"autoCloseConfirm",(()=>{var n=p.Hj.confirm({content:(0,i.jsx)("p",{children:"Close automatically after one second"}),parentComponent:this});setTimeout(n,1e3)}))}render(){return(0,i.jsx)(c.z,{onClick:this.autoCloseConfirm,children:"Self-closing dialog"})}}return(0,i.jsx)(n,{})},f=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"promiseConfirm",(()=>{p.Hj.confirm({content:"Click confirm, close automatically after 3 seconds",title:"onConfirm returns Promise",onConfirm:()=>new Promise((n=>{setTimeout((()=>{n()}),3e3)})),parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.promiseConfirm,children:"Self-closing with Promise"})}}return(0,i.jsx)(n,{})},h=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"showAlertInfo",(()=>{p.Hj.alert({type:"info",content:"Here comes the main content.",title:"This is a Dialog title.",parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.showAlertInfo,children:"Dialog with icon"})}}return(0,i.jsx)(n,{})},g=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"showAlertConfirm",(()=>{p.Hj.alert({confirmType:"default",confirmText:"Delete",content:"Confirm to delete?",title:"Confirm",parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.showAlertConfirm,children:"Remove"})}}return(0,i.jsx)(n,{})},y=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"showAlertInfo",(()=>{p.Hj.alert({closeBtn:!0,maskClosable:!0,content:"Here comes the main content",parentComponent:this})}))}render(){return(0,i.jsx)(c.z,{onClick:this.showAlertInfo,children:"With close button"})}}return(0,i.jsx)(n,{})};function w(n){return(0,i.jsx)(n.tag,u(u({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function v(n){return(0,i.jsx)(w,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function C(n){return(0,i.jsx)(w,{tag:"style",html:n.style})}function b(n,s){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(s+=n.offsetTop),b(n.parentNode,s);return s}class x extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{showCode:!1}),(0,t.Z)(this,"toggle",(()=>{this.setState({showCode:!this.state.showCode})}))}render(){var n=this.state.showCode,s=this.props,a=s.title,t=s.src,e=s.children;return(0,i.jsxs)("div",{className:"zandoc-react-demo",children:[(0,i.jsx)("div",{className:"zandoc-react-demo__preview",children:e}),(0,i.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,i.jsx)("div",{className:"zandoc-react-demo__title",children:(0,i.jsx)("p",{children:a||""})}),(0,i.jsx)("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})]}),n&&(0,i.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,i.jsx)(w,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class j extends e.Component{componentDidMount(){var n=location.hash;if(n){var s=document.querySelector('a[href="'.concat(n,'"]'));s&&(0,o.l)(document.documentElement,0,b(s,-9))}}render(){return e.createElement("div",{className:"zandoc-react-container"},e.createElement(C,{style:""}),e.createElement(v,{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>'}),e.createElement(x,{title:"Basic Usage",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      content<span class="token operator">:</span> <span class="token string">\'Here comes the main content\'</span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">showAlertInfo</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Message</span> <span class="token maybe-class-name">Dialog</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(k)),e.createElement(x,{title:"With Confirm and Cancel Button",id:"Demowithbuttons",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Notify</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Notify</span><span class="token punctuation">.</span><span class="token method function property-access">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      content<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span><span class="token maybe-class-name">This</span> is content<span class="token punctuation">.</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n      onConfirm<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onConfirm</span><span class="token punctuation">,</span>\n      onCancel<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onCancel</span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">showAlertConfirm</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Message</span> <span class="token maybe-class-name">Dialog</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(d)),e.createElement(x,{title:"Self-closing",id:"Democlosedexternal",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token keyword">const</span> close <span class="token operator">=</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      content<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span><span class="token maybe-class-name">Close</span> automatically after one second<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">autoCloseConfirm</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Self</span><span class="token operator">-</span>closing dialog<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(m)),e.createElement(x,{title:"callback returns Promise",id:"Demoreturnpromise",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">confirm</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      content<span class="token operator">:</span> <span class="token string">\'Click confirm, close automatically after 3 seconds\'</span><span class="token punctuation">,</span>\n      title<span class="token operator">:</span> <span class="token string">\'onConfirm returns Promise\'</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 arrow 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><span class="token parameter">resolve</span><span class="token punctuation">)</span> <span class="token arrow 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 arrow 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 operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">promiseConfirm</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Self</span><span class="token operator">-</span>closing <span class="token keyword">with</span> <span class="token known-class-name class-name">Promise</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(f)),e.createElement(x,{title:"Dialog with icon next to the title.",id:"Demowithicon",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      type<span class="token operator">:</span> <span class="token string">\'info\'</span><span class="token punctuation">,</span>\n      content<span class="token operator">:</span> <span class="token string">\'Here comes the main content.\'</span><span class="token punctuation">,</span>\n      title<span class="token operator">:</span> <span class="token string">\'This is a Dialog title.\'</span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">showAlertInfo</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Dialog</span> <span class="token keyword">with</span> icon<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(h)),e.createElement(x,{title:"The type of button in Dialog is settable.",id:"Demobuttontype",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      confirmType<span class="token operator">:</span> <span class="token string">\'default\'</span><span class="token punctuation">,</span>\n      confirmText<span class="token operator">:</span> <span class="token string">\'Delete\'</span><span class="token punctuation">,</span>\n      content<span class="token operator">:</span> <span class="token string">\'Confirm to delete?\'</span><span class="token punctuation">,</span>\n      title<span class="token operator">:</span> <span class="token string">\'Confirm\'</span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">showAlertConfirm</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Remove</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(g)),e.createElement(x,{title:"With close button",id:"Demowithclosebtn",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span></span> <span class="token keyword module">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 arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token maybe-class-name">Sweetalert</span><span class="token punctuation">.</span><span class="token method function property-access">alert</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      closeBtn<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n      maskClosable<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n      content<span class="token operator">:</span> <span class="token string">\'Here comes the main content\'</span><span class="token punctuation">,</span>\n      parentComponent<span class="token operator">:</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 control-flow">return</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Button</span></span> <span class="token attr-name">onClick</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">showAlertInfo</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">With</span> close button<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Button</span></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\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Wrapper</span></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>'},e.createElement(y)),e.createElement(v,{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></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</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></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</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>"}))}}},69024:(n,s,a)=>{"use strict";a.d(s,{V:()=>N,Z:()=>O});var t=a(59312),e=a(24246),o=a(27378),p=a(14623),c=a(53552),l=a(79352),i=a(60042),r=a.n(i),u=a(58801),k=a(27036),d=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.dialogEl=null,s.onClickClose=function(n){var a=s.props.onClose;a&&a(n)},s}return(0,t.ZT)(s,n),s.prototype.componentDidMount=function(){this.resetTransformOrigin()},s.prototype.componentDidUpdate=function(){this.resetTransformOrigin()},s.prototype.resetTransformOrigin=function(n){void 0===n&&(n=this.props);var s=n.mousePosition;if(s&&s.x>=0&&s.y>=0&&this.dialogEl&&this.dialogEl.getBoundingClientRect){var a=this.dialogEl.getBoundingClientRect(),t=a.left,e=a.top,o=s.x-t+"px "+(s.y-e)+"px 0",p=this.dialogEl.style;["Webkit","Moz","Ms","ms"].forEach((function(n){p[n+"TransformOrigin"]=o})),p.transformOrigin=o}},s.prototype.renderHeader=function(){var n=this.props.title;return n?(n="number"==typeof n||"string"==typeof n?(0,e.jsx)("span",(0,t.pi)({className:"zent-dialog-r-title-text","data-zv":"9.12.7"},{children:n}),void 0):n,(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-header","data-zv":"9.12.7"},{children:(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-title","data-zv":"9.12.7"},{children:n}),void 0)}),void 0)):null},s.prototype.render=function(){var n=this,s=this.props,a=s.className,o=s.closeBtn,p=s.footer,c=s.style,l=s.children,i=this.renderHeader(),u=r()("zent-dialog-r-close",{"zent-dialog-r-has-title":!!i}),d=o&&(0,e.jsx)("button",(0,t.pi)({type:"button",className:u,onClick:this.onClickClose,"data-zv":"9.12.7"},{children:(0,e.jsx)(k.Z,{type:"close"},void 0)}),void 0),m=p&&(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-footer","data-zv":"9.12.7"},{children:p}),void 0);return(0,e.jsxs)("div",(0,t.pi)({className:r()("zent-dialog-r",a,{"zent-dialog-r--has-header":!!i,"zent-dialog-r--has-footer":!!m,"zent-dialog-r--no-close-btn":!d}),style:c,ref:function(s){return n.dialogEl=s},"data-zv":"9.12.7"},{children:[d,i,(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body","data-zv":"9.12.7"},{children:(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body-content","data-zv":"9.12.7"},{children:l}),void 0)}),void 0),m]}),void 0)},s}(o.Component),m=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.rootRef=(0,o.createRef)(),s.onMaskClick=function(n){n.target===n.currentTarget&&s.props.mask&&s.props.maskClosable&&s.props.onClose(n)},s}return(0,t.ZT)(s,n),s.prototype.componentDidMount=function(){var n=document.activeElement,s=this.rootRef.current;s!==n&&s&&!s.contains(n)&&function(n){if(n){var s=(0,u.Z)();n.focus(),window.scroll(s.x,s.y)}}(s)},s.prototype.render=function(){var n=this.props,s=n.mask,a=n.visible,o=n.children;return(0,e.jsxs)("div",(0,t.pi)({ref:this.rootRef,tabIndex:-1,className:"zent-dialog-r-root","data-zv":"9.12.7"},{children:[a&&s&&(0,e.jsx)("div",{className:"zent-dialog-r-backdrop","data-zv":"9.12.7"},void 0),(0,e.jsx)("div",(0,t.pi)({className:"zent-dialog-r-wrap",onClick:this.onMaskClick,"data-zv":"9.12.7"},{children:o}),void 0)]}),void 0)},s}(o.Component),f=a(31542),h=a.t(f,2),g=a(70453),y=a(42690),w=a(14805),v=new Map,C=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.state={visible:!0},s.closeOptions={},s.onClosed=function(){var n=s.props,a=n.options.onClose,t=n.container,e=s.closeOptions.triggerOnClose;(void 0===e||e)&&a&&a(),f.unmountComponentAtNode(t)},s.onClose=function(n){s.close({triggerOnClose:!1!==n})},s}return(0,t.ZT)(s,n),s.prototype.close=function(n){void 0===n&&(n={}),this.closeOptions=n,this.setState({visible:!1})},s.prototype.componentWillUnmount=function(){var n=this.props.options.dialogId;v.delete(n)},s.prototype.render=function(){var n=this.props.options,s=this.state.visible;return(0,e.jsx)(O,(0,t.pi)({},n,{onClose:this.onClose,onClosed:this.onClosed,visible:s}),void 0)},s}(o.Component);function b(n,s){void 0===s&&(s={});var a=v.get(n);if(a){var t=a.current;t&&t.close(s)}}function x(n){if(void 0===n&&(n={}),!l.Z)return y.Z;var s=n.dialogId,a=void 0===s?(0,g.Z)("__zent-dialog__"):s,p=n.parentComponent;!function(n){if(v.has(n))throw new Error("Duplicate dialog id found: "+n)}(a);var c=(0,w.Z)("div"),i=p?f.unstable_renderSubtreeIntoContainer.bind(h,p):f.render,r=(0,o.createRef)();return i((0,e.jsx)(C,{ref:r,options:(0,t.pi)((0,t.pi)({},n),{dialogId:a}),container:c},void 0),c),function(n,s){v.set(n,s)}(a,r),function(n){void 0===n&&(n=!0),b(a,{triggerOnClose:!1!==n})}}var j=a(49744),z=null;l.Z&&(0,j.Oo)(document.documentElement,"click",(function(n){z={x:n.clientX,y:n.clientY}}),{capture:!0});var N=function(n){function s(s){var a=n.call(this,s)||this;return a.lastMousePosition=null,a.onClose=function(n){var s=a.props.onClose;s&&s(n)},a.onExited=function(){var n=a.props.onClosed;a.setState({exiting:!1}),n&&n()},a.state={prevOpen:s.visible,exiting:!1},a}return(0,t.ZT)(s,n),s.getDerivedStateFromProps=function(n,s){var a=s.prevOpen;return n.visible===a?null:n.visible?{prevOpen:n.visible,exiting:!1}:{prevOpen:n.visible,exiting:!0}},s.prototype.render=function(){var n=this.props,s=n.visible,a=n.closeBtn,o=n.style,l=n.onOpened,i=(n.onClosed,n.mask),r=n.maskClosable,u=n.children,k=(0,t._T)(n,["visible","closeBtn","style","onOpened","onClosed","mask","maskClosable","children"]),f=this.state.exiting;return this.lastMousePosition=s?this.lastMousePosition||z:null,(0,e.jsx)(c.ZP,(0,t.pi)({visible:s||f,onClose:this.onClose,className:"zent-dialog-r-anchor",closeOnESC:a,blockPageScroll:!0},{children:(0,e.jsx)(m,(0,t.pi)({mask:i,maskClosable:r,visible:s,onClose:this.onClose},{children:(0,e.jsx)(p.Z,(0,t.pi)({appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:s,timeout:300,classNames:"zent-zoom",onEntered:l,onExited:this.onExited},{children:(0,e.jsx)(d,(0,t.pi)({},k,{style:o,closeBtn:a,mousePosition:this.lastMousePosition},{children:u}),void 0)}),void 0)}),void 0)}),void 0)},s.defaultProps={onClose:function(){},visible:!1,className:"",style:{},title:"",closeBtn:!0,mask:!0,maskClosable:!0,footer:null},s.openDialog=x,s.closeDialog=b,s}(o.Component),O=N},11497:(n,s,a)=>{"use strict";a.d(s,{Hj:()=>y});var t=a(59312),e=a(24246),o=a(60042),p=a.n(o),c=a(52074),l=a(69024).Z,i=a(27036),r=a(27378),u=a(90347),k=a(65436),d=function(n){function s(){var s=null!==n&&n.apply(this,arguments)||this;return s.state={loading:!1},s.onClick=function(){var n=s.props,a=n.onClick,t=(0,n.getClose)();if(!a)return t();var e=a.length>0,o=e?a(t):a();if((0,k.Z)(o))return s.setState({loading:!0}),void o.then((function(){t()}),(function(){s.setState({loading:!1})}));e||!1===o||t()},s}return(0,t.ZT)(s,n),s.prototype.render=function(){var n=this.props,s=n.className,a=n.type,o=n.text,p=this.state.loading;return(0,e.jsx)(u.ZP,(0,t.pi)({type:a,className:s,loading:p,onClick:this.onClick},{children:o}),void 0)},s}(r.Component),m={info:"info-circle-o",success:"check-circle-o",error:"close-circle-o",warning:"error-circle-o"},f=l.openDialog;function h(n,s){var a,o=n.className,l=void 0===o?"":o,r=n.confirmType,u=void 0===r?"primary":r,k=n.closeBtn,h=void 0!==k&&k,g=n.maskClosable,y=void 0!==g&&g,w=n.title,v=n.type,C=n.content,b=n.onConfirm,x=n.onCancel,j=n.confirmText,z=n.cancelText,N=n.parentComponent,O=n.onClose,D=null;return D=f({closeBtn:h,maskClosable:y,className:p()("zent-sweetalert-"+s,(a={},a[l]=!!l,a)),title:(0,e.jsx)(c.Z,(0,t.pi)({componentName:"Sweetalert"},{children:function(n){var s=m[v];return(0,e.jsxs)("div",(0,t.pi)({className:"zent-sweetalert-"+(v?"icon-":"")+"title","data-zv":"9.12.7"},{children:[v&&(0,e.jsx)(i.Z,{className:"zent-sweetalert-type-icon",type:s},void 0),w||n.title]}),void 0)}}),void 0),children:C,footer:(0,e.jsx)(c.Z,(0,t.pi)({componentName:"Sweetalert"},{children:function(n){var a="alert"===s;return(0,e.jsxs)("div",(0,t.pi)({className:"sweet-"+s+"-actions","data-zv":"9.12.7"},{children:[!a&&(0,e.jsx)(d,{type:"default",className:"zent-sweetalert-"+s+"-btn-cancel",getClose:function(){return D},onClick:x,text:z||n.cancel},"sweetalert-cancel"),(0,e.jsx)(d,{type:u,className:"zent-sweetalert-"+s+"-btn-confirm",getClose:function(){return D},onClick:b,text:j||(a?n.ok:n.confirm)},"sweetalert-confirm")]}),void 0)}}),void 0),parentComponent:N,onClose:O})}function g(n){return void 0===n&&(n={}),h(n,"alert")}var y={alert:g,info:g,confirm:function(n){return void 0===n&&(n={}),h(n,"confirm")}}},58801:(n,s,a)=>{"use strict";function t(){var n=window.pageXOffset,s=window.pageYOffset;return{x:void 0!==n?n:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==s?s:(document.documentElement||document.body.parentNode||document.body).scrollTop}}a.d(s,{Z:()=>t})}}]);