@conduction/nextcloud-vue 2.170.0 → 2.171.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 (139) hide show
  1. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js +9 -0
  2. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js.map +1 -0
  3. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js +242 -0
  4. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js.map +1 -0
  5. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js +200 -0
  6. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js.map +1 -0
  7. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js +9 -0
  8. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js.map +1 -0
  9. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js +186 -0
  10. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js.map +1 -0
  11. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js +24 -0
  12. package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js.map +1 -0
  13. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue.js +1 -1
  14. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js +3 -15
  15. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js.map +1 -1
  16. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js +16 -61
  17. package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js.map +1 -1
  18. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js +9 -0
  19. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js.map +1 -0
  20. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js +120 -0
  21. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js.map +1 -0
  22. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js +86 -0
  23. package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js.map +1 -0
  24. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +1 -1
  25. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  26. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +9 -9
  27. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  28. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue.js +1 -1
  29. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue2.js.map +1 -1
  30. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue3.js.map +1 -1
  31. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
  32. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
  33. package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
  34. package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js +8 -0
  35. package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js.map +1 -0
  36. package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js +101 -0
  37. package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js.map +1 -0
  38. package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js +54 -0
  39. package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js.map +1 -0
  40. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
  41. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +14 -2
  42. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
  43. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +1 -1
  44. package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
  45. package/dist/esm/components/CnFilesBrowser/filesBrowser.js +21 -2
  46. package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
  47. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
  48. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +7 -0
  49. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
  50. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +2 -2
  51. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
  52. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +11 -0
  53. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
  54. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +2 -1
  55. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
  56. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
  57. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
  58. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
  59. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js +9 -0
  60. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js.map +1 -0
  61. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js +248 -0
  62. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js.map +1 -0
  63. package/dist/esm/components/{CnMassDeleteDialog/CnMassDeleteDialog.vue3.js → CnMassActionDialog/CnMassActionDialog.vue3.js} +66 -52
  64. package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue3.js.map +1 -0
  65. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js +0 -3
  66. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js.map +1 -1
  67. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js +25 -121
  68. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js.map +1 -1
  69. package/dist/esm/components/CnNotesCard/CnNotesCard.vue.js +1 -1
  70. package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js +11 -3
  71. package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js.map +1 -1
  72. package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js +1 -1
  73. package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js.map +1 -1
  74. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue.js +1 -1
  75. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +21 -1
  76. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
  77. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +2 -2
  78. package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
  79. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  80. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  81. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +23 -5
  82. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  83. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  84. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +3 -0
  85. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  86. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +14 -4
  87. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  88. package/dist/esm/dialogs/CnConfirmDialog.vue.js +1 -1
  89. package/dist/esm/dialogs/CnConfirmDialog.vue2.js.map +1 -1
  90. package/dist/esm/dialogs/CnConfirmDialog.vue3.js +5 -3
  91. package/dist/esm/dialogs/CnConfirmDialog.vue3.js.map +1 -1
  92. package/dist/esm/index.js +3 -0
  93. package/dist/esm/index.js.map +1 -1
  94. package/dist/esm/l10n/en.json.js +16 -1
  95. package/dist/esm/l10n/en.json.js.map +1 -1
  96. package/dist/esm/l10n/nl.json.js +16 -1
  97. package/dist/esm/l10n/nl.json.js.map +1 -1
  98. package/dist/esm/library-style.js +1 -1
  99. package/dist/esm/nextcloud-vue.css +638 -302
  100. package/dist/esm/utils/noteThreads.js +14 -2
  101. package/dist/esm/utils/noteThreads.js.map +1 -1
  102. package/dist/nextcloud-vue.cjs.js +11316 -10074
  103. package/dist/nextcloud-vue.cjs.js.map +2 -2
  104. package/dist/nextcloud-vue.css +638 -302
  105. package/l10n/en.json +16 -1
  106. package/l10n/nl.json +16 -1
  107. package/package.json +1 -1
  108. package/scripts/.jsdoc-baselines.json +1 -1
  109. package/src/components/CnConditionGroupEditor/CnConditionGroup.vue +528 -0
  110. package/src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue +211 -0
  111. package/src/components/CnConditionGroupEditor/index.js +9 -0
  112. package/src/components/CnConditionListEditor/CnConditionListEditor.vue +15 -78
  113. package/src/components/CnConditionListEditor/CnConditionRow.vue +226 -0
  114. package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
  115. package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
  116. package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +0 -6
  117. package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
  118. package/src/components/CnDialogActions/index.js +7 -0
  119. package/src/components/CnFilesBrowser/CnFilesBrowser.vue +15 -3
  120. package/src/components/CnFilesBrowser/filesBrowser.js +21 -2
  121. package/src/components/CnFlowsPage/CnFlowBoard.vue +10 -3
  122. package/src/components/CnFlowsPage/CnFlowEditorPage.vue +12 -0
  123. package/src/components/CnLinkedWidget/CnLinkedWidget.vue +7 -0
  124. package/src/components/CnMassActionDialog/CnMassActionDialog.vue +382 -0
  125. package/src/components/CnMassActionDialog/index.js +7 -0
  126. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.md +4 -0
  127. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +25 -254
  128. package/src/components/CnNotesCard/CnNotesCard.vue +12 -4
  129. package/src/components/CnObjectSidebar/CnNotesTab.vue +23 -3
  130. package/src/components/CnTreeView/CnTreeNode.vue +10 -1
  131. package/src/components/CnTreeView/CnTreeView.vue +9 -0
  132. package/src/components/index.js +3 -0
  133. package/src/css/context-menu.css +7 -0
  134. package/src/css/look-board-detail.css +120 -1
  135. package/src/css/look-board.css +43 -2
  136. package/src/dialogs/CnConfirmDialog.vue +3 -1
  137. package/src/index.js +3 -0
  138. package/src/utils/noteThreads.js +13 -1
  139. package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
@@ -0,0 +1,124 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2026 Conduction B.V.
3
+ - SPDX-License-Identifier: EUPL-1.2
4
+ -->
5
+ <template>
6
+ <NcButton :disabled="saving" data-testid="cn-dialog-actions-cancel" @click="onCancel">
7
+ {{ cancelLabel }}
8
+ </NcButton>
9
+ <NcButton
10
+ :variant="variant"
11
+ :disabled="saving || !canSubmit"
12
+ data-testid="cn-dialog-actions-submit"
13
+ @click="onSubmit">
14
+ <template v-if="saving || confirmIcon" #icon>
15
+ <NcLoadingIcon
16
+ v-if="saving"
17
+ :size="20"
18
+ :name="t('nextcloud-vue', 'Loading …')" />
19
+ <CnIcon v-else :name="confirmIcon" :size="20" />
20
+ </template>
21
+ {{ confirmLabel }}
22
+ </NcButton>
23
+ </template>
24
+
25
+ <script>
26
+ import { translate as t } from '@nextcloud/l10n'
27
+ import { NcButton, NcLoadingIcon } from '@nextcloud/vue'
28
+ import { CnIcon } from '../CnIcon/index.js'
29
+
30
+ /**
31
+ * CnDialogActions — the footer of a hand-built dialog: a cancel button and a
32
+ * primary button that shows a loading icon while the dialog saves.
33
+ *
34
+ * Put it in the `#actions` slot of `CnDialog` (or `NcDialog`) when the dialog
35
+ * body is too custom for `CnFormDialog`. The component holds no state: the
36
+ * parent owns `saving` and `canSubmit` and does the work on `submit`.
37
+ *
38
+ * ```vue
39
+ * <CnDialog :name="t('myapp', 'Edit source')" default-width="form" @closing="close">
40
+ * <MySourceForm v-model="source" />
41
+ * <template #actions>
42
+ * <CnDialogActions
43
+ * :saving="saving"
44
+ * :can-submit="source.title !== ''"
45
+ * :confirm-label="editing ? t('myapp', 'Save') : t('myapp', 'Create')"
46
+ * @cancel="close"
47
+ * @submit="save" />
48
+ * </template>
49
+ * </CnDialog>
50
+ * ```
51
+ *
52
+ * The primary button is disabled while `saving` is true or `canSubmit` is
53
+ * false. While saving it draws a loading icon with an accessible name, so a
54
+ * screen-reader user hears that the save is running.
55
+ */
56
+ export default {
57
+ name: 'CnDialogActions',
58
+
59
+ components: {
60
+ CnIcon,
61
+ NcButton,
62
+ NcLoadingIcon,
63
+ },
64
+
65
+ props: {
66
+ /** Whether a save is in flight. Disables both buttons and draws a loading icon on the primary one. */
67
+ saving: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
71
+
72
+ /** Whether the dialog holds enough to submit. False disables the primary button. */
73
+ canSubmit: {
74
+ type: Boolean,
75
+ default: true,
76
+ },
77
+
78
+ /** Label of the primary button. */
79
+ confirmLabel: {
80
+ type: String,
81
+ default: () => t('nextcloud-vue', 'Save'),
82
+ },
83
+
84
+ /** Label of the cancel button. */
85
+ cancelLabel: {
86
+ type: String,
87
+ default: () => t('nextcloud-vue', 'Cancel'),
88
+ },
89
+
90
+ /** Variant of the primary button. Use `error` for a destructive submit. */
91
+ variant: {
92
+ type: String,
93
+ default: 'primary',
94
+ validator: (v) => ['primary', 'secondary', 'error', 'warning', 'success'].includes(v),
95
+ },
96
+
97
+ /** A CnIcon name drawn on the primary button when it is not saving. Empty draws none. */
98
+ confirmIcon: {
99
+ type: String,
100
+ default: '',
101
+ },
102
+ },
103
+
104
+ emits: ['cancel', 'submit'],
105
+
106
+ methods: {
107
+ t,
108
+
109
+ onCancel() {
110
+ /**
111
+ * @event cancel Emitted when the cancel button is clicked.
112
+ */
113
+ this.$emit('cancel')
114
+ },
115
+
116
+ onSubmit() {
117
+ /**
118
+ * @event submit Emitted when the primary button is clicked while it is enabled.
119
+ */
120
+ this.$emit('submit')
121
+ },
122
+ },
123
+ }
124
+ </script>
@@ -0,0 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Conduction B.V.
2
+ // SPDX-License-Identifier: EUPL-1.2
3
+
4
+ import CnDialogActions from './CnDialogActions.vue'
5
+
6
+ export default CnDialogActions
7
+ export { CnDialogActions }
@@ -409,7 +409,7 @@
409
409
  <td class="cn-files-browser__col-actions" @click.stop @auxclick.stop>
410
410
  <!-- The host's one visible button on a file ("Beoordelen"),
411
411
  primary while the row still asks for it. -->
412
- <NcButton v-if="rowButton && !isFolder(node) && hostActionApplies(rowButton, node)"
412
+ <NcButton v-if="rowButtonApplies(node)"
413
413
  :variant="rowButtonPrimary(node) ? 'primary' : 'secondary'"
414
414
  class="cn-files-browser__row-button"
415
415
  :aria-label="t('nextcloud-vue', '{action}: {name}', { action: hostLabel(rowButton), name: node.basename })"
@@ -2301,6 +2301,20 @@ export default {
2301
2301
  return list.some((v) => String(v).toLowerCase() === String(value).toLowerCase())
2302
2302
  },
2303
2303
 
2304
+ /**
2305
+ * Whether the row button is drawn on a file: never on a folder, and
2306
+ * only where its `when` and `visibleIf` (row included) hold.
2307
+ *
2308
+ * @param {object} node The file.
2309
+ * @return {boolean}
2310
+ */
2311
+ rowButtonApplies(node) {
2312
+ if (!this.rowButton || this.isFolder(node)) {
2313
+ return false
2314
+ }
2315
+ return hostActionApplies(this.rowButton, node, this.rowValueOf(node))
2316
+ },
2317
+
2304
2318
  /**
2305
2319
  * Whether a file's row button is the primary one: the row-data field
2306
2320
  * `primaryWhen.key` holds one of `primaryWhen.values`.
@@ -2320,8 +2334,6 @@ export default {
2320
2334
  return when.values.some((v) => String(v).toLowerCase() === String(raw).toLowerCase())
2321
2335
  },
2322
2336
 
2323
- hostActionApplies,
2324
-
2325
2337
  /**
2326
2338
  * Re-read the folder once after a burst of change signals. One upload
2327
2339
  * of ten files answers ten `files:node:created`, and one PROPFIND
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import axios from '@nextcloud/axios'
11
11
  import { generateUrl } from '@nextcloud/router'
12
+ import { conditionHolds } from '../../utils/fieldCondition.js'
12
13
  import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
13
14
 
14
15
  /**
@@ -280,6 +281,23 @@ export function indexRowData(data, { path = '', key = 'fileId' } = {}) {
280
281
  return byId
281
282
  }
282
283
 
284
+ /**
285
+ * Whether one field of a file's row meets its `visibleIf.row` entry: a plain
286
+ * value is compared strictly, an object is a predicate of a form field
287
+ * condition (`equals`, `in`, `notEmpty` and the rest).
288
+ *
289
+ * @param {string} key The row field.
290
+ * @param {unknown} wanted The value, or the predicate.
291
+ * @param {unknown} value What the row holds.
292
+ * @return {boolean} True when the field meets it.
293
+ */
294
+ function rowFieldMatches(key, wanted, value) {
295
+ if (wanted !== null && typeof wanted === 'object' && !Array.isArray(wanted)) {
296
+ return conditionHolds({ ...wanted, field: key }, { [key]: value }, key)
297
+ }
298
+ return value === wanted
299
+ }
300
+
283
301
  /**
284
302
  * Whether a host row action is offered on a file, by its `visibleIf`.
285
303
  *
@@ -287,7 +305,8 @@ export function indexRowData(data, { path = '', key = 'fileId' } = {}) {
287
305
  * allowed); `visibleIf.mime` lists mime types, where one ending in `/` or
288
306
  * `/*` names the whole family; `visibleIf.row` maps fields of the host's row
289
307
  * for the file to the value each must have (compared strictly, so `true` is
290
- * not `"true"`). Every condition named must hold. An action without
308
+ * not `"true"`), or to a predicate of a form field condition such as
309
+ * `{ notEmpty: true }` or `{ in: [...] }`. Every condition named must hold. An action without
291
310
  * `visibleIf` is offered on every file, as before. An action with `when` is
292
311
  * offered only while `when` is `true`.
293
312
  *
@@ -333,7 +352,7 @@ export function hostActionApplies(action, node, rowValue = null) {
333
352
  if (typeof rowValue !== 'function') {
334
353
  return false
335
354
  }
336
- const holds = Object.entries(condition.row).every(([key, wanted]) => rowValue(key) === wanted)
355
+ const holds = Object.entries(condition.row).every(([key, wanted]) => rowFieldMatches(key, wanted, rowValue(key)))
337
356
  if (!holds) {
338
357
  return false
339
358
  }
@@ -15,9 +15,9 @@
15
15
  <div class="cn-flow-board" :class="{ 'cn-flow-board--with-palette': showPalette, 'cn-flow-board--canvas': canvasLayout, 'cn-flow-board--run': store.inRunView }" data-testid="flow-board">
16
16
  <header class="cn-flow-board__header">
17
17
  <div class="cn-flow-board__heading">
18
- <h2 class="cn-flow-board__title" data-testid="flow-board-title">
18
+ <h1 class="cn-flow-board__title" data-testid="flow-board-title">
19
19
  {{ titleText }}
20
- </h2>
20
+ </h1>
21
21
  </div>
22
22
  <div v-if="!store.inRunView || canvasLayout" class="cn-flow-board__actions">
23
23
  <template v-if="!store.inRunView">
@@ -39,7 +39,7 @@
39
39
  data-testid="flow-board-enabled-switch"
40
40
  @click="onEnabledChange(store.flow.enabled === false)" />
41
41
  <span :id="toggleLabelId" class="cn-flow-board__toggle-label">
42
- {{ store.flow.enabled !== false ? t('nextcloud-vue', 'Active') : t('nextcloud-vue', 'Paused') }}
42
+ {{ toggleLabel === 'fixed' || store.flow.enabled !== false ? t('nextcloud-vue', 'Active') : t('nextcloud-vue', 'Paused') }}
43
43
  </span>
44
44
  </span>
45
45
  <NcButton :disabled="store.checking || !store.nodes.length"
@@ -639,6 +639,13 @@ export default {
639
639
  * over the canvas. `cards` (default) keeps the DqFlow grid.
640
640
  */
641
641
  layout: { type: String, default: 'cards' },
642
+
643
+ /**
644
+ * How the Active switch is named. `state` (default) names it after
645
+ * the flow's state, Active or Paused (PqFlow). `fixed` always names
646
+ * it Active and lets the switch show whether the flow runs (DqFlow).
647
+ */
648
+ toggleLabel: { type: String, default: 'state' },
642
649
  },
643
650
 
644
651
  emits: ['save', 'run', 'retried'],
@@ -13,6 +13,7 @@
13
13
  :paletteGroups="translatedPaletteGroups"
14
14
  :flowDirection="flowDirection"
15
15
  :layout="layout"
16
+ :toggleLabel="toggleLabel"
16
17
  :nodeLook="nodeLook"
17
18
  :notice="notice ? cnTranslate(notice) : ''"
18
19
  :saveAsVersion="saveAsVersion"
@@ -261,6 +262,17 @@ export default {
261
262
  type: String,
262
263
  default: 'cards',
263
264
  },
265
+
266
+ /**
267
+ * Board look: how the Active switch is named. `state` names it
268
+ * Active or Paused after the flow; `fixed` always names it Active
269
+ * and the switch shows the state (DqFlow). Manifest key
270
+ * `config.toggleLabel`.
271
+ */
272
+ toggleLabel: {
273
+ type: String,
274
+ default: 'state',
275
+ },
264
276
  },
265
277
 
266
278
  /**
@@ -400,6 +400,13 @@ button.cn-linked-widget__link {
400
400
  text-decoration: underline;
401
401
  }
402
402
 
403
+ /* The class twice: Nextcloud's `button:not(.button-vue, ...)` rule (0,2,1)
404
+ gives every button a 3px margin that a single scoped class cannot take back. */
405
+ button.cn-linked-widget__link.cn-linked-widget__link,
406
+ .cn-linked-widget__action.cn-linked-widget__action {
407
+ margin: 0;
408
+ }
409
+
403
410
  .cn-linked-widget__empty {
404
411
  color: var(--color-text-maxcontrast);
405
412
  font-size: 13px;
@@ -0,0 +1,382 @@
1
+ <template>
2
+ <CnDialog
3
+ :look="look"
4
+ :width="width"
5
+ defaultWidth="confirm"
6
+ :eyebrow="eyebrow"
7
+ :subtitle="subtitle"
8
+ :name="dialogTitle"
9
+ size="normal"
10
+ :noClose="loading"
11
+ @closing="$emit('close')">
12
+ <!-- Review phase -->
13
+ <div v-if="result === null"
14
+ class="cn-mass-delete__review"
15
+ data-testid="cn-modal"
16
+ :data-testid-modal="testidPrefix + '-dialog'"
17
+ data-testid-phase="review">
18
+ <template v-if="isBoardLook">
19
+ <p class="cn-dialog__sentence" :data-testid="testidPrefix + '-sentence'">
20
+ {{ sentenceParts[0] }}<strong class="cn-dialog__name">{{ countLabel }}</strong>{{ sentenceParts[1] }}
21
+ <template v-if="irreversible">
22
+ {{ irreversibleText }}
23
+ </template>
24
+ </p>
25
+ <p class="cn-dialog__note"
26
+ role="note"
27
+ :data-testid="testidPrefix + '-note'">
28
+ <AlertOutline :size="20" aria-hidden="true" />
29
+ <span>{{ warningText }}</span>
30
+ </p>
31
+ </template>
32
+ <NcNoteCard v-else type="warning">
33
+ {{ warningText }}
34
+ </NcNoteCard>
35
+
36
+ <div class="cn-mass-delete__list">
37
+ <div
38
+ v-for="item in localItems"
39
+ :key="item.id"
40
+ class="cn-mass-delete__item">
41
+ <span class="cn-mass-delete__item-name">
42
+ {{ getItemName(item) }}
43
+ </span>
44
+ <NcButton
45
+ variant="tertiary"
46
+ :aria-label="removeLabel"
47
+ @click="removeItem(item.id)">
48
+ <template #icon>
49
+ <Close :size="16" />
50
+ </template>
51
+ </NcButton>
52
+ </div>
53
+ </div>
54
+
55
+ <p v-if="localItems.length === 0" class="cn-mass-delete__empty">
56
+ {{ emptyText }}
57
+ </p>
58
+ <CnConfirmValueField v-if="confirmValue !== ''"
59
+ v-model="typedConfirmValue"
60
+ :value="confirmValue"
61
+ :label="confirmFieldLabel" />
62
+ </div>
63
+
64
+ <!-- Result phase -->
65
+ <div v-else
66
+ class="cn-mass-delete__result"
67
+ data-testid="cn-modal"
68
+ :data-testid-modal="testidPrefix + '-dialog'"
69
+ data-testid-phase="result">
70
+ <NcNoteCard v-if="result.success" type="success">
71
+ {{ successText }}
72
+ </NcNoteCard>
73
+ <NcNoteCard v-if="result.error" type="error">
74
+ {{ result.error }}
75
+ </NcNoteCard>
76
+ </div>
77
+
78
+ <template #actions>
79
+ <NcButton :disabled="loading" @click="$emit('close')">
80
+ {{ result === null ? cancelLabel : closeLabel }}
81
+ </NcButton>
82
+ <NcButton
83
+ v-if="result === null"
84
+ :variant="variant"
85
+ :class="{ 'cn-dialog__confirm-pending': confirmValuePending }"
86
+ :disabled="loading || localItems.length === 0 || confirmValuePending"
87
+ :aria-disabled="confirmValuePending ? 'true' : undefined"
88
+ :data-testid="testidPrefix + '-dialog-confirm'"
89
+ @click="executeConfirm">
90
+ <template v-if="loading || confirmIcon" #icon>
91
+ <NcLoadingIcon v-if="loading" :size="20" />
92
+ <CnIcon v-else-if="typeof confirmIcon === 'string'" :name="confirmIcon" :size="20" />
93
+ <component :is="confirmIcon" v-else :size="20" />
94
+ </template>
95
+ {{ confirmLabel }}
96
+ </NcButton>
97
+ </template>
98
+ </CnDialog>
99
+ </template>
100
+
101
+ <script>
102
+ import { translatePlural as n, translate as t } from '@nextcloud/l10n'
103
+ import { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue'
104
+ import AlertOutline from 'vue-material-design-icons/AlertOutline.vue'
105
+ import Close from 'vue-material-design-icons/Close.vue'
106
+ import CnConfirmValueField from '../CnConfirmValueField/CnConfirmValueField.vue'
107
+ import CnDialog from '../CnDialog/CnDialog.vue'
108
+ import { confirmValueMixin } from '../../mixins/confirmValue.js'
109
+ import { dialogBoardMixin } from '../../mixins/dialogBoard.js'
110
+ import { splitAroundPlaceholder } from '../../utils/dialogSentence.js'
111
+ import { CnIcon } from '../CnIcon/index.js'
112
+
113
+ /**
114
+ * CnMassActionDialog — two-phase confirmation dialog for one action on many
115
+ * items: publish, lock, validate, restore, delete.
116
+ *
117
+ * Phase 1 (review): shows the items the action applies to, each with a button
118
+ * that takes it off the list. Phase 2 (result): shows success or an error.
119
+ *
120
+ * The dialog does NOT perform the action itself. It emits `confirm` with the
121
+ * ids of the items still on the list; the parent performs the call and
122
+ * reports back through `setResult()` on a ref.
123
+ *
124
+ * ```vue
125
+ * <CnMassActionDialog
126
+ * v-if="showPublish"
127
+ * ref="publishDialog"
128
+ * :items="selectedObjects"
129
+ * :dialog-title="t('myapp', 'Publish objects')"
130
+ * :warning-text="t('myapp', 'The following objects will be published.')"
131
+ * :confirm-label="t('myapp', 'Publish')"
132
+ * confirm-icon="Publish"
133
+ * @confirm="onPublishConfirm"
134
+ * @close="showPublish = false" />
135
+ * ```
136
+ *
137
+ * // In methods:
138
+ * async onPublishConfirm(ids) {
139
+ * try {
140
+ * await store.massPublish(ids)
141
+ * this.$refs.publishDialog.setResult({ success: true })
142
+ * } catch (e) {
143
+ * this.$refs.publishDialog.setResult({ error: e.message })
144
+ * }
145
+ * }
146
+ *
147
+ * `CnMassDeleteDialog` is this dialog with the delete texts, the `error`
148
+ * variant and a trash icon as defaults.
149
+ *
150
+ * @event close Emitted when the dialog should be closed (cancel, close button, or auto-close after success).
151
+ */
152
+ export default {
153
+ name: 'CnMassActionDialog',
154
+
155
+ /** Prefix of the dialog's test ids: `<prefix>-dialog`, `<prefix>-dialog-confirm`, `<prefix>-sentence`, `<prefix>-note`. */
156
+ testidPrefix: 'cn-mass-action',
157
+
158
+ components: {
159
+ CnDialog,
160
+ NcButton,
161
+ NcNoteCard,
162
+ NcLoadingIcon,
163
+ CnIcon,
164
+ Close,
165
+ AlertOutline,
166
+ CnConfirmValueField,
167
+ },
168
+
169
+ mixins: [dialogBoardMixin, confirmValueMixin],
170
+
171
+ props: {
172
+ /** Items the action applies to. Each must have an `id` property. */
173
+ items: {
174
+ type: Array,
175
+ required: true,
176
+ },
177
+
178
+ /** Property name used for display (e.g., 'title', 'name') */
179
+ nameField: {
180
+ type: String,
181
+ default: 'title',
182
+ },
183
+
184
+ /** Optional function to format the item name. Receives the item, returns a string. Overrides nameField when provided. */
185
+ nameFormatter: {
186
+ type: Function,
187
+ default: null,
188
+ },
189
+
190
+ /** Dialog title */
191
+ dialogTitle: {
192
+ type: String,
193
+ default: () => t('nextcloud-vue', 'Confirm action'),
194
+ },
195
+
196
+ /** Warning text shown above the item list */
197
+ warningText: {
198
+ type: String,
199
+ default: () => t('nextcloud-vue', 'The action applies to the following items. Remove any items you want to leave out.'),
200
+ },
201
+
202
+ /** Text when all items removed from list */
203
+ emptyText: {
204
+ type: String,
205
+ default: () => t('nextcloud-vue', 'No items selected.'),
206
+ },
207
+
208
+ /** Success message */
209
+ successText: {
210
+ type: String,
211
+ default: () => t('nextcloud-vue', 'Done.'),
212
+ },
213
+
214
+ /** Label for the cancel button (visible before the action runs). */
215
+ cancelLabel: { type: String, default: () => t('nextcloud-vue', 'Cancel') },
216
+ /** Label for the close button (visible after the action completes). */
217
+ closeLabel: { type: String, default: () => t('nextcloud-vue', 'Close') },
218
+ /** Label for the primary button that confirms the action. */
219
+ confirmLabel: { type: String, default: () => t('nextcloud-vue', 'Confirm') },
220
+ /** Aria label for the per-row "remove from list" icon button. */
221
+ removeLabel: { type: String, default: () => t('nextcloud-vue', 'Remove from list') },
222
+
223
+ /**
224
+ * Visual variant of the primary button. Use `error` for a destructive
225
+ * action such as delete or purge.
226
+ */
227
+ variant: {
228
+ type: String,
229
+ default: 'primary',
230
+ validator: (v) => ['primary', 'error', 'warning', 'success'].includes(v),
231
+ },
232
+
233
+ /**
234
+ * Icon on the primary button: a CnIcon name (`Publish`) or an icon
235
+ * component. Empty draws none.
236
+ *
237
+ * @type {string|object}
238
+ */
239
+ confirmIcon: { type: [String, Object], default: '' },
240
+
241
+ /**
242
+ * Board look: the question above the list, with `{count}` where the
243
+ * bold item count goes.
244
+ */
245
+ sentence: {
246
+ type: String,
247
+ default: () => t('nextcloud-vue', 'Are you sure you want to continue with {count}?'),
248
+ },
249
+
250
+ /** Board look: end the sentence with "This action cannot be undone." */
251
+ irreversible: { type: Boolean, default: false },
252
+ },
253
+
254
+ emits: ['close', 'confirm'],
255
+
256
+ data() {
257
+ return {
258
+ localItems: [...this.items],
259
+ loading: false,
260
+ result: null,
261
+ closeTimeout: null,
262
+ }
263
+ },
264
+
265
+ computed: {
266
+ /** The board sentence around the bold item count. */
267
+ sentenceParts() {
268
+ return splitAroundPlaceholder(this.sentence, 'count')
269
+ },
270
+
271
+ /** Prefix of the test ids, set per preset. */
272
+ testidPrefix() {
273
+ return this.$options.testidPrefix
274
+ },
275
+
276
+ countLabel() {
277
+ return n('nextcloud-vue', '%n item', '%n items', this.localItems.length)
278
+ },
279
+
280
+ irreversibleText() {
281
+ return t('nextcloud-vue', 'This action cannot be undone.')
282
+ },
283
+ },
284
+
285
+ watch: {
286
+ items(val) {
287
+ this.localItems = [...val]
288
+ },
289
+ },
290
+
291
+ beforeUnmount() {
292
+ if (this.closeTimeout) {
293
+ clearTimeout(this.closeTimeout)
294
+ }
295
+ },
296
+
297
+ methods: {
298
+ getItemName(item) {
299
+ if (this.nameFormatter) {
300
+ return this.nameFormatter(item)
301
+ }
302
+ return item[this.nameField] || item.name || item.title || item.id
303
+ },
304
+
305
+ removeItem(id) {
306
+ this.localItems = this.localItems.filter((i) => i.id !== id)
307
+ },
308
+
309
+ executeConfirm() {
310
+ if (!this.confirmValueMatches) {
311
+ return
312
+ }
313
+ this.loading = true
314
+ const ids = this.localItems.map((i) => i.id)
315
+ /**
316
+ * Emitted when the user confirms the action. Payload: the ids of the items still on the list.
317
+ *
318
+ * @event confirm
319
+ * @type {Array<string|number>}
320
+ */
321
+ this.$emit('confirm', ids)
322
+ },
323
+
324
+ /**
325
+ * Set the result of the action. Call this from the parent
326
+ * after the API call completes.
327
+ *
328
+ * @param {{ success?: boolean, error?: string }} resultData - Result data to pass to the dialog
329
+ * @public
330
+ */
331
+ setResult(resultData) {
332
+ this.loading = false
333
+ this.result = resultData
334
+ if (resultData.success) {
335
+ this.closeTimeout = setTimeout(() => {
336
+ /**
337
+ * Emitted when the dialog should close: cancel, close button, or 2 seconds after a success.
338
+ *
339
+ * @event close
340
+ */
341
+ this.$emit('close')
342
+ }, 2000)
343
+ }
344
+ },
345
+ },
346
+ }
347
+ </script>
348
+
349
+ <style scoped>
350
+ /* Every preset keeps the cn-mass-delete class names: apps style against them. */
351
+ .cn-mass-delete__list {
352
+ max-height: 300px;
353
+ overflow-y: auto;
354
+ margin-top: 12px;
355
+ }
356
+
357
+ .cn-mass-delete__item {
358
+ display: flex;
359
+ align-items: center;
360
+ justify-content: space-between;
361
+ padding: 8px 12px;
362
+ border-bottom: 1px solid var(--color-border);
363
+ }
364
+
365
+ .cn-mass-delete__item:last-child {
366
+ border-bottom: none;
367
+ }
368
+
369
+ .cn-mass-delete__item-name {
370
+ font-weight: 500;
371
+ overflow: hidden;
372
+ text-overflow: ellipsis;
373
+ white-space: nowrap;
374
+ }
375
+
376
+ .cn-mass-delete__empty {
377
+ text-align: center;
378
+ color: var(--color-text-maxcontrast);
379
+ font-style: italic;
380
+ padding: 20px;
381
+ }
382
+ </style>
@@ -0,0 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Conduction B.V.
2
+ // SPDX-License-Identifier: EUPL-1.2
3
+
4
+ import CnMassActionDialog from './CnMassActionDialog.vue'
5
+
6
+ export default CnMassActionDialog
7
+ export { CnMassActionDialog }
@@ -54,3 +54,7 @@ All user-visible strings have props so they can be pre-translated by the consume
54
54
  ## Board look
55
55
 
56
56
  In the board look the sentence ends with "This action cannot be undone." unless you pass `:irreversible="false"`.
57
+
58
+ ## Other actions
59
+
60
+ This dialog is `CnMassActionDialog` with delete defaults. Pass `variant` (default `'error'`), `confirmIcon` (a CnIcon name or an icon component, default a trash can) and `sentence` to change them, or use `CnMassActionDialog` for an action that is not a delete.