From 55207c35caf981b4ba03f6d7c081749554bfb49f Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Mon, 29 Jun 2020 16:32:51 +0100 Subject: [PATCH 1/3] WIP Form Component Design Update Wide form added Boolean button fixed --- .../userInterface/temporaryPanelStructure.js | 51 +++++-- packages/standard-components/components.json | 7 + .../src/DataFormWide.svelte | 142 ++++++++++++++++++ packages/standard-components/src/index.js | 1 + 4 files changed, 189 insertions(+), 12 deletions(-) create mode 100644 packages/standard-components/src/DataFormWide.svelte diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index e2c4044fb6..764daef972 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -321,17 +321,44 @@ export default { name: "Form", description: "A component that generates a form from your data.", icon: "ri-file-edit-fill", - properties: { - design: { ...all }, - settings: [{ label: "Model", key: "model", control: ModelSelect }], - }, - _component: "@budibase/standard-components/dataform", - template: { - component: "@budibase/materialdesign-components/Form", - description: "Form for saving a record", - name: "@budibase/materialdesign-components/recordForm", - }, - children: [], + commonProps: {}, + children: [ + { + _component: "@budibase/standard-components/dataform", + name: "Form Basic", + icon: "ri-file-edit-fill", + properties: { + design: { ...all }, + settings: [ + { + label: "Model", + key: "model", + control: ModelSelect, + }, + ], + }, + template: { + component: "@budibase/materialdesign-components/Form", + description: "Form for saving a record", + name: "@budibase/materialdesign-components/recordForm", + }, + }, + { + _component: "@budibase/standard-components/dataformwide", + name: "Form Wide", + icon: "ri-file-edit-fill", + properties: { + design: { ...all }, + settings: [ + { + label: "Model", + key: "model", + control: ModelSelect, + }, + ], + }, + }, + ], }, { name: "Chart", @@ -431,4 +458,4 @@ export default { ], }, ], -} +} \ No newline at end of file diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index c4c0246672..8df7756499 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -209,6 +209,13 @@ "model": "models" } }, + "dataformwide": { + "description": "an HTML table that fetches data from a model or view and displays it.", + "data": true, + "props": { + "model": "models" + } + }, "datalist": { "description": "A configurable data list that attaches to your backend models.", "data": true, diff --git a/packages/standard-components/src/DataFormWide.svelte b/packages/standard-components/src/DataFormWide.svelte new file mode 100644 index 0000000000..44c7aef4e2 --- /dev/null +++ b/packages/standard-components/src/DataFormWide.svelte @@ -0,0 +1,142 @@ + +
+

{modelDef.name} Form

+
+
+ {#each fields as field} +
+ + +
+
+ {/each} +
+ +
+
+
+ \ No newline at end of file diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index 24342066e8..37d6abab74 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -16,6 +16,7 @@ export { default as icon } from "./Icon.svelte" export { default as Navigation } from "./Navigation.svelte" export { default as datatable } from "./DataTable.svelte" export { default as dataform } from "./DataForm.svelte" +export { default as dataformwide } from "./DataFormWide.svelte" export { default as datachart } from "./DataChart.svelte" export { default as datalist } from "./DataList.svelte" export { default as list } from "./List.svelte" From 5f7186106e4b5d6ca50f63c42fc6c2d7b1f582e4 Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Mon, 29 Jun 2020 19:54:30 +0100 Subject: [PATCH 2/3] Updated the basic form with boolean and select fix --- .../standard-components/src/DataForm.svelte | 70 ++++++++++++++++--- .../src/DataFormWide.svelte | 57 +++++++++++---- 2 files changed, 103 insertions(+), 24 deletions(-) diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte index 1510110ba9..938077371b 100644 --- a/packages/standard-components/src/DataForm.svelte +++ b/packages/standard-components/src/DataForm.svelte @@ -4,6 +4,12 @@ export let _bb export let model + const TYPE_MAP = { + string: "text", + boolean: "checkbox", + number: "number" + } + let username let password let newModel = { @@ -59,15 +65,23 @@

{modelDef.name} Form

+
{#each fields as field}
- + {#if schema[field].type === "string" && schema[field].constraints.inclusion} + + {:else} + + {/if}

{/each} @@ -142,9 +156,45 @@ text-align: center; } - button:hover { - background-color: white; - border-color: #393c44; - color: #393c44; - } + +button:hover { + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); +} + +input[type=checkbox] { + width: 32px; + height: 32px; + padding: 0; + margin: 0; + vertical-align: bottom; + position: relative; + top: -1px; + *overflow: hidden; + +} + +select::-ms-expand { + display: none; +} +select { + display: inline-block; + cursor: pointer; + align-items: baseline; + box-sizing: border-box; + padding: 1em 1em; + border: 1px solid #eaeaea; + border-radius: 5px; + font: inherit; + line-height: inherit; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + background-repeat: no-repeat; + background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); + background-position: right 17px top 1.5em, right 10px top 1.5em; + background-size: 7px 7px, 7px 7px; +} + + diff --git a/packages/standard-components/src/DataFormWide.svelte b/packages/standard-components/src/DataFormWide.svelte index 44c7aef4e2..78cc1f4dc2 100644 --- a/packages/standard-components/src/DataFormWide.svelte +++ b/packages/standard-components/src/DataFormWide.svelte @@ -59,11 +59,18 @@ {#each fields as field}
- + {#if schema[field].type === "string" && schema[field].constraints.inclusion} + + {:else} + + {/if}

{/each} @@ -84,15 +91,12 @@ margin-bottom: 20px; } .input { - height: 40px; border-radius: 5px; border: 1px solid #e6e6e6; - padding: 6px 12px 6px 12px; + padding: 1em; font-size: 16px; } - .input::placeholder { - color: #cccccc; - } + .form-item { display: grid; grid-template-columns: 30% 1fr; @@ -119,7 +123,7 @@ box-sizing: border-box; border-radius: 4px; color: white; - background-color: #393c44; + background-color: black; outline: none; height: 40px; cursor: pointer; @@ -130,13 +134,38 @@ white-space: nowrap; text-align: center; } - button:hover { - box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); - } + +button:hover { + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); +} input[type=checkbox] { transform: scale(2); cursor: pointer; } +select::-ms-expand { + display: none; +} +select { + cursor: pointer; + display: inline-block; + align-items: baseline; + box-sizing: border-box; + padding: 1em 1em; + border: 1px solid #eaeaea; + border-radius: 5px; + font: inherit; + line-height: inherit; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + background-repeat: no-repeat; + background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); + background-position: right 17px top 1.5em, right 10px top 1.5em; + background-size: 7px 7px, 7px 7px; +} + + \ No newline at end of file From 290b1cce1472b49b1c0e7496d561c3d0c87549d9 Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Mon, 29 Jun 2020 19:55:27 +0100 Subject: [PATCH 3/3] Formatting and linting done --- .../userInterface/temporaryPanelStructure.js | 2 +- .../standard-components/src/DataForm.svelte | 82 +++++++++---------- .../src/DataFormWide.svelte | 68 +++++++-------- 3 files changed, 76 insertions(+), 76 deletions(-) diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index 764daef972..ae39ce3ee2 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -458,4 +458,4 @@ export default { ], }, ], -} \ No newline at end of file +} diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte index 938077371b..389ce0ecd2 100644 --- a/packages/standard-components/src/DataForm.svelte +++ b/packages/standard-components/src/DataForm.svelte @@ -7,7 +7,7 @@ const TYPE_MAP = { string: "text", boolean: "checkbox", - number: "number" + number: "number", } let username @@ -70,10 +70,10 @@ {#each fields as field}
- {#if schema[field].type === "string" && schema[field].constraints.inclusion} + {#if schema[field].type === 'string' && schema[field].constraints.inclusion} {:else} @@ -156,45 +156,43 @@ text-align: center; } - -button:hover { - box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); -} - -input[type=checkbox] { - width: 32px; - height: 32px; - padding: 0; - margin: 0; - vertical-align: bottom; - position: relative; - top: -1px; - *overflow: hidden; - -} - -select::-ms-expand { - display: none; -} -select { - display: inline-block; - cursor: pointer; - align-items: baseline; - box-sizing: border-box; - padding: 1em 1em; - border: 1px solid #eaeaea; - border-radius: 5px; - font: inherit; - line-height: inherit; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; - background-repeat: no-repeat; - background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); - background-position: right 17px top 1.5em, right 10px top 1.5em; - background-size: 7px 7px, 7px 7px; -} + button:hover { + box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), + 0 4px 6px -2px rgba(0, 0, 0, 0.05); + } + input[type="checkbox"] { + width: 32px; + height: 32px; + padding: 0; + margin: 0; + vertical-align: bottom; + position: relative; + top: -1px; + *overflow: hidden; + } + select::-ms-expand { + display: none; + } + select { + display: inline-block; + cursor: pointer; + align-items: baseline; + box-sizing: border-box; + padding: 1em 1em; + border: 1px solid #eaeaea; + border-radius: 5px; + font: inherit; + line-height: inherit; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + background-repeat: no-repeat; + background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), + linear-gradient(135deg, currentColor 50%, transparent 50%); + background-position: right 17px top 1.5em, right 10px top 1.5em; + background-size: 7px 7px, 7px 7px; + } diff --git a/packages/standard-components/src/DataFormWide.svelte b/packages/standard-components/src/DataFormWide.svelte index 78cc1f4dc2..f712c787de 100644 --- a/packages/standard-components/src/DataFormWide.svelte +++ b/packages/standard-components/src/DataFormWide.svelte @@ -6,7 +6,7 @@ const TYPE_MAP = { string: "text", boolean: "checkbox", - number: "number" + number: "number", } let username @@ -52,6 +52,7 @@ newModel[field] = value } +

{modelDef.name} Form


@@ -59,10 +60,10 @@ {#each fields as field}
- {#if schema[field].type === "string" && schema[field].constraints.inclusion} + {#if schema[field].type === 'string' && schema[field].constraints.inclusion} {:else} @@ -79,6 +80,7 @@
+ \ No newline at end of file + select::-ms-expand { + display: none; + } + select { + cursor: pointer; + display: inline-block; + align-items: baseline; + box-sizing: border-box; + padding: 1em 1em; + border: 1px solid #eaeaea; + border-radius: 5px; + font: inherit; + line-height: inherit; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + background-repeat: no-repeat; + background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), + linear-gradient(135deg, currentColor 50%, transparent 50%); + background-position: right 17px top 1.5em, right 10px top 1.5em; + background-size: 7px 7px, 7px 7px; + } +