@flozy/editor 9.0.4 → 9.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/ChatEditor.js +2 -2
- package/dist/Editor/CommonEditor.js +41 -11
- package/dist/Editor/Editor.css +15 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +5 -4
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +4 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +3 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +6 -1
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +19 -9
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +32 -2
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +126 -29
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +3 -3
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +1 -1
- package/dist/Editor/Elements/DataView/styles.js +8 -8
- package/dist/Editor/Elements/Grid/GridItem.js +1 -2
- package/dist/Editor/Elements/Link/Link.js +70 -43
- package/dist/Editor/Elements/SimpleText/index.js +0 -1
- package/dist/Editor/Elements/Variables/Style.js +28 -2
- package/dist/Editor/Elements/Variables/VariableButton.js +7 -3
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +0 -2
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +9 -8
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +13 -11
- package/dist/Editor/common/CustomDialog/index.js +90 -0
- package/dist/Editor/common/CustomDialog/styles.js +80 -0
- package/dist/Editor/common/DnD/Draggable.js +0 -1
- package/dist/Editor/common/ImageSelector/UploadStyles.js +0 -1
- package/dist/Editor/common/MentionsPopup/Styles.js +3 -3
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +5 -4
- package/dist/Editor/commonStyle.js +59 -4
- package/dist/Editor/plugins/withHTML.js +1 -1
- package/dist/Editor/utils/helper.js +13 -1
- package/dist/Editor/utils/link.js +1 -1
- package/package.json +5 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useCallback, useMemo, useRef, useState,
|
1
|
+
import React, { useCallback, useMemo, useRef, useState, useImperativeHandle, forwardRef } from "react";
|
2
2
|
import { Editable, Slate, ReactEditor } from 'slate-react';
|
3
3
|
import { createEditor, Transforms, Editor } from 'slate';
|
4
4
|
import withCommon from "./hooks/withCommon";
|
@@ -41,7 +41,7 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
41
41
|
}]
|
42
42
|
}]
|
43
43
|
});
|
44
|
-
const [value
|
44
|
+
const [value] = useState(convertedContent);
|
45
45
|
const debouncedValue = useRef(value);
|
46
46
|
const debounced = useDebouncedCallback(
|
47
47
|
// function
|
@@ -27,7 +27,7 @@ import DragAndDrop from "./common/DnD";
|
|
27
27
|
import Section from "./common/Section";
|
28
28
|
import decorators from "./utils/Decorators";
|
29
29
|
import { getBreakpointLineSpacing, getTRBLBreakPoints } from "./helper/theme";
|
30
|
-
import { getInitialValue, handleInsertLastElement, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
30
|
+
import { getInitialValue, handleInsertLastElement, isEverythingSelected, isFreeGrid, isFreeGridFragment, isRestrictedNode, outsideEditorClickLabel } from "./utils/helper";
|
31
31
|
import useWindowResize from "./hooks/useWindowResize";
|
32
32
|
import PopoverAIInput from "./Elements/AI/PopoverAIInput";
|
33
33
|
import RnDCopy from "./common/RnD/RnDCopy";
|
@@ -37,6 +37,7 @@ import "./font.css";
|
|
37
37
|
import "./Editor.css";
|
38
38
|
import "animate.css";
|
39
39
|
import FontLoader from "./common/FontLoader/FontLoader";
|
40
|
+
import { CustomDialogComponent } from "./common/CustomDialog";
|
40
41
|
import { jsx as _jsx } from "react/jsx-runtime";
|
41
42
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
42
43
|
const Item = /*#__PURE__*/forwardRef(({
|
@@ -114,6 +115,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
114
115
|
const [breakpoint, setBreakpoint] = useState("");
|
115
116
|
const [topBanner, setTopBanner] = useState();
|
116
117
|
const debouncedValue = useRef(value);
|
118
|
+
const dialogRef = useRef(null);
|
117
119
|
const [size] = useWindowResize();
|
118
120
|
const {
|
119
121
|
needDotsBG,
|
@@ -355,6 +357,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
355
357
|
...partialState
|
356
358
|
}));
|
357
359
|
};
|
360
|
+
const handleDeleteAll = () => {
|
361
|
+
const {
|
362
|
+
selection
|
363
|
+
} = editor;
|
364
|
+
if (selection) {
|
365
|
+
editor.deleteFragment();
|
366
|
+
dialogRef.current?.handleClose();
|
367
|
+
}
|
368
|
+
};
|
358
369
|
const onKeyDown = useCallback(event => {
|
359
370
|
const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
|
360
371
|
const isCtrlKey = event.ctrlKey || isMetaKey;
|
@@ -401,16 +412,27 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
401
412
|
const {
|
402
413
|
selection
|
403
414
|
} = editor;
|
415
|
+
const everythingSelect = isEverythingSelected(editor);
|
404
416
|
event.preventDefault();
|
405
|
-
if (
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
}
|
417
|
+
if (everythingSelect) {
|
418
|
+
dialogRef.current?.handleOpen();
|
419
|
+
} else {
|
420
|
+
if (selection) {
|
421
|
+
if (!Range.isCollapsed(selection)) {
|
422
|
+
editor.deleteFragment();
|
423
|
+
} else {
|
424
|
+
editor.deleteBackward({
|
425
|
+
unit: "character"
|
426
|
+
});
|
427
|
+
}
|
412
428
|
}
|
413
429
|
}
|
430
|
+
} else if (event.key === "Delete") {
|
431
|
+
const everythingSelect = isEverythingSelected(editor);
|
432
|
+
if (everythingSelect) {
|
433
|
+
event.preventDefault();
|
434
|
+
dialogRef.current?.handleOpen();
|
435
|
+
}
|
414
436
|
}
|
415
437
|
}, [chars, target, mentions, setMentions, search, type, mentionsRef]);
|
416
438
|
const Overlay = collaborativeEditor && !isReadOnly ? RemoteCursorOverlay : React.Fragment;
|
@@ -489,10 +511,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
489
511
|
console.log("handleCursorScroll", err);
|
490
512
|
}
|
491
513
|
};
|
492
|
-
return /*#__PURE__*/
|
514
|
+
return /*#__PURE__*/_jsxs(EditorProvider, {
|
493
515
|
theme: theme,
|
494
516
|
editor: editor,
|
495
|
-
children: /*#__PURE__*/_jsx(DialogWrapper, {
|
517
|
+
children: [/*#__PURE__*/_jsx(DialogWrapper, {
|
496
518
|
classes: classes,
|
497
519
|
...props,
|
498
520
|
fullScreen: fullScreen,
|
@@ -616,7 +638,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
616
638
|
readOnly: readOnly
|
617
639
|
})]
|
618
640
|
})
|
619
|
-
})
|
641
|
+
}), /*#__PURE__*/_jsx(CustomDialogComponent, {
|
642
|
+
ref: dialogRef,
|
643
|
+
content: "Are you sure you want to delete All the content?",
|
644
|
+
confirmText: "Delete",
|
645
|
+
cancelText: "Cancel",
|
646
|
+
onConfirm: () => {
|
647
|
+
handleDeleteAll();
|
648
|
+
}
|
649
|
+
})]
|
620
650
|
});
|
621
651
|
});
|
622
652
|
CommonEditor.displayName = "CommonEditor";
|
package/dist/Editor/Editor.css
CHANGED
@@ -1339,4 +1339,18 @@ code.markcode {
|
|
1339
1339
|
display: block;
|
1340
1340
|
background-color: #f3f3f3;
|
1341
1341
|
font-family: 'Source Code Pro' !important;
|
1342
|
-
}
|
1342
|
+
}
|
1343
|
+
/* Hide the popper when the reference is hidden */
|
1344
|
+
.hide-popper-on-overlap[data-popper-escaped],
|
1345
|
+
.hide-popper-on-overlap[data-popper-reference-hidden] {
|
1346
|
+
visibility: hidden;
|
1347
|
+
pointer-events: none;
|
1348
|
+
}
|
1349
|
+
code.markcode {
|
1350
|
+
border-radius: 4px;
|
1351
|
+
padding: 6px 8px;
|
1352
|
+
margin: 8px 0px;
|
1353
|
+
display: block;
|
1354
|
+
background-color: #f3f3f3;
|
1355
|
+
font-family: 'Source Code Pro' !important;
|
1356
|
+
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useState } from "react";
|
2
2
|
import { ReactEditor } from "slate-react";
|
3
|
-
import { Transforms } from "slate";
|
4
3
|
import ColorPickerTool from "react-gcolor-picker";
|
5
4
|
import { IconButton, Tooltip, Box, Popover } from "@mui/material";
|
6
5
|
import { addMarkData, activeMark } from "../../utils/SlateUtilityFunctions";
|
@@ -43,19 +42,21 @@ const ColorPicker = props => {
|
|
43
42
|
};
|
44
43
|
const handleFormSubmit = color => {
|
45
44
|
if (!color) return;
|
46
|
-
selection && Transforms.select(editor, selection);
|
45
|
+
// selection && Transforms.select(editor, selection);
|
47
46
|
addMarkData(editor, {
|
48
47
|
format,
|
49
48
|
value: color
|
50
49
|
});
|
51
|
-
selection && ReactEditor.focus(editor);
|
52
|
-
handleClose();
|
50
|
+
// selection && ReactEditor.focus(editor);
|
51
|
+
// handleClose();
|
53
52
|
};
|
53
|
+
|
54
54
|
const onSelect = color => {
|
55
55
|
handleFormSubmit(color);
|
56
56
|
};
|
57
57
|
const handleClose = () => {
|
58
58
|
setAnchorEl(null);
|
59
|
+
setSelection(null);
|
59
60
|
};
|
60
61
|
const activeColor = activeMark(editor, format) || DEFAULT_COLOR[format];
|
61
62
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
@@ -16,7 +16,10 @@ const ColumnView = props => {
|
|
16
16
|
selected,
|
17
17
|
readOnly
|
18
18
|
} = props;
|
19
|
-
const
|
19
|
+
const {
|
20
|
+
type
|
21
|
+
} = property;
|
22
|
+
const DataType = DataTypes[type] || DataTypes["text"];
|
20
23
|
const anchorRef = useRef(null);
|
21
24
|
const [anchorEl, setAnchorEl] = useState(null);
|
22
25
|
const [popperRefresh, setPopperRefresh] = useState(new Date().getTime());
|
@@ -153,11 +153,9 @@ export default function Select(props) {
|
|
153
153
|
...optionProps,
|
154
154
|
children: /*#__PURE__*/_jsx(Chip, {
|
155
155
|
label: option.label || option.value || "",
|
156
|
+
classes: classes.chipText,
|
156
157
|
sx: {
|
157
|
-
background: option.color || appTheme?.palette?.editor?.tv_border1
|
158
|
-
"& .MuiChip-label": {
|
159
|
-
paddingLeft: "12px !important"
|
160
|
-
}
|
158
|
+
background: option.color || appTheme?.palette?.editor?.tv_border1
|
161
159
|
},
|
162
160
|
avatar: /*#__PURE__*/_jsx(AvatarIcon, {
|
163
161
|
option: option,
|
@@ -172,6 +170,7 @@ export default function Select(props) {
|
|
172
170
|
fullWidth: true,
|
173
171
|
renderInput: params => {
|
174
172
|
return /*#__PURE__*/_jsx(TextField, {
|
173
|
+
fullWidth: true,
|
175
174
|
size: "small",
|
176
175
|
...params,
|
177
176
|
placeholder: placeholder
|
@@ -3,7 +3,7 @@ const useCompStyles = (theme, appTheme) => ({
|
|
3
3
|
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
4
4
|
background: appTheme?.palette?.editor?.tv_pop_bg,
|
5
5
|
color: appTheme?.palette?.editor?.tv_text,
|
6
|
-
fontSize:
|
6
|
+
fontSize: "14px",
|
7
7
|
borderRadius: "8px",
|
8
8
|
[theme?.breakpoints?.between("xs", "md")]: {},
|
9
9
|
"& ul": {
|
@@ -63,6 +63,11 @@ const useCompStyles = (theme, appTheme) => ({
|
|
63
63
|
}
|
64
64
|
}
|
65
65
|
}
|
66
|
+
},
|
67
|
+
chipText: {
|
68
|
+
"& .MuiChip-label": {
|
69
|
+
paddingLeft: "12px !important"
|
70
|
+
}
|
66
71
|
}
|
67
72
|
});
|
68
73
|
export default useCompStyles;
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import DatePicker from "react-datepicker";
|
3
|
+
import { Grid } from "@mui/material";
|
3
4
|
import { useDataView } from "../../Providers/DataViewProvider";
|
5
|
+
import useCommonStyle from "../../../../commonStyle";
|
6
|
+
import { useEditorContext } from "../../../../hooks/useMouseMove";
|
4
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
8
|
function isValidDate(dateString) {
|
6
9
|
const date = new Date(dateString);
|
@@ -16,20 +19,27 @@ const DateType = props => {
|
|
16
19
|
const {
|
17
20
|
onChange
|
18
21
|
} = useDataView();
|
22
|
+
const {
|
23
|
+
theme
|
24
|
+
} = useEditorContext();
|
25
|
+
const classes = useCommonStyle(theme);
|
19
26
|
const handleChange = date => {
|
20
27
|
onChange(rowIndex, {
|
21
28
|
[property]: date
|
22
29
|
});
|
23
30
|
};
|
24
|
-
return /*#__PURE__*/_jsx(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
return /*#__PURE__*/_jsx(Grid, {
|
32
|
+
sx: classes.datePicker,
|
33
|
+
children: /*#__PURE__*/_jsx(DatePicker, {
|
34
|
+
disabled: readOnly,
|
35
|
+
selected: isValidDate(value) ? new Date(value) : "",
|
36
|
+
onChange: handleChange,
|
37
|
+
onKeyDown: e => {
|
38
|
+
e.preventDefault();
|
39
|
+
console.log(e?.target.value);
|
40
|
+
},
|
41
|
+
placeholderText: "MM/DD/YYYY"
|
42
|
+
})
|
33
43
|
});
|
34
44
|
};
|
35
45
|
export default DateType;
|
@@ -10,12 +10,16 @@ const useTableStyles = (theme, appTheme) => ({
|
|
10
10
|
borderSpacing: 0,
|
11
11
|
borderRadius: "7px 7px 0px 0px",
|
12
12
|
overflow: "hidden",
|
13
|
+
width: "auto !important",
|
14
|
+
minWidth: "100%",
|
13
15
|
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
16
|
+
tableLayout: "fixed",
|
14
17
|
"& thead": {
|
15
18
|
background: appTheme?.palette?.editor?.tv_header,
|
16
19
|
height: "40px"
|
17
20
|
},
|
18
21
|
"& th": {
|
22
|
+
position: "relative",
|
19
23
|
"& svg": {
|
20
24
|
"& .fillStroke": {
|
21
25
|
stroke: appTheme?.palette?.editor?.tv_stroke
|
@@ -27,6 +31,8 @@ const useTableStyles = (theme, appTheme) => ({
|
|
27
31
|
},
|
28
32
|
"& td": {
|
29
33
|
height: "40px",
|
34
|
+
maxWidth: "0px !important",
|
35
|
+
minWidth: "0px !important",
|
30
36
|
"& input": {
|
31
37
|
color: appTheme?.palette?.editor?.tv_text_primary,
|
32
38
|
background: "transparent",
|
@@ -39,6 +45,11 @@ const useTableStyles = (theme, appTheme) => ({
|
|
39
45
|
"& th, tr, td": {
|
40
46
|
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`
|
41
47
|
},
|
48
|
+
"& th, & td": {
|
49
|
+
overflowX: "clip",
|
50
|
+
textOverflow: "ellipsis",
|
51
|
+
whiteSpace: "nowrap"
|
52
|
+
},
|
42
53
|
"& .tv-act-btn": {
|
43
54
|
color: appTheme?.palette?.editor?.tv_text,
|
44
55
|
textTransform: "none",
|
@@ -85,13 +96,18 @@ const useTableStyles = (theme, appTheme) => ({
|
|
85
96
|
paddingTop: "3px",
|
86
97
|
paddingBottom: "3px",
|
87
98
|
paddingLeft: "3px",
|
88
|
-
maxWidth: "250px",
|
99
|
+
// maxWidth: "250px",
|
89
100
|
overflow: "hidden",
|
90
101
|
position: "relative",
|
91
102
|
"& .tv-ms-tag-wrpr": {
|
92
103
|
display: "flex",
|
93
104
|
flexWrap: "nowrap",
|
94
|
-
overflow: "auto"
|
105
|
+
overflow: "auto",
|
106
|
+
minWidth: "58px",
|
107
|
+
"& .MuiChip-deleteIcon": {
|
108
|
+
minWidth: "22px",
|
109
|
+
minHeight: "22px"
|
110
|
+
}
|
95
111
|
},
|
96
112
|
"&.Mui-disabled": {
|
97
113
|
"& input": {
|
@@ -129,6 +145,20 @@ const useTableStyles = (theme, appTheme) => ({
|
|
129
145
|
opacity: 1
|
130
146
|
}
|
131
147
|
}
|
148
|
+
},
|
149
|
+
cellResizer: {
|
150
|
+
position: "absolute",
|
151
|
+
cursor: "col-resize",
|
152
|
+
right: "0px",
|
153
|
+
top: 0,
|
154
|
+
width: "3px",
|
155
|
+
borderRadius: "0px",
|
156
|
+
zIndex: 1,
|
157
|
+
background: "transparent",
|
158
|
+
height: "100%",
|
159
|
+
"&:hover, &.active": {
|
160
|
+
background: "#2563EB"
|
161
|
+
}
|
132
162
|
}
|
133
163
|
});
|
134
164
|
export default useTableStyles;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState } from "react";
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
2
|
import { Box, Button, useTheme } from "@mui/material";
|
3
3
|
import { useDataView } from "../Providers/DataViewProvider";
|
4
4
|
import PropertySettings from "./Options";
|
@@ -7,37 +7,127 @@ import useTableStyles from "./TableStyles";
|
|
7
7
|
import { GridSettingsIcon, GridAddSectionIcon } from "../../../common/iconslist";
|
8
8
|
import { useEditorContext } from "../../../hooks/useMouseMove";
|
9
9
|
import Icon from "../../../common/Icon";
|
10
|
+
import useTableResize from "../../../utils/customHooks/useTableResize";
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
const Resizer = ({
|
15
|
+
classes,
|
16
|
+
onMouseDown,
|
17
|
+
height,
|
18
|
+
resizing
|
19
|
+
}) => {
|
20
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
21
|
+
children: /*#__PURE__*/_jsx(Box, {
|
22
|
+
component: "div",
|
23
|
+
className: `cell-resizer ${resizing ? "active" : ""}`,
|
24
|
+
contentEditable: false,
|
25
|
+
onPointerDown: onMouseDown,
|
26
|
+
sx: classes.cellResizer,
|
27
|
+
style: {
|
28
|
+
height: `${height}px`
|
29
|
+
}
|
30
|
+
})
|
31
|
+
});
|
32
|
+
};
|
13
33
|
const SortIcon = props => {
|
14
34
|
const {
|
15
35
|
sortBy
|
16
36
|
} = props;
|
17
37
|
return sortBy ? sortBy === "asc" ? /*#__PURE__*/_jsx(Box, {
|
18
38
|
sx: {
|
19
|
-
|
20
|
-
|
39
|
+
"& svg": {
|
40
|
+
"& path": {
|
21
41
|
stroke: "rgba(37, 99, 235, 1) !important"
|
22
42
|
}
|
23
43
|
}
|
24
44
|
},
|
25
45
|
children: /*#__PURE__*/_jsx(Icon, {
|
26
|
-
icon:
|
46
|
+
icon: "chervUp"
|
27
47
|
})
|
28
48
|
}) : /*#__PURE__*/_jsx(Box, {
|
29
49
|
sx: {
|
30
|
-
|
31
|
-
|
50
|
+
"& svg": {
|
51
|
+
"& path": {
|
32
52
|
stroke: "rgba(37, 99, 235, 1) !important"
|
33
53
|
}
|
34
54
|
}
|
35
55
|
},
|
36
56
|
children: /*#__PURE__*/_jsx(Icon, {
|
37
|
-
icon:
|
57
|
+
icon: "chervDown"
|
38
58
|
})
|
39
59
|
}) : null;
|
40
60
|
};
|
61
|
+
const THead = props => {
|
62
|
+
const thRef = useRef(null);
|
63
|
+
const [headerTextWidth, setHeaderTextWidth] = useState(200);
|
64
|
+
const {
|
65
|
+
iconType,
|
66
|
+
isSort,
|
67
|
+
classes,
|
68
|
+
onEditProperty,
|
69
|
+
m,
|
70
|
+
tableRef,
|
71
|
+
handleResize
|
72
|
+
} = props;
|
73
|
+
// do not remove extra coma it will lead to swap of variable
|
74
|
+
const [size, onMouseDown, resizing,, isDone] = useTableResize({
|
75
|
+
parentDOM: thRef?.current,
|
76
|
+
size: m?.size,
|
77
|
+
minMaxProps: {
|
78
|
+
minWidth: 30
|
79
|
+
}
|
80
|
+
});
|
81
|
+
const finalWidth = size?.width < headerTextWidth ? headerTextWidth : size?.width || 200;
|
82
|
+
useEffect(() => {
|
83
|
+
if (thRef?.current) {
|
84
|
+
const tw = (thRef?.current?.querySelectorAll(".dht-text")[0]?.getBoundingClientRect()?.width || 0) + 16 + 30;
|
85
|
+
setHeaderTextWidth(tw);
|
86
|
+
}
|
87
|
+
}, [thRef?.current, m?.label]);
|
88
|
+
useEffect(() => {
|
89
|
+
if (isDone) {
|
90
|
+
handleResize({
|
91
|
+
...m,
|
92
|
+
size: size
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}, [isDone]);
|
96
|
+
return /*#__PURE__*/_jsxs("th", {
|
97
|
+
style: {
|
98
|
+
minWidth: finalWidth,
|
99
|
+
maxWidth: finalWidth,
|
100
|
+
width: finalWidth
|
101
|
+
},
|
102
|
+
ref: thRef,
|
103
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
104
|
+
sx: {
|
105
|
+
maxWidth: "100%",
|
106
|
+
overflow: "hidden"
|
107
|
+
},
|
108
|
+
children: /*#__PURE__*/_jsx(Button, {
|
109
|
+
className: "tv-act-btn la",
|
110
|
+
startIcon: /*#__PURE__*/_jsx(Icon, {
|
111
|
+
icon: iconType
|
112
|
+
}),
|
113
|
+
endIcon: /*#__PURE__*/_jsx(SortIcon, {
|
114
|
+
sortBy: isSort
|
115
|
+
}),
|
116
|
+
fullWidth: true,
|
117
|
+
onClick: onEditProperty(m),
|
118
|
+
children: /*#__PURE__*/_jsx("span", {
|
119
|
+
className: "dht-text",
|
120
|
+
children: m.label
|
121
|
+
})
|
122
|
+
})
|
123
|
+
}), /*#__PURE__*/_jsx(Resizer, {
|
124
|
+
classes: classes,
|
125
|
+
onMouseDown: onMouseDown,
|
126
|
+
height: tableRef?.current?.getBoundingClientRect()?.height,
|
127
|
+
resizing: resizing
|
128
|
+
})]
|
129
|
+
});
|
130
|
+
};
|
41
131
|
const TableView = props => {
|
42
132
|
const {
|
43
133
|
theme: appTheme
|
@@ -48,6 +138,7 @@ const TableView = props => {
|
|
48
138
|
} = props;
|
49
139
|
const theme = useTheme();
|
50
140
|
const classes = useTableStyles(theme, appTheme);
|
141
|
+
const tableRef = useRef(null);
|
51
142
|
const {
|
52
143
|
properties,
|
53
144
|
onAddProperty,
|
@@ -164,6 +255,9 @@ const TableView = props => {
|
|
164
255
|
setMode({});
|
165
256
|
setAnchorEl(null);
|
166
257
|
};
|
258
|
+
const handleResize = data => {
|
259
|
+
onUpdateProperty(data);
|
260
|
+
};
|
167
261
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
168
262
|
children: [/*#__PURE__*/_jsx(Box, {
|
169
263
|
component: "div",
|
@@ -173,6 +267,7 @@ const TableView = props => {
|
|
173
267
|
children: /*#__PURE__*/_jsxs(Box, {
|
174
268
|
component: "table",
|
175
269
|
sx: classes.table,
|
270
|
+
ref: tableRef,
|
176
271
|
children: [/*#__PURE__*/_jsx("thead", {
|
177
272
|
children: /*#__PURE__*/_jsxs("tr", {
|
178
273
|
children: [shownProperties?.map((m, i) => {
|
@@ -180,26 +275,23 @@ const TableView = props => {
|
|
180
275
|
Icon: iconType
|
181
276
|
} = PROPERTY_TYPES?.find(f => f.type === m.type) || {};
|
182
277
|
const isSort = sortBy?.key === m.key ? sortBy?.operator : null;
|
183
|
-
return /*#__PURE__*/_jsx(
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
}),
|
192
|
-
endIcon: /*#__PURE__*/_jsx(SortIcon, {
|
193
|
-
sortBy: isSort
|
194
|
-
}),
|
195
|
-
fullWidth: true,
|
196
|
-
onClick: onEditProperty(m),
|
197
|
-
children: m.label
|
198
|
-
})
|
278
|
+
return /*#__PURE__*/_jsx(THead, {
|
279
|
+
iconType: iconType,
|
280
|
+
isSort: isSort,
|
281
|
+
onEditProperty: onEditProperty,
|
282
|
+
m: m,
|
283
|
+
classes: classes,
|
284
|
+
tableRef: tableRef,
|
285
|
+
handleResize: handleResize
|
199
286
|
}, i);
|
200
287
|
}), !readOnly ? /*#__PURE__*/_jsxs(_Fragment, {
|
201
288
|
children: [/*#__PURE__*/_jsx("th", {
|
202
289
|
className: "tv-act-btn ico",
|
290
|
+
style: {
|
291
|
+
maxWidth: "80px",
|
292
|
+
minWidth: "80px",
|
293
|
+
width: "auto"
|
294
|
+
},
|
203
295
|
children: /*#__PURE__*/_jsx(Button, {
|
204
296
|
onClick: onAddClick,
|
205
297
|
fullWidth: true,
|
@@ -207,6 +299,11 @@ const TableView = props => {
|
|
207
299
|
})
|
208
300
|
}), /*#__PURE__*/_jsx("th", {
|
209
301
|
className: "tv-act-btn ico",
|
302
|
+
style: {
|
303
|
+
maxWidth: "80px",
|
304
|
+
minWidth: "80px",
|
305
|
+
width: "auto"
|
306
|
+
},
|
210
307
|
children: /*#__PURE__*/_jsx(Button, {
|
211
308
|
onClick: onSettings,
|
212
309
|
fullWidth: true,
|
@@ -226,18 +323,18 @@ const TableView = props => {
|
|
226
323
|
textTransform: "none",
|
227
324
|
justifyContent: "start",
|
228
325
|
color: appTheme?.palette?.editor?.activeColor,
|
229
|
-
|
230
|
-
width:
|
231
|
-
height:
|
326
|
+
"& svg": {
|
327
|
+
width: "18px",
|
328
|
+
height: "18px",
|
232
329
|
strokeWidth: 1.2,
|
233
|
-
|
330
|
+
"& path": {
|
234
331
|
stroke: appTheme?.palette?.editor?.activeColor
|
235
332
|
}
|
236
333
|
},
|
237
|
-
fontFamily:
|
334
|
+
fontFamily: "inter"
|
238
335
|
},
|
239
336
|
startIcon: /*#__PURE__*/_jsx(Icon, {
|
240
|
-
icon:
|
337
|
+
icon: "addRounded"
|
241
338
|
}),
|
242
339
|
children: "Add new row"
|
243
340
|
}) : null, open && !readOnly ? /*#__PURE__*/_jsx(PropertySettings, {
|
@@ -58,17 +58,17 @@ const ViewData = props => {
|
|
58
58
|
}
|
59
59
|
},
|
60
60
|
children: [rows?.map((row, i) => {
|
61
|
-
return /*#__PURE__*/
|
61
|
+
return /*#__PURE__*/_jsxs(Box, {
|
62
62
|
component: "tr",
|
63
63
|
className: "tv-act-row",
|
64
|
-
children: /*#__PURE__*/_jsx(RenderRow, {
|
64
|
+
children: [/*#__PURE__*/_jsx(RenderRow, {
|
65
65
|
rowIndex: row?.id,
|
66
66
|
row: row,
|
67
67
|
properties: properties,
|
68
68
|
onSelect: onSelect,
|
69
69
|
selected: selectedRows?.includes(row?.id),
|
70
70
|
readOnly: readOnly
|
71
|
-
})
|
71
|
+
}), /*#__PURE__*/_jsx("td", {}), /*#__PURE__*/_jsx("td", {})]
|
72
72
|
}, i);
|
73
73
|
}), /*#__PURE__*/_jsx("tr", {
|
74
74
|
style: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { createContext, useContext, useEffect, useState } from "react";
|
2
|
-
import {
|
2
|
+
import { Transforms, Node } from "slate";
|
3
3
|
import { PROPERTY_DEFAULTS } from "../Layouts/Options/Constants";
|
4
4
|
import multiSortRows from "../Utils/multiSortRows";
|
5
5
|
import globalSearch from "../Utils/globalSearch";
|