commit
be28e2dcdd
|
@ -30,7 +30,10 @@ export const getBackendUiStore = () => {
|
||||||
const views = await viewsResponse.json()
|
const views = await viewsResponse.json()
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.selectedDatabase = db
|
state.selectedDatabase = db
|
||||||
state.selectedModel = models && models.length > 0 && models[0]
|
if (models && models.length > 0) {
|
||||||
|
state.selectedModel = models[0]
|
||||||
|
state.selectedView = `${models[0]._id}`
|
||||||
|
}
|
||||||
state.breadcrumbs = [db.name]
|
state.breadcrumbs = [db.name]
|
||||||
state.models = models
|
state.models = models
|
||||||
state.views = views
|
state.views = views
|
||||||
|
@ -73,6 +76,7 @@ export const getBackendUiStore = () => {
|
||||||
state.models.push(model)
|
state.models.push(model)
|
||||||
state.models = state.models
|
state.models = state.models
|
||||||
state.selectedModel = model
|
state.selectedModel = model
|
||||||
|
state.selectedView = `${model._id}`
|
||||||
return state
|
return state
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,6 +23,7 @@ import {
|
||||||
savePage as _savePage,
|
savePage as _savePage,
|
||||||
saveCurrentPreviewItem as _saveCurrentPreviewItem,
|
saveCurrentPreviewItem as _saveCurrentPreviewItem,
|
||||||
saveScreenApi as _saveScreenApi,
|
saveScreenApi as _saveScreenApi,
|
||||||
|
regenerateCssForCurrentScreen,
|
||||||
} from "../storeUtils"
|
} from "../storeUtils"
|
||||||
|
|
||||||
export const getStore = () => {
|
export const getStore = () => {
|
||||||
|
@ -173,11 +174,10 @@ const createScreen = store => (screenName, route, layoutComponentName) => {
|
||||||
const setCurrentScreen = store => screenName => {
|
const setCurrentScreen = store => screenName => {
|
||||||
store.update(s => {
|
store.update(s => {
|
||||||
const screen = getExactComponent(s.screens, screenName)
|
const screen = getExactComponent(s.screens, screenName)
|
||||||
screen._css = generate_screen_css([screen.props])
|
|
||||||
s.currentPreviewItem = screen
|
s.currentPreviewItem = screen
|
||||||
s.currentFrontEndType = "screen"
|
s.currentFrontEndType = "screen"
|
||||||
s.currentView = "detail"
|
s.currentView = "detail"
|
||||||
|
regenerateCssForCurrentScreen(s)
|
||||||
const safeProps = makePropsSafe(
|
const safeProps = makePropsSafe(
|
||||||
s.components[screen.props._component],
|
s.components[screen.props._component],
|
||||||
screen.props
|
screen.props
|
||||||
|
@ -295,9 +295,7 @@ const setCurrentPage = store => pageName => {
|
||||||
state.currentComponentInfo = safeProps
|
state.currentComponentInfo = safeProps
|
||||||
currentPage.props = safeProps
|
currentPage.props = safeProps
|
||||||
state.currentPreviewItem = state.pages[pageName]
|
state.currentPreviewItem = state.pages[pageName]
|
||||||
state.currentPreviewItem._css = generate_screen_css([
|
regenerateCssForCurrentScreen(state)
|
||||||
state.currentPreviewItem.props,
|
|
||||||
])
|
|
||||||
|
|
||||||
for (let screen of state.screens) {
|
for (let screen of state.screens) {
|
||||||
screen._css = generate_screen_css([screen.props])
|
screen._css = generate_screen_css([screen.props])
|
||||||
|
@ -374,9 +372,7 @@ const addTemplatedComponent = store => props => {
|
||||||
state.currentComponentInfo._children = state.currentComponentInfo._children.concat(
|
state.currentComponentInfo._children = state.currentComponentInfo._children.concat(
|
||||||
props
|
props
|
||||||
)
|
)
|
||||||
state.currentPreviewItem._css = generate_screen_css([
|
regenerateCssForCurrentScreen(state)
|
||||||
state.currentPreviewItem.props,
|
|
||||||
])
|
|
||||||
|
|
||||||
setCurrentPageFunctions(state)
|
setCurrentPageFunctions(state)
|
||||||
_saveCurrentPreviewItem(state)
|
_saveCurrentPreviewItem(state)
|
||||||
|
@ -410,9 +406,7 @@ const setComponentStyle = store => (type, name, value) => {
|
||||||
}
|
}
|
||||||
state.currentComponentInfo._styles[type][name] = value
|
state.currentComponentInfo._styles[type][name] = value
|
||||||
|
|
||||||
state.currentPreviewItem._css = generate_screen_css([
|
regenerateCssForCurrentScreen(state)
|
||||||
state.currentPreviewItem.props,
|
|
||||||
])
|
|
||||||
|
|
||||||
// save without messing with the store
|
// save without messing with the store
|
||||||
_saveCurrentPreviewItem(state)
|
_saveCurrentPreviewItem(state)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { makePropsSafe } from "components/userInterface/pagesParsing/createProps"
|
import { makePropsSafe } from "components/userInterface/pagesParsing/createProps"
|
||||||
import api from "./api"
|
import api from "./api"
|
||||||
|
import { generate_screen_css } from "./generate_css"
|
||||||
|
|
||||||
export const selectComponent = (state, component) => {
|
export const selectComponent = (state, component) => {
|
||||||
const componentDef = component._component.startsWith("##")
|
const componentDef = component._component.startsWith("##")
|
||||||
|
@ -57,3 +58,10 @@ export const walkProps = (props, action, cancelToken = null) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const regenerateCssForCurrentScreen = state => {
|
||||||
|
state.currentPreviewItem._css = generate_screen_css([
|
||||||
|
state.currentPreviewItem.props,
|
||||||
|
])
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
getParent,
|
getParent,
|
||||||
walkProps,
|
walkProps,
|
||||||
saveCurrentPreviewItem,
|
saveCurrentPreviewItem,
|
||||||
|
regenerateCssForCurrentScreen,
|
||||||
} from "builderStore/storeUtils"
|
} from "builderStore/storeUtils"
|
||||||
import { uuid } from "builderStore/uuid"
|
import { uuid } from "builderStore/uuid"
|
||||||
|
|
||||||
|
@ -29,8 +30,7 @@
|
||||||
$: noChildrenAllowed =
|
$: noChildrenAllowed =
|
||||||
!component ||
|
!component ||
|
||||||
getComponentDefinition($store, component._component).children === false
|
getComponentDefinition($store, component._component).children === false
|
||||||
$: noPaste =
|
$: noPaste = !$store.componentToPaste
|
||||||
!$store.componentToPaste || $store.componentToPaste._id === component._id
|
|
||||||
|
|
||||||
const lastPartOfName = c => (c ? last(c._component.split("/")) : "")
|
const lastPartOfName = c => (c ? last(c._component.split("/")) : "")
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@
|
||||||
parent._children = [...parent._children, copiedComponent]
|
parent._children = [...parent._children, copiedComponent]
|
||||||
saveCurrentPreviewItem(s)
|
saveCurrentPreviewItem(s)
|
||||||
s.currentComponentInfo = copiedComponent
|
s.currentComponentInfo = copiedComponent
|
||||||
|
regenerateCssForCurrentScreen(s)
|
||||||
return s
|
return s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -141,10 +142,10 @@
|
||||||
const targetIndex = parent._children.indexOf(component)
|
const targetIndex = parent._children.indexOf(component)
|
||||||
const index = mode === "above" ? targetIndex : targetIndex + 1
|
const index = mode === "above" ? targetIndex : targetIndex + 1
|
||||||
parent._children.splice(index, 0, cloneDeep(componentToPaste))
|
parent._children.splice(index, 0, cloneDeep(componentToPaste))
|
||||||
|
regenerateCssForCurrentScreen(s)
|
||||||
saveCurrentPreviewItem(s)
|
saveCurrentPreviewItem(s)
|
||||||
selectComponent(s, componentToPaste)
|
selectComponent(s, componentToPaste)
|
||||||
|
|
||||||
return s
|
return s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
Loading…
Reference in New Issue