@conduction/nextcloud-vue 2.174.0 → 2.176.1
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 +114 -11
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +323 -7
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +255 -10
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
- package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
- package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
- 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 +158 -6
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +79 -14
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +79 -14
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1162 -523
- package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
- package/dist/esm/utils/captureLocation.js +32 -0
- package/dist/esm/utils/captureLocation.js.map +1 -0
- package/dist/esm/utils/childRecordTotals.js +157 -0
- package/dist/esm/utils/childRecordTotals.js.map +1 -0
- package/dist/esm/utils/isoDuration.js +51 -1
- package/dist/esm/utils/isoDuration.js.map +1 -1
- package/dist/esm/utils/parentCrumb.js +86 -0
- package/dist/esm/utils/parentCrumb.js.map +1 -0
- package/dist/esm/utils/qr.js +649 -0
- package/dist/esm/utils/qr.js.map +1 -0
- package/dist/esm/utils/schema.js +3 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/templateVariables.js +54 -0
- package/dist/esm/utils/templateVariables.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +21125 -15025
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1162 -523
- package/l10n/en.json +79 -14
- package/l10n/nl.json +79 -14
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
- package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
- package/src/components/CnBlockListEditor/index.js +9 -0
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
- package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
- package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
- package/src/components/CnChoiceMatrix/index.js +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
- package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
- package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
- package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
- package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
- package/src/components/CnDisplayScreen/index.js +9 -0
- package/src/components/CnDurationField/CnDurationField.vue +330 -5
- package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
- package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
- package/src/components/CnGeoCaptureField/index.js +9 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
- package/src/components/CnQrCode/CnQrCode.vue +321 -0
- package/src/components/CnQrCode/index.js +9 -0
- package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
- package/src/components/CnRevealField/CnRevealField.vue +273 -0
- package/src/components/CnRevealField/index.js +9 -0
- package/src/components/CnStorePage/CnStorePage.vue +8 -8
- package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
- package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
- package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
- package/src/components/CnTransferCard/index.js +9 -0
- package/src/components/CnTreeView/CnTreeNode.vue +145 -2
- package/src/components/CnTreeView/CnTreeView.vue +210 -6
- package/src/components/index.js +7 -0
- package/src/index.js +8 -0
- package/src/utils/captureLocation.js +29 -0
- package/src/utils/childRecordTotals.js +153 -0
- package/src/utils/isoDuration.js +50 -0
- package/src/utils/parentCrumb.js +83 -0
- package/src/utils/qr.js +681 -0
- package/src/utils/schema.js +3 -0
- package/src/utils/templateVariables.js +51 -0
|
@@ -20,6 +20,22 @@
|
|
|
20
20
|
class="cn-checklist-run__form"
|
|
21
21
|
novalidate
|
|
22
22
|
@submit.prevent="next">
|
|
23
|
+
<div v-if="timeLeftText || savedLine" class="cn-checklist-run__status">
|
|
24
|
+
<span v-if="timeLeftText"
|
|
25
|
+
class="cn-checklist-run__time-left"
|
|
26
|
+
:class="{ 'cn-checklist-run__time-left--warning': timeWarning }"
|
|
27
|
+
role="timer"
|
|
28
|
+
aria-live="off"
|
|
29
|
+
data-testid="cn-checklist-run-time-left">
|
|
30
|
+
{{ timeLeftText }}
|
|
31
|
+
</span>
|
|
32
|
+
<span v-if="savedLine"
|
|
33
|
+
class="cn-checklist-run__saved"
|
|
34
|
+
role="status"
|
|
35
|
+
data-testid="cn-checklist-run-saved">
|
|
36
|
+
{{ savedLine }}
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
23
39
|
<p
|
|
24
40
|
ref="position"
|
|
25
41
|
class="cn-checklist-run__position"
|
|
@@ -103,6 +119,13 @@
|
|
|
103
119
|
data-testid="cn-checklist-run-note"
|
|
104
120
|
@input="markDirty(question.id)" />
|
|
105
121
|
</label>
|
|
122
|
+
<CnGeoCaptureField
|
|
123
|
+
v-if="locationField && (locating[question.id] || draft[question.id].location)"
|
|
124
|
+
:modelValue="draft[question.id].location || null"
|
|
125
|
+
:busy="locating[question.id] === true"
|
|
126
|
+
:goodAccuracy="goodAccuracy"
|
|
127
|
+
data-testid="cn-checklist-run-location"
|
|
128
|
+
@update:modelValue="setLocation(question.id, $event)" />
|
|
106
129
|
<p
|
|
107
130
|
v-if="missing.includes(question.id)"
|
|
108
131
|
class="cn-checklist-run__error"
|
|
@@ -157,15 +180,22 @@
|
|
|
157
180
|
<div class="cn-checklist-run__nav">
|
|
158
181
|
<NcButton
|
|
159
182
|
variant="secondary"
|
|
160
|
-
:disabled="page === 0 || saving"
|
|
183
|
+
:disabled="page === 0 || saving || closed"
|
|
161
184
|
data-testid="cn-checklist-run-previous"
|
|
162
185
|
@click="previous">
|
|
163
186
|
{{ previousLabel }}
|
|
164
187
|
</NcButton>
|
|
165
|
-
<NcButton
|
|
188
|
+
<NcButton v-if="submitLabel"
|
|
189
|
+
variant="secondary"
|
|
190
|
+
:disabled="saving || closed"
|
|
191
|
+
data-testid="cn-checklist-run-submit"
|
|
192
|
+
@click="submit">
|
|
193
|
+
{{ submitLabel }}
|
|
194
|
+
</NcButton>
|
|
195
|
+
<NcButton v-if="!submitLabel || !isLastPage"
|
|
166
196
|
variant="primary"
|
|
167
197
|
type="submit"
|
|
168
|
-
:disabled="saving"
|
|
198
|
+
:disabled="saving || closed"
|
|
169
199
|
data-testid="cn-checklist-run-next">
|
|
170
200
|
{{ isLastPage ? finishLabel : nextLabel }}
|
|
171
201
|
</NcButton>
|
|
@@ -189,10 +219,16 @@ import CameraOutline from 'vue-material-design-icons/CameraOutline.vue'
|
|
|
189
219
|
import { uploadHeldFiles } from '../../composables/useHeldFileUpload.js'
|
|
190
220
|
import { dispatchAction } from '../../utils/actionsDispatcher.js'
|
|
191
221
|
import { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'
|
|
222
|
+
import { captureLocation } from '../../utils/captureLocation.js'
|
|
223
|
+
import { parseDateValue } from '../../utils/dateVariant.js'
|
|
192
224
|
import { readPath } from '../../utils/readPath.js'
|
|
193
225
|
import { hasUnresolvedTokens, resolveDeepTokens, resolveFilterTokens } from '../../utils/resolveFilterTokens.js'
|
|
226
|
+
import { CnGeoCaptureField } from '../CnGeoCaptureField/index.js'
|
|
194
227
|
|
|
195
228
|
const OBJECT_API = '/apps/openregister/api/objects'
|
|
229
|
+
const TICK_MS = 1000
|
|
230
|
+
const DEFAULT_TIME_WARNING_SECONDS = 300
|
|
231
|
+
const LAST_MINUTE_SECONDS = 60
|
|
196
232
|
|
|
197
233
|
let instanceCounter = 0
|
|
198
234
|
|
|
@@ -251,6 +287,21 @@ function idOf(object) {
|
|
|
251
287
|
return String(object?.id ?? object?.['@self']?.id ?? object?.uuid ?? '')
|
|
252
288
|
}
|
|
253
289
|
|
|
290
|
+
/**
|
|
291
|
+
* A number of seconds as a clock: "18:42", or "1:04:05" from an hour.
|
|
292
|
+
*
|
|
293
|
+
* @param {number} seconds The seconds.
|
|
294
|
+
* @return {string} The clock.
|
|
295
|
+
*/
|
|
296
|
+
function clockOf(seconds) {
|
|
297
|
+
const pad = (value) => String(value).padStart(2, '0')
|
|
298
|
+
const hours = Math.floor(seconds / 3600)
|
|
299
|
+
const minutes = Math.floor((seconds % 3600) / 60)
|
|
300
|
+
return hours > 0
|
|
301
|
+
? `${hours}:${pad(minutes)}:${pad(seconds % 60)}`
|
|
302
|
+
: `${pad(minutes)}:${pad(seconds % 60)}`
|
|
303
|
+
}
|
|
304
|
+
|
|
254
305
|
/**
|
|
255
306
|
* CnChecklistRunWidget — the `checklist-run` widget: a checklist answered a
|
|
256
307
|
* page of questions at a time (board DqInspectie, the middle phone frame).
|
|
@@ -299,6 +350,13 @@ function idOf(object) {
|
|
|
299
350
|
* with no bound record, `record: { register, schema, filter, sort }` picks
|
|
300
351
|
* the open record: the first match, under the reader's rights.
|
|
301
352
|
*
|
|
353
|
+
* A timed run names the record's deadline in `deadlineField`: the time left
|
|
354
|
+
* follows that moment rather than the page's start, so a reload keeps it. At
|
|
355
|
+
* zero the page is saved and the run finishes. `submitLabel` adds a button
|
|
356
|
+
* that finishes from any page, and `savedText` says so while nothing is unsaved.
|
|
357
|
+
* `saveEachAnswer: true` (or a wait in ms) saves each answer a moment after
|
|
358
|
+
* it is given instead of when the user moves on.
|
|
359
|
+
*
|
|
302
360
|
* `noteWhen: { answers: [...] }` shows a question's note field only once its
|
|
303
361
|
* answer is one of those stored values (the board shows a note under "Nee"),
|
|
304
362
|
* or when the question already holds a note; without it every question shows
|
|
@@ -310,6 +368,11 @@ function idOf(object) {
|
|
|
310
368
|
* question, where the inspector was; without it the run opens at the first
|
|
311
369
|
* page.
|
|
312
370
|
*
|
|
371
|
+
* `captureLocation: { field, goodAccuracy? }` captures where each answer was
|
|
372
|
+
* given, unasked, the first time it changes: the page's save waits for the
|
|
373
|
+
* device, a rough fix or none says so and takes an address by hand, and the
|
|
374
|
+
* place is stored in `field` of the answer.
|
|
375
|
+
*
|
|
313
376
|
* Question kinds: `yes_no`, `yes_no_na`, `choice` (the question's `options`,
|
|
314
377
|
* a list of strings or `{ value, label }`), `number`, `photo` and `text`.
|
|
315
378
|
* `typeMap` maps the app's type values onto them, `choiceValues` the stored
|
|
@@ -321,7 +384,7 @@ function idOf(object) {
|
|
|
321
384
|
export default {
|
|
322
385
|
name: 'CnChecklistRunWidget',
|
|
323
386
|
|
|
324
|
-
components: { CameraOutline, NcButton, NcLoadingIcon },
|
|
387
|
+
components: { CameraOutline, CnGeoCaptureField, NcButton, NcLoadingIcon },
|
|
325
388
|
|
|
326
389
|
inject: {
|
|
327
390
|
/** The detail page's object context (`{ objectId, object }`), for tokens. */
|
|
@@ -340,7 +403,9 @@ export default {
|
|
|
340
403
|
* groupLabelField?, orderField?, fields?, typeMap?, choiceValues?,
|
|
341
404
|
* answers | answersPath, answerKey?, answerFields?, recordPhotosField?,
|
|
342
405
|
* record?, saveAction?, finishAction?, pageSize?, allowNote?, noteWhen?,
|
|
343
|
-
* allowPhotos?, caption?, emptyText
|
|
406
|
+
* allowPhotos?, caption?, emptyText?, deadlineField?, serverNowField?,
|
|
407
|
+
* timeLeftText?, timeWarningSeconds?, savedText?, submitLabel?,
|
|
408
|
+
* saveEachAnswer? }`, as in the component
|
|
344
409
|
* description and docs/components/cn-checklist-run-widget.md.
|
|
345
410
|
*
|
|
346
411
|
* @type {object}
|
|
@@ -393,6 +458,8 @@ export default {
|
|
|
393
458
|
recordAnswers: [],
|
|
394
459
|
draft: {},
|
|
395
460
|
dirty: {},
|
|
461
|
+
locating: {},
|
|
462
|
+
locationPending: {},
|
|
396
463
|
photos: {},
|
|
397
464
|
page: 0,
|
|
398
465
|
// The source the page was last positioned for; `startAt` applies once per source.
|
|
@@ -403,10 +470,33 @@ export default {
|
|
|
403
470
|
// `content.record` with a filter: the record it picked, or null.
|
|
404
471
|
pickedRecord: null,
|
|
405
472
|
liveText: '',
|
|
473
|
+
// The deadline ticker: the moment now, its timer, and whether the run has finished.
|
|
474
|
+
now: Date.now(),
|
|
475
|
+
recordReadAt: Date.now(),
|
|
476
|
+
deadlineTimer: null,
|
|
477
|
+
// `saveEachAnswer`: the pending save, and the save that runs now.
|
|
478
|
+
answerSaveTimer: null,
|
|
479
|
+
pageSave: null,
|
|
480
|
+
finishedRun: false,
|
|
406
481
|
}
|
|
407
482
|
},
|
|
408
483
|
|
|
409
484
|
computed: {
|
|
485
|
+
/**
|
|
486
|
+
* The wait before an answer saves on its own (`saveEachAnswer`: `true`
|
|
487
|
+
* waits 800 ms, a number that many ms), or null to save on moving on.
|
|
488
|
+
*
|
|
489
|
+
* @return {number|null}
|
|
490
|
+
* @spec openspec/changes/checklist-run-save-each-answer/specs/checklist-run-widget/spec.md#requirement-a-run-can-save-each-answer-as-it-is-given
|
|
491
|
+
*/
|
|
492
|
+
answerSaveDelay() {
|
|
493
|
+
const option = this.content?.saveEachAnswer
|
|
494
|
+
if (option === true) {
|
|
495
|
+
return 800
|
|
496
|
+
}
|
|
497
|
+
return typeof option === 'number' && option >= 0 ? option : null
|
|
498
|
+
},
|
|
499
|
+
|
|
410
500
|
/** @return {object} What the tokens resolve against. */
|
|
411
501
|
tokenCtx() {
|
|
412
502
|
const unwrap = (c) => (c && typeof c === 'object' && 'value' in c ? c.value : c)
|
|
@@ -481,6 +571,16 @@ export default {
|
|
|
481
571
|
}).trim()
|
|
482
572
|
},
|
|
483
573
|
|
|
574
|
+
/** @return {string} The answer field a captured place is stored in, '' when none is asked for. */
|
|
575
|
+
locationField() {
|
|
576
|
+
return this.content?.captureLocation?.field || ''
|
|
577
|
+
},
|
|
578
|
+
|
|
579
|
+
/** @return {number} The accuracy in metres above which a fix counts as low. */
|
|
580
|
+
goodAccuracy() {
|
|
581
|
+
return this.content?.captureLocation?.goodAccuracy ?? 50
|
|
582
|
+
},
|
|
583
|
+
|
|
484
584
|
/** @return {boolean} Whether a note field shows (default true). */
|
|
485
585
|
allowNote() {
|
|
486
586
|
return this.content?.allowNote !== false
|
|
@@ -609,6 +709,60 @@ export default {
|
|
|
609
709
|
photoOnlyLabel: () => t('nextcloud-vue', 'Answer with a photo.'),
|
|
610
710
|
morePhotoLabel: () => t('nextcloud-vue', 'Another photo'),
|
|
611
711
|
|
|
712
|
+
/** @return {number|null} The deadline as read off the open record, on this device's clock; null without one. */
|
|
713
|
+
deadlineAt() {
|
|
714
|
+
const field = this.content?.deadlineField
|
|
715
|
+
const date = field ? parseDateValue(readPath(this.openRecord, field)) : null
|
|
716
|
+
return date ? date.getTime() + this.serverOffset : null
|
|
717
|
+
},
|
|
718
|
+
|
|
719
|
+
/** @return {number} How far this device's clock runs ahead of the server's, in milliseconds. */
|
|
720
|
+
serverOffset() {
|
|
721
|
+
const field = this.content?.serverNowField
|
|
722
|
+
const serverNow = field ? parseDateValue(readPath(this.openRecord, field)) : null
|
|
723
|
+
return serverNow ? this.recordReadAt - serverNow.getTime() : 0
|
|
724
|
+
},
|
|
725
|
+
|
|
726
|
+
/** @return {number|null} Whole seconds until the deadline, never below 0; null without one. */
|
|
727
|
+
secondsLeft() {
|
|
728
|
+
return this.deadlineAt === null ? null : Math.max(0, Math.ceil((this.deadlineAt - this.now) / 1000))
|
|
729
|
+
},
|
|
730
|
+
|
|
731
|
+
/** @return {boolean} Whether the time left is in its warning stretch. */
|
|
732
|
+
timeWarning() {
|
|
733
|
+
return this.secondsLeft !== null && this.secondsLeft <= (this.content?.timeWarningSeconds ?? DEFAULT_TIME_WARNING_SECONDS)
|
|
734
|
+
},
|
|
735
|
+
|
|
736
|
+
/** @return {string} The time left in words, or ''. */
|
|
737
|
+
timeLeftText() {
|
|
738
|
+
if (this.secondsLeft === null) {
|
|
739
|
+
return ''
|
|
740
|
+
}
|
|
741
|
+
const time = clockOf(this.secondsLeft)
|
|
742
|
+
return this.content?.timeLeftText
|
|
743
|
+
? this.translate(this.content.timeLeftText).replace('{time}', time)
|
|
744
|
+
: t('nextcloud-vue', 'Time left: {time}', { time })
|
|
745
|
+
},
|
|
746
|
+
|
|
747
|
+
/** @return {string} `savedText`, while nothing is unsaved and something was answered. */
|
|
748
|
+
savedLine() {
|
|
749
|
+
const text = this.content?.savedText
|
|
750
|
+
if (!text || this.answeredCount === 0 || Object.keys(this.dirty).length > 0 || this.saveError) {
|
|
751
|
+
return ''
|
|
752
|
+
}
|
|
753
|
+
return this.translate(text)
|
|
754
|
+
},
|
|
755
|
+
|
|
756
|
+
/** @return {boolean} A timed run finishes once: it is over, so nothing moves any more. */
|
|
757
|
+
closed() {
|
|
758
|
+
return this.finishedRun && this.deadlineAt !== null
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
/** @return {string} The label of the button that finishes from any page, or ''. */
|
|
762
|
+
submitLabel() {
|
|
763
|
+
return this.content?.submitLabel ? this.translate(this.content.submitLabel) : ''
|
|
764
|
+
},
|
|
765
|
+
|
|
612
766
|
/** @return {string} The note field's label. */
|
|
613
767
|
noteLabel() {
|
|
614
768
|
return this.content?.noteLabel ? this.translate(this.content.noteLabel) : t('nextcloud-vue', 'Note')
|
|
@@ -628,9 +782,82 @@ export default {
|
|
|
628
782
|
|
|
629
783
|
immediate: true,
|
|
630
784
|
},
|
|
785
|
+
|
|
786
|
+
openRecord: {
|
|
787
|
+
handler() {
|
|
788
|
+
this.recordReadAt = Date.now()
|
|
789
|
+
},
|
|
790
|
+
|
|
791
|
+
immediate: true,
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
deadlineAt() {
|
|
795
|
+
this.startDeadlineTimer()
|
|
796
|
+
},
|
|
797
|
+
|
|
798
|
+
'questions.length': function() {
|
|
799
|
+
this.startDeadlineTimer()
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
|
|
803
|
+
mounted() {
|
|
804
|
+
this.startDeadlineTimer()
|
|
805
|
+
},
|
|
806
|
+
|
|
807
|
+
beforeUnmount() {
|
|
808
|
+
clearInterval(this.deadlineTimer)
|
|
809
|
+
if (this.answerSaveTimer) {
|
|
810
|
+
clearTimeout(this.answerSaveTimer)
|
|
811
|
+
this.answerSaveTimer = null
|
|
812
|
+
this.savePage()
|
|
813
|
+
}
|
|
631
814
|
},
|
|
632
815
|
|
|
633
816
|
methods: {
|
|
817
|
+
/**
|
|
818
|
+
* Run the ticker while a run with questions has a deadline.
|
|
819
|
+
*
|
|
820
|
+
* @return {void}
|
|
821
|
+
*/
|
|
822
|
+
startDeadlineTimer() {
|
|
823
|
+
clearInterval(this.deadlineTimer)
|
|
824
|
+
this.deadlineTimer = null
|
|
825
|
+
if (this.deadlineAt === null || this.questions.length === 0 || this.finishedRun) {
|
|
826
|
+
return
|
|
827
|
+
}
|
|
828
|
+
this.deadlineTimer = setInterval(this.onDeadlineTick, TICK_MS)
|
|
829
|
+
this.onDeadlineTick()
|
|
830
|
+
},
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Bring the time left up to date, say the warning and the last minute
|
|
834
|
+
* once, and at zero save and finish. A failed save leaves the run open,
|
|
835
|
+
* so the user can try again and sees why. While a save runs it waits for
|
|
836
|
+
* the next tick.
|
|
837
|
+
*
|
|
838
|
+
* @return {Promise<void>}
|
|
839
|
+
*/
|
|
840
|
+
async onDeadlineTick() {
|
|
841
|
+
const before = this.secondsLeft
|
|
842
|
+
this.now = Date.now()
|
|
843
|
+
const left = this.secondsLeft
|
|
844
|
+
if (left === null) {
|
|
845
|
+
return
|
|
846
|
+
}
|
|
847
|
+
const warning = this.content?.timeWarningSeconds ?? DEFAULT_TIME_WARNING_SECONDS
|
|
848
|
+
if (left > 0 && before !== null && [warning, LAST_MINUTE_SECONDS].some((mark) => before > mark && left <= mark)) {
|
|
849
|
+
this.liveText = this.timeLeftText
|
|
850
|
+
}
|
|
851
|
+
if (left > 0 || this.saving) {
|
|
852
|
+
return
|
|
853
|
+
}
|
|
854
|
+
clearInterval(this.deadlineTimer)
|
|
855
|
+
this.deadlineTimer = null
|
|
856
|
+
if (await this.savePage()) {
|
|
857
|
+
await this.finish('deadline')
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
|
|
634
861
|
/**
|
|
635
862
|
* Whether a question shows its note field: always, unless `noteWhen`
|
|
636
863
|
* names the answers that ask for one and this question has none of
|
|
@@ -889,7 +1116,7 @@ export default {
|
|
|
889
1116
|
const qid = String(readPath(entry, key) ?? '')
|
|
890
1117
|
const question = questions.find((x) => x.id === qid)
|
|
891
1118
|
if (question && !answerIds[qid]) {
|
|
892
|
-
draft[qid] = this.draftFromEntry(question, entry)
|
|
1119
|
+
draft[qid] = { ...this.draftFromEntry(question, entry), location: this.locationField ? (readPath(entry, this.locationField) ?? null) : null }
|
|
893
1120
|
answerIds[qid] = qid
|
|
894
1121
|
const photos = readPath(entry, this.answerFields.photos)
|
|
895
1122
|
storedPhotos[qid] = Array.isArray(photos) ? photos : []
|
|
@@ -902,6 +1129,7 @@ export default {
|
|
|
902
1129
|
draft[qid] = {
|
|
903
1130
|
value: String(readPath(answer, a.valueField || 'answer') ?? ''),
|
|
904
1131
|
note: String(readPath(answer, a.noteField || 'note') ?? ''),
|
|
1132
|
+
location: this.locationField ? (readPath(answer, this.locationField) ?? null) : null,
|
|
905
1133
|
}
|
|
906
1134
|
answerIds[qid] = idOf(answer)
|
|
907
1135
|
const stored = a.photosField ? readPath(answer, a.photosField) : null
|
|
@@ -939,6 +1167,60 @@ export default {
|
|
|
939
1167
|
markDirty(id) {
|
|
940
1168
|
this.dirty = { ...this.dirty, [id]: true }
|
|
941
1169
|
this.missing = this.missing.filter((m) => m !== id)
|
|
1170
|
+
this.startLocating(id)
|
|
1171
|
+
this.scheduleAnswerSave()
|
|
1172
|
+
},
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* With `saveEachAnswer`, save the page a moment after the last change,
|
|
1176
|
+
* so typing saves once and a quick run of answers saves together.
|
|
1177
|
+
*
|
|
1178
|
+
* @return {void}
|
|
1179
|
+
* @spec openspec/changes/checklist-run-save-each-answer/specs/checklist-run-widget/spec.md#requirement-a-run-can-save-each-answer-as-it-is-given
|
|
1180
|
+
*/
|
|
1181
|
+
scheduleAnswerSave() {
|
|
1182
|
+
const delay = this.answerSaveDelay
|
|
1183
|
+
if (delay === null) {
|
|
1184
|
+
return
|
|
1185
|
+
}
|
|
1186
|
+
clearTimeout(this.answerSaveTimer)
|
|
1187
|
+
this.answerSaveTimer = setTimeout(() => {
|
|
1188
|
+
this.answerSaveTimer = null
|
|
1189
|
+
this.savePage()
|
|
1190
|
+
}, delay)
|
|
1191
|
+
},
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Capture the place of an answer once, the first time it changes. The
|
|
1195
|
+
* promise is kept so the page's save can wait for it.
|
|
1196
|
+
*
|
|
1197
|
+
* @param {string} id The question id.
|
|
1198
|
+
* @return {void}
|
|
1199
|
+
* @spec openspec/changes/checklist-run-location/specs/checklist-run-location/spec.md#requirement-an-answer-carries-where-it-was-given
|
|
1200
|
+
*/
|
|
1201
|
+
startLocating(id) {
|
|
1202
|
+
if (!this.locationField || this.draft[id]?.location || this.locating[id]) {
|
|
1203
|
+
return
|
|
1204
|
+
}
|
|
1205
|
+
this.locating = { ...this.locating, [id]: true }
|
|
1206
|
+
this.locationPending[id] = captureLocation().then((fix) => {
|
|
1207
|
+
delete this.locationPending[id]
|
|
1208
|
+
this.locating = { ...this.locating, [id]: false }
|
|
1209
|
+
this.draft[id].location = fix ? { ...fix, low: fix.accuracy > this.goodAccuracy } : { low: true }
|
|
1210
|
+
})
|
|
1211
|
+
},
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* The place was changed in the field: a new fix or a typed address.
|
|
1215
|
+
*
|
|
1216
|
+
* @param {string} id The question id.
|
|
1217
|
+
* @param {object} location The place.
|
|
1218
|
+
* @return {void}
|
|
1219
|
+
*/
|
|
1220
|
+
setLocation(id, location) {
|
|
1221
|
+
this.draft[id].location = location
|
|
1222
|
+
this.dirty = { ...this.dirty, [id]: true }
|
|
1223
|
+
this.scheduleAnswerSave()
|
|
942
1224
|
},
|
|
943
1225
|
|
|
944
1226
|
/**
|
|
@@ -970,6 +1252,7 @@ export default {
|
|
|
970
1252
|
}
|
|
971
1253
|
this.photos = { ...this.photos, [id]: [...(this.photos[id] || []), ...files] }
|
|
972
1254
|
this.dirty = { ...this.dirty, [id]: true }
|
|
1255
|
+
this.scheduleAnswerSave()
|
|
973
1256
|
this.missingPhoto = this.missingPhoto.filter((m) => m !== id)
|
|
974
1257
|
if (event.target) {
|
|
975
1258
|
event.target.value = ''
|
|
@@ -985,6 +1268,24 @@ export default {
|
|
|
985
1268
|
* @spec openspec/changes/checklist-run-widget/specs/checklist-run-widget/spec.md#requirement-answers-are-saved-under-the-readers-own-rights
|
|
986
1269
|
*/
|
|
987
1270
|
async savePage() {
|
|
1271
|
+
// One save at a time, so an answer is never created twice.
|
|
1272
|
+
while (this.pageSave) {
|
|
1273
|
+
await this.pageSave
|
|
1274
|
+
}
|
|
1275
|
+
this.pageSave = this.savePageNow()
|
|
1276
|
+
try {
|
|
1277
|
+
return await this.pageSave
|
|
1278
|
+
} finally {
|
|
1279
|
+
this.pageSave = null
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Save the changed answers of this page now (see `savePage`).
|
|
1285
|
+
*
|
|
1286
|
+
* @return {Promise<boolean>} True when everything saved.
|
|
1287
|
+
*/
|
|
1288
|
+
async savePageNow() {
|
|
988
1289
|
const changed = this.pageQuestions.filter((q) => this.dirty[q.id])
|
|
989
1290
|
if (changed.length === 0) {
|
|
990
1291
|
return true
|
|
@@ -992,6 +1293,7 @@ export default {
|
|
|
992
1293
|
this.saving = true
|
|
993
1294
|
this.saveError = ''
|
|
994
1295
|
try {
|
|
1296
|
+
await Promise.all(Object.values(this.locationPending))
|
|
995
1297
|
if (this.inRecord && !this.content?.saveAction) {
|
|
996
1298
|
await this.saveIntoRecord(changed)
|
|
997
1299
|
this.dirty = Object.fromEntries(Object.entries(this.dirty).filter(([id]) => !changed.some((q) => q.id === id)))
|
|
@@ -1051,6 +1353,9 @@ export default {
|
|
|
1051
1353
|
if (af.at) {
|
|
1052
1354
|
entry[af.at] = new Date().toISOString()
|
|
1053
1355
|
}
|
|
1356
|
+
if (this.locationField) {
|
|
1357
|
+
entry[this.locationField] = draft.location ?? null
|
|
1358
|
+
}
|
|
1054
1359
|
const held = this.photos[question.id] || []
|
|
1055
1360
|
if (this.photosEnabled && held.length) {
|
|
1056
1361
|
const field = c.recordPhotosField
|
|
@@ -1087,6 +1392,9 @@ export default {
|
|
|
1087
1392
|
async saveAnswer(question) {
|
|
1088
1393
|
const entry = this.draft[question.id]
|
|
1089
1394
|
const answer = { questionId: question.id, value: entry.value, note: entry.note }
|
|
1395
|
+
if (this.locationField) {
|
|
1396
|
+
answer.location = entry.location ?? null
|
|
1397
|
+
}
|
|
1090
1398
|
const action = this.content?.saveAction
|
|
1091
1399
|
if (action && typeof action === 'object') {
|
|
1092
1400
|
const resolved = resolveDeepTokens(action, this.tokenCtx)
|
|
@@ -1106,6 +1414,9 @@ export default {
|
|
|
1106
1414
|
if (this.allowNote) {
|
|
1107
1415
|
body[a.noteField || 'note'] = entry.note
|
|
1108
1416
|
}
|
|
1417
|
+
if (this.locationField) {
|
|
1418
|
+
body[this.locationField] = entry.location ?? null
|
|
1419
|
+
}
|
|
1109
1420
|
const base = generateUrl(`${OBJECT_API}/${encodeURIComponent(a.register)}/${encodeURIComponent(a.schema)}`)
|
|
1110
1421
|
let id = this.answerIds[question.id]
|
|
1111
1422
|
if (id) {
|
|
@@ -1154,13 +1465,41 @@ export default {
|
|
|
1154
1465
|
if (!(await this.savePage())) {
|
|
1155
1466
|
return
|
|
1156
1467
|
}
|
|
1468
|
+
if (this.secondsLeft === 0) {
|
|
1469
|
+
await this.finish('deadline')
|
|
1470
|
+
return
|
|
1471
|
+
}
|
|
1157
1472
|
if (this.isLastPage) {
|
|
1158
|
-
|
|
1473
|
+
if (!this.submitLabel) {
|
|
1474
|
+
await this.finish()
|
|
1475
|
+
}
|
|
1159
1476
|
return
|
|
1160
1477
|
}
|
|
1161
1478
|
this.goTo(this.page + 1)
|
|
1162
1479
|
},
|
|
1163
1480
|
|
|
1481
|
+
/**
|
|
1482
|
+
* Finish from any page. A required question without an answer holds it
|
|
1483
|
+
* back and opens that question's page.
|
|
1484
|
+
*
|
|
1485
|
+
* @return {Promise<void>}
|
|
1486
|
+
*/
|
|
1487
|
+
async submit() {
|
|
1488
|
+
const open = this.questions.findIndex((q) => q.required && !this.isAnswered(q))
|
|
1489
|
+
if (open >= 0) {
|
|
1490
|
+
if (!(await this.savePage())) {
|
|
1491
|
+
return
|
|
1492
|
+
}
|
|
1493
|
+
this.missing = [this.questions[open].id]
|
|
1494
|
+
this.goTo(Math.floor(open / this.pageSize))
|
|
1495
|
+
return
|
|
1496
|
+
}
|
|
1497
|
+
this.missing = []
|
|
1498
|
+
if (await this.savePage()) {
|
|
1499
|
+
await this.finish()
|
|
1500
|
+
}
|
|
1501
|
+
},
|
|
1502
|
+
|
|
1164
1503
|
/**
|
|
1165
1504
|
* Save this page and go back one.
|
|
1166
1505
|
*
|
|
@@ -1192,9 +1531,16 @@ export default {
|
|
|
1192
1531
|
/**
|
|
1193
1532
|
* The run is done: dispatch `finishAction` when set, and emit `finished`.
|
|
1194
1533
|
*
|
|
1534
|
+
* @param {string} [reason] `user`, or `deadline` when the time ran out.
|
|
1195
1535
|
* @return {Promise<void>}
|
|
1196
1536
|
*/
|
|
1197
|
-
async finish() {
|
|
1537
|
+
async finish(reason = 'user') {
|
|
1538
|
+
if (this.closed) {
|
|
1539
|
+
return
|
|
1540
|
+
}
|
|
1541
|
+
this.finishedRun = true
|
|
1542
|
+
clearInterval(this.deadlineTimer)
|
|
1543
|
+
this.deadlineTimer = null
|
|
1198
1544
|
const action = this.content?.finishAction
|
|
1199
1545
|
if (action && typeof action === 'object') {
|
|
1200
1546
|
const resolved = resolveDeepTokens(action, this.tokenCtx)
|
|
@@ -1204,9 +1550,9 @@ export default {
|
|
|
1204
1550
|
this.liveText = t('nextcloud-vue', 'Checklist finished.')
|
|
1205
1551
|
/**
|
|
1206
1552
|
* @event finished The last page was saved.
|
|
1207
|
-
* @type {{answered: number, total: number}}
|
|
1553
|
+
* @type {{answered: number, total: number, reason: string}}
|
|
1208
1554
|
*/
|
|
1209
|
-
this.$emit('finished', { answered: this.answeredCount, total: this.questions.length })
|
|
1555
|
+
this.$emit('finished', { answered: this.answeredCount, total: this.questions.length, reason })
|
|
1210
1556
|
},
|
|
1211
1557
|
},
|
|
1212
1558
|
}
|
|
@@ -1391,6 +1737,27 @@ export default {
|
|
|
1391
1737
|
padding-inline: 0;
|
|
1392
1738
|
}
|
|
1393
1739
|
|
|
1740
|
+
.cn-checklist-run__status {
|
|
1741
|
+
align-items: center;
|
|
1742
|
+
display: flex;
|
|
1743
|
+
flex-wrap: wrap;
|
|
1744
|
+
gap: 4px 16px;
|
|
1745
|
+
justify-content: space-between;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
.cn-checklist-run__time-left {
|
|
1749
|
+
font-variant-numeric: tabular-nums;
|
|
1750
|
+
font-weight: 600;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.cn-checklist-run__time-left--warning {
|
|
1754
|
+
color: var(--color-error-text, var(--color-error));
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
.cn-checklist-run__saved {
|
|
1758
|
+
color: var(--color-text-maxcontrast);
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1394
1761
|
.cn-checklist-run__error {
|
|
1395
1762
|
color: var(--color-error-text, var(--color-error));
|
|
1396
1763
|
margin: 0;
|