diff --git a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte index 51dd44026e..ea9ebbf2c5 100644 --- a/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/design/NavigationPanel/FrontendNavigatePane.svelte @@ -25,8 +25,7 @@ key: "layout", }, ] - - let modal + let newLayoutModal $: selected = tabs.find(t => t.key === $params.assetType)?.title || "Screens" const navigate = ({ detail }) => { @@ -93,14 +92,18 @@ {#each $store.layouts as layout, idx (layout._id)} 0} /> {/each} - +
- +
diff --git a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte index fbd1fc9256..67dbf581f2 100644 --- a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte @@ -10,16 +10,39 @@ ProgressCircle, } from "@budibase/bbui" import getTemplates from "builderStore/store/screenTemplates" + import { onDestroy } from "svelte" + + import { createEventDispatcher } from "svelte" - export let selectedScreens = [] export let chooseModal export let save export let showProgressCircle = false + + let selectedScreens = [] + const blankScreen = "createFromScratch" + const dispatch = createEventDispatcher() + + function setScreens() { + dispatch("save", { + screens: selectedScreens, + }) + } $: blankSelected = selectedScreens?.length === 1 $: autoSelected = selectedScreens?.length > 0 && !blankSelected + let templates = getTemplates($store, $tables.list) + + const confirm = async () => { + if (autoSelected) { + setScreens() + await save() + } else { + setScreens() + chooseModal(1) + } + } const toggleScreenSelection = table => { if (selectedScreens.find(s => s.table === table.name)) { selectedScreens = selectedScreens.filter( @@ -32,14 +55,18 @@ selectedScreens = [...partialTemplates, ...selectedScreens] } } + + onDestroy(() => { + selectedScreens = [] + }) -
+
(autoSelected ? save() : chooseModal(1))} + onConfirm={() => confirm()} disabled={!selectedScreens.length} size="L" > @@ -70,29 +97,31 @@ {/if}
- Autogenerated Screens + {#if $tables.list.filter(table => table._id !== "ta_users").length > 0} + Autogenerated Screens - {#each $tables.list.filter(table => table._id !== "ta_users") as table} -
x.table === table.name)} - on:click={() => toggleScreenSelection(table)} - class="item" - > -
-
{table.name}
-
+ {#each $tables.list.filter(table => table._id !== "ta_users") as table}
x.table === table.name)} + on:click={() => toggleScreenSelection(table)} + class="item" > - {#if selectedScreens.find(x => x.table === table.name)} -
- -
- {/if} +
+
{table.name}
+
+
+ {#if selectedScreens.find(x => x.table === table.name)} +
+ +
+ {/if} +
-
- {/each} + {/each} + {/if}
{#if showProgressCircle} diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenDetailsModal.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenDetailsModal.svelte index e5cc839045..6d906da742 100644 --- a/packages/builder/src/components/design/NavigationPanel/ScreenDetailsModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ScreenDetailsModal.svelte @@ -2,6 +2,7 @@ import { ModalContent, Input, ProgressCircle } from "@budibase/bbui" import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" import { selectedAccessRole, allScreens } from "builderStore" + import { onDestroy } from "svelte" export let screenName export let url @@ -32,6 +33,11 @@ screen.routing.roleId === roleId ) } + + onDestroy(() => { + screenName = "" + url = "" + }) { let existingScreenCount = $store.screens.filter( s => s.props._instanceName == draftScreen.props._instanceName @@ -90,17 +89,14 @@ ) } - onDestroy(() => { - selectedScreens = [] - screenName = "" - url = "" - createdScreens = [] - }) - export const showModal = () => { newScreenModal.show() } + const setScreens = evt => { + selectedScreens = evt.detail.screens + } + const chooseModal = index => { /* 0 = newScreenModal @@ -119,7 +115,7 @@