Fix buttons being highlighted when filters are set
This commit is contained in:
parent
ca92d520b3
commit
554659bd91
|
@ -2,11 +2,11 @@
|
||||||
import CreateColumnButton from "../CreateColumnButton.svelte"
|
import CreateColumnButton from "../CreateColumnButton.svelte"
|
||||||
import { getContext, onMount } from "svelte"
|
import { getContext, onMount } from "svelte"
|
||||||
|
|
||||||
const { rows, columns, subscribe } = getContext("sheet")
|
const { rows, columns, subscribe, filter } = getContext("sheet")
|
||||||
|
|
||||||
let createColumnModal
|
let createColumnModal
|
||||||
|
|
||||||
$: highlighted = !$rows.length || !$columns.length
|
$: highlighted = !$filter.length && (!$rows.length || !$columns.length)
|
||||||
|
|
||||||
onMount(() => subscribe("add-column", createColumnModal.show))
|
onMount(() => subscribe("add-column", createColumnModal.show))
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
import CreateEditRow from "../../modals/CreateEditRow.svelte"
|
import CreateEditRow from "../../modals/CreateEditRow.svelte"
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
const { rows, columns } = getContext("sheet")
|
const { rows, columns, filter } = getContext("sheet")
|
||||||
|
|
||||||
$: hasCols = !!$columns.length
|
$: hasCols = !!$columns.length
|
||||||
$: hasRows = !!$rows.length
|
$: hasRows = $rows.length || $filter.length
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CreateRowButton
|
<CreateRowButton
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
const { columns, config, filter, schema } = getContext("sheet")
|
const { columns, config, filter, schema } = getContext("sheet")
|
||||||
|
|
||||||
const onFilter = e => {
|
const onFilter = e => {
|
||||||
filter.set(e.detail)
|
filter.set(e.detail || [])
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue