Increase support for lower resolutions in the grid UI by using tooltips instead of text for some buttons at low horizontal breakpoints
This commit is contained in:
parent
eb86127bbe
commit
b07e5095e9
|
@ -39,7 +39,7 @@
|
||||||
{#if datasource}
|
{#if datasource}
|
||||||
<div>
|
<div>
|
||||||
<ActionButton icon="DataCorrelated" primary quiet on:click={modal.show}>
|
<ActionButton icon="DataCorrelated" primary quiet on:click={modal.show}>
|
||||||
Define existing relationship
|
Define relationship
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
<Modal bind:this={modal}>
|
<Modal bind:this={modal}>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { ActionButton, Popover } from "@budibase/bbui"
|
import { ActionButton, Popover } from "@budibase/bbui"
|
||||||
import { DefaultColumnWidth } from "../lib/constants"
|
import { DefaultColumnWidth } from "../lib/constants"
|
||||||
|
|
||||||
const { stickyColumn, columns } = getContext("grid")
|
const { stickyColumn, columns, compact } = getContext("grid")
|
||||||
const smallSize = 120
|
const smallSize = 120
|
||||||
const mediumSize = DefaultColumnWidth
|
const mediumSize = DefaultColumnWidth
|
||||||
const largeSize = DefaultColumnWidth * 1.5
|
const largeSize = DefaultColumnWidth * 1.5
|
||||||
|
@ -59,12 +59,13 @@
|
||||||
on:click={() => (open = !open)}
|
on:click={() => (open = !open)}
|
||||||
selected={open}
|
selected={open}
|
||||||
disabled={!allCols.length}
|
disabled={!allCols.length}
|
||||||
|
tooltip={$compact ? "Width" : null}
|
||||||
>
|
>
|
||||||
Width
|
{$compact ? "" : "Width"}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popover bind:open {anchor} align="left">
|
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{#each sizeOptions as option}
|
{#each sizeOptions as option}
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import { ActionButton, Popover, Toggle } from "@budibase/bbui"
|
import { ActionButton, Popover, Toggle } from "@budibase/bbui"
|
||||||
|
|
||||||
const { columns, stickyColumn } = getContext("grid")
|
const { columns, stickyColumn, compact } = getContext("grid")
|
||||||
|
|
||||||
let open = false
|
let open = false
|
||||||
let anchor
|
let anchor
|
||||||
|
@ -47,12 +47,13 @@
|
||||||
on:click={() => (open = !open)}
|
on:click={() => (open = !open)}
|
||||||
selected={open || anyHidden}
|
selected={open || anyHidden}
|
||||||
disabled={!$columns.length}
|
disabled={!$columns.length}
|
||||||
|
tooltip={$compact ? "Columns" : ""}
|
||||||
>
|
>
|
||||||
Columns
|
{$compact ? "" : "Columns"}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popover bind:open {anchor} align="left">
|
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
{#if $stickyColumn}
|
{#if $stickyColumn}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
SmallRowHeight,
|
SmallRowHeight,
|
||||||
} from "../lib/constants"
|
} from "../lib/constants"
|
||||||
|
|
||||||
const { rowHeight, columns, table } = getContext("grid")
|
const { rowHeight, columns, table, compact } = getContext("grid")
|
||||||
const sizeOptions = [
|
const sizeOptions = [
|
||||||
{
|
{
|
||||||
label: "Small",
|
label: "Small",
|
||||||
|
@ -41,12 +41,13 @@
|
||||||
size="M"
|
size="M"
|
||||||
on:click={() => (open = !open)}
|
on:click={() => (open = !open)}
|
||||||
selected={open}
|
selected={open}
|
||||||
|
tooltip={$compact ? "Height" : null}
|
||||||
>
|
>
|
||||||
Height
|
{$compact ? "" : "Height"}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popover bind:open {anchor} align="left">
|
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{#each sizeOptions as option}
|
{#each sizeOptions as option}
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
import { ActionButton, Popover, Select } from "@budibase/bbui"
|
import { ActionButton, Popover, Select } from "@budibase/bbui"
|
||||||
|
|
||||||
const { sort, columns, stickyColumn } = getContext("grid")
|
const { sort, columns, stickyColumn, compact } = getContext("grid")
|
||||||
|
|
||||||
let open = false
|
let open = false
|
||||||
let anchor
|
let anchor
|
||||||
|
@ -90,12 +90,13 @@
|
||||||
on:click={() => (open = !open)}
|
on:click={() => (open = !open)}
|
||||||
selected={open}
|
selected={open}
|
||||||
disabled={!columnOptions.length}
|
disabled={!columnOptions.length}
|
||||||
|
tooltip={$compact ? "Sort" : ""}
|
||||||
>
|
>
|
||||||
Sort
|
{$compact ? "" : "Sort"}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Popover bind:open {anchor} align="left">
|
<Popover bind:open {anchor} align={$compact ? "right" : "left"}>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<Select
|
<Select
|
||||||
placeholder={null}
|
placeholder={null}
|
||||||
|
|
|
@ -112,10 +112,10 @@
|
||||||
<AddRowButton />
|
<AddRowButton />
|
||||||
<AddColumnButton />
|
<AddColumnButton />
|
||||||
<slot name="controls" />
|
<slot name="controls" />
|
||||||
|
<SortButton />
|
||||||
|
<HideColumnsButton />
|
||||||
<ColumnWidthButton />
|
<ColumnWidthButton />
|
||||||
<RowHeightButton />
|
<RowHeightButton />
|
||||||
<HideColumnsButton />
|
|
||||||
<SortButton />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="controls-right">
|
<div class="controls-right">
|
||||||
<DeleteButton />
|
<DeleteButton />
|
||||||
|
@ -214,6 +214,7 @@
|
||||||
padding: var(--cell-padding);
|
padding: var(--cell-padding);
|
||||||
gap: var(--cell-spacing);
|
gap: var(--cell-spacing);
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
.controls-left,
|
.controls-left,
|
||||||
.controls-right {
|
.controls-right {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { writable, get, derived } from "svelte/store"
|
||||||
import { tick } from "svelte"
|
import { tick } from "svelte"
|
||||||
import {
|
import {
|
||||||
DefaultRowHeight,
|
DefaultRowHeight,
|
||||||
|
GutterWidth,
|
||||||
LargeRowHeight,
|
LargeRowHeight,
|
||||||
MediumRowHeight,
|
MediumRowHeight,
|
||||||
NewRowID,
|
NewRowID,
|
||||||
|
@ -43,6 +44,8 @@ export const deriveStores = context => {
|
||||||
enrichedRows,
|
enrichedRows,
|
||||||
rowLookupMap,
|
rowLookupMap,
|
||||||
rowHeight,
|
rowHeight,
|
||||||
|
stickyColumn,
|
||||||
|
width,
|
||||||
} = context
|
} = context
|
||||||
|
|
||||||
// Derive the row that contains the selected cell
|
// Derive the row that contains the selected cell
|
||||||
|
@ -70,6 +73,7 @@ export const deriveStores = context => {
|
||||||
hoveredRowId.set(null)
|
hoveredRowId.set(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Derive the amount of content lines to show in cells depending on row height
|
||||||
const contentLines = derived(rowHeight, $rowHeight => {
|
const contentLines = derived(rowHeight, $rowHeight => {
|
||||||
if ($rowHeight === LargeRowHeight) {
|
if ($rowHeight === LargeRowHeight) {
|
||||||
return 3
|
return 3
|
||||||
|
@ -79,9 +83,15 @@ export const deriveStores = context => {
|
||||||
return 1
|
return 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Derive whether we should use the compact UI, depending on width
|
||||||
|
const compact = derived([stickyColumn, width], ([$stickyColumn, $width]) => {
|
||||||
|
return ($stickyColumn?.width || 0) + $width + GutterWidth < 1100
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
focusedRow,
|
focusedRow,
|
||||||
contentLines,
|
contentLines,
|
||||||
|
compact,
|
||||||
ui: {
|
ui: {
|
||||||
actions: {
|
actions: {
|
||||||
blur,
|
blur,
|
||||||
|
|
Loading…
Reference in New Issue