@flozy/editor 4.9.1 → 4.9.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/Editor.css +17 -4
- package/dist/Editor/Elements/AI/CustomSelect.js +17 -10
- package/dist/Editor/Elements/AI/Styles.js +7 -1
- package/dist/Editor/Elements/Embed/Video.js +3 -2
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +1 -1
- package/dist/Editor/Elements/Grid/GridItem.js +28 -9
- package/dist/Editor/Elements/Grid/Styles.js +1 -0
- package/dist/Editor/Elements/Search/SearchAttachment.js +27 -18
- package/dist/Editor/Elements/Search/SearchButton.js +66 -9
- package/dist/Editor/Elements/Search/SearchList.js +87 -75
- package/dist/Editor/Elements/Table/AddRowCol.js +76 -0
- package/dist/Editor/Elements/Table/DragButton.js +134 -0
- package/dist/Editor/Elements/Table/DragStyles.js +43 -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 +23 -41
- package/dist/Editor/Elements/Table/Table.js +185 -137
- package/dist/Editor/Elements/Table/TableCell.js +339 -101
- 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/Toolbar/PopupTool/index.js +6 -8
- package/dist/Editor/assets/svg/DocsIcon.js +77 -10
- package/dist/Editor/assets/svg/TableIcons.js +220 -0
- package/dist/Editor/assets/svg/UserIcon.js +2 -2
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +27 -38
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +1 -1
- package/dist/Editor/common/StyleBuilder/index.js +43 -57
- package/dist/Editor/common/StyleBuilder/tableStyle.js +92 -1
- package/dist/Editor/common/iconListV2.js +52 -0
- package/dist/Editor/hooks/useTable.js +164 -0
- package/dist/Editor/utils/helper.js +1 -1
- package/dist/Editor/utils/table.js +204 -21
- package/package.json +1 -1
@@ -1,69 +1,25 @@
|
|
1
|
-
import { Box, CircularProgress, Grid, IconButton, InputAdornment, TextField, Typography } from "@mui/material";
|
1
|
+
import { Box, CircularProgress, Divider, Grid, IconButton, InputAdornment, TextField, Typography } from "@mui/material";
|
2
2
|
import Icon from "../../common/Icon";
|
3
3
|
import { SearchIcon } from "../../common/iconslist";
|
4
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
5
|
-
import { useDebounce } from "use-debounce";
|
6
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
6
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
9
7
|
const SearchAndDocList = ({
|
8
|
+
mapData,
|
9
|
+
isLoading,
|
10
|
+
lastDocRef,
|
11
|
+
onSearchChange,
|
10
12
|
handleClick,
|
11
13
|
theme,
|
12
|
-
handleClose
|
13
|
-
otherProps
|
14
|
+
handleClose
|
14
15
|
}) => {
|
15
|
-
const [mapData, setMapData] = useState([]);
|
16
|
-
const [skip, setSkip] = useState(0);
|
17
|
-
const [search, setSearch] = useState("");
|
18
|
-
const [isLoading, setIsLoading] = useState(false);
|
19
|
-
const [debouncedSearch] = useDebounce(search, 300);
|
20
|
-
const limit = 20;
|
21
|
-
const observer = useRef();
|
22
|
-
const lastDocRef = useCallback(node => {
|
23
|
-
if (observer.current) observer.current.disconnect();
|
24
|
-
observer.current = new IntersectionObserver(entries => {
|
25
|
-
if (entries[0].isIntersecting) {
|
26
|
-
setSkip(prevSkip => prevSkip + limit);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
if (node) observer.current.observe(node);
|
30
|
-
}, [limit]);
|
31
|
-
useEffect(() => {
|
32
|
-
getDocs({
|
33
|
-
debouncedSearch,
|
34
|
-
skip,
|
35
|
-
limit
|
36
|
-
});
|
37
|
-
}, [skip, debouncedSearch]);
|
38
|
-
const getDocs = async () => {
|
39
|
-
setIsLoading(true);
|
40
|
-
try {
|
41
|
-
if (otherProps?.services) {
|
42
|
-
const result = await otherProps?.services("getDocs", {
|
43
|
-
skip,
|
44
|
-
limit,
|
45
|
-
search
|
46
|
-
});
|
47
|
-
setMapData(prev => skip === 0 ? result.data : [...prev, ...result.data]);
|
48
|
-
}
|
49
|
-
} catch (error) {
|
50
|
-
console.error("Error fetching documents:", error);
|
51
|
-
} finally {
|
52
|
-
setIsLoading(false);
|
53
|
-
}
|
54
|
-
};
|
55
|
-
const onSearchChange = value => {
|
56
|
-
setSearch(value);
|
57
|
-
setSkip(0);
|
58
|
-
};
|
59
16
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
60
17
|
children: [/*#__PURE__*/_jsxs(Box, {
|
61
18
|
display: "flex",
|
62
19
|
justifyContent: "space-between",
|
63
20
|
alignItems: "center",
|
64
|
-
mb: 2,
|
65
21
|
sx: {
|
66
|
-
padding: '8px'
|
22
|
+
padding: '9px 16px 8px 16px'
|
67
23
|
},
|
68
24
|
children: [/*#__PURE__*/_jsx(Typography, {
|
69
25
|
sx: {
|
@@ -92,14 +48,22 @@ const SearchAndDocList = ({
|
|
92
48
|
})
|
93
49
|
})]
|
94
50
|
}), /*#__PURE__*/_jsx(Box, {
|
95
|
-
mb: 2,
|
96
51
|
sx: {
|
97
|
-
padding: '
|
52
|
+
padding: '0px 16px'
|
53
|
+
},
|
54
|
+
children: /*#__PURE__*/_jsx(Divider, {
|
55
|
+
sx: {
|
56
|
+
borderColor: theme?.palette?.primary?.slashBrainBorder
|
57
|
+
}
|
58
|
+
})
|
59
|
+
}), /*#__PURE__*/_jsx(Box, {
|
60
|
+
sx: {
|
61
|
+
padding: '12px 16px'
|
98
62
|
},
|
99
63
|
children: /*#__PURE__*/_jsx(TextField, {
|
100
64
|
fullWidth: true,
|
101
65
|
variant: "outlined",
|
102
|
-
placeholder: "Search
|
66
|
+
placeholder: "Search here...",
|
103
67
|
size: "small",
|
104
68
|
onChange: e => onSearchChange(e.target.value),
|
105
69
|
InputProps: {
|
@@ -109,19 +73,29 @@ const SearchAndDocList = ({
|
|
109
73
|
})
|
110
74
|
},
|
111
75
|
sx: {
|
76
|
+
borderRadius: "8px",
|
112
77
|
"& .MuiOutlinedInput-root": {
|
113
78
|
color: theme?.palette?.primary?.main,
|
114
|
-
borderRadius: "8px",
|
115
|
-
border: `1px solid ${theme?.palette?.primary?.border2}`,
|
116
|
-
borderColor: theme?.palette?.primary?.border2,
|
117
79
|
boxShadow: theme?.palette?.shadows?.shadow12,
|
118
80
|
"&:hover .MuiOutlinedInput-notchedOutline": {
|
119
|
-
|
81
|
+
borderRadius: "8px",
|
82
|
+
border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
|
83
|
+
borderColor: theme?.palette?.primary?.slashBrainBorder
|
120
84
|
},
|
121
85
|
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
122
|
-
|
86
|
+
borderRadius: "8px",
|
87
|
+
border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
|
88
|
+
borderColor: theme?.palette?.primary?.slashBrainBorder
|
123
89
|
}
|
124
90
|
},
|
91
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
92
|
+
borderRadius: "8px",
|
93
|
+
border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
|
94
|
+
borderColor: theme?.palette?.primary?.slashBrainBorder
|
95
|
+
},
|
96
|
+
'& .MuiInputBase-root': {
|
97
|
+
borderRadius: '8px'
|
98
|
+
},
|
125
99
|
"& svg": {
|
126
100
|
"& path": {
|
127
101
|
stroke: theme?.palette?.text?.text6
|
@@ -129,25 +103,44 @@ const SearchAndDocList = ({
|
|
129
103
|
}
|
130
104
|
}
|
131
105
|
})
|
132
|
-
}), /*#__PURE__*/
|
106
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
133
107
|
container: true,
|
134
108
|
gap: 1,
|
135
109
|
sx: {
|
110
|
+
position: 'relative',
|
136
111
|
maxHeight: '400px',
|
112
|
+
minWidth: "275px",
|
137
113
|
overflowY: 'auto',
|
138
|
-
padding: '
|
114
|
+
padding: '0px 16px 8px',
|
115
|
+
marginBottom: '20px',
|
116
|
+
scrollbarWidth: "thin",
|
117
|
+
scrollbarColor: `${theme?.palette?.primary?.slashBrainBorder} transparent`,
|
118
|
+
"&::-webkit-scrollbar": {
|
119
|
+
width: "3px",
|
120
|
+
height: "3px !important"
|
121
|
+
},
|
122
|
+
"&::-webkit-scrollbar-thumb": {
|
123
|
+
backgroundColor: theme?.palette?.primary?.slashBrainBorder,
|
124
|
+
borderRadius: "4px",
|
125
|
+
width: "3px !important"
|
126
|
+
},
|
127
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
128
|
+
backgroundColor: theme?.palette?.primary?.slashBrainBorder
|
129
|
+
},
|
130
|
+
"&::-webkit-scrollbar-track": {
|
131
|
+
background: "transparent"
|
132
|
+
}
|
139
133
|
},
|
140
|
-
children: mapData?.map((doc, index) => {
|
134
|
+
children: [mapData?.map((doc, index) => {
|
141
135
|
const title = doc?.title?.trim() === "" ? 'Untitled' : doc?.title;
|
142
136
|
return /*#__PURE__*/_jsx(Grid, {
|
143
137
|
item: true,
|
144
138
|
xs: 12,
|
145
139
|
ref: index === mapData.length - 1 ? lastDocRef : null,
|
146
140
|
sx: {
|
147
|
-
border: `1px solid ${theme?.palette?.primary?.
|
148
|
-
borderRadius: '
|
149
|
-
padding: '
|
150
|
-
marginRight: '5px',
|
141
|
+
border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
|
142
|
+
borderRadius: '8px',
|
143
|
+
padding: '6px 10px',
|
151
144
|
cursor: 'pointer'
|
152
145
|
},
|
153
146
|
onClick: () => handleClick(doc),
|
@@ -165,7 +158,12 @@ const SearchAndDocList = ({
|
|
165
158
|
children: [/*#__PURE__*/_jsx(Grid, {
|
166
159
|
item: true,
|
167
160
|
sx: {
|
168
|
-
marginTop: '2px'
|
161
|
+
marginTop: '2px',
|
162
|
+
'& svg': {
|
163
|
+
'& path': {
|
164
|
+
stroke: theme?.palette?.primary?.slashBrainIcon
|
165
|
+
}
|
166
|
+
}
|
169
167
|
},
|
170
168
|
children: /*#__PURE__*/_jsx(Icon, {
|
171
169
|
icon: "docsIcon"
|
@@ -174,14 +172,15 @@ const SearchAndDocList = ({
|
|
174
172
|
item: true,
|
175
173
|
children: /*#__PURE__*/_jsx(Typography, {
|
176
174
|
sx: {
|
177
|
-
fontSize: "
|
175
|
+
fontSize: "12px",
|
178
176
|
fontWeight: 500,
|
179
177
|
color: theme?.palette?.primary?.main,
|
180
178
|
textOverflow: 'ellipsis',
|
181
179
|
whiteSpace: 'nowrap',
|
182
180
|
overflow: 'hidden',
|
183
181
|
wordBreak: "break-word",
|
184
|
-
maxWidth: '230px'
|
182
|
+
maxWidth: '230px',
|
183
|
+
textAlign: 'left'
|
185
184
|
},
|
186
185
|
children: title
|
187
186
|
})
|
@@ -189,18 +188,31 @@ const SearchAndDocList = ({
|
|
189
188
|
})
|
190
189
|
}), doc?.shared_status === 1 ? /*#__PURE__*/_jsx(Grid, {
|
191
190
|
item: true,
|
191
|
+
sx: {
|
192
|
+
'& svg': {
|
193
|
+
'& path': {
|
194
|
+
stroke: theme?.palette?.primary?.slashBrainIcon
|
195
|
+
}
|
196
|
+
}
|
197
|
+
},
|
192
198
|
children: /*#__PURE__*/_jsx(Icon, {
|
193
199
|
icon: "userIcon"
|
194
200
|
})
|
195
201
|
}) : null]
|
196
202
|
})
|
197
203
|
}, doc.id);
|
198
|
-
})
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
+
}), isLoading && /*#__PURE__*/_jsx(Box, {
|
205
|
+
display: "flex",
|
206
|
+
justifyContent: "center",
|
207
|
+
alignItems: 'center',
|
208
|
+
sx: {
|
209
|
+
minWidth: "330px",
|
210
|
+
minHeight: '400px',
|
211
|
+
padding: '0px 16px 8px',
|
212
|
+
position: 'absolute'
|
213
|
+
},
|
214
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {})
|
215
|
+
})]
|
204
216
|
})]
|
205
217
|
});
|
206
218
|
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { Button } from "@mui/material";
|
2
|
+
import { useMemo, useState } from "react";
|
3
|
+
import useTable from "../../hooks/useTable";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
const showAddButton = (addType, tableNode, hoverPath) => {
|
6
|
+
const [row, col] = hoverPath && hoverPath?.length ? hoverPath.slice(-2) : [];
|
7
|
+
if (addType === "row") {
|
8
|
+
return tableNode?.rows - 1 === row;
|
9
|
+
} else {
|
10
|
+
return tableNode?.columns - 1 === col;
|
11
|
+
}
|
12
|
+
};
|
13
|
+
const ADD_COL_BTN_WIDTH = 20;
|
14
|
+
function AddRowCol(props) {
|
15
|
+
const {
|
16
|
+
tableRef,
|
17
|
+
containerRef,
|
18
|
+
addType,
|
19
|
+
tableNode,
|
20
|
+
onAdd,
|
21
|
+
readOnly
|
22
|
+
} = props;
|
23
|
+
const {
|
24
|
+
hoverPath
|
25
|
+
} = useTable();
|
26
|
+
const [hoveringAddBtn, setHoveringAddBtn] = useState(false);
|
27
|
+
const {
|
28
|
+
tableResizing
|
29
|
+
} = useTable();
|
30
|
+
const {
|
31
|
+
clientHeight,
|
32
|
+
scrollWidth
|
33
|
+
} = tableRef?.current || {};
|
34
|
+
const {
|
35
|
+
clientWidth: containerWidth
|
36
|
+
} = containerRef?.current || {};
|
37
|
+
const buttonStyle = useMemo(() => {
|
38
|
+
if (addType === "row") {
|
39
|
+
const isScrollEnabled = scrollWidth > containerWidth;
|
40
|
+
const width = isScrollEnabled ? containerWidth - ADD_COL_BTN_WIDTH : scrollWidth;
|
41
|
+
return {
|
42
|
+
width
|
43
|
+
};
|
44
|
+
} else {
|
45
|
+
return {
|
46
|
+
height: "100%",
|
47
|
+
marginLeft: "3px"
|
48
|
+
};
|
49
|
+
}
|
50
|
+
}, [scrollWidth, clientHeight, containerWidth, tableResizing]);
|
51
|
+
const showAdd = showAddButton(addType, tableNode, hoverPath);
|
52
|
+
const onMouseEnter = () => setHoveringAddBtn(true);
|
53
|
+
const onMouseLeave = () => setHoveringAddBtn(false);
|
54
|
+
const showBtn = (showAdd || hoveringAddBtn) && !tableResizing && !readOnly;
|
55
|
+
return /*#__PURE__*/_jsx("div", {
|
56
|
+
onMouseEnter: onMouseEnter,
|
57
|
+
onMouseLeave: onMouseLeave,
|
58
|
+
contentEditable: false,
|
59
|
+
children: /*#__PURE__*/_jsx(Button, {
|
60
|
+
sx: {
|
61
|
+
fontSize: "14px",
|
62
|
+
border: "1px dotted #8DA8E3",
|
63
|
+
color: "#2563EB",
|
64
|
+
padding: "0px 4px",
|
65
|
+
minWidth: "unset",
|
66
|
+
lineHeight: "18px",
|
67
|
+
...buttonStyle,
|
68
|
+
opacity: showBtn ? 1 : 0
|
69
|
+
},
|
70
|
+
disabled: !showBtn,
|
71
|
+
onClick: onAdd,
|
72
|
+
children: "+"
|
73
|
+
})
|
74
|
+
});
|
75
|
+
}
|
76
|
+
export default AddRowCol;
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import { Box, Fade, IconButton, Paper, Popover, Popper } from "@mui/material";
|
2
|
+
import DragStyles from "./DragStyles";
|
3
|
+
import { DragIcon } from "../../common/iconListV2";
|
4
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
5
|
+
import { useRef, useState } from "react";
|
6
|
+
import { TableToolOnDrag } from "./TableTool";
|
7
|
+
import Draggable from "./Draggable";
|
8
|
+
import SwipeableDrawerComponent from "../../common/SwipeableDrawer";
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
|
+
function DragButton({
|
13
|
+
anchorEl,
|
14
|
+
placement,
|
15
|
+
dragType,
|
16
|
+
onDrag = () => {},
|
17
|
+
handleToolAction,
|
18
|
+
hideDelete,
|
19
|
+
className = "",
|
20
|
+
customProps,
|
21
|
+
dndProps,
|
22
|
+
resetSelection
|
23
|
+
}) {
|
24
|
+
const {
|
25
|
+
theme
|
26
|
+
} = useEditorContext();
|
27
|
+
const classes = DragStyles(theme);
|
28
|
+
const dragElement = useRef(null);
|
29
|
+
const [showTool, setShowTool] = useState(false);
|
30
|
+
const {
|
31
|
+
isMobile
|
32
|
+
} = customProps || {};
|
33
|
+
const onDragClick = () => {
|
34
|
+
setShowTool(true);
|
35
|
+
onDrag();
|
36
|
+
};
|
37
|
+
const onDragClose = () => {
|
38
|
+
setShowTool(false);
|
39
|
+
setTimeout(() => resetSelection(), 200);
|
40
|
+
};
|
41
|
+
const dragProps = {
|
42
|
+
...dndProps,
|
43
|
+
id: dndProps?.id + dragType,
|
44
|
+
data: {
|
45
|
+
...dndProps.data,
|
46
|
+
dragType
|
47
|
+
}
|
48
|
+
};
|
49
|
+
const handleAction = (value, option, dragType) => {
|
50
|
+
const omitValues = ["delete"];
|
51
|
+
if (!omitValues.includes(value)) {
|
52
|
+
setShowTool(false);
|
53
|
+
}
|
54
|
+
handleToolAction(value, option, dragType);
|
55
|
+
};
|
56
|
+
const commonToolProps = {
|
57
|
+
theme,
|
58
|
+
dragType,
|
59
|
+
hideDelete,
|
60
|
+
handleToolAction: (value, option, dragType) => {
|
61
|
+
handleAction(value, option, dragType);
|
62
|
+
}
|
63
|
+
};
|
64
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
65
|
+
children: [/*#__PURE__*/_jsx(Popper, {
|
66
|
+
sx: classes.popper,
|
67
|
+
open: Boolean(anchorEl),
|
68
|
+
anchorEl: anchorEl,
|
69
|
+
placement: placement || "left",
|
70
|
+
transition: true,
|
71
|
+
contentEditable: false,
|
72
|
+
ref: dragElement,
|
73
|
+
modifiers: [{
|
74
|
+
name: "offset",
|
75
|
+
options: {
|
76
|
+
offset: [0, -14] // align the drag icon by -8
|
77
|
+
}
|
78
|
+
}, {
|
79
|
+
name: "flip",
|
80
|
+
enabled: false // Disable dynamic flipping
|
81
|
+
}],
|
82
|
+
|
83
|
+
disablePortal: dragType !== "row",
|
84
|
+
className: className,
|
85
|
+
children: ({
|
86
|
+
TransitionProps
|
87
|
+
}) => /*#__PURE__*/_jsx(Fade, {
|
88
|
+
...TransitionProps,
|
89
|
+
timeout: 350,
|
90
|
+
children: /*#__PURE__*/_jsx("div", {
|
91
|
+
children: /*#__PURE__*/_jsx(Draggable, {
|
92
|
+
...dragProps,
|
93
|
+
children: /*#__PURE__*/_jsx(Paper, {
|
94
|
+
sx: dragType === "row" ? {
|
95
|
+
transform: "rotate(90deg)"
|
96
|
+
} : {},
|
97
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
98
|
+
onClick: () => {
|
99
|
+
onDragClick();
|
100
|
+
},
|
101
|
+
children: /*#__PURE__*/_jsx(DragIcon, {})
|
102
|
+
})
|
103
|
+
})
|
104
|
+
})
|
105
|
+
})
|
106
|
+
})
|
107
|
+
}), isMobile ? /*#__PURE__*/_jsx(SwipeableDrawerComponent, {
|
108
|
+
open: showTool,
|
109
|
+
onClose: onDragClose,
|
110
|
+
swipeableDrawer: true,
|
111
|
+
children: /*#__PURE__*/_jsx(Box, {
|
112
|
+
sx: classes.mobileToolDrawer,
|
113
|
+
children: /*#__PURE__*/_jsx(TableToolOnDrag, {
|
114
|
+
...commonToolProps
|
115
|
+
})
|
116
|
+
})
|
117
|
+
}) : /*#__PURE__*/_jsx(Popover, {
|
118
|
+
open: showTool,
|
119
|
+
anchorEl: dragElement?.current,
|
120
|
+
transition: true,
|
121
|
+
contentEditable: false,
|
122
|
+
sx: classes.toolPopper,
|
123
|
+
anchorOrigin: {
|
124
|
+
vertical: dragType === "row" ? "bottom" : "top",
|
125
|
+
horizontal: dragType === "row" ? "left" : "right"
|
126
|
+
},
|
127
|
+
onClose: onDragClose,
|
128
|
+
children: /*#__PURE__*/_jsx(TableToolOnDrag, {
|
129
|
+
...commonToolProps
|
130
|
+
})
|
131
|
+
})]
|
132
|
+
});
|
133
|
+
}
|
134
|
+
export default DragButton;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
const DragStyles = theme => ({
|
2
|
+
popper: {
|
3
|
+
zIndex: 1000,
|
4
|
+
"& .MuiPaper-root": {
|
5
|
+
borderRadius: "4px !important",
|
6
|
+
"&:hover": {
|
7
|
+
border: `1px solid ${theme?.palatte?.editor?.activeColor || "#2563EB"}`
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"& .MuiIconButton-root": {
|
11
|
+
padding: "4px 8px",
|
12
|
+
"&:hover": {
|
13
|
+
background: "none"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
},
|
17
|
+
toolPopper: {
|
18
|
+
zIndex: 4001,
|
19
|
+
"& .MuiPaper-root": {
|
20
|
+
borderRadius: "8px"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
mobileToolDrawer: {
|
24
|
+
"& .customSelectContainer": {
|
25
|
+
border: "none !important",
|
26
|
+
padding: "0px !important"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
drawerContainer: {
|
30
|
+
"&.MuiDrawer-root": {
|
31
|
+
zIndex: 1301
|
32
|
+
},
|
33
|
+
"& .MuiDrawer-paper": {
|
34
|
+
borderTopLeftRadius: 8,
|
35
|
+
borderTopRightRadius: 8,
|
36
|
+
backgroundColor: theme.palette.containers.card
|
37
|
+
},
|
38
|
+
"& .customSelectContainer": {
|
39
|
+
border: "none"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
});
|
43
|
+
export default DragStyles;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useDraggable } from "@dnd-kit/core";
|
2
|
+
import { Box } from "@mui/material";
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
function Draggable(props) {
|
5
|
+
const {
|
6
|
+
attributes,
|
7
|
+
listeners,
|
8
|
+
setNodeRef,
|
9
|
+
transform
|
10
|
+
} = useDraggable(props);
|
11
|
+
const {
|
12
|
+
dragType
|
13
|
+
} = props?.data || {};
|
14
|
+
const style = transform ? {
|
15
|
+
transform: dragType === "row" ? `translate3d(0, ${transform.y}px, 0)` : `translate3d(${transform.x}px, 0, 0)`
|
16
|
+
} : undefined;
|
17
|
+
return /*#__PURE__*/_jsx(Box, {
|
18
|
+
style: style,
|
19
|
+
ref: setNodeRef,
|
20
|
+
...listeners,
|
21
|
+
...attributes,
|
22
|
+
children: props.children
|
23
|
+
});
|
24
|
+
}
|
25
|
+
export default Draggable;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { useDroppable } from "@dnd-kit/core";
|
2
|
+
import { Box } from "@mui/material";
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
function getStyle(dragType, isOver, tableDOM) {
|
7
|
+
const style = {};
|
8
|
+
const borderStyle = "4px solid #2563EB";
|
9
|
+
if (isOver) {
|
10
|
+
const {
|
11
|
+
width,
|
12
|
+
height
|
13
|
+
} = tableDOM.getBoundingClientRect();
|
14
|
+
if (dragType === "row") {
|
15
|
+
style.borderTop = borderStyle;
|
16
|
+
style.width = width;
|
17
|
+
} else if (dragType === "col") {
|
18
|
+
style.borderLeft = borderStyle;
|
19
|
+
style.height = height;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
return style;
|
23
|
+
}
|
24
|
+
export function Droppable(props) {
|
25
|
+
const {
|
26
|
+
dragType,
|
27
|
+
tableDOM,
|
28
|
+
...rest
|
29
|
+
} = props;
|
30
|
+
const {
|
31
|
+
isOver,
|
32
|
+
setNodeRef
|
33
|
+
} = useDroppable(rest);
|
34
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
35
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
36
|
+
ref: setNodeRef,
|
37
|
+
sx: {
|
38
|
+
position: "absolute",
|
39
|
+
top: 0,
|
40
|
+
left: 0,
|
41
|
+
width: "100%",
|
42
|
+
height: "100%"
|
43
|
+
}
|
44
|
+
}), isOver ? /*#__PURE__*/_jsx(Box, {
|
45
|
+
sx: {
|
46
|
+
position: "absolute",
|
47
|
+
top: 0,
|
48
|
+
left: 0,
|
49
|
+
...getStyle(dragType, isOver, tableDOM)
|
50
|
+
}
|
51
|
+
}) : null]
|
52
|
+
});
|
53
|
+
}
|
@@ -1,20 +1,25 @@
|
|
1
|
-
const TableStyles =
|
1
|
+
const TableStyles = theme => ({
|
2
2
|
tableToolBar: {
|
3
3
|
position: "absolute",
|
4
|
-
top: "-
|
4
|
+
top: "-24px",
|
5
5
|
left: 0,
|
6
|
-
backgroundColor: "#FFF",
|
7
|
-
border: "1px solid rgba(37, 99, 235, 0.32)",
|
8
|
-
boxShadow: "0px 0px 10px 0px rgba(0, 0, 0, 0.16)",
|
9
|
-
borderRadius: "0px",
|
10
|
-
width: "32px",
|
11
|
-
height: "32px",
|
12
|
-
overflow: "hidden",
|
13
6
|
transition: "all 0.3s",
|
14
7
|
"& button": {
|
8
|
+
backgroundColor: theme?.palette?.editor?.background,
|
9
|
+
border: "1px solid rgba(37, 99, 235, 0.32)",
|
10
|
+
boxShadow: "0px 0px 10px 0px rgba(0, 0, 0, 0.16)",
|
11
|
+
borderRadius: "50%",
|
12
|
+
padding: "4px",
|
13
|
+
margin: "2px",
|
14
|
+
"&:hover": {
|
15
|
+
backgroundColor: theme?.palette?.editor?.background
|
16
|
+
},
|
15
17
|
"& svg": {
|
16
18
|
width: "16px",
|
17
|
-
height: "16px"
|
19
|
+
height: "16px",
|
20
|
+
"& path": {
|
21
|
+
stroke: theme?.palette?.editor?.textColor
|
22
|
+
}
|
18
23
|
}
|
19
24
|
},
|
20
25
|
"&.active": {
|
@@ -31,13 +36,7 @@ const TableStyles = themeType => ({
|
|
31
36
|
},
|
32
37
|
table: {
|
33
38
|
"& td": {
|
34
|
-
padding: "8px 8px"
|
35
|
-
border: "1px solid #E0E0E0",
|
36
|
-
"&.selection": {
|
37
|
-
"& *::selection": {
|
38
|
-
background: "transparent"
|
39
|
-
}
|
40
|
-
}
|
39
|
+
padding: "8px 8px"
|
41
40
|
},
|
42
41
|
"& .selection-area-tc": {
|
43
42
|
position: "absolute",
|
@@ -45,8 +44,13 @@ const TableStyles = themeType => ({
|
|
45
44
|
height: "100%",
|
46
45
|
top: 0,
|
47
46
|
left: 0,
|
48
|
-
|
47
|
+
outline: "1px solid #2563EB",
|
49
48
|
pointerEvents: "none"
|
49
|
+
},
|
50
|
+
"& .hide-drag-btn-wrapper": {
|
51
|
+
"& .row-drag-btn": {
|
52
|
+
display: "none"
|
53
|
+
}
|
50
54
|
}
|
51
55
|
},
|
52
56
|
cellResizer: {
|
@@ -59,29 +63,7 @@ const TableStyles = themeType => ({
|
|
59
63
|
borderRadius: "0px",
|
60
64
|
zIndex: 1,
|
61
65
|
"&:hover": {
|
62
|
-
background: "#
|
63
|
-
}
|
64
|
-
},
|
65
|
-
deleteCellsPopUp: {
|
66
|
-
backgroundColor: themeType === "dark" ? "#292C32" : "#FFFFFF",
|
67
|
-
borderRadius: "7px !important",
|
68
|
-
border: themeType === "dark" ? "1px solid #5B5E64" : "1px solid #E4E8EB",
|
69
|
-
zIndex: 100,
|
70
|
-
minWidth: "186px !important"
|
71
|
-
},
|
72
|
-
menuItemPopUp: {
|
73
|
-
padding: "5px 7px !important",
|
74
|
-
margin: "6px !important",
|
75
|
-
borderRadius: 1,
|
76
|
-
userSelect: "none",
|
77
|
-
color: themeType === "dark" ? "#2563EB" : "#0F172A",
|
78
|
-
"&:hover": {
|
79
|
-
// backgroundColor: "rgba(0, 123, 255, 0.1)",
|
80
|
-
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE"
|
81
|
-
},
|
82
|
-
"&.Mui-selected": {
|
83
|
-
backgroundColor: themeType === "dark" ? "#2563EB" : "#E9F3FE",
|
84
|
-
color: themeType === "dark" ? "#F6F6F6" : "#0F172A"
|
66
|
+
background: "#2563EB"
|
85
67
|
}
|
86
68
|
}
|
87
69
|
});
|