@flozy/editor 5.1.3 → 5.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. package/dist/Editor/ChatEditor.js +34 -25
  2. package/dist/Editor/CommonEditor.js +7 -13
  3. package/dist/Editor/Editor.css +10 -52
  4. package/dist/Editor/Elements/AI/AIInput.js +1 -0
  5. package/dist/Editor/Elements/AI/CustomSelect.js +10 -17
  6. package/dist/Editor/Elements/AI/Styles.js +1 -7
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +5 -7
  8. package/dist/Editor/Elements/Color Picker/Styles.js +3 -7
  9. package/dist/Editor/Elements/Color Picker/defaultColors.js +2 -2
  10. package/dist/Editor/Elements/Form/Form.js +2 -38
  11. package/dist/Editor/Elements/Form/FormElements/FormCheckbox.js +1 -7
  12. package/dist/Editor/Elements/Form/FormElements/FormDate.js +1 -7
  13. package/dist/Editor/Elements/Form/FormElements/FormEmail.js +1 -7
  14. package/dist/Editor/Elements/Form/FormElements/FormNumbers.js +1 -7
  15. package/dist/Editor/Elements/Form/FormElements/FormRadioButton.js +1 -7
  16. package/dist/Editor/Elements/Form/FormElements/FormText.js +1 -7
  17. package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +1 -6
  18. package/dist/Editor/Elements/Form/FormPopup.js +9 -12
  19. package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
  20. package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +1 -20
  21. package/dist/Editor/Elements/Grid/GridButton.js +1 -2
  22. package/dist/Editor/Elements/Link/LinkButton.js +1 -1
  23. package/dist/Editor/Elements/Signature/Signature.css +1 -1
  24. package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -2
  25. package/dist/Editor/Elements/Signature/SignaturePopup.js +48 -13
  26. package/dist/Editor/Elements/SimpleText/index.js +1 -8
  27. package/dist/Editor/Elements/SimpleText/style.js +1 -8
  28. package/dist/Editor/Elements/Table/Styles.js +43 -25
  29. package/dist/Editor/Elements/Table/Table.js +138 -206
  30. package/dist/Editor/Elements/Table/TableCell.js +102 -355
  31. package/dist/Editor/Elements/Table/TablePopup.js +3 -9
  32. package/dist/Editor/Elements/Table/TableRow.js +2 -10
  33. package/dist/Editor/Styles/EditorStyles.js +1 -3
  34. package/dist/Editor/Toolbar/FormatTools/BlockButton.js +0 -10
  35. package/dist/Editor/Toolbar/FormatTools/Dropdown.js +11 -7
  36. package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +4 -10
  37. package/dist/Editor/Toolbar/FormatTools/MarkButton.js +0 -3
  38. package/dist/Editor/Toolbar/FormatTools/TextSize.js +2 -0
  39. package/dist/Editor/Toolbar/Mini/MiniToolbar.js +6 -3
  40. package/dist/Editor/Toolbar/Mini/Styles.js +1 -4
  41. package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +3 -3
  42. package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +11 -16
  43. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +49 -416
  44. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +8 -62
  45. package/dist/Editor/Toolbar/PopupTool/index.js +6 -5
  46. package/dist/Editor/Toolbar/Toolbar.js +0 -6
  47. package/dist/Editor/Toolbar/toolbarGroups.js +0 -4
  48. package/dist/Editor/assets/svg/BrainIcon.js +2 -2
  49. package/dist/Editor/common/ColorPickerButton.js +2 -3
  50. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  51. package/dist/Editor/common/Icon.js +23 -24
  52. package/dist/Editor/common/LinkSettings/NavComponents.js +1 -2
  53. package/dist/Editor/common/LinkSettings/index.js +1 -2
  54. package/dist/Editor/common/MentionsPopup/Styles.js +3 -151
  55. package/dist/Editor/common/MentionsPopup/index.js +1 -1
  56. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +12 -108
  57. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +2 -14
  58. package/dist/Editor/common/Shorthands/elements.js +1 -13
  59. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +0 -5
  60. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +2 -10
  61. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +1 -3
  62. package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +2 -5
  63. package/dist/Editor/common/StyleBuilder/formStyle.js +149 -268
  64. package/dist/Editor/common/StyleBuilder/index.js +11 -84
  65. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +0 -4
  66. package/dist/Editor/common/StyleBuilder/tableStyle.js +25 -69
  67. package/dist/Editor/common/Uploader.js +0 -8
  68. package/dist/Editor/common/iconListV2.js +40 -378
  69. package/dist/Editor/common/iconslist.js +5 -8
  70. package/dist/Editor/commonStyle.js +9 -117
  71. package/dist/Editor/helper/deserialize/index.js +1 -4
  72. package/dist/Editor/helper/index.js +2 -2
  73. package/dist/Editor/helper/theme.js +1 -24
  74. package/dist/Editor/hooks/useMouseMove.js +2 -5
  75. package/dist/Editor/plugins/withCustomDeleteBackward.js +2 -3
  76. package/dist/Editor/plugins/withHTML.js +1 -17
  77. package/dist/Editor/plugins/withLayout.js +1 -48
  78. package/dist/Editor/utils/SlateUtilityFunctions.js +0 -18
  79. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -21
  80. package/dist/Editor/utils/embed.js +1 -2
  81. package/dist/Editor/utils/events.js +1 -0
  82. package/dist/Editor/utils/font.js +4 -11
  83. package/dist/Editor/utils/formfield.js +4 -8
  84. package/dist/Editor/utils/helper.js +1 -34
  85. package/dist/Editor/utils/insertNewLine.js +1 -19
  86. package/dist/Editor/utils/pageSettings.js +2 -14
  87. package/dist/Editor/utils/serializeToText.js +0 -2
  88. package/dist/Editor/utils/table.js +24 -228
  89. package/package.json +1 -1
  90. package/dist/Editor/Elements/DataView/DataView.js +0 -101
  91. package/dist/Editor/Elements/DataView/DataViewButton.js +0 -23
  92. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +0 -59
  93. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +0 -30
  94. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +0 -140
  95. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +0 -40
  96. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +0 -59
  97. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +0 -26
  98. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +0 -38
  99. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +0 -30
  100. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +0 -30
  101. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +0 -35
  102. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +0 -36
  103. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +0 -17
  104. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +0 -29
  105. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +0 -38
  106. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +0 -74
  107. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +0 -64
  108. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +0 -106
  109. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +0 -174
  110. package/dist/Editor/Elements/DataView/Layouts/Formula.js +0 -29
  111. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +0 -113
  112. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +0 -37
  113. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +0 -111
  114. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +0 -62
  115. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +0 -36
  116. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +0 -101
  117. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +0 -160
  118. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +0 -190
  119. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +0 -42
  120. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +0 -30
  121. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +0 -110
  122. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +0 -179
  123. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +0 -100
  124. package/dist/Editor/Elements/DataView/Layouts/TableView.js +0 -227
  125. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +0 -70
  126. package/dist/Editor/Elements/DataView/Layouts/index.js +0 -25
  127. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +0 -288
  128. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +0 -15
  129. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +0 -72
  130. package/dist/Editor/Elements/DataView/styles.js +0 -143
  131. package/dist/Editor/Elements/Table/AddRowCol.js +0 -77
  132. package/dist/Editor/Elements/Table/DragButton.js +0 -141
  133. package/dist/Editor/Elements/Table/DragStyles.js +0 -69
  134. package/dist/Editor/Elements/Table/Draggable.js +0 -25
  135. package/dist/Editor/Elements/Table/Droppable.js +0 -53
  136. package/dist/Editor/Elements/Table/TableTool.js +0 -101
  137. package/dist/Editor/Elements/Table/tableHelper.js +0 -71
  138. package/dist/Editor/assets/svg/TableIcons.js +0 -220
  139. package/dist/Editor/common/Select/index.js +0 -20
  140. package/dist/Editor/common/Select/styles.js +0 -17
  141. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +0 -79
  142. package/dist/Editor/hooks/useTable.js +0 -175
  143. package/dist/Editor/utils/dataView.js +0 -43
@@ -1,179 +0,0 @@
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;
@@ -1,100 +0,0 @@
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;
@@ -1,227 +0,0 @@
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;
@@ -1,70 +0,0 @@
1
- import React from "react";
2
- import { Box, Button } from "@mui/material";
3
- import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
4
- import { useDataView } from "../Providers/DataViewProvider";
5
- import ColumnView from "./ColumnView";
6
- // import Formula from "./Formula";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const RenderRow = props => {
9
- const {
10
- rowIndex,
11
- row,
12
- properties,
13
- onSelect,
14
- selected,
15
- readOnly
16
- } = props;
17
- const showProperties = properties?.filter(f => f.visible);
18
- return showProperties?.map((property, i) => {
19
- return /*#__PURE__*/_jsx(ColumnView, {
20
- needAnchor: i === 0,
21
- row: row,
22
- rowIndex: rowIndex,
23
- property: property,
24
- onSelect: onSelect,
25
- selected: selected,
26
- readOnly: readOnly
27
- }, `${property.key}_${i}`);
28
- });
29
- };
30
- const ViewData = props => {
31
- const {
32
- attributes,
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__*/_jsx(Box, {
52
- component: "tbody",
53
- ...attributes,
54
- children: rows?.map((row, i) => {
55
- return /*#__PURE__*/_jsx(Box, {
56
- component: "tr",
57
- className: "tv-act-row",
58
- children: /*#__PURE__*/_jsx(RenderRow, {
59
- rowIndex: row?.id,
60
- row: row,
61
- properties: properties,
62
- onSelect: onSelect,
63
- selected: selectedRows?.includes(row?.id),
64
- readOnly: readOnly
65
- })
66
- }, i);
67
- })
68
- });
69
- };
70
- export default ViewData;
@@ -1,25 +0,0 @@
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;