@evoke-platform/ui-components 1.15.0 → 1.16.0
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/CriteriaBuilder/CriteriaBuilder.d.ts +8 -4
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +242 -142
- package/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.test.js +189 -67
- package/dist/published/components/custom/CriteriaBuilder/PropertyTree.d.ts +6 -6
- package/dist/published/components/custom/CriteriaBuilder/PropertyTree.js +12 -25
- package/dist/published/components/custom/CriteriaBuilder/PropertyTreeItem.d.ts +4 -5
- package/dist/published/components/custom/CriteriaBuilder/PropertyTreeItem.js +34 -22
- package/dist/published/components/custom/CriteriaBuilder/types.d.ts +2 -11
- package/dist/published/components/custom/CriteriaBuilder/utils.d.ts +6 -34
- package/dist/published/components/custom/CriteriaBuilder/utils.js +18 -89
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/Document.js +1 -1
- package/dist/published/components/custom/Form/FormComponents/DocumentComponent/DocumentList.js +6 -3
- package/dist/published/components/custom/Form/utils.d.ts +1 -0
- package/dist/published/components/custom/FormV2/FormRenderer.d.ts +2 -1
- package/dist/published/components/custom/FormV2/FormRenderer.js +2 -8
- package/dist/published/components/custom/FormV2/FormRendererContainer.d.ts +4 -0
- package/dist/published/components/custom/FormV2/FormRendererContainer.js +229 -126
- package/dist/published/components/custom/FormV2/components/DefaultValues.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/DefaultValues.js +60 -89
- package/dist/published/components/custom/FormV2/components/FormContext.d.ts +1 -1
- package/dist/published/components/custom/FormV2/components/FormContext.js +0 -1
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +1 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +43 -16
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.d.ts +2 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.js +3 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.d.ts +3 -2
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +44 -11
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.d.ts +4 -3
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.js +41 -29
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/FileContent.d.ts +12 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/FileContent.js +197 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.js +2 -4
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +14 -0
- package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +6 -2
- package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +16 -13
- package/dist/published/components/custom/FormV2/components/types.d.ts +6 -1
- package/dist/published/components/custom/FormV2/components/utils.d.ts +10 -8
- package/dist/published/components/custom/FormV2/components/utils.js +168 -82
- package/dist/published/components/custom/ViewDetailsV2/InstanceEntryRenderer.js +6 -1
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/index.d.ts +1 -1
- package/dist/published/stories/CriteriaBuilder.stories.js +70 -22
- package/dist/published/stories/FormRenderer.stories.d.ts +6 -3
- package/dist/published/stories/FormRendererContainer.stories.d.ts +20 -0
- package/dist/published/theme/hooks.d.ts +3 -3
- package/package.json +3 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LocalDateTime } from '@js-joda/core';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
3
|
import { jsonLogic } from 'json-logic-js-graphql';
|
|
3
4
|
import { get, isArray, isEmpty, isObject, omit, pick, startCase, transform } from 'lodash';
|
|
4
5
|
import { DateTime } from 'luxon';
|
|
@@ -6,7 +7,6 @@ import { nanoid } from 'nanoid';
|
|
|
6
7
|
import Handlebars from 'no-eval-handlebars';
|
|
7
8
|
import { defaultRuleProcessorMongoDB, formatQuery } from 'react-querybuilder';
|
|
8
9
|
import { parseMongoDB } from '../../util';
|
|
9
|
-
import { useQuery } from '@tanstack/react-query';
|
|
10
10
|
export const scrollIntoViewWithOffset = (el, offset, container) => {
|
|
11
11
|
const elementRect = el.getBoundingClientRect();
|
|
12
12
|
const containerRect = container ? container.getBoundingClientRect() : document.body.getBoundingClientRect();
|
|
@@ -117,9 +117,27 @@ export const getEntryId = (entry) => {
|
|
|
117
117
|
? entry.input.id
|
|
118
118
|
: undefined;
|
|
119
119
|
};
|
|
120
|
+
const getEntryType = (entry, parameters) => {
|
|
121
|
+
if (entry?.type === 'inputField') {
|
|
122
|
+
return entry?.input?.type;
|
|
123
|
+
}
|
|
124
|
+
else if (entry?.type === 'input') {
|
|
125
|
+
// For 'input' type entries, look up the parameter by parameterId
|
|
126
|
+
const parameter = parameters?.find((param) => param.id === entry.parameterId);
|
|
127
|
+
return parameter?.type;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
120
130
|
export function getPrefixedUrl(url) {
|
|
121
131
|
const wcsMatchers = ['/apps', '/pages', '/widgets'];
|
|
122
|
-
const dataMatchers = [
|
|
132
|
+
const dataMatchers = [
|
|
133
|
+
'/objects',
|
|
134
|
+
'/correspondenceTemplates',
|
|
135
|
+
'/documents',
|
|
136
|
+
'/payments',
|
|
137
|
+
'/forms',
|
|
138
|
+
'/locations',
|
|
139
|
+
'/files',
|
|
140
|
+
];
|
|
123
141
|
const signalrMatchers = ['/hubs'];
|
|
124
142
|
const accessManagementMatchers = ['/users'];
|
|
125
143
|
const workflowMatchers = ['/workflows'];
|
|
@@ -403,7 +421,7 @@ export const convertPropertiesToParams = (object) => {
|
|
|
403
421
|
]
|
|
404
422
|
: [...acc, property];
|
|
405
423
|
}, [])
|
|
406
|
-
.filter((
|
|
424
|
+
.filter((prop) => prop.type !== 'collection' && !prop.formula)
|
|
407
425
|
.flat()
|
|
408
426
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
409
427
|
.map(propertyToParameter);
|
|
@@ -459,53 +477,85 @@ export const docProperties = [
|
|
|
459
477
|
type: 'string',
|
|
460
478
|
},
|
|
461
479
|
];
|
|
462
|
-
|
|
463
|
-
* Upload files using the POST /files endpoint for sys__file objects
|
|
464
|
-
*/
|
|
465
|
-
export const uploadFiles = async (files, apiServices, actionId = '_create', metadata, linkTo) => {
|
|
480
|
+
export const uploadFiles = async (files, apiServices, actionId = '_create', fileObjectId = 'sys__file', linkTo, shortCircuit = true) => {
|
|
466
481
|
// Separate already uploaded files from files that need uploading
|
|
467
482
|
const alreadyUploaded = files.filter((file) => !('size' in file));
|
|
468
483
|
const filesToUpload = files.filter((file) => 'size' in file);
|
|
469
|
-
|
|
470
|
-
|
|
484
|
+
let failedUpload = false;
|
|
485
|
+
// Upload all files in parallel, handling each result individually
|
|
486
|
+
const uploadPromises = [];
|
|
487
|
+
for (const file of filesToUpload) {
|
|
471
488
|
const formData = new FormData();
|
|
472
489
|
formData.append('file', file);
|
|
473
490
|
formData.append('actionId', actionId);
|
|
474
|
-
formData.append('objectId',
|
|
475
|
-
|
|
476
|
-
for (const [key, value] of Object.entries(metadata)) {
|
|
477
|
-
formData.append(key, value);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
491
|
+
formData.append('objectId', fileObjectId);
|
|
492
|
+
formData.append('input', JSON.stringify({ name: file.name, contentType: file.type }));
|
|
480
493
|
if (linkTo) {
|
|
481
494
|
formData.append('linkTo', JSON.stringify(linkTo));
|
|
482
495
|
}
|
|
483
|
-
const
|
|
496
|
+
const uploadPromise = (async () => {
|
|
497
|
+
try {
|
|
498
|
+
const fileInstance = await apiServices.post(getPrefixedUrl(`/files`), formData);
|
|
499
|
+
return {
|
|
500
|
+
id: fileInstance.id,
|
|
501
|
+
name: fileInstance.name,
|
|
502
|
+
unsaved: true,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
catch (error) {
|
|
506
|
+
console.error(`Failed to upload file ${file.name}:`, error);
|
|
507
|
+
failedUpload = true;
|
|
508
|
+
}
|
|
509
|
+
})();
|
|
510
|
+
uploadPromises.push(uploadPromise);
|
|
511
|
+
}
|
|
512
|
+
if (!shortCircuit) {
|
|
513
|
+
// Wait for all upload attempts to complete (successes and failures)
|
|
514
|
+
const uploadResults = await Promise.allSettled(uploadPromises);
|
|
515
|
+
const uploadedFiles = uploadResults
|
|
516
|
+
.filter((result) => result.status === 'fulfilled' && !!result.value)
|
|
517
|
+
.map((result) => result.value);
|
|
518
|
+
const failedCount = filesToUpload.length - uploadedFiles.length;
|
|
484
519
|
return {
|
|
485
|
-
|
|
486
|
-
|
|
520
|
+
successfulUploads: [...alreadyUploaded, ...uploadedFiles],
|
|
521
|
+
errorMessage: failedCount > 0 ? `Failed to upload ${failedCount} file(s)` : undefined,
|
|
487
522
|
};
|
|
488
|
-
}
|
|
523
|
+
}
|
|
489
524
|
const uploadedFiles = await Promise.all(uploadPromises);
|
|
490
|
-
|
|
525
|
+
if (failedUpload) {
|
|
526
|
+
return {
|
|
527
|
+
successfulUploads: [],
|
|
528
|
+
errorMessage: 'An error occurred when uploading files',
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
successfulUploads: [...alreadyUploaded, ...uploadedFiles],
|
|
533
|
+
};
|
|
491
534
|
};
|
|
492
535
|
/**
|
|
493
536
|
* Creates file links for uploaded files by calling the objects endpoint with sys__fileLink
|
|
494
537
|
* This is used after instance creation when the instance ID becomes available
|
|
495
538
|
*/
|
|
496
|
-
export const createFileLinks = async (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
539
|
+
export const createFileLinks = async (fileReferences, linkedInstance, apiServices) => {
|
|
540
|
+
// Link files in parallel, handling each result individually
|
|
541
|
+
const linkPromises = [];
|
|
542
|
+
for (const file of fileReferences) {
|
|
543
|
+
const linkPromise = (async () => {
|
|
544
|
+
try {
|
|
545
|
+
await apiServices.post(getPrefixedUrl(`/objects/sys__fileLink/instances/actions`), {
|
|
546
|
+
actionId: '_create',
|
|
547
|
+
input: { name: 'File Link', file: { id: file.id, name: file.name }, linkedInstance },
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
console.error(`Failed to create file link for ${file.name}:`, error);
|
|
552
|
+
// The file remains unlinked and can be retried later
|
|
553
|
+
}
|
|
554
|
+
})();
|
|
555
|
+
linkPromises.push(linkPromise);
|
|
556
|
+
}
|
|
557
|
+
// Wait for all linking attempts to complete (successes and failures)
|
|
558
|
+
await Promise.allSettled(linkPromises);
|
|
509
559
|
};
|
|
510
560
|
export const uploadDocuments = async (files, metadata, apiServices, instanceId, objectId) => {
|
|
511
561
|
const allDocuments = [];
|
|
@@ -533,20 +583,29 @@ export const uploadDocuments = async (files, metadata, apiServices, instanceId,
|
|
|
533
583
|
export const deleteDocuments = async (submittedFields, requestSuccess, apiServices, object, instance, action, setSnackbarError) => {
|
|
534
584
|
const documentProperties = action?.parameters
|
|
535
585
|
? action.parameters.filter((param) => ['document', 'file'].includes(param.type))
|
|
536
|
-
: object
|
|
586
|
+
: object.properties?.filter((prop) => ['document', 'file'].includes(prop.type));
|
|
537
587
|
for (const docProperty of documentProperties ?? []) {
|
|
538
588
|
const savedValue = submittedFields[docProperty.id];
|
|
539
|
-
const originalValue = instance
|
|
589
|
+
const originalValue = instance[docProperty.id];
|
|
540
590
|
const documentsToRemove = requestSuccess
|
|
541
591
|
? (originalValue?.filter((file) => !savedValue?.some((f) => f.id === file.id)) ?? [])
|
|
542
592
|
: (savedValue?.filter((file) => !originalValue?.some((f) => f.id === file.id)) ?? []);
|
|
543
593
|
for (const doc of documentsToRemove) {
|
|
544
594
|
try {
|
|
545
|
-
//
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
595
|
+
// Build context for state model
|
|
596
|
+
const fieldType = docProperty.type === 'file' ? 'file' : 'document';
|
|
597
|
+
if (fieldType === 'file') {
|
|
598
|
+
// For file properties, unlink the file. Don't delete the actual file
|
|
599
|
+
// since other instances may be using it.
|
|
600
|
+
await apiServices.post(getPrefixedUrl(`/files/${doc.id}/unlinkInstance`), {
|
|
601
|
+
linkedInstanceId: instance.id,
|
|
602
|
+
linkedObjectId: object.id,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
// For document properties, delete the document
|
|
607
|
+
await apiServices.delete(getPrefixedUrl(`/objects/${object.id}/instances/${instance.id}/documents/${doc.id}`));
|
|
608
|
+
}
|
|
550
609
|
}
|
|
551
610
|
catch (error) {
|
|
552
611
|
if (error) {
|
|
@@ -561,16 +620,28 @@ export const deleteDocuments = async (submittedFields, requestSuccess, apiServic
|
|
|
561
620
|
}
|
|
562
621
|
}
|
|
563
622
|
};
|
|
564
|
-
|
|
565
|
-
if (
|
|
566
|
-
|
|
623
|
+
async function handleUploads(files, propertyType, entry, apiServices, objectId, instanceId) {
|
|
624
|
+
if (propertyType === 'file') {
|
|
625
|
+
const fileObjectId = entry.display?.fileObjectId ?? 'sys__file';
|
|
626
|
+
const createActionId = entry.display?.createActionId ?? '_create';
|
|
627
|
+
return await uploadFiles(files, apiServices, createActionId, fileObjectId, instanceId ? { id: instanceId, objectId } : undefined);
|
|
567
628
|
}
|
|
568
|
-
else if (
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
629
|
+
else if (propertyType === 'document' && instanceId) {
|
|
630
|
+
try {
|
|
631
|
+
const docs = await uploadDocuments(files, {
|
|
632
|
+
type: '',
|
|
633
|
+
view_permission: '',
|
|
634
|
+
...entry?.documentMetadata,
|
|
635
|
+
}, apiServices, instanceId, objectId);
|
|
636
|
+
return { successfulUploads: docs };
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
console.error('Error uploading documents:', error);
|
|
640
|
+
return { successfulUploads: [], errorMessage: 'Error uploading documents' };
|
|
641
|
+
}
|
|
572
642
|
}
|
|
573
|
-
};
|
|
643
|
+
return { successfulUploads: [] };
|
|
644
|
+
}
|
|
574
645
|
/**
|
|
575
646
|
* Transforms a form submission into a format safe for API submission.
|
|
576
647
|
*
|
|
@@ -588,50 +659,42 @@ export async function formatSubmission(submission, apiServices, objectId, instan
|
|
|
588
659
|
if (associatedObject) {
|
|
589
660
|
delete submission[associatedObject.propertyId];
|
|
590
661
|
}
|
|
591
|
-
const allEntries = getUnnestedEntries(form?.entries ?? [])
|
|
662
|
+
const allEntries = getUnnestedEntries(form?.entries ?? []);
|
|
592
663
|
for (const [key, value] of Object.entries(submission)) {
|
|
593
664
|
const entry = allEntries?.find((entry) => getEntryId(entry) === key);
|
|
594
665
|
if (isArray(value)) {
|
|
595
|
-
|
|
666
|
+
const propertyType = getEntryType(entry, parameters);
|
|
667
|
+
// The only array types we need to handle specially are 'file' and 'document'.
|
|
668
|
+
if (propertyType !== 'file' && propertyType !== 'document') {
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
// Only upload if array contains File instances (not SavedDocumentReference).
|
|
596
672
|
const fileInArray = value.some((item) => item instanceof File);
|
|
597
673
|
if (fileInArray && apiServices && objectId) {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
// Only pass linkTo if instanceId exists (update action)
|
|
607
|
-
instanceId ? { id: instanceId, objectId } : undefined);
|
|
608
|
-
}
|
|
609
|
-
else if (parameterType === 'document' && instanceId) {
|
|
610
|
-
uploadedDocuments = await uploadDocuments(value, {
|
|
611
|
-
type: '',
|
|
612
|
-
view_permission: '',
|
|
613
|
-
...entry?.documentMetadata,
|
|
614
|
-
}, apiServices, instanceId, objectId);
|
|
615
|
-
}
|
|
616
|
-
submission[key] = uploadedDocuments;
|
|
617
|
-
}
|
|
618
|
-
catch (err) {
|
|
619
|
-
if (err) {
|
|
620
|
-
setSnackbarError &&
|
|
621
|
-
setSnackbarError({
|
|
622
|
-
showAlert: true,
|
|
623
|
-
message: `An error occurred while uploading associated ${parameterType === 'file' ? 'files' : 'documents'}`,
|
|
624
|
-
isError: true,
|
|
625
|
-
});
|
|
626
|
-
}
|
|
674
|
+
const result = await handleUploads(value, propertyType ?? '', entry, apiServices, objectId, instanceId);
|
|
675
|
+
if (result.errorMessage) {
|
|
676
|
+
setSnackbarError?.({
|
|
677
|
+
showAlert: true,
|
|
678
|
+
// Provide generic message since we're ignoring a partial upload.
|
|
679
|
+
message: `An error occurred while uploading associated ${propertyType === 'file' ? 'files' : 'documents'}`,
|
|
680
|
+
isError: true,
|
|
681
|
+
});
|
|
627
682
|
return submission;
|
|
628
683
|
}
|
|
684
|
+
submission[key] = result.successfulUploads;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
submission[key] = value
|
|
688
|
+
// This should never happen but it's possible that the else branch
|
|
689
|
+
// is reached because either 'apiServices' or 'objectId' is undefined.
|
|
690
|
+
// If that's the case the submission will fail if we submit File blobs.
|
|
691
|
+
.filter((file) => !(file instanceof File));
|
|
629
692
|
}
|
|
630
693
|
// if there are address fields with no value address needs to be set to undefined to be able to submit
|
|
631
694
|
}
|
|
632
695
|
else if (typeof value === 'object' && value !== null) {
|
|
633
|
-
if (Object.values(value).every((v) => v === undefined)) {
|
|
634
|
-
submission[key] =
|
|
696
|
+
if (Object.values(value).every((v) => v === undefined || v === '')) {
|
|
697
|
+
submission[key] = null;
|
|
635
698
|
// only submit the name and id of a regular related object
|
|
636
699
|
// and include objectId if it is a dynamic related object
|
|
637
700
|
}
|
|
@@ -639,7 +702,8 @@ export async function formatSubmission(submission, apiServices, objectId, instan
|
|
|
639
702
|
submission[key] =
|
|
640
703
|
entry &&
|
|
641
704
|
['input', 'inputField'].includes(entry.type) &&
|
|
642
|
-
entry.display?.relatedObjectId
|
|
705
|
+
(entry.display?.relatedObjectId ||
|
|
706
|
+
associatedObject?.objectId)
|
|
643
707
|
? pick(value, 'id', 'name', 'objectId')
|
|
644
708
|
: pick(value, 'id', 'name');
|
|
645
709
|
}
|
|
@@ -871,6 +935,28 @@ function applyMaskToObfuscatedValue(value, mask) {
|
|
|
871
935
|
}
|
|
872
936
|
return maskedValue;
|
|
873
937
|
}
|
|
938
|
+
export async function handleFileUpload(apiServices, submission, actionId, objectId, instanceId, linkTo) {
|
|
939
|
+
const formData = new FormData();
|
|
940
|
+
if (submission['content'] instanceof File && submission['content'].size !== 0) {
|
|
941
|
+
formData.append('file', submission['content']);
|
|
942
|
+
}
|
|
943
|
+
formData.append('objectId', objectId ?? 'sys__file');
|
|
944
|
+
formData.append('actionId', actionId);
|
|
945
|
+
delete submission['content'];
|
|
946
|
+
formData.append('input', JSON.stringify(submission));
|
|
947
|
+
if (instanceId) {
|
|
948
|
+
return await apiServices.patch(getPrefixedUrl(`/files/${instanceId}`), formData);
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
if (linkTo) {
|
|
952
|
+
formData.append('linkTo', JSON.stringify({
|
|
953
|
+
id: linkTo?.instanceId,
|
|
954
|
+
objectId: linkTo?.objectId,
|
|
955
|
+
}));
|
|
956
|
+
}
|
|
957
|
+
return await apiServices.post(getPrefixedUrl(`/files`), formData);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
874
960
|
export function useFormById(formId, apiServices, errorMessage) {
|
|
875
961
|
return useQuery({
|
|
876
962
|
queryKey: ['form', formId],
|
|
@@ -14,6 +14,7 @@ import DropdownRepeatableField from '../FormV2/components/FormFieldTypes/Collect
|
|
|
14
14
|
import RepeatableField from '../FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField';
|
|
15
15
|
import Criteria from '../FormV2/components/FormFieldTypes/Criteria';
|
|
16
16
|
import { Document } from '../FormV2/components/FormFieldTypes/DocumentFiles/Document';
|
|
17
|
+
import { FileContent } from '../FormV2/components/FormFieldTypes/FileContent';
|
|
17
18
|
import { Image } from '../FormV2/components/FormFieldTypes/Image';
|
|
18
19
|
import PropertyProtection from '../FormV2/components/PropertyProtection';
|
|
19
20
|
import { entryIsVisible, fetchInitialMiddleObjectInstances, fetchMiddleObject, filterEmptySections, getDefaultPages, isAddressProperty, } from '../FormV2/components/utils';
|
|
@@ -164,7 +165,11 @@ function ViewOnlyEntryRenderer(props) {
|
|
|
164
165
|
}
|
|
165
166
|
else if (fieldDefinition.type === 'document' || fieldDefinition.type === 'file') {
|
|
166
167
|
return (React.createElement(FieldWrapper, { inputId: entryId, inputType: fieldDefinition.type, label: display?.label || fieldDefinition?.name || 'default', value: fieldValue, required: display?.required || false, prefix: display?.prefix, suffix: display?.suffix, viewOnly: true },
|
|
167
|
-
React.createElement(Document, { id: entryId, error: false, value: fieldValue, canUpdateProperty: false })));
|
|
168
|
+
React.createElement(Document, { id: entryId, fieldType: fieldDefinition.type, error: false, value: fieldValue, canUpdateProperty: false })));
|
|
169
|
+
}
|
|
170
|
+
else if (fieldDefinition.type === 'fileContent') {
|
|
171
|
+
return (React.createElement(FieldWrapper, { inputId: entryId, inputType: 'fileContent', label: display?.label || fieldDefinition?.name || 'default', value: fieldValue, required: display?.required || false, viewOnly: true },
|
|
172
|
+
React.createElement(FileContent, { id: entryId, error: false, value: fieldValue, canUpdateProperty: false })));
|
|
168
173
|
}
|
|
169
174
|
else if (fieldDefinition.type === 'collection') {
|
|
170
175
|
if (fieldDefinition.manyToManyPropertyId && !isEmpty(middleObject)) {
|
|
@@ -16,5 +16,6 @@ export { RichTextViewer } from './RichTextViewer';
|
|
|
16
16
|
export { UserAvatar } from './UserAvatar';
|
|
17
17
|
export { ViewDetailsV2Container, ViewOnlyEntryRenderer } from './ViewDetailsV2';
|
|
18
18
|
export type { ViewDetailsV2ContainerProps } from './ViewDetailsV2';
|
|
19
|
+
export type { TreeViewObject, TreeViewProperty } from './CriteriaBuilder/types';
|
|
19
20
|
export * from './util';
|
|
20
21
|
export type { MongoDBQueryValue } from './types';
|
|
@@ -7,7 +7,7 @@ export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTime
|
|
|
7
7
|
export * from './colors';
|
|
8
8
|
export * from './components/core';
|
|
9
9
|
export { BuilderGrid, CriteriaBuilder, DataGrid, ErrorComponent, Form, FormContext, FormField, FormRenderer, FormRendererContainer, getReadableQuery, HistoryLog, MenuBar, MultiSelect, RecursiveEntryRenderer, RepeatableField, ResponsiveOverflow, RichTextViewer, UserAvatar, ViewDetailsV2Container, ViewOnlyEntryRenderer, parseMongoDB, difference, } from './components/custom';
|
|
10
|
-
export type { BodyProps, FooterProps, FormRef, GridSortModel, HeaderProps, MongoDBQueryValue, ViewDetailsV2ContainerProps, } from './components/custom';
|
|
10
|
+
export type { BodyProps, FooterProps, FormRef, GridSortModel, HeaderProps, MongoDBQueryValue, ViewDetailsV2ContainerProps, TreeViewObject, TreeViewProperty, } from './components/custom';
|
|
11
11
|
export { NumericFormat } from './components/custom/FormField/InputFieldComponent';
|
|
12
12
|
export { Box, Container, Grid, Stack } from './components/layout';
|
|
13
13
|
export * from './theme';
|
|
@@ -256,19 +256,26 @@ CriteriaBuilderRelatedObject.args = {
|
|
|
256
256
|
],
|
|
257
257
|
},
|
|
258
258
|
{
|
|
259
|
-
id: 'dynamic
|
|
260
|
-
name: 'Dynamic
|
|
261
|
-
type: '
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
259
|
+
id: 'dynamic',
|
|
260
|
+
name: 'Dynamic',
|
|
261
|
+
type: 'object',
|
|
262
|
+
children: [
|
|
263
|
+
{
|
|
264
|
+
id: 'id',
|
|
265
|
+
name: 'ID',
|
|
266
|
+
type: 'string',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: 'name',
|
|
270
|
+
name: 'Name',
|
|
271
|
+
type: 'string',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: 'objectId',
|
|
275
|
+
name: 'Object Id',
|
|
276
|
+
type: 'string',
|
|
277
|
+
},
|
|
278
|
+
],
|
|
272
279
|
},
|
|
273
280
|
{
|
|
274
281
|
id: 'name',
|
|
@@ -552,19 +559,48 @@ CriteriaBuilderRelatedObject.args = {
|
|
|
552
559
|
required: false,
|
|
553
560
|
},
|
|
554
561
|
{
|
|
555
|
-
id: 'dynamic
|
|
556
|
-
name: 'Dynamic
|
|
557
|
-
type: '
|
|
562
|
+
id: 'dynamic',
|
|
563
|
+
name: 'Dynamic',
|
|
564
|
+
type: 'object',
|
|
565
|
+
children: [
|
|
566
|
+
{
|
|
567
|
+
id: 'id',
|
|
568
|
+
name: 'ID',
|
|
569
|
+
type: 'string',
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
id: 'name',
|
|
573
|
+
name: 'Name',
|
|
574
|
+
type: 'string',
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: 'objectId',
|
|
578
|
+
name: 'Object Id',
|
|
579
|
+
type: 'string',
|
|
580
|
+
},
|
|
581
|
+
],
|
|
558
582
|
},
|
|
559
583
|
{
|
|
560
|
-
id: '
|
|
561
|
-
name: '
|
|
562
|
-
type: '
|
|
584
|
+
id: 'dynamic2',
|
|
585
|
+
name: 'Dynamic2',
|
|
586
|
+
type: 'object',
|
|
563
587
|
},
|
|
564
588
|
{
|
|
565
|
-
id: '
|
|
566
|
-
name: '
|
|
567
|
-
type: '
|
|
589
|
+
id: 'address',
|
|
590
|
+
name: 'Address',
|
|
591
|
+
type: 'address',
|
|
592
|
+
children: [
|
|
593
|
+
{
|
|
594
|
+
id: 'line1',
|
|
595
|
+
name: 'Line 1',
|
|
596
|
+
type: 'string',
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
id: 'line2',
|
|
600
|
+
name: 'Line 2',
|
|
601
|
+
type: 'string',
|
|
602
|
+
},
|
|
603
|
+
],
|
|
568
604
|
},
|
|
569
605
|
],
|
|
570
606
|
},
|
|
@@ -716,6 +752,18 @@ CriteriaBuilderRelatedObject.args = {
|
|
|
716
752
|
{
|
|
717
753
|
'applicationType.status': 'DNP',
|
|
718
754
|
},
|
|
755
|
+
{
|
|
756
|
+
'applicant.deleted': '1',
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
deleted: '1',
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
'applicant.license.expirationDate': '2025-01-16',
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
dynamic2: '1',
|
|
766
|
+
},
|
|
719
767
|
],
|
|
720
768
|
},
|
|
721
769
|
enablePresetValues: false,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("../components/custom/FormV2/components/types").BaseProps & {
|
|
3
3
|
richTextEditor?: React.ComponentType<import("../components/custom/FormV2/components/types").SimpleEditorProps> | undefined;
|
|
4
4
|
value?: import("react-hook-form").FieldValues | undefined;
|
|
5
|
-
onSubmit?: ((data: import("react-hook-form").FieldValues) => void) | undefined;
|
|
5
|
+
onSubmit?: ((data: import("react-hook-form").FieldValues) => Promise<void> | ((data: import("react-hook-form").FieldValues) => void)) | undefined;
|
|
6
6
|
onDiscardChanges?: (() => void) | undefined;
|
|
7
7
|
onSubmitError?: import("react-hook-form").SubmitErrorHandler<import("react-hook-form").FieldValues> | undefined;
|
|
8
8
|
hideTitle?: boolean | undefined;
|
|
@@ -15,6 +15,7 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
15
15
|
associatedObject?: {
|
|
16
16
|
instanceId: string;
|
|
17
17
|
propertyId: string;
|
|
18
|
+
objectId?: string | undefined;
|
|
18
19
|
} | undefined;
|
|
19
20
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
20
21
|
renderBody?: ((props: import("../components/custom").BodyProps) => React.ReactNode) | undefined;
|
|
@@ -24,7 +25,7 @@ export default _default;
|
|
|
24
25
|
export declare const Editable: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("../components/custom/FormV2/components/types").BaseProps & {
|
|
25
26
|
richTextEditor?: React.ComponentType<import("../components/custom/FormV2/components/types").SimpleEditorProps> | undefined;
|
|
26
27
|
value?: import("react-hook-form").FieldValues | undefined;
|
|
27
|
-
onSubmit?: ((data: import("react-hook-form").FieldValues) => void) | undefined;
|
|
28
|
+
onSubmit?: ((data: import("react-hook-form").FieldValues) => Promise<void> | ((data: import("react-hook-form").FieldValues) => void)) | undefined;
|
|
28
29
|
onDiscardChanges?: (() => void) | undefined;
|
|
29
30
|
onSubmitError?: import("react-hook-form").SubmitErrorHandler<import("react-hook-form").FieldValues> | undefined;
|
|
30
31
|
hideTitle?: boolean | undefined;
|
|
@@ -37,6 +38,7 @@ export declare const Editable: import("@storybook/types").AnnotatedStoryFn<impor
|
|
|
37
38
|
associatedObject?: {
|
|
38
39
|
instanceId: string;
|
|
39
40
|
propertyId: string;
|
|
41
|
+
objectId?: string | undefined;
|
|
40
42
|
} | undefined;
|
|
41
43
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
42
44
|
renderBody?: ((props: import("../components/custom").BodyProps) => React.ReactNode) | undefined;
|
|
@@ -45,7 +47,7 @@ export declare const Editable: import("@storybook/types").AnnotatedStoryFn<impor
|
|
|
45
47
|
export declare const NoButtons: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("../components/custom/FormV2/components/types").BaseProps & {
|
|
46
48
|
richTextEditor?: React.ComponentType<import("../components/custom/FormV2/components/types").SimpleEditorProps> | undefined;
|
|
47
49
|
value?: import("react-hook-form").FieldValues | undefined;
|
|
48
|
-
onSubmit?: ((data: import("react-hook-form").FieldValues) => void) | undefined;
|
|
50
|
+
onSubmit?: ((data: import("react-hook-form").FieldValues) => Promise<void> | ((data: import("react-hook-form").FieldValues) => void)) | undefined;
|
|
49
51
|
onDiscardChanges?: (() => void) | undefined;
|
|
50
52
|
onSubmitError?: import("react-hook-form").SubmitErrorHandler<import("react-hook-form").FieldValues> | undefined;
|
|
51
53
|
hideTitle?: boolean | undefined;
|
|
@@ -58,6 +60,7 @@ export declare const NoButtons: import("@storybook/types").AnnotatedStoryFn<impo
|
|
|
58
60
|
associatedObject?: {
|
|
59
61
|
instanceId: string;
|
|
60
62
|
propertyId: string;
|
|
63
|
+
objectId?: string | undefined;
|
|
61
64
|
} | undefined;
|
|
62
65
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
63
66
|
renderBody?: ((props: import("../components/custom").BodyProps) => React.ReactNode) | undefined;
|
|
@@ -20,6 +20,10 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
|
|
|
20
20
|
associatedObject?: {
|
|
21
21
|
instanceId: string;
|
|
22
22
|
propertyId: string;
|
|
23
|
+
objectId?: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
instanceId: string;
|
|
26
|
+
objectId: string;
|
|
23
27
|
} | undefined;
|
|
24
28
|
renderContainer?: ((state: import("../components/custom/FormV2/FormRendererContainer").FormRendererState) => React.ReactNode) | undefined;
|
|
25
29
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
@@ -49,6 +53,10 @@ export declare const Editable: import("@storybook/types").AnnotatedStoryFn<impor
|
|
|
49
53
|
associatedObject?: {
|
|
50
54
|
instanceId: string;
|
|
51
55
|
propertyId: string;
|
|
56
|
+
objectId?: string | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
instanceId: string;
|
|
59
|
+
objectId: string;
|
|
52
60
|
} | undefined;
|
|
53
61
|
renderContainer?: ((state: import("../components/custom/FormV2/FormRendererContainer").FormRendererState) => React.ReactNode) | undefined;
|
|
54
62
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
@@ -77,6 +85,10 @@ export declare const DefaultForm: import("@storybook/types").AnnotatedStoryFn<im
|
|
|
77
85
|
associatedObject?: {
|
|
78
86
|
instanceId: string;
|
|
79
87
|
propertyId: string;
|
|
88
|
+
objectId?: string | undefined;
|
|
89
|
+
} | {
|
|
90
|
+
instanceId: string;
|
|
91
|
+
objectId: string;
|
|
80
92
|
} | undefined;
|
|
81
93
|
renderContainer?: ((state: import("../components/custom/FormV2/FormRendererContainer").FormRendererState) => React.ReactNode) | undefined;
|
|
82
94
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
@@ -105,6 +117,10 @@ export declare const NoButtons: import("@storybook/types").AnnotatedStoryFn<impo
|
|
|
105
117
|
associatedObject?: {
|
|
106
118
|
instanceId: string;
|
|
107
119
|
propertyId: string;
|
|
120
|
+
objectId?: string | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
instanceId: string;
|
|
123
|
+
objectId: string;
|
|
108
124
|
} | undefined;
|
|
109
125
|
renderContainer?: ((state: import("../components/custom/FormV2/FormRendererContainer").FormRendererState) => React.ReactNode) | undefined;
|
|
110
126
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
@@ -133,6 +149,10 @@ export declare const FormWithSections: import("@storybook/types").AnnotatedStory
|
|
|
133
149
|
associatedObject?: {
|
|
134
150
|
instanceId: string;
|
|
135
151
|
propertyId: string;
|
|
152
|
+
objectId?: string | undefined;
|
|
153
|
+
} | {
|
|
154
|
+
instanceId: string;
|
|
155
|
+
objectId: string;
|
|
136
156
|
} | undefined;
|
|
137
157
|
renderContainer?: ((state: import("../components/custom/FormV2/FormRendererContainer").FormRendererState) => React.ReactNode) | undefined;
|
|
138
158
|
renderHeader?: ((props: import("../components/custom").HeaderProps) => React.ReactNode) | undefined;
|
|
@@ -150,12 +150,12 @@ export declare function useFormContext(): {
|
|
|
150
150
|
handleChange?: ((name: string, value: unknown) => void | Promise<void>) | undefined;
|
|
151
151
|
onAutosave?: ((fieldId: string) => void | Promise<void>) | undefined;
|
|
152
152
|
fieldHeight?: "medium" | "small" | undefined;
|
|
153
|
-
triggerFieldReset?: boolean | undefined;
|
|
154
153
|
showSubmitError?: boolean | undefined;
|
|
155
154
|
associatedObject?: {
|
|
156
155
|
instanceId: string;
|
|
157
|
-
propertyId: string;
|
|
158
|
-
|
|
156
|
+
propertyId: string;
|
|
157
|
+
objectId?: string | undefined;
|
|
158
|
+
} | undefined;
|
|
159
159
|
form?: import("@evoke-platform/context").EvokeForm | undefined;
|
|
160
160
|
width: number;
|
|
161
161
|
};
|