@conduction/nextcloud-vue 2.174.0 → 2.175.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 +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 +257 -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 +162 -9
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +63 -23
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.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/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/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 +63 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +63 -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 +1134 -499
- 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/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 +20307 -14544
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1134 -499
- package/l10n/en.json +63 -1
- package/l10n/nl.json +63 -1
- 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 +311 -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 +199 -13
- 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/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/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/qr.js +681 -0
- package/src/utils/schema.js +3 -0
- package/src/utils/templateVariables.js +51 -0
|
@@ -22,6 +22,18 @@
|
|
|
22
22
|
</button>
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
|
+
<div v-if="variableList.length > 0 && !disabled && mode !== 'preview'" class="cn-markdown-editor__variables" data-testid="cn-markdown-variables">
|
|
26
|
+
<NcActions :menuName="insertVariableLabel" :forceName="true">
|
|
27
|
+
<NcActionButton v-for="variable in variableList"
|
|
28
|
+
:key="variable.name"
|
|
29
|
+
:description="variable.description || `{${variable.name}}`"
|
|
30
|
+
:data-testid="'variable-' + variable.name"
|
|
31
|
+
@click="insertVariable(variable.name)">
|
|
32
|
+
{{ variable.label }}
|
|
33
|
+
</NcActionButton>
|
|
34
|
+
</NcActions>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
25
37
|
<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->
|
|
26
38
|
<div v-if="mode !== 'wysiwyg'" class="cn-markdown-editor__panes" :data-mode="mode">
|
|
27
39
|
<textarea v-if="mode !== 'preview'"
|
|
@@ -52,6 +64,13 @@
|
|
|
52
64
|
</p>
|
|
53
65
|
</div>
|
|
54
66
|
|
|
67
|
+
<p v-if="unknownVariables.length > 0"
|
|
68
|
+
class="cn-markdown-editor__error"
|
|
69
|
+
role="alert"
|
|
70
|
+
data-testid="cn-markdown-unknown-variables">
|
|
71
|
+
{{ unknownVariableMessage }}
|
|
72
|
+
</p>
|
|
73
|
+
|
|
55
74
|
<!-- Hint row. -->
|
|
56
75
|
<small v-if="hint" class="cn-markdown-editor__hint">{{ hint }}</small>
|
|
57
76
|
</div>
|
|
@@ -59,7 +78,9 @@
|
|
|
59
78
|
|
|
60
79
|
<script>
|
|
61
80
|
import { translate as t } from '@nextcloud/l10n'
|
|
81
|
+
import { NcActionButton, NcActions } from '@nextcloud/vue'
|
|
62
82
|
import { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'
|
|
83
|
+
import { unknownTemplateVariables } from '../../utils/templateVariables.js'
|
|
63
84
|
import { guardedToastUiEditorClass } from '../../utils/toastUiRawHtmlGuard.js'
|
|
64
85
|
import { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'
|
|
65
86
|
|
|
@@ -158,6 +179,10 @@ const DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([
|
|
|
158
179
|
* textarea modes carry no editor dependency. The `v-model` contract
|
|
159
180
|
* is identical across all modes (`value` in, `input` out).
|
|
160
181
|
*
|
|
182
|
+
* With `variables`, a menu inserts `{name}` at the caret and the editor
|
|
183
|
+
* names every `{…}` in the text that is not allowed, under the editor and
|
|
184
|
+
* through the `unknown-variables` event, so a host can refuse to save.
|
|
185
|
+
*
|
|
161
186
|
* ```vue
|
|
162
187
|
* <CnMarkdownEditor v-model="article" placeholder="Write your article …" />
|
|
163
188
|
* <CnMarkdownEditor v-model="article" mode="wysiwyg" />
|
|
@@ -170,6 +195,8 @@ const DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([
|
|
|
170
195
|
*/
|
|
171
196
|
export default {
|
|
172
197
|
name: 'CnMarkdownEditor',
|
|
198
|
+
|
|
199
|
+
components: { NcActionButton, NcActions },
|
|
173
200
|
props: {
|
|
174
201
|
/**
|
|
175
202
|
* Markdown source (v-model).
|
|
@@ -231,6 +258,20 @@ export default {
|
|
|
231
258
|
toolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },
|
|
232
259
|
/** Optional helper text rendered under the editor. */
|
|
233
260
|
hint: { type: String, default: '' },
|
|
261
|
+
/**
|
|
262
|
+
* Variables the text may use, written as `{name}`: names, or
|
|
263
|
+
* `{ name, label?, description? }`. Given, the editor offers an insert
|
|
264
|
+
* menu and names every `{…}` in the text that is not one of them. A
|
|
265
|
+
* dotted variable (`case.number`) is allowed under a listed `case`.
|
|
266
|
+
*/
|
|
267
|
+
variables: { type: Array, default: () => [] },
|
|
268
|
+
/**
|
|
269
|
+
* The message for unknown variables; `{names}` becomes the list.
|
|
270
|
+
* Defaults to "Unknown variable: {names}.".
|
|
271
|
+
*/
|
|
272
|
+
unknownVariableText: { type: String, default: '' },
|
|
273
|
+
/** The name of the insert menu. Defaults to "Insert variable". */
|
|
274
|
+
insertVariableText: { type: String, default: '' },
|
|
234
275
|
/**
|
|
235
276
|
* WYSIWYG mode only: Toast UI toolbar layout (array of button groups).
|
|
236
277
|
* Ignored in the textarea modes.
|
|
@@ -248,7 +289,7 @@ export default {
|
|
|
248
289
|
// the component as its own `input` — after the component's own
|
|
249
290
|
// `$emit('input', value)` — and listeners receive the raw InputEvent
|
|
250
291
|
// instead of the string.
|
|
251
|
-
emits: ['input', 'update:modelValue', 'update:mode'],
|
|
292
|
+
emits: ['input', 'update:modelValue', 'update:mode', 'unknown-variables'],
|
|
252
293
|
data() {
|
|
253
294
|
return {
|
|
254
295
|
localValue: (this.modelValue !== undefined ? this.modelValue : this.value),
|
|
@@ -259,6 +300,59 @@ export default {
|
|
|
259
300
|
},
|
|
260
301
|
|
|
261
302
|
computed: {
|
|
303
|
+
/**
|
|
304
|
+
* The allowed variables as `{ name, label, description }`.
|
|
305
|
+
*
|
|
306
|
+
* @return {Array<{name: string, label: string, description: string}>} The variables.
|
|
307
|
+
* @spec openspec/changes/markdown-editor-variables/tasks.md#task-1
|
|
308
|
+
*/
|
|
309
|
+
variableList() {
|
|
310
|
+
const list = Array.isArray(this.variables) ? this.variables : []
|
|
311
|
+
return list
|
|
312
|
+
.map((v) => (typeof v === 'string' ? { name: v } : v))
|
|
313
|
+
.filter((v) => v && typeof v.name === 'string' && v.name !== '')
|
|
314
|
+
.map((v) => ({ name: v.name, label: v.label || v.name, description: v.description || '' }))
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The variables in the text that are not allowed, each once, in order.
|
|
319
|
+
* Empty when no `variables` are given, so the check is off.
|
|
320
|
+
*
|
|
321
|
+
* @return {string[]} The unknown variable names.
|
|
322
|
+
* @spec openspec/changes/markdown-editor-variables/tasks.md#task-2
|
|
323
|
+
*/
|
|
324
|
+
unknownVariables() {
|
|
325
|
+
if (this.variableList.length === 0) {
|
|
326
|
+
return []
|
|
327
|
+
}
|
|
328
|
+
return unknownTemplateVariables(this.localValue, this.variableList.map((v) => v.name))
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The message under the editor for the unknown variables.
|
|
333
|
+
*
|
|
334
|
+
* @return {string} The message.
|
|
335
|
+
* @spec openspec/changes/markdown-editor-variables/tasks.md#task-2
|
|
336
|
+
*/
|
|
337
|
+
unknownVariableMessage() {
|
|
338
|
+
const names = this.unknownVariables.map((name) => `{${name}}`).join(', ')
|
|
339
|
+
if (this.unknownVariableText) {
|
|
340
|
+
return this.unknownVariableText.split('{names}').join(names)
|
|
341
|
+
}
|
|
342
|
+
return this.unknownVariables.length === 1
|
|
343
|
+
? t('nextcloud-vue', 'Unknown variable: {names}.', { names }, undefined, { escape: false })
|
|
344
|
+
: t('nextcloud-vue', 'Unknown variables: {names}.', { names }, undefined, { escape: false })
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The name of the insert menu.
|
|
349
|
+
*
|
|
350
|
+
* @return {string} The name.
|
|
351
|
+
*/
|
|
352
|
+
insertVariableLabel() {
|
|
353
|
+
return this.insertVariableText || t('nextcloud-vue', 'Insert variable')
|
|
354
|
+
},
|
|
355
|
+
|
|
262
356
|
/**
|
|
263
357
|
* BEM modifier for the current layout mode.
|
|
264
358
|
*
|
|
@@ -334,6 +428,24 @@ export default {
|
|
|
334
428
|
},
|
|
335
429
|
|
|
336
430
|
watch: {
|
|
431
|
+
unknownVariables: {
|
|
432
|
+
immediate: true,
|
|
433
|
+
handler(next, previous) {
|
|
434
|
+
if (previous === undefined && next.length === 0) {
|
|
435
|
+
return
|
|
436
|
+
}
|
|
437
|
+
if (previous && previous.join('\n') === next.join('\n')) {
|
|
438
|
+
return
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* @event unknown-variables The unknown variables in the text changed;
|
|
442
|
+
* empty when every variable is known again.
|
|
443
|
+
* @type {string[]}
|
|
444
|
+
*/
|
|
445
|
+
this.$emit('unknown-variables', next)
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
|
|
337
449
|
// Both spellings watched, because either may be the one the consumer
|
|
338
450
|
// bound. `boundValue` collapses them so the body is written once.
|
|
339
451
|
modelValue() {
|
|
@@ -778,6 +890,22 @@ export default {
|
|
|
778
890
|
})
|
|
779
891
|
},
|
|
780
892
|
|
|
893
|
+
/**
|
|
894
|
+
* Insert `{name}` at the caret.
|
|
895
|
+
*
|
|
896
|
+
* @param {string} name The variable name.
|
|
897
|
+
* @return {void}
|
|
898
|
+
* @spec openspec/changes/markdown-editor-variables/tasks.md#task-1
|
|
899
|
+
*/
|
|
900
|
+
insertVariable(name) {
|
|
901
|
+
const token = `{${name}}`
|
|
902
|
+
if (this.mode === 'wysiwyg' && this.toastEditor) {
|
|
903
|
+
this.toastEditor.insertText(token)
|
|
904
|
+
return
|
|
905
|
+
}
|
|
906
|
+
this.insertAtCaret(token)
|
|
907
|
+
},
|
|
908
|
+
|
|
781
909
|
/**
|
|
782
910
|
* Programmatic insert helper — exposed publicly so parents
|
|
783
911
|
* can drop content at the caret (e.g. from a file-picker
|
|
@@ -883,6 +1011,16 @@ export default {
|
|
|
883
1011
|
border-left: none;
|
|
884
1012
|
}
|
|
885
1013
|
|
|
1014
|
+
.cn-markdown-editor__variables {
|
|
1015
|
+
display: flex;
|
|
1016
|
+
justify-content: flex-end;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.cn-markdown-editor__error {
|
|
1020
|
+
margin: 0;
|
|
1021
|
+
color: var(--color-error-text, var(--color-error));
|
|
1022
|
+
}
|
|
1023
|
+
|
|
886
1024
|
.cn-markdown-editor__hint {
|
|
887
1025
|
color: var(--color-text-maxcontrast);
|
|
888
1026
|
padding: 0 10px 8px;
|
|
@@ -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
|
}
|