@conduction/nextcloud-vue 0.1.0-beta.4 → 0.1.0-beta.6
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.
- package/dist/nextcloud-vue.cjs +67614 -0
- package/dist/nextcloud-vue.cjs.js +9559 -8983
- package/dist/nextcloud-vue.cjs.js.map +1 -1
- package/dist/nextcloud-vue.cjs.map +1 -0
- package/dist/nextcloud-vue.css +1231 -1231
- package/dist/nextcloud-vue.esm.js +9559 -8983
- package/dist/nextcloud-vue.esm.js.map +1 -1
- package/package.json +14 -5
- package/src/components/CnActionsBar/CnActionsBar.vue +235 -235
- package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -579
- package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
- package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
- package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -418
- package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
- package/src/components/CnCardGrid/CnCardGrid.vue +152 -152
- package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
- package/src/components/CnChartWidget/CnChartWidget.vue +320 -320
- package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
- package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -250
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -225
- package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -390
- package/src/components/CnDataTable/CnDataTable.vue +349 -349
- package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -170
- package/src/components/CnDetailCard/CnDetailCard.vue +214 -214
- package/src/components/CnDetailPage/CnDetailPage.vue +285 -281
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +231 -231
- package/src/components/CnFilterBar/CnFilterBar.vue +152 -152
- package/src/components/CnFormDialog/CnFormDialog.vue +302 -11
- package/src/components/CnIcon/CnIcon.vue +89 -89
- package/src/components/CnIndexPage/CnIndexPage.vue +884 -874
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +503 -503
- package/src/components/CnItemCard/CnItemCard.vue +132 -132
- package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -89
- package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -160
- package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -320
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -238
- package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -190
- package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -491
- package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
- package/src/components/CnNotesCard/CnNotesCard.vue +413 -413
- package/src/components/CnObjectCard/CnObjectCard.vue +292 -292
- package/src/components/CnObjectCard/eslint-setup.md +235 -0
- package/src/components/CnObjectCard/package.json-or.json +132 -0
- package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -876
- package/src/components/CnPageHeader/CnPageHeader.vue +57 -57
- package/src/components/CnPagination/CnPagination.vue +252 -252
- package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -792
- package/src/components/CnRowActions/CnRowActions.vue +95 -73
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -787
- package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
- package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
- package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
- package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
- package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -266
- package/src/components/CnStatsBlock/CnStatsBlock.vue +420 -420
- package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -77
- package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -540
- package/src/components/CnTasksCard/CnTasksCard.vue +373 -373
- package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
- package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -292
- package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -435
- package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -312
- package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
- package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -211
- package/src/index.js +1 -1
- package/src/types/notification.d.ts +13 -13
- package/src/types/organisation.d.ts +15 -15
- package/src/types/schema.d.ts +13 -13
- package/src/types/task.d.ts +6 -6
- package/src/utils/headers.js +5 -3
|
@@ -1,238 +1,238 @@
|
|
|
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-delete__review">
|
|
9
|
-
<NcNoteCard type="warning">
|
|
10
|
-
{{ warningText }}
|
|
11
|
-
</NcNoteCard>
|
|
12
|
-
|
|
13
|
-
<div class="cn-mass-delete__list">
|
|
14
|
-
<div
|
|
15
|
-
v-for="item in localItems"
|
|
16
|
-
:key="item.id"
|
|
17
|
-
class="cn-mass-delete__item">
|
|
18
|
-
<span class="cn-mass-delete__item-name">
|
|
19
|
-
{{ getItemName(item) }}
|
|
20
|
-
</span>
|
|
21
|
-
<NcButton
|
|
22
|
-
type="tertiary"
|
|
23
|
-
:aria-label="removeLabel"
|
|
24
|
-
@click="removeItem(item.id)">
|
|
25
|
-
<template #icon>
|
|
26
|
-
<Close :size="16" />
|
|
27
|
-
</template>
|
|
28
|
-
</NcButton>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<p v-if="localItems.length === 0" class="cn-mass-delete__empty">
|
|
33
|
-
{{ emptyText }}
|
|
34
|
-
</p>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<!-- Result phase -->
|
|
38
|
-
<div v-else class="cn-mass-delete__result">
|
|
39
|
-
<NcNoteCard v-if="result.success" type="success">
|
|
40
|
-
{{ successText }}
|
|
41
|
-
</NcNoteCard>
|
|
42
|
-
<NcNoteCard v-if="result.error" type="error">
|
|
43
|
-
{{ result.error }}
|
|
44
|
-
</NcNoteCard>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<template #actions>
|
|
48
|
-
<NcButton @click="$emit('close')">
|
|
49
|
-
{{ result === null ? cancelLabel : closeLabel }}
|
|
50
|
-
</NcButton>
|
|
51
|
-
<NcButton
|
|
52
|
-
v-if="result === null"
|
|
53
|
-
type="error"
|
|
54
|
-
:disabled="loading || localItems.length === 0"
|
|
55
|
-
@click="executeDelete">
|
|
56
|
-
<template #icon>
|
|
57
|
-
<NcLoadingIcon v-if="loading" :size="20" />
|
|
58
|
-
<TrashCanOutline v-else :size="20" />
|
|
59
|
-
</template>
|
|
60
|
-
{{ confirmLabel }}
|
|
61
|
-
</NcButton>
|
|
62
|
-
</template>
|
|
63
|
-
</NcDialog>
|
|
64
|
-
</template>
|
|
65
|
-
|
|
66
|
-
<script>
|
|
67
|
-
import { NcDialog, NcButton, NcNoteCard, NcLoadingIcon } from '@nextcloud/vue'
|
|
68
|
-
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
|
|
69
|
-
import Close from 'vue-material-design-icons/Close.vue'
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* CnMassDeleteDialog — Two-phase mass delete confirmation dialog.
|
|
73
|
-
*
|
|
74
|
-
* Phase 1 (review): Shows the items to be deleted with the ability to remove
|
|
75
|
-
* individual items before confirming. Phase 2 (result): Shows success or error.
|
|
76
|
-
*
|
|
77
|
-
* The dialog does NOT perform the delete itself — it emits a `confirm` event
|
|
78
|
-
* with the item IDs. The parent component performs the actual API call and
|
|
79
|
-
* calls `setResult()` via a ref.
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* <CnMassDeleteDialog
|
|
83
|
-
* v-if="showDeleteDialog"
|
|
84
|
-
* :items="selectedObjects"
|
|
85
|
-
* :name-field="'title'"
|
|
86
|
-
* @confirm="onDeleteConfirm"
|
|
87
|
-
* @close="showDeleteDialog = false" />
|
|
88
|
-
*
|
|
89
|
-
* // In methods:
|
|
90
|
-
* async onDeleteConfirm(ids) {
|
|
91
|
-
* try {
|
|
92
|
-
* await store.massDelete(ids)
|
|
93
|
-
* this.$refs.deleteDialog.setResult({ success: true })
|
|
94
|
-
* } catch (e) {
|
|
95
|
-
* this.$refs.deleteDialog.setResult({ error: e.message })
|
|
96
|
-
* }
|
|
97
|
-
* }
|
|
98
|
-
*/
|
|
99
|
-
export default {
|
|
100
|
-
name: 'CnMassDeleteDialog',
|
|
101
|
-
|
|
102
|
-
components: {
|
|
103
|
-
NcDialog,
|
|
104
|
-
NcButton,
|
|
105
|
-
NcNoteCard,
|
|
106
|
-
NcLoadingIcon,
|
|
107
|
-
TrashCanOutline,
|
|
108
|
-
Close,
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
props: {
|
|
112
|
-
/** Items to delete. Each must have an `id` property. */
|
|
113
|
-
items: {
|
|
114
|
-
type: Array,
|
|
115
|
-
required: true,
|
|
116
|
-
},
|
|
117
|
-
/** Property name used for display (e.g., 'title', 'name') */
|
|
118
|
-
nameField: {
|
|
119
|
-
type: String,
|
|
120
|
-
default: 'title',
|
|
121
|
-
},
|
|
122
|
-
/** Dialog title */
|
|
123
|
-
dialogTitle: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: 'Delete Items',
|
|
126
|
-
},
|
|
127
|
-
/** Warning text shown above the item list */
|
|
128
|
-
warningText: {
|
|
129
|
-
type: String,
|
|
130
|
-
default: 'The following items will be permanently deleted. Remove any items you want to keep.',
|
|
131
|
-
},
|
|
132
|
-
/** Text when all items removed from list */
|
|
133
|
-
emptyText: {
|
|
134
|
-
type: String,
|
|
135
|
-
default: 'No items selected for deletion.',
|
|
136
|
-
},
|
|
137
|
-
/** Success message */
|
|
138
|
-
successText: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: 'Items successfully deleted.',
|
|
141
|
-
},
|
|
142
|
-
cancelLabel: { type: String, default: 'Cancel' },
|
|
143
|
-
closeLabel: { type: String, default: 'Close' },
|
|
144
|
-
confirmLabel: { type: String, default: 'Delete' },
|
|
145
|
-
removeLabel: { type: String, default: 'Remove from list' },
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
data() {
|
|
149
|
-
return {
|
|
150
|
-
localItems: [...this.items],
|
|
151
|
-
loading: false,
|
|
152
|
-
result: null,
|
|
153
|
-
closeTimeout: null,
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
watch: {
|
|
158
|
-
items(val) {
|
|
159
|
-
this.localItems = [...val]
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
beforeDestroy() {
|
|
164
|
-
if (this.closeTimeout) clearTimeout(this.closeTimeout)
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
methods: {
|
|
168
|
-
getItemName(item) {
|
|
169
|
-
return item[this.nameField] || item.name || item.title || item.id
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
removeItem(id) {
|
|
173
|
-
this.localItems = this.localItems.filter((i) => i.id !== id)
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
executeDelete() {
|
|
177
|
-
this.loading = true
|
|
178
|
-
const ids = this.localItems.map((i) => i.id)
|
|
179
|
-
/**
|
|
180
|
-
* @event confirm Emitted when the user confirms deletion.
|
|
181
|
-
* Payload: array of item IDs to delete.
|
|
182
|
-
*/
|
|
183
|
-
this.$emit('confirm', ids)
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Set the result of the delete operation. Call this from the parent
|
|
188
|
-
* after the API call completes.
|
|
189
|
-
*
|
|
190
|
-
* @param {{ success?: boolean, error?: string }} resultData
|
|
191
|
-
* @public
|
|
192
|
-
*/
|
|
193
|
-
setResult(resultData) {
|
|
194
|
-
this.loading = false
|
|
195
|
-
this.result = resultData
|
|
196
|
-
if (resultData.success) {
|
|
197
|
-
this.closeTimeout = setTimeout(() => {
|
|
198
|
-
this.$emit('close')
|
|
199
|
-
}, 2000)
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
}
|
|
204
|
-
</script>
|
|
205
|
-
|
|
206
|
-
<style scoped>
|
|
207
|
-
.cn-mass-delete__list {
|
|
208
|
-
max-height: 300px;
|
|
209
|
-
overflow-y: auto;
|
|
210
|
-
margin-top: 12px;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.cn-mass-delete__item {
|
|
214
|
-
display: flex;
|
|
215
|
-
align-items: center;
|
|
216
|
-
justify-content: space-between;
|
|
217
|
-
padding: 8px 12px;
|
|
218
|
-
border-bottom: 1px solid var(--color-border);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.cn-mass-delete__item:last-child {
|
|
222
|
-
border-bottom: none;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.cn-mass-delete__item-name {
|
|
226
|
-
font-weight: 500;
|
|
227
|
-
overflow: hidden;
|
|
228
|
-
text-overflow: ellipsis;
|
|
229
|
-
white-space: nowrap;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.cn-mass-delete__empty {
|
|
233
|
-
text-align: center;
|
|
234
|
-
color: var(--color-text-maxcontrast);
|
|
235
|
-
font-style: italic;
|
|
236
|
-
padding: 20px;
|
|
237
|
-
}
|
|
238
|
-
</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-delete__review">
|
|
9
|
+
<NcNoteCard type="warning">
|
|
10
|
+
{{ warningText }}
|
|
11
|
+
</NcNoteCard>
|
|
12
|
+
|
|
13
|
+
<div class="cn-mass-delete__list">
|
|
14
|
+
<div
|
|
15
|
+
v-for="item in localItems"
|
|
16
|
+
:key="item.id"
|
|
17
|
+
class="cn-mass-delete__item">
|
|
18
|
+
<span class="cn-mass-delete__item-name">
|
|
19
|
+
{{ getItemName(item) }}
|
|
20
|
+
</span>
|
|
21
|
+
<NcButton
|
|
22
|
+
type="tertiary"
|
|
23
|
+
:aria-label="removeLabel"
|
|
24
|
+
@click="removeItem(item.id)">
|
|
25
|
+
<template #icon>
|
|
26
|
+
<Close :size="16" />
|
|
27
|
+
</template>
|
|
28
|
+
</NcButton>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<p v-if="localItems.length === 0" class="cn-mass-delete__empty">
|
|
33
|
+
{{ emptyText }}
|
|
34
|
+
</p>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<!-- Result phase -->
|
|
38
|
+
<div v-else class="cn-mass-delete__result">
|
|
39
|
+
<NcNoteCard v-if="result.success" type="success">
|
|
40
|
+
{{ successText }}
|
|
41
|
+
</NcNoteCard>
|
|
42
|
+
<NcNoteCard v-if="result.error" type="error">
|
|
43
|
+
{{ result.error }}
|
|
44
|
+
</NcNoteCard>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<template #actions>
|
|
48
|
+
<NcButton @click="$emit('close')">
|
|
49
|
+
{{ result === null ? cancelLabel : closeLabel }}
|
|
50
|
+
</NcButton>
|
|
51
|
+
<NcButton
|
|
52
|
+
v-if="result === null"
|
|
53
|
+
type="error"
|
|
54
|
+
:disabled="loading || localItems.length === 0"
|
|
55
|
+
@click="executeDelete">
|
|
56
|
+
<template #icon>
|
|
57
|
+
<NcLoadingIcon v-if="loading" :size="20" />
|
|
58
|
+
<TrashCanOutline v-else :size="20" />
|
|
59
|
+
</template>
|
|
60
|
+
{{ confirmLabel }}
|
|
61
|
+
</NcButton>
|
|
62
|
+
</template>
|
|
63
|
+
</NcDialog>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import { NcDialog, NcButton, NcNoteCard, NcLoadingIcon } from '@nextcloud/vue'
|
|
68
|
+
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
|
|
69
|
+
import Close from 'vue-material-design-icons/Close.vue'
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* CnMassDeleteDialog — Two-phase mass delete confirmation dialog.
|
|
73
|
+
*
|
|
74
|
+
* Phase 1 (review): Shows the items to be deleted with the ability to remove
|
|
75
|
+
* individual items before confirming. Phase 2 (result): Shows success or error.
|
|
76
|
+
*
|
|
77
|
+
* The dialog does NOT perform the delete itself — it emits a `confirm` event
|
|
78
|
+
* with the item IDs. The parent component performs the actual API call and
|
|
79
|
+
* calls `setResult()` via a ref.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* <CnMassDeleteDialog
|
|
83
|
+
* v-if="showDeleteDialog"
|
|
84
|
+
* :items="selectedObjects"
|
|
85
|
+
* :name-field="'title'"
|
|
86
|
+
* @confirm="onDeleteConfirm"
|
|
87
|
+
* @close="showDeleteDialog = false" />
|
|
88
|
+
*
|
|
89
|
+
* // In methods:
|
|
90
|
+
* async onDeleteConfirm(ids) {
|
|
91
|
+
* try {
|
|
92
|
+
* await store.massDelete(ids)
|
|
93
|
+
* this.$refs.deleteDialog.setResult({ success: true })
|
|
94
|
+
* } catch (e) {
|
|
95
|
+
* this.$refs.deleteDialog.setResult({ error: e.message })
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
*/
|
|
99
|
+
export default {
|
|
100
|
+
name: 'CnMassDeleteDialog',
|
|
101
|
+
|
|
102
|
+
components: {
|
|
103
|
+
NcDialog,
|
|
104
|
+
NcButton,
|
|
105
|
+
NcNoteCard,
|
|
106
|
+
NcLoadingIcon,
|
|
107
|
+
TrashCanOutline,
|
|
108
|
+
Close,
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
props: {
|
|
112
|
+
/** Items to delete. Each must have an `id` property. */
|
|
113
|
+
items: {
|
|
114
|
+
type: Array,
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
117
|
+
/** Property name used for display (e.g., 'title', 'name') */
|
|
118
|
+
nameField: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: 'title',
|
|
121
|
+
},
|
|
122
|
+
/** Dialog title */
|
|
123
|
+
dialogTitle: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: 'Delete Items',
|
|
126
|
+
},
|
|
127
|
+
/** Warning text shown above the item list */
|
|
128
|
+
warningText: {
|
|
129
|
+
type: String,
|
|
130
|
+
default: 'The following items will be permanently deleted. Remove any items you want to keep.',
|
|
131
|
+
},
|
|
132
|
+
/** Text when all items removed from list */
|
|
133
|
+
emptyText: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: 'No items selected for deletion.',
|
|
136
|
+
},
|
|
137
|
+
/** Success message */
|
|
138
|
+
successText: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: 'Items successfully deleted.',
|
|
141
|
+
},
|
|
142
|
+
cancelLabel: { type: String, default: 'Cancel' },
|
|
143
|
+
closeLabel: { type: String, default: 'Close' },
|
|
144
|
+
confirmLabel: { type: String, default: 'Delete' },
|
|
145
|
+
removeLabel: { type: String, default: 'Remove from list' },
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
data() {
|
|
149
|
+
return {
|
|
150
|
+
localItems: [...this.items],
|
|
151
|
+
loading: false,
|
|
152
|
+
result: null,
|
|
153
|
+
closeTimeout: null,
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
watch: {
|
|
158
|
+
items(val) {
|
|
159
|
+
this.localItems = [...val]
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
beforeDestroy() {
|
|
164
|
+
if (this.closeTimeout) clearTimeout(this.closeTimeout)
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
methods: {
|
|
168
|
+
getItemName(item) {
|
|
169
|
+
return item[this.nameField] || item.name || item.title || item.id
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
removeItem(id) {
|
|
173
|
+
this.localItems = this.localItems.filter((i) => i.id !== id)
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
executeDelete() {
|
|
177
|
+
this.loading = true
|
|
178
|
+
const ids = this.localItems.map((i) => i.id)
|
|
179
|
+
/**
|
|
180
|
+
* @event confirm Emitted when the user confirms deletion.
|
|
181
|
+
* Payload: array of item IDs to delete.
|
|
182
|
+
*/
|
|
183
|
+
this.$emit('confirm', ids)
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Set the result of the delete operation. Call this from the parent
|
|
188
|
+
* after the API call completes.
|
|
189
|
+
*
|
|
190
|
+
* @param {{ success?: boolean, error?: string }} resultData
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
193
|
+
setResult(resultData) {
|
|
194
|
+
this.loading = false
|
|
195
|
+
this.result = resultData
|
|
196
|
+
if (resultData.success) {
|
|
197
|
+
this.closeTimeout = setTimeout(() => {
|
|
198
|
+
this.$emit('close')
|
|
199
|
+
}, 2000)
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
</script>
|
|
205
|
+
|
|
206
|
+
<style scoped>
|
|
207
|
+
.cn-mass-delete__list {
|
|
208
|
+
max-height: 300px;
|
|
209
|
+
overflow-y: auto;
|
|
210
|
+
margin-top: 12px;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.cn-mass-delete__item {
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: space-between;
|
|
217
|
+
padding: 8px 12px;
|
|
218
|
+
border-bottom: 1px solid var(--color-border);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.cn-mass-delete__item:last-child {
|
|
222
|
+
border-bottom: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.cn-mass-delete__item-name {
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
overflow: hidden;
|
|
228
|
+
text-overflow: ellipsis;
|
|
229
|
+
white-space: nowrap;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.cn-mass-delete__empty {
|
|
233
|
+
text-align: center;
|
|
234
|
+
color: var(--color-text-maxcontrast);
|
|
235
|
+
font-style: italic;
|
|
236
|
+
padding: 20px;
|
|
237
|
+
}
|
|
238
|
+
</style>
|