@flozy/editor 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/CollaborativeEditor.js +7 -2
- package/dist/Editor/CommonEditor.js +53 -34
- package/dist/Editor/Editor.css +93 -17
- package/dist/Editor/Elements/Accordion/Accordion.js +67 -2
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +20 -0
- package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -1
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +59 -4
- package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonPopup.js +20 -0
- package/dist/Editor/Elements/Button/ButtonToolIcon.js +19 -0
- package/dist/Editor/Elements/Button/EditorButton.js +124 -0
- package/dist/Editor/Elements/Carousel/Arrows.js +39 -0
- package/dist/Editor/Elements/Carousel/Carousel.js +82 -0
- package/dist/Editor/Elements/Carousel/CarouselButton.js +19 -0
- package/dist/Editor/Elements/Carousel/CarouselItem.js +13 -0
- package/dist/Editor/Elements/Carousel/slick-theme.min.css +143 -0
- package/dist/Editor/Elements/Carousel/slick.min.css +83 -0
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +1 -1
- package/dist/Editor/Elements/Embed/Embed.css +22 -2
- package/dist/Editor/Elements/Embed/Embed.js +89 -74
- package/dist/Editor/Elements/Embed/EmbedPopup.js +23 -0
- package/dist/Editor/Elements/Embed/Image.js +92 -10
- package/dist/Editor/Elements/Embed/Video.js +1 -0
- package/dist/Editor/Elements/Equation/EquationButton.js +12 -12
- package/dist/Editor/Elements/Grid/Grid.js +64 -8
- package/dist/Editor/Elements/Grid/GridButton.js +2 -4
- package/dist/Editor/Elements/Grid/GridItem.js +59 -5
- package/dist/Editor/Elements/Grid/GridItemPopup.js +20 -0
- package/dist/Editor/Elements/Grid/GridPopup.js +22 -0
- package/dist/Editor/Elements/ID/Id.js +1 -1
- package/dist/Editor/Elements/ImageText/ImageText.js +14 -0
- package/dist/Editor/Elements/ImageText/ImageTextWrapper.js +14 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -1
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +88 -0
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +22 -0
- package/dist/Editor/Elements/Signature/Signature.js +4 -2
- package/dist/Editor/Elements/Signature/SignatureButton.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +7 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +50 -0
- package/dist/Editor/Elements/Signature/SignatureOptions/index.js +2 -1
- package/dist/Editor/Elements/Signature/SignaturePopup.js +79 -10
- package/dist/Editor/Elements/Table/DeleteCellIcon.js +24 -0
- package/dist/Editor/Elements/Table/DeleteRowIcon.js +24 -0
- package/dist/Editor/Elements/Table/Table.js +9 -1
- package/dist/Editor/Elements/Table/TableCell.js +181 -0
- package/dist/Editor/Elements/Table/TablePopup.js +22 -0
- package/dist/Editor/Elements/Table/TableRow.js +31 -0
- package/dist/Editor/Elements/Table/TableSelector.js +62 -68
- package/dist/Editor/Toolbar/Toolbar.js +22 -7
- package/dist/Editor/Toolbar/styles.css +20 -11
- package/dist/Editor/Toolbar/toolbarGroups.js +9 -9
- package/dist/Editor/common/Button.js +4 -8
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +23 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +35 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +47 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +63 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +88 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +87 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +136 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +126 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +89 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +110 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +42 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/imageTexts.js +75 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +21 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +46 -0
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +51 -0
- package/dist/Editor/common/StyleBuilder/index.js +114 -0
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +38 -0
- package/dist/Editor/common/Uploader.js +87 -0
- package/dist/Editor/plugins/withEmbeds.js +12 -5
- package/dist/Editor/plugins/withTable.js +5 -4
- package/dist/Editor/service/fileupload.js +17 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +46 -12
- package/dist/Editor/utils/button.js +11 -0
- package/dist/Editor/utils/carousel.js +13 -0
- package/dist/Editor/utils/carouselItem.js +19 -0
- package/dist/Editor/utils/customHooks/useContextMenu.js +8 -8
- package/dist/Editor/utils/customHooks/useResize.js +1 -1
- package/dist/Editor/utils/font.js +4 -4
- package/dist/Editor/utils/helper.js +16 -0
- package/dist/Editor/utils/imageText.js +19 -0
- package/dist/Editor/utils/table.js +172 -0
- package/package.json +2 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import StyleBuilder from "../../common/StyleBuilder";
|
|
3
|
+
import gridItemStyle from "../../common/StyleBuilder/gridItemStyle";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const GridItemPopup = props => {
|
|
6
|
+
const {
|
|
7
|
+
element,
|
|
8
|
+
onSave,
|
|
9
|
+
onClose
|
|
10
|
+
} = props;
|
|
11
|
+
return /*#__PURE__*/_jsx(StyleBuilder, {
|
|
12
|
+
title: "Grid Item",
|
|
13
|
+
type: "gridItemStyle",
|
|
14
|
+
element: element,
|
|
15
|
+
onSave: onSave,
|
|
16
|
+
onClose: onClose,
|
|
17
|
+
renderTabs: gridItemStyle
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default GridItemPopup;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import StyleBuilder from "../../common/StyleBuilder";
|
|
3
|
+
import gridStyle from "../../common/StyleBuilder/gridStyle";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const GridPopup = props => {
|
|
6
|
+
const {
|
|
7
|
+
element,
|
|
8
|
+
onSave,
|
|
9
|
+
onClose,
|
|
10
|
+
customProps
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(StyleBuilder, {
|
|
13
|
+
title: "Grid",
|
|
14
|
+
type: "gridStyle",
|
|
15
|
+
element: element,
|
|
16
|
+
onSave: onSave,
|
|
17
|
+
onClose: onClose,
|
|
18
|
+
renderTabs: gridStyle,
|
|
19
|
+
customProps: customProps
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default GridPopup;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const ImageText = props => {
|
|
4
|
+
const {
|
|
5
|
+
attributes,
|
|
6
|
+
children
|
|
7
|
+
} = props;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
className: "image-text",
|
|
10
|
+
...attributes,
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export default ImageText;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const ImageTextWrapper = props => {
|
|
4
|
+
const {
|
|
5
|
+
attributes,
|
|
6
|
+
children
|
|
7
|
+
} = props;
|
|
8
|
+
return /*#__PURE__*/_jsx("div", {
|
|
9
|
+
...attributes,
|
|
10
|
+
className: "image-text-wrapper",
|
|
11
|
+
children: children
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export default ImageTextWrapper;
|
|
@@ -41,7 +41,7 @@ const LinkButton = props => {
|
|
|
41
41
|
};
|
|
42
42
|
return /*#__PURE__*/_jsxs("div", {
|
|
43
43
|
ref: linkInputRef,
|
|
44
|
-
className: "popup-
|
|
44
|
+
className: "popup-wrapper1",
|
|
45
45
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
46
46
|
className: showInput ? "clicked" : "",
|
|
47
47
|
active: isBlockActive(editor, "link"),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
2
3
|
import KeyboardReturnIcon from "@mui/icons-material/KeyboardReturn";
|
|
3
4
|
import { Transforms } from "slate";
|
|
4
5
|
import { useSlateStatic } from "slate-react";
|
|
@@ -15,7 +16,7 @@ const NewLineButton = props => {
|
|
|
15
16
|
at: [editor.children.length]
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
|
-
return /*#__PURE__*/_jsx(
|
|
19
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
19
20
|
title: "New Line",
|
|
20
21
|
onClick: onAddNewLine,
|
|
21
22
|
children: /*#__PURE__*/_jsx(KeyboardReturnIcon, {})
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Transforms, Editor, Element } from "slate";
|
|
3
|
+
import { IconButton } from "@mui/material";
|
|
4
|
+
import ArticleIcon from "@mui/icons-material/Article";
|
|
5
|
+
import { useSlateStatic, ReactEditor } from "slate-react";
|
|
6
|
+
import PageSettingsPopup from "./PageSettingsPopup";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const PageSettingsButton = props => {
|
|
10
|
+
const {
|
|
11
|
+
customProps
|
|
12
|
+
} = props;
|
|
13
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
|
14
|
+
const [pageProps, setPageProps] = useState({});
|
|
15
|
+
const editor = useSlateStatic();
|
|
16
|
+
const onSettings = () => {
|
|
17
|
+
const {
|
|
18
|
+
element
|
|
19
|
+
} = getPageSettingsPath();
|
|
20
|
+
if (element) {
|
|
21
|
+
setPageProps(element?.pageProps || {});
|
|
22
|
+
setOpenSettings(true);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const getPageSettingsPath = () => {
|
|
26
|
+
try {
|
|
27
|
+
const [pageSettingsNode] = Editor.nodes(editor, {
|
|
28
|
+
at: [],
|
|
29
|
+
match: n => {
|
|
30
|
+
return !Editor.isEditor(n) && Element.isElement(n) && n.type === "page-settings";
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const path = ReactEditor.findPath(editor, pageSettingsNode[0]);
|
|
34
|
+
return {
|
|
35
|
+
path,
|
|
36
|
+
element: pageSettingsNode[0]
|
|
37
|
+
};
|
|
38
|
+
} catch (err) {
|
|
39
|
+
console.log(err);
|
|
40
|
+
return {
|
|
41
|
+
path: null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onSave = data => {
|
|
46
|
+
const {
|
|
47
|
+
path
|
|
48
|
+
} = getPageSettingsPath();
|
|
49
|
+
const updateData = {
|
|
50
|
+
...data
|
|
51
|
+
};
|
|
52
|
+
delete updateData.children;
|
|
53
|
+
if (path) {
|
|
54
|
+
Transforms.setNodes(editor, {
|
|
55
|
+
pageProps: {
|
|
56
|
+
...updateData
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
at: path
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
Transforms.insertNodes(editor, [{
|
|
63
|
+
type: "page-settings",
|
|
64
|
+
pageProps: {
|
|
65
|
+
...updateData
|
|
66
|
+
},
|
|
67
|
+
children: [{
|
|
68
|
+
text: ""
|
|
69
|
+
}]
|
|
70
|
+
}]);
|
|
71
|
+
}
|
|
72
|
+
onClose();
|
|
73
|
+
};
|
|
74
|
+
const onClose = () => {
|
|
75
|
+
setOpenSettings(false);
|
|
76
|
+
};
|
|
77
|
+
return /*#__PURE__*/_jsxs(IconButton, {
|
|
78
|
+
title: "Page Settings",
|
|
79
|
+
onClick: onSettings,
|
|
80
|
+
children: [/*#__PURE__*/_jsx(ArticleIcon, {}), openSetttings ? /*#__PURE__*/_jsx(PageSettingsPopup, {
|
|
81
|
+
element: pageProps,
|
|
82
|
+
onSave: onSave,
|
|
83
|
+
onClose: onClose,
|
|
84
|
+
customProps: customProps
|
|
85
|
+
}) : null]
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
export default PageSettingsButton;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import StyleBuilder from "../../common/StyleBuilder";
|
|
3
|
+
import pageSettingsStyle from "../../common/StyleBuilder/pageSettingsStyle";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const PageSettingsPopup = props => {
|
|
6
|
+
const {
|
|
7
|
+
element,
|
|
8
|
+
onSave,
|
|
9
|
+
onClose,
|
|
10
|
+
customProps
|
|
11
|
+
} = props;
|
|
12
|
+
return /*#__PURE__*/_jsx(StyleBuilder, {
|
|
13
|
+
title: "Grid",
|
|
14
|
+
type: "pageSettingsStyle",
|
|
15
|
+
element: element,
|
|
16
|
+
onSave: onSave,
|
|
17
|
+
onClose: onClose,
|
|
18
|
+
renderTabs: pageSettingsStyle,
|
|
19
|
+
customProps: customProps
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default PageSettingsPopup;
|
|
@@ -9,7 +9,8 @@ const Signature = props => {
|
|
|
9
9
|
const {
|
|
10
10
|
attributes,
|
|
11
11
|
children,
|
|
12
|
-
element
|
|
12
|
+
element,
|
|
13
|
+
customProps
|
|
13
14
|
} = props;
|
|
14
15
|
const editor = useSlateStatic();
|
|
15
16
|
const isSigned = element?.children[0]?.type === "sign";
|
|
@@ -18,7 +19,7 @@ const Signature = props => {
|
|
|
18
19
|
onClear();
|
|
19
20
|
Transforms.insertNodes(editor, [{
|
|
20
21
|
type: "sign",
|
|
21
|
-
signature:
|
|
22
|
+
signature: null,
|
|
22
23
|
fontFamily: "",
|
|
23
24
|
signedBy: "",
|
|
24
25
|
signedOn: formatDate(new Date(), "MM/DD/YYYY"),
|
|
@@ -40,6 +41,7 @@ const Signature = props => {
|
|
|
40
41
|
className: `signature-container`,
|
|
41
42
|
...attributes,
|
|
42
43
|
children: [!isSigned ? /*#__PURE__*/_jsx(SignaturePopup, {
|
|
44
|
+
customProps: customProps,
|
|
43
45
|
onSave: onSave,
|
|
44
46
|
onClear: onClear
|
|
45
47
|
}) : null, children]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
2
3
|
import DrawIcon from "@mui/icons-material/Draw";
|
|
3
4
|
import { insertSignature } from "../../utils/signature";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -9,7 +10,7 @@ const SignatureButton = props => {
|
|
|
9
10
|
const handleInsertSignature = () => {
|
|
10
11
|
insertSignature(editor);
|
|
11
12
|
};
|
|
12
|
-
return /*#__PURE__*/_jsx(
|
|
13
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
13
14
|
onClick: handleInsertSignature,
|
|
14
15
|
title: "Signature",
|
|
15
16
|
children: /*#__PURE__*/_jsx(DrawIcon, {})
|
|
@@ -5,7 +5,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
const DrawSignature = props => {
|
|
6
6
|
let canvasRef = useRef();
|
|
7
7
|
const {
|
|
8
|
-
onDataChange
|
|
8
|
+
onDataChange,
|
|
9
|
+
customProps: {
|
|
10
|
+
brush
|
|
11
|
+
}
|
|
9
12
|
} = props;
|
|
10
13
|
const onSigned = () => {
|
|
11
14
|
onDataChange({
|
|
@@ -26,7 +29,9 @@ const DrawSignature = props => {
|
|
|
26
29
|
className: "signature-canvas"
|
|
27
30
|
},
|
|
28
31
|
onEnd: onSigned,
|
|
29
|
-
ref: ref => canvasRef = ref
|
|
32
|
+
ref: ref => canvasRef = ref,
|
|
33
|
+
maxWidth: brush.size || 2,
|
|
34
|
+
penColor: brush?.color || "#000"
|
|
30
35
|
})
|
|
31
36
|
})
|
|
32
37
|
});
|
|
@@ -26,6 +26,7 @@ const TypeSignature = props => {
|
|
|
26
26
|
const renderFontFamily = () => {
|
|
27
27
|
return signedTextFonts.map((m, i) => {
|
|
28
28
|
return /*#__PURE__*/_jsx(Grid, {
|
|
29
|
+
item: true,
|
|
29
30
|
padding: 1,
|
|
30
31
|
xs: 4,
|
|
31
32
|
style: {
|
|
@@ -44,7 +45,7 @@ const TypeSignature = props => {
|
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
47
|
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
-
className: "signature-tab-
|
|
48
|
+
className: "signature-tab-1-wrapper",
|
|
48
49
|
children: [/*#__PURE__*/_jsx("div", {
|
|
49
50
|
className: "typesignature-input-wrapper",
|
|
50
51
|
children: /*#__PURE__*/_jsx(Grid, {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { convertBase64 } from "../../../utils/helper";
|
|
3
|
+
import { uploadFile } from "../../../service/fileupload";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const UploadSignature = props => {
|
|
7
|
+
const {
|
|
8
|
+
customProps,
|
|
9
|
+
onUploadDone
|
|
10
|
+
} = props;
|
|
11
|
+
const [base64, setBase64] = useState(null);
|
|
12
|
+
const [uploading, setUploading] = useState(false);
|
|
13
|
+
console.log(customProps);
|
|
14
|
+
const onChange = async e => {
|
|
15
|
+
const file = e.target.files[0];
|
|
16
|
+
const strImage = await convertBase64(file);
|
|
17
|
+
setBase64(strImage);
|
|
18
|
+
doUpload(strImage);
|
|
19
|
+
};
|
|
20
|
+
const doUpload = async strImage => {
|
|
21
|
+
setUploading(true);
|
|
22
|
+
const result = await uploadFile({
|
|
23
|
+
image: strImage
|
|
24
|
+
}, customProps);
|
|
25
|
+
setUploading(false);
|
|
26
|
+
if (result && result?.imageURL) {
|
|
27
|
+
onUploadDone({
|
|
28
|
+
signature: result?.imageURL
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
33
|
+
className: "signature-tab",
|
|
34
|
+
children: [uploading ? "Uploading..." : "", base64 ? /*#__PURE__*/_jsx("div", {
|
|
35
|
+
className: "upload-sign-img-wrapper",
|
|
36
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
37
|
+
className: "upload-sign-img",
|
|
38
|
+
src: base64,
|
|
39
|
+
alt: "Signature"
|
|
40
|
+
})
|
|
41
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: "upload-input-wrapper",
|
|
43
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
44
|
+
type: "file",
|
|
45
|
+
onChange: onChange
|
|
46
|
+
})
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export default UploadSignature;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import DrawSignature from "./DrawSignature";
|
|
2
2
|
import TypeSignature from "./TypeSignature";
|
|
3
|
-
|
|
3
|
+
import UploadSignature from "./UploadSignature";
|
|
4
|
+
const SignatureOptions = [DrawSignature, TypeSignature, UploadSignature];
|
|
4
5
|
export default SignatureOptions;
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton, Grid, TextField } from "@mui/material";
|
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
|
4
|
+
import BrushIcon from "@mui/icons-material/Brush";
|
|
4
5
|
import DatePicker from "react-datepicker";
|
|
5
6
|
import "react-datepicker/dist/react-datepicker.css";
|
|
6
7
|
import SignatureOptions from "./SignatureOptions";
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
const BrushSizes = [1, 3, 5];
|
|
10
12
|
const SignaturePopup = props => {
|
|
11
13
|
const {
|
|
12
14
|
onSave,
|
|
13
|
-
onClear
|
|
15
|
+
onClear,
|
|
16
|
+
customProps
|
|
14
17
|
} = props;
|
|
15
18
|
const [open, setOpen] = useState(false);
|
|
16
19
|
const [tab, setTab] = useState(0);
|
|
17
20
|
const SeletectedTab = SignatureOptions[tab];
|
|
18
21
|
const [signedData, setSignedData] = useState({});
|
|
22
|
+
const [brush, setBrush] = useState({
|
|
23
|
+
size: 1,
|
|
24
|
+
color: "#000000"
|
|
25
|
+
});
|
|
19
26
|
const handleOpen = () => {
|
|
20
27
|
setOpen(true);
|
|
21
28
|
};
|
|
@@ -42,6 +49,26 @@ const SignaturePopup = props => {
|
|
|
42
49
|
[e.target.name]: e.target.value
|
|
43
50
|
});
|
|
44
51
|
};
|
|
52
|
+
const onBrushSize = val => () => {
|
|
53
|
+
setBrush({
|
|
54
|
+
...brush,
|
|
55
|
+
size: val
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const onBrushColor = e => {
|
|
59
|
+
setBrush({
|
|
60
|
+
...brush,
|
|
61
|
+
color: e.target.value
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const onUploadDone = data => {
|
|
65
|
+
setSignedData({
|
|
66
|
+
...signedData,
|
|
67
|
+
...data
|
|
68
|
+
});
|
|
69
|
+
handleSave();
|
|
70
|
+
setOpen(false);
|
|
71
|
+
};
|
|
45
72
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
46
73
|
children: [/*#__PURE__*/_jsx("div", {
|
|
47
74
|
className: `signature-btn-container`,
|
|
@@ -94,7 +121,12 @@ const SignaturePopup = props => {
|
|
|
94
121
|
}), /*#__PURE__*/_jsx("div", {
|
|
95
122
|
className: "signature-tab-content",
|
|
96
123
|
children: SeletectedTab ? /*#__PURE__*/_jsx(SeletectedTab, {
|
|
97
|
-
onDataChange: onDataChange
|
|
124
|
+
onDataChange: onDataChange,
|
|
125
|
+
customProps: {
|
|
126
|
+
...(customProps || {}),
|
|
127
|
+
brush: brush
|
|
128
|
+
},
|
|
129
|
+
onUploadDone: onUploadDone
|
|
98
130
|
}) : null
|
|
99
131
|
}), /*#__PURE__*/_jsxs(Grid, {
|
|
100
132
|
container: true,
|
|
@@ -149,7 +181,6 @@ const SignaturePopup = props => {
|
|
|
149
181
|
selected: signedData?.signedOn ? new Date(signedData?.signedOn) : new Date(),
|
|
150
182
|
dateFormat: "MM/dd/yyyy",
|
|
151
183
|
onChange: date => {
|
|
152
|
-
console.log(date);
|
|
153
184
|
setSignedData({
|
|
154
185
|
...signedData,
|
|
155
186
|
signedOn: new Date(date).toISOString().split("T")[0]
|
|
@@ -160,13 +191,51 @@ const SignaturePopup = props => {
|
|
|
160
191
|
})]
|
|
161
192
|
})]
|
|
162
193
|
}), /*#__PURE__*/_jsxs(DialogActions, {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
194
|
+
className: "dialog-actions-si",
|
|
195
|
+
children: [tab === 0 ? /*#__PURE__*/_jsxs(Grid, {
|
|
196
|
+
container: true,
|
|
197
|
+
padding: 2,
|
|
198
|
+
style: {
|
|
199
|
+
display: "flex",
|
|
200
|
+
alignItems: "center"
|
|
201
|
+
},
|
|
202
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
203
|
+
item: true,
|
|
204
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
205
|
+
type: "color",
|
|
206
|
+
className: "brushcolorpic",
|
|
207
|
+
onChange: onBrushColor,
|
|
208
|
+
size: "4",
|
|
209
|
+
value: brush?.color
|
|
210
|
+
})
|
|
211
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
212
|
+
item: true,
|
|
213
|
+
children: /*#__PURE__*/_jsx(Grid, {
|
|
214
|
+
className: "dflex alignCenter sizeIcons",
|
|
215
|
+
children: BrushSizes.map(m => {
|
|
216
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
217
|
+
onClick: onBrushSize(m),
|
|
218
|
+
disableRipple: true,
|
|
219
|
+
className: brush.size === m ? "active" : "",
|
|
220
|
+
children: /*#__PURE__*/_jsx(BrushIcon, {
|
|
221
|
+
style: {
|
|
222
|
+
width: 24 + m,
|
|
223
|
+
height: 24 + m
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
}, `sit-bs-${m}`);
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
})]
|
|
230
|
+
}) : null, tab !== 2 ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
231
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
232
|
+
onClick: handleClear,
|
|
233
|
+
children: "Clear"
|
|
234
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
235
|
+
onClick: handleSave,
|
|
236
|
+
children: "Save"
|
|
237
|
+
})]
|
|
238
|
+
}) : null]
|
|
170
239
|
})]
|
|
171
240
|
})]
|
|
172
241
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
const DeleteCell = () => {
|
|
5
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
6
|
+
width: "24px",
|
|
7
|
+
height: "24px",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
12
|
+
fillRule: "evenodd",
|
|
13
|
+
clipRule: "evenodd",
|
|
14
|
+
d: "M20 16V20L4 20V4H20V8H18.5V5.5H15V18.5L18.5 18.5V16H20ZM5.5 16.5V18.5H8.5V16.5L5.5 16.5ZM10 16.5V18.5L13.5 18.5V16.5L10 16.5ZM13.5 8.01957V5.5H10V8.01958L13.5 8.01957ZM8.5 8.01958V5.5H5.5V8.01959L8.5 8.01958ZM8.5 9.51958L5.5 9.51959V11.5L8.5 11.5V9.51958ZM8.5 13L5.5 13V15L8.5 15V13ZM10 13V15L13.5 15V13L10 13ZM10 11.5L13.5 11.5V9.51957L10 9.51958V11.5Z",
|
|
15
|
+
fill: "#1F2328"
|
|
16
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
clipRule: "evenodd",
|
|
19
|
+
d: "M18.7176 13.0606L19.9373 14.2803L20.9979 13.2197L19.7782 12L20.9979 10.7803L19.9372 9.71967L18.7176 10.9393L17.4979 9.71968L16.4373 10.7803L17.6569 12L16.4373 13.2196L17.4979 14.2803L18.7176 13.0606Z",
|
|
20
|
+
fill: "#1F2328"
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export default DeleteCell;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
const DeleteCell = () => {
|
|
5
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
6
|
+
width: "24px",
|
|
7
|
+
height: "24px",
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
12
|
+
fillRule: "evenodd",
|
|
13
|
+
clipRule: "evenodd",
|
|
14
|
+
d: "M20 4H4V20H8V18.5H5.5V13H18.5V18.5H16V20H20V4ZM5.5 8V5.5H8.5V8H5.5ZM10 8V5.5H14L13.9999 8H10ZM15.4999 8L15.5 5.5H18.5V8H15.4999ZM15.4999 9.5H18.5V11.5H15.4998L15.4999 9.5ZM8.5 11.5H5.5V9.5H8.5V11.5ZM10 11.5V9.5H13.9999L13.9998 11.5H10Z",
|
|
15
|
+
fill: "#1F2328"
|
|
16
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
clipRule: "evenodd",
|
|
19
|
+
d: "M12 18.7804L13.2197 20.0001L14.2803 18.9395L13.0606 17.7197L14.2802 16.5001L13.2196 15.4395L12 16.6591L10.7803 15.4395L9.71968 16.5001L10.9393 17.7197L9.71967 18.9394L10.7803 20.0001L12 18.7804Z",
|
|
20
|
+
fill: "#1F2328"
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export default DeleteCell;
|
|
@@ -5,13 +5,21 @@ const Table = ({
|
|
|
5
5
|
children,
|
|
6
6
|
element
|
|
7
7
|
}) => {
|
|
8
|
+
const {
|
|
9
|
+
bgColor,
|
|
10
|
+
borderColor
|
|
11
|
+
} = element;
|
|
8
12
|
return /*#__PURE__*/_jsx("div", {
|
|
9
13
|
style: {
|
|
10
14
|
minWidth: "100%",
|
|
11
15
|
maxWidth: "100%",
|
|
12
|
-
|
|
16
|
+
position: "relative"
|
|
13
17
|
},
|
|
14
18
|
children: /*#__PURE__*/_jsx("table", {
|
|
19
|
+
style: {
|
|
20
|
+
backgroundColor: bgColor,
|
|
21
|
+
border: `1px solid ${borderColor}`
|
|
22
|
+
},
|
|
15
23
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
16
24
|
...attributes,
|
|
17
25
|
children: children
|