@versini/ui-datagrid 1.1.0 → 1.2.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
package/dist/298.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
package/dist/46.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
package/dist/511.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
package/dist/926.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -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 content to display in the empty state. Defaults to "No Data".
18
+ */
19
+ noDataContent?: React.ReactNode;
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
+ noDataContent?: 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, noDataContent, 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.1.0
2
+ @versini/ui-datagrid v1.2.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, noDataContent, 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: renderedContent
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: noDataContent ?? "No Data"
323
+ })
324
+ }) : renderedContent
312
325
  })
313
326
  });
314
327
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- @versini/ui-datagrid v1.1.0
2
+ @versini/ui-datagrid v1.2.0
3
3
  © 2026 gizmette.com
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-datagrid",
3
- "version": "1.1.0",
3
+ "version": "1.2.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": "11ae5b5a3443d0160d12ae42584aead403fdf58f"
101
+ "gitHead": "4fcf4b9c61ae979d4dfc6b054c9df706ceeb3619"
102
102
  }