Ga naar hoofdinhoud

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.
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, pattern \}Copy confirmed
closeDialog closed

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.

Props

NameTypeRequiredDefaultDescription
itemsarrayItems 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')
closeLabelstring() =&gt; t('nextcloud-vue', 'Close')
confirmLabelstring() =&gt; t('nextcloud-vue', 'Copy')
removeLabelstring() =&gt; t('nextcloud-vue', 'Remove from list')

Events

NamePayloadDescription
close
confirmEmitted when the user confirms copying. Payload: { ids, getName } where getName(item) returns the new name.

Methods

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