π DataExporter - Exporting items, meta, or both β
Use DataExporter when users need to export data from your widget or table.
Quick start β
<template>
<DataExporter
:data="exportPayload"
:formats="['json', 'yaml']
filename="servers"
default-format="json"
/>
</template>
<script setup lang="ts">
import DataExporter from "@raclettejs/core/orchestrator/components/dataExport/DataExporter.vue"
const exportPayload = {
items: [
{ id: "1", name: "vm-1" },
{ id: "2", name: "vm-2" },
],
meta: {
generatedAt: new Date().toISOString(),
currency: "EUR",
},
}
</script>Canonical payload shape β
DataExporter expects this envelope:
{
items: unknown[]
meta?: unknown
}Data scope switch β
The exporter popover provides a data scope switch:
Combined-> exports{ items, meta? }Items-> exports only theitemsarrayMeta-> exports only themetaobject
This is useful when users want:
- just invoice line items (
items) - just configuration object (
meta) - full context (
combined)
Use with BaseDataTable β
BaseDataTable already wires DataExporter and emits the export envelope.
<BaseDataTable
:items="rows"
:exportable-items="rows"
item-value="id"
:show-filters="true"
:export-formats="['json', myCustomFormat]"
/>New table action model β
- Export selection checkboxes are shown only when export mode is enabled from the table actions menu.
- Import and filter controls are available from the actions menu.
- Active per-column filters are indicated in the header (
*suffix on the affected column title). - Create/Edit/Delete are intentionally not built in; implement those in consumer widgets via slots and
rowClickHandler.
Workbench action-layer pattern β
For Workbench plugins, keep routing/CUD behavior in a shared Workbench composable (for example useWorkbenchTableActions) instead of encoding it in BaseDataTable.
Typical usage:
<BaseDataTable
:items="rows"
:headers="headers"
:row-click-handler="(item) => goToEditById('myEditLink', item._id)"
>
<template #toolbar-end>
<v-btn @click="goToCreate('myCreateLink')">Create</v-btn>
</template>
<template #row-actions="{ item }">
<v-btn icon="mdi-delete" @click.stop.prevent="deleteRow(item)" />
</template>
</BaseDataTable>Important β
- Always set
item-valueto a real unique key in your row model (id,_id, ...). - If
item-valueis wrong, selected rows can map incorrectly. - Use
export-metawhen your serializers need contextual fields. - By default (
export-row-shape="visible-columns"), exported row fields are projected to the keys present inheaders. - Columns not present in
headersare not included in exported row objects. - The internal/system
actionscolumn is never exported. - Set
export-row-shape="full-records"to export matched rows as-is (see Workbench round-trip below).
Workbench round-trip (export + re-import) β
Workbench list widgets use one JSON format: a bare array of store records.
[
{ "_id": "β¦", "title": "β¦", "widgetsLayout": [ β¦ ] }
]<BaseDataTable
:items="displayRows"
:exportable-items="recordsFromStore(compositions)"
export-row-shape="full-records"
:export-show-data-scope-switch="false"
:on-file-loaded="handleFileUpload"
/>items: enriched rows for the table UI only.exportable-items:recordsFromStore(store)β raw documents, matched to selection by_id.export-row-shape="full-records": export full records, not visible table columns.export-show-data-scope-switch="false": JSON download is always the record array.
Import: @app/lib/workbenchListTransfer + useWorkbenchListImport.
Relevant BaseDataTable slots β
See the full BaseDataTable reference for props, slots, filters, and widget patterns.
exporter: replace or fully customise exporter rendering.importer: replace/augment import trigger rendering.action.export-mode: customise export-mode action entry.action.filters: customise filter action entry.action.import: customise import action entry.filters.drawer.header|body|footer: customise right-side filter drawer sections.
Built-in formats β
Built-ins serialize the selected scope payload as-is:
jsonyamlxml
So if users select Items, built-ins serialize just the array.
Troubleshooting β
Serializer says payload is invalid β
Your custom format likely validates only one shape. Make it support all relevant scope outputs (combined, items, optionally meta) or normalize input before rendering.
Export button disabled β
In BaseDataTable, export is disabled when no rows are selected.