@conduction/nextcloud-vue 2.56.0-beta.70 → 2.56.0-beta.71

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 (38) hide show
  1. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  2. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +67 -1
  3. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  4. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  5. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
  6. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  7. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  8. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
  9. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  10. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  11. package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
  12. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
  13. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
  14. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
  15. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
  16. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
  17. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
  18. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
  19. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
  20. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
  21. package/dist/esm/l10n/en.json.js +59 -59
  22. package/dist/esm/l10n/nl.json.js +59 -59
  23. package/dist/esm/library-style.js +1 -1
  24. package/dist/esm/nextcloud-vue.css +55 -55
  25. package/dist/esm/utils/parentCrumb.js +86 -0
  26. package/dist/esm/utils/parentCrumb.js.map +1 -0
  27. package/dist/nextcloud-vue.cjs.js +813 -576
  28. package/dist/nextcloud-vue.cjs.js.map +2 -2
  29. package/dist/nextcloud-vue.css +55 -55
  30. package/l10n/en.json +59 -59
  31. package/l10n/nl.json +59 -59
  32. package/package.json +1 -1
  33. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +67 -1
  34. package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
  35. package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
  36. package/src/components/CnStorePage/CnStorePage.vue +8 -8
  37. package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
  38. package/src/utils/parentCrumb.js +83 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ *
5
+ * parentCrumb: the breadcrumb entry for the record a sub-record belongs to.
6
+ *
7
+ * A crumb that carries `parent` names a `visibilityContext` entry of the
8
+ * detail page. The page reads that record beside the loaded one; this
9
+ * helper turns it into a crumb with the parent's label and a link to its
10
+ * page.
11
+ *
12
+ * @module utils/parentCrumb
13
+ */
14
+
15
+ /**
16
+ * Read a dotted path from an object.
17
+ *
18
+ * @param {object|null} obj The object to read.
19
+ * @param {string} path A dotted path, e.g. `identifier` or `@self.name`.
20
+ * @return {unknown} The value, or undefined.
21
+ */
22
+ function readPath(obj, path) {
23
+ return path.split('.').reduce((o, part) => (o === null || o === undefined ? undefined : o[part]), obj)
24
+ }
25
+
26
+ /**
27
+ * A non-empty string for a value, or ''.
28
+ *
29
+ * @param {unknown} value Any value.
30
+ * @return {string} The text.
31
+ */
32
+ function text(value) {
33
+ if (typeof value === 'number') {
34
+ return String(value)
35
+ }
36
+ return typeof value === 'string' ? value.trim() : ''
37
+ }
38
+
39
+ /**
40
+ * The crumb for a record's parent.
41
+ *
42
+ * The crumb is dropped (null) when the record holds no reference to a
43
+ * parent. Its label is the parent's `labelField` value, else the parent's
44
+ * name or title, else the crumb's own `label` (translated); without any of
45
+ * those it is dropped too. The link goes to `route` with the parent's id in
46
+ * `param` (default `id`), or to `href` with `{id}` filled in.
47
+ *
48
+ * @param {object} crumb `{ parent, labelField?, label?, route?, params?, param?, href?, icon? }`.
49
+ * @param {Array<{key: string, id: string}>} refs The page's context references.
50
+ * @param {object} rows The context records read so far, by name.
51
+ * @param {(key: string) => string} translate The host translate function.
52
+ * @return {{label: string, to?: object, href?: string, icon?: string}|null} The crumb, or null.
53
+ * @spec openspec/changes/detail-parent-crumb/specs/detail-page/spec.md#requirement-a-sub-record-trail-can-show-its-parent-record
54
+ */
55
+ export function parentCrumb(crumb, refs, rows, translate) {
56
+ const ref = (refs || []).find((r) => r.key === crumb.parent)
57
+ if (!ref || !ref.id) {
58
+ return null
59
+ }
60
+ const row = rows && rows[crumb.parent] && typeof rows[crumb.parent] === 'object' ? rows[crumb.parent] : null
61
+ let label = ''
62
+ if (row) {
63
+ label = (typeof crumb.labelField === 'string' && crumb.labelField !== '' ? text(readPath(row, crumb.labelField)) : '')
64
+ || text(readPath(row, '@self.name')) || text(row.name) || text(row.title)
65
+ }
66
+ if (label === '' && typeof crumb.label === 'string' && crumb.label !== '') {
67
+ label = translate(crumb.label)
68
+ }
69
+ if (label === '') {
70
+ return null
71
+ }
72
+ const entry = { label }
73
+ if (typeof crumb.icon === 'string' && crumb.icon !== '') {
74
+ entry.icon = crumb.icon
75
+ }
76
+ if (crumb.route) {
77
+ const param = typeof crumb.param === 'string' && crumb.param !== '' ? crumb.param : 'id'
78
+ entry.to = { name: crumb.route, params: { ...(crumb.params || {}), [param]: ref.id } }
79
+ } else if (typeof crumb.href === 'string' && crumb.href !== '') {
80
+ entry.href = crumb.href.split('{id}').join(encodeURIComponent(ref.id))
81
+ }
82
+ return entry
83
+ }