mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +08:00
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
(("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd=("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd||[]).push([["f7fd5a65"],{"04c7cc8a":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return k;}});var a=l("f19d2b93");l("107cac9d");var n=l("a9d1a279");let{DirectoryTree:r}=n.Tree,d=[{title:"parent 0",key:"0-0",children:[{title:"leaf 0-0",key:"0-0-0",isLeaf:!0},{title:"leaf 0-1",key:"0-0-1",isLeaf:!0}]},{title:"parent 1",key:"0-1",children:[{title:"leaf 1-0",key:"0-1-0",isLeaf:!0},{title:"leaf 1-1",key:"0-1-1",isLeaf:!0}]}],i={treeData:d,defaultExpandAll:!0,onSelect:(e,t)=>{console.log("Trigger Select",e,t);},onExpand:(e,t)=>{console.log("Trigger Expand",e,t);}},s=()=>(0,a.jsx)(r,{draggable:!0,defaultSelectedKeys:["0-0-0"]}),c=()=>(0,a.jsx)(r,{...i,checkable:!0,defaultSelectedKeys:["0-1-0"]}),o=()=>(0,a.jsx)(r,{...i,draggable:!0,checkable:!0,defaultSelectedKeys:["0-1"]}),u=()=>(0,a.jsx)(r,{...i,multiple:!0,treeData:d}),f=()=>(0,a.jsx)(n.Tree,{...i,defaultSelectedKeys:["0-1"]}),h=()=>(0,a.jsx)(n.Tree,{...i,checkable:!0,defaultSelectedKeys:["0-1"]}),y=()=>(0,a.jsx)(n.Tree,{...i,draggable:!0,defaultSelectedKeys:["0-1-0"]});var k=()=>(0,a.jsxs)(n.Flex,{wrap:!0,gap:"large",children:[(0,a.jsx)(s,{}),(0,a.jsx)(c,{}),(0,a.jsx)(o,{}),(0,a.jsx)(u,{}),(0,a.jsx)(f,{}),(0,a.jsx)(h,{}),(0,a.jsx)(y,{})]});},"04f48f8d":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return s;}});var a=l("f19d2b93");l("6fb30674");var n=l("5b220c3d"),r=l("e22febe0"),d=l("a9d1a279");let i=[{title:"parent 1",key:"0-0",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"parent 1-0",key:"0-0-0",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"leaf",key:"0-0-0-0",icon:(0,a.jsx)(r.CarryOutOutlined,{})},{title:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{children:"multiple line title"}),(0,a.jsx)("div",{children:"multiple line title"})]}),key:"0-0-0-1",icon:(0,a.jsx)(r.CarryOutOutlined,{})},{title:"leaf",key:"0-0-0-2",icon:(0,a.jsx)(r.CarryOutOutlined,{})}]},{title:"parent 1-1",key:"0-0-1",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"leaf",key:"0-0-1-0",icon:(0,a.jsx)(r.CarryOutOutlined,{})}]},{title:"parent 1-2",key:"0-0-2",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"leaf",key:"0-0-2-0",icon:(0,a.jsx)(r.CarryOutOutlined,{})},{title:"leaf",key:"0-0-2-1",icon:(0,a.jsx)(r.CarryOutOutlined,{}),switcherIcon:(0,a.jsx)(r.FormOutlined,{})}]}]},{title:"parent 2",key:"0-1",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"parent 2-0",key:"0-1-0",icon:(0,a.jsx)(r.CarryOutOutlined,{}),children:[{title:"leaf",key:"0-1-0-0",icon:(0,a.jsx)(r.CarryOutOutlined,{})},{title:"leaf",key:"0-1-0-1",icon:(0,a.jsx)(r.CarryOutOutlined,{})}]}]}];var s=()=>{let[e,t]=(0,n.useState)(!0),[l,s]=(0,n.useState)(!1),[c,o]=(0,n.useState)(!0);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{marginBottom:16},children:["showLine: ",(0,a.jsx)(d.Switch,{checked:!!e,onChange:t}),(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"showIcon: ",(0,a.jsx)(d.Switch,{checked:l,onChange:s}),(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"showLeafIcon:"," ",(0,a.jsxs)(d.Select,{defaultValue:"true",onChange:e=>"custom"===e?o((0,a.jsx)(r.CheckOutlined,{})):"true"===e?o(!0):o(!1),children:[(0,a.jsx)(d.Select.Option,{value:"true",children:"True"}),(0,a.jsx)(d.Select.Option,{value:"false",children:"False"}),(0,a.jsx)(d.Select.Option,{value:"custom",children:"Custom icon"})]})]}),(0,a.jsx)(d.Tree,{showLine:!!e&&{showLeafIcon:c},showIcon:l,defaultExpandedKeys:["0-0-0"],onSelect:(e,t)=>{console.log("selected",e,t);},treeData:i})]});};},"0bb6e16a":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("e3c09e2b");let{DirectoryTree:n}=l("a9d1a279").Tree,r=[{title:"parent 0",key:"0-0",children:[{title:"leaf 0-0",key:"0-0-0",isLeaf:!0},{title:"leaf 0-1",key:"0-0-1",isLeaf:!0}]},{title:"parent 1",key:"0-1",children:[{title:"leaf 1-0",key:"0-1-0",isLeaf:!0},{title:"leaf 1-1",key:"0-1-1",isLeaf:!0}]}];var d=()=>(0,a.jsx)(n,{multiple:!0,draggable:!0,defaultExpandAll:!0,onSelect:(e,t)=>{console.log("Trigger Select",e,t);},onExpand:(e,t)=>{console.log("Trigger Expand",e,t);},treeData:r});},"0f12c16a":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return s;}});var a=l("f19d2b93");l("1e47807d");var n=l("5b220c3d"),r=l("a9d1a279");let d=[],i=(e,t,l)=>{let a=t||"0",n=l||d,r=[];for(let e=0;e<3;e++){let t=`${a}-${e}`;n.push({title:t,key:t}),e<2&&r.push(t);}if(e<0)return n;let s=e-1;r.forEach((e,t)=>(n[t].children=[],i(s,e,n[t].children)));};i(1);var s=()=>{let[e,t]=(0,n.useState)(d),[l]=(0,n.useState)(["0-0","0-0-0","0-0-0-0"]);return(0,a.jsx)(r.Tree,{className:"draggable-tree",defaultExpandedKeys:l,draggable:!0,blockNode:!0,onDragEnter:e=>{console.log(e);},onDrop:l=>{let a;console.log(l);let n=l.node.key,r=l.dragNode.key,d=l.node.pos.split("-"),i=l.dropPosition-Number(d[d.length-1]),s=(e,t,l)=>{for(let a=0;a<e.length;a++){if(e[a].key===t)return l(e[a],a,e);e[a].children&&s(e[a].children,t,l);}},c=[...e];if(s(c,r,(e,t,l)=>{l.splice(t,1),a=e;}),l.dropToGap){let e,t=[];s(c,n,(l,a,n)=>{t=n,e=a;}),-1===i?t.splice(e,0,a):t.splice(e+1,0,a);}else s(c,n,e=>{e.children=e.children||[],e.children.unshift(a);});t(c);},treeData:e});};},"130b751b":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return i;}});var a=l("f19d2b93");l("9eac78a9");var n=l("5b220c3d"),r=l("a9d1a279");let d=[{title:"0-0",key:"0-0",children:[{title:"0-0-0",key:"0-0-0",children:[{title:"0-0-0-0",key:"0-0-0-0"},{title:"0-0-0-1",key:"0-0-0-1"},{title:"0-0-0-2",key:"0-0-0-2"}]},{title:"0-0-1",key:"0-0-1",children:[{title:"0-0-1-0",key:"0-0-1-0"},{title:"0-0-1-1",key:"0-0-1-1"},{title:"0-0-1-2",key:"0-0-1-2"}]},{title:"0-0-2",key:"0-0-2"}]},{title:"0-1",key:"0-1",children:[{title:"0-1-0-0",key:"0-1-0-0"},{title:"0-1-0-1",key:"0-1-0-1"},{title:"0-1-0-2",key:"0-1-0-2"}]},{title:"0-2",key:"0-2"}];var i=()=>{let[e,t]=(0,n.useState)(["0-0-0","0-0-1"]),[l,i]=(0,n.useState)(["0-0-0"]),[s,c]=(0,n.useState)([]),[o,u]=(0,n.useState)(!0);return(0,a.jsx)(r.Tree,{checkable:!0,onExpand:e=>{console.log("onExpand",e),t(e),u(!1);},expandedKeys:e,autoExpandParent:o,onCheck:e=>{console.log("onCheck",e),i(e);},checkedKeys:l,onSelect:(e,t)=>{console.log("onSelect",t),c(e);},selectedKeys:s,treeData:d});};},"22dda86b":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("eabf7ffe");var n=l("a9d1a279");let r=[{title:"parent",key:"0",children:[{title:"child 1",key:"0-0",disabled:!0},{title:"child 2",key:"0-1",disableCheckbox:!0}]}];var d=()=>(0,a.jsx)(n.Tree,{checkable:!0,defaultSelectedKeys:["0-1"],defaultExpandAll:!0,treeData:r,blockNode:!0});},"36c6b1c6":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return o;}});var a=l("777fffbe"),n=l("f19d2b93");l("c6543381");var r=a._(l("5b220c3d")),d=l("a9d1a279");let i=(e="0",t=3)=>{let l=[];for(let a=0;a<10;a+=1){let n=`${e}-${a}`,r={title:n,key:n};t>0&&(r.children=i(n,t-1)),l.push(r);}return l;},s=i(),c=d.Tooltip||r.default.memo(d.Tooltip);var o=()=>(0,n.jsx)(d.Tree,{treeData:s,height:233,defaultExpandAll:!0,titleRender:e=>{let t=e.title;return(0,n.jsx)(c,{title:t,children:t});}});},"3a8480f4":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return o;}});var a=l("777fffbe"),n=l("f19d2b93");l("e0e2c825");var r=a._(l("5b220c3d")),d=l("e22febe0"),i=l("a9d1a279");let s=[],c=(e,t="0",l=s)=>{let a=[];for(let e=0;e<3;e++){let r=`${t}-${e}`;l.push({title:r,key:r,icon:(0,n.jsx)(d.CarryOutOutlined,{})}),e<2&&a.push(r);}if(e<0)return l;let r=e-1;a.forEach((e,t)=>(l[t].children=[],c(r,e,l[t].children)));};c(1);var o=()=>{let[e,t]=r.default.useState(s),[l,a]=r.default.useState(!0),[d,c]=r.default.useState(!0),[o,u]=r.default.useState(!0),[f,h]=r.default.useState(["0-0","0-0-0","0-0-0-0"]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{marginBottom:16},children:["showLine: ",(0,n.jsx)(i.Switch,{checked:l,onChange:e=>{e?o?a({showLeafIcon:!0}):a(!0):a(!1);}}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{}),"showIcon: ",(0,n.jsx)(i.Switch,{checked:d,onChange:()=>c(d)}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{}),"showLeafIcon: ",(0,n.jsx)(i.Switch,{checked:o,onChange:e=>{u(e),a({showLeafIcon:e});}})]}),(0,n.jsx)(i.Tree,{showLine:l,showIcon:d,className:"draggable-tree",defaultExpandedKeys:f,draggable:!0,blockNode:!0,onDragEnter:e=>{console.log(e),h(e.expandedKeys);},onDrop:l=>{let a;console.log(l);let n=l.node.key,r=l.dragNode.key,d=l.node.pos.split("-"),i=l.dropPosition-Number(d[d.length-1]),s=(e,t,l)=>{for(let a=0;a<e.length;a++){if(e[a].key===t)return l(e[a],a,e);e[a].children&&s(e[a].children,t,l);}},c=[...e];if(s(c,r,(e,t,l)=>{l.splice(t,1),a=e;}),l.dropToGap){if((l.node.props.children||[]).length>0&&l.node.props.expanded&&1===i)s(c,n,e=>{e.children=e.children||[],e.children.unshift(a);});else{let e,t;s(c,n,(l,a,n)=>{e=n,t=a;}),-1===i?e.splice(t,0,a):e.splice(t+1,0,a);}}else s(c,n,e=>{e.children=e.children||[],e.children.push(a);});t(c);},treeData:e})]});};},"4588a71c":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("134c1950");var n=l("a9d1a279");let r=[];for(let e=0;e<100;e+=1){let t=[];for(let l=0;l<100;l+=1)t.push({title:`child ${e}-${l}`,key:`l-${e}-${l}`});r.push({title:`parent ${e}`,key:`l-${e}`,children:t});}var d=()=>(0,a.jsx)(n.Tree,{defaultExpandAll:!0,height:400,treeData:r});},"747477d7":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return f;}});var a=l("f19d2b93");l("eede51f3");var n=l("5b220c3d"),r=l("a9d1a279");let{Search:d}=r.Input,i=[],s=(e,t,l)=>{let a=t||"0",n=l||i,r=[];for(let e=0;e<3;e++){let t=`${a}-${e}`;n.push({title:t,key:t}),e<2&&r.push(t);}if(e<0)return n;let d=e-1;r.forEach((e,t)=>(n[t].children=[],s(d,e,n[t].children)));};s(1);let c=[],o=e=>{for(let t=0;t<e.length;t++){let l=e[t],{key:a}=l;c.push({key:a,title:a}),l.children&&o(l.children);}};o(i);let u=(e,t)=>{let l;for(let a=0;a<t.length;a++){let n=t[a];n.children&&(n.children.some(t=>t.key===e)?l=n.key:u(e,n.children)&&(l=u(e,n.children)));}return l;};var f=()=>{let[e,t]=(0,n.useState)([]),[l,s]=(0,n.useState)(""),[o,f]=(0,n.useState)(!0),h=(0,n.useMemo)(()=>{let e=t=>t.map(t=>{let n=t.title,r=n.indexOf(l),d=n.substring(0,r),i=n.slice(r+l.length),s=r>-1?(0,a.jsxs)("span",{children:[d,(0,a.jsx)("span",{className:"site-tree-search-value",children:l}),i]},t.key):(0,a.jsx)("span",{children:n},t.key);return t.children?{title:s,key:t.key,children:e(t.children)}:{title:s,key:t.key};});return e(i);},[l]);return(0,a.jsxs)("div",{children:[(0,a.jsx)(d,{style:{marginBottom:8},placeholder:"Search",onChange:e=>{let{value:l}=e.target;t(c.map(e=>e.title.indexOf(l)>-1?u(e.key,i):null).filter((e,t,l)=>!!(e&&l.indexOf(e)===t))),s(l),f(!0);}}),(0,a.jsx)(r.Tree,{onExpand:e=>{t(e),f(!1);},expandedKeys:e,autoExpandParent:o,treeData:h})]});};},"8d4faa46":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("f8f50271");var n=l("a9d1a279");let r=[{title:"parent 1",key:"0-0",children:[{title:"parent 1-0",key:"0-0-0",disabled:!0,children:[{title:"This is a very very very very long text",key:"0-0-0-0",disableCheckbox:!0},{title:"This is also a very very very very very long text",key:"0-0-0-1"}]},{title:"parent 1-1",key:"0-0-1",children:[{title:(0,a.jsx)("span",{style:{color:"#1677ff"},children:"sss"}),key:"0-0-1-0"}]}]}];var d=()=>(0,a.jsx)(n.Tree,{checkable:!0,defaultExpandedKeys:["0-0-0","0-0-1"],defaultSelectedKeys:["0-0-0","0-0-1"],defaultCheckedKeys:["0-0-0","0-0-1"],onSelect:(e,t)=>{console.log("selected",e,t);},onCheck:(e,t)=>{console.log("onCheck",e,t);},treeData:r,style:{width:200}});},"927ceea7":function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("2abfea61");var n=l("a9d1a279");let r=[{title:"parent 1",key:"0-0",children:[{title:"parent 1-0",key:"0-0-0",disabled:!0,children:[{title:"leaf",key:"0-0-0-0",disableCheckbox:!0},{title:"leaf",key:"0-0-0-1"}]},{title:"parent 1-1",key:"0-0-1",children:[{title:(0,a.jsx)("span",{style:{color:"#1677ff"},children:"sss"}),key:"0-0-1-0"}]}]}];var d=()=>(0,a.jsx)(n.ConfigProvider,{theme:{components:{Tree:{nodeHoverBg:"#fff2f0",nodeHoverColor:"#1677ff",nodeSelectedBg:"#ffa39e",nodeSelectedColor:"#fff",indentSize:80}}},children:(0,a.jsx)(n.Tree,{checkable:!0,defaultExpandedKeys:["0-0-0","0-0-1"],defaultSelectedKeys:["0-0-0","0-0-1"],defaultCheckedKeys:["0-0-0","0-0-1"],onSelect:(e,t)=>{console.log("selected",e,t);},onCheck:(e,t)=>{console.log("onCheck",e,t);},treeData:r})});},bafe5506:function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return i;}});var a=l("f19d2b93");l("59158189");var n=l("e22febe0"),r=l("a9d1a279");let d=[{title:"parent 1",key:"0-0",children:[{title:"parent 1-0",key:"0-0-0",children:[{title:"leaf",key:"0-0-0-0"},{title:"leaf",key:"0-0-0-1"},{title:"leaf",key:"0-0-0-2"}]},{title:"parent 1-1",key:"0-0-1",children:[{title:"leaf",key:"0-0-1-0"}]},{title:"parent 1-2",key:"0-0-2",children:[{title:"leaf",key:"0-0-2-0"},{title:"leaf",key:"0-0-2-1"}]}]}];var i=()=>(0,a.jsx)(r.Tree,{showLine:!0,switcherIcon:(0,a.jsx)(n.DownOutlined,{}),defaultExpandedKeys:["0-0-0"],onSelect:(e,t)=>{console.log("selected",e,t);},treeData:d});},c61f2006:function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return d;}});var a=l("f19d2b93");l("a5777f2d");var n=l("a9d1a279");let r=[{title:"parent 1",key:"0-0",children:[{title:"parent 1-0",key:"0-0-0",disabled:!0,children:[{title:"leaf",key:"0-0-0-0",disableCheckbox:!0},{title:"leaf",key:"0-0-0-1"}]},{title:"parent 1-1",key:"0-0-1",children:[{title:(0,a.jsx)("span",{style:{color:"#1677ff"},children:"sss"}),key:"0-0-1-0"}]}]}];var d=()=>(0,a.jsx)(n.Tree,{checkable:!0,defaultExpandedKeys:["0-0-0","0-0-1"],defaultSelectedKeys:["0-0-0","0-0-1"],defaultCheckedKeys:["0-0-0","0-0-1"],onSelect:(e,t)=>{console.log("selected",e,t);},onCheck:(e,t)=>{console.log("onCheck",e,t);},treeData:r});},cb41dfd9:function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return i;}});var a=l("f19d2b93");l("5f56afff");var n=l("e22febe0"),r=l("a9d1a279");let d=[{title:"parent 1",key:"0-0",icon:(0,a.jsx)(n.SmileOutlined,{}),children:[{title:"leaf",key:"0-0-0",icon:(0,a.jsx)(n.MehOutlined,{})},{title:"leaf",key:"0-0-1",icon:({selected:e})=>e?(0,a.jsx)(n.FrownFilled,{}):(0,a.jsx)(n.FrownOutlined,{})}]}];var i=()=>(0,a.jsx)(r.Tree,{showIcon:!0,defaultExpandAll:!0,defaultSelectedKeys:["0-0-0"],switcherIcon:(0,a.jsx)(n.DownOutlined,{}),treeData:d});},e0fe18e2:function(e,t,l){"use strict";l.d(t,"__esModule",{value:!0}),l.d(t,"default",{enumerable:!0,get:function(){return s;}});var a=l("f19d2b93");l("7cfb1cfe");var n=l("5b220c3d"),r=l("a9d1a279");let d=[{title:"Expand to load",key:"0"},{title:"Expand to load",key:"1"},{title:"Tree Node",key:"2",isLeaf:!0}],i=(e,t,l)=>e.map(e=>e.key===t?{...e,children:l}:e.children?{...e,children:i(e.children,t,l)}:e);var s=()=>{let[e,t]=(0,n.useState)(d);return(0,a.jsx)(r.Tree,{loadData:({key:e,children:l})=>new Promise(a=>{if(l){a();return;}setTimeout(()=>{t(t=>i(t,e,[{title:"Child Node",key:`${e}-0`},{title:"Child Node",key:`${e}-1`}])),a();},1e3);}),treeData:e});};}}]); |