@versini/ui-datagrid 1.0.3 → 1.1.0
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/131.js +3 -4
- package/dist/298.js +1 -1
- package/dist/46.js +1 -1
- package/dist/511.js +1 -1
- package/dist/926.js +1 -1
- package/dist/DataGrid/DataGridTypes.d.ts +18 -1
- package/dist/DataGrid/index.js +1 -1
- package/dist/DataGridAnimated/index.js +1 -1
- package/dist/DataGridBody/DataGridBody.d.ts +1 -1
- package/dist/DataGridBody/getBodyClass.d.ts +0 -1
- package/dist/DataGridBody/index.js +17 -4
- package/dist/DataGridBody/useColumnMeasurement.d.ts +1 -1
- package/dist/DataGridCell/index.js +1 -1
- package/dist/DataGridCellSort/index.js +1 -1
- package/dist/DataGridConstants/index.js +1 -1
- package/dist/DataGridFooter/index.js +1 -1
- package/dist/DataGridHeader/index.js +1 -1
- package/dist/DataGridInfinite/index.js +1 -1
- package/dist/DataGridRow/index.js +1 -1
- package/dist/DataGridSorting/index.js +1 -1
- package/package.json +2 -2
package/dist/131.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v1.0
|
|
2
|
+
@versini/ui-datagrid v1.1.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -13,7 +13,6 @@ import { useRef, useContext, useLayoutEffect } from "./511.js";
|
|
|
13
13
|
* are provided, or define their own grid otherwise.
|
|
14
14
|
*
|
|
15
15
|
* @param className - Additional class name to merge
|
|
16
|
-
*
|
|
17
16
|
*/ function getBodyClass(className) {
|
|
18
17
|
return clsx("contents", className);
|
|
19
18
|
}
|
|
@@ -54,14 +53,14 @@ import { useRef, useContext, useLayoutEffect } from "./511.js";
|
|
|
54
53
|
* @param bodyRef - Ref to the body element containing the rows
|
|
55
54
|
* @param contentDependency - Dependency that changes when content changes (children or renderedContent)
|
|
56
55
|
*
|
|
57
|
-
*/ function useColumnMeasurement(bodyRef, contentDependency) {
|
|
56
|
+
*/ function useColumnMeasurement(bodyRef, contentDependency, noData = false) {
|
|
58
57
|
const ctx = useContext(DataGridContext);
|
|
59
58
|
const prevWidthsRef = useRef([]);
|
|
60
59
|
// biome-ignore lint/correctness/useExhaustiveDependencies: contentDependency triggers remeasurement when rows change
|
|
61
60
|
useLayoutEffect(()=>{
|
|
62
61
|
const element = bodyRef.current;
|
|
63
62
|
const needsMeasurement = ctx.columns && (ctx.stickyHeader || ctx.stickyFooter);
|
|
64
|
-
if (!element || !needsMeasurement || !ctx.setMeasuredColumnWidths) {
|
|
63
|
+
if (noData || !element || !needsMeasurement || !ctx.setMeasuredColumnWidths) {
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
66
|
const firstRow = element.querySelector('[role="row"]');
|
package/dist/298.js
CHANGED
package/dist/46.js
CHANGED
package/dist/511.js
CHANGED
package/dist/926.js
CHANGED
|
@@ -99,11 +99,28 @@ export type DataGridHeaderProps = {
|
|
|
99
99
|
*/
|
|
100
100
|
className?: string;
|
|
101
101
|
} & React.HTMLAttributes<HTMLDivElement>;
|
|
102
|
-
export type DataGridBodyProps = {
|
|
102
|
+
export type DataGridBodyProps = ({
|
|
103
|
+
/**
|
|
104
|
+
* If true, applies styles for an empty state (e.g. removing extra row borders).
|
|
105
|
+
* Used when there are no rows to display.
|
|
106
|
+
*/
|
|
107
|
+
noData: true;
|
|
108
|
+
/**
|
|
109
|
+
* The content of the body (DataGridRow elements).
|
|
110
|
+
*/
|
|
111
|
+
children?: React.ReactNode;
|
|
112
|
+
} | {
|
|
113
|
+
/**
|
|
114
|
+
* If true, applies styles for an empty state (e.g. removing extra row borders).
|
|
115
|
+
* Used when there are no rows to display.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
noData?: false;
|
|
103
119
|
/**
|
|
104
120
|
* The content of the body (DataGridRow elements).
|
|
105
121
|
*/
|
|
106
122
|
children: React.ReactNode;
|
|
123
|
+
}) & {
|
|
107
124
|
/**
|
|
108
125
|
* CSS class to apply to the body.
|
|
109
126
|
*/
|
package/dist/DataGrid/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataGridBodyProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
export declare const DataGridBody: ({ className, children, ...rest }: DataGridBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DataGridBody: ({ className, children, noData, ...rest }: DataGridBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v1.0
|
|
2
|
+
@versini/ui-datagrid v1.1.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,11 +16,11 @@ import { CellWrapper } from "../46.js";
|
|
|
16
16
|
|
|
17
17
|
/* =============================================================================
|
|
18
18
|
* DataGridBody
|
|
19
|
-
* ========================================================================== */ const DataGridBody = ({ className, children, ...rest })=>{
|
|
19
|
+
* ========================================================================== */ const DataGridBody = ({ className, children, noData = false, ...rest })=>{
|
|
20
20
|
const ctx = useContext(DataGridContext);
|
|
21
21
|
const bodyRef = useRef(null);
|
|
22
22
|
// Measure column widths for sticky header/footer sync.
|
|
23
|
-
useColumnMeasurement(bodyRef, children);
|
|
23
|
+
useColumnMeasurement(bodyRef, children, noData);
|
|
24
24
|
const bodyClass = getBodyClass(className);
|
|
25
25
|
return /*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
26
26
|
value: {
|
|
@@ -32,7 +32,20 @@ import { CellWrapper } from "../46.js";
|
|
|
32
32
|
role: "rowgroup",
|
|
33
33
|
className: bodyClass,
|
|
34
34
|
...rest,
|
|
35
|
-
children:
|
|
35
|
+
children: noData ? /*#__PURE__*/ jsx("div", {
|
|
36
|
+
role: "row",
|
|
37
|
+
style: {
|
|
38
|
+
gridColumn: "1 / -1"
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
41
|
+
role: "gridcell",
|
|
42
|
+
style: {
|
|
43
|
+
textAlign: "center",
|
|
44
|
+
width: "100%"
|
|
45
|
+
},
|
|
46
|
+
children: children ?? "No Data"
|
|
47
|
+
})
|
|
48
|
+
}) : children
|
|
36
49
|
})
|
|
37
50
|
});
|
|
38
51
|
};
|
|
@@ -23,4 +23,4 @@ export declare function quantizeWidthToDevicePixels(width: number, devicePixelRa
|
|
|
23
23
|
* @param contentDependency - Dependency that changes when content changes (children or renderedContent)
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
export declare function useColumnMeasurement(bodyRef: React.RefObject<HTMLDivElement | null>, contentDependency: unknown): void;
|
|
26
|
+
export declare function useColumnMeasurement(bodyRef: React.RefObject<HTMLDivElement | null>, contentDependency: unknown, noData?: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-datagrid",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"sideEffects": [
|
|
99
99
|
"**/*.css"
|
|
100
100
|
],
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "11ae5b5a3443d0160d12ae42584aead403fdf58f"
|
|
102
102
|
}
|