-
Notifications
You must be signed in to change notification settings - Fork 1
/
457-77002ebe145c42e3c71c.js
1 lines (1 loc) · 61.2 KB
/
457-77002ebe145c42e3c71c.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[457],{90457:(n,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>x});var t=a(73450),p=a(27378),o=a(57318),e=a(3454),c=a(97701),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 r=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:"显示"}),(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:"关闭"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>this.setVisible(!1),children:"确定"})]}),title:"提示",children:(0,l.jsx)("p",{children:"对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域。"})})]})}}return(0,l.jsx)(n,{})},k=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:"使用 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:"关闭"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>a(t),children:"确定"})]}),onClose(){}})},children:"打开"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>{n=s({title:"使用 openDialog 直接打开对话窗",children:(0,l.jsx)("div",{children:"Hello World"}),footer:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.z,{onClick:()=>n(),children:"关闭"}),(0,l.jsx)(e.z,{type:"primary",onClick:()=>n(),children:"确定"})]}),onClose(){}})},children:"打开2"})]})},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 支持 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:"关闭"}),(0,l.jsx)(e.z,{type:"primary",children:"确定"})]})})}))}render(){return(0,l.jsx)(e.z,{type:"primary",onClick:this.open,children:"显示"})}}return(0,l.jsx)(s.Provider,{value:{shared:"This is from context"},children:(0,l.jsx)(a,{})})},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:"显示"}),(0,l.jsx)(c.V,{visible:this.state.visible,onClose:()=>this.setVisible(!1),children:(0,l.jsx)("p",{children:"对话窗内容"})})]})}}return(0,l.jsx)(n,{})},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:"显示"}),(0,l.jsx)(c.V,{visible:this.state.visible,onClose:()=>this.setVisible(!1),closeBtn:!1,children:(0,l.jsx)("p",{children:"对话窗内容"})})]})}}return(0,l.jsx)(n,{})};function h(n){return(0,l.jsx)(n.tag,u(u({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function y(n){return(0,l.jsx)(h,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function v(n){return(0,l.jsx)(h,{tag:"style",html:n.style})}function f(n,s){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(s+=n.offsetTop),f(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 x 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,f(s,-9))}}render(){return p.createElement("div",{className:"zandoc-react-container"},p.createElement(v,{style:".zent-dialog-demo-basic-dialog {\n\t\twidth: 500px;\n\t}"}),p.createElement(y,{html:'<h2 class="anchor-heading"><a href="#dialog-dui-hua-chuang">¶</a><a href="javascript:void(0)" id="dialog-dui-hua-chuang" class="anchor-point"></a>Dialog 对话窗</h2>\n<p>带背景遮罩的模态窗;常用于承载中小体量的详情、表单,或者必须由用户确认的结果反馈。</p>\n<h3 class="anchor-heading"><a href="#jian-yi">¶</a><a href="javascript:void(0)" id="jian-yi" class="anchor-point"></a>建议</h3>\n<ul>\n<li>当需要提供一些关键信息,或要求用户做出决策时,可以使用对话窗;</li>\n</ul>\n<h3 class="anchor-heading"><a href="#zhu-yi">¶</a><a href="javascript:void(0)" id="zhu-yi" class="anchor-point"></a>注意</h3>\n<ul>\n<li>禁止在模态对话窗中使用单个按钮;</li>\n<li>禁止在模态对话窗中使用两个以上的主行动按钮。</li>\n</ul>\n<h3 class="anchor-heading"><a href="#shi-yong-zhi-nan">¶</a><a href="javascript:void(0)" id="shi-yong-zhi-nan" class="anchor-point"></a>使用指南</h3>\n<ul>\n<li>\n<p>命令式, 直接调用 <code>openDialog</code> 函数。</p>\n</li>\n<li>\n<p>组件式, 通过控制 <code>visible</code> 来显示/隐藏对话窗。</p>\n</li>\n<li>\n<p>推荐使用命令式, 不需要在外部维护一个 <code>visible</code> 属性, 更加方便。</p>\n</li>\n</ul>'}),p.createElement(b,{title:"基础用法",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> <span class="token literal-property property">visible</span><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"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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 显示\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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"><</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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 关闭\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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 确定\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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>提示<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"><</span>p</span><span class="token punctuation">></span></span>对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域对话窗内容区域。<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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"><</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(r)),p.createElement(b,{title:"使用 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 <span class="token literal-property property">dialogId</span><span class="token operator">:</span> id<span class="token punctuation">,</span> <span class="token comment">// id is used to close the dialog</span>\n <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token string">\'使用 openDialog 直接打开对话窗\'</span><span class="token punctuation">,</span>\n <span class="token literal-property property">children</span><span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</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"></</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token literal-property property">footer</span><span class="token operator">:</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><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"><</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 tag"><span class="token tag"><span class="token punctuation"></</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"><</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 确定\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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 <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token string">\'使用 openDialog 直接打开对话窗\'</span><span class="token punctuation">,</span>\n <span class="token literal-property property">children</span><span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</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"></</span>div</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token literal-property property">footer</span><span class="token operator">:</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><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"><</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 tag"><span class="token tag"><span class="token punctuation"></</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"><</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 确定\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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"><</span></span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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 打开\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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 number">2</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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(k)),p.createElement(b,{title:"openDialog 支持 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 <span class="token literal-property property">shared</span><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 <span class="token literal-property property">parentComponent</span><span class="token operator">:</span> <span class="token keyword">this</span><span class="token punctuation">,</span>\n <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token string">\'openDialog 支持 context\'</span><span class="token punctuation">,</span>\n <span class="token literal-property property">children</span><span class="token operator">:</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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"><</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"></</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"></</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 <span class="token literal-property property">footer</span><span class="token operator">:</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><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"><</span><span class="token class-name">Button</span></span><span class="token punctuation">></span></span>关闭<span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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 tag"><span class="token tag"><span class="token punctuation"></</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"></</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"><</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 显示\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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> <span class="token literal-property property">shared</span><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"><</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"></</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(y,{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>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>title</td>\n<td>自定义弹框标题</td>\n<td><code>ReactNode</code></td>\n<td><code>\'\'</code></td>\n</tr>\n<tr>\n<td>children</td>\n<td>弹框内容: \n<code><Dialog>xxxx</Dialog></code></td>\n<td><code>ReactNode</code></td>\n<td><code>null</code></td>\n</tr>\n<tr>\n<td>footer</td>\n<td>底部内容</td>\n<td><code>ReactNode</code></td>\n<td><code>null</code></td>\n</tr>\n<tr>\n<td>visible</td>\n<td>是否打开对话窗</td>\n<td><code>boolean</code></td>\n<td><code>false</code></td>\n</tr>\n<tr>\n<td>closeBtn</td>\n<td>是否显示右上角关闭按钮</td>\n<td><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>关闭操作回调函数</td>\n<td><code>(event) => void</code></td>\n<td><code>noop</code></td>\n</tr>\n<tr>\n<td>onOpened</td>\n<td>对话窗打开动画结束后的回调函数</td>\n<td><code>() => void</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onClosed</td>\n<td>对话窗关闭动画结束后的回调函数</td>\n<td><code>() => void</code></td>\n<td></td>\n</tr>\n<tr>\n<td>mask</td>\n<td>是否显示遮罩</td>\n<td><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>maskClosable</td>\n<td>点击遮罩是否可以关闭</td>\n<td><code>boolean</code></td>\n<td><code>true</code></td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td><code>string</code></td>\n<td><code>\'\'</code></td>\n</tr>\n<tr>\n<td>style</td>\n<td>自定义样式</td>\n<td><code>CSSProperties</code></td>\n<td><code>{}</code></td>\n</tr>\n<tr>\n<td>position</td>\n<td>对话窗打开位置</td>\n<td><code>IDialogPositionType</code></td>\n<td><code>auto</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<IOpenDialogOption>): () => void</code></p>\n<p><strong><code>options</code> 参数支持组件除 <code>visible</code> 以外的所有属性,外加以下参数:</strong></p>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>dialogId</td>\n<td>可选,对话窗的 ID,可以通过 \n<code>closeDialog(dialogId)</code>\n 来关闭对话窗</td>\n<td>string</td>\n<td>随机生成的唯一 ID</td>\n</tr>\n<tr>\n<td>parentComponent</td>\n<td>可选,父组件的引用, 用于关联 context</td>\n<td>ReactInstance</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>如果需要组件实例的引用, 可以传一个函数形式的 <code>ref</code> 给 <code>openDialog</code>, <strong>不支持字符串形式的 <code>ref</code>.</strong></p>\n<blockquote>\n<p><code>openDialog</code> 的返回值是一个手动关闭 Dialog 的函数, <code>close(false)</code> 将不会触发 Dialog 的 <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><code>dialogId</code> 对应调用 <code>openDialog</code> 时传的参数。</p>\n<p><code>options.triggerOnClose</code> 如果是 <code>true</code>,关闭时会触发 <code>onClose</code> 回调,<code>false</code> 时不会触发。</p>\n<h4 class="anchor-heading"><a href="#zhi-ding-dialog-kuan-du">¶</a><a href="javascript:void(0)" id="zhi-ding-dialog-kuan-du" class="anchor-point"></a>指定 Dialog 宽度</h4>\n<p>在 <code>style</code> 中可以指定弹出窗口的宽度, e.g. <code>style={{ width: \'600px\' }}</code>.</p>\n<p>默认情况下弹出窗口会自适应内容的宽度, 同时有最小宽度和最大宽度.</p>\n<h4 class="anchor-heading"><a href="#position-api">¶</a><a href="javascript:void(0)" id="position-api" class="anchor-point"></a>Position API</h4>\n<p><code>position</code> 属性用于指定对话窗打开位置</p>\n<table class="table">\n<thead>\n<tr>\n<th>支持的值</th>\n<th>描述</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>auto</code></td>\n<td>自动选择打开位置, 默认值</td>\n</tr>\n<tr>\n<td><code>center</code></td>\n<td>从屏幕中心位置打开</td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#yi-xia-gong-neng-xin-ban-she-ji-yu-yan-yi-fei-qi-jin-zuo-wei-lao-ban-shi-yong-de-can-kao">¶</a><a href="javascript:void(0)" id="yi-xia-gong-neng-xin-ban-she-ji-yu-yan-yi-fei-qi-jin-zuo-wei-lao-ban-shi-yong-de-can-kao" class="anchor-point"></a>以下功能新版设计语言已废弃,仅作为老版使用的参考</h4>'}),p.createElement(b,{title:"无头部",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> <span class="token literal-property property">visible</span><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"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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 显示\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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"><</span>p</span><span class="token punctuation">></span></span>对话窗内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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"><</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)),p.createElement(b,{title:"仅内容",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> <span class="token literal-property property">visible</span><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"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</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 显示\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"><</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"><</span>p</span><span class="token punctuation">></span></span>对话窗内容<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</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"></</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"><</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)))}}},97701:(n,s,a)=>{"use strict";a.d(s,{V:()=>z,Z:()=>O});var t=a(59312),p=a(24246),o=a(27378),e=a(14623),c=a(53552),l=a(79352),i=a(60042),u=a.n(i),r=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.setTransformOrigin=function(n,s){["Webkit","Moz","Ms","ms"].forEach((function(a){n[a+"TransformOrigin"]=s})),n.transformOrigin=s},s.prototype.resetTransformOrigin=function(n){void 0===n&&(n=this.props);var s=n.mousePosition,a=function(n,s){switch(n){case"center":return"center center 0";case"auto":default:return}}(n.position,this.dialogEl);if(void 0===a&&s&&s.x>=0&&s.y>=0&&this.dialogEl&&this.dialogEl.getBoundingClientRect){var t=this.dialogEl.getBoundingClientRect(),p=t.left,o=t.top;a=s.x-p+"px "+(s.y-o)+"px 0"}a&&this.dialogEl&&this.setTransformOrigin(this.dialogEl.style,a)},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.10"},{children:n}),void 0):n,(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-header","data-zv":"10.0.10"},{children:(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-title","data-zv":"10.0.10"},{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(),r=u()("zent-dialog-r-close",{"zent-dialog-r-has-title":!!i}),d=o&&(0,p.jsx)("button",(0,t.pi)({type:"button",className:r,onClick:this.onClickClose,"data-zv":"10.0.10"},{children:(0,p.jsx)(k.Z,{type:"close"},void 0)}),void 0),g=e&&(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-footer","data-zv":"10.0.10"},{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":!!g,"zent-dialog-r--no-close-btn":!d}),style:c,ref:function(s){return n.dialogEl=s},"data-zv":"10.0.10"},{children:[d,i,(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body","data-zv":"10.0.10"},{children:(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-body-content","data-zv":"10.0.10"},{children:l}),void 0)}),void 0),g]}),void 0)},s}(o.Component),g=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,r.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.10"},{children:[a&&s&&(0,p.jsx)("div",{className:"zent-dialog-r-backdrop","data-zv":"10.0.10"},void 0),(0,p.jsx)("div",(0,t.pi)({className:"zent-dialog-r-wrap",onClick:this.onMaskClick,"data-zv":"10.0.10"},{children:o}),void 0)]}),void 0)},s}(o.Component),m=a(31542),h=a.t(m,2),y=a(70453),v=a(42690),f=a(14805),b=new Map,x=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(),m.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 j(n){if(void 0===n&&(n={}),!l.Z)return v.Z;var s=n.dialogId,a=void 0===s?(0,y.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,f.Z)("div"),i=e?m.unstable_renderSubtreeIntoContainer.bind(h,e):m.render,u=(0,o.createRef)();return i((0,p.jsx)(x,{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 w=a(49744),D=null;l.Z&&(0,w.Oo)(document.documentElement,"click",(function(n){0!==n.clientX&&0!==n.clientY&&(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.position,i=n.onOpened,u=(n.onClosed,n.mask),r=n.maskClosable,k=n.children,m=(0,t._T)(n,["visible","closeBtn","style","position","onOpened","onClosed","mask","maskClosable","children"]),h=this.state.exiting;return this.lastMousePosition=s?this.lastMousePosition||D:null,(0,p.jsx)(c.ZP,(0,t.pi)({visible:s||h,onClose:this.onClose,className:"zent-dialog-r-anchor",closeOnESC:a,blockPageScroll:!0},{children:(0,p.jsx)(g,(0,t.pi)({mask:u,maskClosable:r,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:i,onExited:this.onExited},{children:(0,p.jsx)(d,(0,t.pi)({},m,{style:o,closeBtn:a,position:l,mousePosition:this.lastMousePosition},{children:k}),void 0)}),void 0)}),void 0)}),void 0)},s.defaultProps={onClose:function(){},visible:!1,className:"",style:{},position:"auto",title:"",closeBtn:!0,mask:!0,maskClosable:!0,footer:null},s.openDialog=j,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})}}]);