@conduction/nextcloud-vue 2.169.0 → 2.171.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/CnCellRenderer/CnCellRenderer.vue.js +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +7 -2
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.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/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js +88 -0
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js +4 -3
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +46 -3
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +2 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/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 +9 -3
- 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/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/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/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +13 -6
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.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/integrations/builtin/contacts/CnContactsTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/contacts/CnContactsTab.vue2.js +14 -3
- package/dist/esm/integrations/builtin/contacts/CnContactsTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/contacts/CnContactsTab.vue3.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 +874 -496
- package/dist/esm/utils/noteThreads.js +14 -2
- package/dist/esm/utils/noteThreads.js.map +1 -1
- package/dist/esm/utils/objectParties.js +50 -5
- package/dist/esm/utils/objectParties.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +11549 -10100
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +874 -496
- 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/CnCellRenderer/CnCellRenderer.vue +7 -2
- 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/CnDashboardGrid/CnDashboardGrid.md +1 -0
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +100 -2
- package/src/components/CnDashboardPage/CnDashboardPage.vue +47 -3
- package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +9 -9
- package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
- package/src/components/CnDialogActions/index.js +7 -0
- 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/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +14 -5
- 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/dialog.css +7 -5
- package/src/css/look-board-detail.css +120 -1
- package/src/css/look-board-index.css +21 -2
- package/src/css/look-board.css +55 -2
- package/src/dialogs/CnConfirmDialog.vue +3 -1
- package/src/index.js +3 -0
- package/src/integrations/builtin/contacts/CnContactsTab.vue +14 -3
- package/src/integrations/builtin/contacts/__tests__/CnContactsTabBoardRows.spec.js +17 -2
- package/src/utils/noteThreads.js +13 -1
- package/src/utils/objectParties.js +49 -4
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
|
@@ -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","_with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AG,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,EAAE,MAAM,IAAI;AACzC;;;;AAIC;;;AAGD,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AAC/C;;;AAGC;AACA;;;EAGD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM;AACrD;AACA,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,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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"],"mappings":";;AAiDA;;;;AAIC;;;;;AAKA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;AAKD,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;CAClB,UAAU,EAAE,cAAEA,UAAS,EAAG;AAC1B,CAAA,KAAK,EAAE;AACN;AACC;AACA;AACA;;AAEA;;;;;AAKA;AACA;;AAED,EA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BAAqB,EAAE,IAAI,EAAA;GACtC;;AAED;;AAEC;;;;AAID,EAAA,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,4 +1,4 @@
|
|
|
1
|
-
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,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,EAAA,KAAK,EAAC,oBAAmB;AAAE,EAAA,IAAI,EAAC,MAAM;;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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,EAAA,KAAK,EAAC,oBAAmB;AAAE,EAAA,IAAI,EAAC,MAAM;;;;;;AAdlD,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,CA0CK,OA1CL,UA0CK,EAAA;AAzCU,IAAA,CAAA,MAAA,CAAA,KAAI,IAAK,MAAW,CAAA,WAAA;AAAlC,SAAAD,SAAA,EAAA,EAAAC,kBAAA,CAOQ,UAPR,UAOQ,EAAA;WANG,M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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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnConfirmDialog.vue2.js","sources":["../../../src/dialogs/CnConfirmDialog.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:look=\"look\"\n\t\t:width=\"width\"\n\t\tdefaultWidth=\"confirm\"\n\t\t:eyebrow=\"eyebrow\"\n\t\t:subtitle=\"subtitle\"\n\t\t:name=\"dialogTitle\"\n\t\tsize=\"small\"\n\t\t:noClose=\"loading\"\n\t\t@closing=\"$emit('close')\">\n\t\t<!-- Result phase -->\n\t\t<div v-if=\"result !== null\"\n\t\t\tclass=\"cn-confirm__result\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"result\">\n\t\t\t<NcNoteCard v-if=\"result.success\" type=\"success\">\n\t\t\t\t{{ successText }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard v-if=\"result.error\" type=\"error\">\n\t\t\t\t{{ result.error }}\n\t\t\t</NcNoteCard>\n\t\t</div>\n\n\t\t<!-- Confirm phase -->\n\t\t<div v-else\n\t\t\tclass=\"cn-confirm__confirm\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"confirm\">\n\t\t\t<p v-if=\"isBoardLook\"\n\t\t\t\tclass=\"cn-dialog__sentence\"\n\t\t\t\tdata-testid=\"cn-confirm-sentence\">\n\t\t\t\t{{ message }}\n\t\t\t</p>\n\t\t\t<NcNoteCard v-else :type=\"variant === 'error' ? 'warning' : 'info'\">\n\t\t\t\t{{ message }}\n\t\t\t</NcNoteCard>\n\t\t\t<CnConfirmValueField v-if=\"confirmValue !== ''\"\n\t\t\t\tv-model=\"typedConfirmValue\"\n\t\t\t\t:value=\"confirmValue\"\n\t\t\t\t:label=\"confirmFieldLabel\" />\n\t\t</div>\n\n\t\t<template #actions>\n\t\t\t<NcButton @click=\"$emit('close')\">\n\t\t\t\t{{ result !== null ? closeLabel : cancelLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"result === null\"\n\t\t\t\t:variant=\"variant\"\n\t\t\t\t:class=\"{ 'cn-dialog__confirm-pending': confirmValuePending }\"\n\t\t\t\t:disabled=\"loading || confirmValuePending\"\n\t\t\t\t:aria-disabled=\"confirmValuePending ? 'true' : undefined\"\n\t\t\t\tdata-testid=\"cn-confirm-dialog-confirm\"\n\t\t\t\t@click=\"executeConfirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!--\n\t\t\t\t\t\t`name` is REQUIRED for accessibility, not decoration.\n\t\t\t\t\t\tNcLoadingIcon always renders `role=\"img\"`, and without a\n\t\t\t\t\t\t`name` it emits `aria-label=\"\"` — a role=\"img\" with no\n\t\t\t\t\t\taccessible name, which fails WCAG 1.1.1 / 4.1.2 (axe\n\t\t\t\t\t\t`role-img-alt`). The spinner is also the ONLY thing that\n\t\t\t\t\t\tannounces the in-flight state here: the button is\n\t\t\t\t\t\t`:disabled` while loading and its visible text does not\n\t\t\t\t\t\tchange, so a screen-reader user otherwise gets no signal\n\t\t\t\t\t\tthat the confirm is running.\n\t\t\t\t\t-->\n\t\t\t\t\t<NcLoadingIcon\n\t\t\t\t\t\tv-if=\"loading\"\n\t\t\t\t\t\t:size=\"20\"\n\t\t\t\t\t\t:name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t\t\t\t<CnIcon v-else-if=\"confirmIcon\" :name=\"confirmIcon\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ confirmLabel }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'\nimport CnConfirmValueField from '../components/CnConfirmValueField/CnConfirmValueField.vue'\nimport CnDialog from '../components/CnDialog/CnDialog.vue'\nimport { CnIcon } from '../components/CnIcon/index.js'\nimport { confirmValueMixin } from '../mixins/confirmValue.js'\nimport { dialogBoardMixin } from '../mixins/dialogBoard.js'\n\n/**\n * CnConfirmDialog — generic, verb-agnostic confirmation dialog.\n *\n * Two-phase UI (confirm → result), same pattern as `CnDeleteDialog` but\n * with no delete-specific copy or store coupling: the dialog does NOT\n * perform the confirmed operation itself — it emits a `confirm` event and\n * the parent performs the actual call, then reports back via `setResult()`\n * on a ref. Used by `CnWidgetObjectTable` to confirm-gate declarative\n * `object-op` actions (delete always; patch/create on `confirm: true`),\n * and reusable for any confirm→do→report flow.\n *\n * Destructive operations pass `variant=\"error\"` so the primary button and\n * note-card styling read as destructive.\n *\n * ```vue\n * <CnConfirmDialog\n * v-if=\"showConfirm\"\n * ref=\"confirmDialog\"\n * :dialog-title=\"t('myapp', 'Accept request')\"\n * :message=\"t('myapp', 'Accept this request?')\"\n * @confirm=\"onConfirm\"\n * @close=\"showConfirm = false\" />\n * ```\n *\n * // In methods:\n * async onConfirm() {\n * const ok = await doTheThing()\n * this.$refs.confirmDialog.setResult(ok ? { success: true } : { error: 'It failed' })\n * }\n */\nexport default {\n\tname: 'CnConfirmDialog',\n\n\tcomponents: {\n\t\tCnDialog,\n\t\tCnIcon,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcLoadingIcon,\n\t\tCnConfirmValueField,\n\t},\n\n\tmixins: [dialogBoardMixin, confirmValueMixin],\n\n\tprops: {\n\t\t/** Dialog title shown in the NcDialog header. */\n\t\tdialogTitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm action'),\n\t\t},\n\n\t\t/** Confirmation question shown in the confirm phase's note card. */\n\t\tmessage: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Are you sure you want to continue?'),\n\t\t},\n\n\t\t/**\n\t\t * Visual variant of the primary confirm button. Use `error` for\n\t\t * destructive operations (delete) — the confirm-phase note card then\n\t\t * renders as a warning instead of an info note.\n\t\t */\n\t\tvariant: {\n\t\t\ttype: String,\n\t\t\tdefault: 'primary',\n\t\t\tvalidator: (v) => ['primary', 'error', 'warning', 'success'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * A CnIcon name drawn on the primary button, e.g. `DeleteOutline` for a\n\t\t * delete (board DqFilterVerwijderen). Empty draws none.\n\t\t */\n\t\tconfirmIcon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Label of the primary button that fires the `confirm` event. */\n\t\tconfirmLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm'),\n\t\t},\n\n\t\t/** Label of the cancel button (visible during the confirm phase). */\n\t\tcancelLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Cancel'),\n\t\t},\n\n\t\t/** Label of the close button (visible during the result phase). */\n\t\tcloseLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Close'),\n\t\t},\n\n\t\t/** Success message shown in the result phase after `setResult({ success: true })`. */\n\t\tsuccessText: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Done.'),\n\t\t},\n\t},\n\n\temits: ['close', 'confirm'],\n\n\tdata() {\n\t\treturn {\n\t\t\t/** True between the confirm click and the parent's setResult() call. */\n\t\t\tloading: false,\n\t\t\t/** @type {{ success?: boolean, error?: string }|null} Result phase payload (null = confirm phase). */\n\t\t\tresult: null,\n\t\t\t/** Auto-close timer handle for the success result phase. */\n\t\t\tcloseTimeout: null,\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.closeTimeout) {\n\t\t\tclearTimeout(this.closeTimeout)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t// Exposed to the template for the loading spinner's accessible name —\n\t\t// the same `methods: { t }` pattern the other dialogs in this folder\n\t\t// use (e.g. CnEditPagesModal). The prop defaults above call `t()`\n\t\t// directly at module scope, which the template cannot do.\n\t\tt,\n\t\t/**\n\t\t * Primary-button click: enter the loading state and hand control to\n\t\t * the parent, which performs the confirmed operation.\n\t\t */\n\t\texecuteConfirm() {\n\t\t\tif (!this.confirmValueMatches) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\t/**\n\t\t\t * @event confirm Emitted when the user confirms. The parent performs\n\t\t\t * the actual operation and reports back via `setResult()`.\n\t\t\t */\n\t\t\tthis.$emit('confirm')\n\t\t},\n\n\t\t/**\n\t\t * Report the confirmed operation's outcome. Call this from the parent\n\t\t * after the operation completes; flips the dialog into its result\n\t\t * phase. A success auto-closes after 2 seconds.\n\t\t *\n\t\t * @param {{ success?: boolean, error?: string }} resultData The outcome to display.\n\t\t * @public\n\t\t */\n\t\tsetResult(resultData) {\n\t\t\tthis.loading = false\n\t\t\tthis.result = resultData\n\t\t\tif (resultData && resultData.success) {\n\t\t\t\tthis.closeTimeout = setTimeout(() => {\n\t\t\t\t\t/**\n\t\t\t\t\t * @event close Emitted when the dialog should close (cancel,\n\t\t\t\t\t * close button, or auto-close 2s after a success result).\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('close')\n\t\t\t\t}, 2000)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-confirm__confirm {\n\tpadding: 4px 0;\n}\n</style>\n"],"names":["CnDialog","CnIcon","CnConfirmValueField","t"],"mappings":";;;;;;;;AA8FA;;AAEC;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;;AAGD,aAAe;CACd,IAAI,EAAE,iBAAiB;;CAEvB,UAAU,EAAE;AACX,YAAAA,UAAQ;AACR,UAAAC,YAAM;AACN,EAAA,QAAQ;EACR,UAAU;EACV,aAAa;AACb,uBAAAC,YAAmB;EACnB;;AAED,CAAA,MAAM,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;;AAE7C,CAAA,KAAK,EAAE;AACN;EACA,WAAW,EAAE;GACZ,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,MAAMC,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;GACnD;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,MAAMA,SAAC,CAAC,eAAe,EAAE,oCAAoC,CAAC;GACvE;;AAED;;;AAGC;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,SAAS;AAClB,GAAA,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;GACxE;;AAED;;;;EAIA,WAAW,EAAE;GACZ,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;;EAGD,YAAY,EAAE;GACb,IAAI,EAAE,MAAM;AACZ,GA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Aa,GAAE,UAAU,CAAC,MAAM;AACpC;;;;AAIA,KAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAA;AACnB,KAAC,EAAE,IAAI,EAAA;AACR,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnConfirmDialog.vue2.js","sources":["../../../src/dialogs/CnConfirmDialog.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:look=\"look\"\n\t\t:width=\"width\"\n\t\tdefaultWidth=\"confirm\"\n\t\t:eyebrow=\"eyebrow\"\n\t\t:subtitle=\"subtitle\"\n\t\t:name=\"dialogTitle\"\n\t\tsize=\"small\"\n\t\t:noClose=\"loading\"\n\t\t@closing=\"$emit('close')\">\n\t\t<!-- Result phase -->\n\t\t<div v-if=\"result !== null\"\n\t\t\tclass=\"cn-confirm__result\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"result\">\n\t\t\t<NcNoteCard v-if=\"result.success\" type=\"success\">\n\t\t\t\t{{ successText }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard v-if=\"result.error\" type=\"error\">\n\t\t\t\t{{ result.error }}\n\t\t\t</NcNoteCard>\n\t\t</div>\n\n\t\t<!-- Confirm phase -->\n\t\t<div v-else\n\t\t\tclass=\"cn-confirm__confirm\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"confirm\">\n\t\t\t<p v-if=\"isBoardLook\"\n\t\t\t\tclass=\"cn-dialog__sentence\"\n\t\t\t\tdata-testid=\"cn-confirm-sentence\">\n\t\t\t\t{{ message }}\n\t\t\t</p>\n\t\t\t<NcNoteCard v-else :type=\"variant === 'error' ? 'warning' : 'info'\">\n\t\t\t\t{{ message }}\n\t\t\t</NcNoteCard>\n\t\t\t<!-- @slot default Extra body content below the message in the confirm phase, such as a checkbox, a list or a note. -->\n\t\t\t<slot />\n\t\t\t<CnConfirmValueField v-if=\"confirmValue !== ''\"\n\t\t\t\tv-model=\"typedConfirmValue\"\n\t\t\t\t:value=\"confirmValue\"\n\t\t\t\t:label=\"confirmFieldLabel\" />\n\t\t</div>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"loading\" @click=\"$emit('close')\">\n\t\t\t\t{{ result !== null ? closeLabel : cancelLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"result === null\"\n\t\t\t\t:variant=\"variant\"\n\t\t\t\t:class=\"{ 'cn-dialog__confirm-pending': confirmValuePending }\"\n\t\t\t\t:disabled=\"loading || confirmValuePending\"\n\t\t\t\t:aria-disabled=\"confirmValuePending ? 'true' : undefined\"\n\t\t\t\tdata-testid=\"cn-confirm-dialog-confirm\"\n\t\t\t\t@click=\"executeConfirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!--\n\t\t\t\t\t\t`name` is REQUIRED for accessibility, not decoration.\n\t\t\t\t\t\tNcLoadingIcon always renders `role=\"img\"`, and without a\n\t\t\t\t\t\t`name` it emits `aria-label=\"\"` — a role=\"img\" with no\n\t\t\t\t\t\taccessible name, which fails WCAG 1.1.1 / 4.1.2 (axe\n\t\t\t\t\t\t`role-img-alt`). The spinner is also the ONLY thing that\n\t\t\t\t\t\tannounces the in-flight state here: the button is\n\t\t\t\t\t\t`:disabled` while loading and its visible text does not\n\t\t\t\t\t\tchange, so a screen-reader user otherwise gets no signal\n\t\t\t\t\t\tthat the confirm is running.\n\t\t\t\t\t-->\n\t\t\t\t\t<NcLoadingIcon\n\t\t\t\t\t\tv-if=\"loading\"\n\t\t\t\t\t\t:size=\"20\"\n\t\t\t\t\t\t:name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t\t\t\t<CnIcon v-else-if=\"confirmIcon\" :name=\"confirmIcon\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ confirmLabel }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'\nimport CnConfirmValueField from '../components/CnConfirmValueField/CnConfirmValueField.vue'\nimport CnDialog from '../components/CnDialog/CnDialog.vue'\nimport { CnIcon } from '../components/CnIcon/index.js'\nimport { confirmValueMixin } from '../mixins/confirmValue.js'\nimport { dialogBoardMixin } from '../mixins/dialogBoard.js'\n\n/**\n * CnConfirmDialog — generic, verb-agnostic confirmation dialog.\n *\n * Two-phase UI (confirm → result), same pattern as `CnDeleteDialog` but\n * with no delete-specific copy or store coupling: the dialog does NOT\n * perform the confirmed operation itself — it emits a `confirm` event and\n * the parent performs the actual call, then reports back via `setResult()`\n * on a ref. Used by `CnWidgetObjectTable` to confirm-gate declarative\n * `object-op` actions (delete always; patch/create on `confirm: true`),\n * and reusable for any confirm→do→report flow.\n *\n * Destructive operations pass `variant=\"error\"` so the primary button and\n * note-card styling read as destructive.\n *\n * ```vue\n * <CnConfirmDialog\n * v-if=\"showConfirm\"\n * ref=\"confirmDialog\"\n * :dialog-title=\"t('myapp', 'Accept request')\"\n * :message=\"t('myapp', 'Accept this request?')\"\n * @confirm=\"onConfirm\"\n * @close=\"showConfirm = false\" />\n * ```\n *\n * // In methods:\n * async onConfirm() {\n * const ok = await doTheThing()\n * this.$refs.confirmDialog.setResult(ok ? { success: true } : { error: 'It failed' })\n * }\n */\nexport default {\n\tname: 'CnConfirmDialog',\n\n\tcomponents: {\n\t\tCnDialog,\n\t\tCnIcon,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcLoadingIcon,\n\t\tCnConfirmValueField,\n\t},\n\n\tmixins: [dialogBoardMixin, confirmValueMixin],\n\n\tprops: {\n\t\t/** Dialog title shown in the NcDialog header. */\n\t\tdialogTitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm action'),\n\t\t},\n\n\t\t/** Confirmation question shown in the confirm phase's note card. */\n\t\tmessage: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Are you sure you want to continue?'),\n\t\t},\n\n\t\t/**\n\t\t * Visual variant of the primary confirm button. Use `error` for\n\t\t * destructive operations (delete) — the confirm-phase note card then\n\t\t * renders as a warning instead of an info note.\n\t\t */\n\t\tvariant: {\n\t\t\ttype: String,\n\t\t\tdefault: 'primary',\n\t\t\tvalidator: (v) => ['primary', 'error', 'warning', 'success'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * A CnIcon name drawn on the primary button, e.g. `DeleteOutline` for a\n\t\t * delete (board DqFilterVerwijderen). Empty draws none.\n\t\t */\n\t\tconfirmIcon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Label of the primary button that fires the `confirm` event. */\n\t\tconfirmLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm'),\n\t\t},\n\n\t\t/** Label of the cancel button (visible during the confirm phase). */\n\t\tcancelLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Cancel'),\n\t\t},\n\n\t\t/** Label of the close button (visible during the result phase). */\n\t\tcloseLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Close'),\n\t\t},\n\n\t\t/** Success message shown in the result phase after `setResult({ success: true })`. */\n\t\tsuccessText: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Done.'),\n\t\t},\n\t},\n\n\temits: ['close', 'confirm'],\n\n\tdata() {\n\t\treturn {\n\t\t\t/** True between the confirm click and the parent's setResult() call. */\n\t\t\tloading: false,\n\t\t\t/** @type {{ success?: boolean, error?: string }|null} Result phase payload (null = confirm phase). */\n\t\t\tresult: null,\n\t\t\t/** Auto-close timer handle for the success result phase. */\n\t\t\tcloseTimeout: null,\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.closeTimeout) {\n\t\t\tclearTimeout(this.closeTimeout)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t// Exposed to the template for the loading spinner's accessible name —\n\t\t// the same `methods: { t }` pattern the other dialogs in this folder\n\t\t// use (e.g. CnEditPagesModal). The prop defaults above call `t()`\n\t\t// directly at module scope, which the template cannot do.\n\t\tt,\n\t\t/**\n\t\t * Primary-button click: enter the loading state and hand control to\n\t\t * the parent, which performs the confirmed operation.\n\t\t */\n\t\texecuteConfirm() {\n\t\t\tif (!this.confirmValueMatches) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\t/**\n\t\t\t * @event confirm Emitted when the user confirms. The parent performs\n\t\t\t * the actual operation and reports back via `setResult()`.\n\t\t\t */\n\t\t\tthis.$emit('confirm')\n\t\t},\n\n\t\t/**\n\t\t * Report the confirmed operation's outcome. Call this from the parent\n\t\t * after the operation completes; flips the dialog into its result\n\t\t * phase. A success auto-closes after 2 seconds.\n\t\t *\n\t\t * @param {{ success?: boolean, error?: string }} resultData The outcome to display.\n\t\t * @public\n\t\t */\n\t\tsetResult(resultData) {\n\t\t\tthis.loading = false\n\t\t\tthis.result = resultData\n\t\t\tif (resultData && resultData.success) {\n\t\t\t\tthis.closeTimeout = setTimeout(() => {\n\t\t\t\t\t/**\n\t\t\t\t\t * @event close Emitted when the dialog should close (cancel,\n\t\t\t\t\t * close button, or auto-close 2s after a success result).\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('close')\n\t\t\t\t}, 2000)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-confirm__confirm {\n\tpadding: 4px 0;\n}\n</style>\n"],"names":["CnDialog","CnIcon","CnConfirmValueField","t"],"mappings":";;;;;;;;AAgGA;;AAEC;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAC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,MAAMA,SAAC,CAAC,eAAe,EAAE,OAAO,CAAC;GAC1C;EACD;;CAED,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;;AAE3B,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;;GAEN,OAAO,EAAE,KAAK;AACd;GACA,MAAM,EAAE,IAAI;;AAEZ,GAAA,YAAY,EAAE,IAAI;AACnB,GAAA;EACA;;AAED,CAAA,aAAa,GAAG;AACf,EAAA,IAAI,IAAI,CAAC,YAAY,EAAE;AACtB,GAAA,YAAY,CAAC,IAAI,CAAC,YAAY,EAAA;AAC/B,GAAA;EACA;;AAED,CAAA,OAAO,EAAE;;;;;KAKRA,SAAC;AACD;;AAEC;;AAED,EAAA,cAAc,GAAG;GAChB,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;IAC9B,MAAK;AACN,IAAA;AACA,GAAA,IAAI,CAAC,OAAM,GAAI,KAAG;AAClB;;;;AAIA,GAAA,IAAI,CAAC,KAAK,CAAC,SAAS,EAAA;GACpB;;AAED;;;AAGC;AACA;AACA;AACA;;AAED,EAAA,SAAS,CAAC,UAAU,EAAE;AACrB,GAAA,IAAI,CAAC,OAAQ,GAAE,MAAI;AACnB,GAAA,IAAI,CAAC,SAAS,WAAS;AACvB,GAAA,IAAI,UAAW,IAAG,UAAU,CAAC,OAAO,EAAE;AACrC,IAAA,IAAI,CAAC,YAAa,GAAE,UAAU,CAAC,MAAM;AACpC;;;;AAIA,KAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAA;AACnB,KAAC,EAAE,IAAI,EAAA;AACR,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, toDisplayString, normalizeClass, createCommentVNode, createElementBlock } from 'vue';
|
|
1
|
+
import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, toDisplayString, normalizeClass, createCommentVNode, createElementBlock, renderSlot } from 'vue';
|
|
2
2
|
|
|
3
3
|
const _hoisted_1 = {
|
|
4
4
|
key: 0,
|
|
@@ -41,13 +41,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41
41
|
}, {
|
|
42
42
|
actions: withCtx(() => [
|
|
43
43
|
createVNode(_component_NcButton, {
|
|
44
|
+
disabled: $data.loading,
|
|
44
45
|
onClick: _cache[1] || (_cache[1] = $event => (_ctx.$emit('close')))
|
|
45
46
|
}, {
|
|
46
47
|
default: withCtx(() => [
|
|
47
48
|
createTextVNode(toDisplayString($data.result !== null ? $props.closeLabel : $props.cancelLabel), 1 /* TEXT */)
|
|
48
49
|
]),
|
|
49
50
|
_: 1 /* STABLE */
|
|
50
|
-
}),
|
|
51
|
+
}, 8 /* PROPS */, ["disabled"]),
|
|
51
52
|
($data.result === null)
|
|
52
53
|
? (openBlock(), createBlock(_component_NcButton, {
|
|
53
54
|
key: 0,
|
|
@@ -118,6 +119,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
118
119
|
]),
|
|
119
120
|
_: 1 /* STABLE */
|
|
120
121
|
}, 8 /* PROPS */, ["type"])),
|
|
122
|
+
renderSlot(_ctx.$slots, "default"),
|
|
121
123
|
(_ctx.confirmValue !== '')
|
|
122
124
|
? (openBlock(), createBlock(_component_CnConfirmValueField, {
|
|
123
125
|
key: 2,
|
|
@@ -129,7 +131,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
129
131
|
: createCommentVNode("v-if", true)
|
|
130
132
|
]))
|
|
131
133
|
]),
|
|
132
|
-
_:
|
|
134
|
+
_: 3 /* FORWARDED */
|
|
133
135
|
}, 8 /* PROPS */, ["look", "width", "eyebrow", "subtitle", "name", "noClose"]))
|
|
134
136
|
}
|
|
135
137
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnConfirmDialog.vue3.js","sources":["../../../src/dialogs/CnConfirmDialog.vue?vue&type=template&id=3452fd7a&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:look=\"look\"\n\t\t:width=\"width\"\n\t\tdefaultWidth=\"confirm\"\n\t\t:eyebrow=\"eyebrow\"\n\t\t:subtitle=\"subtitle\"\n\t\t:name=\"dialogTitle\"\n\t\tsize=\"small\"\n\t\t:noClose=\"loading\"\n\t\t@closing=\"$emit('close')\">\n\t\t<!-- Result phase -->\n\t\t<div v-if=\"result !== null\"\n\t\t\tclass=\"cn-confirm__result\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"result\">\n\t\t\t<NcNoteCard v-if=\"result.success\" type=\"success\">\n\t\t\t\t{{ successText }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard v-if=\"result.error\" type=\"error\">\n\t\t\t\t{{ result.error }}\n\t\t\t</NcNoteCard>\n\t\t</div>\n\n\t\t<!-- Confirm phase -->\n\t\t<div v-else\n\t\t\tclass=\"cn-confirm__confirm\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"confirm\">\n\t\t\t<p v-if=\"isBoardLook\"\n\t\t\t\tclass=\"cn-dialog__sentence\"\n\t\t\t\tdata-testid=\"cn-confirm-sentence\">\n\t\t\t\t{{ message }}\n\t\t\t</p>\n\t\t\t<NcNoteCard v-else :type=\"variant === 'error' ? 'warning' : 'info'\">\n\t\t\t\t{{ message }}\n\t\t\t</NcNoteCard>\n\t\t\t<CnConfirmValueField v-if=\"confirmValue !== ''\"\n\t\t\t\tv-model=\"typedConfirmValue\"\n\t\t\t\t:value=\"confirmValue\"\n\t\t\t\t:label=\"confirmFieldLabel\" />\n\t\t</div>\n\n\t\t<template #actions>\n\t\t\t<NcButton @click=\"$emit('close')\">\n\t\t\t\t{{ result !== null ? closeLabel : cancelLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"result === null\"\n\t\t\t\t:variant=\"variant\"\n\t\t\t\t:class=\"{ 'cn-dialog__confirm-pending': confirmValuePending }\"\n\t\t\t\t:disabled=\"loading || confirmValuePending\"\n\t\t\t\t:aria-disabled=\"confirmValuePending ? 'true' : undefined\"\n\t\t\t\tdata-testid=\"cn-confirm-dialog-confirm\"\n\t\t\t\t@click=\"executeConfirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!--\n\t\t\t\t\t\t`name` is REQUIRED for accessibility, not decoration.\n\t\t\t\t\t\tNcLoadingIcon always renders `role=\"img\"`, and without a\n\t\t\t\t\t\t`name` it emits `aria-label=\"\"` — a role=\"img\" with no\n\t\t\t\t\t\taccessible name, which fails WCAG 1.1.1 / 4.1.2 (axe\n\t\t\t\t\t\t`role-img-alt`). The spinner is also the ONLY thing that\n\t\t\t\t\t\tannounces the in-flight state here: the button is\n\t\t\t\t\t\t`:disabled` while loading and its visible text does not\n\t\t\t\t\t\tchange, so a screen-reader user otherwise gets no signal\n\t\t\t\t\t\tthat the confirm is running.\n\t\t\t\t\t-->\n\t\t\t\t\t<NcLoadingIcon\n\t\t\t\t\t\tv-if=\"loading\"\n\t\t\t\t\t\t:size=\"20\"\n\t\t\t\t\t\t:name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t\t\t\t<CnIcon v-else-if=\"confirmIcon\" :name=\"confirmIcon\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ confirmLabel }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'\nimport CnConfirmValueField from '../components/CnConfirmValueField/CnConfirmValueField.vue'\nimport CnDialog from '../components/CnDialog/CnDialog.vue'\nimport { CnIcon } from '../components/CnIcon/index.js'\nimport { confirmValueMixin } from '../mixins/confirmValue.js'\nimport { dialogBoardMixin } from '../mixins/dialogBoard.js'\n\n/**\n * CnConfirmDialog — generic, verb-agnostic confirmation dialog.\n *\n * Two-phase UI (confirm → result), same pattern as `CnDeleteDialog` but\n * with no delete-specific copy or store coupling: the dialog does NOT\n * perform the confirmed operation itself — it emits a `confirm` event and\n * the parent performs the actual call, then reports back via `setResult()`\n * on a ref. Used by `CnWidgetObjectTable` to confirm-gate declarative\n * `object-op` actions (delete always; patch/create on `confirm: true`),\n * and reusable for any confirm→do→report flow.\n *\n * Destructive operations pass `variant=\"error\"` so the primary button and\n * note-card styling read as destructive.\n *\n * ```vue\n * <CnConfirmDialog\n * v-if=\"showConfirm\"\n * ref=\"confirmDialog\"\n * :dialog-title=\"t('myapp', 'Accept request')\"\n * :message=\"t('myapp', 'Accept this request?')\"\n * @confirm=\"onConfirm\"\n * @close=\"showConfirm = false\" />\n * ```\n *\n * // In methods:\n * async onConfirm() {\n * const ok = await doTheThing()\n * this.$refs.confirmDialog.setResult(ok ? { success: true } : { error: 'It failed' })\n * }\n */\nexport default {\n\tname: 'CnConfirmDialog',\n\n\tcomponents: {\n\t\tCnDialog,\n\t\tCnIcon,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcLoadingIcon,\n\t\tCnConfirmValueField,\n\t},\n\n\tmixins: [dialogBoardMixin, confirmValueMixin],\n\n\tprops: {\n\t\t/** Dialog title shown in the NcDialog header. */\n\t\tdialogTitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm action'),\n\t\t},\n\n\t\t/** Confirmation question shown in the confirm phase's note card. */\n\t\tmessage: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Are you sure you want to continue?'),\n\t\t},\n\n\t\t/**\n\t\t * Visual variant of the primary confirm button. Use `error` for\n\t\t * destructive operations (delete) — the confirm-phase note card then\n\t\t * renders as a warning instead of an info note.\n\t\t */\n\t\tvariant: {\n\t\t\ttype: String,\n\t\t\tdefault: 'primary',\n\t\t\tvalidator: (v) => ['primary', 'error', 'warning', 'success'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * A CnIcon name drawn on the primary button, e.g. `DeleteOutline` for a\n\t\t * delete (board DqFilterVerwijderen). Empty draws none.\n\t\t */\n\t\tconfirmIcon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Label of the primary button that fires the `confirm` event. */\n\t\tconfirmLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm'),\n\t\t},\n\n\t\t/** Label of the cancel button (visible during the confirm phase). */\n\t\tcancelLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Cancel'),\n\t\t},\n\n\t\t/** Label of the close button (visible during the result phase). */\n\t\tcloseLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Close'),\n\t\t},\n\n\t\t/** Success message shown in the result phase after `setResult({ success: true })`. */\n\t\tsuccessText: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Done.'),\n\t\t},\n\t},\n\n\temits: ['close', 'confirm'],\n\n\tdata() {\n\t\treturn {\n\t\t\t/** True between the confirm click and the parent's setResult() call. */\n\t\t\tloading: false,\n\t\t\t/** @type {{ success?: boolean, error?: string }|null} Result phase payload (null = confirm phase). */\n\t\t\tresult: null,\n\t\t\t/** Auto-close timer handle for the success result phase. */\n\t\t\tcloseTimeout: null,\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.closeTimeout) {\n\t\t\tclearTimeout(this.closeTimeout)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t// Exposed to the template for the loading spinner's accessible name —\n\t\t// the same `methods: { t }` pattern the other dialogs in this folder\n\t\t// use (e.g. CnEditPagesModal). The prop defaults above call `t()`\n\t\t// directly at module scope, which the template cannot do.\n\t\tt,\n\t\t/**\n\t\t * Primary-button click: enter the loading state and hand control to\n\t\t * the parent, which performs the confirmed operation.\n\t\t */\n\t\texecuteConfirm() {\n\t\t\tif (!this.confirmValueMatches) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\t/**\n\t\t\t * @event confirm Emitted when the user confirms. The parent performs\n\t\t\t * the actual operation and reports back via `setResult()`.\n\t\t\t */\n\t\t\tthis.$emit('confirm')\n\t\t},\n\n\t\t/**\n\t\t * Report the confirmed operation's outcome. Call this from the parent\n\t\t * after the operation completes; flips the dialog into its result\n\t\t * phase. A success auto-closes after 2 seconds.\n\t\t *\n\t\t * @param {{ success?: boolean, error?: string }} resultData The outcome to display.\n\t\t * @public\n\t\t */\n\t\tsetResult(resultData) {\n\t\t\tthis.loading = false\n\t\t\tthis.result = resultData\n\t\t\tif (resultData && resultData.success) {\n\t\t\t\tthis.closeTimeout = setTimeout(() => {\n\t\t\t\t\t/**\n\t\t\t\t\t * @event close Emitted when the dialog should close (cancel,\n\t\t\t\t\t * close button, or auto-close 2s after a success result).\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('close')\n\t\t\t\t}, 2000)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-confirm__confirm {\n\tpadding: 4px 0;\n}\n</style>\n"],"names":["_createBlock","_createVNode","_createTextVNode","_toDisplayString","_createElementBlock"],"mappings":";;;;AAqBG,EAAA,KAAK,EAAC,oBAAoB;AACzB,EAAA,aAAU,EAAC,UAAK;AACjB,EAAA,mBAAY,EAAA,mBAAA;AACZ,EAAA,mBAAiB,EAAC,QAAQ;;;;AAW1B,EAAA,KAAK,EAAC,qBAAc;eACT,EAAC,UAAU;AACrB,EAAA,mBAAgB,EAAC,mBAAgB;qBACrB,EAAA,SAAA;;;;AAEZ,EAAA,KAAK,EAAC,qBAAqB;AAC3B,EAAA,aAAW,EAAC,qBAAA;;;;;;;;;;;uBAhCdA;AACC,IAAA,IAAI,EAAE,IAAI,CAAA,IAAA;AACV,IAAA,KAAK,EAAE,IAAK,CAAA,KA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;;;;2BAnDH;OAXK,KAAM,CAAA,MAAA,KAAA,IAAA;2CAWX,iBAAA,EAAA;AANa,YAAA,CAAA,KAAA,CAAA,MAAA,CAAA,OAAA;8BAAjBF,WAEG,CAAA,qBAAA,EAAA;;AAFc,kBAAA,IAAA,EAAA,SAAA;;mCACjB,MAAW;oDAAR,MAAQ,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;;;;;yCAIH,CAAA,qBAAA,EAAA;;;;mCADR,MAAkB;AAAf,oBAAAE,eAAA,CAAAC,eAAA,CAAA,KAAA,CAAA,MAAM,CAAA,KAAM,CAAA,EAAA,CAAA,YAAA;;;;;;2CAsBX,iBAAA,EAAA;aAZF,IAAA,CAAA,WAAA;8BAAHC,kBAII,CAAA,GAAA,EAJJ,UAII,EAAAD,eAAA,CADA,MAAO,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;yCAIE,CAAA,qBAAA,EAAA;;AAFO,kBAAA,IAAI,EAAE,MAAC,CAAA,OAAA,KAAA,OAAA,GAAA,SAAA,GAAA,MAAA;;mCAC1B,MAAa;oDAAV,MAAO,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;;;;aAEP,IAAA,CAAA,YAAA,KAAA,EAAA;8BAAJH,WAG8B,CAAA,8BAAA,EAAA;;;;AAD5B,kBAAA,KAAK,EAAE,IAAQ,CAAA,YAAA;AACf,kBAAA,KAAK,EAAC,IAAkB,CAAA,iBAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnConfirmDialog.vue3.js","sources":["../../../src/dialogs/CnConfirmDialog.vue?vue&type=template&id=3a1ca778&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:look=\"look\"\n\t\t:width=\"width\"\n\t\tdefaultWidth=\"confirm\"\n\t\t:eyebrow=\"eyebrow\"\n\t\t:subtitle=\"subtitle\"\n\t\t:name=\"dialogTitle\"\n\t\tsize=\"small\"\n\t\t:noClose=\"loading\"\n\t\t@closing=\"$emit('close')\">\n\t\t<!-- Result phase -->\n\t\t<div v-if=\"result !== null\"\n\t\t\tclass=\"cn-confirm__result\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"result\">\n\t\t\t<NcNoteCard v-if=\"result.success\" type=\"success\">\n\t\t\t\t{{ successText }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard v-if=\"result.error\" type=\"error\">\n\t\t\t\t{{ result.error }}\n\t\t\t</NcNoteCard>\n\t\t</div>\n\n\t\t<!-- Confirm phase -->\n\t\t<div v-else\n\t\t\tclass=\"cn-confirm__confirm\"\n\t\t\tdata-testid=\"cn-modal\"\n\t\t\tdata-testid-modal=\"cn-confirm-dialog\"\n\t\t\tdata-testid-phase=\"confirm\">\n\t\t\t<p v-if=\"isBoardLook\"\n\t\t\t\tclass=\"cn-dialog__sentence\"\n\t\t\t\tdata-testid=\"cn-confirm-sentence\">\n\t\t\t\t{{ message }}\n\t\t\t</p>\n\t\t\t<NcNoteCard v-else :type=\"variant === 'error' ? 'warning' : 'info'\">\n\t\t\t\t{{ message }}\n\t\t\t</NcNoteCard>\n\t\t\t<!-- @slot default Extra body content below the message in the confirm phase, such as a checkbox, a list or a note. -->\n\t\t\t<slot />\n\t\t\t<CnConfirmValueField v-if=\"confirmValue !== ''\"\n\t\t\t\tv-model=\"typedConfirmValue\"\n\t\t\t\t:value=\"confirmValue\"\n\t\t\t\t:label=\"confirmFieldLabel\" />\n\t\t</div>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"loading\" @click=\"$emit('close')\">\n\t\t\t\t{{ result !== null ? closeLabel : cancelLabel }}\n\t\t\t</NcButton>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"result === null\"\n\t\t\t\t:variant=\"variant\"\n\t\t\t\t:class=\"{ 'cn-dialog__confirm-pending': confirmValuePending }\"\n\t\t\t\t:disabled=\"loading || confirmValuePending\"\n\t\t\t\t:aria-disabled=\"confirmValuePending ? 'true' : undefined\"\n\t\t\t\tdata-testid=\"cn-confirm-dialog-confirm\"\n\t\t\t\t@click=\"executeConfirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<!--\n\t\t\t\t\t\t`name` is REQUIRED for accessibility, not decoration.\n\t\t\t\t\t\tNcLoadingIcon always renders `role=\"img\"`, and without a\n\t\t\t\t\t\t`name` it emits `aria-label=\"\"` — a role=\"img\" with no\n\t\t\t\t\t\taccessible name, which fails WCAG 1.1.1 / 4.1.2 (axe\n\t\t\t\t\t\t`role-img-alt`). The spinner is also the ONLY thing that\n\t\t\t\t\t\tannounces the in-flight state here: the button is\n\t\t\t\t\t\t`:disabled` while loading and its visible text does not\n\t\t\t\t\t\tchange, so a screen-reader user otherwise gets no signal\n\t\t\t\t\t\tthat the confirm is running.\n\t\t\t\t\t-->\n\t\t\t\t\t<NcLoadingIcon\n\t\t\t\t\t\tv-if=\"loading\"\n\t\t\t\t\t\t:size=\"20\"\n\t\t\t\t\t\t:name=\"t('nextcloud-vue', 'Loading …')\" />\n\t\t\t\t\t<CnIcon v-else-if=\"confirmIcon\" :name=\"confirmIcon\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ confirmLabel }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'\nimport CnConfirmValueField from '../components/CnConfirmValueField/CnConfirmValueField.vue'\nimport CnDialog from '../components/CnDialog/CnDialog.vue'\nimport { CnIcon } from '../components/CnIcon/index.js'\nimport { confirmValueMixin } from '../mixins/confirmValue.js'\nimport { dialogBoardMixin } from '../mixins/dialogBoard.js'\n\n/**\n * CnConfirmDialog — generic, verb-agnostic confirmation dialog.\n *\n * Two-phase UI (confirm → result), same pattern as `CnDeleteDialog` but\n * with no delete-specific copy or store coupling: the dialog does NOT\n * perform the confirmed operation itself — it emits a `confirm` event and\n * the parent performs the actual call, then reports back via `setResult()`\n * on a ref. Used by `CnWidgetObjectTable` to confirm-gate declarative\n * `object-op` actions (delete always; patch/create on `confirm: true`),\n * and reusable for any confirm→do→report flow.\n *\n * Destructive operations pass `variant=\"error\"` so the primary button and\n * note-card styling read as destructive.\n *\n * ```vue\n * <CnConfirmDialog\n * v-if=\"showConfirm\"\n * ref=\"confirmDialog\"\n * :dialog-title=\"t('myapp', 'Accept request')\"\n * :message=\"t('myapp', 'Accept this request?')\"\n * @confirm=\"onConfirm\"\n * @close=\"showConfirm = false\" />\n * ```\n *\n * // In methods:\n * async onConfirm() {\n * const ok = await doTheThing()\n * this.$refs.confirmDialog.setResult(ok ? { success: true } : { error: 'It failed' })\n * }\n */\nexport default {\n\tname: 'CnConfirmDialog',\n\n\tcomponents: {\n\t\tCnDialog,\n\t\tCnIcon,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcLoadingIcon,\n\t\tCnConfirmValueField,\n\t},\n\n\tmixins: [dialogBoardMixin, confirmValueMixin],\n\n\tprops: {\n\t\t/** Dialog title shown in the NcDialog header. */\n\t\tdialogTitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm action'),\n\t\t},\n\n\t\t/** Confirmation question shown in the confirm phase's note card. */\n\t\tmessage: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Are you sure you want to continue?'),\n\t\t},\n\n\t\t/**\n\t\t * Visual variant of the primary confirm button. Use `error` for\n\t\t * destructive operations (delete) — the confirm-phase note card then\n\t\t * renders as a warning instead of an info note.\n\t\t */\n\t\tvariant: {\n\t\t\ttype: String,\n\t\t\tdefault: 'primary',\n\t\t\tvalidator: (v) => ['primary', 'error', 'warning', 'success'].includes(v),\n\t\t},\n\n\t\t/**\n\t\t * A CnIcon name drawn on the primary button, e.g. `DeleteOutline` for a\n\t\t * delete (board DqFilterVerwijderen). Empty draws none.\n\t\t */\n\t\tconfirmIcon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Label of the primary button that fires the `confirm` event. */\n\t\tconfirmLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Confirm'),\n\t\t},\n\n\t\t/** Label of the cancel button (visible during the confirm phase). */\n\t\tcancelLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Cancel'),\n\t\t},\n\n\t\t/** Label of the close button (visible during the result phase). */\n\t\tcloseLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Close'),\n\t\t},\n\n\t\t/** Success message shown in the result phase after `setResult({ success: true })`. */\n\t\tsuccessText: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Done.'),\n\t\t},\n\t},\n\n\temits: ['close', 'confirm'],\n\n\tdata() {\n\t\treturn {\n\t\t\t/** True between the confirm click and the parent's setResult() call. */\n\t\t\tloading: false,\n\t\t\t/** @type {{ success?: boolean, error?: string }|null} Result phase payload (null = confirm phase). */\n\t\t\tresult: null,\n\t\t\t/** Auto-close timer handle for the success result phase. */\n\t\t\tcloseTimeout: null,\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.closeTimeout) {\n\t\t\tclearTimeout(this.closeTimeout)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t// Exposed to the template for the loading spinner's accessible name —\n\t\t// the same `methods: { t }` pattern the other dialogs in this folder\n\t\t// use (e.g. CnEditPagesModal). The prop defaults above call `t()`\n\t\t// directly at module scope, which the template cannot do.\n\t\tt,\n\t\t/**\n\t\t * Primary-button click: enter the loading state and hand control to\n\t\t * the parent, which performs the confirmed operation.\n\t\t */\n\t\texecuteConfirm() {\n\t\t\tif (!this.confirmValueMatches) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\t/**\n\t\t\t * @event confirm Emitted when the user confirms. The parent performs\n\t\t\t * the actual operation and reports back via `setResult()`.\n\t\t\t */\n\t\t\tthis.$emit('confirm')\n\t\t},\n\n\t\t/**\n\t\t * Report the confirmed operation's outcome. Call this from the parent\n\t\t * after the operation completes; flips the dialog into its result\n\t\t * phase. A success auto-closes after 2 seconds.\n\t\t *\n\t\t * @param {{ success?: boolean, error?: string }} resultData The outcome to display.\n\t\t * @public\n\t\t */\n\t\tsetResult(resultData) {\n\t\t\tthis.loading = false\n\t\t\tthis.result = resultData\n\t\t\tif (resultData && resultData.success) {\n\t\t\t\tthis.closeTimeout = setTimeout(() => {\n\t\t\t\t\t/**\n\t\t\t\t\t * @event close Emitted when the dialog should close (cancel,\n\t\t\t\t\t * close button, or auto-close 2s after a success result).\n\t\t\t\t\t */\n\t\t\t\t\tthis.$emit('close')\n\t\t\t\t}, 2000)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-confirm__confirm {\n\tpadding: 4px 0;\n}\n</style>\n"],"names":["_createBlock","_createVNode","_createTextVNode","_toDisplayString","_createElementBlock"],"mappings":";;;;AAqBG,EAAA,KAAK,EAAC,oBAAoB;AACzB,EAAA,aAAU,EAAC,UAAK;AACjB,EAAA,mBAAY,EAAA,mBAAA;AACZ,EAAA,mBAAiB,EAAC,QAAQ;;;;AAW1B,EAAA,KAAK,EAAC,qBAAc;eACT,EAAC,UAAU;AACrB,EAAA,mBAAgB,EAAC,mBAAgB;qBACrB,EAAA,SAAA;;;;AAEZ,EAAA,KAAK,EAAC,qBAAqB;AAC3B,EAAA,aAAW,EAAC,qBAAA;;;;;;;;;;;uBAhCdA;AACC,IAAA,IAAI,EAAE,IAAI,CAAA,IAAA;AACV,IAAA,KAAK,EAAE,IAAK,CAAA,KAAA;AACb,IAAA,YAAW,EAAA,SAAA;AACV,IAAA,OAAO,EAAE,IAAO,CAAA,OAAA;AAChB,IAAA,QAAQ,EAAE,IAAQ,CAAA,QAAA;AAClB,IAAA,IAAI,EA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A,MAAA,CAAA,OAAA;8BAAjBF,WAEG,CAAA,qBAAA,EAAA;;AAFc,kBAAA,IAAA,EAAA,SAAA;;mCACjB,MAAW;oDAAR,MAAQ,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;;;;;yCAIH,CAAA,qBAAA,EAAA;;;;mCADR,MAAkB;AAAf,oBAAAE,eAAA,CAAAC,eAAA,CAAA,KAAA,CAAA,MAAM,CAAA,KAAM,CAAA,EAAA,CAAA,YAAA;;;;;;2CAwBX,iBAAA,EAAA;aAdF,IAAA,CAAA,WAAA;8BAAHC,kBAIK,CAAA,GAAA,EAJL,UAIK,EAAAD,eAAA,CADD,MAAO,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;8BAEXH,WAEa,CAAA,qBAAA,EAAA;;AAFN,kBAAA,IAAA,EAAA,MAAA,CAAA,OAAA,KAAA,OAAA,GAAA,SAAA,GAAA,MAAA;;mCACN,MAAa;oDAAV,MAAO,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;;;;sBAGH,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;aACJ,IAAA,CAAA,YAAA,KAAA,EAAA;8BAAJA,WAG8B,CAAA,8BAAA,EAAA;;;;AAD5B,kBAAA,KAAK,EAAE,IAAQ,CAAA,YAAA;AACf,kBAAA,KAAK,EAAG,IAAgB,CAAA,iBAAA;;;;;;;;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -103,6 +103,7 @@ export { default as CnChoiceCards } from './components/CnChoiceCards/CnChoiceCar
|
|
|
103
103
|
export { default as CnChoicePickerWidget } from './components/CnChoicePickerWidget/CnChoicePickerWidget.vue.js';
|
|
104
104
|
export { default as CnColorPicker } from './components/CnColorPicker/CnColorPicker.vue.js';
|
|
105
105
|
export { default as CnCommandPalette } from './components/CnCommandPalette/CnCommandPalette.vue.js';
|
|
106
|
+
export { default as CnConditionGroupEditor } from './components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js';
|
|
106
107
|
export { default as CnConditionListEditor } from './components/CnConditionListEditor/CnConditionListEditor.vue.js';
|
|
107
108
|
export { default as CnConfigurationCard } from './components/CnConfigurationCard/CnConfigurationCard.vue.js';
|
|
108
109
|
export { default as CnConnectionsPanel } from './components/CnConnectionsPanel/CnConnectionsPanel.vue.js';
|
|
@@ -143,6 +144,7 @@ export { default as CnDetailPage } from './components/CnDetailPage/CnDetailPage.
|
|
|
143
144
|
export { default as CnDetailWidgetHost } from './components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js';
|
|
144
145
|
export { default as CnDeviceFramesWidget } from './components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js';
|
|
145
146
|
export { default as CnDialog } from './components/CnDialog/CnDialog.vue.js';
|
|
147
|
+
export { default as CnDialogActions } from './components/CnDialogActions/CnDialogActions.vue.js';
|
|
146
148
|
export { default as CnDialogHeader } from './components/CnDialogHeader/CnDialogHeader.vue.js';
|
|
147
149
|
export { default as CnDividerWidget } from './components/CnDividerWidget/CnDividerWidget.vue.js';
|
|
148
150
|
export { default as CnDividerWidgetForm } from './components/CnDividerWidgetForm/CnDividerWidgetForm.vue.js';
|
|
@@ -251,6 +253,7 @@ export { default as CnMarkdownEditor } from './components/CnMarkdownEditor/CnMar
|
|
|
251
253
|
export { default as CnMarkdownWidget } from './components/CnMarkdownWidget/CnMarkdownWidget.vue.js';
|
|
252
254
|
export { default as CnMarkdownWidgetForm } from './components/CnMarkdownWidgetForm/CnMarkdownWidgetForm.vue.js';
|
|
253
255
|
export { default as CnMassActionBar } from './components/CnMassActionBar/CnMassActionBar.vue.js';
|
|
256
|
+
export { default as CnMassActionDialog } from './components/CnMassActionDialog/CnMassActionDialog.vue.js';
|
|
254
257
|
export { default as CnMassCopyDialog } from './components/CnMassCopyDialog/CnMassCopyDialog.vue.js';
|
|
255
258
|
export { default as CnMassDeleteDialog } from './components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js';
|
|
256
259
|
export { default as CnMassExportDialog } from './components/CnMassExportDialog/CnMassExportDialog.vue.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnContactsTab.vue2.js';
|
|
|
2
2
|
import { render } from './CnContactsTab.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-613fc51d";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -118,6 +118,13 @@ var script = {
|
|
|
118
118
|
handlerRoleLabel: { type: String, default: () => translate('nextcloud-vue', 'Handler') },
|
|
119
119
|
/** Role badge shown on an advisor. */
|
|
120
120
|
advisorRoleLabel: { type: String, default: () => translate('nextcloud-vue', 'Advisor') },
|
|
121
|
+
/**
|
|
122
|
+
* The word that leads a board row's details per kind of person: keyed
|
|
123
|
+
* by the link's `partyKind` (`person`, `organisation`, `colleague`)
|
|
124
|
+
* or else its `kind` (`user`, `contact`). A kind without a word leads
|
|
125
|
+
* with nothing.
|
|
126
|
+
*/
|
|
127
|
+
kindLabels: { type: Object, default: () => ({}) },
|
|
121
128
|
},
|
|
122
129
|
|
|
123
130
|
emits: ['open-reverse-lookup'],
|
|
@@ -435,14 +442,18 @@ var script = {
|
|
|
435
442
|
* @return {string} The window.
|
|
436
443
|
*/
|
|
437
444
|
/**
|
|
438
|
-
* A person's details on one line for the board look:
|
|
439
|
-
* organisation and note,
|
|
445
|
+
* A person's details on one line for the board look: the word for
|
|
446
|
+
* their kind (`kindLabels`), e-mail, phone, organisation and note,
|
|
447
|
+
* separated by middots.
|
|
440
448
|
*
|
|
441
449
|
* @param {object} contact The contact link.
|
|
442
450
|
* @return {string}
|
|
451
|
+
* @spec openspec/changes/parties-role-line-from-the-role-record/specs/record-widgets/spec.md#requirement-a-board-contact-row-can-lead-with-the-word-for-its-kind
|
|
443
452
|
*/
|
|
444
453
|
boardMetaOf(contact) {
|
|
445
|
-
|
|
454
|
+
const words = this.kindLabels || {};
|
|
455
|
+
const kind = words[contact?.partyKind] || words[contact?.kind] || '';
|
|
456
|
+
return [kind, contact?.email, contact?.phone, contact?.org, contact?.note].filter((part) => typeof part === 'string' && part !== '').join(' · ')
|
|
446
457
|
},
|
|
447
458
|
|
|
448
459
|
/**
|