@versini/ui-datagrid 0.1.0 → 0.1.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/README.md +3 -43
- package/dist/DataGrid/DataGrid.js +29 -35
- package/dist/DataGrid/DataGridContext.js +1 -1
- package/dist/DataGrid/index.js +1 -1
- package/dist/DataGrid/utilities.d.ts +11 -3
- package/dist/DataGrid/utilities.js +32 -12
- package/dist/DataGridAnimated/AnimatedWrapper.js +1 -1
- package/dist/DataGridAnimated/index.js +1 -1
- package/dist/DataGridAnimated/useAnimatedHeight.js +1 -1
- package/dist/DataGridBody/DataGridBody.js +8 -3
- package/dist/DataGridBody/index.js +1 -1
- package/dist/DataGridCell/DataGridCell.d.ts +2 -5
- package/dist/DataGridCell/DataGridCell.js +27 -18
- package/dist/DataGridCell/index.js +1 -1
- package/dist/DataGridCellSort/DataGridCellSort.d.ts +1 -1
- package/dist/DataGridCellSort/DataGridCellSort.js +16 -11
- package/dist/DataGridCellSort/index.js +1 -1
- package/dist/DataGridConstants/DataGridConstants.js +1 -1
- package/dist/DataGridConstants/index.js +1 -1
- package/dist/DataGridFooter/DataGridFooter.js +4 -3
- package/dist/DataGridFooter/index.js +1 -1
- package/dist/DataGridHeader/DataGridHeader.d.ts +2 -1
- package/dist/DataGridHeader/DataGridHeader.js +18 -28
- package/dist/DataGridHeader/index.js +1 -1
- package/dist/DataGridInfinite/InfiniteScrollMarker.d.ts +2 -6
- package/dist/DataGridInfinite/InfiniteScrollMarker.js +7 -6
- package/dist/DataGridInfinite/index.js +1 -1
- package/dist/DataGridInfinite/useInfiniteScroll.d.ts +12 -1
- package/dist/DataGridInfinite/useInfiniteScroll.js +23 -4
- package/dist/DataGridRow/DataGridRow.js +23 -8
- package/dist/DataGridRow/index.js +1 -1
- package/dist/DataGridSorting/index.js +1 -1
- package/dist/DataGridSorting/sortingUtils.js +1 -1
- package/package.json +2 -7
- package/dist/DataGridVirtual/VirtualDataGrid.d.ts +0 -114
- package/dist/DataGridVirtual/VirtualDataGrid.js +0 -181
- package/dist/DataGridVirtual/index.d.ts +0 -6
- package/dist/DataGridVirtual/index.js +0 -22
- package/dist/DataGridVirtual/useVirtualDataGrid.d.ts +0 -112
- package/dist/DataGridVirtual/useVirtualDataGrid.js +0 -89
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @versini/ui-datagrid
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A data grid component library for React built with div-based ARIA grid layout for maximum flexibility and accessibility. Features include:
|
|
4
4
|
|
|
5
|
-
- **
|
|
5
|
+
- **Accessible**: Uses ARIA grid roles for screen reader support
|
|
6
|
+
- **Flexible Layout**: Div-based structure allows for complex styling
|
|
6
7
|
- **Infinite Scrolling**: Progressive loading with IntersectionObserver
|
|
7
8
|
- **Animated Height**: Smooth height transitions when content changes
|
|
8
9
|
- **Sorting**: Built-in sorting utilities and sortable column headers
|
|
@@ -39,12 +40,6 @@ import {
|
|
|
39
40
|
InfiniteScrollMarker
|
|
40
41
|
} from "@versini/ui-datagrid/infinite";
|
|
41
42
|
|
|
42
|
-
// True virtualization for large datasets
|
|
43
|
-
import {
|
|
44
|
-
VirtualDataGrid,
|
|
45
|
-
useVirtualDataGrid
|
|
46
|
-
} from "@versini/ui-datagrid/virtual";
|
|
47
|
-
|
|
48
43
|
// Animated height wrapper
|
|
49
44
|
import {
|
|
50
45
|
AnimatedWrapper,
|
|
@@ -152,31 +147,6 @@ function MyInfiniteTable({ data }) {
|
|
|
152
147
|
}
|
|
153
148
|
```
|
|
154
149
|
|
|
155
|
-
## Virtualization for Large Datasets
|
|
156
|
-
|
|
157
|
-
For datasets with 1000+ rows, use true virtualization:
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
import { VirtualDataGrid } from "@versini/ui-datagrid/virtual";
|
|
161
|
-
|
|
162
|
-
function MyVirtualTable({ data }) {
|
|
163
|
-
return (
|
|
164
|
-
<VirtualDataGrid
|
|
165
|
-
data={data}
|
|
166
|
-
height="500px"
|
|
167
|
-
columns={[
|
|
168
|
-
{ id: "name", header: "Name", cell: (item) => item.name },
|
|
169
|
-
{ id: "email", header: "Email", cell: (item) => item.email },
|
|
170
|
-
{ id: "date", header: "Date", cell: (item) => formatDate(item.date) }
|
|
171
|
-
]}
|
|
172
|
-
getRowKey={(item) => item.id}
|
|
173
|
-
estimateSize={48}
|
|
174
|
-
overscan={10}
|
|
175
|
-
/>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
150
|
## Sorting
|
|
181
151
|
|
|
182
152
|
```tsx
|
|
@@ -279,16 +249,6 @@ function MySortableTable({ data }) {
|
|
|
279
249
|
| `threshold` | `number` | `5` | Items before end to trigger load |
|
|
280
250
|
| `rootMargin` | `string` | `'20px'` | IntersectionObserver margin |
|
|
281
251
|
|
|
282
|
-
### VirtualDataGrid
|
|
283
|
-
|
|
284
|
-
| Prop | Type | Default | Description |
|
|
285
|
-
| -------------- | ---------------------------- | ------------ | ------------------------------- |
|
|
286
|
-
| `data` | `T[]` | **required** | Array of data items |
|
|
287
|
-
| `columns` | `VirtualDataGridColumn<T>[]` | **required** | Column definitions |
|
|
288
|
-
| `height` | `string \| number` | **required** | Container height |
|
|
289
|
-
| `estimateSize` | `number` | `40` | Estimated row height |
|
|
290
|
-
| `overscan` | `number` | `5` | Rows to render outside viewport |
|
|
291
|
-
|
|
292
252
|
## License
|
|
293
253
|
|
|
294
254
|
MIT
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -35,14 +35,16 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
35
35
|
wrapperClassName,
|
|
36
36
|
stickyHeader,
|
|
37
37
|
stickyFooter,
|
|
38
|
-
disabled
|
|
38
|
+
disabled,
|
|
39
|
+
hasCaption: Boolean(caption)
|
|
39
40
|
}), [
|
|
40
41
|
mode,
|
|
41
42
|
className,
|
|
42
43
|
wrapperClassName,
|
|
43
44
|
stickyHeader,
|
|
44
45
|
stickyFooter,
|
|
45
|
-
disabled
|
|
46
|
+
disabled,
|
|
47
|
+
caption
|
|
46
48
|
]);
|
|
47
49
|
const contextValue = useMemo(()=>({
|
|
48
50
|
mode,
|
|
@@ -50,14 +52,16 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
50
52
|
stickyHeader,
|
|
51
53
|
stickyFooter,
|
|
52
54
|
blurEffect,
|
|
53
|
-
disabled
|
|
55
|
+
disabled,
|
|
56
|
+
hasCaption: Boolean(caption)
|
|
54
57
|
}), [
|
|
55
58
|
mode,
|
|
56
59
|
compact,
|
|
57
60
|
stickyHeader,
|
|
58
61
|
stickyFooter,
|
|
59
62
|
blurEffect,
|
|
60
|
-
disabled
|
|
63
|
+
disabled,
|
|
64
|
+
caption
|
|
61
65
|
]);
|
|
62
66
|
const wrapperStyle = maxHeight ? {
|
|
63
67
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
@@ -67,6 +71,13 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
67
71
|
* wrapper has overflow-hidden - Scrollable content area in the middle with
|
|
68
72
|
* padding - Header/footer are absolutely positioned.
|
|
69
73
|
*/ const hasSticky = stickyHeader || stickyFooter;
|
|
74
|
+
const gridContent = /*#__PURE__*/ jsx("div", {
|
|
75
|
+
role: "grid",
|
|
76
|
+
className: classes.grid,
|
|
77
|
+
"aria-labelledby": caption ? captionId : undefined,
|
|
78
|
+
...rest,
|
|
79
|
+
children: children
|
|
80
|
+
});
|
|
70
81
|
return /*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
71
82
|
value: contextValue,
|
|
72
83
|
children: /*#__PURE__*/ jsxs("div", {
|
|
@@ -91,38 +102,21 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
91
102
|
})
|
|
92
103
|
]
|
|
93
104
|
}),
|
|
94
|
-
/*#__PURE__*/
|
|
105
|
+
/*#__PURE__*/ jsxs("div", {
|
|
95
106
|
className: classes.wrapper,
|
|
96
107
|
style: wrapperStyle,
|
|
97
|
-
children:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}),
|
|
110
|
-
children
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
}) : /*#__PURE__*/ jsxs("table", {
|
|
114
|
-
className: classes.table,
|
|
115
|
-
"aria-describedby": caption ? captionId : undefined,
|
|
116
|
-
...rest,
|
|
117
|
-
children: [
|
|
118
|
-
caption && /*#__PURE__*/ jsx("caption", {
|
|
119
|
-
id: captionId,
|
|
120
|
-
className: classes.caption,
|
|
121
|
-
children: caption
|
|
122
|
-
}),
|
|
123
|
-
children
|
|
124
|
-
]
|
|
125
|
-
})
|
|
108
|
+
children: [
|
|
109
|
+
caption && /*#__PURE__*/ jsx("div", {
|
|
110
|
+
id: captionId,
|
|
111
|
+
className: classes.caption,
|
|
112
|
+
children: caption
|
|
113
|
+
}),
|
|
114
|
+
hasSticky ? /*#__PURE__*/ jsx("div", {
|
|
115
|
+
className: classes.scrollableContent,
|
|
116
|
+
style: wrapperStyle,
|
|
117
|
+
children: gridContent
|
|
118
|
+
}) : gridContent
|
|
119
|
+
]
|
|
126
120
|
})
|
|
127
121
|
]
|
|
128
122
|
})
|
package/dist/DataGrid/index.js
CHANGED
|
@@ -5,17 +5,24 @@ import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridCo
|
|
|
5
5
|
export declare const getStickyBlurClasses: ({ blurEffect, }: {
|
|
6
6
|
blurEffect?: BlurEffect;
|
|
7
7
|
}) => string;
|
|
8
|
+
export declare const getCaptionBackgroundClasses: ({ mode }: {
|
|
9
|
+
mode: ThemeMode;
|
|
10
|
+
}) => string;
|
|
11
|
+
export declare const getCaptionCopyClasses: ({ mode }: {
|
|
12
|
+
mode: ThemeMode;
|
|
13
|
+
}) => string;
|
|
8
14
|
/**
|
|
9
|
-
* Generates classes for the main DataGrid wrapper and
|
|
15
|
+
* Generates classes for the main DataGrid wrapper and grid. When sticky
|
|
10
16
|
* header/footer is enabled, uses the Panel-like approach:
|
|
11
17
|
* - Outer wrapper has overflow-hidden
|
|
12
18
|
* - Scrollable area is a separate inner container
|
|
13
19
|
* - Header/footer are absolutely positioned overlays
|
|
14
20
|
*/
|
|
15
|
-
export declare const getDataGridClasses: ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, }: {
|
|
21
|
+
export declare const getDataGridClasses: ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, hasCaption, }: {
|
|
16
22
|
mode: ThemeMode;
|
|
17
23
|
className?: string;
|
|
18
24
|
disabled?: boolean;
|
|
25
|
+
hasCaption?: boolean;
|
|
19
26
|
stickyFooter?: boolean;
|
|
20
27
|
stickyHeader?: boolean;
|
|
21
28
|
wrapperClassName?: string;
|
|
@@ -29,8 +36,9 @@ export declare const getDataGridClasses: ({ mode, className, wrapperClassName, s
|
|
|
29
36
|
* Scrollable content area - like Panel's scrollableContent Has padding to
|
|
30
37
|
* make room for absolutely positioned header/footer rounded-[inherit] clips
|
|
31
38
|
* the scrollbar at the rounded corners.
|
|
39
|
+
* When there's a caption, add extra padding for caption (~36px) + header (~40px).
|
|
32
40
|
*/
|
|
33
41
|
scrollableContent: string;
|
|
34
|
-
|
|
42
|
+
grid: string;
|
|
35
43
|
caption: string;
|
|
36
44
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -44,13 +44,29 @@ import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
|
44
44
|
"backdrop-blur-lg": blurEffect === BlurEffects.LARGE
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
+
const getCaptionBackgroundClasses = ({ mode })=>{
|
|
48
|
+
return clsx({
|
|
49
|
+
"bg-surface-darker": mode === "dark" || mode === "system",
|
|
50
|
+
"bg-surface-light": mode === "light" || mode === "alt-system",
|
|
51
|
+
"dark:bg-surface-light": mode === "system",
|
|
52
|
+
"dark:bg-surface-darker": mode === "alt-system"
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const getCaptionCopyClasses = ({ mode })=>{
|
|
56
|
+
return clsx({
|
|
57
|
+
"text-copy-light": mode === "dark",
|
|
58
|
+
"text-copy-dark": mode === "light",
|
|
59
|
+
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
60
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
61
|
+
});
|
|
62
|
+
};
|
|
47
63
|
/**
|
|
48
|
-
* Generates classes for the main DataGrid wrapper and
|
|
64
|
+
* Generates classes for the main DataGrid wrapper and grid. When sticky
|
|
49
65
|
* header/footer is enabled, uses the Panel-like approach:
|
|
50
66
|
* - Outer wrapper has overflow-hidden
|
|
51
67
|
* - Scrollable area is a separate inner container
|
|
52
68
|
* - Header/footer are absolutely positioned overlays
|
|
53
|
-
*/ const getDataGridClasses = ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled })=>{
|
|
69
|
+
*/ const getDataGridClasses = ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, hasCaption })=>{
|
|
54
70
|
const overlayClasses = disabled ? getOverlayClasses({
|
|
55
71
|
mode
|
|
56
72
|
}) : null;
|
|
@@ -77,23 +93,27 @@ import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
|
77
93
|
* Scrollable content area - like Panel's scrollableContent Has padding to
|
|
78
94
|
* make room for absolutely positioned header/footer rounded-[inherit] clips
|
|
79
95
|
* the scrollbar at the rounded corners.
|
|
96
|
+
* When there's a caption, add extra padding for caption (~36px) + header (~40px).
|
|
80
97
|
*/ scrollableContent: clsx("overflow-y-auto overflow-x-hidden rounded-[inherit]", {
|
|
81
|
-
"pt-10": stickyHeader,
|
|
98
|
+
"pt-10": stickyHeader && !hasCaption,
|
|
99
|
+
"pt-19": stickyHeader && hasCaption,
|
|
82
100
|
"pb-10": stickyFooter
|
|
83
101
|
}),
|
|
84
|
-
|
|
102
|
+
grid: clsx("my-0 w-full text-left text-sm flex flex-col", className, {
|
|
85
103
|
"text-copy-light": mode === "dark",
|
|
86
104
|
"text-copy-dark": mode === "light",
|
|
87
105
|
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
88
106
|
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
89
107
|
}),
|
|
90
|
-
caption: clsx("py-2 text-sm font-bold", {
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})
|
|
108
|
+
caption: clsx("py-2 text-sm text-center font-bold", {
|
|
109
|
+
// When stickyHeader is enabled, caption is absolutely positioned at top
|
|
110
|
+
"absolute left-0 right-0 z-20 top-0 rounded-t-lg": stickyHeader
|
|
111
|
+
}, getCaptionBackgroundClasses({
|
|
112
|
+
mode
|
|
113
|
+
}), getCaptionCopyClasses({
|
|
114
|
+
mode
|
|
115
|
+
}))
|
|
96
116
|
};
|
|
97
117
|
};
|
|
98
118
|
|
|
99
|
-
export { getDataGridClasses, getStickyBlurClasses };
|
|
119
|
+
export { getCaptionBackgroundClasses, getCaptionCopyClasses, getDataGridClasses, getStickyBlurClasses };
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import clsx from "clsx";
|
|
7
8
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
8
9
|
import { CellWrapper } from "../DataGridConstants/index.js";
|
|
9
10
|
|
|
10
11
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
11
12
|
|
|
13
|
+
;// CONCATENATED MODULE: external "clsx"
|
|
14
|
+
|
|
12
15
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
13
16
|
|
|
14
17
|
;// CONCATENATED MODULE: external "../DataGridConstants/index.js"
|
|
@@ -17,6 +20,7 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
23
|
+
|
|
20
24
|
/* =============================================================================
|
|
21
25
|
* DataGridBody
|
|
22
26
|
* ========================================================================== */ const DataGridBody = ({ className, children, ...rest })=>{
|
|
@@ -26,8 +30,9 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
26
30
|
...ctx,
|
|
27
31
|
cellWrapper: CellWrapper.BODY
|
|
28
32
|
},
|
|
29
|
-
children: /*#__PURE__*/ jsx("
|
|
30
|
-
|
|
33
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
34
|
+
role: "rowgroup",
|
|
35
|
+
className: clsx("flex flex-col", className),
|
|
31
36
|
...rest,
|
|
32
37
|
children: children
|
|
33
38
|
})
|
|
@@ -7,8 +7,5 @@ export declare const getCellClasses: ({ cellWrapper, className, compact, align,
|
|
|
7
7
|
compact?: boolean;
|
|
8
8
|
align?: "left" | "center" | "right";
|
|
9
9
|
active?: boolean;
|
|
10
|
-
}) =>
|
|
11
|
-
|
|
12
|
-
alignClasses: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const DataGridCell: ({ className, children, align, active, component, ...rest }: DataGridCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
}) => string;
|
|
11
|
+
export declare const DataGridCell: ({ className, children, align, active, colSpan, style, ...rest }: DataGridCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -27,6 +27,11 @@ const getCellClasses = ({ cellWrapper, className, compact, align, active, mode }
|
|
|
27
27
|
{
|
|
28
28
|
"px-2 py-1": compact,
|
|
29
29
|
"px-4 py-3": !compact
|
|
30
|
+
}, // Text alignment.
|
|
31
|
+
{
|
|
32
|
+
"text-left": align === "left" || !align,
|
|
33
|
+
"text-center": align === "center",
|
|
34
|
+
"text-right": align === "right"
|
|
30
35
|
}, // Header/footer specific styles.
|
|
31
36
|
{
|
|
32
37
|
"font-semibold": isHeader
|
|
@@ -38,22 +43,22 @@ const getCellClasses = ({ cellWrapper, className, compact, align, active, mode }
|
|
|
38
43
|
"before:bg-table-active-dark dark:before:bg-table-active-light": active && mode === "system",
|
|
39
44
|
"before:bg-table-active-light dark:before:bg-table-active-dark": active && mode === "alt-system"
|
|
40
45
|
}, className);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return mainClasses;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Returns the appropriate ARIA role for the cell based on the cell wrapper type.
|
|
50
|
+
*/ const getCellRole = (cellWrapper)=>{
|
|
51
|
+
if (cellWrapper === CellWrapper.HEADER) {
|
|
52
|
+
return "columnheader";
|
|
53
|
+
}
|
|
54
|
+
return "gridcell";
|
|
50
55
|
};
|
|
51
56
|
/* =============================================================================
|
|
52
57
|
* DataGridCell
|
|
53
|
-
* ========================================================================== */ const DataGridCell = ({ className, children, align, active,
|
|
58
|
+
* ========================================================================== */ const DataGridCell = ({ className, children, align, active, colSpan, style, ...rest })=>{
|
|
54
59
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
55
60
|
children: ({ mode, compact, cellWrapper })=>{
|
|
56
|
-
const
|
|
61
|
+
const mainClasses = getCellClasses({
|
|
57
62
|
cellWrapper,
|
|
58
63
|
className,
|
|
59
64
|
mode,
|
|
@@ -61,14 +66,18 @@ const getCellClasses = ({ cellWrapper, className, compact, align, active, mode }
|
|
|
61
66
|
align,
|
|
62
67
|
active
|
|
63
68
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
69
|
+
const role = getCellRole(cellWrapper);
|
|
70
|
+
// Apply grid-column span for colSpan > 1
|
|
71
|
+
const cellStyle = colSpan && colSpan > 1 ? {
|
|
72
|
+
...style,
|
|
73
|
+
gridColumn: `span ${colSpan}`
|
|
74
|
+
} : style;
|
|
75
|
+
return /*#__PURE__*/ jsx("div", {
|
|
76
|
+
role: role,
|
|
66
77
|
className: mainClasses,
|
|
78
|
+
style: cellStyle,
|
|
67
79
|
...rest,
|
|
68
|
-
children:
|
|
69
|
-
className: alignClasses,
|
|
70
|
-
children: children
|
|
71
|
-
})
|
|
80
|
+
children: children
|
|
72
81
|
});
|
|
73
82
|
}
|
|
74
83
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataGridCellSortProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
export declare const DataGridCellSort: ({ className, children, cellId, onSort, sortDirection, sortedCell, slotLeft, slotRight, buttonClassName, focusMode, ...rest }: DataGridCellSortProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DataGridCellSort: ({ className, children, cellId, onSort, sortDirection, sortedCell, slotLeft, slotRight, buttonClassName, focusMode, align, ...rest }: DataGridCellSortProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { ButtonSort_private } from "@versini/ui-button/private";
|
|
8
8
|
import { IconSort, IconSortDown, IconSortUp } from "@versini/ui-icons";
|
|
9
|
+
import clsx from "clsx";
|
|
9
10
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
10
11
|
import { getCellClasses } from "../DataGridCell/DataGridCell.js";
|
|
11
|
-
import { CellWrapper } from "../DataGridConstants/index.js";
|
|
12
12
|
|
|
13
13
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
14
14
|
|
|
@@ -16,12 +16,12 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
16
16
|
|
|
17
17
|
;// CONCATENATED MODULE: external "@versini/ui-icons"
|
|
18
18
|
|
|
19
|
+
;// CONCATENATED MODULE: external "clsx"
|
|
20
|
+
|
|
19
21
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
20
22
|
|
|
21
23
|
;// CONCATENATED MODULE: external "../DataGridCell/DataGridCell.js"
|
|
22
24
|
|
|
23
|
-
;// CONCATENATED MODULE: external "../DataGridConstants/index.js"
|
|
24
|
-
|
|
25
25
|
;// CONCATENATED MODULE: ./src/DataGridCellSort/DataGridCellSort.tsx
|
|
26
26
|
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
31
31
|
|
|
32
32
|
/* =============================================================================
|
|
33
33
|
* DataGridCellSort
|
|
34
|
-
* ========================================================================== */ const DataGridCellSort = ({ className, children, cellId, onSort, sortDirection, sortedCell, slotLeft, slotRight, buttonClassName, focusMode = "alt-system", ...rest })=>{
|
|
34
|
+
* ========================================================================== */ const DataGridCellSort = ({ className, children, cellId, onSort, sortDirection, sortedCell, slotLeft, slotRight, buttonClassName, focusMode = "alt-system", align, ...rest })=>{
|
|
35
35
|
const isSorted = sortedCell === cellId;
|
|
36
36
|
const handleSort = ()=>{
|
|
37
37
|
if (onSort) {
|
|
@@ -69,20 +69,26 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
69
69
|
};
|
|
70
70
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
71
71
|
children: ({ mode, compact, cellWrapper })=>{
|
|
72
|
-
const
|
|
72
|
+
const mainClasses = getCellClasses({
|
|
73
73
|
cellWrapper,
|
|
74
74
|
className,
|
|
75
75
|
mode,
|
|
76
|
-
compact
|
|
76
|
+
compact,
|
|
77
|
+
align
|
|
78
|
+
});
|
|
79
|
+
// Flex container for alignment of button within the cell
|
|
80
|
+
const contentClasses = clsx("flex", {
|
|
81
|
+
"justify-start": align === "left" || !align,
|
|
82
|
+
"justify-center": align === "center",
|
|
83
|
+
"justify-end": align === "right"
|
|
77
84
|
});
|
|
78
|
-
|
|
79
|
-
return /*#__PURE__*/ jsx(Component, {
|
|
85
|
+
return /*#__PURE__*/ jsx("div", {
|
|
80
86
|
className: mainClasses,
|
|
81
87
|
role: "columnheader",
|
|
82
88
|
"aria-sort": getAriaSort(),
|
|
83
89
|
...rest,
|
|
84
90
|
children: /*#__PURE__*/ jsxs("div", {
|
|
85
|
-
className:
|
|
91
|
+
className: contentClasses,
|
|
86
92
|
children: [
|
|
87
93
|
slotLeft,
|
|
88
94
|
/*#__PURE__*/ jsx(ButtonSort_private, {
|
|
@@ -92,7 +98,6 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
92
98
|
noBorder: true,
|
|
93
99
|
focusMode: focusMode,
|
|
94
100
|
mode: mode,
|
|
95
|
-
fullWidth: true,
|
|
96
101
|
labelRight: children,
|
|
97
102
|
children: getSortIcon()
|
|
98
103
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.1.
|
|
2
|
+
@versini/ui-datagrid v0.1.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -29,7 +29,7 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
29
29
|
* Generates classes for the DataGridFooter.
|
|
30
30
|
*/ const getFooterClasses = ({ className, stickyFooter, mode, blurEffect })=>{
|
|
31
31
|
const hasBlur = blurEffect && blurEffect !== BlurEffects.NONE;
|
|
32
|
-
return clsx({
|
|
32
|
+
return clsx("flex flex-col", {
|
|
33
33
|
/**
|
|
34
34
|
* Absolute positioning like Panel's footer: absolute left-0 right-0 z-20
|
|
35
35
|
* bottom-0 rounded-b-lg to match the wrapper's rounded-lg corners.
|
|
@@ -63,7 +63,8 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
63
63
|
...ctx,
|
|
64
64
|
cellWrapper: CellWrapper.FOOTER
|
|
65
65
|
},
|
|
66
|
-
children: /*#__PURE__*/ jsx("
|
|
66
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
67
|
+
role: "rowgroup",
|
|
67
68
|
className: getFooterClasses({
|
|
68
69
|
className,
|
|
69
70
|
stickyFooter,
|
|
@@ -4,10 +4,11 @@ import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridCo
|
|
|
4
4
|
* Generates classes for the DataGridHeader. Uses absolute positioning like
|
|
5
5
|
* Panel - header floats above the scrollable content.
|
|
6
6
|
*/
|
|
7
|
-
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect, }: {
|
|
7
|
+
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect, hasCaption, }: {
|
|
8
8
|
mode: ThemeMode;
|
|
9
9
|
blurEffect?: BlurEffect;
|
|
10
10
|
className?: string;
|
|
11
|
+
hasCaption?: boolean;
|
|
11
12
|
stickyHeader?: boolean;
|
|
12
13
|
}) => string;
|
|
13
14
|
export declare const DataGridHeader: ({ className, children, ...rest }: DataGridHeaderProps) => import("react/jsx-runtime").JSX.Element;
|