@evoke-platform/ui-components 1.8.0-dev.0 → 1.8.0-dev.10
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/core/TextField/TextField.js +3 -2
- package/dist/published/components/custom/DataGrid/DataGrid.d.ts +2 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +3 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +2 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +4 -3
- package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +4 -0
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +4 -0
- package/dist/published/components/custom/Form/utils.js +76 -44
- package/dist/published/components/custom/FormV2/FormRenderer.d.ts +6 -2
- package/dist/published/components/custom/FormV2/FormRenderer.js +13 -14
- package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +7 -2
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +61 -109
- package/dist/published/components/custom/FormV2/components/FormContext.d.ts +4 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +9 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.js +12 -24
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +5 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +80 -30
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +51 -27
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +5 -5
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +45 -7
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +8 -6
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +3 -0
- package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +1 -3
- package/dist/published/components/custom/FormV2/components/types.d.ts +7 -1
- package/dist/published/components/custom/FormV2/components/utils.d.ts +27 -2
- package/dist/published/components/custom/FormV2/components/utils.js +108 -2
- package/dist/published/components/custom/FormV2/tests/FormRenderer.test.d.ts +1 -0
- package/dist/published/components/custom/FormV2/tests/FormRenderer.test.js +173 -0
- package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.d.ts +1 -0
- package/dist/published/components/custom/FormV2/tests/FormRendererContainer.test.js +96 -0
- package/dist/published/components/custom/FormV2/tests/test-data.d.ts +16 -0
- package/dist/published/components/custom/FormV2/tests/test-data.js +394 -0
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/index.d.ts +1 -1
- package/dist/published/stories/FormRenderer.stories.d.ts +7 -0
- package/dist/published/stories/FormRenderer.stories.js +65 -0
- package/dist/published/stories/FormRendererContainer.stories.d.ts +7 -0
- package/dist/published/stories/FormRendererContainer.stories.js +56 -0
- package/dist/published/stories/FormRendererData.d.ts +116 -0
- package/dist/published/stories/FormRendererData.js +925 -0
- package/dist/published/stories/sharedMswHandlers.d.ts +1 -0
- package/dist/published/stories/sharedMswHandlers.js +100 -0
- package/dist/published/theme/hooks.d.ts +4 -0
- package/package.json +12 -4
|
@@ -4,7 +4,8 @@ import UIThemeProvider from '../../../theme';
|
|
|
4
4
|
import FieldError from '../FieldError';
|
|
5
5
|
import Typography from '../Typography';
|
|
6
6
|
const TextField = (props) => {
|
|
7
|
-
const {
|
|
7
|
+
const { labelPlacement, readOnly, instructionText, errorMessage, ...muiProps } = props;
|
|
8
|
+
const { id, variant, label, required, error } = muiProps;
|
|
8
9
|
const readOnlyStyles = {
|
|
9
10
|
'.MuiOutlinedInput-root': {
|
|
10
11
|
paddingRight: '5px',
|
|
@@ -28,7 +29,7 @@ const TextField = (props) => {
|
|
|
28
29
|
readOnly: readOnly,
|
|
29
30
|
'aria-readonly': !!readOnly,
|
|
30
31
|
'data-testid': 'label-outside',
|
|
31
|
-
}, ...
|
|
32
|
+
}, ...muiProps, label: null, sx: readOnly
|
|
32
33
|
? { ...readOnlyStyles, ...props.sx }
|
|
33
34
|
: {
|
|
34
35
|
'& fieldset': { borderRadius: '8px' },
|
|
@@ -22,6 +22,8 @@ export type DataGridProps<T extends GridValidRowModel> = MuiDataGridProps<T> & {
|
|
|
22
22
|
};
|
|
23
23
|
hideSearchbar?: boolean;
|
|
24
24
|
loadingOptions?: LoadingOptions;
|
|
25
|
+
hideDownload?: boolean;
|
|
26
|
+
exportFileName?: string;
|
|
25
27
|
};
|
|
26
28
|
export default function <T extends GridValidRowModel>(props: DataGridProps<T>): React.JSX.Element;
|
|
27
29
|
export {};
|
|
@@ -6,7 +6,7 @@ import LinearProgress from '../../core/LinearProgress';
|
|
|
6
6
|
import { dateTimeBetweenOperator } from './DateTimeCustomOperator';
|
|
7
7
|
import Toolbar from './Toolbar';
|
|
8
8
|
export default function (props) {
|
|
9
|
-
const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows, hideSearchbar, loadingOptions, ...rest } = props;
|
|
9
|
+
const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows, hideSearchbar, loadingOptions, hideDownload, exportFileName, ...rest } = props;
|
|
10
10
|
const [anchorEl, setAnchorEl] = useState();
|
|
11
11
|
const [loadingMessageIndex, setLoadingMessageIndex] = useState(0);
|
|
12
12
|
const addColumnFilterOperators = (columns) => {
|
|
@@ -92,6 +92,8 @@ export default function (props) {
|
|
|
92
92
|
title,
|
|
93
93
|
bulkAction,
|
|
94
94
|
hideSearchbar,
|
|
95
|
+
hideDownload,
|
|
96
|
+
exportFileName,
|
|
95
97
|
},
|
|
96
98
|
panel: {
|
|
97
99
|
anchorEl: anchorEl,
|
|
@@ -10,6 +10,8 @@ export type GridToolbarProps = MuiGridToolbarProps & {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
bulkAction?: BulkAction;
|
|
12
12
|
hideSearchbar?: boolean;
|
|
13
|
+
hideDownload?: boolean;
|
|
14
|
+
exportFileName?: string;
|
|
13
15
|
};
|
|
14
16
|
declare function Toolbar(props: GridToolbarProps): React.JSX.Element;
|
|
15
17
|
export default Toolbar;
|
|
@@ -6,7 +6,8 @@ import UIThemeProvider from '../../../theme';
|
|
|
6
6
|
import { Button, IconButton } from '../../core';
|
|
7
7
|
import { Grid } from '../../layout';
|
|
8
8
|
function Toolbar(props) {
|
|
9
|
-
const { onRefresh, setAnchorEl, loading, theme, title, bulkAction, hideSearchbar } = props;
|
|
9
|
+
const { onRefresh, setAnchorEl, loading, theme, title, bulkAction, hideSearchbar, hideDownload, exportFileName } = props;
|
|
10
|
+
const resolvedFileName = exportFileName ?? 'data';
|
|
10
11
|
const styles = {
|
|
11
12
|
container: { display: 'flex', justifyContent: 'space-between', margin: '0 0 15px 0' },
|
|
12
13
|
iconButton: {
|
|
@@ -50,14 +51,14 @@ function Toolbar(props) {
|
|
|
50
51
|
React.createElement(Grid, { item: true, xs: 6 }, !hideSearchbar && (React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: styles.quickFilter }))),
|
|
51
52
|
!bulkAction ? (React.createElement(Grid, { item: true },
|
|
52
53
|
React.createElement(Grid, { container: true, spacing: 1, sx: styles.icon },
|
|
53
|
-
React.createElement(Grid, { item: true, sx: { paddingRight: '15px' } },
|
|
54
|
+
!hideDownload && (React.createElement(Grid, { item: true, sx: { paddingRight: '15px' } },
|
|
54
55
|
React.createElement(GridToolbarExport, { sx: {
|
|
55
56
|
color: '#212B36',
|
|
56
57
|
height: '95%',
|
|
57
58
|
'&:hover': { backgroundColor: '#f2f3f5' },
|
|
58
59
|
paddingLeft: '10px',
|
|
59
60
|
paddingRight: '10px',
|
|
60
|
-
}, printOptions: { disableToolbarButton: true }, startIcon: React.createElement(FileDownloadRounded, null) })),
|
|
61
|
+
}, printOptions: { disableToolbarButton: true }, csvOptions: { fileName: resolvedFileName }, startIcon: React.createElement(FileDownloadRounded, null) }))),
|
|
61
62
|
React.createElement(Grid, { item: true },
|
|
62
63
|
React.createElement(GridToolbarFilterButton, { componentsProps: {
|
|
63
64
|
button: {
|
package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js
CHANGED
|
@@ -230,6 +230,10 @@ export const ObjectPropertyInput = (props) => {
|
|
|
230
230
|
? (options.find((o) => o.id === option)?.name ?? '')
|
|
231
231
|
: option.label;
|
|
232
232
|
}, onKeyDownCapture: (e) => {
|
|
233
|
+
// prevents keyboard trap
|
|
234
|
+
if (e.key === 'Tab') {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
233
237
|
if (instance?.[property.id]?.id || selectedInstance?.id) {
|
|
234
238
|
e.preventDefault();
|
|
235
239
|
}
|
|
@@ -254,6 +254,7 @@ export function convertFormToComponents(entries, parameters, object) {
|
|
|
254
254
|
conditional: convertVisibilityToConditional(displayOptions?.visibility),
|
|
255
255
|
viewLayout: displayOptions?.viewLayout,
|
|
256
256
|
strictlyTrue: parameter.type === 'boolean' && parameter.strictlyTrue,
|
|
257
|
+
documentMetadata: parameter.type === 'document' ? entry.documentMetadata : undefined,
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
})
|
|
@@ -420,6 +421,7 @@ export function convertComponentsToForm(components) {
|
|
|
420
421
|
}
|
|
421
422
|
: {}),
|
|
422
423
|
},
|
|
424
|
+
...(component.documentMetadata ? { documentMetadata: component.documentMetadata } : {}),
|
|
423
425
|
enumWithLabels: component.data?.values,
|
|
424
426
|
};
|
|
425
427
|
}
|
|
@@ -489,49 +491,76 @@ export function flattenFormComponents(components) {
|
|
|
489
491
|
export async function addObjectPropertiesToComponentProps(properties,
|
|
490
492
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
491
493
|
formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associatedObject, autoSave, readOnly, defaultPages, navigateTo, queryAddresses, apiServices, isModal, fieldHeight, richTextEditor) {
|
|
494
|
+
function removeEmptySections(component) {
|
|
495
|
+
// if a component is an entry to a property that the user doesn't have permission to view, remove it
|
|
496
|
+
if (component?.property?.id) {
|
|
497
|
+
const hasPermission = allProperties.some((p) => p.id === component.property.id);
|
|
498
|
+
if (!hasPermission)
|
|
499
|
+
return undefined;
|
|
500
|
+
}
|
|
501
|
+
// remove sections or tabs with no components
|
|
502
|
+
if (component.components) {
|
|
503
|
+
component.components = component.components
|
|
504
|
+
.map(removeEmptySections)
|
|
505
|
+
.filter((c) => c !== undefined);
|
|
506
|
+
if (component.components.length === 0)
|
|
507
|
+
return undefined;
|
|
508
|
+
}
|
|
509
|
+
// check columns for empty components or sections with no components
|
|
510
|
+
const actionInput = component;
|
|
511
|
+
if (actionInput.columns) {
|
|
512
|
+
const processedColumns = actionInput.columns.map((col) => ({
|
|
513
|
+
...col,
|
|
514
|
+
components: (col.components || [])
|
|
515
|
+
.map(removeEmptySections)
|
|
516
|
+
.filter((c) => c !== undefined),
|
|
517
|
+
}));
|
|
518
|
+
actionInput.columns = processedColumns;
|
|
519
|
+
if (processedColumns.every((col) => col.components.length === 0)) {
|
|
520
|
+
return undefined;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return component;
|
|
524
|
+
}
|
|
525
|
+
const allProperties = properties.flatMap((property) => property.type === 'address'
|
|
526
|
+
? [
|
|
527
|
+
{
|
|
528
|
+
id: `${property.id}.line1`,
|
|
529
|
+
name: `${property.name} Line 1`,
|
|
530
|
+
type: 'string',
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
id: `${property.id}.line2`,
|
|
534
|
+
name: `${property.name} Line 2`,
|
|
535
|
+
type: 'string',
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
id: `${property.id}.city`,
|
|
539
|
+
name: `${property.name} City`,
|
|
540
|
+
type: 'string',
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: `${property.id}.county`,
|
|
544
|
+
name: `${property.name} County`,
|
|
545
|
+
type: 'string',
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
id: `${property.id}.state`,
|
|
549
|
+
name: `${property.name} State`,
|
|
550
|
+
type: 'string',
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
id: `${property.id}.zipCode`,
|
|
554
|
+
name: `${property.name} Zip Code`,
|
|
555
|
+
type: 'string',
|
|
556
|
+
},
|
|
557
|
+
]
|
|
558
|
+
: [property]);
|
|
492
559
|
return [
|
|
493
560
|
...(await Promise.all(formComponents
|
|
494
561
|
?.filter((component) => !isUndefined(component) && !isNil(component))
|
|
495
562
|
?.map(async (component) => {
|
|
496
|
-
const property =
|
|
497
|
-
.flatMap((property) => {
|
|
498
|
-
if (property.type === 'address') {
|
|
499
|
-
return [
|
|
500
|
-
{
|
|
501
|
-
id: `${property.id}.line1`,
|
|
502
|
-
name: `${property.name} Line 1`,
|
|
503
|
-
type: 'string',
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
id: `${property.id}.line2`,
|
|
507
|
-
name: `${property.name} Line 2`,
|
|
508
|
-
type: 'string',
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
id: `${property.id}.city`,
|
|
512
|
-
name: `${property.name} City`,
|
|
513
|
-
type: 'string',
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
id: `${property.id}.county`,
|
|
517
|
-
name: `${property.name} County`,
|
|
518
|
-
type: 'string',
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
id: `${property.id}.state`,
|
|
522
|
-
name: `${property.name} State`,
|
|
523
|
-
type: 'string',
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
id: `${property.id}.zipCode`,
|
|
527
|
-
name: `${property.name} Zip Code`,
|
|
528
|
-
type: 'string',
|
|
529
|
-
},
|
|
530
|
-
];
|
|
531
|
-
}
|
|
532
|
-
return property;
|
|
533
|
-
})
|
|
534
|
-
.find((property) => property.id === component.key);
|
|
563
|
+
const property = allProperties.find((prop) => prop.id === component.key);
|
|
535
564
|
const id = property?.id ?? component.key;
|
|
536
565
|
if (component.type === 'Content') {
|
|
537
566
|
return component;
|
|
@@ -543,7 +572,7 @@ formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associate
|
|
|
543
572
|
? DateTime.now().toISODate()
|
|
544
573
|
: DateTime.fromISO(component.initialValue).toISODate();
|
|
545
574
|
}
|
|
546
|
-
// @
|
|
575
|
+
// @Deprecated
|
|
547
576
|
// This will overwrite the default value
|
|
548
577
|
if (component.defaultToCurrentDate) {
|
|
549
578
|
component.initialValue = DateTime.now().toISODate();
|
|
@@ -556,7 +585,7 @@ formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associate
|
|
|
556
585
|
? DateTime.now().toISO()
|
|
557
586
|
: DateTime.fromISO(component.initialValue).toISO();
|
|
558
587
|
}
|
|
559
|
-
// @
|
|
588
|
+
// @Deprecated
|
|
560
589
|
// This will overwrite the default value
|
|
561
590
|
if (component.defaultToCurrentDate) {
|
|
562
591
|
component.initialValue = DateTime.now().toISO();
|
|
@@ -575,7 +604,7 @@ formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associate
|
|
|
575
604
|
suppressMilliseconds: true,
|
|
576
605
|
});
|
|
577
606
|
}
|
|
578
|
-
// @
|
|
607
|
+
// @Deprecated
|
|
579
608
|
// This will overwrite the default value
|
|
580
609
|
if (component.defaultToCurrentTime) {
|
|
581
610
|
component.initialValue = DateTime.now().toISOTime({
|
|
@@ -709,13 +738,16 @@ formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associate
|
|
|
709
738
|
: undefined,
|
|
710
739
|
};
|
|
711
740
|
}
|
|
712
|
-
|
|
741
|
+
else {
|
|
742
|
+
component = removeEmptySections(component);
|
|
743
|
+
}
|
|
744
|
+
if (component?.columns) {
|
|
713
745
|
for (const column of component.columns) {
|
|
714
746
|
column.components = await addObjectPropertiesToComponentProps(properties, column.components, allCriteriaInputs, instance, objectPropertyInputProps, associatedObject, autoSave, readOnly, undefined, undefined, queryAddresses, apiServices, isModal, fieldHeight, richTextEditor);
|
|
715
747
|
}
|
|
716
748
|
return component;
|
|
717
749
|
}
|
|
718
|
-
if (component
|
|
750
|
+
if (component?.components) {
|
|
719
751
|
for (const item of component.components) {
|
|
720
752
|
const nestedFieldProperty = properties.find((property) => property.id === item.key);
|
|
721
753
|
if (item.type) {
|
|
@@ -2,7 +2,7 @@ import { EvokeForm, ObjectInstance } from '@evoke-platform/context';
|
|
|
2
2
|
import React, { ComponentType } from 'react';
|
|
3
3
|
import { FieldErrors, FieldValues } from 'react-hook-form';
|
|
4
4
|
import { BaseProps, Document, SimpleEditorProps } from './components/types';
|
|
5
|
-
export type
|
|
5
|
+
export type FormRendererProps = BaseProps & {
|
|
6
6
|
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
7
7
|
hideButtons?: boolean;
|
|
8
8
|
value?: FieldValues;
|
|
@@ -14,6 +14,10 @@ export type FormProps = BaseProps & {
|
|
|
14
14
|
instance?: ObjectInstance | Document;
|
|
15
15
|
onChange: (id: string, value: unknown) => void;
|
|
16
16
|
onValidationChange?: (errors: FieldErrors) => void;
|
|
17
|
+
associatedObject?: {
|
|
18
|
+
instanceId?: string;
|
|
19
|
+
propertyId?: string;
|
|
20
|
+
};
|
|
17
21
|
};
|
|
18
|
-
declare function FormRenderer(props:
|
|
22
|
+
declare function FormRenderer(props: FormRendererProps): React.JSX.Element;
|
|
19
23
|
export default FormRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useObject } from '@evoke-platform/context';
|
|
2
|
-
import { isEqual } from 'lodash';
|
|
2
|
+
import { isEmpty, isEqual } from 'lodash';
|
|
3
3
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { useForm } from 'react-hook-form';
|
|
5
5
|
import { useResponsive } from '../../../theme';
|
|
@@ -12,7 +12,7 @@ import { convertDocToParameters, convertPropertiesToParams } from './components/
|
|
|
12
12
|
import { handleValidation } from './components/ValidationFiles/Validation';
|
|
13
13
|
import ValidationErrorDisplay from './components/ValidationFiles/ValidationErrorDisplay';
|
|
14
14
|
function FormRenderer(props) {
|
|
15
|
-
const { onSubmit, value, fieldHeight, richTextEditor, hideButtons, stickyFooter, onCancel, form, instance, onChange, onValidationChange, } = props;
|
|
15
|
+
const { onSubmit, value, fieldHeight, richTextEditor, hideButtons, stickyFooter, onCancel, form, instance, onChange, onValidationChange, associatedObject, } = props;
|
|
16
16
|
const { entries, name: title, objectId, actionId, display } = form;
|
|
17
17
|
const { register, unregister, setValue, reset, handleSubmit, formState: { errors, isSubmitted }, getValues, } = useForm({
|
|
18
18
|
defaultValues: value,
|
|
@@ -99,10 +99,9 @@ function FormRenderer(props) {
|
|
|
99
99
|
}, []);
|
|
100
100
|
if (entries && parameters && (!actionId || action)) {
|
|
101
101
|
return (React.createElement(React.Fragment, null,
|
|
102
|
-
React.createElement(Box, { sx: {
|
|
102
|
+
((isSubmitted && !isEmpty(errors)) || (isSmallerThanMd && hasSections) || title) && (React.createElement(Box, { sx: {
|
|
103
103
|
paddingX: isSmallerThanMd ? 2 : 3,
|
|
104
104
|
paddingTop: '0px',
|
|
105
|
-
borderBottom: '2px solid #F4F6F8',
|
|
106
105
|
} },
|
|
107
106
|
React.createElement(Box, { sx: {
|
|
108
107
|
display: 'flex',
|
|
@@ -111,13 +110,14 @@ function FormRenderer(props) {
|
|
|
111
110
|
flexWrap: 'wrap',
|
|
112
111
|
paddingY: isSm || isXs ? 2 : 3,
|
|
113
112
|
} },
|
|
114
|
-
React.createElement(Typography, { sx: {
|
|
113
|
+
title && (React.createElement(Typography, { sx: {
|
|
115
114
|
fontSize: '20px',
|
|
116
115
|
lineHeight: '30px',
|
|
117
116
|
fontWeight: 700,
|
|
118
117
|
flexGrow: '1',
|
|
119
|
-
} }, title),
|
|
118
|
+
} }, title)),
|
|
120
119
|
isSmallerThanMd && hasSections && (React.createElement(Box, { sx: {
|
|
120
|
+
color: '#212B36',
|
|
121
121
|
display: 'flex',
|
|
122
122
|
alignItems: 'center',
|
|
123
123
|
maxHeight: '22px',
|
|
@@ -140,7 +140,7 @@ function FormRenderer(props) {
|
|
|
140
140
|
fontWeight: 400,
|
|
141
141
|
fontSize: '14px',
|
|
142
142
|
}, onClick: handleCollapseAll }, "Collapse all")))),
|
|
143
|
-
React.createElement(ValidationErrorDisplay, { formId: form.id, title: title })),
|
|
143
|
+
React.createElement(ValidationErrorDisplay, { formId: form.id, title: title, errors: errors, showSubmitError: isSubmitted }))),
|
|
144
144
|
React.createElement(FormContext.Provider, { value: {
|
|
145
145
|
fetchedOptions,
|
|
146
146
|
setFetchedOptions: updateFetchedOptions,
|
|
@@ -159,26 +159,25 @@ function FormRenderer(props) {
|
|
|
159
159
|
handleChange: onChange,
|
|
160
160
|
triggerFieldReset,
|
|
161
161
|
showSubmitError: isSubmitted,
|
|
162
|
+
associatedObject,
|
|
162
163
|
} },
|
|
163
164
|
React.createElement(Box, { sx: {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
paddingX: isSm || isXs ? 2 : 3,
|
|
166
|
+
// when rendering the default delete action, we don't want a border
|
|
167
|
+
borderTop: !form.id || isModal ? undefined : '1px solid #e9ecef',
|
|
167
168
|
} },
|
|
168
169
|
entries.map((entry, index) => (React.createElement(RecursiveEntryRenderer, { key: index, entry: entry, isDocument: !!(form.id === 'documentForm') }))),
|
|
169
170
|
!hideButtons && (actionId || form.id === 'documentForm') && onSubmit && (React.createElement(Box, { sx: {
|
|
170
171
|
...(stickyFooter === false ? { position: 'static' } : { position: 'sticky' }),
|
|
171
|
-
bottom: isModal
|
|
172
|
+
bottom: isModal || isSmallerThanMd ? 0 : 24,
|
|
172
173
|
zIndex: 1000,
|
|
173
174
|
borderTop: action?.type !== 'delete' ? '1px solid #f4f6f8' : 'none',
|
|
174
175
|
backgroundColor: '#fff',
|
|
175
|
-
|
|
176
|
-
paddingX: isSmallerThanMd ? '16px' : '20px',
|
|
176
|
+
padding: isSmallerThanMd ? '16px' : '20px',
|
|
177
177
|
display: 'flex',
|
|
178
178
|
justifyContent: isXs ? 'center' : 'flex-end',
|
|
179
179
|
alignItems: 'center',
|
|
180
180
|
marginX: isSmallerThanMd ? -2 : -3,
|
|
181
|
-
marginBottom: '1px',
|
|
182
181
|
borderRadius: '0px 0px 6px 6px',
|
|
183
182
|
} },
|
|
184
183
|
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 })))))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { BaseProps, SimpleEditorProps } from './components/types';
|
|
3
|
-
export type
|
|
3
|
+
export type FormRendererContainerProps = BaseProps & {
|
|
4
4
|
formId?: string;
|
|
5
5
|
instanceId?: string;
|
|
6
6
|
defaultPages?: Record<string, string>;
|
|
@@ -12,10 +12,15 @@ export type FormProps = BaseProps & {
|
|
|
12
12
|
};
|
|
13
13
|
actionId?: string;
|
|
14
14
|
stickyFooter?: boolean;
|
|
15
|
+
hideButtons?: boolean;
|
|
15
16
|
objectId: string;
|
|
16
17
|
richTextEditor?: ComponentType<SimpleEditorProps>;
|
|
17
18
|
onClose?: () => void;
|
|
18
19
|
onSubmit?: (submission: Record<string, unknown>) => Promise<void>;
|
|
20
|
+
associatedObject?: {
|
|
21
|
+
instanceId?: string;
|
|
22
|
+
propertyId?: string;
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
|
-
declare function FormRendererContainer(props:
|
|
25
|
+
declare function FormRendererContainer(props: FormRendererContainerProps): React.JSX.Element;
|
|
21
26
|
export default FormRendererContainer;
|