dgz-ui-shared 1.0.69 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions-CkCdw8LQ.cjs +1 -0
- package/dist/Actions-h8ihzX2Y.js +28 -0
- package/dist/FilterWrapper-C6rEmxjr.js +180 -0
- package/dist/FilterWrapper-CVM-n8tz.cjs +21 -0
- package/dist/components/actions/index.cjs.js +1 -0
- package/dist/components/actions/index.es.js +4 -0
- package/dist/components/confirm/index.cjs.js +1 -1
- package/dist/components/confirm/index.es.js +1 -1
- package/dist/components/datatable/index.cjs.js +5 -5
- package/dist/components/datatable/index.es.js +139 -135
- package/dist/components/filters/index.cjs.js +1 -1
- package/dist/components/filters/index.es.js +9 -9
- package/dist/dgz-ui-shared.css +1 -1
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +1 -1
- package/dist/index-KCZvOJVU.js +8 -0
- package/dist/index-Vhq7CMrm.cjs +1 -0
- package/dist/types/components/actions/Actions.d.ts +10 -0
- package/dist/types/components/actions/Actions.d.ts.map +1 -0
- package/dist/types/components/actions/index.d.ts +2 -0
- package/dist/types/components/actions/index.d.ts.map +1 -0
- package/dist/types/components/datatable/DataTable.d.ts +3 -1
- package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/{unstyled-CyESqfpT.js → unstyled-4uhv16dY.js} +1 -5
- package/dist/unstyled-BhFHf60E.cjs +7 -0
- package/package.json +7 -2
- package/dist/FilterWrapper-B3eJ74dh.cjs +0 -21
- package/dist/FilterWrapper-yAOBKFII.js +0 -183
- package/dist/unstyled-CYtxtIJS.cjs +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-DUiatUiq.cjs"),n=require("./dropdown-menu-BPBcxHRB-towSSPIs.cjs"),x=require("./button-Bp2lHjov-D9UnCnYX.cjs"),t=require("./index-Vhq7CMrm.cjs"),u=require("./useTranslation-CZf20ucv.cjs"),c=({actions:i=[]})=>{const{t:r}=u.useTranslation();return s.jsxRuntimeExports.jsxs(n.Nt,{children:[s.jsxRuntimeExports.jsx(n.jt,{asChild:!0,children:s.jsxRuntimeExports.jsxs(x.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[s.jsxRuntimeExports.jsx(t.Wg,{})," ",s.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:r("Actions")}),s.jsxRuntimeExports.jsx(t.f1,{})]})}),s.jsxRuntimeExports.jsx(n.ut,{align:"end",children:i.map((e,o)=>s.jsxRuntimeExports.jsx(n.it,{onClick:e.onClick,children:e.label},o))})]})};exports.Actions=c;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { N as t, j as e, u as o, i as l } from "./dropdown-menu-BPBcxHRB-EjT0ADL9.js";
|
|
3
|
+
import { u as m } from "./button-Bp2lHjov-BTlHPcva.js";
|
|
4
|
+
import { W as c, f as d } from "./index-KCZvOJVU.js";
|
|
5
|
+
import { u as j } from "./useTranslation-dH-uwymc.js";
|
|
6
|
+
const g = ({ actions: i = [] }) => {
|
|
7
|
+
const { t: n } = j();
|
|
8
|
+
return /* @__PURE__ */ s.jsxs(t, { children: [
|
|
9
|
+
/* @__PURE__ */ s.jsx(e, { asChild: !0, children: /* @__PURE__ */ s.jsxs(
|
|
10
|
+
m,
|
|
11
|
+
{
|
|
12
|
+
variant: "secondary",
|
|
13
|
+
size: "sm",
|
|
14
|
+
className: "ml-auto rounded-lg px-3",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ s.jsx(c, {}),
|
|
17
|
+
" ",
|
|
18
|
+
/* @__PURE__ */ s.jsx("span", { className: "hidden lg:!inline", children: n("Actions") }),
|
|
19
|
+
/* @__PURE__ */ s.jsx(d, {})
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
) }),
|
|
23
|
+
/* @__PURE__ */ s.jsx(o, { align: "end", children: i.map((r, a) => /* @__PURE__ */ s.jsx(l, { onClick: r.onClick, children: r.label }, a)) })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
g as A
|
|
28
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { y as O, P as D } from "./radio-group-CqPTye2U-DGs9dBuR.js";
|
|
3
|
+
import { u as n } from "./button-Bp2lHjov-BTlHPcva.js";
|
|
4
|
+
import { u as b } from "./useTranslation-dH-uwymc.js";
|
|
5
|
+
import { c } from "./createLucideIcon-B950nf2d.js";
|
|
6
|
+
import { memo as E, useState as y, useEffect as f, useCallback as k } from "react";
|
|
7
|
+
import { l as F } from "./lodash-CYNxjS-I.js";
|
|
8
|
+
import { O as q, _ as A, u as I } from "./popover-HTqpqYpJ-CwZxzUFN.js";
|
|
9
|
+
import { M as L } from "./MyInput-CHKuq1qI.js";
|
|
10
|
+
import { M as P } from "./MySelect-B49OLiFT.js";
|
|
11
|
+
import { u as R } from "./useFilter-DMpxv27U.js";
|
|
12
|
+
/**
|
|
13
|
+
* @license lucide-react v0.511.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
const C = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], T = c("chevron-down", C);
|
|
19
|
+
/**
|
|
20
|
+
* @license lucide-react v0.511.0 - ISC
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the ISC license.
|
|
23
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
const V = [
|
|
26
|
+
["path", { d: "M10 18h4", key: "1ulq68" }],
|
|
27
|
+
["path", { d: "M11 6H3", key: "1u26ik" }],
|
|
28
|
+
["path", { d: "M15 6h6", key: "1jlkvy" }],
|
|
29
|
+
["path", { d: "M18 9V3", key: "xwwp7m" }],
|
|
30
|
+
["path", { d: "M7 12h8", key: "7a1bxv" }]
|
|
31
|
+
], W = c("list-filter-plus", V);
|
|
32
|
+
/**
|
|
33
|
+
* @license lucide-react v0.511.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
const B = [
|
|
39
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
40
|
+
["path", { d: "M7 12h10", key: "b7w52i" }],
|
|
41
|
+
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
42
|
+
], H = c("list-filter", B);
|
|
43
|
+
/**
|
|
44
|
+
* @license lucide-react v0.511.0 - ISC
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the ISC license.
|
|
47
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
49
|
+
const G = [
|
|
50
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
51
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
52
|
+
], J = c("search", G), re = ({
|
|
53
|
+
name: l = "search",
|
|
54
|
+
defaultValue: a,
|
|
55
|
+
onSearchChange: o
|
|
56
|
+
}) => {
|
|
57
|
+
const { t } = b(), r = (i) => {
|
|
58
|
+
const m = new FormData(i.currentTarget);
|
|
59
|
+
o(m.get(l) || void 0), i.preventDefault();
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ e.jsxs(
|
|
62
|
+
"form",
|
|
63
|
+
{
|
|
64
|
+
className: "relative w-full max-w-64 min-w-40",
|
|
65
|
+
onSubmit: r,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e.jsx(
|
|
68
|
+
O,
|
|
69
|
+
{
|
|
70
|
+
className: "h-8 rounded-lg",
|
|
71
|
+
name: l,
|
|
72
|
+
placeholder: t("Search..."),
|
|
73
|
+
defaultValue: a ? `${a}` : ""
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ e.jsx(
|
|
77
|
+
n,
|
|
78
|
+
{
|
|
79
|
+
type: "submit",
|
|
80
|
+
variant: "ghost",
|
|
81
|
+
className: "text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",
|
|
82
|
+
size: "sm",
|
|
83
|
+
children: /* @__PURE__ */ e.jsx(J, {})
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}, ne = E(function({
|
|
90
|
+
filters: a,
|
|
91
|
+
params: o,
|
|
92
|
+
onFilter: t,
|
|
93
|
+
onChange: r,
|
|
94
|
+
onCancel: i,
|
|
95
|
+
...m
|
|
96
|
+
}) {
|
|
97
|
+
const { t: d } = b(), [v, M] = y(!1), [N, h] = y(!1), { form: u } = R({ params: o }), { watch: w, getValues: g, handleSubmit: S, control: x, reset: j } = u;
|
|
98
|
+
f(() => {
|
|
99
|
+
let s = !1;
|
|
100
|
+
a.map(($) => {
|
|
101
|
+
const p = F.get(o, `${$.name}`);
|
|
102
|
+
(Array.isArray(p) ? p.length > 0 : p) && (s = !0), M(s);
|
|
103
|
+
});
|
|
104
|
+
}, [a, o]), f(() => {
|
|
105
|
+
r == null || r(g());
|
|
106
|
+
}, [w()]);
|
|
107
|
+
const _ = k(
|
|
108
|
+
(s = {}) => {
|
|
109
|
+
t == null || t(s), h(!1);
|
|
110
|
+
},
|
|
111
|
+
[t]
|
|
112
|
+
), z = k(() => {
|
|
113
|
+
j(), t && o && t({
|
|
114
|
+
...o,
|
|
115
|
+
...Object.fromEntries(
|
|
116
|
+
a.map((s) => [s.name, void 0])
|
|
117
|
+
)
|
|
118
|
+
}), h(!1);
|
|
119
|
+
}, [t, j, o, a]);
|
|
120
|
+
return /* @__PURE__ */ e.jsxs(q, { open: N, onOpenChange: h, children: [
|
|
121
|
+
/* @__PURE__ */ e.jsx(A, { children: /* @__PURE__ */ e.jsx(
|
|
122
|
+
n,
|
|
123
|
+
{
|
|
124
|
+
asChild: !0,
|
|
125
|
+
size: "sm",
|
|
126
|
+
variant: "secondary",
|
|
127
|
+
className: "ml-auto px-3",
|
|
128
|
+
...m,
|
|
129
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
130
|
+
v ? /* @__PURE__ */ e.jsx(W, { size: 20 }) : /* @__PURE__ */ e.jsx(H, { size: 20 }),
|
|
131
|
+
" ",
|
|
132
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: d("Filter") }),
|
|
133
|
+
/* @__PURE__ */ e.jsx(T, {})
|
|
134
|
+
] })
|
|
135
|
+
}
|
|
136
|
+
) }),
|
|
137
|
+
/* @__PURE__ */ e.jsx(I, { side: "bottom", align: "end", className: "", children: /* @__PURE__ */ e.jsx(D, { ...u, children: /* @__PURE__ */ e.jsxs("form", { onSubmit: S(_), className: "space-y-2", children: [
|
|
138
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full shrink p-1", children: a.map(
|
|
139
|
+
(s) => s.options ? /* @__PURE__ */ e.jsx(
|
|
140
|
+
P,
|
|
141
|
+
{
|
|
142
|
+
control: x,
|
|
143
|
+
name: s.name,
|
|
144
|
+
placeholder: s.placeholder,
|
|
145
|
+
isMulti: s.isMulti,
|
|
146
|
+
options: s.options,
|
|
147
|
+
label: s.label
|
|
148
|
+
},
|
|
149
|
+
s.name
|
|
150
|
+
) : /* @__PURE__ */ e.jsx(
|
|
151
|
+
L,
|
|
152
|
+
{
|
|
153
|
+
control: x,
|
|
154
|
+
placeholder: s.placeholder,
|
|
155
|
+
name: s.name,
|
|
156
|
+
label: s.label
|
|
157
|
+
},
|
|
158
|
+
s.name
|
|
159
|
+
)
|
|
160
|
+
) }),
|
|
161
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 justify-end gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ e.jsx(
|
|
163
|
+
n,
|
|
164
|
+
{
|
|
165
|
+
variant: "destructive",
|
|
166
|
+
type: "reset",
|
|
167
|
+
size: "sm",
|
|
168
|
+
onClick: z,
|
|
169
|
+
children: d("Reset")
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ e.jsx(n, { type: "submit", size: "sm", children: d("Apply") })
|
|
173
|
+
] })
|
|
174
|
+
] }) }) })
|
|
175
|
+
] });
|
|
176
|
+
});
|
|
177
|
+
export {
|
|
178
|
+
ne as F,
|
|
179
|
+
re as S
|
|
180
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-DUiatUiq.cjs"),R=require("./radio-group-CqPTye2U-CXc2TUFE.cjs"),a=require("./button-Bp2lHjov-D9UnCnYX.cjs"),b=require("./useTranslation-CZf20ucv.cjs"),i=require("./createLucideIcon-BnAj0RnC.cjs"),o=require("react"),_=require("./lodash-C5w_OPmE.cjs"),h=require("./popover-HTqpqYpJ-Bx11rWT_.cjs"),I=require("./MyInput-yriz78UG.cjs"),L=require("./MySelect-DtdzVlXP.cjs"),$=require("./useFilter-CiORTEHP.cjs");/**
|
|
2
|
+
* @license lucide-react v0.511.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const z=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],T=i.createLucideIcon("chevron-down",z);/**
|
|
7
|
+
* @license lucide-react v0.511.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const F=[["path",{d:"M10 18h4",key:"1ulq68"}],["path",{d:"M11 6H3",key:"1u26ik"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 9V3",key:"xwwp7m"}],["path",{d:"M7 12h8",key:"7a1bxv"}]],C=i.createLucideIcon("list-filter-plus",F);/**
|
|
12
|
+
* @license lucide-react v0.511.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const D=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],O=i.createLucideIcon("list-filter",D);/**
|
|
17
|
+
* @license lucide-react v0.511.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const A=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],H=i.createLucideIcon("search",A),P=({name:u="search",defaultValue:n,onSearchChange:r})=>{const{t}=b.useTranslation(),c=l=>{const x=new FormData(l.currentTarget);r(x.get(u)||void 0),l.preventDefault()};return e.jsxRuntimeExports.jsxs("form",{className:"relative w-full max-w-64 min-w-40",onSubmit:c,children:[e.jsxRuntimeExports.jsx(R.yl,{className:"h-8 rounded-lg",name:u,placeholder:t("Search..."),defaultValue:n?`${n}`:""}),e.jsxRuntimeExports.jsx(a.u,{type:"submit",variant:"ghost",className:"text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",size:"sm",children:e.jsxRuntimeExports.jsx(H,{})})]})},W=o.memo(function({filters:n,params:r,onFilter:t,onChange:c,onCancel:l,...x}){const{t:p}=b.useTranslation(),[k,q]=o.useState(!1),[v,d]=o.useState(!1),{form:j}=$.useFilter({params:r}),{watch:M,getValues:N,handleSubmit:f,control:y,reset:E}=j;o.useEffect(()=>{let s=!1;n.map(g=>{const m=_.lodashExports.get(r,`${g.name}`);(Array.isArray(m)?m.length>0:m)&&(s=!0),q(s)})},[n,r]),o.useEffect(()=>{c==null||c(N())},[M()]);const S=o.useCallback((s={})=>{t==null||t(s),d(!1)},[t]),w=o.useCallback(()=>{E(),t&&r&&t({...r,...Object.fromEntries(n.map(s=>[s.name,void 0]))}),d(!1)},[t,E,r,n]);return e.jsxRuntimeExports.jsxs(h.Oe,{open:v,onOpenChange:d,children:[e.jsxRuntimeExports.jsx(h._e,{children:e.jsxRuntimeExports.jsx(a.u,{asChild:!0,size:"sm",variant:"secondary",className:"ml-auto px-3",...x,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[k?e.jsxRuntimeExports.jsx(C,{size:20}):e.jsxRuntimeExports.jsx(O,{size:20})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:p("Filter")}),e.jsxRuntimeExports.jsx(T,{})]})})}),e.jsxRuntimeExports.jsx(h.ue,{side:"bottom",align:"end",className:"",children:e.jsxRuntimeExports.jsx(R.Ph,{...j,children:e.jsxRuntimeExports.jsxs("form",{onSubmit:f(S),className:"space-y-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-full shrink p-1",children:n.map(s=>s.options?e.jsxRuntimeExports.jsx(L.MySelect,{control:y,name:s.name,placeholder:s.placeholder,isMulti:s.isMulti,options:s.options,label:s.label},s.name):e.jsxRuntimeExports.jsx(I.MyInput,{control:y,placeholder:s.placeholder,name:s.name,label:s.label},s.name))}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[e.jsxRuntimeExports.jsx(a.u,{variant:"destructive",type:"reset",size:"sm",onClick:w,children:p("Reset")}),e.jsxRuntimeExports.jsx(a.u,{type:"submit",size:"sm",children:p("Apply")})]})]})})})]})});exports.FilterWrapper=W;exports.Search=P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../Actions-CkCdw8LQ.cjs");exports.Actions=t.Actions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../unstyled-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../unstyled-BhFHf60E.cjs");exports.Confirm=r.Confirm;exports.ConfirmContainer=r.Lt;exports.PasswordConfirm=r.PasswordConfirm;
|
|
@@ -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"),J=require("../../button-Bp2lHjov-D9UnCnYX.cjs"),R=require("../../dropdown-menu-BPBcxHRB-towSSPIs.cjs"),M=require("../../MyLimitSelect-BFWr_fUn.cjs"),F=require("../../index-Vhq7CMrm.cjs"),a=require("react"),u=require("../../lodash-C5w_OPmE.cjs"),m=require("../../index-DqTIeHVj-DlSOwhuZ.cjs"),n=require("../../utils-B6fNqzRf-BNysSCt9.cjs"),z=require("../../useSortable-ByFhUHQb.cjs"),$=require("../../radio-group-CqPTye2U-CXc2TUFE.cjs"),B=require("../../SortOrder-81BrXp3i.cjs"),Q=require("../../Empty--unTFnpg.cjs"),L=require("../../createLucideIcon-BnAj0RnC.cjs"),H=require("../../FilterWrapper-CVM-n8tz.cjs"),X=require("../../Loader-bUUShWXh.cjs"),Y=require("../../Actions-CkCdw8LQ.cjs"),Z=require("../../useTranslation-CZf20ucv.cjs"),U=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("table",{ref:i,className:n.mo("w-full caption-bottom text-sm",s),...r}));U.displayName="Table";const S=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("thead",{ref:i,className:n.mo("[&_tr]:border-b",s),...r}));S.displayName="TableHeader";const V=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("tbody",{ref:i,className:n.mo("[&_tr:last-child]:border-0",s),...r}));V.displayName="TableBody";const K=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("tfoot",{ref:i,className:n.mo("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",s),...r}));K.displayName="TableFooter";const q=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("tr",{ref:i,className:n.mo("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",s),...r}));q.displayName="TableRow";const T=a.forwardRef(({className:s,...r},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),...r}));T.displayName="TableHead";const k=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("td",{ref:i,className:n.mo("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...r}));k.displayName="TableCell";const C=a.forwardRef(({className:s,...r},i)=>m.ae.jsx("caption",{ref:i,className:n.mo("text-muted-foreground mt-4 text-sm",s),...r}));C.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 P=[["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"}]],ee=L.createLucideIcon("arrow-down-wide-narrow",P);/**
|
|
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 se=[["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"}]],te=L.createLucideIcon("arrow-up-down",se);/**
|
|
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 re=[["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"}]],ie=L.createLucideIcon("arrow-up-wide-narrow",re);/**
|
|
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 le=[["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"}]],xe=L.createLucideIcon("refresh-cw",le),W=({rows:s=[],columns:r,onRowClick:i,rowKey:j,params:c={page:1,limit:M.DEFAULT_LIMIT},hasNumbers:h=!1,hasCheckbox:E=!1,selectedItems:I,onSelectedItemsChange:g,onSortOrderChange:l,isStickyHeader:_})=>{const{sortObject:d,handleSort:N}=z.useSortable({sortField:c==null?void 0:c.sortField,sortOrder:c==null?void 0:c.sortField,onSortOrderChange:l}),{selectedRows:f,isRowSelected:y,isAllRowsSelected:b,handleSelectAllRows:p,handleSelectRow:v}=z.useDataTable({rows:s,defaultSelectedRows:I});return a.useEffect(()=>{g&&g(f)},[f]),e.jsxRuntimeExports.jsxs(U,{className:"relative",children:[e.jsxRuntimeExports.jsx(S,{className:n.mo("bg-bg",_&&"sticky top-0 z-10"),children:e.jsxRuntimeExports.jsxs(q,{children:[E&&e.jsxRuntimeExports.jsx(T,{className:"w-12 p-3",children:e.jsxRuntimeExports.jsx($.Tl,{className:"mt-1",checked:b(j),onCheckedChange:t=>p(j,!!t),"aria-label":"Select all"})}),h&&e.jsxRuntimeExports.jsx(T,{className:"w-12 p-2",children:"#"}),r.filter(t=>!t.hidden).map(t=>e.jsxRuntimeExports.jsx(T,{style:t.styles,className:n.mo("p-2",t.sortable&&"cursor-pointer"),onClick:()=>t.sortable&&N(t.dataIndex),children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[t.name," ",t.sortable&&((d==null?void 0:d.sortField)===t.key?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[(d==null?void 0:d.sortOrder)===B.SortOrder.DESC&&e.jsxRuntimeExports.jsx(ee,{size:15}),(d==null?void 0:d.sortOrder)===B.SortOrder.ASC&&e.jsxRuntimeExports.jsx(ie,{size:15})]}):e.jsxRuntimeExports.jsx(te,{size:15}))]})},t.key))]})}),e.jsxRuntimeExports.jsx(V,{className:"[&>tr:nth-child(even)]:bg-bg-secondary",children:s.length?s.map((t,w)=>e.jsxRuntimeExports.jsxs(q,{onClick:()=>i==null?void 0:i(t),className:n.mo(i&&"cursor-pointer"),"data-state":y(t[j])&&"selected",children:[E&&e.jsxRuntimeExports.jsx(k,{className:"w-12 p-3",onClick:o=>o.stopPropagation(),children:e.jsxRuntimeExports.jsx($.Tl,{className:"mt-1",checked:y(t[j]),onCheckedChange:o=>v(t[j],!!o),"aria-label":"Select row"})}),h&&e.jsxRuntimeExports.jsx(k,{className:"w-12 p-2",children:(c.page-1)*(c.limit||M.DEFAULT_LIMIT)+w+1}),r.filter(o=>!o.hidden).map(o=>e.jsxRuntimeExports.jsx(k,{className:"text-body-xs-medium max-w-xs p-2",style:o.styles,children:o.render?o.render(u.lodashExports.get(t,o.dataIndex),t):u.lodashExports.get(t,o.dataIndex,"")},`${w}-${o.key}`))]},`${t[j]}`)):e.jsxRuntimeExports.jsx(q,{children:e.jsxRuntimeExports.jsx(k,{colSpan:h?E?r.length+2:r.length+1:r.length,children:e.jsxRuntimeExports.jsx(Q.Empty,{})})})})]})},oe=({dataSource:s,columns:r,onRowClick:i,rowKey:j,hasNumbers:c,hasSearch:h,hasCheckbox:E,hasPagination:I,isStickyHeader:g,onParamChange:l,dataKey:_="docs",loading:d,tableKey:N,filters:f=[],actions:y=[],handleFilterChange:b,params:p,hasColumnsVisibilityDropdown:v})=>{const{t}=Z.useTranslation(),[w,o]=a.useState([]),{formattedColumns:D,handleColumnsChange:O,resetColumns:G}=z.useColumns({key:N,columns:r});return e.jsxRuntimeExports.jsxs("div",{className:"border-border-alpha-light flex grow flex-col overflow-auto rounded-xl border shadow-xs",children:[(h||v&&N||!u.lodashExports.isEmpty(f))&&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:"w-full shrink",children:h&&e.jsxRuntimeExports.jsx(H.Search,{defaultValue:u.lodashExports.get(p,"search",""),onSearchChange:x=>l==null?void 0:l({...p,search:x,page:1})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-3",children:[v&&N&&e.jsxRuntimeExports.jsxs(R.Nt,{children:[e.jsxRuntimeExports.jsx(R.jt,{asChild:!0,children:e.jsxRuntimeExports.jsxs(J.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[e.jsxRuntimeExports.jsx(F.yn,{})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:t("Customize columns")}),e.jsxRuntimeExports.jsx(F.f1,{})]})}),e.jsxRuntimeExports.jsxs(R.ut,{align:"end",children:[e.jsxRuntimeExports.jsxs(R.it,{className:"capitalize",onClick:G,children:[e.jsxRuntimeExports.jsx(xe,{})," ",t("Reset columns")]}),e.jsxRuntimeExports.jsx(R.ft,{}),D.map(x=>e.jsxRuntimeExports.jsx(R.dt,{className:"capitalize",checked:!x.hidden,onCheckedChange:A=>O(x,!A),children:x.name},x.key))]})]}),!u.lodashExports.isEmpty(y)&&e.jsxRuntimeExports.jsx(Y.Actions,{actions:y}),!u.lodashExports.isEmpty(f)&&e.jsxRuntimeExports.jsx(H.FilterWrapper,{filters:f,onFilter:x=>{l==null||l({...p,...x,page:1}),b==null||b(x)}})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col overflow-auto border-y",children:d?e.jsxRuntimeExports.jsx(X.Loader,{}):e.jsxRuntimeExports.jsx(W,{params:p,rows:u.lodashExports.get(s,_,[]),rowKey:j,selectedItems:w,isStickyHeader:g,columns:D,hasCheckbox:E,hasNumbers:c,onRowClick:i,onSelectedItemsChange:o,onSortOrderChange:({sortField:x,sortOrder:A})=>{l==null||l({...p,sortField:x,sortOrder:A})}})}),I&&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(M.MyLimitSelect,{onLimitChange:x=>l==null?void 0:l({...p,limit:x,page:1}),defaultValue:s==null?void 0:s.limit})}),e.jsxRuntimeExports.jsxs("div",{className:"text-muted-foreground text-sm",children:[w.length," of ",(s==null?void 0:s.total)||0," row(s) selected."]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(M.MyPagination,{onPageChange:x=>l==null?void 0:l({...p,page:x}),currentPage:s==null?void 0:s.page,totalPages:s==null?void 0:s.totalPages})})]})]})};exports.DataTable=oe;exports.MyTable=W;
|