CE-740 more widget padding changes

This commit is contained in:
2023-11-16 10:01:20 -06:00
parent 40ac89dac3
commit 627dd3c9f5
4 changed files with 49 additions and 42 deletions

View File

@ -497,6 +497,11 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit
); );
}; };
if(wrapWidgetsInTabPanels)
{
omitWrappingGridContainer = true;
}
const body: JSX.Element = const body: JSX.Element =
( (
<> <>
@ -515,7 +520,12 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit
if (wrapWidgetsInTabPanels) if (wrapWidgetsInTabPanels)
{ {
renderedWidget = (<TabPanel index={i} value={selectedTab} style={{padding: "1rem 0 0 1.25rem", width: "100%", marginBottom: "-1.5rem"}}> renderedWidget = (<TabPanel index={i} value={selectedTab} style={{
padding: 0,
margin: "-1rem",
marginBottom: "-3.5rem",
width: "calc(100% + 2rem)"
}}>
{renderedWidget} {renderedWidget}
</TabPanel>); </TabPanel>);
} }

View File

@ -106,9 +106,15 @@ function ParentWidget({urlParams, widgetMetaData, widgetIndex, data, reloadWidge
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// if this parent widget is in card form, and its children are too, then we need some px // // if this parent widget is in card form, and its children are too, then we need some px //
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
const px = (widgetMetaData && widgetMetaData.isCard && widgets && widgets[0] && widgets[0].isCard) ? 3 : 0; const parentIsCard = widgetMetaData && widgetMetaData.isCard;
const childrenAreCards = widgetMetaData && widgets && widgets[0] && widgets[0].isCard;
const px = (parentIsCard && childrenAreCards) ? 3 : 0;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// if this is a parent, which is not a card, then we need to omit the padding, i think, on the Widget that ultimately gets rendered //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const omitPadding = !parentIsCard;
// @ts-ignore
return ( return (
qInstance && data ? ( qInstance && data ? (
<Widget <Widget
@ -116,6 +122,7 @@ function ParentWidget({urlParams, widgetMetaData, widgetIndex, data, reloadWidge
widgetData={data} widgetData={data}
storeDropdownSelections={storeDropdownSelections} storeDropdownSelections={storeDropdownSelections}
reloadWidgetCallback={parentReloadWidgetCallback} reloadWidgetCallback={parentReloadWidgetCallback}
omitPadding={omitPadding}
> >
<Box sx={{height: "100%", width: "100%"}} px={px}> <Box sx={{height: "100%", width: "100%"}} px={px}>
<DashboardWidgets widgetMetaDataList={widgets} entityPrimaryKey={entityPrimaryKey} tableName={tableName} childUrlParams={childUrlParams} areChildren={true} parentWidgetMetaData={widgetMetaData} wrapWidgetsInTabPanels={data.layoutType == "TABS"}/> <DashboardWidgets widgetMetaDataList={widgets} entityPrimaryKey={entityPrimaryKey} tableName={tableName} childUrlParams={childUrlParams} areChildren={true} parentWidgetMetaData={widgetMetaData} wrapWidgetsInTabPanels={data.layoutType == "TABS"}/>

View File

@ -64,6 +64,7 @@ interface Props
isChild?: boolean; isChild?: boolean;
footerHTML?: string; footerHTML?: string;
storeDropdownSelections?: boolean; storeDropdownSelections?: boolean;
omitPadding: boolean;
} }
Widget.defaultProps = { Widget.defaultProps = {
@ -74,6 +75,7 @@ Widget.defaultProps = {
labelAdditionalComponentsLeft: [], labelAdditionalComponentsLeft: [],
labelAdditionalElementsLeft: [], labelAdditionalElementsLeft: [],
labelAdditionalComponentsRight: [], labelAdditionalComponentsRight: [],
omitPadding: false,
}; };
@ -460,7 +462,7 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
const labelToUse = props.widgetData?.label ?? props.widgetMetaData?.label const labelToUse = props.widgetData?.label ?? props.widgetMetaData?.label
let labelElement = ( let labelElement = (
<Typography sx={{cursor: "default"}} variant="h6" display="inline"> <Typography sx={{cursor: "default", pl: props.widgetMetaData.isCard ? "auto" : "1rem", pt: props.widgetMetaData.type == "parentWidget" ? "1rem" : "auto"}} variant="h6" display="inline">
{labelToUse} {labelToUse}
</Typography> </Typography>
); );
@ -480,21 +482,17 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
{ {
hasPermission ? hasPermission ?
props.widgetMetaData?.icon && ( props.widgetMetaData?.icon && (
<Box <Box ml={1} mr={2} mt={-4} sx={{
ml={1} display: "flex",
mr={2} justifyContent: "center",
mt={-4} alignItems: "center",
sx={{ width: "64px",
display: "flex", height: "64px",
justifyContent: "center", borderRadius: "8px",
alignItems: "center", background: colors.info.main,
width: "64px", color: "#ffffff",
height: "64px", float: "left"
borderRadius: "8px", }}
background: colors.info.main,
color: "#ffffff",
float: "left"
}}
> >
<Icon fontSize="medium" color="inherit"> <Icon fontSize="medium" color="inherit">
{props.widgetMetaData.icon} {props.widgetMetaData.icon}
@ -502,20 +500,17 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
</Box> </Box>
) : ) :
( (
<Box <Box ml={3} mt={-4} sx={{
ml={3} display: "flex",
mt={-4} justifyContent: "center",
sx={{ alignItems: "center",
display: "flex", width: "64px",
justifyContent: "center", height: "64px",
alignItems: "center", borderRadius: "8px",
width: "64px", background: colors.info.main,
height: "64px", color: "#ffffff",
borderRadius: "8px", float: "left"
background: colors.info.main, }}
color: "#ffffff",
float: "left"
}}
> >
<Icon fontSize="medium" color="inherit">lock</Icon> <Icon fontSize="medium" color="inherit">lock</Icon>
</Box> </Box>
@ -583,11 +578,12 @@ function Widget(props: React.PropsWithChildren<Props>): JSX.Element
} }
</Box>; </Box>;
const padding = props.omitPadding? "auto" : "24px 16px";
return props.widgetMetaData?.isCard return props.widgetMetaData?.isCard
? <Card sx={{marginTop: props.widgetMetaData?.icon ? 2 : 0, width: "100%", py: "24px", px: "16px"}} className={fullScreenWidgetClassName}> ? <Card sx={{marginTop: props.widgetMetaData?.icon ? 2 : 0, width: "100%", p: padding}} className={fullScreenWidgetClassName}>
{widgetContent} {widgetContent}
</Card> </Card>
: <span style={{width: "100%"}}>{widgetContent}</span>; : <span style={{width: "100%", padding: padding}}>{widgetContent}</span>;
} }
export default Widget; export default Widget;

View File

@ -392,14 +392,8 @@ export default function ScriptViewer({scriptId, associatedScriptTableName, assoc
return JSON.stringify(new QQueryFilter([new QFilterCriteria("scriptRevisionId", QCriteriaOperator.EQUALS, [scriptRevisionId])])); return JSON.stringify(new QQueryFilter([new QFilterCriteria("scriptRevisionId", QCriteriaOperator.EQUALS, [scriptRevisionId])]));
} }
/*
position: relative;
left: -356px;
width: calc(100% + 380px);
*/
return ( return (
<Grid container className="scriptViewer"> <Grid container className="scriptViewer" m={-2} pt={4} width={"calc(100% + 2rem)"}>
<Grid item xs={12}> <Grid item xs={12}>
<Box> <Box>
{ {