dgz-ui-shared 1.0.65 → 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,14 +1,14 @@
|
|
|
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.
|
|
@@ -18,4 +18,4 @@
|
|
|
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 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),
|
|
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
10
|
import { u as se, a as te, b as le } from "../../useSortable-QB1cZsY8.js";
|
|
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 },
|
|
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 re = h(({ className: s, ...t }, a) => /* @__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 }, a) => /* @__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,24 +72,24 @@ const _ = h(({ className: s, ...t }, a) => /* @__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
|
*
|
|
@@ -102,32 +102,32 @@ const oe = [
|
|
|
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
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
111
|
*/
|
|
112
|
-
const
|
|
112
|
+
const ne = [
|
|
113
113
|
["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
|
|
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
|
-
],
|
|
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
|
-
],
|
|
130
|
+
], he = E("arrow-up-wide-narrow", pe);
|
|
131
131
|
/**
|
|
132
132
|
* @license lucide-react v0.511.0 - ISC
|
|
133
133
|
*
|
|
@@ -139,46 +139,46 @@ const fe = [
|
|
|
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
|
-
], je =
|
|
142
|
+
], je = E("refresh-cw", fe), Ne = ({
|
|
143
143
|
rows: s = [],
|
|
144
144
|
columns: t,
|
|
145
|
-
onRowClick:
|
|
145
|
+
onRowClick: d,
|
|
146
146
|
rowKey: m,
|
|
147
|
-
params:
|
|
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:
|
|
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
163
|
selectedRows: j,
|
|
164
|
-
isRowSelected:
|
|
165
|
-
isAllRowsSelected:
|
|
164
|
+
isRowSelected: N,
|
|
165
|
+
isAllRowsSelected: n,
|
|
166
166
|
handleSelectAllRows: v,
|
|
167
167
|
handleSelectRow: u
|
|
168
|
-
} = te({ rows: s, defaultSelectedRows:
|
|
168
|
+
} = te({ rows: s, defaultSelectedRows: L });
|
|
169
169
|
return P(() => {
|
|
170
|
-
|
|
171
|
-
}, [j]), /* @__PURE__ */ e.jsxs(
|
|
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:
|
|
181
|
+
checked: n(m),
|
|
182
182
|
onCheckedChange: (l) => v(m, !!l),
|
|
183
183
|
"aria-label": "Select all"
|
|
184
184
|
}
|
|
@@ -189,14 +189,14 @@ const fe = [
|
|
|
189
189
|
{
|
|
190
190
|
style: l.styles,
|
|
191
191
|
className: o("p-2", l.sortable && "cursor-pointer"),
|
|
192
|
-
onClick: () =>
|
|
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
|
-
l.sortable && ((
|
|
197
|
-
(
|
|
198
|
-
(
|
|
199
|
-
] }) : /* @__PURE__ */ e.jsx(
|
|
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
|
+
] }) : /* @__PURE__ */ e.jsx(me, { size: 15 }))
|
|
200
200
|
] })
|
|
201
201
|
},
|
|
202
202
|
l.key
|
|
@@ -204,105 +204,105 @@ const fe = [
|
|
|
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
|
-
`${M}-${
|
|
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:
|
|
254
|
+
onRowClick: d,
|
|
255
255
|
rowKey: m,
|
|
256
|
-
hasNumbers:
|
|
256
|
+
hasNumbers: x,
|
|
257
257
|
hasSearch: f,
|
|
258
|
-
hasCheckbox:
|
|
259
|
-
hasPagination:
|
|
260
|
-
isStickyHeader:
|
|
261
|
-
onParamChange:
|
|
262
|
-
dataKey:
|
|
263
|
-
loading:
|
|
264
|
-
tableKey:
|
|
258
|
+
hasCheckbox: k,
|
|
259
|
+
hasPagination: L,
|
|
260
|
+
isStickyHeader: g,
|
|
261
|
+
onParamChange: i,
|
|
262
|
+
dataKey: z = "docs",
|
|
263
|
+
loading: a,
|
|
264
|
+
tableKey: b,
|
|
265
265
|
filters: j = [],
|
|
266
|
-
handleFilterChange:
|
|
267
|
-
params:
|
|
266
|
+
handleFilterChange: N,
|
|
267
|
+
params: n,
|
|
268
268
|
hasColumnsVisibilityDropdown: v
|
|
269
269
|
}) => {
|
|
270
|
-
const { t: u } =
|
|
270
|
+
const { t: u } = re(), [l, M] = ee([]), { formattedColumns: r, handleColumnsChange: H, resetColumns: U } = le({ key: b, columns: t });
|
|
271
271
|
return /* @__PURE__ */ e.jsxs(
|
|
272
272
|
"div",
|
|
273
273
|
{
|
|
274
274
|
className: "border-border-alpha-light flex grow flex-col overflow-auto rounded-xl border shadow-xs",
|
|
275
275
|
children: [
|
|
276
|
-
(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: [
|
|
277
277
|
/* @__PURE__ */ e.jsx("div", { className: "w-full shrink", children: f && /* @__PURE__ */ e.jsx(
|
|
278
|
-
|
|
278
|
+
Y,
|
|
279
279
|
{
|
|
280
|
-
defaultValue:
|
|
281
|
-
onSearchChange: (
|
|
280
|
+
defaultValue: y.get(n, "search", ""),
|
|
281
|
+
onSearchChange: (c) => i == null ? void 0 : i({ ...n, search: c, page: 1 })
|
|
282
282
|
}
|
|
283
283
|
) }),
|
|
284
284
|
/* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 items-center justify-end gap-3", children: [
|
|
285
|
-
v &&
|
|
286
|
-
/* @__PURE__ */ e.jsx(
|
|
287
|
-
|
|
285
|
+
v && b && /* @__PURE__ */ e.jsxs(W, { children: [
|
|
286
|
+
/* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
287
|
+
V,
|
|
288
288
|
{
|
|
289
289
|
variant: "secondary",
|
|
290
290
|
size: "sm",
|
|
291
291
|
className: "ml-auto rounded-lg px-3",
|
|
292
292
|
children: [
|
|
293
|
-
/* @__PURE__ */ e.jsx(
|
|
293
|
+
/* @__PURE__ */ e.jsx(Z, {}),
|
|
294
294
|
" ",
|
|
295
295
|
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: u("Customize columns") }),
|
|
296
|
-
/* @__PURE__ */ e.jsx(
|
|
296
|
+
/* @__PURE__ */ e.jsx(K, {})
|
|
297
297
|
]
|
|
298
298
|
}
|
|
299
299
|
) }),
|
|
300
|
-
/* @__PURE__ */ e.jsxs(
|
|
300
|
+
/* @__PURE__ */ e.jsxs(G, { align: "end", children: [
|
|
301
301
|
/* @__PURE__ */ e.jsxs(
|
|
302
|
-
|
|
302
|
+
J,
|
|
303
303
|
{
|
|
304
304
|
className: "capitalize",
|
|
305
|
-
onClick:
|
|
305
|
+
onClick: U,
|
|
306
306
|
children: [
|
|
307
307
|
/* @__PURE__ */ e.jsx(je, {}),
|
|
308
308
|
" ",
|
|
@@ -310,45 +310,53 @@ const fe = [
|
|
|
310
310
|
]
|
|
311
311
|
}
|
|
312
312
|
),
|
|
313
|
-
/* @__PURE__ */ e.jsx(
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
/* @__PURE__ */ e.jsx(O, {}),
|
|
314
|
+
r.map((c) => /* @__PURE__ */ e.jsx(
|
|
315
|
+
Q,
|
|
316
316
|
{
|
|
317
317
|
className: "capitalize",
|
|
318
|
-
checked: !
|
|
319
|
-
onCheckedChange: (
|
|
320
|
-
children:
|
|
318
|
+
checked: !c.hidden,
|
|
319
|
+
onCheckedChange: (R) => H(c, !R),
|
|
320
|
+
children: c.name
|
|
321
321
|
},
|
|
322
|
-
|
|
322
|
+
c.key
|
|
323
323
|
))
|
|
324
324
|
] })
|
|
325
325
|
] }),
|
|
326
|
-
!
|
|
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
|
+
)
|
|
327
335
|
] })
|
|
328
336
|
] }),
|
|
329
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-auto border-y", children:
|
|
337
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex flex-col overflow-auto border-y", children: a ? /* @__PURE__ */ e.jsx(ie, {}) : /* @__PURE__ */ e.jsx(
|
|
330
338
|
Ne,
|
|
331
339
|
{
|
|
332
|
-
params:
|
|
333
|
-
rows:
|
|
340
|
+
params: n,
|
|
341
|
+
rows: y.get(s, z, []),
|
|
334
342
|
rowKey: m,
|
|
335
343
|
selectedItems: l,
|
|
336
|
-
isStickyHeader:
|
|
337
|
-
columns:
|
|
338
|
-
hasCheckbox:
|
|
339
|
-
hasNumbers:
|
|
340
|
-
onRowClick:
|
|
344
|
+
isStickyHeader: g,
|
|
345
|
+
columns: r,
|
|
346
|
+
hasCheckbox: k,
|
|
347
|
+
hasNumbers: x,
|
|
348
|
+
onRowClick: d,
|
|
341
349
|
onSelectedItemsChange: M,
|
|
342
|
-
onSortOrderChange: ({ sortField:
|
|
343
|
-
|
|
350
|
+
onSortOrderChange: ({ sortField: c, sortOrder: R }) => {
|
|
351
|
+
i == null || i({ ...n, sortField: c, sortOrder: R });
|
|
344
352
|
}
|
|
345
353
|
}
|
|
346
354
|
) }),
|
|
347
|
-
|
|
355
|
+
L && /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 flex-col items-center justify-between gap-3 p-4 lg:flex-row", children: [
|
|
348
356
|
/* @__PURE__ */ e.jsx("div", { className: "text-sm", children: /* @__PURE__ */ e.jsx(
|
|
349
|
-
|
|
357
|
+
S,
|
|
350
358
|
{
|
|
351
|
-
onLimitChange: (
|
|
359
|
+
onLimitChange: (c) => i == null ? void 0 : i({ ...n, limit: c, page: 1 }),
|
|
352
360
|
defaultValue: s == null ? void 0 : s.limit
|
|
353
361
|
}
|
|
354
362
|
) }),
|
|
@@ -359,9 +367,9 @@ const fe = [
|
|
|
359
367
|
" row(s) selected."
|
|
360
368
|
] }),
|
|
361
369
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsx(
|
|
362
|
-
|
|
370
|
+
X,
|
|
363
371
|
{
|
|
364
|
-
onPageChange: (
|
|
372
|
+
onPageChange: (c) => i == null ? void 0 : i({ ...n, page: c }),
|
|
365
373
|
currentPage: s == null ? void 0 : s.page,
|
|
366
374
|
totalPages: s == null ? void 0 : s.totalPages
|
|
367
375
|
}
|
|
@@ -372,6 +380,6 @@ const fe = [
|
|
|
372
380
|
);
|
|
373
381
|
};
|
|
374
382
|
export {
|
|
375
|
-
|
|
383
|
+
De as DataTable,
|
|
376
384
|
Ne as MyTable
|
|
377
385
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type MyTableProps } from './MyTable';
|
|
2
2
|
import { type FilterInterface } from '../filters';
|
|
3
3
|
export interface PaginationInterface<TData> {
|
|
4
|
-
docs
|
|
5
|
-
offset
|
|
4
|
+
docs?: TData[];
|
|
5
|
+
offset?: number;
|
|
6
6
|
limit: number;
|
|
7
7
|
totalPages: number;
|
|
8
|
-
total
|
|
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
16
|
export interface DataTableProps<TData, TPaginationData extends PaginationInterface<TData>> extends Omit<MyTableProps<TData>, 'rows'> {
|
|
17
17
|
dataSource?: TPaginationData;
|
|
@@ -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"}
|