Fix mui-grid issue after update
This commit is contained in:
parent
fb46626cff
commit
3c5c82371a
@ -130,7 +130,7 @@ function MovementsTable(p: {
|
|||||||
}, [p.movements, labelFilter]);
|
}, [p.movements, labelFilter]);
|
||||||
|
|
||||||
const [rowSelectionModel, setRowSelectionModel] =
|
const [rowSelectionModel, setRowSelectionModel] =
|
||||||
React.useState<GridRowSelectionModel>([]);
|
React.useState<GridRowSelectionModel>({ type: "include", ids: new Set() });
|
||||||
|
|
||||||
// Set uploaded file
|
// Set uploaded file
|
||||||
const setUploadedFile = async (
|
const setUploadedFile = async (
|
||||||
@ -216,7 +216,7 @@ function MovementsTable(p: {
|
|||||||
const moveMultiple = async () => {
|
const moveMultiple = async () => {
|
||||||
try {
|
try {
|
||||||
const movements = p.movements.filter((m) =>
|
const movements = p.movements.filter((m) =>
|
||||||
rowSelectionModel.includes(m.id)
|
rowSelectionModel.ids.has(m.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
const targetAccount = await chooseAccount(
|
const targetAccount = await chooseAccount(
|
||||||
@ -260,7 +260,7 @@ function MovementsTable(p: {
|
|||||||
const deleteMultiple = async () => {
|
const deleteMultiple = async () => {
|
||||||
try {
|
try {
|
||||||
const movements = p.movements.filter((m) =>
|
const movements = p.movements.filter((m) =>
|
||||||
rowSelectionModel.includes(m.id)
|
rowSelectionModel.ids.has(m.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -393,15 +393,19 @@ function MovementsTable(p: {
|
|||||||
/>
|
/>
|
||||||
<span style={{ flex: 1 }}></span>
|
<span style={{ flex: 1 }}></span>
|
||||||
<Tooltip title="Refresh table">
|
<Tooltip title="Refresh table">
|
||||||
<IconButton onClick={() => { p.needReload(false); }}>
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
p.needReload(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<RefreshIcon />
|
<RefreshIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Move all the selected entries to another account">
|
<Tooltip title="Move all the selected entries to another account">
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={
|
disabled={
|
||||||
rowSelectionModel.length === 0 ||
|
rowSelectionModel.ids.size === 0 ||
|
||||||
rowSelectionModel.length === p.movements.length
|
rowSelectionModel.ids.size === p.movements.length
|
||||||
}
|
}
|
||||||
onClick={moveMultiple}
|
onClick={moveMultiple}
|
||||||
>
|
>
|
||||||
@ -411,8 +415,8 @@ function MovementsTable(p: {
|
|||||||
<Tooltip title="Delete all the selected entries">
|
<Tooltip title="Delete all the selected entries">
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={
|
disabled={
|
||||||
rowSelectionModel.length === 0 ||
|
rowSelectionModel.ids.size === 0 ||
|
||||||
rowSelectionModel.length === p.movements.length
|
rowSelectionModel.ids.size === p.movements.length
|
||||||
}
|
}
|
||||||
onClick={deleteMultiple}
|
onClick={deleteMultiple}
|
||||||
>
|
>
|
||||||
|
@ -133,7 +133,7 @@ function InboxTable(p: {
|
|||||||
}, [p.entries, labelFilter]);
|
}, [p.entries, labelFilter]);
|
||||||
|
|
||||||
const [rowSelectionModel, setRowSelectionModel] =
|
const [rowSelectionModel, setRowSelectionModel] =
|
||||||
React.useState<GridRowSelectionModel>([]);
|
React.useState<GridRowSelectionModel>({ type: "include", ids: new Set() });
|
||||||
|
|
||||||
const [attaching, setAttaching] = React.useState<InboxEntry | undefined>();
|
const [attaching, setAttaching] = React.useState<InboxEntry | undefined>();
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ function InboxTable(p: {
|
|||||||
|
|
||||||
// Find the entry to map
|
// Find the entry to map
|
||||||
const entries = p.entries.filter(
|
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[][] = [];
|
const movements: Movement[][] = [];
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ function InboxTable(p: {
|
|||||||
const deleteMultiple = async () => {
|
const deleteMultiple = async () => {
|
||||||
try {
|
try {
|
||||||
const deletedEntries = p.entries.filter((m) =>
|
const deletedEntries = p.entries.filter((m) =>
|
||||||
rowSelectionModel.includes(m.id)
|
rowSelectionModel.ids.has(m.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -437,7 +437,9 @@ function InboxTable(p: {
|
|||||||
icon={<SearchIcon />}
|
icon={<SearchIcon />}
|
||||||
label="Attach entry to movement"
|
label="Attach entry to movement"
|
||||||
color="inherit"
|
color="inherit"
|
||||||
onClick={() => { handleAttachClick(params.row); }}
|
onClick={() => {
|
||||||
|
handleAttachClick(params.row);
|
||||||
|
}}
|
||||||
disabled={!!params.row.movement_id}
|
disabled={!!params.row.movement_id}
|
||||||
/>
|
/>
|
||||||
</Tooltip>,
|
</Tooltip>,
|
||||||
@ -496,7 +498,7 @@ function InboxTable(p: {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Attach all the selected inbox entries to movements">
|
<Tooltip title="Attach all the selected inbox entries to movements">
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={rowSelectionModel.length === 0}
|
disabled={rowSelectionModel.ids.size === 0}
|
||||||
onClick={attachMultiple}
|
onClick={attachMultiple}
|
||||||
>
|
>
|
||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
@ -505,8 +507,8 @@ function InboxTable(p: {
|
|||||||
<Tooltip title="Delete all the selected inbox entries">
|
<Tooltip title="Delete all the selected inbox entries">
|
||||||
<IconButton
|
<IconButton
|
||||||
disabled={
|
disabled={
|
||||||
rowSelectionModel.length === 0 ||
|
rowSelectionModel.ids.size === 0 ||
|
||||||
rowSelectionModel.length === p.entries.length
|
rowSelectionModel.ids.size === p.entries.length
|
||||||
}
|
}
|
||||||
onClick={deleteMultiple}
|
onClick={deleteMultiple}
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user