@linzjs/step-ag-grid 17.0.5 → 17.0.7

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.
@@ -2320,7 +2320,7 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
2320
2320
  /**
2321
2321
  * Wrapper for AgGrid to add commonly used functionality.
2322
2322
  */
2323
- const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, ...params }) => {
2323
+ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 : undefined, ...params }) => {
2324
2324
  const { gridReady, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnCellEditingComplete, getColDef, } = useContext(GridContext);
2325
2325
  const { checkUpdating, updatedDep, updatingCols } = useContext(GridUpdatingContext);
2326
2326
  const { prePopupOps } = useContext(GridContext);
@@ -2352,7 +2352,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2352
2352
  }
2353
2353
  const skipHeader = sizeColumns === "auto-skip-headers" && !isEmpty(params.rowData);
2354
2354
  if (sizeColumns === "auto" || skipHeader) {
2355
- const result = autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current });
2355
+ const result = autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, includeFlex: true });
2356
2356
  if (isEmpty(params.rowData)) {
2357
2357
  if (!hasSetContentSizeEmpty.current && result && !hasSetContentSize.current) {
2358
2358
  hasSetContentSizeEmpty.current = true;
@@ -2734,7 +2734,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2734
2734
  const gridContextMenu = useGridContextMenu({ contextMenu: params.contextMenu, contextMenuSelectRow });
2735
2735
  // This is setting a ref in the GridContext so won't be triggering an update loop
2736
2736
  setOnCellEditingComplete(params.onCellEditingComplete);
2737
- return (jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { rowHeight: params.rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
2737
+ return (jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { rowHeight: rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
2738
2738
  setInitialContentSize();
2739
2739
  }, onRowDataUpdated: onRowDataChanged, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: { minWidth: 48, ...omit(params.defaultColDef, ["editable"]) }, columnDefs: columnDefsAdjusted, rowData: params.rowData, noRowsOverlayComponent: (event) => {
2740
2740
  let rowCount = 0;
@@ -4716,13 +4716,15 @@ const GridContextProvider = (props) => {
4716
4716
  /**
4717
4717
  * Resize columns to fit container
4718
4718
  */
4719
- const autoSizeColumns = useCallback(({ skipHeader, colIds, userSizedColIds } = {}) => {
4719
+ const autoSizeColumns = useCallback(({ skipHeader, colIds, userSizedColIds, includeFlex } = {}) => {
4720
4720
  if (!columnApi)
4721
4721
  return null;
4722
4722
  const colIdsSet = colIds instanceof Set ? colIds : new Set(colIds);
4723
4723
  const colsToResize = columnApi.getColumnState().filter((colState) => {
4724
4724
  const colId = colState.colId;
4725
- return (isEmpty(colIdsSet) || colIdsSet.has(colId)) && !userSizedColIds?.has(colId) && !colState.flex;
4725
+ return ((isEmpty(colIdsSet) || colIdsSet.has(colId)) &&
4726
+ !userSizedColIds?.has(colId) &&
4727
+ (includeFlex || !colState.flex));
4726
4728
  });
4727
4729
  if (!isEmpty(colsToResize)) {
4728
4730
  columnApi.autoSizeColumns(colsToResize.map((colState) => colState.colId), skipHeader);