@conduction/nextcloud-vue 2.97.0 → 2.98.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 (107) hide show
  1. package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js +17 -0
  2. package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
  3. package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
  4. package/dist/esm/components/CnChartWidget/CnChartWidget.vue.js +1 -1
  5. package/dist/esm/components/CnChartWidget/CnChartWidget.vue2.js +106 -2
  6. package/dist/esm/components/CnChartWidget/CnChartWidget.vue2.js.map +1 -1
  7. package/dist/esm/components/CnChartWidget/CnChartWidget.vue3.js.map +1 -1
  8. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +9 -0
  9. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js.map +1 -0
  10. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +964 -0
  11. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -0
  12. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +282 -0
  13. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -0
  14. package/dist/esm/components/CnChecklistRunWidget/index.js +28 -0
  15. package/dist/esm/components/CnChecklistRunWidget/index.js.map +1 -0
  16. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  17. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +1 -0
  18. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  19. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  20. package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +26 -8
  21. package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
  22. package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
  23. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +188 -5
  24. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  25. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  26. package/dist/esm/components/CnFeaturesAndRoadmapView/CnFeaturesAndRoadmapView.vue.js +1 -1
  27. package/dist/esm/components/CnFeaturesAndRoadmapView/CnFeaturesAndRoadmapView.vue2.js +3 -3
  28. package/dist/esm/components/CnFeaturesAndRoadmapView/CnFeaturesAndRoadmapView.vue2.js.map +1 -1
  29. package/dist/esm/components/CnFeaturesAndRoadmapView/CnFeaturesAndRoadmapView.vue3.js.map +1 -1
  30. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
  31. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js +27 -0
  32. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
  33. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js +16 -2
  34. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
  35. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +43 -3
  36. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  37. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  38. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue.js +9 -0
  39. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue.js.map +1 -0
  40. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js +220 -0
  41. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue2.js.map +1 -0
  42. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js +121 -0
  43. package/dist/esm/components/CnOrderedListField/CnOrderedListField.vue3.js.map +1 -0
  44. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue.js +1 -1
  45. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue2.js +83 -9
  46. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue2.js.map +1 -1
  47. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue3.js +80 -11
  48. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue3.js.map +1 -1
  49. package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
  50. package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
  51. package/dist/esm/composables/indexSources.js +238 -2
  52. package/dist/esm/composables/indexSources.js.map +1 -1
  53. package/dist/esm/composables/useOrganisationStore.js +115 -0
  54. package/dist/esm/composables/useOrganisationStore.js.map +1 -0
  55. package/dist/esm/index.js +2 -0
  56. package/dist/esm/index.js.map +1 -1
  57. package/dist/esm/l10n/en.json.js +15 -1
  58. package/dist/esm/l10n/en.json.js.map +1 -1
  59. package/dist/esm/l10n/nl.json.js +30 -1
  60. package/dist/esm/l10n/nl.json.js.map +1 -1
  61. package/dist/esm/library-style.js +1 -1
  62. package/dist/esm/nextcloud-vue.css +424 -206
  63. package/dist/esm/utils/builtInFormatters.js +34 -1
  64. package/dist/esm/utils/builtInFormatters.js.map +1 -1
  65. package/dist/esm/utils/libraryWidgetKeys.js +1 -0
  66. package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
  67. package/dist/esm/utils/matrixCells.js +158 -0
  68. package/dist/esm/utils/matrixCells.js.map +1 -0
  69. package/dist/esm/utils/nextcloudDirectory.js +121 -0
  70. package/dist/esm/utils/nextcloudDirectory.js.map +1 -0
  71. package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
  72. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  73. package/dist/nextcloud-vue.cjs.js +12538 -9716
  74. package/dist/nextcloud-vue.cjs.js.map +2 -2
  75. package/dist/nextcloud-vue.css +424 -206
  76. package/l10n/en.json +15 -1
  77. package/l10n/nl.json +30 -1
  78. package/package.json +2 -2
  79. package/scripts/merge-l10n.js +196 -0
  80. package/src/components/CnAppRoot/CnAppRoot.md +1 -0
  81. package/src/components/CnAppRoot/CnAppRoot.vue +17 -0
  82. package/src/components/CnChartWidget/CnChartWidget.md +2 -1
  83. package/src/components/CnChartWidget/CnChartWidget.vue +106 -2
  84. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +1269 -0
  85. package/src/components/CnChecklistRunWidget/index.js +27 -0
  86. package/src/components/CnDashboardPage/CnDashboardPage.vue +1 -0
  87. package/src/components/CnDataTable/CnDataTable.vue +26 -8
  88. package/src/components/CnDetailPage/CnDetailPage.md +48 -0
  89. package/src/components/CnDetailPage/CnDetailPage.vue +188 -5
  90. package/src/components/CnFeaturesAndRoadmapView/CnFeaturesAndRoadmapView.vue +3 -3
  91. package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +38 -2
  92. package/src/components/CnIndexPage/CnIndexPage.md +28 -0
  93. package/src/components/CnIndexPage/CnIndexPage.vue +43 -3
  94. package/src/components/CnOrderedListField/CnOrderedListField.vue +386 -0
  95. package/src/components/CnOrderedListField/index.js +7 -0
  96. package/src/components/CnUserSettingsDialog/CnUserSettingsDialog.vue +139 -10
  97. package/src/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
  98. package/src/components/index.js +2 -0
  99. package/src/composables/indexSources.js +237 -1
  100. package/src/composables/useOrganisationStore.js +111 -0
  101. package/src/index.js +2 -0
  102. package/src/schemas/app-manifest-v2.schema.json +33 -3
  103. package/src/utils/builtInFormatters.js +33 -0
  104. package/src/utils/libraryWidgetKeys.js +1 -0
  105. package/src/utils/matrixCells.js +154 -0
  106. package/src/utils/nextcloudDirectory.js +117 -0
  107. package/src/utils/validateManifestV2.compiled.js +3 -3
@@ -21,7 +21,24 @@
21
21
  class="cn-user-settings-dialog__nav"
22
22
  :aria-label="navLabel"
23
23
  data-testid="cn-user-settings-nav">
24
- <ul>
24
+ <!-- `nextcloudLinks`: Nextcloud's own personal settings first, as
25
+ links, then one entry for this app holding its sections. -->
26
+ <ul v-if="ncLinks.length > 0" class="cn-user-settings-dialog__nc-links" data-testid="cn-user-settings-nc-links">
27
+ <li v-for="link in ncLinks" :key="link.key">
28
+ <a :href="link.href" class="cn-user-settings-dialog__nav-link">
29
+ <span v-if="link.icon" class="cn-user-settings-dialog__nav-icon" aria-hidden="true">
30
+ <CnIcon :name="link.icon" :size="18" />
31
+ </span>
32
+ <span>{{ link.label }}</span>
33
+ </a>
34
+ </li>
35
+ </ul>
36
+ <p v-if="ncLinks.length > 0 && appName"
37
+ class="cn-user-settings-dialog__group"
38
+ data-testid="cn-user-settings-app-group">
39
+ {{ appName }}
40
+ </p>
41
+ <ul :class="{ 'cn-user-settings-dialog__group-sections': ncLinks.length > 0 }">
25
42
  <li v-for="section in sections" :key="section.id">
26
43
  <a
27
44
  :href="`#settings-section_${section.id}`"
@@ -41,6 +58,14 @@
41
58
  <div class="cn-user-settings-dialog__sections">
42
59
  <!-- @slot default NcAppSettingsSection children; each registers itself in the navigation. -->
43
60
  <slot />
61
+ <!-- A section's `#icon` also stands before its heading. -->
62
+ <template v-for="section in sections" :key="`heading-icon-${section.id}-${section.name}`">
63
+ <Teleport v-if="section.icon && headingTargets.includes(section.id)" :to="`#settings-section_${section.id}--label`">
64
+ <span class="cn-user-settings-dialog__heading-icon" aria-hidden="true" :data-testid="`cn-user-settings-heading-icon-${section.id}`">
65
+ <CnVNodes :vnodes="section.icon" />
66
+ </span>
67
+ </Teleport>
68
+ </template>
44
69
  </div>
45
70
  </div>
46
71
  <template #actions>
@@ -56,9 +81,11 @@
56
81
 
57
82
  <script>
58
83
  import { translate as t } from '@nextcloud/l10n'
84
+ import { generateUrl } from '@nextcloud/router'
59
85
  import { NcButton } from '@nextcloud/vue'
60
- import { markRaw } from 'vue'
86
+ import { cloneVNode, markRaw, ref } from 'vue'
61
87
  import CnDialog from '../CnDialog/CnDialog.vue'
88
+ import CnIcon from '../CnIcon/CnIcon.vue'
62
89
 
63
90
  /**
64
91
  * The key NcAppSettingsSection injects to register itself with its dialog
@@ -66,20 +93,26 @@ import CnDialog from '../CnDialog/CnDialog.vue'
66
93
  */
67
94
  const REGISTRATION_KEY = Symbol.for('NcAppSettingsDialog:registration')
68
95
 
96
+ /** The key NcAppSettingsSection injects for the legacy design flag. */
97
+ const LEGACY_DESIGN_KEY = Symbol.for('NcAppSettingsDialog:legacy')
98
+
69
99
  /** Renders a section's icon vnodes as they were registered. */
70
100
  const CnVNodes = {
71
101
  name: 'CnVNodes',
72
102
  props: { vnodes: { type: [Array, Object], default: null } },
73
103
  render() {
74
- return this.vnodes
104
+ // A section's icon is drawn twice (navigation and heading), so each draw gets its own copy.
105
+ const list = Array.isArray(this.vnodes) ? this.vnodes : [this.vnodes]
106
+ return list.map((vnode) => (vnode && typeof vnode === 'object' ? cloneVNode(vnode) : vnode))
75
107
  },
76
108
  }
77
109
 
78
110
  /**
79
111
  * CnUserSettingsDialog - the user settings dialog in the board look (board
80
112
  * PqPersoonlijk): eyebrow, title and subtitle, a left navigation listing the
81
- * sections with their icons, the sections themselves, and a footer with a
82
- * note that changes save straight away and a Close button.
113
+ * sections with their icons, the current section (the others stay mounted
114
+ * but hidden), and a footer with a note that changes save straight away and
115
+ * a Close button.
83
116
  *
84
117
  * The sections stay the app's: any `NcAppSettingsSection` in the default slot
85
118
  * registers itself with this dialog exactly as it does with
@@ -93,7 +126,7 @@ const CnVNodes = {
93
126
  export default {
94
127
  name: 'CnUserSettingsDialog',
95
128
 
96
- components: { CnDialog, CnVNodes, NcButton },
129
+ components: { CnDialog, CnIcon, CnVNodes, NcButton },
97
130
 
98
131
  provide() {
99
132
  return {
@@ -101,6 +134,9 @@ export default {
101
134
  registerSection: this.registerSection,
102
135
  unregisterSection: this.unregisterSection,
103
136
  },
137
+
138
+ // NcAppSettingsSection also asks its dialog whether to use the legacy design.
139
+ [LEGACY_DESIGN_KEY]: ref(false),
104
140
  }
105
141
  },
106
142
 
@@ -113,8 +149,15 @@ export default {
113
149
  eyebrow: { type: String, default: () => t('nextcloud-vue', 'Your account') },
114
150
  /** Sentence under the title. */
115
151
  subtitle: { type: String, default: () => t('nextcloud-vue', 'Only for you. Colleagues keep their own settings.') },
116
- /** The app's name, after the footer note. */
152
+ /** The app's name, after the footer note and as the navigation entry holding its sections. */
117
153
  appName: { type: String, default: '' },
154
+ /**
155
+ * Nextcloud's own personal settings, listed first in the navigation as
156
+ * links: `[{ label, section? | href?, icon? }]`. `section` is a
157
+ * personal settings section id (`/settings/user/<section>`). With any,
158
+ * the app's sections sit under one entry named after the app.
159
+ */
160
+ nextcloudLinks: { type: Array, default: () => [] },
118
161
  },
119
162
 
120
163
  emits: ['update:open'],
@@ -123,11 +166,30 @@ export default {
123
166
  return {
124
167
  sections: [],
125
168
  selected: '',
169
+ /** Ids of the sections whose heading is in the page, for the heading icons. */
170
+ headingTargets: [],
126
171
  picked: false,
127
172
  }
128
173
  },
129
174
 
130
175
  computed: {
176
+ /**
177
+ * The Nextcloud links with their URL.
178
+ *
179
+ * @spec openspec/changes/user-settings-nav-groups/specs/user-settings-board-dialog/spec.md#requirement-the-board-user-settings-navigation-can-list-nextclouds-own-sections-first
180
+ * @return {Array<{key: string, label: string, href: string, icon: string}>}
181
+ */
182
+ ncLinks() {
183
+ return (Array.isArray(this.nextcloudLinks) ? this.nextcloudLinks : [])
184
+ .filter((link) => link && typeof link === 'object' && typeof link.label === 'string' && link.label !== '' && (link.href || link.section))
185
+ .map((link, index) => ({
186
+ key: String(link.section || link.href || index),
187
+ label: link.label,
188
+ href: link.href || generateUrl('/settings/user/{section}', { section: String(link.section) }),
189
+ icon: typeof link.icon === 'string' ? link.icon : '',
190
+ }))
191
+ },
192
+
131
193
  /** @return {object} The board's eyebrow: muted, in sentence case. */
132
194
  eyebrowStyle() {
133
195
  return { '--cn-dialog-eyebrow-transform': 'none', '--cn-dialog-eyebrow-color': 'var(--color-text-maxcontrast)' }
@@ -150,6 +212,21 @@ export default {
150
212
  },
151
213
  },
152
214
 
215
+ watch: {
216
+ sections() {
217
+ this.$nextTick(() => {
218
+ this.headingTargets = typeof document === 'undefined'
219
+ ? []
220
+ : this.sections.filter((section) => section.icon && document.getElementById(`settings-section_${section.id}--label`)).map((section) => section.id)
221
+ this.showSelected()
222
+ })
223
+ },
224
+
225
+ selected() {
226
+ this.$nextTick(() => this.showSelected())
227
+ },
228
+ },
229
+
153
230
  methods: {
154
231
  /**
155
232
  * Add a section to the navigation, kept in `order`; a section
@@ -190,9 +267,31 @@ export default {
190
267
  selectSection(id) {
191
268
  this.picked = true
192
269
  this.selected = id
193
- const target = typeof document !== 'undefined' ? document.getElementById(`settings-section_${id}`) : null
194
- if (target && typeof target.scrollIntoView === 'function') {
195
- target.scrollIntoView({ behavior: 'smooth', block: 'start' })
270
+ this.$nextTick(() => {
271
+ this.showSelected()
272
+ const heading = typeof document !== 'undefined' ? document.getElementById(`settings-section_${id}--label`) : null
273
+ if (heading) {
274
+ heading.setAttribute('tabindex', '-1')
275
+ heading.focus()
276
+ }
277
+ })
278
+ },
279
+
280
+ /**
281
+ * Show the current section and hide the others. They stay mounted,
282
+ * so what a reader typed in one survives a switch.
283
+ *
284
+ * @spec openspec/changes/user-settings-one-section/specs/user-settings-board-dialog/spec.md#requirement-the-board-user-settings-dialog-shows-one-section-at-a-time
285
+ */
286
+ showSelected() {
287
+ if (typeof document === 'undefined') {
288
+ return
289
+ }
290
+ for (const section of this.sections) {
291
+ const el = document.getElementById(`settings-section_${section.id}`)
292
+ if (el) {
293
+ el.hidden = section.id !== this.selected
294
+ }
196
295
  }
197
296
  },
198
297
 
@@ -294,6 +393,9 @@ export default {
294
393
  margin: 0 0 12px;
295
394
  font-size: 17px;
296
395
  font-weight: 700;
396
+ display: flex;
397
+ align-items: center;
398
+ gap: 10px;
297
399
  }
298
400
 
299
401
  .cn-user-settings-dialog__note {
@@ -302,4 +404,31 @@ export default {
302
404
  font-size: 14px;
303
405
  color: var(--color-text-maxcontrast);
304
406
  }
407
+
408
+ .cn-user-settings-dialog__nc-links {
409
+ margin-bottom: 2px;
410
+ }
411
+
412
+ .cn-user-settings-dialog__group {
413
+ margin: 10px 0 2px;
414
+ padding: 0 12px;
415
+ font-size: 15px;
416
+ font-weight: 600;
417
+ color: var(--color-main-text);
418
+ }
419
+
420
+ .cn-user-settings-dialog__group-sections {
421
+ padding-inline-start: 12px;
422
+ }
423
+
424
+ .cn-user-settings-dialog__heading-icon {
425
+ display: inline-flex;
426
+ order: -1;
427
+ color: var(--color-text-maxcontrast);
428
+ }
429
+
430
+ /* One section at a time: the others are mounted but hidden. */
431
+ .cn-user-settings-dialog__sections :deep(.app-settings-section[hidden]) {
432
+ display: none;
433
+ }
305
434
  </style>
@@ -75,6 +75,7 @@ import '../CnTasksWidget/index.js'
75
75
  import '../CnSectionsWidget/index.js'
76
76
  import '../CnFactsWidget/index.js'
77
77
  import '../CnDeviceFramesWidget/index.js'
78
+ import '../CnChecklistRunWidget/index.js'
78
79
  import '../CnPartyActionsWidget/index.js'
79
80
  import '../CnFieldListWidget/index.js'
80
81
  import '../CnSettingsFormWidget/index.js'
@@ -27,6 +27,7 @@ export { CnCardGrid } from './CnCardGrid/index.js'
27
27
  export { CnDateAxisView } from './CnDateAxisView/index.js'
28
28
  export { CnObjectRow } from './CnObjectRow/index.js'
29
29
  export { CnObjectList } from './CnObjectList/index.js'
30
+ export { CnOrderedListField } from './CnOrderedListField/index.js'
30
31
  export { CnObjectKanban } from './CnObjectKanban/index.js'
31
32
  export { CnObjectCalendar } from './CnObjectCalendar/index.js'
32
33
  export { CnFolderTree } from './CnFolderTree/index.js'
@@ -221,6 +222,7 @@ export { CnTasksWidgetForm } from './CnTasksWidgetForm/index.js'
221
222
  export { CnSectionsWidget } from './CnSectionsWidget/index.js'
222
223
  export { CnFactsWidget } from './CnFactsWidget/index.js'
223
224
  export { CnDeviceFramesWidget } from './CnDeviceFramesWidget/index.js'
225
+ export { CnChecklistRunWidget } from './CnChecklistRunWidget/index.js'
224
226
  export { CnPartyActionsWidget } from './CnPartyActionsWidget/index.js'
225
227
  export { CnFieldListWidget } from './CnFieldListWidget/index.js'
226
228
  export { CnSettingsFormWidget } from './CnSettingsFormWidget/index.js'
@@ -3,7 +3,7 @@
3
3
  * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
4
4
  */
5
5
 
6
- import { translate as t } from '@nextcloud/l10n'
6
+ import { getCanonicalLocale, translate as t } from '@nextcloud/l10n'
7
7
  import { generateOcsUrl, generateUrl } from '@nextcloud/router'
8
8
  import { reactive } from 'vue'
9
9
  import CalendarClock from 'vue-material-design-icons/CalendarClock.vue'
@@ -12,8 +12,10 @@ import LightningBolt from 'vue-material-design-icons/LightningBolt.vue'
12
12
  import Pencil from 'vue-material-design-icons/Pencil.vue'
13
13
  import { formatRelativeDate } from '../utils/boardDate.js'
14
14
  import { FLOW_RUN_ERROR_STATUSES, flowRunStatuses } from '../utils/flowRunStatus.js'
15
+ import { fetchGroupMembers, fetchPresence, fetchStatuses } from '../utils/nextcloudDirectory.js'
15
16
  import { readPath } from '../utils/readPath.js'
16
17
  import { useFlowStore } from './useFlowStore.js'
18
+ import { organisationRecord, useOrganisationStore } from './useOrganisationStore.js'
17
19
  import { useTaskInboxStore } from './useTaskInboxStore.js'
18
20
 
19
21
  /**
@@ -891,6 +893,210 @@ function searchSource(config = {}) {
891
893
  }
892
894
  }
893
895
 
896
+ /**
897
+ * The users source: the members of a Nextcloud group, with their function,
898
+ * roles, e-mail and whether they are in today (`entitySource: "users"`,
899
+ * DqAfdelingen). Pair it with `folderSidebar: { source: 'groups',
900
+ * filterField: 'group' }`, which lists the groups as the folder tree; the
901
+ * selected group arrives as `group`. `sourceConfig.group` is the group shown
902
+ * before one is picked.
903
+ *
904
+ * Today is the dav app's out-of-office period when one runs now ("Absent
905
+ * until 14 Oct"), else the user status (present, away) and its message. The
906
+ * function is the profile `headline`, the roles the profile `role`, unless
907
+ * `sourceConfig.functionField` / `rolesField` name other user fields.
908
+ * Listing a group needs an admin or the group's sub-admin; a refused request
909
+ * leaves the list empty.
910
+ *
911
+ * @return {object} The source adapter.
912
+ * @spec openspec/changes/index-groups-users-source/specs/index-page/spec.md#requirement-an-index-page-can-list-nextcloud-groups-and-their-members
913
+ */
914
+ function usersSource() {
915
+ const state = reactive({ rows: [], loading: false })
916
+ let seq = 0
917
+ const presenceLabels = {
918
+ present: t('nextcloud-vue', 'Present'),
919
+ away: t('nextcloud-vue', 'Away'),
920
+ }
921
+ const presenceColors = {
922
+ [presenceLabels.present]: 'success',
923
+ [presenceLabels.away]: 'info',
924
+ }
925
+
926
+ return {
927
+ /**
928
+ * Load the group's members and their presence.
929
+ *
930
+ * @param {object} config The page's source config with the picked `group`.
931
+ * @return {Promise<void>} Resolves when loaded.
932
+ */
933
+ load: async (config) => {
934
+ const group = String((config && (config.group || config.defaultGroup)) || '')
935
+ const mine = ++seq
936
+ if (group === '') {
937
+ state.rows = []
938
+ return
939
+ }
940
+ state.loading = true
941
+ try {
942
+ const { default: axios } = await import('@nextcloud/axios')
943
+ const [members, statuses] = await Promise.all([fetchGroupMembers(axios, group), fetchStatuses(axios)])
944
+ const functionField = (config && config.functionField) || 'headline'
945
+ const rolesField = (config && config.rolesField) || 'role'
946
+ const rows = await Promise.all(members.map(async (user) => {
947
+ const presence = await fetchPresence(axios, user.id, statuses[user.id] || null)
948
+ let today = ''
949
+ if (presence.state === 'absent') {
950
+ const until = presence.until ? new Date(`${presence.until}T12:00:00`) : null
951
+ today = until
952
+ ? t('nextcloud-vue', 'Absent until {date}', { date: until.toLocaleDateString(getCanonicalLocale() || undefined, { day: 'numeric', month: 'short' }) })
953
+ : t('nextcloud-vue', 'Absent')
954
+ } else if (presence.message) {
955
+ today = presence.message
956
+ } else if (presenceLabels[presence.state]) {
957
+ today = presenceLabels[presence.state]
958
+ }
959
+ return {
960
+ id: user.id,
961
+ displayname: user.displayname || user['display-name'] || user.id,
962
+ function: String(user[functionField] || ''),
963
+ roles: String(user[rolesField] || ''),
964
+ email: user.email || '',
965
+ today,
966
+ presence: presence.state,
967
+ }
968
+ }))
969
+ if (mine === seq) {
970
+ state.rows = rows.sort((a, b) => a.displayname.localeCompare(b.displayname))
971
+ }
972
+ } catch (error) {
973
+ if (mine === seq) {
974
+ state.rows = []
975
+ }
976
+ throw error
977
+ } finally {
978
+ if (mine === seq) {
979
+ state.loading = false
980
+ }
981
+ }
982
+ },
983
+
984
+ /**
985
+ * @return {Array<object>} The members.
986
+ */
987
+ rows: () => state.rows,
988
+
989
+ /**
990
+ * @return {boolean} Whether a load is in flight.
991
+ */
992
+ loading: () => state.loading,
993
+
994
+ columns: [
995
+ { key: 'displayname', label: t('nextcloud-vue', 'Employee'), secondary: 'function' },
996
+ { key: 'roles', label: t('nextcloud-vue', 'Roles') },
997
+ { key: 'email', label: t('nextcloud-vue', 'E-mail') },
998
+ { key: 'today', label: t('nextcloud-vue', 'Today'), widget: 'badge', widgetProps: { colorMap: presenceColors, variant: 'warning' } },
999
+ ],
1000
+
1001
+ searchFields: {
1002
+ group: { param: 'group', single: true },
1003
+ },
1004
+
1005
+ showAdd: false,
1006
+ }
1007
+ }
1008
+
1009
+ /**
1010
+ * The organisations source: OpenRegister organisations, which are not
1011
+ * register/schema objects.
1012
+ *
1013
+ * The list is the viewer's own organisations and the single read refuses an
1014
+ * organisation the viewer has no access to; both are decided by OpenRegister
1015
+ * from the session. The adapter forwards nothing that could widen that.
1016
+ *
1017
+ * It is a RECORD source as well (`loadRecord` + `record`), so a
1018
+ * `type: "detail"` page with the same `entitySource` shows one organisation
1019
+ * with the header, pills, facts and `@objectId` / `@object.*` tokens an object
1020
+ * page has.
1021
+ *
1022
+ * @return {object} The source adapter.
1023
+ * @spec openspec/changes/organisations-entity-source/specs/organisations-entity-source/spec.md
1024
+ */
1025
+ function organisationsSource() {
1026
+ const store = useOrganisationStore()
1027
+
1028
+ const statusLabels = {
1029
+ provisioning: t('nextcloud-vue', 'Provisioning'),
1030
+ active: t('nextcloud-vue', 'Active'),
1031
+ suspended: t('nextcloud-vue', 'Suspended'),
1032
+ deprovisioning: t('nextcloud-vue', 'Deprovisioning'),
1033
+ archived: t('nextcloud-vue', 'Archived'),
1034
+ retained: t('nextcloud-vue', 'Retained'),
1035
+ }
1036
+
1037
+ return {
1038
+ store,
1039
+
1040
+ /**
1041
+ * Load the viewer's organisations. The endpoint takes no parameters.
1042
+ *
1043
+ * @return {Promise<void>} Resolves when loaded.
1044
+ */
1045
+ load: () => store.load(),
1046
+
1047
+ /**
1048
+ * @return {Array<object>} The rows, keyed on the organisation uuid.
1049
+ */
1050
+ rows: () => (store.organisations || []).map(organisationRecord),
1051
+
1052
+ /**
1053
+ * @return {boolean} Whether a load is in flight.
1054
+ */
1055
+ loading: () => !!store.loading,
1056
+
1057
+ /**
1058
+ * Read one organisation for a detail page.
1059
+ *
1060
+ * @param {string} id The organisation uuid.
1061
+ * @return {Promise<object|null>} The organisation, or null when it could not be read.
1062
+ */
1063
+ loadRecord: (id) => store.fetchRecord(id),
1064
+
1065
+ /**
1066
+ * @param {string} id The organisation uuid.
1067
+ * @return {object|null} The organisation read for this id, keyed on its uuid, or null.
1068
+ */
1069
+ record: (id) => {
1070
+ const organisation = store.records?.[String(id)]
1071
+ return organisation ? organisationRecord(organisation) : null
1072
+ },
1073
+
1074
+ /**
1075
+ * @param {string} id The organisation uuid.
1076
+ * @return {number|null} The HTTP status of a failed read of this id, or null.
1077
+ */
1078
+ recordError: (id) => store.recordErrors?.[String(id)] ?? null,
1079
+
1080
+ columns: [
1081
+ { key: 'name', label: t('nextcloud-vue', 'Name') },
1082
+ {
1083
+ key: 'status',
1084
+ label: t('nextcloud-vue', 'Status'),
1085
+ enum: Object.keys(statusLabels),
1086
+ enumLabels: statusLabels,
1087
+ colorMap: { active: 'success', provisioning: 'info', suspended: 'warning', deprovisioning: 'error', archived: 'default', retained: 'default' },
1088
+ },
1089
+ { key: 'type', label: t('nextcloud-vue', 'Type') },
1090
+ { key: 'created', label: t('nextcloud-vue', 'Created'), type: 'string', format: 'date-time' },
1091
+ ],
1092
+
1093
+ // Creating an organisation is not the index's object form, and
1094
+ // OpenRegister has no delete for one, so neither action is offered.
1095
+ showAdd: false,
1096
+ title: t('nextcloud-vue', 'Organisations'),
1097
+ }
1098
+ }
1099
+
894
1100
  /**
895
1101
  * The registered sources, by the name a manifest uses.
896
1102
  *
@@ -904,6 +1110,8 @@ export const indexSources = {
904
1110
  tasks: tasksSource,
905
1111
  endpoint: endpointSource,
906
1112
  search: searchSource,
1113
+ users: usersSource,
1114
+ organisations: organisationsSource,
907
1115
  }
908
1116
 
909
1117
  /**
@@ -935,3 +1143,31 @@ export function resolveIndexSource(name, config) {
935
1143
 
936
1144
  return factory(config || {})
937
1145
  }
1146
+
1147
+ /**
1148
+ * Resolve a named source for ONE record, for a `type: "detail"` page.
1149
+ *
1150
+ * The same registry as the index: a source that can also read a single record
1151
+ * supplies `loadRecord(id)` and `record(id)`, and the detail page names it with
1152
+ * the same `entitySource`. A name that is unknown, or a source that cannot read
1153
+ * one record, resolves to null with a console warning, and the page shows no
1154
+ * record rather than the wrong one.
1155
+ *
1156
+ * @param {string} name The source name from `config.entitySource`.
1157
+ * @return {object|null} The adapter, or null.
1158
+ * @spec openspec/changes/organisations-entity-source/specs/organisations-entity-source/spec.md
1159
+ */
1160
+ export function resolveRecordSource(name) {
1161
+ const key = String(name || '')
1162
+ if (!key) {
1163
+ return null
1164
+ }
1165
+ const factory = indexSources[key]
1166
+ const source = typeof factory === 'function' ? factory() : null
1167
+ if (!source || typeof source.loadRecord !== 'function' || typeof source.record !== 'function') {
1168
+ // eslint-disable-next-line no-console
1169
+ console.warn(`[CnDetailPage] entitySource "${key}" is not a source that reads one record. The page shows no record.`)
1170
+ return null
1171
+ }
1172
+ return source
1173
+ }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * SPDX-License-Identifier: EUPL-1.2
3
+ * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
4
+ */
5
+
6
+ import axios from '@nextcloud/axios'
7
+ import { generateUrl } from '@nextcloud/router'
8
+ import { defineStore } from 'pinia'
9
+
10
+ /**
11
+ * OpenRegister's organisation endpoints, behind the `organisations` entity source.
12
+ *
13
+ * An organisation is not a register/schema object, so the object store cannot
14
+ * read it. Both reads answer from the session: the list holds only the
15
+ * organisations the viewer belongs to, and one organisation answers 403 when
16
+ * the viewer has no access to it. This store adds no check of its own and
17
+ * skips none.
18
+ *
19
+ * @type {string}
20
+ */
21
+ export const ORGANISATIONS_URL = '/apps/openregister/api/organisations'
22
+
23
+ /**
24
+ * One organisation as a row or a record: the organisation as OpenRegister
25
+ * serialises it, with `id` set to its uuid. An OpenRegister object's `id` is
26
+ * its uuid as well, so `@object.id`, a row route and the page's `objectId`
27
+ * all name the same thing. The numeric database id stays out of sight.
28
+ *
29
+ * @param {object} organisation The organisation from the endpoint.
30
+ * @return {object} The organisation keyed on its uuid.
31
+ */
32
+ export function organisationRecord(organisation) {
33
+ return { ...organisation, id: organisation?.uuid ?? organisation?.id ?? null }
34
+ }
35
+
36
+ /**
37
+ * The organisations store.
38
+ *
39
+ * @spec openspec/changes/organisations-entity-source/specs/organisations-entity-source/spec.md
40
+ */
41
+ export const useOrganisationStore = defineStore('cnOrganisations', {
42
+ state: () => ({
43
+ /** @type {Array<object>} The viewer's organisations, as the list endpoint returned them. */
44
+ organisations: [],
45
+ /** @type {boolean} Whether the list load is in flight. */
46
+ loading: false,
47
+ /** @type {string|null} The last list failure, for the console trail. */
48
+ error: null,
49
+ /** @type {Record<string, object>} Single organisations read so far, by uuid. */
50
+ records: {},
51
+ /** @type {Record<string, number|null>} The HTTP status of a failed single read, by uuid. */
52
+ recordErrors: {},
53
+ }),
54
+
55
+ actions: {
56
+ /**
57
+ * Load the viewer's organisations. The endpoint takes no parameters and
58
+ * returns every organisation the viewer belongs to in one response.
59
+ *
60
+ * @return {Promise<void>} Resolves when the rows are in the store.
61
+ */
62
+ async load() {
63
+ this.loading = true
64
+ this.error = null
65
+ try {
66
+ const response = await axios.get(generateUrl(ORGANISATIONS_URL))
67
+ this.organisations = Array.isArray(response.data?.results) ? response.data.results : []
68
+ } catch (error) {
69
+ this.error = error?.message || String(error)
70
+ this.organisations = []
71
+ // eslint-disable-next-line no-console
72
+ console.error('[useOrganisationStore] Loading the organisations failed', error)
73
+ } finally {
74
+ this.loading = false
75
+ }
76
+ },
77
+
78
+ /**
79
+ * Read one organisation into `records`. A refusal (403) or a missing
80
+ * organisation (404) leaves no record and keeps the status in
81
+ * `recordErrors`, so the page can tell "not found" from "still loading".
82
+ *
83
+ * @param {string} uuid The organisation uuid.
84
+ * @return {Promise<object|null>} The organisation, or null when it could not be read.
85
+ */
86
+ async fetchRecord(uuid) {
87
+ const key = String(uuid || '')
88
+ if (key === '') {
89
+ return null
90
+ }
91
+ try {
92
+ const response = await axios.get(generateUrl(`${ORGANISATIONS_URL}/${encodeURIComponent(key)}`))
93
+ const organisation = response.data?.organisation || null
94
+ const { [key]: dropped, ...errors } = this.recordErrors
95
+ this.recordErrors = errors
96
+ if (!organisation) {
97
+ return null
98
+ }
99
+ this.records = { ...this.records, [key]: organisation }
100
+ return organisation
101
+ } catch (error) {
102
+ const { [key]: dropped, ...records } = this.records
103
+ this.records = records
104
+ this.recordErrors = { ...this.recordErrors, [key]: error?.response?.status ?? null }
105
+ // eslint-disable-next-line no-console
106
+ console.error(`[useOrganisationStore] Loading organisation "${key}" failed`, error)
107
+ return null
108
+ }
109
+ },
110
+ },
111
+ })
package/src/index.js CHANGED
@@ -59,6 +59,7 @@ export {
59
59
  CnChartWidget,
60
60
  CnChartWidgetForm,
61
61
  CnChatPage,
62
+ CnChecklistRunWidget,
62
63
  CnChildRecordsField,
63
64
  CnChipsFieldWidget,
64
65
  CnChoiceCards,
@@ -236,6 +237,7 @@ export {
236
237
  CnObjectRow,
237
238
  CnObjectSidebar,
238
239
  CnOfflineQueue,
240
+ CnOrderedListField,
239
241
  CnPageHeader,
240
242
  CnPageRenderer,
241
243
  CnPagination,