@solidstarters/solid-core-ui 1.1.47 → 1.1.50

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 +81 -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 +81 -2
  166. package/src/types/solid-core.d.ts +6 -1
@@ -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 SolidEmailField implements ISolidField {
9
10
 
@@ -78,36 +79,51 @@ export class SolidEmailField implements ISolidField {
78
79
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
79
80
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
80
81
 
82
+ const viewMode: string = this.fieldContext.viewMode;
83
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
84
+ const widgetProps = {
85
+ label: fieldLabel,
86
+ value: formik.values[fieldLayoutInfo.attrs.name],
87
+ }
81
88
  return (
82
- <div className={className}>
83
- <div className="relative">
84
- <div className="flex flex-column gap-2 mt-4">
85
- {showFieldLabel != false &&
86
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
87
- {fieldLabel}
88
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
89
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
90
- </label>
91
- }
92
- <InputText
93
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
94
- disabled={formDisabled || fieldDisabled}
95
- id={fieldLayoutInfo.attrs.name}
96
- name={fieldMetadata.name}
97
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
98
- // onChange={formik.handleChange}
99
- onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
100
- onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
101
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
102
- />
89
+ <>
90
+ {viewMode === "view" &&
91
+ <div className={className}>
92
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
103
93
  </div>
104
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
105
- <div className="absolute mt-1">
106
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
94
+ }
95
+ {viewMode === "edit" && (
96
+ <div className={className}>
97
+ <div className="relative">
98
+ <div className="flex flex-column gap-2 mt-4">
99
+ {showFieldLabel != false &&
100
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
101
+ {fieldLabel}
102
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
103
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
104
+ </label>
105
+ }
106
+ <InputText
107
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
108
+ disabled={formDisabled || fieldDisabled}
109
+ id={fieldLayoutInfo.attrs.name}
110
+ name={fieldMetadata.name}
111
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
112
+ // onChange={formik.handleChange}
113
+ onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
114
+ onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
115
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
116
+ />
117
+ </div>
118
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
119
+ <div className="absolute mt-1">
120
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
121
+ </div>
122
+ )}
107
123
  </div>
108
- )}
109
- </div>
110
- </div>
124
+ </div>
125
+ )}
126
+ </>
111
127
  );
112
128
  }
113
129
  }
@@ -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 SolidIntegerField implements ISolidField {
9
10
 
@@ -71,34 +72,50 @@ export class SolidIntegerField implements ISolidField {
71
72
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
72
73
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
73
74
 
75
+ const viewMode: string = this.fieldContext.viewMode;
76
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
77
+ const widgetProps = {
78
+ label: fieldLabel,
79
+ value: formik.values[fieldLayoutInfo.attrs.name],
80
+ }
81
+
74
82
  return (
75
- <div className={className}>
76
- <div className="relative">
77
- <div className="flex flex-column gap-2 mt-4">
78
- {showFieldLabel != false &&
79
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
80
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
81
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
82
- </label>
83
- }
84
- <InputNumber
85
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
86
- disabled={formDisabled || fieldDisabled}
87
- id={fieldLayoutInfo.attrs.name}
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
- />
83
+ <>
84
+ {viewMode === "view" &&
85
+ <div className={className}>
86
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
94
87
  </div>
95
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
96
- <div className="absolute mt-1">
97
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
88
+ }
89
+ {viewMode === "edit" && (
90
+ <div className={className}>
91
+ <div className="relative">
92
+ <div className="flex flex-column gap-2 mt-4">
93
+ {showFieldLabel != false &&
94
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
95
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
96
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
97
+ </label>
98
+ }
99
+ <InputNumber
100
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
101
+ disabled={formDisabled || fieldDisabled}
102
+ id={fieldLayoutInfo.attrs.name}
103
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
104
+ onChange={(e: any) => {
105
+ formik.setFieldValue(fieldLayoutInfo.attrs.name, e.value)
106
+ }}
107
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
108
+ />
109
+ </div>
110
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
111
+ <div className="absolute mt-1">
112
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
113
+ </div>
114
+ )}
98
115
  </div>
99
- )}
100
- </div>
101
- </div>
116
+ </div>
117
+ )}
118
+ </>
102
119
  );
103
120
  }
104
121
  }
@@ -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 SolidJsonField implements ISolidField {
9
10
 
@@ -55,32 +56,48 @@ export class SolidJsonField implements ISolidField {
55
56
  const fieldReadonly = fieldLayoutInfo.attrs?.readonly;
56
57
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
57
58
 
59
+ const viewMode: string = this.fieldContext.viewMode;
60
+ let DynamicWidget = getExtensionComponent("SolidFormFieldJsonViewModeWidget");
61
+ const widgetProps = {
62
+ label: fieldLabel,
63
+ value: formik.values[fieldLayoutInfo.attrs.name],
64
+ }
65
+
58
66
  return (
59
- <div className={className}>
60
- <div className="relative">
61
- <div className="flex flex-column gap-2 mt-4">
62
- {showFieldLabel != false &&
63
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
64
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
65
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
66
- </label>
67
- }
68
- <CodeEditor
69
- formik={formik}
70
- field={fieldLayoutInfo.attrs.name}
71
- height={fieldLayoutInfo.attrs?.height}
72
- fontSize={fieldLayoutInfo.attrs?.fontSize}
73
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
74
- >
75
- </CodeEditor>
67
+ <>
68
+ {viewMode === "view" &&
69
+ <div className={className}>
70
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
76
71
  </div>
77
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
78
- <div className="absolute mt-1">
79
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
72
+ }
73
+ {viewMode === "edit" && (
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
+ <CodeEditor
84
+ formik={formik}
85
+ field={fieldLayoutInfo.attrs.name}
86
+ height={fieldLayoutInfo.attrs?.height}
87
+ fontSize={fieldLayoutInfo.attrs?.fontSize}
88
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
89
+ >
90
+ </CodeEditor>
91
+ </div>
92
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
93
+ <div className="absolute mt-1">
94
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
95
+ </div>
96
+ )}
80
97
  </div>
81
- )}
82
- </div>
83
- </div>
98
+ </div>
99
+ )}
100
+ </>
84
101
  );
85
102
  }
86
103
  }
@@ -6,6 +6,7 @@ import { Schema } from "yup";
6
6
  import { FormikObject, ISolidField, SolidFieldProps } from "./ISolidField";
7
7
  import { Editor } from "primereact/editor";
8
8
  import { useState } from "react";
9
+ import { getExtensionComponent } from "@/helpers/registry";
9
10
 
10
11
  export class SolidLongTextField implements ISolidField {
11
12
 
@@ -65,16 +66,16 @@ export class SolidLongTextField implements ISolidField {
65
66
  const className = fieldLayoutInfo.attrs?.className || 'field col-12';
66
67
  return (
67
68
  <>
68
- {(!fieldLayoutInfo.attrs.renderMode ||fieldLayoutInfo.attrs.renderMode === 'longText') &&
69
- <div className={className}>
70
- {this.renderLongText(formik)}
71
- </div>
72
- }
73
- {fieldLayoutInfo.attrs.renderMode === 'richText' &&
74
- <div className={className}>
75
- {this.renderRichText(formik)}
76
- </div>
77
- }
69
+ {(!fieldLayoutInfo.attrs.renderMode || fieldLayoutInfo.attrs.renderMode === 'longText') &&
70
+ <div className={className}>
71
+ {this.renderLongText(formik)}
72
+ </div>
73
+ }
74
+ {fieldLayoutInfo.attrs.renderMode === 'richText' &&
75
+ <div className={className}>
76
+ {this.renderRichText(formik)}
77
+ </div>
78
+ }
78
79
  </>
79
80
  );
80
81
  }
@@ -88,33 +89,49 @@ export class SolidLongTextField implements ISolidField {
88
89
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
89
90
  const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;
90
91
  const readOnlyPermission = this.fieldContext.readOnly;
91
-
92
+
92
93
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
93
-
94
+
94
95
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
95
96
  const fieldReadonly = fieldLayoutInfo.attrs?.readonly;
96
-
97
+
97
98
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
98
99
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
100
+ const viewMode: string = this.fieldContext.viewMode;
101
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
102
+ const widgetProps = {
103
+ label: fieldLabel,
104
+ value: formik.values[fieldLayoutInfo.attrs.name],
105
+ }
99
106
  return (
100
- <div className="flex flex-column gap-2 mt-4">
101
- {showFieldLabel != false &&
102
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
103
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
104
- {/* &nbsp; {fieldDescription && <span>({fieldDescription}) </span>} */}
105
- </label>
107
+ <>
108
+ {viewMode === "view" &&
109
+ <div className={className}>
110
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
111
+ </div>
106
112
  }
107
- <InputTextarea
108
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
109
- disabled={formDisabled || fieldDisabled}
110
- id={fieldLayoutInfo.attrs.name}
111
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
112
- onChange={formik.handleChange}
113
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
114
- rows={5}
115
- cols={30}
116
- />
117
- </div>
113
+ {viewMode === "edit" && (
114
+
115
+ <div className="flex flex-column gap-2 mt-4">
116
+ {showFieldLabel != false &&
117
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
118
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
119
+ {/* &nbsp; {fieldDescription && <span>({fieldDescription}) </span>} */}
120
+ </label>
121
+ }
122
+ <InputTextarea
123
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
124
+ disabled={formDisabled || fieldDisabled}
125
+ id={fieldLayoutInfo.attrs.name}
126
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
127
+ onChange={formik.handleChange}
128
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
129
+ rows={5}
130
+ cols={30}
131
+ />
132
+ </div>
133
+ )}
134
+ </>
118
135
  )
119
136
  }
120
137
 
@@ -138,31 +155,47 @@ export class SolidLongTextField implements ISolidField {
138
155
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
139
156
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
140
157
 
158
+ const viewMode: string = this.fieldContext.viewMode;
159
+ let DynamicWidget = getExtensionComponent("SolidFormFieldRichTextViewModeWidget");
160
+ const widgetProps = {
161
+ label: fieldLabel,
162
+ value: formik.values[fieldLayoutInfo.attrs.name],
163
+ }
141
164
  return (
142
- <div className={className}>
143
- <div className="flex flex-column gap-2 mt-4">
144
- {showFieldLabel != false &&
145
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
146
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
147
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
148
- </label>
149
- }
150
- <Editor
151
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
152
- disabled={formDisabled || fieldDisabled}
153
- key={fieldLayoutInfo.attrs.name} // React will re-render the component whenever this value changes
154
- id={fieldLayoutInfo.attrs.name}
155
- value={formik.values[fieldLayoutInfo.attrs.name]}
156
- onTextChange={e => formik.setFieldValue(fieldLayoutInfo.attrs.name, e.htmlValue)}
157
- style={{ height: "320px" }}
158
- />
159
- </div>
160
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
161
- <div className="absolute mt-1">
162
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
165
+ <>
166
+ {viewMode === "view" &&
167
+ <div className={className}>
168
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
169
+ </div>
170
+ }
171
+ {viewMode === "edit" && (
172
+
173
+ <div className={className}>
174
+ <div className="flex flex-column gap-2 mt-4">
175
+ {showFieldLabel != false &&
176
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
177
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
178
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
179
+ </label>
180
+ }
181
+ <Editor
182
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
183
+ disabled={formDisabled || fieldDisabled}
184
+ key={fieldLayoutInfo.attrs.name} // React will re-render the component whenever this value changes
185
+ id={fieldLayoutInfo.attrs.name}
186
+ value={formik.values[fieldLayoutInfo.attrs.name]}
187
+ onTextChange={e => formik.setFieldValue(fieldLayoutInfo.attrs.name, e.htmlValue)}
188
+ style={{ height: "320px" }}
189
+ />
163
190
  </div>
164
- )}
165
- </div>
191
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
192
+ <div className="absolute mt-1">
193
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
194
+ </div>
195
+ )}
196
+ </div>
197
+ )}
198
+ </>
166
199
  );
167
200
  }
168
201
  }