@flozy/editor 5.3.0 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +20 -12
  3. package/dist/Editor/Editor.css +14 -16
  4. package/dist/Editor/Elements/AI/AIInput.js +0 -3
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  6. package/dist/Editor/Elements/Button/EditorButton.js +8 -2
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
  8. package/dist/Editor/Elements/DataView/DataView.js +124 -0
  9. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  10. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
  11. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  12. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  22. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  23. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  24. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  25. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  26. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  27. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  28. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  29. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  30. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  31. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  32. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  33. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  34. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  41. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  42. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  43. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
  44. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
  45. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  46. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
  47. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  48. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
  49. package/dist/Editor/Elements/DataView/styles.js +154 -0
  50. package/dist/Editor/Elements/Form/Form.js +1 -0
  51. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  52. package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
  53. package/dist/Editor/Elements/List/CheckList.js +2 -1
  54. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  55. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  56. package/dist/Editor/Elements/SimpleText/style.js +10 -1
  57. package/dist/Editor/Elements/Table/Table.js +1 -1
  58. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
  59. package/dist/Editor/Styles/EditorStyles.js +5 -0
  60. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
  61. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  62. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  63. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  64. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  65. package/dist/Editor/common/Icon.js +6 -0
  66. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  68. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  69. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  70. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  71. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  72. package/dist/Editor/common/RnD/index.js +1 -1
  73. package/dist/Editor/common/Shorthands/elements.js +13 -1
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  76. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  77. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  78. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  79. package/dist/Editor/common/Uploader.js +8 -0
  80. package/dist/Editor/common/iconListV2.js +53 -53
  81. package/dist/Editor/common/iconslist.js +6 -3
  82. package/dist/Editor/commonStyle.js +9 -0
  83. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  84. package/dist/Editor/helper/index.js +2 -2
  85. package/dist/Editor/helper/theme.js +24 -1
  86. package/dist/Editor/hooks/useMouseMove.js +5 -2
  87. package/dist/Editor/plugins/withEmbeds.js +30 -26
  88. package/dist/Editor/plugins/withHTML.js +47 -12
  89. package/dist/Editor/plugins/withLayout.js +42 -0
  90. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -2
  91. package/dist/Editor/utils/button.js +4 -4
  92. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
  93. package/dist/Editor/utils/dataView.js +43 -0
  94. package/dist/Editor/utils/events.js +0 -1
  95. package/dist/Editor/utils/helper.js +51 -1
  96. package/dist/Editor/utils/pageSettings.js +14 -2
  97. package/dist/Editor/utils/serializeToText.js +2 -0
  98. package/package.json +1 -1
@@ -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_input_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} !important`,
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} !important`,
68
+ "& .MuiListItemIcon-root": {
69
+ color: `${appTheme?.palette?.editor?.tv_hover_text} !important`
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 ${appTheme?.palette?.editor?.tv_border}`,
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: "100%"
176
+ }
177
+ }
178
+ });
179
+ export default useOptionsStyles;
@@ -0,0 +1,112 @@
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
+ "& .MuiAvatar-root": {
91
+ width: "20px",
92
+ height: "20px",
93
+ marginLeft: "8px",
94
+ fontSize: "16px",
95
+ padding: "2px",
96
+ textTransform: "capitalize"
97
+ },
98
+ "& .MuiChip-label": {
99
+ paddingLeft: "6px",
100
+ paddingRight: "8px"
101
+ }
102
+ }
103
+ },
104
+ "& .Mui-disabled": {
105
+ WebkitTextFillColor: "#000 !important",
106
+ "& .MuiChip-root": {
107
+ opacity: 1
108
+ }
109
+ }
110
+ }
111
+ });
112
+ 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;
@@ -0,0 +1,80 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import { useDataView } from "../Providers/DataViewProvider";
4
+ import ColumnView from "./ColumnView";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ const RenderRow = props => {
8
+ const {
9
+ rowIndex,
10
+ row,
11
+ properties,
12
+ onSelect,
13
+ selected,
14
+ readOnly
15
+ } = props;
16
+ const showProperties = properties?.filter(f => f.visible);
17
+ return showProperties?.map((property, i) => {
18
+ return /*#__PURE__*/_jsx(ColumnView, {
19
+ needAnchor: i === 0,
20
+ row: row,
21
+ rowIndex: rowIndex,
22
+ property: property,
23
+ onSelect: onSelect,
24
+ selected: selected,
25
+ readOnly: readOnly
26
+ }, `${property.key}_${i}`);
27
+ });
28
+ };
29
+ const ViewData = props => {
30
+ const {
31
+ attributes,
32
+ children,
33
+ customProps
34
+ } = props;
35
+ const {
36
+ readOnly
37
+ } = customProps || {};
38
+ const {
39
+ properties,
40
+ rows,
41
+ selectedRows,
42
+ setSelectedRows
43
+ } = useDataView();
44
+ const onSelect = (id, checked) => {
45
+ if (checked) {
46
+ setSelectedRows([...selectedRows, id]);
47
+ } else {
48
+ setSelectedRows([...selectedRows?.filter(f => f !== id)]);
49
+ }
50
+ };
51
+ return /*#__PURE__*/_jsxs(Box, {
52
+ component: "tbody",
53
+ ...attributes,
54
+ contentEditable: false,
55
+ children: [rows?.map((row, i) => {
56
+ return /*#__PURE__*/_jsx(Box, {
57
+ component: "tr",
58
+ className: "tv-act-row",
59
+ children: /*#__PURE__*/_jsx(RenderRow, {
60
+ rowIndex: row?.id,
61
+ row: row,
62
+ properties: properties,
63
+ onSelect: onSelect,
64
+ selected: selectedRows?.includes(row?.id),
65
+ readOnly: readOnly
66
+ })
67
+ }, i);
68
+ }), /*#__PURE__*/_jsx("tr", {
69
+ style: {
70
+ visibility: "hidden",
71
+ display: "none"
72
+ },
73
+ "aria-hidden": "true",
74
+ children: /*#__PURE__*/_jsx("td", {
75
+ children: children
76
+ })
77
+ })]
78
+ });
79
+ };
80
+ export default ViewData;
@@ -0,0 +1,10 @@
1
+ const useColumnStyles = theme => ({
2
+ root: {
3
+ zIndex: 1000,
4
+ marginTop: "20px !important",
5
+ [theme?.breakpoints?.between("xs", "md")]: {
6
+ left: "-32px !important"
7
+ }
8
+ }
9
+ });
10
+ export default useColumnStyles;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import TableView from "./TableView";
3
+ import { useDataView } from "../Providers/DataViewProvider";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ const LAYOUT_COMPONENT = {
7
+ table: TableView
8
+ };
9
+ const LayoutView = props => {
10
+ const {
11
+ readOnly,
12
+ children
13
+ } = props;
14
+ const {
15
+ layoutType
16
+ } = useDataView();
17
+ const Layout = LAYOUT_COMPONENT[layoutType] || LAYOUT_COMPONENT["table"];
18
+ return /*#__PURE__*/_jsx(_Fragment, {
19
+ children: /*#__PURE__*/_jsx(Layout, {
20
+ readOnly: readOnly,
21
+ children: children
22
+ })
23
+ });
24
+ };
25
+ export default LayoutView;