@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.
- package/dist/nextcloud-vue.cjs +67614 -0
- package/dist/nextcloud-vue.cjs.js +13518 -13617
- package/dist/nextcloud-vue.cjs.js.map +1 -1
- package/dist/nextcloud-vue.cjs.map +1 -0
- package/dist/nextcloud-vue.css +1796 -1800
- package/dist/nextcloud-vue.esm.js +13518 -13617
- package/dist/nextcloud-vue.esm.js.map +1 -1
- package/package.json +3 -2
- package/src/components/CnActionsBar/CnActionsBar.vue +254 -254
- package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -570
- package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
- package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
- package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -422
- package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
- package/src/components/CnCard/CnCard.vue +415 -415
- package/src/components/CnCardGrid/CnCardGrid.vue +156 -156
- package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
- package/src/components/CnChartWidget/CnChartWidget.vue +346 -346
- package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
- package/src/components/CnContextMenu/CnContextMenu.vue +142 -142
- package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -266
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -229
- package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -397
- package/src/components/CnDataTable/CnDataTable.vue +362 -362
- package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -177
- package/src/components/CnDetailCard/CnDetailCard.vue +225 -225
- package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -256
- package/src/components/CnDetailPage/CnDetailPage.vue +432 -432
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -234
- package/src/components/CnFilterBar/CnFilterBar.vue +153 -153
- package/src/components/CnFormDialog/CnFormDialog.vue +1047 -1047
- package/src/components/CnIcon/CnIcon.vue +89 -89
- package/src/components/CnIndexPage/CnIndexPage.vue +981 -980
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -536
- package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -219
- package/src/components/CnItemCard/CnItemCard.vue +134 -134
- package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -312
- package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -93
- package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -161
- package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -327
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -245
- package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -191
- package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -494
- package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
- package/src/components/CnNotesCard/CnNotesCard.vue +416 -416
- package/src/components/CnObjectCard/CnObjectCard.vue +294 -294
- package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -854
- package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -289
- package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -369
- package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -287
- package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -250
- package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -255
- package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -259
- package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -483
- package/src/components/CnPageHeader/CnPageHeader.vue +61 -61
- package/src/components/CnPagination/CnPagination.vue +253 -253
- package/src/components/CnProgressBar/CnProgressBar.vue +262 -262
- package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -793
- package/src/components/CnRowActions/CnRowActions.vue +95 -95
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -788
- 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 +267 -267
- package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -437
- package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -321
- package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -90
- package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -545
- package/src/components/CnTableWidget/CnTableWidget.vue +333 -333
- package/src/components/CnTasksCard/CnTasksCard.vue +374 -374
- package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
- package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -294
- package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -436
- package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -313
- package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
- package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -248
|
@@ -1,289 +1,289 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
CnObjectMetadataWidget — Read-only metadata display widget.
|
|
3
|
-
|
|
4
|
-
Shows system/internal metadata for an OpenRegister object in a horizontal
|
|
5
|
-
label-value grid. Automatically extracts known metadata fields from the object
|
|
6
|
-
(id, uuid, uri, register, schema, created, updated, owner, etc.).
|
|
7
|
-
|
|
8
|
-
Not editable — purely informational. Wraps CnDetailCard + CnDetailGrid.
|
|
9
|
-
-->
|
|
10
|
-
<template>
|
|
11
|
-
<CnDetailCard :title="title"
|
|
12
|
-
:icon="iconComponent"
|
|
13
|
-
:collapsible="collapsible"
|
|
14
|
-
:collapsed="collapsed">
|
|
15
|
-
<template #actions>
|
|
16
|
-
<slot name="actions" />
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<CnDetailGrid
|
|
20
|
-
:items="metadataItems"
|
|
21
|
-
:layout="layout"
|
|
22
|
-
:columns="columns"
|
|
23
|
-
:label-width="labelWidth"
|
|
24
|
-
:accent="false"
|
|
25
|
-
:empty-label="emptyLabel" />
|
|
26
|
-
</CnDetailCard>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import { translate as t } from '@nextcloud/l10n'
|
|
31
|
-
import { CnDetailCard } from '../CnDetailCard/index.js'
|
|
32
|
-
import { CnDetailGrid } from '../CnDetailGrid/index.js'
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Known metadata fields and their labels.
|
|
36
|
-
* These are the standard fields from OpenRegister's @self / system fields.
|
|
37
|
-
*/
|
|
38
|
-
const METADATA_FIELDS = [
|
|
39
|
-
{ key: 'id', label: 'ID' },
|
|
40
|
-
{ key: 'uuid', label: 'UUID' },
|
|
41
|
-
{ key: 'uri', label: 'URI' },
|
|
42
|
-
{ key: 'register', label: 'Register' },
|
|
43
|
-
{ key: 'schema', label: 'Schema' },
|
|
44
|
-
{ key: 'status', label: 'Status' },
|
|
45
|
-
{ key: 'owner', label: 'Owner' },
|
|
46
|
-
{ key: 'organization', label: 'Organization' },
|
|
47
|
-
{ key: 'created', label: 'Created', format: 'date-time' },
|
|
48
|
-
{ key: 'updated', label: 'Updated', format: 'date-time' },
|
|
49
|
-
{ key: 'folder', label: 'Folder' },
|
|
50
|
-
{ key: 'textRepresentation', label: 'Text Representation' },
|
|
51
|
-
{ key: 'locked', label: 'Locked' },
|
|
52
|
-
{ key: 'version', label: 'Version' },
|
|
53
|
-
]
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* CnObjectMetadataWidget — Read-only metadata display widget.
|
|
57
|
-
*
|
|
58
|
-
* Automatically extracts and formats metadata from an OpenRegister object.
|
|
59
|
-
* Understands both flat objects (where metadata is at the top level) and
|
|
60
|
-
* objects with a `@self` metadata block.
|
|
61
|
-
*
|
|
62
|
-
* @example Basic usage
|
|
63
|
-
* <CnObjectMetadataWidget :object-data="publication" />
|
|
64
|
-
*
|
|
65
|
-
* @example With extra items
|
|
66
|
-
* <CnObjectMetadataWidget
|
|
67
|
-
* title="System Info"
|
|
68
|
-
* :object-data="entity"
|
|
69
|
-
* :extra-items="[
|
|
70
|
-
* { label: 'Source', value: entity.source },
|
|
71
|
-
* { label: 'Catalog', value: entity.catalog },
|
|
72
|
-
* ]" />
|
|
73
|
-
*
|
|
74
|
-
* @example Selective display
|
|
75
|
-
* <CnObjectMetadataWidget
|
|
76
|
-
* :object-data="entity"
|
|
77
|
-
* :include="['id', 'uuid', 'created', 'updated', 'owner']" />
|
|
78
|
-
*/
|
|
79
|
-
export default {
|
|
80
|
-
name: 'CnObjectMetadataWidget',
|
|
81
|
-
|
|
82
|
-
components: {
|
|
83
|
-
CnDetailCard,
|
|
84
|
-
CnDetailGrid,
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
props: {
|
|
88
|
-
/** Widget title shown in the card header */
|
|
89
|
-
title: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: () => t('nextcloud-vue', 'Metadata'),
|
|
92
|
-
},
|
|
93
|
-
/** Optional MDI icon component for the header */
|
|
94
|
-
icon: {
|
|
95
|
-
type: [Object, Function],
|
|
96
|
-
default: null,
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* The object data containing metadata.
|
|
100
|
-
* Supports flat objects and objects with `@self` metadata block.
|
|
101
|
-
*/
|
|
102
|
-
objectData: {
|
|
103
|
-
type: Object,
|
|
104
|
-
required: true,
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* Layout mode for the grid: 'grid' or 'horizontal'.
|
|
108
|
-
*/
|
|
109
|
-
layout: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: 'horizontal',
|
|
112
|
-
},
|
|
113
|
-
/**
|
|
114
|
-
* Number of grid columns (only for layout='grid').
|
|
115
|
-
*/
|
|
116
|
-
columns: {
|
|
117
|
-
type: Number,
|
|
118
|
-
default: 0,
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Min width for labels in horizontal layout.
|
|
122
|
-
*/
|
|
123
|
-
labelWidth: {
|
|
124
|
-
type: Number,
|
|
125
|
-
default: 150,
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* Additional metadata items to display.
|
|
129
|
-
* @type {Array<{ label: string, value: string|number }>}
|
|
130
|
-
*/
|
|
131
|
-
extraItems: {
|
|
132
|
-
type: Array,
|
|
133
|
-
default: () => [],
|
|
134
|
-
},
|
|
135
|
-
/**
|
|
136
|
-
* Metadata fields to include (whitelist). If null, all available are shown.
|
|
137
|
-
* @type {string[]|null}
|
|
138
|
-
*/
|
|
139
|
-
include: {
|
|
140
|
-
type: Array,
|
|
141
|
-
default: null,
|
|
142
|
-
},
|
|
143
|
-
/**
|
|
144
|
-
* Metadata fields to exclude.
|
|
145
|
-
* @type {string[]}
|
|
146
|
-
*/
|
|
147
|
-
exclude: {
|
|
148
|
-
type: Array,
|
|
149
|
-
default: () => [],
|
|
150
|
-
},
|
|
151
|
-
/** Whether the card can be collapsed */
|
|
152
|
-
collapsible: {
|
|
153
|
-
type: Boolean,
|
|
154
|
-
default: false,
|
|
155
|
-
},
|
|
156
|
-
/** Initial collapsed state */
|
|
157
|
-
collapsed: {
|
|
158
|
-
type: Boolean,
|
|
159
|
-
default: false,
|
|
160
|
-
},
|
|
161
|
-
/** Label shown when no metadata available */
|
|
162
|
-
emptyLabel: {
|
|
163
|
-
type: String,
|
|
164
|
-
default: () => t('nextcloud-vue', 'No metadata available'),
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
computed: {
|
|
169
|
-
iconComponent() {
|
|
170
|
-
return this.icon
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Merged metadata source: combines @self block with top-level fields.
|
|
175
|
-
* @self fields take priority over top-level for shared keys.
|
|
176
|
-
*/
|
|
177
|
-
metadataSource() {
|
|
178
|
-
const selfBlock = this.objectData['@self'] || {}
|
|
179
|
-
return { ...this.objectData, ...selfBlock }
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Build the items array for CnDetailGrid from known metadata fields.
|
|
184
|
-
*/
|
|
185
|
-
metadataItems() {
|
|
186
|
-
const source = this.metadataSource
|
|
187
|
-
const items = []
|
|
188
|
-
|
|
189
|
-
for (const def of METADATA_FIELDS) {
|
|
190
|
-
// Filter by include/exclude
|
|
191
|
-
if (this.include && !this.include.includes(def.key)) continue
|
|
192
|
-
if (this.exclude.includes(def.key)) continue
|
|
193
|
-
|
|
194
|
-
const raw = source[def.key]
|
|
195
|
-
if (raw === undefined || raw === null) continue
|
|
196
|
-
|
|
197
|
-
items.push({
|
|
198
|
-
label: def.label,
|
|
199
|
-
value: this.formatMetadataValue(raw, def),
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Append extra items
|
|
204
|
-
for (const item of this.extraItems) {
|
|
205
|
-
items.push(item)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return items
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
methods: {
|
|
213
|
-
/**
|
|
214
|
-
* Format a metadata value for display.
|
|
215
|
-
* @param value
|
|
216
|
-
* @param def
|
|
217
|
-
*/
|
|
218
|
-
formatMetadataValue(value, def) {
|
|
219
|
-
if (value === null || value === undefined) return '-'
|
|
220
|
-
|
|
221
|
-
// Date-time formatting
|
|
222
|
-
if (def.format === 'date-time') {
|
|
223
|
-
try {
|
|
224
|
-
const date = new Date(value)
|
|
225
|
-
if (Number.isNaN(date.getTime())) return String(value)
|
|
226
|
-
return date.toLocaleDateString(undefined, {
|
|
227
|
-
day: '2-digit',
|
|
228
|
-
month: '2-digit',
|
|
229
|
-
year: 'numeric',
|
|
230
|
-
}) + ', ' + date.toLocaleTimeString(undefined, {
|
|
231
|
-
hour: '2-digit',
|
|
232
|
-
minute: '2-digit',
|
|
233
|
-
second: '2-digit',
|
|
234
|
-
})
|
|
235
|
-
} catch {
|
|
236
|
-
return String(value)
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Booleans
|
|
241
|
-
if (typeof value === 'boolean') {
|
|
242
|
-
return value ? 'Yes' : 'No'
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// Arrays
|
|
246
|
-
if (Array.isArray(value)) {
|
|
247
|
-
return value.length > 0 ? value.join(', ') : '-'
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Objects — show as JSON snippet
|
|
251
|
-
if (typeof value === 'object') {
|
|
252
|
-
return JSON.stringify(value)
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return String(value)
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
}
|
|
259
|
-
</script>
|
|
260
|
-
|
|
261
|
-
<style scoped>
|
|
262
|
-
/* Override CnDetailGrid item styling for a compact table-like appearance */
|
|
263
|
-
:deep(.cn-detail-grid__item) {
|
|
264
|
-
background: none;
|
|
265
|
-
border-radius: 0;
|
|
266
|
-
border-bottom: 1px solid var(--color-border);
|
|
267
|
-
padding: calc(1.5 * var(--default-grid-baseline, 4px)) 0;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
:deep(.cn-detail-grid__item:last-child) {
|
|
271
|
-
border-bottom: none;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
:deep(.cn-detail-grid--horizontal) {
|
|
275
|
-
gap: 0;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
:deep(.cn-detail-grid__label) {
|
|
279
|
-
font-size: 0.8em;
|
|
280
|
-
text-transform: uppercase;
|
|
281
|
-
letter-spacing: 0.02em;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
:deep(.cn-detail-grid__value) {
|
|
285
|
-
font-size: 0.9em;
|
|
286
|
-
word-break: break-all;
|
|
287
|
-
margin: 0;
|
|
288
|
-
}
|
|
289
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
CnObjectMetadataWidget — Read-only metadata display widget.
|
|
3
|
+
|
|
4
|
+
Shows system/internal metadata for an OpenRegister object in a horizontal
|
|
5
|
+
label-value grid. Automatically extracts known metadata fields from the object
|
|
6
|
+
(id, uuid, uri, register, schema, created, updated, owner, etc.).
|
|
7
|
+
|
|
8
|
+
Not editable — purely informational. Wraps CnDetailCard + CnDetailGrid.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<CnDetailCard :title="title"
|
|
12
|
+
:icon="iconComponent"
|
|
13
|
+
:collapsible="collapsible"
|
|
14
|
+
:collapsed="collapsed">
|
|
15
|
+
<template #actions>
|
|
16
|
+
<slot name="actions" />
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<CnDetailGrid
|
|
20
|
+
:items="metadataItems"
|
|
21
|
+
:layout="layout"
|
|
22
|
+
:columns="columns"
|
|
23
|
+
:label-width="labelWidth"
|
|
24
|
+
:accent="false"
|
|
25
|
+
:empty-label="emptyLabel" />
|
|
26
|
+
</CnDetailCard>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
31
|
+
import { CnDetailCard } from '../CnDetailCard/index.js'
|
|
32
|
+
import { CnDetailGrid } from '../CnDetailGrid/index.js'
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Known metadata fields and their labels.
|
|
36
|
+
* These are the standard fields from OpenRegister's @self / system fields.
|
|
37
|
+
*/
|
|
38
|
+
const METADATA_FIELDS = [
|
|
39
|
+
{ key: 'id', label: 'ID' },
|
|
40
|
+
{ key: 'uuid', label: 'UUID' },
|
|
41
|
+
{ key: 'uri', label: 'URI' },
|
|
42
|
+
{ key: 'register', label: 'Register' },
|
|
43
|
+
{ key: 'schema', label: 'Schema' },
|
|
44
|
+
{ key: 'status', label: 'Status' },
|
|
45
|
+
{ key: 'owner', label: 'Owner' },
|
|
46
|
+
{ key: 'organization', label: 'Organization' },
|
|
47
|
+
{ key: 'created', label: 'Created', format: 'date-time' },
|
|
48
|
+
{ key: 'updated', label: 'Updated', format: 'date-time' },
|
|
49
|
+
{ key: 'folder', label: 'Folder' },
|
|
50
|
+
{ key: 'textRepresentation', label: 'Text Representation' },
|
|
51
|
+
{ key: 'locked', label: 'Locked' },
|
|
52
|
+
{ key: 'version', label: 'Version' },
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* CnObjectMetadataWidget — Read-only metadata display widget.
|
|
57
|
+
*
|
|
58
|
+
* Automatically extracts and formats metadata from an OpenRegister object.
|
|
59
|
+
* Understands both flat objects (where metadata is at the top level) and
|
|
60
|
+
* objects with a `@self` metadata block.
|
|
61
|
+
*
|
|
62
|
+
* @example Basic usage
|
|
63
|
+
* <CnObjectMetadataWidget :object-data="publication" />
|
|
64
|
+
*
|
|
65
|
+
* @example With extra items
|
|
66
|
+
* <CnObjectMetadataWidget
|
|
67
|
+
* title="System Info"
|
|
68
|
+
* :object-data="entity"
|
|
69
|
+
* :extra-items="[
|
|
70
|
+
* { label: 'Source', value: entity.source },
|
|
71
|
+
* { label: 'Catalog', value: entity.catalog },
|
|
72
|
+
* ]" />
|
|
73
|
+
*
|
|
74
|
+
* @example Selective display
|
|
75
|
+
* <CnObjectMetadataWidget
|
|
76
|
+
* :object-data="entity"
|
|
77
|
+
* :include="['id', 'uuid', 'created', 'updated', 'owner']" />
|
|
78
|
+
*/
|
|
79
|
+
export default {
|
|
80
|
+
name: 'CnObjectMetadataWidget',
|
|
81
|
+
|
|
82
|
+
components: {
|
|
83
|
+
CnDetailCard,
|
|
84
|
+
CnDetailGrid,
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
props: {
|
|
88
|
+
/** Widget title shown in the card header */
|
|
89
|
+
title: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: () => t('nextcloud-vue', 'Metadata'),
|
|
92
|
+
},
|
|
93
|
+
/** Optional MDI icon component for the header */
|
|
94
|
+
icon: {
|
|
95
|
+
type: [Object, Function],
|
|
96
|
+
default: null,
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* The object data containing metadata.
|
|
100
|
+
* Supports flat objects and objects with `@self` metadata block.
|
|
101
|
+
*/
|
|
102
|
+
objectData: {
|
|
103
|
+
type: Object,
|
|
104
|
+
required: true,
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Layout mode for the grid: 'grid' or 'horizontal'.
|
|
108
|
+
*/
|
|
109
|
+
layout: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: 'horizontal',
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* Number of grid columns (only for layout='grid').
|
|
115
|
+
*/
|
|
116
|
+
columns: {
|
|
117
|
+
type: Number,
|
|
118
|
+
default: 0,
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Min width for labels in horizontal layout.
|
|
122
|
+
*/
|
|
123
|
+
labelWidth: {
|
|
124
|
+
type: Number,
|
|
125
|
+
default: 150,
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Additional metadata items to display.
|
|
129
|
+
* @type {Array<{ label: string, value: string|number }>}
|
|
130
|
+
*/
|
|
131
|
+
extraItems: {
|
|
132
|
+
type: Array,
|
|
133
|
+
default: () => [],
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Metadata fields to include (whitelist). If null, all available are shown.
|
|
137
|
+
* @type {string[]|null}
|
|
138
|
+
*/
|
|
139
|
+
include: {
|
|
140
|
+
type: Array,
|
|
141
|
+
default: null,
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* Metadata fields to exclude.
|
|
145
|
+
* @type {string[]}
|
|
146
|
+
*/
|
|
147
|
+
exclude: {
|
|
148
|
+
type: Array,
|
|
149
|
+
default: () => [],
|
|
150
|
+
},
|
|
151
|
+
/** Whether the card can be collapsed */
|
|
152
|
+
collapsible: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false,
|
|
155
|
+
},
|
|
156
|
+
/** Initial collapsed state */
|
|
157
|
+
collapsed: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: false,
|
|
160
|
+
},
|
|
161
|
+
/** Label shown when no metadata available */
|
|
162
|
+
emptyLabel: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: () => t('nextcloud-vue', 'No metadata available'),
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
computed: {
|
|
169
|
+
iconComponent() {
|
|
170
|
+
return this.icon
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Merged metadata source: combines @self block with top-level fields.
|
|
175
|
+
* @self fields take priority over top-level for shared keys.
|
|
176
|
+
*/
|
|
177
|
+
metadataSource() {
|
|
178
|
+
const selfBlock = this.objectData['@self'] || {}
|
|
179
|
+
return { ...this.objectData, ...selfBlock }
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Build the items array for CnDetailGrid from known metadata fields.
|
|
184
|
+
*/
|
|
185
|
+
metadataItems() {
|
|
186
|
+
const source = this.metadataSource
|
|
187
|
+
const items = []
|
|
188
|
+
|
|
189
|
+
for (const def of METADATA_FIELDS) {
|
|
190
|
+
// Filter by include/exclude
|
|
191
|
+
if (this.include && !this.include.includes(def.key)) continue
|
|
192
|
+
if (this.exclude.includes(def.key)) continue
|
|
193
|
+
|
|
194
|
+
const raw = source[def.key]
|
|
195
|
+
if (raw === undefined || raw === null) continue
|
|
196
|
+
|
|
197
|
+
items.push({
|
|
198
|
+
label: def.label,
|
|
199
|
+
value: this.formatMetadataValue(raw, def),
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Append extra items
|
|
204
|
+
for (const item of this.extraItems) {
|
|
205
|
+
items.push(item)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return items
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
methods: {
|
|
213
|
+
/**
|
|
214
|
+
* Format a metadata value for display.
|
|
215
|
+
* @param value
|
|
216
|
+
* @param def
|
|
217
|
+
*/
|
|
218
|
+
formatMetadataValue(value, def) {
|
|
219
|
+
if (value === null || value === undefined) return '-'
|
|
220
|
+
|
|
221
|
+
// Date-time formatting
|
|
222
|
+
if (def.format === 'date-time') {
|
|
223
|
+
try {
|
|
224
|
+
const date = new Date(value)
|
|
225
|
+
if (Number.isNaN(date.getTime())) return String(value)
|
|
226
|
+
return date.toLocaleDateString(undefined, {
|
|
227
|
+
day: '2-digit',
|
|
228
|
+
month: '2-digit',
|
|
229
|
+
year: 'numeric',
|
|
230
|
+
}) + ', ' + date.toLocaleTimeString(undefined, {
|
|
231
|
+
hour: '2-digit',
|
|
232
|
+
minute: '2-digit',
|
|
233
|
+
second: '2-digit',
|
|
234
|
+
})
|
|
235
|
+
} catch {
|
|
236
|
+
return String(value)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Booleans
|
|
241
|
+
if (typeof value === 'boolean') {
|
|
242
|
+
return value ? 'Yes' : 'No'
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Arrays
|
|
246
|
+
if (Array.isArray(value)) {
|
|
247
|
+
return value.length > 0 ? value.join(', ') : '-'
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Objects — show as JSON snippet
|
|
251
|
+
if (typeof value === 'object') {
|
|
252
|
+
return JSON.stringify(value)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return String(value)
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<style scoped>
|
|
262
|
+
/* Override CnDetailGrid item styling for a compact table-like appearance */
|
|
263
|
+
:deep(.cn-detail-grid__item) {
|
|
264
|
+
background: none;
|
|
265
|
+
border-radius: 0;
|
|
266
|
+
border-bottom: 1px solid var(--color-border);
|
|
267
|
+
padding: calc(1.5 * var(--default-grid-baseline, 4px)) 0;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
:deep(.cn-detail-grid__item:last-child) {
|
|
271
|
+
border-bottom: none;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:deep(.cn-detail-grid--horizontal) {
|
|
275
|
+
gap: 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
:deep(.cn-detail-grid__label) {
|
|
279
|
+
font-size: 0.8em;
|
|
280
|
+
text-transform: uppercase;
|
|
281
|
+
letter-spacing: 0.02em;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
:deep(.cn-detail-grid__value) {
|
|
285
|
+
font-size: 0.9em;
|
|
286
|
+
word-break: break-all;
|
|
287
|
+
margin: 0;
|
|
288
|
+
}
|
|
289
|
+
</style>
|