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
13 KiB
1 lines
13 KiB
(globalThis.utooChunk_ant_design_pro||(globalThis.utooChunk_ant_design_pro=[])).push(["object"==typeof document?document.currentScript:void 0,82275,e=>{"use strict";let t;var r=e.i(879971),s=e.i(114070),i=e.i(465235),n=e.i(84813),a=e.i(895564),o=e.i(492363),l=e.i(456298),u=e.i(974233),c=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,o.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#s=void 0;#i=void 0;#n=void 0;#a;#o;#r;#t;#l;#u;#c;#h;#d;#p;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#s.addObserver(this),h(this.#s,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#s,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#s,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#g(),this.#s.removeObserver(this)}setOptions(e){let t=this.options,r=this.#s;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,l.resolveQueryBoolean)(this.options.enabled,this.#s))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#R(),this.#s.setOptions(this.options),t._defaulted&&!(0,l.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#s,observer:this});let s=this.hasListeners();s&&p(this.#s,r,this.options,t)&&this.#m(),this.updateResult(),s&&(this.#s!==r||(0,l.resolveQueryBoolean)(this.options.enabled,this.#s)!==(0,l.resolveQueryBoolean)(t.enabled,this.#s)||(0,l.resolveStaleTime)(this.options.staleTime,this.#s)!==(0,l.resolveStaleTime)(t.staleTime,this.#s))&&this.#x();let i=this.#b();s&&(this.#s!==r||(0,l.resolveQueryBoolean)(this.options.enabled,this.#s)!==(0,l.resolveQueryBoolean)(t.enabled,this.#s)||i!==this.#p)&&this.#Q(i)}getOptimisticResult(e){var t,r;let s=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(s,e);return t=this,r=i,(0,l.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#n=i,this.#o=this.options,this.#a=this.#s.state),i}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#f.add(e)}getCurrentQuery(){return this.#s}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#m(e){this.#R();let t=this.#s.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l.noop)),t}#x(){this.#v();let e=(0,l.resolveStaleTime)(this.options.staleTime,this.#s);if(s.environmentManager.isServer()||this.#n.isStale||!(0,l.isValidTimeout)(e))return;let t=(0,l.timeUntilStale)(this.#n.dataUpdatedAt,e);this.#h=u.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t+1)}#b(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#s):this.options.refetchInterval)??!1}#Q(e){this.#g(),this.#p=e,!s.environmentManager.isServer()&&!1!==(0,l.resolveQueryBoolean)(this.options.enabled,this.#s)&&(0,l.isValidTimeout)(this.#p)&&0!==this.#p&&(this.#d=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||r.focusManager.isFocused())&&this.#m()},this.#p))}#y(){this.#x(),this.#Q(this.#b())}#v(){void 0!==this.#h&&(u.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#g(){void 0!==this.#d&&(u.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let r,s=this.#s,i=this.options,a=this.#n,u=this.#a,c=this.#o,d=e!==s?e.state:this.#i,{state:m}=e,y={...m},v=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&h(e,t),o=r&&p(e,s,t,i);(a||o)&&(y={...y,...(0,n.fetchState)(m.data,e.options)}),"isRestoring"===t._optimisticResults&&(y.fetchStatus="idle")}let{error:g,errorUpdatedAt:R,status:x}=y;r=y.data;let b=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===x){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,b=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#c?.state.data,this.#c):t.placeholderData,void 0!==e&&(x="success",r=(0,l.replaceData)(a?.data,e,t),v=!0)}if(t.select&&void 0!==r&&!b)if(a&&r===u?.data&&t.select===this.#l)r=this.#u;else try{this.#l=t.select,r=t.select(r),r=(0,l.replaceData)(a?.data,r,t),this.#u=r,this.#t=null}catch(e){this.#t=e}this.#t&&(g=this.#t,r=this.#u,R=Date.now(),x="error");let Q="fetching"===y.fetchStatus,T="pending"===x,I="error"===x,w=T&&Q,S=void 0!==r,O={status:x,fetchStatus:y.fetchStatus,isPending:T,isSuccess:"success"===x,isError:I,isInitialLoading:w,isLoading:w,data:r,dataUpdatedAt:y.dataUpdatedAt,error:g,errorUpdatedAt:R,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>d.dataUpdateCount||y.errorUpdateCount>d.errorUpdateCount,isFetching:Q,isRefetching:Q&&!T,isLoadingError:I&&!S,isPaused:"paused"===y.fetchStatus,isPlaceholderData:v,isRefetchError:I&&S,isStale:f(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,l.resolveQueryBoolean)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==O.data,r="error"===O.status&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},n=()=>{i(this.#r=O.promise=(0,o.pendingThenable)())},a=this.#r;switch(a.status){case"pending":e.queryHash===s.queryHash&&i(a);break;case"fulfilled":(r||O.data!==a.value)&&n();break;case"rejected":r&&O.error===a.reason||n()}}return O}updateResult(){let e=this.#n,t=this.createResult(this.#s,this.options);if(this.#a=this.#s.state,this.#o=this.options,void 0!==this.#a.data&&(this.#c=this.#s),(0,l.shallowEqualObjects)(t,e))return;this.#n=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#f.size)return!0;let s=new Set(r??this.#f);return this.options.throwOnError&&s.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&s.has(t))};this.#T({listeners:r()})}#R(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#s)return;let t=this.#s;this.#s=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#T(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#s,type:"observerResultsUpdated"})})}};function h(e,t){return!1!==(0,l.resolveQueryBoolean)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==(0,l.resolveQueryBoolean)(t.retryOnMount,e))||void 0!==e.state.data&&d(e,t,t.refetchOnMount)}function d(e,t,r){if(!1!==(0,l.resolveQueryBoolean)(t.enabled,e)&&"static"!==(0,l.resolveStaleTime)(t.staleTime,e)){let s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&f(e,t)}return!1}function p(e,t,r,s){return(e!==t||!1===(0,l.resolveQueryBoolean)(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&f(e,r)}function f(e,t){return!1!==(0,l.resolveQueryBoolean)(t.enabled,e)&&e.isStaleByTime((0,l.resolveStaleTime)(t.staleTime,e))}var m=e.i(191788),y=e.i(755224);e.i(391398);var v=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),g=m.createContext(!1);g.Provider;var R=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});e.s(["useQuery",0,function(e,t){return function(e,t,r){var n,a,o,u;let c,h=m.useContext(g),d=m.useContext(v),p=(0,y.useQueryClient)(r),f=p.defaultQueryOptions(e);null==(a=null==(n=p.getDefaultOptions().queries)?void 0:n._experimental_beforeQuery)||a.call(n,f);let x=p.getQueryCache().get(f.queryHash);if(f._optimisticResults=h?"isRestoring":"optimistic",f.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=f.staleTime;f.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof f.gcTime&&(f.gcTime=Math.max(f.gcTime,1e3))}c=(null==x?void 0:x.state.error)&&"function"==typeof f.throwOnError?(0,l.shouldThrowError)(f.throwOnError,[x.state.error,x]):f.throwOnError,(f.suspense||f.experimental_prefetchInRender||c)&&!d.isReset()&&(f.retryOnMount=!1),m.useEffect(()=>{d.clearReset()},[d]);let b=!p.getQueryCache().get(f.queryHash),[Q]=m.useState(()=>new t(p,f)),T=Q.getOptimisticResult(f),I=!h&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=I?Q.subscribe(i.notifyManager.batchCalls(e)):l.noop;return Q.updateResult(),t},[Q,I]),()=>Q.getCurrentResult(),()=>Q.getCurrentResult()),m.useEffect(()=>{Q.setOptions(f)},[f,Q]),(null==f?void 0:f.suspense)&&T.isPending)throw R(f,Q,d);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&void 0===e.data||(0,l.shouldThrowError)(r,[e.error,s])))({result:T,errorResetBoundary:d,throwOnError:f.throwOnError,query:x,suspense:f.suspense}))throw T.error;if(null==(u=null==(o=p.getDefaultOptions().queries)?void 0:o._experimental_afterQuery)||u.call(o,f,T),f.experimental_prefetchInRender&&!s.environmentManager.isServer()&&T.isLoading&&T.isFetching&&!h){let e=b?R(f,Q,d):null==x?void 0:x.promise;null==e||e.catch(l.noop).finally(()=>{Q.updateResult()})}return f.notifyOnChangeProps?T:Q.trackResult(T)}(e,c,t)}],82275)},733952,e=>{"use strict";var t=e.i(391398),r=e.i(360618),s=e.i(203112),i=e.i(82275),n=e.i(313367),a=e.i(946077),o=e.i(326440),l=e.i(560370);e.i(113297);var u=e.i(134124);async function c(e){return(0,u.request)("/api/card_fake_list",{params:e})}let h=(0,e.i(827830).createStyles)(({token:e})=>({card:{".ant-card-meta-title":{marginBottom:"12px","& > a":{display:"inline-block",maxWidth:"100%",color:e.colorTextHeading}},".ant-card-body:hover":{".ant-card-meta-title > a":{color:e.colorPrimary}}},item:{height:"64px"},cardList:{".ant-list .ant-list-item-content-single":{maxWidth:"100%"}},extraImg:{width:"155px",marginTop:"-20px",textAlign:"center",img:{width:"100%"},[`@media screen and (max-width: ${e.screenMD}px)`]:{display:"none"}},newButton:{width:"100%",height:"201px",color:e.colorTextSecondary,backgroundColor:e.colorBgContainer,borderColor:e.colorBorder},cardAvatar:{width:"48px",height:"48px",borderRadius:"48px"},cardDescription:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",wordBreak:"break-all"},pageHeaderContent:{position:"relative",overflow:"visible",[`@media screen and (max-width: ${e.screenSM}px)`]:{paddingBottom:"30px"}},contentLink:{display:"flex",flexWrap:"nowrap",marginTop:"16px",a:{display:"inline-flex",alignItems:"center",marginRight:"32px",whiteSpace:"nowrap",img:{width:"24px",flexShrink:0}},img:{marginRight:"8px"},[`@media screen and (max-width: ${e.screenLG}px)`]:{a:{marginRight:"16px"}},[`@media screen and (max-width: ${e.screenSM}px)`]:{position:"absolute",bottom:"-4px",left:"0",width:"1000px",a:{marginRight:"16px"},img:{marginRight:"4px"}}}})),{Paragraph:d}=l.Typography;var p=()=>{let{styles:e}=h(),{data:l,isLoading:u}=(0,i.useQuery)({queryKey:["card-list"],queryFn:()=>c({count:8}).then(e=>e.data)}),p=l?.list||[],f=(0,t.jsxs)("div",{className:e.pageHeaderContent,children:[(0,t.jsx)("p",{children:"段落示意:蚂蚁集团设计平台 ant.design,用最小的工作量,无缝接入蚂蚁集团生态, 提供跨越设计与开发的体验解决方案。"}),(0,t.jsxs)("div",{className:e.contentLink,children:[(0,t.jsxs)("a",{children:[(0,t.jsx)("img",{alt:"",src:"https://gw.alipayobjects.com/zos/rmsportal/MjEImQtenlyueSmVEfUD.svg"})," ","快速开始"]}),(0,t.jsxs)("a",{children:[(0,t.jsx)("img",{alt:"",src:"https://gw.alipayobjects.com/zos/rmsportal/NbuDUAuBlIApFuDvWiND.svg"})," ","产品简介"]}),(0,t.jsxs)("a",{children:[(0,t.jsx)("img",{alt:"",src:"https://gw.alipayobjects.com/zos/rmsportal/ohOEPSYdDTNnyMbGuyLb.svg"})," ","产品文档"]})]})]}),m=(0,t.jsx)("div",{className:e.extraImg,children:(0,t.jsx)("img",{alt:"这是一个标题",src:"https://gw.alipayobjects.com/zos/rmsportal/RzwpdLnhmvDJToTdfDPe.png"})});return(0,t.jsx)(s.PageContainer,{content:f,extraContent:m,children:(0,t.jsx)("div",{className:e.cardList,children:(0,t.jsx)(o.List,{rowKey:"id",loading:u,grid:{gutter:16,xs:1,sm:2,md:3,lg:3,xl:4,xxl:4},dataSource:[{},...p],renderItem:s=>s?.id?(0,t.jsx)(o.List.Item,{children:(0,t.jsx)(a.Card,{hoverable:!0,className:e.card,actions:[(0,t.jsx)("a",{children:"操作一"},"option1"),(0,t.jsx)("a",{children:"操作二"},"option2")],children:(0,t.jsx)(a.Card.Meta,{avatar:(0,t.jsx)("img",{alt:"",className:e.cardAvatar,src:s.avatar}),title:(0,t.jsx)("a",{children:s.title}),description:(0,t.jsx)(d,{className:e.item,ellipsis:{rows:3},children:s.description})})})},s.id):(0,t.jsx)(o.List.Item,{children:(0,t.jsxs)(n.Button,{type:"dashed",className:e.newButton,children:[(0,t.jsx)(r.PlusOutlined,{})," 新增产品"]})})})})})};e.s(["default",()=>p],733952)}]);
|