From d268064164aac7cda64e8081c92a92a8f61f8c37 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 20 Apr 2021 12:20:03 +0100 Subject: [PATCH] Update all backend table popovers to use spectrum and fix multiple bugs --- packages/bbui/src/Actions/click_outside.js | 4 +-- packages/bbui/src/Form/Core/Picker.svelte | 15 +++------- packages/bbui/src/Modal/Modal.svelte | 13 ++++----- packages/bbui/src/Popover/Popover.svelte | 28 ------------------- .../popovers/CreateViewPopover.svelte | 3 +- .../DataTable/popovers/ExportPopover.svelte | 14 ++++++---- .../popovers/ManageAccessPopover.svelte | 15 +++++----- packages/builder/src/global.css | 2 +- 8 files changed, 30 insertions(+), 64 deletions(-) diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js index 9257af5f5b..49a15d36a3 100644 --- a/packages/bbui/src/Actions/click_outside.js +++ b/packages/bbui/src/Actions/click_outside.js @@ -5,14 +5,14 @@ export default function clickOutside(element, callbackFunction) { } } - document.body.addEventListener("click", onClick, true) + document.body.addEventListener("mousedown", onClick, true) return { update(newCallbackFunction) { callbackFunction = newCallbackFunction }, destroy() { - document.body.removeEventListener("click", onClick, true) + document.body.removeEventListener("mousedown", onClick, true) }, } } diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 5bc0480f94..01ce2a06af 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -4,6 +4,7 @@ import "@spectrum-css/menu/dist/index-vars.css" import { fly } from "svelte/transition" import { createEventDispatcher } from "svelte" + import clickOutside from "../../Actions/click_outside" export let id = null export let disabled = false @@ -20,7 +21,7 @@ export let readonly = false const dispatch = createEventDispatcher() - const onClick = () => { + const onClick = e => { dispatch("click") if (readonly) { return @@ -36,7 +37,7 @@ class:is-invalid={!!error} class:is-open={open} aria-haspopup="listbox" - on:click={onClick}> + on:mousedown={onClick}> {fieldText} @@ -57,8 +58,8 @@ {#if open} -
(open = false)} />
(open = false)} transition:fly={{ y: -20, duration: 200 }} class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open">
    @@ -104,14 +105,6 @@ {/if} diff --git a/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte index da36ab6635..8b589c66e1 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte @@ -35,7 +35,7 @@
@@ -48,6 +48,7 @@ .actions { display: grid; grid-gap: var(--spacing-xl); + padding: var(--spacing-xl); } .footer { diff --git a/packages/builder/src/components/backend/DataTable/popovers/ExportPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/ExportPopover.svelte index 2b1c531e39..70ee053322 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/ExportPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/ExportPopover.svelte @@ -30,14 +30,15 @@
Export Data
- + + + on:change={e => changePermission(level, e.detail)} + options={$roles} + getOptionLabel={x => x.name} + getOptionValue={x => x._id} /> {/each}
@@ -58,6 +56,7 @@ .popover { display: grid; width: 400px; + padding: var(--spacing-xl); } h5 { diff --git a/packages/builder/src/global.css b/packages/builder/src/global.css index 4ddddd205b..185e6e2e8b 100644 --- a/packages/builder/src/global.css +++ b/packages/builder/src/global.css @@ -30,7 +30,7 @@ body { #app { height: 100%; box-sizing: border-box; - overflow-y: hidden; + overflow: hidden; } .hoverable:hover {