-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDE/PKFE-16 custom data grid header definition
- Loading branch information
1 parent
d265ddd
commit 6bfde87
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/front-end/src/features/editor/components/editorView/editorHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ColumnAggregation } from '@/features/editor/types'; | ||
import { Box, Typography, useTheme } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
export interface EditorHeaderProps { | ||
columnName: string; | ||
gridColumnsAggregation: ColumnAggregation; | ||
} | ||
|
||
export const EditorHeader: React.ElementType<EditorHeaderProps> = ({ columnName, gridColumnsAggregation }) => { | ||
const Theme = useTheme(); | ||
|
||
if (!gridColumnsAggregation[columnName]) | ||
return <Typography sx={{ fontSize: '0.875rem', fontWeight: 'bold' }}>{columnName}</Typography>; | ||
|
||
return ( | ||
<Box sx={{ display: 'flex', flexDirection: 'column' }}> | ||
<Box sx={{ display: 'flex', flexDirection: 'row', gap: '0.5rem', alignItems: 'center' }}> | ||
<Typography | ||
sx={{ | ||
fontSize: '0.875rem', | ||
fontWeight: 'bold', | ||
color: Theme.palette.primary.main, | ||
}} | ||
> | ||
{gridColumnsAggregation[columnName].action.toUpperCase()} | ||
</Typography> | ||
<Typography sx={{ fontSize: '0.875rem', fontWeight: 'bold' }}>{columnName}</Typography> | ||
</Box> | ||
<Typography sx={{ fontSize: '0.75rem', fontWeight: 'bold', color: Theme.palette.primary.main }}> | ||
{gridColumnsAggregation[columnName].value} | ||
</Typography> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { EditorColumnMenuAggregationActions } from '@/features/editor/types'; | ||
|
||
export interface ColumnAggregation { | ||
[field: string]: { action: EditorColumnMenuAggregationActions; value: string }; | ||
} |
8 changes: 8 additions & 0 deletions
8
app/front-end/src/features/editor/types/editorColumnMenuAggregationActions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export enum EditorColumnMenuAggregationActions { | ||
NONE = '', | ||
SUM = 'sum', | ||
AVG = 'avg', | ||
MIN = 'min', | ||
MAX = 'max', | ||
COUNT = 'cnt', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export type { ColumnAggregation } from './columnAggregation'; | ||
export { ConsoleFeedbackTypes } from './consoleFeedback'; | ||
export type { ConsoleFeedback } from './consoleFeedback'; | ||
export { EditorColumnMenuAggregationActions } from './editorColumnMenuAggregationActions'; | ||
export type { FileDataRequestDTO, FileDataResponseDTO } from './fileData'; | ||
export { FileTreeItemContextMenuActions } from './fileTreeItemContextMenuActions'; | ||
export type { FileTreeViewItemProps } from './fileTreeViewItemProps'; |