@refinedev/antd 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/dist/components/pages/index.d.cts +0 -2
- package/dist/components/pages/index.d.cts.map +1 -1
- package/dist/components/pages/index.d.mts +0 -2
- package/dist/components/pages/index.d.mts.map +0 -2
- package/dist/components/pages/index.d.ts +0 -2
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/definitions/table/index.d.cts +0 -3
- package/dist/definitions/table/index.d.cts.map +1 -1
- package/dist/definitions/table/index.d.mts +0 -3
- package/dist/definitions/table/index.d.mts.map +0 -3
- package/dist/definitions/table/index.d.ts +0 -3
- package/dist/definitions/table/index.d.ts.map +1 -1
- package/dist/hooks/index.d.cts +0 -1
- package/dist/hooks/index.d.cts.map +1 -1
- package/dist/hooks/index.d.mts +0 -1
- package/dist/hooks/index.d.mts.map +0 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/index.cjs +4162 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4331 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/src/components/pages/index.tsx +0 -2
- package/src/definitions/table/index.ts +0 -3
- package/src/hooks/index.ts +0 -1
- package/tsconfig.json +1 -1
- package/vitest.config.mts +43 -0
- package/dist/components/pages/login/index.d.cts +0 -15
- package/dist/components/pages/login/index.d.cts.map +0 -1
- package/dist/components/pages/login/index.d.mts +0 -15
- package/dist/components/pages/login/index.d.mts.map +0 -15
- package/dist/components/pages/login/index.d.ts +0 -15
- package/dist/components/pages/login/index.d.ts.map +0 -1
- package/dist/components/pages/login/styles.d.cts +0 -6
- package/dist/components/pages/login/styles.d.cts.map +0 -1
- package/dist/components/pages/login/styles.d.mts +0 -6
- package/dist/components/pages/login/styles.d.mts.map +0 -6
- package/dist/components/pages/login/styles.d.ts +0 -6
- package/dist/components/pages/login/styles.d.ts.map +0 -1
- package/dist/components/pages/ready/index.d.cts +0 -9
- package/dist/components/pages/ready/index.d.cts.map +0 -1
- package/dist/components/pages/ready/index.d.mts +0 -9
- package/dist/components/pages/ready/index.d.mts.map +0 -9
- package/dist/components/pages/ready/index.d.ts +0 -9
- package/dist/components/pages/ready/index.d.ts.map +0 -1
- package/dist/hooks/useSiderVisible/index.d.cts +0 -11
- package/dist/hooks/useSiderVisible/index.d.cts.map +0 -1
- package/dist/hooks/useSiderVisible/index.d.mts +0 -11
- package/dist/hooks/useSiderVisible/index.d.mts.map +0 -11
- package/dist/hooks/useSiderVisible/index.d.ts +0 -11
- package/dist/hooks/useSiderVisible/index.d.ts.map +0 -1
- package/src/components/pages/login/index.tsx +0 -147
- package/src/components/pages/login/styles.ts +0 -25
- package/src/components/pages/ready/index.tsx +0 -87
- package/src/hooks/useSiderVisible/index.ts +0 -29
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4333 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
var bt=Object.defineProperty;var o=(e,r)=>bt(e,"name",{value:r,configurable:!0});import Pt from"react";import{Form as xt}from"antd";import{useForm as Ft}from"sunflower-antd";import{flattenObjectKeys as ht,propertyPathToArray as vr,useForm as Ct,useWarnAboutChange as Bt,useTranslate as St,useRefineContext as Et}from"@refinedev/core";var de=o(({action:e,resource:r,onMutationSuccess:t,onMutationError:s,autoSave:n,submitOnEnter:a=!1,warnWhenUnsavedChanges:p,redirect:i,successNotification:l,errorNotification:u,meta:y,queryMeta:d,mutationMeta:f,liveMode:m,liveParams:c,mutationMode:T,dataProviderName:g,onLiveEvent:P,invalidates:S,undoableTimeout:b,queryOptions:C,createMutationOptions:F,updateMutationOptions:k,id:h,overtimeOptions:v,optimisticUpdateMap:z,defaultFormValues:L,disableServerSideValidation:B=!1}={})=>{var oe,ie;let{options:N}=Et(),X=(N==null?void 0:N.disableServerSideValidation)||B,W=St(),[H]=xt.useForm(),Q=Ft({form:H,defaultFormValues:L}),{form:O}=Q,j=Ct({onMutationSuccess:t||void 0,onMutationError:async(Y,le,Ae)=>{if(X){s==null||s(Y,le,Ae);return}let ce=[],gt=O.getFieldsValue();ce=Object.keys(ht(gt)).map(ze=>({name:vr(ze),errors:void 0})),O.setFields(ce);let Er=Y==null?void 0:Y.errors;for(let ze in Er){let pe=Er[ze],we=[];Array.isArray(pe)&&(we=pe),typeof pe=="string"&&(we=[pe]),typeof pe=="boolean"&&pe&&(we=["Field is not valid."]),typeof pe=="object"&&"key"in pe&&(we=[W(pe.key,pe.message)]),ce.push({name:vr(ze),errors:we})}O.setFields([...ce]),s==null||s(Y,le,Ae)},redirect:i,action:e,resource:r,successNotification:l,errorNotification:u,meta:y,queryMeta:d,mutationMeta:f,liveMode:m,liveParams:c,mutationMode:T,dataProviderName:g,onLiveEvent:P,invalidates:S,undoableTimeout:b,queryOptions:C,createMutationOptions:F,updateMutationOptions:k,id:h,overtimeOptions:v,optimisticUpdateMap:z,autoSave:n}),{formLoading:D,onFinish:q,query:x,id:V,onFinishAutoSave:A}=j,{warnWhenUnsavedChanges:G,setWarnWhen:E}=Bt(),R=p??G;Pt.useEffect(()=>{O.resetFields()},[(oe=x==null?void 0:x.data)==null?void 0:oe.data,V]);let w=o(Y=>{a&&Y.key==="Enter"&&O.submit()},"onKeyUp"),$=o((Y,le)=>{if(Y&&R&&E(!0),n!=null&&n.enabled){E(!1);let Ae=(n==null?void 0:n.onFinish)??(ce=>ce);return A(Ae(le)).catch(ce=>ce)}return Y},"onValuesChange"),ee={disabled:D,onClick:()=>{O.submit()}};return{form:Q.form,formProps:{...Q.formProps,onFinish:Y=>q(Y).catch(le=>le),onKeyUp:w,onValuesChange:$,initialValues:(ie=x==null?void 0:x.data)==null?void 0:ie.data},saveButtonProps:ee,defaultFormValuesLoading:Q.defaultFormValuesLoading,...j,onFinish:async Y=>await q(Y??Q.form.getFieldsValue(!0))}},"useForm");import _e,{useCallback as wr}from"react";import{useTranslate as Dt,useWarnAboutChange as wt,useUserFriendlyName as kt,useResourceParams as Rt,useParsed as Lt,useGo as Vt,useInvalidate as Ut}from"@refinedev/core";import{useModal as vt}from"@refinedev/core";var Dr=o(({modalProps:e={}}={})=>{let{show:r,close:t,visible:s}=vt({defaultVisible:e.open});return{modalProps:{...e,onCancel:n=>{var a;(a=e.onCancel)==null||a.call(e,n),t()},open:s,visible:s},show:r,close:t}},"useModal");var kr=o(({syncWithLocation:e,defaultVisible:r=!1,autoSubmitClose:t=!0,autoResetForm:s=!0,autoResetFormWhenClose:n=!0,autoSave:a,invalidates:p,...i})=>{var R;let[l,u]=_e.useState(!1),y=Ut(),{resource:d,action:f,identifier:m}=Rt({resource:i.resource}),c=Lt(),T=Vt(),g=kt(),P=i.action??f??"",S=!(typeof e=="object"&&(e==null?void 0:e.syncId)===!1),b=typeof e=="object"&&"key"in e?e.key:d&&P&&e?`modal-${m}-${P}`:void 0,C=de({meta:{...b?{[b]:void 0}:{},...i.meta},autoSave:a,invalidates:p,...i}),{form:F,formProps:k,id:h,setId:v,formLoading:z,onFinish:L,autoSaveProps:B}=C,N=Dt(),{warnWhen:X,setWarnWhen:W}=wt(),{show:H,close:Q,modalProps:O}=Dr({modalProps:{open:r}}),j=O.open||!1,D={modalProps:O,form:F,formLoading:z,formProps:k,formResult:void 0,formValues:F.getFieldsValue,defaultFormValuesLoading:!1,initialValues:{},submit:L,close:Q,open:O.open||!1,show:H};_e.useEffect(()=>{var w,$,ee,oe;if(l===!1&&b){let ie=($=(w=c==null?void 0:c.params)==null?void 0:w[b])==null?void 0:$.open;if(typeof ie=="boolean"?ie&&H():typeof ie=="string"&&ie==="true"&&H(),S){let Y=(oe=(ee=c==null?void 0:c.params)==null?void 0:ee[b])==null?void 0:oe.id;Y&&(v==null||v(Y))}u(!0)}},[b,c,S,v]),_e.useEffect(()=>{var w;l===!0&&(j&&b?T({query:{[b]:{...(w=c==null?void 0:c.params)==null?void 0:w[b],open:!0,...S&&h&&{id:h}}},options:{keepQuery:!0},type:"replace"}):b&&!j&&T({query:{[b]:void 0},options:{keepQuery:!0},type:"replace"}))},[h,j,H,b,S]);let q={disabled:z,loading:z,onClick:()=>{F.submit()}},x=wr(()=>{if(B.status==="success"&&(a!=null&&a.invalidateOnClose)&&y({id:h,invalidates:p||["list","many","detail"],dataProviderName:i.dataProviderName,resource:m}),X)if(window.confirm(N("warnWhenUnsavedChanges","Are you sure you want to leave? You have unsaved changes.")))W(!1);else return;v==null||v(void 0),D.close(),n&&F.resetFields()},[X,B.status]),V=wr(w=>{typeof w<"u"&&(v==null||v(w)),(!(P==="edit"||P==="clone")||(typeof w<"u"||typeof h<"u"))&&D.show()},[h]),{visible:A,...G}=O,E={open:A,...G};return{...C,...D,show:V,close:x,open:j,formProps:{...k,...C.formProps,onValuesChange:k==null?void 0:k.onValuesChange,onKeyUp:k==null?void 0:k.onKeyUp,onFinish:async w=>{await L(w),t&&Q(),s&&F.resetFields()}},modalProps:{...E,width:"1000px",okButtonProps:q,title:N(`${m}.titles.${i.action}`,`${g(`${i.action} ${((R=d==null?void 0:d.meta)==null?void 0:R.label)??m}`,"singular")}`),okText:N("buttons.save","Save"),cancelText:N("buttons.cancel","Cancel"),onCancel:x,forceRender:!0},formLoading:z}},"useModalForm");import Xe,{useCallback as Lr}from"react";import{useTranslate as Ht,useWarnAboutChange as Ot,useResourceParams as Mt,useParsed as Qt,useGo as Nt,useInvalidate as At}from"@refinedev/core";import{useModal as It}from"@refinedev/core";var Rr=o(({drawerProps:e={}}={})=>{let{show:r,close:t,visible:s}=It({defaultVisible:e.open});return{drawerProps:{...e,onClose:n=>{var a;(a=e.onClose)==null||a.call(e,n),t()},open:s},show:r,close:t}},"useDrawer");var Vr=o(({syncWithLocation:e,defaultVisible:r=!1,autoSubmitClose:t=!0,autoResetForm:s=!0,autoSave:n,invalidates:a,...p})=>{let i=At(),[l,u]=Xe.useState(!1),{show:y,close:d,drawerProps:f}=Rr({drawerProps:{open:r}}),m=f.open||!1,{resource:c,action:T,identifier:g}=Mt({resource:p.resource}),P=Qt(),S=Nt(),b=p.action??T??"",C=!(typeof e=="object"&&(e==null?void 0:e.syncId)===!1),F=typeof e=="object"&&"key"in e?e.key:c&&b&&e?`drawer-${(c==null?void 0:c.identifier)??(c==null?void 0:c.name)}-${b}`:void 0,k=de({meta:{...F?{[F]:void 0}:{},...p.meta},autoSave:n,invalidates:a,...p}),{form:h,formProps:v,formLoading:z,id:L,setId:B,onFinish:N,autoSaveProps:X}=k;Xe.useEffect(()=>{var x,V,A,G;if(l===!1&&F){let E=(V=(x=P==null?void 0:P.params)==null?void 0:x[F])==null?void 0:V.open;if(typeof E=="boolean"?E?y():d():typeof E=="string"&&E==="true"&&y(),C){let R=(G=(A=P==null?void 0:P.params)==null?void 0:A[F])==null?void 0:G.id;R&&(B==null||B(R))}u(!0)}},[F,P,C,B,l]),Xe.useEffect(()=>{var x;l===!0&&(m&&F?S({query:{[F]:{...(x=P==null?void 0:P.params)==null?void 0:x[F],open:!0,...C&&L&&{id:L}}},options:{keepQuery:!0},type:"replace"}):F&&!m&&S({query:{[F]:void 0},options:{keepQuery:!0},type:"replace"}))},[L,m,y,d,F,C,l]);let W=Ht(),{warnWhen:H,setWarnWhen:Q}=Ot(),O={disabled:z,onClick:()=>{h.submit()},loading:z},j={recordItemId:L,onSuccess:()=>{B==null||B(void 0),d()}},D=Lr(()=>{if(X.status==="success"&&(n!=null&&n.invalidateOnClose)&&i({id:L,invalidates:a||["list","many","detail"],dataProviderName:p.dataProviderName,resource:g}),H)if(window.confirm(W("warnWhenUnsavedChanges","Are you sure you want to leave? You have unsaved changes.")))Q(!1);else return;d(),B==null||B(void 0)},[H]),q=Lr(x=>{typeof x<"u"&&(B==null||B(x)),(!(b==="edit"||b==="clone")||(typeof x<"u"||typeof L<"u"))&&y()},[L]);return{...k,show:q,close:D,formProps:{form:h,...k.formProps,onValuesChange:v==null?void 0:v.onValuesChange,onKeyUp:v==null?void 0:v.onKeyUp,onFinish:async x=>{await N(x),t&&d(),s&&h.resetFields()}},drawerProps:{...f,width:"500px",onClose:D,open:m,forceRender:!0},saveButtonProps:O,deleteButtonProps:j,formLoading:z}},"useDrawerForm");import{useStepsForm as zt}from"sunflower-antd";var Ur=o((e={})=>{let r=de({...e}),{form:t,formProps:s}=r,n=zt({isBackValidate:!1,form:t,submit:a=>{var p;(p=s==null?void 0:s.onFinish)==null||p.call(s,a)},...e});return{...r,...n,formLoading:r.formLoading,formProps:{...n.formProps,...r.formProps,onValuesChange:s==null?void 0:s.onValuesChange,onKeyUp:s==null?void 0:s.onKeyUp},saveButtonProps:{...r.saveButtonProps,onClick:()=>n.submit()}}},"useStepsForm");import Yt,{Children as _t,createElement as je,Fragment as Xt}from"react";import{Grid as Jt,Form as Zt}from"antd";import{useForm as eo}from"sunflower-antd";import{useLiveMode as ro,useTable as to,useSyncWithLocation as oo}from"@refinedev/core";import{getDefaultFilter as jt,getDefaultSortOrder as qt}from"@refinedev/core";var Wt=o((e,r)=>{let t=qt(e,r);if(t)return`${t}end`},"getDefaultSortOrder"),Kt=o((e,r,t="eq")=>jt(e,r,t),"getDefaultFilter"),Je=o(e=>{let r=[];if(Array.isArray(e))e.sort((t,s)=>{var n,a;return(((n=t.column)==null?void 0:n.sorter).multiple??0)<(((a=s.column)==null?void 0:a.sorter).multiple??0)?-1:0}).map(t=>{if(t.field&&t.order){let s=Array.isArray(t.field)?t.field.join("."):`${t.field}`;r.push({field:`${t.columnKey??s}`,order:t.order.replace("end","")})}});else if(e.field&&e.order){let t=Array.isArray(e.field)?e.field.join("."):`${e.field}`;r.push({field:`${e.columnKey??t}`,order:e.order.replace("end","")})}return r},"mapAntdSorterToCrudSorting"),Ze=o((e,r,t)=>{let s=[],n=(t??[]).reduce((a,p)=>{let i=p.key||p.field;return{...a,[i]:p}},{});return Object.keys(e).map(a=>{var l,u;let p=e[a],i=((l=r.filter(y=>y.operator!=="or").find(y=>y.field===a))==null?void 0:l.operator)||((u=n[a])==null?void 0:u.operator);i!=="or"&&i!=="and"&&s.push({field:a,operator:i??(Array.isArray(p)?"in":"eq"),value:p})}),s},"mapAntdFilterToCrudFilter");import{useLink as Gt}from"@refinedev/core";import $t from"react";var fe=o(({to:e,element:r})=>{let t=Gt();return $t.createElement(t,{to:e,replace:!1,onClick:s=>{s.preventDefault()}},r)},"PaginationLink");var er=o(({onSearch:e,pagination:r,filters:t,sorters:s,syncWithLocation:n,resource:a,successNotification:p,errorNotification:i,queryOptions:l,liveMode:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m}={})=>{let{tableQuery:c,currentPage:T,setCurrentPage:g,pageSize:P,setPageSize:S,filters:b,setFilters:C,sorters:F,setSorters:k,createLinkForSyncWithLocation:h,pageCount:v,overtime:z,result:L}=to({pagination:r,filters:t,sorters:s,syncWithLocation:n,resource:a,successNotification:p,errorNotification:i,queryOptions:l,liveMode:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m}),{syncWithLocation:B}=oo(),N=n??B,X=Jt.useBreakpoint(),[W]=Zt.useForm(),H=eo({form:W}),Q=ro(u),O=(r==null?void 0:r.mode)!=="off",j=t==null?void 0:t.initial,{data:D,isFetched:q,isLoading:x}=c;Yt.useEffect(()=>{if(N){let E=H.form.getFieldsValue(),R=Object.keys(E).reduce((w,$)=>{let ee=b.find(oe=>"field"in oe&&oe.field===$);return ee&&(w[$]=ee==null?void 0:ee.value),w},{});H.form.setFieldsValue(R)}},[N]);let V=o((E,R,w)=>{if(R&&Object.keys(R).length>0){let $=Ze(R,b,j);C($)}if(w&&Object.keys(w).length>0){let $=Je(w);k($)}O&&(g==null||g(E.current||1),S==null||S(E.pageSize||10))},"onChange"),A=o(async E=>{if(e){let R=await e(E);C(R),O&&(g==null||g(1))}},"onFinish"),G=o(()=>O?{itemRender:(E,R,w)=>{var ee;let $=h({pagination:{pageSize:P,currentPage:E},sorters:F,filters:b});if(R==="page")return je(fe,{to:$,element:`${E}`});if(R==="next"||R==="prev")return je(fe,{to:$,element:w});if(R==="jump-next"||R==="jump-prev"){let oe=(ee=w==null?void 0:w.props)==null?void 0:ee.children;return je(fe,{to:$,element:_t.count(oe)>1?je(Xt,{},oe):oe})}return w},pageSize:P,current:T,simple:!X.sm,position:X.sm?["bottomRight"]:["bottomCenter"],total:D==null?void 0:D.total}:!1,"antdPagination");return{searchFormProps:{...H.formProps,onFinish:A},tableProps:{dataSource:D==null?void 0:D.data,loading:Q==="auto"?x:!q,onChange:V,pagination:G(),scroll:{x:!0}},tableQuery:c,sorters:F,filters:b,setSorters:k,setFilters:C,currentPage:T,setCurrentPage:g,pageSize:P,setPageSize:S,pageCount:v,createLinkForSyncWithLocation:h,overtime:z,result:L}},"useTable");var so=o(({autoSubmitClose:e=!0,...r}={})=>{let t=er({...r,successNotification:void 0,errorNotification:void 0}),s=de({...r,action:"edit",redirect:!1}),{id:n,setId:a,saveButtonProps:p}=s,i={onClick:()=>{a(void 0)}},l=o(y=>({onClick:()=>a(y)}),"editButtonProps"),u=o(y=>y===n,"isEditing");return{...t,...s,formProps:{...s.formProps,onFinish:async y=>{try{let d=await s.onFinish(y);return e&&a(void 0),d}catch(d){return d}}},saveButtonProps:p,cancelButtonProps:i,editButtonProps:l,isEditing:u}},"useEditableTable");import{useSelect as no}from"@refinedev/core";var Hl=o(e=>{let{query:r,defaultValueQuery:t,onSearch:s,options:n}=no(e);return{selectProps:{options:n,onSearch:s,loading:t.query.isFetching,showSearch:!0,filterOption:!1},query:r,defaultValueQuery:t.query}},"useSelect");import{useSelect as ao}from"@refinedev/core";var Nl=o(({resource:e,sorters:r,filters:t,optionLabel:s,optionValue:n,queryOptions:a,pagination:p,liveMode:i,defaultValue:l,selectedOptionsOrder:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m,...c})=>{let{query:T,options:g}=ao({resource:e,sorters:r,filters:t,optionLabel:s,optionValue:n,queryOptions:a,pagination:p,liveMode:i,defaultValue:l,selectedOptionsOrder:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m,...c});return{checkboxGroupProps:{options:g,defaultValue:l},query:T}},"useCheckboxGroup");import{useSelect as io}from"@refinedev/core";var ql=o(({resource:e,sorters:r,filters:t,optionLabel:s,optionValue:n,queryOptions:a,pagination:p,liveMode:i,defaultValue:l,selectedOptionsOrder:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m,...c})=>{let{query:T,options:g}=io({resource:e,sorters:r,filters:t,optionLabel:s,optionValue:n,queryOptions:a,pagination:p,liveMode:i,defaultValue:l,selectedOptionsOrder:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m,...c});return{radioGroupProps:{options:g,defaultValue:l},query:T}},"useRadioGroup");import rr from"react";import{notification as Ir,Progress as po}from"antd";import{useTranslate as lo,useResourceParams as uo,useImport as mo}from"@refinedev/core";var _l=o(({resource:e,mapData:r=o(l=>l,"mapData"),paparseOptions:t,batchSize:s=Number.MAX_SAFE_INTEGER,onFinish:n,meta:a,dataProviderName:p,onProgress:i}={})=>{let l=lo(),{resource:u}=uo({resource:e}),{mutationResult:y,isLoading:d,handleChange:f}=mo({resource:(u==null?void 0:u.identifier)??(u==null?void 0:u.name),mapData:r,paparseOptions:t,batchSize:s,meta:a,dataProviderName:p,onFinish:n,onProgress:i??(({totalAmount:m,processedAmount:c})=>{if(m>0&&c>0){let T=rr.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"-7px"}},rr.createElement(po,{type:"circle",percent:Math.floor(c/m*100),size:50,strokeColor:"#1890ff",status:"normal"}),rr.createElement("span",{style:{marginLeft:8,width:"100%"}},l("notifications.importProgress",{processed:c,total:m},`Importing: ${c}/${m}`)));Ir.open({description:T,message:null,key:`${u}-import`,duration:0}),c>=m,c===m&&setTimeout(()=>{Ir.destroy(`${u}-import`)},4500)}})});return{uploadProps:{onChange:f,beforeUpload:()=>!1,showUploadList:!1,accept:".csv"},buttonProps:{type:"default",loading:d},mutationResult:y,isLoading:d}},"useImport");import{Children as co,createElement as qe,Fragment as fo}from"react";import{Form as yo,Grid as To}from"antd";import{useTable as go}from"@refinedev/core";import{useLiveMode as bo}from"@refinedev/core";var Po=o(({resource:e,pagination:r,filters:t,sorters:s,onSearch:n,queryOptions:a,syncWithLocation:p,successNotification:i,errorNotification:l,liveMode:u,onLiveEvent:y,liveParams:d,meta:f,dataProviderName:m}={})=>{let{sorters:c,filters:T,currentPage:g,pageSize:P,pageCount:S,setFilters:b,setCurrentPage:C,setPageSize:F,setSorters:k,createLinkForSyncWithLocation:h,tableQuery:v,overtime:z,result:L}=go({resource:e,pagination:r,filters:t,sorters:s,queryOptions:a,successNotification:i,errorNotification:l,liveMode:u,onLiveEvent:y,liveParams:d,meta:f,syncWithLocation:p,dataProviderName:m}),B=(r==null?void 0:r.mode)!=="off",N=To.useBreakpoint(),X=bo(u),[W]=yo.useForm(),{data:H,isFetched:Q,isLoading:O}=v,j=o((x,V)=>{B&&(C(x),F(V||10))},"onChange"),D=o(async x=>{if(n){let V=await n(x);return B&&(C==null||C(1)),b(V)}},"onFinish"),q=o(()=>B?{itemRender:(x,V,A)=>{var E;let G=h({pagination:{pageSize:P,currentPage:x},sorters:c,filters:T});if(V==="page")return qe(fe,{to:G,element:`${x}`});if(V==="next"||V==="prev")return qe(fe,{to:G,element:A});if(V==="jump-next"||V==="jump-prev"){let R=(E=A==null?void 0:A.props)==null?void 0:E.children;return qe(fe,{to:G,element:co.count(R)>1?qe(fo,{},R):R})}return A},pageSize:P,current:g,simple:!N.sm,total:H==null?void 0:H.total,onChange:j}:!1,"antdPagination");return{searchFormProps:{form:W,onFinish:D},listProps:{dataSource:H==null?void 0:H.data,loading:X==="auto"?O:!Q,pagination:q()},query:v,filters:T,setFilters:b,sorters:c,setSorters:k,currentPage:g,setCurrentPage:C,pageSize:P,setPageSize:F,pageCount:S,createLinkForSyncWithLocation:h,overtime:z,result:L}},"useSimpleList");import{useCallback as xo,useMemo as Fo,useState as ho}from"react";var ld=o(()=>{let[e,r]=ho(!1),t=xo(s=>{Co(s.fileList).includes(!0)?r(!0):r(!1)},[]);return Fo(()=>({isLoading:e,onChange:t}),[e])},"useFileUploadState"),Co=o(e=>e.map(r=>{switch(r.status){case"uploading":return!0;default:return!1}}),"mapStatusToLoading");import{useContext as Bo}from"react";import Or,{useState as Hr}from"react";var Be=Or.createContext({siderCollapsed:!1,mobileSiderOpen:!1,setSiderCollapsed:()=>{},setMobileSiderOpen:()=>{}}),tr=o(({children:e,initialSiderCollapsed:r,onSiderCollapsed:t})=>{let[s,n]=Hr(r??!1),[a,p]=Hr(!1),i=o(l=>{n(l),t&&t(l)},"setSiderCollapsed");return Or.createElement(Be.Provider,{value:{siderCollapsed:s,mobileSiderOpen:a,setSiderCollapsed:i,setMobileSiderOpen:p}},e)},"ThemedLayoutContextProvider");var Pd=o(()=>{let{mobileSiderOpen:e,siderCollapsed:r,setMobileSiderOpen:t,setSiderCollapsed:s}=Bo(Be);return{siderVisible:e,setSiderVisible:t,drawerSiderVisible:r,setDrawerSiderVisible:s}},"useSiderVisible");import{useContext as So}from"react";var Mr=o(()=>{let{mobileSiderOpen:e,siderCollapsed:r,setMobileSiderOpen:t,setSiderCollapsed:s}=So(Be);return{mobileSiderOpen:e,siderCollapsed:r,setMobileSiderOpen:t,setSiderCollapsed:s}},"useThemedLayoutContext");import{App as wo,notification as ko}from"antd";import or from"react";import ke from"react";import{Button as Eo,Progress as vo}from"antd";import{UndoOutlined as Do}from"@ant-design/icons";var Qr=o(({message:e,cancelMutation:r,undoableTimeout:t})=>ke.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"-7px"}},ke.createElement(vo,{type:"circle",percent:(t??0)*20,format:s=>s&&s/20,size:50,strokeColor:"#1890ff",status:"normal"}),ke.createElement("span",{style:{marginLeft:8,width:"100%"}},e),ke.createElement(Eo,{style:{flexShrink:0},onClick:r,disabled:t===0,icon:ke.createElement(Do,null)})),"UndoableNotification");var Ud=o(()=>{let{notification:e}=wo.useApp(),r="open"in e?e:ko;return{open:({key:s,message:n,description:a,type:p,cancelMutation:i,undoableTimeout:l})=>{p==="progress"?r.open({key:s,description:or.createElement(Qr,{notificationKey:s,message:n,cancelMutation:()=>{i==null||i(),r.destroy(s??"")},undoableTimeout:l}),message:null,duration:0,closeIcon:or.createElement(or.Fragment,null)}):r.open({key:s,description:n,message:a??null,type:p})},close:s=>r.destroy(s)}},"useNotificationProvider");import ue from"react";import{Grid as Yo,Layout as ir}from"antd";import U,{useContext as Ro}from"react";import{Layout as sr,Menu as We,Grid as Lo,Drawer as Vo,Button as Ar,theme as Uo,ConfigProvider as Io}from"antd";import{LogoutOutlined as Ho,UnorderedListOutlined as zr,BarsOutlined as Oo,LeftOutlined as jr,RightOutlined as qr}from"@ant-design/icons";import{useTranslate as Mo,useLogout as Qo,CanAccess as Wr,useIsExistAuthentication as No,useMenu as Ao,useLink as zo,useWarnAboutChange as jo}from"@refinedev/core";var Nr={borderStartStartRadius:0,borderEndStartRadius:0,position:"fixed",top:64,zIndex:999};var nr=o(({Title:e,render:r,meta:t,fixed:s,activeItemDisabled:n=!1,siderItemsAreCollapsed:a=!0})=>{var j;let{token:p}=Uo.useToken(),{siderCollapsed:i,setSiderCollapsed:l,mobileSiderOpen:u,setMobileSiderOpen:y}=Mr(),d=No(),f=(j=Ro(Io.ConfigContext))==null?void 0:j.direction,m=zo(),{warnWhen:c,setWarnWhen:T}=jo(),g=Mo(),{menuItems:P,selectedKey:S,defaultOpenKeys:b}=Ao({meta:t}),C=Lo.useBreakpoint(),{mutate:F}=Qo(),k=typeof C.lg>"u"?!1:!C.lg,h=e??ne,v=o((D,q)=>D.map(x=>{let{key:V,name:A,children:G,meta:E,list:R}=x,w=E==null?void 0:E.parent,$=(x==null?void 0:x.label)??(E==null?void 0:E.label)??A,ee=E==null?void 0:E.icon,oe=R;if(G.length>0)return U.createElement(Wr,{key:x.key,resource:A,action:"list",params:{resource:x}},U.createElement(We.SubMenu,{key:x.key,icon:ee??U.createElement(zr,null),title:$},v(G,q)));let ie=V===q,Y=!(w!==void 0&&G.length===0),le=n&&ie?{pointerEvents:"none"}:{};return U.createElement(Wr,{key:x.key,resource:A,action:"list",params:{resource:x}},U.createElement(We.Item,{key:x.key,icon:ee??(Y&&U.createElement(zr,null)),style:le},U.createElement(m,{to:oe??"",style:le},$),!i&&ie&&U.createElement("div",{className:"ant-menu-tree-arrow"})))}),"renderTreeView"),z=o(()=>{c?window.confirm(g("warnWhenUnsavedChanges","Are you sure you want to leave? You have unsaved changes."))&&(T(!1),F()):F()},"handleLogout"),L=d&&U.createElement(We.Item,{key:"logout",onClick:()=>z(),icon:U.createElement(Ho,null)},g("buttons.logout","Logout")),B=(()=>a?[]:P.map(({key:D})=>D))(),N=v(P,S),X=o(()=>r?r({items:N,logout:L,collapsed:i}):[...N,L].filter(Boolean),"renderSider"),W=o(()=>U.createElement(We,{selectedKeys:S?[S]:[],defaultOpenKeys:[...b,...B],mode:"inline",style:{paddingTop:"8px",border:"none",overflow:"auto",height:"calc(100% - 72px)"},onClick:()=>{y(!1)}},X()),"renderMenu"),H=o(()=>U.createElement(U.Fragment,null,U.createElement(Vo,{open:u,onClose:()=>y(!1),placement:f==="rtl"?"right":"left",closable:!1,width:200,styles:{body:{padding:0}},maskClosable:!0},U.createElement(sr,null,U.createElement(sr.Sider,{style:{height:"100vh",backgroundColor:p.colorBgContainer,borderRight:`1px solid ${p.colorBgElevated}`}},U.createElement("div",{style:{width:"200px",padding:"0 16px",display:"flex",justifyContent:"flex-start",alignItems:"center",height:"64px",backgroundColor:p.colorBgElevated}},U.createElement(h,{collapsed:!1})),W()))),U.createElement(Ar,{style:Nr,size:"large",onClick:()=>y(!0),icon:U.createElement(Oo,null)})),"renderDrawerSider");if(k)return H();let Q={backgroundColor:p.colorBgContainer,borderRight:`1px solid ${p.colorBgElevated}`};s&&(Q.position="fixed",Q.top=0,Q.height="100vh",Q.zIndex=999);let O=o(()=>{let D={style:{color:p.colorPrimary}};return U.createElement(i?f==="rtl"?jr:qr:f==="rtl"?qr:jr,{...D})},"renderClosingIcons");return U.createElement(U.Fragment,null,s&&U.createElement("div",{style:{width:i?"80px":"200px",transition:"all 0.2s"}}),U.createElement(sr.Sider,{style:Q,collapsible:!0,collapsed:i,onCollapse:(D,q)=>{q==="clickTrigger"&&l(D)},collapsedWidth:80,breakpoint:"lg",trigger:U.createElement(Ar,{type:"text",style:{borderRadius:0,height:"100%",width:"100%",backgroundColor:p.colorBgElevated}},O())},U.createElement("div",{style:{width:i?"80px":"200px",padding:i?"0":"0 16px",display:"flex",justifyContent:i?"center":"flex-start",alignItems:"center",height:"64px",backgroundColor:p.colorBgElevated,fontSize:"14px"}},U.createElement(h,{collapsed:i})),W()))},"ThemedSider");import Re from"react";import{Layout as qo,Typography as Wo,Avatar as Ko,Space as Kr,theme as Go}from"antd";import{useGetIdentity as $o}from"@refinedev/core";var ar=o(({sticky:e})=>{let{token:r}=Go.useToken(),{data:t}=$o();if(!(t&&(t.name||t.avatar)))return null;let n={backgroundColor:r.colorBgElevated,display:"flex",justifyContent:"flex-end",alignItems:"center",padding:"0px 24px",height:"64px"};return e&&(n.position="sticky",n.top=0,n.zIndex=1),Re.createElement(qo.Header,{style:n},Re.createElement(Kr,null,Re.createElement(Kr,{size:"middle"},(t==null?void 0:t.name)&&Re.createElement(Wo.Text,{strong:!0},t.name),(t==null?void 0:t.avatar)&&Re.createElement(Ko,{src:t==null?void 0:t.avatar,alt:t==null?void 0:t.name}))))},"ThemedHeader");var _o=o(({children:e,Header:r,Sider:t,Title:s,Footer:n,OffLayoutArea:a,initialSiderCollapsed:p,onSiderCollapsed:i})=>{let l=Yo.useBreakpoint(),u=t??nr,y=r??ar,d=typeof l.sm>"u"?!0:l.sm,f=!!u({Title:s});return ue.createElement(tr,{initialSiderCollapsed:p,onSiderCollapsed:i},ue.createElement(ir,{style:{minHeight:"100vh"},hasSider:f},ue.createElement(u,{Title:s}),ue.createElement(ir,null,ue.createElement(y,null),ue.createElement(ir.Content,null,ue.createElement("div",{style:{minHeight:360,padding:d?24:12}},e),a&&ue.createElement(a,null)),n&&ue.createElement(n,null))))},"ThemedLayout");import Ke from"react";import{useLink as Xo,useRefineOptions as Jo}from"@refinedev/core";import{Typography as Zo,theme as es,Space as rs}from"antd";var ne=o(({collapsed:e,icon:r,text:t,wrapperStyles:s})=>{let{title:{icon:n,text:a}={}}=Jo(),p=typeof r>"u"?n:r,i=typeof t>"u"?a:t,{token:l}=es.useToken(),u=Xo();return Ke.createElement(u,{to:"/",style:{display:"inline-block",textDecoration:"none"}},Ke.createElement(rs,{style:{display:"flex",alignItems:"center",fontSize:"inherit",...s}},Ke.createElement("div",{style:{height:"24px",width:"24px",color:l.colorPrimary}},p),!e&&Ke.createElement(Zo.Title,{style:{fontSize:"inherit",marginBottom:0,fontWeight:700}},i)))},"ThemedTitle");import pr from"react";import{Button as ts}from"antd";import{PlusSquareOutlined as os}from"@ant-design/icons";import{useCreateButton as ss}from"@refinedev/core";import{RefineButtonClassNames as ns,RefineButtonTestIds as as}from"@refinedev/ui-types";var lr=o(({resource:e,hideText:r=!1,accessControl:t,meta:s,children:n,onClick:a,...p})=>{let{hidden:i,disabled:l,label:u,title:y,LinkComponent:d,to:f}=ss({resource:e,meta:s,accessControl:t}),m=l||p.disabled;return i||p.hidden?null:pr.createElement(d,{to:f,replace:!1,onClick:T=>{if(m){T.preventDefault();return}a&&(T.preventDefault(),a(T))}},pr.createElement(ts,{icon:pr.createElement(os,null),disabled:m,title:y,className:ns.CreateButton,type:"primary",...p},!r&&(n??u)))},"CreateButton");import dr from"react";import{Button as is}from"antd";import{EditOutlined as ps}from"@ant-design/icons";import{useEditButton as ls}from"@refinedev/core";import{RefineButtonClassNames as ds,RefineButtonTestIds as us}from"@refinedev/ui-types";var ur=o(({resource:e,recordItemId:r,hideText:t=!1,accessControl:s,meta:n,children:a,onClick:p,...i})=>{let{to:l,label:u,title:y,hidden:d,disabled:f,LinkComponent:m}=ls({resource:e,id:r,meta:n,accessControl:s}),c=f||i.disabled;return d||i.hidden?null:dr.createElement(m,{to:l,replace:!1,onClick:g=>{if(c){g.preventDefault();return}p&&(g.preventDefault(),p(g))}},dr.createElement(is,{icon:dr.createElement(ps,null),disabled:c,title:y,className:ds.EditButton,...i},!t&&(a??u)))},"EditButton");import mr from"react";import{Button as ms,Popconfirm as cs}from"antd";import{DeleteOutlined as fs}from"@ant-design/icons";import{useDeleteButton as ys}from"@refinedev/core";import{RefineButtonClassNames as Ts,RefineButtonTestIds as gs}from"@refinedev/ui-types";var Le=o(({resource:e,recordItemId:r,onSuccess:t,mutationMode:s,children:n,successNotification:a,errorNotification:p,hideText:i=!1,accessControl:l,meta:u,dataProviderName:y,confirmTitle:d,confirmOkText:f,confirmCancelText:m,invalidates:c,...T})=>{let{title:g,label:P,hidden:S,disabled:b,loading:C,confirmTitle:F,confirmOkLabel:k,cancelLabel:h,onConfirm:v}=ys({resource:e,id:r,dataProviderName:y,invalidates:c,meta:u,onSuccess:t,mutationMode:s,errorNotification:p,successNotification:a,accessControl:l}),z=b||T.disabled;return S||T.hidden?null:mr.createElement(cs,{key:"delete",okText:f??k,cancelText:m??h,okType:"danger",title:d??F,okButtonProps:{disabled:C},onConfirm:v,disabled:z},mr.createElement(ms,{danger:!0,loading:C,icon:mr.createElement(fs,null),title:g,disabled:z,className:Ts.DeleteButton,...T},!i&&(n??P)))},"DeleteButton");import Gr from"react";import{Button as bs}from"antd";import{RedoOutlined as Ps}from"@ant-design/icons";import{useRefreshButton as xs}from"@refinedev/core";import{RefineButtonClassNames as Fs,RefineButtonTestIds as hs}from"@refinedev/ui-types";var Ve=o(({resource:e,recordItemId:r,hideText:t=!1,dataProviderName:s,children:n,...a})=>{let{onClick:p,label:i,loading:l}=xs({resource:e,id:r,dataProviderName:s});return Gr.createElement(bs,{onClick:p,icon:Gr.createElement(Ps,{spin:l}),className:Fs.RefreshButton,...a},!t&&(n??i))},"RefreshButton");import cr from"react";import{Button as Cs}from"antd";import{EyeOutlined as Bs}from"@ant-design/icons";import{useShowButton as Ss}from"@refinedev/core";import{RefineButtonClassNames as Es,RefineButtonTestIds as vs}from"@refinedev/ui-types";var Ds=o(({resource:e,recordItemId:r,hideText:t=!1,accessControl:s,meta:n,children:a,onClick:p,...i})=>{let{to:l,label:u,title:y,hidden:d,disabled:f,LinkComponent:m}=Ss({resource:e,id:r,accessControl:s,meta:n}),c=f||i.disabled;return d||i.hidden?null:cr.createElement(m,{to:l,replace:!1,onClick:g=>{if(c){g.preventDefault();return}p&&(g.preventDefault(),p(g))}},cr.createElement(Cs,{disabled:c,icon:cr.createElement(Bs,null),title:y,className:Es.ShowButton,...i},!t&&(a??u)))},"ShowButton");import fr from"react";import{Button as ws}from"antd";import{BarsOutlined as ks}from"@ant-design/icons";import{useListButton as Rs}from"@refinedev/core";import{RefineButtonClassNames as Ls,RefineButtonTestIds as Vs}from"@refinedev/ui-types";var Ue=o(({resource:e,hideText:r=!1,accessControl:t,meta:s,children:n,onClick:a,...p})=>{let{to:i,label:l,title:u,hidden:y,disabled:d,LinkComponent:f}=Rs({resource:e,meta:s,accessControl:t}),m=d||p.disabled;return y||p.hidden?null:fr.createElement(f,{to:i,replace:!1,onClick:T=>{if(m){T.preventDefault();return}a&&(T.preventDefault(),a(T))}},fr.createElement(ws,{icon:fr.createElement(ks,null),disabled:m,title:u,className:Ls.ListButton,...p},!r&&(n??l)))},"ListButton");import $r from"react";import{Button as Us}from"antd";import{ExportOutlined as Is}from"@ant-design/icons";import{useExportButton as Hs}from"@refinedev/core";import{RefineButtonClassNames as Os,RefineButtonTestIds as Ms}from"@refinedev/ui-types";var Qs=o(({hideText:e=!1,children:r,...t})=>{let{label:s}=Hs();return $r.createElement(Us,{type:"default",icon:$r.createElement(Is,null),className:Os.ExportButton,...t},!e&&(r??s))},"ExportButton");import Yr from"react";import{Button as Ns}from"antd";import{SaveOutlined as As}from"@ant-design/icons";import{useSaveButton as zs}from"@refinedev/core";import{RefineButtonClassNames as js,RefineButtonTestIds as qs}from"@refinedev/ui-types";var Ie=o(({hideText:e=!1,children:r,...t})=>{let{label:s}=zs();return Yr.createElement(Ns,{type:"primary",icon:Yr.createElement(As,null),className:js.SaveButton,...t},!e&&(r??s))},"SaveButton");import yr from"react";import{Button as Ws}from"antd";import{PlusSquareOutlined as Ks}from"@ant-design/icons";import{useCloneButton as Gs}from"@refinedev/core";import{RefineButtonTestIds as $s,RefineButtonClassNames as Ys}from"@refinedev/ui-types";var _s=o(({resource:e,recordItemId:r,hideText:t=!1,accessControl:s,meta:n,children:a,onClick:p,...i})=>{let{to:l,LinkComponent:u,label:y,disabled:d,hidden:f,title:m}=Gs({id:r,resource:e,accessControl:s,meta:n}),c=d||i.disabled;return f||i.hidden?null:yr.createElement(u,{to:l,replace:!1,onClick:g=>{if(c){g.preventDefault();return}p&&(g.preventDefault(),p(g))}},yr.createElement(Ws,{icon:yr.createElement(Ks,null),disabled:c,title:m,className:Ys.CloneButton,...i},!t&&(a??y)))},"CloneButton");import Tr from"react";import{Button as Xs,Upload as Js}from"antd";import{ImportOutlined as Zs}from"@ant-design/icons";import{useImportButton as en}from"@refinedev/core";import{RefineButtonClassNames as rn,RefineButtonTestIds as tn}from"@refinedev/ui-types";var on=o(({uploadProps:e,buttonProps:r,hideText:t=!1,children:s,loading:n,...a})=>{let{label:p}=en();return Tr.createElement(Js,{...e},Tr.createElement(Xs,{icon:Tr.createElement(Zs,null),className:rn.ImportButton,loading:n,...r,...a},!t&&(s??p)))},"ImportButton");import ye from"react";import{Space as sn}from"antd";import{useTranslate as nn,useUserFriendlyName as an,useRefineContext as pn,useResourceParams as ln}from"@refinedev/core";var dn=o(({canCreate:e,title:r,children:t,createButtonProps:s,resource:n,wrapperProps:a,contentProps:p,headerProps:i,breadcrumb:l,headerButtonProps:u,headerButtons:y})=>{var C;let d=nn(),{options:{breadcrumb:f}={}}=pn(),m=an(),{resource:c,identifier:T}=ln({resource:n}),g=e??(!!(c!=null&&c.create)||!!s),P=typeof l>"u"?f:l,S=g?{size:"middle",resource:T,...s}:void 0,b=g?ye.createElement(lr,{...S}):null;return ye.createElement("div",{...a??{}},ye.createElement(ge,{title:r??d(`${T}.titles.list`,m(((C=c==null?void 0:c.meta)==null?void 0:C.label)??T,"plural")),extra:y?ye.createElement(sn,{wrap:!0,...u},typeof y=="function"?y({defaultButtons:b,createButtonProps:S}):y):b,breadcrumb:typeof P<"u"?ye.createElement(ye.Fragment,null,P):ye.createElement(Te,null),...i??{}},ye.createElement("div",{...p??{}},t)))},"List");import se from"react";import{Card as un,Space as _r,Spin as mn}from"antd";import{useTranslate as cn,useUserFriendlyName as fn,useRefineContext as yn,useResourceParams as Tn,useBack as gn}from"@refinedev/core";var bn=o(({title:e,saveButtonProps:r,children:t,resource:s,isLoading:n=!1,breadcrumb:a,wrapperProps:p,headerProps:i,contentProps:l,headerButtonProps:u,headerButtons:y,footerButtonProps:d,footerButtons:f,goBack:m})=>{var h;let c=cn(),{options:{breadcrumb:T}={}}=yn(),g=gn(),P=fn(),{resource:S,identifier:b}=Tn({resource:s}),C=typeof a>"u"?T:a,F={...n?{disabled:!0}:{},...r,htmlType:"submit"},k=se.createElement(se.Fragment,null,se.createElement(Ie,{...F}));return se.createElement("div",{...p??{}},se.createElement(ge,{backIcon:m,onBack:g,title:e??c(`${b}.titles.create`,`Create ${P(((h=S==null?void 0:S.meta)==null?void 0:h.label)??b,"singular")}`),breadcrumb:typeof C<"u"?se.createElement(se.Fragment,null,C):se.createElement(Te,null),extra:se.createElement(_r,{wrap:!0,...u??{}},y?typeof y=="function"?y({defaultButtons:null}):y:null),...i??{}},se.createElement(mn,{spinning:n},se.createElement(un,{variant:"borderless",actions:[se.createElement(_r,{key:"action-buttons",style:{float:"right",marginRight:24},...d??{}},f?typeof f=="function"?f({defaultButtons:k,saveButtonProps:F}):f:k)],...l??{}},t))))},"Create");import J from"react";import{Card as Pn,Space as Xr,Spin as xn}from"antd";import{useMutationMode as Fn,useTranslate as hn,useUserFriendlyName as Cn,useRefineContext as Bn,useBack as Sn,useResourceParams as En,useGo as vn,useToPath as Dn}from"@refinedev/core";var wn=o(({title:e,saveButtonProps:r,mutationMode:t,recordItemId:s,children:n,deleteButtonProps:a,canDelete:p,resource:i,isLoading:l=!1,dataProviderName:u,breadcrumb:y,wrapperProps:d,headerProps:f,contentProps:m,headerButtonProps:c,headerButtons:T,footerButtonProps:g,footerButtons:P,goBack:S,autoSaveProps:b})=>{var R,w;let C=hn(),{options:{breadcrumb:F}={}}=Bn(),{mutationMode:k}=Fn(),h=t??k,v=Sn(),z=vn(),L=Cn(),{resource:B,action:N,id:X,identifier:W}=En({resource:i}),H=Dn({resource:B,action:"list"}),Q=s??X,O=typeof y>"u"?F:y,j=(B==null?void 0:B.list)&&!s,D=p??(((R=B==null?void 0:B.meta)==null?void 0:R.canDelete)||a),q=j?{...l?{disabled:!0}:{},resource:W}:void 0,x={...l?{disabled:!0}:{},resource:W,recordItemId:Q,dataProviderName:u},V=D?{...l?{disabled:!0}:{},resource:W,mutationMode:h,onSuccess:()=>{z({to:H})},recordItemId:Q,dataProviderName:u,...a}:void 0,A={...l?{disabled:!0}:{},...r},G=J.createElement(J.Fragment,null,b&&J.createElement(Jr,{...b}),j&&J.createElement(Ue,{...q}),J.createElement(Ve,{...x})),E=J.createElement(J.Fragment,null,D&&J.createElement(Le,{...V}),J.createElement(Ie,{...A}));return J.createElement("div",{...d??{}},J.createElement(ge,{backIcon:S,onBack:N!=="list"&&typeof N<"u"?v:void 0,title:e??C(`${W}.titles.edit`,`Edit ${L(((w=B==null?void 0:B.meta)==null?void 0:w.label)??W,"singular")}`),extra:J.createElement(Xr,{wrap:!0,...c??{}},T?typeof T=="function"?T({defaultButtons:G,listButtonProps:q,refreshButtonProps:x}):T:G),breadcrumb:typeof O<"u"?J.createElement(J.Fragment,null,O):J.createElement(Te,null),...f??{}},J.createElement(xn,{spinning:l},J.createElement(Pn,{variant:"borderless",actions:[J.createElement(Xr,{key:"footer-buttons",wrap:!0,style:{float:"right",marginRight:24},...g??{}},P?typeof P=="function"?P({defaultButtons:E,deleteButtonProps:V,saveButtonProps:A}):P:E)],...m??{}},n))))},"Edit");import te from"react";import{Card as kn,Space as Zr,Spin as Rn}from"antd";import{useTranslate as Ln,useUserFriendlyName as Vn,useRefineContext as Un,useResourceParams as In,useToPath as Hn,useBack as On,useGo as Mn}from"@refinedev/core";var Qn=o(({title:e,canEdit:r,canDelete:t,deleteButtonProps:s,isLoading:n=!1,children:a,resource:p,recordItemId:i,dataProviderName:l,breadcrumb:u,contentProps:y,headerProps:d,wrapperProps:f,headerButtons:m,footerButtons:c,footerButtonProps:T,headerButtonProps:g,goBack:P})=>{var V,A;let S=Ln(),{options:{breadcrumb:b}={}}=Un(),C=On(),F=Mn(),k=Vn(),{resource:h,action:v,id:z,identifier:L}=In({resource:p}),B=Hn({resource:h,action:"list"}),N=i??z,X=typeof u>"u"?b:u,W=(h==null?void 0:h.list)&&!i,H=t??(((V=h==null?void 0:h.meta)==null?void 0:V.canDelete)||s),Q=r??!!(h!=null&&h.edit),O=W?{resource:L}:void 0,j=Q?{...n?{disabled:!0}:{},type:"primary",resource:L,recordItemId:N}:void 0,D=H?{...n?{disabled:!0}:{},resource:L,recordItemId:N,onSuccess:()=>{F({to:B})},dataProviderName:l,...s}:void 0,q={...n?{disabled:!0}:{},resource:L,recordItemId:N,dataProviderName:l},x=te.createElement(te.Fragment,null,W&&te.createElement(Ue,{...O}),Q&&te.createElement(ur,{...j}),H&&te.createElement(Le,{...D}),te.createElement(Ve,{...q}));return te.createElement("div",{...f??{}},te.createElement(ge,{backIcon:P,onBack:v!=="list"&&typeof v<"u"?C:void 0,title:e??S(`${L}.titles.show`,`Show ${k(((A=h==null?void 0:h.meta)==null?void 0:A.label)??L,"singular")}`),extra:te.createElement(Zr,{key:"extra-buttons",wrap:!0,...g??{}},m?typeof m=="function"?m({defaultButtons:x,deleteButtonProps:D,editButtonProps:j,listButtonProps:O,refreshButtonProps:q}):m:x),breadcrumb:typeof X<"u"?te.createElement(te.Fragment,null,X):te.createElement(Te,null),...d??{}},te.createElement(Rn,{spinning:n},te.createElement(kn,{variant:"borderless",actions:c?[te.createElement(Zr,{key:"footer-buttons",wrap:!0,...T},typeof c=="function"?c({defaultButtons:null}):c)]:void 0,...y??{}},a))))},"Show");import Nn from"react";import{Typography as An}from"antd";var zn=o(({value:e,...r})=>Nn.createElement(An.Text,{...r},e),"TextField");import jn from"react";import{Tag as qn}from"antd";var Wn=o(({value:e,...r})=>jn.createElement(qn,{...r},e==null?void 0:e.toString()),"TagField");import Kn from"react";import{Typography as Gn}from"antd";var $n=o(({value:e,...r})=>Kn.createElement(Gn.Link,{href:`mailto:${e}`,...r},e),"EmailField");import Yn from"react";import{Image as _n}from"antd";var Xn=o(({value:e,imageTitle:r,...t})=>Yn.createElement(_n,{...t,src:e,title:r}),"ImageField");import He from"react";import{Tooltip as Jn}from"antd";import{CheckOutlined as Zn,CloseOutlined as ea}from"@ant-design/icons";var ra=o(({value:e,valueLabelTrue:r="true",valueLabelFalse:t="false",trueIcon:s=He.createElement(Zn,null),falseIcon:n=He.createElement(ea,null),...a})=>He.createElement(Jn,{title:e?r:t,...a},e?He.createElement("span",null,s):He.createElement("span",null,n)),"BooleanField");import ta from"react";import gr from"dayjs";import{Typography as oa}from"antd";import sa from "dayjs/plugin/localizedFormat.js";var na=o(({value:e,locales:r,format:t="L",...s})=>{gr.extend(sa);let n=gr.locale();return ta.createElement(oa.Text,{...s},e?gr(e).locale(r||n).format(t):"")},"DateField");import aa from"react";var ia=o(({title:e,src:r,...t})=>aa.createElement(br,{value:r,title:e,...t},e??r),"FileField");import pa from"react";import{Typography as la}from"antd";var br=o(({children:e,value:r,...t})=>pa.createElement(la.Link,{href:r,...t},e??r),"UrlField");import da from"react";import{Typography as ua}from"antd";function ma(){return!!(typeof Intl=="object"&&Intl&&typeof Intl.NumberFormat=="function")}o(ma,"toLocaleStringSupportsOptions");var ca=o(({value:e,locale:r,options:t,...s})=>{let n=Number(e);return da.createElement(ua.Text,{...s},ma()?n.toLocaleString(r,t):n)},"NumberField");import fa from"react";import ya from"react-markdown";import Ta from"remark-gfm";var ga=o(({value:e=""})=>fa.createElement(ya,{remarkPlugins:[Ta]},e),"MarkdownField");import me from"react";import{Button as et,Space as ba}from"antd";import rt from"dayjs";import{FilterOutlined as Pa}from"@ant-design/icons";import{useTranslate as xa}from"@refinedev/core";var Fa=o(e=>{let{setSelectedKeys:r,confirm:t,clearFilters:s,mapValue:n=o(f=>f,"mapValue"),selectedKeys:a,children:p}=e,i=xa(),l=o(()=>{s&&s()},"clearFilter"),u=o(()=>{let f;typeof a=="number"?f=`${a}`:rt.isDayjs(a)?f=[a.toISOString()]:f=a,r(f),t==null||t()},"onFilter"),y=o(f=>{if(typeof f=="object"){if(Array.isArray(f)){let P=n(f,"onChange");return r(P)}let c=!f||!f.target||rt.isDayjs(f)?{target:{value:f}}:f,{target:T}=c,g=n(T.value,"onChange");r(g);return}let m=n(f,"onChange");r(m)},"onChange"),d=me.Children.map(p,f=>me.isValidElement(f)?me.cloneElement(f,{onChange:y,value:n(a,"value")}):f);return me.createElement("div",{style:{padding:10,display:"flex",flexDirection:"column",alignItems:"flex-end"}},me.createElement("div",{style:{marginBottom:15}},d),me.createElement(ba,null,me.createElement(et,{type:"primary",size:"small",onClick:()=>u()},me.createElement(Pa,null)," ",i("buttons.filter","Filter")),me.createElement(et,{danger:!0,size:"small",onClick:()=>l()},i("buttons.clear","Clear"))))},"FilterDropdown");import Ce,{useEffect as ha,useState as Ca}from"react";import{useGo as Ba,useResourceParams as Sa}from"@refinedev/core";import{Button as Ea,Result as va,Typography as Da,Space as tt,Tooltip as wa}from"antd";import{InfoCircleOutlined as ka}from"@ant-design/icons";import{useTranslate as Ra}from"@refinedev/core";var La=o(()=>{let[e,r]=Ca(),t=Ra(),s=Ba(),{resource:n,action:a}=Sa();return ha(()=>{n&&a&&r(t("pages.error.info",{action:a,resource:n==null?void 0:n.name},`You may have forgotten to add the "${a}" component to "${n==null?void 0:n.name}" resource.`))},[n,a]),Ce.createElement(va,{status:"404",title:"404",extra:Ce.createElement(tt,{direction:"vertical",size:"large"},Ce.createElement(tt,null,Ce.createElement(Da.Text,null,t("pages.error.404","Sorry, the page you visited does not exist.")),e&&Ce.createElement(wa,{title:e},Ce.createElement(ka,{}))),Ce.createElement(Ea,{type:"primary",onClick:()=>s({to:"/"})},t("pages.error.backHome","Back Home")))})},"ErrorComponent");import K from"react";import{Row as Va,Col as Ua,Layout as Ia,Card as Ha,Typography as it,Form as Oe,Input as pt,Button as Oa,Checkbox as Ma}from"antd";import{useLogin as Qa,useTranslate as Na}from"@refinedev/core";var ot={background:"radial-gradient(50% 50% at 50% 50%, #63386A 0%, #310438 100%)",backgroundSize:"cover"},st={maxWidth:"408px",margin:"auto"},nt={textAlign:"center",color:"#626262",fontSize:"30px",letterSpacing:"-0.04em"},at={display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"28px"};var Aa=o(()=>{let[e]=Oe.useForm(),r=Na(),{mutate:t,isPending:s}=Qa(),n=K.createElement(it.Title,{level:3,style:nt},r("pages.login.title","Sign in your account"));return K.createElement(Ia,{style:ot},K.createElement(Va,{justify:"center",align:"middle",style:{height:"100vh"}},K.createElement(Ua,{xs:22},K.createElement("div",{style:st},K.createElement("div",{style:at},K.createElement("img",{src:"https://refine.ams3.cdn.digitaloceanspaces.com/logo/refine.svg",alt:"Refine Logo"})),K.createElement(Ha,{title:n,styles:{header:{borderBottom:0}}},K.createElement(Oe,{layout:"vertical",form:e,onFinish:a=>{t(a)},requiredMark:!1,initialValues:{remember:!1}},K.createElement(Oe.Item,{name:"username",label:r("pages.login.username","Username"),rules:[{required:!0}]},K.createElement(pt,{size:"large",placeholder:r("pages.login.username","Username")})),K.createElement(Oe.Item,{name:"password",label:r("pages.login.password","Password"),rules:[{required:!0}],style:{marginBottom:"12px"}},K.createElement(pt,{type:"password",placeholder:"\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",size:"large"})),K.createElement("div",{style:{marginBottom:"12px"}},K.createElement(Oe.Item,{name:"remember",valuePropName:"checked",noStyle:!0},K.createElement(Ma,{style:{fontSize:"12px"}},r("pages.login.remember","Remember me"))),K.createElement("a",{style:{float:"right",fontSize:"12px"},href:"#"},r("pages.login.forgotPassword","Forgot password?"))),K.createElement(Oa,{type:"primary",size:"large",htmlType:"submit",loading:s,block:!0},r("pages.login.signin","Sign in"))),K.createElement("div",{style:{marginTop:8}},K.createElement(it.Text,{style:{fontSize:12}},r("pages.login.noAccount","Don\u2019t have an account?")," ",K.createElement("a",{href:"#",style:{fontWeight:"bold"}},r("pages.login.signup","Sign up")))))))))},"LoginPage");import*as _ from"react";import{Row as za,Col as ja,Typography as qa,Space as Wa,Button as Pr}from"antd";import{ReadOutlined as Ka,FolderOutlined as Ga,TeamOutlined as $a}from"@ant-design/icons";var Se={root:{height:"100vh",backgroundImage:"url('https://refine.ams3.cdn.digitaloceanspaces.com/login-background/background.png')",backgroundSize:"cover",backgroundColor:"#331049"},title:{color:"white",fontWeight:800,fontSize:"64px",marginBottom:"8px"},p1:{color:"white",marginBottom:0,fontSize:"20px",fontWeight:"bold"},p2:{color:"white",fontSize:"20px"},code:{backgroundColor:"white",color:"#331049"}},Ya=o(()=>_.createElement(za,{align:"middle",justify:"center",style:Se.root},_.createElement(ja,{style:{textAlign:"center"}},_.createElement("img",{style:{marginBottom:"48px"},src:"https://refine.ams3.cdn.digitaloceanspaces.com/logo/refine.svg",alt:"Refine Logo"}),_.createElement(qa.Title,{style:Se.title},"Welcome on board"),_.createElement("p",{style:Se.p1},"Your configuration is completed."),_.createElement("p",{style:Se.p2},"Now you can get started by adding your resources to the"," ",_.createElement("code",{style:Se.code},"resources")," property of"," ",_.createElement("code",{style:Se.code},"<Refine>")),_.createElement(Wa,{size:"large",wrap:!0,style:{marginTop:"70px",justifyContent:"center"}},_.createElement("a",{href:"https://refine.dev",target:"_blank",rel:"noreferrer"},_.createElement(Pr,{size:"large",icon:_.createElement(Ka,null)},"Documentation")),_.createElement("a",{href:"https://refine.dev/examples",target:"_blank",rel:"noreferrer"},_.createElement(Pr,{size:"large",icon:_.createElement(Ga,null)},"Examples")),_.createElement("a",{href:"https://discord.gg/refine",target:"_blank",rel:"noreferrer"},_.createElement(Pr,{size:"large",icon:_.createElement($a,null)},"Community"))))),"ReadyPage");import _a from"react";import{WelcomePage as Xa}from"@refinedev/core";var Ja=o(()=>_a.createElement(Xa,null),"WelcomePage");import ve from"react";import I from"react";import{useLink as Za}from"@refinedev/core";import{Row as ei,Col as ri,Layout as ti,Card as oi,Typography as xr,Form as Ee,Input as lt,Button as dt,Checkbox as si,Divider as ni,theme as ai}from"antd";import{useLogin as ii,useTranslate as pi}from"@refinedev/core";var be={},Pe={maxWidth:"400px",margin:"auto",padding:"32px",boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.02), 0px 1px 6px -1px rgba(0, 0, 0, 0.02), 0px 1px 2px rgba(0, 0, 0, 0.03)"},xe={borderBottom:0,padding:0},Fe={padding:0,marginTop:"32px"},he={textAlign:"center",marginBottom:0,fontSize:"24px",lineHeight:"32px",fontWeight:700,overflowWrap:"break-word",hyphens:"manual",textOverflow:"unset",whiteSpace:"pre-wrap"};var Fr=o(({providers:e,registerLink:r,forgotPasswordLink:t,rememberMe:s,contentProps:n,wrapperProps:a,renderContent:p,formProps:i,title:l,hideForm:u,mutationVariables:y})=>{let{token:d}=ai.useToken(),[f]=Ee.useForm(),m=pi(),c=Za(),{mutate:T,isPending:g}=ii(),P=l===!1?null:I.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"32px",fontSize:"20px"}},l??I.createElement(ne,{collapsed:!1})),S=I.createElement(xr.Title,{level:3,style:{color:d.colorPrimaryTextHover,...he}},m("pages.login.title","Sign in to your account")),b=o(()=>e&&e.length>0?I.createElement(I.Fragment,null,e.map(F=>I.createElement(dt,{key:F.name,type:"default",block:!0,icon:F.icon,style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",marginBottom:"8px"},onClick:()=>T({...y,providerName:F.name})},F.label)),!u&&I.createElement(ni,null,I.createElement(xr.Text,{style:{color:d.colorTextLabel}},m("pages.login.divider","or")))):null,"renderProviders"),C=I.createElement(oi,{title:S,styles:{header:xe,body:Fe},style:{...Pe,backgroundColor:d.colorBgElevated},...n??{}},b(),!u&&I.createElement(Ee,{layout:"vertical",form:f,onFinish:F=>T({...F,...y}),requiredMark:!1,initialValues:{remember:!1},...i},I.createElement(Ee.Item,{name:"email",label:m("pages.login.fields.email","Email"),rules:[{required:!0,message:m("pages.login.errors.requiredEmail","Email is required")},{type:"email",message:m("pages.login.errors.validEmail","Invalid email address")}]},I.createElement(lt,{size:"large",placeholder:m("pages.login.fields.email","Email")})),I.createElement(Ee.Item,{name:"password",label:m("pages.login.fields.password","Password"),rules:[{required:!0,message:m("pages.login.errors.requiredPassword","Password is required")}]},I.createElement(lt,{type:"password",autoComplete:"current-password",placeholder:"\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",size:"large"})),I.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"24px"}},s??I.createElement(Ee.Item,{name:"remember",valuePropName:"checked",noStyle:!0},I.createElement(si,{style:{fontSize:"12px"}},m("pages.login.buttons.rememberMe","Remember me"))),t??I.createElement(c,{style:{color:d.colorPrimaryTextHover,fontSize:"12px",marginLeft:"auto"},to:"/forgot-password"},m("pages.login.buttons.forgotPassword","Forgot password?"))),!u&&I.createElement(Ee.Item,null,I.createElement(dt,{type:"primary",size:"large",htmlType:"submit",loading:g,block:!0},m("pages.login.signin","Sign in")))),r??I.createElement("div",{style:{marginTop:u?16:8}},I.createElement(xr.Text,{style:{fontSize:12}},m("pages.login.buttons.noAccount","Don\u2019t have an account?")," ",I.createElement(c,{to:"/register",style:{fontWeight:"bold",color:d.colorPrimaryTextHover}},m("pages.login.signup","Sign up")))));return I.createElement(ti,{style:be,...a??{}},I.createElement(ei,{justify:"center",align:u?"top":"middle",style:{padding:"16px 0",minHeight:"100dvh",paddingTop:u?"15dvh":"16px"}},I.createElement(ri,{xs:22},p?p(C,P):I.createElement(I.Fragment,null,P,C))))},"LoginPage");import M from"react";import{useLink as li}from"@refinedev/core";import{Row as di,Col as ui,Layout as mi,Card as ci,Typography as Ge,Form as Me,Input as ut,Button as mt,Divider as fi,theme as yi}from"antd";import{useTranslate as Ti,useRegister as gi}from"@refinedev/core";var hr=o(({providers:e,loginLink:r,wrapperProps:t,contentProps:s,renderContent:n,formProps:a,title:p,hideForm:i,mutationVariables:l})=>{let{token:u}=yi.useToken(),[y]=Me.useForm(),d=Ti(),f=li(),{mutate:m,isPending:c}=gi(),T=p===!1?null:M.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"32px",fontSize:"20px"}},p??M.createElement(ne,{collapsed:!1})),g=M.createElement(Ge.Title,{level:3,style:{color:u.colorPrimaryTextHover,...he}},d("pages.register.title","Sign up for your account")),P=o(()=>e&&e.length>0?M.createElement(M.Fragment,null,e.map(b=>M.createElement(mt,{key:b.name,type:"default",block:!0,icon:b.icon,style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",marginBottom:"8px"},onClick:()=>m({...l,providerName:b.name})},b.label)),!i&&M.createElement(fi,null,M.createElement(Ge.Text,{style:{color:u.colorTextLabel}},d("pages.register.divider",d("pages.login.divider","or"))))):null,"renderProviders"),S=M.createElement(ci,{title:g,styles:{header:xe,body:Fe},style:{...Pe,backgroundColor:u.colorBgElevated},...s??{}},P(),!i&&M.createElement(Me,{layout:"vertical",form:y,onFinish:b=>m({...l,...b}),requiredMark:!1,...a},M.createElement(Me.Item,{name:"email",label:d("pages.register.email","Email"),rules:[{required:!0,message:d("pages.register.errors.requiredEmail","Email is required")},{type:"email",message:d("pages.register.errors.validEmail","Invalid email address")}]},M.createElement(ut,{size:"large",placeholder:d("pages.register.fields.email","Email")})),M.createElement(Me.Item,{name:"password",label:d("pages.register.fields.password","Password"),rules:[{required:!0,message:d("pages.register.errors.requiredPassword","Password is required")}]},M.createElement(ut,{type:"password",placeholder:"\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",size:"large"})),M.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"24px"}},r??M.createElement(Ge.Text,{style:{fontSize:12,marginLeft:"auto"}},d("pages.register.buttons.haveAccount",d("pages.login.buttons.haveAccount","Have an account?"))," ",M.createElement(f,{style:{fontWeight:"bold",color:u.colorPrimaryTextHover},to:"/login"},d("pages.register.signin",d("pages.login.signin","Sign in"))))),M.createElement(Me.Item,{style:{marginBottom:0}},M.createElement(mt,{type:"primary",size:"large",htmlType:"submit",loading:c,block:!0},d("pages.register.buttons.submit","Sign up")))),i&&r!==!1&&M.createElement("div",{style:{marginTop:i?16:8}},M.createElement(Ge.Text,{style:{fontSize:12}},d("pages.register.buttons.haveAccount",d("pages.login.buttons.haveAccount","Have an account?"))," ",M.createElement(f,{style:{fontWeight:"bold",color:u.colorPrimaryTextHover},to:"/login"},d("pages.register.signin",d("pages.login.signin","Sign in"))))));return M.createElement(mi,{style:be,...t??{}},M.createElement(di,{justify:"center",align:i?"top":"middle",style:{padding:"16px 0",minHeight:"100dvh",paddingTop:i?"15dvh":"16px"}},M.createElement(ui,{xs:22},n?n(S,T):M.createElement(M.Fragment,null,T,S))))},"RegisterPage");import Z from"react";import{useLink as bi}from"@refinedev/core";import{Row as Pi,Col as xi,Layout as Fi,Card as hi,Typography as ct,Form as $e,Input as Ci,Button as Bi,theme as Si}from"antd";import{useTranslate as Ei,useForgotPassword as vi}from"@refinedev/core";var Cr=o(({loginLink:e,wrapperProps:r,contentProps:t,renderContent:s,formProps:n,title:a,mutationVariables:p})=>{let{token:i}=Si.useToken(),[l]=$e.useForm(),u=Ei(),y=bi(),{mutate:d,isPending:f}=vi(),m=a===!1?null:Z.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"32px",fontSize:"20px"}},a??Z.createElement(ne,{collapsed:!1})),c=Z.createElement(ct.Title,{level:3,style:{color:i.colorPrimaryTextHover,...he}},u("pages.forgotPassword.title","Forgot your password?")),T=Z.createElement(hi,{title:c,styles:{header:xe,body:Fe},style:{...Pe,backgroundColor:i.colorBgElevated},...t??{}},Z.createElement($e,{layout:"vertical",form:l,onFinish:g=>d({...g,...p}),requiredMark:!1,...n},Z.createElement($e.Item,{name:"email",label:u("pages.forgotPassword.fields.email","Email"),rules:[{required:!0,message:u("pages.forgotPassword.errors.requiredEmail","Email is required")},{type:"email",message:u("pages.forgotPassword.errors.validEmail","Invalid email address")}]},Z.createElement(Ci,{type:"email",size:"large",placeholder:u("pages.forgotPassword.fields.email","Email")})),Z.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e??Z.createElement(ct.Text,{style:{fontSize:12,marginLeft:"auto"}},u("pages.forgotPassword.buttons.haveAccount",u("pages.register.buttons.haveAccount","Have an account? "))," ",Z.createElement(y,{style:{fontWeight:"bold",color:i.colorPrimaryTextHover},to:"/login"},u("pages.forgotPassword.signin",u("pages.login.signin","Sign in"))))),Z.createElement($e.Item,{style:{marginTop:"24px",marginBottom:0}},Z.createElement(Bi,{type:"primary",size:"large",htmlType:"submit",loading:f,block:!0},u("pages.forgotPassword.buttons.submit","Send reset instructions")))));return Z.createElement(Fi,{style:be,...r??{}},Z.createElement(Pi,{justify:"center",align:"middle",style:{padding:"16px 0",minHeight:"100dvh"}},Z.createElement(xi,{xs:22},s?s(T,m):Z.createElement(Z.Fragment,null,m,T))))},"ForgotPasswordPage");import re from"react";import{Row as Di,Col as wi,Layout as ki,Card as Ri,Typography as Li,Form as Qe,Input as ft,Button as Vi,theme as Ui}from"antd";import{useTranslate as Ii,useUpdatePassword as Hi}from"@refinedev/core";var Br=o(({wrapperProps:e,contentProps:r,renderContent:t,formProps:s,title:n,mutationVariables:a})=>{let{token:p}=Ui.useToken(),[i]=Qe.useForm(),l=Ii(),{mutate:u,isPending:y}=Hi(),d=n===!1?null:re.createElement("div",{style:{display:"flex",justifyContent:"center",marginBottom:"32px",fontSize:"20px"}},n??re.createElement(ne,{collapsed:!1})),f=re.createElement(Li.Title,{level:3,style:{color:p.colorPrimaryTextHover,...he}},l("pages.updatePassword.title","Set New Password")),m=re.createElement(Ri,{title:f,styles:{header:xe,body:Fe},style:{...Pe,backgroundColor:p.colorBgElevated},...r??{}},re.createElement(Qe,{layout:"vertical",form:i,onFinish:c=>u({...c,...a}),requiredMark:!1,...s},re.createElement(Qe.Item,{name:"password",label:l("pages.updatePassword.fields.password","New Password"),rules:[{required:!0,message:l("pages.updatePassword.errors.requiredPassword","Password is required")}],style:{marginBottom:"12px"}},re.createElement(ft,{type:"password",placeholder:"\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",size:"large"})),re.createElement(Qe.Item,{name:"confirmPassword",label:l("pages.updatePassword.fields.confirmPassword","Confirm New Password"),hasFeedback:!0,dependencies:["password"],rules:[{required:!0,message:l("pages.updatePassword.errors.requiredConfirmPassword","Confirm password is required")},({getFieldValue:c})=>({validator(T,g){return!g||c("password")===g?Promise.resolve():Promise.reject(new Error(l("pages.updatePassword.errors.confirmPasswordNotMatch","Passwords do not match")))}})]},re.createElement(ft,{type:"password",placeholder:"\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",size:"large"})),re.createElement(Qe.Item,{style:{marginBottom:0}},re.createElement(Vi,{type:"primary",size:"large",htmlType:"submit",loading:y,block:!0},l("pages.updatePassword.buttons.submit","Update")))));return re.createElement(ki,{style:be,...e??{}},re.createElement(Di,{justify:"center",align:"middle",style:{padding:"16px 0",minHeight:"100dvh"}},re.createElement(wi,{xs:22},t?t(m,d):re.createElement(re.Fragment,null,d,m))))},"UpdatePasswordPage");var Oi=o(e=>{let{type:r}=e;return ve.createElement(ve.Fragment,null,o(()=>{switch(r){case"register":return ve.createElement(hr,{...e});case"forgotPassword":return ve.createElement(Cr,{...e});case"updatePassword":return ve.createElement(Br,{...e});default:return ve.createElement(Fr,{...e})}},"renderView")())},"AuthPage");import De from"react";import{useBreadcrumb as Mi,useLink as Qi,useResourceParams as Ni,matchResourceFromRoute as Ai}from"@refinedev/core";import{Breadcrumb as zi}from"antd";import{HomeOutlined as ji}from"@ant-design/icons";var Te=o(({breadcrumbProps:e,showHome:r=!0,hideIcons:t=!1,meta:s,minItems:n=2})=>{let{breadcrumbs:a}=Mi({meta:s}),p=Qi(),{resources:i}=Ni(),l=Ai("/",i);if(a.length<n)return null;let u=a.map(({label:d,icon:f,href:m})=>({key:`breadcrumb-item-${d}`,title:De.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:4}},!t&&f,m?De.createElement(p,{to:m},d):De.createElement("span",null,d))}));return De.createElement(zi,{items:o(()=>{var d,f;return r&&l.found?[{key:"breadcrumb-item-home",title:De.createElement(p,{to:"/"},((f=(d=l==null?void 0:l.resource)==null?void 0:d.meta)==null?void 0:f.icon)??De.createElement(ji,null))},...u]:u},"getBreadcrumbItems")(),...e})},"Breadcrumb");import Ne,{useContext as qi}from"react";import{PageHeader as Wi}from"@ant-design/pro-layout";import{Button as Ki,ConfigProvider as Gi,Typography as yt}from"antd";import{ArrowLeftOutlined as $i,ArrowRightOutlined as Yi}from"@ant-design/icons";import{RefinePageHeaderClassNames as Tt}from"@refinedev/ui-types";var ge=o(({children:e,...r})=>{var i;let t=(i=qi(Gi.ConfigContext))==null?void 0:i.direction,s=o(()=>Ne.createElement(Ki,{type:"text",icon:Ne.createElement(t==="rtl"?Yi:$i,null)}),"renderBackButton"),n=typeof r.backIcon>"u"?s():r.backIcon,a=typeof r.title=="string"?Ne.createElement(yt.Title,{className:Tt.Title,level:4,style:{marginBottom:0}},r.title):r.title,p=typeof r.title=="string"?Ne.createElement(yt.Title,{className:Tt.SubTitle,level:5,type:"secondary",style:{marginBottom:0}},r.subTitle):r.subTitle;return Ne.createElement(Wi,{...r,backIcon:n,title:a,subTitle:p,style:{padding:0,...r.style}},e)},"PageHeader");import ae from"react";import{useTranslate as _i,AutoSaveIndicator as Xi}from"@refinedev/core";import{Typography as Ji,theme as Zi}from"antd";import{EllipsisOutlined as ep,SyncOutlined as rp,CheckCircleOutlined as tp,ExclamationCircleOutlined as op}from"@ant-design/icons";var Jr=o(({status:e,elements:{success:r=ae.createElement(Ye,{translationKey:"autoSave.success",defaultMessage:"saved",icon:ae.createElement(tp,null)}),error:t=ae.createElement(Ye,{translationKey:"autoSave.error",defaultMessage:"auto save failure",icon:ae.createElement(op,null)}),loading:s=ae.createElement(Ye,{translationKey:"autoSave.loading",defaultMessage:"saving...",icon:ae.createElement(rp,null)}),idle:n=ae.createElement(Ye,{translationKey:"autoSave.idle",defaultMessage:"waiting for changes",icon:ae.createElement(ep,null)})}={}})=>ae.createElement(Xi,{status:e,elements:{success:r,error:t,loading:s,idle:n}}),"AutoSaveIndicator"),Ye=o(({translationKey:e,defaultMessage:r,icon:t})=>{let s=_i(),{token:n}=Zi.useToken();return ae.createElement(Ji.Text,{style:{marginRight:5,color:n.colorTextTertiary,fontSize:".8rem"}},s(e,r),ae.createElement("span",{style:{marginLeft:".2rem"}},t))},"Message");import Sr from"dayjs";var sp=o((e,r)=>e&&(r==="value"?e.map(t=>typeof t=="string"?Sr(t):t):r==="onChange"&&e.every(Sr.isDayjs)?e.map(t=>Sr(t).toISOString()):e),"rangePickerFilterMapper");var np=o(e=>{let{fileList:r}=e;return[...r]},"getValueFromEvent");var ST={Blue:{token:{colorPrimary:"#1677FF"}},Purple:{token:{colorPrimary:"#722ED1"}},Magenta:{token:{colorPrimary:"#EB2F96"}},Red:{token:{colorPrimary:"#F5222D"}},Orange:{token:{colorPrimary:"#FA541C"}},Yellow:{token:{colorPrimary:"#FAAD14"}},Green:{token:{colorPrimary:"#52C41A"}}};export{Oi as AuthPage,Jr as AutoSaveIndicator,ra as BooleanField,Te as Breadcrumb,_s as CloneButton,bn as Create,lr as CreateButton,na as DateField,Le as DeleteButton,wn as Edit,ur as EditButton,$n as EmailField,La as ErrorComponent,Qs as ExportButton,ia as FileField,Fa as FilterDropdown,Xn as ImageField,on as ImportButton,dn as List,Ue as ListButton,Aa as LoginPage,ga as MarkdownField,ca as NumberField,ge as PageHeader,Ya as ReadyPage,ST as RefineThemes,Ve as RefreshButton,Ie as SaveButton,Qn as Show,Ds as ShowButton,Wn as TagField,zn as TextField,ar as ThemedHeader,_o as ThemedLayout,Be as ThemedLayoutContext,tr as ThemedLayoutContextProvider,nr as ThemedSider,ne as ThemedTitle,br as UrlField,Ja as WelcomePage,Kt as getDefaultFilter,Wt as getDefaultSortOrder,np as getValueFromEvent,Ze as mapAntdFilterToCrudFilter,Je as mapAntdSorterToCrudSorting,sp as rangePickerFilterMapper,Nl as useCheckboxGroup,Rr as useDrawer,Vr as useDrawerForm,so as useEditableTable,ld as useFileUploadState,de as useForm,_l as useImport,Dr as useModal,kr as useModalForm,Ud as useNotificationProvider,ql as useRadioGroup,Hl as useSelect,Pd as useSiderVisible,Po as useSimpleList,Ur as useStepsForm,er as useTable,Mr as useThemedLayoutContext};
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
|
|
5
|
+
// src/hooks/form/useForm.ts
|
|
6
|
+
import React from "react";
|
|
7
|
+
import {
|
|
8
|
+
Form
|
|
9
|
+
} from "antd";
|
|
10
|
+
import { useForm as useFormSF } from "sunflower-antd";
|
|
11
|
+
import {
|
|
12
|
+
flattenObjectKeys,
|
|
13
|
+
propertyPathToArray,
|
|
14
|
+
useForm as useFormCore,
|
|
15
|
+
useWarnAboutChange,
|
|
16
|
+
useTranslate,
|
|
17
|
+
useRefineContext
|
|
18
|
+
} from "@refinedev/core";
|
|
19
|
+
var useForm = /* @__PURE__ */ __name(({
|
|
20
|
+
action,
|
|
21
|
+
resource,
|
|
22
|
+
onMutationSuccess: onMutationSuccessProp,
|
|
23
|
+
onMutationError: onMutationErrorProp,
|
|
24
|
+
autoSave,
|
|
25
|
+
submitOnEnter = false,
|
|
26
|
+
warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
|
|
27
|
+
redirect,
|
|
28
|
+
successNotification,
|
|
29
|
+
errorNotification,
|
|
30
|
+
meta,
|
|
31
|
+
queryMeta,
|
|
32
|
+
mutationMeta,
|
|
33
|
+
liveMode,
|
|
34
|
+
liveParams,
|
|
35
|
+
mutationMode,
|
|
36
|
+
dataProviderName,
|
|
37
|
+
onLiveEvent,
|
|
38
|
+
invalidates,
|
|
39
|
+
undoableTimeout,
|
|
40
|
+
queryOptions,
|
|
41
|
+
createMutationOptions,
|
|
42
|
+
updateMutationOptions,
|
|
43
|
+
id: idFromProps,
|
|
44
|
+
overtimeOptions,
|
|
45
|
+
optimisticUpdateMap,
|
|
46
|
+
defaultFormValues,
|
|
47
|
+
disableServerSideValidation: disableServerSideValidationProp = false
|
|
48
|
+
} = {}) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const { options } = useRefineContext();
|
|
51
|
+
const disableServerSideValidation = (options == null ? void 0 : options.disableServerSideValidation) || disableServerSideValidationProp;
|
|
52
|
+
const translate = useTranslate();
|
|
53
|
+
const [formAnt] = Form.useForm();
|
|
54
|
+
const formSF = useFormSF({
|
|
55
|
+
form: formAnt,
|
|
56
|
+
defaultFormValues
|
|
57
|
+
});
|
|
58
|
+
const { form } = formSF;
|
|
59
|
+
const useFormCoreResult = useFormCore({
|
|
60
|
+
onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
|
|
61
|
+
onMutationError: async (error, _variables, _context) => {
|
|
62
|
+
if (disableServerSideValidation) {
|
|
63
|
+
onMutationErrorProp == null ? void 0 : onMutationErrorProp(error, _variables, _context);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
let parsedErrors = [];
|
|
67
|
+
const fieldsValue = form.getFieldsValue();
|
|
68
|
+
const fields = Object.keys(flattenObjectKeys(fieldsValue));
|
|
69
|
+
parsedErrors = fields.map((field) => {
|
|
70
|
+
return {
|
|
71
|
+
name: propertyPathToArray(field),
|
|
72
|
+
errors: void 0
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
form.setFields(parsedErrors);
|
|
76
|
+
const errors = error == null ? void 0 : error.errors;
|
|
77
|
+
for (const key in errors) {
|
|
78
|
+
const fieldError = errors[key];
|
|
79
|
+
let newError = [];
|
|
80
|
+
if (Array.isArray(fieldError)) {
|
|
81
|
+
newError = fieldError;
|
|
82
|
+
}
|
|
83
|
+
if (typeof fieldError === "string") {
|
|
84
|
+
newError = [fieldError];
|
|
85
|
+
}
|
|
86
|
+
if (typeof fieldError === "boolean" && fieldError) {
|
|
87
|
+
newError = ["Field is not valid."];
|
|
88
|
+
}
|
|
89
|
+
if (typeof fieldError === "object" && "key" in fieldError) {
|
|
90
|
+
const translatedMessage = translate(
|
|
91
|
+
fieldError.key,
|
|
92
|
+
fieldError.message
|
|
93
|
+
);
|
|
94
|
+
newError = [translatedMessage];
|
|
95
|
+
}
|
|
96
|
+
parsedErrors.push({
|
|
97
|
+
name: propertyPathToArray(key),
|
|
98
|
+
errors: newError
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
form.setFields([...parsedErrors]);
|
|
102
|
+
onMutationErrorProp == null ? void 0 : onMutationErrorProp(error, _variables, _context);
|
|
103
|
+
},
|
|
104
|
+
redirect,
|
|
105
|
+
action,
|
|
106
|
+
resource,
|
|
107
|
+
successNotification,
|
|
108
|
+
errorNotification,
|
|
109
|
+
meta,
|
|
110
|
+
queryMeta,
|
|
111
|
+
mutationMeta,
|
|
112
|
+
liveMode,
|
|
113
|
+
liveParams,
|
|
114
|
+
mutationMode,
|
|
115
|
+
dataProviderName,
|
|
116
|
+
onLiveEvent,
|
|
117
|
+
invalidates,
|
|
118
|
+
undoableTimeout,
|
|
119
|
+
queryOptions,
|
|
120
|
+
createMutationOptions,
|
|
121
|
+
updateMutationOptions,
|
|
122
|
+
id: idFromProps,
|
|
123
|
+
overtimeOptions,
|
|
124
|
+
optimisticUpdateMap,
|
|
125
|
+
autoSave
|
|
126
|
+
});
|
|
127
|
+
const { formLoading, onFinish, query, id, onFinishAutoSave } = useFormCoreResult;
|
|
128
|
+
const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
|
|
129
|
+
const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
|
|
130
|
+
React.useEffect(() => {
|
|
131
|
+
form.resetFields();
|
|
132
|
+
}, [(_a = query == null ? void 0 : query.data) == null ? void 0 : _a.data, id]);
|
|
133
|
+
const onKeyUp = /* @__PURE__ */ __name((event) => {
|
|
134
|
+
if (submitOnEnter && event.key === "Enter") {
|
|
135
|
+
form.submit();
|
|
136
|
+
}
|
|
137
|
+
}, "onKeyUp");
|
|
138
|
+
const onValuesChange = /* @__PURE__ */ __name((changeValues, allValues) => {
|
|
139
|
+
if (changeValues && warnWhenUnsavedChanges) {
|
|
140
|
+
setWarnWhen(true);
|
|
141
|
+
}
|
|
142
|
+
if (autoSave == null ? void 0 : autoSave.enabled) {
|
|
143
|
+
setWarnWhen(false);
|
|
144
|
+
const onFinishFromProps = (autoSave == null ? void 0 : autoSave.onFinish) ?? ((values) => values);
|
|
145
|
+
return onFinishAutoSave(onFinishFromProps(allValues)).catch(
|
|
146
|
+
(error) => error
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return changeValues;
|
|
150
|
+
}, "onValuesChange");
|
|
151
|
+
const saveButtonProps = {
|
|
152
|
+
disabled: formLoading,
|
|
153
|
+
onClick: () => {
|
|
154
|
+
form.submit();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
form: formSF.form,
|
|
159
|
+
formProps: {
|
|
160
|
+
...formSF.formProps,
|
|
161
|
+
onFinish: (values) => onFinish(values).catch((error) => error),
|
|
162
|
+
onKeyUp,
|
|
163
|
+
onValuesChange,
|
|
164
|
+
initialValues: (_b = query == null ? void 0 : query.data) == null ? void 0 : _b.data
|
|
165
|
+
},
|
|
166
|
+
saveButtonProps,
|
|
167
|
+
defaultFormValuesLoading: formSF.defaultFormValuesLoading,
|
|
168
|
+
...useFormCoreResult,
|
|
169
|
+
onFinish: async (values) => {
|
|
170
|
+
return await onFinish(values ?? formSF.form.getFieldsValue(true));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}, "useForm");
|
|
174
|
+
|
|
175
|
+
// src/hooks/form/useModalForm/useModalForm.ts
|
|
176
|
+
import React2, { useCallback } from "react";
|
|
177
|
+
import {
|
|
178
|
+
useTranslate as useTranslate2,
|
|
179
|
+
useWarnAboutChange as useWarnAboutChange2,
|
|
180
|
+
useUserFriendlyName,
|
|
181
|
+
useResourceParams,
|
|
182
|
+
useParsed,
|
|
183
|
+
useGo,
|
|
184
|
+
useInvalidate
|
|
185
|
+
} from "@refinedev/core";
|
|
186
|
+
|
|
187
|
+
// src/hooks/modal/useModal/index.tsx
|
|
188
|
+
import {
|
|
189
|
+
useModal as useCoreModal
|
|
190
|
+
} from "@refinedev/core";
|
|
191
|
+
var useModal = /* @__PURE__ */ __name(({
|
|
192
|
+
modalProps = {}
|
|
193
|
+
} = {}) => {
|
|
194
|
+
const { show, close, visible } = useCoreModal({
|
|
195
|
+
defaultVisible: modalProps.open
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
modalProps: {
|
|
199
|
+
...modalProps,
|
|
200
|
+
onCancel: (e) => {
|
|
201
|
+
var _a;
|
|
202
|
+
(_a = modalProps.onCancel) == null ? void 0 : _a.call(modalProps, e);
|
|
203
|
+
close();
|
|
204
|
+
},
|
|
205
|
+
open: visible,
|
|
206
|
+
visible
|
|
207
|
+
},
|
|
208
|
+
show,
|
|
209
|
+
close
|
|
210
|
+
};
|
|
211
|
+
}, "useModal");
|
|
212
|
+
|
|
213
|
+
// src/hooks/form/useModalForm/useModalForm.ts
|
|
214
|
+
var useModalForm = /* @__PURE__ */ __name(({
|
|
215
|
+
syncWithLocation,
|
|
216
|
+
defaultVisible = false,
|
|
217
|
+
autoSubmitClose = true,
|
|
218
|
+
autoResetForm = true,
|
|
219
|
+
autoResetFormWhenClose = true,
|
|
220
|
+
autoSave,
|
|
221
|
+
invalidates,
|
|
222
|
+
...rest
|
|
223
|
+
}) => {
|
|
224
|
+
var _a;
|
|
225
|
+
const [initiallySynced, setInitiallySynced] = React2.useState(false);
|
|
226
|
+
const invalidate = useInvalidate();
|
|
227
|
+
const {
|
|
228
|
+
resource,
|
|
229
|
+
action: actionFromParams,
|
|
230
|
+
identifier
|
|
231
|
+
} = useResourceParams({ resource: rest.resource });
|
|
232
|
+
const parsed = useParsed();
|
|
233
|
+
const go = useGo();
|
|
234
|
+
const getUserFriendlyName = useUserFriendlyName();
|
|
235
|
+
const action = rest.action ?? actionFromParams ?? "";
|
|
236
|
+
const syncingId = !(typeof syncWithLocation === "object" && (syncWithLocation == null ? void 0 : syncWithLocation.syncId) === false);
|
|
237
|
+
const syncWithLocationKey = typeof syncWithLocation === "object" && "key" in syncWithLocation ? syncWithLocation.key : resource && action && syncWithLocation ? `modal-${identifier}-${action}` : void 0;
|
|
238
|
+
const useFormProps = useForm({
|
|
239
|
+
meta: {
|
|
240
|
+
...syncWithLocationKey ? { [syncWithLocationKey]: void 0 } : {},
|
|
241
|
+
...rest.meta
|
|
242
|
+
},
|
|
243
|
+
autoSave,
|
|
244
|
+
invalidates,
|
|
245
|
+
...rest
|
|
246
|
+
});
|
|
247
|
+
const { form, formProps, id, setId, formLoading, onFinish, autoSaveProps } = useFormProps;
|
|
248
|
+
const translate = useTranslate2();
|
|
249
|
+
const { warnWhen, setWarnWhen } = useWarnAboutChange2();
|
|
250
|
+
const { show, close, modalProps } = useModal({
|
|
251
|
+
modalProps: {
|
|
252
|
+
open: defaultVisible
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
const visible = modalProps.open || false;
|
|
256
|
+
const sunflowerUseModal = {
|
|
257
|
+
modalProps,
|
|
258
|
+
form,
|
|
259
|
+
formLoading,
|
|
260
|
+
formProps,
|
|
261
|
+
formResult: void 0,
|
|
262
|
+
formValues: form.getFieldsValue,
|
|
263
|
+
defaultFormValuesLoading: false,
|
|
264
|
+
initialValues: {},
|
|
265
|
+
submit: onFinish,
|
|
266
|
+
close,
|
|
267
|
+
open: modalProps.open || false,
|
|
268
|
+
show
|
|
269
|
+
};
|
|
270
|
+
React2.useEffect(() => {
|
|
271
|
+
var _a2, _b, _c, _d;
|
|
272
|
+
if (initiallySynced === false && syncWithLocationKey) {
|
|
273
|
+
const openStatus = (_b = (_a2 = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a2[syncWithLocationKey]) == null ? void 0 : _b.open;
|
|
274
|
+
if (typeof openStatus === "boolean") {
|
|
275
|
+
if (openStatus) {
|
|
276
|
+
show();
|
|
277
|
+
}
|
|
278
|
+
} else if (typeof openStatus === "string") {
|
|
279
|
+
if (openStatus === "true") {
|
|
280
|
+
show();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (syncingId) {
|
|
284
|
+
const idFromParams = (_d = (_c = parsed == null ? void 0 : parsed.params) == null ? void 0 : _c[syncWithLocationKey]) == null ? void 0 : _d.id;
|
|
285
|
+
if (idFromParams) {
|
|
286
|
+
setId == null ? void 0 : setId(idFromParams);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
setInitiallySynced(true);
|
|
290
|
+
}
|
|
291
|
+
}, [syncWithLocationKey, parsed, syncingId, setId]);
|
|
292
|
+
React2.useEffect(() => {
|
|
293
|
+
var _a2;
|
|
294
|
+
if (initiallySynced === true) {
|
|
295
|
+
if (visible && syncWithLocationKey) {
|
|
296
|
+
go({
|
|
297
|
+
query: {
|
|
298
|
+
[syncWithLocationKey]: {
|
|
299
|
+
...(_a2 = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a2[syncWithLocationKey],
|
|
300
|
+
open: true,
|
|
301
|
+
...syncingId && id && { id }
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
options: { keepQuery: true },
|
|
305
|
+
type: "replace"
|
|
306
|
+
});
|
|
307
|
+
} else if (syncWithLocationKey && !visible) {
|
|
308
|
+
go({
|
|
309
|
+
query: {
|
|
310
|
+
[syncWithLocationKey]: void 0
|
|
311
|
+
},
|
|
312
|
+
options: { keepQuery: true },
|
|
313
|
+
type: "replace"
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}, [id, visible, show, syncWithLocationKey, syncingId]);
|
|
318
|
+
const saveButtonPropsSF = {
|
|
319
|
+
disabled: formLoading,
|
|
320
|
+
loading: formLoading,
|
|
321
|
+
onClick: () => {
|
|
322
|
+
form.submit();
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const handleClose = useCallback(() => {
|
|
326
|
+
if (autoSaveProps.status === "success" && (autoSave == null ? void 0 : autoSave.invalidateOnClose)) {
|
|
327
|
+
invalidate({
|
|
328
|
+
id,
|
|
329
|
+
invalidates: invalidates || ["list", "many", "detail"],
|
|
330
|
+
dataProviderName: rest.dataProviderName,
|
|
331
|
+
resource: identifier
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
if (warnWhen) {
|
|
335
|
+
const warnWhenConfirm = window.confirm(
|
|
336
|
+
translate(
|
|
337
|
+
"warnWhenUnsavedChanges",
|
|
338
|
+
"Are you sure you want to leave? You have unsaved changes."
|
|
339
|
+
)
|
|
340
|
+
);
|
|
341
|
+
if (warnWhenConfirm) {
|
|
342
|
+
setWarnWhen(false);
|
|
343
|
+
} else {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
setId == null ? void 0 : setId(void 0);
|
|
348
|
+
sunflowerUseModal.close();
|
|
349
|
+
if (autoResetFormWhenClose) {
|
|
350
|
+
form.resetFields();
|
|
351
|
+
}
|
|
352
|
+
}, [warnWhen, autoSaveProps.status]);
|
|
353
|
+
const handleShow = useCallback(
|
|
354
|
+
(showId) => {
|
|
355
|
+
if (typeof showId !== "undefined") {
|
|
356
|
+
setId == null ? void 0 : setId(showId);
|
|
357
|
+
}
|
|
358
|
+
const needsIdToOpen = action === "edit" || action === "clone";
|
|
359
|
+
const hasId = typeof showId !== "undefined" || typeof id !== "undefined";
|
|
360
|
+
if (needsIdToOpen ? hasId : true) {
|
|
361
|
+
sunflowerUseModal.show();
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
[id]
|
|
365
|
+
);
|
|
366
|
+
const { visible: _visible, ...otherModalProps } = modalProps;
|
|
367
|
+
const newModalProps = { open: _visible, ...otherModalProps };
|
|
368
|
+
return {
|
|
369
|
+
...useFormProps,
|
|
370
|
+
...sunflowerUseModal,
|
|
371
|
+
show: handleShow,
|
|
372
|
+
close: handleClose,
|
|
373
|
+
open: visible,
|
|
374
|
+
formProps: {
|
|
375
|
+
...formProps,
|
|
376
|
+
...useFormProps.formProps,
|
|
377
|
+
onValuesChange: formProps == null ? void 0 : formProps.onValuesChange,
|
|
378
|
+
onKeyUp: formProps == null ? void 0 : formProps.onKeyUp,
|
|
379
|
+
onFinish: async (values) => {
|
|
380
|
+
await onFinish(values);
|
|
381
|
+
if (autoSubmitClose) {
|
|
382
|
+
close();
|
|
383
|
+
}
|
|
384
|
+
if (autoResetForm) {
|
|
385
|
+
form.resetFields();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
modalProps: {
|
|
390
|
+
...newModalProps,
|
|
391
|
+
width: "1000px",
|
|
392
|
+
okButtonProps: saveButtonPropsSF,
|
|
393
|
+
title: translate(
|
|
394
|
+
`${identifier}.titles.${rest.action}`,
|
|
395
|
+
`${getUserFriendlyName(
|
|
396
|
+
`${rest.action} ${((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.label) ?? identifier}`,
|
|
397
|
+
"singular"
|
|
398
|
+
)}`
|
|
399
|
+
),
|
|
400
|
+
okText: translate("buttons.save", "Save"),
|
|
401
|
+
cancelText: translate("buttons.cancel", "Cancel"),
|
|
402
|
+
onCancel: handleClose,
|
|
403
|
+
forceRender: true
|
|
404
|
+
},
|
|
405
|
+
formLoading
|
|
406
|
+
};
|
|
407
|
+
}, "useModalForm");
|
|
408
|
+
|
|
409
|
+
// src/hooks/form/useDrawerForm/useDrawerForm.ts
|
|
410
|
+
import React3, { useCallback as useCallback2 } from "react";
|
|
411
|
+
import {
|
|
412
|
+
useTranslate as useTranslate3,
|
|
413
|
+
useWarnAboutChange as useWarnAboutChange3,
|
|
414
|
+
useResourceParams as useResourceParams2,
|
|
415
|
+
useParsed as useParsed2,
|
|
416
|
+
useGo as useGo2,
|
|
417
|
+
useInvalidate as useInvalidate2
|
|
418
|
+
} from "@refinedev/core";
|
|
419
|
+
|
|
420
|
+
// src/hooks/drawer/useDrawer/index.tsx
|
|
421
|
+
import { useModal as useModal2 } from "@refinedev/core";
|
|
422
|
+
var useDrawer = /* @__PURE__ */ __name(({
|
|
423
|
+
drawerProps = {}
|
|
424
|
+
} = {}) => {
|
|
425
|
+
const { show, close, visible } = useModal2({
|
|
426
|
+
defaultVisible: drawerProps.open
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
drawerProps: {
|
|
430
|
+
...drawerProps,
|
|
431
|
+
onClose: (e) => {
|
|
432
|
+
var _a;
|
|
433
|
+
(_a = drawerProps.onClose) == null ? void 0 : _a.call(drawerProps, e);
|
|
434
|
+
close();
|
|
435
|
+
},
|
|
436
|
+
open: visible
|
|
437
|
+
},
|
|
438
|
+
show,
|
|
439
|
+
close
|
|
440
|
+
};
|
|
441
|
+
}, "useDrawer");
|
|
442
|
+
|
|
443
|
+
// src/hooks/form/useDrawerForm/useDrawerForm.ts
|
|
444
|
+
var useDrawerForm = /* @__PURE__ */ __name(({
|
|
445
|
+
syncWithLocation,
|
|
446
|
+
defaultVisible = false,
|
|
447
|
+
autoSubmitClose = true,
|
|
448
|
+
autoResetForm = true,
|
|
449
|
+
autoSave,
|
|
450
|
+
invalidates,
|
|
451
|
+
...rest
|
|
452
|
+
}) => {
|
|
453
|
+
const invalidate = useInvalidate2();
|
|
454
|
+
const [initiallySynced, setInitiallySynced] = React3.useState(false);
|
|
455
|
+
const { show, close, drawerProps } = useDrawer({
|
|
456
|
+
drawerProps: {
|
|
457
|
+
open: defaultVisible
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
const visible = drawerProps.open || false;
|
|
461
|
+
const {
|
|
462
|
+
resource,
|
|
463
|
+
action: actionFromParams,
|
|
464
|
+
identifier
|
|
465
|
+
} = useResourceParams2({
|
|
466
|
+
resource: rest.resource
|
|
467
|
+
});
|
|
468
|
+
const parsed = useParsed2();
|
|
469
|
+
const go = useGo2();
|
|
470
|
+
const action = rest.action ?? actionFromParams ?? "";
|
|
471
|
+
const syncingId = !(typeof syncWithLocation === "object" && (syncWithLocation == null ? void 0 : syncWithLocation.syncId) === false);
|
|
472
|
+
const syncWithLocationKey = typeof syncWithLocation === "object" && "key" in syncWithLocation ? syncWithLocation.key : resource && action && syncWithLocation ? `drawer-${(resource == null ? void 0 : resource.identifier) ?? (resource == null ? void 0 : resource.name)}-${action}` : void 0;
|
|
473
|
+
const useFormProps = useForm({
|
|
474
|
+
meta: {
|
|
475
|
+
...syncWithLocationKey ? { [syncWithLocationKey]: void 0 } : {},
|
|
476
|
+
...rest.meta
|
|
477
|
+
},
|
|
478
|
+
autoSave,
|
|
479
|
+
invalidates,
|
|
480
|
+
...rest
|
|
481
|
+
});
|
|
482
|
+
const { form, formProps, formLoading, id, setId, onFinish, autoSaveProps } = useFormProps;
|
|
483
|
+
React3.useEffect(() => {
|
|
484
|
+
var _a, _b, _c, _d;
|
|
485
|
+
if (initiallySynced === false && syncWithLocationKey) {
|
|
486
|
+
const openStatus = (_b = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a[syncWithLocationKey]) == null ? void 0 : _b.open;
|
|
487
|
+
if (typeof openStatus === "boolean") {
|
|
488
|
+
openStatus ? show() : close();
|
|
489
|
+
} else if (typeof openStatus === "string") {
|
|
490
|
+
if (openStatus === "true") {
|
|
491
|
+
show();
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if (syncingId) {
|
|
495
|
+
const idFromParams = (_d = (_c = parsed == null ? void 0 : parsed.params) == null ? void 0 : _c[syncWithLocationKey]) == null ? void 0 : _d.id;
|
|
496
|
+
if (idFromParams) {
|
|
497
|
+
setId == null ? void 0 : setId(idFromParams);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
setInitiallySynced(true);
|
|
501
|
+
}
|
|
502
|
+
}, [syncWithLocationKey, parsed, syncingId, setId, initiallySynced]);
|
|
503
|
+
React3.useEffect(() => {
|
|
504
|
+
var _a;
|
|
505
|
+
if (initiallySynced === true) {
|
|
506
|
+
if (visible && syncWithLocationKey) {
|
|
507
|
+
go({
|
|
508
|
+
query: {
|
|
509
|
+
[syncWithLocationKey]: {
|
|
510
|
+
...(_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a[syncWithLocationKey],
|
|
511
|
+
open: true,
|
|
512
|
+
...syncingId && id && { id }
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
options: { keepQuery: true },
|
|
516
|
+
type: "replace"
|
|
517
|
+
});
|
|
518
|
+
} else if (syncWithLocationKey && !visible) {
|
|
519
|
+
go({
|
|
520
|
+
query: {
|
|
521
|
+
[syncWithLocationKey]: void 0
|
|
522
|
+
},
|
|
523
|
+
options: { keepQuery: true },
|
|
524
|
+
type: "replace"
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}, [
|
|
529
|
+
id,
|
|
530
|
+
visible,
|
|
531
|
+
show,
|
|
532
|
+
close,
|
|
533
|
+
syncWithLocationKey,
|
|
534
|
+
syncingId,
|
|
535
|
+
initiallySynced
|
|
536
|
+
]);
|
|
537
|
+
const translate = useTranslate3();
|
|
538
|
+
const { warnWhen, setWarnWhen } = useWarnAboutChange3();
|
|
539
|
+
const saveButtonProps = {
|
|
540
|
+
disabled: formLoading,
|
|
541
|
+
onClick: () => {
|
|
542
|
+
form.submit();
|
|
543
|
+
},
|
|
544
|
+
loading: formLoading
|
|
545
|
+
};
|
|
546
|
+
const deleteButtonProps = {
|
|
547
|
+
recordItemId: id,
|
|
548
|
+
onSuccess: () => {
|
|
549
|
+
setId == null ? void 0 : setId(void 0);
|
|
550
|
+
close();
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
const handleClose = useCallback2(() => {
|
|
554
|
+
if (autoSaveProps.status === "success" && (autoSave == null ? void 0 : autoSave.invalidateOnClose)) {
|
|
555
|
+
invalidate({
|
|
556
|
+
id,
|
|
557
|
+
invalidates: invalidates || ["list", "many", "detail"],
|
|
558
|
+
dataProviderName: rest.dataProviderName,
|
|
559
|
+
resource: identifier
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
if (warnWhen) {
|
|
563
|
+
const warnWhenConfirm = window.confirm(
|
|
564
|
+
translate(
|
|
565
|
+
"warnWhenUnsavedChanges",
|
|
566
|
+
"Are you sure you want to leave? You have unsaved changes."
|
|
567
|
+
)
|
|
568
|
+
);
|
|
569
|
+
if (warnWhenConfirm) {
|
|
570
|
+
setWarnWhen(false);
|
|
571
|
+
} else {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
close();
|
|
576
|
+
setId == null ? void 0 : setId(void 0);
|
|
577
|
+
}, [warnWhen]);
|
|
578
|
+
const handleShow = useCallback2(
|
|
579
|
+
(showId) => {
|
|
580
|
+
if (typeof showId !== "undefined") {
|
|
581
|
+
setId == null ? void 0 : setId(showId);
|
|
582
|
+
}
|
|
583
|
+
const needsIdToOpen = action === "edit" || action === "clone";
|
|
584
|
+
const hasId = typeof showId !== "undefined" || typeof id !== "undefined";
|
|
585
|
+
if (needsIdToOpen ? hasId : true) {
|
|
586
|
+
show();
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
[id]
|
|
590
|
+
);
|
|
591
|
+
return {
|
|
592
|
+
...useFormProps,
|
|
593
|
+
show: handleShow,
|
|
594
|
+
close: handleClose,
|
|
595
|
+
formProps: {
|
|
596
|
+
form,
|
|
597
|
+
...useFormProps.formProps,
|
|
598
|
+
onValuesChange: formProps == null ? void 0 : formProps.onValuesChange,
|
|
599
|
+
onKeyUp: formProps == null ? void 0 : formProps.onKeyUp,
|
|
600
|
+
onFinish: async (values) => {
|
|
601
|
+
await onFinish(values);
|
|
602
|
+
if (autoSubmitClose) {
|
|
603
|
+
close();
|
|
604
|
+
}
|
|
605
|
+
if (autoResetForm) {
|
|
606
|
+
form.resetFields();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
drawerProps: {
|
|
611
|
+
...drawerProps,
|
|
612
|
+
width: "500px",
|
|
613
|
+
onClose: handleClose,
|
|
614
|
+
open: visible,
|
|
615
|
+
forceRender: true
|
|
616
|
+
},
|
|
617
|
+
saveButtonProps,
|
|
618
|
+
deleteButtonProps,
|
|
619
|
+
formLoading
|
|
620
|
+
};
|
|
621
|
+
}, "useDrawerForm");
|
|
622
|
+
|
|
623
|
+
// src/hooks/form/useStepsForm/useStepsForm.ts
|
|
624
|
+
import {
|
|
625
|
+
useStepsForm as useStepsFormSF
|
|
626
|
+
} from "sunflower-antd";
|
|
627
|
+
var useStepsForm = /* @__PURE__ */ __name((props = {}) => {
|
|
628
|
+
const useFormProps = useForm({
|
|
629
|
+
...props
|
|
630
|
+
});
|
|
631
|
+
const { form, formProps } = useFormProps;
|
|
632
|
+
const stepsPropsSunflower = useStepsFormSF({
|
|
633
|
+
isBackValidate: false,
|
|
634
|
+
form,
|
|
635
|
+
submit: (values) => {
|
|
636
|
+
var _a;
|
|
637
|
+
(_a = formProps == null ? void 0 : formProps.onFinish) == null ? void 0 : _a.call(formProps, values);
|
|
638
|
+
},
|
|
639
|
+
...props
|
|
640
|
+
});
|
|
641
|
+
return {
|
|
642
|
+
...useFormProps,
|
|
643
|
+
...stepsPropsSunflower,
|
|
644
|
+
formLoading: useFormProps.formLoading,
|
|
645
|
+
formProps: {
|
|
646
|
+
...stepsPropsSunflower.formProps,
|
|
647
|
+
...useFormProps.formProps,
|
|
648
|
+
onValuesChange: formProps == null ? void 0 : formProps.onValuesChange,
|
|
649
|
+
onKeyUp: formProps == null ? void 0 : formProps.onKeyUp
|
|
650
|
+
},
|
|
651
|
+
saveButtonProps: {
|
|
652
|
+
...useFormProps.saveButtonProps,
|
|
653
|
+
onClick: () => stepsPropsSunflower.submit()
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
}, "useStepsForm");
|
|
657
|
+
|
|
658
|
+
// src/hooks/table/useTable/useTable.ts
|
|
659
|
+
import React5, { Children, createElement, Fragment } from "react";
|
|
660
|
+
import {
|
|
661
|
+
Grid,
|
|
662
|
+
Form as Form2
|
|
663
|
+
} from "antd";
|
|
664
|
+
import { useForm as useFormSF2 } from "sunflower-antd";
|
|
665
|
+
import {
|
|
666
|
+
useLiveMode,
|
|
667
|
+
useTable as useTableCore,
|
|
668
|
+
useSyncWithLocation
|
|
669
|
+
} from "@refinedev/core";
|
|
670
|
+
|
|
671
|
+
// src/definitions/table/index.ts
|
|
672
|
+
import {
|
|
673
|
+
getDefaultFilter as getDefaultFilterCore,
|
|
674
|
+
getDefaultSortOrder as getDefaultSortOrderCore
|
|
675
|
+
} from "@refinedev/core";
|
|
676
|
+
var getDefaultSortOrder = /* @__PURE__ */ __name((columnName, sorter) => {
|
|
677
|
+
const sort = getDefaultSortOrderCore(columnName, sorter);
|
|
678
|
+
if (sort) {
|
|
679
|
+
return `${sort}end`;
|
|
680
|
+
}
|
|
681
|
+
return void 0;
|
|
682
|
+
}, "getDefaultSortOrder");
|
|
683
|
+
var getDefaultFilter = /* @__PURE__ */ __name((columnName, filters, operatorType = "eq") => {
|
|
684
|
+
return getDefaultFilterCore(columnName, filters, operatorType);
|
|
685
|
+
}, "getDefaultFilter");
|
|
686
|
+
var mapAntdSorterToCrudSorting = /* @__PURE__ */ __name((sorter) => {
|
|
687
|
+
const crudSorting = [];
|
|
688
|
+
if (Array.isArray(sorter)) {
|
|
689
|
+
sorter.sort((a, b) => {
|
|
690
|
+
var _a, _b;
|
|
691
|
+
return (((_a = a.column) == null ? void 0 : _a.sorter).multiple ?? 0) < (((_b = b.column) == null ? void 0 : _b.sorter).multiple ?? 0) ? -1 : 0;
|
|
692
|
+
}).map((item) => {
|
|
693
|
+
if (item.field && item.order) {
|
|
694
|
+
const field = Array.isArray(item.field) ? item.field.join(".") : `${item.field}`;
|
|
695
|
+
crudSorting.push({
|
|
696
|
+
field: `${item.columnKey ?? field}`,
|
|
697
|
+
order: item.order.replace("end", "")
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
} else {
|
|
702
|
+
if (sorter.field && sorter.order) {
|
|
703
|
+
const field = Array.isArray(sorter.field) ? sorter.field.join(".") : `${sorter.field}`;
|
|
704
|
+
crudSorting.push({
|
|
705
|
+
field: `${sorter.columnKey ?? field}`,
|
|
706
|
+
order: sorter.order.replace("end", "")
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
return crudSorting;
|
|
711
|
+
}, "mapAntdSorterToCrudSorting");
|
|
712
|
+
var mapAntdFilterToCrudFilter = /* @__PURE__ */ __name((tableFilters, prevFilters, initialFilters) => {
|
|
713
|
+
const crudFilters = [];
|
|
714
|
+
const mapInitialFilter = (initialFilters ?? []).reduce((acc, item) => {
|
|
715
|
+
const field = item.key || item.field;
|
|
716
|
+
return { ...acc, [field]: item };
|
|
717
|
+
}, {});
|
|
718
|
+
Object.keys(tableFilters).map((field) => {
|
|
719
|
+
var _a, _b;
|
|
720
|
+
const value = tableFilters[field];
|
|
721
|
+
const operator = ((_a = prevFilters.filter((i) => i.operator !== "or").find((p) => p.field === field)) == null ? void 0 : _a.operator) || ((_b = mapInitialFilter[field]) == null ? void 0 : _b.operator);
|
|
722
|
+
if (operator !== "or" && operator !== "and") {
|
|
723
|
+
crudFilters.push({
|
|
724
|
+
field,
|
|
725
|
+
operator: operator ?? (Array.isArray(value) ? "in" : "eq"),
|
|
726
|
+
value
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
return crudFilters;
|
|
731
|
+
}, "mapAntdFilterToCrudFilter");
|
|
732
|
+
|
|
733
|
+
// src/hooks/table/useTable/paginationLink.tsx
|
|
734
|
+
import { useLink } from "@refinedev/core";
|
|
735
|
+
import React4 from "react";
|
|
736
|
+
var PaginationLink = /* @__PURE__ */ __name(({ to, element }) => {
|
|
737
|
+
const Link = useLink();
|
|
738
|
+
return /* @__PURE__ */ React4.createElement(
|
|
739
|
+
Link,
|
|
740
|
+
{
|
|
741
|
+
to,
|
|
742
|
+
replace: false,
|
|
743
|
+
onClick: (e) => {
|
|
744
|
+
e.preventDefault();
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
element
|
|
748
|
+
);
|
|
749
|
+
}, "PaginationLink");
|
|
750
|
+
|
|
751
|
+
// src/hooks/table/useTable/useTable.ts
|
|
752
|
+
var useTable = /* @__PURE__ */ __name(({
|
|
753
|
+
onSearch,
|
|
754
|
+
pagination: paginationFromProp,
|
|
755
|
+
filters: filtersFromProp,
|
|
756
|
+
sorters: sortersFromProp,
|
|
757
|
+
syncWithLocation,
|
|
758
|
+
resource,
|
|
759
|
+
successNotification,
|
|
760
|
+
errorNotification,
|
|
761
|
+
queryOptions,
|
|
762
|
+
liveMode: liveModeFromProp,
|
|
763
|
+
onLiveEvent,
|
|
764
|
+
liveParams,
|
|
765
|
+
meta,
|
|
766
|
+
dataProviderName
|
|
767
|
+
} = {}) => {
|
|
768
|
+
const {
|
|
769
|
+
tableQuery,
|
|
770
|
+
currentPage,
|
|
771
|
+
setCurrentPage,
|
|
772
|
+
pageSize,
|
|
773
|
+
setPageSize,
|
|
774
|
+
filters,
|
|
775
|
+
setFilters,
|
|
776
|
+
sorters,
|
|
777
|
+
setSorters,
|
|
778
|
+
createLinkForSyncWithLocation,
|
|
779
|
+
pageCount,
|
|
780
|
+
overtime,
|
|
781
|
+
result
|
|
782
|
+
} = useTableCore({
|
|
783
|
+
pagination: paginationFromProp,
|
|
784
|
+
filters: filtersFromProp,
|
|
785
|
+
sorters: sortersFromProp,
|
|
786
|
+
syncWithLocation,
|
|
787
|
+
resource,
|
|
788
|
+
successNotification,
|
|
789
|
+
errorNotification,
|
|
790
|
+
queryOptions,
|
|
791
|
+
liveMode: liveModeFromProp,
|
|
792
|
+
onLiveEvent,
|
|
793
|
+
liveParams,
|
|
794
|
+
meta,
|
|
795
|
+
dataProviderName
|
|
796
|
+
});
|
|
797
|
+
const { syncWithLocation: defaultSyncWithLocation } = useSyncWithLocation();
|
|
798
|
+
const shouldSyncWithLocation = syncWithLocation ?? defaultSyncWithLocation;
|
|
799
|
+
const breakpoint = Grid.useBreakpoint();
|
|
800
|
+
const [form] = Form2.useForm();
|
|
801
|
+
const formSF = useFormSF2({
|
|
802
|
+
form
|
|
803
|
+
});
|
|
804
|
+
const liveMode = useLiveMode(liveModeFromProp);
|
|
805
|
+
const isPaginationEnabled = (paginationFromProp == null ? void 0 : paginationFromProp.mode) !== "off";
|
|
806
|
+
const preferredInitialFilters = filtersFromProp == null ? void 0 : filtersFromProp.initial;
|
|
807
|
+
const { data, isFetched, isLoading } = tableQuery;
|
|
808
|
+
React5.useEffect(() => {
|
|
809
|
+
if (shouldSyncWithLocation) {
|
|
810
|
+
const registeredFields = formSF.form.getFieldsValue();
|
|
811
|
+
const filterFilterMap = Object.keys(registeredFields).reduce(
|
|
812
|
+
(acc, curr) => {
|
|
813
|
+
const filter = filters.find(
|
|
814
|
+
(filter2) => "field" in filter2 && filter2.field === curr
|
|
815
|
+
);
|
|
816
|
+
if (filter) {
|
|
817
|
+
acc[curr] = filter == null ? void 0 : filter.value;
|
|
818
|
+
}
|
|
819
|
+
return acc;
|
|
820
|
+
},
|
|
821
|
+
{}
|
|
822
|
+
);
|
|
823
|
+
formSF.form.setFieldsValue(filterFilterMap);
|
|
824
|
+
}
|
|
825
|
+
}, [shouldSyncWithLocation]);
|
|
826
|
+
const onChange = /* @__PURE__ */ __name((paginationState, tableFilters, sorter) => {
|
|
827
|
+
if (tableFilters && Object.keys(tableFilters).length > 0) {
|
|
828
|
+
const crudFilters = mapAntdFilterToCrudFilter(
|
|
829
|
+
tableFilters,
|
|
830
|
+
filters,
|
|
831
|
+
preferredInitialFilters
|
|
832
|
+
);
|
|
833
|
+
setFilters(crudFilters);
|
|
834
|
+
}
|
|
835
|
+
if (sorter && Object.keys(sorter).length > 0) {
|
|
836
|
+
const crudSorting = mapAntdSorterToCrudSorting(sorter);
|
|
837
|
+
setSorters(crudSorting);
|
|
838
|
+
}
|
|
839
|
+
if (isPaginationEnabled) {
|
|
840
|
+
setCurrentPage == null ? void 0 : setCurrentPage(paginationState.current || 1);
|
|
841
|
+
setPageSize == null ? void 0 : setPageSize(paginationState.pageSize || 10);
|
|
842
|
+
}
|
|
843
|
+
}, "onChange");
|
|
844
|
+
const onFinish = /* @__PURE__ */ __name(async (value) => {
|
|
845
|
+
if (onSearch) {
|
|
846
|
+
const searchFilters = await onSearch(value);
|
|
847
|
+
setFilters(searchFilters);
|
|
848
|
+
if (isPaginationEnabled) {
|
|
849
|
+
setCurrentPage == null ? void 0 : setCurrentPage(1);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}, "onFinish");
|
|
853
|
+
const antdPagination = /* @__PURE__ */ __name(() => {
|
|
854
|
+
if (isPaginationEnabled) {
|
|
855
|
+
return {
|
|
856
|
+
itemRender: (page, type, element) => {
|
|
857
|
+
var _a;
|
|
858
|
+
const link = createLinkForSyncWithLocation({
|
|
859
|
+
pagination: {
|
|
860
|
+
pageSize,
|
|
861
|
+
currentPage: page
|
|
862
|
+
},
|
|
863
|
+
sorters,
|
|
864
|
+
filters
|
|
865
|
+
});
|
|
866
|
+
if (type === "page") {
|
|
867
|
+
return createElement(PaginationLink, {
|
|
868
|
+
to: link,
|
|
869
|
+
element: `${page}`
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
if (type === "next" || type === "prev") {
|
|
873
|
+
return createElement(PaginationLink, {
|
|
874
|
+
to: link,
|
|
875
|
+
element
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (type === "jump-next" || type === "jump-prev") {
|
|
879
|
+
const elementChildren = (_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children;
|
|
880
|
+
return createElement(PaginationLink, {
|
|
881
|
+
to: link,
|
|
882
|
+
element: Children.count(elementChildren) > 1 ? createElement(Fragment, {}, elementChildren) : elementChildren
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
return element;
|
|
886
|
+
},
|
|
887
|
+
pageSize,
|
|
888
|
+
current: currentPage,
|
|
889
|
+
simple: !breakpoint.sm,
|
|
890
|
+
position: !breakpoint.sm ? ["bottomCenter"] : ["bottomRight"],
|
|
891
|
+
total: data == null ? void 0 : data.total
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
return false;
|
|
895
|
+
}, "antdPagination");
|
|
896
|
+
return {
|
|
897
|
+
searchFormProps: {
|
|
898
|
+
...formSF.formProps,
|
|
899
|
+
onFinish
|
|
900
|
+
},
|
|
901
|
+
tableProps: {
|
|
902
|
+
dataSource: data == null ? void 0 : data.data,
|
|
903
|
+
loading: liveMode === "auto" ? isLoading : !isFetched,
|
|
904
|
+
onChange,
|
|
905
|
+
pagination: antdPagination(),
|
|
906
|
+
scroll: { x: true }
|
|
907
|
+
},
|
|
908
|
+
tableQuery,
|
|
909
|
+
sorters,
|
|
910
|
+
filters,
|
|
911
|
+
setSorters,
|
|
912
|
+
setFilters,
|
|
913
|
+
currentPage,
|
|
914
|
+
setCurrentPage,
|
|
915
|
+
pageSize,
|
|
916
|
+
setPageSize,
|
|
917
|
+
pageCount,
|
|
918
|
+
createLinkForSyncWithLocation,
|
|
919
|
+
overtime,
|
|
920
|
+
result
|
|
921
|
+
};
|
|
922
|
+
}, "useTable");
|
|
923
|
+
|
|
924
|
+
// src/hooks/table/useEditableTable/useEditableTable.ts
|
|
925
|
+
var useEditableTable = /* @__PURE__ */ __name(({
|
|
926
|
+
autoSubmitClose = true,
|
|
927
|
+
...props
|
|
928
|
+
} = {}) => {
|
|
929
|
+
const table = useTable({
|
|
930
|
+
...props,
|
|
931
|
+
successNotification: void 0,
|
|
932
|
+
errorNotification: void 0
|
|
933
|
+
});
|
|
934
|
+
const edit = useForm({
|
|
935
|
+
...props,
|
|
936
|
+
action: "edit",
|
|
937
|
+
redirect: false
|
|
938
|
+
});
|
|
939
|
+
const { id: editId, setId, saveButtonProps } = edit;
|
|
940
|
+
const cancelButtonProps = {
|
|
941
|
+
onClick: () => {
|
|
942
|
+
setId(void 0);
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
const editButtonProps = /* @__PURE__ */ __name((id) => {
|
|
946
|
+
return {
|
|
947
|
+
onClick: () => setId(id)
|
|
948
|
+
};
|
|
949
|
+
}, "editButtonProps");
|
|
950
|
+
const isEditing = /* @__PURE__ */ __name((id) => id === editId, "isEditing");
|
|
951
|
+
return {
|
|
952
|
+
...table,
|
|
953
|
+
...edit,
|
|
954
|
+
formProps: {
|
|
955
|
+
...edit.formProps,
|
|
956
|
+
onFinish: async (values) => {
|
|
957
|
+
try {
|
|
958
|
+
const result = await edit.onFinish(values);
|
|
959
|
+
if (autoSubmitClose) {
|
|
960
|
+
setId(void 0);
|
|
961
|
+
}
|
|
962
|
+
return result;
|
|
963
|
+
} catch (error) {
|
|
964
|
+
return error;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
saveButtonProps,
|
|
969
|
+
cancelButtonProps,
|
|
970
|
+
editButtonProps,
|
|
971
|
+
isEditing
|
|
972
|
+
};
|
|
973
|
+
}, "useEditableTable");
|
|
974
|
+
|
|
975
|
+
// src/hooks/fields/useSelect/index.ts
|
|
976
|
+
import {
|
|
977
|
+
useSelect as useSelectCore
|
|
978
|
+
} from "@refinedev/core";
|
|
979
|
+
var useSelect = /* @__PURE__ */ __name((props) => {
|
|
980
|
+
const { query, defaultValueQuery, onSearch, options } = useSelectCore(props);
|
|
981
|
+
return {
|
|
982
|
+
selectProps: {
|
|
983
|
+
options,
|
|
984
|
+
onSearch,
|
|
985
|
+
loading: defaultValueQuery.query.isFetching,
|
|
986
|
+
showSearch: true,
|
|
987
|
+
filterOption: false
|
|
988
|
+
},
|
|
989
|
+
query,
|
|
990
|
+
defaultValueQuery: defaultValueQuery.query
|
|
991
|
+
};
|
|
992
|
+
}, "useSelect");
|
|
993
|
+
|
|
994
|
+
// src/hooks/fields/useCheckboxGroup/index.ts
|
|
995
|
+
import {
|
|
996
|
+
useSelect as useSelect2
|
|
997
|
+
} from "@refinedev/core";
|
|
998
|
+
var useCheckboxGroup = /* @__PURE__ */ __name(({
|
|
999
|
+
resource,
|
|
1000
|
+
sorters,
|
|
1001
|
+
filters,
|
|
1002
|
+
optionLabel,
|
|
1003
|
+
optionValue,
|
|
1004
|
+
queryOptions,
|
|
1005
|
+
pagination,
|
|
1006
|
+
liveMode,
|
|
1007
|
+
defaultValue,
|
|
1008
|
+
selectedOptionsOrder,
|
|
1009
|
+
onLiveEvent,
|
|
1010
|
+
liveParams,
|
|
1011
|
+
meta,
|
|
1012
|
+
dataProviderName,
|
|
1013
|
+
...rest
|
|
1014
|
+
}) => {
|
|
1015
|
+
const { query, options } = useSelect2({
|
|
1016
|
+
resource,
|
|
1017
|
+
sorters,
|
|
1018
|
+
filters,
|
|
1019
|
+
optionLabel,
|
|
1020
|
+
optionValue,
|
|
1021
|
+
queryOptions,
|
|
1022
|
+
pagination,
|
|
1023
|
+
liveMode,
|
|
1024
|
+
defaultValue,
|
|
1025
|
+
selectedOptionsOrder,
|
|
1026
|
+
onLiveEvent,
|
|
1027
|
+
liveParams,
|
|
1028
|
+
meta,
|
|
1029
|
+
dataProviderName,
|
|
1030
|
+
...rest
|
|
1031
|
+
});
|
|
1032
|
+
return {
|
|
1033
|
+
checkboxGroupProps: {
|
|
1034
|
+
options,
|
|
1035
|
+
defaultValue
|
|
1036
|
+
},
|
|
1037
|
+
query
|
|
1038
|
+
};
|
|
1039
|
+
}, "useCheckboxGroup");
|
|
1040
|
+
|
|
1041
|
+
// src/hooks/fields/useRadioGroup/index.ts
|
|
1042
|
+
import {
|
|
1043
|
+
useSelect as useSelect3
|
|
1044
|
+
} from "@refinedev/core";
|
|
1045
|
+
var useRadioGroup = /* @__PURE__ */ __name(({
|
|
1046
|
+
resource,
|
|
1047
|
+
sorters,
|
|
1048
|
+
filters,
|
|
1049
|
+
optionLabel,
|
|
1050
|
+
optionValue,
|
|
1051
|
+
queryOptions,
|
|
1052
|
+
pagination,
|
|
1053
|
+
liveMode,
|
|
1054
|
+
defaultValue,
|
|
1055
|
+
selectedOptionsOrder,
|
|
1056
|
+
onLiveEvent,
|
|
1057
|
+
liveParams,
|
|
1058
|
+
meta,
|
|
1059
|
+
dataProviderName,
|
|
1060
|
+
...rest
|
|
1061
|
+
}) => {
|
|
1062
|
+
const { query, options } = useSelect3({
|
|
1063
|
+
resource,
|
|
1064
|
+
sorters,
|
|
1065
|
+
filters,
|
|
1066
|
+
optionLabel,
|
|
1067
|
+
optionValue,
|
|
1068
|
+
queryOptions,
|
|
1069
|
+
pagination,
|
|
1070
|
+
liveMode,
|
|
1071
|
+
defaultValue,
|
|
1072
|
+
selectedOptionsOrder,
|
|
1073
|
+
onLiveEvent,
|
|
1074
|
+
liveParams,
|
|
1075
|
+
meta,
|
|
1076
|
+
dataProviderName,
|
|
1077
|
+
...rest
|
|
1078
|
+
});
|
|
1079
|
+
return {
|
|
1080
|
+
radioGroupProps: {
|
|
1081
|
+
options,
|
|
1082
|
+
defaultValue
|
|
1083
|
+
},
|
|
1084
|
+
query
|
|
1085
|
+
};
|
|
1086
|
+
}, "useRadioGroup");
|
|
1087
|
+
|
|
1088
|
+
// src/hooks/import/index.tsx
|
|
1089
|
+
import React6 from "react";
|
|
1090
|
+
import {
|
|
1091
|
+
notification,
|
|
1092
|
+
Progress
|
|
1093
|
+
} from "antd";
|
|
1094
|
+
import {
|
|
1095
|
+
useTranslate as useTranslate4,
|
|
1096
|
+
useResourceParams as useResourceParams3,
|
|
1097
|
+
useImport as useImportCore
|
|
1098
|
+
} from "@refinedev/core";
|
|
1099
|
+
var useImport = /* @__PURE__ */ __name(({
|
|
1100
|
+
resource: resourceFromProp,
|
|
1101
|
+
mapData = /* @__PURE__ */ __name((item) => item, "mapData"),
|
|
1102
|
+
paparseOptions,
|
|
1103
|
+
batchSize = Number.MAX_SAFE_INTEGER,
|
|
1104
|
+
onFinish,
|
|
1105
|
+
meta,
|
|
1106
|
+
dataProviderName,
|
|
1107
|
+
onProgress: onProgressFromProp
|
|
1108
|
+
} = {}) => {
|
|
1109
|
+
const t = useTranslate4();
|
|
1110
|
+
const { resource } = useResourceParams3({ resource: resourceFromProp });
|
|
1111
|
+
const { mutationResult, isLoading, handleChange } = useImportCore({
|
|
1112
|
+
resource: (resource == null ? void 0 : resource.identifier) ?? (resource == null ? void 0 : resource.name),
|
|
1113
|
+
mapData,
|
|
1114
|
+
paparseOptions,
|
|
1115
|
+
batchSize,
|
|
1116
|
+
meta,
|
|
1117
|
+
dataProviderName,
|
|
1118
|
+
onFinish,
|
|
1119
|
+
onProgress: onProgressFromProp ?? (({ totalAmount, processedAmount }) => {
|
|
1120
|
+
if (totalAmount > 0 && processedAmount > 0) {
|
|
1121
|
+
const description = /* @__PURE__ */ React6.createElement(
|
|
1122
|
+
"div",
|
|
1123
|
+
{
|
|
1124
|
+
style: {
|
|
1125
|
+
display: "flex",
|
|
1126
|
+
alignItems: "center",
|
|
1127
|
+
justifyContent: "space-between",
|
|
1128
|
+
marginTop: "-7px"
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
/* @__PURE__ */ React6.createElement(
|
|
1132
|
+
Progress,
|
|
1133
|
+
{
|
|
1134
|
+
type: "circle",
|
|
1135
|
+
percent: Math.floor(processedAmount / totalAmount * 100),
|
|
1136
|
+
size: 50,
|
|
1137
|
+
strokeColor: "#1890ff",
|
|
1138
|
+
status: "normal"
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
/* @__PURE__ */ React6.createElement("span", { style: { marginLeft: 8, width: "100%" } }, t(
|
|
1142
|
+
"notifications.importProgress",
|
|
1143
|
+
{
|
|
1144
|
+
processed: processedAmount,
|
|
1145
|
+
total: totalAmount
|
|
1146
|
+
},
|
|
1147
|
+
`Importing: ${processedAmount}/${totalAmount}`
|
|
1148
|
+
))
|
|
1149
|
+
);
|
|
1150
|
+
notification.open({
|
|
1151
|
+
description,
|
|
1152
|
+
message: null,
|
|
1153
|
+
key: `${resource}-import`,
|
|
1154
|
+
duration: 0
|
|
1155
|
+
});
|
|
1156
|
+
if (processedAmount >= totalAmount) {
|
|
1157
|
+
}
|
|
1158
|
+
if (processedAmount === totalAmount) {
|
|
1159
|
+
setTimeout(() => {
|
|
1160
|
+
notification.destroy(`${resource}-import`);
|
|
1161
|
+
}, 4500);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
})
|
|
1165
|
+
});
|
|
1166
|
+
return {
|
|
1167
|
+
uploadProps: {
|
|
1168
|
+
onChange: handleChange,
|
|
1169
|
+
beforeUpload: () => false,
|
|
1170
|
+
showUploadList: false,
|
|
1171
|
+
accept: ".csv"
|
|
1172
|
+
},
|
|
1173
|
+
buttonProps: {
|
|
1174
|
+
type: "default",
|
|
1175
|
+
loading: isLoading
|
|
1176
|
+
},
|
|
1177
|
+
mutationResult,
|
|
1178
|
+
isLoading
|
|
1179
|
+
};
|
|
1180
|
+
}, "useImport");
|
|
1181
|
+
|
|
1182
|
+
// src/hooks/useSimpleList/useSimpleList.ts
|
|
1183
|
+
import { Children as Children2, createElement as createElement2, Fragment as Fragment2 } from "react";
|
|
1184
|
+
import { Form as Form3, Grid as Grid2 } from "antd";
|
|
1185
|
+
import {
|
|
1186
|
+
useTable as useTableCore2
|
|
1187
|
+
} from "@refinedev/core";
|
|
1188
|
+
import { useLiveMode as useLiveMode2 } from "@refinedev/core";
|
|
1189
|
+
var useSimpleList = /* @__PURE__ */ __name(({
|
|
1190
|
+
resource,
|
|
1191
|
+
pagination: paginationFromProp,
|
|
1192
|
+
filters: filtersFromProp,
|
|
1193
|
+
sorters: sortersFromProp,
|
|
1194
|
+
onSearch,
|
|
1195
|
+
queryOptions,
|
|
1196
|
+
syncWithLocation,
|
|
1197
|
+
successNotification,
|
|
1198
|
+
errorNotification,
|
|
1199
|
+
liveMode: liveModeFromProp,
|
|
1200
|
+
onLiveEvent,
|
|
1201
|
+
liveParams,
|
|
1202
|
+
meta,
|
|
1203
|
+
dataProviderName
|
|
1204
|
+
} = {}) => {
|
|
1205
|
+
const {
|
|
1206
|
+
sorters,
|
|
1207
|
+
filters,
|
|
1208
|
+
currentPage,
|
|
1209
|
+
pageSize,
|
|
1210
|
+
pageCount,
|
|
1211
|
+
setFilters,
|
|
1212
|
+
setCurrentPage,
|
|
1213
|
+
setPageSize,
|
|
1214
|
+
setSorters,
|
|
1215
|
+
createLinkForSyncWithLocation,
|
|
1216
|
+
tableQuery,
|
|
1217
|
+
overtime,
|
|
1218
|
+
result
|
|
1219
|
+
} = useTableCore2({
|
|
1220
|
+
resource,
|
|
1221
|
+
pagination: paginationFromProp,
|
|
1222
|
+
filters: filtersFromProp,
|
|
1223
|
+
sorters: sortersFromProp,
|
|
1224
|
+
queryOptions,
|
|
1225
|
+
successNotification,
|
|
1226
|
+
errorNotification,
|
|
1227
|
+
liveMode: liveModeFromProp,
|
|
1228
|
+
onLiveEvent,
|
|
1229
|
+
liveParams,
|
|
1230
|
+
meta,
|
|
1231
|
+
syncWithLocation,
|
|
1232
|
+
dataProviderName
|
|
1233
|
+
});
|
|
1234
|
+
const isPaginationEnabled = (paginationFromProp == null ? void 0 : paginationFromProp.mode) !== "off";
|
|
1235
|
+
const breakpoint = Grid2.useBreakpoint();
|
|
1236
|
+
const liveMode = useLiveMode2(liveModeFromProp);
|
|
1237
|
+
const [form] = Form3.useForm();
|
|
1238
|
+
const { data, isFetched, isLoading } = tableQuery;
|
|
1239
|
+
const onChange = /* @__PURE__ */ __name((page, pageSize2) => {
|
|
1240
|
+
if (isPaginationEnabled) {
|
|
1241
|
+
setCurrentPage(page);
|
|
1242
|
+
setPageSize(pageSize2 || 10);
|
|
1243
|
+
}
|
|
1244
|
+
}, "onChange");
|
|
1245
|
+
const onFinish = /* @__PURE__ */ __name(async (values) => {
|
|
1246
|
+
if (onSearch) {
|
|
1247
|
+
const searchFilters = await onSearch(values);
|
|
1248
|
+
if (isPaginationEnabled) {
|
|
1249
|
+
setCurrentPage == null ? void 0 : setCurrentPage(1);
|
|
1250
|
+
}
|
|
1251
|
+
return setFilters(searchFilters);
|
|
1252
|
+
}
|
|
1253
|
+
}, "onFinish");
|
|
1254
|
+
const antdPagination = /* @__PURE__ */ __name(() => {
|
|
1255
|
+
if (isPaginationEnabled) {
|
|
1256
|
+
return {
|
|
1257
|
+
itemRender: (page, type, element) => {
|
|
1258
|
+
var _a;
|
|
1259
|
+
const link = createLinkForSyncWithLocation({
|
|
1260
|
+
pagination: {
|
|
1261
|
+
pageSize,
|
|
1262
|
+
currentPage: page
|
|
1263
|
+
},
|
|
1264
|
+
sorters,
|
|
1265
|
+
filters
|
|
1266
|
+
});
|
|
1267
|
+
if (type === "page") {
|
|
1268
|
+
return createElement2(PaginationLink, {
|
|
1269
|
+
to: link,
|
|
1270
|
+
element: `${page}`
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
if (type === "next" || type === "prev") {
|
|
1274
|
+
return createElement2(PaginationLink, {
|
|
1275
|
+
to: link,
|
|
1276
|
+
element
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
if (type === "jump-next" || type === "jump-prev") {
|
|
1280
|
+
const elementChildren = (_a = element == null ? void 0 : element.props) == null ? void 0 : _a.children;
|
|
1281
|
+
return createElement2(PaginationLink, {
|
|
1282
|
+
to: link,
|
|
1283
|
+
element: Children2.count(elementChildren) > 1 ? createElement2(Fragment2, {}, elementChildren) : elementChildren
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
return element;
|
|
1287
|
+
},
|
|
1288
|
+
pageSize,
|
|
1289
|
+
current: currentPage,
|
|
1290
|
+
simple: !breakpoint.sm,
|
|
1291
|
+
total: data == null ? void 0 : data.total,
|
|
1292
|
+
onChange
|
|
1293
|
+
};
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
}, "antdPagination");
|
|
1297
|
+
return {
|
|
1298
|
+
searchFormProps: {
|
|
1299
|
+
form,
|
|
1300
|
+
onFinish
|
|
1301
|
+
},
|
|
1302
|
+
listProps: {
|
|
1303
|
+
dataSource: data == null ? void 0 : data.data,
|
|
1304
|
+
loading: liveMode === "auto" ? isLoading : !isFetched,
|
|
1305
|
+
pagination: antdPagination()
|
|
1306
|
+
},
|
|
1307
|
+
query: tableQuery,
|
|
1308
|
+
filters,
|
|
1309
|
+
setFilters,
|
|
1310
|
+
sorters,
|
|
1311
|
+
setSorters,
|
|
1312
|
+
currentPage,
|
|
1313
|
+
setCurrentPage,
|
|
1314
|
+
pageSize,
|
|
1315
|
+
setPageSize,
|
|
1316
|
+
pageCount,
|
|
1317
|
+
createLinkForSyncWithLocation,
|
|
1318
|
+
overtime,
|
|
1319
|
+
result
|
|
1320
|
+
};
|
|
1321
|
+
}, "useSimpleList");
|
|
1322
|
+
|
|
1323
|
+
// src/hooks/useFileUploadState/index.ts
|
|
1324
|
+
import { useCallback as useCallback3, useMemo, useState } from "react";
|
|
1325
|
+
var useFileUploadState = /* @__PURE__ */ __name(() => {
|
|
1326
|
+
const [isLoading, setIsloading] = useState(false);
|
|
1327
|
+
const onChange = useCallback3((info) => {
|
|
1328
|
+
const fileListLoadings = mapStatusToLoading(info.fileList);
|
|
1329
|
+
if (fileListLoadings.includes(true)) {
|
|
1330
|
+
setIsloading(true);
|
|
1331
|
+
} else {
|
|
1332
|
+
setIsloading(false);
|
|
1333
|
+
}
|
|
1334
|
+
}, []);
|
|
1335
|
+
return useMemo(() => ({ isLoading, onChange }), [isLoading]);
|
|
1336
|
+
}, "useFileUploadState");
|
|
1337
|
+
var mapStatusToLoading = /* @__PURE__ */ __name((files) => {
|
|
1338
|
+
return files.map((file) => {
|
|
1339
|
+
switch (file.status) {
|
|
1340
|
+
case "uploading":
|
|
1341
|
+
return true;
|
|
1342
|
+
default:
|
|
1343
|
+
return false;
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
}, "mapStatusToLoading");
|
|
1347
|
+
|
|
1348
|
+
// src/hooks/useThemedLayoutContext/index.ts
|
|
1349
|
+
import { useContext } from "react";
|
|
1350
|
+
|
|
1351
|
+
// src/contexts/themedLayoutContext/index.tsx
|
|
1352
|
+
import React7, { useState as useState2 } from "react";
|
|
1353
|
+
var ThemedLayoutContext = React7.createContext({
|
|
1354
|
+
siderCollapsed: false,
|
|
1355
|
+
mobileSiderOpen: false,
|
|
1356
|
+
setSiderCollapsed: () => void 0,
|
|
1357
|
+
setMobileSiderOpen: () => void 0
|
|
1358
|
+
});
|
|
1359
|
+
var ThemedLayoutContextProvider = /* @__PURE__ */ __name(({ children, initialSiderCollapsed, onSiderCollapsed }) => {
|
|
1360
|
+
const [siderCollapsed, setSiderCollapsedState] = useState2(
|
|
1361
|
+
initialSiderCollapsed ?? false
|
|
1362
|
+
);
|
|
1363
|
+
const [mobileSiderOpen, setMobileSiderOpen] = useState2(false);
|
|
1364
|
+
const setSiderCollapsed = /* @__PURE__ */ __name((collapsed) => {
|
|
1365
|
+
setSiderCollapsedState(collapsed);
|
|
1366
|
+
if (onSiderCollapsed) {
|
|
1367
|
+
onSiderCollapsed(collapsed);
|
|
1368
|
+
}
|
|
1369
|
+
}, "setSiderCollapsed");
|
|
1370
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1371
|
+
ThemedLayoutContext.Provider,
|
|
1372
|
+
{
|
|
1373
|
+
value: {
|
|
1374
|
+
siderCollapsed,
|
|
1375
|
+
mobileSiderOpen,
|
|
1376
|
+
setSiderCollapsed,
|
|
1377
|
+
setMobileSiderOpen
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
children
|
|
1381
|
+
);
|
|
1382
|
+
}, "ThemedLayoutContextProvider");
|
|
1383
|
+
|
|
1384
|
+
// src/hooks/useThemedLayoutContext/index.ts
|
|
1385
|
+
var useThemedLayoutContext = /* @__PURE__ */ __name(() => {
|
|
1386
|
+
const {
|
|
1387
|
+
mobileSiderOpen,
|
|
1388
|
+
siderCollapsed,
|
|
1389
|
+
setMobileSiderOpen,
|
|
1390
|
+
setSiderCollapsed
|
|
1391
|
+
} = useContext(ThemedLayoutContext);
|
|
1392
|
+
return {
|
|
1393
|
+
mobileSiderOpen,
|
|
1394
|
+
siderCollapsed,
|
|
1395
|
+
setMobileSiderOpen,
|
|
1396
|
+
setSiderCollapsed
|
|
1397
|
+
};
|
|
1398
|
+
}, "useThemedLayoutContext");
|
|
1399
|
+
|
|
1400
|
+
// src/providers/notificationProvider/index.tsx
|
|
1401
|
+
import { App, notification as staticNotification } from "antd";
|
|
1402
|
+
import React9 from "react";
|
|
1403
|
+
|
|
1404
|
+
// src/components/undoableNotification/index.tsx
|
|
1405
|
+
import React8 from "react";
|
|
1406
|
+
import { Button, Progress as Progress2 } from "antd";
|
|
1407
|
+
import { UndoOutlined } from "@ant-design/icons";
|
|
1408
|
+
var UndoableNotification = /* @__PURE__ */ __name(({
|
|
1409
|
+
message,
|
|
1410
|
+
cancelMutation,
|
|
1411
|
+
undoableTimeout
|
|
1412
|
+
}) => /* @__PURE__ */ React8.createElement(
|
|
1413
|
+
"div",
|
|
1414
|
+
{
|
|
1415
|
+
style: {
|
|
1416
|
+
display: "flex",
|
|
1417
|
+
alignItems: "center",
|
|
1418
|
+
justifyContent: "space-between",
|
|
1419
|
+
marginTop: "-7px"
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
/* @__PURE__ */ React8.createElement(
|
|
1423
|
+
Progress2,
|
|
1424
|
+
{
|
|
1425
|
+
type: "circle",
|
|
1426
|
+
percent: (undoableTimeout ?? 0) * 20,
|
|
1427
|
+
format: (time) => time && time / 20,
|
|
1428
|
+
size: 50,
|
|
1429
|
+
strokeColor: "#1890ff",
|
|
1430
|
+
status: "normal"
|
|
1431
|
+
}
|
|
1432
|
+
),
|
|
1433
|
+
/* @__PURE__ */ React8.createElement("span", { style: { marginLeft: 8, width: "100%" } }, message),
|
|
1434
|
+
/* @__PURE__ */ React8.createElement(
|
|
1435
|
+
Button,
|
|
1436
|
+
{
|
|
1437
|
+
style: { flexShrink: 0 },
|
|
1438
|
+
onClick: cancelMutation,
|
|
1439
|
+
disabled: undoableTimeout === 0,
|
|
1440
|
+
icon: /* @__PURE__ */ React8.createElement(UndoOutlined, null)
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1443
|
+
), "UndoableNotification");
|
|
1444
|
+
|
|
1445
|
+
// src/providers/notificationProvider/index.tsx
|
|
1446
|
+
var useNotificationProvider = /* @__PURE__ */ __name(() => {
|
|
1447
|
+
const { notification: notificationFromContext } = App.useApp();
|
|
1448
|
+
const notification2 = "open" in notificationFromContext ? notificationFromContext : staticNotification;
|
|
1449
|
+
const notificationProvider = {
|
|
1450
|
+
open: ({
|
|
1451
|
+
key,
|
|
1452
|
+
message,
|
|
1453
|
+
description,
|
|
1454
|
+
type,
|
|
1455
|
+
cancelMutation,
|
|
1456
|
+
undoableTimeout
|
|
1457
|
+
}) => {
|
|
1458
|
+
if (type === "progress") {
|
|
1459
|
+
notification2.open({
|
|
1460
|
+
key,
|
|
1461
|
+
description: /* @__PURE__ */ React9.createElement(
|
|
1462
|
+
UndoableNotification,
|
|
1463
|
+
{
|
|
1464
|
+
notificationKey: key,
|
|
1465
|
+
message,
|
|
1466
|
+
cancelMutation: () => {
|
|
1467
|
+
cancelMutation == null ? void 0 : cancelMutation();
|
|
1468
|
+
notification2.destroy(key ?? "");
|
|
1469
|
+
},
|
|
1470
|
+
undoableTimeout
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
message: null,
|
|
1474
|
+
duration: 0,
|
|
1475
|
+
closeIcon: /* @__PURE__ */ React9.createElement(React9.Fragment, null)
|
|
1476
|
+
});
|
|
1477
|
+
} else {
|
|
1478
|
+
notification2.open({
|
|
1479
|
+
key,
|
|
1480
|
+
description: message,
|
|
1481
|
+
message: description ?? null,
|
|
1482
|
+
type
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
close: (key) => notification2.destroy(key)
|
|
1487
|
+
};
|
|
1488
|
+
return notificationProvider;
|
|
1489
|
+
}, "useNotificationProvider");
|
|
1490
|
+
|
|
1491
|
+
// src/components/themedLayout/index.tsx
|
|
1492
|
+
import React12 from "react";
|
|
1493
|
+
import { Grid as Grid4, Layout as AntdLayout2 } from "antd";
|
|
1494
|
+
|
|
1495
|
+
// src/components/themedLayout/sider/index.tsx
|
|
1496
|
+
import React10, { useContext as useContext2 } from "react";
|
|
1497
|
+
import {
|
|
1498
|
+
Layout,
|
|
1499
|
+
Menu,
|
|
1500
|
+
Grid as Grid3,
|
|
1501
|
+
Drawer,
|
|
1502
|
+
Button as Button2,
|
|
1503
|
+
theme,
|
|
1504
|
+
ConfigProvider
|
|
1505
|
+
} from "antd";
|
|
1506
|
+
import {
|
|
1507
|
+
LogoutOutlined,
|
|
1508
|
+
UnorderedListOutlined,
|
|
1509
|
+
BarsOutlined,
|
|
1510
|
+
LeftOutlined,
|
|
1511
|
+
RightOutlined
|
|
1512
|
+
} from "@ant-design/icons";
|
|
1513
|
+
import {
|
|
1514
|
+
useTranslate as useTranslate5,
|
|
1515
|
+
useLogout,
|
|
1516
|
+
CanAccess,
|
|
1517
|
+
useIsExistAuthentication,
|
|
1518
|
+
useMenu,
|
|
1519
|
+
useLink as useLink2,
|
|
1520
|
+
useWarnAboutChange as useWarnAboutChange4
|
|
1521
|
+
} from "@refinedev/core";
|
|
1522
|
+
|
|
1523
|
+
// src/components/themedLayout/sider/styles.ts
|
|
1524
|
+
var drawerButtonStyles = {
|
|
1525
|
+
borderStartStartRadius: 0,
|
|
1526
|
+
borderEndStartRadius: 0,
|
|
1527
|
+
position: "fixed",
|
|
1528
|
+
top: 64,
|
|
1529
|
+
zIndex: 999
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
// src/components/themedLayout/sider/index.tsx
|
|
1533
|
+
var ThemedSider = /* @__PURE__ */ __name(({
|
|
1534
|
+
Title: TitleFromProps,
|
|
1535
|
+
render,
|
|
1536
|
+
meta,
|
|
1537
|
+
fixed,
|
|
1538
|
+
activeItemDisabled = false,
|
|
1539
|
+
siderItemsAreCollapsed = true
|
|
1540
|
+
}) => {
|
|
1541
|
+
var _a;
|
|
1542
|
+
const { token } = theme.useToken();
|
|
1543
|
+
const {
|
|
1544
|
+
siderCollapsed,
|
|
1545
|
+
setSiderCollapsed,
|
|
1546
|
+
mobileSiderOpen,
|
|
1547
|
+
setMobileSiderOpen
|
|
1548
|
+
} = useThemedLayoutContext();
|
|
1549
|
+
const isExistAuthentication = useIsExistAuthentication();
|
|
1550
|
+
const direction = (_a = useContext2(ConfigProvider.ConfigContext)) == null ? void 0 : _a.direction;
|
|
1551
|
+
const Link = useLink2();
|
|
1552
|
+
const { warnWhen, setWarnWhen } = useWarnAboutChange4();
|
|
1553
|
+
const translate = useTranslate5();
|
|
1554
|
+
const { menuItems, selectedKey, defaultOpenKeys } = useMenu({ meta });
|
|
1555
|
+
const breakpoint = Grid3.useBreakpoint();
|
|
1556
|
+
const { mutate: mutateLogout } = useLogout();
|
|
1557
|
+
const isMobile = typeof breakpoint.lg === "undefined" ? false : !breakpoint.lg;
|
|
1558
|
+
const RenderToTitle = TitleFromProps ?? ThemedTitle;
|
|
1559
|
+
const renderTreeView = /* @__PURE__ */ __name((tree, selectedKey2) => {
|
|
1560
|
+
return tree.map((item) => {
|
|
1561
|
+
const { key, name, children, meta: meta2, list } = item;
|
|
1562
|
+
const parentName = meta2 == null ? void 0 : meta2.parent;
|
|
1563
|
+
const label = (item == null ? void 0 : item.label) ?? (meta2 == null ? void 0 : meta2.label) ?? name;
|
|
1564
|
+
const icon = meta2 == null ? void 0 : meta2.icon;
|
|
1565
|
+
const route = list;
|
|
1566
|
+
if (children.length > 0) {
|
|
1567
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1568
|
+
CanAccess,
|
|
1569
|
+
{
|
|
1570
|
+
key: item.key,
|
|
1571
|
+
resource: name,
|
|
1572
|
+
action: "list",
|
|
1573
|
+
params: {
|
|
1574
|
+
resource: item
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
/* @__PURE__ */ React10.createElement(
|
|
1578
|
+
Menu.SubMenu,
|
|
1579
|
+
{
|
|
1580
|
+
key: item.key,
|
|
1581
|
+
icon: icon ?? /* @__PURE__ */ React10.createElement(UnorderedListOutlined, null),
|
|
1582
|
+
title: label
|
|
1583
|
+
},
|
|
1584
|
+
renderTreeView(children, selectedKey2)
|
|
1585
|
+
)
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
const isSelected = key === selectedKey2;
|
|
1589
|
+
const isRoute = !(parentName !== void 0 && children.length === 0);
|
|
1590
|
+
const linkStyle = activeItemDisabled && isSelected ? { pointerEvents: "none" } : {};
|
|
1591
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1592
|
+
CanAccess,
|
|
1593
|
+
{
|
|
1594
|
+
key: item.key,
|
|
1595
|
+
resource: name,
|
|
1596
|
+
action: "list",
|
|
1597
|
+
params: {
|
|
1598
|
+
resource: item
|
|
1599
|
+
}
|
|
1600
|
+
},
|
|
1601
|
+
/* @__PURE__ */ React10.createElement(
|
|
1602
|
+
Menu.Item,
|
|
1603
|
+
{
|
|
1604
|
+
key: item.key,
|
|
1605
|
+
icon: icon ?? (isRoute && /* @__PURE__ */ React10.createElement(UnorderedListOutlined, null)),
|
|
1606
|
+
style: linkStyle
|
|
1607
|
+
},
|
|
1608
|
+
/* @__PURE__ */ React10.createElement(Link, { to: route ?? "", style: linkStyle }, label),
|
|
1609
|
+
!siderCollapsed && isSelected && /* @__PURE__ */ React10.createElement("div", { className: "ant-menu-tree-arrow" })
|
|
1610
|
+
)
|
|
1611
|
+
);
|
|
1612
|
+
});
|
|
1613
|
+
}, "renderTreeView");
|
|
1614
|
+
const handleLogout = /* @__PURE__ */ __name(() => {
|
|
1615
|
+
if (warnWhen) {
|
|
1616
|
+
const confirm = window.confirm(
|
|
1617
|
+
translate(
|
|
1618
|
+
"warnWhenUnsavedChanges",
|
|
1619
|
+
"Are you sure you want to leave? You have unsaved changes."
|
|
1620
|
+
)
|
|
1621
|
+
);
|
|
1622
|
+
if (confirm) {
|
|
1623
|
+
setWarnWhen(false);
|
|
1624
|
+
mutateLogout();
|
|
1625
|
+
}
|
|
1626
|
+
} else {
|
|
1627
|
+
mutateLogout();
|
|
1628
|
+
}
|
|
1629
|
+
}, "handleLogout");
|
|
1630
|
+
const logout = isExistAuthentication && /* @__PURE__ */ React10.createElement(
|
|
1631
|
+
Menu.Item,
|
|
1632
|
+
{
|
|
1633
|
+
key: "logout",
|
|
1634
|
+
onClick: () => handleLogout(),
|
|
1635
|
+
icon: /* @__PURE__ */ React10.createElement(LogoutOutlined, null)
|
|
1636
|
+
},
|
|
1637
|
+
translate("buttons.logout", "Logout")
|
|
1638
|
+
);
|
|
1639
|
+
const defaultExpandMenuItems = (() => {
|
|
1640
|
+
if (siderItemsAreCollapsed)
|
|
1641
|
+
return [];
|
|
1642
|
+
return menuItems.map(({ key }) => key);
|
|
1643
|
+
})();
|
|
1644
|
+
const items = renderTreeView(menuItems, selectedKey);
|
|
1645
|
+
const renderSider = /* @__PURE__ */ __name(() => {
|
|
1646
|
+
if (render) {
|
|
1647
|
+
return render({
|
|
1648
|
+
items,
|
|
1649
|
+
logout,
|
|
1650
|
+
collapsed: siderCollapsed
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
return [...items, logout].filter(Boolean);
|
|
1654
|
+
}, "renderSider");
|
|
1655
|
+
const renderMenu = /* @__PURE__ */ __name(() => {
|
|
1656
|
+
return /* @__PURE__ */ React10.createElement(
|
|
1657
|
+
Menu,
|
|
1658
|
+
{
|
|
1659
|
+
selectedKeys: selectedKey ? [selectedKey] : [],
|
|
1660
|
+
defaultOpenKeys: [...defaultOpenKeys, ...defaultExpandMenuItems],
|
|
1661
|
+
mode: "inline",
|
|
1662
|
+
style: {
|
|
1663
|
+
paddingTop: "8px",
|
|
1664
|
+
border: "none",
|
|
1665
|
+
overflow: "auto",
|
|
1666
|
+
height: "calc(100% - 72px)"
|
|
1667
|
+
},
|
|
1668
|
+
onClick: () => {
|
|
1669
|
+
setMobileSiderOpen(false);
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
renderSider()
|
|
1673
|
+
);
|
|
1674
|
+
}, "renderMenu");
|
|
1675
|
+
const renderDrawerSider = /* @__PURE__ */ __name(() => {
|
|
1676
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
|
|
1677
|
+
Drawer,
|
|
1678
|
+
{
|
|
1679
|
+
open: mobileSiderOpen,
|
|
1680
|
+
onClose: () => setMobileSiderOpen(false),
|
|
1681
|
+
placement: direction === "rtl" ? "right" : "left",
|
|
1682
|
+
closable: false,
|
|
1683
|
+
width: 200,
|
|
1684
|
+
styles: {
|
|
1685
|
+
body: {
|
|
1686
|
+
padding: 0
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
maskClosable: true
|
|
1690
|
+
},
|
|
1691
|
+
/* @__PURE__ */ React10.createElement(Layout, null, /* @__PURE__ */ React10.createElement(
|
|
1692
|
+
Layout.Sider,
|
|
1693
|
+
{
|
|
1694
|
+
style: {
|
|
1695
|
+
height: "100vh",
|
|
1696
|
+
backgroundColor: token.colorBgContainer,
|
|
1697
|
+
borderRight: `1px solid ${token.colorBgElevated}`
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
/* @__PURE__ */ React10.createElement(
|
|
1701
|
+
"div",
|
|
1702
|
+
{
|
|
1703
|
+
style: {
|
|
1704
|
+
width: "200px",
|
|
1705
|
+
padding: "0 16px",
|
|
1706
|
+
display: "flex",
|
|
1707
|
+
justifyContent: "flex-start",
|
|
1708
|
+
alignItems: "center",
|
|
1709
|
+
height: "64px",
|
|
1710
|
+
backgroundColor: token.colorBgElevated
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
/* @__PURE__ */ React10.createElement(RenderToTitle, { collapsed: false })
|
|
1714
|
+
),
|
|
1715
|
+
renderMenu()
|
|
1716
|
+
))
|
|
1717
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1718
|
+
Button2,
|
|
1719
|
+
{
|
|
1720
|
+
style: drawerButtonStyles,
|
|
1721
|
+
size: "large",
|
|
1722
|
+
onClick: () => setMobileSiderOpen(true),
|
|
1723
|
+
icon: /* @__PURE__ */ React10.createElement(BarsOutlined, null)
|
|
1724
|
+
}
|
|
1725
|
+
));
|
|
1726
|
+
}, "renderDrawerSider");
|
|
1727
|
+
if (isMobile) {
|
|
1728
|
+
return renderDrawerSider();
|
|
1729
|
+
}
|
|
1730
|
+
const siderStyles = {
|
|
1731
|
+
backgroundColor: token.colorBgContainer,
|
|
1732
|
+
borderRight: `1px solid ${token.colorBgElevated}`
|
|
1733
|
+
};
|
|
1734
|
+
if (fixed) {
|
|
1735
|
+
siderStyles.position = "fixed";
|
|
1736
|
+
siderStyles.top = 0;
|
|
1737
|
+
siderStyles.height = "100vh";
|
|
1738
|
+
siderStyles.zIndex = 999;
|
|
1739
|
+
}
|
|
1740
|
+
const renderClosingIcons = /* @__PURE__ */ __name(() => {
|
|
1741
|
+
const iconProps = { style: { color: token.colorPrimary } };
|
|
1742
|
+
const OpenIcon = direction === "rtl" ? RightOutlined : LeftOutlined;
|
|
1743
|
+
const CollapsedIcon = direction === "rtl" ? LeftOutlined : RightOutlined;
|
|
1744
|
+
const IconComponent = siderCollapsed ? CollapsedIcon : OpenIcon;
|
|
1745
|
+
return /* @__PURE__ */ React10.createElement(IconComponent, { ...iconProps });
|
|
1746
|
+
}, "renderClosingIcons");
|
|
1747
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, fixed && /* @__PURE__ */ React10.createElement(
|
|
1748
|
+
"div",
|
|
1749
|
+
{
|
|
1750
|
+
style: {
|
|
1751
|
+
width: siderCollapsed ? "80px" : "200px",
|
|
1752
|
+
transition: "all 0.2s"
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1756
|
+
Layout.Sider,
|
|
1757
|
+
{
|
|
1758
|
+
style: siderStyles,
|
|
1759
|
+
collapsible: true,
|
|
1760
|
+
collapsed: siderCollapsed,
|
|
1761
|
+
onCollapse: (collapsed, type) => {
|
|
1762
|
+
if (type === "clickTrigger") {
|
|
1763
|
+
setSiderCollapsed(collapsed);
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
collapsedWidth: 80,
|
|
1767
|
+
breakpoint: "lg",
|
|
1768
|
+
trigger: /* @__PURE__ */ React10.createElement(
|
|
1769
|
+
Button2,
|
|
1770
|
+
{
|
|
1771
|
+
type: "text",
|
|
1772
|
+
style: {
|
|
1773
|
+
borderRadius: 0,
|
|
1774
|
+
height: "100%",
|
|
1775
|
+
width: "100%",
|
|
1776
|
+
backgroundColor: token.colorBgElevated
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
renderClosingIcons()
|
|
1780
|
+
)
|
|
1781
|
+
},
|
|
1782
|
+
/* @__PURE__ */ React10.createElement(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
style: {
|
|
1786
|
+
width: siderCollapsed ? "80px" : "200px",
|
|
1787
|
+
padding: siderCollapsed ? "0" : "0 16px",
|
|
1788
|
+
display: "flex",
|
|
1789
|
+
justifyContent: siderCollapsed ? "center" : "flex-start",
|
|
1790
|
+
alignItems: "center",
|
|
1791
|
+
height: "64px",
|
|
1792
|
+
backgroundColor: token.colorBgElevated,
|
|
1793
|
+
fontSize: "14px"
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
/* @__PURE__ */ React10.createElement(RenderToTitle, { collapsed: siderCollapsed })
|
|
1797
|
+
),
|
|
1798
|
+
renderMenu()
|
|
1799
|
+
));
|
|
1800
|
+
}, "ThemedSider");
|
|
1801
|
+
|
|
1802
|
+
// src/components/themedLayout/header/index.tsx
|
|
1803
|
+
import React11 from "react";
|
|
1804
|
+
import { Layout as AntdLayout, Typography, Avatar, Space, theme as theme2 } from "antd";
|
|
1805
|
+
import { useGetIdentity } from "@refinedev/core";
|
|
1806
|
+
var ThemedHeader = /* @__PURE__ */ __name(({
|
|
1807
|
+
sticky
|
|
1808
|
+
}) => {
|
|
1809
|
+
const { token } = theme2.useToken();
|
|
1810
|
+
const { data: user } = useGetIdentity();
|
|
1811
|
+
const shouldRenderHeader = user && (user.name || user.avatar);
|
|
1812
|
+
if (!shouldRenderHeader) {
|
|
1813
|
+
return null;
|
|
1814
|
+
}
|
|
1815
|
+
const headerStyles = {
|
|
1816
|
+
backgroundColor: token.colorBgElevated,
|
|
1817
|
+
display: "flex",
|
|
1818
|
+
justifyContent: "flex-end",
|
|
1819
|
+
alignItems: "center",
|
|
1820
|
+
padding: "0px 24px",
|
|
1821
|
+
height: "64px"
|
|
1822
|
+
};
|
|
1823
|
+
if (sticky) {
|
|
1824
|
+
headerStyles.position = "sticky";
|
|
1825
|
+
headerStyles.top = 0;
|
|
1826
|
+
headerStyles.zIndex = 1;
|
|
1827
|
+
}
|
|
1828
|
+
return /* @__PURE__ */ React11.createElement(AntdLayout.Header, { style: headerStyles }, /* @__PURE__ */ React11.createElement(Space, null, /* @__PURE__ */ React11.createElement(Space, { size: "middle" }, (user == null ? void 0 : user.name) && /* @__PURE__ */ React11.createElement(Typography.Text, { strong: true }, user.name), (user == null ? void 0 : user.avatar) && /* @__PURE__ */ React11.createElement(Avatar, { src: user == null ? void 0 : user.avatar, alt: user == null ? void 0 : user.name }))));
|
|
1829
|
+
}, "ThemedHeader");
|
|
1830
|
+
|
|
1831
|
+
// src/components/themedLayout/index.tsx
|
|
1832
|
+
var ThemedLayout = /* @__PURE__ */ __name(({
|
|
1833
|
+
children,
|
|
1834
|
+
Header,
|
|
1835
|
+
Sider,
|
|
1836
|
+
Title,
|
|
1837
|
+
Footer,
|
|
1838
|
+
OffLayoutArea,
|
|
1839
|
+
initialSiderCollapsed,
|
|
1840
|
+
onSiderCollapsed
|
|
1841
|
+
}) => {
|
|
1842
|
+
const breakpoint = Grid4.useBreakpoint();
|
|
1843
|
+
const SiderToRender = Sider ?? ThemedSider;
|
|
1844
|
+
const HeaderToRender = Header ?? ThemedHeader;
|
|
1845
|
+
const isSmall = typeof breakpoint.sm === "undefined" ? true : breakpoint.sm;
|
|
1846
|
+
const hasSider = !!SiderToRender({ Title });
|
|
1847
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1848
|
+
ThemedLayoutContextProvider,
|
|
1849
|
+
{
|
|
1850
|
+
initialSiderCollapsed,
|
|
1851
|
+
onSiderCollapsed
|
|
1852
|
+
},
|
|
1853
|
+
/* @__PURE__ */ React12.createElement(AntdLayout2, { style: { minHeight: "100vh" }, hasSider }, /* @__PURE__ */ React12.createElement(SiderToRender, { Title }), /* @__PURE__ */ React12.createElement(AntdLayout2, null, /* @__PURE__ */ React12.createElement(HeaderToRender, null), /* @__PURE__ */ React12.createElement(AntdLayout2.Content, null, /* @__PURE__ */ React12.createElement(
|
|
1854
|
+
"div",
|
|
1855
|
+
{
|
|
1856
|
+
style: {
|
|
1857
|
+
minHeight: 360,
|
|
1858
|
+
padding: isSmall ? 24 : 12
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
children
|
|
1862
|
+
), OffLayoutArea && /* @__PURE__ */ React12.createElement(OffLayoutArea, null)), Footer && /* @__PURE__ */ React12.createElement(Footer, null)))
|
|
1863
|
+
);
|
|
1864
|
+
}, "ThemedLayout");
|
|
1865
|
+
|
|
1866
|
+
// src/components/themedLayout/title/index.tsx
|
|
1867
|
+
import React13 from "react";
|
|
1868
|
+
import { useLink as useLink3, useRefineOptions } from "@refinedev/core";
|
|
1869
|
+
import { Typography as Typography2, theme as theme3, Space as Space2 } from "antd";
|
|
1870
|
+
var ThemedTitle = /* @__PURE__ */ __name(({
|
|
1871
|
+
collapsed,
|
|
1872
|
+
icon: iconFromProps,
|
|
1873
|
+
text: textFromProps,
|
|
1874
|
+
wrapperStyles
|
|
1875
|
+
}) => {
|
|
1876
|
+
const {
|
|
1877
|
+
title: { icon: defaultIcon, text: defaultText } = {}
|
|
1878
|
+
} = useRefineOptions();
|
|
1879
|
+
const icon = typeof iconFromProps === "undefined" ? defaultIcon : iconFromProps;
|
|
1880
|
+
const text = typeof textFromProps === "undefined" ? defaultText : textFromProps;
|
|
1881
|
+
const { token } = theme3.useToken();
|
|
1882
|
+
const Link = useLink3();
|
|
1883
|
+
return /* @__PURE__ */ React13.createElement(
|
|
1884
|
+
Link,
|
|
1885
|
+
{
|
|
1886
|
+
to: "/",
|
|
1887
|
+
style: {
|
|
1888
|
+
display: "inline-block",
|
|
1889
|
+
textDecoration: "none"
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
/* @__PURE__ */ React13.createElement(
|
|
1893
|
+
Space2,
|
|
1894
|
+
{
|
|
1895
|
+
style: {
|
|
1896
|
+
display: "flex",
|
|
1897
|
+
alignItems: "center",
|
|
1898
|
+
fontSize: "inherit",
|
|
1899
|
+
...wrapperStyles
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
/* @__PURE__ */ React13.createElement(
|
|
1903
|
+
"div",
|
|
1904
|
+
{
|
|
1905
|
+
style: {
|
|
1906
|
+
height: "24px",
|
|
1907
|
+
width: "24px",
|
|
1908
|
+
color: token.colorPrimary
|
|
1909
|
+
}
|
|
1910
|
+
},
|
|
1911
|
+
icon
|
|
1912
|
+
),
|
|
1913
|
+
!collapsed && /* @__PURE__ */ React13.createElement(
|
|
1914
|
+
Typography2.Title,
|
|
1915
|
+
{
|
|
1916
|
+
style: {
|
|
1917
|
+
fontSize: "inherit",
|
|
1918
|
+
marginBottom: 0,
|
|
1919
|
+
fontWeight: 700
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
text
|
|
1923
|
+
)
|
|
1924
|
+
)
|
|
1925
|
+
);
|
|
1926
|
+
}, "ThemedTitle");
|
|
1927
|
+
|
|
1928
|
+
// src/components/buttons/create/index.tsx
|
|
1929
|
+
import React14 from "react";
|
|
1930
|
+
import { Button as Button3 } from "antd";
|
|
1931
|
+
import { PlusSquareOutlined } from "@ant-design/icons";
|
|
1932
|
+
import { useCreateButton } from "@refinedev/core";
|
|
1933
|
+
import {
|
|
1934
|
+
RefineButtonClassNames,
|
|
1935
|
+
RefineButtonTestIds
|
|
1936
|
+
} from "@refinedev/ui-types";
|
|
1937
|
+
var CreateButton = /* @__PURE__ */ __name(({
|
|
1938
|
+
resource: resourceNameFromProps,
|
|
1939
|
+
hideText = false,
|
|
1940
|
+
accessControl,
|
|
1941
|
+
meta,
|
|
1942
|
+
children,
|
|
1943
|
+
onClick,
|
|
1944
|
+
...rest
|
|
1945
|
+
}) => {
|
|
1946
|
+
const { hidden, disabled, label, title, LinkComponent, to } = useCreateButton(
|
|
1947
|
+
{
|
|
1948
|
+
resource: resourceNameFromProps,
|
|
1949
|
+
meta,
|
|
1950
|
+
accessControl
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
const isDisabled = disabled || rest.disabled;
|
|
1954
|
+
const isHidden = hidden || rest.hidden;
|
|
1955
|
+
if (isHidden)
|
|
1956
|
+
return null;
|
|
1957
|
+
return /* @__PURE__ */ React14.createElement(
|
|
1958
|
+
LinkComponent,
|
|
1959
|
+
{
|
|
1960
|
+
to,
|
|
1961
|
+
replace: false,
|
|
1962
|
+
onClick: (e) => {
|
|
1963
|
+
if (isDisabled) {
|
|
1964
|
+
e.preventDefault();
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
if (onClick) {
|
|
1968
|
+
e.preventDefault();
|
|
1969
|
+
onClick(e);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
},
|
|
1973
|
+
/* @__PURE__ */ React14.createElement(
|
|
1974
|
+
Button3,
|
|
1975
|
+
{
|
|
1976
|
+
icon: /* @__PURE__ */ React14.createElement(PlusSquareOutlined, null),
|
|
1977
|
+
disabled: isDisabled,
|
|
1978
|
+
title,
|
|
1979
|
+
|
|
1980
|
+
className: RefineButtonClassNames.CreateButton,
|
|
1981
|
+
type: "primary",
|
|
1982
|
+
...rest
|
|
1983
|
+
},
|
|
1984
|
+
!hideText && (children ?? label)
|
|
1985
|
+
)
|
|
1986
|
+
);
|
|
1987
|
+
}, "CreateButton");
|
|
1988
|
+
|
|
1989
|
+
// src/components/buttons/edit/index.tsx
|
|
1990
|
+
import React15 from "react";
|
|
1991
|
+
import { Button as Button4 } from "antd";
|
|
1992
|
+
import { EditOutlined } from "@ant-design/icons";
|
|
1993
|
+
import { useEditButton } from "@refinedev/core";
|
|
1994
|
+
import {
|
|
1995
|
+
RefineButtonClassNames as RefineButtonClassNames2,
|
|
1996
|
+
RefineButtonTestIds as RefineButtonTestIds2
|
|
1997
|
+
} from "@refinedev/ui-types";
|
|
1998
|
+
var EditButton = /* @__PURE__ */ __name(({
|
|
1999
|
+
resource: resourceNameFromProps,
|
|
2000
|
+
recordItemId,
|
|
2001
|
+
hideText = false,
|
|
2002
|
+
accessControl,
|
|
2003
|
+
meta,
|
|
2004
|
+
children,
|
|
2005
|
+
onClick,
|
|
2006
|
+
...rest
|
|
2007
|
+
}) => {
|
|
2008
|
+
const { to, label, title, hidden, disabled, LinkComponent } = useEditButton({
|
|
2009
|
+
resource: resourceNameFromProps,
|
|
2010
|
+
id: recordItemId,
|
|
2011
|
+
meta,
|
|
2012
|
+
accessControl
|
|
2013
|
+
});
|
|
2014
|
+
const isDisabled = disabled || rest.disabled;
|
|
2015
|
+
const isHidden = hidden || rest.hidden;
|
|
2016
|
+
if (isHidden)
|
|
2017
|
+
return null;
|
|
2018
|
+
return /* @__PURE__ */ React15.createElement(
|
|
2019
|
+
LinkComponent,
|
|
2020
|
+
{
|
|
2021
|
+
to,
|
|
2022
|
+
replace: false,
|
|
2023
|
+
onClick: (e) => {
|
|
2024
|
+
if (isDisabled) {
|
|
2025
|
+
e.preventDefault();
|
|
2026
|
+
return;
|
|
2027
|
+
}
|
|
2028
|
+
if (onClick) {
|
|
2029
|
+
e.preventDefault();
|
|
2030
|
+
onClick(e);
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
},
|
|
2034
|
+
/* @__PURE__ */ React15.createElement(
|
|
2035
|
+
Button4,
|
|
2036
|
+
{
|
|
2037
|
+
icon: /* @__PURE__ */ React15.createElement(EditOutlined, null),
|
|
2038
|
+
disabled: isDisabled,
|
|
2039
|
+
title,
|
|
2040
|
+
|
|
2041
|
+
className: RefineButtonClassNames2.EditButton,
|
|
2042
|
+
...rest
|
|
2043
|
+
},
|
|
2044
|
+
!hideText && (children ?? label)
|
|
2045
|
+
)
|
|
2046
|
+
);
|
|
2047
|
+
}, "EditButton");
|
|
2048
|
+
|
|
2049
|
+
// src/components/buttons/delete/index.tsx
|
|
2050
|
+
import React16 from "react";
|
|
2051
|
+
import { Button as Button5, Popconfirm } from "antd";
|
|
2052
|
+
import { DeleteOutlined } from "@ant-design/icons";
|
|
2053
|
+
import { useDeleteButton } from "@refinedev/core";
|
|
2054
|
+
import {
|
|
2055
|
+
RefineButtonClassNames as RefineButtonClassNames3,
|
|
2056
|
+
RefineButtonTestIds as RefineButtonTestIds3
|
|
2057
|
+
} from "@refinedev/ui-types";
|
|
2058
|
+
var DeleteButton = /* @__PURE__ */ __name(({
|
|
2059
|
+
resource: resourceNameFromProps,
|
|
2060
|
+
recordItemId,
|
|
2061
|
+
onSuccess,
|
|
2062
|
+
mutationMode: mutationModeProp,
|
|
2063
|
+
children,
|
|
2064
|
+
successNotification,
|
|
2065
|
+
errorNotification,
|
|
2066
|
+
hideText = false,
|
|
2067
|
+
accessControl,
|
|
2068
|
+
meta,
|
|
2069
|
+
dataProviderName,
|
|
2070
|
+
confirmTitle,
|
|
2071
|
+
confirmOkText,
|
|
2072
|
+
confirmCancelText,
|
|
2073
|
+
invalidates,
|
|
2074
|
+
...rest
|
|
2075
|
+
}) => {
|
|
2076
|
+
const {
|
|
2077
|
+
title,
|
|
2078
|
+
label,
|
|
2079
|
+
hidden,
|
|
2080
|
+
disabled,
|
|
2081
|
+
loading,
|
|
2082
|
+
confirmTitle: defaultConfirmTitle,
|
|
2083
|
+
confirmOkLabel: defaultConfirmOkLabel,
|
|
2084
|
+
cancelLabel: defaultCancelLabel,
|
|
2085
|
+
onConfirm
|
|
2086
|
+
} = useDeleteButton({
|
|
2087
|
+
resource: resourceNameFromProps,
|
|
2088
|
+
id: recordItemId,
|
|
2089
|
+
dataProviderName,
|
|
2090
|
+
invalidates,
|
|
2091
|
+
meta,
|
|
2092
|
+
onSuccess,
|
|
2093
|
+
mutationMode: mutationModeProp,
|
|
2094
|
+
errorNotification,
|
|
2095
|
+
successNotification,
|
|
2096
|
+
accessControl
|
|
2097
|
+
});
|
|
2098
|
+
const isDisabled = disabled || rest.disabled;
|
|
2099
|
+
const isHidden = hidden || rest.hidden;
|
|
2100
|
+
if (isHidden)
|
|
2101
|
+
return null;
|
|
2102
|
+
return /* @__PURE__ */ React16.createElement(
|
|
2103
|
+
Popconfirm,
|
|
2104
|
+
{
|
|
2105
|
+
key: "delete",
|
|
2106
|
+
okText: confirmOkText ?? defaultConfirmOkLabel,
|
|
2107
|
+
cancelText: confirmCancelText ?? defaultCancelLabel,
|
|
2108
|
+
okType: "danger",
|
|
2109
|
+
title: confirmTitle ?? defaultConfirmTitle,
|
|
2110
|
+
okButtonProps: { disabled: loading },
|
|
2111
|
+
onConfirm,
|
|
2112
|
+
disabled: isDisabled
|
|
2113
|
+
},
|
|
2114
|
+
/* @__PURE__ */ React16.createElement(
|
|
2115
|
+
Button5,
|
|
2116
|
+
{
|
|
2117
|
+
danger: true,
|
|
2118
|
+
loading,
|
|
2119
|
+
icon: /* @__PURE__ */ React16.createElement(DeleteOutlined, null),
|
|
2120
|
+
title,
|
|
2121
|
+
disabled: isDisabled,
|
|
2122
|
+
|
|
2123
|
+
className: RefineButtonClassNames3.DeleteButton,
|
|
2124
|
+
...rest
|
|
2125
|
+
},
|
|
2126
|
+
!hideText && (children ?? label)
|
|
2127
|
+
)
|
|
2128
|
+
);
|
|
2129
|
+
}, "DeleteButton");
|
|
2130
|
+
|
|
2131
|
+
// src/components/buttons/refresh/index.tsx
|
|
2132
|
+
import React17 from "react";
|
|
2133
|
+
import { Button as Button6 } from "antd";
|
|
2134
|
+
import { RedoOutlined } from "@ant-design/icons";
|
|
2135
|
+
import { useRefreshButton } from "@refinedev/core";
|
|
2136
|
+
import {
|
|
2137
|
+
RefineButtonClassNames as RefineButtonClassNames4,
|
|
2138
|
+
RefineButtonTestIds as RefineButtonTestIds4
|
|
2139
|
+
} from "@refinedev/ui-types";
|
|
2140
|
+
var RefreshButton = /* @__PURE__ */ __name(({
|
|
2141
|
+
resource: resourceNameFromProps,
|
|
2142
|
+
recordItemId,
|
|
2143
|
+
hideText = false,
|
|
2144
|
+
dataProviderName,
|
|
2145
|
+
children,
|
|
2146
|
+
...rest
|
|
2147
|
+
}) => {
|
|
2148
|
+
const { onClick, label, loading } = useRefreshButton({
|
|
2149
|
+
resource: resourceNameFromProps,
|
|
2150
|
+
id: recordItemId,
|
|
2151
|
+
dataProviderName
|
|
2152
|
+
});
|
|
2153
|
+
return /* @__PURE__ */ React17.createElement(
|
|
2154
|
+
Button6,
|
|
2155
|
+
{
|
|
2156
|
+
onClick,
|
|
2157
|
+
icon: /* @__PURE__ */ React17.createElement(RedoOutlined, { spin: loading }),
|
|
2158
|
+
|
|
2159
|
+
className: RefineButtonClassNames4.RefreshButton,
|
|
2160
|
+
...rest
|
|
2161
|
+
},
|
|
2162
|
+
!hideText && (children ?? label)
|
|
2163
|
+
);
|
|
2164
|
+
}, "RefreshButton");
|
|
2165
|
+
|
|
2166
|
+
// src/components/buttons/show/index.tsx
|
|
2167
|
+
import React18 from "react";
|
|
2168
|
+
import { Button as Button7 } from "antd";
|
|
2169
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
2170
|
+
import { useShowButton } from "@refinedev/core";
|
|
2171
|
+
import {
|
|
2172
|
+
RefineButtonClassNames as RefineButtonClassNames5,
|
|
2173
|
+
RefineButtonTestIds as RefineButtonTestIds5
|
|
2174
|
+
} from "@refinedev/ui-types";
|
|
2175
|
+
var ShowButton = /* @__PURE__ */ __name(({
|
|
2176
|
+
resource: resourceNameFromProps,
|
|
2177
|
+
recordItemId,
|
|
2178
|
+
hideText = false,
|
|
2179
|
+
accessControl,
|
|
2180
|
+
meta,
|
|
2181
|
+
children,
|
|
2182
|
+
onClick,
|
|
2183
|
+
...rest
|
|
2184
|
+
}) => {
|
|
2185
|
+
const { to, label, title, hidden, disabled, LinkComponent } = useShowButton({
|
|
2186
|
+
resource: resourceNameFromProps,
|
|
2187
|
+
id: recordItemId,
|
|
2188
|
+
accessControl,
|
|
2189
|
+
meta
|
|
2190
|
+
});
|
|
2191
|
+
const isDisabled = disabled || rest.disabled;
|
|
2192
|
+
const isHidden = hidden || rest.hidden;
|
|
2193
|
+
if (isHidden)
|
|
2194
|
+
return null;
|
|
2195
|
+
return /* @__PURE__ */ React18.createElement(
|
|
2196
|
+
LinkComponent,
|
|
2197
|
+
{
|
|
2198
|
+
to,
|
|
2199
|
+
replace: false,
|
|
2200
|
+
onClick: (e) => {
|
|
2201
|
+
if (isDisabled) {
|
|
2202
|
+
e.preventDefault();
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
if (onClick) {
|
|
2206
|
+
e.preventDefault();
|
|
2207
|
+
onClick(e);
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
},
|
|
2211
|
+
/* @__PURE__ */ React18.createElement(
|
|
2212
|
+
Button7,
|
|
2213
|
+
{
|
|
2214
|
+
disabled: isDisabled,
|
|
2215
|
+
icon: /* @__PURE__ */ React18.createElement(EyeOutlined, null),
|
|
2216
|
+
title,
|
|
2217
|
+
|
|
2218
|
+
className: RefineButtonClassNames5.ShowButton,
|
|
2219
|
+
...rest
|
|
2220
|
+
},
|
|
2221
|
+
!hideText && (children ?? label)
|
|
2222
|
+
)
|
|
2223
|
+
);
|
|
2224
|
+
}, "ShowButton");
|
|
2225
|
+
|
|
2226
|
+
// src/components/buttons/list/index.tsx
|
|
2227
|
+
import React19 from "react";
|
|
2228
|
+
import { Button as Button8 } from "antd";
|
|
2229
|
+
import { BarsOutlined as BarsOutlined2 } from "@ant-design/icons";
|
|
2230
|
+
import { useListButton } from "@refinedev/core";
|
|
2231
|
+
import {
|
|
2232
|
+
RefineButtonClassNames as RefineButtonClassNames6,
|
|
2233
|
+
RefineButtonTestIds as RefineButtonTestIds6
|
|
2234
|
+
} from "@refinedev/ui-types";
|
|
2235
|
+
var ListButton = /* @__PURE__ */ __name(({
|
|
2236
|
+
resource: resourceNameFromProps,
|
|
2237
|
+
hideText = false,
|
|
2238
|
+
accessControl,
|
|
2239
|
+
meta,
|
|
2240
|
+
children,
|
|
2241
|
+
onClick,
|
|
2242
|
+
...rest
|
|
2243
|
+
}) => {
|
|
2244
|
+
const { to, label, title, hidden, disabled, LinkComponent } = useListButton({
|
|
2245
|
+
resource: resourceNameFromProps,
|
|
2246
|
+
meta,
|
|
2247
|
+
accessControl
|
|
2248
|
+
});
|
|
2249
|
+
const isDisabled = disabled || rest.disabled;
|
|
2250
|
+
const isHidden = hidden || rest.hidden;
|
|
2251
|
+
if (isHidden)
|
|
2252
|
+
return null;
|
|
2253
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2254
|
+
LinkComponent,
|
|
2255
|
+
{
|
|
2256
|
+
to,
|
|
2257
|
+
replace: false,
|
|
2258
|
+
onClick: (e) => {
|
|
2259
|
+
if (isDisabled) {
|
|
2260
|
+
e.preventDefault();
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
if (onClick) {
|
|
2264
|
+
e.preventDefault();
|
|
2265
|
+
onClick(e);
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
},
|
|
2269
|
+
/* @__PURE__ */ React19.createElement(
|
|
2270
|
+
Button8,
|
|
2271
|
+
{
|
|
2272
|
+
icon: /* @__PURE__ */ React19.createElement(BarsOutlined2, null),
|
|
2273
|
+
disabled: isDisabled,
|
|
2274
|
+
title,
|
|
2275
|
+
|
|
2276
|
+
className: RefineButtonClassNames6.ListButton,
|
|
2277
|
+
...rest
|
|
2278
|
+
},
|
|
2279
|
+
!hideText && (children ?? label)
|
|
2280
|
+
)
|
|
2281
|
+
);
|
|
2282
|
+
}, "ListButton");
|
|
2283
|
+
|
|
2284
|
+
// src/components/buttons/export/index.tsx
|
|
2285
|
+
import React20 from "react";
|
|
2286
|
+
import { Button as Button9 } from "antd";
|
|
2287
|
+
import { ExportOutlined } from "@ant-design/icons";
|
|
2288
|
+
import { useExportButton } from "@refinedev/core";
|
|
2289
|
+
import {
|
|
2290
|
+
RefineButtonClassNames as RefineButtonClassNames7,
|
|
2291
|
+
RefineButtonTestIds as RefineButtonTestIds7
|
|
2292
|
+
} from "@refinedev/ui-types";
|
|
2293
|
+
var ExportButton = /* @__PURE__ */ __name(({
|
|
2294
|
+
hideText = false,
|
|
2295
|
+
children,
|
|
2296
|
+
...rest
|
|
2297
|
+
}) => {
|
|
2298
|
+
const { label } = useExportButton();
|
|
2299
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2300
|
+
Button9,
|
|
2301
|
+
{
|
|
2302
|
+
type: "default",
|
|
2303
|
+
icon: /* @__PURE__ */ React20.createElement(ExportOutlined, null),
|
|
2304
|
+
|
|
2305
|
+
className: RefineButtonClassNames7.ExportButton,
|
|
2306
|
+
...rest
|
|
2307
|
+
},
|
|
2308
|
+
!hideText && (children ?? label)
|
|
2309
|
+
);
|
|
2310
|
+
}, "ExportButton");
|
|
2311
|
+
|
|
2312
|
+
// src/components/buttons/save/index.tsx
|
|
2313
|
+
import React21 from "react";
|
|
2314
|
+
import { Button as Button10 } from "antd";
|
|
2315
|
+
import { SaveOutlined } from "@ant-design/icons";
|
|
2316
|
+
import { useSaveButton } from "@refinedev/core";
|
|
2317
|
+
import {
|
|
2318
|
+
RefineButtonClassNames as RefineButtonClassNames8,
|
|
2319
|
+
RefineButtonTestIds as RefineButtonTestIds8
|
|
2320
|
+
} from "@refinedev/ui-types";
|
|
2321
|
+
var SaveButton = /* @__PURE__ */ __name(({
|
|
2322
|
+
hideText = false,
|
|
2323
|
+
children,
|
|
2324
|
+
...rest
|
|
2325
|
+
}) => {
|
|
2326
|
+
const { label } = useSaveButton();
|
|
2327
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2328
|
+
Button10,
|
|
2329
|
+
{
|
|
2330
|
+
type: "primary",
|
|
2331
|
+
icon: /* @__PURE__ */ React21.createElement(SaveOutlined, null),
|
|
2332
|
+
|
|
2333
|
+
className: RefineButtonClassNames8.SaveButton,
|
|
2334
|
+
...rest
|
|
2335
|
+
},
|
|
2336
|
+
!hideText && (children ?? label)
|
|
2337
|
+
);
|
|
2338
|
+
}, "SaveButton");
|
|
2339
|
+
|
|
2340
|
+
// src/components/buttons/clone/index.tsx
|
|
2341
|
+
import React22 from "react";
|
|
2342
|
+
import { Button as Button11 } from "antd";
|
|
2343
|
+
import { PlusSquareOutlined as PlusSquareOutlined2 } from "@ant-design/icons";
|
|
2344
|
+
import { useCloneButton } from "@refinedev/core";
|
|
2345
|
+
import {
|
|
2346
|
+
RefineButtonTestIds as RefineButtonTestIds9,
|
|
2347
|
+
RefineButtonClassNames as RefineButtonClassNames9
|
|
2348
|
+
} from "@refinedev/ui-types";
|
|
2349
|
+
var CloneButton = /* @__PURE__ */ __name(({
|
|
2350
|
+
resource: resourceNameFromProps,
|
|
2351
|
+
recordItemId,
|
|
2352
|
+
hideText = false,
|
|
2353
|
+
accessControl,
|
|
2354
|
+
meta,
|
|
2355
|
+
children,
|
|
2356
|
+
onClick,
|
|
2357
|
+
...rest
|
|
2358
|
+
}) => {
|
|
2359
|
+
const { to, LinkComponent, label, disabled, hidden, title } = useCloneButton({
|
|
2360
|
+
id: recordItemId,
|
|
2361
|
+
resource: resourceNameFromProps,
|
|
2362
|
+
accessControl,
|
|
2363
|
+
meta
|
|
2364
|
+
});
|
|
2365
|
+
const isDisabled = disabled || rest.disabled;
|
|
2366
|
+
const isHidden = hidden || rest.hidden;
|
|
2367
|
+
if (isHidden)
|
|
2368
|
+
return null;
|
|
2369
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2370
|
+
LinkComponent,
|
|
2371
|
+
{
|
|
2372
|
+
to,
|
|
2373
|
+
replace: false,
|
|
2374
|
+
onClick: (e) => {
|
|
2375
|
+
if (isDisabled) {
|
|
2376
|
+
e.preventDefault();
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
if (onClick) {
|
|
2380
|
+
e.preventDefault();
|
|
2381
|
+
onClick(e);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
},
|
|
2385
|
+
/* @__PURE__ */ React22.createElement(
|
|
2386
|
+
Button11,
|
|
2387
|
+
{
|
|
2388
|
+
icon: /* @__PURE__ */ React22.createElement(PlusSquareOutlined2, null),
|
|
2389
|
+
disabled: isDisabled,
|
|
2390
|
+
title,
|
|
2391
|
+
|
|
2392
|
+
className: RefineButtonClassNames9.CloneButton,
|
|
2393
|
+
...rest
|
|
2394
|
+
},
|
|
2395
|
+
!hideText && (children ?? label)
|
|
2396
|
+
)
|
|
2397
|
+
);
|
|
2398
|
+
}, "CloneButton");
|
|
2399
|
+
|
|
2400
|
+
// src/components/buttons/import/index.tsx
|
|
2401
|
+
import React23 from "react";
|
|
2402
|
+
import { Button as Button12, Upload } from "antd";
|
|
2403
|
+
import { ImportOutlined } from "@ant-design/icons";
|
|
2404
|
+
import { useImportButton } from "@refinedev/core";
|
|
2405
|
+
import {
|
|
2406
|
+
RefineButtonClassNames as RefineButtonClassNames10,
|
|
2407
|
+
RefineButtonTestIds as RefineButtonTestIds10
|
|
2408
|
+
} from "@refinedev/ui-types";
|
|
2409
|
+
var ImportButton = /* @__PURE__ */ __name(({
|
|
2410
|
+
uploadProps,
|
|
2411
|
+
buttonProps,
|
|
2412
|
+
hideText = false,
|
|
2413
|
+
children,
|
|
2414
|
+
loading,
|
|
2415
|
+
...rest
|
|
2416
|
+
}) => {
|
|
2417
|
+
const { label } = useImportButton();
|
|
2418
|
+
return /* @__PURE__ */ React23.createElement(Upload, { ...uploadProps }, /* @__PURE__ */ React23.createElement(
|
|
2419
|
+
Button12,
|
|
2420
|
+
{
|
|
2421
|
+
icon: /* @__PURE__ */ React23.createElement(ImportOutlined, null),
|
|
2422
|
+
|
|
2423
|
+
className: RefineButtonClassNames10.ImportButton,
|
|
2424
|
+
loading,
|
|
2425
|
+
...buttonProps,
|
|
2426
|
+
...rest
|
|
2427
|
+
},
|
|
2428
|
+
!hideText && (children ?? label)
|
|
2429
|
+
));
|
|
2430
|
+
}, "ImportButton");
|
|
2431
|
+
|
|
2432
|
+
// src/components/crud/list/index.tsx
|
|
2433
|
+
import React24 from "react";
|
|
2434
|
+
import { Space as Space3 } from "antd";
|
|
2435
|
+
import {
|
|
2436
|
+
useTranslate as useTranslate6,
|
|
2437
|
+
useUserFriendlyName as useUserFriendlyName2,
|
|
2438
|
+
useRefineContext as useRefineContext2,
|
|
2439
|
+
useResourceParams as useResourceParams4
|
|
2440
|
+
} from "@refinedev/core";
|
|
2441
|
+
var List = /* @__PURE__ */ __name(({
|
|
2442
|
+
canCreate,
|
|
2443
|
+
title,
|
|
2444
|
+
children,
|
|
2445
|
+
createButtonProps: createButtonPropsFromProps,
|
|
2446
|
+
resource: resourceFromProps,
|
|
2447
|
+
wrapperProps,
|
|
2448
|
+
contentProps,
|
|
2449
|
+
headerProps,
|
|
2450
|
+
breadcrumb: breadcrumbFromProps,
|
|
2451
|
+
headerButtonProps,
|
|
2452
|
+
headerButtons
|
|
2453
|
+
}) => {
|
|
2454
|
+
var _a;
|
|
2455
|
+
const translate = useTranslate6();
|
|
2456
|
+
const {
|
|
2457
|
+
options: { breadcrumb: globalBreadcrumb } = {}
|
|
2458
|
+
} = useRefineContext2();
|
|
2459
|
+
const getUserFriendlyName = useUserFriendlyName2();
|
|
2460
|
+
const { resource, identifier } = useResourceParams4({
|
|
2461
|
+
resource: resourceFromProps
|
|
2462
|
+
});
|
|
2463
|
+
const isCreateButtonVisible = canCreate ?? (!!(resource == null ? void 0 : resource.create) || !!createButtonPropsFromProps);
|
|
2464
|
+
const breadcrumb = typeof breadcrumbFromProps === "undefined" ? globalBreadcrumb : breadcrumbFromProps;
|
|
2465
|
+
const createButtonProps = isCreateButtonVisible ? {
|
|
2466
|
+
size: "middle",
|
|
2467
|
+
resource: identifier,
|
|
2468
|
+
...createButtonPropsFromProps
|
|
2469
|
+
} : void 0;
|
|
2470
|
+
const defaultExtra = isCreateButtonVisible ? /* @__PURE__ */ React24.createElement(CreateButton, { ...createButtonProps }) : null;
|
|
2471
|
+
return /* @__PURE__ */ React24.createElement("div", { ...wrapperProps ?? {} }, /* @__PURE__ */ React24.createElement(
|
|
2472
|
+
PageHeader,
|
|
2473
|
+
{
|
|
2474
|
+
title: title ?? translate(
|
|
2475
|
+
`${identifier}.titles.list`,
|
|
2476
|
+
getUserFriendlyName(((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.label) ?? identifier, "plural")
|
|
2477
|
+
),
|
|
2478
|
+
extra: headerButtons ? /* @__PURE__ */ React24.createElement(Space3, { wrap: true, ...headerButtonProps }, typeof headerButtons === "function" ? headerButtons({
|
|
2479
|
+
defaultButtons: defaultExtra,
|
|
2480
|
+
createButtonProps
|
|
2481
|
+
}) : headerButtons) : defaultExtra,
|
|
2482
|
+
breadcrumb: typeof breadcrumb !== "undefined" ? /* @__PURE__ */ React24.createElement(React24.Fragment, null, breadcrumb) : /* @__PURE__ */ React24.createElement(Breadcrumb, null),
|
|
2483
|
+
...headerProps ?? {}
|
|
2484
|
+
},
|
|
2485
|
+
/* @__PURE__ */ React24.createElement("div", { ...contentProps ?? {} }, children)
|
|
2486
|
+
));
|
|
2487
|
+
}, "List");
|
|
2488
|
+
|
|
2489
|
+
// src/components/crud/create/index.tsx
|
|
2490
|
+
import React25 from "react";
|
|
2491
|
+
import { Card, Space as Space4, Spin } from "antd";
|
|
2492
|
+
import {
|
|
2493
|
+
useTranslate as useTranslate7,
|
|
2494
|
+
useUserFriendlyName as useUserFriendlyName3,
|
|
2495
|
+
useRefineContext as useRefineContext3,
|
|
2496
|
+
useResourceParams as useResourceParams5,
|
|
2497
|
+
useBack
|
|
2498
|
+
} from "@refinedev/core";
|
|
2499
|
+
var Create = /* @__PURE__ */ __name(({
|
|
2500
|
+
title,
|
|
2501
|
+
saveButtonProps: saveButtonPropsFromProps,
|
|
2502
|
+
children,
|
|
2503
|
+
resource: resourceFromProps,
|
|
2504
|
+
isLoading = false,
|
|
2505
|
+
breadcrumb: breadcrumbFromProps,
|
|
2506
|
+
wrapperProps,
|
|
2507
|
+
headerProps,
|
|
2508
|
+
contentProps,
|
|
2509
|
+
headerButtonProps,
|
|
2510
|
+
headerButtons,
|
|
2511
|
+
footerButtonProps,
|
|
2512
|
+
footerButtons,
|
|
2513
|
+
goBack: goBackFromProps
|
|
2514
|
+
}) => {
|
|
2515
|
+
var _a;
|
|
2516
|
+
const translate = useTranslate7();
|
|
2517
|
+
const {
|
|
2518
|
+
options: { breadcrumb: globalBreadcrumb } = {}
|
|
2519
|
+
} = useRefineContext3();
|
|
2520
|
+
const back = useBack();
|
|
2521
|
+
const getUserFriendlyName = useUserFriendlyName3();
|
|
2522
|
+
const { resource, identifier } = useResourceParams5({
|
|
2523
|
+
resource: resourceFromProps
|
|
2524
|
+
});
|
|
2525
|
+
const breadcrumb = typeof breadcrumbFromProps === "undefined" ? globalBreadcrumb : breadcrumbFromProps;
|
|
2526
|
+
const saveButtonProps = {
|
|
2527
|
+
...isLoading ? { disabled: true } : {},
|
|
2528
|
+
...saveButtonPropsFromProps,
|
|
2529
|
+
htmlType: "submit"
|
|
2530
|
+
};
|
|
2531
|
+
const defaultFooterButtons = /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(SaveButton, { ...saveButtonProps }));
|
|
2532
|
+
return /* @__PURE__ */ React25.createElement("div", { ...wrapperProps ?? {} }, /* @__PURE__ */ React25.createElement(
|
|
2533
|
+
PageHeader,
|
|
2534
|
+
{
|
|
2535
|
+
backIcon: goBackFromProps,
|
|
2536
|
+
onBack: back,
|
|
2537
|
+
title: title ?? translate(
|
|
2538
|
+
`${identifier}.titles.create`,
|
|
2539
|
+
`Create ${getUserFriendlyName(
|
|
2540
|
+
((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.label) ?? identifier,
|
|
2541
|
+
"singular"
|
|
2542
|
+
)}`
|
|
2543
|
+
),
|
|
2544
|
+
breadcrumb: typeof breadcrumb !== "undefined" ? /* @__PURE__ */ React25.createElement(React25.Fragment, null, breadcrumb) : /* @__PURE__ */ React25.createElement(Breadcrumb, null),
|
|
2545
|
+
extra: /* @__PURE__ */ React25.createElement(Space4, { wrap: true, ...headerButtonProps ?? {} }, headerButtons ? typeof headerButtons === "function" ? headerButtons({
|
|
2546
|
+
defaultButtons: null
|
|
2547
|
+
}) : headerButtons : null),
|
|
2548
|
+
...headerProps ?? {}
|
|
2549
|
+
},
|
|
2550
|
+
/* @__PURE__ */ React25.createElement(Spin, { spinning: isLoading }, /* @__PURE__ */ React25.createElement(
|
|
2551
|
+
Card,
|
|
2552
|
+
{
|
|
2553
|
+
variant: "borderless",
|
|
2554
|
+
actions: [
|
|
2555
|
+
/* @__PURE__ */ React25.createElement(
|
|
2556
|
+
Space4,
|
|
2557
|
+
{
|
|
2558
|
+
key: "action-buttons",
|
|
2559
|
+
style: { float: "right", marginRight: 24 },
|
|
2560
|
+
...footerButtonProps ?? {}
|
|
2561
|
+
},
|
|
2562
|
+
footerButtons ? typeof footerButtons === "function" ? footerButtons({
|
|
2563
|
+
defaultButtons: defaultFooterButtons,
|
|
2564
|
+
saveButtonProps
|
|
2565
|
+
}) : footerButtons : defaultFooterButtons
|
|
2566
|
+
)
|
|
2567
|
+
],
|
|
2568
|
+
...contentProps ?? {}
|
|
2569
|
+
},
|
|
2570
|
+
children
|
|
2571
|
+
))
|
|
2572
|
+
));
|
|
2573
|
+
}, "Create");
|
|
2574
|
+
|
|
2575
|
+
// src/components/crud/edit/index.tsx
|
|
2576
|
+
import React26 from "react";
|
|
2577
|
+
import { Card as Card2, Space as Space5, Spin as Spin2 } from "antd";
|
|
2578
|
+
import {
|
|
2579
|
+
useMutationMode,
|
|
2580
|
+
useTranslate as useTranslate8,
|
|
2581
|
+
useUserFriendlyName as useUserFriendlyName4,
|
|
2582
|
+
useRefineContext as useRefineContext4,
|
|
2583
|
+
useBack as useBack2,
|
|
2584
|
+
useResourceParams as useResourceParams6,
|
|
2585
|
+
useGo as useGo3,
|
|
2586
|
+
useToPath
|
|
2587
|
+
} from "@refinedev/core";
|
|
2588
|
+
var Edit = /* @__PURE__ */ __name(({
|
|
2589
|
+
title,
|
|
2590
|
+
saveButtonProps: saveButtonPropsFromProps,
|
|
2591
|
+
mutationMode: mutationModeProp,
|
|
2592
|
+
recordItemId,
|
|
2593
|
+
children,
|
|
2594
|
+
deleteButtonProps: deleteButtonPropsFromProps,
|
|
2595
|
+
canDelete,
|
|
2596
|
+
resource: resourceFromProps,
|
|
2597
|
+
isLoading = false,
|
|
2598
|
+
dataProviderName,
|
|
2599
|
+
breadcrumb: breadcrumbFromProps,
|
|
2600
|
+
wrapperProps,
|
|
2601
|
+
headerProps,
|
|
2602
|
+
contentProps,
|
|
2603
|
+
headerButtonProps,
|
|
2604
|
+
headerButtons,
|
|
2605
|
+
footerButtonProps,
|
|
2606
|
+
footerButtons,
|
|
2607
|
+
goBack: goBackFromProps,
|
|
2608
|
+
autoSaveProps
|
|
2609
|
+
}) => {
|
|
2610
|
+
var _a, _b;
|
|
2611
|
+
const translate = useTranslate8();
|
|
2612
|
+
const {
|
|
2613
|
+
options: { breadcrumb: globalBreadcrumb } = {}
|
|
2614
|
+
} = useRefineContext4();
|
|
2615
|
+
const { mutationMode: mutationModeContext } = useMutationMode();
|
|
2616
|
+
const mutationMode = mutationModeProp ?? mutationModeContext;
|
|
2617
|
+
const back = useBack2();
|
|
2618
|
+
const go = useGo3();
|
|
2619
|
+
const getUserFriendlyName = useUserFriendlyName4();
|
|
2620
|
+
const {
|
|
2621
|
+
resource,
|
|
2622
|
+
action,
|
|
2623
|
+
id: idFromParams,
|
|
2624
|
+
identifier
|
|
2625
|
+
} = useResourceParams6({
|
|
2626
|
+
resource: resourceFromProps
|
|
2627
|
+
});
|
|
2628
|
+
const goListPath = useToPath({
|
|
2629
|
+
resource,
|
|
2630
|
+
action: "list"
|
|
2631
|
+
});
|
|
2632
|
+
const id = recordItemId ?? idFromParams;
|
|
2633
|
+
const breadcrumb = typeof breadcrumbFromProps === "undefined" ? globalBreadcrumb : breadcrumbFromProps;
|
|
2634
|
+
const hasList = (resource == null ? void 0 : resource.list) && !recordItemId;
|
|
2635
|
+
const isDeleteButtonVisible = canDelete ?? (((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.canDelete) || deleteButtonPropsFromProps);
|
|
2636
|
+
const listButtonProps = hasList ? {
|
|
2637
|
+
...isLoading ? { disabled: true } : {},
|
|
2638
|
+
resource: identifier
|
|
2639
|
+
} : void 0;
|
|
2640
|
+
const refreshButtonProps = {
|
|
2641
|
+
...isLoading ? { disabled: true } : {},
|
|
2642
|
+
resource: identifier,
|
|
2643
|
+
recordItemId: id,
|
|
2644
|
+
dataProviderName
|
|
2645
|
+
};
|
|
2646
|
+
const deleteButtonProps = isDeleteButtonVisible ? {
|
|
2647
|
+
...isLoading ? { disabled: true } : {},
|
|
2648
|
+
resource: identifier,
|
|
2649
|
+
mutationMode,
|
|
2650
|
+
onSuccess: () => {
|
|
2651
|
+
go({ to: goListPath });
|
|
2652
|
+
},
|
|
2653
|
+
recordItemId: id,
|
|
2654
|
+
dataProviderName,
|
|
2655
|
+
...deleteButtonPropsFromProps
|
|
2656
|
+
} : void 0;
|
|
2657
|
+
const saveButtonProps = {
|
|
2658
|
+
...isLoading ? { disabled: true } : {},
|
|
2659
|
+
...saveButtonPropsFromProps
|
|
2660
|
+
};
|
|
2661
|
+
const defaultHeaderButtons = /* @__PURE__ */ React26.createElement(React26.Fragment, null, autoSaveProps && /* @__PURE__ */ React26.createElement(AutoSaveIndicator, { ...autoSaveProps }), hasList && /* @__PURE__ */ React26.createElement(ListButton, { ...listButtonProps }), /* @__PURE__ */ React26.createElement(RefreshButton, { ...refreshButtonProps }));
|
|
2662
|
+
const defaultFooterButtons = /* @__PURE__ */ React26.createElement(React26.Fragment, null, isDeleteButtonVisible && /* @__PURE__ */ React26.createElement(DeleteButton, { ...deleteButtonProps }), /* @__PURE__ */ React26.createElement(SaveButton, { ...saveButtonProps }));
|
|
2663
|
+
return /* @__PURE__ */ React26.createElement("div", { ...wrapperProps ?? {} }, /* @__PURE__ */ React26.createElement(
|
|
2664
|
+
PageHeader,
|
|
2665
|
+
{
|
|
2666
|
+
backIcon: goBackFromProps,
|
|
2667
|
+
onBack: action !== "list" && typeof action !== "undefined" ? back : void 0,
|
|
2668
|
+
title: title ?? translate(
|
|
2669
|
+
`${identifier}.titles.edit`,
|
|
2670
|
+
`Edit ${getUserFriendlyName(
|
|
2671
|
+
((_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.label) ?? identifier,
|
|
2672
|
+
"singular"
|
|
2673
|
+
)}`
|
|
2674
|
+
),
|
|
2675
|
+
extra: /* @__PURE__ */ React26.createElement(Space5, { wrap: true, ...headerButtonProps ?? {} }, headerButtons ? typeof headerButtons === "function" ? headerButtons({
|
|
2676
|
+
defaultButtons: defaultHeaderButtons,
|
|
2677
|
+
listButtonProps,
|
|
2678
|
+
refreshButtonProps
|
|
2679
|
+
}) : headerButtons : defaultHeaderButtons),
|
|
2680
|
+
breadcrumb: typeof breadcrumb !== "undefined" ? /* @__PURE__ */ React26.createElement(React26.Fragment, null, breadcrumb) : /* @__PURE__ */ React26.createElement(Breadcrumb, null),
|
|
2681
|
+
...headerProps ?? {}
|
|
2682
|
+
},
|
|
2683
|
+
/* @__PURE__ */ React26.createElement(Spin2, { spinning: isLoading }, /* @__PURE__ */ React26.createElement(
|
|
2684
|
+
Card2,
|
|
2685
|
+
{
|
|
2686
|
+
variant: "borderless",
|
|
2687
|
+
actions: [
|
|
2688
|
+
/* @__PURE__ */ React26.createElement(
|
|
2689
|
+
Space5,
|
|
2690
|
+
{
|
|
2691
|
+
key: "footer-buttons",
|
|
2692
|
+
wrap: true,
|
|
2693
|
+
style: {
|
|
2694
|
+
float: "right",
|
|
2695
|
+
marginRight: 24
|
|
2696
|
+
},
|
|
2697
|
+
...footerButtonProps ?? {}
|
|
2698
|
+
},
|
|
2699
|
+
footerButtons ? typeof footerButtons === "function" ? footerButtons({
|
|
2700
|
+
defaultButtons: defaultFooterButtons,
|
|
2701
|
+
deleteButtonProps,
|
|
2702
|
+
saveButtonProps
|
|
2703
|
+
}) : footerButtons : defaultFooterButtons
|
|
2704
|
+
)
|
|
2705
|
+
],
|
|
2706
|
+
...contentProps ?? {}
|
|
2707
|
+
},
|
|
2708
|
+
children
|
|
2709
|
+
))
|
|
2710
|
+
));
|
|
2711
|
+
}, "Edit");
|
|
2712
|
+
|
|
2713
|
+
// src/components/crud/show/index.tsx
|
|
2714
|
+
import React27 from "react";
|
|
2715
|
+
import { Card as Card3, Space as Space6, Spin as Spin3 } from "antd";
|
|
2716
|
+
import {
|
|
2717
|
+
useTranslate as useTranslate9,
|
|
2718
|
+
useUserFriendlyName as useUserFriendlyName5,
|
|
2719
|
+
useRefineContext as useRefineContext5,
|
|
2720
|
+
useResourceParams as useResourceParams7,
|
|
2721
|
+
useToPath as useToPath2,
|
|
2722
|
+
useBack as useBack3,
|
|
2723
|
+
useGo as useGo4
|
|
2724
|
+
} from "@refinedev/core";
|
|
2725
|
+
var Show = /* @__PURE__ */ __name(({
|
|
2726
|
+
title,
|
|
2727
|
+
canEdit,
|
|
2728
|
+
canDelete,
|
|
2729
|
+
deleteButtonProps: deleteButtonPropsFromProps,
|
|
2730
|
+
isLoading = false,
|
|
2731
|
+
children,
|
|
2732
|
+
resource: resourceFromProps,
|
|
2733
|
+
recordItemId,
|
|
2734
|
+
dataProviderName,
|
|
2735
|
+
breadcrumb: breadcrumbFromProps,
|
|
2736
|
+
contentProps,
|
|
2737
|
+
headerProps,
|
|
2738
|
+
wrapperProps,
|
|
2739
|
+
headerButtons,
|
|
2740
|
+
footerButtons,
|
|
2741
|
+
footerButtonProps,
|
|
2742
|
+
headerButtonProps,
|
|
2743
|
+
goBack: goBackFromProps
|
|
2744
|
+
}) => {
|
|
2745
|
+
var _a, _b;
|
|
2746
|
+
const translate = useTranslate9();
|
|
2747
|
+
const {
|
|
2748
|
+
options: { breadcrumb: globalBreadcrumb } = {}
|
|
2749
|
+
} = useRefineContext5();
|
|
2750
|
+
const back = useBack3();
|
|
2751
|
+
const go = useGo4();
|
|
2752
|
+
const getUserFriendlyName = useUserFriendlyName5();
|
|
2753
|
+
const {
|
|
2754
|
+
resource,
|
|
2755
|
+
action,
|
|
2756
|
+
id: idFromParams,
|
|
2757
|
+
identifier
|
|
2758
|
+
} = useResourceParams7({
|
|
2759
|
+
resource: resourceFromProps
|
|
2760
|
+
});
|
|
2761
|
+
const goListPath = useToPath2({
|
|
2762
|
+
resource,
|
|
2763
|
+
action: "list"
|
|
2764
|
+
});
|
|
2765
|
+
const id = recordItemId ?? idFromParams;
|
|
2766
|
+
const breadcrumb = typeof breadcrumbFromProps === "undefined" ? globalBreadcrumb : breadcrumbFromProps;
|
|
2767
|
+
const hasList = (resource == null ? void 0 : resource.list) && !recordItemId;
|
|
2768
|
+
const isDeleteButtonVisible = canDelete ?? (((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.canDelete) || deleteButtonPropsFromProps);
|
|
2769
|
+
const isEditButtonVisible = canEdit ?? !!(resource == null ? void 0 : resource.edit);
|
|
2770
|
+
const listButtonProps = hasList ? {
|
|
2771
|
+
resource: identifier
|
|
2772
|
+
} : void 0;
|
|
2773
|
+
const editButtonProps = isEditButtonVisible ? {
|
|
2774
|
+
...isLoading ? { disabled: true } : {},
|
|
2775
|
+
type: "primary",
|
|
2776
|
+
resource: identifier,
|
|
2777
|
+
recordItemId: id
|
|
2778
|
+
} : void 0;
|
|
2779
|
+
const deleteButtonProps = isDeleteButtonVisible ? {
|
|
2780
|
+
...isLoading ? { disabled: true } : {},
|
|
2781
|
+
resource: identifier,
|
|
2782
|
+
recordItemId: id,
|
|
2783
|
+
onSuccess: () => {
|
|
2784
|
+
go({ to: goListPath });
|
|
2785
|
+
},
|
|
2786
|
+
dataProviderName,
|
|
2787
|
+
...deleteButtonPropsFromProps
|
|
2788
|
+
} : void 0;
|
|
2789
|
+
const refreshButtonProps = {
|
|
2790
|
+
...isLoading ? { disabled: true } : {},
|
|
2791
|
+
resource: identifier,
|
|
2792
|
+
recordItemId: id,
|
|
2793
|
+
dataProviderName
|
|
2794
|
+
};
|
|
2795
|
+
const defaultHeaderButtons = /* @__PURE__ */ React27.createElement(React27.Fragment, null, hasList && /* @__PURE__ */ React27.createElement(ListButton, { ...listButtonProps }), isEditButtonVisible && /* @__PURE__ */ React27.createElement(EditButton, { ...editButtonProps }), isDeleteButtonVisible && /* @__PURE__ */ React27.createElement(DeleteButton, { ...deleteButtonProps }), /* @__PURE__ */ React27.createElement(RefreshButton, { ...refreshButtonProps }));
|
|
2796
|
+
return /* @__PURE__ */ React27.createElement("div", { ...wrapperProps ?? {} }, /* @__PURE__ */ React27.createElement(
|
|
2797
|
+
PageHeader,
|
|
2798
|
+
{
|
|
2799
|
+
backIcon: goBackFromProps,
|
|
2800
|
+
onBack: action !== "list" && typeof action !== "undefined" ? back : void 0,
|
|
2801
|
+
title: title ?? translate(
|
|
2802
|
+
`${identifier}.titles.show`,
|
|
2803
|
+
`Show ${getUserFriendlyName(
|
|
2804
|
+
((_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.label) ?? identifier,
|
|
2805
|
+
"singular"
|
|
2806
|
+
)}`
|
|
2807
|
+
),
|
|
2808
|
+
extra: /* @__PURE__ */ React27.createElement(Space6, { key: "extra-buttons", wrap: true, ...headerButtonProps ?? {} }, headerButtons ? typeof headerButtons === "function" ? headerButtons({
|
|
2809
|
+
defaultButtons: defaultHeaderButtons,
|
|
2810
|
+
deleteButtonProps,
|
|
2811
|
+
editButtonProps,
|
|
2812
|
+
listButtonProps,
|
|
2813
|
+
refreshButtonProps
|
|
2814
|
+
}) : headerButtons : defaultHeaderButtons),
|
|
2815
|
+
breadcrumb: typeof breadcrumb !== "undefined" ? /* @__PURE__ */ React27.createElement(React27.Fragment, null, breadcrumb) : /* @__PURE__ */ React27.createElement(Breadcrumb, null),
|
|
2816
|
+
...headerProps ?? {}
|
|
2817
|
+
},
|
|
2818
|
+
/* @__PURE__ */ React27.createElement(Spin3, { spinning: isLoading }, /* @__PURE__ */ React27.createElement(
|
|
2819
|
+
Card3,
|
|
2820
|
+
{
|
|
2821
|
+
variant: "borderless",
|
|
2822
|
+
actions: footerButtons ? [
|
|
2823
|
+
/* @__PURE__ */ React27.createElement(Space6, { key: "footer-buttons", wrap: true, ...footerButtonProps }, typeof footerButtons === "function" ? footerButtons({
|
|
2824
|
+
defaultButtons: null
|
|
2825
|
+
}) : footerButtons)
|
|
2826
|
+
] : void 0,
|
|
2827
|
+
...contentProps ?? {}
|
|
2828
|
+
},
|
|
2829
|
+
children
|
|
2830
|
+
))
|
|
2831
|
+
));
|
|
2832
|
+
}, "Show");
|
|
2833
|
+
|
|
2834
|
+
// src/components/fields/text/index.tsx
|
|
2835
|
+
import React28 from "react";
|
|
2836
|
+
import { Typography as Typography3 } from "antd";
|
|
2837
|
+
var TextField = /* @__PURE__ */ __name(({ value, ...rest }) => {
|
|
2838
|
+
return /* @__PURE__ */ React28.createElement(Typography3.Text, { ...rest }, value);
|
|
2839
|
+
}, "TextField");
|
|
2840
|
+
|
|
2841
|
+
// src/components/fields/tag/index.tsx
|
|
2842
|
+
import React29 from "react";
|
|
2843
|
+
import { Tag } from "antd";
|
|
2844
|
+
var TagField = /* @__PURE__ */ __name(({ value, ...rest }) => {
|
|
2845
|
+
return /* @__PURE__ */ React29.createElement(Tag, { ...rest }, value == null ? void 0 : value.toString());
|
|
2846
|
+
}, "TagField");
|
|
2847
|
+
|
|
2848
|
+
// src/components/fields/email/index.tsx
|
|
2849
|
+
import React30 from "react";
|
|
2850
|
+
import { Typography as Typography4 } from "antd";
|
|
2851
|
+
var EmailField = /* @__PURE__ */ __name(({ value, ...rest }) => {
|
|
2852
|
+
return /* @__PURE__ */ React30.createElement(Typography4.Link, { href: `mailto:${value}`, ...rest }, value);
|
|
2853
|
+
}, "EmailField");
|
|
2854
|
+
|
|
2855
|
+
// src/components/fields/image/index.tsx
|
|
2856
|
+
import React31 from "react";
|
|
2857
|
+
import { Image } from "antd";
|
|
2858
|
+
var ImageField = /* @__PURE__ */ __name(({
|
|
2859
|
+
value,
|
|
2860
|
+
imageTitle,
|
|
2861
|
+
...rest
|
|
2862
|
+
}) => {
|
|
2863
|
+
return /* @__PURE__ */ React31.createElement(Image, { ...rest, src: value, title: imageTitle });
|
|
2864
|
+
}, "ImageField");
|
|
2865
|
+
|
|
2866
|
+
// src/components/fields/boolean/index.tsx
|
|
2867
|
+
import React32 from "react";
|
|
2868
|
+
import { Tooltip } from "antd";
|
|
2869
|
+
import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
|
|
2870
|
+
var BooleanField = /* @__PURE__ */ __name(({
|
|
2871
|
+
value,
|
|
2872
|
+
valueLabelTrue = "true",
|
|
2873
|
+
valueLabelFalse = "false",
|
|
2874
|
+
trueIcon = /* @__PURE__ */ React32.createElement(CheckOutlined, null),
|
|
2875
|
+
falseIcon = /* @__PURE__ */ React32.createElement(CloseOutlined, null),
|
|
2876
|
+
...rest
|
|
2877
|
+
}) => {
|
|
2878
|
+
return /* @__PURE__ */ React32.createElement(Tooltip, { title: value ? valueLabelTrue : valueLabelFalse, ...rest }, value ? /* @__PURE__ */ React32.createElement("span", null, trueIcon) : /* @__PURE__ */ React32.createElement("span", null, falseIcon));
|
|
2879
|
+
}, "BooleanField");
|
|
2880
|
+
|
|
2881
|
+
// src/components/fields/date/index.tsx
|
|
2882
|
+
import React33 from "react";
|
|
2883
|
+
import dayjs from "dayjs";
|
|
2884
|
+
import { Typography as Typography5 } from "antd";
|
|
2885
|
+
import LocalizedFormat from "dayjs/plugin/localizedFormat.js";
|
|
2886
|
+
var DateField = /* @__PURE__ */ __name(({
|
|
2887
|
+
value,
|
|
2888
|
+
locales,
|
|
2889
|
+
format: dateFormat = "L",
|
|
2890
|
+
...rest
|
|
2891
|
+
}) => {
|
|
2892
|
+
dayjs.extend(LocalizedFormat);
|
|
2893
|
+
const defaultLocale = dayjs.locale();
|
|
2894
|
+
return /* @__PURE__ */ React33.createElement(Typography5.Text, { ...rest }, value ? dayjs(value).locale(locales || defaultLocale).format(dateFormat) : "");
|
|
2895
|
+
}, "DateField");
|
|
2896
|
+
|
|
2897
|
+
// src/components/fields/file/index.tsx
|
|
2898
|
+
import React34 from "react";
|
|
2899
|
+
var FileField = /* @__PURE__ */ __name(({
|
|
2900
|
+
title,
|
|
2901
|
+
src,
|
|
2902
|
+
...rest
|
|
2903
|
+
}) => {
|
|
2904
|
+
return /* @__PURE__ */ React34.createElement(UrlField, { value: src, title, ...rest }, title ?? src);
|
|
2905
|
+
}, "FileField");
|
|
2906
|
+
|
|
2907
|
+
// src/components/fields/url/index.tsx
|
|
2908
|
+
import React35 from "react";
|
|
2909
|
+
import { Typography as Typography6 } from "antd";
|
|
2910
|
+
var UrlField = /* @__PURE__ */ __name(({
|
|
2911
|
+
children,
|
|
2912
|
+
value,
|
|
2913
|
+
...rest
|
|
2914
|
+
}) => {
|
|
2915
|
+
return /* @__PURE__ */ React35.createElement(Typography6.Link, { href: value, ...rest }, children ?? value);
|
|
2916
|
+
}, "UrlField");
|
|
2917
|
+
|
|
2918
|
+
// src/components/fields/number/index.tsx
|
|
2919
|
+
import React36 from "react";
|
|
2920
|
+
import { Typography as Typography7 } from "antd";
|
|
2921
|
+
function toLocaleStringSupportsOptions() {
|
|
2922
|
+
return !!(typeof Intl === "object" && Intl && typeof Intl.NumberFormat === "function");
|
|
2923
|
+
}
|
|
2924
|
+
__name(toLocaleStringSupportsOptions, "toLocaleStringSupportsOptions");
|
|
2925
|
+
var NumberField = /* @__PURE__ */ __name(({
|
|
2926
|
+
value,
|
|
2927
|
+
locale,
|
|
2928
|
+
options,
|
|
2929
|
+
...rest
|
|
2930
|
+
}) => {
|
|
2931
|
+
const number = Number(value);
|
|
2932
|
+
return /* @__PURE__ */ React36.createElement(Typography7.Text, { ...rest }, toLocaleStringSupportsOptions() ? number.toLocaleString(locale, options) : number);
|
|
2933
|
+
}, "NumberField");
|
|
2934
|
+
|
|
2935
|
+
// src/components/fields/markdown/index.tsx
|
|
2936
|
+
import React37 from "react";
|
|
2937
|
+
import ReactMarkdown from "react-markdown";
|
|
2938
|
+
import gfm from "remark-gfm";
|
|
2939
|
+
var MarkdownField = /* @__PURE__ */ __name(({
|
|
2940
|
+
value = ""
|
|
2941
|
+
}) => {
|
|
2942
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2943
|
+
ReactMarkdown,
|
|
2944
|
+
{
|
|
2945
|
+
remarkPlugins: [gfm]
|
|
2946
|
+
},
|
|
2947
|
+
value
|
|
2948
|
+
);
|
|
2949
|
+
}, "MarkdownField");
|
|
2950
|
+
|
|
2951
|
+
// src/components/table/components/filterDropdown/index.tsx
|
|
2952
|
+
import React38 from "react";
|
|
2953
|
+
import { Button as Button13, Space as Space7 } from "antd";
|
|
2954
|
+
import dayjs2 from "dayjs";
|
|
2955
|
+
import { FilterOutlined } from "@ant-design/icons";
|
|
2956
|
+
import { useTranslate as useTranslate10 } from "@refinedev/core";
|
|
2957
|
+
var FilterDropdown = /* @__PURE__ */ __name((props) => {
|
|
2958
|
+
const {
|
|
2959
|
+
setSelectedKeys,
|
|
2960
|
+
confirm,
|
|
2961
|
+
clearFilters,
|
|
2962
|
+
mapValue = /* @__PURE__ */ __name((value) => value, "mapValue"),
|
|
2963
|
+
selectedKeys,
|
|
2964
|
+
children
|
|
2965
|
+
} = props;
|
|
2966
|
+
const translate = useTranslate10();
|
|
2967
|
+
const clearFilter = /* @__PURE__ */ __name(() => {
|
|
2968
|
+
if (clearFilters) {
|
|
2969
|
+
clearFilters();
|
|
2970
|
+
}
|
|
2971
|
+
}, "clearFilter");
|
|
2972
|
+
const onFilter = /* @__PURE__ */ __name(() => {
|
|
2973
|
+
let keys;
|
|
2974
|
+
if (typeof selectedKeys === "number") {
|
|
2975
|
+
keys = `${selectedKeys}`;
|
|
2976
|
+
} else if (dayjs2.isDayjs(selectedKeys)) {
|
|
2977
|
+
keys = [selectedKeys.toISOString()];
|
|
2978
|
+
} else {
|
|
2979
|
+
keys = selectedKeys;
|
|
2980
|
+
}
|
|
2981
|
+
setSelectedKeys(keys);
|
|
2982
|
+
confirm == null ? void 0 : confirm();
|
|
2983
|
+
}, "onFilter");
|
|
2984
|
+
const onChange = /* @__PURE__ */ __name((e) => {
|
|
2985
|
+
if (typeof e === "object") {
|
|
2986
|
+
if (Array.isArray(e)) {
|
|
2987
|
+
const mappedValue3 = mapValue(e, "onChange");
|
|
2988
|
+
return setSelectedKeys(mappedValue3);
|
|
2989
|
+
}
|
|
2990
|
+
const changeEvent = !e || !e.target || dayjs2.isDayjs(e) ? { target: { value: e } } : e;
|
|
2991
|
+
const { target } = changeEvent;
|
|
2992
|
+
const mappedValue2 = mapValue(target.value, "onChange");
|
|
2993
|
+
setSelectedKeys(mappedValue2);
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
const mappedValue = mapValue(e, "onChange");
|
|
2997
|
+
setSelectedKeys(mappedValue);
|
|
2998
|
+
}, "onChange");
|
|
2999
|
+
const childrenWithProps = React38.Children.map(children, (child) => {
|
|
3000
|
+
if (React38.isValidElement(child)) {
|
|
3001
|
+
return React38.cloneElement(child, {
|
|
3002
|
+
onChange,
|
|
3003
|
+
value: mapValue(selectedKeys, "value")
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
return child;
|
|
3007
|
+
});
|
|
3008
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3009
|
+
"div",
|
|
3010
|
+
{
|
|
3011
|
+
style: {
|
|
3012
|
+
padding: 10,
|
|
3013
|
+
display: "flex",
|
|
3014
|
+
flexDirection: "column",
|
|
3015
|
+
alignItems: "flex-end"
|
|
3016
|
+
}
|
|
3017
|
+
},
|
|
3018
|
+
/* @__PURE__ */ React38.createElement("div", { style: { marginBottom: 15 } }, childrenWithProps),
|
|
3019
|
+
/* @__PURE__ */ React38.createElement(Space7, null, /* @__PURE__ */ React38.createElement(Button13, { type: "primary", size: "small", onClick: () => onFilter() }, /* @__PURE__ */ React38.createElement(FilterOutlined, null), " ", translate("buttons.filter", "Filter")), /* @__PURE__ */ React38.createElement(Button13, { danger: true, size: "small", onClick: () => clearFilter() }, translate("buttons.clear", "Clear")))
|
|
3020
|
+
);
|
|
3021
|
+
}, "FilterDropdown");
|
|
3022
|
+
|
|
3023
|
+
// src/components/pages/error/index.tsx
|
|
3024
|
+
import React39, { useEffect, useState as useState3 } from "react";
|
|
3025
|
+
import { useGo as useGo5, useResourceParams as useResourceParams8 } from "@refinedev/core";
|
|
3026
|
+
import { Button as Button14, Result, Typography as Typography8, Space as Space8, Tooltip as Tooltip2 } from "antd";
|
|
3027
|
+
import { InfoCircleOutlined } from "@ant-design/icons";
|
|
3028
|
+
import { useTranslate as useTranslate11 } from "@refinedev/core";
|
|
3029
|
+
var ErrorComponent = /* @__PURE__ */ __name(() => {
|
|
3030
|
+
const [errorMessage, setErrorMessage] = useState3();
|
|
3031
|
+
const translate = useTranslate11();
|
|
3032
|
+
const go = useGo5();
|
|
3033
|
+
const { resource, action } = useResourceParams8();
|
|
3034
|
+
useEffect(() => {
|
|
3035
|
+
if (resource) {
|
|
3036
|
+
if (action) {
|
|
3037
|
+
setErrorMessage(
|
|
3038
|
+
translate(
|
|
3039
|
+
"pages.error.info",
|
|
3040
|
+
{
|
|
3041
|
+
action,
|
|
3042
|
+
resource: resource == null ? void 0 : resource.name
|
|
3043
|
+
},
|
|
3044
|
+
`You may have forgotten to add the "${action}" component to "${resource == null ? void 0 : resource.name}" resource.`
|
|
3045
|
+
)
|
|
3046
|
+
);
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}, [resource, action]);
|
|
3050
|
+
return /* @__PURE__ */ React39.createElement(
|
|
3051
|
+
Result,
|
|
3052
|
+
{
|
|
3053
|
+
status: "404",
|
|
3054
|
+
title: "404",
|
|
3055
|
+
extra: /* @__PURE__ */ React39.createElement(Space8, { direction: "vertical", size: "large" }, /* @__PURE__ */ React39.createElement(Space8, null, /* @__PURE__ */ React39.createElement(Typography8.Text, null, translate(
|
|
3056
|
+
"pages.error.404",
|
|
3057
|
+
"Sorry, the page you visited does not exist."
|
|
3058
|
+
)), errorMessage && /* @__PURE__ */ React39.createElement(Tooltip2, { title: errorMessage }, /* @__PURE__ */ React39.createElement(InfoCircleOutlined, { }))), /* @__PURE__ */ React39.createElement(Button14, { type: "primary", onClick: () => go({ to: "/" }) }, translate("pages.error.backHome", "Back Home")))
|
|
3059
|
+
}
|
|
3060
|
+
);
|
|
3061
|
+
}, "ErrorComponent");
|
|
3062
|
+
|
|
3063
|
+
// src/components/pages/welcome/index.tsx
|
|
3064
|
+
import React40 from "react";
|
|
3065
|
+
import { WelcomePage as WelcomePageFromCore } from "@refinedev/core";
|
|
3066
|
+
var WelcomePage = /* @__PURE__ */ __name(() => {
|
|
3067
|
+
return /* @__PURE__ */ React40.createElement(WelcomePageFromCore, null);
|
|
3068
|
+
}, "WelcomePage");
|
|
3069
|
+
|
|
3070
|
+
// src/components/pages/auth/index.tsx
|
|
3071
|
+
import React45 from "react";
|
|
3072
|
+
|
|
3073
|
+
// src/components/pages/auth/components/login/index.tsx
|
|
3074
|
+
import React41 from "react";
|
|
3075
|
+
import {
|
|
3076
|
+
useLink as useLink4
|
|
3077
|
+
} from "@refinedev/core";
|
|
3078
|
+
import {
|
|
3079
|
+
Row,
|
|
3080
|
+
Col,
|
|
3081
|
+
Layout as Layout2,
|
|
3082
|
+
Card as Card4,
|
|
3083
|
+
Typography as Typography9,
|
|
3084
|
+
Form as Form4,
|
|
3085
|
+
Input,
|
|
3086
|
+
Button as Button15,
|
|
3087
|
+
Checkbox,
|
|
3088
|
+
Divider,
|
|
3089
|
+
theme as theme4
|
|
3090
|
+
} from "antd";
|
|
3091
|
+
import { useLogin, useTranslate as useTranslate12 } from "@refinedev/core";
|
|
3092
|
+
|
|
3093
|
+
// src/components/pages/auth/components/styles.ts
|
|
3094
|
+
var layoutStyles = {};
|
|
3095
|
+
var containerStyles = {
|
|
3096
|
+
maxWidth: "400px",
|
|
3097
|
+
margin: "auto",
|
|
3098
|
+
padding: "32px",
|
|
3099
|
+
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.02), 0px 1px 6px -1px rgba(0, 0, 0, 0.02), 0px 1px 2px rgba(0, 0, 0, 0.03)"
|
|
3100
|
+
};
|
|
3101
|
+
var headStyles = {
|
|
3102
|
+
borderBottom: 0,
|
|
3103
|
+
padding: 0
|
|
3104
|
+
};
|
|
3105
|
+
var bodyStyles = { padding: 0, marginTop: "32px" };
|
|
3106
|
+
var titleStyles = {
|
|
3107
|
+
textAlign: "center",
|
|
3108
|
+
marginBottom: 0,
|
|
3109
|
+
fontSize: "24px",
|
|
3110
|
+
lineHeight: "32px",
|
|
3111
|
+
fontWeight: 700,
|
|
3112
|
+
overflowWrap: "break-word",
|
|
3113
|
+
hyphens: "manual",
|
|
3114
|
+
textOverflow: "unset",
|
|
3115
|
+
whiteSpace: "pre-wrap"
|
|
3116
|
+
};
|
|
3117
|
+
|
|
3118
|
+
// src/components/pages/auth/components/login/index.tsx
|
|
3119
|
+
var LoginPage = /* @__PURE__ */ __name(({
|
|
3120
|
+
providers,
|
|
3121
|
+
registerLink,
|
|
3122
|
+
forgotPasswordLink,
|
|
3123
|
+
rememberMe,
|
|
3124
|
+
contentProps,
|
|
3125
|
+
wrapperProps,
|
|
3126
|
+
renderContent,
|
|
3127
|
+
formProps,
|
|
3128
|
+
title,
|
|
3129
|
+
hideForm,
|
|
3130
|
+
mutationVariables
|
|
3131
|
+
}) => {
|
|
3132
|
+
const { token } = theme4.useToken();
|
|
3133
|
+
const [form] = Form4.useForm();
|
|
3134
|
+
const translate = useTranslate12();
|
|
3135
|
+
const Link = useLink4();
|
|
3136
|
+
const { mutate: login, isPending } = useLogin();
|
|
3137
|
+
const PageTitle = title === false ? null : /* @__PURE__ */ React41.createElement(
|
|
3138
|
+
"div",
|
|
3139
|
+
{
|
|
3140
|
+
style: {
|
|
3141
|
+
display: "flex",
|
|
3142
|
+
justifyContent: "center",
|
|
3143
|
+
marginBottom: "32px",
|
|
3144
|
+
fontSize: "20px"
|
|
3145
|
+
}
|
|
3146
|
+
},
|
|
3147
|
+
title ?? /* @__PURE__ */ React41.createElement(ThemedTitle, { collapsed: false })
|
|
3148
|
+
);
|
|
3149
|
+
const CardTitle = /* @__PURE__ */ React41.createElement(
|
|
3150
|
+
Typography9.Title,
|
|
3151
|
+
{
|
|
3152
|
+
level: 3,
|
|
3153
|
+
style: {
|
|
3154
|
+
color: token.colorPrimaryTextHover,
|
|
3155
|
+
...titleStyles
|
|
3156
|
+
}
|
|
3157
|
+
},
|
|
3158
|
+
translate("pages.login.title", "Sign in to your account")
|
|
3159
|
+
);
|
|
3160
|
+
const renderProviders = /* @__PURE__ */ __name(() => {
|
|
3161
|
+
if (providers && providers.length > 0) {
|
|
3162
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, providers.map((provider) => {
|
|
3163
|
+
return /* @__PURE__ */ React41.createElement(
|
|
3164
|
+
Button15,
|
|
3165
|
+
{
|
|
3166
|
+
key: provider.name,
|
|
3167
|
+
type: "default",
|
|
3168
|
+
block: true,
|
|
3169
|
+
icon: provider.icon,
|
|
3170
|
+
style: {
|
|
3171
|
+
display: "flex",
|
|
3172
|
+
justifyContent: "center",
|
|
3173
|
+
alignItems: "center",
|
|
3174
|
+
width: "100%",
|
|
3175
|
+
marginBottom: "8px"
|
|
3176
|
+
},
|
|
3177
|
+
onClick: () => login({
|
|
3178
|
+
...mutationVariables,
|
|
3179
|
+
providerName: provider.name
|
|
3180
|
+
})
|
|
3181
|
+
},
|
|
3182
|
+
provider.label
|
|
3183
|
+
);
|
|
3184
|
+
}), !hideForm && /* @__PURE__ */ React41.createElement(Divider, null, /* @__PURE__ */ React41.createElement(
|
|
3185
|
+
Typography9.Text,
|
|
3186
|
+
{
|
|
3187
|
+
style: {
|
|
3188
|
+
color: token.colorTextLabel
|
|
3189
|
+
}
|
|
3190
|
+
},
|
|
3191
|
+
translate("pages.login.divider", "or")
|
|
3192
|
+
)));
|
|
3193
|
+
}
|
|
3194
|
+
return null;
|
|
3195
|
+
}, "renderProviders");
|
|
3196
|
+
const CardContent = /* @__PURE__ */ React41.createElement(
|
|
3197
|
+
Card4,
|
|
3198
|
+
{
|
|
3199
|
+
title: CardTitle,
|
|
3200
|
+
styles: {
|
|
3201
|
+
header: headStyles,
|
|
3202
|
+
body: bodyStyles
|
|
3203
|
+
},
|
|
3204
|
+
style: {
|
|
3205
|
+
...containerStyles,
|
|
3206
|
+
backgroundColor: token.colorBgElevated
|
|
3207
|
+
},
|
|
3208
|
+
...contentProps ?? {}
|
|
3209
|
+
},
|
|
3210
|
+
renderProviders(),
|
|
3211
|
+
!hideForm && /* @__PURE__ */ React41.createElement(
|
|
3212
|
+
Form4,
|
|
3213
|
+
{
|
|
3214
|
+
layout: "vertical",
|
|
3215
|
+
form,
|
|
3216
|
+
onFinish: (values) => login({ ...values, ...mutationVariables }),
|
|
3217
|
+
requiredMark: false,
|
|
3218
|
+
initialValues: {
|
|
3219
|
+
remember: false
|
|
3220
|
+
},
|
|
3221
|
+
...formProps
|
|
3222
|
+
},
|
|
3223
|
+
/* @__PURE__ */ React41.createElement(
|
|
3224
|
+
Form4.Item,
|
|
3225
|
+
{
|
|
3226
|
+
name: "email",
|
|
3227
|
+
label: translate("pages.login.fields.email", "Email"),
|
|
3228
|
+
rules: [
|
|
3229
|
+
{
|
|
3230
|
+
required: true,
|
|
3231
|
+
message: translate(
|
|
3232
|
+
"pages.login.errors.requiredEmail",
|
|
3233
|
+
"Email is required"
|
|
3234
|
+
)
|
|
3235
|
+
},
|
|
3236
|
+
{
|
|
3237
|
+
type: "email",
|
|
3238
|
+
message: translate(
|
|
3239
|
+
"pages.login.errors.validEmail",
|
|
3240
|
+
"Invalid email address"
|
|
3241
|
+
)
|
|
3242
|
+
}
|
|
3243
|
+
]
|
|
3244
|
+
},
|
|
3245
|
+
/* @__PURE__ */ React41.createElement(
|
|
3246
|
+
Input,
|
|
3247
|
+
{
|
|
3248
|
+
size: "large",
|
|
3249
|
+
placeholder: translate("pages.login.fields.email", "Email")
|
|
3250
|
+
}
|
|
3251
|
+
)
|
|
3252
|
+
),
|
|
3253
|
+
/* @__PURE__ */ React41.createElement(
|
|
3254
|
+
Form4.Item,
|
|
3255
|
+
{
|
|
3256
|
+
name: "password",
|
|
3257
|
+
label: translate("pages.login.fields.password", "Password"),
|
|
3258
|
+
rules: [
|
|
3259
|
+
{
|
|
3260
|
+
required: true,
|
|
3261
|
+
message: translate(
|
|
3262
|
+
"pages.login.errors.requiredPassword",
|
|
3263
|
+
"Password is required"
|
|
3264
|
+
)
|
|
3265
|
+
}
|
|
3266
|
+
]
|
|
3267
|
+
},
|
|
3268
|
+
/* @__PURE__ */ React41.createElement(
|
|
3269
|
+
Input,
|
|
3270
|
+
{
|
|
3271
|
+
type: "password",
|
|
3272
|
+
autoComplete: "current-password",
|
|
3273
|
+
placeholder: "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF",
|
|
3274
|
+
size: "large"
|
|
3275
|
+
}
|
|
3276
|
+
)
|
|
3277
|
+
),
|
|
3278
|
+
/* @__PURE__ */ React41.createElement(
|
|
3279
|
+
"div",
|
|
3280
|
+
{
|
|
3281
|
+
style: {
|
|
3282
|
+
display: "flex",
|
|
3283
|
+
justifyContent: "space-between",
|
|
3284
|
+
marginBottom: "24px"
|
|
3285
|
+
}
|
|
3286
|
+
},
|
|
3287
|
+
rememberMe ?? /* @__PURE__ */ React41.createElement(Form4.Item, { name: "remember", valuePropName: "checked", noStyle: true }, /* @__PURE__ */ React41.createElement(
|
|
3288
|
+
Checkbox,
|
|
3289
|
+
{
|
|
3290
|
+
style: {
|
|
3291
|
+
fontSize: "12px"
|
|
3292
|
+
}
|
|
3293
|
+
},
|
|
3294
|
+
translate("pages.login.buttons.rememberMe", "Remember me")
|
|
3295
|
+
)),
|
|
3296
|
+
forgotPasswordLink ?? /* @__PURE__ */ React41.createElement(
|
|
3297
|
+
Link,
|
|
3298
|
+
{
|
|
3299
|
+
style: {
|
|
3300
|
+
color: token.colorPrimaryTextHover,
|
|
3301
|
+
fontSize: "12px",
|
|
3302
|
+
marginLeft: "auto"
|
|
3303
|
+
},
|
|
3304
|
+
to: "/forgot-password"
|
|
3305
|
+
},
|
|
3306
|
+
translate(
|
|
3307
|
+
"pages.login.buttons.forgotPassword",
|
|
3308
|
+
"Forgot password?"
|
|
3309
|
+
)
|
|
3310
|
+
)
|
|
3311
|
+
),
|
|
3312
|
+
!hideForm && /* @__PURE__ */ React41.createElement(Form4.Item, null, /* @__PURE__ */ React41.createElement(
|
|
3313
|
+
Button15,
|
|
3314
|
+
{
|
|
3315
|
+
type: "primary",
|
|
3316
|
+
size: "large",
|
|
3317
|
+
htmlType: "submit",
|
|
3318
|
+
loading: isPending,
|
|
3319
|
+
block: true
|
|
3320
|
+
},
|
|
3321
|
+
translate("pages.login.signin", "Sign in")
|
|
3322
|
+
))
|
|
3323
|
+
),
|
|
3324
|
+
registerLink ?? /* @__PURE__ */ React41.createElement(
|
|
3325
|
+
"div",
|
|
3326
|
+
{
|
|
3327
|
+
style: {
|
|
3328
|
+
marginTop: hideForm ? 16 : 8
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
/* @__PURE__ */ React41.createElement(Typography9.Text, { style: { fontSize: 12 } }, translate(
|
|
3332
|
+
"pages.login.buttons.noAccount",
|
|
3333
|
+
"Don\u2019t have an account?"
|
|
3334
|
+
), " ", /* @__PURE__ */ React41.createElement(
|
|
3335
|
+
Link,
|
|
3336
|
+
{
|
|
3337
|
+
to: "/register",
|
|
3338
|
+
style: {
|
|
3339
|
+
fontWeight: "bold",
|
|
3340
|
+
color: token.colorPrimaryTextHover
|
|
3341
|
+
}
|
|
3342
|
+
},
|
|
3343
|
+
translate("pages.login.signup", "Sign up")
|
|
3344
|
+
))
|
|
3345
|
+
)
|
|
3346
|
+
);
|
|
3347
|
+
return /* @__PURE__ */ React41.createElement(Layout2, { style: layoutStyles, ...wrapperProps ?? {} }, /* @__PURE__ */ React41.createElement(
|
|
3348
|
+
Row,
|
|
3349
|
+
{
|
|
3350
|
+
justify: "center",
|
|
3351
|
+
align: hideForm ? "top" : "middle",
|
|
3352
|
+
style: {
|
|
3353
|
+
padding: "16px 0",
|
|
3354
|
+
minHeight: "100dvh",
|
|
3355
|
+
paddingTop: hideForm ? "15dvh" : "16px"
|
|
3356
|
+
}
|
|
3357
|
+
},
|
|
3358
|
+
/* @__PURE__ */ React41.createElement(Col, { xs: 22 }, renderContent ? renderContent(CardContent, PageTitle) : /* @__PURE__ */ React41.createElement(React41.Fragment, null, PageTitle, CardContent))
|
|
3359
|
+
));
|
|
3360
|
+
}, "LoginPage");
|
|
3361
|
+
|
|
3362
|
+
// src/components/pages/auth/components/register/index.tsx
|
|
3363
|
+
import React42 from "react";
|
|
3364
|
+
import {
|
|
3365
|
+
useLink as useLink5
|
|
3366
|
+
} from "@refinedev/core";
|
|
3367
|
+
import {
|
|
3368
|
+
Row as Row2,
|
|
3369
|
+
Col as Col2,
|
|
3370
|
+
Layout as Layout3,
|
|
3371
|
+
Card as Card5,
|
|
3372
|
+
Typography as Typography10,
|
|
3373
|
+
Form as Form5,
|
|
3374
|
+
Input as Input2,
|
|
3375
|
+
Button as Button16,
|
|
3376
|
+
Divider as Divider2,
|
|
3377
|
+
theme as theme5
|
|
3378
|
+
} from "antd";
|
|
3379
|
+
import { useTranslate as useTranslate13, useRegister } from "@refinedev/core";
|
|
3380
|
+
var RegisterPage = /* @__PURE__ */ __name(({
|
|
3381
|
+
providers,
|
|
3382
|
+
loginLink,
|
|
3383
|
+
wrapperProps,
|
|
3384
|
+
contentProps,
|
|
3385
|
+
renderContent,
|
|
3386
|
+
formProps,
|
|
3387
|
+
title,
|
|
3388
|
+
hideForm,
|
|
3389
|
+
mutationVariables
|
|
3390
|
+
}) => {
|
|
3391
|
+
const { token } = theme5.useToken();
|
|
3392
|
+
const [form] = Form5.useForm();
|
|
3393
|
+
const translate = useTranslate13();
|
|
3394
|
+
const Link = useLink5();
|
|
3395
|
+
const { mutate: register, isPending } = useRegister();
|
|
3396
|
+
const PageTitle = title === false ? null : /* @__PURE__ */ React42.createElement(
|
|
3397
|
+
"div",
|
|
3398
|
+
{
|
|
3399
|
+
style: {
|
|
3400
|
+
display: "flex",
|
|
3401
|
+
justifyContent: "center",
|
|
3402
|
+
marginBottom: "32px",
|
|
3403
|
+
fontSize: "20px"
|
|
3404
|
+
}
|
|
3405
|
+
},
|
|
3406
|
+
title ?? /* @__PURE__ */ React42.createElement(ThemedTitle, { collapsed: false })
|
|
3407
|
+
);
|
|
3408
|
+
const CardTitle = /* @__PURE__ */ React42.createElement(
|
|
3409
|
+
Typography10.Title,
|
|
3410
|
+
{
|
|
3411
|
+
level: 3,
|
|
3412
|
+
style: {
|
|
3413
|
+
color: token.colorPrimaryTextHover,
|
|
3414
|
+
...titleStyles
|
|
3415
|
+
}
|
|
3416
|
+
},
|
|
3417
|
+
translate("pages.register.title", "Sign up for your account")
|
|
3418
|
+
);
|
|
3419
|
+
const renderProviders = /* @__PURE__ */ __name(() => {
|
|
3420
|
+
if (providers && providers.length > 0) {
|
|
3421
|
+
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, providers.map((provider) => {
|
|
3422
|
+
return /* @__PURE__ */ React42.createElement(
|
|
3423
|
+
Button16,
|
|
3424
|
+
{
|
|
3425
|
+
key: provider.name,
|
|
3426
|
+
type: "default",
|
|
3427
|
+
block: true,
|
|
3428
|
+
icon: provider.icon,
|
|
3429
|
+
style: {
|
|
3430
|
+
display: "flex",
|
|
3431
|
+
justifyContent: "center",
|
|
3432
|
+
alignItems: "center",
|
|
3433
|
+
width: "100%",
|
|
3434
|
+
marginBottom: "8px"
|
|
3435
|
+
},
|
|
3436
|
+
onClick: () => register({
|
|
3437
|
+
...mutationVariables,
|
|
3438
|
+
providerName: provider.name
|
|
3439
|
+
})
|
|
3440
|
+
},
|
|
3441
|
+
provider.label
|
|
3442
|
+
);
|
|
3443
|
+
}), !hideForm && /* @__PURE__ */ React42.createElement(Divider2, null, /* @__PURE__ */ React42.createElement(
|
|
3444
|
+
Typography10.Text,
|
|
3445
|
+
{
|
|
3446
|
+
style: {
|
|
3447
|
+
color: token.colorTextLabel
|
|
3448
|
+
}
|
|
3449
|
+
},
|
|
3450
|
+
translate(
|
|
3451
|
+
"pages.register.divider",
|
|
3452
|
+
translate("pages.login.divider", "or")
|
|
3453
|
+
)
|
|
3454
|
+
)));
|
|
3455
|
+
}
|
|
3456
|
+
return null;
|
|
3457
|
+
}, "renderProviders");
|
|
3458
|
+
const CardContent = /* @__PURE__ */ React42.createElement(
|
|
3459
|
+
Card5,
|
|
3460
|
+
{
|
|
3461
|
+
title: CardTitle,
|
|
3462
|
+
styles: {
|
|
3463
|
+
header: headStyles,
|
|
3464
|
+
body: bodyStyles
|
|
3465
|
+
},
|
|
3466
|
+
style: {
|
|
3467
|
+
...containerStyles,
|
|
3468
|
+
backgroundColor: token.colorBgElevated
|
|
3469
|
+
},
|
|
3470
|
+
...contentProps ?? {}
|
|
3471
|
+
},
|
|
3472
|
+
renderProviders(),
|
|
3473
|
+
!hideForm && /* @__PURE__ */ React42.createElement(
|
|
3474
|
+
Form5,
|
|
3475
|
+
{
|
|
3476
|
+
layout: "vertical",
|
|
3477
|
+
form,
|
|
3478
|
+
onFinish: (values) => register({ ...mutationVariables, ...values }),
|
|
3479
|
+
requiredMark: false,
|
|
3480
|
+
...formProps
|
|
3481
|
+
},
|
|
3482
|
+
/* @__PURE__ */ React42.createElement(
|
|
3483
|
+
Form5.Item,
|
|
3484
|
+
{
|
|
3485
|
+
name: "email",
|
|
3486
|
+
label: translate("pages.register.email", "Email"),
|
|
3487
|
+
rules: [
|
|
3488
|
+
{
|
|
3489
|
+
required: true,
|
|
3490
|
+
message: translate(
|
|
3491
|
+
"pages.register.errors.requiredEmail",
|
|
3492
|
+
"Email is required"
|
|
3493
|
+
)
|
|
3494
|
+
},
|
|
3495
|
+
{
|
|
3496
|
+
type: "email",
|
|
3497
|
+
message: translate(
|
|
3498
|
+
"pages.register.errors.validEmail",
|
|
3499
|
+
"Invalid email address"
|
|
3500
|
+
)
|
|
3501
|
+
}
|
|
3502
|
+
]
|
|
3503
|
+
},
|
|
3504
|
+
/* @__PURE__ */ React42.createElement(
|
|
3505
|
+
Input2,
|
|
3506
|
+
{
|
|
3507
|
+
size: "large",
|
|
3508
|
+
placeholder: translate("pages.register.fields.email", "Email")
|
|
3509
|
+
}
|
|
3510
|
+
)
|
|
3511
|
+
),
|
|
3512
|
+
/* @__PURE__ */ React42.createElement(
|
|
3513
|
+
Form5.Item,
|
|
3514
|
+
{
|
|
3515
|
+
name: "password",
|
|
3516
|
+
label: translate("pages.register.fields.password", "Password"),
|
|
3517
|
+
rules: [
|
|
3518
|
+
{
|
|
3519
|
+
required: true,
|
|
3520
|
+
message: translate(
|
|
3521
|
+
"pages.register.errors.requiredPassword",
|
|
3522
|
+
"Password is required"
|
|
3523
|
+
)
|
|
3524
|
+
}
|
|
3525
|
+
]
|
|
3526
|
+
},
|
|
3527
|
+
/* @__PURE__ */ React42.createElement(Input2, { type: "password", placeholder: "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF", size: "large" })
|
|
3528
|
+
),
|
|
3529
|
+
/* @__PURE__ */ React42.createElement(
|
|
3530
|
+
"div",
|
|
3531
|
+
{
|
|
3532
|
+
style: {
|
|
3533
|
+
display: "flex",
|
|
3534
|
+
justifyContent: "space-between",
|
|
3535
|
+
marginBottom: "24px"
|
|
3536
|
+
}
|
|
3537
|
+
},
|
|
3538
|
+
loginLink ?? /* @__PURE__ */ React42.createElement(
|
|
3539
|
+
Typography10.Text,
|
|
3540
|
+
{
|
|
3541
|
+
style: {
|
|
3542
|
+
fontSize: 12,
|
|
3543
|
+
marginLeft: "auto"
|
|
3544
|
+
}
|
|
3545
|
+
},
|
|
3546
|
+
translate(
|
|
3547
|
+
"pages.register.buttons.haveAccount",
|
|
3548
|
+
translate(
|
|
3549
|
+
"pages.login.buttons.haveAccount",
|
|
3550
|
+
"Have an account?"
|
|
3551
|
+
)
|
|
3552
|
+
),
|
|
3553
|
+
" ",
|
|
3554
|
+
/* @__PURE__ */ React42.createElement(
|
|
3555
|
+
Link,
|
|
3556
|
+
{
|
|
3557
|
+
style: {
|
|
3558
|
+
fontWeight: "bold",
|
|
3559
|
+
color: token.colorPrimaryTextHover
|
|
3560
|
+
},
|
|
3561
|
+
to: "/login"
|
|
3562
|
+
},
|
|
3563
|
+
translate(
|
|
3564
|
+
"pages.register.signin",
|
|
3565
|
+
translate("pages.login.signin", "Sign in")
|
|
3566
|
+
)
|
|
3567
|
+
)
|
|
3568
|
+
)
|
|
3569
|
+
),
|
|
3570
|
+
/* @__PURE__ */ React42.createElement(
|
|
3571
|
+
Form5.Item,
|
|
3572
|
+
{
|
|
3573
|
+
style: {
|
|
3574
|
+
marginBottom: 0
|
|
3575
|
+
}
|
|
3576
|
+
},
|
|
3577
|
+
/* @__PURE__ */ React42.createElement(
|
|
3578
|
+
Button16,
|
|
3579
|
+
{
|
|
3580
|
+
type: "primary",
|
|
3581
|
+
size: "large",
|
|
3582
|
+
htmlType: "submit",
|
|
3583
|
+
loading: isPending,
|
|
3584
|
+
block: true
|
|
3585
|
+
},
|
|
3586
|
+
translate("pages.register.buttons.submit", "Sign up")
|
|
3587
|
+
)
|
|
3588
|
+
)
|
|
3589
|
+
),
|
|
3590
|
+
hideForm && loginLink !== false && /* @__PURE__ */ React42.createElement(
|
|
3591
|
+
"div",
|
|
3592
|
+
{
|
|
3593
|
+
style: {
|
|
3594
|
+
marginTop: hideForm ? 16 : 8
|
|
3595
|
+
}
|
|
3596
|
+
},
|
|
3597
|
+
/* @__PURE__ */ React42.createElement(
|
|
3598
|
+
Typography10.Text,
|
|
3599
|
+
{
|
|
3600
|
+
style: {
|
|
3601
|
+
fontSize: 12
|
|
3602
|
+
}
|
|
3603
|
+
},
|
|
3604
|
+
translate(
|
|
3605
|
+
"pages.register.buttons.haveAccount",
|
|
3606
|
+
translate("pages.login.buttons.haveAccount", "Have an account?")
|
|
3607
|
+
),
|
|
3608
|
+
" ",
|
|
3609
|
+
/* @__PURE__ */ React42.createElement(
|
|
3610
|
+
Link,
|
|
3611
|
+
{
|
|
3612
|
+
style: {
|
|
3613
|
+
fontWeight: "bold",
|
|
3614
|
+
color: token.colorPrimaryTextHover
|
|
3615
|
+
},
|
|
3616
|
+
to: "/login"
|
|
3617
|
+
},
|
|
3618
|
+
translate(
|
|
3619
|
+
"pages.register.signin",
|
|
3620
|
+
translate("pages.login.signin", "Sign in")
|
|
3621
|
+
)
|
|
3622
|
+
)
|
|
3623
|
+
)
|
|
3624
|
+
)
|
|
3625
|
+
);
|
|
3626
|
+
return /* @__PURE__ */ React42.createElement(Layout3, { style: layoutStyles, ...wrapperProps ?? {} }, /* @__PURE__ */ React42.createElement(
|
|
3627
|
+
Row2,
|
|
3628
|
+
{
|
|
3629
|
+
justify: "center",
|
|
3630
|
+
align: hideForm ? "top" : "middle",
|
|
3631
|
+
style: {
|
|
3632
|
+
padding: "16px 0",
|
|
3633
|
+
minHeight: "100dvh",
|
|
3634
|
+
paddingTop: hideForm ? "15dvh" : "16px"
|
|
3635
|
+
}
|
|
3636
|
+
},
|
|
3637
|
+
/* @__PURE__ */ React42.createElement(Col2, { xs: 22 }, renderContent ? renderContent(CardContent, PageTitle) : /* @__PURE__ */ React42.createElement(React42.Fragment, null, PageTitle, CardContent))
|
|
3638
|
+
));
|
|
3639
|
+
}, "RegisterPage");
|
|
3640
|
+
|
|
3641
|
+
// src/components/pages/auth/components/forgotPassword/index.tsx
|
|
3642
|
+
import React43 from "react";
|
|
3643
|
+
import {
|
|
3644
|
+
useLink as useLink6
|
|
3645
|
+
} from "@refinedev/core";
|
|
3646
|
+
import {
|
|
3647
|
+
Row as Row3,
|
|
3648
|
+
Col as Col3,
|
|
3649
|
+
Layout as Layout4,
|
|
3650
|
+
Card as Card6,
|
|
3651
|
+
Typography as Typography11,
|
|
3652
|
+
Form as Form6,
|
|
3653
|
+
Input as Input3,
|
|
3654
|
+
Button as Button17,
|
|
3655
|
+
theme as theme6
|
|
3656
|
+
} from "antd";
|
|
3657
|
+
import { useTranslate as useTranslate14, useForgotPassword } from "@refinedev/core";
|
|
3658
|
+
var ForgotPasswordPage = /* @__PURE__ */ __name(({
|
|
3659
|
+
loginLink,
|
|
3660
|
+
wrapperProps,
|
|
3661
|
+
contentProps,
|
|
3662
|
+
renderContent,
|
|
3663
|
+
formProps,
|
|
3664
|
+
title,
|
|
3665
|
+
mutationVariables
|
|
3666
|
+
}) => {
|
|
3667
|
+
const { token } = theme6.useToken();
|
|
3668
|
+
const [form] = Form6.useForm();
|
|
3669
|
+
const translate = useTranslate14();
|
|
3670
|
+
const Link = useLink6();
|
|
3671
|
+
const { mutate: forgotPassword, isPending } = useForgotPassword();
|
|
3672
|
+
const PageTitle = title === false ? null : /* @__PURE__ */ React43.createElement(
|
|
3673
|
+
"div",
|
|
3674
|
+
{
|
|
3675
|
+
style: {
|
|
3676
|
+
display: "flex",
|
|
3677
|
+
justifyContent: "center",
|
|
3678
|
+
marginBottom: "32px",
|
|
3679
|
+
fontSize: "20px"
|
|
3680
|
+
}
|
|
3681
|
+
},
|
|
3682
|
+
title ?? /* @__PURE__ */ React43.createElement(ThemedTitle, { collapsed: false })
|
|
3683
|
+
);
|
|
3684
|
+
const CardTitle = /* @__PURE__ */ React43.createElement(
|
|
3685
|
+
Typography11.Title,
|
|
3686
|
+
{
|
|
3687
|
+
level: 3,
|
|
3688
|
+
style: {
|
|
3689
|
+
color: token.colorPrimaryTextHover,
|
|
3690
|
+
...titleStyles
|
|
3691
|
+
}
|
|
3692
|
+
},
|
|
3693
|
+
translate("pages.forgotPassword.title", "Forgot your password?")
|
|
3694
|
+
);
|
|
3695
|
+
const CardContent = /* @__PURE__ */ React43.createElement(
|
|
3696
|
+
Card6,
|
|
3697
|
+
{
|
|
3698
|
+
title: CardTitle,
|
|
3699
|
+
styles: {
|
|
3700
|
+
header: headStyles,
|
|
3701
|
+
body: bodyStyles
|
|
3702
|
+
},
|
|
3703
|
+
style: {
|
|
3704
|
+
...containerStyles,
|
|
3705
|
+
backgroundColor: token.colorBgElevated
|
|
3706
|
+
},
|
|
3707
|
+
...contentProps ?? {}
|
|
3708
|
+
},
|
|
3709
|
+
/* @__PURE__ */ React43.createElement(
|
|
3710
|
+
Form6,
|
|
3711
|
+
{
|
|
3712
|
+
layout: "vertical",
|
|
3713
|
+
form,
|
|
3714
|
+
onFinish: (values) => forgotPassword({ ...values, ...mutationVariables }),
|
|
3715
|
+
requiredMark: false,
|
|
3716
|
+
...formProps
|
|
3717
|
+
},
|
|
3718
|
+
/* @__PURE__ */ React43.createElement(
|
|
3719
|
+
Form6.Item,
|
|
3720
|
+
{
|
|
3721
|
+
name: "email",
|
|
3722
|
+
label: translate("pages.forgotPassword.fields.email", "Email"),
|
|
3723
|
+
rules: [
|
|
3724
|
+
{
|
|
3725
|
+
required: true,
|
|
3726
|
+
message: translate(
|
|
3727
|
+
"pages.forgotPassword.errors.requiredEmail",
|
|
3728
|
+
"Email is required"
|
|
3729
|
+
)
|
|
3730
|
+
},
|
|
3731
|
+
{
|
|
3732
|
+
type: "email",
|
|
3733
|
+
message: translate(
|
|
3734
|
+
"pages.forgotPassword.errors.validEmail",
|
|
3735
|
+
"Invalid email address"
|
|
3736
|
+
)
|
|
3737
|
+
}
|
|
3738
|
+
]
|
|
3739
|
+
},
|
|
3740
|
+
/* @__PURE__ */ React43.createElement(
|
|
3741
|
+
Input3,
|
|
3742
|
+
{
|
|
3743
|
+
type: "email",
|
|
3744
|
+
size: "large",
|
|
3745
|
+
placeholder: translate(
|
|
3746
|
+
"pages.forgotPassword.fields.email",
|
|
3747
|
+
"Email"
|
|
3748
|
+
)
|
|
3749
|
+
}
|
|
3750
|
+
)
|
|
3751
|
+
),
|
|
3752
|
+
/* @__PURE__ */ React43.createElement(
|
|
3753
|
+
"div",
|
|
3754
|
+
{
|
|
3755
|
+
style: {
|
|
3756
|
+
display: "flex",
|
|
3757
|
+
justifyContent: "space-between"
|
|
3758
|
+
}
|
|
3759
|
+
},
|
|
3760
|
+
loginLink ?? /* @__PURE__ */ React43.createElement(
|
|
3761
|
+
Typography11.Text,
|
|
3762
|
+
{
|
|
3763
|
+
style: {
|
|
3764
|
+
fontSize: 12,
|
|
3765
|
+
marginLeft: "auto"
|
|
3766
|
+
}
|
|
3767
|
+
},
|
|
3768
|
+
translate(
|
|
3769
|
+
"pages.forgotPassword.buttons.haveAccount",
|
|
3770
|
+
translate(
|
|
3771
|
+
"pages.register.buttons.haveAccount",
|
|
3772
|
+
"Have an account? "
|
|
3773
|
+
)
|
|
3774
|
+
),
|
|
3775
|
+
" ",
|
|
3776
|
+
/* @__PURE__ */ React43.createElement(
|
|
3777
|
+
Link,
|
|
3778
|
+
{
|
|
3779
|
+
style: {
|
|
3780
|
+
fontWeight: "bold",
|
|
3781
|
+
color: token.colorPrimaryTextHover
|
|
3782
|
+
},
|
|
3783
|
+
to: "/login"
|
|
3784
|
+
},
|
|
3785
|
+
translate(
|
|
3786
|
+
"pages.forgotPassword.signin",
|
|
3787
|
+
translate("pages.login.signin", "Sign in")
|
|
3788
|
+
)
|
|
3789
|
+
)
|
|
3790
|
+
)
|
|
3791
|
+
),
|
|
3792
|
+
/* @__PURE__ */ React43.createElement(
|
|
3793
|
+
Form6.Item,
|
|
3794
|
+
{
|
|
3795
|
+
style: {
|
|
3796
|
+
marginTop: "24px",
|
|
3797
|
+
marginBottom: 0
|
|
3798
|
+
}
|
|
3799
|
+
},
|
|
3800
|
+
/* @__PURE__ */ React43.createElement(
|
|
3801
|
+
Button17,
|
|
3802
|
+
{
|
|
3803
|
+
type: "primary",
|
|
3804
|
+
size: "large",
|
|
3805
|
+
htmlType: "submit",
|
|
3806
|
+
loading: isPending,
|
|
3807
|
+
block: true
|
|
3808
|
+
},
|
|
3809
|
+
translate(
|
|
3810
|
+
"pages.forgotPassword.buttons.submit",
|
|
3811
|
+
"Send reset instructions"
|
|
3812
|
+
)
|
|
3813
|
+
)
|
|
3814
|
+
)
|
|
3815
|
+
)
|
|
3816
|
+
);
|
|
3817
|
+
return /* @__PURE__ */ React43.createElement(Layout4, { style: layoutStyles, ...wrapperProps ?? {} }, /* @__PURE__ */ React43.createElement(
|
|
3818
|
+
Row3,
|
|
3819
|
+
{
|
|
3820
|
+
justify: "center",
|
|
3821
|
+
align: "middle",
|
|
3822
|
+
style: {
|
|
3823
|
+
padding: "16px 0",
|
|
3824
|
+
minHeight: "100dvh"
|
|
3825
|
+
}
|
|
3826
|
+
},
|
|
3827
|
+
/* @__PURE__ */ React43.createElement(Col3, { xs: 22 }, renderContent ? renderContent(CardContent, PageTitle) : /* @__PURE__ */ React43.createElement(React43.Fragment, null, PageTitle, CardContent))
|
|
3828
|
+
));
|
|
3829
|
+
}, "ForgotPasswordPage");
|
|
3830
|
+
|
|
3831
|
+
// src/components/pages/auth/components/updatePassword/index.tsx
|
|
3832
|
+
import React44 from "react";
|
|
3833
|
+
import {
|
|
3834
|
+
Row as Row4,
|
|
3835
|
+
Col as Col4,
|
|
3836
|
+
Layout as Layout5,
|
|
3837
|
+
Card as Card7,
|
|
3838
|
+
Typography as Typography12,
|
|
3839
|
+
Form as Form7,
|
|
3840
|
+
Input as Input4,
|
|
3841
|
+
Button as Button18,
|
|
3842
|
+
theme as theme7
|
|
3843
|
+
} from "antd";
|
|
3844
|
+
import { useTranslate as useTranslate15, useUpdatePassword } from "@refinedev/core";
|
|
3845
|
+
var UpdatePasswordPage = /* @__PURE__ */ __name(({
|
|
3846
|
+
wrapperProps,
|
|
3847
|
+
contentProps,
|
|
3848
|
+
renderContent,
|
|
3849
|
+
formProps,
|
|
3850
|
+
title,
|
|
3851
|
+
mutationVariables
|
|
3852
|
+
}) => {
|
|
3853
|
+
const { token } = theme7.useToken();
|
|
3854
|
+
const [form] = Form7.useForm();
|
|
3855
|
+
const translate = useTranslate15();
|
|
3856
|
+
const { mutate: updatePassword, isPending } = useUpdatePassword();
|
|
3857
|
+
const PageTitle = title === false ? null : /* @__PURE__ */ React44.createElement(
|
|
3858
|
+
"div",
|
|
3859
|
+
{
|
|
3860
|
+
style: {
|
|
3861
|
+
display: "flex",
|
|
3862
|
+
justifyContent: "center",
|
|
3863
|
+
marginBottom: "32px",
|
|
3864
|
+
fontSize: "20px"
|
|
3865
|
+
}
|
|
3866
|
+
},
|
|
3867
|
+
title ?? /* @__PURE__ */ React44.createElement(ThemedTitle, { collapsed: false })
|
|
3868
|
+
);
|
|
3869
|
+
const CardTitle = /* @__PURE__ */ React44.createElement(
|
|
3870
|
+
Typography12.Title,
|
|
3871
|
+
{
|
|
3872
|
+
level: 3,
|
|
3873
|
+
style: {
|
|
3874
|
+
color: token.colorPrimaryTextHover,
|
|
3875
|
+
...titleStyles
|
|
3876
|
+
}
|
|
3877
|
+
},
|
|
3878
|
+
translate("pages.updatePassword.title", "Set New Password")
|
|
3879
|
+
);
|
|
3880
|
+
const CardContent = /* @__PURE__ */ React44.createElement(
|
|
3881
|
+
Card7,
|
|
3882
|
+
{
|
|
3883
|
+
title: CardTitle,
|
|
3884
|
+
styles: {
|
|
3885
|
+
header: headStyles,
|
|
3886
|
+
body: bodyStyles
|
|
3887
|
+
},
|
|
3888
|
+
style: {
|
|
3889
|
+
...containerStyles,
|
|
3890
|
+
backgroundColor: token.colorBgElevated
|
|
3891
|
+
},
|
|
3892
|
+
...contentProps ?? {}
|
|
3893
|
+
},
|
|
3894
|
+
/* @__PURE__ */ React44.createElement(
|
|
3895
|
+
Form7,
|
|
3896
|
+
{
|
|
3897
|
+
layout: "vertical",
|
|
3898
|
+
form,
|
|
3899
|
+
onFinish: (values) => updatePassword({ ...values, ...mutationVariables }),
|
|
3900
|
+
requiredMark: false,
|
|
3901
|
+
...formProps
|
|
3902
|
+
},
|
|
3903
|
+
/* @__PURE__ */ React44.createElement(
|
|
3904
|
+
Form7.Item,
|
|
3905
|
+
{
|
|
3906
|
+
name: "password",
|
|
3907
|
+
label: translate(
|
|
3908
|
+
"pages.updatePassword.fields.password",
|
|
3909
|
+
"New Password"
|
|
3910
|
+
),
|
|
3911
|
+
rules: [
|
|
3912
|
+
{
|
|
3913
|
+
required: true,
|
|
3914
|
+
message: translate(
|
|
3915
|
+
"pages.updatePassword.errors.requiredPassword",
|
|
3916
|
+
"Password is required"
|
|
3917
|
+
)
|
|
3918
|
+
}
|
|
3919
|
+
],
|
|
3920
|
+
style: { marginBottom: "12px" }
|
|
3921
|
+
},
|
|
3922
|
+
/* @__PURE__ */ React44.createElement(Input4, { type: "password", placeholder: "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF", size: "large" })
|
|
3923
|
+
),
|
|
3924
|
+
/* @__PURE__ */ React44.createElement(
|
|
3925
|
+
Form7.Item,
|
|
3926
|
+
{
|
|
3927
|
+
name: "confirmPassword",
|
|
3928
|
+
label: translate(
|
|
3929
|
+
"pages.updatePassword.fields.confirmPassword",
|
|
3930
|
+
"Confirm New Password"
|
|
3931
|
+
),
|
|
3932
|
+
hasFeedback: true,
|
|
3933
|
+
dependencies: ["password"],
|
|
3934
|
+
rules: [
|
|
3935
|
+
{
|
|
3936
|
+
required: true,
|
|
3937
|
+
message: translate(
|
|
3938
|
+
"pages.updatePassword.errors.requiredConfirmPassword",
|
|
3939
|
+
"Confirm password is required"
|
|
3940
|
+
)
|
|
3941
|
+
},
|
|
3942
|
+
({ getFieldValue }) => ({
|
|
3943
|
+
validator(_, value) {
|
|
3944
|
+
if (!value || getFieldValue("password") === value) {
|
|
3945
|
+
return Promise.resolve();
|
|
3946
|
+
}
|
|
3947
|
+
return Promise.reject(
|
|
3948
|
+
new Error(
|
|
3949
|
+
translate(
|
|
3950
|
+
"pages.updatePassword.errors.confirmPasswordNotMatch",
|
|
3951
|
+
"Passwords do not match"
|
|
3952
|
+
)
|
|
3953
|
+
)
|
|
3954
|
+
);
|
|
3955
|
+
}
|
|
3956
|
+
})
|
|
3957
|
+
]
|
|
3958
|
+
},
|
|
3959
|
+
/* @__PURE__ */ React44.createElement(Input4, { type: "password", placeholder: "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF", size: "large" })
|
|
3960
|
+
),
|
|
3961
|
+
/* @__PURE__ */ React44.createElement(
|
|
3962
|
+
Form7.Item,
|
|
3963
|
+
{
|
|
3964
|
+
style: {
|
|
3965
|
+
marginBottom: 0
|
|
3966
|
+
}
|
|
3967
|
+
},
|
|
3968
|
+
/* @__PURE__ */ React44.createElement(
|
|
3969
|
+
Button18,
|
|
3970
|
+
{
|
|
3971
|
+
type: "primary",
|
|
3972
|
+
size: "large",
|
|
3973
|
+
htmlType: "submit",
|
|
3974
|
+
loading: isPending,
|
|
3975
|
+
block: true
|
|
3976
|
+
},
|
|
3977
|
+
translate("pages.updatePassword.buttons.submit", "Update")
|
|
3978
|
+
)
|
|
3979
|
+
)
|
|
3980
|
+
)
|
|
3981
|
+
);
|
|
3982
|
+
return /* @__PURE__ */ React44.createElement(Layout5, { style: layoutStyles, ...wrapperProps ?? {} }, /* @__PURE__ */ React44.createElement(
|
|
3983
|
+
Row4,
|
|
3984
|
+
{
|
|
3985
|
+
justify: "center",
|
|
3986
|
+
align: "middle",
|
|
3987
|
+
style: {
|
|
3988
|
+
padding: "16px 0",
|
|
3989
|
+
minHeight: "100dvh"
|
|
3990
|
+
}
|
|
3991
|
+
},
|
|
3992
|
+
/* @__PURE__ */ React44.createElement(Col4, { xs: 22 }, renderContent ? renderContent(CardContent, PageTitle) : /* @__PURE__ */ React44.createElement(React44.Fragment, null, PageTitle, CardContent))
|
|
3993
|
+
));
|
|
3994
|
+
}, "UpdatePasswordPage");
|
|
3995
|
+
|
|
3996
|
+
// src/components/pages/auth/index.tsx
|
|
3997
|
+
var AuthPage = /* @__PURE__ */ __name((props) => {
|
|
3998
|
+
const { type } = props;
|
|
3999
|
+
const renderView = /* @__PURE__ */ __name(() => {
|
|
4000
|
+
switch (type) {
|
|
4001
|
+
case "register":
|
|
4002
|
+
return /* @__PURE__ */ React45.createElement(RegisterPage, { ...props });
|
|
4003
|
+
case "forgotPassword":
|
|
4004
|
+
return /* @__PURE__ */ React45.createElement(ForgotPasswordPage, { ...props });
|
|
4005
|
+
case "updatePassword":
|
|
4006
|
+
return /* @__PURE__ */ React45.createElement(UpdatePasswordPage, { ...props });
|
|
4007
|
+
default:
|
|
4008
|
+
return /* @__PURE__ */ React45.createElement(LoginPage, { ...props });
|
|
4009
|
+
}
|
|
4010
|
+
}, "renderView");
|
|
4011
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, renderView());
|
|
4012
|
+
}, "AuthPage");
|
|
4013
|
+
|
|
4014
|
+
// src/components/breadcrumb/index.tsx
|
|
4015
|
+
import React46 from "react";
|
|
4016
|
+
import {
|
|
4017
|
+
useBreadcrumb,
|
|
4018
|
+
useLink as useLink7,
|
|
4019
|
+
useResourceParams as useResourceParams9,
|
|
4020
|
+
matchResourceFromRoute
|
|
4021
|
+
} from "@refinedev/core";
|
|
4022
|
+
import {
|
|
4023
|
+
Breadcrumb as AntdBreadcrumb
|
|
4024
|
+
} from "antd";
|
|
4025
|
+
import { HomeOutlined } from "@ant-design/icons";
|
|
4026
|
+
var Breadcrumb = /* @__PURE__ */ __name(({
|
|
4027
|
+
breadcrumbProps,
|
|
4028
|
+
showHome = true,
|
|
4029
|
+
hideIcons = false,
|
|
4030
|
+
meta,
|
|
4031
|
+
minItems = 2
|
|
4032
|
+
}) => {
|
|
4033
|
+
const { breadcrumbs } = useBreadcrumb({
|
|
4034
|
+
meta
|
|
4035
|
+
});
|
|
4036
|
+
const Link = useLink7();
|
|
4037
|
+
const { resources } = useResourceParams9();
|
|
4038
|
+
const rootRouteResource = matchResourceFromRoute("/", resources);
|
|
4039
|
+
if (breadcrumbs.length < minItems)
|
|
4040
|
+
return null;
|
|
4041
|
+
const breadCrumbItems = breadcrumbs.map(({ label, icon, href }) => ({
|
|
4042
|
+
key: `breadcrumb-item-${label}`,
|
|
4043
|
+
title: /* @__PURE__ */ React46.createElement(
|
|
4044
|
+
"div",
|
|
4045
|
+
{
|
|
4046
|
+
style: {
|
|
4047
|
+
display: "flex",
|
|
4048
|
+
alignItems: "center",
|
|
4049
|
+
justifyContent: "center",
|
|
4050
|
+
gap: 4
|
|
4051
|
+
}
|
|
4052
|
+
},
|
|
4053
|
+
!hideIcons && icon,
|
|
4054
|
+
href ? /* @__PURE__ */ React46.createElement(Link, { to: href }, label) : /* @__PURE__ */ React46.createElement("span", null, label)
|
|
4055
|
+
)
|
|
4056
|
+
}));
|
|
4057
|
+
const getBreadcrumbItems = /* @__PURE__ */ __name(() => {
|
|
4058
|
+
var _a, _b;
|
|
4059
|
+
if (showHome && rootRouteResource.found) {
|
|
4060
|
+
return [
|
|
4061
|
+
{
|
|
4062
|
+
key: "breadcrumb-item-home",
|
|
4063
|
+
title: /* @__PURE__ */ React46.createElement(Link, { to: "/" }, ((_b = (_a = rootRouteResource == null ? void 0 : rootRouteResource.resource) == null ? void 0 : _a.meta) == null ? void 0 : _b.icon) ?? /* @__PURE__ */ React46.createElement(HomeOutlined, null))
|
|
4064
|
+
},
|
|
4065
|
+
...breadCrumbItems
|
|
4066
|
+
];
|
|
4067
|
+
}
|
|
4068
|
+
return breadCrumbItems;
|
|
4069
|
+
}, "getBreadcrumbItems");
|
|
4070
|
+
return /* @__PURE__ */ React46.createElement(AntdBreadcrumb, { items: getBreadcrumbItems(), ...breadcrumbProps });
|
|
4071
|
+
}, "Breadcrumb");
|
|
4072
|
+
|
|
4073
|
+
// src/components/pageHeader/index.tsx
|
|
4074
|
+
import React47, { useContext as useContext3 } from "react";
|
|
4075
|
+
import {
|
|
4076
|
+
PageHeader as AntdPageHeader
|
|
4077
|
+
} from "@ant-design/pro-layout";
|
|
4078
|
+
import { Button as Button19, ConfigProvider as ConfigProvider2, Typography as Typography13 } from "antd";
|
|
4079
|
+
import { ArrowLeftOutlined, ArrowRightOutlined } from "@ant-design/icons";
|
|
4080
|
+
import { RefinePageHeaderClassNames } from "@refinedev/ui-types";
|
|
4081
|
+
var PageHeader = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
4082
|
+
var _a;
|
|
4083
|
+
const direction = (_a = useContext3(ConfigProvider2.ConfigContext)) == null ? void 0 : _a.direction;
|
|
4084
|
+
const renderBackButton = /* @__PURE__ */ __name(() => {
|
|
4085
|
+
const BackIcon = direction === "rtl" ? ArrowRightOutlined : ArrowLeftOutlined;
|
|
4086
|
+
return /* @__PURE__ */ React47.createElement(Button19, { type: "text", icon: /* @__PURE__ */ React47.createElement(BackIcon, null) });
|
|
4087
|
+
}, "renderBackButton");
|
|
4088
|
+
const backIcon = typeof props.backIcon === "undefined" ? renderBackButton() : props.backIcon;
|
|
4089
|
+
const title = typeof props.title === "string" ? /* @__PURE__ */ React47.createElement(
|
|
4090
|
+
Typography13.Title,
|
|
4091
|
+
{
|
|
4092
|
+
className: RefinePageHeaderClassNames.Title,
|
|
4093
|
+
level: 4,
|
|
4094
|
+
style: { marginBottom: 0 }
|
|
4095
|
+
},
|
|
4096
|
+
props.title
|
|
4097
|
+
) : props.title;
|
|
4098
|
+
const subtitle = typeof props.title === "string" ? /* @__PURE__ */ React47.createElement(
|
|
4099
|
+
Typography13.Title,
|
|
4100
|
+
{
|
|
4101
|
+
className: RefinePageHeaderClassNames.SubTitle,
|
|
4102
|
+
level: 5,
|
|
4103
|
+
type: "secondary",
|
|
4104
|
+
style: { marginBottom: 0 }
|
|
4105
|
+
},
|
|
4106
|
+
props.subTitle
|
|
4107
|
+
) : props.subTitle;
|
|
4108
|
+
return /* @__PURE__ */ React47.createElement(
|
|
4109
|
+
AntdPageHeader,
|
|
4110
|
+
{
|
|
4111
|
+
...props,
|
|
4112
|
+
backIcon,
|
|
4113
|
+
title,
|
|
4114
|
+
subTitle: subtitle,
|
|
4115
|
+
style: { padding: 0, ...props.style }
|
|
4116
|
+
},
|
|
4117
|
+
children
|
|
4118
|
+
);
|
|
4119
|
+
}, "PageHeader");
|
|
4120
|
+
|
|
4121
|
+
// src/components/autoSaveIndicator/index.tsx
|
|
4122
|
+
import React48 from "react";
|
|
4123
|
+
import {
|
|
4124
|
+
useTranslate as useTranslate16,
|
|
4125
|
+
AutoSaveIndicator as AutoSaveIndicatorCore
|
|
4126
|
+
} from "@refinedev/core";
|
|
4127
|
+
import { Typography as Typography14, theme as theme8 } from "antd";
|
|
4128
|
+
import {
|
|
4129
|
+
EllipsisOutlined,
|
|
4130
|
+
SyncOutlined,
|
|
4131
|
+
CheckCircleOutlined,
|
|
4132
|
+
ExclamationCircleOutlined
|
|
4133
|
+
} from "@ant-design/icons";
|
|
4134
|
+
var AutoSaveIndicator = /* @__PURE__ */ __name(({
|
|
4135
|
+
status,
|
|
4136
|
+
elements: {
|
|
4137
|
+
success = /* @__PURE__ */ React48.createElement(
|
|
4138
|
+
Message,
|
|
4139
|
+
{
|
|
4140
|
+
translationKey: "autoSave.success",
|
|
4141
|
+
defaultMessage: "saved",
|
|
4142
|
+
icon: /* @__PURE__ */ React48.createElement(CheckCircleOutlined, null)
|
|
4143
|
+
}
|
|
4144
|
+
),
|
|
4145
|
+
error = /* @__PURE__ */ React48.createElement(
|
|
4146
|
+
Message,
|
|
4147
|
+
{
|
|
4148
|
+
translationKey: "autoSave.error",
|
|
4149
|
+
defaultMessage: "auto save failure",
|
|
4150
|
+
icon: /* @__PURE__ */ React48.createElement(ExclamationCircleOutlined, null)
|
|
4151
|
+
}
|
|
4152
|
+
),
|
|
4153
|
+
loading = /* @__PURE__ */ React48.createElement(
|
|
4154
|
+
Message,
|
|
4155
|
+
{
|
|
4156
|
+
translationKey: "autoSave.loading",
|
|
4157
|
+
defaultMessage: "saving...",
|
|
4158
|
+
icon: /* @__PURE__ */ React48.createElement(SyncOutlined, null)
|
|
4159
|
+
}
|
|
4160
|
+
),
|
|
4161
|
+
idle = /* @__PURE__ */ React48.createElement(
|
|
4162
|
+
Message,
|
|
4163
|
+
{
|
|
4164
|
+
translationKey: "autoSave.idle",
|
|
4165
|
+
defaultMessage: "waiting for changes",
|
|
4166
|
+
icon: /* @__PURE__ */ React48.createElement(EllipsisOutlined, null)
|
|
4167
|
+
}
|
|
4168
|
+
)
|
|
4169
|
+
} = {}
|
|
4170
|
+
}) => {
|
|
4171
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4172
|
+
AutoSaveIndicatorCore,
|
|
4173
|
+
{
|
|
4174
|
+
status,
|
|
4175
|
+
elements: {
|
|
4176
|
+
success,
|
|
4177
|
+
error,
|
|
4178
|
+
loading,
|
|
4179
|
+
idle
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
);
|
|
4183
|
+
}, "AutoSaveIndicator");
|
|
4184
|
+
var Message = /* @__PURE__ */ __name(({
|
|
4185
|
+
translationKey,
|
|
4186
|
+
defaultMessage,
|
|
4187
|
+
icon
|
|
4188
|
+
}) => {
|
|
4189
|
+
const translate = useTranslate16();
|
|
4190
|
+
const { token } = theme8.useToken();
|
|
4191
|
+
return /* @__PURE__ */ React48.createElement(
|
|
4192
|
+
Typography14.Text,
|
|
4193
|
+
{
|
|
4194
|
+
style: {
|
|
4195
|
+
marginRight: 5,
|
|
4196
|
+
color: token.colorTextTertiary,
|
|
4197
|
+
fontSize: ".8rem"
|
|
4198
|
+
}
|
|
4199
|
+
},
|
|
4200
|
+
translate(translationKey, defaultMessage),
|
|
4201
|
+
/* @__PURE__ */ React48.createElement("span", { style: { marginLeft: ".2rem" } }, icon)
|
|
4202
|
+
);
|
|
4203
|
+
}, "Message");
|
|
4204
|
+
|
|
4205
|
+
// src/definitions/filter-mappers/index.ts
|
|
4206
|
+
import dayjs3 from "dayjs";
|
|
4207
|
+
var rangePickerFilterMapper = /* @__PURE__ */ __name((selectedKeys, event) => {
|
|
4208
|
+
if (!selectedKeys) {
|
|
4209
|
+
return selectedKeys;
|
|
4210
|
+
}
|
|
4211
|
+
if (event === "value") {
|
|
4212
|
+
return selectedKeys.map((key) => {
|
|
4213
|
+
if (typeof key === "string") {
|
|
4214
|
+
return dayjs3(key);
|
|
4215
|
+
}
|
|
4216
|
+
return key;
|
|
4217
|
+
});
|
|
4218
|
+
}
|
|
4219
|
+
if (event === "onChange") {
|
|
4220
|
+
if (selectedKeys.every(dayjs3.isDayjs)) {
|
|
4221
|
+
return selectedKeys.map((date) => dayjs3(date).toISOString());
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
return selectedKeys;
|
|
4225
|
+
}, "rangePickerFilterMapper");
|
|
4226
|
+
|
|
4227
|
+
// src/definitions/upload/index.ts
|
|
4228
|
+
var getValueFromEvent = /* @__PURE__ */ __name((event) => {
|
|
4229
|
+
const { fileList } = event;
|
|
4230
|
+
return [...fileList];
|
|
4231
|
+
}, "getValueFromEvent");
|
|
4232
|
+
|
|
4233
|
+
// src/definitions/themes/index.ts
|
|
4234
|
+
var RefineThemes = {
|
|
4235
|
+
Blue: {
|
|
4236
|
+
token: {
|
|
4237
|
+
colorPrimary: "#1677FF"
|
|
4238
|
+
}
|
|
4239
|
+
},
|
|
4240
|
+
Purple: {
|
|
4241
|
+
token: {
|
|
4242
|
+
colorPrimary: "#722ED1"
|
|
4243
|
+
}
|
|
4244
|
+
},
|
|
4245
|
+
Magenta: {
|
|
4246
|
+
token: {
|
|
4247
|
+
colorPrimary: "#EB2F96"
|
|
4248
|
+
}
|
|
4249
|
+
},
|
|
4250
|
+
Red: {
|
|
4251
|
+
token: {
|
|
4252
|
+
colorPrimary: "#F5222D"
|
|
4253
|
+
}
|
|
4254
|
+
},
|
|
4255
|
+
Orange: {
|
|
4256
|
+
token: {
|
|
4257
|
+
colorPrimary: "#FA541C"
|
|
4258
|
+
}
|
|
4259
|
+
},
|
|
4260
|
+
Yellow: {
|
|
4261
|
+
token: {
|
|
4262
|
+
colorPrimary: "#FAAD14"
|
|
4263
|
+
}
|
|
4264
|
+
},
|
|
4265
|
+
Green: {
|
|
4266
|
+
token: {
|
|
4267
|
+
colorPrimary: "#52C41A"
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
};
|
|
4271
|
+
export {
|
|
4272
|
+
AuthPage,
|
|
4273
|
+
AutoSaveIndicator,
|
|
4274
|
+
BooleanField,
|
|
4275
|
+
Breadcrumb,
|
|
4276
|
+
CloneButton,
|
|
4277
|
+
Create,
|
|
4278
|
+
CreateButton,
|
|
4279
|
+
DateField,
|
|
4280
|
+
DeleteButton,
|
|
4281
|
+
Edit,
|
|
4282
|
+
EditButton,
|
|
4283
|
+
EmailField,
|
|
4284
|
+
ErrorComponent,
|
|
4285
|
+
ExportButton,
|
|
4286
|
+
FileField,
|
|
4287
|
+
FilterDropdown,
|
|
4288
|
+
ImageField,
|
|
4289
|
+
ImportButton,
|
|
4290
|
+
List,
|
|
4291
|
+
ListButton,
|
|
4292
|
+
MarkdownField,
|
|
4293
|
+
NumberField,
|
|
4294
|
+
PageHeader,
|
|
4295
|
+
RefineThemes,
|
|
4296
|
+
RefreshButton,
|
|
4297
|
+
SaveButton,
|
|
4298
|
+
Show,
|
|
4299
|
+
ShowButton,
|
|
4300
|
+
TagField,
|
|
4301
|
+
TextField,
|
|
4302
|
+
ThemedHeader,
|
|
4303
|
+
ThemedLayout,
|
|
4304
|
+
ThemedLayoutContext,
|
|
4305
|
+
ThemedLayoutContextProvider,
|
|
4306
|
+
ThemedSider,
|
|
4307
|
+
ThemedTitle,
|
|
4308
|
+
UrlField,
|
|
4309
|
+
WelcomePage,
|
|
4310
|
+
getDefaultFilter,
|
|
4311
|
+
getDefaultSortOrder,
|
|
4312
|
+
getValueFromEvent,
|
|
4313
|
+
mapAntdFilterToCrudFilter,
|
|
4314
|
+
mapAntdSorterToCrudSorting,
|
|
4315
|
+
rangePickerFilterMapper,
|
|
4316
|
+
useCheckboxGroup,
|
|
4317
|
+
useDrawer,
|
|
4318
|
+
useDrawerForm,
|
|
4319
|
+
useEditableTable,
|
|
4320
|
+
useFileUploadState,
|
|
4321
|
+
useForm,
|
|
4322
|
+
useImport,
|
|
4323
|
+
useModal,
|
|
4324
|
+
useModalForm,
|
|
4325
|
+
useNotificationProvider,
|
|
4326
|
+
useRadioGroup,
|
|
4327
|
+
useSelect,
|
|
4328
|
+
useSimpleList,
|
|
4329
|
+
useStepsForm,
|
|
4330
|
+
useTable,
|
|
4331
|
+
useThemedLayoutContext
|
|
4332
|
+
};
|
|
3
4333
|
//# sourceMappingURL=index.mjs.map
|