-
Notifications
You must be signed in to change notification settings - Fork 0
/
18-a28f22da2d828c0b81f9.js
1 lines (1 loc) · 71 KB
/
18-a28f22da2d828c0b81f9.js
1
webpackJsonp([18],{1608:function(n,a,s){"use strict";function t(n){return n&&n.__esModule?n:{default:n}}function p(n){return T.default.createElement(n.tag,(0,l.default)({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function e(n){return T.default.createElement(p,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function o(n){return T.default.createElement(p,{tag:"style",html:n.style})}function c(n,a){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(a+=n.offsetTop),c(n.parentNode,a);return a}Object.defineProperty(a,"__esModule",{value:!0});var u=s(7),l=t(u),k=s(1),i=t(k),r=s(4),d=t(r),g=s(2),b=t(g),f=s(3),h=t(f),m=s(0),T=t(m),y=s(232),v=t(y),w=s(359),E=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return a=t=(0,b.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(o))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,b.default)(t,p)}return(0,h.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return T.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange},T.default.createElement(n,{tab:T.default.createElement("span",null,"Tab One"),id:"1",disabled:!0},T.default.createElement("div",null,"The content of tab one.")),T.default.createElement(n,{tab:"Tab Two",id:"2"},T.default.createElement("div",null,"The content of tab two.")),T.default.createElement(n,{tab:"Tab Three",id:"3"},T.default.createElement("div",null,"The content of tab three.")))}}]),s}(T.default.Component);return T.default.createElement(a,null)},P=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return a=t=(0,b.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(o))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,b.default)(t,p)}return(0,h.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return T.default.createElement(w.Tabs,{type:"slider",activeId:this.state.activeId,onChange:this.onTabChange},T.default.createElement(n,{tab:T.default.createElement("span",null,"Tab One"),id:"1",disabled:!0},T.default.createElement("div",null,"The content of tab one.")),T.default.createElement(n,{tab:"Tab Two",id:"2"},T.default.createElement("div",null,"The content of tab two.")),T.default.createElement(n,{tab:"Tab Three",id:"3"},T.default.createElement("div",null,"The content of tab three.")))}}]),s}(T.default.Component);return T.default.createElement(a,null)},C=function(){var n=w.Tabs.TabPanel,a=function(a){function s(){var n,a,t,p;(0,i.default)(this,s);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return a=t=(0,b.default)(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(o))),t.state={activeId:"2"},t.onTabChange=function(n){t.setState({activeId:n})},p=a,(0,b.default)(t,p)}return(0,h.default)(s,a),(0,d.default)(s,[{key:"render",value:function(){return T.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange,type:"card"},T.default.createElement(n,{tab:T.default.createElement("span",null,"Tab One"),id:"1",disabled:!0},T.default.createElement("div",null,"The content of tab one.")),T.default.createElement(n,{tab:"Tab Two",id:"2"},T.default.createElement("div",null,"The content of tab two.")),T.default.createElement(n,{tab:"Tab Three",id:"3"},T.default.createElement("div",null,"The content of tab three.")))}}]),s}(T.default.Component);return T.default.createElement(a,null)},I=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){function t(){var n,s,p,e;(0,i.default)(this,t);for(var o=arguments.length,c=Array(o),u=0;u<o;u++)c[u]=arguments[u];return s=p=(0,b.default)(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(c))),p.state={activeId:"2",panels:[{tab:T.default.createElement("span",null,"Tab1"),id:"1",disabled:!0,content:"The content of tab1."},{tab:T.default.createElement("span",null,"Tab2"),id:"2",content:T.default.createElement("div",null,"The content of tab2.")}]},p.onTabAdd=function(){var n=p.state.panels;n.push({tab:"Tab"+a,id:""+a++,content:Date.now()}),p.setState({panels:n})},p.onTabDel=function(n){var a=p.state.panels,s=-1;a.some(function(a,t){return a.id===n&&(s=t,!0)}),s>-1&&(a.splice(s,1),p.setState({panels:a}))},p.onTabChange=function(n){p.setState({activeId:n})},e=s,(0,b.default)(p,e)}return(0,h.default)(t,s),(0,d.default)(t,[{key:"renderPanels",value:function(){return this.state.panels.map(function(a){return T.default.createElement(n,(0,l.default)({},a,{key:a.id}),a.content)})}},{key:"render",value:function(){return T.default.createElement(w.Tabs,{candel:!0,canadd:!0,activeId:this.state.activeId,onChange:this.onTabChange.bind(this),onDelete:this.onTabDel.bind(this),onAdd:this.onTabAdd.bind(this)},this.renderPanels())}}]),t}(T.default.Component);return T.default.createElement(s,null)},_=function(){var n=function(n){function a(n){(0,i.default)(this,a);var s=(0,b.default)(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,n));return s.state={activeId:"2",tabs:[{title:"Tab One",key:"1",disabled:!0},{title:"Tab Two",key:"2"},{title:"Tab Three",key:"3"}]},s}return(0,h.default)(a,n),(0,d.default)(a,[{key:"onTabChange",value:function(n){this.setState({activeId:n})}},{key:"render",value:function(){return T.default.createElement("div",null,T.default.createElement("div",{style:{marginTop:"10px"}},T.default.createElement(w.Tabs,{activeId:this.state.activeId,onChange:this.onTabChange.bind(this),tabs:this.state.tabs}),T.default.createElement("h1",null,this.state.activeId)))}}]),a}(m.Component);return T.default.createElement(n,null)},D=function(){var n=w.Tabs.TabPanel,a=4,s=function(s){function t(){var n,s,p,e;(0,i.default)(this,t);for(var o=arguments.length,c=Array(o),u=0;u<o;u++)c[u]=arguments[u];return s=p=(0,b.default)(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(c))),p.state={activeId:"2",panels:[{tab:T.default.createElement("span",null,"Tab1"),id:"1",disabled:!0,content:"The content of tab1."},{tab:T.default.createElement("span",null,"Tab2"),id:"2",content:T.default.createElement("div",null,"The content of tab2.")}]},p.onTabAdd=function(){var n=p.state.panels;n.push({tab:"Tab"+a,id:""+a++,content:Date.now()}),p.setState({panels:n})},p.onTabDel=function(n){var a=p.state.panels,s=-1;a.some(function(a,t){return a.id===n&&(s=t,!0)}),s>-1&&(a.splice(s,1),p.setState({panels:a}))},p.onTabChange=function(n){p.setState({activeId:n})},e=s,(0,b.default)(p,e)}return(0,h.default)(t,s),(0,d.default)(t,[{key:"renderPanels",value:function(){return this.state.panels.map(function(a){return T.default.createElement(n,(0,l.default)({},a,{key:a.id}),a.content)})}},{key:"render",value:function(){return T.default.createElement(w.Tabs,{candel:!0,canadd:!0,activeId:this.state.activeId,onChange:this.onTabChange.bind(this),onDelete:this.onTabDel.bind(this),onAdd:this.onTabAdd.bind(this),navExtraContent:T.default.createElement("span",{style:{lineHeight:"35px",padding:"0 5px"}},"Current shop")},this.renderPanels())}}]),t}(T.default.Component);return T.default.createElement(s,null)},S=function(n){function a(){var n,s,t,p;(0,i.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,b.default)(this,(n=a.__proto__||Object.getPrototypeOf(a)).call.apply(n,[this].concat(o))),t.state={showCode:!1},t.toggle=function(){t.setState({showCode:!t.state.showCode})},p=s,(0,b.default)(t,p)}return(0,h.default)(a,n),(0,d.default)(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return T.default.createElement("div",{className:"zandoc-react-demo"},T.default.createElement("div",{className:"zandoc-react-demo__preview"},e),T.default.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},T.default.createElement("div",{className:"zandoc-react-demo__title"},T.default.createElement("p",null,s||"")),T.default.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle "+(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&T.default.createElement("pre",{className:"zandoc-react-demo__code"},T.default.createElement(p,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(m.Component),O=function(n){function a(){return(0,i.default)(this,a),(0,b.default)(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return(0,h.default)(a,n),(0,d.default)(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'+n+'"]');a&&(0,v.default)(document.documentElement,0,c(a,-9))}}},{key:"render",value:function(){return T.default.createElement("div",{className:"zandoc-react-container",key:null},T.default.createElement(o,{style:""}),T.default.createElement(e,{html:'<h2 class="anchor-heading"><a href="#tabs">¶</a><a href="javascript:void(0)" id="tabs" class="anchor-point"></a>Tabs</h2>\n<p>Tabs is used to switch different view in one page. </p>\n<h3 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h3>'}),T.default.createElement(S,{title:"Basic usage",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</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 activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<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>TabPanel</span>\n <span class="token attr-name">tab={<span</span><span class="token punctuation">></span></span>Tab One<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 id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab one<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Two<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab two<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Three<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab three<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(E)),T.default.createElement(S,{title:"Basic usage of slider type",id:"Demoslider",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</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 activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tabs</span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>slider<span class="token punctuation">"</span></span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<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>TabPanel</span>\n <span class="token attr-name">tab={<span</span><span class="token punctuation">></span></span>Tab One<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 id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab one<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Two<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab two<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Three<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab three<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(P)),T.default.createElement(S,{title:"Basic usage of card type",id:"Democard",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</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 activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>card<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>TabPanel</span>\n <span class="token attr-name">tab={<span</span><span class="token punctuation">></span></span>Tab One<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 id<span class="token operator">=</span><span class="token string">"1"</span>\n disabled\n <span class="token operator">></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab one<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Two<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab two<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span>\n <span class="token attr-name">tab</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>Tab Three<span class="token punctuation">"</span></span>\n <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">\'</span>3<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>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab three<span class="token punctuation">.</span><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>TabPanel</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(C)),T.default.createElement(S,{title:"Dynamic add and delete tab",id:"Demoaddanddel",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<span class="token punctuation">;</span>\n<span class="token keyword">let</span> uniqId <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</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 activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<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>Tab1<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 id<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'The content of tab1.\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n tab<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>Tab2<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 id<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab2<span class="token punctuation">.</span><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>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabAdd</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token punctuation">:</span> <span class="token template-string"><span class="token string">`Tab</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">,</span>\n id<span class="token punctuation">:</span> <span class="token template-string"><span class="token string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token operator">++</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> Date<span class="token punctuation">.</span><span class="token function">now</span><span class="token punctuation">(</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n onTabDel <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n <span class="token keyword">let</span> index <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">some</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>p<span class="token punctuation">.</span>id <span class="token operator">===</span> id<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n index <span class="token operator">=</span> i<span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> <span class="token boolean">false</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 keyword">if</span> <span class="token punctuation">(</span>index <span class="token operator">></span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n panels<span class="token punctuation">.</span><span class="token function">splice</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n <span class="token keyword">return</span> panels<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span> <span class="token spread"><span class="token punctuation">{</span><span class="token punctuation">...</span><span class="token attr-value">p</span><span class="token punctuation">}</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>id<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>content<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>TabPanel</span><span class="token punctuation">></span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <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>Tabs</span>\n <span class="token attr-name">candel</span>\n <span class="token attr-name">canadd</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onDelete</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabDel<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onAdd</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabAdd<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token punctuation">></span></span>\n <span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(I)),T.default.createElement(S,{title:"Tabs without using TabPanel",id:"Demonotabpanel",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n <span class="token function">constructor</span><span class="token punctuation">(</span>props<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">super</span><span class="token punctuation">(</span>props<span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">this</span><span class="token punctuation">.</span>state <span class="token operator">=</span> <span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n tabs<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Tab One\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Tab Two\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'2\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Tab Three\'</span><span class="token punctuation">,</span>\n key<span class="token punctuation">:</span> <span class="token string">\'3\'</span>\n <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>\n\n <span class="token function">onTabChange</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token 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 operator"><</span>div style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> marginTop<span class="token punctuation">:</span> <span class="token string">\'10px\'</span> <span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tabs</span>\n <span class="token attr-name">activeId</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">tabs</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>tabs<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>h1</span><span class="token punctuation">></span></span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h1</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 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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(_)),T.default.createElement(S,{title:"Nav add extra content",id:"Demonavextracontent",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tabs <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n<span class="token keyword">const</span> TabPanel <span class="token operator">=</span> Tabs<span class="token punctuation">.</span>TabPanel<span class="token punctuation">;</span>\n<span class="token keyword">let</span> uniqId <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">Simple</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 activeId<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n panels<span class="token punctuation">:</span> <span class="token punctuation">[</span>\n <span class="token punctuation">{</span>\n tab<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>Tab1<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 id<span class="token punctuation">:</span> <span class="token string">\'1\'</span><span class="token punctuation">,</span>\n disabled<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'The content of tab1.\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n tab<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>Tab2<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 id<span class="token punctuation">:</span> <span class="token string">\'2\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>The content <span class="token keyword">of</span> tab2<span class="token punctuation">.</span><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>\n <span class="token punctuation">]</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onTabAdd</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n tab<span class="token punctuation">:</span> <span class="token template-string"><span class="token string">`Tab</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">,</span>\n id<span class="token punctuation">:</span> <span class="token template-string"><span class="token string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>uniqId<span class="token operator">++</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> Date<span class="token punctuation">.</span><span class="token function">now</span><span class="token punctuation">(</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n onTabDel <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n <span class="token keyword">let</span> index <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>\n panels<span class="token punctuation">.</span><span class="token function">some</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">,</span> i<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>p<span class="token punctuation">.</span>id <span class="token operator">===</span> id<span class="token punctuation">)</span> <span class="token punctuation">{</span>\n index <span class="token operator">=</span> i<span class="token punctuation">;</span>\n <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> <span class="token boolean">false</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 keyword">if</span> <span class="token punctuation">(</span>index <span class="token operator">></span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n panels<span class="token punctuation">.</span><span class="token function">splice</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n panels\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span>\n\n <span class="token function-variable function">onTabChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n activeId<span class="token punctuation">:</span> id\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">let</span> <span class="token punctuation">{</span> panels <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n <span class="token keyword">return</span> panels<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TabPanel</span> <span class="token spread"><span class="token punctuation">{</span><span class="token punctuation">...</span><span class="token attr-value">p</span><span class="token punctuation">}</span></span> <span class="token attr-name">key</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>id<span class="token punctuation">}</span></span><span class="token punctuation">></span></span><span class="token punctuation">{</span>p<span class="token punctuation">.</span>content<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>TabPanel</span><span class="token punctuation">></span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <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 operator"><</span>Tabs\n candel\n canadd\n activeId<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>activeId<span class="token punctuation">}</span>\n onChange<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabChange<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n onDelete<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabDel<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n onAdd<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>onTabAdd<span class="token punctuation">.</span><span class="token function">bind</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n navExtraContent<span class="token operator">=</span><span class="token punctuation">{</span><span class="token operator"><</span>span style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>lineHeight<span class="token punctuation">:</span> <span class="token string">"35px"</span><span class="token punctuation">,</span> padding<span class="token punctuation">:</span> <span class="token string">"0 5px"</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span><span class="token punctuation">{</span><span class="token template-string"><span class="token string">`Current shop`</span></span><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 operator">></span>\n <span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">renderPanels</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Tabs</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><span class="token punctuation">;</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span> mountNode<span class="token punctuation">)</span><span class="token punctuation">;</span>'},T.default.createElement(D)),T.default.createElement(e,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<h4 class="anchor-heading"><a href="#tabs">¶</a><a href="javascript:void(0)" id="tabs" class="anchor-point"></a>Tabs</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>Alternative</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>activeId</td>\n<td>The id of the active tab</td>\n<td>string \n|\n number</td>\n<td></td>\n<td></td>\n<td>yes</td>\n</tr>\n<tr>\n<td>type</td>\n<td>The type of tabs</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'card\'</code>\n, \n<code>\'slider\'</code></td>\n<td>no</td>\n</tr>\n<tr>\n<td>size</td>\n<td>The size of tabs</td>\n<td>string</td>\n<td><code>\'normal\'</code></td>\n<td><code>\'huge\'</code></td>\n<td>no</td>\n</tr>\n<tr>\n<td>align</td>\n<td>The layout of tabs</td>\n<td>string</td>\n<td><code>\'left\'</code></td>\n<td><code>\'right\'</code>\n, \n<code>\'center\'</code></td>\n<td>no</td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>The callback function that is triggered when the tab is active</td>\n<td>(id: string \n|\n number) => any</td>\n<td></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>onDelete</td>\n<td>The callback function that is triggered when the tab is closed.</td>\n<td>(id: string \n|\n number) => any</td>\n<td></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>onAdd</td>\n<td>The callback function that is triggered when adding tab.</td>\n<td>func</td>\n<td></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>candel</td>\n<td>Whether the tab can be deleted.</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code></td>\n<td>no</td>\n</tr>\n<tr>\n<td>canadd</td>\n<td>Whether the tabs can add more tab pannels.</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td><code>true</code></td>\n<td>no</td>\n</tr>\n<tr>\n<td>tabs</td>\n<td>The config of tabs when not using Panel.</td>\n<td>Array</td>\n<td><code>null</code></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>className</td>\n<td>The custom classname</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>The custom prefix</td>\n<td>string</td>\n<td><code>\'zent\'</code></td>\n<td></td>\n<td>no</td>\n</tr>\n<tr>\n<td>navExtraContent</td>\n<td>Nav add extra content</td>\n<td>node</td>\n<td>null</td>\n<td></td>\n<td>no</td>\n</tr>\n</tbody>\n</table>\n<p>Paramerter type of <code>tabs</code>:</p>\n<pre><code class="language-ts"><span class="token keyword">Array</span><span class="token operator"><</span><span class="token punctuation">{</span>\n key<span class="token punctuation">:</span> <span class="token keyword">string</span> <span class="token operator">|</span> <span class="token keyword">number</span><span class="token punctuation">,</span> <span class="token comment">// the same as TabPanel\'s `id`</span>\n title<span class="token punctuation">:</span> <span class="token keyword">string</span> <span class="token operator">|</span> <span class="token keyword">number</span><span class="token punctuation">,</span> <span class="token comment">// the same as TabPanel\'s `tab`</span>\n disabled<span class="token operator">?</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span> <span class="token comment">// the same as TabPanel\'s `disabled`</span>\n<span class="token punctuation">}</span><span class="token operator">></span></code></pre>\n<h4 class="anchor-heading"><a href="#tabpanel">¶</a><a href="javascript:void(0)" id="tabpanel" class="anchor-point"></a>TabPanel</h4>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>tab</td>\n<td>The label of the tab which corresponding to this panel.</td>\n<td>string</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>id</td>\n<td>The id of the tab panel.</td>\n<td>string \n|\n number</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>disabled</td>\n<td>Disable this tab panel.</td>\n<td>bool</td>\n<td>no</td>\n</tr>\n</tbody>\n</table>'}))}}]),a}(m.Component);a.default=O}});