@conduction/nextcloud-vue 0.1.0-beta.11 → 0.1.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/nextcloud-vue.cjs +67614 -0
  2. package/dist/nextcloud-vue.cjs.js +13518 -13617
  3. package/dist/nextcloud-vue.cjs.js.map +1 -1
  4. package/dist/nextcloud-vue.cjs.map +1 -0
  5. package/dist/nextcloud-vue.css +1796 -1800
  6. package/dist/nextcloud-vue.esm.js +13518 -13617
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/package.json +3 -2
  9. package/src/components/CnActionsBar/CnActionsBar.vue +254 -254
  10. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -570
  11. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
  12. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
  13. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -422
  14. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
  15. package/src/components/CnCard/CnCard.vue +415 -415
  16. package/src/components/CnCardGrid/CnCardGrid.vue +156 -156
  17. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  18. package/src/components/CnChartWidget/CnChartWidget.vue +346 -346
  19. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  20. package/src/components/CnContextMenu/CnContextMenu.vue +142 -142
  21. package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -266
  22. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -229
  23. package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -397
  24. package/src/components/CnDataTable/CnDataTable.vue +362 -362
  25. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -177
  26. package/src/components/CnDetailCard/CnDetailCard.vue +225 -225
  27. package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -256
  28. package/src/components/CnDetailPage/CnDetailPage.vue +432 -432
  29. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -234
  30. package/src/components/CnFilterBar/CnFilterBar.vue +153 -153
  31. package/src/components/CnFormDialog/CnFormDialog.vue +1047 -1047
  32. package/src/components/CnIcon/CnIcon.vue +89 -89
  33. package/src/components/CnIndexPage/CnIndexPage.vue +981 -980
  34. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -536
  35. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -219
  36. package/src/components/CnItemCard/CnItemCard.vue +134 -134
  37. package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -312
  38. package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -93
  39. package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -161
  40. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -327
  41. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -245
  42. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -191
  43. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -494
  44. package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
  45. package/src/components/CnNotesCard/CnNotesCard.vue +416 -416
  46. package/src/components/CnObjectCard/CnObjectCard.vue +294 -294
  47. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -854
  48. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -289
  49. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -369
  50. package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -287
  51. package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -250
  52. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -255
  53. package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -259
  54. package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -483
  55. package/src/components/CnPageHeader/CnPageHeader.vue +61 -61
  56. package/src/components/CnPagination/CnPagination.vue +253 -253
  57. package/src/components/CnProgressBar/CnProgressBar.vue +262 -262
  58. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -793
  59. package/src/components/CnRowActions/CnRowActions.vue +95 -95
  60. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
  61. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -788
  62. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
  63. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
  64. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
  65. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  66. package/src/components/CnSettingsSection/CnSettingsSection.vue +267 -267
  67. package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -437
  68. package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -321
  69. package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -90
  70. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -545
  71. package/src/components/CnTableWidget/CnTableWidget.vue +333 -333
  72. package/src/components/CnTasksCard/CnTasksCard.vue +374 -374
  73. package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
  74. package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -294
  75. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -436
  76. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -313
  77. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
  78. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -248
@@ -1,327 +1,327 @@
1
- <template>
2
- <NcDialog
3
- :name="dialogTitle"
4
- size="normal"
5
- :can-close="!loading"
6
- @closing="$emit('close')">
7
- <!-- Review phase -->
8
- <div v-if="result === null" class="cn-mass-copy__review">
9
- <div class="cn-mass-copy__pattern">
10
- <label for="cn-mass-copy-pattern">{{ patternLabel }}</label>
11
- <NcSelect
12
- input-id="cn-mass-copy-pattern"
13
- :options="patternOptions"
14
- :value="selectedPattern"
15
- :clearable="false"
16
- @input="onPatternChange" />
17
- </div>
18
-
19
- <div class="cn-mass-copy__list">
20
- <div
21
- v-for="item in localItems"
22
- :key="item.id"
23
- class="cn-mass-copy__item">
24
- <div class="cn-mass-copy__item-names">
25
- <span class="cn-mass-copy__item-original">{{ getItemName(item) }}</span>
26
- <span class="cn-mass-copy__item-arrow">&rarr;</span>
27
- <span class="cn-mass-copy__item-new">{{ getNewName(item) }}</span>
28
- </div>
29
- <NcButton
30
- type="tertiary"
31
- :aria-label="removeLabel"
32
- @click="removeItem(item.id)">
33
- <template #icon>
34
- <Close :size="16" />
35
- </template>
36
- </NcButton>
37
- </div>
38
- </div>
39
-
40
- <p v-if="localItems.length === 0" class="cn-mass-copy__empty">
41
- {{ emptyText }}
42
- </p>
43
- </div>
44
-
45
- <!-- Result phase -->
46
- <div v-else class="cn-mass-copy__result">
47
- <NcNoteCard v-if="result.success" type="success">
48
- {{ successText }}
49
- </NcNoteCard>
50
- <NcNoteCard v-if="result.error" type="error">
51
- {{ result.error }}
52
- </NcNoteCard>
53
- </div>
54
-
55
- <template #actions>
56
- <NcButton @click="$emit('close')">
57
- {{ result === null ? cancelLabel : closeLabel }}
58
- </NcButton>
59
- <NcButton
60
- v-if="result === null"
61
- type="primary"
62
- :disabled="loading || localItems.length === 0"
63
- @click="executeCopy">
64
- <template #icon>
65
- <NcLoadingIcon v-if="loading" :size="20" />
66
- <ContentCopy v-else :size="20" />
67
- </template>
68
- {{ confirmLabel }}
69
- </NcButton>
70
- </template>
71
- </NcDialog>
72
- </template>
73
-
74
- <script>
75
- import { translate as t } from '@nextcloud/l10n'
76
- import { NcDialog, NcButton, NcNoteCard, NcLoadingIcon, NcSelect } from '@nextcloud/vue'
77
- import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'
78
- import Close from 'vue-material-design-icons/Close.vue'
79
-
80
- /**
81
- * CnMassCopyDialog — Two-phase mass copy confirmation dialog.
82
- *
83
- * Phase 1 (review): Shows the items to be copied with a naming pattern
84
- * selector and real-time preview of new names. Phase 2 (result): Shows
85
- * success or error.
86
- *
87
- * The dialog does NOT perform the copy itself — it emits a `confirm` event
88
- * with the items and naming function. The parent performs the actual API
89
- * call and calls `setResult()` via a ref.
90
- *
91
- * @example
92
- * <CnMassCopyDialog
93
- * v-if="showCopyDialog"
94
- * ref="copyDialog"
95
- * :items="selectedObjects"
96
- * :name-field="'title'"
97
- * @confirm="onCopyConfirm"
98
- * @close="showCopyDialog = false" />
99
- *
100
- * // In methods:
101
- * async onCopyConfirm({ ids, getName }) {
102
- * try {
103
- * for (const item of this.selectedObjects) {
104
- * await store.copyObject(item.id, { title: getName(item) })
105
- * }
106
- * this.$refs.copyDialog.setResult({ success: true })
107
- * } catch (e) {
108
- * this.$refs.copyDialog.setResult({ error: e.message })
109
- * }
110
- * }
111
- */
112
- export default {
113
- name: 'CnMassCopyDialog',
114
-
115
- components: {
116
- NcDialog,
117
- NcButton,
118
- NcNoteCard,
119
- NcLoadingIcon,
120
- NcSelect,
121
- ContentCopy,
122
- Close,
123
- },
124
-
125
- props: {
126
- /** Items to copy. Each must have an `id` property. */
127
- items: {
128
- type: Array,
129
- required: true,
130
- },
131
- /** Property name used for display (e.g., 'title', 'name') */
132
- nameField: {
133
- type: String,
134
- default: 'title',
135
- },
136
- /** Optional function to format the item name. Receives the item, returns a string. Overrides nameField when provided. */
137
- nameFormatter: {
138
- type: Function,
139
- default: null,
140
- },
141
- /** Dialog title */
142
- dialogTitle: {
143
- type: String,
144
- default: () => t('nextcloud-vue', 'Copy items'),
145
- },
146
- /** Label for the naming pattern selector */
147
- patternLabel: {
148
- type: String,
149
- default: () => t('nextcloud-vue', 'Naming pattern'),
150
- },
151
- /** Text when all items removed from list */
152
- emptyText: {
153
- type: String,
154
- default: () => t('nextcloud-vue', 'No items selected for copying.'),
155
- },
156
- /** Success message */
157
- successText: {
158
- type: String,
159
- default: () => t('nextcloud-vue', 'Items successfully copied.'),
160
- },
161
- cancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },
162
- closeLabel: { type: String, default: () => t('nextcloud-vue', 'Close') },
163
- confirmLabel: { type: String, default: () => t('nextcloud-vue', 'Copy') },
164
- removeLabel: { type: String, default: () => t('nextcloud-vue', 'Remove from list') },
165
- },
166
-
167
- data() {
168
- return {
169
- localItems: [...this.items],
170
- loading: false,
171
- result: null,
172
- closeTimeout: null,
173
- selectedPattern: { id: 'copy-of', label: 'Copy of {name}' },
174
- }
175
- },
176
-
177
- computed: {
178
- patternOptions() {
179
- return [
180
- { id: 'copy-of', label: 'Copy of {name}' },
181
- { id: 'name-copy', label: '{name} - Copy' },
182
- { id: 'name-parens', label: '{name} (Copy)' },
183
- ]
184
- },
185
- },
186
-
187
- watch: {
188
- items(val) {
189
- this.localItems = [...val]
190
- },
191
- },
192
-
193
- beforeDestroy() {
194
- if (this.closeTimeout) clearTimeout(this.closeTimeout)
195
- },
196
-
197
- methods: {
198
- getItemName(item) {
199
- if (this.nameFormatter) return this.nameFormatter(item)
200
- return item[this.nameField] || item.name || item.title || item.id
201
- },
202
-
203
- getNewName(item) {
204
- const name = this.getItemName(item)
205
- return this.applyPattern(name, this.selectedPattern.id)
206
- },
207
-
208
- applyPattern(name, patternId) {
209
- switch (patternId) {
210
- case 'copy-of':
211
- return `Copy of ${name}`
212
- case 'name-copy':
213
- return `${name} - Copy`
214
- case 'name-parens':
215
- return `${name} (Copy)`
216
- default:
217
- return `Copy of ${name}`
218
- }
219
- },
220
-
221
- onPatternChange(option) {
222
- this.selectedPattern = option
223
- },
224
-
225
- removeItem(id) {
226
- this.localItems = this.localItems.filter((i) => i.id !== id)
227
- },
228
-
229
- executeCopy() {
230
- this.loading = true
231
- const ids = this.localItems.map((i) => i.id)
232
- const patternId = this.selectedPattern.id
233
- /**
234
- * @event confirm Emitted when the user confirms copying.
235
- * Payload: { ids, getName } where getName(item) returns the new name.
236
- */
237
- this.$emit('confirm', {
238
- ids,
239
- getName: (item) => {
240
- const name = this.getItemName(item)
241
- return this.applyPattern(name, patternId)
242
- },
243
- })
244
- },
245
-
246
- /**
247
- * Set the result of the copy operation. Call this from the parent
248
- * after the API call completes.
249
- *
250
- * @param {{ success?: boolean, error?: string }} resultData - Result data to pass to the dialog
251
- * @public
252
- */
253
- setResult(resultData) {
254
- this.loading = false
255
- this.result = resultData
256
- if (resultData.success) {
257
- this.closeTimeout = setTimeout(() => {
258
- this.$emit('close')
259
- }, 2000)
260
- }
261
- },
262
- },
263
- }
264
- </script>
265
-
266
- <style scoped>
267
- .cn-mass-copy__pattern {
268
- margin-bottom: 16px;
269
- }
270
-
271
- .cn-mass-copy__pattern label {
272
- display: block;
273
- font-weight: 600;
274
- margin-bottom: 4px;
275
- }
276
-
277
- .cn-mass-copy__list {
278
- max-height: 300px;
279
- overflow-y: auto;
280
- }
281
-
282
- .cn-mass-copy__item {
283
- display: flex;
284
- align-items: center;
285
- justify-content: space-between;
286
- padding: 8px 12px;
287
- border-bottom: 1px solid var(--color-border);
288
- }
289
-
290
- .cn-mass-copy__item:last-child {
291
- border-bottom: none;
292
- }
293
-
294
- .cn-mass-copy__item-names {
295
- display: flex;
296
- align-items: center;
297
- gap: 8px;
298
- overflow: hidden;
299
- flex: 1;
300
- }
301
-
302
- .cn-mass-copy__item-original {
303
- color: var(--color-text-maxcontrast);
304
- overflow: hidden;
305
- text-overflow: ellipsis;
306
- white-space: nowrap;
307
- }
308
-
309
- .cn-mass-copy__item-arrow {
310
- flex-shrink: 0;
311
- color: var(--color-text-maxcontrast);
312
- }
313
-
314
- .cn-mass-copy__item-new {
315
- font-weight: 500;
316
- overflow: hidden;
317
- text-overflow: ellipsis;
318
- white-space: nowrap;
319
- }
320
-
321
- .cn-mass-copy__empty {
322
- text-align: center;
323
- color: var(--color-text-maxcontrast);
324
- font-style: italic;
325
- padding: 20px;
326
- }
327
- </style>
1
+ <template>
2
+ <NcDialog
3
+ :name="dialogTitle"
4
+ size="normal"
5
+ :can-close="!loading"
6
+ @closing="$emit('close')">
7
+ <!-- Review phase -->
8
+ <div v-if="result === null" class="cn-mass-copy__review">
9
+ <div class="cn-mass-copy__pattern">
10
+ <label for="cn-mass-copy-pattern">{{ patternLabel }}</label>
11
+ <NcSelect
12
+ input-id="cn-mass-copy-pattern"
13
+ :options="patternOptions"
14
+ :value="selectedPattern"
15
+ :clearable="false"
16
+ @input="onPatternChange" />
17
+ </div>
18
+
19
+ <div class="cn-mass-copy__list">
20
+ <div
21
+ v-for="item in localItems"
22
+ :key="item.id"
23
+ class="cn-mass-copy__item">
24
+ <div class="cn-mass-copy__item-names">
25
+ <span class="cn-mass-copy__item-original">{{ getItemName(item) }}</span>
26
+ <span class="cn-mass-copy__item-arrow">&rarr;</span>
27
+ <span class="cn-mass-copy__item-new">{{ getNewName(item) }}</span>
28
+ </div>
29
+ <NcButton
30
+ type="tertiary"
31
+ :aria-label="removeLabel"
32
+ @click="removeItem(item.id)">
33
+ <template #icon>
34
+ <Close :size="16" />
35
+ </template>
36
+ </NcButton>
37
+ </div>
38
+ </div>
39
+
40
+ <p v-if="localItems.length === 0" class="cn-mass-copy__empty">
41
+ {{ emptyText }}
42
+ </p>
43
+ </div>
44
+
45
+ <!-- Result phase -->
46
+ <div v-else class="cn-mass-copy__result">
47
+ <NcNoteCard v-if="result.success" type="success">
48
+ {{ successText }}
49
+ </NcNoteCard>
50
+ <NcNoteCard v-if="result.error" type="error">
51
+ {{ result.error }}
52
+ </NcNoteCard>
53
+ </div>
54
+
55
+ <template #actions>
56
+ <NcButton @click="$emit('close')">
57
+ {{ result === null ? cancelLabel : closeLabel }}
58
+ </NcButton>
59
+ <NcButton
60
+ v-if="result === null"
61
+ type="primary"
62
+ :disabled="loading || localItems.length === 0"
63
+ @click="executeCopy">
64
+ <template #icon>
65
+ <NcLoadingIcon v-if="loading" :size="20" />
66
+ <ContentCopy v-else :size="20" />
67
+ </template>
68
+ {{ confirmLabel }}
69
+ </NcButton>
70
+ </template>
71
+ </NcDialog>
72
+ </template>
73
+
74
+ <script>
75
+ import { translate as t } from '@nextcloud/l10n'
76
+ import { NcDialog, NcButton, NcNoteCard, NcLoadingIcon, NcSelect } from '@nextcloud/vue'
77
+ import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'
78
+ import Close from 'vue-material-design-icons/Close.vue'
79
+
80
+ /**
81
+ * CnMassCopyDialog — Two-phase mass copy confirmation dialog.
82
+ *
83
+ * Phase 1 (review): Shows the items to be copied with a naming pattern
84
+ * selector and real-time preview of new names. Phase 2 (result): Shows
85
+ * success or error.
86
+ *
87
+ * The dialog does NOT perform the copy itself — it emits a `confirm` event
88
+ * with the items and naming function. The parent performs the actual API
89
+ * call and calls `setResult()` via a ref.
90
+ *
91
+ * @example
92
+ * <CnMassCopyDialog
93
+ * v-if="showCopyDialog"
94
+ * ref="copyDialog"
95
+ * :items="selectedObjects"
96
+ * :name-field="'title'"
97
+ * @confirm="onCopyConfirm"
98
+ * @close="showCopyDialog = false" />
99
+ *
100
+ * // In methods:
101
+ * async onCopyConfirm({ ids, getName }) {
102
+ * try {
103
+ * for (const item of this.selectedObjects) {
104
+ * await store.copyObject(item.id, { title: getName(item) })
105
+ * }
106
+ * this.$refs.copyDialog.setResult({ success: true })
107
+ * } catch (e) {
108
+ * this.$refs.copyDialog.setResult({ error: e.message })
109
+ * }
110
+ * }
111
+ */
112
+ export default {
113
+ name: 'CnMassCopyDialog',
114
+
115
+ components: {
116
+ NcDialog,
117
+ NcButton,
118
+ NcNoteCard,
119
+ NcLoadingIcon,
120
+ NcSelect,
121
+ ContentCopy,
122
+ Close,
123
+ },
124
+
125
+ props: {
126
+ /** Items to copy. Each must have an `id` property. */
127
+ items: {
128
+ type: Array,
129
+ required: true,
130
+ },
131
+ /** Property name used for display (e.g., 'title', 'name') */
132
+ nameField: {
133
+ type: String,
134
+ default: 'title',
135
+ },
136
+ /** Optional function to format the item name. Receives the item, returns a string. Overrides nameField when provided. */
137
+ nameFormatter: {
138
+ type: Function,
139
+ default: null,
140
+ },
141
+ /** Dialog title */
142
+ dialogTitle: {
143
+ type: String,
144
+ default: () => t('nextcloud-vue', 'Copy items'),
145
+ },
146
+ /** Label for the naming pattern selector */
147
+ patternLabel: {
148
+ type: String,
149
+ default: () => t('nextcloud-vue', 'Naming pattern'),
150
+ },
151
+ /** Text when all items removed from list */
152
+ emptyText: {
153
+ type: String,
154
+ default: () => t('nextcloud-vue', 'No items selected for copying.'),
155
+ },
156
+ /** Success message */
157
+ successText: {
158
+ type: String,
159
+ default: () => t('nextcloud-vue', 'Items successfully copied.'),
160
+ },
161
+ cancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },
162
+ closeLabel: { type: String, default: () => t('nextcloud-vue', 'Close') },
163
+ confirmLabel: { type: String, default: () => t('nextcloud-vue', 'Copy') },
164
+ removeLabel: { type: String, default: () => t('nextcloud-vue', 'Remove from list') },
165
+ },
166
+
167
+ data() {
168
+ return {
169
+ localItems: [...this.items],
170
+ loading: false,
171
+ result: null,
172
+ closeTimeout: null,
173
+ selectedPattern: { id: 'copy-of', label: 'Copy of {name}' },
174
+ }
175
+ },
176
+
177
+ computed: {
178
+ patternOptions() {
179
+ return [
180
+ { id: 'copy-of', label: 'Copy of {name}' },
181
+ { id: 'name-copy', label: '{name} - Copy' },
182
+ { id: 'name-parens', label: '{name} (Copy)' },
183
+ ]
184
+ },
185
+ },
186
+
187
+ watch: {
188
+ items(val) {
189
+ this.localItems = [...val]
190
+ },
191
+ },
192
+
193
+ beforeDestroy() {
194
+ if (this.closeTimeout) clearTimeout(this.closeTimeout)
195
+ },
196
+
197
+ methods: {
198
+ getItemName(item) {
199
+ if (this.nameFormatter) return this.nameFormatter(item)
200
+ return item[this.nameField] || item.name || item.title || item.id
201
+ },
202
+
203
+ getNewName(item) {
204
+ const name = this.getItemName(item)
205
+ return this.applyPattern(name, this.selectedPattern.id)
206
+ },
207
+
208
+ applyPattern(name, patternId) {
209
+ switch (patternId) {
210
+ case 'copy-of':
211
+ return `Copy of ${name}`
212
+ case 'name-copy':
213
+ return `${name} - Copy`
214
+ case 'name-parens':
215
+ return `${name} (Copy)`
216
+ default:
217
+ return `Copy of ${name}`
218
+ }
219
+ },
220
+
221
+ onPatternChange(option) {
222
+ this.selectedPattern = option
223
+ },
224
+
225
+ removeItem(id) {
226
+ this.localItems = this.localItems.filter((i) => i.id !== id)
227
+ },
228
+
229
+ executeCopy() {
230
+ this.loading = true
231
+ const ids = this.localItems.map((i) => i.id)
232
+ const patternId = this.selectedPattern.id
233
+ /**
234
+ * @event confirm Emitted when the user confirms copying.
235
+ * Payload: { ids, getName } where getName(item) returns the new name.
236
+ */
237
+ this.$emit('confirm', {
238
+ ids,
239
+ getName: (item) => {
240
+ const name = this.getItemName(item)
241
+ return this.applyPattern(name, patternId)
242
+ },
243
+ })
244
+ },
245
+
246
+ /**
247
+ * Set the result of the copy operation. Call this from the parent
248
+ * after the API call completes.
249
+ *
250
+ * @param {{ success?: boolean, error?: string }} resultData - Result data to pass to the dialog
251
+ * @public
252
+ */
253
+ setResult(resultData) {
254
+ this.loading = false
255
+ this.result = resultData
256
+ if (resultData.success) {
257
+ this.closeTimeout = setTimeout(() => {
258
+ this.$emit('close')
259
+ }, 2000)
260
+ }
261
+ },
262
+ },
263
+ }
264
+ </script>
265
+
266
+ <style scoped>
267
+ .cn-mass-copy__pattern {
268
+ margin-bottom: 16px;
269
+ }
270
+
271
+ .cn-mass-copy__pattern label {
272
+ display: block;
273
+ font-weight: 600;
274
+ margin-bottom: 4px;
275
+ }
276
+
277
+ .cn-mass-copy__list {
278
+ max-height: 300px;
279
+ overflow-y: auto;
280
+ }
281
+
282
+ .cn-mass-copy__item {
283
+ display: flex;
284
+ align-items: center;
285
+ justify-content: space-between;
286
+ padding: 8px 12px;
287
+ border-bottom: 1px solid var(--color-border);
288
+ }
289
+
290
+ .cn-mass-copy__item:last-child {
291
+ border-bottom: none;
292
+ }
293
+
294
+ .cn-mass-copy__item-names {
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 8px;
298
+ overflow: hidden;
299
+ flex: 1;
300
+ }
301
+
302
+ .cn-mass-copy__item-original {
303
+ color: var(--color-text-maxcontrast);
304
+ overflow: hidden;
305
+ text-overflow: ellipsis;
306
+ white-space: nowrap;
307
+ }
308
+
309
+ .cn-mass-copy__item-arrow {
310
+ flex-shrink: 0;
311
+ color: var(--color-text-maxcontrast);
312
+ }
313
+
314
+ .cn-mass-copy__item-new {
315
+ font-weight: 500;
316
+ overflow: hidden;
317
+ text-overflow: ellipsis;
318
+ white-space: nowrap;
319
+ }
320
+
321
+ .cn-mass-copy__empty {
322
+ text-align: center;
323
+ color: var(--color-text-maxcontrast);
324
+ font-style: italic;
325
+ padding: 20px;
326
+ }
327
+ </style>