@linzjs/step-ag-grid 21.1.0 → 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.
@@ -1,3 +1,4 @@
1
+ import { ForwardedRef } from "react";
1
2
  export interface GridNoRowsOverlayProps {
2
3
  loading: boolean;
3
4
  rowCount: number | undefined | null;
@@ -6,4 +7,5 @@ export interface GridNoRowsOverlayProps {
6
7
  noRowsMatchingOverlayText: string | undefined;
7
8
  headerRowHeight: number;
8
9
  }
9
- export declare const GridNoRowsOverlay: (props: GridNoRowsOverlayProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const GridNoRowsOverlayFr: (props: GridNoRowsOverlayProps, externalRef: ForwardedRef<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const GridNoRowsOverlay: import("react").ForwardRefExoticComponent<GridNoRowsOverlayProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -264,7 +264,7 @@ const sanitiseFileName = (filename) => {
264
264
  return valid.slice(0, -fileExt.length - 1).slice(0, 64) + "." + fileExt;
265
265
  };
266
266
 
267
- const GridLoadingOverlayComponent = (props) => (jsxRuntime.jsx("div", { style: {
267
+ const GridLoadingOverlayComponentFr = (props, externalRef) => (jsxRuntime.jsx("div", { ref: externalRef, style: {
268
268
  left: 0,
269
269
  top: 0,
270
270
  bottom: 0,
@@ -272,15 +272,20 @@ const GridLoadingOverlayComponent = (props) => (jsxRuntime.jsx("div", { style: {
272
272
  position: "absolute",
273
273
  backgroundColor: "rgba(255,255,255,0.5)",
274
274
  }, children: jsxRuntime.jsx("div", { style: { height: "100%", position: "relative" }, children: jsxRuntime.jsx("div", { style: { position: "absolute", left: 0, top: props.headerRowHeight, right: 0, bottom: 0 }, children: jsxRuntime.jsx(lui.LuiStatusSpinner, {}) }) }) }));
275
- const GridNoRowsOverlay = (props) => {
276
- if (props.loading)
277
- return jsxRuntime.jsx(GridLoadingOverlayComponent, { headerRowHeight: props.headerRowHeight });
278
- if (props.rowCount === 0)
279
- return jsxRuntime.jsx("div", { children: props.noRowsOverlayText ?? "There are currently no rows" });
280
- if (props.filteredRowCount === 0)
281
- return jsxRuntime.jsx("div", { children: props.noRowsMatchingOverlayText ?? "All rows have been filtered" });
282
- return jsxRuntime.jsx("span", {});
275
+ const GridLoadingOverlayComponent = React.forwardRef(GridLoadingOverlayComponentFr);
276
+ const GridNoRowsOverlayFr = (props, externalRef) => {
277
+ if (props.loading) {
278
+ return jsxRuntime.jsx(GridLoadingOverlayComponent, { ref: externalRef, headerRowHeight: props.headerRowHeight });
279
+ }
280
+ if (props.rowCount === 0) {
281
+ return jsxRuntime.jsx("div", { ref: externalRef, children: props.noRowsOverlayText ?? "There are currently no rows" });
282
+ }
283
+ if (props.filteredRowCount === 0) {
284
+ return jsxRuntime.jsx("div", { ref: externalRef, children: props.noRowsMatchingOverlayText ?? "All rows have been filtered" });
285
+ }
286
+ return jsxRuntime.jsx("div", { ref: externalRef });
283
287
  };
288
+ const GridNoRowsOverlay = React.forwardRef(GridNoRowsOverlayFr);
284
289
 
285
290
  /**
286
291
  * Retains last sort order from via <AgGrid postRowSort>.
@@ -2349,6 +2354,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2349
2354
  const hasSetContentSize = React.useRef(false);
2350
2355
  const hasSetContentSizeEmpty = React.useRef(false);
2351
2356
  const needsAutoSize = React.useRef(true);
2357
+ const lastFullResize = React.useRef();
2352
2358
  const setInitialContentSize = React.useCallback(() => {
2353
2359
  if (!gridDivRef.current?.clientWidth || rowData == null) {
2354
2360
  // Don't resize grids if they are offscreen as it doesn't work.
@@ -2376,8 +2382,14 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2376
2382
  }
2377
2383
  else if (gridRendered === "rows-visible") {
2378
2384
  if (!hasSetContentSize.current) {
2379
- hasSetContentSize.current = true;
2380
- params.onContentSize?.(result);
2385
+ if (lastFullResize.current === result.width) {
2386
+ hasSetContentSize.current = true;
2387
+ params.onContentSize?.(result);
2388
+ }
2389
+ else {
2390
+ needsAutoSize.current = true;
2391
+ }
2392
+ lastFullResize.current = result.width;
2381
2393
  }
2382
2394
  }
2383
2395
  else {
@@ -5318,6 +5330,7 @@ exports.GridHeaderSelect = GridHeaderSelect;
5318
5330
  exports.GridIcon = GridIcon;
5319
5331
  exports.GridLoadableCell = GridLoadableCell;
5320
5332
  exports.GridNoRowsOverlay = GridNoRowsOverlay;
5333
+ exports.GridNoRowsOverlayFr = GridNoRowsOverlayFr;
5321
5334
  exports.GridPopoutEditMultiSelect = GridPopoutEditMultiSelect;
5322
5335
  exports.GridPopoutEditMultiSelectGrid = GridPopoutEditMultiSelectGrid;
5323
5336
  exports.GridPopoverContext = GridPopoverContext;