commit
c791efc864
|
@ -65,7 +65,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.58.13",
|
"@budibase/bbui": "^1.58.13",
|
||||||
"@budibase/client": "^0.8.5",
|
"@budibase/client": "^0.8.5",
|
||||||
"@budibase/colorpicker": "1.0.1",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^0.8.5",
|
"@budibase/string-templates": "^0.8.5",
|
||||||
"@budibase/svelte-ag-grid": "^1.0.4",
|
"@budibase/svelte-ag-grid": "^1.0.4",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { getFrontendStore } from "./store/frontend"
|
||||||
import { getBackendUiStore } from "./store/backend"
|
import { getBackendUiStore } from "./store/backend"
|
||||||
import { getAutomationStore } from "./store/automation"
|
import { getAutomationStore } from "./store/automation"
|
||||||
import { getHostingStore } from "./store/hosting"
|
import { getHostingStore } from "./store/hosting"
|
||||||
|
|
||||||
import { getThemeStore } from "./store/theme"
|
import { getThemeStore } from "./store/theme"
|
||||||
import { derived, writable } from "svelte/store"
|
import { derived, writable } from "svelte/store"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
|
@ -66,3 +65,5 @@ export const initialise = async () => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const screenSearchString = writable(null)
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@sveltech/routify"
|
import {
|
||||||
import { store, selectedComponent, currentAsset } from "builderStore"
|
store,
|
||||||
|
selectedComponent,
|
||||||
|
currentAsset,
|
||||||
|
screenSearchString,
|
||||||
|
} from "builderStore"
|
||||||
import instantiateStore from "./dragDropStore"
|
import instantiateStore from "./dragDropStore"
|
||||||
|
|
||||||
import ComponentTree from "./ComponentTree.svelte"
|
import ComponentTree from "./ComponentTree.svelte"
|
||||||
import NavItem from "components/common/NavItem.svelte"
|
import NavItem from "components/common/NavItem.svelte"
|
||||||
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
|
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
|
||||||
|
import { get } from "svelte/store"
|
||||||
|
|
||||||
const ROUTE_NAME_MAP = {
|
const ROUTE_NAME_MAP = {
|
||||||
"/": {
|
"/": {
|
||||||
|
@ -21,38 +25,72 @@
|
||||||
export let indent
|
export let indent
|
||||||
export let border
|
export let border
|
||||||
|
|
||||||
|
let routeManuallyOpened = false
|
||||||
$: selectedScreen = $currentAsset
|
$: selectedScreen = $currentAsset
|
||||||
|
$: allScreens = getAllScreens(route)
|
||||||
|
$: filteredScreens = getFilteredScreens(allScreens, $screenSearchString)
|
||||||
|
$: hasSearchMatch = $screenSearchString && filteredScreens.length > 0
|
||||||
|
$: noSearchMatch = $screenSearchString && !filteredScreens.length
|
||||||
|
$: routeSelected =
|
||||||
|
route.subpaths[selectedScreen?.routing?.route] !== undefined
|
||||||
|
$: routeOpened = routeManuallyOpened || routeSelected || hasSearchMatch
|
||||||
|
|
||||||
const changeScreen = screenId => {
|
const changeScreen = screenId => {
|
||||||
store.actions.screens.select(screenId)
|
store.actions.screens.select(screenId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getAllScreens = route => {
|
||||||
|
let screens = []
|
||||||
|
Object.entries(route.subpaths).forEach(([route, subpath]) => {
|
||||||
|
Object.entries(subpath.screens).forEach(([role, id]) => {
|
||||||
|
screens.push({ id, route, role })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return screens
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFilteredScreens = (screens, searchString) => {
|
||||||
|
return screens.filter(
|
||||||
|
screen => !searchString || screen.route.includes(searchString)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const toggleManuallyOpened = () => {
|
||||||
|
if (get(screenSearchString)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
routeManuallyOpened = !routeManuallyOpened
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<NavItem
|
{#if !noSearchMatch}
|
||||||
icon="ri-folder-line"
|
<NavItem
|
||||||
text={path}
|
icon="ri-folder-line"
|
||||||
opened={true}
|
text={path}
|
||||||
{border}
|
on:click={toggleManuallyOpened}
|
||||||
withArrow={route.subpaths} />
|
opened={routeOpened}
|
||||||
|
{border}
|
||||||
|
withArrow={route.subpaths} />
|
||||||
|
|
||||||
{#each Object.entries(route.subpaths) as [url, subpath]}
|
{#if routeOpened}
|
||||||
{#each Object.entries(subpath.screens) as [role, screenId]}
|
{#each filteredScreens as screen (screen.id)}
|
||||||
<NavItem
|
<NavItem
|
||||||
icon="ri-artboard-2-line"
|
icon="ri-artboard-2-line"
|
||||||
indentLevel={indent || 1}
|
indentLevel={indent || 1}
|
||||||
selected={$store.selectedScreenId === screenId}
|
selected={$store.selectedScreenId === screen.id}
|
||||||
opened={$store.selectedScreenId === screenId}
|
opened={$store.selectedScreenId === screen.id}
|
||||||
text={ROUTE_NAME_MAP[url]?.[role] || url}
|
text={ROUTE_NAME_MAP[screen.route]?.[screen.role] || screen.route}
|
||||||
withArrow={route.subpaths}
|
withArrow={route.subpaths}
|
||||||
on:click={() => changeScreen(screenId)}>
|
on:click={() => changeScreen(screen.id)}>
|
||||||
<ScreenDropdownMenu {screenId} />
|
<ScreenDropdownMenu screenId={screen.id} />
|
||||||
</NavItem>
|
</NavItem>
|
||||||
{#if selectedScreen?._id === screenId}
|
{#if selectedScreen?._id === screen.id}
|
||||||
<ComponentTree
|
<ComponentTree
|
||||||
level={1}
|
level={1}
|
||||||
components={selectedScreen.props._children}
|
components={selectedScreen.props._children}
|
||||||
currentComponent={$selectedComponent}
|
currentComponent={$selectedComponent}
|
||||||
{dragDropStore} />
|
{dragDropStore} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
{#each paths as path, idx}
|
{#each paths as path, idx (path)}
|
||||||
<PathTree border={idx > 0} {path} route={routes[path]} />
|
<PathTree border={idx > 0} {path} route={routes[path]} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { goto, params, url } from "@sveltech/routify"
|
import { goto, params } from "@sveltech/routify"
|
||||||
import {
|
import {
|
||||||
store,
|
store,
|
||||||
allScreens,
|
allScreens,
|
||||||
currentAsset,
|
|
||||||
backendUiStore,
|
backendUiStore,
|
||||||
selectedAccessRole,
|
selectedAccessRole,
|
||||||
|
screenSearchString,
|
||||||
} from "builderStore"
|
} from "builderStore"
|
||||||
import { FrontendTypes } from "constants"
|
import { FrontendTypes } from "constants"
|
||||||
import ComponentNavigationTree from "components/design/NavigationPanel/ComponentNavigationTree/index.svelte"
|
import ComponentNavigationTree from "components/design/NavigationPanel/ComponentNavigationTree/index.svelte"
|
||||||
import Layout from "components/design/NavigationPanel/Layout.svelte"
|
import Layout from "components/design/NavigationPanel/Layout.svelte"
|
||||||
import NewScreenModal from "components/design/NavigationPanel/NewScreenModal.svelte"
|
import NewScreenModal from "components/design/NavigationPanel/NewScreenModal.svelte"
|
||||||
import NewLayoutModal from "components/design/NavigationPanel/NewLayoutModal.svelte"
|
import NewLayoutModal from "components/design/NavigationPanel/NewLayoutModal.svelte"
|
||||||
import { Modal, Switcher, Select } from "@budibase/bbui"
|
import { Modal, Switcher, Select, Input } from "@budibase/bbui"
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,16 @@
|
||||||
<option value={role._id}>{role.name}</option>
|
<option value={role._id}>{role.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
|
<div class="search-screens">
|
||||||
|
<Input
|
||||||
|
extraThin
|
||||||
|
placeholder="Enter a route to search"
|
||||||
|
label="Search Screens"
|
||||||
|
bind:value={$screenSearchString} />
|
||||||
|
<i
|
||||||
|
class="ri-close-line"
|
||||||
|
on:click={() => ($screenSearchString = null)} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-items-container">
|
<div class="nav-items-container">
|
||||||
<ComponentNavigationTree />
|
<ComponentNavigationTree />
|
||||||
|
@ -127,6 +137,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.role-select {
|
.role-select {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
margin-bottom: var(--spacing-m);
|
margin-bottom: var(--spacing-m);
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-screens {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.search-screens i {
|
||||||
|
right: 2px;
|
||||||
|
bottom: 2px;
|
||||||
|
position: absolute;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: var(--spacing-s);
|
||||||
|
border-left: 1px solid var(--grey-4);
|
||||||
|
background-color: var(--grey-2);
|
||||||
|
border-top-right-radius: var(--border-radius-m);
|
||||||
|
border-bottom-right-radius: var(--border-radius-m);
|
||||||
|
color: var(--grey-7);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 15px;
|
||||||
|
top: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,7 +1,38 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { createEventDispatcher } from 'svelte'
|
||||||
import Colorpicker from "@budibase/colorpicker"
|
import Colorpicker from "@budibase/colorpicker"
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
|
||||||
|
const WAIT = 150;
|
||||||
|
|
||||||
|
function throttle(callback, wait, immediate = false) {
|
||||||
|
let timeout = null
|
||||||
|
let initialCall = true
|
||||||
|
|
||||||
|
return function() {
|
||||||
|
const callNow = immediate && initialCall
|
||||||
|
const next = () => {
|
||||||
|
callback.apply(this, arguments)
|
||||||
|
timeout = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callNow) {
|
||||||
|
initialCall = false
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!timeout) {
|
||||||
|
timeout = setTimeout(next, wait)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onChange = throttle(e => {
|
||||||
|
dispatch('change', e.detail)
|
||||||
|
}, WAIT, true)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Colorpicker value={value || '#000'} on:change />
|
<Colorpicker value={value || '#C4C4C4'} on:change={onChange} />
|
||||||
|
|
|
@ -833,10 +833,10 @@
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
turndown "^7.0.0"
|
turndown "^7.0.0"
|
||||||
|
|
||||||
"@budibase/colorpicker@1.0.1":
|
"@budibase/colorpicker@1.1.2":
|
||||||
version "1.0.1"
|
version "1.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.0.1.tgz#940c180e7ebba0cb0756c4c8ef13f5dfab58e810"
|
resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.1.2.tgz#f7436924ee746d7be9b2009c2fa193e710c30f89"
|
||||||
integrity sha512-+DTHYhU0sTi5RfCyd7AAvMsLFwyF/wgs0owf7KyQU+ZILRW+YsWa7OQMz+hKQfgVAmvzwrNz8ATiBlG3Ac6Asg==
|
integrity sha512-2PlZBVkATDqDC4b4Ri8Xi8X3OxhuHOGfmZwtXbZL38lNIeofaQT3Qyc1ECzEY5N+HrdGrWhY9EnliF6QM+LIuA==
|
||||||
|
|
||||||
"@budibase/svelte-ag-grid@^1.0.4":
|
"@budibase/svelte-ag-grid@^1.0.4":
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
|
|
Loading…
Reference in New Issue