@solidstarters/solid-core-ui 1.1.55 → 1.1.57

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.
Files changed (105) hide show
  1. package/dist/components/Svg/PDFSvg.d.ts +2 -0
  2. package/dist/components/Svg/PDFSvg.d.ts.map +1 -0
  3. package/dist/components/Svg/PDFSvg.js +5 -0
  4. package/dist/components/Svg/PDFSvg.js.map +1 -0
  5. package/dist/components/common/SolidFormStepper.d.ts.map +1 -1
  6. package/dist/components/common/SolidFormStepper.js +0 -4
  7. package/dist/components/common/SolidFormStepper.js.map +1 -1
  8. package/dist/components/core/form/SolidFormUserViewLayout.d.ts +2 -0
  9. package/dist/components/core/form/SolidFormUserViewLayout.d.ts.map +1 -0
  10. package/dist/components/core/form/SolidFormUserViewLayout.js +112 -0
  11. package/dist/components/core/form/SolidFormUserViewLayout.js.map +1 -0
  12. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  13. package/dist/components/core/form/SolidFormView.js +29 -22
  14. package/dist/components/core/form/SolidFormView.js.map +1 -1
  15. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  16. package/dist/components/core/form/fields/SolidMediaMultipleField.js +1 -1
  17. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  18. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  19. package/dist/components/core/form/fields/SolidMediaSingleField.js +1 -1
  20. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  21. package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
  22. package/dist/components/core/form/fields/SolidSelectionDynamicField.js +12 -1
  23. package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
  24. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  25. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +4 -0
  26. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  27. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  28. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +9 -7
  29. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  30. package/dist/components/core/kanban/KanbanCard.d.ts.map +1 -1
  31. package/dist/components/core/kanban/KanbanCard.js +7 -6
  32. package/dist/components/core/kanban/KanbanCard.js.map +1 -1
  33. package/dist/components/core/kanban/KanbanColumn.d.ts.map +1 -1
  34. package/dist/components/core/kanban/KanbanColumn.js +2 -2
  35. package/dist/components/core/kanban/KanbanColumn.js.map +1 -1
  36. package/dist/components/core/kanban/KanbanUserViewLayout.d.ts +2 -0
  37. package/dist/components/core/kanban/KanbanUserViewLayout.d.ts.map +1 -0
  38. package/dist/components/core/kanban/KanbanUserViewLayout.js +112 -0
  39. package/dist/components/core/kanban/KanbanUserViewLayout.js.map +1 -0
  40. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  41. package/dist/components/core/kanban/SolidKanbanView.js +41 -35
  42. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  43. package/dist/components/core/kanban/SolidKanbanViewConfigure.d.ts +1 -1
  44. package/dist/components/core/kanban/SolidKanbanViewConfigure.d.ts.map +1 -1
  45. package/dist/components/core/kanban/SolidKanbanViewConfigure.js +2 -2
  46. package/dist/components/core/kanban/SolidKanbanViewConfigure.js.map +1 -1
  47. package/dist/components/core/kanban/SolidKanbanViewFields.d.ts +2 -1
  48. package/dist/components/core/kanban/SolidKanbanViewFields.d.ts.map +1 -1
  49. package/dist/components/core/kanban/SolidKanbanViewFields.js +3 -3
  50. package/dist/components/core/kanban/SolidKanbanViewFields.js.map +1 -1
  51. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.d.ts.map +1 -1
  52. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js +10 -2
  53. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js.map +1 -1
  54. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
  55. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
  56. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts +1 -1
  57. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
  58. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +26 -5
  59. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
  60. package/dist/components/core/list/SolidListColumnSelector.d.ts +2 -0
  61. package/dist/components/core/list/SolidListColumnSelector.d.ts.map +1 -0
  62. package/dist/components/core/list/SolidListColumnSelector.js +182 -0
  63. package/dist/components/core/list/SolidListColumnSelector.js.map +1 -0
  64. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  65. package/dist/components/core/list/SolidListView.js +48 -45
  66. package/dist/components/core/list/SolidListView.js.map +1 -1
  67. package/dist/components/core/list/SolidListViewConfigure.d.ts +1 -1
  68. package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
  69. package/dist/components/core/list/SolidListViewConfigure.js +7 -49
  70. package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
  71. package/dist/redux/api/solidEntityApi.d.ts +1 -0
  72. package/dist/redux/api/solidEntityApi.d.ts.map +1 -1
  73. package/dist/redux/api/solidEntityApi.js +7 -0
  74. package/dist/redux/api/solidEntityApi.js.map +1 -1
  75. package/dist/resources/globals.css +52 -1
  76. package/dist/resources/images/fileTypes/File.png +0 -0
  77. package/dist/resources/images/fileTypes/Mp3.png +0 -0
  78. package/dist/resources/images/fileTypes/Mp4.png +0 -0
  79. package/package.json +1 -1
  80. package/src/components/Svg/PDFSvg.tsx +12 -0
  81. package/src/components/common/SolidFormStepper.tsx +0 -4
  82. package/src/components/core/form/SolidFormUserViewLayout.tsx +87 -0
  83. package/src/components/core/form/SolidFormView.tsx +30 -5
  84. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +16 -14
  85. package/src/components/core/form/fields/SolidMediaSingleField.tsx +16 -14
  86. package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +12 -4
  87. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +5 -2
  88. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +4 -2
  89. package/src/components/core/kanban/KanbanCard.tsx +7 -6
  90. package/src/components/core/kanban/KanbanColumn.tsx +6 -8
  91. package/src/components/core/kanban/KanbanUserViewLayout.tsx +87 -0
  92. package/src/components/core/kanban/SolidKanbanView.tsx +18 -3
  93. package/src/components/core/kanban/SolidKanbanViewConfigure.tsx +3 -3
  94. package/src/components/core/kanban/SolidKanbanViewFields.tsx +23 -22
  95. package/src/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +10 -3
  96. package/src/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +6 -6
  97. package/src/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +102 -7
  98. package/src/components/core/list/SolidListColumnSelector.tsx +170 -0
  99. package/src/components/core/list/SolidListView.tsx +16 -12
  100. package/src/components/core/list/SolidListViewConfigure.tsx +2 -77
  101. package/src/redux/api/solidEntityApi.tsx +7 -0
  102. package/src/resources/globals.css +52 -1
  103. package/src/resources/images/fileTypes/File.png +0 -0
  104. package/src/resources/images/fileTypes/Mp3.png +0 -0
  105. package/src/resources/images/fileTypes/Mp4.png +0 -0
@@ -1,16 +1,49 @@
1
1
  'use client';
2
+ import { useState } from 'react';
2
3
  import { SolidKanbanViewFieldsParams } from '../SolidKanbanViewFields';
3
-
4
- const SolidShortTextKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout, data, setLightboxUrls, setOpenLightbox }: SolidKanbanViewFieldsParams) => {
4
+ import { Dialog } from 'primereact/dialog';
5
+ import { Document, Page, pdfjs } from "react-pdf";
6
+ import MP3Image from '../../../../resources/images/fileTypes/Mp3.png'
7
+ import MP4Image from '../../../../resources/images/fileTypes/Mp4.png'
8
+ import FileImage from '../../../../resources/images/fileTypes/File.png'
9
+ import Image from 'next/image';
10
+ import { PDFSvg } from '@/components/Svg/PDFSvg';
11
+ const SolidShortTextKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fieldLayout, data, setLightboxUrls, setOpenLightbox, groupedView }: SolidKanbanViewFieldsParams) => {
12
+ const [visible, setVisible] = useState(false);
5
13
  const renderMode = fieldLayout?.attrs?.renderMode ? fieldLayout?.attrs?.renderMode : "text";
6
-
14
+ const mimeType = data && data?.mimeType
15
+ const fileName = data?.originalFileName;
16
+ const PDFHeader = () => {
17
+ return (
18
+ <div className='flex justify-content-between align-items-center'>
19
+ <p className='m-0'>
20
+ {fileName}
21
+ </p>
22
+ <a
23
+ href={data[fieldMetadata.name]}
24
+ download={fileName}
25
+ target="_blank"
26
+ rel="noopener noreferrer"
27
+ className='mr-4'
28
+ >
29
+ <i className='pi pi-download' />
30
+ </a>
31
+ </div>
32
+ )
33
+ }
7
34
  return (
8
35
  <div>
9
- {renderMode === "text" &&
36
+ {renderMode === "text" && groupedView &&
37
+ <p className='font-medium'>{data && data[fieldMetadata.name] ? `${data[fieldMetadata.name]}` : ""}</p>
38
+ }
39
+ {renderMode === "text" && !groupedView && fieldMetadata?.name === 'originalFileName' &&
10
40
  <p className='font-medium'>{data && data[fieldMetadata.name] ? `${data[fieldMetadata.name]}` : ""}</p>
11
41
  }
12
- {renderMode === "image" &&
13
- <div className='my-2'>
42
+ {renderMode === "text" && !groupedView && fieldMetadata?.name === 'mimeType' &&
43
+ <span className='solid-mimetype-chip'>{data && data[fieldMetadata.name] ? `${data[fieldMetadata.name]}` : ""}</span>
44
+ }
45
+ {renderMode === "image" && !groupedView && mimeType && mimeType.includes("image/") &&
46
+ < div className='mt-3'>
14
47
  <img
15
48
  src={data[fieldMetadata.name]}
16
49
  onClick={(event) => {
@@ -18,10 +51,72 @@ const SolidShortTextKanbanField = ({ solidKanbanViewMetaData, fieldMetadata, fie
18
51
  setLightboxUrls([{ src: data[fieldMetadata.name] }]);
19
52
  setOpenLightbox(true);
20
53
  }}
21
- className='kanban-image-preview'
54
+ className={`${!groupedView ? 'kanban-media-image-preview' : 'kanban-image-preview'}`}
22
55
  ></img>
23
56
  </div>
24
57
  }
58
+ {renderMode === "image" && !groupedView && mimeType && mimeType.includes("pdf") && (
59
+ <div className='mt-3' onClick={(e) => e.stopPropagation()}>
60
+ <div className='kanban-media-view-card' onClick={() => setVisible(true)} style={{ cursor: 'pointer' }}>
61
+ <PDFSvg />
62
+ </div>
63
+ <Dialog header={<PDFHeader />} visible={visible} style={{ width: "" }} onHide={() => setVisible(false)} modal>
64
+ <Document file={data[fieldMetadata.name]}>
65
+ <Page pageNumber={1} />
66
+ </Document>
67
+ </Dialog>
68
+ </div>
69
+ )}
70
+
71
+ {renderMode === "image" && !groupedView && mimeType && (mimeType.includes("excel") || mimeType.includes("spreadsheet")) && (
72
+ <a href={data[fieldMetadata.name]} className='kanban-media-view-card mt-3' onClick={(e) => e.stopPropagation()} style={{ cursor: 'pointer' }} download target="_blank" rel="noopener noreferrer">
73
+ <svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
74
+ <path d="M15 10.4147V10.4146C14.9999 5.29959 19.6888 1 25.3892 1H53.5858L77 24.4142V69.5852C77 74.7288 72.5287 78.9999 66.8806 78.9999H25.1406C19.47 78.9999 15 74.7276 15 69.5852V10.4147Z" fill="white" stroke="#DBDBDB" stroke-width="2" />
75
+ <path d="M54.0513 16.32V0L78 24H62.0342C54.8496 24 53.7187 18.88 54.0513 16.32Z" fill="#D4D4D8" />
76
+ <rect x="2" y="38" width="51" height="30" rx="6" fill="#079455" />
77
+ <path d="M13.7955 46.9091L16.4354 51.3707H16.5376L19.1903 46.9091H22.3161L18.321 53.4545L22.4055 60H19.2223L16.5376 55.532H16.4354L13.7507 60H10.5803L14.6776 53.4545L10.657 46.9091H13.7955ZM24.0675 60V46.9091H26.8352V57.718H32.4474V60H24.0675ZM41.3819 50.674C41.3308 50.1584 41.1113 49.7578 40.7235 49.4723C40.3358 49.1868 39.8095 49.044 39.1447 49.044C38.693 49.044 38.3116 49.108 38.0005 49.2358C37.6895 49.3594 37.4508 49.532 37.2846 49.7536C37.1227 49.9751 37.0417 50.2266 37.0417 50.5078C37.0332 50.7422 37.0822 50.9467 37.1887 51.1214C37.2995 51.2962 37.4508 51.4474 37.6426 51.5753C37.8343 51.6989 38.0559 51.8075 38.3074 51.9013C38.5588 51.9908 38.8272 52.0675 39.1127 52.1314L40.2889 52.4126C40.8599 52.5405 41.3841 52.7109 41.8613 52.924C42.3386 53.1371 42.752 53.3991 43.1014 53.7102C43.4508 54.0213 43.7214 54.3878 43.9132 54.8097C44.1092 55.2315 44.2093 55.7152 44.2136 56.2607C44.2093 57.0618 44.0048 57.7564 43.6 58.3445C43.1994 58.9283 42.6199 59.3821 41.8613 59.706C41.1071 60.0256 40.1973 60.1854 39.1319 60.1854C38.0751 60.1854 37.1547 60.0234 36.3706 59.6996C35.5907 59.3757 34.9814 58.8963 34.5424 58.2614C34.1078 57.6222 33.8798 56.8317 33.8585 55.8899H36.5368C36.5666 56.3288 36.6923 56.6953 36.9139 56.9893C37.1397 57.2791 37.4402 57.4986 37.8152 57.6477C38.1944 57.7926 38.6227 57.8651 39.1 57.8651C39.5687 57.8651 39.9757 57.7969 40.3208 57.6605C40.6703 57.5241 40.9409 57.3345 41.1326 57.0916C41.3244 56.8487 41.4203 56.5696 41.4203 56.2543C41.4203 55.9602 41.3329 55.7131 41.1582 55.5128C40.9877 55.3125 40.7363 55.142 40.4039 55.0014C40.0758 54.8608 39.6731 54.733 39.1958 54.6179L37.7704 54.2599C36.6667 53.9915 35.7953 53.5717 35.1561 53.0007C34.5169 52.4297 34.1994 51.6605 34.2037 50.6932C34.1994 49.9006 34.4103 49.2081 34.8365 48.6158C35.2669 48.0234 35.8571 47.5611 36.6071 47.2287C37.3571 46.8963 38.2093 46.7301 39.1639 46.7301C40.1355 46.7301 40.9835 46.8963 41.7079 47.2287C42.4366 47.5611 43.0034 48.0234 43.4082 48.6158C43.813 49.2081 44.0218 49.8942 44.0346 50.674H41.3819Z" fill="white" />
78
+ </svg>
79
+ </a>
80
+ )}
81
+ {renderMode === "image" && !groupedView && mimeType && mimeType.includes("audio") && (
82
+ <a href={data[fieldMetadata.name]} className='kanban-media-view-card my-2' onClick={(e) => e.stopPropagation()} style={{ cursor: 'pointer' }} download target="_blank" rel="noopener noreferrer">
83
+ <Image
84
+ src={MP3Image}
85
+ alt={fileName}
86
+ className="relative"
87
+ height={80}
88
+ width={80}
89
+ />
90
+ </a>
91
+ )}
92
+ {renderMode === "image" && !groupedView && mimeType && mimeType.includes("video") && (
93
+ <a href={data[fieldMetadata.name]} className='kanban-media-view-card mt-3' onClick={(e) => e.stopPropagation()} style={{ cursor: 'pointer' }} download target="_blank" rel="noopener noreferrer">
94
+ <Image
95
+ src={MP4Image}
96
+ alt={fileName}
97
+ className="relative"
98
+ height={80}
99
+ width={80}
100
+ />
101
+ </a>
102
+ )}
103
+
104
+ {renderMode === "image" && !groupedView && mimeType && !mimeType.includes("image/") &&
105
+ !mimeType.includes("pdf") &&
106
+ !mimeType.includes("excel") &&
107
+ !mimeType.includes("spreadsheet") &&
108
+ !mimeType.includes("audio") &&
109
+ !mimeType.includes("video") && (
110
+ <a href={data[fieldMetadata.name]} className='kanban-media-view-card mt-3' onClick={(e) => e.stopPropagation()} style={{ cursor: 'pointer' }} download target="_blank" rel="noopener noreferrer">
111
+ <Image
112
+ src={FileImage}
113
+ alt={fileName}
114
+ className="relative"
115
+ height={80}
116
+ width={80}
117
+ />
118
+ </a>
119
+ )}
25
120
  </div>
26
121
  );
27
122
 
@@ -0,0 +1,170 @@
1
+ "use client"
2
+ import { useFormik } from 'formik';
3
+ import { Button } from 'primereact/button';
4
+ import { Checkbox, CheckboxChangeEvent } from 'primereact/checkbox';
5
+ import React, { useEffect, useRef, useState } from 'react'
6
+ import qs from "qs";
7
+ import { useSelector } from 'react-redux';
8
+ import { createSolidEntityApi } from '@/redux/api/solidEntityApi';
9
+ import { Toast } from "primereact/toast";
10
+
11
+ interface FieldMetadata {
12
+ displayName: string;
13
+ }
14
+
15
+ interface FilterColumns {
16
+ name: string;
17
+ key: string;
18
+ }
19
+
20
+ export const SolidListColumnSelector = ({ listViewMetaData }: any) => {
21
+ const toast = useRef<Toast>(null);
22
+
23
+ const { user } = useSelector((state: any) => state.auth);
24
+ const entityApi = createSolidEntityApi('userViewMetadata');
25
+ const {
26
+ useUpsertSolidEntityMutation
27
+ } = entityApi;
28
+
29
+ const [upsertUserView, { isLoading, error: viewCreateError, isSuccess, data: data }] = useUpsertSolidEntityMutation();
30
+ const showToast = (severity: "success" | "error", summary: string, detail: string) => {
31
+ toast.current?.show({
32
+ severity,
33
+ summary,
34
+ detail,
35
+ life: 3000,
36
+ });
37
+ };
38
+
39
+ if (!listViewMetaData) {
40
+ return;
41
+ }
42
+ if (!listViewMetaData.data) {
43
+ return;
44
+ }
45
+
46
+ const solidView = listViewMetaData?.data?.solidView;
47
+
48
+ // This is a key value map of field name vs field metadata.
49
+ const solidFieldsMetadata = listViewMetaData?.data?.solidFieldsMetadata as Record<string, FieldMetadata>;
50
+
51
+
52
+ if (!solidView || !solidFieldsMetadata) {
53
+ return;
54
+ }
55
+
56
+ const checkedFieldNames = new Set(solidView.layout.children.map((col: { attrs: { name: string } }) => col.attrs.name));
57
+
58
+ const solidListColumns: FilterColumns[] = Object.entries(solidFieldsMetadata).map(([key, field]) => ({
59
+ name: field.displayName,
60
+ key,
61
+ }));
62
+
63
+ const formik = useFormik({
64
+ initialValues: {
65
+ selectedColumns: solidListColumns.filter(col => checkedFieldNames.has(col.key)),
66
+ },
67
+ onSubmit: async (values) => {
68
+ const selectedKeys = values.selectedColumns.map(col => col.key);
69
+
70
+ // Step 1: Extract current children
71
+ const currentChildren = solidView.layout.children;
72
+
73
+ // Step 2: Create a map of all available metadata
74
+ const allFieldMeta = solidFieldsMetadata;
75
+
76
+ // Step 3: Filter children to include only selected keys
77
+ const newChildren = selectedKeys.map((key) => {
78
+ const existingChild = currentChildren.find((child: any) => child.attrs.name === key);
79
+ if (existingChild) {
80
+ return existingChild; // keep original config
81
+ } else {
82
+ // construct a new one if it wasn't in the original
83
+ return {
84
+ type: 'field',
85
+ attrs: {
86
+ name: key,
87
+ label: allFieldMeta[key]?.displayName || key,
88
+ sortable: true,
89
+ filterable: true,
90
+ }
91
+ };
92
+ }
93
+ });
94
+
95
+ // Now build updated solidView
96
+ const updatedView = {
97
+ layout: {
98
+ ...solidView.layout,
99
+ children: newChildren
100
+ }
101
+ };
102
+
103
+ try {
104
+ if (listViewMetaData?.data?.solidView?.id) {
105
+ // Update existing user view
106
+ const response = await upsertUserView({
107
+ userId: user?.user?.id,
108
+ viewMetadataId: listViewMetaData?.data?.solidView?.id,
109
+ layout: JSON.stringify(updatedView.layout),
110
+ }).unwrap();
111
+ if (response.statusCode === 200) {
112
+ showToast("success", "Layout", "Form Layout Updated successfully!");
113
+ window.location.reload();
114
+ }
115
+ console.log("Successfully updated:", response);
116
+ } else {
117
+ // Create new user view
118
+ console.log("Error:");
119
+ }
120
+ } catch (error) {
121
+ console.error("Error updating user view:", error);
122
+ }
123
+
124
+ console.log("Updated solidView", updatedView);
125
+
126
+ },
127
+ });
128
+
129
+ return (
130
+ <>
131
+ <Toast ref={toast} />
132
+ <form onSubmit={formik.handleSubmit} className="flex flex-column gap-1 p-1">
133
+ <div className="flex flex-column gap-3 px-3 cogwheel-column-filter" style={{ maxHeight: 400, overflowY: 'auto' }}>
134
+ {solidListColumns.map((column) => {
135
+ return (
136
+ <div key={column.key} className="flex align-items-center gap-1">
137
+ <Checkbox
138
+ inputId={column.key}
139
+ name="selectedColumns"
140
+ value={column}
141
+ onChange={(e) => {
142
+ const isChecked = formik.values.selectedColumns.some(item => item.key === column.key);
143
+ formik.setFieldValue(
144
+ "selectedColumns",
145
+ isChecked
146
+ ? formik.values.selectedColumns.filter(item => item.key !== column.key)
147
+ : [...formik.values.selectedColumns, column]
148
+ );
149
+ }}
150
+ checked={formik.values.selectedColumns.some(item => item.key === column.key)}
151
+ className="text-base"
152
+ />
153
+ <label htmlFor={column.key} className="ml-2 text-base">
154
+ {column.name}
155
+ </label>
156
+ </div>
157
+ );
158
+ })}
159
+ </div>
160
+ <div className="p-3 flex gap-2">
161
+ <Button type='submit' label="Apply" size="small" />
162
+ <Button type='button' outlined label="Cancel" size="small"
163
+ // @ts-ignore
164
+ onClick={(e) => op.current.hide(e)}
165
+ />
166
+ </div>
167
+ </form>
168
+ </>
169
+ )
170
+ }
@@ -43,6 +43,7 @@ import Download from "yet-another-react-lightbox/plugins/download";
43
43
  import "yet-another-react-lightbox/styles.css";
44
44
  import "yet-another-react-lightbox/plugins/counter.css";
45
45
  import { SolidListViewConfigure } from "./SolidListViewConfigure";
46
+ import { useSelector } from "react-redux";
46
47
 
47
48
 
48
49
  const getRandomInt = (min: number, max: number) => {
@@ -91,6 +92,7 @@ type SolidListViewParams = {
91
92
  export const SolidListView = (params: SolidListViewParams) => {
92
93
 
93
94
  const solidGlobalSearchElementRef = useRef();
95
+ const { user } = useSelector((state: any) => state.auth);
94
96
 
95
97
 
96
98
  const router = useRouter()
@@ -148,7 +150,7 @@ export const SolidListView = (params: SolidListViewParams) => {
148
150
  } = entityApi;
149
151
 
150
152
  // Get the list view layout & metadata first.
151
- const listViewMetaDataQs = qs.stringify({ modelName: params.modelName, moduleName: params.moduleName, viewType: 'list' }, {
153
+ const listViewMetaDataQs = qs.stringify({ modelName: params.modelName, moduleName: params.moduleName, viewType: 'list', userId: user?.user?.id }, {
152
154
  encodeValuesOnly: true,
153
155
  });
154
156
  const [listViewMetaData, setListViewMetaData] = useState({});
@@ -722,23 +724,25 @@ export const SolidListView = (params: SolidListViewParams) => {
722
724
  {actionsAllowed.includes(`${createPermission(params.modelName)}`) && solidListViewMetaData?.data?.solidView?.layout?.attrs?.create !== false && params.embeded !== true &&
723
725
  <SolidCreateButton url={createButtonUrl} />
724
726
  }
725
- {actionsAllowed.includes(`${createPermission(params.modelName)}`) && solidListViewMetaData?.data?.solidView?.layout?.attrs?.create !== false && params.embeded == true && params.inlineCreate == true &&
727
+ {actionsAllowed.includes(`${createPermission(params.modelName)}`) && solidListViewMetaData?.data?.solidView?.layout?.attrs?.create !== false && params.embeded == true && params.inlineCreate == true && params.id !== 'new' &&
726
728
  // < SolidCreateButton url={createButtonUrl} />
727
729
  <Button type="button" icon="pi pi-plus" label="Add" size='small'
728
730
  onClick={() => params.handlePopUpOpen("new")}
729
731
  ></Button>
730
732
  }
731
733
  {/* Button For Manual Refresh */}
732
- <Button
733
- type="button"
734
- size="small"
735
- icon="pi pi-refresh"
736
- severity="secondary"
737
- outlined
738
- onClick={() => {
739
- setQueryString(first, rows, sortField, sortOrder, filters, showArchived);
740
- }}
741
- />
734
+ {params.embeded !== true &&
735
+ <Button
736
+ type="button"
737
+ size="small"
738
+ icon="pi pi-refresh"
739
+ severity="secondary"
740
+ outlined
741
+ onClick={() => {
742
+ setQueryString(first, rows, sortField, sortOrder, filters, showArchived);
743
+ }}
744
+ />
745
+ }
742
746
  {showArchived && <Button type="button" icon="pi pi-refresh" label="Recover" size='small' severity="secondary"
743
747
  onClick={() => setRecoverDialogVisible(true)}
744
748
  ></Button>}
@@ -9,29 +9,9 @@ import { Divider } from "primereact/divider";
9
9
  import { OverlayPanel } from "primereact/overlaypanel";
10
10
  import { RadioButton } from "primereact/radiobutton";
11
11
  import { useEffect, useRef, useState } from "react";
12
+ import { SolidListColumnSelector } from "./SolidListColumnSelector";
12
13
 
13
- interface FieldMetadata {
14
- displayName: string;
15
- }
16
-
17
- interface FilterColumns {
18
- name: string;
19
- key: string;
20
- isChecked: boolean;
21
- }
22
14
  export const SolidListViewConfigure = ({ listViewMetaData, setShowArchived, showArchived, viewData, sizeOptions, setSize, size, viewModes, params, actionsAllowed, selectedRecords, setDialogVisible }: any) => {
23
- if (!listViewMetaData) {
24
- return;
25
- }
26
- if (!listViewMetaData.data) {
27
- return;
28
- }
29
-
30
- const solidView = listViewMetaData?.data?.solidView;
31
-
32
- // This is a key value map of field name vs field metadata.
33
- const solidFieldsMetadata = listViewMetaData?.data?.solidFieldsMetadata as Record<string, FieldMetadata>;
34
-
35
15
  // const [visible, setVisible] = useState<boolean>(false);
36
16
  const op = useRef(null);
37
17
  const customizeLayout = useRef<OverlayPanel | null>(null);
@@ -77,32 +57,6 @@ export const SolidListViewConfigure = ({ listViewMetaData, setShowArchived, show
77
57
  return () => document.removeEventListener("click", handleClickOutside);
78
58
  }, [isOverlayOpen])
79
59
 
80
- if (!solidView || !solidFieldsMetadata) {
81
- return;
82
- }
83
-
84
- const checkedFieldNames = new Set(solidView.layout.children.map((col: { attrs: { name: string } }) => col.attrs.name));
85
-
86
-
87
- const solidListColumns: FilterColumns[] = Object.entries(solidFieldsMetadata).map(([key, field]) => ({
88
- name: field.displayName,
89
- key,
90
- isChecked: checkedFieldNames.has(key),
91
- }));
92
-
93
- const [selectedColumns, setSelectedColumns] = useState<FilterColumns[]>(solidListColumns.filter(col => col.isChecked));
94
-
95
- const onCategoryChange = (e: CheckboxChangeEvent) => {
96
- let _selectedColumns = [...selectedColumns];
97
-
98
- if (e.checked)
99
- _selectedColumns.push(e.value);
100
- else
101
- _selectedColumns = _selectedColumns.filter(column => column.key !== e.value.key);
102
-
103
- setSelectedColumns(_selectedColumns);
104
- };
105
-
106
60
  return (
107
61
  <div className="position-relative">
108
62
  <Button
@@ -147,8 +101,6 @@ export const SolidListViewConfigure = ({ listViewMetaData, setShowArchived, show
147
101
  </label>
148
102
  </div>
149
103
  )}
150
-
151
-
152
104
  </div>
153
105
  </div>
154
106
  <Divider className="m-0" />
@@ -233,34 +185,7 @@ export const SolidListViewConfigure = ({ listViewMetaData, setShowArchived, show
233
185
  </div>
234
186
  </AccordionTab>
235
187
  <AccordionTab header="Column Selector">
236
- <div className="flex flex-column gap-1 p-1">
237
- <div className="flex flex-column gap-3 px-3 cogwheel-column-filter" style={{maxHeight: 400, overflowY:'auto'}}>
238
- {solidListColumns.map((column) => {
239
- return (
240
- <div key={column.key} className="flex align-items-center gap-1">
241
- <Checkbox
242
- inputId={column.key}
243
- name="column"
244
- value={column}
245
- onChange={onCategoryChange}
246
- checked={selectedColumns.some((item) => item.key === column.key)}
247
- className="text-base"
248
- />
249
- <label htmlFor={column.key} className="ml-2 text-base">
250
- {column.name}
251
- </label>
252
- </div>
253
- );
254
- })}
255
- </div>
256
- <div className="p-3 flex gap-2">
257
- <Button label="Apply" size="small" />
258
- <Button outlined label="Cancel" size="small"
259
- // @ts-ignore
260
- onClick={(e) => op.current.hide(e)}
261
- />
262
- </div>
263
- </div>
188
+ <SolidListColumnSelector listViewMetaData={listViewMetaData} />
264
189
  </AccordionTab>
265
190
  </Accordion>
266
191
  </div>
@@ -49,6 +49,13 @@ export const createSolidEntityApi = (entityName: string) => {
49
49
  body: entity
50
50
  }),
51
51
  }),
52
+ upsertSolidEntity: builder.mutation({
53
+ query: (entity) => ({
54
+ url: `/${kebabEntityName}/upsert`,
55
+ method: 'POST',
56
+ body: entity
57
+ }),
58
+ }),
52
59
  updateSolidEntity: builder.mutation({
53
60
  query: ({ id, data }) => ({
54
61
  url: `/${kebabEntityName}/${id}`,
@@ -2484,7 +2484,7 @@ li.header-li-px {
2484
2484
 
2485
2485
  .custom-filter-chip-type {
2486
2486
  display: flex;
2487
- align-items: center;
2487
+ align-items: center;
2488
2488
  padding: 0.25rem 0.5rem !important;
2489
2489
  color: var(--primary-color) !important;
2490
2490
  font-size: 0.875rem !important;
@@ -2967,6 +2967,32 @@ li.header-li-px {
2967
2967
  padding: 9px;
2968
2968
  }
2969
2969
 
2970
+
2971
+ .solid-media-card {
2972
+ box-shadow: none;
2973
+ border-radius: 0.5rem;
2974
+ border: 1px solid #E0E0E0;
2975
+ background: #FAFAFA;
2976
+ padding: 9px;
2977
+ height: 100%;
2978
+ transition: 0.2s linear;
2979
+ }
2980
+
2981
+ .solid-media-card:hover {
2982
+ border: 1px solid #722ED1;
2983
+ background: #F9F0FF;
2984
+ }
2985
+
2986
+ .solid-mimetype-chip {
2987
+ border-radius: 0.25rem;
2988
+ background: #F0F0F0;
2989
+ padding: 0.25rem 0.5rem;
2990
+ color: var(--secondary-dark-color);
2991
+ font-size: 12px;
2992
+ font-weight: 500;
2993
+ line-height: 16px;
2994
+ }
2995
+
2970
2996
  .kanban-group-heading {
2971
2997
  font-weight: 600;
2972
2998
  display: flex;
@@ -3001,10 +3027,35 @@ flex-shrink: 0; */
3001
3027
  box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
3002
3028
  }
3003
3029
 
3030
+
3031
+ .kanban-media-image-preview {
3032
+ /* width: 100px; */
3033
+ /* width: 240px;
3034
+ height: 120px;
3035
+ flex-shrink: 0; */
3036
+ width: 100%;
3037
+ border-radius: 8px;
3038
+ height: 145px;
3039
+ object-fit: contain;
3040
+ background-color: #fff;
3041
+ }
3042
+
3043
+ .kanban-media-view-card {
3044
+ width: 100%;
3045
+ border-radius: 8px;
3046
+ height: 145px;
3047
+ object-fit: contain;
3048
+ background-color: #fff;
3049
+ display: flex;
3050
+ align-items: center;
3051
+ justify-content: center;
3052
+ }
3053
+
3004
3054
  .kanban-image-preview:hover {
3005
3055
  box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
3006
3056
  }
3007
3057
 
3058
+
3008
3059
  .solid-kanban-board-wrapper {
3009
3060
  border-top: 1px solid #CED0D6;
3010
3061
  overflow: hidden;