@cryptlex/web-components 1.4.0 → 1.4.1
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/components/data-table/data-table.es.js +51 -49
- package/dist/components/data-table/data-table.es.js.map +1 -1
- package/dist/components/data-table/table-commons.es.js +5 -4
- package/dist/components/data-table/table-commons.es.js.map +1 -1
- package/dist/components/data-table/table-content.es.js +24 -27
- package/dist/components/data-table/table-content.es.js.map +1 -1
- package/dist/components/ui/table.es.js +7 -7
- package/dist/components/ui/table.es.js.map +1 -1
- package/dist/index.es.d.ts +9 -6
- package/dist/index.es.js +109 -108
- package/lib/tailwind.preset.css +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as i, jsxs as c } from "react/jsx-runtime";
|
|
3
|
-
import { TableFilter as
|
|
3
|
+
import { TableFilter as q } from "./table-filter.es.js";
|
|
4
4
|
import "../ui/accordion.es.js";
|
|
5
5
|
import "../ui/avatar.es.js";
|
|
6
6
|
import "../ui/badge.es.js";
|
|
@@ -12,8 +12,8 @@ import "../ui/chart.es.js";
|
|
|
12
12
|
import "../ui/checkbox.es.js";
|
|
13
13
|
import "@radix-ui/react-collapsible";
|
|
14
14
|
import "../ui/command.es.js";
|
|
15
|
-
import { Info as
|
|
16
|
-
import { useState as
|
|
15
|
+
import { Info as H } from "lucide-react";
|
|
16
|
+
import { useState as A, useEffect as W, useMemo as u } from "react";
|
|
17
17
|
import "../ui/dialog.es.js";
|
|
18
18
|
import "../ui/drawer.es.js";
|
|
19
19
|
import "../ui/dropdown-menu.es.js";
|
|
@@ -43,19 +43,20 @@ import { ColumnPicker as it } from "./column-picker.es.js";
|
|
|
43
43
|
import { PageSize as rt } from "./page-size.es.js";
|
|
44
44
|
import { Paginator as nt } from "./paginator.es.js";
|
|
45
45
|
import at from "./table-actions.es.js";
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
46
|
+
import { TableContent as lt } from "./table-content.es.js";
|
|
47
|
+
import { TABLE_CHECK_BOX_COLUMN as st, TABLE_ID_COLUMN as mt, TABLE_DEFAULT_DATE_COLUMNS as ct } from "./table-commons.es.js";
|
|
48
48
|
import { DEFAULT_FILTERABLE_FIELDS as pt } from "./table-utils/constants.es.js";
|
|
49
|
-
|
|
49
|
+
const ne = "actions_button";
|
|
50
|
+
function ae({
|
|
50
51
|
columns: g,
|
|
51
|
-
fetchFn:
|
|
52
|
-
tableName:
|
|
52
|
+
fetchFn: M,
|
|
53
|
+
tableName: O,
|
|
53
54
|
tableActions: h,
|
|
54
|
-
columnsToHideByDefault:
|
|
55
|
-
filterableFields:
|
|
55
|
+
columnsToHideByDefault: S,
|
|
56
|
+
filterableFields: I
|
|
56
57
|
}) {
|
|
57
|
-
var
|
|
58
|
-
const [
|
|
58
|
+
var F, _, D, E, L, N;
|
|
59
|
+
const [V, U] = A({
|
|
59
60
|
sorting: [],
|
|
60
61
|
// Sorting state
|
|
61
62
|
columnFilters: [],
|
|
@@ -69,24 +70,24 @@ function ne({
|
|
|
69
70
|
pagination: { pageIndex: 0, pageSize: 20 }
|
|
70
71
|
// Pagination state
|
|
71
72
|
}), a = (t) => {
|
|
72
|
-
|
|
73
|
-
}, { sorting: p, columnFilters:
|
|
74
|
-
|
|
73
|
+
U((e) => ({ ...e, ...t }));
|
|
74
|
+
}, { sorting: p, columnFilters: w, searching: y, columnVisibility: T, rowSelection: f, pagination: d } = V, [j] = ot(y.trim(), 300);
|
|
75
|
+
W(() => {
|
|
75
76
|
a({
|
|
76
|
-
columnVisibility: { id: !1, updatedAt: !1, ...
|
|
77
|
+
columnVisibility: { id: !1, updatedAt: !1, ...S }
|
|
77
78
|
});
|
|
78
|
-
}, [
|
|
79
|
-
const [
|
|
79
|
+
}, [S]);
|
|
80
|
+
const [C, R] = A([]), x = u(() => C.reduce((t, e) => {
|
|
80
81
|
const { property: r, value: n, operator: l } = e;
|
|
81
82
|
return t[r] || (t[r] = {}), t[r][l] = n, t;
|
|
82
|
-
}, {}), [
|
|
83
|
-
queryKey: [
|
|
84
|
-
queryFn: () =>
|
|
83
|
+
}, {}), [C]), o = Z({
|
|
84
|
+
queryKey: [O, d, p, j, x],
|
|
85
|
+
queryFn: () => M(d, p, y.trim(), x),
|
|
85
86
|
placeholderData: $,
|
|
86
87
|
// Keep previous data while loading new data
|
|
87
88
|
retry: 0,
|
|
88
89
|
refetchOnWindowFocus: !1
|
|
89
|
-
}),
|
|
90
|
+
}), k = Q(), b = u(() => {
|
|
90
91
|
var r;
|
|
91
92
|
const t = (r = o.data) == null ? void 0 : r.data;
|
|
92
93
|
if (!(t != null && t.length)) return [];
|
|
@@ -96,10 +97,10 @@ function ne({
|
|
|
96
97
|
e.add(l.key);
|
|
97
98
|
});
|
|
98
99
|
}), Array.from(e).map(
|
|
99
|
-
(n) =>
|
|
100
|
+
(n) => k.accessor(
|
|
100
101
|
(l) => {
|
|
101
|
-
var
|
|
102
|
-
const s = (
|
|
102
|
+
var P;
|
|
103
|
+
const s = (P = l.metadata) == null ? void 0 : P.find((K) => K.key === n);
|
|
103
104
|
return s == null ? void 0 : s.value;
|
|
104
105
|
},
|
|
105
106
|
{
|
|
@@ -107,7 +108,7 @@ function ne({
|
|
|
107
108
|
/* @__PURE__ */ i(J, { asChild: !0, children: /* @__PURE__ */ c("span", { className: "flex gap-1 items-center align-middle", children: [
|
|
108
109
|
n,
|
|
109
110
|
" ",
|
|
110
|
-
/* @__PURE__ */ i(
|
|
111
|
+
/* @__PURE__ */ i(H, { size: 18, strokeWidth: "1px" })
|
|
111
112
|
] }) }),
|
|
112
113
|
/* @__PURE__ */ i(Y, { children: "Metadata Key" })
|
|
113
114
|
] }) }),
|
|
@@ -121,24 +122,24 @@ function ne({
|
|
|
121
122
|
}
|
|
122
123
|
)
|
|
123
124
|
);
|
|
124
|
-
}, [(
|
|
125
|
-
...h.selection ?
|
|
126
|
-
...st,
|
|
127
|
-
...g.filter((e) => e.id !== "actions"),
|
|
128
|
-
...C.length ? C : [],
|
|
125
|
+
}, [(F = o.data) == null ? void 0 : F.data]), v = u(() => [
|
|
126
|
+
...h.selection ? st : [],
|
|
129
127
|
...mt,
|
|
128
|
+
...g.filter((e) => e.id !== "actions"),
|
|
129
|
+
...b.length ? b : [],
|
|
130
|
+
...ct,
|
|
130
131
|
...g.filter((e) => e.id === "actions")
|
|
131
|
-
], [g,
|
|
132
|
+
], [g, b, (_ = o.data) == null ? void 0 : _.data, h.selection]), z = u(
|
|
132
133
|
() => Object.entries(f).map((t) => {
|
|
133
134
|
var e, r;
|
|
134
135
|
return (r = (e = o == null ? void 0 : o.data) == null ? void 0 : e.data) == null ? void 0 : r[t[0]];
|
|
135
136
|
}),
|
|
136
|
-
[(
|
|
137
|
+
[(D = o == null ? void 0 : o.data) == null ? void 0 : D.data, f]
|
|
137
138
|
), m = tt({
|
|
138
139
|
data: ((E = o.data) == null ? void 0 : E.data) ?? [],
|
|
139
|
-
columns:
|
|
140
|
+
columns: v,
|
|
140
141
|
getCoreRowModel: et(),
|
|
141
|
-
rowCount: (
|
|
142
|
+
rowCount: (L = o.data) == null ? void 0 : L.total,
|
|
142
143
|
manualPagination: !0,
|
|
143
144
|
// Handle pagination manually
|
|
144
145
|
onPaginationChange: (t) => {
|
|
@@ -154,11 +155,11 @@ function ne({
|
|
|
154
155
|
manualFiltering: !0,
|
|
155
156
|
// Handle filtering manually
|
|
156
157
|
onGlobalFilterChange: (t) => {
|
|
157
|
-
const e = typeof t == "function" ? t(
|
|
158
|
+
const e = typeof t == "function" ? t(w) : t;
|
|
158
159
|
a({ columnFilters: e });
|
|
159
160
|
},
|
|
160
161
|
onColumnVisibilityChange: (t) => {
|
|
161
|
-
const e = typeof t == "function" ? t(
|
|
162
|
+
const e = typeof t == "function" ? t(T) : t;
|
|
162
163
|
a({ columnVisibility: e });
|
|
163
164
|
},
|
|
164
165
|
onRowSelectionChange: (t) => {
|
|
@@ -167,25 +168,25 @@ function ne({
|
|
|
167
168
|
},
|
|
168
169
|
state: {
|
|
169
170
|
sorting: p,
|
|
170
|
-
columnFilters:
|
|
171
|
-
columnVisibility:
|
|
171
|
+
columnFilters: w,
|
|
172
|
+
columnVisibility: T,
|
|
172
173
|
pagination: d,
|
|
173
174
|
rowSelection: f
|
|
174
175
|
},
|
|
175
176
|
meta: {
|
|
176
177
|
refetch: o.refetch
|
|
177
178
|
}
|
|
178
|
-
}),
|
|
179
|
+
}), B = {
|
|
179
180
|
key: "",
|
|
180
|
-
stateData:
|
|
181
|
+
stateData: z
|
|
181
182
|
};
|
|
182
183
|
return /* @__PURE__ */ c("div", { className: "flex flex-col gap-1 w-full bg-card", children: [
|
|
183
184
|
/* @__PURE__ */ i("div", { className: " px-1", children: /* @__PURE__ */ i(
|
|
184
|
-
|
|
185
|
+
q,
|
|
185
186
|
{
|
|
186
|
-
filterableProperties: { ...
|
|
187
|
-
filters:
|
|
188
|
-
onFiltersChange:
|
|
187
|
+
filterableProperties: { ...I, ...pt },
|
|
188
|
+
filters: C,
|
|
189
|
+
onFiltersChange: R
|
|
189
190
|
}
|
|
190
191
|
) }),
|
|
191
192
|
/* @__PURE__ */ i("div", { className: "border px-1", children: /* @__PURE__ */ i(
|
|
@@ -194,21 +195,22 @@ function ne({
|
|
|
194
195
|
dataQuery: o,
|
|
195
196
|
table: m,
|
|
196
197
|
tableActions: h,
|
|
197
|
-
stateToPass:
|
|
198
|
+
stateToPass: B,
|
|
198
199
|
handleSearching: (t) => a({ searching: t })
|
|
199
200
|
}
|
|
200
201
|
) }),
|
|
201
|
-
/* @__PURE__ */ i("div", { className: "relative h-[60vh] z-10 overflow-x-auto border-x align-top justify-start", children: /* @__PURE__ */ i(
|
|
202
|
+
/* @__PURE__ */ i("div", { className: "relative h-[60vh] z-10 overflow-x-auto border-x align-top justify-start", children: /* @__PURE__ */ i(lt, { table: m, columns: v, dataQuery: o }) }),
|
|
202
203
|
/* @__PURE__ */ c("div", { className: "flex overflow-auto flex-row w-full justify-between border gap-4 px-1 py-2", children: [
|
|
203
204
|
/* @__PURE__ */ c("div", { className: "flex gap-2", children: [
|
|
204
205
|
/* @__PURE__ */ i(it, { table: m }),
|
|
205
206
|
/* @__PURE__ */ i(rt, { table: m })
|
|
206
207
|
] }),
|
|
207
|
-
/* @__PURE__ */ i(nt, { table: m, rowCount: ((
|
|
208
|
+
/* @__PURE__ */ i(nt, { table: m, rowCount: ((N = o.data) == null ? void 0 : N.total) ?? 0 })
|
|
208
209
|
] })
|
|
209
210
|
] });
|
|
210
211
|
}
|
|
211
212
|
export {
|
|
212
|
-
ne as
|
|
213
|
+
ne as ACTIONS_COLUMN_ID,
|
|
214
|
+
ae as DataTable
|
|
213
215
|
};
|
|
214
216
|
//# sourceMappingURL=data-table.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.es.js","sources":["../../../lib/components/data-table/data-table.tsx"],"sourcesContent":["'use client';\nimport { TableFilter, type FilterFormType } from '@/components/data-table/table-filter';\nimport {\n DEFAULT_FILTERABLE_FIELDS,\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/index';\nimport { keepPreviousData, useQuery } from '@tanstack/react-query';\nimport {\n ColumnDef,\n ColumnFiltersState,\n createColumnHelper,\n getCoreRowModel,\n PaginationState,\n SortingState,\n useReactTable,\n VisibilityState,\n} from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useDebounce } from 'use-debounce';\nimport { ColumnPicker } from './column-picker';\nimport { PageSize } from './page-size';\nimport { Paginator } from './paginator';\nimport Actions from './table-actions';\nimport { CHECK_BOX, DEFAULT_DATE_COLUMNS, ID_COLUMN } from './table-commons';\nimport { TableContent } from './table-content';\nimport type { FilterableProperties, MetadataDto, TableActions, TableFetchFn } from './table-utils';\n\n// Props type for the DataTable component\nexport interface DataTableProps<TData, TValue = any> {\n columns: ColumnDef<TData, TValue>[]; // Columns for the table\n tableName: string; // Table name used as query key\n fetchFn: TableFetchFn<TData>; // Function for fetching data from the server\n tableActions: TableActions;\n filterableFields: FilterableProperties<TData>; // Fields that can be filtered\n columnsToHideByDefault: VisibilityState; // Columns that are hidden by default\n}\nexport function DataTable<TData extends Record<string, any>, TValue = any>({\n columns,\n fetchFn,\n tableName,\n tableActions,\n columnsToHideByDefault,\n filterableFields,\n}: DataTableProps<TData, TValue>) {\n // State for managing table data and filters\n //TODO: This is later to be stored in url as params\n const [tableState, setTableState] = useState({\n sorting: [] as SortingState, // Sorting state\n columnFilters: [] as ColumnFiltersState, // Filters for columns\n searching: '', // Search query state\n columnVisibility: {} as VisibilityState, // Visibility of columns\n rowSelection: {}, // Row selection state\n pagination: { pageIndex: 0, pageSize: 20 } as PaginationState, // Pagination state\n });\n\n // Update table state with new values\n const updateTableState = (updates: Partial<typeof tableState>) => {\n setTableState((prev) => ({ ...prev, ...updates }));\n };\n\n // Destructuring the table state for easier access\n const { sorting, columnFilters, searching, columnVisibility, rowSelection, pagination } =\n tableState;\n\n // Debounce the search query to avoid making a request on every keystroke\n const [debouncedQuery] = useDebounce(searching.trim(), 300);\n\n // Update column visibility when columnsToHideByDefault changes\n useEffect(() => {\n updateTableState({\n columnVisibility: { id: false, updatedAt: false, ...columnsToHideByDefault },\n });\n }, [columnsToHideByDefault]);\n const [filters, setFilters] = useState<FilterFormType[]>([]);\n\n const formatedFilters = useMemo(() => {\n return filters.reduce((acc, filter) => {\n const { property, value, operator } = filter;\n if (!acc[property]) {\n acc[property] = {};\n }\n acc[property][operator] = value;\n return acc;\n }, {} as Record<string, Record<string, any>>);\n }, [filters]);\n\n // Fetch table data using the fetchFn and react-query's useQuery hook\n const dataQuery = useQuery({\n queryKey: [tableName, pagination, sorting, debouncedQuery, formatedFilters],\n queryFn: () => fetchFn(pagination, sorting, searching.trim(), formatedFilters),\n placeholderData: keepPreviousData, // Keep previous data while loading new data\n retry: 0,\n refetchOnWindowFocus: false,\n });\n\n // Create column helpers for dynamic column generation\n const columnHelper = createColumnHelper<TData>();\n const metadataColumns = useMemo<ColumnDef<TData, TValue>[]>(() => {\n const data = dataQuery.data?.data;\n if (!data?.length) return [];\n // set of all the keys present in a given view\n const allMetadataKeys = new Set<string>();\n\n // Collect all unique metadata keys\n data.forEach((row: TData) => {\n if (row.metadata) {\n row.metadata.forEach((meta: MetadataDto) => {\n allMetadataKeys.add(meta.key);\n });\n }\n });\n\n // Generate columns for all unique metadata keys\n return Array.from(allMetadataKeys).map((key) =>\n columnHelper.accessor(\n (row: TData) => {\n // Find the metadata object with the matching key\n const metadataEntry = row.metadata?.find((meta: MetadataDto) => meta.key === key);\n return metadataEntry?.value; // Return the value for the specific key\n },\n {\n header: () => (\n <TooltipProvider delayDuration={0}>\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex gap-1 items-center align-middle\">\n {key} <Info size={18} strokeWidth={'1px'} />\n </span>\n </TooltipTrigger>\n <TooltipContent>Metadata Key</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ), // Use the metadata key as the column header\n id: key,\n enableSorting: false,\n cell: (info) => {\n const value = info.getValue();\n // Handle null/undefined values\n if (value === null || value === undefined) return '';\n // For primitive types, return the string representation\n return String(value);\n },\n },\n ),\n );\n }, [dataQuery.data?.data]);\n\n /**\n * ID,createdAt and updatedAt will be added by default for all tables\n * If selection is allowed, checkbox will be added\n * If the dto has metadata, dynamics columns for all the metadata key-value will be added(particular for a view)\n * If there are actions for the table, they will be placed fixed at the right side of table.\n */\n const extendedColumns = useMemo<ColumnDef<any, any>[]>(() => {\n const _columns = [\n ...(tableActions.selection ? CHECK_BOX : []),\n ...ID_COLUMN,\n ...columns.filter((col) => col.id !== 'actions'),\n ...(metadataColumns.length ? metadataColumns : []),\n ...DEFAULT_DATE_COLUMNS,\n ...columns.filter((col) => col.id === 'actions'),\n ];\n\n return _columns;\n }, [columns, metadataColumns, dataQuery.data?.data, tableActions.selection]);\n\n // Get selected row data\n const rowSelectedData = useMemo(\n () => Object.entries(rowSelection).map((d: any) => dataQuery?.data?.data?.[d[0]]),\n [dataQuery?.data?.data, rowSelection],\n );\n\n // Use react-table's hook to create the table instance\n const table = useReactTable({\n data: dataQuery.data?.data ?? [],\n columns: extendedColumns,\n getCoreRowModel: getCoreRowModel(),\n rowCount: dataQuery.data?.total,\n manualPagination: true, // Handle pagination manually\n onPaginationChange: (updater) => {\n const newPagination = typeof updater === 'function' ? updater(pagination) : updater;\n updateTableState({ pagination: newPagination });\n },\n manualSorting: true, // Handle sorting manually\n onSortingChange: (updater) => {\n const newSorting = typeof updater === 'function' ? updater(sorting) : updater;\n updateTableState({ sorting: newSorting });\n },\n manualFiltering: true, // Handle filtering manually\n onGlobalFilterChange: (updater) => {\n const newFilters = typeof updater === 'function' ? updater(columnFilters) : updater;\n updateTableState({ columnFilters: newFilters });\n },\n onColumnVisibilityChange: (updater) => {\n const newVisibility = typeof updater === 'function' ? updater(columnVisibility) : updater;\n updateTableState({ columnVisibility: newVisibility });\n },\n onRowSelectionChange: (updater) => {\n const newSelection = typeof updater === 'function' ? updater(rowSelection) : updater;\n updateTableState({ rowSelection: newSelection });\n },\n state: {\n sorting,\n columnFilters,\n columnVisibility,\n pagination,\n rowSelection,\n },\n meta: {\n refetch: dataQuery.refetch,\n },\n });\n const stateToPass = {\n key: '',\n stateData: rowSelectedData,\n };\n\n return (\n <div className=\"flex flex-col gap-1 w-full bg-card\">\n <div className=\" px-1\">\n <TableFilter\n filterableProperties={{ ...filterableFields, ...DEFAULT_FILTERABLE_FIELDS }}\n filters={filters}\n onFiltersChange={setFilters}\n />\n </div>\n {/* Table Actions Section */}\n <div className=\"border px-1\">\n <Actions\n dataQuery={dataQuery}\n table={table}\n tableActions={tableActions}\n stateToPass={stateToPass}\n handleSearching={(value) => updateTableState({ searching: value })}\n />\n </div>\n\n {/* Table Content Section */}\n <div className=\"relative h-[60vh] z-10 overflow-x-auto border-x align-top justify-start\">\n <TableContent table={table} columns={extendedColumns} dataQuery={dataQuery} />\n </div>\n\n {/* Table Footer Section with Pagination and Column Picker */}\n <div className=\"flex overflow-auto flex-row w-full justify-between border gap-4 px-1 py-2\">\n <div className=\"flex gap-2\">\n <ColumnPicker table={table} />\n <PageSize table={table} />\n </div>\n <Paginator table={table} rowCount={dataQuery.data?.total ?? 0} />\n </div>\n </div>\n );\n}\n"],"names":["DataTable","columns","fetchFn","tableName","tableActions","columnsToHideByDefault","filterableFields","tableState","setTableState","useState","updateTableState","updates","prev","sorting","columnFilters","searching","columnVisibility","rowSelection","pagination","debouncedQuery","useDebounce","useEffect","filters","setFilters","formatedFilters","useMemo","acc","filter","property","value","operator","dataQuery","useQuery","keepPreviousData","columnHelper","createColumnHelper","metadataColumns","data","_a","allMetadataKeys","row","meta","key","metadataEntry","jsx","TooltipProvider","Tooltip","TooltipTrigger","jsxs","Info","TooltipContent","info","extendedColumns","CHECK_BOX","ID_COLUMN","col","DEFAULT_DATE_COLUMNS","_b","rowSelectedData","d","_c","table","useReactTable","_d","getCoreRowModel","_e","updater","newPagination","newSorting","newFilters","newVisibility","newSelection","stateToPass","TableFilter","DEFAULT_FILTERABLE_FIELDS","Actions","TableContent","ColumnPicker","PageSize","Paginator","_f"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,SAASA,GAA2D;AAAA,EACzE,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,kBAAAC;AACF,GAAkC;;AAGhC,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS;AAAA,IAC3C,SAAS,CAAC;AAAA;AAAA,IACV,eAAe,CAAC;AAAA;AAAA,IAChB,WAAW;AAAA;AAAA,IACX,kBAAkB,CAAC;AAAA;AAAA,IACnB,cAAc,CAAC;AAAA;AAAA,IACf,YAAY,EAAE,WAAW,GAAG,UAAU,GAAG;AAAA;AAAA,EAAA,CAC1C,GAGKC,IAAmB,CAACC,MAAwC;AAChE,IAAAH,EAA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AAA,MAAC,gBAAAA,EAAA,OAAA,EAAI,WAAU,cACb,UAAA;AAAA,QAAA,gBAAAJ,EAACiC,MAAa,OAAAhB,GAAc;AAAA,QAC5B,gBAAAjB,EAACkC,MAAS,OAAAjB,EAAc,CAAA;AAAA,MAAA,GAC1B;AAAA,wBACCkB,IAAU,EAAA,OAAAlB,GAAc,YAAUmB,IAAAjD,EAAU,SAAV,gBAAAiD,EAAgB,UAAS,EAAG,CAAA;AAAA,IAAA,EACjE,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"data-table.es.js","sources":["../../../lib/components/data-table/data-table.tsx"],"sourcesContent":["'use client';\nimport { TableFilter, type FilterFormType } from '@/components/data-table/table-filter';\nimport {\n DEFAULT_FILTERABLE_FIELDS,\n TABLE_CHECK_BOX_COLUMN,\n TABLE_DEFAULT_DATE_COLUMNS,\n TABLE_ID_COLUMN,\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@/index';\nimport { keepPreviousData, useQuery } from '@tanstack/react-query';\nimport {\n ColumnDef,\n ColumnFiltersState,\n createColumnHelper,\n getCoreRowModel,\n PaginationState,\n SortingState,\n useReactTable,\n VisibilityState,\n} from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useDebounce } from 'use-debounce';\nimport { ColumnPicker } from './column-picker';\nimport { PageSize } from './page-size';\nimport { Paginator } from './paginator';\nimport Actions from './table-actions';\nimport { TableContent } from './table-content';\nimport type { FilterableProperties, MetadataDto, TableActions, TableFetchFn } from './table-utils';\n\n/** Reserved name for actions column */\nexport const ACTIONS_COLUMN_ID = 'actions_button';\n\n// Props type for the DataTable component\nexport interface DataTableProps<TData, TValue = any> {\n columns: ColumnDef<TData, TValue>[]; // Columns for the table\n tableName: string; // Table name used as query key\n fetchFn: TableFetchFn<TData>; // Function for fetching data from the server\n tableActions: TableActions;\n filterableFields: FilterableProperties<TData>; // Fields that can be filtered\n columnsToHideByDefault: VisibilityState; // Columns that are hidden by default\n}\nexport function DataTable<TData extends Record<string, any>, TValue = any>({\n columns,\n fetchFn,\n tableName,\n tableActions,\n columnsToHideByDefault,\n filterableFields,\n}: DataTableProps<TData, TValue>) {\n // State for managing table data and filters\n //TODO: This is later to be stored in url as params\n const [tableState, setTableState] = useState({\n sorting: [] as SortingState, // Sorting state\n columnFilters: [] as ColumnFiltersState, // Filters for columns\n searching: '', // Search query state\n columnVisibility: {} as VisibilityState, // Visibility of columns\n rowSelection: {}, // Row selection state\n pagination: { pageIndex: 0, pageSize: 20 } as PaginationState, // Pagination state\n });\n\n // Update table state with new values\n const updateTableState = (updates: Partial<typeof tableState>) => {\n setTableState((prev) => ({ ...prev, ...updates }));\n };\n\n // Destructuring the table state for easier access\n const { sorting, columnFilters, searching, columnVisibility, rowSelection, pagination } =\n tableState;\n\n // Debounce the search query to avoid making a request on every keystroke\n const [debouncedQuery] = useDebounce(searching.trim(), 300);\n\n // Update column visibility when columnsToHideByDefault changes\n useEffect(() => {\n updateTableState({\n columnVisibility: { id: false, updatedAt: false, ...columnsToHideByDefault },\n });\n }, [columnsToHideByDefault]);\n const [filters, setFilters] = useState<FilterFormType[]>([]);\n\n const formatedFilters = useMemo(() => {\n return filters.reduce((acc, filter) => {\n const { property, value, operator } = filter;\n if (!acc[property]) {\n acc[property] = {};\n }\n acc[property][operator] = value;\n return acc;\n }, {} as Record<string, Record<string, any>>);\n }, [filters]);\n\n // Fetch table data using the fetchFn and react-query's useQuery hook\n const dataQuery = useQuery({\n queryKey: [tableName, pagination, sorting, debouncedQuery, formatedFilters],\n queryFn: () => fetchFn(pagination, sorting, searching.trim(), formatedFilters),\n placeholderData: keepPreviousData, // Keep previous data while loading new data\n retry: 0,\n refetchOnWindowFocus: false,\n });\n\n // Create column helpers for dynamic column generation\n const columnHelper = createColumnHelper<TData>();\n const metadataColumns = useMemo<ColumnDef<TData, TValue>[]>(() => {\n const data = dataQuery.data?.data;\n if (!data?.length) return [];\n // set of all the keys present in a given view\n const allMetadataKeys = new Set<string>();\n\n // Collect all unique metadata keys\n data.forEach((row: TData) => {\n if (row.metadata) {\n row.metadata.forEach((meta: MetadataDto) => {\n allMetadataKeys.add(meta.key);\n });\n }\n });\n\n // Generate columns for all unique metadata keys\n return Array.from(allMetadataKeys).map((key) =>\n columnHelper.accessor(\n (row: TData) => {\n // Find the metadata object with the matching key\n const metadataEntry = row.metadata?.find((meta: MetadataDto) => meta.key === key);\n return metadataEntry?.value; // Return the value for the specific key\n },\n {\n header: () => (\n <TooltipProvider delayDuration={0}>\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex gap-1 items-center align-middle\">\n {key} <Info size={18} strokeWidth={'1px'} />\n </span>\n </TooltipTrigger>\n <TooltipContent>Metadata Key</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ), // Use the metadata key as the column header\n id: key,\n enableSorting: false,\n cell: (info) => {\n const value = info.getValue();\n // Handle null/undefined values\n if (value === null || value === undefined) return '';\n // For primitive types, return the string representation\n return String(value);\n },\n },\n ),\n );\n }, [dataQuery.data?.data]);\n\n /**\n * ID,createdAt and updatedAt will be added by default for all tables\n * If selection is allowed, checkbox will be added\n * If the dto has metadata, dynamics columns for all the metadata key-value will be added(particular for a view)\n * If there are actions for the table, they will be placed fixed at the right side of table.\n */\n const extendedColumns = useMemo<ColumnDef<any, any>[]>(() => {\n const _columns = [\n ...(tableActions.selection ? TABLE_CHECK_BOX_COLUMN : []),\n ...TABLE_ID_COLUMN,\n ...columns.filter((col) => col.id !== 'actions'),\n ...(metadataColumns.length ? metadataColumns : []),\n ...TABLE_DEFAULT_DATE_COLUMNS,\n ...columns.filter((col) => col.id === 'actions'),\n ];\n\n return _columns;\n }, [columns, metadataColumns, dataQuery.data?.data, tableActions.selection]);\n\n // Get selected row data\n const rowSelectedData = useMemo(\n () => Object.entries(rowSelection).map((d: any) => dataQuery?.data?.data?.[d[0]]),\n [dataQuery?.data?.data, rowSelection],\n );\n\n // Use react-table's hook to create the table instance\n const table = useReactTable({\n data: dataQuery.data?.data ?? [],\n columns: extendedColumns,\n getCoreRowModel: getCoreRowModel(),\n rowCount: dataQuery.data?.total,\n manualPagination: true, // Handle pagination manually\n onPaginationChange: (updater) => {\n const newPagination = typeof updater === 'function' ? updater(pagination) : updater;\n updateTableState({ pagination: newPagination });\n },\n manualSorting: true, // Handle sorting manually\n onSortingChange: (updater) => {\n const newSorting = typeof updater === 'function' ? updater(sorting) : updater;\n updateTableState({ sorting: newSorting });\n },\n manualFiltering: true, // Handle filtering manually\n onGlobalFilterChange: (updater) => {\n const newFilters = typeof updater === 'function' ? updater(columnFilters) : updater;\n updateTableState({ columnFilters: newFilters });\n },\n onColumnVisibilityChange: (updater) => {\n const newVisibility = typeof updater === 'function' ? updater(columnVisibility) : updater;\n updateTableState({ columnVisibility: newVisibility });\n },\n onRowSelectionChange: (updater) => {\n const newSelection = typeof updater === 'function' ? updater(rowSelection) : updater;\n updateTableState({ rowSelection: newSelection });\n },\n state: {\n sorting,\n columnFilters,\n columnVisibility,\n pagination,\n rowSelection,\n },\n meta: {\n refetch: dataQuery.refetch,\n },\n });\n const stateToPass = {\n key: '',\n stateData: rowSelectedData,\n };\n\n return (\n <div className=\"flex flex-col gap-1 w-full bg-card\">\n <div className=\" px-1\">\n <TableFilter\n filterableProperties={{ ...filterableFields, ...DEFAULT_FILTERABLE_FIELDS }}\n filters={filters}\n onFiltersChange={setFilters}\n />\n </div>\n {/* Table Actions Section */}\n <div className=\"border px-1\">\n <Actions\n dataQuery={dataQuery}\n table={table}\n tableActions={tableActions}\n stateToPass={stateToPass}\n handleSearching={(value) => updateTableState({ searching: value })}\n />\n </div>\n\n {/* Table Content Section */}\n <div className=\"relative h-[60vh] z-10 overflow-x-auto border-x align-top justify-start\">\n <TableContent table={table} columns={extendedColumns} dataQuery={dataQuery} />\n </div>\n\n {/* Table Footer Section with Pagination and Column Picker */}\n <div className=\"flex overflow-auto flex-row w-full justify-between border gap-4 px-1 py-2\">\n <div className=\"flex gap-2\">\n <ColumnPicker table={table} />\n <PageSize table={table} />\n </div>\n <Paginator table={table} rowCount={dataQuery.data?.total ?? 0} />\n </div>\n </div>\n );\n}\n"],"names":["ACTIONS_COLUMN_ID","DataTable","columns","fetchFn","tableName","tableActions","columnsToHideByDefault","filterableFields","tableState","setTableState","useState","updateTableState","updates","prev","sorting","columnFilters","searching","columnVisibility","rowSelection","pagination","debouncedQuery","useDebounce","useEffect","filters","setFilters","formatedFilters","useMemo","acc","filter","property","value","operator","dataQuery","useQuery","keepPreviousData","columnHelper","createColumnHelper","metadataColumns","data","_a","allMetadataKeys","row","meta","key","metadataEntry","jsx","TooltipProvider","Tooltip","TooltipTrigger","jsxs","Info","TooltipContent","info","extendedColumns","TABLE_CHECK_BOX_COLUMN","TABLE_ID_COLUMN","col","TABLE_DEFAULT_DATE_COLUMNS","_b","rowSelectedData","d","_c","table","useReactTable","_d","getCoreRowModel","_e","updater","newPagination","newSorting","newFilters","newVisibility","newSelection","stateToPass","TableFilter","DEFAULT_FILTERABLE_FIELDS","Actions","TableContent","ColumnPicker","PageSize","Paginator","_f"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAoB;AAW1B,SAASC,GAA2D;AAAA,EACzE,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,kBAAAC;AACF,GAAkC;;AAGhC,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAAS;AAAA,IAC3C,SAAS,CAAC;AAAA;AAAA,IACV,eAAe,CAAC;AAAA;AAAA,IAChB,WAAW;AAAA;AAAA,IACX,kBAAkB,CAAC;AAAA;AAAA,IACnB,cAAc,CAAC;AAAA;AAAA,IACf,YAAY,EAAE,WAAW,GAAG,UAAU,GAAG;AAAA;AAAA,EAAA,CAC1C,GAGKC,IAAmB,CAACC,MAAwC;AAChE,IAA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UAAA;AAAA,MAAC,gBAAAA,EAAA,OAAA,EAAI,WAAU,cACb,UAAA;AAAA,QAAA,gBAAAJ,EAACiC,MAAa,OAAAhB,GAAc;AAAA,QAC5B,gBAAAjB,EAACkC,MAAS,OAAAjB,EAAc,CAAA;AAAA,MAAA,GAC1B;AAAA,wBACCkB,IAAU,EAAA,OAAAlB,GAAc,YAAUmB,IAAAjD,EAAU,SAAV,gBAAAiD,EAAgB,UAAS,EAAG,CAAA;AAAA,IAAA,EACjE,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -41,12 +41,13 @@ const a = r(), i = [
|
|
|
41
41
|
cell: ({ row: e }) => {
|
|
42
42
|
const t = e.getValue("createdAt");
|
|
43
43
|
return o(t);
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
enableHiding: !1
|
|
45
46
|
})
|
|
46
47
|
];
|
|
47
48
|
export {
|
|
48
|
-
i as
|
|
49
|
-
m as
|
|
50
|
-
h as
|
|
49
|
+
i as TABLE_CHECK_BOX_COLUMN,
|
|
50
|
+
m as TABLE_DEFAULT_DATE_COLUMNS,
|
|
51
|
+
h as TABLE_ID_COLUMN
|
|
51
52
|
};
|
|
52
53
|
//# sourceMappingURL=table-commons.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-commons.es.js","sources":["../../../lib/components/data-table/table-commons.tsx"],"sourcesContent":["import { FormatDate } from '@/components/data-table/table-utils/index';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { createColumnHelper } from '@tanstack/react-table';\n\nconst cH = createColumnHelper<any>();\nexport const
|
|
1
|
+
{"version":3,"file":"table-commons.es.js","sources":["../../../lib/components/data-table/table-commons.tsx"],"sourcesContent":["import { FormatDate } from '@/components/data-table/table-utils/index';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { createColumnHelper } from '@tanstack/react-table';\n\nconst cH = createColumnHelper<any>();\nexport const TABLE_CHECK_BOX_COLUMN = [\n cH.accessor('checkbox', {\n header: ({ table }) => (\n <Checkbox\n checked={\n table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate')\n }\n onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}\n aria-label=\"Select all\"\n />\n ),\n\n cell: ({ row }) => (\n <Checkbox\n checked={row.getIsSelected()}\n onCheckedChange={(value) => row.toggleSelected(!!value)}\n aria-label=\"Select row\"\n />\n ),\n enableSorting: false,\n enableHiding: false,\n })];\n\nexport const TABLE_ID_COLUMN = [\n cH.accessor('id', {\n header: () => 'ID',\n }),\n];\nexport const TABLE_DEFAULT_DATE_COLUMNS = [\n cH.accessor('createdAt', {\n header: () => 'Creation Date',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n enableHiding: false,\n }),\n cH.accessor('updatedAt', {\n header: () => 'Last Updated',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n enableHiding: false,\n }),\n];\n"],"names":["cH","createColumnHelper","TABLE_CHECK_BOX_COLUMN","table","jsx","Checkbox","value","row","TABLE_ID_COLUMN","TABLE_DEFAULT_DATE_COLUMNS","date","FormatDate"],"mappings":";;;;AAIA,MAAMA,IAAKC,EAAwB,GACtBC,IAAyB;AAAA,EACpCF,EAAG,SAAS,YAAY;AAAA,IACtB,QAAQ,CAAC,EAAE,OAAAG,EAAA,MACT,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SACEF,EAAM,yBAAA,KAA+BA,EAAM,0BAA+B,KAAA;AAAA,QAE5E,iBAAiB,CAACG,MAAUH,EAAM,0BAA0B,CAAC,CAACG,CAAK;AAAA,QACnE,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAGF,MAAM,CAAC,EAAE,KAAAC,EAAA,MACP,gBAAAH;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAASE,EAAI,cAAc;AAAA,QAC3B,iBAAiB,CAACD,MAAUC,EAAI,eAAe,CAAC,CAACD,CAAK;AAAA,QACtD,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAEF,eAAe;AAAA,IACf,cAAc;AAAA,EACf,CAAA;AAAC,GAESE,IAAkB;AAAA,EAC7BR,EAAG,SAAS,MAAM;AAAA,IAChB,QAAQ,MAAM;AAAA,EACf,CAAA;AACH,GACaS,IAA6B;AAAA,EACxCT,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IACxB;AAAA,IACA,cAAc;AAAA,EAAA,CACf;AAAA,EACDV,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IACxB;AAAA,IACA,cAAc;AAAA,EACf,CAAA;AACH;"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { jsxs as r, jsx as e, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { ACTIONS_COLUMN_ID as d } from "./data-table.es.js";
|
|
3
|
+
import { Table as h, TableHeader as f, TableRow as c, TableCell as i, TableBody as g, TableFooter as x } from "../ui/table.es.js";
|
|
4
|
+
import { flexRender as p } from "@tanstack/react-table";
|
|
5
|
+
import { Info as N } from "lucide-react";
|
|
6
|
+
function v({
|
|
7
|
+
table: s,
|
|
8
|
+
columns: u,
|
|
9
|
+
dataQuery: n
|
|
9
10
|
}) {
|
|
10
|
-
var
|
|
11
|
-
return /* @__PURE__ */ r(
|
|
12
|
-
/* @__PURE__ */ e(
|
|
13
|
-
|
|
11
|
+
var a;
|
|
12
|
+
return /* @__PURE__ */ r(h, { className: "relative h-full w-full", children: [
|
|
13
|
+
/* @__PURE__ */ e(f, { className: "sticky top-0 z-10", children: s.getHeaderGroups().map((o, l) => /* @__PURE__ */ e(c, { className: "border-b", children: o.headers.map((t) => /* @__PURE__ */ r(
|
|
14
|
+
i,
|
|
14
15
|
{
|
|
15
|
-
className: `
|
|
16
|
-
px-4 py-2 text-left text-sm font-medium cursor-pointer whitespace-nowrap
|
|
17
|
-
bg-card
|
|
18
|
-
${t.id === "actions" ? "sticky right-0 z-50 bg-card" : ""}
|
|
19
|
-
`,
|
|
16
|
+
className: `px-4 py-2 cursor-pointer text-left text-sm font-medium whitespace-nowrap ${t.id === d ? "sticky right-0 z-50" : ""}`,
|
|
20
17
|
onClick: t.column.getToggleSortingHandler(),
|
|
21
18
|
children: [
|
|
22
|
-
t.isPlaceholder ? null :
|
|
19
|
+
t.isPlaceholder ? null : p(t.column.columnDef.header, t.getContext()),
|
|
23
20
|
{
|
|
24
21
|
asc: "↑",
|
|
25
22
|
desc: "↓"
|
|
@@ -28,24 +25,24 @@ function y({
|
|
|
28
25
|
},
|
|
29
26
|
t.id
|
|
30
27
|
)) }, l)) }),
|
|
31
|
-
/* @__PURE__ */ e(
|
|
32
|
-
|
|
28
|
+
/* @__PURE__ */ e(g, { className: "flex-1 overflow-y-auto", children: s.getRowModel().rows.length ? s.getRowModel().rows.map((o) => /* @__PURE__ */ e(c, { "data-state": o.getIsSelected() && "selected", children: o.getVisibleCells().map((l) => /* @__PURE__ */ e(
|
|
29
|
+
i,
|
|
33
30
|
{
|
|
34
31
|
className: `
|
|
35
32
|
px-4 py-2 text-left text-sm whitespace-nowrap
|
|
36
|
-
${l.column.id ===
|
|
33
|
+
${l.column.id === d ? "sticky right-0 text-center" : ""}
|
|
37
34
|
`,
|
|
38
|
-
children:
|
|
35
|
+
children: p(l.column.columnDef.cell, l.getContext())
|
|
39
36
|
},
|
|
40
37
|
l.id
|
|
41
|
-
)) }, o.id)) : /* @__PURE__ */ e(c, { className: "h-[55vh] hover:bg-transparent cursor-not-allowed", children: /* @__PURE__ */ e(
|
|
42
|
-
/* @__PURE__ */ e(
|
|
38
|
+
)) }, o.id)) : /* @__PURE__ */ e(c, { className: "h-[55vh] hover:bg-transparent cursor-not-allowed", children: /* @__PURE__ */ e(i, { colSpan: u.length, className: "border-none", children: /* @__PURE__ */ e("span", { className: "flex gap-3 justify-center items-center", children: !n.isFetching && (n.isError ? /* @__PURE__ */ r(m, { children: [
|
|
39
|
+
/* @__PURE__ */ e(N, {}),
|
|
43
40
|
" You don't have the required permissions. Please contact your admin."
|
|
44
|
-
] }) : (
|
|
45
|
-
|
|
41
|
+
] }) : (a = n.data) != null && a.data ? null : /* @__PURE__ */ e(m, { children: "No result found." })) }) }) }) }),
|
|
42
|
+
n.isFetching && /* @__PURE__ */ e(x, { className: "absolute inset-0 z-20 flex justify-center items-center bg-card/80" })
|
|
46
43
|
] });
|
|
47
44
|
}
|
|
48
45
|
export {
|
|
49
|
-
|
|
46
|
+
v as TableContent
|
|
50
47
|
};
|
|
51
48
|
//# sourceMappingURL=table-content.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-content.es.js","sources":["../../../lib/components/data-table/table-content.tsx"],"sourcesContent":["import {\n Table as CxTable,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { ColumnDef, Table, flexRender } from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\n\nexport function TableContent<TData, TValue>({\n table,\n columns,\n dataQuery,\n}: {\n table: Table<TData>;\n columns: ColumnDef<TData, TValue>[];\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n return (\n <CxTable className=\"relative h-full w-full\">\n <TableHeader className=\"sticky top-0 z-10\">\n {table.getHeaderGroups().map((headerGroup, index) => (\n <TableRow key={index} className=\"border-b\">\n {headerGroup.headers.map((header) => (\n <TableCell\n key={header.id}\n className={
|
|
1
|
+
{"version":3,"file":"table-content.es.js","sources":["../../../lib/components/data-table/table-content.tsx"],"sourcesContent":["import { ACTIONS_COLUMN_ID } from '@/components/data-table/data-table';\nimport {\n Table as CxTable,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { ColumnDef, Table, flexRender } from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\n\nexport function TableContent<TData, TValue>({\n table,\n columns,\n dataQuery,\n}: {\n table: Table<TData>;\n columns: ColumnDef<TData, TValue>[];\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n return (\n <CxTable className=\"relative h-full w-full\">\n <TableHeader className=\"sticky top-0 z-10\">\n {table.getHeaderGroups().map((headerGroup, index) => (\n <TableRow key={index} className=\"border-b\">\n {headerGroup.headers.map((header) => (\n <TableCell\n key={header.id}\n className={`px-4 py-2 cursor-pointer text-left text-sm font-medium whitespace-nowrap ${header.id === ACTIONS_COLUMN_ID ? 'sticky right-0 z-50' : ''}`}\n onClick={header.column.getToggleSortingHandler()}\n >\n {header.isPlaceholder\n ? null\n : flexRender(header.column.columnDef.header, header.getContext())}\n {{\n asc: '↑',\n desc: '↓',\n }[header.column.getIsSorted() as string] ?? null}\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody className=\"flex-1 overflow-y-auto\">\n {table.getRowModel().rows.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow key={row.id} data-state={row.getIsSelected() && 'selected'}>\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n className={`\n px-4 py-2 text-left text-sm whitespace-nowrap \n ${cell.column.id === ACTIONS_COLUMN_ID\n ? 'sticky right-0 text-center'\n : ''\n }\n `}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n ))}\n </TableRow>\n ))\n ) : (\n <TableRow className=\"h-[55vh] hover:bg-transparent cursor-not-allowed\">\n <TableCell colSpan={columns.length} className=\"border-none\">\n <span className=\"flex gap-3 justify-center items-center\">\n {!dataQuery.isFetching && (\n dataQuery.isError ? (\n <>\n <Info /> You don't have the required permissions. Please contact your admin.\n </>\n ) : !dataQuery.data?.data ? (\n <>No result found.</>\n ) : null\n )}\n </span>\n </TableCell>\n </TableRow>\n\n )}\n </TableBody>\n {/* Loader positioned to cover entire table viewport */}\n {dataQuery.isFetching && (\n <TableFooter className=\"absolute inset-0 z-20 flex justify-center items-center bg-card/80\" />\n )}\n </CxTable>\n );\n}\n"],"names":["TableContent","table","columns","dataQuery","jsxs","CxTable","jsx","TableHeader","headerGroup","index","TableRow","header","TableCell","ACTIONS_COLUMN_ID","flexRender","TableBody","row","cell","Fragment","Info","_a","TableFooter"],"mappings":";;;;;AAaO,SAASA,EAA4B;AAAA,EAC1C,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAIG;;AAEC,SAAA,gBAAAC,EAACC,GAAQ,EAAA,WAAU,0BACjB,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAY,WAAU,qBACpB,YAAM,gBAAgB,EAAE,IAAI,CAACC,GAAaC,MACzC,gBAAAH,EAACI,KAAqB,WAAU,YAC7B,YAAY,QAAQ,IAAI,CAACC,MACxB,gBAAAP;AAAA,MAACQ;AAAA,MAAA;AAAA,QAEC,WAAW,4EAA4ED,EAAO,OAAOE,IAAoB,wBAAwB,EAAE;AAAA,QACnJ,SAASF,EAAO,OAAO,wBAAwB;AAAA,QAE9C,UAAA;AAAA,UAAOA,EAAA,gBACJ,OACAG,EAAWH,EAAO,OAAO,UAAU,QAAQA,EAAO,YAAY;AAAA,UACjE;AAAA,YACC,KAAK;AAAA,YACL,MAAM;AAAA,UACN,EAAAA,EAAO,OAAO,YAAA,CAAuB,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAVvCA,EAAO;AAAA,IAAA,CAYf,EAAA,GAfYF,CAgBf,CACD,GACH;AAAA,IACC,gBAAAH,EAAAS,GAAA,EAAU,WAAU,0BAClB,UAAMd,EAAA,YAAA,EAAc,KAAK,SACxBA,EAAM,YAAY,EAAE,KAAK,IAAI,CAACe,MAC3B,gBAAAV,EAAAI,GAAA,EAAsB,cAAYM,EAAI,cAAc,KAAK,YACvD,UAAAA,EAAI,gBAAgB,EAAE,IAAI,CAACC,MAC1B,gBAAAX;AAAA,MAACM;AAAA,MAAA;AAAA,QAEC,WAAW;AAAA;AAAA,sBAEPK,EAAK,OAAO,OAAOJ,IACjB,+BACA,EACJ;AAAA;AAAA,QAGD,YAAWI,EAAK,OAAO,UAAU,MAAMA,EAAK,WAAY,CAAA;AAAA,MAAA;AAAA,MATpDA,EAAK;AAAA,IAAA,CAWb,EAdY,GAAAD,EAAI,EAenB,CACD,IAED,gBAAAV,EAACI,GAAS,EAAA,WAAU,oDAClB,UAAA,gBAAAJ,EAACM,GAAU,EAAA,SAASV,EAAQ,QAAQ,WAAU,eAC5C,UAAA,gBAAAI,EAAC,QAAK,EAAA,WAAU,0CACb,UAAA,CAACH,EAAU,eACVA,EAAU,UAEN,gBAAAC,EAAAc,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAZ,EAACa,GAAK,EAAA;AAAA,MAAE;AAAA,IAAA,EACV,CAAA,KACGC,IAAAjB,EAAU,SAAV,QAAAiB,EAAgB,OAEjB,OADA,gBAAAd,EAAAY,GAAA,EAAA,UAAA,mBAAA,CAAgB,GAGxB,CAAA,EACF,CAAA,EACF,CAAA,GAGJ;AAAA,IAECf,EAAU,cACR,gBAAAG,EAAAe,GAAA,EAAY,WAAU,oEAAoE,CAAA;AAAA,EAAA,GAE/F;AAEJ;"}
|
|
@@ -52,7 +52,7 @@ const c = t.forwardRef(
|
|
|
52
52
|
{
|
|
53
53
|
ref: r,
|
|
54
54
|
className: d(
|
|
55
|
-
"border-b border-card
|
|
55
|
+
"border-b border-card transition-colors data-[state=selected]:bg-muted-foreground/20 hover:bg-muted-foreground/30",
|
|
56
56
|
e
|
|
57
57
|
),
|
|
58
58
|
...a
|
|
@@ -60,7 +60,7 @@ const c = t.forwardRef(
|
|
|
60
60
|
)
|
|
61
61
|
);
|
|
62
62
|
c.displayName = "TableRow";
|
|
63
|
-
const
|
|
63
|
+
const f = t.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
|
|
64
64
|
"th",
|
|
65
65
|
{
|
|
66
66
|
ref: r,
|
|
@@ -71,8 +71,8 @@ const i = t.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
|
|
|
71
71
|
...a
|
|
72
72
|
}
|
|
73
73
|
));
|
|
74
|
-
|
|
75
|
-
const
|
|
74
|
+
f.displayName = "TableHead";
|
|
75
|
+
const i = t.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
|
|
76
76
|
"td",
|
|
77
77
|
{
|
|
78
78
|
ref: r,
|
|
@@ -83,16 +83,16 @@ const f = t.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o(
|
|
|
83
83
|
...a
|
|
84
84
|
}
|
|
85
85
|
));
|
|
86
|
-
|
|
86
|
+
i.displayName = "TableCell";
|
|
87
87
|
const n = t.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ o("caption", { ref: r, className: d("mt-4 text-sm text-muted-foreground", e), ...a }));
|
|
88
88
|
n.displayName = "TableCaption";
|
|
89
89
|
export {
|
|
90
90
|
l as Table,
|
|
91
91
|
b as TableBody,
|
|
92
92
|
n as TableCaption,
|
|
93
|
-
|
|
93
|
+
i as TableCell,
|
|
94
94
|
m as TableFooter,
|
|
95
|
-
|
|
95
|
+
f as TableHead,
|
|
96
96
|
s as TableHeader,
|
|
97
97
|
c as TableRow
|
|
98
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.es.js","sources":["../../../lib/components/ui/table.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/utils';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"w-full\">\n <table\n ref={ref}\n className={cn(\n 'w-full caption-bottom text-sm [&_tr:last-child]:border-0 my-0 overflow-x-auto whitespace-nowrap',\n className,\n )}\n {...props}\n />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead\n ref={ref}\n className={cn('[&_tr]:border-b border-b', className)} // Added border-b to apply a bottom border\n {...props}\n />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n className={cn(\n '[&_tr:last-child]:border-b-2 [&_tr:last-child]:border-dotted', // Updated to 2px dotted border for the last row\n className,\n )}\n {...props}\n />\n));\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-t bg-card/50 font-medium last:[&>tr]:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n 'border-b border-card
|
|
1
|
+
{"version":3,"file":"table.es.js","sources":["../../../lib/components/ui/table.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/utils';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"w-full\">\n <table\n ref={ref}\n className={cn(\n 'w-full caption-bottom text-sm [&_tr:last-child]:border-0 my-0 overflow-x-auto whitespace-nowrap',\n className,\n )}\n {...props}\n />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead\n ref={ref}\n className={cn('[&_tr]:border-b border-b', className)} // Added border-b to apply a bottom border\n {...props}\n />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n className={cn(\n '[&_tr:last-child]:border-b-2 [&_tr:last-child]:border-dotted', // Updated to 2px dotted border for the last row\n className,\n )}\n {...props}\n />\n));\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-t bg-card/50 font-medium last:[&>tr]:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n 'border-b border-card transition-colors data-[state=selected]:bg-muted-foreground/20 hover:bg-muted-foreground/30',\n className,\n )}\n {...props}\n />\n ),\n);\nTableRow.displayName = 'TableRow';\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n 'h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',\n className,\n )}\n {...props}\n />\n));\nTableHead.displayName = 'TableHead';\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(\n 'p-4 align-middle [&:has([role=checkbox])]:pr-0 border-b [&_tr:last-child]:border-dotted',\n className,\n )}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };\n"],"names":["Table","React","className","props","ref","jsx","cn","TableHeader","TableBody","TableFooter","TableRow","TableHead","TableCell","TableCaption"],"mappings":";;;AAIA,MAAMA,IAAQC,EAAM;AAAA,EAClB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACxB,gBAAAC,EAAC,OAAI,EAAA,WAAU,UACb,UAAA,gBAAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACAJ;AAAA,MACF;AAAA,MACC,GAAGC;AAAA,IAAA;AAAA,EAAA,EAER,CAAA;AAEJ;AACAH,EAAM,cAAc;AAEd,MAAAO,IAAcN,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAM,GAAGC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,WAAWE,EAAG,4BAA4BJ,CAAS;AAAA,IAClD,GAAGC;AAAA,EAAA;AACN,CACD;AACDI,EAAY,cAAc;AAEpB,MAAAC,IAAYP,EAAM,WAGtB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAM,GAAGC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,WAAWE;AAAA,MACT;AAAA;AAAA,MACAJ;AAAA,IACF;AAAA,IACC,GAAGC;AAAA,EAAA;AACN,CACD;AACDK,EAAU,cAAc;AAElB,MAAAC,IAAcR,E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efExoticComponent<Omit<Accor
|
|
|
70
70
|
|
|
71
71
|
export declare const AccordionTrigger: React_2.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
72
72
|
|
|
73
|
+
/** Reserved name for actions column */
|
|
74
|
+
export declare const ACTIONS_COLUMN_ID = "actions_button";
|
|
75
|
+
|
|
73
76
|
export declare const ALL_OS: {
|
|
74
77
|
[key: string]: string;
|
|
75
78
|
};
|
|
@@ -215,8 +218,6 @@ export declare const ChartTooltipContent: React_2.ForwardRefExoticComponent<Omit
|
|
|
215
218
|
labelKey?: string;
|
|
216
219
|
}, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
217
220
|
|
|
218
|
-
export declare const CHECK_BOX: AccessorKeyColumnDef<any, any>[];
|
|
219
|
-
|
|
220
221
|
export declare const Checkbox: React_2.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
221
222
|
|
|
222
223
|
declare type Client = ReturnType<typeof default_3<paths>>;
|
|
@@ -363,8 +364,6 @@ export declare interface DataTableProps<TData, TValue = any> {
|
|
|
363
364
|
columnsToHideByDefault: VisibilityState_2;
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
export declare const DEFAULT_DATE_COLUMNS: AccessorKeyColumnDef<any, any>[];
|
|
367
|
-
|
|
368
367
|
export declare const DEFAULT_FILTERABLE_FIELDS: FilterableProperties<any>;
|
|
369
368
|
|
|
370
369
|
/*** Type for hide some of the columns based on the dto of the particular page
|
|
@@ -546,8 +545,6 @@ export declare function getValidityDisplay(validity: number | undefined): string
|
|
|
546
545
|
|
|
547
546
|
export declare function getValueFromData(data: any, accessor: string | number | symbol): any;
|
|
548
547
|
|
|
549
|
-
export declare const ID_COLUMN: AccessorKeyColumnDef<any, any>[];
|
|
550
|
-
|
|
551
548
|
export declare const Input: React_2.ForwardRefExoticComponent<InputProps & React_2.RefAttributes<HTMLInputElement>>;
|
|
552
549
|
|
|
553
550
|
export declare const InputOTP: React_2.ForwardRefExoticComponent<(Omit<Omit<React_2.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
@@ -911,6 +908,12 @@ export declare interface StaticDataTableProps<T> {
|
|
|
911
908
|
|
|
912
909
|
export declare const Table: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLTableElement> & React_2.RefAttributes<HTMLTableElement>>;
|
|
913
910
|
|
|
911
|
+
export declare const TABLE_CHECK_BOX_COLUMN: AccessorKeyColumnDef<any, any>[];
|
|
912
|
+
|
|
913
|
+
export declare const TABLE_DEFAULT_DATE_COLUMNS: AccessorKeyColumnDef<any, any>[];
|
|
914
|
+
|
|
915
|
+
export declare const TABLE_ID_COLUMN: AccessorKeyColumnDef<any, any>[];
|
|
916
|
+
|
|
914
917
|
export declare type TableActions = {
|
|
915
918
|
/** True if reading this resource is allowed. */
|
|
916
919
|
read: boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Accordion as t, AccordionContent as a, AccordionItem as n, AccordionTrigger as i } from "./components/ui/accordion.es.js";
|
|
2
2
|
import { Avatar as m, AvatarFallback as l, AvatarImage as d } from "./components/ui/avatar.es.js";
|
|
3
|
-
import { Badge as S, badgeVariants as
|
|
4
|
-
import { Breadcrumb as
|
|
3
|
+
import { Badge as S, badgeVariants as T } from "./components/ui/badge.es.js";
|
|
4
|
+
import { Breadcrumb as C, BreadcrumbEllipsis as b, BreadcrumbItem as D, BreadcrumbLink as x, BreadcrumbList as f, BreadcrumbPage as c, BreadcrumbSeparator as s } from "./components/ui/breadcrumb.es.js";
|
|
5
5
|
import { Button as I, buttonVariants as L } from "./components/ui/button.es.js";
|
|
6
|
-
import { Calendar as
|
|
7
|
-
import { Card as
|
|
8
|
-
import { ChartContainer as
|
|
6
|
+
import { Calendar as E } from "./components/ui/calendar.es.js";
|
|
7
|
+
import { Card as F, CardContent as w, CardDescription as O, CardFooter as R, CardHeader as v, CardTitle as _ } from "./components/ui/card.es.js";
|
|
8
|
+
import { ChartContainer as B, ChartLegend as N, ChartLegendContent as y, ChartStyle as G, ChartTooltip as k, ChartTooltipContent as H } from "./components/ui/chart.es.js";
|
|
9
9
|
import { Checkbox as V } from "./components/ui/checkbox.es.js";
|
|
10
10
|
import { Collapsible as K, CollapsibleContent as z, CollapsibleTrigger as X } from "./components/ui/collapsible.es.js";
|
|
11
11
|
import { Command as q, CommandDialog as J, CommandEmpty as Q, CommandGroup as W, CommandInput as Z, CommandItem as $, CommandList as ee, CommandSeparator as oe, CommandShortcut as re } from "./components/ui/command.es.js";
|
|
12
12
|
import { CopyButton as ae } from "./components/ui/copy-button.es.js";
|
|
13
|
-
import { Dialog as ie, DialogClose as pe, DialogContent as me, DialogDescription as le, DialogFooter as de, DialogHeader as ue, DialogOverlay as Se, DialogPortal as
|
|
14
|
-
import { Drawer as De, DrawerClose as xe, DrawerContent as fe, DrawerDescription as ce, DrawerFooter as se, DrawerHeader as Me, DrawerOverlay as Ie, DrawerPortal as Le, DrawerTitle as Pe, DrawerTrigger as
|
|
15
|
-
import { DropdownMenu as
|
|
13
|
+
import { Dialog as ie, DialogClose as pe, DialogContent as me, DialogDescription as le, DialogFooter as de, DialogHeader as ue, DialogOverlay as Se, DialogPortal as Te, DialogTitle as ge, DialogTrigger as Ce } from "./components/ui/dialog.es.js";
|
|
14
|
+
import { Drawer as De, DrawerClose as xe, DrawerContent as fe, DrawerDescription as ce, DrawerFooter as se, DrawerHeader as Me, DrawerOverlay as Ie, DrawerPortal as Le, DrawerTitle as Pe, DrawerTrigger as Ee } from "./components/ui/drawer.es.js";
|
|
15
|
+
import { DropdownMenu as Fe, DropdownMenuCheckboxItem as we, DropdownMenuContent as Oe, DropdownMenuGroup as Re, DropdownMenuItem as ve, DropdownMenuLabel as _e, DropdownMenuPortal as he, DropdownMenuRadioGroup as Be, DropdownMenuRadioItem as Ne, DropdownMenuSeparator as ye, DropdownMenuShortcut as Ge, DropdownMenuSub as ke, DropdownMenuSubContent as He, DropdownMenuSubTrigger as Ue, DropdownMenuTrigger as Ve } from "./components/ui/dropdown-menu.es.js";
|
|
16
16
|
import { Form as Ke, FormControl as ze, FormDescription as Xe, FormField as je, FormItem as qe, FormLabel as Je, FormMessage as Qe, useFormField as We } from "./components/ui/form.es.js";
|
|
17
17
|
import { Input as $e } from "./components/ui/input.es.js";
|
|
18
18
|
import { InputOTP as oo, InputOTPGroup as ro, InputOTPSeparator as to, InputOTPSlot as ao } from "./components/ui/input-otp.es.js";
|
|
@@ -20,16 +20,16 @@ import { Label as io } from "./components/ui/label.es.js";
|
|
|
20
20
|
import { LinkButton as mo } from "./components/ui/link-button.es.js";
|
|
21
21
|
import { Loader as uo } from "./components/ui/loader.es.js";
|
|
22
22
|
import "./components/ui/mutli-select.es.js";
|
|
23
|
-
import { NavigationMenu as
|
|
24
|
-
import { Pagination as Lo, PaginationContent as Po, PaginationEllipsis as
|
|
25
|
-
import { PasswordInput as
|
|
26
|
-
import { Popover as
|
|
23
|
+
import { NavigationMenu as To, NavigationMenuContent as go, NavigationMenuIndicator as Co, NavigationMenuItem as bo, NavigationMenuLink as Do, NavigationMenuList as xo, NavigationMenuListItem as fo, NavigationMenuTrigger as co, NavigationMenuViewport as so, navigationMenuTriggerStyle as Mo } from "./components/ui/navigation-menu.es.js";
|
|
24
|
+
import { Pagination as Lo, PaginationContent as Po, PaginationEllipsis as Eo, PaginationItem as Ao, PaginationLink as Fo, PaginationNext as wo, PaginationPrevious as Oo } from "./components/ui/pagination.es.js";
|
|
25
|
+
import { PasswordInput as vo } from "./components/ui/password-input.es.js";
|
|
26
|
+
import { Popover as ho, PopoverAnchor as Bo, PopoverContent as No, PopoverTrigger as yo } from "./components/ui/popover.es.js";
|
|
27
27
|
import { RadioGroup as ko, RadioGroupItem as Ho } from "./components/ui/radio-group.es.js";
|
|
28
28
|
import { SearchInput as Vo } from "./components/ui/search-input.es.js";
|
|
29
29
|
import { Select as Ko, SelectContent as zo, SelectGroup as Xo, SelectItem as jo, SelectLabel as qo, SelectScrollDownButton as Jo, SelectScrollUpButton as Qo, SelectSeparator as Wo, SelectTrigger as Zo, SelectValue as $o } from "./components/ui/select.es.js";
|
|
30
30
|
import { Separator as or } from "./components/ui/separator.es.js";
|
|
31
31
|
import { Sheet as tr, SheetClose as ar, SheetContent as nr, SheetDescription as ir, SheetFooter as pr, SheetHeader as mr, SheetOverlay as lr, SheetPortal as dr, SheetTitle as ur, SheetTrigger as Sr } from "./components/ui/sheet.es.js";
|
|
32
|
-
import { Sidebar as
|
|
32
|
+
import { Sidebar as gr, SidebarContent as Cr, SidebarFooter as br, SidebarGroup as Dr, SidebarGroupAction as xr, SidebarGroupContent as fr, SidebarGroupLabel as cr, SidebarHeader as sr, SidebarInput as Mr, SidebarInset as Ir, SidebarMenu as Lr, SidebarMenuAction as Pr, SidebarMenuBadge as Er, SidebarMenuButton as Ar, SidebarMenuItem as Fr, SidebarMenuSkeleton as wr, SidebarMenuSub as Or, SidebarMenuSubButton as Rr, SidebarMenuSubItem as vr, SidebarProvider as _r, SidebarRail as hr, SidebarSeparator as Br, SidebarTrigger as Nr, useSidebar as yr } from "./components/ui/sidebar.es.js";
|
|
33
33
|
import { Skeleton as kr } from "./components/ui/skeleton.es.js";
|
|
34
34
|
import { Toaster as Ur } from "./components/ui/sonner.es.js";
|
|
35
35
|
import { Table as Yr, TableBody as Kr, TableCaption as zr, TableCell as Xr, TableFooter as jr, TableHead as qr, TableHeader as Jr, TableRow as Qr } from "./components/ui/table.es.js";
|
|
@@ -37,50 +37,50 @@ import { Tabs as Zr, TabsContent as $r, TabsList as et, TabsTrigger as ot } from
|
|
|
37
37
|
import { Tooltip as tt, TooltipContent as at, TooltipProvider as nt, TooltipTrigger as it } from "./components/ui/tooltip.es.js";
|
|
38
38
|
import { TablePageLayout as mt } from "./components/ui/table-page-layout.es.js";
|
|
39
39
|
import { useIsMobile as dt } from "./hooks/use-mobile.es.js";
|
|
40
|
-
import { cn as St, getThemeHue as
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import { ALL_OS as
|
|
44
|
-
import { createTableFetchFn as
|
|
45
|
-
import { FormatDate as
|
|
46
|
-
import { getLinkDisplay as
|
|
47
|
-
import { convertCamelCaseToTitleCase as
|
|
48
|
-
import { DYNAMIC_INPUT_TARGET as
|
|
49
|
-
import { KeyValueCard as
|
|
50
|
-
import { AppLayout as
|
|
51
|
-
import { NavMain as
|
|
52
|
-
import { SideBar as
|
|
53
|
-
import { StaticDataTable as
|
|
40
|
+
import { cn as St, getThemeHue as Tt, logout as gt, setThemeHue as Ct } from "./utils/index.es.js";
|
|
41
|
+
import { ACTIONS_COLUMN_ID as Dt, DataTable as xt } from "./components/data-table/data-table.es.js";
|
|
42
|
+
import { TABLE_CHECK_BOX_COLUMN as ct, TABLE_DEFAULT_DATE_COLUMNS as st, TABLE_ID_COLUMN as Mt } from "./components/data-table/table-commons.es.js";
|
|
43
|
+
import { ALL_OS as Lt, COMPARISON_OPERATOR_LABELS as Pt, DEFAULT_FILTERABLE_FIELDS as Et, FILTERABLE_PROPERTY_TYPES as At, FILTER_COMPARISON_OPERATORS as Ft, OPERATORS_FOR_FILTER_TYPE as wt, RESOURCE_DEFINITIONS as Ot, RESOURCE_NAMES as Rt, getLicenseStatus as vt, getResourceDisplayName as _t, getValidityDisplay as ht, getValueFromData as Bt, secondsToDuration as Nt } from "./components/data-table/table-utils/constants.es.js";
|
|
44
|
+
import { createTableFetchFn as Gt } from "./components/data-table/table-utils/createTableFetchFn.es.js";
|
|
45
|
+
import { FormatDate as Ht } from "./components/data-table/table-utils/date.es.js";
|
|
46
|
+
import { getLinkDisplay as Vt } from "./components/data-table/table-utils/link-display.es.js";
|
|
47
|
+
import { convertCamelCaseToTitleCase as Kt, convertToTitleCase as zt, pluralizeTimes as Xt } from "./components/data-table/table-utils/string.es.js";
|
|
48
|
+
import { DYNAMIC_INPUT_TARGET as qt } from "./components/data-table/table-utils/types.es.js";
|
|
49
|
+
import { KeyValueCard as Qt } from "./components/key-value-card/key-value-card.es.js";
|
|
50
|
+
import { AppLayout as Zt } from "./components/sidebar/app-layout.es.js";
|
|
51
|
+
import { NavMain as ea } from "./components/sidebar/nav-main.es.js";
|
|
52
|
+
import { SideBar as ra } from "./components/sidebar/sidebar.es.js";
|
|
53
|
+
import { StaticDataTable as aa } from "./components/static-data-table/data-table.es.js";
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
Dt as ACTIONS_COLUMN_ID,
|
|
56
|
+
Lt as ALL_OS,
|
|
56
57
|
t as Accordion,
|
|
57
58
|
a as AccordionContent,
|
|
58
59
|
n as AccordionItem,
|
|
59
60
|
i as AccordionTrigger,
|
|
60
|
-
|
|
61
|
+
Zt as AppLayout,
|
|
61
62
|
m as Avatar,
|
|
62
63
|
l as AvatarFallback,
|
|
63
64
|
d as AvatarImage,
|
|
64
65
|
S as Badge,
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
C as Breadcrumb,
|
|
67
|
+
b as BreadcrumbEllipsis,
|
|
67
68
|
D as BreadcrumbItem,
|
|
68
69
|
x as BreadcrumbLink,
|
|
69
70
|
f as BreadcrumbList,
|
|
70
71
|
c as BreadcrumbPage,
|
|
71
72
|
s as BreadcrumbSeparator,
|
|
72
73
|
I as Button,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
F as
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
N as
|
|
83
|
-
_ as ChartLegend,
|
|
74
|
+
Pt as COMPARISON_OPERATOR_LABELS,
|
|
75
|
+
E as Calendar,
|
|
76
|
+
F as Card,
|
|
77
|
+
w as CardContent,
|
|
78
|
+
O as CardDescription,
|
|
79
|
+
R as CardFooter,
|
|
80
|
+
v as CardHeader,
|
|
81
|
+
_ as CardTitle,
|
|
82
|
+
B as ChartContainer,
|
|
83
|
+
N as ChartLegend,
|
|
84
84
|
y as ChartLegendContent,
|
|
85
85
|
G as ChartStyle,
|
|
86
86
|
k as ChartTooltip,
|
|
@@ -99,10 +99,9 @@ export {
|
|
|
99
99
|
oe as CommandSeparator,
|
|
100
100
|
re as CommandShortcut,
|
|
101
101
|
ae as CopyButton,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Dt as DataTable,
|
|
102
|
+
Et as DEFAULT_FILTERABLE_FIELDS,
|
|
103
|
+
qt as DYNAMIC_INPUT_TARGET,
|
|
104
|
+
xt as DataTable,
|
|
106
105
|
ie as Dialog,
|
|
107
106
|
pe as DialogClose,
|
|
108
107
|
me as DialogContent,
|
|
@@ -110,9 +109,9 @@ export {
|
|
|
110
109
|
de as DialogFooter,
|
|
111
110
|
ue as DialogHeader,
|
|
112
111
|
Se as DialogOverlay,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
Te as DialogPortal,
|
|
113
|
+
ge as DialogTitle,
|
|
114
|
+
Ce as DialogTrigger,
|
|
116
115
|
De as Drawer,
|
|
117
116
|
xe as DrawerClose,
|
|
118
117
|
fe as DrawerContent,
|
|
@@ -122,24 +121,24 @@ export {
|
|
|
122
121
|
Ie as DrawerOverlay,
|
|
123
122
|
Le as DrawerPortal,
|
|
124
123
|
Pe as DrawerTitle,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
Ee as DrawerTrigger,
|
|
125
|
+
Fe as DropdownMenu,
|
|
126
|
+
we as DropdownMenuCheckboxItem,
|
|
127
|
+
Oe as DropdownMenuContent,
|
|
128
|
+
Re as DropdownMenuGroup,
|
|
129
|
+
ve as DropdownMenuItem,
|
|
130
|
+
_e as DropdownMenuLabel,
|
|
131
|
+
he as DropdownMenuPortal,
|
|
132
|
+
Be as DropdownMenuRadioGroup,
|
|
133
|
+
Ne as DropdownMenuRadioItem,
|
|
135
134
|
ye as DropdownMenuSeparator,
|
|
136
135
|
Ge as DropdownMenuShortcut,
|
|
137
136
|
ke as DropdownMenuSub,
|
|
138
137
|
He as DropdownMenuSubContent,
|
|
139
138
|
Ue as DropdownMenuSubTrigger,
|
|
140
139
|
Ve as DropdownMenuTrigger,
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
At as FILTERABLE_PROPERTY_TYPES,
|
|
141
|
+
Ft as FILTER_COMPARISON_OPERATORS,
|
|
143
142
|
Ke as Form,
|
|
144
143
|
ze as FormControl,
|
|
145
144
|
Xe as FormDescription,
|
|
@@ -147,42 +146,41 @@ export {
|
|
|
147
146
|
qe as FormItem,
|
|
148
147
|
Je as FormLabel,
|
|
149
148
|
Qe as FormMessage,
|
|
150
|
-
|
|
151
|
-
st as ID_COLUMN,
|
|
149
|
+
Ht as FormatDate,
|
|
152
150
|
$e as Input,
|
|
153
151
|
oo as InputOTP,
|
|
154
152
|
ro as InputOTPGroup,
|
|
155
153
|
to as InputOTPSeparator,
|
|
156
154
|
ao as InputOTPSlot,
|
|
157
|
-
|
|
155
|
+
Qt as KeyValueCard,
|
|
158
156
|
io as Label,
|
|
159
157
|
mo as LinkButton,
|
|
160
158
|
uo as Loader,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
ea as NavMain,
|
|
160
|
+
To as NavigationMenu,
|
|
161
|
+
go as NavigationMenuContent,
|
|
162
|
+
Co as NavigationMenuIndicator,
|
|
163
|
+
bo as NavigationMenuItem,
|
|
166
164
|
Do as NavigationMenuLink,
|
|
167
165
|
xo as NavigationMenuList,
|
|
168
166
|
fo as NavigationMenuListItem,
|
|
169
167
|
co as NavigationMenuTrigger,
|
|
170
168
|
so as NavigationMenuViewport,
|
|
171
|
-
|
|
169
|
+
wt as OPERATORS_FOR_FILTER_TYPE,
|
|
172
170
|
Lo as Pagination,
|
|
173
171
|
Po as PaginationContent,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
Eo as PaginationEllipsis,
|
|
173
|
+
Ao as PaginationItem,
|
|
174
|
+
Fo as PaginationLink,
|
|
175
|
+
wo as PaginationNext,
|
|
176
|
+
Oo as PaginationPrevious,
|
|
177
|
+
vo as PasswordInput,
|
|
178
|
+
ho as Popover,
|
|
179
|
+
Bo as PopoverAnchor,
|
|
180
|
+
No as PopoverContent,
|
|
183
181
|
yo as PopoverTrigger,
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
Ot as RESOURCE_DEFINITIONS,
|
|
183
|
+
Rt as RESOURCE_NAMES,
|
|
186
184
|
ko as RadioGroup,
|
|
187
185
|
Ho as RadioGroupItem,
|
|
188
186
|
Vo as SearchInput,
|
|
@@ -207,10 +205,10 @@ export {
|
|
|
207
205
|
dr as SheetPortal,
|
|
208
206
|
ur as SheetTitle,
|
|
209
207
|
Sr as SheetTrigger,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
ra as SideBar,
|
|
209
|
+
gr as Sidebar,
|
|
210
|
+
Cr as SidebarContent,
|
|
211
|
+
br as SidebarFooter,
|
|
214
212
|
Dr as SidebarGroup,
|
|
215
213
|
xr as SidebarGroupAction,
|
|
216
214
|
fr as SidebarGroupContent,
|
|
@@ -220,19 +218,22 @@ export {
|
|
|
220
218
|
Ir as SidebarInset,
|
|
221
219
|
Lr as SidebarMenu,
|
|
222
220
|
Pr as SidebarMenuAction,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
221
|
+
Er as SidebarMenuBadge,
|
|
222
|
+
Ar as SidebarMenuButton,
|
|
223
|
+
Fr as SidebarMenuItem,
|
|
224
|
+
wr as SidebarMenuSkeleton,
|
|
225
|
+
Or as SidebarMenuSub,
|
|
226
|
+
Rr as SidebarMenuSubButton,
|
|
227
|
+
vr as SidebarMenuSubItem,
|
|
228
|
+
_r as SidebarProvider,
|
|
229
|
+
hr as SidebarRail,
|
|
230
|
+
Br as SidebarSeparator,
|
|
231
|
+
Nr as SidebarTrigger,
|
|
234
232
|
kr as Skeleton,
|
|
235
|
-
|
|
233
|
+
aa as StaticDataTable,
|
|
234
|
+
ct as TABLE_CHECK_BOX_COLUMN,
|
|
235
|
+
st as TABLE_DEFAULT_DATE_COLUMNS,
|
|
236
|
+
Mt as TABLE_ID_COLUMN,
|
|
236
237
|
Yr as Table,
|
|
237
238
|
Kr as TableBody,
|
|
238
239
|
zr as TableCaption,
|
|
@@ -251,23 +252,23 @@ export {
|
|
|
251
252
|
at as TooltipContent,
|
|
252
253
|
nt as TooltipProvider,
|
|
253
254
|
it as TooltipTrigger,
|
|
254
|
-
|
|
255
|
+
T as badgeVariants,
|
|
255
256
|
L as buttonVariants,
|
|
256
257
|
St as cn,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
258
|
+
Kt as convertCamelCaseToTitleCase,
|
|
259
|
+
zt as convertToTitleCase,
|
|
260
|
+
Gt as createTableFetchFn,
|
|
261
|
+
vt as getLicenseStatus,
|
|
262
|
+
Vt as getLinkDisplay,
|
|
263
|
+
_t as getResourceDisplayName,
|
|
264
|
+
Tt as getThemeHue,
|
|
264
265
|
ht as getValidityDisplay,
|
|
265
266
|
Bt as getValueFromData,
|
|
266
|
-
|
|
267
|
+
gt as logout,
|
|
267
268
|
Mo as navigationMenuTriggerStyle,
|
|
268
|
-
|
|
269
|
+
Xt as pluralizeTimes,
|
|
269
270
|
Nt as secondsToDuration,
|
|
270
|
-
|
|
271
|
+
Ct as setThemeHue,
|
|
271
272
|
We as useFormField,
|
|
272
273
|
dt as useIsMobile,
|
|
273
274
|
yr as useSidebar
|
package/lib/tailwind.preset.css
CHANGED
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
--color-success-10: var(--success-10);
|
|
77
77
|
|
|
78
78
|
--color-background: var(--color-neutral-2);
|
|
79
|
-
--color-foreground: var(--color-neutral-
|
|
79
|
+
--color-foreground: var(--color-neutral-9);
|
|
80
80
|
|
|
81
|
-
--color-card: var(--color-neutral-
|
|
81
|
+
--color-card: var(--color-neutral-1);
|
|
82
82
|
--color-card-foreground: var(--color-foreground);
|
|
83
83
|
|
|
84
|
-
--color-popover: var(--color-
|
|
84
|
+
--color-popover: var(--color-card);
|
|
85
85
|
--color-popover-foreground: var(--color-foreground);
|
|
86
86
|
|
|
87
87
|
--color-primary: var(--color-primary-8);
|