CnCopyDialog
Two-phase single-item copy dialog with naming pattern selector. User picks a naming pattern, confirms, then sees success or error.
Try it
Wraps: NcDialog, NcButton, NcNoteCard, NcSelect

Props
| Prop | Type | Default | Description |
|---|---|---|---|
item | Object | (required) | Item to copy |
nameField | String | 'title' | Field used as display name |
nameFormatter | Function | null | Optional function (item) => string to format the display name. Overrides nameField when provided. |
include | Array | [] | Link kinds a copy may take along, from the page's config.copy.include: relationRows, incoming, files. Each is listed with its linked items and a count, ticked by default. Empty keeps the dialog as it was. |
register | String | '' | Register slug of the item, for reading its links. Empty: the item's @self.register. |
schema | String | '' | Schema slug of the item. Empty: the item's @self.schema. |
dialogTitle | String | 'Copy Item' | |
patternLabel | String | 'Naming pattern' | |
successText | String | 'Item successfully copied.' | |
cancelLabel | String | ||
closeLabel | String | ||
confirmLabel | String |
Naming Patterns
| Pattern | Example |
|---|---|
copy-of | Copy of Contact A |
name-copy | Contact A - Copy |
name-parens | Contact A (Copy) |
Events
| Event | Payload | Description |
|---|---|---|
confirm | \{ id, newName, include? \} | Copy confirmed; include holds the ticked link kinds, only when the page lists links and the server can copy them |
close | — | Dialog closed |
Copying with links
When the page declares config.copy.include, the form phase lists, per included kind, what the item is linked to: Used by (objects that point at it), Connections (relation rows) and Files, each with its count, the first ten titles, and a checkbox ticked by default. A kind the page does not include is not listed. A page without copy.include shows the dialog exactly as before.
The copy itself is one request to OpenRegister's copy endpoint, made by the host (CnIndexPage does it): it creates the new object and its links together, so a failure leaves no half-linked copy. Call setResult({ success, url, links }) with the per-link outcome the server returned; links with ok: false are listed with their reason, and url adds a link to the new object. A single-valued reference on another object is never moved to the copy.
Where the server has no copy endpoint (404 or 405), or the item's register and schema are not known, the list stays read-only with the note "Links are not copied yet. Only the fields are copied." and the copy carries the fields only.
Public Methods
| Method | Description |
|---|---|
setResult(\{ success?, error? \}) | Set operation result |
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 item</button>
<CnCopyDialog
v-if="open"
ref="dlg"
:item="{ id: 1, title: 'Annual Report 2024' }"
@confirm="onConfirm"
@close="open = false" />
</div>
</template>
<script>
export default {
data() { return { open: false } },
methods: {
async onConfirm({ id, newName }) {
await new Promise(r => setTimeout(r, 800))
this.$refs.dlg.setResult({ success: true })
},
},
}
</script>
Reference (auto-generated)
The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnCopyDialog.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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
item | object | ✓ | — | The item to copy. Must have an id property. |
nameField | string | 'title' | Property name used for display (e.g., 'title', 'name') | |
nameFormatter | func | null | Optional function to format the item name. Receives the item, returns a string. Overrides nameField when provided. | |
dialogTitle | string | () => t('nextcloud-vue', 'Copy item') | Dialog title | |
patternLabel | string | () => t('nextcloud-vue', 'Naming pattern') | Label for the naming pattern selector | |
successText | string | () => t('nextcloud-vue', 'Item successfully copied.') | Success message | |
include | Array<'relationRows'|'incoming'|'files'> | [] | Link kinds a copy may take along, from the page's config.copy.include: relationRows, incoming, files. Each is listed with its linked items and ticked by default. Empty keeps the dialog as it was. | |
register | string | '' | Register slug of the item, for reading its links. Empty: the item's @self.register. | |
schema | string | '' | Schema slug of the item, for reading its links. Empty: the item's @self.schema. | |
cancelLabel | string | () => t('nextcloud-vue', 'Cancel') | Label for the cancel button (visible before the copy runs). | |
closeLabel | string | () => t('nextcloud-vue', 'Close') | Label for the close button (visible after copy completes). | |
confirmLabel | string | () => t('nextcloud-vue', 'Copy') | Label for the primary confirm button that triggers the copy. |
Events
| Name | Payload | Description |
|---|---|---|
close | — | |
confirm | — |
Methods
| Name | Description |
|---|---|
setResult | Set the result of the copy operation. Call this from the parent after the API call completes. |