@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,321 +1,321 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="cn-stats-panel">
|
|
3
|
-
<!-- Header slot for filters/selectors -->
|
|
4
|
-
<div v-if="$slots.header" class="cn-stats-panel__header">
|
|
5
|
-
<slot name="header" />
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<!-- Global loading state -->
|
|
9
|
-
<div v-if="loading" class="cn-stats-panel__loading">
|
|
10
|
-
<NcLoadingIcon :size="20" />
|
|
11
|
-
<span>{{ loadingLabel }}</span>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<!-- Sections -->
|
|
15
|
-
<template v-else>
|
|
16
|
-
<div
|
|
17
|
-
v-for="section in sections"
|
|
18
|
-
:key="section.id"
|
|
19
|
-
class="cn-stats-panel__section">
|
|
20
|
-
<!-- Section title -->
|
|
21
|
-
<h4 v-if="section.title" class="cn-stats-panel__section-title">
|
|
22
|
-
{{ section.title }}
|
|
23
|
-
</h4>
|
|
24
|
-
|
|
25
|
-
<!-- Section-level loading -->
|
|
26
|
-
<div v-if="section.loading" class="cn-stats-panel__loading">
|
|
27
|
-
<NcLoadingIcon :size="20" />
|
|
28
|
-
<span>{{ loadingLabel }}</span>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<!-- Empty section -->
|
|
32
|
-
<div v-else-if="!section.items || !section.items.length" class="cn-stats-panel__empty">
|
|
33
|
-
{{ section.emptyLabel || emptyLabel }}
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- Stats section -->
|
|
37
|
-
<template v-else-if="section.type === 'stats'">
|
|
38
|
-
<slot :name="'section-' + section.id" :section="section">
|
|
39
|
-
<!-- Stack layout -->
|
|
40
|
-
<div v-if="section.layout === 'stack'" class="cn-stats-panel__stack">
|
|
41
|
-
<CnStatsBlock
|
|
42
|
-
v-for="(item, index) in section.items"
|
|
43
|
-
:key="index"
|
|
44
|
-
:title="item.title"
|
|
45
|
-
:count="item.count"
|
|
46
|
-
:count-label="item.countLabel"
|
|
47
|
-
:variant="item.variant || 'default'"
|
|
48
|
-
:icon="isComponentIcon(item.icon) ? item.icon : null"
|
|
49
|
-
:icon-size="item.iconSize || 24"
|
|
50
|
-
:horizontal="item.horizontal !== undefined ? item.horizontal : true"
|
|
51
|
-
:show-zero-count="item.showZeroCount !== undefined ? item.showZeroCount : true"
|
|
52
|
-
:breakdown="item.breakdown || null"
|
|
53
|
-
:route="item.route || null"
|
|
54
|
-
:clickable="item.clickable || false"
|
|
55
|
-
:loading="item.loading || false"
|
|
56
|
-
@click="$emit('stat-click', { section: section.id, item, index })">
|
|
57
|
-
<template v-if="typeof item.icon === 'string'" #icon>
|
|
58
|
-
<CnIcon :name="item.icon" :size="item.iconSize || 24" />
|
|
59
|
-
</template>
|
|
60
|
-
</CnStatsBlock>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<!-- Grid layout -->
|
|
64
|
-
<CnKpiGrid
|
|
65
|
-
v-else-if="section.layout === 'grid'"
|
|
66
|
-
grid-class="remove-margin"
|
|
67
|
-
:columns="section.columns || 2">
|
|
68
|
-
<CnStatsBlock
|
|
69
|
-
v-for="(item, index) in section.items"
|
|
70
|
-
:key="index"
|
|
71
|
-
:title="item.title"
|
|
72
|
-
:count="item.count"
|
|
73
|
-
:count-label="item.countLabel"
|
|
74
|
-
:variant="item.variant || 'default'"
|
|
75
|
-
:icon="isComponentIcon(item.icon) ? item.icon : null"
|
|
76
|
-
:icon-size="item.iconSize || 24"
|
|
77
|
-
:horizontal="item.horizontal !== undefined ? item.horizontal : false"
|
|
78
|
-
:show-zero-count="item.showZeroCount !== undefined ? item.showZeroCount : true"
|
|
79
|
-
:breakdown="item.breakdown || null"
|
|
80
|
-
:route="item.route || null"
|
|
81
|
-
:clickable="item.clickable || false"
|
|
82
|
-
:loading="item.loading || false"
|
|
83
|
-
@click="$emit('stat-click', { section: section.id, item, index })">
|
|
84
|
-
<template v-if="typeof item.icon === 'string'" #icon>
|
|
85
|
-
<CnIcon :name="item.icon" :size="item.iconSize || 24" />
|
|
86
|
-
</template>
|
|
87
|
-
</CnStatsBlock>
|
|
88
|
-
</CnKpiGrid>
|
|
89
|
-
</slot>
|
|
90
|
-
</template>
|
|
91
|
-
|
|
92
|
-
<!-- Progress section -->
|
|
93
|
-
<template v-else-if="section.type === 'progress'">
|
|
94
|
-
<slot :name="'section-' + section.id" :section="section">
|
|
95
|
-
<CnProgressBar
|
|
96
|
-
:items="section.items"
|
|
97
|
-
:variant="section.variant || 'primary'"
|
|
98
|
-
:bar-height="section.barHeight || 8"
|
|
99
|
-
:rounded="section.rounded !== undefined ? section.rounded : true"
|
|
100
|
-
:show-percentage="section.showPercentage || false" />
|
|
101
|
-
</slot>
|
|
102
|
-
</template>
|
|
103
|
-
|
|
104
|
-
<!-- List section -->
|
|
105
|
-
<template v-else-if="section.type === 'list'">
|
|
106
|
-
<slot :name="'section-' + section.id" :section="section">
|
|
107
|
-
<div class="cn-stats-panel__list">
|
|
108
|
-
<NcListItem
|
|
109
|
-
v-for="item in section.items"
|
|
110
|
-
:key="item.key"
|
|
111
|
-
:name="item.name"
|
|
112
|
-
:bold="item.bold || false"
|
|
113
|
-
@click="$emit('list-click', { section: section.id, item })">
|
|
114
|
-
<template #icon>
|
|
115
|
-
<slot :name="'item-icon-' + section.id" :item="item">
|
|
116
|
-
<CnIcon
|
|
117
|
-
v-if="typeof item.icon === 'string'"
|
|
118
|
-
:name="item.icon"
|
|
119
|
-
:size="item.iconSize || 32" />
|
|
120
|
-
<component
|
|
121
|
-
:is="item.icon"
|
|
122
|
-
v-else-if="item.icon"
|
|
123
|
-
:size="item.iconSize || 32" />
|
|
124
|
-
</slot>
|
|
125
|
-
</template>
|
|
126
|
-
<template #subname>
|
|
127
|
-
<slot :name="'item-subname-' + section.id" :item="item">
|
|
128
|
-
{{ item.subname }}
|
|
129
|
-
</slot>
|
|
130
|
-
</template>
|
|
131
|
-
</NcListItem>
|
|
132
|
-
</div>
|
|
133
|
-
</slot>
|
|
134
|
-
</template>
|
|
135
|
-
</div>
|
|
136
|
-
</template>
|
|
137
|
-
|
|
138
|
-
<!-- Footer slot -->
|
|
139
|
-
<div v-if="$slots.footer" class="cn-stats-panel__footer">
|
|
140
|
-
<slot name="footer" />
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</template>
|
|
144
|
-
|
|
145
|
-
<script>
|
|
146
|
-
import { translate as t } from '@nextcloud/l10n'
|
|
147
|
-
import { NcLoadingIcon, NcListItem } from '@nextcloud/vue'
|
|
148
|
-
import { CnStatsBlock } from '../CnStatsBlock/index.js'
|
|
149
|
-
import { CnKpiGrid } from '../CnKpiGrid/index.js'
|
|
150
|
-
import { CnIcon } from '../CnIcon/index.js'
|
|
151
|
-
import { CnProgressBar } from '../CnProgressBar/index.js'
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* CnStatsPanel — Configurable statistics panel with sections of stat blocks and list items.
|
|
155
|
-
*
|
|
156
|
-
* Renders statistics content from a declarative sections array. Each section can be
|
|
157
|
-
* either a 'stats' section (renders CnStatsBlocks in stack or grid layout) or a
|
|
158
|
-
* 'list' section (renders NcListItems). Suitable for sidebar tabs, dashboard widgets,
|
|
159
|
-
* or any panel that displays statistics.
|
|
160
|
-
*
|
|
161
|
-
* @example Stats stack (vertical)
|
|
162
|
-
* <CnStatsPanel :sections="[{
|
|
163
|
-
* type: 'stats',
|
|
164
|
-
* id: 'totals',
|
|
165
|
-
* title: 'System Totals',
|
|
166
|
-
* layout: 'stack',
|
|
167
|
-
* items: [
|
|
168
|
-
* { title: 'Objects', count: 42, countLabel: 'objects', variant: 'primary', icon: PackageIcon },
|
|
169
|
-
* { title: 'Files', count: 128, countLabel: 'files', icon: FileIcon },
|
|
170
|
-
* ],
|
|
171
|
-
* }]" />
|
|
172
|
-
*
|
|
173
|
-
* @example Stats grid (2-column)
|
|
174
|
-
* <CnStatsPanel :sections="[{
|
|
175
|
-
* type: 'stats',
|
|
176
|
-
* id: 'operations',
|
|
177
|
-
* title: 'Operations',
|
|
178
|
-
* layout: 'grid',
|
|
179
|
-
* columns: 2,
|
|
180
|
-
* items: [
|
|
181
|
-
* { title: 'Create', count: 10, countLabel: 'ops', variant: 'success', icon: PlusIcon },
|
|
182
|
-
* { title: 'Delete', count: 3, countLabel: 'ops', variant: 'error', icon: DeleteIcon },
|
|
183
|
-
* ],
|
|
184
|
-
* }]" />
|
|
185
|
-
*
|
|
186
|
-
* @example List section
|
|
187
|
-
* <CnStatsPanel :sections="[{
|
|
188
|
-
* type: 'list',
|
|
189
|
-
* id: 'topObjects',
|
|
190
|
-
* title: 'Most Active',
|
|
191
|
-
* items: [
|
|
192
|
-
* { key: '1', name: 'Object A', subname: '42 entries', icon: CogIcon },
|
|
193
|
-
* ],
|
|
194
|
-
* }]" />
|
|
195
|
-
*
|
|
196
|
-
* @example With header slot for filters
|
|
197
|
-
* <CnStatsPanel :sections="sections">
|
|
198
|
-
* <template #header>
|
|
199
|
-
* <NcSelect v-bind="registerOptions" />
|
|
200
|
-
* </template>
|
|
201
|
-
* </CnStatsPanel>
|
|
202
|
-
*/
|
|
203
|
-
export default {
|
|
204
|
-
name: 'CnStatsPanel',
|
|
205
|
-
|
|
206
|
-
components: {
|
|
207
|
-
NcLoadingIcon,
|
|
208
|
-
NcListItem,
|
|
209
|
-
CnStatsBlock,
|
|
210
|
-
CnKpiGrid,
|
|
211
|
-
CnIcon,
|
|
212
|
-
CnProgressBar,
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
props: {
|
|
216
|
-
/**
|
|
217
|
-
* Array of section definitions to render.
|
|
218
|
-
* Each section has a `type` of 'stats', 'list', or 'progress'.
|
|
219
|
-
*
|
|
220
|
-
* Stats sections: `{ type: 'stats', id, title, layout: 'stack'|'grid', columns?, loading?, items: StatItem[] }`
|
|
221
|
-
* List sections: `{ type: 'list', id, title, loading?, items: ListItem[] }`
|
|
222
|
-
* Progress sections: `{ type: 'progress', id, title, variant?, barHeight?, rounded?, showPercentage?, loading?, items: ProgressItem[] }`
|
|
223
|
-
*
|
|
224
|
-
* StatItem: `{ title, count, countLabel, variant?, icon?, iconSize?, horizontal?, showZeroCount?, breakdown?, route?, clickable?, loading? }`
|
|
225
|
-
* ListItem: `{ key, name, subname?, bold?, icon?, iconSize? }`
|
|
226
|
-
* ProgressItem: `{ key?, label, count?, percentage?, variant?, tooltip? }`
|
|
227
|
-
*/
|
|
228
|
-
sections: {
|
|
229
|
-
type: Array,
|
|
230
|
-
default: () => [],
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
/** Whether the entire panel is in a loading state */
|
|
234
|
-
loading: {
|
|
235
|
-
type: Boolean,
|
|
236
|
-
default: false,
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
/** Label shown during loading state */
|
|
240
|
-
loadingLabel: {
|
|
241
|
-
type: String,
|
|
242
|
-
default: () => t('nextcloud-vue', 'Loading...'),
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
/** Default text shown when a section has no items. Can be overridden per section via `section.emptyLabel`. */
|
|
246
|
-
emptyLabel: {
|
|
247
|
-
type: String,
|
|
248
|
-
default: () => t('nextcloud-vue', 'No data available'),
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
emits: ['stat-click', 'list-click', 'progress-click'],
|
|
253
|
-
|
|
254
|
-
methods: {
|
|
255
|
-
/**
|
|
256
|
-
* Check if an icon value is a component reference (not a string name).
|
|
257
|
-
* @param {*} icon - Icon value to check
|
|
258
|
-
* @return {boolean}
|
|
259
|
-
*/
|
|
260
|
-
isComponentIcon(icon) {
|
|
261
|
-
return icon != null && typeof icon !== 'string'
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
}
|
|
265
|
-
</script>
|
|
266
|
-
|
|
267
|
-
<style scoped>
|
|
268
|
-
.cn-stats-panel__section {
|
|
269
|
-
padding: 12px 0;
|
|
270
|
-
border-bottom: 1px solid var(--color-border);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.remove-margin {
|
|
274
|
-
margin: 0;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.cn-stats-panel__section:last-child {
|
|
278
|
-
border-bottom: none;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.cn-stats-panel__section-title {
|
|
282
|
-
color: var(--color-text-maxcontrast);
|
|
283
|
-
font-size: 14px;
|
|
284
|
-
font-weight: bold;
|
|
285
|
-
padding: 0 16px;
|
|
286
|
-
margin: 0 0 12px 0;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.cn-stats-panel__stack {
|
|
290
|
-
display: flex;
|
|
291
|
-
flex-direction: column;
|
|
292
|
-
gap: 12px;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.cn-stats-panel__loading {
|
|
296
|
-
display: flex;
|
|
297
|
-
align-items: center;
|
|
298
|
-
gap: 8px;
|
|
299
|
-
padding: 0 16px;
|
|
300
|
-
color: var(--color-text-maxcontrast);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.cn-stats-panel__empty {
|
|
304
|
-
padding: 0 16px;
|
|
305
|
-
color: var(--color-text-maxcontrast);
|
|
306
|
-
font-style: italic;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.cn-stats-panel__header {
|
|
310
|
-
padding-bottom: 12px;
|
|
311
|
-
border-bottom: 1px solid var(--color-border);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.cn-stats-panel__footer {
|
|
315
|
-
padding-top: 12px;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.cn-stats-panel__list {
|
|
319
|
-
margin-top: 4px;
|
|
320
|
-
}
|
|
321
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="cn-stats-panel">
|
|
3
|
+
<!-- Header slot for filters/selectors -->
|
|
4
|
+
<div v-if="$slots.header" class="cn-stats-panel__header">
|
|
5
|
+
<slot name="header" />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<!-- Global loading state -->
|
|
9
|
+
<div v-if="loading" class="cn-stats-panel__loading">
|
|
10
|
+
<NcLoadingIcon :size="20" />
|
|
11
|
+
<span>{{ loadingLabel }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<!-- Sections -->
|
|
15
|
+
<template v-else>
|
|
16
|
+
<div
|
|
17
|
+
v-for="section in sections"
|
|
18
|
+
:key="section.id"
|
|
19
|
+
class="cn-stats-panel__section">
|
|
20
|
+
<!-- Section title -->
|
|
21
|
+
<h4 v-if="section.title" class="cn-stats-panel__section-title">
|
|
22
|
+
{{ section.title }}
|
|
23
|
+
</h4>
|
|
24
|
+
|
|
25
|
+
<!-- Section-level loading -->
|
|
26
|
+
<div v-if="section.loading" class="cn-stats-panel__loading">
|
|
27
|
+
<NcLoadingIcon :size="20" />
|
|
28
|
+
<span>{{ loadingLabel }}</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- Empty section -->
|
|
32
|
+
<div v-else-if="!section.items || !section.items.length" class="cn-stats-panel__empty">
|
|
33
|
+
{{ section.emptyLabel || emptyLabel }}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- Stats section -->
|
|
37
|
+
<template v-else-if="section.type === 'stats'">
|
|
38
|
+
<slot :name="'section-' + section.id" :section="section">
|
|
39
|
+
<!-- Stack layout -->
|
|
40
|
+
<div v-if="section.layout === 'stack'" class="cn-stats-panel__stack">
|
|
41
|
+
<CnStatsBlock
|
|
42
|
+
v-for="(item, index) in section.items"
|
|
43
|
+
:key="index"
|
|
44
|
+
:title="item.title"
|
|
45
|
+
:count="item.count"
|
|
46
|
+
:count-label="item.countLabel"
|
|
47
|
+
:variant="item.variant || 'default'"
|
|
48
|
+
:icon="isComponentIcon(item.icon) ? item.icon : null"
|
|
49
|
+
:icon-size="item.iconSize || 24"
|
|
50
|
+
:horizontal="item.horizontal !== undefined ? item.horizontal : true"
|
|
51
|
+
:show-zero-count="item.showZeroCount !== undefined ? item.showZeroCount : true"
|
|
52
|
+
:breakdown="item.breakdown || null"
|
|
53
|
+
:route="item.route || null"
|
|
54
|
+
:clickable="item.clickable || false"
|
|
55
|
+
:loading="item.loading || false"
|
|
56
|
+
@click="$emit('stat-click', { section: section.id, item, index })">
|
|
57
|
+
<template v-if="typeof item.icon === 'string'" #icon>
|
|
58
|
+
<CnIcon :name="item.icon" :size="item.iconSize || 24" />
|
|
59
|
+
</template>
|
|
60
|
+
</CnStatsBlock>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<!-- Grid layout -->
|
|
64
|
+
<CnKpiGrid
|
|
65
|
+
v-else-if="section.layout === 'grid'"
|
|
66
|
+
grid-class="remove-margin"
|
|
67
|
+
:columns="section.columns || 2">
|
|
68
|
+
<CnStatsBlock
|
|
69
|
+
v-for="(item, index) in section.items"
|
|
70
|
+
:key="index"
|
|
71
|
+
:title="item.title"
|
|
72
|
+
:count="item.count"
|
|
73
|
+
:count-label="item.countLabel"
|
|
74
|
+
:variant="item.variant || 'default'"
|
|
75
|
+
:icon="isComponentIcon(item.icon) ? item.icon : null"
|
|
76
|
+
:icon-size="item.iconSize || 24"
|
|
77
|
+
:horizontal="item.horizontal !== undefined ? item.horizontal : false"
|
|
78
|
+
:show-zero-count="item.showZeroCount !== undefined ? item.showZeroCount : true"
|
|
79
|
+
:breakdown="item.breakdown || null"
|
|
80
|
+
:route="item.route || null"
|
|
81
|
+
:clickable="item.clickable || false"
|
|
82
|
+
:loading="item.loading || false"
|
|
83
|
+
@click="$emit('stat-click', { section: section.id, item, index })">
|
|
84
|
+
<template v-if="typeof item.icon === 'string'" #icon>
|
|
85
|
+
<CnIcon :name="item.icon" :size="item.iconSize || 24" />
|
|
86
|
+
</template>
|
|
87
|
+
</CnStatsBlock>
|
|
88
|
+
</CnKpiGrid>
|
|
89
|
+
</slot>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<!-- Progress section -->
|
|
93
|
+
<template v-else-if="section.type === 'progress'">
|
|
94
|
+
<slot :name="'section-' + section.id" :section="section">
|
|
95
|
+
<CnProgressBar
|
|
96
|
+
:items="section.items"
|
|
97
|
+
:variant="section.variant || 'primary'"
|
|
98
|
+
:bar-height="section.barHeight || 8"
|
|
99
|
+
:rounded="section.rounded !== undefined ? section.rounded : true"
|
|
100
|
+
:show-percentage="section.showPercentage || false" />
|
|
101
|
+
</slot>
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<!-- List section -->
|
|
105
|
+
<template v-else-if="section.type === 'list'">
|
|
106
|
+
<slot :name="'section-' + section.id" :section="section">
|
|
107
|
+
<div class="cn-stats-panel__list">
|
|
108
|
+
<NcListItem
|
|
109
|
+
v-for="item in section.items"
|
|
110
|
+
:key="item.key"
|
|
111
|
+
:name="item.name"
|
|
112
|
+
:bold="item.bold || false"
|
|
113
|
+
@click="$emit('list-click', { section: section.id, item })">
|
|
114
|
+
<template #icon>
|
|
115
|
+
<slot :name="'item-icon-' + section.id" :item="item">
|
|
116
|
+
<CnIcon
|
|
117
|
+
v-if="typeof item.icon === 'string'"
|
|
118
|
+
:name="item.icon"
|
|
119
|
+
:size="item.iconSize || 32" />
|
|
120
|
+
<component
|
|
121
|
+
:is="item.icon"
|
|
122
|
+
v-else-if="item.icon"
|
|
123
|
+
:size="item.iconSize || 32" />
|
|
124
|
+
</slot>
|
|
125
|
+
</template>
|
|
126
|
+
<template #subname>
|
|
127
|
+
<slot :name="'item-subname-' + section.id" :item="item">
|
|
128
|
+
{{ item.subname }}
|
|
129
|
+
</slot>
|
|
130
|
+
</template>
|
|
131
|
+
</NcListItem>
|
|
132
|
+
</div>
|
|
133
|
+
</slot>
|
|
134
|
+
</template>
|
|
135
|
+
</div>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<!-- Footer slot -->
|
|
139
|
+
<div v-if="$slots.footer" class="cn-stats-panel__footer">
|
|
140
|
+
<slot name="footer" />
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
147
|
+
import { NcLoadingIcon, NcListItem } from '@nextcloud/vue'
|
|
148
|
+
import { CnStatsBlock } from '../CnStatsBlock/index.js'
|
|
149
|
+
import { CnKpiGrid } from '../CnKpiGrid/index.js'
|
|
150
|
+
import { CnIcon } from '../CnIcon/index.js'
|
|
151
|
+
import { CnProgressBar } from '../CnProgressBar/index.js'
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* CnStatsPanel — Configurable statistics panel with sections of stat blocks and list items.
|
|
155
|
+
*
|
|
156
|
+
* Renders statistics content from a declarative sections array. Each section can be
|
|
157
|
+
* either a 'stats' section (renders CnStatsBlocks in stack or grid layout) or a
|
|
158
|
+
* 'list' section (renders NcListItems). Suitable for sidebar tabs, dashboard widgets,
|
|
159
|
+
* or any panel that displays statistics.
|
|
160
|
+
*
|
|
161
|
+
* @example Stats stack (vertical)
|
|
162
|
+
* <CnStatsPanel :sections="[{
|
|
163
|
+
* type: 'stats',
|
|
164
|
+
* id: 'totals',
|
|
165
|
+
* title: 'System Totals',
|
|
166
|
+
* layout: 'stack',
|
|
167
|
+
* items: [
|
|
168
|
+
* { title: 'Objects', count: 42, countLabel: 'objects', variant: 'primary', icon: PackageIcon },
|
|
169
|
+
* { title: 'Files', count: 128, countLabel: 'files', icon: FileIcon },
|
|
170
|
+
* ],
|
|
171
|
+
* }]" />
|
|
172
|
+
*
|
|
173
|
+
* @example Stats grid (2-column)
|
|
174
|
+
* <CnStatsPanel :sections="[{
|
|
175
|
+
* type: 'stats',
|
|
176
|
+
* id: 'operations',
|
|
177
|
+
* title: 'Operations',
|
|
178
|
+
* layout: 'grid',
|
|
179
|
+
* columns: 2,
|
|
180
|
+
* items: [
|
|
181
|
+
* { title: 'Create', count: 10, countLabel: 'ops', variant: 'success', icon: PlusIcon },
|
|
182
|
+
* { title: 'Delete', count: 3, countLabel: 'ops', variant: 'error', icon: DeleteIcon },
|
|
183
|
+
* ],
|
|
184
|
+
* }]" />
|
|
185
|
+
*
|
|
186
|
+
* @example List section
|
|
187
|
+
* <CnStatsPanel :sections="[{
|
|
188
|
+
* type: 'list',
|
|
189
|
+
* id: 'topObjects',
|
|
190
|
+
* title: 'Most Active',
|
|
191
|
+
* items: [
|
|
192
|
+
* { key: '1', name: 'Object A', subname: '42 entries', icon: CogIcon },
|
|
193
|
+
* ],
|
|
194
|
+
* }]" />
|
|
195
|
+
*
|
|
196
|
+
* @example With header slot for filters
|
|
197
|
+
* <CnStatsPanel :sections="sections">
|
|
198
|
+
* <template #header>
|
|
199
|
+
* <NcSelect v-bind="registerOptions" />
|
|
200
|
+
* </template>
|
|
201
|
+
* </CnStatsPanel>
|
|
202
|
+
*/
|
|
203
|
+
export default {
|
|
204
|
+
name: 'CnStatsPanel',
|
|
205
|
+
|
|
206
|
+
components: {
|
|
207
|
+
NcLoadingIcon,
|
|
208
|
+
NcListItem,
|
|
209
|
+
CnStatsBlock,
|
|
210
|
+
CnKpiGrid,
|
|
211
|
+
CnIcon,
|
|
212
|
+
CnProgressBar,
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
props: {
|
|
216
|
+
/**
|
|
217
|
+
* Array of section definitions to render.
|
|
218
|
+
* Each section has a `type` of 'stats', 'list', or 'progress'.
|
|
219
|
+
*
|
|
220
|
+
* Stats sections: `{ type: 'stats', id, title, layout: 'stack'|'grid', columns?, loading?, items: StatItem[] }`
|
|
221
|
+
* List sections: `{ type: 'list', id, title, loading?, items: ListItem[] }`
|
|
222
|
+
* Progress sections: `{ type: 'progress', id, title, variant?, barHeight?, rounded?, showPercentage?, loading?, items: ProgressItem[] }`
|
|
223
|
+
*
|
|
224
|
+
* StatItem: `{ title, count, countLabel, variant?, icon?, iconSize?, horizontal?, showZeroCount?, breakdown?, route?, clickable?, loading? }`
|
|
225
|
+
* ListItem: `{ key, name, subname?, bold?, icon?, iconSize? }`
|
|
226
|
+
* ProgressItem: `{ key?, label, count?, percentage?, variant?, tooltip? }`
|
|
227
|
+
*/
|
|
228
|
+
sections: {
|
|
229
|
+
type: Array,
|
|
230
|
+
default: () => [],
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/** Whether the entire panel is in a loading state */
|
|
234
|
+
loading: {
|
|
235
|
+
type: Boolean,
|
|
236
|
+
default: false,
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
/** Label shown during loading state */
|
|
240
|
+
loadingLabel: {
|
|
241
|
+
type: String,
|
|
242
|
+
default: () => t('nextcloud-vue', 'Loading...'),
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
/** Default text shown when a section has no items. Can be overridden per section via `section.emptyLabel`. */
|
|
246
|
+
emptyLabel: {
|
|
247
|
+
type: String,
|
|
248
|
+
default: () => t('nextcloud-vue', 'No data available'),
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
emits: ['stat-click', 'list-click', 'progress-click'],
|
|
253
|
+
|
|
254
|
+
methods: {
|
|
255
|
+
/**
|
|
256
|
+
* Check if an icon value is a component reference (not a string name).
|
|
257
|
+
* @param {*} icon - Icon value to check
|
|
258
|
+
* @return {boolean}
|
|
259
|
+
*/
|
|
260
|
+
isComponentIcon(icon) {
|
|
261
|
+
return icon != null && typeof icon !== 'string'
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
</script>
|
|
266
|
+
|
|
267
|
+
<style scoped>
|
|
268
|
+
.cn-stats-panel__section {
|
|
269
|
+
padding: 12px 0;
|
|
270
|
+
border-bottom: 1px solid var(--color-border);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.remove-margin {
|
|
274
|
+
margin: 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.cn-stats-panel__section:last-child {
|
|
278
|
+
border-bottom: none;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.cn-stats-panel__section-title {
|
|
282
|
+
color: var(--color-text-maxcontrast);
|
|
283
|
+
font-size: 14px;
|
|
284
|
+
font-weight: bold;
|
|
285
|
+
padding: 0 16px;
|
|
286
|
+
margin: 0 0 12px 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.cn-stats-panel__stack {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-direction: column;
|
|
292
|
+
gap: 12px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.cn-stats-panel__loading {
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
gap: 8px;
|
|
299
|
+
padding: 0 16px;
|
|
300
|
+
color: var(--color-text-maxcontrast);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.cn-stats-panel__empty {
|
|
304
|
+
padding: 0 16px;
|
|
305
|
+
color: var(--color-text-maxcontrast);
|
|
306
|
+
font-style: italic;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.cn-stats-panel__header {
|
|
310
|
+
padding-bottom: 12px;
|
|
311
|
+
border-bottom: 1px solid var(--color-border);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.cn-stats-panel__footer {
|
|
315
|
+
padding-top: 12px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.cn-stats-panel__list {
|
|
319
|
+
margin-top: 4px;
|
|
320
|
+
}
|
|
321
|
+
</style>
|