@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.
Files changed (180) hide show
  1. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
  2. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +114 -11
  3. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
  4. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
  5. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
  6. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
  7. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
  8. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
  9. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
  10. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
  11. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
  12. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  13. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +257 -7
  14. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  15. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
  16. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  17. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
  18. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
  19. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
  20. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
  21. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
  22. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
  23. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
  24. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
  25. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
  26. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
  27. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
  28. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
  29. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
  30. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
  31. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
  32. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
  33. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
  34. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
  35. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
  36. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
  37. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
  38. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
  39. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +162 -9
  40. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
  41. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +63 -23
  42. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
  43. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
  44. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
  45. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
  46. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
  47. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
  48. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
  49. package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
  50. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
  51. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
  52. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
  53. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
  54. package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
  55. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
  56. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
  57. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
  58. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
  59. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
  60. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
  61. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
  62. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
  63. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
  64. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
  65. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
  66. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
  67. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
  68. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
  69. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
  70. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
  71. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
  72. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
  73. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
  74. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
  75. package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
  76. package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
  77. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
  78. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
  79. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
  80. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
  81. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
  82. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
  83. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
  84. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
  85. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
  86. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  87. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
  88. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  89. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
  90. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  91. package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
  92. package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
  93. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
  94. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
  95. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
  96. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
  97. package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
  98. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
  99. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
  100. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
  101. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
  102. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
  103. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
  104. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
  105. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
  106. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
  107. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
  108. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  109. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
  110. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  111. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
  112. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  113. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  114. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
  115. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  116. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
  117. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  118. package/dist/esm/index.js +8 -0
  119. package/dist/esm/index.js.map +1 -1
  120. package/dist/esm/l10n/en.json.js +63 -1
  121. package/dist/esm/l10n/en.json.js.map +1 -1
  122. package/dist/esm/l10n/nl.json.js +63 -1
  123. package/dist/esm/l10n/nl.json.js.map +1 -1
  124. package/dist/esm/library-style.js +1 -1
  125. package/dist/esm/nextcloud-vue.css +1134 -499
  126. package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
  127. package/dist/esm/utils/captureLocation.js +32 -0
  128. package/dist/esm/utils/captureLocation.js.map +1 -0
  129. package/dist/esm/utils/childRecordTotals.js +157 -0
  130. package/dist/esm/utils/childRecordTotals.js.map +1 -0
  131. package/dist/esm/utils/isoDuration.js +51 -1
  132. package/dist/esm/utils/isoDuration.js.map +1 -1
  133. package/dist/esm/utils/qr.js +649 -0
  134. package/dist/esm/utils/qr.js.map +1 -0
  135. package/dist/esm/utils/schema.js +3 -0
  136. package/dist/esm/utils/schema.js.map +1 -1
  137. package/dist/esm/utils/templateVariables.js +54 -0
  138. package/dist/esm/utils/templateVariables.js.map +1 -0
  139. package/dist/nextcloud-vue.cjs.js +20307 -14544
  140. package/dist/nextcloud-vue.cjs.js.map +2 -2
  141. package/dist/nextcloud-vue.css +1134 -499
  142. package/l10n/en.json +63 -1
  143. package/l10n/nl.json +63 -1
  144. package/package.json +1 -1
  145. package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
  146. package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
  147. package/src/components/CnBlockListEditor/index.js +9 -0
  148. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +311 -10
  149. package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
  150. package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
  151. package/src/components/CnChoiceMatrix/index.js +9 -0
  152. package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
  153. package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
  154. package/src/components/CnDataMatrix/CnDataMatrix.vue +199 -13
  155. package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
  156. package/src/components/CnDisplayScreen/index.js +9 -0
  157. package/src/components/CnDurationField/CnDurationField.vue +330 -5
  158. package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
  159. package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
  160. package/src/components/CnGeoCaptureField/index.js +9 -0
  161. package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
  162. package/src/components/CnQrCode/CnQrCode.vue +321 -0
  163. package/src/components/CnQrCode/index.js +9 -0
  164. package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
  165. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
  166. package/src/components/CnRevealField/CnRevealField.vue +273 -0
  167. package/src/components/CnRevealField/index.js +9 -0
  168. package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
  169. package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
  170. package/src/components/CnTransferCard/index.js +9 -0
  171. package/src/components/CnTreeView/CnTreeNode.vue +145 -2
  172. package/src/components/CnTreeView/CnTreeView.vue +210 -6
  173. package/src/components/index.js +7 -0
  174. package/src/index.js +8 -0
  175. package/src/utils/captureLocation.js +29 -0
  176. package/src/utils/childRecordTotals.js +153 -0
  177. package/src/utils/isoDuration.js +50 -0
  178. package/src/utils/qr.js +681 -0
  179. package/src/utils/schema.js +3 -0
  180. package/src/utils/templateVariables.js +51 -0
@@ -439,8 +439,24 @@
439
439
  </NcButton>
440
440
  </template>
441
441
  </template>
442
+ <span
443
+ v-if="item.tag === 'div' && item.rowActions.length > 0 && rowActionsInline"
444
+ class="cn-record-list__row-actions-inline"
445
+ data-testid="cn-record-list-row-actions-inline">
446
+ <NcButton
447
+ v-for="entry in item.rowActions"
448
+ :key="`row-action-${entry.index}`"
449
+ :variant="entry.action.variant || 'secondary'"
450
+ :href="entry.href || undefined"
451
+ :target="entry.external ? '_blank' : undefined"
452
+ :ariaLabel="fillRow(entry.action.ariaLabel, item.row) || undefined"
453
+ :data-testid="`cn-record-list-row-action-${entry.index}`"
454
+ @click="entry.href ? undefined : runRowActionEntry(entry.action, item.row)">
455
+ {{ entry.action.label }}
456
+ </NcButton>
457
+ </span>
442
458
  <NcActions
443
- v-if="item.tag === 'div' && item.rowActions.length > 0"
459
+ v-else-if="item.tag === 'div' && item.rowActions.length > 0"
444
460
  :aria-label="rowActionsLabel"
445
461
  data-testid="cn-record-list-row-actions">
446
462
  <template v-for="entry in item.rowActions" :key="`row-action-${entry.index}`">
@@ -1842,6 +1858,17 @@ export default {
1842
1858
  return this.content?.rowAction?.variant === 'outlined'
1843
1859
  },
1844
1860
 
1861
+ /**
1862
+ * Whether a row's actions are buttons on the row (`rowActionsInline`), as
1863
+ * board DqZaakBesluiten draws "Goedkeuren" and "Afwijzen", not a menu.
1864
+ *
1865
+ * @spec openspec/changes/record-list-inline-row-actions/specs/record-list-inline-row-actions/spec.md#requirement-row-actions-can-be-buttons-on-the-row
1866
+ * @return {boolean}
1867
+ */
1868
+ rowActionsInline() {
1869
+ return this.content?.rowActionsInline === true
1870
+ },
1871
+
1845
1872
  rowActionsHeader() {
1846
1873
  const own = this.content?.rowActionsHeader
1847
1874
  return typeof own === 'string' && own !== '' ? this.translate(own) : t('nextcloud-vue', 'Actions')
@@ -3408,6 +3435,12 @@ export default {
3408
3435
  </script>
3409
3436
 
3410
3437
  <style scoped>
3438
+ .cn-record-list__row-actions-inline {
3439
+ display: inline-flex;
3440
+ flex-wrap: wrap;
3441
+ gap: 8px;
3442
+ }
3443
+
3411
3444
  .cn-record-list__checklist-bar {
3412
3445
  height: 8px;
3413
3446
  margin-block-end: 16px;
@@ -0,0 +1,273 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ - SPDX-License-Identifier: EUPL-1.2
4
+ -->
5
+ <template>
6
+ <div class="cn-reveal-field" data-testid="cn-reveal-field">
7
+ <div class="cn-reveal-field__row">
8
+ <span :id="labelId" class="cn-reveal-field__label">{{ label }}</span>
9
+ <span
10
+ class="cn-reveal-field__value"
11
+ :class="{ 'cn-reveal-field__value--masked': !revealed }"
12
+ :aria-labelledby="labelId"
13
+ aria-live="polite"
14
+ data-testid="cn-reveal-value">{{ revealed ? revealedValue : maskedValue }}</span>
15
+ <NcButton
16
+ v-if="!askingReason"
17
+ variant="tertiary"
18
+ :aria-label="revealed ? t('nextcloud-vue', 'Hide {label}', { label }) : t('nextcloud-vue', 'Show {label}', { label })"
19
+ :disabled="loading"
20
+ data-testid="cn-reveal-toggle"
21
+ @click="toggle">
22
+ <template v-if="loading" #icon>
23
+ <NcLoadingIcon :size="20" />
24
+ </template>
25
+ {{ revealed ? t('nextcloud-vue', 'Hide') : t('nextcloud-vue', 'Show') }}
26
+ </NcButton>
27
+ </div>
28
+
29
+ <form
30
+ v-if="askingReason"
31
+ class="cn-reveal-field__reason"
32
+ data-testid="cn-reveal-reason"
33
+ @submit.prevent="submitReason">
34
+ <NcTextField
35
+ ref="reasonField"
36
+ :modelValue="reason"
37
+ :label="reasonLabel || t('nextcloud-vue', 'Why do you need to see this?')"
38
+ required
39
+ data-testid="cn-reveal-reason-input"
40
+ @update:modelValue="reason = $event" />
41
+ <div class="cn-reveal-field__reason-actions">
42
+ <NcButton variant="tertiary" data-testid="cn-reveal-reason-cancel" @click="cancelReason">
43
+ {{ t('nextcloud-vue', 'Cancel') }}
44
+ </NcButton>
45
+ <NcButton
46
+ type="submit"
47
+ variant="primary"
48
+ :disabled="reason.trim() === '' || loading"
49
+ data-testid="cn-reveal-reason-submit">
50
+ {{ t('nextcloud-vue', 'Show') }}
51
+ </NcButton>
52
+ </div>
53
+ </form>
54
+
55
+ <p v-if="error"
56
+ class="cn-reveal-field__error"
57
+ role="alert"
58
+ data-testid="cn-reveal-error">
59
+ {{ error }}
60
+ </p>
61
+ <p v-if="note" class="cn-reveal-field__note" data-testid="cn-reveal-note">
62
+ {{ note }}
63
+ </p>
64
+ </div>
65
+ </template>
66
+
67
+ <script>
68
+ import { translate as t } from '@nextcloud/l10n'
69
+ import { NcButton, NcLoadingIcon, NcTextField } from '@nextcloud/vue'
70
+
71
+ let uid = 0
72
+
73
+ /**
74
+ * CnRevealField — a protected value shown masked until the user asks to see
75
+ * it (board DqContact: "BSN *****4001 Tonen", "Het tonen van het BSN wordt
76
+ * gelogd.").
77
+ *
78
+ * The component never holds the value until the user asks: `load` fetches it
79
+ * on every reveal, so the server can log each viewing. With `requireReason`
80
+ * the user first states why, and `load` receives that reason. Hide masks the
81
+ * value again and drops it; the next Show calls `load` again.
82
+ *
83
+ * ```vue
84
+ * <CnRevealField
85
+ * label="BSN"
86
+ * masked-value="*****4001"
87
+ * :load="(reason) => api.revealBsn(person.id, reason)"
88
+ * require-reason
89
+ * note="Het tonen van het BSN wordt gelogd." />
90
+ * ```
91
+ *
92
+ * @event revealed Emitted once the value shows, with `{ reason }`.
93
+ * @event hidden Emitted when the user masks the value again.
94
+ */
95
+ export default {
96
+ name: 'CnRevealField',
97
+
98
+ components: {
99
+ NcButton,
100
+ NcLoadingIcon,
101
+ NcTextField,
102
+ },
103
+
104
+ props: {
105
+ /** What the value is, already translated ("BSN"). */
106
+ label: { type: String, required: true },
107
+ /** What shows while the value is hidden, such as the last digits behind stars. */
108
+ maskedValue: { type: String, default: '••••••' },
109
+ /**
110
+ * Fetches the value: `(reason) => string | Promise<string>`. Called on
111
+ * every reveal; `reason` is '' unless `requireReason` is set.
112
+ */
113
+ load: { type: Function, required: true },
114
+ /** Ask why the user needs the value before it is fetched. */
115
+ requireReason: { type: Boolean, default: false },
116
+ /** Label of the reason field, already translated; the library default is "Why do you need to see this?". */
117
+ reasonLabel: { type: String, default: '' },
118
+ /** A line under the value, already translated, such as that showing it is logged. */
119
+ note: { type: String, default: '' },
120
+ },
121
+
122
+ emits: ['revealed', 'hidden'],
123
+
124
+ data() {
125
+ uid += 1
126
+ return {
127
+ labelId: `cn-reveal-field-${uid}`,
128
+ revealed: false,
129
+ revealedValue: '',
130
+ askingReason: false,
131
+ reason: '',
132
+ loading: false,
133
+ error: '',
134
+ }
135
+ },
136
+
137
+ methods: {
138
+ t,
139
+
140
+ /**
141
+ * Show or hide the value. Showing asks the reason first when
142
+ * `requireReason` is set.
143
+ *
144
+ * @return {Promise<void>|void}
145
+ */
146
+ toggle() {
147
+ if (this.revealed) {
148
+ this.hide()
149
+ return undefined
150
+ }
151
+ if (this.requireReason) {
152
+ this.askingReason = true
153
+ this.error = ''
154
+ this.$nextTick(() => this.$refs.reasonField?.focus?.())
155
+ return undefined
156
+ }
157
+ return this.reveal('')
158
+ },
159
+
160
+ /**
161
+ * Reveal with the typed reason.
162
+ *
163
+ * @return {Promise<void>|void}
164
+ */
165
+ submitReason() {
166
+ const reason = this.reason.trim()
167
+ if (reason === '') {
168
+ return undefined
169
+ }
170
+ return this.reveal(reason)
171
+ },
172
+
173
+ /**
174
+ * Close the reason form without fetching.
175
+ *
176
+ * @return {void}
177
+ */
178
+ cancelReason() {
179
+ this.askingReason = false
180
+ this.reason = ''
181
+ },
182
+
183
+ /**
184
+ * Fetch the value through `load` and show it; a failure keeps the
185
+ * value masked and says so.
186
+ *
187
+ * @param {string} reason Why the user asked, or ''.
188
+ * @return {Promise<void>}
189
+ */
190
+ async reveal(reason) {
191
+ this.loading = true
192
+ this.error = ''
193
+ try {
194
+ const value = await this.load(reason)
195
+ if (value === null || value === undefined || value === '') {
196
+ throw new Error('empty')
197
+ }
198
+ this.revealedValue = String(value)
199
+ this.revealed = true
200
+ this.askingReason = false
201
+ this.reason = ''
202
+ this.$emit('revealed', { reason })
203
+ } catch {
204
+ this.error = t('nextcloud-vue', 'The value could not be shown. Try again later.')
205
+ } finally {
206
+ this.loading = false
207
+ }
208
+ },
209
+
210
+ /**
211
+ * Mask the value again and drop it.
212
+ *
213
+ * @return {void}
214
+ */
215
+ hide() {
216
+ this.revealed = false
217
+ this.revealedValue = ''
218
+ this.$emit('hidden')
219
+ },
220
+ },
221
+ }
222
+ </script>
223
+
224
+ <style scoped>
225
+ .cn-reveal-field {
226
+ display: flex;
227
+ flex-direction: column;
228
+ gap: 6px;
229
+ }
230
+
231
+ .cn-reveal-field__row {
232
+ align-items: center;
233
+ display: flex;
234
+ flex-wrap: wrap;
235
+ gap: 4px 12px;
236
+ }
237
+
238
+ .cn-reveal-field__label {
239
+ color: var(--color-text-maxcontrast);
240
+ }
241
+
242
+ .cn-reveal-field__value {
243
+ font-variant-numeric: tabular-nums;
244
+ font-weight: 500;
245
+ }
246
+
247
+ .cn-reveal-field__value--masked {
248
+ letter-spacing: 0.08em;
249
+ }
250
+
251
+ .cn-reveal-field__reason {
252
+ display: flex;
253
+ flex-direction: column;
254
+ gap: 8px;
255
+ }
256
+
257
+ .cn-reveal-field__reason-actions {
258
+ display: flex;
259
+ gap: 8px;
260
+ justify-content: flex-end;
261
+ }
262
+
263
+ .cn-reveal-field__error {
264
+ color: var(--color-error-text, var(--color-error));
265
+ margin: 0;
266
+ }
267
+
268
+ .cn-reveal-field__note {
269
+ color: var(--color-text-maxcontrast);
270
+ font-size: 0.9em;
271
+ margin: 0;
272
+ }
273
+ </style>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+
6
+ import CnRevealField from './CnRevealField.vue'
7
+
8
+ export { CnRevealField }
9
+ export default CnRevealField
@@ -48,6 +48,11 @@
48
48
  </tr>
49
49
  </tbody>
50
50
  </table>
51
+ <pre
52
+ v-else-if="monospace && hasText"
53
+ class="cn-text-widget__mono"
54
+ data-testid="cn-text-widget-mono"
55
+ :style="monoStyle">{{ text }}</pre>
51
56
  <div
52
57
  v-else-if="hasText"
53
58
  class="cn-text-widget__content"
@@ -127,6 +132,11 @@ function ensureDomPurifyHook() {
127
132
  * attributes. Merge-swallowed cells are hidden via `v-show` so the visual
128
133
  * grid stays rectangular.
129
134
  *
135
+ * With `monospace: true` the text is shown as typed, in a fixed-width font
136
+ * with its spaces and line breaks kept, and is never parsed as HTML or
137
+ * markdown: a receipt or a log line. `textField` reads the text from that
138
+ * field of the detail page's object instead of `text`.
139
+ *
130
140
  * Registered as the `text` dashboard widget type via the renderer's
131
141
  * `index.js`.
132
142
  */
@@ -143,26 +153,61 @@ export default {
143
153
  props: {
144
154
  /**
145
155
  * Persisted widget content blob: `{text, fontSize, color,
146
- * backgroundColor, textAlign, contentMode, tableMode, tableData, link}`.
156
+ * backgroundColor, textAlign, contentMode, tableMode, tableData, link,
157
+ * monospace, textField}`.
147
158
  * All keys are optional; missing keys collapse to documented defaults.
148
159
  * `text` and `link.label` go through the app's translate function.
149
160
  * `link` is `{label, route}` (a page id, or a path starting with `/`) or
150
161
  * `{label, href}` (an external URL), drawn under the text.
162
+ * `monospace` shows the text as typed in a fixed-width font;
163
+ * `textField` reads the text from that field of `objectData`.
151
164
  *
152
- * @type {{text: string, fontSize: string, color: string, backgroundColor: string, textAlign: string, contentMode: string, tableMode: boolean, tableData: object, link: {label: string, route: string, href: string}}}
165
+ * @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}}
153
166
  */
154
167
  content: {
155
168
  type: Object,
156
169
  default: () => ({}),
157
170
  },
171
+
172
+ /** The detail page's object, which `content.textField` reads from. */
173
+ objectData: {
174
+ type: Object,
175
+ default: null,
176
+ },
158
177
  },
159
178
 
160
179
  computed: {
161
- /** The author text through the app's translate function, or '' when absent / non-string. */
180
+ /**
181
+ * The text: `content.textField` of the object as it is, else `content.text` translated; '' when absent.
182
+ *
183
+ * @spec openspec/changes/text-widget-monospace/tasks.md#task-2
184
+ */
162
185
  text() {
186
+ const field = this.content?.textField
187
+ if (typeof field === 'string' && field !== '') {
188
+ const value = this.objectData?.[field]
189
+ return value === undefined || value === null ? '' : String(value)
190
+ }
163
191
  return typeof this.content?.text === 'string' ? this.tr(this.content.text) : ''
164
192
  },
165
193
 
194
+ /**
195
+ * Whether the text shows as typed, in a fixed-width font.
196
+ *
197
+ * @spec openspec/changes/text-widget-monospace/tasks.md#task-1
198
+ */
199
+ monospace() {
200
+ return this.content?.monospace === true
201
+ },
202
+
203
+ /** Inline style for the fixed-width text. */
204
+ monoStyle() {
205
+ return {
206
+ 'font-size': this.fontSize,
207
+ color: this.color,
208
+ }
209
+ },
210
+
166
211
  /**
167
212
  * The link under the text, from `content.link`: `{ label, route }`
168
213
  * (a page id, or a router path when it starts with `/`) or
@@ -438,6 +483,20 @@ export default {
438
483
  }
439
484
 
440
485
  .cn-text-widget__content,
486
+ .cn-text-widget__mono {
487
+ width: 100%;
488
+ margin: 0;
489
+ padding: 12px;
490
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
491
+ line-height: 1.4;
492
+ white-space: pre-wrap;
493
+ overflow-wrap: anywhere;
494
+ text-align: start;
495
+ background: var(--color-background-dark);
496
+ border: 1px solid var(--color-border);
497
+ border-radius: var(--border-radius);
498
+ }
499
+
441
500
  .cn-text-widget__placeholder {
442
501
  /* Safety net — ensures long URLs / words inside the sanitised HTML wrap
443
502
  rather than overflowing horizontally. */
@@ -0,0 +1,205 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ - SPDX-License-Identifier: EUPL-1.2
4
+ -->
5
+ <template>
6
+ <section class="cn-transfer-card" data-testid="cn-transfer-card">
7
+ <header v-if="title || subtitle" class="cn-transfer-card__header">
8
+ <h3 v-if="title" class="cn-transfer-card__title">
9
+ {{ title }}
10
+ </h3>
11
+ <span v-if="subtitle" class="cn-transfer-card__muted">{{ subtitle }}</span>
12
+ </header>
13
+
14
+ <div class="cn-transfer-card__progress">
15
+ <span class="cn-transfer-card__line">
16
+ <strong data-testid="cn-transfer-amount">{{ amountText }}</strong>
17
+ <span v-if="remainingText && !paused" class="cn-transfer-card__muted" data-testid="cn-transfer-remaining">{{ remainingText }}</span>
18
+ </span>
19
+ <NcProgressBar
20
+ :value="percent"
21
+ :aria-label="amountText"
22
+ data-testid="cn-transfer-bar" />
23
+ <span v-if="hint" class="cn-transfer-card__muted" data-testid="cn-transfer-hint">{{ hint }}</span>
24
+ </div>
25
+
26
+ <p v-if="paused"
27
+ class="cn-transfer-card__paused"
28
+ role="status"
29
+ data-testid="cn-transfer-paused">
30
+ {{ pausedText || t('nextcloud-vue', 'The connection dropped. It carries on from where it stopped.') }}
31
+ </p>
32
+
33
+ <ul v-if="items.length > 0" class="cn-transfer-card__items">
34
+ <li v-for="item in items"
35
+ :key="item.id ?? item.label"
36
+ class="cn-transfer-card__item"
37
+ data-testid="cn-transfer-item">
38
+ <span>{{ item.label }}</span>
39
+ <span class="cn-transfer-card__muted">{{ item.state }}</span>
40
+ </li>
41
+ </ul>
42
+
43
+ <div v-if="paused || $slots.actions" class="cn-transfer-card__actions">
44
+ <NcButton v-if="paused"
45
+ variant="primary"
46
+ data-testid="cn-transfer-resume"
47
+ @click="$emit('resume')">
48
+ {{ resumeLabel || t('nextcloud-vue', 'Resume') }}
49
+ </NcButton>
50
+ <!-- @slot actions Further buttons under the card. -->
51
+ <slot name="actions" />
52
+ </div>
53
+
54
+ <p v-if="note" class="cn-transfer-card__muted cn-transfer-card__note" data-testid="cn-transfer-note">
55
+ {{ note }}
56
+ </p>
57
+ </section>
58
+ </template>
59
+
60
+ <script>
61
+ import { translate as t } from '@nextcloud/l10n'
62
+ import { NcButton, NcProgressBar } from '@nextcloud/vue'
63
+
64
+ /**
65
+ * CnTransferCard: a transfer that takes a while, such as taking a day's work
66
+ * offline (board DqInspectie "Dag synchroniseren": "32 MB van 48 MB gedownload",
67
+ * "nog ca. 6 minuten", a row per part, and resuming after a dropped connection).
68
+ *
69
+ * The host owns the transfer and passes where it stands. The card holds no
70
+ * state, so the same card serves a download, an upload or a sync.
71
+ *
72
+ * ```vue
73
+ * <CnTransferCard
74
+ * title="Sync the day"
75
+ * :done="32"
76
+ * :total="48"
77
+ * unit="MB"
78
+ * remaining-text="about 6 minutes left"
79
+ * :items="[{ id: 'cases', label: 'Cases of 4 addresses', state: 'Done' }]"
80
+ * @resume="resume" />
81
+ * ```
82
+ *
83
+ * @event resume The user pressed Resume on a paused transfer.
84
+ * @spec openspec/changes/transfer-card/specs/transfer-card/spec.md
85
+ */
86
+ export default {
87
+ name: 'CnTransferCard',
88
+
89
+ components: { NcButton, NcProgressBar },
90
+
91
+ props: {
92
+ /** Title, already translated. */
93
+ title: { type: String, default: '' },
94
+ /** A line under the title, already translated. */
95
+ subtitle: { type: String, default: '' },
96
+ /** How much has been transferred. */
97
+ done: { type: Number, default: 0 },
98
+ /** How much there is in total. */
99
+ total: { type: Number, default: 0 },
100
+ /** The unit of `done` and `total`, such as "MB". */
101
+ unit: { type: String, default: '' },
102
+ /** The amount line, already translated, with `{done}`, `{total}` and `{unit}`; the library default is "{done} {unit} of {total} {unit}". */
103
+ amountTemplate: { type: String, default: '' },
104
+ /** How long it will still take, already translated. */
105
+ remainingText: { type: String, default: '' },
106
+ /** A line under the bar, already translated. */
107
+ hint: { type: String, default: '' },
108
+ /** The parts: `{ id?, label, state }`, both already translated. */
109
+ items: { type: Array, default: () => [] },
110
+ /** The transfer stopped and can carry on. */
111
+ paused: { type: Boolean, default: false },
112
+ /** Says why it stopped, already translated. */
113
+ pausedText: { type: String, default: '' },
114
+ /** Label of the Resume button, already translated. */
115
+ resumeLabel: { type: String, default: '' },
116
+ /** A line at the end of the card, already translated. */
117
+ note: { type: String, default: '' },
118
+ },
119
+
120
+ emits: ['resume'],
121
+
122
+ computed: {
123
+ /** @return {number} Progress in percent, from 0 to 100; 0 with no total. */
124
+ percent() {
125
+ if (!(this.total > 0)) {
126
+ return 0
127
+ }
128
+ return Math.min(100, Math.max(0, Math.round((this.done / this.total) * 100)))
129
+ },
130
+
131
+ /** @return {string} The amount in words. */
132
+ amountText() {
133
+ const values = { done: String(this.done), total: String(this.total), unit: this.unit }
134
+ if (this.amountTemplate) {
135
+ return this.amountTemplate.replace(/\{(done|total|unit)\}/g, (match, key) => values[key])
136
+ }
137
+ return t('nextcloud-vue', '{done} {unit} of {total} {unit}', values)
138
+ },
139
+ },
140
+
141
+ methods: {
142
+ t,
143
+ },
144
+ }
145
+ </script>
146
+
147
+ <style scoped>
148
+ .cn-transfer-card {
149
+ background: var(--color-main-background);
150
+ border: 1px solid var(--color-border);
151
+ border-radius: var(--border-radius-large);
152
+ display: flex;
153
+ flex-direction: column;
154
+ gap: 12px;
155
+ padding: 16px 20px;
156
+ }
157
+
158
+ .cn-transfer-card__header,
159
+ .cn-transfer-card__progress {
160
+ display: flex;
161
+ flex-direction: column;
162
+ gap: 4px;
163
+ }
164
+
165
+ .cn-transfer-card__title {
166
+ font-size: 1.1em;
167
+ margin: 0;
168
+ }
169
+
170
+ .cn-transfer-card__muted {
171
+ color: var(--color-text-maxcontrast);
172
+ }
173
+
174
+ .cn-transfer-card__line,
175
+ .cn-transfer-card__item {
176
+ display: flex;
177
+ flex-wrap: wrap;
178
+ gap: 4px 12px;
179
+ justify-content: space-between;
180
+ }
181
+
182
+ .cn-transfer-card__paused,
183
+ .cn-transfer-card__note {
184
+ margin: 0;
185
+ }
186
+
187
+ .cn-transfer-card__items {
188
+ display: flex;
189
+ flex-direction: column;
190
+ list-style: none;
191
+ margin: 0;
192
+ padding: 0;
193
+ }
194
+
195
+ .cn-transfer-card__item {
196
+ border-top: 1px solid var(--color-border);
197
+ padding: 8px 0;
198
+ }
199
+
200
+ .cn-transfer-card__actions {
201
+ display: flex;
202
+ flex-wrap: wrap;
203
+ gap: 8px;
204
+ }
205
+ </style>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+
6
+ import CnTransferCard from './CnTransferCard.vue'
7
+
8
+ export { CnTransferCard }
9
+ export default CnTransferCard