@flozy/editor 5.1.5 → 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 +152 -7
- 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,30 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { List, ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
|
3
|
+
import { PROPERTY_TYPES } from "./Constants";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
const PropertyList = props => {
|
7
|
+
const {
|
8
|
+
onSelect,
|
9
|
+
selected
|
10
|
+
} = props;
|
11
|
+
return /*#__PURE__*/_jsx(List, {
|
12
|
+
children: PROPERTY_TYPES?.map(({
|
13
|
+
Icon,
|
14
|
+
...rest
|
15
|
+
}, i) => {
|
16
|
+
return /*#__PURE__*/_jsxs(ListItemButton, {
|
17
|
+
className: selected?.type === rest?.type ? "active" : "",
|
18
|
+
onClick: onSelect(rest),
|
19
|
+
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
20
|
+
className: "needBg",
|
21
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
22
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
23
|
+
primary: rest?.label
|
24
|
+
})]
|
25
|
+
}, i);
|
26
|
+
})
|
27
|
+
});
|
28
|
+
};
|
29
|
+
PropertyList.defaultProps = {};
|
30
|
+
export default PropertyList;
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Popover, SwipeableDrawer } from "@mui/material";
|
3
|
+
import useOptionsStyles from "./styles";
|
4
|
+
import AddProperty from "./AddProperty";
|
5
|
+
import EditProperty from "./EditProperty";
|
6
|
+
import ChangeProperty from "./ChangeProperty";
|
7
|
+
import AllProperties from "./AllProperties";
|
8
|
+
import EditOption from "./EditOption";
|
9
|
+
import { useTheme } from "@emotion/react";
|
10
|
+
import { useEditorContext } from "../../../../hooks/useMouseMove";
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
12
|
+
const POSITIONS = {
|
13
|
+
addProperty: {
|
14
|
+
anchorOrigin: {
|
15
|
+
vertical: "bottom",
|
16
|
+
horizontal: "right"
|
17
|
+
},
|
18
|
+
transformOrigin: {
|
19
|
+
vertical: "top",
|
20
|
+
horizontal: "right"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
allProperties: {
|
24
|
+
anchorOrigin: {
|
25
|
+
vertical: "bottom",
|
26
|
+
horizontal: "right"
|
27
|
+
},
|
28
|
+
transformOrigin: {
|
29
|
+
vertical: "top",
|
30
|
+
horizontal: "right"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
};
|
34
|
+
const PropertySettings = props => {
|
35
|
+
const {
|
36
|
+
theme: appTheme
|
37
|
+
} = useEditorContext();
|
38
|
+
const theme = useTheme();
|
39
|
+
const {
|
40
|
+
open,
|
41
|
+
anchorEl,
|
42
|
+
mode,
|
43
|
+
onClose,
|
44
|
+
onEvent
|
45
|
+
} = props;
|
46
|
+
const classes = useOptionsStyles(theme, appTheme);
|
47
|
+
const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
|
48
|
+
const PoperComponent = isMobile ? SwipeableDrawer : Popover;
|
49
|
+
const renderMode = () => {
|
50
|
+
switch (mode?.type) {
|
51
|
+
case "addProperty":
|
52
|
+
return /*#__PURE__*/_jsx(AddProperty, {
|
53
|
+
classes: classes,
|
54
|
+
onClose: onClose,
|
55
|
+
onEvent: onEvent,
|
56
|
+
mode: mode
|
57
|
+
});
|
58
|
+
case "editProperty":
|
59
|
+
return /*#__PURE__*/_jsx(EditProperty, {
|
60
|
+
classes: classes,
|
61
|
+
onClose: onClose,
|
62
|
+
onEvent: onEvent,
|
63
|
+
mode: mode
|
64
|
+
});
|
65
|
+
case "changeProperty":
|
66
|
+
return /*#__PURE__*/_jsx(ChangeProperty, {
|
67
|
+
classes: classes,
|
68
|
+
onClose: onClose,
|
69
|
+
onEvent: onEvent,
|
70
|
+
mode: mode
|
71
|
+
});
|
72
|
+
case "allProperties":
|
73
|
+
return /*#__PURE__*/_jsx(AllProperties, {
|
74
|
+
classes: classes,
|
75
|
+
onClose: onClose,
|
76
|
+
onEvent: onEvent,
|
77
|
+
mode: mode
|
78
|
+
});
|
79
|
+
case "editOption":
|
80
|
+
return /*#__PURE__*/_jsx(EditOption, {
|
81
|
+
classes: classes,
|
82
|
+
onClose: onClose,
|
83
|
+
onEvent: onEvent,
|
84
|
+
mode: mode
|
85
|
+
});
|
86
|
+
default:
|
87
|
+
return null;
|
88
|
+
}
|
89
|
+
};
|
90
|
+
return /*#__PURE__*/_jsx(PoperComponent, {
|
91
|
+
open: open,
|
92
|
+
anchorEl: anchorEl,
|
93
|
+
anchorOrigin: {
|
94
|
+
vertical: "top",
|
95
|
+
horizontal: "right"
|
96
|
+
},
|
97
|
+
transformOrigin: {
|
98
|
+
vertical: "top",
|
99
|
+
horizontal: "left"
|
100
|
+
},
|
101
|
+
onClose: onClose,
|
102
|
+
anchor: "bottom",
|
103
|
+
sx: classes.popover
|
104
|
+
// override position
|
105
|
+
,
|
106
|
+
...(POSITIONS[mode?.type] || {}),
|
107
|
+
children: renderMode()
|
108
|
+
});
|
109
|
+
};
|
110
|
+
export default PropertySettings;
|
@@ -0,0 +1,179 @@
|
|
1
|
+
const useOptionsStyles = (theme, appTheme) => ({
|
2
|
+
popover: {
|
3
|
+
"& .MuiPaper-root": {
|
4
|
+
boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.16)",
|
5
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
6
|
+
borderRadius: "12px",
|
7
|
+
background: appTheme?.palette?.editor?.tv_pop_bg,
|
8
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
9
|
+
[theme.breakpoints.between("xs", "md")]: {
|
10
|
+
borderRadius: "16px 16px 0px 0px",
|
11
|
+
maxHeight: "50%"
|
12
|
+
},
|
13
|
+
"& .tv-act-ico": {
|
14
|
+
color: appTheme?.palette?.editor?.tv_text,
|
15
|
+
"&.br1": {
|
16
|
+
borderRadius: "6px"
|
17
|
+
},
|
18
|
+
"&.bg": {
|
19
|
+
background: appTheme?.palette?.editor?.tv_ico_bg,
|
20
|
+
"&:hover": {
|
21
|
+
background: "rgba(100, 116, 139, 0.12)"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"& svg": {
|
25
|
+
width: "16px",
|
26
|
+
height: "16px"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"& .MuiInputBase-root": {
|
30
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
31
|
+
fontSize: "14px",
|
32
|
+
background: appTheme?.palette?.editor?.tv_ico_bg,
|
33
|
+
borderRadius: "8px"
|
34
|
+
},
|
35
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
36
|
+
borderRadius: "8px",
|
37
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`
|
38
|
+
},
|
39
|
+
"& .MuiList-root": {
|
40
|
+
padding: "4px 2px",
|
41
|
+
"& .MuiListItemButton-root": {
|
42
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
43
|
+
padding: "2px 4px",
|
44
|
+
borderRadius: "8px",
|
45
|
+
"& .MuiListItemIcon-root": {
|
46
|
+
minWidth: "38px",
|
47
|
+
"&.needBg": {
|
48
|
+
minWidth: "20px",
|
49
|
+
width: "20px",
|
50
|
+
height: "20px",
|
51
|
+
alignItems: "center",
|
52
|
+
justifyContent: "center",
|
53
|
+
borderRadius: "4px",
|
54
|
+
marginRight: "12px",
|
55
|
+
background: appTheme?.palette?.editor?.tv_ico_bg
|
56
|
+
},
|
57
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
58
|
+
"& svg": {
|
59
|
+
width: "16px"
|
60
|
+
}
|
61
|
+
},
|
62
|
+
"& .MuiTypography-root": {
|
63
|
+
fontSize: "14px"
|
64
|
+
},
|
65
|
+
"&:hover": {
|
66
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
67
|
+
color: appTheme?.palette?.editor?.tv_hover_text,
|
68
|
+
"& .MuiListItemIcon-root": {
|
69
|
+
color: appTheme?.palette?.editor?.tv_hover_text
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
},
|
74
|
+
"& .st": {
|
75
|
+
borderTop: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
76
|
+
marginTop: "8px",
|
77
|
+
paddingTop: "8px"
|
78
|
+
},
|
79
|
+
"& .sb": {
|
80
|
+
borderBottom: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
81
|
+
marginBottom: "8px",
|
82
|
+
paddingBottom: "8px"
|
83
|
+
},
|
84
|
+
"& .mt": {
|
85
|
+
marginTop: "8px"
|
86
|
+
},
|
87
|
+
"& .mt-1": {
|
88
|
+
marginTop: "12px"
|
89
|
+
},
|
90
|
+
"& .mb": {
|
91
|
+
marginBottom: "8px"
|
92
|
+
},
|
93
|
+
"& .mb-1": {
|
94
|
+
marginBottom: "12px"
|
95
|
+
},
|
96
|
+
"& .ml": {
|
97
|
+
marginLeft: "8px"
|
98
|
+
},
|
99
|
+
"& .mb-0": {
|
100
|
+
marginBottom: "0px"
|
101
|
+
},
|
102
|
+
"& .ml-0": {
|
103
|
+
marginLeft: "0px !important"
|
104
|
+
},
|
105
|
+
"& .pl-0": {
|
106
|
+
paddingLeft: "0px"
|
107
|
+
},
|
108
|
+
"& .label-desc": {},
|
109
|
+
"& .MuiFormControlLabel-root": {
|
110
|
+
alignItems: "flex-start",
|
111
|
+
margin: "0px 0px 0px 0px",
|
112
|
+
width: "100%",
|
113
|
+
"& .MuiFormControlLabel-label": {
|
114
|
+
marginBottom: "8px",
|
115
|
+
fontSize: "14px"
|
116
|
+
}
|
117
|
+
},
|
118
|
+
"& .label-tp": {
|
119
|
+
fontFamily: '"Roboto","Helvetica","Arial",sans-serif',
|
120
|
+
fontSize: "14px"
|
121
|
+
},
|
122
|
+
"& .MuiInputBase-input": {
|
123
|
+
height: "32px",
|
124
|
+
padding: "4px 8px"
|
125
|
+
},
|
126
|
+
"& .more-btn-cbs": {
|
127
|
+
color: appTheme?.palette?.editor?.tv_text_primary
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
addProperty: {
|
132
|
+
padding: "12px",
|
133
|
+
width: "253px",
|
134
|
+
"& .fe-dv-ap-title": {
|
135
|
+
display: "flex",
|
136
|
+
fontWeight: "bold",
|
137
|
+
padding: "0px 0px 12px 0px",
|
138
|
+
justifyContent: "space-between",
|
139
|
+
fontSize: "14px",
|
140
|
+
alignItems: "center",
|
141
|
+
borderBottom: "1px solid rgba(220, 228, 236, 1)",
|
142
|
+
marginBottom: "8px",
|
143
|
+
"& span": {
|
144
|
+
display: "flex",
|
145
|
+
alignItems: "center"
|
146
|
+
}
|
147
|
+
},
|
148
|
+
"& .fe-dv-ap-desc": {
|
149
|
+
fontSize: "12px",
|
150
|
+
color: "rgba(148, 163, 184, 1)"
|
151
|
+
},
|
152
|
+
"& .fe-dv-ap-opt-list": {
|
153
|
+
margin: "12px 0px"
|
154
|
+
},
|
155
|
+
"& .fe-tv-addopt": {
|
156
|
+
marginTop: "8px",
|
157
|
+
paddingLeft: "4px",
|
158
|
+
"& .MuiList-root": {
|
159
|
+
maxHeight: "200px",
|
160
|
+
overflowY: "auto"
|
161
|
+
},
|
162
|
+
"& .MuiFormHelperText-root": {
|
163
|
+
color: "red",
|
164
|
+
marginLeft: "2px",
|
165
|
+
marginTop: "4px"
|
166
|
+
}
|
167
|
+
},
|
168
|
+
"& .fe-tv-opt-sub-title": {
|
169
|
+
display: "flex",
|
170
|
+
alignItems: "center",
|
171
|
+
justifyContent: "space-between",
|
172
|
+
marginBottom: "8px"
|
173
|
+
},
|
174
|
+
[theme.breakpoints.between("xs", "md")]: {
|
175
|
+
width: "calc(100% - 24px)"
|
176
|
+
}
|
177
|
+
}
|
178
|
+
});
|
179
|
+
export default useOptionsStyles;
|
@@ -0,0 +1,100 @@
|
|
1
|
+
const useTableStyles = (theme, appTheme) => ({
|
2
|
+
root: {
|
3
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
4
|
+
borderRadius: "7px 7px 0px 0px",
|
5
|
+
overflowX: "auto",
|
6
|
+
[theme.breakpoints.between("xs", "md")]: {}
|
7
|
+
},
|
8
|
+
table: {
|
9
|
+
borderCollapse: "separate",
|
10
|
+
borderSpacing: 0,
|
11
|
+
borderRadius: "7px 7px 0px 0px",
|
12
|
+
overflow: "hidden",
|
13
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
14
|
+
"& thead": {
|
15
|
+
background: appTheme?.palette?.editor?.tv_header,
|
16
|
+
height: "40px"
|
17
|
+
},
|
18
|
+
"& th": {
|
19
|
+
"& svg": {
|
20
|
+
"& .fillStroke": {
|
21
|
+
stroke: appTheme?.palette?.editor?.tv_stroke
|
22
|
+
}
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"& td": {
|
26
|
+
height: "40px",
|
27
|
+
"& input": {
|
28
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
29
|
+
background: "transparent"
|
30
|
+
}
|
31
|
+
},
|
32
|
+
"& th, tr, td": {
|
33
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`
|
34
|
+
},
|
35
|
+
"& .tv-act-btn": {
|
36
|
+
color: appTheme?.palette?.editor?.tv_text,
|
37
|
+
textTransform: "none",
|
38
|
+
"&.ico": {
|
39
|
+
"& svg": {
|
40
|
+
color: appTheme?.palette?.editor?.tv_text
|
41
|
+
}
|
42
|
+
},
|
43
|
+
"&:hover": {
|
44
|
+
color: "rgba(37, 99, 235, 1)",
|
45
|
+
"& svg": {
|
46
|
+
color: "rgba(37, 99, 235, 1)"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"& .la": {
|
51
|
+
justifyContent: "start"
|
52
|
+
},
|
53
|
+
"& .react-datepicker__input-container": {
|
54
|
+
"& input": {
|
55
|
+
border: "0px solid transparent"
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"& .tv-ac-field": {
|
59
|
+
"&.MuiAutocomplete-root": {
|
60
|
+
"& .MuiAutocomplete-inputRoot": {
|
61
|
+
display: "flex",
|
62
|
+
flexWrap: "nowrap",
|
63
|
+
paddingTop: "3px",
|
64
|
+
paddingBottom: "3px",
|
65
|
+
paddingLeft: "3px",
|
66
|
+
maxWidth: "250px",
|
67
|
+
overflow: "hidden",
|
68
|
+
position: "relative",
|
69
|
+
"& .tv-ms-tag-wrpr": {
|
70
|
+
display: "flex",
|
71
|
+
flexWrap: "nowrap",
|
72
|
+
overflow: "auto"
|
73
|
+
},
|
74
|
+
"&.Mui-disabled": {
|
75
|
+
"& input": {
|
76
|
+
display: "none"
|
77
|
+
},
|
78
|
+
"& .tv-ms-tag-wrpr": {
|
79
|
+
"& .MuiSvgIcon-root": {
|
80
|
+
display: "none"
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
},
|
85
|
+
"& .MuiAutocomplete-clearIndicator": {
|
86
|
+
"& svg": {
|
87
|
+
color: appTheme?.palette?.editor?.tv_text
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"& .Mui-disabled": {
|
93
|
+
WebkitTextFillColor: "#000 !important",
|
94
|
+
"& .MuiChip-root": {
|
95
|
+
opacity: 1
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
});
|
100
|
+
export default useTableStyles;
|
@@ -0,0 +1,227 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import { Box, Button, useTheme } from "@mui/material";
|
3
|
+
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
4
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
5
|
+
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
|
6
|
+
import { useDataView } from "../Providers/DataViewProvider";
|
7
|
+
import PropertySettings from "./Options";
|
8
|
+
import { PROPERTY_TYPES } from "./Options/Constants";
|
9
|
+
import useTableStyles from "./TableStyles";
|
10
|
+
import { GridSettingsIcon, GridAddSectionIcon } from "../../../common/iconslist";
|
11
|
+
import { useEditorContext } from "../../../hooks/useMouseMove";
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
15
|
+
const SortIcon = props => {
|
16
|
+
const {
|
17
|
+
sortBy
|
18
|
+
} = props;
|
19
|
+
return sortBy ? sortBy === "asc" ? /*#__PURE__*/_jsx(KeyboardArrowUpIcon, {
|
20
|
+
sx: {
|
21
|
+
color: "rgba(37, 99, 235, 1)"
|
22
|
+
}
|
23
|
+
}) : /*#__PURE__*/_jsx(KeyboardArrowDownIcon, {
|
24
|
+
sx: {
|
25
|
+
color: "rgba(37, 99, 235, 1)"
|
26
|
+
}
|
27
|
+
}) : null;
|
28
|
+
};
|
29
|
+
const TableView = props => {
|
30
|
+
const {
|
31
|
+
theme: appTheme
|
32
|
+
} = useEditorContext();
|
33
|
+
const {
|
34
|
+
children,
|
35
|
+
readOnly
|
36
|
+
} = props;
|
37
|
+
const theme = useTheme();
|
38
|
+
const classes = useTableStyles(theme, appTheme);
|
39
|
+
const {
|
40
|
+
properties,
|
41
|
+
onAddProperty,
|
42
|
+
onUpdateProperty,
|
43
|
+
onUpdateSort,
|
44
|
+
sort,
|
45
|
+
onAddRow
|
46
|
+
} = useDataView();
|
47
|
+
const [sortBy] = sort || [];
|
48
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
49
|
+
const [mode, setMode] = useState({
|
50
|
+
mode: null,
|
51
|
+
edit: null
|
52
|
+
});
|
53
|
+
const open = Boolean(anchorEl);
|
54
|
+
const shownProperties = properties?.filter(f => f.visible);
|
55
|
+
const onAddClick = e => {
|
56
|
+
setMode({
|
57
|
+
type: "addProperty"
|
58
|
+
});
|
59
|
+
setAnchorEl(e.currentTarget);
|
60
|
+
};
|
61
|
+
const onEvent = (type, data, navToEdit = true) => {
|
62
|
+
switch (type) {
|
63
|
+
case "addProperty":
|
64
|
+
const np = onAddProperty({
|
65
|
+
type: data?.type
|
66
|
+
}, data?.overrides || {});
|
67
|
+
if (navToEdit) {
|
68
|
+
setMode({
|
69
|
+
type: "editProperty",
|
70
|
+
edit: {
|
71
|
+
...np
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
break;
|
76
|
+
case "editProperty":
|
77
|
+
setMode({
|
78
|
+
type: "editProperty",
|
79
|
+
edit: {
|
80
|
+
...data?.edit
|
81
|
+
}
|
82
|
+
});
|
83
|
+
break;
|
84
|
+
case "changeProperty":
|
85
|
+
setMode({
|
86
|
+
type: "changeProperty",
|
87
|
+
edit: {
|
88
|
+
...(data?.edit || {})
|
89
|
+
}
|
90
|
+
});
|
91
|
+
break;
|
92
|
+
case "updateProperty":
|
93
|
+
const up = onUpdateProperty(data);
|
94
|
+
if (navToEdit) {
|
95
|
+
setMode({
|
96
|
+
type: "editProperty",
|
97
|
+
edit: {
|
98
|
+
...(up || {})
|
99
|
+
}
|
100
|
+
});
|
101
|
+
}
|
102
|
+
break;
|
103
|
+
case "deleteProperty":
|
104
|
+
onUpdateProperty(data, true);
|
105
|
+
break;
|
106
|
+
case "allProperties":
|
107
|
+
setMode({
|
108
|
+
type: "allProperties",
|
109
|
+
edit: null
|
110
|
+
});
|
111
|
+
break;
|
112
|
+
case "editOption":
|
113
|
+
setMode({
|
114
|
+
type: "editOption",
|
115
|
+
edit: {
|
116
|
+
...(data?.edit || {})
|
117
|
+
}
|
118
|
+
});
|
119
|
+
break;
|
120
|
+
case "addSort":
|
121
|
+
onUpdateSort(data);
|
122
|
+
break;
|
123
|
+
case "close":
|
124
|
+
onClose();
|
125
|
+
break;
|
126
|
+
default:
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
};
|
130
|
+
const onEditProperty = data => e => {
|
131
|
+
if (!readOnly) {
|
132
|
+
setAnchorEl(e?.currentTarget);
|
133
|
+
onEvent("editProperty", {
|
134
|
+
edit: {
|
135
|
+
...data
|
136
|
+
}
|
137
|
+
});
|
138
|
+
} else {
|
139
|
+
const currentSort = sortBy?.key === data?.key ? sortBy : null;
|
140
|
+
onUpdateSort({
|
141
|
+
...(sortBy || data),
|
142
|
+
newKey: data.key,
|
143
|
+
operator: currentSort?.operator === "asc" ? "desc" : "asc"
|
144
|
+
}, false, false);
|
145
|
+
}
|
146
|
+
};
|
147
|
+
const onSettings = e => {
|
148
|
+
setAnchorEl(e?.currentTarget);
|
149
|
+
onEvent("allProperties", {});
|
150
|
+
};
|
151
|
+
const onClose = () => {
|
152
|
+
setMode({});
|
153
|
+
setAnchorEl(null);
|
154
|
+
};
|
155
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
156
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
157
|
+
component: "div",
|
158
|
+
className: `tv-d-wrapper ${readOnly ? "readOnly" : ""}`,
|
159
|
+
sx: classes.root,
|
160
|
+
contentEditable: false,
|
161
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
162
|
+
component: "table",
|
163
|
+
sx: classes.table,
|
164
|
+
children: [/*#__PURE__*/_jsx("thead", {
|
165
|
+
children: /*#__PURE__*/_jsxs("tr", {
|
166
|
+
children: [shownProperties?.map((m, i) => {
|
167
|
+
const {
|
168
|
+
Icon
|
169
|
+
} = PROPERTY_TYPES?.find(f => f.type === m.type) || {};
|
170
|
+
const isSort = sortBy?.key === m.key ? sortBy?.operator : null;
|
171
|
+
return /*#__PURE__*/_jsx("th", {
|
172
|
+
style: {
|
173
|
+
minWidth: "200px"
|
174
|
+
},
|
175
|
+
children: /*#__PURE__*/_jsx(Button, {
|
176
|
+
className: "tv-act-btn la",
|
177
|
+
startIcon: /*#__PURE__*/_jsx(Icon, {}),
|
178
|
+
endIcon: /*#__PURE__*/_jsx(SortIcon, {
|
179
|
+
sortBy: isSort
|
180
|
+
}),
|
181
|
+
fullWidth: true,
|
182
|
+
onClick: onEditProperty(m),
|
183
|
+
children: m.label
|
184
|
+
})
|
185
|
+
}, i);
|
186
|
+
}), !readOnly ? /*#__PURE__*/_jsxs(_Fragment, {
|
187
|
+
children: [/*#__PURE__*/_jsx("th", {
|
188
|
+
className: "tv-act-btn ico",
|
189
|
+
children: /*#__PURE__*/_jsx(Button, {
|
190
|
+
onClick: onAddClick,
|
191
|
+
fullWidth: true,
|
192
|
+
children: /*#__PURE__*/_jsx(GridAddSectionIcon, {})
|
193
|
+
})
|
194
|
+
}), /*#__PURE__*/_jsx("th", {
|
195
|
+
className: "tv-act-btn ico",
|
196
|
+
children: /*#__PURE__*/_jsx(Button, {
|
197
|
+
onClick: onSettings,
|
198
|
+
fullWidth: true,
|
199
|
+
children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
|
200
|
+
})
|
201
|
+
})]
|
202
|
+
}) : null]
|
203
|
+
})
|
204
|
+
}), children]
|
205
|
+
})
|
206
|
+
}), !readOnly ? /*#__PURE__*/_jsx(Button, {
|
207
|
+
contentEditable: false,
|
208
|
+
className: "tv-act-btn la",
|
209
|
+
fullWidth: true,
|
210
|
+
onClick: onAddRow,
|
211
|
+
sx: {
|
212
|
+
textTransform: "none",
|
213
|
+
justifyContent: "start"
|
214
|
+
},
|
215
|
+
startIcon: /*#__PURE__*/_jsx(AddCircleOutlineIcon, {}),
|
216
|
+
children: "Add new row"
|
217
|
+
}) : null, open && !readOnly ? /*#__PURE__*/_jsx(PropertySettings, {
|
218
|
+
open: open,
|
219
|
+
anchorEl: anchorEl,
|
220
|
+
mode: mode,
|
221
|
+
properties: properties,
|
222
|
+
onClose: onClose,
|
223
|
+
onEvent: onEvent
|
224
|
+
}) : null]
|
225
|
+
});
|
226
|
+
};
|
227
|
+
export default TableView;
|