From cdb8ff3563214f23cff9b093391732010a3f0fea Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 18 Nov 2020 21:06:12 +0000 Subject: [PATCH] Update all components to be renderable and styleable --- .../AppPreview/iframeTemplate.js | 2 -- packages/client/src/store/routes.js | 2 -- packages/client/src/store/screens.js | 7 ++--- packages/standard-components/src/Card.svelte | 5 +++- .../src/CardHorizontal.svelte | 5 +++- .../standard-components/src/DataForm.svelte | 7 ++--- .../src/DataFormWide.svelte | 5 +--- .../standard-components/src/DatePicker.svelte | 17 ++++++------ packages/standard-components/src/Form.svelte | 5 ++-- packages/standard-components/src/Icon.svelte | 9 ++++++- packages/standard-components/src/Image.svelte | 15 ++++++++--- packages/standard-components/src/Input.svelte | 25 +++++++++--------- .../src/LinkedRowSelector.svelte | 8 +++--- .../standard-components/src/NewRow.svelte | 2 +- .../standard-components/src/RichText.svelte | 18 +++++-------- .../standard-components/src/RowDetail.svelte | 20 +++++--------- .../src/StackedList.svelte | 7 ++++- .../src/attachments/Dropzone.svelte | 5 ++-- .../src/charts/ApexChart.svelte | 8 ++++-- .../src/charts/BarChart.svelte | 19 ++++++-------- .../src/charts/CandleStickChart.svelte | 17 +++++------- .../src/charts/LineChart.svelte | 19 ++++++-------- .../src/charts/PieChart.svelte | 17 +++++------- packages/standard-components/src/index.js | 26 +++++++++---------- 24 files changed, 135 insertions(+), 135 deletions(-) diff --git a/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js b/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js index 47ee1319c8..884b6a5741 100644 --- a/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js +++ b/packages/builder/src/components/userInterface/AppPreview/iframeTemplate.js @@ -44,8 +44,6 @@ export default ` if (selectedComponentStyle) document.head.removeChild(selectedComponentStyle) } catch(_) { } - console.log(data.selectedComponentType) - selectedComponentStyle = document.createElement('style'); document.head.appendChild(selectedComponentStyle) var selectedCss = '[data-bb-id="' + data.selectedComponentType + '-' + data.selectedComponentId + '"]' + '{border:2px solid #0055ff !important;}' diff --git a/packages/client/src/store/routes.js b/packages/client/src/store/routes.js index 4d6279485d..8ec70f36cf 100644 --- a/packages/client/src/store/routes.js +++ b/packages/client/src/store/routes.js @@ -21,8 +21,6 @@ const createRouteStore = () => { }) } const setRouteParams = routeParams => { - console.log("new route params: ") - console.log(routeParams) store.update(state => { state.routeParams = routeParams return state diff --git a/packages/client/src/store/screens.js b/packages/client/src/store/screens.js index 20408c4756..33eac0ab13 100644 --- a/packages/client/src/store/screens.js +++ b/packages/client/src/store/screens.js @@ -4,9 +4,10 @@ import { routeStore } from "./routes" const createScreenStore = () => { const screens = writable([]) const store = derived([screens, routeStore], ([$screens, $routeStore]) => { - const activeScreen = $screens.find( - screen => screen.route === $routeStore.activeRoute - ) + const activeScreen = + $screens.length === 1 + ? $screens[0] + : $screens.find(screen => screen.route === $routeStore.activeRoute) return { screens: $screens, activeScreen, diff --git a/packages/standard-components/src/Card.svelte b/packages/standard-components/src/Card.svelte index 63df22822a..01d14da07c 100644 --- a/packages/standard-components/src/Card.svelte +++ b/packages/standard-components/src/Card.svelte @@ -1,6 +1,9 @@ -
+
{#if showImage}{/if}

{heading}

diff --git a/packages/standard-components/src/CardHorizontal.svelte b/packages/standard-components/src/CardHorizontal.svelte index 33a5677a1c..53292f149e 100644 --- a/packages/standard-components/src/CardHorizontal.svelte +++ b/packages/standard-components/src/CardHorizontal.svelte @@ -1,6 +1,9 @@ -
+
{#if showImage}{/if}
diff --git a/packages/standard-components/src/DataForm.svelte b/packages/standard-components/src/DataForm.svelte index 8e7f9cb50d..9a370e18f8 100644 --- a/packages/standard-components/src/DataForm.svelte +++ b/packages/standard-components/src/DataForm.svelte @@ -1,10 +1,7 @@ -
+ diff --git a/packages/standard-components/src/DataFormWide.svelte b/packages/standard-components/src/DataFormWide.svelte index fd99a8a8ce..0df31ea9ff 100644 --- a/packages/standard-components/src/DataFormWide.svelte +++ b/packages/standard-components/src/DataFormWide.svelte @@ -1,10 +1,7 @@ - + diff --git a/packages/standard-components/src/DatePicker.svelte b/packages/standard-components/src/DatePicker.svelte index 30b07e6d8f..86706f9a52 100644 --- a/packages/standard-components/src/DatePicker.svelte +++ b/packages/standard-components/src/DatePicker.svelte @@ -1,18 +1,19 @@ - +
+ +
diff --git a/packages/standard-components/src/Form.svelte b/packages/standard-components/src/Form.svelte index b3a0166641..6188e7bcb7 100644 --- a/packages/standard-components/src/Form.svelte +++ b/packages/standard-components/src/Form.svelte @@ -8,12 +8,11 @@ const { styleable, screenStore } = getContext("app") const dataProviderStore = getContext("data") - export let table export let wide = false export let styles - $: row = $dataProviderStore.row - $: schema = $dataProviderStore.table && $dataProviderStore.table.schema + $: row = $dataProviderStore?.row + $: schema = $dataProviderStore?.table && $dataProviderStore.table.schema $: fields = schema ? Object.keys(schema) : [] diff --git a/packages/standard-components/src/Icon.svelte b/packages/standard-components/src/Icon.svelte index c877a024dc..fa1b687923 100644 --- a/packages/standard-components/src/Icon.svelte +++ b/packages/standard-components/src/Icon.svelte @@ -1,9 +1,16 @@ - + diff --git a/packages/standard-components/src/Image.svelte b/packages/standard-components/src/Image.svelte index 20a6abca30..1e12165640 100644 --- a/packages/standard-components/src/Image.svelte +++ b/packages/standard-components/src/Image.svelte @@ -1,11 +1,20 @@ -{description} +{description} diff --git a/packages/standard-components/src/Input.svelte b/packages/standard-components/src/Input.svelte index 2900680d6b..d57cde94bb 100644 --- a/packages/standard-components/src/Input.svelte +++ b/packages/standard-components/src/Input.svelte @@ -1,22 +1,21 @@ - - + diff --git a/packages/standard-components/src/LinkedRowSelector.svelte b/packages/standard-components/src/LinkedRowSelector.svelte index 954457c018..9b0089ea5e 100644 --- a/packages/standard-components/src/LinkedRowSelector.svelte +++ b/packages/standard-components/src/LinkedRowSelector.svelte @@ -1,7 +1,9 @@ diff --git a/packages/standard-components/src/RichText.svelte b/packages/standard-components/src/RichText.svelte index af0c190578..c6a7cdd199 100644 --- a/packages/standard-components/src/RichText.svelte +++ b/packages/standard-components/src/RichText.svelte @@ -1,20 +1,12 @@ - +
+ +
diff --git a/packages/standard-components/src/RowDetail.svelte b/packages/standard-components/src/RowDetail.svelte index 2e0eea6712..4299f2039e 100644 --- a/packages/standard-components/src/RowDetail.svelte +++ b/packages/standard-components/src/RowDetail.svelte @@ -1,23 +1,16 @@ -
+
{#if showImage} diff --git a/packages/standard-components/src/attachments/Dropzone.svelte b/packages/standard-components/src/attachments/Dropzone.svelte index 7227b1a528..04fb1fcfdf 100644 --- a/packages/standard-components/src/attachments/Dropzone.svelte +++ b/packages/standard-components/src/attachments/Dropzone.svelte @@ -1,7 +1,8 @@ diff --git a/packages/standard-components/src/charts/ApexChart.svelte b/packages/standard-components/src/charts/ApexChart.svelte index 5bf319e7ea..d1886325c6 100644 --- a/packages/standard-components/src/charts/ApexChart.svelte +++ b/packages/standard-components/src/charts/ApexChart.svelte @@ -1,13 +1,17 @@ {#if options} -
+
{:else if options === false} -
Invalid chart options
+
Invalid chart options
{/if}