Skip to content

Commit 356ab4e

Browse files
Merge pull request #1291 from OpenSignLabs/form-layout
fix: mobile view issue with text box widget design for value entry.
2 parents 572cb55 + 08b8346 commit 356ab4e

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
import React from "react";
22

3-
function BorderResize({ right, top }) {
3+
function BorderResize(props) {
4+
const getHeight = () => {
5+
const height = props.posHeight(props.pos, props.isSignYourself);
6+
if (height > 14) {
7+
return "14px";
8+
} else {
9+
return `${height}px`;
10+
}
11+
};
12+
413
return (
514
<div
6-
className={`${right ? `-right-[12px]` : "-right-[1px]"} ${
7-
top ? `-bottom-[11px]` : "-bottom-[1px]"
8-
} absolute inline-block w-[14px] h-[14px] hover:cursor-sw-resize border-r-[3px] border-b-[3px] border-[#188ae2]`}
15+
style={{
16+
width: getHeight() || "14px",
17+
height: getHeight() || "14px"
18+
}}
19+
className={`${props.right ? `-right-[12px]` : "-right-[2px]"} ${
20+
props.top ? `-bottom-[12px]` : "-bottom-[2px] "
21+
} absolute inline-block hover:cursor-sw-resize border-r-[3px] border-b-[3px] border-[#188ae2]`}
922
></div>
1023
);
1124
}

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,12 +791,22 @@ function Placeholder(props) {
791791
props.pos.type !== radioButtonWidget &&
792792
props.pos.type !== "checkbox" &&
793793
props.pos.key === props.selectWidgetId ? (
794-
<BorderResize right={-12} top={-11} />
794+
<BorderResize
795+
right={-12}
796+
top={-11}
797+
pos={props.pos}
798+
posHeight={props.posHeight}
799+
isSignYourself={props.isSignYourself}
800+
/>
795801
) : props.data && props.isNeedSign && props.pos.type !== "checkbox" ? (
796802
props.data?.signerObjId === props.signerObjId &&
797803
props.pos.type !== radioButtonWidget &&
798804
props.pos.type !== "checkbox" ? (
799-
<BorderResize />
805+
<BorderResize
806+
posHeight={props.posHeight}
807+
isSignYourself={props.isSignYourself}
808+
pos={props.pos}
809+
/>
800810
) : (
801811
<></>
802812
)
@@ -862,6 +872,7 @@ function Placeholder(props) {
862872
startDate={startDate}
863873
handleSaveDate={handleSaveDate}
864874
xPos={props.xPos}
875+
posHeight={props.posHeight}
865876
/>
866877
</div>
867878
) : (
@@ -889,6 +900,7 @@ function Placeholder(props) {
889900
startDate={startDate}
890901
handleSaveDate={handleSaveDate}
891902
xPos={props.xPos}
903+
posHeight={props.posHeight}
892904
/>
893905
</>
894906
)}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ function PlaceholderType(props) {
2929
const [textValue, setTextValue] = useState();
3030
const [selectedCheckbox, setSelectedCheckbox] = useState([]);
3131
const years = range(1990, getYear(new Date()) + 16, 1);
32-
const fontSize = (props.pos.options?.fontSize || "12") + "px";
32+
const height = props.posHeight(props.pos, props.isSignYourself);
33+
const fontSize =
34+
(props.pos.options?.fontSize || (height ? height - 4 : 12)) + "px";
3335
const fontColor = props.pos.options?.fontColor || "black";
3436
const months = [
3537
"January",

apps/OpenSign/src/constant/Utils.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,8 +1283,14 @@ export const changeImageWH = async (base64Image) => {
12831283
};
12841284

12851285
//function to calculate font size of text area widgets
1286-
const calculateFontSize = (position, containerScale, signyourself) => {
1287-
const font = position?.options?.fontSize || 12;
1286+
const calculateFontSize = (
1287+
position,
1288+
containerScale,
1289+
signyourself,
1290+
widgetHeight
1291+
) => {
1292+
const font =
1293+
position?.options?.fontSize || (widgetHeight ? widgetHeight / 2 : 12);
12881294
if (!signyourself && position?.isMobile && position?.scale) {
12891295
return font / position?.scale / containerScale;
12901296
} else {
@@ -1488,7 +1494,8 @@ export const multiSignEmbed = async (
14881494
const fontSize = calculateFontSize(
14891495
position,
14901496
containerScale,
1491-
signyourself
1497+
signyourself,
1498+
position.Height
14921499
);
14931500
parseInt(fontSize);
14941501
let textContent;

apps/OpenSignServer/cloud/parsefunction/getDrive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export default async function getDrive(request) {
1818
if (userId) {
1919
let url;
2020
if (docId) {
21-
url = `${classUrl}?where={"Folder":{"__type":"Pointer","className":"contracts_Document","objectId":"${docId}"},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers,Folder&skip=${skip}&limit=${limit}`;
21+
url = `${classUrl}?where={"Folder":{"__type":"Pointer","className":"contracts_Document","objectId":"${docId}"},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers,Folder&order=-updatedAt&skip=${skip}&limit=${limit}`;
2222
} else {
23-
url = `${classUrl}?where={"Folder":{"$exists":false},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers&skip=${skip}&limit=${limit}`;
23+
url = `${classUrl}?where={"Folder":{"$exists":false},"CreatedBy":{"__type":"Pointer","className":"_User","objectId":"${userId}"},"IsArchive":{"$ne":true}}&include=ExtUserPtr,Signers&order=-updatedAt&skip=${skip}&limit=${limit}`;
2424
}
2525
try {
2626
const res = await axios.get(url, {

0 commit comments

Comments
 (0)