@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,200 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, Fragment, renderList, createBlock, withCtx, createTextVNode, createVNode, createCommentVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = { class: "cn-condition-group__header" };
|
|
4
|
+
const _hoisted_2 = { class: "cn-condition-group__combinator" };
|
|
5
|
+
const _hoisted_3 = { class: "cn-condition-group__legend" };
|
|
6
|
+
const _hoisted_4 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "cn-condition-group__rows"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_5 = { class: "cn-condition-group__line" };
|
|
11
|
+
const _hoisted_6 = { class: "cn-condition-group__connector" };
|
|
12
|
+
const _hoisted_7 = { class: "cn-condition-group__caption" };
|
|
13
|
+
const _hoisted_8 = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "cn-condition-group__line"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_9 = { class: "cn-condition-group__connector" };
|
|
18
|
+
const _hoisted_10 = { class: "cn-condition-group__locked" };
|
|
19
|
+
const _hoisted_11 = {
|
|
20
|
+
key: 2,
|
|
21
|
+
class: "cn-condition-group__line"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_12 = { class: "cn-condition-group__connector" };
|
|
24
|
+
const _hoisted_13 = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "cn-condition-group__empty"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_14 = {
|
|
29
|
+
key: 2,
|
|
30
|
+
class: "cn-condition-group__error",
|
|
31
|
+
role: "alert"
|
|
32
|
+
};
|
|
33
|
+
const _hoisted_15 = { class: "cn-condition-group__actions" };
|
|
34
|
+
|
|
35
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
36
|
+
const _component_NcCheckboxRadioSwitch = resolveComponent("NcCheckboxRadioSwitch");
|
|
37
|
+
const _component_TrashCanOutline = resolveComponent("TrashCanOutline");
|
|
38
|
+
const _component_NcButton = resolveComponent("NcButton");
|
|
39
|
+
const _component_CnConditionGroup = resolveComponent("CnConditionGroup", true);
|
|
40
|
+
const _component_Lock = resolveComponent("Lock");
|
|
41
|
+
const _component_CnConditionRow = resolveComponent("CnConditionRow");
|
|
42
|
+
const _component_Plus = resolveComponent("Plus");
|
|
43
|
+
const _component_FolderPlusOutline = resolveComponent("FolderPlusOutline");
|
|
44
|
+
|
|
45
|
+
return (openBlock(), createElementBlock("div", {
|
|
46
|
+
class: normalizeClass(["cn-condition-group", {
|
|
47
|
+
'cn-condition-group--nested': $props.depth > 0,
|
|
48
|
+
'cn-condition-group--error': !!$options.ownError,
|
|
49
|
+
}])
|
|
50
|
+
}, [
|
|
51
|
+
createElementVNode("div", _hoisted_1, [
|
|
52
|
+
createElementVNode("fieldset", _hoisted_2, [
|
|
53
|
+
createElementVNode("legend", _hoisted_3, toDisplayString($options.t('nextcloud-vue', 'How the conditions combine')), 1 /* TEXT */),
|
|
54
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.combinators, (choice) => {
|
|
55
|
+
return (openBlock(), createBlock(_component_NcCheckboxRadioSwitch, {
|
|
56
|
+
key: choice.value,
|
|
57
|
+
type: "radio",
|
|
58
|
+
class: normalizeClass({ 'cn-condition-group__choice--checked': $props.node.type === choice.value }),
|
|
59
|
+
name: $data.radioName,
|
|
60
|
+
value: choice.value,
|
|
61
|
+
modelValue: $props.node.type,
|
|
62
|
+
"onUpdate:modelValue": $options.setType
|
|
63
|
+
}, {
|
|
64
|
+
default: withCtx(() => [
|
|
65
|
+
createTextVNode(toDisplayString(choice.label), 1 /* TEXT */)
|
|
66
|
+
]),
|
|
67
|
+
_: 2 /* DYNAMIC */
|
|
68
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["class", "name", "value", "modelValue", "onUpdate:modelValue"]))
|
|
69
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
70
|
+
]),
|
|
71
|
+
($props.depth > 0)
|
|
72
|
+
? (openBlock(), createBlock(_component_NcButton, {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: "cn-condition-group__remove-group",
|
|
75
|
+
variant: "tertiary",
|
|
76
|
+
onClick: _cache[0] || (_cache[0] = $event => (_ctx.$emit('remove')))
|
|
77
|
+
}, {
|
|
78
|
+
icon: withCtx(() => [
|
|
79
|
+
createVNode(_component_TrashCanOutline, { size: 16 })
|
|
80
|
+
]),
|
|
81
|
+
default: withCtx(() => [
|
|
82
|
+
createTextVNode(" " + toDisplayString($options.t('nextcloud-vue', 'Remove group')), 1 /* TEXT */)
|
|
83
|
+
]),
|
|
84
|
+
_: 1 /* STABLE */
|
|
85
|
+
}))
|
|
86
|
+
: createCommentVNode("v-if", true)
|
|
87
|
+
]),
|
|
88
|
+
($props.node.children.length)
|
|
89
|
+
? (openBlock(), createElementBlock("ol", _hoisted_4, [
|
|
90
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($props.node.children, (child, index) => {
|
|
91
|
+
return (openBlock(), createElementBlock("li", {
|
|
92
|
+
key: index,
|
|
93
|
+
class: "cn-condition-group__item"
|
|
94
|
+
}, [
|
|
95
|
+
($options.kindOf(child) === 'group')
|
|
96
|
+
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
97
|
+
createElementVNode("div", _hoisted_5, [
|
|
98
|
+
createElementVNode("span", _hoisted_6, toDisplayString($options.connector(index)), 1 /* TEXT */),
|
|
99
|
+
createElementVNode("span", _hoisted_7, toDisplayString($options.caption(child)), 1 /* TEXT */)
|
|
100
|
+
]),
|
|
101
|
+
createVNode(_component_CnConditionGroup, {
|
|
102
|
+
class: "cn-condition-group__child",
|
|
103
|
+
node: child,
|
|
104
|
+
depth: $props.depth + 1,
|
|
105
|
+
path: $options.childPath(index),
|
|
106
|
+
fields: $props.fields,
|
|
107
|
+
operatorsFor: $props.operatorsFor,
|
|
108
|
+
maxDepth: $props.maxDepth,
|
|
109
|
+
errors: $props.errors,
|
|
110
|
+
"onUpdate:node": $event => ($options.setChild(index, $event)),
|
|
111
|
+
onRemove: $event => ($options.removeChild(index))
|
|
112
|
+
}, null, 8 /* PROPS */, ["node", "depth", "path", "fields", "operatorsFor", "maxDepth", "errors", "onUpdate:node", "onRemove"])
|
|
113
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
114
|
+
: ($options.kindOf(child) === 'locked')
|
|
115
|
+
? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
116
|
+
createElementVNode("span", _hoisted_9, toDisplayString($options.connector(index)), 1 /* TEXT */),
|
|
117
|
+
createElementVNode("div", _hoisted_10, [
|
|
118
|
+
createVNode(_component_Lock, { size: 16 }),
|
|
119
|
+
createElementVNode("span", null, toDisplayString($options.t('nextcloud-vue', 'These conditions are kept as written')), 1 /* TEXT */),
|
|
120
|
+
createVNode(_component_NcButton, {
|
|
121
|
+
class: "cn-condition-group__pill",
|
|
122
|
+
variant: "tertiary",
|
|
123
|
+
"aria-label": $options.t('nextcloud-vue', 'Remove group'),
|
|
124
|
+
title: $options.t('nextcloud-vue', 'Remove group'),
|
|
125
|
+
onClick: $event => ($options.removeChild(index))
|
|
126
|
+
}, {
|
|
127
|
+
icon: withCtx(() => [
|
|
128
|
+
createVNode(_component_TrashCanOutline, { size: 18 })
|
|
129
|
+
]),
|
|
130
|
+
_: 1 /* STABLE */
|
|
131
|
+
}, 8 /* PROPS */, ["aria-label", "title", "onClick"])
|
|
132
|
+
])
|
|
133
|
+
]))
|
|
134
|
+
: (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
135
|
+
createElementVNode("span", _hoisted_12, toDisplayString($options.connector(index)), 1 /* TEXT */),
|
|
136
|
+
createVNode(_component_CnConditionRow, {
|
|
137
|
+
class: "cn-condition-group__row",
|
|
138
|
+
condition: child,
|
|
139
|
+
fieldOptions: $options.fieldOptionsFor(child),
|
|
140
|
+
operatorOptions: $options.operatorOptionsFor(child),
|
|
141
|
+
valueOptions: $options.valueOptionsFor(child),
|
|
142
|
+
inputType: $options.inputTypeFor(child),
|
|
143
|
+
showValue: $options.operatorTakesValue(child.operator),
|
|
144
|
+
controlLabels: $options.controlLabels,
|
|
145
|
+
error: $props.errors[$options.childPath(index)] || '',
|
|
146
|
+
hideLabels: "",
|
|
147
|
+
onField: $event => ($options.setField(index, $event)),
|
|
148
|
+
onOperator: $event => ($options.setOperator(index, $event)),
|
|
149
|
+
onValue: $event => ($options.setValue(index, child, $event)),
|
|
150
|
+
onRemove: $event => ($options.removeChild(index))
|
|
151
|
+
}, {
|
|
152
|
+
"remove-icon": withCtx(() => [
|
|
153
|
+
createVNode(_component_TrashCanOutline, { size: 18 })
|
|
154
|
+
]),
|
|
155
|
+
_: 1 /* STABLE */
|
|
156
|
+
}, 8 /* PROPS */, ["condition", "fieldOptions", "operatorOptions", "valueOptions", "inputType", "showValue", "controlLabels", "error", "onField", "onOperator", "onValue", "onRemove"])
|
|
157
|
+
]))
|
|
158
|
+
]))
|
|
159
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
160
|
+
]))
|
|
161
|
+
: (openBlock(), createElementBlock("p", _hoisted_13, toDisplayString($props.depth === 0 && $props.emptyText ? $props.emptyText : $options.t('nextcloud-vue', 'This group has no conditions yet.')), 1 /* TEXT */)),
|
|
162
|
+
($options.ownError)
|
|
163
|
+
? (openBlock(), createElementBlock("p", _hoisted_14, toDisplayString($options.ownError), 1 /* TEXT */))
|
|
164
|
+
: createCommentVNode("v-if", true),
|
|
165
|
+
createElementVNode("div", _hoisted_15, [
|
|
166
|
+
createVNode(_component_NcButton, {
|
|
167
|
+
variant: "tertiary",
|
|
168
|
+
disabled: $props.fields.length === 0,
|
|
169
|
+
onClick: $options.addCondition
|
|
170
|
+
}, {
|
|
171
|
+
icon: withCtx(() => [
|
|
172
|
+
createVNode(_component_Plus, { size: 16 })
|
|
173
|
+
]),
|
|
174
|
+
default: withCtx(() => [
|
|
175
|
+
createTextVNode(" " + toDisplayString($options.t('nextcloud-vue', 'Add condition')), 1 /* TEXT */)
|
|
176
|
+
]),
|
|
177
|
+
_: 1 /* STABLE */
|
|
178
|
+
}, 8 /* PROPS */, ["disabled", "onClick"]),
|
|
179
|
+
($props.depth < $props.maxDepth)
|
|
180
|
+
? (openBlock(), createBlock(_component_NcButton, {
|
|
181
|
+
key: 0,
|
|
182
|
+
variant: "tertiary",
|
|
183
|
+
disabled: $props.fields.length === 0,
|
|
184
|
+
onClick: $options.addGroup
|
|
185
|
+
}, {
|
|
186
|
+
icon: withCtx(() => [
|
|
187
|
+
createVNode(_component_FolderPlusOutline, { size: 16 })
|
|
188
|
+
]),
|
|
189
|
+
default: withCtx(() => [
|
|
190
|
+
createTextVNode(" " + toDisplayString($options.t('nextcloud-vue', 'Add group')), 1 /* TEXT */)
|
|
191
|
+
]),
|
|
192
|
+
_: 1 /* STABLE */
|
|
193
|
+
}, 8 /* PROPS */, ["disabled", "onClick"]))
|
|
194
|
+
: createCommentVNode("v-if", true)
|
|
195
|
+
])
|
|
196
|
+
], 2 /* CLASS */))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export { render };
|
|
200
|
+
//# sourceMappingURL=CnConditionGroup.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroup.vue3.js","sources":["../../../../src/components/CnConditionGroupEditor/CnConditionGroup.vue?vue&type=template&id=73aaa314&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-condition-group\"\n\t\t:class=\"{\n\t\t\t'cn-condition-group--nested': depth > 0,\n\t\t\t'cn-condition-group--error': !!ownError,\n\t\t}\">\n\t\t<div class=\"cn-condition-group__header\">\n\t\t\t<fieldset class=\"cn-condition-group__combinator\">\n\t\t\t\t<legend class=\"cn-condition-group__legend\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'How the conditions combine') }}\n\t\t\t\t</legend>\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\tv-for=\"choice in combinators\"\n\t\t\t\t\t:key=\"choice.value\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t:class=\"{ 'cn-condition-group__choice--checked': node.type === choice.value }\"\n\t\t\t\t\t:name=\"radioName\"\n\t\t\t\t\t:value=\"choice.value\"\n\t\t\t\t\t:modelValue=\"node.type\"\n\t\t\t\t\t@update:modelValue=\"setType\">\n\t\t\t\t\t{{ choice.label }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t</fieldset>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"depth > 0\"\n\t\t\t\tclass=\"cn-condition-group__remove-group\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t@click=\"$emit('remove')\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<TrashCanOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Remove group') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<ol v-if=\"node.children.length\" class=\"cn-condition-group__rows\">\n\t\t\t<li v-for=\"(child, index) in node.children\" :key=\"index\" class=\"cn-condition-group__item\">\n\t\t\t\t<template v-if=\"kindOf(child) === 'group'\">\n\t\t\t\t\t<div class=\"cn-condition-group__line\">\n\t\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t\t<span class=\"cn-condition-group__caption\">{{ caption(child) }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<CnConditionGroup\n\t\t\t\t\t\tclass=\"cn-condition-group__child\"\n\t\t\t\t\t\t:node=\"child\"\n\t\t\t\t\t\t:depth=\"depth + 1\"\n\t\t\t\t\t\t:path=\"childPath(index)\"\n\t\t\t\t\t\t:fields=\"fields\"\n\t\t\t\t\t\t:operatorsFor=\"operatorsFor\"\n\t\t\t\t\t\t:maxDepth=\"maxDepth\"\n\t\t\t\t\t\t:errors=\"errors\"\n\t\t\t\t\t\t@update:node=\"setChild(index, $event)\"\n\t\t\t\t\t\t@remove=\"removeChild(index)\" />\n\t\t\t\t</template>\n\t\t\t\t<div v-else-if=\"kindOf(child) === 'locked'\" class=\"cn-condition-group__line\">\n\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t<div class=\"cn-condition-group__locked\">\n\t\t\t\t\t\t<Lock :size=\"16\" />\n\t\t\t\t\t\t<span>{{ t('nextcloud-vue', 'These conditions are kept as written') }}</span>\n\t\t\t\t\t\t<NcButton\n\t\t\t\t\t\t\tclass=\"cn-condition-group__pill\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Remove group')\"\n\t\t\t\t\t\t\t:title=\"t('nextcloud-vue', 'Remove group')\"\n\t\t\t\t\t\t\t@click=\"removeChild(index)\">\n\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t<TrashCanOutline :size=\"18\" />\n\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t</NcButton>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div v-else class=\"cn-condition-group__line\">\n\t\t\t\t\t<span class=\"cn-condition-group__connector\">{{ connector(index) }}</span>\n\t\t\t\t\t<CnConditionRow\n\t\t\t\t\t\tclass=\"cn-condition-group__row\"\n\t\t\t\t\t\t:condition=\"child\"\n\t\t\t\t\t\t:fieldOptions=\"fieldOptionsFor(child)\"\n\t\t\t\t\t\t:operatorOptions=\"operatorOptionsFor(child)\"\n\t\t\t\t\t\t:valueOptions=\"valueOptionsFor(child)\"\n\t\t\t\t\t\t:inputType=\"inputTypeFor(child)\"\n\t\t\t\t\t\t:showValue=\"operatorTakesValue(child.operator)\"\n\t\t\t\t\t\t:controlLabels=\"controlLabels\"\n\t\t\t\t\t\t:error=\"errors[childPath(index)] || ''\"\n\t\t\t\t\t\thideLabels\n\t\t\t\t\t\t@field=\"setField(index, $event)\"\n\t\t\t\t\t\t@operator=\"setOperator(index, $event)\"\n\t\t\t\t\t\t@value=\"setValue(index, child, $event)\"\n\t\t\t\t\t\t@remove=\"removeChild(index)\">\n\t\t\t\t\t\t<template #remove-icon>\n\t\t\t\t\t\t\t<TrashCanOutline :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</CnConditionRow>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ol>\n\t\t<p v-else class=\"cn-condition-group__empty\">\n\t\t\t{{ depth === 0 && emptyText ? emptyText : t('nextcloud-vue', 'This group has no conditions yet.') }}\n\t\t</p>\n\n\t\t<p v-if=\"ownError\" class=\"cn-condition-group__error\" role=\"alert\">\n\t\t\t{{ ownError }}\n\t\t</p>\n\n\t\t<div class=\"cn-condition-group__actions\">\n\t\t\t<NcButton variant=\"tertiary\" :disabled=\"fields.length === 0\" @click=\"addCondition\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<Plus :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Add condition') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"depth < maxDepth\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"fields.length === 0\"\n\t\t\t\t@click=\"addGroup\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FolderPlusOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ t('nextcloud-vue', 'Add group') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue'\nimport FolderPlusOutline from 'vue-material-design-icons/FolderPlusOutline.vue'\nimport Lock from 'vue-material-design-icons/Lock.vue'\nimport Plus from 'vue-material-design-icons/Plus.vue'\nimport TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'\nimport CnConditionRow from '../CnConditionListEditor/CnConditionRow.vue'\nimport { operatorTakesValue } from '../CnConditionListEditor/conditionOperators.js'\n\nlet groupSeq = 0\n\n/**\n * CnConditionGroup - one group of CnConditionGroupEditor: the combinator\n * choice, its rows, and the groups inside it, drawn recursively. Internal to\n * the editor, which owns the tree.\n */\nexport default {\n\tname: 'CnConditionGroup',\n\n\tcomponents: { CnConditionRow, FolderPlusOutline, Lock, NcButton, NcCheckboxRadioSwitch, Plus, TrashCanOutline },\n\n\tprops: {\n\t\t/** The group: `{ type: 'AND' | 'OR', children }`. */\n\t\tnode: { type: Object, required: true },\n\t\t/** How deep this group sits; the root is 0. */\n\t\tdepth: { type: Number, default: 0 },\n\t\t/** This group's path in validator notation (`$.children[1]`). */\n\t\tpath: { type: String, default: '$' },\n\t\t/** The fields, normalised to `{ id, label, type, format?, options? }`. */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/** The operators of a field, `(field) => [{ id, label }]`. */\n\t\toperatorsFor: { type: Function, required: true },\n\t\t/** The deepest group Add group may create. */\n\t\tmaxDepth: { type: Number, default: 1 },\n\t\t/** Messages keyed by node path. */\n\t\terrors: { type: Object, default: () => ({}) },\n\t\t/** What an empty root says, already translated. */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['update:node', 'remove'],\n\n\tdata() {\n\t\tgroupSeq += 1\n\t\treturn { radioName: `cn-condition-group-${groupSeq}` }\n\t},\n\n\tcomputed: {\n\t\tcombinators() {\n\t\t\treturn [\n\t\t\t\t{ value: 'AND', label: t('nextcloud-vue', 'Match all conditions') },\n\t\t\t\t{ value: 'OR', label: t('nextcloud-vue', 'Match any condition') },\n\t\t\t]\n\t\t},\n\n\t\tcontrolLabels() {\n\t\t\treturn {\n\t\t\t\tfield: t('nextcloud-vue', 'Field'),\n\t\t\t\toperator: t('nextcloud-vue', 'Condition'),\n\t\t\t\tvalue: t('nextcloud-vue', 'Value'),\n\t\t\t}\n\t\t},\n\n\t\townError() {\n\t\t\treturn this.errors[this.path] || ''\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\toperatorTakesValue,\n\n\t\t/**\n\t\t * What a child is: a group drawn as a card, a group the editor keeps\n\t\t * as written (NOT), or a condition.\n\t\t *\n\t\t * @param {object} child The child node.\n\t\t * @return {string} group, locked or condition.\n\t\t */\n\t\tkindOf(child) {\n\t\t\tif (!Array.isArray(child?.children)) {\n\t\t\t\treturn 'condition'\n\t\t\t}\n\t\t\treturn ['AND', 'OR'].includes(String(child.type || 'AND').toUpperCase()) ? 'group' : 'locked'\n\t\t},\n\n\t\t/**\n\t\t * The word before a row: Where on the first, then and or or.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @return {string} The word.\n\t\t */\n\t\tconnector(index) {\n\t\t\tif (index === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Where')\n\t\t\t}\n\t\t\treturn this.node.type === 'OR' ? t('nextcloud-vue', 'or') : t('nextcloud-vue', 'and')\n\t\t},\n\n\t\tcaption(child) {\n\t\t\treturn String(child.type).toUpperCase() === 'OR'\n\t\t\t\t? t('nextcloud-vue', 'one of these')\n\t\t\t\t: t('nextcloud-vue', 'all of these')\n\t\t},\n\n\t\tchildPath(index) {\n\t\t\treturn `${this.path}.children[${index}]`\n\t\t},\n\n\t\tfieldOf(id) {\n\t\t\treturn this.fields.find((f) => f.id === id)\n\t\t},\n\n\t\t/**\n\t\t * The field choices, plus a stored field the list does not offer.\n\t\t *\n\t\t * @param {object} child The condition.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\tfieldOptionsFor(child) {\n\t\t\tconst options = this.fields.map((f) => ({ id: f.id, label: f.label || f.id }))\n\t\t\tif (child.field && !options.some((o) => o.id === child.field)) {\n\t\t\t\toptions.push({ id: child.field, label: child.field })\n\t\t\t}\n\t\t\treturn options\n\t\t},\n\n\t\t/**\n\t\t * The operator choices of the condition's field, plus a stored\n\t\t * operator the list does not offer.\n\t\t *\n\t\t * @param {object} child The condition.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\toperatorOptionsFor(child) {\n\t\t\tconst options = this.operatorsFor(this.fieldOf(child.field))\n\t\t\tif (child.operator && !options.some((o) => o.id === child.operator)) {\n\t\t\t\treturn [...options, { id: child.operator, label: child.operator }]\n\t\t\t}\n\t\t\treturn options\n\t\t},\n\n\t\tvalueOptionsFor(child) {\n\t\t\tconst field = this.fieldOf(child.field)\n\t\t\tif (field?.type === 'boolean') {\n\t\t\t\treturn [\n\t\t\t\t\t{ id: true, label: t('nextcloud-vue', 'Yes') },\n\t\t\t\t\t{ id: false, label: t('nextcloud-vue', 'No') },\n\t\t\t\t]\n\t\t\t}\n\t\t\tif (Array.isArray(field?.options) && field.options.length > 0) {\n\t\t\t\treturn field.options.map((o) => (typeof o === 'object'\n\t\t\t\t\t? { id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }\n\t\t\t\t\t: { id: o, label: String(o) }))\n\t\t\t}\n\t\t\treturn null\n\t\t},\n\n\t\tinputTypeFor(child) {\n\t\t\tconst field = this.fieldOf(child.field)\n\t\t\tif (field?.type === 'number' || field?.type === 'integer') {\n\t\t\t\treturn 'number'\n\t\t\t}\n\t\t\treturn field?.type === 'date' || field?.format === 'date' ? 'date' : 'text'\n\t\t},\n\n\t\temitNode(next) {\n\t\t\tthis.$emit('update:node', next)\n\t\t},\n\n\t\tsetChildren(children) {\n\t\t\tthis.emitNode({ ...this.node, children })\n\t\t},\n\n\t\tsetChild(index, next) {\n\t\t\tconst children = [...this.node.children]\n\t\t\tchildren[index] = next\n\t\t\tthis.setChildren(children)\n\t\t},\n\n\t\tremoveChild(index) {\n\t\t\tthis.setChildren(this.node.children.filter((_, i) => i !== index))\n\t\t},\n\n\t\tsetType(type) {\n\t\t\tthis.emitNode({ ...this.node, type: type === 'OR' ? 'OR' : 'AND' })\n\t\t},\n\n\t\taddCondition() {\n\t\t\tthis.setChildren([...this.node.children, { field: '', operator: '', value: '' }])\n\t\t},\n\n\t\taddGroup() {\n\t\t\tthis.setChildren([...this.node.children, { type: 'AND', children: [{ field: '', operator: '', value: '' }] }])\n\t\t},\n\n\t\t/**\n\t\t * Pick a field: the operator resets to the field's first one and the\n\t\t * value clears, since a value for another field rarely fits.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {object} option The field choice.\n\t\t */\n\t\tsetField(index, option) {\n\t\t\tconst field = this.fieldOf(option?.id)\n\t\t\tconst first = this.operatorsFor(field)[0]\n\t\t\tthis.setChild(index, {\n\t\t\t\tfield: option?.id || '',\n\t\t\t\toperator: first ? first.id : '',\n\t\t\t\tvalue: field?.type === 'boolean' ? true : '',\n\t\t\t})\n\t\t},\n\n\t\tsetOperator(index, option) {\n\t\t\tconst next = { ...this.node.children[index], operator: option?.id || '' }\n\t\t\tif (!operatorTakesValue(next.operator)) {\n\t\t\t\tdelete next.value\n\t\t\t} else if (next.value === undefined) {\n\t\t\t\tnext.value = ''\n\t\t\t}\n\t\t\tthis.setChild(index, next)\n\t\t},\n\n\t\t/**\n\t\t * Set a value, as a number for a number field.\n\t\t *\n\t\t * @param {number} index The row index.\n\t\t * @param {object} child The condition.\n\t\t * @param {unknown} raw The picked or typed value.\n\t\t */\n\t\tsetValue(index, child, raw) {\n\t\t\tlet value = raw\n\t\t\tif (this.inputTypeFor(child) === 'number' && raw !== '' && !Number.isNaN(Number(raw))) {\n\t\t\t\tvalue = Number(raw)\n\t\t\t}\n\t\t\tthis.setChild(index, { ...child, value })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-group {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmin-width: 0;\n\tpadding: 14px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\t--cn-condition-row-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.25fr) auto;\n\t--cn-condition-row-align: center;\n}\n\n.cn-condition-group--nested {\n\tmargin-inline-start: 52px;\n\tpadding: 12px 12px 8px;\n\tborder-color: var(--color-border);\n\tborder-inline-start: 3px solid var(--color-primary-element);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-condition-group--error {\n\tborder-color: var(--color-border-error, var(--color-error));\n}\n\n.cn-condition-group__header {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n}\n\n.cn-condition-group__combinator {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 18px;\n\tmargin: 0;\n\tpadding: 0;\n\tborder: 0;\n\tmin-width: 0;\n}\n\n.cn-condition-group__legend {\n\tfloat: inline-start;\n\tmargin-inline-end: 6px;\n\tpadding: 0;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__choice--checked :deep(.checkbox-radio-switch__text) {\n\tfont-weight: 600;\n}\n\n.cn-condition-group__remove-group {\n\tcolor: var(--color-text-error, var(--color-error));\n}\n\n.cn-condition-group__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-condition-group__item {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tmin-width: 0;\n}\n\n.cn-condition-group__line {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tmin-width: 0;\n}\n\n.cn-condition-group__connector {\n\tflex: 0 0 44px;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__caption {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__row {\n\tflex: 1 1 auto;\n}\n\n.cn-condition-group__locked {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\talign-items: center;\n\tgap: 8px;\n\tmin-height: var(--default-clickable-area);\n\tpadding: 0 0 0 10px;\n\tborder: 1px dashed var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-condition-group__locked > span {\n\tflex: 1 1 auto;\n}\n\n.cn-condition-group__pill,\n.cn-condition-group__row :deep(.cn-condition-row__remove) {\n\tborder-radius: var(--border-radius-pill, 17px);\n}\n\n.cn-condition-group__empty {\n\tmargin: 0;\n\tpadding: 12px;\n\tborder: 1px dashed var(--color-border-dark);\n\tborder-radius: var(--border-radius-large);\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n}\n\n.cn-condition-group__error {\n\tmargin: 0;\n\tcolor: var(--color-text-error, var(--color-error));\n\tfont-size: 0.9em;\n}\n\n.cn-condition-group__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\tpadding-inline-start: 44px;\n}\n\n@media (max-width: 640px) {\n\t.cn-condition-group--nested {\n\t\tmargin-inline-start: 12px;\n\t}\n\n\t.cn-condition-group__line {\n\t\tflex-wrap: wrap;\n\t}\n\n\t.cn-condition-group__actions {\n\t\tpadding-inline-start: 0;\n\t}\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","_createTextVNode","_openBlock","_createVNode"],"mappings":";;AAiBO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,4BAAY,GAAA;AACZ,MAAA,UAAA,GAAA,EAAA,KAAI,EAAE,gCAAc,GAAA;AACrB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,4BAAK,GAAA;;;AA2BW,EAAA,KAAK,EAAC,0BAA0B;;AAGxD,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAsB,GAAA;AAC1B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,+BAAA,GAAA;AACN,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,6BAAK,GAAA;;;AAcT,EAAA,KAAA,EAAA,0BAAA;;AACH,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,+BAAqB,GAAA;AAC5B,MAAA,WAAA,GAAA,EAAA,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A,UAAA,MAAA,CAAA,SAAA,GAAA,MAAA,CAAA,SAAA,GAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,mCAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;KAGM,QAAQ,CAAA,QAAA;sBAAhBF,kBAEG,CAAA,GAAA,EAFH,WAEG,EAAAE,eAAA,CADA,QAAQ,CAAA,QAAA,CAAA,EAAA,CAAA,YAAA;;AAGV,IAAAD,kBAAA,QAAA;MACDO,WAKW,CAAA,mBAAA,EAAA;AALD,QAAA,OAAA,EAAA,UAAA;QAAA,QAAA,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,KAAA,CAAA;AAAA,QAAA,OAAA,EAAA,QAAA,CAAA,YAAA;;AACE,QAAA,IAAI,UACd,MAAgB;UAAhBA,WAAgB,CAAA,eAAA,EAAA,EAAT,IAAI,EAAE,EAAE,EAAA,CAAA;;yBACL,MACX;AADW,UAAAF,eAAA,CAAA,GACX,mBAAG,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,eAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;AAEW,MAAA,CAAA,MAAA,CAAA,KAAK,GAAG,MAAQ,CAAA,QAAA;;;AAC/B,YAAA,OAAO,EAAC,UAAE;YACT,QAAQ,EAAE,MAAM,CAAA,MAAA,CAAC,MAAM,KAAA,CAAA;AACvB,YAAA,OAAK,EAAE,QAAC,CAAA,QAAA;;AACN,YAAA,IAAA,UACF,MAAC;cAADE,WAAC,CAAA,4BAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import script from './CnConditionGroupEditor.vue2.js';
|
|
2
|
+
import { render } from './CnConditionGroupEditor.vue3.js';
|
|
3
|
+
|
|
4
|
+
script.render = render;
|
|
5
|
+
script.__scopeId = "data-v-36d77d2d";
|
|
6
|
+
const __sfc_main = script;
|
|
7
|
+
|
|
8
|
+
export { __sfc_main as default };
|
|
9
|
+
//# sourceMappingURL=CnConditionGroupEditor.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroupEditor.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import __sfc_main from './CnConditionGroup.vue.js';
|
|
2
|
+
import { operatorsForType, operatorLabel } from '../CnConditionListEditor/conditionOperators.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A rule value as a group: a group keeps its shape with `type` upper-cased; a
|
|
6
|
+
* bare condition, a list of nodes, or `children` without a `type` read as an
|
|
7
|
+
* AND group of them; anything else reads as an empty AND group.
|
|
8
|
+
*
|
|
9
|
+
* @param {unknown} value The bound value.
|
|
10
|
+
* @return {{type: string, children: Array}} A detached group.
|
|
11
|
+
*/
|
|
12
|
+
function toGroup(value) {
|
|
13
|
+
let copy;
|
|
14
|
+
try {
|
|
15
|
+
copy = JSON.parse(JSON.stringify(value ?? null));
|
|
16
|
+
} catch {
|
|
17
|
+
copy = null;
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(copy)) {
|
|
20
|
+
return { type: 'AND', children: copy }
|
|
21
|
+
}
|
|
22
|
+
if (!copy || typeof copy !== 'object') {
|
|
23
|
+
return { type: 'AND', children: [] }
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(copy.children)) {
|
|
26
|
+
return { ...copy, type: copy.type ? String(copy.type).toUpperCase() : 'AND' }
|
|
27
|
+
}
|
|
28
|
+
if ('field' in copy || 'operator' in copy) {
|
|
29
|
+
return { type: 'AND', children: [copy] }
|
|
30
|
+
}
|
|
31
|
+
return { type: 'AND', children: [] }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* CnConditionGroupEditor - the conditions of a rule in groups: each group
|
|
36
|
+
* chooses whether all or any of its conditions must hold, and the root may
|
|
37
|
+
* hold inner groups ("this, and one of these"). Rows are CnConditionRow, the
|
|
38
|
+
* same field, operator and value row as CnConditionListEditor.
|
|
39
|
+
*
|
|
40
|
+
* v-model on `{ type: 'AND' | 'OR', children }`, where a child is a
|
|
41
|
+
* condition `{ field, operator, value }` or another group, in both dialects
|
|
42
|
+
* (`value`/`input` and `modelValue`/`update:modelValue`). Add group shows
|
|
43
|
+
* only on groups above `maxDepth`; a deeper tree still renders every level.
|
|
44
|
+
* A group of another type (NOT) shows as a locked row that can only be
|
|
45
|
+
* removed.
|
|
46
|
+
*/
|
|
47
|
+
var script = {
|
|
48
|
+
name: 'CnConditionGroupEditor',
|
|
49
|
+
|
|
50
|
+
components: { CnConditionGroup: __sfc_main },
|
|
51
|
+
|
|
52
|
+
props: {
|
|
53
|
+
/**
|
|
54
|
+
* The group tree.
|
|
55
|
+
*
|
|
56
|
+
* @type {{type: string, children: Array}}
|
|
57
|
+
*/
|
|
58
|
+
value: { type: [Object, Array], default: () => ({ type: 'AND', children: [] }) },
|
|
59
|
+
/**
|
|
60
|
+
* The same value under Vue 3's v-model name; wins over `value` when passed.
|
|
61
|
+
*
|
|
62
|
+
* @type {object}
|
|
63
|
+
*/
|
|
64
|
+
modelValue: { type: [Object, Array], default: undefined },
|
|
65
|
+
/**
|
|
66
|
+
* The fields a condition may name: `{ id | value, label, type?, format?, options? }`.
|
|
67
|
+
* `type` number or integer types a number, `type` or `format` date picks a
|
|
68
|
+
* date, `type` boolean or `options` (`[{ id, label }]`) make the value a choice.
|
|
69
|
+
*
|
|
70
|
+
* @type {Array<object>}
|
|
71
|
+
*/
|
|
72
|
+
fields: { type: Array, default: () => [] },
|
|
73
|
+
/**
|
|
74
|
+
* The operators, in the host's own names: a map from field type to
|
|
75
|
+
* `[{ value, label }]` (`default` for any other type), or a function
|
|
76
|
+
* `(field) => [{ value, label }]`. Without it, the operators of
|
|
77
|
+
* CnConditionListEditor are offered.
|
|
78
|
+
*
|
|
79
|
+
* @type {object|function(object): Array<{value: string, label: string}>}
|
|
80
|
+
*/
|
|
81
|
+
operators: { type: [Object, Function], default: null },
|
|
82
|
+
/**
|
|
83
|
+
* The deepest level Add group may build; 1 lets the root hold groups
|
|
84
|
+
* of conditions.
|
|
85
|
+
*
|
|
86
|
+
* @type {number}
|
|
87
|
+
*/
|
|
88
|
+
maxDepth: { type: Number, default: 1 },
|
|
89
|
+
/**
|
|
90
|
+
* Messages keyed by node path (`$.children[1].children[0]`), already
|
|
91
|
+
* translated, shown on that row or group.
|
|
92
|
+
*
|
|
93
|
+
* @type {object}
|
|
94
|
+
*/
|
|
95
|
+
errors: { type: Object, default: () => ({}) },
|
|
96
|
+
/**
|
|
97
|
+
* What an empty root says, already translated.
|
|
98
|
+
*
|
|
99
|
+
* @type {string}
|
|
100
|
+
*/
|
|
101
|
+
emptyText: { type: String, default: '' },
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
emits: ['input', 'update:modelValue'],
|
|
105
|
+
|
|
106
|
+
data() {
|
|
107
|
+
return {
|
|
108
|
+
tree: toGroup(this.modelValue !== undefined ? this.modelValue : this.value),
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
computed: {
|
|
113
|
+
fieldList() {
|
|
114
|
+
return this.fields.map((f) => ({ ...f, id: f.id ?? f.value }))
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
watch: {
|
|
119
|
+
value(next) {
|
|
120
|
+
if (this.modelValue === undefined) {
|
|
121
|
+
this.take(next);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
modelValue(next) {
|
|
126
|
+
if (next !== undefined) {
|
|
127
|
+
this.take(next);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
methods: {
|
|
133
|
+
take(next) {
|
|
134
|
+
const group = toGroup(next);
|
|
135
|
+
if (JSON.stringify(group) !== JSON.stringify(this.tree)) {
|
|
136
|
+
this.tree = group;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The operator choices of a field, as `[{ id, label }]`.
|
|
142
|
+
*
|
|
143
|
+
* @param {object|undefined} field The field.
|
|
144
|
+
* @return {Array<{id: string, label: string}>} The choices.
|
|
145
|
+
*/
|
|
146
|
+
operatorsFor(field) {
|
|
147
|
+
let list;
|
|
148
|
+
if (typeof this.operators === 'function') {
|
|
149
|
+
list = this.operators(field);
|
|
150
|
+
} else if (this.operators) {
|
|
151
|
+
list = this.operators[field?.type] || this.operators.default || [];
|
|
152
|
+
} else {
|
|
153
|
+
return operatorsForType(field?.type).map((id) => ({ id, label: operatorLabel(id) }))
|
|
154
|
+
}
|
|
155
|
+
return (list || []).map((o) => ({ id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }))
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Keep the edited tree and tell the consumer, in both v-model dialects.
|
|
160
|
+
*
|
|
161
|
+
* @param {object} next The edited tree.
|
|
162
|
+
* @return {void}
|
|
163
|
+
*/
|
|
164
|
+
onUpdate(next) {
|
|
165
|
+
this.tree = next;
|
|
166
|
+
const copy = JSON.parse(JSON.stringify(next));
|
|
167
|
+
/**
|
|
168
|
+
* The tree changed.
|
|
169
|
+
*
|
|
170
|
+
* @event input
|
|
171
|
+
* @type {object}
|
|
172
|
+
*/
|
|
173
|
+
this.$emit('input', copy);
|
|
174
|
+
/**
|
|
175
|
+
* The tree changed (Vue 3 v-model).
|
|
176
|
+
*
|
|
177
|
+
* @event update:modelValue
|
|
178
|
+
* @type {object}
|
|
179
|
+
*/
|
|
180
|
+
this.$emit('update:modelValue', copy);
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export { script as default };
|
|
186
|
+
//# sourceMappingURL=CnConditionGroupEditor.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroupEditor.vue2.js","sources":["../../../../src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-condition-group-editor\">\n\t\t<CnConditionGroup\n\t\t\t:node=\"tree\"\n\t\t\t:depth=\"0\"\n\t\t\tpath=\"$\"\n\t\t\t:fields=\"fieldList\"\n\t\t\t:operatorsFor=\"operatorsFor\"\n\t\t\t:maxDepth=\"maxDepth\"\n\t\t\t:errors=\"errors\"\n\t\t\t:emptyText=\"emptyText\"\n\t\t\t@update:node=\"onUpdate\" />\n\t</div>\n</template>\n\n<script>\nimport CnConditionGroup from './CnConditionGroup.vue'\nimport { operatorLabel, operatorsForType } from '../CnConditionListEditor/conditionOperators.js'\n\n/**\n * A rule value as a group: a group keeps its shape with `type` upper-cased; a\n * bare condition, a list of nodes, or `children` without a `type` read as an\n * AND group of them; anything else reads as an empty AND group.\n *\n * @param {unknown} value The bound value.\n * @return {{type: string, children: Array}} A detached group.\n */\nfunction toGroup(value) {\n\tlet copy\n\ttry {\n\t\tcopy = JSON.parse(JSON.stringify(value ?? null))\n\t} catch {\n\t\tcopy = null\n\t}\n\tif (Array.isArray(copy)) {\n\t\treturn { type: 'AND', children: copy }\n\t}\n\tif (!copy || typeof copy !== 'object') {\n\t\treturn { type: 'AND', children: [] }\n\t}\n\tif (Array.isArray(copy.children)) {\n\t\treturn { ...copy, type: copy.type ? String(copy.type).toUpperCase() : 'AND' }\n\t}\n\tif ('field' in copy || 'operator' in copy) {\n\t\treturn { type: 'AND', children: [copy] }\n\t}\n\treturn { type: 'AND', children: [] }\n}\n\n/**\n * CnConditionGroupEditor - the conditions of a rule in groups: each group\n * chooses whether all or any of its conditions must hold, and the root may\n * hold inner groups (\"this, and one of these\"). Rows are CnConditionRow, the\n * same field, operator and value row as CnConditionListEditor.\n *\n * v-model on `{ type: 'AND' | 'OR', children }`, where a child is a\n * condition `{ field, operator, value }` or another group, in both dialects\n * (`value`/`input` and `modelValue`/`update:modelValue`). Add group shows\n * only on groups above `maxDepth`; a deeper tree still renders every level.\n * A group of another type (NOT) shows as a locked row that can only be\n * removed.\n */\nexport default {\n\tname: 'CnConditionGroupEditor',\n\n\tcomponents: { CnConditionGroup },\n\n\tprops: {\n\t\t/**\n\t\t * The group tree.\n\t\t *\n\t\t * @type {{type: string, children: Array}}\n\t\t */\n\t\tvalue: { type: [Object, Array], default: () => ({ type: 'AND', children: [] }) },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tmodelValue: { type: [Object, Array], default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id | value, label, type?, format?, options? }`.\n\t\t * `type` number or integer types a number, `type` or `format` date picks a\n\t\t * date, `type` boolean or `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The operators, in the host's own names: a map from field type to\n\t\t * `[{ value, label }]` (`default` for any other type), or a function\n\t\t * `(field) => [{ value, label }]`. Without it, the operators of\n\t\t * CnConditionListEditor are offered.\n\t\t *\n\t\t * @type {object|function(object): Array<{value: string, label: string}>}\n\t\t */\n\t\toperators: { type: [Object, Function], default: null },\n\t\t/**\n\t\t * The deepest level Add group may build; 1 lets the root hold groups\n\t\t * of conditions.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tmaxDepth: { type: Number, default: 1 },\n\t\t/**\n\t\t * Messages keyed by node path (`$.children[1].children[0]`), already\n\t\t * translated, shown on that row or group.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\terrors: { type: Object, default: () => ({}) },\n\t\t/**\n\t\t * What an empty root says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\ttree: toGroup(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tfieldList() {\n\t\t\treturn this.fields.map((f) => ({ ...f, id: f.id ?? f.value }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.take(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.take(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\ttake(next) {\n\t\t\tconst group = toGroup(next)\n\t\t\tif (JSON.stringify(group) !== JSON.stringify(this.tree)) {\n\t\t\t\tthis.tree = group\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The operator choices of a field, as `[{ id, label }]`.\n\t\t *\n\t\t * @param {object|undefined} field The field.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\toperatorsFor(field) {\n\t\t\tlet list\n\t\t\tif (typeof this.operators === 'function') {\n\t\t\t\tlist = this.operators(field)\n\t\t\t} else if (this.operators) {\n\t\t\t\tlist = this.operators[field?.type] || this.operators.default || []\n\t\t\t} else {\n\t\t\t\treturn operatorsForType(field?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t\t}\n\t\t\treturn (list || []).map((o) => ({ id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }))\n\t\t},\n\n\t\t/**\n\t\t * Keep the edited tree and tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @param {object} next The edited tree.\n\t\t * @return {void}\n\t\t */\n\t\tonUpdate(next) {\n\t\t\tthis.tree = next\n\t\t\tconst copy = JSON.parse(JSON.stringify(next))\n\t\t\t/**\n\t\t\t * The tree changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('input', copy)\n\t\t\t/**\n\t\t\t * The tree changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', copy)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-group-editor {\n\tmin-width: 0;\n}\n</style>\n"],"names":["CnConditionGroup"],"mappings":";;;AAwBA;;;;AAIC;AACA;;;AAGD,SAAS,OAAO,CAAC,KAAK,EAAE;AACvB,CAAA,IAAI,KAAG;AACP,CAAA,IAAI;AACH,EAAA,IAAG,GAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,EAAA;AAChD,EAAA,CAAE,MAAM;AACP,EAAA,IAAG,GAAI,KAAG;AACX,EAAA;CACA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACxB,EAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAK,EAAA;AACtC,EAAA;AACA,CAAA,IAAI,CAAC,IAAK,IAAG,OAAO,IAAG,KAAM,QAAQ,EAAE;EACtC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAG,EAAA;AACpC,EAAA;AACA,CAAA,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;AACjC,EAAA,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAK,GAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAC,GAAI,KAAM,EAAA;AAC7E,EAAA;AACA,CAAA,IAAI,OAAM,IAAK,IAAK,IAAG,UAAS,IAAK,IAAI,EAAE;AAC1C,EAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAE,EAAA;AACxC,EAAA;CACA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAG,EAAA;AACpC,CAAA;;AAEA;;;AAGC;;AAEA;;AAEA;AACA;AACA;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E,CAAA,EAAG,CAAC,CAAA;AACpF,IAAA;AACA,GAAA,OAAO,CAAC,IAAG,IAAK,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAC,IAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAM,IAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAA,EAAG,CAAC,CAAA;GACnG;;AAED;;AAEC;AACA;;;AAGD,EAAA,QAAQ,CAAC,IAAI,EAAE;GACd,IAAI,CAAC,IAAK,GAAE,KAAG;AACf,GAAA,MAAM,IAAG,GAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAA;AAC5C;AACC;AACA;;;;GAID,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAA;AACxB;;AAEC;;;;AAID,GAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,EAAA;GACpC;EACD;AACF;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, createVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = { class: "cn-condition-group-editor" };
|
|
4
|
+
|
|
5
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6
|
+
const _component_CnConditionGroup = resolveComponent("CnConditionGroup");
|
|
7
|
+
|
|
8
|
+
return (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
9
|
+
createVNode(_component_CnConditionGroup, {
|
|
10
|
+
node: $data.tree,
|
|
11
|
+
depth: 0,
|
|
12
|
+
path: "$",
|
|
13
|
+
fields: $options.fieldList,
|
|
14
|
+
operatorsFor: $options.operatorsFor,
|
|
15
|
+
maxDepth: $props.maxDepth,
|
|
16
|
+
errors: $props.errors,
|
|
17
|
+
emptyText: $props.emptyText,
|
|
18
|
+
"onUpdate:node": $options.onUpdate
|
|
19
|
+
}, null, 8 /* PROPS */, ["node", "fields", "operatorsFor", "maxDepth", "errors", "emptyText", "onUpdate:node"])
|
|
20
|
+
]))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { render };
|
|
24
|
+
//# sourceMappingURL=CnConditionGroupEditor.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CnConditionGroupEditor.vue3.js","sources":["../../../../src/components/CnConditionGroupEditor/CnConditionGroupEditor.vue?vue&type=template&id=36d77d2d&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-condition-group-editor\">\n\t\t<CnConditionGroup\n\t\t\t:node=\"tree\"\n\t\t\t:depth=\"0\"\n\t\t\tpath=\"$\"\n\t\t\t:fields=\"fieldList\"\n\t\t\t:operatorsFor=\"operatorsFor\"\n\t\t\t:maxDepth=\"maxDepth\"\n\t\t\t:errors=\"errors\"\n\t\t\t:emptyText=\"emptyText\"\n\t\t\t@update:node=\"onUpdate\" />\n\t</div>\n</template>\n\n<script>\nimport CnConditionGroup from './CnConditionGroup.vue'\nimport { operatorLabel, operatorsForType } from '../CnConditionListEditor/conditionOperators.js'\n\n/**\n * A rule value as a group: a group keeps its shape with `type` upper-cased; a\n * bare condition, a list of nodes, or `children` without a `type` read as an\n * AND group of them; anything else reads as an empty AND group.\n *\n * @param {unknown} value The bound value.\n * @return {{type: string, children: Array}} A detached group.\n */\nfunction toGroup(value) {\n\tlet copy\n\ttry {\n\t\tcopy = JSON.parse(JSON.stringify(value ?? null))\n\t} catch {\n\t\tcopy = null\n\t}\n\tif (Array.isArray(copy)) {\n\t\treturn { type: 'AND', children: copy }\n\t}\n\tif (!copy || typeof copy !== 'object') {\n\t\treturn { type: 'AND', children: [] }\n\t}\n\tif (Array.isArray(copy.children)) {\n\t\treturn { ...copy, type: copy.type ? String(copy.type).toUpperCase() : 'AND' }\n\t}\n\tif ('field' in copy || 'operator' in copy) {\n\t\treturn { type: 'AND', children: [copy] }\n\t}\n\treturn { type: 'AND', children: [] }\n}\n\n/**\n * CnConditionGroupEditor - the conditions of a rule in groups: each group\n * chooses whether all or any of its conditions must hold, and the root may\n * hold inner groups (\"this, and one of these\"). Rows are CnConditionRow, the\n * same field, operator and value row as CnConditionListEditor.\n *\n * v-model on `{ type: 'AND' | 'OR', children }`, where a child is a\n * condition `{ field, operator, value }` or another group, in both dialects\n * (`value`/`input` and `modelValue`/`update:modelValue`). Add group shows\n * only on groups above `maxDepth`; a deeper tree still renders every level.\n * A group of another type (NOT) shows as a locked row that can only be\n * removed.\n */\nexport default {\n\tname: 'CnConditionGroupEditor',\n\n\tcomponents: { CnConditionGroup },\n\n\tprops: {\n\t\t/**\n\t\t * The group tree.\n\t\t *\n\t\t * @type {{type: string, children: Array}}\n\t\t */\n\t\tvalue: { type: [Object, Array], default: () => ({ type: 'AND', children: [] }) },\n\t\t/**\n\t\t * The same value under Vue 3's v-model name; wins over `value` when passed.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tmodelValue: { type: [Object, Array], default: undefined },\n\t\t/**\n\t\t * The fields a condition may name: `{ id | value, label, type?, format?, options? }`.\n\t\t * `type` number or integer types a number, `type` or `format` date picks a\n\t\t * date, `type` boolean or `options` (`[{ id, label }]`) make the value a choice.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tfields: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The operators, in the host's own names: a map from field type to\n\t\t * `[{ value, label }]` (`default` for any other type), or a function\n\t\t * `(field) => [{ value, label }]`. Without it, the operators of\n\t\t * CnConditionListEditor are offered.\n\t\t *\n\t\t * @type {object|function(object): Array<{value: string, label: string}>}\n\t\t */\n\t\toperators: { type: [Object, Function], default: null },\n\t\t/**\n\t\t * The deepest level Add group may build; 1 lets the root hold groups\n\t\t * of conditions.\n\t\t *\n\t\t * @type {number}\n\t\t */\n\t\tmaxDepth: { type: Number, default: 1 },\n\t\t/**\n\t\t * Messages keyed by node path (`$.children[1].children[0]`), already\n\t\t * translated, shown on that row or group.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\terrors: { type: Object, default: () => ({}) },\n\t\t/**\n\t\t * What an empty root says, already translated.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\temptyText: { type: String, default: '' },\n\t},\n\n\temits: ['input', 'update:modelValue'],\n\n\tdata() {\n\t\treturn {\n\t\t\ttree: toGroup(this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tfieldList() {\n\t\t\treturn this.fields.map((f) => ({ ...f, id: f.id ?? f.value }))\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tif (this.modelValue === undefined) {\n\t\t\t\tthis.take(next)\n\t\t\t}\n\t\t},\n\n\t\tmodelValue(next) {\n\t\t\tif (next !== undefined) {\n\t\t\t\tthis.take(next)\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\ttake(next) {\n\t\t\tconst group = toGroup(next)\n\t\t\tif (JSON.stringify(group) !== JSON.stringify(this.tree)) {\n\t\t\t\tthis.tree = group\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The operator choices of a field, as `[{ id, label }]`.\n\t\t *\n\t\t * @param {object|undefined} field The field.\n\t\t * @return {Array<{id: string, label: string}>} The choices.\n\t\t */\n\t\toperatorsFor(field) {\n\t\t\tlet list\n\t\t\tif (typeof this.operators === 'function') {\n\t\t\t\tlist = this.operators(field)\n\t\t\t} else if (this.operators) {\n\t\t\t\tlist = this.operators[field?.type] || this.operators.default || []\n\t\t\t} else {\n\t\t\t\treturn operatorsForType(field?.type).map((id) => ({ id, label: operatorLabel(id) }))\n\t\t\t}\n\t\t\treturn (list || []).map((o) => ({ id: o.id ?? o.value, label: o.label ?? String(o.id ?? o.value) }))\n\t\t},\n\n\t\t/**\n\t\t * Keep the edited tree and tell the consumer, in both v-model dialects.\n\t\t *\n\t\t * @param {object} next The edited tree.\n\t\t * @return {void}\n\t\t */\n\t\tonUpdate(next) {\n\t\t\tthis.tree = next\n\t\t\tconst copy = JSON.parse(JSON.stringify(next))\n\t\t\t/**\n\t\t\t * The tree changed.\n\t\t\t *\n\t\t\t * @event input\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('input', copy)\n\t\t\t/**\n\t\t\t * The tree changed (Vue 3 v-model).\n\t\t\t *\n\t\t\t * @event update:modelValue\n\t\t\t * @type {object}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', copy)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-condition-group-editor {\n\tmin-width: 0;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,2BAAS,GAAA;;;;;AAAlB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;;AAEC,MAAA,IAAI,EAAE,KAAI,CAAA,IAAA;AACV,MAAA,KAAK,EAAE,CAAC;AACT,MAAA,IAAI,EAAC,GAAG;AACP,MAAA,MAAM,EAAE,QAAS,CAAA,SAAA;AACjB,MAAA,YAAE,EAAA,QAAA,CAAA,YAAA;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnConditionListEditor.vue2.js';
|
|
|
2
2
|
import { render } from './CnConditionListEditor.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-77809f32";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { translate } from '@nextcloud/l10n';
|
|
2
|
-
import { NcButton
|
|
3
|
-
import Close from 'vue-material-design-icons/Close.vue';
|
|
2
|
+
import { NcButton } from '@nextcloud/vue';
|
|
4
3
|
import Plus from 'vue-material-design-icons/Plus.vue';
|
|
4
|
+
import __sfc_main from './CnConditionRow.vue.js';
|
|
5
5
|
import { operatorsForType, operatorLabel, operatorTakesValue } from './conditionOperators.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -17,7 +17,7 @@ import { operatorsForType, operatorLabel, operatorTakesValue } from './condition
|
|
|
17
17
|
var script = {
|
|
18
18
|
name: 'CnConditionListEditor',
|
|
19
19
|
|
|
20
|
-
components: {
|
|
20
|
+
components: { CnConditionRow: __sfc_main, NcButton, Plus },
|
|
21
21
|
|
|
22
22
|
props: {
|
|
23
23
|
/**
|
|
@@ -110,18 +110,10 @@ var script = {
|
|
|
110
110
|
return this.fields.find((f) => f.id === id)
|
|
111
111
|
},
|
|
112
112
|
|
|
113
|
-
fieldOption(id) {
|
|
114
|
-
return this.fieldOptions.find((o) => o.id === id) || null
|
|
115
|
-
},
|
|
116
|
-
|
|
117
113
|
operatorOptions(fieldId) {
|
|
118
114
|
return operatorsForType(this.fieldOf(fieldId)?.type).map((id) => ({ id, label: operatorLabel(id) }))
|
|
119
115
|
},
|
|
120
116
|
|
|
121
|
-
operatorOption(operator) {
|
|
122
|
-
return operator ? { id: operator, label: operatorLabel(operator) } : null
|
|
123
|
-
},
|
|
124
|
-
|
|
125
117
|
takesValue(operator) {
|
|
126
118
|
return operatorTakesValue(operator)
|
|
127
119
|
},
|
|
@@ -148,10 +140,6 @@ var script = {
|
|
|
148
140
|
return null
|
|
149
141
|
},
|
|
150
142
|
|
|
151
|
-
valueOption(row) {
|
|
152
|
-
return (this.valueOptions(row.field) || []).find((o) => String(o.id) === String(row.value)) || null
|
|
153
|
-
},
|
|
154
|
-
|
|
155
143
|
inputType(fieldId) {
|
|
156
144
|
const type = this.fieldOf(fieldId)?.type;
|
|
157
145
|
if (type === 'number' || type === 'integer') {
|