@flozy/editor 5.0.7 → 5.0.8

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.
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import TextField from "@mui/material/TextField";
3
3
  import Autocomplete from "@mui/material/Autocomplete";
4
- import { Box, Chip } from "@mui/material";
4
+ import { Box, Chip, useTheme } from "@mui/material";
5
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
6
+ import useCompStyles from "./styles";
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
8
  const filter = (opt, params, selectedOpt) => {
7
9
  const selectedVals = selectedOpt?.map(m => m?.value);
@@ -12,6 +14,11 @@ const filter = (opt, params, selectedOpt) => {
12
14
  return fv;
13
15
  };
14
16
  export default function Select(props) {
17
+ const theme = useTheme();
18
+ const {
19
+ theme: appTheme
20
+ } = useEditorContext();
21
+ const classes = useCompStyles(theme, appTheme);
15
22
  const {
16
23
  value,
17
24
  onChange,
@@ -123,6 +130,11 @@ export default function Select(props) {
123
130
  ...params,
124
131
  placeholder: placeholder
125
132
  });
133
+ },
134
+ slotProps: {
135
+ paper: {
136
+ sx: classes.autocomplete
137
+ }
126
138
  }
127
139
  });
128
140
  }
@@ -1,22 +1,37 @@
1
1
  import React from "react";
2
- import { MenuItem, Select } from "@mui/material";
2
+ import { MenuItem, Select, useTheme } from "@mui/material";
3
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
4
+ import useCompStyles from "./styles";
3
5
  import { jsx as _jsx } from "react/jsx-runtime";
4
6
  const SimpleSelect = props => {
7
+ const theme = useTheme();
8
+ const {
9
+ theme: appTheme
10
+ } = useEditorContext();
11
+ const classes = useCompStyles(theme, appTheme);
5
12
  const {
6
13
  value,
7
14
  options,
8
15
  handleChange,
9
16
  disabled = false
10
17
  } = props;
18
+ console.log(classes);
11
19
  return /*#__PURE__*/_jsx(Select, {
12
20
  disabled: disabled,
13
21
  value: value,
14
22
  onChange: handleChange,
15
23
  fullWidth: true,
16
24
  size: "small",
25
+ MenuProps: {
26
+ PaperProps: {
27
+ sx: classes.simpleselect,
28
+ className: "tv-cf-opt-wrpr"
29
+ }
30
+ },
17
31
  children: options?.map((m, i) => {
18
32
  return /*#__PURE__*/_jsx(MenuItem, {
19
33
  value: m.key,
34
+ className: "tv-cf-opt-wrpr",
20
35
  children: m.label
21
36
  }, i);
22
37
  })
@@ -0,0 +1,59 @@
1
+ const useCompStyles = (theme, appTheme) => ({
2
+ simpleselect: {
3
+ border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
4
+ background: appTheme?.palette?.editor?.tv_pop_bg,
5
+ color: appTheme?.palette?.editor?.tv_text_primary,
6
+ borderRadius: "8px",
7
+ [theme.breakpoints.between("xs", "md")]: {},
8
+ "& ul": {
9
+ padding: "4px",
10
+ "& li": {
11
+ padding: "4px 6px",
12
+ borderRadius: "8px",
13
+ color: appTheme?.palette?.editor?.tv_text_primary,
14
+ fontSize: "14px",
15
+ marginTop: "4px",
16
+ "&.Mui-selected": {
17
+ background: appTheme?.palette?.editor?.tv_hover_bg,
18
+ color: appTheme?.palette?.editor?.tv_hover_text,
19
+ "&:hover": {
20
+ background: appTheme?.palette?.editor?.tv_hover_bg,
21
+ color: appTheme?.palette?.editor?.tv_hover_text
22
+ }
23
+ },
24
+ "&:hover": {
25
+ background: appTheme?.palette?.editor?.tv_hover_bg,
26
+ color: appTheme?.palette?.editor?.tv_hover_text
27
+ }
28
+ }
29
+ }
30
+ },
31
+ autocomplete: {
32
+ border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
33
+ background: appTheme?.palette?.editor?.tv_pop_bg,
34
+ color: appTheme?.palette?.editor?.tv_text_primary,
35
+ borderRadius: "8px",
36
+ "& ul": {
37
+ padding: "4px",
38
+ "& .MuiAutocomplete-option": {
39
+ padding: "4px 6px",
40
+ borderRadius: "8px",
41
+ color: appTheme?.palette?.editor?.tv_text_primary,
42
+ fontSize: "14px",
43
+ "&.Mui-selected": {
44
+ background: appTheme?.palette?.editor?.tv_hover_bg,
45
+ color: appTheme?.palette?.editor?.tv_hover_text,
46
+ "&:hover": {
47
+ background: appTheme?.palette?.editor?.tv_hover_bg,
48
+ color: appTheme?.palette?.editor?.tv_hover_text
49
+ }
50
+ },
51
+ "&:hover": {
52
+ background: appTheme?.palette?.editor?.tv_hover_bg,
53
+ color: appTheme?.palette?.editor?.tv_hover_text
54
+ }
55
+ }
56
+ }
57
+ }
58
+ });
59
+ export default useCompStyles;
@@ -18,6 +18,7 @@ const ChooseField = props => {
18
18
  width: "120px",
19
19
  mr: 1
20
20
  },
21
+ className: "tv-cf",
21
22
  children: /*#__PURE__*/_jsx(SimpleSelect, {
22
23
  value: sort?.key,
23
24
  options: properties,
@@ -27,6 +27,7 @@ const ChooseSort = props => {
27
27
  sx: {
28
28
  width: "120px"
29
29
  },
30
+ className: "tv-cf",
30
31
  children: /*#__PURE__*/_jsx(SimpleSelect, {
31
32
  value: sort?.operator,
32
33
  options: SORT_OPTIONS,
@@ -3,9 +3,13 @@ import { Box, Popover, SwipeableDrawer, IconButton, useTheme } from "@mui/materi
3
3
  import CloseIcon from "@mui/icons-material/Close";
4
4
  import useFilterSortStyles from "./styles";
5
5
  import SortOptions from "./SortOptions";
6
+ import { useEditorContext } from "../../../../hooks/useMouseMove";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  const FilterSort = props => {
10
+ const {
11
+ theme: appTheme
12
+ } = useEditorContext();
9
13
  const theme = useTheme();
10
14
  const {
11
15
  open,
@@ -13,7 +17,7 @@ const FilterSort = props => {
13
17
  anchorEl,
14
18
  onClose
15
19
  } = props;
16
- const classes = useFilterSortStyles(theme);
20
+ const classes = useFilterSortStyles(theme, appTheme);
17
21
  const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
18
22
  const PoperComponent = isMobile ? SwipeableDrawer : Popover;
19
23
  const renderMode = () => {
@@ -48,6 +52,7 @@ const FilterSort = props => {
48
52
  children: [/*#__PURE__*/_jsx("span", {
49
53
  children: "Sort By"
50
54
  }), /*#__PURE__*/_jsx(IconButton, {
55
+ className: "tv-act-ico bg",
51
56
  size: "small",
52
57
  onClick: onClose,
53
58
  children: /*#__PURE__*/_jsx(CloseIcon, {})
@@ -1,41 +1,81 @@
1
- const useFilterSortStyles = theme => ({
1
+ const useFilterSortStyles = (theme, appTheme) => ({
2
2
  root: {
3
3
  "& .MuiPaper-root": {
4
4
  boxShadow: "0px 4px 10px 0px rgba(0, 0, 0, 0.16)",
5
- border: "1px solid rgba(228, 232, 235, 1)",
5
+ border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
6
+ background: appTheme?.palette?.editor?.tv_pop_bg,
7
+ color: appTheme?.palette?.editor?.tv_text_primary,
6
8
  borderRadius: "12px",
7
9
  [theme.breakpoints.between("xs", "md")]: {
8
10
  borderRadius: "16px 16px 0px 0px",
9
11
  maxHeight: "50%"
10
12
  },
13
+ "& .MuiSelect-select": {
14
+ padding: "4px 8px"
15
+ },
16
+ "& .ml": {
17
+ marginLeft: "8px"
18
+ },
19
+ "& .tv-act-ico": {
20
+ color: appTheme?.palette?.editor?.tv_text,
21
+ "&.br1": {
22
+ borderRadius: "6px"
23
+ },
24
+ "&.bg": {
25
+ background: appTheme?.palette?.editor?.tv_ico_bg,
26
+ "&:hover": {
27
+ background: "rgba(100, 116, 139, 0.12)"
28
+ }
29
+ },
30
+ "& svg": {
31
+ width: "16px",
32
+ height: "16px"
33
+ }
34
+ },
11
35
  "& .MuiList-root": {
12
36
  padding: "4px 2px",
13
- "& .MuiListItem-root": {
14
- padding: "8px"
15
- },
16
37
  "& .MuiListItemButton-root": {
17
- color: "rgba(15, 23, 42, 1)",
38
+ color: appTheme?.palette?.editor?.tv_text_primary,
18
39
  padding: "2px 4px",
40
+ borderRadius: "8px",
19
41
  "& .MuiListItemIcon-root": {
20
- minWidth: "38px"
42
+ minWidth: "38px",
43
+ "&.needBg": {
44
+ minWidth: "20px",
45
+ width: "20px",
46
+ height: "20px",
47
+ alignItems: "center",
48
+ justifyContent: "center",
49
+ borderRadius: "4px",
50
+ marginRight: "12px",
51
+ background: appTheme?.palette?.editor?.tv_ico_bg
52
+ },
53
+ color: appTheme?.palette?.editor?.tv_text_primary,
54
+ "& svg": {
55
+ width: "16px"
56
+ }
21
57
  },
22
58
  "& .MuiTypography-root": {
23
59
  fontSize: "14px"
60
+ },
61
+ "&:hover": {
62
+ background: appTheme?.palette?.editor?.tv_hover_bg,
63
+ color: appTheme?.palette?.editor?.tv_hover_text,
64
+ "& .MuiListItemIcon-root": {
65
+ color: appTheme?.palette?.editor?.tv_hover_text
66
+ }
24
67
  }
25
- },
26
- "& .MuiButtonBase-root": {
27
- padding: "4px",
68
+ }
69
+ },
70
+ "& .tv-cf": {
71
+ "& .MuiInputBase-root": {
72
+ color: appTheme?.palette?.editor?.tv_text_primary,
73
+ background: appTheme?.palette?.editor?.tv_ico_bg,
74
+ borderRadius: "8px",
28
75
  "& svg": {
29
- // width: "16px",
30
- // height: "16px",
76
+ color: appTheme?.palette?.editor?.tv_text_primary
31
77
  }
32
78
  }
33
- },
34
- "& .MuiSelect-select": {
35
- padding: "4px 8px"
36
- },
37
- "& .ml": {
38
- marginLeft: "8px"
39
79
  }
40
80
  }
41
81
  },
@@ -54,7 +94,7 @@ const useFilterSortStyles = theme => ({
54
94
  justifyContent: "space-between",
55
95
  fontSize: "14px",
56
96
  alignItems: "center",
57
- borderBottom: "1px solid rgba(220, 228, 236, 1)",
97
+ borderBottom: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
58
98
  marginBottom: "0px",
59
99
  "& span": {
60
100
  display: "flex",
@@ -101,11 +101,13 @@ const EditOption = props => {
101
101
  className: "fe-dv-ap-title",
102
102
  children: [/*#__PURE__*/_jsxs("span", {
103
103
  children: [/*#__PURE__*/_jsx(IconButton, {
104
+ className: "tv-act-ico",
104
105
  size: "small",
105
106
  onClick: onBack,
106
107
  children: /*#__PURE__*/_jsx(ArrowBackIcon, {})
107
108
  }), "Edit Option"]
108
109
  }), /*#__PURE__*/_jsx(IconButton, {
110
+ className: "tv-act-ico bg",
109
111
  size: "small",
110
112
  onClick: onClose,
111
113
  children: /*#__PURE__*/_jsx(CloseIcon, {})
@@ -122,6 +122,9 @@ const useOptionsStyles = (theme, appTheme) => ({
122
122
  "& .MuiInputBase-input": {
123
123
  height: "32px",
124
124
  padding: "4px 8px"
125
+ },
126
+ "& .more-btn-cbs": {
127
+ color: appTheme?.palette?.editor?.tv_text_primary
125
128
  }
126
129
  }
127
130
  },
@@ -2,7 +2,8 @@ const useTableStyles = (theme, appTheme) => ({
2
2
  root: {
3
3
  border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
4
4
  borderRadius: "7px 7px 0px 0px",
5
- overflowX: "auto"
5
+ overflowX: "auto",
6
+ [theme.breakpoints.between("xs", "md")]: {}
6
7
  },
7
8
  table: {
8
9
  borderCollapse: "separate",
@@ -80,6 +81,11 @@ const useTableStyles = (theme, appTheme) => ({
80
81
  }
81
82
  }
82
83
  }
84
+ },
85
+ "& .MuiAutocomplete-clearIndicator": {
86
+ "& svg": {
87
+ color: appTheme?.palette?.editor?.tv_text
88
+ }
83
89
  }
84
90
  }
85
91
  },
@@ -2,6 +2,7 @@ import React, { useState } from "react";
2
2
  import { Box, Button, useTheme } from "@mui/material";
3
3
  import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
4
4
  import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
5
+ import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
5
6
  import { useDataView } from "../Providers/DataViewProvider";
6
7
  import PropertySettings from "./Options";
7
8
  import { PROPERTY_TYPES } from "./Options/Constants";
@@ -40,7 +41,8 @@ const TableView = props => {
40
41
  onAddProperty,
41
42
  onUpdateProperty,
42
43
  onUpdateSort,
43
- sort
44
+ sort,
45
+ onAddRow
44
46
  } = useDataView();
45
47
  const [sortBy] = sort || [];
46
48
  const [anchorEl, setAnchorEl] = useState(null);
@@ -201,7 +203,18 @@ const TableView = props => {
201
203
  })
202
204
  }), children]
203
205
  })
204
- }), open && !readOnly ? /*#__PURE__*/_jsx(PropertySettings, {
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, {
205
218
  open: open,
206
219
  anchorEl: anchorEl,
207
220
  mode: mode,
@@ -5,7 +5,6 @@ import { useDataView } from "../Providers/DataViewProvider";
5
5
  import ColumnView from "./ColumnView";
6
6
  // import Formula from "./Formula";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
8
  const RenderRow = props => {
10
9
  const {
11
10
  rowIndex,
@@ -39,7 +38,6 @@ const ViewData = props => {
39
38
  const {
40
39
  properties,
41
40
  rows,
42
- onAddRow,
43
41
  selectedRows,
44
42
  setSelectedRows
45
43
  } = useDataView();
@@ -50,10 +48,10 @@ const ViewData = props => {
50
48
  setSelectedRows([...selectedRows?.filter(f => f !== id)]);
51
49
  }
52
50
  };
53
- return /*#__PURE__*/_jsxs(Box, {
51
+ return /*#__PURE__*/_jsx(Box, {
54
52
  component: "tbody",
55
53
  ...attributes,
56
- children: [rows?.map((row, i) => {
54
+ children: rows?.map((row, i) => {
57
55
  return /*#__PURE__*/_jsx(Box, {
58
56
  component: "tr",
59
57
  className: "tv-act-row",
@@ -66,18 +64,7 @@ const ViewData = props => {
66
64
  readOnly: readOnly
67
65
  })
68
66
  }, i);
69
- }), !readOnly ? /*#__PURE__*/_jsx("tr", {
70
- children: /*#__PURE__*/_jsx("td", {
71
- colSpan: properties?.length + 2,
72
- children: /*#__PURE__*/_jsx(Button, {
73
- className: "tv-act-btn la",
74
- fullWidth: true,
75
- onClick: onAddRow,
76
- startIcon: /*#__PURE__*/_jsx(AddCircleOutlineIcon, {}),
77
- children: "Add new row"
78
- })
79
- })
80
- }) : null]
67
+ })
81
68
  });
82
69
  };
83
70
  export default ViewData;
@@ -44,6 +44,16 @@ const useDataViewStyles = (theme, appTheme) => ({
44
44
  opacity: 0,
45
45
  "&.active": {
46
46
  opacity: 1
47
+ },
48
+ "& .tv-ck-box": {
49
+ "& svg": {
50
+ color: appTheme?.palette?.editor?.tv_border
51
+ },
52
+ "&.Mui-checked": {
53
+ "& svg": {
54
+ color: "rgba(37, 99, 235, 1)"
55
+ }
56
+ }
47
57
  }
48
58
  },
49
59
  "&:hover": {
@@ -275,7 +275,8 @@ const GridItem = props => {
275
275
  ...attributes,
276
276
  style: {
277
277
  textAlign: element.alignment || "left",
278
- "--minWidth": minWidthInPercent
278
+ "--minWidth": lastChild ? "auto" : minWidthInPercent,
279
+ flexGrow: lastChild ? 1 : "auto"
279
280
  },
280
281
  sx: {
281
282
  ...getBRProps,
@@ -24,16 +24,6 @@ const getAdjacentColumnPath = (editor, currentPath, direction = "next") => {
24
24
  }; // Return the adjacent column's path
25
25
  };
26
26
 
27
- const isSingleColumn = (editor, currentPath) => {
28
- try {
29
- const parentPath = Path.parent(currentPath); // Get the parent grid path
30
- const gridNode = Node.get(editor, parentPath);
31
- return gridNode?.children?.length === 1;
32
- } catch (err) {
33
- console.log(err);
34
- return false;
35
- }
36
- };
37
27
  export const getChildCount = (editor, currentPath) => {
38
28
  try {
39
29
  const parentPath = Path.parent(currentPath); // Get the parent grid path
@@ -57,20 +47,23 @@ export const GridProvider = ({
57
47
  parentPath,
58
48
  rightColPath
59
49
  } = getAdjacentColumnPath(editor, currentColPath);
50
+ let isRightLast = false;
60
51
  if (rightColPath) {
61
52
  const parentPath = Path.parent(rightColPath); // Get the parent grid path
62
53
  const gridNode = Node.get(editor, parentPath);
63
54
  const gridNodeDom = ReactEditor.toDOMNode(editor, gridNode);
64
55
  const rightColNode = Node.get(editor, rightColPath);
65
56
  const rightColDom = ReactEditor.toDOMNode(editor, rightColNode);
66
- right = rightColNode?.minWidth || rightColDom?.offsetWidth / gridNodeDom?.offsetWidth * 100;
57
+ right = rightColDom?.offsetWidth / gridNodeDom?.offsetWidth * 100;
58
+ isRightLast = [...rightColPath].pop() === gridNode?.children?.length - 1;
67
59
  }
68
60
  setColumnWidths({
69
61
  left: currentMinWidth,
70
62
  right,
71
63
  rightPath: rightColPath?.join(),
72
64
  rightIndex: rightColPath,
73
- parentPath: parentPath
65
+ parentPath: parentPath,
66
+ isRightLast: isRightLast
74
67
  });
75
68
  } catch (err) {
76
69
  console.log(err);
@@ -85,12 +78,7 @@ export const GridProvider = ({
85
78
  // logic to update right column width
86
79
  const right = columnWidths?.right - (data?.left - columnWidths?.left);
87
80
  const diff = right !== widths?.right;
88
- if (isSingleColumn(editor, currentColPath) && data?.left <= 100) {
89
- setWidths({
90
- ...data,
91
- right: right
92
- });
93
- } else if (right && right > 10 && data?.left > 10 && diff) {
81
+ if (right && right > 10 && data?.left > 10 && diff) {
94
82
  setWidths({
95
83
  ...data,
96
84
  right: right
@@ -77,16 +77,16 @@ const SearchAndDocList = ({
77
77
  children: /*#__PURE__*/_jsx(SearchIcon, {})
78
78
  }),
79
79
  sx: {
80
- color: theme?.palette?.text?.textColor,
80
+ color: theme?.palette?.editor?.textColor,
81
81
  fontSize: '14px'
82
82
  }
83
83
  },
84
84
  sx: {
85
85
  borderRadius: "8px",
86
86
  fontSize: '14px',
87
- color: theme?.palette?.text?.textColor,
87
+ color: theme?.palette?.editor?.textColor,
88
88
  "& .MuiOutlinedInput-root": {
89
- color: `${theme?.palette?.text?.textColor} !important`,
89
+ color: `${theme?.palette?.editor?.textColor} !important`,
90
90
  boxShadow: theme?.palette?.shadows?.shadow12,
91
91
  backgroundColor: theme?.palette?.editor?.inputFieldBgColor,
92
92
  fontSize: '14px',
@@ -96,21 +96,21 @@ const SearchAndDocList = ({
96
96
  borderColor: theme?.palette?.primary?.slashBrainBorder
97
97
  },
98
98
  "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
99
- color: theme?.palette?.text?.textColor,
99
+ color: theme?.palette?.editor?.textColor,
100
100
  borderRadius: "8px",
101
101
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
102
102
  borderColor: `${theme?.palette?.primary?.slashBrainBorder} !important`
103
103
  }
104
104
  },
105
105
  '& .MuiOutlinedInput-notchedOutline': {
106
- color: theme?.palette?.text?.textColor,
106
+ color: theme?.palette?.editor?.textColor,
107
107
  borderRadius: "8px",
108
108
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
109
109
  borderColor: theme?.palette?.primary?.slashBrainBorder,
110
110
  fontSize: '14px'
111
111
  },
112
112
  '& .MuiInputBase-root': {
113
- color: theme?.palette?.text?.textColor,
113
+ color: theme?.palette?.editor?.textColor,
114
114
  borderRadius: '8px',
115
115
  fontSize: '14px'
116
116
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"