@evoke-platform/ui-components 1.7.0-testing.8 → 1.8.0-dev.0
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/published/components/custom/FormV2/FormRenderer.js +15 -3
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +1 -6
- package/dist/published/components/custom/FormV2/components/AccordionSections.js +10 -7
- package/dist/published/components/custom/FormV2/components/ActionButtons.d.ts +1 -3
- package/dist/published/components/custom/FormV2/components/ActionButtons.js +8 -7
- package/dist/published/components/custom/FormV2/components/FieldWrapper.d.ts +0 -1
- package/dist/published/components/custom/FormV2/components/FieldWrapper.js +3 -1
- package/dist/published/components/custom/FormV2/components/FormContext.d.ts +15 -2
- package/dist/published/components/custom/FormV2/components/FormContext.js +9 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.d.ts +0 -7
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableField.d.ts +0 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableField.js +3 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableFieldInput.d.ts +0 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableFieldInput.js +3 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +0 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.d.ts +0 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.d.ts +0 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +3 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.d.ts +0 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.d.ts +0 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.js +3 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.d.ts +0 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +8 -8
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +2 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +4 -2
- package/dist/published/components/custom/FormV2/components/FormSections.js +4 -2
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +25 -26
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +0 -3
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +4 -2
- package/dist/published/components/custom/FormV2/components/types.d.ts +0 -32
- package/dist/published/components/custom/FormV2/components/utils.d.ts +1 -1
- package/dist/published/components/custom/FormV2/index.d.ts +2 -0
- package/dist/published/components/custom/FormV2/index.js +2 -0
- package/dist/published/components/custom/index.d.ts +1 -1
- package/dist/published/components/custom/index.js +1 -1
- package/dist/published/index.d.ts +1 -1
- package/dist/published/index.js +1 -1
- package/dist/published/theme/hooks.d.ts +13 -0
- package/package.json +3 -2
|
@@ -140,20 +140,32 @@ function FormRenderer(props) {
|
|
|
140
140
|
fontWeight: 400,
|
|
141
141
|
fontSize: '14px',
|
|
142
142
|
}, onClick: handleCollapseAll }, "Collapse all")))),
|
|
143
|
-
React.createElement(ValidationErrorDisplay, {
|
|
143
|
+
React.createElement(ValidationErrorDisplay, { formId: form.id, title: title })),
|
|
144
144
|
React.createElement(FormContext.Provider, { value: {
|
|
145
145
|
fetchedOptions,
|
|
146
146
|
setFetchedOptions: updateFetchedOptions,
|
|
147
147
|
getValues,
|
|
148
148
|
stickyFooter,
|
|
149
149
|
object,
|
|
150
|
+
errors,
|
|
151
|
+
instance,
|
|
152
|
+
richTextEditor,
|
|
153
|
+
expandedSections,
|
|
154
|
+
setExpandedSections,
|
|
155
|
+
expandAll,
|
|
156
|
+
setExpandAll,
|
|
157
|
+
parameters,
|
|
158
|
+
fieldHeight,
|
|
159
|
+
handleChange: onChange,
|
|
160
|
+
triggerFieldReset,
|
|
161
|
+
showSubmitError: isSubmitted,
|
|
150
162
|
} },
|
|
151
163
|
React.createElement(Box, { sx: {
|
|
152
164
|
padding: isModal ? '0px' : isSm || isXs ? 2 : 3,
|
|
153
165
|
paddingBottom: '0px',
|
|
154
166
|
paddingTop: !hasSections ? undefined : '0px',
|
|
155
167
|
} },
|
|
156
|
-
entries.map((entry, index) => (React.createElement(RecursiveEntryRenderer, {
|
|
168
|
+
entries.map((entry, index) => (React.createElement(RecursiveEntryRenderer, { key: index, entry: entry, isDocument: !!(form.id === 'documentForm') }))),
|
|
157
169
|
!hideButtons && (actionId || form.id === 'documentForm') && onSubmit && (React.createElement(Box, { sx: {
|
|
158
170
|
...(stickyFooter === false ? { position: 'static' } : { position: 'sticky' }),
|
|
159
171
|
bottom: isModal ? -5 : isSmallerThanMd ? 0 : 24,
|
|
@@ -169,7 +181,7 @@ function FormRenderer(props) {
|
|
|
169
181
|
marginBottom: '1px',
|
|
170
182
|
borderRadius: '0px 0px 6px 6px',
|
|
171
183
|
} },
|
|
172
|
-
React.createElement(ActionButtons, { onSubmit: onSubmit, handleSubmit: handleSubmit, isModal: isModal, actionType: action?.type, submitButtonLabel: display?.submitLabel, onReset: handleReset,
|
|
184
|
+
React.createElement(ActionButtons, { onSubmit: onSubmit, handleSubmit: handleSubmit, isModal: isModal, actionType: action?.type, submitButtonLabel: display?.submitLabel, onReset: handleReset, unregister: unregister, entries: entries, setValue: setValue, formId: form.id })))))));
|
|
173
185
|
}
|
|
174
186
|
else {
|
|
175
187
|
return (React.createElement(Box, { p: 2 },
|
|
@@ -463,12 +463,7 @@ function FormRendererContainer(props) {
|
|
|
463
463
|
})();
|
|
464
464
|
}
|
|
465
465
|
const isLoading = (instanceId && !formData && !document) || !form || !sanitizedObject;
|
|
466
|
-
return !error ? (React.createElement(
|
|
467
|
-
backgroundColor: '#ffffff',
|
|
468
|
-
borderRadius: '6px',
|
|
469
|
-
padding: '0px',
|
|
470
|
-
border: !isLoading ? '1px solid #dbe0e4' : undefined,
|
|
471
|
-
} },
|
|
466
|
+
return !error ? (React.createElement(React.Fragment, null,
|
|
472
467
|
!isLoading ? (React.createElement(React.Fragment, null,
|
|
473
468
|
React.createElement(FormRenderer, { onSubmit: saveHandler, hideButtons: document && !hasDocumentUpdateAccess, richTextEditor: richTextEditor, fieldHeight: display?.fieldHeight ?? 'medium', value: formData, stickyFooter: stickyFooter, form: form, instance: dataType !== 'documents' ? instance : document, onChange: onChange, onCancel: onCancel }))) : (React.createElement(Box, { sx: { padding: '20px' } },
|
|
474
469
|
React.createElement(Box, { display: 'flex', width: '100%', justifyContent: 'space-between' },
|
|
@@ -2,13 +2,15 @@ import { ExpandMoreOutlined } from '@mui/icons-material';
|
|
|
2
2
|
import { nanoid } from 'nanoid';
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { useResponsive } from '../../../../theme';
|
|
5
|
+
import { useFormContext } from '../../../../theme/hooks';
|
|
5
6
|
import { Accordion, AccordionDetails, AccordionSummary, Typography } from '../../../core';
|
|
6
7
|
import { Box } from '../../../layout';
|
|
7
8
|
import { RecursiveEntryRenderer } from './RecursiveEntryRenderer';
|
|
8
9
|
import { getErrorCountForSection } from './utils';
|
|
9
10
|
function AccordionSections(props) {
|
|
10
|
-
const { entry
|
|
11
|
+
const { entry } = props;
|
|
11
12
|
const { isMd, isLg, isXl } = useResponsive();
|
|
13
|
+
const { errors, expandedSections, setExpandedSections, expandAll, setExpandAll, showSubmitError } = useFormContext();
|
|
12
14
|
const lastSection = entry.sections.length - 1;
|
|
13
15
|
const sectionsWithIds = React.useMemo(() => assignIds(entry.sections), [entry]);
|
|
14
16
|
function collectNestedSections(entries = []) {
|
|
@@ -65,17 +67,18 @@ function AccordionSections(props) {
|
|
|
65
67
|
}
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
if (expandAll !== null) {
|
|
68
|
-
setExpandedSections(getExpandedSections(sectionsWithIds, expandAll));
|
|
70
|
+
setExpandedSections && setExpandedSections(getExpandedSections(sectionsWithIds, expandAll));
|
|
69
71
|
}
|
|
70
72
|
}, [expandAll, sectionsWithIds]);
|
|
71
73
|
const handleAccordionChange = (id) => {
|
|
72
|
-
const updatedSections = expandedSections
|
|
73
|
-
setExpandedSections
|
|
74
|
-
|
|
74
|
+
const updatedSections = expandedSections?.map((section) => section.id === id ? { ...section, expanded: !section.expanded } : section);
|
|
75
|
+
if (setExpandedSections && updatedSections)
|
|
76
|
+
setExpandedSections(updatedSections);
|
|
77
|
+
setExpandAll && setExpandAll(null);
|
|
75
78
|
};
|
|
76
79
|
return (React.createElement(Box, null, sectionsWithIds.map((section, sectionIndex) => {
|
|
77
80
|
const errorCount = getErrorCountForSection(section, errors);
|
|
78
|
-
return (React.createElement(Accordion, { key: section.id, expanded: expandedSections
|
|
81
|
+
return (React.createElement(Accordion, { key: section.id, expanded: expandedSections?.find((expandedSection) => expandedSection.id === section.id)?.expanded ??
|
|
79
82
|
!!expandAll, onChange: () => handleAccordionChange(section.id), defaultExpanded: sectionIndex === 0, sx: {
|
|
80
83
|
border: '1px solid #dbe0e4',
|
|
81
84
|
boxShadow: 'none',
|
|
@@ -125,7 +128,7 @@ function AccordionSections(props) {
|
|
|
125
128
|
margin: '0px',
|
|
126
129
|
marginRight: '16px',
|
|
127
130
|
} }, errorCount)))),
|
|
128
|
-
React.createElement(AccordionDetails, null, section.entries?.map((sectionEntry, index) => (React.createElement(RecursiveEntryRenderer, { key: sectionEntry.type + index, entry: sectionEntry
|
|
131
|
+
React.createElement(AccordionDetails, null, section.entries?.map((sectionEntry, index) => (React.createElement(RecursiveEntryRenderer, { key: sectionEntry.type + index, entry: sectionEntry }))))));
|
|
129
132
|
})));
|
|
130
133
|
}
|
|
131
134
|
export default AccordionSections;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionType, FormEntry } from '@evoke-platform/context';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { FieldValues, UseFormReturn, UseFormSetValue, UseFormUnregister } from 'react-hook-form';
|
|
4
4
|
type ActionButtonProps = {
|
|
5
5
|
onSubmit: (data: FieldValues) => void;
|
|
6
6
|
handleSubmit: UseFormReturn['handleSubmit'];
|
|
@@ -8,12 +8,10 @@ type ActionButtonProps = {
|
|
|
8
8
|
submitButtonLabel?: string;
|
|
9
9
|
actionType?: ActionType;
|
|
10
10
|
onReset: () => void;
|
|
11
|
-
errors?: FieldErrors;
|
|
12
11
|
unregister: UseFormUnregister<FieldValues>;
|
|
13
12
|
entries: FormEntry[];
|
|
14
13
|
setValue: UseFormSetValue<FieldValues>;
|
|
15
14
|
formId?: string;
|
|
16
|
-
instance?: FieldValues;
|
|
17
15
|
};
|
|
18
16
|
declare function ActionButtons(props: ActionButtonProps): React.JSX.Element;
|
|
19
17
|
export default ActionButtons;
|
|
@@ -6,10 +6,10 @@ import { Box } from '../../../layout';
|
|
|
6
6
|
import { FormContext } from './FormContext';
|
|
7
7
|
import { entryIsVisible, getEntryId, getNestedParameterIds, isAddressProperty, scrollIntoViewWithOffset, } from './utils';
|
|
8
8
|
function ActionButtons(props) {
|
|
9
|
-
const { onSubmit, submitButtonLabel, actionType, handleSubmit, onReset, unregister,
|
|
9
|
+
const { onSubmit, submitButtonLabel, actionType, handleSubmit, onReset, unregister, isModal, entries, setValue, formId, } = props;
|
|
10
10
|
const { isXs } = useResponsive();
|
|
11
11
|
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
|
|
12
|
-
const { getValues } = useContext(FormContext);
|
|
12
|
+
const { getValues, instance, errors } = useContext(FormContext);
|
|
13
13
|
const unregisterHiddenFields = (entriesToCheck) => {
|
|
14
14
|
entriesToCheck.forEach((entry) => {
|
|
15
15
|
if (entry.type === 'sections' || entry.type === 'columns') {
|
|
@@ -35,11 +35,12 @@ function ActionButtons(props) {
|
|
|
35
35
|
};
|
|
36
36
|
const processFieldUnregister = (fieldId) => {
|
|
37
37
|
if (isAddressProperty(fieldId)) {
|
|
38
|
-
// Unregister entire
|
|
39
|
-
|
|
40
|
-
addressValues =
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
// Unregister entire addressObject to clear hidden field errors, then restore existing values since unregistering address.line1 etc is not working
|
|
39
|
+
const [addressObject, addressField] = fieldId.split('.');
|
|
40
|
+
let addressValues = getValues(addressObject);
|
|
41
|
+
addressValues = omit(addressValues, addressField);
|
|
42
|
+
unregister(addressObject);
|
|
43
|
+
setValue(addressObject, addressValues);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
unregister(fieldId);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Help, InfoRounded } from '@mui/icons-material';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useFormContext } from '../../../../theme/hooks';
|
|
3
4
|
import { IconButton, InputLabel, Tooltip, Typography } from '../../../core';
|
|
4
5
|
import { Box } from '../../../layout';
|
|
5
6
|
const underFieldStyles = {
|
|
@@ -48,7 +49,8 @@ const PrefixSuffix = (props) => {
|
|
|
48
49
|
* description, tooltip, prefix, suffix and word/char counts
|
|
49
50
|
*/
|
|
50
51
|
const FieldWrapper = (props) => {
|
|
51
|
-
const { inputId, label, description, tooltip, prefix, suffix, value, maxLength, errorMessage, showCharCount, inputType, viewOnly, children,
|
|
52
|
+
const { inputId, label, description, tooltip, prefix, suffix, value, maxLength, errorMessage, showCharCount, inputType, viewOnly, children, required, } = props;
|
|
53
|
+
const { fieldHeight } = useFormContext();
|
|
52
54
|
const charCount = typeof value === 'string' ? value.length : 0;
|
|
53
55
|
const remainingChars = maxLength ? maxLength - charCount : undefined;
|
|
54
56
|
return (React.createElement(Box, null,
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { InputParameter, Obj } from '@evoke-platform/context';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
3
|
import { FieldValues, UseFormGetValues } from 'react-hook-form';
|
|
4
|
+
import { ExpandedSection, SimpleEditorProps } from './types';
|
|
4
5
|
type FormContextType = {
|
|
5
6
|
fetchedOptions: FieldValues;
|
|
6
7
|
setFetchedOptions: (newData: FieldValues) => void;
|
|
7
8
|
getValues: UseFormGetValues<FieldValues>;
|
|
8
9
|
stickyFooter?: boolean;
|
|
9
10
|
object?: Obj;
|
|
11
|
+
errors?: FieldValues;
|
|
12
|
+
instance?: FieldValues;
|
|
13
|
+
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
14
|
+
expandAll?: boolean | undefined | null;
|
|
15
|
+
expandedSections?: ExpandedSection[];
|
|
16
|
+
setExpandedSections?: React.Dispatch<React.SetStateAction<ExpandedSection[]>>;
|
|
17
|
+
setExpandAll?: React.Dispatch<React.SetStateAction<boolean | undefined | null>>;
|
|
18
|
+
parameters?: InputParameter[];
|
|
19
|
+
handleChange: (name: string, value: unknown) => void;
|
|
20
|
+
fieldHeight?: 'small' | 'medium';
|
|
21
|
+
triggerFieldReset?: boolean;
|
|
22
|
+
showSubmitError?: boolean;
|
|
10
23
|
};
|
|
11
24
|
export declare const FormContext: import("react").Context<FormContextType>;
|
|
12
25
|
export {};
|
|
@@ -5,4 +5,13 @@ export const FormContext = createContext({
|
|
|
5
5
|
getValues: (() => ({})),
|
|
6
6
|
stickyFooter: false,
|
|
7
7
|
object: undefined,
|
|
8
|
+
errors: {},
|
|
9
|
+
instance: {},
|
|
10
|
+
expandAll: undefined,
|
|
11
|
+
expandedSections: [],
|
|
12
|
+
parameters: [],
|
|
13
|
+
showSubmitError: false,
|
|
14
|
+
triggerFieldReset: false,
|
|
15
|
+
handleChange: () => { },
|
|
16
|
+
fieldHeight: 'medium',
|
|
8
17
|
});
|
package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { InputField, InputParameter, InputParameterReference, Property, ReadonlyField } from '@evoke-platform/context';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { FieldErrors, FieldValues } from 'react-hook-form';
|
|
4
|
-
import { Address } from '../../../FormField/AddressFieldComponent';
|
|
5
3
|
interface AddressProps {
|
|
6
4
|
entry: InputParameterReference | ReadonlyField | InputField;
|
|
7
|
-
errors?: FieldErrors;
|
|
8
|
-
handleChange: (propertyId: string, value: string | Address | undefined) => void;
|
|
9
|
-
fieldHeight?: 'small' | 'medium';
|
|
10
5
|
readOnly?: boolean;
|
|
11
|
-
parameters?: InputParameter[];
|
|
12
|
-
instance?: FieldValues;
|
|
13
6
|
entryId: string;
|
|
14
7
|
fieldDefinition: InputParameter | Property;
|
|
15
8
|
}
|
|
@@ -6,8 +6,8 @@ import FormField from '../../../FormField';
|
|
|
6
6
|
import FieldWrapper from '../FieldWrapper';
|
|
7
7
|
import { getPrefixedUrl, isOptionEqualToValue } from '../utils';
|
|
8
8
|
function AddressFields(props) {
|
|
9
|
-
const { entry,
|
|
10
|
-
const { getValues } = useFormContext();
|
|
9
|
+
const { entry, readOnly, entryId, fieldDefinition } = props;
|
|
10
|
+
const { getValues, instance, errors, handleChange, fieldHeight, parameters } = useFormContext();
|
|
11
11
|
const apiServices = useApiServices();
|
|
12
12
|
const addressObject = entryId.split('.')[0];
|
|
13
13
|
const addressField = entryId.split('.')[1];
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { ObjWithRoot as EvokeObjectWithRoot, InputParameter, ObjectInstance, Property, ViewLayoutEntityReference } from '@evoke-platform/context';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
export type DropdownRepeatableFieldProps = {
|
|
5
4
|
id: string;
|
|
6
5
|
fieldDefinition: InputParameter | Property;
|
|
7
|
-
instance?: FieldValues;
|
|
8
6
|
criteria?: object;
|
|
9
7
|
readOnly: boolean;
|
|
10
8
|
initialMiddleObjectInstances: ObjectInstance[];
|
|
11
9
|
middleObject: EvokeObjectWithRoot;
|
|
12
|
-
fieldHeight?: 'small' | 'medium';
|
|
13
10
|
hasDescription?: boolean;
|
|
14
11
|
viewLayout?: ViewLayoutEntityReference;
|
|
15
12
|
};
|
|
@@ -7,8 +7,8 @@ import { retrieveCustomErrorMessage } from '../../../../Form/utils';
|
|
|
7
7
|
import { getMiddleObject, getMiddleObjectFilter, getPrefixedUrl, transformToWhere } from '../../utils';
|
|
8
8
|
import { DropdownRepeatableFieldInput } from './DropdownRepeatableFieldInput';
|
|
9
9
|
const DropdownRepeatableField = (props) => {
|
|
10
|
-
const { id, fieldDefinition, criteria,
|
|
11
|
-
const { fetchedOptions, setFetchedOptions } = useFormContext();
|
|
10
|
+
const { id, fieldDefinition, criteria, readOnly, initialMiddleObjectInstances, middleObject, hasDescription, viewLayout, } = props;
|
|
11
|
+
const { fetchedOptions, setFetchedOptions, instance } = useFormContext();
|
|
12
12
|
const [layout, setLayout] = useState();
|
|
13
13
|
const [loading, setLoading] = useState(false);
|
|
14
14
|
const [layoutLoaded, setLayoutLoaded] = useState(false);
|
|
@@ -228,6 +228,6 @@ const DropdownRepeatableField = (props) => {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
return initialLoading || !middleObject || !middleObjectInstances || !endObjectInstances || !endObject ? (React.createElement(Skeleton, null)) : (React.createElement(React.Fragment, null, middleObjectInstances && endObject && (React.createElement(DropdownRepeatableFieldInput, { id: id, fieldDefinition: fieldDefinition, readOnly: readOnly || !middleObject.actions?.some((action) => action.id === '_create'), layout: layout, middleObjectInstances: middleObjectInstances, endObjectInstances: endObjectInstances ?? [], endObject: endObject, searchValue: searchValue, loading: loading, handleSaveMiddleInstance: saveMiddleInstance, handleRemoveMiddleInstance: removeMiddleInstance, setSearchValue: setSearchValue, setSnackbarError: setSnackbarError, snackbarError: snackbarError, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, setDropdownSelections: setDropDownSelections,
|
|
231
|
+
return initialLoading || !middleObject || !middleObjectInstances || !endObjectInstances || !endObject ? (React.createElement(Skeleton, null)) : (React.createElement(React.Fragment, null, middleObjectInstances && endObject && (React.createElement(DropdownRepeatableFieldInput, { id: id, fieldDefinition: fieldDefinition, readOnly: readOnly || !middleObject.actions?.some((action) => action.id === '_create'), layout: layout, middleObjectInstances: middleObjectInstances, endObjectInstances: endObjectInstances ?? [], endObject: endObject, searchValue: searchValue, loading: loading, handleSaveMiddleInstance: saveMiddleInstance, handleRemoveMiddleInstance: removeMiddleInstance, setSearchValue: setSearchValue, setSnackbarError: setSnackbarError, snackbarError: snackbarError, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, setDropdownSelections: setDropDownSelections, hasDescription: hasDescription }))));
|
|
232
232
|
};
|
|
233
233
|
export default DropdownRepeatableField;
|
|
@@ -11,7 +11,6 @@ type DropdownRepeatableFieldInputProps = {
|
|
|
11
11
|
endObject: Pick<Obj, 'id' | 'name' | 'properties'>;
|
|
12
12
|
searchValue: string;
|
|
13
13
|
loading: boolean;
|
|
14
|
-
fieldHeight?: 'small' | 'medium';
|
|
15
14
|
handleSaveMiddleInstance: (endObjectId: string, endObjectName: string) => void;
|
|
16
15
|
handleRemoveMiddleInstance: (instanceId: string) => void;
|
|
17
16
|
setSearchValue: (value: string) => void;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { difference, isEmpty, isObject } from 'lodash';
|
|
2
2
|
import Handlebars from 'no-eval-handlebars';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { useFormContext } from '../../../../../../theme/hooks';
|
|
4
5
|
import { Snackbar, TextField, Typography } from '../../../../../core';
|
|
5
6
|
import FormField from '../../../../FormField';
|
|
6
7
|
import { normalizeDates } from '../../utils';
|
|
7
8
|
const isDropdownRepeatableFieldInputOption = (option) => isObject(option) && 'label' in option && 'endObjectId' in option;
|
|
8
9
|
export const DropdownRepeatableFieldInput = (props) => {
|
|
9
|
-
const { id, fieldDefinition, readOnly, layout, middleObjectInstances, endObjectInstances, endObject, searchValue, loading, handleSaveMiddleInstance, handleRemoveMiddleInstance, setSearchValue, selectedOptions, setSnackbarError, snackbarError, setDropdownSelections,
|
|
10
|
+
const { id, fieldDefinition, readOnly, layout, middleObjectInstances, endObjectInstances, endObject, searchValue, loading, handleSaveMiddleInstance, handleRemoveMiddleInstance, setSearchValue, selectedOptions, setSnackbarError, snackbarError, setDropdownSelections, hasDescription, } = props;
|
|
11
|
+
const { fieldHeight } = useFormContext();
|
|
10
12
|
const [selectOptions, setSelectOptions] = useState([]);
|
|
11
13
|
useEffect(() => {
|
|
12
14
|
setDropdownSelections && setDropdownSelections(middleObjectInstances);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { InputParameter, Property, ViewLayoutEntityReference } from '@evoke-platform/context';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
export type ObjectPropertyInputProps = {
|
|
5
4
|
fieldDefinition: InputParameter | Property;
|
|
6
|
-
instance?: FieldValues;
|
|
7
5
|
canUpdateProperty: boolean;
|
|
8
6
|
criteria?: object;
|
|
9
7
|
viewLayout?: ViewLayoutEntityReference;
|
|
@@ -36,8 +36,8 @@ const styles = {
|
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
const RepeatableField = (props) => {
|
|
39
|
-
const { fieldDefinition,
|
|
40
|
-
const { fetchedOptions, setFetchedOptions } = useFormContext();
|
|
39
|
+
const { fieldDefinition, canUpdateProperty, criteria, viewLayout } = props;
|
|
40
|
+
const { fetchedOptions, setFetchedOptions, instance } = useFormContext();
|
|
41
41
|
const { instanceChanges } = useNotification();
|
|
42
42
|
const apiServices = useApiServices();
|
|
43
43
|
const { smallerThan } = useResponsive();
|
|
@@ -6,9 +6,9 @@ import { Box } from '../../../../layout';
|
|
|
6
6
|
import CriteriaBuilder from '../../../CriteriaBuilder';
|
|
7
7
|
import { addressProperties, getPrefixedUrl } from '../utils';
|
|
8
8
|
export default function Criteria(props) {
|
|
9
|
-
const {
|
|
9
|
+
const { value, canUpdateProperty, fieldDefinition, error } = props;
|
|
10
10
|
const apiServices = useApiServices();
|
|
11
|
-
const { fetchedOptions, setFetchedOptions } = useFormContext();
|
|
11
|
+
const { fetchedOptions, setFetchedOptions, handleChange } = useFormContext();
|
|
12
12
|
const [loadingError, setLoadingError] = useState(false);
|
|
13
13
|
const [loading, setLoading] = useState(false);
|
|
14
14
|
const [properties, setProperties] = useState(fetchedOptions[`${fieldDefinition.id}Options`] || []);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { DocumentParameterValidation } from '@evoke-platform/context';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
import { SavedDocumentReference } from '../../types';
|
|
5
4
|
type DocumentProps = {
|
|
6
5
|
id: string;
|
|
7
|
-
handleChange: (propertyId: string, value: (File | SavedDocumentReference)[] | undefined) => void;
|
|
8
|
-
instance?: FieldValues;
|
|
9
6
|
canUpdateProperty: boolean;
|
|
10
7
|
error: boolean;
|
|
11
8
|
validate?: DocumentParameterValidation;
|
package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js
CHANGED
|
@@ -10,9 +10,9 @@ import { Box, Grid } from '../../../../../layout';
|
|
|
10
10
|
import { getPrefixedUrl } from '../../utils';
|
|
11
11
|
import { DocumentList } from './DocumentList';
|
|
12
12
|
export const Document = (props) => {
|
|
13
|
-
const { id,
|
|
13
|
+
const { id, canUpdateProperty, error, value, validate, hasDescription } = props;
|
|
14
14
|
const apiServices = useApiServices();
|
|
15
|
-
const { fetchedOptions, setFetchedOptions, object } = useFormContext();
|
|
15
|
+
const { fetchedOptions, setFetchedOptions, object, handleChange, instance } = useFormContext();
|
|
16
16
|
const [snackbarError, setSnackbarError] = useState();
|
|
17
17
|
const [documents, setDocuments] = useState();
|
|
18
18
|
const [hasUpdatePermission, setHasUpdatePermission] = useState(fetchedOptions[`${id}UpdatePermission`]);
|
|
@@ -110,7 +110,7 @@ export const Document = (props) => {
|
|
|
110
110
|
? `Maximum size is ${formattedMaxSize}.`
|
|
111
111
|
: `The maximum size of each document is ${formattedMaxSize}.`)))))),
|
|
112
112
|
canUpdateProperty && isNil(hasUpdatePermission) && (React.createElement(Skeleton, { variant: "rectangular", height: formattedMaxSize || allowedTypesMessage ? '136px' : '115px', sx: { margin: '5px 0', borderRadius: '8px' } })),
|
|
113
|
-
React.createElement(DocumentList, { id: id,
|
|
113
|
+
React.createElement(DocumentList, { id: id, handleChange: handleChange, value: value, setSnackbarError: (type, message) => setSnackbarError({ message, type }), canUpdateProperty: canUpdateProperty && !!hasUpdatePermission }),
|
|
114
114
|
React.createElement(Snackbar, { open: !!snackbarError?.message, handleClose: () => setSnackbarError(null), message: snackbarError?.message, error: snackbarError?.type === 'error' }),
|
|
115
115
|
errors.length > 0 && (React.createElement(Box, { display: 'flex', alignItems: 'center' },
|
|
116
116
|
React.createElement(InfoRounded, { sx: { fontSize: '.75rem', marginRight: '3px', color: '#D3271B' } }),
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FieldValues } from 'react-hook-form';
|
|
3
2
|
import { SavedDocumentReference } from '../../types';
|
|
4
3
|
type DocumentListProps = {
|
|
5
4
|
handleChange: (propertyId: string, value: (File | SavedDocumentReference)[] | undefined) => void;
|
|
6
5
|
id: string;
|
|
7
|
-
instance?: FieldValues;
|
|
8
6
|
canUpdateProperty: boolean;
|
|
9
7
|
value: (File | SavedDocumentReference)[] | undefined;
|
|
10
8
|
setSnackbarError: (type: 'error' | 'success', message: string) => void;
|
|
@@ -24,9 +24,9 @@ const viewableFileTypes = [
|
|
|
24
24
|
'text/plain',
|
|
25
25
|
];
|
|
26
26
|
export const DocumentList = (props) => {
|
|
27
|
-
const { handleChange, id, canUpdateProperty,
|
|
27
|
+
const { handleChange, id, canUpdateProperty, value: documents, setSnackbarError } = props;
|
|
28
28
|
const apiServices = useApiServices();
|
|
29
|
-
const { fetchedOptions, setFetchedOptions, object } = useFormContext();
|
|
29
|
+
const { fetchedOptions, setFetchedOptions, object, instance } = useFormContext();
|
|
30
30
|
const [hasViewPermission, setHasViewPermission] = useState(fetchedOptions[`${id}ViewPermission`] ?? true);
|
|
31
31
|
const [savedDocuments, setSavedDocuments] = useState(fetchedOptions[`${id}SavedDocuments`]);
|
|
32
32
|
useEffect(() => {
|
|
@@ -2,6 +2,7 @@ import { BackupOutlined, ClearRounded } from '@mui/icons-material';
|
|
|
2
2
|
import { CardMedia } from '@mui/material';
|
|
3
3
|
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import { useDropzone } from 'react-dropzone';
|
|
5
|
+
import { useFormContext } from '../../../../../theme/hooks';
|
|
5
6
|
import { IconButton, Typography } from '../../../../core';
|
|
6
7
|
import { Box, Grid } from '../../../../layout';
|
|
7
8
|
export function blobToDataUrl(blob) {
|
|
@@ -54,7 +55,8 @@ const styles = {
|
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
export const Image = (props) => {
|
|
57
|
-
const { id,
|
|
58
|
+
const { id, canUpdateProperty, error, value, hasDescription } = props;
|
|
59
|
+
const { handleChange } = useFormContext();
|
|
58
60
|
const [image, setImage] = useState();
|
|
59
61
|
useEffect(() => {
|
|
60
62
|
if (typeof value === 'string') {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { UserAccount } from '@evoke-platform/context';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
export type UserPropertyProps = {
|
|
4
3
|
id: string;
|
|
5
|
-
handleChange: (id: string, user: UserAccount | undefined) => void;
|
|
6
4
|
error?: boolean;
|
|
7
5
|
value?: {
|
|
8
6
|
id: string;
|
|
9
7
|
name: string;
|
|
10
8
|
};
|
|
11
|
-
fieldHeight?: 'small' | 'medium';
|
|
12
9
|
readOnly?: boolean;
|
|
13
10
|
hasDescription?: boolean;
|
|
14
11
|
};
|
|
@@ -5,8 +5,8 @@ import { useFormContext } from '../../../../../theme/hooks';
|
|
|
5
5
|
import { Autocomplete, Paper, TextField, Typography } from '../../../../core';
|
|
6
6
|
import { getPrefixedUrl, isOptionEqualToValue } from '../utils';
|
|
7
7
|
const UserProperty = (props) => {
|
|
8
|
-
const { id,
|
|
9
|
-
const { fetchedOptions, setFetchedOptions } = useFormContext();
|
|
8
|
+
const { id, error, value, readOnly, hasDescription } = props;
|
|
9
|
+
const { fetchedOptions, setFetchedOptions, handleChange, fieldHeight } = useFormContext();
|
|
10
10
|
const [loadingOptions, setLoadingOptions] = useState(false);
|
|
11
11
|
const apiServices = useApiServices();
|
|
12
12
|
const [options, setOptions] = useState(fetchedOptions[`${id}Options`] || []);
|
|
@@ -10,8 +10,8 @@ import { Box } from '../../../../../layout';
|
|
|
10
10
|
import { encodePageSlug, getDefaultPages, getPrefixedUrl, transformToWhere } from '../../utils';
|
|
11
11
|
import RelatedObjectInstance from './RelatedObjectInstance';
|
|
12
12
|
const ObjectPropertyInput = (props) => {
|
|
13
|
-
const { id,
|
|
14
|
-
const { fetchedOptions, setFetchedOptions } = useFormContext();
|
|
13
|
+
const { id, fieldDefinition, nestedFieldsView, readOnly, error, mode, displayOption, filter, defaultValueCriteria, sortBy, orderBy, isModal, initialValue, viewLayout, hasDescription, } = props;
|
|
14
|
+
const { fetchedOptions, setFetchedOptions, parameters, fieldHeight, handleChange: handleChangeObjectField, instance, } = useFormContext();
|
|
15
15
|
const { defaultPages, findDefaultPageSlugFor } = useApp();
|
|
16
16
|
const [selectedInstance, setSelectedInstance] = useState(initialValue || undefined);
|
|
17
17
|
const [openCreateDialog, setOpenCreateDialog] = useState(false);
|
|
@@ -86,7 +86,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
86
86
|
}
|
|
87
87
|
if (instances && instances.length > 0) {
|
|
88
88
|
setSelectedInstance(instances[0]);
|
|
89
|
-
|
|
89
|
+
handleChangeObjectField(id, instances[0]);
|
|
90
90
|
}
|
|
91
91
|
setLoadingOptions(false);
|
|
92
92
|
});
|
|
@@ -313,12 +313,12 @@ const ObjectPropertyInput = (props) => {
|
|
|
313
313
|
if (isNil(value)) {
|
|
314
314
|
setDropdownInput(undefined);
|
|
315
315
|
setSelectedInstance(undefined);
|
|
316
|
-
|
|
316
|
+
handleChangeObjectField(id, null);
|
|
317
317
|
}
|
|
318
318
|
else {
|
|
319
319
|
const selectedInstance = options.find((o) => o.id === value?.value);
|
|
320
320
|
setSelectedInstance(selectedInstance);
|
|
321
|
-
|
|
321
|
+
handleChangeObjectField(id, selectedInstance);
|
|
322
322
|
}
|
|
323
323
|
}, selectOnFocus: false, onBlur: () => setDropdownInput(undefined), renderInput: (params) => (React.createElement(TextField, { ...params, placeholder: selectedInstance?.id || readOnly ? '' : 'Select', readOnly: !loadingOptions && !selectedInstance?.id && readOnly, onChange: (event) => setDropdownInput(event.target.value), onClick: (e) => {
|
|
324
324
|
if (openOptions &&
|
|
@@ -398,7 +398,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
398
398
|
React.createElement("span", null,
|
|
399
399
|
React.createElement(IconButton, { onClick: (event) => {
|
|
400
400
|
event.stopPropagation();
|
|
401
|
-
|
|
401
|
+
handleChangeObjectField(id, null);
|
|
402
402
|
setSelectedInstance(undefined);
|
|
403
403
|
}, sx: { p: 0, marginBottom: '4px' }, "aria-label": `Unlink` },
|
|
404
404
|
React.createElement(Close, { sx: { width: '20px', height: '20px' } }))))) : (React.createElement(Button, { sx: {
|
|
@@ -422,7 +422,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
422
422
|
event.stopPropagation();
|
|
423
423
|
setOpenCreateDialog(true);
|
|
424
424
|
}, "aria-label": `Add` }, "Add")))),
|
|
425
|
-
openCreateDialog && (React.createElement(React.Fragment, null, nestedFieldsView ? (React.createElement(RelatedObjectInstance, { id: id, handleClose: handleClose,
|
|
425
|
+
openCreateDialog && (React.createElement(React.Fragment, null, nestedFieldsView ? (React.createElement(RelatedObjectInstance, { id: id, handleClose: handleClose, setSelectedInstance: setSelectedInstance, relatedObject: relatedObject, nestedFieldsView: nestedFieldsView, mode: mode, displayOption: displayOption, setOptions: setOptions, options: options, filter: updatedCriteria, layout: layout, form: form, action: action, setSnackbarError: setSnackbarError, selectedInstance: selectedInstance })) : (React.createElement(Dialog, { fullWidth: true, maxWidth: "md", open: openCreateDialog, onClose: (e, reason) => reason !== 'backdropClick' && handleClose },
|
|
426
426
|
React.createElement(Typography, { sx: {
|
|
427
427
|
marginTop: '28px',
|
|
428
428
|
fontSize: '22px',
|
|
@@ -430,7 +430,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
430
430
|
marginLeft: '24px',
|
|
431
431
|
marginBottom: '10px',
|
|
432
432
|
} }, `Add ${fieldDefinition.name}`),
|
|
433
|
-
React.createElement(RelatedObjectInstance, { handleClose: handleClose,
|
|
433
|
+
React.createElement(RelatedObjectInstance, { handleClose: handleClose, setSelectedInstance: setSelectedInstance, nestedFieldsView: nestedFieldsView, relatedObject: relatedObject, id: id, mode: mode, displayOption: displayOption, setOptions: setOptions, options: options, filter: updatedCriteria, layout: layout, form: form, action: action, setSnackbarError: setSnackbarError, selectedInstance: selectedInstance }))))),
|
|
434
434
|
React.createElement(Snackbar, { open: snackbarError.showAlert, handleClose: () => setSnackbarError({
|
|
435
435
|
isError: snackbarError.isError,
|
|
436
436
|
showAlert: false,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Action, EvokeForm, Obj, ObjectInstance, TableViewLayout } from '@evoke-platform/context';
|
|
2
|
-
import React
|
|
3
|
-
import { BaseProps
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { BaseProps } from '../../types';
|
|
4
4
|
export type RelatedObjectInstanceProps = BaseProps & {
|
|
5
5
|
relatedObject: Obj | undefined;
|
|
6
6
|
id: string;
|
|
7
7
|
setSelectedInstance: (selectedInstance: ObjectInstance) => void;
|
|
8
|
-
handleChangeObjectProperty: (propertyId: string, instance?: any) => void;
|
|
9
8
|
handleClose: () => void;
|
|
10
9
|
mode: 'default' | 'existingOnly' | 'newOnly';
|
|
11
10
|
setSnackbarError: React.Dispatch<React.SetStateAction<{
|
|
@@ -19,8 +18,6 @@ export type RelatedObjectInstanceProps = BaseProps & {
|
|
|
19
18
|
options: ObjectInstance[];
|
|
20
19
|
filter?: Record<string, unknown>;
|
|
21
20
|
layout?: TableViewLayout;
|
|
22
|
-
fieldHeight?: 'small' | 'medium';
|
|
23
|
-
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
24
21
|
form?: EvokeForm;
|
|
25
22
|
action?: Action;
|
|
26
23
|
selectedInstance?: ObjectInstance;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InfoRounded } from '@mui/icons-material';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
+
import { useFormContext } from '../../../../../../theme/hooks';
|
|
3
4
|
import { Alert, Button, FormControlLabel, Radio, RadioGroup } from '../../../../../core';
|
|
4
5
|
import { Box, Grid } from '../../../../../layout';
|
|
5
6
|
import InstanceLookup from './InstanceLookup';
|
|
@@ -13,14 +14,15 @@ const styles = {
|
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
const RelatedObjectInstance = (props) => {
|
|
16
|
-
const { relatedObject, id, setSelectedInstance,
|
|
17
|
+
const { relatedObject, id, setSelectedInstance, handleClose, nestedFieldsView, mode, displayOption, filter, layout, form, } = props;
|
|
18
|
+
const { handleChange: handleChangeObjectField } = useFormContext();
|
|
17
19
|
const [errors, setErrors] = useState([]);
|
|
18
20
|
const [selectedRow, setSelectedRow] = useState();
|
|
19
21
|
const [relationType, setRelationType] = useState(displayOption === 'dropdown' ? 'new' : 'existing');
|
|
20
22
|
const linkExistingInstance = async () => {
|
|
21
23
|
if (selectedRow) {
|
|
22
24
|
setSelectedInstance(selectedRow);
|
|
23
|
-
|
|
25
|
+
handleChangeObjectField(id, selectedRow);
|
|
24
26
|
}
|
|
25
27
|
onClose();
|
|
26
28
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked';
|
|
2
2
|
import { TabContext, TabPanel } from '@mui/lab';
|
|
3
3
|
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { useFormContext } from '../../../../theme/hooks';
|
|
4
5
|
import { Tab, Tabs, Typography } from '../../../core';
|
|
5
6
|
import { Box } from '../../../layout';
|
|
6
7
|
import { RecursiveEntryRenderer } from './RecursiveEntryRenderer';
|
|
7
8
|
import TabNav from './TabNav';
|
|
8
9
|
import { getErrorCountForSection, scrollIntoViewWithOffset } from './utils';
|
|
9
10
|
function FormSections(props) {
|
|
10
|
-
const { entry
|
|
11
|
+
const { entry } = props;
|
|
12
|
+
const { errors, showSubmitError } = useFormContext();
|
|
11
13
|
const tabPanelsRef = useRef(null);
|
|
12
14
|
const [tabValue, setTabValue] = useState(0);
|
|
13
15
|
const handleTabChange = (type, newValue) => {
|
|
@@ -97,7 +99,7 @@ function FormSections(props) {
|
|
|
97
99
|
} },
|
|
98
100
|
React.createElement(Box, null, section.entries &&
|
|
99
101
|
section.entries.map((sectionEntry, index) => {
|
|
100
|
-
return (React.createElement(RecursiveEntryRenderer, { key: sectionEntry.type + index, entry: sectionEntry
|
|
102
|
+
return (React.createElement(RecursiveEntryRenderer, { key: sectionEntry.type + index, entry: sectionEntry }));
|
|
101
103
|
})),
|
|
102
104
|
React.createElement(TabNav, { prevTabLabel: prevTabLabel, nextTabLabel: nextTabLabel, numberOfTabs: entry.sections.length, tabValue: tabValue, handleTabChange: handleTabChange })))))))));
|
|
103
105
|
}
|
|
@@ -19,7 +19,7 @@ import ObjectPropertyInput from './FormFieldTypes/relatedObjectFiles/ObjectPrope
|
|
|
19
19
|
import UserProperty from './FormFieldTypes/UserProperty';
|
|
20
20
|
import FormSections from './FormSections';
|
|
21
21
|
import { docProperties, entryIsVisible, fetchCollectionData, getEntryId, isAddressProperty, isOptionEqualToValue, updateCriteriaInputs, } from './utils';
|
|
22
|
-
function getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
22
|
+
function getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors, validation) {
|
|
23
23
|
return {
|
|
24
24
|
inputId: entryId,
|
|
25
25
|
inputType: fieldDefinition.type,
|
|
@@ -33,13 +33,12 @@ function getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, displ
|
|
|
33
33
|
prefix: display?.prefix,
|
|
34
34
|
suffix: display?.suffix,
|
|
35
35
|
viewOnly: entry.type === 'readonlyField',
|
|
36
|
-
fieldHeight,
|
|
37
36
|
errorMessage: errors?.[entryId]?.message,
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
export function RecursiveEntryRenderer(props) {
|
|
41
|
-
const {
|
|
42
|
-
const { fetchedOptions, setFetchedOptions, object, getValues } = useFormContext();
|
|
40
|
+
const { entry, isDocument } = props;
|
|
41
|
+
const { fetchedOptions, setFetchedOptions, object, getValues, errors, instance, richTextEditor, parameters, handleChange, fieldHeight, triggerFieldReset, } = useFormContext();
|
|
43
42
|
// If the entry is hidden, clear its value and any nested values, and skip rendering
|
|
44
43
|
if (!entryIsVisible(entry, getValues(), instance)) {
|
|
45
44
|
return null;
|
|
@@ -92,51 +91,51 @@ export function RecursiveEntryRenderer(props) {
|
|
|
92
91
|
else if ((entry.type === 'input' || entry.type === 'readonlyField' || entry.type === 'inputField') &&
|
|
93
92
|
fieldDefinition) {
|
|
94
93
|
if (isAddressProperty(entryId)) {
|
|
95
|
-
return
|
|
94
|
+
return React.createElement(AddressFields, { entry: entry, entryId: entryId, fieldDefinition: fieldDefinition });
|
|
96
95
|
}
|
|
97
96
|
else if (fieldDefinition.type === 'image') {
|
|
98
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
99
|
-
React.createElement(Image, { id: entryId,
|
|
97
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
98
|
+
React.createElement(Image, { id: entryId, canUpdateProperty: entry.type !== 'readonlyField', error: !!errors?.[entryId], value: fieldValue, hasDescription: !!display?.description })));
|
|
100
99
|
}
|
|
101
100
|
else if (fieldDefinition.type === 'object') {
|
|
102
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
103
|
-
React.createElement(ObjectPropertyInput, {
|
|
101
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
102
|
+
React.createElement(ObjectPropertyInput, { fieldDefinition: fieldDefinition, id: entryId, mode: display?.mode || 'default', error: !!errors?.[entryId], displayOption: display?.relatedObjectDisplay || 'dialogBox', initialValue: fieldValue, readOnly: entry.type === 'readonlyField', filter: validation?.criteria
|
|
104
103
|
? updateCriteriaInputs(validation.criteria, getValues(), userAccount)
|
|
105
104
|
: undefined, sortBy: typeof display?.defaultValue === 'object' && 'sortBy' in display.defaultValue
|
|
106
105
|
? display?.defaultValue.sortBy
|
|
107
106
|
: undefined, orderBy: typeof display?.defaultValue === 'object' && 'orderBy' in display.defaultValue
|
|
108
107
|
? display?.defaultValue.orderBy
|
|
109
|
-
: undefined,
|
|
108
|
+
: undefined, defaultValueCriteria: typeof display?.defaultValue === 'object' && 'criteria' in display.defaultValue
|
|
110
109
|
? display?.defaultValue?.criteria
|
|
111
110
|
: undefined, viewLayout: display?.viewLayout, hasDescription: !!display?.description })));
|
|
112
111
|
}
|
|
113
112
|
else if (fieldDefinition.type === 'user') {
|
|
114
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
115
|
-
React.createElement(UserProperty, { id: entryId, value: fieldValue,
|
|
113
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
114
|
+
React.createElement(UserProperty, { id: entryId, value: fieldValue, error: !!errors?.[entryId], readOnly: entry.type === 'readonlyField', hasDescription: !!display?.description })));
|
|
116
115
|
}
|
|
117
116
|
else if (fieldDefinition.type === 'collection') {
|
|
118
|
-
return fieldDefinition?.manyToManyPropertyId ? (middleObject && initialMiddleObjectInstances && (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
119
|
-
React.createElement(DropdownRepeatableField, { initialMiddleObjectInstances: fetchedOptions[`${entryId}MiddleObjectInstances`] || initialMiddleObjectInstances, fieldDefinition: fieldDefinition, id: entryId, middleObject: middleObject,
|
|
120
|
-
React.createElement(RepeatableField, { fieldDefinition: fieldDefinition, canUpdateProperty: entry.type !== 'readonlyField', criteria: validation?.criteria, viewLayout: display?.viewLayout
|
|
117
|
+
return fieldDefinition?.manyToManyPropertyId ? (middleObject && initialMiddleObjectInstances && (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
118
|
+
React.createElement(DropdownRepeatableField, { initialMiddleObjectInstances: fetchedOptions[`${entryId}MiddleObjectInstances`] || initialMiddleObjectInstances, fieldDefinition: fieldDefinition, id: entryId, middleObject: middleObject, readOnly: entry.type === 'readonlyField', criteria: validation?.criteria, hasDescription: !!display?.description })))) : (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
119
|
+
React.createElement(RepeatableField, { fieldDefinition: fieldDefinition, canUpdateProperty: entry.type !== 'readonlyField', criteria: validation?.criteria, viewLayout: display?.viewLayout })));
|
|
121
120
|
}
|
|
122
121
|
else if (fieldDefinition.type === 'richText') {
|
|
123
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
122
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) }, richTextEditor ? (React.createElement(richTextEditor, {
|
|
124
123
|
id: entryId,
|
|
125
124
|
value: fieldValue,
|
|
126
125
|
handleUpdate: (value) => handleChange(entryId, value),
|
|
127
126
|
format: 'rtf',
|
|
128
127
|
disabled: entry.type === 'readonlyField',
|
|
129
128
|
rows: display?.rowCount,
|
|
130
|
-
hasError: !!errors[entryId],
|
|
131
|
-
})) : (React.createElement(FormField, { id: entryId, property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, error: !!errors[entryId], errorMessage: errors[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, size: fieldHeight }))));
|
|
129
|
+
hasError: !!errors?.[entryId],
|
|
130
|
+
})) : (React.createElement(FormField, { id: entryId, property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, error: !!errors?.[entryId], errorMessage: errors?.[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, size: fieldHeight }))));
|
|
132
131
|
}
|
|
133
132
|
else if (fieldDefinition.type === 'document') {
|
|
134
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
135
|
-
React.createElement(Document, { id: entryId,
|
|
133
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
134
|
+
React.createElement(Document, { id: entryId, error: !!errors?.[entryId], value: fieldValue, canUpdateProperty: !(entry.type === 'readonlyField'), hasDescription: !!display?.description, validate: validation })));
|
|
136
135
|
}
|
|
137
136
|
else if (fieldDefinition.type === 'criteria') {
|
|
138
|
-
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
139
|
-
React.createElement(Criteria, { key: triggerFieldReset ? `${entryId}-reset-true` : `${entryId}-reset-false`, fieldDefinition: fieldDefinition, value: fieldValue,
|
|
137
|
+
return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors) },
|
|
138
|
+
React.createElement(Criteria, { key: triggerFieldReset ? `${entryId}-reset-true` : `${entryId}-reset-false`, fieldDefinition: fieldDefinition, value: fieldValue, canUpdateProperty: !(entry.type === 'readonlyField'), error: !!errors?.[entryId] })));
|
|
140
139
|
}
|
|
141
140
|
else {
|
|
142
141
|
// Add `aria-describedby` to ensure screen readers read the description
|
|
@@ -169,10 +168,10 @@ export function RecursiveEntryRenderer(props) {
|
|
|
169
168
|
fieldDefinition?.type === 'boolean') &&
|
|
170
169
|
triggerFieldReset
|
|
171
170
|
? `${entryId}-reset-true`
|
|
172
|
-
: `${entryId}-reset-false`, ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display,
|
|
171
|
+
: `${entryId}-reset-false`, ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, errors), errorMessage: undefined },
|
|
173
172
|
React.createElement(FormField, { id: entryId,
|
|
174
173
|
// TODO: Ideally the FormField prop should be called parameter but can't change the name for backwards compatibility reasons
|
|
175
|
-
property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, mask: validation?.mask, isOptionEqualToValue: isOptionEqualToValue, error: !!errors[entryId], errorMessage: errors[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, required: entry.display?.required || false, getOptionLabel: (option) => {
|
|
174
|
+
property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, mask: validation?.mask, isOptionEqualToValue: isOptionEqualToValue, error: !!errors?.[entryId], errorMessage: errors?.[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, required: entry.display?.required || false, getOptionLabel: (option) => {
|
|
176
175
|
if (typeof option === 'string') {
|
|
177
176
|
return (entry?.enumWithLabels?.find((e) => e.value === option)
|
|
178
177
|
?.label ?? option);
|
|
@@ -190,11 +189,11 @@ export function RecursiveEntryRenderer(props) {
|
|
|
190
189
|
return (React.createElement(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: '30px', flexDirection: isXs ? 'column' : 'row' } }, entry.columns.map((column, colIndex) => (
|
|
191
190
|
// calculating the width like this rather than flex={column.width} to prevent collections from being too wide
|
|
192
191
|
React.createElement(Box, { key: colIndex, sx: { width: isXs ? '100%' : `calc(${(column.width / 12) * 100}% - 15px)` } }, column.entries?.map((columnEntry, entryIndex) => {
|
|
193
|
-
return (React.createElement(RecursiveEntryRenderer, { key: entryIndex + (columnEntry?.parameterId ?? ''), entry: columnEntry
|
|
192
|
+
return (React.createElement(RecursiveEntryRenderer, { key: entryIndex + (columnEntry?.parameterId ?? ''), entry: columnEntry }));
|
|
194
193
|
}))))));
|
|
195
194
|
}
|
|
196
195
|
else if (entry.type === 'sections') {
|
|
197
|
-
return smallerThan('md') ?
|
|
196
|
+
return smallerThan('md') ? React.createElement(AccordionSections, { entry: entry }) : React.createElement(FormSections, { entry: entry });
|
|
198
197
|
}
|
|
199
198
|
else if (!fieldDefinition) {
|
|
200
199
|
return (React.createElement(Box, { sx: {
|
package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useResponsive } from '../../../../../theme';
|
|
3
|
+
import { useFormContext } from '../../../../../theme/hooks';
|
|
3
4
|
import { List, ListItem, Typography } from '../../../../core';
|
|
4
5
|
import { Box } from '../../../../layout';
|
|
5
6
|
function ValidationErrorDisplay(props) {
|
|
6
|
-
const {
|
|
7
|
+
const { formId, title } = props;
|
|
8
|
+
const { errors, showSubmitError } = useFormContext();
|
|
7
9
|
const { isSm, isXs } = useResponsive();
|
|
8
10
|
function extractErrorMessages(errors) {
|
|
9
11
|
const messages = [];
|
|
@@ -24,7 +26,7 @@ function ValidationErrorDisplay(props) {
|
|
|
24
26
|
return messages;
|
|
25
27
|
}
|
|
26
28
|
const errorMessages = extractErrorMessages(errors);
|
|
27
|
-
return
|
|
29
|
+
return showSubmitError && errorMessages.length > 0 ? (React.createElement(Box, { id: `validation-error-display-${formId}`, sx: {
|
|
28
30
|
backgroundColor: '#f8d7da',
|
|
29
31
|
borderColor: '#f5c6cb',
|
|
30
32
|
color: '#721c24',
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { FormEntry, InputParameter, ObjectInstance, Property, Section, Sections, ViewLayoutEntityReference } from '@evoke-platform/context';
|
|
2
2
|
import { GridSize } from '@mui/material';
|
|
3
|
-
import { ComponentType } from 'react';
|
|
4
|
-
import { FieldErrors, FieldValues } from 'react-hook-form';
|
|
5
3
|
export type FieldAddress = {
|
|
6
4
|
line1?: string;
|
|
7
5
|
line2?: string;
|
|
@@ -40,9 +38,7 @@ export type SimpleEditorProps = {
|
|
|
40
38
|
};
|
|
41
39
|
export type ObjectPropertyInputProps = {
|
|
42
40
|
id: string;
|
|
43
|
-
instance?: FieldValues;
|
|
44
41
|
fieldDefinition: InputParameter;
|
|
45
|
-
handleChangeObjectProperty: (propertyId: string, instance?: ObjectInstance | null) => void;
|
|
46
42
|
mode: 'default' | 'existingOnly' | 'newOnly';
|
|
47
43
|
nestedFieldsView?: boolean;
|
|
48
44
|
readOnly?: boolean;
|
|
@@ -55,11 +51,8 @@ export type ObjectPropertyInputProps = {
|
|
|
55
51
|
isModal?: boolean;
|
|
56
52
|
label?: string;
|
|
57
53
|
initialValue?: ObjectInstance | null;
|
|
58
|
-
fieldHeight?: 'small' | 'medium';
|
|
59
|
-
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
60
54
|
viewLayout?: ViewLayoutEntityReference;
|
|
61
55
|
hasDescription?: boolean;
|
|
62
|
-
parameters?: InputParameter[];
|
|
63
56
|
};
|
|
64
57
|
export type Page = {
|
|
65
58
|
id: string;
|
|
@@ -91,35 +84,10 @@ export type ExpandedSection = Section & {
|
|
|
91
84
|
};
|
|
92
85
|
export type EntryRendererProps = BaseProps & {
|
|
93
86
|
entry: FormEntry;
|
|
94
|
-
errors: FieldErrors;
|
|
95
|
-
handleChange: (name: string, value: unknown) => void;
|
|
96
|
-
showSubmitError?: boolean;
|
|
97
|
-
fieldHeight?: 'small' | 'medium';
|
|
98
|
-
instance?: FieldValues;
|
|
99
|
-
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
100
|
-
expandedSections: ExpandedSection[];
|
|
101
|
-
setExpandedSections: React.Dispatch<React.SetStateAction<ExpandedSection[]>>;
|
|
102
|
-
expandAll?: boolean | undefined | null;
|
|
103
|
-
setExpandAll: React.Dispatch<React.SetStateAction<boolean | undefined | null>>;
|
|
104
|
-
parameters?: InputParameter[];
|
|
105
|
-
readOnly?: boolean;
|
|
106
|
-
triggerFieldReset?: boolean;
|
|
107
87
|
isDocument?: boolean;
|
|
108
88
|
};
|
|
109
89
|
export type SectionsProps = {
|
|
110
90
|
entry: Sections;
|
|
111
|
-
handleChange: (propertyId: string, value: unknown) => void;
|
|
112
|
-
fieldHeight?: 'small' | 'medium';
|
|
113
|
-
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
114
|
-
instance?: FieldValues;
|
|
115
|
-
expandAll?: boolean | undefined | null;
|
|
116
|
-
expandedSections: ExpandedSection[];
|
|
117
|
-
setExpandedSections: React.Dispatch<React.SetStateAction<ExpandedSection[]>>;
|
|
118
|
-
setExpandAll: React.Dispatch<React.SetStateAction<boolean | undefined | null>>;
|
|
119
|
-
errors: FieldErrors;
|
|
120
|
-
parameters?: InputParameter[];
|
|
121
|
-
triggerFieldReset?: boolean;
|
|
122
|
-
showSubmitError?: boolean;
|
|
123
91
|
};
|
|
124
92
|
export type DocumentData = {
|
|
125
93
|
id: string;
|
|
@@ -40,7 +40,7 @@ export declare function getDefaultPages(parameters: InputParameter[], defaultPag
|
|
|
40
40
|
}>;
|
|
41
41
|
export declare function updateCriteriaInputs(criteria: Record<string, unknown>, data: Record<string, unknown>, user?: UserAccount): Record<string, unknown>;
|
|
42
42
|
export declare function fetchCollectionData(apiServices: ApiServices, fieldDefinition: InputParameter | Property, setFetchedOptions: (newData: FieldValues) => void, instanceId?: string, fetchedOptions?: Record<string, unknown>, initialMiddleObjectInstances?: ObjectInstance[]): Promise<void>;
|
|
43
|
-
export declare const getErrorCountForSection: (section: Section | Column, errors
|
|
43
|
+
export declare const getErrorCountForSection: (section: Section | Column, errors?: FieldErrors) => number;
|
|
44
44
|
export declare const convertDocToParameters: (obj: Document) => InputParameter[];
|
|
45
45
|
export declare const propertyToParameter: (property: Property) => InputParameter;
|
|
46
46
|
export declare const propertyValidationToParameterValidation: (property: Property) => InputParameter['validation'];
|
|
@@ -5,7 +5,7 @@ export { ErrorComponent } from './ErrorComponent';
|
|
|
5
5
|
export { Form } from './Form';
|
|
6
6
|
export type { FormRef } from './Form';
|
|
7
7
|
export { FormField } from './FormField';
|
|
8
|
-
export { FormRenderer, FormRendererContainer } from './FormV2';
|
|
8
|
+
export { FormContext, FormRenderer, FormRendererContainer, RecursiveEntryRenderer } from './FormV2';
|
|
9
9
|
export { HistoryLog } from './HistoryLog';
|
|
10
10
|
export { MenuBar } from './Menubar';
|
|
11
11
|
export { MultiSelect } from './MultiSelect';
|
|
@@ -4,7 +4,7 @@ export { DataGrid } from './DataGrid';
|
|
|
4
4
|
export { ErrorComponent } from './ErrorComponent';
|
|
5
5
|
export { Form } from './Form';
|
|
6
6
|
export { FormField } from './FormField';
|
|
7
|
-
export { FormRenderer, FormRendererContainer } from './FormV2';
|
|
7
|
+
export { FormContext, FormRenderer, FormRendererContainer, RecursiveEntryRenderer } from './FormV2';
|
|
8
8
|
export { HistoryLog } from './HistoryLog';
|
|
9
9
|
export { MenuBar } from './Menubar';
|
|
10
10
|
export { MultiSelect } from './MultiSelect';
|
|
@@ -2,7 +2,7 @@ export { ClickAwayListener, createTheme, darken, lighten, styled, Toolbar, useMe
|
|
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
|
3
3
|
export * from './colors';
|
|
4
4
|
export * from './components/core';
|
|
5
|
-
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
5
|
+
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormContext, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RecursiveEntryRenderer, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
6
6
|
export type { FormRef } from './components/custom';
|
|
7
7
|
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
|
8
8
|
export { Box, Container, Grid, Stack } from './components/layout';
|
package/dist/published/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { ClickAwayListener, createTheme, darken, lighten, styled, Toolbar, useMe
|
|
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
|
3
3
|
export * from './colors';
|
|
4
4
|
export * from './components/core';
|
|
5
|
-
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
5
|
+
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormContext, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RecursiveEntryRenderer, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
6
6
|
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
|
7
7
|
export { Box, Container, Grid, Stack } from './components/layout';
|
|
8
8
|
export * from './theme';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Breakpoint } from '@mui/material/styles';
|
|
2
3
|
/**
|
|
3
4
|
* Custom hook for responsive design breakpoints using size terminology.
|
|
@@ -113,4 +114,16 @@ export declare function useFormContext(): {
|
|
|
113
114
|
getValues: import("react-hook-form").UseFormGetValues<import("react-hook-form").FieldValues>;
|
|
114
115
|
stickyFooter?: boolean | undefined;
|
|
115
116
|
object?: import("@evoke-platform/context").Obj | undefined;
|
|
117
|
+
errors?: import("react-hook-form").FieldValues | undefined;
|
|
118
|
+
instance?: import("react-hook-form").FieldValues | undefined;
|
|
119
|
+
richTextEditor?: import("react").ComponentType<import("../components/custom/FormV2/components/types").SimpleEditorProps> | undefined;
|
|
120
|
+
expandAll?: boolean | null | undefined;
|
|
121
|
+
expandedSections?: import("../components/custom/FormV2/components/types").ExpandedSection[] | undefined;
|
|
122
|
+
setExpandedSections?: import("react").Dispatch<import("react").SetStateAction<import("../components/custom/FormV2/components/types").ExpandedSection[]>> | undefined;
|
|
123
|
+
setExpandAll?: import("react").Dispatch<import("react").SetStateAction<boolean | null | undefined>> | undefined; /** Small screens (600px to 899px) */
|
|
124
|
+
parameters?: import("@evoke-platform/context").InputParameter[] | undefined;
|
|
125
|
+
handleChange: (name: string, value: unknown) => void;
|
|
126
|
+
fieldHeight?: "medium" | "small" | undefined;
|
|
127
|
+
triggerFieldReset?: boolean | undefined;
|
|
128
|
+
showSubmitError?: boolean | undefined;
|
|
116
129
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evoke-platform/ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/published/index.js",
|
|
6
6
|
"module": "dist/published/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"icons.ts",
|
|
10
10
|
"colors.ts"
|
|
11
11
|
],
|
|
12
|
+
"sideEffects": false,
|
|
12
13
|
"exports": {
|
|
13
14
|
".": "./dist/published/index.js",
|
|
14
15
|
"./colors": "./dist/published/colors/index.js",
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"yalc": "^1.0.0-pre.53"
|
|
88
89
|
},
|
|
89
90
|
"peerDependencies": {
|
|
90
|
-
"@evoke-platform/context": "^1.
|
|
91
|
+
"@evoke-platform/context": "^1.4.0-dev.5",
|
|
91
92
|
"react": "^18.1.0",
|
|
92
93
|
"react-dom": "^18.1.0"
|
|
93
94
|
},
|