Simplify code

This commit is contained in:
Adria Navarro 2023-10-03 17:06:17 +02:00
parent 8ebf473ab2
commit da95c32a0c
3 changed files with 4 additions and 15 deletions

View File

@ -308,7 +308,7 @@
bind:value={filter.value}
multiselect={getSchema(filter).relationshipType ===
RelationshipType.MANY_TO_MANY ||
filter.operator === OperatorOptions.ContainsAny.value}
filter.operator === OperatorOptions.In.value}
disabled={filter.noValue}
/>
{:else}

View File

@ -20,25 +20,13 @@
$: options = $fetch.rows
function onChange(e) {
const val = e.detail
if (!val) {
value = val
} else {
value = Array.isArray(val) ? val : [val]
}
}
$: selectedValue = multiselect || !value ? value : value[0]
$: component = multiselect ? Multiselect : Select
</script>
<svelte:component
this={component}
value={selectedValue}
bind:value
autocomplete
on:change={onChange}
{options}
getOptionLabel={option => option.email}
getOptionValue={option => option._id}

View File

@ -72,7 +72,8 @@ export const getValidOperatorsForType = (
ops = stringOps.concat([Op.MoreThan, Op.LessThan])
} else if (!isFieldType(type) && type.type === FieldType.BB_REFERENCE) {
if (type.multiple) {
ops = [Op.Contains, Op.NotContains, Op.ContainsAny, Op.Empty, Op.NotEmpty]
// Temporally disabled
ops = []
} else {
ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In]
}