initial commit

This commit is contained in:
kevmodrome 2020-08-12 17:30:20 +02:00
parent 9a940c0df5
commit 3b525cf71b
No known key found for this signature in database
GPG Key ID: E8F9CD141E63BF38
5 changed files with 1289 additions and 898 deletions

View File

@ -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),

View File

@ -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>

View File

@ -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 {

File diff suppressed because it is too large Load Diff

View File

@ -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",
@ -313,7 +317,7 @@
"lineGradient": "string", "lineGradient": "string",
"titleText": "string", "titleText": "string",
"valueLabel": "string" "valueLabel": "string"
} }
}, },
"stackedbar": { "stackedbar": {
"description": "Stacked Bar Chart", "description": "Stacked Bar Chart",
@ -342,7 +346,7 @@
"yAxisLabel": "string", "yAxisLabel": "string",
"yAxisLabelOffset": "number", "yAxisLabelOffset": "number",
"useLegend": "bool" "useLegend": "bool"
} }
}, },
"stackarea": { "stackarea": {
"description": "Step Chart", "description": "Step Chart",
@ -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",
@ -389,14 +393,14 @@
"xAxisLabel": "string", "xAxisLabel": "string",
"xAxisLabelOffset": "string", "xAxisLabelOffset": "string",
"yAxisLabel": "string", "yAxisLabel": "string",
"yAxisLabelOffset": "string", "yAxisLabelOffset": "string",
"yTicks": "string" "yTicks": "string"
} }
}, },
"scatterplot": { "scatterplot": {
"description": "Scatterplot Chart", "description": "Scatterplot Chart",
"data": true, "data": true,
"props": { "props": {
"model": "string", "model": "string",
"color": "string", "color": "string",
"height": "number", "height": "number",
@ -412,7 +416,7 @@
"xTicks": "string", "xTicks": "string",
"yAxisFormat": "string", "yAxisFormat": "string",
"yAxisLabel": "string", "yAxisLabel": "string",
"yAxisLabelOffset": "string", "yAxisLabelOffset": "string",
"yTicks": "string" "yTicks": "string"
} }
}, },
@ -471,7 +475,7 @@
"xAxisLabel": "string" "xAxisLabel": "string"
} }
}, },
"brush":{ "brush": {
"description": "brush chart", "description": "brush chart",
"data": true, "data": true,
"props": { "props": {
@ -499,7 +503,7 @@
"useLegend": "bool", "useLegend": "bool",
"yAxisLabel": "string", "yAxisLabel": "string",
"boxSize": "number" "boxSize": "number"
} }
}, },
"groupedbar": { "groupedbar": {
"description": "Groupedbar chart", "description": "Groupedbar chart",
@ -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"
@ -576,12 +580,12 @@
"styleBindingProperty": "font-family", "styleBindingProperty": "font-family",
"options": [ "options": [
"initial", "initial",
"Times New Roman", "Times New Roman",
"Georgia", "Georgia",
"Arial", "Arial",
"Arial Black", "Arial Black",
"Comic Sans MS", "Comic Sans MS",
"Impact", "Impact",
"Lucida Sans Unicode" "Lucida Sans Unicode"
] ]
} }
@ -622,7 +626,7 @@
], ],
"default": "div" "default": "div"
} }
}, },
"container": true, "container": true,
"tags": [ "tags": [
"div", "div",
@ -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": [
@ -665,4 +669,4 @@
"className": "string" "className": "string"
} }
} }
} }