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