@conduction/nextcloud-vue 2.84.0 → 2.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue.js +1 -1
  2. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue2.js +131 -3
  3. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue2.js.map +1 -1
  4. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue3.js +54 -18
  5. package/dist/esm/components/CnAdminSettingsShell/CnAdminSettingsShell.vue3.js.map +1 -1
  6. package/dist/esm/components/CnBoardView/CnBoardView.vue.js +1 -1
  7. package/dist/esm/components/CnBoardView/CnBoardView.vue2.js +232 -4
  8. package/dist/esm/components/CnBoardView/CnBoardView.vue2.js.map +1 -1
  9. package/dist/esm/components/CnBoardView/CnBoardView.vue3.js +95 -51
  10. package/dist/esm/components/CnBoardView/CnBoardView.vue3.js.map +1 -1
  11. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
  12. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js +114 -0
  13. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js.map +1 -1
  14. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js +2 -2
  15. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js.map +1 -1
  16. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  17. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +45 -0
  18. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  19. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +22 -12
  20. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  21. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +23 -4
  22. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  23. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  24. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
  25. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +3 -1
  26. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
  27. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
  28. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
  29. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +18 -5
  30. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
  31. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
  32. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +548 -77
  33. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  34. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +191 -82
  35. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  36. package/dist/esm/components/CnIndexPage/useSelfFetchList.js +11 -2
  37. package/dist/esm/components/CnIndexPage/useSelfFetchList.js.map +1 -1
  38. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue.js +1 -1
  39. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js +95 -0
  40. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js.map +1 -1
  41. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js +24 -2
  42. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js.map +1 -1
  43. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  44. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +70 -2
  45. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  46. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  47. package/dist/esm/components/CnRegisterMapping/CnRegisterMapping.vue.js +1 -1
  48. package/dist/esm/components/CnRegisterMapping/CnRegisterMapping.vue2.js +67 -5
  49. package/dist/esm/components/CnRegisterMapping/CnRegisterMapping.vue2.js.map +1 -1
  50. package/dist/esm/components/CnRegisterMapping/CnRegisterMapping.vue3.js +181 -124
  51. package/dist/esm/components/CnRegisterMapping/CnRegisterMapping.vue3.js.map +1 -1
  52. package/dist/esm/components/CnSettingsPage/CnSettingsPage.vue.js +1 -1
  53. package/dist/esm/components/CnSettingsPage/CnSettingsPage.vue2.js +5 -1
  54. package/dist/esm/components/CnSettingsPage/CnSettingsPage.vue2.js.map +1 -1
  55. package/dist/esm/components/CnSettingsPage/CnSettingsPage.vue3.js.map +1 -1
  56. package/dist/esm/components/CnStatWidget/CnStatWidget.vue.js +1 -1
  57. package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +134 -10
  58. package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
  59. package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js +6 -2
  60. package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
  61. package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue.js +1 -1
  62. package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js +6 -3
  63. package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js.map +1 -1
  64. package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue3.js.map +1 -1
  65. package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue.js +1 -1
  66. package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue2.js +140 -7
  67. package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue2.js.map +1 -1
  68. package/dist/esm/components/CnToggleTableWidget/CnToggleTableWidget.vue3.js.map +1 -1
  69. package/dist/esm/components/CnVersionInfoCard/CnVersionInfoCard.vue.js +1 -1
  70. package/dist/esm/components/CnVersionInfoCard/CnVersionInfoCard.vue2.js +37 -9
  71. package/dist/esm/components/CnVersionInfoCard/CnVersionInfoCard.vue2.js.map +1 -1
  72. package/dist/esm/components/CnVersionInfoCard/CnVersionInfoCard.vue3.js +6 -5
  73. package/dist/esm/components/CnVersionInfoCard/CnVersionInfoCard.vue3.js.map +1 -1
  74. package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue.js +1 -1
  75. package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue2.js +2 -1
  76. package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue2.js.map +1 -1
  77. package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue3.js.map +1 -1
  78. package/dist/esm/components/CnWidgetCardGrid/CnWidgetCardGrid.vue2.js +53 -1
  79. package/dist/esm/components/CnWidgetCardGrid/CnWidgetCardGrid.vue2.js.map +1 -1
  80. package/dist/esm/components/CnWidgetCardGrid/CnWidgetCardGrid.vue3.js +3 -2
  81. package/dist/esm/components/CnWidgetCardGrid/CnWidgetCardGrid.vue3.js.map +1 -1
  82. package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue.js +1 -1
  83. package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js +135 -0
  84. package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js.map +1 -1
  85. package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue3.js.map +1 -1
  86. package/dist/esm/components/CnWidgetWrapper/CnWidgetWrapper.vue.js +1 -1
  87. package/dist/esm/components/CnWidgetWrapper/CnWidgetWrapper.vue2.js +19 -0
  88. package/dist/esm/components/CnWidgetWrapper/CnWidgetWrapper.vue2.js.map +1 -1
  89. package/dist/esm/components/CnWidgetWrapper/CnWidgetWrapper.vue3.js +37 -19
  90. package/dist/esm/components/CnWidgetWrapper/CnWidgetWrapper.vue3.js.map +1 -1
  91. package/dist/esm/composables/useListView.js +21 -0
  92. package/dist/esm/composables/useListView.js.map +1 -1
  93. package/dist/esm/index.js +1 -0
  94. package/dist/esm/index.js.map +1 -1
  95. package/dist/esm/l10n/en.json.js +23 -1
  96. package/dist/esm/l10n/en.json.js.map +1 -1
  97. package/dist/esm/l10n/nl.json.js +41 -1
  98. package/dist/esm/l10n/nl.json.js.map +1 -1
  99. package/dist/esm/library-style.js +1 -1
  100. package/dist/esm/nextcloud-vue.css +742 -397
  101. package/dist/esm/store/useObjectStore.js +16 -2
  102. package/dist/esm/store/useObjectStore.js.map +1 -1
  103. package/dist/esm/utils/boardColumns.js +8 -1
  104. package/dist/esm/utils/boardColumns.js.map +1 -1
  105. package/dist/esm/utils/boardReferenceColumns.js +278 -0
  106. package/dist/esm/utils/boardReferenceColumns.js.map +1 -0
  107. package/dist/esm/utils/buildManifest.js +4 -1
  108. package/dist/esm/utils/buildManifest.js.map +1 -1
  109. package/dist/esm/utils/gridStack.js +40 -1
  110. package/dist/esm/utils/gridStack.js.map +1 -1
  111. package/dist/esm/utils/humaniseKey.js +41 -0
  112. package/dist/esm/utils/humaniseKey.js.map +1 -0
  113. package/dist/esm/utils/notificationRuleLabel.js +6 -23
  114. package/dist/esm/utils/notificationRuleLabel.js.map +1 -1
  115. package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
  116. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  117. package/dist/esm/utils/widgetDispatch.js +8 -2
  118. package/dist/esm/utils/widgetDispatch.js.map +1 -1
  119. package/dist/nextcloud-vue.cjs.js +15075 -12590
  120. package/dist/nextcloud-vue.cjs.js.map +2 -2
  121. package/dist/nextcloud-vue.css +742 -397
  122. package/l10n/en.json +23 -1
  123. package/l10n/nl.json +41 -1
  124. package/package.json +1 -1
  125. package/src/components/CnAdminSettingsShell/CnAdminSettingsShell.vue +160 -8
  126. package/src/components/CnBoardView/CnBoardView.vue +262 -6
  127. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +116 -2
  128. package/src/components/CnDashboardPage/CnDashboardPage.vue +57 -2
  129. package/src/components/CnDetailPage/CnDetailPage.md +1 -1
  130. package/src/components/CnDetailPage/CnDetailPage.vue +23 -4
  131. package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +3 -1
  132. package/src/components/CnFactsWidget/CnFactsWidget.vue +18 -5
  133. package/src/components/CnIndexPage/CnIndexPage.vue +586 -25
  134. package/src/components/CnIndexPage/useSelfFetchList.js +10 -1
  135. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +123 -3
  136. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +70 -2
  137. package/src/components/CnRegisterMapping/CnRegisterMapping.md +5 -0
  138. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +231 -96
  139. package/src/components/CnSettingsPage/CnSettingsPage.vue +5 -1
  140. package/src/components/CnStatWidget/CnStatWidget.vue +136 -11
  141. package/src/components/CnTabsWidget/CnTabsWidget.vue +6 -3
  142. package/src/components/CnToggleTableWidget/CnToggleTableWidget.vue +140 -7
  143. package/src/components/CnVersionInfoCard/CnVersionInfoCard.md +2 -1
  144. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +42 -13
  145. package/src/components/CnWeekStripWidget/CnWeekStripWidget.vue +2 -1
  146. package/src/components/CnWidgetCardGrid/CnWidgetCardGrid.vue +55 -2
  147. package/src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue +135 -0
  148. package/src/components/CnWidgetWrapper/CnWidgetWrapper.md +10 -0
  149. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +44 -1
  150. package/src/composables/useListView.js +21 -0
  151. package/src/css/board.css +65 -4
  152. package/src/css/dialog.css +4 -2
  153. package/src/css/index-page.css +49 -0
  154. package/src/css/kpi-card.css +13 -0
  155. package/src/css/look-board.css +96 -7
  156. package/src/index.js +2 -0
  157. package/src/schemas/app-manifest-v2.schema.json +115 -5
  158. package/src/store/useObjectStore.js +16 -2
  159. package/src/utils/boardColumns.js +8 -1
  160. package/src/utils/boardReferenceColumns.js +274 -0
  161. package/src/utils/buildManifest.js +4 -1
  162. package/src/utils/gridStack.js +39 -0
  163. package/src/utils/humaniseKey.js +38 -0
  164. package/src/utils/notificationRuleLabel.js +5 -23
  165. package/src/utils/validateManifestV2.compiled.js +3 -3
  166. package/src/utils/widgetDispatch.js +8 -2
@@ -5,7 +5,7 @@
5
5
  <template>
6
6
  <div
7
7
  class="cn-board-view"
8
- :class="{ 'cn-board-view--board': isBoardLook }"
8
+ :class="{ 'cn-board-view--board': isBoardLook, 'cn-board-view--wrap': wrapColumns, 'cn-board-view--selecting': selectedKeys.length > 0 }"
9
9
  data-testid="cn-board-view">
10
10
  <p v-if="!usable" class="cn-board-view__unusable" data-testid="cn-board-unusable">
11
11
  {{ unusableText }}
@@ -36,9 +36,11 @@
36
36
  v-for="column in lane.columns"
37
37
  :key="`col-${lane.key}-${column.key}`"
38
38
  class="cn-board-view__column"
39
+ :class="{ 'cn-board-view__column--unreachable': isUnreachable(column) }"
39
40
  role="listitem"
40
41
  data-testid="cn-board-column"
41
42
  :data-column="column.key"
43
+ :data-unreachable="isUnreachable(column) ? 'true' : null"
42
44
  @dragover.prevent
43
45
  @drop="onDrop(column, $event)">
44
46
  <!-- Board look: a dot, the label and a white count badge, with an
@@ -116,11 +118,21 @@
116
118
  :data-card-id="cardKey(card)"
117
119
  :draggable="canMove"
118
120
  @dragstart="onDragStart(card, column, $event)"
121
+ @dragend="onDragEnd"
119
122
  @keydown="onCardKeydown(card, column, lane, $event)">
120
123
  <!-- Board look: title link, sub line, pill, footer, and a
121
124
  menu button instead of the Move to select. -->
122
125
  <template v-if="isBoardLook">
123
126
  <div class="cn-board-view__card-head">
127
+ <input
128
+ v-if="selectable"
129
+ type="checkbox"
130
+ class="cn-board-view__select"
131
+ data-testid="cn-board-card-select"
132
+ :data-card-id="cardKey(card)"
133
+ :checked="isSelected(card)"
134
+ :aria-label="selectLabel(card)"
135
+ @change="toggleSelected(card)">
124
136
  <a
125
137
  href="#"
126
138
  class="cn-board-view__card-title"
@@ -164,8 +176,14 @@
164
176
  class="cn-board-view__menu-item"
165
177
  data-testid="cn-board-menu-move"
166
178
  :data-target="target.key"
167
- @click="onMenuMove(card, column, target)">
179
+ :aria-disabled="isMoveAllowed(card, target) ? null : 'true'"
180
+ :class="{ 'cn-board-view__menu-item--blocked': !isMoveAllowed(card, target) }"
181
+ @click="isMoveAllowed(card, target) && onMenuMove(card, column, target)">
168
182
  {{ target.label }}
183
+ <span
184
+ v-if="!isMoveAllowed(card, target)"
185
+ class="cn-board-view__menu-note"
186
+ data-testid="cn-board-menu-blocked">{{ notAllowedLabel }}</span>
169
187
  </button>
170
188
  </div>
171
189
  <button
@@ -216,6 +234,16 @@
216
234
  </span>
217
235
  </template>
218
236
  <template v-else>
237
+ <label v-if="selectable" class="cn-board-view__select-label">
238
+ <input
239
+ type="checkbox"
240
+ class="cn-board-view__select"
241
+ data-testid="cn-board-card-select"
242
+ :data-card-id="cardKey(card)"
243
+ :checked="isSelected(card)"
244
+ :aria-label="selectLabel(card)"
245
+ @change="toggleSelected(card)">
246
+ </label>
219
247
  <span
220
248
  v-if="dueLabel(card)"
221
249
  class="cn-board-view__due"
@@ -354,6 +382,12 @@ export default {
354
382
  * draws the screens' board anatomy (screens-kanban-parity).
355
383
  */
356
384
  cnLook: { default: 'nextcloud' },
385
+ /**
386
+ * The app's cell-formatter registry, provided by CnAppRoot. A card
387
+ * role named in `cardRoles.formatters` shows its value through it, as
388
+ * the table's cells do (screens-board-reference-columns).
389
+ */
390
+ cnFormatters: { default: () => ({}) },
357
391
  },
358
392
 
359
393
  props: {
@@ -494,9 +528,72 @@ export default {
494
528
  type: Number,
495
529
  default: 0,
496
530
  },
531
+
532
+ /**
533
+ * The column a row belongs in, for a status whose raw value is not
534
+ * the column key: a reference whose rows are merged by name
535
+ * (screens-board-reference-columns). Absent, the row's `statusField`
536
+ * value is the key.
537
+ *
538
+ * @type {((row: object) => string)|null}
539
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-columns-can-be-the-rows-a-field-references
540
+ */
541
+ columnKeyOf: {
542
+ type: Function,
543
+ default: null,
544
+ },
545
+
546
+ /**
547
+ * Wrap the columns onto more rows, as many to a row as fit at 240px,
548
+ * instead of one row that scrolls sideways (manifest
549
+ * `config.board.wrap`). For a board with more stages than fit.
550
+ *
551
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-a-wide-board-can-wrap-its-columns
552
+ */
553
+ wrapColumns: {
554
+ type: Boolean,
555
+ default: false,
556
+ },
557
+
558
+ /**
559
+ * Offer a checkbox on every card, so cards can be selected for the
560
+ * list's bulk actions (the same selection the table holds).
561
+ *
562
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-cards-can-be-selected-for-bulk-actions
563
+ */
564
+ selectable: {
565
+ type: Boolean,
566
+ default: false,
567
+ },
568
+
569
+ /**
570
+ * The selected cards, by row key.
571
+ *
572
+ * @type {Array<string|number>}
573
+ */
574
+ selectedIds: {
575
+ type: Array,
576
+ default: () => [],
577
+ },
578
+
579
+ /**
580
+ * The columns one card may move to, asked when its menu opens or its
581
+ * drag starts: `(card) => Promise<Array<string>|null>`, column keys,
582
+ * `null` for every column. A column the card cannot reach is greyed
583
+ * during the drag and marked "not allowed" in the menu, and a drop on
584
+ * it is refused without asking the host. Absent, every column is
585
+ * offered and the host's move decides.
586
+ *
587
+ * @type {((card: object) => Promise<Array<string>|null>)|null}
588
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-the-board-shows-where-a-card-can-go
589
+ */
590
+ allowedMoves: {
591
+ type: Function,
592
+ default: null,
593
+ },
497
594
  },
498
595
 
499
- emits: ['card-click', 'card-aux-click', 'moved', 'refused', 'stale', 'load-more'],
596
+ emits: ['card-click', 'card-aux-click', 'moved', 'refused', 'stale', 'load-more', 'select'],
500
597
 
501
598
  data() {
502
599
  return {
@@ -512,6 +609,10 @@ export default {
512
609
  expanded: [],
513
610
  /** The card whose menu is open (board look), by card key. */
514
611
  openMenuKey: null,
612
+ /** Column keys each card may move to (`allowedMoves`), by card key; absent = not asked yet. */
613
+ allowedByCard: {},
614
+ /** The column keys the dragged card may reach, or null for all. */
615
+ dragAllowed: null,
515
616
  }
516
617
  },
517
618
 
@@ -529,6 +630,7 @@ export default {
529
630
  statusField: this.statusField,
530
631
  offBoardLabel: t('nextcloud-vue', 'Elsewhere'),
531
632
  colorField: this.colorField,
633
+ keyOf: this.columnKeyOf,
532
634
  })
533
635
  },
534
636
 
@@ -556,9 +658,20 @@ export default {
556
658
  due: (given && given.due) || '',
557
659
  owner: (given && given.owner) || '',
558
660
  pillColors: (given && given.pillColors) || {},
661
+ formatters: (given && given.formatters && typeof given.formatters === 'object') ? given.formatters : {},
559
662
  }
560
663
  },
561
664
 
665
+ /** @return {string} The note on a menu target the card cannot reach. */
666
+ notAllowedLabel() {
667
+ return t('nextcloud-vue', 'not allowed')
668
+ },
669
+
670
+ /** @return {Array<string>} The selected row keys as strings. */
671
+ selectedKeys() {
672
+ return (Array.isArray(this.selectedIds) ? this.selectedIds : []).map(String)
673
+ },
674
+
562
675
  /** @return {string} The Open in new tab menu item. */
563
676
  openInNewTabLabel() {
564
677
  return t('nextcloud-vue', 'Open in new tab')
@@ -617,6 +730,97 @@ export default {
617
730
 
618
731
  preventMiddleClickAutoscroll,
619
732
 
733
+ /**
734
+ * Whether a card is selected.
735
+ *
736
+ * @param {object} card The card.
737
+ * @return {boolean} True when selected.
738
+ */
739
+ isSelected(card) {
740
+ return this.selectedKeys.includes(this.cardKey(card))
741
+ },
742
+
743
+ /**
744
+ * The checkbox's accessible name.
745
+ *
746
+ * @param {object} card The card.
747
+ * @return {string} "Select <name>".
748
+ */
749
+ selectLabel(card) {
750
+ const name = this.roleText(card, this.roles.title) || this.cardKey(card)
751
+ return t('nextcloud-vue', 'Select {name}', { name })
752
+ },
753
+
754
+ /**
755
+ * Select a card, or unselect it.
756
+ *
757
+ * @param {object} card The card.
758
+ * @return {void}
759
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-cards-can-be-selected-for-bulk-actions
760
+ */
761
+ toggleSelected(card) {
762
+ const key = this.cardKey(card)
763
+ const next = this.isSelected(card)
764
+ ? this.selectedIds.filter((id) => String(id) !== key)
765
+ : [...this.selectedIds, card?.[this.rowKey]]
766
+ /**
767
+ * @event select Emitted when a card's checkbox changes. Payload: the selected row keys.
768
+ */
769
+ this.$emit('select', next)
770
+ },
771
+
772
+ /**
773
+ * Ask the host where one card may go (`allowedMoves`), once per card.
774
+ *
775
+ * @param {object} card The card.
776
+ * @return {Promise<Array<string>|null>} The column keys, or null for all.
777
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-the-board-shows-where-a-card-can-go
778
+ */
779
+ async loadAllowed(card) {
780
+ if (typeof this.allowedMoves !== 'function') {
781
+ return null
782
+ }
783
+ const key = this.cardKey(card)
784
+ if (Object.hasOwn(this.allowedByCard, key)) {
785
+ return this.allowedByCard[key]
786
+ }
787
+ let allowed
788
+ try {
789
+ const answer = await this.allowedMoves(card)
790
+ allowed = Array.isArray(answer) ? answer.map(String) : null
791
+ } catch {
792
+ // Unknown is not "nowhere": the host's move stays the authority.
793
+ allowed = null
794
+ }
795
+ this.allowedByCard = { ...this.allowedByCard, [key]: allowed }
796
+ return allowed
797
+ },
798
+
799
+ /**
800
+ * Whether a card may move to a column, as far as the board knows.
801
+ *
802
+ * @param {object} card The card.
803
+ * @param {object} target The column.
804
+ * @return {boolean} False only when the host said it cannot.
805
+ */
806
+ isMoveAllowed(card, target) {
807
+ const allowed = this.allowedByCard[this.cardKey(card)]
808
+ return !Array.isArray(allowed) || allowed.includes(String(target.key))
809
+ },
810
+
811
+ /**
812
+ * Whether a column is out of reach for the card being dragged.
813
+ *
814
+ * @param {object} column The column.
815
+ * @return {boolean} True while a drag is on and the card cannot go there.
816
+ */
817
+ isUnreachable(column) {
818
+ return this.dragging !== null
819
+ && Array.isArray(this.dragAllowed)
820
+ && column.key !== this.dragging.fromKey
821
+ && !this.dragAllowed.includes(String(column.key))
822
+ },
823
+
620
824
  /**
621
825
  * A card's due state under `dueRule`.
622
826
  *
@@ -658,11 +862,35 @@ export default {
658
862
  const fields = Array.isArray(role) ? role : [role]
659
863
  return fields
660
864
  .filter((field) => typeof field === 'string' && field !== '')
661
- .map((field) => this.textOf(readPath(card, field)))
865
+ .map((field) => this.fieldText(card, field))
662
866
  .filter((value) => value !== '')
663
867
  .join(' \u00b7 ')
664
868
  },
665
869
 
870
+ /**
871
+ * One card field as text: through the formatter `cardRoles.formatters`
872
+ * names for it, else the value itself.
873
+ *
874
+ * @param {object} card The card's row.
875
+ * @param {string} field The dot-path.
876
+ * @return {string} The text.
877
+ * @spec openspec/changes/screens-board-reference-columns/specs/board-view/spec.md#requirement-a-card-field-can-show-through-a-formatter
878
+ */
879
+ fieldText(card, field) {
880
+ const raw = readPath(card, field)
881
+ const id = this.roles.formatters[field]
882
+ const fn = id && this.cnFormatters ? this.cnFormatters[id] : null
883
+ if (typeof fn === 'function') {
884
+ try {
885
+ const out = fn(raw, card, null)
886
+ return out === null || out === undefined ? '' : String(out).trim()
887
+ } catch {
888
+ return this.textOf(raw)
889
+ }
890
+ }
891
+ return this.textOf(raw)
892
+ },
893
+
666
894
  /**
667
895
  * A value as text: a string or number as is, an object by its label.
668
896
  *
@@ -687,7 +915,7 @@ export default {
687
915
  * @return {string} A CnStatusBadge variant.
688
916
  */
689
917
  pillVariant(card) {
690
- const raw = this.textOf(readPath(card, this.roles.pill))
918
+ const raw = this.fieldText(card, this.roles.pill)
691
919
  const variant = this.roles.pillColors[raw] ?? this.roles.pillColors[raw.toLowerCase()]
692
920
  return isBadgeVariant(variant) ? variant : 'default'
693
921
  },
@@ -727,7 +955,7 @@ export default {
727
955
  * @return {string} The name, '' when there is none.
728
956
  */
729
957
  ownerName(card) {
730
- return this.roles.owner === '' ? '' : this.textOf(readPath(card, this.roles.owner))
958
+ return this.roles.owner === '' ? '' : this.fieldText(card, this.roles.owner)
731
959
  },
732
960
 
733
961
  /**
@@ -879,6 +1107,7 @@ export default {
879
1107
  const key = this.cardKey(card)
880
1108
  this.openMenuKey = this.openMenuKey === key ? null : key
881
1109
  if (this.openMenuKey !== null) {
1110
+ this.loadAllowed(card)
882
1111
  this.focusMenuItem(card, 0)
883
1112
  }
884
1113
  },
@@ -967,6 +1196,7 @@ export default {
967
1196
  event.preventDefault()
968
1197
  if (!this.isMenuOpen(card)) {
969
1198
  this.openMenuKey = this.cardKey(card)
1199
+ this.loadAllowed(card)
970
1200
  this.focusMenuItem(card, 0)
971
1201
  }
972
1202
  }
@@ -1113,8 +1343,27 @@ export default {
1113
1343
  */
1114
1344
  onDragStart(card, column, event) {
1115
1345
  this.dragging = { card, fromKey: column.key }
1346
+ this.dragAllowed = null
1116
1347
  // Firefox drops a drag that carries no data.
1117
1348
  event?.dataTransfer?.setData?.('text/plain', this.cardKey(card))
1349
+ if (typeof this.allowedMoves === 'function') {
1350
+ this.loadAllowed(card).then((allowed) => {
1351
+ if (this.dragging && this.dragging.card === card) {
1352
+ this.dragAllowed = allowed
1353
+ }
1354
+ })
1355
+ }
1356
+ },
1357
+
1358
+ /**
1359
+ * The drag ended (dropped anywhere, or cancelled): no column stays
1360
+ * greyed. A drop on a column has already run by now.
1361
+ *
1362
+ * @return {void}
1363
+ */
1364
+ onDragEnd() {
1365
+ this.dragging = null
1366
+ this.dragAllowed = null
1118
1367
  },
1119
1368
 
1120
1369
  /**
@@ -1129,6 +1378,13 @@ export default {
1129
1378
  }
1130
1379
  const { card, fromKey } = this.dragging
1131
1380
  this.dragging = null
1381
+ this.dragAllowed = null
1382
+ if (column.key !== fromKey && !this.isMoveAllowed(card, column)) {
1383
+ const name = this.roleText(card, this.roles.title) || this.cardKey(card)
1384
+ this.refusal = t('nextcloud-vue', '{name} cannot move to {column}.', { name, column: column.label })
1385
+ this.$emit('refused', { card, message: this.refusal })
1386
+ return
1387
+ }
1132
1388
  await this.move(card, fromKey, column.key)
1133
1389
  },
1134
1390
 
@@ -28,12 +28,12 @@
28
28
 
29
29
  <div class="grid-stack">
30
30
  <div
31
- v-for="(item, index) in layout"
31
+ v-for="item in itemsInRowOrder"
32
32
  :key="resolveItemKey(item)"
33
33
  class="grid-stack-item"
34
34
  :class="{ 'cn-dashboard-grid__item--fit': sizeToContentAttr(item) !== undefined }"
35
35
  role="group"
36
- :aria-label="resolveItemLabel(item, index)"
36
+ :aria-label="resolveItemLabel(item, layout.indexOf(item))"
37
37
  :aria-describedby="itemDescribedBy"
38
38
  :tabindex="itemTabindex"
39
39
  :gs-id="item.id"
@@ -71,6 +71,7 @@
71
71
  <script>
72
72
  import { translate as t } from '@nextcloud/l10n'
73
73
  import { GridStack } from 'gridstack'
74
+ import { planGrowth } from '../../utils/gridStack.js'
74
75
  // `gridstack` is a peerDependency (see package.json), not bundled — this
75
76
  // component's JS and the consumer's GridStack stylesheet MUST come from the
76
77
  // exact same installed copy, because GridStack's JS writes layout state
@@ -333,6 +334,30 @@ export default {
333
334
  },
334
335
 
335
336
  computed: {
337
+ /**
338
+ * The layout's items top to bottom, then left to right: the order the
339
+ * items are in the page, so GridStack places them in that order.
340
+ *
341
+ * GridStack sizes a size-to-content cell while it adds the items, one
342
+ * at a time, and an item it adds onto a cell that has already grown
343
+ * moves itself below whatever it then collides with. In the layout's
344
+ * own order a card declared after the lists (pipelinq's full-width
345
+ * "client in focus" card) was added last, so when the banner above
346
+ * it grew it skipped past the stat tiles AND the lists and landed at
347
+ * the bottom. Added top to bottom, every card lands under the one
348
+ * above it. It is also the order a screen reader and the Tab key
349
+ * follow. An item without a row or column sorts after the items
350
+ * that have one, in the layout's order.
351
+ *
352
+ * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it
353
+ * @return {Array<object>} The items in row order.
354
+ */
355
+ itemsInRowOrder() {
356
+ const items = Array.isArray(this.layout) ? [...this.layout] : []
357
+ const at = (value) => (Number.isFinite(value) ? value : Number.MAX_SAFE_INTEGER)
358
+ return items.sort((a, b) => (at(a.gridY) - at(b.gridY)) || (at(a.gridX) - at(b.gridX)))
359
+ },
360
+
336
361
  /**
337
362
  * Whether the grid draws each layout row as ROW_SPLIT finer rows. A
338
363
  * size-to-content cell can only be a whole number of rows tall, so on
@@ -608,6 +633,13 @@ export default {
608
633
  )
609
634
  },
610
635
 
636
+ /**
637
+ * Build the GridStack grid on the rendered items, install the growth
638
+ * wrapper (`keepOrderOnGrowth`) and listen for its changes.
639
+ *
640
+ * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it
641
+ * @return {void}
642
+ */
611
643
  initGrid() {
612
644
  if (this.cellHeightCssVar && typeof document !== 'undefined' && document.documentElement) {
613
645
  document.documentElement.style.setProperty(this.cellHeightCssVar, `${this.cellHeight}px`)
@@ -624,6 +656,7 @@ export default {
624
656
  removable: false,
625
657
  ...(this.columnOpts ? { columnOpts: this.columnOpts } : {}),
626
658
  }, el)
659
+ this.keepOrderOnGrowth()
627
660
 
628
661
  this.grid.on('change', (_event, items) => {
629
662
  this.handleGridChange(items)
@@ -635,6 +668,87 @@ export default {
635
668
  this.syncInteractivity()
636
669
  },
637
670
 
671
+ /**
672
+ * Let a size-to-content cell that grows push the cards under it down in
673
+ * their order. GridStack resolves that collision itself, but not in
674
+ * order: when pipelinq's banner grew from two rows to three, the
675
+ * full-width card under the stat tiles landed below the lists, also
676
+ * with `float: false`. Every grow after the grid is built, whether
677
+ * GridStack measures it on resize or this grid's content observer asks
678
+ * for it, now first moves the cards the growth reaches down by the
679
+ * growth (`planGrowth`), bottom-most first, and only then grows the
680
+ * cell, so GridStack has no collision left to resolve. The wrapper is
681
+ * installed after `GridStack.init` has already measured the cells on
682
+ * load; the order on load comes from adding the items in row order
683
+ * (`itemsInRowOrder`). A cell that shrinks is left to GridStack as
684
+ * before.
685
+ *
686
+ * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it
687
+ * @return {void}
688
+ */
689
+ keepOrderOnGrowth() {
690
+ const grid = this.grid
691
+ if (!grid || typeof grid.resizeToContent !== 'function' || typeof grid.update !== 'function') {
692
+ return
693
+ }
694
+ const resize = grid.resizeToContent.bind(grid)
695
+ grid.resizeToContent = (el) => {
696
+ const node = el && el.gridstackNode
697
+ const nodes = grid.engine && Array.isArray(grid.engine.nodes) ? grid.engine.nodes : null
698
+ const rows = node && nodes ? this.contentRows(el, node) : null
699
+ const plan = rows ? planGrowth(nodes, node, rows) : []
700
+ if (plan.length === 0) {
701
+ resize(el)
702
+ return
703
+ }
704
+ // Inside a batch the moves are not packed until the cell has grown.
705
+ const batching = Boolean(grid.engine.batchMode)
706
+ if (!batching) {
707
+ grid.batchUpdate()
708
+ }
709
+ for (const step of plan) {
710
+ grid.update(step.node.el, { y: step.y })
711
+ }
712
+ resize(el)
713
+ if (!batching) {
714
+ grid.batchUpdate(false)
715
+ }
716
+ }
717
+ },
718
+
719
+ /**
720
+ * The rows a size-to-content cell needs for its content, measured the
721
+ * way GridStack's `resizeToContent` measures it (the content's first
722
+ * child, plus the cell's own padding), within its size-to-content row
723
+ * maximum and its minimum and maximum height.
724
+ *
725
+ * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it
726
+ * @param {HTMLElement} el The cell.
727
+ * @param {object} node Its GridStack node.
728
+ * @return {number|null} The rows, or null when it cannot be measured.
729
+ */
730
+ contentRows(el, node) {
731
+ const cell = this.grid.getCellHeight(true)
732
+ const item = el.querySelector('.grid-stack-item-content')
733
+ const child = item && item.firstElementChild
734
+ if (!el.clientHeight || !cell || !child || !Number.isFinite(node.h)) {
735
+ return null
736
+ }
737
+ const padding = el.clientHeight - item.clientHeight
738
+ const itemHeight = node.h * cell - padding
739
+ const wanted = child.getBoundingClientRect().height || itemHeight
740
+ let rows = Math.ceil((node.h * cell + wanted - itemHeight) / cell)
741
+ if (Number.isInteger(node.sizeToContent) && rows > node.sizeToContent) {
742
+ rows = node.sizeToContent
743
+ }
744
+ if (node.minH && rows < node.minH) {
745
+ rows = node.minH
746
+ } else if (node.maxH && rows > node.maxH) {
747
+ rows = node.maxH
748
+ }
749
+ return rows
750
+ },
751
+
638
752
  /**
639
753
  * Keep both editing lanes in step with whether an edit could actually be
640
754
  * kept: the pointer's handles, and — through `reflowed` feeding