Skip to content

Commit 1cefe01

Browse files
Merge pull request #499 from OpenSignLabs/fix_mobile_issue
fix: width issue of text widget & default data for widgets information pop-ups in mobile display.
2 parents cf21ac7 + f1cf395 commit 1cefe01

File tree

7 files changed

+72
-30
lines changed

7 files changed

+72
-30
lines changed

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ function Placeholder(props) {
215215
"company",
216216
"job title",
217217
"date",
218-
"email"
218+
"email",
219+
textWidget
219220
].includes(props.pos.type);
220221

221222
if (widgetTypeExist) {
@@ -594,7 +595,7 @@ function Placeholder(props) {
594595
disableDragging={
595596
props.isNeedSign
596597
? true
597-
: props.isPlaceholder && props.pos.type !== "date"
598+
: props.isPlaceholder && ![textWidget].includes(props.pos.type)
598599
? false
599600
: !isDraggingEnabled
600601
}
@@ -652,8 +653,18 @@ function Placeholder(props) {
652653
style={{
653654
left: props.xPos(props.pos, props.isSignYourself),
654655
top: props.yPos(props.pos, props.isSignYourself),
655-
width: "auto", //props.posWidth(props.pos, props.isSignYourself),
656+
width:
657+
props.pos.type === radioButtonWidget ||
658+
props.pos.type === "checkbox"
659+
? "auto"
660+
: props.posWidth(props.pos, props.isSignYourself),
661+
// "auto", //props.posWidth(props.pos, props.isSignYourself),
656662
// height: props.posHeight(props.pos, props.isSignYourself),
663+
height:
664+
props.pos.type === radioButtonWidget ||
665+
props.pos.type === "checkbox"
666+
? "auto"
667+
: props.posHeight(props.pos, props.isSignYourself),
657668
zIndex: "10"
658669
}}
659670
onTouchEnd={() => handleOnClickPlaceholder()}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
defaultWidthHeight,
55
isMobile,
66
radioButtonWidget,
7-
resizeBorderExtraWidth
7+
resizeBorderExtraWidth,
8+
textWidget
89
} from "../../constant/Utils";
910
function PlaceholderBorder(props) {
1011
const getResizeBorderExtraWidth = resizeBorderExtraWidth();
@@ -31,7 +32,10 @@ function PlaceholderBorder(props) {
3132
};
3233
return (
3334
<div
34-
onMouseEnter={!isMobile && props?.setDraggingEnabled(true)}
35+
onMouseEnter={() => !isMobile && props?.setDraggingEnabled(true)}
36+
onTouchEnd={() =>
37+
props.pos.type === textWidget && props?.setDraggingEnabled(true)
38+
}
3539
className="borderResize"
3640
style={{
3741
borderColor: themeColor,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect, useState, forwardRef, useRef } from "react";
22
import {
33
getMonth,
44
getYear,
5+
isMobile,
56
onChangeInput,
67
radioButtonWidget,
78
range,
@@ -741,6 +742,7 @@ function PlaceholderType(props) {
741742
placeholder="Enter label"
742743
rows={1}
743744
value={textValue}
745+
onBlur={handleInputBlur}
744746
onChange={(e) => {
745747
setTextValue(e.target.value);
746748
onChangeInput(
@@ -753,7 +755,11 @@ function PlaceholderType(props) {
753755
false
754756
);
755757
}}
756-
className="labelTextArea"
758+
className={
759+
isMobile
760+
? "labelTextArea labelWidthMobile"
761+
: "labelTextArea labelWidthDesktop"
762+
}
757763
style={{ whiteSpace: "pre-wrap" }}
758764
cols="50"
759765
/>

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,15 @@ const WidgetNameModal = (props) => {
129129
>
130130
<div style={{ width: "100%", position: "relative" }}>
131131
<input
132-
style={{
133-
padding: "0.5rem 0.75rem",
134-
width: "92%",
135-
borderWidth: "1px",
136-
borderColor: "#d1d5db",
137-
borderTopLeftRadius: "0.375rem",
138-
borderBottomLeftRadius: "0.375rem",
139-
outline: "none",
140-
fontSize: "0.75rem",
141-
position: "relative",
142-
zIndex: 2
143-
}}
132+
className="relative z-20 w-[87%] md:w-[92%] p-2.5 border-[1px] border-[#d1d5db] rounded-l-md outline-none text-xs"
144133
name="textvalidate"
145134
placeholder="Enter custom expression"
146135
value={formdata.textvalidate}
147136
onChange={(e) => handleChange(e)}
148137
// onBlur={() => handleBlurRegex()}
149138
/>
150139
<select
151-
style={{ position: "absolute", left: 0, zIndex: 1 }}
152-
className="addUserInput"
140+
className="validationlist addUserInput"
153141
name="textvalidate"
154142
value={formdata.textvalidate}
155143
onChange={(e) => handleChange(e)}

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@ function PlaceHolderSign() {
317317

318318
//function for setting position after drop signature button over pdf
319319
const addPositionOfSignature = (item, monitor) => {
320-
if (item && item.text) {
321-
setWidgetName(item.text);
322-
}
323320
getSignerPos(item, monitor);
324321
};
325322

@@ -336,7 +333,6 @@ function PlaceHolderSign() {
336333
let dropData = [];
337334
let placeHolder;
338335
const dragTypeValue = item?.text ? item.text : monitor.type;
339-
340336
if (item === "onclick") {
341337
const dropObj = {
342338
//onclick put placeholder center on pdf
@@ -487,10 +483,11 @@ function PlaceHolderSign() {
487483
setIsCheckbox(true);
488484
} else if (dragTypeValue === radioButtonWidget) {
489485
setIsRadio(true);
490-
}
486+
}
491487
setWidgetType(dragTypeValue);
492488
setSignKey(key);
493489
setCurrWidgetsDetails({});
490+
setWidgetName(dragTypeValue);
494491
}
495492
}
496493
};
@@ -1755,7 +1752,6 @@ function PlaceHolderSign() {
17551752
</button>
17561753
</div>
17571754
</ModalUi>
1758-
17591755
<LinkUserModal
17601756
handleAddUser={handleAddUser}
17611757
isAddUser={isAddUser}

apps/OpenSign/src/styles/AddUser.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
color: #ffffff;
6161
outline: none;
6262
}
63+
6364
/* For classes: bg-[#188ae2] text-sm text-white px-4 py-2 rounded ml-2 shadow focus:outline-none */
6465
.resetbutton {
6566
background-color: #188ae2;
@@ -75,3 +76,29 @@
7576
outline: none;
7677
margin-left: 8px;
7778
}
79+
80+
.validationlist {
81+
position: absolute;
82+
left: 0;
83+
z-index: 1;
84+
appearance: none;
85+
-moz-appearance: "none";
86+
-webkit-appearance: "none";
87+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAnUlEQVR4nO2QMQrCQBBFX51NbWMp2uox7Gw8h22uYEguIZNKyB0lMIElTNzdGBvdB8PC8Gces5DJ/Cxn4Aa4QM5pbsgncQF6rQYoZ3IFcPey11jByRsaqzYuctqfZo8xki3QBURuRtDpfBQ74GEsaYHN5It8wYFEhgExlj2NniwRhC7qP70gRSRrCN6JZE2BJZJvCEb2QKVvJvMvvAD2WzaK/35kGAAAAABJRU5ErkJggg==");
88+
background-repeat: no-repeat;
89+
background-position: right 0.7rem top 50%;
90+
background-size: 1rem auto;
91+
}
92+
93+
94+
@media (max-width: 375px) {
95+
.validationlist {
96+
background-position: right 0.5rem top 50%;
97+
}
98+
}
99+
100+
@media (min-width:375px) and (max-width: 767px) {
101+
.validationlist {
102+
background-position: right 1rem top 50%;
103+
}
104+
}

apps/OpenSign/src/styles/signature.css

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,10 +837,18 @@ option {
837837
justify-content: flex-start;
838838
}
839839

840-
.labelTextArea {
841-
font-size: 12px;
840+
.labelWidthDesktop {
842841
min-width: 100%;
843842
min-height: 100%;
843+
}
844+
845+
.labelWidthMobile {
846+
width: 100%;
847+
height: 100%;
848+
}
849+
850+
.labelTextArea {
851+
font-size: 12px;
844852
border: 1px solid #007bff;
845853
outline: none;
846854
z-index: 999;
@@ -944,7 +952,7 @@ option {
944952
to prevent sudden quick movement (as the
945953
navigation bar gets a new position at the top of the
946954
page (position:fixed and top:0) */
947-
.stickyHead + .content {
955+
.stickyHead+.content {
948956
padding-top: 60px;
949957
}
950958

@@ -1173,6 +1181,7 @@ option {
11731181
font-size: 12px;
11741182
margin-left: 5px;
11751183
}
1184+
11761185
.defaultOptions:focus {
11771186
outline: none;
11781187
}
@@ -1191,6 +1200,7 @@ option {
11911200
min-width: 90%;
11921201
overflow-y: auto;
11931202
}
1203+
11941204
.signatureBtn {
11951205
width: max-content;
11961206
}
@@ -1224,4 +1234,4 @@ option {
12241234
min-width: 78%;
12251235
overflow-y: auto;
12261236
}
1227-
}
1237+
}

0 commit comments

Comments
 (0)