@flozy/editor 3.2.9 → 3.3.1

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",
@@ -1,16 +1,9 @@
1
1
  export const validationMethods = {
2
2
  isEmail: value => {
3
- const regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; //eslint-disable-line
4
- const result = regex.test(String(value).toLowerCase());
5
- if (result) {
6
- let domain = String(value).toLowerCase().split('@')[1];
7
- let validExtensions = ['com', 'net', 'org', 'edu'];
8
- let extension = domain.split('.').pop();
9
- if (validExtensions.includes(extension)) {
10
- return "";
11
- } else {
12
- return "Enter valid email address";
13
- }
3
+ const regex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
4
+ const isValidEmail = regex.test(String(value).toLowerCase());
5
+ if (isValidEmail) {
6
+ return "";
14
7
  } else {
15
8
  return "Enter valid email address";
16
9
  }
@@ -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`,
@@ -51,7 +51,7 @@ export const SelectPage = props => {
51
51
  ...rest
52
52
  } = r;
53
53
  return {
54
- label: title,
54
+ label: url_name,
55
55
  value: url_name,
56
56
  ...rest
57
57
  };
@@ -78,7 +78,7 @@ export const SelectPage = props => {
78
78
  }, [value, pages]);
79
79
  return /*#__PURE__*/_jsxs("div", {
80
80
  children: [/*#__PURE__*/_jsx(FreeSoloCreateOption, {
81
- label: page?.label || "Home",
81
+ label: page?.label,
82
82
  setValue: val => onChange(val?.value),
83
83
  placeholder: "Select Page",
84
84
  options: pages
@@ -33,7 +33,7 @@ const appHeaderStyle = [{
33
33
  key: "appLogo",
34
34
  type: "text"
35
35
  }, {
36
- label: "App Logo Height",
36
+ label: "Logo Height",
37
37
  key: "logoHeight",
38
38
  type: "text",
39
39
  placeholder: "40px"
@@ -214,6 +214,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
214
214
  component: "button"
215
215
  };
216
216
  }
217
+ if (!linkType && url) {
218
+ if (url?.includes("http")) {
219
+ linkType = "webAddress";
220
+ } else {
221
+ linkType = "page";
222
+ }
223
+ }
217
224
  switch (linkType) {
218
225
  case "webAddress":
219
226
  const refUrl = url ? url.includes("http") ? url : `//${url}` : "Link";
@@ -236,7 +243,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
236
243
  break;
237
244
  case "page":
238
245
  props.component = "a";
239
- const [page, section] = url.split("#");
246
+ const [page, section] = url?.split("#") || [];
240
247
  const sec = section ? `#${section}` : "";
241
248
  const isHome = page === "home" || !page;
242
249
  props.href = isHome ? `${sec}` : `/${url}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.2.9",
3
+ "version": "3.3.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"