From 7584667643dc4187b1986a55d33dc8c449420379 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Thu, 14 Mar 2024 18:35:40 +0530 Subject: [PATCH 1/2] fix: when click on label in radio or checkbox widget it's border not visible --- .../src/components/pdf/Placeholder.js | 45 +++++++++---------- .../src/components/pdf/PlaceholderType.js | 23 +++++----- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 81a645067..d7c8f7d36 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -168,8 +168,8 @@ function Placeholder(props) { }; }, [isShowDateFormat]); - //onclick placeholder function to open signature pad - const handlePlaceholderClick = () => { + //`handleWidgetIdandPopup` is used to set current widget id and open relative popup + const handleWidgetIdandPopup = () => { if (props.setSelectWidgetId) { props.setSelectWidgetId(props.pos.key); } @@ -238,9 +238,18 @@ function Placeholder(props) { } } }; - - //function to set state value of onclick on widget's setting icon - const handleWidgetsOnclick = () => { + const handleOnClickPlaceholder = () => { + if (!props.isNeedSign) { + props.setWidgetType(props.pos.type); + } + if (props.isNeedSign && props.data?.signerObjId === props.signerObjId) { + handleWidgetIdandPopup(); + } else if (props.isPlaceholder || props.isSignYourself) { + handleWidgetIdandPopup(); + } + }; + //`handleOnClickSettingIcon` is used set current widget details and open setting of it + const handleOnClickSettingIcon = () => { if (props.pos.type === radioButtonWidget) { props.setIsRadio(true); } else if (props.pos.type === "dropdown") { @@ -312,11 +321,11 @@ function Placeholder(props) { { e.stopPropagation(); - handleWidgetsOnclick(); + handleOnClickSettingIcon(); }} onTouchEnd={(e) => { e.stopPropagation(); - handleWidgetsOnclick(); + handleOnClickSettingIcon(); }} className="fa-solid fa-gear settingIcon" style={{ @@ -335,11 +344,11 @@ function Placeholder(props) { { e.stopPropagation(); - handleWidgetsOnclick(); + handleOnClickSettingIcon(); }} onTouchEnd={(e) => { e.stopPropagation(); - handleWidgetsOnclick(); + handleOnClickSettingIcon(); }} className="fa-solid fa-gear settingIcon" style={{ @@ -622,14 +631,7 @@ function Placeholder(props) { false ); }} - onClick={() => { - !props.isNeedSign && props.setWidgetType(props.pos.type); - props.isNeedSign && props.data?.signerObjId === props.signerObjId - ? handlePlaceholderClick() - : props.isPlaceholder - ? handlePlaceholderClick() - : props.isSignYourself && handlePlaceholderClick(); - }} + onClick={() => handleOnClickPlaceholder()} > {props.isShowBorder && props.pos.type !== radioButtonWidget && @@ -679,14 +681,7 @@ function Placeholder(props) { // height: props.posHeight(props.pos, props.isSignYourself), zIndex: "10" }} - onTouchEnd={() => { - !props.isNeedSign && props.setWidgetType(props.pos.type); - props.isNeedSign && props.data?.signerObjId === props.signerObjId - ? handlePlaceholderClick() - : props.isPlaceholder - ? handlePlaceholderClick() - : props.isSignYourself && handlePlaceholderClick(); - }} + onTouchEnd={() => handleOnClickPlaceholder()} > {props.pos.key === props.selectWidgetId && } diff --git a/apps/OpenSign/src/components/pdf/PlaceholderType.js b/apps/OpenSign/src/components/pdf/PlaceholderType.js index 71614bd8b..8f5b78ce8 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderType.js +++ b/apps/OpenSign/src/components/pdf/PlaceholderType.js @@ -332,15 +332,14 @@ function PlaceholderType(props) {
{props.pos.options?.values?.map((data, ind) => { return ( -
+
{!props.pos.options?.isHideLabel && ( -
{props.pos.options?.values.map((data, ind) => { return ( -
+
{!props.pos.options?.isHideLabel && ( - ) : ( @@ -351,19 +370,7 @@ function Placeholder(props) { handleOnClickSettingIcon(); }} className="fa-solid fa-gear settingIcon" - style={{ - color: "#188ae2", - right: ["checkbox", radioButtonWidget].includes( - props.pos.type - ) - ? "24px" - : "47px", - top: ["checkbox", radioButtonWidget].includes( - props.pos.type - ) - ? "-28px" - : "-19px" - }} + style={{ color: "#188ae2", right: "47px", top: "-19px" }} > ) )} @@ -382,19 +389,7 @@ function Placeholder(props) { props.handleLinkUser(props.data.Id); props.setUniqueId(props.data.Id); }} - style={{ - color: "#188ae2", - right: - props.pos.type === "checkbox" || - props.pos.type === radioButtonWidget - ? "8px" - : "32px", - top: - props.pos.type === "checkbox" || - props.pos.type === radioButtonWidget - ? "-28px" - : "-18px" - }} + style={{ color: "#188ae2", right: "32px", top: "-18px" }} > )} @@ -472,19 +467,7 @@ function Placeholder(props) { className="fa-regular fa-copy signCopy" onClick={(e) => handleCopyPlaceholder(e)} onTouchEnd={(e) => handleCopyPlaceholder(e)} - style={{ - color: "#188ae2", - right: - props.pos.type === "checkbox" || - props.pos.type === radioButtonWidget - ? "-9px" - : "12px", - top: - props.pos.type === "checkbox" || - props.pos.type === radioButtonWidget - ? "-28px" - : "-18px" - }} + style={{ color: "#188ae2", right: "12px", top: "-18px" }} > ) @@ -528,6 +499,7 @@ function Placeholder(props) { return ( + ) : props.data && props.isNeedSign && props.pos.type !== "checkbox" ? ( props.data?.signerObjId === props.signerObjId && props.pos.type !== radioButtonWidget && @@ -670,6 +629,7 @@ function Placeholder(props) { setDraggingEnabled={setDraggingEnabled} pos={props.pos} isPlaceholder={props.isPlaceholder} + getCheckboxRenderWidth={getCheckboxRenderWidth} /> )} {isMobile ? ( @@ -677,7 +637,7 @@ function Placeholder(props) { style={{ left: props.xPos(props.pos, props.isSignYourself), top: props.yPos(props.pos, props.isSignYourself), - width: props.posWidth(props.pos, props.isSignYourself), + width: "auto", //props.posWidth(props.pos, props.isSignYourself), // height: props.posHeight(props.pos, props.isSignYourself), zIndex: "10" }} diff --git a/apps/OpenSign/src/components/pdf/PlaceholderBorder.js b/apps/OpenSign/src/components/pdf/PlaceholderBorder.js index 22907f296..f209307c2 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderBorder.js +++ b/apps/OpenSign/src/components/pdf/PlaceholderBorder.js @@ -6,16 +6,13 @@ import { resizeBorderExtraWidth } from "../../constant/Utils"; function PlaceholderBorder(props) { - const getResizeBorderExtraWidth = - props.pos.type === "checkbox" || props.pos.type === radioButtonWidget - ? 38 - : resizeBorderExtraWidth(); + const getResizeBorderExtraWidth = resizeBorderExtraWidth(); const defaultWidth = defaultWidthHeight(props.pos.type).width; const defaultHeight = defaultWidthHeight(props.pos.type).height; const handleMinWidth = () => { if (props.pos.type === "checkbox" || props.pos.type === radioButtonWidget) { - return "120%"; + return props.getCheckboxRenderWidth.width + getResizeBorderExtraWidth; } else { return props.pos.Width ? props.pos.Width + getResizeBorderExtraWidth @@ -24,7 +21,7 @@ function PlaceholderBorder(props) { }; const handleMinHeight = () => { if (props.pos.type === "checkbox" || props.pos.type === radioButtonWidget) { - return "120%"; + return props.getCheckboxRenderWidth.height + getResizeBorderExtraWidth; } else { return props.pos.Height ? props.pos.Height + getResizeBorderExtraWidth diff --git a/apps/OpenSign/src/styles/signature.css b/apps/OpenSign/src/styles/signature.css index 47c3d9e73..8229cdb05 100644 --- a/apps/OpenSign/src/styles/signature.css +++ b/apps/OpenSign/src/styles/signature.css @@ -339,8 +339,6 @@ display: flex !important; justify-content: center !important; align-items: center !important; - min-width:max-content; - min-height: max-content; } .finishBtn {