@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.
- package/dist/components/common/SolidThemeProvider.js +2 -2
- package/dist/components/common/SolidThemeProvider.js.map +1 -1
- package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
- package/dist/components/core/common/FilterComponent.js +26 -10
- package/dist/components/core/common/FilterComponent.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +160 -94
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +43 -16
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/fields/ISolidField.d.ts +1 -0
- package/dist/components/core/form/fields/ISolidField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.js +9 -2
- package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.js +27 -11
- package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js +28 -11
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.js +24 -5
- package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidEmailField.js +24 -5
- package/dist/components/core/form/fields/SolidEmailField.js.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.js +24 -5
- package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.js +22 -3
- package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.js +30 -4
- package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.js +52 -29
- package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +39 -16
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidPasswordField.js +23 -3
- package/dist/components/core/form/fields/SolidPasswordField.js.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.js +23 -3
- package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js +14 -5
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.js +10 -2
- package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.js +28 -8
- package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.js +27 -8
- package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +15 -4
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -4
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +17 -5
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js +1 -1
- package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js +1 -1
- package/dist/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js +9 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js +8 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js +9 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js +20 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js +7 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts +3 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js +74 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts +3 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js +58 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts +2 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.d.ts.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js +6 -0
- package/dist/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.js.map +1 -0
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js +1 -1
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js +1 -1
- package/dist/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +37 -14
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/list/SolidListView.d.ts +3 -0
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +167 -95
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/users/CreateUser.js +1 -3
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/helpers/registry.d.ts.map +1 -1
- package/dist/helpers/registry.js +16 -0
- package/dist/helpers/registry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/globals.css +15 -5
- package/dist/resources/themes/solid-light-purple/solid-login-light.png +0 -0
- package/dist/resources/themes/solid-light-purple/theme.css +4 -0
- package/package.json +1 -1
- package/src/components/common/SolidThemeProvider.tsx +2 -2
- package/src/components/core/common/FilterComponent.tsx +39 -10
- package/src/components/core/common/SolidGlobalSearchElement.tsx +228 -135
- package/src/components/core/form/SolidFormView.tsx +69 -21
- package/src/components/core/form/fields/ISolidField.tsx +1 -0
- package/src/components/core/form/fields/SolidBooleanField.tsx +39 -25
- package/src/components/core/form/fields/SolidDateField.tsx +46 -32
- package/src/components/core/form/fields/SolidDateTimeField.tsx +47 -34
- package/src/components/core/form/fields/SolidDecimalField.tsx +42 -26
- package/src/components/core/form/fields/SolidEmailField.tsx +43 -27
- package/src/components/core/form/fields/SolidIntegerField.tsx +42 -25
- package/src/components/core/form/fields/SolidJsonField.tsx +40 -23
- package/src/components/core/form/fields/SolidLongTextField.tsx +86 -53
- package/src/components/core/form/fields/SolidMediaMultipleField.tsx +170 -139
- package/src/components/core/form/fields/SolidMediaSingleField.tsx +124 -93
- package/src/components/core/form/fields/SolidPasswordField.tsx +42 -25
- package/src/components/core/form/fields/SolidRichTextField.tsx +41 -24
- package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +46 -28
- package/src/components/core/form/fields/SolidSelectionStaticField.tsx +38 -22
- package/src/components/core/form/fields/SolidShortTextField.tsx +63 -47
- package/src/components/core/form/fields/SolidTimeField.tsx +47 -30
- package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +30 -8
- package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +49 -31
- package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +38 -19
- package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +1 -1
- package/src/components/core/form/fields/widgets/SolidBooleanSelectFieldWidget.tsx +1 -1
- package/src/components/core/form/fields/widgets/SolidFormFieldJsonViewModeWidget.tsx +23 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldMediaViewModeWidget.tsx +13 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldPasswordViewModeWidget.tsx +23 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldRelationViewModeWidget.tsx +32 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldRichTextViewModeWidget.tsx +17 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaMultipleWidget.tsx +157 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldViewMediaSingleWidget.tsx +98 -0
- package/src/components/core/form/fields/widgets/SolidFormFieldViewModeWidget.tsx +11 -0
- package/src/components/core/form/fields/widgets/SolidSelectionStaticAutocompleteFieldWidget.tsx +1 -1
- package/src/components/core/form/fields/widgets/SolidSelectionStaticRadioFieldWidget.tsx +1 -1
- package/src/components/core/kanban/SolidKanbanView.tsx +26 -5
- package/src/components/core/list/SolidListView.tsx +166 -105
- package/src/components/core/model/FieldMetaDataForm.tsx +1 -1
- package/src/components/core/users/CreateUser.tsx +5 -5
- package/src/helpers/registry.ts +16 -0
- package/src/index.ts +2 -1
- package/src/resources/globals.css +15 -5
- package/src/resources/themes/solid-light-purple/solid-login-light.png +0 -0
- package/src/resources/themes/solid-light-purple/theme.css +4 -0
- 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
|
-
|
|
83
|
-
|
|
84
|
-
<div className=
|
|
85
|
-
{
|
|
86
|
-
<label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">
|
|
87
|
-
{fieldLabel}
|
|
88
|
-
{fieldMetadata.required && <span className="text-red-500"> *</span>}
|
|
89
|
-
{/* {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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
+
{/* {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
|
-
|
|
110
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
<div className=
|
|
78
|
-
{
|
|
79
|
-
<label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
|
|
80
|
-
{fieldMetadata.required && <span className="text-red-500"> *</span>}
|
|
81
|
-
{/* {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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
+
{/* {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
|
-
|
|
101
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
<div className=
|
|
62
|
-
{
|
|
63
|
-
<label htmlFor={fieldLayoutInfo.attrs.name} className="form-field-label">{fieldLabel}
|
|
64
|
-
{fieldMetadata.required && <span className="text-red-500"> *</span>}
|
|
65
|
-
{/* {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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
{/* {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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
101
|
-
{
|
|
102
|
-
<
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
</label>
|
|
107
|
+
<>
|
|
108
|
+
{viewMode === "view" &&
|
|
109
|
+
<div className={className}>
|
|
110
|
+
{DynamicWidget && <DynamicWidget {...widgetProps} />}
|
|
111
|
+
</div>
|
|
106
112
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
+
{/* {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
|
-
|
|
143
|
-
|
|
144
|
-
{
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
+
{/* {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
|
-
|
|
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
|
}
|