@conduction/nextcloud-vue 2.80.0 → 2.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js +3 -3
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js +80 -4
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js +95 -91
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js +140 -10
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js +52 -16
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +17 -3
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js +63 -52
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue.js +10 -0
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue.js.map +1 -0
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue2.js +252 -0
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue3.js +140 -0
- package/dist/esm/components/CnChipsFieldWidget/CnChipsFieldWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnChipsFieldWidget/index.js +26 -0
- package/dist/esm/components/CnChipsFieldWidget/index.js.map +1 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue.js +10 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue.js.map +1 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue2.js +354 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue3.js +172 -0
- package/dist/esm/components/CnChoicePickerWidget/CnChoicePickerWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnChoicePickerWidget/index.js +27 -0
- package/dist/esm/components/CnChoicePickerWidget/index.js.map +1 -0
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js +2 -2
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +65 -5
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +2 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +19 -11
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js +3 -2
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +72 -0
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +21 -4
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue2.js +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue2.js +7 -7
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +131 -0
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js +80 -5
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js +282 -69
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +302 -4
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +417 -244
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +101 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js +141 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js.map +1 -1
- package/dist/esm/components/CnFormPage/CnFormPage.vue2.js +60 -0
- package/dist/esm/components/CnFormPage/CnFormPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFormPage/CnFormPage.vue3.js +74 -49
- package/dist/esm/components/CnFormPage/CnFormPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +29 -2
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +48 -4
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +7 -7
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnNextStepCard/CnNextStepWidget.vue2.js +1 -1
- package/dist/esm/components/CnNextStepCard/CnNextStepWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +65 -2
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js +6 -2
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js +63 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js +8 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +14 -0
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +5 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue.js +10 -0
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue.js.map +1 -0
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue2.js +174 -0
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue3.js +75 -0
- package/dist/esm/components/CnRadioCardsWidget/CnRadioCardsWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnRadioCardsWidget/index.js +28 -0
- package/dist/esm/components/CnRadioCardsWidget/index.js.map +1 -0
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +30 -6
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +34 -25
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue.js +10 -0
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue.js.map +1 -0
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue2.js +222 -0
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue3.js +64 -0
- package/dist/esm/components/CnSavedViewsWidget/CnSavedViewsWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnSavedViewsWidget/index.js +30 -0
- package/dist/esm/components/CnSavedViewsWidget/index.js.map +1 -0
- package/dist/esm/components/CnSegmentedControl/CnSegmentedControl.vue2.js.map +1 -1
- package/dist/esm/components/CnSegmentedControl/CnSegmentedControl.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue.js +10 -0
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue.js.map +1 -0
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue2.js +347 -0
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue3.js +184 -0
- package/dist/esm/components/CnSettingsFormWidget/CnSettingsFormWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnSettingsFormWidget/index.js +27 -0
- package/dist/esm/components/CnSettingsFormWidget/index.js.map +1 -0
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +87 -6
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue2.js +84 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue3.js +85 -41
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue.js +10 -0
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue.js.map +1 -0
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue2.js +159 -0
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue3.js +60 -0
- package/dist/esm/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnSwitchRowsWidget/index.js +26 -0
- package/dist/esm/components/CnSwitchRowsWidget/index.js.map +1 -0
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js +47 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue3.js +16 -14
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue2.js +80 -1
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue3.js +75 -32
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue.js +10 -0
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue.js.map +1 -0
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue2.js +269 -0
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue3.js +106 -0
- package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnToggleTableWidget/index.js +27 -0
- package/dist/esm/components/CnToggleTableWidget/index.js.map +1 -0
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +7 -0
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js +7 -2
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue3.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/dashboardRegistration.js +5 -0
- package/dist/esm/components/CnWidgetObjectTable/dashboardRegistration.js.map +1 -1
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue2.js +197 -6
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue3.js +96 -50
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue3.js.map +1 -1
- package/dist/esm/composables/useListView.js +4 -4
- package/dist/esm/composables/useListView.js.map +1 -1
- package/dist/esm/index.js +17 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +9 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +55 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/nextcloud-vue.css +1041 -12
- package/dist/esm/utils/contentHeaderLink.js +51 -0
- package/dist/esm/utils/contentHeaderLink.js.map +1 -0
- package/dist/esm/utils/facets.js +75 -3
- package/dist/esm/utils/facets.js.map +1 -1
- package/dist/esm/utils/fetchFilterCounts.js +40 -5
- package/dist/esm/utils/fetchFilterCounts.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +7 -1
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/initials.js +32 -0
- package/dist/esm/utils/initials.js.map +1 -0
- package/dist/esm/utils/libraryWidgetKeys.js +7 -0
- package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
- package/dist/esm/utils/objectWrite.js +59 -0
- package/dist/esm/utils/objectWrite.js.map +1 -0
- package/dist/esm/utils/pageControls.js +81 -0
- package/dist/esm/utils/pageControls.js.map +1 -0
- package/dist/esm/utils/personalLenses.js +40 -3
- package/dist/esm/utils/personalLenses.js.map +1 -1
- package/dist/esm/utils/resolveFilterTokens.js +1 -1
- package/dist/esm/utils/resolveFilterTokens.js.map +1 -1
- package/dist/esm/utils/resolveManifestTokens.js +2 -0
- package/dist/esm/utils/resolveManifestTokens.js.map +1 -1
- package/dist/esm/utils/sentinelTokens.js +19 -1
- package/dist/esm/utils/sentinelTokens.js.map +1 -1
- package/dist/esm/utils/userGroupsPeek.js +91 -0
- package/dist/esm/utils/userGroupsPeek.js.map +1 -0
- package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
- package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
- package/dist/esm/utils/visibleWhen.js +57 -5
- package/dist/esm/utils/visibleWhen.js.map +1 -1
- package/dist/esm/utils/widgetDispatch.js +1 -1
- package/dist/esm/utils/widgetDispatch.js.map +1 -1
- package/dist/esm/utils/widgetVisibility.js +4 -57
- package/dist/esm/utils/widgetVisibility.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +13589 -7833
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1041 -12
- package/l10n/en.json +9 -1
- package/l10n/nl.json +55 -1
- package/package.json +2 -1
- package/scripts/check-docs-mdx.mjs +108 -0
- package/src/components/CnActionsBar/CnActionsBar.vue +6 -1
- package/src/components/CnAppRoot/CnAppRoot.md +4 -2
- package/src/components/CnAppRoot/CnAppRoot.vue +151 -59
- package/src/components/CnBannerWidget/CnBannerWidget.vue +205 -20
- package/src/components/CnCellRenderer/CnCellRenderer.md +2 -0
- package/src/components/CnCellRenderer/CnCellRenderer.vue +47 -4
- package/src/components/CnChipsFieldWidget/CnChipsFieldWidget.vue +433 -0
- package/src/components/CnChipsFieldWidget/index.js +25 -0
- package/src/components/CnChoicePickerWidget/CnChoicePickerWidget.vue +556 -0
- package/src/components/CnChoicePickerWidget/index.js +26 -0
- package/src/components/CnConversationThread/CnConversationWidget.vue +1 -1
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +2 -2
- package/src/components/CnDashboardPage/CnDashboardPage.vue +78 -5
- package/src/components/CnDataTable/CnDataTable.vue +21 -12
- package/src/components/CnDetailPage/CnDetailPage.vue +89 -3
- package/src/components/CnDocumentReviewList/CnDocumentReviewWidget.vue +1 -1
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +7 -7
- package/src/components/CnFactsWidget/CnFactsWidget.vue +142 -2
- package/src/components/CnFieldListWidget/CnFieldListWidget.vue +268 -6
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +588 -117
- package/src/components/CnFilesBrowser/filesBrowser.js +100 -0
- package/src/components/CnFilesBrowser/filesBrowserColumns.js +140 -0
- package/src/components/CnFormPage/CnFormPage.vue +81 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +56 -4
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +7 -7
- package/src/components/CnNextStepCard/CnNextStepWidget.vue +1 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +69 -2
- package/src/components/CnObjectSidebar/CnFilesTab.vue +70 -1
- package/src/components/CnObjectSidebar/CnNotesTab.vue +16 -0
- package/src/components/CnRadioCardsWidget/CnRadioCardsWidget.vue +313 -0
- package/src/components/CnRadioCardsWidget/index.js +27 -0
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +55 -6
- package/src/components/CnSavedViewsWidget/CnSavedViewsWidget.vue +296 -0
- package/src/components/CnSavedViewsWidget/index.js +29 -0
- package/src/components/CnSegmentedControl/CnSegmentedControl.vue +13 -0
- package/src/components/CnSettingsFormWidget/CnSettingsFormWidget.vue +555 -0
- package/src/components/CnSettingsFormWidget/index.js +26 -0
- package/src/components/CnStatWidget/CnStatWidget.vue +87 -6
- package/src/components/CnStatsBlockWidget/CnStatsBlockWidget.vue +180 -3
- package/src/components/CnSwitchRowsWidget/CnSwitchRowsWidget.vue +226 -0
- package/src/components/CnSwitchRowsWidget/index.js +25 -0
- package/src/components/CnTabsWidget/CnTabsWidget.vue +82 -3
- package/src/components/CnTasksWidget/CnTasksWidget.vue +175 -15
- package/src/components/CnToggleTableWidget/CnToggleTableWidget.vue +386 -0
- package/src/components/CnToggleTableWidget/index.js +26 -0
- package/src/components/CnWidgetGrid/registerDashboardWidgets.js +7 -0
- package/src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue +7 -2
- package/src/components/CnWidgetObjectTable/dashboardRegistration.js +5 -0
- package/src/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue +309 -11
- package/src/components/index.js +15 -0
- package/src/composables/useListView.js +4 -4
- package/src/css/look-board-detail.css +36 -2
- package/src/css/look-board-index.css +39 -8
- package/src/css/look-board.css +72 -0
- package/src/index.js +15 -0
- package/src/schemas/app-manifest-v2.schema.json +93 -9
- package/src/utils/contentHeaderLink.js +48 -0
- package/src/utils/facets.js +74 -2
- package/src/utils/fetchFilterCounts.js +39 -4
- package/src/utils/fillTemplate.js +7 -1
- package/src/utils/initials.js +29 -0
- package/src/utils/libraryWidgetKeys.js +7 -0
- package/src/utils/objectWrite.js +55 -0
- package/src/utils/pageControls.js +78 -0
- package/src/utils/personalLenses.js +39 -2
- package/src/utils/resolveFilterTokens.js +3 -1
- package/src/utils/resolveManifestTokens.js +2 -0
- package/src/utils/sentinelTokens.js +19 -1
- package/src/utils/userGroupsPeek.js +87 -0
- package/src/utils/validateManifestV2.compiled.js +3 -3
- package/src/utils/visibleWhen.js +56 -4
- package/src/utils/widgetDispatch.js +1 -1
- package/src/utils/widgetVisibility.js +7 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnNotesTab.vue2.js","sources":["../../../../src/components/CnObjectSidebar/CnNotesTab.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-sidebar-tab\">\n\t\t<!-- Add / Edit note -->\n\t\t<div class=\"cn-sidebar-tab__action\">\n\t\t\t<!-- Replying: the composer says to whom, and a reply to a reply goes to the top of its thread. -->\n\t\t\t<p\n\t\t\t\tv-if=\"replyTo\"\n\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t{{ replyingLabel }}\n\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</p>\n\t\t\t<CnNoteComposer\n\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t:register=\"register\"\n\t\t\t\t:schema=\"schema\"\n\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!-- Notes list -->\n\t\t<!-- Standalone spinner: give it an accessible name so screen readers\n\t\t announce the loading state (WCAG 1.1.1 / 4.1.2 — a bare\n\t\t NcLoadingIcon renders an unlabelled role=\"img\"). -->\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"loadingLabel\" />\n\t\t<div v-else-if=\"notes.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noNotesLabel }}\n\t\t</div>\n\t\t<!-- <ul>, not <div>: NcListItem renders an <li>, which WCAG 1.3.1\n\t\t requires to be contained in a <ul>/<ol> (axe \"listitem\"). -->\n\t\t<ul v-else class=\"cn-sidebar-tab__list\">\n\t\t\t<!-- One <li> per thread; inside it the note first, then its replies (oldest first), as a nested list named after the note. -->\n\t\t\t<li v-for=\"thread in threads\" :key=\"thread.note.id\" class=\"cn-notes-tab__thread\">\n\t\t\t\t<ul class=\"cn-notes-tab__thread-list\" :aria-label=\"threadLabel(thread.note)\">\n\t\t\t\t\t<NcListItem\n\t\t\t\t\t\tv-for=\"row in threadRows(thread)\"\n\t\t\t\t\t\t:key=\"row.note.id\"\n\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__reply': row.isReply }\"\n\t\t\t\t\t\t:name=\"row.note.actorDisplayName || row.note.author || 'Unknown'\"\n\t\t\t\t\t\t:bold=\"false\"\n\t\t\t\t\t\t:forceDisplayActions=\"true\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<CommentTextOutline :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #subname>\n\t\t\t\t\t\t\t<span class=\"cn-sidebar-tab__message\">\n\t\t\t\t\t\t\t\t<span v-if=\"row.quote\" class=\"cn-notes-tab__quote\" data-testid=\"cn-note-quote\">{{ row.quote }}</span>\n\t\t\t\t\t\t\t\t<CnNoteBody :message=\"row.note.message || row.note.content || ''\" :record=\"record\" :names=\"mentionNames\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #details>\n\t\t\t\t\t\t\t{{ formatDate(row.note.creationDateTime || row.note.created) }}\n\t\t\t\t\t\t\t<!-- An edited note says so where its time is, because that\n\t\t\t\t\t\t\t is where a reader already looks to date what they are\n\t\t\t\t\t\t\t reading. The line names the editor, so nobody has to\n\t\t\t\t\t\t\t open the history to learn who changed it. -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__edited\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-edited\">{{ editedLine(row.note) }}</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-if=\"canReply || canDelete(row.note) || wasEdited(row.note) || noteActions.length > 0\" #actions>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"canReply\"\n\t\t\t\t\t\t\t\t:aria-label=\"replyAria(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-reply-action\"\n\t\t\t\t\t\t\t\t@click=\"startReply(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Reply :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ replyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"startEdit(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Pencil :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ editLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-history-action\"\n\t\t\t\t\t\t\t\t@click=\"openHistory(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<HistoryIcon :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ historyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"deleteNote(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Delete :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ deleteLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<!-- The consuming app's own per-note actions, after the\n\t\t\t\t\t\t\t library's. They render inside this NcActions and emit\n\t\t\t\t\t\t\t `note-action`; nothing about what they DO lives here. -->\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-for=\"action in noteActions\"\n\t\t\t\t\t\t\t\t:key=\"`${row.note.id}-${action.id}`\"\n\t\t\t\t\t\t\t\t:data-testid=\"`cn-note-action-${action.id}`\"\n\t\t\t\t\t\t\t\t@click=\"$emit('note-action', { action: action.id, note: row.note })\">\n\t\t\t\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ action.label }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcListItem>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<CnNoteHistoryDialog\n\t\t\tv-if=\"historyNoteId\"\n\t\t\t:open=\"true\"\n\t\t\t:noteId=\"historyNoteId\"\n\t\t\t:objectId=\"objectId\"\n\t\t\t:register=\"register\"\n\t\t\t:schema=\"schema\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@update:open=\"historyNoteId = null\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcButton, NcListItem, NcLoadingIcon } from '@nextcloud/vue'\nimport CommentTextOutline from 'vue-material-design-icons/CommentTextOutline.vue'\nimport Delete from 'vue-material-design-icons/Delete.vue'\nimport HistoryIcon from 'vue-material-design-icons/History.vue'\nimport Pencil from 'vue-material-design-icons/Pencil.vue'\nimport Reply from 'vue-material-design-icons/Reply.vue'\nimport Send from 'vue-material-design-icons/Send.vue'\nimport CnNoteHistoryDialog from '../../dialogs/CnNoteHistoryDialog.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tprops: {\n\t\t/** ID of the object this tab belongs to */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register slug */\n\t\tregister: { type: String, default: '' },\n\t\t/** JSON Schema definition for the object */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base URL for the OpenRegister API */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Label for the add note button */\n\t\taddNoteLabel: { type: String, default: () => t('nextcloud-vue', 'Add note') },\n\t\t/** Placeholder text for the note input field */\n\t\taddNotePlaceholder: { type: String, default: () => t('nextcloud-vue', 'Write a note…') },\n\t\t/** Label for the edit action */\n\t\teditLabel: { type: String, default: () => t('nextcloud-vue', 'Edit') },\n\t\t/** Label for the save action */\n\t\tsaveLabel: { type: String, default: () => t('nextcloud-vue', 'Save') },\n\t\t/** Label for the cancel button */\n\t\tcancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },\n\t\t/** Label for the delete action */\n\t\tdeleteLabel: { type: String, default: () => t('nextcloud-vue', 'Delete') },\n\t\t/** Text shown when there are no notes */\n\t\tnoNotesLabel: { type: String, default: () => t('nextcloud-vue', 'No notes yet') },\n\t\t/** Text shown while the notes are being fetched */\n\t\tloadingLabel: { type: String, default: () => t('nextcloud-vue', 'Loading notes…') },\n\t\t/** Label for the Reply action (shown only when the backend supports replies) */\n\t\treplyLabel: { type: String, default: () => t('nextcloud-vue', 'Reply') },\n\t\t/** Label for the action that opens a note's earlier versions */\n\t\thistoryLabel: { type: String, default: () => t('nextcloud-vue', 'Show earlier versions') },\n\t\t// WHY THIS PROP EXISTS, since a seam nobody asked for is the kind that\n\t\t// rots. An app-specific act on ONE note had nowhere to live: this\n\t\t// component rendered edit, history and delete and offered no fourth\n\t\t// place. Dossiq sends a single case note to a neighbouring ZGW\n\t\t// register, and its endpoint, guard, route and tests were all in place\n\t\t// while no page could call any of them. Its own change wrote that down\n\t\t// as a blocker rather than declaring a prop nothing read.\n\t\t//\n\t\t// `label` stays the app's to write and translate, so nc-vue phrases\n\t\t// nothing for somebody else's domain and adds no catalogue string here.\n\t\t/**\n\t\t * Per-note actions the consuming app owns, `[{ id, label, icon? }]`.\n\t\t * Each entry renders one NcActionButton in every note's action menu,\n\t\t * after the library's own, and clicking it emits `note-action`. Empty\n\t\t * by default, and an empty list changes nothing. `icon` is optional\n\t\t * and takes an icon component.\n\t\t */\n\t\tnoteActions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t\tvalidator: (actions) => actions.every((action) => action\n\t\t\t\t&& typeof action.id === 'string' && action.id !== ''\n\t\t\t\t&& typeof action.label === 'string' && action.label !== ''),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted after a note containing at least one `@mention` was\n\t\t * successfully created or edited, with payload\n\t\t * `{ objectId, register, schema, noteId, mentionedUserIds }`, plus\n\t\t * `mentionedGroupIds` when the note mentions a group (`@\"group/<gid>\"`).\n\t\t * The event also fires for a note that mentions only groups. Expanding a\n\t\t * group to its members is the listener's job.\n\t\t * nc-vue never dispatches server-side notifications itself —\n\t\t * consuming apps listen to this event and notify from their own\n\t\t * backend.\n\t\t */\n\t\t'mention',\n\t\t/**\n\t\t * Emitted when one of the consuming app's `noteActions` is clicked,\n\t\t * with payload `{ action, note }`: the entry's `id` and the whole note\n\t\t * as the backend answered it. The library does the rendering and\n\t\t * nothing else, so what the action means stays in the app.\n\t\t */\n\t\t'note-action',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tnotes: [],\n\t\t\tloading: false,\n\t\t\tnewNoteText: '',\n\t\t\tsaving: false,\n\t\t\teditingNoteId: null,\n\t\t\t/** The note whose earlier versions are open, or null. */\n\t\t\thistoryNoteId: null,\n\t\t\t/**\n\t\t\t * Per-instance cache of mentioned-user display names, keyed by\n\t\t\t * user id. `null` marks an id that could not be resolved (unknown\n\t\t\t * or deleted user) so it is only looked up once.\n\t\t\t */\n\t\t\tmentionNames: {},\n\t\t\t/** The note a reply is being written to, or null. */\n\t\t\treplyTo: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{apiBase: string, register: string, schema: string, objectId: string}} Where this record's files live, for pasted images. */\n\t\trecord() {\n\t\t\treturn { apiBase: this.apiBase, register: this.register, schema: this.schema, objectId: this.objectId }\n\t\t},\n\n\t\t/** @return {boolean} Whether the backend supports replies: its notes carry a `parentId` key. */\n\t\tcanReply() {\n\t\t\treturn supportsReplies(this.notes)\n\t\t},\n\n\t\t/** @return {Array<{note: object, replies: object[]}>} The notes as threads, in the order they came. */\n\t\tthreads() {\n\t\t\treturn threadNotes(this.notes)\n\t\t},\n\n\t\t/** @return {string} The line above the composer while replying. */\n\t\treplyingLabel() {\n\t\t\treturn this.replyTo ? t('nextcloud-vue', 'Replying to {author}', { author: this.authorOf(this.replyTo) }) : ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.fetchNotes()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync fetchNotes() {\n\t\t\tif (!this.register || !this.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tthis.notes = data.results || data || []\n\t\t\t\t\tthis.resolveMentionNames()\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to fetch notes', err)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Resolve display names for every mentioned id across the current\n\t\t * notes list. Each id is looked up at most once per component\n\t\t * instance; unresolvable ids are cached as `null`.\n\t\t */\n\t\tasync resolveMentionNames() {\n\t\t\tconst ids = new Set()\n\t\t\tfor (const note of this.notes) {\n\t\t\t\tfor (const id of extractMentionedIds(note.message || note.content || '')) {\n\t\t\t\t\tids.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait Promise.all([...ids]\n\t\t\t\t.filter((id) => !(id in this.mentionNames))\n\t\t\t\t.map(async (id) => {\n\t\t\t\t\t// Mark as pending (null) first so concurrent calls skip it.\n\t\t\t\t\tthis.mentionNames[id] = null\n\t\t\t\t\tconst results = await searchNextcloudUsers(id)\n\t\t\t\t\tconst match = results.find((user) => user.id === id)\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tthis.mentionNames[id] = match.label\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Emit the `mention` notification hook for a successfully saved note.\n\t\t *\n\t\t * @param {string} savedText The note text that was persisted.\n\t\t * @param {string|null} noteId The created/edited note's id.\n\t\t */\n\t\temitMentionEvent(savedText, noteId) {\n\t\t\tconst mentionedUserIds = extractMentionedIds(savedText)\n\t\t\tconst mentionedGroupIds = extractMentionedGroupIds(savedText)\n\t\t\tif (mentionedUserIds.length === 0 && mentionedGroupIds.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('mention', {\n\t\t\t\tobjectId: this.objectId,\n\t\t\t\tregister: this.register,\n\t\t\t\tschema: this.schema,\n\t\t\t\tnoteId,\n\t\t\t\tmentionedUserIds,\n\t\t\t\t// Only when a group is mentioned: a note that names none keeps the payload it always had.\n\t\t\t\t...(mentionedGroupIds.length > 0 ? { mentionedGroupIds } : {}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Save from the composer (Ctrl/Cmd+Enter): the same as the button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsubmitComposer() {\n\t\t\tif (!this.newNoteText.trim() || this.saving) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.editingNoteId) {\n\t\t\t\tthis.saveEdit()\n\t\t\t} else {\n\t\t\t\tthis.addNote()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A note.\n\t\t * @return {string} Its author's name.\n\t\t */\n\t\tauthorOf(note) {\n\t\t\treturn note.actorDisplayName || note.author || 'Unknown'\n\t\t},\n\n\t\t/**\n\t\t * Write a reply to a note. A reply to a reply goes to the top of its thread.\n\t\t *\n\t\t * @param {object} note The note answered.\n\t\t * @return {void}\n\t\t */\n\t\tstartReply(note) {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.replyTo = note\n\t\t},\n\n\t\tcancelReply() {\n\t\t\tthis.replyTo = null\n\t\t},\n\n\t\t/**\n\t\t * The rows of one thread: the note, then its replies. A reply whose parent\n\t\t * is far up the list carries a one-line quote of it.\n\t\t *\n\t\t * @param {{note: object, replies: object[]}} thread The thread.\n\t\t * @return {Array<{note: object, isReply: boolean, quote: string}>} The rows.\n\t\t */\n\t\tthreadRows(thread) {\n\t\t\tconst flat = this.threads.flatMap((t2) => [t2.note, ...t2.replies])\n\t\t\treturn [\n\t\t\t\t{ note: thread.note, isReply: false, quote: '' },\n\t\t\t\t...thread.replies.map((reply) => ({ note: reply, isReply: true, quote: quoteFor(reply, flat) })),\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A top-level note.\n\t\t * @return {string} The name of its thread for assistive technology.\n\t\t */\n\t\tthreadLabel(note) {\n\t\t\treturn t('nextcloud-vue', 'Note by {author} and its replies', { author: this.authorOf(note) })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note The note a Reply button answers.\n\t\t * @return {string} The button's accessible name, naming the author.\n\t\t */\n\t\treplyAria(note) {\n\t\t\treturn t('nextcloud-vue', 'Reply to {author}', { author: this.authorOf(note) })\n\t\t},\n\n\t\tasync addNote() {\n\t\t\tif (!this.newNoteText.trim()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify(this.replyTo\n\t\t\t\t\t\t\t? { message: savedText, parentId: threadRootId(this.replyTo, this.notes) }\n\t\t\t\t\t\t\t: { message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tlet noteId = null\n\t\t\t\ttry {\n\t\t\t\t\tconst created = await response.json()\n\t\t\t\t\tnoteId = (created && (created.id || (created.results && created.results.id))) || null\n\t\t\t\t} catch {\n\t\t\t\t\t// Body not JSON — the event still fires with noteId null.\n\t\t\t\t}\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tthis.replyTo = null\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to add note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tstartEdit(note) {\n\t\t\tthis.replyTo = null\n\t\t\tthis.editingNoteId = note.id\n\t\t\tthis.newNoteText = note.message || note.content || ''\n\t\t},\n\n\t\tcancelEdit() {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.newNoteText = ''\n\t\t},\n\n\t\tasync saveEdit() {\n\t\t\tif (!this.newNoteText.trim() || !this.editingNoteId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\tconst noteId = this.editingNoteId\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${noteId}`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify({ message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.editingNoteId = null\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to update note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tcanDelete(note) {\n\t\t\treturn note.actorId === OC?.currentUser || note.author === OC?.currentUser\n\t\t},\n\n\t\t/**\n\t\t * Whether this note carries a history to show.\n\t\t *\n\t\t * Read off `versionCount` rather than off `editedAt`: a note edited by\n\t\t * a since-deleted account still has its prior texts, and a marker that\n\t\t * depended on the editor still existing would quietly vanish.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {boolean} True when at least one earlier version exists.\n\t\t */\n\t\twasEdited(note) {\n\t\t\treturn Number(note.versionCount || 0) > 0\n\t\t},\n\n\t\t/**\n\t\t * The \"edited\" line beside a note's time.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {string} The rendered line.\n\t\t */\n\t\teditedLine(note) {\n\t\t\tconst editor = note.editedByDisplayName || note.editedBy\n\t\t\tif (!editor) {\n\t\t\t\treturn t('nextcloud-vue', 'Edited')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Edited by {editor}', { editor })\n\t\t},\n\n\t\t/**\n\t\t * Open the earlier versions of one note.\n\t\t *\n\t\t * @param {object} note The note to open.\n\t\t */\n\t\topenHistory(note) {\n\t\t\tthis.historyNoteId = note.id\n\t\t},\n\n\t\tasync deleteNote(note) {\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${note.id}`),\n\t\t\t\t\t{ method: 'DELETE', headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tthis.notes = this.notes.filter((n) => n.id !== note.id)\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to delete note', err)\n\t\t\t}\n\t\t},\n\n\t\tformatDate(dateStr) {\n\t\t\tif (!dateStr) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new Date(dateStr).toLocaleString(undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\treturn dateStr\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab { padding: 12px; }\n\n.cn-sidebar-tab__action { margin-bottom: 16px; }\n\n.cn-sidebar-tab__action--row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }\n\n.cn-sidebar-tab__composer {\n\twidth: 100%;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__thread { list-style: none; }\n\n.cn-notes-tab__thread-list { margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__reply { margin-inline-start: 24px; }\n\n.cn-notes-tab__quote {\n\tdisplay: block;\n\tmargin-bottom: 2px;\n\tpadding-inline-start: 8px;\n\tborder-inline-start: 2px solid var(--color-border-dark);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-sidebar-tab__replying {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin: 0 0 4px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-notes-tab__edited {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin-inline-start: 6px;\n\tfont-style: italic;\n}\n\n</style>\n"],"names":["CnNoteBody","CnNoteComposer","CnNoteHistoryDialog","HistoryIcon","t"],"mappings":";;;;;;;;;;;;;;;;AA0KA,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;;AAElB,CAAA,UAAU,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,cAAEA,UAAU,kBAAEC,YAAc,uBAAEC,YAAmB,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAEC,OAAW,EAAE,OAAO;;AAElL,CAAA,KAAK,EAAE;AACN;AACA,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;AAE1C,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACvC;AACA,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACrC;EACA,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAuB,EAAG;;AAE5D,EAAA,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAMC,SAAC,CAAC,eAAe,EAAE,UAAU,GAAG;AAC7E;AACA,EAAA,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAMA,SAAC,CAAC,eAAe,EAAE,eAAe,GAAG;;EAExF,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAMA,SAAC,CAAC,eAAe,EAAE,MAAM,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AAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACtG,KAAA,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,IAAI;AAC9C,MAAA;IACA,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAG,KAAI,IAAI,CAAC,EAAE,EAAA;IACrD,CAAA,OAAO,GAAG,EAAE;AACb;IACA,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,GAAG,EAAA;AACvD,IAAA;GACA;;AAED,EAAA,UAAU,CAAC,OAAO,EAAE;GACnB,IAAI,CAAC,OAAO,EAAE;AACb,IAAA,OAAO,EAAC;AACT,IAAA;AACA,GAAA,IAAI;IACH,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;AAClD,KAAA,IAAI,EAAE,SAAS;KACf,KAAK,EAAE,OAAO;KACd,GAAG,EAAE,SAAS;AACd,KAAA,IAAI,EAAE,SAAS;AACf,KAAA,MAAM,EAAE,SAAS;KACjB,CAAA;AACF,IAAA,CAAE,MAAM;IACP,OAAO,OAAM;AACd,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnNotesTab.vue2.js","sources":["../../../../src/components/CnObjectSidebar/CnNotesTab.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-sidebar-tab\">\n\t\t<!-- Add / Edit note -->\n\t\t<div class=\"cn-sidebar-tab__action\">\n\t\t\t<!-- Replying: the composer says to whom, and a reply to a reply goes to the top of its thread. -->\n\t\t\t<p\n\t\t\t\tv-if=\"replyTo\"\n\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t{{ replyingLabel }}\n\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</p>\n\t\t\t<!-- @slot composer-before An app's own control above the composer, e.g. a template picker. Scope: `{ setText, text }`; `setText(text)` fills the composer, `text` is what it holds now. -->\n\t\t\t<slot name=\"composer-before\" :setText=\"setComposerText\" :text=\"newNoteText\" />\n\t\t\t<CnNoteComposer\n\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t:register=\"register\"\n\t\t\t\t:schema=\"schema\"\n\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!-- Notes list -->\n\t\t<!-- Standalone spinner: give it an accessible name so screen readers\n\t\t announce the loading state (WCAG 1.1.1 / 4.1.2 — a bare\n\t\t NcLoadingIcon renders an unlabelled role=\"img\"). -->\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"loadingLabel\" />\n\t\t<div v-else-if=\"notes.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noNotesLabel }}\n\t\t</div>\n\t\t<!-- <ul>, not <div>: NcListItem renders an <li>, which WCAG 1.3.1\n\t\t requires to be contained in a <ul>/<ol> (axe \"listitem\"). -->\n\t\t<ul v-else class=\"cn-sidebar-tab__list\">\n\t\t\t<!-- One <li> per thread; inside it the note first, then its replies (oldest first), as a nested list named after the note. -->\n\t\t\t<li v-for=\"thread in threads\" :key=\"thread.note.id\" class=\"cn-notes-tab__thread\">\n\t\t\t\t<ul class=\"cn-notes-tab__thread-list\" :aria-label=\"threadLabel(thread.note)\">\n\t\t\t\t\t<NcListItem\n\t\t\t\t\t\tv-for=\"row in threadRows(thread)\"\n\t\t\t\t\t\t:key=\"row.note.id\"\n\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__reply': row.isReply }\"\n\t\t\t\t\t\t:name=\"row.note.actorDisplayName || row.note.author || 'Unknown'\"\n\t\t\t\t\t\t:bold=\"false\"\n\t\t\t\t\t\t:forceDisplayActions=\"true\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<CommentTextOutline :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #subname>\n\t\t\t\t\t\t\t<span class=\"cn-sidebar-tab__message\">\n\t\t\t\t\t\t\t\t<span v-if=\"row.quote\" class=\"cn-notes-tab__quote\" data-testid=\"cn-note-quote\">{{ row.quote }}</span>\n\t\t\t\t\t\t\t\t<CnNoteBody :message=\"row.note.message || row.note.content || ''\" :record=\"record\" :names=\"mentionNames\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #details>\n\t\t\t\t\t\t\t{{ formatDate(row.note.creationDateTime || row.note.created) }}\n\t\t\t\t\t\t\t<!-- An edited note says so where its time is, because that\n\t\t\t\t\t\t\t is where a reader already looks to date what they are\n\t\t\t\t\t\t\t reading. The line names the editor, so nobody has to\n\t\t\t\t\t\t\t open the history to learn who changed it. -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__edited\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-edited\">{{ editedLine(row.note) }}</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-if=\"canReply || canDelete(row.note) || wasEdited(row.note) || noteActions.length > 0\" #actions>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"canReply\"\n\t\t\t\t\t\t\t\t:aria-label=\"replyAria(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-reply-action\"\n\t\t\t\t\t\t\t\t@click=\"startReply(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Reply :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ replyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"startEdit(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Pencil :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ editLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-history-action\"\n\t\t\t\t\t\t\t\t@click=\"openHistory(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<HistoryIcon :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ historyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"deleteNote(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Delete :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ deleteLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<!-- The consuming app's own per-note actions, after the\n\t\t\t\t\t\t\t library's. They render inside this NcActions and emit\n\t\t\t\t\t\t\t `note-action`; nothing about what they DO lives here. -->\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-for=\"action in noteActions\"\n\t\t\t\t\t\t\t\t:key=\"`${row.note.id}-${action.id}`\"\n\t\t\t\t\t\t\t\t:data-testid=\"`cn-note-action-${action.id}`\"\n\t\t\t\t\t\t\t\t@click=\"$emit('note-action', { action: action.id, note: row.note })\">\n\t\t\t\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ action.label }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcListItem>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<CnNoteHistoryDialog\n\t\t\tv-if=\"historyNoteId\"\n\t\t\t:open=\"true\"\n\t\t\t:noteId=\"historyNoteId\"\n\t\t\t:objectId=\"objectId\"\n\t\t\t:register=\"register\"\n\t\t\t:schema=\"schema\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@update:open=\"historyNoteId = null\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcButton, NcListItem, NcLoadingIcon } from '@nextcloud/vue'\nimport CommentTextOutline from 'vue-material-design-icons/CommentTextOutline.vue'\nimport Delete from 'vue-material-design-icons/Delete.vue'\nimport HistoryIcon from 'vue-material-design-icons/History.vue'\nimport Pencil from 'vue-material-design-icons/Pencil.vue'\nimport Reply from 'vue-material-design-icons/Reply.vue'\nimport Send from 'vue-material-design-icons/Send.vue'\nimport CnNoteHistoryDialog from '../../dialogs/CnNoteHistoryDialog.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tprops: {\n\t\t/** ID of the object this tab belongs to */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register slug */\n\t\tregister: { type: String, default: '' },\n\t\t/** JSON Schema definition for the object */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base URL for the OpenRegister API */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Label for the add note button */\n\t\taddNoteLabel: { type: String, default: () => t('nextcloud-vue', 'Add note') },\n\t\t/** Placeholder text for the note input field */\n\t\taddNotePlaceholder: { type: String, default: () => t('nextcloud-vue', 'Write a note…') },\n\t\t/** Label for the edit action */\n\t\teditLabel: { type: String, default: () => t('nextcloud-vue', 'Edit') },\n\t\t/** Label for the save action */\n\t\tsaveLabel: { type: String, default: () => t('nextcloud-vue', 'Save') },\n\t\t/** Label for the cancel button */\n\t\tcancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },\n\t\t/** Label for the delete action */\n\t\tdeleteLabel: { type: String, default: () => t('nextcloud-vue', 'Delete') },\n\t\t/** Text shown when there are no notes */\n\t\tnoNotesLabel: { type: String, default: () => t('nextcloud-vue', 'No notes yet') },\n\t\t/** Text shown while the notes are being fetched */\n\t\tloadingLabel: { type: String, default: () => t('nextcloud-vue', 'Loading notes…') },\n\t\t/** Label for the Reply action (shown only when the backend supports replies) */\n\t\treplyLabel: { type: String, default: () => t('nextcloud-vue', 'Reply') },\n\t\t/** Label for the action that opens a note's earlier versions */\n\t\thistoryLabel: { type: String, default: () => t('nextcloud-vue', 'Show earlier versions') },\n\t\t// WHY THIS PROP EXISTS, since a seam nobody asked for is the kind that\n\t\t// rots. An app-specific act on ONE note had nowhere to live: this\n\t\t// component rendered edit, history and delete and offered no fourth\n\t\t// place. Dossiq sends a single case note to a neighbouring ZGW\n\t\t// register, and its endpoint, guard, route and tests were all in place\n\t\t// while no page could call any of them. Its own change wrote that down\n\t\t// as a blocker rather than declaring a prop nothing read.\n\t\t//\n\t\t// `label` stays the app's to write and translate, so nc-vue phrases\n\t\t// nothing for somebody else's domain and adds no catalogue string here.\n\t\t/**\n\t\t * Per-note actions the consuming app owns, `[{ id, label, icon? }]`.\n\t\t * Each entry renders one NcActionButton in every note's action menu,\n\t\t * after the library's own, and clicking it emits `note-action`. Empty\n\t\t * by default, and an empty list changes nothing. `icon` is optional\n\t\t * and takes an icon component.\n\t\t */\n\t\tnoteActions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t\tvalidator: (actions) => actions.every((action) => action\n\t\t\t\t&& typeof action.id === 'string' && action.id !== ''\n\t\t\t\t&& typeof action.label === 'string' && action.label !== ''),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted after a note containing at least one `@mention` was\n\t\t * successfully created or edited, with payload\n\t\t * `{ objectId, register, schema, noteId, mentionedUserIds }`, plus\n\t\t * `mentionedGroupIds` when the note mentions a group (`@\"group/<gid>\"`).\n\t\t * The event also fires for a note that mentions only groups. Expanding a\n\t\t * group to its members is the listener's job.\n\t\t * nc-vue never dispatches server-side notifications itself —\n\t\t * consuming apps listen to this event and notify from their own\n\t\t * backend.\n\t\t */\n\t\t'mention',\n\t\t/**\n\t\t * Emitted when one of the consuming app's `noteActions` is clicked,\n\t\t * with payload `{ action, note }`: the entry's `id` and the whole note\n\t\t * as the backend answered it. The library does the rendering and\n\t\t * nothing else, so what the action means stays in the app.\n\t\t */\n\t\t'note-action',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tnotes: [],\n\t\t\tloading: false,\n\t\t\tnewNoteText: '',\n\t\t\tsaving: false,\n\t\t\teditingNoteId: null,\n\t\t\t/** The note whose earlier versions are open, or null. */\n\t\t\thistoryNoteId: null,\n\t\t\t/**\n\t\t\t * Per-instance cache of mentioned-user display names, keyed by\n\t\t\t * user id. `null` marks an id that could not be resolved (unknown\n\t\t\t * or deleted user) so it is only looked up once.\n\t\t\t */\n\t\t\tmentionNames: {},\n\t\t\t/** The note a reply is being written to, or null. */\n\t\t\treplyTo: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{apiBase: string, register: string, schema: string, objectId: string}} Where this record's files live, for pasted images. */\n\t\trecord() {\n\t\t\treturn { apiBase: this.apiBase, register: this.register, schema: this.schema, objectId: this.objectId }\n\t\t},\n\n\t\t/** @return {boolean} Whether the backend supports replies: its notes carry a `parentId` key. */\n\t\tcanReply() {\n\t\t\treturn supportsReplies(this.notes)\n\t\t},\n\n\t\t/** @return {Array<{note: object, replies: object[]}>} The notes as threads, in the order they came. */\n\t\tthreads() {\n\t\t\treturn threadNotes(this.notes)\n\t\t},\n\n\t\t/** @return {string} The line above the composer while replying. */\n\t\treplyingLabel() {\n\t\t\treturn this.replyTo ? t('nextcloud-vue', 'Replying to {author}', { author: this.authorOf(this.replyTo) }) : ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.fetchNotes()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync fetchNotes() {\n\t\t\tif (!this.register || !this.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tthis.notes = data.results || data || []\n\t\t\t\t\tthis.resolveMentionNames()\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to fetch notes', err)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Resolve display names for every mentioned id across the current\n\t\t * notes list. Each id is looked up at most once per component\n\t\t * instance; unresolvable ids are cached as `null`.\n\t\t */\n\t\tasync resolveMentionNames() {\n\t\t\tconst ids = new Set()\n\t\t\tfor (const note of this.notes) {\n\t\t\t\tfor (const id of extractMentionedIds(note.message || note.content || '')) {\n\t\t\t\t\tids.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait Promise.all([...ids]\n\t\t\t\t.filter((id) => !(id in this.mentionNames))\n\t\t\t\t.map(async (id) => {\n\t\t\t\t\t// Mark as pending (null) first so concurrent calls skip it.\n\t\t\t\t\tthis.mentionNames[id] = null\n\t\t\t\t\tconst results = await searchNextcloudUsers(id)\n\t\t\t\t\tconst match = results.find((user) => user.id === id)\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tthis.mentionNames[id] = match.label\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Emit the `mention` notification hook for a successfully saved note.\n\t\t *\n\t\t * @param {string} savedText The note text that was persisted.\n\t\t * @param {string|null} noteId The created/edited note's id.\n\t\t */\n\t\temitMentionEvent(savedText, noteId) {\n\t\t\tconst mentionedUserIds = extractMentionedIds(savedText)\n\t\t\tconst mentionedGroupIds = extractMentionedGroupIds(savedText)\n\t\t\tif (mentionedUserIds.length === 0 && mentionedGroupIds.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('mention', {\n\t\t\t\tobjectId: this.objectId,\n\t\t\t\tregister: this.register,\n\t\t\t\tschema: this.schema,\n\t\t\t\tnoteId,\n\t\t\t\tmentionedUserIds,\n\t\t\t\t// Only when a group is mentioned: a note that names none keeps the payload it always had.\n\t\t\t\t...(mentionedGroupIds.length > 0 ? { mentionedGroupIds } : {}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Save from the composer (Ctrl/Cmd+Enter): the same as the button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsubmitComposer() {\n\t\t\tif (!this.newNoteText.trim() || this.saving) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.editingNoteId) {\n\t\t\t\tthis.saveEdit()\n\t\t\t} else {\n\t\t\t\tthis.addNote()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A note.\n\t\t * @return {string} Its author's name.\n\t\t */\n\t\tauthorOf(note) {\n\t\t\treturn note.actorDisplayName || note.author || 'Unknown'\n\t\t},\n\n\t\t/**\n\t\t * Write a reply to a note. A reply to a reply goes to the top of its thread.\n\t\t *\n\t\t * @param {object} note The note answered.\n\t\t * @return {void}\n\t\t */\n\t\tstartReply(note) {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.replyTo = note\n\t\t},\n\n\t\tcancelReply() {\n\t\t\tthis.replyTo = null\n\t\t},\n\n\t\t/**\n\t\t * The rows of one thread: the note, then its replies. A reply whose parent\n\t\t * is far up the list carries a one-line quote of it.\n\t\t *\n\t\t * @param {{note: object, replies: object[]}} thread The thread.\n\t\t * @return {Array<{note: object, isReply: boolean, quote: string}>} The rows.\n\t\t */\n\t\tthreadRows(thread) {\n\t\t\tconst flat = this.threads.flatMap((t2) => [t2.note, ...t2.replies])\n\t\t\treturn [\n\t\t\t\t{ note: thread.note, isReply: false, quote: '' },\n\t\t\t\t...thread.replies.map((reply) => ({ note: reply, isReply: true, quote: quoteFor(reply, flat) })),\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A top-level note.\n\t\t * @return {string} The name of its thread for assistive technology.\n\t\t */\n\t\tthreadLabel(note) {\n\t\t\treturn t('nextcloud-vue', 'Note by {author} and its replies', { author: this.authorOf(note) })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note The note a Reply button answers.\n\t\t * @return {string} The button's accessible name, naming the author.\n\t\t */\n\t\treplyAria(note) {\n\t\t\treturn t('nextcloud-vue', 'Reply to {author}', { author: this.authorOf(note) })\n\t\t},\n\n\t\tasync addNote() {\n\t\t\tif (!this.newNoteText.trim()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify(this.replyTo\n\t\t\t\t\t\t\t? { message: savedText, parentId: threadRootId(this.replyTo, this.notes) }\n\t\t\t\t\t\t\t: { message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tlet noteId = null\n\t\t\t\ttry {\n\t\t\t\t\tconst created = await response.json()\n\t\t\t\t\tnoteId = (created && (created.id || (created.results && created.results.id))) || null\n\t\t\t\t} catch {\n\t\t\t\t\t// Body not JSON — the event still fires with noteId null.\n\t\t\t\t}\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tthis.replyTo = null\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to add note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Fill the composer from outside, for the `composer-before` slot.\n\t\t *\n\t\t * The app decides what goes in (a template body, a quoted line); the\n\t\t * composer stays the one place the text lives, so sending, editing and\n\t\t * the mention picker all see it exactly as if it had been typed.\n\t\t *\n\t\t * @param {string} text The text the composer should hold.\n\t\t * @return {void}\n\t\t */\n\t\tsetComposerText(text) {\n\t\t\tthis.newNoteText = (text === null || text === undefined) ? '' : String(text)\n\t\t},\n\n\t\tstartEdit(note) {\n\t\t\tthis.replyTo = null\n\t\t\tthis.editingNoteId = note.id\n\t\t\tthis.newNoteText = note.message || note.content || ''\n\t\t},\n\n\t\tcancelEdit() {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.newNoteText = ''\n\t\t},\n\n\t\tasync saveEdit() {\n\t\t\tif (!this.newNoteText.trim() || !this.editingNoteId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\tconst noteId = this.editingNoteId\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${noteId}`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify({ message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.editingNoteId = null\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to update note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tcanDelete(note) {\n\t\t\treturn note.actorId === OC?.currentUser || note.author === OC?.currentUser\n\t\t},\n\n\t\t/**\n\t\t * Whether this note carries a history to show.\n\t\t *\n\t\t * Read off `versionCount` rather than off `editedAt`: a note edited by\n\t\t * a since-deleted account still has its prior texts, and a marker that\n\t\t * depended on the editor still existing would quietly vanish.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {boolean} True when at least one earlier version exists.\n\t\t */\n\t\twasEdited(note) {\n\t\t\treturn Number(note.versionCount || 0) > 0\n\t\t},\n\n\t\t/**\n\t\t * The \"edited\" line beside a note's time.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {string} The rendered line.\n\t\t */\n\t\teditedLine(note) {\n\t\t\tconst editor = note.editedByDisplayName || note.editedBy\n\t\t\tif (!editor) {\n\t\t\t\treturn t('nextcloud-vue', 'Edited')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Edited by {editor}', { editor })\n\t\t},\n\n\t\t/**\n\t\t * Open the earlier versions of one note.\n\t\t *\n\t\t * @param {object} note The note to open.\n\t\t */\n\t\topenHistory(note) {\n\t\t\tthis.historyNoteId = note.id\n\t\t},\n\n\t\tasync deleteNote(note) {\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${note.id}`),\n\t\t\t\t\t{ method: 'DELETE', headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tthis.notes = this.notes.filter((n) => n.id !== note.id)\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to delete note', err)\n\t\t\t}\n\t\t},\n\n\t\tformatDate(dateStr) {\n\t\t\tif (!dateStr) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new Date(dateStr).toLocaleString(undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\treturn dateStr\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab { padding: 12px; }\n\n.cn-sidebar-tab__action { margin-bottom: 16px; }\n\n.cn-sidebar-tab__action--row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }\n\n.cn-sidebar-tab__composer {\n\twidth: 100%;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__thread { list-style: none; }\n\n.cn-notes-tab__thread-list { margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__reply { margin-inline-start: 24px; }\n\n.cn-notes-tab__quote {\n\tdisplay: block;\n\tmargin-bottom: 2px;\n\tpadding-inline-start: 8px;\n\tborder-inline-start: 2px solid var(--color-border-dark);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-sidebar-tab__replying {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin: 0 0 4px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-notes-tab__edited {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin-inline-start: 6px;\n\tfont-style: italic;\n}\n\n</style>\n"],"names":["CnNoteBody","CnNoteComposer","CnNoteHistoryDialog","HistoryIcon","t"],"mappings":";;;;;;;;;;;;;;;;AA4KA,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;;AAElB,CAAA,UAAU,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,cAAEA,UAAU,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AAC,KAAK,CAAC,CAAC,EAAG,KAAI,IAAI,CAAC,EAAE,EAAA;IACrD,CAAA,OAAO,GAAG,EAAE;AACb;IACA,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,GAAG,EAAA;AACvD,IAAA;GACA;;AAED,EAAA,UAAU,CAAC,OAAO,EAAE;GACnB,IAAI,CAAC,OAAO,EAAE;AACb,IAAA,OAAO,EAAC;AACT,IAAA;AACA,GAAA,IAAI;IACH,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;AAClD,KAAA,IAAI,EAAE,SAAS;KACf,KAAK,EAAE,OAAO;KACd,GAAG,EAAE,SAAS;AACd,KAAA,IAAI,EAAE,SAAS;AACf,KAAA,MAAM,EAAE,SAAS;KACjB,CAAA;AACF,IAAA,CAAE,MAAM;IACP,OAAO,OAAM;AACd,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveComponent, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createVNode, withCtx, createCommentVNode, createBlock, Fragment, renderList, normalizeClass, createSlots, resolveDynamicComponent } from 'vue';
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createVNode, withCtx, createCommentVNode, renderSlot, createBlock, Fragment, renderList, normalizeClass, createSlots, resolveDynamicComponent } from 'vue';
|
|
2
2
|
|
|
3
3
|
const _hoisted_1 = { class: "cn-sidebar-tab" };
|
|
4
4
|
const _hoisted_2 = { class: "cn-sidebar-tab__action" };
|
|
@@ -61,6 +61,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
61
61
|
}, 8 /* PROPS */, ["onClick"])
|
|
62
62
|
]))
|
|
63
63
|
: createCommentVNode("v-if", true),
|
|
64
|
+
renderSlot(_ctx.$slots, "composer-before", {
|
|
65
|
+
setText: $options.setComposerText,
|
|
66
|
+
text: $data.newNoteText
|
|
67
|
+
}),
|
|
64
68
|
createVNode(_component_CnNoteComposer, {
|
|
65
69
|
class: "cn-sidebar-tab__composer",
|
|
66
70
|
modelValue: $data.newNoteText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnNotesTab.vue3.js","sources":["../../../../src/components/CnObjectSidebar/CnNotesTab.vue?vue&type=template&id=6e7356a8&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-sidebar-tab\">\n\t\t<!-- Add / Edit note -->\n\t\t<div class=\"cn-sidebar-tab__action\">\n\t\t\t<!-- Replying: the composer says to whom, and a reply to a reply goes to the top of its thread. -->\n\t\t\t<p\n\t\t\t\tv-if=\"replyTo\"\n\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t{{ replyingLabel }}\n\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</p>\n\t\t\t<CnNoteComposer\n\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t:register=\"register\"\n\t\t\t\t:schema=\"schema\"\n\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!-- Notes list -->\n\t\t<!-- Standalone spinner: give it an accessible name so screen readers\n\t\t announce the loading state (WCAG 1.1.1 / 4.1.2 — a bare\n\t\t NcLoadingIcon renders an unlabelled role=\"img\"). -->\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"loadingLabel\" />\n\t\t<div v-else-if=\"notes.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noNotesLabel }}\n\t\t</div>\n\t\t<!-- <ul>, not <div>: NcListItem renders an <li>, which WCAG 1.3.1\n\t\t requires to be contained in a <ul>/<ol> (axe \"listitem\"). -->\n\t\t<ul v-else class=\"cn-sidebar-tab__list\">\n\t\t\t<!-- One <li> per thread; inside it the note first, then its replies (oldest first), as a nested list named after the note. -->\n\t\t\t<li v-for=\"thread in threads\" :key=\"thread.note.id\" class=\"cn-notes-tab__thread\">\n\t\t\t\t<ul class=\"cn-notes-tab__thread-list\" :aria-label=\"threadLabel(thread.note)\">\n\t\t\t\t\t<NcListItem\n\t\t\t\t\t\tv-for=\"row in threadRows(thread)\"\n\t\t\t\t\t\t:key=\"row.note.id\"\n\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__reply': row.isReply }\"\n\t\t\t\t\t\t:name=\"row.note.actorDisplayName || row.note.author || 'Unknown'\"\n\t\t\t\t\t\t:bold=\"false\"\n\t\t\t\t\t\t:forceDisplayActions=\"true\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<CommentTextOutline :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #subname>\n\t\t\t\t\t\t\t<span class=\"cn-sidebar-tab__message\">\n\t\t\t\t\t\t\t\t<span v-if=\"row.quote\" class=\"cn-notes-tab__quote\" data-testid=\"cn-note-quote\">{{ row.quote }}</span>\n\t\t\t\t\t\t\t\t<CnNoteBody :message=\"row.note.message || row.note.content || ''\" :record=\"record\" :names=\"mentionNames\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #details>\n\t\t\t\t\t\t\t{{ formatDate(row.note.creationDateTime || row.note.created) }}\n\t\t\t\t\t\t\t<!-- An edited note says so where its time is, because that\n\t\t\t\t\t\t\t is where a reader already looks to date what they are\n\t\t\t\t\t\t\t reading. The line names the editor, so nobody has to\n\t\t\t\t\t\t\t open the history to learn who changed it. -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__edited\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-edited\">{{ editedLine(row.note) }}</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-if=\"canReply || canDelete(row.note) || wasEdited(row.note) || noteActions.length > 0\" #actions>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"canReply\"\n\t\t\t\t\t\t\t\t:aria-label=\"replyAria(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-reply-action\"\n\t\t\t\t\t\t\t\t@click=\"startReply(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Reply :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ replyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"startEdit(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Pencil :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ editLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-history-action\"\n\t\t\t\t\t\t\t\t@click=\"openHistory(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<HistoryIcon :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ historyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"deleteNote(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Delete :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ deleteLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<!-- The consuming app's own per-note actions, after the\n\t\t\t\t\t\t\t library's. They render inside this NcActions and emit\n\t\t\t\t\t\t\t `note-action`; nothing about what they DO lives here. -->\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-for=\"action in noteActions\"\n\t\t\t\t\t\t\t\t:key=\"`${row.note.id}-${action.id}`\"\n\t\t\t\t\t\t\t\t:data-testid=\"`cn-note-action-${action.id}`\"\n\t\t\t\t\t\t\t\t@click=\"$emit('note-action', { action: action.id, note: row.note })\">\n\t\t\t\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ action.label }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcListItem>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<CnNoteHistoryDialog\n\t\t\tv-if=\"historyNoteId\"\n\t\t\t:open=\"true\"\n\t\t\t:noteId=\"historyNoteId\"\n\t\t\t:objectId=\"objectId\"\n\t\t\t:register=\"register\"\n\t\t\t:schema=\"schema\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@update:open=\"historyNoteId = null\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcButton, NcListItem, NcLoadingIcon } from '@nextcloud/vue'\nimport CommentTextOutline from 'vue-material-design-icons/CommentTextOutline.vue'\nimport Delete from 'vue-material-design-icons/Delete.vue'\nimport HistoryIcon from 'vue-material-design-icons/History.vue'\nimport Pencil from 'vue-material-design-icons/Pencil.vue'\nimport Reply from 'vue-material-design-icons/Reply.vue'\nimport Send from 'vue-material-design-icons/Send.vue'\nimport CnNoteHistoryDialog from '../../dialogs/CnNoteHistoryDialog.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tprops: {\n\t\t/** ID of the object this tab belongs to */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register slug */\n\t\tregister: { type: String, default: '' },\n\t\t/** JSON Schema definition for the object */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base URL for the OpenRegister API */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Label for the add note button */\n\t\taddNoteLabel: { type: String, default: () => t('nextcloud-vue', 'Add note') },\n\t\t/** Placeholder text for the note input field */\n\t\taddNotePlaceholder: { type: String, default: () => t('nextcloud-vue', 'Write a note…') },\n\t\t/** Label for the edit action */\n\t\teditLabel: { type: String, default: () => t('nextcloud-vue', 'Edit') },\n\t\t/** Label for the save action */\n\t\tsaveLabel: { type: String, default: () => t('nextcloud-vue', 'Save') },\n\t\t/** Label for the cancel button */\n\t\tcancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },\n\t\t/** Label for the delete action */\n\t\tdeleteLabel: { type: String, default: () => t('nextcloud-vue', 'Delete') },\n\t\t/** Text shown when there are no notes */\n\t\tnoNotesLabel: { type: String, default: () => t('nextcloud-vue', 'No notes yet') },\n\t\t/** Text shown while the notes are being fetched */\n\t\tloadingLabel: { type: String, default: () => t('nextcloud-vue', 'Loading notes…') },\n\t\t/** Label for the Reply action (shown only when the backend supports replies) */\n\t\treplyLabel: { type: String, default: () => t('nextcloud-vue', 'Reply') },\n\t\t/** Label for the action that opens a note's earlier versions */\n\t\thistoryLabel: { type: String, default: () => t('nextcloud-vue', 'Show earlier versions') },\n\t\t// WHY THIS PROP EXISTS, since a seam nobody asked for is the kind that\n\t\t// rots. An app-specific act on ONE note had nowhere to live: this\n\t\t// component rendered edit, history and delete and offered no fourth\n\t\t// place. Dossiq sends a single case note to a neighbouring ZGW\n\t\t// register, and its endpoint, guard, route and tests were all in place\n\t\t// while no page could call any of them. Its own change wrote that down\n\t\t// as a blocker rather than declaring a prop nothing read.\n\t\t//\n\t\t// `label` stays the app's to write and translate, so nc-vue phrases\n\t\t// nothing for somebody else's domain and adds no catalogue string here.\n\t\t/**\n\t\t * Per-note actions the consuming app owns, `[{ id, label, icon? }]`.\n\t\t * Each entry renders one NcActionButton in every note's action menu,\n\t\t * after the library's own, and clicking it emits `note-action`. Empty\n\t\t * by default, and an empty list changes nothing. `icon` is optional\n\t\t * and takes an icon component.\n\t\t */\n\t\tnoteActions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t\tvalidator: (actions) => actions.every((action) => action\n\t\t\t\t&& typeof action.id === 'string' && action.id !== ''\n\t\t\t\t&& typeof action.label === 'string' && action.label !== ''),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted after a note containing at least one `@mention` was\n\t\t * successfully created or edited, with payload\n\t\t * `{ objectId, register, schema, noteId, mentionedUserIds }`, plus\n\t\t * `mentionedGroupIds` when the note mentions a group (`@\"group/<gid>\"`).\n\t\t * The event also fires for a note that mentions only groups. Expanding a\n\t\t * group to its members is the listener's job.\n\t\t * nc-vue never dispatches server-side notifications itself —\n\t\t * consuming apps listen to this event and notify from their own\n\t\t * backend.\n\t\t */\n\t\t'mention',\n\t\t/**\n\t\t * Emitted when one of the consuming app's `noteActions` is clicked,\n\t\t * with payload `{ action, note }`: the entry's `id` and the whole note\n\t\t * as the backend answered it. The library does the rendering and\n\t\t * nothing else, so what the action means stays in the app.\n\t\t */\n\t\t'note-action',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tnotes: [],\n\t\t\tloading: false,\n\t\t\tnewNoteText: '',\n\t\t\tsaving: false,\n\t\t\teditingNoteId: null,\n\t\t\t/** The note whose earlier versions are open, or null. */\n\t\t\thistoryNoteId: null,\n\t\t\t/**\n\t\t\t * Per-instance cache of mentioned-user display names, keyed by\n\t\t\t * user id. `null` marks an id that could not be resolved (unknown\n\t\t\t * or deleted user) so it is only looked up once.\n\t\t\t */\n\t\t\tmentionNames: {},\n\t\t\t/** The note a reply is being written to, or null. */\n\t\t\treplyTo: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{apiBase: string, register: string, schema: string, objectId: string}} Where this record's files live, for pasted images. */\n\t\trecord() {\n\t\t\treturn { apiBase: this.apiBase, register: this.register, schema: this.schema, objectId: this.objectId }\n\t\t},\n\n\t\t/** @return {boolean} Whether the backend supports replies: its notes carry a `parentId` key. */\n\t\tcanReply() {\n\t\t\treturn supportsReplies(this.notes)\n\t\t},\n\n\t\t/** @return {Array<{note: object, replies: object[]}>} The notes as threads, in the order they came. */\n\t\tthreads() {\n\t\t\treturn threadNotes(this.notes)\n\t\t},\n\n\t\t/** @return {string} The line above the composer while replying. */\n\t\treplyingLabel() {\n\t\t\treturn this.replyTo ? t('nextcloud-vue', 'Replying to {author}', { author: this.authorOf(this.replyTo) }) : ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.fetchNotes()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync fetchNotes() {\n\t\t\tif (!this.register || !this.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tthis.notes = data.results || data || []\n\t\t\t\t\tthis.resolveMentionNames()\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to fetch notes', err)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Resolve display names for every mentioned id across the current\n\t\t * notes list. Each id is looked up at most once per component\n\t\t * instance; unresolvable ids are cached as `null`.\n\t\t */\n\t\tasync resolveMentionNames() {\n\t\t\tconst ids = new Set()\n\t\t\tfor (const note of this.notes) {\n\t\t\t\tfor (const id of extractMentionedIds(note.message || note.content || '')) {\n\t\t\t\t\tids.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait Promise.all([...ids]\n\t\t\t\t.filter((id) => !(id in this.mentionNames))\n\t\t\t\t.map(async (id) => {\n\t\t\t\t\t// Mark as pending (null) first so concurrent calls skip it.\n\t\t\t\t\tthis.mentionNames[id] = null\n\t\t\t\t\tconst results = await searchNextcloudUsers(id)\n\t\t\t\t\tconst match = results.find((user) => user.id === id)\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tthis.mentionNames[id] = match.label\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Emit the `mention` notification hook for a successfully saved note.\n\t\t *\n\t\t * @param {string} savedText The note text that was persisted.\n\t\t * @param {string|null} noteId The created/edited note's id.\n\t\t */\n\t\temitMentionEvent(savedText, noteId) {\n\t\t\tconst mentionedUserIds = extractMentionedIds(savedText)\n\t\t\tconst mentionedGroupIds = extractMentionedGroupIds(savedText)\n\t\t\tif (mentionedUserIds.length === 0 && mentionedGroupIds.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('mention', {\n\t\t\t\tobjectId: this.objectId,\n\t\t\t\tregister: this.register,\n\t\t\t\tschema: this.schema,\n\t\t\t\tnoteId,\n\t\t\t\tmentionedUserIds,\n\t\t\t\t// Only when a group is mentioned: a note that names none keeps the payload it always had.\n\t\t\t\t...(mentionedGroupIds.length > 0 ? { mentionedGroupIds } : {}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Save from the composer (Ctrl/Cmd+Enter): the same as the button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsubmitComposer() {\n\t\t\tif (!this.newNoteText.trim() || this.saving) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.editingNoteId) {\n\t\t\t\tthis.saveEdit()\n\t\t\t} else {\n\t\t\t\tthis.addNote()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A note.\n\t\t * @return {string} Its author's name.\n\t\t */\n\t\tauthorOf(note) {\n\t\t\treturn note.actorDisplayName || note.author || 'Unknown'\n\t\t},\n\n\t\t/**\n\t\t * Write a reply to a note. A reply to a reply goes to the top of its thread.\n\t\t *\n\t\t * @param {object} note The note answered.\n\t\t * @return {void}\n\t\t */\n\t\tstartReply(note) {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.replyTo = note\n\t\t},\n\n\t\tcancelReply() {\n\t\t\tthis.replyTo = null\n\t\t},\n\n\t\t/**\n\t\t * The rows of one thread: the note, then its replies. A reply whose parent\n\t\t * is far up the list carries a one-line quote of it.\n\t\t *\n\t\t * @param {{note: object, replies: object[]}} thread The thread.\n\t\t * @return {Array<{note: object, isReply: boolean, quote: string}>} The rows.\n\t\t */\n\t\tthreadRows(thread) {\n\t\t\tconst flat = this.threads.flatMap((t2) => [t2.note, ...t2.replies])\n\t\t\treturn [\n\t\t\t\t{ note: thread.note, isReply: false, quote: '' },\n\t\t\t\t...thread.replies.map((reply) => ({ note: reply, isReply: true, quote: quoteFor(reply, flat) })),\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A top-level note.\n\t\t * @return {string} The name of its thread for assistive technology.\n\t\t */\n\t\tthreadLabel(note) {\n\t\t\treturn t('nextcloud-vue', 'Note by {author} and its replies', { author: this.authorOf(note) })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note The note a Reply button answers.\n\t\t * @return {string} The button's accessible name, naming the author.\n\t\t */\n\t\treplyAria(note) {\n\t\t\treturn t('nextcloud-vue', 'Reply to {author}', { author: this.authorOf(note) })\n\t\t},\n\n\t\tasync addNote() {\n\t\t\tif (!this.newNoteText.trim()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify(this.replyTo\n\t\t\t\t\t\t\t? { message: savedText, parentId: threadRootId(this.replyTo, this.notes) }\n\t\t\t\t\t\t\t: { message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tlet noteId = null\n\t\t\t\ttry {\n\t\t\t\t\tconst created = await response.json()\n\t\t\t\t\tnoteId = (created && (created.id || (created.results && created.results.id))) || null\n\t\t\t\t} catch {\n\t\t\t\t\t// Body not JSON — the event still fires with noteId null.\n\t\t\t\t}\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tthis.replyTo = null\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to add note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tstartEdit(note) {\n\t\t\tthis.replyTo = null\n\t\t\tthis.editingNoteId = note.id\n\t\t\tthis.newNoteText = note.message || note.content || ''\n\t\t},\n\n\t\tcancelEdit() {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.newNoteText = ''\n\t\t},\n\n\t\tasync saveEdit() {\n\t\t\tif (!this.newNoteText.trim() || !this.editingNoteId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\tconst noteId = this.editingNoteId\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${noteId}`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify({ message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.editingNoteId = null\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to update note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tcanDelete(note) {\n\t\t\treturn note.actorId === OC?.currentUser || note.author === OC?.currentUser\n\t\t},\n\n\t\t/**\n\t\t * Whether this note carries a history to show.\n\t\t *\n\t\t * Read off `versionCount` rather than off `editedAt`: a note edited by\n\t\t * a since-deleted account still has its prior texts, and a marker that\n\t\t * depended on the editor still existing would quietly vanish.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {boolean} True when at least one earlier version exists.\n\t\t */\n\t\twasEdited(note) {\n\t\t\treturn Number(note.versionCount || 0) > 0\n\t\t},\n\n\t\t/**\n\t\t * The \"edited\" line beside a note's time.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {string} The rendered line.\n\t\t */\n\t\teditedLine(note) {\n\t\t\tconst editor = note.editedByDisplayName || note.editedBy\n\t\t\tif (!editor) {\n\t\t\t\treturn t('nextcloud-vue', 'Edited')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Edited by {editor}', { editor })\n\t\t},\n\n\t\t/**\n\t\t * Open the earlier versions of one note.\n\t\t *\n\t\t * @param {object} note The note to open.\n\t\t */\n\t\topenHistory(note) {\n\t\t\tthis.historyNoteId = note.id\n\t\t},\n\n\t\tasync deleteNote(note) {\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${note.id}`),\n\t\t\t\t\t{ method: 'DELETE', headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tthis.notes = this.notes.filter((n) => n.id !== note.id)\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to delete note', err)\n\t\t\t}\n\t\t},\n\n\t\tformatDate(dateStr) {\n\t\t\tif (!dateStr) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new Date(dateStr).toLocaleString(undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\treturn dateStr\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab { padding: 12px; }\n\n.cn-sidebar-tab__action { margin-bottom: 16px; }\n\n.cn-sidebar-tab__action--row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }\n\n.cn-sidebar-tab__composer {\n\twidth: 100%;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__thread { list-style: none; }\n\n.cn-notes-tab__thread-list { margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__reply { margin-inline-start: 24px; }\n\n.cn-notes-tab__quote {\n\tdisplay: block;\n\tmargin-bottom: 2px;\n\tpadding-inline-start: 8px;\n\tborder-inline-start: 2px solid var(--color-border-dark);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-sidebar-tab__replying {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin: 0 0 4px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-notes-tab__edited {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin-inline-start: 6px;\n\tfont-style: italic;\n}\n\n</style>\n"],"names":["_openBlock","_createElementBlock","_createTextVNode","_toDisplayString","_createVNode","_createElementVNode","_createBlock","_Fragment","_renderList","_normalizeClass","_resolveDynam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AA,EAAAC,UAAA,CARmB,MAAW,CAAA,WAAA,EAAA,CAArB,MAAM,KAAA;qDADbF,WASF,CAAA,yBAAA,EAAA;kCAPG,GAAG,EAAA,CAAA,EAAK,GAAC,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,EAAA,MAAA,CAAA,EAAA,CAAA,CAAA;kCACT,aAAW,EAAA,CAAA,eAAA,EAAK,MAAA,CAAA,EAAA,CAAA,CAAA;kCAChB,OAAK,EAAA,MAAA,KAAE,UAAK,CAAE,aAAA,EAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,EAAA,IAAA,EAAA,GAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;mDAGf,MACD;oDADC,GACD,GAAAH,eAAA,CAAA,MAAA,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;;;;AAHS,kCAAA,CAAA,MAAA,CAAA,IAAA;;8CAAA,MAAA;oDACP,MAAQ;AAAR,2CAAAH,SAAA,EAAA,EAAAM,WAAA,CAAQI,wBAAA,MAAA,CAAA,IAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;KAWR,KAAS,CAAA,aAAA;sBADfJ;;AAEC,UAAA,IAAI,EAAE,IAAI;AACV,UAAA,MAAM,EAAE,KAAa,CAAA,aAAA;AACrB,UAAA,QAAE,EAAA,MAAA,CAAA,QAAA;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnNotesTab.vue3.js","sources":["../../../../src/components/CnObjectSidebar/CnNotesTab.vue?vue&type=template&id=6e7356a8&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-sidebar-tab\">\n\t\t<!-- Add / Edit note -->\n\t\t<div class=\"cn-sidebar-tab__action\">\n\t\t\t<!-- Replying: the composer says to whom, and a reply to a reply goes to the top of its thread. -->\n\t\t\t<p\n\t\t\t\tv-if=\"replyTo\"\n\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t{{ replyingLabel }}\n\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</p>\n\t\t\t<!-- @slot composer-before An app's own control above the composer, e.g. a template picker. Scope: `{ setText, text }`; `setText(text)` fills the composer, `text` is what it holds now. -->\n\t\t\t<slot name=\"composer-before\" :setText=\"setComposerText\" :text=\"newNoteText\" />\n\t\t\t<CnNoteComposer\n\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t:register=\"register\"\n\t\t\t\t:schema=\"schema\"\n\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!-- Notes list -->\n\t\t<!-- Standalone spinner: give it an accessible name so screen readers\n\t\t announce the loading state (WCAG 1.1.1 / 4.1.2 — a bare\n\t\t NcLoadingIcon renders an unlabelled role=\"img\"). -->\n\t\t<NcLoadingIcon v-if=\"loading\" :name=\"loadingLabel\" />\n\t\t<div v-else-if=\"notes.length === 0\" class=\"cn-sidebar-tab__empty\">\n\t\t\t{{ noNotesLabel }}\n\t\t</div>\n\t\t<!-- <ul>, not <div>: NcListItem renders an <li>, which WCAG 1.3.1\n\t\t requires to be contained in a <ul>/<ol> (axe \"listitem\"). -->\n\t\t<ul v-else class=\"cn-sidebar-tab__list\">\n\t\t\t<!-- One <li> per thread; inside it the note first, then its replies (oldest first), as a nested list named after the note. -->\n\t\t\t<li v-for=\"thread in threads\" :key=\"thread.note.id\" class=\"cn-notes-tab__thread\">\n\t\t\t\t<ul class=\"cn-notes-tab__thread-list\" :aria-label=\"threadLabel(thread.note)\">\n\t\t\t\t\t<NcListItem\n\t\t\t\t\t\tv-for=\"row in threadRows(thread)\"\n\t\t\t\t\t\t:key=\"row.note.id\"\n\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__reply': row.isReply }\"\n\t\t\t\t\t\t:name=\"row.note.actorDisplayName || row.note.author || 'Unknown'\"\n\t\t\t\t\t\t:bold=\"false\"\n\t\t\t\t\t\t:forceDisplayActions=\"true\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<CommentTextOutline :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #subname>\n\t\t\t\t\t\t\t<span class=\"cn-sidebar-tab__message\">\n\t\t\t\t\t\t\t\t<span v-if=\"row.quote\" class=\"cn-notes-tab__quote\" data-testid=\"cn-note-quote\">{{ row.quote }}</span>\n\t\t\t\t\t\t\t\t<CnNoteBody :message=\"row.note.message || row.note.content || ''\" :record=\"record\" :names=\"mentionNames\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template #details>\n\t\t\t\t\t\t\t{{ formatDate(row.note.creationDateTime || row.note.created) }}\n\t\t\t\t\t\t\t<!-- An edited note says so where its time is, because that\n\t\t\t\t\t\t\t is where a reader already looks to date what they are\n\t\t\t\t\t\t\t reading. The line names the editor, so nobody has to\n\t\t\t\t\t\t\t open the history to learn who changed it. -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__edited\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-edited\">{{ editedLine(row.note) }}</span>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<template v-if=\"canReply || canDelete(row.note) || wasEdited(row.note) || noteActions.length > 0\" #actions>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"canReply\"\n\t\t\t\t\t\t\t\t:aria-label=\"replyAria(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-reply-action\"\n\t\t\t\t\t\t\t\t@click=\"startReply(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Reply :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ replyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"startEdit(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Pencil :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ editLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-if=\"wasEdited(row.note)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-note-history-action\"\n\t\t\t\t\t\t\t\t@click=\"openHistory(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<HistoryIcon :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ historyLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<NcActionButton v-if=\"canDelete(row.note)\" @click=\"deleteNote(row.note)\">\n\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t<Delete :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ deleteLabel }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t\t<!-- The consuming app's own per-note actions, after the\n\t\t\t\t\t\t\t library's. They render inside this NcActions and emit\n\t\t\t\t\t\t\t `note-action`; nothing about what they DO lives here. -->\n\t\t\t\t\t\t\t<NcActionButton\n\t\t\t\t\t\t\t\tv-for=\"action in noteActions\"\n\t\t\t\t\t\t\t\t:key=\"`${row.note.id}-${action.id}`\"\n\t\t\t\t\t\t\t\t:data-testid=\"`cn-note-action-${action.id}`\"\n\t\t\t\t\t\t\t\t@click=\"$emit('note-action', { action: action.id, note: row.note })\">\n\t\t\t\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ action.label }}\n\t\t\t\t\t\t\t</NcActionButton>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</NcListItem>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<CnNoteHistoryDialog\n\t\t\tv-if=\"historyNoteId\"\n\t\t\t:open=\"true\"\n\t\t\t:noteId=\"historyNoteId\"\n\t\t\t:objectId=\"objectId\"\n\t\t\t:register=\"register\"\n\t\t\t:schema=\"schema\"\n\t\t\t:apiBase=\"apiBase\"\n\t\t\t@update:open=\"historyNoteId = null\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcButton, NcListItem, NcLoadingIcon } from '@nextcloud/vue'\nimport CommentTextOutline from 'vue-material-design-icons/CommentTextOutline.vue'\nimport Delete from 'vue-material-design-icons/Delete.vue'\nimport HistoryIcon from 'vue-material-design-icons/History.vue'\nimport Pencil from 'vue-material-design-icons/Pencil.vue'\nimport Reply from 'vue-material-design-icons/Reply.vue'\nimport Send from 'vue-material-design-icons/Send.vue'\nimport CnNoteHistoryDialog from '../../dialogs/CnNoteHistoryDialog.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tprops: {\n\t\t/** ID of the object this tab belongs to */\n\t\tobjectId: { type: String, required: true },\n\t\t/** OpenRegister register slug */\n\t\tregister: { type: String, default: '' },\n\t\t/** JSON Schema definition for the object */\n\t\tschema: { type: String, default: '' },\n\t\t/** Base URL for the OpenRegister API */\n\t\tapiBase: { type: String, default: '/apps/openregister/api' },\n\t\t/** Label for the add note button */\n\t\taddNoteLabel: { type: String, default: () => t('nextcloud-vue', 'Add note') },\n\t\t/** Placeholder text for the note input field */\n\t\taddNotePlaceholder: { type: String, default: () => t('nextcloud-vue', 'Write a note…') },\n\t\t/** Label for the edit action */\n\t\teditLabel: { type: String, default: () => t('nextcloud-vue', 'Edit') },\n\t\t/** Label for the save action */\n\t\tsaveLabel: { type: String, default: () => t('nextcloud-vue', 'Save') },\n\t\t/** Label for the cancel button */\n\t\tcancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },\n\t\t/** Label for the delete action */\n\t\tdeleteLabel: { type: String, default: () => t('nextcloud-vue', 'Delete') },\n\t\t/** Text shown when there are no notes */\n\t\tnoNotesLabel: { type: String, default: () => t('nextcloud-vue', 'No notes yet') },\n\t\t/** Text shown while the notes are being fetched */\n\t\tloadingLabel: { type: String, default: () => t('nextcloud-vue', 'Loading notes…') },\n\t\t/** Label for the Reply action (shown only when the backend supports replies) */\n\t\treplyLabel: { type: String, default: () => t('nextcloud-vue', 'Reply') },\n\t\t/** Label for the action that opens a note's earlier versions */\n\t\thistoryLabel: { type: String, default: () => t('nextcloud-vue', 'Show earlier versions') },\n\t\t// WHY THIS PROP EXISTS, since a seam nobody asked for is the kind that\n\t\t// rots. An app-specific act on ONE note had nowhere to live: this\n\t\t// component rendered edit, history and delete and offered no fourth\n\t\t// place. Dossiq sends a single case note to a neighbouring ZGW\n\t\t// register, and its endpoint, guard, route and tests were all in place\n\t\t// while no page could call any of them. Its own change wrote that down\n\t\t// as a blocker rather than declaring a prop nothing read.\n\t\t//\n\t\t// `label` stays the app's to write and translate, so nc-vue phrases\n\t\t// nothing for somebody else's domain and adds no catalogue string here.\n\t\t/**\n\t\t * Per-note actions the consuming app owns, `[{ id, label, icon? }]`.\n\t\t * Each entry renders one NcActionButton in every note's action menu,\n\t\t * after the library's own, and clicking it emits `note-action`. Empty\n\t\t * by default, and an empty list changes nothing. `icon` is optional\n\t\t * and takes an icon component.\n\t\t */\n\t\tnoteActions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t\tvalidator: (actions) => actions.every((action) => action\n\t\t\t\t&& typeof action.id === 'string' && action.id !== ''\n\t\t\t\t&& typeof action.label === 'string' && action.label !== ''),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted after a note containing at least one `@mention` was\n\t\t * successfully created or edited, with payload\n\t\t * `{ objectId, register, schema, noteId, mentionedUserIds }`, plus\n\t\t * `mentionedGroupIds` when the note mentions a group (`@\"group/<gid>\"`).\n\t\t * The event also fires for a note that mentions only groups. Expanding a\n\t\t * group to its members is the listener's job.\n\t\t * nc-vue never dispatches server-side notifications itself —\n\t\t * consuming apps listen to this event and notify from their own\n\t\t * backend.\n\t\t */\n\t\t'mention',\n\t\t/**\n\t\t * Emitted when one of the consuming app's `noteActions` is clicked,\n\t\t * with payload `{ action, note }`: the entry's `id` and the whole note\n\t\t * as the backend answered it. The library does the rendering and\n\t\t * nothing else, so what the action means stays in the app.\n\t\t */\n\t\t'note-action',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tnotes: [],\n\t\t\tloading: false,\n\t\t\tnewNoteText: '',\n\t\t\tsaving: false,\n\t\t\teditingNoteId: null,\n\t\t\t/** The note whose earlier versions are open, or null. */\n\t\t\thistoryNoteId: null,\n\t\t\t/**\n\t\t\t * Per-instance cache of mentioned-user display names, keyed by\n\t\t\t * user id. `null` marks an id that could not be resolved (unknown\n\t\t\t * or deleted user) so it is only looked up once.\n\t\t\t */\n\t\t\tmentionNames: {},\n\t\t\t/** The note a reply is being written to, or null. */\n\t\t\treplyTo: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{apiBase: string, register: string, schema: string, objectId: string}} Where this record's files live, for pasted images. */\n\t\trecord() {\n\t\t\treturn { apiBase: this.apiBase, register: this.register, schema: this.schema, objectId: this.objectId }\n\t\t},\n\n\t\t/** @return {boolean} Whether the backend supports replies: its notes carry a `parentId` key. */\n\t\tcanReply() {\n\t\t\treturn supportsReplies(this.notes)\n\t\t},\n\n\t\t/** @return {Array<{note: object, replies: object[]}>} The notes as threads, in the order they came. */\n\t\tthreads() {\n\t\t\treturn threadNotes(this.notes)\n\t\t},\n\n\t\t/** @return {string} The line above the composer while replying. */\n\t\treplyingLabel() {\n\t\t\treturn this.replyTo ? t('nextcloud-vue', 'Replying to {author}', { author: this.authorOf(this.replyTo) }) : ''\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler(id) {\n\t\t\t\tif (id) {\n\t\t\t\t\tthis.fetchNotes()\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync fetchNotes() {\n\t\t\tif (!this.register || !this.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{ headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tconst data = await response.json()\n\t\t\t\t\tthis.notes = data.results || data || []\n\t\t\t\t\tthis.resolveMentionNames()\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to fetch notes', err)\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Resolve display names for every mentioned id across the current\n\t\t * notes list. Each id is looked up at most once per component\n\t\t * instance; unresolvable ids are cached as `null`.\n\t\t */\n\t\tasync resolveMentionNames() {\n\t\t\tconst ids = new Set()\n\t\t\tfor (const note of this.notes) {\n\t\t\t\tfor (const id of extractMentionedIds(note.message || note.content || '')) {\n\t\t\t\t\tids.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t\tawait Promise.all([...ids]\n\t\t\t\t.filter((id) => !(id in this.mentionNames))\n\t\t\t\t.map(async (id) => {\n\t\t\t\t\t// Mark as pending (null) first so concurrent calls skip it.\n\t\t\t\t\tthis.mentionNames[id] = null\n\t\t\t\t\tconst results = await searchNextcloudUsers(id)\n\t\t\t\t\tconst match = results.find((user) => user.id === id)\n\t\t\t\t\tif (match) {\n\t\t\t\t\t\tthis.mentionNames[id] = match.label\n\t\t\t\t\t}\n\t\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Emit the `mention` notification hook for a successfully saved note.\n\t\t *\n\t\t * @param {string} savedText The note text that was persisted.\n\t\t * @param {string|null} noteId The created/edited note's id.\n\t\t */\n\t\temitMentionEvent(savedText, noteId) {\n\t\t\tconst mentionedUserIds = extractMentionedIds(savedText)\n\t\t\tconst mentionedGroupIds = extractMentionedGroupIds(savedText)\n\t\t\tif (mentionedUserIds.length === 0 && mentionedGroupIds.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('mention', {\n\t\t\t\tobjectId: this.objectId,\n\t\t\t\tregister: this.register,\n\t\t\t\tschema: this.schema,\n\t\t\t\tnoteId,\n\t\t\t\tmentionedUserIds,\n\t\t\t\t// Only when a group is mentioned: a note that names none keeps the payload it always had.\n\t\t\t\t...(mentionedGroupIds.length > 0 ? { mentionedGroupIds } : {}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Save from the composer (Ctrl/Cmd+Enter): the same as the button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsubmitComposer() {\n\t\t\tif (!this.newNoteText.trim() || this.saving) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.editingNoteId) {\n\t\t\t\tthis.saveEdit()\n\t\t\t} else {\n\t\t\t\tthis.addNote()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A note.\n\t\t * @return {string} Its author's name.\n\t\t */\n\t\tauthorOf(note) {\n\t\t\treturn note.actorDisplayName || note.author || 'Unknown'\n\t\t},\n\n\t\t/**\n\t\t * Write a reply to a note. A reply to a reply goes to the top of its thread.\n\t\t *\n\t\t * @param {object} note The note answered.\n\t\t * @return {void}\n\t\t */\n\t\tstartReply(note) {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.replyTo = note\n\t\t},\n\n\t\tcancelReply() {\n\t\t\tthis.replyTo = null\n\t\t},\n\n\t\t/**\n\t\t * The rows of one thread: the note, then its replies. A reply whose parent\n\t\t * is far up the list carries a one-line quote of it.\n\t\t *\n\t\t * @param {{note: object, replies: object[]}} thread The thread.\n\t\t * @return {Array<{note: object, isReply: boolean, quote: string}>} The rows.\n\t\t */\n\t\tthreadRows(thread) {\n\t\t\tconst flat = this.threads.flatMap((t2) => [t2.note, ...t2.replies])\n\t\t\treturn [\n\t\t\t\t{ note: thread.note, isReply: false, quote: '' },\n\t\t\t\t...thread.replies.map((reply) => ({ note: reply, isReply: true, quote: quoteFor(reply, flat) })),\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note A top-level note.\n\t\t * @return {string} The name of its thread for assistive technology.\n\t\t */\n\t\tthreadLabel(note) {\n\t\t\treturn t('nextcloud-vue', 'Note by {author} and its replies', { author: this.authorOf(note) })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} note The note a Reply button answers.\n\t\t * @return {string} The button's accessible name, naming the author.\n\t\t */\n\t\treplyAria(note) {\n\t\t\treturn t('nextcloud-vue', 'Reply to {author}', { author: this.authorOf(note) })\n\t\t},\n\n\t\tasync addNote() {\n\t\t\tif (!this.newNoteText.trim()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\ttry {\n\t\t\t\tconst response = await fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify(this.replyTo\n\t\t\t\t\t\t\t? { message: savedText, parentId: threadRootId(this.replyTo, this.notes) }\n\t\t\t\t\t\t\t: { message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tlet noteId = null\n\t\t\t\ttry {\n\t\t\t\t\tconst created = await response.json()\n\t\t\t\t\tnoteId = (created && (created.id || (created.results && created.results.id))) || null\n\t\t\t\t} catch {\n\t\t\t\t\t// Body not JSON — the event still fires with noteId null.\n\t\t\t\t}\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tthis.replyTo = null\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to add note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Fill the composer from outside, for the `composer-before` slot.\n\t\t *\n\t\t * The app decides what goes in (a template body, a quoted line); the\n\t\t * composer stays the one place the text lives, so sending, editing and\n\t\t * the mention picker all see it exactly as if it had been typed.\n\t\t *\n\t\t * @param {string} text The text the composer should hold.\n\t\t * @return {void}\n\t\t */\n\t\tsetComposerText(text) {\n\t\t\tthis.newNoteText = (text === null || text === undefined) ? '' : String(text)\n\t\t},\n\n\t\tstartEdit(note) {\n\t\t\tthis.replyTo = null\n\t\t\tthis.editingNoteId = note.id\n\t\t\tthis.newNoteText = note.message || note.content || ''\n\t\t},\n\n\t\tcancelEdit() {\n\t\t\tthis.editingNoteId = null\n\t\t\tthis.newNoteText = ''\n\t\t},\n\n\t\tasync saveEdit() {\n\t\t\tif (!this.newNoteText.trim() || !this.editingNoteId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tconst savedText = this.newNoteText.trim()\n\t\t\tconst noteId = this.editingNoteId\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${noteId}`),\n\t\t\t\t\t{\n\t\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\t\theaders: buildHeaders(),\n\t\t\t\t\t\tbody: JSON.stringify({ message: savedText }),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tthis.emitMentionEvent(savedText, noteId)\n\t\t\t\tthis.editingNoteId = null\n\t\t\t\tthis.newNoteText = ''\n\t\t\t\tawait this.fetchNotes()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to update note', err)\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\tcanDelete(note) {\n\t\t\treturn note.actorId === OC?.currentUser || note.author === OC?.currentUser\n\t\t},\n\n\t\t/**\n\t\t * Whether this note carries a history to show.\n\t\t *\n\t\t * Read off `versionCount` rather than off `editedAt`: a note edited by\n\t\t * a since-deleted account still has its prior texts, and a marker that\n\t\t * depended on the editor still existing would quietly vanish.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {boolean} True when at least one earlier version exists.\n\t\t */\n\t\twasEdited(note) {\n\t\t\treturn Number(note.versionCount || 0) > 0\n\t\t},\n\n\t\t/**\n\t\t * The \"edited\" line beside a note's time.\n\t\t *\n\t\t * @param {object} note The note from the backend.\n\t\t * @return {string} The rendered line.\n\t\t */\n\t\teditedLine(note) {\n\t\t\tconst editor = note.editedByDisplayName || note.editedBy\n\t\t\tif (!editor) {\n\t\t\t\treturn t('nextcloud-vue', 'Edited')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Edited by {editor}', { editor })\n\t\t},\n\n\t\t/**\n\t\t * Open the earlier versions of one note.\n\t\t *\n\t\t * @param {object} note The note to open.\n\t\t */\n\t\topenHistory(note) {\n\t\t\tthis.historyNoteId = note.id\n\t\t},\n\n\t\tasync deleteNote(note) {\n\t\t\ttry {\n\t\t\t\tawait fetch(\n\t\t\t\t\tprefixUrl(`${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/notes/${note.id}`),\n\t\t\t\t\t{ method: 'DELETE', headers: buildHeaders() },\n\t\t\t\t)\n\t\t\t\tthis.notes = this.notes.filter((n) => n.id !== note.id)\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('CnNotesTab: Failed to delete note', err)\n\t\t\t}\n\t\t},\n\n\t\tformatDate(dateStr) {\n\t\t\tif (!dateStr) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new Date(dateStr).toLocaleString(undefined, {\n\t\t\t\t\tyear: 'numeric',\n\t\t\t\t\tmonth: 'short',\n\t\t\t\t\tday: 'numeric',\n\t\t\t\t\thour: '2-digit',\n\t\t\t\t\tminute: '2-digit',\n\t\t\t\t})\n\t\t\t} catch {\n\t\t\t\treturn dateStr\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-sidebar-tab { padding: 12px; }\n\n.cn-sidebar-tab__action { margin-bottom: 16px; }\n\n.cn-sidebar-tab__action--row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }\n\n.cn-sidebar-tab__composer {\n\twidth: 100%;\n}\n\n.cn-sidebar-tab__empty {\n\ttext-align: center;\n\tpadding: 24px 12px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-sidebar-tab__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__thread { list-style: none; }\n\n.cn-notes-tab__thread-list { margin: 0; padding: 0; list-style: none; }\n\n.cn-notes-tab__reply { margin-inline-start: 24px; }\n\n.cn-notes-tab__quote {\n\tdisplay: block;\n\tmargin-bottom: 2px;\n\tpadding-inline-start: 8px;\n\tborder-inline-start: 2px solid var(--color-border-dark);\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n}\n\n.cn-sidebar-tab__replying {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmargin: 0 0 4px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-notes-tab__edited {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin-inline-start: 6px;\n\tfont-style: italic;\n}\n\n</style>\n"],"names":["_openBlock","_createElementBlock","_createTextVNode","_toDisplayString","_createVNode","_renderSlot","_createElementVNode","_createBlock","_Fragment","_renderList","_normalizeClass","_resolveDynamicComponent"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAA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CAAA,GACX,mBAAG,MAAU,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;;;;gDAKbD,kBASF,CAAAO,QAAA,EAAA,IAAA,EAAAC,UAAA,CARmB,MAAW,CAAA,WAAA,EAAA,CAArB,MAAM,KAAA;qDADbF,WASF,CAAA,yBAAA,EAAA;kCAPG,GAAG,EAAA,CAAA,EAAK,GAAC,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,EAAA,MAAA,CAAA,EAAA,CAAA,CAAA;kCACT,aAAW,EAAA,CAAA,eAAA,EAAK,MAAA,CAAA,EAAA,CAAA,CAAA;kCAChB,OAAK,EAAA,MAAA,KAAE,UAAK,CAAE,aAAA,EAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAAA,EAAA,IAAA,EAAA,GAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;mDAGf,MACD;oDADC,GACD,GAAAJ,eAAA,CAAA,MAAA,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;;;;AAHS,kCAAA,CAAA,MAAA,CAAA,IAAA;;8CAAA,MAAA;oDACP,MAAQ;AAAR,2CAAAH,SAAA,EAAA,EAAAO,WAAA,CAAQI,wBAAA,MAAA,CAAA,IAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;KAWR,KAAS,CAAA,aAAA;sBADfJ;;AAEC,UAAA,IAAI,EAAE,IAAI;AACV,UAAA,MAAM,EAAE,KAAa,CAAA,aAAA;AACrB,UAAA,QAAE,EAAA,MAAA,CAAA,QAAA;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import script from './CnRadioCardsWidget.vue2.js';
|
|
2
|
+
import { render } from './CnRadioCardsWidget.vue3.js';
|
|
3
|
+
|
|
4
|
+
script.render = render;
|
|
5
|
+
script.__scopeId = "data-v-8aefa4a2";
|
|
6
|
+
script.__file = "src/components/CnRadioCardsWidget/CnRadioCardsWidget.vue";
|
|
7
|
+
const __sfc_main = script;
|
|
8
|
+
|
|
9
|
+
export { __sfc_main as default };
|
|
10
|
+
//# sourceMappingURL=CnRadioCardsWidget.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnRadioCardsWidget.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { NcNoteCard } from '@nextcloud/vue';
|
|
2
|
+
import { objectUrlOf, patchObject } from '../../utils/objectWrite.js';
|
|
3
|
+
import { readPath } from '../../utils/readPath.js';
|
|
4
|
+
import { serverErrorMessage } from '../../utils/serverErrorMessage.js';
|
|
5
|
+
|
|
6
|
+
let uid = 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* CnRadioCardsWidget — the `radio-cards` widget: one choice out of a few cards,
|
|
10
|
+
* each with a title and a description, bound to an enum field of the CURRENT
|
|
11
|
+
* object. Choosing a card saves at once with ONE PATCH of that field; a refused
|
|
12
|
+
* PATCH puts the choice back and shows the server's words. Real radio inputs
|
|
13
|
+
* underneath, so the choice is perceivable without colour and works from the
|
|
14
|
+
* keyboard.
|
|
15
|
+
*
|
|
16
|
+
* @spec openspec/changes/abstract-radio-cards/specs/radio-cards/spec.md
|
|
17
|
+
*/
|
|
18
|
+
var script = {
|
|
19
|
+
name: 'CnRadioCardsWidget',
|
|
20
|
+
|
|
21
|
+
components: { NcNoteCard },
|
|
22
|
+
|
|
23
|
+
inject: {
|
|
24
|
+
cnTranslate: { default: () => (key) => key },
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
/**
|
|
29
|
+
* The widget configuration.
|
|
30
|
+
*
|
|
31
|
+
* - `field` (required) — the top-level enum field.
|
|
32
|
+
* - `options` (required) — `[{ value, label, description? }]`.
|
|
33
|
+
* - `label` — a legend over the cards (visually shown).
|
|
34
|
+
* - `columns` — 1, 2 or 3 (default 2).
|
|
35
|
+
* - `readOnly`.
|
|
36
|
+
*
|
|
37
|
+
* @type {object}
|
|
38
|
+
*/
|
|
39
|
+
content: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({}),
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/** The current detail-page object. */
|
|
45
|
+
objectData: {
|
|
46
|
+
type: Object,
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/** The current object id. */
|
|
51
|
+
objectId: {
|
|
52
|
+
type: [String, Number],
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/** OpenRegister register slug of the surface. */
|
|
57
|
+
register: {
|
|
58
|
+
type: [String, Object],
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/** OpenRegister schema slug of the surface. */
|
|
63
|
+
schema: {
|
|
64
|
+
type: [String, Object],
|
|
65
|
+
default: '',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
emits: ['saved'],
|
|
70
|
+
|
|
71
|
+
data() {
|
|
72
|
+
uid += 1;
|
|
73
|
+
return {
|
|
74
|
+
groupName: `cn-radio-cards-${uid}`,
|
|
75
|
+
saved: '',
|
|
76
|
+
value: '',
|
|
77
|
+
busy: false,
|
|
78
|
+
notice: '',
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
computed: {
|
|
83
|
+
options() {
|
|
84
|
+
const list = Array.isArray(this.content.options) ? this.content.options : [];
|
|
85
|
+
return list
|
|
86
|
+
.filter((option) => option !== null && option !== undefined)
|
|
87
|
+
.map((option) => (typeof option === 'object'
|
|
88
|
+
? { value: option.value, label: this.tr(String(option.label ?? option.value)), description: this.tr(option.description || '') }
|
|
89
|
+
: { value: option, label: this.tr(String(option)), description: '' }))
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
label() {
|
|
93
|
+
return this.tr(this.content.label || '')
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
columns() {
|
|
97
|
+
return [1, 3].includes(this.content.columns) ? this.content.columns : 2
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
readOnly() {
|
|
101
|
+
return this.content.readOnly === true
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
objectUrl() {
|
|
105
|
+
return objectUrlOf(this.register, this.schema, this.objectId || (this.objectData && this.objectData.id))
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
watch: {
|
|
110
|
+
objectData() {
|
|
111
|
+
this.adopt();
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
created() {
|
|
116
|
+
this.adopt();
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
methods: {
|
|
120
|
+
tr(text) {
|
|
121
|
+
if (typeof text !== 'string' || text === '') {
|
|
122
|
+
return ''
|
|
123
|
+
}
|
|
124
|
+
return typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/** Read the choice off the object. */
|
|
128
|
+
adopt() {
|
|
129
|
+
const stored = readPath(this.objectData || {}, this.content.field);
|
|
130
|
+
this.saved = stored === undefined || stored === null ? '' : String(stored);
|
|
131
|
+
this.value = this.saved;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
isSelected(option) {
|
|
135
|
+
return this.value === String(option.value)
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Choose a card and save that one field.
|
|
140
|
+
*
|
|
141
|
+
* @param {object} option The chosen option.
|
|
142
|
+
* @return {Promise<void>}
|
|
143
|
+
* @spec openspec/changes/abstract-radio-cards/specs/radio-cards/spec.md#requirement-choosing-a-card-saves-that-one-field
|
|
144
|
+
*/
|
|
145
|
+
async choose(option) {
|
|
146
|
+
if (!this.objectUrl || !this.content.field) {
|
|
147
|
+
this.notice = this.tr('This choice cannot be saved here.');
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
this.notice = '';
|
|
151
|
+
this.busy = true;
|
|
152
|
+
this.value = String(option.value);
|
|
153
|
+
try {
|
|
154
|
+
const data = await patchObject(this.objectUrl, { [this.content.field]: option.value });
|
|
155
|
+
const written = readPath(data, this.content.field);
|
|
156
|
+
this.saved = String(written !== undefined && written !== null ? written : option.value);
|
|
157
|
+
this.value = this.saved;
|
|
158
|
+
/**
|
|
159
|
+
* @event saved The choice was written.
|
|
160
|
+
* @type {{field: string, value: unknown}}
|
|
161
|
+
*/
|
|
162
|
+
this.$emit('saved', { field: this.content.field, value: option.value });
|
|
163
|
+
} catch (e) {
|
|
164
|
+
this.value = this.saved;
|
|
165
|
+
this.notice = serverErrorMessage(e);
|
|
166
|
+
} finally {
|
|
167
|
+
this.busy = false;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export { script as default };
|
|
174
|
+
//# sourceMappingURL=CnRadioCardsWidget.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnRadioCardsWidget.vue2.js","sources":["../../../../src/components/CnRadioCardsWidget/CnRadioCardsWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<fieldset class=\"cn-radio-cards\" data-testid=\"cn-radio-cards\" :aria-busy=\"busy ? 'true' : 'false'\">\n\t\t<legend v-if=\"label\" class=\"cn-radio-cards__legend\">\n\t\t\t{{ label }}\n\t\t</legend>\n\t\t<div class=\"cn-radio-cards__grid\" :class=\"`cn-radio-cards__grid--${columns}`\">\n\t\t\t<label\n\t\t\t\tv-for=\"option in options\"\n\t\t\t\t:key=\"String(option.value)\"\n\t\t\t\tclass=\"cn-radio-cards__card\"\n\t\t\t\t:class=\"{ 'cn-radio-cards__card--selected': isSelected(option) }\"\n\t\t\t\t:data-testid=\"`cn-radio-cards-option-${option.value}`\">\n\t\t\t\t<input\n\t\t\t\t\tclass=\"cn-radio-cards__input\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t:name=\"groupName\"\n\t\t\t\t\t:value=\"String(option.value)\"\n\t\t\t\t\t:checked=\"isSelected(option)\"\n\t\t\t\t\t:disabled=\"readOnly || busy\"\n\t\t\t\t\t@change=\"choose(option)\">\n\t\t\t\t<span class=\"cn-radio-cards__dot\" aria-hidden=\"true\" />\n\t\t\t\t<span class=\"cn-radio-cards__text\">\n\t\t\t\t\t<span class=\"cn-radio-cards__title\">{{ option.label }}</span>\n\t\t\t\t\t<span v-if=\"option.description\" class=\"cn-radio-cards__description\">{{ option.description }}</span>\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t</div>\n\t\t<NcNoteCard v-if=\"notice\" type=\"error\" data-testid=\"cn-radio-cards-notice\">\n\t\t\t{{ notice }}\n\t\t</NcNoteCard>\n\t</fieldset>\n</template>\n\n<script>\nimport { NcNoteCard } from '@nextcloud/vue'\nimport { objectUrlOf, patchObject } from '../../utils/objectWrite.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { serverErrorMessage } from '../../utils/serverErrorMessage.js'\n\nlet uid = 0\n\n/**\n * CnRadioCardsWidget — the `radio-cards` widget: one choice out of a few cards,\n * each with a title and a description, bound to an enum field of the CURRENT\n * object. Choosing a card saves at once with ONE PATCH of that field; a refused\n * PATCH puts the choice back and shows the server's words. Real radio inputs\n * underneath, so the choice is perceivable without colour and works from the\n * keyboard.\n *\n * @spec openspec/changes/abstract-radio-cards/specs/radio-cards/spec.md\n */\nexport default {\n\tname: 'CnRadioCardsWidget',\n\n\tcomponents: { NcNoteCard },\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget configuration.\n\t\t *\n\t\t * - `field` (required) — the top-level enum field.\n\t\t * - `options` (required) — `[{ value, label, description? }]`.\n\t\t * - `label` — a legend over the cards (visually shown).\n\t\t * - `columns` — 1, 2 or 3 (default 2).\n\t\t * - `readOnly`.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The current detail-page object. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The current object id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** OpenRegister register slug of the surface. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** OpenRegister schema slug of the surface. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['saved'],\n\n\tdata() {\n\t\tuid += 1\n\t\treturn {\n\t\t\tgroupName: `cn-radio-cards-${uid}`,\n\t\t\tsaved: '',\n\t\t\tvalue: '',\n\t\t\tbusy: false,\n\t\t\tnotice: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\toptions() {\n\t\t\tconst list = Array.isArray(this.content.options) ? this.content.options : []\n\t\t\treturn list\n\t\t\t\t.filter((option) => option !== null && option !== undefined)\n\t\t\t\t.map((option) => (typeof option === 'object'\n\t\t\t\t\t? { value: option.value, label: this.tr(String(option.label ?? option.value)), description: this.tr(option.description || '') }\n\t\t\t\t\t: { value: option, label: this.tr(String(option)), description: '' }))\n\t\t},\n\n\t\tlabel() {\n\t\t\treturn this.tr(this.content.label || '')\n\t\t},\n\n\t\tcolumns() {\n\t\t\treturn [1, 3].includes(this.content.columns) ? this.content.columns : 2\n\t\t},\n\n\t\treadOnly() {\n\t\t\treturn this.content.readOnly === true\n\t\t},\n\n\t\tobjectUrl() {\n\t\t\treturn objectUrlOf(this.register, this.schema, this.objectId || (this.objectData && this.objectData.id))\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjectData() {\n\t\t\tthis.adopt()\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.adopt()\n\t},\n\n\tmethods: {\n\t\ttr(text) {\n\t\t\tif (typeof text !== 'string' || text === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/** Read the choice off the object. */\n\t\tadopt() {\n\t\t\tconst stored = readPath(this.objectData || {}, this.content.field)\n\t\t\tthis.saved = stored === undefined || stored === null ? '' : String(stored)\n\t\t\tthis.value = this.saved\n\t\t},\n\n\t\tisSelected(option) {\n\t\t\treturn this.value === String(option.value)\n\t\t},\n\n\t\t/**\n\t\t * Choose a card and save that one field.\n\t\t *\n\t\t * @param {object} option The chosen option.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/abstract-radio-cards/specs/radio-cards/spec.md#requirement-choosing-a-card-saves-that-one-field\n\t\t */\n\t\tasync choose(option) {\n\t\t\tif (!this.objectUrl || !this.content.field) {\n\t\t\t\tthis.notice = this.tr('This choice cannot be saved here.')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.notice = ''\n\t\t\tthis.busy = true\n\t\t\tthis.value = String(option.value)\n\t\t\ttry {\n\t\t\t\tconst data = await patchObject(this.objectUrl, { [this.content.field]: option.value })\n\t\t\t\tconst written = readPath(data, this.content.field)\n\t\t\t\tthis.saved = String(written !== undefined && written !== null ? written : option.value)\n\t\t\t\tthis.value = this.saved\n\t\t\t\t/**\n\t\t\t\t * @event saved The choice was written.\n\t\t\t\t * @type {{field: string, value: unknown}}\n\t\t\t\t */\n\t\t\t\tthis.$emit('saved', { field: this.content.field, value: option.value })\n\t\t\t} catch (e) {\n\t\t\t\tthis.value = this.saved\n\t\t\t\tthis.notice = serverErrorMessage(e)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-radio-cards {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmin-width: 0;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n}\n\n.cn-radio-cards__legend {\n\tpadding: 0;\n\tmargin-bottom: 6px;\n\tfont-weight: 600;\n}\n\n.cn-radio-cards__grid {\n\tdisplay: grid;\n\tgap: 10px;\n\tgrid-template-columns: minmax(0, 1fr);\n}\n\n.cn-radio-cards__grid--2 {\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n}\n\n.cn-radio-cards__grid--3 {\n\tgrid-template-columns: repeat(3, minmax(0, 1fr));\n}\n\n.cn-radio-cards__card {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 10px;\n\tpadding: 12px 14px;\n\tborder: 1px solid var(--color-border-maxcontrast);\n\tborder-radius: var(--cn-board-control-radius, 8px);\n\tbackground: var(--color-main-background);\n\tcursor: pointer;\n}\n\n.cn-radio-cards__card--selected {\n\tborder-color: var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n\tbox-shadow: 0 0 0 1px var(--color-primary-element);\n}\n\n.cn-radio-cards__card:focus-within {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n\n/* The real input stays in the DOM and in the accessibility tree; the dot is its picture. */\n.cn-radio-cards__input {\n\tposition: absolute;\n\topacity: 0;\n\tinset: 0;\n\tmargin: 0;\n\tcursor: pointer;\n}\n\n.cn-radio-cards__dot {\n\tflex: 0 0 auto;\n\twidth: 14px;\n\theight: 14px;\n\tmargin-top: 3px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--color-border-maxcontrast);\n\tborder-radius: 50%;\n\tbackground: var(--color-main-background);\n}\n\n.cn-radio-cards__card--selected .cn-radio-cards__dot {\n\tborder: 4px solid var(--color-primary-element);\n}\n\n.cn-radio-cards__text {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-radio-cards__title {\n\tfont-weight: 600;\n}\n\n.cn-radio-cards__description {\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n@media (max-width: 640px)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