@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
@@ -1,3 +1,5 @@
1
+ import { translate } from '@nextcloud/l10n';
2
+ import Draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
1
3
  import __sfc_main from './CnTreeNode.vue.js';
2
4
 
3
5
  /**
@@ -5,10 +7,11 @@ import __sfc_main from './CnTreeNode.vue.js';
5
7
  * nodes with click-to-expand carets, optional badges + icons,
6
8
  * inline per-row actions slot, and select-on-click semantics.
7
9
  *
8
- * Drag-drop reorder is intentionally a follow-up (issue #278).
9
- * The widget's public contract (props, events, selection model)
10
- * is forward-compatible — adding `draggable: true` later won't
11
- * touch existing v-model bindings.
10
+ * With `reorderable` a row moves among its siblings by dragging or with Move
11
+ * up and Move down. Both say the new position, and the buttons keep focus, so
12
+ * the tree works without a pointer (WCAG 2.2 SC 2.1.1, 2.5.7). Moving between
13
+ * parents is not offered. The host owns the tree through `v-model:nodes`, and
14
+ * saves on `move`.
12
15
  *
13
16
  * ```vue
14
17
  * <CnTreeView
@@ -42,7 +45,7 @@ import __sfc_main from './CnTreeNode.vue.js';
42
45
  */
43
46
  var script = {
44
47
  name: 'CnTreeView',
45
- components: { CnTreeNode: __sfc_main },
48
+ components: { CnTreeNode: __sfc_main, Draggable },
46
49
  props: {
47
50
  /**
48
51
  * Tree nodes (root level). Each node:
@@ -108,12 +111,55 @@ var script = {
108
111
  * the row selects its node, like a click. Off, rows are click-only.
109
112
  */
110
113
  focusableRows: { type: Boolean, default: false },
114
+ /** Rows can be moved among their siblings: a drag handle, Move up and Move down. */
115
+ reorderable: { type: Boolean, default: false },
116
+ /**
117
+ * Replacement texts for reordering, already translated: `moveUp`, `moveDown`, `drag`,
118
+ * `controlName` (`{action}`, `{label}`), `moved` (`{label}`, `{position}`, `{total}`).
119
+ */
120
+ reorderLabels: { type: Object, default: () => ({}) },
121
+ /** A status the host sets after saving a move, such as "Saved"; it replaces the spoken position. */
122
+ moveStatus: { type: String, default: '' },
111
123
  /** Expand all nodes on mount. */
112
124
  expandAllOnMount: { type: Boolean, default: false },
113
125
  },
114
126
 
115
- emits: ['select', 'update:expanded-ids', 'update:selected-id'],
127
+ emits: ['select', 'update:expanded-ids', 'update:selected-id', 'update:nodes', 'move'],
128
+
129
+ data() {
130
+ return {
131
+ announcement: '',
132
+ }
133
+ },
134
+
116
135
  computed: {
136
+ /** @return {object} The texts of the move controls, with library defaults. */
137
+ reorderTexts() {
138
+ return {
139
+ moveUp: translate('nextcloud-vue', 'Move up'),
140
+ moveDown: translate('nextcloud-vue', 'Move down'),
141
+ drag: translate('nextcloud-vue', 'Drag to reorder'),
142
+ controlName: translate('nextcloud-vue', '{action}: {label}'),
143
+ moved: translate('nextcloud-vue', '{label} moved to position {position} of {total}.'),
144
+ ...this.reorderLabels,
145
+ }
146
+ },
147
+
148
+ /**
149
+ * One entry when the status line shows. A `v-for` leaves no placeholder in the
150
+ * markup when off, which `v-if` would.
151
+ *
152
+ * @return {string[]} The keys.
153
+ */
154
+ statusSlots() {
155
+ return this.reorderable ? ['status'] : []
156
+ },
157
+
158
+ /** @return {string} What the status line says. */
159
+ statusText() {
160
+ return this.moveStatus || this.announcement
161
+ },
162
+
117
163
  /**
118
164
  * The `nodes` prop coerced to a real array. Guards against a parent
119
165
  * that passes `null` / `undefined` (or a non-array) while its data is
@@ -194,6 +240,112 @@ var script = {
194
240
  this.$emit('update:expanded-ids', next);
195
241
  },
196
242
 
243
+ /**
244
+ * A row at the root was dragged to another place.
245
+ *
246
+ * @param {{moved?: {element: object, oldIndex: number, newIndex: number}}} change What the drag changed.
247
+ * @return {void}
248
+ */
249
+ onRootDragChange({ moved } = {}) {
250
+ if (moved) {
251
+ this.moveNode({ node: moved.element, parentId: null, from: moved.oldIndex, to: moved.newIndex });
252
+ }
253
+ },
254
+
255
+ /**
256
+ * The nodes with one list of siblings in its new order. Only the path to
257
+ * that list is copied.
258
+ *
259
+ * @param {Array<object>} list The nodes at this level.
260
+ * @param {{parentId: string|number|null, from: number, to: number}} move The move.
261
+ * @return {Array<object>} The new nodes.
262
+ */
263
+ movedIn(list, { parentId, from, to }) {
264
+ if (parentId === null) {
265
+ const next = [...list];
266
+ next.splice(to, 0, next.splice(from, 1)[0]);
267
+ return next
268
+ }
269
+ return list.map((node) => {
270
+ const children = node[this.childrenKey];
271
+ if (!Array.isArray(children)) {
272
+ return node
273
+ }
274
+ const reordered = node[this.idKey] === parentId
275
+ ? this.movedIn(children, { parentId: null, from, to })
276
+ : this.movedIn(children, { parentId, from, to });
277
+ return { ...node, [this.childrenKey]: reordered }
278
+ })
279
+ },
280
+
281
+ /**
282
+ * The list of siblings a parent holds.
283
+ *
284
+ * @param {Array<object>} list The nodes to look in.
285
+ * @param {string|number|null} parentId The parent, or null for the root.
286
+ * @return {Array<object>|null} Its children.
287
+ */
288
+ siblingsOf(list, parentId) {
289
+ if (parentId === null) {
290
+ return list
291
+ }
292
+ for (const node of list) {
293
+ const children = node[this.childrenKey];
294
+ if (Array.isArray(children)) {
295
+ const found = node[this.idKey] === parentId ? children : this.siblingsOf(children, parentId);
296
+ if (found) {
297
+ return found
298
+ }
299
+ }
300
+ }
301
+ return null
302
+ },
303
+
304
+ /**
305
+ * Apply a move: give the host the new tree, say where the node landed, and
306
+ * after a button keep focus on that button, or on the other one at the end.
307
+ *
308
+ * @param {{node: object, parentId: string|number|null, from: number, to: number, byButton?: boolean}} move The move.
309
+ * @return {void}
310
+ */
311
+ moveNode({ node, parentId, from, to, byButton }) {
312
+ const nodes = this.movedIn(this.safeNodes, { parentId, from, to });
313
+ const siblings = this.siblingsOf(nodes, parentId);
314
+ if (!siblings || to < 0 || to >= siblings.length) {
315
+ return
316
+ }
317
+ this.$emit('update:nodes', nodes);
318
+ /**
319
+ * @event move A row moved. Save the order here.
320
+ * @type {{node: object, parentId: string|number|null, from: number, to: number, siblings: Array<object>}}
321
+ */
322
+ this.$emit('move', { node, parentId, from, to, siblings });
323
+ this.announcement = this.reorderTexts.moved
324
+ .replace('{label}', String(node[this.labelKey] ?? ''))
325
+ .replace('{position}', String(to + 1))
326
+ .replace('{total}', String(siblings.length));
327
+ if (byButton) {
328
+ this.$nextTick(() => this.focusMoveButton(node[this.idKey], to < from ? 'up' : 'down'));
329
+ }
330
+ },
331
+
332
+ /**
333
+ * Focus a row's move button, or its other one when that is disabled.
334
+ *
335
+ * @param {string|number} id The node.
336
+ * @param {string} direction `up` or `down`.
337
+ * @return {void}
338
+ */
339
+ focusMoveButton(id, direction) {
340
+ const row = [...this.$el.querySelectorAll('.cn-tree-node')]
341
+ .find((element) => element.dataset.nodeId === String(id))
342
+ ?.querySelector(':scope > .cn-tree-node__row');
343
+ const used = row?.querySelector(`[data-move="${direction}"]`);
344
+ const other = row?.querySelector(`[data-move="${direction === 'up' ? 'down' : 'up'}"]`);
345
+ const target = used && !used.disabled ? used : other;
346
+ target?.focus();
347
+ },
348
+
197
349
  /**
198
350
  * Select a node. Emits `@select` + `update:selected-id`.
199
351
  *
@@ -1 +1 @@
1
- {"version":3,"file":"CnTreeView.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n *\n * Per-node hooks, all off by default:\n * - `expandLabel` / `collapseLabel` take a function `(node) => string` for a\n * name per row, e.g. \"Expand {name}\".\n * - `toggleAttrs` and `rowAttrs` add attributes per node to the expand button\n * and the row (test ids, `data-*`, an active class, a role).\n * - `focusableRows` lets keyboard users reach a row and select it with\n * Enter or Space.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button, or `(node) => string` for a name per row. */\n\t\texpandLabel: { type: [String, Function], default: 'Expand' },\n\t\t/** A11y label for the collapse button, or `(node) => string` for a name per row. */\n\t\tcollapseLabel: { type: [String, Function], default: 'Collapse' },\n\t\t/**\n\t\t * Extra attributes for each row's expand button, as `(node, depth) => object`,\n\t\t * e.g. a test id per node. Null adds none.\n\t\t */\n\t\ttoggleAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Extra attributes for each row, as `(node, depth) => object`: a class,\n\t\t * `data-*` attributes, or a `role` and `aria-label`. `class` and `style`\n\t\t * merge with the row's own. Null adds none.\n\t\t */\n\t\trowAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Makes each row reachable with Tab (`tabindex=\"0\"`); Enter or Space on\n\t\t * the row selects its node, like a click. Off, rows are click-only.\n\t\t */\n\t\tfocusableRows: { type: Boolean, default: false },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["CnTreeNode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EAAA;AAChB,KAAA;AACD,KAAA;GACA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAA;;;;;AAK3B;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAA;GACrC;;AAED;AACC;AACA;;;EAGD,WAAW,GAAG;;;;;AAKb;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,EAAA;GACpC;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnTreeView.vue2.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<Draggable v-else-if=\"reorderable\"\n\t\t\t:modelValue=\"safeNodes\"\n\t\t\t:itemKey=\"idKey\"\n\t\t\ttag=\"ul\"\n\t\t\tclass=\"cn-tree-view__root\"\n\t\t\trole=\"tree\"\n\t\t\thandle=\".cn-tree-node__handle\"\n\t\t\t@change=\"onRootDragChange\">\n\t\t\t<template #item=\"{ element: node, index }\">\n\t\t\t\t<CnTreeNode :node=\"node\"\n\t\t\t\t\t:depth=\"0\"\n\t\t\t\t\t:indent=\"indent\"\n\t\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t\treorderable\n\t\t\t\t\t:reorderLabels=\"reorderTexts\"\n\t\t\t\t\t:siblingIndex=\"index\"\n\t\t\t\t\t:siblingCount=\"safeNodes.length\"\n\t\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t\t@select=\"selectNode\"\n\t\t\t\t\t@move=\"moveNode\">\n\t\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t\t</template>\n\t\t\t\t</CnTreeNode>\n\t\t\t</template>\n\t\t</Draggable>\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\n\t\t<p v-for=\"key in statusSlots\"\n\t\t\t:key=\"key\"\n\t\t\tclass=\"cn-tree-view__status\"\n\t\t\t:class=\"{ 'hidden-visually': !statusText }\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-tree-view-status\">\n\t\t\t{{ statusText }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport Draggable from 'vuedraggable'\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * With `reorderable` a row moves among its siblings by dragging or with Move\n * up and Move down. Both say the new position, and the buttons keep focus, so\n * the tree works without a pointer (WCAG 2.2 SC 2.1.1, 2.5.7). Moving between\n * parents is not offered. The host owns the tree through `v-model:nodes`, and\n * saves on `move`.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n *\n * Per-node hooks, all off by default:\n * - `expandLabel` / `collapseLabel` take a function `(node) => string` for a\n * name per row, e.g. \"Expand {name}\".\n * - `toggleAttrs` and `rowAttrs` add attributes per node to the expand button\n * and the row (test ids, `data-*`, an active class, a role).\n * - `focusableRows` lets keyboard users reach a row and select it with\n * Enter or Space.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode, Draggable },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button, or `(node) => string` for a name per row. */\n\t\texpandLabel: { type: [String, Function], default: 'Expand' },\n\t\t/** A11y label for the collapse button, or `(node) => string` for a name per row. */\n\t\tcollapseLabel: { type: [String, Function], default: 'Collapse' },\n\t\t/**\n\t\t * Extra attributes for each row's expand button, as `(node, depth) => object`,\n\t\t * e.g. a test id per node. Null adds none.\n\t\t */\n\t\ttoggleAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Extra attributes for each row, as `(node, depth) => object`: a class,\n\t\t * `data-*` attributes, or a `role` and `aria-label`. `class` and `style`\n\t\t * merge with the row's own. Null adds none.\n\t\t */\n\t\trowAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Makes each row reachable with Tab (`tabindex=\"0\"`); Enter or Space on\n\t\t * the row selects its node, like a click. Off, rows are click-only.\n\t\t */\n\t\tfocusableRows: { type: Boolean, default: false },\n\t\t/** Rows can be moved among their siblings: a drag handle, Move up and Move down. */\n\t\treorderable: { type: Boolean, default: false },\n\t\t/**\n\t\t * Replacement texts for reordering, already translated: `moveUp`, `moveDown`, `drag`,\n\t\t * `controlName` (`{action}`, `{label}`), `moved` (`{label}`, `{position}`, `{total}`).\n\t\t */\n\t\treorderLabels: { type: Object, default: () => ({}) },\n\t\t/** A status the host sets after saving a move, such as \"Saved\"; it replaces the spoken position. */\n\t\tmoveStatus: { type: String, default: '' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id', 'update:nodes', 'move'],\n\n\tdata() {\n\t\treturn {\n\t\t\tannouncement: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The texts of the move controls, with library defaults. */\n\t\treorderTexts() {\n\t\t\treturn {\n\t\t\t\tmoveUp: t('nextcloud-vue', 'Move up'),\n\t\t\t\tmoveDown: t('nextcloud-vue', 'Move down'),\n\t\t\t\tdrag: t('nextcloud-vue', 'Drag to reorder'),\n\t\t\t\tcontrolName: t('nextcloud-vue', '{action}: {label}'),\n\t\t\t\tmoved: t('nextcloud-vue', '{label} moved to position {position} of {total}.'),\n\t\t\t\t...this.reorderLabels,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * One entry when the status line shows. A `v-for` leaves no placeholder in the\n\t\t * markup when off, which `v-if` would.\n\t\t *\n\t\t * @return {string[]} The keys.\n\t\t */\n\t\tstatusSlots() {\n\t\t\treturn this.reorderable ? ['status'] : []\n\t\t},\n\n\t\t/** @return {string} What the status line says. */\n\t\tstatusText() {\n\t\t\treturn this.moveStatus || this.announcement\n\t\t},\n\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * A row at the root was dragged to another place.\n\t\t *\n\t\t * @param {{moved?: {element: object, oldIndex: number, newIndex: number}}} change What the drag changed.\n\t\t * @return {void}\n\t\t */\n\t\tonRootDragChange({ moved } = {}) {\n\t\t\tif (moved) {\n\t\t\t\tthis.moveNode({ node: moved.element, parentId: null, from: moved.oldIndex, to: moved.newIndex })\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The nodes with one list of siblings in its new order. Only the path to\n\t\t * that list is copied.\n\t\t *\n\t\t * @param {Array<object>} list The nodes at this level.\n\t\t * @param {{parentId: string|number|null, from: number, to: number}} move The move.\n\t\t * @return {Array<object>} The new nodes.\n\t\t */\n\t\tmovedIn(list, { parentId, from, to }) {\n\t\t\tif (parentId === null) {\n\t\t\t\tconst next = [...list]\n\t\t\t\tnext.splice(to, 0, next.splice(from, 1)[0])\n\t\t\t\treturn next\n\t\t\t}\n\t\t\treturn list.map((node) => {\n\t\t\t\tconst children = node[this.childrenKey]\n\t\t\t\tif (!Array.isArray(children)) {\n\t\t\t\t\treturn node\n\t\t\t\t}\n\t\t\t\tconst reordered = node[this.idKey] === parentId\n\t\t\t\t\t? this.movedIn(children, { parentId: null, from, to })\n\t\t\t\t\t: this.movedIn(children, { parentId, from, to })\n\t\t\t\treturn { ...node, [this.childrenKey]: reordered }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The list of siblings a parent holds.\n\t\t *\n\t\t * @param {Array<object>} list The nodes to look in.\n\t\t * @param {string|number|null} parentId The parent, or null for the root.\n\t\t * @return {Array<object>|null} Its children.\n\t\t */\n\t\tsiblingsOf(list, parentId) {\n\t\t\tif (parentId === null) {\n\t\t\t\treturn list\n\t\t\t}\n\t\t\tfor (const node of list) {\n\t\t\t\tconst children = node[this.childrenKey]\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\tconst found = node[this.idKey] === parentId ? children : this.siblingsOf(children, parentId)\n\t\t\t\t\tif (found) {\n\t\t\t\t\t\treturn found\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\t/**\n\t\t * Apply a move: give the host the new tree, say where the node landed, and\n\t\t * after a button keep focus on that button, or on the other one at the end.\n\t\t *\n\t\t * @param {{node: object, parentId: string|number|null, from: number, to: number, byButton?: boolean}} move The move.\n\t\t * @return {void}\n\t\t */\n\t\tmoveNode({ node, parentId, from, to, byButton }) {\n\t\t\tconst nodes = this.movedIn(this.safeNodes, { parentId, from, to })\n\t\t\tconst siblings = this.siblingsOf(nodes, parentId)\n\t\t\tif (!siblings || to < 0 || to >= siblings.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('update:nodes', nodes)\n\t\t\t/**\n\t\t\t * @event move A row moved. Save the order here.\n\t\t\t * @type {{node: object, parentId: string|number|null, from: number, to: number, siblings: Array<object>}}\n\t\t\t */\n\t\t\tthis.$emit('move', { node, parentId, from, to, siblings })\n\t\t\tthis.announcement = this.reorderTexts.moved\n\t\t\t\t.replace('{label}', String(node[this.labelKey] ?? ''))\n\t\t\t\t.replace('{position}', String(to + 1))\n\t\t\t\t.replace('{total}', String(siblings.length))\n\t\t\tif (byButton) {\n\t\t\t\tthis.$nextTick(() => this.focusMoveButton(node[this.idKey], to < from ? 'up' : 'down'))\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Focus a row's move button, or its other one when that is disabled.\n\t\t *\n\t\t * @param {string|number} id The node.\n\t\t * @param {string} direction `up` or `down`.\n\t\t * @return {void}\n\t\t */\n\t\tfocusMoveButton(id, direction) {\n\t\t\tconst row = [...this.$el.querySelectorAll('.cn-tree-node')]\n\t\t\t\t.find((element) => element.dataset.nodeId === String(id))\n\t\t\t\t?.querySelector(':scope > .cn-tree-node__row')\n\t\t\tconst used = row?.querySelector(`[data-move=\"${direction}\"]`)\n\t\t\tconst other = row?.querySelector(`[data-move=\"${direction === 'up' ? 'down' : 'up'}\"]`)\n\t\t\tconst target = used && !used.disabled ? used : other\n\t\t\ttarget?.focus()\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__status {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 8px 0 0;\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["CnTreeNode","t"],"mappings":";;;;AAqGA;;;;AAIC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;;;;;AAKD,aAAe;AACd,CAAA,IAAI,EAAE,YAAY;AAClB,CAAA,UAAU,EAAE,cAAEA,UAAU,EAAE,WAAW;AACrC,CAAA,KAAK,EAAE;AACN;AACC;AACA;AACA;;AAEA;;;;;AAKA;AACA;;AAED,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AACzC;;;;AAIC;;;AAGD,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AAC/C;;;AAGC;AACA;;;EAGD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM;AACrD;AACA,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;AAEtC,EAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;;AAE5C,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY;;AAElD,EAAA,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACrC;AACA,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;AACpC;AACA,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,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B;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAA;GACrC;;AAED;AACC;AACA;;;EAGD,WAAW,GAAG;;;;;AAKb;;AAEC;;;AAGD,GAAA,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,EAAA;GACpC;EACD;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, createSlots, withCtx, renderSlot, mergeProps } from 'vue';
1
+ import { resolveComponent, openBlock, createElementBlock, toDisplayString, createCommentVNode, createBlock, withCtx, createVNode, createSlots, renderSlot, normalizeProps, guardReactiveProps, Fragment, renderList, mergeProps, normalizeClass } from 'vue';
2
2
 
3
3
  const _hoisted_1 = {
4
4
  class: "cn-tree-view",
@@ -21,13 +21,14 @@ const _hoisted_5 = {
21
21
  class: "cn-tree-view__empty"
22
22
  };
23
23
  const _hoisted_6 = {
24
- key: 2,
24
+ key: 3,
25
25
  class: "cn-tree-view__root",
26
26
  role: "tree"
27
27
  };
28
28
 
29
29
  function render(_ctx, _cache, $props, $setup, $data, $options) {
30
30
  const _component_CnTreeNode = resolveComponent("CnTreeNode");
31
+ const _component_Draggable = resolveComponent("Draggable");
31
32
 
32
33
  return (openBlock(), createElementBlock("div", _hoisted_1, [
33
34
  ($props.title || $props.description)
@@ -42,43 +43,103 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
42
43
  : createCommentVNode("v-if", true),
43
44
  ($options.safeNodes.length === 0)
44
45
  ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString($props.emptyLabel), 1 /* TEXT */))
45
- : (openBlock(), createElementBlock("ul", _hoisted_6, [
46
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.safeNodes, (node) => {
47
- return (openBlock(), createBlock(_component_CnTreeNode, {
48
- key: node[$props.idKey],
49
- node: node,
50
- depth: 0,
51
- indent: $props.indent,
52
- expandedIds: $options.expandedMap,
53
- selectedId: $props.selectedId,
54
- idKey: $props.idKey,
55
- labelKey: $props.labelKey,
56
- childrenKey: $props.childrenKey,
57
- expandLabel: $props.expandLabel,
58
- collapseLabel: $props.collapseLabel,
59
- toggleAttrs: $props.toggleAttrs,
60
- rowAttrs: $props.rowAttrs,
61
- focusableRows: $props.focusableRows,
62
- onToggle: $options.toggleNode,
63
- onSelect: $options.selectNode
64
- }, createSlots({
65
- actions: withCtx((scope) => [
66
- renderSlot(_ctx.$slots, "actions", mergeProps({ ref_for: true }, scope))
67
- ]),
68
- _: 2 /* DYNAMIC */
69
- }, [
70
- (_ctx.$slots.label)
71
- ? {
72
- name: "label",
73
- fn: withCtx((scope) => [
74
- renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, scope))
75
- ]),
76
- key: "0"
77
- }
78
- : undefined
79
- ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "indent", "expandedIds", "selectedId", "idKey", "labelKey", "childrenKey", "expandLabel", "collapseLabel", "toggleAttrs", "rowAttrs", "focusableRows", "onToggle", "onSelect"]))
80
- }), 128 /* KEYED_FRAGMENT */))
81
- ]))
46
+ : ($props.reorderable)
47
+ ? (openBlock(), createBlock(_component_Draggable, {
48
+ key: 2,
49
+ modelValue: $options.safeNodes,
50
+ itemKey: $props.idKey,
51
+ tag: "ul",
52
+ class: "cn-tree-view__root",
53
+ role: "tree",
54
+ handle: ".cn-tree-node__handle",
55
+ onChange: $options.onRootDragChange
56
+ }, {
57
+ item: withCtx(({ element: node, index }) => [
58
+ createVNode(_component_CnTreeNode, {
59
+ node: node,
60
+ depth: 0,
61
+ indent: $props.indent,
62
+ expandedIds: $options.expandedMap,
63
+ selectedId: $props.selectedId,
64
+ idKey: $props.idKey,
65
+ labelKey: $props.labelKey,
66
+ childrenKey: $props.childrenKey,
67
+ expandLabel: $props.expandLabel,
68
+ collapseLabel: $props.collapseLabel,
69
+ toggleAttrs: $props.toggleAttrs,
70
+ rowAttrs: $props.rowAttrs,
71
+ focusableRows: $props.focusableRows,
72
+ reorderable: "",
73
+ reorderLabels: $options.reorderTexts,
74
+ siblingIndex: index,
75
+ siblingCount: $options.safeNodes.length,
76
+ onToggle: $options.toggleNode,
77
+ onSelect: $options.selectNode,
78
+ onMove: $options.moveNode
79
+ }, createSlots({
80
+ actions: withCtx((scope) => [
81
+ renderSlot(_ctx.$slots, "actions", normalizeProps(guardReactiveProps(scope)))
82
+ ]),
83
+ _: 2 /* DYNAMIC */
84
+ }, [
85
+ (_ctx.$slots.label)
86
+ ? {
87
+ name: "label",
88
+ fn: withCtx((scope) => [
89
+ renderSlot(_ctx.$slots, "label", normalizeProps(guardReactiveProps(scope)))
90
+ ]),
91
+ key: "0"
92
+ }
93
+ : undefined
94
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "indent", "expandedIds", "selectedId", "idKey", "labelKey", "childrenKey", "expandLabel", "collapseLabel", "toggleAttrs", "rowAttrs", "focusableRows", "reorderLabels", "siblingIndex", "siblingCount", "onToggle", "onSelect", "onMove"])
95
+ ]),
96
+ _: 3 /* FORWARDED */
97
+ }, 8 /* PROPS */, ["modelValue", "itemKey", "onChange"]))
98
+ : (openBlock(), createElementBlock("ul", _hoisted_6, [
99
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.safeNodes, (node) => {
100
+ return (openBlock(), createBlock(_component_CnTreeNode, {
101
+ key: node[$props.idKey],
102
+ node: node,
103
+ depth: 0,
104
+ indent: $props.indent,
105
+ expandedIds: $options.expandedMap,
106
+ selectedId: $props.selectedId,
107
+ idKey: $props.idKey,
108
+ labelKey: $props.labelKey,
109
+ childrenKey: $props.childrenKey,
110
+ expandLabel: $props.expandLabel,
111
+ collapseLabel: $props.collapseLabel,
112
+ toggleAttrs: $props.toggleAttrs,
113
+ rowAttrs: $props.rowAttrs,
114
+ focusableRows: $props.focusableRows,
115
+ onToggle: $options.toggleNode,
116
+ onSelect: $options.selectNode
117
+ }, createSlots({
118
+ actions: withCtx((scope) => [
119
+ renderSlot(_ctx.$slots, "actions", mergeProps({ ref_for: true }, scope))
120
+ ]),
121
+ _: 2 /* DYNAMIC */
122
+ }, [
123
+ (_ctx.$slots.label)
124
+ ? {
125
+ name: "label",
126
+ fn: withCtx((scope) => [
127
+ renderSlot(_ctx.$slots, "label", mergeProps({ ref_for: true }, scope))
128
+ ]),
129
+ key: "0"
130
+ }
131
+ : undefined
132
+ ]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["node", "indent", "expandedIds", "selectedId", "idKey", "labelKey", "childrenKey", "expandLabel", "collapseLabel", "toggleAttrs", "rowAttrs", "focusableRows", "onToggle", "onSelect"]))
133
+ }), 128 /* KEYED_FRAGMENT */))
134
+ ])),
135
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.statusSlots, (key) => {
136
+ return (openBlock(), createElementBlock("p", {
137
+ key: key,
138
+ class: normalizeClass(["cn-tree-view__status", { 'hidden-visually': !$options.statusText }]),
139
+ role: "status",
140
+ "data-testid": "cn-tree-view-status"
141
+ }, toDisplayString($options.statusText), 3 /* TEXT, CLASS */))
142
+ }), 128 /* KEYED_FRAGMENT */))
82
143
  ]))
83
144
  }
84
145
 
@@ -1 +1 @@
1
- {"version":3,"file":"CnTreeView.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue?vue&type=template&id=790ecd66&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\t</div>\n</template>\n\n<script>\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * Drag-drop reorder is intentionally a follow-up (issue #278).\n * The widget's public contract (props, events, selection model)\n * is forward-compatible — adding `draggable: true` later won't\n * touch existing v-model bindings.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n *\n * Per-node hooks, all off by default:\n * - `expandLabel` / `collapseLabel` take a function `(node) => string` for a\n * name per row, e.g. \"Expand {name}\".\n * - `toggleAttrs` and `rowAttrs` add attributes per node to the expand button\n * and the row (test ids, `data-*`, an active class, a role).\n * - `focusableRows` lets keyboard users reach a row and select it with\n * Enter or Space.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button, or `(node) => string` for a name per row. */\n\t\texpandLabel: { type: [String, Function], default: 'Expand' },\n\t\t/** A11y label for the collapse button, or `(node) => string` for a name per row. */\n\t\tcollapseLabel: { type: [String, Function], default: 'Collapse' },\n\t\t/**\n\t\t * Extra attributes for each row's expand button, as `(node, depth) => object`,\n\t\t * e.g. a test id per node. Null adds none.\n\t\t */\n\t\ttoggleAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Extra attributes for each row, as `(node, depth) => object`: a class,\n\t\t * `data-*` attributes, or a `role` and `aria-label`. `class` and `style`\n\t\t * merge with the row's own. Null adds none.\n\t\t */\n\t\trowAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Makes each row reachable with Tab (`tabindex=\"0\"`); Enter or Space on\n\t\t * the row selects its node, like a click. Off, rows are click-only.\n\t\t */\n\t\tfocusableRows: { type: Boolean, default: false },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id'],\n\tcomputed: {\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList","_createBlock","_withCtx","_renderSlot","_mergeProps"],"mappings":";;;AACM,EAAA,KAAK,EAAC,cAAe;AAAA,EAAA,aAAW,EAAC,cAAc;;;;AACf,EAAA,KAAK,EAAC,sBAAsB;;;;AAC9C,EAAA,KAAK,EAAC,qBAAqB;;;;AAGtB,EAAA,KAAK,EAAC,2BAA2B;;;;AAKvB,EAAA,KAAK,EAAC,qBAAqB;;;;AAIjD,EAAA,KAAK,EAAC,oBAAmB;AAAE,EAAA,IAAI,EAAC,MAAM;;;;;;AAdlD,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,CA6CK,OA7CL,UA6CK,EAAA;AA5CU,IAAA,CAAA,MAAA,CAAA,KAAI,IAAK,MAAW,CAAA,WAAA;AAAlC,SAAAD,SAAA,EAAA,EAAAC,kBAAA,CAOQ,UAPR,UAOQ,EAAA;WANG,MAAK,CAAA,KAAA;4BAAfA,kBAEI,CAAA,IAAA,EAFJ,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AHb,KAAA;gBAGxBC,UAAqC,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAArCC,UAAqC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;AAEnB,cAAA,CAAA,IAAA,CAAA,MAAM,CAAC,KAAK;;0BAAG,OAAK;AAInC,oBAAA,EAAA,EAAAF,OAAA,CAAA,CAJqC,KAAK,KAAA;sBAI1CC,UAAmC,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,EAAnCC,UAAmC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CnTreeView.vue3.js","sources":["../../../../src/components/CnTreeView/CnTreeView.vue?vue&type=template&id=5e1d084c&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-tree-view\" data-testid=\"cn-tree-view\">\n\t\t<header v-if=\"title || description\" class=\"cn-tree-view__header\">\n\t\t\t<h3 v-if=\"title\" class=\"cn-tree-view__title\">\n\t\t\t\t{{ title }}\n\t\t\t</h3>\n\t\t\t<p v-if=\"description\" class=\"cn-tree-view__description\">\n\t\t\t\t{{ description }}\n\t\t\t</p>\n\t\t</header>\n\n\t\t<p v-if=\"safeNodes.length === 0\" class=\"cn-tree-view__empty\">\n\t\t\t{{ emptyLabel }}\n\t\t</p>\n\n\t\t<Draggable v-else-if=\"reorderable\"\n\t\t\t:modelValue=\"safeNodes\"\n\t\t\t:itemKey=\"idKey\"\n\t\t\ttag=\"ul\"\n\t\t\tclass=\"cn-tree-view__root\"\n\t\t\trole=\"tree\"\n\t\t\thandle=\".cn-tree-node__handle\"\n\t\t\t@change=\"onRootDragChange\">\n\t\t\t<template #item=\"{ element: node, index }\">\n\t\t\t\t<CnTreeNode :node=\"node\"\n\t\t\t\t\t:depth=\"0\"\n\t\t\t\t\t:indent=\"indent\"\n\t\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t\treorderable\n\t\t\t\t\t:reorderLabels=\"reorderTexts\"\n\t\t\t\t\t:siblingIndex=\"index\"\n\t\t\t\t\t:siblingCount=\"safeNodes.length\"\n\t\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t\t@select=\"selectNode\"\n\t\t\t\t\t@move=\"moveNode\">\n\t\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t\t</template>\n\t\t\t\t</CnTreeNode>\n\t\t\t</template>\n\t\t</Draggable>\n\t\t<ul v-else class=\"cn-tree-view__root\" role=\"tree\">\n\t\t\t<CnTreeNode v-for=\"node in safeNodes\"\n\t\t\t\t:key=\"node[idKey]\"\n\t\t\t\t:node=\"node\"\n\t\t\t\t:depth=\"0\"\n\t\t\t\t:indent=\"indent\"\n\t\t\t\t:expandedIds=\"expandedMap\"\n\t\t\t\t:selectedId=\"selectedId\"\n\t\t\t\t:idKey=\"idKey\"\n\t\t\t\t:labelKey=\"labelKey\"\n\t\t\t\t:childrenKey=\"childrenKey\"\n\t\t\t\t:expandLabel=\"expandLabel\"\n\t\t\t\t:collapseLabel=\"collapseLabel\"\n\t\t\t\t:toggleAttrs=\"toggleAttrs\"\n\t\t\t\t:rowAttrs=\"rowAttrs\"\n\t\t\t\t:focusableRows=\"focusableRows\"\n\t\t\t\t@toggle=\"toggleNode\"\n\t\t\t\t@select=\"selectNode\">\n\t\t\t\t<template #actions=\"scope\">\n\t\t\t\t\t<!-- @slot actions Per-row actions. Scope:\n\t\t\t\t\t { node, depth }. -->\n\t\t\t\t\t<slot name=\"actions\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"$slots.label\" #label=\"scope\">\n\t\t\t\t\t<!-- @slot label Replaces the label text of every row. Scope:\n\t\t\t\t\t { node, depth, expanded }. Unused, the row shows\n\t\t\t\t\t `node[labelKey]`. -->\n\t\t\t\t\t<slot name=\"label\" v-bind=\"scope\" />\n\t\t\t\t</template>\n\t\t\t</CnTreeNode>\n\t\t</ul>\n\n\t\t<p v-for=\"key in statusSlots\"\n\t\t\t:key=\"key\"\n\t\t\tclass=\"cn-tree-view__status\"\n\t\t\t:class=\"{ 'hidden-visually': !statusText }\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-tree-view-status\">\n\t\t\t{{ statusText }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport Draggable from 'vuedraggable'\nimport CnTreeNode from './CnTreeNode.vue'\n\n/**\n * CnTreeView — Recursive hierarchical tree widget. Renders nested\n * nodes with click-to-expand carets, optional badges + icons,\n * inline per-row actions slot, and select-on-click semantics.\n *\n * With `reorderable` a row moves among its siblings by dragging or with Move\n * up and Move down. Both say the new position, and the buttons keep focus, so\n * the tree works without a pointer (WCAG 2.2 SC 2.1.1, 2.5.7). Moving between\n * parents is not offered. The host owns the tree through `v-model:nodes`, and\n * saves on `move`.\n *\n * ```vue\n * <CnTreeView\n * :nodes=\"[\n * { id: 1, label: 'Knowledge base', children: [\n * { id: 2, label: 'How-tos', children: [\n * { id: 3, label: 'Reset password' },\n * ] },\n * { id: 4, label: 'Reference' },\n * ] },\n * ]\"\n * v-model:expanded-ids=\"expanded\"\n * v-model:selected-id=\"selected\"\n * @select=\"onSelect\" />\n * ```\n *\n * Slots:\n * - `#actions` — inline per-row actions (e.g. edit / delete\n * buttons). Scope: `{ node, depth }`.\n * - `#label` — the label of every row, for an icon, a marker or a test id\n * next to the text. Scope: `{ node, depth, expanded }`. Unused, the row\n * shows `node[labelKey]`.\n *\n * Per-node hooks, all off by default:\n * - `expandLabel` / `collapseLabel` take a function `(node) => string` for a\n * name per row, e.g. \"Expand {name}\".\n * - `toggleAttrs` and `rowAttrs` add attributes per node to the expand button\n * and the row (test ids, `data-*`, an active class, a role).\n * - `focusableRows` lets keyboard users reach a row and select it with\n * Enter or Space.\n */\nexport default {\n\tname: 'CnTreeView',\n\tcomponents: { CnTreeNode, Draggable },\n\tprops: {\n\t\t/**\n\t\t * Tree nodes (root level). Each node:\n\t\t * `{ id, label, children?, icon?, badge? }`. The keys\n\t\t * `id`, `label`, `children` are configurable via the\n\t\t * `*Key` props.\n\t\t *\n\t\t * Defaults to an empty array and is null-guarded (see `safeNodes`)\n\t\t * so a parent that hasn't loaded its data yet — passing `undefined`\n\t\t * or `null` — renders the empty state instead of throwing on\n\t\t * `nodes.length` during render (ADR-062: never crash a detail page).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tnodes: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Set of currently-expanded node ids. Pass with `.sync`\n\t\t * (or `:expanded-ids` + `@update:expanded-ids`) to control\n\t\t * expansion state from the parent.\n\t\t *\n\t\t * @type {Array<string|number>}\n\t\t */\n\t\texpandedIds: { type: Array, default: () => [] },\n\t\t/**\n\t\t * Currently-selected node id (or null). Node ids are read off\n\t\t * `node[idKey]`, so the same `string | number` domain as `expandedIds`.\n\t\t * Pass with `.sync`.\n\t\t *\n\t\t * @type {string|number|null}\n\t\t */\n\t\tselectedId: { type: [String, Number], default: null },\n\t\t/** Override the `id` key on node objects. */\n\t\tidKey: { type: String, default: 'id' },\n\t\t/** Override the `label` key. */\n\t\tlabelKey: { type: String, default: 'label' },\n\t\t/** Override the `children` key. */\n\t\tchildrenKey: { type: String, default: 'children' },\n\t\t/** Indent per depth (px). */\n\t\tindent: { type: Number, default: 18 },\n\t\t/** Optional title rendered above the tree. */\n\t\ttitle: { type: String, default: '' },\n\t\t/** Optional description rendered under the title. */\n\t\tdescription: { type: String, default: '' },\n\t\t/** Empty-state text when nodes[] is empty. */\n\t\temptyLabel: { type: String, default: 'No items.' },\n\t\t/** A11y label for the expand button, or `(node) => string` for a name per row. */\n\t\texpandLabel: { type: [String, Function], default: 'Expand' },\n\t\t/** A11y label for the collapse button, or `(node) => string` for a name per row. */\n\t\tcollapseLabel: { type: [String, Function], default: 'Collapse' },\n\t\t/**\n\t\t * Extra attributes for each row's expand button, as `(node, depth) => object`,\n\t\t * e.g. a test id per node. Null adds none.\n\t\t */\n\t\ttoggleAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Extra attributes for each row, as `(node, depth) => object`: a class,\n\t\t * `data-*` attributes, or a `role` and `aria-label`. `class` and `style`\n\t\t * merge with the row's own. Null adds none.\n\t\t */\n\t\trowAttrs: { type: Function, default: null },\n\t\t/**\n\t\t * Makes each row reachable with Tab (`tabindex=\"0\"`); Enter or Space on\n\t\t * the row selects its node, like a click. Off, rows are click-only.\n\t\t */\n\t\tfocusableRows: { type: Boolean, default: false },\n\t\t/** Rows can be moved among their siblings: a drag handle, Move up and Move down. */\n\t\treorderable: { type: Boolean, default: false },\n\t\t/**\n\t\t * Replacement texts for reordering, already translated: `moveUp`, `moveDown`, `drag`,\n\t\t * `controlName` (`{action}`, `{label}`), `moved` (`{label}`, `{position}`, `{total}`).\n\t\t */\n\t\treorderLabels: { type: Object, default: () => ({}) },\n\t\t/** A status the host sets after saving a move, such as \"Saved\"; it replaces the spoken position. */\n\t\tmoveStatus: { type: String, default: '' },\n\t\t/** Expand all nodes on mount. */\n\t\texpandAllOnMount: { type: Boolean, default: false },\n\t},\n\n\temits: ['select', 'update:expanded-ids', 'update:selected-id', 'update:nodes', 'move'],\n\n\tdata() {\n\t\treturn {\n\t\t\tannouncement: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The texts of the move controls, with library defaults. */\n\t\treorderTexts() {\n\t\t\treturn {\n\t\t\t\tmoveUp: t('nextcloud-vue', 'Move up'),\n\t\t\t\tmoveDown: t('nextcloud-vue', 'Move down'),\n\t\t\t\tdrag: t('nextcloud-vue', 'Drag to reorder'),\n\t\t\t\tcontrolName: t('nextcloud-vue', '{action}: {label}'),\n\t\t\t\tmoved: t('nextcloud-vue', '{label} moved to position {position} of {total}.'),\n\t\t\t\t...this.reorderLabels,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * One entry when the status line shows. A `v-for` leaves no placeholder in the\n\t\t * markup when off, which `v-if` would.\n\t\t *\n\t\t * @return {string[]} The keys.\n\t\t */\n\t\tstatusSlots() {\n\t\t\treturn this.reorderable ? ['status'] : []\n\t\t},\n\n\t\t/** @return {string} What the status line says. */\n\t\tstatusText() {\n\t\t\treturn this.moveStatus || this.announcement\n\t\t},\n\n\t\t/**\n\t\t * The `nodes` prop coerced to a real array. Guards against a parent\n\t\t * that passes `null` / `undefined` (or a non-array) while its data is\n\t\t * still loading — Vue only applies the prop default for `undefined`,\n\t\t * so an explicit `null` would otherwise reach `nodes.length` and throw\n\t\t * during render.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tsafeNodes() {\n\t\t\treturn Array.isArray(this.nodes) ? this.nodes : []\n\t\t},\n\n\t\t/**\n\t\t * `expandedIds[]` lifted to an object map for O(1) lookups\n\t\t * inside the recursive node.\n\t\t *\n\t\t * @return {Record<string,true>}\n\t\t */\n\t\texpandedMap() {\n\t\t\tconst out = {}\n\t\t\tfor (const id of this.expandedIds) {\n\t\t\t\tout[id] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.expandAllOnMount) {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Toggle a node's expanded state by id. Emits\n\t\t * `update:expanded-ids` with the new array.\n\t\t *\n\t\t * @param {string|number} id Node id.\n\t\t * @return {void}\n\t\t */\n\t\ttoggleNode(id) {\n\t\t\tconst next = [...this.expandedIds]\n\t\t\tconst idx = next.indexOf(id)\n\t\t\tif (idx >= 0) {\n\t\t\t\tnext.splice(idx, 1)\n\t\t\t} else {\n\t\t\t\tnext.push(id)\n\t\t\t}\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', next)\n\t\t},\n\n\t\t/**\n\t\t * A row at the root was dragged to another place.\n\t\t *\n\t\t * @param {{moved?: {element: object, oldIndex: number, newIndex: number}}} change What the drag changed.\n\t\t * @return {void}\n\t\t */\n\t\tonRootDragChange({ moved } = {}) {\n\t\t\tif (moved) {\n\t\t\t\tthis.moveNode({ node: moved.element, parentId: null, from: moved.oldIndex, to: moved.newIndex })\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The nodes with one list of siblings in its new order. Only the path to\n\t\t * that list is copied.\n\t\t *\n\t\t * @param {Array<object>} list The nodes at this level.\n\t\t * @param {{parentId: string|number|null, from: number, to: number}} move The move.\n\t\t * @return {Array<object>} The new nodes.\n\t\t */\n\t\tmovedIn(list, { parentId, from, to }) {\n\t\t\tif (parentId === null) {\n\t\t\t\tconst next = [...list]\n\t\t\t\tnext.splice(to, 0, next.splice(from, 1)[0])\n\t\t\t\treturn next\n\t\t\t}\n\t\t\treturn list.map((node) => {\n\t\t\t\tconst children = node[this.childrenKey]\n\t\t\t\tif (!Array.isArray(children)) {\n\t\t\t\t\treturn node\n\t\t\t\t}\n\t\t\t\tconst reordered = node[this.idKey] === parentId\n\t\t\t\t\t? this.movedIn(children, { parentId: null, from, to })\n\t\t\t\t\t: this.movedIn(children, { parentId, from, to })\n\t\t\t\treturn { ...node, [this.childrenKey]: reordered }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The list of siblings a parent holds.\n\t\t *\n\t\t * @param {Array<object>} list The nodes to look in.\n\t\t * @param {string|number|null} parentId The parent, or null for the root.\n\t\t * @return {Array<object>|null} Its children.\n\t\t */\n\t\tsiblingsOf(list, parentId) {\n\t\t\tif (parentId === null) {\n\t\t\t\treturn list\n\t\t\t}\n\t\t\tfor (const node of list) {\n\t\t\t\tconst children = node[this.childrenKey]\n\t\t\t\tif (Array.isArray(children)) {\n\t\t\t\t\tconst found = node[this.idKey] === parentId ? children : this.siblingsOf(children, parentId)\n\t\t\t\t\tif (found) {\n\t\t\t\t\t\treturn found\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\t/**\n\t\t * Apply a move: give the host the new tree, say where the node landed, and\n\t\t * after a button keep focus on that button, or on the other one at the end.\n\t\t *\n\t\t * @param {{node: object, parentId: string|number|null, from: number, to: number, byButton?: boolean}} move The move.\n\t\t * @return {void}\n\t\t */\n\t\tmoveNode({ node, parentId, from, to, byButton }) {\n\t\t\tconst nodes = this.movedIn(this.safeNodes, { parentId, from, to })\n\t\t\tconst siblings = this.siblingsOf(nodes, parentId)\n\t\t\tif (!siblings || to < 0 || to >= siblings.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$emit('update:nodes', nodes)\n\t\t\t/**\n\t\t\t * @event move A row moved. Save the order here.\n\t\t\t * @type {{node: object, parentId: string|number|null, from: number, to: number, siblings: Array<object>}}\n\t\t\t */\n\t\t\tthis.$emit('move', { node, parentId, from, to, siblings })\n\t\t\tthis.announcement = this.reorderTexts.moved\n\t\t\t\t.replace('{label}', String(node[this.labelKey] ?? ''))\n\t\t\t\t.replace('{position}', String(to + 1))\n\t\t\t\t.replace('{total}', String(siblings.length))\n\t\t\tif (byButton) {\n\t\t\t\tthis.$nextTick(() => this.focusMoveButton(node[this.idKey], to < from ? 'up' : 'down'))\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Focus a row's move button, or its other one when that is disabled.\n\t\t *\n\t\t * @param {string|number} id The node.\n\t\t * @param {string} direction `up` or `down`.\n\t\t * @return {void}\n\t\t */\n\t\tfocusMoveButton(id, direction) {\n\t\t\tconst row = [...this.$el.querySelectorAll('.cn-tree-node')]\n\t\t\t\t.find((element) => element.dataset.nodeId === String(id))\n\t\t\t\t?.querySelector(':scope > .cn-tree-node__row')\n\t\t\tconst used = row?.querySelector(`[data-move=\"${direction}\"]`)\n\t\t\tconst other = row?.querySelector(`[data-move=\"${direction === 'up' ? 'down' : 'up'}\"]`)\n\t\t\tconst target = used && !used.disabled ? used : other\n\t\t\ttarget?.focus()\n\t\t},\n\n\t\t/**\n\t\t * Select a node. Emits `@select` + `update:selected-id`.\n\t\t *\n\t\t * @param {object} node The node.\n\t\t * @return {void}\n\t\t */\n\t\tselectNode(node) {\n\t\t\t// Description above the tag — see the note on `update:expanded-ids`.\n\t\t\t/**\n\t\t\t * `v-model:selected-id` counterpart. Payload is the new id (or null).\n\t\t\t *\n\t\t\t * @event update:selected-id\n\t\t\t */\n\t\t\tthis.$emit('update:selected-id', node[this.idKey])\n\t\t\t/**\n\t\t\t * @event select Emitted on row click. Payload is the\n\t\t\t * selected node object.\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('select', node)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically expand every node in the tree.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\texpandAll() {\n\t\t\tconst ids = []\n\t\t\tconst walk = (n) => {\n\t\t\t\tids.push(n[this.idKey])\n\t\t\t\tconst cs = n[this.childrenKey]\n\t\t\t\tif (Array.isArray(cs)) {\n\t\t\t\t\tcs.forEach(walk)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.safeNodes.forEach(walk)\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', ids)\n\t\t},\n\n\t\t/**\n\t\t * Programmatically collapse every node.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcollapseAll() {\n\t\t\t// Description goes ABOVE `@event`, not inline after it:\n\t\t\t// vue-docgen-api's event-name splitter stops at the first `:`, so\n\t\t\t// `@event update:expanded-ids <description>` is read as one long\n\t\t\t// event NAME and the generated docs show an empty description.\n\t\t\t/**\n\t\t\t * `v-model:expanded-ids` counterpart. Payload is the new full set.\n\t\t\t *\n\t\t\t * @event update:expanded-ids\n\t\t\t */\n\t\t\tthis.$emit('update:expanded-ids', [])\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-tree-view {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-tree-view__title {\n\tmargin: 0;\n\tfont-size: 1.1em;\n}\n\n.cn-tree-view__description {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-tree-view__status {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 8px 0 0;\n}\n\n.cn-tree-view__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-style: italic;\n\tmargin: 16px 0;\n\ttext-align: center;\n}\n\n.cn-tree-view__root {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_toDisplayString","_createBlock","_withCtx","_createVNode","_renderSlot","_Fragment","_renderList","_mergeProps","_normalizeClass"],"mappings":";;;AACM,EAAA,KAAK,EAAC,cAAe;AAAA,EAAA,aAAW,EAAC,cAAc;;;;AACf,EAAA,KAAK,EAAC,sBAAsB;;;;AAC9C,EAAA,KAAK,EAAC,qBAAqB;;;;AAGtB,EAAA,KAAK,EAAC,2BAA2B;;;;AAKvB,EAAA,KAAK,EAAC,qBAAqB;;;;AA0CjD,EAAA,KAAK,EAAC,oBAAmB;AAAE,EAAA,IAAI,EAAC,MAAM;;;;;;;AApDlD,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,CA4FK,OA5FL,UA4FK,EAAA;AA3FU,IAAA,CAAA,MAAA,CAAA,KAAI,IAAK,MAAW,CAAA,WAAA;AAAlC,SAAAD,SAAA,EAAA,EAAAC,kBAAA,CAOQ,UAPR,UAOQ,EAAA;WANG,MAAK,CAAA,KAAA;4BAAfA,kBAEI,CAAA,IAAA,EAFJ,UAEI,EAAAC,eAAA,CADA;;WAEK,MAAW,CAAA,WAAA;4BAApBD,kBAEG,CAAA,GAAA,EAFH,UAEG,EAAAC,eAAA,CADC,MAAU,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;;;AAIN,IAAA,CAAA,QAAA,CAAA,SAAS,CAAC,MAAK,KAAA,CAAA;sBAAxBD,kBAEG,CAAA,GAAA,EAFH,UAEG,EAAAC,eAAA,CADC,MAAS,CAAA,UAAA,CAAA,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AAM,EAAE,QAAU,CAAA,UAAA;;gBACR,OAAO,EAAAC,OAAA,CAGjB,CAAqC,KAHb,KAAA;kBAGxBE,UAAqC,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAArCG,UAAqC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;AAEnB,gBAAA,CAAA,IAAA,CAAA,MAAM,CAAC,KAAK;;4BAAG,OAAK;AAInC,sBAAA,EAAA,EAAAL,OAAA,CAAA,CAJqC,KAAK,KAAA;wBAI1CE,UAAmC,CAAA,IAAA,CAAA,MAAA,EAAA,OAAA,EAAnCG,UAAmC,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAR,KAAK,CAAA,CAAA;;;;;;;;sBAKnCR,kBAOG,CAAAM,QAAA,EAAA,IAAA,EAAAC,UAAA,CAPc,QAAW,CAAA,WAAA,EAAA,CAAlB,GAAE,KAAA;2BAAZP,kBAOG,CAAA,GAAA,EAAA;AAND,QAAA,GAAG,EAAE,GAAG;QACT,KAAK,EAAAS,cAAA,CAAA,CAAC,sBAAqB,EAAA,EAAA,iBAAA,EAAA,CACG;AAC9B,QAAA,IAAI,EAAC,QAAO;AACZ,QAAA,aAAW,EAAC,qBAAqB;yBAC9B,QAAS,CAAA,UAAA,CAAA,EAAA,CAAA,mBAAA,CAAA;;;;;;;"}
package/dist/esm/index.js CHANGED
@@ -22,6 +22,7 @@ export { SAFE_MARKDOWN_DOMPURIFY_CONFIG } from './utils/safeMarkdownDompurifyCon
22
22
  export { FOLDER_COLORS, FOLDER_ICONS, folderColorTint, resolveFolderColor, resolveFolderIcon, searchFolderIcons } from './utils/folderCustomization.js';
23
23
  export { currentTheme, useCurrentTheme } from './composables/useCurrentTheme.js';
24
24
  export { ROADMAP_LABEL_BLOCKLIST } from './utils/roadmapLabelBlocklist.js';
25
+ export { encodeQr } from './utils/qr.js';
25
26
  export { humaniseRuleKey, notificationRuleLabel } from './utils/notificationRuleLabel.js';
26
27
  export { readTransitionInputs } from './utils/transitionInputs.js';
27
28
  export { conditionSentence, formatConditionValue, operatorLabel, operatorTakesValue, operatorsForType } from './components/CnConditionListEditor/conditionOperators.js';
@@ -79,6 +80,7 @@ export { default as CnAttentionFlagWidget } from './components/CnAttentionFlagWi
79
80
  export { default as CnAuditTrailCard } from './components/CnAuditTrailCard/CnAuditTrailCard.vue.js';
80
81
  export { default as CnAuditTrailWidget } from './components/CnAuditTrailWidget/CnAuditTrailWidget.vue.js';
81
82
  export { default as CnBannerWidget } from './components/CnBannerWidget/CnBannerWidget.vue.js';
83
+ export { default as CnBlockListEditor } from './components/CnBlockListEditor/CnBlockListEditor.vue.js';
82
84
  export { default as CnBoardView } from './components/CnBoardView/CnBoardView.vue.js';
83
85
  export { default as CnBodySections } from './components/CnBodySections/CnBodySections.vue.js';
84
86
  export { default as CnBreadcrumbs } from './components/CnBreadcrumbs/CnBreadcrumbs.vue.js';
@@ -100,6 +102,7 @@ export { default as CnChildRecordsField } from './components/CnChildRecordsField
100
102
  export { default as CnChipListManager } from './components/CnChipListManager/CnChipListManager.vue.js';
101
103
  export { default as CnChipsFieldWidget } from './components/CnChipsFieldWidget/CnChipsFieldWidget.vue.js';
102
104
  export { default as CnChoiceCards } from './components/CnChoiceCards/CnChoiceCards.vue.js';
105
+ export { default as CnChoiceMatrix } from './components/CnChoiceMatrix/CnChoiceMatrix.vue.js';
103
106
  export { default as CnChoicePickerWidget } from './components/CnChoicePickerWidget/CnChoicePickerWidget.vue.js';
104
107
  export { default as CnColorPicker } from './components/CnColorPicker/CnColorPicker.vue.js';
105
108
  export { default as CnCommandPalette } from './components/CnCommandPalette/CnCommandPalette.vue.js';
@@ -147,6 +150,7 @@ export { default as CnDeviceFramesWidget } from './components/CnDeviceFramesWidg
147
150
  export { default as CnDialog } from './components/CnDialog/CnDialog.vue.js';
148
151
  export { default as CnDialogActions } from './components/CnDialogActions/CnDialogActions.vue.js';
149
152
  export { default as CnDialogHeader } from './components/CnDialogHeader/CnDialogHeader.vue.js';
153
+ export { default as CnDisplayScreen } from './components/CnDisplayScreen/CnDisplayScreen.vue.js';
150
154
  export { default as CnDividerWidget } from './components/CnDividerWidget/CnDividerWidget.vue.js';
151
155
  export { default as CnDividerWidgetForm } from './components/CnDividerWidgetForm/CnDividerWidgetForm.vue.js';
152
156
  export { default as CnDocumentReviewList } from './components/CnDocumentReviewList/CnDocumentReviewList.vue.js';
@@ -205,6 +209,7 @@ export { default as CnFormDialog } from './components/CnFormDialog/CnFormDialog.
205
209
  export { default as CnFormWidgetBase } from './components/CnFormWidgetBase/CnFormWidgetBase.vue.js';
206
210
  export { default as CnGaugeWidget } from './components/CnGaugeWidget/CnGaugeWidget.vue.js';
207
211
  export { default as CnGaugeWidgetForm } from './components/CnGaugeWidgetForm/CnGaugeWidgetForm.vue.js';
212
+ export { default as CnGeoCaptureField } from './components/CnGeoCaptureField/CnGeoCaptureField.vue.js';
208
213
  export { default as CnGraphCanvas } from './components/CnGraphCanvas/CnGraphCanvas.vue.js';
209
214
  export { default as CnGroupedCardsWidget } from './components/CnGroupedCardsWidget/CnGroupedCardsWidget.vue.js';
210
215
  export { default as CnGroupedMenu } from './components/CnGroupedMenu/CnGroupedMenu.vue.js';
@@ -315,6 +320,7 @@ export { default as CnProgressBar } from './components/CnProgressBar/CnProgressB
315
320
  export { default as CnPropertiesTab } from './components/CnAdvancedFormDialog/CnPropertiesTab.vue.js';
316
321
  export { default as CnPropertySourceField } from './components/CnPropertySourceField/CnPropertySourceField.vue.js';
317
322
  export { default as CnPropertyValueCell } from './components/CnAdvancedFormDialog/CnPropertyValueCell.vue.js';
323
+ export { default as CnQrCode } from './components/CnQrCode/CnQrCode.vue.js';
318
324
  export { default as CnQuickFilterBar } from './components/CnQuickFilterBar/CnQuickFilterBar.vue.js';
319
325
  export { default as CnQuicklinksWidget } from './components/CnQuicklinksWidget/CnQuicklinksWidget.vue.js';
320
326
  export { default as CnQuicklinksWidgetForm } from './components/CnQuicklinksWidgetForm/CnQuicklinksWidgetForm.vue.js';
@@ -334,6 +340,7 @@ export { default as CnRelationLinkModal } from './dialogs/CnRelationLinkModal.vu
334
340
  export { default as CnRelationshipGraph } from './components/CnRelationshipGraph/CnRelationshipGraph.vue.js';
335
341
  export { default as CnResourceSelect } from './components/CnResourceSelect/CnResourceSelect.vue.js';
336
342
  export { default as CnRetentionWidget } from './components/CnRetentionWidget/CnRetentionWidget.vue.js';
343
+ export { default as CnRevealField } from './components/CnRevealField/CnRevealField.vue.js';
337
344
  export { default as CnRichSubmitDialog } from './components/CnRichSubmitDialog/CnRichSubmitDialog.vue.js';
338
345
  export { default as CnRoadmapItem } from './components/CnRoadmapItem/CnRoadmapItem.vue.js';
339
346
  export { default as CnRoadmapTab } from './components/CnRoadmapTab/CnRoadmapTab.vue.js';
@@ -411,6 +418,7 @@ export { default as CnTimelineStages } from './components/CnTimelineStages/CnTim
411
418
  export { default as CnTimelineView } from './components/CnTimelineView/CnTimelineView.vue.js';
412
419
  export { default as CnTimelineWidget } from './components/CnTimelineWidget/CnTimelineWidget.vue.js';
413
420
  export { default as CnToggleTableWidget } from './components/CnToggleTableWidget/CnToggleTableWidget.vue.js';
421
+ export { default as CnTransferCard } from './components/CnTransferCard/CnTransferCard.vue.js';
414
422
  export { default as CnTransitionInputFields } from './components/CnTransitionInputFields/CnTransitionInputFields.vue.js';
415
423
  export { default as CnTranslatedBadge } from './components/CnTranslatedBadge/CnTranslatedBadge.vue.js';
416
424
  export { default as CnTreeView } from './components/CnTreeView/CnTreeView.vue.js';