mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
fix: input text type regex issue
This commit is contained in:
@@ -133,31 +133,6 @@ const TemplatePlaceholder = () => {
|
||||
isDragStamp: !!monitor.isDragging()
|
||||
})
|
||||
});
|
||||
|
||||
const [{ isDragSignatureSS }, dragSignatureSS] = useDrag({
|
||||
type: "BOX",
|
||||
item: {
|
||||
type: "BOX",
|
||||
id: 3,
|
||||
text: "signature"
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isDragSignatureSS: !!monitor.isDragging()
|
||||
})
|
||||
});
|
||||
|
||||
const [{ isDragStampSS }, dragStampSS] = useDrag({
|
||||
type: "BOX",
|
||||
item: {
|
||||
type: "BOX",
|
||||
id: 4,
|
||||
text: "stamp"
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isDragStampSS: !!monitor.isDragging()
|
||||
})
|
||||
});
|
||||
|
||||
const [uniqueId, setUniqueId] = useState("");
|
||||
const [isModalRole, setIsModalRole] = useState(false);
|
||||
const [roleName, setRoleName] = useState("");
|
||||
@@ -171,7 +146,7 @@ const TemplatePlaceholder = () => {
|
||||
const [isDragging, setIsDragging] = useState(false);
|
||||
const [currWidgetsDetails, setCurrWidgetsDetails] = useState([]);
|
||||
const [isCheckbox, setIsCheckbox] = useState(false);
|
||||
const checkboxType = ["Optional", "Required", "Read only"];
|
||||
|
||||
const senderUser =
|
||||
localStorage.getItem(
|
||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||
@@ -338,12 +313,6 @@ const TemplatePlaceholder = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const getDate = () => {
|
||||
const date = new Date();
|
||||
const milliseconds = date.getTime();
|
||||
const newDate = moment(milliseconds).format("MM/DD/YYYY");
|
||||
return newDate;
|
||||
};
|
||||
//function for setting position after drop signature button over pdf
|
||||
const addPositionOfSignature = (item, monitor) => {
|
||||
getSignerPos(item, monitor);
|
||||
@@ -393,8 +362,6 @@ const TemplatePlaceholder = () => {
|
||||
.getBoundingClientRect();
|
||||
const x = offset.x - containerRect.left;
|
||||
const y = offset.y - containerRect.top;
|
||||
const ybottom = containerRect.bottom - offset.y;
|
||||
|
||||
const dropObj = {
|
||||
xPosition: signBtnPosition[0] ? x - signBtnPosition[0].xPos : x,
|
||||
yPosition: signBtnPosition[0] ? y - signBtnPosition[0].yPos : y,
|
||||
@@ -1401,9 +1368,6 @@ const TemplatePlaceholder = () => {
|
||||
dragRef={dragRef}
|
||||
isDragStamp={isDragStamp}
|
||||
isSignYourself={false}
|
||||
isDragSignatureSS={isDragSignatureSS}
|
||||
dragSignatureSS={dragSignatureSS}
|
||||
dragStampSS={dragStampSS}
|
||||
addPositionOfSignature={addPositionOfSignature}
|
||||
signerPos={signerPos}
|
||||
signersdata={signersdata}
|
||||
|
||||
@@ -50,6 +50,8 @@ function Placeholder(props) {
|
||||
return "MMM dd, YYYY";
|
||||
case "DD MMMM, YYYY":
|
||||
return "dd MMMM, YYYY";
|
||||
default:
|
||||
return "dd/MM/yyyy";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -57,19 +57,9 @@ function PlaceholderType(props) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleTextValid = (e, regx) => {
|
||||
const handleTextValid = (e) => {
|
||||
const textInput = e.target.value;
|
||||
setTextValue(textInput);
|
||||
|
||||
// console.log('textInput',textInput)
|
||||
// let isValidate = regx.test(textValue);
|
||||
// console.log('isValidate',isValidate,regx)
|
||||
// if (isValidate) {
|
||||
// const sanitizedValue = textInput.replace(regx, "");
|
||||
// setTextValue(sanitizedValue);
|
||||
// } else {
|
||||
// setTextValue('');
|
||||
// }
|
||||
};
|
||||
function checkRegularExpress(validateType) {
|
||||
switch (validateType) {
|
||||
@@ -81,6 +71,7 @@ function PlaceholderType(props) {
|
||||
break;
|
||||
case "text":
|
||||
setValidatePlaceholder("enter text");
|
||||
break;
|
||||
default:
|
||||
setValidatePlaceholder("enter text");
|
||||
}
|
||||
@@ -381,10 +372,6 @@ function PlaceholderType(props) {
|
||||
}
|
||||
onBlur={handleInputBlur}
|
||||
onChange={(e) => {
|
||||
// props.pos?.validation && handleTextValid(e, props.pos?.validation);
|
||||
// if (!props.pos.options?.validation) {
|
||||
// setTextValue(e.target.value);
|
||||
// }
|
||||
setTextValue(e.target.value);
|
||||
onChangeInput(
|
||||
e.target.value,
|
||||
@@ -486,7 +473,7 @@ function PlaceholderType(props) {
|
||||
}
|
||||
onBlur={handleInputBlur}
|
||||
onChange={(e) => {
|
||||
handleTextValid(e, /[^a-zA-Z\s]/g);
|
||||
handleTextValid(e);
|
||||
onChangeInput(
|
||||
e.target.value,
|
||||
props.pos.key,
|
||||
@@ -524,7 +511,7 @@ function PlaceholderType(props) {
|
||||
}
|
||||
onBlur={handleInputBlur}
|
||||
onChange={(e) => {
|
||||
handleTextValid(e, /[^a-zA-Z\s]/g);
|
||||
handleTextValid(e);
|
||||
onChangeInput(
|
||||
e.target.value,
|
||||
props.pos.key,
|
||||
@@ -562,7 +549,7 @@ function PlaceholderType(props) {
|
||||
}
|
||||
onBlur={handleInputBlur}
|
||||
onChange={(e) => {
|
||||
handleTextValid(e, /[^a-zA-Z\s]/g);
|
||||
handleTextValid(e);
|
||||
onChangeInput(
|
||||
e.target.value,
|
||||
props.pos.key,
|
||||
@@ -653,10 +640,7 @@ function PlaceholderType(props) {
|
||||
}
|
||||
onBlur={handleInputBlur}
|
||||
onChange={(e) => {
|
||||
handleTextValid(
|
||||
e,
|
||||
/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
|
||||
);
|
||||
handleTextValid(e);
|
||||
onChangeInput(
|
||||
e.target.value,
|
||||
props.pos.key,
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import React from "react";
|
||||
import RSC from "react-scrollbars-custom";
|
||||
import { Document, Page, pdfjs } from "react-pdf";
|
||||
|
||||
import {
|
||||
addZIndex,
|
||||
defaultWidthHeight,
|
||||
handleImageResize,
|
||||
handleSignYourselfImageResize
|
||||
} from "../../utils/Utils";
|
||||
import EmailToast from "./emailToast";
|
||||
// import PlaceholderBorder from "./placeholderBorder";
|
||||
import Placeholder from "../WidgetComponent/placeholder";
|
||||
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
|
||||
|
||||
@@ -1149,8 +1149,11 @@ function PlaceHolderSign() {
|
||||
//function for base on condition to add checkbox widget status and input text validation in signerPos array
|
||||
const handleApplyWidgetsStatus = (textValidate) => {
|
||||
const options = ["email", "number", "text"];
|
||||
const regexType = options.includes(textValidate);
|
||||
let regularExpression = textValidate;
|
||||
let regularExpression, regexType;
|
||||
if (textValidate) {
|
||||
regexType = options.includes(textValidate);
|
||||
regularExpression = textValidate;
|
||||
}
|
||||
|
||||
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
|
||||
if (filterSignerPos.length > 0) {
|
||||
@@ -1172,7 +1175,11 @@ function PlaceHolderSign() {
|
||||
...position.options,
|
||||
hint: hint,
|
||||
validation: {
|
||||
type: regexType ? regularExpression : "regex",
|
||||
type: textValidate
|
||||
? regexType
|
||||
? regularExpression
|
||||
: "regex"
|
||||
: "text",
|
||||
pattern: !regexType ? regularExpression : ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user