@yuno-payments/dashboard-design-system 0.0.136 → 0.0.138-beta.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/atoms/filter/filter-date-range.js +185 -161
- package/dist/components/atoms/filter/filter.d.ts +4 -0
- package/dist/components/atoms/filter/filter.js +82 -70
- package/dist/components/atoms/filter-dropdown/filter-dropdown.js +84 -87
- package/dist/components/atoms/icon/icon-list.d.ts +0 -3
- package/dist/components/atoms/icon/icon-list.js +392 -398
- package/dist/components/atoms/multi-values-field/multi-values-field.js +28 -28
- package/dist/components/atoms/radio-group/radio-group-option.js +7 -7
- package/dist/components/atoms/search-field/search-field.js +9 -9
- package/dist/components/atoms/switch/switch.js +13 -13
- package/dist/components/atoms/time-picker/time-picker.d.ts +5 -0
- package/dist/components/atoms/time-picker/time-picker.js +123 -115
- package/dist/components/molecules/empty/empty-icon.js +6 -6
- package/dist/components/organisms/data-table/data-table.d.ts +1 -24
- package/dist/components/organisms/data-table/data-table.js +93 -104
- package/dist/components/organisms/data-table/data-table.types.d.ts +0 -20
- package/dist/components/organisms/data-table/hooks/use-data-table-state.d.ts +2 -7
- package/dist/components/organisms/data-table/hooks/use-data-table-state.js +46 -80
- package/dist/components/organisms/data-table/utils/data-table-constants.d.ts +2 -2
- package/dist/components/organisms/data-table/utils/data-table-constants.js +11 -11
- package/dist/index.css +1 -1
- package/dist/vendor/shadcn/badge.js +17 -17
- package/dist/vendor/shadcn/card.js +7 -7
- package/dist/vendor/shadcn/input.js +7 -7
- package/dist/vendor/shadcn/select.js +1 -1
- package/dist/vendor/shadcn/table.js +18 -18
- package/package.json +1 -1
- package/dist/components/atoms/icon/aida-logo.d.ts +0 -3
- package/dist/components/atoms/icon/aida-logo.js +0 -64
- package/dist/node_modules/@phosphor-icons/react/dist/csr/File.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/csr/Table.es.js +0 -8
- package/dist/node_modules/@phosphor-icons/react/dist/defs/File.es.js +0 -30
- package/dist/node_modules/@phosphor-icons/react/dist/defs/Table.es.js +0 -30
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { j as o } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import "react";
|
|
3
|
-
import { Icon as
|
|
4
|
-
function
|
|
3
|
+
import { Icon as t } from "../../atoms/icon/icon.js";
|
|
4
|
+
function d({
|
|
5
5
|
name: r,
|
|
6
|
-
size:
|
|
7
|
-
className:
|
|
6
|
+
size: m = "xl",
|
|
7
|
+
className: n,
|
|
8
8
|
children: s
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */ o.jsx("div", { className: "p-4 bg-
|
|
10
|
+
return /* @__PURE__ */ o.jsx("div", { className: "p-4 bg-background rounded-lg shadow-sm", children: s || /* @__PURE__ */ o.jsx(t, { name: r, size: m, className: n }) });
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
d as EmptyIcon
|
|
14
14
|
};
|
|
@@ -41,15 +41,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
41
41
|
* @default false
|
|
42
42
|
*/
|
|
43
43
|
manualSorting?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Controlled sorting state (optional)
|
|
46
|
-
* If provided, component operates in controlled mode
|
|
47
|
-
*/
|
|
48
|
-
sorting?: import('@tanstack/react-table').SortingState;
|
|
49
|
-
/**
|
|
50
|
-
* Callback when sorting changes (required for controlled mode)
|
|
51
|
-
*/
|
|
52
|
-
onSortingChange?: (sorting: import('@tanstack/react-table').SortingState) => void;
|
|
53
44
|
/**
|
|
54
45
|
* Whether to enable column filtering
|
|
55
46
|
* @default false
|
|
@@ -65,11 +56,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
65
56
|
* @default 'onChange'
|
|
66
57
|
*/
|
|
67
58
|
columnResizeMode?: ColumnResizeMode;
|
|
68
|
-
/**
|
|
69
|
-
* Whether to enable column pinning
|
|
70
|
-
* @default true
|
|
71
|
-
*/
|
|
72
|
-
enableColumnPinning?: boolean;
|
|
73
59
|
/**
|
|
74
60
|
* Callback fired when a row is clicked
|
|
75
61
|
*/
|
|
@@ -95,15 +81,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
95
81
|
* Unique key for persisting table state in localStorage
|
|
96
82
|
*/
|
|
97
83
|
persistKey?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Initial settings to load (from backend/profile)
|
|
100
|
-
* Takes precedence over localStorage
|
|
101
|
-
*/
|
|
102
|
-
initialSettings?: import('./data-table.types').DataTableSettings;
|
|
103
|
-
/**
|
|
104
|
-
* Callback when table settings change (for syncing to backend)
|
|
105
|
-
*/
|
|
106
|
-
onUpdate?: (settings: import('./data-table.types').DataTableSettings) => void;
|
|
107
84
|
}
|
|
108
85
|
/**
|
|
109
86
|
* Advanced data table component built on TanStack Table.
|
|
@@ -126,4 +103,4 @@ export interface DataTableProps<TData, TValue> {
|
|
|
126
103
|
* />
|
|
127
104
|
* ```
|
|
128
105
|
*/
|
|
129
|
-
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, onRowSelectionChange, enableSorting, manualSorting,
|
|
106
|
+
export declare function DataTable<TData, TValue>({ columns, data, isLoading, empty, checkboxSelection, onRowSelectionChange, enableSorting, manualSorting, enableColumnFilters, enableColumnResizing, columnResizeMode, onRowClick, actions, height, rowHeight, className, persistKey, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,151 +1,140 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import * as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { Table as
|
|
1
|
+
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import { useReactTable as W } from "../../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { Table as _ } from "../../../vendor/shadcn/table.js";
|
|
5
5
|
import { cn as u } from "../../../lib/utils.js";
|
|
6
|
-
import { DataTableLoading as
|
|
7
|
-
import { DataTableHeader as
|
|
8
|
-
import { DataTableBody as
|
|
9
|
-
import { useDataTableColumns as
|
|
10
|
-
import { useDataTableState as
|
|
11
|
-
import { ROW_HEIGHT_DEFAULT as
|
|
12
|
-
import { getFilteredRowModel as
|
|
13
|
-
import { Empty as
|
|
14
|
-
function
|
|
6
|
+
import { DataTableLoading as B } from "./components/states/data-table-loading.js";
|
|
7
|
+
import { DataTableHeader as G } from "./components/data-table-header.js";
|
|
8
|
+
import { DataTableBody as I } from "./components/data-table-body.js";
|
|
9
|
+
import { useDataTableColumns as O } from "./hooks/use-data-table-columns.js";
|
|
10
|
+
import { useDataTableState as U } from "./hooks/use-data-table-state.js";
|
|
11
|
+
import { ROW_HEIGHT_DEFAULT as q } from "./utils/data-table-constants.js";
|
|
12
|
+
import { getFilteredRowModel as J, getSortedRowModel as K, getCoreRowModel as Q } from "../../../node_modules/@tanstack/table-core/build/lib/index.js";
|
|
13
|
+
import { Empty as X } from "../../molecules/empty/empty.js";
|
|
14
|
+
function ae({
|
|
15
15
|
columns: a,
|
|
16
16
|
data: s,
|
|
17
|
-
isLoading:
|
|
18
|
-
empty:
|
|
17
|
+
isLoading: c = !1,
|
|
18
|
+
empty: g,
|
|
19
19
|
checkboxSelection: m = !1,
|
|
20
|
-
onRowSelectionChange:
|
|
21
|
-
enableSorting:
|
|
22
|
-
manualSorting:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rowHeight: d = Z,
|
|
33
|
-
className: D,
|
|
34
|
-
persistKey: F,
|
|
35
|
-
initialSettings: M,
|
|
36
|
-
onUpdate: E
|
|
20
|
+
onRowSelectionChange: o,
|
|
21
|
+
enableSorting: p = !0,
|
|
22
|
+
manualSorting: C = !1,
|
|
23
|
+
enableColumnFilters: b = !1,
|
|
24
|
+
enableColumnResizing: i = !0,
|
|
25
|
+
columnResizeMode: h = "onChange",
|
|
26
|
+
onRowClick: x,
|
|
27
|
+
actions: n,
|
|
28
|
+
height: w,
|
|
29
|
+
rowHeight: d = q,
|
|
30
|
+
className: T,
|
|
31
|
+
persistKey: j
|
|
37
32
|
}) {
|
|
38
|
-
const
|
|
33
|
+
const y = O({
|
|
39
34
|
columns: a,
|
|
40
35
|
checkboxSelection: m,
|
|
41
|
-
actions:
|
|
36
|
+
actions: n
|
|
42
37
|
}), {
|
|
43
|
-
sorting:
|
|
44
|
-
setSorting:
|
|
45
|
-
columnFilters:
|
|
46
|
-
setColumnFilters:
|
|
47
|
-
columnVisibility:
|
|
48
|
-
setColumnVisibility:
|
|
49
|
-
rowSelection:
|
|
50
|
-
setRowSelection:
|
|
51
|
-
columnPinning:
|
|
52
|
-
handleColumnPinningChange:
|
|
53
|
-
} =
|
|
54
|
-
persistKey:
|
|
55
|
-
hasActions: !!
|
|
56
|
-
|
|
57
|
-
onExternalSortingChange: w,
|
|
58
|
-
initialSettings: M,
|
|
59
|
-
onUpdate: E
|
|
60
|
-
}), t = V({
|
|
38
|
+
sorting: R,
|
|
39
|
+
setSorting: S,
|
|
40
|
+
columnFilters: D,
|
|
41
|
+
setColumnFilters: F,
|
|
42
|
+
columnVisibility: M,
|
|
43
|
+
setColumnVisibility: E,
|
|
44
|
+
rowSelection: f,
|
|
45
|
+
setRowSelection: N,
|
|
46
|
+
columnPinning: v,
|
|
47
|
+
handleColumnPinningChange: P
|
|
48
|
+
} = U({
|
|
49
|
+
persistKey: j,
|
|
50
|
+
hasActions: !!n
|
|
51
|
+
}), t = W({
|
|
61
52
|
data: s,
|
|
62
|
-
columns:
|
|
63
|
-
getCoreRowModel:
|
|
64
|
-
enableColumnResizing:
|
|
65
|
-
columnResizeMode:
|
|
66
|
-
enableColumnPinning:
|
|
53
|
+
columns: y,
|
|
54
|
+
getCoreRowModel: Q(),
|
|
55
|
+
enableColumnResizing: i,
|
|
56
|
+
columnResizeMode: h,
|
|
57
|
+
enableColumnPinning: !0,
|
|
67
58
|
defaultColumn: {
|
|
68
59
|
enableSorting: !1,
|
|
69
60
|
minSize: 50
|
|
70
61
|
},
|
|
71
|
-
...
|
|
72
|
-
onSortingChange:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
getSortedRowModel: k(),
|
|
76
|
-
manualSorting: b
|
|
62
|
+
...p && {
|
|
63
|
+
onSortingChange: S,
|
|
64
|
+
getSortedRowModel: K(),
|
|
65
|
+
manualSorting: C
|
|
77
66
|
},
|
|
78
|
-
...
|
|
79
|
-
onColumnFiltersChange:
|
|
80
|
-
getFilteredRowModel:
|
|
67
|
+
...b && {
|
|
68
|
+
onColumnFiltersChange: F,
|
|
69
|
+
getFilteredRowModel: J()
|
|
81
70
|
},
|
|
82
|
-
onColumnVisibilityChange:
|
|
83
|
-
onRowSelectionChange:
|
|
84
|
-
onColumnPinningChange:
|
|
71
|
+
onColumnVisibilityChange: E,
|
|
72
|
+
onRowSelectionChange: N,
|
|
73
|
+
onColumnPinningChange: P,
|
|
85
74
|
state: {
|
|
86
|
-
sorting:
|
|
87
|
-
columnFilters:
|
|
88
|
-
columnVisibility:
|
|
89
|
-
rowSelection:
|
|
90
|
-
columnPinning:
|
|
75
|
+
sorting: R,
|
|
76
|
+
columnFilters: D,
|
|
77
|
+
columnVisibility: M,
|
|
78
|
+
rowSelection: f,
|
|
79
|
+
columnPinning: v
|
|
91
80
|
}
|
|
92
81
|
});
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
|
|
82
|
+
if (L.useEffect(() => {
|
|
83
|
+
if (o) {
|
|
84
|
+
const r = t.getFilteredSelectedRowModel().rows.map((l) => l.original);
|
|
85
|
+
o(r);
|
|
97
86
|
}
|
|
98
|
-
}, [
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
|
|
87
|
+
}, [f, o, t]), c)
|
|
88
|
+
return /* @__PURE__ */ e.jsx(
|
|
89
|
+
B,
|
|
101
90
|
{
|
|
102
91
|
columns: a,
|
|
103
92
|
checkboxSelection: m,
|
|
104
|
-
actions:
|
|
93
|
+
actions: n,
|
|
105
94
|
rowHeight: d
|
|
106
95
|
}
|
|
107
96
|
);
|
|
108
97
|
if (s.length === 0) {
|
|
109
|
-
const
|
|
98
|
+
const r = g || {}, {
|
|
110
99
|
title: l = "No results",
|
|
111
|
-
description:
|
|
112
|
-
media:
|
|
113
|
-
actions:
|
|
114
|
-
} =
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
100
|
+
description: V = "No data available",
|
|
101
|
+
media: A,
|
|
102
|
+
actions: H
|
|
103
|
+
} = r;
|
|
104
|
+
return /* @__PURE__ */ e.jsx(
|
|
105
|
+
X,
|
|
117
106
|
{
|
|
118
|
-
media:
|
|
107
|
+
media: A,
|
|
119
108
|
title: l,
|
|
120
|
-
description:
|
|
121
|
-
actions:
|
|
109
|
+
description: V,
|
|
110
|
+
actions: H
|
|
122
111
|
}
|
|
123
112
|
);
|
|
124
113
|
}
|
|
125
|
-
return /* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ e.jsx("div", { className: u("space-y-4", T), children: /* @__PURE__ */ e.jsx(
|
|
126
115
|
"div",
|
|
127
116
|
{
|
|
128
117
|
className: "rounded-md border overflow-x-auto",
|
|
129
|
-
style: { height:
|
|
130
|
-
children: /* @__PURE__ */
|
|
131
|
-
|
|
118
|
+
style: { height: w || "auto" },
|
|
119
|
+
children: /* @__PURE__ */ e.jsxs(
|
|
120
|
+
_,
|
|
132
121
|
{
|
|
133
122
|
className: u("table-fixed"),
|
|
134
123
|
style: { width: "max-content", minWidth: "100%" },
|
|
135
124
|
children: [
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
|
|
125
|
+
/* @__PURE__ */ e.jsx(
|
|
126
|
+
G,
|
|
138
127
|
{
|
|
139
128
|
table: t,
|
|
140
|
-
enableColumnResizing:
|
|
129
|
+
enableColumnResizing: i
|
|
141
130
|
}
|
|
142
131
|
),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
132
|
+
/* @__PURE__ */ e.jsx(
|
|
133
|
+
I,
|
|
145
134
|
{
|
|
146
135
|
table: t,
|
|
147
|
-
enableColumnResizing:
|
|
148
|
-
onRowClick:
|
|
136
|
+
enableColumnResizing: i,
|
|
137
|
+
onRowClick: x,
|
|
149
138
|
rowHeight: d
|
|
150
139
|
}
|
|
151
140
|
)
|
|
@@ -156,5 +145,5 @@ function ge({
|
|
|
156
145
|
) });
|
|
157
146
|
}
|
|
158
147
|
export {
|
|
159
|
-
|
|
148
|
+
ae as DataTable
|
|
160
149
|
};
|
|
@@ -77,23 +77,6 @@ export type DataTableColumn<TData> = ColumnDef<TData> & {
|
|
|
77
77
|
enableSorting?: boolean;
|
|
78
78
|
enableHiding?: boolean;
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
81
|
-
* Settings structure compatible with TableV2 format
|
|
82
|
-
* Used for initialSettings and onUpdate callback
|
|
83
|
-
*/
|
|
84
|
-
export interface DataTableSettings {
|
|
85
|
-
hide?: string[];
|
|
86
|
-
show?: string[];
|
|
87
|
-
width?: {
|
|
88
|
-
[key: string]: number;
|
|
89
|
-
};
|
|
90
|
-
pinnedColumns?: {
|
|
91
|
-
right: string[];
|
|
92
|
-
left: string[];
|
|
93
|
-
};
|
|
94
|
-
order?: string[];
|
|
95
|
-
sorting?: SortingState;
|
|
96
|
-
}
|
|
97
80
|
export interface DataTableProps<TData> {
|
|
98
81
|
columns: DataTableColumn<TData>[];
|
|
99
82
|
data: TData[];
|
|
@@ -114,15 +97,12 @@ export interface DataTableProps<TData> {
|
|
|
114
97
|
enableColumnFilters?: boolean;
|
|
115
98
|
columnFilters?: ColumnFiltersState;
|
|
116
99
|
onColumnFiltersChange?: (filters: ColumnFiltersState) => void;
|
|
117
|
-
enableColumnPinning?: boolean;
|
|
118
100
|
columnVisibility?: VisibilityState;
|
|
119
101
|
onColumnVisibilityChange?: (visibility: VisibilityState) => void;
|
|
120
102
|
onRowClick?: (row: TData) => void;
|
|
121
103
|
height?: string | number;
|
|
122
104
|
rowHeight?: number;
|
|
123
105
|
persistKey?: string;
|
|
124
|
-
initialSettings?: DataTableSettings;
|
|
125
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
126
106
|
renderToolbar?: () => React.ReactNode;
|
|
127
107
|
renderActions?: () => React.ReactNode;
|
|
128
108
|
className?: string;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { ColumnFiltersState, SortingState, VisibilityState, RowSelectionState, ColumnPinningState } from '@tanstack/react-table';
|
|
2
|
-
import { DataTableSettings } from '../data-table.types';
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
interface UseDataTableStateProps {
|
|
5
4
|
persistKey?: string;
|
|
6
5
|
hasActions?: boolean;
|
|
7
|
-
externalSorting?: SortingState;
|
|
8
|
-
onExternalSortingChange?: (sorting: SortingState) => void;
|
|
9
|
-
initialSettings?: DataTableSettings;
|
|
10
|
-
onUpdate?: (settings: DataTableSettings) => void;
|
|
11
6
|
}
|
|
12
|
-
export declare function useDataTableState({ persistKey, hasActions,
|
|
7
|
+
export declare function useDataTableState({ persistKey, hasActions, }: UseDataTableStateProps): {
|
|
13
8
|
sorting: SortingState;
|
|
14
|
-
setSorting:
|
|
9
|
+
setSorting: React.Dispatch<React.SetStateAction<SortingState>>;
|
|
15
10
|
columnFilters: ColumnFiltersState;
|
|
16
11
|
setColumnFilters: React.Dispatch<React.SetStateAction<ColumnFiltersState>>;
|
|
17
12
|
columnVisibility: VisibilityState;
|
|
@@ -1,108 +1,74 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
function
|
|
3
|
-
persistKey:
|
|
4
|
-
hasActions:
|
|
5
|
-
externalSorting: P,
|
|
6
|
-
onExternalSortingChange: r,
|
|
7
|
-
initialSettings: n,
|
|
8
|
-
onUpdate: m
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
function V({
|
|
3
|
+
persistKey: i,
|
|
4
|
+
hasActions: l = !1
|
|
9
5
|
}) {
|
|
10
|
-
const [
|
|
6
|
+
const [g, m] = e.useState([]), [S, b] = e.useState(
|
|
11
7
|
[]
|
|
12
|
-
), [
|
|
8
|
+
), [r, c] = e.useState({}), [h, P] = e.useState({}), [a, s] = e.useState({
|
|
13
9
|
left: [],
|
|
14
|
-
right:
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
n.hide?.forEach((t) => {
|
|
21
|
-
e[t] = !1;
|
|
22
|
-
}), d(e);
|
|
23
|
-
}
|
|
24
|
-
n.pinnedColumns && g({
|
|
25
|
-
left: n.pinnedColumns.left || [],
|
|
26
|
-
right: [
|
|
27
|
-
...(n.pinnedColumns.right || []).filter(
|
|
28
|
-
(e) => e !== "actions"
|
|
29
|
-
),
|
|
30
|
-
...s ? ["actions"] : []
|
|
31
|
-
]
|
|
32
|
-
}), !r && n.sorting && a(n.sorting);
|
|
33
|
-
}
|
|
34
|
-
}, [n, s, r]), i.useEffect(() => {
|
|
35
|
-
if (!l) return;
|
|
36
|
-
const e = localStorage.getItem(`datatable-${l}`);
|
|
37
|
-
if (e)
|
|
10
|
+
right: l ? ["actions"] : []
|
|
11
|
+
});
|
|
12
|
+
e.useEffect(() => {
|
|
13
|
+
if (!i) return;
|
|
14
|
+
const n = localStorage.getItem(`datatable-${i}`);
|
|
15
|
+
if (n)
|
|
38
16
|
try {
|
|
39
|
-
const t = JSON.parse(
|
|
40
|
-
t.columnVisibility &&
|
|
17
|
+
const t = JSON.parse(n);
|
|
18
|
+
t.columnVisibility && c(t.columnVisibility), t.columnPinning && s({
|
|
41
19
|
left: t.columnPinning.left || [],
|
|
42
20
|
right: [
|
|
43
21
|
...(t.columnPinning.right || []).filter(
|
|
44
22
|
(o) => o !== "actions"
|
|
45
23
|
),
|
|
46
|
-
...
|
|
24
|
+
...l ? ["actions"] : []
|
|
47
25
|
]
|
|
48
|
-
})
|
|
26
|
+
});
|
|
49
27
|
} catch (t) {
|
|
50
28
|
console.error("Failed to load table state", t);
|
|
51
29
|
}
|
|
52
|
-
}, [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
right: f.right || []
|
|
58
|
-
},
|
|
59
|
-
// Only include sorting if not controlled externally
|
|
60
|
-
...!r && c.length > 0 && { sorting: c }
|
|
30
|
+
}, [i, l]), e.useEffect(() => {
|
|
31
|
+
if (!i) return;
|
|
32
|
+
const n = {
|
|
33
|
+
columnVisibility: r,
|
|
34
|
+
columnPinning: a
|
|
61
35
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}, [u, f, c, l, r, m]);
|
|
72
|
-
const O = i.useCallback(
|
|
73
|
-
(e) => {
|
|
74
|
-
g((t) => {
|
|
75
|
-
const o = typeof e == "function" ? e(t) : e, h = Array.isArray(o.left) ? o.left : [], b = Array.isArray(o.right) ? o.right : [];
|
|
76
|
-
if (s) {
|
|
77
|
-
const v = b.filter(
|
|
78
|
-
(J) => J !== "actions"
|
|
36
|
+
localStorage.setItem(`datatable-${i}`, JSON.stringify(n));
|
|
37
|
+
}, [r, a, i]);
|
|
38
|
+
const d = e.useCallback(
|
|
39
|
+
(n) => {
|
|
40
|
+
s((t) => {
|
|
41
|
+
const o = typeof n == "function" ? n(t) : n, u = Array.isArray(o.left) ? o.left : [], f = Array.isArray(o.right) ? o.right : [];
|
|
42
|
+
if (l) {
|
|
43
|
+
const y = f.filter(
|
|
44
|
+
(C) => C !== "actions"
|
|
79
45
|
);
|
|
80
46
|
return {
|
|
81
|
-
left:
|
|
82
|
-
right: [...
|
|
47
|
+
left: u,
|
|
48
|
+
right: [...y, "actions"]
|
|
83
49
|
};
|
|
84
50
|
}
|
|
85
51
|
return {
|
|
86
|
-
left:
|
|
87
|
-
right:
|
|
52
|
+
left: u,
|
|
53
|
+
right: f
|
|
88
54
|
};
|
|
89
55
|
});
|
|
90
56
|
},
|
|
91
|
-
[
|
|
57
|
+
[l]
|
|
92
58
|
);
|
|
93
59
|
return {
|
|
94
|
-
sorting:
|
|
95
|
-
setSorting:
|
|
96
|
-
columnFilters:
|
|
97
|
-
setColumnFilters:
|
|
98
|
-
columnVisibility:
|
|
99
|
-
setColumnVisibility:
|
|
100
|
-
rowSelection:
|
|
101
|
-
setRowSelection:
|
|
102
|
-
columnPinning:
|
|
103
|
-
handleColumnPinningChange:
|
|
60
|
+
sorting: g,
|
|
61
|
+
setSorting: m,
|
|
62
|
+
columnFilters: S,
|
|
63
|
+
setColumnFilters: b,
|
|
64
|
+
columnVisibility: r,
|
|
65
|
+
setColumnVisibility: c,
|
|
66
|
+
rowSelection: h,
|
|
67
|
+
setRowSelection: P,
|
|
68
|
+
columnPinning: a,
|
|
69
|
+
handleColumnPinningChange: d
|
|
104
70
|
};
|
|
105
71
|
}
|
|
106
72
|
export {
|
|
107
|
-
|
|
73
|
+
V as useDataTableState
|
|
108
74
|
};
|
|
@@ -16,8 +16,8 @@ export declare const ACTIONS_COLUMN_CONFIG: {
|
|
|
16
16
|
readonly maxSize: 50;
|
|
17
17
|
};
|
|
18
18
|
export declare const CELL_BACKGROUND_COLORS: {
|
|
19
|
-
readonly header: "
|
|
20
|
-
readonly body: "
|
|
19
|
+
readonly header: "hsl(var(--sidebar))";
|
|
20
|
+
readonly body: "hsl(var(--background))";
|
|
21
21
|
};
|
|
22
22
|
export declare const ROW_HEIGHT_DEFAULT = 66;
|
|
23
23
|
export declare const PINNED_SHADOW_CLASS = "shadow-[-4px_0_4px_-2px_rgba(0,0,0,0.1)]";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = {
|
|
2
2
|
height: "h-8",
|
|
3
3
|
gap: "gap-1.5",
|
|
4
4
|
roundedClass: "rounded-md",
|
|
5
5
|
fontSize: "text-sm",
|
|
6
6
|
fontWeight: "font-medium"
|
|
7
|
-
},
|
|
7
|
+
}, t = {
|
|
8
8
|
width: "w-2",
|
|
9
9
|
lineHeight: "h-5",
|
|
10
10
|
lineWidth: "w-[1px]"
|
|
@@ -12,15 +12,15 @@ const t = {
|
|
|
12
12
|
size: 50,
|
|
13
13
|
minSize: 50,
|
|
14
14
|
maxSize: 50
|
|
15
|
-
},
|
|
16
|
-
header: "
|
|
17
|
-
body: "
|
|
18
|
-
},
|
|
15
|
+
}, n = {
|
|
16
|
+
header: "hsl(var(--sidebar))",
|
|
17
|
+
body: "hsl(var(--background))"
|
|
18
|
+
}, o = 66, i = "shadow-[-4px_0_4px_-2px_rgba(0,0,0,0.1)]";
|
|
19
19
|
export {
|
|
20
20
|
_ as ACTIONS_COLUMN_CONFIG,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
n as CELL_BACKGROUND_COLORS,
|
|
22
|
+
e as COLUMN_HEADER_CONFIG,
|
|
23
|
+
i as PINNED_SHADOW_CLASS,
|
|
24
|
+
t as RESIZE_HANDLE_CONFIG,
|
|
25
|
+
o as ROW_HEIGHT_DEFAULT
|
|
26
26
|
};
|