This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
v0.17.0
- Update dependencies
- Adds AttachmentsField
- object type schemas with
attachment=true
render AttachmentsField and attach_id
properties to their appropriate section of formData- this randomly generated 10 character alphanumberic id is used to identify/match which field uploaded attachments should be assigned to.
// can place attachments property on any object type field
const schema = {
type: 'object',
attachments: true,
...
};
// accepted mime types can be applied using field specific ui:options
const uiSchema = {
'ui:options': {
accept: 'application/pdf, image/*',
},
};
newly generated formData example
const formData = {
section: {
firstName: 'Testy' // form field value
_id: asdfg12345 // field id
}
};
attachments uploaded through an `AttachmentsField` should carry the matching `_id` so that they may be displayed in their appropriate sections
New required formContext
properties:
const formContext = {
attachmentDestinationId, // i.e. EKID of access-request
onDrop,
onDeleteAttachment,
attachments,
formRef,
};
type OnDrop = (
file :Object,
attachmentDestinationId :UUID,
fieldId :string,
formData :Object,
) => void;
type OnDeleteAttachment = (
attachment :Object,
formData :Object
) => void;
type Attachment = {
date :string;
fieldId :string; // id of attachments field to inform render target
href :string;
id :UUID; // entity key id of file
name :string;
type :string;
};
type Attachments = {
[fieldId :string] :Attachment[];
}