@solidstarters/solid-core-ui 1.1.46 → 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 (178) hide show
  1. package/dist/components/common/SolidThemeProvider.js +2 -2
  2. package/dist/components/common/SolidThemeProvider.js.map +1 -1
  3. package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
  4. package/dist/components/core/common/FilterComponent.js +26 -10
  5. package/dist/components/core/common/FilterComponent.js.map +1 -1
  6. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  7. package/dist/components/core/common/SolidGlobalSearchElement.js +160 -94
  8. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  9. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  10. package/dist/components/core/form/SolidFormView.js +43 -16
  11. package/dist/components/core/form/SolidFormView.js.map +1 -1
  12. package/dist/components/core/form/fields/ISolidField.d.ts +1 -0
  13. package/dist/components/core/form/fields/ISolidField.d.ts.map +1 -1
  14. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  15. package/dist/components/core/form/fields/SolidBooleanField.js +9 -2
  16. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  17. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  18. package/dist/components/core/form/fields/SolidDateField.js +27 -11
  19. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  20. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  21. package/dist/components/core/form/fields/SolidDateTimeField.js +28 -11
  22. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  23. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  24. package/dist/components/core/form/fields/SolidDecimalField.js +24 -5
  25. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  26. package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
  27. package/dist/components/core/form/fields/SolidEmailField.js +24 -5
  28. package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
  29. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  30. package/dist/components/core/form/fields/SolidIntegerField.js +24 -5
  31. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  32. package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
  33. package/dist/components/core/form/fields/SolidJsonField.js +22 -3
  34. package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
  35. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  36. package/dist/components/core/form/fields/SolidLongTextField.js +30 -4
  37. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  38. package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
  39. package/dist/components/core/form/fields/SolidMediaMultipleField.js +52 -29
  40. package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
  41. package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
  42. package/dist/components/core/form/fields/SolidMediaSingleField.js +39 -16
  43. package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
  44. package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
  45. package/dist/components/core/form/fields/SolidPasswordField.js +23 -3
  46. package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
  47. package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
  48. package/dist/components/core/form/fields/SolidRichTextField.js +23 -3
  49. package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
  50. package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
  51. package/dist/components/core/form/fields/SolidSelectionDynamicField.js +14 -5
  52. package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
  53. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  54. package/dist/components/core/form/fields/SolidSelectionStaticField.js +10 -2
  55. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  56. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  57. package/dist/components/core/form/fields/SolidShortTextField.js +28 -8
  58. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  59. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  60. package/dist/components/core/form/fields/SolidTimeField.js +27 -8
  61. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  62. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
  63. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +15 -4
  64. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  65. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  66. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -4
  67. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  68. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  69. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +17 -5
  70. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  71. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js +1 -1
  72. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js.map +1 -1
  73. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js +1 -1
  74. package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js.map +1 -1
  75. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts +2 -0
  76. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts.map +1 -0
  77. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js +9 -0
  78. package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js.map +1 -0
  79. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts +2 -0
  80. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts.map +1 -0
  81. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js +8 -0
  82. package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js.map +1 -0
  83. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts +2 -0
  84. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts.map +1 -0
  85. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js +9 -0
  86. package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js.map +1 -0
  87. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts +2 -0
  88. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts.map +1 -0
  89. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js +20 -0
  90. package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js.map +1 -0
  91. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts +2 -0
  92. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts.map +1 -0
  93. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js +7 -0
  94. package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js.map +1 -0
  95. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +3 -0
  96. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts.map +1 -0
  97. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js +74 -0
  98. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js.map +1 -0
  99. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +3 -0
  100. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts.map +1 -0
  101. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js +58 -0
  102. package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js.map +1 -0
  103. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts +2 -0
  104. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts.map +1 -0
  105. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js +6 -0
  106. package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js.map +1 -0
  107. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js +1 -1
  108. package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js.map +1 -1
  109. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js +1 -1
  110. package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js.map +1 -1
  111. package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
  112. package/dist/components/core/kanban/SolidKanbanView.js +37 -14
  113. package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
  114. package/dist/components/core/list/SolidListView.d.ts +3 -0
  115. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  116. package/dist/components/core/list/SolidListView.js +167 -95
  117. package/dist/components/core/list/SolidListView.js.map +1 -1
  118. package/dist/components/core/model/FieldMetaDataForm.js +1 -1
  119. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  120. package/dist/components/core/users/CreateUser.js +1 -3
  121. package/dist/components/core/users/CreateUser.js.map +1 -1
  122. package/dist/helpers/registry.d.ts.map +1 -1
  123. package/dist/helpers/registry.js +16 -0
  124. package/dist/helpers/registry.js.map +1 -1
  125. package/dist/index.d.ts +1 -0
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +1 -0
  128. package/dist/index.js.map +1 -1
  129. package/dist/resources/globals.css +15 -5
  130. package/dist/resources/themes/solid-light-purple/solid-login-light.png +0 -0
  131. package/dist/resources/themes/solid-light-purple/theme.css +4 -0
  132. package/package.json +1 -1
  133. package/src/components/common/SolidThemeProvider.tsx +2 -2
  134. package/src/components/core/common/FilterComponent.tsx +39 -10
  135. package/src/components/core/common/SolidGlobalSearchElement.tsx +228 -135
  136. package/src/components/core/form/SolidFormView.tsx +69 -21
  137. package/src/components/core/form/fields/ISolidField.tsx +1 -0
  138. package/src/components/core/form/fields/SolidBooleanField.tsx +39 -25
  139. package/src/components/core/form/fields/SolidDateField.tsx +46 -32
  140. package/src/components/core/form/fields/SolidDateTimeField.tsx +47 -34
  141. package/src/components/core/form/fields/SolidDecimalField.tsx +42 -26
  142. package/src/components/core/form/fields/SolidEmailField.tsx +43 -27
  143. package/src/components/core/form/fields/SolidIntegerField.tsx +42 -25
  144. package/src/components/core/form/fields/SolidJsonField.tsx +40 -23
  145. package/src/components/core/form/fields/SolidLongTextField.tsx +86 -53
  146. package/src/components/core/form/fields/SolidMediaMultipleField.tsx +170 -139
  147. package/src/components/core/form/fields/SolidMediaSingleField.tsx +124 -93
  148. package/src/components/core/form/fields/SolidPasswordField.tsx +42 -25
  149. package/src/components/core/form/fields/SolidRichTextField.tsx +41 -24
  150. package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +46 -28
  151. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +38 -22
  152. package/src/components/core/form/fields/SolidShortTextField.tsx +63 -47
  153. package/src/components/core/form/fields/SolidTimeField.tsx +47 -30
  154. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +30 -8
  155. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +49 -31
  156. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +38 -19
  157. package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +1 -1
  158. package/src/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.tsx +1 -1
  159. package/src/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.tsx +23 -0
  160. package/src/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.tsx +13 -0
  161. package/src/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.tsx +23 -0
  162. package/src/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.tsx +32 -0
  163. package/src/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.tsx +17 -0
  164. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +157 -0
  165. package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +98 -0
  166. package/src/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.tsx +11 -0
  167. package/src/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.tsx +1 -1
  168. package/src/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.tsx +1 -1
  169. package/src/components/core/kanban/SolidKanbanView.tsx +26 -5
  170. package/src/components/core/list/SolidListView.tsx +166 -105
  171. package/src/components/core/model/FieldMetaDataForm.tsx +1 -1
  172. package/src/components/core/users/CreateUser.tsx +5 -5
  173. package/src/helpers/registry.ts +16 -0
  174. package/src/index.ts +2 -1
  175. package/src/resources/globals.css +15 -5
  176. package/src/resources/themes/solid-light-purple/solid-login-light.png +0 -0
  177. package/src/resources/themes/solid-light-purple/theme.css +4 -0
  178. 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 SolidShortTextField implements ISolidField {
9
10
 
@@ -78,59 +79,74 @@ export class SolidShortTextField implements ISolidField {
78
79
 
79
80
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
80
81
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
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
+ }
82
88
  return (
83
89
  <>
84
- {includeWrapper === 'yes' && <div className={className}>
85
- <div className="relative">
86
- <div className="flex flex-column gap-2 mt-4">
87
- {showFieldLabel != false &&
88
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
89
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
90
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
91
- </label>
92
- }
93
- <InputText
94
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
95
- disabled={formDisabled || fieldDisabled}
96
- id={fieldLayoutInfo.attrs.name}
97
- name={fieldMetadata.name}
98
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
99
- // onChange={formik.handleChange}
100
- onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
101
- onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
102
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
103
- />
104
- </div>
105
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
106
- <div className="absolute mt-1">
107
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
108
- </div>
109
- )}
90
+ {viewMode === "view" &&
91
+ <div className={className}>
92
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
110
93
  </div>
111
- </div>}
112
- {includeWrapper === 'no' &&
94
+ }
95
+ {viewMode === "edit" &&
113
96
  <>
114
- {showFieldLabel != false &&
115
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
116
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
117
- {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
118
- </label>
97
+ {includeWrapper === 'yes' && <div className={className}>
98
+ <div className="relative">
99
+ <div className="flex flex-column gap-2 mt-4">
100
+ {showFieldLabel != false &&
101
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
102
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
103
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
104
+ </label>
105
+ }
106
+ &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>}
107
+ <InputText
108
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
109
+ disabled={formDisabled || fieldDisabled}
110
+ id={fieldLayoutInfo.attrs.name}
111
+ name={fieldMetadata.name}
112
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
113
+ // onChange={formik.handleChange}
114
+ onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
115
+ onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
116
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
117
+ />
118
+ </div>
119
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
120
+ <div className="absolute mt-1">
121
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
122
+ </div>
123
+ )}
124
+ </div>
125
+ </div>}
126
+ {includeWrapper === 'no' &&
127
+ <>
128
+ {showFieldLabel != false &&
129
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
130
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
131
+ {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
132
+ </label>
133
+ }
134
+ <InputText
135
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
136
+ disabled={formDisabled || fieldDisabled}
137
+ id={fieldLayoutInfo.attrs.name}
138
+ name={fieldMetadata.name}
139
+ aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
140
+ // onChange={formik.handleChange}
141
+ onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
142
+ onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
143
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
144
+ />
145
+ </>
119
146
  }
120
- <InputText
121
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
122
- disabled={formDisabled || fieldDisabled}
123
- id={fieldLayoutInfo.attrs.name}
124
- name={fieldMetadata.name}
125
- aria-describedby={`${fieldLayoutInfo.attrs.name}-help`}
126
- // onChange={formik.handleChange}
127
- onChange={(e) => this.fieldContext.onChange(e, 'onFieldChange')}
128
- onBlur={(e) => this.fieldContext.onBlur(e, 'onFieldBlur')}
129
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
130
- />
131
- </>
132
- }
147
+ </>}
133
148
  </>
149
+
134
150
  );
135
151
  }
136
152
  }
@@ -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 SolidTimeField implements ISolidField {
10
11
 
@@ -59,40 +60,56 @@ export class SolidTimeField implements ISolidField {
59
60
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
60
61
  const formDisabled = solidFormViewMetaData.data.solidView?.layout?.attrs?.disabled;
61
62
 
63
+ const viewMode: string = this.fieldContext.viewMode;
64
+ let DynamicWidget = getExtensionComponent("SolidFormFieldViewModeWidget");
65
+ const widgetProps = {
66
+ label: fieldLabel,
67
+ value: formik.values[fieldLayoutInfo.attrs.name],
68
+ }
62
69
  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
- //@ts-ignore
79
- value={formik.values[fieldLayoutInfo.attrs.name] ? formik.values[fieldLayoutInfo.attrs.name] : Date()}
80
- // dateFormat="mm/dd/yy"
81
- // placeholder="mm/dd/yyyy hh:mm"
82
- hideOnDateTimeSelect
83
- timeOnly
84
- showTime className=""
85
- hourFormat="24"
86
70
 
87
- />
71
+ <>
72
+ {viewMode === "view" &&
73
+ <div className={className}>
74
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
88
75
  </div>
89
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
90
- <div className="absolute mt-1">
91
- <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] ? formik.values[fieldLayoutInfo.attrs.name] : Date()}
95
+ // dateFormat="mm/dd/yy"
96
+ // placeholder="mm/dd/yyyy hh:mm"
97
+ hideOnDateTimeSelect
98
+ timeOnly
99
+ showTime className=""
100
+ hourFormat="24"
101
+
102
+ />
103
+ </div>
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
+ )}
92
109
  </div>
93
- )}
94
- </div>
95
- </div>
110
+ </div>
111
+ )}
112
+ </>
96
113
  );
97
114
  }
98
115
  }
@@ -83,30 +83,52 @@ export class SolidRelationManyToManyField implements ISolidField {
83
83
  }
84
84
 
85
85
  render(formik: FormikObject) {
86
+ const fieldMetadata = this.fieldContext.fieldMetadata;
86
87
  const fieldLayoutInfo = this.fieldContext.field;
87
88
  const [visibleCreateRelationEntity, setVisibleCreateRelationEntity] = useState(false);
89
+ const className = fieldLayoutInfo.attrs?.className || 'field col-12';
88
90
 
89
91
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
92
+ const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
90
93
 
91
94
  let renderMode = fieldLayoutInfo.attrs.renderMode;
92
95
  if (!renderMode) {
93
96
  renderMode = 'autocomplete';
94
97
  }
98
+
99
+ const viewMode: string = this.fieldContext.viewMode;
100
+ let DynamicWidget = getExtensionComponent("SolidFormFieldRelationViewModeWidget");
101
+ const widgetProps = {
102
+ label: fieldLabel,
103
+ value: formik.values[fieldLayoutInfo.attrs.name],
104
+ }
105
+
95
106
  return (
107
+
96
108
  <>
97
- {renderMode &&
98
- this.renderExtensionRenderMode(renderMode, formik, visibleCreateRelationEntity, setVisibleCreateRelationEntity)
99
- }
100
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
101
- <div className="absolute mt-1">
102
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
109
+ {viewMode === "view" &&
110
+ <div className={className}>
111
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
103
112
  </div>
104
- )}
113
+ }
114
+ {viewMode === "edit" &&
115
+ (
116
+ <>
117
+ {renderMode &&
118
+ this.renderExtensionRenderMode(renderMode, formik, visibleCreateRelationEntity, setVisibleCreateRelationEntity)
119
+ }
120
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
121
+ <div className="absolute mt-1">
122
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
123
+ </div>
124
+ )}
125
+ </>
126
+ )}
105
127
  </>
106
128
  );
107
129
  }
108
130
 
109
- renderExtensionRenderMode(widgetName: string, formik: FormikObject, visibleCreateRelationEntity: any, setvisibleCreateRelationEntity: any) {
131
+ renderExtensionRenderMode(widgetName: string, formik: FormikObject, visibleCreateRelationEntity: any, setvisibleCreateRelationEntity: any) {
110
132
  let DynamicWidget = getExtensionComponent(widgetName);
111
133
  if (!DynamicWidget) {
112
134
  DynamicWidget = getExtensionComponent('autocomplete');
@@ -13,6 +13,7 @@ import { Checkbox } from "primereact/checkbox";
13
13
  import { Dialog } from "primereact/dialog";
14
14
  import { Panel } from "primereact/panel";
15
15
  import SolidFormView from "../../SolidFormView";
16
+ import { getExtensionComponent } from "@/helpers/registry";
16
17
 
17
18
 
18
19
  export class SolidRelationManyToOneField implements ISolidField {
@@ -135,41 +136,58 @@ export class SolidRelationManyToOneField implements ISolidField {
135
136
  formik.setFieldValue(fieldLayoutInfo.attrs.name, updatedRelationData);
136
137
 
137
138
  }
139
+
140
+ const viewMode: string = this.fieldContext.viewMode;
141
+ let DynamicWidget = getExtensionComponent("SolidFormFieldRelationViewModeWidget");
142
+ const widgetProps = {
143
+ label: fieldLabel,
144
+ value: formik.values[fieldLayoutInfo.attrs.name],
145
+ }
138
146
  return (
139
- <div className={className}>
140
- <div className="mt-4 relative">
141
- {showFieldLabel != false &&
142
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
143
- {fieldLabel}
144
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
145
- </label>
146
- }
147
- <div className="flex align-items-center gap-3 mt-2">
148
- <AutoComplete
149
- readOnly={formReadonly || fieldReadonly || readOnlyPermission}
150
- disabled={formDisabled || fieldDisabled || readOnlyPermission}
151
- {...formik.getFieldProps(fieldLayoutInfo.attrs.name)}
152
- id={fieldLayoutInfo.attrs.name}
153
- field="label"
154
- value={formik.values[fieldLayoutInfo.attrs.name] || ''}
155
- dropdown={!readOnlyPermission}
156
- suggestions={autoCompleteItems}
157
- completeMethod={autoCompleteSearch}
158
- onChange={formik.handleChange}
159
- onFocus={(e) => e.target.select()}
160
- className="w-full solid-standard-autocomplete"
161
- />
162
- {fieldLayoutInfo.attrs.inlineCreate === "true" && readOnlyPermission === false &&
163
- this.renderSolidFormEmbededView(formik, customCreateHandler, visibleCreateRelationEntity, setvisibleCreateRelationEntity)
164
- }
147
+ <>
148
+ {viewMode === "view" &&
149
+ <div className={className}>
150
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
165
151
  </div>
166
- {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
167
- <div className="absolute mt-1">
168
- <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
152
+ }
153
+ {viewMode === "edit" &&
154
+ (
155
+ <div className={className}>
156
+ <div className="mt-4 relative">
157
+ {showFieldLabel != false &&
158
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
159
+ {fieldLabel}
160
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
161
+ </label>
162
+ }
163
+ <div className="flex align-items-center gap-3 mt-2">
164
+ <AutoComplete
165
+ readOnly={formReadonly || fieldReadonly || readOnlyPermission}
166
+ disabled={formDisabled || fieldDisabled || readOnlyPermission}
167
+ {...formik.getFieldProps(fieldLayoutInfo.attrs.name)}
168
+ id={fieldLayoutInfo.attrs.name}
169
+ field="label"
170
+ value={formik.values[fieldLayoutInfo.attrs.name] || ''}
171
+ dropdown={!readOnlyPermission}
172
+ suggestions={autoCompleteItems}
173
+ completeMethod={autoCompleteSearch}
174
+ onChange={formik.handleChange}
175
+ onFocus={(e) => e.target.select()}
176
+ className="w-full solid-standard-autocomplete"
177
+ />
178
+ {fieldLayoutInfo.attrs.inlineCreate === "true" && readOnlyPermission === false &&
179
+ this.renderSolidFormEmbededView(formik, customCreateHandler, visibleCreateRelationEntity, setvisibleCreateRelationEntity)
180
+ }
181
+ </div>
182
+ {isFormFieldValid(formik, fieldLayoutInfo.attrs.name) && (
183
+ <div className="absolute mt-1">
184
+ <Message severity="error" text={formik?.errors[fieldLayoutInfo.attrs.name]?.toString()} />
185
+ </div>
186
+ )}
187
+ </div>
169
188
  </div>
170
189
  )}
171
- </div>
172
- </div>
190
+ </>
173
191
  );
174
192
  }
175
193
 
@@ -7,6 +7,8 @@ import * as Yup from 'yup';
7
7
  import { Schema } from "yup";
8
8
  import SolidFormView from "../../SolidFormView";
9
9
  import { FormikObject, ISolidField, SolidFieldProps } from "../ISolidField";
10
+ import { usePathname } from "next/navigation";
11
+ import { getExtensionComponent } from "@/helpers/registry";
10
12
 
11
13
 
12
14
  export class SolidRelationOneToManyField implements ISolidField {
@@ -64,7 +66,8 @@ export class SolidRelationOneToManyField implements ISolidField {
64
66
  const [refreshList, setRefreshList] = useState(false); // Added state for rerender
65
67
  const showFieldLabel = fieldLayoutInfo?.attrs?.showLabel;
66
68
  const readOnlyPermission = this.fieldContext.readOnly;
67
-
69
+ const pathname = usePathname();
70
+ const lastPathSegment = pathname.split('/').pop();
68
71
 
69
72
  const handlePopupOpen = (id: any) => {
70
73
  const formviewparams = {
@@ -104,7 +107,7 @@ export class SolidRelationOneToManyField implements ISolidField {
104
107
  useEffect(() => {
105
108
 
106
109
  const customFilter = this.fieldContext.fieldMetadata.relationCoModelFieldName ? this.fieldContext.fieldMetadata.relationCoModelFieldName : `${this.fieldContext.modelName}`
107
- const listviewparams = {
110
+ const listviewparams = {
108
111
  moduleName: this.fieldContext.fieldMetadata.relationModelModuleName,
109
112
  modelName: camelCase(this.fieldContext.fieldMetadata.relationCoModelSingularName),
110
113
  inlineCreate: readOnlyPermission === false ? true : false,
@@ -138,27 +141,43 @@ export class SolidRelationOneToManyField implements ISolidField {
138
141
  const formReadonly = solidFormViewMetaData.data.solidView?.layout?.attrs?.readonly;
139
142
 
140
143
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
141
-
144
+ const viewMode: string = this.fieldContext.viewMode;
145
+ let DynamicWidget = getExtensionComponent("SolidFormFieldRelationViewModeWidget");
146
+ const widgetProps = {
147
+ label: fieldLabel,
148
+ value: formik.values[fieldLayoutInfo.attrs.name],
149
+ }
142
150
 
143
151
  return (
144
- <div className={className}>
145
- {/* <div className="justify-content-center align-items-center"> */}
146
- {showFieldLabel != false &&
147
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
148
- {fieldMetadata.required && <span className="text-red-500"> *</span>}
149
- {/* &nbsp;{fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
150
- </label>
152
+ <>
153
+ {viewMode === "view" &&
154
+ <div className={className}>
155
+ {DynamicWidget && <DynamicWidget {...widgetProps} />}
156
+ </div>
151
157
  }
152
-
153
- {/* </div>
158
+ {viewMode === "edit" &&
159
+ (
160
+ <div className={className}>
161
+ {/* <div className="justify-content-center align-items-center"> */}
162
+ {showFieldLabel != false &&
163
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
164
+ {fieldMetadata.required && <span className="text-red-500"> *</span>}
165
+ {/* &nbsp;{fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
166
+ </label>
167
+ }
168
+
169
+ {/* </div>
154
170
  <br></br> */}
155
- {listViewParams &&
156
- <SolidListView key={refreshList.toString()} {...listViewParams} handlePopUpOpen={handlePopupOpen} />
157
- }
158
- {readOnlyPermission !== true &&
159
- this.renderSolidFormEmbededView(visibleCreateRelationEntity, setvisibleCreateRelationEntity, formViewParams, handlePopupClose)}
160
-
161
- </div>
171
+ {lastPathSegment === 'new' && <p>Please save the {solidFormViewMetaData.data.solidView.model.displayName} to be able to save {fieldMetadata.displayName}</p>}
172
+ {listViewParams && lastPathSegment !== 'new' &&
173
+ <SolidListView key={refreshList.toString()} {...listViewParams} handlePopUpOpen={handlePopupOpen} />
174
+ }
175
+ {readOnlyPermission !== true &&
176
+ this.renderSolidFormEmbededView(visibleCreateRelationEntity, setvisibleCreateRelationEntity, formViewParams, handlePopupClose)}
177
+
178
+ </div>
179
+ )}
180
+ </>
162
181
  );
163
182
 
164
183
  }
@@ -47,7 +47,7 @@ export const SolidBooleanFieldCheckboxWidget = ({ formik, fieldContext }: SolidB
47
47
  <div className="relative">
48
48
  <div className="flex flex-column gap-2 mt-4">
49
49
  {showFieldLabel !== false && (
50
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
50
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label font-medium">
51
51
  {fieldLabel}
52
52
  {fieldMetadata.required && <span className="text-red-500"> *</span>}
53
53
  </label>
@@ -31,7 +31,7 @@ export const SolidBooleanFieldSelectWidget = ({ formik, fieldContext }: SolidBoo
31
31
  <div className="relative">
32
32
  <div className="flex flex-column gap-2 mt-4">
33
33
  {showFieldLabel != false &&
34
- <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
34
+ <label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label font-medium">{fieldLabel}
35
35
  {fieldMetadata.required && <span className="text-red-500"> *</span>}
36
36
  {/* &nbsp; {fieldDescription && <span className="form_field_help">({fieldDescription}) </span>} */}
37
37
  </label>
@@ -0,0 +1,23 @@
1
+
2
+ import { javascript } from '@codemirror/lang-javascript';
3
+ import { oneDark } from '@codemirror/theme-one-dark';
4
+ import CodeMirror, { EditorView } from '@uiw/react-codemirror'; // Correct import
5
+
6
+
7
+ export const SolidFormFieldJsonViewModeWidget = ({ label, value }: any) => {
8
+ return (
9
+ <div className="mt-2 flex-column gap-2">
10
+ <p className="m-0"><span className="form-field-label font-medium">{label}</span></p>
11
+ <CodeMirror
12
+ id={label}
13
+ value={value}
14
+ height={'300px'}
15
+ style={{ fontSize: '10px' }}
16
+ theme={oneDark}
17
+ readOnly={true}
18
+ extensions={[javascript(), EditorView.lineWrapping]}
19
+ />
20
+ </div>
21
+ );
22
+ };
23
+
@@ -0,0 +1,13 @@
1
+
2
+ export const SolidFormFieldMediaViewModeWidget = ({ label, value }: any) => {
3
+ console.log("label", label);
4
+ console.log("value", value);
5
+
6
+ return (
7
+ <div className="mt-2 flex-column gap-2">
8
+ <p className="m-0 form-field-label font-medium">{label}</p>
9
+ <p className="m-0">{value}</p>
10
+ </div>
11
+ );
12
+ };
13
+
@@ -0,0 +1,23 @@
1
+ "use client"
2
+ import { useState } from "react";
3
+
4
+ export const SolidFormFieldPasswordViewModeWidget = ({ label, value }: any) => {
5
+ const [isText, setIsText] = useState(false)
6
+ return (
7
+ <div className="mt-2 flex-column gap-2">
8
+ <p className="m-0 form-field-label font-medium">{label}</p>
9
+ <div className="flex align-items-center gap-4">
10
+ <p className="m-0">
11
+ {isText ? value : "••••••••"}
12
+ </p>
13
+ <i
14
+ className={`pi ${isText ? 'pi-eye' : 'pi-eye-slash'}`}
15
+ onClick={() => setIsText(!isText)}
16
+ style={{ cursor: 'pointer' }}
17
+ />
18
+ </div>
19
+
20
+ </div>
21
+ );
22
+ };
23
+
@@ -0,0 +1,32 @@
1
+ import { Chip } from "primereact/chip";
2
+ import { Chips } from "primereact/chips";
3
+ import { useEffect, useState } from "react";
4
+
5
+ export const SolidFormFieldRelationViewModeWidget = ({ label, value }: any) => {
6
+ const [fieldValue, setFieldValue] = useState<any>([]);
7
+ useEffect(() => {
8
+ if (Array.isArray(value)) {
9
+
10
+ if (value.length > 0) {
11
+ const data = value.map((v: any) => v.label);
12
+ setFieldValue(data);
13
+ }
14
+ }
15
+ if (value && !Array.isArray(value) && typeof value === "object") {
16
+ setFieldValue([value.label]);
17
+ }
18
+ }, [value]);
19
+
20
+
21
+ return (
22
+ <div className="mt-2 flex-column">
23
+ <p className="m-0 form-field-label font-medium">{label}</p>
24
+ <div className="flex flex-wrap gap-2 mt-2">
25
+ {fieldValue.map((v: any) => (
26
+ <Chip key={v} label={v} className="view-widget-chip" />
27
+ ))}
28
+ </div>
29
+ </div>
30
+ );
31
+ };
32
+
@@ -0,0 +1,17 @@
1
+ import { Editor } from "primereact/editor";
2
+
3
+ export const SolidFormFieldRichTextViewModeWidget = ({ label, value }: any) => {
4
+ return (
5
+ <div>
6
+ <Editor
7
+ readOnly={true}
8
+ key={label} // React will re-render the component whenever this value changes
9
+ id={label}
10
+ value={value}
11
+ style={{ height: "320px" }}
12
+ className="solid-custom-editor"
13
+ />
14
+ </div>
15
+ );
16
+ };
17
+