@flozy/editor 5.3.6 → 5.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +14 -8
- package/dist/Editor/Editor.css +58 -22
- package/dist/Editor/Elements/Accordion/Accordion.js +8 -1
- package/dist/Editor/Elements/AppHeader/AppHeader.js +6 -6
- package/dist/Editor/Elements/Button/EditorButton.js +9 -2
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +4 -2
- package/dist/Editor/Elements/DataView/DataView.js +124 -0
- package/dist/Editor/Elements/DataView/DataViewButton.js +23 -0
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +67 -0
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/CheckType.js +33 -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 +35 -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 +80 -0
- package/dist/Editor/Elements/DataView/Layouts/colStyles.js +10 -0
- package/dist/Editor/Elements/DataView/Layouts/index.js +25 -0
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +281 -0
- package/dist/Editor/Elements/DataView/Utils/globalSearch.js +15 -0
- package/dist/Editor/Elements/DataView/Utils/multiSortRows.js +74 -0
- package/dist/Editor/Elements/DataView/styles.js +154 -0
- package/dist/Editor/Elements/Divider/Divider.js +24 -9
- package/dist/Editor/Elements/Embed/Image.js +31 -12
- package/dist/Editor/Elements/Embed/Video.js +13 -2
- package/dist/Editor/Elements/Form/Form.js +1 -0
- package/dist/Editor/Elements/FreeGrid/breakpointConstants.js +4 -4
- package/dist/Editor/Elements/FreeGrid/styles.js +2 -1
- package/dist/Editor/Elements/Grid/GridItem.js +2 -0
- package/dist/Editor/Elements/Grid/Styles.js +44 -0
- package/dist/Editor/Elements/List/CheckList.js +2 -1
- package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
- package/dist/Editor/Elements/Signature/SignaturePopup.js +4 -4
- package/dist/Editor/Elements/SimpleText/index.js +8 -1
- package/dist/Editor/Elements/SimpleText/style.js +10 -1
- package/dist/Editor/Elements/Table/Table.js +2 -4
- package/dist/Editor/Elements/Table/TableCell.js +5 -10
- package/dist/Editor/Elements/TopBanner/TopBanner.js +2 -1
- package/dist/Editor/MiniEditor.js +15 -1
- package/dist/Editor/Styles/EditorStyles.js +5 -3
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +17 -1
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -3
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +210 -72
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +56 -8
- package/dist/Editor/Toolbar/Toolbar.js +6 -0
- package/dist/Editor/Toolbar/toolbarGroups.js +4 -0
- package/dist/Editor/assets/svg/SettingsIcon.js +4 -4
- package/dist/Editor/common/ColorPickerButton.js +5 -3
- package/dist/Editor/common/DnD/Draggable.js +2 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +4 -4
- package/dist/Editor/common/Icon.js +6 -0
- package/dist/Editor/common/ImageSelector/Options/Upload.js +2 -1
- package/dist/Editor/common/ImageSelector/Styles.js +47 -6
- package/dist/Editor/common/ImageSelector/UploadStyles.js +18 -6
- package/dist/Editor/common/MentionsPopup/Styles.js +109 -122
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +1 -0
- 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/RnD/Utils/gridDropItem.js +9 -6
- package/dist/Editor/common/RnD/index.js +2 -1
- package/dist/Editor/common/Section/index.js +3 -3
- package/dist/Editor/common/Section/styles.js +5 -1
- package/dist/Editor/common/Shorthands/elements.js +13 -1
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +9 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +27 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +10 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +2 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +1 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -0
- 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 +4 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +22 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +21 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +15 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +7 -0
- package/dist/Editor/common/StyleBuilder/index.js +17 -9
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
- package/dist/Editor/common/ToolbarIcon.js +1 -1
- package/dist/Editor/common/Uploader.js +46 -36
- package/dist/Editor/common/iconListV2.js +348 -130
- package/dist/Editor/common/iconslist.js +6 -3
- package/dist/Editor/commonStyle.js +290 -4
- package/dist/Editor/helper/deserialize/index.js +19 -23
- package/dist/Editor/helper/enforceDateFormat.js +41 -0
- package/dist/Editor/helper/index.js +16 -3
- package/dist/Editor/helper/theme.js +24 -1
- package/dist/Editor/hooks/useMouseMove.js +5 -2
- package/dist/Editor/hooks/useTable.js +22 -19
- package/dist/Editor/plugins/withCustomDeleteBackward.js +33 -2
- package/dist/Editor/plugins/withEmbeds.js +30 -26
- package/dist/Editor/utils/SlateUtilityFunctions.js +27 -4
- package/dist/Editor/utils/button.js +4 -4
- package/dist/Editor/utils/dataView.js +43 -0
- package/dist/Editor/utils/helper.js +50 -10
- package/dist/Editor/utils/pageSettings.js +14 -2
- package/package.json +2 -2
@@ -0,0 +1,281 @@
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from "react";
|
2
|
+
import { Editor, Transforms, Node } from "slate";
|
3
|
+
import { PROPERTY_DEFAULTS } from "../Layouts/Options/Constants";
|
4
|
+
import multiSortRows from "../Utils/multiSortRows";
|
5
|
+
import globalSearch from "../Utils/globalSearch";
|
6
|
+
|
7
|
+
// Data View context
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
const DataViewContext = /*#__PURE__*/createContext();
|
10
|
+
export const useDataView = () => useContext(DataViewContext);
|
11
|
+
const DEFAULT_PROPERTIES = [{
|
12
|
+
key: "column1",
|
13
|
+
label: "Name",
|
14
|
+
dataType: "text"
|
15
|
+
}, {
|
16
|
+
key: "column2",
|
17
|
+
label: "Status",
|
18
|
+
dataType: "select",
|
19
|
+
options: ["Active", "Inactive"]
|
20
|
+
}, {
|
21
|
+
key: "column3",
|
22
|
+
label: "Agree?",
|
23
|
+
dataType: "checkbox"
|
24
|
+
}];
|
25
|
+
|
26
|
+
// Combined provider
|
27
|
+
export const DataViewProvider = ({
|
28
|
+
children,
|
29
|
+
...props
|
30
|
+
}) => {
|
31
|
+
const {
|
32
|
+
data: initialData,
|
33
|
+
path,
|
34
|
+
editor,
|
35
|
+
users: peoples
|
36
|
+
} = props;
|
37
|
+
const dataViewNode = Node.get(editor, path);
|
38
|
+
const [layouts, setLayouts] = useState(initialData?.layouts || []);
|
39
|
+
const [seletectedLayout, setSelectedLayout] = useState({
|
40
|
+
...(layouts[0] || {})
|
41
|
+
});
|
42
|
+
const [layoutType, setLayoutType] = useState(seletectedLayout?.type || "table");
|
43
|
+
const [properties, setProperties] = useState(initialData?.properties || [...DEFAULT_PROPERTIES]);
|
44
|
+
const [sort, setSort] = useState(seletectedLayout?.sort || []);
|
45
|
+
const [filter, setFilter] = useState(seletectedLayout?.filter || []);
|
46
|
+
const [rows, setRows] = useState(initialData?.rows || []);
|
47
|
+
const [selectedRows, setSelectedRows] = useState([]);
|
48
|
+
const [search, setSearch] = useState("");
|
49
|
+
const users = peoples?.map(m => {
|
50
|
+
return {
|
51
|
+
value: m?.name
|
52
|
+
};
|
53
|
+
});
|
54
|
+
|
55
|
+
// for undo and redo
|
56
|
+
// minimal added for perforamnce issue avoid
|
57
|
+
useEffect(() => {
|
58
|
+
setRows(dataViewNode?.rows);
|
59
|
+
}, [dataViewNode?.rows?.length]);
|
60
|
+
useEffect(() => {
|
61
|
+
setProperties(dataViewNode?.properties);
|
62
|
+
}, [dataViewNode?.properties?.length]);
|
63
|
+
|
64
|
+
// re-order when sort val changes
|
65
|
+
useEffect(() => {
|
66
|
+
if ((sort?.length > 0 || search) && rows?.length > 0) {
|
67
|
+
const reOrderRows = sort?.length > 0 ? multiSortRows(initialData?.rows, sort, properties) : [...initialData?.rows];
|
68
|
+
setRows(globalSearch(reOrderRows, search));
|
69
|
+
} else {
|
70
|
+
// reset to default order
|
71
|
+
setRows(globalSearch(initialData?.rows || [], search));
|
72
|
+
}
|
73
|
+
}, [sort, search]);
|
74
|
+
const onAddProperty = (data, overrides = {}) => {
|
75
|
+
try {
|
76
|
+
const {
|
77
|
+
type
|
78
|
+
} = data;
|
79
|
+
const key = `col_${new Date().getTime()}`;
|
80
|
+
const newProperty = {
|
81
|
+
...(PROPERTY_DEFAULTS[type] || {}),
|
82
|
+
...overrides,
|
83
|
+
key: key,
|
84
|
+
type
|
85
|
+
};
|
86
|
+
const updatedProperties = [...properties, {
|
87
|
+
...newProperty
|
88
|
+
}];
|
89
|
+
Transforms.setNodes(editor, {
|
90
|
+
properties: [...updatedProperties]
|
91
|
+
}, {
|
92
|
+
at: path
|
93
|
+
});
|
94
|
+
setProperties([...updatedProperties]);
|
95
|
+
return newProperty;
|
96
|
+
} catch (err) {
|
97
|
+
console.log(err);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
const onUpdateProperty = (data, isDelete = false) => {
|
101
|
+
try {
|
102
|
+
const {
|
103
|
+
key
|
104
|
+
} = data;
|
105
|
+
let up = {
|
106
|
+
...data
|
107
|
+
};
|
108
|
+
const updatedProperties = properties?.map(m => {
|
109
|
+
if (m.key === key) {
|
110
|
+
up = {
|
111
|
+
...m,
|
112
|
+
...data
|
113
|
+
};
|
114
|
+
return up;
|
115
|
+
}
|
116
|
+
return m;
|
117
|
+
});
|
118
|
+
if (isDelete) {
|
119
|
+
const deleteIndex = updatedProperties.findIndex(f => f.key === key);
|
120
|
+
updatedProperties.splice(deleteIndex, 1);
|
121
|
+
}
|
122
|
+
Transforms.setNodes(editor, {
|
123
|
+
properties: [...updatedProperties]
|
124
|
+
}, {
|
125
|
+
at: path
|
126
|
+
});
|
127
|
+
setProperties([...updatedProperties]);
|
128
|
+
return up;
|
129
|
+
} catch (err) {
|
130
|
+
console.log(err);
|
131
|
+
}
|
132
|
+
};
|
133
|
+
const onChange = (rowIndex, rowData) => {
|
134
|
+
try {
|
135
|
+
const updatedRows = rows?.map(m => {
|
136
|
+
if (m?.id === rowIndex) {
|
137
|
+
m = {
|
138
|
+
...m,
|
139
|
+
...rowData
|
140
|
+
};
|
141
|
+
}
|
142
|
+
return m;
|
143
|
+
});
|
144
|
+
Transforms.setNodes(editor, {
|
145
|
+
rows: [...updatedRows]
|
146
|
+
}, {
|
147
|
+
at: path
|
148
|
+
});
|
149
|
+
setRows(updatedRows);
|
150
|
+
} catch (err) {
|
151
|
+
console.log(err);
|
152
|
+
}
|
153
|
+
};
|
154
|
+
const onAddRow = () => {
|
155
|
+
try {
|
156
|
+
const newRow = properties?.reduce((a, b) => {
|
157
|
+
a[b.key] = "";
|
158
|
+
return a;
|
159
|
+
}, {
|
160
|
+
id: `row_${new Date().getTime()}`
|
161
|
+
});
|
162
|
+
const updatedRows = [...rows, newRow];
|
163
|
+
Transforms.setNodes(editor, {
|
164
|
+
rows: [...updatedRows]
|
165
|
+
}, {
|
166
|
+
at: path
|
167
|
+
});
|
168
|
+
setRows(updatedRows);
|
169
|
+
} catch (err) {
|
170
|
+
console.log(err);
|
171
|
+
}
|
172
|
+
};
|
173
|
+
const formatSort = (sorts = [], sortData, isDelete = false) => {
|
174
|
+
let upSort = [];
|
175
|
+
const isUpdate = sorts?.find(f => f.key === sortData?.key);
|
176
|
+
if (isUpdate) {
|
177
|
+
// update if any
|
178
|
+
upSort = sorts?.map(m => {
|
179
|
+
if (m.key === sortData.key) {
|
180
|
+
// if update col
|
181
|
+
if (sortData["newKey"]) {
|
182
|
+
sortData["key"] = sortData["newKey"];
|
183
|
+
delete sortData["newKey"];
|
184
|
+
}
|
185
|
+
return {
|
186
|
+
...sortData
|
187
|
+
};
|
188
|
+
}
|
189
|
+
return m;
|
190
|
+
});
|
191
|
+
} else {
|
192
|
+
upSort = [...sorts, {
|
193
|
+
...sortData
|
194
|
+
}];
|
195
|
+
}
|
196
|
+
|
197
|
+
// if no sort
|
198
|
+
if (sorts?.length === 0 && !isDelete) {
|
199
|
+
upSort = [{
|
200
|
+
...sortData
|
201
|
+
}];
|
202
|
+
}
|
203
|
+
|
204
|
+
// if delete
|
205
|
+
if (isDelete) {
|
206
|
+
const deleteIndex = upSort.findIndex(f => f.key === sortData.key);
|
207
|
+
upSort.splice(deleteIndex, 1);
|
208
|
+
}
|
209
|
+
return upSort;
|
210
|
+
};
|
211
|
+
const onUpdateSort = (sortData = {}, isDelete = false, deleteAll = false) => {
|
212
|
+
try {
|
213
|
+
let upSort = {};
|
214
|
+
const updatedLayouts = layouts?.map((m, i) => {
|
215
|
+
if (seletectedLayout?.key === m.key) {
|
216
|
+
upSort = !deleteAll ? formatSort(m?.sort || [], sortData, isDelete) : [];
|
217
|
+
return {
|
218
|
+
...m,
|
219
|
+
sort: [...upSort]
|
220
|
+
};
|
221
|
+
}
|
222
|
+
return m;
|
223
|
+
});
|
224
|
+
Transforms.setNodes(editor, {
|
225
|
+
layouts: [...updatedLayouts]
|
226
|
+
}, {
|
227
|
+
at: path
|
228
|
+
});
|
229
|
+
setLayouts(updatedLayouts);
|
230
|
+
setSort(upSort);
|
231
|
+
} catch (err) {
|
232
|
+
console.log(err);
|
233
|
+
}
|
234
|
+
};
|
235
|
+
const onDeleteRows = () => {
|
236
|
+
try {
|
237
|
+
const updatedRows = [...rows].filter(f => selectedRows.includes(f.id) === false);
|
238
|
+
Transforms.setNodes(editor, {
|
239
|
+
rows: [...updatedRows]
|
240
|
+
}, {
|
241
|
+
at: path
|
242
|
+
});
|
243
|
+
setRows(updatedRows);
|
244
|
+
setSelectedRows([]);
|
245
|
+
} catch (err) {
|
246
|
+
console.log(err);
|
247
|
+
}
|
248
|
+
};
|
249
|
+
const onSearch = e => {
|
250
|
+
setSearch(e?.target?.value);
|
251
|
+
};
|
252
|
+
const value = {
|
253
|
+
layoutType,
|
254
|
+
setLayoutType,
|
255
|
+
properties,
|
256
|
+
setProperties,
|
257
|
+
rows,
|
258
|
+
setRows,
|
259
|
+
onAddProperty,
|
260
|
+
layouts,
|
261
|
+
setLayouts,
|
262
|
+
onUpdateProperty,
|
263
|
+
onChange,
|
264
|
+
onAddRow,
|
265
|
+
users: users,
|
266
|
+
onUpdateSort,
|
267
|
+
sort,
|
268
|
+
filter,
|
269
|
+
setSelectedLayout,
|
270
|
+
setFilter,
|
271
|
+
selectedRows,
|
272
|
+
setSelectedRows,
|
273
|
+
onDeleteRows,
|
274
|
+
search,
|
275
|
+
onSearch
|
276
|
+
};
|
277
|
+
return /*#__PURE__*/_jsx(DataViewContext.Provider, {
|
278
|
+
value: value,
|
279
|
+
children: children
|
280
|
+
});
|
281
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const globalSearch = (array, searchTerm) => {
|
2
|
+
if (!searchTerm) {
|
3
|
+
return array;
|
4
|
+
}
|
5
|
+
const lowerCaseSearchTerm = searchTerm.toLowerCase();
|
6
|
+
return array.filter(item => Object.values(item).some(value => {
|
7
|
+
if (typeof value === "string" && value) {
|
8
|
+
return value?.toLowerCase().includes(lowerCaseSearchTerm);
|
9
|
+
} else if (Array.isArray(value)) {
|
10
|
+
return value?.map(m => m?.value).some(d => d.toLowerCase().includes(lowerCaseSearchTerm));
|
11
|
+
}
|
12
|
+
return false;
|
13
|
+
}));
|
14
|
+
};
|
15
|
+
export default globalSearch;
|
@@ -0,0 +1,74 @@
|
|
1
|
+
function sortByDate(a, b) {
|
2
|
+
const dateA = new Date(a);
|
3
|
+
const dateB = new Date(b);
|
4
|
+
|
5
|
+
// Check if both dates are valid
|
6
|
+
const isValidA = !isNaN(dateA.getTime());
|
7
|
+
const isValidB = !isNaN(dateB.getTime());
|
8
|
+
if (isValidA && isValidB) {
|
9
|
+
// Compare valid dates
|
10
|
+
return dateA - dateB;
|
11
|
+
} else if (isValidA) {
|
12
|
+
// Invalid date in `b` pushes `a` before `b`
|
13
|
+
return -1;
|
14
|
+
} else if (isValidB) {
|
15
|
+
// Invalid date in `a` pushes `b` before `a`
|
16
|
+
return 1;
|
17
|
+
} else {
|
18
|
+
// Both are invalid, maintain their relative order
|
19
|
+
return 0;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Multi-sort rows based on multiple criteria.
|
25
|
+
* @param {Array} rows - Array of row objects.
|
26
|
+
* @param {Array} criteria - Array of sort criteria [{key, sortBy}].
|
27
|
+
* @param {Object} columnConfig - Column configurations with data types.
|
28
|
+
*/
|
29
|
+
const multiSortRows = (rows, criteria, columnConfig) => {
|
30
|
+
return rows.slice().sort((a, b) => {
|
31
|
+
for (let {
|
32
|
+
key,
|
33
|
+
operator
|
34
|
+
} of criteria) {
|
35
|
+
const column = columnConfig.find(col => col.key === key);
|
36
|
+
if (!column) continue;
|
37
|
+
const dataType = column.type;
|
38
|
+
const valueA = a[key];
|
39
|
+
const valueB = b[key];
|
40
|
+
let comparison = 0;
|
41
|
+
switch (dataType) {
|
42
|
+
case "text":
|
43
|
+
comparison = valueA.localeCompare(valueB, undefined, {
|
44
|
+
sensitivity: "base"
|
45
|
+
});
|
46
|
+
break;
|
47
|
+
case "number":
|
48
|
+
comparison = parseInt(valueA || 0) - parseInt(valueB || 0);
|
49
|
+
break;
|
50
|
+
case "select":
|
51
|
+
case "multi-select":
|
52
|
+
if (Array.isArray(valueA) && Array.isArray(valueB)) {
|
53
|
+
comparison = Array.isArray(valueA) ? valueA?.map(m => m?.value).join(", ").localeCompare(valueB?.map(m => m?.value).join(", "), undefined, {
|
54
|
+
sensitivity: "base"
|
55
|
+
}) : 0;
|
56
|
+
}
|
57
|
+
break;
|
58
|
+
case "date":
|
59
|
+
comparison = sortByDate(valueA, valueB);
|
60
|
+
break;
|
61
|
+
case "check":
|
62
|
+
return valueA && operator === "desc" ? 1 : -1;
|
63
|
+
default:
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
if (comparison !== 0) {
|
67
|
+
return operator === "asc" ? comparison : -comparison;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return 0; // Rows are equal based on all criteria
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
export default multiSortRows;
|
@@ -0,0 +1,154 @@
|
|
1
|
+
const useDataViewStyles = (theme, appTheme) => ({
|
2
|
+
root: {
|
3
|
+
width: "100%",
|
4
|
+
overflowX: "auto",
|
5
|
+
marginTop: "8px",
|
6
|
+
"& table": {
|
7
|
+
width: "100%",
|
8
|
+
"& th.fe-tv-ap-ico": {
|
9
|
+
width: "50px"
|
10
|
+
}
|
11
|
+
},
|
12
|
+
"& table th": {
|
13
|
+
cursor: "pointer",
|
14
|
+
width: "200px"
|
15
|
+
},
|
16
|
+
"& table, th, td": {
|
17
|
+
border: "1px solid black",
|
18
|
+
borderCollapse: "collapse"
|
19
|
+
},
|
20
|
+
"& .react-datepicker-wrapper": {
|
21
|
+
width: "100%",
|
22
|
+
"& input": {
|
23
|
+
padding: "6px 12px"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"& .MuiInputBase-root": {
|
27
|
+
"& fieldset": {
|
28
|
+
border: "none"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
// filter view
|
32
|
+
"& .fe-tv-fv": {
|
33
|
+
marginBottom: "8px",
|
34
|
+
"& .mr": {
|
35
|
+
marginRight: "4px"
|
36
|
+
},
|
37
|
+
[theme?.breakpoints?.between("xs", "md")]: {
|
38
|
+
display: "flex",
|
39
|
+
flexDirection: "column"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
"& .tv-act-row": {
|
43
|
+
"& .tv-tr-pop": {
|
44
|
+
opacity: 0,
|
45
|
+
"&.active": {
|
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
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"&:hover": {
|
60
|
+
"& .tv-tr-pop": {
|
61
|
+
opacity: 1
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
},
|
66
|
+
filterView: {
|
67
|
+
display: "flex",
|
68
|
+
justifyContent: "space-between",
|
69
|
+
alignItems: "center",
|
70
|
+
"& .MuiButtonBase-root": {
|
71
|
+
padding: "6px",
|
72
|
+
marginLeft: "4px",
|
73
|
+
width: "29px",
|
74
|
+
height: "29px",
|
75
|
+
"&.active": {
|
76
|
+
color: "rgba(37, 99, 235, 1)"
|
77
|
+
}
|
78
|
+
},
|
79
|
+
"& .tv-sb": {
|
80
|
+
display: "flex",
|
81
|
+
border: "1px solid transparent",
|
82
|
+
width: "24px",
|
83
|
+
transition: "width 1s",
|
84
|
+
"&.open": {
|
85
|
+
width: "fit-content",
|
86
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
87
|
+
boxShadow: "0px 4px 18px 0px #0000000D",
|
88
|
+
borderRadius: "8px"
|
89
|
+
},
|
90
|
+
"& input": {
|
91
|
+
paddingBottom: "0px",
|
92
|
+
fontSize: "14px"
|
93
|
+
}
|
94
|
+
},
|
95
|
+
"& .tv-title-wrpr, .tv-fi-wrpr": {
|
96
|
+
display: "flex",
|
97
|
+
"& button": {
|
98
|
+
color: appTheme?.palette?.editor?.tv_text
|
99
|
+
},
|
100
|
+
"& input": {
|
101
|
+
color: appTheme?.palette?.editor?.tv_text
|
102
|
+
}
|
103
|
+
},
|
104
|
+
"& .tv-title-wrpr": {
|
105
|
+
width: "80%",
|
106
|
+
marginRight: "8px",
|
107
|
+
"& .MuiInputBase-root": {
|
108
|
+
width: "100%"
|
109
|
+
},
|
110
|
+
"& .MuiInputBase-input": {
|
111
|
+
paddingBottom: "0px",
|
112
|
+
fontWeight: "bold",
|
113
|
+
fontSize: "16px"
|
114
|
+
},
|
115
|
+
[theme?.breakpoints?.between("xs", "md")]: {
|
116
|
+
width: "100%",
|
117
|
+
marginRight: "0px"
|
118
|
+
}
|
119
|
+
},
|
120
|
+
"& .tv-fi-wrpr": {
|
121
|
+
[theme?.breakpoints?.between("xs", "md")]: {
|
122
|
+
width: "100%",
|
123
|
+
justifyContent: "end"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
127
|
+
basicMenu: {
|
128
|
+
"& .MuiPaper-root": {
|
129
|
+
padding: "0px 6px",
|
130
|
+
width: "150px",
|
131
|
+
border: `1px solid ${appTheme?.palette?.editor?.tv_border}`,
|
132
|
+
borderRadius: "8px",
|
133
|
+
background: appTheme?.palette?.editor?.tv_pop_bg,
|
134
|
+
color: appTheme?.palette?.editor?.tv_text_primary,
|
135
|
+
"& .MuiButtonBase-root": {
|
136
|
+
fontSize: "14px",
|
137
|
+
"& svg": {
|
138
|
+
width: "16px",
|
139
|
+
height: "16px",
|
140
|
+
color: `${appTheme?.palette?.editor?.tv_text}`
|
141
|
+
},
|
142
|
+
"&:hover": {
|
143
|
+
background: appTheme?.palette?.editor?.tv_hover_bg,
|
144
|
+
borderRadius: "8px",
|
145
|
+
color: `${appTheme?.palette?.editor?.tv_hover_text} !important`,
|
146
|
+
"& svg": {
|
147
|
+
color: `${appTheme?.palette?.editor?.tv_hover_text} !important`
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
});
|
154
|
+
export default useDataViewStyles;
|
@@ -5,6 +5,7 @@ import { IconButton, Tooltip } from "@mui/material";
|
|
5
5
|
import { GridSettingsIcon } from "../../common/iconslist";
|
6
6
|
import DividerPopup from "./DividerPopup";
|
7
7
|
import { Transforms } from "slate";
|
8
|
+
import useCommonStyle from "../../commonStyle";
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
const Divider = props => {
|
@@ -17,6 +18,7 @@ const Divider = props => {
|
|
17
18
|
const {
|
18
19
|
theme
|
19
20
|
} = useEditorContext();
|
21
|
+
const classes = useCommonStyle(theme);
|
20
22
|
const {
|
21
23
|
borderColor = theme?.palette?.primary?.main || "#0F172A",
|
22
24
|
borderWidth = "1px",
|
@@ -43,11 +45,16 @@ const Divider = props => {
|
|
43
45
|
showTool,
|
44
46
|
onSettings
|
45
47
|
}) => {
|
46
|
-
const hoverStyles = readOnly
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
// const hoverStyles = readOnly
|
49
|
+
// ? {
|
50
|
+
// "&.MuiIconButton-root:hover": {
|
51
|
+
// background:
|
52
|
+
// theme?.palette?.type === "dark"
|
53
|
+
// ? `${theme?.palette?.greyshades?.light8} !important`
|
54
|
+
// : `${theme?.palette?.containers?.card} !important`,
|
55
|
+
// },
|
56
|
+
// }
|
57
|
+
// : {};
|
51
58
|
return /*#__PURE__*/_jsx("div", {
|
52
59
|
contentEditable: false,
|
53
60
|
className: "divider-settings",
|
@@ -61,14 +68,22 @@ const Divider = props => {
|
|
61
68
|
children: /*#__PURE__*/_jsx(IconButton, {
|
62
69
|
size: "small",
|
63
70
|
sx: {
|
64
|
-
background:
|
65
|
-
|
71
|
+
// background:
|
72
|
+
// theme?.palette?.type === "dark"
|
73
|
+
// ? theme?.palette?.greyshades?.light8
|
74
|
+
// : theme?.palette?.containers?.card,
|
75
|
+
// border:
|
76
|
+
// theme?.palette?.type === "dark"
|
77
|
+
// ? "1px solid #E4E8EB33"
|
78
|
+
// : "none",
|
66
79
|
boxShadow: "0px 0px 4px 0px #00000040",
|
67
80
|
borderRadius: "50%",
|
68
81
|
"& svg": {
|
69
|
-
|
82
|
+
width: '16px',
|
83
|
+
height: '16px'
|
70
84
|
},
|
71
|
-
...hoverStyles
|
85
|
+
// ...hoverStyles,
|
86
|
+
...classes.buttonMoreOption
|
72
87
|
},
|
73
88
|
onClick: onSettings,
|
74
89
|
children: /*#__PURE__*/_jsx(GridSettingsIcon, {})
|
@@ -14,28 +14,33 @@ import ImageFrame from "./Frames/ImageFrame";
|
|
14
14
|
import LinkSettings from "../../common/LinkSettings";
|
15
15
|
import { handleLinkType } from "../../utils/helper";
|
16
16
|
import { wrapThemeBreakpoints } from "../FreeGrid/breakpointConstants";
|
17
|
+
import useCommonStyle from "../../commonStyle";
|
18
|
+
import SettingsIcon from "../../assets/svg/SettingsIcon";
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
18
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
21
|
const ToolBar = ({
|
20
22
|
isEmpty,
|
21
23
|
onSettings,
|
22
24
|
setOpenNav,
|
23
|
-
topM
|
25
|
+
topM,
|
26
|
+
classes
|
24
27
|
}) => {
|
25
28
|
return !isEmpty ? /*#__PURE__*/_jsxs("div", {
|
26
29
|
className: "element-toolbar visible-on-hover",
|
27
30
|
contentEditable: false,
|
28
31
|
style: {
|
29
|
-
top: "-
|
32
|
+
top: "-4px",
|
30
33
|
left: topM ? "35px" : "0px",
|
31
|
-
margin: "0px"
|
34
|
+
margin: "0px",
|
35
|
+
gap: '3px'
|
32
36
|
},
|
33
37
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
34
38
|
title: "Image Settings",
|
35
39
|
arrow: true,
|
36
40
|
children: /*#__PURE__*/_jsx(IconButton, {
|
37
41
|
onClick: onSettings,
|
38
|
-
|
42
|
+
sx: classes.buttonMoreOption,
|
43
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
39
44
|
})
|
40
45
|
}), /*#__PURE__*/_jsx(Tooltip, {
|
41
46
|
title: "Link Settings",
|
@@ -43,6 +48,7 @@ const ToolBar = ({
|
|
43
48
|
children: /*#__PURE__*/_jsx(IconButton, {
|
44
49
|
className: "last-btn",
|
45
50
|
onClick: () => setOpenNav(true),
|
51
|
+
sx: classes.buttonMoreOption,
|
46
52
|
children: /*#__PURE__*/_jsx(LinkIcon, {})
|
47
53
|
})
|
48
54
|
})]
|
@@ -64,7 +70,8 @@ const ImageContent = props => {
|
|
64
70
|
handleImageClick,
|
65
71
|
onTouchEnd,
|
66
72
|
path,
|
67
|
-
theme
|
73
|
+
theme,
|
74
|
+
classes
|
68
75
|
} = props;
|
69
76
|
return !url ? !readOnly ? /*#__PURE__*/_jsxs(Box, {
|
70
77
|
component: "button",
|
@@ -73,6 +80,9 @@ const ImageContent = props => {
|
|
73
80
|
onClick: () => {
|
74
81
|
setOpenSettings(true);
|
75
82
|
},
|
83
|
+
sx: {
|
84
|
+
...classes.emptyThumbBtn
|
85
|
+
},
|
76
86
|
children: [/*#__PURE__*/_jsx(Icon, {
|
77
87
|
icon: "image"
|
78
88
|
}), "Add Image"]
|
@@ -183,6 +193,10 @@ const Image = props => {
|
|
183
193
|
onClick,
|
184
194
|
onTouchEnd
|
185
195
|
} = handleLinkType(webAddress, linkType, readOnly, isNewTab);
|
196
|
+
const {
|
197
|
+
theme: appTheme
|
198
|
+
} = useEditorContext();
|
199
|
+
const classes = useCommonStyle(appTheme);
|
186
200
|
const handleImageClick = () => {
|
187
201
|
try {
|
188
202
|
Transforms.select(editor, {
|
@@ -293,7 +307,8 @@ const Image = props => {
|
|
293
307
|
isEmpty: isEmpty,
|
294
308
|
onSettings: onSettings,
|
295
309
|
setOpenNav: setOpenNav,
|
296
|
-
topM: size.width < 100
|
310
|
+
topM: size.width < 100,
|
311
|
+
classes: classes
|
297
312
|
}), /*#__PURE__*/_jsx(ImageContent, {
|
298
313
|
...element,
|
299
314
|
readOnly: readOnly,
|
@@ -301,7 +316,8 @@ const Image = props => {
|
|
301
316
|
handleImageClick: handleImageClick,
|
302
317
|
onTouchEnd: onTouchEnd,
|
303
318
|
path: path,
|
304
|
-
theme: theme
|
319
|
+
theme: theme,
|
320
|
+
classes: classes
|
305
321
|
}), url && frames[frame] ? /*#__PURE__*/_jsx(Box, {
|
306
322
|
component: "div",
|
307
323
|
className: "image-frame",
|
@@ -317,11 +333,14 @@ const Image = props => {
|
|
317
333
|
handleImageClick: handleImageClick
|
318
334
|
})
|
319
335
|
}) : null, selected && !readOnly && url && /*#__PURE__*/_jsx(IconButton, {
|
320
|
-
onPointerDown: onMouseDown
|
321
|
-
style
|
322
|
-
|
323
|
-
|
324
|
-
|
336
|
+
onPointerDown: onMouseDown
|
337
|
+
// style={{
|
338
|
+
// opacity: 1,
|
339
|
+
// // background: "#FFF",
|
340
|
+
// // ...classes.resizeButton
|
341
|
+
// }}
|
342
|
+
,
|
343
|
+
sx: classes.resizeButton,
|
325
344
|
className: "resize-br visible-on-hover img-resizer",
|
326
345
|
children: /*#__PURE__*/_jsx(AspectRatioIcon, {})
|
327
346
|
})]
|