@solidstarters/solid-core-ui 1.1.61 → 1.1.63
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/components/core/common/SolidGlobalSearchElement.d.ts +1 -0
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +292 -56
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidSaveCustomFilterForm.d.ts +9 -0
- package/dist/components/core/common/SolidSaveCustomFilterForm.d.ts.map +1 -0
- package/dist/components/core/common/SolidSaveCustomFilterForm.js +37 -0
- package/dist/components/core/common/SolidSaveCustomFilterForm.js.map +1 -0
- package/dist/components/core/filter/fields/SolidBooleanField.js +1 -1
- package/dist/components/core/filter/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +205 -167
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +6 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
- package/dist/components/core/model/CreateModel.js +3 -3
- package/dist/components/core/model/CreateModel.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
- package/dist/components/core/model/ModelMetaData.js +68 -15
- package/dist/components/core/model/ModelMetaData.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/globals.css +8 -0
- package/package.json +1 -1
- package/src/components/core/common/SolidGlobalSearchElement.tsx +425 -123
- package/src/components/core/common/SolidSaveCustomFilterForm.tsx +74 -0
- package/src/components/core/filter/fields/SolidBooleanField.tsx +1 -1
- package/src/components/core/kanban/SolidKanbanView.tsx +176 -158
- package/src/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +45 -2
- package/src/components/core/model/CreateModel.tsx +2 -2
- package/src/components/core/model/FieldMetaDataForm.tsx +0 -2
- package/src/components/core/model/ModelMetaData.tsx +204 -121
- package/src/index.ts +1 -0
- package/src/resources/globals.css +8 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Button } from "primereact/button";
|
|
2
|
+
import { Checkbox } from "primereact/checkbox";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
|
|
5
|
+
interface SolidSaveCustomFilterFormProps {
|
|
6
|
+
currentSavedFilterData: any,
|
|
7
|
+
handleSaveFilter: ({ }) => void;
|
|
8
|
+
closeDialog: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const SolidSaveCustomFilterForm: React.FC<SolidSaveCustomFilterFormProps> = ({ currentSavedFilterData, handleSaveFilter, closeDialog }) => {
|
|
12
|
+
const [formValues, setFormValues] = useState({ name: currentSavedFilterData ? currentSavedFilterData.name : "", isPrivate: currentSavedFilterData ? currentSavedFilterData.isPrivate : false });
|
|
13
|
+
|
|
14
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
15
|
+
const { name, value, type, checked } = e.target;
|
|
16
|
+
setFormValues((prev) => ({
|
|
17
|
+
...prev,
|
|
18
|
+
[name]: type === "checkbox" ? checked : value,
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
const formData = {
|
|
25
|
+
id: currentSavedFilterData ? currentSavedFilterData.id : null,
|
|
26
|
+
name: formValues.name,
|
|
27
|
+
isPrivate: formValues.isPrivate === true ? true : "",
|
|
28
|
+
}
|
|
29
|
+
handleSaveFilter(formData);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<form onSubmit={handleSubmit}>
|
|
34
|
+
<div className="flex flex-column gap-2">
|
|
35
|
+
<label htmlFor="name">Name:</label>
|
|
36
|
+
<input
|
|
37
|
+
type="text"
|
|
38
|
+
id="name"
|
|
39
|
+
name="name"
|
|
40
|
+
placeholder="Filter Title"
|
|
41
|
+
className="p-inputtext p-inputtext-sm p-component"
|
|
42
|
+
value={formValues.name}
|
|
43
|
+
onChange={handleChange}
|
|
44
|
+
readOnly={currentSavedFilterData}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
<div className="mt-3 flex align-items-center ">
|
|
48
|
+
<Checkbox
|
|
49
|
+
inputId="isPrivate"
|
|
50
|
+
name="isPrivate"
|
|
51
|
+
checked={formValues.isPrivate}
|
|
52
|
+
onChange={(e: any) => handleChange(e)}
|
|
53
|
+
>
|
|
54
|
+
</Checkbox>
|
|
55
|
+
<label htmlFor="isPrivate" className="ml-2">Is Private</label>
|
|
56
|
+
</div>
|
|
57
|
+
<div className="mt-3 flex align-items-center gap-2">
|
|
58
|
+
<Button
|
|
59
|
+
type="submit"
|
|
60
|
+
label="Save"
|
|
61
|
+
size="small"
|
|
62
|
+
/>
|
|
63
|
+
<Button
|
|
64
|
+
type="button"
|
|
65
|
+
label="Cancel"
|
|
66
|
+
size="small"
|
|
67
|
+
outlined
|
|
68
|
+
onClick={() => closeDialog()}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</form>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
@@ -29,7 +29,15 @@ import "yet-another-react-lightbox/plugins/counter.css";
|
|
|
29
29
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
30
30
|
import { SolidKanbanViewConfigure } from "./SolidKanbanViewConfigure";
|
|
31
31
|
import { KanbanUserViewLayout } from "./KanbanUserViewLayout";
|
|
32
|
+
import { useSelector } from "react-redux";
|
|
33
|
+
import { queryObjectToQueryString, queryStringToQueryObject } from "../list/SolidListView";
|
|
34
|
+
|
|
35
|
+
|
|
32
36
|
import { Toast } from "primereact/toast";
|
|
37
|
+
import { useSelector } from "react-redux";
|
|
38
|
+
import { queryObjectToQueryString, queryStringToQueryObject } from "../list/SolidListView";
|
|
39
|
+
|
|
40
|
+
|
|
33
41
|
|
|
34
42
|
type SolidKanbanViewParams = {
|
|
35
43
|
moduleName: string;
|
|
@@ -39,6 +47,8 @@ type SolidKanbanViewParams = {
|
|
|
39
47
|
|
|
40
48
|
|
|
41
49
|
export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
50
|
+
const { user } = useSelector((state: any) => state.auth);
|
|
51
|
+
|
|
42
52
|
const solidGlobalSearchElementRef = useRef();
|
|
43
53
|
const searchParams = useSearchParams().toString(); // Converts the query params to a string
|
|
44
54
|
const router = useRouter();
|
|
@@ -187,10 +197,13 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
187
197
|
}
|
|
188
198
|
}
|
|
189
199
|
// setFilters(initialFilters);
|
|
190
|
-
const
|
|
200
|
+
const recordsInSwimlane = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsInSwimlane ? solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsInSwimlane : 25;
|
|
191
201
|
// setToPopulate(toPopulate);
|
|
192
202
|
// setToPopulateMedia(toPopulateMedia);
|
|
193
|
-
|
|
203
|
+
setRecordsInSwimlane(recordsInSwimlane);
|
|
204
|
+
setToPopulate(toPopulate);
|
|
205
|
+
setToPopulateMedia(toPopulateMedia);
|
|
206
|
+
return { recordsInSwimlane, toPopulate, toPopulateMedia }
|
|
194
207
|
}
|
|
195
208
|
|
|
196
209
|
|
|
@@ -199,10 +212,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
199
212
|
|
|
200
213
|
if (solidKanbanViewMetaData) {
|
|
201
214
|
setKanbanViewMetaData(solidKanbanViewMetaData);
|
|
202
|
-
|
|
203
|
-
setRows(rows);
|
|
204
|
-
setToPopulate(toPopulate);
|
|
205
|
-
setToPopulateMedia(toPopulateMedia);
|
|
215
|
+
// initialFilterMethod();
|
|
206
216
|
const viewModes = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.length > 0 && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.allowedViews.map((view: any) => { return { label: capitalize(view), value: view } });
|
|
207
217
|
setViewModes(viewModes);
|
|
208
218
|
if (solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.grouped !== false) {
|
|
@@ -217,7 +227,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
217
227
|
// All kanban view state.
|
|
218
228
|
const [kanbanViewData, setKanbanViewData] = useState<any>([]);
|
|
219
229
|
const [kanbanLoadMoreData, setKanbanLoadMoreData] = useState<any>({});
|
|
220
|
-
const [
|
|
230
|
+
const [recordsInSwimlane, setRecordsInSwimlane] = useState(25);
|
|
221
231
|
const [selectedRecords, setSelectedRecords] = useState<any[]>([]);
|
|
222
232
|
const [loading, setLoading] = useState<boolean>(true);
|
|
223
233
|
const [isDialogVisible, setDialogVisible] = useState(false);
|
|
@@ -225,6 +235,9 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
225
235
|
const [editButtonUrl, setEditButtonUrl] = useState<string>();
|
|
226
236
|
const [columnsCount, setColumnsCount] = useState(5);
|
|
227
237
|
const [swimLaneCurrentPageNumber, setSwimLaneCurrentPageNumber] = useState(1);
|
|
238
|
+
const [queryDataLoaded, setQueryDataLoaded] = useState(false);
|
|
239
|
+
|
|
240
|
+
|
|
228
241
|
|
|
229
242
|
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
230
243
|
toast.current?.show({
|
|
@@ -276,109 +289,112 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
276
289
|
|
|
277
290
|
|
|
278
291
|
|
|
279
|
-
|
|
280
|
-
// Fetch data after toPopulate has been populated...
|
|
281
292
|
useEffect(() => {
|
|
282
|
-
|
|
283
293
|
if (solidKanbanViewMetaData) {
|
|
284
294
|
const createActionUrl = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.createAction && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.type === "custom" ? solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.createAction?.customComponent : "form/new";
|
|
285
295
|
const editActionUrl = solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.editAction && solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.type === "custom" ? solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.editAction?.customComponent : "form";
|
|
286
|
-
if (solidKanbanViewMetaData?.data?.solidView?.layout?.attrs?.swimlanesCount) {
|
|
287
|
-
setColumnsCount(solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount)
|
|
288
|
-
}
|
|
289
296
|
if (createActionUrl) {
|
|
290
297
|
setCreateButtonUrl(createActionUrl)
|
|
291
298
|
}
|
|
292
299
|
if (editActionUrl) {
|
|
293
300
|
setEditButtonUrl(editActionUrl)
|
|
294
301
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
|
|
298
|
-
if (groupByFieldName && (toPopulate || toPopulateMedia)) {
|
|
299
|
-
|
|
300
|
-
const queryData = {
|
|
301
|
-
offset: 0,
|
|
302
|
-
limit: columnsToLoadCount,
|
|
303
|
-
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
304
|
-
groupBy: groupByFieldName,
|
|
305
|
-
populateMedia: toPopulateMedia,
|
|
306
|
-
populateGroup: true,
|
|
307
|
-
groupFilter: {
|
|
308
|
-
limit: kanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsInSwimlane || 10,
|
|
309
|
-
offset: 0,
|
|
310
|
-
filters: filters,
|
|
311
|
-
populate: toPopulate,
|
|
312
|
-
populateMedia: toPopulateMedia
|
|
313
|
-
}
|
|
314
|
-
// sort: [`id:desc`],
|
|
315
|
-
};
|
|
316
|
-
// fields=status&groupBy=status&fields=count(status)&populateGroup=true
|
|
317
|
-
let queryString = qs.stringify(queryData, {
|
|
318
|
-
encodeValuesOnly: true
|
|
319
|
-
});
|
|
320
|
-
if (searchParams) {
|
|
321
|
-
queryString = searchParams;
|
|
322
|
-
setFilterQueryString(searchParams)
|
|
323
|
-
} else {
|
|
324
|
-
setFilterQueryString(queryString)
|
|
325
|
-
}
|
|
326
|
-
triggerGetSolidEntities(queryString);
|
|
327
|
-
setSelectedRecords([]);
|
|
328
|
-
}
|
|
329
302
|
}
|
|
330
|
-
}, [
|
|
303
|
+
}, [solidKanbanViewMetaData])
|
|
331
304
|
|
|
305
|
+
// Fetch data after toPopulate has been populated...
|
|
306
|
+
useEffect(() => {
|
|
332
307
|
|
|
308
|
+
if (solidKanbanViewMetaData) {
|
|
333
309
|
|
|
310
|
+
const swimlanesCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
|
|
311
|
+
if (groupByFieldName && (toPopulate || toPopulateMedia)) {
|
|
334
312
|
|
|
335
|
-
|
|
313
|
+
const queryObject = queryStringToQueryObject();
|
|
314
|
+
let queryString = "";
|
|
315
|
+
if (searchParams) {
|
|
336
316
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
// const columnsToLoadCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
|
|
317
|
+
// Get Object from Url
|
|
318
|
+
const queryObject = qs.parse(searchParams,
|
|
319
|
+
{
|
|
320
|
+
decoder: str => decodeURIComponent(str),
|
|
321
|
+
allowDots: true,
|
|
322
|
+
}
|
|
323
|
+
);
|
|
345
324
|
|
|
346
|
-
|
|
325
|
+
const filters = {
|
|
326
|
+
$and: []
|
|
327
|
+
}
|
|
328
|
+
if (queryObject.s_filter) {
|
|
329
|
+
filters.$and.push(queryObject.s_filter);
|
|
330
|
+
}
|
|
331
|
+
if (queryObject.c_filter) {
|
|
332
|
+
filters.$and.push(queryObject.c_filter);
|
|
333
|
+
}
|
|
347
334
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
335
|
+
const queryData = {
|
|
336
|
+
offset: 0,
|
|
337
|
+
limit: Number(queryObject.limit) + Number(queryObject.offset),
|
|
338
|
+
fields: queryObject.fields || [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
339
|
+
groupBy: queryObject.groupBy || groupByFieldName,
|
|
340
|
+
populateMedia: queryObject.populateMedia || toPopulateMedia,
|
|
341
|
+
populateGroup: queryObject.populateGroup || true,
|
|
342
|
+
groupFilter: {
|
|
343
|
+
limit: Number(queryObject.groupFilter.limit) + Number(queryObject.groupFilter.offset) || kanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsInSwimlane,
|
|
344
|
+
offset: 0,
|
|
345
|
+
filters: filters,
|
|
346
|
+
populate: queryObject.groupFilter.populate || toPopulate,
|
|
347
|
+
populateMedia: queryObject.groupFilter.populateMedia || toPopulateMedia
|
|
348
|
+
}
|
|
349
|
+
// sort: [`id:desc`],
|
|
350
|
+
};
|
|
359
351
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
// encodeValuesOnly: true
|
|
366
|
-
// });
|
|
352
|
+
setRecordsInSwimlane(queryData.limit);
|
|
353
|
+
setToPopulate(queryData.populate);
|
|
354
|
+
setToPopulateMedia(queryData.populateMedia);
|
|
355
|
+
setFilters(filters);
|
|
356
|
+
setQueryDataLoaded(true);
|
|
367
357
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
// setKanbanViewData(updatedData);
|
|
372
|
-
// }
|
|
373
|
-
// setSelectedRecords([]);
|
|
374
|
-
// }
|
|
375
|
-
// }
|
|
358
|
+
queryString = qs.stringify(queryData, {
|
|
359
|
+
encodeValuesOnly: true
|
|
360
|
+
});
|
|
376
361
|
|
|
377
|
-
// // @ts-ignore
|
|
378
|
-
// solidGlobalSearchElementRef.current.clearFilter()
|
|
379
|
-
// };
|
|
380
362
|
|
|
363
|
+
} else {
|
|
364
|
+
const { recordsInSwimlane, toPopulate, toPopulateMedia } = initialFilterMethod();
|
|
365
|
+
const queryData = {
|
|
366
|
+
offset: 0,
|
|
367
|
+
limit: swimlanesCount,
|
|
368
|
+
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
369
|
+
groupBy: groupByFieldName,
|
|
370
|
+
populateMedia: toPopulateMedia,
|
|
371
|
+
populateGroup: true,
|
|
372
|
+
groupFilter: {
|
|
373
|
+
limit: kanbanViewMetaData?.data?.solidView?.layout?.attrs?.recordsInSwimlane || 10,
|
|
374
|
+
offset: 0,
|
|
375
|
+
filters: filters,
|
|
376
|
+
populate: toPopulate,
|
|
377
|
+
populateMedia: toPopulateMedia
|
|
378
|
+
}
|
|
379
|
+
// sort: [`id:desc`],
|
|
380
|
+
};
|
|
381
|
+
setRecordsInSwimlane(recordsInSwimlane);
|
|
382
|
+
setToPopulate(toPopulate);
|
|
383
|
+
setToPopulateMedia(toPopulateMedia);
|
|
384
|
+
|
|
385
|
+
// fields=status&groupBy=status&fields=count(status)&populateGroup=true
|
|
386
|
+
queryString = qs.stringify(queryData, {
|
|
387
|
+
encodeValuesOnly: true
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
setQueryDataLoaded(true)
|
|
391
|
+
}
|
|
381
392
|
|
|
393
|
+
triggerGetSolidEntities(queryString);
|
|
394
|
+
setSelectedRecords([]);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}, [isDeleteSolidEntitiesSucess, groupByFieldName, solidKanbanViewMetaData]);
|
|
382
398
|
|
|
383
399
|
|
|
384
400
|
// clickable link allowing one to open the detail / form view.
|
|
@@ -411,18 +427,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
411
427
|
const { offset, limit, records } = kanbanLoadMoreData[groupByField];
|
|
412
428
|
const newLoadMoreData = kanbanLoadMoreData;
|
|
413
429
|
kanbanLoadMoreData[groupByField].offset = offset + limit;
|
|
414
|
-
|
|
415
430
|
try {
|
|
416
|
-
// const queryData = {
|
|
417
|
-
// offset: 0,
|
|
418
|
-
// limit: 1,
|
|
419
|
-
// fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
420
|
-
// groupBy: groupByFieldName,
|
|
421
|
-
// populate: toPopulate,
|
|
422
|
-
// populateGroup: true,
|
|
423
|
-
// sort: [`id:desc`],
|
|
424
|
-
// };
|
|
425
|
-
|
|
426
431
|
const queryData = {
|
|
427
432
|
offset: offset + limit,
|
|
428
433
|
limit: limit,
|
|
@@ -441,7 +446,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
441
446
|
const queryString = qs.stringify(queryData, {
|
|
442
447
|
encodeValuesOnly: true
|
|
443
448
|
});
|
|
444
|
-
|
|
449
|
+
// router.push(`?${queryString}`);
|
|
445
450
|
const data: any = await triggerGetSolidEntities(queryString);
|
|
446
451
|
const newRecords = data.data.records;
|
|
447
452
|
const currentData = kanbanViewData;
|
|
@@ -471,8 +476,6 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
471
476
|
groupData.meta.nextPage = groupData.meta.currentPage + 1
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
479
|
return originalData;
|
|
477
480
|
};
|
|
478
481
|
|
|
@@ -496,7 +499,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
496
499
|
|
|
497
500
|
|
|
498
501
|
// Handle drag-and-drop functionality
|
|
499
|
-
const onDragEnd = (result: DropResult): void => {
|
|
502
|
+
const onDragEnd = async (result: DropResult): void => {
|
|
500
503
|
const { source, destination } = result;
|
|
501
504
|
if (!destination) return;
|
|
502
505
|
|
|
@@ -584,20 +587,21 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
584
587
|
};
|
|
585
588
|
|
|
586
589
|
|
|
587
|
-
|
|
588
|
-
const
|
|
590
|
+
// Handle SwimLane Pagination
|
|
591
|
+
const handleSwimLanePagination = async () => {
|
|
589
592
|
|
|
590
593
|
if (solidKanbanViewMetaData) {
|
|
591
594
|
|
|
592
|
-
const
|
|
595
|
+
const swimlanesCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
|
|
593
596
|
const queryData = {
|
|
594
|
-
offset: swimLaneCurrentPageNumber *
|
|
595
|
-
limit:
|
|
597
|
+
offset: swimLaneCurrentPageNumber * swimlanesCount,
|
|
598
|
+
limit: swimlanesCount,
|
|
596
599
|
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
597
600
|
groupBy: groupByFieldName,
|
|
601
|
+
populateMedia: toPopulateMedia,
|
|
598
602
|
populateGroup: true,
|
|
599
603
|
groupFilter: {
|
|
600
|
-
limit:
|
|
604
|
+
limit: recordsInSwimlane,
|
|
601
605
|
offset: 0,
|
|
602
606
|
filters: filters,
|
|
603
607
|
populate: toPopulate,
|
|
@@ -610,7 +614,11 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
610
614
|
const queryString = qs.stringify(queryData, {
|
|
611
615
|
encodeValuesOnly: true
|
|
612
616
|
});
|
|
613
|
-
|
|
617
|
+
|
|
618
|
+
//Push to Router
|
|
619
|
+
router.push(`?${queryString}`);
|
|
620
|
+
|
|
621
|
+
|
|
614
622
|
const data: any = await triggerGetSolidEntities(queryString);
|
|
615
623
|
if (data && data?.data?.groupRecords.length > 0) {
|
|
616
624
|
const updatedData = [...kanbanViewData, ...data.data.groupRecords];
|
|
@@ -620,64 +628,74 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
620
628
|
}
|
|
621
629
|
}
|
|
622
630
|
|
|
623
|
-
const handleApplyCustomFilter = async (filters: any) => {
|
|
624
631
|
|
|
632
|
+
// Handle the custom filter and Search Filter
|
|
633
|
+
const handleApplyCustomFilter = async (transformedFilter: any) => {
|
|
625
634
|
|
|
626
|
-
|
|
627
|
-
setFilters(filters)
|
|
635
|
+
if (solidKanbanViewMetaData) {
|
|
628
636
|
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
637
|
+
|
|
638
|
+
const queryfilter = {
|
|
639
|
+
$and: [
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
if (transformedFilter.s_filter) {
|
|
643
|
+
queryfilter.$and.push(transformedFilter.s_filter)
|
|
644
|
+
}
|
|
645
|
+
if (transformedFilter.c_filter) {
|
|
646
|
+
queryfilter.$and.push(transformedFilter.c_filter)
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
const customFilter = transformedFilter;
|
|
650
|
+
const updatedFilter = { ...(filters || {}), ...(queryfilter || {}) };
|
|
651
|
+
setFilters((prevFilters) => ({ ...(prevFilters || {}), ...(queryfilter || {}) }));
|
|
652
|
+
|
|
653
|
+
const swimlanesCount = solidKanbanViewMetaData?.data.solidView?.layout?.attrs?.swimlanesCount || 5;
|
|
654
|
+
|
|
655
|
+
if (toPopulate) {
|
|
656
|
+
const queryData = {
|
|
638
657
|
offset: 0,
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
658
|
+
limit: swimlanesCount,
|
|
659
|
+
fields: [`${groupByFieldName}`, `count(${groupByFieldName})`],
|
|
660
|
+
groupBy: groupByFieldName,
|
|
661
|
+
populateGroup: true,
|
|
662
|
+
groupFilter: {
|
|
663
|
+
limit: recordsInSwimlane,
|
|
664
|
+
offset: 0,
|
|
665
|
+
filters: updatedFilter,
|
|
666
|
+
populate: toPopulate,
|
|
667
|
+
populateMedia: toPopulateMedia
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
const queryString = qs.stringify(queryData, {
|
|
671
|
+
encodeValuesOnly: true
|
|
672
|
+
});
|
|
642
673
|
|
|
674
|
+
// s_filter and c_filter format that needs to be passed to the router
|
|
675
|
+
// only present if handleCustomFilter is applied
|
|
676
|
+
if (customFilter) {
|
|
677
|
+
let url
|
|
678
|
+
const urlData = queryData;
|
|
679
|
+
delete urlData.filters;
|
|
680
|
+
urlData.s_filter = customFilter.s_filter || {};
|
|
681
|
+
urlData.c_filter = customFilter.c_filter || {};
|
|
682
|
+
queryObjectToQueryString(urlData);
|
|
643
683
|
}
|
|
644
|
-
// sort: [`id:desc`],
|
|
645
|
-
};
|
|
646
|
-
// fields=status&groupBy=status&fields=count(status)&populateGroup=true
|
|
647
|
-
const queryString = qs.stringify(queryData, {
|
|
648
|
-
encodeValuesOnly: true
|
|
649
|
-
});
|
|
650
684
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
685
|
+
|
|
686
|
+
const data: any = await triggerGetSolidEntities(queryString);
|
|
687
|
+
|
|
688
|
+
// Update the kanban view data with the new data based on filter
|
|
689
|
+
if (data && data?.data?.groupRecords.length > 0) {
|
|
690
|
+
const updatedData = [...data.data.groupRecords];
|
|
691
|
+
setKanbanViewData(updatedData);
|
|
692
|
+
}
|
|
693
|
+
setSelectedRecords([]);
|
|
694
|
+
|
|
657
695
|
}
|
|
658
|
-
setSelectedRecords([]);
|
|
659
696
|
}
|
|
660
|
-
// if (toPopulate) {
|
|
661
|
-
// const queryData = {
|
|
662
|
-
// offset: 0,
|
|
663
|
-
// limit: 25,
|
|
664
|
-
// populate: toPopulate,
|
|
665
|
-
// sort: [`id:desc`],
|
|
666
|
-
// filters: { ...transformedFilter.filters }
|
|
667
|
-
// };
|
|
668
|
-
// if (params.embeded) {
|
|
669
|
-
|
|
670
|
-
// }
|
|
671
|
-
// const queryString = qs.stringify(queryData, {
|
|
672
|
-
// encodeValuesOnly: true
|
|
673
|
-
// });
|
|
674
|
-
|
|
675
|
-
// triggerGetSolidEntities(queryString);
|
|
676
|
-
// // setShowGlobalSearchElement(false)
|
|
677
|
-
// setSelectedRecords([]);
|
|
678
|
-
// }
|
|
679
|
-
}
|
|
680
697
|
|
|
698
|
+
}
|
|
681
699
|
|
|
682
700
|
useEffect(() => {
|
|
683
701
|
if (solidKanbanViewMetaData) {
|
|
@@ -742,7 +760,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
|
|
|
742
760
|
</div>
|
|
743
761
|
<style>{`.p-datatable .p-datatable-loading-overlay {background-color: rgba(0, 0, 0, 0.0);}`}</style>
|
|
744
762
|
{solidKanbanViewMetaData && kanbanViewData &&
|
|
745
|
-
<KanbanBoard groupedView={groupedView} kanbanViewData={kanbanViewData} solidKanbanViewMetaData={solidKanbanViewMetaData?.data} setKanbanViewData={setKanbanViewData} handleLoadMore={handleLoadMore} onDragEnd={onDragEnd}
|
|
763
|
+
<KanbanBoard groupedView={groupedView} kanbanViewData={kanbanViewData} solidKanbanViewMetaData={solidKanbanViewMetaData?.data} setKanbanViewData={setKanbanViewData} handleLoadMore={handleLoadMore} onDragEnd={onDragEnd} handleSwimLanePagination={handleSwimLanePagination} setLightboxUrls={setLightboxUrls} setOpenLightbox={setOpenLightbox} editButtonUrl={editButtonUrl}></KanbanBoard>
|
|
746
764
|
}
|
|
747
765
|
|
|
748
766
|
<Dialog
|
|
@@ -11,7 +11,8 @@ import { PDFSvg } from '@/components/Svg/PDFSvg';
|
|
|
11
11
|
import Image from 'next/image';
|
|
12
12
|
import FileImage from '../../../../resources/images/fileTypes/File.png'
|
|
13
13
|
import { ExcelSvg } from '@/components/Svg/ExcelSvg';
|
|
14
|
-
|
|
14
|
+
import MP3Image from '../../../../resources/images/fileTypes/Mp3.png'
|
|
15
|
+
import MP4Image from '../../../../resources/images/fileTypes/Mp4.png'
|
|
15
16
|
|
|
16
17
|
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
|
|
17
18
|
|
|
@@ -83,11 +84,53 @@ const SolidMediaSingleKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, f
|
|
|
83
84
|
</a>
|
|
84
85
|
</div>
|
|
85
86
|
)}
|
|
87
|
+
|
|
88
|
+
{mimeType && mimeType.includes("audio") && (
|
|
89
|
+
<div className='flex align-items-end gap-2 my-2' onClick={(e) => e.stopPropagation()}>
|
|
90
|
+
<a href={url} download target="_blank" rel="noopener noreferrer">
|
|
91
|
+
<Image
|
|
92
|
+
src={MP3Image}
|
|
93
|
+
alt={fileName}
|
|
94
|
+
className="relative"
|
|
95
|
+
height={50}
|
|
96
|
+
width={50}
|
|
97
|
+
/>
|
|
98
|
+
</a>
|
|
99
|
+
<a href={url} download target="_blank" rel="noopener noreferrer" className='text-color flex align-items-start gap-2' style={{ textDecoration: 'none' }}>
|
|
100
|
+
<p className="text-sm mb-1" style={{ wordWrap: 'break-word', overflowWrap: 'break-word' }}>
|
|
101
|
+
{fileName}
|
|
102
|
+
</p>
|
|
103
|
+
<span className='pi pi-cloud-download'></span>
|
|
104
|
+
</a>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
{mimeType && mimeType.includes("video") && (
|
|
108
|
+
<div className='flex align-items-end gap-2 my-2' onClick={(e) => e.stopPropagation()}>
|
|
109
|
+
<a href={url} download target="_blank" rel="noopener noreferrer">
|
|
110
|
+
<Image
|
|
111
|
+
src={MP4Image}
|
|
112
|
+
alt={fileName}
|
|
113
|
+
className="relative"
|
|
114
|
+
height={50}
|
|
115
|
+
width={50}
|
|
116
|
+
/>
|
|
117
|
+
</a>
|
|
118
|
+
<a href={url} download target="_blank" rel="noopener noreferrer" className='text-color flex align-items-start gap-2' style={{ textDecoration: 'none' }}>
|
|
119
|
+
<p className="text-sm mb-1" style={{ wordWrap: 'break-word', overflowWrap: 'break-word' }}>
|
|
120
|
+
{fileName}
|
|
121
|
+
</p>
|
|
122
|
+
<span className='pi pi-cloud-download'></span>
|
|
123
|
+
</a>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
|
|
86
127
|
{mimeType &&
|
|
87
128
|
!mimeType.includes("image/") &&
|
|
88
129
|
!mimeType.includes("pdf") &&
|
|
89
130
|
!mimeType.includes("excel") &&
|
|
90
|
-
!mimeType.includes("spreadsheet") &&
|
|
131
|
+
!mimeType.includes("spreadsheet") &&
|
|
132
|
+
!mimeType.includes("audio") &&
|
|
133
|
+
!mimeType.includes("video") && (
|
|
91
134
|
<div className='flex align-items-end gap-2 my-2' onClick={(e) => e.stopPropagation()}>
|
|
92
135
|
<a href={url} download target="_blank" rel="noopener noreferrer">
|
|
93
136
|
<Image
|
|
@@ -178,7 +178,7 @@ const CreateModel = ({ data, params }: any) => {
|
|
|
178
178
|
}
|
|
179
179
|
return rest
|
|
180
180
|
});
|
|
181
|
-
const { module, createdAt, updatedAt, id, deletedAt, ...modelData } = modelMetaData;
|
|
181
|
+
const { module, parentModel,createdAt, updatedAt, id, deletedAt, ...modelData } = modelMetaData;
|
|
182
182
|
const updateData = { ...modelData, displayName: modelData.displayName.trim(), fields: fieldData };
|
|
183
183
|
updateModel({ id: data.id, data: updateData });
|
|
184
184
|
}
|
|
@@ -190,7 +190,7 @@ const CreateModel = ({ data, params }: any) => {
|
|
|
190
190
|
}
|
|
191
191
|
return rest
|
|
192
192
|
});
|
|
193
|
-
const { module,
|
|
193
|
+
const { module, parentModel,...modelData } = modelMetaData;
|
|
194
194
|
const data = { ...modelData, displayName: modelData.displayName.trim(), fields: fieldData };
|
|
195
195
|
createModel(data);
|
|
196
196
|
if (isCreateModelSuccess) {
|
|
@@ -173,8 +173,6 @@ const fieldBasedPayloadFormating = (values: any, currentFields: string[], fieldM
|
|
|
173
173
|
if (transformedPayload.relationType == "many-to-many") {
|
|
174
174
|
transformedPayload.isRelationManyToManyOwner = true;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
176
|
return transformedPayload
|
|
179
177
|
|
|
180
178
|
}
|