Skip to main content

CnObjectFilesWidget

The files of one OpenRegister object: list, upload (button or drag and drop) and delete, through /apps/openregister/api/objects/{register}/{schema}/{id}/files.

On a manifest detail page a files widget mounts this instead of the placement-folder CnFilesWidget, which stays the dashboard widget. A consumer registry entry for files still wins. The register, schema and id come from the props, or from the loaded object's @self. Without an object id (a record not saved yet) upload is disabled and the widget says so.

An upload posts JSON { name, content } (content as a data URL) to the files endpoint; delete calls DELETE .../files/{fileId}.

Usage​

<CnObjectFilesWidget :object-data="pet" />

Props​

PropTypeDefaultDescription
registerString''Register slug or id. Empty: objectData['@self'].register.
schemaString''Schema slug or id. Empty: objectData['@self'].schema.
objectIdString, Number''Object id. Empty: objectData['@self'].id.
objectDataObject{}The loaded object; its @self supplies the context the props leave empty.
readOnlyBooleanfalseHide upload and delete.
apiBaseString/apps/openregister/api/objectsObject API base.
uploadLabelString"Upload file"Label of the upload button.

Events​

EventPayloadDescription
uploadedfile namesFiles were attached to the object.
deletedfile idA file was removed from the object.
errorErrorListing, uploading or deleting failed.

Slots​

None.