@evoke-platform/ui-components 1.8.0-dev.1 → 1.8.0-dev.11
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 +1 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +2 -1
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +1 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +3 -2
- package/dist/published/components/custom/DataGrid/index.d.ts +1 -0
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/ObjectPropertyInput.js +48 -39
- package/dist/published/components/custom/Form/FormComponents/ObjectComponent/RelatedObjectInstance.js +1 -1
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.d.ts +1 -1
- package/dist/published/components/custom/Form/FormComponents/UserComponent/UserProperty.js +22 -6
- package/dist/published/components/custom/Form/tests/Form.test.js +192 -2
- package/dist/published/components/custom/Form/tests/test-data.d.ts +7 -0
- package/dist/published/components/custom/Form/tests/test-data.js +138 -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
|
@@ -39,6 +39,17 @@ export const licenseObject = {
|
|
|
39
39
|
name: 'Create',
|
|
40
40
|
type: 'create',
|
|
41
41
|
outputEvent: 'License Created',
|
|
42
|
+
form: {
|
|
43
|
+
entries: [
|
|
44
|
+
{
|
|
45
|
+
parameterId: 'name',
|
|
46
|
+
type: 'input',
|
|
47
|
+
display: {
|
|
48
|
+
label: 'License Number',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
42
53
|
},
|
|
43
54
|
],
|
|
44
55
|
};
|
|
@@ -78,6 +89,118 @@ export const licenseTypeObject = {
|
|
|
78
89
|
},
|
|
79
90
|
],
|
|
80
91
|
};
|
|
92
|
+
// New dedicated object for 508 testing
|
|
93
|
+
export const accessibility508Object = {
|
|
94
|
+
id: 'accessibility508',
|
|
95
|
+
name: 'Accessibility 508 Test Object',
|
|
96
|
+
properties: [
|
|
97
|
+
{
|
|
98
|
+
id: 'name',
|
|
99
|
+
name: 'Name',
|
|
100
|
+
type: 'string',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'license',
|
|
104
|
+
name: 'License',
|
|
105
|
+
type: 'object',
|
|
106
|
+
objectId: 'license',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'user',
|
|
110
|
+
name: 'User',
|
|
111
|
+
type: 'user',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
actions: [
|
|
115
|
+
{
|
|
116
|
+
id: '_update1',
|
|
117
|
+
name: 'Update Related Object',
|
|
118
|
+
type: 'update',
|
|
119
|
+
outputEvent: '508 Test Object Updated',
|
|
120
|
+
parameters: [
|
|
121
|
+
{
|
|
122
|
+
id: 'name',
|
|
123
|
+
name: 'Name',
|
|
124
|
+
type: 'string',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'license',
|
|
128
|
+
name: 'License',
|
|
129
|
+
type: 'object',
|
|
130
|
+
objectId: 'license',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
form: {
|
|
134
|
+
entries: [
|
|
135
|
+
{
|
|
136
|
+
parameterId: 'name',
|
|
137
|
+
type: 'input',
|
|
138
|
+
display: {
|
|
139
|
+
label: 'Name',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
parameterId: 'license',
|
|
144
|
+
type: 'input',
|
|
145
|
+
display: {
|
|
146
|
+
label: 'License',
|
|
147
|
+
relatedObjectDisplay: 'dropdown',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: '_update2',
|
|
155
|
+
name: 'Update User',
|
|
156
|
+
type: 'update',
|
|
157
|
+
outputEvent: '508 Test Object Updated',
|
|
158
|
+
parameters: [
|
|
159
|
+
{
|
|
160
|
+
id: 'name',
|
|
161
|
+
name: 'Name',
|
|
162
|
+
type: 'string',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'user',
|
|
166
|
+
type: 'user',
|
|
167
|
+
name: 'User',
|
|
168
|
+
required: false,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
form: {
|
|
172
|
+
entries: [
|
|
173
|
+
{
|
|
174
|
+
parameterId: 'name',
|
|
175
|
+
type: 'input',
|
|
176
|
+
display: {
|
|
177
|
+
label: 'Name',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'input',
|
|
182
|
+
parameterId: 'user',
|
|
183
|
+
display: {
|
|
184
|
+
label: 'User',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: '_delete',
|
|
192
|
+
name: 'Delete',
|
|
193
|
+
type: 'delete',
|
|
194
|
+
outputEvent: 'Accessibility Type Deleted',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: '_create',
|
|
198
|
+
name: 'Create',
|
|
199
|
+
type: 'create',
|
|
200
|
+
outputEvent: 'Accessibility Type Created',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
};
|
|
81
204
|
export const specialtyObject = {
|
|
82
205
|
id: 'specialty',
|
|
83
206
|
name: 'Specialty',
|
|
@@ -379,3 +502,18 @@ export const npSpecialtyType2 = {
|
|
|
379
502
|
name: 'NP License Type',
|
|
380
503
|
},
|
|
381
504
|
};
|
|
505
|
+
// Users
|
|
506
|
+
export const users = [
|
|
507
|
+
{
|
|
508
|
+
id: 'user1',
|
|
509
|
+
status: 'Active',
|
|
510
|
+
email: 'user1@systemautomation.com',
|
|
511
|
+
name: 'User 1',
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
id: 'user2',
|
|
515
|
+
status: 'Active',
|
|
516
|
+
email: 'user2@systemautomation.com',
|
|
517
|
+
name: 'User 2',
|
|
518
|
+
},
|
|
519
|
+
];
|
|
@@ -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;
|