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

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 (208) hide show
  1. package/README.md +226 -0
  2. package/css/index.css +5 -0
  3. package/dist/nextcloud-vue.cjs.js +79416 -7715
  4. package/dist/nextcloud-vue.cjs.js.map +1 -1
  5. package/dist/nextcloud-vue.css +3583 -504
  6. package/dist/nextcloud-vue.esm.js +79343 -7692
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/l10n/en.json +164 -0
  9. package/l10n/nl.json +164 -0
  10. package/package.json +104 -63
  11. package/src/components/CnActionsBar/CnActionsBar.vue +254 -0
  12. package/src/components/CnActionsBar/index.js +1 -0
  13. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -0
  14. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
  15. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
  16. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -0
  17. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
  18. package/src/components/CnAdvancedFormDialog/index.js +1 -0
  19. package/src/components/CnCard/CnCard.vue +415 -0
  20. package/src/components/CnCard/index.js +1 -0
  21. package/src/components/CnCardGrid/CnCardGrid.vue +156 -152
  22. package/src/components/CnCardGrid/index.js +1 -1
  23. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  24. package/src/components/CnCellRenderer/index.js +1 -1
  25. package/src/components/CnChartWidget/CnChartWidget.vue +346 -0
  26. package/src/components/CnChartWidget/index.js +1 -0
  27. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  28. package/src/components/CnConfigurationCard/index.js +1 -1
  29. package/src/components/CnContextMenu/CnContextMenu.vue +142 -0
  30. package/src/components/CnContextMenu/index.js +1 -0
  31. package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -0
  32. package/src/components/CnCopyDialog/index.js +1 -0
  33. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -0
  34. package/src/components/CnDashboardGrid/index.js +1 -0
  35. package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -0
  36. package/src/components/CnDashboardPage/index.js +1 -0
  37. package/src/components/CnDataTable/CnDataTable.vue +362 -354
  38. package/src/components/CnDataTable/index.js +1 -1
  39. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -0
  40. package/src/components/CnDeleteDialog/index.js +1 -0
  41. package/src/components/CnDetailCard/CnDetailCard.vue +225 -0
  42. package/src/components/CnDetailCard/index.js +1 -0
  43. package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -0
  44. package/src/components/CnDetailGrid/index.js +1 -0
  45. package/src/components/CnDetailPage/CnDetailPage.vue +432 -0
  46. package/src/components/CnDetailPage/index.js +1 -0
  47. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -223
  48. package/src/components/CnFacetSidebar/index.js +1 -1
  49. package/src/components/CnFilterBar/CnFilterBar.vue +153 -152
  50. package/src/components/CnFilterBar/index.js +1 -1
  51. package/src/components/CnFormDialog/CnFormDialog.vue +1047 -0
  52. package/src/components/CnFormDialog/index.js +1 -0
  53. package/src/components/CnIcon/CnIcon.vue +89 -0
  54. package/src/components/CnIcon/index.js +1 -0
  55. package/src/components/CnIndexPage/CnIndexPage.vue +980 -682
  56. package/src/components/CnIndexPage/index.js +1 -1
  57. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -0
  58. package/src/components/CnIndexSidebar/index.js +1 -0
  59. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -0
  60. package/src/components/CnInfoWidget/index.js +1 -0
  61. package/src/components/CnItemCard/CnItemCard.vue +134 -0
  62. package/src/components/CnItemCard/index.js +1 -0
  63. package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -0
  64. package/src/components/CnJsonViewer/index.js +1 -0
  65. package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -89
  66. package/src/components/CnKpiGrid/index.js +1 -1
  67. package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -160
  68. package/src/components/CnMassActionBar/index.js +1 -1
  69. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -320
  70. package/src/components/CnMassCopyDialog/index.js +1 -1
  71. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -238
  72. package/src/components/CnMassDeleteDialog/index.js +1 -1
  73. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -190
  74. package/src/components/CnMassExportDialog/index.js +1 -1
  75. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -491
  76. package/src/components/CnMassImportDialog/index.js +1 -1
  77. package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
  78. package/src/components/CnNoteCard/index.js +1 -0
  79. package/src/components/CnNotesCard/CnNotesCard.vue +416 -0
  80. package/src/components/CnNotesCard/index.js +1 -0
  81. package/src/components/CnObjectCard/CnObjectCard.vue +294 -292
  82. package/src/components/CnObjectCard/index.js +1 -1
  83. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -0
  84. package/src/components/CnObjectDataWidget/index.js +1 -0
  85. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -0
  86. package/src/components/CnObjectMetadataWidget/index.js +1 -0
  87. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -0
  88. package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -0
  89. package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -0
  90. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -0
  91. package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -0
  92. package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -0
  93. package/src/components/CnObjectSidebar/index.js +6 -0
  94. package/src/components/CnPageHeader/CnPageHeader.vue +61 -0
  95. package/src/components/CnPageHeader/index.js +1 -0
  96. package/src/components/CnPagination/CnPagination.vue +253 -252
  97. package/src/components/CnPagination/index.js +1 -1
  98. package/src/components/CnProgressBar/CnProgressBar.vue +262 -0
  99. package/src/components/CnProgressBar/index.js +1 -0
  100. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -0
  101. package/src/components/CnRegisterMapping/index.js +1 -0
  102. package/src/components/CnRowActions/CnRowActions.vue +95 -73
  103. package/src/components/CnRowActions/index.js +1 -1
  104. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
  105. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -0
  106. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
  107. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
  108. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
  109. package/src/components/CnSchemaFormDialog/index.js +1 -0
  110. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  111. package/src/components/CnSettingsCard/index.js +1 -1
  112. package/src/components/CnSettingsSection/CnSettingsSection.vue +267 -266
  113. package/src/components/CnSettingsSection/index.js +1 -1
  114. package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -366
  115. package/src/components/CnStatsBlock/index.js +1 -1
  116. package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -0
  117. package/src/components/CnStatsPanel/index.js +1 -0
  118. package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -77
  119. package/src/components/CnStatusBadge/index.js +1 -1
  120. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -0
  121. package/src/components/CnTabbedFormDialog/index.js +1 -0
  122. package/src/components/CnTableWidget/CnTableWidget.vue +333 -0
  123. package/src/components/CnTableWidget/index.js +1 -0
  124. package/src/components/CnTasksCard/CnTasksCard.vue +374 -0
  125. package/src/components/CnTasksCard/index.js +1 -0
  126. package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
  127. package/src/components/CnTileWidget/index.js +1 -0
  128. package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -0
  129. package/src/components/CnTimelineStages/index.js +1 -0
  130. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -0
  131. package/src/components/CnUserActionMenu/index.js +1 -0
  132. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -312
  133. package/src/components/CnVersionInfoCard/index.js +1 -1
  134. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
  135. package/src/components/CnWidgetRenderer/index.js +1 -0
  136. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -0
  137. package/src/components/CnWidgetWrapper/index.js +1 -0
  138. package/src/components/index.js +57 -25
  139. package/src/composables/index.js +5 -3
  140. package/src/composables/useContextMenu.js +126 -0
  141. package/src/composables/useDashboardView.js +286 -0
  142. package/src/composables/useDetailView.js +290 -132
  143. package/src/composables/useListView.js +364 -153
  144. package/src/composables/useSubResource.js +142 -142
  145. package/src/constants/metadata.js +30 -0
  146. package/src/css/CnSchemaFormDialog.css +546 -0
  147. package/src/css/__sample_nextcloud_tokens.css +110 -0
  148. package/src/css/actions-bar.css +54 -0
  149. package/src/css/badge.css +83 -51
  150. package/src/css/card.css +129 -128
  151. package/src/css/context-menu.css +20 -0
  152. package/src/css/dashboard.css +70 -0
  153. package/src/css/detail-page.css +235 -0
  154. package/src/css/detail.css +68 -68
  155. package/src/css/index-page.css +44 -0
  156. package/src/css/index-sidebar.css +193 -0
  157. package/src/css/index.css +17 -8
  158. package/src/css/layout.css +90 -90
  159. package/src/css/page-header.css +35 -0
  160. package/src/css/pagination.css +72 -72
  161. package/src/css/table.css +142 -143
  162. package/src/css/timeline-stages.css +220 -0
  163. package/src/css/utilities.css +46 -46
  164. package/src/index.js +95 -50
  165. package/src/l10n/index.js +12 -0
  166. package/src/mixins/gridLayout.js +118 -0
  167. package/src/store/createCrudStore.d.ts +350 -0
  168. package/src/store/createCrudStore.js +413 -0
  169. package/src/store/createSubResourcePlugin.js +125 -135
  170. package/src/store/index.js +4 -3
  171. package/src/store/pluginMerge.js +55 -0
  172. package/src/store/plugins/auditTrails.js +357 -17
  173. package/src/store/plugins/files.js +250 -186
  174. package/src/store/plugins/index.js +8 -4
  175. package/src/store/plugins/lifecycle.js +180 -180
  176. package/src/store/plugins/logs.d.ts +22 -0
  177. package/src/store/plugins/logs.js +172 -0
  178. package/src/store/plugins/registerMapping.js +195 -0
  179. package/src/store/plugins/relations.js +68 -68
  180. package/src/store/plugins/search.js +385 -0
  181. package/src/store/plugins/selection.js +104 -0
  182. package/src/store/useObjectStore.js +793 -625
  183. package/src/types/auditTrail.d.ts +32 -32
  184. package/src/types/file.d.ts +23 -23
  185. package/src/types/index.d.ts +67 -35
  186. package/src/types/notification.d.ts +36 -36
  187. package/src/types/object.d.ts +40 -40
  188. package/src/types/organisation.d.ts +41 -41
  189. package/src/types/register.d.ts +25 -25
  190. package/src/types/schema.d.ts +39 -39
  191. package/src/types/shared.d.ts +79 -79
  192. package/src/types/source.d.ts +14 -14
  193. package/src/types/task.d.ts +31 -31
  194. package/src/utils/errors.js +96 -96
  195. package/src/utils/getTheme.js +9 -0
  196. package/src/utils/headers.js +80 -44
  197. package/src/utils/id.js +13 -0
  198. package/src/utils/index.js +4 -3
  199. package/src/utils/schema.js +423 -287
  200. package/src/utils/widgetVisibility.js +162 -0
  201. package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +0 -88
  202. package/src/components/CnDetailViewLayout/index.js +0 -1
  203. package/src/components/CnEmptyState/CnEmptyState.vue +0 -78
  204. package/src/components/CnEmptyState/index.js +0 -1
  205. package/src/components/CnListViewLayout/CnListViewLayout.vue +0 -80
  206. package/src/components/CnListViewLayout/index.js +0 -1
  207. package/src/components/CnViewModeToggle/CnViewModeToggle.vue +0 -77
  208. package/src/components/CnViewModeToggle/index.js +0 -1
@@ -0,0 +1,436 @@
1
+ <!--
2
+ CnUserActionMenu — Popover menu triggered by clicking a user name.
3
+
4
+ Shows avatar, display name, and contextual actions (message, chat, email, meeting)
5
+ based on which Nextcloud apps are installed (Talk, Mail, Calendar).
6
+ -->
7
+ <template>
8
+ <span class="cn-user-action-menu">
9
+ <span
10
+ ref="trigger"
11
+ class="cn-user-action-menu__trigger"
12
+ :class="{ 'cn-user-action-menu__trigger--interactive': interactive }"
13
+ role="button"
14
+ :tabindex="interactive ? 0 : -1"
15
+ :aria-haspopup="interactive ? 'menu' : undefined"
16
+ @click="interactive && openMenu()"
17
+ @keydown.enter.prevent="interactive && openMenu()"
18
+ @keydown.space.prevent="interactive && openMenu()">
19
+ <slot>{{ displayName }}</slot>
20
+ </span>
21
+
22
+ <NcPopover
23
+ v-if="interactive"
24
+ :shown.sync="isOpen"
25
+ :trigger="triggerElements"
26
+ placement="bottom-start"
27
+ @after-hide="onClose">
28
+ <div
29
+ class="cn-user-action-menu__popover"
30
+ role="menu"
31
+ :aria-label="'Actions for ' + displayName"
32
+ @keydown.escape.prevent="closeMenu">
33
+ <!-- User info header -->
34
+ <div class="cn-user-action-menu__header">
35
+ <NcAvatar
36
+ :user="userId"
37
+ :display-name="displayName"
38
+ :size="36"
39
+ :show-user-status="false" />
40
+ <div class="cn-user-action-menu__user-info">
41
+ <span class="cn-user-action-menu__display-name">{{ displayName }}</span>
42
+ <span v-if="userEmail" class="cn-user-action-menu__email">{{ userEmail }}</span>
43
+ </div>
44
+ </div>
45
+
46
+ <!-- Action buttons -->
47
+ <div class="cn-user-action-menu__actions">
48
+ <NcActionButton
49
+ v-if="hasTalk"
50
+ role="menuitem"
51
+ @click="sendMessage">
52
+ <template #icon>
53
+ <MessageTextOutline :size="20" />
54
+ </template>
55
+ {{ sendMessageLabel }}
56
+ </NcActionButton>
57
+
58
+ <NcActionButton
59
+ v-if="hasTalk"
60
+ role="menuitem"
61
+ @click="startChat">
62
+ <template #icon>
63
+ <ChatOutline :size="20" />
64
+ </template>
65
+ {{ startChatLabel }}
66
+ </NcActionButton>
67
+
68
+ <NcActionButton
69
+ v-if="showEmailAction"
70
+ role="menuitem"
71
+ @click="sendEmail">
72
+ <template #icon>
73
+ <EmailOutline :size="20" />
74
+ </template>
75
+ {{ sendEmailLabel }}
76
+ </NcActionButton>
77
+
78
+ <NcActionButton
79
+ v-if="hasCalendar"
80
+ role="menuitem"
81
+ @click="planMeeting">
82
+ <template #icon>
83
+ <CalendarOutline :size="20" />
84
+ </template>
85
+ {{ planMeetingLabel }}
86
+ </NcActionButton>
87
+
88
+ <div
89
+ v-if="!hasTalk && !showEmailAction && !hasCalendar"
90
+ class="cn-user-action-menu__no-actions">
91
+ {{ noActionsLabel }}
92
+ </div>
93
+ </div>
94
+ </div>
95
+ </NcPopover>
96
+ </span>
97
+ </template>
98
+
99
+ <script>
100
+ import { translate as t } from '@nextcloud/l10n'
101
+ import { NcPopover, NcActionButton, NcAvatar } from '@nextcloud/vue'
102
+
103
+ import MessageTextOutline from 'vue-material-design-icons/MessageTextOutline.vue'
104
+ import ChatOutline from 'vue-material-design-icons/ChatOutline.vue'
105
+ import EmailOutline from 'vue-material-design-icons/EmailOutline.vue'
106
+ import CalendarOutline from 'vue-material-design-icons/CalendarOutline.vue'
107
+
108
+ import { buildHeaders } from '../../utils/index.js'
109
+
110
+ // Module-level capabilities cache (shared across all instances, fetched once per session)
111
+ let _capabilitiesCache = null
112
+ let _capabilitiesPromise = null
113
+
114
+ /**
115
+ * CnUserActionMenu — Popover with user communication actions.
116
+ *
117
+ * Shows contextual actions based on installed Nextcloud apps (Talk, Mail, Calendar).
118
+ * Uses @nextcloud/capabilities when available, falls back to OCS API.
119
+ *
120
+ * @example Usage in notes/tasks cards
121
+ * <CnUserActionMenu
122
+ * :user-id="note.actorId || note.author"
123
+ * :display-name="note.actorDisplayName || note.author || 'Unknown'" />
124
+ */
125
+ export default {
126
+ name: 'CnUserActionMenu',
127
+
128
+ components: {
129
+ NcPopover,
130
+ NcActionButton,
131
+ NcAvatar,
132
+ MessageTextOutline,
133
+ ChatOutline,
134
+ EmailOutline,
135
+ CalendarOutline,
136
+ },
137
+
138
+ props: {
139
+ /** The Nextcloud user ID */
140
+ userId: {
141
+ type: String,
142
+ required: true,
143
+ },
144
+ /** The user's display name */
145
+ displayName: {
146
+ type: String,
147
+ default: () => t('nextcloud-vue', 'Unknown'),
148
+ },
149
+ /** Whether the menu is interactive (false for current user or system accounts) */
150
+ interactive: {
151
+ type: Boolean,
152
+ default: true,
153
+ },
154
+
155
+ // --- Pre-translated labels ---
156
+ sendMessageLabel: { type: String, default: () => t('nextcloud-vue', 'Send message') },
157
+ startChatLabel: { type: String, default: () => t('nextcloud-vue', 'Start chat') },
158
+ sendEmailLabel: { type: String, default: () => t('nextcloud-vue', 'Send email') },
159
+ planMeetingLabel: { type: String, default: () => t('nextcloud-vue', 'Schedule meeting') },
160
+ noActionsLabel: { type: String, default: () => t('nextcloud-vue', 'No communication apps available') },
161
+ },
162
+
163
+ emits: ['action'],
164
+
165
+ data() {
166
+ return {
167
+ isOpen: false,
168
+ hasTalk: false,
169
+ hasMail: false,
170
+ hasCalendar: false,
171
+ userEmail: '',
172
+ emailResolved: false,
173
+ triggerElements: [],
174
+ }
175
+ },
176
+
177
+ computed: {
178
+ showEmailAction() {
179
+ return !!this.userEmail
180
+ },
181
+ },
182
+
183
+ mounted() {
184
+ this.triggerElements = [this.$refs.trigger]
185
+ this.detectCapabilities()
186
+ },
187
+
188
+ methods: {
189
+ openMenu() {
190
+ if (!this.interactive) return
191
+ this.isOpen = true
192
+ // Resolve email on first open if not yet done
193
+ if (!this.emailResolved) {
194
+ this.resolveUserEmail()
195
+ }
196
+ },
197
+
198
+ closeMenu() {
199
+ this.isOpen = false
200
+ },
201
+
202
+ onClose() {
203
+ this.isOpen = false
204
+ // Return focus to trigger
205
+ if (this.$refs.trigger) {
206
+ this.$refs.trigger.focus()
207
+ }
208
+ },
209
+
210
+ async detectCapabilities() {
211
+ if (_capabilitiesCache) {
212
+ this.applyCapabilities(_capabilitiesCache)
213
+ return
214
+ }
215
+
216
+ // Try @nextcloud/capabilities first (synchronous, from initial state)
217
+ try {
218
+ // eslint-disable-next-line n/no-missing-import
219
+ const { getCapabilities } = await import('@nextcloud/capabilities')
220
+ const caps = getCapabilities()
221
+ if (caps) {
222
+ _capabilitiesCache = caps
223
+ this.applyCapabilities(caps)
224
+ return
225
+ }
226
+ } catch {
227
+ // Package not available, fall back to API
228
+ }
229
+
230
+ // Fallback: fetch from OCS API (once per session)
231
+ if (!_capabilitiesPromise) {
232
+ _capabilitiesPromise = this.fetchCapabilities()
233
+ }
234
+ const caps = await _capabilitiesPromise
235
+ if (caps) {
236
+ _capabilitiesCache = caps
237
+ this.applyCapabilities(caps)
238
+ }
239
+ },
240
+
241
+ async fetchCapabilities() {
242
+ try {
243
+ const response = await fetch('/ocs/v2.php/cloud/capabilities?format=json', {
244
+ headers: buildHeaders(),
245
+ })
246
+ if (response.ok) {
247
+ const data = await response.json()
248
+ return data?.ocs?.data?.capabilities || {}
249
+ }
250
+ } catch (err) {
251
+ console.error('CnUserActionMenu: Failed to fetch capabilities', err)
252
+ }
253
+ return {}
254
+ },
255
+
256
+ applyCapabilities(caps) {
257
+ this.hasTalk = !!caps?.spreed
258
+ this.hasCalendar = !!caps?.dav
259
+ this.hasMail = !!caps?.mail
260
+ },
261
+
262
+ async resolveUserEmail() {
263
+ this.emailResolved = true
264
+ try {
265
+ const response = await fetch(
266
+ `/ocs/v2.php/cloud/users/${encodeURIComponent(this.userId)}?format=json`,
267
+ {
268
+ headers: {
269
+ ...buildHeaders(),
270
+ 'OCS-APIREQUEST': 'true',
271
+ },
272
+ },
273
+ )
274
+ if (response.ok) {
275
+ const data = await response.json()
276
+ this.userEmail = data?.ocs?.data?.email || ''
277
+ }
278
+ } catch (err) {
279
+ console.error('CnUserActionMenu: Failed to resolve user email', err)
280
+ this.userEmail = ''
281
+ }
282
+ },
283
+
284
+ async sendMessage() {
285
+ try {
286
+ const response = await fetch('/ocs/v2.php/apps/spreed/api/v4/room', {
287
+ method: 'POST',
288
+ headers: {
289
+ ...buildHeaders(),
290
+ 'OCS-APIREQUEST': 'true',
291
+ 'Content-Type': 'application/json',
292
+ },
293
+ body: JSON.stringify({ roomType: 1, invite: this.userId }),
294
+ })
295
+ if (response.ok) {
296
+ const data = await response.json()
297
+ const token = data?.ocs?.data?.token
298
+ if (token) {
299
+ window.location.href = `/apps/spreed/#/call/${token}`
300
+ }
301
+ } else {
302
+ this.showActionError('Failed to create conversation')
303
+ }
304
+ } catch (err) {
305
+ console.error('CnUserActionMenu: Failed to send message', err)
306
+ this.showActionError('Failed to create conversation')
307
+ }
308
+ this.$emit('action', { type: 'message', userId: this.userId })
309
+ },
310
+
311
+ async startChat() {
312
+ try {
313
+ const response = await fetch('/ocs/v2.php/apps/spreed/api/v4/room', {
314
+ method: 'POST',
315
+ headers: {
316
+ ...buildHeaders(),
317
+ 'OCS-APIREQUEST': 'true',
318
+ 'Content-Type': 'application/json',
319
+ },
320
+ body: JSON.stringify({ roomType: 1, invite: this.userId }),
321
+ })
322
+ if (response.ok) {
323
+ const data = await response.json()
324
+ const token = data?.ocs?.data?.token
325
+ if (token) {
326
+ window.open(`/apps/spreed/#/call/${token}`, '_blank')
327
+ }
328
+ } else {
329
+ this.showActionError('Failed to create conversation')
330
+ }
331
+ } catch (err) {
332
+ console.error('CnUserActionMenu: Failed to start chat', err)
333
+ this.showActionError('Failed to create conversation')
334
+ }
335
+ this.$emit('action', { type: 'chat', userId: this.userId })
336
+ },
337
+
338
+ sendEmail() {
339
+ if (!this.userEmail) return
340
+ if (this.hasMail) {
341
+ window.location.href = `/apps/mail/compose?to=${encodeURIComponent(this.userEmail)}`
342
+ } else {
343
+ window.location.href = `mailto:${this.userEmail}`
344
+ }
345
+ this.closeMenu()
346
+ this.$emit('action', { type: 'email', userId: this.userId })
347
+ },
348
+
349
+ planMeeting() {
350
+ window.location.href = `/apps/calendar/new?attendees=${encodeURIComponent(this.userId)}&title=Meeting`
351
+ this.closeMenu()
352
+ this.$emit('action', { type: 'meeting', userId: this.userId })
353
+ },
354
+
355
+ showActionError(message) {
356
+ try {
357
+ // eslint-disable-next-line n/no-missing-import
358
+ import('@nextcloud/dialogs').then(({ showError }) => {
359
+ showError(message)
360
+ })
361
+ } catch {
362
+ console.error(message)
363
+ }
364
+ },
365
+ },
366
+ }
367
+ </script>
368
+
369
+ <style scoped>
370
+ .cn-user-action-menu {
371
+ display: inline;
372
+ }
373
+
374
+ .cn-user-action-menu__trigger--interactive {
375
+ cursor: pointer;
376
+ color: var(--color-primary-element);
377
+ font-weight: 600;
378
+ }
379
+
380
+ .cn-user-action-menu__trigger--interactive:hover {
381
+ text-decoration: underline;
382
+ }
383
+
384
+ .cn-user-action-menu__trigger--interactive:focus-visible {
385
+ outline: 2px solid var(--color-primary-element);
386
+ outline-offset: 2px;
387
+ border-radius: var(--border-radius);
388
+ }
389
+
390
+ .cn-user-action-menu__popover {
391
+ min-width: 220px;
392
+ padding: 8px 0;
393
+ }
394
+
395
+ .cn-user-action-menu__header {
396
+ display: flex;
397
+ align-items: center;
398
+ gap: 10px;
399
+ padding: 8px 12px 12px;
400
+ border-bottom: 1px solid var(--color-border);
401
+ margin-bottom: 4px;
402
+ }
403
+
404
+ .cn-user-action-menu__user-info {
405
+ display: flex;
406
+ flex-direction: column;
407
+ min-width: 0;
408
+ }
409
+
410
+ .cn-user-action-menu__display-name {
411
+ font-weight: 600;
412
+ font-size: 14px;
413
+ white-space: nowrap;
414
+ overflow: hidden;
415
+ text-overflow: ellipsis;
416
+ }
417
+
418
+ .cn-user-action-menu__email {
419
+ font-size: 12px;
420
+ color: var(--color-text-maxcontrast);
421
+ white-space: nowrap;
422
+ overflow: hidden;
423
+ text-overflow: ellipsis;
424
+ }
425
+
426
+ .cn-user-action-menu__actions {
427
+ padding: 4px 0;
428
+ }
429
+
430
+ .cn-user-action-menu__no-actions {
431
+ padding: 12px 16px;
432
+ text-align: center;
433
+ color: var(--color-text-maxcontrast);
434
+ font-size: 13px;
435
+ }
436
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnUserActionMenu } from './CnUserActionMenu.vue'