@oneplatformdev/ui 0.0.1-beta.32 → 0.0.1-beta.33
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/DataTable/DataTable.mjs
CHANGED
@@ -1,64 +1,45 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { flexRender as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
import { Table as w, TableHeader as x, TableRow as o, TableHead as T, TableBody as D, TableCell as a } from "../Table/Table.mjs";
|
8
|
-
const B = (s) => {
|
9
|
-
var i;
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { flexRender as i } from "@tanstack/react-table";
|
3
|
+
import { Table as h, TableHeader as u, TableRow as n, TableHead as b, TableBody as g, TableCell as c } from "../Table/Table.mjs";
|
4
|
+
import { DataTableColumnFilter as f } from "./DataTableColumnFilter.mjs";
|
5
|
+
const N = (d) => {
|
6
|
+
var o;
|
10
7
|
const {
|
11
|
-
table:
|
12
|
-
ToolBar:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
/* @__PURE__ */ r(g, { children: [
|
20
|
-
/* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ r(p, { variant: "outline", className: "ml-auto", children: [
|
21
|
-
m,
|
22
|
-
/* @__PURE__ */ l(u, { className: "ml-2 h-4 w-4" })
|
23
|
-
] }) }),
|
24
|
-
/* @__PURE__ */ l(C, { align: "end", children: t.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ l(
|
25
|
-
f,
|
26
|
-
{
|
27
|
-
className: "capitalize",
|
28
|
-
checked: e.getIsVisible(),
|
29
|
-
onCheckedChange: (n) => e.toggleVisibility(!!n),
|
30
|
-
children: e.id
|
31
|
-
},
|
32
|
-
e.id
|
33
|
-
)) })
|
34
|
-
] })
|
8
|
+
table: r,
|
9
|
+
ToolBar: s,
|
10
|
+
noResultLabel: m = "No results"
|
11
|
+
} = d;
|
12
|
+
return /* @__PURE__ */ a("div", { className: "w-full", children: [
|
13
|
+
/* @__PURE__ */ a("div", { className: "flex items-center py-4", children: [
|
14
|
+
s,
|
15
|
+
/* @__PURE__ */ e(f, { ...d })
|
35
16
|
] }),
|
36
|
-
/* @__PURE__ */
|
37
|
-
/* @__PURE__ */
|
38
|
-
|
39
|
-
|
40
|
-
) },
|
41
|
-
/* @__PURE__ */
|
42
|
-
|
17
|
+
/* @__PURE__ */ e("div", { className: "rounded-md border", children: /* @__PURE__ */ a(h, { children: [
|
18
|
+
/* @__PURE__ */ e(u, { children: r.getHeaderGroups().map((t) => /* @__PURE__ */ e(n, { children: t.headers.map((l) => /* @__PURE__ */ e(b, { children: l.isPlaceholder ? null : i(
|
19
|
+
l.column.columnDef.header,
|
20
|
+
l.getContext()
|
21
|
+
) }, l.id)) }, t.id)) }),
|
22
|
+
/* @__PURE__ */ e(g, { children: (o = r.getRowModel().rows) != null && o.length ? r.getRowModel().rows.map((t) => /* @__PURE__ */ e(
|
23
|
+
n,
|
43
24
|
{
|
44
|
-
"data-state":
|
45
|
-
children:
|
46
|
-
|
47
|
-
|
48
|
-
) },
|
25
|
+
"data-state": t.getIsSelected() && "selected",
|
26
|
+
children: t.getVisibleCells().map((l) => /* @__PURE__ */ e(c, { children: i(
|
27
|
+
l.column.columnDef.cell,
|
28
|
+
l.getContext()
|
29
|
+
) }, l.id))
|
49
30
|
},
|
50
|
-
|
51
|
-
)) : /* @__PURE__ */
|
52
|
-
|
31
|
+
t.id
|
32
|
+
)) : /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
|
33
|
+
c,
|
53
34
|
{
|
54
|
-
colSpan:
|
35
|
+
colSpan: r.getAllColumns().length,
|
55
36
|
className: "h-24 text-center",
|
56
|
-
children:
|
37
|
+
children: m
|
57
38
|
}
|
58
39
|
) }) })
|
59
40
|
] }) })
|
60
41
|
] });
|
61
42
|
};
|
62
43
|
export {
|
63
|
-
|
44
|
+
N as DataTable
|
64
45
|
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { jsx as n, jsxs as t } from "react/jsx-runtime";
|
2
|
+
import { ChevronDown as m } from "lucide-react";
|
3
|
+
import { useMemo as s } from "react";
|
4
|
+
import { Button as d } from "../Button/Button.mjs";
|
5
|
+
import "../Button/buttonVariants.mjs";
|
6
|
+
import { DropdownMenuCheckboxItem as c, DropdownMenu as u, DropdownMenuTrigger as h, DropdownMenuContent as p } from "../DropdownMenu/DropdownMenu.mjs";
|
7
|
+
const x = (i) => {
|
8
|
+
const {
|
9
|
+
table: r,
|
10
|
+
columnsLabel: l = "Columns"
|
11
|
+
} = i, o = s(() => r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ n(
|
12
|
+
c,
|
13
|
+
{
|
14
|
+
className: "capitalize",
|
15
|
+
checked: e.getIsVisible(),
|
16
|
+
onCheckedChange: (a) => e.toggleVisibility(!!a),
|
17
|
+
children: e.id
|
18
|
+
},
|
19
|
+
e.id
|
20
|
+
)), [r]);
|
21
|
+
return o.length ? /* @__PURE__ */ t(u, { children: [
|
22
|
+
/* @__PURE__ */ n(h, { asChild: !0, children: /* @__PURE__ */ t(d, { variant: "outline", className: "ml-auto", children: [
|
23
|
+
l,
|
24
|
+
/* @__PURE__ */ n(m, { className: "ml-2 h-4 w-4" })
|
25
|
+
] }) }),
|
26
|
+
/* @__PURE__ */ n(p, { align: "end", children: o })
|
27
|
+
] }) : null;
|
28
|
+
};
|
29
|
+
export {
|
30
|
+
x as DataTableColumnFilter
|
31
|
+
};
|