Fix mui-grid issue after update
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Pierre HUBERT 2025-05-15 21:51:12 +02:00
parent fb46626cff
commit 3c5c82371a
2 changed files with 21 additions and 15 deletions

View File

@ -130,7 +130,7 @@ function MovementsTable(p: {
}, [p.movements, labelFilter]);
const [rowSelectionModel, setRowSelectionModel] =
React.useState<GridRowSelectionModel>([]);
React.useState<GridRowSelectionModel>({ type: "include", ids: new Set() });
// Set uploaded file
const setUploadedFile = async (
@ -216,7 +216,7 @@ function MovementsTable(p: {
const moveMultiple = async () => {
try {
const movements = p.movements.filter((m) =>
rowSelectionModel.includes(m.id)
rowSelectionModel.ids.has(m.id)
);
const targetAccount = await chooseAccount(
@ -260,7 +260,7 @@ function MovementsTable(p: {
const deleteMultiple = async () => {
try {
const movements = p.movements.filter((m) =>
rowSelectionModel.includes(m.id)
rowSelectionModel.ids.has(m.id)
);
if (
@ -393,15 +393,19 @@ function MovementsTable(p: {
/>
<span style={{ flex: 1 }}></span>
<Tooltip title="Refresh table">
<IconButton onClick={() => { p.needReload(false); }}>
<IconButton
onClick={() => {
p.needReload(false);
}}
>
<RefreshIcon />
</IconButton>
</Tooltip>
<Tooltip title="Move all the selected entries to another account">
<IconButton
disabled={
rowSelectionModel.length === 0 ||
rowSelectionModel.length === p.movements.length
rowSelectionModel.ids.size === 0 ||
rowSelectionModel.ids.size === p.movements.length
}
onClick={moveMultiple}
>
@ -411,8 +415,8 @@ function MovementsTable(p: {
<Tooltip title="Delete all the selected entries">
<IconButton
disabled={
rowSelectionModel.length === 0 ||
rowSelectionModel.length === p.movements.length
rowSelectionModel.ids.size === 0 ||
rowSelectionModel.ids.size === p.movements.length
}
onClick={deleteMultiple}
>

View File

@ -133,7 +133,7 @@ function InboxTable(p: {
}, [p.entries, labelFilter]);
const [rowSelectionModel, setRowSelectionModel] =
React.useState<GridRowSelectionModel>([]);
React.useState<GridRowSelectionModel>({ type: "include", ids: new Set() });
const [attaching, setAttaching] = React.useState<InboxEntry | undefined>();
@ -244,7 +244,7 @@ function InboxTable(p: {
// Find the entry to map
const entries = p.entries.filter(
(m) => rowSelectionModel.includes(m.id) && !m.movement_id
(m) => rowSelectionModel.ids.has(m.id) && !m.movement_id
);
const movements: Movement[][] = [];
@ -324,7 +324,7 @@ function InboxTable(p: {
const deleteMultiple = async () => {
try {
const deletedEntries = p.entries.filter((m) =>
rowSelectionModel.includes(m.id)
rowSelectionModel.ids.has(m.id)
);
if (
@ -437,7 +437,9 @@ function InboxTable(p: {
icon={<SearchIcon />}
label="Attach entry to movement"
color="inherit"
onClick={() => { handleAttachClick(params.row); }}
onClick={() => {
handleAttachClick(params.row);
}}
disabled={!!params.row.movement_id}
/>
</Tooltip>,
@ -496,7 +498,7 @@ function InboxTable(p: {
</Tooltip>
<Tooltip title="Attach all the selected inbox entries to movements">
<IconButton
disabled={rowSelectionModel.length === 0}
disabled={rowSelectionModel.ids.size === 0}
onClick={attachMultiple}
>
<SearchIcon />
@ -505,8 +507,8 @@ function InboxTable(p: {
<Tooltip title="Delete all the selected inbox entries">
<IconButton
disabled={
rowSelectionModel.length === 0 ||
rowSelectionModel.length === p.entries.length
rowSelectionModel.ids.size === 0 ||
rowSelectionModel.ids.size === p.entries.length
}
onClick={deleteMultiple}
>