Skip to main content

CnMassCopyDialog

Two-phase mass copy dialog with naming pattern. Allows users to define a naming pattern for copied items.

Try it​

Loading CnMassCopyDialog playground…

Wraps: NcDialog, NcButton, NcTextField

CnMassCopyDialog showing bulk copy with naming pattern and item list

Props​

PropTypeDefaultDescription
itemsArray[]Items to copy ([\{ id, name \}])
nameFieldString'title'Field to display as item name
nameFormatterFunctionnullOptional function (item) => string to format item names. Overrides nameField when provided.
includeArray[]Link kinds a copy may take along (relationRows, incoming, files), from the page's config.copy.include. Each is offered ticked; the dialog shows the kinds, not every row's links. Empty keeps the dialog as it was.
registerString''Register slug of the items, for checking the server can copy links. Empty: the first item's @self.register.
schemaString''Schema slug of the items. Empty: the first item's @self.schema.
dialogTitleString'Copy items'
patternLabelString'Naming pattern'
patternPlaceholderString'\{name\} (copy)'
emptyTextString'No items selected for copying.'Message shown when all items have been removed from the list
successTextString'Items successfully copied.'Message shown in the result phase on success
cancelLabelString'Cancel'
closeLabelString'Close'Label for the close button shown in the result phase
confirmLabelString'Copy'
removeLabelString'Remove from list'Tooltip/label for the per-item remove button

Events​

EventPayloadDescription
confirm\{ ids, getName, include? \}Copy confirmed; include holds the ticked link kinds, only when the page lists links and the server can copy them
close—Dialog closed

With include the dialog adds a Links to take along section: the included kinds, ticked, one checkbox each. Each row is copied with one request to OpenRegister's copy endpoint carrying the same kinds, and the result lists the links the server refused, with their reason. Without the endpoint the section is read-only with a note and the copy carries the fields only. See CnCopyDialog.

Public Methods​

MethodDescription
setResult(\{ success?, error?, results? \})Set result per item

Live demo​

<template>
<div>
<button @click="open = true" style="padding: 6px 16px; border-radius: 4px; background: var(--color-primary-element); color: white; border: none; cursor: pointer;">Copy selected (2)</button>
<CnMassCopyDialog
v-if="open"
ref="dlg"
:items="[{ id: 1, title: 'Report A' }, { id: 2, title: 'Report B' }]"
@confirm="onConfirm"
@close="open = false" />
</div>
</template>
<script>
export default {
data() { return { open: false } },
methods: {
async onConfirm(payload) {
await new Promise(r => setTimeout(r, 800))
this.$refs.dlg.setResult({ success: true })
},
},
}
</script>

Usage​

<CnMassCopyDialog
ref="massCopyDialog"
:items="selectedItems"
@confirm="onMassCopy"
@close="showMassCopy = false" />

Reference (auto-generated)​

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnMassCopyDialog.vue and update automatically whenever the component changes.

OpenRegister reliance​

light: this component touches OpenRegister lightly. 0 direct references, 1 file reached through imports.

See the reliance overview for the filterable list.

Props​

NameTypeRequiredDefaultDescription
includeArray<'relationRows'&#124;'incoming'&#124;'files'>[]Link kinds a copy may take along, from the page's config.copy.include (relationRows, incoming, files). Each is offered ticked. Empty keeps the dialog as it was.
registerstring''Register slug of the items, for checking the server can copy links. Empty: the first item's @self.register.
schemastring''Schema slug of the items. Empty: the first item's @self.schema.
itemsarray✓—Items to copy. Each must have an id property.
nameFieldstring'title'Property name used for display (e.g., 'title', 'name')
nameFormatterfuncnullOptional function to format the item name. Receives the item, returns a string. Overrides nameField when provided.
dialogTitlestring() =&gt; t('nextcloud-vue', 'Copy items')Dialog title
patternLabelstring() =&gt; t('nextcloud-vue', 'Naming pattern')Label for the naming pattern selector
emptyTextstring() =&gt; t('nextcloud-vue', 'No items selected for copying.')Text when all items removed from list
successTextstring() =&gt; t('nextcloud-vue', 'Items successfully copied.')Success message
cancelLabelstring() =&gt; t('nextcloud-vue', 'Cancel')Label for the cancel button (visible before the copy runs).
closeLabelstring() =&gt; t('nextcloud-vue', 'Close')Label for the close button (visible after copy completes).
confirmLabelstring() =&gt; t('nextcloud-vue', 'Copy')Label for the primary confirm button that triggers the copy.
removeLabelstring() =&gt; t('nextcloud-vue', 'Remove from list')Aria label for the per-row "remove from list" icon button.

Events​

NamePayloadDescription
close—Emitted when the dialog should close (cancel, close button, or auto-close after success).
confirm—Emitted when the user confirms copying. Payload: { ids, getName, include? } where getName(item) returns the new name and include lists the ticked link kinds.

Methods​

NameDescription
setResultSet the result of the copy operation. Call this from the parent after the API call completes.