@conduction/nextcloud-vue 2.56.0-beta.69 → 2.56.0-beta.70

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
@@ -0,0 +1,277 @@
1
+ import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createElementVNode, createTextVNode, normalizeClass, createBlock, withCtx, renderSlot } from 'vue';
2
+
3
+ const _hoisted_1 = {
4
+ class: "cn-choice-matrix",
5
+ "data-testid": "cn-choice-matrix",
6
+ tabindex: "-1"
7
+ };
8
+ const _hoisted_2 = {
9
+ key: 0,
10
+ class: "cn-choice-matrix__header"
11
+ };
12
+ const _hoisted_3 = {
13
+ key: 0,
14
+ class: "cn-choice-matrix__title"
15
+ };
16
+ const _hoisted_4 = {
17
+ key: 1,
18
+ class: "cn-choice-matrix__description"
19
+ };
20
+ const _hoisted_5 = {
21
+ key: 1,
22
+ class: "cn-choice-matrix__empty",
23
+ "data-testid": "cn-choice-matrix-empty"
24
+ };
25
+ const _hoisted_6 = ["aria-invalid", "aria-describedby", "data-testid"];
26
+ const _hoisted_7 = { class: "cn-choice-matrix__legend" };
27
+ const _hoisted_8 = {
28
+ key: 0,
29
+ class: "cn-choice-matrix__weight"
30
+ };
31
+ const _hoisted_9 = { class: "cn-choice-matrix__options" };
32
+ const _hoisted_10 = ["name", "value", "checked", "disabled", "data-testid", "onChange"];
33
+ const _hoisted_11 = { class: "cn-choice-matrix__option-text" };
34
+ const _hoisted_12 = {
35
+ key: 0,
36
+ class: "cn-choice-matrix__option-detail"
37
+ };
38
+ const _hoisted_13 = {
39
+ key: 1,
40
+ class: "cn-choice-matrix__option-detail"
41
+ };
42
+ const _hoisted_14 = ["id"];
43
+ const _hoisted_15 = {
44
+ key: 0,
45
+ class: "cn-choice-matrix__score",
46
+ "data-testid": "cn-choice-matrix-score"
47
+ };
48
+ const _hoisted_16 = { role: "status" };
49
+ const _hoisted_17 = {
50
+ key: 3,
51
+ class: "cn-choice-matrix__scroller"
52
+ };
53
+ const _hoisted_18 = { class: "cn-choice-matrix__table" };
54
+ const _hoisted_19 = {
55
+ key: 0,
56
+ class: "cn-choice-matrix__caption"
57
+ };
58
+ const _hoisted_20 = {
59
+ scope: "col",
60
+ class: "cn-choice-matrix__corner"
61
+ };
62
+ const _hoisted_21 = ["data-testid"];
63
+ const _hoisted_22 = {
64
+ key: 0,
65
+ class: "cn-choice-matrix__col-description"
66
+ };
67
+ const _hoisted_23 = {
68
+ key: 0,
69
+ scope: "col",
70
+ class: "cn-choice-matrix__actions"
71
+ };
72
+ const _hoisted_24 = { class: "cn-choice-matrix__sr" };
73
+ const _hoisted_25 = {
74
+ scope: "row",
75
+ class: "cn-choice-matrix__row-header"
76
+ };
77
+ const _hoisted_26 = {
78
+ key: 0,
79
+ class: "cn-choice-matrix__error",
80
+ "data-testid": "cn-choice-matrix-row-error"
81
+ };
82
+ const _hoisted_27 = ["data-testid"];
83
+ const _hoisted_28 = {
84
+ key: 0,
85
+ class: "cn-choice-matrix__actions"
86
+ };
87
+ const _hoisted_29 = {
88
+ class: "cn-choice-matrix__sr",
89
+ "aria-live": "polite",
90
+ "data-testid": "cn-choice-matrix-status"
91
+ };
92
+
93
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
94
+ const _component_NcButton = resolveComponent("NcButton");
95
+ const _component_NcSelect = resolveComponent("NcSelect");
96
+
97
+ return (openBlock(), createElementBlock("section", _hoisted_1, [
98
+ ($props.title || $props.description)
99
+ ? (openBlock(), createElementBlock("header", _hoisted_2, [
100
+ ($props.title)
101
+ ? (openBlock(), createElementBlock("h3", _hoisted_3, toDisplayString($props.title), 1 /* TEXT */))
102
+ : createCommentVNode("v-if", true),
103
+ ($props.description)
104
+ ? (openBlock(), createElementBlock("p", _hoisted_4, toDisplayString($props.description), 1 /* TEXT */))
105
+ : createCommentVNode("v-if", true)
106
+ ]))
107
+ : createCommentVNode("v-if", true),
108
+ ($options.isEmpty)
109
+ ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString($props.emptyLabel || $options.t('nextcloud-vue', 'Nothing to set yet.')), 1 /* TEXT */))
110
+ : ($props.pickPerRow)
111
+ ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
112
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.rows, (row) => {
113
+ return (openBlock(), createElementBlock("fieldset", {
114
+ key: $options.rowId(row),
115
+ class: "cn-choice-matrix__row",
116
+ role: "radiogroup",
117
+ "aria-invalid": $options.rowError(row) ? 'true' : undefined,
118
+ "aria-describedby": $options.rowError(row) ? $options.errorId(row) : undefined,
119
+ "data-testid": `cn-choice-matrix-row-${$options.rowId(row)}`
120
+ }, [
121
+ createElementVNode("legend", _hoisted_7, [
122
+ createTextVNode(toDisplayString(row[$props.rowLabelKey]) + " ", 1 /* TEXT */),
123
+ ($options.weightText(row))
124
+ ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString($options.weightText(row)), 1 /* TEXT */))
125
+ : createCommentVNode("v-if", true)
126
+ ]),
127
+ createElementVNode("div", _hoisted_9, [
128
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.optionsOf(row), (option) => {
129
+ return (openBlock(), createElementBlock("label", {
130
+ key: option.key,
131
+ class: normalizeClass(["cn-choice-matrix__option", { 'cn-choice-matrix__option--picked': $options.pickedKey(row) === option.key }])
132
+ }, [
133
+ createElementVNode("input", {
134
+ type: "radio",
135
+ name: `${$data.uid}-${$options.rowId(row)}`,
136
+ value: option.key,
137
+ checked: $options.pickedKey(row) === option.key,
138
+ disabled: $props.readOnly || Boolean(row.readOnly),
139
+ "data-testid": `cn-choice-matrix-option-${$options.rowId(row)}-${option.key}`,
140
+ onChange: $event => ($options.pick(row, option))
141
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_10),
142
+ createElementVNode("span", _hoisted_11, [
143
+ createElementVNode("span", null, toDisplayString(option.label), 1 /* TEXT */),
144
+ (option.description)
145
+ ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(option.description), 1 /* TEXT */))
146
+ : createCommentVNode("v-if", true),
147
+ ($options.pointsText(option))
148
+ ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString($options.pointsText(option)), 1 /* TEXT */))
149
+ : createCommentVNode("v-if", true)
150
+ ])
151
+ ], 2 /* CLASS */))
152
+ }), 128 /* KEYED_FRAGMENT */))
153
+ ]),
154
+ ($options.rowError(row))
155
+ ? (openBlock(), createElementBlock("p", {
156
+ key: 0,
157
+ id: $options.errorId(row),
158
+ class: "cn-choice-matrix__error",
159
+ "data-testid": "cn-choice-matrix-row-error"
160
+ }, toDisplayString($options.rowError(row)), 9 /* TEXT, PROPS */, _hoisted_14))
161
+ : createCommentVNode("v-if", true),
162
+ ($options.removable(row))
163
+ ? (openBlock(), createBlock(_component_NcButton, {
164
+ key: 1,
165
+ variant: "tertiary",
166
+ class: "cn-choice-matrix__remove",
167
+ "aria-label": $options.removeLabel(row),
168
+ "data-testid": `cn-choice-matrix-remove-${$options.rowId(row)}`,
169
+ onClick: $event => ($options.removeRow(row))
170
+ }, {
171
+ default: withCtx(() => [
172
+ createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Remove')), 1 /* TEXT */)
173
+ ]),
174
+ _: 1 /* STABLE */
175
+ }, 8 /* PROPS */, ["aria-label", "data-testid", "onClick"]))
176
+ : createCommentVNode("v-if", true)
177
+ ], 8 /* PROPS */, _hoisted_6))
178
+ }), 128 /* KEYED_FRAGMENT */)),
179
+ ($options.scoreLine || _ctx.$slots.scoreNote)
180
+ ? (openBlock(), createElementBlock("div", _hoisted_15, [
181
+ createElementVNode("strong", _hoisted_16, toDisplayString($options.scoreLine), 1 /* TEXT */),
182
+ renderSlot(_ctx.$slots, "scoreNote")
183
+ ]))
184
+ : createCommentVNode("v-if", true)
185
+ ], 64 /* STABLE_FRAGMENT */))
186
+ : (openBlock(), createElementBlock("div", _hoisted_17, [
187
+ createElementVNode("table", _hoisted_18, [
188
+ ($props.title)
189
+ ? (openBlock(), createElementBlock("caption", _hoisted_19, toDisplayString($props.title), 1 /* TEXT */))
190
+ : createCommentVNode("v-if", true),
191
+ createElementVNode("thead", null, [
192
+ createElementVNode("tr", null, [
193
+ createElementVNode("th", _hoisted_20, toDisplayString($props.rowHeader), 1 /* TEXT */),
194
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, (column) => {
195
+ return (openBlock(), createElementBlock("th", {
196
+ key: column.key,
197
+ scope: "col",
198
+ class: "cn-choice-matrix__col-header",
199
+ "data-testid": `cn-choice-matrix-col-${column.key}`
200
+ }, [
201
+ createElementVNode("span", null, toDisplayString(column.label), 1 /* TEXT */),
202
+ (column.description)
203
+ ? (openBlock(), createElementBlock("span", _hoisted_22, toDisplayString(column.description), 1 /* TEXT */))
204
+ : createCommentVNode("v-if", true)
205
+ ], 8 /* PROPS */, _hoisted_21))
206
+ }), 128 /* KEYED_FRAGMENT */)),
207
+ ($options.hasRemovable)
208
+ ? (openBlock(), createElementBlock("th", _hoisted_23, [
209
+ createElementVNode("span", _hoisted_24, toDisplayString($options.t('nextcloud-vue', 'Row actions')), 1 /* TEXT */)
210
+ ]))
211
+ : createCommentVNode("v-if", true)
212
+ ])
213
+ ]),
214
+ createElementVNode("tbody", null, [
215
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.rows, (row) => {
216
+ return (openBlock(), createElementBlock("tr", {
217
+ key: $options.rowId(row)
218
+ }, [
219
+ createElementVNode("th", _hoisted_25, [
220
+ createTextVNode(toDisplayString(row[$props.rowLabelKey]) + " ", 1 /* TEXT */),
221
+ ($options.rowError(row))
222
+ ? (openBlock(), createElementBlock("span", _hoisted_26, toDisplayString($options.rowError(row)), 1 /* TEXT */))
223
+ : createCommentVNode("v-if", true)
224
+ ]),
225
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, (column) => {
226
+ return (openBlock(), createElementBlock("td", {
227
+ key: column.key,
228
+ class: "cn-choice-matrix__cell",
229
+ "data-testid": `cn-choice-matrix-cell-${$options.rowId(row)}-${column.key}`
230
+ }, [
231
+ ($options.editable(row, column))
232
+ ? (openBlock(), createBlock(_component_NcSelect, {
233
+ key: 0,
234
+ modelValue: $options.choiceOf(row, column),
235
+ options: $props.choices,
236
+ clearable: false,
237
+ searchable: false,
238
+ ariaLabelCombobox: $options.cellLabel(row, column),
239
+ label: "label",
240
+ "onUpdate:modelValue": (choice) => $options.setCell(row, column, choice)
241
+ }, null, 8 /* PROPS */, ["modelValue", "options", "ariaLabelCombobox", "onUpdate:modelValue"]))
242
+ : (openBlock(), createElementBlock("span", {
243
+ key: 1,
244
+ class: normalizeClass(["cn-choice-matrix__value", $options.toneClass(row, column)]),
245
+ "data-testid": "cn-choice-matrix-value"
246
+ }, toDisplayString($options.valueText(row, column)), 3 /* TEXT, CLASS */))
247
+ ], 8 /* PROPS */, _hoisted_27))
248
+ }), 128 /* KEYED_FRAGMENT */)),
249
+ ($options.hasRemovable)
250
+ ? (openBlock(), createElementBlock("td", _hoisted_28, [
251
+ ($options.removable(row))
252
+ ? (openBlock(), createBlock(_component_NcButton, {
253
+ key: 0,
254
+ variant: "tertiary",
255
+ "aria-label": $options.removeLabel(row),
256
+ "data-testid": `cn-choice-matrix-remove-${$options.rowId(row)}`,
257
+ onClick: $event => ($options.removeRow(row))
258
+ }, {
259
+ default: withCtx(() => [
260
+ createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Remove')), 1 /* TEXT */)
261
+ ]),
262
+ _: 1 /* STABLE */
263
+ }, 8 /* PROPS */, ["aria-label", "data-testid", "onClick"]))
264
+ : createCommentVNode("v-if", true)
265
+ ]))
266
+ : createCommentVNode("v-if", true)
267
+ ]))
268
+ }), 128 /* KEYED_FRAGMENT */))
269
+ ])
270
+ ])
271
+ ])),
272
+ createElementVNode("p", _hoisted_29, toDisplayString($data.status), 1 /* TEXT */)
273
+ ]))
274
+ }
275
+
276
+ export { render };
277
+ //# sourceMappingURL=CnChoiceMatrix.vue3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnChoiceMatrix.vue3.js","sources":["../../../../src/components/CnChoiceMatrix/CnChoiceMatrix.vue?vue&type=template&id=74e66abe&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<section class=\"cn-choice-matrix\" data-testid=\"cn-choice-matrix\" tabindex=\"-1\">\n\t\t<header v-if=\"title || description\" class=\"cn-choice-matrix__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-choice-matrix__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-choice-matrix__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"isEmpty\"\n\t\t\tclass=\"cn-choice-matrix__empty\"\n\t\t\tdata-testid=\"cn-choice-matrix-empty\">\n\t\t\t{{ emptyLabel || t('nextcloud-vue', 'Nothing to set yet.') }}\n\t\t</p>\n\n\t\t<template v-else-if=\"pickPerRow\">\n\t\t\t<fieldset v-for=\"row in rows\"\n\t\t\t\t:key=\"rowId(row)\"\n\t\t\t\tclass=\"cn-choice-matrix__row\"\n\t\t\t\trole=\"radiogroup\"\n\t\t\t\t:aria-invalid=\"rowError(row) ? 'true' : undefined\"\n\t\t\t\t:aria-describedby=\"rowError(row) ? errorId(row) : undefined\"\n\t\t\t\t:data-testid=\"`cn-choice-matrix-row-${rowId(row)}`\">\n\t\t\t\t<legend class=\"cn-choice-matrix__legend\">\n\t\t\t\t\t{{ row[rowLabelKey] }}\n\t\t\t\t\t<span v-if=\"weightText(row)\" class=\"cn-choice-matrix__weight\">{{ weightText(row) }}</span>\n\t\t\t\t</legend>\n\t\t\t\t<div class=\"cn-choice-matrix__options\">\n\t\t\t\t\t<label v-for=\"option in optionsOf(row)\"\n\t\t\t\t\t\t:key=\"option.key\"\n\t\t\t\t\t\tclass=\"cn-choice-matrix__option\"\n\t\t\t\t\t\t:class=\"{ 'cn-choice-matrix__option--picked': pickedKey(row) === option.key }\">\n\t\t\t\t\t\t<input type=\"radio\"\n\t\t\t\t\t\t\t:name=\"`${uid}-${rowId(row)}`\"\n\t\t\t\t\t\t\t:value=\"option.key\"\n\t\t\t\t\t\t\t:checked=\"pickedKey(row) === option.key\"\n\t\t\t\t\t\t\t:disabled=\"readOnly || Boolean(row.readOnly)\"\n\t\t\t\t\t\t\t:data-testid=\"`cn-choice-matrix-option-${rowId(row)}-${option.key}`\"\n\t\t\t\t\t\t\t@change=\"pick(row, option)\">\n\t\t\t\t\t\t<span class=\"cn-choice-matrix__option-text\">\n\t\t\t\t\t\t\t<span>{{ option.label }}</span>\n\t\t\t\t\t\t\t<span v-if=\"option.description\" class=\"cn-choice-matrix__option-detail\">{{ option.description }}</span>\n\t\t\t\t\t\t\t<span v-if=\"pointsText(option)\" class=\"cn-choice-matrix__option-detail\">{{ pointsText(option) }}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t\t<p v-if=\"rowError(row)\"\n\t\t\t\t\t:id=\"errorId(row)\"\n\t\t\t\t\tclass=\"cn-choice-matrix__error\"\n\t\t\t\t\tdata-testid=\"cn-choice-matrix-row-error\">\n\t\t\t\t\t{{ rowError(row) }}\n\t\t\t\t</p>\n\t\t\t\t<NcButton v-if=\"removable(row)\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tclass=\"cn-choice-matrix__remove\"\n\t\t\t\t\t:aria-label=\"removeLabel(row)\"\n\t\t\t\t\t:data-testid=\"`cn-choice-matrix-remove-${rowId(row)}`\"\n\t\t\t\t\t@click=\"removeRow(row)\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t\t</NcButton>\n\t\t\t</fieldset>\n\t\t\t<div v-if=\"scoreLine || $slots.scoreNote\" class=\"cn-choice-matrix__score\" data-testid=\"cn-choice-matrix-score\">\n\t\t\t\t<strong role=\"status\">{{ scoreLine }}</strong>\n\t\t\t\t<!-- @slot scoreNote A remark beside the score. -->\n\t\t\t\t<slot name=\"scoreNote\" />\n\t\t\t</div>\n\t\t</template>\n\n\t\t<div v-else class=\"cn-choice-matrix__scroller\">\n\t\t\t<table class=\"cn-choice-matrix__table\">\n\t\t\t\t<caption v-if=\"title\" class=\"cn-choice-matrix__caption\">\n\t\t\t\t\t{{ title }}\n\t\t\t\t</caption>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th scope=\"col\" class=\"cn-choice-matrix__corner\">\n\t\t\t\t\t\t\t{{ rowHeader }}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-for=\"column in columns\"\n\t\t\t\t\t\t\t:key=\"column.key\"\n\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\tclass=\"cn-choice-matrix__col-header\"\n\t\t\t\t\t\t\t:data-testid=\"`cn-choice-matrix-col-${column.key}`\">\n\t\t\t\t\t\t\t<span>{{ column.label }}</span>\n\t\t\t\t\t\t\t<span v-if=\"column.description\" class=\"cn-choice-matrix__col-description\">{{ column.description }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th v-if=\"hasRemovable\" scope=\"col\" class=\"cn-choice-matrix__actions\">\n\t\t\t\t\t\t\t<span class=\"cn-choice-matrix__sr\">{{ t('nextcloud-vue', 'Row actions') }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr v-for=\"row in rows\" :key=\"rowId(row)\">\n\t\t\t\t\t\t<th scope=\"row\" class=\"cn-choice-matrix__row-header\">\n\t\t\t\t\t\t\t{{ row[rowLabelKey] }}\n\t\t\t\t\t\t\t<span v-if=\"rowError(row)\" class=\"cn-choice-matrix__error\" data-testid=\"cn-choice-matrix-row-error\">{{ rowError(row) }}</span>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td v-for=\"column in columns\"\n\t\t\t\t\t\t\t:key=\"column.key\"\n\t\t\t\t\t\t\tclass=\"cn-choice-matrix__cell\"\n\t\t\t\t\t\t\t:data-testid=\"`cn-choice-matrix-cell-${rowId(row)}-${column.key}`\">\n\t\t\t\t\t\t\t<NcSelect v-if=\"editable(row, column)\"\n\t\t\t\t\t\t\t\t:modelValue=\"choiceOf(row, column)\"\n\t\t\t\t\t\t\t\t:options=\"choices\"\n\t\t\t\t\t\t\t\t:clearable=\"false\"\n\t\t\t\t\t\t\t\t:searchable=\"false\"\n\t\t\t\t\t\t\t\t:ariaLabelCombobox=\"cellLabel(row, column)\"\n\t\t\t\t\t\t\t\tlabel=\"label\"\n\t\t\t\t\t\t\t\t@update:modelValue=\"(choice) => setCell(row, column, choice)\" />\n\t\t\t\t\t\t\t<span v-else\n\t\t\t\t\t\t\t\tclass=\"cn-choice-matrix__value\"\n\t\t\t\t\t\t\t\t:class=\"toneClass(row, column)\"\n\t\t\t\t\t\t\t\tdata-testid=\"cn-choice-matrix-value\">{{ valueText(row, column) }}</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td v-if=\"hasRemovable\" class=\"cn-choice-matrix__actions\">\n\t\t\t\t\t\t\t<NcButton v-if=\"removable(row)\"\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t:aria-label=\"removeLabel(row)\"\n\t\t\t\t\t\t\t\t:data-testid=\"`cn-choice-matrix-remove-${rowId(row)}`\"\n\t\t\t\t\t\t\t\t@click=\"removeRow(row)\">\n\t\t\t\t\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t\t<p class=\"cn-choice-matrix__sr\" aria-live=\"polite\" data-testid=\"cn-choice-matrix-status\">\n\t\t\t{{ status }}\n\t\t</p>\n\t</section>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcSelect } from '@nextcloud/vue'\nimport { userLocale } from '../../utils/userLocale.js'\n\nlet lastUid = 0\n\n/**\n * CnChoiceMatrix: rows against columns, every cell one choice out of the same\n * closed set (board DqZaaktypeVelden: fields against role and status, each\n * cell hidden, required or read only). `CnDataMatrix` is the grid for free\n * values, `CnActionAuthMatrix` the one for ticks.\n *\n * The value is a map `{ [rowId]: { [columnKey]: choiceValue } }`. A cell with\n * no stored value shows `defaultValue`. A change emits the whole new map, so\n * the host saves it or a single cell as it likes, and refusing a save is only\n * a matter of not passing the new map back in.\n *\n * ```vue\n * <CnChoiceMatrix\n * row-header=\"Field\"\n * :rows=\"[{ id: 'costs', label: 'Building costs' }]\"\n * :columns=\"[{ key: 'intake', label: 'Intake', description: 'received' }]\"\n * :choices=\"[\n * { value: 'hidden', label: 'Hidden', tone: 'muted' },\n * { value: 'required', label: 'Required', tone: 'strong' },\n * { value: 'readonly', label: 'Read only' },\n * ]\"\n * :model-value=\"rights\"\n * default-value=\"readonly\"\n * @update:model-value=\"rights = $event\" />\n * ```\n *\n * With `pickPerRow` a row holds one pick rather than a value per column, as a\n * rubric does (boards LqInleveringNakijken, LqLlInleveren): radio buttons per\n * row, each with its text and points, and a running score. The value is then\n * `{ [rowId]: optionKey }`. The options are the `columns`, or a row's own\n * `options` when its levels differ.\n *\n * @event update:modelValue The whole new map after a cell changed.\n * @event cell-change One changed cell: `{ rowId, columnKey, value, previous }`.\n * @event score-change With `pickPerRow`, on mount and on every change: `{ score, max, complete }`.\n *\n * @spec openspec/changes/choice-matrix/specs/choice-matrix/spec.md\n */\nexport default {\n\tname: 'CnChoiceMatrix',\n\n\tcomponents: { NcButton, NcSelect },\n\n\tprops: {\n\t\t/**\n\t\t * The rows: objects with an id (`rowIdKey`), a label (`rowLabelKey`) and an optional `readOnly`.\n\t\t * With `pickPerRow` also `weight` and `options`: `{ key, label, description?, points? }`.\n\t\t */\n\t\trows: { type: Array, default: () => [] },\n\t\t/** The columns: `{ key, label, description?, readOnly?, points? }`. */\n\t\tcolumns: { type: Array, default: () => [] },\n\t\t/** The closed set every cell picks from: `{ value, label, tone? }`, `tone` being `muted` or `strong`. */\n\t\tchoices: { type: Array, default: () => [] },\n\t\t/** The stored choices: `{ [rowId]: { [columnKey]: value } }`, or with `pickPerRow` `{ [rowId]: optionKey }`. */\n\t\tmodelValue: { type: Object, default: () => ({}) },\n\t\t/** The choice value a cell shows while nothing is stored for it. */\n\t\tdefaultValue: { type: String, default: '' },\n\t\t/** Key of a row's id. */\n\t\trowIdKey: { type: String, default: 'id' },\n\t\t/** Key of a row's label. */\n\t\trowLabelKey: { type: String, default: 'label' },\n\t\t/** Heading of the row column, already translated. */\n\t\trowHeader: { type: String, default: '' },\n\t\t/** Title above the grid, already translated. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** A line under the title, already translated. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Text when there are no rows or columns; the library default is \"Nothing to set yet.\". */\n\t\temptyLabel: { type: String, default: '' },\n\t\t/** Draw every cell as text. */\n\t\treadOnly: { type: Boolean, default: false },\n\t\t/** A row holds one pick, drawn as radio buttons, rather than a choice per column. */\n\t\tpickPerRow: { type: Boolean, default: false },\n\t\t/** Show the score: `true` for the library's words, or a text with `{score}` and `{max}`, already translated. */\n\t\tscoreLabel: { type: [Boolean, String], default: false },\n\t\t/** The most a user can score; the sum of each row's highest points when null. */\n\t\tscoreMax: { type: Number, default: null },\n\t\t/** How picks add up: `sum` adds the points, `weighted` multiplies each by its row's `weight` first. */\n\t\tscoreMode: { type: String, default: 'sum', validator: (value) => ['sum', 'weighted'].includes(value) },\n\t\t/** A row's weight in words, already translated, with `{weight}`. */\n\t\tweightTemplate: { type: String, default: '' },\n\t\t/** Errors per row, already translated: `{ [rowId]: text }`. */\n\t\trowErrors: { type: Object, default: () => ({}) },\n\t\t/** A Remove button per row; a row with `removable: false` keeps none. Ignored when `readOnly`. */\n\t\tremovableRows: { type: Boolean, default: false },\n\t},\n\n\temits: ['update:modelValue', 'cell-change', 'score-change', 'remove-row'],\n\n\tdata() {\n\t\tlastUid += 1\n\t\treturn { uid: `cn-choice-matrix-${lastUid}`, status: '' }\n\t},\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether there is nothing to draw. */\n\t\t/**\n\t\t * @return {boolean} Whether any row shows a Remove button, which adds the actions column.\n\t\t */\n\t\thasRemovable() {\n\t\t\treturn this.rows.some((row) => this.removable(row))\n\t\t},\n\n\t\tisEmpty() {\n\t\t\tif (this.rows.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.pickPerRow\n\t\t\t\t? this.rows.every((row) => this.optionsOf(row).length === 0)\n\t\t\t\t: this.columns.length === 0\n\t\t},\n\n\t\t/** @return {{score: number, max: number, complete: boolean}} The running score. */\n\t\tscore() {\n\t\t\tlet score = 0\n\t\t\tlet max = 0\n\t\t\tlet complete = true\n\t\t\tfor (const row of this.rows) {\n\t\t\t\tconst factor = this.scoreMode === 'weighted' ? (Number(row.weight) || 0) : 1\n\t\t\t\tconst options = this.optionsOf(row)\n\t\t\t\tconst picked = options.find((option) => option.key === this.pickedKey(row))\n\t\t\t\tmax += Math.max(0, ...options.map((option) => Number(option.points) || 0)) * factor\n\t\t\t\tscore += (Number(picked?.points) || 0) * factor\n\t\t\t\tcomplete = complete && (Boolean(picked) || Boolean(row.readOnly))\n\t\t\t}\n\t\t\treturn { score, max: this.scoreMax ?? max, complete }\n\t\t},\n\n\t\t/** @return {string} The score in words, or ''. */\n\t\tscoreLine() {\n\t\t\tif (!this.scoreLabel) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst score = this.formatNumber(this.score.score)\n\t\t\tconst max = this.formatNumber(this.score.max)\n\t\t\treturn typeof this.scoreLabel === 'string'\n\t\t\t\t? this.scoreLabel.replace('{score}', score).replace('{max}', max)\n\t\t\t\t: t('nextcloud-vue', 'Score: {score} of {max}', { score, max })\n\t\t},\n\t},\n\n\twatch: {\n\t\tscore: {\n\t\t\timmediate: true,\n\t\t\thandler(next, previous) {\n\t\t\t\tif (this.pickPerRow && JSON.stringify(next) !== JSON.stringify(previous)) {\n\t\t\t\t\tthis.$emit('score-change', next)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * @param {number} value A number.\n\t\t * @return {string} The number in the user's locale, with at most two decimals.\n\t\t */\n\t\tformatNumber(value) {\n\t\t\treturn value.toLocaleString(userLocale(), { maximumFractionDigits: 2 })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {object[]} What the row picks from: its own options, else the columns.\n\t\t */\n\t\toptionsOf(row) {\n\t\t\treturn Array.isArray(row.options) ? row.options : this.columns\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string|undefined} The key of the option the row holds.\n\t\t */\n\t\tpickedKey(row) {\n\t\t\treturn this.modelValue?.[this.rowId(row)]\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string} The row's weight in words, or ''.\n\t\t */\n\t\tweightText(row) {\n\t\t\tif (row.weight === undefined || row.weight === null || row.weight === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst weight = String(row.weight)\n\t\t\treturn this.weightTemplate\n\t\t\t\t? this.weightTemplate.replace('{weight}', weight)\n\t\t\t\t: t('nextcloud-vue', '(weight {weight})', { weight })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} option An option.\n\t\t * @return {string} Its points in words, or ''.\n\t\t */\n\t\tpointsText(option) {\n\t\t\tif (option.points === undefined || option.points === null) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst points = this.formatNumber(Number(option.points))\n\t\t\treturn Number(option.points) === 1\n\t\t\t\t? t('nextcloud-vue', '{points} point', { points })\n\t\t\t\t: t('nextcloud-vue', '{points} points', { points })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string} The row's error, or ''.\n\t\t */\n\t\trowError(row) {\n\t\t\treturn this.rowErrors?.[this.rowId(row)] ?? ''\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string} The id of the row's error line.\n\t\t */\n\t\terrorId(row) {\n\t\t\treturn `${this.uid}-error-${this.rowId(row)}`\n\t\t},\n\n\t\t/**\n\t\t * Emit the new map for a picked option.\n\t\t *\n\t\t * @param {object} row A row.\n\t\t * @param {object} option The picked option.\n\t\t * @return {void}\n\t\t */\n\t\tpick(row, option) {\n\t\t\tconst rowId = this.rowId(row)\n\t\t\tconst previous = this.pickedKey(row)\n\t\t\tthis.$emit('update:modelValue', { ...this.modelValue, [rowId]: option.key })\n\t\t\tthis.$emit('cell-change', { rowId, columnKey: option.key, value: option.key, previous })\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {boolean} Whether the row shows a Remove button.\n\t\t * @spec openspec/changes/choice-matrix-removable-rows/tasks.md#task-1\n\t\t */\n\t\tremovable(row) {\n\t\t\treturn this.removableRows && !this.readOnly && row.removable !== false\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string} The accessible name of its Remove button.\n\t\t */\n\t\tremoveLabel(row) {\n\t\t\treturn t('nextcloud-vue', 'Remove {row}', { row: String(row[this.rowLabelKey] ?? '') })\n\t\t},\n\n\t\t/**\n\t\t * Remove a row: emit the map without it and `remove-row`, so the host\n\t\t * drops it from `rows`, and say so to a screen reader.\n\t\t *\n\t\t * @param {object} row A row.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/choice-matrix-removable-rows/tasks.md#task-1\n\t\t */\n\t\tremoveRow(row) {\n\t\t\tconst rowId = this.rowId(row)\n\t\t\tconst next = { ...this.modelValue }\n\t\t\tdelete next[rowId]\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t\tthis.$emit('remove-row', { rowId, row })\n\t\t\tthis.status = t('nextcloud-vue', 'Removed {row}.', { row: String(row[this.rowLabelKey] ?? '') })\n\t\t\tconst index = this.rows.indexOf(row)\n\t\t\tthis.$nextTick(() => this.focusAfterRemove(index))\n\t\t},\n\n\t\t/**\n\t\t * Keep the keyboard in the grid after a row is gone: the Remove button\n\t\t * now at the removed row's place, else the last one, else the grid.\n\t\t *\n\t\t * @param {number} index Where the removed row was.\n\t\t * @return {void}\n\t\t */\n\t\tfocusAfterRemove(index) {\n\t\t\tconst buttons = this.$el.querySelectorAll('[data-testid^=\"cn-choice-matrix-remove-\"]')\n\t\t\tconst target = buttons[Math.min(index, buttons.length - 1)] || this.$el\n\t\t\ttarget.focus()\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @return {string} The row's id as a string.\n\t\t */\n\t\trowId(row) {\n\t\t\treturn String(row[this.rowIdKey])\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {boolean} Whether this cell offers a choice.\n\t\t */\n\t\teditable(row, column) {\n\t\t\treturn !this.readOnly && !row.readOnly && !column.readOnly\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {string} The stored value, else `defaultValue`.\n\t\t */\n\t\tvalueOf(row, column) {\n\t\t\treturn this.modelValue?.[this.rowId(row)]?.[column.key] ?? this.defaultValue\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {object|null} The choice the cell holds, null when it matches none.\n\t\t */\n\t\tchoiceOf(row, column) {\n\t\t\tconst value = this.valueOf(row, column)\n\t\t\treturn this.choices.find((choice) => choice.value === value) ?? null\n\t\t},\n\n\t\t/**\n\t\t * The cell as text. A stored value outside the set shows as it is, so\n\t\t * it is seen rather than read as empty.\n\t\t *\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {string} What a read-only cell says.\n\t\t */\n\t\tvalueText(row, column) {\n\t\t\treturn this.choiceOf(row, column)?.label ?? String(this.valueOf(row, column))\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {string} The class of the cell's tone, or ''.\n\t\t */\n\t\ttoneClass(row, column) {\n\t\t\tconst tone = this.choiceOf(row, column)?.tone\n\t\t\treturn tone ? `cn-choice-matrix__value--${tone}` : ''\n\t\t},\n\n\t\t/**\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @return {string} A name for the cell's control, naming both axes.\n\t\t */\n\t\tcellLabel(row, column) {\n\t\t\treturn `${row[this.rowLabelKey]}, ${column.label}`\n\t\t},\n\n\t\t/**\n\t\t * Emit the new map for a picked choice. Picking what the cell already\n\t\t * holds, or nothing, changes nothing.\n\t\t *\n\t\t * @param {object} row A row.\n\t\t * @param {object} column A column.\n\t\t * @param {object|null} choice The picked choice.\n\t\t * @return {void}\n\t\t */\n\t\tsetCell(row, column, choice) {\n\t\t\tconst previous = this.valueOf(row, column)\n\t\t\tif (!choice || choice.value === previous) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst rowId = this.rowId(row)\n\t\t\tthis.$emit('update:modelValue', {\n\t\t\t\t...this.modelValue,\n\t\t\t\t[rowId]: { ...(this.modelValue?.[rowId] ?? {}), [column.key]: choice.value },\n\t\t\t})\n\t\t\tthis.$emit('cell-change', { rowId, columnKey: column.key, value: choice.value, previous })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-choice-matrix {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-choice-matrix__title {\n\tfont-size: 1.1em;\n\tmargin: 0;\n}\n\n.cn-choice-matrix__description,\n.cn-choice-matrix__empty,\n.cn-choice-matrix__col-description {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-choice-matrix__description,\n.cn-choice-matrix__empty {\n\tmargin: 0;\n}\n\n.cn-choice-matrix__row {\n\tborder: 0;\n\tborder-top: 1px solid var(--color-border);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmargin: 0;\n\tmin-width: 0;\n\tpadding: 12px 0 0;\n}\n\n.cn-choice-matrix__legend {\n\tfont-weight: 600;\n\tpadding: 0;\n}\n\n.cn-choice-matrix__weight {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.9em;\n\tfont-weight: normal;\n}\n\n.cn-choice-matrix__options {\n\tdisplay: grid;\n\tgap: 8px;\n\tgrid-template-columns: repeat(auto-fit, minmax(170px, 1fr));\n}\n\n.cn-choice-matrix__option {\n\talign-items: flex-start;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\tcursor: pointer;\n\tdisplay: flex;\n\tgap: 8px;\n\tpadding: 8px 12px;\n}\n\n.cn-choice-matrix__option--picked {\n\tbackground: var(--color-primary-element-light);\n\tborder-color: var(--color-primary-element);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-choice-matrix__option input {\n\taccent-color: var(--color-primary-element);\n\tflex: none;\n\tmargin: 2px 0 0;\n}\n\n.cn-choice-matrix__option-text {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-choice-matrix__option-detail {\n\tfont-size: 0.9em;\n}\n\n.cn-choice-matrix__actions {\n\twidth: 1%;\n\twhite-space: nowrap;\n}\n\n.cn-choice-matrix__remove {\n\tmargin-top: 4px;\n}\n\n.cn-choice-matrix__sr {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n\twhite-space: nowrap;\n}\n\n.cn-choice-matrix__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tdisplay: block;\n\tfont-weight: normal;\n\tmargin: 0;\n\twhite-space: normal;\n}\n\n.cn-choice-matrix__score {\n\talign-items: center;\n\tbackground: var(--color-background-hover);\n\tborder-radius: var(--border-radius-large);\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px 16px;\n\tjustify-content: space-between;\n\tpadding: 12px 16px;\n}\n\n.cn-choice-matrix__scroller {\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\toverflow-x: auto;\n}\n\n.cn-choice-matrix__table {\n\tborder-collapse: collapse;\n\twidth: 100%;\n}\n\n.cn-choice-matrix__caption {\n\tblock-size: 1px;\n\tclip-path: inset(50%);\n\tinline-size: 1px;\n\toverflow: hidden;\n\tposition: absolute;\n\twhite-space: nowrap;\n}\n\n.cn-choice-matrix__corner,\n.cn-choice-matrix__col-header {\n\tbackground: var(--color-background-hover);\n\tborder-bottom: 1px solid var(--color-border);\n\tfont-weight: 600;\n\tpadding: 8px 12px;\n\ttext-align: start;\n\tvertical-align: top;\n}\n\n.cn-choice-matrix__col-header > span {\n\tdisplay: block;\n}\n\n.cn-choice-matrix__col-description {\n\tfont-size: 0.9em;\n\tfont-weight: normal;\n}\n\n.cn-choice-matrix__row-header {\n\tborder-bottom: 1px solid var(--color-border);\n\tfont-weight: 500;\n\tpadding: 6px 12px;\n\ttext-align: start;\n\twhite-space: nowrap;\n}\n\n.cn-choice-matrix__cell {\n\tborder-bottom: 1px solid var(--color-border);\n\tmin-width: 160px;\n\tpadding: 6px 12px;\n}\n\ntbody tr:last-child > * {\n\tborder-bottom: 0;\n}\n\n.cn-choice-matrix__value--muted {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-choice-matrix__value--strong {\n\tfont-weight: 600;\n}\n</style>\n"],"names":["_createElementBlock","_toDisplayString","_openBlock","_Fragment","_renderList","_createElementVNode","_normalizeClass","_renderSlot","_createBlock"],"mappings":";;;AASO,EAAA,KAAA,EAAA,kBAAA;AAAA,EAAA,aAAA,EAAA,kBAAA;AAAA,EAAA,QAAA,EAAA,IAAA;;;;AAC+B,EAAA,KAAK,EAAC,0BAAkB;;;;AAC1C,EAAA,KAAA,EAAA,yBAAA;;;;;;;;;AAUjB,EAAA,aAAW,EAAC,wBAAmB;;;AAYtB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAwB,GAAA;;;AAEpB,EAAA,KAAA,EAAA,0BAAA;;AAEb,MAAA,UAAA,GAAA,EAAA,KAAK,EAAE,2BAA0B,GAAA;;AAY9B,MAAA,WAAA,GAAA,EAAA,KAAA,EAAA,+BAAA,GAAA;;;AAEH,EAAA,KAAA,EAAA,iCAAA;;;;AACiB,EAAA,KAAA,EAAA,iCAAA;;;;;AAmBlB,EAAA,KAAA,EAAA,yBAAA;AAAA,EAAA,aAAA,EAAA,wBAAA;;AACI,MAAA,WAAA,GAAA,EAAA,IAAA,EAAA,QAAA,GAAA;;;AAMC,EAAA,KAAA,EAAA,4BAAA;;AACH,MAAA,W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AAA,CAAA;uDAMrB,CAAA,mBAAA,EAAA;;AALF,gCAAA,OAAO,EAAC,UAAU;gCACjB,YAAQ,EAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA;gCACR,aAAC,EAAA,CAAA,wBAAA,EAAA,QAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,CAAA;gCACD,OAAA,EAAA,MAAA,KAAA,QAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA;;iDACD,MAAG;kEAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,QAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnCountdownWidget.vue2.js';
2
2
  import { render } from './CnCountdownWidget.vue3.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-f992f4f8";
5
+ script.__scopeId = "data-v-69debc7c";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -1,6 +1,7 @@
1
1
  import { translate } from '@nextcloud/l10n';
2
2
  import { inject } from 'vue';
3
- import __sfc_main from '../CnWidgetGrid/CnWidgetIcon.vue.js';
3
+ import __sfc_main from '../CnNoteCard/CnNoteCard.vue.js';
4
+ import __sfc_main$1 from '../CnWidgetGrid/CnWidgetIcon.vue.js';
4
5
  import { getByPath } from '../../composables/useEndpointSource.js';
5
6
  import { normalizeLook } from '../../composables/useLook.js';
6
7
  import { dispatchAction } from '../../utils/actionsDispatcher.js';
@@ -10,6 +11,18 @@ import { userLocale } from '../../utils/userLocale.js';
10
11
 
11
12
  const MS_PER_DAY = 24 * 60 * 60 * 1000;
12
13
 
14
+ /** The note-card types a state notice may take. */
15
+ const NOTICE_TYPES = ['success', 'info', 'warning', 'error'];
16
+
17
+ /** The note-card type of each state's notice when the notice names none. */
18
+ const DEFAULT_NOTICE_TYPES = Object.freeze({
19
+ onTrack: 'info',
20
+ warning: 'warning',
21
+ danger: 'error',
22
+ overdue: 'error',
23
+ extended: 'info',
24
+ });
25
+
13
26
  const VARIANT_COLORS = Object.freeze({
14
27
  default: 'var(--color-primary-element)',
15
28
  success: 'var(--color-success)',
@@ -59,6 +72,33 @@ const VARIANT_COLORS = Object.freeze({
59
72
  * content: { field: 'deadline', settledField: 'isFinalStatus', settledLabel: 'Handled' }
60
73
  * ```
61
74
  *
75
+ * ## The states of a term
76
+ *
77
+ * A term card reads differently as its date nears. `states` gives each state
78
+ * its own headline, caption and notice, and `actions` puts several buttons
79
+ * under the card, each greyed out in the states its `disabledIn` names:
80
+ *
81
+ * ```js
82
+ * content: {
83
+ * field: 'deadline',
84
+ * thresholds: { warn: 14, danger: 7 },
85
+ * extendedField: 'extendedOn',
86
+ * states: {
87
+ * warning: { notice: { lead: 'Watch the term', text: 'Two weeks left.' } },
88
+ * overdue: { headline: 'Term passed', caption: 'Was due {date}, {count} days ago' },
89
+ * },
90
+ * actions: [
91
+ * { label: 'Extend', type: 'handler', handler: 'extendTerm', disabledIn: ['overdue', 'extended'] },
92
+ * { label: 'Suspend', type: 'handler', handler: 'suspendTerm' },
93
+ * ],
94
+ * }
95
+ * ```
96
+ *
97
+ * The state is `overdue` past the date, else `danger` or `warning` by the
98
+ * thresholds, else `extended` when `extendedField` is truthy, else `onTrack`.
99
+ * `extended` also counts for `disabledIn` while a threshold applies, so a
100
+ * term extended once cannot be extended again a week before its end.
101
+ *
62
102
  * ## An unset date
63
103
  *
64
104
  * Renders a dash and no threshold colour. A case with no deadline is not urgent
@@ -69,7 +109,8 @@ var script = {
69
109
  name: 'CnCountdownWidget',
70
110
 
71
111
  components: {
72
- CnWidgetIcon: __sfc_main,
112
+ CnNoteCard: __sfc_main,
113
+ CnWidgetIcon: __sfc_main$1,
73
114
  },
74
115
 
75
116
  props: {
@@ -90,8 +131,11 @@ var script = {
90
131
  * - `emptyLabel` — the headline while the date is unset (default a dash).
91
132
  * - `emptyCaption` — the line under it while the date is unset, with `{date}` read from `emptyDateField`.
92
133
  * - `facts` — `[{ label, field }]` rows under the caption.
134
+ * - `extendedField` — property on the record that is truthy once the term has been extended.
135
+ * - `states` — per state (`onTrack`, `warning`, `danger`, `overdue`, `extended`) a `{ headline?, caption?, notice?: { lead?, text?, type? } }`; texts take `{date}` and `{count}` and run through the host's translate.
136
+ * - `actions` — several manifest actions under the card, each with an optional `disabledIn` list of states.
93
137
  *
94
- * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}> }}
138
+ * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}>, extendedField?: string, states?: object, actions?: Array<object> }}
95
139
  */
96
140
  content: {
97
141
  type: Object,
@@ -207,6 +251,9 @@ var script = {
207
251
  return translate('nextcloud-vue', 'Closed')
208
252
  }
209
253
  const days = this.daysRemaining;
254
+ if (this.stateConfig.headline) {
255
+ return this.fillStateText(this.stateConfig.headline)
256
+ }
210
257
  if (days === null) {
211
258
  return this.content?.emptyLabel ? this.translate(this.content.emptyLabel) : '—'
212
259
  }
@@ -284,22 +331,109 @@ var script = {
284
331
  .filter((row) => row.value !== '')
285
332
  },
286
333
 
287
- /** @return {string} The accessible name of the progress bar. */
288
- progressLabel() {
289
- return translate('nextcloud-vue', 'Time passed')
334
+ /**
335
+ * Whether the record says its term has been extended (`extendedField`).
336
+ *
337
+ * @return {boolean} True for an extended term.
338
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state
339
+ */
340
+ isExtended() {
341
+ const field = this.content?.extendedField;
342
+ return Boolean(field && this.record && getByPath(this.record, field))
290
343
  },
291
344
 
292
345
  /**
293
- * The label of `content.action`, translated, or ''.
346
+ * The state of the term: `overdue`, `danger`, `warning`, `extended` or
347
+ * `onTrack`; null while the date is unset or the record is settled.
294
348
  *
295
- * @return {string} The label.
296
- * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card
349
+ * @return {string|null} The state.
350
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state
351
+ */
352
+ termState() {
353
+ if (this.daysRemaining === null || this.isSettled) {
354
+ return null
355
+ }
356
+ if (this.daysRemaining < 0) {
357
+ return 'overdue'
358
+ }
359
+ if (this.variant === 'error') {
360
+ return 'danger'
361
+ }
362
+ if (this.variant === 'warning') {
363
+ return 'warning'
364
+ }
365
+ return this.isExtended ? 'extended' : 'onTrack'
366
+ },
367
+
368
+ /**
369
+ * Every state that holds now: the term state, plus `extended` while a
370
+ * threshold or the date outranks it.
371
+ *
372
+ * @return {string[]} The states.
373
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state
297
374
  */
298
- actionLabel() {
299
- const action = this.content?.action;
300
- return action && typeof action === 'object' && typeof action.label === 'string' && action.label !== ''
301
- ? this.translate(action.label)
302
- : ''
375
+ activeStates() {
376
+ if (this.termState === null) {
377
+ return []
378
+ }
379
+ return this.isExtended && this.termState !== 'extended' ? [this.termState, 'extended'] : [this.termState]
380
+ },
381
+
382
+ /**
383
+ * The `states` entry of the current state, or an empty object.
384
+ *
385
+ * @return {{headline?: string, caption?: string, notice?: object}} The entry.
386
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state
387
+ */
388
+ stateConfig() {
389
+ const states = this.content?.states;
390
+ const entry = this.termState && states && typeof states === 'object' ? states[this.termState] : null;
391
+ return entry && typeof entry === 'object' ? entry : {}
392
+ },
393
+
394
+ /**
395
+ * The notice of the current state, its texts filled in, or null.
396
+ *
397
+ * @return {{lead: string, text: string, type: string}|null} The notice.
398
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state
399
+ */
400
+ stateNotice() {
401
+ const notice = this.stateConfig.notice;
402
+ if (!notice || typeof notice !== 'object' || (!notice.lead && !notice.text)) {
403
+ return null
404
+ }
405
+ const type = NOTICE_TYPES.includes(notice.type) ? notice.type : DEFAULT_NOTICE_TYPES[this.termState];
406
+ return {
407
+ lead: notice.lead ? this.fillStateText(notice.lead) : '',
408
+ text: notice.text ? this.fillStateText(notice.text) : '',
409
+ type,
410
+ }
411
+ },
412
+
413
+ /**
414
+ * The buttons under the card: `content.actions`, or `content.action`
415
+ * alone, each greyed out while a state its `disabledIn` names holds.
416
+ *
417
+ * @return {Array<{index: number, label: string, primary: boolean, disabled: boolean, action: object}>} The buttons.
418
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state
419
+ */
420
+ actionButtons() {
421
+ const list = Array.isArray(this.content?.actions) ? this.content.actions : [this.content?.action];
422
+ return list
423
+ .map((action, index) => ({ action, index }))
424
+ .filter(({ action }) => action && typeof action === 'object' && typeof action.label === 'string' && action.label !== '')
425
+ .map(({ action, index }) => ({
426
+ index,
427
+ label: this.translate(action.label),
428
+ primary: action.variant === 'primary',
429
+ disabled: Array.isArray(action.disabledIn) && action.disabledIn.some((state) => this.activeStates.includes(state)),
430
+ action,
431
+ }))
432
+ },
433
+
434
+ /** @return {string} The accessible name of the progress bar. */
435
+ progressLabel() {
436
+ return translate('nextcloud-vue', 'Time passed')
303
437
  },
304
438
 
305
439
  /**
@@ -318,6 +452,9 @@ var script = {
318
452
  if (!this.targetDate || this.content?.showDate === false) {
319
453
  return ''
320
454
  }
455
+ if (this.stateConfig.caption) {
456
+ return this.fillStateText(this.stateConfig.caption)
457
+ }
321
458
  const date = this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' });
322
459
  const caption = this.content?.caption;
323
460
  if (typeof caption === 'string' && caption !== '') {
@@ -386,20 +523,38 @@ var script = {
386
523
  },
387
524
 
388
525
  /**
389
- * Dispatch `content.action` with the record's tokens resolved, through
390
- * the page's dispatcher when there is one.
526
+ * A state text through the host's translate, with `{date}` the long
527
+ * date and `{count}` the days left, or the days past once overdue.
528
+ *
529
+ * @param {string} text The text.
530
+ * @return {string} The filled text.
531
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state
532
+ */
533
+ fillStateText(text) {
534
+ const date = this.targetDate ? this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : '';
535
+ const count = this.daysRemaining === null ? '' : String(Math.abs(this.daysRemaining));
536
+ return this.translate(text).replace(/\{date\}/g, date).replace(/\{count\}/g, count)
537
+ },
538
+
539
+ /**
540
+ * Dispatch a manifest action with the record's tokens resolved, through
541
+ * the page's dispatcher when there is one. A greyed-out action does nothing.
391
542
  *
543
+ * @param {object} [action] The action; `content.action` when left out.
392
544
  * @return {unknown}
393
- * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card
545
+ * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state
394
546
  */
395
- runAction() {
396
- const action = this.content?.action;
547
+ runAction(action = this.content?.action) {
397
548
  if (!action || typeof action !== 'object') {
398
549
  return undefined
399
550
  }
400
551
  const ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected) || {};
401
552
  const tokenCtx = { ...ctx, object: this.record || ctx.object || null, objectId: this.record?.id ?? ctx.objectId ?? null };
402
- const resolved = resolveDeepTokens(action, tokenCtx);
553
+ const { disabledIn, ...declared } = action;
554
+ if (Array.isArray(disabledIn) && disabledIn.some((state) => this.activeStates.includes(state))) {
555
+ return undefined
556
+ }
557
+ const resolved = resolveDeepTokens(declared, tokenCtx);
403
558
  if (typeof this.cnDispatchAction === 'function') {
404
559
  return this.cnDispatchAction(resolved)
405
560
  }