@conduction/nextcloud-vue 0.1.0-beta.11 → 0.1.0-beta.12

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 (78) hide show
  1. package/dist/nextcloud-vue.cjs +67614 -0
  2. package/dist/nextcloud-vue.cjs.js +13518 -13617
  3. package/dist/nextcloud-vue.cjs.js.map +1 -1
  4. package/dist/nextcloud-vue.cjs.map +1 -0
  5. package/dist/nextcloud-vue.css +1796 -1800
  6. package/dist/nextcloud-vue.esm.js +13518 -13617
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/package.json +3 -2
  9. package/src/components/CnActionsBar/CnActionsBar.vue +254 -254
  10. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -570
  11. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
  12. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
  13. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -422
  14. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
  15. package/src/components/CnCard/CnCard.vue +415 -415
  16. package/src/components/CnCardGrid/CnCardGrid.vue +156 -156
  17. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  18. package/src/components/CnChartWidget/CnChartWidget.vue +346 -346
  19. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  20. package/src/components/CnContextMenu/CnContextMenu.vue +142 -142
  21. package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -266
  22. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -229
  23. package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -397
  24. package/src/components/CnDataTable/CnDataTable.vue +362 -362
  25. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -177
  26. package/src/components/CnDetailCard/CnDetailCard.vue +225 -225
  27. package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -256
  28. package/src/components/CnDetailPage/CnDetailPage.vue +432 -432
  29. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -234
  30. package/src/components/CnFilterBar/CnFilterBar.vue +153 -153
  31. package/src/components/CnFormDialog/CnFormDialog.vue +1047 -1047
  32. package/src/components/CnIcon/CnIcon.vue +89 -89
  33. package/src/components/CnIndexPage/CnIndexPage.vue +981 -980
  34. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -536
  35. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -219
  36. package/src/components/CnItemCard/CnItemCard.vue +134 -134
  37. package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -312
  38. package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -93
  39. package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -161
  40. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -327
  41. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -245
  42. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -191
  43. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -494
  44. package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
  45. package/src/components/CnNotesCard/CnNotesCard.vue +416 -416
  46. package/src/components/CnObjectCard/CnObjectCard.vue +294 -294
  47. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -854
  48. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -289
  49. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -369
  50. package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -287
  51. package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -250
  52. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -255
  53. package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -259
  54. package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -483
  55. package/src/components/CnPageHeader/CnPageHeader.vue +61 -61
  56. package/src/components/CnPagination/CnPagination.vue +253 -253
  57. package/src/components/CnProgressBar/CnProgressBar.vue +262 -262
  58. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -793
  59. package/src/components/CnRowActions/CnRowActions.vue +95 -95
  60. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
  61. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -788
  62. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
  63. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
  64. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
  65. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  66. package/src/components/CnSettingsSection/CnSettingsSection.vue +267 -267
  67. package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -437
  68. package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -321
  69. package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -90
  70. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -545
  71. package/src/components/CnTableWidget/CnTableWidget.vue +333 -333
  72. package/src/components/CnTasksCard/CnTasksCard.vue +374 -374
  73. package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
  74. package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -294
  75. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -436
  76. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -313
  77. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
  78. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -248
@@ -1,374 +1,374 @@
1
- <!--
2
- CnTasksCard — Inline tasks card for detail pages.
3
-
4
- Displays up to 5 tasks with status indicators, assignee, and due date.
5
- Integrates CnUserActionMenu on assignee names. Highlights overdue tasks.
6
- Wraps CnDetailCard for consistent styling.
7
- -->
8
- <template>
9
- <CnDetailCard :title="titleLabel" :icon="CheckboxMarkedOutline" :collapsible="collapsible">
10
- <div class="cn-tasks-card">
11
- <!-- Loading state -->
12
- <NcLoadingIcon v-if="loading" />
13
-
14
- <!-- Empty state -->
15
- <div v-else-if="allTasks.length === 0" class="cn-tasks-card__empty">
16
- {{ noTasksLabel }}
17
- </div>
18
-
19
- <!-- Tasks list -->
20
- <div v-else class="cn-tasks-card__list">
21
- <div
22
- v-for="task in displayedTasks"
23
- :key="task.id"
24
- class="cn-tasks-card__task">
25
- <!-- Status icon -->
26
- <div class="cn-tasks-card__status-icon">
27
- <CheckboxMarkedOutline
28
- v-if="task.status === 'completed'"
29
- :size="20"
30
- class="cn-tasks-card__icon--completed" />
31
- <ProgressClock
32
- v-else-if="task.status === 'active' || task.status === 'in-process'"
33
- :size="20"
34
- class="cn-tasks-card__icon--active" />
35
- <CloseCircleOutline
36
- v-else-if="task.status === 'terminated'"
37
- :size="20"
38
- class="cn-tasks-card__icon--terminated" />
39
- <CheckboxBlankOutline
40
- v-else
41
- :size="20"
42
- class="cn-tasks-card__icon--available" />
43
- </div>
44
-
45
- <!-- Task content -->
46
- <div class="cn-tasks-card__content">
47
- <span class="cn-tasks-card__title">{{ task.title || task.name }}</span>
48
- <div class="cn-tasks-card__meta">
49
- <!-- Assignee -->
50
- <span v-if="hasAssignee(task)" class="cn-tasks-card__assignee">
51
- <CnUserActionMenu
52
- v-if="!isCurrentUser(task.assignee)"
53
- :user-id="task.assignee"
54
- :display-name="task.assignee">
55
- <span class="cn-tasks-card__assignee-name">{{ task.assignee }}</span>
56
- </CnUserActionMenu>
57
- <span v-else class="cn-tasks-card__assignee-name cn-tasks-card__assignee-name--self">
58
- {{ task.assignee }}
59
- </span>
60
- </span>
61
- <span v-else class="cn-tasks-card__unassigned">
62
- {{ unassignedLabel }}
63
- </span>
64
-
65
- <!-- Due date -->
66
- <span
67
- v-if="task.dueDate"
68
- class="cn-tasks-card__due-date"
69
- :class="{ 'cn-tasks-card__due-date--overdue': isOverdue(task) }">
70
- {{ formatDate(task.dueDate) }}
71
- </span>
72
- </div>
73
- </div>
74
- </div>
75
- </div>
76
- </div>
77
-
78
- <!-- Footer: "Show all" link -->
79
- <template v-if="allTasks.length > maxDisplay" #footer>
80
- <button
81
- class="cn-tasks-card__show-all"
82
- @click="$emit('show-all')">
83
- {{ showAllLabel }} ({{ allTasks.length }})
84
- </button>
85
- </template>
86
- </CnDetailCard>
87
- </template>
88
-
89
- <script>
90
- import { translate as t } from '@nextcloud/l10n'
91
- import { NcLoadingIcon } from '@nextcloud/vue'
92
- import CheckboxMarkedOutline from 'vue-material-design-icons/CheckboxMarkedOutline.vue'
93
- import CheckboxBlankOutline from 'vue-material-design-icons/CheckboxBlankOutline.vue'
94
- import ProgressClock from 'vue-material-design-icons/ProgressClock.vue'
95
- import CloseCircleOutline from 'vue-material-design-icons/CloseCircleOutline.vue'
96
-
97
- import CnDetailCard from '../CnDetailCard/CnDetailCard.vue'
98
- import CnUserActionMenu from '../CnUserActionMenu/CnUserActionMenu.vue'
99
- import { buildHeaders } from '../../utils/index.js'
100
-
101
- /**
102
- * CnTasksCard — Inline tasks widget for detail pages.
103
- *
104
- * Shows up to 5 tasks sorted by due date with status indicators.
105
- * Highlights overdue tasks and integrates CnUserActionMenu on assignees.
106
- *
107
- * @example Basic usage
108
- * <CnTasksCard
109
- * register-id="uuid-register"
110
- * schema-id="uuid-schema"
111
- * object-id="uuid-object" />
112
- *
113
- * @example With sidebar sync
114
- * <CnTasksCard
115
- * register-id="reg"
116
- * schema-id="schema"
117
- * object-id="obj"
118
- * @show-all="openSidebarTasksTab" />
119
- */
120
- export default {
121
- name: 'CnTasksCard',
122
-
123
- components: {
124
- CnDetailCard,
125
- CnUserActionMenu,
126
- NcLoadingIcon,
127
- CheckboxMarkedOutline,
128
- CheckboxBlankOutline,
129
- ProgressClock,
130
- CloseCircleOutline,
131
- },
132
-
133
- props: {
134
- /** OpenRegister register ID */
135
- registerId: {
136
- type: String,
137
- required: true,
138
- },
139
- /** OpenRegister schema ID */
140
- schemaId: {
141
- type: String,
142
- required: true,
143
- },
144
- /** Object UUID */
145
- objectId: {
146
- type: String,
147
- required: true,
148
- },
149
- /** Base API URL for OpenRegister */
150
- apiBase: {
151
- type: String,
152
- default: '/apps/openregister/api',
153
- },
154
- /** Maximum number of tasks to display */
155
- maxDisplay: {
156
- type: Number,
157
- default: 5,
158
- },
159
- /** Whether the card is collapsible */
160
- collapsible: {
161
- type: Boolean,
162
- default: false,
163
- },
164
-
165
- // --- Pre-translated labels ---
166
- titleLabel: { type: String, default: () => t('nextcloud-vue', 'Tasks') },
167
- noTasksLabel: { type: String, default: () => t('nextcloud-vue', 'No tasks') },
168
- showAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },
169
- unassignedLabel: { type: String, default: () => t('nextcloud-vue', 'Unassigned') },
170
- },
171
-
172
- emits: ['show-all'],
173
-
174
- data() {
175
- return {
176
- CheckboxMarkedOutline,
177
- allTasks: [],
178
- loading: false,
179
- }
180
- },
181
-
182
- computed: {
183
- displayedTasks() {
184
- // Sort by due date (soonest first), then limit
185
- const sorted = [...this.allTasks].sort((a, b) => {
186
- const dateA = a.dueDate ? new Date(a.dueDate) : new Date('9999-12-31')
187
- const dateB = b.dueDate ? new Date(b.dueDate) : new Date('9999-12-31')
188
- return dateA - dateB
189
- })
190
- return sorted.slice(0, this.maxDisplay)
191
- },
192
- },
193
-
194
- watch: {
195
- objectId: {
196
- immediate: true,
197
- handler(newId) {
198
- if (newId && this.registerId && this.schemaId) {
199
- this.fetchTasks()
200
- }
201
- },
202
- },
203
- },
204
-
205
- methods: {
206
- hasAssignee(task) {
207
- return task.assignee && task.assignee.trim() !== ''
208
- },
209
-
210
- isCurrentUser(userId) {
211
- const currentUser = typeof OC !== 'undefined' ? OC?.currentUser : null
212
- return userId === currentUser
213
- },
214
-
215
- isOverdue(task) {
216
- if (!task.dueDate || task.status === 'completed') return false
217
- try {
218
- return new Date(task.dueDate) < new Date()
219
- } catch {
220
- return false
221
- }
222
- },
223
-
224
- async fetchTasks() {
225
- if (!this.registerId || !this.schemaId || !this.objectId) return
226
- this.loading = true
227
- try {
228
- const url = `${this.apiBase}/objects/${this.registerId}/${this.schemaId}/${this.objectId}/tasks`
229
- const response = await fetch(url, { headers: buildHeaders() })
230
- if (response.ok) {
231
- const data = await response.json()
232
- this.allTasks = data.results || data || []
233
- }
234
- } catch (err) {
235
- console.error('CnTasksCard: Failed to fetch tasks', err)
236
- } finally {
237
- this.loading = false
238
- }
239
- },
240
-
241
- formatDate(dateStr) {
242
- if (!dateStr) return ''
243
- try {
244
- return new Date(dateStr).toLocaleDateString(undefined, {
245
- year: 'numeric',
246
- month: 'short',
247
- day: 'numeric',
248
- })
249
- } catch {
250
- return dateStr
251
- }
252
- },
253
- },
254
- }
255
- </script>
256
-
257
- <style scoped>
258
- .cn-tasks-card__empty {
259
- text-align: center;
260
- padding: 16px 12px;
261
- color: var(--color-text-maxcontrast);
262
- font-size: 13px;
263
- }
264
-
265
- .cn-tasks-card__list {
266
- display: flex;
267
- flex-direction: column;
268
- }
269
-
270
- .cn-tasks-card__task {
271
- display: flex;
272
- align-items: flex-start;
273
- gap: 10px;
274
- padding: 8px 0;
275
- border-bottom: 1px solid var(--color-border);
276
- }
277
-
278
- .cn-tasks-card__task:last-child {
279
- border-bottom: none;
280
- }
281
-
282
- .cn-tasks-card__status-icon {
283
- flex-shrink: 0;
284
- padding-top: 1px;
285
- }
286
-
287
- .cn-tasks-card__icon--completed {
288
- color: var(--color-success);
289
- }
290
-
291
- .cn-tasks-card__icon--active {
292
- color: var(--color-primary-element);
293
- }
294
-
295
- .cn-tasks-card__icon--terminated {
296
- color: var(--color-error);
297
- }
298
-
299
- .cn-tasks-card__icon--available {
300
- color: var(--color-text-maxcontrast);
301
- }
302
-
303
- .cn-tasks-card__content {
304
- flex: 1;
305
- min-width: 0;
306
- }
307
-
308
- .cn-tasks-card__title {
309
- display: block;
310
- font-size: 13px;
311
- font-weight: 500;
312
- white-space: nowrap;
313
- overflow: hidden;
314
- text-overflow: ellipsis;
315
- }
316
-
317
- .cn-tasks-card__meta {
318
- display: flex;
319
- align-items: center;
320
- gap: 8px;
321
- margin-top: 2px;
322
- font-size: 12px;
323
- color: var(--color-text-maxcontrast);
324
- }
325
-
326
- .cn-tasks-card__assignee-name {
327
- color: var(--color-primary-element);
328
- font-weight: 500;
329
- cursor: pointer;
330
- }
331
-
332
- .cn-tasks-card__assignee-name:hover {
333
- text-decoration: underline;
334
- }
335
-
336
- .cn-tasks-card__assignee-name--self {
337
- color: var(--color-text-maxcontrast);
338
- cursor: default;
339
- }
340
-
341
- .cn-tasks-card__assignee-name--self:hover {
342
- text-decoration: none;
343
- }
344
-
345
- .cn-tasks-card__unassigned {
346
- font-style: italic;
347
- color: var(--color-text-maxcontrast);
348
- }
349
-
350
- .cn-tasks-card__due-date {
351
- white-space: nowrap;
352
- }
353
-
354
- .cn-tasks-card__due-date--overdue {
355
- color: var(--color-error);
356
- font-weight: 500;
357
- }
358
-
359
- .cn-tasks-card__show-all {
360
- background: none;
361
- border: none;
362
- color: var(--color-primary-element);
363
- font-size: 13px;
364
- font-weight: 500;
365
- cursor: pointer;
366
- padding: 0;
367
- width: 100%;
368
- text-align: center;
369
- }
370
-
371
- .cn-tasks-card__show-all:hover {
372
- text-decoration: underline;
373
- }
374
- </style>
1
+ <!--
2
+ CnTasksCard — Inline tasks card for detail pages.
3
+
4
+ Displays up to 5 tasks with status indicators, assignee, and due date.
5
+ Integrates CnUserActionMenu on assignee names. Highlights overdue tasks.
6
+ Wraps CnDetailCard for consistent styling.
7
+ -->
8
+ <template>
9
+ <CnDetailCard :title="titleLabel" :icon="CheckboxMarkedOutline" :collapsible="collapsible">
10
+ <div class="cn-tasks-card">
11
+ <!-- Loading state -->
12
+ <NcLoadingIcon v-if="loading" />
13
+
14
+ <!-- Empty state -->
15
+ <div v-else-if="allTasks.length === 0" class="cn-tasks-card__empty">
16
+ {{ noTasksLabel }}
17
+ </div>
18
+
19
+ <!-- Tasks list -->
20
+ <div v-else class="cn-tasks-card__list">
21
+ <div
22
+ v-for="task in displayedTasks"
23
+ :key="task.id"
24
+ class="cn-tasks-card__task">
25
+ <!-- Status icon -->
26
+ <div class="cn-tasks-card__status-icon">
27
+ <CheckboxMarkedOutline
28
+ v-if="task.status === 'completed'"
29
+ :size="20"
30
+ class="cn-tasks-card__icon--completed" />
31
+ <ProgressClock
32
+ v-else-if="task.status === 'active' || task.status === 'in-process'"
33
+ :size="20"
34
+ class="cn-tasks-card__icon--active" />
35
+ <CloseCircleOutline
36
+ v-else-if="task.status === 'terminated'"
37
+ :size="20"
38
+ class="cn-tasks-card__icon--terminated" />
39
+ <CheckboxBlankOutline
40
+ v-else
41
+ :size="20"
42
+ class="cn-tasks-card__icon--available" />
43
+ </div>
44
+
45
+ <!-- Task content -->
46
+ <div class="cn-tasks-card__content">
47
+ <span class="cn-tasks-card__title">{{ task.title || task.name }}</span>
48
+ <div class="cn-tasks-card__meta">
49
+ <!-- Assignee -->
50
+ <span v-if="hasAssignee(task)" class="cn-tasks-card__assignee">
51
+ <CnUserActionMenu
52
+ v-if="!isCurrentUser(task.assignee)"
53
+ :user-id="task.assignee"
54
+ :display-name="task.assignee">
55
+ <span class="cn-tasks-card__assignee-name">{{ task.assignee }}</span>
56
+ </CnUserActionMenu>
57
+ <span v-else class="cn-tasks-card__assignee-name cn-tasks-card__assignee-name--self">
58
+ {{ task.assignee }}
59
+ </span>
60
+ </span>
61
+ <span v-else class="cn-tasks-card__unassigned">
62
+ {{ unassignedLabel }}
63
+ </span>
64
+
65
+ <!-- Due date -->
66
+ <span
67
+ v-if="task.dueDate"
68
+ class="cn-tasks-card__due-date"
69
+ :class="{ 'cn-tasks-card__due-date--overdue': isOverdue(task) }">
70
+ {{ formatDate(task.dueDate) }}
71
+ </span>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
+ <!-- Footer: "Show all" link -->
79
+ <template v-if="allTasks.length > maxDisplay" #footer>
80
+ <button
81
+ class="cn-tasks-card__show-all"
82
+ @click="$emit('show-all')">
83
+ {{ showAllLabel }} ({{ allTasks.length }})
84
+ </button>
85
+ </template>
86
+ </CnDetailCard>
87
+ </template>
88
+
89
+ <script>
90
+ import { translate as t } from '@nextcloud/l10n'
91
+ import { NcLoadingIcon } from '@nextcloud/vue'
92
+ import CheckboxMarkedOutline from 'vue-material-design-icons/CheckboxMarkedOutline.vue'
93
+ import CheckboxBlankOutline from 'vue-material-design-icons/CheckboxBlankOutline.vue'
94
+ import ProgressClock from 'vue-material-design-icons/ProgressClock.vue'
95
+ import CloseCircleOutline from 'vue-material-design-icons/CloseCircleOutline.vue'
96
+
97
+ import CnDetailCard from '../CnDetailCard/CnDetailCard.vue'
98
+ import CnUserActionMenu from '../CnUserActionMenu/CnUserActionMenu.vue'
99
+ import { buildHeaders } from '../../utils/index.js'
100
+
101
+ /**
102
+ * CnTasksCard — Inline tasks widget for detail pages.
103
+ *
104
+ * Shows up to 5 tasks sorted by due date with status indicators.
105
+ * Highlights overdue tasks and integrates CnUserActionMenu on assignees.
106
+ *
107
+ * @example Basic usage
108
+ * <CnTasksCard
109
+ * register-id="uuid-register"
110
+ * schema-id="uuid-schema"
111
+ * object-id="uuid-object" />
112
+ *
113
+ * @example With sidebar sync
114
+ * <CnTasksCard
115
+ * register-id="reg"
116
+ * schema-id="schema"
117
+ * object-id="obj"
118
+ * @show-all="openSidebarTasksTab" />
119
+ */
120
+ export default {
121
+ name: 'CnTasksCard',
122
+
123
+ components: {
124
+ CnDetailCard,
125
+ CnUserActionMenu,
126
+ NcLoadingIcon,
127
+ CheckboxMarkedOutline,
128
+ CheckboxBlankOutline,
129
+ ProgressClock,
130
+ CloseCircleOutline,
131
+ },
132
+
133
+ props: {
134
+ /** OpenRegister register ID */
135
+ registerId: {
136
+ type: String,
137
+ required: true,
138
+ },
139
+ /** OpenRegister schema ID */
140
+ schemaId: {
141
+ type: String,
142
+ required: true,
143
+ },
144
+ /** Object UUID */
145
+ objectId: {
146
+ type: String,
147
+ required: true,
148
+ },
149
+ /** Base API URL for OpenRegister */
150
+ apiBase: {
151
+ type: String,
152
+ default: '/apps/openregister/api',
153
+ },
154
+ /** Maximum number of tasks to display */
155
+ maxDisplay: {
156
+ type: Number,
157
+ default: 5,
158
+ },
159
+ /** Whether the card is collapsible */
160
+ collapsible: {
161
+ type: Boolean,
162
+ default: false,
163
+ },
164
+
165
+ // --- Pre-translated labels ---
166
+ titleLabel: { type: String, default: () => t('nextcloud-vue', 'Tasks') },
167
+ noTasksLabel: { type: String, default: () => t('nextcloud-vue', 'No tasks') },
168
+ showAllLabel: { type: String, default: () => t('nextcloud-vue', 'Show all') },
169
+ unassignedLabel: { type: String, default: () => t('nextcloud-vue', 'Unassigned') },
170
+ },
171
+
172
+ emits: ['show-all'],
173
+
174
+ data() {
175
+ return {
176
+ CheckboxMarkedOutline,
177
+ allTasks: [],
178
+ loading: false,
179
+ }
180
+ },
181
+
182
+ computed: {
183
+ displayedTasks() {
184
+ // Sort by due date (soonest first), then limit
185
+ const sorted = [...this.allTasks].sort((a, b) => {
186
+ const dateA = a.dueDate ? new Date(a.dueDate) : new Date('9999-12-31')
187
+ const dateB = b.dueDate ? new Date(b.dueDate) : new Date('9999-12-31')
188
+ return dateA - dateB
189
+ })
190
+ return sorted.slice(0, this.maxDisplay)
191
+ },
192
+ },
193
+
194
+ watch: {
195
+ objectId: {
196
+ immediate: true,
197
+ handler(newId) {
198
+ if (newId && this.registerId && this.schemaId) {
199
+ this.fetchTasks()
200
+ }
201
+ },
202
+ },
203
+ },
204
+
205
+ methods: {
206
+ hasAssignee(task) {
207
+ return task.assignee && task.assignee.trim() !== ''
208
+ },
209
+
210
+ isCurrentUser(userId) {
211
+ const currentUser = typeof OC !== 'undefined' ? OC?.currentUser : null
212
+ return userId === currentUser
213
+ },
214
+
215
+ isOverdue(task) {
216
+ if (!task.dueDate || task.status === 'completed') return false
217
+ try {
218
+ return new Date(task.dueDate) < new Date()
219
+ } catch {
220
+ return false
221
+ }
222
+ },
223
+
224
+ async fetchTasks() {
225
+ if (!this.registerId || !this.schemaId || !this.objectId) return
226
+ this.loading = true
227
+ try {
228
+ const url = `${this.apiBase}/objects/${this.registerId}/${this.schemaId}/${this.objectId}/tasks`
229
+ const response = await fetch(url, { headers: buildHeaders() })
230
+ if (response.ok) {
231
+ const data = await response.json()
232
+ this.allTasks = data.results || data || []
233
+ }
234
+ } catch (err) {
235
+ console.error('CnTasksCard: Failed to fetch tasks', err)
236
+ } finally {
237
+ this.loading = false
238
+ }
239
+ },
240
+
241
+ formatDate(dateStr) {
242
+ if (!dateStr) return ''
243
+ try {
244
+ return new Date(dateStr).toLocaleDateString(undefined, {
245
+ year: 'numeric',
246
+ month: 'short',
247
+ day: 'numeric',
248
+ })
249
+ } catch {
250
+ return dateStr
251
+ }
252
+ },
253
+ },
254
+ }
255
+ </script>
256
+
257
+ <style scoped>
258
+ .cn-tasks-card__empty {
259
+ text-align: center;
260
+ padding: 16px 12px;
261
+ color: var(--color-text-maxcontrast);
262
+ font-size: 13px;
263
+ }
264
+
265
+ .cn-tasks-card__list {
266
+ display: flex;
267
+ flex-direction: column;
268
+ }
269
+
270
+ .cn-tasks-card__task {
271
+ display: flex;
272
+ align-items: flex-start;
273
+ gap: 10px;
274
+ padding: 8px 0;
275
+ border-bottom: 1px solid var(--color-border);
276
+ }
277
+
278
+ .cn-tasks-card__task:last-child {
279
+ border-bottom: none;
280
+ }
281
+
282
+ .cn-tasks-card__status-icon {
283
+ flex-shrink: 0;
284
+ padding-top: 1px;
285
+ }
286
+
287
+ .cn-tasks-card__icon--completed {
288
+ color: var(--color-success);
289
+ }
290
+
291
+ .cn-tasks-card__icon--active {
292
+ color: var(--color-primary-element);
293
+ }
294
+
295
+ .cn-tasks-card__icon--terminated {
296
+ color: var(--color-error);
297
+ }
298
+
299
+ .cn-tasks-card__icon--available {
300
+ color: var(--color-text-maxcontrast);
301
+ }
302
+
303
+ .cn-tasks-card__content {
304
+ flex: 1;
305
+ min-width: 0;
306
+ }
307
+
308
+ .cn-tasks-card__title {
309
+ display: block;
310
+ font-size: 13px;
311
+ font-weight: 500;
312
+ white-space: nowrap;
313
+ overflow: hidden;
314
+ text-overflow: ellipsis;
315
+ }
316
+
317
+ .cn-tasks-card__meta {
318
+ display: flex;
319
+ align-items: center;
320
+ gap: 8px;
321
+ margin-top: 2px;
322
+ font-size: 12px;
323
+ color: var(--color-text-maxcontrast);
324
+ }
325
+
326
+ .cn-tasks-card__assignee-name {
327
+ color: var(--color-primary-element);
328
+ font-weight: 500;
329
+ cursor: pointer;
330
+ }
331
+
332
+ .cn-tasks-card__assignee-name:hover {
333
+ text-decoration: underline;
334
+ }
335
+
336
+ .cn-tasks-card__assignee-name--self {
337
+ color: var(--color-text-maxcontrast);
338
+ cursor: default;
339
+ }
340
+
341
+ .cn-tasks-card__assignee-name--self:hover {
342
+ text-decoration: none;
343
+ }
344
+
345
+ .cn-tasks-card__unassigned {
346
+ font-style: italic;
347
+ color: var(--color-text-maxcontrast);
348
+ }
349
+
350
+ .cn-tasks-card__due-date {
351
+ white-space: nowrap;
352
+ }
353
+
354
+ .cn-tasks-card__due-date--overdue {
355
+ color: var(--color-error);
356
+ font-weight: 500;
357
+ }
358
+
359
+ .cn-tasks-card__show-all {
360
+ background: none;
361
+ border: none;
362
+ color: var(--color-primary-element);
363
+ font-size: 13px;
364
+ font-weight: 500;
365
+ cursor: pointer;
366
+ padding: 0;
367
+ width: 100%;
368
+ text-align: center;
369
+ }
370
+
371
+ .cn-tasks-card__show-all:hover {
372
+ text-decoration: underline;
373
+ }
374
+ </style>