dgz-ui-shared 1.0.2 → 1.0.4
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/DateRangePicker-B9lDZ2FT.cjs +6 -0
- package/dist/DateRangePicker-CfMYCBMq.js +163 -0
- package/dist/FilterWrapper-B1-45FgA.js +178 -0
- package/dist/FilterWrapper-XLIh0aTI.cjs +21 -0
- package/dist/MyInput-BQjLUH2I.js +12917 -0
- package/dist/MyInput-CQFbGr2c.cjs +139 -0
- package/dist/MyLimitSelect-BO3ygMhv.js +190 -0
- package/dist/MyLimitSelect-Cl8rOMDk.cjs +6 -0
- package/dist/MySelect-DPLKIZ6K.cjs +1 -0
- package/dist/MySelect-Dq2P8WPq.js +65 -0
- package/dist/{PasswordConfirm-Dyk7QmeW.cjs → PasswordConfirm-CwnNWBzr.cjs} +3 -3
- package/dist/{PasswordConfirm-CCTmtd2l.js → PasswordConfirm-DfwH7m7b.js} +12 -11
- package/dist/ThemeMode-BO6tit_Z.cjs +1 -0
- package/dist/ThemeMode-CqURAYDL.js +4 -0
- package/dist/check-DE-1lGDl-7MQr4Ksp.cjs +6 -0
- package/dist/check-DE-1lGDl-CAn2HBZJ.js +133 -0
- package/dist/chevron-right-HWBijj-I-CwlGSp1F.cjs +6 -0
- package/dist/chevron-right-HWBijj-I-LacTHiN3.js +11 -0
- package/dist/components/confirm/index.es.js +1 -1
- package/dist/components/confirm/index.umd.js +1 -1
- package/dist/components/datatable/index.es.js +427 -1457
- package/dist/components/datatable/index.umd.js +5 -10
- package/dist/components/datepicker/index.es.js +1 -1
- package/dist/components/datepicker/index.umd.js +1 -1
- package/dist/components/filters/index.es.js +3 -3
- package/dist/components/filters/index.umd.js +1 -1
- package/dist/components/form/index.es.js +5864 -0
- package/dist/components/form/index.umd.js +49 -0
- package/dist/components/pagination/index.es.js +1 -1
- package/dist/components/pagination/index.umd.js +1 -1
- package/dist/components/theme/index.es.js +59 -1
- package/dist/components/theme/index.umd.js +11 -1
- package/dist/components/tooltip/index.es.js +27 -26
- package/dist/components/tooltip/index.umd.js +1 -1
- package/dist/dgz-ui-shared.css +5 -1
- package/dist/dropdown-menu--t1ZKu0y-BLYI5cDb.cjs +6 -0
- package/dist/dropdown-menu--t1ZKu0y-Bvhna1yO.js +1046 -0
- package/dist/enums/index.es.js +6 -5
- package/dist/enums/index.umd.js +1 -1
- package/dist/hooks/index.es.js +5 -5
- package/dist/hooks/index.umd.js +1 -1
- package/dist/index-C5JzSjdD-BaVma9GJ.js +31 -0
- package/dist/index-C5JzSjdD-CRk3Pjir.cjs +1 -0
- package/dist/{index-C5JzSjdD-BmvOu3HF.js → index-CMCLDN5g-0Rognn9f.js} +269 -294
- package/dist/{index-C5JzSjdD-BlvcNArV.cjs → index-CMCLDN5g-Cp4PwCEr.cjs} +1 -1
- package/dist/index.esm-CpcLzfLZ.cjs +1 -0
- package/dist/index.esm-lbl2HgR1.js +970 -0
- package/dist/{popover-CBRr00GV-1hN6Nqs4.cjs → popover-CBRr00GV-BcOs0SIq.cjs} +1 -1
- package/dist/{popover-CBRr00GV--XTgMs23.js → popover-CBRr00GV-h-gcn9d-.js} +1 -1
- package/dist/{select-Cwb1akIr-HJSi7km3.js → select-Cwb1akIr-CttAFcBK.js} +3241 -3364
- package/dist/select-Cwb1akIr-DMc1PmCt.cjs +56 -0
- package/dist/{DateRangePicker-SaQJQ9ba.js → timepicker-a0cR_CqS-BrgmF8fg.js} +1102 -1255
- package/dist/timepicker-a0cR_CqS-DbmOeTeF.cjs +6 -0
- package/dist/types/components/theme/theme-toggle.d.ts +1 -2
- package/dist/types/components/theme/theme-toggle.d.ts.map +1 -1
- package/dist/{useDateRange-YGn1ZvSX.cjs → useDateRange-C-f8vIGF.cjs} +3 -3
- package/dist/{useDateRange-E_fB9biv.js → useDateRange-CNxZF1SP.js} +1 -1
- package/dist/useFilter-DKCjRvhK.js +17 -0
- package/dist/useFilter-DuWATARL.cjs +1 -0
- package/dist/useSortable-JdV8xdLr.cjs +1 -0
- package/dist/{useSortable-X4MYXlDa.js → useSortable-N7MJfTri.js} +1 -1
- package/package.json +6 -1
- package/dist/DateRangePicker-SMIL2r00.cjs +0 -11
- package/dist/FilterWrapper-7Ls7u2Kr.js +0 -235
- package/dist/FilterWrapper-8kzo6OTD.cjs +0 -21
- package/dist/MyLimitSelect-BDvVJ796.cjs +0 -11
- package/dist/MyLimitSelect-t7KGF-ET.js +0 -196
- package/dist/index.esm-BS2kCDgX.cjs +0 -139
- package/dist/index.esm-dkp4Vz3y.js +0 -13864
- package/dist/select-Cwb1akIr-DmdZdXTc.cjs +0 -61
- package/dist/useFilter-0HNR8ewo.js +0 -16
- package/dist/useFilter-CwmfhUFk.cjs +0 -1
- package/dist/useSortable-q46kVK_x.cjs +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-DUiatUiq.cjs"),a=require("react"),m=require("./timepicker-a0cR_CqS-DbmOeTeF.cjs"),n=require("./dayjs.min-DiHYRps1.cjs"),p=require("./check-DE-1lGDl-7MQr4Ksp.cjs"),d=require("./popover-CBRr00GV-BcOs0SIq.cjs"),y=require("./utils-PffWk1Lg-Bm8mmArS.cjs"),k=require("./useTranslation-CZf20ucv.cjs"),v=require("./createLucideIcon-BnAj0RnC.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 E=[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]],O=v.createLucideIcon("calendar-1",E),q=({className:j,format:i=m.to,selected:x,timezone:u,onRangeSelected:b=()=>{},placeholder:D})=>{const{t:o}=k.useTranslation(),[R,f]=a.useState(!1),[t,c]=a.useState();a.useEffect(()=>{c(x)},[x]);const g=a.useMemo(()=>{const e=n.dayjs().endOf("day");return[{from:e.startOf("week").toDate(),to:e.endOf("week").toDate(),label:o("This week")},{from:e.startOf("month").toDate(),to:e.endOf("month").toDate(),label:o("This month")},{from:e.startOf("year").toDate(),to:e.endOf("year").toDate(),label:o("This year")},{from:e.subtract(7,"day").startOf("day").toDate(),to:e.toDate(),label:o("Last 7 days")},{from:e.subtract(30,"day").startOf("day").toDate(),to:e.toDate(),label:o("Last 30 days")},{from:e.subtract(3,"month").startOf("day").toDate(),to:e.toDate(),label:o("Last 3 months")},{from:e.subtract(6,"month").startOf("day").toDate(),to:e.toDate(),label:o("Last 6 months")},{from:e.subtract(12,"month").startOf("day").toDate(),to:e.toDate(),label:o("Last 12 months")}]},[o]),h=e=>{const{from:r,to:l}=e;c({from:r,to:l}),r&&l&&(b({from:r,to:l}),f(!1))};return s.jsxRuntimeExports.jsx("div",{className:y.vr("grid gap-2",j),children:s.jsxRuntimeExports.jsxs(d.Ae,{open:R,onOpenChange:f,children:[s.jsxRuntimeExports.jsx(d.Oe,{asChild:!0,children:s.jsxRuntimeExports.jsxs(p.u,{id:"date",size:"sm",variant:"secondary",className:y.vr("min-w-[170px] text-body-xs-regular justify-between",!t&&"text-primary"),children:[t!=null&&t.from?t.to?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[n.dayjs(t.from).format(i)," -"," ",n.dayjs(t.to).format(i)]}):n.dayjs(t.from).format(i):s.jsxRuntimeExports.jsx("span",{className:"text-secondary",children:D}),s.jsxRuntimeExports.jsx(O,{className:"text-secondary"})]})}),s.jsxRuntimeExports.jsxs(d.ue,{className:"w-auto p-0 flex",align:"end",side:"bottom",children:[s.jsxRuntimeExports.jsx("div",{className:"space-y-1 flex flex-col p-2 border-e border-border-alpha-light",children:g.map((e,r)=>s.jsxRuntimeExports.jsx(p.u,{size:"xs",variant:"ghost",className:"justify-start",onClick:()=>h(e),children:e.label},r))}),s.jsxRuntimeExports.jsx(m.Gs,{className:"border-e border-border-alpha-light",mode:"single",endMonth:t==null?void 0:t.to,selected:t==null?void 0:t.from,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,timeZone:u,disabled:t!=null&&t.to?{after:t.to}:void 0,onSelect:e=>{c({...t,from:e})}}),s.jsxRuntimeExports.jsx(m.Gs,{mode:"single",startMonth:t==null?void 0:t.from,selected:t==null?void 0:t.to,timeZone:u,disabled:t!=null&&t.from?{before:t.from}:void 0,selectedToDate:t==null?void 0:t.to,selectedFromDate:t==null?void 0:t.from,onSelect:e=>{t&&h({...t,to:e})}})]})]})})};exports.DateRangePicker=q;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { j as o } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { useState as h, useEffect as g, useMemo as v } from "react";
|
|
3
|
+
import { t as k, G as y } from "./timepicker-a0cR_CqS-BrgmF8fg.js";
|
|
4
|
+
import { d as r } from "./dayjs.min-C0f7f7oH.js";
|
|
5
|
+
import { u as p } from "./check-DE-1lGDl-CAn2HBZJ.js";
|
|
6
|
+
import { A as N, O as w, u as M } from "./popover-CBRr00GV-h-gcn9d-.js";
|
|
7
|
+
import { v as x } from "./utils-PffWk1Lg-CZY16h3s.js";
|
|
8
|
+
import { u as L } from "./useTranslation-dH-uwymc.js";
|
|
9
|
+
import { c as T } from "./createLucideIcon-B950nf2d.js";
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v0.511.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
const C = [
|
|
17
|
+
["path", { d: "M11 14h1v4", key: "fy54vd" }],
|
|
18
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
19
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
20
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
21
|
+
["rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", key: "12vinp" }]
|
|
22
|
+
], S = T("calendar-1", C), P = ({
|
|
23
|
+
className: b,
|
|
24
|
+
format: n = k,
|
|
25
|
+
selected: c,
|
|
26
|
+
timezone: i,
|
|
27
|
+
onRangeSelected: D = () => {
|
|
28
|
+
},
|
|
29
|
+
placeholder: u
|
|
30
|
+
}) => {
|
|
31
|
+
const { t: s } = L(), [j, f] = h(!1), [t, m] = h();
|
|
32
|
+
g(() => {
|
|
33
|
+
m(c);
|
|
34
|
+
}, [c]);
|
|
35
|
+
const O = v(() => {
|
|
36
|
+
const e = r().endOf("day");
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
from: e.startOf("week").toDate(),
|
|
40
|
+
to: e.endOf("week").toDate(),
|
|
41
|
+
label: s("This week")
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
from: e.startOf("month").toDate(),
|
|
45
|
+
to: e.endOf("month").toDate(),
|
|
46
|
+
label: s("This month")
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
from: e.startOf("year").toDate(),
|
|
50
|
+
to: e.endOf("year").toDate(),
|
|
51
|
+
label: s("This year")
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
from: e.subtract(7, "day").startOf("day").toDate(),
|
|
55
|
+
to: e.toDate(),
|
|
56
|
+
label: s("Last 7 days")
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
from: e.subtract(30, "day").startOf("day").toDate(),
|
|
60
|
+
to: e.toDate(),
|
|
61
|
+
label: s("Last 30 days")
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
from: e.subtract(3, "month").startOf("day").toDate(),
|
|
65
|
+
to: e.toDate(),
|
|
66
|
+
label: s("Last 3 months")
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
from: e.subtract(6, "month").startOf("day").toDate(),
|
|
70
|
+
to: e.toDate(),
|
|
71
|
+
label: s("Last 6 months")
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
from: e.subtract(12, "month").startOf("day").toDate(),
|
|
75
|
+
to: e.toDate(),
|
|
76
|
+
label: s("Last 12 months")
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
}, [s]), d = (e) => {
|
|
80
|
+
const { from: a, to: l } = e;
|
|
81
|
+
m({ from: a, to: l }), a && l && (D({ from: a, to: l }), f(!1));
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ o.jsx("div", { className: x("grid gap-2", b), children: /* @__PURE__ */ o.jsxs(N, { open: j, onOpenChange: f, children: [
|
|
84
|
+
/* @__PURE__ */ o.jsx(w, { asChild: !0, children: /* @__PURE__ */ o.jsxs(
|
|
85
|
+
p,
|
|
86
|
+
{
|
|
87
|
+
id: "date",
|
|
88
|
+
size: "sm",
|
|
89
|
+
variant: "secondary",
|
|
90
|
+
className: x(
|
|
91
|
+
"min-w-[170px] text-body-xs-regular justify-between",
|
|
92
|
+
!t && "text-primary"
|
|
93
|
+
),
|
|
94
|
+
children: [
|
|
95
|
+
t != null && t.from ? t.to ? /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
96
|
+
r(t.from).format(n),
|
|
97
|
+
" -",
|
|
98
|
+
" ",
|
|
99
|
+
r(t.to).format(n)
|
|
100
|
+
] }) : r(t.from).format(n) : /* @__PURE__ */ o.jsx("span", { className: "text-secondary", children: u }),
|
|
101
|
+
/* @__PURE__ */ o.jsx(S, { className: "text-secondary" })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
/* @__PURE__ */ o.jsxs(M, { className: "w-auto p-0 flex", align: "end", side: "bottom", children: [
|
|
106
|
+
/* @__PURE__ */ o.jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: "space-y-1 flex flex-col p-2 border-e border-border-alpha-light",
|
|
110
|
+
children: O.map((e, a) => /* @__PURE__ */ o.jsx(
|
|
111
|
+
p,
|
|
112
|
+
{
|
|
113
|
+
size: "xs",
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
className: "justify-start",
|
|
116
|
+
onClick: () => d(e),
|
|
117
|
+
children: e.label
|
|
118
|
+
},
|
|
119
|
+
a
|
|
120
|
+
))
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ o.jsx(
|
|
124
|
+
y,
|
|
125
|
+
{
|
|
126
|
+
className: "border-e border-border-alpha-light",
|
|
127
|
+
mode: "single",
|
|
128
|
+
endMonth: t == null ? void 0 : t.to,
|
|
129
|
+
selected: t == null ? void 0 : t.from,
|
|
130
|
+
selectedToDate: t == null ? void 0 : t.to,
|
|
131
|
+
selectedFromDate: t == null ? void 0 : t.from,
|
|
132
|
+
timeZone: i,
|
|
133
|
+
disabled: t != null && t.to ? {
|
|
134
|
+
after: t.to
|
|
135
|
+
} : void 0,
|
|
136
|
+
onSelect: (e) => {
|
|
137
|
+
m({ ...t, from: e });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ o.jsx(
|
|
142
|
+
y,
|
|
143
|
+
{
|
|
144
|
+
mode: "single",
|
|
145
|
+
startMonth: t == null ? void 0 : t.from,
|
|
146
|
+
selected: t == null ? void 0 : t.to,
|
|
147
|
+
timeZone: i,
|
|
148
|
+
disabled: t != null && t.from ? {
|
|
149
|
+
before: t.from
|
|
150
|
+
} : void 0,
|
|
151
|
+
selectedToDate: t == null ? void 0 : t.to,
|
|
152
|
+
selectedFromDate: t == null ? void 0 : t.from,
|
|
153
|
+
onSelect: (e) => {
|
|
154
|
+
t && d({ ...t, to: e });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] })
|
|
159
|
+
] }) });
|
|
160
|
+
};
|
|
161
|
+
export {
|
|
162
|
+
P as D
|
|
163
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { j as e } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import { y as $, a as A, N as C, b as O } from "./MyInput-BQjLUH2I.js";
|
|
3
|
+
import { u as r } from "./check-DE-1lGDl-CAn2HBZJ.js";
|
|
4
|
+
import { u as k } from "./useTranslation-dH-uwymc.js";
|
|
5
|
+
import { c } from "./createLucideIcon-B950nf2d.js";
|
|
6
|
+
import { memo as D, useState as y, useEffect as f, useCallback as b } from "react";
|
|
7
|
+
import { A as E, O as q, u as I } from "./popover-CBRr00GV-h-gcn9d-.js";
|
|
8
|
+
import { M as L } from "./MySelect-Dq2P8WPq.js";
|
|
9
|
+
import { u as R } from "./useFilter-DKCjRvhK.js";
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v0.511.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
const T = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], V = c("chevron-down", T);
|
|
17
|
+
/**
|
|
18
|
+
* @license lucide-react v0.511.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/
|
|
23
|
+
const W = [
|
|
24
|
+
["path", { d: "M10 18h4", key: "1ulq68" }],
|
|
25
|
+
["path", { d: "M11 6H3", key: "1u26ik" }],
|
|
26
|
+
["path", { d: "M15 6h6", key: "1jlkvy" }],
|
|
27
|
+
["path", { d: "M18 9V3", key: "xwwp7m" }],
|
|
28
|
+
["path", { d: "M7 12h8", key: "7a1bxv" }]
|
|
29
|
+
], B = c("list-filter-plus", W);
|
|
30
|
+
/**
|
|
31
|
+
* @license lucide-react v0.511.0 - ISC
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the ISC license.
|
|
34
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
const H = [
|
|
37
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
38
|
+
["path", { d: "M7 12h10", key: "b7w52i" }],
|
|
39
|
+
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
40
|
+
], P = c("list-filter", H);
|
|
41
|
+
/**
|
|
42
|
+
* @license lucide-react v0.511.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
const G = [
|
|
48
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
49
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
50
|
+
], J = c("search", G), te = ({
|
|
51
|
+
name: l = "search",
|
|
52
|
+
defaultValue: a,
|
|
53
|
+
onSearchChange: t
|
|
54
|
+
}) => {
|
|
55
|
+
const { t: n } = k(), o = (i) => {
|
|
56
|
+
const d = new FormData(i.currentTarget);
|
|
57
|
+
t(d.get(l)), i.preventDefault();
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ e.jsxs(
|
|
60
|
+
"form",
|
|
61
|
+
{
|
|
62
|
+
className: "relative min-w-40 w-full max-w-64",
|
|
63
|
+
onSubmit: o,
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ e.jsx(
|
|
66
|
+
$,
|
|
67
|
+
{
|
|
68
|
+
className: "rounded-lg h-8",
|
|
69
|
+
name: l,
|
|
70
|
+
placeholder: n("Search..."),
|
|
71
|
+
defaultValue: a ? `${a}` : ""
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ e.jsx(
|
|
75
|
+
r,
|
|
76
|
+
{
|
|
77
|
+
type: "submit",
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
className: "!bg-transparent absolute top-0 right-0 cursor-pointer rounded-md text-foreground",
|
|
80
|
+
size: "sm",
|
|
81
|
+
children: /* @__PURE__ */ e.jsx(J, {})
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}, ne = D(function({
|
|
88
|
+
filters: a,
|
|
89
|
+
params: t,
|
|
90
|
+
onFilter: n,
|
|
91
|
+
onChange: o,
|
|
92
|
+
onCancel: i,
|
|
93
|
+
...d
|
|
94
|
+
}) {
|
|
95
|
+
const { t: m } = k(), [N, v] = y(!1), [M, h] = y(!1), { form: u } = R({ params: t }), { watch: g, getValues: w, handleSubmit: S, control: x, reset: j } = u;
|
|
96
|
+
f(() => {
|
|
97
|
+
let s = !1;
|
|
98
|
+
a.map((z) => {
|
|
99
|
+
const p = A.get(t, `${z.name}`);
|
|
100
|
+
(Array.isArray(p) ? p.length > 0 : p) && (s = !0), v(s);
|
|
101
|
+
});
|
|
102
|
+
}, [a, t]), f(() => {
|
|
103
|
+
o && o(w());
|
|
104
|
+
}, [g()]);
|
|
105
|
+
const _ = b(
|
|
106
|
+
(s = {}) => {
|
|
107
|
+
n && n(s), h(!1);
|
|
108
|
+
},
|
|
109
|
+
[n]
|
|
110
|
+
), F = b(() => {
|
|
111
|
+
j(), n && t && n({
|
|
112
|
+
...t,
|
|
113
|
+
...Object.fromEntries(
|
|
114
|
+
a.map((s) => [s.name, void 0])
|
|
115
|
+
)
|
|
116
|
+
}), h(!1);
|
|
117
|
+
}, [n, j, t, a]);
|
|
118
|
+
return /* @__PURE__ */ e.jsxs(E, { open: M, onOpenChange: h, children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsx(
|
|
120
|
+
r,
|
|
121
|
+
{
|
|
122
|
+
asChild: !0,
|
|
123
|
+
size: "sm",
|
|
124
|
+
variant: "secondary",
|
|
125
|
+
className: "ml-auto px-3",
|
|
126
|
+
...d,
|
|
127
|
+
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
128
|
+
N ? /* @__PURE__ */ e.jsx(B, { size: 20 }) : /* @__PURE__ */ e.jsx(P, { size: 20 }),
|
|
129
|
+
" ",
|
|
130
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden md:inline", children: m("Filter") }),
|
|
131
|
+
/* @__PURE__ */ e.jsx(V, {})
|
|
132
|
+
] })
|
|
133
|
+
}
|
|
134
|
+
) }),
|
|
135
|
+
/* @__PURE__ */ e.jsx(I, { side: "bottom", align: "end", className: "", children: /* @__PURE__ */ e.jsx(C, { ...u, children: /* @__PURE__ */ e.jsxs("form", { onSubmit: S(_), className: "space-y-2", children: [
|
|
136
|
+
/* @__PURE__ */ e.jsx("div", { className: "h-full shrink overflow-y-auto p-1", children: a.map(
|
|
137
|
+
(s) => s.options ? /* @__PURE__ */ e.jsx(
|
|
138
|
+
L,
|
|
139
|
+
{
|
|
140
|
+
control: x,
|
|
141
|
+
name: s.name,
|
|
142
|
+
placeholder: s.placeholder,
|
|
143
|
+
isMulti: s.isMulti,
|
|
144
|
+
options: s.options,
|
|
145
|
+
label: s.label
|
|
146
|
+
},
|
|
147
|
+
s.name
|
|
148
|
+
) : /* @__PURE__ */ e.jsx(
|
|
149
|
+
O,
|
|
150
|
+
{
|
|
151
|
+
control: x,
|
|
152
|
+
placeholder: s.placeholder,
|
|
153
|
+
name: s.name,
|
|
154
|
+
label: s.label
|
|
155
|
+
},
|
|
156
|
+
s.name
|
|
157
|
+
)
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 justify-end gap-2", children: [
|
|
160
|
+
/* @__PURE__ */ e.jsx(
|
|
161
|
+
r,
|
|
162
|
+
{
|
|
163
|
+
variant: "destructive",
|
|
164
|
+
type: "reset",
|
|
165
|
+
size: "sm",
|
|
166
|
+
onClick: F,
|
|
167
|
+
children: m("Reset")
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ e.jsx(r, { type: "submit", size: "sm", children: m("Apply") })
|
|
171
|
+
] })
|
|
172
|
+
] }) }) })
|
|
173
|
+
] });
|
|
174
|
+
});
|
|
175
|
+
export {
|
|
176
|
+
ne as F,
|
|
177
|
+
te as S
|
|
178
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-DUiatUiq.cjs"),a=require("./MyInput-CQFbGr2c.cjs"),i=require("./check-DE-1lGDl-7MQr4Ksp.cjs"),k=require("./useTranslation-CZf20ucv.cjs"),l=require("./createLucideIcon-BnAj0RnC.cjs"),o=require("react"),j=require("./popover-CBRr00GV-BcOs0SIq.cjs"),F=require("./MySelect-DPLKIZ6K.cjs"),I=require("./useFilter-DuWATARL.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 _=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],C=l.createLucideIcon("chevron-down",_);/**
|
|
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 L=[["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"}]],$=l.createLucideIcon("list-filter-plus",L);/**
|
|
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 z=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],D=l.createLucideIcon("list-filter",z);/**
|
|
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"}]],O=l.createLucideIcon("search",A),T=({name:u="search",defaultValue:t,onSearchChange:n})=>{const{t:r}=k.useTranslation(),c=x=>{const p=new FormData(x.currentTarget);n(p.get(u)),x.preventDefault()};return e.jsxRuntimeExports.jsxs("form",{className:"relative min-w-40 w-full max-w-64",onSubmit:c,children:[e.jsxRuntimeExports.jsx(a.yo,{className:"rounded-lg h-8",name:u,placeholder:r("Search..."),defaultValue:t?`${t}`:""}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",variant:"ghost",className:"!bg-transparent absolute top-0 right-0 cursor-pointer rounded-md text-foreground",size:"sm",children:e.jsxRuntimeExports.jsx(O,{})})]})},V=o.memo(function({filters:t,params:n,onFilter:r,onChange:c,onCancel:x,...p}){const{t:d}=k.useTranslation(),[b,f]=o.useState(!1),[v,m]=o.useState(!1),{form:y}=I.useFilter({params:n}),{watch:N,getValues:M,handleSubmit:g,control:E,reset:R}=y;o.useEffect(()=>{let s=!1;t.map(S=>{const h=a.lodashExports.get(n,`${S.name}`);(Array.isArray(h)?h.length>0:h)&&(s=!0),f(s)})},[t,n]),o.useEffect(()=>{c&&c(M())},[N()]);const q=o.useCallback((s={})=>{r&&r(s),m(!1)},[r]),w=o.useCallback(()=>{R(),r&&n&&r({...n,...Object.fromEntries(t.map(s=>[s.name,void 0]))}),m(!1)},[r,R,n,t]);return e.jsxRuntimeExports.jsxs(j.Ae,{open:v,onOpenChange:m,children:[e.jsxRuntimeExports.jsx(j.Oe,{children:e.jsxRuntimeExports.jsx(i.u,{asChild:!0,size:"sm",variant:"secondary",className:"ml-auto px-3",...p,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[b?e.jsxRuntimeExports.jsx($,{size:20}):e.jsxRuntimeExports.jsx(D,{size:20})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:d("Filter")}),e.jsxRuntimeExports.jsx(C,{})]})})}),e.jsxRuntimeExports.jsx(j.ue,{side:"bottom",align:"end",className:"",children:e.jsxRuntimeExports.jsx(a.Nf,{...y,children:e.jsxRuntimeExports.jsxs("form",{onSubmit:g(q),className:"space-y-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-full shrink overflow-y-auto p-1",children:t.map(s=>s.options?e.jsxRuntimeExports.jsx(F.MySelect,{control:E,name:s.name,placeholder:s.placeholder,isMulti:s.isMulti,options:s.options,label:s.label},s.name):e.jsxRuntimeExports.jsx(a.MyInput,{control:E,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(i.u,{variant:"destructive",type:"reset",size:"sm",onClick:w,children:d("Reset")}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",size:"sm",children:d("Apply")})]})]})})})]})});exports.FilterWrapper=V;exports.Search=T;
|