@conduction/nextcloud-vue 2.100.0 → 2.101.0

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 (127) hide show
  1. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue.js +1 -1
  2. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js +22 -1
  3. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js.map +1 -1
  4. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js +26 -16
  5. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js.map +1 -1
  6. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  7. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +51 -7
  8. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  9. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +104 -73
  10. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  11. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js +9 -0
  12. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js.map +1 -0
  13. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js +139 -0
  14. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js.map +1 -0
  15. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js +76 -0
  16. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js.map +1 -0
  17. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
  18. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +160 -2
  19. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
  20. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +206 -94
  21. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
  22. package/dist/esm/components/CnFilesBrowser/filesReview.js +61 -0
  23. package/dist/esm/components/CnFilesBrowser/filesReview.js.map +1 -0
  24. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js +9 -0
  25. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js.map +1 -0
  26. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js +279 -0
  27. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js.map +1 -0
  28. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js +122 -0
  29. package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js.map +1 -0
  30. package/dist/esm/components/CnGroupedCardsWidget/index.js +29 -0
  31. package/dist/esm/components/CnGroupedCardsWidget/index.js.map +1 -0
  32. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +251 -71
  33. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  34. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +317 -209
  35. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  36. package/dist/esm/components/CnIndexPage/useNamedSource.js +4 -1
  37. package/dist/esm/components/CnIndexPage/useNamedSource.js.map +1 -1
  38. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  39. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +15 -0
  40. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  41. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  42. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue.js +1 -1
  43. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +14 -1
  44. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
  45. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js +14 -6
  46. package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
  47. package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue.js +1 -1
  48. package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js +10 -0
  49. package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js.map +1 -1
  50. package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js +6 -1
  51. package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js.map +1 -1
  52. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue.js +1 -1
  53. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js +91 -4
  54. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js.map +1 -1
  55. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js +63 -38
  56. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js.map +1 -1
  57. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue.js +9 -0
  58. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue.js.map +1 -0
  59. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue2.js +175 -0
  60. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue2.js.map +1 -0
  61. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue3.js +77 -0
  62. package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue3.js.map +1 -0
  63. package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue.js +1 -1
  64. package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue2.js +35 -2
  65. package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue2.js.map +1 -1
  66. package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue3.js.map +1 -1
  67. package/dist/esm/components/CnWidgetGrid/builtInWidgets.js +4 -0
  68. package/dist/esm/components/CnWidgetGrid/builtInWidgets.js.map +1 -1
  69. package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
  70. package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
  71. package/dist/esm/composables/indexSources.js +167 -20
  72. package/dist/esm/composables/indexSources.js.map +1 -1
  73. package/dist/esm/composables/useEndpointSource.js +28 -6
  74. package/dist/esm/composables/useEndpointSource.js.map +1 -1
  75. package/dist/esm/index.js +1 -0
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/l10n/en.json.js +37 -1
  78. package/dist/esm/l10n/en.json.js.map +1 -1
  79. package/dist/esm/l10n/nl.json.js +35 -1
  80. package/dist/esm/l10n/nl.json.js.map +1 -1
  81. package/dist/esm/library-style.js +1 -1
  82. package/dist/esm/nextcloud-vue.css +769 -251
  83. package/dist/esm/utils/languageMapText.js +50 -0
  84. package/dist/esm/utils/languageMapText.js.map +1 -0
  85. package/dist/esm/utils/libraryWidgetKeys.js +3 -0
  86. package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
  87. package/dist/esm/utils/mapList.js +71 -0
  88. package/dist/esm/utils/mapList.js.map +1 -0
  89. package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
  90. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  91. package/dist/nextcloud-vue.cjs.js +8977 -6843
  92. package/dist/nextcloud-vue.cjs.js.map +2 -2
  93. package/dist/nextcloud-vue.css +769 -251
  94. package/l10n/en.json +37 -1
  95. package/l10n/nl.json +35 -1
  96. package/package.json +1 -1
  97. package/src/components/CnChoiceCards/CnChoiceCards.md +39 -0
  98. package/src/components/CnChoiceCards/CnChoiceCards.vue +93 -16
  99. package/src/components/CnDashboardPage/CnDashboardPage.vue +89 -20
  100. package/src/components/CnExportsWidget/CnExportsWidget.vue +233 -0
  101. package/src/components/CnExportsWidget/index.js +7 -0
  102. package/src/components/CnFilesBrowser/CnFilesBrowser.vue +324 -0
  103. package/src/components/CnFilesBrowser/filesReview.js +57 -0
  104. package/src/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue +433 -0
  105. package/src/components/CnGroupedCardsWidget/index.js +28 -0
  106. package/src/components/CnIndexPage/CnIndexPage.vue +240 -4
  107. package/src/components/CnIndexPage/useNamedSource.js +4 -1
  108. package/src/components/CnMapWidget/CnMapWidget.vue +37 -0
  109. package/src/components/CnObjectListWidget/CnObjectListWidget.vue +29 -1
  110. package/src/components/CnObjectSidebar/CnFilesTab.vue +15 -0
  111. package/src/components/CnOrderedListField/CnOrderedListField.vue +151 -5
  112. package/src/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue +272 -0
  113. package/src/components/CnSavedViewAlertWidget/index.js +7 -0
  114. package/src/components/CnSetupWizard/CnSetupWizard.vue +35 -2
  115. package/src/components/CnWidgetGrid/builtInWidgets.js +4 -0
  116. package/src/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
  117. package/src/components/index.js +3 -0
  118. package/src/composables/indexSources.js +166 -19
  119. package/src/composables/useEndpointSource.js +28 -6
  120. package/src/css/index-page.css +117 -0
  121. package/src/css/look-board.css +44 -0
  122. package/src/index.js +1 -0
  123. package/src/schemas/app-manifest-v2.schema.json +31 -1
  124. package/src/utils/languageMapText.js +46 -0
  125. package/src/utils/libraryWidgetKeys.js +3 -0
  126. package/src/utils/mapList.js +67 -0
  127. package/src/utils/validateManifestV2.compiled.js +3 -3
@@ -0,0 +1,57 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+ import { fileColumnValue } from './filesBrowserColumns.js'
6
+
7
+ /** The tones a review segment may take; anything else draws as `default`. */
8
+ const TONES = ['success', 'warning', 'error', 'info', 'default']
9
+
10
+ /**
11
+ * The review summary of a file list (DqZaakDocumenten "4 van 7 beoordeeld"):
12
+ * how many files carry each review value, read from the host's row data.
13
+ *
14
+ * `spec` is `{ key, open, values: [{ value, label?, tone? }] }`: `key` is the
15
+ * row-data field that holds the review state, `open` the value (or values) of
16
+ * a file still to review. A file with no value, or one not listed, counts as
17
+ * open. Values compare without case.
18
+ *
19
+ * @param {object} spec The summary declaration.
20
+ * @param {Array<object>} nodes The file nodes (folders already left out).
21
+ * @param {object|null} rowData The host's row data, by file id.
22
+ * @return {{total: number, done: number, open: number, segments: Array<{value: string, label: string, tone: string, count: number, share: number}>}|null}
23
+ * The counts, or null when the declaration names no key or no values.
24
+ */
25
+ export function reviewSummary(spec, nodes, rowData) {
26
+ if (!spec || typeof spec !== 'object' || typeof spec.key !== 'string' || spec.key === '' || !Array.isArray(spec.values) || spec.values.length === 0) {
27
+ return null
28
+ }
29
+ const files = Array.isArray(nodes) ? nodes : []
30
+ const openValues = (Array.isArray(spec.open) ? spec.open : [spec.open]).filter((v) => v !== undefined && v !== null).map((v) => String(v).toLowerCase())
31
+ const segments = spec.values
32
+ .filter((entry) => entry && entry.value !== undefined && entry.value !== null)
33
+ .map((entry) => ({
34
+ value: String(entry.value),
35
+ label: typeof entry.label === 'string' && entry.label !== '' ? entry.label : String(entry.value),
36
+ tone: TONES.includes(entry.tone) ? entry.tone : 'default',
37
+ count: 0,
38
+ share: 0,
39
+ }))
40
+ let open = 0
41
+ for (const node of files) {
42
+ const raw = fileColumnValue({ key: spec.key, source: 'row' }, node, rowData)
43
+ const value = raw === null || raw === undefined ? '' : String(raw).toLowerCase()
44
+ const segment = segments.find((s) => s.value.toLowerCase() === value)
45
+ if (segment) {
46
+ segment.count++
47
+ }
48
+ if (!segment || openValues.includes(value)) {
49
+ open++
50
+ }
51
+ }
52
+ const total = files.length
53
+ for (const segment of segments) {
54
+ segment.share = total > 0 ? Math.round((segment.count / total) * 1000) / 10 : 0
55
+ }
56
+ return { total, done: total - open, open, segments }
57
+ }
@@ -0,0 +1,433 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ - SPDX-License-Identifier: EUPL-1.2
4
+ -->
5
+
6
+ <template>
7
+ <div class="cn-grouped-cards" data-testid="cn-grouped-cards">
8
+ <p v-if="error" class="cn-grouped-cards__state" data-testid="cn-grouped-cards-error">
9
+ {{ errorLabel }}
10
+ </p>
11
+ <div v-else-if="loading && groups.length === 0" class="cn-grouped-cards__loading">
12
+ <NcLoadingIcon :size="20" :name="loadingLabel" />
13
+ </div>
14
+ <p v-else-if="groups.length === 0 && !extra" class="cn-grouped-cards__state" data-testid="cn-grouped-cards-empty">
15
+ {{ emptyLabel }}
16
+ </p>
17
+ <div
18
+ v-else
19
+ class="cn-grouped-cards__grid"
20
+ :style="{ '--cn-grouped-cards-columns': columns }">
21
+ <section
22
+ v-for="group in groups"
23
+ :key="group.key"
24
+ class="cn-grouped-cards__group"
25
+ :aria-labelledby="group.headingId"
26
+ data-testid="cn-grouped-cards-group">
27
+ <header class="cn-grouped-cards__group-header">
28
+ <h4 :id="group.headingId" class="cn-grouped-cards__group-title">
29
+ {{ group.title }}
30
+ </h4>
31
+ <span v-if="group.count" class="cn-grouped-cards__count" data-testid="cn-grouped-cards-count">{{ group.count }}</span>
32
+ </header>
33
+ <ul v-if="group.items.length > 0" class="cn-grouped-cards__items">
34
+ <li
35
+ v-for="item in group.items"
36
+ :key="item.key"
37
+ class="cn-grouped-cards__item"
38
+ data-testid="cn-grouped-cards-item">
39
+ <span class="cn-grouped-cards__item-title">{{ item.title }}</span>
40
+ <span v-if="item.meta" class="cn-grouped-cards__item-meta">{{ item.meta }}</span>
41
+ </li>
42
+ </ul>
43
+ <p v-else class="cn-grouped-cards__group-empty">
44
+ {{ groupEmptyLabel }}
45
+ </p>
46
+ </section>
47
+ <section
48
+ v-if="extra"
49
+ class="cn-grouped-cards__group cn-grouped-cards__group--extra"
50
+ :aria-labelledby="extra.headingId"
51
+ data-testid="cn-grouped-cards-extra">
52
+ <header class="cn-grouped-cards__group-header">
53
+ <h4 :id="extra.headingId" class="cn-grouped-cards__group-title">
54
+ {{ extra.title }}
55
+ </h4>
56
+ </header>
57
+ <p class="cn-grouped-cards__extra-text">
58
+ {{ extra.text }}
59
+ </p>
60
+ </section>
61
+ </div>
62
+ </div>
63
+ </template>
64
+
65
+ <script>
66
+ import { translate as t } from '@nextcloud/l10n'
67
+ import { NcLoadingIcon } from '@nextcloud/vue'
68
+ import { inject, ref } from 'vue'
69
+ import { useEndpointSource } from '../../composables/useEndpointSource.js'
70
+ import { fillTemplate } from '../../utils/fillTemplate.js'
71
+ import { unwrapAppConfig } from '../../utils/formatMetric.js'
72
+ import { languageMapText } from '../../utils/languageMapText.js'
73
+ import { readPath } from '../../utils/readPath.js'
74
+
75
+ let uid = 0
76
+
77
+ /**
78
+ * Unwrap a value that may be a ref.
79
+ *
80
+ * @param {unknown} value The value.
81
+ * @return {unknown} The plain value.
82
+ */
83
+ function unwrap(value) {
84
+ return value && typeof value === 'object' && 'value' in value ? value.value : value
85
+ }
86
+
87
+ /**
88
+ * A row as the templates read it: a language map (`{ nl, en }`) becomes its
89
+ * text in the user's language, and a list of plain values is joined with ", ".
90
+ * Nested objects stay as they are, for a template that reads a deeper path.
91
+ *
92
+ * @param {object} row The row.
93
+ * @return {object} A shallow copy with readable values.
94
+ */
95
+ function readable(row) {
96
+ if (!row || typeof row !== 'object') {
97
+ return {}
98
+ }
99
+ const out = {}
100
+ for (const [key, value] of Object.entries(row)) {
101
+ if (Array.isArray(value)) {
102
+ const plain = value.filter((entry) => typeof entry === 'string' || typeof entry === 'number')
103
+ out[key] = plain.length === value.length ? plain.join(', ') : value
104
+ } else if (value && typeof value === 'object' && Object.values(value).every((entry) => typeof entry === 'string')) {
105
+ out[key] = languageMapText(value)
106
+ } else {
107
+ out[key] = value
108
+ }
109
+ }
110
+ return out
111
+ }
112
+
113
+ /**
114
+ * CnGroupedCardsWidget — groups of cards side by side, read from an app
115
+ * endpoint: a case type's phases, each with the tasks it runs, and a dashed
116
+ * box of what is available in every phase (board DqZaaktype, Fasen en taken).
117
+ *
118
+ * Content-only on a card surface: the detail host or the dashboard draws the
119
+ * titled card around it.
120
+ */
121
+ export default {
122
+ name: 'CnGroupedCardsWidget',
123
+
124
+ components: { NcLoadingIcon },
125
+
126
+ inject: {
127
+ /** The host app's translate function. */
128
+ cnTranslate: { default: () => (key) => key },
129
+ /** The page's app config map, for money tokens in a template. */
130
+ cnAppConfig: { default: () => ({}) },
131
+ },
132
+
133
+ props: {
134
+ /**
135
+ * The widget config: `{ endpointSource, groupsPath?, itemsKey?,
136
+ * groupTitle?, groupCount?, itemTitle?, itemMeta?, columns?,
137
+ * extraGroup?, emptyText?, groupEmptyText?, errorText? }`.
138
+ *
139
+ * - `endpointSource` (`{ url, params?, responsePath? }`) reads the payload; tokens
140
+ * such as `@objectId` resolve as on every widget.
141
+ * - `groupsPath` (default `groups`) is the list of groups in the payload, and
142
+ * `itemsKey` (default `items`) the list of cards in each group.
143
+ * - `groupTitle` and `itemTitle` are templates (`"Phase {order}: {name}"`,
144
+ * `"{title}"`); `itemMeta` is a template or a list of templates joined
145
+ * with " · ", a part whose token is empty being left out.
146
+ * - `groupCount` (`{ one, other }`, `{count}` filled in) draws a count pill.
147
+ * - `extraGroup` (`{ title, path, itemText, join? }`) closes the grid with a
148
+ * dashed box whose entries, read at `path` of the payload, are one line.
149
+ * - `columns` (default 2) is the number of groups side by side.
150
+ *
151
+ * A language map (`{ nl, en }`) reads in the user's language, and a list
152
+ * of plain values reads joined with ", ". Texts go through the app's
153
+ * translate.
154
+ *
155
+ * @type {object}
156
+ */
157
+ content: {
158
+ type: Object,
159
+ default: () => ({}),
160
+ },
161
+
162
+ /** The current record's id, for the `@objectId` token. */
163
+ objectId: {
164
+ type: [String, Number],
165
+ default: null,
166
+ },
167
+
168
+ /** The current record, for `@object.<field>` tokens. */
169
+ objectData: {
170
+ type: Object,
171
+ default: null,
172
+ },
173
+ },
174
+
175
+ setup(props) {
176
+ const objectCtxRaw = inject('cnObjectContext', null)
177
+ const workspaceRaw = inject('cnWorkspaceContext', null)
178
+ const appConfigRaw = inject('cnAppConfig', ref({}))
179
+ const { data, loading, error } = useEndpointSource(
180
+ () => props.content?.endpointSource || null,
181
+ {
182
+ ctx: () => {
183
+ const injected = unwrap(objectCtxRaw) || {}
184
+ return {
185
+ ...injected,
186
+ objectId: props.objectId ?? injected.objectId ?? props.objectData?.id ?? null,
187
+ object: props.objectData || injected.object || null,
188
+ workspace: unwrap(workspaceRaw) || {},
189
+ config: unwrapAppConfig(appConfigRaw) || {},
190
+ }
191
+ },
192
+ },
193
+ )
194
+ uid += 1
195
+ return { payload: data, loading, error, idPrefix: `cn-grouped-cards-${uid}` }
196
+ },
197
+
198
+ computed: {
199
+ /** @return {number} The groups side by side. */
200
+ columns() {
201
+ const value = Number(this.content?.columns)
202
+ return Number.isFinite(value) && value >= 1 ? Math.min(4, Math.floor(value)) : 2
203
+ },
204
+
205
+ /**
206
+ * The groups ready to draw.
207
+ *
208
+ * @return {Array<{key: string, headingId: string, title: string, count: string, items: Array<object>}>} The groups.
209
+ * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint
210
+ */
211
+ groups() {
212
+ const c = this.content || {}
213
+ const list = readPath(this.payload, c.groupsPath || 'groups')
214
+ if (!Array.isArray(list)) {
215
+ return []
216
+ }
217
+ return list.filter((group) => group && typeof group === 'object').map((raw, index) => {
218
+ const group = readable(raw)
219
+ const itemList = Array.isArray(raw[c.itemsKey || 'items']) ? raw[c.itemsKey || 'items'] : []
220
+ const items = itemList.filter((item) => item && typeof item === 'object').map((rawItem, itemIndex) => {
221
+ const item = readable(rawItem)
222
+ return {
223
+ key: String(rawItem.id ?? `item-${itemIndex}`),
224
+ title: this.fill(c.itemTitle || '{title}', item),
225
+ meta: this.metaOf(item),
226
+ }
227
+ })
228
+ return {
229
+ key: String(raw.id ?? `group-${index}`),
230
+ headingId: `${this.idPrefix}-group-${index}`,
231
+ title: this.fill(c.groupTitle || '{name}', group),
232
+ count: this.countOf(items.length),
233
+ items,
234
+ }
235
+ })
236
+ },
237
+
238
+ /**
239
+ * The closing box of entries available everywhere, or null.
240
+ *
241
+ * @return {{headingId: string, title: string, text: string}|null} The box.
242
+ * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint
243
+ */
244
+ extra() {
245
+ const spec = this.content?.extraGroup
246
+ if (!spec || typeof spec !== 'object' || !spec.path) {
247
+ return null
248
+ }
249
+ const list = readPath(this.payload, spec.path)
250
+ if (!Array.isArray(list) || list.length === 0) {
251
+ return null
252
+ }
253
+ const parts = list
254
+ .map((entry) => (entry && typeof entry === 'object' ? this.fill(spec.itemText || '{label}', readable(entry)) : languageMapText(entry)))
255
+ .filter((text) => text !== '')
256
+ if (parts.length === 0) {
257
+ return null
258
+ }
259
+ return {
260
+ headingId: `${this.idPrefix}-extra`,
261
+ title: this.translate(spec.title || 'Always available'),
262
+ text: parts.join(typeof spec.join === 'string' ? spec.join : ' · '),
263
+ }
264
+ },
265
+
266
+ /** @return {string} The empty text. */
267
+ emptyLabel() {
268
+ return this.content?.emptyText ? this.translate(this.content.emptyText) : t('nextcloud-vue', 'Nothing to show yet')
269
+ },
270
+
271
+ /** @return {string} The text of a group without cards. */
272
+ groupEmptyLabel() {
273
+ return this.content?.groupEmptyText ? this.translate(this.content.groupEmptyText) : t('nextcloud-vue', 'Nothing here yet')
274
+ },
275
+
276
+ /** @return {string} The error text. */
277
+ errorLabel() {
278
+ return this.content?.errorText ? this.translate(this.content.errorText) : t('nextcloud-vue', 'This list could not be loaded.')
279
+ },
280
+
281
+ /** @return {string} The loading label. */
282
+ loadingLabel() {
283
+ return t('nextcloud-vue', 'Loading')
284
+ },
285
+ },
286
+
287
+ methods: {
288
+ /**
289
+ * Translate a text through the host app's catalogue.
290
+ *
291
+ * @param {string} text The text.
292
+ * @return {string} The translated text.
293
+ */
294
+ translate(text) {
295
+ const fn = typeof this.cnTranslate === 'function' ? this.cnTranslate : (key) => key
296
+ return fn(text)
297
+ },
298
+
299
+ /**
300
+ * Fill a template from a row, after translating it.
301
+ *
302
+ * @param {string} template The template.
303
+ * @param {object} row The row.
304
+ * @return {string} The text, '' when a token is empty.
305
+ */
306
+ fill(template, row) {
307
+ if (typeof template !== 'string' || template === '') {
308
+ return ''
309
+ }
310
+ return fillTemplate(this.translate(template), row, new Date(), { config: unwrapAppConfig(this.cnAppConfig) })
311
+ },
312
+
313
+ /**
314
+ * A card's meta line: one template, or several joined with " · ", a
315
+ * part whose token is empty being left out with its separator.
316
+ *
317
+ * @param {object} item The card's row.
318
+ * @return {string} The line.
319
+ */
320
+ metaOf(item) {
321
+ const spec = this.content?.itemMeta
322
+ const parts = Array.isArray(spec) ? spec : (typeof spec === 'string' ? [spec] : [])
323
+ return parts.map((part) => this.fill(part, item)).filter((text) => text !== '').join(' · ')
324
+ },
325
+
326
+ /**
327
+ * The count pill of a group (`groupCount: { one, other }`).
328
+ *
329
+ * @param {number} count The number of cards.
330
+ * @return {string} The text, '' without `groupCount`.
331
+ */
332
+ countOf(count) {
333
+ const spec = this.content?.groupCount
334
+ if (!spec || typeof spec !== 'object') {
335
+ return ''
336
+ }
337
+ const template = count === 1 ? spec.one : spec.other
338
+ return typeof template === 'string' && template !== '' ? this.translate(template).replace(/\{count\}/g, String(count)) : ''
339
+ },
340
+ },
341
+ }
342
+ </script>
343
+
344
+ <style scoped>
345
+ .cn-grouped-cards__grid {
346
+ display: grid;
347
+ grid-template-columns: repeat(var(--cn-grouped-cards-columns, 2), minmax(0, 1fr));
348
+ gap: 16px;
349
+ }
350
+
351
+ @media (max-width: 700px) {
352
+ .cn-grouped-cards__grid {
353
+ grid-template-columns: minmax(0, 1fr);
354
+ }
355
+ }
356
+
357
+ .cn-grouped-cards__group {
358
+ display: flex;
359
+ flex-direction: column;
360
+ gap: 8px;
361
+ padding: 12px 14px 14px;
362
+ border-radius: var(--border-radius-large, 10px);
363
+ background: var(--color-background-hover);
364
+ }
365
+
366
+ .cn-grouped-cards__group--extra {
367
+ background: transparent;
368
+ border: 1px dashed var(--color-border-dark);
369
+ }
370
+
371
+ .cn-grouped-cards__group-header {
372
+ display: flex;
373
+ align-items: center;
374
+ justify-content: space-between;
375
+ gap: 8px;
376
+ }
377
+
378
+ .cn-grouped-cards__group-title {
379
+ margin: 0;
380
+ font-size: 15px;
381
+ font-weight: 600;
382
+ color: var(--color-main-text);
383
+ }
384
+
385
+ .cn-grouped-cards__count {
386
+ padding: 2px 8px;
387
+ border-radius: var(--border-radius-pill, 12px);
388
+ background: var(--color-main-background);
389
+ color: var(--color-text-maxcontrast);
390
+ font-size: 12px;
391
+ font-weight: 600;
392
+ white-space: nowrap;
393
+ }
394
+
395
+ .cn-grouped-cards__items {
396
+ display: flex;
397
+ flex-direction: column;
398
+ gap: 8px;
399
+ margin: 0;
400
+ padding: 0;
401
+ list-style: none;
402
+ }
403
+
404
+ .cn-grouped-cards__item {
405
+ display: flex;
406
+ flex-direction: column;
407
+ gap: 2px;
408
+ padding: 10px 12px;
409
+ border: 1px solid var(--color-border);
410
+ border-radius: var(--border-radius-large, 8px);
411
+ background: var(--color-main-background);
412
+ }
413
+
414
+ .cn-grouped-cards__item-title {
415
+ font-weight: 600;
416
+ color: var(--color-main-text);
417
+ }
418
+
419
+ .cn-grouped-cards__item-meta,
420
+ .cn-grouped-cards__extra-text,
421
+ .cn-grouped-cards__group-empty,
422
+ .cn-grouped-cards__state {
423
+ margin: 0;
424
+ color: var(--color-text-maxcontrast);
425
+ font-size: 13px;
426
+ }
427
+
428
+ .cn-grouped-cards__loading {
429
+ display: flex;
430
+ justify-content: center;
431
+ padding: 8px 0;
432
+ }
433
+ </style>
@@ -0,0 +1,28 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ *
5
+ * CnGroupedCardsWidget — self-registers the `grouped-cards` widget type
6
+ * (groups of cards side by side, read from an app endpoint) into the shared
7
+ * dashboardWidgetRegistry at module load.
8
+ */
9
+
10
+ import CnGroupedCardsWidget from './CnGroupedCardsWidget.vue'
11
+ import { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'
12
+
13
+ registerDashboardWidget('grouped-cards', {
14
+ renderer: CnGroupedCardsWidget,
15
+ form: null,
16
+ defaultContent: {
17
+ endpointSource: { url: '' },
18
+ groupsPath: 'groups',
19
+ itemsKey: 'items',
20
+ columns: 2,
21
+ },
22
+ displayName: 'Grouped cards',
23
+ icon: 'ViewGridOutline',
24
+ surfaces: ['detail-page', 'app-dashboard'],
25
+ })
26
+
27
+ export { CnGroupedCardsWidget }
28
+ export default CnGroupedCardsWidget