Skip to content

Commit

Permalink
[3763] Add a default size on the Selection Dialog TreeView
Browse files Browse the repository at this point in the history
Bug: #3763
Signed-off-by: Florian Barbin <[email protected]>
  • Loading branch information
florianbarbin committed Sep 6, 2024
1 parent a655d7b commit 665d5ad
Showing 1 changed file with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import IconButton from '@mui/material/IconButton';
import { useEffect, useState } from 'react';
import { makeStyles } from 'tss-react/mui';
import { DiagramDialogComponentState } from './SelectionDialog.types';
import { useSelectionDescription } from './useSelectionDescription';

export const SELECTION_DIALOG_TYPE: string = 'selectionDialogDescription';

const useTreeStyle = makeStyles()((theme) => ({
borderStyle: {
border: '1px solid',
borderColor: theme.palette.grey[500],
height: 300,
overflow: 'auto',
},
}));

export const SelectionDialog = ({
editingContextId,
dialogDescriptionId,
Expand All @@ -39,6 +49,7 @@ export const SelectionDialog = ({
message: '',
selectedObjects: [],
};
const { classes } = useTreeStyle();
const [state, setState] = useState<DiagramDialogComponentState>(initialState);

const { loading, selectionDescription } = useSelectionDescription({
Expand All @@ -64,19 +75,21 @@ export const SelectionDialog = ({

if (state.treeDescriptionId) {
content = (
<TreeView
editingContextId={editingContextId}
readOnly={true}
treeId={`selection://?treeDescriptionId=${encodeURIComponent(
state.treeDescriptionId
)}&targetObjectId=${encodeURIComponent(targetObjectId)}`}
enableMultiSelection={false}
synchronizedWithSelection={true}
activeFilterIds={[]}
textToFilter={''}
textToHighlight={''}
treeItemActionRender={(props) => <SelectionDialogTreeItemAction {...props} />}
/>
<div className={classes.borderStyle}>
<TreeView
editingContextId={editingContextId}
readOnly={true}
treeId={`selection://?treeDescriptionId=${encodeURIComponent(
state.treeDescriptionId
)}&targetObjectId=${encodeURIComponent(targetObjectId)}`}
enableMultiSelection={false}
synchronizedWithSelection={true}
activeFilterIds={[]}
textToFilter={''}
textToHighlight={''}
treeItemActionRender={(props) => <SelectionDialogTreeItemAction {...props} />}
/>
</div>
);
}
return (
Expand Down

0 comments on commit 665d5ad

Please sign in to comment.