@flozy/editor 5.4.2 → 5.4.3

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.
Files changed (192) hide show
  1. package/dist/Editor/ChatEditor.js +34 -25
  2. package/dist/Editor/CommonEditor.js +15 -29
  3. package/dist/Editor/Editor.css +18 -100
  4. package/dist/Editor/Elements/AI/AIInput.js +1 -0
  5. package/dist/Editor/Elements/AI/CustomSelect.js +11 -19
  6. package/dist/Editor/Elements/AI/PopoverAIInput.js +52 -58
  7. package/dist/Editor/Elements/AI/Styles.js +6 -24
  8. package/dist/Editor/Elements/Accordion/Accordion.js +1 -8
  9. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  10. package/dist/Editor/Elements/Button/EditorButton.js +2 -9
  11. package/dist/Editor/Elements/Carousel/CarouselItem.js +3 -11
  12. package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
  13. package/dist/Editor/Elements/Color Picker/Styles.js +3 -7
  14. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  15. package/dist/Editor/Elements/Divider/Divider.js +20 -36
  16. package/dist/Editor/Elements/Embed/Image.js +16 -51
  17. package/dist/Editor/Elements/Embed/Video.js +3 -26
  18. package/dist/Editor/Elements/Form/Form.js +2 -39
  19. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
  20. package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
  21. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
  22. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
  23. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
  24. package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
  25. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
  26. package/dist/Editor/Elements/Form/FormPopup.js +9 -12
  27. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  28. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
  29. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  30. package/dist/Editor/Elements/FreeGrid/styles.js +1 -2
  31. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  32. package/dist/Editor/Elements/Grid/GridItem.js +36 -47
  33. package/dist/Editor/Elements/Grid/Styles.js +0 -50
  34. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  35. package/dist/Editor/Elements/List/CheckList.js +1 -2
  36. package/dist/Editor/Elements/Search/SearchAttachment.js +0 -1
  37. package/dist/Editor/Elements/Search/SearchButton.js +0 -1
  38. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  39. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  40. package/dist/Editor/Elements/Signature/SignaturePopup.js +52 -17
  41. package/dist/Editor/Elements/SimpleText/index.js +1 -8
  42. package/dist/Editor/Elements/SimpleText/style.js +1 -20
  43. package/dist/Editor/Elements/Table/Styles.js +79 -82
  44. package/dist/Editor/Elements/Table/Table.js +140 -258
  45. package/dist/Editor/Elements/Table/TableCell.js +111 -365
  46. package/dist/Editor/Elements/Table/TablePopup.js +3 -9
  47. package/dist/Editor/Elements/Table/TableRow.js +2 -10
  48. package/dist/Editor/Elements/TopBanner/TopBanner.js +1 -2
  49. package/dist/Editor/MiniEditor.js +1 -15
  50. package/dist/Editor/Styles/EditorStyles.js +4 -13
  51. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
  52. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +12 -7
  53. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -26
  54. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
  55. package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
  56. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +6 -3
  57. package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
  58. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +3 -7
  59. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -6
  60. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +15 -19
  61. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +57 -555
  62. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +16 -73
  63. package/dist/Editor/Toolbar/PopupTool/index.js +5 -3
  64. package/dist/Editor/Toolbar/Toolbar.js +0 -6
  65. package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
  66. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  67. package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
  68. package/dist/Editor/common/ColorPickerButton.js +45 -85
  69. package/dist/Editor/common/DnD/Draggable.js +1 -2
  70. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  71. package/dist/Editor/common/Icon.js +20 -23
  72. package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -2
  73. package/dist/Editor/common/ImageSelector/Styles.js +6 -47
  74. package/dist/Editor/common/ImageSelector/UploadStyles.js +6 -18
  75. package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
  76. package/dist/Editor/common/LinkSettings/index.js +1 -2
  77. package/dist/Editor/common/MentionsPopup/Styles.js +8 -143
  78. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  79. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
  80. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  81. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  82. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  83. package/dist/Editor/common/RnD/Utils/gridDropItem.js +6 -9
  84. package/dist/Editor/common/RnD/VirtualElement/index.js +1 -5
  85. package/dist/Editor/common/RnD/index.js +2 -3
  86. package/dist/Editor/common/Section/index.js +3 -3
  87. package/dist/Editor/common/Section/styles.js +1 -5
  88. package/dist/Editor/common/Shorthands/elements.js +1 -13
  89. package/dist/Editor/common/StyleBuilder/fieldStyle.js +1 -2
  90. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -9
  91. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +7 -35
  92. package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +2 -15
  93. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  94. package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +1 -2
  95. package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
  96. package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +0 -2
  97. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  98. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
  99. package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +6 -22
  100. package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -21
  101. package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -20
  102. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -12
  103. package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
  104. package/dist/Editor/common/StyleBuilder/index.js +20 -101
  105. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  106. package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
  107. package/dist/Editor/common/SwipeableDrawer/style.js +4 -15
  108. package/dist/Editor/common/ToolbarIcon.js +1 -1
  109. package/dist/Editor/common/Uploader.js +36 -46
  110. package/dist/Editor/common/iconListV2.js +60 -616
  111. package/dist/Editor/common/iconslist.js +17 -23
  112. package/dist/Editor/commonStyle.js +11 -417
  113. package/dist/Editor/helper/deserialize/index.js +3 -4
  114. package/dist/Editor/helper/index.js +4 -17
  115. package/dist/Editor/helper/theme.js +1 -24
  116. package/dist/Editor/hooks/useMouseMove.js +2 -5
  117. package/dist/Editor/plugins/withCustomDeleteBackward.js +4 -36
  118. package/dist/Editor/plugins/withEmbeds.js +26 -30
  119. package/dist/Editor/plugins/withHTML.js +10 -61
  120. package/dist/Editor/plugins/withLayout.js +0 -1
  121. package/dist/Editor/utils/SlateUtilityFunctions.js +12 -39
  122. package/dist/Editor/utils/brains.js +1 -1
  123. package/dist/Editor/utils/button.js +4 -4
  124. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +1 -26
  125. package/dist/Editor/utils/customHooks/useResize.js +4 -7
  126. package/dist/Editor/utils/customHooks/useTableResize.js +2 -6
  127. package/dist/Editor/utils/embed.js +1 -2
  128. package/dist/Editor/utils/events.js +1 -0
  129. package/dist/Editor/utils/font.js +4 -11
  130. package/dist/Editor/utils/formfield.js +4 -8
  131. package/dist/Editor/utils/helper.js +2 -103
  132. package/dist/Editor/utils/insertNewLine.js +1 -19
  133. package/dist/Editor/utils/pageSettings.js +2 -14
  134. package/dist/Editor/utils/serializeToText.js +0 -2
  135. package/dist/Editor/utils/table.js +24 -228
  136. package/package.json +2 -2
  137. package/dist/Editor/Elements/DataView/DataView.js +0 -124
  138. package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
  139. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -67
  140. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -33
  141. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -162
  142. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -40
  143. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -67
  144. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -35
  145. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -39
  146. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
  147. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
  148. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
  149. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
  150. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
  151. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
  152. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
  153. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -74
  154. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -64
  155. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -106
  156. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -174
  157. package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
  158. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
  159. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -37
  160. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -111
  161. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -60
  162. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -36
  163. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
  164. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -160
  165. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -190
  166. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -42
  167. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -30
  168. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
  169. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -179
  170. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -112
  171. package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -227
  172. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -80
  173. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +0 -10
  174. package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
  175. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -281
  176. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
  177. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -74
  178. package/dist/Editor/Elements/DataView/styles.js +0 -154
  179. package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
  180. package/dist/Editor/Elements/Table/DragButton.js +0 -142
  181. package/dist/Editor/Elements/Table/DragStyles.js +0 -70
  182. package/dist/Editor/Elements/Table/Draggable.js +0 -25
  183. package/dist/Editor/Elements/Table/Droppable.js +0 -53
  184. package/dist/Editor/Elements/Table/TableTool.js +0 -101
  185. package/dist/Editor/Elements/Table/tableHelper.js +0 -71
  186. package/dist/Editor/assets/svg/TableIcons.js +0 -220
  187. package/dist/Editor/common/Select/index.js +0 -20
  188. package/dist/Editor/common/Select/styles.js +0 -17
  189. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  190. package/dist/Editor/helper/enforceDateFormat.js +0 -41
  191. package/dist/Editor/hooks/useTable.js +0 -210
  192. package/dist/Editor/utils/dataView.js +0 -43
@@ -1,124 +0,0 @@
1
- import React from "react";
2
- import { Node, Path, Transforms } from "slate";
3
- import { ReactEditor, useSlateStatic } from "slate-react";
4
- import { Box, useTheme } from "@mui/material";
5
- import { DataViewProvider } from "./Providers/DataViewProvider";
6
- import useDataViewStyles from "./styles";
7
- import LayoutView from "./Layouts";
8
- import FilterView from "./Layouts/FilterView";
9
- import { insertLineBreakAtEndOfPath } from "../../utils/helper";
10
- import { useEditorContext } from "../../hooks/useMouseMove";
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
- const DataView = props => {
14
- const {
15
- theme: appTheme
16
- } = useEditorContext();
17
- const theme = useTheme();
18
- const editor = useSlateStatic();
19
- const {
20
- attributes,
21
- children,
22
- element,
23
- customProps
24
- } = props;
25
- const {
26
- CHARACTERS,
27
- readOnly
28
- } = customProps || {};
29
- const {
30
- properties,
31
- layouts,
32
- rows,
33
- title
34
- } = element;
35
- const classes = useDataViewStyles(theme, appTheme);
36
- const path = ReactEditor.findPath(editor, element);
37
- const users = CHARACTERS?.map(m => {
38
- const name = [m?.first_name || "", m?.last_name || ""]?.join(" ").trim();
39
- return {
40
- value: m?.email,
41
- name: name || m?.username || m?.email,
42
- avatar: m?.avatar || null
43
- };
44
- });
45
- const onDuplicate = () => {
46
- try {
47
- const newPath = ReactEditor.findPath(editor, element);
48
- const dataViewNode = Node.get(editor, newPath);
49
- const cloneNode = JSON.parse(JSON.stringify(dataViewNode));
50
- const toPath = Path.next(Path.parent(newPath));
51
- Transforms.insertNodes(editor, [{
52
- type: "paragraph",
53
- children: [{
54
- ...cloneNode
55
- }]
56
- }], {
57
- at: toPath
58
- });
59
- } catch (err) {
60
- console.log(err);
61
- }
62
- };
63
- const onDelete = () => {
64
- try {
65
- const newPath = ReactEditor.findPath(editor, element);
66
- Transforms.removeNodes(editor, {
67
- at: newPath
68
- });
69
- } catch (err) {
70
- console.log(err);
71
- }
72
- };
73
- const onEnter = () => {
74
- try {
75
- const newPath = ReactEditor.findPath(editor, element);
76
- const toPath = Path.previous(Path.parent(newPath));
77
- insertLineBreakAtEndOfPath(editor, toPath);
78
- } catch (err) {
79
- console.log(err);
80
- }
81
- };
82
- const onTitleChange = value => {
83
- try {
84
- Transforms.setNodes(editor, {
85
- title: value
86
- }, {
87
- at: path
88
- });
89
- } catch (err) {
90
- console.log(err);
91
- }
92
- };
93
- return /*#__PURE__*/_jsx(Box, {
94
- ...attributes,
95
- className: "fe-dataview",
96
- sx: classes.root,
97
- contentEditable: false,
98
- "data-title": title,
99
- children: /*#__PURE__*/_jsxs(DataViewProvider, {
100
- data: {
101
- properties,
102
- layouts,
103
- rows
104
- },
105
- path: path,
106
- editor: editor,
107
- title: title,
108
- users: users,
109
- children: [/*#__PURE__*/_jsx(FilterView, {
110
- classes: classes,
111
- onEnter: onEnter,
112
- onDelete: onDelete,
113
- onDuplicate: onDuplicate,
114
- readOnly: readOnly,
115
- title: title,
116
- onTitleChange: onTitleChange
117
- }), /*#__PURE__*/_jsx(LayoutView, {
118
- readOnly: readOnly,
119
- children: children
120
- })]
121
- })
122
- });
123
- };
124
- export default DataView;
@@ -1,23 +0,0 @@
1
- import React from "react";
2
- import ToolbarIcon from "../../common/ToolbarIcon";
3
- import Icon from "../../common/Icon";
4
- import { insertDataView } from "../../utils/dataView";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const DataViewButton = props => {
7
- const {
8
- editor,
9
- icoBtnType
10
- } = props;
11
- const onClick = () => {
12
- insertDataView(editor);
13
- };
14
- return /*#__PURE__*/_jsx(ToolbarIcon, {
15
- title: "Dynamic Table",
16
- onClick: onClick,
17
- icon: /*#__PURE__*/_jsx(Icon, {
18
- icon: "dataView"
19
- }),
20
- icoBtnType: icoBtnType
21
- });
22
- };
23
- export default DataViewButton;
@@ -1,67 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
- import { Box, Checkbox, Popper, useTheme } from "@mui/material";
3
- import CheckBoxTwoToneIcon from "@mui/icons-material/CheckBoxTwoTone";
4
- import DataTypes from "./DataTypes";
5
- import useColumnStyles from "./colStyles";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- const ColumnView = props => {
9
- const theme = useTheme();
10
- const {
11
- needAnchor,
12
- rowIndex,
13
- row,
14
- property,
15
- onSelect,
16
- selected,
17
- readOnly
18
- } = props;
19
- const DataType = DataTypes[property?.type] || DataTypes["text"];
20
- const anchorRef = useRef(null);
21
- const [anchorEl, setAnchorEl] = useState(null);
22
- const open = Boolean(anchorEl);
23
- const classes = useColumnStyles(theme);
24
- useEffect(() => {
25
- if (anchorRef?.current) {
26
- setAnchorEl(anchorRef?.current);
27
- }
28
- }, [anchorRef?.current]);
29
- const handleSelect = id => e => {
30
- onSelect(id, e.target.checked);
31
- };
32
- return /*#__PURE__*/_jsxs(Box, {
33
- component: "td",
34
- children: [needAnchor ? /*#__PURE__*/_jsx("span", {
35
- ref: anchorRef,
36
- style: {
37
- position: "absolute",
38
- width: "1px"
39
- }
40
- }) : null, /*#__PURE__*/_jsx(DataType, {
41
- options: property?.options,
42
- property: property?.key,
43
- value: row[property?.key] || "",
44
- rowIndex: rowIndex,
45
- label: property?.label,
46
- readOnly: readOnly
47
- }), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
48
- sx: classes.root,
49
- open: open,
50
- anchorEl: anchorEl,
51
- placement: "left",
52
- className: `tv-tr-pop ${selected ? "active" : ""}`,
53
- disablePortal: true,
54
- children: /*#__PURE__*/_jsx(Checkbox, {
55
- onClick: handleSelect(row?.id),
56
- size: "small",
57
- className: "tv-ck-box",
58
- sx: {
59
- mr: 0
60
- },
61
- checked: selected,
62
- checkedIcon: /*#__PURE__*/_jsx(CheckBoxTwoToneIcon, {})
63
- })
64
- }) : null]
65
- });
66
- };
67
- export default ColumnView;
@@ -1,33 +0,0 @@
1
- import React from "react";
2
- import { useDataView } from "../../Providers/DataViewProvider";
3
- import Checkbox from "@mui/material/Checkbox";
4
- import Icon from "../../../../common/Icon";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const CheckType = props => {
7
- const {
8
- rowIndex,
9
- property,
10
- value,
11
- readOnly
12
- } = props;
13
- const {
14
- onChange
15
- } = useDataView();
16
- const handleChange = e => {
17
- onChange(rowIndex, {
18
- [property]: e?.target?.checked
19
- });
20
- };
21
- return /*#__PURE__*/_jsx(Checkbox, {
22
- checked: value || false,
23
- icon: /*#__PURE__*/_jsx(Icon, {
24
- icon: "checkListButton"
25
- }),
26
- checkedIcon: /*#__PURE__*/_jsx(Icon, {
27
- icon: "checkListButtonActive"
28
- }),
29
- onChange: handleChange,
30
- disabled: readOnly
31
- }, rowIndex);
32
- };
33
- export default CheckType;
@@ -1,162 +0,0 @@
1
- import React from "react";
2
- import TextField from "@mui/material/TextField";
3
- import Autocomplete from "@mui/material/Autocomplete";
4
- import { Avatar, Box, Chip, useTheme } from "@mui/material";
5
- import { useEditorContext } from "../../../../../hooks/useMouseMove";
6
- import useCompStyles from "./styles";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const AvatarIcon = props => {
9
- const {
10
- option,
11
- avatar
12
- } = props;
13
- const nameIndex = option.label || option.value;
14
- return avatar && nameIndex ? /*#__PURE__*/_jsx(Avatar, {
15
- alt: option.label || option.value,
16
- src: option.avatar || null,
17
- children: nameIndex[0] || ""
18
- }) : null;
19
- };
20
- const filter = (opt, params, selectedOpt) => {
21
- const selectedVals = selectedOpt?.map(m => m?.value);
22
- const fv = opt?.filter(f => !selectedVals.includes(f.value));
23
- if (params?.inputValue) {
24
- return fv.filter(f => f?.value?.toLowerCase().indexOf(params?.inputValue?.toLowerCase()) >= 0);
25
- }
26
- return fv;
27
- };
28
- export default function Select(props) {
29
- const theme = useTheme();
30
- const {
31
- theme: appTheme
32
- } = useEditorContext();
33
- const classes = useCompStyles(theme, appTheme);
34
- const {
35
- value: pValue,
36
- onChange,
37
- options,
38
- multiple = false,
39
- limitTags = 2,
40
- placeholder = "",
41
- disabled = false,
42
- optionAvatar = false
43
- } = props;
44
- const value = Array.isArray(pValue) ? pValue : [];
45
- return /*#__PURE__*/_jsx(Autocomplete, {
46
- disabled: disabled,
47
- className: "tv-ac-field",
48
- multiple: true,
49
- limitTags: limitTags,
50
- placeholder: placeholder,
51
- value: value || "",
52
- onChange: (event, newValue) => {
53
- const fv = [];
54
- newValue?.forEach(m => {
55
- if (multiple) {
56
- fv.push({
57
- value: m.inputValue || m.value
58
- });
59
- } else {
60
- fv[0] = {
61
- value: m.inputValue || m.value
62
- };
63
- }
64
- });
65
- onChange(fv);
66
- },
67
- filterOptions: (options, params) => {
68
- const filtered = filter(options, params, value);
69
-
70
- // const { inputValue } = params;
71
- // Suggest the creation of a new value
72
- // const isExisting = options.some(
73
- // (option) => inputValue?.toLowerCase() === option.value?.toLowerCase()
74
- // );
75
- // no need of new val now
76
- // if (inputValue !== "" && !isExisting) {
77
- // filtered.push({
78
- // inputValue,
79
- // value: `Add "${inputValue}"`,
80
- // });
81
- // }
82
-
83
- return filtered;
84
- },
85
- selectOnFocus: true,
86
- clearOnBlur: true,
87
- handleHomeEndKeys: true,
88
- options: options || [],
89
- getOptionLabel: option => {
90
- // Value selected with enter, right from the input
91
- if (typeof option === "string") {
92
- return option;
93
- }
94
- // Add "xxx" option created dynamically
95
- if (option.inputValue) {
96
- return option.inputValue;
97
- }
98
- // Regular option
99
- return option.value || "";
100
- },
101
- renderTags: (value, getTagProps) => {
102
- return /*#__PURE__*/_jsx(Box, {
103
- className: "tv-ms-tag-wrpr",
104
- children: value?.map((option, index) => {
105
- const {
106
- key,
107
- ...tagProps
108
- } = getTagProps({
109
- index
110
- }) || {};
111
- return option?.value ? /*#__PURE__*/_jsx(Chip, {
112
- variant: "outlined",
113
- label: option?.label || option?.value,
114
- ...tagProps,
115
- sx: {
116
- background: option?.color || "#CCC",
117
- border: "none"
118
- },
119
- avatar: /*#__PURE__*/_jsx(AvatarIcon, {
120
- option: option,
121
- avatar: optionAvatar
122
- })
123
- }, key) : null;
124
- })
125
- });
126
- },
127
- renderOption: (props, option) => {
128
- const {
129
- key,
130
- ...optionProps
131
- } = props;
132
- return /*#__PURE__*/_jsx("li", {
133
- ...optionProps,
134
- children: /*#__PURE__*/_jsx(Chip, {
135
- label: option.label || option.value || "",
136
- sx: {
137
- background: option.color || "#CCC"
138
- },
139
- avatar: /*#__PURE__*/_jsx(AvatarIcon, {
140
- option: option,
141
- avatar: optionAvatar
142
- })
143
- })
144
- }, key);
145
- },
146
- freeSolo: true,
147
- size: "small",
148
- fullWidth: true,
149
- renderInput: params => {
150
- return /*#__PURE__*/_jsx(TextField, {
151
- size: "small",
152
- ...params,
153
- placeholder: placeholder
154
- });
155
- },
156
- slotProps: {
157
- paper: {
158
- sx: classes.autocomplete
159
- }
160
- }
161
- });
162
- }
@@ -1,40 +0,0 @@
1
- import React from "react";
2
- import { MenuItem, Select, useTheme } from "@mui/material";
3
- import { useEditorContext } from "../../../../../hooks/useMouseMove";
4
- import useCompStyles from "./styles";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const SimpleSelect = props => {
7
- const theme = useTheme();
8
- const {
9
- theme: appTheme
10
- } = useEditorContext();
11
- const classes = useCompStyles(theme, appTheme);
12
- const {
13
- value,
14
- options,
15
- handleChange,
16
- disabled = false
17
- } = props;
18
- console.log(classes);
19
- return /*#__PURE__*/_jsx(Select, {
20
- disabled: disabled,
21
- value: value,
22
- onChange: handleChange,
23
- fullWidth: true,
24
- size: "small",
25
- MenuProps: {
26
- PaperProps: {
27
- sx: classes.simpleselect,
28
- className: "tv-cf-opt-wrpr"
29
- }
30
- },
31
- children: options?.map((m, i) => {
32
- return /*#__PURE__*/_jsx(MenuItem, {
33
- value: m.key,
34
- className: "tv-cf-opt-wrpr",
35
- children: m.label
36
- }, i);
37
- })
38
- });
39
- };
40
- export default SimpleSelect;
@@ -1,67 +0,0 @@
1
- const useCompStyles = (theme, appTheme) => ({
2
- simpleselect: {
3
- border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
4
- background: appTheme?.palette?.editor?.tv_pop_bg,
5
- color: appTheme?.palette?.editor?.tv_text_primary,
6
- borderRadius: "8px",
7
- [theme?.breakpoints?.between("xs", "md")]: {},
8
- "& ul": {
9
- padding: "4px",
10
- "& li": {
11
- padding: "4px 6px",
12
- borderRadius: "8px",
13
- color: appTheme?.palette?.editor?.tv_text_primary,
14
- fontSize: "14px",
15
- marginTop: "4px",
16
- "&.Mui-selected": {
17
- background: appTheme?.palette?.editor?.tv_hover_bg,
18
- color: appTheme?.palette?.editor?.tv_hover_text,
19
- "&:hover": {
20
- background: appTheme?.palette?.editor?.tv_hover_bg,
21
- color: appTheme?.palette?.editor?.tv_hover_text
22
- }
23
- },
24
- "&:hover": {
25
- background: appTheme?.palette?.editor?.tv_hover_bg,
26
- color: appTheme?.palette?.editor?.tv_hover_text
27
- }
28
- }
29
- }
30
- },
31
- autocomplete: {
32
- border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
33
- background: appTheme?.palette?.editor?.tv_pop_bg,
34
- color: appTheme?.palette?.editor?.tv_text_primary,
35
- borderRadius: "8px",
36
- "& ul": {
37
- padding: "4px",
38
- "& .MuiAutocomplete-option": {
39
- padding: "4px 6px",
40
- borderRadius: "8px",
41
- color: appTheme?.palette?.editor?.tv_text_primary,
42
- fontSize: "14px",
43
- "& .MuiAvatar-root": {
44
- width: "20px",
45
- height: "20px",
46
- marginLeft: "8px",
47
- fontSize: "16px",
48
- padding: "2px",
49
- textTransform: "capitalize"
50
- },
51
- "&.Mui-selected": {
52
- background: appTheme?.palette?.editor?.tv_hover_bg,
53
- color: appTheme?.palette?.editor?.tv_hover_text,
54
- "&:hover": {
55
- background: appTheme?.palette?.editor?.tv_hover_bg,
56
- color: appTheme?.palette?.editor?.tv_hover_text
57
- }
58
- },
59
- "&:hover": {
60
- background: appTheme?.palette?.editor?.tv_hover_bg,
61
- color: appTheme?.palette?.editor?.tv_hover_text
62
- }
63
- }
64
- }
65
- }
66
- });
67
- export default useCompStyles;
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import DatePicker from "react-datepicker";
3
- import { useDataView } from "../../Providers/DataViewProvider";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- function isValidDate(dateString) {
6
- const date = new Date(dateString);
7
- return !isNaN(date.getTime());
8
- }
9
- const DateType = props => {
10
- const {
11
- rowIndex,
12
- property,
13
- value,
14
- readOnly
15
- } = props;
16
- const {
17
- onChange
18
- } = useDataView();
19
- const handleChange = date => {
20
- onChange(rowIndex, {
21
- [property]: date
22
- });
23
- };
24
- return /*#__PURE__*/_jsx(DatePicker, {
25
- disabled: readOnly,
26
- selected: isValidDate(value) ? new Date(value) : "",
27
- onChange: handleChange,
28
- onKeyDown: e => {
29
- e.preventDefault();
30
- console.log(e?.target.value);
31
- },
32
- placeholderText: "MM/DD/YYYY"
33
- });
34
- };
35
- export default DateType;
@@ -1,39 +0,0 @@
1
- import React from "react";
2
- import { useDataView } from "../../Providers/DataViewProvider";
3
- import Select from "./Components/Select";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const MultiSelectType = props => {
6
- const {
7
- rowIndex,
8
- property,
9
- value: pValue,
10
- options,
11
- label = "",
12
- readOnly
13
- } = props;
14
- const {
15
- onChange
16
- } = useDataView();
17
- const value = Array.isArray(pValue) ? pValue : [];
18
- const coloredValues = [...(value || [])]?.map(m => {
19
- return {
20
- ...m,
21
- color: options?.find(f => f.value === m.value)?.color || "#FFF"
22
- };
23
- });
24
- const handleChange = data => {
25
- onChange(rowIndex, {
26
- [property]: data?.filter(f => f?.value)
27
- });
28
- };
29
- return /*#__PURE__*/_jsx(Select, {
30
- value: coloredValues,
31
- onChange: handleChange,
32
- options: options,
33
- multiple: true,
34
- limitTags: 2,
35
- placeholder: label,
36
- disabled: readOnly
37
- });
38
- };
39
- export default MultiSelectType;
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import { TextField } from "@mui/material";
3
- import { useDataView } from "../../Providers/DataViewProvider";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const NumberType = props => {
6
- const {
7
- rowIndex,
8
- property,
9
- value,
10
- readOnly
11
- } = props;
12
- const {
13
- onChange
14
- } = useDataView();
15
- const handleChange = e => {
16
- onChange(rowIndex, {
17
- [property]: e?.target?.value
18
- });
19
- };
20
- return /*#__PURE__*/_jsx(TextField, {
21
- type: "number",
22
- fullWidth: true,
23
- className: "fe-tv-type_text",
24
- value: value,
25
- size: "small",
26
- onChange: handleChange,
27
- disabled: readOnly
28
- });
29
- };
30
- export default NumberType;
@@ -1,30 +0,0 @@
1
- import React from "react";
2
- import { useDataView } from "../../Providers/DataViewProvider";
3
- import Select from "./Components/Select";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const PersonType = props => {
6
- const {
7
- rowIndex,
8
- property,
9
- value,
10
- readOnly
11
- } = props;
12
- const {
13
- onChange,
14
- users
15
- } = useDataView();
16
- const handleChange = data => {
17
- onChange(rowIndex, {
18
- [property]: data?.filter(f => f?.value)
19
- });
20
- };
21
- return /*#__PURE__*/_jsx(Select, {
22
- value: value || [],
23
- onChange: handleChange,
24
- options: users || [],
25
- multiple: false,
26
- disabled: readOnly,
27
- optionAvatar: true
28
- });
29
- };
30
- export default PersonType;
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import { useDataView } from "../../Providers/DataViewProvider";
3
- import Select from "./Components/Select";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const SelectType = props => {
6
- const {
7
- rowIndex,
8
- property,
9
- value,
10
- options,
11
- readOnly
12
- } = props;
13
- const {
14
- onChange
15
- } = useDataView();
16
- const coloredValues = [...(value || [])]?.map(m => {
17
- return {
18
- ...m,
19
- color: options?.find(f => f.value === m.value)?.color
20
- };
21
- });
22
- const handleChange = data => {
23
- onChange(rowIndex, {
24
- [property]: data?.filter(f => f?.value)
25
- });
26
- };
27
- return /*#__PURE__*/_jsx(Select, {
28
- value: coloredValues,
29
- onChange: handleChange,
30
- options: options,
31
- multiple: false,
32
- disabled: readOnly
33
- });
34
- };
35
- export default SelectType;