@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.
- package/dist/src/components/Grid.d.ts +1 -1
- package/dist/src/contexts/GridContext.d.ts +1 -0
- package/dist/step-ag-grid.cjs.js +7 -5
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +7 -5
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +3 -2
- package/src/contexts/GridContext.tsx +1 -0
- package/src/contexts/GridContextProvider.tsx +6 -2
package/package.json
CHANGED
package/src/components/Grid.tsx
CHANGED
|
@@ -97,6 +97,7 @@ export const Grid = ({
|
|
|
97
97
|
sizeColumns = "auto",
|
|
98
98
|
selectColumnPinned = null,
|
|
99
99
|
contextMenuSelectRow = false,
|
|
100
|
+
rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 : undefined,
|
|
100
101
|
...params
|
|
101
102
|
}: GridProps): ReactElement => {
|
|
102
103
|
const {
|
|
@@ -153,7 +154,7 @@ export const Grid = ({
|
|
|
153
154
|
|
|
154
155
|
const skipHeader = sizeColumns === "auto-skip-headers" && !isEmpty(params.rowData);
|
|
155
156
|
if (sizeColumns === "auto" || skipHeader) {
|
|
156
|
-
const result = autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current });
|
|
157
|
+
const result = autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, includeFlex: true });
|
|
157
158
|
if (isEmpty(params.rowData)) {
|
|
158
159
|
if (!hasSetContentSizeEmpty.current && result && !hasSetContentSize.current) {
|
|
159
160
|
hasSetContentSizeEmpty.current = true;
|
|
@@ -598,7 +599,7 @@ export const Grid = ({
|
|
|
598
599
|
{gridContextMenu.component}
|
|
599
600
|
<div style={{ flex: 1 }} ref={gridDivRef}>
|
|
600
601
|
<AgGridReact
|
|
601
|
-
rowHeight={
|
|
602
|
+
rowHeight={rowHeight}
|
|
602
603
|
animateRows={params.animateRows}
|
|
603
604
|
rowClassRules={params.rowClassRules}
|
|
604
605
|
getRowId={(params) => `${params.data.id}`}
|
|
@@ -394,12 +394,16 @@ export const GridContextProvider = <RowType extends GridBaseRow>(props: PropsWit
|
|
|
394
394
|
* Resize columns to fit container
|
|
395
395
|
*/
|
|
396
396
|
const autoSizeColumns = useCallback(
|
|
397
|
-
({ skipHeader, colIds, userSizedColIds }: AutoSizeColumnsProps = {}): AutoSizeColumnsResult => {
|
|
397
|
+
({ skipHeader, colIds, userSizedColIds, includeFlex }: AutoSizeColumnsProps = {}): AutoSizeColumnsResult => {
|
|
398
398
|
if (!columnApi) return null;
|
|
399
399
|
const colIdsSet = colIds instanceof Set ? colIds : new Set(colIds);
|
|
400
400
|
const colsToResize = columnApi.getColumnState().filter((colState) => {
|
|
401
401
|
const colId = colState.colId;
|
|
402
|
-
return (
|
|
402
|
+
return (
|
|
403
|
+
(isEmpty(colIdsSet) || colIdsSet.has(colId)) &&
|
|
404
|
+
!userSizedColIds?.has(colId) &&
|
|
405
|
+
(includeFlex || !colState.flex)
|
|
406
|
+
);
|
|
403
407
|
});
|
|
404
408
|
if (!isEmpty(colsToResize)) {
|
|
405
409
|
columnApi.autoSizeColumns(
|