@versini/ui-datagrid 1.1.0 → 1.3.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/README.md +11 -1
- package/dist/131.js +1 -1
- 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 +5 -0
- 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/index.js +3 -3
- 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/DataGridInfiniteBody.d.ts +28 -2
- package/dist/DataGridInfinite/index.js +17 -4
- package/dist/DataGridRow/index.js +1 -1
- package/dist/DataGridSorting/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -355,7 +355,15 @@ function MySortableTable({ data }) {
|
|
|
355
355
|
| `captionClassName` | `string` | - | CSS class for the caption element |
|
|
356
356
|
| `className` | `string` | - | CSS class for the header |
|
|
357
357
|
|
|
358
|
-
### DataGridBody
|
|
358
|
+
### DataGridBody
|
|
359
|
+
|
|
360
|
+
| Prop | Type | Default | Description |
|
|
361
|
+
| ------------ | --------- | ------- | -------------------------------------------------- |
|
|
362
|
+
| `noData` | `boolean` | `false` | Display empty state instead of children |
|
|
363
|
+
| `noDataText` | `string` | `'No Data'` | Custom text for the empty state |
|
|
364
|
+
| `className` | `string` | - | CSS class for the element |
|
|
365
|
+
|
|
366
|
+
### DataGridFooter
|
|
359
367
|
|
|
360
368
|
| Prop | Type | Default | Description |
|
|
361
369
|
| ----------- | -------- | ------- | ------------------------- |
|
|
@@ -405,6 +413,8 @@ function MySortableTable({ data }) {
|
|
|
405
413
|
| `threshold` | `number` | `5` | Items before marker to allow seamless scrolling |
|
|
406
414
|
| `rootMargin` | `string` | `'20px'`| IntersectionObserver margin |
|
|
407
415
|
| `onVisibleCountChange` | `(visibleCount: number, total: number) => void` | - | Callback when visible count changes |
|
|
416
|
+
| `noData` | `boolean` | `false` | Display empty state instead of infinite scroll |
|
|
417
|
+
| `noDataText` | `string` | `'No Data'` | Custom text for the empty state |
|
|
408
418
|
| `className` | `string` | - | CSS class for the body element |
|
|
409
419
|
| `ref` | `React.Ref<DataGridInfiniteBodyRef>` | - | Ref to access imperative methods |
|
|
410
420
|
|
package/dist/131.js
CHANGED
package/dist/298.js
CHANGED
package/dist/46.js
CHANGED
package/dist/511.js
CHANGED
package/dist/926.js
CHANGED
|
@@ -109,6 +109,10 @@ export type DataGridBodyProps = ({
|
|
|
109
109
|
* The content of the body (DataGridRow elements).
|
|
110
110
|
*/
|
|
111
111
|
children?: React.ReactNode;
|
|
112
|
+
/**
|
|
113
|
+
* Custom text to display in the empty state. Defaults to "No Data".
|
|
114
|
+
*/
|
|
115
|
+
noDataText?: string;
|
|
112
116
|
} | {
|
|
113
117
|
/**
|
|
114
118
|
* If true, applies styles for an empty state (e.g. removing extra row borders).
|
|
@@ -120,6 +124,7 @@ export type DataGridBodyProps = ({
|
|
|
120
124
|
* The content of the body (DataGridRow elements).
|
|
121
125
|
*/
|
|
122
126
|
children: React.ReactNode;
|
|
127
|
+
noDataText?: never;
|
|
123
128
|
}) & {
|
|
124
129
|
/**
|
|
125
130
|
* CSS class to apply to the body.
|
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, noData, ...rest }: DataGridBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DataGridBody: ({ className, children, noData, noDataText, ...rest }: DataGridBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v1.
|
|
2
|
+
@versini/ui-datagrid v1.3.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ import { CellWrapper } from "../46.js";
|
|
|
16
16
|
|
|
17
17
|
/* =============================================================================
|
|
18
18
|
* DataGridBody
|
|
19
|
-
* ========================================================================== */ const DataGridBody = ({ className, children, noData = false, ...rest })=>{
|
|
19
|
+
* ========================================================================== */ const DataGridBody = ({ className, children, noData = false, noDataText, ...rest })=>{
|
|
20
20
|
const ctx = useContext(DataGridContext);
|
|
21
21
|
const bodyRef = useRef(null);
|
|
22
22
|
// Measure column widths for sticky header/footer sync.
|
|
@@ -43,7 +43,7 @@ import { CellWrapper } from "../46.js";
|
|
|
43
43
|
textAlign: "center",
|
|
44
44
|
width: "100%"
|
|
45
45
|
},
|
|
46
|
-
children:
|
|
46
|
+
children: noDataText ?? "No Data"
|
|
47
47
|
})
|
|
48
48
|
}) : children
|
|
49
49
|
})
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
export type DataGridInfiniteBodyProps<T> = {
|
|
1
|
+
export type DataGridInfiniteBodyProps<T> = ({
|
|
2
|
+
/**
|
|
3
|
+
* If true, displays an empty state instead of infinite scroll content.
|
|
4
|
+
* When noData is true, data, children, and scroll-related props are optional.
|
|
5
|
+
*/
|
|
6
|
+
noData: true;
|
|
7
|
+
/**
|
|
8
|
+
* The full dataset to render progressively.
|
|
9
|
+
*/
|
|
10
|
+
data?: T[];
|
|
11
|
+
/**
|
|
12
|
+
* Render function for each row. Should return a DataGridRow element. The
|
|
13
|
+
* consumer is responsible for providing the key prop on the returned element.
|
|
14
|
+
*/
|
|
15
|
+
children?: (item: T, index: number) => React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Custom text to display in the empty state. Defaults to "No Data".
|
|
18
|
+
*/
|
|
19
|
+
noDataText?: string;
|
|
20
|
+
} | {
|
|
21
|
+
/**
|
|
22
|
+
* If true, displays an empty state instead of infinite scroll content.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
noData?: false;
|
|
2
26
|
/**
|
|
3
27
|
* The full dataset to render progressively.
|
|
4
28
|
*/
|
|
@@ -8,6 +32,8 @@ export type DataGridInfiniteBodyProps<T> = {
|
|
|
8
32
|
* consumer is responsible for providing the key prop on the returned element.
|
|
9
33
|
*/
|
|
10
34
|
children: (item: T, index: number) => React.ReactNode;
|
|
35
|
+
noDataText?: never;
|
|
36
|
+
}) & {
|
|
11
37
|
/**
|
|
12
38
|
* Number of items to show initially and to add on each scroll.
|
|
13
39
|
* @default 20
|
|
@@ -87,6 +113,6 @@ export type DataGridInfiniteBodyRef = {
|
|
|
87
113
|
* ```
|
|
88
114
|
*
|
|
89
115
|
*/
|
|
90
|
-
export declare function DataGridInfiniteBody<T>({ data, children: renderRow, batchSize, threshold, rootMargin, onVisibleCountChange, className, ref, }: DataGridInfiniteBodyProps<T> & {
|
|
116
|
+
export declare function DataGridInfiniteBody<T>({ data, children: renderRow, batchSize, threshold, rootMargin, onVisibleCountChange, className, noData, noDataText, ref, }: DataGridInfiniteBodyProps<T> & {
|
|
91
117
|
ref?: React.Ref<DataGridInfiniteBodyRef>;
|
|
92
118
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v1.
|
|
2
|
+
@versini/ui-datagrid v1.3.0
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -75,7 +75,7 @@ const ROW_INDEX_DATA_ATTR = "data-row-index";
|
|
|
75
75
|
* </DataGrid>
|
|
76
76
|
* ```
|
|
77
77
|
*
|
|
78
|
-
*/ function DataGridInfiniteBody({ data, children: renderRow, batchSize = DEFAULT_BATCH_SIZE, threshold = DEFAULT_THRESHOLD, rootMargin = DEFAULT_ROOT_MARGIN, onVisibleCountChange, className, ref }) {
|
|
78
|
+
*/ function DataGridInfiniteBody({ data = [], children: renderRow, batchSize = DEFAULT_BATCH_SIZE, threshold = DEFAULT_THRESHOLD, rootMargin = DEFAULT_ROOT_MARGIN, onVisibleCountChange, className, noData = false, noDataText, ref }) {
|
|
79
79
|
const ctx = useContext(DataGridContext);
|
|
80
80
|
const bodyRef = useRef(null);
|
|
81
81
|
const observerRef = useRef(null);
|
|
@@ -297,7 +297,7 @@ const ROW_INDEX_DATA_ATTR = "data-row-index";
|
|
|
297
297
|
bodyContextBase
|
|
298
298
|
]);
|
|
299
299
|
// Measure column widths for sticky header/footer sync.
|
|
300
|
-
useColumnMeasurement(bodyRef, renderedContent);
|
|
300
|
+
useColumnMeasurement(bodyRef, renderedContent, noData);
|
|
301
301
|
const bodyClass = getBodyClass(className);
|
|
302
302
|
return /*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
303
303
|
value: {
|
|
@@ -308,7 +308,20 @@ const ROW_INDEX_DATA_ATTR = "data-row-index";
|
|
|
308
308
|
ref: bodyRef,
|
|
309
309
|
role: "rowgroup",
|
|
310
310
|
className: bodyClass,
|
|
311
|
-
children:
|
|
311
|
+
children: noData ? /*#__PURE__*/ jsx("div", {
|
|
312
|
+
role: "row",
|
|
313
|
+
style: {
|
|
314
|
+
gridColumn: "1 / -1"
|
|
315
|
+
},
|
|
316
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
317
|
+
role: "gridcell",
|
|
318
|
+
style: {
|
|
319
|
+
textAlign: "center",
|
|
320
|
+
width: "100%"
|
|
321
|
+
},
|
|
322
|
+
children: noDataText ?? "No Data"
|
|
323
|
+
})
|
|
324
|
+
}) : renderedContent
|
|
312
325
|
})
|
|
313
326
|
});
|
|
314
327
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-datagrid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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": "521cbb0ad888c8eb05e6f128d3d80c15e7806027"
|
|
102
102
|
}
|