laif-ds 0.2.23 → 0.2.25
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/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +2 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/alert-dialog.js +6 -6
- package/dist/components/ui/app-multiple-select-dropdown.js +34 -34
- package/dist/components/ui/app-select.js +127 -124
- package/dist/components/ui/badge.js +13 -12
- package/dist/components/ui/button.js +20 -18
- package/dist/components/ui/calendar.js +6 -6
- package/dist/components/ui/checkbox.js +9 -9
- package/dist/components/ui/confirmer.js +45 -19
- package/dist/components/ui/context-menu.js +4 -4
- package/dist/components/ui/date-picker.js +45 -36
- package/dist/components/ui/input-otp.js +16 -16
- package/dist/components/ui/input-selector.js +19 -19
- package/dist/components/ui/input.js +19 -19
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/pagination.js +90 -77
- package/dist/components/ui/radio-group.js +14 -14
- package/dist/components/ui/select.js +27 -27
- package/dist/components/ui/switch.js +8 -6
- package/dist/components/ui/table.js +16 -16
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +6 -6
- package/dist/components/ui/tables/data-table/components/data-table-actions.js +51 -0
- package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +470 -0
- package/dist/components/ui/tables/data-table/components/data-table-body.js +340 -0
- package/dist/components/ui/tables/data-table/components/data-table-column-visibility.js +274 -0
- package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +177 -0
- package/dist/components/ui/tables/data-table/components/data-table-filters.js +286 -0
- package/dist/components/ui/tables/data-table/components/data-table-pagination.js +131 -0
- package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +112 -0
- package/dist/components/ui/tables/data-table/components/data-table-simple-filters.js +263 -0
- package/dist/components/ui/tables/data-table/components/data-table-sorting.js +128 -0
- package/dist/components/ui/tables/data-table/data-table-constants.js +58 -0
- package/dist/components/ui/tables/data-table/data-table-i18n.js +138 -0
- package/dist/components/ui/tables/data-table/data-table.js +549 -0
- package/dist/components/ui/tables/data-table/data-table.service.js +254 -0
- package/dist/components/ui/tabs.js +33 -33
- package/dist/components/ui/textarea.js +11 -11
- package/dist/components/ui/tooltip.js +10 -10
- package/dist/css-for-template.css +57 -0
- package/dist/index.d.ts +249 -76
- package/dist/index.js +64 -64
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +5 -3
- package/dist/components/ui/data-table.js +0 -461
- package/dist/components/ui/data-table.service.js +0 -62
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { Button as g } from "../../../button.js";
|
|
4
|
+
import { cn as w } from "../../../../../lib/utils.js";
|
|
5
|
+
import { useState as p, useRef as x, useEffect as v } from "react";
|
|
6
|
+
import { Tooltip as q, TooltipTrigger as z, TooltipContent as D } from "../../../tooltip.js";
|
|
7
|
+
function P({
|
|
8
|
+
searchableColumnsHeaders: b = [],
|
|
9
|
+
i18n: i,
|
|
10
|
+
className: T = "",
|
|
11
|
+
onSearch: u,
|
|
12
|
+
debounceMs: d = 300,
|
|
13
|
+
initialValue: t
|
|
14
|
+
}) {
|
|
15
|
+
const [c, s] = p(t || ""), [f, a] = p(!!(t && t.length > 0)), S = "search_input_" + Math.random().toString(36).substring(2, 9), h = x(null), n = x(null);
|
|
16
|
+
v(() => {
|
|
17
|
+
t && t.length > 0 ? (s(t), a(!0)) : (t === "" || t === void 0) && (s(""), a(!1));
|
|
18
|
+
}, [t]), v(() => (u && (n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
19
|
+
u(c);
|
|
20
|
+
}, d)), () => {
|
|
21
|
+
n.current && clearTimeout(n.current);
|
|
22
|
+
}), [c, u, d]);
|
|
23
|
+
const C = () => {
|
|
24
|
+
f ? h.current?.focus() : (a(!0), setTimeout(() => {
|
|
25
|
+
h.current?.focus();
|
|
26
|
+
}, 10));
|
|
27
|
+
}, B = (e) => {
|
|
28
|
+
e.preventDefault(), e.stopPropagation(), s(""), a(!1), setTimeout(() => {
|
|
29
|
+
e?.currentTarget?.closest(".relative")?.querySelector('button[aria-label="Search"]')?.focus();
|
|
30
|
+
}, 0);
|
|
31
|
+
}, N = (e) => {
|
|
32
|
+
const r = e.relatedTarget, m = !e.currentTarget.contains(r), k = r?.parentElement?.getAttribute("aria-label") === "Search", y = r?.closest(
|
|
33
|
+
'button[aria-label="Clear search"]'
|
|
34
|
+
);
|
|
35
|
+
m && !k && !y && c === "" && (a(!1), setTimeout(() => {
|
|
36
|
+
e?.currentTarget?.closest(".relative")?.querySelector('button[aria-label="Search"]')?.focus();
|
|
37
|
+
}, 0));
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ o("div", { className: w("relative", T), children: /* @__PURE__ */ l("div", { className: "flex items-center", children: [
|
|
40
|
+
/* @__PURE__ */ l(q, { children: [
|
|
41
|
+
/* @__PURE__ */ o(z, { asChild: !0, children: /* @__PURE__ */ o(
|
|
42
|
+
g,
|
|
43
|
+
{
|
|
44
|
+
className: "h-6 w-6",
|
|
45
|
+
iconLeft: "Search",
|
|
46
|
+
size: "icon",
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
onClick: C,
|
|
49
|
+
"aria-label": i.search
|
|
50
|
+
}
|
|
51
|
+
) }),
|
|
52
|
+
/* @__PURE__ */ l(
|
|
53
|
+
D,
|
|
54
|
+
{
|
|
55
|
+
className: "flex max-h-24 min-h-0 flex-col gap-0 px-2 py-1.5",
|
|
56
|
+
variant: "card",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ o("div", { className: "text-d-foreground/90 text-xs", children: i.searchTooltipLabel }),
|
|
59
|
+
/* @__PURE__ */ o("ul", { className: "flex flex-col gap-0 overflow-auto", children: b.map((e) => /* @__PURE__ */ l("li", { className: "text-d-foreground/75 text-xs", children: [
|
|
60
|
+
"⋅ ",
|
|
61
|
+
e
|
|
62
|
+
] }, e)) })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ o(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: `overflow-hidden transition-all duration-300 ease-in-out ${f ? "w-52" : "w-0"}`,
|
|
71
|
+
onBlur: N,
|
|
72
|
+
children: /* @__PURE__ */ l("div", { className: "flex w-52 items-center", children: [
|
|
73
|
+
/* @__PURE__ */ o(
|
|
74
|
+
"input",
|
|
75
|
+
{
|
|
76
|
+
ref: h,
|
|
77
|
+
id: S,
|
|
78
|
+
className: "bg-background placeholder:text-muted-foreground h-8 flex-1 rounded-md border-0 px-2 py-1 text-xs outline-none",
|
|
79
|
+
placeholder: i.searchPlaceholder,
|
|
80
|
+
value: c,
|
|
81
|
+
onChange: (e) => {
|
|
82
|
+
s(e.target.value);
|
|
83
|
+
},
|
|
84
|
+
onKeyDown: (e) => {
|
|
85
|
+
if (e.key === "Escape") {
|
|
86
|
+
const r = e.target;
|
|
87
|
+
r.value ? (s(""), r.focus()) : (a(!1), r.closest(".relative")?.querySelector(
|
|
88
|
+
'button[aria-label="Search"]'
|
|
89
|
+
)?.focus());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
c !== "" && /* @__PURE__ */ o(
|
|
95
|
+
g,
|
|
96
|
+
{
|
|
97
|
+
className: "text-muted-foreground hover:text-foreground hover:text-d-destructive absolute top-1 right-0 size-6 -translate-y-1",
|
|
98
|
+
iconLeft: "X",
|
|
99
|
+
size: "icon",
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
onClick: B,
|
|
102
|
+
"aria-label": i.clearSearch
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }) });
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
P as DataTableSearchbar
|
|
112
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import { AppSelect as d } from "../../../app-select.js";
|
|
4
|
+
import { Button as m } from "../../../button.js";
|
|
5
|
+
import { Popover as v, PopoverTrigger as h, PopoverContent as g } from "../../../popover.js";
|
|
6
|
+
import { getStringFilterOptions as x, getNumberFilterOptions as T, getBooleanFilterOptions as b, getDateFilterOptions as y, getDateTimeFilterOptions as C, getListSingleSelectFilterOptions as D, getListMultiSelectFilterOptions as w } from "../data-table-constants.js";
|
|
7
|
+
import { FilterValueInput as l } from "./data-table-filter-inputs.js";
|
|
8
|
+
function p({
|
|
9
|
+
filter: e,
|
|
10
|
+
setFilterBadges: n,
|
|
11
|
+
options: t,
|
|
12
|
+
content: r,
|
|
13
|
+
i18n: i
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
16
|
+
/* @__PURE__ */ s("div", { className: "flex max-w-full flex-row items-center justify-between gap-2", children: [
|
|
17
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-row items-center gap-2", children: [
|
|
18
|
+
/* @__PURE__ */ a("div", { className: "text-d-foreground max-w-[40%] overflow-hidden text-xs text-ellipsis whitespace-nowrap", children: e.columnLabel }),
|
|
19
|
+
/* @__PURE__ */ a(
|
|
20
|
+
d,
|
|
21
|
+
{
|
|
22
|
+
size: "sm",
|
|
23
|
+
wrpClassName: "flex flex-1",
|
|
24
|
+
options: t,
|
|
25
|
+
value: e.operator ?? "eq",
|
|
26
|
+
onValueChange: (o) => n(
|
|
27
|
+
(u) => u.map(
|
|
28
|
+
(c) => c.id === e.id ? { ...c, operator: String(o) } : c
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
] }),
|
|
34
|
+
/* @__PURE__ */ s(v, { children: [
|
|
35
|
+
/* @__PURE__ */ a(h, { asChild: !0, children: /* @__PURE__ */ a(m, { variant: "ghost", iconLeft: "Ellipsis", size: "sm" }) }),
|
|
36
|
+
/* @__PURE__ */ a(g, { side: "right", className: "flex w-auto", children: /* @__PURE__ */ a(
|
|
37
|
+
m,
|
|
38
|
+
{
|
|
39
|
+
variant: "ghost-destructive",
|
|
40
|
+
iconLeft: "Trash2",
|
|
41
|
+
size: "sm",
|
|
42
|
+
onClick: () => n(
|
|
43
|
+
(o) => o.filter((u) => u.id !== e.id)
|
|
44
|
+
),
|
|
45
|
+
children: i.filters.deleteFilter
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ a("div", { children: r })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function _({
|
|
54
|
+
filter: e,
|
|
55
|
+
setFilterBadges: n,
|
|
56
|
+
i18n: t
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ a(
|
|
59
|
+
p,
|
|
60
|
+
{
|
|
61
|
+
filter: e,
|
|
62
|
+
setFilterBadges: n,
|
|
63
|
+
options: x(t),
|
|
64
|
+
content: /* @__PURE__ */ a(
|
|
65
|
+
l,
|
|
66
|
+
{
|
|
67
|
+
columnType: "string",
|
|
68
|
+
operator: e.operator,
|
|
69
|
+
value: e.value,
|
|
70
|
+
onChange: (r) => n(
|
|
71
|
+
(i) => i.map((o) => o.id === e.id ? { ...o, value: r } : o)
|
|
72
|
+
),
|
|
73
|
+
i18n: t
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
i18n: t
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function j({
|
|
81
|
+
filter: e,
|
|
82
|
+
setFilterBadges: n,
|
|
83
|
+
i18n: t
|
|
84
|
+
}) {
|
|
85
|
+
return /* @__PURE__ */ a(
|
|
86
|
+
p,
|
|
87
|
+
{
|
|
88
|
+
filter: e,
|
|
89
|
+
setFilterBadges: n,
|
|
90
|
+
options: T(t),
|
|
91
|
+
content: /* @__PURE__ */ a(
|
|
92
|
+
l,
|
|
93
|
+
{
|
|
94
|
+
columnType: "number",
|
|
95
|
+
operator: e.operator,
|
|
96
|
+
value: e.value,
|
|
97
|
+
onChange: (r) => n(
|
|
98
|
+
(i) => i.map((o) => o.id === e.id ? { ...o, value: r } : o)
|
|
99
|
+
),
|
|
100
|
+
i18n: t
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
i18n: t
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function z({
|
|
108
|
+
filter: e,
|
|
109
|
+
setFilterBadges: n,
|
|
110
|
+
i18n: t
|
|
111
|
+
}) {
|
|
112
|
+
return /* @__PURE__ */ a(
|
|
113
|
+
p,
|
|
114
|
+
{
|
|
115
|
+
filter: e,
|
|
116
|
+
setFilterBadges: n,
|
|
117
|
+
options: b(t),
|
|
118
|
+
content: /* @__PURE__ */ a(
|
|
119
|
+
l,
|
|
120
|
+
{
|
|
121
|
+
columnType: "boolean",
|
|
122
|
+
operator: e.operator,
|
|
123
|
+
value: e.value,
|
|
124
|
+
onChange: (r) => n(
|
|
125
|
+
(i) => i.map((o) => o.id === e.id ? { ...o, value: r } : o)
|
|
126
|
+
),
|
|
127
|
+
i18n: t
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
i18n: t
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function P({
|
|
135
|
+
filter: e,
|
|
136
|
+
setFilterBadges: n,
|
|
137
|
+
i18n: t
|
|
138
|
+
}) {
|
|
139
|
+
return /* @__PURE__ */ a(
|
|
140
|
+
p,
|
|
141
|
+
{
|
|
142
|
+
filter: e,
|
|
143
|
+
setFilterBadges: n,
|
|
144
|
+
options: D(t),
|
|
145
|
+
content: /* @__PURE__ */ a(
|
|
146
|
+
l,
|
|
147
|
+
{
|
|
148
|
+
columnType: "list_single_select",
|
|
149
|
+
operator: e.operator,
|
|
150
|
+
value: e.value,
|
|
151
|
+
onChange: (r) => n(
|
|
152
|
+
(i) => i.map(
|
|
153
|
+
(o) => o.id === e.id ? {
|
|
154
|
+
...o,
|
|
155
|
+
value: Array.isArray(r) && r.length === 0 ? void 0 : r
|
|
156
|
+
} : o
|
|
157
|
+
)
|
|
158
|
+
),
|
|
159
|
+
listOptions: e.listOptions ?? [],
|
|
160
|
+
i18n: t
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
i18n: t
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
function M({
|
|
168
|
+
filter: e,
|
|
169
|
+
setFilterBadges: n,
|
|
170
|
+
i18n: t
|
|
171
|
+
}) {
|
|
172
|
+
return /* @__PURE__ */ a(
|
|
173
|
+
p,
|
|
174
|
+
{
|
|
175
|
+
filter: e,
|
|
176
|
+
setFilterBadges: n,
|
|
177
|
+
options: w(t),
|
|
178
|
+
content: /* @__PURE__ */ a(
|
|
179
|
+
l,
|
|
180
|
+
{
|
|
181
|
+
columnType: "list_multi_select",
|
|
182
|
+
operator: e.operator,
|
|
183
|
+
value: e.value,
|
|
184
|
+
onChange: (r) => n(
|
|
185
|
+
(i) => i.map(
|
|
186
|
+
(o) => o.id === e.id ? {
|
|
187
|
+
...o,
|
|
188
|
+
value: Array.isArray(r) && r.length === 0 ? void 0 : r
|
|
189
|
+
} : o
|
|
190
|
+
)
|
|
191
|
+
),
|
|
192
|
+
listOptions: e.listOptions ?? [],
|
|
193
|
+
i18n: t
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
i18n: t
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
function V({
|
|
201
|
+
filter: e,
|
|
202
|
+
setFilterBadges: n,
|
|
203
|
+
i18n: t
|
|
204
|
+
}) {
|
|
205
|
+
return /* @__PURE__ */ a(
|
|
206
|
+
p,
|
|
207
|
+
{
|
|
208
|
+
filter: e,
|
|
209
|
+
setFilterBadges: n,
|
|
210
|
+
options: y(t),
|
|
211
|
+
content: /* @__PURE__ */ a(
|
|
212
|
+
l,
|
|
213
|
+
{
|
|
214
|
+
columnType: "date",
|
|
215
|
+
operator: e.operator,
|
|
216
|
+
value: e.value,
|
|
217
|
+
onChange: (r) => n(
|
|
218
|
+
(i) => i.map((o) => o.id === e.id ? { ...o, value: r } : o)
|
|
219
|
+
),
|
|
220
|
+
i18n: t
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
i18n: t
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
function k({
|
|
228
|
+
filter: e,
|
|
229
|
+
setFilterBadges: n,
|
|
230
|
+
i18n: t
|
|
231
|
+
}) {
|
|
232
|
+
return /* @__PURE__ */ a(
|
|
233
|
+
p,
|
|
234
|
+
{
|
|
235
|
+
filter: e,
|
|
236
|
+
setFilterBadges: n,
|
|
237
|
+
options: C(t),
|
|
238
|
+
content: /* @__PURE__ */ a(
|
|
239
|
+
l,
|
|
240
|
+
{
|
|
241
|
+
columnType: "datetime",
|
|
242
|
+
operator: e.operator,
|
|
243
|
+
value: e.value,
|
|
244
|
+
onChange: (r) => n(
|
|
245
|
+
(i) => i.map((o) => o.id === e.id ? { ...o, value: r } : o)
|
|
246
|
+
),
|
|
247
|
+
i18n: t
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
i18n: t
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
export {
|
|
255
|
+
z as DataTableBooleanFilter,
|
|
256
|
+
V as DataTableDateFilter,
|
|
257
|
+
k as DataTableDateTimeFilter,
|
|
258
|
+
p as DataTableFilter,
|
|
259
|
+
M as DataTableListMultiSelectFilter,
|
|
260
|
+
P as DataTableListSingleSelectFilter,
|
|
261
|
+
j as DataTableNumberFilter,
|
|
262
|
+
_ as DataTableStringFilter
|
|
263
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { AppSelect as h } from "../../../app-select.js";
|
|
4
|
+
import { Badge as S } from "../../../badge.js";
|
|
5
|
+
import { Button as f } from "../../../button.js";
|
|
6
|
+
import { Icon as z } from "../../../icon.js";
|
|
7
|
+
import { Popover as C, PopoverTrigger as k, PopoverContent as A } from "../../../popover.js";
|
|
8
|
+
function T({
|
|
9
|
+
table: a,
|
|
10
|
+
sortedColumns: g = [],
|
|
11
|
+
sortableColumns: d,
|
|
12
|
+
i18n: l,
|
|
13
|
+
maxSortedColumns: m = 3
|
|
14
|
+
}) {
|
|
15
|
+
const r = a.getState().sorting || [], p = new Set(r.map((n) => n.id)), u = (n, t) => {
|
|
16
|
+
const e = r[n], s = r.map(
|
|
17
|
+
(i, N) => N === n ? { id: t, desc: e?.desc ?? !1 } : i
|
|
18
|
+
);
|
|
19
|
+
a.setSorting(s);
|
|
20
|
+
}, x = (n, t) => {
|
|
21
|
+
const e = r.map(
|
|
22
|
+
(s, i) => i === n ? { ...s, desc: t === "desc" } : s
|
|
23
|
+
);
|
|
24
|
+
a.setSorting(e);
|
|
25
|
+
}, v = () => {
|
|
26
|
+
if (r.length >= m) return;
|
|
27
|
+
const n = new Set(r.map((i) => i.id)), e = (d.find((i) => !n.has(i.column.id)) ?? d[0])?.column.id;
|
|
28
|
+
if (!e) return;
|
|
29
|
+
const s = [...r, { id: e, desc: !1 }];
|
|
30
|
+
a.setSorting(s);
|
|
31
|
+
}, w = (n) => {
|
|
32
|
+
const t = r.filter((e, s) => s !== n);
|
|
33
|
+
a.setSorting(t);
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ c(C, { children: [
|
|
36
|
+
/* @__PURE__ */ o(k, { asChild: !0, children: /* @__PURE__ */ c(
|
|
37
|
+
S,
|
|
38
|
+
{
|
|
39
|
+
variant: g.length > 0 ? "default" : "ghost",
|
|
40
|
+
className: "hover:border-d-border cursor-pointer hover:border",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ o(z, { name: "ArrowUpDown" }),
|
|
43
|
+
l.sorting.sort
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
) }),
|
|
47
|
+
/* @__PURE__ */ c(A, { className: "flex w-[400px] flex-col gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ o("div", { className: "text-d-foreground text-md font-semibold", children: l.sorting.sorting }),
|
|
49
|
+
g.length > 0 && /* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: [
|
|
50
|
+
/* @__PURE__ */ c("div", { className: "flex w-full flex-row gap-1 pr-9 text-sm", children: [
|
|
51
|
+
/* @__PURE__ */ o("div", { className: "flex flex-1", children: l.sorting.column }),
|
|
52
|
+
/* @__PURE__ */ o("div", { className: "flex flex-1", children: l.sorting.order })
|
|
53
|
+
] }),
|
|
54
|
+
g.map((n, t) => /* @__PURE__ */ c("div", { className: "flex w-full flex-row items-end gap-1", children: [
|
|
55
|
+
/* @__PURE__ */ o(
|
|
56
|
+
h,
|
|
57
|
+
{
|
|
58
|
+
size: "sm",
|
|
59
|
+
wrpClassName: "flex flex-1",
|
|
60
|
+
options: d.filter((e) => {
|
|
61
|
+
const s = e.column.id;
|
|
62
|
+
return s === n?.column.id || !p.has(s);
|
|
63
|
+
}).map((e) => ({
|
|
64
|
+
value: e.column.id,
|
|
65
|
+
label: e.column.columnDef.header?.toString() || e.column.id
|
|
66
|
+
})),
|
|
67
|
+
value: n?.column.id,
|
|
68
|
+
onValueChange: (e) => {
|
|
69
|
+
e != null && u(t, String(e));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ o(
|
|
74
|
+
h,
|
|
75
|
+
{
|
|
76
|
+
size: "sm",
|
|
77
|
+
wrpClassName: "flex flex-1",
|
|
78
|
+
options: [
|
|
79
|
+
{ value: "asc", label: l.sorting.ascending },
|
|
80
|
+
{ value: "desc", label: l.sorting.descending }
|
|
81
|
+
],
|
|
82
|
+
value: r?.[t]?.desc ? "desc" : "asc",
|
|
83
|
+
onValueChange: (e) => {
|
|
84
|
+
e && x(t, e);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ o(
|
|
89
|
+
f,
|
|
90
|
+
{
|
|
91
|
+
variant: "ghost-destructive",
|
|
92
|
+
size: "sm",
|
|
93
|
+
onClick: () => w(t),
|
|
94
|
+
iconLeft: "X"
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }, t))
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ c("div", { className: "flex w-full gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ o(
|
|
101
|
+
f,
|
|
102
|
+
{
|
|
103
|
+
className: "flex flex-1",
|
|
104
|
+
variant: "ghost-destructive",
|
|
105
|
+
size: "sm",
|
|
106
|
+
onClick: () => a.resetSorting(),
|
|
107
|
+
disabled: r.length === 0 || d.length === 0,
|
|
108
|
+
children: l.sorting.resetSorting
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ o(
|
|
112
|
+
f,
|
|
113
|
+
{
|
|
114
|
+
className: "flex flex-1",
|
|
115
|
+
variant: "ghost",
|
|
116
|
+
size: "sm",
|
|
117
|
+
onClick: v,
|
|
118
|
+
disabled: d.length === 0 || r.length >= m,
|
|
119
|
+
children: l.sorting.addSort
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
T as DataTableSortingComponent
|
|
128
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var a = /* @__PURE__ */ ((e) => (e.AND = "AND", e.OR = "OR", e))(a || {});
|
|
3
|
+
const l = (e) => [
|
|
4
|
+
{ value: "like", label: e.stringOperators.like },
|
|
5
|
+
{ value: "n_like", label: e.stringOperators.nLike },
|
|
6
|
+
{ value: "starts_with", label: e.stringOperators.startsWith },
|
|
7
|
+
{ value: "ends_with", label: e.stringOperators.endsWith },
|
|
8
|
+
{ value: "eq", label: e.stringOperators.eq },
|
|
9
|
+
{ value: "ne", label: e.stringOperators.ne }
|
|
10
|
+
// { value: "eq_null", label: i18n.stringOperators.eqNull },
|
|
11
|
+
// { value: "n_eq_null", label: i18n.stringOperators.nEqNull },
|
|
12
|
+
], t = (e) => [
|
|
13
|
+
{ value: "eq", label: e.numberOperators.eq },
|
|
14
|
+
{ value: "ne", label: e.numberOperators.ne },
|
|
15
|
+
{ value: "lt", label: e.numberOperators.lt },
|
|
16
|
+
{ value: "le", label: e.numberOperators.le },
|
|
17
|
+
{ value: "gt", label: e.numberOperators.gt },
|
|
18
|
+
{ value: "ge", label: e.numberOperators.ge }
|
|
19
|
+
// { value: "eq_null", label: i18n.numberOperators.eqNull },
|
|
20
|
+
// { value: "n_eq_null", label: i18n.numberOperators.nEqNull },
|
|
21
|
+
], r = (e) => [
|
|
22
|
+
{ value: "eq", label: e.booleanOperators.eq },
|
|
23
|
+
{ value: "ne", label: e.booleanOperators.ne },
|
|
24
|
+
{ value: "checked", label: e.booleanOperators.checked },
|
|
25
|
+
{ value: "unchecked", label: e.booleanOperators.unchecked }
|
|
26
|
+
], s = (e) => [
|
|
27
|
+
{ value: "eq", label: e.dateOperators.is },
|
|
28
|
+
{ value: "date_before", label: e.dateOperators.isBefore },
|
|
29
|
+
{ value: "date_after", label: e.dateOperators.isAfter }
|
|
30
|
+
// { value: "eq_null", label: i18n.dateOperators.eqNull },
|
|
31
|
+
// { value: "n_eq_null", label: i18n.dateOperators.nEqNull },
|
|
32
|
+
], o = (e) => [
|
|
33
|
+
{ value: "date_time_before", label: e.dateTimeOperators.isBefore },
|
|
34
|
+
{ value: "date_time_after", label: e.dateTimeOperators.isAfter }
|
|
35
|
+
// { value: "eq_null", label: i18n.dateTimeOperators.eqNull },
|
|
36
|
+
// { value: "n_eq_null", label: i18n.dateTimeOperators.nEqNull },
|
|
37
|
+
], b = (e) => [
|
|
38
|
+
{ value: "array_overlap", label: e.listOperators.is },
|
|
39
|
+
{ value: "n_array_overlap", label: e.listOperators.isNot }
|
|
40
|
+
// { value: "eq_null", label: i18n.listOperators.eqNull },
|
|
41
|
+
// { value: "n_eq_null", label: i18n.listOperators.nEqNull },
|
|
42
|
+
], u = (e) => [
|
|
43
|
+
{ value: "array_overlap", label: e.listOperators.contains },
|
|
44
|
+
{ value: "n_array_overlap", label: e.listOperators.doesNotContain }
|
|
45
|
+
// { value: "eq_null", label: i18n.listOperators.eqNull },
|
|
46
|
+
// { value: "n_eq_null", label: i18n.listOperators.nEqNull },
|
|
47
|
+
], n = "border-d-destructive border rounded-md";
|
|
48
|
+
export {
|
|
49
|
+
a as ELogicalFilterOperator,
|
|
50
|
+
n as errorSelectClass,
|
|
51
|
+
r as getBooleanFilterOptions,
|
|
52
|
+
s as getDateFilterOptions,
|
|
53
|
+
o as getDateTimeFilterOptions,
|
|
54
|
+
u as getListMultiSelectFilterOptions,
|
|
55
|
+
b as getListSingleSelectFilterOptions,
|
|
56
|
+
t as getNumberFilterOptions,
|
|
57
|
+
l as getStringFilterOptions
|
|
58
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const e = {
|
|
3
|
+
// General
|
|
4
|
+
search: "Search",
|
|
5
|
+
searchPlaceholder: "Search...",
|
|
6
|
+
clearSearch: "Clear search",
|
|
7
|
+
reset: "Reset",
|
|
8
|
+
loading: "Loading...",
|
|
9
|
+
notFoundMessage: "No results found",
|
|
10
|
+
// Tooltip / helper text
|
|
11
|
+
searchTooltipLabel: "You will search across these columns:",
|
|
12
|
+
// Checkboxes
|
|
13
|
+
selectAll: "Select all",
|
|
14
|
+
selectRow: "Select row",
|
|
15
|
+
// Filters
|
|
16
|
+
filters: {
|
|
17
|
+
addFilter: "Add Filter",
|
|
18
|
+
advancedFilter: "Advanced Filter",
|
|
19
|
+
addFilterRule: "Add Rule",
|
|
20
|
+
addFilterGroup: "Add Group",
|
|
21
|
+
deleteFilter: "Delete Filter",
|
|
22
|
+
deleteCondition: "Delete Condition",
|
|
23
|
+
deleteGroup: "Delete Group",
|
|
24
|
+
duplicateCondition: "Duplicate Condition",
|
|
25
|
+
duplicateGroup: "Duplicate Group",
|
|
26
|
+
operator: "Operator",
|
|
27
|
+
value: "Value",
|
|
28
|
+
searchFilters: "Search columns",
|
|
29
|
+
searchPlaceholder: "Search",
|
|
30
|
+
selectDate: "Select date",
|
|
31
|
+
where: "Where",
|
|
32
|
+
and: "AND",
|
|
33
|
+
or: "OR",
|
|
34
|
+
filterNotSupported: "Filter not supported",
|
|
35
|
+
column: "Column",
|
|
36
|
+
filter: "Filter"
|
|
37
|
+
},
|
|
38
|
+
// Filter operators - String
|
|
39
|
+
stringOperators: {
|
|
40
|
+
eq: "Equal to",
|
|
41
|
+
ne: "Not equal to",
|
|
42
|
+
like: "Contains",
|
|
43
|
+
nLike: "Does not contain",
|
|
44
|
+
startsWith: "Starts with",
|
|
45
|
+
endsWith: "Ends with",
|
|
46
|
+
eqNull: "Is empty",
|
|
47
|
+
nEqNull: "Is not empty"
|
|
48
|
+
},
|
|
49
|
+
// Filter operators - Number
|
|
50
|
+
numberOperators: {
|
|
51
|
+
eq: "=",
|
|
52
|
+
ne: "!=",
|
|
53
|
+
lt: "<",
|
|
54
|
+
le: "<=",
|
|
55
|
+
gt: ">",
|
|
56
|
+
ge: ">=",
|
|
57
|
+
eqNull: "Is empty",
|
|
58
|
+
nEqNull: "Is not empty"
|
|
59
|
+
},
|
|
60
|
+
// Filter operators - Boolean
|
|
61
|
+
booleanOperators: {
|
|
62
|
+
eq: "Equal to",
|
|
63
|
+
ne: "Not equal to",
|
|
64
|
+
checked: "Checked",
|
|
65
|
+
unchecked: "Unchecked",
|
|
66
|
+
true: "True",
|
|
67
|
+
false: "False"
|
|
68
|
+
},
|
|
69
|
+
// Filter operators - Date
|
|
70
|
+
dateOperators: {
|
|
71
|
+
is: "Is",
|
|
72
|
+
isBefore: "Is before",
|
|
73
|
+
isAfter: "Is after",
|
|
74
|
+
eqNull: "Is empty",
|
|
75
|
+
nEqNull: "Is not empty"
|
|
76
|
+
},
|
|
77
|
+
// Filter operators - DateTime
|
|
78
|
+
dateTimeOperators: {
|
|
79
|
+
isBefore: "Is before",
|
|
80
|
+
isAfter: "Is after",
|
|
81
|
+
eqNull: "Is empty",
|
|
82
|
+
nEqNull: "Is not empty"
|
|
83
|
+
},
|
|
84
|
+
// Filter operators - List
|
|
85
|
+
listOperators: {
|
|
86
|
+
is: "Is",
|
|
87
|
+
isNot: "Is not",
|
|
88
|
+
contains: "Contains",
|
|
89
|
+
doesNotContain: "Does not contain",
|
|
90
|
+
eqNull: "Is empty",
|
|
91
|
+
nEqNull: "Is not empty"
|
|
92
|
+
},
|
|
93
|
+
// Sorting
|
|
94
|
+
sorting: {
|
|
95
|
+
sort: "Sort",
|
|
96
|
+
sorting: "Sorting",
|
|
97
|
+
column: "Column",
|
|
98
|
+
order: "Order",
|
|
99
|
+
sortBy: "Sort by",
|
|
100
|
+
ascending: "Ascending",
|
|
101
|
+
descending: "Descending",
|
|
102
|
+
clearSort: "Clear sort",
|
|
103
|
+
resetSorting: "Reset Sorting",
|
|
104
|
+
addSort: "Add sort"
|
|
105
|
+
},
|
|
106
|
+
// Column visibility
|
|
107
|
+
columnVisibility: {
|
|
108
|
+
visibleColumns: "Visible columns",
|
|
109
|
+
hiddenColumns: "Hidden columns",
|
|
110
|
+
hideColumn: "Hide column",
|
|
111
|
+
showColumn: "Show column",
|
|
112
|
+
hideAll: "Hide all",
|
|
113
|
+
showAll: "Show all"
|
|
114
|
+
},
|
|
115
|
+
// Pagination
|
|
116
|
+
pagination: {
|
|
117
|
+
previous: "Previous",
|
|
118
|
+
next: "Next",
|
|
119
|
+
first: "First",
|
|
120
|
+
last: "Last",
|
|
121
|
+
page: "Page",
|
|
122
|
+
of: "of",
|
|
123
|
+
rows: "rows",
|
|
124
|
+
pages: "pages",
|
|
125
|
+
rowsPerPage: "Rows per page",
|
|
126
|
+
goToPage: "Go to page",
|
|
127
|
+
showing: "Showing",
|
|
128
|
+
to: "to",
|
|
129
|
+
entries: "entries"
|
|
130
|
+
},
|
|
131
|
+
// Table actions
|
|
132
|
+
tableActions: {
|
|
133
|
+
actions: "Actions"
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
e as defaultDataTableI18n
|
|
138
|
+
};
|