From 627dd3c9f58dcbd2aeeafa8b4115f54094e35c5a Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Thu, 16 Nov 2023 10:01:20 -0600 Subject: [PATCH] CE-740 more widget padding changes --- .../components/widgets/DashboardWidgets.tsx | 12 +++- src/qqq/components/widgets/ParentWidget.tsx | 11 +++- src/qqq/components/widgets/Widget.tsx | 60 +++++++++---------- .../components/widgets/misc/ScriptViewer.tsx | 8 +-- 4 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/qqq/components/widgets/DashboardWidgets.tsx b/src/qqq/components/widgets/DashboardWidgets.tsx index 22ffe0a..28b3858 100644 --- a/src/qqq/components/widgets/DashboardWidgets.tsx +++ b/src/qqq/components/widgets/DashboardWidgets.tsx @@ -497,6 +497,11 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit ); }; + if(wrapWidgetsInTabPanels) + { + omitWrappingGridContainer = true; + } + const body: JSX.Element = ( <> @@ -515,7 +520,12 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit if (wrapWidgetsInTabPanels) { - renderedWidget = ( + renderedWidget = ( {renderedWidget} ); } diff --git a/src/qqq/components/widgets/ParentWidget.tsx b/src/qqq/components/widgets/ParentWidget.tsx index 86235a1..dd0ac06 100644 --- a/src/qqq/components/widgets/ParentWidget.tsx +++ b/src/qqq/components/widgets/ParentWidget.tsx @@ -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 // /////////////////////////////////////////////////////////////////////////////////////////// - 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 ( qInstance && data ? ( diff --git a/src/qqq/components/widgets/Widget.tsx b/src/qqq/components/widgets/Widget.tsx index 9bc0917..b2a7f42 100644 --- a/src/qqq/components/widgets/Widget.tsx +++ b/src/qqq/components/widgets/Widget.tsx @@ -64,6 +64,7 @@ interface Props isChild?: boolean; footerHTML?: string; storeDropdownSelections?: boolean; + omitPadding: boolean; } Widget.defaultProps = { @@ -74,6 +75,7 @@ Widget.defaultProps = { labelAdditionalComponentsLeft: [], labelAdditionalElementsLeft: [], labelAdditionalComponentsRight: [], + omitPadding: false, }; @@ -460,7 +462,7 @@ function Widget(props: React.PropsWithChildren): JSX.Element ////////////////////////////////////////////////////////////////////////////////////////// const labelToUse = props.widgetData?.label ?? props.widgetMetaData?.label let labelElement = ( - + {labelToUse} ); @@ -480,21 +482,17 @@ function Widget(props: React.PropsWithChildren): JSX.Element { hasPermission ? props.widgetMetaData?.icon && ( - {props.widgetMetaData.icon} @@ -502,20 +500,17 @@ function Widget(props: React.PropsWithChildren): JSX.Element ) : ( - lock @@ -583,11 +578,12 @@ function Widget(props: React.PropsWithChildren): JSX.Element } ; + const padding = props.omitPadding? "auto" : "24px 16px"; return props.widgetMetaData?.isCard - ? + ? {widgetContent} - : {widgetContent}; + : {widgetContent}; } export default Widget; diff --git a/src/qqq/components/widgets/misc/ScriptViewer.tsx b/src/qqq/components/widgets/misc/ScriptViewer.tsx index 51266cb..9c1dbcc 100644 --- a/src/qqq/components/widgets/misc/ScriptViewer.tsx +++ b/src/qqq/components/widgets/misc/ScriptViewer.tsx @@ -392,14 +392,8 @@ export default function ScriptViewer({scriptId, associatedScriptTableName, assoc return JSON.stringify(new QQueryFilter([new QFilterCriteria("scriptRevisionId", QCriteriaOperator.EQUALS, [scriptRevisionId])])); } - /* - position: relative; - left: -356px; - width: calc(100% + 380px); - */ - return ( - + {