text: (self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[9570],{89570:(n,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>w});var t=a(73450),p=a(27378),o=a(57318),e=a(96681),c=a(69024),l=a(24246);function i(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?i(Object(a),!0).forEach((function(s){(0,t.Z)(n,s,a[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(a,s))}))}return n}var k=function(){class n extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{visible:!1}),(0,t.Z)(this,"setVisible",(n=>{this.setState({visible:n})}))}render(){return(0,l.jsxs)("div",{children:[(0,l.jsx)(e.z,{type:"primary",onClick:()=>this.setVisible(!0),children:"Show Dialog"}),(0,l.jsx)(c.V,{className:"zent-dialog-demo-basic-dialog",visible:this.state.visible,onClose:()=>this.setVisible(!1),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{onClick:()=>this.setVisible(!1),children:"Close"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>this.setVisible(!1),children:"Ok"})]}),title:"prompt",children:(0,l.jsx)("p",{children:"content content content content content content content content content"})})]})}}return(0,l.jsx)(n,{})},r=function(){var n,s=c.V.openDialog,a=c.V.closeDialog,t="my_dialog";return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{type:"primary",onClick:()=>{s({dialogId:t,title:"Open the dialog through openDialog",children:(0,l.jsx)("div",{children:"Hello World"}),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{onClick:()=>a(t),children:"Close"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>a(t),children:"Ok"})]}),onClose(){}})},children:"Open"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>{n=s({title:"Open the dialog through openDialog",children:(0,l.jsx)("div",{children:"Hello World"}),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{onClick:()=>n(),children:"Close"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>n(),children:"Ok"})]}),onClose(){}})},children:"Open2"})]})},d=function(){var n=c.V.openDialog,s=p.createContext({shared:"This is from context"});class a extends p.Component{constructor(...a){super(...a),(0,t.Z)(this,"open",(()=>{n({parentComponent:this,title:"openDialog support context",children:(0,l.jsx)(s.Consumer,{children:({shared:n})=>(0,l.jsx)("span",{children:n})}),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{children:"Close"}),(0,l.jsx)(e.z,{type:"primary",children:"Ok"})]})})}))}render(){return(0,l.jsx)(e.z,{type:"primary",onClick:this.open,children:"Show"})}}return(0,l.jsx)(s.Provider,{value:{shared:"This is from context"},children:(0,l.jsx)(a,{})})},m=function(){class n extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{visible:!1}),(0,t.Z)(this,"setVisible",(n=>{this.setState({visible:n})}))}render(){return(0,l.jsxs)("div",{children:[(0,l.jsx)(e.z,{type:"primary",onClick:()=>this.setVisible(!0),children:"Show Dialog"}),(0,l.jsx)(c.V,{visible:this.state.visible,onClose:()=>this.setVisible(!1),children:(0,l.jsx)("p",{children:"content"})})]})}}return(0,l.jsx)(n,{})},g=function(){class n extends p.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{visible:!1}),(0,t.Z)(this,"setVisible",(n=>{this.setState({visible:n})}))}render(){return(0,l.jsxs)("div",{children:[(0,l.jsx)(e.z,{type:"primary",onClick:()=>this.setVisible(!0),children:"Show Dialog"}),(0,l.jsx)(c.V,{visible:this.state.visible,onClose:()=>this.setVisible(!1),closeBtn:!1,children:(0,l.jsx)("p",{children:"content"})})]})}}return(0,l.jsx)(n,{})};function h(n){return(0,l.jsx)(n.tag,u(u({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function f(n){return(0,l.jsx)(h,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function y(n){return(0,l.jsx)(h,{tag:"style",html:n.style})}function v(n,s){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(s+=n.offsetTop),v(n.parentNode,s);return s}class b extends p.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,p=s.children;return(0,l.jsxs)("div",{className:"zandoc-react-demo",children:[(0,l.jsx)("div",{className:"zandoc-react-demo__preview",children:p}),(0,l.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,l.jsx)("div",{className:"zandoc-react-demo__title",children:(0,l.jsx)("p",{children:a||""})}),(0,l.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,l.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,l.jsx)(h,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class w extends p.Component{componentDidMount(){var n=location.hash;if(n){var s=document.querySelector('a[href="'.concat(n,'"]'));s&&(0,o.l)(document.documentElement,0,v(s,-9))}}render(){return p.createElement("div",{className:"zandoc-react-container"},p.createElement(y,{style:".zent-dialog-demo-basic-dialog {\n\t\twidth: 500px;\n\t}"}),p.createElement(f,{html:'<h2 class="anchor-heading"><a href="#dialog">¶</a><a href="javascript:void(0)" id="dialog" class="anchor-point"></a>Dialog</h2>\n<p>Modal window with background mask; It is often used to carry the feedback of details and forms of small and medium-sized volumes that must be confirmed by users.</p>\n<h3 class="anchor-heading"><a href="#suggestion">¶</a><a href="javascript:void(0)" id="suggestion" class="anchor-point"></a>Suggestion</h3>\n<ul>\n<li>When you need to provide some key information or ask the user to make a decision, you can use the dialog window.</li>\n</ul>\n<h3 class="anchor-heading"><a href="#note">¶</a><a href="javascript:void(0)" id="note" class="anchor-point"></a>Note</h3>\n<ul>\n<li>Disallow the use of single buttons in modal dialogs.</li>\n<li>Disallow the use of more than two main action buttons in a modal dialog.</li>\n</ul>\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>\n<p>Imperative, call <code>openDialog</code> function.</p>\n</li>\n<li>\n<p>Component-based, show/hide the dialog through <code>visible</code> prop.</p>\n</li>\n</ul>'}),p.createElement(b,{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">Dialog</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">Example</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  state <span class="token operator">=</span> <span class="token punctuation">{</span> visible<span class="token operator">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n  <span class="token function-variable function">setVisible</span> <span class="token operator">=</span> <span class="token parameter">visible</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> visible <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>\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 punctuation">(</span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">></span></span>\n        <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n          <span class="token maybe-class-name">Show</span> <span class="token maybe-class-name">Dialog</span>\n        <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>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Dialog</span></span>\n          <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-dialog-demo-basic-dialog<span class="token punctuation">"</span></span>\n          <span class="token attr-name">visible</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">state</span><span class="token punctuation">.</span><span class="token property-access">visible</span><span class="token punctuation">}</span></span>\n          <span class="token attr-name">onClose</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n          <span class="token attr-name">footer</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span>\n            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span></span><span class="token punctuation">></span></span>\n              <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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n                <span class="token maybe-class-name">Close</span>\n              <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>\n              <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n                <span class="token maybe-class-name">Ok</span>\n              <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>\n            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span></span><span class="token punctuation">></span></span>\n          <span class="token punctuation">}</span></span>\n          <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>prompt<span class="token punctuation">"</span></span>\n        <span class="token punctuation">></span></span>\n          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>content content content content content content content content content<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Dialog</span></span><span class="token punctuation">></span></span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span>\n    <span class="token punctuation">)</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><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Example</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(k)),p.createElement(b,{title:"Set up with openDialog",id:"Demoopen",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Dialog</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">const</span> <span class="token punctuation">{</span> openDialog<span class="token punctuation">,</span> closeDialog <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token maybe-class-name">Dialog</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> id <span class="token operator">=</span> <span class="token string">\'my_dialog\'</span><span class="token punctuation">;</span>\n\n<span class="token comment">// 使用 `closeDialog` 关闭需要传入 `dialogId`</span>\n<span class="token keyword">const</span> <span class="token function-variable function">open</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 function">openDialog</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n    dialogId<span class="token operator">:</span> id<span class="token punctuation">,</span> <span class="token comment">// id is used to close the dialog</span>\n    title<span class="token operator">:</span> <span class="token string">\'Open the dialog through openDialog\'</span><span class="token punctuation">,</span>\n    children<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">></span></span><span class="token maybe-class-name">Hello</span> <span class="token maybe-class-name">World</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n    footer<span class="token operator">:</span> <span class="token punctuation">(</span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span></span><span class="token punctuation">></span></span>\n        <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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">closeDialog</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Close</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>\n        <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">closeDialog</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n          <span class="token maybe-class-name">Ok</span>\n        <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>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span></span><span class="token punctuation">></span></span>\n    <span class="token punctuation">)</span><span class="token punctuation">,</span>\n    <span class="token function">onClose</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n      <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">\'outer dialog closed\'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n    <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<span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n<span class="token comment">// 使用 `openDialog` 返回的 `close` 函数关闭</span>\n<span class="token keyword">let</span> close<span class="token punctuation">;</span>\n<span class="token keyword">const</span> <span class="token function-variable function">open2</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  close <span class="token operator">=</span> <span class="token function">openDialog</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n    title<span class="token operator">:</span> <span class="token string">\'Open the dialog through openDialog\'</span><span class="token punctuation">,</span>\n    children<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">></span></span><span class="token maybe-class-name">Hello</span> <span class="token maybe-class-name">World</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n    footer<span class="token operator">:</span> <span class="token punctuation">(</span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span></span><span class="token punctuation">></span></span>\n        <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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Close</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>\n        <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n          <span class="token maybe-class-name">Ok</span>\n        <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>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span></span><span class="token punctuation">></span></span>\n    <span class="token punctuation">)</span><span class="token punctuation">,</span>\n    <span class="token function">onClose</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n      <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">\'outer dialog closed\'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n    <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<span class="token punctuation">}</span><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><span class="token punctuation">></span></span>\n    <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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>open<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n      <span class="token maybe-class-name">Open</span>\n    <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>\n    <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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>open2<span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n      <span class="token maybe-class-name">Open2</span>\n    <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>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</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>'},p.createElement(r)),p.createElement(b,{title:"openDialog with context",id:"Democontext",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Dialog</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">const</span> <span class="token punctuation">{</span> openDialog <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token maybe-class-name">Dialog</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token maybe-class-name">DemoContext</span> <span class="token operator">=</span> <span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">createContext</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n  shared<span class="token operator">:</span> <span class="token string">\'This is from context\'</span><span class="token punctuation">,</span>\n<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Example</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">open</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 function">openDialog</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n      parentComponent<span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">,</span>\n      title<span class="token operator">:</span> <span class="token string">\'openDialog support context\'</span><span class="token punctuation">,</span>\n      children<span class="token operator">:</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">DemoContext.Consumer</span></span><span class="token punctuation">></span></span>\n          <span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> shared <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">></span></span><span class="token punctuation">{</span>shared<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">></span></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">DemoContext.Consumer</span></span><span class="token punctuation">></span></span>\n      <span class="token punctuation">)</span><span class="token punctuation">,</span>\n      footer<span class="token operator">:</span> <span class="token punctuation">(</span>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span></span><span class="token punctuation">></span></span>\n          <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 maybe-class-name">Close</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>\n          <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token maybe-class-name">Ok</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>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span></span><span class="token punctuation">></span></span>\n      <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  <span class="token punctuation">}</span><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 punctuation">(</span>\n      <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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">open</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n        <span class="token maybe-class-name">Show</span>\n      <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>\n    <span class="token punctuation">)</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">DemoContext.Provider</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> shared<span class="token operator">:</span> <span class="token string">\'This is from context\'</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Example</span></span> <span class="token punctuation">/></span></span>\n  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">DemoContext.Provider</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>'},p.createElement(d)),p.createElement(f,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\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</tr>\n</thead>\n<tbody>\n<tr>\n<td>title</td>\n<td>Dialog title</td>\n<td><code>ReactNode</code></td>\n<td><code>\'\'</code></td>\n</tr>\n<tr>\n<td>children</td>\n<td>Content of the dialog\n<code>|</code>\nReactNode\n<code>|</code>\nnull`</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>footer</td>\n<td>Content of the dialog footer</td>\n<td><code>ReactNode</code></td>\n<td><code>null</code></td>\n</tr>\n<tr>\n<td>visible</td>\n<td>Visibility of the dialog</td>\n<td><code>boolean</code></td>\n<td><code>false</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><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>Close callback</td>\n<td><code>(event) => void</code></td>\n<td><code>noop</code></td>\n</tr>\n<tr>\n<td>onClosed</td>\n<td>Callback when dialog closing animation is done</td>\n<td><code>() => void</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onOpened</td>\n<td>Callback when dialog opening animation is done</td>\n<td><code>() => void</code></td>\n<td></td>\n</tr>\n<tr>\n<td>mask</td>\n<td>Visibility of the mask</td>\n<td><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>maskClosable</td>\n<td>Click on the mask to close the dialog</td>\n<td><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>className</td>\n<td>Custom classname</td>\n<td><code>string</code></td>\n<td><code>\'\'</code></td>\n</tr>\n<tr>\n<td>style</td>\n<td>Custom style object</td>\n<td><code>CSSProperties</code></td>\n<td><code>{}</code></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#opendialog">¶</a><a href="javascript:void(0)" id="opendialog" class="anchor-point"></a>openDialog</h4>\n<p><code>openDialog(options: Partial&#x3C;IOpenDialogOption>): () => void</code></p>\n<p><strong><code>options</code> can contain all props above in addition to <code>visible</code> as well as the following parameters：</strong></p>\n<table class="table">\n<thead>\n<tr>\n<th>parameter</th>\n<th>description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>dialogId</td>\n<td>Optional, the id of dialog. The dialog can be closed throuth \n<code>closeDialog(dialogId)</code>\n.</td>\n<td>string</td>\n<td><code>\'random-id\'</code></td>\n</tr>\n<tr>\n<td>parentComponent</td>\n<td>Optional, the reference of dialog\'s parent, used to correlate the \n<code>context</code></td>\n<td>ReactInstance</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>A <code>ref</code> function passed to <code>openDialog</code> can provide a reference to the instance, <strong><code>ref</code> in string format is non-supported.</strong></p>\n<blockquote>\n<p>The return value of <code>openDialog</code> is a function which can close the dialog manually, and close the dialog with this function won\'t trigger <code>onClose</code>.</p>\n</blockquote>\n<h4 class="anchor-heading"><a href="#closedialog">¶</a><a href="javascript:void(0)" id="closedialog" class="anchor-point"></a>closeDialog</h4>\n<p><code>closeDialog(dialogId: string, options: object): void</code></p>\n<p>If <code>options.triggerOnClose</code> is <code>true</code>, <code>onClose</code> will be triggered when the dialog is closed.</p>\n<h4 class="anchor-heading"><a href="#specify-the-width-of-the-dialo">¶</a><a href="javascript:void(0)" id="specify-the-width-of-the-dialo" class="anchor-point"></a>Specify the width of the Dialog</h4>\n<p>Set a <code>style</code> prop on Dialog can specify its width, e.g. <code>style={{ width: \'600px\' }}</code>.</p>\n<p>By default the pop-up window width will adapt its content, meanwhile it has a minimum width and maximum width.</p>\n<h4 class="anchor-heading"><a href="#the-following-functions-is-obs">¶</a><a href="javascript:void(0)" id="the-following-functions-is-obs" class="anchor-point"></a>The following functions is obsolete in the new design system and is only used as a reference for the old version</h4>'}),p.createElement(b,{title:"No Header",id:"Demonoheader",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Dialog</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">Example</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  state <span class="token operator">=</span> <span class="token punctuation">{</span> visible<span class="token operator">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n  <span class="token function-variable function">setVisible</span> <span class="token operator">=</span> <span class="token parameter">visible</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> visible <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>\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 punctuation">(</span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">></span></span>\n        <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n          <span class="token maybe-class-name">Show</span> <span class="token maybe-class-name">Dialog</span>\n        <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>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Dialog</span></span>\n          <span class="token attr-name">visible</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">state</span><span class="token punctuation">.</span><span class="token property-access">visible</span><span class="token punctuation">}</span></span>\n          <span class="token attr-name">onClose</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n        <span class="token punctuation">></span></span>\n          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>content<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Dialog</span></span><span class="token punctuation">></span></span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span>\n    <span class="token punctuation">)</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><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Example</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(m)),p.createElement(b,{title:"Content Only",id:"Democontentonly",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Dialog</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">const</span> <span class="token constant">ID</span> <span class="token operator">=</span> <span class="token string">\'zent-demo-dialog-no-header\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Example</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  state <span class="token operator">=</span> <span class="token punctuation">{</span> visible<span class="token operator">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n  <span class="token function-variable function">setVisible</span> <span class="token operator">=</span> <span class="token parameter">visible</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> visible <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>\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 punctuation">(</span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span><span class="token punctuation">></span></span>\n        <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">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</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 punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>\n          <span class="token maybe-class-name">Show</span> <span class="token maybe-class-name">Dialog</span>\n        <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>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Dialog</span></span>\n          <span class="token attr-name">visible</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">state</span><span class="token punctuation">.</span><span class="token property-access">visible</span><span class="token punctuation">}</span></span>\n          <span class="token attr-name">onClose</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</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 keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setVisible</span><span class="token punctuation">(</span><span class="token boolean">false</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n          <span class="token attr-name">closeBtn</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token boolean">false</span><span class="token punctuation">}</span></span>\n        <span class="token punctuation">></span></span>\n          <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>content<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>\n        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span><span class="token class-name">Dialog</span></span><span class="token punctuation">></span></span>\n      <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span>\n    <span class="token punctuation">)</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><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span><span class="token class-name">Example</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},p.createElement(g)))}}},69024:(n,s,a)=>{"use strict";a.d(s,{V:()=>z,Z:()=>O});var t=a(93646),p=a(24246),o=a(27378),e=a(14623),c=a(53552),l=a(79352),i=a(60042),u=a.n(i),k=a(58801),r=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,p=a.top,o=s.x-t+"px "+(s.y-p)+"px 0",e=this.dialogEl.style;["Webkit","Moz","Ms","ms"].forEach((function(n){e[n+"TransformOrigin"]=o})),e.transformOrigin=o}},s.prototype.renderHeader=function(){var n=this.props.title;return n?(n="number"==typeof n||"string"==typeof n?(0,p.jsx)("span",(0,t.pi)({className:"zent-dialog-r-title-text","data-zv":"10.0.0-beta.1"},{children:n}),void 0):n,(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-header","data-zv":"10.0.0-beta.1"},{children:(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-title","data-zv":"10.0.0-beta.1"},{children:n}),void 0)}),void 0)):null},s.prototype.render=function(){var n=this,s=this.props,a=s.className,o=s.closeBtn,e=s.footer,c=s.style,l=s.children,i=this.renderHeader(),k=u()("zent-dialog-r-close",{"zent-dialog-r-has-title":!!i}),d=o&&(0,p.jsx)("button",(0,t.pi)({type:"button",className:k,onClick:this.onClickClose,"data-zv":"10.0.0-beta.1"},{children:(0,p.jsx)(r.Z,{type:"close"},void 0)}),void 0),m=e&&(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-footer","data-zv":"10.0.0-beta.1"},{children:e}),void 0);return(0,p.jsxs)("div",(0,t.pi)({className:u()("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":"10.0.0-beta.1"},{children:[d,i,(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body","data-zv":"10.0.0-beta.1"},{children:(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body-content","data-zv":"10.0.0-beta.1"},{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,k.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,p.jsxs)("div",(0,t.pi)({ref:this.rootRef,tabIndex:-1,className:"zent-dialog-r-root","data-zv":"10.0.0-beta.1"},{children:[a&&s&&(0,p.jsx)("div",{className:"zent-dialog-r-backdrop","data-zv":"10.0.0-beta.1"},void 0),(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-wrap",onClick:this.onMaskClick,"data-zv":"10.0.0-beta.1"},{children:o}),void 0)]}),void 0)},s}(o.Component),g=a(31542),h=a.t(g,2),f=a(70453),y=a(42690),v=a(14805),b=new Map,w=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,p=s.closeOptions.triggerOnClose;(void 0===p||p)&&a&&a(),g.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;b.delete(n)},s.prototype.render=function(){var n=this.props.options,s=this.state.visible;return(0,p.jsx)(O,(0,t.pi)({},n,{onClose:this.onClose,onClosed:this.onClosed,visible:s}),void 0)},s}(o.Component);function C(n,s){void 0===s&&(s={});var a=b.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,f.Z)("__zent-dialog__"):s,e=n.parentComponent;!function(n){if(b.has(n))throw new Error("Duplicate dialog id found: "+n)}(a);var c=(0,v.Z)("div"),i=e?g.unstable_renderSubtreeIntoContainer.bind(h,e):g.render,u=(0,o.createRef)();return i((0,p.jsx)(w,{ref:u,options:(0,t.pi)((0,t.pi)({},n),{dialogId:a}),container:c},void 0),c),function(n,s){b.set(n,s)}(a,u),function(n){void 0===n&&(n=!0),C(a,{triggerOnClose:!1!==n})}}var j=a(49744),D=null;l.Z&&(0,j.Oo)(document.documentElement,"click",(function(n){D={x:n.clientX,y:n.clientY}}),{capture:!0});var z=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),u=n.maskClosable,k=n.children,r=(0,t._T)(n,["visible","closeBtn","style","onOpened","onClosed","mask","maskClosable","children"]),g=this.state.exiting;return this.lastMousePosition=s?this.lastMousePosition||D:null,(0,p.jsx)(c.ZP,(0,t.pi)({visible:s||g,onClose:this.onClose,className:"zent-dialog-r-anchor",closeOnESC:a,blockPageScroll:!0},{children:(0,p.jsx)(m,(0,t.pi)({mask:i,maskClosable:u,visible:s,onClose:this.onClose},{children:(0,p.jsx)(e.Z,(0,t.pi)({appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:s,timeout:300,classNames:"zent-zoom",onEntered:l,onExited:this.onExited},{children:(0,p.jsx)(d,(0,t.pi)({},r,{style:o,closeBtn:a,mousePosition:this.lastMousePosition},{children:k}),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=C,s}(o.Component),O=z},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})}}]);