@flozy/editor 5.1.5 → 5.1.7
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/AppHeader/AppHeader.js +6 -6
- 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 +109 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +66 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +30 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -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 +60 -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 +112 -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/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +1 -1
- package/dist/Editor/Elements/Grid/GridButton.js +2 -2
- package/dist/Editor/Elements/Grid/GridItem.js +21 -18
- 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 +13 -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 -12
- 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 +19 -15
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +411 -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 +20 -19
- 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 -8
- 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/GuideLines/styles.js +3 -3
- package/dist/Editor/common/RnD/ShadowElement.js +1 -1
- 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
@@ -1,122 +1,106 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Transforms } from "slate";
|
3
|
-
import { useSelected, useSlateStatic } from "slate-react";
|
4
|
-
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, useTheme } from "@mui/material";
|
5
|
-
import AlignHorizontalLeftIcon from "@mui/icons-material/AlignHorizontalLeft";
|
6
|
-
import AlignHorizontalRightIcon from "@mui/icons-material/AlignHorizontalRight";
|
7
|
-
import AlignVerticalTopIcon from "@mui/icons-material/AlignVerticalTop";
|
8
|
-
import AlignVerticalBottomIcon from "@mui/icons-material/AlignVerticalBottom";
|
9
|
-
import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
|
10
|
-
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
11
|
-
import SettingsIcon from "@mui/icons-material/Settings";
|
12
|
-
import DeleteCellIcon from "./DeleteCellIcon";
|
13
|
-
import DeleteRowIcon from "./DeleteRowIcon";
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
|
+
import { Editor, Transforms } from "slate";
|
3
|
+
import { ReactEditor, useSelected, useSlateStatic } from "slate-react";
|
4
|
+
import { Box, IconButton, Tooltip, Table as TableComp, TableBody, useTheme, Popper, Fade } from "@mui/material";
|
14
5
|
import { TableUtil } from "../../utils/table";
|
15
6
|
import TablePopup from "./TablePopup";
|
16
|
-
import { useEditorSelection } from "../../hooks/useMouseMove";
|
7
|
+
import { useEditorContext, useEditorSelection } from "../../hooks/useMouseMove";
|
17
8
|
import TableStyles from "./Styles";
|
18
9
|
import "./table.css";
|
19
10
|
import { groupByBreakpoint } from "../../helper/theme";
|
11
|
+
import useTable, { TableProvider } from "../../hooks/useTable";
|
12
|
+
import AddRowCol from "./AddRowCol";
|
13
|
+
import TableTool from "./TableTool";
|
14
|
+
import { MoreIcon, SettingsIcon } from "../../assets/svg/TableIcons";
|
20
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
21
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
type: "insertColumn",
|
27
|
-
position: "after"
|
17
|
+
const hideRowDragBtns = (hide, dragRowBtnCls) => {
|
18
|
+
const rowDragBtns = document.querySelectorAll(`.${dragRowBtnCls}`);
|
19
|
+
if (rowDragBtns?.length) {
|
20
|
+
rowDragBtns?.forEach(btn => btn.style.display = hide);
|
28
21
|
}
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}, {
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
}, {
|
69
|
-
Icon: DeleteForeverIcon,
|
70
|
-
text: "Remove Table",
|
71
|
-
action: {
|
72
|
-
type: "remove"
|
73
|
-
}
|
74
|
-
}];
|
22
|
+
};
|
23
|
+
const ToolBar = props => {
|
24
|
+
const {
|
25
|
+
selected,
|
26
|
+
showTool,
|
27
|
+
classes,
|
28
|
+
handleExpand,
|
29
|
+
handleAction,
|
30
|
+
exandTools
|
31
|
+
} = props;
|
32
|
+
const {
|
33
|
+
getSelectedCells
|
34
|
+
} = useTable();
|
35
|
+
const viewTool = selected && !showTool && getSelectedCells()?.length <= 1;
|
36
|
+
return viewTool ? /*#__PURE__*/_jsxs(Box, {
|
37
|
+
component: "div",
|
38
|
+
contentEditable: false,
|
39
|
+
className: `tableToolBar ${exandTools ? "active" : ""}`,
|
40
|
+
sx: classes.tableToolBar,
|
41
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
42
|
+
title: "Settings",
|
43
|
+
arrow: true,
|
44
|
+
onClick: () => handleAction("settings"),
|
45
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
46
|
+
className: "toolbtn toggle",
|
47
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
48
|
+
})
|
49
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
50
|
+
title: "Show Tools",
|
51
|
+
arrow: true,
|
52
|
+
onClick: handleExpand,
|
53
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
54
|
+
className: "toolbtn toggle",
|
55
|
+
children: /*#__PURE__*/_jsx(MoreIcon, {})
|
56
|
+
})
|
57
|
+
})]
|
58
|
+
}) : null;
|
59
|
+
};
|
75
60
|
const Table = props => {
|
76
61
|
const theme = useTheme();
|
62
|
+
const {
|
63
|
+
theme: editorTheme
|
64
|
+
} = useEditorContext();
|
77
65
|
const {
|
78
66
|
element,
|
79
67
|
attributes,
|
80
68
|
children,
|
81
69
|
customProps
|
82
70
|
} = props;
|
83
|
-
const classes = TableStyles();
|
71
|
+
const classes = TableStyles(editorTheme);
|
84
72
|
const {
|
85
73
|
readOnly
|
86
74
|
} = customProps;
|
87
75
|
const [openSetttings, setOpenSettings] = useState(false);
|
88
|
-
const [exandTools, setExpandTools] = useState(
|
76
|
+
const [exandTools, setExpandTools] = useState(null);
|
89
77
|
const {
|
90
78
|
bgColor,
|
91
79
|
borderColor,
|
92
|
-
xsHidden
|
80
|
+
xsHidden,
|
81
|
+
fontFamily,
|
82
|
+
fontWeight,
|
83
|
+
textSize,
|
84
|
+
textColor
|
93
85
|
} = element;
|
94
86
|
const editor = useSlateStatic();
|
95
87
|
const selected = useSelected();
|
96
88
|
const table = new TableUtil(editor);
|
97
89
|
const tableProps = table.getTableProps();
|
98
90
|
const [showTool] = useEditorSelection(editor);
|
99
|
-
const
|
100
|
-
|
101
|
-
|
102
|
-
|
91
|
+
const tableRef = useRef(null);
|
92
|
+
const containerRef = useRef(null);
|
93
|
+
const path = ReactEditor.findPath(editor, element);
|
94
|
+
const dragRowBtnCls = `table-${path?.toString()?.replaceAll(",", "-")}-row-drag-btn`;
|
95
|
+
const handleAction = type => {
|
103
96
|
Transforms.select(editor, editor.selection);
|
104
97
|
switch (type) {
|
105
|
-
case "
|
106
|
-
table.insertRow(position);
|
107
|
-
break;
|
108
|
-
case "insertColumn":
|
109
|
-
table.insertColumn(position);
|
110
|
-
break;
|
111
|
-
case "deleteRow":
|
112
|
-
table.deleteRow();
|
113
|
-
break;
|
114
|
-
case "deleteColumn":
|
115
|
-
table.deleteColumn();
|
116
|
-
break;
|
117
|
-
case "remove":
|
98
|
+
case "delete":
|
118
99
|
table.removeTable();
|
119
100
|
break;
|
101
|
+
case "duplicate":
|
102
|
+
table.duplicateTable();
|
103
|
+
break;
|
120
104
|
case "settings":
|
121
105
|
if (tableProps) {
|
122
106
|
onSettings(true);
|
@@ -126,42 +110,16 @@ const Table = props => {
|
|
126
110
|
return;
|
127
111
|
}
|
128
112
|
};
|
129
|
-
const handleExpand =
|
130
|
-
setExpandTools(
|
131
|
-
};
|
132
|
-
const ToolBar = () => {
|
133
|
-
return selected && !showTool ? /*#__PURE__*/_jsxs(Box, {
|
134
|
-
component: "div",
|
135
|
-
contentEditable: false,
|
136
|
-
className: `tableToolBar ${exandTools ? "active" : ""}`,
|
137
|
-
sx: classes.tableToolBar,
|
138
|
-
children: [/*#__PURE__*/_jsx(Tooltip, {
|
139
|
-
title: "Show Tools",
|
140
|
-
arrow: true,
|
141
|
-
onClick: handleExpand,
|
142
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
143
|
-
className: "toolbtn toggle",
|
144
|
-
children: /*#__PURE__*/_jsx(MoreVertIcon, {})
|
145
|
-
})
|
146
|
-
}), TABLE_MENUS.map(({
|
147
|
-
Icon,
|
148
|
-
text,
|
149
|
-
action
|
150
|
-
}) => {
|
151
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
152
|
-
title: text,
|
153
|
-
arrow: true,
|
154
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
155
|
-
className: `toolbtn ${action?.type}`,
|
156
|
-
onClick: handleAction(action),
|
157
|
-
children: /*#__PURE__*/_jsx(Icon, {})
|
158
|
-
})
|
159
|
-
}, text);
|
160
|
-
})]
|
161
|
-
}) : null;
|
113
|
+
const handleExpand = e => {
|
114
|
+
setExpandTools(prev => prev ? false : e.currentTarget);
|
162
115
|
};
|
116
|
+
useEffect(() => {
|
117
|
+
if (!selected) {
|
118
|
+
setExpandTools(false);
|
119
|
+
}
|
120
|
+
}, [selected]);
|
163
121
|
const onSettings = () => {
|
164
|
-
setOpenSettings(
|
122
|
+
setOpenSettings(!openSetttings);
|
165
123
|
};
|
166
124
|
const onSave = data => {
|
167
125
|
const updateData = {
|
@@ -183,28 +141,137 @@ const Table = props => {
|
|
183
141
|
lg: "inline-block"
|
184
142
|
}
|
185
143
|
}, theme);
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
144
|
+
const addRow = () => {
|
145
|
+
const lastRow = element?.rows - 1;
|
146
|
+
const firstCol = 0;
|
147
|
+
const lastRowPath = [...path, lastRow, firstCol];
|
148
|
+
const position = Editor.start(editor, lastRowPath);
|
149
|
+
const selection = {
|
150
|
+
anchor: position,
|
151
|
+
focus: position
|
152
|
+
};
|
153
|
+
|
154
|
+
// select the last row first col to insert row below
|
155
|
+
Transforms.select(editor, selection);
|
156
|
+
table.insertRow("after");
|
157
|
+
Transforms.deselect(editor);
|
158
|
+
};
|
159
|
+
const addCol = () => {
|
160
|
+
const lastCol = element?.columns - 1;
|
161
|
+
const firstRow = 0;
|
162
|
+
const lastColumnPath = [...path, firstRow, lastCol];
|
163
|
+
const position = Editor.start(editor, lastColumnPath);
|
164
|
+
const selection = {
|
165
|
+
anchor: position,
|
166
|
+
focus: position
|
167
|
+
};
|
168
|
+
|
169
|
+
// select the last row first col to insert row below
|
170
|
+
Transforms.select(editor, selection);
|
171
|
+
table.insertColumn("after");
|
172
|
+
Transforms.deselect(editor);
|
173
|
+
};
|
174
|
+
const handleRowDragBtns = () => {
|
175
|
+
if (containerRef?.current?.scrollLeft > 0) {
|
176
|
+
hideRowDragBtns("none", dragRowBtnCls);
|
177
|
+
} else {
|
178
|
+
hideRowDragBtns("", dragRowBtnCls);
|
179
|
+
}
|
180
|
+
};
|
181
|
+
const handleScroll = () => {
|
182
|
+
handleRowDragBtns();
|
183
|
+
};
|
184
|
+
const onMouseOver = () => {
|
185
|
+
containerRef?.current?.classList.remove("hideScroll");
|
186
|
+
};
|
187
|
+
const onMouseLeave = () => {
|
188
|
+
containerRef?.current?.classList.add("hideScroll");
|
189
|
+
};
|
190
|
+
const commonAddBtnProps = {
|
191
|
+
tableRef,
|
192
|
+
containerRef,
|
193
|
+
readOnly,
|
194
|
+
tableNode: element
|
195
|
+
};
|
196
|
+
return /*#__PURE__*/_jsxs(TableProvider, {
|
197
|
+
editor: editor,
|
198
|
+
otherProps: {
|
199
|
+
dragRowBtnCls,
|
200
|
+
tablePath: path,
|
201
|
+
openSetttings
|
191
202
|
},
|
192
|
-
children: [/*#__PURE__*/
|
193
|
-
className: readOnly ? "readOnly" : "",
|
194
|
-
sx: {
|
195
|
-
...classes.table,
|
196
|
-
...tableSX
|
197
|
-
},
|
203
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
198
204
|
style: {
|
199
|
-
|
200
|
-
|
201
|
-
|
205
|
+
minWidth: "100%",
|
206
|
+
maxWidth: "100%",
|
207
|
+
position: "relative",
|
208
|
+
overflowX: "auto",
|
209
|
+
display: "flex",
|
210
|
+
paddingTop: "10px"
|
202
211
|
},
|
203
|
-
|
204
|
-
|
205
|
-
|
212
|
+
ref: containerRef,
|
213
|
+
onScroll: handleScroll,
|
214
|
+
onMouseOver: onMouseOver,
|
215
|
+
onMouseLeave: onMouseLeave,
|
216
|
+
className: "custom-scroll",
|
217
|
+
children: [/*#__PURE__*/_jsx(TableComp, {
|
218
|
+
className: readOnly ? "readOnly" : "",
|
219
|
+
sx: {
|
220
|
+
...classes.table,
|
221
|
+
...tableSX
|
222
|
+
},
|
223
|
+
style: {
|
224
|
+
background: bgColor,
|
225
|
+
border: borderColor ? `1px solid ${borderColor}` : "",
|
226
|
+
width: "auto",
|
227
|
+
fontFamily,
|
228
|
+
fontWeight,
|
229
|
+
fontSize: textSize,
|
230
|
+
color: textColor
|
231
|
+
},
|
232
|
+
ref: tableRef,
|
233
|
+
children: /*#__PURE__*/_jsx(TableBody, {
|
234
|
+
...attributes,
|
235
|
+
children: children
|
236
|
+
})
|
237
|
+
}), /*#__PURE__*/_jsx(AddRowCol, {
|
238
|
+
...commonAddBtnProps,
|
239
|
+
addType: "col",
|
240
|
+
onAdd: addCol
|
241
|
+
})]
|
242
|
+
}), /*#__PURE__*/_jsx(AddRowCol, {
|
243
|
+
...commonAddBtnProps,
|
244
|
+
addType: "row",
|
245
|
+
onAdd: addRow
|
246
|
+
}), !readOnly && /*#__PURE__*/_jsx(ToolBar, {
|
247
|
+
selected: selected,
|
248
|
+
showTool: showTool,
|
249
|
+
classes: classes,
|
250
|
+
handleExpand: handleExpand,
|
251
|
+
handleAction: handleAction,
|
252
|
+
exandTools: exandTools
|
253
|
+
}), /*#__PURE__*/_jsx(Popper, {
|
254
|
+
open: Boolean(exandTools),
|
255
|
+
anchorEl: exandTools,
|
256
|
+
transition: true,
|
257
|
+
contentEditable: false,
|
258
|
+
sx: {
|
259
|
+
zIndex: 2000
|
260
|
+
},
|
261
|
+
placement: "bottom-start",
|
262
|
+
children: ({
|
263
|
+
TransitionProps
|
264
|
+
}) => /*#__PURE__*/_jsx(Fade, {
|
265
|
+
...TransitionProps,
|
266
|
+
timeout: 350,
|
267
|
+
children: /*#__PURE__*/_jsx("div", {
|
268
|
+
children: /*#__PURE__*/_jsx(TableTool, {
|
269
|
+
theme: editorTheme,
|
270
|
+
handleToolAction: handleAction
|
271
|
+
})
|
272
|
+
})
|
206
273
|
})
|
207
|
-
}),
|
274
|
+
}), openSetttings ? /*#__PURE__*/_jsx(TablePopup, {
|
208
275
|
element: tableProps?.styleProps || {},
|
209
276
|
onSave: onSave,
|
210
277
|
onClose: onClose,
|