@linzjs/step-ag-grid 21.1.1 → 21.1.2
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/src/components/GridNoRowsOverlay.d.ts +3 -1
- package/dist/step-ag-grid.cjs.js +15 -9
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +16 -11
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridNoRowsOverlay.tsx +21 -7
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { LuiStatusSpinner } from "@linzjs/lui";
|
|
2
|
+
import { ForwardedRef, forwardRef } from "react";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const GridLoadingOverlayComponentFr = (
|
|
5
|
+
props: { headerRowHeight: number },
|
|
6
|
+
externalRef: ForwardedRef<HTMLDivElement>,
|
|
7
|
+
) => (
|
|
4
8
|
<div
|
|
9
|
+
ref={externalRef}
|
|
5
10
|
style={{
|
|
6
11
|
left: 0,
|
|
7
12
|
top: 0,
|
|
@@ -19,6 +24,8 @@ const GridLoadingOverlayComponent = (props: { headerRowHeight: number }) => (
|
|
|
19
24
|
</div>
|
|
20
25
|
);
|
|
21
26
|
|
|
27
|
+
const GridLoadingOverlayComponent = forwardRef(GridLoadingOverlayComponentFr);
|
|
28
|
+
|
|
22
29
|
export interface GridNoRowsOverlayProps {
|
|
23
30
|
loading: boolean;
|
|
24
31
|
rowCount: number | undefined | null;
|
|
@@ -28,10 +35,17 @@ export interface GridNoRowsOverlayProps {
|
|
|
28
35
|
headerRowHeight: number;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
export const
|
|
32
|
-
if (props.loading)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
export const GridNoRowsOverlayFr = (props: GridNoRowsOverlayProps, externalRef: ForwardedRef<HTMLDivElement>) => {
|
|
39
|
+
if (props.loading) {
|
|
40
|
+
return <GridLoadingOverlayComponent ref={externalRef} headerRowHeight={props.headerRowHeight} />;
|
|
41
|
+
}
|
|
42
|
+
if (props.rowCount === 0) {
|
|
43
|
+
return <div ref={externalRef}>{props.noRowsOverlayText ?? "There are currently no rows"}</div>;
|
|
44
|
+
}
|
|
45
|
+
if (props.filteredRowCount === 0) {
|
|
46
|
+
return <div ref={externalRef}>{props.noRowsMatchingOverlayText ?? "All rows have been filtered"}</div>;
|
|
47
|
+
}
|
|
48
|
+
return <div ref={externalRef} />;
|
|
37
49
|
};
|
|
50
|
+
|
|
51
|
+
export const GridNoRowsOverlay = forwardRef(GridNoRowsOverlayFr);
|