@versini/ui-datagrid 0.3.7 → 0.3.8
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/DataGrid/DataGrid.js +7 -7
- package/dist/DataGrid/DataGridContext.js +1 -1
- package/dist/DataGrid/index.js +1 -1
- 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 +13 -11
- package/dist/DataGridBody/index.js +1 -1
- package/dist/DataGridCell/DataGridCell.d.ts +0 -10
- package/dist/DataGridCell/DataGridCell.js +4 -58
- package/dist/DataGridCell/index.js +1 -1
- package/dist/DataGridCellSort/DataGridCellSort.js +3 -3
- 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.d.ts +0 -15
- package/dist/DataGridFooter/DataGridFooter.js +6 -42
- package/dist/DataGridFooter/index.js +1 -1
- package/dist/DataGridHeader/DataGridHeader.d.ts +0 -27
- package/dist/DataGridHeader/DataGridHeader.js +6 -54
- package/dist/DataGridHeader/index.js +1 -1
- package/dist/DataGridInfinite/InfiniteScrollMarker.js +1 -1
- package/dist/DataGridInfinite/index.js +1 -1
- package/dist/DataGridInfinite/useInfiniteScroll.js +1 -1
- package/dist/DataGridRow/DataGridRow.js +10 -34
- package/dist/DataGridRow/index.js +1 -1
- package/dist/DataGridSorting/index.js +1 -1
- package/dist/DataGridSorting/sortingUtils.js +1 -1
- package/dist/utilities/classes.d.ts +150 -0
- package/dist/utilities/classes.js +249 -0
- package/package.json +2 -2
- package/dist/DataGrid/utilities.d.ts +0 -44
- package/dist/DataGrid/utilities.js +0 -92
- package/dist/common/utilities.d.ts +0 -15
- package/dist/common/utilities.js +0 -48
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useCallback, useMemo, useState } from "react";
|
|
8
8
|
import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
9
|
+
import { getDataGridClasses } from "../utilities/classes.js";
|
|
9
10
|
import { DataGridContext } from "./DataGridContext.js";
|
|
10
|
-
import { getDataGridClasses } from "./utilities.js";
|
|
11
11
|
|
|
12
12
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
13
13
|
|
|
@@ -15,9 +15,9 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
15
15
|
|
|
16
16
|
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
17
17
|
|
|
18
|
-
;// CONCATENATED MODULE: external "
|
|
18
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
19
19
|
|
|
20
|
-
;// CONCATENATED MODULE: external "./
|
|
20
|
+
;// CONCATENATED MODULE: external "./DataGridContext.js"
|
|
21
21
|
|
|
22
22
|
;// CONCATENATED MODULE: ./src/DataGrid/DataGrid.tsx
|
|
23
23
|
|
|
@@ -42,9 +42,9 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
42
42
|
*/ const [headerHeight, setHeaderHeight] = useState(0);
|
|
43
43
|
const [footerHeight, setFooterHeight] = useState(0);
|
|
44
44
|
/**
|
|
45
|
-
* Track measured column widths from the body. Used by sticky header/footer
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* Track measured column widths from the body. Used by sticky header/footer to
|
|
46
|
+
* sync column widths since absolutely positioned elements can't use CSS
|
|
47
|
+
* subgrid.
|
|
48
48
|
*/ const [measuredColumnWidths, setMeasuredColumnWidths] = useState([]);
|
|
49
49
|
/**
|
|
50
50
|
* Registration callbacks with stable references. Called by
|
package/dist/DataGrid/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -32,17 +32,19 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
32
32
|
const bodyRef = useRef(null);
|
|
33
33
|
/**
|
|
34
34
|
* Measure column widths from the first body row's cells. This is needed
|
|
35
|
-
* because sticky header/footer are absolutely positioned and can't use
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* because sticky header/footer are absolutely positioned and can't use CSS
|
|
36
|
+
* subgrid. We measure the body cells (which ARE in the grid flow) and report
|
|
37
|
+
* the widths so header/footer can use the same pixel values.
|
|
38
38
|
*/ useLayoutEffect(()=>{
|
|
39
39
|
const element = bodyRef.current;
|
|
40
40
|
const needsMeasurement = ctx.columns && (ctx.stickyHeader || ctx.stickyFooter);
|
|
41
41
|
if (!element || !needsMeasurement || !ctx.setMeasuredColumnWidths) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Find the first row and its cells once, reuse for both measurement and
|
|
46
|
+
* observation.
|
|
47
|
+
*/ const firstRow = element.querySelector('[role="row"]');
|
|
46
48
|
if (!firstRow) {
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
@@ -51,19 +53,19 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
const measureColumns = ()=>{
|
|
54
|
-
// Measure each cell's width
|
|
56
|
+
// Measure each cell's width.
|
|
55
57
|
const widths = Array.from(cells).map((cell)=>cell.getBoundingClientRect().width);
|
|
56
58
|
ctx.setMeasuredColumnWidths?.(widths);
|
|
57
59
|
};
|
|
58
|
-
// Initial measurement
|
|
60
|
+
// Initial measurement.
|
|
59
61
|
measureColumns();
|
|
60
|
-
// Set up ResizeObserver to re-measure when cells resize
|
|
62
|
+
// Set up ResizeObserver to re-measure when cells resize.
|
|
61
63
|
const observer = new ResizeObserver(()=>{
|
|
62
64
|
measureColumns();
|
|
63
65
|
});
|
|
64
|
-
// Observe the body element for any size changes
|
|
66
|
+
// Observe the body element for any size changes.
|
|
65
67
|
observer.observe(element);
|
|
66
|
-
// Also observe the first row's cells directly for more accurate updates
|
|
68
|
+
// Also observe the first row's cells directly for more accurate updates.
|
|
67
69
|
for (const cell of cells){
|
|
68
70
|
observer.observe(cell);
|
|
69
71
|
}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
import type { DataGridCellProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
import { type CellWrapperType, type ThemeMode } from "../DataGridConstants";
|
|
3
|
-
export declare const getCellClasses: ({ cellWrapper, className, compact, align, mode, borderLeft, borderRight, }: {
|
|
4
|
-
cellWrapper?: CellWrapperType;
|
|
5
|
-
className?: string;
|
|
6
|
-
mode?: ThemeMode;
|
|
7
|
-
compact?: boolean;
|
|
8
|
-
align?: "left" | "center" | "right";
|
|
9
|
-
borderLeft?: boolean;
|
|
10
|
-
borderRight?: boolean;
|
|
11
|
-
}) => string;
|
|
12
2
|
export declare const DataGridCell: ({ className, children, align, borderLeft, borderRight, colSpan, style, ...rest }: DataGridCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,76 +1,22 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { clsx } from "clsx";
|
|
8
7
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
9
|
-
import {
|
|
8
|
+
import { getCellClasses, getCellRole } from "../utilities/classes.js";
|
|
10
9
|
|
|
11
10
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
12
11
|
|
|
13
|
-
;// CONCATENATED MODULE: external "clsx"
|
|
14
|
-
|
|
15
12
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
16
13
|
|
|
17
|
-
;// CONCATENATED MODULE: external "../
|
|
14
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
18
15
|
|
|
19
16
|
;// CONCATENATED MODULE: ./src/DataGridCell/DataGridCell.tsx
|
|
20
17
|
|
|
21
18
|
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
const getCellClasses = ({ cellWrapper, className, compact, align, mode, borderLeft, borderRight })=>{
|
|
25
|
-
const isHeader = cellWrapper === CellWrapper.HEADER;
|
|
26
|
-
const mainClasses = clsx(// Base padding.
|
|
27
|
-
{
|
|
28
|
-
"px-2 py-1": compact,
|
|
29
|
-
"px-4 py-3": !compact
|
|
30
|
-
}, // Text alignment.
|
|
31
|
-
{
|
|
32
|
-
"text-left justify-start": align === "left" || !align,
|
|
33
|
-
"text-center justify-center": align === "center",
|
|
34
|
-
"text-right justify-end": align === "right"
|
|
35
|
-
}, // Header/footer specific styles.
|
|
36
|
-
{
|
|
37
|
-
"font-semibold": isHeader
|
|
38
|
-
}, /**
|
|
39
|
-
* Active row indicator (left border on first cell only).
|
|
40
|
-
* Uses CSS group-data-[active] to detect when parent row has data-active attribute.
|
|
41
|
-
* The `first:` variant ensures only the first cell in the row shows the indicator.
|
|
42
|
-
*/ "first:group-data-[active]:relative", "first:group-data-[active]:before:absolute first:group-data-[active]:before:left-0 first:group-data-[active]:before:top-0 first:group-data-[active]:before:bottom-0 first:group-data-[active]:before:w-1", "first:group-data-[active]:self-stretch first:group-data-[active]:flex first:group-data-[active]:items-center", // Active indicator color based on theme mode.
|
|
43
|
-
{
|
|
44
|
-
"first:group-data-[active]:before:bg-table-active-dark": mode === "dark",
|
|
45
|
-
"first:group-data-[active]:before:bg-table-active-light": mode === "light",
|
|
46
|
-
"first:group-data-[active]:before:bg-table-active-dark dark:first:group-data-[active]:before:bg-table-active-light": mode === "system",
|
|
47
|
-
"first:group-data-[active]:before:bg-table-active-light dark:first:group-data-[active]:before:bg-table-active-dark": mode === "alt-system"
|
|
48
|
-
}, /**
|
|
49
|
-
* Vertical borders. self-stretch ensures border spans full row height in
|
|
50
|
-
* grid layout. When stretching, use flex + items-center to maintain
|
|
51
|
-
* vertical centering of content.
|
|
52
|
-
*/ {
|
|
53
|
-
"self-stretch flex items-center": borderLeft || borderRight,
|
|
54
|
-
"border-l border-l-table-dark": borderLeft && mode === "dark",
|
|
55
|
-
"border-l border-l-table-light": borderLeft && mode === "light",
|
|
56
|
-
"border-l border-l-table-dark dark:border-l-table-light": borderLeft && mode === "system",
|
|
57
|
-
"border-l border-l-table-light dark:border-l-table-dark": borderLeft && mode === "alt-system",
|
|
58
|
-
"border-r border-r-table-dark": borderRight && mode === "dark",
|
|
59
|
-
"border-r border-r-table-light": borderRight && mode === "light",
|
|
60
|
-
"border-r border-r-table-dark dark:border-r-table-light": borderRight && mode === "system",
|
|
61
|
-
"border-r border-r-table-light dark:border-r-table-dark": borderRight && mode === "alt-system"
|
|
62
|
-
}, className);
|
|
63
|
-
return mainClasses;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Returns the appropriate ARIA role for the cell based on the cell wrapper
|
|
67
|
-
* type.
|
|
68
|
-
*/ const getCellRole = (cellWrapper)=>{
|
|
69
|
-
if (cellWrapper === CellWrapper.HEADER) {
|
|
70
|
-
return "columnheader";
|
|
71
|
-
}
|
|
72
|
-
return "gridcell";
|
|
73
|
-
};
|
|
74
20
|
/* =============================================================================
|
|
75
21
|
* DataGridCell
|
|
76
22
|
* ========================================================================== */ const DataGridCell = ({ className, children, align, borderLeft, borderRight, colSpan, style, ...rest })=>{
|
|
@@ -102,4 +48,4 @@ const getCellClasses = ({ cellWrapper, className, compact, align, mode, borderLe
|
|
|
102
48
|
});
|
|
103
49
|
};
|
|
104
50
|
|
|
105
|
-
export { DataGridCell
|
|
51
|
+
export { DataGridCell };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ import { ButtonSort_private } from "@versini/ui-button/private";
|
|
|
8
8
|
import { IconSort, IconSortDown, IconSortUp } from "@versini/ui-icons";
|
|
9
9
|
import clsx from "clsx";
|
|
10
10
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
11
|
-
import { getCellClasses } from "../
|
|
11
|
+
import { getCellClasses } from "../utilities/classes.js";
|
|
12
12
|
|
|
13
13
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ import { getCellClasses } from "../DataGridCell/DataGridCell.js";
|
|
|
20
20
|
|
|
21
21
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
22
22
|
|
|
23
|
-
;// CONCATENATED MODULE: external "../
|
|
23
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
24
24
|
|
|
25
25
|
;// CONCATENATED MODULE: ./src/DataGridCellSort/DataGridCellSort.tsx
|
|
26
26
|
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import type { DataGridFooterProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
3
|
-
/**
|
|
4
|
-
* Generates classes for the DataGridFooter.
|
|
5
|
-
*
|
|
6
|
-
* When columns are provided (subgrid mode), uses display:contents so the footer
|
|
7
|
-
* doesn't break the parent grid flow.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare const getFooterClasses: ({ className, stickyFooter, mode, blurEffect, hasColumns, }: {
|
|
11
|
-
mode: ThemeMode;
|
|
12
|
-
blurEffect?: BlurEffect;
|
|
13
|
-
className?: string;
|
|
14
|
-
hasColumns?: boolean;
|
|
15
|
-
stickyFooter?: boolean;
|
|
16
|
-
}) => string;
|
|
17
2
|
export declare const DataGridFooter: {
|
|
18
3
|
({ className, children, ...rest }: DataGridFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
19
4
|
displayName: string;
|
|
@@ -1,66 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import clsx from "clsx";
|
|
8
7
|
import { useEffect, useLayoutEffect, useRef } from "react";
|
|
9
|
-
import { getHeaderFooterBackgroundClasses, getStickyBlurClasses } from "../common/utilities.js";
|
|
10
8
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
11
|
-
import {
|
|
9
|
+
import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
10
|
+
import { getFooterClasses } from "../utilities/classes.js";
|
|
12
11
|
|
|
13
12
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
14
13
|
|
|
15
|
-
;// CONCATENATED MODULE: external "clsx"
|
|
16
|
-
|
|
17
14
|
;// CONCATENATED MODULE: external "react"
|
|
18
15
|
|
|
19
|
-
;// CONCATENATED MODULE: external "../common/utilities.js"
|
|
20
|
-
|
|
21
16
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
22
17
|
|
|
23
18
|
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
24
19
|
|
|
25
|
-
;// CONCATENATED MODULE:
|
|
20
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
26
21
|
|
|
22
|
+
;// CONCATENATED MODULE: ./src/DataGridFooter/DataGridFooter.tsx
|
|
27
23
|
|
|
28
24
|
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
|
|
32
|
-
/**
|
|
33
|
-
* Generates classes for the DataGridFooter.
|
|
34
|
-
*
|
|
35
|
-
* When columns are provided (subgrid mode), uses display:contents so the footer
|
|
36
|
-
* doesn't break the parent grid flow.
|
|
37
|
-
*
|
|
38
|
-
*/ const getFooterClasses = ({ className, stickyFooter, mode, blurEffect, hasColumns })=>{
|
|
39
|
-
/**
|
|
40
|
-
* When columns are provided and not sticky, use display:contents so the
|
|
41
|
-
* rowgroup doesn't interfere with the grid flow. The rows will use subgrid.
|
|
42
|
-
*/ if (hasColumns && !stickyFooter) {
|
|
43
|
-
return clsx("contents", className);
|
|
44
|
-
}
|
|
45
|
-
const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
|
|
46
|
-
return clsx("flex flex-col", {
|
|
47
|
-
/**
|
|
48
|
-
* Absolute positioning like Panel's footer: absolute left-0 right-0 z-20
|
|
49
|
-
* bottom-0 rounded-b-lg to match the wrapper's rounded-lg corners.
|
|
50
|
-
*/ "absolute left-0 right-0 z-20 bottom-0 rounded-b-lg": stickyFooter,
|
|
51
|
-
// Shadow for visual depth (upward glow).
|
|
52
|
-
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "dark",
|
|
53
|
-
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "system",
|
|
54
|
-
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "light",
|
|
55
|
-
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "alt-system"
|
|
56
|
-
}, getHeaderFooterBackgroundClasses({
|
|
57
|
-
mode,
|
|
58
|
-
hasBlur,
|
|
59
|
-
sticky: Boolean(stickyFooter)
|
|
60
|
-
}), stickyFooter && getStickyBlurClasses({
|
|
61
|
-
blurEffect
|
|
62
|
-
}), className);
|
|
63
|
-
};
|
|
64
28
|
/* =============================================================================
|
|
65
29
|
* DataGridFooter
|
|
66
30
|
* ========================================================================== */ const DataGridFooter = ({ className, children, ...rest })=>{
|
|
@@ -133,4 +97,4 @@ DataGridFooter.displayName = "DataGridFooter";
|
|
|
133
97
|
});
|
|
134
98
|
};
|
|
135
99
|
|
|
136
|
-
export { DataGridFooter
|
|
100
|
+
export { DataGridFooter };
|
|
@@ -1,31 +1,4 @@
|
|
|
1
1
|
import type { DataGridHeaderProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
3
|
-
/**
|
|
4
|
-
* Generates classes for the DataGridHeader wrapper.
|
|
5
|
-
*
|
|
6
|
-
* When stickyHeader is true, uses position:absolute so the header overlays the
|
|
7
|
-
* scrollbar area. The parent DataGrid auto-detects caption presence and applies
|
|
8
|
-
* appropriate padding to the scrollable content.
|
|
9
|
-
*
|
|
10
|
-
* When columns are provided (subgrid mode) and not sticky, uses
|
|
11
|
-
* display:contents so the header doesn't break the parent grid flow.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect, hasColumns, }: {
|
|
15
|
-
mode: ThemeMode;
|
|
16
|
-
blurEffect?: BlurEffect;
|
|
17
|
-
className?: string;
|
|
18
|
-
hasColumns?: boolean;
|
|
19
|
-
stickyHeader?: boolean;
|
|
20
|
-
}) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Generates classes for the caption element inside DataGridHeader. When
|
|
23
|
-
* hasColumns is true (subgrid mode), adds col-span-full to span all columns.
|
|
24
|
-
*/
|
|
25
|
-
export declare const getCaptionClasses: ({ captionClassName, hasColumns, }: {
|
|
26
|
-
captionClassName?: string;
|
|
27
|
-
hasColumns?: boolean;
|
|
28
|
-
}) => string;
|
|
29
2
|
export declare const DataGridHeader: {
|
|
30
3
|
({ caption, captionClassName, className, children, ...rest }: DataGridHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
31
4
|
displayName: string;
|
|
@@ -1,78 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import clsx from "clsx";
|
|
8
7
|
import { useEffect, useId, useLayoutEffect, useRef } from "react";
|
|
9
|
-
import { getHeaderFooterBackgroundClasses, getHeaderFooterCopyClasses, getStickyBlurClasses } from "../common/utilities.js";
|
|
10
8
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
11
|
-
import {
|
|
9
|
+
import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
10
|
+
import { getCaptionClasses, getHeaderClasses } from "../utilities/classes.js";
|
|
12
11
|
|
|
13
12
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
14
13
|
|
|
15
|
-
;// CONCATENATED MODULE: external "clsx"
|
|
16
|
-
|
|
17
14
|
;// CONCATENATED MODULE: external "react"
|
|
18
15
|
|
|
19
|
-
;// CONCATENATED MODULE: external "../common/utilities.js"
|
|
20
|
-
|
|
21
16
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
22
17
|
|
|
23
18
|
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
24
19
|
|
|
25
|
-
;// CONCATENATED MODULE:
|
|
20
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
26
21
|
|
|
22
|
+
;// CONCATENATED MODULE: ./src/DataGridHeader/DataGridHeader.tsx
|
|
27
23
|
|
|
28
24
|
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
|
|
32
|
-
/**
|
|
33
|
-
* Generates classes for the DataGridHeader wrapper.
|
|
34
|
-
*
|
|
35
|
-
* When stickyHeader is true, uses position:absolute so the header overlays the
|
|
36
|
-
* scrollbar area. The parent DataGrid auto-detects caption presence and applies
|
|
37
|
-
* appropriate padding to the scrollable content.
|
|
38
|
-
*
|
|
39
|
-
* When columns are provided (subgrid mode) and not sticky, uses
|
|
40
|
-
* display:contents so the header doesn't break the parent grid flow.
|
|
41
|
-
*
|
|
42
|
-
*/ const getHeaderClasses = ({ className, stickyHeader, mode, blurEffect, hasColumns })=>{
|
|
43
|
-
const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
|
|
44
|
-
/**
|
|
45
|
-
* When columns are provided and not sticky, use display:contents so the
|
|
46
|
-
* rowgroup doesn't interfere with the grid flow. The rows will use subgrid.
|
|
47
|
-
*/ if (hasColumns && !stickyHeader) {
|
|
48
|
-
return clsx("contents", getHeaderFooterBackgroundClasses({
|
|
49
|
-
mode,
|
|
50
|
-
hasBlur,
|
|
51
|
-
sticky: Boolean(stickyHeader)
|
|
52
|
-
}), getHeaderFooterCopyClasses({
|
|
53
|
-
mode
|
|
54
|
-
}), className);
|
|
55
|
-
}
|
|
56
|
-
return clsx("flex flex-col", {
|
|
57
|
-
// Absolute positioning to overlay scrollbar, matching footer behavior.
|
|
58
|
-
"absolute left-0 right-0 z-20 top-0 rounded-t-lg": stickyHeader
|
|
59
|
-
}, getHeaderFooterBackgroundClasses({
|
|
60
|
-
mode,
|
|
61
|
-
hasBlur,
|
|
62
|
-
sticky: Boolean(stickyHeader)
|
|
63
|
-
}), getHeaderFooterCopyClasses({
|
|
64
|
-
mode
|
|
65
|
-
}), stickyHeader && getStickyBlurClasses({
|
|
66
|
-
blurEffect
|
|
67
|
-
}), className);
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Generates classes for the caption element inside DataGridHeader. When
|
|
71
|
-
* hasColumns is true (subgrid mode), adds col-span-full to span all columns.
|
|
72
|
-
*/ const getCaptionClasses = ({ captionClassName, hasColumns })=>{
|
|
73
|
-
return clsx("py-2 text-sm text-center font-bold", // In subgrid mode, caption needs to span all columns.
|
|
74
|
-
hasColumns && "col-span-full", captionClassName);
|
|
75
|
-
};
|
|
76
28
|
/* =============================================================================
|
|
77
29
|
* DataGridHeader
|
|
78
30
|
* ========================================================================== */ const DataGridHeader = ({ caption, captionClassName, className, children, ...rest })=>{
|
|
@@ -174,4 +126,4 @@ DataGridHeader.displayName = "DataGridHeader";
|
|
|
174
126
|
});
|
|
175
127
|
};
|
|
176
128
|
|
|
177
|
-
export { DataGridHeader
|
|
129
|
+
export { DataGridHeader };
|
|
@@ -1,55 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.3.
|
|
2
|
+
@versini/ui-datagrid v0.3.8
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import clsx from "clsx";
|
|
8
7
|
import react from "react";
|
|
9
8
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
10
9
|
import { CellWrapper } from "../DataGridConstants/index.js";
|
|
10
|
+
import { getRowClasses } from "../utilities/classes.js";
|
|
11
11
|
|
|
12
12
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
13
13
|
|
|
14
|
-
;// CONCATENATED MODULE: external "clsx"
|
|
15
|
-
|
|
16
14
|
;// CONCATENATED MODULE: external "react"
|
|
17
15
|
|
|
18
16
|
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
19
17
|
|
|
20
18
|
;// CONCATENATED MODULE: external "../DataGridConstants/index.js"
|
|
21
19
|
|
|
20
|
+
;// CONCATENATED MODULE: external "../utilities/classes.js"
|
|
21
|
+
|
|
22
22
|
;// CONCATENATED MODULE: ./src/DataGridRow/DataGridRow.tsx
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const getRowClasses = ({ mode, className, cellWrapper })=>{
|
|
29
|
-
// Always use CSS Grid for proper column alignment, with vertical centering.
|
|
30
|
-
// `group` enables child cells to use group-data-[active] for active row indicator.
|
|
31
|
-
const layoutClass = "group grid items-center";
|
|
32
|
-
if (cellWrapper === CellWrapper.HEADER || cellWrapper === CellWrapper.FOOTER) {
|
|
33
|
-
/**
|
|
34
|
-
* When in a sticky header/footer, don't apply background to row since the
|
|
35
|
-
* background is applied to the rowgroup for blur effect to work.
|
|
36
|
-
*/ return clsx(layoutClass, className);
|
|
37
|
-
}
|
|
38
|
-
return clsx(layoutClass, "border-b last:border-0", {
|
|
39
|
-
"border-table-dark": mode === "dark" || mode === "system",
|
|
40
|
-
"border-table-light": mode === "light" || mode === "alt-system",
|
|
41
|
-
"dark:border-table-light": mode === "system",
|
|
42
|
-
"dark:border-table-dark": mode === "alt-system",
|
|
43
|
-
"odd:bg-table-dark-odd even:bg-table-dark-even": mode === "dark",
|
|
44
|
-
"hover:bg-table-dark-hover": mode === "dark",
|
|
45
|
-
"odd:bg-table-light-odd even:bg-table-light-even": mode === "light",
|
|
46
|
-
"hover:bg-table-light-hover": mode === "light",
|
|
47
|
-
"odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": mode === "system",
|
|
48
|
-
"hover:bg-table-dark-hover dark:hover:bg-table-light-hover": mode === "system",
|
|
49
|
-
"odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": mode === "alt-system",
|
|
50
|
-
"hover:bg-table-light-hover dark::hover:bg-table-dark-hover": mode === "alt-system"
|
|
51
|
-
}, className);
|
|
52
|
-
};
|
|
53
28
|
/* =============================================================================
|
|
54
29
|
* DataGridRow
|
|
55
30
|
* ========================================================================== */ const DataGridRow = ({ className, children, active, style: userStyle, ...rest })=>{
|
|
@@ -79,11 +54,12 @@ const getRowClasses = ({ mode, className, cellWrapper })=>{
|
|
|
79
54
|
*/ let rowStyle;
|
|
80
55
|
if (columns) {
|
|
81
56
|
if (isInStickyContext) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Sticky elements can't use subgrid. Use measured widths from body if
|
|
59
|
+
* available for perfect alignment. Also check that widths are valid
|
|
60
|
+
* (non-zero) - in test environments or before layout, measurements may be
|
|
61
|
+
* zero.
|
|
62
|
+
*/ const hasValidMeasurements = measuredColumnWidths && measuredColumnWidths.length === columns.length && measuredColumnWidths.some((w)=>w > 0);
|
|
87
63
|
if (hasValidMeasurements) {
|
|
88
64
|
rowStyle = {
|
|
89
65
|
gridTemplateColumns: measuredColumnWidths.map((w)=>`${w}px`).join(" ")
|