@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
|
@@ -731,6 +731,10 @@
|
|
|
731
731
|
:inputLabel="fieldLabelText(field)"
|
|
732
732
|
:disabled="field.readOnly"
|
|
733
733
|
:error="!!errors[field.key]"
|
|
734
|
+
:timer="field.timer === true"
|
|
735
|
+
:autoStart="field.autoStart === true"
|
|
736
|
+
:norm="field.norm || null"
|
|
737
|
+
:normLabel="field.normLabel || ''"
|
|
734
738
|
@update:modelValue="value => updateField(field.key, value)" />
|
|
735
739
|
<CnFieldHelper
|
|
736
740
|
:id="helpId(field)"
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<div class="cn-geo-capture" data-testid="cn-geo-capture">
|
|
7
|
+
<p class="cn-geo-capture__line" role="status" data-testid="cn-geo-capture-line">
|
|
8
|
+
{{ lineText }}
|
|
9
|
+
</p>
|
|
10
|
+
<template v-if="!searching && needsAddress">
|
|
11
|
+
<NcButton variant="tertiary" data-testid="cn-geo-capture-retry" @click="retry">
|
|
12
|
+
{{ t('nextcloud-vue', 'Try again') }}
|
|
13
|
+
</NcButton>
|
|
14
|
+
<NcTextField
|
|
15
|
+
:modelValue="modelValue?.address || ''"
|
|
16
|
+
:label="t('nextcloud-vue', 'Address (by hand)')"
|
|
17
|
+
data-testid="cn-geo-capture-address"
|
|
18
|
+
@update:modelValue="setAddress" />
|
|
19
|
+
</template>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
25
|
+
import { NcButton, NcTextField } from '@nextcloud/vue'
|
|
26
|
+
import { captureLocation } from '../../utils/captureLocation.js'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* CnGeoCaptureField: the place something was recorded, captured from the
|
|
30
|
+
* device (board DqInspectie: "51.9012, 4.4831 · ±12 m · 10:52"). A fix whose
|
|
31
|
+
* accuracy is worse than `goodAccuracy`, or no fix at all, says so, offers a
|
|
32
|
+
* retry and takes an address by hand. The user can always carry on, and the
|
|
33
|
+
* value says how good it was through `low`.
|
|
34
|
+
*
|
|
35
|
+
* The value is `{ lat, lng, accuracy, at, low, address? }`, or null.
|
|
36
|
+
*
|
|
37
|
+
* ```vue
|
|
38
|
+
* <CnGeoCaptureField v-model="place" auto />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @event update:modelValue The new value.
|
|
42
|
+
* @spec openspec/changes/checklist-run-location/specs/checklist-run-location/spec.md#requirement-a-field-captures-where-something-was-recorded
|
|
43
|
+
*/
|
|
44
|
+
export default {
|
|
45
|
+
name: 'CnGeoCaptureField',
|
|
46
|
+
|
|
47
|
+
components: { NcButton, NcTextField },
|
|
48
|
+
|
|
49
|
+
props: {
|
|
50
|
+
/** The captured place: `{ lat, lng, accuracy, at, low, address? }`, or null. */
|
|
51
|
+
modelValue: { type: Object, default: null },
|
|
52
|
+
/** Capture on mount when no value is held yet. */
|
|
53
|
+
auto: { type: Boolean, default: false },
|
|
54
|
+
/** A host is capturing; the field says it is looking. */
|
|
55
|
+
busy: { type: Boolean, default: false },
|
|
56
|
+
/** The accuracy in metres above which a fix counts as low. */
|
|
57
|
+
goodAccuracy: { type: Number, default: 50 },
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
emits: ['update:modelValue'],
|
|
61
|
+
|
|
62
|
+
data() {
|
|
63
|
+
return { capturing: false }
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
computed: {
|
|
67
|
+
/** @return {boolean} Whether a capture is under way. */
|
|
68
|
+
searching() {
|
|
69
|
+
return this.busy || this.capturing
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/** @return {boolean} Whether the value has coordinates. */
|
|
73
|
+
hasFix() {
|
|
74
|
+
return Number.isFinite(this.modelValue?.lat) && Number.isFinite(this.modelValue?.lng)
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/** @return {boolean} Whether the fix is missing or too rough. */
|
|
78
|
+
needsAddress() {
|
|
79
|
+
return !this.hasFix || this.modelValue.low === true
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/** @return {string} The state of the capture in words. */
|
|
83
|
+
lineText() {
|
|
84
|
+
if (this.searching) {
|
|
85
|
+
return t('nextcloud-vue', 'Looking for your location…')
|
|
86
|
+
}
|
|
87
|
+
if (!this.hasFix) {
|
|
88
|
+
return t('nextcloud-vue', 'No location found. You can carry on, or add the address by hand.')
|
|
89
|
+
}
|
|
90
|
+
const accuracy = Math.round(this.modelValue.accuracy)
|
|
91
|
+
if (this.modelValue.low === true) {
|
|
92
|
+
return t('nextcloud-vue', 'Location is inaccurate (±{accuracy} m). Wait for a better signal or add the address by hand.', { accuracy })
|
|
93
|
+
}
|
|
94
|
+
const time = new Date(this.modelValue.at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
|
|
95
|
+
return `${this.modelValue.lat.toFixed(4)}, ${this.modelValue.lng.toFixed(4)} · ±${accuracy} m · ${time}`
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
mounted() {
|
|
100
|
+
if (this.auto && !this.modelValue) {
|
|
101
|
+
this.retry()
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
methods: {
|
|
106
|
+
t,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Ask the device again. A fix replaces what is held, keeping a typed
|
|
110
|
+
* address; no fix keeps it all.
|
|
111
|
+
*
|
|
112
|
+
* @return {Promise<void>}
|
|
113
|
+
*/
|
|
114
|
+
async retry() {
|
|
115
|
+
this.capturing = true
|
|
116
|
+
const fix = await captureLocation()
|
|
117
|
+
this.capturing = false
|
|
118
|
+
if (fix) {
|
|
119
|
+
this.$emit('update:modelValue', { ...this.modelValue, ...fix, low: fix.accuracy > this.goodAccuracy })
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Keep the address typed by hand beside whatever fix there is.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} address The address.
|
|
127
|
+
* @return {void}
|
|
128
|
+
*/
|
|
129
|
+
setAddress(address) {
|
|
130
|
+
this.$emit('update:modelValue', { low: true, ...this.modelValue, address })
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style scoped>
|
|
137
|
+
.cn-geo-capture {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
gap: 6px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.cn-geo-capture__line {
|
|
144
|
+
color: var(--color-text-maxcontrast);
|
|
145
|
+
font-variant-numeric: tabular-nums;
|
|
146
|
+
margin: 0;
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -2358,6 +2358,21 @@ export default {
|
|
|
2358
2358
|
default: null,
|
|
2359
2359
|
},
|
|
2360
2360
|
|
|
2361
|
+
/**
|
|
2362
|
+
* Text added to the count line after a middle dot while a quick filter
|
|
2363
|
+
* or lens is selected (manifest `config.countSuffixByFilter`),
|
|
2364
|
+
* `{ <tab id or label>: text }`: a lens that sorts by waiting time
|
|
2365
|
+
* says "longest waiting first". A quick filter tab can also carry
|
|
2366
|
+
* its own `countSuffix`, which comes first. The text goes through the
|
|
2367
|
+
* host translate function. Null (the default) adds nothing.
|
|
2368
|
+
*
|
|
2369
|
+
* @spec openspec/changes/index-count-suffix-per-filter/specs/index-page/spec.md#requirement-the-count-line-can-say-what-the-selected-quick-filter-does
|
|
2370
|
+
*/
|
|
2371
|
+
countSuffixByFilter: {
|
|
2372
|
+
type: Object,
|
|
2373
|
+
default: null,
|
|
2374
|
+
},
|
|
2375
|
+
|
|
2361
2376
|
/**
|
|
2362
2377
|
* The property keys the card's facts list shows, in order (manifest key
|
|
2363
2378
|
* `config.cardFields`). Without it the board look shows the first four
|
|
@@ -9276,7 +9291,8 @@ export default {
|
|
|
9276
9291
|
* @return {string}
|
|
9277
9292
|
*/
|
|
9278
9293
|
headerDescription() {
|
|
9279
|
-
const
|
|
9294
|
+
const suffix = this.quickFilterCountSuffix
|
|
9295
|
+
const base = suffix && this.headerDescriptionBase ? `${this.headerDescriptionBase} · ${suffix}` : this.headerDescriptionBase
|
|
9280
9296
|
if (this.currentViewMode !== 'map' || !this.mapListEnabled) {
|
|
9281
9297
|
return base
|
|
9282
9298
|
}
|
|
@@ -9298,6 +9314,29 @@ export default {
|
|
|
9298
9314
|
return active || this.quickFilterNarrows
|
|
9299
9315
|
},
|
|
9300
9316
|
|
|
9317
|
+
/**
|
|
9318
|
+
* The count line text of the selected quick filters or lenses: each
|
|
9319
|
+
* tab's `countSuffix`, else its entry in `countSuffixByFilter` (by
|
|
9320
|
+
* id, then by label), translated and joined by a middle dot.
|
|
9321
|
+
*
|
|
9322
|
+
* @return {string}
|
|
9323
|
+
* @spec openspec/changes/index-count-suffix-per-filter/specs/index-page/spec.md#requirement-the-count-line-can-say-what-the-selected-quick-filter-does
|
|
9324
|
+
*/
|
|
9325
|
+
quickFilterCountSuffix() {
|
|
9326
|
+
const tabs = this.tabStripEntries || []
|
|
9327
|
+
const byFilter = this.countSuffixByFilter && typeof this.countSuffixByFilter === 'object' ? this.countSuffixByFilter : {}
|
|
9328
|
+
const indices = this.quickFilterMultiple
|
|
9329
|
+
? (this.selectedQuickFilterIndices || [])
|
|
9330
|
+
: [this.activeQuickFilterIndex]
|
|
9331
|
+
return indices
|
|
9332
|
+
.map((index) => (typeof index === 'number' ? tabs[index] : null))
|
|
9333
|
+
.filter(Boolean)
|
|
9334
|
+
.map((tab) => [tab.countSuffix, byFilter[tab.id], byFilter[tab.label]].find((text) => typeof text === 'string' && text !== ''))
|
|
9335
|
+
.filter(Boolean)
|
|
9336
|
+
.map((text) => this.cnTranslate(text))
|
|
9337
|
+
.join(' · ')
|
|
9338
|
+
},
|
|
9339
|
+
|
|
9301
9340
|
/**
|
|
9302
9341
|
* Whether a selected quick filter tab carries a filter (an "All" tab
|
|
9303
9342
|
* does not).
|
|
@@ -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;
|