@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
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<div class="cn-qr-code" data-testid="cn-qr-code">
|
|
7
|
+
<!-- A scanner needs dark on light, so the modules stay black on white in every theme. -->
|
|
8
|
+
<svg v-if="symbol"
|
|
9
|
+
class="cn-qr-code__image"
|
|
10
|
+
role="img"
|
|
11
|
+
:aria-label="imageName"
|
|
12
|
+
:viewBox="`0 0 ${symbol.size + 8} ${symbol.size + 8}`"
|
|
13
|
+
:width="size"
|
|
14
|
+
:height="size"
|
|
15
|
+
shape-rendering="crispEdges"
|
|
16
|
+
data-testid="cn-qr-image">
|
|
17
|
+
<rect :width="symbol.size + 8" :height="symbol.size + 8" fill="#fff" />
|
|
18
|
+
<path :d="path" fill="#000" />
|
|
19
|
+
</svg>
|
|
20
|
+
<p v-else-if="currentValue"
|
|
21
|
+
class="cn-qr-code__problem"
|
|
22
|
+
role="alert"
|
|
23
|
+
data-testid="cn-qr-too-long">
|
|
24
|
+
{{ t('nextcloud-vue', 'This text is too long for a QR code.') }}
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p v-if="currentCode"
|
|
28
|
+
class="cn-qr-code__code"
|
|
29
|
+
role="status"
|
|
30
|
+
aria-live="polite"
|
|
31
|
+
data-testid="cn-qr-code-text">
|
|
32
|
+
{{ currentCode }}
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p v-if="failed"
|
|
36
|
+
class="cn-qr-code__problem"
|
|
37
|
+
role="alert"
|
|
38
|
+
data-testid="cn-qr-failed">
|
|
39
|
+
{{ refreshFailedText || t('nextcloud-vue', 'This code could not be refreshed and may no longer work.') }}
|
|
40
|
+
</p>
|
|
41
|
+
<p v-else-if="counting" class="cn-qr-code__countdown" data-testid="cn-qr-countdown">
|
|
42
|
+
{{ countdownText }}
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
<!-- @slot default Further lines under the code. -->
|
|
46
|
+
<slot />
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import axios from '@nextcloud/axios'
|
|
52
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
53
|
+
import { prefixUrl } from '../../utils/headers.js'
|
|
54
|
+
import { encodeQr } from '../../utils/qr.js'
|
|
55
|
+
|
|
56
|
+
const TICK_MS = 1000
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* CnQrCode: a QR code drawn in the browser, with an optional typed code and a
|
|
60
|
+
* code that changes on a timer (boards LqLes "Zelf inchecken, op het bord",
|
|
61
|
+
* LqLlCertificaat "In je wallet", PtZaaktypeWeergave).
|
|
62
|
+
*
|
|
63
|
+
* The encoder needs no library and sends nothing to a QR service, so a one-time
|
|
64
|
+
* claim stays on the page. Time is counted from a deadline, not from ticks, so a
|
|
65
|
+
* throttled tab stays right.
|
|
66
|
+
*
|
|
67
|
+
* With `refreshUrl` the component reads `{ value, code, secondsLeft }` every
|
|
68
|
+
* `refreshSeconds`, sooner when `secondsLeft` runs out first. `mapResponse` turns
|
|
69
|
+
* another response into that shape. Without `refreshUrl` the host sets `value`
|
|
70
|
+
* and `code`, and hears `expired` when `refreshSeconds` has passed.
|
|
71
|
+
*
|
|
72
|
+
* ```vue
|
|
73
|
+
* <CnQrCode :value="checkInUrl" :code="code" label="Check in" />
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @event refreshed A refresh arrived, with the whole response.
|
|
77
|
+
* @event refresh-error A refresh failed, with the error. The last code stays and the component tries again.
|
|
78
|
+
* @event expired `refreshSeconds` passed without a new value, when there is no `refreshUrl`.
|
|
79
|
+
* @spec openspec/changes/qr-code/specs/qr-code/spec.md
|
|
80
|
+
*/
|
|
81
|
+
export default {
|
|
82
|
+
name: 'CnQrCode',
|
|
83
|
+
|
|
84
|
+
props: {
|
|
85
|
+
/** The text the code says, such as an address. Empty draws no code. */
|
|
86
|
+
value: { type: String, default: '' },
|
|
87
|
+
/** A code to type in, shown large under the image. */
|
|
88
|
+
code: { type: String, default: '' },
|
|
89
|
+
/** What the code does, for the image's accessible name, already translated. */
|
|
90
|
+
label: { type: String, default: '' },
|
|
91
|
+
/** Width and height in CSS pixels. */
|
|
92
|
+
size: { type: Number, default: 160 },
|
|
93
|
+
/** Where to read the current code. */
|
|
94
|
+
refreshUrl: { type: String, default: '' },
|
|
95
|
+
/** Seconds between reads, or until `expired` without `refreshUrl`. 0 is no timer. */
|
|
96
|
+
refreshSeconds: { type: Number, default: 0 },
|
|
97
|
+
/** Turns a response into `{ value, code, secondsLeft }`. */
|
|
98
|
+
mapResponse: { type: Function, default: (data) => data },
|
|
99
|
+
/** The countdown, already translated, with `{seconds}`. */
|
|
100
|
+
countdownTemplate: { type: String, default: '' },
|
|
101
|
+
/** Says a refresh failed, already translated. */
|
|
102
|
+
refreshFailedText: { type: String, default: '' },
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
emits: ['refreshed', 'refresh-error', 'expired'],
|
|
106
|
+
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
currentValue: this.value,
|
|
110
|
+
currentCode: this.code,
|
|
111
|
+
secondsLeft: 0,
|
|
112
|
+
deadline: 0,
|
|
113
|
+
nextReadAt: 0,
|
|
114
|
+
failed: false,
|
|
115
|
+
reading: false,
|
|
116
|
+
expiredSaid: false,
|
|
117
|
+
timer: null,
|
|
118
|
+
readNumber: 0,
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
computed: {
|
|
123
|
+
/** @return {{size: number, modules: boolean[][]}|null} The symbol, or null when the value does not encode. */
|
|
124
|
+
symbol() {
|
|
125
|
+
return encodeQr(this.currentValue)
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/** @return {string} One path for all dark modules, one segment per run. */
|
|
129
|
+
path() {
|
|
130
|
+
const parts = []
|
|
131
|
+
this.symbol.modules.forEach((row, r) => {
|
|
132
|
+
let c = 0
|
|
133
|
+
while (c < row.length) {
|
|
134
|
+
if (!row[c]) {
|
|
135
|
+
c++
|
|
136
|
+
continue
|
|
137
|
+
}
|
|
138
|
+
const from = c
|
|
139
|
+
while (c < row.length && row[c]) {
|
|
140
|
+
c++
|
|
141
|
+
}
|
|
142
|
+
parts.push(`M${from + 4} ${r + 4}h${c - from}v1h-${c - from}z`)
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
return parts.join('')
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
/** @return {string} The accessible name of the image. */
|
|
149
|
+
imageName() {
|
|
150
|
+
return this.label
|
|
151
|
+
? t('nextcloud-vue', 'QR code for: {label}', { label: this.label })
|
|
152
|
+
: t('nextcloud-vue', 'QR code')
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/** @return {boolean} Whether a countdown applies. */
|
|
156
|
+
counting() {
|
|
157
|
+
return this.refreshSeconds > 0 && this.deadline > 0
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
/** @return {string} The countdown in words. */
|
|
161
|
+
countdownText() {
|
|
162
|
+
if (this.countdownTemplate) {
|
|
163
|
+
return this.countdownTemplate.replace('{seconds}', String(this.secondsLeft))
|
|
164
|
+
}
|
|
165
|
+
return t('nextcloud-vue', 'Changes in {seconds} s', { seconds: String(this.secondsLeft) })
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
watch: {
|
|
170
|
+
value(next) {
|
|
171
|
+
this.currentValue = next
|
|
172
|
+
this.restartCountdown()
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
code(next) {
|
|
176
|
+
this.currentCode = next
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
refreshUrl() {
|
|
180
|
+
this.start()
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
refreshSeconds() {
|
|
184
|
+
this.start()
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
mounted() {
|
|
189
|
+
this.start()
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
beforeUnmount() {
|
|
193
|
+
this.stop()
|
|
194
|
+
this.readNumber += 1
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
methods: {
|
|
198
|
+
t,
|
|
199
|
+
|
|
200
|
+
/** Start the timer and, with a URL, the first read. */
|
|
201
|
+
start() {
|
|
202
|
+
this.stop()
|
|
203
|
+
this.readNumber += 1
|
|
204
|
+
this.reading = false
|
|
205
|
+
this.failed = false
|
|
206
|
+
if (!(this.refreshSeconds > 0)) {
|
|
207
|
+
this.deadline = 0
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
this.timer = setInterval(this.tick, TICK_MS)
|
|
211
|
+
if (this.refreshUrl) {
|
|
212
|
+
this.read()
|
|
213
|
+
} else {
|
|
214
|
+
this.restartCountdown()
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
/** Stop the timer. */
|
|
219
|
+
stop() {
|
|
220
|
+
clearInterval(this.timer)
|
|
221
|
+
this.timer = null
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Start the countdown over.
|
|
226
|
+
*
|
|
227
|
+
* @param {number} [seconds] How long it runs; `refreshSeconds` by default.
|
|
228
|
+
*/
|
|
229
|
+
restartCountdown(seconds = this.refreshSeconds) {
|
|
230
|
+
this.deadline = Date.now() + seconds * 1000
|
|
231
|
+
this.secondsLeft = seconds
|
|
232
|
+
this.expiredSaid = false
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
/** Bring the countdown up to date, and read or expire when it is time. */
|
|
236
|
+
tick() {
|
|
237
|
+
const now = Date.now()
|
|
238
|
+
this.secondsLeft = Math.max(0, Math.ceil((this.deadline - now) / 1000))
|
|
239
|
+
if (this.refreshUrl) {
|
|
240
|
+
if (now >= this.nextReadAt) {
|
|
241
|
+
this.read()
|
|
242
|
+
}
|
|
243
|
+
} else if (this.secondsLeft === 0 && !this.expiredSaid) {
|
|
244
|
+
this.expiredSaid = true
|
|
245
|
+
this.$emit('expired')
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Read the current code. On a failure the last code stays, and the next read
|
|
251
|
+
* comes after `refreshSeconds`. A read that a newer start overtook is dropped.
|
|
252
|
+
*
|
|
253
|
+
* @return {Promise<void>}
|
|
254
|
+
*/
|
|
255
|
+
async read() {
|
|
256
|
+
if (this.reading) {
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
this.reading = true
|
|
260
|
+
const number = this.readNumber
|
|
261
|
+
try {
|
|
262
|
+
const { data } = await axios.get(prefixUrl(this.refreshUrl))
|
|
263
|
+
if (number !== this.readNumber) {
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
const mapped = this.mapResponse(data) ?? {}
|
|
267
|
+
this.currentValue = mapped.value ?? this.currentValue
|
|
268
|
+
this.currentCode = mapped.code ?? this.currentCode
|
|
269
|
+
this.failed = false
|
|
270
|
+
const left = Number(mapped.secondsLeft ?? this.refreshSeconds)
|
|
271
|
+
this.restartCountdown(left)
|
|
272
|
+
this.nextReadAt = Date.now() + Math.min(Math.max(left, 1), this.refreshSeconds) * 1000
|
|
273
|
+
this.$emit('refreshed', data)
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (number !== this.readNumber) {
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
this.failed = true
|
|
279
|
+
this.nextReadAt = Date.now() + this.refreshSeconds * 1000
|
|
280
|
+
this.$emit('refresh-error', error)
|
|
281
|
+
} finally {
|
|
282
|
+
if (number === this.readNumber) {
|
|
283
|
+
this.reading = false
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
}
|
|
289
|
+
</script>
|
|
290
|
+
|
|
291
|
+
<style scoped>
|
|
292
|
+
.cn-qr-code {
|
|
293
|
+
align-items: center;
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: column;
|
|
296
|
+
gap: 8px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.cn-qr-code__image {
|
|
300
|
+
display: block;
|
|
301
|
+
max-width: 100%;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.cn-qr-code__code {
|
|
305
|
+
font-family: var(--font-face-monospace, monospace);
|
|
306
|
+
font-size: 2em;
|
|
307
|
+
font-weight: bold;
|
|
308
|
+
letter-spacing: 0.1em;
|
|
309
|
+
margin: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.cn-qr-code__countdown {
|
|
313
|
+
color: var(--color-text-maxcontrast);
|
|
314
|
+
margin: 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.cn-qr-code__problem {
|
|
318
|
+
color: var(--color-error-text);
|
|
319
|
+
margin: 0;
|
|
320
|
+
}
|
|
321
|
+
</style>
|
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
{{ blockingText }} {{ blockingItems.map((item) => item.label).join(', ') }}
|
|
22
22
|
</NcNoteCard>
|
|
23
23
|
|
|
24
|
+
<div v-if="summaryText || verdictText"
|
|
25
|
+
class="cn-readiness-checklist__head"
|
|
26
|
+
data-testid="cn-readiness-checklist-head">
|
|
27
|
+
<span v-if="summaryText" data-testid="cn-readiness-checklist-summary">{{ summaryText }}</span>
|
|
28
|
+
<span v-if="verdictText" role="status" data-testid="cn-readiness-checklist-verdict">
|
|
29
|
+
<CnStatusBadge :label="verdictText" :variant="allMet ? 'success' : 'warning'" />
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
24
33
|
<p v-if="shownItems.length === 0" class="cn-readiness-checklist__empty" data-testid="cn-readiness-checklist-empty">
|
|
25
34
|
{{ emptyText || t('nextcloud-vue', 'Nothing to check.') }}
|
|
26
35
|
</p>
|
|
@@ -58,6 +67,22 @@
|
|
|
58
67
|
</li>
|
|
59
68
|
</ul>
|
|
60
69
|
</section>
|
|
70
|
+
|
|
71
|
+
<p v-if="note" class="cn-readiness-checklist__note" data-testid="cn-readiness-checklist-note">
|
|
72
|
+
{{ text(note) }}
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
<div v-if="confirmLabel || $slots.actions" class="cn-readiness-checklist__actions">
|
|
76
|
+
<NcButton v-if="confirmLabel"
|
|
77
|
+
variant="primary"
|
|
78
|
+
:disabled="!allMet"
|
|
79
|
+
data-testid="cn-readiness-checklist-confirm"
|
|
80
|
+
@click="$emit('confirm')">
|
|
81
|
+
{{ text(confirmLabel) }}
|
|
82
|
+
</NcButton>
|
|
83
|
+
<!-- @slot actions Further buttons beside the confirm. -->
|
|
84
|
+
<slot name="actions" />
|
|
85
|
+
</div>
|
|
61
86
|
</template>
|
|
62
87
|
</div>
|
|
63
88
|
</template>
|
|
@@ -66,9 +91,10 @@
|
|
|
66
91
|
import axios from '@nextcloud/axios'
|
|
67
92
|
import { translate as t } from '@nextcloud/l10n'
|
|
68
93
|
import { generateUrl } from '@nextcloud/router'
|
|
69
|
-
import { NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
|
|
94
|
+
import { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
|
|
70
95
|
import innerHeading from '../../mixins/innerHeading.js'
|
|
71
96
|
import { readPath } from '../../utils/readPath.js'
|
|
97
|
+
import { CnStatusBadge } from '../CnStatusBadge/index.js'
|
|
72
98
|
|
|
73
99
|
/**
|
|
74
100
|
* The fields an item is read from by default.
|
|
@@ -90,6 +116,10 @@ const DEFAULT_FIELDS = Object.freeze({
|
|
|
90
116
|
* CnReadinessChecklist: a list of things an instance needs, each with its
|
|
91
117
|
* state in words (met, open, unknown), an explanation and a link to the
|
|
92
118
|
* screen that fixes it. Reported, never gated: nothing here blocks the app.
|
|
119
|
+
* A host that does gate a step on the list adds `summary`, `verdict` and
|
|
120
|
+
* `confirmLabel`: the count, the verdict in words, and a button that stays off
|
|
121
|
+
* until every item is met (board DqZaakDocumenten "Volledigheid van de
|
|
122
|
+
* aanvraag").
|
|
93
123
|
*
|
|
94
124
|
* Items come from `items`, or are read from an app endpoint (`source`, an app
|
|
95
125
|
* path resolved with `generateUrl`, the list at `itemsPath`) and re-read when
|
|
@@ -102,7 +132,7 @@ const DEFAULT_FIELDS = Object.freeze({
|
|
|
102
132
|
export default {
|
|
103
133
|
name: 'CnReadinessChecklist',
|
|
104
134
|
|
|
105
|
-
components: { NcLoadingIcon, NcNoteCard },
|
|
135
|
+
components: { CnStatusBadge, NcButton, NcLoadingIcon, NcNoteCard },
|
|
106
136
|
|
|
107
137
|
mixins: [innerHeading],
|
|
108
138
|
|
|
@@ -132,9 +162,17 @@ export default {
|
|
|
132
162
|
errorText: { type: String, default: '' },
|
|
133
163
|
/** Said before the unmet items marked `blocking` ("Cannot run until this is installed:"). */
|
|
134
164
|
blockingText: { type: String, default: '' },
|
|
165
|
+
/** The count above the list, a template with `{met}`, `{open}` and `{total}`. */
|
|
166
|
+
summary: { type: String, default: '' },
|
|
167
|
+
/** The verdict beside the count: `{ met, unmet }`. */
|
|
168
|
+
verdict: { type: Object, default: null },
|
|
169
|
+
/** A line under the list. */
|
|
170
|
+
note: { type: String, default: '' },
|
|
171
|
+
/** Label of a button under the list that stays off until every item is met; emits `confirm`. */
|
|
172
|
+
confirmLabel: { type: String, default: '' },
|
|
135
173
|
},
|
|
136
174
|
|
|
137
|
-
emits: ['loaded'],
|
|
175
|
+
emits: ['loaded', 'confirm'],
|
|
138
176
|
|
|
139
177
|
data() {
|
|
140
178
|
return {
|
|
@@ -165,6 +203,24 @@ export default {
|
|
|
165
203
|
})
|
|
166
204
|
},
|
|
167
205
|
|
|
206
|
+
/** @return {boolean} Whether there are items and each is met. */
|
|
207
|
+
allMet() {
|
|
208
|
+
return this.shownItems.length > 0 && this.shownItems.every((item) => item.met === true)
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/** @return {string} The `summary` with its counts filled in. */
|
|
212
|
+
summaryText() {
|
|
213
|
+
const total = this.shownItems.length
|
|
214
|
+
const met = this.shownItems.filter((item) => item.met === true).length
|
|
215
|
+
const counts = { met, open: total - met, total }
|
|
216
|
+
return this.text(this.summary).replace(/\{(met|open|total)\}/g, (match, key) => String(counts[key]))
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/** @return {string} The verdict in words, '' when none is declared for this state. */
|
|
220
|
+
verdictText() {
|
|
221
|
+
return this.text(this.verdict?.[this.allMet ? 'met' : 'unmet'] ?? '')
|
|
222
|
+
},
|
|
223
|
+
|
|
168
224
|
/** @return {Array<object>} The unmet blocking items. */
|
|
169
225
|
blockingItems() {
|
|
170
226
|
return this.shownItems.filter((item) => item.blocking && item.met !== true)
|
|
@@ -286,6 +342,27 @@ export default {
|
|
|
286
342
|
margin: 0 0 12px;
|
|
287
343
|
}
|
|
288
344
|
|
|
345
|
+
.cn-readiness-checklist__head {
|
|
346
|
+
align-items: center;
|
|
347
|
+
display: flex;
|
|
348
|
+
flex-wrap: wrap;
|
|
349
|
+
gap: 4px 12px;
|
|
350
|
+
justify-content: space-between;
|
|
351
|
+
margin-bottom: 8px;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.cn-readiness-checklist__note {
|
|
355
|
+
color: var(--color-text-maxcontrast);
|
|
356
|
+
margin: 12px 0 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.cn-readiness-checklist__actions {
|
|
360
|
+
display: flex;
|
|
361
|
+
flex-wrap: wrap;
|
|
362
|
+
gap: 8px;
|
|
363
|
+
margin-top: 12px;
|
|
364
|
+
}
|
|
365
|
+
|
|
289
366
|
.cn-readiness-checklist__group-title {
|
|
290
367
|
margin: 12px 0 4px;
|
|
291
368
|
}
|
|
@@ -439,8 +439,24 @@
|
|
|
439
439
|
</NcButton>
|
|
440
440
|
</template>
|
|
441
441
|
</template>
|
|
442
|
+
<span
|
|
443
|
+
v-if="item.tag === 'div' && item.rowActions.length > 0 && rowActionsInline"
|
|
444
|
+
class="cn-record-list__row-actions-inline"
|
|
445
|
+
data-testid="cn-record-list-row-actions-inline">
|
|
446
|
+
<NcButton
|
|
447
|
+
v-for="entry in item.rowActions"
|
|
448
|
+
:key="`row-action-${entry.index}`"
|
|
449
|
+
:variant="entry.action.variant || 'secondary'"
|
|
450
|
+
:href="entry.href || undefined"
|
|
451
|
+
:target="entry.external ? '_blank' : undefined"
|
|
452
|
+
:ariaLabel="fillRow(entry.action.ariaLabel, item.row) || undefined"
|
|
453
|
+
:data-testid="`cn-record-list-row-action-${entry.index}`"
|
|
454
|
+
@click="entry.href ? undefined : runRowActionEntry(entry.action, item.row)">
|
|
455
|
+
{{ entry.action.label }}
|
|
456
|
+
</NcButton>
|
|
457
|
+
</span>
|
|
442
458
|
<NcActions
|
|
443
|
-
v-if="item.tag === 'div' && item.rowActions.length > 0"
|
|
459
|
+
v-else-if="item.tag === 'div' && item.rowActions.length > 0"
|
|
444
460
|
:aria-label="rowActionsLabel"
|
|
445
461
|
data-testid="cn-record-list-row-actions">
|
|
446
462
|
<template v-for="entry in item.rowActions" :key="`row-action-${entry.index}`">
|
|
@@ -1842,6 +1858,17 @@ export default {
|
|
|
1842
1858
|
return this.content?.rowAction?.variant === 'outlined'
|
|
1843
1859
|
},
|
|
1844
1860
|
|
|
1861
|
+
/**
|
|
1862
|
+
* Whether a row's actions are buttons on the row (`rowActionsInline`), as
|
|
1863
|
+
* board DqZaakBesluiten draws "Goedkeuren" and "Afwijzen", not a menu.
|
|
1864
|
+
*
|
|
1865
|
+
* @spec openspec/changes/record-list-inline-row-actions/specs/record-list-inline-row-actions/spec.md#requirement-row-actions-can-be-buttons-on-the-row
|
|
1866
|
+
* @return {boolean}
|
|
1867
|
+
*/
|
|
1868
|
+
rowActionsInline() {
|
|
1869
|
+
return this.content?.rowActionsInline === true
|
|
1870
|
+
},
|
|
1871
|
+
|
|
1845
1872
|
rowActionsHeader() {
|
|
1846
1873
|
const own = this.content?.rowActionsHeader
|
|
1847
1874
|
return typeof own === 'string' && own !== '' ? this.translate(own) : t('nextcloud-vue', 'Actions')
|
|
@@ -3408,6 +3435,12 @@ export default {
|
|
|
3408
3435
|
</script>
|
|
3409
3436
|
|
|
3410
3437
|
<style scoped>
|
|
3438
|
+
.cn-record-list__row-actions-inline {
|
|
3439
|
+
display: inline-flex;
|
|
3440
|
+
flex-wrap: wrap;
|
|
3441
|
+
gap: 8px;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3411
3444
|
.cn-record-list__checklist-bar {
|
|
3412
3445
|
height: 8px;
|
|
3413
3446
|
margin-block-end: 16px;
|