Browse Source

initial commit

gh-pages
kevmodrome 6 years ago
parent
commit
3b525cf71b
No known key found for this signature in database GPG Key ID: E8F9CD141E63BF38
  1. 4
      packages/builder/src/builderStore/fetchBindableProperties.js
  2. 49
      packages/builder/src/components/userInterface/BindingDropdown.svelte
  3. 10
      packages/builder/src/components/userInterface/PropertyControl.svelte
  4. 2144
      packages/builder/yarn.lock
  5. 16
      packages/standard-components/components.json

4
packages/builder/src/builderStore/fetchBindableProperties.js

@ -1,4 +1,4 @@
import { cloneDeep, difference } from "lodash" import { cloneDeep, difference } from "lodash/fp"
/** /**
* parameter for fetchBindableProperties function * parameter for fetchBindableProperties function
@ -23,7 +23,7 @@ import { cloneDeep, difference } from "lodash"
* @param {fetchBindablePropertiesParameter} param * @param {fetchBindablePropertiesParameter} param
* @returns {Array.<BindableProperty>} * @returns {Array.<BindableProperty>}
*/ */
export default function({ componentInstanceId, screen, components, models }) { export default function ({ componentInstanceId, screen, components, models }) {
const walkResult = walk({ const walkResult = walk({
// cloning so we are free to mutate props (e.g. by adding _contexts) // cloning so we are free to mutate props (e.g. by adding _contexts)
instance: cloneDeep(screen.props), instance: cloneDeep(screen.props),

49
packages/builder/src/components/userInterface/BindingDropdown.svelte

@ -0,0 +1,49 @@
<script>
import api from "builderStore/api"
import { store } from "builderStore"
import fetchBindableProperties from "builderStore/fetchBindableProperties"
export let value = "Something is wrong"
async function getBindableProperties() {
const modelResponse = await api.get(`/api/models/`)
const models = await modelResponse.json()
const result = fetchBindableProperties({
componentInstanceId: $store.currentComponentInfo._id,
components: $store.components,
screen: $store.currentPreviewItem,
models: [],
})
console.log("Result: ", result)
}
</script>
<div class="container">{value}</div>
<button on:click={getBindableProperties}>Get stuff!</button>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<style>
ul {
list-style: none;
padding-left: 0;
margin: 0;
padding: var(--spacing-s) 0;
}
li {
display: flex;
font-family: var(--font-sans);
font-size: var(--font-size-xs);
color: var(--ink);
padding: var(--spacing-s) var(--spacing-m);
margin: auto 0px;
align-items: center;
cursor: pointer;
}
</style>

10
packages/builder/src/components/userInterface/PropertyControl.svelte

@ -1,4 +1,6 @@
<script> <script>
import { DropdownMenu } from "@budibase/bbui"
import BindingDropdown from "components/userInterface/BindingDropdown.svelte"
import { onMount, getContext } from "svelte" import { onMount, getContext } from "svelte"
export let label = "" export let label = ""
@ -7,6 +9,8 @@
export let value export let value
export let props = {} export let props = {}
export let onChange = () => {} export let onChange = () => {}
let anchor
let dropdown
function handleChange(key, v) { function handleChange(key, v) {
let innerVal = v let innerVal = v
@ -42,7 +46,13 @@
{...props} {...props}
name={key} /> name={key} />
</div> </div>
<div bind:this={anchor}>
<button on:click={dropdown.show}>Dropdown</button>
</div>
</div> </div>
<DropdownMenu bind:this={dropdown} {anchor} align="right">
<BindingDropdown />
</DropdownMenu>
<style> <style>
.property-control { .property-control {

2144
packages/builder/yarn.lock

File diff suppressed because it is too large

16
packages/standard-components/components.json

@ -92,6 +92,7 @@
}, },
"input": { "input": {
"name": "Input", "name": "Input",
"bindable": "value",
"description": "An HTML input", "description": "An HTML input",
"props": { "props": {
"value": "string", "value": "string",
@ -151,7 +152,10 @@
"children": false, "children": false,
"props": { "props": {
"text": "string", "text": "string",
"type": {"type": "string", "default": "none"} "type": {
"type": "string",
"default": "none"
}
}, },
"tags": [ "tags": [
"div", "div",
@ -371,7 +375,7 @@
"xAxisCustomFormat": "string", "xAxisCustomFormat": "string",
"xAxisFormat": "string", "xAxisFormat": "string",
"xAxisScale": "string", "xAxisScale": "string",
"xAxisValueType":"string", "xAxisValueType": "string",
"yTicks": "number", "yTicks": "number",
"xTicks": "number", "xTicks": "number",
"yAxisBaseline": "string", "yAxisBaseline": "string",
@ -471,7 +475,7 @@
"xAxisLabel": "string" "xAxisLabel": "string"
} }
}, },
"brush":{ "brush": {
"description": "brush chart", "description": "brush chart",
"data": true, "data": true,
"props": { "props": {
@ -511,12 +515,12 @@
"width": "string", "width": "string",
"margin": "string", "margin": "string",
"aspectRatio": "number", "aspectRatio": "number",
"grid":"string", "grid": "string",
"groupLabel": "string", "groupLabel": "string",
"isAnimated": "bool", "isAnimated": "bool",
"isHorizontal": "bool", "isHorizontal": "bool",
"nameLabel": "string", "nameLabel": "string",
"valueLabel":"string", "valueLabel": "string",
"yTicks": "string", "yTicks": "string",
"yTickTextOffset": "string", "yTickTextOffset": "string",
"useLegend": "bool" "useLegend": "bool"
@ -636,7 +640,7 @@
"props": { "props": {
"className": "string", "className": "string",
"text": "string", "text": "string",
"type": { "type": {
"type": "options", "type": "options",
"default": "h1", "default": "h1",
"options": [ "options": [

Loading…
Cancel
Save