@conduction/nextcloud-vue 0.1.0-beta.1
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.js +10710 -0
- package/dist/nextcloud-vue.cjs.js.map +1 -0
- package/dist/nextcloud-vue.css +803 -0
- package/dist/nextcloud-vue.esm.js +10665 -0
- package/dist/nextcloud-vue.esm.js.map +1 -0
- package/package.json +63 -0
- package/src/components/CnCardGrid/CnCardGrid.vue +152 -0
- package/src/components/CnCardGrid/index.js +1 -0
- package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -0
- package/src/components/CnCellRenderer/index.js +1 -0
- package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -0
- package/src/components/CnConfigurationCard/index.js +1 -0
- package/src/components/CnDataTable/CnDataTable.vue +354 -0
- package/src/components/CnDataTable/index.js +1 -0
- package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +88 -0
- package/src/components/CnDetailViewLayout/index.js +1 -0
- package/src/components/CnEmptyState/CnEmptyState.vue +78 -0
- package/src/components/CnEmptyState/index.js +1 -0
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +223 -0
- package/src/components/CnFacetSidebar/index.js +1 -0
- package/src/components/CnFilterBar/CnFilterBar.vue +152 -0
- package/src/components/CnFilterBar/index.js +1 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +682 -0
- package/src/components/CnIndexPage/index.js +1 -0
- package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -0
- package/src/components/CnKpiGrid/index.js +1 -0
- package/src/components/CnListViewLayout/CnListViewLayout.vue +80 -0
- package/src/components/CnListViewLayout/index.js +1 -0
- package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -0
- package/src/components/CnMassActionBar/index.js +1 -0
- package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -0
- package/src/components/CnMassCopyDialog/index.js +1 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -0
- package/src/components/CnMassDeleteDialog/index.js +1 -0
- package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -0
- package/src/components/CnMassExportDialog/index.js +1 -0
- package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -0
- package/src/components/CnMassImportDialog/index.js +1 -0
- package/src/components/CnObjectCard/CnObjectCard.vue +292 -0
- package/src/components/CnObjectCard/index.js +1 -0
- package/src/components/CnPagination/CnPagination.vue +252 -0
- package/src/components/CnPagination/index.js +1 -0
- package/src/components/CnRowActions/CnRowActions.vue +73 -0
- package/src/components/CnRowActions/index.js +1 -0
- package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -0
- package/src/components/CnSettingsCard/index.js +1 -0
- package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -0
- package/src/components/CnSettingsSection/index.js +1 -0
- package/src/components/CnStatsBlock/CnStatsBlock.vue +366 -0
- package/src/components/CnStatsBlock/index.js +1 -0
- package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -0
- package/src/components/CnStatusBadge/index.js +1 -0
- package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -0
- package/src/components/CnVersionInfoCard/index.js +1 -0
- package/src/components/CnViewModeToggle/CnViewModeToggle.vue +77 -0
- package/src/components/CnViewModeToggle/index.js +1 -0
- package/src/components/index.js +25 -0
- package/src/composables/index.js +3 -0
- package/src/composables/useDetailView.js +132 -0
- package/src/composables/useListView.js +153 -0
- package/src/composables/useSubResource.js +142 -0
- package/src/css/badge.css +51 -0
- package/src/css/card.css +128 -0
- package/src/css/detail.css +68 -0
- package/src/css/index.css +8 -0
- package/src/css/layout.css +90 -0
- package/src/css/pagination.css +72 -0
- package/src/css/table.css +143 -0
- package/src/css/utilities.css +46 -0
- package/src/index.js +50 -0
- package/src/store/createSubResourcePlugin.js +135 -0
- package/src/store/index.js +3 -0
- package/src/store/plugins/auditTrails.js +17 -0
- package/src/store/plugins/files.js +186 -0
- package/src/store/plugins/index.js +4 -0
- package/src/store/plugins/lifecycle.js +180 -0
- package/src/store/plugins/relations.js +68 -0
- package/src/store/useObjectStore.js +625 -0
- package/src/types/auditTrail.d.ts +32 -0
- package/src/types/file.d.ts +23 -0
- package/src/types/index.d.ts +35 -0
- package/src/types/notification.d.ts +36 -0
- package/src/types/object.d.ts +40 -0
- package/src/types/organisation.d.ts +41 -0
- package/src/types/register.d.ts +25 -0
- package/src/types/schema.d.ts +39 -0
- package/src/types/shared.d.ts +79 -0
- package/src/types/source.d.ts +14 -0
- package/src/types/task.d.ts +31 -0
- package/src/utils/errors.js +96 -0
- package/src/utils/headers.js +44 -0
- package/src/utils/index.js +3 -0
- package/src/utils/schema.js +287 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CnSettingsCard } from './CnSettingsCard.vue'
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<NcSettingsSection
|
|
3
|
+
:name="name"
|
|
4
|
+
:description="description"
|
|
5
|
+
:doc-url="docUrl"
|
|
6
|
+
v-bind="$attrs">
|
|
7
|
+
<!-- Action buttons positioned top-right -->
|
|
8
|
+
<div v-if="$slots.actions" class="cn-settings-section__actions">
|
|
9
|
+
<slot name="actions" />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<!-- Section Description (optional detailed description box) -->
|
|
13
|
+
<div v-if="$slots.description || detailedDescription" class="cn-settings-section__description">
|
|
14
|
+
<slot name="description">
|
|
15
|
+
<p v-if="detailedDescription" class="cn-settings-section__description-text">
|
|
16
|
+
{{ detailedDescription }}
|
|
17
|
+
</p>
|
|
18
|
+
</slot>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<!-- Main Content -->
|
|
22
|
+
<div class="cn-settings-section__content">
|
|
23
|
+
<slot />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<!-- Loading State -->
|
|
27
|
+
<div v-if="loading" class="cn-settings-section__loading">
|
|
28
|
+
<NcLoadingIcon :size="32" />
|
|
29
|
+
<p>{{ loadingMessage }}</p>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<!-- Error State -->
|
|
33
|
+
<div v-if="error && !loading" class="cn-settings-section__error">
|
|
34
|
+
<p class="cn-settings-section__error-message">
|
|
35
|
+
{{ errorMessage }}
|
|
36
|
+
</p>
|
|
37
|
+
<NcButton v-if="onRetry" type="primary" @click="onRetry">
|
|
38
|
+
<template #icon>
|
|
39
|
+
<Refresh :size="20" />
|
|
40
|
+
</template>
|
|
41
|
+
{{ retryButtonText }}
|
|
42
|
+
</NcButton>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<!-- Empty State -->
|
|
46
|
+
<div v-if="empty && !loading && !error" class="cn-settings-section__empty">
|
|
47
|
+
<slot name="empty">
|
|
48
|
+
<div class="cn-settings-section__empty-content">
|
|
49
|
+
<InformationOutline :size="48" />
|
|
50
|
+
<p>{{ emptyMessage }}</p>
|
|
51
|
+
</div>
|
|
52
|
+
</slot>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<!-- Footer Actions -->
|
|
56
|
+
<div v-if="$slots.footer" class="cn-settings-section__footer">
|
|
57
|
+
<slot name="footer" />
|
|
58
|
+
</div>
|
|
59
|
+
</NcSettingsSection>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
import { NcSettingsSection, NcLoadingIcon, NcButton } from '@nextcloud/vue'
|
|
64
|
+
import Refresh from 'vue-material-design-icons/Refresh.vue'
|
|
65
|
+
import InformationOutline from 'vue-material-design-icons/InformationOutline.vue'
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* CnSettingsSection - Admin settings section wrapper with consistent layout.
|
|
69
|
+
*
|
|
70
|
+
* Wraps NcSettingsSection with action buttons (top-right), loading/error/empty
|
|
71
|
+
* states, and a footer slot. Use this as the container for each section on an
|
|
72
|
+
* admin settings page.
|
|
73
|
+
*
|
|
74
|
+
* Extracted from OpenRegister's SettingsSection. Designed for reuse across all
|
|
75
|
+
* Conduction Nextcloud apps.
|
|
76
|
+
*
|
|
77
|
+
* @example Basic usage
|
|
78
|
+
* <CnSettingsSection name="Cache Management" description="Manage application caches">
|
|
79
|
+
* <template #actions>
|
|
80
|
+
* <NcButton @click="clearCache">Clear Cache</NcButton>
|
|
81
|
+
* </template>
|
|
82
|
+
* <p>Cache hit rate: 94%</p>
|
|
83
|
+
* </CnSettingsSection>
|
|
84
|
+
*
|
|
85
|
+
* @example With loading and error states
|
|
86
|
+
* <CnSettingsSection
|
|
87
|
+
* name="Statistics"
|
|
88
|
+
* :loading="isLoading"
|
|
89
|
+
* loading-message="Loading statistics..."
|
|
90
|
+
* :error="hasError"
|
|
91
|
+
* error-message="Failed to load statistics"
|
|
92
|
+
* :on-retry="loadStats">
|
|
93
|
+
* <StatsTable :data="stats" />
|
|
94
|
+
* </CnSettingsSection>
|
|
95
|
+
*
|
|
96
|
+
* @example With empty state
|
|
97
|
+
* <CnSettingsSection name="API Tokens" :empty="tokens.length === 0" empty-message="No tokens configured">
|
|
98
|
+
* <TokenList :tokens="tokens" />
|
|
99
|
+
* </CnSettingsSection>
|
|
100
|
+
*/
|
|
101
|
+
export default {
|
|
102
|
+
name: 'CnSettingsSection',
|
|
103
|
+
|
|
104
|
+
components: {
|
|
105
|
+
NcSettingsSection,
|
|
106
|
+
NcLoadingIcon,
|
|
107
|
+
NcButton,
|
|
108
|
+
Refresh,
|
|
109
|
+
InformationOutline,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
inheritAttrs: false,
|
|
113
|
+
|
|
114
|
+
props: {
|
|
115
|
+
/** Section name/title */
|
|
116
|
+
name: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: true,
|
|
119
|
+
},
|
|
120
|
+
/** Brief section description (shown under title by NcSettingsSection) */
|
|
121
|
+
description: {
|
|
122
|
+
type: String,
|
|
123
|
+
default: '',
|
|
124
|
+
},
|
|
125
|
+
/** Detailed description shown in a separate block below the title */
|
|
126
|
+
detailedDescription: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: '',
|
|
129
|
+
},
|
|
130
|
+
/** Documentation URL (shows info icon next to title) */
|
|
131
|
+
docUrl: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: '',
|
|
134
|
+
},
|
|
135
|
+
/** Whether the section is in a loading state */
|
|
136
|
+
loading: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false,
|
|
139
|
+
},
|
|
140
|
+
/** Message shown during loading */
|
|
141
|
+
loadingMessage: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: 'Loading...',
|
|
144
|
+
},
|
|
145
|
+
/** Whether the section is in an error state */
|
|
146
|
+
error: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false,
|
|
149
|
+
},
|
|
150
|
+
/** Message shown when in error state */
|
|
151
|
+
errorMessage: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: 'An error occurred',
|
|
154
|
+
},
|
|
155
|
+
/** Callback function for retry button (shown in error state). If null, no retry button is shown. */
|
|
156
|
+
onRetry: {
|
|
157
|
+
type: Function,
|
|
158
|
+
default: null,
|
|
159
|
+
},
|
|
160
|
+
/** Text for the retry button */
|
|
161
|
+
retryButtonText: {
|
|
162
|
+
type: String,
|
|
163
|
+
default: 'Retry',
|
|
164
|
+
},
|
|
165
|
+
/** Whether the section has no data to show */
|
|
166
|
+
empty: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: false,
|
|
169
|
+
},
|
|
170
|
+
/** Message shown when section is empty */
|
|
171
|
+
emptyMessage: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: 'No data available',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
</script>
|
|
178
|
+
|
|
179
|
+
<style scoped>
|
|
180
|
+
.cn-settings-section__actions {
|
|
181
|
+
display: flex;
|
|
182
|
+
gap: 0.5rem;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: flex-end;
|
|
185
|
+
float: right;
|
|
186
|
+
margin-top: -66px;
|
|
187
|
+
margin-bottom: 26px;
|
|
188
|
+
position: relative;
|
|
189
|
+
z-index: 10;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.cn-settings-section__content {
|
|
193
|
+
clear: both;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.cn-settings-section__description-text {
|
|
197
|
+
color: var(--color-text-maxcontrast);
|
|
198
|
+
margin-bottom: 16px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.cn-settings-section__loading {
|
|
202
|
+
display: flex;
|
|
203
|
+
flex-direction: column;
|
|
204
|
+
align-items: center;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
padding: 40px 20px;
|
|
207
|
+
gap: 16px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.cn-settings-section__loading p {
|
|
211
|
+
color: var(--color-text-maxcontrast);
|
|
212
|
+
font-size: 14px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.cn-settings-section__error {
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
align-items: center;
|
|
219
|
+
justify-content: center;
|
|
220
|
+
padding: 32px 20px;
|
|
221
|
+
gap: 16px;
|
|
222
|
+
background: var(--color-error-light);
|
|
223
|
+
border: 1px solid var(--color-error);
|
|
224
|
+
border-radius: var(--border-radius-large);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.cn-settings-section__error-message {
|
|
228
|
+
color: var(--color-error);
|
|
229
|
+
font-weight: 500;
|
|
230
|
+
margin: 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.cn-settings-section__empty {
|
|
234
|
+
padding: 40px 20px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.cn-settings-section__empty-content {
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-direction: column;
|
|
240
|
+
align-items: center;
|
|
241
|
+
gap: 16px;
|
|
242
|
+
color: var(--color-text-maxcontrast);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.cn-settings-section__empty-content p {
|
|
246
|
+
margin: 0;
|
|
247
|
+
font-size: 14px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.cn-settings-section__footer {
|
|
251
|
+
margin-top: 24px;
|
|
252
|
+
padding-top: 24px;
|
|
253
|
+
border-top: 1px solid var(--color-border);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@media (max-width: 768px) {
|
|
257
|
+
.cn-settings-section__actions {
|
|
258
|
+
position: static;
|
|
259
|
+
margin-top: 0;
|
|
260
|
+
margin-bottom: 1rem;
|
|
261
|
+
float: none;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
align-items: stretch;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CnSettingsSection } from './CnSettingsSection.vue'
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="clickable ? 'a' : 'div'"
|
|
4
|
+
class="cn-stats-block"
|
|
5
|
+
:class="rootClasses"
|
|
6
|
+
v-bind="clickable ? { href: '#', role: 'button', tabindex: '0' } : {}"
|
|
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 breakdown
|
|
74
|
+
* <CnStatsBlock
|
|
75
|
+
* title="Cases"
|
|
76
|
+
* :count="42"
|
|
77
|
+
* :breakdown="{ total: 100, invalid: 3, deleted: 5, published: 92 }" />
|
|
78
|
+
*
|
|
79
|
+
* @example Custom icon slot
|
|
80
|
+
* <CnStatsBlock title="Files" :count="128">
|
|
81
|
+
* <template #icon>
|
|
82
|
+
* <FileDocumentOutline :size="24" />
|
|
83
|
+
* </template>
|
|
84
|
+
* </CnStatsBlock>
|
|
85
|
+
*/
|
|
86
|
+
export default {
|
|
87
|
+
name: 'CnStatsBlock',
|
|
88
|
+
|
|
89
|
+
components: {
|
|
90
|
+
NcLoadingIcon,
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
props: {
|
|
94
|
+
/** Block title */
|
|
95
|
+
title: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: '',
|
|
98
|
+
},
|
|
99
|
+
/** The main count number to display prominently */
|
|
100
|
+
count: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 0,
|
|
103
|
+
},
|
|
104
|
+
/** Label displayed next to the count */
|
|
105
|
+
countLabel: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'objects',
|
|
108
|
+
},
|
|
109
|
+
/** Detailed breakdown object (key-value pairs) */
|
|
110
|
+
breakdown: {
|
|
111
|
+
type: Object,
|
|
112
|
+
default: null,
|
|
113
|
+
},
|
|
114
|
+
/** Whether data is currently loading */
|
|
115
|
+
loading: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: false,
|
|
118
|
+
},
|
|
119
|
+
/** Text shown while loading */
|
|
120
|
+
loadingLabel: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: 'Loading...',
|
|
123
|
+
},
|
|
124
|
+
/** Text shown when count is 0 */
|
|
125
|
+
emptyLabel: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'No items found',
|
|
128
|
+
},
|
|
129
|
+
/** Icon component (e.g., imported MDI icon) */
|
|
130
|
+
icon: {
|
|
131
|
+
type: [Object, Function],
|
|
132
|
+
default: null,
|
|
133
|
+
},
|
|
134
|
+
/** Icon size in pixels */
|
|
135
|
+
iconSize: {
|
|
136
|
+
type: Number,
|
|
137
|
+
default: 24,
|
|
138
|
+
},
|
|
139
|
+
/** Color variant: 'default', 'primary', 'success', 'warning', 'error' */
|
|
140
|
+
variant: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: 'default',
|
|
143
|
+
validator: (v) => ['default', 'primary', 'success', 'warning', 'error'].includes(v),
|
|
144
|
+
},
|
|
145
|
+
/** Use horizontal layout (icon left, content right) */
|
|
146
|
+
horizontal: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: false,
|
|
149
|
+
},
|
|
150
|
+
/** Whether the card is clickable */
|
|
151
|
+
clickable: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
computed: {
|
|
158
|
+
hasIcon() {
|
|
159
|
+
return this.icon !== null || this.$scopedSlots.icon || this.$slots.icon
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
formattedCount() {
|
|
163
|
+
return this.count.toLocaleString()
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
rootClasses() {
|
|
167
|
+
return {
|
|
168
|
+
'cn-stats-block--horizontal': this.horizontal,
|
|
169
|
+
'cn-stats-block--clickable': this.clickable,
|
|
170
|
+
[`cn-stats-block--${this.variant}`]: this.variant !== 'default',
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
iconClasses() {
|
|
175
|
+
return {
|
|
176
|
+
[`cn-stats-block__icon--${this.variant}`]: this.variant !== 'default',
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
methods: {
|
|
182
|
+
formatBreakdownLabel(key) {
|
|
183
|
+
return key.charAt(0).toUpperCase() + key.slice(1) + ':'
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
onClick(event) {
|
|
187
|
+
if (this.clickable) {
|
|
188
|
+
event.preventDefault()
|
|
189
|
+
this.$emit('click', event)
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<style scoped>
|
|
197
|
+
.cn-stats-block {
|
|
198
|
+
background: var(--color-background-hover);
|
|
199
|
+
border-radius: var(--border-radius-large, 10px);
|
|
200
|
+
padding: 1rem;
|
|
201
|
+
display: flex;
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
align-items: center;
|
|
204
|
+
text-decoration: none;
|
|
205
|
+
color: inherit;
|
|
206
|
+
border: 2px solid transparent;
|
|
207
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.cn-stats-block--horizontal {
|
|
211
|
+
flex-direction: row;
|
|
212
|
+
align-items: flex-start;
|
|
213
|
+
gap: 16px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.cn-stats-block--horizontal .cn-stats-block__content {
|
|
217
|
+
text-align: left;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cn-stats-block--horizontal .cn-stats-block__count {
|
|
221
|
+
justify-content: flex-start;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.cn-stats-block--clickable {
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.cn-stats-block--clickable:hover {
|
|
229
|
+
border-color: var(--color-primary-element);
|
|
230
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.cn-stats-block--clickable:focus-visible {
|
|
234
|
+
outline: 2px solid var(--color-primary-element);
|
|
235
|
+
outline-offset: 2px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* Icon */
|
|
239
|
+
.cn-stats-block__icon {
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
width: 44px;
|
|
244
|
+
height: 44px;
|
|
245
|
+
border-radius: 50%;
|
|
246
|
+
background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
|
|
247
|
+
color: var(--color-primary-element);
|
|
248
|
+
flex-shrink: 0;
|
|
249
|
+
margin-bottom: 8px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.cn-stats-block--horizontal .cn-stats-block__icon {
|
|
253
|
+
margin-bottom: 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.cn-stats-block__icon--primary {
|
|
257
|
+
background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
|
|
258
|
+
color: var(--color-primary-element);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.cn-stats-block__icon--success {
|
|
262
|
+
background: rgba(70, 186, 97, 0.1);
|
|
263
|
+
color: var(--color-success);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.cn-stats-block__icon--warning {
|
|
267
|
+
background: rgba(232, 163, 24, 0.1);
|
|
268
|
+
color: var(--color-warning);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.cn-stats-block__icon--error {
|
|
272
|
+
background: rgba(224, 36, 36, 0.1);
|
|
273
|
+
color: var(--color-error);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* Content */
|
|
277
|
+
.cn-stats-block__content {
|
|
278
|
+
flex: 1;
|
|
279
|
+
min-width: 0;
|
|
280
|
+
text-align: center;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.cn-stats-block__header h4 {
|
|
284
|
+
margin-top: 0;
|
|
285
|
+
margin-bottom: 0.5rem;
|
|
286
|
+
color: var(--color-main-text);
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
font-weight: 600;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.cn-stats-block__count {
|
|
292
|
+
display: flex;
|
|
293
|
+
align-items: baseline;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
gap: 0.5rem;
|
|
296
|
+
font-size: 1.2rem;
|
|
297
|
+
margin-bottom: 0.5rem;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.cn-stats-block__count-value {
|
|
301
|
+
font-size: 2rem;
|
|
302
|
+
font-weight: bold;
|
|
303
|
+
color: var(--color-primary-element);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.cn-stats-block--primary .cn-stats-block__count-value { color: var(--color-primary-element); }
|
|
307
|
+
.cn-stats-block--success .cn-stats-block__count-value { color: var(--color-success); }
|
|
308
|
+
.cn-stats-block--warning .cn-stats-block__count-value { color: var(--color-warning); }
|
|
309
|
+
.cn-stats-block--error .cn-stats-block__count-value { color: var(--color-error); }
|
|
310
|
+
|
|
311
|
+
.cn-stats-block__count-label {
|
|
312
|
+
color: var(--color-text-maxcontrast);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.cn-stats-block__loading {
|
|
316
|
+
display: flex;
|
|
317
|
+
align-items: center;
|
|
318
|
+
justify-content: center;
|
|
319
|
+
gap: 0.5rem;
|
|
320
|
+
color: var(--color-text-maxcontrast);
|
|
321
|
+
margin-bottom: 0.5rem;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.cn-stats-block__empty {
|
|
325
|
+
text-align: center;
|
|
326
|
+
color: var(--color-text-maxcontrast);
|
|
327
|
+
font-style: italic;
|
|
328
|
+
margin-bottom: 0.5rem;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.cn-stats-block__breakdown {
|
|
332
|
+
margin-top: 0.5rem;
|
|
333
|
+
padding: 0.75rem;
|
|
334
|
+
background: var(--color-background-hover);
|
|
335
|
+
border-radius: var(--border-radius);
|
|
336
|
+
border: 1px solid var(--color-border);
|
|
337
|
+
width: 100%;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.cn-stats-block__breakdown-item {
|
|
341
|
+
display: flex;
|
|
342
|
+
justify-content: space-between;
|
|
343
|
+
align-items: center;
|
|
344
|
+
margin-bottom: 0.5rem;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.cn-stats-block__breakdown-item:last-child {
|
|
348
|
+
margin-bottom: 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.cn-stats-block__breakdown-label {
|
|
352
|
+
font-weight: 500;
|
|
353
|
+
color: var(--color-main-text);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.cn-stats-block__breakdown-value {
|
|
357
|
+
font-weight: 600;
|
|
358
|
+
padding: 0.25rem 0.5rem;
|
|
359
|
+
border-radius: var(--border-radius);
|
|
360
|
+
background: var(--color-background-hover);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.cn-stats-block__breakdown-value--invalid { color: var(--color-warning); }
|
|
364
|
+
.cn-stats-block__breakdown-value--deleted { color: var(--color-error); }
|
|
365
|
+
.cn-stats-block__breakdown-value--published { color: var(--color-success); }
|
|
366
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CnStatsBlock } from './CnStatsBlock.vue'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="cn-status-badge"
|
|
4
|
+
:class="badgeClasses">
|
|
5
|
+
<slot>{{ label }}</slot>
|
|
6
|
+
</span>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
/**
|
|
11
|
+
* CnStatusBadge — Color-coded pill badge for status, priority, or category display.
|
|
12
|
+
*
|
|
13
|
+
* Replaces the various .status-badge / .priority-badge CSS patterns duplicated
|
|
14
|
+
* across Pipelinq and Procest. Supports a colorMap for automatic variant lookup.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <CnStatusBadge label="Open" variant="success" />
|
|
18
|
+
* <CnStatusBadge label="Urgent" variant="error" size="small" />
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <!-- With colorMap: variant auto-resolved from label -->
|
|
22
|
+
* <CnStatusBadge
|
|
23
|
+
* label="overdue"
|
|
24
|
+
* :color-map="{ open: 'success', closed: 'default', overdue: 'error' }" />
|
|
25
|
+
*/
|
|
26
|
+
export default {
|
|
27
|
+
name: 'CnStatusBadge',
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
/** Badge label text */
|
|
31
|
+
label: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '',
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Color variant: 'default', 'primary', 'success', 'warning', 'error', 'info'
|
|
37
|
+
*/
|
|
38
|
+
variant: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'default',
|
|
41
|
+
validator: (v) => ['default', 'primary', 'success', 'warning', 'error', 'info'].includes(v),
|
|
42
|
+
},
|
|
43
|
+
/** Size: 'small' or 'medium' */
|
|
44
|
+
size: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'medium',
|
|
47
|
+
validator: (v) => ['small', 'medium'].includes(v),
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Map of label values to variants. When provided, the variant is resolved
|
|
51
|
+
* from this map using the label (case-insensitive). Falls back to the variant prop.
|
|
52
|
+
* @example { open: 'success', closed: 'default', overdue: 'error' }
|
|
53
|
+
*/
|
|
54
|
+
colorMap: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
computed: {
|
|
61
|
+
resolvedVariant() {
|
|
62
|
+
if (this.colorMap && this.label) {
|
|
63
|
+
const key = this.label.toLowerCase()
|
|
64
|
+
return this.colorMap[key] || this.variant
|
|
65
|
+
}
|
|
66
|
+
return this.variant
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
badgeClasses() {
|
|
70
|
+
return {
|
|
71
|
+
['cn-status-badge--' + this.resolvedVariant]: true,
|
|
72
|
+
'cn-status-badge--small': this.size === 'small',
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CnStatusBadge } from './CnStatusBadge.vue'
|