From e7ac33bf435777e02b2807ef365f9d6e68f57943 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 5 Feb 2024 11:59:54 +0000 Subject: [PATCH] Remove legacy concept of currentAsset --- .../actions/ChangeFormStep.svelte | 6 +++--- .../ButtonActionEditor/actions/ClearForm.svelte | 4 ++-- .../actions/DuplicateRow.svelte | 9 +++++++-- .../ButtonActionEditor/actions/ExportData.svelte | 15 ++++++++------- .../actions/RefreshDataProvider.svelte | 4 ++-- .../ButtonActionEditor/actions/S3Upload.svelte | 4 ++-- .../ButtonActionEditor/actions/SaveRow.svelte | 9 +++++++-- .../ButtonActionEditor/actions/ScrollTo.svelte | 6 +++--- .../actions/UpdateFieldValue.svelte | 6 +++--- .../actions/ValidateForm.svelte | 6 +++--- .../controls/ColumnEditor/ColumnEditor.svelte | 6 +++--- .../settings/controls/DataProviderSelect.svelte | 4 ++-- .../DataSourceSelect/DataSourceSelect.svelte | 4 ++-- .../FieldConfiguration/FieldConfiguration.svelte | 6 +++--- .../design/settings/controls/FieldSelect.svelte | 6 +++--- .../controls/FilterEditor/FilterEditor.svelte | 6 +++--- .../settings/controls/FormFieldSelect.svelte | 4 ++-- .../controls/FormStepConfiguration.svelte | 4 ++-- .../GridColumnConfiguration.svelte | 8 ++++---- .../settings/controls/MultiFieldSelect.svelte | 6 +++--- .../controls/RelationshipFilterEditor.svelte | 16 ++++++++-------- .../settings/controls/ResetFieldsButton.svelte | 4 ++-- .../settings/controls/SearchFieldSelect.svelte | 6 +++--- .../settings/controls/SortableFieldSelect.svelte | 6 +++--- .../ValidationEditor/ValidationDrawer.svelte | 9 +++++---- packages/builder/src/dataBinding.js | 8 +++----- .../[screenId]/_components/AppPreview.svelte | 5 ++--- packages/builder/src/stores/builder/index.js | 8 +------- packages/builder/src/stores/builder/screens.js | 2 -- packages/builder/vite.config.js | 4 ++++ 30 files changed, 98 insertions(+), 93 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte index 647ee1f9dd..6e7c5874fc 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/ChangeFormStep.svelte @@ -1,7 +1,7 @@ diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/SaveRow.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/SaveRow.svelte index 7a09e11b52..7513072034 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/SaveRow.svelte +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/SaveRow.svelte @@ -1,6 +1,11 @@ diff --git a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte index a366feb03b..1de5ae6cc6 100644 --- a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte @@ -22,7 +22,7 @@ queries as queriesStore, viewsV2 as viewsV2Store, views as viewsStore, - currentAsset, + selectedScreen, componentStore, datasources, integrations, @@ -76,7 +76,7 @@ ...query, type: "query", })) - $: dataProviders = findAllComponents($currentAsset.props) + $: dataProviders = findAllComponents($selectedScreen.props) .filter(component => { return ( component._component?.endsWith("/dataprovider") && diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte index 9e55e30e46..c6b62543cb 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte @@ -7,7 +7,7 @@ getBindableProperties, getComponentBindableProperties, } from "../../../../../dataBinding" - import { selectedScreen, currentAsset, componentStore } from "stores/builder" + import { selectedScreen, componentStore } from "stores/builder" import DraggableList from "../DraggableList/DraggableList.svelte" import { createEventDispatcher } from "svelte" import FieldSetting from "./FieldSetting.svelte" @@ -44,7 +44,7 @@ $: datasource = componentInstance.dataSource || - getDatasourceForProvider($currentAsset, componentInstance) + getDatasourceForProvider($selectedScreen, componentInstance) $: resourceId = datasource?.resourceId || datasource?.tableId @@ -53,7 +53,7 @@ } const updateState = value => { - schema = getSchema($currentAsset, datasource) + schema = getSchema($selectedScreen, datasource) options = Object.keys(schema || {}) sanitisedValue = getValidColumns(convertOldFieldFormat(value), options) updateSanitsedFields(sanitisedValue) diff --git a/packages/builder/src/components/design/settings/controls/FieldSelect.svelte b/packages/builder/src/components/design/settings/controls/FieldSelect.svelte index e1f63af1af..4921eb74fa 100644 --- a/packages/builder/src/components/design/settings/controls/FieldSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldSelect.svelte @@ -4,7 +4,7 @@ getDatasourceForProvider, getSchemaForDatasource, } from "../../../../dataBinding" - import { currentAsset } from "stores/builder" + import { selectedScreen } from "stores/builder" import { createEventDispatcher } from "svelte" export let componentInstance = {} @@ -12,8 +12,8 @@ export let placeholder const dispatch = createEventDispatcher() - $: datasource = getDatasourceForProvider($currentAsset, componentInstance) - $: schema = getSchemaForDatasource($currentAsset, datasource).schema + $: datasource = getDatasourceForProvider($selectedScreen, componentInstance) + $: schema = getSchemaForDatasource($selectedScreen, datasource).schema $: options = Object.keys(schema || {}) $: boundValue = getValidValue(value, options) diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte index cdcb488834..b8adbd5276 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte @@ -6,7 +6,7 @@ getSchemaForDatasource, } from "../../../../../dataBinding" import FilterDrawer from "./FilterDrawer.svelte" - import { currentAsset } from "stores/builder" + import { selectedScreen } from "stores/builder" const dispatch = createEventDispatcher() @@ -18,8 +18,8 @@ let drawer $: tempValue = value - $: datasource = getDatasourceForProvider($currentAsset, componentInstance) - $: dsSchema = getSchemaForDatasource($currentAsset, datasource)?.schema + $: datasource = getDatasourceForProvider($selectedScreen, componentInstance) + $: dsSchema = getSchemaForDatasource($selectedScreen, datasource)?.schema $: schemaFields = Object.values(schema || dsSchema || {}) $: text = getText(value?.filter(filter => filter.field)) diff --git a/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte b/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte index 3a7f1d73e4..b418cb3111 100644 --- a/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/FormFieldSelect.svelte @@ -1,6 +1,6 @@