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} bind:value={filter.value}
multiselect={getSchema(filter).relationshipType === multiselect={getSchema(filter).relationshipType ===
RelationshipType.MANY_TO_MANY || RelationshipType.MANY_TO_MANY ||
filter.operator === OperatorOptions.ContainsAny.value} filter.operator === OperatorOptions.In.value}
disabled={filter.noValue} disabled={filter.noValue}
/> />
{:else} {:else}

View File

@ -20,25 +20,13 @@
$: options = $fetch.rows $: 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 $: component = multiselect ? Multiselect : Select
</script> </script>
<svelte:component <svelte:component
this={component} this={component}
value={selectedValue} bind:value
autocomplete autocomplete
on:change={onChange}
{options} {options}
getOptionLabel={option => option.email} getOptionLabel={option => option.email}
getOptionValue={option => option._id} getOptionValue={option => option._id}

View File

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