Merge pull request #11643 from Budibase/cheeks-fixes

Add missing grid tooltip for views + form fixes
This commit is contained in:
Andrew Kingston 2023-09-01 11:42:06 +01:00 committed by GitHub
commit cb5ff85ca0
5 changed files with 37 additions and 18 deletions

View File

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

View File

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

View File

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

View File

@ -33,17 +33,19 @@
let anchors = {} let anchors = {}
let draggableItems = [] let draggableItems = []
const buildDragable = items => { const buildDraggable = items => {
return items.map(item => { return items
return { .map(item => {
id: listItemKey ? item[listItemKey] : generate(), return {
item, id: listItemKey ? item[listItemKey] : generate(),
} item,
}) }
})
.filter(item => item.id)
} }
$: if (items) { $: if (items) {
draggableItems = buildDragable(items) draggableItems = buildDraggable(items)
} }
const updateRowOrder = e => { const updateRowOrder = e => {

View File

@ -99,6 +99,9 @@
} }
const type = getComponentForField(instance.field, schema) const type = getComponentForField(instance.field, schema)
if (!type) {
return null
}
instance._component = `@budibase/standard-components/${type}` instance._component = `@budibase/standard-components/${type}`
const pseudoComponentInstance = store.actions.components.createInstance( const pseudoComponentInstance = store.actions.components.createInstance(
@ -116,7 +119,9 @@
} }
$: if (sanitisedFields) { $: if (sanitisedFields) {
fieldList = [...sanitisedFields, ...unconfigured].map(buildSudoInstance) fieldList = [...sanitisedFields, ...unconfigured]
.map(buildSudoInstance)
.filter(x => x != null)
} }
const processItemUpdate = e => { const processItemUpdate = e => {