@evoke-platform/ui-components 1.11.1-dev.0 → 1.11.1-dev.2
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.
|
@@ -52,7 +52,7 @@ export declare function normalizeDateTime(dateTime: LocalDateTime): string;
|
|
|
52
52
|
export declare function normalizeDates(instances: ObjectInstance[], object?: Obj): void;
|
|
53
53
|
export declare function retrieveCustomErrorMessage(error: AxiosError<any>): string | undefined;
|
|
54
54
|
type CorruptedFile = {
|
|
55
|
-
handle
|
|
55
|
+
handle?: Record<string, never>;
|
|
56
56
|
path: string;
|
|
57
57
|
relativePath: string;
|
|
58
58
|
};
|
|
@@ -1451,5 +1451,5 @@ function convertVisibilityToConditional(visibility) {
|
|
|
1451
1451
|
return value.some((item) => isCorruptedFile(item));
|
|
1452
1452
|
}
|
|
1453
1453
|
export function isCorruptedFile(file) {
|
|
1454
|
-
return '
|
|
1454
|
+
return 'path' in file && 'relativePath' in file && !(file instanceof File);
|
|
1455
1455
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useApiServices, useApp, useAuthenticationContext, useNavigate, useObject, } from '@evoke-platform/context';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import { cloneDeep, get, isArray, isEmpty, isEqual, omit, pick, set
|
|
3
|
+
import { cloneDeep, get, isArray, isEmpty, isEqual, omit, pick, set } from 'lodash';
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Skeleton, Snackbar } from '../../core';
|
|
6
6
|
import { Box } from '../../layout';
|
|
7
7
|
import ErrorComponent from '../ErrorComponent';
|
|
8
8
|
import { evalDefaultVals, processValueUpdate } from './components/DefaultValues';
|
|
9
9
|
import Header from './components/Header';
|
|
10
|
-
import { convertDocToEntries, deleteDocuments, encodePageSlug, formatDataToDoc, formatSubmission, getEntryId, getPrefixedUrl, getUnnestedEntries, isAddressProperty, isEmptyWithDefault, plainTextToRtf, } from './components/utils';
|
|
10
|
+
import { convertDocToEntries, convertPropertiesToParams, deleteDocuments, encodePageSlug, formatDataToDoc, formatSubmission, getEntryId, getPrefixedUrl, getUnnestedEntries, isAddressProperty, isEmptyWithDefault, plainTextToRtf, } from './components/utils';
|
|
11
11
|
import FormRenderer from './FormRenderer';
|
|
12
12
|
function FormRendererContainer(props) {
|
|
13
13
|
const { instanceId, pageNavigation, documentId, dataType, display, formId, objectId, actionId, richTextEditor, onSubmit, onDiscardChanges: onDiscardChangesOverride, associatedObject, renderContainer, onSubmitError, sx, renderHeader, renderBody, renderFooter, } = props;
|
|
@@ -149,29 +149,12 @@ function FormRendererContainer(props) {
|
|
|
149
149
|
}
|
|
150
150
|
}, [action, actionId, objectId, instance]);
|
|
151
151
|
useEffect(() => {
|
|
152
|
-
if (form
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: 'view_permission',
|
|
161
|
-
name: 'View Permission',
|
|
162
|
-
type: 'string',
|
|
163
|
-
enum: ['Public', 'Private', 'Portal'],
|
|
164
|
-
},
|
|
165
|
-
]);
|
|
166
|
-
}
|
|
167
|
-
else if (form) {
|
|
168
|
-
const unnestedEntries = getUnnestedEntries(form.entries);
|
|
169
|
-
const inputFieldParams = unnestedEntries
|
|
170
|
-
.filter((entry) => entry.type === 'inputField')
|
|
171
|
-
.map((entry) => entry.input);
|
|
172
|
-
setParameters(uniq([...(action?.parameters ?? []), ...inputFieldParams]));
|
|
173
|
-
}
|
|
174
|
-
}, [form, action]);
|
|
152
|
+
if (!form)
|
|
153
|
+
return;
|
|
154
|
+
// If no parameters are defined, then the action is synced with object properties
|
|
155
|
+
const getParamsFromObject = sanitizedObject && !action?.parameters;
|
|
156
|
+
setParameters(getParamsFromObject ? convertPropertiesToParams(sanitizedObject) : action?.parameters);
|
|
157
|
+
}, [form, action?.parameters, sanitizedObject]);
|
|
175
158
|
useEffect(() => {
|
|
176
159
|
const getInitialValues = async () => {
|
|
177
160
|
if (document && objectId) {
|