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