@flozy/editor 5.5.8 → 5.6.0
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/ChatEditor.js +25 -34
- package/dist/Editor/CommonEditor.js +26 -13
- package/dist/Editor/Editor.css +106 -20
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
- package/dist/Editor/Elements/AI/PopoverAIInput.js +59 -53
- package/dist/Editor/Elements/AI/Styles.js +24 -6
- package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +6 -1
- package/dist/Editor/Elements/Carousel/CarouselItem.js +11 -3
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
- package/dist/Editor/Elements/Color Picker/Styles.js +8 -3
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/DataView/DataView.js +124 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +83 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +180 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +62 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +68 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +86 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +71 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +138 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +213 -0
- package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +44 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +146 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +79 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +57 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +174 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +241 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +45 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +32 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +217 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +131 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +253 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +85 -0
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +277 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +88 -0
- package/dist/Editor/Elements/DataView/styles.js +169 -0
- package/dist/Editor/Elements/Divider/Divider.js +36 -20
- package/dist/Editor/Elements/Embed/Image.js +51 -16
- package/dist/Editor/Elements/Embed/Video.js +26 -3
- package/dist/Editor/Elements/Form/Form.js +38 -2
- package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormDate.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormEmail.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormText.js +7 -1
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +6 -1
- package/dist/Editor/Elements/Form/FormPopup.js +12 -9
- package/dist/Editor/Elements/Form/Workflow/Styles.js +2 -0
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -2
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +47 -36
- package/dist/Editor/Elements/Grid/Styles.js +50 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- package/dist/Editor/Elements/Search/SearchButton.js +1 -0
- package/dist/Editor/Elements/Signature/Signature.css +1 -1
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
- package/dist/Editor/Elements/Signature/SignaturePopup.js +17 -52
- package/dist/Editor/Elements/SimpleText/index.js +3 -2
- package/dist/Editor/Elements/SimpleText/style.js +15 -0
- package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
- package/dist/Editor/Elements/Table/DragButton.js +142 -0
- package/dist/Editor/Elements/Table/DragStyles.js +70 -0
- package/dist/Editor/Elements/Table/Draggable.js +25 -0
- package/dist/Editor/Elements/Table/Droppable.js +53 -0
- package/dist/Editor/Elements/Table/Styles.js +88 -78
- package/dist/Editor/Elements/Table/Table.js +263 -140
- package/dist/Editor/Elements/Table/TableCell.js +365 -111
- package/dist/Editor/Elements/Table/TablePopup.js +9 -3
- package/dist/Editor/Elements/Table/TableRow.js +10 -2
- package/dist/Editor/Elements/Table/TableTool.js +101 -0
- package/dist/Editor/Elements/Table/tableHelper.js +71 -0
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/MiniEditor.js +21 -2
- package/dist/Editor/Styles/EditorStyles.js +13 -4
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -12
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +26 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -5
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +8 -8
- package/dist/Editor/Toolbar/Mini/Styles.js +9 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/InfinityAITool.js +7 -3
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +6 -4
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +19 -15
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +547 -58
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +28 -16
- package/dist/Editor/Toolbar/PopupTool/index.js +3 -5
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/assets/svg/ArrowDownIcon.js +25 -0
- package/dist/Editor/assets/svg/ArrowUpIcon.js +25 -0
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/CalenderIconTick.js +64 -0
- package/dist/Editor/assets/svg/ChervDown.js +18 -0
- package/dist/Editor/assets/svg/ChervUp.js +18 -0
- package/dist/Editor/assets/svg/DataTableIcon.js +50 -0
- package/dist/Editor/assets/svg/DuplicateIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeIcon.js +23 -0
- package/dist/Editor/assets/svg/EyeSlash.js +43 -0
- package/dist/Editor/assets/svg/HashtagIcon.js +33 -0
- package/dist/Editor/assets/svg/PlusIcon.js +23 -0
- package/dist/Editor/assets/svg/SelectRoundedIcon.js +24 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/assets/svg/SortByIcon.js +33 -0
- package/dist/Editor/assets/svg/TableIcons.js +220 -0
- package/dist/Editor/assets/svg/TickOutlined.js +23 -0
- package/dist/Editor/assets/svg/TrashCanIcon.js +38 -0
- package/dist/Editor/common/ColorPickerButton.js +85 -45
- package/dist/Editor/common/DnD/Draggable.js +2 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +2 -2
- package/dist/Editor/common/Icon.js +54 -21
- package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
- package/dist/Editor/common/ImageSelector/Styles.js +47 -6
- package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
- package/dist/Editor/common/LinkSettings/NavComponents.js +2 -1
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +142 -8
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +107 -12
- package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- package/dist/Editor/common/RnD/VirtualElement/index.js +5 -1
- package/dist/Editor/common/RnD/index.js +4 -3
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +5 -1
- package/dist/Editor/common/Select/index.js +20 -0
- package/dist/Editor/common/Select/styles.js +17 -0
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +4 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +35 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +11 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +20 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -2
- package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
- package/dist/Editor/common/StyleBuilder/index.js +101 -20
- package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
- package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +39 -37
- package/dist/Editor/common/iconListV2.js +598 -74
- package/dist/Editor/common/iconslist.js +25 -19
- package/dist/Editor/commonStyle.js +421 -15
- package/dist/Editor/helper/deserialize/index.js +31 -2
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +15 -2
- package/dist/Editor/helper/theme.js +15 -1
- package/dist/Editor/hooks/useBreakpoints.js +1 -1
- package/dist/Editor/hooks/useTable.js +210 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +1 -1
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/plugins/withHTML.js +100 -12
- package/dist/Editor/plugins/withLayout.js +1 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +31 -11
- package/dist/Editor/utils/brains.js +1 -1
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +75 -6
- package/dist/Editor/utils/customHooks/useResize.js +7 -4
- package/dist/Editor/utils/customHooks/useTableResize.js +6 -2
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/embed.js +2 -1
- package/dist/Editor/utils/events.js +0 -1
- package/dist/Editor/utils/font.js +11 -4
- package/dist/Editor/utils/formfield.js +8 -4
- package/dist/Editor/utils/helper.js +100 -2
- package/dist/Editor/utils/insertNewLine.js +19 -1
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/dist/Editor/utils/table.js +228 -24
- package/package.json +2 -2
@@ -0,0 +1,83 @@
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
|
+
import { Box, Checkbox, Popper, useTheme } from "@mui/material";
|
3
|
+
import DataTypes from "./DataTypes";
|
4
|
+
import useColumnStyles from "./colStyles";
|
5
|
+
import Icon from "../../../common/Icon";
|
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 [popperRefresh, setPopperRefresh] = useState(new Date().getTime());
|
23
|
+
const open = Boolean(anchorEl);
|
24
|
+
const classes = useColumnStyles(theme);
|
25
|
+
const parentRef = useRef(null);
|
26
|
+
useEffect(() => {
|
27
|
+
if (!anchorRef?.current) return;
|
28
|
+
setAnchorEl(anchorRef?.current);
|
29
|
+
parentRef.current = anchorRef?.current.closest(".tv-d-wrapper");
|
30
|
+
const resizeObserver = new ResizeObserver(() => {
|
31
|
+
if (parentRef?.current) {
|
32
|
+
setPopperRefresh(new Date().getTime());
|
33
|
+
}
|
34
|
+
});
|
35
|
+
resizeObserver.observe(parentRef.current);
|
36
|
+
return () => {
|
37
|
+
resizeObserver.disconnect();
|
38
|
+
};
|
39
|
+
}, [anchorRef?.current]);
|
40
|
+
const handleSelect = id => e => {
|
41
|
+
onSelect(id, e.target.checked);
|
42
|
+
};
|
43
|
+
return /*#__PURE__*/_jsxs(Box, {
|
44
|
+
component: "td",
|
45
|
+
children: [needAnchor ? /*#__PURE__*/_jsx("span", {
|
46
|
+
ref: anchorRef,
|
47
|
+
style: {
|
48
|
+
position: "absolute",
|
49
|
+
width: "1px"
|
50
|
+
}
|
51
|
+
}) : null, /*#__PURE__*/_jsx(DataType, {
|
52
|
+
options: property?.options,
|
53
|
+
property: property?.key,
|
54
|
+
value: row[property?.key] || "",
|
55
|
+
rowIndex: rowIndex,
|
56
|
+
label: property?.label,
|
57
|
+
readOnly: readOnly
|
58
|
+
}), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
|
59
|
+
sx: classes.root,
|
60
|
+
open: open,
|
61
|
+
anchorEl: anchorEl,
|
62
|
+
placement: "left",
|
63
|
+
className: `tv-tr-pop ${selected ? "active" : ""}`,
|
64
|
+
disablePortal: true,
|
65
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
66
|
+
onClick: handleSelect(row?.id),
|
67
|
+
size: "small",
|
68
|
+
className: "tv-ck-box",
|
69
|
+
sx: {
|
70
|
+
mr: 0
|
71
|
+
},
|
72
|
+
checked: selected,
|
73
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
74
|
+
icon: "uncheckedIcon"
|
75
|
+
}),
|
76
|
+
checkedIcon: /*#__PURE__*/_jsx(Icon, {
|
77
|
+
icon: "checkedIcon"
|
78
|
+
})
|
79
|
+
})
|
80
|
+
}, popperRefresh) : null]
|
81
|
+
});
|
82
|
+
};
|
83
|
+
export default ColumnView;
|
@@ -0,0 +1,33 @@
|
|
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;
|
@@ -0,0 +1,180 @@
|
|
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 { CloseIcon } from "../../../../../common/iconslist";
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
const AvatarIcon = props => {
|
10
|
+
const {
|
11
|
+
option,
|
12
|
+
avatar
|
13
|
+
} = props;
|
14
|
+
const nameIndex = option.label || option.value;
|
15
|
+
return avatar && nameIndex ? /*#__PURE__*/_jsx(Avatar, {
|
16
|
+
alt: option.label || option.value,
|
17
|
+
src: option.avatar || null,
|
18
|
+
children: nameIndex[0] || ""
|
19
|
+
}) : null;
|
20
|
+
};
|
21
|
+
const filter = (opt, params, selectedOpt) => {
|
22
|
+
const selectedVals = selectedOpt?.map(m => m?.value);
|
23
|
+
const fv = opt?.filter(f => !selectedVals.includes(f.value));
|
24
|
+
if (params?.inputValue) {
|
25
|
+
return fv.filter(f => f?.value?.toLowerCase().indexOf(params?.inputValue?.toLowerCase()) >= 0);
|
26
|
+
}
|
27
|
+
return fv;
|
28
|
+
};
|
29
|
+
export default function Select(props) {
|
30
|
+
const theme = useTheme();
|
31
|
+
const {
|
32
|
+
theme: appTheme
|
33
|
+
} = useEditorContext();
|
34
|
+
const classes = useCompStyles(theme, appTheme);
|
35
|
+
const {
|
36
|
+
value: pValue,
|
37
|
+
onChange,
|
38
|
+
options: selectOptions,
|
39
|
+
multiple = false,
|
40
|
+
limitTags = 2,
|
41
|
+
placeholder = "",
|
42
|
+
disabled = false,
|
43
|
+
optionAvatar = false
|
44
|
+
} = props;
|
45
|
+
const value = Array.isArray(pValue) ? pValue : [];
|
46
|
+
const options = selectOptions?.length ? selectOptions.filter(s => s.value) : [];
|
47
|
+
return /*#__PURE__*/_jsx(Autocomplete, {
|
48
|
+
disabled: disabled,
|
49
|
+
className: "tv-ac-field",
|
50
|
+
multiple: true,
|
51
|
+
limitTags: limitTags,
|
52
|
+
placeholder: placeholder,
|
53
|
+
value: value || "",
|
54
|
+
onChange: (event, newValue) => {
|
55
|
+
const fv = [];
|
56
|
+
newValue?.forEach(m => {
|
57
|
+
if (multiple) {
|
58
|
+
fv.push({
|
59
|
+
value: m.inputValue || m.value
|
60
|
+
});
|
61
|
+
} else {
|
62
|
+
fv[0] = {
|
63
|
+
value: m.inputValue || m.value
|
64
|
+
};
|
65
|
+
}
|
66
|
+
});
|
67
|
+
onChange(fv);
|
68
|
+
},
|
69
|
+
filterOptions: (options, params) => {
|
70
|
+
const filtered = filter(options, params, value);
|
71
|
+
|
72
|
+
// const { inputValue } = params;
|
73
|
+
// Suggest the creation of a new value
|
74
|
+
// const isExisting = options.some(
|
75
|
+
// (option) => inputValue?.toLowerCase() === option.value?.toLowerCase()
|
76
|
+
// );
|
77
|
+
// no need of new val now
|
78
|
+
// if (inputValue !== "" && !isExisting) {
|
79
|
+
// filtered.push({
|
80
|
+
// inputValue,
|
81
|
+
// value: `Add "${inputValue}"`,
|
82
|
+
// });
|
83
|
+
// }
|
84
|
+
|
85
|
+
return filtered;
|
86
|
+
},
|
87
|
+
selectOnFocus: true,
|
88
|
+
clearOnBlur: true,
|
89
|
+
handleHomeEndKeys: true,
|
90
|
+
options: options || [],
|
91
|
+
getOptionLabel: option => {
|
92
|
+
// Value selected with enter, right from the input
|
93
|
+
if (typeof option === "string") {
|
94
|
+
return option;
|
95
|
+
}
|
96
|
+
// Add "xxx" option created dynamically
|
97
|
+
if (option.inputValue) {
|
98
|
+
return option.inputValue;
|
99
|
+
}
|
100
|
+
// Regular option
|
101
|
+
return option.value || "";
|
102
|
+
},
|
103
|
+
renderTags: (value, getTagProps) => {
|
104
|
+
return /*#__PURE__*/_jsx(Box, {
|
105
|
+
className: "tv-ms-tag-wrpr",
|
106
|
+
sx: {
|
107
|
+
'& svg': {
|
108
|
+
marginRight: '5px',
|
109
|
+
'& path': {
|
110
|
+
stroke: "#000"
|
111
|
+
}
|
112
|
+
}
|
113
|
+
},
|
114
|
+
children: value?.map((option, index) => {
|
115
|
+
const {
|
116
|
+
key,
|
117
|
+
...tagProps
|
118
|
+
} = getTagProps({
|
119
|
+
index
|
120
|
+
}) || {};
|
121
|
+
return option?.value ? /*#__PURE__*/_jsx(Chip, {
|
122
|
+
variant: "outlined",
|
123
|
+
label: option?.label || option?.value,
|
124
|
+
...tagProps,
|
125
|
+
sx: {
|
126
|
+
background: option?.color || appTheme?.palette?.editor?.tv_border1,
|
127
|
+
border: "none",
|
128
|
+
'& .MuiChip-label': {
|
129
|
+
paddingLeft: '12px !important'
|
130
|
+
}
|
131
|
+
},
|
132
|
+
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
133
|
+
option: option,
|
134
|
+
avatar: optionAvatar
|
135
|
+
}),
|
136
|
+
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {})
|
137
|
+
}, key) : null;
|
138
|
+
})
|
139
|
+
});
|
140
|
+
},
|
141
|
+
renderOption: (props, option) => {
|
142
|
+
const {
|
143
|
+
key,
|
144
|
+
...optionProps
|
145
|
+
} = props;
|
146
|
+
return /*#__PURE__*/_jsx("li", {
|
147
|
+
...optionProps,
|
148
|
+
children: /*#__PURE__*/_jsx(Chip, {
|
149
|
+
label: option.label || option.value || "",
|
150
|
+
sx: {
|
151
|
+
background: option.color || appTheme?.palette?.editor?.tv_border1,
|
152
|
+
'& .MuiChip-label': {
|
153
|
+
paddingLeft: '12px !important'
|
154
|
+
}
|
155
|
+
},
|
156
|
+
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
157
|
+
option: option,
|
158
|
+
avatar: optionAvatar
|
159
|
+
}),
|
160
|
+
deleteIcon: /*#__PURE__*/_jsx(CloseIcon, {})
|
161
|
+
})
|
162
|
+
}, key);
|
163
|
+
},
|
164
|
+
freeSolo: true,
|
165
|
+
size: "small",
|
166
|
+
fullWidth: true,
|
167
|
+
renderInput: params => {
|
168
|
+
return /*#__PURE__*/_jsx(TextField, {
|
169
|
+
size: "small",
|
170
|
+
...params,
|
171
|
+
placeholder: placeholder
|
172
|
+
});
|
173
|
+
},
|
174
|
+
slotProps: {
|
175
|
+
paper: {
|
176
|
+
sx: classes.autocomplete
|
177
|
+
}
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}
|
@@ -0,0 +1,62 @@
|
|
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 KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
const SimpleSelect = props => {
|
8
|
+
const theme = useTheme();
|
9
|
+
const {
|
10
|
+
theme: appTheme
|
11
|
+
} = useEditorContext();
|
12
|
+
const classes = useCompStyles(theme, appTheme);
|
13
|
+
const {
|
14
|
+
value,
|
15
|
+
options,
|
16
|
+
handleChange,
|
17
|
+
disabled = false
|
18
|
+
} = props;
|
19
|
+
return /*#__PURE__*/_jsx(Select, {
|
20
|
+
disabled: disabled,
|
21
|
+
value: value,
|
22
|
+
onChange: handleChange,
|
23
|
+
IconComponent: KeyboardArrowDownRoundedIcon,
|
24
|
+
fullWidth: true,
|
25
|
+
size: "small",
|
26
|
+
sx: {
|
27
|
+
color: appTheme?.palette?.editor?.tv_text,
|
28
|
+
fontSize: '14px !important',
|
29
|
+
marginTop: '4px !important',
|
30
|
+
padding: '3px 0px !important',
|
31
|
+
background: 'transparent !important',
|
32
|
+
'& .MuiOutlinedInput-root': {
|
33
|
+
height: '34px !important',
|
34
|
+
background: 'transparent !important'
|
35
|
+
},
|
36
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
37
|
+
border: `1px solid ${appTheme?.palette?.editor?.inputFieldBorder} !important`,
|
38
|
+
boxShadow: '0px 4px 18px 0px #0000000D !important',
|
39
|
+
background: 'transparent !important'
|
40
|
+
},
|
41
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
42
|
+
border: `1px solid ${appTheme?.palette?.editor?.inputFieldBorder} !important`,
|
43
|
+
boxShadow: '0px 4px 18px 0px #0000000D !important',
|
44
|
+
background: 'transparent !important'
|
45
|
+
}
|
46
|
+
},
|
47
|
+
MenuProps: {
|
48
|
+
PaperProps: {
|
49
|
+
sx: classes.simpleselect,
|
50
|
+
className: "tv-cf-opt-wrpr"
|
51
|
+
}
|
52
|
+
},
|
53
|
+
children: options?.map((m, i) => {
|
54
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
55
|
+
value: m.key,
|
56
|
+
className: "tv-cf-opt-wrpr",
|
57
|
+
children: m.label
|
58
|
+
}, i);
|
59
|
+
})
|
60
|
+
});
|
61
|
+
};
|
62
|
+
export default SimpleSelect;
|
@@ -0,0 +1,68 @@
|
|
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,
|
6
|
+
fontSize: '14px',
|
7
|
+
borderRadius: "8px",
|
8
|
+
[theme?.breakpoints?.between("xs", "md")]: {},
|
9
|
+
"& ul": {
|
10
|
+
padding: "4px",
|
11
|
+
"& li": {
|
12
|
+
padding: "4px 6px",
|
13
|
+
borderRadius: "8px",
|
14
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
15
|
+
fontSize: "14px",
|
16
|
+
marginTop: "4px",
|
17
|
+
"&.Mui-selected": {
|
18
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
19
|
+
color: appTheme?.palette?.editor?.tv_hover_text,
|
20
|
+
"&:hover": {
|
21
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
22
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"&:hover": {
|
26
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
27
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
},
|
32
|
+
autocomplete: {
|
33
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
34
|
+
background: appTheme?.palette?.editor?.tv_pop_bg,
|
35
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
36
|
+
borderRadius: "8px",
|
37
|
+
"& ul": {
|
38
|
+
padding: "4px",
|
39
|
+
"& .MuiAutocomplete-option": {
|
40
|
+
padding: "4px 6px",
|
41
|
+
borderRadius: "8px",
|
42
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
43
|
+
fontSize: "14px",
|
44
|
+
"& .MuiAvatar-root": {
|
45
|
+
width: "20px",
|
46
|
+
height: "20px",
|
47
|
+
marginLeft: "8px",
|
48
|
+
fontSize: "16px",
|
49
|
+
padding: "2px",
|
50
|
+
textTransform: "capitalize"
|
51
|
+
},
|
52
|
+
"&.Mui-selected": {
|
53
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
54
|
+
color: appTheme?.palette?.editor?.tv_hover_text,
|
55
|
+
"&:hover": {
|
56
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
57
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
58
|
+
}
|
59
|
+
},
|
60
|
+
"&:hover": {
|
61
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
62
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
});
|
68
|
+
export default useCompStyles;
|
@@ -0,0 +1,35 @@
|
|
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;
|
@@ -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;
|
@@ -0,0 +1,36 @@
|
|
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 TextType = 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
|
+
const formatValue = () => {
|
21
|
+
if (typeof value === "string") {
|
22
|
+
return value;
|
23
|
+
} else if (value[0]) {
|
24
|
+
return value?.map(m => m.value).join(", ");
|
25
|
+
}
|
26
|
+
};
|
27
|
+
return /*#__PURE__*/_jsx(TextField, {
|
28
|
+
fullWidth: true,
|
29
|
+
className: "fe-tv-type_text",
|
30
|
+
value: formatValue(value),
|
31
|
+
size: "small",
|
32
|
+
onChange: handleChange,
|
33
|
+
disabled: readOnly
|
34
|
+
});
|
35
|
+
};
|
36
|
+
export default TextType;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import TextType from "./TextType";
|
2
|
+
import DateType from "./DateType";
|
3
|
+
import SelectType from "./SelectType";
|
4
|
+
import MultiSelectType from "./MultiSelectType";
|
5
|
+
import NumberType from "./NumberType";
|
6
|
+
import CheckType from "./CheckType";
|
7
|
+
import PersonType from "./PersonType";
|
8
|
+
const DataTypes = {
|
9
|
+
text: TextType,
|
10
|
+
date: DateType,
|
11
|
+
select: SelectType,
|
12
|
+
"multi-select": MultiSelectType,
|
13
|
+
number: NumberType,
|
14
|
+
check: CheckType,
|
15
|
+
person: PersonType
|
16
|
+
};
|
17
|
+
export default DataTypes;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Box } from "@mui/material";
|
3
|
+
import SimpleSelect from "../../DataTypes/Components/SimpleSelect";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const ChooseField = props => {
|
6
|
+
const {
|
7
|
+
sort,
|
8
|
+
properties,
|
9
|
+
onChange
|
10
|
+
} = props;
|
11
|
+
const handleChange = e => {
|
12
|
+
onChange(sort, {
|
13
|
+
newKey: e?.target?.value
|
14
|
+
});
|
15
|
+
};
|
16
|
+
return /*#__PURE__*/_jsx(Box, {
|
17
|
+
sx: {
|
18
|
+
width: "120px",
|
19
|
+
mr: 1
|
20
|
+
},
|
21
|
+
className: "tv-cf",
|
22
|
+
children: /*#__PURE__*/_jsx(SimpleSelect, {
|
23
|
+
value: sort?.key,
|
24
|
+
options: properties,
|
25
|
+
handleChange: handleChange
|
26
|
+
})
|
27
|
+
});
|
28
|
+
};
|
29
|
+
export default ChooseField;
|