mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
table formatting
This commit is contained in:
@@ -206,34 +206,63 @@ const DashboardData: FC = () => {
|
||||
border-top: 1px solid transparent;
|
||||
border-right: 1px solid transparent;
|
||||
border-bottom: 1px solid transparent;
|
||||
&:not(.stiff) > div {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
&:nth-of-type(1) {
|
||||
padding-left: 16px;
|
||||
width: 260px;
|
||||
min-width: 260px;
|
||||
}
|
||||
&:nth-of-type(4) {
|
||||
padding-left: 16px;
|
||||
}
|
||||
width: 124px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
&:last-of-type {
|
||||
&:nth-of-type(2) {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
}
|
||||
&:last-of-type {
|
||||
padding-left: 0px;
|
||||
text-align: center;
|
||||
width: 32px;
|
||||
min-width: 32px;
|
||||
max-width: 32px;
|
||||
}
|
||||
`,
|
||||
HeaderCell: `
|
||||
padding-left: 8px;
|
||||
&:nth-of-type(1) {
|
||||
padding-left: 8px;
|
||||
}
|
||||
&:nth-of-type(4) {
|
||||
padding-left: 16px;
|
||||
}
|
||||
&:not(:last-of-type) {
|
||||
border-right: 1px solid #565656;
|
||||
padding-left: 8px;
|
||||
border-left: 1px solid #565656;
|
||||
}
|
||||
&:first-of-type {
|
||||
border-left: 0px;
|
||||
}
|
||||
`
|
||||
});
|
||||
|
||||
const temperature_theme = useTheme([data_theme]);
|
||||
|
||||
const analog_theme = useTheme([
|
||||
data_theme,
|
||||
{
|
||||
BaseCell: `
|
||||
&:nth-of-type(1) {
|
||||
width: 100px;
|
||||
min-width: 100px;
|
||||
}
|
||||
&:nth-of-type(2) {
|
||||
text-align: left;
|
||||
}
|
||||
&:nth-of-type(3) {
|
||||
width: 100px;
|
||||
min-width: 100px;
|
||||
}
|
||||
&:nth-of-type(4) {
|
||||
text-align: right;
|
||||
flex: 1;
|
||||
}
|
||||
`
|
||||
}
|
||||
]);
|
||||
|
||||
const getSortIcon = (state: any, sortKey: any) => {
|
||||
if (state.sortKey === sortKey && state.reverse) {
|
||||
return <KeyboardArrowDownOutlinedIcon />;
|
||||
@@ -746,12 +775,15 @@ const DashboardData: FC = () => {
|
||||
<Typography sx={{ pt: 2, pb: 1 }} variant="h6" color="primary">
|
||||
{deviceData.label}
|
||||
</Typography>
|
||||
|
||||
<FormControlLabel
|
||||
control={<Checkbox size="small" name="onlyFav" checked={onlyFav} onChange={() => setOnlyFav(!onlyFav)} />}
|
||||
label={<span style={{ fontSize: '12px' }}>show only favorites</span>}
|
||||
label={
|
||||
<span style={{ fontSize: '12px' }}>
|
||||
only show favorites
|
||||
<StarIcon color="primary" sx={{ fontSize: 12 }} />
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
|
||||
<Table
|
||||
data={{
|
||||
nodes: onlyFav
|
||||
@@ -760,7 +792,7 @@ const DashboardData: FC = () => {
|
||||
}}
|
||||
theme={data_theme}
|
||||
sort={dv_sort}
|
||||
// layout={{ custom: true }}
|
||||
layout={{ custom: true }}
|
||||
>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
@@ -776,10 +808,10 @@ const DashboardData: FC = () => {
|
||||
ENTITY NAME
|
||||
</Button>
|
||||
</HeaderCell>
|
||||
<HeaderCell resize>
|
||||
<HeaderCell>
|
||||
<Button
|
||||
fullWidth
|
||||
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
|
||||
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
|
||||
endIcon={getSortIcon(dv_sort.state, 'VALUE')}
|
||||
onClick={() => dv_sort.fns.onToggleSort({ sortKey: 'VALUE' })}
|
||||
>
|
||||
@@ -832,8 +864,12 @@ const DashboardData: FC = () => {
|
||||
<Typography sx={{ pt: 2, pb: 1 }} variant="h6" color="primary">
|
||||
Temperature Sensors
|
||||
</Typography>
|
||||
|
||||
<Table data={{ nodes: sensorData.sensors }} theme={data_theme} sort={sensor_sort}>
|
||||
<Table
|
||||
data={{ nodes: sensorData.sensors }}
|
||||
theme={temperature_theme}
|
||||
sort={sensor_sort}
|
||||
layout={{ custom: true }}
|
||||
>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
<Header>
|
||||
@@ -848,10 +884,10 @@ const DashboardData: FC = () => {
|
||||
NAME
|
||||
</Button>
|
||||
</HeaderCell>
|
||||
<HeaderCell resize>
|
||||
<HeaderCell>
|
||||
<Button
|
||||
fullWidth
|
||||
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
|
||||
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
|
||||
endIcon={getSortIcon(sensor_sort.state, 'TEMPERATURE')}
|
||||
onClick={() => sensor_sort.fns.onToggleSort({ sortKey: 'TEMPERATURE' })}
|
||||
>
|
||||
@@ -888,7 +924,7 @@ const DashboardData: FC = () => {
|
||||
Analog Sensors
|
||||
</Typography>
|
||||
|
||||
<Table data={{ nodes: sensorData.analogs }} theme={data_theme} sort={analog_sort}>
|
||||
<Table data={{ nodes: sensorData.analogs }} theme={analog_theme} sort={analog_sort} layout={{ custom: true }}>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
<Header>
|
||||
@@ -923,7 +959,7 @@ const DashboardData: FC = () => {
|
||||
TYPE
|
||||
</Button>
|
||||
</HeaderCell>
|
||||
<HeaderCell resize>VALUE</HeaderCell>
|
||||
<HeaderCell>VALUE</HeaderCell>
|
||||
<HeaderCell />
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
|
||||
Reference in New Issue
Block a user