@solidstarters/solid-core-ui 1.1.10 → 1.1.12

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 (188) hide show
  1. package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
  2. package/dist/components/auth/SolidForgotPassword.js +2 -1
  3. package/dist/components/auth/SolidForgotPassword.js.map +1 -1
  4. package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
  5. package/dist/components/auth/SolidInitialLoginOtp.js +2 -1
  6. package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
  7. package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -1
  8. package/dist/components/auth/SolidInitiateRegisterOtp.js +2 -1
  9. package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -1
  10. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  11. package/dist/components/auth/SolidLogin.js +2 -1
  12. package/dist/components/auth/SolidLogin.js.map +1 -1
  13. package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -1
  14. package/dist/components/auth/SolidOTPVerify.js +2 -1
  15. package/dist/components/auth/SolidOTPVerify.js.map +1 -1
  16. package/dist/components/auth/SolidRegister.d.ts.map +1 -1
  17. package/dist/components/auth/SolidRegister.js +125 -103
  18. package/dist/components/auth/SolidRegister.js.map +1 -1
  19. package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
  20. package/dist/components/auth/SolidResetPassword.js +2 -1
  21. package/dist/components/auth/SolidResetPassword.js.map +1 -1
  22. package/dist/components/common/DropzonePlaceholder.js +1 -1
  23. package/dist/components/common/DropzonePlaceholder.js.map +1 -1
  24. package/dist/components/common/GeneralSettings.d.ts.map +1 -1
  25. package/dist/components/common/GeneralSettings.js +43 -31
  26. package/dist/components/common/GeneralSettings.js.map +1 -1
  27. package/dist/components/core/common/FilterComponent.d.ts +2 -1
  28. package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
  29. package/dist/components/core/common/FilterComponent.js +52 -16
  30. package/dist/components/core/common/FilterComponent.js.map +1 -1
  31. package/dist/components/core/common/SolidConfigureLayoutElement.d.ts +1 -1
  32. package/dist/components/core/common/SolidConfigureLayoutElement.d.ts.map +1 -1
  33. package/dist/components/core/common/SolidConfigureLayoutElement.js +5 -2
  34. package/dist/components/core/common/SolidConfigureLayoutElement.js.map +1 -1
  35. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  36. package/dist/components/core/common/SolidGlobalSearchElement.js +131 -23
  37. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  38. package/dist/components/core/filter/SolidManyToOneFilterElement.d.ts.map +1 -1
  39. package/dist/components/core/filter/SolidManyToOneFilterElement.js +8 -6
  40. package/dist/components/core/filter/SolidManyToOneFilterElement.js.map +1 -1
  41. package/dist/components/core/filter/SolidSelectionDynamicFilterElement.js +1 -1
  42. package/dist/components/core/filter/SolidSelectionDynamicFilterElement.js.map +1 -1
  43. package/dist/components/core/filter/SolidSelectionStaticFilterElement.js +1 -1
  44. package/dist/components/core/filter/SolidSelectionStaticFilterElement.js.map +1 -1
  45. package/dist/components/core/filter/SolidVarInputsFilterElement.d.ts.map +1 -1
  46. package/dist/components/core/filter/SolidVarInputsFilterElement.js +11 -10
  47. package/dist/components/core/filter/SolidVarInputsFilterElement.js.map +1 -1
  48. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  49. package/dist/components/core/form/SolidFormView.js +49 -14
  50. package/dist/components/core/form/SolidFormView.js.map +1 -1
  51. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  52. package/dist/components/core/form/fields/SolidBooleanField.js +9 -5
  53. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  54. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  55. package/dist/components/core/form/fields/SolidDateField.js +12 -8
  56. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  57. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  58. package/dist/components/core/form/fields/SolidDateTimeField.js +12 -8
  59. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  60. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  61. package/dist/components/core/form/fields/SolidDecimalField.js +9 -5
  62. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  63. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  64. package/dist/components/core/form/fields/SolidIntegerField.js +9 -5
  65. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  66. package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
  67. package/dist/components/core/form/fields/SolidJsonField.js +2 -2
  68. package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
  69. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  70. package/dist/components/core/form/fields/SolidLongTextField.js +7 -3
  71. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  72. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  73. package/dist/components/core/form/fields/SolidMediaMultipleField.js +155 -46
  74. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  75. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  76. package/dist/components/core/form/fields/SolidMediaSingleField.js +87 -31
  77. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  78. package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
  79. package/dist/components/core/form/fields/SolidRichTextField.js +2 -2
  80. package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
  81. package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
  82. package/dist/components/core/form/fields/SolidSelectionDynamicField.js +4 -4
  83. package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
  84. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  85. package/dist/components/core/form/fields/SolidSelectionStaticField.js +18 -9
  86. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  87. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  88. package/dist/components/core/form/fields/SolidShortTextField.js +7 -3
  89. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  90. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  91. package/dist/components/core/form/fields/SolidTimeField.js +12 -8
  92. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  93. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +22 -15
  94. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  95. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  96. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +11 -8
  97. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  98. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +2 -2
  99. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  100. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  101. package/dist/components/core/list/SolidListView.js +88 -63
  102. package/dist/components/core/list/SolidListView.js.map +1 -1
  103. package/dist/components/core/list/SolidManyToOneFilterElement.js +7 -5
  104. package/dist/components/core/list/SolidManyToOneFilterElement.js.map +1 -1
  105. package/dist/components/core/list/columns/SolidBooleanColumn.js +3 -1
  106. package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
  107. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +2 -1
  108. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
  109. package/dist/components/core/model/CreateModel.d.ts.map +1 -1
  110. package/dist/components/core/model/CreateModel.js +20 -16
  111. package/dist/components/core/model/CreateModel.js.map +1 -1
  112. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  113. package/dist/components/core/model/FieldMetaDataForm.js +67 -54
  114. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  115. package/dist/components/core/model/FieldSelector.js +1 -1
  116. package/dist/components/core/model/FieldSelector.js.map +1 -1
  117. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  118. package/dist/components/core/model/ModelMetaData.js +12 -17
  119. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  120. package/dist/components/core/module/CreateModule.d.ts.map +1 -1
  121. package/dist/components/core/module/CreateModule.js +23 -23
  122. package/dist/components/core/module/CreateModule.js.map +1 -1
  123. package/dist/components/layout/AppSidebar.d.ts.map +1 -1
  124. package/dist/components/layout/AppSidebar.js +42 -11
  125. package/dist/components/layout/AppSidebar.js.map +1 -1
  126. package/dist/components/layout/navbar-two-menu.d.ts.map +1 -1
  127. package/dist/components/layout/navbar-two-menu.js +6 -2
  128. package/dist/components/layout/navbar-two-menu.js.map +1 -1
  129. package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
  130. package/dist/components/layout/user-profile-menu.js +7 -3
  131. package/dist/components/layout/user-profile-menu.js.map +1 -1
  132. package/dist/helpers/AppTitle.d.ts +4 -0
  133. package/dist/helpers/AppTitle.d.ts.map +1 -0
  134. package/dist/helpers/AppTitle.js +8 -0
  135. package/dist/helpers/AppTitle.js.map +1 -0
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +1 -0
  139. package/dist/index.js.map +1 -1
  140. package/package.json +1 -1
  141. package/src/components/auth/SolidForgotPassword.tsx +2 -6
  142. package/src/components/auth/SolidInitialLoginOtp.tsx +2 -6
  143. package/src/components/auth/SolidInitiateRegisterOtp.tsx +2 -6
  144. package/src/components/auth/SolidLogin.tsx +2 -5
  145. package/src/components/auth/SolidOTPVerify.tsx +4 -7
  146. package/src/components/auth/SolidRegister.tsx +207 -178
  147. package/src/components/auth/SolidResetPassword.tsx +2 -6
  148. package/src/components/common/DropzonePlaceholder.tsx +1 -1
  149. package/src/components/common/GeneralSettings.tsx +310 -193
  150. package/src/components/core/common/FilterComponent.tsx +148 -202
  151. package/src/components/core/common/SolidConfigureLayoutElement.tsx +6 -4
  152. package/src/components/core/common/SolidGlobalSearchElement.tsx +193 -50
  153. package/src/components/core/filter/SolidManyToOneFilterElement.tsx +5 -3
  154. package/src/components/core/filter/SolidSelectionDynamicFilterElement.tsx +1 -1
  155. package/src/components/core/filter/SolidSelectionStaticFilterElement.tsx +1 -1
  156. package/src/components/core/filter/SolidVarInputsFilterElement.tsx +103 -135
  157. package/src/components/core/form/SolidFormView.tsx +64 -25
  158. package/src/components/core/form/fields/SolidBooleanField.tsx +12 -5
  159. package/src/components/core/form/fields/SolidDateField.tsx +9 -4
  160. package/src/components/core/form/fields/SolidDateTimeField.tsx +27 -21
  161. package/src/components/core/form/fields/SolidDecimalField.tsx +9 -2
  162. package/src/components/core/form/fields/SolidIntegerField.tsx +22 -15
  163. package/src/components/core/form/fields/SolidJsonField.tsx +14 -12
  164. package/src/components/core/form/fields/SolidLongTextField.tsx +22 -16
  165. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +257 -79
  166. package/src/components/core/form/fields/SolidMediaSingleField.tsx +148 -61
  167. package/src/components/core/form/fields/SolidRichTextField.tsx +6 -4
  168. package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +6 -5
  169. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +34 -23
  170. package/src/components/core/form/fields/SolidShortTextField.tsx +23 -16
  171. package/src/components/core/form/fields/SolidTimeField.tsx +27 -20
  172. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +9 -9
  173. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +20 -19
  174. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +2 -2
  175. package/src/components/core/list/SolidListView.tsx +91 -49
  176. package/src/components/core/list/SolidManyToOneFilterElement.tsx +2 -2
  177. package/src/components/core/list/columns/SolidBooleanColumn.tsx +2 -2
  178. package/src/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +1 -1
  179. package/src/components/core/model/CreateModel.tsx +92 -81
  180. package/src/components/core/model/FieldMetaDataForm.tsx +166 -87
  181. package/src/components/core/model/FieldSelector.tsx +1 -1
  182. package/src/components/core/model/ModelMetaData.tsx +8 -7
  183. package/src/components/core/module/CreateModule.tsx +181 -183
  184. package/src/components/layout/AppSidebar.tsx +35 -10
  185. package/src/components/layout/navbar-two-menu.tsx +6 -1
  186. package/src/components/layout/user-profile-menu.tsx +20 -8
  187. package/src/helpers/AppTitle.tsx +14 -0
  188. package/src/index.ts +2 -1
@@ -1,6 +1,5 @@
1
1
  'use client';
2
2
  import { DropzonePlaceholder } from "@/components/common/DropzonePlaceholder";
3
- import { DropzoneUpload } from "@/components/common/DropzoneUpload";
4
3
  import { useDeleteMediaMutation } from "@/redux/api/mediaApi";
5
4
  import { Button } from "primereact/button";
6
5
  import { Dialog } from "primereact/dialog";
@@ -10,7 +9,8 @@ import { useDropzone } from "react-dropzone";
10
9
  import * as Yup from 'yup';
11
10
  import { Schema } from "yup";
12
11
  import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
13
-
12
+ import { FileReaderExt } from "@/components/common/FileReaderExt";
13
+ import { ProgressBar } from "primereact/progressbar";
14
14
  export class SolidMediaSingleField implements ISolidField {
15
15
 
16
16
  private fieldContext: SolidFieldProps;
@@ -74,7 +74,7 @@ export class SolidMediaSingleField implements ISolidField {
74
74
  render(formik: FormikObject) {
75
75
  const fieldMetadata = this.fieldContext.fieldMetadata;
76
76
  const fieldLayoutInfo = this.fieldContext.field;
77
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
77
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
78
78
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
79
79
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
80
80
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
@@ -82,6 +82,17 @@ export class SolidMediaSingleField implements ISolidField {
82
82
  const [isDeleteImageDialogVisible, setDeleteImageDialogVisible] = useState(false);
83
83
  const [imageToBeDeletedData, setImageToBeDeletedData] = useState<any>();
84
84
  const [imagesPreview, setImagesPreview] = useState<string | ArrayBuffer | null>(null);
85
+ const [uploadProgress, setUploadProgress] = useState<number>(0);
86
+ const [uploadCompleted, setUploadCompleted] = useState<boolean>(false);
87
+ const [fileDetails, setFileDetails] = useState<{ name: string; type: string } | null>(null);
88
+ const [uploadedSize, setUploadedSize] = useState<string>("0 MB");
89
+ const [totalSize, setTotalSize] = useState<string>("0 KB");
90
+
91
+ const formatFileSize = (size: number) => {
92
+ return size >= 1024 * 1024
93
+ ? `${(size / (1024 * 1024)).toFixed(1)} MB`
94
+ : `${(size / 1024).toFixed(1)} KB`;
95
+ };
85
96
 
86
97
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
87
98
  const fieldReadonly = fieldLayoutInfo.attrs?.readonly;
@@ -102,30 +113,92 @@ export class SolidMediaSingleField implements ISolidField {
102
113
  formik.setFieldValue(fieldLayoutInfo.attrs.name, null);
103
114
  setDeleteImageDialogVisible(false);
104
115
  };
116
+ const handleCancelUpload = (e: React.MouseEvent) => {
117
+ e.stopPropagation();
118
+ if (imageToBeDeletedData?.imagesPreview.id) {
119
+ deleteMedia(imageToBeDeletedData.imagesPreview.id);
120
+ }
121
+ e.stopPropagation();
122
+ setUploadProgress(0);
123
+ setUploadCompleted(false);
124
+ setFileDetails(null);
125
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, null);
126
+ setDeleteImageDialogVisible(false);
127
+ };
105
128
 
106
129
  const handleDropImage = (acceptedFiles: File[]) => {
130
+ // const file = acceptedFiles[0];
131
+ // if (file) {
132
+ // formik.setFieldValue(fieldLayoutInfo.attrs.name, file);
133
+ // } else {
134
+ // console.error("No file was accepted");
135
+ // }
107
136
  const file = acceptedFiles[0];
108
- if (file) {
109
- formik.setFieldValue(fieldLayoutInfo.attrs.name, file);
110
- } else {
111
- console.error("No file was accepted");
112
- }
137
+ if (!file) return;
138
+
139
+ setUploadCompleted(false);
140
+ setUploadProgress(0);
141
+ setTotalSize(formatFileSize(file.size));
142
+ setUploadedSize("0 KB");
143
+ setFileDetails({ name: file.name, type: file.type });
144
+
145
+ const reader = new FileReader();
146
+
147
+ reader.onloadstart = () => {
148
+ setUploadProgress(0);
149
+ setUploadedSize("0 KB");
150
+ };
151
+ reader.onprogress = (event) => {
152
+ if (event.loaded && event.total) {
153
+ const percent = Math.round((event.loaded / event.total) * 100);
154
+ setUploadProgress(percent);
155
+ setUploadedSize(formatFileSize(event.loaded));
156
+ }
157
+ };
158
+
159
+ reader.onloadend = () => {
160
+ setUploadProgress(100);
161
+ setUploadCompleted(true);
162
+ setUploadedSize(totalSize); // Set uploaded size to total size after completion
163
+ };
164
+
165
+ reader.readAsDataURL(file);
166
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, file);
113
167
  };
114
168
 
169
+ // useEffect(() => {
170
+ // const fieldValue = formik?.values[fieldLayoutInfo.attrs.name];
171
+
172
+ // if (fieldValue instanceof File) {
173
+ // setImagesPreview(URL.createObjectURL(fieldValue)); // Generate preview URL for file
174
+ // }
175
+ // if (typeof fieldValue === 'object') {
176
+ // setImagesPreview(fieldValue); // Generate preview URL for file
177
+ // }
178
+ // if (!fieldValue) {
179
+ // setImagesPreview(null);
180
+ // }
181
+ // }, [formik.values, fieldLayoutInfo.attrs.name]);
115
182
  useEffect(() => {
116
183
  const fieldValue = formik?.values[fieldLayoutInfo.attrs.name];
117
184
 
118
- if (fieldValue instanceof File) {
119
- setImagesPreview(URL.createObjectURL(fieldValue)); // Generate preview URL for file
120
- }
121
- if (typeof fieldValue === 'object') {
122
- setImagesPreview(fieldValue); // Generate preview URL for file
123
- }
124
- if (!fieldValue) {
125
- setImagesPreview(null);
185
+ if (fieldValue && typeof fieldValue === "object") {
186
+ const fileUrl = fieldValue._full_url;
187
+ if (typeof fileUrl === "string" && fileUrl.length > 0) {
188
+ const fileName = fileUrl.split("/").pop(); // Extract filename from URL
189
+ setFileDetails({ name: fileName || "Unknown File", type: "Uploaded File" });
190
+
191
+ // Set upload progress
192
+ setUploadProgress(100);
193
+ setUploadCompleted(true);
194
+
195
+ // Ensure Formik has the existing file URL
196
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, fieldValue);
197
+ }
126
198
  }
127
199
  }, [formik.values, fieldLayoutInfo.attrs.name]);
128
200
 
201
+
129
202
  const {
130
203
  getRootProps: getRootProps,
131
204
  getInputProps: getInputProps,
@@ -156,61 +229,75 @@ export class SolidMediaSingleField implements ISolidField {
156
229
 
157
230
  return (
158
231
  <div className={className}>
159
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
160
- &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
161
- </label>
162
- <div
163
- {...getRootProps()}
164
- className="dropzone p-3 border-1 border-round surface-border"
165
- >
166
- <input {...getInputProps()} />
167
-
168
- {isDragActive ? (
232
+ <div className="flex flex-column gap-2 mt-4">
233
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
234
+ &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
235
+ </label>
236
+ <div
237
+ {...getRootProps()}
238
+ className="solid-dropzone-wrapper"
239
+ >
240
+ <input {...getInputProps()} />
169
241
  <DropzonePlaceholder />
170
- ) : imagesPreview ? (
171
- <div className="relative">
172
- <img
173
- src={imageFormatHandler(imagesPreview) as string}
174
- alt="Banner Image"
175
- className="bg-white h-10rem w-14rem"
176
- />
177
- <Button
178
- type="button"
179
- onClick={(e) => {
180
- e.stopPropagation();
181
- setDeleteImageDialogVisible(true);
182
- const data = {
183
- e, imagesPreview
242
+ </div>
243
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
244
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
245
+ )}
246
+ {fileDetails && (
247
+ <div className="solid-file-upload-wrapper">
248
+ <div className="flex align-items-center gap-2">
249
+ <FileReaderExt fileDetails={fileDetails} />
250
+ <div className="w-full flex flex-column gap-1">
251
+ <div className="flex align-items-center justify-content-between">
252
+ <div className="font-bold">{fileDetails.name}</div>
253
+ <div className="cancel-upload-button" onClick={() => setDeleteImageDialogVisible(true)}>
254
+ <svg xmlns="http://www.w3.org/2000/svg" width="6" height="6" viewBox="0 0 6 6" fill="none">
255
+ <path d="M0.6 6L0 5.4L2.4 3L0 0.6L0.6 0L3 2.4L5.4 0L6 0.6L3.6 3L6 5.4L5.4 6L3 3.6L0.6 6Z" fill="#4B4D52" />
256
+ </svg>
257
+ </div>
258
+ </div>
259
+ {
260
+ uploadCompleted ?
261
+ <div className="flex align-items-center gap-2 text-sm">
262
+ {totalSize} of {totalSize}
263
+ <svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4" fill="none">
264
+ <circle cx="2" cy="2" r="2" fill="#C1C1C1" />
265
+ </svg>
266
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
267
+ <mask id="mask0_2480_8635" style={{ maskType: 'alpha' }} maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
268
+ <rect width="20" height="20" fill="#D9D9D9" />
269
+ </mask>
270
+ <g mask="url(#mask0_2480_8635)">
271
+ <path d="M9.16 12.76L13.39 8.53L12.55 7.69L9.16 11.08L7.45 9.37L6.61 10.21L9.16 12.76ZM10 16C9.17 16 8.39 15.8424 7.66 15.5272C6.93 15.2124 6.295 14.785 5.755 14.245C5.215 13.705 4.7876 13.07 4.4728 12.34C4.1576 11.61 4 10.83 4 10C4 9.17 4.1576 8.39 4.4728 7.66C4.7876 6.93 5.215 6.295 5.755 5.755C6.295 5.215 6.93 4.7874 7.66 4.4722C8.39 4.1574 9.17 4 10 4C10.83 4 11.61 4.1574 12.34 4.4722C13.07 4.7874 13.705 5.215 14.245 5.755C14.785 6.295 15.2124 6.93 15.5272 7.66C15.8424 8.39 16 9.17 16 10C16 10.83 15.8424 11.61 15.5272 12.34C15.2124 13.07 14.785 13.705 14.245 14.245C13.705 14.785 13.07 15.2124 12.34 15.5272C11.61 15.8424 10.83 16 10 16Z" fill="#722ED1" />
272
+ </g>
273
+ </svg>
274
+ Completed
275
+ </div>
276
+ :
277
+ <div className="flex align-items-center gap-2 text-sm">
278
+ {uploadedSize} of {totalSize}
279
+ <svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4" fill="none">
280
+ <circle cx="2" cy="2" r="2" fill="#C1C1C1" />
281
+ </svg>
282
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
283
+ <path d="M7.375 10.5V5.40625L5.75 7.03125L4.875 6.125L8 3L11.125 6.125L10.25 7.03125L8.625 5.40625V10.5H7.375ZM4.25 13C3.90625 13 3.61198 12.8776 3.36719 12.6328C3.1224 12.388 3 12.0938 3 11.75V9.875H4.25V11.75H11.75V9.875H13V11.75C13 12.0938 12.8776 12.388 12.6328 12.6328C12.388 12.8776 12.0938 13 11.75 13H4.25Z" fill="black" />
284
+ </svg>
285
+ Uploading ${uploadProgress}% Completed
286
+ </div>
184
287
  }
185
- setImageToBeDeletedData(data)
186
- }}
187
- icon="pi pi-trash"
188
- severity="secondary"
189
- outlined
190
- aria-label="Bookmark"
191
- className="absolute right-0 top-0 bg-white z-5 m-2"
192
- style={{
193
- height: 25,
194
- width: 25,
195
- }}
196
- />
197
- <DropzoneUpload />
288
+ </div>
289
+ </div>
290
+ <ProgressBar value={uploadProgress} showValue={false} style={{ height: 4 }} className="mt-2" />
198
291
  </div>
199
- ) : (
200
- <DropzonePlaceholder />
201
292
  )}
202
- { }
203
293
  </div>
204
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
205
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
206
- )}
207
294
  <Dialog
208
295
  visible={isDeleteImageDialogVisible}
209
296
  header="Confirm Delete"
210
297
  modal
211
298
  footer={() => (
212
299
  <div className="flex justify-content-center">
213
- <Button label="Yes" icon="pi pi-check" className='small-button' severity="danger" autoFocus onClick={handleDelete} />
300
+ <Button label="Yes" icon="pi pi-check" className='small-button' severity="danger" autoFocus onClick={handleCancelUpload} />
214
301
  <Button label="No" icon="pi pi-times" className='small-button' onClick={() => setDeleteImageDialogVisible(false)} />
215
302
  </div>
216
303
  )}
@@ -221,4 +308,4 @@ export class SolidMediaSingleField implements ISolidField {
221
308
  </div>
222
309
  );
223
310
  }
224
- }
311
+ }
@@ -57,7 +57,7 @@ export class SolidRichTextField implements ISolidField {
57
57
  render(formik: FormikObject) {
58
58
  const fieldMetadata = this.fieldContext.fieldMetadata;
59
59
  const fieldLayoutInfo = this.fieldContext.field;
60
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
60
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
61
61
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
62
62
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
63
63
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
@@ -73,6 +73,7 @@ export class SolidRichTextField implements ISolidField {
73
73
 
74
74
  return (
75
75
  <div className={className}>
76
+ <div className="flex flex-column gap-2 mt-4">
76
77
  <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
77
78
  &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
78
79
  </label>
@@ -85,9 +86,10 @@ export class SolidRichTextField implements ISolidField {
85
86
  onTextChange={e => formik.setFieldValue(fieldLayoutInfo.attrs.name, e.htmlValue)}
86
87
  style={{ height: "320px" }}
87
88
  />
88
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
89
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
90
- )}
89
+ </div>
90
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
91
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
92
+ )}
91
93
  </div>
92
94
  );
93
95
  }
@@ -51,7 +51,7 @@ export class SolidSelectionDynamicField implements ISolidField {
51
51
  render(formik: FormikObject) {
52
52
  const fieldMetadata = this.fieldContext.fieldMetadata;
53
53
  const fieldLayoutInfo = this.fieldContext.field;
54
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
54
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
55
55
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
56
56
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
57
57
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
@@ -93,8 +93,8 @@ export class SolidSelectionDynamicField implements ISolidField {
93
93
 
94
94
  return (
95
95
  <div className={className}>
96
+ <div className="flex flex-column gap-2 mt-4">
96
97
  <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
97
-
98
98
  &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
99
99
  </label>
100
100
  <AutoComplete
@@ -109,9 +109,10 @@ export class SolidSelectionDynamicField implements ISolidField {
109
109
  completeMethod={selectionDynamicSearch}
110
110
  // onChange={(e) => updateInputs(index, e.value)} />
111
111
  onChange={formik.handleChange} />
112
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
113
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
114
- )}
112
+ </div>
113
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
114
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
115
+ )}
115
116
  </div>
116
117
  );
117
118
  }
@@ -22,12 +22,17 @@ export class SolidSelectionStaticField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- // TODO: Use the field metadata to re-create the object in the valid format
26
- // {label: '', value: ''}
27
- const optionValue = this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ // Get field name and metadata
26
+ const fieldName = this.fieldContext.field.attrs.name;
28
27
  const fieldMetadata = this.fieldContext.fieldMetadata;
28
+ const fieldDefaultValue = fieldMetadata?.defaultValue;
29
29
 
30
- const getDisplayValue = (value: string): string | null => {
30
+ // Get existing value from form data
31
+ const existingValue = this.fieldContext.data[fieldName];
32
+
33
+ // Function to get display value based on selectionStaticValues
34
+ const getDisplayValue = (value: string | null): string | null => {
35
+ if (!value) return null;
31
36
  for (const item of fieldMetadata.selectionStaticValues) {
32
37
  const [lhs, rhs] = item.split(':');
33
38
  if (lhs === value) {
@@ -37,11 +42,16 @@ export class SolidSelectionStaticField implements ISolidField {
37
42
  return null;
38
43
  };
39
44
 
40
- const displayValue = getDisplayValue(optionValue)
45
+ // Determine the final value to use (existing value or default value)
46
+ const finalValue = existingValue ?? fieldDefaultValue ?? '';
47
+
48
+ // Get display value for the final value
49
+ const displayValue = getDisplayValue(finalValue);
41
50
 
42
- return { label: displayValue ?? '', value: optionValue };
51
+ return { label: displayValue ?? '', value: finalValue };
43
52
  }
44
53
 
54
+
45
55
  validationSchema(): Schema {
46
56
 
47
57
  const fieldMetadata = this.fieldContext.fieldMetadata;
@@ -62,7 +72,7 @@ export class SolidSelectionStaticField implements ISolidField {
62
72
  render(formik: FormikObject) {
63
73
  const fieldMetadata = this.fieldContext.fieldMetadata;
64
74
  const fieldLayoutInfo = this.fieldContext.field;
65
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
75
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
66
76
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
67
77
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
68
78
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
@@ -88,22 +98,23 @@ export class SolidSelectionStaticField implements ISolidField {
88
98
 
89
99
  return (
90
100
  <div className={className}>
91
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
92
- &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
93
- </label>
94
- <AutoComplete
95
- readOnly={formReadonly || fieldReadonly}
96
- disabled={formDisabled || fieldDisabled}
97
- {...formik.getFieldProps(fieldLayoutInfo.attrs.name)}
98
- id={fieldLayoutInfo.attrs.name}
99
- field="label"
100
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
101
- dropdown
102
- suggestions={selectionStaticItems}
103
- completeMethod={selectionStaticSearch}
104
- // onChange={(e) => updateInputs(index, e.value)} />
105
- onChange={formik.handleChange} />
106
-
101
+ <div className="flex flex-column gap-2 mt-4">
102
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
103
+ &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
104
+ </label>
105
+ <AutoComplete
106
+ readOnly={formReadonly || fieldReadonly}
107
+ disabled={formDisabled || fieldDisabled}
108
+ {...formik.getFieldProps(fieldLayoutInfo.attrs.name)}
109
+ id={fieldLayoutInfo.attrs.name}
110
+ field="label"
111
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
112
+ dropdown
113
+ suggestions={selectionStaticItems}
114
+ completeMethod={selectionStaticSearch}
115
+ // onChange={(e) => updateInputs(index, e.value)} />
116
+ onChange={formik.handleChange} />
117
+ </div>
107
118
  {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
108
119
  <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
109
120
  )}
@@ -21,9 +21,15 @@ export class SolidShortTextField implements ISolidField {
21
21
  }
22
22
 
23
23
  initialValue(): any {
24
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
24
+ const fieldName = this.fieldContext.field.attrs.name;
25
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
26
+
27
+ const existingValue = this.fieldContext.data[fieldName];
28
+
29
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
25
30
  }
26
31
 
32
+
27
33
  validationSchema(): Schema {
28
34
  let schema: Yup.StringSchema<string | null | undefined> = Yup.string();
29
35
 
@@ -58,11 +64,10 @@ export class SolidShortTextField implements ISolidField {
58
64
  render(formik: FormikObject) {
59
65
  const fieldMetadata = this.fieldContext.fieldMetadata;
60
66
  const fieldLayoutInfo = this.fieldContext.field;
61
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
67
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
62
68
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
63
69
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
64
70
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
65
-
66
71
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
67
72
 
68
73
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
@@ -73,19 +78,21 @@ export class SolidShortTextField implements ISolidField {
73
78
 
74
79
  return (
75
80
  <div className={className}>
76
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
77
- &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
78
-
79
- {/* &nbsp; {fieldDescription && <span className="form_field_help_text">`(${fieldDescription})` </span>} */}
80
- </label>
81
- <InputText
82
- readOnly={formReadonly || fieldReadonly}
83
- disabled={formDisabled || fieldDisabled}
84
- id={fieldLayoutInfo.attrs.name}
85
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
86
- onChange={formik.handleChange}
87
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
88
- />
81
+ <div className="flex flex-column gap-2 mt-4">
82
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
83
+ &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
84
+
85
+ {/* &nbsp; {fieldDescription && <span className="form_field_help_text">`(${fieldDescription})` </span>} */}
86
+ </label>
87
+ <InputText
88
+ readOnly={formReadonly || fieldReadonly}
89
+ disabled={formDisabled || fieldDisabled}
90
+ id={fieldLayoutInfo.attrs.name}
91
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
92
+ onChange={formik.handleChange}
93
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
94
+ />
95
+ </div>
89
96
  {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
90
97
  <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
91
98
  )}
@@ -22,7 +22,12 @@ export class SolidTimeField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ const fieldName = this.fieldContext.field.attrs.name;
26
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
27
+
28
+ const existingValue = this.fieldContext.data[fieldName];
29
+
30
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
26
31
  }
27
32
 
28
33
  validationSchema(): Schema {
@@ -41,7 +46,7 @@ export class SolidTimeField implements ISolidField {
41
46
  render(formik: FormikObject) {
42
47
  const fieldMetadata = this.fieldContext.fieldMetadata;
43
48
  const fieldLayoutInfo = this.fieldContext.field;
44
- const className = fieldLayoutInfo.attrs?.className || 'field col-6 flex flex-column gap-2 mt-4';
49
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
45
50
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
46
51
  const calendarRef = useRef<any>(null); // Reference for the Calendar component
47
52
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
@@ -54,26 +59,28 @@ export class SolidTimeField implements ISolidField {
54
59
 
55
60
  return (
56
61
  <div className={className}>
57
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
62
+ <div className="flex flex-column gap-2 mt-4">
63
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
58
64
 
59
- &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
60
- </label>
61
- <Calendar
62
- disabled={formDisabled || fieldDisabled}
63
- ref={calendarRef} // Attach ref to Calendar
64
- id={fieldLayoutInfo.attrs.name}
65
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
66
- onChange={formik.handleChange}
67
- //@ts-ignore
68
- value={formik.values[fieldLayoutInfo.attrs.name] ? formik.values[fieldLayoutInfo.attrs.name] : Date()}
69
- // dateFormat="mm/dd/yy"
70
- // placeholder="mm/dd/yyyy hh:mm"
71
- hideOnDateTimeSelect
72
- timeOnly
73
- showTime className=""
74
- hourFormat="24"
65
+ &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
66
+ </label>
67
+ <Calendar
68
+ disabled={formDisabled || fieldDisabled}
69
+ ref={calendarRef} // Attach ref to Calendar
70
+ id={fieldLayoutInfo.attrs.name}
71
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
72
+ onChange={formik.handleChange}
73
+ //@ts-ignore
74
+ value={formik.values[fieldLayoutInfo.attrs.name] ? formik.values[fieldLayoutInfo.attrs.name] : Date()}
75
+ // dateFormat="mm/dd/yy"
76
+ // placeholder="mm/dd/yyyy hh:mm"
77
+ hideOnDateTimeSelect
78
+ timeOnly
79
+ showTime className=""
80
+ hourFormat="24"
75
81
 
76
- />
82
+ />
83
+ </div>
77
84
  {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
78
85
  <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
79
86
  )}