Skip to content

Commit 7584667

Browse files
fix: when click on label in radio or checkbox widget it's border not visible
1 parent b99d8e6 commit 7584667

File tree

2 files changed

+32
-36
lines changed

2 files changed

+32
-36
lines changed

apps/OpenSign/src/components/pdf/Placeholder.js

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ function Placeholder(props) {
168168
};
169169
}, [isShowDateFormat]);
170170

171-
//onclick placeholder function to open signature pad
172-
const handlePlaceholderClick = () => {
171+
//`handleWidgetIdandPopup` is used to set current widget id and open relative popup
172+
const handleWidgetIdandPopup = () => {
173173
if (props.setSelectWidgetId) {
174174
props.setSelectWidgetId(props.pos.key);
175175
}
@@ -238,9 +238,18 @@ function Placeholder(props) {
238238
}
239239
}
240240
};
241-
242-
//function to set state value of onclick on widget's setting icon
243-
const handleWidgetsOnclick = () => {
241+
const handleOnClickPlaceholder = () => {
242+
if (!props.isNeedSign) {
243+
props.setWidgetType(props.pos.type);
244+
}
245+
if (props.isNeedSign && props.data?.signerObjId === props.signerObjId) {
246+
handleWidgetIdandPopup();
247+
} else if (props.isPlaceholder || props.isSignYourself) {
248+
handleWidgetIdandPopup();
249+
}
250+
};
251+
//`handleOnClickSettingIcon` is used set current widget details and open setting of it
252+
const handleOnClickSettingIcon = () => {
244253
if (props.pos.type === radioButtonWidget) {
245254
props.setIsRadio(true);
246255
} else if (props.pos.type === "dropdown") {
@@ -312,11 +321,11 @@ function Placeholder(props) {
312321
<i
313322
onClick={(e) => {
314323
e.stopPropagation();
315-
handleWidgetsOnclick();
324+
handleOnClickSettingIcon();
316325
}}
317326
onTouchEnd={(e) => {
318327
e.stopPropagation();
319-
handleWidgetsOnclick();
328+
handleOnClickSettingIcon();
320329
}}
321330
className="fa-solid fa-gear settingIcon"
322331
style={{
@@ -335,11 +344,11 @@ function Placeholder(props) {
335344
<i
336345
onClick={(e) => {
337346
e.stopPropagation();
338-
handleWidgetsOnclick();
347+
handleOnClickSettingIcon();
339348
}}
340349
onTouchEnd={(e) => {
341350
e.stopPropagation();
342-
handleWidgetsOnclick();
351+
handleOnClickSettingIcon();
343352
}}
344353
className="fa-solid fa-gear settingIcon"
345354
style={{
@@ -622,14 +631,7 @@ function Placeholder(props) {
622631
false
623632
);
624633
}}
625-
onClick={() => {
626-
!props.isNeedSign && props.setWidgetType(props.pos.type);
627-
props.isNeedSign && props.data?.signerObjId === props.signerObjId
628-
? handlePlaceholderClick()
629-
: props.isPlaceholder
630-
? handlePlaceholderClick()
631-
: props.isSignYourself && handlePlaceholderClick();
632-
}}
634+
onClick={() => handleOnClickPlaceholder()}
633635
>
634636
{props.isShowBorder &&
635637
props.pos.type !== radioButtonWidget &&
@@ -679,14 +681,7 @@ function Placeholder(props) {
679681
// height: props.posHeight(props.pos, props.isSignYourself),
680682
zIndex: "10"
681683
}}
682-
onTouchEnd={() => {
683-
!props.isNeedSign && props.setWidgetType(props.pos.type);
684-
props.isNeedSign && props.data?.signerObjId === props.signerObjId
685-
? handlePlaceholderClick()
686-
: props.isPlaceholder
687-
? handlePlaceholderClick()
688-
: props.isSignYourself && handlePlaceholderClick();
689-
}}
684+
onTouchEnd={() => handleOnClickPlaceholder()}
690685
>
691686
{props.pos.key === props.selectWidgetId && <PlaceholderIcon />}
692687

apps/OpenSign/src/components/pdf/PlaceholderType.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,14 @@ function PlaceholderType(props) {
332332
<div style={{ zIndex: props.isSignYourself && "99" }}>
333333
{props.pos.options?.values?.map((data, ind) => {
334334
return (
335-
<div key={ind} className="flex items-center gap-1 min-w-max">
335+
<div key={ind} className="flex items-center text-center gap-0.5">
336336
<input
337337
id={data}
338338
style={{
339339
width: props.pos.Width,
340340
display: "flex",
341341
justifyContent: "center",
342-
marginBottom: "6px",
343-
marginTop: "5px"
342+
marginTop: ind === 0 ? 0 : "5px"
344343
}}
345344
onBlur={handleInputBlur}
346345
disabled={
@@ -375,7 +374,10 @@ function PlaceholderType(props) {
375374
}}
376375
/>
377376
{!props.pos.options?.isHideLabel && (
378-
<label htmlFor={data} className="text-xs">
377+
<label
378+
htmlFor={!props.isPlaceholder && data}
379+
className="text-xs mb-0 text-center"
380+
>
379381
{data}
380382
</label>
381383
)}
@@ -710,18 +712,14 @@ function PlaceholderType(props) {
710712
<div>
711713
{props.pos.options?.values.map((data, ind) => {
712714
return (
713-
<div
714-
key={ind}
715-
className="flex flex-row items-center gap-1 min-w-max"
716-
>
715+
<div key={ind} className="flex items-center text-center gap-0.5">
717716
<input
718717
id={data}
719718
style={{
720719
width: props.pos.Width,
721720
display: "flex",
722721
justifyContent: "center",
723-
marginBottom: "6px",
724-
marginTop: "5px"
722+
marginTop: ind === 0 ? 0 : "5px"
725723
}}
726724
type="radio"
727725
disabled={
@@ -737,7 +735,10 @@ function PlaceholderType(props) {
737735
}}
738736
/>
739737
{!props.pos.options?.isHideLabel && (
740-
<label htmlFor={data} className="text-xs">
738+
<label
739+
htmlFor={!props.isPlaceholder && data}
740+
className="text-xs mb-0"
741+
>
741742
{data}
742743
</label>
743744
)}

0 commit comments

Comments
 (0)