@conduction/nextcloud-vue 2.170.0 → 2.172.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/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +22 -3
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js +242 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js +200 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js +186 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js +24 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue.js +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js +3 -15
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js +16 -61
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js +9 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js +120 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js +86 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js.map +1 -0
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +9 -9
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +75 -4
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js +8 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js +101 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js +54 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js.map +1 -0
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +7 -3
- 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/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +14 -2
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +7 -0
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +2 -2
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +11 -0
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +2 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js +9 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js.map +1 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js +248 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js.map +1 -0
- package/dist/esm/components/{CnMassDeleteDialog/CnMassDeleteDialog.vue3.js → CnMassActionDialog/CnMassActionDialog.vue3.js} +66 -52
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue3.js.map +1 -0
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js +0 -3
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js.map +1 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js +25 -121
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js +11 -3
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue.js +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +21 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +2 -2
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +23 -5
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +3 -0
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +14 -4
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue.js +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js +5 -3
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +16 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +16 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +908 -464
- package/dist/esm/utils/builtInFormatters.js +19 -1
- package/dist/esm/utils/builtInFormatters.js.map +1 -1
- package/dist/esm/utils/noteThreads.js +14 -2
- package/dist/esm/utils/noteThreads.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +11435 -10084
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +908 -464
- package/l10n/en.json +16 -1
- package/l10n/nl.json +16 -1
- package/package.json +1 -1
- package/scripts/.jsdoc-baselines.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +4 -1
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +24 -3
- package/src/components/CnConditionGroupEditor/CnConditionGroup.vue +528 -0
- package/src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue +211 -0
- package/src/components/CnConditionGroupEditor/index.js +9 -0
- package/src/components/CnConditionListEditor/CnConditionListEditor.vue +15 -78
- package/src/components/CnConditionListEditor/CnConditionRow.vue +226 -0
- package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +0 -6
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +75 -4
- package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
- package/src/components/CnDialogActions/index.js +7 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +7 -3
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +15 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/src/components/CnFlowsPage/CnFlowBoard.vue +10 -3
- package/src/components/CnFlowsPage/CnFlowEditorPage.vue +12 -0
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +7 -0
- package/src/components/CnMassActionDialog/CnMassActionDialog.vue +382 -0
- package/src/components/CnMassActionDialog/index.js +7 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.md +4 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +25 -254
- package/src/components/CnNotesCard/CnNotesCard.vue +12 -4
- package/src/components/CnObjectSidebar/CnNotesTab.vue +23 -3
- package/src/components/CnTreeView/CnTreeNode.vue +10 -1
- package/src/components/CnTreeView/CnTreeView.vue +9 -0
- package/src/components/index.js +3 -0
- package/src/css/context-menu.css +7 -0
- package/src/css/look-board-detail.css +220 -2
- package/src/css/look-board-index.css +7 -6
- package/src/css/look-board.css +43 -2
- package/src/css/patches.css +4 -1
- package/src/dialogs/CnConfirmDialog.vue +3 -1
- package/src/index.js +3 -0
- package/src/utils/builtInFormatters.js +18 -0
- package/src/utils/noteThreads.js +13 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnNotesTab.vue3.js","sources":["../../../../src/components/CnObjectSidebar/CnNotesTab.vue?vue&type=template&id=379c1d9a&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<!-- `composer: 'button'`: the add form waits behind \"Add note\". -->\n\t\t\t<div v-if=\"composerBehindButton\" class=\"cn-sidebar-tab__composer-toggle\">\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:aria-expanded=\"composerShown ? 'true' : 'false'\"\n\t\t\t\t\tdata-testid=\"cn-notes-open-composer\"\n\t\t\t\t\t@click=\"composerOpen = !composerOpen\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<NotePlusOutline :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t\t<template v-if=\"composerShown\">\n\t\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\t<p\n\t\t\t\t\tv-if=\"replyTo\"\n\t\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\t\trole=\"status\"\n\t\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t\t{{ replyingLabel }}\n\t\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</p>\n\t\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\t<slot name=\"composer-before\" :setText=\"setComposerText\" :text=\"newNoteText\" />\n\t\t\t\t<CnNoteComposer\n\t\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t\t:register=\"register\"\n\t\t\t\t\t:schema=\"schema\"\n\t\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</template>\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, 'cn-notes-tab__row--authored': authoredRows }\"\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<span\n\t\t\t\t\t\t\t\tv-if=\"authoredRows\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__avatar\"\n\t\t\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__avatar--own': canDelete(row.note) }\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">{{ initialsOf(authorOf(row.note)) }}</span>\n\t\t\t\t\t\t\t<CommentTextOutline v-else :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<!-- `noteRows: 'authored'`: the text is the row's first line, \"author · time\" the second. -->\n\t\t\t\t\t\t<template v-if=\"authoredRows\" #name>\n\t\t\t\t\t\t\t<span class=\"cn-notes-tab__text\">\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 v-if=\"authoredRows\" #subname>\n\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<span class=\"cn-notes-tab__meta\">{{ authorOf(row.note) }} · {{ formatDate(row.note.creationDateTime || row.note.created) }}</span>\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-else #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 v-if=\"!authoredRows\" #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=\"onNoteAction(action, 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<CnIcon v-if=\"typeof action.icon === 'string'\" :name=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" v-else :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ translateLabel(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 { showError, showSuccess, showWarning } from '@nextcloud/dialogs'\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 NotePlusOutline from 'vue-material-design-icons/NotePlusOutline.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 CnIcon from '../CnIcon/CnIcon.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { initialsOf } from '../../utils/initials.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, NotePlusOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tinject: {\n\t\t/** The host app's translate, for labels a manifest wrote (`noteActions`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\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?, endpoint?, messages? }]`.\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 or an icon name. With `endpoint` (an app\n\t\t * URL; `@objectId` and `{objectId}` are filled in) the click also POSTs\n\t\t * `{ note }` there and says what the server answered: `{ outcome,\n\t\t * reason }`, `sent` as a success, `failed` as an error, anything else\n\t\t * as a warning, each with the server's `reason`, else `messages.sent`,\n\t\t * `messages.failed` or `messages.other`.\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\n\t\t/**\n\t\t * An app endpoint the `mention` payload is POSTed to after a note with\n\t\t * an `@mention` was saved, so a manifest can wire the notification\n\t\t * without a component. The `mention` event fires either way.\n\t\t */\n\t\tmentionUrl: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Where the add form lives: `inline` (default) keeps it open above the\n\t\t * notes; `button` puts it behind an \"Add note\" button (DqZaakEmail\n\t\t * \"Notities\") and closes it again once the note is saved. A reply or\n\t\t * an edit opens it either way.\n\t\t *\n\t\t * @spec openspec/changes/notes-tab-composer-button/specs/notes-tab-composer-button/spec.md#requirement-the-notes-tab-can-keep-its-composer-behind-a-button\n\t\t */\n\t\tcomposer: {\n\t\t\ttype: String,\n\t\t\tdefault: 'inline',\n\t\t\tvalidator: (v) => ['inline', 'button'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * How a note is drawn: `list` (default) is the sidebar list item, the\n\t\t * author as its name and the text under it; `authored` leads with the\n\t\t * author's initials, the text bold as the first line and\n\t\t * \"author · time\" under it (DqZaakEmail \"Notities\"). The actions stay.\n\t\t *\n\t\t * @spec openspec/changes/notes-tab-authored-rows/specs/notes-tab-authored-rows/spec.md#requirement-the-notes-tab-can-draw-a-note-as-an-authored-row\n\t\t */\n\t\tnoteRows: {\n\t\t\ttype: String,\n\t\t\tdefault: 'list',\n\t\t\tvalidator: (v) => ['list', 'authored'].includes(v),\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\t/** Whether the add form is open while `composer` is `button`. */\n\t\t\tcomposerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether the add form waits behind the \"Add note\" button. */\n\t\tcomposerBehindButton() {\n\t\t\treturn this.composer === 'button'\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is drawn as an authored row. */\n\t\tauthoredRows() {\n\t\t\treturn this.noteRows === 'authored'\n\t\t},\n\n\t\t/** @return {boolean} Whether the add form shows. */\n\t\tcomposerShown() {\n\t\t\treturn !this.composerBehindButton || this.composerOpen || Boolean(this.replyTo) || Boolean(this.editingNoteId)\n\t\t},\n\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\tinitialsOf,\n\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\tconst payload = {\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\tthis.$emit('mention', payload)\n\t\t\tif (this.mentionUrl !== '') {\n\t\t\t\tthis.postJson(this.mentionUrl, payload).catch(() => {\n\t\t\t\t\t// The note is saved; a notification that did not go out is\n\t\t\t\t\t// not a reason to tell the writer their note failed.\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A manifest label through the host app's translate.\n\t\t *\n\t\t * @param {string} label The label.\n\t\t * @return {string} The translated label.\n\t\t */\n\t\ttranslateLabel(label) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t},\n\n\t\t/**\n\t\t * POST a JSON body to an app URL and answer the parsed response.\n\t\t *\n\t\t * @param {string} url The app URL (`/apps/...`), tokens filled.\n\t\t * @param {object} body The body.\n\t\t * @return {Promise<object>} The response body; rejects on a non-2xx status.\n\t\t * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-notes-can-notify-and-act-without-a-wrapper\n\t\t */\n\t\tasync postJson(url, body) {\n\t\t\tconst target = interpolateUrlTokens(url, { objectId: this.objectId }).replaceAll('{objectId}', encodeURIComponent(String(this.objectId)))\n\t\t\tconst response = await fetch(prefixUrl(target), { method: 'POST', headers: buildHeaders(), body: JSON.stringify(body) })\n\t\t\tconst data = await response.json().catch(() => ({}))\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = new Error(String(data?.message || data?.error || response.status))\n\t\t\t\terror.data = data\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\treturn data || {}\n\t\t},\n\n\t\t/**\n\t\t * Run one of the app's note actions: emit `note-action`, and with an\n\t\t * `endpoint` POST the note there and say what became of it.\n\t\t *\n\t\t * @param {object} action The action entry.\n\t\t * @param {object} note The note.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-notes-can-notify-and-act-without-a-wrapper\n\t\t */\n\t\tasync onNoteAction(action, note) {\n\t\t\tthis.$emit('note-action', { action: action.id, note })\n\t\t\tif (typeof action.endpoint !== 'string' || action.endpoint === '' || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst messages = action.messages && typeof action.messages === 'object' ? action.messages : {}\n\t\t\tconst say = (key, fallback) => (typeof messages[key] === 'string' && messages[key] !== '' ? this.translateLabel(messages[key]) : fallback)\n\t\t\ttry {\n\t\t\t\tconst outcome = await this.postJson(action.endpoint, { note })\n\t\t\t\tconst reason = String(outcome.reason || '').trim()\n\t\t\t\tif (outcome.outcome === 'sent') {\n\t\t\t\t\tshowSuccess(reason || say('sent', t('nextcloud-vue', 'Done')))\n\t\t\t\t} else if (outcome.outcome === 'failed') {\n\t\t\t\t\tshowError(reason || say('failed', t('nextcloud-vue', 'This did not work. Try again.')))\n\t\t\t\t} else {\n\t\t\t\t\tshowWarning(reason || say('other', t('nextcloud-vue', 'Nothing was changed')))\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconst reason = String(error?.data?.reason || '').trim()\n\t\t\t\tshowError(reason || say('failed', t('nextcloud-vue', 'This did not work. Try again.')))\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\tthis.composerOpen = false\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(userLocale(), {\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__composer-toggle { display: flex; justify-content: flex-end; }\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__avatar {\n\tdisplay: inline-flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder-radius: 50%;\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: 12px;\n\tfont-weight: 700;\n}\n\n.cn-notes-tab__avatar--own {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n/* The text wraps as the row's bold first line; the name line is otherwise a single ellipsed line. */\n.cn-notes-tab__row--authored :deep(.list-item-content__name) {\n\twhite-space: normal;\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-notes-tab__row--authored :deep(.list-item__anchor),\n.cn-notes-tab__row--authored :deep(.list-item__anchor:hover) {\n\ttext-decoration: none;\n}\n\n.cn-notes-tab__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\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","_createElementVNode","_createVNode","_createTextVNode","_Fragment","_toDisplayString","_renderSlot","_createBlock","_renderList","_normalizeClass","_resolveDynamicComponent"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,gBAAA,GAAA;AAEL,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,wBAAwB,GAAA;;;AAED,EAAA,KAAK,EAAC,iCAAA;;;;AAgBpC,EAAA,KAAI,EAAC,0BAAW;AACjB,EAAA,IAAI,EAAC,QAAK;AACV,EAAA,aAAE,EAAA,mBAAA;;AAkBE,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,6BAAO,GAAA;;;AAyBgB,EAAA,KAAG,EAAA,uBAAA;;;;AAK5B,EAAA,KAAK,EAAE,sBAAkB;;;AAqBzB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oBAAoB,GAAA;;;AAKT,EAAA,KAAK,EAAC,qBAAqB;AAAC,EAAA,aAAW,EAAA,eAAA;;AACxD,MAAA,WAAA,GAAA,EAAA,KAAG,EAAA,oBAAA,GAAA;;;AAGR,EAAA,KAAI,EAAE,sBAAsB;AAC5B,EAAA,aAAU,EAAE,gBAAgB;;AAGvB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,yBAAyB,GAAA;;;AACb,EAAA,KAAK,EAAC,qBAAqB;AAAC,EAAA,aAAU,EAAA,eAAA;;;;AAY7D,EAAA,KAAK,EAAC,sBAAQ;AACd,EAAA,aAAW,EAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;AAtHhC,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;AAEC,IAAAC,kBAAA,CAwDG,OAxDH,UAwDG,EAAA;OAtDM,QAAoB,CAAA,oBAAA;AAA7B,WAAAF,SAAA,EAAA,EAAAC,kBAAA,CAWI,OAXJ,UAWI,EAAA;YAVJE,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../src/components/CnObjectSidebar/CnNotesTab.vue?vue&type=template&id=60fb682a&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<!-- `composer: 'button'`: the add form waits behind \"Add note\". -->\n\t\t\t<div v-if=\"composerBehindButton\" class=\"cn-sidebar-tab__composer-toggle\">\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:aria-expanded=\"composerShown ? 'true' : 'false'\"\n\t\t\t\t\tdata-testid=\"cn-notes-open-composer\"\n\t\t\t\t\t@click=\"composerOpen = !composerOpen\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<NotePlusOutline :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ addNoteLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t\t<template v-if=\"composerShown\">\n\t\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\t<p\n\t\t\t\t\tv-if=\"replyTo\"\n\t\t\t\t\tclass=\"cn-sidebar-tab__replying\"\n\t\t\t\t\trole=\"status\"\n\t\t\t\t\tdata-testid=\"cn-notes-replying\">\n\t\t\t\t\t{{ replyingLabel }}\n\t\t\t\t\t<NcButton variant=\"tertiary\" @click=\"cancelReply\">\n\t\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</p>\n\t\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\t<slot name=\"composer-before\" :setText=\"setComposerText\" :text=\"newNoteText\" />\n\t\t\t\t<CnNoteComposer\n\t\t\t\t\tclass=\"cn-sidebar-tab__composer\"\n\t\t\t\t\t:modelValue=\"newNoteText\"\n\t\t\t\t\t:placeholder=\"addNotePlaceholder\"\n\t\t\t\t\t:register=\"register\"\n\t\t\t\t\t:schema=\"schema\"\n\t\t\t\t\t:objectId=\"objectId\"\n\t\t\t\t\t:apiBase=\"apiBase\"\n\t\t\t\t\t@update:modelValue=\"newNoteText = $event\"\n\t\t\t\t\t@submit=\"submitComposer\" />\n\t\t\t\t<div class=\"cn-sidebar-tab__action--row\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"editingNoteId\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t@click=\"cancelEdit\">\n\t\t\t\t\t\t{{ cancelLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t:disabled=\"!newNoteText.trim() || saving\"\n\t\t\t\t\t\t@click=\"editingNoteId ? saveEdit() : addNote()\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<Send :size=\"20\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ editingNoteId ? saveLabel : addNoteLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</template>\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, 'cn-notes-tab__row--authored': authoredRows }\"\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<span\n\t\t\t\t\t\t\t\tv-if=\"authoredRows\"\n\t\t\t\t\t\t\t\tclass=\"cn-notes-tab__avatar\"\n\t\t\t\t\t\t\t\t:class=\"{ 'cn-notes-tab__avatar--own': canDelete(row.note) }\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">{{ initialsOf(authorOf(row.note)) }}</span>\n\t\t\t\t\t\t\t<CommentTextOutline v-else :size=\"32\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t<!-- `noteRows: 'authored'`: the text is the row's first line, \"author · time\" the second. -->\n\t\t\t\t\t\t<template v-if=\"authoredRows\" #name>\n\t\t\t\t\t\t\t<span class=\"cn-notes-tab__text\">\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 v-if=\"authoredRows\" #subname>\n\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<span class=\"cn-notes-tab__meta\">{{ authorOf(row.note) }} · {{ authoredTime(row.note) }}</span>\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-else #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 v-if=\"!authoredRows\" #details>\n\t\t\t\t\t\t\t{{ formatDate(noteCreatedAt(row.note)) }}\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=\"onNoteAction(action, 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<CnIcon v-if=\"typeof action.icon === 'string'\" :name=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t\t\t\t\t<component :is=\"action.icon\" v-else :size=\"20\" />\n\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t{{ translateLabel(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 { showError, showSuccess, showWarning } from '@nextcloud/dialogs'\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 NotePlusOutline from 'vue-material-design-icons/NotePlusOutline.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 CnIcon from '../CnIcon/CnIcon.vue'\nimport CnNoteBody from '../CnNoteBody/CnNoteBody.vue'\nimport CnNoteComposer from '../CnNoteComposer/CnNoteComposer.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'\nimport { buildHeaders, prefixUrl } from '../../utils/index.js'\nimport { initialsOf } from '../../utils/initials.js'\nimport { extractMentionedGroupIds, extractMentionedIds } from '../../utils/mentions.js'\nimport { noteCreatedAt, quoteFor, supportsReplies, threadNotes, threadRootId } from '../../utils/noteThreads.js'\nimport { searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nexport default {\n\tname: 'CnNotesTab',\n\n\tcomponents: { NcButton, NcListItem, NcActionButton, NcLoadingIcon, CnIcon, CnNoteBody, CnNoteComposer, CnNoteHistoryDialog, CommentTextOutline, NotePlusOutline, Send, Pencil, Delete, HistoryIcon, Reply },\n\n\tinject: {\n\t\t/** The host app's translate, for labels a manifest wrote (`noteActions`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\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?, endpoint?, messages? }]`.\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 or an icon name. With `endpoint` (an app\n\t\t * URL; `@objectId` and `{objectId}` are filled in) the click also POSTs\n\t\t * `{ note }` there and says what the server answered: `{ outcome,\n\t\t * reason }`, `sent` as a success, `failed` as an error, anything else\n\t\t * as a warning, each with the server's `reason`, else `messages.sent`,\n\t\t * `messages.failed` or `messages.other`.\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\n\t\t/**\n\t\t * An app endpoint the `mention` payload is POSTed to after a note with\n\t\t * an `@mention` was saved, so a manifest can wire the notification\n\t\t * without a component. The `mention` event fires either way.\n\t\t */\n\t\tmentionUrl: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Where the add form lives: `inline` (default) keeps it open above the\n\t\t * notes; `button` puts it behind an \"Add note\" button (DqZaakEmail\n\t\t * \"Notities\") and closes it again once the note is saved. A reply or\n\t\t * an edit opens it either way.\n\t\t *\n\t\t * @spec openspec/changes/notes-tab-composer-button/specs/notes-tab-composer-button/spec.md#requirement-the-notes-tab-can-keep-its-composer-behind-a-button\n\t\t */\n\t\tcomposer: {\n\t\t\ttype: String,\n\t\t\tdefault: 'inline',\n\t\t\tvalidator: (v) => ['inline', 'button'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * How a note is drawn: `list` (default) is the sidebar list item, the\n\t\t * author as its name and the text under it; `authored` leads with the\n\t\t * author's initials, the text bold as the first line and\n\t\t * \"author · time\" under it (DqZaakEmail \"Notities\"). The actions stay.\n\t\t *\n\t\t * @spec openspec/changes/notes-tab-authored-rows/specs/notes-tab-authored-rows/spec.md#requirement-the-notes-tab-can-draw-a-note-as-an-authored-row\n\t\t */\n\t\tnoteRows: {\n\t\t\ttype: String,\n\t\t\tdefault: 'list',\n\t\t\tvalidator: (v) => ['list', 'authored'].includes(v),\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\t/** Whether the add form is open while `composer` is `button`. */\n\t\t\tcomposerOpen: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether the add form waits behind the \"Add note\" button. */\n\t\tcomposerBehindButton() {\n\t\t\treturn this.composer === 'button'\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is drawn as an authored row. */\n\t\tauthoredRows() {\n\t\t\treturn this.noteRows === 'authored'\n\t\t},\n\n\t\t/** @return {boolean} Whether the add form shows. */\n\t\tcomposerShown() {\n\t\t\treturn !this.composerBehindButton || this.composerOpen || Boolean(this.replyTo) || Boolean(this.editingNoteId)\n\t\t},\n\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\tinitialsOf,\n\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\tconst payload = {\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\tthis.$emit('mention', payload)\n\t\t\tif (this.mentionUrl !== '') {\n\t\t\t\tthis.postJson(this.mentionUrl, payload).catch(() => {\n\t\t\t\t\t// The note is saved; a notification that did not go out is\n\t\t\t\t\t// not a reason to tell the writer their note failed.\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A manifest label through the host app's translate.\n\t\t *\n\t\t * @param {string} label The label.\n\t\t * @return {string} The translated label.\n\t\t */\n\t\ttranslateLabel(label) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t},\n\n\t\t/**\n\t\t * POST a JSON body to an app URL and answer the parsed response.\n\t\t *\n\t\t * @param {string} url The app URL (`/apps/...`), tokens filled.\n\t\t * @param {object} body The body.\n\t\t * @return {Promise<object>} The response body; rejects on a non-2xx status.\n\t\t * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-notes-can-notify-and-act-without-a-wrapper\n\t\t */\n\t\tasync postJson(url, body) {\n\t\t\tconst target = interpolateUrlTokens(url, { objectId: this.objectId }).replaceAll('{objectId}', encodeURIComponent(String(this.objectId)))\n\t\t\tconst response = await fetch(prefixUrl(target), { method: 'POST', headers: buildHeaders(), body: JSON.stringify(body) })\n\t\t\tconst data = await response.json().catch(() => ({}))\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = new Error(String(data?.message || data?.error || response.status))\n\t\t\t\terror.data = data\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\treturn data || {}\n\t\t},\n\n\t\t/**\n\t\t * Run one of the app's note actions: emit `note-action`, and with an\n\t\t * `endpoint` POST the note there and say what became of it.\n\t\t *\n\t\t * @param {object} action The action entry.\n\t\t * @param {object} note The note.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-notes-can-notify-and-act-without-a-wrapper\n\t\t */\n\t\tasync onNoteAction(action, note) {\n\t\t\tthis.$emit('note-action', { action: action.id, note })\n\t\t\tif (typeof action.endpoint !== 'string' || action.endpoint === '' || !this.objectId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst messages = action.messages && typeof action.messages === 'object' ? action.messages : {}\n\t\t\tconst say = (key, fallback) => (typeof messages[key] === 'string' && messages[key] !== '' ? this.translateLabel(messages[key]) : fallback)\n\t\t\ttry {\n\t\t\t\tconst outcome = await this.postJson(action.endpoint, { note })\n\t\t\t\tconst reason = String(outcome.reason || '').trim()\n\t\t\t\tif (outcome.outcome === 'sent') {\n\t\t\t\t\tshowSuccess(reason || say('sent', t('nextcloud-vue', 'Done')))\n\t\t\t\t} else if (outcome.outcome === 'failed') {\n\t\t\t\t\tshowError(reason || say('failed', t('nextcloud-vue', 'This did not work. Try again.')))\n\t\t\t\t} else {\n\t\t\t\t\tshowWarning(reason || say('other', t('nextcloud-vue', 'Nothing was changed')))\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconst reason = String(error?.data?.reason || '').trim()\n\t\t\t\tshowError(reason || say('failed', t('nextcloud-vue', 'This did not work. Try again.')))\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\tthis.composerOpen = false\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\tnoteCreatedAt,\n\n\t\t/**\n\t\t * The time on an authored row, as the boards write it: \"6 okt 15:52\",\n\t\t * with the year outside the current one.\n\t\t *\n\t\t * @param {object} note The note.\n\t\t * @return {string} The time, or '' when the note has none.\n\t\t * @spec openspec/changes/notes-tab-authored-rows/specs/notes-tab-authored-rows/spec.md#requirement-the-notes-tab-can-draw-a-note-as-an-authored-row\n\t\t */\n\t\tauthoredTime(note) {\n\t\t\tconst value = noteCreatedAt(note)\n\t\t\tconst date = value ? new Date(value) : null\n\t\t\tif (date === null || Number.isNaN(date.getTime())) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn formatBoardDate(date) + ' ' + formatTimeOfDay(date)\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(userLocale(), {\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__composer-toggle { display: flex; justify-content: flex-end; }\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__avatar {\n\tdisplay: inline-flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 32px;\n\theight: 32px;\n\tborder-radius: 50%;\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: 12px;\n\tfont-weight: 700;\n}\n\n.cn-notes-tab__avatar--own {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n/* The text wraps as the row's bold first line; the name line is otherwise a single ellipsed line. */\n.cn-notes-tab__row--authored :deep(.list-item-content__name) {\n\twhite-space: normal;\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-notes-tab__row--authored :deep(.list-item__anchor),\n.cn-notes-tab__row--authored :deep(.list-item__anchor:hover) {\n\ttext-decoration: none;\n}\n\n.cn-notes-tab__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\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","_createElementVNode","_createVNode","_createTextVNode","_Fragment","_toDisplayString","_renderSlot","_createBlock","_renderList","_normalizeClass","_resolveDynamicComponent"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,gBAAA,GAAA;AAEL,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,wBAAwB,GAAA;;;AAED,EAAA,KAAK,EAAC,iCAAA;;;;AAgBpC,EAAA,KAAI,EAAC,0BAAW;AACjB,EAAA,IAAI,EAAC,QAAK;AACV,EAAA,aAAE,EAAA,mBAAA;;AAkBE,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,6BAAO,GAAA;;;AAyBgB,EAAA,KAAG,EAAA,uBAAA;;;;AAK5B,EAAA,KAAK,EAAE,sBAAkB;;;AAqBzB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oBAAoB,GAAA;;;AAKT,EAAA,KAAK,EAAC,qBAAqB;AAAC,EAAA,aAAW,EAAA,eAAA;;AACxD,MAAA,WAAA,GAAA,EAAA,KAAG,EAAA,oBAAA,GAAA;;;AAGR,EAAA,KAAI,EAAE,sBAAsB;AAC5B,EAAA,aAAU,EAAE,gBAAgB;;AAGvB,MAAA,WAAA,GAAA,EAAA,KAAK,EAA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CAAAG,uBAAA,CAAA,MAAA,CAAA,IAAA,CAAA,EAAA;;AAAA,gDAAA,IAAA,EAAA,EAAA;;;;;;;;;;;;;;;;;;KAWR,KAAS,CAAA,aAAA;sBADfH;;AAEC,UAAA,IAAI,EAAE,IAAI;AACV,UAAA,MAAM,EAAE,KAAa,CAAA,aAAA;AACrB,UAAA,QAAE,EAAA,MAAA,CAAA,QAAA;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTreeNode.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeNode.vue"],"sourcesContent":["<template>\n\t<li class=\"cn-tree-node\"\n\t\t:class=\"{\n\t\t\t'cn-tree-node--selected': isSelected,\n\t\t\t'cn-tree-node--expanded': isExpanded,\n\t\t}\"\n\t\t:data-node-id=\"node[idKey]\"\n\t\trole=\"treeitem\"\n\t\t:aria-expanded=\"hasChildren ? isExpanded : undefined\"\n\t\t:aria-selected=\"isSelected\">\n\t\t<div class=\"cn-tree-node__row\"\n\t\t\t:style=\"{ paddingLeft: (depth * indent) + 'px' }\"\n\t\t\t@click=\"onRowClick\">\n\t\t\t<button v-if=\"hasChildren\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-tree-node__toggle\"\n\t\t\t\t:aria-label=\"isExpanded ? collapseLabel : expandLabel\"\n\t\t\t\t@click.stop=\"toggle\">\n\t\t\t\t<span class=\"cn-tree-node__caret\" :class=\"{ 'cn-tree-node__caret--open': isExpanded }\">▸</span>\n\t\t\t</button>\n\t\t\t<span v-else class=\"cn-tree-node__toggle cn-tree-node__toggle--leaf\" />\n\n\t\t\t<span v-if=\"node.icon\" class=\"cn-tree-node__icon\">{{ node.icon }}</span>\n\t\t\t<span class=\"cn-tree-node__label\">{{ node[labelKey] }}</span>\n\t\t\t<span v-if=\"node.badge !== undefined\" class=\"cn-tree-node__badge\">{{ node.badge }}</span>\n\n\t\t\t<!-- @slot actions Inline per-row actions slot. Scope:\n\t\t\t { node, depth }. -->\n\t\t\t<slot name=\"actions\" :node=\"node\" :depth=\"depth\" />\n\t\t</div>\n\n\t\t<ul v-if=\"hasChildren && isExpanded\" class=\"cn-tree-node__children\" role=\"group\">\n\t\t\t<CnTreeNode v-for=\"child in node[childrenKey]\"\n\t\t\t\t:key=\"child[idKey]\"\n\t\t\t\t:node=\"child\"\n\t\t\t\t:depth=\"depth + 1\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedIds\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"$emit('toggle', $event)\"\n\t\t\t\t@select=\"$emit('select', $event)\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</li>\n</template>\n\n<script>\n/**\n * CnTreeNode — Recursive tree row used inside CnTreeView. Renders\n * its own row + recurses for children when expanded. Not exported\n * as a separate barrel entry — consumers use CnTreeView and the\n * recursion is internal.\n */\nexport default {\n\tname: 'CnTreeNode',\n\tprops: {\n\t\t/** The node data. */\n\t\tnode: { type: Object, required: true },\n\t\t/** Depth (drives indent). */\n\t\tdepth: { type: Number, default: 0 },\n\t\t/** Pixels of padding per depth level. */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Set of expanded node ids. */\n\t\texpandedIds: { type: Object, required: true },\n\t\t/** Currently selected node id, read off `node[idKey]` (or null). */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Node-field key for the id. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Node-field key for the display label. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Node-field key for the children array. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t},\n\n\temits: ['select', 'toggle'],\n\tcomputed: {\n\t\t/**\n\t\t * Whether this node has any children at all.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\thasChildren() {\n\t\t\tconst c = this.node[this.childrenKey]\n\t\t\treturn Array.isArray(c) && c.length > 0\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is currently expanded.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisExpanded() {\n\t\t\treturn Boolean(this.expandedIds[this.node[this.idKey]])\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is the currently-selected one.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisSelected() {\n\t\t\treturn this.selectedId === this.node[this.idKey]\n\t\t},\n\t},\n\n\tmethods: {\n\t\ttoggle() {\n\t\t\tthis.$emit('toggle', this.node[this.idKey])\n\t\t},\n\n\t\tonRowClick() {\n\t\t\tthis.$emit('select', this.node)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-node {\n\tlist-style: none;\n}\n\n.cn-tree-node__row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 4px 6px;\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n}\n\n.cn-tree-node__row:hover {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-tree-node--selected > .cn-tree-node__row {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__toggle {\n\tbackground: none;\n\tborder: none;\n\tcursor: pointer;\n\tpadding: 0;\n\twidth: 18px;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.cn-tree-node__toggle--leaf {\n\tcursor: default;\n}\n\n.cn-tree-node__caret {\n\tdisplay: inline-block;\n\ttransition: transform 0.15s ease;\n\tfont-size: 0.9em;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__caret--open {\n\ttransform: rotate(90deg);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__icon {\n\tfont-size: 0.9em;\n}\n\n.cn-tree-node__label {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-tree-node__badge {\n\tfont-size: 0.8em;\n\tpadding: 1px 6px;\n\tborder-radius: 9999px;\n\tbackground: var(--color-background-hover);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CnTreeNode.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeNode.vue"],"sourcesContent":["<template>\n\t<li class=\"cn-tree-node\"\n\t\t:class=\"{\n\t\t\t'cn-tree-node--selected': isSelected,\n\t\t\t'cn-tree-node--expanded': isExpanded,\n\t\t}\"\n\t\t:data-node-id=\"node[idKey]\"\n\t\trole=\"treeitem\"\n\t\t:aria-expanded=\"hasChildren ? isExpanded : undefined\"\n\t\t:aria-selected=\"isSelected\">\n\t\t<div class=\"cn-tree-node__row\"\n\t\t\t:style=\"{ paddingLeft: (depth * indent) + 'px' }\"\n\t\t\t@click=\"onRowClick\">\n\t\t\t<button v-if=\"hasChildren\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-tree-node__toggle\"\n\t\t\t\t:aria-label=\"isExpanded ? collapseLabel : expandLabel\"\n\t\t\t\t@click.stop=\"toggle\">\n\t\t\t\t<span class=\"cn-tree-node__caret\" :class=\"{ 'cn-tree-node__caret--open': isExpanded }\">▸</span>\n\t\t\t</button>\n\t\t\t<span v-else class=\"cn-tree-node__toggle cn-tree-node__toggle--leaf\" />\n\n\t\t\t<span v-if=\"node.icon\" class=\"cn-tree-node__icon\">{{ node.icon }}</span>\n\t\t\t<span class=\"cn-tree-node__label\">\n\t\t\t\t<!-- @slot label The row's label. Scope: { node, depth, expanded }. Defaults to the node's label text. -->\n\t\t\t\t<slot name=\"label\"\n\t\t\t\t\t:node=\"node\"\n\t\t\t\t\t:depth=\"depth\"\n\t\t\t\t\t:expanded=\"isExpanded\">{{ node[labelKey] }}</slot>\n\t\t\t</span>\n\t\t\t<span v-if=\"node.badge !== undefined\" class=\"cn-tree-node__badge\">{{ node.badge }}</span>\n\n\t\t\t<!-- @slot actions Inline per-row actions slot. Scope:\n\t\t\t { node, depth }. -->\n\t\t\t<slot name=\"actions\" :node=\"node\" :depth=\"depth\" />\n\t\t</div>\n\n\t\t<ul v-if=\"hasChildren && isExpanded\" class=\"cn-tree-node__children\" role=\"group\">\n\t\t\t<CnTreeNode v-for=\"child in node[childrenKey]\"\n\t\t\t\t:key=\"child[idKey]\"\n\t\t\t\t:node=\"child\"\n\t\t\t\t:depth=\"depth + 1\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedIds\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"$emit('toggle', $event)\"\n\t\t\t\t@select=\"$emit('select', $event)\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</li>\n</template>\n\n<script>\n/**\n * CnTreeNode — Recursive tree row used inside CnTreeView. Renders\n * its own row + recurses for children when expanded. Not exported\n * as a separate barrel entry — consumers use CnTreeView and the\n * recursion is internal.\n */\nexport default {\n\tname: 'CnTreeNode',\n\tprops: {\n\t\t/** The node data. */\n\t\tnode: { type: Object, required: true },\n\t\t/** Depth (drives indent). */\n\t\tdepth: { type: Number, default: 0 },\n\t\t/** Pixels of padding per depth level. */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Set of expanded node ids. */\n\t\texpandedIds: { type: Object, required: true },\n\t\t/** Currently selected node id, read off `node[idKey]` (or null). */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Node-field key for the id. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Node-field key for the display label. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Node-field key for the children array. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t},\n\n\temits: ['select', 'toggle'],\n\tcomputed: {\n\t\t/**\n\t\t * Whether this node has any children at all.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\thasChildren() {\n\t\t\tconst c = this.node[this.childrenKey]\n\t\t\treturn Array.isArray(c) && c.length > 0\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is currently expanded.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisExpanded() {\n\t\t\treturn Boolean(this.expandedIds[this.node[this.idKey]])\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is the currently-selected one.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisSelected() {\n\t\t\treturn this.selectedId === this.node[this.idKey]\n\t\t},\n\t},\n\n\tmethods: {\n\t\ttoggle() {\n\t\t\tthis.$emit('toggle', this.node[this.idKey])\n\t\t},\n\n\t\tonRowClick() {\n\t\t\tthis.$emit('select', this.node)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-node {\n\tlist-style: none;\n}\n\n.cn-tree-node__row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 4px 6px;\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n}\n\n.cn-tree-node__row:hover {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-tree-node--selected > .cn-tree-node__row {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__toggle {\n\tbackground: none;\n\tborder: none;\n\tcursor: pointer;\n\tpadding: 0;\n\twidth: 18px;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.cn-tree-node__toggle--leaf {\n\tcursor: default;\n}\n\n.cn-tree-node__caret {\n\tdisplay: inline-block;\n\ttransition: transform 0.15s ease;\n\tfont-size: 0.9em;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__caret--open {\n\ttransform: rotate(90deg);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__icon {\n\tfont-size: 0.9em;\n}\n\n.cn-tree-node__label {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-tree-node__badge {\n\tfont-size: 0.8em;\n\tpadding: 1px 6px;\n\tborder-radius: 9999px;\n\tbackground: var(--color-background-hover);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":[],"mappings":"AAgEA;;;;AAIC;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;AAClB,CAAA,KAAK,EAAE;AACN;AACA,EAAA,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;EAEtC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA,EAAG;AACnC;AACA,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAA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AE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA;GAC1C;;EAED,UAAU,GAAG;GACZ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAA;GAC9B;EACD;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, withModifiers, toDisplayString, createCommentVNode, renderSlot, Fragment, renderList, createBlock, withCtx, mergeProps } from 'vue';
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, withModifiers, toDisplayString, createCommentVNode, renderSlot, createTextVNode, Fragment, renderList, createBlock, createSlots, withCtx, mergeProps } from 'vue';
|
|
2
2
|
|
|
3
3
|
const _hoisted_1 = ["data-node-id", "aria-expanded", "aria-selected"];
|
|
4
4
|
const _hoisted_2 = ["aria-label"];
|
|
@@ -55,7 +55,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
55
55
|
($props.node.icon)
|
|
56
56
|
? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString($props.node.icon), 1 /* TEXT */))
|
|
57
57
|
: createCommentVNode("v-if", true),
|
|
58
|
-
createElementVNode("span", _hoisted_5,
|
|
58
|
+
createElementVNode("span", _hoisted_5, [
|
|
59
|
+
renderSlot(_ctx.$slots, "label", {
|
|
60
|
+
node: $props.node,
|
|
61
|
+
depth: $props.depth,
|
|
62
|
+
expanded: $options.isExpanded
|
|
63
|
+
}, () => [
|
|
64
|
+
createTextVNode(toDisplayString($props.node[$props.labelKey]), 1 /* TEXT */)
|
|
65
|
+
])
|
|
66
|
+
]),
|
|
59
67
|
($props.node.badge !== undefined)
|
|
60
68
|
? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString($props.node.badge), 1 /* TEXT */))
|
|
61
69
|
: createCommentVNode("v-if", true),
|
|
@@ -81,12 +89,22 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
81
89
|
collapseLabel: $props.collapseLabel,
|
|
82
90
|
onToggle: _cache[2] || (_cache[2] = $event => (_ctx.$emit('toggle', $event))),
|
|
83
91
|
onSelect: _cache[3] || (_cache[3] = $event => (_ctx.$emit('select', $event)))
|
|
84
|
-
}, {
|
|
92
|
+
}, createSlots({
|
|
85
93
|
actions: withCtx((scope) => [
|
|
86
94
|
renderSlot(_ctx.$slots, "actions", mergeProps({ ref_for: true }, scope))
|
|
87
95
|
]),
|
|
88
|
-
_:
|
|
89
|
-
},
|
|
96
|
+
_: 2 /* DYNAMIC */
|
|
97
|
+
}, [
|
|
98
|
+
(_ctx.$slots.label)
|
|
99
|
+
? {
|
|
100
|
+
name: "label",
|
|
101
|
+
fn: withCtx((scope) => [
|
|
102
|
+
renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, scope))
|
|
103
|
+
]),
|
|
104
|
+
key: "0"
|
|
105
|
+
}
|
|
106
|
+
: undefined
|
|
107
|
+
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "depth", "indent", "expandedIds", "selectedId", "idKey", "labelKey", "childrenKey", "expandLabel", "collapseLabel"]))
|
|
90
108
|
}), 128 /* KEYED_FRAGMENT */))
|
|
91
109
|
]))
|
|
92
110
|
: createCommentVNode("v-if", true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTreeNode.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeNode.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CnTreeNode.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeNode.vue?vue&type=template&id=478b0cc7&lang.js"],"sourcesContent":["<template>\n\t<li class=\"cn-tree-node\"\n\t\t:class=\"{\n\t\t\t'cn-tree-node--selected': isSelected,\n\t\t\t'cn-tree-node--expanded': isExpanded,\n\t\t}\"\n\t\t:data-node-id=\"node[idKey]\"\n\t\trole=\"treeitem\"\n\t\t:aria-expanded=\"hasChildren ? isExpanded : undefined\"\n\t\t:aria-selected=\"isSelected\">\n\t\t<div class=\"cn-tree-node__row\"\n\t\t\t:style=\"{ paddingLeft: (depth * indent) + 'px' }\"\n\t\t\t@click=\"onRowClick\">\n\t\t\t<button v-if=\"hasChildren\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-tree-node__toggle\"\n\t\t\t\t:aria-label=\"isExpanded ? collapseLabel : expandLabel\"\n\t\t\t\t@click.stop=\"toggle\">\n\t\t\t\t<span class=\"cn-tree-node__caret\" :class=\"{ 'cn-tree-node__caret--open': isExpanded }\">▸</span>\n\t\t\t</button>\n\t\t\t<span v-else class=\"cn-tree-node__toggle cn-tree-node__toggle--leaf\" />\n\n\t\t\t<span v-if=\"node.icon\" class=\"cn-tree-node__icon\">{{ node.icon }}</span>\n\t\t\t<span class=\"cn-tree-node__label\">\n\t\t\t\t<!-- @slot label The row's label. Scope: { node, depth, expanded }. Defaults to the node's label text. -->\n\t\t\t\t<slot name=\"label\"\n\t\t\t\t\t:node=\"node\"\n\t\t\t\t\t:depth=\"depth\"\n\t\t\t\t\t:expanded=\"isExpanded\">{{ node[labelKey] }}</slot>\n\t\t\t</span>\n\t\t\t<span v-if=\"node.badge !== undefined\" class=\"cn-tree-node__badge\">{{ node.badge }}</span>\n\n\t\t\t<!-- @slot actions Inline per-row actions slot. Scope:\n\t\t\t { node, depth }. -->\n\t\t\t<slot name=\"actions\" :node=\"node\" :depth=\"depth\" />\n\t\t</div>\n\n\t\t<ul v-if=\"hasChildren && isExpanded\" class=\"cn-tree-node__children\" role=\"group\">\n\t\t\t<CnTreeNode v-for=\"child in node[childrenKey]\"\n\t\t\t\t:key=\"child[idKey]\"\n\t\t\t\t:node=\"child\"\n\t\t\t\t:depth=\"depth + 1\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedIds\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"$emit('toggle', $event)\"\n\t\t\t\t@select=\"$emit('select', $event)\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</li>\n</template>\n\n<script>\n/**\n * CnTreeNode — Recursive tree row used inside CnTreeView. Renders\n * its own row + recurses for children when expanded. Not exported\n * as a separate barrel entry — consumers use CnTreeView and the\n * recursion is internal.\n */\nexport default {\n\tname: 'CnTreeNode',\n\tprops: {\n\t\t/** The node data. */\n\t\tnode: { type: Object, required: true },\n\t\t/** Depth (drives indent). */\n\t\tdepth: { type: Number, default: 0 },\n\t\t/** Pixels of padding per depth level. */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Set of expanded node ids. */\n\t\texpandedIds: { type: Object, required: true },\n\t\t/** Currently selected node id, read off `node[idKey]` (or null). */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Node-field key for the id. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Node-field key for the display label. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Node-field key for the children array. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t},\n\n\temits: ['select', 'toggle'],\n\tcomputed: {\n\t\t/**\n\t\t * Whether this node has any children at all.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\thasChildren() {\n\t\t\tconst c = this.node[this.childrenKey]\n\t\t\treturn Array.isArray(c) && c.length > 0\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is currently expanded.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisExpanded() {\n\t\t\treturn Boolean(this.expandedIds[this.node[this.idKey]])\n\t\t},\n\n\t\t/**\n\t\t * Whether this node is the currently-selected one.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tisSelected() {\n\t\t\treturn this.selectedId === this.node[this.idKey]\n\t\t},\n\t},\n\n\tmethods: {\n\t\ttoggle() {\n\t\t\tthis.$emit('toggle', this.node[this.idKey])\n\t\t},\n\n\t\tonRowClick() {\n\t\t\tthis.$emit('select', this.node)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-node {\n\tlist-style: none;\n}\n\n.cn-tree-node__row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tpadding: 4px 6px;\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n}\n\n.cn-tree-node__row:hover {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-tree-node--selected > .cn-tree-node__row {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__toggle {\n\tbackground: none;\n\tborder: none;\n\tcursor: pointer;\n\tpadding: 0;\n\twidth: 18px;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.cn-tree-node__toggle--leaf {\n\tcursor: default;\n}\n\n.cn-tree-node__caret {\n\tdisplay: inline-block;\n\ttransition: transform 0.15s ease;\n\tfont-size: 0.9em;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__caret--open {\n\ttransform: rotate(90deg);\n\tcolor: var(--color-main-text);\n}\n\n.cn-tree-node__icon {\n\tfont-size: 0.9em;\n}\n\n.cn-tree-node__label {\n\tflex: 1 1 auto;\n\tmin-width: 0;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-tree-node__badge {\n\tfont-size: 0.8em;\n\tpadding: 1px 6px;\n\tborder-radius: 9999px;\n\tbackground: var(--color-background-hover);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-node__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_normalizeStyle","_normalizeClass","_openBlock","_toDisplayString","_renderSlot","_createTextVNode","_Fragment","_renderList","_createBlock","_withCtx","_mergeProps"],"mappings":";;;;;;AAoBgB,EAAA,KAAK,EAAC;;;;AAEI,EAAA,KAAK,EAAC,oBAAoB;;AAC3C,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,qBAAqB,GAAA;;;AAOK,EAAA,KAAK,EAAC,qBAAqB;;;;AAO7B,EAAA,KAAK,EAAC,wBAAuB;AAAE,EAAA,IAAI,EAAC,OAAO;;;;;;uBApCjFA,kBA2DI,CAAA,IAAA,EAAA;AA3DA,IAAA,KAAK,kBAAC,cAAa,EAAA;6BACd,QAAA,CAAA,UAAA;6BAAA,QAAA,CAAA,UAAA;;IAIP,cAAY,EAAE,MAAI,CAAA,IAAA,CAAC,MAAK,CAAA,KAAA,CAAA;AACzB,IAAA,IAAI,EAAC,UAAS;AACb,IAAA,eAAa,EAAE,QAAA,CAAA,WAAU,GAAI,QAAA,CAAA,UAAW,GAAE,SAAS;AACnD,IAAA,eAAa,EAAE,QAAU,CAAA,UAAA;;IAC1BC,kBAyBK,CAAA,KAAA,EAAA;AAzBA,MAAA,KAAK,EAAC,mBAAkB;MAC3B,KAAK,EAAAC,cAAA,CAAA,EAAA,WAAA,EAAA,CAAkB,MAAM,CAAA,KAAA,GAAE,MAAM,CAAA,MAAA,IAAA,IAAA,EAAA,CAAA;AACrC,MAAA,OAAK,0CAAE,QAAU,CAAA,UAAA,IAAA,QAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA,CAAA;;OACJ,QAAW,CAAA,WAAA;wBAAzBF,kBAMQ,CAAA,QAAA,EAAA;;AALP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QAAA,EAAW,MAAM,CAAA,CAAA,CAAA;;cACpB,OAAO,EAAAC,OAAA,CACjB,CAAqC,KADb,KAAA;gBACxBL,UAAqC,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAArCM,UAAqC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;AAEnB,cAAA,CAAA,IAAA,CAAA,MAAM,CAAC,KAAK;;0BAAG,OAAK;AACnC,oBAAA,EAAA,EAAAD,OAAA,CAAA,CADqC,KAAK,KAAA;sBAC1CL,UAAmC,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,EAAnCM,UAAmC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -28,6 +28,9 @@ import __sfc_main from './CnTreeNode.vue.js';
|
|
|
28
28
|
* Slots:
|
|
29
29
|
* - `#actions` — inline per-row actions (e.g. edit / delete
|
|
30
30
|
* buttons). Scope: `{ node, depth }`.
|
|
31
|
+
* - `#label` — the label of every row, for an icon, a marker or a test id
|
|
32
|
+
* next to the text. Scope: `{ node, depth, expanded }`. Unused, the row
|
|
33
|
+
* shows `node[labelKey]`.
|
|
31
34
|
*/
|
|
32
35
|
var script = {
|
|
33
36
|
name: 'CnTreeView',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTreeView.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["CnTreeNode"],"mappings":";;AA2CA;;;;AAIC;;;;;AAKA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;CAClB,UAAU,EAAE,cAAEA,UAAS,EAAG;AAC1B,CAAA,KAAK,EAAE;AACN;AACC;AACA;AACA;;AAEA;;;;;AAKA;AACA;;AAED,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAA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AA,UAAU,CAAC,IAAI,EAAE;;AAEhB;;AAEC;;;GAGD,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA;AACjD;AACC;AACA;;;GAGD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAA;GACzB;;AAED;AACC;AACA;;;EAGD,SAAS,GAAG;GACX,MAAM,GAAE,GAAI,GAAC;AACb,GAAA,MAAM,IAAG,GAAI,CAAC,CAAC,KAAK;IACnB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA;IACtB,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,EAAA;AAC7B,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;AACtB,KAAA,EAAE,CAAC,OAAO,CAAC,IAAI,EAAA;AAChB,KAAA;AACD,KAAA;GACA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAA;;;;;AAK3B;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAA;GACrC;;AAED;AACC;AACA;;;EAGD,WAAW,GAAG;;;;;AAKb;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,EAAA;GACpC;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnTreeView.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["CnTreeNode"],"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import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, withCtx, renderSlot, mergeProps } from 'vue';
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, createSlots, withCtx, renderSlot, mergeProps } from 'vue';
|
|
2
2
|
|
|
3
3
|
const _hoisted_1 = {
|
|
4
4
|
class: "cn-tree-view",
|
|
@@ -58,12 +58,22 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
58
58
|
collapseLabel: $props.collapseLabel,
|
|
59
59
|
onToggle: $options.toggleNode,
|
|
60
60
|
onSelect: $options.selectNode
|
|
61
|
-
}, {
|
|
61
|
+
}, createSlots({
|
|
62
62
|
actions: withCtx((scope) => [
|
|
63
63
|
renderSlot(_ctx.$slots, "actions", mergeProps({ ref_for: true }, scope))
|
|
64
64
|
]),
|
|
65
|
-
_:
|
|
66
|
-
},
|
|
65
|
+
_: 2 /* DYNAMIC */
|
|
66
|
+
}, [
|
|
67
|
+
(_ctx.$slots.label)
|
|
68
|
+
? {
|
|
69
|
+
name: "label",
|
|
70
|
+
fn: withCtx((scope) => [
|
|
71
|
+
renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, scope))
|
|
72
|
+
]),
|
|
73
|
+
key: "0"
|
|
74
|
+
}
|
|
75
|
+
: undefined
|
|
76
|
+
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "indent", "expandedIds", "selectedId", "idKey", "labelKey", "childrenKey", "expandLabel", "collapseLabel", "onToggle", "onSelect"]))
|
|
67
77
|
}), 128 /* KEYED_FRAGMENT */))
|
|
68
78
|
]))
|
|
69
79
|
]))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTreeView.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue?vue&type=template&id=228491ad&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList","_createBlock","_withCtx","_renderSlot","_mergeProps"],"mappings":";;;AACM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AE,QAAW,CAAA,WAAA;AACxB,cAAA,UAAU,EAAE,MAAU,CAAA,UAAA;AACtB,cAAA,KAAK,EAAE,MAAK,CAAA,KAAA;AACZ,cAAA,QAAQ,EAAE,MAAQ,CAAA,QAAA;AAClB,cAAA,WAAW,EAAE,MAAW,CAAA,WAAA;AACxB,cAAA,WAAW,EAAE,MAAW,CAAA,WAAA;AACxB,cAAA,aAAa,EAAE,MAAa,CAAA,aAAA;AAC5B,cAAA,QAAM,EAAE,QAAU,CAAA,UAAA;AAClB,cAAA,QAAM,EAAE,QAAU,CAAA,UAAA;;cACR,OAAO,EAAAC,OAAA,CAGjB,CAAqC,KAHb,KAAA;gBAGxBC,UAAqC,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAArCC,UAAqC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnTreeView.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue?vue&type=template&id=23ded820&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button. */\n\t\texpandLabel: { type: String, default: 'Expand' },\n\t\t/** A11y label for the collapse button. */\n\t\tcollapseLabel: { type: String, default: 'Collapse' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList","_createBlock","_withCtx","_renderSlot","_mergeProps"],"mappings":";;;AACM,EAAA,KAAK,EAAC,cAAe;AAAA,EAAA,aAAW,EAAC,cAAc;;;;AACf,EAAA,KAAK,EAAC,sBAAsB;;;;AAC9C,EAAA,KAAK,EAAC,qBAAqB;;;;AAGtB,EAAA,KAAK,EAAC,2BAA2B;;;;AAKvB,EAAA,KAAK,EAAC,qBAAqB;;;;AAIjD,E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EAAE,MAAW,CAAA,WAAA;AACxB,cAAA,aAAa,EAAE,MAAa,CAAA,aAAA;AAC5B,cAAA,QAAM,EAAE,QAAU,CAAA,UAAA;AAClB,cAAA,QAAM,EAAE,QAAU,CAAA,UAAA;;cACR,OAAO,EAAAC,OAAA,CAGjB,CAAqC,KAHb,KAAA;gBAGxBC,UAAqC,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAArCC,UAAqC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;AAEnB,cAAA,CAAA,IAAA,CAAA,MAAM,CAAC,KAAK;;0BAAG,OAAK;AAInC,oBAAA,EAAA,EAAAF,OAAA,CAAA,CAJqC,KAAK,KAAA;sBAI1CC,UAAmC,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,EAAnCC,UAAmC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnConfirmDialog.vue2.js';
|
|
|
2
2
|
import { render } from './CnConfirmDialog.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-3a1ca778";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|