@conduction/nextcloud-vue 2.170.0 → 2.172.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.
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +22 -3
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js +242 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js +200 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroup.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js +9 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js +186 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js +24 -0
- package/dist/esm/components/CnConditionGroupEditor/CnConditionGroupEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue.js +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js +3 -15
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js +16 -61
- package/dist/esm/components/CnConditionListEditor/CnConditionListEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js +9 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js +120 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue2.js.map +1 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js +86 -0
- package/dist/esm/components/CnConditionListEditor/CnConditionRow.vue3.js.map +1 -0
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +9 -9
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +75 -4
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js +8 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js +101 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue2.js.map +1 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js +54 -0
- package/dist/esm/components/CnDialogActions/CnDialogActions.vue3.js.map +1 -0
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +7 -3
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +14 -2
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +7 -0
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +2 -2
- package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +11 -0
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +2 -1
- package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js +9 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue.js.map +1 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js +248 -0
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue2.js.map +1 -0
- package/dist/esm/components/{CnMassDeleteDialog/CnMassDeleteDialog.vue3.js → CnMassActionDialog/CnMassActionDialog.vue3.js} +66 -52
- package/dist/esm/components/CnMassActionDialog/CnMassActionDialog.vue3.js.map +1 -0
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js +0 -3
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue.js.map +1 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js +25 -121
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js +11 -3
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue2.js.map +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js +1 -1
- package/dist/esm/components/CnNotesCard/CnNotesCard.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue.js +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +21 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +2 -2
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +23 -5
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +3 -0
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +14 -4
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue.js +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue2.js.map +1 -1
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js +5 -3
- package/dist/esm/dialogs/CnConfirmDialog.vue3.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +16 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +16 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +908 -464
- package/dist/esm/utils/builtInFormatters.js +19 -1
- package/dist/esm/utils/builtInFormatters.js.map +1 -1
- package/dist/esm/utils/noteThreads.js +14 -2
- package/dist/esm/utils/noteThreads.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +11435 -10084
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +908 -464
- package/l10n/en.json +16 -1
- package/l10n/nl.json +16 -1
- package/package.json +1 -1
- package/scripts/.jsdoc-baselines.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +4 -1
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +24 -3
- package/src/components/CnConditionGroupEditor/CnConditionGroup.vue +528 -0
- package/src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue +211 -0
- package/src/components/CnConditionGroupEditor/index.js +9 -0
- package/src/components/CnConditionListEditor/CnConditionListEditor.vue +15 -78
- package/src/components/CnConditionListEditor/CnConditionRow.vue +226 -0
- package/src/components/CnDetailPage/CnDetailPage.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHeaderItems.vue +6 -0
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +0 -6
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +75 -4
- package/src/components/CnDialogActions/CnDialogActions.vue +124 -0
- package/src/components/CnDialogActions/index.js +7 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +7 -3
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +15 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +21 -2
- package/src/components/CnFlowsPage/CnFlowBoard.vue +10 -3
- package/src/components/CnFlowsPage/CnFlowEditorPage.vue +12 -0
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +7 -0
- package/src/components/CnMassActionDialog/CnMassActionDialog.vue +382 -0
- package/src/components/CnMassActionDialog/index.js +7 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.md +4 -0
- package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +25 -254
- package/src/components/CnNotesCard/CnNotesCard.vue +12 -4
- package/src/components/CnObjectSidebar/CnNotesTab.vue +23 -3
- package/src/components/CnTreeView/CnTreeNode.vue +10 -1
- package/src/components/CnTreeView/CnTreeView.vue +9 -0
- package/src/components/index.js +3 -0
- package/src/css/context-menu.css +7 -0
- package/src/css/look-board-detail.css +220 -2
- package/src/css/look-board-index.css +7 -6
- package/src/css/look-board.css +43 -2
- package/src/css/patches.css +4 -1
- package/src/dialogs/CnConfirmDialog.vue +3 -1
- package/src/index.js +3 -0
- package/src/utils/builtInFormatters.js +18 -0
- package/src/utils/noteThreads.js +13 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
|
@@ -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>
|
|
@@ -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.
|