@flozy/editor 5.1.5 → 5.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +15 -9
  3. package/dist/Editor/Editor.css +56 -12
  4. package/dist/Editor/Elements/AI/AIInput.js +0 -1
  5. package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
  6. package/dist/Editor/Elements/AI/Styles.js +7 -1
  7. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  8. package/dist/Editor/Elements/Button/EditorButton.js +1 -1
  9. package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -1
  10. package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
  11. package/dist/Editor/Elements/Color Picker/Styles.js +7 -3
  12. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  13. package/dist/Editor/Elements/DataView/DataView.js +109 -0
  14. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  15. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +66 -0
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +30 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +30 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  22. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  23. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  24. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  25. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  26. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  27. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  28. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  29. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  30. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  31. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  32. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  33. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  34. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  41. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  42. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  43. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  44. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  45. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  46. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  47. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  48. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +70 -0
  49. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  50. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +288 -0
  51. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  52. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +72 -0
  53. package/dist/Editor/Elements/DataView/styles.js +143 -0
  54. package/dist/Editor/Elements/Divider/Divider.js +15 -14
  55. package/dist/Editor/Elements/Form/Form.js +38 -2
  56. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
  57. package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
  58. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
  59. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
  60. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
  61. package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
  62. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
  63. package/dist/Editor/Elements/Form/FormPopup.js +12 -9
  64. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  65. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
  66. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  67. package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
  68. package/dist/Editor/Elements/Grid/GridButton.js +2 -2
  69. package/dist/Editor/Elements/Grid/GridItem.js +21 -18
  70. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  71. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  72. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  73. package/dist/Editor/Elements/Signature/SignaturePopup.js +13 -48
  74. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  75. package/dist/Editor/Elements/SimpleText/style.js +13 -1
  76. package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
  77. package/dist/Editor/Elements/Table/DragButton.js +141 -0
  78. package/dist/Editor/Elements/Table/DragStyles.js +70 -0
  79. package/dist/Editor/Elements/Table/Draggable.js +25 -0
  80. package/dist/Editor/Elements/Table/Droppable.js +53 -0
  81. package/dist/Editor/Elements/Table/Styles.js +25 -43
  82. package/dist/Editor/Elements/Table/Table.js +205 -138
  83. package/dist/Editor/Elements/Table/TableCell.js +355 -102
  84. package/dist/Editor/Elements/Table/TablePopup.js +9 -3
  85. package/dist/Editor/Elements/Table/TableRow.js +10 -2
  86. package/dist/Editor/Elements/Table/TableTool.js +101 -0
  87. package/dist/Editor/Elements/Table/tableHelper.js +71 -0
  88. package/dist/Editor/Styles/EditorStyles.js +3 -1
  89. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
  90. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -12
  91. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +10 -4
  92. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
  93. package/dist/Editor/Toolbar/FormatTools/TextSize.js +0 -2
  94. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -6
  95. package/dist/Editor/Toolbar/Mini/Styles.js +4 -1
  96. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -3
  97. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +19 -15
  98. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +411 -49
  99. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +62 -8
  100. package/dist/Editor/Toolbar/PopupTool/index.js +5 -6
  101. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  102. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  103. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  104. package/dist/Editor/assets/svg/TableIcons.js +220 -0
  105. package/dist/Editor/common/ColorPickerButton.js +3 -2
  106. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  107. package/dist/Editor/common/Icon.js +20 -19
  108. package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
  109. package/dist/Editor/common/LinkSettings/index.js +2 -1
  110. package/dist/Editor/common/MentionsPopup/Styles.js +152 -8
  111. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  112. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +108 -12
  113. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  114. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  115. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  116. package/dist/Editor/common/Select/index.js +20 -0
  117. package/dist/Editor/common/Select/styles.js +17 -0
  118. package/dist/Editor/common/Shorthands/elements.js +13 -1
  119. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  120. package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +8 -4
  121. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  122. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  123. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  124. package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +7 -7
  125. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
  126. package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
  127. package/dist/Editor/common/StyleBuilder/index.js +84 -11
  128. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  129. package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
  130. package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
  131. package/dist/Editor/common/Uploader.js +8 -0
  132. package/dist/Editor/common/iconListV2.js +378 -40
  133. package/dist/Editor/common/iconslist.js +23 -17
  134. package/dist/Editor/commonStyle.js +126 -9
  135. package/dist/Editor/helper/deserialize/index.js +4 -1
  136. package/dist/Editor/helper/index.js +2 -2
  137. package/dist/Editor/helper/theme.js +24 -1
  138. package/dist/Editor/hooks/useMouseMove.js +5 -2
  139. package/dist/Editor/hooks/useTable.js +195 -0
  140. package/dist/Editor/plugins/withCustomDeleteBackward.js +3 -2
  141. package/dist/Editor/plugins/withHTML.js +17 -1
  142. package/dist/Editor/plugins/withLayout.js +48 -1
  143. package/dist/Editor/utils/SlateUtilityFunctions.js +18 -0
  144. package/dist/Editor/utils/button.js +4 -4
  145. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +21 -0
  146. package/dist/Editor/utils/dataView.js +43 -0
  147. package/dist/Editor/utils/embed.js +2 -1
  148. package/dist/Editor/utils/events.js +0 -1
  149. package/dist/Editor/utils/font.js +11 -4
  150. package/dist/Editor/utils/formfield.js +8 -4
  151. package/dist/Editor/utils/helper.js +67 -2
  152. package/dist/Editor/utils/insertNewLine.js +19 -1
  153. package/dist/Editor/utils/pageSettings.js +14 -2
  154. package/dist/Editor/utils/serializeToText.js +2 -0
  155. package/dist/Editor/utils/table.js +228 -24
  156. package/package.json +1 -1
@@ -0,0 +1,109 @@
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
+ title
25
+ } = props;
26
+ const {
27
+ CHARACTERS,
28
+ readOnly
29
+ } = customProps || {};
30
+ const {
31
+ properties,
32
+ layouts,
33
+ rows
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
+ return /*#__PURE__*/_jsx(Box, {
83
+ ...attributes,
84
+ className: "fe-dataview",
85
+ sx: classes.root,
86
+ children: /*#__PURE__*/_jsxs(DataViewProvider, {
87
+ initialData: {
88
+ properties,
89
+ layouts,
90
+ rows,
91
+ users: users,
92
+ tableTitle: title
93
+ },
94
+ path: path,
95
+ editor: editor,
96
+ children: [/*#__PURE__*/_jsx(FilterView, {
97
+ classes: classes,
98
+ onEnter: onEnter,
99
+ onDelete: onDelete,
100
+ onDuplicate: onDuplicate,
101
+ readOnly: readOnly
102
+ }), /*#__PURE__*/_jsx(LayoutView, {
103
+ readOnly: readOnly,
104
+ children: children
105
+ })]
106
+ })
107
+ });
108
+ };
109
+ export default DataView;
@@ -0,0 +1,23 @@
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;
@@ -0,0 +1,66 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { Box, Checkbox, Popper } from "@mui/material";
3
+ import DataTypes from "./DataTypes";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const ColumnView = props => {
7
+ const {
8
+ needAnchor,
9
+ rowIndex,
10
+ row,
11
+ property,
12
+ onSelect,
13
+ selected,
14
+ readOnly
15
+ } = props;
16
+ const DataType = DataTypes[property?.type] || DataTypes["text"];
17
+ const anchorRef = useRef(null);
18
+ const [anchorEl, setAnchorEl] = useState(null);
19
+ const open = Boolean(anchorEl);
20
+ useEffect(() => {
21
+ if (anchorRef?.current) {
22
+ setAnchorEl(anchorRef?.current);
23
+ }
24
+ }, [anchorRef?.current]);
25
+ const handleSelect = id => e => {
26
+ onSelect(id, e.target.checked);
27
+ };
28
+ return /*#__PURE__*/_jsxs(Box, {
29
+ component: "td",
30
+ children: [needAnchor ? /*#__PURE__*/_jsx("span", {
31
+ ref: anchorRef,
32
+ style: {
33
+ position: "absolute",
34
+ width: "1px"
35
+ }
36
+ }) : null, /*#__PURE__*/_jsx(DataType, {
37
+ options: property?.options,
38
+ property: property?.key,
39
+ value: row[property?.key] || "",
40
+ rowIndex: rowIndex,
41
+ label: property?.label,
42
+ readOnly: readOnly
43
+ }), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
44
+ sx: {
45
+ zIndex: 1000,
46
+ marginTop: "20px !important"
47
+ },
48
+ open: open,
49
+ anchorEl: anchorEl,
50
+ placement: "left",
51
+ container: anchorRef?.current,
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
+ })
63
+ }) : null]
64
+ });
65
+ };
66
+ export default ColumnView;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { useDataView } from "../../Providers/DataViewProvider";
3
+ import Checkbox from "@mui/material/Checkbox";
4
+ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
5
+ import CheckCircleIcon from "@mui/icons-material/CheckCircle";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const CheckType = props => {
8
+ const {
9
+ rowIndex,
10
+ property,
11
+ value,
12
+ readOnly
13
+ } = props;
14
+ const {
15
+ onChange
16
+ } = useDataView();
17
+ const handleChange = e => {
18
+ onChange(rowIndex, {
19
+ [property]: e?.target?.checked
20
+ });
21
+ };
22
+ return /*#__PURE__*/_jsx(Checkbox, {
23
+ checked: value,
24
+ icon: /*#__PURE__*/_jsx(CheckCircleOutlineIcon, {}),
25
+ checkedIcon: /*#__PURE__*/_jsx(CheckCircleIcon, {}),
26
+ onChange: handleChange,
27
+ disabled: readOnly
28
+ }, rowIndex);
29
+ };
30
+ export default CheckType;
@@ -0,0 +1,162 @@
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 ? /*#__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
+ 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
+ backgroundColor: 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
+ }
@@ -0,0 +1,40 @@
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;
@@ -0,0 +1,67 @@
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;
@@ -0,0 +1,30 @@
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
+ });
29
+ };
30
+ export default DateType;
@@ -0,0 +1,39 @@
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;
@@ -0,0 +1,30 @@
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;
@@ -0,0 +1,30 @@
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;
@@ -0,0 +1,35 @@
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;