@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,211 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div class="cn-condition-group-editor">
|
|
8
|
+
<CnConditionGroup
|
|
9
|
+
:node="tree"
|
|
10
|
+
:depth="0"
|
|
11
|
+
path="$"
|
|
12
|
+
:fields="fieldList"
|
|
13
|
+
:operatorsFor="operatorsFor"
|
|
14
|
+
:maxDepth="maxDepth"
|
|
15
|
+
:errors="errors"
|
|
16
|
+
:emptyText="emptyText"
|
|
17
|
+
@update:node="onUpdate" />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import CnConditionGroup from './CnConditionGroup.vue'
|
|
23
|
+
import { operatorLabel, operatorsForType } from '../CnConditionListEditor/conditionOperators.js'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A rule value as a group: a group keeps its shape with `type` upper-cased; a
|
|
27
|
+
* bare condition, a list of nodes, or `children` without a `type` read as an
|
|
28
|
+
* AND group of them; anything else reads as an empty AND group.
|
|
29
|
+
*
|
|
30
|
+
* @param {unknown} value The bound value.
|
|
31
|
+
* @return {{type: string, children: Array}} A detached group.
|
|
32
|
+
*/
|
|
33
|
+
function toGroup(value) {
|
|
34
|
+
let copy
|
|
35
|
+
try {
|
|
36
|
+
copy = JSON.parse(JSON.stringify(value ?? null))
|
|
37
|
+
} catch {
|
|
38
|
+
copy = null
|
|
39
|
+
}
|
|
40
|
+
if (Array.isArray(copy)) {
|
|
41
|
+
return { type: 'AND', children: copy }
|
|
42
|
+
}
|
|
43
|
+
if (!copy || typeof copy !== 'object') {
|
|
44
|
+
return { type: 'AND', children: [] }
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(copy.children)) {
|
|
47
|
+
return { ...copy, type: copy.type ? String(copy.type).toUpperCase() : 'AND' }
|
|
48
|
+
}
|
|
49
|
+
if ('field' in copy || 'operator' in copy) {
|
|
50
|
+
return { type: 'AND', children: [copy] }
|
|
51
|
+
}
|
|
52
|
+
return { type: 'AND', children: [] }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* CnConditionGroupEditor - the conditions of a rule in groups: each group
|
|
57
|
+
* chooses whether all or any of its conditions must hold, and the root may
|
|
58
|
+
* hold inner groups ("this, and one of these"). Rows are CnConditionRow, the
|
|
59
|
+
* same field, operator and value row as CnConditionListEditor.
|
|
60
|
+
*
|
|
61
|
+
* v-model on `{ type: 'AND' | 'OR', children }`, where a child is a
|
|
62
|
+
* condition `{ field, operator, value }` or another group, in both dialects
|
|
63
|
+
* (`value`/`input` and `modelValue`/`update:modelValue`). Add group shows
|
|
64
|
+
* only on groups above `maxDepth`; a deeper tree still renders every level.
|
|
65
|
+
* A group of another type (NOT) shows as a locked row that can only be
|
|
66
|
+
* removed.
|
|
67
|
+
*/
|
|
68
|
+
export default {
|
|
69
|
+
name: 'CnConditionGroupEditor',
|
|
70
|
+
|
|
71
|
+
components: { CnConditionGroup },
|
|
72
|
+
|
|
73
|
+
props: {
|
|
74
|
+
/**
|
|
75
|
+
* The group tree.
|
|
76
|
+
*
|
|
77
|
+
* @type {{type: string, children: Array}}
|
|
78
|
+
*/
|
|
79
|
+
value: { type: [Object, Array], default: () => ({ type: 'AND', children: [] }) },
|
|
80
|
+
/**
|
|
81
|
+
* The same value under Vue 3's v-model name; wins over `value` when passed.
|
|
82
|
+
*
|
|
83
|
+
* @type {object}
|
|
84
|
+
*/
|
|
85
|
+
modelValue: { type: [Object, Array], default: undefined },
|
|
86
|
+
/**
|
|
87
|
+
* The fields a condition may name: `{ id | value, label, type?, format?, options? }`.
|
|
88
|
+
* `type` number or integer types a number, `type` or `format` date picks a
|
|
89
|
+
* date, `type` boolean or `options` (`[{ id, label }]`) make the value a choice.
|
|
90
|
+
*
|
|
91
|
+
* @type {Array<object>}
|
|
92
|
+
*/
|
|
93
|
+
fields: { type: Array, default: () => [] },
|
|
94
|
+
/**
|
|
95
|
+
* The operators, in the host's own names: a map from field type to
|
|
96
|
+
* `[{ value, label }]` (`default` for any other type), or a function
|
|
97
|
+
* `(field) => [{ value, label }]`. Without it, the operators of
|
|
98
|
+
* CnConditionListEditor are offered.
|
|
99
|
+
*
|
|
100
|
+
* @type {object|function(object): Array<{value: string, label: string}>}
|
|
101
|
+
*/
|
|
102
|
+
operators: { type: [Object, Function], default: null },
|
|
103
|
+
/**
|
|
104
|
+
* The deepest level Add group may build; 1 lets the root hold groups
|
|
105
|
+
* of conditions.
|
|
106
|
+
*
|
|
107
|
+
* @type {number}
|
|
108
|
+
*/
|
|
109
|
+
maxDepth: { type: Number, default: 1 },
|
|
110
|
+
/**
|
|
111
|
+
* Messages keyed by node path (`$.children[1].children[0]`), already
|
|
112
|
+
* translated, shown on that row or group.
|
|
113
|
+
*
|
|
114
|
+
* @type {object}
|
|
115
|
+
*/
|
|
116
|
+
errors: { type: Object, default: () => ({}) },
|
|
117
|
+
/**
|
|
118
|
+
* What an empty root says, already translated.
|
|
119
|
+
*
|
|
120
|
+
* @type {string}
|
|
121
|
+
*/
|
|
122
|
+
emptyText: { type: String, default: '' },
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
emits: ['input', 'update:modelValue'],
|
|
126
|
+
|
|
127
|
+
data() {
|
|
128
|
+
return {
|
|
129
|
+
tree: toGroup(this.modelValue !== undefined ? this.modelValue : this.value),
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
computed: {
|
|
134
|
+
fieldList() {
|
|
135
|
+
return this.fields.map((f) => ({ ...f, id: f.id ?? f.value }))
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
watch: {
|
|
140
|
+
value(next) {
|
|
141
|
+
if (this.modelValue === undefined) {
|
|
142
|
+
this.take(next)
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
modelValue(next) {
|
|
147
|
+
if (next !== undefined) {
|
|
148
|
+
this.take(next)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
methods: {
|
|
154
|
+
take(next) {
|
|
155
|
+
const group = toGroup(next)
|
|
156
|
+
if (JSON.stringify(group) !== JSON.stringify(this.tree)) {
|
|
157
|
+
this.tree = group
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The operator choices of a field, as `[{ id, label }]`.
|
|
163
|
+
*
|
|
164
|
+
* @param {object|undefined} field The field.
|
|
165
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
166
|
+
*/
|
|
167
|
+
operatorsFor(field) {
|
|
168
|
+
let list
|
|
169
|
+
if (typeof this.operators === 'function') {
|
|
170
|
+
list = this.operators(field)
|
|
171
|
+
} else if (this.operators) {
|
|
172
|
+
list = this.operators[field?.type] || this.operators.default || []
|
|
173
|
+
} else {
|
|
174
|
+
return operatorsForType(field?.type).map((id) => ({ id, label: operatorLabel(id) }))
|
|
175
|
+
}
|
|
176
|
+
return (list || []).map((o) => ({ id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }))
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Keep the edited tree and tell the consumer, in both v-model dialects.
|
|
181
|
+
*
|
|
182
|
+
* @param {object} next The edited tree.
|
|
183
|
+
* @return {void}
|
|
184
|
+
*/
|
|
185
|
+
onUpdate(next) {
|
|
186
|
+
this.tree = next
|
|
187
|
+
const copy = JSON.parse(JSON.stringify(next))
|
|
188
|
+
/**
|
|
189
|
+
* The tree changed.
|
|
190
|
+
*
|
|
191
|
+
* @event input
|
|
192
|
+
* @type {object}
|
|
193
|
+
*/
|
|
194
|
+
this.$emit('input', copy)
|
|
195
|
+
/**
|
|
196
|
+
* The tree changed (Vue 3 v-model).
|
|
197
|
+
*
|
|
198
|
+
* @event update:modelValue
|
|
199
|
+
* @type {object}
|
|
200
|
+
*/
|
|
201
|
+
this.$emit('update:modelValue', copy)
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<style scoped>
|
|
208
|
+
.cn-condition-group-editor {
|
|
209
|
+
min-width: 0;
|
|
210
|
+
}
|
|
211
|
+
</style>
|
|
@@ -11,54 +11,20 @@
|
|
|
11
11
|
<p v-if="rows.length === 0" class="cn-condition-list__empty">
|
|
12
12
|
{{ emptyText || t('nextcloud-vue', 'No conditions: the rule always applies.') }}
|
|
13
13
|
</p>
|
|
14
|
-
<
|
|
14
|
+
<CnConditionRow
|
|
15
15
|
v-for="(row, i) in rows"
|
|
16
16
|
:key="i"
|
|
17
|
-
class="cn-condition-list__row"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:modelValue="operatorOption(row.operator)"
|
|
29
|
-
:options="operatorOptions(row.field)"
|
|
30
|
-
label="label"
|
|
31
|
-
:inputLabel="t('nextcloud-vue', 'Operator')"
|
|
32
|
-
:clearable="false"
|
|
33
|
-
:disabled="!row.field"
|
|
34
|
-
@update:modelValue="setOperator(i, $event)" />
|
|
35
|
-
<template v-if="takesValue(row.operator)">
|
|
36
|
-
<NcSelect
|
|
37
|
-
v-if="valueOptions(row.field)"
|
|
38
|
-
class="cn-condition-list__value"
|
|
39
|
-
:modelValue="valueOption(row)"
|
|
40
|
-
:options="valueOptions(row.field)"
|
|
41
|
-
label="label"
|
|
42
|
-
:inputLabel="t('nextcloud-vue', 'Value')"
|
|
43
|
-
:clearable="false"
|
|
44
|
-
@update:modelValue="setValue(i, $event ? $event.id : '')" />
|
|
45
|
-
<NcTextField
|
|
46
|
-
v-else
|
|
47
|
-
class="cn-condition-list__value"
|
|
48
|
-
:type="inputType(row.field)"
|
|
49
|
-
:modelValue="row.value === undefined || row.value === null ? '' : String(row.value)"
|
|
50
|
-
:label="t('nextcloud-vue', 'Value')"
|
|
51
|
-
@update:modelValue="setValue(i, typedValue(row.field, $event))" />
|
|
52
|
-
</template>
|
|
53
|
-
<NcButton
|
|
54
|
-
variant="tertiary"
|
|
55
|
-
:aria-label="t('nextcloud-vue', 'Remove condition')"
|
|
56
|
-
@click="remove(i)">
|
|
57
|
-
<template #icon>
|
|
58
|
-
<Close :size="18" />
|
|
59
|
-
</template>
|
|
60
|
-
</NcButton>
|
|
61
|
-
</div>
|
|
17
|
+
class="cn-condition-list__row"
|
|
18
|
+
:condition="row"
|
|
19
|
+
:fieldOptions="fieldOptions"
|
|
20
|
+
:operatorOptions="operatorOptions(row.field)"
|
|
21
|
+
:valueOptions="valueOptions(row.field)"
|
|
22
|
+
:inputType="inputType(row.field)"
|
|
23
|
+
:showValue="takesValue(row.operator)"
|
|
24
|
+
@field="setField(i, $event)"
|
|
25
|
+
@operator="setOperator(i, $event)"
|
|
26
|
+
@value="setValue(i, valueOptions(row.field) ? $event : typedValue(row.field, $event))"
|
|
27
|
+
@remove="remove(i)" />
|
|
62
28
|
<NcButton variant="tertiary" :disabled="fields.length === 0" @click="add">
|
|
63
29
|
<template #icon>
|
|
64
30
|
<Plus :size="18" />
|
|
@@ -70,9 +36,9 @@
|
|
|
70
36
|
|
|
71
37
|
<script>
|
|
72
38
|
import { translate as t } from '@nextcloud/l10n'
|
|
73
|
-
import { NcButton
|
|
74
|
-
import Close from 'vue-material-design-icons/Close.vue'
|
|
39
|
+
import { NcButton } from '@nextcloud/vue'
|
|
75
40
|
import Plus from 'vue-material-design-icons/Plus.vue'
|
|
41
|
+
import CnConditionRow from './CnConditionRow.vue'
|
|
76
42
|
import { operatorLabel, operatorsForType, operatorTakesValue } from './conditionOperators.js'
|
|
77
43
|
|
|
78
44
|
/**
|
|
@@ -88,7 +54,7 @@ import { operatorLabel, operatorsForType, operatorTakesValue } from './condition
|
|
|
88
54
|
export default {
|
|
89
55
|
name: 'CnConditionListEditor',
|
|
90
56
|
|
|
91
|
-
components: {
|
|
57
|
+
components: { CnConditionRow, NcButton, Plus },
|
|
92
58
|
|
|
93
59
|
props: {
|
|
94
60
|
/**
|
|
@@ -181,18 +147,10 @@ export default {
|
|
|
181
147
|
return this.fields.find((f) => f.id === id)
|
|
182
148
|
},
|
|
183
149
|
|
|
184
|
-
fieldOption(id) {
|
|
185
|
-
return this.fieldOptions.find((o) => o.id === id) || null
|
|
186
|
-
},
|
|
187
|
-
|
|
188
150
|
operatorOptions(fieldId) {
|
|
189
151
|
return operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))
|
|
190
152
|
},
|
|
191
153
|
|
|
192
|
-
operatorOption(operator) {
|
|
193
|
-
return operator ? { id: operator, label: operatorLabel(operator) } : null
|
|
194
|
-
},
|
|
195
|
-
|
|
196
154
|
takesValue(operator) {
|
|
197
155
|
return operatorTakesValue(operator)
|
|
198
156
|
},
|
|
@@ -219,10 +177,6 @@ export default {
|
|
|
219
177
|
return null
|
|
220
178
|
},
|
|
221
179
|
|
|
222
|
-
valueOption(row) {
|
|
223
|
-
return (this.valueOptions(row.field) || []).find((o) => String(o.id) === String(row.value)) || null
|
|
224
|
-
},
|
|
225
|
-
|
|
226
180
|
inputType(fieldId) {
|
|
227
181
|
const type = this.fieldOf(fieldId)?.type
|
|
228
182
|
if (type === 'number' || type === 'integer') {
|
|
@@ -326,21 +280,4 @@ export default {
|
|
|
326
280
|
color: var(--color-text-maxcontrast);
|
|
327
281
|
margin: 0;
|
|
328
282
|
}
|
|
329
|
-
|
|
330
|
-
.cn-condition-list__row {
|
|
331
|
-
display: grid;
|
|
332
|
-
grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto;
|
|
333
|
-
gap: 8px;
|
|
334
|
-
align-items: end;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.cn-condition-list__row > :nth-child(3):last-child {
|
|
338
|
-
grid-column: 4;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
@media (max-width: 640px) {
|
|
342
|
-
.cn-condition-list__row {
|
|
343
|
-
grid-template-columns: minmax(0, 1fr) auto;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
283
|
</style>
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div class="cn-condition-row" :class="{ 'cn-condition-row--error': !!error }">
|
|
8
|
+
<div class="cn-condition-row__controls">
|
|
9
|
+
<NcSelect
|
|
10
|
+
class="cn-condition-row__field"
|
|
11
|
+
:modelValue="fieldOption"
|
|
12
|
+
:options="fieldOptions"
|
|
13
|
+
label="label"
|
|
14
|
+
v-bind="selectLabel(labels.field)"
|
|
15
|
+
:clearable="false"
|
|
16
|
+
@update:modelValue="$emit('field', $event)" />
|
|
17
|
+
<NcSelect
|
|
18
|
+
class="cn-condition-row__operator"
|
|
19
|
+
:modelValue="operatorOption"
|
|
20
|
+
:options="operatorOptions"
|
|
21
|
+
label="label"
|
|
22
|
+
v-bind="selectLabel(labels.operator)"
|
|
23
|
+
:clearable="false"
|
|
24
|
+
:disabled="!condition.field"
|
|
25
|
+
@update:modelValue="$emit('operator', $event)" />
|
|
26
|
+
<template v-if="showValue">
|
|
27
|
+
<NcSelect
|
|
28
|
+
v-if="valueOptions"
|
|
29
|
+
class="cn-condition-row__value"
|
|
30
|
+
:modelValue="valueOption"
|
|
31
|
+
:options="valueOptions"
|
|
32
|
+
label="label"
|
|
33
|
+
v-bind="selectLabel(labels.value)"
|
|
34
|
+
:clearable="false"
|
|
35
|
+
:disabled="!condition.field"
|
|
36
|
+
@update:modelValue="$emit('value', $event ? $event.id : '')" />
|
|
37
|
+
<NcTextField
|
|
38
|
+
v-else
|
|
39
|
+
class="cn-condition-row__value"
|
|
40
|
+
:type="inputType"
|
|
41
|
+
:modelValue="textValue"
|
|
42
|
+
:label="labels.value"
|
|
43
|
+
:disabled="!condition.field"
|
|
44
|
+
@update:modelValue="$emit('value', $event)" />
|
|
45
|
+
</template>
|
|
46
|
+
<NcButton
|
|
47
|
+
class="cn-condition-row__remove"
|
|
48
|
+
variant="tertiary"
|
|
49
|
+
:aria-label="t('nextcloud-vue', 'Remove condition')"
|
|
50
|
+
:title="t('nextcloud-vue', 'Remove condition')"
|
|
51
|
+
@click="$emit('remove')">
|
|
52
|
+
<template #icon>
|
|
53
|
+
<!-- @slot The remove button's icon; a close cross by default. -->
|
|
54
|
+
<slot name="remove-icon">
|
|
55
|
+
<Close :size="18" />
|
|
56
|
+
</slot>
|
|
57
|
+
</template>
|
|
58
|
+
</NcButton>
|
|
59
|
+
</div>
|
|
60
|
+
<p v-if="error" class="cn-condition-row__error" role="alert">
|
|
61
|
+
{{ error }}
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
68
|
+
import { NcButton, NcSelect, NcTextField } from '@nextcloud/vue'
|
|
69
|
+
import Close from 'vue-material-design-icons/Close.vue'
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* CnConditionRow - one condition as a row of field, operator and value, with
|
|
73
|
+
* a remove button. Shared by CnConditionListEditor and CnConditionGroupEditor;
|
|
74
|
+
* the editor owns the condition and decides the options, the row only draws
|
|
75
|
+
* them and reports what the user picked.
|
|
76
|
+
*/
|
|
77
|
+
export default {
|
|
78
|
+
name: 'CnConditionRow',
|
|
79
|
+
|
|
80
|
+
components: { NcButton, NcSelect, NcTextField, Close },
|
|
81
|
+
|
|
82
|
+
props: {
|
|
83
|
+
/**
|
|
84
|
+
* The condition drawn.
|
|
85
|
+
*
|
|
86
|
+
* @type {{field: string, operator: string, value?: unknown}}
|
|
87
|
+
*/
|
|
88
|
+
condition: { type: Object, required: true },
|
|
89
|
+
/**
|
|
90
|
+
* The field choices, `[{ id, label }]`.
|
|
91
|
+
*
|
|
92
|
+
* @type {Array<{id: string, label: string}>}
|
|
93
|
+
*/
|
|
94
|
+
fieldOptions: { type: Array, default: () => [] },
|
|
95
|
+
/**
|
|
96
|
+
* The operator choices for the condition's field, `[{ id, label }]`.
|
|
97
|
+
*
|
|
98
|
+
* @type {Array<{id: string, label: string}>}
|
|
99
|
+
*/
|
|
100
|
+
operatorOptions: { type: Array, default: () => [] },
|
|
101
|
+
/**
|
|
102
|
+
* The value choices, or null when the value is typed.
|
|
103
|
+
*
|
|
104
|
+
* @type {Array<{id: unknown, label: string}>|null}
|
|
105
|
+
*/
|
|
106
|
+
valueOptions: { type: Array, default: null },
|
|
107
|
+
/**
|
|
108
|
+
* The input type of a typed value: text, number or date.
|
|
109
|
+
*
|
|
110
|
+
* @type {string}
|
|
111
|
+
*/
|
|
112
|
+
inputType: { type: String, default: 'text' },
|
|
113
|
+
/**
|
|
114
|
+
* Whether the operator takes a value.
|
|
115
|
+
*
|
|
116
|
+
* @type {boolean}
|
|
117
|
+
*/
|
|
118
|
+
showValue: { type: Boolean, default: true },
|
|
119
|
+
/**
|
|
120
|
+
* Keep the field, operator and value labels for screen readers only.
|
|
121
|
+
*
|
|
122
|
+
* @type {boolean}
|
|
123
|
+
*/
|
|
124
|
+
hideLabels: { type: Boolean, default: false },
|
|
125
|
+
/**
|
|
126
|
+
* The labels of the three controls, already translated. Missing keys
|
|
127
|
+
* read Field, Operator and Value.
|
|
128
|
+
*
|
|
129
|
+
* @type {{field?: string, operator?: string, value?: string}}
|
|
130
|
+
*/
|
|
131
|
+
controlLabels: { type: Object, default: () => ({}) },
|
|
132
|
+
/**
|
|
133
|
+
* A message shown under the row, already translated.
|
|
134
|
+
*
|
|
135
|
+
* @type {string}
|
|
136
|
+
*/
|
|
137
|
+
error: { type: String, default: '' },
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
emits: ['field', 'operator', 'value', 'remove'],
|
|
141
|
+
|
|
142
|
+
computed: {
|
|
143
|
+
labels() {
|
|
144
|
+
return {
|
|
145
|
+
field: this.controlLabels.field || t('nextcloud-vue', 'Field'),
|
|
146
|
+
operator: this.controlLabels.operator || t('nextcloud-vue', 'Operator'),
|
|
147
|
+
value: this.controlLabels.value || t('nextcloud-vue', 'Value'),
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
fieldOption() {
|
|
152
|
+
return this.fieldOptions.find((o) => o.id === this.condition.field) || null
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
operatorOption() {
|
|
156
|
+
return this.operatorOptions.find((o) => o.id === this.condition.operator) || null
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
valueOption() {
|
|
160
|
+
return (this.valueOptions || []).find((o) => String(o.id) === String(this.condition.value)) || null
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
textValue() {
|
|
164
|
+
const value = this.condition.value
|
|
165
|
+
return value === undefined || value === null ? '' : String(value)
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
methods: {
|
|
170
|
+
t,
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The label binding of a select: shown above it, or for screen
|
|
174
|
+
* readers only.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} text The label.
|
|
177
|
+
* @return {object} The props.
|
|
178
|
+
*/
|
|
179
|
+
selectLabel(text) {
|
|
180
|
+
return this.hideLabels ? { ariaLabelCombobox: text } : { inputLabel: text }
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<style scoped>
|
|
187
|
+
.cn-condition-row {
|
|
188
|
+
min-width: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.cn-condition-row__controls {
|
|
192
|
+
display: grid;
|
|
193
|
+
grid-template-columns: var(--cn-condition-row-columns, minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr) auto);
|
|
194
|
+
gap: 8px;
|
|
195
|
+
align-items: var(--cn-condition-row-align, end);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.cn-condition-row__controls > :nth-child(3):last-child {
|
|
199
|
+
grid-column: 4;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.cn-condition-row__field,
|
|
203
|
+
.cn-condition-row__operator,
|
|
204
|
+
.cn-condition-row__value {
|
|
205
|
+
width: 100%;
|
|
206
|
+
min-width: 0;
|
|
207
|
+
margin: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.cn-condition-row--error .cn-condition-row__controls :deep(input),
|
|
211
|
+
.cn-condition-row--error .cn-condition-row__controls :deep(.vs__dropdown-toggle) {
|
|
212
|
+
border-color: var(--color-border-error, var(--color-error));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.cn-condition-row__error {
|
|
216
|
+
margin: 4px 0 0;
|
|
217
|
+
color: var(--color-text-error, var(--color-error));
|
|
218
|
+
font-size: 0.9em;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media (max-width: 640px) {
|
|
222
|
+
.cn-condition-row__controls {
|
|
223
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
@@ -523,8 +523,14 @@
|
|
|
523
523
|
:rootText="breadcrumbCrumbs[0].icon === undefined"
|
|
524
524
|
:separator="breadcrumbSeparator || '/'"
|
|
525
525
|
data-testid="cn-detail-page-breadcrumbs" />
|
|
526
|
+
<CnDetailHeaderChips
|
|
527
|
+
v-if="headerFields.length > 0"
|
|
528
|
+
:fields="headerFields"
|
|
529
|
+
:object="resolvedObject"
|
|
530
|
+
:schema="currentSchema"
|
|
531
|
+
:register="register" />
|
|
526
532
|
<span
|
|
527
|
-
v-if="breadcrumbCrumbs.length > 0 &&
|
|
533
|
+
v-if="(breadcrumbCrumbs.length > 0 || headerFields.length > 0) && headerMetaText"
|
|
528
534
|
class="cn-detail-page__header-dot"
|
|
529
535
|
aria-hidden="true"
|
|
530
536
|
data-testid="cn-detail-page-header-dot">·</span>
|
|
@@ -532,12 +538,6 @@
|
|
|
532
538
|
v-if="headerMetaText"
|
|
533
539
|
class="cn-detail-page__header-meta"
|
|
534
540
|
data-testid="cn-detail-page-header-meta">{{ headerMetaText }}</span>
|
|
535
|
-
<CnDetailHeaderChips
|
|
536
|
-
v-if="headerFields.length > 0"
|
|
537
|
-
:fields="headerFields"
|
|
538
|
-
:object="resolvedObject"
|
|
539
|
-
:schema="currentSchema"
|
|
540
|
-
:register="register" />
|
|
541
541
|
</div>
|
|
542
542
|
<!-- Row 3 of the board look's header: the Follow control under the
|
|
543
543
|
breadcrumb, clear of the title row and its actions (DqZaak
|
|
@@ -3814,7 +3814,7 @@ export default {
|
|
|
3814
3814
|
},
|
|
3815
3815
|
|
|
3816
3816
|
/**
|
|
3817
|
-
* Whether row 2 has a meta line or header chips to draw
|
|
3817
|
+
* Whether row 2 has a meta line or header chips to draw beside the
|
|
3818
3818
|
* breadcrumb.
|
|
3819
3819
|
*
|
|
3820
3820
|
* @return {boolean} True with meta or chips.
|
|
@@ -113,6 +113,12 @@ export default {
|
|
|
113
113
|
gap: 12px;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
.cn-detail-page__catalog-note {
|
|
117
|
+
color: var(--color-text-maxcontrast);
|
|
118
|
+
font-size: 14px;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
.cn-detail-page__catalog-action {
|
|
117
123
|
align-items: center;
|
|
118
124
|
background: var(--color-primary-element-light);
|
|
@@ -2200,12 +2200,6 @@ export default {
|
|
|
2200
2200
|
text-align: center;
|
|
2201
2201
|
}
|
|
2202
2202
|
|
|
2203
|
-
.cn-detail-page__catalog-note {
|
|
2204
|
-
color: var(--color-text-maxcontrast);
|
|
2205
|
-
font-size: 14px;
|
|
2206
|
-
white-space: nowrap;
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
2203
|
.cn-detail-widget-host,
|
|
2210
2204
|
.cn-detail-widget-host > * {
|
|
2211
2205
|
height: 100%;
|