👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
14 KiB

(globalThis.utooChunk_ant_design_pro||(globalThis.utooChunk_ant_design_pro=[])).push(["object"==typeof document?document.currentScript:void 0,26486,e=>{"use strict";var t=e.i(391398),l=e.i(927494),r=e.i(977892),i=e.i(191788),n={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"}}]},name:"message",theme:"outlined"},a=e.i(117716);function s(){return(s=Object.assign.bind()).apply(this,arguments)}let o=i.forwardRef((e,t)=>i.createElement(a.default,s({},e,{ref:t,icon:n})));var d={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z"}}]},name:"star",theme:"outlined"};function c(){return(c=Object.assign.bind()).apply(this,arguments)}let u=i.forwardRef((e,t)=>i.createElement(a.default,c({},e,{ref:t,icon:d})));var h=e.i(82275),f=e.i(313367),g=e.i(946077),p=e.i(76820),m=e.i(900195),x=e.i(882474),y=e.i(326440),w=e.i(245538),v=e.i(847942),j=e.i(543330),b=e.i(157413),M=e.i(184897),F=e.i(535898);async function C(e){return(0,F.request)("/api/fake_list",{params:e})}let L=(0,e.i(827830).createStyles)(({token:e})=>({listItemMetaTitle:{color:e.colorTextHeading},listItemExtra:{width:"272px",height:"1px",[`@media screen and (max-width: ${e.screenLG}px)`]:{width:"0",height:"1px"}},selfTrigger:{marginLeft:"12px",[`@media screen and (max-width: ${e.screenXS}px)`]:{display:"block",marginLeft:"0"},[`@media screen and (max-width: ${e.screenMD}px)`]:{display:"block",marginLeft:"0"}}})),R=x.Form.Item,S=({type:e,text:r})=>{switch(e){case"star-o":return(0,t.jsxs)("span",{children:[(0,t.jsx)(u,{style:{marginRight:8}}),r]});case"like-o":return(0,t.jsxs)("span",{children:[(0,t.jsx)(l.LikeOutlined,{style:{marginRight:8}}),r]});case"message":return(0,t.jsxs)("span",{children:[(0,t.jsx)(o,{style:{marginRight:8}}),r]});default:return null}};var k=()=>{let[e]=x.Form.useForm(),{styles:l}=L(),n=(0,i.useRef)({}),{data:a,isLoading:s,isFetching:o,refetch:d}=(0,h.useQuery)({queryKey:["search-articles",5,n.current],queryFn:()=>C({count:5,...n.current}).then(e=>e.data)}),c=a?.list||[],u=[{id:"wzj",name:"我自己"},{id:"wjh",name:"吴家豪"},{id:"zxx",name:"周星星"},{id:"zly",name:"赵丽颖"},{id:"ym",name:"姚明"}],F={wrapperCol:{xs:{span:24},sm:{span:24},md:{span:12}}},k=c.length>0&&(0,t.jsx)("div",{style:{textAlign:"center",marginTop:16},children:(0,t.jsx)(f.Button,{onClick:()=>{d()},style:{paddingLeft:48,paddingRight:48},children:o?(0,t.jsxs)("span",{children:[(0,t.jsx)(r.LoadingOutlined,{})," 加载中..."]}):"加载更多"})}),$=(0,i.useMemo)(()=>u.map(e=>({label:e.name,value:e.id})),[]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Card,{variant:"borderless",children:(0,t.jsxs)(x.Form,{layout:"inline",form:e,initialValues:{owner:["wjh","zxx"]},onValuesChange:()=>{n.current=e.getFieldsValue(),d()},children:[(0,t.jsx)(b.StandardFormRow,{title:"所属类目",block:!0,style:{paddingBottom:11},children:(0,t.jsx)(R,{name:"category",children:(0,t.jsx)(b.TagSelect,{expandable:!0,children:M.categoryOptions.filter(e=>void 0!==e.value&&null!==e.value).map(e=>(0,t.jsx)(b.TagSelect.Option,{value:e.value,children:e.label},e.value))})})}),(0,t.jsxs)(b.StandardFormRow,{title:"owner",grid:!0,children:[(0,t.jsx)(R,{name:"owner",noStyle:!0,children:(0,t.jsx)(v.Select,{mode:"multiple",placeholder:"选择 owner",style:{minWidth:"6rem"},options:$})}),(0,t.jsx)("a",{className:l.selfTrigger,onClick:()=>{e.setFieldsValue({owner:["wzj"]})},children:"只看自己的"})]}),(0,t.jsx)(b.StandardFormRow,{title:"其它选项",grid:!0,last:!0,children:(0,t.jsxs)(w.Row,{gutter:16,children:[(0,t.jsx)(p.Col,{xl:8,lg:10,md:12,sm:24,xs:24,children:(0,t.jsx)(R,{...F,label:"活跃用户",name:"user",children:(0,t.jsx)(v.Select,{placeholder:"不限",style:{maxWidth:200,width:"100%"},options:[{label:"李三",value:"lisa"}]})})}),(0,t.jsx)(p.Col,{xl:8,lg:10,md:12,sm:24,xs:24,children:(0,t.jsx)(R,{...F,label:"好评度",name:"rate",children:(0,t.jsx)(v.Select,{placeholder:"不限",style:{maxWidth:200,width:"100%"},options:[{label:"优秀",value:"good"}]})})})]})})]})}),(0,t.jsx)(g.Card,{style:{marginTop:24},variant:"borderless",styles:{body:{padding:"8px 32px 32px 32px"}},children:(0,t.jsx)(y.List,{size:"large",loading:s,rowKey:"id",itemLayout:"vertical",loadMore:k,dataSource:c,renderItem:e=>(0,t.jsxs)(y.List.Item,{actions:[(0,t.jsx)(S,{type:"star-o",text:e.star},"star"),(0,t.jsx)(S,{type:"like-o",text:e.like},"like"),(0,t.jsx)(S,{type:"message",text:e.message},"message")],extra:(0,t.jsx)("div",{className:l.listItemExtra}),children:[(0,t.jsx)(y.List.Item.Meta,{title:(0,t.jsx)("a",{className:l.listItemMetaTitle,href:e.href,children:e.title}),description:(0,t.jsxs)(m.Flex,{wrap:!0,gap:"small",children:[(0,t.jsx)(j.Tag,{children:"Ant Design"}),(0,t.jsx)(j.Tag,{children:"设计语言"}),(0,t.jsx)(j.Tag,{children:"蚂蚁集团"})]})}),(0,t.jsx)(b.ArticleListContent,{data:e})]},e.id)})})]})};e.s(["default",()=>k],26486)},76820,245538,e=>{"use strict";var t=e.i(84443).Col;e.s(["Col",()=>t],76820);var l=e.i(247699).Row;e.s(["Row",()=>l],245538)},184897,e=>{"use strict";let t=Array.from({length:12}).map((e,t)=>({value:`cat${t+1}`,label:`类目${t+1}`}));e.s(["categoryOptions",0,t])},749344,236107,e=>{"use strict";var t=e.i(191788),l=e.i(316419),r=e.i(938667);let i=e=>"object"==typeof e&&null!=e&&1===e.nodeType,n=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,a=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let l,r=getComputedStyle(e,null);return n(r.overflowY,t)||n(r.overflowX,t)||!!(l=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e))&&(l.clientHeight<e.scrollHeight||l.clientWidth<e.scrollWidth)}return!1},s=(e,t,l,r,i,n,a,s)=>n<e&&a>t||n>e&&a<t?0:n<=e&&s<=l||a>=t&&s>=l?n-e-r:a>t&&s<l||n<e&&s>l?a-t+i:0,o=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t},d=(e,t)=>{var l,r,n,d;let c;if("u"<typeof document)return[];let{scrollMode:u,block:h,inline:f,boundary:g,skipOverflowHiddenElements:p}=t,m="function"==typeof g?g:e=>e!==g;if(!i(e))throw TypeError("Invalid target");let x=document.scrollingElement||document.documentElement,y=[],w=e;for(;i(w)&&m(w);){if((w=o(w))===x){y.push(w);break}null!=w&&w===document.body&&a(w)&&!a(document.documentElement)||null!=w&&a(w,p)&&y.push(w)}let v=null!=(r=null==(l=window.visualViewport)?void 0:l.width)?r:innerWidth,j=null!=(d=null==(n=window.visualViewport)?void 0:n.height)?d:innerHeight,{scrollX:b,scrollY:M}=window,{height:F,width:C,top:L,right:R,bottom:S,left:k}=e.getBoundingClientRect(),{top:$,right:T,bottom:E,left:I}={top:parseFloat((c=window.getComputedStyle(e)).scrollMarginTop)||0,right:parseFloat(c.scrollMarginRight)||0,bottom:parseFloat(c.scrollMarginBottom)||0,left:parseFloat(c.scrollMarginLeft)||0},N="start"===h||"nearest"===h?L-$:"end"===h?S+E:L+F/2-$+E,W="center"===f?k+C/2-I+T:"end"===f?R+T:k-I,_=[];for(let e=0;e<y.length;e++){let t=y[e],{height:l,width:r,top:i,right:n,bottom:o,left:d}=t.getBoundingClientRect();if("if-needed"===u&&L>=0&&k>=0&&S<=j&&R<=v&&(t===x&&!a(t)||L>=i&&S<=o&&k>=d&&R<=n))break;let c=getComputedStyle(t),g=parseInt(c.borderLeftWidth,10),p=parseInt(c.borderTopWidth,10),m=parseInt(c.borderRightWidth,10),w=parseInt(c.borderBottomWidth,10),$=0,T=0,E="offsetWidth"in t?t.offsetWidth-t.clientWidth-g-m:0,I="offsetHeight"in t?t.offsetHeight-t.clientHeight-p-w:0,H="offsetWidth"in t?0===t.offsetWidth?0:r/t.offsetWidth:0,z="offsetHeight"in t?0===t.offsetHeight?0:l/t.offsetHeight:0;if(x===t)$="start"===h?N:"end"===h?N-j:"nearest"===h?s(M,M+j,j,p,w,M+N,M+N+F,F):N-j/2,T="start"===f?W:"center"===f?W-v/2:"end"===f?W-v:s(b,b+v,v,g,m,b+W,b+W+C,C),$=Math.max(0,$+M),T=Math.max(0,T+b);else{$="start"===h?N-i-p:"end"===h?N-o+w+I:"nearest"===h?s(i,o,l,p,w+I,N,N+F,F):N-(i+l/2)+I/2,T="start"===f?W-d-g:"center"===f?W-(d+r/2)+E/2:"end"===f?W-n+m+E:s(d,n,r,g,m+E,W,W+C,C);let{scrollLeft:e,scrollTop:a}=t;$=0===z?0:Math.max(0,Math.min(a+$/z,t.scrollHeight-l/z+I)),T=0===H?0:Math.max(0,Math.min(e+T/H,t.scrollWidth-r/H+E)),N+=a-$,W+=e-T}_.push({el:t,top:$,left:T})}return _},c=["parentNode"];function u(e){return void 0===e||!1===e?[]:Array.isArray(e)?e:[e]}function h(e,t){if(!e.length)return;let l=e.join("_");return t?`${t}_${l}`:c.includes(l)?`form_item_${l}`:l}function f(e){return u(e).join("_")}function g(e,t){let l=t.getFieldInstance(e),i=(0,r.getDOM)(l);if(i)return i;let n=h(u(e),t.__INTERNAL__.name);if(n)return document.getElementById(n)}e.s(["getFieldId",0,h,"getStatus",0,function(e,t,l,r,i,n){let a=r;return void 0!==n?a=n:l.validating?a="validating":e.length?a="error":t.length?a="warning":(l.touched||i&&l.validated)&&(a="success"),a},"toArray",0,u],236107),e.s(["default",0,function(e){let[r]=(0,l.useForm)(),i=t.useRef({}),n=t.useMemo(()=>e??{...r,__INTERNAL__:{itemRef:e=>t=>{let l=f(e);t?i.current[l]=t:delete i.current[l]}},scrollToField:(e,t={})=>{let{focus:l,...r}=t,i=g(e,n);i&&(!function(e,t){let l;if(!e.isConnected||!(e=>{let t=e;for(;t&&t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}return!1})(e))return;let r={top:parseFloat((l=window.getComputedStyle(e)).scrollMarginTop)||0,right:parseFloat(l.scrollMarginRight)||0,bottom:parseFloat(l.scrollMarginBottom)||0,left:parseFloat(l.scrollMarginLeft)||0};if("object"==typeof t&&"function"==typeof t.behavior)return t.behavior(d(e,t));let i="boolean"==typeof t||null==t?void 0:t.behavior;for(let{el:l,top:n,left:a}of d(e,!1===t?{block:"end",inline:"nearest"}:t===Object(t)&&0!==Object.keys(t).length?t:{block:"start",inline:"nearest"})){let e=n-r.top+r.bottom,t=a-r.left+r.right;l.scroll({top:e,left:t,behavior:i})}}(i,{scrollMode:"if-needed",block:"nearest",...r}),l&&n.focusField(e))},focusField:e=>{let t=n.getFieldInstance(e);"function"==typeof t?.focus?t.focus():g(e,n)?.focus?.()},getFieldInstance:e=>{let t=f(e);return i.current[t]}},[e,r]);return[n]},"toNamePathStr",0,f],749344)},900195,e=>{"use strict";var t=e.i(191788),l=e.i(151304),r=e.i(56206),i=e.i(239988),n=e.i(497630),a=e.i(934854),s=e.i(993175),o=e.i(352050),d=e.i(108314);let c=["wrap","nowrap","wrap-reverse"],u=["flex-start","flex-end","start","end","center","space-between","space-around","space-evenly","stretch","normal","left","right"],h=["center","start","end","flex-start","flex-end","self-start","self-end","baseline","normal","stretch"];var f=(0,o.genStyleHooks)("Flex",e=>{let{paddingXS:t,padding:l,paddingLG:r}=e,i=(0,d.mergeToken)(e,{flexGapSM:t,flexGap:l,flexGapLG:r});return[(e=>{let{componentCls:t}=e;return{[t]:{display:"flex",margin:0,padding:0,"&-vertical":{flexDirection:"column"},"&-rtl":{direction:"rtl"},"&:empty":{display:"none"}}}})(i),(e=>{let{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-medium, &-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}})(i),(e=>{let{componentCls:t}=e,l={};return c.forEach(e=>{l[`${t}-wrap-${e}`]={flexWrap:e}}),l})(i),(e=>{let{componentCls:t}=e,l={};return h.forEach(e=>{l[`${t}-align-${e}`]={alignItems:e}}),l})(i),(e=>{let{componentCls:t}=e,l={};return u.forEach(e=>{l[`${t}-justify-${e}`]={justifyContent:e}}),l})(i)]},()=>({}),{resetStyle:!1});let g=t.default.forwardRef((e,o)=>{var d;let g,p,m,{prefixCls:x,rootClassName:y,className:w,style:v,flex:j,gap:b,vertical:M,orientation:F,component:C="div",children:L,...R}=e,{flex:S,direction:k,getPrefixCls:$}=t.default.useContext(s.ConfigContext),T=$("flex",x),[E,I]=f(T),[,N]=(0,n.useOrientation)(F,M??S?.vertical),W=(0,r.clsx)(w,y,S?.className,T,E,I,(d={...e,vertical:N},(0,r.clsx)({...(g=!0===d.wrap?"wrap":d.wrap,{[`${T}-wrap-${g}`]:g&&c.includes(g)}),...(p={},h.forEach(e=>{p[`${T}-align-${e}`]=d.align===e}),p[`${T}-align-stretch`]=!d.align&&!!d.vertical,p),...(m={},u.forEach(e=>{m[`${T}-justify-${e}`]=d.justify===e}),m)})),{[`${T}-rtl`]:"rtl"===k,[`${T}-gap-${b}`]:(0,i.isPresetSize)(b),[`${T}-vertical`]:N}),_={...S?.style,...v};return(0,a.isNonNullable)(j)&&(_.flex=j),(0,a.isNonNullable)(b)&&!(0,i.isPresetSize)(b)&&(_.gap=b),t.default.createElement(C,{ref:o,className:W,style:_,...(0,l.omit)(R,["justify","wrap","align"])},L)});e.s(["Flex",()=>g],900195)},927494,e=>{"use strict";var t=e.i(191788),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 00-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 00471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0142.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"}}]},name:"like",theme:"outlined"},r=e.i(117716);function i(){return(i=Object.assign.bind()).apply(this,arguments)}let n=t.forwardRef((e,n)=>t.createElement(r.default,i({},e,{ref:n,icon:l})));e.s(["LikeOutlined",()=>n],927494)},977892,e=>{"use strict";var t=e.i(677057);e.s(["LoadingOutlined",()=>t.default])}]);