Skip to content

Commit

Permalink
Merge branch 'main' into dbraquart/add-network-visu-params-element
Browse files Browse the repository at this point in the history
  • Loading branch information
dbraquart authored Jan 23, 2025
2 parents f0aac39 + 7ee19dd commit 5aabd20
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 45 deletions.
41 changes: 25 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gridsuite/commons-ui",
"version": "0.78.0",
"version": "0.79.0",
"description": "common react components for gridsuite applications",
"engines": {
"npm": ">=9",
Expand Down Expand Up @@ -54,8 +54,8 @@
"@mui/material": "^5.15.14",
"@mui/system": "^5.15.15",
"@mui/x-tree-view": "^6.17.0",
"ag-grid-community": "^31.0.0",
"ag-grid-react": "^31.2.0",
"ag-grid-community": "^33.0.3",
"ag-grid-react": "^33.0.3",
"notistack": "^3.0.1",
"papaparse": "^5.4.1",
"react": "^18.2.0",
Expand Down Expand Up @@ -101,8 +101,8 @@
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"@vitejs/plugin-react": "^4.2.1",
"ag-grid-community": "^31.0.0",
"ag-grid-react": "^31.2.0",
"ag-grid-community": "^33.0.3",
"ag-grid-react": "^33.0.3",
"babel-eslint": "^10.1.0",
"babel-preset-airbnb": "^5.0.0",
"babel-preset-vite": "^1.1.3",
Expand Down
4 changes: 2 additions & 2 deletions src/components/customAGGrid/customAggrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const onColumnResized = (params: ColumnResizedEvent) => {
if (column && colDefinedMinWidth && finished) {
const newWidth = column?.getActualWidth();
if (newWidth < colDefinedMinWidth) {
column?.setActualWidth(colDefinedMinWidth, params.source);
params.api.setColumnWidths([{ key: column, newWidth: colDefinedMinWidth }], finished, params.source);
}
}
};
Expand Down Expand Up @@ -66,9 +66,9 @@ export const CustomAGGrid = React.forwardRef<AgGridReact, CustomAGGridProps>((pr
<AgGridReact
ref={ref}
getLocaleText={getLocaleText}
suppressPropertyNamesCheck
onColumnResized={onColumnResized}
enableCellTextSelection
theme="legacy"
{...agGridReactProps}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import { v4 as uuid4 } from 'uuid';
import { UUID } from 'crypto';
import { FieldConstants } from '../../../utils/constants/fieldConstants';
import yup from '../../../utils/yupConfig';
import {
CustomAgGridTable,
ROW_DRAGGING_SELECTION_COLUMN_DEF,
} from '../../inputs/reactHookForm/agGridTable/CustomAgGridTable';
import { CustomAgGridTable } from '../../inputs/reactHookForm/agGridTable/CustomAgGridTable';
import { SelectInput } from '../../inputs/reactHookForm/selectInputs/SelectInput';
import { Generator, Load } from '../../../utils/types/equipmentTypes';
import { NumericEditor } from '../../inputs/reactHookForm/agGridTable/cellEditors/numericEditor';
Expand Down Expand Up @@ -129,11 +126,11 @@ export function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversi

const columnDefs = useMemo(() => {
const newColumnDefs: any[] = [
...ROW_DRAGGING_SELECTION_COLUMN_DEF,
{
headerName: intl.formatMessage({
id: FieldConstants.EQUIPMENT_ID,
}),
rowDrag: true,
field: FieldConstants.EQUIPMENT_ID,
editable: true,
singleClickEdit: true,
Expand Down Expand Up @@ -246,7 +243,12 @@ export function ExplicitNamingFilterForm({ sourceFilterForExplicitNamingConversi
makeDefaultRowData={makeDefaultRowData}
pagination
paginationPageSize={100}
suppressRowClickSelection
rowSelection={{
mode: 'multiRow',
enableClickSelection: false,
checkboxes: true,
headerCheckbox: true,
}}
alwaysShowVerticalScroll
stopEditingWhenCellsLoseFocus
csvProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { useCallback, useEffect, useState } from 'react';
import { useFieldArray, useFormContext } from 'react-hook-form';
import { AgGridReact } from 'ag-grid-react';
import { AgGridReact, AgGridReactProps } from 'ag-grid-react';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';
import { Box, useTheme } from '@mui/material';
Expand All @@ -16,15 +16,6 @@ import { CellEditingStoppedEvent, ColumnState, SortChangedEvent } from 'ag-grid-
import { BottomRightButtons } from './BottomRightButtons';
import { FieldConstants } from '../../../../utils/constants/fieldConstants';

export const ROW_DRAGGING_SELECTION_COLUMN_DEF = [
{
rowDrag: true,
headerCheckboxSelection: true,
checkboxSelection: true,
maxWidth: 50,
},
];

const style = (customProps: any) => ({
grid: (theme: any) => ({
width: 'auto',
Expand Down Expand Up @@ -92,7 +83,7 @@ export interface CustomAgGridTableProps {
defaultColDef: unknown;
pagination: boolean;
paginationPageSize: number;
suppressRowClickSelection: boolean;
rowSelection?: AgGridReactProps['rowSelection'];
alwaysShowVerticalScroll: boolean;
stopEditingWhenCellsLoseFocus: boolean;
}
Expand All @@ -106,11 +97,11 @@ export function CustomAgGridTable({
defaultColDef,
pagination,
paginationPageSize,
suppressRowClickSelection,
rowSelection,
alwaysShowVerticalScroll,
stopEditingWhenCellsLoseFocus,
...props
}: CustomAgGridTableProps) {
}: Readonly<CustomAgGridTableProps>) {
// FIXME: right type => Theme --> not defined there ( gridStudy and gridExplore definition not the same )
const theme: any = useTheme();
const [gridApi, setGridApi] = useState<any>(null);
Expand Down Expand Up @@ -243,11 +234,10 @@ export function CustomAgGridTable({
onGridReady={onGridReady}
getLocaleText={getLocaleText}
cacheOverflowSize={10}
rowSelection="multiple"
rowSelection={rowSelection ?? 'multiple'}
rowDragEntireRow
rowDragManaged
onRowDragEnd={(e) => move(getIndex(e.node.data), e.overIndex)}
suppressBrowserResizeObserver
columnDefs={columnDefs}
detailRowAutoHeight
onSelectionChanged={() => {
Expand All @@ -259,9 +249,9 @@ export function CustomAgGridTable({
getRowId={(row) => row.data[FieldConstants.AG_GRID_ROW_UUID]}
pagination={pagination}
paginationPageSize={paginationPageSize}
suppressRowClickSelection={suppressRowClickSelection}
alwaysShowVerticalScroll={alwaysShowVerticalScroll}
stopEditingWhenCellsLoseFocus={stopEditingWhenCellsLoseFocus}
theme="legacy"
{...props}
/>
</Box>
Expand Down

0 comments on commit 5aabd20

Please sign in to comment.