abrplus-ui-kit 1.0.8 → 1.0.9
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/dist/organisms.cjs.js +1 -1
- package/dist/organisms.es.js +48 -48
- package/dist/types/components/molecules/noResult/index.d.ts +1 -1
- package/dist/types/components/organisms/avatarGroup/index.d.ts +2 -2
- package/dist/types/components/organisms/table/components/cell/currencyCell.d.ts +1 -1
- package/dist/types/components/organisms/table/components/cell/dateCell.d.ts +1 -1
- package/dist/types/components/organisms/table/components/cell/status.d.ts +1 -1
- package/package.json +1 -1
package/dist/organisms.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./sortable.esm-CA8VbUF-.cjs"),G=require("./index-lDQ4dr86.cjs"),o=require("./index-B1HRk2-g.cjs"),l=require("./colors-BDQwGpaB.cjs"),E=require("antd"),C=require("tailwind-merge"),P=require("react-i18next"),y=require("./index-BJmt8SSx.cjs"),x=require("react"),ee=require("starkstring"),re=require("./deepMerge-2zqLIrFM.cjs"),$=require("react-router-dom");function te(r,t){const n=localStorage.getItem(r),s=n?JSON.parse(n):t,[a,i]=x.useState(s);return x.useEffect(()=>{localStorage.setItem(r,JSON.stringify(a))},[r,a]),[a,i]}const oe=640,ne=768,le=1024,se=1280;function ae(){const{width:r}=G.useWindowDimensions(),t=x.useCallback(c=>{if(!(typeof window>"u"))return r<=c},[r]),n=x.useCallback(c=>{if(!(typeof window>"u"))return r>c},[r]),s=x.useCallback(c=>{if(c[0]>=c[1])throw new Error(`The second query: ${c[1]}px must be greater than the first query: ${c[0]}px`);if(!(typeof window>"u"))return r>c[0]&&r<=c[1]},[r]),a=t(le),i=t(oe),d=t(ne),g=n(se);return{getIsWidthSmallerThan:t,getIsWidthLargerThan:n,getIsWidthBetween:s,isSmallerThanExtraLarge:g,isSmallerThanMedium:d,isSmallerThanSmall:i,isSmallerThenLarge:a}}const W="PAGINATION_SIZE";function ie({items:r=[],max:t=3,avatarProps:{size:n}={},onClickAvatar:s,hasAnimation:a=!0,nameExtractor:i,renderItem:d,itemLogoProps:g,containerProps:c,popoverProps:h}){if(r.length===0)return e.jsx(o.Text,{children:"-"});const b=u=>i?.(u)??(u.name||"--");return e.jsxs(o.Flex,{...c,children:[r.slice(0,t).map((u,w)=>e.jsx(o.Render,{when:!!d,fallback:e.jsx(B.Logo,{style:{marginInlineStart:w-12,width:n,height:n},imageSrc:u?.imageSrc,hasToolTip:!0,toolTipTitle:b(u),hasAnimation:a,onClick:()=>s?.(u),...g},u.id),children:d?.(u)})),r.length>t&&e.jsx(G.Popover,{arrow:!0,color:l.colors.primary_dark_1,placement:"left",overlayInnerStyle:{backgroundColor:l.colors.primary_dark_1,borderRadius:4},trigger:["hover"],content:e.jsx(G.View,{vertical:!0,children:r.slice(t).map(u=>e.jsx(o.Text,{color:l.colors.white_ff,children:b(u)},u.id))}),...h,children:e.jsx(o.Flex,{align:"center",justify:"center",className:"z-50 -ms-3 h-6 w-6 rounded-full border-2 border-primary-light-3 bg-light-7",style:{width:n,height:n},...h?.containerProps,children:`${r.length-t}+`})})]})}const ce=({discardTitle:r,onDiscard:t,onSubmit:n,submitTitle:s,isLoading:a,isSubmitDisabled:i})=>{const{t:d}=P.useTranslation();return e.jsxs(o.Flex,{align:"center",gap:16,justify:"flex-end",children:[r&&e.jsx(y.Button.Secondary,{disabled:a,onClick:t,children:r}),e.jsx(y.Button.Primary,{disabled:i,isLoading:a,onClick:n,children:s||d("common.literal.apply")})]})},de=({title:r,closable:t,onClose:n})=>{const s=()=>typeof r!="string"?r:e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary,children:r});return e.jsxs(o.Flex,{justify:"space-between",align:"center",children:[s(),t&&e.jsx("div",{className:"cursor-pointer",onClick:n,children:e.jsx(o.Icon,{name:"Close",size:20,color:l.colors.primary})})]})},ge=({title:r,closable:t=!0,transparent:n,submitTitle:s,discardTitle:a,onClose:i,onSubmit:d,onDiscard:g,classNames:c,styles:h,children:b,isLoading:u,headerHeight:w=60,wrapperClassName:F,contentClassName:j,noPadding:M,isSubmitDisabled:A,footer:_,...k})=>e.jsx(E.Drawer,{onClose:i,styles:{...h,header:{minHeight:w,backgroundColor:l.colors.light_2,borderColor:l.colors.light_7,paddingBlock:12,paddingInline:24},body:{backgroundColor:n?"transparent":l.colors.white_ff,padding:0},content:{backgroundColor:l.colors.light_2,padding:0},footer:{minHeight:60,paddingBlock:12,borderColor:l.colors.light_7,paddingInline:24,margin:0}},classNames:{...c,body:"small-custom-scrollbar"},footer:_||e.jsx(ce,{onSubmit:d,onDiscard:g,submitTitle:s,discardTitle:a,isLoading:u,isSubmitDisabled:A}),closable:!1,title:e.jsx(de,{title:r,closable:t,onClose:i}),...k,children:e.jsx(o.Flex,{className:C.twMerge("small-custom-scrollbar h-full flex-1 overflow-y-auto bg-light-2 p-6",F),vertical:!0,gap:16,children:e.jsx(o.Flex,{className:C.twMerge("bg-white-ff",M?"rounded-lg":"rounded p-6",n?"bg-transparent":"",j),vertical:!0,children:b})})}),H=({children:r,submitTitle:t,discardTitle:n,onSubmit:s,onDiscard:a,title:i,onClose:d,isLoadingSubmit:g,renderFooter:c,...h})=>e.jsx(E.ConfigProvider,{theme:{components:{Modal:{borderRadius:4,borderRadiusOuter:4,borderRadiusLG:4,paddingMD:0,paddingContentHorizontalLG:0,margin:0}}},children:e.jsx(E.Modal,{closeIcon:!1,classNames:{body:"!px-6 !py-4"},footer:c!==void 0?c:t||n?e.jsxs(o.Flex,{justify:"end",align:"center",className:"h-[58px] rounded-b border-t border-solid border-light-7 bg-light-2 px-6",gap:16,children:[n&&e.jsx(y.Button.Secondary,{onClick:a,children:n}),t&&e.jsx(y.Button.Primary,{isLoading:g,onClick:s,children:t})]}):null,title:typeof i=="string"?e.jsxs(o.Flex,{className:"h-12 rounded-t border-b border-solid border-light-7 bg-light-2 px-6",align:"center",justify:"space-between",children:[e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary_dark_1,children:i}),e.jsx(o.Icon,{name:"Close",color:l.colors.primary,onClick:d,className:"cursor-pointer"})]}):i,...h,children:r})}),ue=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,renderFooter:g,...c})=>{const h=g!==void 0?g:(a||i)&&e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",className:"px-6 py-4",children:[i&&e.jsx(y.Button.Secondary,{onClick:s,children:i}),a&&e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]});return e.jsx(H,{...c,renderFooter:h,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"mb-2 border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r})]})})},xe=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,...g})=>e.jsx(H,{...g,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.Secondary,{onClick:s,children:i}),e.jsx(y.Button.Negative,{iconName:"Delete",isLoading:d,onClick:n,children:a})]})]})}),pe=({children:r,title:t,onSubmit:n,submitTitle:s,isLoadingSubmit:a,...i})=>e.jsx(H,{...i,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsxs(o.Flex,{className:"border-b-[2px] border-light-7 pb-3",align:"center",justify:"space-between",children:[typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t,e.jsx(o.Icon,{name:"Alert",color:l.colors.negative,size:18})]}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Flex,{justify:"flex-end",children:e.jsx(y.Button.Primary,{isLoading:a,onClick:n,children:s})})]})}),he=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,error:g,...c})=>e.jsx(H,{...c,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.negative,children:g}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.SecondaryQuiet,{onClick:s,children:i}),e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]})]})}),me=y.batch({Base:H,Confirm:ue,Error:pe,Delete:xe,Info:he}),V=r=>e.jsx(e.Fragment,{}),fe=({value:r,includeCurrency:t,...n})=>{const{t:s}=P.useTranslation();return e.jsxs(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...n,children:[r?ee(r).scientificNotationToDecimal().toCurrency().toString():"",t&&` ${s("common.literal.rial")}`]})},ye=({value:r,...t})=>e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...t,children:r}),be=({value:r,activeTitle:t,disableTitle:n,...s})=>{const{t:a}=P.useTranslation();return e.jsx(o.Flex,{className:C.twMerge("h-[26px] items-center justify-center rounded px-4",r?"bg-positive-light-2 bg-opacity-10":"bg-light-6"),...s,children:r?e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.positive,children:t||a("common.literal.active")}):e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.primary_light_2,children:n||a("common.literal.disable")})})},v=({children:r})=>typeof r=="string"||typeof r=="number"?e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,children:r}):r;v.Currency=fe;v.Date=ye;v.StatusCell=be;const je=({expandable:r,expanded:t,onExpand:n})=>{const{i18n:s}=P.useTranslation();return r?e.jsx("button",{className:"float-start h-full items-center justify-center",children:e.jsx(o.Icon,{onClick:n,name:t?"Chevron_Down":s.language==="fa"?"Chevron_Left":"Chevron_Right"})}):null},we=({title:r,align:t,style:n,className:s})=>typeof r!="string"?r:e.jsx(o.Flex,{style:n,className:C.twMerge("w-full",t==="start"&&"justify-start",t==="center"&&"justify-center",t==="end"&&"justify-end",s),children:e.jsx(o.Text,{size:14,weight:"normal",className:"whitespace-nowrap",color:l.colors.primary,children:r})}),Ce=r=>re.deepMerge({components:{Table:{borderColor:l.colors.light_7,cellPaddingBlock:0,cellPaddingBlockMD:0,cellPaddingBlockSM:0,cellPaddingInline:8,cellPaddingInlineMD:8,cellPaddingInlineSM:8,fixedHeaderSortActiveBg:"transparent",footerBg:l.colors.light_2,headerBg:l.colors.light_2,headerBorderRadius:0,headerColor:l.colors.primary,bodySortBg:l.colors.white_ff,headerSortHoverBg:l.colors.light_1,headerSortActiveBg:l.colors.light_1,headerSplitColor:"transparent",rowExpandedBg:l.colors.light_3,rowHoverBg:l.colors.light_4,rowSelectedBg:l.colors.light_7,rowSelectedHoverBg:l.colors.light_7,selectionColumnWidth:56},Pagination:{itemActiveBg:l.colors.white_ff,itemActiveBgDisabled:l.colors.negative,itemActiveColorDisabled:l.colors.negative,colorPrimaryBorderHover:"red",colorInfoBorderHover:"yellow",colorWarningBorderHover:"green",itemBg:l.colors.white_ff,itemInputBg:l.colors.negative,itemLinkBg:l.colors.negative,itemSize:30,itemSizeSM:30,miniOptionsSizeChangerTop:40,colorPrimary:l.colors.primary,fontFamily:"YekanBakhFaRegular"}}},r??{}),_e=C.twMerge("[&_th]:!border-t h-full [&_.ant-spin-nested-loading]:h-full [&_.ant-spin-container]:h-full [&_.ant-table]:h-full [&_.ant-spin-container]:flex [&_.ant-spin-container]:flex-col [&_.ant-spin-container]:justify-between [&_.ant-table-column-title]:flex-[0] [&_th]:!border-t-light-7 [&_th]:!pt-4 [&_th]:!pb-1 [&_.ant-table-selection-column]:!ps-4 [&_.ant-table-wrapper]:!p-0 [&_.ant-table-measure-row]:!h-[1px] [&_.ant-table-body]:h-full [&_.ant-table-container]:h-full"),Se=C.twMerge("[&_th]:!bg-transparent h-full [&_th]:!border-t-0 [&_td]:!bg-transparent "),ve={small:"h-[40px] max-h-[40px] min-h-[40px]",middle:"h-[48px] max-h-[48px] min-h-[48px]",large:"h-[56px] max-h-[56px] min-h-[56px]"},Y=x.createContext({}),Ne=()=>{const{setActivatorNodeRef:r,listeners:t}=x.useContext(Y);return e.jsx("button",{style:{cursor:"move"},ref:r,...t,children:e.jsx(o.Icon,{name:"drag_and_drop",color:l.colors.primary_light_2})})},Te=r=>{let{transform:t}=r;return{...t,x:0}},Be=({children:r,onDragEnd:t,dataSource:n=[],rowKey:s})=>{const a=x.useMemo(()=>n.map(d=>d[s]),[n,s]),i=x.useCallback(({active:d,over:g})=>{if(d.id!==g?.id){const c=n.findIndex(u=>u[s]===d?.id),h=n.findIndex(u=>u[s]===g?.id),b=B.arrayMove(n,c,h);t(b)}},[n,s,t]);return e.jsx(e.Fragment,{children:e.jsx(B.DndContext,{modifiers:[Te],onDragEnd:i,children:e.jsx(B.SortableContext,{items:a,strategy:B.verticalListSortingStrategy,children:r})})})},ke=r=>{const{attributes:t,listeners:n,setNodeRef:s,setActivatorNodeRef:a,transform:i,transition:d,isDragging:g}=B.useSortable({id:r["data-row-key"]}),c={...r.style,transform:B.CSS.Translate.toString(i),transition:d,cursor:"default",...g?{position:"relative",zIndex:10}:{}},h=x.useMemo(()=>({setActivatorNodeRef:a,listeners:n}),[a,n]);return e.jsx(Y.Provider,{value:h,children:e.jsx("tr",{...r,ref:s,style:c,...t})})},Ie=({page:r,type:t,current:n,isFa:s})=>{const a=Number(r)===n;return e.jsx(o.Flex,{className:"h-[30px] items-center justify-center",children:t==="page"?e.jsx(o.Text,{weight:a?"bold":"normal",size:a?20:18,color:a?l.colors.primary:l.colors.primary_dark_1,children:r}):t==="next"?e.jsx(o.Flex,{className:"me-4 h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Right":"Chevron_Left",color:l.colors.primary})}):t==="prev"?e.jsx(o.Flex,{className:"h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Left":"Chevron_Right",color:l.colors.primary})}):e.jsx(o.Text,{size:18,children:"..."})})},ze="CHANGE_ORDER",U="CHANGE_PAGE",Z="CHANGE",J="page",Ee={order:void 0,orderBy:"",pageSize:10,current:1,filters:{}};function Fe(r,t){switch(t.type){case ze:return{...r,orderBy:t.payload.orderBy,order:t.payload.order};case U:return{...r,current:t.payload.current,pageSize:t.payload.pageSize===void 0?r.pageSize:t.payload.pageSize};case Z:return{...r,current:t.payload.current,pageSize:t.payload.pageSize??r.pageSize,order:t.payload.order,orderBy:t.payload.orderBy,filters:t.payload.filters};default:return r}}function Me({defaultCurrent:r=1,defaultPageSize:t=10,hasQueryParams:n=!1,hideOnSinglePage:s,style:a,...i}){const{isSmallerThanMedium:d}=ae(),g=$.useNavigate(),[c]=$.useSearchParams(),[h,b]=te(W,t),[u,w]=x.useState(0),{i18n:F}=P.useTranslation(),[{current:j,order:M,orderBy:A,pageSize:_,filters:k},L]=x.useReducer(Fe,{...Ee,pageSize:h,current:n?Number(c.get(J)||String(r)):r});localStorage.removeItem(W);const m=x.useCallback((f,T,R)=>{const z=Array.isArray(R)?R[0]:R;b(f.pageSize||t),L({type:Z,payload:{filters:T,current:f.current,pageSize:f.pageSize,orderBy:Array.isArray(z?.field)?z?.field[0]:z?.field,order:z?.order}})},[t,b]),I=(f,T)=>{L({type:U,payload:{current:f,pageSize:T}})},p=f=>w(f||t);x.useEffect(()=>{n&&g({search:`?${J}=${j}`},{replace:!0})},[j,n]);const S={total:u,current:j,pageSize:_,defaultCurrent:r,defaultPageSize:t,onChange:I,pageSizeOptions:["10","20","30"],showSizeChanger:!0,hideOnSinglePage:s,className:"border border-negative",style:{backgroundColor:l.colors.white_ff,paddingInline:d?4:24,paddingBlock:16,margin:0,borderTop:`1px solid ${l.colors.light_7}`,flexDirection:"row-reverse",justifyContent:"flex-start",border:"none",...a},showPrevNextJumpers:!0,showQuickJumper:!0,rootClassName:"flex items-center [&_.ant-select-dropdown]:!p-0 [&_.ant-pagination-options]:flex [&_.ant-pagination-options]:items-center [&_.ant-pagination-options]:justify-between [&_.ant-pagination-options]:flex-1",itemRender:(f,T)=>Ie({current:j,page:f,type:T,isFa:F.language==="fa"}),...i};return{filters:k,current:j,pageSize:_,pagination:S,order:M,orderBy:A,onChange:m,getTotal:p}}const N=({className:r,children:t,expandable:n,rowSelection:s,size:a,pagination:i,loading:d,transparentHeader:g,internalScroll:c=!0,extraHeight:h=100,footer:b,theme:u,dndSort:w,components:F,...j})=>{const[M,A]=x.useState(),_=x.useRef(null);x.useEffect(()=>{_.current&&A(window.innerHeight-_.current.offsetTop-46-(i?65:0)-h)},[i,u?.components?.Table?.headerBg]);const k=x.useMemo(()=>{function m(p){if(!p)return[];if(typeof p=="boolean"||typeof p>"u"||p===null)return[];if(typeof p!="object")throw new Error("Table children must be Column");if(!Array.isArray(p)){if(p.type===V)return[{...p.props,child:p}];if(p.type===x.Fragment)return m(p.props?.children)}return(p||[])?.flatMap(S=>m(S))}return m(t)},[t]),L=({children:m})=>w===void 0?e.jsx(e.Fragment,{children:m}):e.jsx(Be,{children:m,onDragEnd:w.onDragEnd,dataSource:j.dataSource,rowKey:j.rowKey});return e.jsx(E.ConfigProvider,{theme:Ce(u),children:e.jsx(L,{children:e.jsxs(E.Table,{ref:_,loading:{indicator:e.jsx(o.Flex,{className:"items-center justify-center",children:e.jsx(o.Loading,{isLoading:!0,size:32,thickness:3})}),spinning:!!d},scroll:c?{y:M}:void 0,className:C.twMerge(_e,"abrplus-table-custom-scroll-bar w-full !animate-none [&_.ant-table-thead_th]:!pt-2",!!n&&!!s&&"[&_.ant-table-selection-column]:!ps-0",g&&Se,r),rowSelection:s,expandable:n?{...n,expandedRowClassName:()=>"[&_.ant-table-cell]:!p-0 [&_.ant-table-row-expand-icon-cell]:!p-0 ",expandIcon:({expandable:m,expanded:I,onExpand:p,record:S})=>e.jsx(je,{expandable:m,expanded:I,onExpand:f=>p?.(S,f)})}:void 0,pagination:i,footer:b,components:w?{body:{row:ke}}:F,...j,children:[w&&e.jsx(N.Column,{align:"center",width:80,render:()=>e.jsx(Ne,{})},"sort"),k.map(({render:m,children:I,dataIndex:p,align:S,headerStyle:f,headerClassName:T,className:R,filtersOptions:z,sortIconOptions:q,...X},O)=>e.jsx(E.Table.Column,{...X,dataIndex:p?.toString(),className:C.twMerge("h-[56px] [&_.ant-table-column-title]:!flex-1",R),title:e.jsxs(o.Flex,{className:"ant-table-column-title-content items-center justify-between",flex:1,children:[e.jsx(we,{title:I,align:S,style:f,className:T}),z?.renderFilter?.()]}),render:(D,Q,K)=>e.jsx(o.Flex,{className:C.twMerge("items-center",ve[a||"large"]),style:{wordWrap:"break-word",wordBreak:"break-word",paddingInlineEnd:O===k.length-1?24:void 0},children:m?m({index:K,row:Q,value:D}):e.jsx(v,{children:D})}),showSorterTooltip:!1,sortIcon:({sortOrder:D})=>e.jsxs(o.Flex,{vertical:!0,...q,className:C.twMerge("table-filters-sort flex-[4] ps-2",q?.className),children:[e.jsx(o.Icon,{size:12,color:D==="ascend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Up",style:{marginBottom:-4}}),e.jsx(o.Icon,{size:12,color:D==="descend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Down"})]})},O))]})})})};N.Cell=v;N.Column=V;N.Currency=v.Currency;N.Date=v.Date;N.Status=v.StatusCell;N.usePagination=Me;exports.AvatarGroup=ie;exports.Drawer=ge;exports.Modal=me;exports.Table=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./sortable.esm-CA8VbUF-.cjs"),G=require("./index-lDQ4dr86.cjs"),o=require("./index-B1HRk2-g.cjs"),l=require("./colors-BDQwGpaB.cjs"),E=require("antd"),C=require("tailwind-merge"),P=require("react-i18next"),y=require("./index-BJmt8SSx.cjs"),x=require("react"),ee=require("starkstring"),re=require("./deepMerge-2zqLIrFM.cjs"),$=require("react-router-dom");function te(r,t){const n=localStorage.getItem(r),s=n?JSON.parse(n):t,[a,i]=x.useState(s);return x.useEffect(()=>{localStorage.setItem(r,JSON.stringify(a))},[r,a]),[a,i]}const oe=640,ne=768,le=1024,se=1280;function ae(){const{width:r}=G.useWindowDimensions(),t=x.useCallback(c=>{if(!(typeof window>"u"))return r<=c},[r]),n=x.useCallback(c=>{if(!(typeof window>"u"))return r>c},[r]),s=x.useCallback(c=>{if(c[0]>=c[1])throw new Error(`The second query: ${c[1]}px must be greater than the first query: ${c[0]}px`);if(!(typeof window>"u"))return r>c[0]&&r<=c[1]},[r]),a=t(le),i=t(oe),d=t(ne),g=n(se);return{getIsWidthSmallerThan:t,getIsWidthLargerThan:n,getIsWidthBetween:s,isSmallerThanExtraLarge:g,isSmallerThanMedium:d,isSmallerThanSmall:i,isSmallerThenLarge:a}}const W="PAGINATION_SIZE";function ie({items:r=[],max:t=3,avatarProps:{size:n}={},onClickAvatar:s,hasAnimation:a=!0,nameExtractor:i,renderItem:d,itemLogoProps:g,containerProps:c,popoverProps:h}){if(r.length===0)return e.jsx(o.Text,{children:"-"});const b=u=>i?.(u)??(u.name||"--");return e.jsxs(o.Flex,{...c,children:[r.slice(0,t).map((u,j)=>e.jsx(o.Render,{when:!!d,fallback:e.jsx(B.Logo,{style:{marginInlineStart:j-12,width:n,height:n},imageSrc:u?.imageSrc,hasToolTip:!0,toolTipTitle:b(u),hasAnimation:a,onClick:()=>s?.(u),...g},u.id),children:d?.(u,j)})),r.length>t&&e.jsx(G.Popover,{arrow:!0,color:l.colors.primary_dark_1,placement:"left",overlayInnerStyle:{backgroundColor:l.colors.primary_dark_1,borderRadius:4},trigger:["hover"],content:e.jsx(G.View,{vertical:!0,children:r.slice(t).map(u=>e.jsx(o.Text,{color:l.colors.white_ff,children:b(u)},u.id))}),...h,children:e.jsx(o.Flex,{align:"center",justify:"center",className:"z-50 -ms-3 h-6 w-6 rounded-full border-2 border-primary-light-3 bg-light-7",style:{width:n,height:n},...h?.containerProps,children:`${r.length-t}+`})})]})}const ce=({discardTitle:r,onDiscard:t,onSubmit:n,submitTitle:s,isLoading:a,isSubmitDisabled:i})=>{const{t:d}=P.useTranslation();return e.jsxs(o.Flex,{align:"center",gap:16,justify:"flex-end",children:[r&&e.jsx(y.Button.Secondary,{disabled:a,onClick:t,children:r}),e.jsx(y.Button.Primary,{disabled:i,isLoading:a,onClick:n,children:s||d("common.literal.apply")})]})},de=({title:r,closable:t,onClose:n})=>{const s=()=>typeof r!="string"?r:e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary,children:r});return e.jsxs(o.Flex,{justify:"space-between",align:"center",children:[s(),t&&e.jsx("div",{className:"cursor-pointer",onClick:n,children:e.jsx(o.Icon,{name:"Close",size:20,color:l.colors.primary})})]})},ge=({title:r,closable:t=!0,transparent:n,submitTitle:s,discardTitle:a,onClose:i,onSubmit:d,onDiscard:g,classNames:c,styles:h,children:b,isLoading:u,headerHeight:j=60,wrapperClassName:F,contentClassName:w,noPadding:M,isSubmitDisabled:A,footer:_,...k})=>e.jsx(E.Drawer,{onClose:i,styles:{...h,header:{minHeight:j,backgroundColor:l.colors.light_2,borderColor:l.colors.light_7,paddingBlock:12,paddingInline:24},body:{backgroundColor:n?"transparent":l.colors.white_ff,padding:0},content:{backgroundColor:l.colors.light_2,padding:0},footer:{minHeight:60,paddingBlock:12,borderColor:l.colors.light_7,paddingInline:24,margin:0}},classNames:{...c,body:"small-custom-scrollbar"},footer:_||e.jsx(ce,{onSubmit:d,onDiscard:g,submitTitle:s,discardTitle:a,isLoading:u,isSubmitDisabled:A}),closable:!1,title:e.jsx(de,{title:r,closable:t,onClose:i}),...k,children:e.jsx(o.Flex,{className:C.twMerge("small-custom-scrollbar h-full flex-1 overflow-y-auto bg-light-2 p-6",F),vertical:!0,gap:16,children:e.jsx(o.Flex,{className:C.twMerge("bg-white-ff",M?"rounded-lg":"rounded p-6",n?"bg-transparent":"",w),vertical:!0,children:b})})}),H=({children:r,submitTitle:t,discardTitle:n,onSubmit:s,onDiscard:a,title:i,onClose:d,isLoadingSubmit:g,renderFooter:c,...h})=>e.jsx(E.ConfigProvider,{theme:{components:{Modal:{borderRadius:4,borderRadiusOuter:4,borderRadiusLG:4,paddingMD:0,paddingContentHorizontalLG:0,margin:0}}},children:e.jsx(E.Modal,{closeIcon:!1,classNames:{body:"!px-6 !py-4"},footer:c!==void 0?c:t||n?e.jsxs(o.Flex,{justify:"end",align:"center",className:"h-[58px] rounded-b border-t border-solid border-light-7 bg-light-2 px-6",gap:16,children:[n&&e.jsx(y.Button.Secondary,{onClick:a,children:n}),t&&e.jsx(y.Button.Primary,{isLoading:g,onClick:s,children:t})]}):null,title:typeof i=="string"?e.jsxs(o.Flex,{className:"h-12 rounded-t border-b border-solid border-light-7 bg-light-2 px-6",align:"center",justify:"space-between",children:[e.jsx(o.Text,{size:18,weight:"medium",color:l.colors.primary_dark_1,children:i}),e.jsx(o.Icon,{name:"Close",color:l.colors.primary,onClick:d,className:"cursor-pointer"})]}):i,...h,children:r})}),ue=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,renderFooter:g,...c})=>{const h=g!==void 0?g:(a||i)&&e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",className:"px-6 py-4",children:[i&&e.jsx(y.Button.Secondary,{onClick:s,children:i}),a&&e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]});return e.jsx(H,{...c,renderFooter:h,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"mb-2 border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r})]})})},xe=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,...g})=>e.jsx(H,{...g,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.Secondary,{onClick:s,children:i}),e.jsx(y.Button.Negative,{iconName:"Delete",isLoading:d,onClick:n,children:a})]})]})}),pe=({children:r,title:t,onSubmit:n,submitTitle:s,isLoadingSubmit:a,...i})=>e.jsx(H,{...i,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsxs(o.Flex,{className:"border-b-[2px] border-light-7 pb-3",align:"center",justify:"space-between",children:[typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t,e.jsx(o.Icon,{name:"Alert",color:l.colors.negative,size:18})]}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Flex,{justify:"flex-end",children:e.jsx(y.Button.Primary,{isLoading:a,onClick:n,children:s})})]})}),he=({children:r,title:t,onSubmit:n,onDiscard:s,submitTitle:a,discardTitle:i,isLoadingSubmit:d,error:g,...c})=>e.jsx(H,{...c,children:e.jsxs(o.Flex,{vertical:!0,children:[e.jsx(o.Flex,{vertical:!0,className:"border-b-[2px] border-light-7 pb-3",children:typeof t=="string"?e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.primary_dark_1,children:t}):t}),e.jsx(o.Flex,{className:"pb-10 pt-4",children:typeof r=="string"?e.jsx(o.Text,{size:16,weight:"normal",color:l.colors.primary,children:r}):r}),e.jsx(o.Text,{size:20,weight:"bold",color:l.colors.negative,children:g}),e.jsxs(o.Flex,{gap:16,align:"center",justify:"flex-end",children:[e.jsx(y.Button.SecondaryQuiet,{onClick:s,children:i}),e.jsx(y.Button.Primary,{isLoading:d,onClick:n,children:a})]})]})}),me=y.batch({Base:H,Confirm:ue,Error:pe,Delete:xe,Info:he}),V=r=>e.jsx(e.Fragment,{}),fe=({value:r,includeCurrency:t,...n})=>{const{t:s}=P.useTranslation();return e.jsxs(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...n,children:[r?ee(r).scientificNotationToDecimal().toCurrency().toString():"",t&&` ${s("common.literal.rial")}`]})},ye=({value:r,...t})=>e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,...t,children:r}),be=({value:r,activeTitle:t,disableTitle:n,...s})=>{const{t:a}=P.useTranslation();return e.jsx(o.Flex,{className:C.twMerge("h-[26px] items-center justify-center rounded px-4",r?"bg-positive-light-2 bg-opacity-10":"bg-light-6"),...s,children:r?e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.positive,children:t||a("common.literal.active")}):e.jsx(o.Text,{size:12,weight:"medium",color:l.colors.primary_light_2,children:n||a("common.literal.disable")})})},v=({children:r})=>typeof r=="string"||typeof r=="number"?e.jsx(o.Text,{className:"w-full",size:14,weight:"normal",color:l.colors.primary,children:r}):r;v.Currency=fe;v.Date=ye;v.StatusCell=be;const je=({expandable:r,expanded:t,onExpand:n})=>{const{i18n:s}=P.useTranslation();return r?e.jsx("button",{className:"float-start h-full items-center justify-center",children:e.jsx(o.Icon,{onClick:n,name:t?"Chevron_Down":s.language==="fa"?"Chevron_Left":"Chevron_Right"})}):null},we=({title:r,align:t,style:n,className:s})=>typeof r!="string"?r:e.jsx(o.Flex,{style:n,className:C.twMerge("w-full",t==="start"&&"justify-start",t==="center"&&"justify-center",t==="end"&&"justify-end",s),children:e.jsx(o.Text,{size:14,weight:"normal",className:"whitespace-nowrap",color:l.colors.primary,children:r})}),Ce=r=>re.deepMerge({components:{Table:{borderColor:l.colors.light_7,cellPaddingBlock:0,cellPaddingBlockMD:0,cellPaddingBlockSM:0,cellPaddingInline:8,cellPaddingInlineMD:8,cellPaddingInlineSM:8,fixedHeaderSortActiveBg:"transparent",footerBg:l.colors.light_2,headerBg:l.colors.light_2,headerBorderRadius:0,headerColor:l.colors.primary,bodySortBg:l.colors.white_ff,headerSortHoverBg:l.colors.light_1,headerSortActiveBg:l.colors.light_1,headerSplitColor:"transparent",rowExpandedBg:l.colors.light_3,rowHoverBg:l.colors.light_4,rowSelectedBg:l.colors.light_7,rowSelectedHoverBg:l.colors.light_7,selectionColumnWidth:56},Pagination:{itemActiveBg:l.colors.white_ff,itemActiveBgDisabled:l.colors.negative,itemActiveColorDisabled:l.colors.negative,colorPrimaryBorderHover:"red",colorInfoBorderHover:"yellow",colorWarningBorderHover:"green",itemBg:l.colors.white_ff,itemInputBg:l.colors.negative,itemLinkBg:l.colors.negative,itemSize:30,itemSizeSM:30,miniOptionsSizeChangerTop:40,colorPrimary:l.colors.primary,fontFamily:"YekanBakhFaRegular"}}},r??{}),_e=C.twMerge("[&_th]:!border-t h-full [&_.ant-spin-nested-loading]:h-full [&_.ant-spin-container]:h-full [&_.ant-table]:h-full [&_.ant-spin-container]:flex [&_.ant-spin-container]:flex-col [&_.ant-spin-container]:justify-between [&_.ant-table-column-title]:flex-[0] [&_th]:!border-t-light-7 [&_th]:!pt-4 [&_th]:!pb-1 [&_.ant-table-selection-column]:!ps-4 [&_.ant-table-wrapper]:!p-0 [&_.ant-table-measure-row]:!h-[1px] [&_.ant-table-body]:h-full [&_.ant-table-container]:h-full"),Se=C.twMerge("[&_th]:!bg-transparent h-full [&_th]:!border-t-0 [&_td]:!bg-transparent "),ve={small:"h-[40px] max-h-[40px] min-h-[40px]",middle:"h-[48px] max-h-[48px] min-h-[48px]",large:"h-[56px] max-h-[56px] min-h-[56px]"},Y=x.createContext({}),Ne=()=>{const{setActivatorNodeRef:r,listeners:t}=x.useContext(Y);return e.jsx("button",{style:{cursor:"move"},ref:r,...t,children:e.jsx(o.Icon,{name:"drag_and_drop",color:l.colors.primary_light_2})})},Te=r=>{let{transform:t}=r;return{...t,x:0}},Be=({children:r,onDragEnd:t,dataSource:n=[],rowKey:s})=>{const a=x.useMemo(()=>n.map(d=>d[s]),[n,s]),i=x.useCallback(({active:d,over:g})=>{if(d.id!==g?.id){const c=n.findIndex(u=>u[s]===d?.id),h=n.findIndex(u=>u[s]===g?.id),b=B.arrayMove(n,c,h);t(b)}},[n,s,t]);return e.jsx(e.Fragment,{children:e.jsx(B.DndContext,{modifiers:[Te],onDragEnd:i,children:e.jsx(B.SortableContext,{items:a,strategy:B.verticalListSortingStrategy,children:r})})})},ke=r=>{const{attributes:t,listeners:n,setNodeRef:s,setActivatorNodeRef:a,transform:i,transition:d,isDragging:g}=B.useSortable({id:r["data-row-key"]}),c={...r.style,transform:B.CSS.Translate.toString(i),transition:d,cursor:"default",...g?{position:"relative",zIndex:10}:{}},h=x.useMemo(()=>({setActivatorNodeRef:a,listeners:n}),[a,n]);return e.jsx(Y.Provider,{value:h,children:e.jsx("tr",{...r,ref:s,style:c,...t})})},Ie=({page:r,type:t,current:n,isFa:s})=>{const a=Number(r)===n;return e.jsx(o.Flex,{className:"h-[30px] items-center justify-center",children:t==="page"?e.jsx(o.Text,{weight:a?"bold":"normal",size:a?20:18,color:a?l.colors.primary:l.colors.primary_dark_1,children:r}):t==="next"?e.jsx(o.Flex,{className:"me-4 h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Right":"Chevron_Left",color:l.colors.primary})}):t==="prev"?e.jsx(o.Flex,{className:"h-[30px] w-[30px] items-center justify-center rounded border border-light-7",children:e.jsx(o.Icon,{name:s?"Chevron_Left":"Chevron_Right",color:l.colors.primary})}):e.jsx(o.Text,{size:18,children:"..."})})},ze="CHANGE_ORDER",U="CHANGE_PAGE",Z="CHANGE",J="page",Ee={order:void 0,orderBy:"",pageSize:10,current:1,filters:{}};function Fe(r,t){switch(t.type){case ze:return{...r,orderBy:t.payload.orderBy,order:t.payload.order};case U:return{...r,current:t.payload.current,pageSize:t.payload.pageSize===void 0?r.pageSize:t.payload.pageSize};case Z:return{...r,current:t.payload.current,pageSize:t.payload.pageSize??r.pageSize,order:t.payload.order,orderBy:t.payload.orderBy,filters:t.payload.filters};default:return r}}function Me({defaultCurrent:r=1,defaultPageSize:t=10,hasQueryParams:n=!1,hideOnSinglePage:s,style:a,...i}){const{isSmallerThanMedium:d}=ae(),g=$.useNavigate(),[c]=$.useSearchParams(),[h,b]=te(W,t),[u,j]=x.useState(0),{i18n:F}=P.useTranslation(),[{current:w,order:M,orderBy:A,pageSize:_,filters:k},L]=x.useReducer(Fe,{...Ee,pageSize:h,current:n?Number(c.get(J)||String(r)):r});localStorage.removeItem(W);const m=x.useCallback((f,T,R)=>{const z=Array.isArray(R)?R[0]:R;b(f.pageSize||t),L({type:Z,payload:{filters:T,current:f.current,pageSize:f.pageSize,orderBy:Array.isArray(z?.field)?z?.field[0]:z?.field,order:z?.order}})},[t,b]),I=(f,T)=>{L({type:U,payload:{current:f,pageSize:T}})},p=f=>j(f||t);x.useEffect(()=>{n&&g({search:`?${J}=${w}`},{replace:!0})},[w,n]);const S={total:u,current:w,pageSize:_,defaultCurrent:r,defaultPageSize:t,onChange:I,pageSizeOptions:["10","20","30"],showSizeChanger:!0,hideOnSinglePage:s,className:"border border-negative",style:{backgroundColor:l.colors.white_ff,paddingInline:d?4:24,paddingBlock:16,margin:0,borderTop:`1px solid ${l.colors.light_7}`,flexDirection:"row-reverse",justifyContent:"flex-start",border:"none",...a},showPrevNextJumpers:!0,showQuickJumper:!0,rootClassName:"flex items-center [&_.ant-select-dropdown]:!p-0 [&_.ant-pagination-options]:flex [&_.ant-pagination-options]:items-center [&_.ant-pagination-options]:justify-between [&_.ant-pagination-options]:flex-1",itemRender:(f,T)=>Ie({current:w,page:f,type:T,isFa:F.language==="fa"}),...i};return{filters:k,current:w,pageSize:_,pagination:S,order:M,orderBy:A,onChange:m,getTotal:p}}const N=({className:r,children:t,expandable:n,rowSelection:s,size:a,pagination:i,loading:d,transparentHeader:g,internalScroll:c=!0,extraHeight:h=100,footer:b,theme:u,dndSort:j,components:F,...w})=>{const[M,A]=x.useState(),_=x.useRef(null);x.useEffect(()=>{_.current&&A(window.innerHeight-_.current.offsetTop-46-(i?65:0)-h)},[i,u?.components?.Table?.headerBg]);const k=x.useMemo(()=>{function m(p){if(!p)return[];if(typeof p=="boolean"||typeof p>"u"||p===null)return[];if(typeof p!="object")throw new Error("Table children must be Column");if(!Array.isArray(p)){if(p.type===V)return[{...p.props,child:p}];if(p.type===x.Fragment)return m(p.props?.children)}return(p||[])?.flatMap(S=>m(S))}return m(t)},[t]),L=({children:m})=>j===void 0?e.jsx(e.Fragment,{children:m}):e.jsx(Be,{children:m,onDragEnd:j.onDragEnd,dataSource:w.dataSource,rowKey:w.rowKey});return e.jsx(E.ConfigProvider,{theme:Ce(u),children:e.jsx(L,{children:e.jsxs(E.Table,{ref:_,loading:{indicator:e.jsx(o.Flex,{className:"items-center justify-center",children:e.jsx(o.Loading,{isLoading:!0,size:32,thickness:3})}),spinning:!!d},scroll:c?{y:M}:void 0,className:C.twMerge(_e,"abrplus-table-custom-scroll-bar w-full !animate-none [&_.ant-table-thead_th]:!pt-2",!!n&&!!s&&"[&_.ant-table-selection-column]:!ps-0",g&&Se,r),rowSelection:s,expandable:n?{...n,expandedRowClassName:()=>"[&_.ant-table-cell]:!p-0 [&_.ant-table-row-expand-icon-cell]:!p-0 ",expandIcon:({expandable:m,expanded:I,onExpand:p,record:S})=>e.jsx(je,{expandable:m,expanded:I,onExpand:f=>p?.(S,f)})}:void 0,pagination:i,footer:b,components:j?{body:{row:ke}}:F,...w,children:[j&&e.jsx(N.Column,{align:"center",width:80,render:()=>e.jsx(Ne,{})},"sort"),k.map(({render:m,children:I,dataIndex:p,align:S,headerStyle:f,headerClassName:T,className:R,filtersOptions:z,sortIconOptions:q,...X},O)=>e.jsx(E.Table.Column,{...X,dataIndex:p?.toString(),className:C.twMerge("h-[56px] [&_.ant-table-column-title]:!flex-1",R),title:e.jsxs(o.Flex,{className:"ant-table-column-title-content items-center justify-between",flex:1,children:[e.jsx(we,{title:I,align:S,style:f,className:T}),z?.renderFilter?.()]}),render:(D,Q,K)=>e.jsx(o.Flex,{className:C.twMerge("items-center",ve[a||"large"]),style:{wordWrap:"break-word",wordBreak:"break-word",paddingInlineEnd:O===k.length-1?24:void 0},children:m?m({index:K,row:Q,value:D}):e.jsx(v,{children:D})}),showSorterTooltip:!1,sortIcon:({sortOrder:D})=>e.jsxs(o.Flex,{vertical:!0,...q,className:C.twMerge("table-filters-sort flex-[4] ps-2",q?.className),children:[e.jsx(o.Icon,{size:12,color:D==="ascend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Up",style:{marginBottom:-4}}),e.jsx(o.Icon,{size:12,color:D==="descend"?l.colors.primary:l.colors.primary_light_3,name:"Chevron_Down"})]})},O))]})})})};N.Cell=v;N.Column=V;N.Currency=v.Currency;N.Date=v.Date;N.Status=v.StatusCell;N.usePagination=Me;exports.AvatarGroup=ie;exports.Drawer=ge;exports.Modal=me;exports.Table=N;
|
package/dist/organisms.es.js
CHANGED
|
@@ -4,10 +4,10 @@ import { u as pe, P as me, V as he } from "./index-BeP9-mrf.js";
|
|
|
4
4
|
import { T as m, F as s, R as ue, I as v, L as fe } from "./index-BRLLsEKX.js";
|
|
5
5
|
import { c as o } from "./colors-BW-NR0oP.js";
|
|
6
6
|
import { Drawer as ye, ConfigProvider as Q, Modal as be, Table as U } from "antd";
|
|
7
|
-
import { twMerge as
|
|
7
|
+
import { twMerge as x } from "tailwind-merge";
|
|
8
8
|
import { useTranslation as H } from "react-i18next";
|
|
9
|
-
import { B as
|
|
10
|
-
import { useState as O, useEffect as W, useCallback as L, createContext as Ce, useContext as _e, useMemo as V, useReducer as
|
|
9
|
+
import { B as S, b as we } from "./index-CzPs2mPX.js";
|
|
10
|
+
import { useState as O, useEffect as W, useCallback as L, createContext as Ce, useContext as _e, useMemo as V, useReducer as Se, useRef as xe, Fragment as ve } from "react";
|
|
11
11
|
import Ne from "starkstring";
|
|
12
12
|
import { d as ke } from "./deepMerge-Dm_AZi0Z.js";
|
|
13
13
|
import { useNavigate as ze, useSearchParams as Be } from "react-router-dom";
|
|
@@ -69,14 +69,14 @@ function br({
|
|
|
69
69
|
return /* @__PURE__ */ r(m, { children: "-" });
|
|
70
70
|
const w = (p) => l?.(p) ?? (p.name || "--");
|
|
71
71
|
return /* @__PURE__ */ u(s, { ...c, children: [
|
|
72
|
-
e.slice(0, t).map((p,
|
|
72
|
+
e.slice(0, t).map((p, C) => /* @__PURE__ */ r(
|
|
73
73
|
ue,
|
|
74
74
|
{
|
|
75
75
|
when: !!d,
|
|
76
76
|
fallback: /* @__PURE__ */ r(
|
|
77
77
|
ae,
|
|
78
78
|
{
|
|
79
|
-
style: { marginInlineStart:
|
|
79
|
+
style: { marginInlineStart: C - 12, width: n, height: n },
|
|
80
80
|
imageSrc: p?.imageSrc,
|
|
81
81
|
hasToolTip: !0,
|
|
82
82
|
toolTipTitle: w(p),
|
|
@@ -86,7 +86,7 @@ function br({
|
|
|
86
86
|
},
|
|
87
87
|
p.id
|
|
88
88
|
),
|
|
89
|
-
children: d?.(p)
|
|
89
|
+
children: d?.(p, C)
|
|
90
90
|
}
|
|
91
91
|
)),
|
|
92
92
|
e.length > t && /* @__PURE__ */ r(
|
|
@@ -127,8 +127,8 @@ const Pe = ({
|
|
|
127
127
|
}) => {
|
|
128
128
|
const { t: d } = H();
|
|
129
129
|
return /* @__PURE__ */ u(s, { align: "center", gap: 16, justify: "flex-end", children: [
|
|
130
|
-
e && /* @__PURE__ */ r(
|
|
131
|
-
/* @__PURE__ */ r(
|
|
130
|
+
e && /* @__PURE__ */ r(S.Secondary, { disabled: i, onClick: t, children: e }),
|
|
131
|
+
/* @__PURE__ */ r(S.Primary, { disabled: l, isLoading: i, onClick: n, children: a || d("common.literal.apply") })
|
|
132
132
|
] });
|
|
133
133
|
}, je = ({ title: e, closable: t, onClose: n }) => /* @__PURE__ */ u(s, { justify: "space-between", align: "center", children: [
|
|
134
134
|
typeof e != "string" ? e : /* @__PURE__ */ r(m, { size: 18, weight: "medium", color: o.primary, children: e }),
|
|
@@ -146,9 +146,9 @@ const Pe = ({
|
|
|
146
146
|
styles: f,
|
|
147
147
|
children: w,
|
|
148
148
|
isLoading: p,
|
|
149
|
-
headerHeight:
|
|
149
|
+
headerHeight: C = 60,
|
|
150
150
|
wrapperClassName: R,
|
|
151
|
-
contentClassName:
|
|
151
|
+
contentClassName: _,
|
|
152
152
|
noPadding: T,
|
|
153
153
|
isSubmitDisabled: P,
|
|
154
154
|
footer: N,
|
|
@@ -160,7 +160,7 @@ const Pe = ({
|
|
|
160
160
|
styles: {
|
|
161
161
|
...f,
|
|
162
162
|
header: {
|
|
163
|
-
minHeight:
|
|
163
|
+
minHeight: C,
|
|
164
164
|
backgroundColor: o.light_2,
|
|
165
165
|
borderColor: o.light_7,
|
|
166
166
|
paddingBlock: 12,
|
|
@@ -205,7 +205,7 @@ const Pe = ({
|
|
|
205
205
|
children: /* @__PURE__ */ r(
|
|
206
206
|
s,
|
|
207
207
|
{
|
|
208
|
-
className:
|
|
208
|
+
className: x(
|
|
209
209
|
"small-custom-scrollbar h-full flex-1 overflow-y-auto bg-light-2 p-6",
|
|
210
210
|
R
|
|
211
211
|
),
|
|
@@ -214,11 +214,11 @@ const Pe = ({
|
|
|
214
214
|
children: /* @__PURE__ */ r(
|
|
215
215
|
s,
|
|
216
216
|
{
|
|
217
|
-
className:
|
|
217
|
+
className: x(
|
|
218
218
|
"bg-white-ff",
|
|
219
219
|
T ? "rounded-lg" : "rounded p-6",
|
|
220
220
|
n ? "bg-transparent" : "",
|
|
221
|
-
|
|
221
|
+
_
|
|
222
222
|
),
|
|
223
223
|
vertical: !0,
|
|
224
224
|
children: w
|
|
@@ -266,8 +266,8 @@ const Pe = ({
|
|
|
266
266
|
className: "h-[58px] rounded-b border-t border-solid border-light-7 bg-light-2 px-6",
|
|
267
267
|
gap: 16,
|
|
268
268
|
children: [
|
|
269
|
-
n && /* @__PURE__ */ r(
|
|
270
|
-
t && /* @__PURE__ */ r(
|
|
269
|
+
n && /* @__PURE__ */ r(S.Secondary, { onClick: i, children: n }),
|
|
270
|
+
t && /* @__PURE__ */ r(S.Primary, { isLoading: g, onClick: a, children: t })
|
|
271
271
|
]
|
|
272
272
|
}
|
|
273
273
|
) : null,
|
|
@@ -308,8 +308,8 @@ const Pe = ({
|
|
|
308
308
|
...c
|
|
309
309
|
}) => {
|
|
310
310
|
const f = g !== void 0 ? g : (i || l) && /* @__PURE__ */ u(s, { gap: 16, align: "center", justify: "flex-end", className: "px-6 py-4", children: [
|
|
311
|
-
l && /* @__PURE__ */ r(
|
|
312
|
-
i && /* @__PURE__ */ r(
|
|
311
|
+
l && /* @__PURE__ */ r(S.Secondary, { onClick: a, children: l }),
|
|
312
|
+
i && /* @__PURE__ */ r(S.Primary, { isLoading: d, onClick: n, children: i })
|
|
313
313
|
] });
|
|
314
314
|
return /* @__PURE__ */ r(G, { ...c, renderFooter: f, children: /* @__PURE__ */ u(s, { vertical: !0, children: [
|
|
315
315
|
/* @__PURE__ */ r(s, { vertical: !0, className: "mb-2 border-b-[2px] border-light-7 pb-3", children: typeof t == "string" ? /* @__PURE__ */ r(m, { size: 20, weight: "bold", color: o.primary_dark_1, children: t }) : t }),
|
|
@@ -328,8 +328,8 @@ const Pe = ({
|
|
|
328
328
|
/* @__PURE__ */ r(s, { vertical: !0, className: "border-b-[2px] border-light-7 pb-3", children: typeof t == "string" ? /* @__PURE__ */ r(m, { size: 20, weight: "bold", color: o.primary_dark_1, children: t }) : t }),
|
|
329
329
|
/* @__PURE__ */ r(s, { className: "pb-10 pt-4", children: typeof e == "string" ? /* @__PURE__ */ r(m, { size: 16, weight: "normal", color: o.primary, children: e }) : e }),
|
|
330
330
|
/* @__PURE__ */ u(s, { gap: 16, align: "center", justify: "flex-end", children: [
|
|
331
|
-
/* @__PURE__ */ r(
|
|
332
|
-
/* @__PURE__ */ r(
|
|
331
|
+
/* @__PURE__ */ r(S.Secondary, { onClick: a, children: l }),
|
|
332
|
+
/* @__PURE__ */ r(S.Negative, { iconName: "Delete", isLoading: d, onClick: n, children: i })
|
|
333
333
|
] })
|
|
334
334
|
] }) }), He = ({
|
|
335
335
|
children: e,
|
|
@@ -344,7 +344,7 @@ const Pe = ({
|
|
|
344
344
|
/* @__PURE__ */ r(v, { name: "Alert", color: o.negative, size: 18 })
|
|
345
345
|
] }),
|
|
346
346
|
/* @__PURE__ */ r(s, { className: "pb-10 pt-4", children: typeof e == "string" ? /* @__PURE__ */ r(m, { size: 16, weight: "normal", color: o.primary, children: e }) : e }),
|
|
347
|
-
/* @__PURE__ */ r(s, { justify: "flex-end", children: /* @__PURE__ */ r(
|
|
347
|
+
/* @__PURE__ */ r(s, { justify: "flex-end", children: /* @__PURE__ */ r(S.Primary, { isLoading: i, onClick: n, children: a }) })
|
|
348
348
|
] }) }), Ge = ({
|
|
349
349
|
children: e,
|
|
350
350
|
title: t,
|
|
@@ -360,8 +360,8 @@ const Pe = ({
|
|
|
360
360
|
/* @__PURE__ */ r(s, { className: "pb-10 pt-4", children: typeof e == "string" ? /* @__PURE__ */ r(m, { size: 16, weight: "normal", color: o.primary, children: e }) : e }),
|
|
361
361
|
/* @__PURE__ */ r(m, { size: 20, weight: "bold", color: o.negative, children: g }),
|
|
362
362
|
/* @__PURE__ */ u(s, { gap: 16, align: "center", justify: "flex-end", children: [
|
|
363
|
-
/* @__PURE__ */ r(
|
|
364
|
-
/* @__PURE__ */ r(
|
|
363
|
+
/* @__PURE__ */ r(S.SecondaryQuiet, { onClick: a, children: l }),
|
|
364
|
+
/* @__PURE__ */ r(S.Primary, { isLoading: d, onClick: n, children: i })
|
|
365
365
|
] })
|
|
366
366
|
] }) }), Cr = we({
|
|
367
367
|
Base: G,
|
|
@@ -380,7 +380,7 @@ const Pe = ({
|
|
|
380
380
|
return /* @__PURE__ */ r(
|
|
381
381
|
s,
|
|
382
382
|
{
|
|
383
|
-
className:
|
|
383
|
+
className: x(
|
|
384
384
|
"h-[26px] items-center justify-center rounded px-4",
|
|
385
385
|
e ? "bg-positive-light-2 bg-opacity-10" : "bg-light-6"
|
|
386
386
|
),
|
|
@@ -405,7 +405,7 @@ const We = ({ expandable: e, expanded: t, onExpand: n }) => {
|
|
|
405
405
|
s,
|
|
406
406
|
{
|
|
407
407
|
style: n,
|
|
408
|
-
className:
|
|
408
|
+
className: x(
|
|
409
409
|
"w-full",
|
|
410
410
|
t === "start" && "justify-start",
|
|
411
411
|
t === "center" && "justify-center",
|
|
@@ -460,9 +460,9 @@ const We = ({ expandable: e, expanded: t, onExpand: n }) => {
|
|
|
460
460
|
}
|
|
461
461
|
},
|
|
462
462
|
e ?? {}
|
|
463
|
-
), Ye =
|
|
463
|
+
), Ye = x(
|
|
464
464
|
"[&_th]:!border-t h-full [&_.ant-spin-nested-loading]:h-full [&_.ant-spin-container]:h-full [&_.ant-table]:h-full [&_.ant-spin-container]:flex [&_.ant-spin-container]:flex-col [&_.ant-spin-container]:justify-between [&_.ant-table-column-title]:flex-[0] [&_th]:!border-t-light-7 [&_th]:!pt-4 [&_th]:!pb-1 [&_.ant-table-selection-column]:!ps-4 [&_.ant-table-wrapper]:!p-0 [&_.ant-table-measure-row]:!h-[1px] [&_.ant-table-body]:h-full [&_.ant-table-container]:h-full"
|
|
465
|
-
), Ue =
|
|
465
|
+
), Ue = x(
|
|
466
466
|
"[&_th]:!bg-transparent h-full [&_th]:!border-t-0 [&_td]:!bg-transparent "
|
|
467
467
|
), Ze = {
|
|
468
468
|
small: "h-[40px] max-h-[40px] min-h-[40px]",
|
|
@@ -574,7 +574,7 @@ function or({
|
|
|
574
574
|
const { isSmallerThanMedium: d } = Te(), g = ze(), [c] = Be(), [f, w] = Ee(
|
|
575
575
|
Z,
|
|
576
576
|
t
|
|
577
|
-
), [p,
|
|
577
|
+
), [p, C] = O(0), { i18n: R } = H(), [{ current: _, order: T, orderBy: P, pageSize: N, filters: A }, $] = Se(
|
|
578
578
|
nr,
|
|
579
579
|
{
|
|
580
580
|
...tr,
|
|
@@ -600,13 +600,13 @@ function or({
|
|
|
600
600
|
[t, w]
|
|
601
601
|
), I = (b, B) => {
|
|
602
602
|
$({ type: ee, payload: { current: b, pageSize: B } });
|
|
603
|
-
}, h = (b) =>
|
|
603
|
+
}, h = (b) => C(b || t);
|
|
604
604
|
W(() => {
|
|
605
|
-
n && g({ search: `?${X}=${
|
|
606
|
-
}, [
|
|
605
|
+
n && g({ search: `?${X}=${_}` }, { replace: !0 });
|
|
606
|
+
}, [_, n]);
|
|
607
607
|
const k = {
|
|
608
608
|
total: p,
|
|
609
|
-
current:
|
|
609
|
+
current: _,
|
|
610
610
|
pageSize: N,
|
|
611
611
|
defaultCurrent: e,
|
|
612
612
|
defaultPageSize: t,
|
|
@@ -630,12 +630,12 @@ function or({
|
|
|
630
630
|
showQuickJumper: !0,
|
|
631
631
|
rootClassName: "flex items-center [&_.ant-select-dropdown]:!p-0 [&_.ant-pagination-options]:flex [&_.ant-pagination-options]:items-center [&_.ant-pagination-options]:justify-between [&_.ant-pagination-options]:flex-1",
|
|
632
632
|
// selectComponentClass: () => SelectComponentClass({ filters, onChange, pageSize, pagination }),
|
|
633
|
-
itemRender: (b, B) => er({ current:
|
|
633
|
+
itemRender: (b, B) => er({ current: _, page: b, type: B, isFa: R.language === "fa" }),
|
|
634
634
|
...l
|
|
635
635
|
};
|
|
636
636
|
return {
|
|
637
637
|
filters: A,
|
|
638
|
-
current:
|
|
638
|
+
current: _,
|
|
639
639
|
pageSize: N,
|
|
640
640
|
pagination: k,
|
|
641
641
|
order: T,
|
|
@@ -657,11 +657,11 @@ const E = ({
|
|
|
657
657
|
extraHeight: f = 100,
|
|
658
658
|
footer: w,
|
|
659
659
|
theme: p,
|
|
660
|
-
dndSort:
|
|
660
|
+
dndSort: C,
|
|
661
661
|
components: R,
|
|
662
|
-
...
|
|
662
|
+
..._
|
|
663
663
|
}) => {
|
|
664
|
-
const [T, P] = O(), N =
|
|
664
|
+
const [T, P] = O(), N = xe(null);
|
|
665
665
|
W(() => {
|
|
666
666
|
N.current && P(
|
|
667
667
|
window.innerHeight - N.current.offsetTop - 46 - (l ? 65 : 0) - f
|
|
@@ -687,13 +687,13 @@ const E = ({
|
|
|
687
687
|
return (h || [])?.flatMap((k) => y(k));
|
|
688
688
|
}
|
|
689
689
|
return y(t);
|
|
690
|
-
}, [t]), $ = ({ children: y }) =>
|
|
690
|
+
}, [t]), $ = ({ children: y }) => C === void 0 ? /* @__PURE__ */ r(F, { children: y }) : /* @__PURE__ */ r(
|
|
691
691
|
Ke,
|
|
692
692
|
{
|
|
693
693
|
children: y,
|
|
694
|
-
onDragEnd:
|
|
695
|
-
dataSource:
|
|
696
|
-
rowKey:
|
|
694
|
+
onDragEnd: C.onDragEnd,
|
|
695
|
+
dataSource: _.dataSource,
|
|
696
|
+
rowKey: _.rowKey
|
|
697
697
|
}
|
|
698
698
|
);
|
|
699
699
|
return /* @__PURE__ */ r(Q, { theme: Je(p), children: /* @__PURE__ */ r($, { children: /* @__PURE__ */ u(
|
|
@@ -705,7 +705,7 @@ const E = ({
|
|
|
705
705
|
spinning: !!d
|
|
706
706
|
},
|
|
707
707
|
scroll: c ? { y: T } : void 0,
|
|
708
|
-
className:
|
|
708
|
+
className: x(
|
|
709
709
|
Ye,
|
|
710
710
|
"abrplus-table-custom-scroll-bar w-full !animate-none [&_.ant-table-thead_th]:!pt-2",
|
|
711
711
|
!!n && !!a && "[&_.ant-table-selection-column]:!ps-0",
|
|
@@ -727,10 +727,10 @@ const E = ({
|
|
|
727
727
|
} : void 0,
|
|
728
728
|
pagination: l,
|
|
729
729
|
footer: w,
|
|
730
|
-
components:
|
|
731
|
-
...
|
|
730
|
+
components: C ? { body: { row: qe } } : R,
|
|
731
|
+
..._,
|
|
732
732
|
children: [
|
|
733
|
-
|
|
733
|
+
C && /* @__PURE__ */ r(E.Column, { align: "center", width: 80, render: () => /* @__PURE__ */ r(Xe, {}) }, "sort"),
|
|
734
734
|
A.map(
|
|
735
735
|
({
|
|
736
736
|
render: y,
|
|
@@ -748,7 +748,7 @@ const E = ({
|
|
|
748
748
|
{
|
|
749
749
|
...te,
|
|
750
750
|
dataIndex: h?.toString(),
|
|
751
|
-
className:
|
|
751
|
+
className: x("h-[56px] [&_.ant-table-column-title]:!flex-1", j),
|
|
752
752
|
title: /* @__PURE__ */ u(
|
|
753
753
|
s,
|
|
754
754
|
{
|
|
@@ -771,7 +771,7 @@ const E = ({
|
|
|
771
771
|
render: (M, ne, oe) => /* @__PURE__ */ r(
|
|
772
772
|
s,
|
|
773
773
|
{
|
|
774
|
-
className:
|
|
774
|
+
className: x("items-center", Ze[i || "large"]),
|
|
775
775
|
style: {
|
|
776
776
|
wordWrap: "break-word",
|
|
777
777
|
wordBreak: "break-word",
|
|
@@ -786,7 +786,7 @@ const E = ({
|
|
|
786
786
|
{
|
|
787
787
|
vertical: !0,
|
|
788
788
|
...J,
|
|
789
|
-
className:
|
|
789
|
+
className: x(
|
|
790
790
|
"table-filters-sort flex-[4] ps-2",
|
|
791
791
|
J?.className
|
|
792
792
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogoProps } from '
|
|
1
|
+
import { LogoProps } from '../../molecules';
|
|
2
2
|
import { FlexProps } from '../../antOverrides';
|
|
3
3
|
import { PopoverProps } from '../../atoms';
|
|
4
4
|
export interface AvatarGroupItemType {
|
|
@@ -8,7 +8,7 @@ export interface AvatarGroupItemType {
|
|
|
8
8
|
}
|
|
9
9
|
export interface AvatarGroupItemsProps<T extends AvatarGroupItemType = AvatarGroupItemType> {
|
|
10
10
|
items: T[];
|
|
11
|
-
renderItem?: (item: T) => JSX.Element;
|
|
11
|
+
renderItem?: (item: T, index: number) => JSX.Element;
|
|
12
12
|
max?: number;
|
|
13
13
|
avatarProps?: {
|
|
14
14
|
size?: number;
|