-
Notifications
You must be signed in to change notification settings - Fork 0
/
12-a28f22da2d828c0b81f9.js
1 lines (1 loc) · 90.5 KB
/
12-a28f22da2d828c0b81f9.js
1
webpackJsonp([12],{1609:function(n,a,s){"use strict";function t(n){return n&&n.__esModule?n:{default:n}}function p(n){return v.default.createElement(n.tag,(0,l.default)({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function e(n){return v.default.createElement(p,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function o(n){return v.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),i=s(123),k=t(i),r=s(1),d=t(r),h=s(4),g=t(h),f=s(2),m=t(f),y=s(3),b=t(y),w=s(0),v=t(w),E=s(232),C=t(E),D=s(359),T=function(){var n=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd",children:[{id:2,title:"Engineer",children:[{id:3,title:"Back End Engineer"},{id:4,title:"Front End Engineer"},{id:5,title:"Operations Engineer"}]},{id:6,title:"Product"}]}];return v.default.createElement(D.Tree,{data:n})},z=function(){var n=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd"},{id:2,title:"Engineer",parentId:1},{id:3,title:"Back End Engineer",parentId:2},{id:4,title:"Front End Engineer",parentId:2},{id:5,title:"Operations Engineer",parentId:2},{id:6,title:"Product",parentId:1}];return v.default.createElement(D.Tree,{dataType:"plain",data:n})},j=function(){var n=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd",children:[{id:2,title:"Engineer",children:[{id:3,title:"Back End Engineer"},{id:4,title:"Front End Engineer"},{id:5,title:"Operations Engineer"}]},{id:6,title:"Product"}]}];return v.default.createElement("div",null,v.default.createElement(D.Tree,{data:n,size:"small"}),v.default.createElement(D.Tree,{data:n}),v.default.createElement(D.Tree,{data:n,size:"large"}))},N=function(){var n=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd",content:"great company",children:[{id:2,title:"Engineer",content:"job http://job.youzan.com",children:[{id:3,title:"Back End Engineer"},{id:4,title:"Front End Engineer"},{id:5,title:"Operations Engineer"}]},{id:6,title:"Product",content:v.default.createElement("a",{href:"http://job.youzan.com"},"'send resume to joinus@youzan.com'")}]}],a=function(n){return v.default.createElement("span",{style:{fontSize:16,margin:0,lineHeight:1}},n.title,n.content?v.default.createElement("small",{style:{display:"block",fontSize:10}},n.content):"")};return v.default.createElement(D.Tree,{data:n,render:a})},I=function(){var n=D.Radio.Group,a=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd"},{id:2,title:"Engineer",parentId:1},{id:3,title:"Back End Engineer",parentId:2},{id:4,title:"Front End Engineer",parentId:2},{id:5,title:"Operations Engineer",parentId:2},{id:6,title:"Product",parentId:1}],s=function n(a){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],p={id:String(Math.random()).replace("0.",""),parentId:s,title:a.title};t.push(p);for(var e=0,o=a.children&&a.children.length||0;e<o;e++)n(a.children[e],p.id,t);return t},t=function(t){function p(){var n,t,e,o;(0,d.default)(this,p);for(var c=arguments.length,u=Array(c),l=0;l<c;l++)u[l]=arguments[l];return t=e=(0,m.default)(this,(n=p.__proto__||Object.getPrototypeOf(p)).call.apply(n,[this].concat(u))),e.state={treeData:a,copyType:"shallow"},e.onDelete=function(n){e.setState({treeData:e.state.treeData.filter(function(a){return a.id!==n.id})})},e.onClone=function(n){var a=e.state.copyType;if("shallow"===a){var t=Object.assign({},n,{id:Date.now()});e.setState({treeData:[].concat((0,k.default)(e.state.treeData),[t])})}else if("deep"===a){var p=s(n,n.parentId);e.setState({treeData:[].concat((0,k.default)(e.state.treeData),(0,k.default)(p))})}},e.onCopyTypeChange=function(n){return e.setState({copyType:n.target.value})},o=t,(0,m.default)(e,o)}return(0,b.default)(p,t),(0,g.default)(p,[{key:"render",value:function(){var a=this.state,s=a.copyType,t=a.treeData,p=[{name:"Delete",icon:v.default.createElement(D.Icon,{type:"close"}),action:this.onDelete},{name:"Clone",icon:v.default.createElement(D.Icon,{type:"plus"}),action:this.onClone}];return v.default.createElement("div",null,v.default.createElement(n,{onChange:this.onCopyTypeChange,value:s},v.default.createElement(D.Radio,{value:"shallow"},"浅拷贝"),v.default.createElement(D.Radio,{value:"deep"},"深拷贝")),v.default.createElement("hr",null),v.default.createElement(D.Tree,{data:t,dataType:"plain",operations:p}))}}]),p}(v.default.Component);return v.default.createElement(t,null)},O=function(){var n=D.Radio.Group,a=[{id:1,title:"Hangzhou Youzan Technology Co. Ltd",children:[{id:2,title:"Engineer",children:[{id:3,title:"Back End Engineer",children:[{id:7,title:"JAVA"},{id:8,title:"PHP"},{id:9,title:"GO"},{id:10,title:".NET"}]},{id:4,title:"Front End Engineer"},{id:5,title:"Operations Engineer"}]},{id:6,title:"Product"}]}],s=function(s){function t(){var n,a,s,p;(0,d.default)(this,t);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return a=s=(0,m.default)(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(o))),s.state={useNew:!0,radioValue:"default",controlled:!1,defaultCheckedKeys:[3,5],disabledCheckedKeys:[4,7,9]},s.onUseNewChange=function(n){s.setState({useNew:n})},s.onControllableChange=function(n){if("controllable"===n.target.value)return void s.setState({controlled:!0,radioValue:"controllable"});"default"===n.target.value&&s.setState({controlled:!1,radioValue:"default"})},s.onCheck=function(n){s.state.controlled&&s.setState({defaultCheckedKeys:n})},p=a,(0,m.default)(s,p)}return(0,b.default)(t,s),(0,g.default)(t,[{key:"renderNew",value:function(){var s=this.state,t=s.controlled,p=s.defaultCheckedKeys,e=s.disabledCheckedKeys,o=s.radioValue;return v.default.createElement("div",null,v.default.createElement(n,{onChange:this.onControllableChange,value:o},v.default.createElement(D.Radio,{value:"default"},"default"),v.default.createElement(D.Radio,{value:"controllable"},"controllable")),v.default.createElement("hr",null),v.default.createElement(D.Tree,{useNew:!0,checkable:!0,controlled:t,size:"small",data:a,onCheck:this.onCheck,defaultCheckedKeys:p,disabledCheckedKeys:e}))}},{key:"renderOld",value:function(){var n=this.state,s=n.defaultCheckedKeys,t=n.disabledCheckedKeys;return v.default.createElement(D.Tree,{checkable:!0,size:"small",data:a,onCheck:this.onCheck,defaultCheckedKeys:s,disabledCheckedKeys:t})}},{key:"render",value:function(){var n=this.state.useNew;return v.default.createElement("div",null,v.default.createElement("div",{style:{marginBottom:15}},"useNew ",v.default.createElement(D.Switch,{size:"small",checked:n,onChange:this.onUseNewChange})),n?this.renderNew():this.renderOld())}}]),t}(v.default.Component);return v.default.createElement(s,null)},R=function(){var n=function(n,a){n.level<4?setTimeout(function(){for(var s=[],t=Number(n.title.split("-")[0]),p=Math.pow(10,3-n.level),e=n.level+1,o=0,c="",u=!1;o<=9;o++)4===e?(c=String(t+o),u=!0):(c=t+p*o+"-"+(t+p*(o+1)),u=!1),s.push({id:c,level:e,title:c,isLeaf:u});a(s)},200):setTimeout(function(){return a([])},200)},a=function(a){function s(){var a,t,p,e;(0,d.default)(this,s);for(var o=arguments.length,c=Array(o),u=0;u<o;u++)c[u]=arguments[u];return t=p=(0,m.default)(this,(a=s.__proto__||Object.getPrototypeOf(s)).call.apply(a,[this].concat(c))),p.state={treeData:[]},p.loadMore=function(a){return new Promise(function(s,t){n(a,function(n){var t=n.map(function(n){return(0,l.default)({},n,{parentId:a.id})});p.setState({treeData:[].concat((0,k.default)(p.state.treeData),(0,k.default)(t))}),s()})})},e=t,(0,m.default)(p,e)}return(0,b.default)(s,a),(0,g.default)(s,[{key:"componentDidMount",value:function(){var a=this,s={id:"1-0-10000",title:"0-10000",level:0,expand:!0};n(s,function(n){var t=n.map(function(n){return(0,l.default)({},n,{parentId:s.id})});a.setState({treeData:[s].concat((0,k.default)(t))})})}},{key:"render",value:function(){var n=this.state.treeData;return v.default.createElement(D.Tree,{dataType:"plain",data:n,loadMore:this.loadMore})}}]),s}(v.default.Component);return v.default.createElement(a,null)},S=function(n){function a(){var n,s,t,p;(0,d.default)(this,a);for(var e=arguments.length,o=Array(e),c=0;c<e;c++)o[c]=arguments[c];return s=t=(0,m.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,m.default)(t,p)}return(0,b.default)(a,n),(0,g.default)(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return v.default.createElement("div",{className:"zandoc-react-demo"},v.default.createElement("div",{className:"zandoc-react-demo__preview"},e),v.default.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},v.default.createElement("div",{className:"zandoc-react-demo__title"},v.default.createElement("p",null,s||"")),v.default.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle "+(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&v.default.createElement("pre",{className:"zandoc-react-demo__code"},v.default.createElement(p,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(w.Component),_=function(n){function a(){return(0,d.default)(this,a),(0,m.default)(this,(a.__proto__||Object.getPrototypeOf(a)).apply(this,arguments))}return(0,b.default)(a,n),(0,g.default)(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'+n+'"]');a&&(0,C.default)(document.documentElement,0,c(a,-9))}}},{key:"render",value:function(){return v.default.createElement("div",{className:"zandoc-react-container",key:null},v.default.createElement(o,{style:""}),v.default.createElement(e,{html:'<h2 class="anchor-heading"><a href="#tree">¶</a><a href="javascript:void(0)" id="tree" class="anchor-point"></a>Tree</h2>\n<p>Tree widget is used to build and manipulate trees. such as files, organization structures, geographic infomation</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>Supports two types of data structure, nested tree and array.</li>\n<li>The widget only display input data, but not change itself.</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>'}),v.default.createElement(S,{title:"Basic Usage",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree <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">const</span> treeData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</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 id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</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>'},v.default.createElement(T)),v.default.createElement(S,{title:"Array data",id:"Demoarraydata",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree <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">const</span> treeData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},v.default.createElement(z)),v.default.createElement(S,{title:"Three Size",id:"Demosize",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree <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">const</span> treeData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</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 id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</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>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>small<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>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<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>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>large<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>div</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>'},v.default.createElement(j)),v.default.createElement(S,{title:"Custom Node Display",id:"Democustomnode",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree <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">const</span> treeData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'great company\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n content<span class="token punctuation">:</span> <span class="token string">\'job http://job.youzan.com\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</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 id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</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>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://job.youzan.com<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token string">\'send resume to joinus@youzan.com\'</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span><span class="token punctuation">]</span>\n<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token function-variable function">customRender</span> <span class="token operator">=</span> <span class="token punctuation">(</span>data<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">(</span>\n <span class="token operator"><</span>span style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> fontSize<span class="token punctuation">:</span> <span class="token number">16</span><span class="token punctuation">,</span> margin<span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span> lineHeight<span class="token punctuation">:</span> <span class="token number">1</span> <span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>\n <span class="token punctuation">{</span>data<span class="token punctuation">.</span>title<span class="token punctuation">}</span>\n <span class="token punctuation">{</span>data<span class="token punctuation">.</span>content <span class="token operator">?</span> <span class="token operator"><</span>small style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span> display<span class="token punctuation">:</span> <span class="token string">\'block\'</span><span class="token punctuation">,</span> fontSize<span class="token punctuation">:</span> <span class="token number">10</span> <span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span><span class="token punctuation">{</span>data<span class="token punctuation">.</span>content<span class="token punctuation">}</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>small</span><span class="token punctuation">></span></span> <span class="token punctuation">:</span> <span class="token string">\'\'</span><span class="token punctuation">}</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">render</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>customRender<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},v.default.createElement(N)),v.default.createElement(S,{title:"Custom Operate",id:"Democustomoperate",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree<span class="token punctuation">,</span> Icon<span class="token punctuation">,</span> Radio <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">const</span> RadioGroup <span class="token operator">=</span> Radio<span class="token punctuation">.</span>Group<span class="token punctuation">;</span>\n<span class="token keyword">const</span> originData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">2</span>\n<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> <span class="token number">1</span>\n<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\n<span class="token keyword">const</span> <span class="token function-variable function">deepClone</span> <span class="token operator">=</span> <span class="token punctuation">(</span>node<span class="token punctuation">,</span> parentId <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> nodeArray <span class="token operator">=</span> <span class="token punctuation">[</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">const</span> copyNode <span class="token operator">=</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token function">String</span><span class="token punctuation">(</span>Math<span class="token punctuation">.</span><span class="token function">random</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">replace</span><span class="token punctuation">(</span><span class="token string">\'0.\'</span><span class="token punctuation">,</span> <span class="token string">\'\'</span><span class="token punctuation">)</span><span class="token punctuation">,</span>\n parentId<span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> node<span class="token punctuation">.</span>title\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n nodeArray<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span>copyNode<span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> l <span class="token operator">=</span> node<span class="token punctuation">.</span>children <span class="token operator">&&</span> node<span class="token punctuation">.</span>children<span class="token punctuation">.</span>length <span class="token operator">||</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator"><</span> l<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token function">deepClone</span><span class="token punctuation">(</span>node<span class="token punctuation">.</span>children<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">,</span> copyNode<span class="token punctuation">.</span>id<span class="token punctuation">,</span> nodeArray<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token keyword">return</span> nodeArray<span class="token punctuation">;</span>\n<span class="token punctuation">}</span>\n\n<span class="token keyword">class</span> <span class="token class-name">TreeExample</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 treeData<span class="token punctuation">:</span> originData<span class="token punctuation">,</span>\n copyType<span class="token punctuation">:</span> <span class="token string">\'shallow\'</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onDelete</span> <span class="token operator">=</span> <span class="token punctuation">(</span>data<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 treeData<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>treeData<span class="token punctuation">.</span><span class="token function">filter</span><span class="token punctuation">(</span>item <span class="token operator">=></span> item<span class="token punctuation">.</span>id <span class="token operator">!==</span> data<span class="token punctuation">.</span>id<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-variable function">onClone</span> <span class="token operator">=</span> <span class="token punctuation">(</span>data<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> copyType <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\n <span class="token keyword">if</span> <span class="token punctuation">(</span>copyType <span class="token operator">===</span> <span class="token string">\'shallow\'</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> node <span class="token operator">=</span> Object<span class="token punctuation">.</span><span class="token function">assign</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">{</span> id<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> <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 treeData<span class="token punctuation">:</span> <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>treeData<span class="token punctuation">,</span> node<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 keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>copyType <span class="token operator">===</span> <span class="token string">\'deep\'</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> nodeArray <span class="token operator">=</span> <span class="token function">deepClone</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> data<span class="token punctuation">.</span>parentId<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 treeData<span class="token punctuation">:</span> <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>treeData<span class="token punctuation">,</span> <span class="token operator">...</span>nodeArray<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 <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">onCopyTypeChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>e<span class="token punctuation">)</span> <span class="token operator">=></span> <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> copyType<span class="token punctuation">:</span> e<span class="token punctuation">.</span>target<span class="token punctuation">.</span>value <span class="token punctuation">}</span><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">const</span> <span class="token punctuation">{</span> copyType<span class="token punctuation">,</span> treeData <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">const</span> operations <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n name<span class="token punctuation">:</span> <span class="token string">\'Delete\'</span><span class="token punctuation">,</span>\n icon<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Icon</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>close<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n action<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>onDelete\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n name<span class="token punctuation">:</span> <span class="token string">\'Clone\'</span><span class="token punctuation">,</span>\n icon<span class="token punctuation">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Icon</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>plus<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">,</span>\n action<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>onClone\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n\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>RadioGroup</span> <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>onCopyTypeChange<span class="token punctuation">}</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>copyType<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>Radio</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>shallow<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>浅拷贝<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Radio</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Radio</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>deep<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>深拷贝<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Radio</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>RadioGroup</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>hr</span><span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">operations</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>operations<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>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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TreeExample</span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},v.default.createElement(I)),v.default.createElement(S,{title:"Optional Tree",id:"Demooption",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree<span class="token punctuation">,</span> Radio<span class="token punctuation">,</span> Switch <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">const</span> RadioGroup <span class="token operator">=</span> Radio<span class="token punctuation">.</span>Group<span class="token punctuation">;</span>\n<span class="token keyword">const</span> treeData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">1</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Hangzhou Youzan Technology Co. Ltd\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Engineer\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">3</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Back End Engineer\'</span><span class="token punctuation">,</span>\n children<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">7</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'JAVA\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">8</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'PHP\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">9</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'GO\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">10</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'.NET\'</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 id<span class="token punctuation">:</span> <span class="token number">4</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Front End Engineer\'</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token number">5</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Operations Engineer\'</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 id<span class="token punctuation">:</span> <span class="token number">6</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'Product\'</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 keyword">class</span> <span class="token class-name">TreeExample</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 useNew<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n radioValue<span class="token punctuation">:</span> <span class="token string">\'default\'</span><span class="token punctuation">,</span>\n controlled<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>\n defaultCheckedKeys<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">,</span>\n disabledCheckedKeys<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token number">9</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onUseNewChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>checked<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 useNew<span class="token punctuation">:</span> checked<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-variable function">onControllableChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>e<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>e<span class="token punctuation">.</span>target<span class="token punctuation">.</span>value <span class="token operator">===</span> <span class="token string">\'controllable\'</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 controlled<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>\n radioValue<span class="token punctuation">:</span> <span class="token string">\'controllable\'</span>\n <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 punctuation">}</span>\n\n <span class="token keyword">if</span> <span class="token punctuation">(</span>e<span class="token punctuation">.</span>target<span class="token punctuation">.</span>value <span class="token operator">===</span> <span class="token string">\'default\'</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 controlled<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>\n radioValue<span class="token punctuation">:</span> <span class="token string">\'default\'</span>\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>\n\n <span class="token function-variable function">onCheck</span> <span class="token operator">=</span> <span class="token punctuation">(</span>checked<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>checked<span class="token punctuation">)</span><span class="token punctuation">;</span>\n\n <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">.</span>controlled<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 defaultCheckedKeys<span class="token punctuation">:</span> checked\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>\n\n <span class="token function">renderNew</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> controlled<span class="token punctuation">,</span> defaultCheckedKeys<span class="token punctuation">,</span> disabledCheckedKeys<span class="token punctuation">,</span> radioValue <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\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>RadioGroup</span> <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>onControllableChange<span class="token punctuation">}</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>radioValue<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>Radio</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>default<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token keyword">default</span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Radio</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Radio</span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>controllable<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>controllable<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>Radio</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>RadioGroup</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>hr</span><span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span>\n <span class="token attr-name">useNew</span>\n <span class="token attr-name">checkable</span>\n <span class="token attr-name">controlled</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>controlled<span class="token punctuation">}</span></span>\n <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span>\n <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span>\n <span class="token attr-name">onCheck</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>onCheck<span class="token punctuation">}</span></span>\n <span class="token attr-name">defaultCheckedKeys</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>defaultCheckedKeys<span class="token punctuation">}</span></span>\n <span class="token attr-name">disabledCheckedKeys</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>disabledCheckedKeys<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>\n <span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">renderOld</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> <span class="token punctuation">{</span> defaultCheckedKeys<span class="token punctuation">,</span> disabledCheckedKeys <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\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>Tree</span>\n <span class="token attr-name">checkable</span>\n <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span>\n <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span>\n <span class="token attr-name">onCheck</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>onCheck<span class="token punctuation">}</span></span>\n <span class="token attr-name">defaultCheckedKeys</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>defaultCheckedKeys<span class="token punctuation">}</span></span>\n <span class="token attr-name">disabledCheckedKeys</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>disabledCheckedKeys<span class="token punctuation">}</span></span>\n <span class="token punctuation">/></span></span>\n <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">const</span> <span class="token punctuation">{</span> useNew <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\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> marginBottom<span class="token punctuation">:</span> <span class="token number">15</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token operator">></span>\n useNew <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Switch</span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>small<span class="token punctuation">"</span></span> <span class="token attr-name">checked</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>useNew<span class="token punctuation">}</span></span> <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>onUseNewChange<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>div</span><span class="token punctuation">></span></span>\n\n <span class="token punctuation">{</span>useNew <span class="token operator">?</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">renderNew</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">renderOld</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>div</span><span class="token punctuation">></span></span>\n <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>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TreeExample</span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span>'},v.default.createElement(O)),v.default.createElement(S,{title:"Async Loading",id:"Demoasync",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> Tree <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">const</span> <span class="token function-variable function">fetchData</span> <span class="token operator">=</span> <span class="token punctuation">(</span>data<span class="token punctuation">,</span> callback<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>data<span class="token punctuation">.</span>level <span class="token operator"><</span> <span class="token number">4</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> resData <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> base <span class="token operator">=</span> <span class="token function">Number</span><span class="token punctuation">(</span>data<span class="token punctuation">.</span>title<span class="token punctuation">.</span><span class="token function">split</span><span class="token punctuation">(</span><span class="token string">\'-\'</span><span class="token punctuation">)</span><span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> step <span class="token operator">=</span> Math<span class="token punctuation">.</span><span class="token function">pow</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">,</span> <span class="token number">3</span> <span class="token operator">-</span> data<span class="token punctuation">.</span>level<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">const</span> level <span class="token operator">=</span> data<span class="token punctuation">.</span>level <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">;</span>\n <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> id <span class="token operator">=</span> <span class="token string">\'\'</span><span class="token punctuation">,</span> isLeaf <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span> i <span class="token operator"><=</span> <span class="token number">9</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">if</span> <span class="token punctuation">(</span>level <span class="token operator">===</span> <span class="token number">4</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n id <span class="token operator">=</span> <span class="token function">String</span><span class="token punctuation">(</span>base <span class="token operator">+</span> i<span class="token punctuation">)</span><span class="token punctuation">;</span>\n isLeaf <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 keyword">else</span> <span class="token punctuation">{</span>\n id <span class="token operator">=</span> <span class="token template-string"><span class="token string">`</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>base <span class="token operator">+</span> step <span class="token operator">*</span> i<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">-</span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>base <span class="token operator">+</span> step <span class="token operator">*</span> <span class="token punctuation">(</span>i <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token interpolation-punctuation punctuation">}</span></span><span class="token string">`</span></span><span class="token punctuation">;</span>\n isLeaf <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n resData<span class="token punctuation">.</span><span class="token function">push</span><span class="token punctuation">(</span><span class="token punctuation">{</span> id<span class="token punctuation">,</span> level<span class="token punctuation">,</span> title<span class="token punctuation">:</span> id<span class="token punctuation">,</span> isLeaf <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 function">callback</span><span class="token punctuation">(</span>resData<span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>\n <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token function">callback</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">200</span><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 keyword">class</span> <span class="token class-name">TreeExample</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 treeData<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">componentDidMount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> rootData <span class="token operator">=</span> <span class="token punctuation">{</span>\n id<span class="token punctuation">:</span> <span class="token string">\'1-0-10000\'</span><span class="token punctuation">,</span>\n title<span class="token punctuation">:</span> <span class="token string">\'0-10000\'</span><span class="token punctuation">,</span>\n level<span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>\n expand<span class="token punctuation">:</span> <span class="token boolean">true</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n <span class="token function">fetchData</span><span class="token punctuation">(</span>rootData<span class="token punctuation">,</span> <span class="token punctuation">(</span>resData<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> newData <span class="token operator">=</span> resData<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span>item <span class="token operator">=></span> <span class="token punctuation">(</span><span class="token punctuation">{</span>\n <span class="token operator">...</span>item<span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> rootData<span class="token punctuation">.</span>id\n <span class="token punctuation">}</span><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 treeData<span class="token punctuation">:</span> <span class="token punctuation">[</span>rootData<span class="token punctuation">,</span> <span class="token operator">...</span>newData<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><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">loadMore</span> <span class="token operator">=</span> <span class="token punctuation">(</span>data<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span>resolve<span class="token punctuation">,</span> reject<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token function">fetchData</span><span class="token punctuation">(</span>data<span class="token punctuation">,</span> <span class="token punctuation">(</span>resData<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">const</span> newData <span class="token operator">=</span> resData<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span>item <span class="token operator">=></span> <span class="token punctuation">(</span><span class="token punctuation">{</span>\n <span class="token operator">...</span>item<span class="token punctuation">,</span>\n parentId<span class="token punctuation">:</span> data<span class="token punctuation">.</span>id\n <span class="token punctuation">}</span><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> treeData<span class="token punctuation">:</span> <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>treeData<span class="token punctuation">,</span> <span class="token operator">...</span>newData<span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token function">resolve</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><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">const</span> <span class="token punctuation">{</span> treeData <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> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Tree</span> <span class="token attr-name">dataType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>plain<span class="token punctuation">"</span></span> <span class="token attr-name">data</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>treeData<span class="token punctuation">}</span></span> <span class="token attr-name">loadMore</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>loadMore<span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>TreeExample</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>'},v.default.createElement(R)),v.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="#tree">¶</a><a href="javascript:void(0)" id="tree" class="anchor-point"></a>Tree</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</tr>\n</thead>\n<tbody>\n<tr>\n<td>useNew</td>\n<td>whether to use new version Tree</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>dataType</td>\n<td>data structure, default is tree</td>\n<td>string</td>\n<td><code>\'tree\'</code></td>\n<td><code>\'plain\'</code></td>\n</tr>\n<tr>\n<td>data</td>\n<td>required, input data, identified by dataType</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>renderKey</td>\n<td>(userNew)the key map for render node, see the following table</td>\n<td>object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>render</td>\n<td>you can customize function to render tree , the parameter is node data (includings children tree)</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>operations</td>\n<td>custom operate, includings \n<code>name</code>\n, \n<code>icon</code>\n, \n<code>action</code>\n, \n<code>shouldRender</code>\n attributes</td>\n<td>array\n[\nobject\n]</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>foldable</td>\n<td>whether to support item show and hide</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onCheck</td>\n<td>when you click checkbox, callback function will call, params is a array includes all nodes id array</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>checkable</td>\n<td>whether to support checkbox</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>controlled</td>\n<td>(useNew)with checkable, whether to support defaultCheckedKeys and defaultCheckedKeys controlled</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>defaultCheckedKeys</td>\n<td>default choosen node id array</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>disabledCheckedKeys</td>\n<td>default forbidden choosen node id array</td>\n<td>array</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>size</td>\n<td>size</td>\n<td>string</td>\n<td><code>\'medium\'</code></td>\n<td><code>\'small\'</code>\n, \n<code>\'large\'</code></td>\n</tr>\n<tr>\n<td>commonStyle</td>\n<td>set entire tree style</td>\n<td>object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>expandAll</td>\n<td>whether to expand all nodes</td>\n<td>bool</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onExpand</td>\n<td>after node expands, callback is trigger</td>\n<td>func(data, config)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>autoExpandOnSelect</td>\n<td>node auto expands when you select it</td>\n<td>bool</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onSelect</td>\n<td>the callback when you choose tree node</td>\n<td>func(data, target)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>isRoot</td>\n<td>plain data, to determine whether the node is the api of the root node</td>\n<td>func(node)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>loadMore</td>\n<td>return Promise func, support thenable callback, be used to asynchronously load more content</td>\n<td>func(data)</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#renderkey-usenew">¶</a><a href="javascript:void(0)" id="renderkey-usenew" class="anchor-point"></a>renderKey (useNew)</h4>\n<p>The Key for customized for <code>data</code>.</p>\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</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>key for uniuqe key</td>\n<td>string</td>\n<td><code>\'id\'</code></td>\n</tr>\n<tr>\n<td>title</td>\n<td>key for show title</td>\n<td>string</td>\n<td><code>\'title\'</code></td>\n</tr>\n<tr>\n<td>children</td>\n<td>key for children tree (\n<code>dataType="tree"</code>\n it works)</td>\n<td>string</td>\n<td><code>\'children\'</code></td>\n</tr>\n<tr>\n<td>parentId</td>\n<td>key for parent Id (\n<code>dataType="plain"</code>\n it works)</td>\n<td>string</td>\n<td><code>\'parentId\'</code></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#data">¶</a><a href="javascript:void(0)" id="data" class="anchor-point"></a>data</h4>\n<p>Except for key-value below, you can add attributes on anynode, the callback will get entire data that user input.\nYou can customize key through <code>renderKey</code>.</p>\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</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>required, uniuqe key</td>\n<td>number/string</td>\n<td></td>\n</tr>\n<tr>\n<td>title</td>\n<td>required, show title</td>\n<td>string</td>\n<td></td>\n</tr>\n<tr>\n<td>children</td>\n<td>children tree (\n<code>dataType="tree"</code>\n it works)</td>\n<td>array\n[\nobject\n]</td>\n<td></td>\n</tr>\n<tr>\n<td>parentId</td>\n<td>parent Id (\n<code>dataType="plain"</code>\n it works), roort node is 0 or undefined</td>\n<td>number/string</td>\n<td></td>\n</tr>\n<tr>\n<td>expand</td>\n<td>whether to expand or not</td>\n<td>bool</td>\n<td><code>false</code></td>\n</tr>\n<tr>\n<td>isLeaf</td>\n<td>whether is leaf node or not</td>\n<td>bool</td>\n<td><code>false</code></td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#operations">¶</a><a href="javascript:void(0)" id="operations" class="anchor-point"></a>operations</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</tr>\n</thead>\n<tbody>\n<tr>\n<td>name</td>\n<td>required, show content</td>\n<td>string</td>\n<td></td>\n</tr>\n<tr>\n<td>icon</td>\n<td>display icon className, or ReactNode</td>\n<td>string/ReactNode</td>\n<td></td>\n</tr>\n<tr>\n<td>action</td>\n<td>required, click callback, the parameter is children tree</td>\n<td>func(data)</td>\n<td></td>\n</tr>\n<tr>\n<td>shouldRender</td>\n<td>is it need to update, return true/false</td>\n<td>func(data)</td>\n<td><code>true</code></td>\n</tr>\n</tbody>\n</table>'}))}}]),a}(w.Component);a.default=_}});