PageView - editing html
This commit is contained in:
parent
b715b2a842
commit
53287779f2
|
@ -483,9 +483,9 @@ const savePage = store => async page => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.pages[currentPageName] = page;
|
s.pages[s.currentPageName] = page;
|
||||||
savePackage();
|
savePackage(store, s);
|
||||||
|
return s;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,40 +5,58 @@ import Dropdown from "../common/Dropdown.svelte";
|
||||||
import Button from "../common/Button.svelte";
|
import Button from "../common/Button.svelte";
|
||||||
import { store } from "../builderStore";
|
import { store } from "../builderStore";
|
||||||
import { isRootComponent } from "./pagesParsing/searchComponents";
|
import { isRootComponent } from "./pagesParsing/searchComponents";
|
||||||
|
import {
|
||||||
|
filter,
|
||||||
|
find
|
||||||
|
} from "lodash/fp";
|
||||||
|
|
||||||
let entryComponent;
|
let entryComponent;
|
||||||
let title = "";
|
let title = "";
|
||||||
let components = [];
|
let components = [];
|
||||||
|
|
||||||
store.subscribe(s => {
|
store.subscribe(s => {
|
||||||
title = s.currentFrontEndItem.title;
|
title = s.currentFrontEndItem.index.title;
|
||||||
entryComponent = s.currentFrontEndItem.entryComponent;
|
|
||||||
components = filter(s => !isRootComponent(s))(s.allComponents);
|
components = filter(s => !isRootComponent(s))(s.allComponents);
|
||||||
|
entryComponent = find(c => c.name === s.currentFrontEndItem.appBody)(components);
|
||||||
});
|
});
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
const page = {
|
const page = {
|
||||||
title,
|
index: {
|
||||||
entryComponent,
|
title
|
||||||
|
},
|
||||||
|
appBody: entryComponent.name,
|
||||||
}
|
}
|
||||||
store.savePage(page);
|
store.savePage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>{$store.currentPageName}</p>
|
<div class="root">
|
||||||
|
|
||||||
|
<h3>{$store.currentPageName}</h3>
|
||||||
|
|
||||||
<form class="uk-form-horizontal">
|
<form class="uk-form-horizontal">
|
||||||
<Textbox bind:value={title} label="Title" />
|
<Textbox bind:text={title} label="Title" />
|
||||||
<Dropdown bind:value={title}
|
<div class="help-text">The title of your page, displayed in the bowser tab</div>
|
||||||
label="App Entry Component"
|
<Dropdown label="App Entry Component"
|
||||||
options={components}
|
options={components}
|
||||||
selected={entryComponent}
|
bind:selected={entryComponent}
|
||||||
textMember="name" />
|
textMember={(v) => v.name} />
|
||||||
|
|
||||||
|
<div class="help-text">The component that will be loaded into the body of the page</div>
|
||||||
|
<div style="margin-top: 20px"></div>
|
||||||
<Button on:click={save}>Save</Button>
|
<Button on:click={save}>Save</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<style>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.root {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
.help-text {
|
||||||
|
color: var(--slate);
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
|
@ -10,13 +10,13 @@ const getPage = (s, name) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="hierarchy-item component" class:selected={$store.currentFrontEndItem && $store.currentFrontEndItem.name === "main"}
|
<div class="hierarchy-item component" class:selected={$store.currentFrontEndItem && $store.currentPageName === "main"}
|
||||||
on:click|stopPropagation={() => store.setCurrentPage("main")}>
|
on:click|stopPropagation={() => store.setCurrentPage("main")}>
|
||||||
<span>{@html getIcon("circle", "7")}</span>
|
<span>{@html getIcon("circle", "7")}</span>
|
||||||
<span class="title">Main</span>
|
<span class="title">Main</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hierarchy-item component" class:selected={$store.currentFrontEndItem && $store.currentFrontEndItem.name === "unauthenticated"}
|
<div class="hierarchy-item component" class:selected={$store.currentFrontEndItem && $store.currentPageName === "unauthenticated"}
|
||||||
on:click|stopPropagation={() => store.setCurrentPage("unauthenticated")}>
|
on:click|stopPropagation={() => store.setCurrentPage("unauthenticated")}>
|
||||||
<span>{@html getIcon("circle", "7")}</span>
|
<span>{@html getIcon("circle", "7")}</span>
|
||||||
<span class="title">Login</span>
|
<span class="title">Login</span>
|
||||||
|
|
|
@ -5,12 +5,13 @@ import PagesList from "./PagesList.svelte"
|
||||||
import EditComponent from "./EditComponent.svelte";
|
import EditComponent from "./EditComponent.svelte";
|
||||||
import { store } from "../builderStore";
|
import { store } from "../builderStore";
|
||||||
import getIcon from "../common/icon";
|
import getIcon from "../common/icon";
|
||||||
import { isRootComponent } from "./pagesParsing/searchComponents";
|
import { isComponent } from "./pagesParsing/searchComponents";
|
||||||
import IconButton from "../common/IconButton.svelte";
|
import IconButton from "../common/IconButton.svelte";
|
||||||
import Modal from "../common/Modal.svelte";
|
import Modal from "../common/Modal.svelte";
|
||||||
import NewComponent from "./NewComponent.svelte";
|
import NewComponent from "./NewComponent.svelte";
|
||||||
import CurrentItemPreview from "./CurrentItemPreview.svelte";
|
import CurrentItemPreview from "./CurrentItemPreview.svelte";
|
||||||
import SettingsView from "./SettingsView.svelte";
|
import SettingsView from "./SettingsView.svelte";
|
||||||
|
import PageView from "./PageView.svelte";
|
||||||
|
|
||||||
let newComponentPicker;
|
let newComponentPicker;
|
||||||
const newComponent = () => {
|
const newComponent = () => {
|
||||||
|
@ -59,15 +60,19 @@ const settings = () => {
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{#if $store.currentFrontEndItem}
|
{#if $store.currentFrontEndItem}
|
||||||
|
{#if isComponent($store.currentFrontEndItem)}
|
||||||
<CurrentItemPreview />
|
<CurrentItemPreview />
|
||||||
|
{:else}
|
||||||
|
<PageView />
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if $store.currentFrontEndItem && isComponent($store.currentFrontEndItem)}
|
||||||
<div class="properties-pane">
|
<div class="properties-pane">
|
||||||
{#if $store.currentFrontEndItem && !isRootComponent($store.currentFrontEndItem)}
|
|
||||||
<EditComponent />
|
<EditComponent />
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,18 @@ import {
|
||||||
isUndefined,
|
isUndefined,
|
||||||
filter,
|
filter,
|
||||||
some,
|
some,
|
||||||
includes
|
includes,
|
||||||
|
has
|
||||||
} from "lodash/fp";
|
} from "lodash/fp";
|
||||||
|
|
||||||
const normalString = s => (s||"").trim().toLowerCase();
|
const normalString = s => (s||"").trim().toLowerCase();
|
||||||
|
|
||||||
export const isRootComponent = c => isUndefined(c.inherits);
|
export const isRootComponent = c => isComponent(c) && isUndefined(c.inherits);
|
||||||
|
|
||||||
|
export const isComponent = c => {
|
||||||
|
const hasProp = (n) => !isUndefined(c[n]);
|
||||||
|
return hasProp("name") && hasProp("props");
|
||||||
|
}
|
||||||
|
|
||||||
export const searchAllComponents = (allComponents, phrase) => {
|
export const searchAllComponents = (allComponents, phrase) => {
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,10 @@
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
[
|
||||||
|
[
|
||||||
|
[
|
||||||
|
[
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
@ -142,6 +146,10 @@
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"mainUi": {},
|
"mainUi": {},
|
||||||
"unauthenticatedUi": {}
|
"unauthenticatedUi": {}
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
{
|
{
|
||||||
"main": {
|
"main": {
|
||||||
"index": {},
|
"index": {
|
||||||
"appBody": "./main.app.json"
|
"title": "yyyaaa"
|
||||||
|
},
|
||||||
|
"appBody": "Random Button"
|
||||||
},
|
},
|
||||||
"unauthenticated": {
|
"unauthenticated": {
|
||||||
"index": {
|
"index": {
|
||||||
"_component": "budibase-components/indexHtml",
|
"title": "Test App 1 - Login"
|
||||||
"title": "Test App 1 - Login",
|
|
||||||
"customScripts": [
|
|
||||||
"MyCustomComponents.js"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"appBody": "./unauthenticated.app.json"
|
"appBody": "login_screen"
|
||||||
},
|
},
|
||||||
"componentLibraries": [
|
"componentLibraries": [
|
||||||
"./standard-components"
|
"./standard-components"
|
||||||
|
|
|
@ -38,5 +38,6 @@ input.svelte-66516k{margin-right:7px}
|
||||||
.root.svelte-bv289q{padding:10px}.option-container.svelte-bv289q{border-style:dotted;border-width:1px;border-color:var(--primary75);padding:3px;margin-right:5px}
|
.root.svelte-bv289q{padding:10px}.option-container.svelte-bv289q{border-style:dotted;border-width:1px;border-color:var(--primary75);padding:3px;margin-right:5px}
|
||||||
.addelement-container.svelte-jliz3p{cursor:pointer;padding:3px 0px;text-align:center}.addelement-container.svelte-jliz3p:hover{background-color:var(--primary25)}.item-container.svelte-jliz3p{padding-left:3px;background:var(--secondary10)}
|
.addelement-container.svelte-jliz3p{cursor:pointer;padding:3px 0px;text-align:center}.addelement-container.svelte-jliz3p:hover{background-color:var(--primary25)}.item-container.svelte-jliz3p{padding-left:3px;background:var(--secondary10)}
|
||||||
textarea.svelte-1wfv4cc{width:300px;height:200px}
|
textarea.svelte-1wfv4cc{width:300px;height:200px}
|
||||||
|
.root.svelte-1ersoxu{padding:15px}.help-text.svelte-1ersoxu{color:var(--slate);font-size:10pt}
|
||||||
|
|
||||||
/*# sourceMappingURL=bundle.css.map */
|
/*# sourceMappingURL=bundle.css.map */
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue