@conduction/nextcloud-vue 2.177.0 → 2.179.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 +90 -7
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +82 -79
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue.js +1 -1
- package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js +12 -1
- package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js.map +1 -1
- package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue3.js.map +1 -1
- package/dist/esm/components/CnCardNotices/CnCardNotices.vue.js +1 -1
- package/dist/esm/components/CnCardNotices/CnCardNotices.vue2.js +45 -7
- package/dist/esm/components/CnCardNotices/CnCardNotices.vue2.js.map +1 -1
- package/dist/esm/components/CnCardNotices/CnCardNotices.vue3.js +1 -1
- package/dist/esm/components/CnCardNotices/CnCardNotices.vue3.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue.js +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +10 -8
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js +95 -88
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +40 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +149 -109
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js +10 -4
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js.map +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue.js +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js +86 -8
- package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js +137 -121
- package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue.js +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js +56 -4
- package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js +166 -70
- package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js +9 -0
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js.map +1 -0
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js +123 -0
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js.map +1 -0
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js +268 -0
- package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js.map +1 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js +9 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js.map +1 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js +49 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js.map +1 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js +41 -0
- package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js.map +1 -0
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +116 -8
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +110 -58
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +78 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +44 -3
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js +1 -1
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js +112 -1
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js +53 -18
- package/dist/esm/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexHeaderMenu.vue2.js +3 -3
- package/dist/esm/components/CnIndexPage/CnIndexHeaderMenu.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexHeaderMenu.vue3.js +108 -74
- package/dist/esm/components/CnIndexPage/CnIndexHeaderMenu.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +219 -83
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +92 -58
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js +56 -0
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js +185 -123
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue.js +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js +2 -0
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js +2 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +197 -63
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +244 -161
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSearchPage/CnSearchPage.vue.js +1 -1
- package/dist/esm/components/CnSearchPage/CnSearchPage.vue2.js +39 -1
- package/dist/esm/components/CnSearchPage/CnSearchPage.vue2.js.map +1 -1
- package/dist/esm/components/CnSearchPage/CnSearchPage.vue3.js +12 -2
- package/dist/esm/components/CnSearchPage/CnSearchPage.vue3.js.map +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
- package/dist/esm/components/CnTaskFormFields/CnTaskFormFields.vue.js +1 -1
- package/dist/esm/components/CnTaskFormFields/CnTaskFormFields.vue2.js +51 -2
- package/dist/esm/components/CnTaskFormFields/CnTaskFormFields.vue2.js.map +1 -1
- package/dist/esm/components/CnTaskFormFields/CnTaskFormFields.vue3.js +49 -11
- package/dist/esm/components/CnTaskFormFields/CnTaskFormFields.vue3.js.map +1 -1
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue.js +9 -0
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue.js.map +1 -0
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue2.js +328 -0
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue2.js.map +1 -0
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue3.js +85 -0
- package/dist/esm/components/CnTaskFormWidget/CnTaskFormWidget.vue3.js.map +1 -0
- package/dist/esm/components/CnTaskFormWidget/index.js +24 -0
- package/dist/esm/components/CnTaskFormWidget/index.js.map +1 -0
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue.js +1 -1
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue2.js +8 -2
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue3.js +16 -3
- package/dist/esm/components/CnTasksWidget/CnTasksWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
- package/dist/esm/components/CnWidgetGrid/registerDashboardWidgets.js.map +1 -1
- package/dist/esm/composables/indexSources.js +24 -4
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/composables/useFlowStore.js +75 -4
- package/dist/esm/composables/useFlowStore.js.map +1 -1
- package/dist/esm/dialogs/CnFlowEdgeEditModal.vue.js +1 -1
- package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js +17 -0
- package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js +9 -1
- package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js.map +1 -1
- package/dist/esm/dialogs/CnFlowEditModal.vue.js +1 -1
- package/dist/esm/dialogs/CnFlowEditModal.vue2.js +15 -0
- package/dist/esm/dialogs/CnFlowEditModal.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnFlowEditModal.vue3.js +13 -3
- package/dist/esm/dialogs/CnFlowEditModal.vue3.js.map +1 -1
- package/dist/esm/dialogs/CnFlowStepPickerModal.vue.js +1 -1
- package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js +13 -1
- package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnFlowStepPickerModal.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 +52 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +51 -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 +1203 -812
- package/dist/esm/utils/dialogWidths.js +6 -4
- package/dist/esm/utils/dialogWidths.js.map +1 -1
- package/dist/esm/utils/fieldPill.js +77 -0
- package/dist/esm/utils/fieldPill.js.map +1 -0
- package/dist/esm/utils/flowCondition.js +177 -0
- package/dist/esm/utils/flowCondition.js.map +1 -0
- package/dist/esm/utils/flowRunStatus.js +64 -1
- package/dist/esm/utils/flowRunStatus.js.map +1 -1
- package/dist/esm/utils/flowStepList.js +385 -0
- package/dist/esm/utils/flowStepList.js.map +1 -0
- package/dist/esm/utils/libraryWidgetKeys.js +1 -0
- package/dist/esm/utils/libraryWidgetKeys.js.map +1 -1
- package/dist/esm/utils/searchRefusal.js +35 -1
- package/dist/esm/utils/searchRefusal.js.map +1 -1
- package/dist/esm/utils/widgetDispatch.js +1 -1
- package/dist/esm/utils/widgetDispatch.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +14837 -11411
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1203 -812
- package/l10n/en.json +52 -1
- package/l10n/nl.json +51 -1
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +116 -9
- package/src/components/CnBuildiqEditButton/CnBuildiqEditButton.vue +12 -1
- package/src/components/CnCardNotices/CnCardNotices.vue +46 -8
- package/src/components/CnCellRenderer/CnCellRenderer.vue +8 -0
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +61 -2
- package/src/components/CnFilesBrowser/filesBrowserColumns.js +10 -4
- package/src/components/CnFlowDetail/CnFlowDetail.vue +110 -12
- package/src/components/CnFlowDetail/CnFlowDryRunResult.vue +163 -5
- package/src/components/CnFlowDetail/CnFlowStepList.vue +408 -0
- package/src/components/CnFlowDetail/CnFlowViewSwitch.vue +117 -0
- package/src/components/CnFlowDetail/index.js +2 -0
- package/src/components/CnFlowsPage/CnFlowBoard.vue +182 -25
- package/src/components/CnFlowsPage/CnFlowEditorPage.vue +101 -3
- package/src/components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue +141 -1
- package/src/components/CnIndexPage/CnIndexHeaderMenu.vue +22 -4
- package/src/components/CnIndexPage/CnIndexPage.vue +172 -13
- package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +148 -4
- package/src/components/CnObjectSidebar/CnFilesTab.vue +3 -0
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +310 -66
- package/src/components/CnSearchPage/CnSearchPage.vue +50 -1
- package/src/components/CnStepper/CnStepper.vue +14 -5
- package/src/components/CnTaskFormFields/CnTaskFormFields.md +1 -0
- package/src/components/CnTaskFormFields/CnTaskFormFields.vue +89 -3
- package/src/components/CnTaskFormWidget/CnTaskFormWidget.vue +400 -0
- package/src/components/CnTaskFormWidget/index.js +23 -0
- package/src/components/CnTasksWidget/CnTasksWidget.vue +17 -3
- package/src/components/CnWidgetGrid/registerDashboardWidgets.js +1 -0
- package/src/components/index.js +2 -1
- package/src/composables/indexSources.js +24 -4
- package/src/composables/useFlowStore.js +75 -4
- package/src/css/index-page.css +10 -0
- package/src/dialogs/CnFlowEdgeEditModal.vue +28 -0
- package/src/dialogs/CnFlowEditModal.vue +26 -6
- package/src/dialogs/CnFlowStepPickerModal.vue +13 -1
- package/src/index.js +3 -0
- package/src/utils/dialogWidths.js +6 -4
- package/src/utils/fieldPill.js +73 -0
- package/src/utils/flowCondition.js +173 -0
- package/src/utils/flowRunStatus.js +63 -0
- package/src/utils/flowStepList.js +381 -0
- package/src/utils/libraryWidgetKeys.js +1 -0
- package/src/utils/searchRefusal.js +33 -0
- package/src/utils/widgetDispatch.js +1 -1
|
@@ -22,12 +22,38 @@
|
|
|
22
22
|
:key="field.field"
|
|
23
23
|
class="cn-task-form-fields__field"
|
|
24
24
|
:data-testid="field.renderable === false ? `${idPrefix}-broken-row` : null">
|
|
25
|
+
<!-- `widget` (or `type`) `textarea`, `select` (`options` or
|
|
26
|
+
`enum`) and `date`; anything else is one line of text. -->
|
|
27
|
+
<NcTextArea
|
|
28
|
+
v-if="field.renderable !== false && kindOf(field) === 'textarea'"
|
|
29
|
+
:id="`${idPrefix}-${field.field}`"
|
|
30
|
+
:modelValue="String(values[field.field] ?? '')"
|
|
31
|
+
:label="labelOf(field)"
|
|
32
|
+
:placeholder="field.placeholder || undefined"
|
|
33
|
+
:required="field.required === true"
|
|
34
|
+
:error="!!errorOf(field)"
|
|
35
|
+
:helperText="errorOf(field)"
|
|
36
|
+
:data-testid="`${idPrefix}-${field.field}`"
|
|
37
|
+
@update:modelValue="(value) => $emit('answer', { field: field.field, value })" />
|
|
38
|
+
<NcSelect
|
|
39
|
+
v-else-if="field.renderable !== false && kindOf(field) === 'select'"
|
|
40
|
+
:inputId="`${idPrefix}-${field.field}`"
|
|
41
|
+
:inputLabel="labelOf(field)"
|
|
42
|
+
:options="optionsOf(field)"
|
|
43
|
+
:modelValue="optionsOf(field).find((option) => option.id === values[field.field]) || null"
|
|
44
|
+
:required="field.required === true"
|
|
45
|
+
:data-testid="`${idPrefix}-${field.field}`"
|
|
46
|
+
@update:modelValue="(option) => $emit('answer', { field: field.field, value: option ? option.id : null })" />
|
|
25
47
|
<NcTextField
|
|
26
|
-
v-if="field.renderable !== false"
|
|
48
|
+
v-else-if="field.renderable !== false"
|
|
27
49
|
:id="`${idPrefix}-${field.field}`"
|
|
28
50
|
:modelValue="String(values[field.field] ?? '')"
|
|
29
51
|
:label="labelOf(field)"
|
|
52
|
+
:type="kindOf(field) === 'date' ? 'date' : 'text'"
|
|
53
|
+
:placeholder="field.placeholder || undefined"
|
|
30
54
|
:required="field.required === true"
|
|
55
|
+
:error="!!errorOf(field)"
|
|
56
|
+
:helperText="errorOf(field)"
|
|
31
57
|
:data-testid="`${idPrefix}-${field.field}`"
|
|
32
58
|
@update:modelValue="(value) => $emit('answer', { field: field.field, value })" />
|
|
33
59
|
<NcTextField
|
|
@@ -36,6 +62,11 @@
|
|
|
36
62
|
:label="labelOf(field)"
|
|
37
63
|
:disabled="true"
|
|
38
64
|
:helperText="taskFieldUnavailableReason(field)" />
|
|
65
|
+
<p v-if="field.renderable !== false && kindOf(field) === 'select' && errorOf(field)"
|
|
66
|
+
class="cn-task-form-fields__error"
|
|
67
|
+
:data-testid="`${idPrefix}-${field.field}-error`">
|
|
68
|
+
{{ errorOf(field) }}
|
|
69
|
+
</p>
|
|
39
70
|
</div>
|
|
40
71
|
</template>
|
|
41
72
|
</div>
|
|
@@ -43,7 +74,7 @@
|
|
|
43
74
|
|
|
44
75
|
<script>
|
|
45
76
|
import { translate as t } from '@nextcloud/l10n'
|
|
46
|
-
import { NcNoteCard, NcTextField } from '@nextcloud/vue'
|
|
77
|
+
import { NcNoteCard, NcSelect, NcTextArea, NcTextField } from '@nextcloud/vue'
|
|
47
78
|
|
|
48
79
|
/**
|
|
49
80
|
* The text under a declared field the form cannot show: the server's reason,
|
|
@@ -80,7 +111,7 @@ export function taskFieldUnavailableReason(field) {
|
|
|
80
111
|
export default {
|
|
81
112
|
name: 'CnTaskFormFields',
|
|
82
113
|
|
|
83
|
-
components: { NcNoteCard, NcTextField },
|
|
114
|
+
components: { NcNoteCard, NcSelect, NcTextArea, NcTextField },
|
|
84
115
|
|
|
85
116
|
props: {
|
|
86
117
|
/**
|
|
@@ -111,6 +142,17 @@ export default {
|
|
|
111
142
|
default: 'cn-task-form-fields',
|
|
112
143
|
},
|
|
113
144
|
|
|
145
|
+
/**
|
|
146
|
+
* A message under a field, keyed by field ("Completing was refused:
|
|
147
|
+
* fill in Report."), e.g. a required field left empty.
|
|
148
|
+
*
|
|
149
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-field-can-be-a-text-area-a-date-or-a-choice
|
|
150
|
+
*/
|
|
151
|
+
errors: {
|
|
152
|
+
type: Object,
|
|
153
|
+
default: () => ({}),
|
|
154
|
+
},
|
|
155
|
+
|
|
114
156
|
/** Draw only the declared fields the form cannot show (CnTaskFormDialog's rows). */
|
|
115
157
|
brokenOnly: {
|
|
116
158
|
type: Boolean,
|
|
@@ -175,6 +217,44 @@ export default {
|
|
|
175
217
|
labelOf(field) {
|
|
176
218
|
return field.label || field.field
|
|
177
219
|
},
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @param {{widget?: string, type?: string}} field The declared field.
|
|
223
|
+
* @return {string} `textarea`, `select`, `date` or `text`.
|
|
224
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-field-can-be-a-text-area-a-date-or-a-choice
|
|
225
|
+
*/
|
|
226
|
+
kindOf(field) {
|
|
227
|
+
const kind = String(field.widget || field.type || '')
|
|
228
|
+
if (kind === 'textarea' || kind === 'date') {
|
|
229
|
+
return kind
|
|
230
|
+
}
|
|
231
|
+
return kind === 'select' || this.optionsOf(field).length > 0 ? 'select' : 'text'
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The choices of a field: `options` (`[{ value, label }]` or strings),
|
|
236
|
+
* else `enum`, as NcSelect options `{ id, label }`.
|
|
237
|
+
*
|
|
238
|
+
* @param {{options?: Array, enum?: Array}} field The declared field.
|
|
239
|
+
* @return {Array<{id: string, label: string}>}
|
|
240
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-field-can-be-a-text-area-a-date-or-a-choice
|
|
241
|
+
*/
|
|
242
|
+
optionsOf(field) {
|
|
243
|
+
const list = Array.isArray(field.options) ? field.options : (Array.isArray(field.enum) ? field.enum : [])
|
|
244
|
+
return list
|
|
245
|
+
.map((option) => (option && typeof option === 'object' ? { id: String(option.value ?? ''), label: String(option.label ?? option.value ?? '') } : { id: String(option), label: String(option) }))
|
|
246
|
+
.filter((option) => option.id !== '')
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @param {{field: string}} field The declared field.
|
|
251
|
+
* @return {string} Its message from `errors`, or ''.
|
|
252
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-field-can-be-a-text-area-a-date-or-a-choice
|
|
253
|
+
*/
|
|
254
|
+
errorOf(field) {
|
|
255
|
+
const message = this.errors && this.errors[field.field]
|
|
256
|
+
return typeof message === 'string' ? message : ''
|
|
257
|
+
},
|
|
178
258
|
},
|
|
179
259
|
}
|
|
180
260
|
</script>
|
|
@@ -186,6 +266,12 @@ export default {
|
|
|
186
266
|
gap: 12px;
|
|
187
267
|
}
|
|
188
268
|
|
|
269
|
+
.cn-task-form-fields__error {
|
|
270
|
+
margin: 4px 0 0;
|
|
271
|
+
color: var(--color-text-error, var(--color-error));
|
|
272
|
+
font-size: 13px;
|
|
273
|
+
}
|
|
274
|
+
|
|
189
275
|
.cn-task-form-fields__external {
|
|
190
276
|
margin: 0;
|
|
191
277
|
color: var(--color-text-maxcontrast);
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<div class="cn-task-form-widget" data-testid="cn-task-form-widget">
|
|
7
|
+
<p v-if="descriptionText" class="cn-task-form-widget__description" data-testid="cn-task-form-widget-description">
|
|
8
|
+
{{ descriptionText }}
|
|
9
|
+
</p>
|
|
10
|
+
<CnCardNotices
|
|
11
|
+
v-if="notices.length > 0"
|
|
12
|
+
:notices="notices"
|
|
13
|
+
@noticeDismiss="onDismiss" />
|
|
14
|
+
<template v-if="form">
|
|
15
|
+
<CnTaskFormFields
|
|
16
|
+
:form="form"
|
|
17
|
+
:values="values"
|
|
18
|
+
:errors="errors"
|
|
19
|
+
idPrefix="cn-task-form-widget-field"
|
|
20
|
+
@answer="onAnswer" />
|
|
21
|
+
<p v-if="helpText" class="cn-task-form-widget__help" data-testid="cn-task-form-widget-help">
|
|
22
|
+
{{ helpText }}
|
|
23
|
+
</p>
|
|
24
|
+
<div class="cn-task-form-widget__actions">
|
|
25
|
+
<NcButton
|
|
26
|
+
v-if="draftUrl"
|
|
27
|
+
variant="secondary"
|
|
28
|
+
:disabled="busy"
|
|
29
|
+
data-testid="cn-task-form-widget-draft"
|
|
30
|
+
@click="saveDraft">
|
|
31
|
+
{{ draftLabel }}
|
|
32
|
+
</NcButton>
|
|
33
|
+
<NcButton
|
|
34
|
+
variant="primary"
|
|
35
|
+
:disabled="busy"
|
|
36
|
+
data-testid="cn-task-form-widget-complete"
|
|
37
|
+
@click="complete">
|
|
38
|
+
{{ completeLabel }}
|
|
39
|
+
</NcButton>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<p v-else class="cn-task-form-widget__empty" data-testid="cn-task-form-widget-empty">
|
|
43
|
+
{{ emptyLabel }}
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import axios from '@nextcloud/axios'
|
|
50
|
+
import { emit } from '@nextcloud/event-bus'
|
|
51
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
52
|
+
import { generateUrl } from '@nextcloud/router'
|
|
53
|
+
import { NcButton } from '@nextcloud/vue'
|
|
54
|
+
import CnTaskFormFields from '../CnTaskFormFields/CnTaskFormFields.vue'
|
|
55
|
+
import { formatBoardDate, formatTimeOfDay } from '../../utils/boardDate.js'
|
|
56
|
+
import { parseAxiosError } from '../../utils/errors.js'
|
|
57
|
+
import { fillTemplate } from '../../utils/fillTemplate.js'
|
|
58
|
+
import { taskForm } from '../../utils/flowTask.js'
|
|
59
|
+
import { readPath } from '../../utils/readPath.js'
|
|
60
|
+
import { CnCardNotices } from '../CnCardNotices/index.js'
|
|
61
|
+
|
|
62
|
+
const FLOW_TASKS_URL = '/apps/openregister/api/flow-tasks'
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Whether an answer is empty: `0` and `false` are answers.
|
|
66
|
+
*
|
|
67
|
+
* @param {unknown} value The answer.
|
|
68
|
+
* @return {boolean}
|
|
69
|
+
*/
|
|
70
|
+
function isEmpty(value) {
|
|
71
|
+
return value === undefined || value === null || (typeof value === 'string' && value.trim() === '') || (Array.isArray(value) && value.length === 0)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* CnTaskFormWidget (widget type `task-form`): the form of the flow task the
|
|
76
|
+
* page shows, as a card (board DqTaak "Vraag uit de flow"): the question,
|
|
77
|
+
* the fields with a required field's refusal under it, a help line, and
|
|
78
|
+
* "Save as provisional" plus "Complete". A draft the server kept is put back
|
|
79
|
+
* with a notice saying how much of it came back.
|
|
80
|
+
*
|
|
81
|
+
* Content-only: the detail host draws the titled card around it. The task is
|
|
82
|
+
* the page's record (`objectData`).
|
|
83
|
+
*/
|
|
84
|
+
export default {
|
|
85
|
+
name: 'CnTaskFormWidget',
|
|
86
|
+
|
|
87
|
+
components: { CnCardNotices, CnTaskFormFields, NcButton },
|
|
88
|
+
|
|
89
|
+
inject: {
|
|
90
|
+
/** The host app's translate function. */
|
|
91
|
+
cnTranslate: { default: () => (key) => key },
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
props: {
|
|
95
|
+
/**
|
|
96
|
+
* The widget config:
|
|
97
|
+
*
|
|
98
|
+
* - `description` — a template filled from the task, the question above
|
|
99
|
+
* the fields; default the task form's `description`.
|
|
100
|
+
* - `help` — a muted line under the fields.
|
|
101
|
+
* - `completeUrl` — where Complete posts `{ outcome: "done", data }`;
|
|
102
|
+
* `{id}` is the task uuid. Default the engine's flow-task route.
|
|
103
|
+
* - `draft` — `{ url, method? }`: GET answers `{ values, savedAt }` (a kept
|
|
104
|
+
* draft), and "Save as provisional" sends `{ values }` (`method`, default
|
|
105
|
+
* POST); `{id}` is the task uuid. Without it there is no draft button.
|
|
106
|
+
* - `draftLabel`, `completeLabel`, `successMessage`, `draftSavedText`,
|
|
107
|
+
* `restoredText` (`{count}`, `{total}`, `{date}`), `emptyText`.
|
|
108
|
+
*
|
|
109
|
+
* @type {object}
|
|
110
|
+
*/
|
|
111
|
+
content: {
|
|
112
|
+
type: Object,
|
|
113
|
+
default: () => ({}),
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/** The page's record: the flow task. */
|
|
117
|
+
objectData: {
|
|
118
|
+
type: Object,
|
|
119
|
+
default: null,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
/** The record id, used when the task carries no uuid. */
|
|
123
|
+
objectId: {
|
|
124
|
+
type: [String, Number],
|
|
125
|
+
default: null,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
data() {
|
|
130
|
+
return {
|
|
131
|
+
/** The answers so far, keyed by field. */
|
|
132
|
+
answers: {},
|
|
133
|
+
/** The message under a field, keyed by field. */
|
|
134
|
+
errors: {},
|
|
135
|
+
/** The card's notices: the restored draft, a refusal, a saved draft. */
|
|
136
|
+
notices: [],
|
|
137
|
+
busy: false,
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
computed: {
|
|
142
|
+
/**
|
|
143
|
+
* @return {object|null} The task's form.
|
|
144
|
+
*
|
|
145
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
146
|
+
*/
|
|
147
|
+
form() {
|
|
148
|
+
return taskForm(this.objectData)
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @return {string} The task uuid.
|
|
153
|
+
*
|
|
154
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
155
|
+
*/
|
|
156
|
+
taskId() {
|
|
157
|
+
return String(this.objectData?.uuid || this.objectData?.id || this.objectId || '')
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @return {object} The answers drawn: the task's stored data under what was typed.
|
|
162
|
+
*
|
|
163
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
164
|
+
*/
|
|
165
|
+
values() {
|
|
166
|
+
const stored = this.objectData && typeof this.objectData.data === 'object' && this.objectData.data !== null ? this.objectData.data : {}
|
|
167
|
+
return { ...stored, ...this.answers }
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @return {string} The question above the fields.
|
|
172
|
+
*
|
|
173
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
174
|
+
*/
|
|
175
|
+
descriptionText() {
|
|
176
|
+
const template = this.content?.description
|
|
177
|
+
if (typeof template === 'string' && template !== '') {
|
|
178
|
+
return fillTemplate(this.translate(template), this.objectData || {})
|
|
179
|
+
}
|
|
180
|
+
const own = readPath(this.objectData || {}, 'form.description')
|
|
181
|
+
return typeof own === 'string' ? own : ''
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @return {string} The help line.
|
|
186
|
+
*
|
|
187
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
188
|
+
*/
|
|
189
|
+
helpText() {
|
|
190
|
+
return this.textOf('help', '')
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @return {string} The draft route, `{id}` filled, or ''.
|
|
195
|
+
*
|
|
196
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-can-be-saved-as-provisional-and-comes-back
|
|
197
|
+
*/
|
|
198
|
+
draftUrl() {
|
|
199
|
+
const url = this.content?.draft?.url
|
|
200
|
+
return typeof url === 'string' && url !== '' && this.taskId !== '' ? url.replace('{id}', encodeURIComponent(this.taskId)) : ''
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @return {string}
|
|
205
|
+
*
|
|
206
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-can-be-saved-as-provisional-and-comes-back
|
|
207
|
+
*/
|
|
208
|
+
draftLabel() {
|
|
209
|
+
return this.textOf('draftLabel', t('nextcloud-vue', 'Save as provisional'))
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @return {string}
|
|
214
|
+
*
|
|
215
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
216
|
+
*/
|
|
217
|
+
completeLabel() {
|
|
218
|
+
return this.textOf('completeLabel', t('nextcloud-vue', 'Complete'))
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @return {string}
|
|
223
|
+
*
|
|
224
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
225
|
+
*/
|
|
226
|
+
emptyLabel() {
|
|
227
|
+
return this.textOf('emptyText', t('nextcloud-vue', 'This task asks nothing to fill in.'))
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
watch: {
|
|
232
|
+
draftUrl: {
|
|
233
|
+
immediate: true,
|
|
234
|
+
/** @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-can-be-saved-as-provisional-and-comes-back */
|
|
235
|
+
handler(url) {
|
|
236
|
+
if (url) {
|
|
237
|
+
this.loadDraft()
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
methods: {
|
|
244
|
+
/**
|
|
245
|
+
* @param {string} text A host text.
|
|
246
|
+
* @return {string} It translated.
|
|
247
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
248
|
+
*/
|
|
249
|
+
translate(text) {
|
|
250
|
+
return typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @param {string} key A content key.
|
|
255
|
+
* @param {string} fallback The library's words.
|
|
256
|
+
* @return {string} The content's text, translated, else the fallback.
|
|
257
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
258
|
+
*/
|
|
259
|
+
textOf(key, fallback) {
|
|
260
|
+
const text = this.content?.[key]
|
|
261
|
+
return typeof text === 'string' && text !== '' ? this.translate(text) : fallback
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param {{field: string, value: unknown}} answer One answer typed.
|
|
266
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
267
|
+
*/
|
|
268
|
+
onAnswer({ field, value }) {
|
|
269
|
+
this.answers = { ...this.answers, [field]: value }
|
|
270
|
+
if (this.errors[field]) {
|
|
271
|
+
const { [field]: _, ...rest } = this.errors
|
|
272
|
+
this.errors = rest
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @param {object} notice The closed notice.
|
|
278
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
279
|
+
*/
|
|
280
|
+
onDismiss(notice) {
|
|
281
|
+
this.notices = this.notices.filter((entry) => entry !== notice)
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Read the draft the server kept and put it back, saying how much came back.
|
|
286
|
+
*
|
|
287
|
+
* @return {Promise<void>}
|
|
288
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-can-be-saved-as-provisional-and-comes-back
|
|
289
|
+
*/
|
|
290
|
+
async loadDraft() {
|
|
291
|
+
try {
|
|
292
|
+
const { data } = await axios.get(generateUrl(this.draftUrl))
|
|
293
|
+
const kept = data && typeof data.values === 'object' && data.values !== null ? data.values : null
|
|
294
|
+
const count = kept ? Object.keys(kept).filter((key) => !isEmpty(kept[key])).length : 0
|
|
295
|
+
if (!kept || count === 0) {
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
this.answers = { ...kept, ...this.answers }
|
|
299
|
+
const total = Array.isArray(this.form?.fields) ? this.form.fields.length : count
|
|
300
|
+
const savedAt = data.savedAt ? new Date(data.savedAt) : null
|
|
301
|
+
const date = savedAt && !Number.isNaN(savedAt.getTime()) ? `${formatBoardDate(savedAt)} ${formatTimeOfDay(savedAt)}` : ''
|
|
302
|
+
const template = this.textOf('restoredText', t('nextcloud-vue', 'Unsaved input restored: {count} of {total} fields from your previous visit, {date}. Check them and save.'))
|
|
303
|
+
this.notices = [{
|
|
304
|
+
id: 'draft-restored',
|
|
305
|
+
variant: 'info',
|
|
306
|
+
role: 'status',
|
|
307
|
+
text: template.replace('{count}', String(count)).replace('{total}', String(total)).replace('{date}', date),
|
|
308
|
+
}]
|
|
309
|
+
} catch {
|
|
310
|
+
// No draft kept, or the route is not there: the form starts empty.
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Save what was typed as provisional, required fields left open.
|
|
316
|
+
*
|
|
317
|
+
* @return {Promise<void>}
|
|
318
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-task-form-can-be-saved-as-provisional-and-comes-back
|
|
319
|
+
*/
|
|
320
|
+
async saveDraft() {
|
|
321
|
+
this.busy = true
|
|
322
|
+
try {
|
|
323
|
+
const method = String(this.content?.draft?.method || 'post').toLowerCase() === 'put' ? 'put' : 'post'
|
|
324
|
+
await axios[method](generateUrl(this.draftUrl), { values: this.values })
|
|
325
|
+
this.notices = [{ id: 'draft-saved', variant: 'success', role: 'status', text: this.textOf('draftSavedText', t('nextcloud-vue', 'Saved as provisional.')), dismissible: true }]
|
|
326
|
+
} catch (error) {
|
|
327
|
+
this.refused(error)
|
|
328
|
+
} finally {
|
|
329
|
+
this.busy = false
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Complete the task with the answers. A required field left empty is
|
|
335
|
+
* refused under that field before anything is sent.
|
|
336
|
+
*
|
|
337
|
+
* @return {Promise<void>}
|
|
338
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
339
|
+
*/
|
|
340
|
+
async complete() {
|
|
341
|
+
const missing = (Array.isArray(this.form?.fields) ? this.form.fields : [])
|
|
342
|
+
.filter((field) => field && field.required === true && field.renderable !== false && isEmpty(this.values[field.field]))
|
|
343
|
+
if (missing.length > 0) {
|
|
344
|
+
this.errors = Object.fromEntries(missing.map((field) => [field.field, t('nextcloud-vue', 'Completing was refused: fill in {field}.', { field: field.label || field.field })]))
|
|
345
|
+
return
|
|
346
|
+
}
|
|
347
|
+
this.busy = true
|
|
348
|
+
try {
|
|
349
|
+
const route = typeof this.content?.completeUrl === 'string' && this.content.completeUrl !== ''
|
|
350
|
+
? this.content.completeUrl.replace('{id}', encodeURIComponent(this.taskId))
|
|
351
|
+
: `${FLOW_TASKS_URL}/${encodeURIComponent(this.taskId)}/complete`
|
|
352
|
+
await axios.post(generateUrl(route), { outcome: 'done', data: this.values })
|
|
353
|
+
this.notices = [{ id: 'completed', variant: 'success', role: 'status', text: this.textOf('successMessage', t('nextcloud-vue', 'Task completed.')) }]
|
|
354
|
+
emit('cn:page:refresh', { source: 'task-form', id: this.taskId })
|
|
355
|
+
} catch (error) {
|
|
356
|
+
this.refused(error)
|
|
357
|
+
} finally {
|
|
358
|
+
this.busy = false
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* A refusal in the server's words, in the card.
|
|
364
|
+
*
|
|
365
|
+
* @param {unknown} error The caught error.
|
|
366
|
+
* @spec openspec/changes/task-form-widget/specs/task-form-widget/spec.md#requirement-a-flow-tasks-form-is-a-card-of-its-own
|
|
367
|
+
*/
|
|
368
|
+
refused(error) {
|
|
369
|
+
const { message } = parseAxiosError(error)
|
|
370
|
+
this.notices = [{ id: 'refused', variant: 'error', role: 'alert', text: message || t('nextcloud-vue', 'This could not be done. Try again.'), dismissible: true }]
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
}
|
|
374
|
+
</script>
|
|
375
|
+
|
|
376
|
+
<style scoped>
|
|
377
|
+
.cn-task-form-widget {
|
|
378
|
+
display: flex;
|
|
379
|
+
flex-direction: column;
|
|
380
|
+
gap: 12px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.cn-task-form-widget__description,
|
|
384
|
+
.cn-task-form-widget__help,
|
|
385
|
+
.cn-task-form-widget__empty {
|
|
386
|
+
margin: 0;
|
|
387
|
+
color: var(--color-text-maxcontrast);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.cn-task-form-widget__help {
|
|
391
|
+
font-size: 13px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.cn-task-form-widget__actions {
|
|
395
|
+
display: flex;
|
|
396
|
+
flex-wrap: wrap;
|
|
397
|
+
justify-content: flex-end;
|
|
398
|
+
gap: 8px;
|
|
399
|
+
}
|
|
400
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
* SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
*
|
|
5
|
+
* CnTaskFormWidget - self-registers the `task-form` widget type (the form of
|
|
6
|
+
* the flow task a detail page shows, with Save as provisional and Complete)
|
|
7
|
+
* into the shared dashboardWidgetRegistry at module load.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import CnTaskFormWidget from './CnTaskFormWidget.vue'
|
|
11
|
+
import { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'
|
|
12
|
+
|
|
13
|
+
registerDashboardWidget('task-form', {
|
|
14
|
+
renderer: CnTaskFormWidget,
|
|
15
|
+
form: null,
|
|
16
|
+
defaultContent: {},
|
|
17
|
+
displayName: 'Task form',
|
|
18
|
+
icon: 'FormSelect',
|
|
19
|
+
surfaces: ['detail-page'],
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export { CnTaskFormWidget }
|
|
23
|
+
export default CnTaskFormWidget
|
|
@@ -168,8 +168,16 @@
|
|
|
168
168
|
@click="complete(task, outcomeId(outcomesOf(task)[0]))">
|
|
169
169
|
{{ tr('Complete') }}
|
|
170
170
|
</NcButton>
|
|
171
|
+
<!-- `cancelInline`: Cancel as a button beside Complete (DqZaakTaken). -->
|
|
172
|
+
<NcButton
|
|
173
|
+
v-if="content.cancelInline === true && canCancelRow(task)"
|
|
174
|
+
variant="secondary"
|
|
175
|
+
:data-testid="`cn-tasks-widget-cancel-${task.uuid}`"
|
|
176
|
+
@click="cancel(task)">
|
|
177
|
+
{{ tr('Cancel') }}
|
|
178
|
+
</NcButton>
|
|
171
179
|
<NcActions
|
|
172
|
-
v-if="(canCompleteRow(task) && outcomesOf(task).length > 1) || canCancelRow(task)"
|
|
180
|
+
v-if="(canCompleteRow(task) && outcomesOf(task).length > 1) || (canCancelRow(task) && content.cancelInline !== true)"
|
|
173
181
|
:forceMenu="true"
|
|
174
182
|
:aria-label="tr('Task actions')">
|
|
175
183
|
<template v-if="canCompleteRow(task) && outcomesOf(task).length > 1">
|
|
@@ -182,7 +190,7 @@
|
|
|
182
190
|
</NcActionButton>
|
|
183
191
|
</template>
|
|
184
192
|
<NcActionButton
|
|
185
|
-
v-if="canCancelRow(task)"
|
|
193
|
+
v-if="canCancelRow(task) && content.cancelInline !== true"
|
|
186
194
|
:closeAfterClick="true"
|
|
187
195
|
:data-testid="`cn-tasks-widget-cancel-${task.uuid}`"
|
|
188
196
|
@click="cancel(task)">
|
|
@@ -541,6 +549,10 @@ export default {
|
|
|
541
549
|
* task is posted as an open task on `objectUuid`.
|
|
542
550
|
* - `completeAny` — offer Complete on every open row, not only the
|
|
543
551
|
* viewer's own (the server still decides); `cancel` — offer Cancel.
|
|
552
|
+
* - `cancelInline` — in the table, Cancel is a secondary button beside
|
|
553
|
+
* Complete instead of an entry in the row's menu.
|
|
554
|
+
* - `summaryNote` — a text appended to the table's summary after " · "
|
|
555
|
+
* ("the tasks of the whole case, colleagues' too").
|
|
544
556
|
* - `variant: 'focus'` — the first open task to work on in place: its
|
|
545
557
|
* number, handler, deadline, lock, who it is offered to, its form
|
|
546
558
|
* inline and its verbs, with the other open tasks listed under it.
|
|
@@ -846,9 +858,11 @@ export default {
|
|
|
846
858
|
summaryLabel() {
|
|
847
859
|
const open = this.rows.filter((task) => task.isTerminal !== true).length
|
|
848
860
|
const done = this.rows.length - open
|
|
849
|
-
|
|
861
|
+
const line = this.tr('{open} open, {done} done · sorted by deadline')
|
|
850
862
|
.replace('{open}', String(open))
|
|
851
863
|
.replace('{done}', String(done))
|
|
864
|
+
const note = typeof this.content.summaryNote === 'string' && this.content.summaryNote !== '' ? this.tr(this.content.summaryNote) : ''
|
|
865
|
+
return note === '' ? line : `${line} · ${note}`
|
|
852
866
|
},
|
|
853
867
|
|
|
854
868
|
/**
|
|
@@ -105,6 +105,7 @@ import '../CnSlotGrid/index.js'
|
|
|
105
105
|
import '../CnChoicePickerWidget/index.js'
|
|
106
106
|
import '../CnConflictResolveCard/index.js'
|
|
107
107
|
import '../CnShareList/index.js'
|
|
108
|
+
import '../CnTaskFormWidget/index.js'
|
|
108
109
|
import '../CnRecordListWidget/index.js'
|
|
109
110
|
import '../CnIndexListWidget/index.js'
|
|
110
111
|
import '../CnStatGridWidget/index.js'
|
package/src/components/index.js
CHANGED
|
@@ -92,7 +92,7 @@ export { CnThemePreview } from './CnThemePreview/index.js'
|
|
|
92
92
|
export { CnRelationshipGraph } from './CnRelationshipGraph/index.js'
|
|
93
93
|
export { CnGraphCanvas } from './CnGraphCanvas/index.js'
|
|
94
94
|
export { CnStateMachineEditor } from './CnStateMachineEditor/index.js'
|
|
95
|
-
export { CnFlowDetail, CnFlowIndexPage, CnFlowSidebar } from './CnFlowDetail/index.js'
|
|
95
|
+
export { CnFlowDetail, CnFlowIndexPage, CnFlowSidebar, CnFlowStepList, CnFlowViewSwitch } from './CnFlowDetail/index.js'
|
|
96
96
|
export { CnIcon, ICON_MAP, registerIcons } from './CnIcon/index.js'
|
|
97
97
|
export {
|
|
98
98
|
conceptForIcon,
|
|
@@ -316,6 +316,7 @@ export { CnWorkspaceFilterWidget } from './CnWorkspaceFilterWidget/index.js'
|
|
|
316
316
|
export { CnFilePreview } from './CnFilePreview/index.js'
|
|
317
317
|
export { CnTaskFormDialog } from './CnTaskFormDialog/index.js'
|
|
318
318
|
export { CnTaskFormFields } from './CnTaskFormFields/index.js'
|
|
319
|
+
export { CnTaskFormWidget } from './CnTaskFormWidget/index.js'
|
|
319
320
|
export { CnChildRecordsField } from './CnChildRecordsField/index.js'
|
|
320
321
|
export { CnApiReference } from './CnApiReference/index.js'
|
|
321
322
|
export { CnMarkdownWidget } from './CnMarkdownWidget/index.js'
|