@flozy/editor 5.3.0 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/dist/Editor/ChatEditor.js +25 -34
  2. package/dist/Editor/CommonEditor.js +20 -12
  3. package/dist/Editor/Editor.css +14 -16
  4. package/dist/Editor/Elements/AI/AIInput.js +0 -3
  5. package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
  6. package/dist/Editor/Elements/Button/EditorButton.js +8 -2
  7. package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
  8. package/dist/Editor/Elements/DataView/DataView.js +124 -0
  9. package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
  10. package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
  11. package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -0
  12. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +162 -0
  13. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/SimpleSelect.js +40 -0
  14. package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +67 -0
  15. package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +35 -0
  16. package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +39 -0
  17. package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +30 -0
  18. package/dist/Editor/Elements/DataView/Layouts/DataTypes/PersonType.js +30 -0
  19. package/dist/Editor/Elements/DataView/Layouts/DataTypes/SelectType.js +35 -0
  20. package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +36 -0
  21. package/dist/Editor/Elements/DataView/Layouts/DataTypes/index.js +17 -0
  22. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseField.js +29 -0
  23. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +38 -0
  24. package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +74 -0
  25. package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +64 -0
  26. package/dist/Editor/Elements/DataView/Layouts/FilterSort/styles.js +106 -0
  27. package/dist/Editor/Elements/DataView/Layouts/FilterView.js +174 -0
  28. package/dist/Editor/Elements/DataView/Layouts/Formula.js +29 -0
  29. package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +113 -0
  30. package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +37 -0
  31. package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +111 -0
  32. package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +60 -0
  33. package/dist/Editor/Elements/DataView/Layouts/Options/ColumnsList.js +36 -0
  34. package/dist/Editor/Elements/DataView/Layouts/Options/Constants.js +101 -0
  35. package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +160 -0
  36. package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +190 -0
  37. package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +42 -0
  38. package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +30 -0
  39. package/dist/Editor/Elements/DataView/Layouts/Options/index.js +110 -0
  40. package/dist/Editor/Elements/DataView/Layouts/Options/styles.js +179 -0
  41. package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +112 -0
  42. package/dist/Editor/Elements/DataView/Layouts/TableView.js +227 -0
  43. package/dist/Editor/Elements/DataView/Layouts/ViewData.js +80 -0
  44. package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
  45. package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
  46. package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
  47. package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
  48. package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
  49. package/dist/Editor/Elements/DataView/styles.js +154 -0
  50. package/dist/Editor/Elements/Form/Form.js +1 -0
  51. package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
  52. package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
  53. package/dist/Editor/Elements/List/CheckList.js +2 -1
  54. package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
  55. package/dist/Editor/Elements/SimpleText/index.js +8 -1
  56. package/dist/Editor/Elements/SimpleText/style.js +10 -1
  57. package/dist/Editor/Elements/Table/Table.js +1 -1
  58. package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
  59. package/dist/Editor/Styles/EditorStyles.js +5 -0
  60. package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +10 -0
  61. package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
  62. package/dist/Editor/Toolbar/Toolbar.js +6 -0
  63. package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
  64. package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
  65. package/dist/Editor/common/Icon.js +6 -0
  66. package/dist/Editor/common/MentionsPopup/Styles.js +2 -5
  67. package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
  68. package/dist/Editor/common/RnD/GuideLines/styles.js +3 -3
  69. package/dist/Editor/common/RnD/ShadowElement.js +1 -1
  70. package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +14 -2
  71. package/dist/Editor/common/RnD/Utils/gridDropItem.js +9 -6
  72. package/dist/Editor/common/RnD/index.js +1 -1
  73. package/dist/Editor/common/Shorthands/elements.js +13 -1
  74. package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +5 -0
  75. package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
  76. package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
  77. package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
  78. package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
  79. package/dist/Editor/common/Uploader.js +8 -0
  80. package/dist/Editor/common/iconListV2.js +53 -53
  81. package/dist/Editor/common/iconslist.js +6 -3
  82. package/dist/Editor/commonStyle.js +9 -0
  83. package/dist/Editor/helper/enforceDateFormat.js +41 -0
  84. package/dist/Editor/helper/index.js +2 -2
  85. package/dist/Editor/helper/theme.js +24 -1
  86. package/dist/Editor/hooks/useMouseMove.js +5 -2
  87. package/dist/Editor/plugins/withEmbeds.js +30 -26
  88. package/dist/Editor/plugins/withHTML.js +47 -12
  89. package/dist/Editor/plugins/withLayout.js +42 -0
  90. package/dist/Editor/utils/SlateUtilityFunctions.js +25 -2
  91. package/dist/Editor/utils/button.js +4 -4
  92. package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +26 -1
  93. package/dist/Editor/utils/dataView.js +43 -0
  94. package/dist/Editor/utils/events.js +0 -1
  95. package/dist/Editor/utils/helper.js +51 -1
  96. package/dist/Editor/utils/pageSettings.js +14 -2
  97. package/dist/Editor/utils/serializeToText.js +2 -0
  98. package/package.json +1 -1
@@ -0,0 +1,162 @@
1
+ import React from "react";
2
+ import TextField from "@mui/material/TextField";
3
+ import Autocomplete from "@mui/material/Autocomplete";
4
+ import { Avatar, Box, Chip, useTheme } from "@mui/material";
5
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
6
+ import useCompStyles from "./styles";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const AvatarIcon = props => {
9
+ const {
10
+ option,
11
+ avatar
12
+ } = props;
13
+ const nameIndex = option.label || option.value;
14
+ return avatar && nameIndex ? /*#__PURE__*/_jsx(Avatar, {
15
+ alt: option.label || option.value,
16
+ src: option.avatar || null,
17
+ children: nameIndex[0] || ""
18
+ }) : null;
19
+ };
20
+ const filter = (opt, params, selectedOpt) => {
21
+ const selectedVals = selectedOpt?.map(m => m?.value);
22
+ const fv = opt?.filter(f => !selectedVals.includes(f.value));
23
+ if (params?.inputValue) {
24
+ return fv.filter(f => f?.value?.toLowerCase().indexOf(params?.inputValue?.toLowerCase()) >= 0);
25
+ }
26
+ return fv;
27
+ };
28
+ export default function Select(props) {
29
+ const theme = useTheme();
30
+ const {
31
+ theme: appTheme
32
+ } = useEditorContext();
33
+ const classes = useCompStyles(theme, appTheme);
34
+ const {
35
+ value: pValue,
36
+ onChange,
37
+ options,
38
+ multiple = false,
39
+ limitTags = 2,
40
+ placeholder = "",
41
+ disabled = false,
42
+ optionAvatar = false
43
+ } = props;
44
+ const value = Array.isArray(pValue) ? pValue : [];
45
+ return /*#__PURE__*/_jsx(Autocomplete, {
46
+ disabled: disabled,
47
+ className: "tv-ac-field",
48
+ multiple: true,
49
+ limitTags: limitTags,
50
+ placeholder: placeholder,
51
+ value: value || "",
52
+ onChange: (event, newValue) => {
53
+ const fv = [];
54
+ newValue?.forEach(m => {
55
+ if (multiple) {
56
+ fv.push({
57
+ value: m.inputValue || m.value
58
+ });
59
+ } else {
60
+ fv[0] = {
61
+ value: m.inputValue || m.value
62
+ };
63
+ }
64
+ });
65
+ onChange(fv);
66
+ },
67
+ filterOptions: (options, params) => {
68
+ const filtered = filter(options, params, value);
69
+
70
+ // const { inputValue } = params;
71
+ // Suggest the creation of a new value
72
+ // const isExisting = options.some(
73
+ // (option) => inputValue?.toLowerCase() === option.value?.toLowerCase()
74
+ // );
75
+ // no need of new val now
76
+ // if (inputValue !== "" && !isExisting) {
77
+ // filtered.push({
78
+ // inputValue,
79
+ // value: `Add "${inputValue}"`,
80
+ // });
81
+ // }
82
+
83
+ return filtered;
84
+ },
85
+ selectOnFocus: true,
86
+ clearOnBlur: true,
87
+ handleHomeEndKeys: true,
88
+ options: options || [],
89
+ getOptionLabel: option => {
90
+ // Value selected with enter, right from the input
91
+ if (typeof option === "string") {
92
+ return option;
93
+ }
94
+ // Add "xxx" option created dynamically
95
+ if (option.inputValue) {
96
+ return option.inputValue;
97
+ }
98
+ // Regular option
99
+ return option.value || "";
100
+ },
101
+ renderTags: (value, getTagProps) => {
102
+ return /*#__PURE__*/_jsx(Box, {
103
+ className: "tv-ms-tag-wrpr",
104
+ children: value?.map((option, index) => {
105
+ const {
106
+ key,
107
+ ...tagProps
108
+ } = getTagProps({
109
+ index
110
+ }) || {};
111
+ return option?.value ? /*#__PURE__*/_jsx(Chip, {
112
+ variant: "outlined",
113
+ label: option?.label || option?.value,
114
+ ...tagProps,
115
+ sx: {
116
+ background: option?.color || "#CCC",
117
+ border: "none"
118
+ },
119
+ avatar: /*#__PURE__*/_jsx(AvatarIcon, {
120
+ option: option,
121
+ avatar: optionAvatar
122
+ })
123
+ }, key) : null;
124
+ })
125
+ });
126
+ },
127
+ renderOption: (props, option) => {
128
+ const {
129
+ key,
130
+ ...optionProps
131
+ } = props;
132
+ return /*#__PURE__*/_jsx("li", {
133
+ ...optionProps,
134
+ children: /*#__PURE__*/_jsx(Chip, {
135
+ label: option.label || option.value || "",
136
+ sx: {
137
+ background: option.color || "#CCC"
138
+ },
139
+ avatar: /*#__PURE__*/_jsx(AvatarIcon, {
140
+ option: option,
141
+ avatar: optionAvatar
142
+ })
143
+ })
144
+ }, key);
145
+ },
146
+ freeSolo: true,
147
+ size: "small",
148
+ fullWidth: true,
149
+ renderInput: params => {
150
+ return /*#__PURE__*/_jsx(TextField, {
151
+ size: "small",
152
+ ...params,
153
+ placeholder: placeholder
154
+ });
155
+ },
156
+ slotProps: {
157
+ paper: {
158
+ sx: classes.autocomplete
159
+ }
160
+ }
161
+ });
162
+ }
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { MenuItem, Select, useTheme } from "@mui/material";
3
+ import { useEditorContext } from "../../../../../hooks/useMouseMove";
4
+ import useCompStyles from "./styles";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const SimpleSelect = props => {
7
+ const theme = useTheme();
8
+ const {
9
+ theme: appTheme
10
+ } = useEditorContext();
11
+ const classes = useCompStyles(theme, appTheme);
12
+ const {
13
+ value,
14
+ options,
15
+ handleChange,
16
+ disabled = false
17
+ } = props;
18
+ console.log(classes);
19
+ return /*#__PURE__*/_jsx(Select, {
20
+ disabled: disabled,
21
+ value: value,
22
+ onChange: handleChange,
23
+ fullWidth: true,
24
+ size: "small",
25
+ MenuProps: {
26
+ PaperProps: {
27
+ sx: classes.simpleselect,
28
+ className: "tv-cf-opt-wrpr"
29
+ }
30
+ },
31
+ children: options?.map((m, i) => {
32
+ return /*#__PURE__*/_jsx(MenuItem, {
33
+ value: m.key,
34
+ className: "tv-cf-opt-wrpr",
35
+ children: m.label
36
+ }, i);
37
+ })
38
+ });
39
+ };
40
+ export default SimpleSelect;
@@ -0,0 +1,67 @@
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
+ "& .MuiAvatar-root": {
44
+ width: "20px",
45
+ height: "20px",
46
+ marginLeft: "8px",
47
+ fontSize: "16px",
48
+ padding: "2px",
49
+ textTransform: "capitalize"
50
+ },
51
+ "&.Mui-selected": {
52
+ background: appTheme?.palette?.editor?.tv_hover_bg,
53
+ color: appTheme?.palette?.editor?.tv_hover_text,
54
+ "&:hover": {
55
+ background: appTheme?.palette?.editor?.tv_hover_bg,
56
+ color: appTheme?.palette?.editor?.tv_hover_text
57
+ }
58
+ },
59
+ "&:hover": {
60
+ background: appTheme?.palette?.editor?.tv_hover_bg,
61
+ color: appTheme?.palette?.editor?.tv_hover_text
62
+ }
63
+ }
64
+ }
65
+ }
66
+ });
67
+ export default useCompStyles;
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import DatePicker from "react-datepicker";
3
+ import { useDataView } from "../../Providers/DataViewProvider";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ function isValidDate(dateString) {
6
+ const date = new Date(dateString);
7
+ return !isNaN(date.getTime());
8
+ }
9
+ const DateType = props => {
10
+ const {
11
+ rowIndex,
12
+ property,
13
+ value,
14
+ readOnly
15
+ } = props;
16
+ const {
17
+ onChange
18
+ } = useDataView();
19
+ const handleChange = date => {
20
+ onChange(rowIndex, {
21
+ [property]: date
22
+ });
23
+ };
24
+ return /*#__PURE__*/_jsx(DatePicker, {
25
+ disabled: readOnly,
26
+ selected: isValidDate(value) ? new Date(value) : "",
27
+ onChange: handleChange,
28
+ onKeyDown: e => {
29
+ e.preventDefault();
30
+ console.log(e?.target.value);
31
+ },
32
+ placeholderText: "MM/DD/YYYY"
33
+ });
34
+ };
35
+ export default DateType;
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { useDataView } from "../../Providers/DataViewProvider";
3
+ import Select from "./Components/Select";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const MultiSelectType = props => {
6
+ const {
7
+ rowIndex,
8
+ property,
9
+ value: pValue,
10
+ options,
11
+ label = "",
12
+ readOnly
13
+ } = props;
14
+ const {
15
+ onChange
16
+ } = useDataView();
17
+ const value = Array.isArray(pValue) ? pValue : [];
18
+ const coloredValues = [...(value || [])]?.map(m => {
19
+ return {
20
+ ...m,
21
+ color: options?.find(f => f.value === m.value)?.color || "#FFF"
22
+ };
23
+ });
24
+ const handleChange = data => {
25
+ onChange(rowIndex, {
26
+ [property]: data?.filter(f => f?.value)
27
+ });
28
+ };
29
+ return /*#__PURE__*/_jsx(Select, {
30
+ value: coloredValues,
31
+ onChange: handleChange,
32
+ options: options,
33
+ multiple: true,
34
+ limitTags: 2,
35
+ placeholder: label,
36
+ disabled: readOnly
37
+ });
38
+ };
39
+ export default MultiSelectType;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { TextField } from "@mui/material";
3
+ import { useDataView } from "../../Providers/DataViewProvider";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const NumberType = props => {
6
+ const {
7
+ rowIndex,
8
+ property,
9
+ value,
10
+ readOnly
11
+ } = props;
12
+ const {
13
+ onChange
14
+ } = useDataView();
15
+ const handleChange = e => {
16
+ onChange(rowIndex, {
17
+ [property]: e?.target?.value
18
+ });
19
+ };
20
+ return /*#__PURE__*/_jsx(TextField, {
21
+ type: "number",
22
+ fullWidth: true,
23
+ className: "fe-tv-type_text",
24
+ value: value,
25
+ size: "small",
26
+ onChange: handleChange,
27
+ disabled: readOnly
28
+ });
29
+ };
30
+ export default NumberType;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { useDataView } from "../../Providers/DataViewProvider";
3
+ import Select from "./Components/Select";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const PersonType = props => {
6
+ const {
7
+ rowIndex,
8
+ property,
9
+ value,
10
+ readOnly
11
+ } = props;
12
+ const {
13
+ onChange,
14
+ users
15
+ } = useDataView();
16
+ const handleChange = data => {
17
+ onChange(rowIndex, {
18
+ [property]: data?.filter(f => f?.value)
19
+ });
20
+ };
21
+ return /*#__PURE__*/_jsx(Select, {
22
+ value: value || [],
23
+ onChange: handleChange,
24
+ options: users || [],
25
+ multiple: false,
26
+ disabled: readOnly,
27
+ optionAvatar: true
28
+ });
29
+ };
30
+ export default PersonType;
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import { useDataView } from "../../Providers/DataViewProvider";
3
+ import Select from "./Components/Select";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const SelectType = props => {
6
+ const {
7
+ rowIndex,
8
+ property,
9
+ value,
10
+ options,
11
+ readOnly
12
+ } = props;
13
+ const {
14
+ onChange
15
+ } = useDataView();
16
+ const coloredValues = [...(value || [])]?.map(m => {
17
+ return {
18
+ ...m,
19
+ color: options?.find(f => f.value === m.value)?.color
20
+ };
21
+ });
22
+ const handleChange = data => {
23
+ onChange(rowIndex, {
24
+ [property]: data?.filter(f => f?.value)
25
+ });
26
+ };
27
+ return /*#__PURE__*/_jsx(Select, {
28
+ value: coloredValues,
29
+ onChange: handleChange,
30
+ options: options,
31
+ multiple: false,
32
+ disabled: readOnly
33
+ });
34
+ };
35
+ export default SelectType;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { TextField } from "@mui/material";
3
+ import { useDataView } from "../../Providers/DataViewProvider";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const TextType = props => {
6
+ const {
7
+ rowIndex,
8
+ property,
9
+ value,
10
+ readOnly
11
+ } = props;
12
+ const {
13
+ onChange
14
+ } = useDataView();
15
+ const handleChange = e => {
16
+ onChange(rowIndex, {
17
+ [property]: e?.target?.value
18
+ });
19
+ };
20
+ const formatValue = () => {
21
+ if (typeof value === "string") {
22
+ return value;
23
+ } else if (value[0]) {
24
+ return value?.map(m => m.value).join(", ");
25
+ }
26
+ };
27
+ return /*#__PURE__*/_jsx(TextField, {
28
+ fullWidth: true,
29
+ className: "fe-tv-type_text",
30
+ value: formatValue(value),
31
+ size: "small",
32
+ onChange: handleChange,
33
+ disabled: readOnly
34
+ });
35
+ };
36
+ export default TextType;
@@ -0,0 +1,17 @@
1
+ import TextType from "./TextType";
2
+ import DateType from "./DateType";
3
+ import SelectType from "./SelectType";
4
+ import MultiSelectType from "./MultiSelectType";
5
+ import NumberType from "./NumberType";
6
+ import CheckType from "./CheckType";
7
+ import PersonType from "./PersonType";
8
+ const DataTypes = {
9
+ text: TextType,
10
+ date: DateType,
11
+ select: SelectType,
12
+ "multi-select": MultiSelectType,
13
+ number: NumberType,
14
+ check: CheckType,
15
+ person: PersonType
16
+ };
17
+ export default DataTypes;
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import SimpleSelect from "../../DataTypes/Components/SimpleSelect";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const ChooseField = props => {
6
+ const {
7
+ sort,
8
+ properties,
9
+ onChange
10
+ } = props;
11
+ const handleChange = e => {
12
+ onChange(sort, {
13
+ newKey: e?.target?.value
14
+ });
15
+ };
16
+ return /*#__PURE__*/_jsx(Box, {
17
+ sx: {
18
+ width: "120px",
19
+ mr: 1
20
+ },
21
+ className: "tv-cf",
22
+ children: /*#__PURE__*/_jsx(SimpleSelect, {
23
+ value: sort?.key,
24
+ options: properties,
25
+ handleChange: handleChange
26
+ })
27
+ });
28
+ };
29
+ export default ChooseField;
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { Box } from "@mui/material";
3
+ import SimpleSelect from "../../DataTypes/Components/SimpleSelect";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const SORT_LABELS = {
6
+ asc: "Ascending",
7
+ desc: "Descending"
8
+ };
9
+ const SORT_OPTIONS = [{
10
+ key: "asc",
11
+ label: SORT_LABELS.asc
12
+ }, {
13
+ key: "desc",
14
+ label: SORT_LABELS.desc
15
+ }];
16
+ const ChooseSort = props => {
17
+ const {
18
+ sort,
19
+ onChange
20
+ } = props;
21
+ const handleChange = e => {
22
+ onChange(sort, {
23
+ operator: e?.target?.value
24
+ });
25
+ };
26
+ return /*#__PURE__*/_jsx(Box, {
27
+ sx: {
28
+ width: "120px"
29
+ },
30
+ className: "tv-cf",
31
+ children: /*#__PURE__*/_jsx(SimpleSelect, {
32
+ value: sort?.operator,
33
+ options: SORT_OPTIONS,
34
+ handleChange: handleChange
35
+ })
36
+ });
37
+ };
38
+ export default ChooseSort;
@@ -0,0 +1,74 @@
1
+ import React from "react";
2
+ import { Box, List, ListItem, ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
3
+ import { useDataView } from "../../../Providers/DataViewProvider";
4
+ import DeleteIcon from "@mui/icons-material/Delete";
5
+ import ChooseSort from "./ChooseSort";
6
+ import ChooseField from "./ChooseField";
7
+ import ColumnsList from "../../Options/ColumnsList";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const SortOptions = props => {
11
+ const {
12
+ onClose
13
+ } = props;
14
+ const {
15
+ properties,
16
+ sort,
17
+ onUpdateSort
18
+ } = useDataView();
19
+ const handleSortChange = (currentSortData, data = {}) => {
20
+ onUpdateSort({
21
+ ...currentSortData,
22
+ ...data
23
+ });
24
+ };
25
+ const handleDelete = () => {
26
+ onClose();
27
+ onUpdateSort({}, false, true);
28
+ };
29
+ const onSelect = s => () => {
30
+ onUpdateSort({
31
+ ...s,
32
+ newKey: s.key,
33
+ operator: "asc"
34
+ }, false, false);
35
+ onClose();
36
+ };
37
+ return sort?.length > 0 ? /*#__PURE__*/_jsxs(List, {
38
+ className: "tv-opt-list",
39
+ sx: {
40
+ p: 0
41
+ },
42
+ children: [sort?.map((m, i) => {
43
+ return /*#__PURE__*/_jsx(ListItem, {
44
+ sx: {
45
+ justifyContent: "space-between"
46
+ },
47
+ children: /*#__PURE__*/_jsxs(Box, {
48
+ sx: {
49
+ display: "flex"
50
+ },
51
+ children: [/*#__PURE__*/_jsx(ChooseField, {
52
+ sort: m,
53
+ properties: properties,
54
+ onChange: handleSortChange
55
+ }), /*#__PURE__*/_jsx(ChooseSort, {
56
+ sort: m,
57
+ onChange: handleSortChange
58
+ })]
59
+ })
60
+ }, i);
61
+ }), /*#__PURE__*/_jsxs(ListItemButton, {
62
+ onClick: handleDelete,
63
+ children: [/*#__PURE__*/_jsx(ListItemIcon, {
64
+ children: /*#__PURE__*/_jsx(DeleteIcon, {})
65
+ }), /*#__PURE__*/_jsx(ListItemText, {
66
+ children: "Delete Sort"
67
+ })]
68
+ })]
69
+ }) : /*#__PURE__*/_jsx(ColumnsList, {
70
+ properties: properties,
71
+ onSelect: onSelect
72
+ });
73
+ };
74
+ export default SortOptions;