@linzjs/step-ag-grid 29.3.5 → 29.4.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.
@@ -2760,7 +2760,7 @@ ModuleRegistry.registerModules([AllCommunityModule]);
2760
2760
  /**
2761
2761
  * Wrapper for AgGrid to add commonly used functionality.
2762
2762
  */
2763
- const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection = 'multiple', suppressColumnVirtualization = true, theme = 'ag-theme-step-default', sizeColumns = 'auto', selectColumnPinned = 'left', contextMenuSelectRow = false, singleClickEdit = false, rowData, rowHeight = theme === 'ag-theme-step-default' ? 40 : theme === 'ag-theme-step-compact' ? 36 : 40, selectable, onCellFocused: paramsOnCellFocused, maxInitialWidth, ...params }) => {
2763
+ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection = 'multiple', suppressColumnVirtualization = true, theme = 'ag-theme-step-default', sizeColumns = 'auto', selectColumnPinned = 'left', contextMenuSelectRow = false, singleClickEdit = false, rowData, rowHeight = theme === 'ag-theme-step-default' ? 40 : theme === 'ag-theme-step-compact' ? 36 : 40, selectable, onCellFocused: paramsOnCellFocused, maxInitialWidth, suppressReadOnlyStyle = false, ...params }) => {
2764
2764
  const { gridReady, gridRenderState, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnBulkEditingComplete, getColDef, showNoRowsOverlay, prePopupOps, startCellEditing: propStartCellEditing, } = useGridContext();
2765
2765
  // CellEditingStop event happens too much for one edit
2766
2766
  const startedEditRef = useRef(false);
@@ -2966,11 +2966,14 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
2966
2966
  * Synchronise externally selected items to grid on externalSelectedItems change
2967
2967
  */
2968
2968
  useEffect(synchroniseExternallySelectedItemsToGrid, [synchroniseExternallySelectedItemsToGrid]);
2969
- /**
2970
- * Add selectable column to colDefs. Adjust column defs to block fit for auto sized columns.
2971
- */
2972
- const columnDefs = useMemo(() => {
2973
- return params.columnDefs.map((colDef) => {
2969
+ const mapColDef = useCallback((colDef) => {
2970
+ if ('children' in colDef) {
2971
+ return {
2972
+ ...colDef,
2973
+ children: colDef.children.map(mapColDef),
2974
+ };
2975
+ }
2976
+ else {
2974
2977
  const colDefEditable = colDef.editable;
2975
2978
  const editable = combineEditables(params.loading !== true && params.readOnly !== true, params.defaultColDef?.editable, colDefEditable);
2976
2979
  return {
@@ -2978,11 +2981,17 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
2978
2981
  editable,
2979
2982
  cellClassRules: {
2980
2983
  ...colDef.cellClassRules,
2981
- 'GridCell-readonly': (ccp) => !editable(ccp),
2984
+ 'GridCell-readonly': (ccp) => !suppressReadOnlyStyle && !editable(ccp),
2982
2985
  },
2983
2986
  };
2984
- });
2985
- }, [params.columnDefs, params.loading, params.readOnly, params.defaultColDef?.editable]);
2987
+ }
2988
+ }, [params.defaultColDef?.editable, params.loading, params.readOnly, suppressReadOnlyStyle]);
2989
+ /**
2990
+ * Add selectable column to colDefs. Adjust column defs to block fit for auto sized columns.
2991
+ */
2992
+ const columnDefs = useMemo(() => {
2993
+ return params.columnDefs.map(mapColDef);
2994
+ }, [params.columnDefs, mapColDef]);
2986
2995
  const hasExternallySelectedItems = !!params.setExternalSelectedItems;
2987
2996
  /**
2988
2997
  * When grid is ready set the apis to the grid context and sync selected items to grid.