@@ -26,10 +27,12 @@
{:else if type === 'models'}
{:else if type === 'options' || type === 'models'}
diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js
index 17b008028e..5aeb6cf2ec 100644
--- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js
+++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js
@@ -189,6 +189,22 @@ export default {
commonProps: {},
children: [],
},
+ {
+ name: "Chart",
+ _component: "@budibase/standard-components/datachart",
+ description: "Shiny chart",
+ icon: "ri-bar-chart-line",
+ commonProps: {},
+ children: [],
+ },
+ {
+ name: "List",
+ _component: "@budibase/standard-components/datalist",
+ description: "Shiny list",
+ icon: "ri-file-list-line",
+ commonProps: {},
+ children: [],
+ },
],
},
],
diff --git a/packages/client/src/index.js b/packages/client/src/index.js
index 00d3df0682..9c1e95df45 100644
--- a/packages/client/src/index.js
+++ b/packages/client/src/index.js
@@ -29,9 +29,12 @@ export const loadBudibase = async opts => {
// let { appRootPath } = frontendDefinition;
// appRootPath = appRootPath === "" ? "" : "/" + trimSlash(appRootPatl)
- const componentLibraryModules = opts.componentLibraries || {}
+ const componentLibraryModules = opts && opts.componentLibraries || {}
- const libraries = frontendDefinition.libraries || []
+ const libraries = frontendDefinition.libraries || [
+ "@budibase/materialdesign-components",
+ "@budibase/standard-components"
+ ]
for (let library of libraries) {
// fetch the JavaScript for the component libraries from the server
diff --git a/packages/server/src/api/controllers/record.js b/packages/server/src/api/controllers/record.js
index 980fb648f6..313d852a93 100644
--- a/packages/server/src/api/controllers/record.js
+++ b/packages/server/src/api/controllers/record.js
@@ -45,7 +45,10 @@ exports.save = async function(ctx) {
// record: record,
// })
- ctx.body = record
+ ctx.body = {
+ ...record,
+ ...response
+ }
ctx.status = 200
ctx.message = `${model.name} created successfully`
}
diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json
index 80bd42ec21..abc72cad72 100644
--- a/packages/standard-components/components.json
+++ b/packages/standard-components/components.json
@@ -276,6 +276,45 @@
"model": "models"
}
},
+ "datalist": {
+ "description": "A configurable data list that attaches to your backend models.",
+ "data": true,
+ "props": {
+ "model": "models",
+ "layout": {
+ "type": "options",
+ "default": "list",
+ "options": [
+ "list",
+ "grid"
+ ]
+ }
+ }
+ },
+ "datachart": {
+ "description": "shiny chart",
+ "data": true,
+ "props": {
+ "model": "models",
+ "type": {
+ "type": "options",
+ "default": "column2d",
+ "options": [
+ "column3d",
+ "line",
+ "area2d",
+ "bar2d",
+ "bar3d",
+ "pie2d",
+ "pie3d",
+ "doughnut2d",
+ "doughnut3d",
+ "pareto2d",
+ "pareto3d"
+ ]
+ }
+ }
+ },
"link": {
"description": "an HTML anchor
tag",
"props": {
diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json
index a575356d38..5243d546b2 100644
--- a/packages/standard-components/package.json
+++ b/packages/standard-components/package.json
@@ -14,6 +14,7 @@
"devDependencies": {
"@budibase/client": "^0.0.32",
"@nx-js/compiler-util": "^2.0.0",
+ "@rollup/plugin-commonjs": "^11.1.0",
"bcryptjs": "2.4.3",
"fs-extra": "^8.1.0",
"lodash": "^4.17.15",
@@ -34,5 +35,9 @@
],
"version": "0.0.32",
"license": "MIT",
- "gitHead": "b1f4f90927d9e494e513220ef060af28d2d42455"
+ "gitHead": "b1f4f90927d9e494e513220ef060af28d2d42455",
+ "dependencies": {
+ "fusioncharts": "^3.15.1-sr.1",
+ "svelte-fusioncharts": "^1.0.0"
+ }
}
diff --git a/packages/standard-components/rollup.config.js b/packages/standard-components/rollup.config.js
index 5b6b0ee50a..078b107232 100644
--- a/packages/standard-components/rollup.config.js
+++ b/packages/standard-components/rollup.config.js
@@ -1,5 +1,6 @@
import svelte from "rollup-plugin-svelte"
import resolve from "rollup-plugin-node-resolve"
+import commonjs from "@rollup/plugin-commonjs"
export default {
input: "src/index.js",
@@ -15,6 +16,9 @@ export default {
svelte({
hydratable: true,
}),
- resolve(),
+ resolve({
+ browser: true,
+ }),
+ commonjs()
],
}
diff --git a/packages/standard-components/src/DataChart.svelte b/packages/standard-components/src/DataChart.svelte
index 4d403ce725..7ddb3228f5 100644
--- a/packages/standard-components/src/DataChart.svelte
+++ b/packages/standard-components/src/DataChart.svelte
@@ -1,22 +1,38 @@
-
-
-
-
-
-
- {#each headers as header}
- {header} |
- {/each}
-
-
-
- {#each data as row}
-
- {#each headers as header}
- {#if row[header]}
- {row[header]} |
- {/if}
- {/each}
-
- {/each}
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte
index 5121709b5a..1316b51fe8 100644
--- a/packages/standard-components/src/DataForm.svelte
+++ b/packages/standard-components/src/DataForm.svelte
@@ -2,26 +2,73 @@
import { onMount } from "svelte"
export let _bb
- export let _viewName
export let _instanceId
+ export let model
let username
let password
+ let newModel = {
+ modelId: model._id
+ }
+ let store = _bb.store
+
+ $: fields = Object.keys(model.schema)
+
+ async function save() {
+ const SAVE_RECORD_URL = `/api/${_instanceId}/records`
+ const response = await _bb.api.post(SAVE_RECORD_URL, newModel);
+ const json = await response.json();
+
+ store.update(state => {
+ state[model._id] = [
+ ...state[model._id],
+ json
+ ]
+ return state
+ });
+ }
+
+ const handleInput = field => event => {
+ let value
+
+ if (event.target.type === "checkbox") {
+ value = event.target.checked
+ newModel[field] = value
+ return
+ }
+
+ if (event.target.type === "number") {
+ value = parseInt(event.target.value)
+ newModel[field] = value
+ return
+ }
+
+ value = event.target.value
+ newModel[field] = value
+ }
-
diff --git a/packages/standard-components/src/DataList.svelte b/packages/standard-components/src/DataList.svelte
new file mode 100644
index 0000000000..00732917a2
--- /dev/null
+++ b/packages/standard-components/src/DataList.svelte
@@ -0,0 +1,87 @@
+
+
+
+ {#each data as data}
+
+
+ {#each Object.keys(data) as key}
+ -
+
+ {key}:
+
+
+ {data[key]}
+
+
+ {/each}
+
+
+ {/each}
+
+
+
diff --git a/packages/standard-components/src/DataSearch.svelte b/packages/standard-components/src/DataSearch.svelte
new file mode 100644
index 0000000000..3e4f0dec65
--- /dev/null
+++ b/packages/standard-components/src/DataSearch.svelte
@@ -0,0 +1,17 @@
+
+
+
+
+
+
diff --git a/packages/standard-components/src/DataTable.svelte b/packages/standard-components/src/DataTable.svelte
index 375cb932bd..e0139952b4 100644
--- a/packages/standard-components/src/DataTable.svelte
+++ b/packages/standard-components/src/DataTable.svelte
@@ -1,38 +1,38 @@
-
-
-
-
-