-
+
{{ t('global.dependency.modes.union') }}
-
+
{{ t('global.dependency.modes.intersect') }}
@@ -399,7 +399,11 @@
const validateDependencyRule = rule => {
return rule.attribute?.id &&
rule.operator?.id &&
- !!rule.value;
+ (
+ (!rule.operator.no_parameter && !!rule.value)
+ ||
+ (rule.operator.no_parameter && !rule.value)
+ );
};
const formatDependency = dependencyRules => {
const formattedRules = {};
@@ -422,9 +426,9 @@
return formattedGroup;
});
} else if(Object.keys(dependencyRules).length == 0) {
- formattedRules.union = false;
+ formattedRules.union = true;
formattedRules.groups = [{
- union: true,
+ union: false,
rules: [],
}];
}
@@ -505,6 +509,8 @@
}
};
const getOperatorList = datatype => {
+ const list = defaultOperators.slice();
+ console.log(list.map(l => l.operator).join(', '));
switch(datatype) {
case 'epoch':
case 'timeperiod':
@@ -512,12 +518,12 @@
case 'list':
case 'table':
case 'sql':
- return [];
+ break;
// TODO handle entity attributes
case 'entity':
case 'entity-mc':
case 'userlist':
- return [];
+ break;
case 'string':
case 'stringf':
case 'richtext':
@@ -527,42 +533,43 @@
case 'iconclass':
case 'rism':
case 'serial':
- return operators.filter(o => {
+ operators.forEach(o => {
switch(o.id) {
case 1:
case 2:
- return true;
- default:
- return false;
+ list.push(o);
+ break;
}
});
+ break;
case 'double':
case 'integer':
case 'date':
case 'percentage':
- return operators.filter(o => {
+ operators.forEach(o => {
switch(o.id) {
case 1:
case 2:
case 3:
case 4:
- return true;
- default:
- return false;
+ list.push(o);
+ break;
}
});
+ break;
case 'boolean':
- return operators.filter(o => {
+ operators.forEach(o => {
switch(o.id) {
case 1:
- return true;
- default:
- return false;
+ list.push(o);
+ break;
}
});
+ break;
default:
throw new Error(`Unsupported datatype ${datatype}`);
}
+ return list;
};
const getDependantOptions = (aid, datatype) => {
if(getInputTypeClass(datatype) == 'select') {
@@ -589,7 +596,7 @@
state.dependency.groups.push({
rules: [],
- union: true,
+ union: false,
});
gotoGroup(state.dependency.groups.length - 1);
};
@@ -615,27 +622,44 @@
const operators = [
{
id: 1,
+ operator: '=',
label: '=',
},
{
id: 2,
+ operator: '!=',
label: '!=',
},
{
id: 3,
+ operator: '<',
label: '<',
},
{
id: 4,
+ operator: '>',
label: '>',
},
+ {
+ id: 5,
+ operator: '?',
+ label: 'Set',
+ no_parameter: true,
+ },
+ {
+ id: 6,
+ operator: '!?',
+ label: 'Unset',
+ no_parameter: true,
+ },
];
+ const defaultOperators = operators.filter(o => o.operator == '?' || o.operator == '!?');
const state = reactive({
currentDependencyGroupId: 0,
dependency: {
- union: false,
+ union: true,
groups: [{
- union: true,
+ union: false,
rules: [],
}],
},
diff --git a/resources/js/i18n/de.json b/resources/js/i18n/de.json
index 31c31dba..a1b9f075 100644
--- a/resources/js/i18n/de.json
+++ b/resources/js/i18n/de.json
@@ -368,9 +368,9 @@
"no_rules_defined": "Noch keine Abhängigkeitsregeln für diese Gruppe definiert.",
"modes": {
"union": "Vereinigung",
- "union_desc": "Alle Gruppen müssen erfüllt sein",
+ "union_desc": "Mindestens eine Gruppe muss erfüllt sein",
"intersect": "Schnitt",
- "intersect_desc": "Mindestens eine Gruppe muss erfüllt sein"
+ "intersect_desc": "Alle Gruppen müssen erfüllt sein"
},
"depends_on": {
"title": "Hängt ab von",
diff --git a/resources/js/i18n/en.json b/resources/js/i18n/en.json
index e9bc0eda..5dc57382 100644
--- a/resources/js/i18n/en.json
+++ b/resources/js/i18n/en.json
@@ -368,9 +368,9 @@
"no_rules_defined": "No dependency rules defined for this group yet.",
"modes": {
"union": "Union",
- "union_desc": "All groups must evaluate to true",
+ "union_desc": "Any group must evaluate to true",
"intersect": "Intersect",
- "intersect_desc": "Any group must evaluate to true"
+ "intersect_desc": "All groups must evaluate to true"
},
"depends_on": {
"title": "Depends on",