1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00

Merge branch 'master' of github.com:Budibase/budibase into feature/audit-log-sqs

This commit is contained in:
mike12345567 2024-05-17 12:39:41 +01:00
commit 220b35d1b7
2 changed files with 23 additions and 26 deletions

View file

@ -37,6 +37,7 @@
let grid let grid
let gridContext let gridContext
let minHeight
$: parsedColumns = getParsedColumns(columns) $: parsedColumns = getParsedColumns(columns)
$: columnWhitelist = parsedColumns.filter(x => x.active).map(x => x.field) $: columnWhitelist = parsedColumns.filter(x => x.active).map(x => x.field)
@ -51,8 +52,6 @@
metadata: { dataSource: table }, metadata: { dataSource: table },
}, },
] ]
$: height = $component.styles?.normal?.height || "408px"
$: styles = getSanitisedStyles($component.styles)
// Provide additional data context for live binding eval // Provide additional data context for live binding eval
export const getAdditionalDataContext = () => { export const getAdditionalDataContext = () => {
@ -129,23 +128,17 @@
) )
} }
const getSanitisedStyles = styles => {
return {
...styles,
normal: {
...styles?.normal,
height: undefined,
},
}
}
onMount(() => { onMount(() => {
gridContext = grid.getContext() gridContext = grid.getContext()
gridContext.minHeight.subscribe($height => (minHeight = $height))
}) })
</script> </script>
<div use:styleable={styles} class:in-builder={$builderStore.inBuilder}> <span style="--min-height:{minHeight}px">
<span style="--height:{height};"> <div
use:styleable={$component.styles}
class:in-builder={$builderStore.inBuilder}
>
<Grid <Grid
bind:this={grid} bind:this={grid}
datasource={table} datasource={table}
@ -172,12 +165,15 @@
isCloud={$environmentStore.cloud} isCloud={$environmentStore.cloud}
on:rowclick={e => onRowClick?.({ row: e.detail })} on:rowclick={e => onRowClick?.({ row: e.detail })}
/> />
</span> </div>
</div> </span>
<Provider {data} {actions} /> <Provider {data} {actions} />
<style> <style>
span {
display: contents;
}
div { div {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -185,14 +181,10 @@
border: 1px solid var(--spectrum-global-color-gray-300); border: 1px solid var(--spectrum-global-color-gray-300);
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
height: 410px;
min-height: var(--min-height);
} }
div.in-builder :global(*) { div.in-builder :global(*) {
pointer-events: none; pointer-events: none;
} }
span {
display: contents;
}
span :global(.grid) {
height: var(--height);
}
</style> </style>

View file

@ -1,6 +1,6 @@
<script> <script>
import { setContext, onMount } from "svelte" import { setContext, onMount } from "svelte"
import { writable } from "svelte/store" import { writable, derived } from "svelte/store"
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { clickOutside, ProgressCircle } from "@budibase/bbui" import { clickOutside, ProgressCircle } from "@budibase/bbui"
import { createEventManagers } from "../lib/events" import { createEventManagers } from "../lib/events"
@ -111,8 +111,13 @@
buttons, buttons,
isCloud, isCloud,
}) })
$: minHeight =
Padding + SmallRowHeight + $rowHeight + (showControls ? ControlsHeight : 0) // Derive min height and make available in context
const minHeight = derived(rowHeight, $height => {
const heightForControls = showControls ? ControlsHeight : 0
return Padding + SmallRowHeight + $height + heightForControls
})
context = { ...context, minHeight }
// Set context for children to consume // Set context for children to consume
setContext("grid", context) setContext("grid", context)
@ -138,7 +143,7 @@
class:quiet class:quiet
on:mouseenter={() => gridFocused.set(true)} on:mouseenter={() => gridFocused.set(true)}
on:mouseleave={() => gridFocused.set(false)} on:mouseleave={() => gridFocused.set(false)}
style="--row-height:{$rowHeight}px; --default-row-height:{DefaultRowHeight}px; --gutter-width:{GutterWidth}px; --max-cell-render-overflow:{MaxCellRenderOverflow}px; --content-lines:{$contentLines}; --min-height:{minHeight}px; --controls-height:{ControlsHeight}px;" style="--row-height:{$rowHeight}px; --default-row-height:{DefaultRowHeight}px; --gutter-width:{GutterWidth}px; --max-cell-render-overflow:{MaxCellRenderOverflow}px; --content-lines:{$contentLines}; --min-height:{$minHeight}px; --controls-height:{ControlsHeight}px;"
> >
{#if showControls} {#if showControls}
<div class="controls"> <div class="controls">