dgz-ui-shared 1.0.64 → 1.0.66

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.
@@ -1,21 +1,21 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../jsx-runtime-DUiatUiq.cjs"),W=require("../../button-Bp2lHjov-D9UnCnYX.cjs"),u=require("../../dropdown-menu-BPBcxHRB-towSSPIs.cjs"),L=require("../../MyLimitSelect-BFWr_fUn.cjs"),T=require("../../FilterWrapper-DiuKsyOG.cjs"),c=require("react"),y=require("../../lodash-C5w_OPmE.cjs"),j=require("../../index-DqTIeHVj-DlSOwhuZ.cjs"),d=require("../../utils-B6fNqzRf-BNysSCt9.cjs"),A=require("../../useSortable-Dx_e142l.cjs"),D=require("../../radio-group-CqPTye2U-CXc2TUFE.cjs"),$=require("../../SortOrder-81BrXp3i.cjs"),O=require("../../Empty--unTFnpg.cjs"),I=require("../../createLucideIcon-BnAj0RnC.cjs"),G=require("../../Loader-bUUShWXh.cjs"),J=require("../../useTranslation-CZf20ucv.cjs"),B=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("table",{ref:r,className:d.mo("w-full caption-bottom text-sm",s),...t}));B.displayName="Table";const H=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("thead",{ref:r,className:d.mo("[&_tr]:border-b",s),...t}));H.displayName="TableHeader";const C=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("tbody",{ref:r,className:d.mo("[&_tr:last-child]:border-0",s),...t}));C.displayName="TableBody";const Q=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("tfoot",{ref:r,className:d.mo("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",s),...t}));Q.displayName="TableFooter";const M=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("tr",{ref:r,className:d.mo("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...t}));M.displayName="TableRow";const q=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("th",{ref:r,className:d.mo("text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0",s),...t}));q.displayName="TableHead";const N=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("td",{ref:r,className:d.mo("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...t}));N.displayName="TableCell";const S=c.forwardRef(({className:s,...t},r)=>j.ae.jsx("caption",{ref:r,className:d.mo("text-muted-foreground mt-4 text-sm",s),...t}));S.displayName="TableCaption";/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../jsx-runtime-DUiatUiq.cjs"),O=require("../../button-Bp2lHjov-D9UnCnYX.cjs"),R=require("../../dropdown-menu-BPBcxHRB-towSSPIs.cjs"),L=require("../../MyLimitSelect-BFWr_fUn.cjs"),T=require("../../FilterWrapper-DiuKsyOG.cjs"),a=require("react"),E=require("../../lodash-C5w_OPmE.cjs"),m=require("../../index-DqTIeHVj-DlSOwhuZ.cjs"),n=require("../../utils-B6fNqzRf-BNysSCt9.cjs"),D=require("../../useSortable-Dx_e142l.cjs"),F=require("../../radio-group-CqPTye2U-CXc2TUFE.cjs"),$=require("../../SortOrder-81BrXp3i.cjs"),G=require("../../Empty--unTFnpg.cjs"),I=require("../../createLucideIcon-BnAj0RnC.cjs"),J=require("../../Loader-bUUShWXh.cjs"),Q=require("../../useTranslation-CZf20ucv.cjs"),B=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("table",{ref:i,className:n.mo("w-full caption-bottom text-sm",s),...t}));B.displayName="Table";const H=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("thead",{ref:i,className:n.mo("[&_tr]:border-b",s),...t}));H.displayName="TableHeader";const U=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("tbody",{ref:i,className:n.mo("[&_tr:last-child]:border-0",s),...t}));U.displayName="TableBody";const X=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("tfoot",{ref:i,className:n.mo("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",s),...t}));X.displayName="TableFooter";const M=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("tr",{ref:i,className:n.mo("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...t}));M.displayName="TableRow";const q=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("th",{ref:i,className:n.mo("text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0",s),...t}));q.displayName="TableHead";const b=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("td",{ref:i,className:n.mo("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...t}));b.displayName="TableCell";const Y=a.forwardRef(({className:s,...t},i)=>m.ae.jsx("caption",{ref:i,className:n.mo("text-muted-foreground mt-4 text-sm",s),...t}));Y.displayName="TableCaption";/**
2
2
  * @license lucide-react v0.511.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const X=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],Y=I.createLucideIcon("arrow-down-wide-narrow",X);/**
6
+ */const Z=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],K=I.createLucideIcon("arrow-down-wide-narrow",Z);/**
7
7
  * @license lucide-react v0.511.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Z=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],P=I.createLucideIcon("arrow-up-down",Z);/**
11
+ */const C=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],P=I.createLucideIcon("arrow-up-down",C);/**
12
12
  * @license lucide-react v0.511.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const K=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]],ee=I.createLucideIcon("arrow-up-wide-narrow",K);/**
16
+ */const ee=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]],se=I.createLucideIcon("arrow-up-wide-narrow",ee);/**
17
17
  * @license lucide-react v0.511.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const se=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],te=I.createLucideIcon("refresh-cw",se),U=({rows:s=[],columns:t,onRowClick:r,rowKey:p,params:a={page:1,limit:L.DEFAULT_LIMIT},hasNumbers:h=!1,hasCheckbox:f=!1,selectedItems:_,onSelectedItemsChange:g,onSortOrderChange:n,isStickyHeader:F})=>{const{sortObject:o,handleSort:R}=A.useSortable({sortField:a==null?void 0:a.sortField,sortOrder:a==null?void 0:a.sortField,onSortOrderChange:n}),{selectedRows:b,isRowSelected:m,isAllRowsSelected:w,handleSelectAllRows:k,handleSelectRow:v}=A.useDataTable({rows:s,defaultSelectedRows:_});return c.useEffect(()=>{g&&g(b)},[b]),e.jsxRuntimeExports.jsxs(B,{className:"relative",children:[e.jsxRuntimeExports.jsx(H,{className:d.mo("bg-bg",F&&"sticky top-0 z-10"),children:e.jsxRuntimeExports.jsxs(M,{children:[f&&e.jsxRuntimeExports.jsx(q,{className:"w-12 p-3",children:e.jsxRuntimeExports.jsx(D.Tl,{className:"mt-1",checked:w(p),onCheckedChange:i=>k(p,!!i),"aria-label":"Select all"})}),h&&e.jsxRuntimeExports.jsx(q,{className:"w-12 p-2",children:"#"}),t.filter(i=>!i.hidden).map(i=>e.jsxRuntimeExports.jsx(q,{style:i.styles,className:d.mo("p-2",i.sortable&&"cursor-pointer"),onClick:()=>R(i.dataIndex),children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[i.name," ",i.sortable&&((o==null?void 0:o.sortField)===i.key?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(o==null?void 0:o.sortOrder)===$.SortOrder.DESC&&e.jsxRuntimeExports.jsx(Y,{size:15}),(o==null?void 0:o.sortOrder)===$.SortOrder.ASC&&e.jsxRuntimeExports.jsx(ee,{size:15})]}):e.jsxRuntimeExports.jsx(P,{size:15}))]})},i.key))]})}),e.jsxRuntimeExports.jsx(C,{className:"[&>tr:nth-child(even)]:bg-bg-secondary",children:s.length?s.map((i,E)=>e.jsxRuntimeExports.jsxs(M,{onClick:()=>r==null?void 0:r(i),className:d.mo(r&&"cursor-pointer"),"data-state":m(i[p])&&"selected",children:[f&&e.jsxRuntimeExports.jsx(N,{className:"w-12 p-3",onClick:l=>l.stopPropagation(),children:e.jsxRuntimeExports.jsx(D.Tl,{className:"mt-1",checked:m(i[p]),onCheckedChange:l=>v(i[p],!!l),"aria-label":"Select row"})}),h&&e.jsxRuntimeExports.jsx(N,{className:"w-12 p-2",children:(a.page-1)*(a.limit||L.DEFAULT_LIMIT)+E+1}),t.filter(l=>!l.hidden).map(l=>e.jsxRuntimeExports.jsx(N,{className:"text-body-xs-medium max-w-xs overflow-hidden p-2 text-ellipsis",style:l.styles,children:l.render?l.render(y.lodashExports.get(i,l.dataIndex),i):y.lodashExports.get(i,l.dataIndex,"")},`${E}-${l.key}`))]},`${i[p]}`)):e.jsxRuntimeExports.jsx(M,{children:e.jsxRuntimeExports.jsx(N,{colSpan:h?f?t.length+2:t.length+1:t.length,children:e.jsxRuntimeExports.jsx(O.Empty,{})})})})]})},re=({dataSource:s,columns:t,onRowClick:r,rowKey:p,hasNumbers:a,hasSearch:h,hasCheckbox:f,hasPagination:_,isStickyHeader:g,onParamChange:n,loading:F,tableKey:o,filters:R=[],handleFilterChange:b,params:m,hasColumnsVisibilityDropdown:w})=>{const{t:k}=J.useTranslation(),[v,i]=c.useState([]),{formattedColumns:E,handleColumnsChange:l,resetColumns:V}=A.useColumns({key:o,columns:t});return e.jsxRuntimeExports.jsxs("div",{className:"border-border-alpha-light flex grow flex-col overflow-auto rounded-xl border shadow-xs",children:[(h||w&&o||!y.lodashExports.isEmpty(R))&&e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"w-full shrink",children:h&&e.jsxRuntimeExports.jsx(T.Search,{defaultValue:y.lodashExports.get(m,"search",""),onSearchChange:x=>({...m,search:x,page:1})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-3",children:[w&&o&&e.jsxRuntimeExports.jsxs(u.Nt,{children:[e.jsxRuntimeExports.jsx(u.jt,{asChild:!0,children:e.jsxRuntimeExports.jsxs(W.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[e.jsxRuntimeExports.jsx(T.yn,{})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:k("Customize columns")}),e.jsxRuntimeExports.jsx(T.f1,{})]})}),e.jsxRuntimeExports.jsxs(u.ut,{align:"end",children:[e.jsxRuntimeExports.jsxs(u.it,{className:"capitalize",onClick:V,children:[e.jsxRuntimeExports.jsx(te,{})," ",k("Reset columns")]}),e.jsxRuntimeExports.jsx(u.ft,{}),E.map(x=>e.jsxRuntimeExports.jsx(u.dt,{className:"capitalize",checked:!x.hidden,onCheckedChange:z=>l(x,!z),children:x.name},x.key))]})]}),!y.lodashExports.isEmpty(R)&&e.jsxRuntimeExports.jsx(T.FilterWrapper,{filters:R,onFilter:b})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col overflow-auto border-y",children:F?e.jsxRuntimeExports.jsx(G.Loader,{}):e.jsxRuntimeExports.jsx(U,{params:m,rows:s==null?void 0:s.docs,rowKey:p,selectedItems:v,isStickyHeader:g,columns:E,hasCheckbox:f,hasNumbers:a,onRowClick:r,onSelectedItemsChange:i,onSortOrderChange:({sortField:x,sortOrder:z})=>{n==null||n({...m,sortField:x,sortOrder:z})}})}),_&&e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 flex-col items-center justify-between gap-3 p-4 lg:flex-row",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm",children:e.jsxRuntimeExports.jsx(L.MyLimitSelect,{onLimitChange:x=>n==null?void 0:n({...m,limit:x,page:1}),defaultValue:s==null?void 0:s.limit})}),e.jsxRuntimeExports.jsxs("div",{className:"text-muted-foreground text-sm",children:[v.length," of ",(s==null?void 0:s.total)||0," row(s) selected."]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(L.MyPagination,{onPageChange:x=>n==null?void 0:n({...m,page:x}),currentPage:s==null?void 0:s.page,totalPages:s==null?void 0:s.totalPages})})]})]})};exports.DataTable=re;exports.MyTable=U;
21
+ */const te=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],re=I.createLucideIcon("refresh-cw",te),S=({rows:s=[],columns:t,onRowClick:i,rowKey:j,params:c={page:1,limit:L.DEFAULT_LIMIT},hasNumbers:u=!1,hasCheckbox:N=!1,selectedItems:_,onSelectedItemsChange:w,onSortOrderChange:l,isStickyHeader:z})=>{const{sortObject:d,handleSort:y}=D.useSortable({sortField:c==null?void 0:c.sortField,sortOrder:c==null?void 0:c.sortField,onSortOrderChange:l}),{selectedRows:h,isRowSelected:f,isAllRowsSelected:p,handleSelectAllRows:k,handleSelectRow:g}=D.useDataTable({rows:s,defaultSelectedRows:_});return a.useEffect(()=>{w&&w(h)},[h]),e.jsxRuntimeExports.jsxs(B,{className:"relative",children:[e.jsxRuntimeExports.jsx(H,{className:n.mo("bg-bg",z&&"sticky top-0 z-10"),children:e.jsxRuntimeExports.jsxs(M,{children:[N&&e.jsxRuntimeExports.jsx(q,{className:"w-12 p-3",children:e.jsxRuntimeExports.jsx(F.Tl,{className:"mt-1",checked:p(j),onCheckedChange:r=>k(j,!!r),"aria-label":"Select all"})}),u&&e.jsxRuntimeExports.jsx(q,{className:"w-12 p-2",children:"#"}),t.filter(r=>!r.hidden).map(r=>e.jsxRuntimeExports.jsx(q,{style:r.styles,className:n.mo("p-2",r.sortable&&"cursor-pointer"),onClick:()=>y(r.dataIndex),children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[r.name," ",r.sortable&&((d==null?void 0:d.sortField)===r.key?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(d==null?void 0:d.sortOrder)===$.SortOrder.DESC&&e.jsxRuntimeExports.jsx(K,{size:15}),(d==null?void 0:d.sortOrder)===$.SortOrder.ASC&&e.jsxRuntimeExports.jsx(se,{size:15})]}):e.jsxRuntimeExports.jsx(P,{size:15}))]})},r.key))]})}),e.jsxRuntimeExports.jsx(U,{className:"[&>tr:nth-child(even)]:bg-bg-secondary",children:s.length?s.map((r,v)=>e.jsxRuntimeExports.jsxs(M,{onClick:()=>i==null?void 0:i(r),className:n.mo(i&&"cursor-pointer"),"data-state":f(r[j])&&"selected",children:[N&&e.jsxRuntimeExports.jsx(b,{className:"w-12 p-3",onClick:x=>x.stopPropagation(),children:e.jsxRuntimeExports.jsx(F.Tl,{className:"mt-1",checked:f(r[j]),onCheckedChange:x=>g(r[j],!!x),"aria-label":"Select row"})}),u&&e.jsxRuntimeExports.jsx(b,{className:"w-12 p-2",children:(c.page-1)*(c.limit||L.DEFAULT_LIMIT)+v+1}),t.filter(x=>!x.hidden).map(x=>e.jsxRuntimeExports.jsx(b,{className:"text-body-xs-medium max-w-xs overflow-hidden p-2 text-ellipsis",style:x.styles,children:x.render?x.render(E.lodashExports.get(r,x.dataIndex),r):E.lodashExports.get(r,x.dataIndex,"")},`${v}-${x.key}`))]},`${r[j]}`)):e.jsxRuntimeExports.jsx(M,{children:e.jsxRuntimeExports.jsx(b,{colSpan:u?N?t.length+2:t.length+1:t.length,children:e.jsxRuntimeExports.jsx(G.Empty,{})})})})]})},ie=({dataSource:s,columns:t,onRowClick:i,rowKey:j,hasNumbers:c,hasSearch:u,hasCheckbox:N,hasPagination:_,isStickyHeader:w,onParamChange:l,dataKey:z="docs",loading:d,tableKey:y,filters:h=[],handleFilterChange:f,params:p,hasColumnsVisibilityDropdown:k})=>{const{t:g}=Q.useTranslation(),[r,v]=a.useState([]),{formattedColumns:x,handleColumnsChange:V,resetColumns:W}=D.useColumns({key:y,columns:t});return e.jsxRuntimeExports.jsxs("div",{className:"border-border-alpha-light flex grow flex-col overflow-auto rounded-xl border shadow-xs",children:[(u||k&&y||!E.lodashExports.isEmpty(h))&&e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"w-full shrink",children:u&&e.jsxRuntimeExports.jsx(T.Search,{defaultValue:E.lodashExports.get(p,"search",""),onSearchChange:o=>l==null?void 0:l({...p,search:o,page:1})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-3",children:[k&&y&&e.jsxRuntimeExports.jsxs(R.Nt,{children:[e.jsxRuntimeExports.jsx(R.jt,{asChild:!0,children:e.jsxRuntimeExports.jsxs(O.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[e.jsxRuntimeExports.jsx(T.yn,{})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:g("Customize columns")}),e.jsxRuntimeExports.jsx(T.f1,{})]})}),e.jsxRuntimeExports.jsxs(R.ut,{align:"end",children:[e.jsxRuntimeExports.jsxs(R.it,{className:"capitalize",onClick:W,children:[e.jsxRuntimeExports.jsx(re,{})," ",g("Reset columns")]}),e.jsxRuntimeExports.jsx(R.ft,{}),x.map(o=>e.jsxRuntimeExports.jsx(R.dt,{className:"capitalize",checked:!o.hidden,onCheckedChange:A=>V(o,!A),children:o.name},o.key))]})]}),!E.lodashExports.isEmpty(h)&&e.jsxRuntimeExports.jsx(T.FilterWrapper,{filters:h,onFilter:o=>{l==null||l({...p,...o,page:1}),f==null||f(o)}})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col overflow-auto border-y",children:d?e.jsxRuntimeExports.jsx(J.Loader,{}):e.jsxRuntimeExports.jsx(S,{params:p,rows:E.lodashExports.get(s,z,[]),rowKey:j,selectedItems:r,isStickyHeader:w,columns:x,hasCheckbox:N,hasNumbers:c,onRowClick:i,onSelectedItemsChange:v,onSortOrderChange:({sortField:o,sortOrder:A})=>{l==null||l({...p,sortField:o,sortOrder:A})}})}),_&&e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 flex-col items-center justify-between gap-3 p-4 lg:flex-row",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm",children:e.jsxRuntimeExports.jsx(L.MyLimitSelect,{onLimitChange:o=>l==null?void 0:l({...p,limit:o,page:1}),defaultValue:s==null?void 0:s.limit})}),e.jsxRuntimeExports.jsxs("div",{className:"text-muted-foreground text-sm",children:[r.length," of ",(s==null?void 0:s.total)||0," row(s) selected."]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(L.MyPagination,{onPageChange:o=>l==null?void 0:l({...p,page:o}),currentPage:s==null?void 0:s.page,totalPages:s==null?void 0:s.totalPages})})]})]})};exports.DataTable=ie;exports.MyTable=S;
@@ -1,45 +1,45 @@
1
1
  import { j as e } from "../../jsx-runtime-C5mzlN2N.js";
2
- import { u as H } from "../../button-Bp2lHjov-BTlHPcva.js";
3
- import { N as U, j as V, u as W, i as B, f as G, d as J } from "../../dropdown-menu-BPBcxHRB-EjT0ADL9.js";
4
- import { D as R, a as O, M as Q } from "../../MyLimitSelect-Bzc40bxS.js";
5
- import { S as X, y as Y, f as Z, F as S } from "../../FilterWrapper-DwZpntbw.js";
6
- import { forwardRef as h, useEffect as K, useState as P } from "react";
7
- import { l as k } from "../../lodash-CYNxjS-I.js";
8
- import { a as p } from "../../index-DqTIeHVj-CeLMF2B2.js";
2
+ import { u as V } from "../../button-Bp2lHjov-BTlHPcva.js";
3
+ import { N as W, j as B, u as G, i as J, f as O, d as Q } from "../../dropdown-menu-BPBcxHRB-EjT0ADL9.js";
4
+ import { D as A, a as S, M as X } from "../../MyLimitSelect-Bzc40bxS.js";
5
+ import { S as Y, y as Z, f as K, F as C } from "../../FilterWrapper-DwZpntbw.js";
6
+ import { forwardRef as p, useEffect as P, useState as ee } from "react";
7
+ import { l as y } from "../../lodash-CYNxjS-I.js";
8
+ import { a as h } from "../../index-DqTIeHVj-CeLMF2B2.js";
9
9
  import { m as o } from "../../utils-B6fNqzRf-B1_jG1K7.js";
10
- import { u as ee, a as se, b as te } from "../../useSortable-QB1cZsY8.js";
11
- import { T as A } from "../../radio-group-CqPTye2U-DGs9dBuR.js";
12
- import { S as I } from "../../SortOrder-CwuehjY1.js";
13
- import { E as le } from "../../Empty--aMfJ9Jw.js";
14
- import { c as F } from "../../createLucideIcon-B950nf2d.js";
15
- import { L as de } from "../../Loader-CVKJNLck.js";
16
- import { u as ie } from "../../useTranslation-dH-uwymc.js";
17
- const D = h(
18
- ({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
10
+ import { u as se, a as te, b as le } from "../../useSortable-QB1cZsY8.js";
11
+ import { T as I } from "../../radio-group-CqPTye2U-DGs9dBuR.js";
12
+ import { S as D } from "../../SortOrder-CwuehjY1.js";
13
+ import { E as de } from "../../Empty--aMfJ9Jw.js";
14
+ import { c as E } from "../../createLucideIcon-B950nf2d.js";
15
+ import { L as ie } from "../../Loader-CVKJNLck.js";
16
+ import { u as re } from "../../useTranslation-dH-uwymc.js";
17
+ const F = p(
18
+ ({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
19
19
  "table",
20
20
  {
21
- ref: l,
21
+ ref: d,
22
22
  className: o("w-full caption-bottom text-sm", s),
23
23
  ...t
24
24
  }
25
25
  )
26
26
  );
27
- D.displayName = "Table";
28
- const $ = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx("thead", { ref: l, className: o("[&_tr]:border-b", s), ...t }));
27
+ F.displayName = "Table";
28
+ const $ = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx("thead", { ref: d, className: o("[&_tr]:border-b", s), ...t }));
29
29
  $.displayName = "TableHeader";
30
- const C = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
30
+ const q = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
31
31
  "tbody",
32
32
  {
33
- ref: l,
33
+ ref: d,
34
34
  className: o("[&_tr:last-child]:border-0", s),
35
35
  ...t
36
36
  }
37
37
  ));
38
- C.displayName = "TableBody";
39
- const ae = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
38
+ q.displayName = "TableBody";
39
+ const ce = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
40
40
  "tfoot",
41
41
  {
42
- ref: l,
42
+ ref: d,
43
43
  className: o(
44
44
  "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
45
45
  s
@@ -47,11 +47,11 @@ const ae = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
47
47
  ...t
48
48
  }
49
49
  ));
50
- ae.displayName = "TableFooter";
51
- const T = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
50
+ ce.displayName = "TableFooter";
51
+ const T = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
52
52
  "tr",
53
53
  {
54
- ref: l,
54
+ ref: d,
55
55
  className: o(
56
56
  "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
57
57
  s
@@ -60,10 +60,10 @@ const T = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
60
60
  }
61
61
  ));
62
62
  T.displayName = "TableRow";
63
- const _ = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
63
+ const _ = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
64
64
  "th",
65
65
  {
66
- ref: l,
66
+ ref: d,
67
67
  className: o(
68
68
  "text-muted-foreground h-12 px-4 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0",
69
69
  s
@@ -72,37 +72,37 @@ const _ = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
72
72
  }
73
73
  ));
74
74
  _.displayName = "TableHead";
75
- const g = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
75
+ const w = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
76
76
  "td",
77
77
  {
78
- ref: l,
78
+ ref: d,
79
79
  className: o("p-4 align-middle [&:has([role=checkbox])]:pr-0", s),
80
80
  ...t
81
81
  }
82
82
  ));
83
- g.displayName = "TableCell";
84
- const re = h(({ className: s, ...t }, l) => /* @__PURE__ */ p.jsx(
83
+ w.displayName = "TableCell";
84
+ const ae = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
85
85
  "caption",
86
86
  {
87
- ref: l,
87
+ ref: d,
88
88
  className: o("text-muted-foreground mt-4 text-sm", s),
89
89
  ...t
90
90
  }
91
91
  ));
92
- re.displayName = "TableCaption";
92
+ ae.displayName = "TableCaption";
93
93
  /**
94
94
  * @license lucide-react v0.511.0 - ISC
95
95
  *
96
96
  * This source code is licensed under the ISC license.
97
97
  * See the LICENSE file in the root directory of this source tree.
98
98
  */
99
- const ce = [
99
+ const oe = [
100
100
  ["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
101
101
  ["path", { d: "M7 20V4", key: "1yoxec" }],
102
102
  ["path", { d: "M11 4h10", key: "1w87gc" }],
103
103
  ["path", { d: "M11 8h7", key: "djye34" }],
104
104
  ["path", { d: "M11 12h4", key: "q8tih4" }]
105
- ], oe = F("arrow-down-wide-narrow", ce);
105
+ ], xe = E("arrow-down-wide-narrow", oe);
106
106
  /**
107
107
  * @license lucide-react v0.511.0 - ISC
108
108
  *
@@ -114,253 +114,262 @@ const ne = [
114
114
  ["path", { d: "M17 20V4", key: "1ejh1v" }],
115
115
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
116
116
  ["path", { d: "M7 4v16", key: "1glfcx" }]
117
- ], me = F("arrow-up-down", ne);
117
+ ], me = E("arrow-up-down", ne);
118
118
  /**
119
119
  * @license lucide-react v0.511.0 - ISC
120
120
  *
121
121
  * This source code is licensed under the ISC license.
122
122
  * See the LICENSE file in the root directory of this source tree.
123
123
  */
124
- const xe = [
124
+ const pe = [
125
125
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
126
126
  ["path", { d: "M7 4v16", key: "1glfcx" }],
127
127
  ["path", { d: "M11 12h10", key: "1438ji" }],
128
128
  ["path", { d: "M11 16h7", key: "uosisv" }],
129
129
  ["path", { d: "M11 20h4", key: "1krc32" }]
130
- ], he = F("arrow-up-wide-narrow", xe);
130
+ ], he = E("arrow-up-wide-narrow", pe);
131
131
  /**
132
132
  * @license lucide-react v0.511.0 - ISC
133
133
  *
134
134
  * This source code is licensed under the ISC license.
135
135
  * See the LICENSE file in the root directory of this source tree.
136
136
  */
137
- const pe = [
137
+ const fe = [
138
138
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
139
139
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
140
140
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
141
141
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
142
- ], fe = F("refresh-cw", pe), je = ({
142
+ ], je = E("refresh-cw", fe), Ne = ({
143
143
  rows: s = [],
144
144
  columns: t,
145
- onRowClick: l,
146
- rowKey: x,
147
- params: n = {
145
+ onRowClick: d,
146
+ rowKey: m,
147
+ params: x = {
148
148
  page: 1,
149
- limit: R
149
+ limit: A
150
150
  },
151
151
  hasNumbers: f = !1,
152
- hasCheckbox: j = !1,
153
- selectedItems: E,
154
- onSelectedItemsChange: b,
155
- onSortOrderChange: c,
156
- isStickyHeader: L
152
+ hasCheckbox: k = !1,
153
+ selectedItems: L,
154
+ onSelectedItemsChange: g,
155
+ onSortOrderChange: i,
156
+ isStickyHeader: z
157
157
  }) => {
158
- const { sortObject: a, handleSort: N } = ee({
159
- sortField: n == null ? void 0 : n.sortField,
160
- sortOrder: n == null ? void 0 : n.sortField,
161
- onSortOrderChange: c
158
+ const { sortObject: a, handleSort: b } = se({
159
+ sortField: x == null ? void 0 : x.sortField,
160
+ sortOrder: x == null ? void 0 : x.sortField,
161
+ onSortOrderChange: i
162
162
  }), {
163
- selectedRows: w,
164
- isRowSelected: m,
165
- isAllRowsSelected: v,
166
- handleSelectAllRows: M,
163
+ selectedRows: j,
164
+ isRowSelected: N,
165
+ isAllRowsSelected: n,
166
+ handleSelectAllRows: v,
167
167
  handleSelectRow: u
168
- } = se({ rows: s, defaultSelectedRows: E });
169
- return K(() => {
170
- b && b(w);
171
- }, [w]), /* @__PURE__ */ e.jsxs(D, { className: "relative", children: [
168
+ } = te({ rows: s, defaultSelectedRows: L });
169
+ return P(() => {
170
+ g && g(j);
171
+ }, [j]), /* @__PURE__ */ e.jsxs(F, { className: "relative", children: [
172
172
  /* @__PURE__ */ e.jsx(
173
173
  $,
174
174
  {
175
- className: o("bg-bg", L && "sticky top-0 z-10"),
175
+ className: o("bg-bg", z && "sticky top-0 z-10"),
176
176
  children: /* @__PURE__ */ e.jsxs(T, { children: [
177
- j && /* @__PURE__ */ e.jsx(_, { className: "w-12 p-3", children: /* @__PURE__ */ e.jsx(
178
- A,
177
+ k && /* @__PURE__ */ e.jsx(_, { className: "w-12 p-3", children: /* @__PURE__ */ e.jsx(
178
+ I,
179
179
  {
180
180
  className: "mt-1",
181
- checked: v(x),
182
- onCheckedChange: (d) => M(x, !!d),
181
+ checked: n(m),
182
+ onCheckedChange: (l) => v(m, !!l),
183
183
  "aria-label": "Select all"
184
184
  }
185
185
  ) }),
186
186
  f && /* @__PURE__ */ e.jsx(_, { className: "w-12 p-2", children: "#" }),
187
- t.filter((d) => !d.hidden).map((d) => /* @__PURE__ */ e.jsx(
187
+ t.filter((l) => !l.hidden).map((l) => /* @__PURE__ */ e.jsx(
188
188
  _,
189
189
  {
190
- style: d.styles,
191
- className: o("p-2", d.sortable && "cursor-pointer"),
192
- onClick: () => N(d.dataIndex),
190
+ style: l.styles,
191
+ className: o("p-2", l.sortable && "cursor-pointer"),
192
+ onClick: () => b(l.dataIndex),
193
193
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
194
- d.name,
194
+ l.name,
195
195
  " ",
196
- d.sortable && ((a == null ? void 0 : a.sortField) === d.key ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
197
- (a == null ? void 0 : a.sortOrder) === I.DESC && /* @__PURE__ */ e.jsx(oe, { size: 15 }),
198
- (a == null ? void 0 : a.sortOrder) === I.ASC && /* @__PURE__ */ e.jsx(he, { size: 15 })
196
+ l.sortable && ((a == null ? void 0 : a.sortField) === l.key ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
197
+ (a == null ? void 0 : a.sortOrder) === D.DESC && /* @__PURE__ */ e.jsx(xe, { size: 15 }),
198
+ (a == null ? void 0 : a.sortOrder) === D.ASC && /* @__PURE__ */ e.jsx(he, { size: 15 })
199
199
  ] }) : /* @__PURE__ */ e.jsx(me, { size: 15 }))
200
200
  ] })
201
201
  },
202
- d.key
202
+ l.key
203
203
  ))
204
204
  ] })
205
205
  }
206
206
  ),
207
- /* @__PURE__ */ e.jsx(C, { className: "[&>tr:nth-child(even)]:bg-bg-secondary", children: s.length ? s.map((d, y) => /* @__PURE__ */ e.jsxs(
207
+ /* @__PURE__ */ e.jsx(q, { className: "[&>tr:nth-child(even)]:bg-bg-secondary", children: s.length ? s.map((l, M) => /* @__PURE__ */ e.jsxs(
208
208
  T,
209
209
  {
210
- onClick: () => l == null ? void 0 : l(d),
211
- className: o(l && "cursor-pointer"),
212
- "data-state": m(d[x]) && "selected",
210
+ onClick: () => d == null ? void 0 : d(l),
211
+ className: o(d && "cursor-pointer"),
212
+ "data-state": N(l[m]) && "selected",
213
213
  children: [
214
- j && /* @__PURE__ */ e.jsx(
215
- g,
214
+ k && /* @__PURE__ */ e.jsx(
215
+ w,
216
216
  {
217
217
  className: "w-12 p-3",
218
- onClick: (i) => i.stopPropagation(),
218
+ onClick: (r) => r.stopPropagation(),
219
219
  children: /* @__PURE__ */ e.jsx(
220
- A,
220
+ I,
221
221
  {
222
222
  className: "mt-1",
223
- checked: m(d[x]),
224
- onCheckedChange: (i) => u(d[x], !!i),
223
+ checked: N(l[m]),
224
+ onCheckedChange: (r) => u(l[m], !!r),
225
225
  "aria-label": "Select row"
226
226
  }
227
227
  )
228
228
  }
229
229
  ),
230
- f && /* @__PURE__ */ e.jsx(g, { className: "w-12 p-2", children: (n.page - 1) * (n.limit || R) + y + 1 }),
231
- t.filter((i) => !i.hidden).map((i) => /* @__PURE__ */ e.jsx(
232
- g,
230
+ f && /* @__PURE__ */ e.jsx(w, { className: "w-12 p-2", children: (x.page - 1) * (x.limit || A) + M + 1 }),
231
+ t.filter((r) => !r.hidden).map((r) => /* @__PURE__ */ e.jsx(
232
+ w,
233
233
  {
234
234
  className: "text-body-xs-medium max-w-xs overflow-hidden p-2 text-ellipsis",
235
- style: i.styles,
236
- children: i.render ? i.render(k.get(d, i.dataIndex), d) : k.get(d, i.dataIndex, "")
235
+ style: r.styles,
236
+ children: r.render ? r.render(y.get(l, r.dataIndex), l) : y.get(l, r.dataIndex, "")
237
237
  },
238
- `${y}-${i.key}`
238
+ `${M}-${r.key}`
239
239
  ))
240
240
  ]
241
241
  },
242
- `${d[x]}`
242
+ `${l[m]}`
243
243
  )) : /* @__PURE__ */ e.jsx(T, { children: /* @__PURE__ */ e.jsx(
244
- g,
244
+ w,
245
245
  {
246
- colSpan: f ? j ? t.length + 2 : t.length + 1 : t.length,
247
- children: /* @__PURE__ */ e.jsx(le, {})
246
+ colSpan: f ? k ? t.length + 2 : t.length + 1 : t.length,
247
+ children: /* @__PURE__ */ e.jsx(de, {})
248
248
  }
249
249
  ) }) })
250
250
  ] });
251
- }, Ae = ({
251
+ }, De = ({
252
252
  dataSource: s,
253
253
  columns: t,
254
- onRowClick: l,
255
- rowKey: x,
256
- hasNumbers: n,
254
+ onRowClick: d,
255
+ rowKey: m,
256
+ hasNumbers: x,
257
257
  hasSearch: f,
258
- hasCheckbox: j,
259
- hasPagination: E,
260
- isStickyHeader: b,
261
- onParamChange: c,
262
- loading: L,
263
- tableKey: a,
264
- filters: N = [],
265
- handleFilterChange: w,
266
- params: m,
258
+ hasCheckbox: k,
259
+ hasPagination: L,
260
+ isStickyHeader: g,
261
+ onParamChange: i,
262
+ dataKey: z = "docs",
263
+ loading: a,
264
+ tableKey: b,
265
+ filters: j = [],
266
+ handleFilterChange: N,
267
+ params: n,
267
268
  hasColumnsVisibilityDropdown: v
268
269
  }) => {
269
- const { t: M } = ie(), [u, d] = P([]), { formattedColumns: y, handleColumnsChange: i, resetColumns: q } = te({ key: a, columns: t });
270
+ const { t: u } = re(), [l, M] = ee([]), { formattedColumns: r, handleColumnsChange: H, resetColumns: U } = le({ key: b, columns: t });
270
271
  return /* @__PURE__ */ e.jsxs(
271
272
  "div",
272
273
  {
273
274
  className: "border-border-alpha-light flex grow flex-col overflow-auto rounded-xl border shadow-xs",
274
275
  children: [
275
- (f || v && a || !k.isEmpty(N)) && /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 p-4", children: [
276
+ (f || v && b || !y.isEmpty(j)) && /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 p-4", children: [
276
277
  /* @__PURE__ */ e.jsx("div", { className: "w-full shrink", children: f && /* @__PURE__ */ e.jsx(
277
- X,
278
+ Y,
278
279
  {
279
- defaultValue: k.get(m, "search", ""),
280
- onSearchChange: (r) => ({ ...m, search: r, page: 1 })
280
+ defaultValue: y.get(n, "search", ""),
281
+ onSearchChange: (c) => i == null ? void 0 : i({ ...n, search: c, page: 1 })
281
282
  }
282
283
  ) }),
283
284
  /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 items-center justify-end gap-3", children: [
284
- v && a && /* @__PURE__ */ e.jsxs(U, { children: [
285
- /* @__PURE__ */ e.jsx(V, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
286
- H,
285
+ v && b && /* @__PURE__ */ e.jsxs(W, { children: [
286
+ /* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
287
+ V,
287
288
  {
288
289
  variant: "secondary",
289
290
  size: "sm",
290
291
  className: "ml-auto rounded-lg px-3",
291
292
  children: [
292
- /* @__PURE__ */ e.jsx(Y, {}),
293
+ /* @__PURE__ */ e.jsx(Z, {}),
293
294
  " ",
294
- /* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: M("Customize columns") }),
295
- /* @__PURE__ */ e.jsx(Z, {})
295
+ /* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: u("Customize columns") }),
296
+ /* @__PURE__ */ e.jsx(K, {})
296
297
  ]
297
298
  }
298
299
  ) }),
299
- /* @__PURE__ */ e.jsxs(W, { align: "end", children: [
300
+ /* @__PURE__ */ e.jsxs(G, { align: "end", children: [
300
301
  /* @__PURE__ */ e.jsxs(
301
- B,
302
+ J,
302
303
  {
303
304
  className: "capitalize",
304
- onClick: q,
305
+ onClick: U,
305
306
  children: [
306
- /* @__PURE__ */ e.jsx(fe, {}),
307
+ /* @__PURE__ */ e.jsx(je, {}),
307
308
  " ",
308
- M("Reset columns")
309
+ u("Reset columns")
309
310
  ]
310
311
  }
311
312
  ),
312
- /* @__PURE__ */ e.jsx(G, {}),
313
- y.map((r) => /* @__PURE__ */ e.jsx(
314
- J,
313
+ /* @__PURE__ */ e.jsx(O, {}),
314
+ r.map((c) => /* @__PURE__ */ e.jsx(
315
+ Q,
315
316
  {
316
317
  className: "capitalize",
317
- checked: !r.hidden,
318
- onCheckedChange: (z) => i(r, !z),
319
- children: r.name
318
+ checked: !c.hidden,
319
+ onCheckedChange: (R) => H(c, !R),
320
+ children: c.name
320
321
  },
321
- r.key
322
+ c.key
322
323
  ))
323
324
  ] })
324
325
  ] }),
325
- !k.isEmpty(N) && /* @__PURE__ */ e.jsx(S, { filters: N, onFilter: w })
326
+ !y.isEmpty(j) && /* @__PURE__ */ e.jsx(
327
+ C,
328
+ {
329
+ filters: j,
330
+ onFilter: (c) => {
331
+ i == null || i({ ...n, ...c, page: 1 }), N == null || N(c);
332
+ }
333
+ }
334
+ )
326
335
  ] })
327
336
  ] }),
328
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-auto border-y", children: L ? /* @__PURE__ */ e.jsx(de, {}) : /* @__PURE__ */ e.jsx(
329
- je,
337
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-auto border-y", children: a ? /* @__PURE__ */ e.jsx(ie, {}) : /* @__PURE__ */ e.jsx(
338
+ Ne,
330
339
  {
331
- params: m,
332
- rows: s == null ? void 0 : s.docs,
333
- rowKey: x,
334
- selectedItems: u,
335
- isStickyHeader: b,
336
- columns: y,
337
- hasCheckbox: j,
338
- hasNumbers: n,
339
- onRowClick: l,
340
- onSelectedItemsChange: d,
341
- onSortOrderChange: ({ sortField: r, sortOrder: z }) => {
342
- c == null || c({ ...m, sortField: r, sortOrder: z });
340
+ params: n,
341
+ rows: y.get(s, z, []),
342
+ rowKey: m,
343
+ selectedItems: l,
344
+ isStickyHeader: g,
345
+ columns: r,
346
+ hasCheckbox: k,
347
+ hasNumbers: x,
348
+ onRowClick: d,
349
+ onSelectedItemsChange: M,
350
+ onSortOrderChange: ({ sortField: c, sortOrder: R }) => {
351
+ i == null || i({ ...n, sortField: c, sortOrder: R });
343
352
  }
344
353
  }
345
354
  ) }),
346
- E && /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 flex-col items-center justify-between gap-3 p-4 lg:flex-row", children: [
355
+ L && /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 flex-col items-center justify-between gap-3 p-4 lg:flex-row", children: [
347
356
  /* @__PURE__ */ e.jsx("div", { className: "text-sm", children: /* @__PURE__ */ e.jsx(
348
- O,
357
+ S,
349
358
  {
350
- onLimitChange: (r) => c == null ? void 0 : c({ ...m, limit: r, page: 1 }),
359
+ onLimitChange: (c) => i == null ? void 0 : i({ ...n, limit: c, page: 1 }),
351
360
  defaultValue: s == null ? void 0 : s.limit
352
361
  }
353
362
  ) }),
354
363
  /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-sm", children: [
355
- u.length,
364
+ l.length,
356
365
  " of ",
357
366
  (s == null ? void 0 : s.total) || 0,
358
367
  " row(s) selected."
359
368
  ] }),
360
369
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
361
- Q,
370
+ X,
362
371
  {
363
- onPageChange: (r) => c == null ? void 0 : c({ ...m, page: r }),
372
+ onPageChange: (c) => i == null ? void 0 : i({ ...n, page: c }),
364
373
  currentPage: s == null ? void 0 : s.page,
365
374
  totalPages: s == null ? void 0 : s.totalPages
366
375
  }
@@ -371,6 +380,6 @@ const pe = [
371
380
  );
372
381
  };
373
382
  export {
374
- Ae as DataTable,
375
- je as MyTable
383
+ De as DataTable,
384
+ Ne as MyTable
376
385
  };
@@ -1,20 +1,20 @@
1
1
  import { type MyTableProps } from './MyTable';
2
2
  import { type FilterInterface } from '../filters';
3
3
  export interface PaginationInterface<TData> {
4
- docs: TData[];
5
- total: number;
6
- offset: number;
4
+ docs?: TData[];
5
+ offset?: number;
7
6
  limit: number;
8
7
  totalPages: number;
8
+ total?: number;
9
9
  page: number;
10
- pagingCounter: number;
11
- hasPrevPage: boolean;
12
- hasNextPage: boolean;
13
- prevPage: number;
14
- nextPage: number;
10
+ pagingCounter?: number;
11
+ hasPrevPage?: boolean;
12
+ hasNextPage?: boolean;
13
+ prevPage?: number;
14
+ nextPage?: number;
15
15
  }
16
- export interface DataTableProps<TData> extends Omit<MyTableProps<TData>, 'rows'> {
17
- dataSource?: PaginationInterface<TData>;
16
+ export interface DataTableProps<TData, TPaginationData extends PaginationInterface<TData>> extends Omit<MyTableProps<TData>, 'rows'> {
17
+ dataSource?: TPaginationData;
18
18
  onParamChange?: (param: Record<string, unknown>) => void;
19
19
  hasPagination?: true;
20
20
  hasSearch?: true;
@@ -22,7 +22,8 @@ export interface DataTableProps<TData> extends Omit<MyTableProps<TData>, 'rows'>
22
22
  filters?: FilterInterface[];
23
23
  handleFilterChange?: (filters: Record<string, unknown>) => void;
24
24
  tableKey: string;
25
+ dataKey?: keyof TPaginationData;
25
26
  hasColumnsVisibilityDropdown?: true;
26
27
  }
27
- export declare const DataTable: <TData>({ dataSource, columns, onRowClick, rowKey, hasNumbers, hasSearch, hasCheckbox, hasPagination, isStickyHeader, onParamChange, loading, tableKey, filters, handleFilterChange, params, hasColumnsVisibilityDropdown, }: DataTableProps<TData>) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const DataTable: <TData, TPaginationData extends PaginationInterface<TData> = PaginationInterface<TData>>({ dataSource, columns, onRowClick, rowKey, hasNumbers, hasSearch, hasCheckbox, hasPagination, isStickyHeader, onParamChange, dataKey, loading, tableKey, filters, handleFilterChange, params, hasColumnsVisibilityDropdown, }: DataTableProps<TData, TPaginationData>) => import("react/jsx-runtime").JSX.Element;
28
29
  //# sourceMappingURL=DataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../../src/components/datatable/DataTable.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,YAAY,CAAC;AAGzE,MAAM,WAAW,mBAAmB,CAAC,KAAK;IACxC,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc,CAAC,KAAK,CACnC,SAAQ,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzC,UAAU,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B,CAAC,EAAE,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,SAAS,GAAI,KAAK,EAAG,sNAiB/B,cAAc,CAAC,KAAK,CAAC,4CAoHvB,CAAC"}
1
+ {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../../src/components/datatable/DataTable.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,YAAY,CAAC;AAGzE,MAAM,WAAW,mBAAmB,CAAC,KAAK;IACxC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc,CAC7B,KAAK,EACL,eAAe,SAAS,mBAAmB,CAAC,KAAK,CAAC,CAClD,SAAQ,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,eAAe,CAAC;IAChC,4BAA4B,CAAC,EAAE,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,SAAS,GACpB,KAAK,EACL,eAAe,SACb,mBAAmB,CAAC,KAAK,CAAC,GAAG,mBAAmB,CAAC,KAAK,CAAC,EACzD,+NAkBC,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,4CA4HxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dgz-ui-shared",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"