@flozy/editor 5.1.4 → 5.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +25 -34
- package/dist/Editor/CommonEditor.js +15 -9
- package/dist/Editor/Editor.css +56 -12
- package/dist/Editor/Elements/AI/AIInput.js +0 -1
- package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
- package/dist/Editor/Elements/AI/Styles.js +7 -1
- package/dist/Editor/Elements/Button/EditorButton.js +1 -1
- package/dist/Editor/Elements/Carousel/CarouselItem.js +1 -1
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +7 -5
- package/dist/Editor/Elements/Color Picker/Styles.js +7 -3
- package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
- package/dist/Editor/Elements/DataView/DataView.js +101 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +59 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +140 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +59 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +26 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +38 -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 +74 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -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 +37 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +62 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
- package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +100 -0
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +70 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +288 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +72 -0
- package/dist/Editor/Elements/DataView/styles.js +143 -0
- package/dist/Editor/Elements/Divider/Divider.js +15 -14
- 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/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +20 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -1
- package/dist/Editor/Elements/Grid/GridItem.js +12 -0
- package/dist/Editor/Elements/Link/LinkButton.js +1 -1
- 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 +13 -48
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +8 -1
- package/dist/Editor/Elements/Table/AddRowCol.js +77 -0
- package/dist/Editor/Elements/Table/DragButton.js +141 -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 +25 -43
- package/dist/Editor/Elements/Table/Table.js +205 -138
- package/dist/Editor/Elements/Table/TableCell.js +355 -102
- 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/Styles/EditorStyles.js +3 -1
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +10 -0
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +7 -11
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +10 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +3 -0
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +0 -2
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +3 -6
- package/dist/Editor/Toolbar/Mini/Styles.js +4 -1
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -3
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +16 -11
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +416 -49
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +62 -8
- package/dist/Editor/Toolbar/PopupTool/index.js +5 -6
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/assets/svg/BrainIcon.js +2 -2
- package/dist/Editor/assets/svg/TableIcons.js +220 -0
- package/dist/Editor/common/ColorPickerButton.js +3 -2
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/Icon.js +24 -23
- 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 +151 -3
- package/dist/Editor/common/MentionsPopup/index.js +1 -1
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +108 -12
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
- 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/fieldTypes/backgroundImage.js +5 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +8 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/radiusStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +5 -2
- package/dist/Editor/common/StyleBuilder/formStyle.js +268 -149
- package/dist/Editor/common/StyleBuilder/index.js +84 -11
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/common/StyleBuilder/tableStyle.js +69 -25
- package/dist/Editor/common/SwipeableDrawer/style.js +15 -4
- package/dist/Editor/common/Uploader.js +8 -0
- package/dist/Editor/common/iconListV2.js +378 -40
- package/dist/Editor/common/iconslist.js +23 -17
- package/dist/Editor/commonStyle.js +126 -9
- package/dist/Editor/helper/deserialize/index.js +4 -1
- package/dist/Editor/helper/index.js +2 -2
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/hooks/useTable.js +195 -0
- package/dist/Editor/plugins/withCustomDeleteBackward.js +3 -2
- package/dist/Editor/plugins/withHTML.js +17 -1
- package/dist/Editor/plugins/withLayout.js +48 -1
- package/dist/Editor/utils/SlateUtilityFunctions.js +18 -0
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +21 -0
- 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 +67 -2
- package/dist/Editor/utils/insertNewLine.js +19 -1
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/dist/Editor/utils/serializeToText.js +2 -0
- package/dist/Editor/utils/table.js +228 -24
- package/package.json +1 -1
@@ -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,59 @@
|
|
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
|
+
ref: anchorRef,
|
31
|
+
children: [/*#__PURE__*/_jsx(DataType, {
|
32
|
+
options: property?.options,
|
33
|
+
property: property?.key,
|
34
|
+
value: row[property?.key] || "",
|
35
|
+
rowIndex: rowIndex,
|
36
|
+
label: property?.label,
|
37
|
+
readOnly: readOnly
|
38
|
+
}), needAnchor && !readOnly ? /*#__PURE__*/_jsx(Popper, {
|
39
|
+
sx: {
|
40
|
+
zIndex: 1000
|
41
|
+
},
|
42
|
+
open: open,
|
43
|
+
anchorEl: anchorEl,
|
44
|
+
placement: "left",
|
45
|
+
container: anchorRef?.current,
|
46
|
+
className: `tv-tr-pop ${selected ? "active" : ""}`,
|
47
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
48
|
+
onClick: handleSelect(row?.id),
|
49
|
+
size: "small",
|
50
|
+
className: "tv-ck-box",
|
51
|
+
sx: {
|
52
|
+
mr: 0
|
53
|
+
},
|
54
|
+
checked: selected
|
55
|
+
})
|
56
|
+
}) : null]
|
57
|
+
});
|
58
|
+
};
|
59
|
+
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,140 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import TextField from "@mui/material/TextField";
|
3
|
+
import Autocomplete from "@mui/material/Autocomplete";
|
4
|
+
import { 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 filter = (opt, params, selectedOpt) => {
|
9
|
+
const selectedVals = selectedOpt?.map(m => m?.value);
|
10
|
+
const fv = opt?.filter(f => !selectedVals.includes(f.value));
|
11
|
+
if (params?.inputValue) {
|
12
|
+
fv.filter(f => f?.value?.toLowerCase().indexOf(params?.inputValue?.toLowerCase()) >= 0);
|
13
|
+
}
|
14
|
+
return fv;
|
15
|
+
};
|
16
|
+
export default function Select(props) {
|
17
|
+
const theme = useTheme();
|
18
|
+
const {
|
19
|
+
theme: appTheme
|
20
|
+
} = useEditorContext();
|
21
|
+
const classes = useCompStyles(theme, appTheme);
|
22
|
+
const {
|
23
|
+
value,
|
24
|
+
onChange,
|
25
|
+
options,
|
26
|
+
multiple = false,
|
27
|
+
limitTags = 2,
|
28
|
+
placeholder = "",
|
29
|
+
disabled = false
|
30
|
+
} = props;
|
31
|
+
return /*#__PURE__*/_jsx(Autocomplete, {
|
32
|
+
disabled: disabled,
|
33
|
+
className: "tv-ac-field",
|
34
|
+
multiple: true,
|
35
|
+
limitTags: limitTags,
|
36
|
+
placeholder: placeholder,
|
37
|
+
value: value || "",
|
38
|
+
onChange: (event, newValue) => {
|
39
|
+
const fv = [];
|
40
|
+
newValue?.forEach(m => {
|
41
|
+
if (multiple) {
|
42
|
+
fv.push({
|
43
|
+
value: m.inputValue || m.value
|
44
|
+
});
|
45
|
+
} else {
|
46
|
+
fv[0] = {
|
47
|
+
value: m.inputValue || m.value
|
48
|
+
};
|
49
|
+
}
|
50
|
+
});
|
51
|
+
onChange(fv);
|
52
|
+
},
|
53
|
+
filterOptions: (options, params) => {
|
54
|
+
const filtered = filter(options, params, value);
|
55
|
+
|
56
|
+
// const { inputValue } = params;
|
57
|
+
// Suggest the creation of a new value
|
58
|
+
// const isExisting = options.some(
|
59
|
+
// (option) => inputValue?.toLowerCase() === option.value?.toLowerCase()
|
60
|
+
// );
|
61
|
+
// no need of new val now
|
62
|
+
// if (inputValue !== "" && !isExisting) {
|
63
|
+
// filtered.push({
|
64
|
+
// inputValue,
|
65
|
+
// value: `Add "${inputValue}"`,
|
66
|
+
// });
|
67
|
+
// }
|
68
|
+
|
69
|
+
return filtered;
|
70
|
+
},
|
71
|
+
selectOnFocus: true,
|
72
|
+
clearOnBlur: true,
|
73
|
+
handleHomeEndKeys: true,
|
74
|
+
options: options || [],
|
75
|
+
getOptionLabel: option => {
|
76
|
+
// Value selected with enter, right from the input
|
77
|
+
if (typeof option === "string") {
|
78
|
+
return option;
|
79
|
+
}
|
80
|
+
// Add "xxx" option created dynamically
|
81
|
+
if (option.inputValue) {
|
82
|
+
return option.inputValue;
|
83
|
+
}
|
84
|
+
// Regular option
|
85
|
+
return option.value || "";
|
86
|
+
},
|
87
|
+
renderTags: (value, getTagProps) => {
|
88
|
+
return /*#__PURE__*/_jsx(Box, {
|
89
|
+
className: "tv-ms-tag-wrpr",
|
90
|
+
children: value?.map((option, index) => {
|
91
|
+
const {
|
92
|
+
key,
|
93
|
+
...tagProps
|
94
|
+
} = getTagProps({
|
95
|
+
index
|
96
|
+
}) || {};
|
97
|
+
return option?.value ? /*#__PURE__*/_jsx(Chip, {
|
98
|
+
variant: "outlined",
|
99
|
+
label: option?.label || option?.value,
|
100
|
+
...tagProps,
|
101
|
+
sx: {
|
102
|
+
background: option?.color || "#CCC",
|
103
|
+
border: "none"
|
104
|
+
}
|
105
|
+
}, key) : null;
|
106
|
+
})
|
107
|
+
});
|
108
|
+
},
|
109
|
+
renderOption: (props, option) => {
|
110
|
+
const {
|
111
|
+
key,
|
112
|
+
...optionProps
|
113
|
+
} = props;
|
114
|
+
return /*#__PURE__*/_jsx("li", {
|
115
|
+
...optionProps,
|
116
|
+
children: /*#__PURE__*/_jsx(Chip, {
|
117
|
+
label: option.label || option.value || "",
|
118
|
+
sx: {
|
119
|
+
backgroundColor: option.color || "#CCC"
|
120
|
+
}
|
121
|
+
})
|
122
|
+
}, key);
|
123
|
+
},
|
124
|
+
freeSolo: true,
|
125
|
+
size: "small",
|
126
|
+
fullWidth: true,
|
127
|
+
renderInput: params => {
|
128
|
+
return /*#__PURE__*/_jsx(TextField, {
|
129
|
+
size: "small",
|
130
|
+
...params,
|
131
|
+
placeholder: placeholder
|
132
|
+
});
|
133
|
+
},
|
134
|
+
slotProps: {
|
135
|
+
paper: {
|
136
|
+
sx: classes.autocomplete
|
137
|
+
}
|
138
|
+
}
|
139
|
+
});
|
140
|
+
}
|
@@ -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,59 @@
|
|
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
|
+
"&.Mui-selected": {
|
44
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
45
|
+
color: appTheme?.palette?.editor?.tv_hover_text,
|
46
|
+
"&:hover": {
|
47
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
48
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"&:hover": {
|
52
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
53
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
});
|
59
|
+
export default useCompStyles;
|
@@ -0,0 +1,26 @@
|
|
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
|
+
const DateType = props => {
|
6
|
+
const {
|
7
|
+
rowIndex,
|
8
|
+
property,
|
9
|
+
value,
|
10
|
+
readOnly
|
11
|
+
} = props;
|
12
|
+
const {
|
13
|
+
onChange
|
14
|
+
} = useDataView();
|
15
|
+
const handleChange = date => {
|
16
|
+
onChange(rowIndex, {
|
17
|
+
[property]: date
|
18
|
+
});
|
19
|
+
};
|
20
|
+
return /*#__PURE__*/_jsx(DatePicker, {
|
21
|
+
disabled: readOnly,
|
22
|
+
selected: value ? new Date(value) : "",
|
23
|
+
onChange: handleChange
|
24
|
+
});
|
25
|
+
};
|
26
|
+
export default DateType;
|
@@ -0,0 +1,38 @@
|
|
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,
|
10
|
+
options,
|
11
|
+
label = "",
|
12
|
+
readOnly
|
13
|
+
} = props;
|
14
|
+
const {
|
15
|
+
onChange
|
16
|
+
} = useDataView();
|
17
|
+
const coloredValues = [...(value || [])]?.map(m => {
|
18
|
+
return {
|
19
|
+
...m,
|
20
|
+
color: options?.find(f => f.value === m.value)?.color || "#FFF"
|
21
|
+
};
|
22
|
+
});
|
23
|
+
const handleChange = data => {
|
24
|
+
onChange(rowIndex, {
|
25
|
+
[property]: data?.filter(f => f?.value)
|
26
|
+
});
|
27
|
+
};
|
28
|
+
return /*#__PURE__*/_jsx(Select, {
|
29
|
+
value: coloredValues,
|
30
|
+
onChange: handleChange,
|
31
|
+
options: options,
|
32
|
+
multiple: true,
|
33
|
+
limitTags: 2,
|
34
|
+
placeholder: label,
|
35
|
+
disabled: readOnly
|
36
|
+
});
|
37
|
+
};
|
38
|
+
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
|
+
console.log(users);
|
17
|
+
const handleChange = data => {
|
18
|
+
onChange(rowIndex, {
|
19
|
+
[property]: data?.filter(f => f?.value)
|
20
|
+
});
|
21
|
+
};
|
22
|
+
return /*#__PURE__*/_jsx(Select, {
|
23
|
+
value: value || [],
|
24
|
+
onChange: handleChange,
|
25
|
+
options: users,
|
26
|
+
multiple: false,
|
27
|
+
disabled: readOnly
|
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;
|
@@ -0,0 +1,38 @@
|
|
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 SORT_LABELS = {
|
6
|
+
asc: "Ascending",
|
7
|
+
desc: "Descending"
|
8
|
+
};
|
9
|
+
const SORT_OPTIONS = [{
|
10
|
+
key: "asc",
|
11
|
+
label: SORT_LABELS.asc
|
12
|
+
}, {
|
13
|
+
key: "desc",
|
14
|
+
label: SORT_LABELS.desc
|
15
|
+
}];
|
16
|
+
const ChooseSort = props => {
|
17
|
+
const {
|
18
|
+
sort,
|
19
|
+
onChange
|
20
|
+
} = props;
|
21
|
+
const handleChange = e => {
|
22
|
+
onChange(sort, {
|
23
|
+
operator: e?.target?.value
|
24
|
+
});
|
25
|
+
};
|
26
|
+
return /*#__PURE__*/_jsx(Box, {
|
27
|
+
sx: {
|
28
|
+
width: "120px"
|
29
|
+
},
|
30
|
+
className: "tv-cf",
|
31
|
+
children: /*#__PURE__*/_jsx(SimpleSelect, {
|
32
|
+
value: sort?.operator,
|
33
|
+
options: SORT_OPTIONS,
|
34
|
+
handleChange: handleChange
|
35
|
+
})
|
36
|
+
});
|
37
|
+
};
|
38
|
+
export default ChooseSort;
|