@conduction/nextcloud-vue 2.170.0 → 2.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +22 -3
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js +242 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js +200 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js +186 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js +24 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue.js +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js +3 -15
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js +16 -61
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js +9 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js +120 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js +86 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js.map +1 -0
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +9 -9
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +75 -4
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js +8 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js +101 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js +54 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js.map +1 -0
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +7 -3
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +14 -2
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +7 -0
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +2 -2
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +11 -0
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +2 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js +9 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js.map +1 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js +248 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js.map +1 -0
- package/dist/esm/components/{CnMassDeleteDialog/CnMassDeleteDialog.vue3.js → CnMassActionDialog/CnMassActionDialog.vue3.js} +66 -52
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue3.js.map +1 -0
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js +0 -3
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js.map +1 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js +25 -121
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js +11 -3
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue.js +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +21 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +2 -2
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +23 -5
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +3 -0
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +14 -4
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue.js +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js +5 -3
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +16 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +16 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +908 -464
- package/dist/esm/utils/builtInFormatters.js +19 -1
- package/dist/esm/utils/builtInFormatters.js.map +1 -1
- package/dist/esm/utils/noteThreads.js +14 -2
- package/dist/esm/utils/noteThreads.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +11435 -10084
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +908 -464
- package/l10n/en.json +16 -1
- package/l10n/nl.json +16 -1
- package/package.json +1 -1
- package/scripts/.jsdoc-baselines.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +4 -1
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +24 -3
- package/src/components/CnConditionGroupEditor/CnConditionGroup.vue +528 -0
- package/src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue +211 -0
- package/src/components/CnConditionGroupEditor/index.js +9 -0
- package/src/components/CnConditionListEditor/CnConditionListEditor.vue +15 -78
- package/src/components/CnConditionListEditor/CnConditionRow.vue +226 -0
- package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +0 -6
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +75 -4
- package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
- package/src/components/CnDialogActions/index.js +7 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +7 -3
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +15 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/src/components/CnFlowsPage/CnFlowBoard.vue +10 -3
- package/src/components/CnFlowsPage/CnFlowEditorPage.vue +12 -0
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +7 -0
- package/src/components/CnMassActionDialog/CnMassActionDialog.vue +382 -0
- package/src/components/CnMassActionDialog/index.js +7 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.md +4 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +25 -254
- package/src/components/CnNotesCard/CnNotesCard.vue +12 -4
- package/src/components/CnObjectSidebar/CnNotesTab.vue +23 -3
- package/src/components/CnTreeView/CnTreeNode.vue +10 -1
- package/src/components/CnTreeView/CnTreeView.vue +9 -0
- package/src/components/index.js +3 -0
- package/src/css/context-menu.css +7 -0
- package/src/css/look-board-detail.css +220 -2
- package/src/css/look-board-index.css +7 -6
- package/src/css/look-board.css +43 -2
- package/src/css/patches.css +4 -1
- package/src/dialogs/CnConfirmDialog.vue +3 -1
- package/src/index.js +3 -0
- package/src/utils/builtInFormatters.js +18 -0
- package/src/utils/noteThreads.js +13 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnChecklistRunWidget.vue3.js","sources":["../../../../src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue?vue&type=template&id=4713ce24&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-checklist-run\" data-testid=\"cn-checklist-run\">\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-checklist-run-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<div v-else-if=\"loading\" class=\"cn-checklist-run__loading\">\n\t\t\t<NcLoadingIcon :size=\"20\" :name=\"loadingLabel\" />\n\t\t</div>\n\t\t<p v-else-if=\"questions.length === 0\" class=\"cn-checklist-run__empty\" data-testid=\"cn-checklist-run-empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t\t<form v-else\n\t\t\tclass=\"cn-checklist-run__form\"\n\t\t\tnovalidate\n\t\t\t@submit.prevent=\"next\">\n\t\t\t<p\n\t\t\t\tref=\"position\"\n\t\t\t\tclass=\"cn-checklist-run__position\"\n\t\t\t\ttabindex=\"-1\"\n\t\t\t\tdata-testid=\"cn-checklist-run-position\">\n\t\t\t\t{{ positionText }}\n\t\t\t</p>\n\t\t\t<span\n\t\t\t\tclass=\"cn-checklist-run__progress\"\n\t\t\t\trole=\"progressbar\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t:aria-valuemax=\"questions.length\"\n\t\t\t\t:aria-valuenow=\"answeredCount\"\n\t\t\t\tdata-testid=\"cn-checklist-run-progress\">\n\t\t\t\t<span class=\"cn-checklist-run__progress-fill\" :style=\"{ width: `${progressShare}%` }\" />\n\t\t\t</span>\n\t\t\t<span class=\"cn-checklist-run__live\" aria-live=\"polite\">{{ liveText }}</span>\n\n\t\t\t<p v-if=\"pageGroup\" class=\"cn-checklist-run__group\" data-testid=\"cn-checklist-run-group\">\n\t\t\t\t{{ pageGroup }}\n\t\t\t</p>\n\t\t\t<fieldset\n\t\t\t\tv-for=\"question in pageQuestions\"\n\t\t\t\t:key=\"question.id\"\n\t\t\t\tclass=\"cn-checklist-run__question\"\n\t\t\t\t:aria-describedby=\"question.help ? `${uid}-help-${question.id}` : null\"\n\t\t\t\tdata-testid=\"cn-checklist-run-question\">\n\t\t\t\t<legend class=\"cn-checklist-run__legend\">\n\t\t\t\t\t{{ question.text }}<span v-if=\"question.required\" class=\"cn-checklist-run__required\">\n\t\t\t\t\t\t<span aria-hidden=\"true\"> *</span><span class=\"cn-checklist-run__sr\">{{ requiredLabel }}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</legend>\n\t\t\t\t<p v-if=\"question.help\" :id=\"`${uid}-help-${question.id}`\" class=\"cn-checklist-run__help\">\n\t\t\t\t\t{{ question.help }}\n\t\t\t\t</p>\n\t\t\t\t<template v-if=\"question.choices.length\">\n\t\t\t\t\t<label\n\t\t\t\t\t\tv-for=\"choice in question.choices\"\n\t\t\t\t\t\t:key=\"choice.value\"\n\t\t\t\t\t\tclass=\"cn-checklist-run__choice\">\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t:name=\"`${uid}-${question.id}`\"\n\t\t\t\t\t\t\t:value=\"choice.value\"\n\t\t\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\t\t\tdata-testid=\"cn-checklist-run-choice\"\n\t\t\t\t\t\t\t@change=\"markDirty(question.id)\">\n\t\t\t\t\t\t{{ choice.label }}\n\t\t\t\t\t</label>\n\t\t\t\t</template>\n\t\t\t\t<input\n\t\t\t\t\tv-else-if=\"question.kind === 'number'\"\n\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\tclass=\"cn-checklist-run__number\"\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tinputmode=\"decimal\"\n\t\t\t\t\t:aria-label=\"question.text\"\n\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-number\"\n\t\t\t\t\t@input=\"markDirty(question.id)\">\n\t\t\t\t<p v-else-if=\"question.kind === 'photo'\" class=\"cn-checklist-run__help\">\n\t\t\t\t\t{{ photoOnlyLabel }}\n\t\t\t\t</p>\n\t\t\t\t<textarea\n\t\t\t\t\tv-else\n\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\tclass=\"cn-checklist-run__text\"\n\t\t\t\t\trows=\"3\"\n\t\t\t\t\t:aria-label=\"question.text\"\n\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-text\"\n\t\t\t\t\t@input=\"markDirty(question.id)\" />\n\t\t\t\t<label v-if=\"allowNote && noteShown(question)\" class=\"cn-checklist-run__note-label\">\n\t\t\t\t\t{{ noteLabel }}\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tv-model=\"draft[question.id].note\"\n\t\t\t\t\t\tclass=\"cn-checklist-run__text\"\n\t\t\t\t\t\trows=\"2\"\n\t\t\t\t\t\tdata-testid=\"cn-checklist-run-note\"\n\t\t\t\t\t\t@input=\"markDirty(question.id)\" />\n\t\t\t\t</label>\n\t\t\t\t<p\n\t\t\t\t\tv-if=\"missing.includes(question.id)\"\n\t\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-missing\">\n\t\t\t\t\t{{ missingLabel }}\n\t\t\t\t</p>\n\t\t\t</fieldset>\n\n\t\t\t<div\n\t\t\t\tv-for=\"question in photoQuestions\"\n\t\t\t\t:key=\"`photos-${question.id}`\"\n\t\t\t\tclass=\"cn-checklist-run__photos\"\n\t\t\t\tdata-testid=\"cn-checklist-run-photos\">\n\t\t\t\t<strong class=\"cn-checklist-run__photos-title\">{{ photoTitle(question) }}</strong>\n\t\t\t\t<ul v-if=\"photoNamesFor(question).length\" class=\"cn-checklist-run__photo-list\">\n\t\t\t\t\t<li v-for=\"name in photoNamesFor(question)\" :key=\"name\" data-testid=\"cn-checklist-run-photo\">\n\t\t\t\t\t\t{{ name }}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t\t<!-- A button that opens the hidden file input, so the control is\n\t\t\t\t a button to every reader; the input stays out of the tab\n\t\t\t\t order and the accessibility tree. -->\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-checklist-run__photo-button\"\n\t\t\t\t\t:aria-describedby=\"missingPhoto.includes(question.id) ? `${uid}-photo-${question.id}` : null\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-photo-button\"\n\t\t\t\t\t@click=\"openPhotoPicker\">\n\t\t\t\t\t<CameraOutline :size=\"16\" />\n\t\t\t\t\t{{ photoNamesFor(question).length || (storedPhotos[question.id] || []).length ? morePhotoLabel : addPhotoLabel }}\n\t\t\t\t</button>\n\t\t\t\t<input\n\t\t\t\t\tclass=\"cn-checklist-run__photo-input\"\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tcapture=\"environment\"\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-photo-input\"\n\t\t\t\t\t@change=\"addPhotos($event, question.id)\">\n\t\t\t\t<p\n\t\t\t\t\tv-if=\"missingPhoto.includes(question.id)\"\n\t\t\t\t\t:id=\"`${uid}-photo-${question.id}`\"\n\t\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-missing-photo\">\n\t\t\t\t\t{{ missingPhotoLabel }}\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-checklist-run__nav\">\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:disabled=\"page === 0 || saving\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-previous\"\n\t\t\t\t\t@click=\"previous\">\n\t\t\t\t\t{{ previousLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t:disabled=\"saving\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-next\">\n\t\t\t\t\t{{ isLastPage ? finishLabel : nextLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t\t<p v-if=\"saveError\"\n\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-checklist-run-save-error\">\n\t\t\t\t{{ saveError }}\n\t\t\t</p>\n\t\t</form>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport CameraOutline from 'vue-material-design-icons/CameraOutline.vue'\nimport { uploadHeldFiles } from '../../composables/useHeldFileUpload.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { hasUnresolvedTokens, resolveDeepTokens, resolveFilterTokens } from '../../utils/resolveFilterTokens.js'\n\nconst OBJECT_API = '/apps/openregister/api/objects'\n\nlet instanceCounter = 0\n\n/**\n * The choices a question type offers, before translation.\n *\n * @type {Record<string, Array<{value: string, label: string}>>}\n */\nconst TYPE_CHOICES = Object.freeze({\n\tyes_no: [{ key: 'yes', label: 'Yes' }, { key: 'no', label: 'No' }],\n\tyes_no_na: [{ key: 'yes', label: 'Yes' }, { key: 'no', label: 'No' }, { key: 'na', label: 'Not applicable' }],\n})\n\n/** The kinds of question the widget draws. */\nconst KINDS = Object.freeze(['yes_no', 'yes_no_na', 'choice', 'text', 'number', 'photo'])\n\n/**\n * Sort by a numeric field, lowest first, keeping the given order for ties and\n * for entries without the field.\n *\n * @param {Array<object>} list The entries.\n * @param {string} field The field.\n * @return {Array<object>} A sorted copy.\n */\nfunction byOrder(list, field) {\n\tif (!field) {\n\t\treturn [...list]\n\t}\n\tconst rank = (entry) => {\n\t\tconst n = Number(readPath(entry, field))\n\t\treturn Number.isFinite(n) ? n : Infinity\n\t}\n\treturn list.map((entry, index) => ({ entry, index })).sort((a, b) => (rank(a.entry) - rank(b.entry)) || (a.index - b.index)).map(({ entry }) => entry)\n}\n\n/**\n * A register or schema as the object API path takes it.\n *\n * @param {string|object} value A slug, or a register/schema object.\n * @return {string} The slug or id.\n */\nfunction slugOf(value) {\n\tif (value && typeof value === 'object') {\n\t\treturn String(value.slug ?? value.id ?? '')\n\t}\n\treturn value ? String(value) : ''\n}\n\n/**\n * The id of an object, wherever OpenRegister carries it.\n *\n * @param {object|null} object The object.\n * @return {string} The id, or ''.\n */\nfunction idOf(object) {\n\treturn String(object?.id ?? object?.['@self']?.id ?? object?.uuid ?? '')\n}\n\n/**\n * CnChecklistRunWidget — the `checklist-run` widget: a checklist answered a\n * page of questions at a time (board DqInspectie, the middle phone frame).\n *\n * The questions are records of a register, listed with a token-resolved\n * filter. Each page shows `pageSize` questions (one by default) as radio\n * choices or a text field, an optional note, and photos for the first\n * question of the page, then Previous and Next. The answers of a page are\n * saved when the user moves on.\n *\n * Answers are stored one record per question through the OpenRegister object\n * API, under the reader's own rights: an existing answer is updated, a new\n * one created with the `answers.create` fields. Photos go up through the\n * object's own file upload (`uploadHeldFiles`) and are attached to the\n * answer's `photosField`. An app that stores answers its own way names a\n * `saveAction` instead; it is dispatched per answer with the answer as its\n * last argument, and photos are not uploaded then.\n *\n * ```json\n * {\n * \"type\": \"checklist-run\",\n * \"content\": {\n * \"questions\": { \"register\": \"app\", \"schema\": \"question\", \"filter\": { \"checklist\": \"@object.checklist\" }, \"orderField\": \"position\" },\n * \"fields\": { \"text\": \"text\", \"type\": \"type\", \"options\": \"options\", \"required\": \"required\", \"help\": \"help\" },\n * \"answers\": {\n * \"register\": \"app\", \"schema\": \"answer\", \"filter\": { \"run\": \"@objectId\" },\n * \"questionField\": \"question\", \"valueField\": \"answer\", \"noteField\": \"note\", \"photosField\": \"photos\",\n * \"create\": { \"run\": \"@objectId\" }\n * },\n * \"pageSize\": 1,\n * \"caption\": \"{title} version {version}\"\n * }\n * }\n * ```\n *\n * The questions and answers can also live inside the open record:\n * `questionsPath` (with `itemsKey` for groups, both sorted by `orderField`)\n * reads the questions off it, and `answersPath` writes the answers into an\n * array on it, one entry per question keyed by `answerKey`, by updating the\n * record through the object API. Photos then go to the record's own files\n * (`recordPhotosField`) and their references into the answer.\n *\n * A question can require a photo: `fields.photoRequired` names its rule,\n * `photoRequiredValues` maps the stored values onto `never`, `always` or\n * `{ whenAnswer }`, and the page holds until the photo is there. On a page\n * with no bound record, `record: { register, schema, filter, sort }` picks\n * the open record: the first match, under the reader's rights.\n *\n * `noteWhen: { answers: [...] }` shows a question's note field only once its\n * answer is one of those stored values (the board shows a note under \"Nee\"),\n * or when the question already holds a note; without it every question shows\n * one (`allowNote: false` hides them all).\n *\n * `startAt: \"firstOpen\"` opens a run that was started earlier at the page of\n * its first unanswered question (the last page when all are answered), once\n * per record; without it the run opens at the first page.\n *\n * Question kinds: `yes_no`, `yes_no_na`, `choice` (the question's `options`,\n * a list of strings or `{ value, label }`), `number`, `photo` and `text`.\n * `typeMap` maps the app's type values onto them, `choiceValues` the stored\n * values of yes / no / not applicable.\n * Keyboard: the choices are native radio buttons in a fieldset whose legend is\n * the question; on a new page focus moves to the position line and a polite\n * live region reads it.\n */\nexport default {\n\tname: 'CnChecklistRunWidget',\n\n\tcomponents: { CameraOutline, NcButton, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The detail page's object context (`{ objectId, object }`), for tokens. */\n\t\tcnObjectContext: { default: null },\n\t\t/** The page's workspace values, for `@workspace.<key>` tokens. */\n\t\tcnWorkspaceContext: { default: null },\n\t\t/** The host's translate, for manifest texts and question texts. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher, for `saveAction` / `finishAction`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ questions | questionsPath, itemsKey?,\n\t\t * groupLabelField?, orderField?, fields?, typeMap?, choiceValues?,\n\t\t * answers | answersPath, answerKey?, answerFields?, recordPhotosField?,\n\t\t * record?, saveAction?, finishAction?, pageSize?, allowNote?, noteWhen?,\n\t\t * allowPhotos?, caption?, emptyText? }`, as in the component\n\t\t * description and docs/components/cn-checklist-run-widget.md.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record's id, for `@objectId`. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record, for `@object.<field>`, the caption and `questionsPath` / `answersPath`. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's register, for writing `answersPath` (`content.record` wins). */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record's schema, for writing `answersPath` (`content.record` wins). */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['finished'],\n\n\tdata() {\n\t\tinstanceCounter += 1\n\t\treturn {\n\t\t\tuid: `cn-checklist-run-${instanceCounter}`,\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t\tsaving: false,\n\t\t\tsaveError: '',\n\t\t\tquestions: [],\n\t\t\tanswerIds: {},\n\t\t\t// Photos an answer already holds, kept when new ones are attached.\n\t\t\tstoredPhotos: {},\n\t\t\t// `answersPath` mode: the answer entries as last read or written.\n\t\t\trecordAnswers: [],\n\t\t\tdraft: {},\n\t\t\tdirty: {},\n\t\t\tphotos: {},\n\t\t\tpage: 0,\n\t\t\t// The source the page was last positioned for; `startAt` applies once per source.\n\t\t\tpositionedFor: '',\n\t\t\tmissing: [],\n\t\t\t// Questions on this page that still need their photo.\n\t\t\tmissingPhoto: [],\n\t\t\t// `content.record` with a filter: the record it picked, or null.\n\t\t\tpickedRecord: null,\n\t\t\tliveText: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} What the tokens resolve against. */\n\t\ttokenCtx() {\n\t\t\tconst unwrap = (c) => (c && typeof c === 'object' && 'value' in c ? c.value : c)\n\t\t\tconst injected = unwrap(this.cnObjectContext) || {}\n\t\t\treturn {\n\t\t\t\t...injected,\n\t\t\t\tobjectId: (this.pickedRecord && idOf(this.pickedRecord)) || this.objectId || injected.objectId || this.objectData?.id || null,\n\t\t\t\tobject: this.pickedRecord || this.objectData || injected.object || null,\n\t\t\t\tworkspace: unwrap(this.cnWorkspaceContext) || {},\n\t\t\t}\n\t\t},\n\n\t\t/** @return {object} The question field paths, with their defaults. */\n\t\tfields() {\n\t\t\treturn { id: 'id', text: 'text', type: 'type', options: 'options', required: 'required', help: 'help', ...(this.content?.fields || {}) }\n\t\t},\n\n\t\t/** @return {number} Questions per page, at least 1. */\n\t\tpageSize() {\n\t\t\tconst n = Math.floor(Number(this.content?.pageSize))\n\t\t\treturn Number.isFinite(n) && n >= 1 ? n : 1\n\t\t},\n\n\t\t/** @return {number} The number of pages. */\n\t\tpageCount() {\n\t\t\treturn Math.max(1, Math.ceil(this.questions.length / this.pageSize))\n\t\t},\n\n\t\t/** @return {boolean} Whether this is the last page. */\n\t\tisLastPage() {\n\t\t\treturn this.page >= this.pageCount - 1\n\t\t},\n\n\t\t/** @return {object[]} The questions on this page. */\n\t\tpageQuestions() {\n\t\t\treturn this.questions.slice(this.page * this.pageSize, (this.page + 1) * this.pageSize)\n\t\t},\n\n\t\t/** @return {object|null} The first question on this page, the one photos belong to. */\n\t\tcurrentQuestion() {\n\t\t\treturn this.pageQuestions[0] || null\n\t\t},\n\n\t\t/** @return {number} Questions with an answer. */\n\t\tansweredCount() {\n\t\t\treturn this.questions.filter((q) => this.isAnswered(q)).length\n\t\t},\n\n\t\t/** @return {number} The share answered, 0 to 100. */\n\t\tprogressShare() {\n\t\t\treturn this.questions.length ? Math.round((this.answeredCount / this.questions.length) * 100) : 0\n\t\t},\n\n\t\t/** @return {string} \"Question 7 of 24\", with the caption after it. */\n\t\tpositionText() {\n\t\t\tconst first = this.page * this.pageSize + 1\n\t\t\tconst position = t('nextcloud-vue', 'Question {n} of {total}', { n: first, total: this.questions.length })\n\t\t\tconst caption = this.caption\n\t\t\treturn caption ? `${position} · ${caption}` : position\n\t\t},\n\n\t\t/** @return {string} `content.caption` with `{field}` filled from the record. */\n\t\tcaption() {\n\t\t\tconst template = this.content?.caption\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst object = this.tokenCtx.object || {}\n\t\t\treturn this.translate(template).replace(/\\{([A-Za-z0-9_.]+)\\}/g, (_m, path) => {\n\t\t\t\tconst value = readPath(object, path)\n\t\t\t\treturn value === null || value === undefined ? '' : String(value)\n\t\t\t}).trim()\n\t\t},\n\n\t\t/** @return {boolean} Whether a note field shows (default true). */\n\t\tallowNote() {\n\t\t\treturn this.content?.allowNote !== false\n\t\t},\n\n\t\t/** @return {boolean} Whether the answers are written into an array on the open record. */\n\t\tinRecord() {\n\t\t\treturn typeof this.content?.answersPath === 'string' && this.content.answersPath !== ''\n\t\t},\n\n\t\t/** @return {object} `answersPath` field names, with their defaults. */\n\t\tanswerFields() {\n\t\t\treturn { value: 'value', number: 'value', choice: 'value', note: 'note', photos: 'photos', ...(this.content?.answerFields || {}) }\n\t\t},\n\n\t\t/** @return {{register: string, schema: string}} Where the open record lives. */\n\t\trecordRef() {\n\t\t\tconst own = this.content?.record || {}\n\t\t\treturn { register: slugOf(own.register || this.register), schema: slugOf(own.schema || this.schema) }\n\t\t},\n\n\t\t/**\n\t\t * Whether photos can be added: allowed, and somewhere to put them.\n\t\t *\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tphotosEnabled() {\n\t\t\tif (this.content?.allowPhotos === false || this.content?.saveAction) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.inRecord) {\n\t\t\t\treturn Boolean(this.content?.recordPhotosField && this.answerFields.photos)\n\t\t\t}\n\t\t\treturn Boolean(this.content?.answers?.photosField)\n\t\t},\n\n\t\t/** @return {string} The group (section) of this page's first question, or ''. */\n\t\tpageGroup() {\n\t\t\treturn this.currentQuestion?.group || ''\n\t\t},\n\n\t\t/**\n\t\t * The questions of this page that get a photo control: with a\n\t\t * `photoRequired` field, those whose rule is not never (and photo\n\t\t * questions); without one, the first question of the page.\n\t\t *\n\t\t * @return {object[]} The questions.\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-question-can-require-a-photo\n\t\t */\n\t\tphotoQuestions() {\n\t\t\tif (!this.photosEnabled) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tif (this.fields.photoRequired) {\n\t\t\t\treturn this.pageQuestions.filter((q) => q.kind === 'photo' || q.photoRule !== 'never')\n\t\t\t}\n\t\t\tconst first = this.currentQuestion\n\t\t\tconst extra = this.pageQuestions.filter((q) => q.kind === 'photo' && q !== first)\n\t\t\treturn first ? [first, ...extra] : extra\n\t\t},\n\n\t\t/**\n\t\t * `content.record` with a `filter`: the list to pick the open record\n\t\t * from (first match of `sort`), `'blocked'` while a token is\n\t\t * unresolved, or null without a filter.\n\t\t *\n\t\t * @return {object|string|null}\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-checklist-run-can-pick-its-record-by-filter\n\t\t */\n\t\trecordPicker() {\n\t\t\tconst own = this.content?.record\n\t\t\tif (!own || typeof own !== 'object' || !own.filter || typeof own.filter !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst unwrap = (c) => (c && typeof c === 'object' && 'value' in c ? c.value : c)\n\t\t\tconst filter = resolveFilterTokens(own.filter, { objectId: this.objectId || null, object: this.objectData, workspace: unwrap(this.cnWorkspaceContext) || {} })\n\t\t\tif (hasUnresolvedTokens(filter)) {\n\t\t\t\treturn 'blocked'\n\t\t\t}\n\t\t\tconst sort = own.sort && typeof own.sort === 'object' && own.sort.field ? { [`_order[${own.sort.field}]`]: own.sort.dir === 'asc' ? 'asc' : 'desc' } : {}\n\t\t\treturn { register: slugOf(own.register), schema: slugOf(own.schema), filter: { ...filter, ...sort } }\n\t\t},\n\n\t\t/** @return {object|null} The record the run lives in: the picked one, else the bound one. */\n\t\topenRecord() {\n\t\t\treturn this.recordPicker ? this.pickedRecord : this.tokenCtx.object\n\t\t},\n\n\t\t/** @return {string} The key of the source lists, to read them again when they change. */\n\t\tsourceKey() {\n\t\t\tconst picker = this.recordPicker\n\t\t\tif (picker === 'blocked') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (picker && typeof this.content?.questionsPath === 'string' && this.content.questionsPath !== '') {\n\t\t\t\treturn JSON.stringify({ pick: picker, path: this.content.questionsPath })\n\t\t\t}\n\t\t\tif (typeof this.content?.questionsPath === 'string' && this.content.questionsPath !== '') {\n\t\t\t\tconst object = this.tokenCtx.object\n\t\t\t\treturn object ? JSON.stringify({ path: this.content.questionsPath, id: idOf(object), at: object['@self']?.updated ?? null }) : ''\n\t\t\t}\n\t\t\tconst q = this.content?.questions\n\t\t\tif (!q || !q.register || !q.schema) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst qFilter = resolveFilterTokens(q.filter || {}, this.tokenCtx)\n\t\t\tconst a = this.content?.answers\n\t\t\tconst aFilter = a && a.register && a.schema ? resolveFilterTokens(a.filter || {}, this.tokenCtx) : null\n\t\t\tif (hasUnresolvedTokens(qFilter) || (aFilter && hasUnresolvedTokens(aFilter))) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn JSON.stringify({ q: [q.register, q.schema, qFilter], a: aFilter ? [a.register, a.schema, aFilter] : null })\n\t\t},\n\n\t\tloadingLabel: () => t('nextcloud-vue', 'Loading …'),\n\t\tprogressLabel: () => t('nextcloud-vue', 'Questions answered'),\n\t\trequiredLabel: () => ` ${t('nextcloud-vue', '(required)')}`,\n\t\tmissingLabel: () => t('nextcloud-vue', 'Answer this question to go on.'),\n\t\tpreviousLabel: () => t('nextcloud-vue', 'Previous'),\n\t\tnextLabel: () => t('nextcloud-vue', 'Next'),\n\t\tfinishLabel: () => t('nextcloud-vue', 'Finish'),\n\t\taddPhotoLabel: () => t('nextcloud-vue', 'Take or add a photo'),\n\t\tmissingPhotoLabel: () => t('nextcloud-vue', 'This answer needs a photo. Add one to go on.'),\n\t\tphotoOnlyLabel: () => t('nextcloud-vue', 'Answer with a photo.'),\n\t\tmorePhotoLabel: () => t('nextcloud-vue', 'Another photo'),\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.content?.noteLabel ? this.translate(this.content.noteLabel) : t('nextcloud-vue', 'Note')\n\t\t},\n\n\t\t/** @return {string} The empty-state text. */\n\t\temptyLabel() {\n\t\t\treturn this.content?.emptyText ? this.translate(this.content.emptyText) : t('nextcloud-vue', 'This checklist has no questions.')\n\t\t},\n\t},\n\n\twatch: {\n\t\tsourceKey: {\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\n\t\t\timmediate: true,\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether a question shows its note field: always, unless `noteWhen`\n\t\t * names the answers that ask for one and this question has none of\n\t\t * them and no note yet.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean}\n\t\t */\n\t\tnoteShown(question) {\n\t\t\tconst answers = this.content?.noteWhen?.answers\n\t\t\tif (!Array.isArray(answers)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tconst draft = this.draft[question.id] || {}\n\t\t\treturn (draft.note || '') !== '' || answers.map(String).includes(String(draft.value ?? ''))\n\t\t},\n\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Whether a value counts as an answer.\n\t\t *\n\t\t * @param {unknown} value The value.\n\t\t * @return {boolean} True for a non-empty value.\n\t\t */\n\t\thasValue(value) {\n\t\t\treturn value !== null && value !== undefined && String(value).trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether a question has an answer: a value, or for a photo question\n\t\t * a photo stored or held.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True when answered.\n\t\t */\n\t\tisAnswered(question) {\n\t\t\tif (question.kind === 'photo') {\n\t\t\t\treturn this.hasPhoto(question)\n\t\t\t}\n\t\t\treturn this.hasValue(this.draft[question.id]?.value)\n\t\t},\n\n\t\t/**\n\t\t * A question record as the widget draws it.\n\t\t *\n\t\t * @param {object} record The question record.\n\t\t * @param {string} [group] The group (section) it belongs to.\n\t\t * @return {{id: string, text: string, kind: string, required: boolean, help: string, choices: Array<{value: string, label: string}>, group: string}} The question.\n\t\t */\n\t\ttoQuestion(record, group = '') {\n\t\t\tconst f = this.fields\n\t\t\tconst raw = String(readPath(record, f.type) ?? '')\n\t\t\tconst mapped = this.content?.typeMap && typeof this.content.typeMap === 'object' ? this.content.typeMap[raw] : undefined\n\t\t\tconst kind = KINDS.includes(mapped) ? mapped : (KINDS.includes(raw) ? raw : 'text')\n\t\t\tconst stored = { yes: 'yes', no: 'no', na: 'na', ...(this.content?.choiceValues || {}) }\n\t\t\tlet choices = (TYPE_CHOICES[kind] || []).map((c) => ({ value: String(stored[c.key]), label: t('nextcloud-vue', c.label) }))\n\t\t\tif (kind === 'choice') {\n\t\t\t\tconst options = readPath(record, f.options)\n\t\t\t\tchoices = (Array.isArray(options) ? options : []).map((o) => (o && typeof o === 'object'\n\t\t\t\t\t? { value: String(o.value ?? o.label ?? ''), label: this.translate(String(o.label ?? o.value ?? '')) }\n\t\t\t\t\t: { value: String(o), label: this.translate(String(o)) })).filter((c) => c.value !== '')\n\t\t\t}\n\t\t\tconst help = readPath(record, f.help)\n\t\t\treturn {\n\t\t\t\tid: String(readPath(record, f.id) ?? idOf(record)),\n\t\t\t\ttext: this.translate(String(readPath(record, f.text) ?? '')),\n\t\t\t\tkind,\n\t\t\t\trequired: Boolean(readPath(record, f.required)),\n\t\t\t\thelp: typeof help === 'string' && help !== '' ? this.translate(help) : '',\n\t\t\t\tchoices,\n\t\t\t\tgroup,\n\t\t\t\tphotoRule: this.photoRuleOf(record),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A question's photo rule, from its `photoRequired` field mapped\n\t\t * through `photoRequiredValues`: `'never'`, `'always'` or\n\t\t * `{ whenAnswer }` (a photo is needed when the answer is that value).\n\t\t *\n\t\t * @param {object} record The question record.\n\t\t * @return {('never'|'always'|{whenAnswer: string})} The rule.\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-question-can-require-a-photo\n\t\t */\n\t\tphotoRuleOf(record) {\n\t\t\tconst path = this.fields.photoRequired\n\t\t\tif (!path) {\n\t\t\t\treturn 'never'\n\t\t\t}\n\t\t\tconst raw = readPath(record, path)\n\t\t\tconst map = { true: 'always', false: 'never', always: 'always', never: 'never', ...(this.content?.photoRequiredValues || {}) }\n\t\t\tconst rule = raw === null || raw === undefined ? 'never' : map[String(raw)]\n\t\t\tif (rule && typeof rule === 'object' && rule.whenAnswer !== undefined) {\n\t\t\t\treturn { whenAnswer: String(rule.whenAnswer) }\n\t\t\t}\n\t\t\treturn rule === 'always' ? 'always' : 'never'\n\t\t},\n\n\t\t/**\n\t\t * Whether a question needs a photo with its current answer.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True when a photo is required now.\n\t\t */\n\t\tneedsPhoto(question) {\n\t\t\tconst rule = question.photoRule\n\t\t\tif (rule === 'always') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn Boolean(rule && typeof rule === 'object' && String(this.draft[question.id]?.value ?? '') === rule.whenAnswer)\n\t\t},\n\n\t\t/**\n\t\t * Whether a question has a photo, stored or held.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True with at least one photo.\n\t\t */\n\t\thasPhoto(question) {\n\t\t\treturn (this.storedPhotos[question.id] || []).length > 0 || (this.photos[question.id] || []).length > 0\n\t\t},\n\n\t\t/**\n\t\t * The photo card title for a question: its position in the run.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {string} The title.\n\t\t */\n\t\tphotoTitle(question) {\n\t\t\tconst n = this.questions.indexOf(question) + 1\n\t\t\treturn t('nextcloud-vue', 'Photo for question {n}', { n })\n\t\t},\n\n\t\t/**\n\t\t * The names of the photos held for a question.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {string[]} The file names.\n\t\t */\n\t\tphotoNamesFor(question) {\n\t\t\treturn (this.photos[question.id] || []).map((file) => file.name)\n\t\t},\n\n\t\t/**\n\t\t * The questions on the open record (`questionsPath`): a list of\n\t\t * questions, or of groups whose `itemsKey` holds them, both levels\n\t\t * sorted by `orderField`.\n\t\t *\n\t\t * @return {object[]} The questions.\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tquestionsFromRecord() {\n\t\t\tconst c = this.content\n\t\t\tconst list = readPath(this.openRecord, c.questionsPath)\n\t\t\tconst orderField = c.orderField === undefined ? 'order' : c.orderField\n\t\t\tconst top = byOrder(Array.isArray(list) ? list : [], orderField)\n\t\t\tif (!c.itemsKey) {\n\t\t\t\treturn top.map((record) => this.toQuestion(record))\n\t\t\t}\n\t\t\tconst labelField = c.groupLabelField || 'name'\n\t\t\treturn top.flatMap((group) => {\n\t\t\t\tconst items = readPath(group, c.itemsKey)\n\t\t\t\tconst label = readPath(group, labelField)\n\t\t\t\treturn byOrder(Array.isArray(items) ? items : [], orderField).map((record) => this.toQuestion(record, typeof label === 'string' ? this.translate(label) : ''))\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The draft of one answer entry from the open record's `answersPath`.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @param {object} entry The stored entry.\n\t\t * @return {{value: string, note: string}} The draft.\n\t\t */\n\t\tdraftFromEntry(question, entry) {\n\t\t\tconst af = this.answerFields\n\t\t\tconst field = question.kind === 'number' ? af.number : (question.kind === 'choice' ? af.choice : af.value)\n\t\t\tconst value = readPath(entry, field)\n\t\t\tconst note = readPath(entry, af.note)\n\t\t\treturn { value: value === null || value === undefined ? '' : String(value), note: note === null || note === undefined ? '' : String(note) }\n\t\t},\n\n\t\t/**\n\t\t * Read the questions and the answers given so far.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-a-checklist-run-shows-a-page-of-questions-at-a-time\n\t\t */\n\t\tasync load() {\n\t\t\tconst key = this.sourceKey\n\t\t\tif (key === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst picker = this.recordPicker\n\t\t\t\tif (picker) {\n\t\t\t\t\tconst found = await fetchReferenceObjects({ register: picker.register, schema: picker.schema, filter: picker.filter, limit: 1 })\n\t\t\t\t\tif (key !== this.sourceKey) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthis.pickedRecord = found[0] || null\n\t\t\t\t}\n\t\t\t\tlet questions\n\t\t\t\tif (picker && !this.pickedRecord) {\n\t\t\t\t\tquestions = []\n\t\t\t\t} else if (this.content.questionsPath) {\n\t\t\t\t\tquestions = this.questionsFromRecord()\n\t\t\t\t} else {\n\t\t\t\t\tconst q = this.content.questions\n\t\t\t\t\tconst records = await fetchReferenceObjects({ register: q.register, schema: q.schema, filter: resolveFilterTokens(q.filter || {}, this.tokenCtx), limit: q.limit || 500 })\n\t\t\t\t\tquestions = byOrder(records, q.orderField).map((r) => this.toQuestion(r))\n\t\t\t\t}\n\t\t\t\tquestions = questions.filter((x) => x.id !== '' && x.text !== '')\n\t\t\t\tconst a = this.inRecord ? null : this.content.answers\n\t\t\t\tconst answers = a && a.register && a.schema\n\t\t\t\t\t? await fetchReferenceObjects({ register: a.register, schema: a.schema, filter: resolveFilterTokens(a.filter || {}, this.tokenCtx), limit: a.limit || 500 })\n\t\t\t\t\t: []\n\t\t\t\tif (key !== this.sourceKey) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst draft = {}\n\t\t\t\tconst answerIds = {}\n\t\t\t\tconst storedPhotos = {}\n\t\t\t\tfor (const question of questions) {\n\t\t\t\t\tdraft[question.id] = { value: '', note: '' }\n\t\t\t\t}\n\t\t\t\tif (this.inRecord) {\n\t\t\t\t\tconst entries = readPath(this.openRecord, this.content.answersPath)\n\t\t\t\t\tthis.recordAnswers = Array.isArray(entries) ? entries : []\n\t\t\t\t\tconst key = this.content.answerKey || 'questionId'\n\t\t\t\t\tfor (const entry of this.recordAnswers) {\n\t\t\t\t\t\tconst qid = String(readPath(entry, key) ?? '')\n\t\t\t\t\t\tconst question = questions.find((x) => x.id === qid)\n\t\t\t\t\t\tif (question && !answerIds[qid]) {\n\t\t\t\t\t\t\tdraft[qid] = this.draftFromEntry(question, entry)\n\t\t\t\t\t\t\tanswerIds[qid] = qid\n\t\t\t\t\t\t\tconst photos = readPath(entry, this.answerFields.photos)\n\t\t\t\t\t\t\tstoredPhotos[qid] = Array.isArray(photos) ? photos : []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const answer of answers) {\n\t\t\t\t\tconst qid = String(readPath(answer, a.questionField || 'question') ?? '')\n\t\t\t\t\tif (draft[qid] && !answerIds[qid]) {\n\t\t\t\t\t\tdraft[qid] = {\n\t\t\t\t\t\t\tvalue: String(readPath(answer, a.valueField || 'answer') ?? ''),\n\t\t\t\t\t\t\tnote: String(readPath(answer, a.noteField || 'note') ?? ''),\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanswerIds[qid] = idOf(answer)\n\t\t\t\t\t\tconst stored = a.photosField ? readPath(answer, a.photosField) : null\n\t\t\t\t\t\tstoredPhotos[qid] = Array.isArray(stored) ? stored : []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.questions = questions\n\t\t\t\tthis.draft = draft\n\t\t\t\tthis.answerIds = answerIds\n\t\t\t\tthis.storedPhotos = storedPhotos\n\t\t\t\tthis.dirty = {}\n\t\t\t\tconst lastPage = Math.max(0, Math.ceil(questions.length / this.pageSize) - 1)\n\t\t\t\tif (this.positionedFor !== key && this.content?.startAt === 'firstOpen') {\n\t\t\t\t\tconst open = questions.findIndex((question) => !this.isAnswered(question))\n\t\t\t\t\tthis.page = open === -1 ? lastPage : Math.floor(open / this.pageSize)\n\t\t\t\t}\n\t\t\t\tthis.positionedFor = key\n\t\t\t\tthis.page = Math.min(this.page, lastPage)\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'The checklist could not be loaded.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Note that a question's answer changed, so the page saves it.\n\t\t *\n\t\t * @param {string} id The question id.\n\t\t * @return {void}\n\t\t */\n\t\tmarkDirty(id) {\n\t\t\tthis.dirty = { ...this.dirty, [id]: true }\n\t\t\tthis.missing = this.missing.filter((m) => m !== id)\n\t\t},\n\n\t\t/**\n\t\t * Open the file picker of the photo button's own question: the hidden\n\t\t * input that follows the button.\n\t\t *\n\t\t * @param {MouseEvent} event The button's click.\n\t\t * @return {void}\n\t\t */\n\t\topenPhotoPicker(event) {\n\t\t\tconst input = event.currentTarget.nextElementSibling\n\t\t\tif (input && input.type === 'file') {\n\t\t\t\tinput.click()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Hold the photos picked for a question until the page saves.\n\t\t *\n\t\t * @param {Event} event The file input's change event.\n\t\t * @param {string} [questionId] The question, else the first of the page.\n\t\t * @return {void}\n\t\t */\n\t\taddPhotos(event, questionId) {\n\t\t\tconst id = questionId || this.currentQuestion?.id\n\t\t\tconst files = Array.from(event?.target?.files || [])\n\t\t\tif (!id || files.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.photos = { ...this.photos, [id]: [...(this.photos[id] || []), ...files] }\n\t\t\tthis.dirty = { ...this.dirty, [id]: true }\n\t\t\tthis.missingPhoto = this.missingPhoto.filter((m) => m !== id)\n\t\t\tif (event.target) {\n\t\t\t\tevent.target.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Save the changed answers of this page: through `saveAction` when\n\t\t * set, else one answer record per question through the object API,\n\t\t * then its held photos.\n\t\t *\n\t\t * @return {Promise<boolean>} True when everything saved.\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-answers-are-saved-under-the-readers-own-rights\n\t\t */\n\t\tasync savePage() {\n\t\t\tconst changed = this.pageQuestions.filter((q) => this.dirty[q.id])\n\t\t\tif (changed.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tthis.saveError = ''\n\t\t\ttry {\n\t\t\t\tif (this.inRecord && !this.content?.saveAction) {\n\t\t\t\t\tawait this.saveIntoRecord(changed)\n\t\t\t\t\tthis.dirty = Object.fromEntries(Object.entries(this.dirty).filter(([id]) => !changed.some((q) => q.id === id)))\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tfor (const question of changed) {\n\t\t\t\t\tawait this.saveAnswer(question)\n\t\t\t\t\tconst { [question.id]: _done, ...rest } = this.dirty\n\t\t\t\t\tthis.dirty = rest\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t} catch {\n\t\t\t\tthis.saveError = t('nextcloud-vue', 'The answer could not be saved. Try again.')\n\t\t\t\treturn false\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write the changed answers of this page into the open record's\n\t\t * `answersPath` array (one entry per question, keyed by `answerKey`)\n\t\t * with one update of the record through the object API. Held photos\n\t\t * go first to the record's own files (`recordPhotosField`), and their\n\t\t * references (`photoRefField`, default `id`) into the answer.\n\t\t *\n\t\t * @param {object[]} changed The changed questions.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tasync saveIntoRecord(changed) {\n\t\t\tconst { register, schema } = this.recordRef\n\t\t\tconst objectId = idOf(this.openRecord) || String(this.openRecordId || '')\n\t\t\tif (!register || !schema || !objectId) {\n\t\t\t\tthrow new Error('no record to write to')\n\t\t\t}\n\t\t\tconst c = this.content\n\t\t\tconst af = this.answerFields\n\t\t\tconst key = c.answerKey || 'questionId'\n\t\t\tconst refField = c.photoRefField || 'id'\n\t\t\tlet recordPhotos = Array.isArray(readPath(this.openRecord, c.recordPhotosField)) ? readPath(this.openRecord, c.recordPhotosField) : []\n\t\t\tconst entries = [...this.recordAnswers]\n\t\t\tfor (const question of changed) {\n\t\t\t\tconst draft = this.draft[question.id]\n\t\t\t\tconst index = entries.findIndex((entry) => String(readPath(entry, key) ?? '') === question.id)\n\t\t\t\tconst entry = { ...(index >= 0 ? entries[index] : { [key]: question.id }) }\n\t\t\t\tif (question.kind === 'number') {\n\t\t\t\t\tentry[af.number] = draft.value === '' ? null : Number(draft.value)\n\t\t\t\t} else if (question.kind === 'choice') {\n\t\t\t\t\tentry[af.choice] = draft.value\n\t\t\t\t} else if (question.kind !== 'photo') {\n\t\t\t\t\tentry[af.value] = draft.value\n\t\t\t\t}\n\t\t\t\tif (this.allowNote) {\n\t\t\t\t\tentry[af.note] = draft.note\n\t\t\t\t}\n\t\t\t\tif (af.at) {\n\t\t\t\t\tentry[af.at] = new Date().toISOString()\n\t\t\t\t}\n\t\t\t\tconst held = this.photos[question.id] || []\n\t\t\t\tif (this.photosEnabled && held.length) {\n\t\t\t\t\tconst field = c.recordPhotosField\n\t\t\t\t\tconst { failed, attached } = await uploadHeldFiles({ register, schema, objectId, held: { [field]: held }, kept: { [field]: recordPhotos } })\n\t\t\t\t\tif (failed.length) {\n\t\t\t\t\t\tthrow new Error('photo upload failed')\n\t\t\t\t\t}\n\t\t\t\t\tconst now = Array.isArray(attached[field]) ? attached[field] : recordPhotos\n\t\t\t\t\tconst added = now.slice(recordPhotos.length).map((ref) => (ref && typeof ref === 'object' ? ref[refField] ?? ref : ref))\n\t\t\t\t\trecordPhotos = now\n\t\t\t\t\tconst existing = Array.isArray(entry[af.photos]) ? entry[af.photos] : []\n\t\t\t\t\tentry[af.photos] = [...existing, ...added]\n\t\t\t\t\tthis.storedPhotos = { ...this.storedPhotos, [question.id]: entry[af.photos] }\n\t\t\t\t\tconst { [question.id]: _sent, ...rest } = this.photos\n\t\t\t\t\tthis.photos = rest\n\t\t\t\t}\n\t\t\t\tif (index >= 0) {\n\t\t\t\t\tentries[index] = entry\n\t\t\t\t} else {\n\t\t\t\t\tentries.push(entry)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst url = generateUrl(`${OBJECT_API}/${encodeURIComponent(register)}/${encodeURIComponent(schema)}/${encodeURIComponent(objectId)}`)\n\t\t\tawait axios.patch(url, { [c.answersPath]: entries })\n\t\t\tthis.recordAnswers = entries\n\t\t},\n\n\t\t/**\n\t\t * Save one answer.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync saveAnswer(question) {\n\t\t\tconst entry = this.draft[question.id]\n\t\t\tconst answer = { questionId: question.id, value: entry.value, note: entry.note }\n\t\t\tconst action = this.content?.saveAction\n\t\t\tif (action && typeof action === 'object') {\n\t\t\t\tconst resolved = resolveDeepTokens(action, this.tokenCtx)\n\t\t\t\tconst wrapped = { ...resolved, args: [...(Array.isArray(resolved.args) ? resolved.args : []), answer] }\n\t\t\t\tconst run = typeof this.cnDispatchAction === 'function' ? this.cnDispatchAction(wrapped) : dispatchAction(wrapped, { router: this.$router || null, tokenCtx: this.tokenCtx })\n\t\t\t\tawait run\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst a = this.content?.answers\n\t\t\tif (!a || !a.register || !a.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst body = {\n\t\t\t\t[a.questionField || 'question']: question.id,\n\t\t\t\t[a.valueField || 'answer']: entry.value,\n\t\t\t}\n\t\t\tif (this.allowNote) {\n\t\t\t\tbody[a.noteField || 'note'] = entry.note\n\t\t\t}\n\t\t\tconst base = generateUrl(`${OBJECT_API}/${encodeURIComponent(a.register)}/${encodeURIComponent(a.schema)}`)\n\t\t\tlet id = this.answerIds[question.id]\n\t\t\tif (id) {\n\t\t\t\tawait axios.patch(`${base}/${encodeURIComponent(id)}`, body)\n\t\t\t} else {\n\t\t\t\tconst create = resolveDeepTokens(a.create && typeof a.create === 'object' ? a.create : {}, this.tokenCtx)\n\t\t\t\tconst response = await axios.post(base, { ...create, ...body })\n\t\t\t\tid = idOf(response?.data)\n\t\t\t\tthis.answerIds = { ...this.answerIds, [question.id]: id }\n\t\t\t}\n\t\t\tconst held = this.photos[question.id] || []\n\t\t\tif (this.photosEnabled && held.length && id) {\n\t\t\t\tconst { failed, attached } = await uploadHeldFiles({ register: a.register, schema: a.schema, objectId: id, held: { [a.photosField]: held }, kept: { [a.photosField]: this.storedPhotos[question.id] || [] } })\n\t\t\t\tif (failed.length) {\n\t\t\t\t\tthrow new Error('photo upload failed')\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(attached[a.photosField])) {\n\t\t\t\t\tthis.storedPhotos = { ...this.storedPhotos, [question.id]: attached[a.photosField] }\n\t\t\t\t}\n\t\t\t\tconst { [question.id]: _sent, ...rest } = this.photos\n\t\t\t\tthis.photos = rest\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The required questions on this page without an answer.\n\t\t *\n\t\t * @return {string[]} Their ids.\n\t\t */\n\t\tunansweredRequired() {\n\t\t\treturn this.pageQuestions.filter((q) => q.required && !this.isAnswered(q)).map((q) => q.id)\n\t\t},\n\n\t\t/**\n\t\t * Save this page and go to the next one; on the last page, finish.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-a-checklist-run-shows-a-page-of-questions-at-a-time\n\t\t */\n\t\tasync next() {\n\t\t\tthis.missing = this.unansweredRequired()\n\t\t\tthis.missingPhoto = this.photosEnabled ? this.pageQuestions.filter((q) => this.needsPhoto(q) && !this.hasPhoto(q)).map((q) => q.id) : []\n\t\t\tif (this.missing.length || this.missingPhoto.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!(await this.savePage())) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isLastPage) {\n\t\t\t\tawait this.finish()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.goTo(this.page + 1)\n\t\t},\n\n\t\t/**\n\t\t * Save this page and go back one.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync previous() {\n\t\t\tif (this.page === 0 || !(await this.savePage())) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.missing = []\n\t\t\tthis.missingPhoto = []\n\t\t\tthis.goTo(this.page - 1)\n\t\t},\n\n\t\t/**\n\t\t * Show a page, move focus to its position line and announce it.\n\t\t *\n\t\t * @param {number} page The page.\n\t\t * @return {void}\n\t\t */\n\t\tgoTo(page) {\n\t\t\tthis.page = page\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.liveText = this.positionText\n\t\t\t\tthis.$refs.position?.focus?.()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The run is done: dispatch `finishAction` when set, and emit `finished`.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync finish() {\n\t\t\tconst action = this.content?.finishAction\n\t\t\tif (action && typeof action === 'object') {\n\t\t\t\tconst resolved = resolveDeepTokens(action, this.tokenCtx)\n\t\t\t\tconst run = typeof this.cnDispatchAction === 'function' ? this.cnDispatchAction(resolved) : dispatchAction(resolved, { router: this.$router || null, tokenCtx: this.tokenCtx })\n\t\t\t\tawait run\n\t\t\t}\n\t\t\tthis.liveText = t('nextcloud-vue', 'Checklist finished.')\n\t\t\t/**\n\t\t\t * @event finished The last page was saved.\n\t\t\t * @type {{answered: number, total: number}}\n\t\t\t */\n\t\t\tthis.$emit('finished', { answered: this.answeredCount, total: this.questions.length })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-checklist-run__form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-checklist-run__position {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tline-height: 17px;\n\tmargin: 0;\n}\n\n.cn-checklist-run__progress {\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\toverflow: hidden;\n}\n\n.cn-checklist-run__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-checklist-run__live,\n.cn-checklist-run__sr {\n\tclip-path: inset(50%);\n\theight: 1px;\n\toverflow: hidden;\n\tposition: absolute;\n\twhite-space: nowrap;\n\twidth: 1px;\n}\n\n.cn-checklist-run__question,\n.cn-checklist-run__photos {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large, 12px);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin: 0;\n\tpadding: 12px 14px;\n}\n\n.cn-checklist-run__photos-title {\n\tfont-size: 15px;\n\tline-height: 1.2;\n}\n\n.cn-checklist-run__legend {\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tline-height: 1.2;\n\tpadding: 0 4px;\n}\n\n.cn-checklist-run__help {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 14px;\n\tline-height: 1.2;\n\tmargin: 0;\n}\n\n/* An option reads as text, not as a field label (a theme makes every label\n bold with !important); 15px, 31px apart, as the board draws it (DqInspectie). */\n.cn-checklist-run__choice {\n\talign-items: center;\n\tdisplay: flex;\n\tfont-size: 15px;\n\tfont-weight: 400 !important;\n\tgap: 10px;\n\tmin-height: 23px;\n}\n\n/* The board draws the radio with the browser's own 3px 3px 0 5px margin. */\n.cn-checklist-run__choice input {\n\taccent-color: var(--color-primary-element);\n\theight: 20px;\n\tmargin: 3px 3px 0 5px;\n\twidth: 20px;\n}\n\n/* The board look sizes every radio 18px with a (0,4,1) rule. */\n.cn-checklist-run__choice.cn-checklist-run__choice.cn-checklist-run__choice input[type=\"radio\"] {\n\theight: 20px;\n\tmin-height: 20px;\n\tmin-width: 20px;\n\twidth: 20px;\n}\n\n.cn-checklist-run__text,\n.cn-checklist-run__number {\n\tbox-sizing: border-box;\n\twidth: 100%;\n}\n\n/* A note is two 15px lines on the normal line height, 8px 12px in: 54px, as\n the board draws it. A theme pads every textarea 5px 12px with !important. */\n.cn-checklist-run__text.cn-checklist-run__text {\n\tpadding: 8px 12px !important;\n\tline-height: normal;\n\tmargin: 0;\n}\n\n.cn-checklist-run__group {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tline-height: normal;\n\tmargin: 0;\n}\n\n.cn-checklist-run__note-label {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tline-height: 1.2;\n}\n\n.cn-checklist-run__photo-list {\n\tmargin: 0;\n\tpadding-inline-start: 18px;\n}\n\n/* The photo button is the board's 34px secondary control across its card\n (DqInspectie, 272px), its 14px/600 label after a camera. The doubled class\n outranks Nextcloud's `button:not(.button-vue)` margin, padding and height,\n and a theme's bold label weight set with !important. */\n.cn-checklist-run__photo-button.cn-checklist-run__photo-button {\n\talign-items: center;\n\talign-self: stretch;\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--cn-board-control-border, var(--color-border-dark));\n\tborder-radius: var(--border-radius-element, 8px);\n\tbox-sizing: border-box;\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n\tdisplay: flex;\n\tfont-size: 14px;\n\tfont-weight: 600 !important;\n\tgap: 8px;\n\theight: 34px;\n\tmargin: 0;\n\tmin-height: 34px;\n\tpadding: 0 14px;\n}\n\n.cn-checklist-run__photo-button:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n\n.cn-checklist-run__photo-input {\n\tclip-path: inset(50%);\n\theight: 1px;\n\toverflow: hidden;\n\tposition: absolute;\n\twidth: 1px;\n}\n\n.cn-checklist-run__nav {\n\tdisplay: flex;\n\tjustify-content: space-between;\n}\n\n/* Previous and Next are as wide as the board draws them: the board pads the\n button 14px and the label not at all (Vorige 70.3px); NcButton's label\n padding made them 4px wider. */\n.cn-checklist-run__nav :deep(.button-vue__text) {\n\tpadding-inline: 0;\n}\n\n.cn-checklist-run__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: 0;\n}\n\n.cn-checklist-run__empty {\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_createVNode","_createElementVNode","_Fragment","_renderList","_createTextVNode","_vModelRadio","_vModelText"],"mappings":";;;AASM,EAAA,KAAK,EAAC,kBAAkB;AAAC,EAAA,aAAQ,EAAA,kBAAA;;;;AAEpC,EAAA,KAAE,EAAA,yBAAA;AACF,EAAA,IAAI,EAAC,OAAO;AACZ,EAAA,aAAW,EAAC,wBAAwB;;;;AAGrB,EAAA,KAAA,EAAA,2BAAA;;;;AAGc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,WAMU,CAAA,mBAAA,EAAA;AALV,kBAAA,OAAO,EAAC,WAAU;kBACjB,QAAQ,EAAA,KAAA,CAAA,IAAA,KAAA,CAAA,IAAA,KAAA,CAAA,MAAA;AACT,kBAAA,aAAO,EAAA,2BAAA;AACN,kBAAA,OAAK,EAAE,QAAQ,CAAA,QAAA;;mCAChB,MAAY;oDAAT,QAAS,CAAA,aAAA,CAAA,EAAA,CAAA,YAAA;;;;gBAEZA,WAMU,CAAA,mBAAA,EAAA;AALV,kBAAA,OAAO,EAAC,SAAS;AACjB,kBAAA,IAAI,EAAC,QAAI;AACR,kBAAA,QAAE,EAAA,KAAA,CAAA,MAAA;AACF,kBAAA,aAAU,EAAC,uBAAI;;mCAChB,MAA6B;oDAA1B,QAAU,CAAA,UAAA,GAAG,QAAW,CAAA,WAAA,GAAE,QAAA,CAAA,SAAA,CAAA,EAAA,CAAA,YAAA;;;;;eAGtB,KAAM,CAAA,SAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnChecklistRunWidget.vue3.js","sources":["../../../../src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue?vue&type=template&id=05891472&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-checklist-run\" data-testid=\"cn-checklist-run\">\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-checklist-run-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<div v-else-if=\"loading\" class=\"cn-checklist-run__loading\">\n\t\t\t<NcLoadingIcon :size=\"20\" :name=\"loadingLabel\" />\n\t\t</div>\n\t\t<p v-else-if=\"questions.length === 0\" class=\"cn-checklist-run__empty\" data-testid=\"cn-checklist-run-empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\t\t<form v-else\n\t\t\tclass=\"cn-checklist-run__form\"\n\t\t\tnovalidate\n\t\t\t@submit.prevent=\"next\">\n\t\t\t<p\n\t\t\t\tref=\"position\"\n\t\t\t\tclass=\"cn-checklist-run__position\"\n\t\t\t\ttabindex=\"-1\"\n\t\t\t\tdata-testid=\"cn-checklist-run-position\">\n\t\t\t\t{{ positionText }}\n\t\t\t</p>\n\t\t\t<span\n\t\t\t\tclass=\"cn-checklist-run__progress\"\n\t\t\t\trole=\"progressbar\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t:aria-valuemax=\"questions.length\"\n\t\t\t\t:aria-valuenow=\"answeredCount\"\n\t\t\t\tdata-testid=\"cn-checklist-run-progress\">\n\t\t\t\t<span class=\"cn-checklist-run__progress-fill\" :style=\"{ width: `${progressShare}%` }\" />\n\t\t\t</span>\n\t\t\t<span class=\"cn-checklist-run__live\" aria-live=\"polite\">{{ liveText }}</span>\n\n\t\t\t<p v-if=\"pageGroup\" class=\"cn-checklist-run__group\" data-testid=\"cn-checklist-run-group\">\n\t\t\t\t{{ pageGroup }}\n\t\t\t</p>\n\t\t\t<fieldset\n\t\t\t\tv-for=\"question in pageQuestions\"\n\t\t\t\t:key=\"question.id\"\n\t\t\t\tclass=\"cn-checklist-run__question\"\n\t\t\t\t:aria-describedby=\"question.help ? `${uid}-help-${question.id}` : null\"\n\t\t\t\tdata-testid=\"cn-checklist-run-question\">\n\t\t\t\t<legend class=\"cn-checklist-run__legend\">\n\t\t\t\t\t{{ question.text }}<span v-if=\"question.required\" class=\"cn-checklist-run__required\">\n\t\t\t\t\t\t<span aria-hidden=\"true\"> *</span><span class=\"cn-checklist-run__sr\">{{ requiredLabel }}</span>\n\t\t\t\t\t</span>\n\t\t\t\t</legend>\n\t\t\t\t<p v-if=\"question.help\" :id=\"`${uid}-help-${question.id}`\" class=\"cn-checklist-run__help\">\n\t\t\t\t\t{{ question.help }}\n\t\t\t\t</p>\n\t\t\t\t<template v-if=\"question.choices.length\">\n\t\t\t\t\t<label\n\t\t\t\t\t\tv-for=\"choice in question.choices\"\n\t\t\t\t\t\t:key=\"choice.value\"\n\t\t\t\t\t\tclass=\"cn-checklist-run__choice\">\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t:name=\"`${uid}-${question.id}`\"\n\t\t\t\t\t\t\t:value=\"choice.value\"\n\t\t\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\t\t\tdata-testid=\"cn-checklist-run-choice\"\n\t\t\t\t\t\t\t@change=\"markDirty(question.id)\">\n\t\t\t\t\t\t{{ choice.label }}\n\t\t\t\t\t</label>\n\t\t\t\t</template>\n\t\t\t\t<input\n\t\t\t\t\tv-else-if=\"question.kind === 'number'\"\n\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\tclass=\"cn-checklist-run__number\"\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tinputmode=\"decimal\"\n\t\t\t\t\t:aria-label=\"question.text\"\n\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-number\"\n\t\t\t\t\t@input=\"markDirty(question.id)\">\n\t\t\t\t<p v-else-if=\"question.kind === 'photo'\" class=\"cn-checklist-run__help\">\n\t\t\t\t\t{{ photoOnlyLabel }}\n\t\t\t\t</p>\n\t\t\t\t<textarea\n\t\t\t\t\tv-else\n\t\t\t\t\tv-model=\"draft[question.id].value\"\n\t\t\t\t\tclass=\"cn-checklist-run__text\"\n\t\t\t\t\trows=\"3\"\n\t\t\t\t\t:aria-label=\"question.text\"\n\t\t\t\t\t:required=\"question.required\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-text\"\n\t\t\t\t\t@input=\"markDirty(question.id)\" />\n\t\t\t\t<label v-if=\"allowNote && noteShown(question)\" class=\"cn-checklist-run__note-label\">\n\t\t\t\t\t{{ noteLabel }}\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tv-model=\"draft[question.id].note\"\n\t\t\t\t\t\tclass=\"cn-checklist-run__text\"\n\t\t\t\t\t\trows=\"2\"\n\t\t\t\t\t\tdata-testid=\"cn-checklist-run-note\"\n\t\t\t\t\t\t@input=\"markDirty(question.id)\" />\n\t\t\t\t</label>\n\t\t\t\t<p\n\t\t\t\t\tv-if=\"missing.includes(question.id)\"\n\t\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-missing\">\n\t\t\t\t\t{{ missingLabel }}\n\t\t\t\t</p>\n\t\t\t</fieldset>\n\n\t\t\t<div\n\t\t\t\tv-for=\"question in photoQuestions\"\n\t\t\t\t:key=\"`photos-${question.id}`\"\n\t\t\t\tclass=\"cn-checklist-run__photos\"\n\t\t\t\tdata-testid=\"cn-checklist-run-photos\">\n\t\t\t\t<strong class=\"cn-checklist-run__photos-title\">{{ photoTitle(question) }}</strong>\n\t\t\t\t<ul v-if=\"photoNamesFor(question).length\" class=\"cn-checklist-run__photo-list\">\n\t\t\t\t\t<li v-for=\"name in photoNamesFor(question)\" :key=\"name\" data-testid=\"cn-checklist-run-photo\">\n\t\t\t\t\t\t{{ name }}\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t\t<!-- A button that opens the hidden file input, so the control is\n\t\t\t\t a button to every reader; the input stays out of the tab\n\t\t\t\t order and the accessibility tree. -->\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-checklist-run__photo-button\"\n\t\t\t\t\t:aria-describedby=\"missingPhoto.includes(question.id) ? `${uid}-photo-${question.id}` : null\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-photo-button\"\n\t\t\t\t\t@click=\"openPhotoPicker\">\n\t\t\t\t\t<CameraOutline :size=\"16\" />\n\t\t\t\t\t{{ photoNamesFor(question).length || (storedPhotos[question.id] || []).length ? morePhotoLabel : addPhotoLabel }}\n\t\t\t\t</button>\n\t\t\t\t<input\n\t\t\t\t\tclass=\"cn-checklist-run__photo-input\"\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tcapture=\"environment\"\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-photo-input\"\n\t\t\t\t\t@change=\"addPhotos($event, question.id)\">\n\t\t\t\t<p\n\t\t\t\t\tv-if=\"missingPhoto.includes(question.id)\"\n\t\t\t\t\t:id=\"`${uid}-photo-${question.id}`\"\n\t\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\t\trole=\"alert\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-missing-photo\">\n\t\t\t\t\t{{ missingPhotoLabel }}\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t<div class=\"cn-checklist-run__nav\">\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t:disabled=\"page === 0 || saving\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-previous\"\n\t\t\t\t\t@click=\"previous\">\n\t\t\t\t\t{{ previousLabel }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t:disabled=\"saving\"\n\t\t\t\t\tdata-testid=\"cn-checklist-run-next\">\n\t\t\t\t\t{{ isLastPage ? finishLabel : nextLabel }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t\t<p v-if=\"saveError\"\n\t\t\t\tclass=\"cn-checklist-run__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-checklist-run-save-error\">\n\t\t\t\t{{ saveError }}\n\t\t\t</p>\n\t\t</form>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport CameraOutline from 'vue-material-design-icons/CameraOutline.vue'\nimport { uploadHeldFiles } from '../../composables/useHeldFileUpload.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { hasUnresolvedTokens, resolveDeepTokens, resolveFilterTokens } from '../../utils/resolveFilterTokens.js'\n\nconst OBJECT_API = '/apps/openregister/api/objects'\n\nlet instanceCounter = 0\n\n/**\n * The choices a question type offers, before translation.\n *\n * @type {Record<string, Array<{value: string, label: string}>>}\n */\nconst TYPE_CHOICES = Object.freeze({\n\tyes_no: [{ key: 'yes', label: 'Yes' }, { key: 'no', label: 'No' }],\n\tyes_no_na: [{ key: 'yes', label: 'Yes' }, { key: 'no', label: 'No' }, { key: 'na', label: 'Not applicable' }],\n})\n\n/** The kinds of question the widget draws. */\nconst KINDS = Object.freeze(['yes_no', 'yes_no_na', 'choice', 'text', 'number', 'photo'])\n\n/**\n * Sort by a numeric field, lowest first, keeping the given order for ties and\n * for entries without the field.\n *\n * @param {Array<object>} list The entries.\n * @param {string} field The field.\n * @return {Array<object>} A sorted copy.\n */\nfunction byOrder(list, field) {\n\tif (!field) {\n\t\treturn [...list]\n\t}\n\tconst rank = (entry) => {\n\t\tconst n = Number(readPath(entry, field))\n\t\treturn Number.isFinite(n) ? n : Infinity\n\t}\n\treturn list.map((entry, index) => ({ entry, index })).sort((a, b) => (rank(a.entry) - rank(b.entry)) || (a.index - b.index)).map(({ entry }) => entry)\n}\n\n/**\n * A register or schema as the object API path takes it.\n *\n * @param {string|object} value A slug, or a register/schema object.\n * @return {string} The slug or id.\n */\nfunction slugOf(value) {\n\tif (value && typeof value === 'object') {\n\t\treturn String(value.slug ?? value.id ?? '')\n\t}\n\treturn value ? String(value) : ''\n}\n\n/**\n * The id of an object, wherever OpenRegister carries it.\n *\n * @param {object|null} object The object.\n * @return {string} The id, or ''.\n */\nfunction idOf(object) {\n\treturn String(object?.id ?? object?.['@self']?.id ?? object?.uuid ?? '')\n}\n\n/**\n * CnChecklistRunWidget — the `checklist-run` widget: a checklist answered a\n * page of questions at a time (board DqInspectie, the middle phone frame).\n *\n * The questions are records of a register, listed with a token-resolved\n * filter. Each page shows `pageSize` questions (one by default) as radio\n * choices or a text field, an optional note, and photos for the first\n * question of the page, then Previous and Next. The answers of a page are\n * saved when the user moves on.\n *\n * Answers are stored one record per question through the OpenRegister object\n * API, under the reader's own rights: an existing answer is updated, a new\n * one created with the `answers.create` fields. Photos go up through the\n * object's own file upload (`uploadHeldFiles`) and are attached to the\n * answer's `photosField`. An app that stores answers its own way names a\n * `saveAction` instead; it is dispatched per answer with the answer as its\n * last argument, and photos are not uploaded then.\n *\n * ```json\n * {\n * \"type\": \"checklist-run\",\n * \"content\": {\n * \"questions\": { \"register\": \"app\", \"schema\": \"question\", \"filter\": { \"checklist\": \"@object.checklist\" }, \"orderField\": \"position\" },\n * \"fields\": { \"text\": \"text\", \"type\": \"type\", \"options\": \"options\", \"required\": \"required\", \"help\": \"help\" },\n * \"answers\": {\n * \"register\": \"app\", \"schema\": \"answer\", \"filter\": { \"run\": \"@objectId\" },\n * \"questionField\": \"question\", \"valueField\": \"answer\", \"noteField\": \"note\", \"photosField\": \"photos\",\n * \"create\": { \"run\": \"@objectId\" }\n * },\n * \"pageSize\": 1,\n * \"caption\": \"{title} version {version}\"\n * }\n * }\n * ```\n *\n * The questions and answers can also live inside the open record:\n * `questionsPath` (with `itemsKey` for groups, both sorted by `orderField`)\n * reads the questions off it, and `answersPath` writes the answers into an\n * array on it, one entry per question keyed by `answerKey`, by updating the\n * record through the object API. Photos then go to the record's own files\n * (`recordPhotosField`) and their references into the answer.\n *\n * A question can require a photo: `fields.photoRequired` names its rule,\n * `photoRequiredValues` maps the stored values onto `never`, `always` or\n * `{ whenAnswer }`, and the page holds until the photo is there. On a page\n * with no bound record, `record: { register, schema, filter, sort }` picks\n * the open record: the first match, under the reader's rights.\n *\n * `noteWhen: { answers: [...] }` shows a question's note field only once its\n * answer is one of those stored values (the board shows a note under \"Nee\"),\n * or when the question already holds a note; without it every question shows\n * one (`allowNote: false` hides them all).\n *\n * `startAt: \"firstOpen\"` opens a run that was started earlier at the page of\n * its first unanswered question (the last page when all are answered), once\n * per record; `startAt: \"lastAnswered\"` at the page of its last answered\n * question, where the inspector was; without it the run opens at the first\n * page.\n *\n * Question kinds: `yes_no`, `yes_no_na`, `choice` (the question's `options`,\n * a list of strings or `{ value, label }`), `number`, `photo` and `text`.\n * `typeMap` maps the app's type values onto them, `choiceValues` the stored\n * values of yes / no / not applicable.\n * Keyboard: the choices are native radio buttons in a fieldset whose legend is\n * the question; on a new page focus moves to the position line and a polite\n * live region reads it.\n */\nexport default {\n\tname: 'CnChecklistRunWidget',\n\n\tcomponents: { CameraOutline, NcButton, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The detail page's object context (`{ objectId, object }`), for tokens. */\n\t\tcnObjectContext: { default: null },\n\t\t/** The page's workspace values, for `@workspace.<key>` tokens. */\n\t\tcnWorkspaceContext: { default: null },\n\t\t/** The host's translate, for manifest texts and question texts. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher, for `saveAction` / `finishAction`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ questions | questionsPath, itemsKey?,\n\t\t * groupLabelField?, orderField?, fields?, typeMap?, choiceValues?,\n\t\t * answers | answersPath, answerKey?, answerFields?, recordPhotosField?,\n\t\t * record?, saveAction?, finishAction?, pageSize?, allowNote?, noteWhen?,\n\t\t * allowPhotos?, caption?, emptyText? }`, as in the component\n\t\t * description and docs/components/cn-checklist-run-widget.md.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record's id, for `@objectId`. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record, for `@object.<field>`, the caption and `questionsPath` / `answersPath`. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's register, for writing `answersPath` (`content.record` wins). */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record's schema, for writing `answersPath` (`content.record` wins). */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['finished'],\n\n\tdata() {\n\t\tinstanceCounter += 1\n\t\treturn {\n\t\t\tuid: `cn-checklist-run-${instanceCounter}`,\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t\tsaving: false,\n\t\t\tsaveError: '',\n\t\t\tquestions: [],\n\t\t\tanswerIds: {},\n\t\t\t// Photos an answer already holds, kept when new ones are attached.\n\t\t\tstoredPhotos: {},\n\t\t\t// `answersPath` mode: the answer entries as last read or written.\n\t\t\trecordAnswers: [],\n\t\t\tdraft: {},\n\t\t\tdirty: {},\n\t\t\tphotos: {},\n\t\t\tpage: 0,\n\t\t\t// The source the page was last positioned for; `startAt` applies once per source.\n\t\t\tpositionedFor: '',\n\t\t\tmissing: [],\n\t\t\t// Questions on this page that still need their photo.\n\t\t\tmissingPhoto: [],\n\t\t\t// `content.record` with a filter: the record it picked, or null.\n\t\t\tpickedRecord: null,\n\t\t\tliveText: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} What the tokens resolve against. */\n\t\ttokenCtx() {\n\t\t\tconst unwrap = (c) => (c && typeof c === 'object' && 'value' in c ? c.value : c)\n\t\t\tconst injected = unwrap(this.cnObjectContext) || {}\n\t\t\treturn {\n\t\t\t\t...injected,\n\t\t\t\tobjectId: (this.pickedRecord && idOf(this.pickedRecord)) || this.objectId || injected.objectId || this.objectData?.id || null,\n\t\t\t\tobject: this.pickedRecord || this.objectData || injected.object || null,\n\t\t\t\tworkspace: unwrap(this.cnWorkspaceContext) || {},\n\t\t\t}\n\t\t},\n\n\t\t/** @return {object} The question field paths, with their defaults. */\n\t\tfields() {\n\t\t\treturn { id: 'id', text: 'text', type: 'type', options: 'options', required: 'required', help: 'help', ...(this.content?.fields || {}) }\n\t\t},\n\n\t\t/** @return {number} Questions per page, at least 1. */\n\t\tpageSize() {\n\t\t\tconst n = Math.floor(Number(this.content?.pageSize))\n\t\t\treturn Number.isFinite(n) && n >= 1 ? n : 1\n\t\t},\n\n\t\t/** @return {number} The number of pages. */\n\t\tpageCount() {\n\t\t\treturn Math.max(1, Math.ceil(this.questions.length / this.pageSize))\n\t\t},\n\n\t\t/** @return {boolean} Whether this is the last page. */\n\t\tisLastPage() {\n\t\t\treturn this.page >= this.pageCount - 1\n\t\t},\n\n\t\t/** @return {object[]} The questions on this page. */\n\t\tpageQuestions() {\n\t\t\treturn this.questions.slice(this.page * this.pageSize, (this.page + 1) * this.pageSize)\n\t\t},\n\n\t\t/** @return {object|null} The first question on this page, the one photos belong to. */\n\t\tcurrentQuestion() {\n\t\t\treturn this.pageQuestions[0] || null\n\t\t},\n\n\t\t/** @return {number} Questions with an answer. */\n\t\tansweredCount() {\n\t\t\treturn this.questions.filter((q) => this.isAnswered(q)).length\n\t\t},\n\n\t\t/** @return {number} The share answered, 0 to 100. */\n\t\tprogressShare() {\n\t\t\treturn this.questions.length ? Math.round((this.answeredCount / this.questions.length) * 100) : 0\n\t\t},\n\n\t\t/** @return {string} \"Question 7 of 24\", with the caption after it. */\n\t\tpositionText() {\n\t\t\tconst first = this.page * this.pageSize + 1\n\t\t\tconst position = t('nextcloud-vue', 'Question {n} of {total}', { n: first, total: this.questions.length })\n\t\t\tconst caption = this.caption\n\t\t\treturn caption ? `${position} · ${caption}` : position\n\t\t},\n\n\t\t/** @return {string} `content.caption` with `{field}` filled from the record. */\n\t\tcaption() {\n\t\t\tconst template = this.content?.caption\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst object = this.tokenCtx.object || {}\n\t\t\treturn this.translate(template).replace(/\\{([A-Za-z0-9_.]+)\\}/g, (_m, path) => {\n\t\t\t\tconst value = readPath(object, path)\n\t\t\t\treturn value === null || value === undefined ? '' : String(value)\n\t\t\t}).trim()\n\t\t},\n\n\t\t/** @return {boolean} Whether a note field shows (default true). */\n\t\tallowNote() {\n\t\t\treturn this.content?.allowNote !== false\n\t\t},\n\n\t\t/** @return {boolean} Whether the answers are written into an array on the open record. */\n\t\tinRecord() {\n\t\t\treturn typeof this.content?.answersPath === 'string' && this.content.answersPath !== ''\n\t\t},\n\n\t\t/** @return {object} `answersPath` field names, with their defaults. */\n\t\tanswerFields() {\n\t\t\treturn { value: 'value', number: 'value', choice: 'value', note: 'note', photos: 'photos', ...(this.content?.answerFields || {}) }\n\t\t},\n\n\t\t/** @return {{register: string, schema: string}} Where the open record lives. */\n\t\trecordRef() {\n\t\t\tconst own = this.content?.record || {}\n\t\t\treturn { register: slugOf(own.register || this.register), schema: slugOf(own.schema || this.schema) }\n\t\t},\n\n\t\t/**\n\t\t * Whether photos can be added: allowed, and somewhere to put them.\n\t\t *\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tphotosEnabled() {\n\t\t\tif (this.content?.allowPhotos === false || this.content?.saveAction) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.inRecord) {\n\t\t\t\treturn Boolean(this.content?.recordPhotosField && this.answerFields.photos)\n\t\t\t}\n\t\t\treturn Boolean(this.content?.answers?.photosField)\n\t\t},\n\n\t\t/** @return {string} The group (section) of this page's first question, or ''. */\n\t\tpageGroup() {\n\t\t\treturn this.currentQuestion?.group || ''\n\t\t},\n\n\t\t/**\n\t\t * The questions of this page that get a photo control: with a\n\t\t * `photoRequired` field, those whose rule is not never (and photo\n\t\t * questions), less a `{ whenAnswer }` question answered otherwise that\n\t\t * holds no photo; without one, the first question of the page.\n\t\t *\n\t\t * @return {object[]} The questions.\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-question-can-require-a-photo\n\t\t */\n\t\tphotoQuestions() {\n\t\t\tif (!this.photosEnabled) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tif (this.fields.photoRequired) {\n\t\t\t\treturn this.pageQuestions.filter((q) => q.kind === 'photo' || (q.photoRule !== 'never' && !this.photoRuledOut(q)))\n\t\t\t}\n\t\t\tconst first = this.currentQuestion\n\t\t\tconst extra = this.pageQuestions.filter((q) => q.kind === 'photo' && q !== first)\n\t\t\treturn first ? [first, ...extra] : extra\n\t\t},\n\n\t\t/**\n\t\t * `content.record` with a `filter`: the list to pick the open record\n\t\t * from (first match of `sort`), `'blocked'` while a token is\n\t\t * unresolved, or null without a filter.\n\t\t *\n\t\t * @return {object|string|null}\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-checklist-run-can-pick-its-record-by-filter\n\t\t */\n\t\trecordPicker() {\n\t\t\tconst own = this.content?.record\n\t\t\tif (!own || typeof own !== 'object' || !own.filter || typeof own.filter !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst unwrap = (c) => (c && typeof c === 'object' && 'value' in c ? c.value : c)\n\t\t\tconst filter = resolveFilterTokens(own.filter, { objectId: this.objectId || null, object: this.objectData, workspace: unwrap(this.cnWorkspaceContext) || {} })\n\t\t\tif (hasUnresolvedTokens(filter)) {\n\t\t\t\treturn 'blocked'\n\t\t\t}\n\t\t\tconst sort = own.sort && typeof own.sort === 'object' && own.sort.field ? { [`_order[${own.sort.field}]`]: own.sort.dir === 'asc' ? 'asc' : 'desc' } : {}\n\t\t\treturn { register: slugOf(own.register), schema: slugOf(own.schema), filter: { ...filter, ...sort } }\n\t\t},\n\n\t\t/** @return {object|null} The record the run lives in: the picked one, else the bound one. */\n\t\topenRecord() {\n\t\t\treturn this.recordPicker ? this.pickedRecord : this.tokenCtx.object\n\t\t},\n\n\t\t/** @return {string} The key of the source lists, to read them again when they change. */\n\t\tsourceKey() {\n\t\t\tconst picker = this.recordPicker\n\t\t\tif (picker === 'blocked') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (picker && typeof this.content?.questionsPath === 'string' && this.content.questionsPath !== '') {\n\t\t\t\treturn JSON.stringify({ pick: picker, path: this.content.questionsPath })\n\t\t\t}\n\t\t\tif (typeof this.content?.questionsPath === 'string' && this.content.questionsPath !== '') {\n\t\t\t\tconst object = this.tokenCtx.object\n\t\t\t\treturn object ? JSON.stringify({ path: this.content.questionsPath, id: idOf(object), at: object['@self']?.updated ?? null }) : ''\n\t\t\t}\n\t\t\tconst q = this.content?.questions\n\t\t\tif (!q || !q.register || !q.schema) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst qFilter = resolveFilterTokens(q.filter || {}, this.tokenCtx)\n\t\t\tconst a = this.content?.answers\n\t\t\tconst aFilter = a && a.register && a.schema ? resolveFilterTokens(a.filter || {}, this.tokenCtx) : null\n\t\t\tif (hasUnresolvedTokens(qFilter) || (aFilter && hasUnresolvedTokens(aFilter))) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn JSON.stringify({ q: [q.register, q.schema, qFilter], a: aFilter ? [a.register, a.schema, aFilter] : null })\n\t\t},\n\n\t\tloadingLabel: () => t('nextcloud-vue', 'Loading …'),\n\t\tprogressLabel: () => t('nextcloud-vue', 'Questions answered'),\n\t\trequiredLabel: () => ` ${t('nextcloud-vue', '(required)')}`,\n\t\tmissingLabel: () => t('nextcloud-vue', 'Answer this question to go on.'),\n\t\tpreviousLabel: () => t('nextcloud-vue', 'Previous'),\n\t\tnextLabel: () => t('nextcloud-vue', 'Next'),\n\t\tfinishLabel: () => t('nextcloud-vue', 'Finish'),\n\t\taddPhotoLabel: () => t('nextcloud-vue', 'Take or add a photo'),\n\t\tmissingPhotoLabel: () => t('nextcloud-vue', 'This answer needs a photo. Add one to go on.'),\n\t\tphotoOnlyLabel: () => t('nextcloud-vue', 'Answer with a photo.'),\n\t\tmorePhotoLabel: () => t('nextcloud-vue', 'Another photo'),\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.content?.noteLabel ? this.translate(this.content.noteLabel) : t('nextcloud-vue', 'Note')\n\t\t},\n\n\t\t/** @return {string} The empty-state text. */\n\t\temptyLabel() {\n\t\t\treturn this.content?.emptyText ? this.translate(this.content.emptyText) : t('nextcloud-vue', 'This checklist has no questions.')\n\t\t},\n\t},\n\n\twatch: {\n\t\tsourceKey: {\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\n\t\t\timmediate: true,\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Whether a question shows its note field: always, unless `noteWhen`\n\t\t * names the answers that ask for one and this question has none of\n\t\t * them and no note yet.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean}\n\t\t */\n\t\tnoteShown(question) {\n\t\t\tconst answers = this.content?.noteWhen?.answers\n\t\t\tif (!Array.isArray(answers)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tconst draft = this.draft[question.id] || {}\n\t\t\treturn (draft.note || '') !== '' || answers.map(String).includes(String(draft.value ?? ''))\n\t\t},\n\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Whether a value counts as an answer.\n\t\t *\n\t\t * @param {unknown} value The value.\n\t\t * @return {boolean} True for a non-empty value.\n\t\t */\n\t\thasValue(value) {\n\t\t\treturn value !== null && value !== undefined && String(value).trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether a question has an answer: a value, or for a photo question\n\t\t * a photo stored or held.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True when answered.\n\t\t */\n\t\tisAnswered(question) {\n\t\t\tif (question.kind === 'photo') {\n\t\t\t\treturn this.hasPhoto(question)\n\t\t\t}\n\t\t\treturn this.hasValue(this.draft[question.id]?.value)\n\t\t},\n\n\t\t/**\n\t\t * A question record as the widget draws it.\n\t\t *\n\t\t * @param {object} record The question record.\n\t\t * @param {string} [group] The group (section) it belongs to.\n\t\t * @return {{id: string, text: string, kind: string, required: boolean, help: string, choices: Array<{value: string, label: string}>, group: string}} The question.\n\t\t */\n\t\ttoQuestion(record, group = '') {\n\t\t\tconst f = this.fields\n\t\t\tconst raw = String(readPath(record, f.type) ?? '')\n\t\t\tconst mapped = this.content?.typeMap && typeof this.content.typeMap === 'object' ? this.content.typeMap[raw] : undefined\n\t\t\tconst kind = KINDS.includes(mapped) ? mapped : (KINDS.includes(raw) ? raw : 'text')\n\t\t\tconst stored = { yes: 'yes', no: 'no', na: 'na', ...(this.content?.choiceValues || {}) }\n\t\t\tlet choices = (TYPE_CHOICES[kind] || []).map((c) => ({ value: String(stored[c.key]), label: t('nextcloud-vue', c.label) }))\n\t\t\tif (kind === 'choice') {\n\t\t\t\tconst options = readPath(record, f.options)\n\t\t\t\tchoices = (Array.isArray(options) ? options : []).map((o) => (o && typeof o === 'object'\n\t\t\t\t\t? { value: String(o.value ?? o.label ?? ''), label: this.translate(String(o.label ?? o.value ?? '')) }\n\t\t\t\t\t: { value: String(o), label: this.translate(String(o)) })).filter((c) => c.value !== '')\n\t\t\t}\n\t\t\tconst help = readPath(record, f.help)\n\t\t\treturn {\n\t\t\t\tid: String(readPath(record, f.id) ?? idOf(record)),\n\t\t\t\ttext: this.translate(String(readPath(record, f.text) ?? '')),\n\t\t\t\tkind,\n\t\t\t\trequired: Boolean(readPath(record, f.required)),\n\t\t\t\thelp: typeof help === 'string' && help !== '' ? this.translate(help) : '',\n\t\t\t\tchoices,\n\t\t\t\tgroup,\n\t\t\t\tphotoRule: this.photoRuleOf(record),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A question's photo rule, from its `photoRequired` field mapped\n\t\t * through `photoRequiredValues`: `'never'`, `'always'` or\n\t\t * `{ whenAnswer }` (a photo is needed when the answer is that value).\n\t\t *\n\t\t * @param {object} record The question record.\n\t\t * @return {('never'|'always'|{whenAnswer: string})} The rule.\n\t\t * @spec openspec/changes/checklist-run-photo-rule/specs/checklist-run-photo-rule/spec.md#requirement-a-question-can-require-a-photo\n\t\t */\n\t\tphotoRuleOf(record) {\n\t\t\tconst path = this.fields.photoRequired\n\t\t\tif (!path) {\n\t\t\t\treturn 'never'\n\t\t\t}\n\t\t\tconst raw = readPath(record, path)\n\t\t\tconst map = { true: 'always', false: 'never', always: 'always', never: 'never', ...(this.content?.photoRequiredValues || {}) }\n\t\t\tconst rule = raw === null || raw === undefined ? 'never' : map[String(raw)]\n\t\t\tif (rule && typeof rule === 'object' && rule.whenAnswer !== undefined) {\n\t\t\t\treturn { whenAnswer: String(rule.whenAnswer) }\n\t\t\t}\n\t\t\treturn rule === 'always' ? 'always' : 'never'\n\t\t},\n\n\t\t/**\n\t\t * Whether a question needs a photo with its current answer.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True when a photo is required now.\n\t\t */\n\t\tneedsPhoto(question) {\n\t\t\tconst rule = question.photoRule\n\t\t\tif (rule === 'always') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn Boolean(rule && typeof rule === 'object' && String(this.draft[question.id]?.value ?? '') === rule.whenAnswer)\n\t\t},\n\n\t\t/**\n\t\t * Whether a question's answer rules its photo out: a `{ whenAnswer }`\n\t\t * question answered with another value and holding no photo.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True when no photo control is needed.\n\t\t */\n\t\tphotoRuledOut(question) {\n\t\t\tconst rule = question.photoRule\n\t\t\tconst value = String(this.draft[question.id]?.value ?? '')\n\t\t\treturn Boolean(rule && typeof rule === 'object' && value !== '' && value !== rule.whenAnswer && !this.hasPhoto(question))\n\t\t},\n\n\t\t/**\n\t\t * Whether a question has a photo, stored or held.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {boolean} True with at least one photo.\n\t\t */\n\t\thasPhoto(question) {\n\t\t\treturn (this.storedPhotos[question.id] || []).length > 0 || (this.photos[question.id] || []).length > 0\n\t\t},\n\n\t\t/**\n\t\t * The photo card title for a question: its position in the run.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {string} The title.\n\t\t */\n\t\tphotoTitle(question) {\n\t\t\tconst n = this.questions.indexOf(question) + 1\n\t\t\treturn t('nextcloud-vue', 'Photo for question {n}', { n })\n\t\t},\n\n\t\t/**\n\t\t * The names of the photos held for a question.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {string[]} The file names.\n\t\t */\n\t\tphotoNamesFor(question) {\n\t\t\treturn (this.photos[question.id] || []).map((file) => file.name)\n\t\t},\n\n\t\t/**\n\t\t * The questions on the open record (`questionsPath`): a list of\n\t\t * questions, or of groups whose `itemsKey` holds them, both levels\n\t\t * sorted by `orderField`.\n\t\t *\n\t\t * @return {object[]} The questions.\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tquestionsFromRecord() {\n\t\t\tconst c = this.content\n\t\t\tconst list = readPath(this.openRecord, c.questionsPath)\n\t\t\tconst orderField = c.orderField === undefined ? 'order' : c.orderField\n\t\t\tconst top = byOrder(Array.isArray(list) ? list : [], orderField)\n\t\t\tif (!c.itemsKey) {\n\t\t\t\treturn top.map((record) => this.toQuestion(record))\n\t\t\t}\n\t\t\tconst labelField = c.groupLabelField || 'name'\n\t\t\treturn top.flatMap((group) => {\n\t\t\t\tconst items = readPath(group, c.itemsKey)\n\t\t\t\tconst label = readPath(group, labelField)\n\t\t\t\treturn byOrder(Array.isArray(items) ? items : [], orderField).map((record) => this.toQuestion(record, typeof label === 'string' ? this.translate(label) : ''))\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The draft of one answer entry from the open record's `answersPath`.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @param {object} entry The stored entry.\n\t\t * @return {{value: string, note: string}} The draft.\n\t\t */\n\t\tdraftFromEntry(question, entry) {\n\t\t\tconst af = this.answerFields\n\t\t\tconst field = question.kind === 'number' ? af.number : (question.kind === 'choice' ? af.choice : af.value)\n\t\t\tconst value = readPath(entry, field)\n\t\t\tconst note = readPath(entry, af.note)\n\t\t\treturn { value: value === null || value === undefined ? '' : String(value), note: note === null || note === undefined ? '' : String(note) }\n\t\t},\n\n\t\t/**\n\t\t * Read the questions and the answers given so far.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-a-checklist-run-shows-a-page-of-questions-at-a-time\n\t\t */\n\t\tasync load() {\n\t\t\tconst key = this.sourceKey\n\t\t\tif (key === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst picker = this.recordPicker\n\t\t\t\tif (picker) {\n\t\t\t\t\tconst found = await fetchReferenceObjects({ register: picker.register, schema: picker.schema, filter: picker.filter, limit: 1 })\n\t\t\t\t\tif (key !== this.sourceKey) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthis.pickedRecord = found[0] || null\n\t\t\t\t}\n\t\t\t\tlet questions\n\t\t\t\tif (picker && !this.pickedRecord) {\n\t\t\t\t\tquestions = []\n\t\t\t\t} else if (this.content.questionsPath) {\n\t\t\t\t\tquestions = this.questionsFromRecord()\n\t\t\t\t} else {\n\t\t\t\t\tconst q = this.content.questions\n\t\t\t\t\tconst records = await fetchReferenceObjects({ register: q.register, schema: q.schema, filter: resolveFilterTokens(q.filter || {}, this.tokenCtx), limit: q.limit || 500 })\n\t\t\t\t\tquestions = byOrder(records, q.orderField).map((r) => this.toQuestion(r))\n\t\t\t\t}\n\t\t\t\tquestions = questions.filter((x) => x.id !== '' && x.text !== '')\n\t\t\t\tconst a = this.inRecord ? null : this.content.answers\n\t\t\t\tconst answers = a && a.register && a.schema\n\t\t\t\t\t? await fetchReferenceObjects({ register: a.register, schema: a.schema, filter: resolveFilterTokens(a.filter || {}, this.tokenCtx), limit: a.limit || 500 })\n\t\t\t\t\t: []\n\t\t\t\tif (key !== this.sourceKey) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst draft = {}\n\t\t\t\tconst answerIds = {}\n\t\t\t\tconst storedPhotos = {}\n\t\t\t\tfor (const question of questions) {\n\t\t\t\t\tdraft[question.id] = { value: '', note: '' }\n\t\t\t\t}\n\t\t\t\tif (this.inRecord) {\n\t\t\t\t\tconst entries = readPath(this.openRecord, this.content.answersPath)\n\t\t\t\t\tthis.recordAnswers = Array.isArray(entries) ? entries : []\n\t\t\t\t\tconst key = this.content.answerKey || 'questionId'\n\t\t\t\t\tfor (const entry of this.recordAnswers) {\n\t\t\t\t\t\tconst qid = String(readPath(entry, key) ?? '')\n\t\t\t\t\t\tconst question = questions.find((x) => x.id === qid)\n\t\t\t\t\t\tif (question && !answerIds[qid]) {\n\t\t\t\t\t\t\tdraft[qid] = this.draftFromEntry(question, entry)\n\t\t\t\t\t\t\tanswerIds[qid] = qid\n\t\t\t\t\t\t\tconst photos = readPath(entry, this.answerFields.photos)\n\t\t\t\t\t\t\tstoredPhotos[qid] = Array.isArray(photos) ? photos : []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const answer of answers) {\n\t\t\t\t\tconst qid = String(readPath(answer, a.questionField || 'question') ?? '')\n\t\t\t\t\tif (draft[qid] && !answerIds[qid]) {\n\t\t\t\t\t\tdraft[qid] = {\n\t\t\t\t\t\t\tvalue: String(readPath(answer, a.valueField || 'answer') ?? ''),\n\t\t\t\t\t\t\tnote: String(readPath(answer, a.noteField || 'note') ?? ''),\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanswerIds[qid] = idOf(answer)\n\t\t\t\t\t\tconst stored = a.photosField ? readPath(answer, a.photosField) : null\n\t\t\t\t\t\tstoredPhotos[qid] = Array.isArray(stored) ? stored : []\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.questions = questions\n\t\t\t\tthis.draft = draft\n\t\t\t\tthis.answerIds = answerIds\n\t\t\t\tthis.storedPhotos = storedPhotos\n\t\t\t\tthis.dirty = {}\n\t\t\t\tconst lastPage = Math.max(0, Math.ceil(questions.length / this.pageSize) - 1)\n\t\t\t\tif (this.positionedFor !== key && this.content?.startAt === 'firstOpen') {\n\t\t\t\t\tconst open = questions.findIndex((question) => !this.isAnswered(question))\n\t\t\t\t\tthis.page = open === -1 ? lastPage : Math.floor(open / this.pageSize)\n\t\t\t\t} else if (this.positionedFor !== key && this.content?.startAt === 'lastAnswered') {\n\t\t\t\t\tconst last = questions.findLastIndex((question) => this.isAnswered(question))\n\t\t\t\t\tthis.page = last === -1 ? 0 : Math.floor(last / this.pageSize)\n\t\t\t\t}\n\t\t\t\tthis.positionedFor = key\n\t\t\t\tthis.page = Math.min(this.page, lastPage)\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'The checklist could not be loaded.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Note that a question's answer changed, so the page saves it.\n\t\t *\n\t\t * @param {string} id The question id.\n\t\t * @return {void}\n\t\t */\n\t\tmarkDirty(id) {\n\t\t\tthis.dirty = { ...this.dirty, [id]: true }\n\t\t\tthis.missing = this.missing.filter((m) => m !== id)\n\t\t},\n\n\t\t/**\n\t\t * Open the file picker of the photo button's own question: the hidden\n\t\t * input that follows the button.\n\t\t *\n\t\t * @param {MouseEvent} event The button's click.\n\t\t * @return {void}\n\t\t */\n\t\topenPhotoPicker(event) {\n\t\t\tconst input = event.currentTarget.nextElementSibling\n\t\t\tif (input && input.type === 'file') {\n\t\t\t\tinput.click()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Hold the photos picked for a question until the page saves.\n\t\t *\n\t\t * @param {Event} event The file input's change event.\n\t\t * @param {string} [questionId] The question, else the first of the page.\n\t\t * @return {void}\n\t\t */\n\t\taddPhotos(event, questionId) {\n\t\t\tconst id = questionId || this.currentQuestion?.id\n\t\t\tconst files = Array.from(event?.target?.files || [])\n\t\t\tif (!id || files.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.photos = { ...this.photos, [id]: [...(this.photos[id] || []), ...files] }\n\t\t\tthis.dirty = { ...this.dirty, [id]: true }\n\t\t\tthis.missingPhoto = this.missingPhoto.filter((m) => m !== id)\n\t\t\tif (event.target) {\n\t\t\t\tevent.target.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Save the changed answers of this page: through `saveAction` when\n\t\t * set, else one answer record per question through the object API,\n\t\t * then its held photos.\n\t\t *\n\t\t * @return {Promise<boolean>} True when everything saved.\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-answers-are-saved-under-the-readers-own-rights\n\t\t */\n\t\tasync savePage() {\n\t\t\tconst changed = this.pageQuestions.filter((q) => this.dirty[q.id])\n\t\t\tif (changed.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tthis.saving = true\n\t\t\tthis.saveError = ''\n\t\t\ttry {\n\t\t\t\tif (this.inRecord && !this.content?.saveAction) {\n\t\t\t\t\tawait this.saveIntoRecord(changed)\n\t\t\t\t\tthis.dirty = Object.fromEntries(Object.entries(this.dirty).filter(([id]) => !changed.some((q) => q.id === id)))\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tfor (const question of changed) {\n\t\t\t\t\tawait this.saveAnswer(question)\n\t\t\t\t\tconst { [question.id]: _done, ...rest } = this.dirty\n\t\t\t\t\tthis.dirty = rest\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t} catch {\n\t\t\t\tthis.saveError = t('nextcloud-vue', 'The answer could not be saved. Try again.')\n\t\t\t\treturn false\n\t\t\t} finally {\n\t\t\t\tthis.saving = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write the changed answers of this page into the open record's\n\t\t * `answersPath` array (one entry per question, keyed by `answerKey`)\n\t\t * with one update of the record through the object API. Held photos\n\t\t * go first to the record's own files (`recordPhotosField`), and their\n\t\t * references (`photoRefField`, default `id`) into the answer.\n\t\t *\n\t\t * @param {object[]} changed The changed questions.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-questions-and-answers-can-live-inside-the-open-record\n\t\t */\n\t\tasync saveIntoRecord(changed) {\n\t\t\tconst { register, schema } = this.recordRef\n\t\t\tconst objectId = idOf(this.openRecord) || String(this.openRecordId || '')\n\t\t\tif (!register || !schema || !objectId) {\n\t\t\t\tthrow new Error('no record to write to')\n\t\t\t}\n\t\t\tconst c = this.content\n\t\t\tconst af = this.answerFields\n\t\t\tconst key = c.answerKey || 'questionId'\n\t\t\tconst refField = c.photoRefField || 'id'\n\t\t\tlet recordPhotos = Array.isArray(readPath(this.openRecord, c.recordPhotosField)) ? readPath(this.openRecord, c.recordPhotosField) : []\n\t\t\tconst entries = [...this.recordAnswers]\n\t\t\tfor (const question of changed) {\n\t\t\t\tconst draft = this.draft[question.id]\n\t\t\t\tconst index = entries.findIndex((entry) => String(readPath(entry, key) ?? '') === question.id)\n\t\t\t\tconst entry = { ...(index >= 0 ? entries[index] : { [key]: question.id }) }\n\t\t\t\tif (question.kind === 'number') {\n\t\t\t\t\tentry[af.number] = draft.value === '' ? null : Number(draft.value)\n\t\t\t\t} else if (question.kind === 'choice') {\n\t\t\t\t\tentry[af.choice] = draft.value\n\t\t\t\t} else if (question.kind !== 'photo') {\n\t\t\t\t\tentry[af.value] = draft.value\n\t\t\t\t}\n\t\t\t\tif (this.allowNote) {\n\t\t\t\t\tentry[af.note] = draft.note\n\t\t\t\t}\n\t\t\t\tif (af.at) {\n\t\t\t\t\tentry[af.at] = new Date().toISOString()\n\t\t\t\t}\n\t\t\t\tconst held = this.photos[question.id] || []\n\t\t\t\tif (this.photosEnabled && held.length) {\n\t\t\t\t\tconst field = c.recordPhotosField\n\t\t\t\t\tconst { failed, attached } = await uploadHeldFiles({ register, schema, objectId, held: { [field]: held }, kept: { [field]: recordPhotos } })\n\t\t\t\t\tif (failed.length) {\n\t\t\t\t\t\tthrow new Error('photo upload failed')\n\t\t\t\t\t}\n\t\t\t\t\tconst now = Array.isArray(attached[field]) ? attached[field] : recordPhotos\n\t\t\t\t\tconst added = now.slice(recordPhotos.length).map((ref) => (ref && typeof ref === 'object' ? ref[refField] ?? ref : ref))\n\t\t\t\t\trecordPhotos = now\n\t\t\t\t\tconst existing = Array.isArray(entry[af.photos]) ? entry[af.photos] : []\n\t\t\t\t\tentry[af.photos] = [...existing, ...added]\n\t\t\t\t\tthis.storedPhotos = { ...this.storedPhotos, [question.id]: entry[af.photos] }\n\t\t\t\t\tconst { [question.id]: _sent, ...rest } = this.photos\n\t\t\t\t\tthis.photos = rest\n\t\t\t\t}\n\t\t\t\tif (index >= 0) {\n\t\t\t\t\tentries[index] = entry\n\t\t\t\t} else {\n\t\t\t\t\tentries.push(entry)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst url = generateUrl(`${OBJECT_API}/${encodeURIComponent(register)}/${encodeURIComponent(schema)}/${encodeURIComponent(objectId)}`)\n\t\t\tawait axios.patch(url, { [c.answersPath]: entries })\n\t\t\tthis.recordAnswers = entries\n\t\t},\n\n\t\t/**\n\t\t * Save one answer.\n\t\t *\n\t\t * @param {object} question The question.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync saveAnswer(question) {\n\t\t\tconst entry = this.draft[question.id]\n\t\t\tconst answer = { questionId: question.id, value: entry.value, note: entry.note }\n\t\t\tconst action = this.content?.saveAction\n\t\t\tif (action && typeof action === 'object') {\n\t\t\t\tconst resolved = resolveDeepTokens(action, this.tokenCtx)\n\t\t\t\tconst wrapped = { ...resolved, args: [...(Array.isArray(resolved.args) ? resolved.args : []), answer] }\n\t\t\t\tconst run = typeof this.cnDispatchAction === 'function' ? this.cnDispatchAction(wrapped) : dispatchAction(wrapped, { router: this.$router || null, tokenCtx: this.tokenCtx })\n\t\t\t\tawait run\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst a = this.content?.answers\n\t\t\tif (!a || !a.register || !a.schema) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst body = {\n\t\t\t\t[a.questionField || 'question']: question.id,\n\t\t\t\t[a.valueField || 'answer']: entry.value,\n\t\t\t}\n\t\t\tif (this.allowNote) {\n\t\t\t\tbody[a.noteField || 'note'] = entry.note\n\t\t\t}\n\t\t\tconst base = generateUrl(`${OBJECT_API}/${encodeURIComponent(a.register)}/${encodeURIComponent(a.schema)}`)\n\t\t\tlet id = this.answerIds[question.id]\n\t\t\tif (id) {\n\t\t\t\tawait axios.patch(`${base}/${encodeURIComponent(id)}`, body)\n\t\t\t} else {\n\t\t\t\tconst create = resolveDeepTokens(a.create && typeof a.create === 'object' ? a.create : {}, this.tokenCtx)\n\t\t\t\tconst response = await axios.post(base, { ...create, ...body })\n\t\t\t\tid = idOf(response?.data)\n\t\t\t\tthis.answerIds = { ...this.answerIds, [question.id]: id }\n\t\t\t}\n\t\t\tconst held = this.photos[question.id] || []\n\t\t\tif (this.photosEnabled && held.length && id) {\n\t\t\t\tconst { failed, attached } = await uploadHeldFiles({ register: a.register, schema: a.schema, objectId: id, held: { [a.photosField]: held }, kept: { [a.photosField]: this.storedPhotos[question.id] || [] } })\n\t\t\t\tif (failed.length) {\n\t\t\t\t\tthrow new Error('photo upload failed')\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(attached[a.photosField])) {\n\t\t\t\t\tthis.storedPhotos = { ...this.storedPhotos, [question.id]: attached[a.photosField] }\n\t\t\t\t}\n\t\t\t\tconst { [question.id]: _sent, ...rest } = this.photos\n\t\t\t\tthis.photos = rest\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The required questions on this page without an answer.\n\t\t *\n\t\t * @return {string[]} Their ids.\n\t\t */\n\t\tunansweredRequired() {\n\t\t\treturn this.pageQuestions.filter((q) => q.required && !this.isAnswered(q)).map((q) => q.id)\n\t\t},\n\n\t\t/**\n\t\t * Save this page and go to the next one; on the last page, finish.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-a-checklist-run-shows-a-page-of-questions-at-a-time\n\t\t */\n\t\tasync next() {\n\t\t\tthis.missing = this.unansweredRequired()\n\t\t\tthis.missingPhoto = this.photosEnabled ? this.pageQuestions.filter((q) => this.needsPhoto(q) && !this.hasPhoto(q)).map((q) => q.id) : []\n\t\t\tif (this.missing.length || this.missingPhoto.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!(await this.savePage())) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.isLastPage) {\n\t\t\t\tawait this.finish()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.goTo(this.page + 1)\n\t\t},\n\n\t\t/**\n\t\t * Save this page and go back one.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync previous() {\n\t\t\tif (this.page === 0 || !(await this.savePage())) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.missing = []\n\t\t\tthis.missingPhoto = []\n\t\t\tthis.goTo(this.page - 1)\n\t\t},\n\n\t\t/**\n\t\t * Show a page, move focus to its position line and announce it.\n\t\t *\n\t\t * @param {number} page The page.\n\t\t * @return {void}\n\t\t */\n\t\tgoTo(page) {\n\t\t\tthis.page = page\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.liveText = this.positionText\n\t\t\t\tthis.$refs.position?.focus?.()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The run is done: dispatch `finishAction` when set, and emit `finished`.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync finish() {\n\t\t\tconst action = this.content?.finishAction\n\t\t\tif (action && typeof action === 'object') {\n\t\t\t\tconst resolved = resolveDeepTokens(action, this.tokenCtx)\n\t\t\t\tconst run = typeof this.cnDispatchAction === 'function' ? this.cnDispatchAction(resolved) : dispatchAction(resolved, { router: this.$router || null, tokenCtx: this.tokenCtx })\n\t\t\t\tawait run\n\t\t\t}\n\t\t\tthis.liveText = t('nextcloud-vue', 'Checklist finished.')\n\t\t\t/**\n\t\t\t * @event finished The last page was saved.\n\t\t\t * @type {{answered: number, total: number}}\n\t\t\t */\n\t\t\tthis.$emit('finished', { answered: this.answeredCount, total: this.questions.length })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-checklist-run__form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-checklist-run__position {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tline-height: 17px;\n\tmargin: 0;\n}\n\n.cn-checklist-run__progress {\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\toverflow: hidden;\n}\n\n.cn-checklist-run__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-checklist-run__live,\n.cn-checklist-run__sr {\n\tclip-path: inset(50%);\n\theight: 1px;\n\toverflow: hidden;\n\tposition: absolute;\n\twhite-space: nowrap;\n\twidth: 1px;\n}\n\n.cn-checklist-run__question,\n.cn-checklist-run__photos {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large, 12px);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin: 0;\n\tpadding: 12px 14px;\n}\n\n.cn-checklist-run__photos-title {\n\tfont-size: 15px;\n\tline-height: 1.2;\n}\n\n.cn-checklist-run__legend {\n\tfont-size: 15px;\n\tfont-weight: 600;\n\tline-height: 1.2;\n\tpadding: 0 4px;\n}\n\n.cn-checklist-run__help {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 14px;\n\tline-height: 1.2;\n\tmargin: 0;\n}\n\n/* An option reads as text, not as a field label (a theme makes every label\n bold with !important); 15px, 31px apart, as the board draws it (DqInspectie). */\n.cn-checklist-run__choice {\n\talign-items: center;\n\tdisplay: flex;\n\tfont-size: 15px;\n\tfont-weight: 400 !important;\n\tgap: 10px;\n\tmin-height: 23px;\n}\n\n/* The board draws the radio with the browser's own 3px 3px 0 5px margin. */\n.cn-checklist-run__choice input {\n\taccent-color: var(--color-primary-element);\n\theight: 20px;\n\tmargin: 3px 3px 0 5px;\n\twidth: 20px;\n}\n\n/* The board look sizes every radio 18px with a (0,4,1) rule. */\n.cn-checklist-run__choice.cn-checklist-run__choice.cn-checklist-run__choice input[type=\"radio\"] {\n\theight: 20px;\n\tmin-height: 20px;\n\tmin-width: 20px;\n\twidth: 20px;\n}\n\n.cn-checklist-run__text,\n.cn-checklist-run__number {\n\tbox-sizing: border-box;\n\twidth: 100%;\n}\n\n/* A note is two 15px lines on the normal line height, 8px 12px in: 54px, as\n the board draws it. A theme pads every textarea 5px 12px with !important. */\n.cn-checklist-run__text.cn-checklist-run__text {\n\tpadding: 8px 12px !important;\n\tline-height: normal;\n\tmargin: 0;\n}\n\n.cn-checklist-run__group {\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tline-height: normal;\n\tmargin: 0;\n}\n\n.cn-checklist-run__note-label {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tfont-size: 14px;\n\tfont-weight: 600 !important;\n\tline-height: 1.2;\n}\n\n.cn-checklist-run__photo-list {\n\tmargin: 0;\n\tpadding-inline-start: 18px;\n}\n\n/* The photo button is the board's 34px secondary control across its card\n (DqInspectie, 272px), its 14px/600 label after a camera. The doubled class\n outranks Nextcloud's `button:not(.button-vue)` margin, padding and height,\n and a theme's bold label weight set with !important. */\n.cn-checklist-run__photo-button.cn-checklist-run__photo-button {\n\talign-items: center;\n\talign-self: stretch;\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--cn-board-control-border, var(--color-border-dark));\n\tborder-radius: var(--border-radius-element, 8px);\n\tbox-sizing: border-box;\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n\tdisplay: flex;\n\tfont-size: 14px;\n\tfont-weight: 600 !important;\n\tgap: 8px;\n\theight: 34px;\n\tmargin: 0;\n\tmin-height: 34px;\n\tpadding: 0 14px;\n}\n\n.cn-checklist-run__photo-button:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n\n.cn-checklist-run__photo-input {\n\tclip-path: inset(50%);\n\theight: 1px;\n\toverflow: hidden;\n\tposition: absolute;\n\twidth: 1px;\n}\n\n.cn-checklist-run__nav {\n\tdisplay: flex;\n\tjustify-content: space-between;\n}\n\n/* Previous and Next are as wide as the board draws them: the board pads the\n button 14px and the label not at all (Vorige 70.3px); NcButton's label\n padding made them 4px wider. */\n.cn-checklist-run__nav :deep(.button-vue__text) {\n\tpadding-inline: 0;\n}\n\n.cn-checklist-run__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: 0;\n}\n\n.cn-checklist-run__empty {\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_createVNode","_createElementVNode","_Fragment","_renderList","_createTextVNode","_vModelRadio","_vModelText"],"mappings":";;;AASM,EAAA,KAAK,EAAC,kBAAkB;AAAC,EAAA,aAAQ,EAAA,kBAAA;;;;AAEpC,EAAA,KAAE,EAAA,yBAAA;AACF,EAAA,IAAI,EAAC,OAAO;AACZ,EAAA,aAAW,EAAC,wBAAwB;;;;AAGrB,EAAA,KAAA,EAAA,2BAAA;;;;AAGc,EAAA,KAAA,EAAA,yBAAA;AAAA,EAAA,aAAA,EAAA,wBAAA;;;;AAwB1B,EAAA,KAAA,EAAA,wBAAA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,KAAA,CAAA,IAAA,KAAA,CAAA,MAAA;AACT,kBAAA,aAAO,EAAA,2BAAA;AACN,kBAAA,OAAK,EAAE,QAAQ,CAAA,QAAA;;mCAChB,MAAY;oDAAT,QAAS,CAAA,aAAA,CAAA,EAAA,CAAA,YAAA;;;;gBAEZA,WAMU,CAAA,mBAAA,EAAA;AALV,kBAAA,OAAO,EAAC,SAAS;AACjB,kBAAA,IAAI,EAAC,QAAI;AACR,kBAAA,QAAE,EAAA,KAAA,CAAA,MAAA;AACF,kBAAA,aAAU,EAAC,uBAAI;;mCAChB,MAA6B;oDAA1B,QAAU,CAAA,UAAA,GAAG,QAAW,CAAA,WAAA,GAAE,QAAA,CAAA,SAAA,CAAA,EAAA,CAAA,YAAA;;;;;eAGtB,KAAM,CAAA,SAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import script from './CnConditionGroup.vue2.js';
|
|
2
|
+
import { render } from './CnConditionGroup.vue3.js';
|
|
3
|
+
|
|
4
|
+
script.render = render;
|
|
5
|
+
script.__scopeId = "data-v-73aaa314";
|
|
6
|
+
const __sfc_main = script;
|
|
7
|
+
|
|
8
|
+
export { __sfc_main as default };
|
|
9
|
+
//# sourceMappingURL=CnConditionGroup.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroup.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { translate } from '@nextcloud/l10n';
|
|
2
|
+
import { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue';
|
|
3
|
+
import FolderPlusOutline from 'vue-material-design-icons/FolderPlusOutline.vue';
|
|
4
|
+
import Lock from 'vue-material-design-icons/Lock.vue';
|
|
5
|
+
import Plus from 'vue-material-design-icons/Plus.vue';
|
|
6
|
+
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue';
|
|
7
|
+
import __sfc_main from '../CnConditionListEditor/CnConditionRow.vue.js';
|
|
8
|
+
import { operatorTakesValue } from '../CnConditionListEditor/conditionOperators.js';
|
|
9
|
+
|
|
10
|
+
let groupSeq = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* CnConditionGroup - one group of CnConditionGroupEditor: the combinator
|
|
14
|
+
* choice, its rows, and the groups inside it, drawn recursively. Internal to
|
|
15
|
+
* the editor, which owns the tree.
|
|
16
|
+
*/
|
|
17
|
+
var script = {
|
|
18
|
+
name: 'CnConditionGroup',
|
|
19
|
+
|
|
20
|
+
components: { CnConditionRow: __sfc_main, FolderPlusOutline, Lock, NcButton, NcCheckboxRadioSwitch, Plus, TrashCanOutline },
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
/** The group: `{ type: 'AND' | 'OR', children }`. */
|
|
24
|
+
node: { type: Object, required: true },
|
|
25
|
+
/** How deep this group sits; the root is 0. */
|
|
26
|
+
depth: { type: Number, default: 0 },
|
|
27
|
+
/** This group's path in validator notation (`$.children[1]`). */
|
|
28
|
+
path: { type: String, default: '$' },
|
|
29
|
+
/** The fields, normalised to `{ id, label, type, format?, options? }`. */
|
|
30
|
+
fields: { type: Array, default: () => [] },
|
|
31
|
+
/** The operators of a field, `(field) => [{ id, label }]`. */
|
|
32
|
+
operatorsFor: { type: Function, required: true },
|
|
33
|
+
/** The deepest group Add group may create. */
|
|
34
|
+
maxDepth: { type: Number, default: 1 },
|
|
35
|
+
/** Messages keyed by node path. */
|
|
36
|
+
errors: { type: Object, default: () => ({}) },
|
|
37
|
+
/** What an empty root says, already translated. */
|
|
38
|
+
emptyText: { type: String, default: '' },
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
emits: ['update:node', 'remove'],
|
|
42
|
+
|
|
43
|
+
data() {
|
|
44
|
+
groupSeq += 1;
|
|
45
|
+
return { radioName: `cn-condition-group-${groupSeq}` }
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
computed: {
|
|
49
|
+
combinators() {
|
|
50
|
+
return [
|
|
51
|
+
{ value: 'AND', label: translate('nextcloud-vue', 'Match all conditions') },
|
|
52
|
+
{ value: 'OR', label: translate('nextcloud-vue', 'Match any condition') },
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
controlLabels() {
|
|
57
|
+
return {
|
|
58
|
+
field: translate('nextcloud-vue', 'Field'),
|
|
59
|
+
operator: translate('nextcloud-vue', 'Condition'),
|
|
60
|
+
value: translate('nextcloud-vue', 'Value'),
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
ownError() {
|
|
65
|
+
return this.errors[this.path] || ''
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
methods: {
|
|
70
|
+
t: translate,
|
|
71
|
+
operatorTakesValue,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* What a child is: a group drawn as a card, a group the editor keeps
|
|
75
|
+
* as written (NOT), or a condition.
|
|
76
|
+
*
|
|
77
|
+
* @param {object} child The child node.
|
|
78
|
+
* @return {string} group, locked or condition.
|
|
79
|
+
*/
|
|
80
|
+
kindOf(child) {
|
|
81
|
+
if (!Array.isArray(child?.children)) {
|
|
82
|
+
return 'condition'
|
|
83
|
+
}
|
|
84
|
+
return ['AND', 'OR'].includes(String(child.type || 'AND').toUpperCase()) ? 'group' : 'locked'
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The word before a row: Where on the first, then and or or.
|
|
89
|
+
*
|
|
90
|
+
* @param {number} index The row index.
|
|
91
|
+
* @return {string} The word.
|
|
92
|
+
*/
|
|
93
|
+
connector(index) {
|
|
94
|
+
if (index === 0) {
|
|
95
|
+
return translate('nextcloud-vue', 'Where')
|
|
96
|
+
}
|
|
97
|
+
return this.node.type === 'OR' ? translate('nextcloud-vue', 'or') : translate('nextcloud-vue', 'and')
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
caption(child) {
|
|
101
|
+
return String(child.type).toUpperCase() === 'OR'
|
|
102
|
+
? translate('nextcloud-vue', 'one of these')
|
|
103
|
+
: translate('nextcloud-vue', 'all of these')
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
childPath(index) {
|
|
107
|
+
return `${this.path}.children[${index}]`
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
fieldOf(id) {
|
|
111
|
+
return this.fields.find((f) => f.id === id)
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The field choices, plus a stored field the list does not offer.
|
|
116
|
+
*
|
|
117
|
+
* @param {object} child The condition.
|
|
118
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
119
|
+
*/
|
|
120
|
+
fieldOptionsFor(child) {
|
|
121
|
+
const options = this.fields.map((f) => ({ id: f.id, label: f.label || f.id }));
|
|
122
|
+
if (child.field && !options.some((o) => o.id === child.field)) {
|
|
123
|
+
options.push({ id: child.field, label: child.field });
|
|
124
|
+
}
|
|
125
|
+
return options
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The operator choices of the condition's field, plus a stored
|
|
130
|
+
* operator the list does not offer.
|
|
131
|
+
*
|
|
132
|
+
* @param {object} child The condition.
|
|
133
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
134
|
+
*/
|
|
135
|
+
operatorOptionsFor(child) {
|
|
136
|
+
const options = this.operatorsFor(this.fieldOf(child.field));
|
|
137
|
+
if (child.operator && !options.some((o) => o.id === child.operator)) {
|
|
138
|
+
return [...options, { id: child.operator, label: child.operator }]
|
|
139
|
+
}
|
|
140
|
+
return options
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
valueOptionsFor(child) {
|
|
144
|
+
const field = this.fieldOf(child.field);
|
|
145
|
+
if (field?.type === 'boolean') {
|
|
146
|
+
return [
|
|
147
|
+
{ id: true, label: translate('nextcloud-vue', 'Yes') },
|
|
148
|
+
{ id: false, label: translate('nextcloud-vue', 'No') },
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
if (Array.isArray(field?.options) && field.options.length > 0) {
|
|
152
|
+
return field.options.map((o) => (typeof o === 'object'
|
|
153
|
+
? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }
|
|
154
|
+
: { id: o, label: String(o) }))
|
|
155
|
+
}
|
|
156
|
+
return null
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
inputTypeFor(child) {
|
|
160
|
+
const field = this.fieldOf(child.field);
|
|
161
|
+
if (field?.type === 'number' || field?.type === 'integer') {
|
|
162
|
+
return 'number'
|
|
163
|
+
}
|
|
164
|
+
return field?.type === 'date' || field?.format === 'date' ? 'date' : 'text'
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
emitNode(next) {
|
|
168
|
+
this.$emit('update:node', next);
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
setChildren(children) {
|
|
172
|
+
this.emitNode({ ...this.node, children });
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
setChild(index, next) {
|
|
176
|
+
const children = [...this.node.children];
|
|
177
|
+
children[index] = next;
|
|
178
|
+
this.setChildren(children);
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
removeChild(index) {
|
|
182
|
+
this.setChildren(this.node.children.filter((_, i) => i !== index));
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
setType(type) {
|
|
186
|
+
this.emitNode({ ...this.node, type: type === 'OR' ? 'OR' : 'AND' });
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
addCondition() {
|
|
190
|
+
this.setChildren([...this.node.children, { field: '', operator: '', value: '' }]);
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
addGroup() {
|
|
194
|
+
this.setChildren([...this.node.children, { type: 'AND', children: [{ field: '', operator: '', value: '' }] }]);
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Pick a field: the operator resets to the field's first one and the
|
|
199
|
+
* value clears, since a value for another field rarely fits.
|
|
200
|
+
*
|
|
201
|
+
* @param {number} index The row index.
|
|
202
|
+
* @param {object} option The field choice.
|
|
203
|
+
*/
|
|
204
|
+
setField(index, option) {
|
|
205
|
+
const field = this.fieldOf(option?.id);
|
|
206
|
+
const first = this.operatorsFor(field)[0];
|
|
207
|
+
this.setChild(index, {
|
|
208
|
+
field: option?.id || '',
|
|
209
|
+
operator: first ? first.id : '',
|
|
210
|
+
value: field?.type === 'boolean' ? true : '',
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
setOperator(index, option) {
|
|
215
|
+
const next = { ...this.node.children[index], operator: option?.id || '' };
|
|
216
|
+
if (!operatorTakesValue(next.operator)) {
|
|
217
|
+
delete next.value;
|
|
218
|
+
} else if (next.value === undefined) {
|
|
219
|
+
next.value = '';
|
|
220
|
+
}
|
|
221
|
+
this.setChild(index, next);
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Set a value, as a number for a number field.
|
|
226
|
+
*
|
|
227
|
+
* @param {number} index The row index.
|
|
228
|
+
* @param {object} child The condition.
|
|
229
|
+
* @param {unknown} raw The picked or typed value.
|
|
230
|
+
*/
|
|
231
|
+
setValue(index, child, raw) {
|
|
232
|
+
let value = raw;
|
|
233
|
+
if (this.inputTypeFor(child) === 'number' && raw !== '' && !Number.isNaN(Number(raw))) {
|
|
234
|
+
value = Number(raw);
|
|
235
|
+
}
|
|
236
|
+
this.setChild(index, { ...child, value });
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export { script as default };
|
|
242
|
+
//# sourceMappingURL=CnConditionGroup.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroup.vue2.js","sources":["../../../../src/components/CnConditionGroupEditor/CnConditionGroup.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-condition-group\"\n\t\t:class=\"{\n\t\t\t'cn-condition-group--nested': depth > 0,\n\t\t\t'cn-condition-group--error': !!ownError,\n\t\t}\">\n\t\t<div class=\"cn-condition-group__header\">\n\t\t\t<fieldset class=\"cn-condition-group__combinator\">\n\t\t\t\t<legend class=\"cn-condition-group__legend\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'How the conditions combine') }}\n\t\t\t\t</legend>\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\tv-for=\"choice in combinators\"\n\t\t\t\t\t:key=\"choice.value\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t:class=\"{ 'cn-condition-group__choice--checked': node.type === choice.value }\"\n\t\t\t\t\t:name=\"radioName\"\n\t\t\t\t\t:value=\"choice.value\"\n\t\t\t\t\t:modelValue=\"node.type\"\n\t\t\t\t\t@update:modelValue=\"setType\">\n\t\t\t\t\t{{ choice.label }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t</fieldset>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"depth > 0\"\n\t\t\t\tclass=\"cn-condition-group__remove-group\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t@click=\"$emit('remove')\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<TrashCanOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Remove group') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<ol v-if=\"node.children.length\" class=\"cn-condition-group__rows\">\n\t\t\t<li v-for=\"(child, index) in node.children\" :key=\"index\" class=\"cn-condition-group__item\">\n\t\t\t\t<template v-if=\"kindOf(child) === 'group'\">\n\t\t\t\t\t<div class=\"cn-condition-group__line\">\n\t\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t\t<span class=\"cn-condition-group__caption\">{{ caption(child) }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<CnConditionGroup\n\t\t\t\t\t\tclass=\"cn-condition-group__child\"\n\t\t\t\t\t\t:node=\"child\"\n\t\t\t\t\t\t:depth=\"depth + 1\"\n\t\t\t\t\t\t:path=\"childPath(index)\"\n\t\t\t\t\t\t:fields=\"fields\"\n\t\t\t\t\t\t:operatorsFor=\"operatorsFor\"\n\t\t\t\t\t\t:maxDepth=\"maxDepth\"\n\t\t\t\t\t\t:errors=\"errors\"\n\t\t\t\t\t\t@update:node=\"setChild(index, $event)\"\n\t\t\t\t\t\t@remove=\"removeChild(index)\" />\n\t\t\t\t</template>\n\t\t\t\t<div v-else-if=\"kindOf(child) === 'locked'\" class=\"cn-condition-group__line\">\n\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t<div class=\"cn-condition-group__locked\">\n\t\t\t\t\t\t<Lock :size=\"16\" />\n\t\t\t\t\t\t<span>{{ t('nextcloud-vue', 'These conditions are kept as written') }}</span>\n\t\t\t\t\t\t<NcButton\n\t\t\t\t\t\t\tclass=\"cn-condition-group__pill\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove group')\"\n\t\t\t\t\t\t\t:title=\"t('nextcloud-vue', 'Remove group')\"\n\t\t\t\t\t\t\t@click=\"removeChild(index)\">\n\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t<TrashCanOutline :size=\"18\" />\n\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div v-else class=\"cn-condition-group__line\">\n\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t<CnConditionRow\n\t\t\t\t\t\tclass=\"cn-condition-group__row\"\n\t\t\t\t\t\t:condition=\"child\"\n\t\t\t\t\t\t:fieldOptions=\"fieldOptionsFor(child)\"\n\t\t\t\t\t\t:operatorOptions=\"operatorOptionsFor(child)\"\n\t\t\t\t\t\t:valueOptions=\"valueOptionsFor(child)\"\n\t\t\t\t\t\t:inputType=\"inputTypeFor(child)\"\n\t\t\t\t\t\t:showValue=\"operatorTakesValue(child.operator)\"\n\t\t\t\t\t\t:controlLabels=\"controlLabels\"\n\t\t\t\t\t\t:error=\"errors[childPath(index)] || ''\"\n\t\t\t\t\t\thideLabels\n\t\t\t\t\t\t@field=\"setField(index, $event)\"\n\t\t\t\t\t\t@operator=\"setOperator(index, $event)\"\n\t\t\t\t\t\t@value=\"setValue(index, child, $event)\"\n\t\t\t\t\t\t@remove=\"removeChild(index)\">\n\t\t\t\t\t\t<template #remove-icon>\n\t\t\t\t\t\t\t<TrashCanOutline :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</CnConditionRow>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ol>\n\t\t<p v-else class=\"cn-condition-group__empty\">\n\t\t\t{{ depth === 0 && emptyText ? emptyText : t('nextcloud-vue', 'This group has no conditions yet.') }}\n\t\t</p>\n\n\t\t<p v-if=\"ownError\" class=\"cn-condition-group__error\" role=\"alert\">\n\t\t\t{{ ownError }}\n\t\t</p>\n\n\t\t<div class=\"cn-condition-group__actions\">\n\t\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"addCondition\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<Plus :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"depth < maxDepth\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"fields.length === 0\"\n\t\t\t\t@click=\"addGroup\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FolderPlusOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Add group') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue'\nimport FolderPlusOutline from 'vue-material-design-icons/FolderPlusOutline.vue'\nimport Lock from 'vue-material-design-icons/Lock.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'\nimport CnConditionRow from '../CnConditionListEditor/CnConditionRow.vue'\nimport { operatorTakesValue } from '../CnConditionListEditor/conditionOperators.js'\n\nlet groupSeq = 0\n\n/**\n * CnConditionGroup - one group of CnConditionGroupEditor: the combinator\n * choice, its rows, and the groups inside it, drawn recursively. Internal to\n * the editor, which owns the tree.\n */\nexport default {\n\tname: 'CnConditionGroup',\n\n\tcomponents: { CnConditionRow, FolderPlusOutline, Lock, NcButton, NcCheckboxRadioSwitch, Plus, TrashCanOutline },\n\n\tprops: {\n\t\t/** The group: `{ type: 'AND' | 'OR', children }`. */\n\t\tnode: { type: Object, required: true },\n\t\t/** How deep this group sits; the root is 0. */\n\t\tdepth: { type: Number, default: 0 },\n\t\t/** This group's path in validator notation (`$.children[1]`). */\n\t\tpath: { type: String, default: '$' },\n\t\t/** The fields, normalised to `{ id, label, type, format?, options? }`. */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/** The operators of a field, `(field) => [{ id, label }]`. */\n\t\toperatorsFor: { type: Function, required: true },\n\t\t/** The deepest group Add group may create. */\n\t\tmaxDepth: { type: Number, default: 1 },\n\t\t/** Messages keyed by node path. */\n\t\terrors: { type: Object, default: () => ({}) },\n\t\t/** What an empty root says, already translated. */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['update:node', 'remove'],\n\n\tdata() {\n\t\tgroupSeq += 1\n\t\treturn { radioName: `cn-condition-group-${groupSeq}` }\n\t},\n\n\tcomputed: {\n\t\tcombinators() {\n\t\t\treturn [\n\t\t\t\t{ value: 'AND', label: t('nextcloud-vue', 'Match all conditions') },\n\t\t\t\t{ value: 'OR', label: t('nextcloud-vue', 'Match any condition') },\n\t\t\t]\n\t\t},\n\n\t\tcontrolLabels() {\n\t\t\treturn {\n\t\t\t\tfield: t('nextcloud-vue', 'Field'),\n\t\t\t\toperator: t('nextcloud-vue', 'Condition'),\n\t\t\t\tvalue: t('nextcloud-vue', 'Value'),\n\t\t\t}\n\t\t},\n\n\t\townError() {\n\t\t\treturn this.errors[this.path] || ''\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\toperatorTakesValue,\n\n\t\t/**\n\t\t * What a child is: a group drawn as a card, a group the editor keeps\n\t\t * as written (NOT), or a condition.\n\t\t *\n\t\t * @param {object} child The child node.\n\t\t * @return {string} group, locked or condition.\n\t\t */\n\t\tkindOf(child) {\n\t\t\tif (!Array.isArray(child?.children)) {\n\t\t\t\treturn 'condition'\n\t\t\t}\n\t\t\treturn ['AND', 'OR'].includes(String(child.type || 'AND').toUpperCase()) ? 'group' : 'locked'\n\t\t},\n\n\t\t/**\n\t\t * The word before a row: Where on the first, then and or or.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @return {string} The word.\n\t\t */\n\t\tconnector(index) {\n\t\t\tif (index === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Where')\n\t\t\t}\n\t\t\treturn this.node.type === 'OR' ? t('nextcloud-vue', 'or') : t('nextcloud-vue', 'and')\n\t\t},\n\n\t\tcaption(child) {\n\t\t\treturn String(child.type).toUpperCase() === 'OR'\n\t\t\t\t? t('nextcloud-vue', 'one of these')\n\t\t\t\t: t('nextcloud-vue', 'all of these')\n\t\t},\n\n\t\tchildPath(index) {\n\t\t\treturn `${this.path}.children[${index}]`\n\t\t},\n\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\t/**\n\t\t * The field choices, plus a stored field the list does not offer.\n\t\t *\n\t\t * @param {object} child The condition.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\tfieldOptionsFor(child) {\n\t\t\tconst options = this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t\tif (child.field && !options.some((o) => o.id === child.field)) {\n\t\t\t\toptions.push({ id: child.field, label: child.field })\n\t\t\t}\n\t\t\treturn options\n\t\t},\n\n\t\t/**\n\t\t * The operator choices of the condition's field, plus a stored\n\t\t * operator the list does not offer.\n\t\t *\n\t\t * @param {object} child The condition.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\toperatorOptionsFor(child) {\n\t\t\tconst options = this.operatorsFor(this.fieldOf(child.field))\n\t\t\tif (child.operator && !options.some((o) => o.id === child.operator)) {\n\t\t\t\treturn [...options, { id: child.operator, label: child.operator }]\n\t\t\t}\n\t\t\treturn options\n\t\t},\n\n\t\tvalueOptionsFor(child) {\n\t\t\tconst field = this.fieldOf(child.field)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tinputTypeFor(child) {\n\t\t\tconst field = this.fieldOf(child.field)\n\t\t\tif (field?.type === 'number' || field?.type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn field?.type === 'date' || field?.format === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\temitNode(next) {\n\t\t\tthis.$emit('update:node', next)\n\t\t},\n\n\t\tsetChildren(children) {\n\t\t\tthis.emitNode({ ...this.node, children })\n\t\t},\n\n\t\tsetChild(index, next) {\n\t\t\tconst children = [...this.node.children]\n\t\t\tchildren[index] = next\n\t\t\tthis.setChildren(children)\n\t\t},\n\n\t\tremoveChild(index) {\n\t\t\tthis.setChildren(this.node.children.filter((_, i) => i !== index))\n\t\t},\n\n\t\tsetType(type) {\n\t\t\tthis.emitNode({ ...this.node, type: type === 'OR' ? 'OR' : 'AND' })\n\t\t},\n\n\t\taddCondition() {\n\t\t\tthis.setChildren([...this.node.children, { field: '', operator: '', value: '' }])\n\t\t},\n\n\t\taddGroup() {\n\t\t\tthis.setChildren([...this.node.children, { type: 'AND', children: [{ field: '', operator: '', value: '' }] }])\n\t\t},\n\n\t\t/**\n\t\t * Pick a field: the operator resets to the field's first one and the\n\t\t * value clears, since a value for another field rarely fits.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {object} option The field choice.\n\t\t */\n\t\tsetField(index, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst first = this.operatorsFor(field)[0]\n\t\t\tthis.setChild(index, {\n\t\t\t\tfield: option?.id || '',\n\t\t\t\toperator: first ? first.id : '',\n\t\t\t\tvalue: field?.type === 'boolean' ? true : '',\n\t\t\t})\n\t\t},\n\n\t\tsetOperator(index, option) {\n\t\t\tconst next = { ...this.node.children[index], operator: option?.id || '' }\n\t\t\tif (!operatorTakesValue(next.operator)) {\n\t\t\t\tdelete next.value\n\t\t\t} else if (next.value === undefined) {\n\t\t\t\tnext.value = ''\n\t\t\t}\n\t\t\tthis.setChild(index, next)\n\t\t},\n\n\t\t/**\n\t\t * Set a value, as a number for a number field.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {object} child The condition.\n\t\t * @param {unknown} raw The picked or typed value.\n\t\t */\n\t\tsetValue(index, child, raw) {\n\t\t\tlet value = raw\n\t\t\tif (this.inputTypeFor(child) === 'number' && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\tvalue = Number(raw)\n\t\t\t}\n\t\t\tthis.setChild(index, { ...child, value })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-group {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmin-width: 0;\n\tpadding: 14px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\t--cn-condition-row-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.25fr) auto;\n\t--cn-condition-row-align: center;\n}\n\n.cn-condition-group--nested {\n\tmargin-inline-start: 52px;\n\tpadding: 12px 12px 8px;\n\tborder-color: var(--color-border);\n\tborder-inline-start: 3px solid var(--color-primary-element);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-condition-group--error {\n\tborder-color: var(--color-border-error, var(--color-error));\n}\n\n.cn-condition-group__header {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-condition-group__combinator {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 18px;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-group__legend {\n\tfloat: inline-start;\n\tmargin-inline-end: 6px;\n\tpadding: 0;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__choice--checked :deep(.checkbox-radio-switch__text) {\n\tfont-weight: 600;\n}\n\n.cn-condition-group__remove-group {\n\tcolor: var(--color-text-error, var(--color-error));\n}\n\n.cn-condition-group__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-condition-group__item {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmin-width: 0;\n}\n\n.cn-condition-group__line {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tmin-width: 0;\n}\n\n.cn-condition-group__connector {\n\tflex: 0 0 44px;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__caption {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__row {\n\tflex: 1 1 auto;\n}\n\n.cn-condition-group__locked {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\talign-items: center;\n\tgap: 8px;\n\tmin-height: var(--default-clickable-area);\n\tpadding: 0 0 0 10px;\n\tborder: 1px dashed var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__locked > span {\n\tflex: 1 1 auto;\n}\n\n.cn-condition-group__pill,\n.cn-condition-group__row :deep(.cn-condition-row__remove) {\n\tborder-radius: var(--border-radius-pill, 17px);\n}\n\n.cn-condition-group__empty {\n\tmargin: 0;\n\tpadding: 12px;\n\tborder: 1px dashed var(--color-border-dark);\n\tborder-radius: var(--border-radius-large);\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n}\n\n.cn-condition-group__error {\n\tmargin: 0;\n\tcolor: var(--color-text-error, var(--color-error));\n\tfont-size: 0.9em;\n}\n\n.cn-condition-group__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\tpadding-inline-start: 44px;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-group--nested {\n\t\tmargin-inline-start: 12px;\n\t}\n\n\t.cn-condition-group__line {\n\t\tflex-wrap: wrap;\n\t}\n\n\t.cn-condition-group__actions {\n\t\tpadding-inline-start: 0;\n\t}\n}\n</style>\n"],"names":["CnConditionRow","t"],"mappings":";;;;;;;;;AA2IA,IAAI,QAAO,GAAI,EAAA;;AAEf;AACC;AACA;;;AAGD,aAAe;CACd,IAAI,EAAE,kBAAkB;;CAExB,UAAU,EAAE,kBAAEA,UAAc,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,qBAAqB,EAAE,IAAI,EAAE,eAAc,EAAG;;AAE/G,CAAA,KAAK,EAAE;AACN;AACA,EAAA,IAAI,EAAE,EAAE,IAAI,EAAE,MAA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