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"),
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
3
|
-
import { N as
|
|
4
|
-
import { D as
|
|
5
|
-
import { S as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { l as
|
|
8
|
-
import { a as
|
|
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
|
|
11
|
-
import { T as
|
|
12
|
-
import { S as
|
|
13
|
-
import { E as
|
|
14
|
-
import { c as
|
|
15
|
-
import { L as
|
|
16
|
-
import { u as
|
|
17
|
-
const
|
|
18
|
-
({ className: s, ...t },
|
|
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:
|
|
21
|
+
ref: d,
|
|
22
22
|
className: o("w-full caption-bottom text-sm", s),
|
|
23
23
|
...t
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
26
|
);
|
|
27
|
-
|
|
28
|
-
const $ =
|
|
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
|
|
30
|
+
const q = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
31
31
|
"tbody",
|
|
32
32
|
{
|
|
33
|
-
ref:
|
|
33
|
+
ref: d,
|
|
34
34
|
className: o("[&_tr:last-child]:border-0", s),
|
|
35
35
|
...t
|
|
36
36
|
}
|
|
37
37
|
));
|
|
38
|
-
|
|
39
|
-
const
|
|
38
|
+
q.displayName = "TableBody";
|
|
39
|
+
const ce = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
40
40
|
"tfoot",
|
|
41
41
|
{
|
|
42
|
-
ref:
|
|
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
|
-
|
|
51
|
-
const T =
|
|
50
|
+
ce.displayName = "TableFooter";
|
|
51
|
+
const T = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
52
52
|
"tr",
|
|
53
53
|
{
|
|
54
|
-
ref:
|
|
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 _ =
|
|
63
|
+
const _ = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
64
64
|
"th",
|
|
65
65
|
{
|
|
66
|
-
ref:
|
|
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
|
|
75
|
+
const w = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
76
76
|
"td",
|
|
77
77
|
{
|
|
78
|
-
ref:
|
|
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
|
-
|
|
84
|
-
const
|
|
83
|
+
w.displayName = "TableCell";
|
|
84
|
+
const ae = p(({ className: s, ...t }, d) => /* @__PURE__ */ h.jsx(
|
|
85
85
|
"caption",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
87
|
+
ref: d,
|
|
88
88
|
className: o("text-muted-foreground mt-4 text-sm", s),
|
|
89
89
|
...t
|
|
90
90
|
}
|
|
91
91
|
));
|
|
92
|
-
|
|
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
|
|
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
|
-
],
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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
|
-
],
|
|
142
|
+
], je = E("refresh-cw", fe), Ne = ({
|
|
143
143
|
rows: s = [],
|
|
144
144
|
columns: t,
|
|
145
|
-
onRowClick:
|
|
146
|
-
rowKey:
|
|
147
|
-
params:
|
|
145
|
+
onRowClick: d,
|
|
146
|
+
rowKey: m,
|
|
147
|
+
params: x = {
|
|
148
148
|
page: 1,
|
|
149
|
-
limit:
|
|
149
|
+
limit: A
|
|
150
150
|
},
|
|
151
151
|
hasNumbers: f = !1,
|
|
152
|
-
hasCheckbox:
|
|
153
|
-
selectedItems:
|
|
154
|
-
onSelectedItemsChange:
|
|
155
|
-
onSortOrderChange:
|
|
156
|
-
isStickyHeader:
|
|
152
|
+
hasCheckbox: k = !1,
|
|
153
|
+
selectedItems: L,
|
|
154
|
+
onSelectedItemsChange: g,
|
|
155
|
+
onSortOrderChange: i,
|
|
156
|
+
isStickyHeader: z
|
|
157
157
|
}) => {
|
|
158
|
-
const { sortObject: a, handleSort:
|
|
159
|
-
sortField:
|
|
160
|
-
sortOrder:
|
|
161
|
-
onSortOrderChange:
|
|
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:
|
|
164
|
-
isRowSelected:
|
|
165
|
-
isAllRowsSelected:
|
|
166
|
-
handleSelectAllRows:
|
|
163
|
+
selectedRows: j,
|
|
164
|
+
isRowSelected: N,
|
|
165
|
+
isAllRowsSelected: n,
|
|
166
|
+
handleSelectAllRows: v,
|
|
167
167
|
handleSelectRow: u
|
|
168
|
-
} =
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
}, [
|
|
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",
|
|
175
|
+
className: o("bg-bg", z && "sticky top-0 z-10"),
|
|
176
176
|
children: /* @__PURE__ */ e.jsxs(T, { children: [
|
|
177
|
-
|
|
178
|
-
|
|
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:
|
|
182
|
-
onCheckedChange: (
|
|
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((
|
|
187
|
+
t.filter((l) => !l.hidden).map((l) => /* @__PURE__ */ e.jsx(
|
|
188
188
|
_,
|
|
189
189
|
{
|
|
190
|
-
style:
|
|
191
|
-
className: o("p-2",
|
|
192
|
-
onClick: () =>
|
|
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
|
-
|
|
194
|
+
l.name,
|
|
195
195
|
" ",
|
|
196
|
-
|
|
197
|
-
(a == null ? void 0 : a.sortOrder) ===
|
|
198
|
-
(a == null ? void 0 : a.sortOrder) ===
|
|
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
|
-
|
|
202
|
+
l.key
|
|
203
203
|
))
|
|
204
204
|
] })
|
|
205
205
|
}
|
|
206
206
|
),
|
|
207
|
-
/* @__PURE__ */ e.jsx(
|
|
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: () =>
|
|
211
|
-
className: o(
|
|
212
|
-
"data-state":
|
|
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
|
-
|
|
215
|
-
|
|
214
|
+
k && /* @__PURE__ */ e.jsx(
|
|
215
|
+
w,
|
|
216
216
|
{
|
|
217
217
|
className: "w-12 p-3",
|
|
218
|
-
onClick: (
|
|
218
|
+
onClick: (r) => r.stopPropagation(),
|
|
219
219
|
children: /* @__PURE__ */ e.jsx(
|
|
220
|
-
|
|
220
|
+
I,
|
|
221
221
|
{
|
|
222
222
|
className: "mt-1",
|
|
223
|
-
checked:
|
|
224
|
-
onCheckedChange: (
|
|
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(
|
|
231
|
-
t.filter((
|
|
232
|
-
|
|
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:
|
|
236
|
-
children:
|
|
235
|
+
style: r.styles,
|
|
236
|
+
children: r.render ? r.render(y.get(l, r.dataIndex), l) : y.get(l, r.dataIndex, "")
|
|
237
237
|
},
|
|
238
|
-
`${
|
|
238
|
+
`${M}-${r.key}`
|
|
239
239
|
))
|
|
240
240
|
]
|
|
241
241
|
},
|
|
242
|
-
`${
|
|
242
|
+
`${l[m]}`
|
|
243
243
|
)) : /* @__PURE__ */ e.jsx(T, { children: /* @__PURE__ */ e.jsx(
|
|
244
|
-
|
|
244
|
+
w,
|
|
245
245
|
{
|
|
246
|
-
colSpan: f ?
|
|
247
|
-
children: /* @__PURE__ */ e.jsx(
|
|
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
|
-
},
|
|
251
|
+
}, De = ({
|
|
252
252
|
dataSource: s,
|
|
253
253
|
columns: t,
|
|
254
|
-
onRowClick:
|
|
255
|
-
rowKey:
|
|
256
|
-
hasNumbers:
|
|
254
|
+
onRowClick: d,
|
|
255
|
+
rowKey: m,
|
|
256
|
+
hasNumbers: x,
|
|
257
257
|
hasSearch: f,
|
|
258
|
-
hasCheckbox:
|
|
259
|
-
hasPagination:
|
|
260
|
-
isStickyHeader:
|
|
261
|
-
onParamChange:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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:
|
|
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 &&
|
|
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
|
-
|
|
278
|
+
Y,
|
|
278
279
|
{
|
|
279
|
-
defaultValue:
|
|
280
|
-
onSearchChange: (
|
|
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 &&
|
|
285
|
-
/* @__PURE__ */ e.jsx(
|
|
286
|
-
|
|
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(
|
|
293
|
+
/* @__PURE__ */ e.jsx(Z, {}),
|
|
293
294
|
" ",
|
|
294
|
-
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children:
|
|
295
|
-
/* @__PURE__ */ e.jsx(
|
|
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(
|
|
300
|
+
/* @__PURE__ */ e.jsxs(G, { align: "end", children: [
|
|
300
301
|
/* @__PURE__ */ e.jsxs(
|
|
301
|
-
|
|
302
|
+
J,
|
|
302
303
|
{
|
|
303
304
|
className: "capitalize",
|
|
304
|
-
onClick:
|
|
305
|
+
onClick: U,
|
|
305
306
|
children: [
|
|
306
|
-
/* @__PURE__ */ e.jsx(
|
|
307
|
+
/* @__PURE__ */ e.jsx(je, {}),
|
|
307
308
|
" ",
|
|
308
|
-
|
|
309
|
+
u("Reset columns")
|
|
309
310
|
]
|
|
310
311
|
}
|
|
311
312
|
),
|
|
312
|
-
/* @__PURE__ */ e.jsx(
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
/* @__PURE__ */ e.jsx(O, {}),
|
|
314
|
+
r.map((c) => /* @__PURE__ */ e.jsx(
|
|
315
|
+
Q,
|
|
315
316
|
{
|
|
316
317
|
className: "capitalize",
|
|
317
|
-
checked: !
|
|
318
|
-
onCheckedChange: (
|
|
319
|
-
children:
|
|
318
|
+
checked: !c.hidden,
|
|
319
|
+
onCheckedChange: (R) => H(c, !R),
|
|
320
|
+
children: c.name
|
|
320
321
|
},
|
|
321
|
-
|
|
322
|
+
c.key
|
|
322
323
|
))
|
|
323
324
|
] })
|
|
324
325
|
] }),
|
|
325
|
-
!
|
|
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:
|
|
329
|
-
|
|
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:
|
|
332
|
-
rows: s
|
|
333
|
-
rowKey:
|
|
334
|
-
selectedItems:
|
|
335
|
-
isStickyHeader:
|
|
336
|
-
columns:
|
|
337
|
-
hasCheckbox:
|
|
338
|
-
hasNumbers:
|
|
339
|
-
onRowClick:
|
|
340
|
-
onSelectedItemsChange:
|
|
341
|
-
onSortOrderChange: ({ sortField:
|
|
342
|
-
|
|
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
|
-
|
|
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
|
-
|
|
357
|
+
S,
|
|
349
358
|
{
|
|
350
|
-
onLimitChange: (
|
|
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
|
-
|
|
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
|
-
|
|
370
|
+
X,
|
|
362
371
|
{
|
|
363
|
-
onPageChange: (
|
|
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
|
-
|
|
375
|
-
|
|
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
|
|
5
|
-
|
|
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
|
|
11
|
-
hasPrevPage
|
|
12
|
-
hasNextPage
|
|
13
|
-
prevPage
|
|
14
|
-
nextPage
|
|
10
|
+
pagingCounter?: number;
|
|
11
|
+
hasPrevPage?: boolean;
|
|
12
|
+
hasNextPage?: boolean;
|
|
13
|
+
prevPage?: number;
|
|
14
|
+
nextPage?: number;
|
|
15
15
|
}
|
|
16
|
-
export interface DataTableProps<TData
|
|
17
|
-
dataSource?:
|
|
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;
|
|
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"}
|