@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.
- 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/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/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 +638 -302
- package/dist/esm/utils/noteThreads.js +14 -2
- package/dist/esm/utils/noteThreads.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +11316 -10074
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +638 -302
- 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/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/CnDialogActions/CnDialogActions.vue +124 -0
- package/src/components/CnDialogActions/index.js +7 -0
- 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 +120 -1
- package/src/css/look-board.css +43 -2
- package/src/dialogs/CnConfirmDialog.vue +3 -1
- package/src/index.js +3 -0
- package/src/utils/noteThreads.js +13 -1
- package/dist/esm/components/CnMassDeleteDialog/CnMassDeleteDialog.vue3.js.map +0 -1
package/l10n/en.json
CHANGED
|
@@ -2594,7 +2594,22 @@
|
|
|
2594
2594
|
"Shown on the card. Leave empty to show the step type.": "Shown on the card. Leave empty to show the step type.",
|
|
2595
2595
|
"The full configuration document. The fields above update along.": "The full configuration document. The fields above update along.",
|
|
2596
2596
|
"This step has no options.": "This step has no options.",
|
|
2597
|
-
"{uid} (you)": "{uid} (you)"
|
|
2597
|
+
"{uid} (you)": "{uid} (you)",
|
|
2598
|
+
"The action applies to the following items. Remove any items you want to leave out.": "The action applies to the following items. Remove any items you want to leave out.",
|
|
2599
|
+
"No items selected.": "No items selected.",
|
|
2600
|
+
"Are you sure you want to continue with {count}?": "Are you sure you want to continue with {count}?",
|
|
2601
|
+
"How the conditions combine": "How the conditions combine",
|
|
2602
|
+
"Match all conditions": "Match all conditions",
|
|
2603
|
+
"Match any condition": "Match any condition",
|
|
2604
|
+
"Where": "Where",
|
|
2605
|
+
"and": "and",
|
|
2606
|
+
"all of these": "all of these",
|
|
2607
|
+
"one of these": "one of these",
|
|
2608
|
+
"Add group": "Add group",
|
|
2609
|
+
"Remove group": "Remove group",
|
|
2610
|
+
"Condition": "Condition",
|
|
2611
|
+
"These conditions are kept as written": "These conditions are kept as written",
|
|
2612
|
+
"This group has no conditions yet.": "This group has no conditions yet."
|
|
2598
2613
|
},
|
|
2599
2614
|
"plurals": {
|
|
2600
2615
|
"{count} member": [
|
package/l10n/nl.json
CHANGED
|
@@ -2859,7 +2859,22 @@
|
|
|
2859
2859
|
"Shown on the card. Leave empty to show the step type.": "Staat op de kaart. Laat leeg om het soort stap te tonen.",
|
|
2860
2860
|
"The full configuration document. The fields above update along.": "Alle instellingen in één document. De velden hierboven passen zich aan.",
|
|
2861
2861
|
"This step has no options.": "Deze stap heeft geen opties.",
|
|
2862
|
-
"{uid} (you)": "{uid} (jij)"
|
|
2862
|
+
"{uid} (you)": "{uid} (jij)",
|
|
2863
|
+
"The action applies to the following items. Remove any items you want to leave out.": "De actie geldt voor de volgende items. Haal items weg die je wilt overslaan.",
|
|
2864
|
+
"No items selected.": "Geen items geselecteerd.",
|
|
2865
|
+
"Are you sure you want to continue with {count}?": "Weet je zeker dat je wilt doorgaan met {count}?",
|
|
2866
|
+
"How the conditions combine": "Hoe de voorwaarden samengaan",
|
|
2867
|
+
"Match all conditions": "Voldoet aan alle voorwaarden",
|
|
2868
|
+
"Match any condition": "Voldoet aan een van de voorwaarden",
|
|
2869
|
+
"Where": "Waarbij",
|
|
2870
|
+
"and": "en",
|
|
2871
|
+
"all of these": "al deze",
|
|
2872
|
+
"one of these": "een van deze",
|
|
2873
|
+
"Add group": "Groep toevoegen",
|
|
2874
|
+
"Remove group": "Groep verwijderen",
|
|
2875
|
+
"Condition": "Voorwaarde",
|
|
2876
|
+
"These conditions are kept as written": "Deze voorwaarden blijven zoals ze zijn geschreven",
|
|
2877
|
+
"This group has no conditions yet.": "Deze groep heeft nog geen voorwaarden."
|
|
2863
2878
|
},
|
|
2864
2879
|
"plurals": {
|
|
2865
2880
|
"{count} member": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/nextcloud-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.171.0",
|
|
4
4
|
"description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
|
|
5
5
|
"homepage": "https://github.com/ConductionNL/nextcloud-vue#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
- SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
3
|
+
- SPDX-License-Identifier: EUPL-1.2
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div
|
|
8
|
+
class="cn-condition-group"
|
|
9
|
+
:class="{
|
|
10
|
+
'cn-condition-group--nested': depth > 0,
|
|
11
|
+
'cn-condition-group--error': !!ownError,
|
|
12
|
+
}">
|
|
13
|
+
<div class="cn-condition-group__header">
|
|
14
|
+
<fieldset class="cn-condition-group__combinator">
|
|
15
|
+
<legend class="cn-condition-group__legend">
|
|
16
|
+
{{ t('nextcloud-vue', 'How the conditions combine') }}
|
|
17
|
+
</legend>
|
|
18
|
+
<NcCheckboxRadioSwitch
|
|
19
|
+
v-for="choice in combinators"
|
|
20
|
+
:key="choice.value"
|
|
21
|
+
type="radio"
|
|
22
|
+
:class="{ 'cn-condition-group__choice--checked': node.type === choice.value }"
|
|
23
|
+
:name="radioName"
|
|
24
|
+
:value="choice.value"
|
|
25
|
+
:modelValue="node.type"
|
|
26
|
+
@update:modelValue="setType">
|
|
27
|
+
{{ choice.label }}
|
|
28
|
+
</NcCheckboxRadioSwitch>
|
|
29
|
+
</fieldset>
|
|
30
|
+
<NcButton
|
|
31
|
+
v-if="depth > 0"
|
|
32
|
+
class="cn-condition-group__remove-group"
|
|
33
|
+
variant="tertiary"
|
|
34
|
+
@click="$emit('remove')">
|
|
35
|
+
<template #icon>
|
|
36
|
+
<TrashCanOutline :size="16" />
|
|
37
|
+
</template>
|
|
38
|
+
{{ t('nextcloud-vue', 'Remove group') }}
|
|
39
|
+
</NcButton>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<ol v-if="node.children.length" class="cn-condition-group__rows">
|
|
43
|
+
<li v-for="(child, index) in node.children" :key="index" class="cn-condition-group__item">
|
|
44
|
+
<template v-if="kindOf(child) === 'group'">
|
|
45
|
+
<div class="cn-condition-group__line">
|
|
46
|
+
<span class="cn-condition-group__connector">{{ connector(index) }}</span>
|
|
47
|
+
<span class="cn-condition-group__caption">{{ caption(child) }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
<CnConditionGroup
|
|
50
|
+
class="cn-condition-group__child"
|
|
51
|
+
:node="child"
|
|
52
|
+
:depth="depth + 1"
|
|
53
|
+
:path="childPath(index)"
|
|
54
|
+
:fields="fields"
|
|
55
|
+
:operatorsFor="operatorsFor"
|
|
56
|
+
:maxDepth="maxDepth"
|
|
57
|
+
:errors="errors"
|
|
58
|
+
@update:node="setChild(index, $event)"
|
|
59
|
+
@remove="removeChild(index)" />
|
|
60
|
+
</template>
|
|
61
|
+
<div v-else-if="kindOf(child) === 'locked'" class="cn-condition-group__line">
|
|
62
|
+
<span class="cn-condition-group__connector">{{ connector(index) }}</span>
|
|
63
|
+
<div class="cn-condition-group__locked">
|
|
64
|
+
<Lock :size="16" />
|
|
65
|
+
<span>{{ t('nextcloud-vue', 'These conditions are kept as written') }}</span>
|
|
66
|
+
<NcButton
|
|
67
|
+
class="cn-condition-group__pill"
|
|
68
|
+
variant="tertiary"
|
|
69
|
+
:aria-label="t('nextcloud-vue', 'Remove group')"
|
|
70
|
+
:title="t('nextcloud-vue', 'Remove group')"
|
|
71
|
+
@click="removeChild(index)">
|
|
72
|
+
<template #icon>
|
|
73
|
+
<TrashCanOutline :size="18" />
|
|
74
|
+
</template>
|
|
75
|
+
</NcButton>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div v-else class="cn-condition-group__line">
|
|
79
|
+
<span class="cn-condition-group__connector">{{ connector(index) }}</span>
|
|
80
|
+
<CnConditionRow
|
|
81
|
+
class="cn-condition-group__row"
|
|
82
|
+
:condition="child"
|
|
83
|
+
:fieldOptions="fieldOptionsFor(child)"
|
|
84
|
+
:operatorOptions="operatorOptionsFor(child)"
|
|
85
|
+
:valueOptions="valueOptionsFor(child)"
|
|
86
|
+
:inputType="inputTypeFor(child)"
|
|
87
|
+
:showValue="operatorTakesValue(child.operator)"
|
|
88
|
+
:controlLabels="controlLabels"
|
|
89
|
+
:error="errors[childPath(index)] || ''"
|
|
90
|
+
hideLabels
|
|
91
|
+
@field="setField(index, $event)"
|
|
92
|
+
@operator="setOperator(index, $event)"
|
|
93
|
+
@value="setValue(index, child, $event)"
|
|
94
|
+
@remove="removeChild(index)">
|
|
95
|
+
<template #remove-icon>
|
|
96
|
+
<TrashCanOutline :size="18" />
|
|
97
|
+
</template>
|
|
98
|
+
</CnConditionRow>
|
|
99
|
+
</div>
|
|
100
|
+
</li>
|
|
101
|
+
</ol>
|
|
102
|
+
<p v-else class="cn-condition-group__empty">
|
|
103
|
+
{{ depth === 0 && emptyText ? emptyText : t('nextcloud-vue', 'This group has no conditions yet.') }}
|
|
104
|
+
</p>
|
|
105
|
+
|
|
106
|
+
<p v-if="ownError" class="cn-condition-group__error" role="alert">
|
|
107
|
+
{{ ownError }}
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
<div class="cn-condition-group__actions">
|
|
111
|
+
<NcButton variant="tertiary" :disabled="fields.length === 0" @click="addCondition">
|
|
112
|
+
<template #icon>
|
|
113
|
+
<Plus :size="16" />
|
|
114
|
+
</template>
|
|
115
|
+
{{ t('nextcloud-vue', 'Add condition') }}
|
|
116
|
+
</NcButton>
|
|
117
|
+
<NcButton v-if="depth < maxDepth"
|
|
118
|
+
variant="tertiary"
|
|
119
|
+
:disabled="fields.length === 0"
|
|
120
|
+
@click="addGroup">
|
|
121
|
+
<template #icon>
|
|
122
|
+
<FolderPlusOutline :size="16" />
|
|
123
|
+
</template>
|
|
124
|
+
{{ t('nextcloud-vue', 'Add group') }}
|
|
125
|
+
</NcButton>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
import { translate as t } from '@nextcloud/l10n'
|
|
132
|
+
import { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue'
|
|
133
|
+
import FolderPlusOutline from 'vue-material-design-icons/FolderPlusOutline.vue'
|
|
134
|
+
import Lock from 'vue-material-design-icons/Lock.vue'
|
|
135
|
+
import Plus from 'vue-material-design-icons/Plus.vue'
|
|
136
|
+
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
|
|
137
|
+
import CnConditionRow from '../CnConditionListEditor/CnConditionRow.vue'
|
|
138
|
+
import { operatorTakesValue } from '../CnConditionListEditor/conditionOperators.js'
|
|
139
|
+
|
|
140
|
+
let groupSeq = 0
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* CnConditionGroup - one group of CnConditionGroupEditor: the combinator
|
|
144
|
+
* choice, its rows, and the groups inside it, drawn recursively. Internal to
|
|
145
|
+
* the editor, which owns the tree.
|
|
146
|
+
*/
|
|
147
|
+
export default {
|
|
148
|
+
name: 'CnConditionGroup',
|
|
149
|
+
|
|
150
|
+
components: { CnConditionRow, FolderPlusOutline, Lock, NcButton, NcCheckboxRadioSwitch, Plus, TrashCanOutline },
|
|
151
|
+
|
|
152
|
+
props: {
|
|
153
|
+
/** The group: `{ type: 'AND' | 'OR', children }`. */
|
|
154
|
+
node: { type: Object, required: true },
|
|
155
|
+
/** How deep this group sits; the root is 0. */
|
|
156
|
+
depth: { type: Number, default: 0 },
|
|
157
|
+
/** This group's path in validator notation (`$.children[1]`). */
|
|
158
|
+
path: { type: String, default: '$' },
|
|
159
|
+
/** The fields, normalised to `{ id, label, type, format?, options? }`. */
|
|
160
|
+
fields: { type: Array, default: () => [] },
|
|
161
|
+
/** The operators of a field, `(field) => [{ id, label }]`. */
|
|
162
|
+
operatorsFor: { type: Function, required: true },
|
|
163
|
+
/** The deepest group Add group may create. */
|
|
164
|
+
maxDepth: { type: Number, default: 1 },
|
|
165
|
+
/** Messages keyed by node path. */
|
|
166
|
+
errors: { type: Object, default: () => ({}) },
|
|
167
|
+
/** What an empty root says, already translated. */
|
|
168
|
+
emptyText: { type: String, default: '' },
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
emits: ['update:node', 'remove'],
|
|
172
|
+
|
|
173
|
+
data() {
|
|
174
|
+
groupSeq += 1
|
|
175
|
+
return { radioName: `cn-condition-group-${groupSeq}` }
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
computed: {
|
|
179
|
+
combinators() {
|
|
180
|
+
return [
|
|
181
|
+
{ value: 'AND', label: t('nextcloud-vue', 'Match all conditions') },
|
|
182
|
+
{ value: 'OR', label: t('nextcloud-vue', 'Match any condition') },
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
controlLabels() {
|
|
187
|
+
return {
|
|
188
|
+
field: t('nextcloud-vue', 'Field'),
|
|
189
|
+
operator: t('nextcloud-vue', 'Condition'),
|
|
190
|
+
value: t('nextcloud-vue', 'Value'),
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
ownError() {
|
|
195
|
+
return this.errors[this.path] || ''
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
methods: {
|
|
200
|
+
t,
|
|
201
|
+
operatorTakesValue,
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* What a child is: a group drawn as a card, a group the editor keeps
|
|
205
|
+
* as written (NOT), or a condition.
|
|
206
|
+
*
|
|
207
|
+
* @param {object} child The child node.
|
|
208
|
+
* @return {string} group, locked or condition.
|
|
209
|
+
*/
|
|
210
|
+
kindOf(child) {
|
|
211
|
+
if (!Array.isArray(child?.children)) {
|
|
212
|
+
return 'condition'
|
|
213
|
+
}
|
|
214
|
+
return ['AND', 'OR'].includes(String(child.type || 'AND').toUpperCase()) ? 'group' : 'locked'
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The word before a row: Where on the first, then and or or.
|
|
219
|
+
*
|
|
220
|
+
* @param {number} index The row index.
|
|
221
|
+
* @return {string} The word.
|
|
222
|
+
*/
|
|
223
|
+
connector(index) {
|
|
224
|
+
if (index === 0) {
|
|
225
|
+
return t('nextcloud-vue', 'Where')
|
|
226
|
+
}
|
|
227
|
+
return this.node.type === 'OR' ? t('nextcloud-vue', 'or') : t('nextcloud-vue', 'and')
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
caption(child) {
|
|
231
|
+
return String(child.type).toUpperCase() === 'OR'
|
|
232
|
+
? t('nextcloud-vue', 'one of these')
|
|
233
|
+
: t('nextcloud-vue', 'all of these')
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
childPath(index) {
|
|
237
|
+
return `${this.path}.children[${index}]`
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
fieldOf(id) {
|
|
241
|
+
return this.fields.find((f) => f.id === id)
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The field choices, plus a stored field the list does not offer.
|
|
246
|
+
*
|
|
247
|
+
* @param {object} child The condition.
|
|
248
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
249
|
+
*/
|
|
250
|
+
fieldOptionsFor(child) {
|
|
251
|
+
const options = this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))
|
|
252
|
+
if (child.field && !options.some((o) => o.id === child.field)) {
|
|
253
|
+
options.push({ id: child.field, label: child.field })
|
|
254
|
+
}
|
|
255
|
+
return options
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* The operator choices of the condition's field, plus a stored
|
|
260
|
+
* operator the list does not offer.
|
|
261
|
+
*
|
|
262
|
+
* @param {object} child The condition.
|
|
263
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
264
|
+
*/
|
|
265
|
+
operatorOptionsFor(child) {
|
|
266
|
+
const options = this.operatorsFor(this.fieldOf(child.field))
|
|
267
|
+
if (child.operator && !options.some((o) => o.id === child.operator)) {
|
|
268
|
+
return [...options, { id: child.operator, label: child.operator }]
|
|
269
|
+
}
|
|
270
|
+
return options
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
valueOptionsFor(child) {
|
|
274
|
+
const field = this.fieldOf(child.field)
|
|
275
|
+
if (field?.type === 'boolean') {
|
|
276
|
+
return [
|
|
277
|
+
{ id: true, label: t('nextcloud-vue', 'Yes') },
|
|
278
|
+
{ id: false, label: t('nextcloud-vue', 'No') },
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
if (Array.isArray(field?.options) && field.options.length > 0) {
|
|
282
|
+
return field.options.map((o) => (typeof o === 'object'
|
|
283
|
+
? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }
|
|
284
|
+
: { id: o, label: String(o) }))
|
|
285
|
+
}
|
|
286
|
+
return null
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
inputTypeFor(child) {
|
|
290
|
+
const field = this.fieldOf(child.field)
|
|
291
|
+
if (field?.type === 'number' || field?.type === 'integer') {
|
|
292
|
+
return 'number'
|
|
293
|
+
}
|
|
294
|
+
return field?.type === 'date' || field?.format === 'date' ? 'date' : 'text'
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
emitNode(next) {
|
|
298
|
+
this.$emit('update:node', next)
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
setChildren(children) {
|
|
302
|
+
this.emitNode({ ...this.node, children })
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
setChild(index, next) {
|
|
306
|
+
const children = [...this.node.children]
|
|
307
|
+
children[index] = next
|
|
308
|
+
this.setChildren(children)
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
removeChild(index) {
|
|
312
|
+
this.setChildren(this.node.children.filter((_, i) => i !== index))
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
setType(type) {
|
|
316
|
+
this.emitNode({ ...this.node, type: type === 'OR' ? 'OR' : 'AND' })
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
addCondition() {
|
|
320
|
+
this.setChildren([...this.node.children, { field: '', operator: '', value: '' }])
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
addGroup() {
|
|
324
|
+
this.setChildren([...this.node.children, { type: 'AND', children: [{ field: '', operator: '', value: '' }] }])
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Pick a field: the operator resets to the field's first one and the
|
|
329
|
+
* value clears, since a value for another field rarely fits.
|
|
330
|
+
*
|
|
331
|
+
* @param {number} index The row index.
|
|
332
|
+
* @param {object} option The field choice.
|
|
333
|
+
*/
|
|
334
|
+
setField(index, option) {
|
|
335
|
+
const field = this.fieldOf(option?.id)
|
|
336
|
+
const first = this.operatorsFor(field)[0]
|
|
337
|
+
this.setChild(index, {
|
|
338
|
+
field: option?.id || '',
|
|
339
|
+
operator: first ? first.id : '',
|
|
340
|
+
value: field?.type === 'boolean' ? true : '',
|
|
341
|
+
})
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
setOperator(index, option) {
|
|
345
|
+
const next = { ...this.node.children[index], operator: option?.id || '' }
|
|
346
|
+
if (!operatorTakesValue(next.operator)) {
|
|
347
|
+
delete next.value
|
|
348
|
+
} else if (next.value === undefined) {
|
|
349
|
+
next.value = ''
|
|
350
|
+
}
|
|
351
|
+
this.setChild(index, next)
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Set a value, as a number for a number field.
|
|
356
|
+
*
|
|
357
|
+
* @param {number} index The row index.
|
|
358
|
+
* @param {object} child The condition.
|
|
359
|
+
* @param {unknown} raw The picked or typed value.
|
|
360
|
+
*/
|
|
361
|
+
setValue(index, child, raw) {
|
|
362
|
+
let value = raw
|
|
363
|
+
if (this.inputTypeFor(child) === 'number' && raw !== '' && !Number.isNaN(Number(raw))) {
|
|
364
|
+
value = Number(raw)
|
|
365
|
+
}
|
|
366
|
+
this.setChild(index, { ...child, value })
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
}
|
|
370
|
+
</script>
|
|
371
|
+
|
|
372
|
+
<style scoped>
|
|
373
|
+
.cn-condition-group {
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
gap: 10px;
|
|
377
|
+
min-width: 0;
|
|
378
|
+
padding: 14px;
|
|
379
|
+
border: 1px solid var(--color-border);
|
|
380
|
+
border-radius: var(--border-radius-large);
|
|
381
|
+
--cn-condition-row-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.25fr) auto;
|
|
382
|
+
--cn-condition-row-align: center;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.cn-condition-group--nested {
|
|
386
|
+
margin-inline-start: 52px;
|
|
387
|
+
padding: 12px 12px 8px;
|
|
388
|
+
border-color: var(--color-border);
|
|
389
|
+
border-inline-start: 3px solid var(--color-primary-element);
|
|
390
|
+
border-radius: var(--border-radius-element, 8px);
|
|
391
|
+
background: var(--color-background-hover);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.cn-condition-group--error {
|
|
395
|
+
border-color: var(--color-border-error, var(--color-error));
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.cn-condition-group__header {
|
|
399
|
+
display: flex;
|
|
400
|
+
flex-wrap: wrap;
|
|
401
|
+
align-items: center;
|
|
402
|
+
justify-content: space-between;
|
|
403
|
+
gap: 8px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.cn-condition-group__combinator {
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-wrap: wrap;
|
|
409
|
+
align-items: center;
|
|
410
|
+
gap: 8px 18px;
|
|
411
|
+
margin: 0;
|
|
412
|
+
padding: 0;
|
|
413
|
+
border: 0;
|
|
414
|
+
min-width: 0;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.cn-condition-group__legend {
|
|
418
|
+
float: inline-start;
|
|
419
|
+
margin-inline-end: 6px;
|
|
420
|
+
padding: 0;
|
|
421
|
+
font-size: 13px;
|
|
422
|
+
color: var(--color-text-maxcontrast);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.cn-condition-group__choice--checked :deep(.checkbox-radio-switch__text) {
|
|
426
|
+
font-weight: 600;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.cn-condition-group__remove-group {
|
|
430
|
+
color: var(--color-text-error, var(--color-error));
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.cn-condition-group__rows {
|
|
434
|
+
display: flex;
|
|
435
|
+
flex-direction: column;
|
|
436
|
+
gap: 10px;
|
|
437
|
+
margin: 0;
|
|
438
|
+
padding: 0;
|
|
439
|
+
list-style: none;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.cn-condition-group__item {
|
|
443
|
+
display: flex;
|
|
444
|
+
flex-direction: column;
|
|
445
|
+
gap: 10px;
|
|
446
|
+
min-width: 0;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.cn-condition-group__line {
|
|
450
|
+
display: flex;
|
|
451
|
+
align-items: center;
|
|
452
|
+
gap: 8px;
|
|
453
|
+
min-width: 0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.cn-condition-group__connector {
|
|
457
|
+
flex: 0 0 44px;
|
|
458
|
+
font-size: 13px;
|
|
459
|
+
font-weight: 600;
|
|
460
|
+
color: var(--color-text-maxcontrast);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.cn-condition-group__caption {
|
|
464
|
+
font-size: 13px;
|
|
465
|
+
color: var(--color-text-maxcontrast);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.cn-condition-group__row {
|
|
469
|
+
flex: 1 1 auto;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.cn-condition-group__locked {
|
|
473
|
+
display: flex;
|
|
474
|
+
flex: 1 1 auto;
|
|
475
|
+
align-items: center;
|
|
476
|
+
gap: 8px;
|
|
477
|
+
min-height: var(--default-clickable-area);
|
|
478
|
+
padding: 0 0 0 10px;
|
|
479
|
+
border: 1px dashed var(--color-border-dark);
|
|
480
|
+
border-radius: var(--border-radius-element, 8px);
|
|
481
|
+
color: var(--color-text-maxcontrast);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.cn-condition-group__locked > span {
|
|
485
|
+
flex: 1 1 auto;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.cn-condition-group__pill,
|
|
489
|
+
.cn-condition-group__row :deep(.cn-condition-row__remove) {
|
|
490
|
+
border-radius: var(--border-radius-pill, 17px);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.cn-condition-group__empty {
|
|
494
|
+
margin: 0;
|
|
495
|
+
padding: 12px;
|
|
496
|
+
border: 1px dashed var(--color-border-dark);
|
|
497
|
+
border-radius: var(--border-radius-large);
|
|
498
|
+
color: var(--color-text-maxcontrast);
|
|
499
|
+
text-align: center;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.cn-condition-group__error {
|
|
503
|
+
margin: 0;
|
|
504
|
+
color: var(--color-text-error, var(--color-error));
|
|
505
|
+
font-size: 0.9em;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.cn-condition-group__actions {
|
|
509
|
+
display: flex;
|
|
510
|
+
flex-wrap: wrap;
|
|
511
|
+
gap: 6px;
|
|
512
|
+
padding-inline-start: 44px;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
@media (max-width: 640px) {
|
|
516
|
+
.cn-condition-group--nested {
|
|
517
|
+
margin-inline-start: 12px;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.cn-condition-group__line {
|
|
521
|
+
flex-wrap: wrap;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.cn-condition-group__actions {
|
|
525
|
+
padding-inline-start: 0;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
</style>
|