Show tooltip when initially applying filters to a table

This commit is contained in:
Andrew Kingston 2023-09-01 10:07:37 +01:00
parent 0b7998f898
commit d47bb4f191
3 changed files with 21 additions and 9 deletions

View File

@ -4,7 +4,7 @@
export let text = null
export let condition = true
export let duration = 3000
export let duration = 5000
export let position
export let type

View File

@ -1,18 +1,30 @@
<script>
import { getContext } from "svelte"
import { Modal, ActionButton } from "@budibase/bbui"
import { Modal, ActionButton, TooltipType, TempTooltip } from "@budibase/bbui"
import GridCreateViewModal from "../../modals/grid/GridCreateViewModal.svelte"
const { rows, columns } = getContext("grid")
const { rows, columns, filter } = getContext("grid")
let modal
let firstFilterUsage = false
$: disabled = !$columns.length || !$rows.length
$: {
if ($filter?.length && !firstFilterUsage) {
firstFilterUsage = true
}
}
</script>
<ActionButton {disabled} icon="CollectionAdd" quiet on:click={modal.show}>
Add view
</ActionButton>
<TempTooltip
text="Create a view to save your filters"
type={TooltipType.Info}
condition={firstFilterUsage}
>
<ActionButton {disabled} icon="CollectionAdd" quiet on:click={modal.show}>
Create view
</ActionButton>
</TempTooltip>
<Modal bind:this={modal}>
<GridCreateViewModal />
</Modal>

View File

@ -46,13 +46,13 @@
</script>
<ModalContent
title="Create View"
confirmText="Create View"
title="Create view"
confirmText="Create view"
onConfirm={saveView}
disabled={nameExists}
>
<Input
label="View Name"
label="View name"
thin
bind:value={name}
error={nameExists ? "A view already exists with that name" : null}