From 6c1701830fedb7913290b3ea5b9cf40f3de96a67 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 14 Feb 2022 13:06:32 +0000 Subject: [PATCH] Improve layout and edge cases around using column editor drawer --- .../ColumnEditor/ColumnDrawer.svelte | 106 +++++++++++------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte index 3f2f75a206..ef4726751b 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ColumnEditor/ColumnDrawer.svelte @@ -7,6 +7,7 @@ Input, Select, Label, + Body, } from "@budibase/bbui" import { flip } from "svelte/animate" import { dndzone } from "svelte-dnd-action" @@ -59,59 +60,81 @@ updateColumnOrder(e) dragDisabled = true } + + const reset = () => { + columns = options.map(col => ({ + name: col, + displayName: col, + })) + }
{#if columns?.length} -
+
- {#each columns as column (column.id)} -
-
(dragDisabled = false)} - > - +
+ {#each columns as column (column.id)} +
+
(dragDisabled = false)} + > + +
+ + removeColumn(column.id)} + disabled={columns.length === 1} + />
- - removeColumn(column.id)} - /> -
- {/each} + {/each} +
+ + {:else} +
+
+ Add the first column to your table.
{/if} -
-
- +
+
+
+
+ + +
+
@@ -145,4 +168,11 @@ display: grid; place-items: center; } + .buttons { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + gap: var(--spacing-m); + }