From 795991438f769fc2969d83feabed11b3af338494 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 24 Apr 2024 15:47:39 +0100 Subject: [PATCH] Use new grid popover for date cells to allow overflow outside grid --- packages/bbui/src/Popover/Popover.svelte | 3 +- .../src/components/grid/cells/DataCell.svelte | 2 + .../src/components/grid/cells/DateCell.svelte | 38 +++++++++++------- .../src/components/grid/layout/Grid.svelte | 10 ++--- .../src/components/grid/layout/GridRow.svelte | 2 + .../src/components/grid/lib/constants.js | 3 +- .../grid/overlays/GridPopover.svelte | 40 +++++++++++++++++++ .../grid/overlays/PopoverOverlay.svelte | 9 +++++ .../grid/overlays/ScrollOverlay.svelte | 2 + 9 files changed, 84 insertions(+), 25 deletions(-) create mode 100644 packages/frontend-core/src/components/grid/overlays/GridPopover.svelte create mode 100644 packages/frontend-core/src/components/grid/overlays/PopoverOverlay.svelte diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte index 263a0b6dc6..079aee32b5 100644 --- a/packages/bbui/src/Popover/Popover.svelte +++ b/packages/bbui/src/Popover/Popover.svelte @@ -116,12 +116,11 @@ min-width: var(--spectrum-global-dimension-size-2000); border-color: var(--spectrum-global-color-gray-300); overflow: auto; - transition: opacity 260ms ease-out, transform 260ms ease-out; + transition: opacity 260ms ease-out; } .hidden { opacity: 0; pointer-events: none; - transform: translateY(-20px); } .customZindex { z-index: var(--customZindex) !important; diff --git a/packages/frontend-core/src/components/grid/cells/DataCell.svelte b/packages/frontend-core/src/components/grid/cells/DataCell.svelte index d8cff26b9d..33f74b116c 100644 --- a/packages/frontend-core/src/components/grid/cells/DataCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/DataCell.svelte @@ -22,6 +22,7 @@ export let invertY = false export let contentLines = 1 export let hidden = false + export let rand const emptyError = writable(null) @@ -96,6 +97,7 @@ {invertY} {invertX} {contentLines} + {rand} /> diff --git a/packages/frontend-core/src/components/grid/cells/DateCell.svelte b/packages/frontend-core/src/components/grid/cells/DateCell.svelte index 04d5841f49..26f5653fd0 100644 --- a/packages/frontend-core/src/components/grid/cells/DateCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/DateCell.svelte @@ -7,7 +7,7 @@ } from "@budibase/bbui" import { onMount } from "svelte" import dayjs from "dayjs" - import { debounce } from "../../../utils/utils" + import GridPopover from "../overlays/GridPopover.svelte" export let value export let schema @@ -15,8 +15,12 @@ export let focused = false export let readonly = false export let api + export let invertX = false + export let invertY = false + export let rand let isOpen + let anchor $: timeOnly = schema?.timeOnly $: enableTime = !schema?.dateOnly @@ -99,7 +103,12 @@ -
+
{displayValue}
@@ -109,16 +118,18 @@
{#if isOpen} -
- (value = e.detail)} - {enableTime} - {timeOnly} - {ignoreTimezones} - useKeyboardShortcuts={false} - /> -
+ +
+ (value = e.detail)} + {enableTime} + {timeOnly} + {ignoreTimezones} + useKeyboardShortcuts={false} + /> +
+
{/if} ` + + const updateInitialOffsets = open => { + if (!open) { + return + } + initialOffsetX = $scroll.left + initialOffsetY = $scroll.top % $rowHeight + } + + + +{@html markup} + + + diff --git a/packages/frontend-core/src/components/grid/overlays/PopoverOverlay.svelte b/packages/frontend-core/src/components/grid/overlays/PopoverOverlay.svelte new file mode 100644 index 0000000000..a03ba6d927 --- /dev/null +++ b/packages/frontend-core/src/components/grid/overlays/PopoverOverlay.svelte @@ -0,0 +1,9 @@ +
+ + diff --git a/packages/frontend-core/src/components/grid/overlays/ScrollOverlay.svelte b/packages/frontend-core/src/components/grid/overlays/ScrollOverlay.svelte index 43a64f3fbd..c256e0dc19 100644 --- a/packages/frontend-core/src/components/grid/overlays/ScrollOverlay.svelte +++ b/packages/frontend-core/src/components/grid/overlays/ScrollOverlay.svelte @@ -127,6 +127,7 @@ on:mousedown={startVDragging} on:touchstart={startVDragging} class:dragging={isDraggingV} + data-ignore-click-outside="true" /> {/if} {#if $showHScrollbar} @@ -137,6 +138,7 @@ on:mousedown={startHDragging} on:touchstart={startHDragging} class:dragging={isDraggingH} + data-ignore-click-outside="true" /> {/if}