Simplify code
This commit is contained in:
parent
8ebf473ab2
commit
da95c32a0c
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue