fixes to transitions and adds default fade to screens
This commit is contained in:
parent
43e37e2ed6
commit
c6292c070c
|
@ -1,11 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { goto } from "@sveltech/routify"
|
|
||||||
import { store, backendUiStore, allScreens } from "builderStore"
|
import { store, backendUiStore, allScreens } from "builderStore"
|
||||||
import { Input, Select, ModalContent, Toggle } from "@budibase/bbui"
|
import { Input, Select, ModalContent, Toggle } from "@budibase/bbui"
|
||||||
import getTemplates from "builderStore/store/screenTemplates"
|
import getTemplates from "builderStore/store/screenTemplates"
|
||||||
import analytics from "analytics"
|
import analytics from "analytics"
|
||||||
import { onMount } from "svelte"
|
|
||||||
import api from "builderStore/api"
|
|
||||||
|
|
||||||
const CONTAINER = "@budibase/standard-components/container"
|
const CONTAINER = "@budibase/standard-components/container"
|
||||||
|
|
||||||
|
@ -19,9 +16,6 @@
|
||||||
|
|
||||||
$: templates = getTemplates($store, $backendUiStore.tables)
|
$: templates = getTemplates($store, $backendUiStore.tables)
|
||||||
$: route = !route && $allScreens.length === 0 ? "*" : route
|
$: route = !route && $allScreens.length === 0 ? "*" : route
|
||||||
$: baseComponents = Object.values($store.components)
|
|
||||||
.filter(componentDefinition => componentDefinition.baseComponent)
|
|
||||||
.map(c => c._component)
|
|
||||||
$: {
|
$: {
|
||||||
if (templates && templateIndex === undefined) {
|
if (templates && templateIndex === undefined) {
|
||||||
templateIndex = 0
|
templateIndex = 0
|
||||||
|
@ -31,7 +25,6 @@
|
||||||
|
|
||||||
const templateChanged = newTemplateIndex => {
|
const templateChanged = newTemplateIndex => {
|
||||||
if (newTemplateIndex === undefined) return
|
if (newTemplateIndex === undefined) return
|
||||||
const template = templates[newTemplateIndex]
|
|
||||||
draftScreen = templates[newTemplateIndex].create()
|
draftScreen = templates[newTemplateIndex].create()
|
||||||
if (draftScreen.props._instanceName) {
|
if (draftScreen.props._instanceName) {
|
||||||
name = draftScreen.props._instanceName
|
name = draftScreen.props._instanceName
|
||||||
|
@ -60,6 +53,7 @@
|
||||||
if (routeError) return false
|
if (routeError) return false
|
||||||
|
|
||||||
draftScreen.props._instanceName = name
|
draftScreen.props._instanceName = name
|
||||||
|
draftScreen.props._transition = "fade"
|
||||||
draftScreen.props._component = baseComponent
|
draftScreen.props._component = baseComponent
|
||||||
draftScreen.routing = { route, roleId }
|
draftScreen.routing = { route, roleId }
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,11 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
const transitions = [
|
const transitions = [
|
||||||
'fade', 'blur', 'fly', 'scale' // slide is hidden because it does not seem to result in any effect
|
'none', 'fade', 'blur', 'fly', 'scale' // slide is hidden because it does not seem to result in any effect
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const capitalize = ([first,...rest]) => first.toUpperCase() + rest.join('');
|
||||||
|
|
||||||
$: groups = componentDefinition?.styleable ? Object.keys(allStyles) : []
|
$: groups = componentDefinition?.styleable ? Object.keys(allStyles) : []
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -71,10 +73,9 @@
|
||||||
</div>
|
</div>
|
||||||
{#if componentDefinition?.transitionable}
|
{#if componentDefinition?.transitionable}
|
||||||
<div class="transitions">
|
<div class="transitions">
|
||||||
<Select value={componentInstance._transition || ""} on:change={event => onUpdateTransition(event.target.value)} name="transition" label="Transition" secondary thin>
|
<Select value={componentInstance._transition} on:change={event => onUpdateTransition(event.target.value)} name="transition" label="Transition" secondary thin>
|
||||||
<option value="">Choose a transition</option>
|
|
||||||
{#each transitions as transition}
|
{#each transitions as transition}
|
||||||
<option value={transition}>{transition}</option>
|
<option value={transition}>{capitalize(transition)}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,6 @@ const transitions = new Map([
|
||||||
])
|
])
|
||||||
|
|
||||||
export default function transition(node, { type, options = {} }) {
|
export default function transition(node, { type, options = {} }) {
|
||||||
const { tn, opt } = transitions.get(type) || {}
|
const { tn, opt } = transitions.get(type) || { tn: () => {}, opt: {}}
|
||||||
return tn ? tn(node, { ...opt, ...options }) : fade(node, { duration: 0 })
|
return tn(node, { ...opt, ...options })
|
||||||
}
|
}
|
|
@ -21,6 +21,7 @@ exports.createHomeScreen = () => ({
|
||||||
active: {},
|
active: {},
|
||||||
selected: {},
|
selected: {},
|
||||||
},
|
},
|
||||||
|
_transition: "fade",
|
||||||
type: "div",
|
type: "div",
|
||||||
_children: [
|
_children: [
|
||||||
{
|
{
|
||||||
|
@ -69,6 +70,7 @@ exports.createLoginScreen = app => ({
|
||||||
active: {},
|
active: {},
|
||||||
selected: {},
|
selected: {},
|
||||||
},
|
},
|
||||||
|
_transition: "fade",
|
||||||
type: "div",
|
type: "div",
|
||||||
_children: [
|
_children: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue