@evoke-platform/ui-components 1.8.0-dev.6 → 1.8.0-dev.8
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/DataGrid/index.d.ts +1 -0
- package/dist/published/components/custom/Form/utils.js +76 -44
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +3 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +2 -2
- package/dist/published/components/custom/FormV2/components/utils.js +1 -1
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -97,7 +97,7 @@ function FormRendererContainer(props) {
|
|
|
97
97
|
return;
|
|
98
98
|
if (formId || action?.defaultFormId) {
|
|
99
99
|
apiServices
|
|
100
|
-
.get(getPrefixedUrl(
|
|
100
|
+
.get(getPrefixedUrl(`/forms/${formId || action?.defaultFormId}`))
|
|
101
101
|
.then((evokeForm) => {
|
|
102
102
|
if (evokeForm?.actionId === actionId) {
|
|
103
103
|
const form = onClose ? { ...evokeForm, name: '' } : evokeForm;
|
|
@@ -113,7 +113,7 @@ function FormRendererContainer(props) {
|
|
|
113
113
|
}
|
|
114
114
|
else if (action) {
|
|
115
115
|
apiServices
|
|
116
|
-
.get(getPrefixedUrl('
|
|
116
|
+
.get(getPrefixedUrl('/forms'), {
|
|
117
117
|
params: {
|
|
118
118
|
filter: {
|
|
119
119
|
where: {
|
|
@@ -146,7 +146,7 @@ function FormRendererContainer(props) {
|
|
|
146
146
|
},
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
else if (instance) {
|
|
149
|
+
else if (instance || action.type === 'create') {
|
|
150
150
|
setError(true);
|
|
151
151
|
}
|
|
152
152
|
})
|
|
@@ -66,7 +66,7 @@ const RepeatableField = (props) => {
|
|
|
66
66
|
function getForm(setForm, action, formId) {
|
|
67
67
|
if (formId || action?.defaultFormId) {
|
|
68
68
|
apiServices
|
|
69
|
-
.get(getPrefixedUrl(
|
|
69
|
+
.get(getPrefixedUrl(`/forms/${formId || action?.defaultFormId}`))
|
|
70
70
|
.then((evokeForm) => {
|
|
71
71
|
setForm(evokeForm);
|
|
72
72
|
})
|
|
@@ -76,7 +76,7 @@ const RepeatableField = (props) => {
|
|
|
76
76
|
}
|
|
77
77
|
else if (action) {
|
|
78
78
|
apiServices
|
|
79
|
-
.get(getPrefixedUrl('
|
|
79
|
+
.get(getPrefixedUrl('/forms'), {
|
|
80
80
|
params: {
|
|
81
81
|
filter: {
|
|
82
82
|
where: {
|
|
@@ -147,7 +147,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
147
147
|
useEffect(() => {
|
|
148
148
|
if (formId || action?.defaultFormId) {
|
|
149
149
|
apiServices
|
|
150
|
-
.get(getPrefixedUrl(
|
|
150
|
+
.get(getPrefixedUrl(`/forms/${formId || action?.defaultFormId}`))
|
|
151
151
|
.then((evokeForm) => {
|
|
152
152
|
setForm(evokeForm);
|
|
153
153
|
})
|
|
@@ -157,7 +157,7 @@ const ObjectPropertyInput = (props) => {
|
|
|
157
157
|
}
|
|
158
158
|
else if (action) {
|
|
159
159
|
apiServices
|
|
160
|
-
.get(getPrefixedUrl('
|
|
160
|
+
.get(getPrefixedUrl('/forms'), {
|
|
161
161
|
params: {
|
|
162
162
|
filter: {
|
|
163
163
|
where: {
|
|
@@ -116,7 +116,7 @@ export const getEntryId = (entry) => {
|
|
|
116
116
|
};
|
|
117
117
|
export function getPrefixedUrl(url) {
|
|
118
118
|
const wcsMatchers = ['/apps', '/pages', '/widgets'];
|
|
119
|
-
const dataMatchers = ['/objects', '/correspondenceTemplates', '/documents', '/payments', '/locations'];
|
|
119
|
+
const dataMatchers = ['/objects', '/correspondenceTemplates', '/documents', '/payments', '/forms', '/locations'];
|
|
120
120
|
const signalrMatchers = ['/hubs'];
|
|
121
121
|
const accessManagementMatchers = ['/users'];
|
|
122
122
|
const workflowMatchers = ['/workflows'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { BuilderGrid } from './BuilderGrid';
|
|
2
2
|
export { CriteriaBuilder, getReadableQuery } from './CriteriaBuilder';
|
|
3
3
|
export { DataGrid } from './DataGrid';
|
|
4
|
+
export type { GridSortModel } from './DataGrid';
|
|
4
5
|
export { ErrorComponent } from './ErrorComponent';
|
|
5
6
|
export { Form } from './Form';
|
|
6
7
|
export type { FormRef } from './Form';
|
|
@@ -3,7 +3,7 @@ export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTime
|
|
|
3
3
|
export * from './colors';
|
|
4
4
|
export * from './components/core';
|
|
5
5
|
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormContext, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RecursiveEntryRenderer, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, } from './components/custom';
|
|
6
|
-
export type { FormRef } from './components/custom';
|
|
6
|
+
export type { FormRef, GridSortModel } from './components/custom';
|
|
7
7
|
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
|
8
8
|
export { Box, Container, Grid, Stack } from './components/layout';
|
|
9
9
|
export * from './theme';
|