-
Notifications
You must be signed in to change notification settings - Fork 0
/
102-9c128e7e1f8e9241073d.js
1 lines (1 loc) · 53 KB
/
102-9c128e7e1f8e9241073d.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[102],{962:function(n,a,s){"use strict";s.r(a),s.d(a,"default",(function(){return z}));var t=s(846),e=s.n(t),o=s(840),p=s.n(o),c=s(841),l=s.n(c),i=s(521),u=s.n(i),r=s(842),k=s.n(r),d=s(843),m=s.n(d),g=s(844),h=s.n(g),v=s(845),y=s.n(v),f=s(0),b=s.n(f),w=s(210),P=s(145);function C(n){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(n){return!1}}();return function(){var s,t=h()(n);if(a){var e=h()(this).constructor;s=Reflect.construct(t,arguments,e)}else s=t.apply(this,arguments);return m()(this,s)}}var B=function(){return b.a.createElement(P.Popover,{className:"zent-doc-popover",position:P.Popover.Position.BottomLeft,display:"inline",cushion:5},b.a.createElement(P.Popover.Trigger.Click,null,b.a.createElement(P.Button,{type:"primary"},"Click to Open")),b.a.createElement(P.Popover.Content,null,b.a.createElement("div",null,"Popover content"),b.a.createElement("div",null,"You can add anything here")))},N=function(){var n=function(n){k()(s,n);var a=C(s);function s(){var n;p()(this,s);for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return n=a.call.apply(a,[this].concat(e)),y()(u()(n),"state",{visible:!1}),n}return l()(s,[{key:"render",value:function(){var n=this;return b.a.createElement("div",{className:"zent-doc-popover-container"},b.a.createElement(P.Popover,{className:"zent-doc-popover",visible:this.state.visible,onVisibleChange:function(a){return n.setState({visible:a})},position:P.Popover.Position.BottomLeft,display:"inline",cushion:5},b.a.createElement(P.Popover.Trigger.Base,null,b.a.createElement(P.Button,{type:"primary",onClick:function(){return n.setState({visible:!0})}},"Click to Open")),b.a.createElement(P.Popover.Content,null,b.a.createElement("div",null,"Popover content"),b.a.createElement("div",null,"You can add anything here"))),b.a.createElement(P.Button,{onClick:function(){return n.setState({visible:!1})}},"Close"))}}]),s}(f.Component);return b.a.createElement(n,null)},E=function(){var n=function(n){k()(s,n);var a=C(s);function s(){var n;p()(this,s);for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return n=a.call.apply(a,[this].concat(e)),y()(u()(n),"state",{visible:!0}),y()(u()(n),"onVisibleChange",(function(a){n.setState({visible:a})})),n}return l()(s,[{key:"render",value:function(){return b.a.createElement(P.Popover,{className:"zent-doc-popover",position:P.Popover.Position.BottomLeft,display:"inline",cushion:5},b.a.createElement(P.Popover.Trigger.Click,null,b.a.createElement(P.Button,{type:"primary"},"Click to Open")),b.a.createElement(P.Popover.Content,null,b.a.createElement("div",null,"Popover content"),b.a.createElement(P.Popover,{className:"zent-doc-popover",position:P.Popover.Position.BottomLeft,display:"inline",cushion:5,visible:this.state.visible,onVisibleChange:this.onVisibleChange},b.a.createElement(P.Popover.Trigger.Click,null,b.a.createElement(P.Button,{type:"primary"},"Click to Open")),b.a.createElement(P.Popover.Content,null,b.a.createElement("div",null,"Nested popover content")))))}}]),s}(b.a.Component);return b.a.createElement(n,null)};function T(n){return b.a.createElement(n.tag,e()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function x(n){return b.a.createElement(T,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function j(n){return b.a.createElement(T,{tag:"style",html:n.style})}var D=function(n){k()(s,n);var a=C(s);function s(){var n;p()(this,s);for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return n=a.call.apply(a,[this].concat(e)),y()(u()(n),"state",{showCode:!1}),y()(u()(n),"toggle",(function(){n.setState({showCode:!n.state.showCode})})),n}return l()(s,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return b.a.createElement("div",{className:"zandoc-react-demo"},b.a.createElement("div",{className:"zandoc-react-demo__preview"},e),b.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},b.a.createElement("div",{className:"zandoc-react-demo__title"},b.a.createElement("p",null,s||"")),b.a.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&b.a.createElement("pre",{className:"zandoc-react-demo__code"},b.a.createElement(T,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),s}(f.Component),z=function(n){k()(s,n);var a=C(s);function s(){return p()(this,s),a.apply(this,arguments)}return l()(s,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(w.a)(document.documentElement,0,function n(a,s){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(s+=a.offsetTop),n(a.parentNode,s);return s}(a,-9))}}},{key:"render",value:function(){return b.a.createElement("div",{className:"zandoc-react-container",key:null},b.a.createElement(j,{style:".zent-doc-popover {\n\tborder: 1px solid #e5e5e5;\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tbackground: #fff;\n\tfont-size: 14px;\n}\n\n.zent-doc-popover-container .zent-popover-wrapper {\n\t\tmargin-right: 10px;\n\t}"}),b.a.createElement(x,{html:'<h2 class="anchor-heading"><a href="#popover">¶</a><a href="javascript:void(0)" id="popover" class="anchor-point"></a>Popover</h2>\n<p>Common trigger pop widget, you can customize postion、trigger method、display style.</p>\n<p>The widget supports nested pop</p>\n<p><strong>The widget do not support style, if you need bubble-like tips component, please use <code>Pop</code>.</strong></p>\n<h3 class="anchor-heading"><a href="#guides">¶</a><a href="javascript:void(0)" id="guides" class="anchor-point"></a>Guides</h3>\n<ul>\n<li>If <code>Pop</code> widget do not meet your needs, you can achieve custom trigger pop by using <code>Popover</code></li>\n<li>Can be used as <code>Dropdown</code></li>\n</ul>\n<h3 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h3>'}),b.a.createElement(D,{title:"Basic usage",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</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 class="token class-name">Popover</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-doc-popover<span class="token punctuation">"</span></span>\n <span class="token attr-name">position</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">BottomLeft</span></span><span class="token punctuation">}</span></span>\n <span class="token attr-name">display</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>inline<span class="token punctuation">"</span></span>\n <span class="token attr-name">cushion</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">5</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">Popover.Trigger.Click</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 maybe-class-name">Click</span> to <span class="token maybe-class-name">Open</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">Popover.Trigger.Click</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">Popover.Content</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><span class="token maybe-class-name">Popover</span> content<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>div</span><span class="token punctuation">></span></span><span class="token maybe-class-name">You</span> can add anything here<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">Popover.Content</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">Popover</span></span><span class="token punctuation">></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},b.a.createElement(B)),b.a.createElement(D,{title:"Controlled open/close",id:"Democontrolled",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</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">PopoverDemo</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n visible<span class="token operator">:</span> <span class="token boolean">false</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">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 attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-doc-popover-container<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">Popover</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-doc-popover<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">onVisibleChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token parameter">v</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">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> visible<span class="token operator">:</span> v <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">position</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">BottomLeft</span></span><span class="token punctuation">}</span></span>\n <span class="token attr-name">display</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>inline<span class="token punctuation">"</span></span>\n <span class="token attr-name">cushion</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">5</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">Popover.Trigger.Base</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">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> visible<span class="token operator">:</span> <span class="token boolean">true</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">Click</span> to <span class="token maybe-class-name">Open</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">Popover.Trigger.Base</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">Popover.Content</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><span class="token maybe-class-name">Popover</span> content<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>div</span><span class="token punctuation">></span></span><span class="token maybe-class-name">You</span> can add anything here<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">Popover.Content</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">Popover</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 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">setState</span><span class="token punctuation">(</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><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"></</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>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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">PopoverDemo</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},b.a.createElement(N)),b.a.createElement(D,{title:"Nested",id:"Demonested",src:'<span class="token keyword module">import</span> <span class="token punctuation">{</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Button</span> <span class="token punctuation">}</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">Demo</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>\n visible<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onVisibleChange</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>\n visible<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">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">Popover</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-doc-popover<span class="token punctuation">"</span></span>\n <span class="token attr-name">position</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">BottomLeft</span></span><span class="token punctuation">}</span></span>\n <span class="token attr-name">display</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>inline<span class="token punctuation">"</span></span>\n <span class="token attr-name">cushion</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">5</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><span class="token class-name">Popover.Trigger.Click</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 maybe-class-name">Click</span> to <span class="token maybe-class-name">Open</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">Popover.Trigger.Click</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">Popover.Content</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><span class="token maybe-class-name">Popover</span> content<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">Popover</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-doc-popover<span class="token punctuation">"</span></span>\n <span class="token attr-name">position</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">BottomLeft</span></span><span class="token punctuation">}</span></span>\n <span class="token attr-name">display</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>inline<span class="token punctuation">"</span></span>\n <span class="token attr-name">cushion</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">5</span><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">onVisibleChange</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">onVisibleChange</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><span class="token class-name">Popover.Trigger.Click</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 maybe-class-name">Click</span> to <span class="token maybe-class-name">Open</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">Popover.Trigger.Click</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">Popover.Content</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><span class="token maybe-class-name">Nested</span> popover content<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">Popover.Content</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">Popover</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">Popover.Content</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">Popover</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><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Demo</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},b.a.createElement(E)),b.a.createElement(x,{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>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Alternative</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>position</td>\n<td>position way, refer to \n<code>Popover.Positon</code></td>\n<td>Positon</td>\n<td></td>\n<td></td>\n<td>Yes</td>\n</tr>\n<tr>\n<td>cushion</td>\n<td>position offset, generally it reserves a space for some icon like arrow</td>\n<td>number</td>\n<td><code>0</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>display</td>\n<td>the display property specifies the type of box used for an HTML element.</td>\n<td>string</td>\n<td><code>\'block\'</code></td>\n<td>all legal \n<code>display</code>\n value in CSS</td>\n<td>No</td>\n</tr>\n<tr>\n<td>onShow</td>\n<td>the callback after pop shows</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onClose</td>\n<td>the callback after pop closes</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onBeforeShow</td>\n<td>the callback before pop opens, only triggered by user\'s operation, setting \n<code>visible</code>\n outside will not call</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onBeforeClose</td>\n<td>the callback after pop closes, only triggered by user\'s operation, setting \n<code>visible</code>\n outside will not call</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n<td></td>\n</tr>\n<tr>\n<td>containerSelector</td>\n<td>pop\'s parent node CSS selector</td>\n<td>string</td>\n<td><code>\'body\'</code></td>\n<td>all legal CSS selector</td>\n<td>No</td>\n</tr>\n<tr>\n<td>visible</td>\n<td>manual control pop\'s show or hide, must be used with \n<code>onVisibleChange</code></td>\n<td>bool</td>\n<td></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onVisibleChange</td>\n<td>the callback when manual control, must be used with \n<code>visible</code>\n, only triggered by user\'s open/close operation</td>\n<td>func</td>\n<td></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onPositionUpdated</td>\n<td>callback after position updates, a position update does not imply a position change</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>onPositionReady</td>\n<td>callback after content enters viewport, only called once within the life cycle</td>\n<td>func</td>\n<td><code>noop</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>className</td>\n<td>custom extra class name</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>wrapperClassName</td>\n<td>trigger outerline div classname</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>width</td>\n<td>width</td>\n<td>string or number</td>\n<td></td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>custom prefix</td>\n<td>string</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n<td>No</td>\n</tr>\n</tbody>\n</table>\n<p><code>onBeforeShow</code> and <code>onBeforeClose</code> will return a <code>Promise</code>,<code>Popover</code> will open/close after <code>Promise</code> resolve,if <code>Promise</code> reject, open/close opreation will stop.</p>\n<p>If you do not use <code>Promise</code>, <code>onBeforeShow</code> and <code>onBeforeClose</code> also supports two arguments <code>callback</code> and <code>escapse</code>, you have to manual call <code>callback</code> to open/close in <code>onBeforeShow</code> and <code>onBeforeClose</code>. manual call <code>escape</code> to stop open/close opreation.</p>\n<p><code>onBeforeShow(callback: ?function, escape: ?escape): ?Promise</code></p>\n<p>Every kinds of trigger has it\'s own API to control component behavior, custom trigger can specifies it\'s parameter.</p>\n<h4 class="anchor-heading"><a href="#trigger-click">¶</a><a href="javascript:void(0)" id="trigger-click" class="anchor-point"></a>Trigger.Click</h4>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>autoClose</td>\n<td>whether to auto close pop when click \n<code>outside</code></td>\n<td>bool</td>\n<td><code>true</code></td>\n<td>No</td>\n</tr>\n<tr>\n<td>isOutside</td>\n<td>to determine a node is \n<code>outside</code>\n or not, click outside to close pop. default trigger and the node outside pop is \n<code>outside</code></td>\n<td>func: (node, data) => bool</td>\n<td><code>() => false</code></td>\n<td>No</td>\n</tr>\n</tbody>\n</table>\n<p>The <code>data</code> in isOutside includes two attributes :<code>contentNode</code> and <code>triggerNode</code>。</p>\n<h4 class="anchor-heading"><a href="#trigger-hover">¶</a><a href="javascript:void(0)" id="trigger-hover" class="anchor-point"></a>Trigger.Hover</h4>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>showDelay</td>\n<td>the duration before layer open (in milliseconds), during this time, if you move mouse out of layer, pop will not open</td>\n<td>number</td>\n<td><code>150</code></td>\n<td>No</td>\n</tr>\n<tr>\n<td>hideDelay</td>\n<td>the duration before layer close (in milliseconds), during this time, if you move mouse out of layer, pop will not close</td>\n<td>number</td>\n<td><code>150</code></td>\n<td>No</td>\n</tr>\n<tr>\n<td>isOutside</td>\n<td>to determine a node is \n<code>outside</code>\n or not. default trigger and the node outside pop is \n<code>outside</code></td>\n<td>func: (node, data) => bool</td>\n<td></td>\n<td>No</td>\n</tr>\n<tr>\n<td>quirk</td>\n<td>quirk mode,in this mode, mouse is not required to move out trigger and layer when close triggers</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td>No</td>\n</tr>\n</tbody>\n</table>\n<p>The <code>data</code> in isOutside includes two attributes:<code>contentNode</code> 和 <code>triggerNode</code>。</p>\n<h4 class="anchor-heading"><a href="#trigger-focus">¶</a><a href="javascript:void(0)" id="trigger-focus" class="anchor-point"></a>Trigger.Focus</h4>\n<p>Display when it gets focus, close when it loses focus, no params</p>\n<h4 class="anchor-heading"><a href="#trigger-base">¶</a><a href="javascript:void(0)" id="trigger-base" class="anchor-point"></a>Trigger.Base</h4>\n<p>All trigger\'s base class, implement custom trigger need to inherit this class, you have rewrite <code>getTriggerProps</code> method to add trigger event. and you can control pop\'s open/close in event handle function.</p>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>getTriggerNode</td>\n<td>Get trigger\'s DOM node</td>\n<td>func: () => node</td>\n</tr>\n<tr>\n<td>getContentNode</td>\n<td>Get pop\'s DOM node</td>\n<td>func: () => node</td>\n</tr>\n<tr>\n<td>open</td>\n<td>Open pop</td>\n<td>func</td>\n</tr>\n<tr>\n<td>close</td>\n<td>Close pop</td>\n<td>func</td>\n</tr>\n<tr>\n<td>contentVisible</td>\n<td>Is popover content visible</td>\n<td>bool</td>\n</tr>\n<tr>\n<td>onTriggerRefChange</td>\n<td>Callback when ref changes. It is only needed when you rewrite render function</td>\n<td>func:(instance)</td>\n</tr>\n<tr>\n<td>getNodeForTriggerRefChange</td>\n<td>Callback to get the actual trigger DOM node when ref changes</td>\n<td>(HTMLElement) => HTMLELement</td>\n</tr>\n</tbody>\n</table>\n<h3 class="anchor-heading"><a href="#position-api">¶</a><a href="javascript:void(0)" id="position-api" class="anchor-point"></a>Position API</h3>\n<p>Position is used to position layer. there are 12 kinds of basic positions. You can add custom position algorithms. The <code>cushion</code> on Popover affect position. It usually acts as an offset.</p>\n<pre><code class="language-text"><span class="token comment">// Basic positions</span>\n\n <span class="token maybe-class-name">TopLeft</span> <span class="token maybe-class-name">TopCenter</span> <span class="token maybe-class-name">TopRight</span>\n\n<span class="token maybe-class-name">LeftTop</span> <span class="token maybe-class-name">RightTop</span>\n\n\n<span class="token maybe-class-name">LeftCenter</span> <span class="token maybe-class-name">RightCenter</span>\n\n\n<span class="token maybe-class-name">LeftBottom</span> <span class="token maybe-class-name">RightBottom</span>\n\n <span class="token maybe-class-name">BottomLeft</span> <span class="token maybe-class-name">BottomCenter</span> <span class="token maybe-class-name">BottomRight</span></code></pre>\n<p>Except for 12 kinds of basic position algorithm, there is 6 position algorithm to automatically determine appropriate position according to the left space in screen: <code>AutoBottomLeft</code>,<code>AutoBottomCenter</code>, <code>AutoBottomRight</code>, <code>AutoTopLeft</code>, <code>AutoTopCenter</code> and <code>AutoTopRight</code>. those algorithm is used for dropdown widget。</p>\n<p>Every object in position algorithm has a <code>locate</code> function which can be used to implement a combination of positioning algorithms.</p>\n<pre><code class="language-jsx"><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token method function property-access">create</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">anchorBoundingBox<span class="token punctuation">,</span> containerBoundingBox<span class="token punctuation">,</span> contentDimension<span class="token punctuation">,</span> options</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>someCondition<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">BottomLeft</span></span><span class="token punctuation">.</span><span class="token method function property-access">locate</span><span class="token punctuation">(</span>anchorBoundingBox<span class="token punctuation">,</span> containerBoundingBox<span class="token punctuation">,</span> contentDimension<span class="token punctuation">,</span> options<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token keyword">return</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">TopRight</span></span><span class="token punctuation">.</span><span class="token method function property-access">locate</span><span class="token punctuation">(</span>anchorBoundingBox<span class="token punctuation">,</span> containerBoundingBox<span class="token punctuation">,</span> contentDimension<span class="token punctuation">,</span> options<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></code></pre>\n<h4 class="anchor-heading"><a href="#position-create">¶</a><a href="javascript:void(0)" id="position-create" class="anchor-point"></a>Position.create</h4>\n<p>The factory function, receiving a function as parameter, is used to customize position</p>\n<pre><code class="language-jsx"><span class="token comment">// a bounding box is an object with these fields: {top, left, right, bottom, width, height}</span>\n<span class="token keyword">const</span> position <span class="token operator">=</span> <span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token method function property-access">create</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">anchorBoundingBox<span class="token punctuation">,</span> containerBoundingBox<span class="token punctuation">,</span> contentDimension<span class="token punctuation">,</span> options</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">{</span>\n <span class="token function">getCSSStyle</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">{</span>\n position<span class="token operator">:</span> <span class="token string">\'fixed\'</span><span class="token punctuation">,</span>\n left<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>\n top<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>\n opacity<span class="token operator">:</span> <span class="token number">0</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span>\n\n name<span class="token operator">:</span> <span class="token string">\'position-example\'</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></code></pre>\n<p>Anchor means trigger,container is nearst layer\'s parent node which have it\'s own position.</p>\n<p><code>anchorBoundingBox</code> and <code>containerBoundingBox</code> is relative to container\'s upper-left corner.</p>\n<p><code>contentDimension</code> is layer\'s width and height.</p>\n<p><code>options</code> contains another useful arguments:</p>\n<ul>\n<li><code>options.cushion</code> position offset passed by Props</li>\n<li><code>options.anchor</code> anchor\'s DOM node</li>\n<li><code>options.container</code> container\'s DOM node</li>\n<li><code>options.anchorBoundingBoxViewport</code> anchor is a coordinate relative to viewport</li>\n<li><code>options.containerBoundingBoxViewport</code> container is a coordinate relative to viewport</li>\n</ul>\n<h4 class="anchor-heading"><a href="#withpopover-high-level-compone">¶</a><a href="javascript:void(0)" id="withpopover-high-level-compone" class="anchor-point"></a>withPopover high-level component</h4>\n<p>The high-level component provides some important functions. it can be used to manually close pop in <code>Content</code></p>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>getTriggerNode</td>\n<td>get trigger\'s DOM node</td>\n<td>func: () => node</td>\n</tr>\n<tr>\n<td>getContentNode</td>\n<td>get layer\'s DOM node</td>\n<td>func: () => node</td>\n</tr>\n<tr>\n<td>open</td>\n<td>open layer</td>\n<td>func</td>\n</tr>\n<tr>\n<td>close</td>\n<td>close layer</td>\n<td>func</td>\n</tr>\n</tbody>\n</table>\n<p>Example:</p>\n<pre><code class="language-jsx"><span class="token comment">// click close button to close layer</span>\n<span class="token keyword">const</span> <span class="token maybe-class-name">HoverContent</span> <span class="token operator">=</span> <span class="token function">withPopover</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token function"><span class="token maybe-class-name">HoverContent</span></span><span class="token punctuation">(</span><span class="token parameter"><span class="token punctuation">{</span> popover <span class="token punctuation">}</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">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>div</span><span class="token punctuation">></span></span>popover content<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>button</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>popover<span class="token punctuation">.</span><span class="token property-access">close</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>close<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>button</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><span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Popover</span></span> <span class="token attr-name">position</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token maybe-class-name">Popover</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Position</span></span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">RightTop</span></span><span class="token punctuation">}</span></span> <span class="token attr-name">display</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>inline<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">Popover.Trigger.Hover</span></span> <span class="token attr-name">showDelay</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">500</span><span class="token punctuation">}</span></span> <span class="token attr-name">hideDelay</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">200</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>button</span> <span class="token attr-name">style</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> marginLeft<span class="token operator">:</span> <span class="token number">100</span> <span class="token punctuation">}</span><span class="token punctuation">}</span></span><span class="token punctuation">></span></span>hover on me<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>button</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">Popover.Trigger.Hover</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">PopoverContent</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">HoverContent</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">PopoverContent</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">Popover</span></span><span class="token punctuation">></span></span></code></pre>\n<h4 class="anchor-heading"><a href="#adjustposition">¶</a><a href="javascript:void(0)" id="adjustposition" class="anchor-point"></a><code>adjustPosition</code></h4>\n<p>You can use this method to update <code>Popover</code> position.</p>\n<p>You rarely need it. <code>Popover</code> will update its position automatically on window scroll and resize.</p>'}))}}]),s}(f.Component)}}]);