@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,437 +1,437 @@
1
- <template>
2
- <component
3
- :is="componentTag"
4
- class="cn-stats-block"
5
- :class="rootClasses"
6
- v-bind="componentAttrs"
7
- @click="onClick">
8
- <!-- Icon -->
9
- <div v-if="hasIcon" class="cn-stats-block__icon" :class="iconClasses">
10
- <slot name="icon">
11
- <component :is="icon" v-if="icon" :size="iconSize" />
12
- </slot>
13
- </div>
14
-
15
- <!-- Content -->
16
- <div class="cn-stats-block__content">
17
- <div class="cn-stats-block__header">
18
- <h4>{{ title || t('nextcloud-vue', 'Objects') }}</h4>
19
- </div>
20
-
21
- <div v-if="count > 0 || (showZeroCount && count === 0)" class="cn-stats-block__count">
22
- <span class="cn-stats-block__count-value">{{ formattedCount }}</span>
23
- <span class="cn-stats-block__count-label">{{ countLabel }}</span>
24
- </div>
25
- <div v-else-if="loading" class="cn-stats-block__loading">
26
- <NcLoadingIcon :size="16" />
27
- {{ loadingLabel }}
28
- </div>
29
- <div v-else class="cn-stats-block__empty">
30
- {{ emptyLabel }}
31
- </div>
32
-
33
- <!-- Breakdown details -->
34
- <div v-if="breakdown && (count > 0 || showZeroCount)" class="cn-stats-block__breakdown">
35
- <div
36
- v-for="(value, key) in breakdown"
37
- :key="key"
38
- class="cn-stats-block__breakdown-item">
39
- <span class="cn-stats-block__breakdown-label">{{ formatBreakdownLabel(key) }}</span>
40
- <span
41
- class="cn-stats-block__breakdown-value"
42
- :class="'cn-stats-block__breakdown-value--' + key">
43
- {{ value }}
44
- </span>
45
- </div>
46
- </div>
47
- </div>
48
- </component>
49
- </template>
50
-
51
- <script>
52
- import { translate as t } from '@nextcloud/l10n'
53
- import { NcLoadingIcon } from '@nextcloud/vue'
54
-
55
- /**
56
- * CnStatsBlock — Statistics display card with icon, count, and optional breakdown.
57
- *
58
- * Supports vertical (default) and horizontal layouts, color variants, icons,
59
- * and clickable state. Use in a CnKpiGrid for responsive dashboard layouts.
60
- *
61
- * @example Basic vertical (default)
62
- * <CnStatsBlock title="Cases" :count="42" count-label="open cases" />
63
- *
64
- * @example Horizontal with icon and variant
65
- * <CnStatsBlock
66
- * title="Open Cases"
67
- * :count="42"
68
- * :icon="BriefcaseOutline"
69
- * variant="primary"
70
- * horizontal
71
- * clickable
72
- * @click="goToCases" />
73
- *
74
- * @example With route-based navigation (renders as <router-link>)
75
- * <CnStatsBlock
76
- * title="Open Cases"
77
- * :count="42"
78
- * :icon="BriefcaseOutline"
79
- * variant="primary"
80
- * :route="{ name: 'Cases', query: { status: 'open' } }" />
81
- *
82
- * @example With breakdown
83
- * <CnStatsBlock
84
- * title="Cases"
85
- * :count="42"
86
- * :breakdown="{ total: 100, invalid: 3, deleted: 5, published: 92 }" />
87
- *
88
- * @example Custom icon slot
89
- * <CnStatsBlock title="Files" :count="128">
90
- * <template #icon>
91
- * <FileDocumentOutline :size="24" />
92
- * </template>
93
- * </CnStatsBlock>
94
- */
95
- export default {
96
- name: 'CnStatsBlock',
97
-
98
- components: {
99
- NcLoadingIcon,
100
- },
101
-
102
- props: {
103
- /** Block title */
104
- title: {
105
- type: String,
106
- default: '',
107
- },
108
- /** The main count number to display prominently */
109
- count: {
110
- type: Number,
111
- default: 0,
112
- },
113
- /** Label displayed next to the count */
114
- countLabel: {
115
- type: String,
116
- default: () => t('nextcloud-vue', 'objects'),
117
- },
118
- /** Detailed breakdown object (key-value pairs) */
119
- breakdown: {
120
- type: Object,
121
- default: null,
122
- },
123
- /** Whether data is currently loading */
124
- loading: {
125
- type: Boolean,
126
- default: false,
127
- },
128
- /** Text shown while loading */
129
- loadingLabel: {
130
- type: String,
131
- default: () => t('nextcloud-vue', 'Loading...'),
132
- },
133
- /** Text shown when count is 0 */
134
- emptyLabel: {
135
- type: String,
136
- default: () => t('nextcloud-vue', 'No items found'),
137
- },
138
- /** Icon component (e.g., imported MDI icon) */
139
- icon: {
140
- type: [Object, Function],
141
- default: null,
142
- },
143
- /** Icon size in pixels */
144
- iconSize: {
145
- type: Number,
146
- default: 24,
147
- },
148
- /** Color variant: 'default', 'primary', 'success', 'warning', 'error' */
149
- variant: {
150
- type: String,
151
- default: 'default',
152
- validator: (v) => ['default', 'primary', 'success', 'warning', 'error'].includes(v),
153
- },
154
- /** Use horizontal layout (icon left, content right) */
155
- horizontal: {
156
- type: Boolean,
157
- default: false,
158
- },
159
- /** Whether the card is clickable */
160
- clickable: {
161
- type: Boolean,
162
- default: false,
163
- },
164
- /** Whether to display 0 as a count value instead of the empty label */
165
- showZeroCount: {
166
- type: Boolean,
167
- default: false,
168
- },
169
- /**
170
- * Vue Router location object for declarative navigation.
171
- * When set, the card renders as a <router-link> and clickable styles are implied.
172
- * @example { name: 'Cases', query: { status: 'open' } }
173
- * @example { path: '/catalogi' }
174
- */
175
- route: {
176
- type: Object,
177
- default: null,
178
- },
179
- },
180
-
181
- computed: {
182
- hasIcon() {
183
- return this.icon !== null || this.$scopedSlots.icon || this.$slots.icon
184
- },
185
-
186
- formattedCount() {
187
- return this.count.toLocaleString()
188
- },
189
-
190
- /**
191
- * Whether the card is interactive (clickable or has a route).
192
- * Used for applying hover/focus styles.
193
- */
194
- isInteractive() {
195
- return !!this.route || this.clickable
196
- },
197
-
198
- /**
199
- * Determines which HTML element or component to render.
200
- * - route set → 'router-link' (SPA navigation)
201
- * - clickable → 'a' (app handles click via event)
202
- * - neither → 'div' (static display)
203
- */
204
- componentTag() {
205
- if (this.route) return 'router-link'
206
- if (this.clickable) return 'a'
207
- return 'div'
208
- },
209
-
210
- /**
211
- * Dynamic attributes for the root element based on rendering mode.
212
- */
213
- componentAttrs() {
214
- if (this.route) return { to: this.route, tabindex: '0' }
215
- if (this.clickable) return { href: '#', role: 'button', tabindex: '0' }
216
- return {}
217
- },
218
-
219
- rootClasses() {
220
- return {
221
- 'cn-stats-block--horizontal': this.horizontal,
222
- 'cn-stats-block--clickable': this.isInteractive,
223
- [`cn-stats-block--${this.variant}`]: this.variant !== 'default',
224
- }
225
- },
226
-
227
- iconClasses() {
228
- return {
229
- [`cn-stats-block__icon--${this.variant}`]: this.variant !== 'default',
230
- }
231
- },
232
- },
233
-
234
- methods: {
235
- formatBreakdownLabel(key) {
236
- return key.charAt(0).toUpperCase() + key.slice(1) + ':'
237
- },
238
-
239
- onClick(event) {
240
- // When route is set, router-link handles navigation — do not emit click
241
- if (this.route) return
242
- if (this.clickable) {
243
- event.preventDefault()
244
- this.$emit('click', event)
245
- }
246
- },
247
- },
248
- }
249
- </script>
250
-
251
- <style scoped>
252
- .cn-stats-block {
253
- background: var(--color-background-hover);
254
- border-radius: var(--border-radius-large, 10px);
255
- padding: 1rem;
256
- display: flex;
257
- flex-direction: column;
258
- align-items: center;
259
- text-decoration: none;
260
- color: inherit;
261
- border: 2px solid transparent;
262
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
263
- height: 100%;
264
- width: 100%;
265
- box-sizing: border-box;
266
- overflow: hidden;
267
- min-width: 0;
268
- }
269
-
270
- .cn-stats-block--horizontal {
271
- flex-direction: row;
272
- align-items: center;
273
- gap: 12px;
274
- }
275
-
276
- .cn-stats-block--horizontal .cn-stats-block__content {
277
- text-align: left;
278
- min-width: 0;
279
- }
280
-
281
- .cn-stats-block--horizontal .cn-stats-block__count {
282
- justify-content: flex-start;
283
- }
284
-
285
- .cn-stats-block--clickable {
286
- cursor: pointer;
287
- }
288
-
289
- .cn-stats-block--clickable:hover {
290
- border-color: var(--color-primary-element);
291
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
292
- }
293
-
294
- .cn-stats-block--clickable:focus-visible {
295
- outline: 2px solid var(--color-primary-element);
296
- outline-offset: 2px;
297
- }
298
-
299
- /* Icon */
300
- .cn-stats-block__icon {
301
- display: flex;
302
- align-items: center;
303
- justify-content: center;
304
- width: 44px;
305
- height: 44px;
306
- border-radius: 50%;
307
- background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
308
- color: var(--color-primary-element);
309
- flex-shrink: 0;
310
- margin-bottom: 8px;
311
- }
312
-
313
- .cn-stats-block--horizontal .cn-stats-block__icon {
314
- margin-bottom: 0;
315
- width: 36px;
316
- height: 36px;
317
- }
318
-
319
- .cn-stats-block__icon--primary {
320
- background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
321
- color: var(--color-primary-element);
322
- }
323
-
324
- .cn-stats-block__icon--success {
325
- background: rgba(70, 186, 97, 0.1);
326
- color: var(--color-element-success, var(--color-success));
327
- }
328
-
329
- .cn-stats-block__icon--warning {
330
- background: rgba(232, 163, 24, 0.1);
331
- color: var(--color-element-warning, var(--color-warning));
332
- }
333
-
334
- .cn-stats-block__icon--error {
335
- background: rgba(224, 36, 36, 0.1);
336
- color: var(--color-element-error, var(--color-error));
337
- }
338
-
339
- /* Content */
340
- .cn-stats-block__content {
341
- flex: 1;
342
- min-width: 0;
343
- text-align: center;
344
- }
345
-
346
- .cn-stats-block__header h4 {
347
- margin-top: 0;
348
- margin-bottom: 0.25rem;
349
- color: var(--color-main-text);
350
- font-size: 14px;
351
- font-weight: 600;
352
- white-space: nowrap;
353
- overflow: hidden;
354
- text-overflow: ellipsis;
355
- }
356
-
357
- .cn-stats-block__count {
358
- display: flex;
359
- align-items: baseline;
360
- justify-content: center;
361
- gap: 0.25rem;
362
- font-size: 1.2rem;
363
- margin-bottom: 0.25rem;
364
- white-space: nowrap;
365
- overflow: hidden;
366
- }
367
-
368
- .cn-stats-block__count-value {
369
- font-size: 2rem;
370
- font-weight: bold;
371
- color: var(--color-primary-element);
372
- flex-shrink: 0;
373
- }
374
-
375
- .cn-stats-block--primary .cn-stats-block__count-value { color: var(--color-primary-element); }
376
- .cn-stats-block--success .cn-stats-block__count-value { color: var(--color-element-success, var(--color-success)); }
377
- .cn-stats-block--warning .cn-stats-block__count-value { color: var(--color-element-warning, var(--color-warning)); }
378
- .cn-stats-block--error .cn-stats-block__count-value { color: var(--color-element-error, var(--color-error)); }
379
-
380
- .cn-stats-block__count-label {
381
- color: var(--color-text-maxcontrast);
382
- overflow: hidden;
383
- text-overflow: ellipsis;
384
- }
385
-
386
- .cn-stats-block__loading {
387
- display: flex;
388
- align-items: center;
389
- justify-content: center;
390
- gap: 0.5rem;
391
- color: var(--color-text-maxcontrast);
392
- margin-bottom: 0.5rem;
393
- }
394
-
395
- .cn-stats-block__empty {
396
- text-align: center;
397
- color: var(--color-text-maxcontrast);
398
- font-style: italic;
399
- margin-bottom: 0.5rem;
400
- }
401
-
402
- .cn-stats-block__breakdown {
403
- margin-top: 0.5rem;
404
- padding: 0.75rem;
405
- background: var(--color-background-hover);
406
- border-radius: var(--border-radius);
407
- border: 1px solid var(--color-border);
408
- width: 100%;
409
- }
410
-
411
- .cn-stats-block__breakdown-item {
412
- display: flex;
413
- justify-content: space-between;
414
- align-items: center;
415
- margin-bottom: 0.5rem;
416
- }
417
-
418
- .cn-stats-block__breakdown-item:last-child {
419
- margin-bottom: 0;
420
- }
421
-
422
- .cn-stats-block__breakdown-label {
423
- font-weight: 500;
424
- color: var(--color-main-text);
425
- }
426
-
427
- .cn-stats-block__breakdown-value {
428
- font-weight: 600;
429
- padding: 0.25rem 0.5rem;
430
- border-radius: var(--border-radius);
431
- background: var(--color-background-hover);
432
- }
433
-
434
- .cn-stats-block__breakdown-value--invalid { color: var(--color-element-warning); }
435
- .cn-stats-block__breakdown-value--deleted { color: var(--color-element-error); }
436
- .cn-stats-block__breakdown-value--published { color: var(--color-element-success); }
437
- </style>
1
+ <template>
2
+ <component
3
+ :is="componentTag"
4
+ class="cn-stats-block"
5
+ :class="rootClasses"
6
+ v-bind="componentAttrs"
7
+ @click="onClick">
8
+ <!-- Icon -->
9
+ <div v-if="hasIcon" class="cn-stats-block__icon" :class="iconClasses">
10
+ <slot name="icon">
11
+ <component :is="icon" v-if="icon" :size="iconSize" />
12
+ </slot>
13
+ </div>
14
+
15
+ <!-- Content -->
16
+ <div class="cn-stats-block__content">
17
+ <div class="cn-stats-block__header">
18
+ <h4>{{ title || t('nextcloud-vue', 'Objects') }}</h4>
19
+ </div>
20
+
21
+ <div v-if="count > 0 || (showZeroCount && count === 0)" class="cn-stats-block__count">
22
+ <span class="cn-stats-block__count-value">{{ formattedCount }}</span>
23
+ <span class="cn-stats-block__count-label">{{ countLabel }}</span>
24
+ </div>
25
+ <div v-else-if="loading" class="cn-stats-block__loading">
26
+ <NcLoadingIcon :size="16" />
27
+ {{ loadingLabel }}
28
+ </div>
29
+ <div v-else class="cn-stats-block__empty">
30
+ {{ emptyLabel }}
31
+ </div>
32
+
33
+ <!-- Breakdown details -->
34
+ <div v-if="breakdown && (count > 0 || showZeroCount)" class="cn-stats-block__breakdown">
35
+ <div
36
+ v-for="(value, key) in breakdown"
37
+ :key="key"
38
+ class="cn-stats-block__breakdown-item">
39
+ <span class="cn-stats-block__breakdown-label">{{ formatBreakdownLabel(key) }}</span>
40
+ <span
41
+ class="cn-stats-block__breakdown-value"
42
+ :class="'cn-stats-block__breakdown-value--' + key">
43
+ {{ value }}
44
+ </span>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </component>
49
+ </template>
50
+
51
+ <script>
52
+ import { translate as t } from '@nextcloud/l10n'
53
+ import { NcLoadingIcon } from '@nextcloud/vue'
54
+
55
+ /**
56
+ * CnStatsBlock — Statistics display card with icon, count, and optional breakdown.
57
+ *
58
+ * Supports vertical (default) and horizontal layouts, color variants, icons,
59
+ * and clickable state. Use in a CnKpiGrid for responsive dashboard layouts.
60
+ *
61
+ * @example Basic vertical (default)
62
+ * <CnStatsBlock title="Cases" :count="42" count-label="open cases" />
63
+ *
64
+ * @example Horizontal with icon and variant
65
+ * <CnStatsBlock
66
+ * title="Open Cases"
67
+ * :count="42"
68
+ * :icon="BriefcaseOutline"
69
+ * variant="primary"
70
+ * horizontal
71
+ * clickable
72
+ * @click="goToCases" />
73
+ *
74
+ * @example With route-based navigation (renders as <router-link>)
75
+ * <CnStatsBlock
76
+ * title="Open Cases"
77
+ * :count="42"
78
+ * :icon="BriefcaseOutline"
79
+ * variant="primary"
80
+ * :route="{ name: 'Cases', query: { status: 'open' } }" />
81
+ *
82
+ * @example With breakdown
83
+ * <CnStatsBlock
84
+ * title="Cases"
85
+ * :count="42"
86
+ * :breakdown="{ total: 100, invalid: 3, deleted: 5, published: 92 }" />
87
+ *
88
+ * @example Custom icon slot
89
+ * <CnStatsBlock title="Files" :count="128">
90
+ * <template #icon>
91
+ * <FileDocumentOutline :size="24" />
92
+ * </template>
93
+ * </CnStatsBlock>
94
+ */
95
+ export default {
96
+ name: 'CnStatsBlock',
97
+
98
+ components: {
99
+ NcLoadingIcon,
100
+ },
101
+
102
+ props: {
103
+ /** Block title */
104
+ title: {
105
+ type: String,
106
+ default: '',
107
+ },
108
+ /** The main count number to display prominently */
109
+ count: {
110
+ type: Number,
111
+ default: 0,
112
+ },
113
+ /** Label displayed next to the count */
114
+ countLabel: {
115
+ type: String,
116
+ default: () => t('nextcloud-vue', 'objects'),
117
+ },
118
+ /** Detailed breakdown object (key-value pairs) */
119
+ breakdown: {
120
+ type: Object,
121
+ default: null,
122
+ },
123
+ /** Whether data is currently loading */
124
+ loading: {
125
+ type: Boolean,
126
+ default: false,
127
+ },
128
+ /** Text shown while loading */
129
+ loadingLabel: {
130
+ type: String,
131
+ default: () => t('nextcloud-vue', 'Loading...'),
132
+ },
133
+ /** Text shown when count is 0 */
134
+ emptyLabel: {
135
+ type: String,
136
+ default: () => t('nextcloud-vue', 'No items found'),
137
+ },
138
+ /** Icon component (e.g., imported MDI icon) */
139
+ icon: {
140
+ type: [Object, Function],
141
+ default: null,
142
+ },
143
+ /** Icon size in pixels */
144
+ iconSize: {
145
+ type: Number,
146
+ default: 24,
147
+ },
148
+ /** Color variant: 'default', 'primary', 'success', 'warning', 'error' */
149
+ variant: {
150
+ type: String,
151
+ default: 'default',
152
+ validator: (v) => ['default', 'primary', 'success', 'warning', 'error'].includes(v),
153
+ },
154
+ /** Use horizontal layout (icon left, content right) */
155
+ horizontal: {
156
+ type: Boolean,
157
+ default: false,
158
+ },
159
+ /** Whether the card is clickable */
160
+ clickable: {
161
+ type: Boolean,
162
+ default: false,
163
+ },
164
+ /** Whether to display 0 as a count value instead of the empty label */
165
+ showZeroCount: {
166
+ type: Boolean,
167
+ default: false,
168
+ },
169
+ /**
170
+ * Vue Router location object for declarative navigation.
171
+ * When set, the card renders as a <router-link> and clickable styles are implied.
172
+ * @example { name: 'Cases', query: { status: 'open' } }
173
+ * @example { path: '/catalogi' }
174
+ */
175
+ route: {
176
+ type: Object,
177
+ default: null,
178
+ },
179
+ },
180
+
181
+ computed: {
182
+ hasIcon() {
183
+ return this.icon !== null || this.$scopedSlots.icon || this.$slots.icon
184
+ },
185
+
186
+ formattedCount() {
187
+ return this.count.toLocaleString()
188
+ },
189
+
190
+ /**
191
+ * Whether the card is interactive (clickable or has a route).
192
+ * Used for applying hover/focus styles.
193
+ */
194
+ isInteractive() {
195
+ return !!this.route || this.clickable
196
+ },
197
+
198
+ /**
199
+ * Determines which HTML element or component to render.
200
+ * - route set → 'router-link' (SPA navigation)
201
+ * - clickable → 'a' (app handles click via event)
202
+ * - neither → 'div' (static display)
203
+ */
204
+ componentTag() {
205
+ if (this.route) return 'router-link'
206
+ if (this.clickable) return 'a'
207
+ return 'div'
208
+ },
209
+
210
+ /**
211
+ * Dynamic attributes for the root element based on rendering mode.
212
+ */
213
+ componentAttrs() {
214
+ if (this.route) return { to: this.route, tabindex: '0' }
215
+ if (this.clickable) return { href: '#', role: 'button', tabindex: '0' }
216
+ return {}
217
+ },
218
+
219
+ rootClasses() {
220
+ return {
221
+ 'cn-stats-block--horizontal': this.horizontal,
222
+ 'cn-stats-block--clickable': this.isInteractive,
223
+ [`cn-stats-block--${this.variant}`]: this.variant !== 'default',
224
+ }
225
+ },
226
+
227
+ iconClasses() {
228
+ return {
229
+ [`cn-stats-block__icon--${this.variant}`]: this.variant !== 'default',
230
+ }
231
+ },
232
+ },
233
+
234
+ methods: {
235
+ formatBreakdownLabel(key) {
236
+ return key.charAt(0).toUpperCase() + key.slice(1) + ':'
237
+ },
238
+
239
+ onClick(event) {
240
+ // When route is set, router-link handles navigation — do not emit click
241
+ if (this.route) return
242
+ if (this.clickable) {
243
+ event.preventDefault()
244
+ this.$emit('click', event)
245
+ }
246
+ },
247
+ },
248
+ }
249
+ </script>
250
+
251
+ <style scoped>
252
+ .cn-stats-block {
253
+ background: var(--color-background-hover);
254
+ border-radius: var(--border-radius-large, 10px);
255
+ padding: 1rem;
256
+ display: flex;
257
+ flex-direction: column;
258
+ align-items: center;
259
+ text-decoration: none;
260
+ color: inherit;
261
+ border: 2px solid transparent;
262
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
263
+ height: 100%;
264
+ width: 100%;
265
+ box-sizing: border-box;
266
+ overflow: hidden;
267
+ min-width: 0;
268
+ }
269
+
270
+ .cn-stats-block--horizontal {
271
+ flex-direction: row;
272
+ align-items: center;
273
+ gap: 12px;
274
+ }
275
+
276
+ .cn-stats-block--horizontal .cn-stats-block__content {
277
+ text-align: left;
278
+ min-width: 0;
279
+ }
280
+
281
+ .cn-stats-block--horizontal .cn-stats-block__count {
282
+ justify-content: flex-start;
283
+ }
284
+
285
+ .cn-stats-block--clickable {
286
+ cursor: pointer;
287
+ }
288
+
289
+ .cn-stats-block--clickable:hover {
290
+ border-color: var(--color-primary-element);
291
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
292
+ }
293
+
294
+ .cn-stats-block--clickable:focus-visible {
295
+ outline: 2px solid var(--color-primary-element);
296
+ outline-offset: 2px;
297
+ }
298
+
299
+ /* Icon */
300
+ .cn-stats-block__icon {
301
+ display: flex;
302
+ align-items: center;
303
+ justify-content: center;
304
+ width: 44px;
305
+ height: 44px;
306
+ border-radius: 50%;
307
+ background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
308
+ color: var(--color-primary-element);
309
+ flex-shrink: 0;
310
+ margin-bottom: 8px;
311
+ }
312
+
313
+ .cn-stats-block--horizontal .cn-stats-block__icon {
314
+ margin-bottom: 0;
315
+ width: 36px;
316
+ height: 36px;
317
+ }
318
+
319
+ .cn-stats-block__icon--primary {
320
+ background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
321
+ color: var(--color-primary-element);
322
+ }
323
+
324
+ .cn-stats-block__icon--success {
325
+ background: rgba(70, 186, 97, 0.1);
326
+ color: var(--color-element-success, var(--color-success));
327
+ }
328
+
329
+ .cn-stats-block__icon--warning {
330
+ background: rgba(232, 163, 24, 0.1);
331
+ color: var(--color-element-warning, var(--color-warning));
332
+ }
333
+
334
+ .cn-stats-block__icon--error {
335
+ background: rgba(224, 36, 36, 0.1);
336
+ color: var(--color-element-error, var(--color-error));
337
+ }
338
+
339
+ /* Content */
340
+ .cn-stats-block__content {
341
+ flex: 1;
342
+ min-width: 0;
343
+ text-align: center;
344
+ }
345
+
346
+ .cn-stats-block__header h4 {
347
+ margin-top: 0;
348
+ margin-bottom: 0.25rem;
349
+ color: var(--color-main-text);
350
+ font-size: 14px;
351
+ font-weight: 600;
352
+ white-space: nowrap;
353
+ overflow: hidden;
354
+ text-overflow: ellipsis;
355
+ }
356
+
357
+ .cn-stats-block__count {
358
+ display: flex;
359
+ align-items: baseline;
360
+ justify-content: center;
361
+ gap: 0.25rem;
362
+ font-size: 1.2rem;
363
+ margin-bottom: 0.25rem;
364
+ white-space: nowrap;
365
+ overflow: hidden;
366
+ }
367
+
368
+ .cn-stats-block__count-value {
369
+ font-size: 2rem;
370
+ font-weight: bold;
371
+ color: var(--color-primary-element);
372
+ flex-shrink: 0;
373
+ }
374
+
375
+ .cn-stats-block--primary .cn-stats-block__count-value { color: var(--color-primary-element); }
376
+ .cn-stats-block--success .cn-stats-block__count-value { color: var(--color-element-success, var(--color-success)); }
377
+ .cn-stats-block--warning .cn-stats-block__count-value { color: var(--color-element-warning, var(--color-warning)); }
378
+ .cn-stats-block--error .cn-stats-block__count-value { color: var(--color-element-error, var(--color-error)); }
379
+
380
+ .cn-stats-block__count-label {
381
+ color: var(--color-text-maxcontrast);
382
+ overflow: hidden;
383
+ text-overflow: ellipsis;
384
+ }
385
+
386
+ .cn-stats-block__loading {
387
+ display: flex;
388
+ align-items: center;
389
+ justify-content: center;
390
+ gap: 0.5rem;
391
+ color: var(--color-text-maxcontrast);
392
+ margin-bottom: 0.5rem;
393
+ }
394
+
395
+ .cn-stats-block__empty {
396
+ text-align: center;
397
+ color: var(--color-text-maxcontrast);
398
+ font-style: italic;
399
+ margin-bottom: 0.5rem;
400
+ }
401
+
402
+ .cn-stats-block__breakdown {
403
+ margin-top: 0.5rem;
404
+ padding: 0.75rem;
405
+ background: var(--color-background-hover);
406
+ border-radius: var(--border-radius);
407
+ border: 1px solid var(--color-border);
408
+ width: 100%;
409
+ }
410
+
411
+ .cn-stats-block__breakdown-item {
412
+ display: flex;
413
+ justify-content: space-between;
414
+ align-items: center;
415
+ margin-bottom: 0.5rem;
416
+ }
417
+
418
+ .cn-stats-block__breakdown-item:last-child {
419
+ margin-bottom: 0;
420
+ }
421
+
422
+ .cn-stats-block__breakdown-label {
423
+ font-weight: 500;
424
+ color: var(--color-main-text);
425
+ }
426
+
427
+ .cn-stats-block__breakdown-value {
428
+ font-weight: 600;
429
+ padding: 0.25rem 0.5rem;
430
+ border-radius: var(--border-radius);
431
+ background: var(--color-background-hover);
432
+ }
433
+
434
+ .cn-stats-block__breakdown-value--invalid { color: var(--color-element-warning); }
435
+ .cn-stats-block__breakdown-value--deleted { color: var(--color-element-error); }
436
+ .cn-stats-block__breakdown-value--published { color: var(--color-element-success); }
437
+ </style>