mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-26 19:44:53 +02:00
fix: text input widgets issue after set default values
This commit is contained in:
@@ -109,7 +109,8 @@ const NameModal = (props) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{props.widgetName === "text" && (
|
{(props.defaultdata?.type === "text" ||
|
||||||
|
props.widgetName === "text") && (
|
||||||
<>
|
<>
|
||||||
<div className="form-section">
|
<div className="form-section">
|
||||||
<label htmlFor="textvalidate" style={{ fontSize: 13 }}>
|
<label htmlFor="textvalidate" style={{ fontSize: 13 }}>
|
||||||
@@ -187,7 +188,15 @@ const NameModal = (props) => {
|
|||||||
invalid default value
|
invalid default value
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<p style={{ color: "transparent", fontSize: 8 }}>.</p>
|
<p
|
||||||
|
style={{
|
||||||
|
color: "transparent",
|
||||||
|
fontSize: 10,
|
||||||
|
margin: "3px 8px"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
.
|
||||||
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -234,7 +243,8 @@ const NameModal = (props) => {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{props.widgetName === "text" && (
|
{(props.defaultdata?.type === "text" ||
|
||||||
|
props?.widgetName === "text") && (
|
||||||
<div className="form-section">
|
<div className="form-section">
|
||||||
<label htmlFor="hint" style={{ fontSize: 13 }}>
|
<label htmlFor="hint" style={{ fontSize: 13 }}>
|
||||||
Hint
|
Hint
|
||||||
|
|||||||
@@ -76,19 +76,6 @@ function Placeholder(props) {
|
|||||||
});
|
});
|
||||||
setDateFormat(updateDate);
|
setDateFormat(updateDate);
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
|
||||||
//set default current date and default format MM/dd/yyyy
|
|
||||||
if (props.isPlaceholder || props.isSignYourself) {
|
|
||||||
const date = new Date();
|
|
||||||
const milliseconds = date.getTime();
|
|
||||||
const newDate = moment(milliseconds).format("MM/DD/YYYY");
|
|
||||||
const dateObj = {
|
|
||||||
date: newDate,
|
|
||||||
format: "MM/dd/YYYY"
|
|
||||||
};
|
|
||||||
setSelectDate(dateObj);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.isPlaceholder || props.isSignYourself) {
|
if (props.isPlaceholder || props.isSignYourself) {
|
||||||
selectDate && changeDateFormat();
|
selectDate && changeDateFormat();
|
||||||
@@ -101,9 +88,7 @@ function Placeholder(props) {
|
|||||||
setIsShowDateFormat(!isShowDateFormat);
|
setIsShowDateFormat(!isShowDateFormat);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("click", closeMenuOnOutsideClick);
|
document.addEventListener("click", closeMenuOnOutsideClick);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
// Cleanup the event listener when the component unmounts
|
// Cleanup the event listener when the component unmounts
|
||||||
document.removeEventListener("click", closeMenuOnOutsideClick);
|
document.removeEventListener("click", closeMenuOnOutsideClick);
|
||||||
|
|||||||
Reference in New Issue
Block a user