@evoke-platform/ui-components 1.13.0-dev.2 → 1.13.0-dev.3
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/FormRendererContainer.js +1 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +1 -0
- package/dist/published/components/custom/FormV2/components/utils.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/utils.js +12 -2
- package/package.json +1 -1
|
@@ -186,7 +186,7 @@ function FormRendererContainer(props) {
|
|
|
186
186
|
if (!form) {
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
|
-
submission = await formatSubmission(submission, apiServices, objectId, instanceId, form, setSnackbarError);
|
|
189
|
+
submission = await formatSubmission(submission, apiServices, objectId, instanceId, form, setSnackbarError, undefined, parameters);
|
|
190
190
|
try {
|
|
191
191
|
if (action?.type === 'create') {
|
|
192
192
|
const response = await apiServices.post(getPrefixedUrl(`/objects/${form.objectId}/instances/actions`), {
|
|
@@ -9,7 +9,7 @@ import { Accordion, AccordionDetails, AccordionSummary, Button, IconButton, Skel
|
|
|
9
9
|
import { Box } from '../../../../../layout';
|
|
10
10
|
import { getReadableQuery } from '../../../../CriteriaBuilder';
|
|
11
11
|
import { retrieveCustomErrorMessage } from '../../../../Form/utils';
|
|
12
|
-
import { deleteDocuments, formatSubmission, getPrefixedUrl, transformToWhere } from '../../utils';
|
|
12
|
+
import { convertPropertiesToParams, deleteDocuments, formatSubmission, getPrefixedUrl, transformToWhere, } from '../../utils';
|
|
13
13
|
import { ActionDialog } from './ActionDialog';
|
|
14
14
|
import { DocumentViewerCell } from './DocumentViewerCell';
|
|
15
15
|
const styles = {
|
|
@@ -344,7 +344,7 @@ const RepeatableField = (props) => {
|
|
|
344
344
|
// when save is called we know that fieldDefinition is a parameter and fieldDefinition.objectId is defined
|
|
345
345
|
input = await formatSubmission(input, apiServices, fieldDefinition.objectId, selectedInstanceId, action?.type === 'update' ? updateForm : undefined, undefined, instance?.id && fieldDefinition.relatedPropertyId
|
|
346
346
|
? { instanceId: instance.id, propertyId: fieldDefinition.relatedPropertyId }
|
|
347
|
-
: undefined);
|
|
347
|
+
: undefined, action?.parameters ?? (relatedObject && convertPropertiesToParams(relatedObject)));
|
|
348
348
|
if (action?.type === 'create' && entry.display?.createActionId) {
|
|
349
349
|
const updatedInput = {
|
|
350
350
|
...input,
|
package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js
CHANGED
|
@@ -57,6 +57,7 @@ export const Document = (props) => {
|
|
|
57
57
|
const handleUpload = async (files) => {
|
|
58
58
|
// Store File objects in form state - they will be uploaded during autosave via formatSubmission()
|
|
59
59
|
const newDocuments = [...(documents ?? []), ...(files ?? [])];
|
|
60
|
+
console.debug('Uploading documents:', newDocuments);
|
|
60
61
|
setDocuments(newDocuments);
|
|
61
62
|
try {
|
|
62
63
|
handleChange && (await handleChange(id, newDocuments));
|
|
@@ -84,7 +84,7 @@ export declare function formatSubmission(submission: FieldValues, apiServices?:
|
|
|
84
84
|
}>>, associatedObject?: {
|
|
85
85
|
instanceId: string;
|
|
86
86
|
propertyId: string;
|
|
87
|
-
}): Promise<FieldValues>;
|
|
87
|
+
}, parameters?: InputParameter[]): Promise<FieldValues>;
|
|
88
88
|
export declare function filterEmptySections(entry: Sections | Columns, instance?: FieldValues, formData?: FieldValues): Sections | Columns | null;
|
|
89
89
|
export declare function assignIdsToSectionsAndRichText(entries: FormEntry[], object: Obj, parameters?: InputParameter[]): FormEntry[];
|
|
90
90
|
/**
|
|
@@ -115,6 +115,16 @@ export const getEntryId = (entry) => {
|
|
|
115
115
|
? entry.input.id
|
|
116
116
|
: undefined;
|
|
117
117
|
};
|
|
118
|
+
const getEntryType = (entry, parameters) => {
|
|
119
|
+
if (entry?.type === 'inputField') {
|
|
120
|
+
return entry?.input?.type;
|
|
121
|
+
}
|
|
122
|
+
else if (entry?.type === 'input') {
|
|
123
|
+
// For 'input' type entries, look up the parameter by parameterId
|
|
124
|
+
const parameter = parameters?.find((param) => param.id === entry.parameterId);
|
|
125
|
+
return parameter?.type;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
118
128
|
export function getPrefixedUrl(url) {
|
|
119
129
|
const wcsMatchers = ['/apps', '/pages', '/widgets'];
|
|
120
130
|
const dataMatchers = ['/objects', '/correspondenceTemplates', '/documents', '/payments', '/forms', '/locations'];
|
|
@@ -584,7 +594,7 @@ export const deleteDocuments = async (submittedFields, requestSuccess, apiServic
|
|
|
584
594
|
*
|
|
585
595
|
* Returns the cleaned submission ready for submitting.
|
|
586
596
|
*/
|
|
587
|
-
export async function formatSubmission(submission, apiServices, objectId, instanceId, form, setSnackbarError, associatedObject) {
|
|
597
|
+
export async function formatSubmission(submission, apiServices, objectId, instanceId, form, setSnackbarError, associatedObject, parameters) {
|
|
588
598
|
if (associatedObject) {
|
|
589
599
|
delete submission[associatedObject.propertyId];
|
|
590
600
|
}
|
|
@@ -596,7 +606,7 @@ export async function formatSubmission(submission, apiServices, objectId, instan
|
|
|
596
606
|
const fileInArray = value.some((item) => item instanceof File);
|
|
597
607
|
if (fileInArray && apiServices && objectId) {
|
|
598
608
|
// Determine property type from the entry
|
|
599
|
-
const propertyType = entry
|
|
609
|
+
const propertyType = getEntryType(entry, parameters);
|
|
600
610
|
try {
|
|
601
611
|
let uploadedDocuments = [];
|
|
602
612
|
if (propertyType === 'file') {
|