Skip to content

Commit 3603d13

Browse files
Merge remote-tracking branch 'origin/main' into add_announcement_page
2 parents cc5aa4f + 5013324 commit 3603d13

34 files changed

+1339
-794
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
uses: powsybl/github-ci/.github/workflows/build-frontend-app-generic.yml@8197c006b729cfd664ffa3f3fe4bb603fb574c69
11+
uses: powsybl/github-ci/.github/workflows/build-frontend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
1212
with:
1313
dockerImage: gridsuite/gridadmin-app
1414
dockerUsername: gridsuiteci

.github/workflows/patch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
run-patch:
13-
uses: powsybl/github-ci/.github/workflows/patch-frontend-app-generic.yml@8197c006b729cfd664ffa3f3fe4bb603fb574c69
13+
uses: powsybl/github-ci/.github/workflows/patch-frontend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
1414
with:
1515
releaseVersion: ${{ github.event.inputs.releaseVersion }}
1616
dockerImage: docker.io/gridsuite/gridadmin-app

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
run-release:
17-
uses: powsybl/github-ci/.github/workflows/release-frontend-app-generic.yml@8197c006b729cfd664ffa3f3fe4bb603fb574c69
17+
uses: powsybl/github-ci/.github/workflows/release-frontend-app-generic.yml@69b162754c0728d9aeb2ea568eaf47f28f60fafb
1818
with:
1919
releaseVersion: ${{ github.event.inputs.releaseVersion }}
2020
commitSha: ${{ github.event.inputs.gitReference }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gridadmin-app",
3-
"version": "2.17.0-SNAPSHOT",
3+
"version": "2.18.0-SNAPSHOT",
44
"license": "MPL-2.0",
55
"private": true,
66
"type": "module",

src/components/Grid/GridTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const GridTable: GridTableWithRef = forwardRef(function AgGridToolbar<TDa
7676
);
7777

7878
return (
79-
<Grid container direction="column" justifyContent="flex-start" alignItems="stretch">
79+
<Grid container direction="column" justifyContent="flex-start" alignItems="stretch" width={'100%'}>
8080
<Grid item xs="auto">
8181
<AppBar position="static" color="default">
8282
<Toolbar
@@ -105,6 +105,7 @@ export const GridTable: GridTableWithRef = forwardRef(function AgGridToolbar<TDa
105105
rowData={data}
106106
alwaysShowVerticalScroll={true}
107107
onGridReady={loadDataAndSave}
108+
accentedSort={true}
108109
context={useMemo(
109110
() =>
110111
({
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
import React, { useRef, useState, useEffect } from 'react';
9+
import { Chip, Grid, Tooltip } from '@mui/material';
10+
import { mergeSx } from '@gridsuite/commons-ui';
11+
12+
const maxChipWidth = 100;
13+
const counterChipWidth = 25;
14+
15+
const chipStyles = {
16+
default: {
17+
marginTop: 2,
18+
marginLeft: 1,
19+
maxWidth: maxChipWidth,
20+
},
21+
withCounter: {
22+
'&.MuiChip-root': {
23+
fontWeight: 'bold',
24+
},
25+
},
26+
};
27+
28+
export interface MultiChipCellRendererProps {
29+
value: string[];
30+
}
31+
32+
const MultiChipCellRenderer = (props: MultiChipCellRendererProps) => {
33+
const values: string[] = props.value ? [...props.value].sort((a: string, b: string) => a.localeCompare(b)) : [];
34+
const containerRef = useRef<HTMLDivElement>(null);
35+
const [chipLimit, setChipLimit] = useState<number>(5);
36+
37+
useEffect(() => {
38+
const updateChipLimit = () => {
39+
if (!containerRef.current) {
40+
return;
41+
}
42+
const zoomLevel = window.devicePixelRatio;
43+
const adjustedContainerWidth = containerRef.current.clientWidth / zoomLevel;
44+
const maxChips = Math.max(1, Math.floor(adjustedContainerWidth / (maxChipWidth + counterChipWidth)));
45+
setChipLimit(maxChips);
46+
};
47+
48+
updateChipLimit();
49+
const resizeObserver = new ResizeObserver(updateChipLimit);
50+
if (containerRef.current) {
51+
resizeObserver.observe(containerRef.current);
52+
}
53+
return () => resizeObserver.disconnect();
54+
}, [values.length]);
55+
56+
const customChip = (label: string, index: number, chipsNumber: number) => {
57+
if (index < chipLimit) {
58+
return (
59+
<Tooltip title={label} key={`tooltip-${label}`}>
60+
<Chip key={label} label={label} size="small" sx={chipStyles.default} />
61+
</Tooltip>
62+
);
63+
} else if (index === chipLimit) {
64+
const hiddenLabels = values.slice(chipLimit);
65+
const tooltipContent = (
66+
<>
67+
{hiddenLabels.map((hiddenLabel) => (
68+
<div key={`hidden-label-${hiddenLabel}`}>{'- ' + hiddenLabel}</div>
69+
))}
70+
</>
71+
);
72+
73+
return (
74+
<Tooltip title={tooltipContent} key="tooltip-counter">
75+
<Chip
76+
size="small"
77+
label={`+${chipsNumber - chipLimit}`}
78+
key="chip-counter"
79+
sx={mergeSx(chipStyles.default, chipStyles.withCounter)}
80+
/>
81+
</Tooltip>
82+
);
83+
}
84+
return null;
85+
};
86+
87+
return (
88+
<Grid container direction="row" spacing={1} wrap="nowrap" ref={containerRef}>
89+
{values.map((label: string, index: number) => customChip(label, index, values.length))}
90+
</Grid>
91+
);
92+
};
93+
94+
export default MultiChipCellRenderer;

src/pages/common/multi-chips-renderer-component.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/pages/common/multi-select-editor-component.tsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/pages/common/table-config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
import { ColDef, RowSelectionOptions } from 'ag-grid-community';
9+
10+
export const defaultColDef: ColDef = {
11+
editable: false,
12+
resizable: true,
13+
minWidth: 50,
14+
rowDrag: false,
15+
sortable: true,
16+
};
17+
18+
export const defaultRowSelection: RowSelectionOptions = {
19+
mode: 'multiRow',
20+
enableClickSelection: false,
21+
checkboxes: true,
22+
headerCheckbox: true,
23+
hideDisabledCheckboxes: false,
24+
};

0 commit comments

Comments
 (0)