@solidstarters/solid-core-ui 1.1.56 → 1.1.58

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 (96) 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/core/form/SolidFormUserViewLayout.d.ts.map +1 -1
  6. package/dist/components/core/form/SolidFormUserViewLayout.js +7 -11
  7. package/dist/components/core/form/SolidFormUserViewLayout.js.map +1 -1
  8. package/dist/components/core/form/SolidFormView.d.ts +2 -0
  9. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  10. package/dist/components/core/form/SolidFormView.js +33 -27
  11. package/dist/components/core/form/SolidFormView.js.map +1 -1
  12. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts +6 -1
  13. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  14. package/dist/components/core/form/fields/SolidMediaMultipleField.js +36 -14
  15. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  16. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts +6 -1
  17. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  18. package/dist/components/core/form/fields/SolidMediaSingleField.js +25 -3
  19. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  20. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  21. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +7 -6
  22. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  23. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +1 -1
  24. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts.map +1 -1
  25. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js +23 -7
  26. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js.map +1 -1
  27. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +1 -1
  28. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts.map +1 -1
  29. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js +19 -3
  30. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js.map +1 -1
  31. package/dist/components/core/kanban/KanbanCard.d.ts.map +1 -1
  32. package/dist/components/core/kanban/KanbanCard.js +7 -6
  33. package/dist/components/core/kanban/KanbanCard.js.map +1 -1
  34. package/dist/components/core/kanban/KanbanColumn.d.ts.map +1 -1
  35. package/dist/components/core/kanban/KanbanColumn.js +2 -2
  36. package/dist/components/core/kanban/KanbanColumn.js.map +1 -1
  37. package/dist/components/core/kanban/KanbanUserViewLayout.d.ts.map +1 -1
  38. package/dist/components/core/kanban/KanbanUserViewLayout.js +7 -11
  39. package/dist/components/core/kanban/KanbanUserViewLayout.js.map +1 -1
  40. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  41. package/dist/components/core/kanban/SolidKanbanView.js +34 -36
  42. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  43. package/dist/components/core/kanban/SolidKanbanViewConfigure.js +1 -1
  44. package/dist/components/core/kanban/SolidKanbanViewConfigure.js.map +1 -1
  45. package/dist/components/core/kanban/SolidKanbanViewFields.d.ts +2 -1
  46. package/dist/components/core/kanban/SolidKanbanViewFields.d.ts.map +1 -1
  47. package/dist/components/core/kanban/SolidKanbanViewFields.js +3 -3
  48. package/dist/components/core/kanban/SolidKanbanViewFields.js.map +1 -1
  49. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.d.ts.map +1 -1
  50. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js +10 -2
  51. package/dist/components/core/kanban/kanban-fields/SolidIntKanbanField.js.map +1 -1
  52. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
  53. package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
  54. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts +1 -1
  55. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
  56. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +26 -5
  57. package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
  58. package/dist/components/core/list/SolidListColumnSelector.d.ts.map +1 -1
  59. package/dist/components/core/list/SolidListColumnSelector.js +9 -12
  60. package/dist/components/core/list/SolidListColumnSelector.js.map +1 -1
  61. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  62. package/dist/components/core/list/SolidListView.js +43 -45
  63. package/dist/components/core/list/SolidListView.js.map +1 -1
  64. package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
  65. package/dist/components/core/list/columns/SolidMediaSingleColumn.js +2 -4
  66. package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
  67. package/dist/resources/globals.css +51 -1
  68. package/dist/resources/images/fileTypes/File.png +0 -0
  69. package/dist/resources/images/fileTypes/Mp3.png +0 -0
  70. package/dist/resources/images/fileTypes/Mp4.png +0 -0
  71. package/package.json +1 -1
  72. package/src/components/Svg/PDFSvg.tsx +12 -0
  73. package/src/components/core/form/SolidFormUserViewLayout.tsx +0 -2
  74. package/src/components/core/form/SolidFormView.tsx +24 -10
  75. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +28 -4
  76. package/src/components/core/form/fields/SolidMediaSingleField.tsx +26 -3
  77. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +7 -1
  78. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +20 -3
  79. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +19 -2
  80. package/src/components/core/kanban/KanbanCard.tsx +7 -6
  81. package/src/components/core/kanban/KanbanColumn.tsx +6 -8
  82. package/src/components/core/kanban/KanbanUserViewLayout.tsx +0 -2
  83. package/src/components/core/kanban/SolidKanbanView.tsx +1 -3
  84. package/src/components/core/kanban/SolidKanbanViewConfigure.tsx +1 -1
  85. package/src/components/core/kanban/SolidKanbanViewFields.tsx +23 -22
  86. package/src/components/core/kanban/kanban-fields/SolidIntKanbanField.tsx +10 -3
  87. package/src/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +6 -6
  88. package/src/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +102 -7
  89. package/src/components/core/list/SolidListColumnSelector.tsx +0 -3
  90. package/src/components/core/list/SolidListView.tsx +1 -4
  91. package/src/components/core/list/columns/SolidMediaSingleColumn.tsx +6 -3
  92. package/src/resources/globals.css +51 -1
  93. package/src/resources/images/fileTypes/File.png +0 -0
  94. package/src/resources/images/fileTypes/Mp3.png +0 -0
  95. package/src/resources/images/fileTypes/Mp4.png +0 -0
  96. package/src/types/solid-core.d.ts +3 -1
@@ -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,6 +3027,30 @@ 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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core-ui",
3
- "version": "1.1.56",
3
+ "version": "1.1.58",
4
4
  "scripts": {
5
5
  "prebuild": "npm run copy-styles",
6
6
  "build": "tsc && tsc-alias",
@@ -0,0 +1,12 @@
1
+ import React from 'react'
2
+
3
+ export const PDFSvg = () => {
4
+ return (
5
+ <svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
6
+ <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" />
7
+ <path d="M54.0513 16.32V0L78 24H62.0342C54.8496 24 53.7187 18.88 54.0513 16.32Z" fill="#D4D4D8" />
8
+ <rect x="2" y="38" width="52" height="30" rx="6" fill="#E62E05" />
9
+ <path d="M11.4718 60V46.9091H16.6365C17.6294 46.9091 18.4753 47.0987 19.1742 47.478C19.873 47.853 20.4057 48.375 20.7722 49.044C21.1429 49.7088 21.3283 50.4759 21.3283 51.3452C21.3283 52.2145 21.1408 52.9815 20.7658 53.6463C20.3908 54.3111 19.8475 54.8288 19.1358 55.1996C18.4284 55.5703 17.5719 55.7557 16.5662 55.7557H13.2743V53.5376H16.1188C16.6515 53.5376 17.0904 53.446 17.4355 53.2628C17.785 53.0753 18.0449 52.8175 18.2154 52.4893C18.3901 52.157 18.4775 51.7756 18.4775 51.3452C18.4775 50.9105 18.3901 50.5312 18.2154 50.2074C18.0449 49.8793 17.785 49.6257 17.4355 49.4467C17.0861 49.2635 16.6429 49.1719 16.106 49.1719H14.2395V60H11.4718ZM23.1261 60V46.9091H28.2908C29.2837 46.9091 30.1296 47.0987 30.8285 47.478C31.5273 47.853 32.06 48.375 32.4265 49.044C32.7972 49.7088 32.9826 50.4759 32.9826 51.3452C32.9826 52.2145 32.7951 52.9815 32.4201 53.6463C32.0451 54.3111 31.5018 54.8288 30.7901 55.1996C30.0827 55.5703 29.2262 55.7557 28.2205 55.7557H24.9286V53.5376H27.7731C28.3058 53.5376 28.7447 53.446 29.0898 53.2628C29.4393 53.0753 29.6992 52.8175 29.8697 52.4893C30.0444 52.157 30.1317 51.7756 30.1317 51.3452C30.1317 50.9105 30.0444 50.5312 29.8697 50.2074C29.6992 49.8793 29.4393 49.6257 29.0898 49.4467C28.7404 49.2635 28.2972 49.1719 27.7603 49.1719H25.8938V60H23.1261ZM34.2818 49.1911V46.9091H45.0332V49.1911H41.0254V60H38.2896V49.1911H34.2818Z" fill="white" />
10
+ </svg>
11
+ )
12
+ }
@@ -11,7 +11,6 @@ import { Toast } from "primereact/toast";
11
11
 
12
12
  export const SolidFormUserViewLayout = ({ solidFormViewMetaData, setLayoutDialogVisible }: any) => {
13
13
  const toast = useRef<Toast>(null);
14
- const { user } = useSelector((state: any) => state.auth);
15
14
  const entityApi = createSolidEntityApi("userViewMetadata");
16
15
  const { useUpsertSolidEntityMutation } = entityApi;
17
16
  const [upsertUserView] = useUpsertSolidEntityMutation();
@@ -40,7 +39,6 @@ export const SolidFormUserViewLayout = ({ solidFormViewMetaData, setLayoutDialog
40
39
  try {
41
40
  if (solidView.id) {
42
41
  const response = await upsertUserView({
43
- userId: user?.user?.id,
44
42
  viewMetadataId: solidView.id,
45
43
  layout: JSON.stringify(parsedLayout)
46
44
  }).unwrap();
@@ -44,7 +44,11 @@ import { Panel } from "primereact/panel";
44
44
  import { SolidFormStepper } from "@/components/common/SolidFormStepper";
45
45
  import { SolidFormHeader } from "@/components/common/SolidFormHeader";
46
46
  import { SolidFormUserViewLayout } from "./SolidFormUserViewLayout";
47
- import { useSelector } from "react-redux";
47
+ import Lightbox from "yet-another-react-lightbox";
48
+ import Counter from "yet-another-react-lightbox/plugins/counter";
49
+ import Download from "yet-another-react-lightbox/plugins/download";
50
+ import "yet-another-react-lightbox/styles.css";
51
+ import "yet-another-react-lightbox/plugins/counter.css";
48
52
 
49
53
  export type SolidFormViewProps = {
50
54
  moduleName: string;
@@ -90,7 +94,7 @@ const getLayoutFieldsAsObject = (layout: any[]): any => {
90
94
  }, {});
91
95
  }
92
96
 
93
- const fieldFactory = (type: string, fieldContext: SolidFieldProps): ISolidField | null => {
97
+ const fieldFactory = (type: string, fieldContext: SolidFieldProps, setLightboxUrls?: any, setOpenLightbox?: any): ISolidField | null => {
94
98
  if (type === 'shortText') {
95
99
  return new SolidShortTextField(fieldContext);
96
100
  }
@@ -131,10 +135,10 @@ const fieldFactory = (type: string, fieldContext: SolidFieldProps): ISolidField
131
135
  return new SolidRelationField(fieldContext);
132
136
  }
133
137
  if (type === 'mediaSingle') {
134
- return new SolidMediaSingleField(fieldContext);
138
+ return new SolidMediaSingleField(fieldContext, setLightboxUrls, setOpenLightbox);
135
139
  }
136
140
  if (type === 'mediaMultiple') {
137
- return new SolidMediaMultipleField(fieldContext);
141
+ return new SolidMediaMultipleField(fieldContext, setLightboxUrls, setOpenLightbox);
138
142
  }
139
143
  if (type === 'password') {
140
144
  return new SolidPasswordField(fieldContext);
@@ -146,7 +150,7 @@ const fieldFactory = (type: string, fieldContext: SolidFieldProps): ISolidField
146
150
  }
147
151
 
148
152
  // solidFieldsMetadata={solidFieldsMetadata} solidView={solidView}
149
- const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur }: any) => {
153
+ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur, setLightboxUrls, setOpenLightbox }: any) => {
150
154
  const fieldContext: SolidFieldProps = {
151
155
  // field metadata - coming from the field-metadata table.
152
156
  fieldMetadata: fieldMetadata,
@@ -162,7 +166,7 @@ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidForm
162
166
  onChange: onChange,
163
167
  onBlur: onBlur
164
168
  }
165
- const solidField = fieldFactory(fieldMetadata?.type, fieldContext);
169
+ const solidField = fieldFactory(fieldMetadata?.type, fieldContext, setLightboxUrls, setOpenLightbox);
166
170
 
167
171
  return solidField?.render(formik);
168
172
  };
@@ -344,7 +348,6 @@ const SolidPage = ({ attrs, children, key }: any) => (
344
348
  // };
345
349
 
346
350
  const SolidFormView = (params: SolidFormViewProps) => {
347
- const { user } = useSelector((state: any) => state.auth);
348
351
  const pathname = usePathname();
349
352
  const router = useRouter();
350
353
  const toast = useRef<Toast>(null);
@@ -358,7 +361,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
358
361
 
359
362
  const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
360
363
  const [viewMode, setViewMode] = useState<"view" | "edit">("view");
361
-
364
+ const [openLightbox, setOpenLightbox] = useState(false);
365
+ const [lightboxUrls, setLightboxUrls] = useState([]);
362
366
  const errorFields: string[] = [];
363
367
 
364
368
  const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
@@ -440,7 +444,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
440
444
 
441
445
  // - - - - - - - - - - - -- - - - - - - - - - - - METADATA here
442
446
  // Get the form view layout & metadata first.
443
- const formViewMetaDataQs = qs.stringify({ ...params, viewType: 'form', userId: user?.user?.id }, {
447
+ const formViewMetaDataQs = qs.stringify({ ...params, viewType: 'form' }, {
444
448
  encodeValuesOnly: true,
445
449
  });
446
450
  const [formViewMetaData, setFormViewMetaData] = useState({});
@@ -659,7 +663,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
659
663
  const event: SolidLoadForm = {
660
664
  fieldsMetadata: solidFormViewMetaData,
661
665
  formData: solidFormViewData?.data,
662
- type: dynamicHeader,
666
+ type: 'onFormLayoutLoad',
663
667
  viewMetadata: solidFormViewMetaData?.data?.solidView
664
668
  }
665
669
  if (dynamicHeader) {
@@ -935,6 +939,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
935
939
  viewMode={viewMode}
936
940
  onChange={formFieldOnXXX}
937
941
  onBlur={formFieldOnXXX}
942
+ setLightboxUrls={setLightboxUrls}
943
+ setOpenLightbox={setOpenLightbox}
938
944
  />;
939
945
  }
940
946
  }
@@ -1292,6 +1298,14 @@ const SolidFormView = (params: SolidFormViewProps) => {
1292
1298
  >
1293
1299
  <SolidFormUserViewLayout solidFormViewMetaData={solidFormViewMetaData} setLayoutDialogVisible={setLayoutDialogVisible} />
1294
1300
  </Dialog>
1301
+ {openLightbox &&
1302
+ <Lightbox
1303
+ open={openLightbox}
1304
+ plugins={[Counter, Download]}
1305
+ close={() => setOpenLightbox(false)}
1306
+ slides={lightboxUrls}
1307
+ />
1308
+ }
1295
1309
  </div>
1296
1310
  );
1297
1311
  }
@@ -19,9 +19,13 @@ import { getExtensionComponent } from "@/helpers/registry";
19
19
  export class SolidMediaMultipleField implements ISolidField {
20
20
 
21
21
  private fieldContext: SolidFieldProps;
22
-
23
- constructor(fieldContext: SolidFieldProps) {
22
+ private setLightboxUrls?: (urls: { src: string; downloadUrl: string }[]) => void;
23
+ private setOpenLightbox?: (open: boolean) => void;
24
+ constructor(fieldContext: SolidFieldProps, setLightboxUrls?: (urls: { src: string; downloadUrl: string }[]) => void,
25
+ setOpenLightbox?: (open: boolean) => void) {
24
26
  this.fieldContext = fieldContext;
27
+ this.setLightboxUrls = setLightboxUrls;
28
+ this.setOpenLightbox = setOpenLightbox;
25
29
  }
26
30
 
27
31
  updateFormData(value: any, formData: FormData): any {
@@ -223,7 +227,27 @@ export class SolidMediaMultipleField implements ISolidField {
223
227
  const widgetProps = {
224
228
  formik: formik,
225
229
  fieldContext: this.fieldContext,
230
+ setLightboxUrls: this.setLightboxUrls,
231
+ setOpenLightbox: this.setOpenLightbox
226
232
  }
233
+
234
+ const handleFileView = (url: any) => {
235
+ if (url?.type.includes('image/')) {
236
+ this.setLightboxUrls?.([
237
+ { src: url.fileUrl, downloadUrl: url.fileUrl },
238
+ ]);
239
+ this.setOpenLightbox?.(true);
240
+ } else {
241
+ const link = document.createElement('a');
242
+ link.href = url.fileUrl;
243
+ link.download = ''; // or specify a file name like 'file.pdf'
244
+ link.target = '_blank';
245
+ document.body.appendChild(link);
246
+ link.click();
247
+ document.body.removeChild(link);
248
+ }
249
+ }
250
+
227
251
  return (
228
252
  <>
229
253
  {viewMode === "view" &&
@@ -268,7 +292,7 @@ export class SolidMediaMultipleField implements ISolidField {
268
292
  <FileReaderExt fileDetails={fileDetails[0]} />
269
293
  <div className="w-full flex flex-column gap-1">
270
294
  <div className="flex align-items-center justify-content-between">
271
- <Link className="font-normal w-11" href={`${fileDetails[0]?.fileUrl}`} target="_blank">{fileDetails[0].name}</Link>
295
+ <p className="font-normal w-9 text-primary m-0" style={{ cursor: 'pointer' }} onClick={() => handleFileView(fileDetails[0])}>{fileDetails[0].name}</p>
272
296
  <div className="flex align-items-center gap-2">
273
297
  <div>
274
298
  <Button
@@ -335,7 +359,7 @@ export class SolidMediaMultipleField implements ISolidField {
335
359
  <FileReaderExt fileDetails={file} />
336
360
  <div className="w-full flex flex-column gap-1">
337
361
  <div className="flex align-items-center justify-content-between">
338
- <Link className="font-normal w-11" href={file?.fileUrl} target="_blank">{file.name}</Link>
362
+ <p className="font-normal w-11 text-primary m-0" style={{ cursor: 'pointer' }} onClick={() => handleFileView(file)}>{file.name}</p>
339
363
  <div className="flex align-items-center gap-2">
340
364
  <div>
341
365
  <Button
@@ -19,9 +19,13 @@ import { getExtensionComponent } from "@/helpers/registry";
19
19
  export class SolidMediaSingleField implements ISolidField {
20
20
 
21
21
  private fieldContext: SolidFieldProps;
22
-
23
- constructor(fieldContext: SolidFieldProps) {
22
+ private setLightboxUrls?: (urls: { src: string; downloadUrl: string }[]) => void;
23
+ private setOpenLightbox?: (open: boolean) => void;
24
+ constructor(fieldContext: SolidFieldProps, setLightboxUrls?: (urls: { src: string; downloadUrl: string }[]) => void,
25
+ setOpenLightbox?: (open: boolean) => void) {
24
26
  this.fieldContext = fieldContext;
27
+ this.setLightboxUrls = setLightboxUrls;
28
+ this.setOpenLightbox = setOpenLightbox;
25
29
  }
26
30
 
27
31
  updateFormData(value: any, formData: FormData): any {
@@ -217,6 +221,25 @@ export class SolidMediaSingleField implements ISolidField {
217
221
  const widgetProps = {
218
222
  formik: formik,
219
223
  fieldContext: this.fieldContext,
224
+ setLightboxUrls: this.setLightboxUrls,
225
+ setOpenLightbox: this.setOpenLightbox
226
+ }
227
+
228
+ const handleFileView = (url: any) => {
229
+ if (url?.type.includes('image/')) {
230
+ this.setLightboxUrls?.([
231
+ { src: url.fileUrl, downloadUrl: url.fileUrl },
232
+ ]);
233
+ this.setOpenLightbox?.(true);
234
+ } else {
235
+ const link = document.createElement('a');
236
+ link.href = url.fileUrl;
237
+ link.download = ''; // or specify a file name like 'file.pdf'
238
+ link.target = '_blank';
239
+ document.body.appendChild(link);
240
+ link.click();
241
+ document.body.removeChild(link);
242
+ }
220
243
  }
221
244
 
222
245
  return (
@@ -262,7 +285,7 @@ export class SolidMediaSingleField implements ISolidField {
262
285
  <FileReaderExt fileDetails={fileDetails} />
263
286
  <div className="w-full flex flex-column gap-1">
264
287
  <div className="flex align-items-start justify-content-between">
265
- <Link className="font-normal w-9 text-primary" href={fileDetails.fileUrl} target="_blank">{fileDetails.name}</Link>
288
+ <p className="font-normal w-9 text-primary m-0" style={{ cursor: 'pointer' }} onClick={() => handleFileView(fileDetails)}>{fileDetails.name}</p>
266
289
  <div className="flex align-items-center gap-2">
267
290
  <div>
268
291
  <Button
@@ -144,12 +144,18 @@ export class SolidRelationOneToManyField implements ISolidField {
144
144
 
145
145
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
146
146
  const viewMode: string = this.fieldContext.viewMode;
147
+
148
+ const userKeyFieldName = fieldMetadata.relationModel?.userKeyField?.name;
149
+
147
150
  let DynamicWidget = getExtensionComponent("SolidFormFieldRelationViewModeWidget");
148
151
  const widgetProps = {
149
152
  label: fieldLabel,
150
- value: formik.values[fieldLayoutInfo.attrs.name],
153
+ value: (this.fieldContext.data[fieldLayoutInfo.attrs.name] || []).map(
154
+ (item: any) => ({ label: item[userKeyFieldName] ?? '' })
155
+ )
151
156
  }
152
157
 
158
+
153
159
  return (
154
160
  <>
155
161
  {viewMode === "view" &&
@@ -7,7 +7,7 @@ import { downloadMediaFile } from "@/helpers/downloadMediaFile";
7
7
  import { SolidMediaSingleFieldWidgetProps } from "@/types/solid-core";
8
8
  import { Dialog } from "primereact/dialog";
9
9
 
10
- export const SolidFormFieldViewMediaMultipleWidget = ({ formik, fieldContext }: SolidMediaSingleFieldWidgetProps) => {
10
+ export const SolidFormFieldViewMediaMultipleWidget = ({ formik, fieldContext, setLightboxUrls, setOpenLightbox }: SolidMediaSingleFieldWidgetProps) => {
11
11
  const [fileDetails, setFileDetails] = useState<{ name: string; type: string; size: number, id: number, fileUrl: string }[]>([]);
12
12
  const [isShowAllFiles, setShowAllFiles] = useState(false);
13
13
  const fieldMetadata = fieldContext.fieldMetadata;
@@ -60,6 +60,23 @@ export const SolidFormFieldViewMediaMultipleWidget = ({ formik, fieldContext }:
60
60
  }
61
61
  }, [formik.values, fieldLayoutInfo.attrs.name]);
62
62
 
63
+ const handleFileView = (url: any) => {
64
+ if (url?.type.includes('image/')) {
65
+ setLightboxUrls?.([
66
+ { src: url.fileUrl, downloadUrl: url.fileUrl },
67
+ ]);
68
+ setOpenLightbox?.(true);
69
+ } else {
70
+ const link = document.createElement('a');
71
+ link.href = url.fileUrl;
72
+ link.download = ''; // or specify a file name like 'file.pdf'
73
+ link.target = '_blank';
74
+ document.body.appendChild(link);
75
+ link.click();
76
+ document.body.removeChild(link);
77
+ }
78
+ }
79
+
63
80
  return (
64
81
  <div className={className}>
65
82
  {showFieldLabel != false &&
@@ -72,7 +89,7 @@ export const SolidFormFieldViewMediaMultipleWidget = ({ formik, fieldContext }:
72
89
  <FileReaderExt fileDetails={fileDetails[0]} />
73
90
  <div className="w-full flex flex-column gap-1">
74
91
  <div className="flex align-items-center justify-content-between">
75
- <Link className="font-normal w-11" href={`${fileDetails[0]?.fileUrl}`} target="_blank">{fileDetails[0].name}</Link>
92
+ <p className="font-normal w-11 text-primary m-0" style={{ cursor: 'pointer' }} onClick={() => handleFileView(fileDetails[0])}>{fileDetails[0].name}</p>
76
93
  <div className="flex align-items-center gap-2">
77
94
  <div>
78
95
  <Button
@@ -124,7 +141,7 @@ export const SolidFormFieldViewMediaMultipleWidget = ({ formik, fieldContext }:
124
141
  <FileReaderExt fileDetails={file} />
125
142
  <div className="w-full flex flex-column gap-1">
126
143
  <div className="flex align-items-center justify-content-between">
127
- <Link className="font-normal w-11" href={file?.fileUrl} target="_blank">{file.name}</Link>
144
+ <p className="font-normal w-11" style={{ cursor: 'pointer' }} onClick={() => handleFileView(file)}>{file.name}</p>
128
145
  <div className="flex align-items-center gap-2">
129
146
  <div>
130
147
  <Button
@@ -6,7 +6,7 @@ import Link from "next/link";
6
6
  import { downloadMediaFile } from "@/helpers/downloadMediaFile";
7
7
  import { SolidMediaSingleFieldWidgetProps } from "@/types/solid-core";
8
8
 
9
- export const SolidFormFieldViewMediaSingleWidget = ({ formik, fieldContext }: SolidMediaSingleFieldWidgetProps) => {
9
+ export const SolidFormFieldViewMediaSingleWidget = ({ formik, fieldContext, setLightboxUrls, setOpenLightbox }: SolidMediaSingleFieldWidgetProps) => {
10
10
  const [fileDetails, setFileDetails] = useState<{ name: string; type: string, fileUrl: string, fileSize: number } | null>(null);
11
11
  const fieldMetadata = fieldContext.fieldMetadata;
12
12
  const fieldLayoutInfo = fieldContext.field;
@@ -52,6 +52,23 @@ export const SolidFormFieldViewMediaSingleWidget = ({ formik, fieldContext }: So
52
52
  }
53
53
  }, [formik.values, fieldLayoutInfo.attrs.name]);
54
54
 
55
+ const handleFileView = (url: any) => {
56
+ if (url?.type.includes('image/')) {
57
+ setLightboxUrls?.([
58
+ { src: url.fileUrl, downloadUrl: url.fileUrl },
59
+ ]);
60
+ setOpenLightbox?.(true);
61
+ } else {
62
+ const link = document.createElement('a');
63
+ link.href = url.fileUrl;
64
+ link.download = ''; // or specify a file name like 'file.pdf'
65
+ link.target = '_blank';
66
+ document.body.appendChild(link);
67
+ link.click();
68
+ document.body.removeChild(link);
69
+ }
70
+ }
71
+
55
72
  return (
56
73
  <div className={className}>
57
74
  <div className="flex flex-column gap-2 mt-4 relative">
@@ -66,7 +83,7 @@ export const SolidFormFieldViewMediaSingleWidget = ({ formik, fieldContext }: So
66
83
  <FileReaderExt fileDetails={fileDetails} />
67
84
  <div className="w-full flex flex-column gap-1">
68
85
  <div className="flex align-items-start justify-content-between">
69
- <Link className="font-normal w-9 text-primary" href={fileDetails.fileUrl} target="_blank">{fileDetails.name}</Link>
86
+ <p className="font-normal w-9 text-primary m-0" style={{ cursor: 'pointer' }} onClick={() => handleFileView(fileDetails)}>{fileDetails.name}</p>
70
87
  <div className="flex align-items-center gap-2">
71
88
  <div>
72
89
  <Button
@@ -21,7 +21,7 @@ interface KanbanCardProps {
21
21
  }
22
22
 
23
23
  // Render columns dynamically based on metadata
24
- const renderFieldsDynamically = (field: any, data: any, solidKanbanViewMetaData: any, setLightboxUrls?: any, setOpenLightbox?: any) => {
24
+ const renderFieldsDynamically = (field: any, data: any, solidKanbanViewMetaData: any, setLightboxUrls?: any, setOpenLightbox?: any, groupedView: boolean) => {
25
25
  if (!solidKanbanViewMetaData) {
26
26
  return;
27
27
  }
@@ -33,7 +33,7 @@ const renderFieldsDynamically = (field: any, data: any, solidKanbanViewMetaData:
33
33
  }
34
34
  const fieldMetadata = solidFieldsMetadata[field.attrs.name];
35
35
  const fieldLayout = field;
36
- return SolidKanbanViewFields({ solidKanbanViewMetaData, fieldMetadata, fieldLayout, data, setLightboxUrls, setOpenLightbox });
36
+ return SolidKanbanViewFields({ solidKanbanViewMetaData, fieldMetadata, fieldLayout, data, setLightboxUrls, setOpenLightbox, groupedView });
37
37
  // return solidView.layout.children?.map((column: any) => {
38
38
  // const fieldMetadata = solidFieldsMetadata[column.attrs.name];
39
39
  // if (!fieldMetadata) {
@@ -45,7 +45,7 @@ const renderFieldsDynamically = (field: any, data: any, solidKanbanViewMetaData:
45
45
  // });
46
46
  };
47
47
 
48
- const KanbanCard: React.FC<KanbanCardProps> = ({ data, solidKanbanViewMetaData, index, setLightboxUrls, setOpenLightbox, editButtonUrl }) => {
48
+ const KanbanCard: React.FC<KanbanCardProps> = ({ data, solidKanbanViewMetaData, index, setLightboxUrls, setOpenLightbox, editButtonUrl, groupedView }) => {
49
49
  const router = useRouter()
50
50
 
51
51
  const SolidRow = ({ children, attrs }: any) => {
@@ -104,7 +104,7 @@ const KanbanCard: React.FC<KanbanCardProps> = ({ data, solidKanbanViewMetaData,
104
104
 
105
105
  const SolidField = ({ field, data, solidKanbanViewMetaData }: any) => {
106
106
 
107
- return renderFieldsDynamically(field, data, solidKanbanViewMetaData, setLightboxUrls, setOpenLightbox)
107
+ return renderFieldsDynamically(field, data, solidKanbanViewMetaData, setLightboxUrls, setOpenLightbox, groupedView)
108
108
  // switch (solidKanbanViewMetaData[field.attrs.name].type) {
109
109
  // case "mediaSingle":
110
110
  // return <img src=""></img>
@@ -164,7 +164,7 @@ const KanbanCard: React.FC<KanbanCardProps> = ({ data, solidKanbanViewMetaData,
164
164
 
165
165
 
166
166
  return (
167
- <Draggable draggableId={String(data.id)} index={index}>
167
+ <Draggable draggableId={String(data.id)} index={index} isDragDisabled={!groupedView}>
168
168
  {(provided: DraggableProvided, snapshot) => (
169
169
  <div
170
170
  className=""
@@ -180,9 +180,10 @@ const KanbanCard: React.FC<KanbanCardProps> = ({ data, solidKanbanViewMetaData,
180
180
  style={{
181
181
  opacity: snapshot.isDragging ? 0.9 : 1,
182
182
  transform: snapshot.isDragging ? "rotate(-2deg)" : "",
183
+ cursor:'pointer'
183
184
  }}
184
185
  elevation={snapshot.isDragging ? 3 : 1}
185
- className="solid-kanban-card"
186
+ className={`${!groupedView ? 'solid-media-card' : 'solid-kanban-card'}`}
186
187
  onClick={() =>
187
188
  router.push(`${editButtonUrl}/${data?.id}`)
188
189
  }
@@ -60,7 +60,7 @@ const KanbanColumn = ({ groupedView, groupByField, solidKanbanViewMetaData, grou
60
60
  </div>
61
61
  }
62
62
  {!group.folded &&
63
- <Button
63
+ <Button
64
64
  onClick={(e: any) => op?.current?.toggle(e)}
65
65
  icon='pi pi-cog'
66
66
  text
@@ -110,7 +110,7 @@ const KanbanColumn = ({ groupedView, groupByField, solidKanbanViewMetaData, grou
110
110
  </div>
111
111
  }
112
112
  {!group.folded && (
113
- <Droppable droppableId={groupByField}>
113
+ <Droppable droppableId={groupByField} isDropDisable={!groupedView}>
114
114
  {(provided: DroppableProvided) => (
115
115
  <div
116
116
  ref={provided.innerRef}
@@ -119,16 +119,14 @@ const KanbanColumn = ({ groupedView, groupByField, solidKanbanViewMetaData, grou
119
119
  className={groupedView === false && "kanban-ungrouped-column-content"}
120
120
  >
121
121
  {groupData.map((data, index) => (
122
- <KanbanCard key={data.id} data={data} solidKanbanViewMetaData={solidKanbanViewMetaData} index={index} setLightboxUrls={setLightboxUrls} setOpenLightbox={setOpenLightbox} editButtonUrl={editButtonUrl}/>
122
+ <KanbanCard groupedView={groupedView} key={data.id} data={data} solidKanbanViewMetaData={solidKanbanViewMetaData} index={index} setLightboxUrls={setLightboxUrls} setOpenLightbox={setOpenLightbox} editButtonUrl={editButtonUrl} />
123
123
  ))}
124
124
  {provided.placeholder}
125
125
  {group.count > 0 && (group.count > (group.limit * group.currentPage)) &&
126
- <a
127
- className="load-more-button"
126
+ <Button text className="kaban-load-more" size="small"
128
127
  onClick={() => handleLoadMore(groupByField)}
129
- >
130
- Load more data... ({group.count - (group.limit * group.currentPage)} remaining)
131
- </a>
128
+ label={`Load more data... ( ${group.count - (group.limit * group.currentPage)} remaining)`}
129
+ />
132
130
  }
133
131
  </div>
134
132
  )}
@@ -11,7 +11,6 @@ import { Toast } from "primereact/toast";
11
11
 
12
12
  export const KanbanUserViewLayout = ({ solidKanbanViewMetaData, setLayoutDialogVisible }: any) => {
13
13
  const toast = useRef<Toast>(null);
14
- const { user } = useSelector((state: any) => state.auth);
15
14
  const entityApi = createSolidEntityApi("userViewMetadata");
16
15
  const { useUpsertSolidEntityMutation } = entityApi;
17
16
  const [upsertUserView] = useUpsertSolidEntityMutation();
@@ -40,7 +39,6 @@ export const KanbanUserViewLayout = ({ solidKanbanViewMetaData, setLayoutDialogV
40
39
  try {
41
40
  if (solidView.id) {
42
41
  const response = await upsertUserView({
43
- userId: user?.user?.id,
44
42
  viewMetadataId: solidView.id,
45
43
  layout: JSON.stringify(parsedLayout),
46
44
  }).unwrap();
@@ -29,7 +29,6 @@ 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
32
 
34
33
 
35
34
 
@@ -41,7 +40,6 @@ type SolidKanbanViewParams = {
41
40
 
42
41
 
43
42
  export const SolidKanbanView = (params: SolidKanbanViewParams) => {
44
- const { user } = useSelector((state: any) => state.auth);
45
43
  const solidGlobalSearchElementRef = useRef();
46
44
  const searchParams = useSearchParams().toString(); // Converts the query params to a string
47
45
  const router = useRouter();
@@ -121,7 +119,7 @@ export const SolidKanbanView = (params: SolidKanbanViewParams) => {
121
119
  } = entityApi;
122
120
 
123
121
  // Get the kanban view layout & metadata first.
124
- const kanbanViewMetaDataQs = qs.stringify({ ...params, viewType: 'kanban', userId: user?.user?.id }, {
122
+ const kanbanViewMetaDataQs = qs.stringify({ ...params, viewType: 'kanban' }, {
125
123
  encodeValuesOnly: true,
126
124
  });
127
125
  const [kanbanViewMetaData, setKanbanViewMetaData] = useState<any>({});
@@ -71,7 +71,7 @@ export const SolidKanbanViewConfigure = ({ solidKanbanViewMetaData, actionsAllow
71
71
  <Button
72
72
  text
73
73
  type="button"
74
- className="w-8rem text-left gap-2 purple-200"
74
+ className="w-8rem text-left text-base gap-2 purple-200"
75
75
  label="Layout"
76
76
  size="small"
77
77
  iconPos="left"