@conduction/nextcloud-vue 2.100.0 → 2.102.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.
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue2.js +22 -0
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js +8 -6
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue.js +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue2.js +29 -4
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue3.js +9 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue.js +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js +22 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js +26 -16
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +70 -6
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +105 -74
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js +9 -0
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js.map +1 -0
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js +139 -0
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js +76 -0
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +160 -2
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +206 -94
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesReview.js +61 -0
- package/dist/esm/components/CnFilesBrowser/filesReview.js.map +1 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js +9 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js.map +1 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js +279 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js +122 -0
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnGroupedCardsWidget/index.js +29 -0
- package/dist/esm/components/CnGroupedCardsWidget/index.js.map +1 -0
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +320 -74
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +323 -213
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/useNamedSource.js +30 -3
- package/dist/esm/components/CnIndexPage/useNamedSource.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +15 -0
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuWidget/CnMenuWidget.vue.js +1 -1
- package/dist/esm/components/CnMenuWidget/CnMenuWidget.vue2.js +25 -1
- package/dist/esm/components/CnMenuWidget/CnMenuWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnMenuWidget/CnMenuWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +14 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js +14 -6
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue.js +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js +10 -0
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js +6 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue.js +1 -1
- package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js +91 -4
- package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js.map +1 -1
- package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js +63 -38
- package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js.map +1 -1
- package/dist/esm/components/CnQuickFilterBar/CnQuickFilterBar.vue.js +1 -1
- package/dist/esm/components/CnQuickFilterBar/CnQuickFilterBar.vue2.js +106 -4
- package/dist/esm/components/CnQuickFilterBar/CnQuickFilterBar.vue2.js.map +1 -1
- package/dist/esm/components/CnQuickFilterBar/CnQuickFilterBar.vue3.js +70 -25
- package/dist/esm/components/CnQuickFilterBar/CnQuickFilterBar.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue.js +9 -0
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue.js.map +1 -0
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue2.js +175 -0
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue3.js +77 -0
- package/dist/esm/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue.js +1 -1
- package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue2.js +35 -2
- package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue2.js.map +1 -1
- package/dist/esm/components/CnSetupWizard/CnSetupWizard.vue3.js.map +1 -1
- package/dist/esm/components/CnWidgetGrid/builtInWidgets.js +4 -0
- package/dist/esm/components/CnWidgetGrid/builtInWidgets.js.map +1 -1
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue.js +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js +2 -23
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue3.js.map +1 -1
- package/dist/esm/composables/indexSources.js +176 -20
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/composables/useEndpointSource.js +28 -6
- package/dist/esm/composables/useEndpointSource.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +41 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +39 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +939 -376
- package/dist/esm/utils/builtInFormatters.js +24 -4
- package/dist/esm/utils/builtInFormatters.js.map +1 -1
- package/dist/esm/utils/languageMapText.js +50 -0
- package/dist/esm/utils/languageMapText.js.map +1 -0
- package/dist/esm/utils/libraryWidgetKeys.js +3 -0
- package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
- package/dist/esm/utils/mapList.js +71 -0
- package/dist/esm/utils/mapList.js.map +1 -0
- package/dist/esm/utils/rowClassRules.js +43 -0
- package/dist/esm/utils/rowClassRules.js.map +1 -0
- package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
- package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
- package/dist/esm/utils/visibleWhen.js +19 -2
- package/dist/esm/utils/visibleWhen.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +9681 -7136
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +939 -376
- package/l10n/en.json +41 -1
- package/l10n/nl.json +39 -1
- package/package.json +1 -1
- package/src/components/CnActionsBar/CnActionsBar.md +1 -0
- package/src/components/CnActionsBar/CnActionsBar.vue +31 -4
- package/src/components/CnChartWidget/CnChartWidget.md +3 -2
- package/src/components/CnChartWidget/CnChartWidget.vue +42 -4
- package/src/components/CnChoiceCards/CnChoiceCards.md +39 -0
- package/src/components/CnChoiceCards/CnChoiceCards.vue +93 -16
- package/src/components/CnDashboardPage/CnDashboardPage.vue +110 -21
- package/src/components/CnExportsWidget/CnExportsWidget.vue +233 -0
- package/src/components/CnExportsWidget/index.js +7 -0
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +324 -0
- package/src/components/CnFilesBrowser/filesReview.js +57 -0
- package/src/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue +433 -0
- package/src/components/CnGroupedCardsWidget/index.js +28 -0
- package/src/components/CnIndexPage/CnIndexPage.md +5 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +313 -9
- package/src/components/CnIndexPage/useNamedSource.js +30 -3
- package/src/components/CnMapWidget/CnMapWidget.vue +37 -0
- package/src/components/CnMenuWidget/CnMenuWidget.vue +25 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +29 -1
- package/src/components/CnObjectSidebar/CnFilesTab.vue +15 -0
- package/src/components/CnOrderedListField/CnOrderedListField.vue +151 -5
- package/src/components/CnQuickFilterBar/CnQuickFilterBar.md +1 -0
- package/src/components/CnQuickFilterBar/CnQuickFilterBar.vue +159 -5
- package/src/components/CnSavedViewAlertWidget/CnSavedViewAlertWidget.vue +272 -0
- package/src/components/CnSavedViewAlertWidget/index.js +7 -0
- package/src/components/CnSetupWizard/CnSetupWizard.vue +35 -2
- package/src/components/CnWidgetGrid/builtInWidgets.js +4 -0
- package/src/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
- package/src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue +2 -23
- package/src/components/index.js +3 -0
- package/src/composables/indexSources.js +175 -19
- package/src/composables/useEndpointSource.js +28 -6
- package/src/css/index-page.css +117 -0
- package/src/css/look-board-index.css +10 -0
- package/src/css/look-board.css +44 -0
- package/src/index.js +1 -0
- package/src/schemas/app-manifest-v2.schema.json +85 -3
- package/src/utils/builtInFormatters.js +24 -4
- package/src/utils/languageMapText.js +46 -0
- package/src/utils/libraryWidgetKeys.js +3 -0
- package/src/utils/mapList.js +67 -0
- package/src/utils/rowClassRules.js +39 -0
- package/src/utils/validateManifestV2.compiled.js +3 -3
- package/src/utils/visibleWhen.js +19 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { fileColumnValue } from './filesBrowserColumns.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
5
|
+
* SPDX-License-Identifier: EUPL-1.2
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** The tones a review segment may take; anything else draws as `default`. */
|
|
9
|
+
const TONES = ['success', 'warning', 'error', 'info', 'default'];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The review summary of a file list (DqZaakDocumenten "4 van 7 beoordeeld"):
|
|
13
|
+
* how many files carry each review value, read from the host's row data.
|
|
14
|
+
*
|
|
15
|
+
* `spec` is `{ key, open, values: [{ value, label?, tone? }] }`: `key` is the
|
|
16
|
+
* row-data field that holds the review state, `open` the value (or values) of
|
|
17
|
+
* a file still to review. A file with no value, or one not listed, counts as
|
|
18
|
+
* open. Values compare without case.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} spec The summary declaration.
|
|
21
|
+
* @param {Array<object>} nodes The file nodes (folders already left out).
|
|
22
|
+
* @param {object|null} rowData The host's row data, by file id.
|
|
23
|
+
* @return {{total: number, done: number, open: number, segments: Array<{value: string, label: string, tone: string, count: number, share: number}>}|null}
|
|
24
|
+
* The counts, or null when the declaration names no key or no values.
|
|
25
|
+
*/
|
|
26
|
+
function reviewSummary(spec, nodes, rowData) {
|
|
27
|
+
if (!spec || typeof spec !== 'object' || typeof spec.key !== 'string' || spec.key === '' || !Array.isArray(spec.values) || spec.values.length === 0) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
const files = Array.isArray(nodes) ? nodes : [];
|
|
31
|
+
const openValues = (Array.isArray(spec.open) ? spec.open : [spec.open]).filter((v) => v !== undefined && v !== null).map((v) => String(v).toLowerCase());
|
|
32
|
+
const segments = spec.values
|
|
33
|
+
.filter((entry) => entry && entry.value !== undefined && entry.value !== null)
|
|
34
|
+
.map((entry) => ({
|
|
35
|
+
value: String(entry.value),
|
|
36
|
+
label: typeof entry.label === 'string' && entry.label !== '' ? entry.label : String(entry.value),
|
|
37
|
+
tone: TONES.includes(entry.tone) ? entry.tone : 'default',
|
|
38
|
+
count: 0,
|
|
39
|
+
share: 0,
|
|
40
|
+
}));
|
|
41
|
+
let open = 0;
|
|
42
|
+
for (const node of files) {
|
|
43
|
+
const raw = fileColumnValue({ key: spec.key, source: 'row' }, node, rowData);
|
|
44
|
+
const value = raw === null || raw === undefined ? '' : String(raw).toLowerCase();
|
|
45
|
+
const segment = segments.find((s) => s.value.toLowerCase() === value);
|
|
46
|
+
if (segment) {
|
|
47
|
+
segment.count++;
|
|
48
|
+
}
|
|
49
|
+
if (!segment || openValues.includes(value)) {
|
|
50
|
+
open++;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const total = files.length;
|
|
54
|
+
for (const segment of segments) {
|
|
55
|
+
segment.share = total > 0 ? Math.round((segment.count / total) * 1000) / 10 : 0;
|
|
56
|
+
}
|
|
57
|
+
return { total, done: total - open, open, segments }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { reviewSummary };
|
|
61
|
+
//# sourceMappingURL=filesReview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesReview.js","sources":["../../../../src/components/CnFilesBrowser/filesReview.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n */\nimport { fileColumnValue } from './filesBrowserColumns.js'\n\n/** The tones a review segment may take; anything else draws as `default`. */\nconst TONES = ['success', 'warning', 'error', 'info', 'default']\n\n/**\n * The review summary of a file list (DqZaakDocumenten \"4 van 7 beoordeeld\"):\n * how many files carry each review value, read from the host's row data.\n *\n * `spec` is `{ key, open, values: [{ value, label?, tone? }] }`: `key` is the\n * row-data field that holds the review state, `open` the value (or values) of\n * a file still to review. A file with no value, or one not listed, counts as\n * open. Values compare without case.\n *\n * @param {object} spec The summary declaration.\n * @param {Array<object>} nodes The file nodes (folders already left out).\n * @param {object|null} rowData The host's row data, by file id.\n * @return {{total: number, done: number, open: number, segments: Array<{value: string, label: string, tone: string, count: number, share: number}>}|null}\n * The counts, or null when the declaration names no key or no values.\n */\nexport function reviewSummary(spec, nodes, rowData) {\n\tif (!spec || typeof spec !== 'object' || typeof spec.key !== 'string' || spec.key === '' || !Array.isArray(spec.values) || spec.values.length === 0) {\n\t\treturn null\n\t}\n\tconst files = Array.isArray(nodes) ? nodes : []\n\tconst openValues = (Array.isArray(spec.open) ? spec.open : [spec.open]).filter((v) => v !== undefined && v !== null).map((v) => String(v).toLowerCase())\n\tconst segments = spec.values\n\t\t.filter((entry) => entry && entry.value !== undefined && entry.value !== null)\n\t\t.map((entry) => ({\n\t\t\tvalue: String(entry.value),\n\t\t\tlabel: typeof entry.label === 'string' && entry.label !== '' ? entry.label : String(entry.value),\n\t\t\ttone: TONES.includes(entry.tone) ? entry.tone : 'default',\n\t\t\tcount: 0,\n\t\t\tshare: 0,\n\t\t}))\n\tlet open = 0\n\tfor (const node of files) {\n\t\tconst raw = fileColumnValue({ key: spec.key, source: 'row' }, node, rowData)\n\t\tconst value = raw === null || raw === undefined ? '' : String(raw).toLowerCase()\n\t\tconst segment = segments.find((s) => s.value.toLowerCase() === value)\n\t\tif (segment) {\n\t\t\tsegment.count++\n\t\t}\n\t\tif (!segment || openValues.includes(value)) {\n\t\t\topen++\n\t\t}\n\t}\n\tconst total = files.length\n\tfor (const segment of segments) {\n\t\tsegment.share = total > 0 ? Math.round((segment.count / total) * 1000) / 10 : 0\n\t}\n\treturn { total, done: total - open, open, segments }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;AACpD,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,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a";
|
|
6
|
+
const __sfc_main = script;
|
|
7
|
+
|
|
8
|
+
export { __sfc_main as default };
|
|
9
|
+
//# sourceMappingURL=CnGroupedCardsWidget.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnGroupedCardsWidget.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { translate } from '@nextcloud/l10n';
|
|
2
|
+
import { NcLoadingIcon } from '@nextcloud/vue';
|
|
3
|
+
import { inject, ref } from 'vue';
|
|
4
|
+
import { useEndpointSource } from '../../composables/useEndpointSource.js';
|
|
5
|
+
import { fillTemplate } from '../../utils/fillTemplate.js';
|
|
6
|
+
import { unwrapAppConfig } from '../../utils/formatMetric.js';
|
|
7
|
+
import { languageMapText } from '../../utils/languageMapText.js';
|
|
8
|
+
import { readPath } from '../../utils/readPath.js';
|
|
9
|
+
|
|
10
|
+
let uid = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Unwrap a value that may be a ref.
|
|
14
|
+
*
|
|
15
|
+
* @param {unknown} value The value.
|
|
16
|
+
* @return {unknown} The plain value.
|
|
17
|
+
*/
|
|
18
|
+
function unwrap(value) {
|
|
19
|
+
return value && typeof value === 'object' && 'value' in value ? value.value : value
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A row as the templates read it: a language map (`{ nl, en }`) becomes its
|
|
24
|
+
* text in the user's language, and a list of plain values is joined with ", ".
|
|
25
|
+
* Nested objects stay as they are, for a template that reads a deeper path.
|
|
26
|
+
*
|
|
27
|
+
* @param {object} row The row.
|
|
28
|
+
* @return {object} A shallow copy with readable values.
|
|
29
|
+
*/
|
|
30
|
+
function readable(row) {
|
|
31
|
+
if (!row || typeof row !== 'object') {
|
|
32
|
+
return {}
|
|
33
|
+
}
|
|
34
|
+
const out = {};
|
|
35
|
+
for (const [key, value] of Object.entries(row)) {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
const plain = value.filter((entry) => typeof entry === 'string' || typeof entry === 'number');
|
|
38
|
+
out[key] = plain.length === value.length ? plain.join(', ') : value;
|
|
39
|
+
} else if (value && typeof value === 'object' && Object.values(value).every((entry) => typeof entry === 'string')) {
|
|
40
|
+
out[key] = languageMapText(value);
|
|
41
|
+
} else {
|
|
42
|
+
out[key] = value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return out
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* CnGroupedCardsWidget — groups of cards side by side, read from an app
|
|
50
|
+
* endpoint: a case type's phases, each with the tasks it runs, and a dashed
|
|
51
|
+
* box of what is available in every phase (board DqZaaktype, Fasen en taken).
|
|
52
|
+
*
|
|
53
|
+
* Content-only on a card surface: the detail host or the dashboard draws the
|
|
54
|
+
* titled card around it.
|
|
55
|
+
*/
|
|
56
|
+
var script = {
|
|
57
|
+
name: 'CnGroupedCardsWidget',
|
|
58
|
+
|
|
59
|
+
components: { NcLoadingIcon },
|
|
60
|
+
|
|
61
|
+
inject: {
|
|
62
|
+
/** The host app's translate function. */
|
|
63
|
+
cnTranslate: { default: () => (key) => key },
|
|
64
|
+
/** The page's app config map, for money tokens in a template. */
|
|
65
|
+
cnAppConfig: { default: () => ({}) },
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
props: {
|
|
69
|
+
/**
|
|
70
|
+
* The widget config: `{ endpointSource, groupsPath?, itemsKey?,
|
|
71
|
+
* groupTitle?, groupCount?, itemTitle?, itemMeta?, columns?,
|
|
72
|
+
* extraGroup?, emptyText?, groupEmptyText?, errorText? }`.
|
|
73
|
+
*
|
|
74
|
+
* - `endpointSource` (`{ url, params?, responsePath? }`) reads the payload; tokens
|
|
75
|
+
* such as `@objectId` resolve as on every widget.
|
|
76
|
+
* - `groupsPath` (default `groups`) is the list of groups in the payload, and
|
|
77
|
+
* `itemsKey` (default `items`) the list of cards in each group.
|
|
78
|
+
* - `groupTitle` and `itemTitle` are templates (`"Phase {order}: {name}"`,
|
|
79
|
+
* `"{title}"`); `itemMeta` is a template or a list of templates joined
|
|
80
|
+
* with " · ", a part whose token is empty being left out.
|
|
81
|
+
* - `groupCount` (`{ one, other }`, `{count}` filled in) draws a count pill.
|
|
82
|
+
* - `extraGroup` (`{ title, path, itemText, join? }`) closes the grid with a
|
|
83
|
+
* dashed box whose entries, read at `path` of the payload, are one line.
|
|
84
|
+
* - `columns` (default 2) is the number of groups side by side.
|
|
85
|
+
*
|
|
86
|
+
* A language map (`{ nl, en }`) reads in the user's language, and a list
|
|
87
|
+
* of plain values reads joined with ", ". Texts go through the app's
|
|
88
|
+
* translate.
|
|
89
|
+
*
|
|
90
|
+
* @type {object}
|
|
91
|
+
*/
|
|
92
|
+
content: {
|
|
93
|
+
type: Object,
|
|
94
|
+
default: () => ({}),
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/** The current record's id, for the `@objectId` token. */
|
|
98
|
+
objectId: {
|
|
99
|
+
type: [String, Number],
|
|
100
|
+
default: null,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/** The current record, for `@object.<field>` tokens. */
|
|
104
|
+
objectData: {
|
|
105
|
+
type: Object,
|
|
106
|
+
default: null,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
setup(props) {
|
|
111
|
+
const objectCtxRaw = inject('cnObjectContext', null);
|
|
112
|
+
const workspaceRaw = inject('cnWorkspaceContext', null);
|
|
113
|
+
const appConfigRaw = inject('cnAppConfig', ref({}));
|
|
114
|
+
const { data, loading, error } = useEndpointSource(
|
|
115
|
+
() => props.content?.endpointSource || null,
|
|
116
|
+
{
|
|
117
|
+
ctx: () => {
|
|
118
|
+
const injected = unwrap(objectCtxRaw) || {};
|
|
119
|
+
return {
|
|
120
|
+
...injected,
|
|
121
|
+
objectId: props.objectId ?? injected.objectId ?? props.objectData?.id ?? null,
|
|
122
|
+
object: props.objectData || injected.object || null,
|
|
123
|
+
workspace: unwrap(workspaceRaw) || {},
|
|
124
|
+
config: unwrapAppConfig(appConfigRaw) || {},
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
uid += 1;
|
|
130
|
+
return { payload: data, loading, error, idPrefix: `cn-grouped-cards-${uid}` }
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
computed: {
|
|
134
|
+
/** @return {number} The groups side by side. */
|
|
135
|
+
columns() {
|
|
136
|
+
const value = Number(this.content?.columns);
|
|
137
|
+
return Number.isFinite(value) && value >= 1 ? Math.min(4, Math.floor(value)) : 2
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The groups ready to draw.
|
|
142
|
+
*
|
|
143
|
+
* @return {Array<{key: string, headingId: string, title: string, count: string, items: Array<object>}>} The groups.
|
|
144
|
+
* @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint
|
|
145
|
+
*/
|
|
146
|
+
groups() {
|
|
147
|
+
const c = this.content || {};
|
|
148
|
+
const list = readPath(this.payload, c.groupsPath || 'groups');
|
|
149
|
+
if (!Array.isArray(list)) {
|
|
150
|
+
return []
|
|
151
|
+
}
|
|
152
|
+
return list.filter((group) => group && typeof group === 'object').map((raw, index) => {
|
|
153
|
+
const group = readable(raw);
|
|
154
|
+
const itemList = Array.isArray(raw[c.itemsKey || 'items']) ? raw[c.itemsKey || 'items'] : [];
|
|
155
|
+
const items = itemList.filter((item) => item && typeof item === 'object').map((rawItem, itemIndex) => {
|
|
156
|
+
const item = readable(rawItem);
|
|
157
|
+
return {
|
|
158
|
+
key: String(rawItem.id ?? `item-${itemIndex}`),
|
|
159
|
+
title: this.fill(c.itemTitle || '{title}', item),
|
|
160
|
+
meta: this.metaOf(item),
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
key: String(raw.id ?? `group-${index}`),
|
|
165
|
+
headingId: `${this.idPrefix}-group-${index}`,
|
|
166
|
+
title: this.fill(c.groupTitle || '{name}', group),
|
|
167
|
+
count: this.countOf(items.length),
|
|
168
|
+
items,
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The closing box of entries available everywhere, or null.
|
|
175
|
+
*
|
|
176
|
+
* @return {{headingId: string, title: string, text: string}|null} The box.
|
|
177
|
+
* @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint
|
|
178
|
+
*/
|
|
179
|
+
extra() {
|
|
180
|
+
const spec = this.content?.extraGroup;
|
|
181
|
+
if (!spec || typeof spec !== 'object' || !spec.path) {
|
|
182
|
+
return null
|
|
183
|
+
}
|
|
184
|
+
const list = readPath(this.payload, spec.path);
|
|
185
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
186
|
+
return null
|
|
187
|
+
}
|
|
188
|
+
const parts = list
|
|
189
|
+
.map((entry) => (entry && typeof entry === 'object' ? this.fill(spec.itemText || '{label}', readable(entry)) : languageMapText(entry)))
|
|
190
|
+
.filter((text) => text !== '');
|
|
191
|
+
if (parts.length === 0) {
|
|
192
|
+
return null
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
headingId: `${this.idPrefix}-extra`,
|
|
196
|
+
title: this.translate(spec.title || 'Always available'),
|
|
197
|
+
text: parts.join(typeof spec.join === 'string' ? spec.join : ' · '),
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
/** @return {string} The empty text. */
|
|
202
|
+
emptyLabel() {
|
|
203
|
+
return this.content?.emptyText ? this.translate(this.content.emptyText) : translate('nextcloud-vue', 'Nothing to show yet')
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/** @return {string} The text of a group without cards. */
|
|
207
|
+
groupEmptyLabel() {
|
|
208
|
+
return this.content?.groupEmptyText ? this.translate(this.content.groupEmptyText) : translate('nextcloud-vue', 'Nothing here yet')
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/** @return {string} The error text. */
|
|
212
|
+
errorLabel() {
|
|
213
|
+
return this.content?.errorText ? this.translate(this.content.errorText) : translate('nextcloud-vue', 'This list could not be loaded.')
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
/** @return {string} The loading label. */
|
|
217
|
+
loadingLabel() {
|
|
218
|
+
return translate('nextcloud-vue', 'Loading')
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
methods: {
|
|
223
|
+
/**
|
|
224
|
+
* Translate a text through the host app's catalogue.
|
|
225
|
+
*
|
|
226
|
+
* @param {string} text The text.
|
|
227
|
+
* @return {string} The translated text.
|
|
228
|
+
*/
|
|
229
|
+
translate(text) {
|
|
230
|
+
const fn = typeof this.cnTranslate === 'function' ? this.cnTranslate : (key) => key;
|
|
231
|
+
return fn(text)
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Fill a template from a row, after translating it.
|
|
236
|
+
*
|
|
237
|
+
* @param {string} template The template.
|
|
238
|
+
* @param {object} row The row.
|
|
239
|
+
* @return {string} The text, '' when a token is empty.
|
|
240
|
+
*/
|
|
241
|
+
fill(template, row) {
|
|
242
|
+
if (typeof template !== 'string' || template === '') {
|
|
243
|
+
return ''
|
|
244
|
+
}
|
|
245
|
+
return fillTemplate(this.translate(template), row, new Date(), { config: unwrapAppConfig(this.cnAppConfig) })
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* A card's meta line: one template, or several joined with " · ", a
|
|
250
|
+
* part whose token is empty being left out with its separator.
|
|
251
|
+
*
|
|
252
|
+
* @param {object} item The card's row.
|
|
253
|
+
* @return {string} The line.
|
|
254
|
+
*/
|
|
255
|
+
metaOf(item) {
|
|
256
|
+
const spec = this.content?.itemMeta;
|
|
257
|
+
const parts = Array.isArray(spec) ? spec : (typeof spec === 'string' ? [spec] : []);
|
|
258
|
+
return parts.map((part) => this.fill(part, item)).filter((text) => text !== '').join(' · ')
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The count pill of a group (`groupCount: { one, other }`).
|
|
263
|
+
*
|
|
264
|
+
* @param {number} count The number of cards.
|
|
265
|
+
* @return {string} The text, '' without `groupCount`.
|
|
266
|
+
*/
|
|
267
|
+
countOf(count) {
|
|
268
|
+
const spec = this.content?.groupCount;
|
|
269
|
+
if (!spec || typeof spec !== 'object') {
|
|
270
|
+
return ''
|
|
271
|
+
}
|
|
272
|
+
const template = count === 1 ? spec.one : spec.other;
|
|
273
|
+
return typeof template === 'string' && template !== '' ? this.translate(template).replace(/\{count\}/g, String(count)) : ''
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export { script as default };
|
|
279
|
+
//# sourceMappingURL=CnGroupedCardsWidget.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnGroupedCardsWidget.vue2.js","sources":["../../../../src/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-grouped-cards\" data-testid=\"cn-grouped-cards\">\n\t\t<p v-if=\"error\" class=\"cn-grouped-cards__state\" data-testid=\"cn-grouped-cards-error\">\n\t\t\t{{ errorLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"loading && groups.length === 0\" class=\"cn-grouped-cards__loading\">\n\t\t\t<NcLoadingIcon :size=\"20\" :name=\"loadingLabel\" />\n\t\t</div>\n\t\t<p v-else-if=\"groups.length === 0 && !extra\" class=\"cn-grouped-cards__state\" data-testid=\"cn-grouped-cards-empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-grouped-cards__grid\"\n\t\t\t:style=\"{ '--cn-grouped-cards-columns': columns }\">\n\t\t\t<section\n\t\t\t\tv-for=\"group in groups\"\n\t\t\t\t:key=\"group.key\"\n\t\t\t\tclass=\"cn-grouped-cards__group\"\n\t\t\t\t:aria-labelledby=\"group.headingId\"\n\t\t\t\tdata-testid=\"cn-grouped-cards-group\">\n\t\t\t\t<header class=\"cn-grouped-cards__group-header\">\n\t\t\t\t\t<h4 :id=\"group.headingId\" class=\"cn-grouped-cards__group-title\">\n\t\t\t\t\t\t{{ group.title }}\n\t\t\t\t\t</h4>\n\t\t\t\t\t<span v-if=\"group.count\" class=\"cn-grouped-cards__count\" data-testid=\"cn-grouped-cards-count\">{{ group.count }}</span>\n\t\t\t\t</header>\n\t\t\t\t<ul v-if=\"group.items.length > 0\" class=\"cn-grouped-cards__items\">\n\t\t\t\t\t<li\n\t\t\t\t\t\tv-for=\"item in group.items\"\n\t\t\t\t\t\t:key=\"item.key\"\n\t\t\t\t\t\tclass=\"cn-grouped-cards__item\"\n\t\t\t\t\t\tdata-testid=\"cn-grouped-cards-item\">\n\t\t\t\t\t\t<span class=\"cn-grouped-cards__item-title\">{{ item.title }}</span>\n\t\t\t\t\t\t<span v-if=\"item.meta\" class=\"cn-grouped-cards__item-meta\">{{ item.meta }}</span>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t\t<p v-else class=\"cn-grouped-cards__group-empty\">\n\t\t\t\t\t{{ groupEmptyLabel }}\n\t\t\t\t</p>\n\t\t\t</section>\n\t\t\t<section\n\t\t\t\tv-if=\"extra\"\n\t\t\t\tclass=\"cn-grouped-cards__group cn-grouped-cards__group--extra\"\n\t\t\t\t:aria-labelledby=\"extra.headingId\"\n\t\t\t\tdata-testid=\"cn-grouped-cards-extra\">\n\t\t\t\t<header class=\"cn-grouped-cards__group-header\">\n\t\t\t\t\t<h4 :id=\"extra.headingId\" class=\"cn-grouped-cards__group-title\">\n\t\t\t\t\t\t{{ extra.title }}\n\t\t\t\t\t</h4>\n\t\t\t\t</header>\n\t\t\t\t<p class=\"cn-grouped-cards__extra-text\">\n\t\t\t\t\t{{ extra.text }}\n\t\t\t\t</p>\n\t\t\t</section>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { inject, ref } from 'vue'\nimport { useEndpointSource } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { unwrapAppConfig } from '../../utils/formatMetric.js'\nimport { languageMapText } from '../../utils/languageMapText.js'\nimport { readPath } from '../../utils/readPath.js'\n\nlet uid = 0\n\n/**\n * Unwrap a value that may be a ref.\n *\n * @param {unknown} value The value.\n * @return {unknown} The plain value.\n */\nfunction unwrap(value) {\n\treturn value && typeof value === 'object' && 'value' in value ? value.value : value\n}\n\n/**\n * A row as the templates read it: a language map (`{ nl, en }`) becomes its\n * text in the user's language, and a list of plain values is joined with \", \".\n * Nested objects stay as they are, for a template that reads a deeper path.\n *\n * @param {object} row The row.\n * @return {object} A shallow copy with readable values.\n */\nfunction readable(row) {\n\tif (!row || typeof row !== 'object') {\n\t\treturn {}\n\t}\n\tconst out = {}\n\tfor (const [key, value] of Object.entries(row)) {\n\t\tif (Array.isArray(value)) {\n\t\t\tconst plain = value.filter((entry) => typeof entry === 'string' || typeof entry === 'number')\n\t\t\tout[key] = plain.length === value.length ? plain.join(', ') : value\n\t\t} else if (value && typeof value === 'object' && Object.values(value).every((entry) => typeof entry === 'string')) {\n\t\t\tout[key] = languageMapText(value)\n\t\t} else {\n\t\t\tout[key] = value\n\t\t}\n\t}\n\treturn out\n}\n\n/**\n * CnGroupedCardsWidget — groups of cards side by side, read from an app\n * endpoint: a case type's phases, each with the tasks it runs, and a dashed\n * box of what is available in every phase (board DqZaaktype, Fasen en taken).\n *\n * Content-only on a card surface: the detail host or the dashboard draws the\n * titled card around it.\n */\nexport default {\n\tname: 'CnGroupedCardsWidget',\n\n\tcomponents: { NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate function. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's app config map, for money tokens in a template. */\n\t\tcnAppConfig: { default: () => ({}) },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ endpointSource, groupsPath?, itemsKey?,\n\t\t * groupTitle?, groupCount?, itemTitle?, itemMeta?, columns?,\n\t\t * extraGroup?, emptyText?, groupEmptyText?, errorText? }`.\n\t\t *\n\t\t * - `endpointSource` (`{ url, params?, responsePath? }`) reads the payload; tokens\n\t\t * such as `@objectId` resolve as on every widget.\n\t\t * - `groupsPath` (default `groups`) is the list of groups in the payload, and\n\t\t * `itemsKey` (default `items`) the list of cards in each group.\n\t\t * - `groupTitle` and `itemTitle` are templates (`\"Phase {order}: {name}\"`,\n\t\t * `\"{title}\"`); `itemMeta` is a template or a list of templates joined\n\t\t * with \" · \", a part whose token is empty being left out.\n\t\t * - `groupCount` (`{ one, other }`, `{count}` filled in) draws a count pill.\n\t\t * - `extraGroup` (`{ title, path, itemText, join? }`) closes the grid with a\n\t\t * dashed box whose entries, read at `path` of the payload, are one line.\n\t\t * - `columns` (default 2) is the number of groups side by side.\n\t\t *\n\t\t * A language map (`{ nl, en }`) reads in the user's language, and a list\n\t\t * of plain values reads joined with \", \". Texts go through the app's\n\t\t * translate.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The current record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The current record, for `@object.<field>` tokens. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup(props) {\n\t\tconst objectCtxRaw = inject('cnObjectContext', null)\n\t\tconst workspaceRaw = inject('cnWorkspaceContext', null)\n\t\tconst appConfigRaw = inject('cnAppConfig', ref({}))\n\t\tconst { data, loading, error } = useEndpointSource(\n\t\t\t() => props.content?.endpointSource || null,\n\t\t\t{\n\t\t\t\tctx: () => {\n\t\t\t\t\tconst injected = unwrap(objectCtxRaw) || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...injected,\n\t\t\t\t\t\tobjectId: props.objectId ?? injected.objectId ?? props.objectData?.id ?? null,\n\t\t\t\t\t\tobject: props.objectData || injected.object || null,\n\t\t\t\t\t\tworkspace: unwrap(workspaceRaw) || {},\n\t\t\t\t\t\tconfig: unwrapAppConfig(appConfigRaw) || {},\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tuid += 1\n\t\treturn { payload: data, loading, error, idPrefix: `cn-grouped-cards-${uid}` }\n\t},\n\n\tcomputed: {\n\t\t/** @return {number} The groups side by side. */\n\t\tcolumns() {\n\t\t\tconst value = Number(this.content?.columns)\n\t\t\treturn Number.isFinite(value) && value >= 1 ? Math.min(4, Math.floor(value)) : 2\n\t\t},\n\n\t\t/**\n\t\t * The groups ready to draw.\n\t\t *\n\t\t * @return {Array<{key: string, headingId: string, title: string, count: string, items: Array<object>}>} The groups.\n\t\t * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint\n\t\t */\n\t\tgroups() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst list = readPath(this.payload, c.groupsPath || 'groups')\n\t\t\tif (!Array.isArray(list)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn list.filter((group) => group && typeof group === 'object').map((raw, index) => {\n\t\t\t\tconst group = readable(raw)\n\t\t\t\tconst itemList = Array.isArray(raw[c.itemsKey || 'items']) ? raw[c.itemsKey || 'items'] : []\n\t\t\t\tconst items = itemList.filter((item) => item && typeof item === 'object').map((rawItem, itemIndex) => {\n\t\t\t\t\tconst item = readable(rawItem)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkey: String(rawItem.id ?? `item-${itemIndex}`),\n\t\t\t\t\t\ttitle: this.fill(c.itemTitle || '{title}', item),\n\t\t\t\t\t\tmeta: this.metaOf(item),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tkey: String(raw.id ?? `group-${index}`),\n\t\t\t\t\theadingId: `${this.idPrefix}-group-${index}`,\n\t\t\t\t\ttitle: this.fill(c.groupTitle || '{name}', group),\n\t\t\t\t\tcount: this.countOf(items.length),\n\t\t\t\t\titems,\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The closing box of entries available everywhere, or null.\n\t\t *\n\t\t * @return {{headingId: string, title: string, text: string}|null} The box.\n\t\t * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint\n\t\t */\n\t\textra() {\n\t\t\tconst spec = this.content?.extraGroup\n\t\t\tif (!spec || typeof spec !== 'object' || !spec.path) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst list = readPath(this.payload, spec.path)\n\t\t\tif (!Array.isArray(list) || list.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parts = list\n\t\t\t\t.map((entry) => (entry && typeof entry === 'object' ? this.fill(spec.itemText || '{label}', readable(entry)) : languageMapText(entry)))\n\t\t\t\t.filter((text) => text !== '')\n\t\t\tif (parts.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\theadingId: `${this.idPrefix}-extra`,\n\t\t\t\ttitle: this.translate(spec.title || 'Always available'),\n\t\t\t\ttext: parts.join(typeof spec.join === 'string' ? spec.join : ' · '),\n\t\t\t}\n\t\t},\n\n\t\t/** @return {string} The empty text. */\n\t\temptyLabel() {\n\t\t\treturn this.content?.emptyText ? this.translate(this.content.emptyText) : t('nextcloud-vue', 'Nothing to show yet')\n\t\t},\n\n\t\t/** @return {string} The text of a group without cards. */\n\t\tgroupEmptyLabel() {\n\t\t\treturn this.content?.groupEmptyText ? this.translate(this.content.groupEmptyText) : t('nextcloud-vue', 'Nothing here yet')\n\t\t},\n\n\t\t/** @return {string} The error text. */\n\t\terrorLabel() {\n\t\t\treturn this.content?.errorText ? this.translate(this.content.errorText) : t('nextcloud-vue', 'This list could not be loaded.')\n\t\t},\n\n\t\t/** @return {string} The loading label. */\n\t\tloadingLabel() {\n\t\t\treturn t('nextcloud-vue', 'Loading')\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Translate a text through the host app's catalogue.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translated text.\n\t\t */\n\t\ttranslate(text) {\n\t\t\tconst fn = typeof this.cnTranslate === 'function' ? this.cnTranslate : (key) => key\n\t\t\treturn fn(text)\n\t\t},\n\n\t\t/**\n\t\t * Fill a template from a row, after translating it.\n\t\t *\n\t\t * @param {string} template The template.\n\t\t * @param {object} row The row.\n\t\t * @return {string} The text, '' when a token is empty.\n\t\t */\n\t\tfill(template, row) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.translate(template), row, new Date(), { config: unwrapAppConfig(this.cnAppConfig) })\n\t\t},\n\n\t\t/**\n\t\t * A card's meta line: one template, or several joined with \" · \", a\n\t\t * part whose token is empty being left out with its separator.\n\t\t *\n\t\t * @param {object} item The card's row.\n\t\t * @return {string} The line.\n\t\t */\n\t\tmetaOf(item) {\n\t\t\tconst spec = this.content?.itemMeta\n\t\t\tconst parts = Array.isArray(spec) ? spec : (typeof spec === 'string' ? [spec] : [])\n\t\t\treturn parts.map((part) => this.fill(part, item)).filter((text) => text !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * The count pill of a group (`groupCount: { one, other }`).\n\t\t *\n\t\t * @param {number} count The number of cards.\n\t\t * @return {string} The text, '' without `groupCount`.\n\t\t */\n\t\tcountOf(count) {\n\t\t\tconst spec = this.content?.groupCount\n\t\t\tif (!spec || typeof spec !== 'object') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst template = count === 1 ? spec.one : spec.other\n\t\t\treturn typeof template === 'string' && template !== '' ? this.translate(template).replace(/\\{count\\}/g, String(count)) : ''\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-grouped-cards__grid {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(var(--cn-grouped-cards-columns, 2), minmax(0, 1fr));\n\tgap: 16px;\n}\n\n@media (max-width: 700px) {\n\t.cn-grouped-cards__grid {\n\t\tgrid-template-columns: minmax(0, 1fr);\n\t}\n}\n\n.cn-grouped-cards__group {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tpadding: 12px 14px 14px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-grouped-cards__group--extra {\n\tbackground: transparent;\n\tborder: 1px dashed var(--color-border-dark);\n}\n\n.cn-grouped-cards__group-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-grouped-cards__group-title {\n\tmargin: 0;\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-grouped-cards__count {\n\tpadding: 2px 8px;\n\tborder-radius: var(--border-radius-pill, 12px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 12px;\n\tfont-weight: 600;\n\twhite-space: nowrap;\n}\n\n.cn-grouped-cards__items {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-grouped-cards__item {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 10px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large, 8px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-grouped-cards__item-title {\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-grouped-cards__item-meta,\n.cn-grouped-cards__extra-text,\n.cn-grouped-cards__group-empty,\n.cn-grouped-cards__state {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-grouped-cards__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 8px 0;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;;;;;AA0EA,IAAI,MAAM,EAAA;;AAEV;;AAEC;;AAEA;;AAED,SAAS,MAAM,CAAC,KAAK,EAAE;AACtB,CAAA,OAAO,KAAI,IAAK,OAAO,KAAM,KAAI,QAAS,IAAG,OAAM,IAAK,KAAI,GAAI,KAAK,CAAC,KAAM,GAAE,KAAI;AACnF,CAAA;;AAEA;;;;AAIC;;;;AAID,SAAS,QAAQ,CAAC,GAAG,EAAE;AACtB,CAAA,IAAI,CAAC,GAAE,IAAK,OAAO,GAAI,KAAI,QAAQ,EAAE;AACpC,EAAA,OAAO,EAAC;AACT,EAAA;CACA,MAAM,GAAE,GAAI,GAAC;AACb,CAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAE,IAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;EAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACzB,GAAA,MAAM,KAAM,GAAE,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,OAAO,KAAI,KAAM,QAAS,IAAG,OAAO,KAAM,KAAI,QAAQ,EAAA;GAC5F,GAAG,CAAC,GAAG,CAAE,GAAE,KAAK,CAAC,MAAO,KAAI,KAAK,CAAC,MAAO,GAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA,GAAI,MAAI;GACjE,MAAK,IAAI,KAAM,IAAG,OAAO,KAAM,KAAI,YAAY,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,OAAO,KAAM,KAA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Z,GAAA,MAAM,IAAG,GAAI,IAAI,CAAC,OAAO,EAAE,SAAO;AAClC,GAAA,MAAM,KAAM,GAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAE,GAAE,IAAK,IAAG,OAAO,IAAK,KAAI,WAAW,CAAC,IAAI,CAAE,GAAE,EAAE,EAAA;AAClF,GAAA,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,IAAG,KAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;GAC1F;;AAED;;AAEC;AACA;AACA;;AAED,EAAA,OAAO,CAAC,KAAK,EAAE;AACd,GAAA,MAAM,IAAG,GAAI,IAAI,CAAC,OAAO,EAAE,WAAS;AACpC,GAAA,IAAI,CAAC,IAAK,IAAG,OAAO,IAAG,KAAM,QAAQ,EAAE;AACtC,IAAA,OAAO,EAAC;AACT,IAAA;AACA,GAAA,MAAM,WAAW,UAAU,CAAA,GAAI,IAAI,CAAC,GAAE,GAAI,IAAI,CAAC,MAAI;GACnD,OAAO,OAAO,aAAa,QAAO,IAAK,aAAa,EAAG,GAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAE,GAAE,EAAC;GAC1H;EACD;AACF;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, toDisplayString, createVNode, normalizeStyle, Fragment, renderList, createElementVNode, createCommentVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "cn-grouped-cards",
|
|
5
|
+
"data-testid": "cn-grouped-cards"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "cn-grouped-cards__state",
|
|
10
|
+
"data-testid": "cn-grouped-cards-error"
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_3 = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "cn-grouped-cards__loading"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_4 = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "cn-grouped-cards__state",
|
|
19
|
+
"data-testid": "cn-grouped-cards-empty"
|
|
20
|
+
};
|
|
21
|
+
const _hoisted_5 = ["aria-labelledby"];
|
|
22
|
+
const _hoisted_6 = { class: "cn-grouped-cards__group-header" };
|
|
23
|
+
const _hoisted_7 = ["id"];
|
|
24
|
+
const _hoisted_8 = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "cn-grouped-cards__count",
|
|
27
|
+
"data-testid": "cn-grouped-cards-count"
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_9 = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "cn-grouped-cards__items"
|
|
32
|
+
};
|
|
33
|
+
const _hoisted_10 = { class: "cn-grouped-cards__item-title" };
|
|
34
|
+
const _hoisted_11 = {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: "cn-grouped-cards__item-meta"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_12 = {
|
|
39
|
+
key: 1,
|
|
40
|
+
class: "cn-grouped-cards__group-empty"
|
|
41
|
+
};
|
|
42
|
+
const _hoisted_13 = ["aria-labelledby"];
|
|
43
|
+
const _hoisted_14 = { class: "cn-grouped-cards__group-header" };
|
|
44
|
+
const _hoisted_15 = ["id"];
|
|
45
|
+
const _hoisted_16 = { class: "cn-grouped-cards__extra-text" };
|
|
46
|
+
|
|
47
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
48
|
+
const _component_NcLoadingIcon = resolveComponent("NcLoadingIcon");
|
|
49
|
+
|
|
50
|
+
return (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
51
|
+
($setup.error)
|
|
52
|
+
? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString($options.errorLabel), 1 /* TEXT */))
|
|
53
|
+
: ($setup.loading && $options.groups.length === 0)
|
|
54
|
+
? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
55
|
+
createVNode(_component_NcLoadingIcon, {
|
|
56
|
+
size: 20,
|
|
57
|
+
name: $options.loadingLabel
|
|
58
|
+
}, null, 8 /* PROPS */, ["name"])
|
|
59
|
+
]))
|
|
60
|
+
: ($options.groups.length === 0 && !$options.extra)
|
|
61
|
+
? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString($options.emptyLabel), 1 /* TEXT */))
|
|
62
|
+
: (openBlock(), createElementBlock("div", {
|
|
63
|
+
key: 3,
|
|
64
|
+
class: "cn-grouped-cards__grid",
|
|
65
|
+
style: normalizeStyle({ '--cn-grouped-cards-columns': $options.columns })
|
|
66
|
+
}, [
|
|
67
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.groups, (group) => {
|
|
68
|
+
return (openBlock(), createElementBlock("section", {
|
|
69
|
+
key: group.key,
|
|
70
|
+
class: "cn-grouped-cards__group",
|
|
71
|
+
"aria-labelledby": group.headingId,
|
|
72
|
+
"data-testid": "cn-grouped-cards-group"
|
|
73
|
+
}, [
|
|
74
|
+
createElementVNode("header", _hoisted_6, [
|
|
75
|
+
createElementVNode("h4", {
|
|
76
|
+
id: group.headingId,
|
|
77
|
+
class: "cn-grouped-cards__group-title"
|
|
78
|
+
}, toDisplayString(group.title), 9 /* TEXT, PROPS */, _hoisted_7),
|
|
79
|
+
(group.count)
|
|
80
|
+
? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(group.count), 1 /* TEXT */))
|
|
81
|
+
: createCommentVNode("v-if", true)
|
|
82
|
+
]),
|
|
83
|
+
(group.items.length > 0)
|
|
84
|
+
? (openBlock(), createElementBlock("ul", _hoisted_9, [
|
|
85
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
|
|
86
|
+
return (openBlock(), createElementBlock("li", {
|
|
87
|
+
key: item.key,
|
|
88
|
+
class: "cn-grouped-cards__item",
|
|
89
|
+
"data-testid": "cn-grouped-cards-item"
|
|
90
|
+
}, [
|
|
91
|
+
createElementVNode("span", _hoisted_10, toDisplayString(item.title), 1 /* TEXT */),
|
|
92
|
+
(item.meta)
|
|
93
|
+
? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(item.meta), 1 /* TEXT */))
|
|
94
|
+
: createCommentVNode("v-if", true)
|
|
95
|
+
]))
|
|
96
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
97
|
+
]))
|
|
98
|
+
: (openBlock(), createElementBlock("p", _hoisted_12, toDisplayString($options.groupEmptyLabel), 1 /* TEXT */))
|
|
99
|
+
], 8 /* PROPS */, _hoisted_5))
|
|
100
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
101
|
+
($options.extra)
|
|
102
|
+
? (openBlock(), createElementBlock("section", {
|
|
103
|
+
key: 0,
|
|
104
|
+
class: "cn-grouped-cards__group cn-grouped-cards__group--extra",
|
|
105
|
+
"aria-labelledby": $options.extra.headingId,
|
|
106
|
+
"data-testid": "cn-grouped-cards-extra"
|
|
107
|
+
}, [
|
|
108
|
+
createElementVNode("header", _hoisted_14, [
|
|
109
|
+
createElementVNode("h4", {
|
|
110
|
+
id: $options.extra.headingId,
|
|
111
|
+
class: "cn-grouped-cards__group-title"
|
|
112
|
+
}, toDisplayString($options.extra.title), 9 /* TEXT, PROPS */, _hoisted_15)
|
|
113
|
+
]),
|
|
114
|
+
createElementVNode("p", _hoisted_16, toDisplayString($options.extra.text), 1 /* TEXT */)
|
|
115
|
+
], 8 /* PROPS */, _hoisted_13))
|
|
116
|
+
: createCommentVNode("v-if", true)
|
|
117
|
+
], 4 /* STYLE */))
|
|
118
|
+
]))
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { render };
|
|
122
|
+
//# sourceMappingURL=CnGroupedCardsWidget.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnGroupedCardsWidget.vue3.js","sources":["../../../../src/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue?vue&type=template&id=cf2cd50a&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-grouped-cards\" data-testid=\"cn-grouped-cards\">\n\t\t<p v-if=\"error\" class=\"cn-grouped-cards__state\" data-testid=\"cn-grouped-cards-error\">\n\t\t\t{{ errorLabel }}\n\t\t</p>\n\t\t<div v-else-if=\"loading && groups.length === 0\" class=\"cn-grouped-cards__loading\">\n\t\t\t<NcLoadingIcon :size=\"20\" :name=\"loadingLabel\" />\n\t\t</div>\n\t\t<p v-else-if=\"groups.length === 0 && !extra\" class=\"cn-grouped-cards__state\" data-testid=\"cn-grouped-cards-empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-grouped-cards__grid\"\n\t\t\t:style=\"{ '--cn-grouped-cards-columns': columns }\">\n\t\t\t<section\n\t\t\t\tv-for=\"group in groups\"\n\t\t\t\t:key=\"group.key\"\n\t\t\t\tclass=\"cn-grouped-cards__group\"\n\t\t\t\t:aria-labelledby=\"group.headingId\"\n\t\t\t\tdata-testid=\"cn-grouped-cards-group\">\n\t\t\t\t<header class=\"cn-grouped-cards__group-header\">\n\t\t\t\t\t<h4 :id=\"group.headingId\" class=\"cn-grouped-cards__group-title\">\n\t\t\t\t\t\t{{ group.title }}\n\t\t\t\t\t</h4>\n\t\t\t\t\t<span v-if=\"group.count\" class=\"cn-grouped-cards__count\" data-testid=\"cn-grouped-cards-count\">{{ group.count }}</span>\n\t\t\t\t</header>\n\t\t\t\t<ul v-if=\"group.items.length > 0\" class=\"cn-grouped-cards__items\">\n\t\t\t\t\t<li\n\t\t\t\t\t\tv-for=\"item in group.items\"\n\t\t\t\t\t\t:key=\"item.key\"\n\t\t\t\t\t\tclass=\"cn-grouped-cards__item\"\n\t\t\t\t\t\tdata-testid=\"cn-grouped-cards-item\">\n\t\t\t\t\t\t<span class=\"cn-grouped-cards__item-title\">{{ item.title }}</span>\n\t\t\t\t\t\t<span v-if=\"item.meta\" class=\"cn-grouped-cards__item-meta\">{{ item.meta }}</span>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t\t<p v-else class=\"cn-grouped-cards__group-empty\">\n\t\t\t\t\t{{ groupEmptyLabel }}\n\t\t\t\t</p>\n\t\t\t</section>\n\t\t\t<section\n\t\t\t\tv-if=\"extra\"\n\t\t\t\tclass=\"cn-grouped-cards__group cn-grouped-cards__group--extra\"\n\t\t\t\t:aria-labelledby=\"extra.headingId\"\n\t\t\t\tdata-testid=\"cn-grouped-cards-extra\">\n\t\t\t\t<header class=\"cn-grouped-cards__group-header\">\n\t\t\t\t\t<h4 :id=\"extra.headingId\" class=\"cn-grouped-cards__group-title\">\n\t\t\t\t\t\t{{ extra.title }}\n\t\t\t\t\t</h4>\n\t\t\t\t</header>\n\t\t\t\t<p class=\"cn-grouped-cards__extra-text\">\n\t\t\t\t\t{{ extra.text }}\n\t\t\t\t</p>\n\t\t\t</section>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcLoadingIcon } from '@nextcloud/vue'\nimport { inject, ref } from 'vue'\nimport { useEndpointSource } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { unwrapAppConfig } from '../../utils/formatMetric.js'\nimport { languageMapText } from '../../utils/languageMapText.js'\nimport { readPath } from '../../utils/readPath.js'\n\nlet uid = 0\n\n/**\n * Unwrap a value that may be a ref.\n *\n * @param {unknown} value The value.\n * @return {unknown} The plain value.\n */\nfunction unwrap(value) {\n\treturn value && typeof value === 'object' && 'value' in value ? value.value : value\n}\n\n/**\n * A row as the templates read it: a language map (`{ nl, en }`) becomes its\n * text in the user's language, and a list of plain values is joined with \", \".\n * Nested objects stay as they are, for a template that reads a deeper path.\n *\n * @param {object} row The row.\n * @return {object} A shallow copy with readable values.\n */\nfunction readable(row) {\n\tif (!row || typeof row !== 'object') {\n\t\treturn {}\n\t}\n\tconst out = {}\n\tfor (const [key, value] of Object.entries(row)) {\n\t\tif (Array.isArray(value)) {\n\t\t\tconst plain = value.filter((entry) => typeof entry === 'string' || typeof entry === 'number')\n\t\t\tout[key] = plain.length === value.length ? plain.join(', ') : value\n\t\t} else if (value && typeof value === 'object' && Object.values(value).every((entry) => typeof entry === 'string')) {\n\t\t\tout[key] = languageMapText(value)\n\t\t} else {\n\t\t\tout[key] = value\n\t\t}\n\t}\n\treturn out\n}\n\n/**\n * CnGroupedCardsWidget — groups of cards side by side, read from an app\n * endpoint: a case type's phases, each with the tasks it runs, and a dashed\n * box of what is available in every phase (board DqZaaktype, Fasen en taken).\n *\n * Content-only on a card surface: the detail host or the dashboard draws the\n * titled card around it.\n */\nexport default {\n\tname: 'CnGroupedCardsWidget',\n\n\tcomponents: { NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate function. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's app config map, for money tokens in a template. */\n\t\tcnAppConfig: { default: () => ({}) },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ endpointSource, groupsPath?, itemsKey?,\n\t\t * groupTitle?, groupCount?, itemTitle?, itemMeta?, columns?,\n\t\t * extraGroup?, emptyText?, groupEmptyText?, errorText? }`.\n\t\t *\n\t\t * - `endpointSource` (`{ url, params?, responsePath? }`) reads the payload; tokens\n\t\t * such as `@objectId` resolve as on every widget.\n\t\t * - `groupsPath` (default `groups`) is the list of groups in the payload, and\n\t\t * `itemsKey` (default `items`) the list of cards in each group.\n\t\t * - `groupTitle` and `itemTitle` are templates (`\"Phase {order}: {name}\"`,\n\t\t * `\"{title}\"`); `itemMeta` is a template or a list of templates joined\n\t\t * with \" · \", a part whose token is empty being left out.\n\t\t * - `groupCount` (`{ one, other }`, `{count}` filled in) draws a count pill.\n\t\t * - `extraGroup` (`{ title, path, itemText, join? }`) closes the grid with a\n\t\t * dashed box whose entries, read at `path` of the payload, are one line.\n\t\t * - `columns` (default 2) is the number of groups side by side.\n\t\t *\n\t\t * A language map (`{ nl, en }`) reads in the user's language, and a list\n\t\t * of plain values reads joined with \", \". Texts go through the app's\n\t\t * translate.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The current record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The current record, for `@object.<field>` tokens. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup(props) {\n\t\tconst objectCtxRaw = inject('cnObjectContext', null)\n\t\tconst workspaceRaw = inject('cnWorkspaceContext', null)\n\t\tconst appConfigRaw = inject('cnAppConfig', ref({}))\n\t\tconst { data, loading, error } = useEndpointSource(\n\t\t\t() => props.content?.endpointSource || null,\n\t\t\t{\n\t\t\t\tctx: () => {\n\t\t\t\t\tconst injected = unwrap(objectCtxRaw) || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...injected,\n\t\t\t\t\t\tobjectId: props.objectId ?? injected.objectId ?? props.objectData?.id ?? null,\n\t\t\t\t\t\tobject: props.objectData || injected.object || null,\n\t\t\t\t\t\tworkspace: unwrap(workspaceRaw) || {},\n\t\t\t\t\t\tconfig: unwrapAppConfig(appConfigRaw) || {},\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tuid += 1\n\t\treturn { payload: data, loading, error, idPrefix: `cn-grouped-cards-${uid}` }\n\t},\n\n\tcomputed: {\n\t\t/** @return {number} The groups side by side. */\n\t\tcolumns() {\n\t\t\tconst value = Number(this.content?.columns)\n\t\t\treturn Number.isFinite(value) && value >= 1 ? Math.min(4, Math.floor(value)) : 2\n\t\t},\n\n\t\t/**\n\t\t * The groups ready to draw.\n\t\t *\n\t\t * @return {Array<{key: string, headingId: string, title: string, count: string, items: Array<object>}>} The groups.\n\t\t * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint\n\t\t */\n\t\tgroups() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst list = readPath(this.payload, c.groupsPath || 'groups')\n\t\t\tif (!Array.isArray(list)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn list.filter((group) => group && typeof group === 'object').map((raw, index) => {\n\t\t\t\tconst group = readable(raw)\n\t\t\t\tconst itemList = Array.isArray(raw[c.itemsKey || 'items']) ? raw[c.itemsKey || 'items'] : []\n\t\t\t\tconst items = itemList.filter((item) => item && typeof item === 'object').map((rawItem, itemIndex) => {\n\t\t\t\t\tconst item = readable(rawItem)\n\t\t\t\t\treturn {\n\t\t\t\t\t\tkey: String(rawItem.id ?? `item-${itemIndex}`),\n\t\t\t\t\t\ttitle: this.fill(c.itemTitle || '{title}', item),\n\t\t\t\t\t\tmeta: this.metaOf(item),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\treturn {\n\t\t\t\t\tkey: String(raw.id ?? `group-${index}`),\n\t\t\t\t\theadingId: `${this.idPrefix}-group-${index}`,\n\t\t\t\t\ttitle: this.fill(c.groupTitle || '{name}', group),\n\t\t\t\t\tcount: this.countOf(items.length),\n\t\t\t\t\titems,\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The closing box of entries available everywhere, or null.\n\t\t *\n\t\t * @return {{headingId: string, title: string, text: string}|null} The box.\n\t\t * @spec openspec/changes/grouped-cards-widget/specs/grouped-cards-widget/spec.md#requirement-a-widget-draws-groups-of-cards-from-an-endpoint\n\t\t */\n\t\textra() {\n\t\t\tconst spec = this.content?.extraGroup\n\t\t\tif (!spec || typeof spec !== 'object' || !spec.path) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst list = readPath(this.payload, spec.path)\n\t\t\tif (!Array.isArray(list) || list.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parts = list\n\t\t\t\t.map((entry) => (entry && typeof entry === 'object' ? this.fill(spec.itemText || '{label}', readable(entry)) : languageMapText(entry)))\n\t\t\t\t.filter((text) => text !== '')\n\t\t\tif (parts.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\theadingId: `${this.idPrefix}-extra`,\n\t\t\t\ttitle: this.translate(spec.title || 'Always available'),\n\t\t\t\ttext: parts.join(typeof spec.join === 'string' ? spec.join : ' · '),\n\t\t\t}\n\t\t},\n\n\t\t/** @return {string} The empty text. */\n\t\temptyLabel() {\n\t\t\treturn this.content?.emptyText ? this.translate(this.content.emptyText) : t('nextcloud-vue', 'Nothing to show yet')\n\t\t},\n\n\t\t/** @return {string} The text of a group without cards. */\n\t\tgroupEmptyLabel() {\n\t\t\treturn this.content?.groupEmptyText ? this.translate(this.content.groupEmptyText) : t('nextcloud-vue', 'Nothing here yet')\n\t\t},\n\n\t\t/** @return {string} The error text. */\n\t\terrorLabel() {\n\t\t\treturn this.content?.errorText ? this.translate(this.content.errorText) : t('nextcloud-vue', 'This list could not be loaded.')\n\t\t},\n\n\t\t/** @return {string} The loading label. */\n\t\tloadingLabel() {\n\t\t\treturn t('nextcloud-vue', 'Loading')\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Translate a text through the host app's catalogue.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translated text.\n\t\t */\n\t\ttranslate(text) {\n\t\t\tconst fn = typeof this.cnTranslate === 'function' ? this.cnTranslate : (key) => key\n\t\t\treturn fn(text)\n\t\t},\n\n\t\t/**\n\t\t * Fill a template from a row, after translating it.\n\t\t *\n\t\t * @param {string} template The template.\n\t\t * @param {object} row The row.\n\t\t * @return {string} The text, '' when a token is empty.\n\t\t */\n\t\tfill(template, row) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.translate(template), row, new Date(), { config: unwrapAppConfig(this.cnAppConfig) })\n\t\t},\n\n\t\t/**\n\t\t * A card's meta line: one template, or several joined with \" · \", a\n\t\t * part whose token is empty being left out with its separator.\n\t\t *\n\t\t * @param {object} item The card's row.\n\t\t * @return {string} The line.\n\t\t */\n\t\tmetaOf(item) {\n\t\t\tconst spec = this.content?.itemMeta\n\t\t\tconst parts = Array.isArray(spec) ? spec : (typeof spec === 'string' ? [spec] : [])\n\t\t\treturn parts.map((part) => this.fill(part, item)).filter((text) => text !== '').join(' · ')\n\t\t},\n\n\t\t/**\n\t\t * The count pill of a group (`groupCount: { one, other }`).\n\t\t *\n\t\t * @param {number} count The number of cards.\n\t\t * @return {string} The text, '' without `groupCount`.\n\t\t */\n\t\tcountOf(count) {\n\t\t\tconst spec = this.content?.groupCount\n\t\t\tif (!spec || typeof spec !== 'object') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst template = count === 1 ? spec.one : spec.other\n\t\t\treturn typeof template === 'string' && template !== '' ? this.translate(template).replace(/\\{count\\}/g, String(count)) : ''\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-grouped-cards__grid {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(var(--cn-grouped-cards-columns, 2), minmax(0, 1fr));\n\tgap: 16px;\n}\n\n@media (max-width: 700px) {\n\t.cn-grouped-cards__grid {\n\t\tgrid-template-columns: minmax(0, 1fr);\n\t}\n}\n\n.cn-grouped-cards__group {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tpadding: 12px 14px 14px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-grouped-cards__group--extra {\n\tbackground: transparent;\n\tborder: 1px dashed var(--color-border-dark);\n}\n\n.cn-grouped-cards__group-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-grouped-cards__group-title {\n\tmargin: 0;\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-grouped-cards__count {\n\tpadding: 2px 8px;\n\tborder-radius: var(--border-radius-pill, 12px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 12px;\n\tfont-weight: 600;\n\twhite-space: nowrap;\n}\n\n.cn-grouped-cards__items {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-grouped-cards__item {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 10px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large, 8px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-grouped-cards__item-title {\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-grouped-cards__item-meta,\n.cn-grouped-cards__extra-text,\n.cn-grouped-cards__group-empty,\n.cn-grouped-cards__state {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-grouped-cards__loading {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding: 8px 0;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_createVNode","_Fragment","_renderList","_createElementVNode"],"mappings":";;;AAWM,EAAA,KAAK,EAAC,kBAAkB;AAAC,EAAA,aAAW,EAAC,kBAAQ;;;;AAC5C,EAAA,KAAA,EAAA,yBAAA;AAAA,EAAA,aAAA,EAAA,wBAAA;;;;AAGF,EAAA,KAAA,EAAA,2BAAA;;;;AAG2B,EAAA,KAAA,EAAA,yBAAA;AAAA,EAAA,aAAA,EAAA,wBAAA;;;AAapB,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,gCAAA,GAAA;;;;AAIQ,EAAA,KAA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KAAA;gCADXD;;AAEE,oBAAA,KAAG,EAAC,wDAAY;oBACjB,iBAAI,EAAA,QAAA,CAAA,KAAA,CAAA,SAAA;AACL,oBAAA,aAAQ,EAAA,wBAAA;;AACR,oBAAAK,kBAAA,CAIG,UAJH,WAIG,EAAA;sBAHFA,kBAEK,CAAA,IAAA,EAAA;wBAFA,EAAE,EAAE,QAAK,CAAA,KAAA,CAAC,SAAA;AAAA,wBAAA,KAAA,EAAA,+BAAA;AACb,uBAAA,EAAAJ,eAAA,CAAA,QAAA,CAAA,KAAA,CAAA,KAAA,CAAA,EAAA,CAAA,oBAAA,WAAA,CAAA;;AAGH,oBAAAI,kBAAA,IAAA,EAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import __sfc_main from './CnGroupedCardsWidget.vue.js';
|
|
2
|
+
import { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
6
|
+
* SPDX-License-Identifier: EUPL-1.2
|
|
7
|
+
*
|
|
8
|
+
* CnGroupedCardsWidget — self-registers the `grouped-cards` widget type
|
|
9
|
+
* (groups of cards side by side, read from an app endpoint) into the shared
|
|
10
|
+
* dashboardWidgetRegistry at module load.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
registerDashboardWidget('grouped-cards', {
|
|
15
|
+
renderer: __sfc_main,
|
|
16
|
+
form: null,
|
|
17
|
+
defaultContent: {
|
|
18
|
+
endpointSource: { url: '' },
|
|
19
|
+
groupsPath: 'groups',
|
|
20
|
+
itemsKey: 'items',
|
|
21
|
+
columns: 2,
|
|
22
|
+
},
|
|
23
|
+
displayName: 'Grouped cards',
|
|
24
|
+
icon: 'ViewGridOutline',
|
|
25
|
+
surfaces: ['detail-page', 'app-dashboard'],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { __sfc_main as CnGroupedCardsWidget, __sfc_main as default };
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/CnGroupedCardsWidget/index.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * CnGroupedCardsWidget — self-registers the `grouped-cards` widget type\n * (groups of cards side by side, read from an app endpoint) into the shared\n * dashboardWidgetRegistry at module load.\n */\n\nimport CnGroupedCardsWidget from './CnGroupedCardsWidget.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\nregisterDashboardWidget('grouped-cards', {\n\trenderer: CnGroupedCardsWidget,\n\tform: null,\n\tdefaultContent: {\n\t\tendpointSource: { url: '' },\n\t\tgroupsPath: 'groups',\n\t\titemsKey: 'items',\n\t\tcolumns: 2,\n\t},\n\tdisplayName: 'Grouped cards',\n\ticon: 'ViewGridOutline',\n\tsurfaces: ['detail-page', 'app-dashboard'],\n})\n\nexport { CnGroupedCardsWidget }\nexport default CnGroupedCardsWidget\n"],"names":["CnGroupedCardsWidget"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA,uBAAuB,CAAC,eAAe,EAAE;AACzC,CAAC,QAAQ,EAAEA,UAAoB;AAC/B,CAAC,IAAI,EAAE,IAAI;AACX,CAAC,cAAc,EAAE;AACjB,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;AAC7B,EAAE,UAAU,EAAE,QAAQ;AACtB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,CAAC;AACZ,EAAE;AACF,CAAC,WAAW,EAAE,eAAe;AAC7B,CAAC,IAAI,EAAE,iBAAiB;AACxB,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,eAAe,CAAC;AAC3C,CAAC;;;;"}
|