@conduction/nextcloud-vue 2.174.0 → 2.176.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) 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 +323 -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 +255 -10
  40. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
  41. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
  42. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
  43. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
  44. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  45. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  46. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
  47. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
  48. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
  49. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
  50. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
  51. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
  52. package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
  53. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
  54. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
  55. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
  56. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
  57. package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
  58. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
  59. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
  60. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
  61. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
  62. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
  63. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
  64. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
  65. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
  66. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
  67. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
  68. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  69. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  70. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
  71. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
  72. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
  73. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
  74. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
  75. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
  76. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
  77. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
  78. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
  79. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
  80. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
  81. package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
  82. package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
  83. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
  84. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
  85. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
  86. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
  87. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
  88. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
  89. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
  90. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
  91. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
  92. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  93. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
  94. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  95. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
  96. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  97. package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
  98. package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
  99. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
  100. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
  101. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
  102. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
  103. package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
  104. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
  105. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
  106. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
  107. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
  108. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
  109. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
  110. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
  111. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
  112. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
  113. package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
  114. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
  115. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
  116. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
  117. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
  118. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
  119. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
  120. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
  121. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
  122. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
  123. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
  124. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  125. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
  126. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  127. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
  128. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  129. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  130. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
  131. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  132. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
  133. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  134. package/dist/esm/index.js +8 -0
  135. package/dist/esm/index.js.map +1 -1
  136. package/dist/esm/l10n/en.json.js +79 -14
  137. package/dist/esm/l10n/en.json.js.map +1 -1
  138. package/dist/esm/l10n/nl.json.js +79 -14
  139. package/dist/esm/l10n/nl.json.js.map +1 -1
  140. package/dist/esm/library-style.js +1 -1
  141. package/dist/esm/nextcloud-vue.css +1162 -523
  142. package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
  143. package/dist/esm/utils/captureLocation.js +32 -0
  144. package/dist/esm/utils/captureLocation.js.map +1 -0
  145. package/dist/esm/utils/childRecordTotals.js +157 -0
  146. package/dist/esm/utils/childRecordTotals.js.map +1 -0
  147. package/dist/esm/utils/isoDuration.js +51 -1
  148. package/dist/esm/utils/isoDuration.js.map +1 -1
  149. package/dist/esm/utils/parentCrumb.js +86 -0
  150. package/dist/esm/utils/parentCrumb.js.map +1 -0
  151. package/dist/esm/utils/qr.js +649 -0
  152. package/dist/esm/utils/qr.js.map +1 -0
  153. package/dist/esm/utils/schema.js +3 -0
  154. package/dist/esm/utils/schema.js.map +1 -1
  155. package/dist/esm/utils/templateVariables.js +54 -0
  156. package/dist/esm/utils/templateVariables.js.map +1 -0
  157. package/dist/nextcloud-vue.cjs.js +21125 -15025
  158. package/dist/nextcloud-vue.cjs.js.map +2 -2
  159. package/dist/nextcloud-vue.css +1162 -523
  160. package/l10n/en.json +79 -14
  161. package/l10n/nl.json +79 -14
  162. package/package.json +1 -1
  163. package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
  164. package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
  165. package/src/components/CnBlockListEditor/index.js +9 -0
  166. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
  167. package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
  168. package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
  169. package/src/components/CnChoiceMatrix/index.js +9 -0
  170. package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
  171. package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
  172. package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
  173. package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
  174. package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
  175. package/src/components/CnDisplayScreen/index.js +9 -0
  176. package/src/components/CnDurationField/CnDurationField.vue +330 -5
  177. package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
  178. package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
  179. package/src/components/CnGeoCaptureField/index.js +9 -0
  180. package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
  181. package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
  182. package/src/components/CnQrCode/CnQrCode.vue +321 -0
  183. package/src/components/CnQrCode/index.js +9 -0
  184. package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
  185. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
  186. package/src/components/CnRevealField/CnRevealField.vue +273 -0
  187. package/src/components/CnRevealField/index.js +9 -0
  188. package/src/components/CnStorePage/CnStorePage.vue +8 -8
  189. package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
  190. package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
  191. package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
  192. package/src/components/CnTransferCard/index.js +9 -0
  193. package/src/components/CnTreeView/CnTreeNode.vue +145 -2
  194. package/src/components/CnTreeView/CnTreeView.vue +210 -6
  195. package/src/components/index.js +7 -0
  196. package/src/index.js +8 -0
  197. package/src/utils/captureLocation.js +29 -0
  198. package/src/utils/childRecordTotals.js +153 -0
  199. package/src/utils/isoDuration.js +50 -0
  200. package/src/utils/parentCrumb.js +83 -0
  201. package/src/utils/qr.js +681 -0
  202. package/src/utils/schema.js +3 -0
  203. package/src/utils/templateVariables.js +51 -0
@@ -0,0 +1,308 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ - SPDX-License-Identifier: EUPL-1.2
4
+ -->
5
+ <template>
6
+ <Teleport to="body" :disabled="!overlay">
7
+ <NcThemeProvider :dark="dark" :class="rootClasses" data-testid="cn-display-screen">
8
+ <component :is="overlay ? 'section' : 'main'"
9
+ ref="screen"
10
+ class="cn-display-screen__page"
11
+ :role="overlay ? 'dialog' : undefined"
12
+ :aria-modal="overlay ? 'true' : undefined"
13
+ :aria-label="overlay ? title : undefined"
14
+ :tabindex="overlay ? -1 : undefined"
15
+ @keydown.esc="onEscape">
16
+ <header class="cn-display-screen__header">
17
+ <div class="cn-display-screen__titles">
18
+ <span v-if="subtitle" class="cn-display-screen__muted" data-testid="cn-display-subtitle">{{ subtitle }}</span>
19
+ <h1 class="cn-display-screen__title">
20
+ {{ title }}
21
+ </h1>
22
+ </div>
23
+ <div v-if="clock || updatedText" class="cn-display-screen__time">
24
+ <span v-if="clock" class="cn-display-screen__clock" data-testid="cn-display-clock">{{ clockText }}</span>
25
+ <span v-if="updatedText" class="cn-display-screen__muted" data-testid="cn-display-updated">{{ updatedText }}</span>
26
+ </div>
27
+ </header>
28
+
29
+ <p v-if="stale"
30
+ class="cn-display-screen__stale"
31
+ role="status"
32
+ data-testid="cn-display-stale">
33
+ {{ staleMessage }}
34
+ </p>
35
+
36
+ <div class="cn-display-screen__body">
37
+ <!-- @slot default The rows of the screen. -->
38
+ <slot />
39
+ </div>
40
+
41
+ <footer v-if="footer || $slots.footer || $slots.actions" class="cn-display-screen__footer">
42
+ <!-- @slot footer The bottom line of the screen; replaces `footer`. -->
43
+ <slot name="footer">
44
+ <span class="cn-display-screen__muted" data-testid="cn-display-footer">{{ footer }}</span>
45
+ </slot>
46
+ <span v-if="$slots.actions" class="cn-display-screen__actions">
47
+ <!-- @slot actions Buttons at the end of the bottom line. -->
48
+ <slot name="actions" />
49
+ </span>
50
+ </footer>
51
+ </component>
52
+ </NcThemeProvider>
53
+ </Teleport>
54
+ </template>
55
+
56
+ <script>
57
+ import { translate as t } from '@nextcloud/l10n'
58
+ import { NcThemeProvider } from '@nextcloud/vue'
59
+ import { formatTimeOfDay } from '../../utils/boardDate.js'
60
+ import { parseDateValue } from '../../utils/dateVariant.js'
61
+
62
+ const TICK_MS = 1000
63
+
64
+ /**
65
+ * CnDisplayScreen: a full page without a menu, read from a distance on a hall
66
+ * screen or a classroom board (boards LqInfoscherm "Infoscherm bij de aula", LqLes
67
+ * "Zelf inchecken, op het bord").
68
+ *
69
+ * A title, a clock, when the content was last updated, the host's rows and a
70
+ * bottom line. The host owns the content and its refresh, and sets `stale` when a
71
+ * refresh failed. With `overlay` the screen covers the whole app: the rest of the
72
+ * page goes inert, Escape emits `close`, and focus returns on unmount.
73
+ *
74
+ * ```vue
75
+ * <CnDisplayScreen title="Today" clock dark footer="No names, no reasons." :updated-at="updatedAt" :stale="failed">
76
+ * <CnDataTable :rows="rows" />
77
+ * </CnDisplayScreen>
78
+ * ```
79
+ *
80
+ * @event close The user pressed Escape on an overlay.
81
+ * @spec openspec/changes/display-screen/specs/display-screen/spec.md
82
+ */
83
+ export default {
84
+ name: 'CnDisplayScreen',
85
+
86
+ components: { NcThemeProvider },
87
+
88
+ props: {
89
+ /** The heading, already translated. */
90
+ title: { type: String, required: true },
91
+ /** A line over the title, already translated. */
92
+ subtitle: { type: String, default: '' },
93
+ /** Show a clock that keeps time. */
94
+ clock: { type: Boolean, default: false },
95
+ /** When the content was last updated: an ISO string, a Date or a timestamp. */
96
+ updatedAt: { type: [String, Number, Date], default: '' },
97
+ /** The update line, already translated, with `{time}`. */
98
+ updatedTemplate: { type: String, default: '' },
99
+ /** The content could not be refreshed and shows what it last had. */
100
+ stale: { type: Boolean, default: false },
101
+ /** Says the content is old, already translated, with `{time}`. */
102
+ staleText: { type: String, default: '' },
103
+ /** The bottom line, already translated. */
104
+ footer: { type: String, default: '' },
105
+ /** Use the dark theme, whatever the user's theme is. */
106
+ dark: { type: Boolean, default: false },
107
+ /** Cover the whole app. */
108
+ overlay: { type: Boolean, default: false },
109
+ },
110
+
111
+ emits: ['close'],
112
+
113
+ data() {
114
+ return {
115
+ now: new Date(),
116
+ timer: null,
117
+ inerted: [],
118
+ returnFocusTo: null,
119
+ }
120
+ },
121
+
122
+ computed: {
123
+ /** @return {object} The classes of the outer element. */
124
+ rootClasses() {
125
+ return { 'cn-display-screen': true, 'cn-display-screen--overlay': this.overlay }
126
+ },
127
+
128
+ /** @return {string} The clock. */
129
+ clockText() {
130
+ return formatTimeOfDay(this.now)
131
+ },
132
+
133
+ /** @return {string} The time of the last update, or '' without one. */
134
+ updatedTime() {
135
+ const date = parseDateValue(this.updatedAt)
136
+ return date ? formatTimeOfDay(date) : ''
137
+ },
138
+
139
+ /** @return {string} The update line. */
140
+ updatedText() {
141
+ if (!this.updatedTime) {
142
+ return ''
143
+ }
144
+ if (this.updatedTemplate) {
145
+ return this.updatedTemplate.replace('{time}', this.updatedTime)
146
+ }
147
+ return t('nextcloud-vue', 'updated at {time}', { time: this.updatedTime })
148
+ },
149
+
150
+ /** @return {string} What the stale line says. */
151
+ staleMessage() {
152
+ if (this.staleText) {
153
+ return this.staleText.replace('{time}', this.updatedTime)
154
+ }
155
+ return this.updatedTime
156
+ ? t('nextcloud-vue', 'Cannot reach the server. This shows what it knew at {time}.', { time: this.updatedTime })
157
+ : t('nextcloud-vue', 'Cannot reach the server. This may be out of date.')
158
+ },
159
+ },
160
+
161
+ watch: {
162
+ clock() {
163
+ this.startClock()
164
+ },
165
+
166
+ overlay(on) {
167
+ if (on) {
168
+ this.$nextTick(this.enterOverlay)
169
+ } else {
170
+ this.leaveOverlay()
171
+ }
172
+ },
173
+ },
174
+
175
+ mounted() {
176
+ this.startClock()
177
+ if (this.overlay) {
178
+ this.enterOverlay()
179
+ }
180
+ },
181
+
182
+ beforeUnmount() {
183
+ clearInterval(this.timer)
184
+ this.leaveOverlay()
185
+ },
186
+
187
+ methods: {
188
+ /** Keep the clock on time while it shows. */
189
+ startClock() {
190
+ clearInterval(this.timer)
191
+ this.timer = null
192
+ if (this.clock) {
193
+ this.now = new Date()
194
+ this.timer = setInterval(() => {
195
+ this.now = new Date()
196
+ }, TICK_MS)
197
+ }
198
+ },
199
+
200
+ /** Make the rest of the page inert and take focus. */
201
+ enterOverlay() {
202
+ const root = this.$refs.screen?.closest('.cn-display-screen')
203
+ this.returnFocusTo = document.activeElement
204
+ this.inerted = [...document.body.children].filter((element) => element !== root && !element.inert)
205
+ this.inerted.forEach((element) => {
206
+ element.inert = true
207
+ })
208
+ this.$refs.screen?.focus()
209
+ },
210
+
211
+ /** Give the rest of the page and the focus back. */
212
+ leaveOverlay() {
213
+ this.inerted.forEach((element) => {
214
+ element.inert = false
215
+ })
216
+ this.inerted = []
217
+ this.returnFocusTo?.focus?.()
218
+ this.returnFocusTo = null
219
+ },
220
+
221
+ /** Ask the host to close an overlay. */
222
+ onEscape() {
223
+ if (this.overlay) {
224
+ this.$emit('close')
225
+ }
226
+ },
227
+ },
228
+ }
229
+ </script>
230
+
231
+ <style scoped>
232
+ .cn-display-screen {
233
+ background: var(--color-main-background);
234
+ color: var(--color-main-text);
235
+ }
236
+
237
+ .cn-display-screen--overlay {
238
+ inset: 0;
239
+ overflow: auto;
240
+ position: fixed;
241
+ z-index: 10000;
242
+ }
243
+
244
+ .cn-display-screen__page {
245
+ display: flex;
246
+ flex-direction: column;
247
+ font-size: 1.6rem;
248
+ gap: 16px;
249
+ min-height: 100vh;
250
+ outline: none;
251
+ padding: 24px 32px;
252
+ }
253
+
254
+ .cn-display-screen__header,
255
+ .cn-display-screen__footer {
256
+ align-items: flex-end;
257
+ display: flex;
258
+ flex-wrap: wrap;
259
+ gap: 8px 24px;
260
+ justify-content: space-between;
261
+ }
262
+
263
+ .cn-display-screen__titles,
264
+ .cn-display-screen__time {
265
+ display: flex;
266
+ flex-direction: column;
267
+ gap: 4px;
268
+ }
269
+
270
+ .cn-display-screen__time {
271
+ align-items: flex-end;
272
+ }
273
+
274
+ .cn-display-screen__title {
275
+ font-size: 1.6em;
276
+ font-weight: 700;
277
+ margin: 0;
278
+ }
279
+
280
+ .cn-display-screen__clock {
281
+ font-size: 2.2em;
282
+ font-variant-numeric: tabular-nums;
283
+ font-weight: 700;
284
+ line-height: 1;
285
+ }
286
+
287
+ .cn-display-screen__muted {
288
+ color: var(--color-text-maxcontrast);
289
+ }
290
+
291
+ .cn-display-screen__stale {
292
+ background: var(--color-background-hover);
293
+ border-inline-start: 6px solid var(--color-warning);
294
+ margin: 0;
295
+ padding: 8px 12px;
296
+ }
297
+
298
+ .cn-display-screen__body {
299
+ flex: 1 1 auto;
300
+ min-height: 0;
301
+ }
302
+
303
+ .cn-display-screen__actions {
304
+ display: flex;
305
+ flex-wrap: wrap;
306
+ gap: 8px;
307
+ }
308
+ </style>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ * SPDX-License-Identifier: EUPL-1.2
4
+ */
5
+
6
+ import CnDisplayScreen from './CnDisplayScreen.vue'
7
+
8
+ export { CnDisplayScreen }
9
+ export default CnDisplayScreen
@@ -4,7 +4,49 @@
4
4
  -->
5
5
  <template>
6
6
  <div class="cn-duration-field">
7
- <div v-if="!rawMode" class="cn-duration-field__row">
7
+ <div v-if="timer" class="cn-duration-field__row cn-duration-field__row--timer">
8
+ <NcTextField
9
+ class="cn-duration-field__clock"
10
+ :label="inputLabel"
11
+ :modelValue="clockText"
12
+ :disabled="disabled"
13
+ :error="error || clockInvalid"
14
+ :helperText="clockInvalid ? t('nextcloud-vue', 'Enter minutes, or minutes and seconds as 04:23.') : hint"
15
+ data-testid="cn-duration-clock"
16
+ @update:modelValue="onClock" />
17
+ <div
18
+ class="cn-duration-field__controls"
19
+ role="group"
20
+ :aria-label="timerLabel">
21
+ <NcButton
22
+ v-if="!running"
23
+ :disabled="disabled"
24
+ data-testid="cn-duration-start"
25
+ @click="start">
26
+ {{ t('nextcloud-vue', 'Start') }}
27
+ </NcButton>
28
+ <NcButton
29
+ v-else
30
+ :disabled="disabled"
31
+ data-testid="cn-duration-stop"
32
+ @click="stop">
33
+ {{ t('nextcloud-vue', 'Stop') }}
34
+ </NcButton>
35
+ <NcButton
36
+ variant="tertiary"
37
+ :disabled="disabled"
38
+ data-testid="cn-duration-reset"
39
+ @click="reset">
40
+ {{ t('nextcloud-vue', 'Reset') }}
41
+ </NcButton>
42
+ </div>
43
+ <span
44
+ class="cn-duration-field__state"
45
+ :class="{ 'cn-duration-field__state--running': running }"
46
+ role="status"
47
+ data-testid="cn-duration-state">{{ stateText }}</span>
48
+ </div>
49
+ <div v-else-if="!rawMode" class="cn-duration-field__row">
8
50
  <NcTextField
9
51
  class="cn-duration-field__amount"
10
52
  type="number"
@@ -39,13 +81,37 @@
39
81
  {{ t('nextcloud-vue', 'Edit as ISO') }}
40
82
  </NcButton>
41
83
  </div>
84
+ <div
85
+ v-if="timer && normSeconds"
86
+ class="cn-duration-field__norm"
87
+ :class="`cn-duration-field__norm--${normLevel}`"
88
+ data-testid="cn-duration-norm">
89
+ <div class="cn-duration-field__norm-line">
90
+ <span>{{ normText }}</span>
91
+ <span>{{ normPercent }}%</span>
92
+ <span v-if="normWords" data-testid="cn-duration-norm-words">{{ normWords }}</span>
93
+ </div>
94
+ <NcProgressBar
95
+ :value="Math.min(normPercent, 100)"
96
+ :error="normLevel === 'over'"
97
+ :aria-label="normText" />
98
+ </div>
42
99
  </div>
43
100
  </template>
44
101
 
45
102
  <script>
46
103
  import { translate as t } from '@nextcloud/l10n'
47
- import { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'
48
- import { DURATION_UNITS, formatDuration, isIsoDuration, parseDuration } from '../../utils/isoDuration.js'
104
+ import { NcButton, NcProgressBar, NcSelect, NcTextField } from '@nextcloud/vue'
105
+ import {
106
+ DURATION_UNITS,
107
+ durationSeconds,
108
+ formatClock,
109
+ formatDuration,
110
+ isIsoDuration,
111
+ parseClock,
112
+ parseDuration,
113
+ secondsToDuration,
114
+ } from '../../utils/isoDuration.js'
49
115
 
50
116
  /**
51
117
  * CnDurationField — edits an ISO 8601 duration as a number plus a unit
@@ -57,15 +123,21 @@ import { DURATION_UNITS, formatDuration, isIsoDuration, parseDuration } from '..
57
123
  * with an "Edit as ISO" toggle, so nothing is rounded. Clearing the number
58
124
  * writes `null`.
59
125
  *
126
+ * With `timer` the field is a clock: Start, Stop and Reset run it, and it writes
127
+ * the running time into the value every second, so a form saved mid-run holds it.
128
+ * Typing a time stops the clock and keeps what was typed. `autoStart` starts it
129
+ * when the field holds no value yet. `norm` shows the time against a length.
130
+ *
60
131
  * Example:
61
132
  * ```vue
62
133
  * <CnDurationField v-model="term" input-label="Handling term" />
134
+ * <CnDurationField v-model="length" input-label="Duration" timer auto-start norm="PT5M" />
63
135
  * ```
64
136
  */
65
137
  export default {
66
138
  name: 'CnDurationField',
67
139
 
68
- components: { NcButton, NcSelect, NcTextField },
140
+ components: { NcButton, NcProgressBar, NcSelect, NcTextField },
69
141
 
70
142
  props: {
71
143
  /** ISO 8601 duration string (v-model), or null. */
@@ -97,15 +169,64 @@ export default {
97
169
  type: Boolean,
98
170
  default: false,
99
171
  },
172
+
173
+ /** Draw the field as a clock with Start, Stop and Reset. */
174
+ timer: {
175
+ type: Boolean,
176
+ default: false,
177
+ },
178
+
179
+ /** With `timer`: start the clock when the field holds no value yet. */
180
+ autoStart: {
181
+ type: Boolean,
182
+ default: false,
183
+ },
184
+
185
+ /** With `timer`: an ISO 8601 length to show the time against. */
186
+ norm: {
187
+ type: String,
188
+ default: null,
189
+ },
190
+
191
+ /** Percentage of `norm` from which the bar warns. */
192
+ normWarningPercent: {
193
+ type: Number,
194
+ default: 80,
195
+ },
196
+
197
+ /** Words before the time on the norm line. */
198
+ normLabel: {
199
+ type: String,
200
+ default: '',
201
+ },
202
+
203
+ /** Accessible name of the Start, Stop and Reset group. */
204
+ timerLabel: {
205
+ type: String,
206
+ default: () => t('nextcloud-vue', 'Timer'),
207
+ },
208
+
209
+ /** With `timer`: a line under the clock. */
210
+ hint: {
211
+ type: String,
212
+ default: '',
213
+ },
100
214
  },
101
215
 
102
- emits: ['update:modelValue'],
216
+ emits: ['update:modelValue', 'started', 'stopped', 'reset'],
103
217
 
104
218
  data() {
105
219
  return {
106
220
  unit: 'days',
107
221
  editIso: false,
108
222
  draftIso: null,
223
+ running: false,
224
+ hasRun: false,
225
+ startedAt: 0,
226
+ secondsBefore: 0,
227
+ elapsed: 0,
228
+ clockDraft: null,
229
+ interval: null,
109
230
  }
110
231
  },
111
232
 
@@ -154,9 +275,168 @@ export default {
154
275
  unitOption() {
155
276
  return this.unitOptions.find((o) => o.id === this.currentUnit) || null
156
277
  },
278
+
279
+ clockInvalid() {
280
+ return this.clockDraft !== null && this.clockDraft.trim() !== '' && parseClock(this.clockDraft) === null
281
+ },
282
+
283
+ clockText() {
284
+ if (this.clockDraft !== null) {
285
+ return this.clockDraft
286
+ }
287
+ return this.running || this.hasValue ? formatClock(this.elapsed) : ''
288
+ },
289
+
290
+ stateText() {
291
+ if (this.running) {
292
+ return t('nextcloud-vue', 'Running')
293
+ }
294
+ return this.hasRun ? t('nextcloud-vue', 'Stopped') : ''
295
+ },
296
+
297
+ normSeconds() {
298
+ return this.norm ? durationSeconds(this.norm) : null
299
+ },
300
+
301
+ normPercent() {
302
+ return this.normSeconds ? Math.round((this.elapsed / this.normSeconds) * 100) : 0
303
+ },
304
+
305
+ normLevel() {
306
+ if (this.normPercent >= 100) {
307
+ return 'over'
308
+ }
309
+ return this.normPercent >= this.normWarningPercent ? 'near' : 'within'
310
+ },
311
+
312
+ normWords() {
313
+ if (this.normLevel === 'over') {
314
+ return t('nextcloud-vue', 'Over the norm')
315
+ }
316
+ return this.normLevel === 'near' ? t('nextcloud-vue', 'Close to the norm') : ''
317
+ },
318
+
319
+ normText() {
320
+ const amount = t('nextcloud-vue', '{elapsed} of {norm}', {
321
+ elapsed: formatClock(this.elapsed),
322
+ norm: formatClock(this.normSeconds),
323
+ })
324
+ return this.normLabel ? `${this.normLabel} ${amount}` : amount
325
+ },
326
+ },
327
+
328
+ watch: {
329
+ // The clock owns the value while it runs; the echo of its own write is ignored.
330
+ modelValue: {
331
+ immediate: true,
332
+ handler(value) {
333
+ if (!this.running) {
334
+ this.elapsed = durationSeconds(value) ?? 0
335
+ }
336
+ if (this.clockDraft !== null && secondsToDuration(parseClock(this.clockDraft)) !== value) {
337
+ this.clockDraft = null
338
+ }
339
+ },
340
+ },
341
+
342
+ autoStart() {
343
+ this.maybeAutoStart()
344
+ },
345
+ },
346
+
347
+ mounted() {
348
+ this.maybeAutoStart()
349
+ },
350
+
351
+ beforeUnmount() {
352
+ clearInterval(this.interval)
157
353
  },
158
354
 
159
355
  methods: {
356
+ t,
357
+
358
+ maybeAutoStart() {
359
+ if (this.timer && this.autoStart && !this.disabled && !this.hasRun && !this.hasValue) {
360
+ this.start()
361
+ }
362
+ },
363
+
364
+ /**
365
+ * Run the clock from the time it shows now.
366
+ *
367
+ * @spec openspec/changes/duration-field-timer/specs/duration-field-timer/spec.md#requirement-a-duration-field-can-run-as-a-clock
368
+ */
369
+ start() {
370
+ if (this.running) {
371
+ return
372
+ }
373
+ this.clockDraft = null
374
+ this.secondsBefore = this.elapsed
375
+ this.startedAt = Date.now()
376
+ this.running = true
377
+ this.hasRun = true
378
+ this.interval = setInterval(this.tick, 1000)
379
+ /** @event started The clock started. */
380
+ this.$emit('started')
381
+ },
382
+
383
+ // Counted from the start time, because a background tab throttles intervals.
384
+ tick() {
385
+ this.elapsed = this.secondsBefore + Math.floor((Date.now() - this.startedAt) / 1000)
386
+ this.$emit('update:modelValue', secondsToDuration(this.elapsed))
387
+ },
388
+
389
+ halt() {
390
+ clearInterval(this.interval)
391
+ this.interval = null
392
+ this.running = false
393
+ },
394
+
395
+ /**
396
+ * Stop the clock and write the final time.
397
+ *
398
+ * @spec openspec/changes/duration-field-timer/specs/duration-field-timer/spec.md#requirement-a-duration-field-can-run-as-a-clock
399
+ */
400
+ stop() {
401
+ if (!this.running) {
402
+ return
403
+ }
404
+ this.tick()
405
+ this.halt()
406
+ const value = secondsToDuration(this.elapsed)
407
+ /** @event stopped The clock stopped; carries the ISO string of the time. */
408
+ this.$emit('stopped', value)
409
+ },
410
+
411
+ /**
412
+ * Stop the clock and clear the value.
413
+ *
414
+ * @spec openspec/changes/duration-field-timer/specs/duration-field-timer/spec.md#requirement-a-duration-field-can-run-as-a-clock
415
+ */
416
+ reset() {
417
+ this.halt()
418
+ this.elapsed = 0
419
+ this.clockDraft = null
420
+ this.hasRun = false
421
+ this.$emit('update:modelValue', null)
422
+ /** @event reset The clock stopped and the value was cleared. */
423
+ this.$emit('reset')
424
+ },
425
+
426
+ onClock(text) {
427
+ const seconds = parseClock(text)
428
+ this.clockDraft = text
429
+ if (String(text).trim() === '') {
430
+ this.halt()
431
+ this.elapsed = 0
432
+ this.$emit('update:modelValue', null)
433
+ } else if (seconds !== null) {
434
+ this.halt()
435
+ this.elapsed = seconds
436
+ this.$emit('update:modelValue', secondsToDuration(seconds))
437
+ }
438
+ },
439
+
160
440
  onAmount(value) {
161
441
  /** @event update:modelValue The ISO string for the chosen amount and unit; null when the amount is cleared. */
162
442
  this.$emit('update:modelValue', formatDuration(value, this.currentUnit))
@@ -199,4 +479,49 @@ export default {
199
479
  .cn-duration-field__unit {
200
480
  min-width: 140px;
201
481
  }
482
+
483
+ .cn-duration-field__row--timer {
484
+ flex-wrap: wrap;
485
+ }
486
+
487
+ .cn-duration-field__clock {
488
+ flex: 0 1 160px;
489
+ font-variant-numeric: tabular-nums;
490
+ }
491
+
492
+ .cn-duration-field__controls {
493
+ display: flex;
494
+ gap: 4px;
495
+ }
496
+
497
+ .cn-duration-field__state {
498
+ align-self: center;
499
+ color: var(--color-text-maxcontrast);
500
+ }
501
+
502
+ .cn-duration-field__state--running {
503
+ color: var(--color-success-text);
504
+ font-weight: bold;
505
+ }
506
+
507
+ .cn-duration-field__norm {
508
+ margin-top: 8px;
509
+ }
510
+
511
+ .cn-duration-field__norm-line {
512
+ display: flex;
513
+ flex-wrap: wrap;
514
+ gap: 8px;
515
+ justify-content: space-between;
516
+ margin-bottom: 4px;
517
+ font-variant-numeric: tabular-nums;
518
+ }
519
+
520
+ .cn-duration-field__norm--near .cn-duration-field__norm-line {
521
+ color: var(--color-warning-text);
522
+ }
523
+
524
+ .cn-duration-field__norm--over .cn-duration-field__norm-line {
525
+ color: var(--color-error-text);
526
+ }
202
527
  </style>