@solidstarters/solid-core-ui 1.1.47 → 1.1.49

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 (166) hide show
  1. package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
  2. package/dist/components/core/common/FilterComponent.js +26 -10
  3. package/dist/components/core/common/FilterComponent.js.map +1 -1
  4. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  5. package/dist/components/core/common/SolidGlobalSearchElement.js +160 -94
  6. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  7. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  8. package/dist/components/core/form/SolidFormView.js +43 -16
  9. package/dist/components/core/form/SolidFormView.js.map +1 -1
  10. package/dist/components/core/form/fields/ISolidField.d.ts +1 -0
  11. package/dist/components/core/form/fields/ISolidField.d.ts.map +1 -1
  12. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  13. package/dist/components/core/form/fields/SolidBooleanField.js +9 -2
  14. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  15. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  16. package/dist/components/core/form/fields/SolidDateField.js +27 -11
  17. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  18. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  19. package/dist/components/core/form/fields/SolidDateTimeField.js +28 -11
  20. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  21. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  22. package/dist/components/core/form/fields/SolidDecimalField.js +24 -5
  23. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  24. package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
  25. package/dist/components/core/form/fields/SolidEmailField.js +24 -5
  26. package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
  27. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  28. package/dist/components/core/form/fields/SolidIntegerField.js +24 -5
  29. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  30. package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
  31. package/dist/components/core/form/fields/SolidJsonField.js +22 -3
  32. package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
  33. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  34. package/dist/components/core/form/fields/SolidLongTextField.js +30 -4
  35. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  36. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  37. package/dist/components/core/form/fields/SolidMediaMultipleField.js +52 -29
  38. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  39. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  40. package/dist/components/core/form/fields/SolidMediaSingleField.js +39 -16
  41. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  42. package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
  43. package/dist/components/core/form/fields/SolidPasswordField.js +23 -3
  44. package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
  45. package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
  46. package/dist/components/core/form/fields/SolidRichTextField.js +23 -3
  47. package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
  48. package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
  49. package/dist/components/core/form/fields/SolidSelectionDynamicField.js +14 -5
  50. package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
  51. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  52. package/dist/components/core/form/fields/SolidSelectionStaticField.js +10 -2
  53. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  54. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  55. package/dist/components/core/form/fields/SolidShortTextField.js +28 -8
  56. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  57. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  58. package/dist/components/core/form/fields/SolidTimeField.js +27 -8
  59. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  60. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  61. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +15 -4
  62. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  63. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  64. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -4
  65. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  66. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  67. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +17 -5
  68. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  69. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js +1 -1
  70. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js.map +1 -1
  71. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js +1 -1
  72. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js.map +1 -1
  73. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts +2 -0
  74. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts.map +1 -0
  75. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js +9 -0
  76. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js.map +1 -0
  77. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts +2 -0
  78. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts.map +1 -0
  79. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js +8 -0
  80. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js.map +1 -0
  81. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts +2 -0
  82. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts.map +1 -0
  83. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js +9 -0
  84. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js.map +1 -0
  85. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts +2 -0
  86. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts.map +1 -0
  87. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js +20 -0
  88. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js.map +1 -0
  89. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts +2 -0
  90. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts.map +1 -0
  91. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js +7 -0
  92. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js.map +1 -0
  93. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +3 -0
  94. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts.map +1 -0
  95. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js +74 -0
  96. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js.map +1 -0
  97. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +3 -0
  98. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts.map +1 -0
  99. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js +58 -0
  100. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js.map +1 -0
  101. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts +2 -0
  102. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts.map +1 -0
  103. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js +6 -0
  104. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js.map +1 -0
  105. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js +1 -1
  106. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js.map +1 -1
  107. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js +1 -1
  108. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js.map +1 -1
  109. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  110. package/dist/components/core/kanban/SolidKanbanView.js +37 -14
  111. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  112. package/dist/components/core/list/SolidListView.d.ts +3 -0
  113. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  114. package/dist/components/core/list/SolidListView.js +167 -95
  115. package/dist/components/core/list/SolidListView.js.map +1 -1
  116. package/dist/components/core/model/FieldMetaDataForm.js +1 -1
  117. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  118. package/dist/components/core/users/CreateUser.js +1 -3
  119. package/dist/components/core/users/CreateUser.js.map +1 -1
  120. package/dist/helpers/registry.d.ts.map +1 -1
  121. package/dist/helpers/registry.js +16 -0
  122. package/dist/helpers/registry.js.map +1 -1
  123. package/dist/resources/globals.css +15 -2
  124. package/package.json +1 -1
  125. package/src/components/core/common/FilterComponent.tsx +39 -10
  126. package/src/components/core/common/SolidGlobalSearchElement.tsx +228 -135
  127. package/src/components/core/form/SolidFormView.tsx +69 -21
  128. package/src/components/core/form/fields/ISolidField.tsx +1 -0
  129. package/src/components/core/form/fields/SolidBooleanField.tsx +39 -25
  130. package/src/components/core/form/fields/SolidDateField.tsx +46 -32
  131. package/src/components/core/form/fields/SolidDateTimeField.tsx +47 -34
  132. package/src/components/core/form/fields/SolidDecimalField.tsx +42 -26
  133. package/src/components/core/form/fields/SolidEmailField.tsx +43 -27
  134. package/src/components/core/form/fields/SolidIntegerField.tsx +42 -25
  135. package/src/components/core/form/fields/SolidJsonField.tsx +40 -23
  136. package/src/components/core/form/fields/SolidLongTextField.tsx +86 -53
  137. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +170 -139
  138. package/src/components/core/form/fields/SolidMediaSingleField.tsx +124 -93
  139. package/src/components/core/form/fields/SolidPasswordField.tsx +42 -25
  140. package/src/components/core/form/fields/SolidRichTextField.tsx +41 -24
  141. package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +46 -28
  142. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +38 -22
  143. package/src/components/core/form/fields/SolidShortTextField.tsx +63 -47
  144. package/src/components/core/form/fields/SolidTimeField.tsx +47 -30
  145. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +30 -8
  146. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +49 -31
  147. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +38 -19
  148. package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +1 -1
  149. package/src/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.tsx +1 -1
  150. package/src/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.tsx +23 -0
  151. package/src/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.tsx +13 -0
  152. package/src/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.tsx +23 -0
  153. package/src/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.tsx +32 -0
  154. package/src/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.tsx +17 -0
  155. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +157 -0
  156. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +98 -0
  157. package/src/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.tsx +11 -0
  158. package/src/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.tsx +1 -1
  159. package/src/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.tsx +1 -1
  160. package/src/components/core/kanban/SolidKanbanView.tsx +26 -5
  161. package/src/components/core/list/SolidListView.tsx +166 -105
  162. package/src/components/core/model/FieldMetaDataForm.tsx +1 -1
  163. package/src/components/core/users/CreateUser.tsx +5 -5
  164. package/src/helpers/registry.ts +16 -0
  165. package/src/resources/globals.css +15 -2
  166. package/src/types/solid-core.d.ts +6 -1
@@ -7,7 +7,7 @@ import { useGetSolidViewLayoutQuery } from "@/redux/api/solidViewApi";
7
7
  import { useLazyCheckIfPermissionExistsQuery } from "@/redux/api/userApi";
8
8
  import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query";
9
9
  import { useFormik } from "formik";
10
- import { usePathname, useRouter } from "next/navigation";
10
+ import { usePathname, useRouter, useSearchParams } from "next/navigation";
11
11
  import "primeflex/primeflex.css";
12
12
  import { Button } from "primereact/button";
13
13
  import { Dialog } from "primereact/dialog";
@@ -52,7 +52,7 @@ export type SolidFormViewProps = {
52
52
  handlePopupClose?: any,
53
53
  customCreateHandler?: any
54
54
  inlineCreateAutoSave?: boolean,
55
- customLayout?: any
55
+ customLayout?: any,
56
56
  };
57
57
 
58
58
 
@@ -144,7 +144,7 @@ const fieldFactory = (type: string, fieldContext: SolidFieldProps): ISolidField
144
144
  }
145
145
 
146
146
  // solidFieldsMetadata={solidFieldsMetadata} solidView={solidView}
147
- const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, onChange, onBlur }: any) => {
147
+ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur }: any) => {
148
148
  const fieldContext: SolidFieldProps = {
149
149
  // field metadata - coming from the field-metadata table.
150
150
  fieldMetadata: fieldMetadata,
@@ -156,6 +156,7 @@ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidForm
156
156
  solidFormViewMetaData: solidFormViewMetaData,
157
157
  modelName: modelName,
158
158
  readOnly: readOnly,
159
+ viewMode: viewMode,
159
160
  onChange: onChange,
160
161
  onBlur: onBlur
161
162
  }
@@ -345,11 +346,15 @@ const SolidFormView = (params: SolidFormViewProps) => {
345
346
  const pathname = usePathname();
346
347
  const router = useRouter();
347
348
  const toast = useRef<Toast>(null);
349
+ const searchParams = useSearchParams();
350
+ const viewModeFromURL = searchParams.get("viewMode");
351
+
348
352
  const [redirectToList, setRedirectToList] = useState(false);
349
353
 
350
354
  const [isDeleteDialogVisible, setDeleteDialogVisible] = useState(false);
351
355
 
352
356
  const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
357
+ const [viewMode, setViewMode] = useState<"view" | "edit">("view");
353
358
 
354
359
  const errorFields: string[] = [];
355
360
 
@@ -357,7 +362,30 @@ const SolidFormView = (params: SolidFormViewProps) => {
357
362
  const op = useRef(null);
358
363
 
359
364
  useEffect(() => {
365
+ if (viewModeFromURL === "edit" || viewModeFromURL === "view") {
366
+ setViewMode(viewModeFromURL);
367
+ } else {
368
+ setViewMode("view"); // Default to 'view' if not present
369
+ }
370
+ if (params.id === 'new') {
371
+ setViewMode("edit");
372
+ }
373
+ }, [viewModeFromURL]);
374
+
375
+
376
+ // function that updates view mode
377
+ const updateViewMode = (newMode: "view" | "edit") => {
378
+ setViewMode(newMode);
379
+ const params = new URLSearchParams(searchParams.toString());
380
+ params.set("viewMode", newMode);
381
+ router.push(`${pathname}?${params.toString()}`, { scroll: false });
382
+ };
383
+
384
+
385
+
360
386
 
387
+
388
+ useEffect(() => {
361
389
  const fetchPermissions = async () => {
362
390
  if (params.modelName) {
363
391
  const permissionNames = [
@@ -540,14 +568,18 @@ const SolidFormView = (params: SolidFormViewProps) => {
540
568
  // createEntity(formData);
541
569
  const result = await createEntity(formData).unwrap();
542
570
  showToast("success", "Form saved", "Form saved successfully!");
543
- const updatedUrl = pathname.replace("new", result?.data?.id);
544
- router.push(updatedUrl);
571
+ if (!params.embeded) {
572
+ const updatedUrl = pathname.replace("new", result?.data?.id);
573
+ router.push(updatedUrl);
574
+ }
545
575
  }
546
576
  else {
547
577
  // updateEntity({ id: +params.id, data: formData });
548
578
  await updateEntity({ id: +params.id, data: formData }).unwrap();
549
579
  // const result = await updateEntity({ id: +params.id, data: formData }).unwrap();
550
- showToast("success", "Form Updated", "Form updated successfully!");
580
+ if (!params.embeded) {
581
+ showToast("success", "Form Updated", "Form updated successfully!");
582
+ }
551
583
  }
552
584
  }
553
585
 
@@ -618,7 +650,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
618
650
 
619
651
  useEffect(() => {
620
652
  if (solidFormViewMetaData) {
621
- let formLayout = solidFormViewMetaData;
653
+ let formLayout = solidFormViewMetaData;
622
654
  const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormLayoutLoad;
623
655
  let DynamicFunctionComponent = null;
624
656
  const event: SolidLoadForm = {
@@ -634,7 +666,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
634
666
  if (updatedFormLayout && updatedFormLayout?.layoutChanged && updatedFormLayout?.newLayout) {
635
667
  const newFormLayout = {
636
668
  ...formLayout,
637
- data : {
669
+ data: {
638
670
  ...formLayout.data,
639
671
  solidView: {
640
672
  ...formLayout.data.solidView,
@@ -659,23 +691,23 @@ const SolidFormView = (params: SolidFormViewProps) => {
659
691
  const handleDynamicFunction = async () => {
660
692
  if (solidFormViewData) {
661
693
  const dynamicHeader = solidFormViewMetaData?.data?.solidView?.layout?.onFormDataLoad;
662
-
694
+
663
695
  let DynamicFunctionComponent = null;
664
696
  let formViewData = solidFormViewData?.data;
665
-
697
+
666
698
  const event: SolidLoadForm = {
667
699
  fieldsMetadata: solidFormViewMetaData,
668
700
  formData: solidFormViewData?.data,
669
701
  type: dynamicHeader,
670
702
  viewMetadata: solidFormViewMetaData?.data?.solidView
671
703
  };
672
-
704
+
673
705
  if (dynamicHeader) {
674
706
  DynamicFunctionComponent = getExtensionFunction(dynamicHeader);
675
-
707
+
676
708
  if (DynamicFunctionComponent) {
677
709
  const updatedFormData = await DynamicFunctionComponent(event);
678
-
710
+
679
711
  if (updatedFormData && updatedFormData?.dataChanged && updatedFormData?.newFormData) {
680
712
  formViewData = updatedFormData.newFormData;
681
713
  }
@@ -684,7 +716,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
684
716
  setInitialEntityData(formViewData);
685
717
  }
686
718
  };
687
-
719
+
688
720
  handleDynamicFunction();
689
721
  }, [solidFormViewData]);
690
722
 
@@ -897,6 +929,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
897
929
  solidFormViewMetaData={solidFormViewMetaData}
898
930
  modelName={params.modelName}
899
931
  readOnly={readOnlyPermission}
932
+ viewMode={viewMode}
900
933
  onChange={formFieldOnXXX}
901
934
  onBlur={formFieldOnXXX}
902
935
  />;
@@ -1079,6 +1112,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
1079
1112
  />
1080
1113
  </div>
1081
1114
  } */}
1115
+
1116
+ {/* Inline */}
1082
1117
  {params.embeded == true &&
1083
1118
  actionsAllowed.includes(`${createPermission(params.modelName)}`) &&
1084
1119
  !formViewLayout.attrs.readonly &&
@@ -1112,6 +1147,17 @@ const SolidFormView = (params: SolidFormViewProps) => {
1112
1147
  <div className="form-wrapper-title"> {editHeaderTitle}</div>
1113
1148
  </div>
1114
1149
  <div className="gap-3 flex">
1150
+ {params.embeded !== true && viewMode === "view" &&
1151
+ <div>
1152
+ <Button
1153
+ label="Edit"
1154
+ size="small"
1155
+ onClick={() => updateViewMode("edit")}
1156
+ type="button"
1157
+ />
1158
+ </div>
1159
+ }
1160
+
1115
1161
  {params.embeded !== true &&
1116
1162
  actionsAllowed.includes(`${updatePermission(params.modelName)}`) &&
1117
1163
  !formViewLayout.attrs.readonly &&
@@ -1125,6 +1171,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
1125
1171
  />
1126
1172
  </div>
1127
1173
  }
1174
+
1175
+ {/* Inline */}
1128
1176
  {params.embeded == true &&
1129
1177
  actionsAllowed.includes(`${updatePermission(params.modelName)}`) &&
1130
1178
  !formViewLayout.attrs.readonly &&
@@ -1186,13 +1234,13 @@ const SolidFormView = (params: SolidFormViewProps) => {
1186
1234
  } */}
1187
1235
  {params.embeded !== true &&
1188
1236
  // <div className="solid-form-stepper">
1189
- <SolidFormHeader
1190
- // solidFormViewMetaData={solidFormViewMetaData?.data?.solidView?.model}
1191
- solidFormViewMetaData={solidFormViewMetaData}
1192
- initialEntityData={initialEntityData}
1193
- modelName={params.modelName}
1194
- id={params.id}
1195
- />
1237
+ <SolidFormHeader
1238
+ // solidFormViewMetaData={solidFormViewMetaData?.data?.solidView?.model}
1239
+ solidFormViewMetaData={solidFormViewMetaData}
1240
+ initialEntityData={initialEntityData}
1241
+ modelName={params.modelName}
1242
+ id={params.id}
1243
+ />
1196
1244
  // </div>
1197
1245
  }
1198
1246
  <div className="p-4 solid-form-content">
@@ -9,6 +9,7 @@ export type SolidFieldProps = {
9
9
  data: any,
10
10
  modelName?: any,
11
11
  readOnly?: any,
12
+ viewMode? :any
12
13
  onChange?: any,
13
14
  onBlur?: any
14
15
  };
@@ -36,8 +36,8 @@ export class SolidBooleanField implements ISolidField {
36
36
 
37
37
  // Ensure the value is always a string "true" or "false"
38
38
  const result = existingValue
39
- ? (existingValue === true || existingValue === "true" ? "true" : "false")
40
- : (fieldDefaultValue === true || fieldDefaultValue === "true" ? "true" : "false");
39
+ ? (existingValue === true || existingValue === "true" ? "true" : "false")
40
+ : (fieldDefaultValue === true || fieldDefaultValue === "true" ? "true" : "false");
41
41
  return result;
42
42
  }
43
43
 
@@ -96,38 +96,52 @@ export class SolidBooleanField implements ISolidField {
96
96
  if (!renderMode) {
97
97
  renderMode = 'field-selectbox';
98
98
  }
99
+ const viewMode: string = this.fieldContext.viewMode;
100
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
101
+ const widgetProps = {
102
+ label: fieldLabel,
103
+ value: formik.values[fieldLayoutInfo.attrs.name],
104
+ }
99
105
  return (
100
106
  <>
101
- {renderMode &&
102
- this.renderExtensionRenderMode(renderMode, formik)
107
+ {viewMode === "view" &&
108
+ DynamicWidget && <DynamicWidget {...widgetProps} />
109
+ }
110
+ {viewMode === "edit" && (
111
+ <>
112
+ {renderMode &&
113
+ this.renderExtensionRenderMode(renderMode, formik)
114
+ }
115
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
116
+ <div className="absolute mt-1">
117
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
118
+ </div>
119
+ )}
120
+ </>
121
+ )
103
122
  }
104
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
105
- <div className="absolute mt-1">
106
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
107
- </div>
108
- )}
109
123
  </>
110
124
  );
111
125
 
112
-
126
+
113
127
  }
114
128
 
115
129
 
116
- renderExtensionRenderMode(widgetName: string, formik: FormikObject) {
117
- let DynamicWidget = getExtensionComponent(widgetName);
118
- if (!DynamicWidget) {
119
- DynamicWidget = getExtensionComponent('field-selectbox');
120
- }
121
- const widgetProps: SolidBooleanFieldWidgetProps = {
122
- formik: formik,
123
- fieldContext: this.fieldContext,
124
- }
125
- return (
126
- <>
127
- {DynamicWidget && <DynamicWidget {...widgetProps} />}
128
- </>
129
- )
130
+ renderExtensionRenderMode(widgetName: string, formik: FormikObject) {
131
+ let DynamicWidget = getExtensionComponent(widgetName);
132
+ if (!DynamicWidget) {
133
+ DynamicWidget = getExtensionComponent('field-selectbox');
130
134
  }
135
+ const widgetProps: SolidBooleanFieldWidgetProps = {
136
+ formik: formik,
137
+ fieldContext: this.fieldContext,
138
+ }
139
+ return (
140
+ <>
141
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
142
+ </>
143
+ )
144
+ }
145
+
131
146
 
132
-
133
147
  }
@@ -5,6 +5,7 @@ import { useRef } from "react";
5
5
  import * as Yup from 'yup';
6
6
  import { Schema } from "yup";
7
7
  import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
8
+ import { getExtensionComponent } from "@/helpers/registry";
8
9
 
9
10
  export class SolidDateField implements ISolidField {
10
11
 
@@ -60,41 +61,54 @@ export class SolidDateField implements ISolidField {
60
61
 
61
62
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
62
63
  // const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
63
-
64
+ const viewMode: string = this.fieldContext.viewMode;
65
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
66
+ const widgetProps = {
67
+ label: fieldLabel,
68
+ value: formik.values[fieldLayoutInfo.attrs.name],
69
+ }
64
70
  return (
65
- <div className={className}>
66
- <div className="relative">
67
- <div className="flex flex-column gap-2 mt-4">
68
- {showFieldLabel != false &&
69
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
70
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
71
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
72
- </label>
73
- }
74
- <Calendar
75
- disabled={formDisabled || fieldDisabled || readOnlyPermission}
76
- ref={calendarRef} // Attach ref to Calendar
77
- id={fieldLayoutInfo.attrs.name}
78
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
79
- name={fieldLayoutInfo.attrs.name}
80
- // onChange={formik.handleChange}
81
- onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
82
- //@ts-ignore
83
- value={formik.values[fieldLayoutInfo.attrs.name] ? new Date(formik.values[fieldLayoutInfo.attrs.name]) : Date()}
84
- // dateFormat="mm/dd/yy"
85
- // placeholder="mm/dd/yyyy hh:mm"
86
- mask="99/99/9999 99:99"
87
- hideOnDateTimeSelect
88
- className=""
89
- />
71
+ <>
72
+ {viewMode === "view" &&
73
+ <div className={className}>
74
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
90
75
  </div>
91
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
92
- <div className="absolute mt-1">
93
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
76
+ }
77
+ {viewMode === "edit" && (
78
+ <div className={className}>
79
+ <div className="relative">
80
+ <div className="flex flex-column gap-2 mt-4">
81
+ {showFieldLabel != false &&
82
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
83
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
84
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
85
+ </label>
86
+ }
87
+ <Calendar
88
+ disabled={formDisabled || fieldDisabled || readOnlyPermission}
89
+ ref={calendarRef} // Attach ref to Calendar
90
+ id={fieldLayoutInfo.attrs.name}
91
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
92
+ onChange={formik.handleChange}
93
+ //@ts-ignore
94
+ value={formik.values[fieldLayoutInfo.attrs.name] ? new Date(formik.values[fieldLayoutInfo.attrs.name]) : Date()}
95
+ // dateFormat="mm/dd/yy"
96
+ // placeholder="mm/dd/yyyy hh:mm"
97
+ mask="99/99/9999 99:99"
98
+ hideOnDateTimeSelect
99
+ className=""
100
+ />
101
+ </div>
102
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
103
+ <div className="absolute mt-1">
104
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
105
+ </div>
106
+ )}
94
107
  </div>
95
- )}
96
- </div>
97
- </div>
108
+ </div>
109
+ )
110
+ }
111
+ </>
98
112
  );
99
113
  }
100
114
  }
@@ -5,6 +5,7 @@ import { useRef } from "react";
5
5
  import * as Yup from 'yup';
6
6
  import { Schema } from "yup";
7
7
  import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
8
+ import { getExtensionComponent } from "@/helpers/registry";
8
9
 
9
10
  export class SolidDateTimeField implements ISolidField {
10
11
 
@@ -58,43 +59,55 @@ export class SolidDateTimeField implements ISolidField {
58
59
 
59
60
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
60
61
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
61
-
62
+ const viewMode: string = this.fieldContext.viewMode;
63
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
64
+ const widgetProps = {
65
+ label: fieldLabel,
66
+ value: formik.values[fieldLayoutInfo.attrs.name],
67
+ }
62
68
  return (
63
- <div className={className}>
64
- <div className="relative">
65
- <div className="flex flex-column gap-2 mt-4">
66
- {showFieldLabel != false &&
67
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
68
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
69
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
70
- </label>
71
- }
72
- <Calendar
73
- disabled={formDisabled || fieldDisabled || readOnlyPermission}
74
- ref={calendarRef} // Attach ref to Calendar
75
- id={fieldLayoutInfo.attrs.name}
76
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
77
- // onChange={formik.handleChange}
78
- name={fieldLayoutInfo.attrs.name}
79
- onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
80
- //@ts-ignore
81
- value={formik.values[fieldLayoutInfo.attrs.name] ? new Date(formik.values[fieldLayoutInfo.attrs.name]) : Date()}
82
- // dateFormat="mm/dd/yy"
83
- // placeholder="mm/dd/yyyy hh:mm"
84
- mask="99/99/9999 99:99"
85
- hideOnDateTimeSelect
86
- showTime className=""
87
- hourFormat="24"
88
-
89
- />
69
+ <>
70
+ {viewMode === "view" &&
71
+ <div className={className}>
72
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
90
73
  </div>
91
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
92
- <div className="absolute mt-1">
93
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
74
+ }
75
+ {viewMode === "edit" &&
76
+ <div className={className}>
77
+ <div className="relative">
78
+ <div className="flex flex-column gap-2 mt-4">
79
+ {showFieldLabel != false &&
80
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
81
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
82
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
83
+ </label>
84
+ }
85
+ <Calendar
86
+ disabled={formDisabled || fieldDisabled || readOnlyPermission}
87
+ ref={calendarRef} // Attach ref to Calendar
88
+ id={fieldLayoutInfo.attrs.name}
89
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
90
+ onChange={formik.handleChange}
91
+ //@ts-ignore
92
+ value={formik.values[fieldLayoutInfo.attrs.name] ? new Date(formik.values[fieldLayoutInfo.attrs.name]) : Date()}
93
+ // dateFormat="mm/dd/yy"
94
+ // placeholder="mm/dd/yyyy hh:mm"
95
+ mask="99/99/9999 99:99"
96
+ hideOnDateTimeSelect
97
+ showTime className=""
98
+ hourFormat="24"
99
+
100
+ />
101
+ </div>
102
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
103
+ <div className="absolute mt-1">
104
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
105
+ </div>
106
+ )}
94
107
  </div>
95
- )}
96
- </div>
97
- </div>
108
+ </div>
109
+ }
110
+ </>
98
111
  );
99
112
  }
100
113
  }
@@ -4,6 +4,7 @@ import { Message } from "primereact/message";
4
4
  import * as Yup from 'yup';
5
5
  import { Schema } from "yup";
6
6
  import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
7
+ import { getExtensionComponent } from "@/helpers/registry";
7
8
 
8
9
  export class SolidDecimalField implements ISolidField {
9
10
 
@@ -70,35 +71,50 @@ export class SolidDecimalField implements ISolidField {
70
71
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
71
72
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
72
73
 
74
+ const viewMode: string = this.fieldContext.viewMode;
75
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
76
+ const widgetProps = {
77
+ label: fieldLabel,
78
+ value: formik.values[fieldLayoutInfo.attrs.name],
79
+ }
73
80
  return (
74
- <div className={className}>
75
- <div className="relative">
76
- <div className="flex flex-column gap-2 mt-4">
77
- {showFieldLabel != false &&
78
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
79
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
80
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
81
- </label>
82
- }
83
- <InputNumber
84
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
85
- disabled={formDisabled || fieldDisabled}
86
- id={fieldLayoutInfo.attrs.name}
87
- minFractionDigits={2}
88
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
89
- onChange={(e: any) => {
90
- formik.setFieldValue(fieldLayoutInfo.attrs.name, e.value)
91
- }}
92
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
93
- />
81
+ <>
82
+ {viewMode === "view" &&
83
+ <div className={className}>
84
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
94
85
  </div>
95
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
96
- <div className="absolute mt-1">
97
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
86
+ }
87
+ {viewMode === "edit" && (
88
+ <div className={className}>
89
+ <div className="relative">
90
+ <div className="flex flex-column gap-2 mt-4">
91
+ {showFieldLabel != false &&
92
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
93
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
94
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
95
+ </label>
96
+ }
97
+ <InputNumber
98
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
99
+ disabled={formDisabled || fieldDisabled}
100
+ id={fieldLayoutInfo.attrs.name}
101
+ minFractionDigits={2}
102
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
103
+ onChange={(e: any) => {
104
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, e.value)
105
+ }}
106
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
107
+ />
108
+ </div>
109
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
110
+ <div className="absolute mt-1">
111
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
112
+ </div>
113
+ )}
98
114
  </div>
99
- )}
100
- </div>
101
- </div>
115
+ </div>
116
+ )}
117
+ </>
102
118
  );
103
119
  }
104
120
  }