@flozy/editor 3.2.9 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,8 @@ const Form = props => {
40
40
  formTitle,
41
41
  textSize,
42
42
  fontFamily,
43
- textAlign
43
+ textAlign,
44
+ alignment
44
45
  } = element;
45
46
  const btnR = buttonProps?.borderRadius || {};
46
47
  const btnSpacing = buttonProps?.bannerSpacing || {};
@@ -218,7 +219,8 @@ const Form = props => {
218
219
  contentEditable: false,
219
220
  style: {
220
221
  top: "-42px",
221
- left: "0px"
222
+ left: "0px",
223
+ textAlign: "left"
222
224
  },
223
225
  children: [/*#__PURE__*/_jsx(Tooltip, {
224
226
  title: "Form Settings",
@@ -260,7 +262,8 @@ const Form = props => {
260
262
  className: "form-wrapper element-root",
261
263
  style: {
262
264
  border: !readOnly ? "none" : "none",
263
- padding: "10px"
265
+ padding: "10px",
266
+ width: "100%"
264
267
  },
265
268
  onMouseOver: onMouseOver,
266
269
  onMouseLeave: onMouseLeave,
@@ -290,6 +293,9 @@ const Form = props => {
290
293
  children: /*#__PURE__*/_jsxs(Grid, {
291
294
  container: true,
292
295
  spacing: 2,
296
+ sx: {
297
+ justifyContent: alignment?.horizantal || "start"
298
+ },
293
299
  children: [/*#__PURE__*/_jsx("legend", {
294
300
  style: {
295
301
  fontSize: `${textSize}px` || "inherit",
@@ -8,6 +8,7 @@ import "./Signature.css";
8
8
  import { DrawSignature, PencilIcon, TypeSignature, UploadSignature } from "../../common/EditorIcons";
9
9
  import useCommonStyle from "../../commonStyle";
10
10
  import { useEditorContext } from "../../hooks/useMouseMove";
11
+ import { validationMethods } from "../Form/FormElements/validations";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -25,7 +26,8 @@ const SignaturePopup = props => {
25
26
  } = props;
26
27
  const {
27
28
  readOnly,
28
- metadata
29
+ metadata,
30
+ isSignerDetailsRequired = false
29
31
  } = customProps;
30
32
  const [open, setOpen] = useState(false);
31
33
  const [tab, setTab] = useState(0);
@@ -33,7 +35,9 @@ const SignaturePopup = props => {
33
35
  const [signedData, setSignedData] = useState({
34
36
  signedOn: new Date(),
35
37
  signature: "",
36
- signedText: ""
38
+ signedText: "",
39
+ signedBy: "",
40
+ signedByEmail: ""
37
41
  });
38
42
  const [brush, setBrush] = useState({
39
43
  size: 1,
@@ -49,14 +53,22 @@ const SignaturePopup = props => {
49
53
  await customProps?.services("workFlowAction", {
50
54
  resource_id: customProps?.page_id
51
55
  });
52
- onSave(signedData);
53
- // manual delay
54
- setTimeout(() => {
55
- if (metadata && metadata?.actionHandler) {
56
- metadata?.actionHandler("signed", signedData);
57
- }
58
- handleClose();
59
- }, 0);
56
+ let isValidEmail = "";
57
+ if (isSignerDetailsRequired && signedData?.signedByEmail !== "") {
58
+ isValidEmail = validationMethods?.isEmail(signedData?.signedByEmail);
59
+ }
60
+ if (isValidEmail === "Enter valid email address") {
61
+ alert(isValidEmail);
62
+ } else {
63
+ onSave(signedData);
64
+ // manual delay
65
+ setTimeout(() => {
66
+ if (metadata && metadata?.actionHandler) {
67
+ metadata?.actionHandler("signed", signedData);
68
+ }
69
+ handleClose();
70
+ }, 0);
71
+ }
60
72
  };
61
73
  const handleClear = () => {
62
74
  onClear();
@@ -99,10 +111,15 @@ const SignaturePopup = props => {
99
111
  setSignedData({
100
112
  signedOn: new Date(),
101
113
  signature: "",
102
- signedText: ""
114
+ signedText: "",
115
+ signedBy: "",
116
+ signedByEmail: ""
103
117
  });
104
118
  };
105
- const isEmpty = signedData?.signature === "" && signedData?.signedText === "";
119
+ let isEmpty = signedData?.signature === "" && signedData?.signedText === "";
120
+ if (isSignerDetailsRequired) {
121
+ isEmpty = signedData?.signature === "" && signedData?.signedText === "" || signedData?.signedBy === "" || signedData?.signedByEmail === "";
122
+ }
106
123
  return /*#__PURE__*/_jsxs(_Fragment, {
107
124
  children: [/*#__PURE__*/_jsx("div", {
108
125
  className: `signature-btn-container`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.2.9",
3
+ "version": "3.3.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"