forked from tsai/budibase
8 changed files with 2228 additions and 143 deletions
@ -1,5 +1,4 @@ |
|||||
.DS_Store |
.DS_Store |
||||
node_modules |
node_modules |
||||
yarn.lock |
|
||||
package-lock.json |
package-lock.json |
||||
dist/ |
dist/ |
||||
|
|||||
@ -1,47 +0,0 @@ |
|||||
<script> |
|
||||
import createApp from "./createApp" |
|
||||
import { form } from "./props" |
|
||||
let _bb |
|
||||
let currentComponent |
|
||||
let _appPromise |
|
||||
|
|
||||
const autoAssignIds = (props, count = 0) => { |
|
||||
if (!props._id) { |
|
||||
props._id = `auto_id_${count}` |
|
||||
} |
|
||||
if (props._children) { |
|
||||
for (let child of props._children) { |
|
||||
count += 1 |
|
||||
autoAssignIds(child, count) |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
$: { |
|
||||
if (currentComponent) { |
|
||||
const _appPromise = createApp() |
|
||||
const page = { |
|
||||
props: form, |
|
||||
} |
|
||||
|
|
||||
autoAssignIds(page.props) |
|
||||
|
|
||||
_appPromise.then(initialise => { |
|
||||
initialise(page, currentComponent, "") |
|
||||
}) |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
{#await _appPromise} |
|
||||
loading |
|
||||
{:then _} |
|
||||
<div id="current_component" bind:this={currentComponent} /> |
|
||||
{/await} |
|
||||
|
|
||||
<style> |
|
||||
#current_component { |
|
||||
height: 100%; |
|
||||
width: 100%; |
|
||||
} |
|
||||
</style> |
|
||||
@ -1,64 +0,0 @@ |
|||||
export const form = { |
|
||||
_id: "1", |
|
||||
_component: "@budibase/standard-components/container", |
|
||||
type: "main", |
|
||||
_children: [ |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/heading", |
|
||||
type: "h1", |
|
||||
_children: [ |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/text", |
|
||||
text: "This is an H1 Heading", |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/text", |
|
||||
text: "This just some text", |
|
||||
type: "strong", |
|
||||
}, |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/container", |
|
||||
type: "paragraph", |
|
||||
backgroundColor: "red", |
|
||||
color: "white", |
|
||||
borderStyle: "solid", |
|
||||
borderWidth: "3px", |
|
||||
borderColor: "blue", |
|
||||
_children: [ |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/text", |
|
||||
formattingTag: "<i>", |
|
||||
text: "some iatlics in a paragraph", |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/heading", |
|
||||
type: "h2", |
|
||||
_children: [ |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/text", |
|
||||
text: "This is an H2 Heading", |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/select", |
|
||||
value: "two", |
|
||||
_children: [ |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/option", |
|
||||
text: "number 1", |
|
||||
value: "one", |
|
||||
}, |
|
||||
{ |
|
||||
_component: "@budibase/standard-components/option", |
|
||||
text: "number 2", |
|
||||
value: "two", |
|
||||
}, |
|
||||
], |
|
||||
}, |
|
||||
], |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
export const rootComponent = window => { |
|
||||
return function(opts) { |
|
||||
const node = window.document.createElement("DIV") |
|
||||
const $set = props => { |
|
||||
props._bb.attachChildren(node) |
|
||||
} |
|
||||
const $destroy = () => { |
|
||||
if (opts.target && node) opts.target.removeChild(node) |
|
||||
} |
|
||||
this.$set = $set |
|
||||
this.$set(opts.props) |
|
||||
this.$destroy = $destroy |
|
||||
opts.target.appendChild(node) |
|
||||
} |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
import * as components from "../index" |
|
||||
|
|
||||
export default components |
|
||||
@ -1,7 +0,0 @@ |
|||||
import App from "./TestApp.svelte" |
|
||||
|
|
||||
const app = new App({ |
|
||||
target: document.body, |
|
||||
}) |
|
||||
|
|
||||
export default app |
|
||||
File diff suppressed because it is too large
Loading…
Reference in new issue