@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import script from './CnRevealField.vue2.js';
|
|
2
|
+
import { render } from './CnRevealField.vue3.js';
|
|
3
|
+
|
|
4
|
+
script.render = render;
|
|
5
|
+
script.__scopeId = "data-v-bd786526";
|
|
6
|
+
const __sfc_main = script;
|
|
7
|
+
|
|
8
|
+
export { __sfc_main as default };
|
|
9
|
+
//# sourceMappingURL=CnRevealField.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnRevealField.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { translate } from '@nextcloud/l10n';
|
|
2
|
+
import { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue';
|
|
3
|
+
|
|
4
|
+
let uid = 0;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CnRevealField — a protected value shown masked until the user asks to see
|
|
8
|
+
* it (board DqContact: "BSN *****4001 Tonen", "Het tonen van het BSN wordt
|
|
9
|
+
* gelogd.").
|
|
10
|
+
*
|
|
11
|
+
* The component never holds the value until the user asks: `load` fetches it
|
|
12
|
+
* on every reveal, so the server can log each viewing. With `requireReason`
|
|
13
|
+
* the user first states why, and `load` receives that reason. Hide masks the
|
|
14
|
+
* value again and drops it; the next Show calls `load` again.
|
|
15
|
+
*
|
|
16
|
+
* ```vue
|
|
17
|
+
* <CnRevealField
|
|
18
|
+
* label="BSN"
|
|
19
|
+
* masked-value="*****4001"
|
|
20
|
+
* :load="(reason) => api.revealBsn(person.id, reason)"
|
|
21
|
+
* require-reason
|
|
22
|
+
* note="Het tonen van het BSN wordt gelogd." />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @event revealed Emitted once the value shows, with `{ reason }`.
|
|
26
|
+
* @event hidden Emitted when the user masks the value again.
|
|
27
|
+
*/
|
|
28
|
+
var script = {
|
|
29
|
+
name: 'CnRevealField',
|
|
30
|
+
|
|
31
|
+
components: {
|
|
32
|
+
NcButton,
|
|
33
|
+
NcLoadingIcon,
|
|
34
|
+
NcTextField,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
props: {
|
|
38
|
+
/** What the value is, already translated ("BSN"). */
|
|
39
|
+
label: { type: String, required: true },
|
|
40
|
+
/** What shows while the value is hidden, such as the last digits behind stars. */
|
|
41
|
+
maskedValue: { type: String, default: '••••••' },
|
|
42
|
+
/**
|
|
43
|
+
* Fetches the value: `(reason) => string | Promise<string>`. Called on
|
|
44
|
+
* every reveal; `reason` is '' unless `requireReason` is set.
|
|
45
|
+
*/
|
|
46
|
+
load: { type: Function, required: true },
|
|
47
|
+
/** Ask why the user needs the value before it is fetched. */
|
|
48
|
+
requireReason: { type: Boolean, default: false },
|
|
49
|
+
/** Label of the reason field, already translated; the library default is "Why do you need to see this?". */
|
|
50
|
+
reasonLabel: { type: String, default: '' },
|
|
51
|
+
/** A line under the value, already translated, such as that showing it is logged. */
|
|
52
|
+
note: { type: String, default: '' },
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
emits: ['revealed', 'hidden'],
|
|
56
|
+
|
|
57
|
+
data() {
|
|
58
|
+
uid += 1;
|
|
59
|
+
return {
|
|
60
|
+
labelId: `cn-reveal-field-${uid}`,
|
|
61
|
+
revealed: false,
|
|
62
|
+
revealedValue: '',
|
|
63
|
+
askingReason: false,
|
|
64
|
+
reason: '',
|
|
65
|
+
loading: false,
|
|
66
|
+
error: '',
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
methods: {
|
|
71
|
+
t: translate,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Show or hide the value. Showing asks the reason first when
|
|
75
|
+
* `requireReason` is set.
|
|
76
|
+
*
|
|
77
|
+
* @return {Promise<void>|void}
|
|
78
|
+
*/
|
|
79
|
+
toggle() {
|
|
80
|
+
if (this.revealed) {
|
|
81
|
+
this.hide();
|
|
82
|
+
return undefined
|
|
83
|
+
}
|
|
84
|
+
if (this.requireReason) {
|
|
85
|
+
this.askingReason = true;
|
|
86
|
+
this.error = '';
|
|
87
|
+
this.$nextTick(() => this.$refs.reasonField?.focus?.());
|
|
88
|
+
return undefined
|
|
89
|
+
}
|
|
90
|
+
return this.reveal('')
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Reveal with the typed reason.
|
|
95
|
+
*
|
|
96
|
+
* @return {Promise<void>|void}
|
|
97
|
+
*/
|
|
98
|
+
submitReason() {
|
|
99
|
+
const reason = this.reason.trim();
|
|
100
|
+
if (reason === '') {
|
|
101
|
+
return undefined
|
|
102
|
+
}
|
|
103
|
+
return this.reveal(reason)
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Close the reason form without fetching.
|
|
108
|
+
*
|
|
109
|
+
* @return {void}
|
|
110
|
+
*/
|
|
111
|
+
cancelReason() {
|
|
112
|
+
this.askingReason = false;
|
|
113
|
+
this.reason = '';
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Fetch the value through `load` and show it; a failure keeps the
|
|
118
|
+
* value masked and says so.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} reason Why the user asked, or ''.
|
|
121
|
+
* @return {Promise<void>}
|
|
122
|
+
*/
|
|
123
|
+
async reveal(reason) {
|
|
124
|
+
this.loading = true;
|
|
125
|
+
this.error = '';
|
|
126
|
+
try {
|
|
127
|
+
const value = await this.load(reason);
|
|
128
|
+
if (value === null || value === undefined || value === '') {
|
|
129
|
+
throw new Error('empty')
|
|
130
|
+
}
|
|
131
|
+
this.revealedValue = String(value);
|
|
132
|
+
this.revealed = true;
|
|
133
|
+
this.askingReason = false;
|
|
134
|
+
this.reason = '';
|
|
135
|
+
this.$emit('revealed', { reason });
|
|
136
|
+
} catch {
|
|
137
|
+
this.error = translate('nextcloud-vue', 'The value could not be shown. Try again later.');
|
|
138
|
+
} finally {
|
|
139
|
+
this.loading = false;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Mask the value again and drop it.
|
|
145
|
+
*
|
|
146
|
+
* @return {void}
|
|
147
|
+
*/
|
|
148
|
+
hide() {
|
|
149
|
+
this.revealed = false;
|
|
150
|
+
this.revealedValue = '';
|
|
151
|
+
this.$emit('hidden');
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export { script as default };
|
|
157
|
+
//# sourceMappingURL=CnRevealField.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnRevealField.vue2.js","sources":["../../../../src/components/CnRevealField/CnRevealField.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-reveal-field\" data-testid=\"cn-reveal-field\">\n\t\t<div class=\"cn-reveal-field__row\">\n\t\t\t<span :id=\"labelId\" class=\"cn-reveal-field__label\">{{ label }}</span>\n\t\t\t<span\n\t\t\t\tclass=\"cn-reveal-field__value\"\n\t\t\t\t:class=\"{ 'cn-reveal-field__value--masked': !revealed }\"\n\t\t\t\t:aria-labelledby=\"labelId\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\tdata-testid=\"cn-reveal-value\">{{ revealed ? revealedValue : maskedValue }}</span>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"!askingReason\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"revealed ? t('nextcloud-vue', 'Hide {label}', { label }) : t('nextcloud-vue', 'Show {label}', { label })\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\tdata-testid=\"cn-reveal-toggle\"\n\t\t\t\t@click=\"toggle\">\n\t\t\t\t<template v-if=\"loading\" #icon>\n\t\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ revealed ? t('nextcloud-vue', 'Hide') : t('nextcloud-vue', 'Show') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<form\n\t\t\tv-if=\"askingReason\"\n\t\t\tclass=\"cn-reveal-field__reason\"\n\t\t\tdata-testid=\"cn-reveal-reason\"\n\t\t\t@submit.prevent=\"submitReason\">\n\t\t\t<NcTextField\n\t\t\t\tref=\"reasonField\"\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel || t('nextcloud-vue', 'Why do you need to see this?')\"\n\t\t\t\trequired\n\t\t\t\tdata-testid=\"cn-reveal-reason-input\"\n\t\t\t\t@update:modelValue=\"reason = $event\" />\n\t\t\t<div class=\"cn-reveal-field__reason-actions\">\n\t\t\t\t<NcButton variant=\"tertiary\" data-testid=\"cn-reveal-reason-cancel\" @click=\"cancelReason\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Cancel') }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"reason.trim() === '' || loading\"\n\t\t\t\t\tdata-testid=\"cn-reveal-reason-submit\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Show') }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-reveal-field__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-reveal-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<p v-if=\"note\" class=\"cn-reveal-field__note\" data-testid=\"cn-reveal-note\">\n\t\t\t{{ note }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue'\n\nlet uid = 0\n\n/**\n * CnRevealField — a protected value shown masked until the user asks to see\n * it (board DqContact: \"BSN *****4001 Tonen\", \"Het tonen van het BSN wordt\n * gelogd.\").\n *\n * The component never holds the value until the user asks: `load` fetches it\n * on every reveal, so the server can log each viewing. With `requireReason`\n * the user first states why, and `load` receives that reason. Hide masks the\n * value again and drops it; the next Show calls `load` again.\n *\n * ```vue\n * <CnRevealField\n * label=\"BSN\"\n * masked-value=\"*****4001\"\n * :load=\"(reason) => api.revealBsn(person.id, reason)\"\n * require-reason\n * note=\"Het tonen van het BSN wordt gelogd.\" />\n * ```\n *\n * @event revealed Emitted once the value shows, with `{ reason }`.\n * @event hidden Emitted when the user masks the value again.\n */\nexport default {\n\tname: 'CnRevealField',\n\n\tcomponents: {\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\t/** What the value is, already translated (\"BSN\"). */\n\t\tlabel: { type: String, required: true },\n\t\t/** What shows while the value is hidden, such as the last digits behind stars. */\n\t\tmaskedValue: { type: String, default: '••••••' },\n\t\t/**\n\t\t * Fetches the value: `(reason) => string | Promise<string>`. Called on\n\t\t * every reveal; `reason` is '' unless `requireReason` is set.\n\t\t */\n\t\tload: { type: Function, required: true },\n\t\t/** Ask why the user needs the value before it is fetched. */\n\t\trequireReason: { type: Boolean, default: false },\n\t\t/** Label of the reason field, already translated; the library default is \"Why do you need to see this?\". */\n\t\treasonLabel: { type: String, default: '' },\n\t\t/** A line under the value, already translated, such as that showing it is logged. */\n\t\tnote: { type: String, default: '' },\n\t},\n\n\temits: ['revealed', 'hidden'],\n\n\tdata() {\n\t\tuid += 1\n\t\treturn {\n\t\t\tlabelId: `cn-reveal-field-${uid}`,\n\t\t\trevealed: false,\n\t\t\trevealedValue: '',\n\t\t\taskingReason: false,\n\t\t\treason: '',\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t}\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Show or hide the value. Showing asks the reason first when\n\t\t * `requireReason` is set.\n\t\t *\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\ttoggle() {\n\t\t\tif (this.revealed) {\n\t\t\t\tthis.hide()\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (this.requireReason) {\n\t\t\t\tthis.askingReason = true\n\t\t\t\tthis.error = ''\n\t\t\t\tthis.$nextTick(() => this.$refs.reasonField?.focus?.())\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn this.reveal('')\n\t\t},\n\n\t\t/**\n\t\t * Reveal with the typed reason.\n\t\t *\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\tsubmitReason() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn this.reveal(reason)\n\t\t},\n\n\t\t/**\n\t\t * Close the reason form without fetching.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelReason() {\n\t\t\tthis.askingReason = false\n\t\t\tthis.reason = ''\n\t\t},\n\n\t\t/**\n\t\t * Fetch the value through `load` and show it; a failure keeps the\n\t\t * value masked and says so.\n\t\t *\n\t\t * @param {string} reason Why the user asked, or ''.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync reveal(reason) {\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst value = await this.load(reason)\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\tthrow new Error('empty')\n\t\t\t\t}\n\t\t\t\tthis.revealedValue = String(value)\n\t\t\t\tthis.revealed = true\n\t\t\t\tthis.askingReason = false\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.$emit('revealed', { reason })\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'The value could not be shown. Try again later.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Mask the value again and drop it.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\thide() {\n\t\t\tthis.revealed = false\n\t\t\tthis.revealedValue = ''\n\t\t\tthis.$emit('hidden')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-reveal-field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.cn-reveal-field__row {\n\talign-items: center;\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 4px 12px;\n}\n\n.cn-reveal-field__label {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-reveal-field__value {\n\tfont-variant-numeric: tabular-nums;\n\tfont-weight: 500;\n}\n\n.cn-reveal-field__value--masked {\n\tletter-spacing: 0.08em;\n}\n\n.cn-reveal-field__reason {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-reveal-field__reason-actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tjustify-content: flex-end;\n}\n\n.cn-reveal-field__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: 0;\n}\n\n.cn-reveal-field__note {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n\tmargin: 0;\n}\n</style>\n"],"names":["t"],"mappings":";;;AAsEA,IAAI,MAAM,EAAA;;AAEV;;;;AAI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AAG,EAAA;AAClC,IAAA,CAAE,MAAM;AACP,IAAA,IAAI,CAAC,KAAM,GAAEA,SAAC,CAAC,eAAe,EAAE,gDAAgD,EAAA;AACjF,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,OAAQ,GAAE,MAAI;AACpB,IAAA;GACA;;AAED;;AAEC;;;AAGD,EAAA,IAAI,GAAG;AACN,GAAA,IAAI,CAAC,QAAS,GAAE,MAAI;AACpB,GAAA,IAAI,CAAC,aAAY,GAAI,GAAC;AACtB,GAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAA;GACnB;EACD;AACF;;;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, normalizeClass, createBlock, createSlots, withCtx, createTextVNode, createVNode, createCommentVNode, withModifiers } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "cn-reveal-field",
|
|
5
|
+
"data-testid": "cn-reveal-field"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = { class: "cn-reveal-field__row" };
|
|
8
|
+
const _hoisted_3 = ["id"];
|
|
9
|
+
const _hoisted_4 = ["aria-labelledby"];
|
|
10
|
+
const _hoisted_5 = { class: "cn-reveal-field__reason-actions" };
|
|
11
|
+
const _hoisted_6 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "cn-reveal-field__error",
|
|
14
|
+
role: "alert",
|
|
15
|
+
"data-testid": "cn-reveal-error"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_7 = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "cn-reveal-field__note",
|
|
20
|
+
"data-testid": "cn-reveal-note"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
24
|
+
const _component_NcLoadingIcon = resolveComponent("NcLoadingIcon");
|
|
25
|
+
const _component_NcButton = resolveComponent("NcButton");
|
|
26
|
+
const _component_NcTextField = resolveComponent("NcTextField");
|
|
27
|
+
|
|
28
|
+
return (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
29
|
+
createElementVNode("div", _hoisted_2, [
|
|
30
|
+
createElementVNode("span", {
|
|
31
|
+
id: $data.labelId,
|
|
32
|
+
class: "cn-reveal-field__label"
|
|
33
|
+
}, toDisplayString($props.label), 9 /* TEXT, PROPS */, _hoisted_3),
|
|
34
|
+
createElementVNode("span", {
|
|
35
|
+
class: normalizeClass(["cn-reveal-field__value", { 'cn-reveal-field__value--masked': !$data.revealed }]),
|
|
36
|
+
"aria-labelledby": $data.labelId,
|
|
37
|
+
"aria-live": "polite",
|
|
38
|
+
"data-testid": "cn-reveal-value"
|
|
39
|
+
}, toDisplayString($data.revealed ? $data.revealedValue : $props.maskedValue), 11 /* TEXT, CLASS, PROPS */, _hoisted_4),
|
|
40
|
+
(!$data.askingReason)
|
|
41
|
+
? (openBlock(), createBlock(_component_NcButton, {
|
|
42
|
+
key: 0,
|
|
43
|
+
variant: "tertiary",
|
|
44
|
+
"aria-label": $data.revealed ? $options.t('nextcloud-vue', 'Hide {label}', { label: $props.label }) : $options.t('nextcloud-vue', 'Show {label}', { label: $props.label }),
|
|
45
|
+
disabled: $data.loading,
|
|
46
|
+
"data-testid": "cn-reveal-toggle",
|
|
47
|
+
onClick: $options.toggle
|
|
48
|
+
}, createSlots({
|
|
49
|
+
default: withCtx(() => [
|
|
50
|
+
createTextVNode(" " + toDisplayString($data.revealed ? $options.t('nextcloud-vue', 'Hide') : $options.t('nextcloud-vue', 'Show')), 1 /* TEXT */)
|
|
51
|
+
]),
|
|
52
|
+
_: 2 /* DYNAMIC */
|
|
53
|
+
}, [
|
|
54
|
+
($data.loading)
|
|
55
|
+
? {
|
|
56
|
+
name: "icon",
|
|
57
|
+
fn: withCtx(() => [
|
|
58
|
+
createVNode(_component_NcLoadingIcon, { size: 20 })
|
|
59
|
+
]),
|
|
60
|
+
key: "0"
|
|
61
|
+
}
|
|
62
|
+
: undefined
|
|
63
|
+
]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["aria-label", "disabled", "onClick"]))
|
|
64
|
+
: createCommentVNode("v-if", true)
|
|
65
|
+
]),
|
|
66
|
+
($data.askingReason)
|
|
67
|
+
? (openBlock(), createElementBlock("form", {
|
|
68
|
+
key: 0,
|
|
69
|
+
class: "cn-reveal-field__reason",
|
|
70
|
+
"data-testid": "cn-reveal-reason",
|
|
71
|
+
onSubmit: _cache[1] || (_cache[1] = withModifiers((...args) => ($options.submitReason && $options.submitReason(...args)), ["prevent"]))
|
|
72
|
+
}, [
|
|
73
|
+
createVNode(_component_NcTextField, {
|
|
74
|
+
ref: "reasonField",
|
|
75
|
+
modelValue: $data.reason,
|
|
76
|
+
label: $props.reasonLabel || $options.t('nextcloud-vue', 'Why do you need to see this?'),
|
|
77
|
+
required: "",
|
|
78
|
+
"data-testid": "cn-reveal-reason-input",
|
|
79
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ($data.reason = $event))
|
|
80
|
+
}, null, 8 /* PROPS */, ["modelValue", "label"]),
|
|
81
|
+
createElementVNode("div", _hoisted_5, [
|
|
82
|
+
createVNode(_component_NcButton, {
|
|
83
|
+
variant: "tertiary",
|
|
84
|
+
"data-testid": "cn-reveal-reason-cancel",
|
|
85
|
+
onClick: $options.cancelReason
|
|
86
|
+
}, {
|
|
87
|
+
default: withCtx(() => [
|
|
88
|
+
createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Cancel')), 1 /* TEXT */)
|
|
89
|
+
]),
|
|
90
|
+
_: 1 /* STABLE */
|
|
91
|
+
}, 8 /* PROPS */, ["onClick"]),
|
|
92
|
+
createVNode(_component_NcButton, {
|
|
93
|
+
type: "submit",
|
|
94
|
+
variant: "primary",
|
|
95
|
+
disabled: $data.reason.trim() === '' || $data.loading,
|
|
96
|
+
"data-testid": "cn-reveal-reason-submit"
|
|
97
|
+
}, {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Show')), 1 /* TEXT */)
|
|
100
|
+
]),
|
|
101
|
+
_: 1 /* STABLE */
|
|
102
|
+
}, 8 /* PROPS */, ["disabled"])
|
|
103
|
+
])
|
|
104
|
+
], 32 /* NEED_HYDRATION */))
|
|
105
|
+
: createCommentVNode("v-if", true),
|
|
106
|
+
($data.error)
|
|
107
|
+
? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString($data.error), 1 /* TEXT */))
|
|
108
|
+
: createCommentVNode("v-if", true),
|
|
109
|
+
($props.note)
|
|
110
|
+
? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString($props.note), 1 /* TEXT */))
|
|
111
|
+
: createCommentVNode("v-if", true)
|
|
112
|
+
]))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { render };
|
|
116
|
+
//# sourceMappingURL=CnRevealField.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnRevealField.vue3.js","sources":["../../../../src/components/CnRevealField/CnRevealField.vue?vue&type=template&id=bd786526&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-reveal-field\" data-testid=\"cn-reveal-field\">\n\t\t<div class=\"cn-reveal-field__row\">\n\t\t\t<span :id=\"labelId\" class=\"cn-reveal-field__label\">{{ label }}</span>\n\t\t\t<span\n\t\t\t\tclass=\"cn-reveal-field__value\"\n\t\t\t\t:class=\"{ 'cn-reveal-field__value--masked': !revealed }\"\n\t\t\t\t:aria-labelledby=\"labelId\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\tdata-testid=\"cn-reveal-value\">{{ revealed ? revealedValue : maskedValue }}</span>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"!askingReason\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:aria-label=\"revealed ? t('nextcloud-vue', 'Hide {label}', { label }) : t('nextcloud-vue', 'Show {label}', { label })\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\tdata-testid=\"cn-reveal-toggle\"\n\t\t\t\t@click=\"toggle\">\n\t\t\t\t<template v-if=\"loading\" #icon>\n\t\t\t\t\t<NcLoadingIcon :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ revealed ? t('nextcloud-vue', 'Hide') : t('nextcloud-vue', 'Show') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<form\n\t\t\tv-if=\"askingReason\"\n\t\t\tclass=\"cn-reveal-field__reason\"\n\t\t\tdata-testid=\"cn-reveal-reason\"\n\t\t\t@submit.prevent=\"submitReason\">\n\t\t\t<NcTextField\n\t\t\t\tref=\"reasonField\"\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel || t('nextcloud-vue', 'Why do you need to see this?')\"\n\t\t\t\trequired\n\t\t\t\tdata-testid=\"cn-reveal-reason-input\"\n\t\t\t\t@update:modelValue=\"reason = $event\" />\n\t\t\t<div class=\"cn-reveal-field__reason-actions\">\n\t\t\t\t<NcButton variant=\"tertiary\" data-testid=\"cn-reveal-reason-cancel\" @click=\"cancelReason\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Cancel') }}\n\t\t\t\t</NcButton>\n\t\t\t\t<NcButton\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t:disabled=\"reason.trim() === '' || loading\"\n\t\t\t\t\tdata-testid=\"cn-reveal-reason-submit\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Show') }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\t\t</form>\n\n\t\t<p v-if=\"error\"\n\t\t\tclass=\"cn-reveal-field__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-reveal-error\">\n\t\t\t{{ error }}\n\t\t</p>\n\t\t<p v-if=\"note\" class=\"cn-reveal-field__note\" data-testid=\"cn-reveal-note\">\n\t\t\t{{ note }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue'\n\nlet uid = 0\n\n/**\n * CnRevealField — a protected value shown masked until the user asks to see\n * it (board DqContact: \"BSN *****4001 Tonen\", \"Het tonen van het BSN wordt\n * gelogd.\").\n *\n * The component never holds the value until the user asks: `load` fetches it\n * on every reveal, so the server can log each viewing. With `requireReason`\n * the user first states why, and `load` receives that reason. Hide masks the\n * value again and drops it; the next Show calls `load` again.\n *\n * ```vue\n * <CnRevealField\n * label=\"BSN\"\n * masked-value=\"*****4001\"\n * :load=\"(reason) => api.revealBsn(person.id, reason)\"\n * require-reason\n * note=\"Het tonen van het BSN wordt gelogd.\" />\n * ```\n *\n * @event revealed Emitted once the value shows, with `{ reason }`.\n * @event hidden Emitted when the user masks the value again.\n */\nexport default {\n\tname: 'CnRevealField',\n\n\tcomponents: {\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\t/** What the value is, already translated (\"BSN\"). */\n\t\tlabel: { type: String, required: true },\n\t\t/** What shows while the value is hidden, such as the last digits behind stars. */\n\t\tmaskedValue: { type: String, default: '••••••' },\n\t\t/**\n\t\t * Fetches the value: `(reason) => string | Promise<string>`. Called on\n\t\t * every reveal; `reason` is '' unless `requireReason` is set.\n\t\t */\n\t\tload: { type: Function, required: true },\n\t\t/** Ask why the user needs the value before it is fetched. */\n\t\trequireReason: { type: Boolean, default: false },\n\t\t/** Label of the reason field, already translated; the library default is \"Why do you need to see this?\". */\n\t\treasonLabel: { type: String, default: '' },\n\t\t/** A line under the value, already translated, such as that showing it is logged. */\n\t\tnote: { type: String, default: '' },\n\t},\n\n\temits: ['revealed', 'hidden'],\n\n\tdata() {\n\t\tuid += 1\n\t\treturn {\n\t\t\tlabelId: `cn-reveal-field-${uid}`,\n\t\t\trevealed: false,\n\t\t\trevealedValue: '',\n\t\t\taskingReason: false,\n\t\t\treason: '',\n\t\t\tloading: false,\n\t\t\terror: '',\n\t\t}\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Show or hide the value. Showing asks the reason first when\n\t\t * `requireReason` is set.\n\t\t *\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\ttoggle() {\n\t\t\tif (this.revealed) {\n\t\t\t\tthis.hide()\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (this.requireReason) {\n\t\t\t\tthis.askingReason = true\n\t\t\t\tthis.error = ''\n\t\t\t\tthis.$nextTick(() => this.$refs.reasonField?.focus?.())\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn this.reveal('')\n\t\t},\n\n\t\t/**\n\t\t * Reveal with the typed reason.\n\t\t *\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\tsubmitReason() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\treturn this.reveal(reason)\n\t\t},\n\n\t\t/**\n\t\t * Close the reason form without fetching.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcancelReason() {\n\t\t\tthis.askingReason = false\n\t\t\tthis.reason = ''\n\t\t},\n\n\t\t/**\n\t\t * Fetch the value through `load` and show it; a failure keeps the\n\t\t * value masked and says so.\n\t\t *\n\t\t * @param {string} reason Why the user asked, or ''.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync reveal(reason) {\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst value = await this.load(reason)\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\tthrow new Error('empty')\n\t\t\t\t}\n\t\t\t\tthis.revealedValue = String(value)\n\t\t\t\tthis.revealed = true\n\t\t\t\tthis.askingReason = false\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.$emit('revealed', { reason })\n\t\t\t} catch {\n\t\t\t\tthis.error = t('nextcloud-vue', 'The value could not be shown. Try again later.')\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Mask the value again and drop it.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\thide() {\n\t\t\tthis.revealed = false\n\t\t\tthis.revealedValue = ''\n\t\t\tthis.$emit('hidden')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-reveal-field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n.cn-reveal-field__row {\n\talign-items: center;\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 4px 12px;\n}\n\n.cn-reveal-field__label {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-reveal-field__value {\n\tfont-variant-numeric: tabular-nums;\n\tfont-weight: 500;\n}\n\n.cn-reveal-field__value--masked {\n\tletter-spacing: 0.08em;\n}\n\n.cn-reveal-field__reason {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-reveal-field__reason-actions {\n\tdisplay: flex;\n\tgap: 8px;\n\tjustify-content: flex-end;\n}\n\n.cn-reveal-field__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: 0;\n}\n\n.cn-reveal-field__note {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n\tmargin: 0;\n}\n</style>\n"],"names":["_createElementVNode","_normalizeClass","_createBlock","_toDisplayString","_createVNode","_createElementBlock"],"mappings":";;;AASM,EAAA,KAAK,EAAC,iBAAiB;AAAC,EAAA,aAAG,EAAA,iBAAA;;AAC1B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAE,sBAAqB,GAAA;;;AAkC3B,MAAA,UAAA,GAAA,EAAA,KAAI,EAAA,iCAAA,GAAA;;;AAeT,EAAA,KAAE,EAAA,wBAAA;AACF,EAAA,IAAI,EAAC,OAAO;AACZ,EAAA,aAAS,EAAA,iBAAA;;;;;;;;;;;;;;uBA/BJ,iBAAA,EAAA;w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;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnTextWidget.vue2.js';
|
|
|
2
2
|
import { render } from './CnTextWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-8e69025a";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -50,6 +50,11 @@ function ensureDomPurifyHook() {
|
|
|
50
50
|
* attributes. Merge-swallowed cells are hidden via `v-show` so the visual
|
|
51
51
|
* grid stays rectangular.
|
|
52
52
|
*
|
|
53
|
+
* With `monospace: true` the text is shown as typed, in a fixed-width font
|
|
54
|
+
* with its spaces and line breaks kept, and is never parsed as HTML or
|
|
55
|
+
* markdown: a receipt or a log line. `textField` reads the text from that
|
|
56
|
+
* field of the detail page's object instead of `text`.
|
|
57
|
+
*
|
|
53
58
|
* Registered as the `text` dashboard widget type via the renderer's
|
|
54
59
|
* `index.js`.
|
|
55
60
|
*/
|
|
@@ -66,26 +71,61 @@ var script = {
|
|
|
66
71
|
props: {
|
|
67
72
|
/**
|
|
68
73
|
* Persisted widget content blob: `{text, fontSize, color,
|
|
69
|
-
* backgroundColor, textAlign, contentMode, tableMode, tableData, link
|
|
74
|
+
* backgroundColor, textAlign, contentMode, tableMode, tableData, link,
|
|
75
|
+
* monospace, textField}`.
|
|
70
76
|
* All keys are optional; missing keys collapse to documented defaults.
|
|
71
77
|
* `text` and `link.label` go through the app's translate function.
|
|
72
78
|
* `link` is `{label, route}` (a page id, or a path starting with `/`) or
|
|
73
79
|
* `{label, href}` (an external URL), drawn under the text.
|
|
80
|
+
* `monospace` shows the text as typed in a fixed-width font;
|
|
81
|
+
* `textField` reads the text from that field of `objectData`.
|
|
74
82
|
*
|
|
75
|
-
* @type {{text: string, fontSize: string, color: string, backgroundColor: string, textAlign: string, contentMode: string, tableMode: boolean, tableData: object, link: {label: string, route: string, href: string}}}
|
|
83
|
+
* @type {{text: string, fontSize: string, color: string, backgroundColor: string, textAlign: string, contentMode: string, tableMode: boolean, tableData: object, link: {label: string, route: string, href: string}, monospace: boolean, textField: string}}
|
|
76
84
|
*/
|
|
77
85
|
content: {
|
|
78
86
|
type: Object,
|
|
79
87
|
default: () => ({}),
|
|
80
88
|
},
|
|
89
|
+
|
|
90
|
+
/** The detail page's object, which `content.textField` reads from. */
|
|
91
|
+
objectData: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: null,
|
|
94
|
+
},
|
|
81
95
|
},
|
|
82
96
|
|
|
83
97
|
computed: {
|
|
84
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* The text: `content.textField` of the object as it is, else `content.text` translated; '' when absent.
|
|
100
|
+
*
|
|
101
|
+
* @spec openspec/changes/text-widget-monospace/tasks.md#task-2
|
|
102
|
+
*/
|
|
85
103
|
text() {
|
|
104
|
+
const field = this.content?.textField;
|
|
105
|
+
if (typeof field === 'string' && field !== '') {
|
|
106
|
+
const value = this.objectData?.[field];
|
|
107
|
+
return value === undefined || value === null ? '' : String(value)
|
|
108
|
+
}
|
|
86
109
|
return typeof this.content?.text === 'string' ? this.tr(this.content.text) : ''
|
|
87
110
|
},
|
|
88
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Whether the text shows as typed, in a fixed-width font.
|
|
114
|
+
*
|
|
115
|
+
* @spec openspec/changes/text-widget-monospace/tasks.md#task-1
|
|
116
|
+
*/
|
|
117
|
+
monospace() {
|
|
118
|
+
return this.content?.monospace === true
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/** Inline style for the fixed-width text. */
|
|
122
|
+
monoStyle() {
|
|
123
|
+
return {
|
|
124
|
+
'font-size': this.fontSize,
|
|
125
|
+
color: this.color,
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
89
129
|
/**
|
|
90
130
|
* The link under the text, from `content.link`: `{ label, route }`
|
|
91
131
|
* (a page id, or a router path when it starts with `/`) or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnTextWidget.vue2.js","sources":["../../../../src/components/CnTextWidget/CnTextWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-text-widget\" :style=\"wrapperStyle\">\n\t\t<table\n\t\t\tv-if=\"tableMode\"\n\t\t\tclass=\"cn-text-widget__table\"\n\t\t\t:style=\"tableContainerStyle\">\n\t\t\t<tbody>\n\t\t\t\t<tr v-for=\"(row, rIdx) in tableRows\" :key=\"`r-${rIdx}`\">\n\t\t\t\t\t<template v-for=\"(cell, cIdx) in row\">\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\tv-if=\"isHeaderCell(rIdx)\"\n\t\t\t\t\t\t\tv-show=\"!isPlaceholderCellAt(rIdx, cIdx)\"\n\t\t\t\t\t\t\t:key=\"`c-${rIdx}-${cIdx}`\"\n\t\t\t\t\t\t\t:rowspan=\"cell.rowSpan || 1\"\n\t\t\t\t\t\t\t:colspan=\"cell.colSpan || 1\"\n\t\t\t\t\t\t\t:style=\"headerCellStyle(cIdx)\">\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"cellHasText(cell)\"\n\t\t\t\t\t\t\t\tv-html=\"sanitizeCell(cell.text)\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\t\tclass=\"cn-text-widget__cell-placeholder\">\n\t\t\t\t\t\t\t\t{{ emptyCellPlaceholder }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td\n\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\tv-show=\"!isPlaceholderCellAt(rIdx, cIdx)\"\n\t\t\t\t\t\t\t:key=\"`c-${rIdx}-${cIdx}`\"\n\t\t\t\t\t\t\t:rowspan=\"cell.rowSpan || 1\"\n\t\t\t\t\t\t\t:colspan=\"cell.colSpan || 1\"\n\t\t\t\t\t\t\t:style=\"dataCellStyle(cIdx)\">\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"cellHasText(cell)\"\n\t\t\t\t\t\t\t\tv-html=\"sanitizeCell(cell.text)\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\t\tclass=\"cn-text-widget__cell-placeholder\">\n\t\t\t\t\t\t\t\t{{ emptyCellPlaceholder }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</template>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</table>\n\t\t<div\n\t\t\tv-else-if=\"hasText\"\n\t\t\tclass=\"cn-text-widget__content\"\n\t\t\t:class=\"contentClass\"\n\t\t\t:style=\"contentStyle\"\n\t\t\tv-html=\"sanitizedHtml\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t<span\n\t\t\tv-else\n\t\t\tclass=\"cn-text-widget__placeholder\"\n\t\t\t:style=\"contentStyle\">\n\t\t\t{{ placeholderText }}\n\t\t</span>\n\t\t<a\n\t\t\tv-if=\"link\"\n\t\t\tclass=\"cn-text-widget__link\"\n\t\t\tdata-testid=\"cn-text-widget-link\"\n\t\t\t:href=\"link.url\"\n\t\t\t:target=\"link.external ? '_blank' : null\"\n\t\t\t:rel=\"link.external ? 'noopener noreferrer' : null\"\n\t\t\t@click=\"openLink\">\n\t\t\t{{ link.label }}\n\t\t\t<ChevronRight :size=\"16\" />\n\t\t</a>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport DOMPurify from 'dompurify'\nimport { Marked } from 'marked'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport { followLinkClick, resolveHref } from '../../utils/linkNavigation.js'\nimport { isPlaceholderCell } from '../../utils/textTable.js'\n\n// Per-module `Marked` instance so configuration is scoped here and does NOT\n// mutate the global `marked` singleton (which would affect any other code in\n// the same app that imports `marked`). `gfm: true` enables tables; `breaks:\n// false` keeps CommonMark-strict newline behaviour.\nconst markedInstance = new Marked({\n\tgfm: true,\n\tbreaks: false,\n})\n\n// DOMPurify allow-list hook: author-supplied `target=_blank` links survive\n// sanitisation (we add `target` to ADD_ATTR below); the hook then appends\n// `rel=\"noopener noreferrer\"` to mitigate reverse-tabnabbing. The hook is\n// idempotent and registered once.\nlet hookRegistered = false\nfunction ensureDomPurifyHook() {\n\tif (hookRegistered) {\n\t\treturn\n\t}\n\tDOMPurify.addHook('afterSanitizeAttributes', (node) => {\n\t\tif (node.tagName === 'A' && node.getAttribute('target') === '_blank') {\n\t\t\tnode.setAttribute('rel', 'noopener noreferrer')\n\t\t}\n\t})\n\thookRegistered = true\n}\n\n/**\n * CnTextWidget — renders user-authored multi-line text (or a small table)\n * inside a dashboard cell. Text content is passed through DOMPurify before\n * injection via `v-html` so common formatting tags survive while XSS vectors\n * (`<script>`, `on*` attributes, `javascript:` URLs) are stripped.\n *\n * Persisted shape: `{text, fontSize, color, backgroundColor, textAlign,\n * contentMode, tableMode, tableData}`. Defaults: `fontSize='14px'`,\n * `color='var(--color-main-text)'`, `backgroundColor='transparent'`,\n * `textAlign='left'`. `contentMode` absent means the legacy `'html'` branch;\n * the literal `'markdown'` parses via marked (GFM tables) then sanitises\n * through the same allow-list — a single trust boundary protects both modes.\n *\n * When `tableMode === true`, the renderer draws an HTML `<table>` from\n * `tableData` instead: header rows promote row 0 to `<th>`, per-column\n * alignment is applied inline, and `colSpan` / `rowSpan` become native HTML\n * attributes. Merge-swallowed cells are hidden via `v-show` so the visual\n * grid stays rectangular.\n *\n * Registered as the `text` dashboard widget type via the renderer's\n * `index.js`.\n */\nexport default {\n\tname: 'CnTextWidget',\n\n\tcomponents: { ChevronRight },\n\n\tinject: {\n\t\t/** The app's translate function, provided by CnAppRoot. Identity outside one. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted widget content blob: `{text, fontSize, color,\n\t\t * backgroundColor, textAlign, contentMode, tableMode, tableData, link}`.\n\t\t * All keys are optional; missing keys collapse to documented defaults.\n\t\t * `text` and `link.label` go through the app's translate function.\n\t\t * `link` is `{label, route}` (a page id, or a path starting with `/`) or\n\t\t * `{label, href}` (an external URL), drawn under the text.\n\t\t *\n\t\t * @type {{text: string, fontSize: string, color: string, backgroundColor: string, textAlign: string, contentMode: string, tableMode: boolean, tableData: object, link: {label: string, route: string, href: string}}}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/** The author text through the app's translate function, or '' when absent / non-string. */\n\t\ttext() {\n\t\t\treturn typeof this.content?.text === 'string' ? this.tr(this.content.text) : ''\n\t\t},\n\n\t\t/**\n\t\t * The link under the text, from `content.link`: `{ label, route }`\n\t\t * (a page id, or a router path when it starts with `/`) or\n\t\t * `{ label, href }` (an external URL, opened in a new tab). The label\n\t\t * goes through the app's translate function. Null without a label or\n\t\t * a target.\n\t\t *\n\t\t * @return {{label: string, url: string, location: (object|null), external: boolean}|null} The link.\n\t\t */\n\t\tlink() {\n\t\t\tconst link = this.content?.link\n\t\t\tif (!link || typeof link !== 'object' || typeof link.label !== 'string' || link.label === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tif (typeof link.route === 'string' && link.route !== '') {\n\t\t\t\tconst location = link.route.startsWith('/') ? { path: link.route } : { name: link.route }\n\t\t\t\tconst url = resolveHref(location, this.$router)\n\t\t\t\treturn url ? { label: this.tr(link.label), url, location, external: false } : null\n\t\t\t}\n\t\t\tif (typeof link.href === 'string' && link.href !== '') {\n\t\t\t\treturn { label: this.tr(link.label), url: link.href, location: null, external: true }\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\t/** Whether the text has any non-whitespace content. */\n\t\thasText() {\n\t\t\treturn this.text.trim() !== ''\n\t\t},\n\n\t\t/** Resolved content mode — only `'markdown'` switches the branch. */\n\t\tcontentMode() {\n\t\t\treturn this.content?.contentMode === 'markdown' ? 'markdown' : 'html'\n\t\t},\n\n\t\t/** CSS class selecting the markdown vs html content-spacing rules. */\n\t\tcontentClass() {\n\t\t\treturn this.contentMode === 'markdown'\n\t\t\t\t? 'cn-text-widget__content--markdown'\n\t\t\t\t: 'cn-text-widget__content--html'\n\t\t},\n\n\t\t/**\n\t\t * The HTML to render: either the raw author HTML (sanitised) or the\n\t\t * markdown rendering of the author text (sanitised). Both branches go\n\t\t * through DOMPurify, which strips `<script>`, `<style>`, `<link>`,\n\t\t * `on*` attributes, and `javascript:` URLs.\n\t\t *\n\t\t * @return {string} sanitised HTML safe for `v-html` injection.\n\t\t */\n\t\tsanitizedHtml() {\n\t\t\tlet html\n\t\t\tif (this.contentMode === 'markdown') {\n\t\t\t\ttry {\n\t\t\t\t\thtml = markedInstance.parse(this.text)\n\t\t\t\t\tif (typeof html !== 'string') {\n\t\t\t\t\t\thtml = String(html)\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Defensive: fall back to the raw text rather than crash\n\t\t\t\t\t// the dashboard if the parser throws.\n\t\t\t\t\thtml = this.text\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thtml = this.text\n\t\t\t}\n\t\t\treturn DOMPurify.sanitize(html, {\n\t\t\t\tADD_ATTR: ['target'],\n\t\t\t})\n\t\t},\n\n\t\t/** Localised placeholder shown when there is no text content. */\n\t\tplaceholderText() {\n\t\t\treturn t('nextcloud-vue', 'No text content')\n\t\t},\n\n\t\t/** Localised placeholder shown inside an empty table cell. */\n\t\temptyCellPlaceholder() {\n\t\t\treturn t('nextcloud-vue', 'Empty cell')\n\t\t},\n\n\t\t/** Resolved font size (default `14px`). */\n\t\tfontSize() {\n\t\t\treturn this.content?.fontSize || '14px'\n\t\t},\n\n\t\t/** Resolved text colour (default theme main text). */\n\t\tcolor() {\n\t\t\treturn this.content?.color || 'var(--color-main-text)'\n\t\t},\n\n\t\t/** Resolved background colour (default transparent). */\n\t\tbackgroundColor() {\n\t\t\treturn this.content?.backgroundColor || 'transparent'\n\t\t},\n\n\t\t/** Resolved text alignment (default `left`). */\n\t\ttextAlign() {\n\t\t\treturn this.content?.textAlign || 'left'\n\t\t},\n\n\t\t/** Whether the renderer is in table mode. */\n\t\ttableMode() {\n\t\t\treturn this.content?.tableMode === true\n\t\t},\n\n\t\t/** The persisted tableData object, or null. */\n\t\ttableData() {\n\t\t\treturn this.content?.tableData || null\n\t\t},\n\n\t\t/** The table rows array (empty when no table data). */\n\t\ttableRows() {\n\t\t\treturn Array.isArray(this.tableData?.rows) ? this.tableData.rows : []\n\t\t},\n\n\t\t/** Whether row 0 should render as a header row. */\n\t\theaderRow() {\n\t\t\treturn this.tableData?.headerRow === true\n\t\t},\n\n\t\t/** Per-column text-alignment array. */\n\t\tcolumnAlignments() {\n\t\t\tconst aligns = this.tableData?.columnAlignments\n\t\t\treturn Array.isArray(aligns) ? aligns : []\n\t\t},\n\n\t\t/** Inline style for the flex wrapper. */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tpadding: '16px',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\toverflow: 'auto',\n\t\t\t\t'background-color': this.backgroundColor,\n\t\t\t\t...(this.link ? { 'flex-direction': 'column', gap: '8px', 'align-items': 'flex-start' } : {}),\n\t\t\t}\n\t\t},\n\n\t\t/** Inline style for the text / placeholder content. */\n\t\tcontentStyle() {\n\t\t\tconst base = {\n\t\t\t\t'font-size': this.fontSize,\n\t\t\t\t'text-align': this.textAlign,\n\t\t\t\tcolor: this.color,\n\t\t\t\twidth: '100%',\n\t\t\t\t'overflow-wrap': 'break-word',\n\t\t\t}\n\t\t\tif (!this.hasText) {\n\t\t\t\tbase['font-style'] = 'italic'\n\t\t\t\tbase.color = 'var(--color-text-maxcontrast)'\n\t\t\t}\n\t\t\treturn base\n\t\t},\n\n\t\t/** Inline style for the table container. */\n\t\ttableContainerStyle() {\n\t\t\treturn {\n\t\t\t\t'font-size': this.fontSize,\n\t\t\t\tcolor: this.color,\n\t\t\t\twidth: '100%',\n\t\t\t}\n\t\t},\n\t},\n\n\tcreated() {\n\t\tensureDomPurifyHook()\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A manifest string through the app's translate function.\n\t\t *\n\t\t * @param {string} text The string.\n\t\t * @return {string} The translated string.\n\t\t */\n\t\ttr(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\topenLink(event) {\n\t\t\tif (this.link && !this.link.external) {\n\t\t\t\tfollowLinkClick(event, this.link.location, this.$router)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run cell text through DOMPurify so the table-mode render path has\n\t\t * the same XSS-stripping guarantees as the text-mode path.\n\t\t *\n\t\t * @param {string} text raw cell text (may contain HTML).\n\t\t * @return {string} sanitised HTML safe to render via `v-html`.\n\t\t */\n\t\tsanitizeCell(text) {\n\t\t\treturn DOMPurify.sanitize(typeof text === 'string' ? text : '')\n\t\t},\n\n\t\t/**\n\t\t * Whether the given row index renders as `<th>` (header row).\n\t\t *\n\t\t * @param {number} rIdx the 0-based row index.\n\t\t * @return {boolean} true when row 0 and the header flag is set.\n\t\t */\n\t\tisHeaderCell(rIdx) {\n\t\t\treturn this.headerRow && rIdx === 0\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell is covered by another cell's `rowSpan` / `colSpan`\n\t\t * and so must be hidden to keep the grid rectangular.\n\t\t *\n\t\t * @param {number} rIdx the row index.\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {boolean} true when the cell is a covered placeholder.\n\t\t */\n\t\tisPlaceholderCellAt(rIdx, cIdx) {\n\t\t\treturn isPlaceholderCell(this.tableRows, rIdx, cIdx)\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell has any non-whitespace text.\n\t\t *\n\t\t * @param {object} cell the cell object.\n\t\t * @return {boolean} true when the cell has text.\n\t\t */\n\t\tcellHasText(cell) {\n\t\t\treturn typeof cell?.text === 'string' && cell.text.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Inline style for a data cell at a given column.\n\t\t *\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {object} the cell style object.\n\t\t */\n\t\tdataCellStyle(cIdx) {\n\t\t\treturn {\n\t\t\t\t'text-align': this.columnAlignments[cIdx] || 'left',\n\t\t\t\tborder: '1px solid var(--color-border)',\n\t\t\t\tpadding: '8px',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for a header cell at a given column.\n\t\t *\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {object} the header cell style object.\n\t\t */\n\t\theaderCellStyle(cIdx) {\n\t\t\treturn {\n\t\t\t\t...this.dataCellStyle(cIdx),\n\t\t\t\t'background-color': 'var(--color-background-hover)',\n\t\t\t\t'font-weight': 'bold',\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-text-widget {\n\twidth: 100%;\n\theight: 100%;\n}\n\n.cn-text-widget__content,\n.cn-text-widget__placeholder {\n\t/* Safety net — ensures long URLs / words inside the sanitised HTML wrap\n\t rather than overflowing horizontally. */\n\toverflow-wrap: break-word;\n\tmax-width: 100%;\n}\n\n/* Restore inline-emphasis semantics inside rendered content. Nextcloud's\n server CSS styles bare <em> as muted (var(--color-text-maxcontrast)) and can\n drop the italic, so `_x_` / `**_x_**` looked greyed-out and non-italic. Force\n italic <em> / bold <strong> that inherit the widget's own text colour. */\n.cn-text-widget :deep(em),\n.cn-text-widget :deep(i) {\n\tfont-style: italic;\n\tcolor: inherit;\n}\n\n.cn-text-widget :deep(strong),\n.cn-text-widget :deep(b) {\n\tfont-weight: bold;\n\tcolor: inherit;\n}\n\n/* Nextcloud's server CSS strips list markers/indent (`list-style: none`,\n no padding), so rendered `<ul>`/`<ol>` looked like plain text. Restore\n bullets/numbers and indentation, including nested levels. */\n.cn-text-widget :deep(ul),\n.cn-text-widget :deep(ol) {\n\tmargin: 4px 0;\n\tpadding-left: 1.5em;\n}\n\n.cn-text-widget :deep(ul) {\n\tlist-style: disc outside;\n}\n\n.cn-text-widget :deep(ol) {\n\tlist-style: decimal outside;\n}\n\n.cn-text-widget :deep(ul ul) {\n\tlist-style-type: circle;\n}\n\n.cn-text-widget :deep(ul ul ul) {\n\tlist-style-type: square;\n}\n\n.cn-text-widget :deep(li) {\n\tdisplay: list-item;\n}\n\n/* Nextcloud's server CSS flattens heading sizes (e.g. h1 → 100%, so it fell\n back to the ~14px body size while h2 stayed 1.8em), leaving them oddly\n scaled. Apply a consistent em-based scale that grows with the widget's own\n font size. */\n.cn-text-widget :deep(h1) {\n\tfont-size: 2em;\n}\n\n.cn-text-widget :deep(h2) {\n\tfont-size: 1.5em;\n}\n\n.cn-text-widget :deep(h3) {\n\tfont-size: 1.25em;\n}\n\n.cn-text-widget :deep(h4) {\n\tfont-size: 1.1em;\n}\n\n.cn-text-widget :deep(h5) {\n\tfont-size: 1em;\n}\n\n.cn-text-widget :deep(h6) {\n\tfont-size: 0.85em;\n}\n\n.cn-text-widget__content--markdown :deep(h1),\n.cn-text-widget__content--markdown :deep(h2),\n.cn-text-widget__content--markdown :deep(h3),\n.cn-text-widget__content--markdown :deep(h4),\n.cn-text-widget__content--markdown :deep(h5),\n.cn-text-widget__content--markdown :deep(h6) {\n\tmargin: 8px 0 4px;\n\tfont-weight: 600;\n\tline-height: 1.3;\n}\n\n.cn-text-widget__content--markdown :deep(p),\n.cn-text-widget__content--markdown :deep(ul),\n.cn-text-widget__content--markdown :deep(ol),\n.cn-text-widget__content--markdown :deep(blockquote) {\n\tmargin: 4px 0;\n}\n\n.cn-text-widget__content--markdown :deep(code) {\n\tpadding: 1px 4px;\n\tborder-radius: 3px;\n\tbackground: var(--color-background-hover);\n\tfont-family: var(--font-monospace, monospace);\n\tfont-size: 0.95em;\n}\n\n.cn-text-widget__content--markdown :deep(pre) {\n\tpadding: 8px;\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\toverflow: auto;\n}\n\n.cn-text-widget__content--markdown :deep(pre) :deep(code) {\n\tpadding: 0;\n\tbackground: transparent;\n}\n\n.cn-text-widget__content--markdown :deep(blockquote) {\n\tpadding-left: 8px;\n\tborder-left: 3px solid var(--color-border);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-text-widget__content--markdown :deep(table) {\n\tborder-collapse: collapse;\n\tmargin: 4px 0;\n}\n\n.cn-text-widget__content--markdown :deep(th),\n.cn-text-widget__content--markdown :deep(td) {\n\tpadding: 4px 8px;\n\tborder: 1px solid var(--color-border);\n}\n\n.cn-text-widget__table {\n\tborder-collapse: collapse;\n\twidth: 100%;\n}\n\n.cn-text-widget__table th,\n.cn-text-widget__table td {\n\toverflow-wrap: break-word;\n\tvertical-align: top;\n}\n\n.cn-text-widget__cell-placeholder {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n}\n\n.cn-text-widget__link {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 2px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n\ttext-decoration: none;\n}\n\n.cn-text-widget__link:hover,\n.cn-text-widget__link:focus-visible {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;;;AAoFA;AACA;AACA;AACA;AACA,MAAM,cAAa,GAAI,IAAI,MAAM,CAAC;AACjC,CAAA,GAAG,EAAE,IAAI;CACT,MAAM,EAAE,KAAK;AACd,CAAC,EAAA;;AAED;AACA;AACA;AACA;AACA,IAAI,cAAa,GAAI,MAAI;AACzB,SAAS,mBAAmB,GAAG;AAC9B,CAAA,IAAI,cAAc,EAAE;EACnB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AAED,EAAA,aAAa,CAAC,IAAI,EAAE;AACnB,GAAA,OAAO;IACN,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM;AACnD,IAAA,MAAM,EAAE,+BAA+B;IACvC,OAAO,EAAE,KAAK;AACf,IAAA;GACA;;AAED;AACC;AACA;AACA;AACA;;AAED,EAAA,eAAe,CAAC,IAAI,EAAE;AACrB,GAAA,OAAO;IACN,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IAC3B,kBAAkB,EAAE,+BAA+B;AACnD,IAAA,aAAa,EAAE,MAAM;AACtB,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnTextWidget.vue2.js","sources":["../../../../src/components/CnTextWidget/CnTextWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-text-widget\" :style=\"wrapperStyle\">\n\t\t<table\n\t\t\tv-if=\"tableMode\"\n\t\t\tclass=\"cn-text-widget__table\"\n\t\t\t:style=\"tableContainerStyle\">\n\t\t\t<tbody>\n\t\t\t\t<tr v-for=\"(row, rIdx) in tableRows\" :key=\"`r-${rIdx}`\">\n\t\t\t\t\t<template v-for=\"(cell, cIdx) in row\">\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\tv-if=\"isHeaderCell(rIdx)\"\n\t\t\t\t\t\t\tv-show=\"!isPlaceholderCellAt(rIdx, cIdx)\"\n\t\t\t\t\t\t\t:key=\"`c-${rIdx}-${cIdx}`\"\n\t\t\t\t\t\t\t:rowspan=\"cell.rowSpan || 1\"\n\t\t\t\t\t\t\t:colspan=\"cell.colSpan || 1\"\n\t\t\t\t\t\t\t:style=\"headerCellStyle(cIdx)\">\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"cellHasText(cell)\"\n\t\t\t\t\t\t\t\tv-html=\"sanitizeCell(cell.text)\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\t\tclass=\"cn-text-widget__cell-placeholder\">\n\t\t\t\t\t\t\t\t{{ emptyCellPlaceholder }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td\n\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\tv-show=\"!isPlaceholderCellAt(rIdx, cIdx)\"\n\t\t\t\t\t\t\t:key=\"`c-${rIdx}-${cIdx}`\"\n\t\t\t\t\t\t\t:rowspan=\"cell.rowSpan || 1\"\n\t\t\t\t\t\t\t:colspan=\"cell.colSpan || 1\"\n\t\t\t\t\t\t\t:style=\"dataCellStyle(cIdx)\">\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-if=\"cellHasText(cell)\"\n\t\t\t\t\t\t\t\tv-html=\"sanitizeCell(cell.text)\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tv-else\n\t\t\t\t\t\t\t\tclass=\"cn-text-widget__cell-placeholder\">\n\t\t\t\t\t\t\t\t{{ emptyCellPlaceholder }}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</template>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</table>\n\t\t<pre\n\t\t\tv-else-if=\"monospace && hasText\"\n\t\t\tclass=\"cn-text-widget__mono\"\n\t\t\tdata-testid=\"cn-text-widget-mono\"\n\t\t\t:style=\"monoStyle\">{{ text }}</pre>\n\t\t<div\n\t\t\tv-else-if=\"hasText\"\n\t\t\tclass=\"cn-text-widget__content\"\n\t\t\t:class=\"contentClass\"\n\t\t\t:style=\"contentStyle\"\n\t\t\tv-html=\"sanitizedHtml\" /><!-- eslint-disable-line vue/no-v-html -->\n\t\t<span\n\t\t\tv-else\n\t\t\tclass=\"cn-text-widget__placeholder\"\n\t\t\t:style=\"contentStyle\">\n\t\t\t{{ placeholderText }}\n\t\t</span>\n\t\t<a\n\t\t\tv-if=\"link\"\n\t\t\tclass=\"cn-text-widget__link\"\n\t\t\tdata-testid=\"cn-text-widget-link\"\n\t\t\t:href=\"link.url\"\n\t\t\t:target=\"link.external ? '_blank' : null\"\n\t\t\t:rel=\"link.external ? 'noopener noreferrer' : null\"\n\t\t\t@click=\"openLink\">\n\t\t\t{{ link.label }}\n\t\t\t<ChevronRight :size=\"16\" />\n\t\t</a>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport DOMPurify from 'dompurify'\nimport { Marked } from 'marked'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport { followLinkClick, resolveHref } from '../../utils/linkNavigation.js'\nimport { isPlaceholderCell } from '../../utils/textTable.js'\n\n// Per-module `Marked` instance so configuration is scoped here and does NOT\n// mutate the global `marked` singleton (which would affect any other code in\n// the same app that imports `marked`). `gfm: true` enables tables; `breaks:\n// false` keeps CommonMark-strict newline behaviour.\nconst markedInstance = new Marked({\n\tgfm: true,\n\tbreaks: false,\n})\n\n// DOMPurify allow-list hook: author-supplied `target=_blank` links survive\n// sanitisation (we add `target` to ADD_ATTR below); the hook then appends\n// `rel=\"noopener noreferrer\"` to mitigate reverse-tabnabbing. The hook is\n// idempotent and registered once.\nlet hookRegistered = false\nfunction ensureDomPurifyHook() {\n\tif (hookRegistered) {\n\t\treturn\n\t}\n\tDOMPurify.addHook('afterSanitizeAttributes', (node) => {\n\t\tif (node.tagName === 'A' && node.getAttribute('target') === '_blank') {\n\t\t\tnode.setAttribute('rel', 'noopener noreferrer')\n\t\t}\n\t})\n\thookRegistered = true\n}\n\n/**\n * CnTextWidget — renders user-authored multi-line text (or a small table)\n * inside a dashboard cell. Text content is passed through DOMPurify before\n * injection via `v-html` so common formatting tags survive while XSS vectors\n * (`<script>`, `on*` attributes, `javascript:` URLs) are stripped.\n *\n * Persisted shape: `{text, fontSize, color, backgroundColor, textAlign,\n * contentMode, tableMode, tableData}`. Defaults: `fontSize='14px'`,\n * `color='var(--color-main-text)'`, `backgroundColor='transparent'`,\n * `textAlign='left'`. `contentMode` absent means the legacy `'html'` branch;\n * the literal `'markdown'` parses via marked (GFM tables) then sanitises\n * through the same allow-list — a single trust boundary protects both modes.\n *\n * When `tableMode === true`, the renderer draws an HTML `<table>` from\n * `tableData` instead: header rows promote row 0 to `<th>`, per-column\n * alignment is applied inline, and `colSpan` / `rowSpan` become native HTML\n * attributes. Merge-swallowed cells are hidden via `v-show` so the visual\n * grid stays rectangular.\n *\n * With `monospace: true` the text is shown as typed, in a fixed-width font\n * with its spaces and line breaks kept, and is never parsed as HTML or\n * markdown: a receipt or a log line. `textField` reads the text from that\n * field of the detail page's object instead of `text`.\n *\n * Registered as the `text` dashboard widget type via the renderer's\n * `index.js`.\n */\nexport default {\n\tname: 'CnTextWidget',\n\n\tcomponents: { ChevronRight },\n\n\tinject: {\n\t\t/** The app's translate function, provided by CnAppRoot. Identity outside one. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted widget content blob: `{text, fontSize, color,\n\t\t * backgroundColor, textAlign, contentMode, tableMode, tableData, link,\n\t\t * monospace, textField}`.\n\t\t * All keys are optional; missing keys collapse to documented defaults.\n\t\t * `text` and `link.label` go through the app's translate function.\n\t\t * `link` is `{label, route}` (a page id, or a path starting with `/`) or\n\t\t * `{label, href}` (an external URL), drawn under the text.\n\t\t * `monospace` shows the text as typed in a fixed-width font;\n\t\t * `textField` reads the text from that field of `objectData`.\n\t\t *\n\t\t * @type {{text: string, fontSize: string, color: string, backgroundColor: string, textAlign: string, contentMode: string, tableMode: boolean, tableData: object, link: {label: string, route: string, href: string}, monospace: boolean, textField: string}}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The detail page's object, which `content.textField` reads from. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The text: `content.textField` of the object as it is, else `content.text` translated; '' when absent.\n\t\t *\n\t\t * @spec openspec/changes/text-widget-monospace/tasks.md#task-2\n\t\t */\n\t\ttext() {\n\t\t\tconst field = this.content?.textField\n\t\t\tif (typeof field === 'string' && field !== '') {\n\t\t\t\tconst value = this.objectData?.[field]\n\t\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t\t}\n\t\t\treturn typeof this.content?.text === 'string' ? this.tr(this.content.text) : ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the text shows as typed, in a fixed-width font.\n\t\t *\n\t\t * @spec openspec/changes/text-widget-monospace/tasks.md#task-1\n\t\t */\n\t\tmonospace() {\n\t\t\treturn this.content?.monospace === true\n\t\t},\n\n\t\t/** Inline style for the fixed-width text. */\n\t\tmonoStyle() {\n\t\t\treturn {\n\t\t\t\t'font-size': this.fontSize,\n\t\t\t\tcolor: this.color,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The link under the text, from `content.link`: `{ label, route }`\n\t\t * (a page id, or a router path when it starts with `/`) or\n\t\t * `{ label, href }` (an external URL, opened in a new tab). The label\n\t\t * goes through the app's translate function. Null without a label or\n\t\t * a target.\n\t\t *\n\t\t * @return {{label: string, url: string, location: (object|null), external: boolean}|null} The link.\n\t\t */\n\t\tlink() {\n\t\t\tconst link = this.content?.link\n\t\t\tif (!link || typeof link !== 'object' || typeof link.label !== 'string' || link.label === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tif (typeof link.route === 'string' && link.route !== '') {\n\t\t\t\tconst location = link.route.startsWith('/') ? { path: link.route } : { name: link.route }\n\t\t\t\tconst url = resolveHref(location, this.$router)\n\t\t\t\treturn url ? { label: this.tr(link.label), url, location, external: false } : null\n\t\t\t}\n\t\t\tif (typeof link.href === 'string' && link.href !== '') {\n\t\t\t\treturn { label: this.tr(link.label), url: link.href, location: null, external: true }\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\t/** Whether the text has any non-whitespace content. */\n\t\thasText() {\n\t\t\treturn this.text.trim() !== ''\n\t\t},\n\n\t\t/** Resolved content mode — only `'markdown'` switches the branch. */\n\t\tcontentMode() {\n\t\t\treturn this.content?.contentMode === 'markdown' ? 'markdown' : 'html'\n\t\t},\n\n\t\t/** CSS class selecting the markdown vs html content-spacing rules. */\n\t\tcontentClass() {\n\t\t\treturn this.contentMode === 'markdown'\n\t\t\t\t? 'cn-text-widget__content--markdown'\n\t\t\t\t: 'cn-text-widget__content--html'\n\t\t},\n\n\t\t/**\n\t\t * The HTML to render: either the raw author HTML (sanitised) or the\n\t\t * markdown rendering of the author text (sanitised). Both branches go\n\t\t * through DOMPurify, which strips `<script>`, `<style>`, `<link>`,\n\t\t * `on*` attributes, and `javascript:` URLs.\n\t\t *\n\t\t * @return {string} sanitised HTML safe for `v-html` injection.\n\t\t */\n\t\tsanitizedHtml() {\n\t\t\tlet html\n\t\t\tif (this.contentMode === 'markdown') {\n\t\t\t\ttry {\n\t\t\t\t\thtml = markedInstance.parse(this.text)\n\t\t\t\t\tif (typeof html !== 'string') {\n\t\t\t\t\t\thtml = String(html)\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Defensive: fall back to the raw text rather than crash\n\t\t\t\t\t// the dashboard if the parser throws.\n\t\t\t\t\thtml = this.text\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thtml = this.text\n\t\t\t}\n\t\t\treturn DOMPurify.sanitize(html, {\n\t\t\t\tADD_ATTR: ['target'],\n\t\t\t})\n\t\t},\n\n\t\t/** Localised placeholder shown when there is no text content. */\n\t\tplaceholderText() {\n\t\t\treturn t('nextcloud-vue', 'No text content')\n\t\t},\n\n\t\t/** Localised placeholder shown inside an empty table cell. */\n\t\temptyCellPlaceholder() {\n\t\t\treturn t('nextcloud-vue', 'Empty cell')\n\t\t},\n\n\t\t/** Resolved font size (default `14px`). */\n\t\tfontSize() {\n\t\t\treturn this.content?.fontSize || '14px'\n\t\t},\n\n\t\t/** Resolved text colour (default theme main text). */\n\t\tcolor() {\n\t\t\treturn this.content?.color || 'var(--color-main-text)'\n\t\t},\n\n\t\t/** Resolved background colour (default transparent). */\n\t\tbackgroundColor() {\n\t\t\treturn this.content?.backgroundColor || 'transparent'\n\t\t},\n\n\t\t/** Resolved text alignment (default `left`). */\n\t\ttextAlign() {\n\t\t\treturn this.content?.textAlign || 'left'\n\t\t},\n\n\t\t/** Whether the renderer is in table mode. */\n\t\ttableMode() {\n\t\t\treturn this.content?.tableMode === true\n\t\t},\n\n\t\t/** The persisted tableData object, or null. */\n\t\ttableData() {\n\t\t\treturn this.content?.tableData || null\n\t\t},\n\n\t\t/** The table rows array (empty when no table data). */\n\t\ttableRows() {\n\t\t\treturn Array.isArray(this.tableData?.rows) ? this.tableData.rows : []\n\t\t},\n\n\t\t/** Whether row 0 should render as a header row. */\n\t\theaderRow() {\n\t\t\treturn this.tableData?.headerRow === true\n\t\t},\n\n\t\t/** Per-column text-alignment array. */\n\t\tcolumnAlignments() {\n\t\t\tconst aligns = this.tableData?.columnAlignments\n\t\t\treturn Array.isArray(aligns) ? aligns : []\n\t\t},\n\n\t\t/** Inline style for the flex wrapper. */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tpadding: '16px',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\toverflow: 'auto',\n\t\t\t\t'background-color': this.backgroundColor,\n\t\t\t\t...(this.link ? { 'flex-direction': 'column', gap: '8px', 'align-items': 'flex-start' } : {}),\n\t\t\t}\n\t\t},\n\n\t\t/** Inline style for the text / placeholder content. */\n\t\tcontentStyle() {\n\t\t\tconst base = {\n\t\t\t\t'font-size': this.fontSize,\n\t\t\t\t'text-align': this.textAlign,\n\t\t\t\tcolor: this.color,\n\t\t\t\twidth: '100%',\n\t\t\t\t'overflow-wrap': 'break-word',\n\t\t\t}\n\t\t\tif (!this.hasText) {\n\t\t\t\tbase['font-style'] = 'italic'\n\t\t\t\tbase.color = 'var(--color-text-maxcontrast)'\n\t\t\t}\n\t\t\treturn base\n\t\t},\n\n\t\t/** Inline style for the table container. */\n\t\ttableContainerStyle() {\n\t\t\treturn {\n\t\t\t\t'font-size': this.fontSize,\n\t\t\t\tcolor: this.color,\n\t\t\t\twidth: '100%',\n\t\t\t}\n\t\t},\n\t},\n\n\tcreated() {\n\t\tensureDomPurifyHook()\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A manifest string through the app's translate function.\n\t\t *\n\t\t * @param {string} text The string.\n\t\t * @return {string} The translated string.\n\t\t */\n\t\ttr(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\topenLink(event) {\n\t\t\tif (this.link && !this.link.external) {\n\t\t\t\tfollowLinkClick(event, this.link.location, this.$router)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run cell text through DOMPurify so the table-mode render path has\n\t\t * the same XSS-stripping guarantees as the text-mode path.\n\t\t *\n\t\t * @param {string} text raw cell text (may contain HTML).\n\t\t * @return {string} sanitised HTML safe to render via `v-html`.\n\t\t */\n\t\tsanitizeCell(text) {\n\t\t\treturn DOMPurify.sanitize(typeof text === 'string' ? text : '')\n\t\t},\n\n\t\t/**\n\t\t * Whether the given row index renders as `<th>` (header row).\n\t\t *\n\t\t * @param {number} rIdx the 0-based row index.\n\t\t * @return {boolean} true when row 0 and the header flag is set.\n\t\t */\n\t\tisHeaderCell(rIdx) {\n\t\t\treturn this.headerRow && rIdx === 0\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell is covered by another cell's `rowSpan` / `colSpan`\n\t\t * and so must be hidden to keep the grid rectangular.\n\t\t *\n\t\t * @param {number} rIdx the row index.\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {boolean} true when the cell is a covered placeholder.\n\t\t */\n\t\tisPlaceholderCellAt(rIdx, cIdx) {\n\t\t\treturn isPlaceholderCell(this.tableRows, rIdx, cIdx)\n\t\t},\n\n\t\t/**\n\t\t * Whether a cell has any non-whitespace text.\n\t\t *\n\t\t * @param {object} cell the cell object.\n\t\t * @return {boolean} true when the cell has text.\n\t\t */\n\t\tcellHasText(cell) {\n\t\t\treturn typeof cell?.text === 'string' && cell.text.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Inline style for a data cell at a given column.\n\t\t *\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {object} the cell style object.\n\t\t */\n\t\tdataCellStyle(cIdx) {\n\t\t\treturn {\n\t\t\t\t'text-align': this.columnAlignments[cIdx] || 'left',\n\t\t\t\tborder: '1px solid var(--color-border)',\n\t\t\t\tpadding: '8px',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for a header cell at a given column.\n\t\t *\n\t\t * @param {number} cIdx the column index.\n\t\t * @return {object} the header cell style object.\n\t\t */\n\t\theaderCellStyle(cIdx) {\n\t\t\treturn {\n\t\t\t\t...this.dataCellStyle(cIdx),\n\t\t\t\t'background-color': 'var(--color-background-hover)',\n\t\t\t\t'font-weight': 'bold',\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-text-widget {\n\twidth: 100%;\n\theight: 100%;\n}\n\n.cn-text-widget__content,\n.cn-text-widget__mono {\n\twidth: 100%;\n\tmargin: 0;\n\tpadding: 12px;\n\tfont-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;\n\tline-height: 1.4;\n\twhite-space: pre-wrap;\n\toverflow-wrap: anywhere;\n\ttext-align: start;\n\tbackground: var(--color-background-dark);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-text-widget__placeholder {\n\t/* Safety net — ensures long URLs / words inside the sanitised HTML wrap\n\t rather than overflowing horizontally. */\n\toverflow-wrap: break-word;\n\tmax-width: 100%;\n}\n\n/* Restore inline-emphasis semantics inside rendered content. Nextcloud's\n server CSS styles bare <em> as muted (var(--color-text-maxcontrast)) and can\n drop the italic, so `_x_` / `**_x_**` looked greyed-out and non-italic. Force\n italic <em> / bold <strong> that inherit the widget's own text colour. */\n.cn-text-widget :deep(em),\n.cn-text-widget :deep(i) {\n\tfont-style: italic;\n\tcolor: inherit;\n}\n\n.cn-text-widget :deep(strong),\n.cn-text-widget :deep(b) {\n\tfont-weight: bold;\n\tcolor: inherit;\n}\n\n/* Nextcloud's server CSS strips list markers/indent (`list-style: none`,\n no padding), so rendered `<ul>`/`<ol>` looked like plain text. Restore\n bullets/numbers and indentation, including nested levels. */\n.cn-text-widget :deep(ul),\n.cn-text-widget :deep(ol) {\n\tmargin: 4px 0;\n\tpadding-left: 1.5em;\n}\n\n.cn-text-widget :deep(ul) {\n\tlist-style: disc outside;\n}\n\n.cn-text-widget :deep(ol) {\n\tlist-style: decimal outside;\n}\n\n.cn-text-widget :deep(ul ul) {\n\tlist-style-type: circle;\n}\n\n.cn-text-widget :deep(ul ul ul) {\n\tlist-style-type: square;\n}\n\n.cn-text-widget :deep(li) {\n\tdisplay: list-item;\n}\n\n/* Nextcloud's server CSS flattens heading sizes (e.g. h1 → 100%, so it fell\n back to the ~14px body size while h2 stayed 1.8em), leaving them oddly\n scaled. Apply a consistent em-based scale that grows with the widget's own\n font size. */\n.cn-text-widget :deep(h1) {\n\tfont-size: 2em;\n}\n\n.cn-text-widget :deep(h2) {\n\tfont-size: 1.5em;\n}\n\n.cn-text-widget :deep(h3) {\n\tfont-size: 1.25em;\n}\n\n.cn-text-widget :deep(h4) {\n\tfont-size: 1.1em;\n}\n\n.cn-text-widget :deep(h5) {\n\tfont-size: 1em;\n}\n\n.cn-text-widget :deep(h6) {\n\tfont-size: 0.85em;\n}\n\n.cn-text-widget__content--markdown :deep(h1),\n.cn-text-widget__content--markdown :deep(h2),\n.cn-text-widget__content--markdown :deep(h3),\n.cn-text-widget__content--markdown :deep(h4),\n.cn-text-widget__content--markdown :deep(h5),\n.cn-text-widget__content--markdown :deep(h6) {\n\tmargin: 8px 0 4px;\n\tfont-weight: 600;\n\tline-height: 1.3;\n}\n\n.cn-text-widget__content--markdown :deep(p),\n.cn-text-widget__content--markdown :deep(ul),\n.cn-text-widget__content--markdown :deep(ol),\n.cn-text-widget__content--markdown :deep(blockquote) {\n\tmargin: 4px 0;\n}\n\n.cn-text-widget__content--markdown :deep(code) {\n\tpadding: 1px 4px;\n\tborder-radius: 3px;\n\tbackground: var(--color-background-hover);\n\tfont-family: var(--font-monospace, monospace);\n\tfont-size: 0.95em;\n}\n\n.cn-text-widget__content--markdown :deep(pre) {\n\tpadding: 8px;\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\toverflow: auto;\n}\n\n.cn-text-widget__content--markdown :deep(pre) :deep(code) {\n\tpadding: 0;\n\tbackground: transparent;\n}\n\n.cn-text-widget__content--markdown :deep(blockquote) {\n\tpadding-left: 8px;\n\tborder-left: 3px solid var(--color-border);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-text-widget__content--markdown :deep(table) {\n\tborder-collapse: collapse;\n\tmargin: 4px 0;\n}\n\n.cn-text-widget__content--markdown :deep(th),\n.cn-text-widget__content--markdown :deep(td) {\n\tpadding: 4px 8px;\n\tborder: 1px solid var(--color-border);\n}\n\n.cn-text-widget__table {\n\tborder-collapse: collapse;\n\twidth: 100%;\n}\n\n.cn-text-widget__table th,\n.cn-text-widget__table td {\n\toverflow-wrap: break-word;\n\tvertical-align: top;\n}\n\n.cn-text-widget__cell-placeholder {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n}\n\n.cn-text-widget__link {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 2px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n\ttext-decoration: none;\n}\n\n.cn-text-widget__link:hover,\n.cn-text-widget__link:focus-visible {\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;;;AAyFA;AACA;AACA;AACA;AACA,MAAM,cAAa,GAAI,IAAI,MAAM,CAAC;AACjC,CAAA,GAAG,EAAE,IAAI;CACT,MAAM,EAAE,KAAK;AACd,CAAC,EAAA;;AAED;AACA;AACA;AACA;AACA,IAAI,cAAa,GAAI,MAAI;AACzB,SAAS,mBAAmB,GAAG;AAC9B,CAAA,IAAI,cAAc,EAAE;EACnB,MAAK;AACN,EAAA;CACA,SAAS,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC,IAAI,KAAK;AACtD,EAAA,IAAI,IAAI,CAAC,OAAM,KAAM,GAAE,IAAK,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAE,KAAI,QAAQ,EAAE;AACrE,GAAA,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,qBAAqB,EAAA;AAC/C,GAAA;EACA,EAAA;AACD,CAAA,cAAa,GAAI,KAAG;AACrB,CAAA;;AAEA;AACC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;;;;AAIA;AACA;;;;AAID,aAAe;AACd,CAAA,IAAI,EAAE,cAAc;;CAEpB,UAAU,EAAE,EAAE,YAAW,EAAG;;AAE5B,CAAA,MAAM,EAAE;AACP;AACA,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C;;AAED,CAAA,KAAK,EAAE;AACN;;AAEC;;;;;;;;AAQA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;;EAGD,UAAU,EAAE;GACX,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;EACD;;AAED,CAAA,QAAQ,EAAE;AACT;AACC;AACA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IAAI,EAAE;AACrB,GAAA,OAAO;IACN,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IAC3B,kBAAkB,EAAE,+BAA+B;AACnD,IAAA,aAAa,EAAE,MAAM;AACtB,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -72,21 +72,28 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
72
72
|
}), 128 /* KEYED_FRAGMENT */))
|
|
73
73
|
])
|
|
74
74
|
], 4 /* STYLE */))
|
|
75
|
-
: ($options.hasText)
|
|
76
|
-
? (openBlock(), createElementBlock("
|
|
75
|
+
: ($options.monospace && $options.hasText)
|
|
76
|
+
? (openBlock(), createElementBlock("pre", {
|
|
77
77
|
key: 1,
|
|
78
|
-
class:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
: (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
class: "cn-text-widget__mono",
|
|
79
|
+
"data-testid": "cn-text-widget-mono",
|
|
80
|
+
style: normalizeStyle($options.monoStyle)
|
|
81
|
+
}, toDisplayString($options.text), 5 /* TEXT, STYLE */))
|
|
82
|
+
: ($options.hasText)
|
|
83
|
+
? (openBlock(), createElementBlock("div", {
|
|
84
|
+
key: 2,
|
|
85
|
+
class: normalizeClass(["cn-text-widget__content", $options.contentClass]),
|
|
86
|
+
style: normalizeStyle($options.contentStyle),
|
|
87
|
+
innerHTML: $options.sanitizedHtml
|
|
88
|
+
}, null, 14 /* CLASS, STYLE, PROPS */, _hoisted_7))
|
|
89
|
+
: (openBlock(), createElementBlock("span", {
|
|
90
|
+
key: 3,
|
|
91
|
+
class: "cn-text-widget__placeholder",
|
|
92
|
+
style: normalizeStyle($options.contentStyle)
|
|
93
|
+
}, toDisplayString($options.placeholderText), 5 /* TEXT, STYLE */)),
|
|
87
94
|
($options.link)
|
|
88
95
|
? (openBlock(), createElementBlock("a", {
|
|
89
|
-
key:
|
|
96
|
+
key: 4,
|
|
90
97
|
class: "cn-text-widget__link",
|
|
91
98
|
"data-testid": "cn-text-widget-link",
|
|
92
99
|
href: $options.link.url,
|