Merge pull request #12969 from Budibase/monolith-cheeks-tweaks
Monolith cheeks tweaks
This commit is contained in:
commit
f35230d46e
101 changed files with 381 additions and 459 deletions
|
@ -23,7 +23,6 @@
|
|||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/fileMock.js",
|
||||
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
|
||||
"components(.*)$": "<rootDir>/src/components$1",
|
||||
"builder(.*)$": "<rootDir>/src/builder$1",
|
||||
"stores(.*)$": "<rootDir>/src/stores$1",
|
||||
"analytics(.*)$": "<rootDir>/src/analytics$1",
|
||||
"constants/backend": "<rootDir>/src/constants/backend/index.js"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
import { admin, licensing } from "stores/portal"
|
||||
import { externalActions } from "./ExternalActions"
|
||||
import { TriggerStepID, ActionStepID } from "constants/backend/automations"
|
||||
import { checkForCollectStep } from "builder/utils"
|
||||
import { checkForCollectStep } from "helpers/utils"
|
||||
|
||||
export let blockIdx
|
||||
export let lastStep
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
import {
|
||||
getSchemaForDatasourcePlus,
|
||||
getEnvironmentBindings,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { TriggerStepID, ActionStepID } from "constants/backend/automations"
|
||||
import { onMount } from "svelte"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
PrettyRelationshipDefinitions,
|
||||
DB_TYPE_EXTERNAL,
|
||||
} from "constants/backend"
|
||||
import { getAutoColumnInformation, buildAutoColumn } from "builder/utils"
|
||||
import { getAutoColumnInformation, buildAutoColumn } from "helpers/utils"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte"
|
||||
import { getBindings } from "components/backend/DataTable/formula"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
} from "@budibase/bbui"
|
||||
import { onMount, createEventDispatcher } from "svelte"
|
||||
import { FIELDS } from "constants/backend"
|
||||
import { generate } from "builder/schemaGenerator"
|
||||
import { generate } from "helpers/schemaGenerator"
|
||||
|
||||
export let schema = {}
|
||||
export let json
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
views,
|
||||
viewsV2,
|
||||
userSelectedResourceMap,
|
||||
database,
|
||||
} from "stores/builder"
|
||||
import EditDatasourcePopover from "./popovers/EditDatasourcePopover.svelte"
|
||||
import EditQueryPopover from "./popovers/EditQueryPopover.svelte"
|
||||
|
@ -75,7 +74,6 @@
|
|||
searchTerm && !showAppUsersTable && !enrichedDataSources.find(ds => ds.show)
|
||||
</script>
|
||||
|
||||
{#if $database?._id}
|
||||
<div class="hierarchy-items-container">
|
||||
{#if showAppUsersTable}
|
||||
<NavItem
|
||||
|
@ -137,7 +135,6 @@
|
|||
</Layout>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.hierarchy-items-container {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
views,
|
||||
viewsV2,
|
||||
userSelectedResourceMap,
|
||||
database,
|
||||
} from "stores/builder"
|
||||
import { TableNames } from "constants"
|
||||
import EditTablePopover from "./popovers/EditTablePopover.svelte"
|
||||
|
@ -29,7 +28,6 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{#if $database?._id}
|
||||
<div class="hierarchy-items-container">
|
||||
{#each sortedTables as table, idx}
|
||||
<NavItem
|
||||
|
@ -67,4 +65,3 @@
|
|||
{/each}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { tables } from "stores/builder"
|
||||
import { API } from "api"
|
||||
import { Select, Label, Multiselect } from "@budibase/bbui"
|
||||
import { capitalise } from "../../helpers"
|
||||
import { capitalise } from "helpers"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let schema
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
import { admin } from "stores/portal"
|
||||
import CodeEditor from "../CodeEditor/CodeEditor.svelte"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||
import { createEventDispatcher, setContext } from "svelte"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||
import { createEventDispatcher, setContext } from "svelte"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||
import { createEventDispatcher, setContext } from "svelte"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<script>
|
||||
import { Layout, Input } from "@budibase/bbui"
|
||||
import {
|
||||
createValidationStore,
|
||||
requiredValidator,
|
||||
} from "../../../helpers/validation"
|
||||
import { createValidationStore, requiredValidator } from "helpers/validation"
|
||||
|
||||
export let password
|
||||
export let error
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { ModalContent, Input } from "@budibase/bbui"
|
||||
import sanitizeUrl from "builder/store/screenTemplates/utils/sanitizeUrl"
|
||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||
import { get } from "svelte/store"
|
||||
import { screenStore } from "stores/builder"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
getActionBindings,
|
||||
makeStateBinding,
|
||||
updateReferencesInObject,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
|
||||
const flipDurationMs = 150
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "builder/dataBinding"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "dataBinding"
|
||||
import { onMount } from "svelte"
|
||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
|||
export let nested
|
||||
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"ChangeFormStep",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "builder/dataBinding"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "dataBinding"
|
||||
|
||||
export let parameters
|
||||
export let nested
|
||||
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"ClearForm",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<script>
|
||||
import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore, tables, viewsV2 } from "stores/builder"
|
||||
import { getSchemaForDatasourcePlus } from "builder/dataBinding"
|
||||
import {
|
||||
selectedScreen,
|
||||
componentStore,
|
||||
tables,
|
||||
viewsV2,
|
||||
} from "stores/builder"
|
||||
import { getSchemaForDatasourcePlus } from "dataBinding"
|
||||
import SaveFields from "./SaveFields.svelte"
|
||||
import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils"
|
||||
|
||||
|
@ -10,7 +15,7 @@
|
|||
export let nested
|
||||
|
||||
$: providerOptions = getDatasourceLikeProviders({
|
||||
asset: $currentAsset,
|
||||
asset: $selectedScreen,
|
||||
componentId: $componentStore.selectedComponentId,
|
||||
nested,
|
||||
})
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
<script>
|
||||
import { Label, Select, Body, Multiselect } from "@budibase/bbui"
|
||||
import {
|
||||
findAllMatchingComponents,
|
||||
findComponent,
|
||||
} from "stores/builder/components/utils"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { findAllMatchingComponents, findComponent } from "helpers/components"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { onMount } from "svelte"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
|
||||
export let parameters
|
||||
|
||||
|
@ -24,14 +18,15 @@
|
|||
},
|
||||
]
|
||||
|
||||
$: tables = findAllMatchingComponents($currentAsset?.props, component =>
|
||||
$: tables = findAllMatchingComponents($selectedScreen?.props, component =>
|
||||
component._component.endsWith("table")
|
||||
).map(table => ({
|
||||
label: table._instanceName,
|
||||
value: table._id,
|
||||
}))
|
||||
$: tableBlocks = findAllMatchingComponents($currentAsset?.props, component =>
|
||||
component._component.endsWith("tableblock")
|
||||
$: tableBlocks = findAllMatchingComponents(
|
||||
$selectedScreen?.props,
|
||||
component => component._component.endsWith("tableblock")
|
||||
).map(block => ({
|
||||
label: block._instanceName,
|
||||
value: `${block._id}-table`,
|
||||
|
@ -44,9 +39,9 @@
|
|||
if (tableId?.includes("-")) {
|
||||
tableId = tableId.split("-")[0]
|
||||
}
|
||||
const selectedTable = findComponent($currentAsset?.props, tableId)
|
||||
const datasource = getDatasourceForProvider($currentAsset, selectedTable)
|
||||
const { schema } = getSchemaForDatasource($currentAsset, datasource)
|
||||
const selectedTable = findComponent($selectedScreen?.props, tableId)
|
||||
const datasource = getDatasourceForProvider($selectedScreen, selectedTable)
|
||||
const { schema } = getSchemaForDatasource($selectedScreen, datasource)
|
||||
return Object.keys(schema || {})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { findAllMatchingComponents } from "stores/builder/components/utils"
|
||||
import { findAllMatchingComponents } from "helpers/components"
|
||||
|
||||
export let parameters
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "builder/dataBinding"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "dataBinding"
|
||||
|
||||
export let parameters
|
||||
export let nested
|
||||
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"RefreshDatasource",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { findAllMatchingComponents } from "stores/builder/components/utils"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { findAllMatchingComponents } from "helpers/components"
|
||||
|
||||
export let parameters
|
||||
|
||||
$: components = findAllMatchingComponents($currentAsset?.props, component =>
|
||||
$: components = findAllMatchingComponents($selectedScreen?.props, component =>
|
||||
component._component.endsWith("s3upload")
|
||||
)
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<script>
|
||||
import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore, tables, viewsV2 } from "stores/builder"
|
||||
import { getSchemaForDatasourcePlus } from "builder/dataBinding"
|
||||
import {
|
||||
selectedScreen,
|
||||
componentStore,
|
||||
tables,
|
||||
viewsV2,
|
||||
} from "stores/builder"
|
||||
import { getSchemaForDatasourcePlus } from "dataBinding"
|
||||
import SaveFields from "./SaveFields.svelte"
|
||||
import { getDatasourceLikeProviders } from "components/design/settings/controls/ButtonActionEditor/actions/utils"
|
||||
|
||||
|
@ -10,7 +15,7 @@
|
|||
export let nested
|
||||
|
||||
$: providerOptions = getDatasourceLikeProviders({
|
||||
asset: $currentAsset,
|
||||
asset: $selectedScreen,
|
||||
componentId: $componentStore.selectedComponentId,
|
||||
nested,
|
||||
})
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<script>
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { Label, Combobox, Select } from "@budibase/bbui"
|
||||
import { getActionProviders, buildFormSchema } from "builder/dataBinding"
|
||||
import { findComponent } from "stores/builder/components/utils"
|
||||
import { getActionProviders, buildFormSchema } from "dataBinding"
|
||||
import { findComponent } from "helpers/components"
|
||||
|
||||
export let parameters
|
||||
export let nested
|
||||
|
||||
$: formComponent = getFormComponent(
|
||||
$currentAsset.props,
|
||||
$selectedScreen.props,
|
||||
parameters.componentId
|
||||
)
|
||||
$: formSchema = buildFormSchema(formComponent)
|
||||
$: fieldOptions = Object.keys(formSchema || {})
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"ScrollTo",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
import { Select, Label, Combobox } from "@budibase/bbui"
|
||||
import { onMount } from "svelte"
|
||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getActionProviders, buildFormSchema } from "builder/dataBinding"
|
||||
import { findComponent } from "stores/builder/components/utils"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { getActionProviders, buildFormSchema } from "dataBinding"
|
||||
import { findComponent } from "helpers/components"
|
||||
|
||||
export let parameters
|
||||
export let bindings = []
|
||||
|
@ -22,13 +22,13 @@
|
|||
]
|
||||
|
||||
$: formComponent = getFormComponent(
|
||||
$currentAsset.props,
|
||||
$selectedScreen.props,
|
||||
parameters.componentId
|
||||
)
|
||||
$: formSchema = buildFormSchema(formComponent)
|
||||
$: fieldOptions = Object.keys(formSchema || {})
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"ValidateForm",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { Select, Label, Combobox, Checkbox, Body } from "@budibase/bbui"
|
||||
import { onMount } from "svelte"
|
||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
import { getAllStateVariables } from "builder/dataBinding"
|
||||
import { getAllStateVariables } from "dataBinding"
|
||||
|
||||
export let parameters
|
||||
export let bindings = []
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<script>
|
||||
import { Select, Label } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "builder/dataBinding"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { getActionProviders } from "dataBinding"
|
||||
|
||||
export let parameters
|
||||
export let nested
|
||||
|
||||
$: actionProviders = getActionProviders(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
$componentStore.selectedComponentId,
|
||||
"ValidateForm",
|
||||
{ includeSelf: nested }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getComponentContexts } from "builder/dataBinding"
|
||||
import { getComponentContexts } from "dataBinding"
|
||||
import { capitalise } from "helpers"
|
||||
|
||||
// Generates bindings for all components that provider "datasource like"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { createEventDispatcher } from "svelte"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import { componentStore } from "stores/builder"
|
||||
import { getEventContextBindings } from "builder/dataBinding"
|
||||
import { getEventContextBindings } from "dataBinding"
|
||||
import { cloneDeep, isEqual } from "lodash/fp"
|
||||
|
||||
export let componentInstance
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import EditComponentPopover from "../EditComponentPopover.svelte"
|
||||
import { Icon } from "@budibase/bbui"
|
||||
import { runtimeToReadableBinding } from "builder/dataBinding"
|
||||
import { runtimeToReadableBinding } from "dataBinding"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
|
||||
export let item
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
import { createEventDispatcher } from "svelte"
|
||||
import ColumnDrawer from "./ColumnDrawer.svelte"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { getFields } from "helpers/searchFields"
|
||||
|
||||
export let componentInstance
|
||||
|
@ -21,8 +18,8 @@
|
|||
let boundValue
|
||||
|
||||
$: text = getText(value)
|
||||
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
||||
$: schema = getSchema($currentAsset, datasource)
|
||||
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
|
||||
$: schema = getSchema($selectedScreen, datasource)
|
||||
$: options = allowCellEditing
|
||||
? Object.keys(schema || {})
|
||||
: enrichedSchemaFields?.map(field => field.name)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<script>
|
||||
import { Select } from "@budibase/bbui"
|
||||
import { makePropSafe } from "@budibase/string-templates"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { findAllMatchingComponents } from "stores/builder/components/utils"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { findAllMatchingComponents } from "helpers/components"
|
||||
|
||||
export let value
|
||||
|
||||
const getValue = component => `{{ literal ${makePropSafe(component._id)} }}`
|
||||
|
||||
$: providers = findAllMatchingComponents($currentAsset?.props, c =>
|
||||
$: providers = findAllMatchingComponents($selectedScreen?.props, c =>
|
||||
c._component?.endsWith("/dataprovider")
|
||||
)
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import {
|
||||
Button,
|
||||
Popover,
|
||||
|
@ -22,7 +22,7 @@
|
|||
queries as queriesStore,
|
||||
viewsV2 as viewsV2Store,
|
||||
views as viewsStore,
|
||||
currentAsset,
|
||||
selectedScreen,
|
||||
componentStore,
|
||||
datasources,
|
||||
integrations,
|
||||
|
@ -30,7 +30,7 @@
|
|||
import BindingBuilder from "components/integration/QueryBindingBuilder.svelte"
|
||||
import IntegrationQueryEditor from "components/integration/index.svelte"
|
||||
import { makePropSafe as safe } from "@budibase/string-templates"
|
||||
import { findAllComponents } from "stores/builder/components/utils"
|
||||
import { findAllComponents } from "helpers/components"
|
||||
import ClientBindingPanel from "components/common/bindings/ClientBindingPanel.svelte"
|
||||
import DataSourceCategory from "components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte"
|
||||
import { API } from "api"
|
||||
|
@ -76,7 +76,7 @@
|
|||
...query,
|
||||
type: "query",
|
||||
}))
|
||||
$: dataProviders = findAllComponents($currentAsset.props)
|
||||
$: dataProviders = findAllComponents($selectedScreen.props)
|
||||
.filter(component => {
|
||||
return (
|
||||
component._component?.endsWith("/dataprovider") &&
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { componentStore } from "stores/builder"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import { createEventDispatcher, getContext } from "svelte"
|
||||
import ComponentSettingsSection from "../../../../pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte"
|
||||
import ComponentSettingsSection from "pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte"
|
||||
|
||||
export let anchor
|
||||
export let componentInstance
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
getSchemaForDatasource,
|
||||
getBindableProperties,
|
||||
getComponentBindableProperties,
|
||||
} from "builder/dataBinding"
|
||||
import { selectedScreen, currentAsset, componentStore } from "stores/builder"
|
||||
} from "dataBinding"
|
||||
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)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import { Toggle, Icon } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import { runtimeToReadableBinding } from "builder/dataBinding"
|
||||
import { runtimeToReadableBinding } from "dataBinding"
|
||||
import { isJSBinding } from "@budibase/string-templates"
|
||||
import { componentStore } from "stores/builder"
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<script>
|
||||
import { Select } from "@budibase/bbui"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let componentInstance = {}
|
||||
|
@ -12,8 +9,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)
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<script>
|
||||
import { notifications, ActionButton, Button, Drawer } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import FilterDrawer from "./FilterDrawer.svelte"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -18,8 +15,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))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { Combobox } from "@budibase/bbui"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { getComponentFieldOptions } from "helpers/formFields"
|
||||
|
||||
export let componentInstance
|
||||
|
@ -8,7 +8,7 @@
|
|||
export let type
|
||||
|
||||
$: options = getComponentFieldOptions(
|
||||
$currentAsset?.props,
|
||||
$selectedScreen?.props,
|
||||
componentInstance?._id,
|
||||
type
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script>
|
||||
import { createEventDispatcher, setContext } from "svelte"
|
||||
import ComponentSettingsSection from "../../../../pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte"
|
||||
import { getDatasourceForProvider } from "builder/dataBinding"
|
||||
import { currentAsset, componentStore, previewStore } from "stores/builder"
|
||||
import ComponentSettingsSection from "pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte"
|
||||
import { getDatasourceForProvider } from "dataBinding"
|
||||
import { selectedScreen, componentStore, previewStore } from "stores/builder"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import { derived, writable } from "svelte/store"
|
||||
import { Utils } from "@budibase/frontend-core"
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
$: stepCount = cachedValue?.length || 0
|
||||
$: updateStore(stepCount)
|
||||
$: dataSource = getDatasourceForProvider($currentAsset, cachedInstance)
|
||||
$: dataSource = getDatasourceForProvider($selectedScreen, cachedInstance)
|
||||
$: emitCurrentStep($currentStep)
|
||||
$: stepLabel = getStepLabel($multiStepStore)
|
||||
$: stepDef = getDefinition(stepLabel)
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<script>
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import DraggableList from "../DraggableList/DraggableList.svelte"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import FieldSetting from "./FieldSetting.svelte"
|
||||
|
@ -32,12 +29,12 @@
|
|||
return schema
|
||||
}
|
||||
|
||||
$: datasource = getDatasourceForProvider($currentAsset, componentInstance)
|
||||
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
|
||||
$: primaryDisplayColumnName = getSchemaForDatasource(
|
||||
$currentAsset,
|
||||
$selectedScreen,
|
||||
datasource
|
||||
)?.table?.primaryDisplay
|
||||
$: schema = getSchema(currentAsset, datasource)
|
||||
$: schema = getSchema(selectedScreen, datasource)
|
||||
$: columns = getColumns({
|
||||
columns: value,
|
||||
schema,
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<script>
|
||||
import { Multiselect } from "@budibase/bbui"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let componentInstance = {}
|
||||
|
@ -12,8 +9,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 = getValidOptions(value, options)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { builderStore } from "stores/builder"
|
||||
import { onDestroy } from "svelte"
|
||||
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
import {
|
||||
findClosestMatchingComponent,
|
||||
findComponent,
|
||||
} from "stores/builder/components/utils"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { tables, currentAsset, componentStore } from "stores/builder"
|
||||
} from "helpers/components"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { tables, selectedScreen, componentStore } from "stores/builder"
|
||||
import FilterEditor from "./FilterEditor/FilterEditor.svelte"
|
||||
|
||||
export let componentInstance
|
||||
|
@ -17,29 +14,29 @@
|
|||
|
||||
// Find the closest parent form
|
||||
$: form = findClosestMatchingComponent(
|
||||
$currentAsset.props,
|
||||
$selectedScreen.props,
|
||||
componentInstance._id,
|
||||
component => component._component.endsWith("/form")
|
||||
)
|
||||
|
||||
const resolveDatasource = (currentAsset, componentInstance, form) => {
|
||||
const resolveDatasource = (selectedScreen, componentInstance, form) => {
|
||||
if (!form && componentInstance._id != $componentStore.selectedComponentId) {
|
||||
const block = findComponent(
|
||||
currentAsset.props,
|
||||
selectedScreen.props,
|
||||
$componentStore.selectedComponentId
|
||||
)
|
||||
const def = componentStore.getDefinition(block._component)
|
||||
return def?.block === true
|
||||
? getDatasourceForProvider(currentAsset, block)
|
||||
? getDatasourceForProvider(selectedScreen, block)
|
||||
: {}
|
||||
} else {
|
||||
return getDatasourceForProvider(currentAsset, form)
|
||||
return getDatasourceForProvider(selectedScreen, form)
|
||||
}
|
||||
}
|
||||
|
||||
// Get that form's schema
|
||||
$: datasource = resolveDatasource($currentAsset, componentInstance, form)
|
||||
$: formSchema = getSchemaForDatasource($currentAsset, datasource)?.schema
|
||||
$: datasource = resolveDatasource($selectedScreen, componentInstance, form)
|
||||
$: formSchema = getSchemaForDatasource($selectedScreen, datasource)?.schema
|
||||
|
||||
// Get the schema for the relationship field that this picker is using
|
||||
$: columnSchema = formSchema?.[column]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script>
|
||||
import { ActionButton, notifications } from "@budibase/bbui"
|
||||
import { currentAsset, componentStore } from "stores/builder"
|
||||
import { findClosestMatchingComponent } from "stores/builder/components/utils"
|
||||
import { makeDatasourceFormComponents } from "builder/store/screenTemplates/utils/commonComponents"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
import { findClosestMatchingComponent } from "helpers/components"
|
||||
import { makeDatasourceFormComponents } from "templates/commonComponents"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
|
||||
export let componentInstance
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
const resetFormFields = async () => {
|
||||
const form = findClosestMatchingComponent(
|
||||
$currentAsset?.props,
|
||||
$selectedScreen?.props,
|
||||
componentInstance._id,
|
||||
component => component._component.endsWith("/form")
|
||||
)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<script>
|
||||
import { Multiselect } from "@budibase/bbui"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset, tables } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen, tables } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { getFields } from "helpers/searchFields"
|
||||
|
||||
|
@ -13,8 +10,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 = getOptions(datasource, schema || {})
|
||||
$: boundValue = getSelectedOption(value, options)
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<script>
|
||||
import { Select } from "@budibase/bbui"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { currentAsset } from "stores/builder"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { canBeSortColumn } from "@budibase/shared-core"
|
||||
|
||||
|
@ -13,8 +10,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 = getSortableFields(schema)
|
||||
$: boundValue = getValidValue(value, options)
|
||||
|
||||
|
|
|
@ -10,12 +10,9 @@
|
|||
Input,
|
||||
DatePicker,
|
||||
} from "@budibase/bbui"
|
||||
import { currentAsset, selectedComponent } from "stores/builder"
|
||||
import { findClosestMatchingComponent } from "stores/builder/components/utils"
|
||||
import {
|
||||
getSchemaForDatasource,
|
||||
getDatasourceForProvider,
|
||||
} from "builder/dataBinding"
|
||||
import { selectedScreen, selectedComponent } from "stores/builder"
|
||||
import { findClosestMatchingComponent } from "helpers/components"
|
||||
import { getSchemaForDatasource, getDatasourceForProvider } from "dataBinding"
|
||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
import { generate } from "shortid"
|
||||
|
||||
|
@ -127,13 +124,14 @@
|
|||
],
|
||||
}
|
||||
|
||||
const resolveDatasource = (currentAsset, componentInstance, parent) => {
|
||||
const resolveDatasource = (selectedScreen, componentInstance, parent) => {
|
||||
return (
|
||||
getDatasourceForProvider(currentAsset, parent || componentInstance) || {}
|
||||
getDatasourceForProvider(selectedScreen, parent || componentInstance) ||
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
$: dataSourceSchema = getDataSourceSchema($currentAsset, $selectedComponent)
|
||||
$: dataSourceSchema = getDataSourceSchema($selectedScreen, $selectedComponent)
|
||||
$: field = fieldName || $selectedComponent?.field
|
||||
$: schemaRules = parseRulesFromSchema(field, dataSourceSchema || {})
|
||||
$: fieldType = type?.split("/")[1] || "string"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import {
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
|
||||
import { getUserBindings } from "builder/dataBinding"
|
||||
import { getUserBindings } from "dataBinding"
|
||||
|
||||
export let queryBindings = []
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
runtimeToReadableBinding,
|
||||
runtimeToReadableMap,
|
||||
toBindingsArray,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
export let queryId
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { Body, ProgressBar, Heading, Icon, Link } from "@budibase/bbui"
|
||||
import { admin, auth } from "../../stores/portal"
|
||||
import { admin, auth } from "stores/portal"
|
||||
import { onMount } from "svelte"
|
||||
|
||||
export let usage
|
||||
|
|
|
@ -5,9 +5,8 @@ import {
|
|||
findAllMatchingComponents,
|
||||
findComponent,
|
||||
findComponentPath,
|
||||
} from "stores/builder/components/utils"
|
||||
} from "helpers/components"
|
||||
import {
|
||||
currentAsset,
|
||||
componentStore,
|
||||
screenStore,
|
||||
appStore,
|
||||
|
@ -15,6 +14,7 @@ import {
|
|||
queries as queriesStores,
|
||||
tables as tablesStore,
|
||||
roles as rolesStore,
|
||||
selectedScreen,
|
||||
} from "stores/builder"
|
||||
import {
|
||||
makePropSafe,
|
||||
|
@ -22,7 +22,7 @@ import {
|
|||
decodeJSBinding,
|
||||
encodeJSBinding,
|
||||
} from "@budibase/string-templates"
|
||||
import { TableNames } from "../constants"
|
||||
import { TableNames } from "constants"
|
||||
import { JSONUtils } from "@budibase/frontend-core"
|
||||
import ActionDefinitions from "components/design/settings/controls/ButtonActionEditor/manifest.json"
|
||||
import { environment, licensing } from "stores/portal"
|
||||
|
@ -731,13 +731,11 @@ export const getEventContextBindings = ({
|
|||
asset,
|
||||
}) => {
|
||||
let bindings = []
|
||||
|
||||
const selectedAsset = asset ?? get(currentAsset)
|
||||
asset = asset ?? get(selectedScreen)
|
||||
|
||||
// Check if any context bindings are provided by the component for this
|
||||
// setting
|
||||
const component =
|
||||
componentInstance ?? findComponent(selectedAsset.props, componentId)
|
||||
const component = componentInstance ?? findComponent(asset.props, componentId)
|
||||
|
||||
if (!component) {
|
||||
return bindings
|
|
@ -3,7 +3,7 @@ import {
|
|||
runtimeToReadableBinding,
|
||||
readableToRuntimeBinding,
|
||||
updateReferencesInObject,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
describe("Builder dataBinding", () => {
|
||||
beforeEach(() => {
|
|
@ -6,7 +6,7 @@ import {
|
|||
encodeJSBinding,
|
||||
findHBSBlocks,
|
||||
} from "@budibase/string-templates"
|
||||
import { capitalise } from "helpers"
|
||||
import { capitalise } from "./index"
|
||||
|
||||
/**
|
||||
* Recursively searches for a specific component ID
|
|
@ -1,8 +1,5 @@
|
|||
import { findClosestMatchingComponent } from "stores/builder/components/utils"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "builder/dataBinding"
|
||||
import { findClosestMatchingComponent } from "helpers/components"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
|
||||
export const getComponentFieldOptions = (asset, id, type, loose = true) => {
|
||||
const form = findClosestMatchingComponent(
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { ActionStepID } from "constants/backend/automations"
|
||||
import { TableNames } from "../constants"
|
||||
import { TableNames } from "constants"
|
||||
import {
|
||||
AUTO_COLUMN_DISPLAY_NAMES,
|
||||
AUTO_COLUMN_SUB_TYPES,
|
||||
FIELDS,
|
||||
isAutoColumnUserRelationship,
|
||||
} from "../constants/backend"
|
||||
} from "constants/backend"
|
||||
|
||||
export function getAutoColumnInformation(enabled = true) {
|
||||
let info = {}
|
|
@ -12,7 +12,7 @@
|
|||
} from "@budibase/bbui"
|
||||
import { AUTH_TYPE_LABELS, AUTH_TYPES } from "./authTypes"
|
||||
import BindableCombobox from "components/common/bindings/BindableCombobox.svelte"
|
||||
import { getAuthBindings, getEnvironmentBindings } from "builder/dataBinding"
|
||||
import { getAuthBindings, getEnvironmentBindings } from "dataBinding"
|
||||
import { environment, licensing, auth } from "stores/portal"
|
||||
import CreateEditVariableModal from "components/portal/environment/CreateEditVariableModal.svelte"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
getRestBindings,
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableMap,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import SaveDatasourceButton from "./SaveDatasourceButton.svelte"
|
||||
import Panel from "./Panel.svelte"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { Heading, Layout } from "@budibase/bbui"
|
||||
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
|
||||
import ViewDynamicVariables from "./ViewDynamicVariables.svelte"
|
||||
import { getEnvironmentBindings } from "builder/dataBinding"
|
||||
import { getEnvironmentBindings } from "dataBinding"
|
||||
import { licensing } from "stores/portal"
|
||||
import { queries } from "stores/builder"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { queries, datasources, database } from "stores/builder"
|
||||
import { queries, datasources } from "stores/builder"
|
||||
import QueryViewer from "components/integration/QueryViewer.svelte"
|
||||
import RestQueryViewer from "components/integration/RestQueryViewer.svelte"
|
||||
import { IntegrationTypes } from "constants/backend"
|
||||
|
@ -11,7 +11,7 @@
|
|||
$: isRestQuery = datasource?.source === IntegrationTypes.REST
|
||||
</script>
|
||||
|
||||
{#if $database._id && query}
|
||||
{#if query}
|
||||
{#if isRestQuery}
|
||||
<RestQueryViewer queryId={$queries.selectedQueryId} />
|
||||
{:else}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QueryViewer from "components/integration/QueryViewer.svelte"
|
||||
import RestQueryViewer from "components/integration/RestQueryViewer.svelte"
|
||||
import { IntegrationTypes } from "constants/backend"
|
||||
import { database, datasources } from "stores/builder"
|
||||
import { datasources } from "stores/builder"
|
||||
|
||||
$: datasource = $datasources.list.find(ds => ds._id === $params.datasourceId)
|
||||
$: {
|
||||
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
{#if $database._id && datasource && query}
|
||||
{#if datasource && query}
|
||||
{#if isRestQuery}
|
||||
<RestQueryViewer />
|
||||
{:else}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import TableDataTable from "components/backend/DataTable/TableDataTable.svelte"
|
||||
import { tables, database } from "stores/builder"
|
||||
import { tables } from "stores/builder"
|
||||
import { Banner } from "@budibase/bbui"
|
||||
|
||||
const verifyAutocolumns = table => {
|
||||
|
@ -30,7 +30,7 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
{#if $database?._id && $tables?.selected?.name}
|
||||
{#if $tables?.selected?.name}
|
||||
{#if duplicates?.length}
|
||||
<div class="alert-wrap">
|
||||
<Banner type="warning" showCloseButton={false}>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<script>
|
||||
import ViewDataTable from "components/backend/DataTable/ViewDataTable.svelte"
|
||||
import { views, database } from "stores/builder"
|
||||
import { views } from "stores/builder"
|
||||
|
||||
$: selectedView = $views.selected
|
||||
</script>
|
||||
|
||||
{#if $database._id && selectedView}
|
||||
{#if selectedView}
|
||||
<ViewDataTable view={selectedView} />
|
||||
{:else}<i>Create your first table to start building</i>{/if}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
import DesignSection from "./DesignSection.svelte"
|
||||
import CustomStylesSection from "./CustomStylesSection.svelte"
|
||||
import ConditionalUISection from "./ConditionalUISection.svelte"
|
||||
import { getComponentName } from "stores/builder/components/utils"
|
||||
import { getComponentName } from "helpers/components"
|
||||
import {
|
||||
getBindableProperties,
|
||||
getComponentBindableProperties,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
import { ActionButton, notifications } from "@budibase/bbui"
|
||||
import { capitalise } from "helpers"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
getBindableProperties,
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableBinding,
|
||||
} from "builder/dataBinding"
|
||||
} from "dataBinding"
|
||||
|
||||
export let componentInstance
|
||||
export let componentDefinition
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
import PropertyControl from "components/design/settings/controls/PropertyControl.svelte"
|
||||
import RoleSelect from "components/design/settings/controls/RoleSelect.svelte"
|
||||
import { selectedScreen, screenStore } from "stores/builder"
|
||||
import sanitizeUrl from "builder/store/screenTemplates/utils/sanitizeUrl"
|
||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||
import ButtonActionEditor from "components/design/settings/controls/ButtonActionEditor/ButtonActionEditor.svelte"
|
||||
import { getBindableProperties } from "builder/dataBinding"
|
||||
import { getBindableProperties } from "dataBinding"
|
||||
|
||||
$: bindings = getBindableProperties($selectedScreen, null)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
} from "stores/builder"
|
||||
import * as routify from "@roxi/routify"
|
||||
import { onDestroy } from "svelte"
|
||||
import { findComponent } from "stores/builder/components/utils"
|
||||
import { findComponent } from "helpers/components"
|
||||
import ComponentSettingsPanel from "./_components/Component/ComponentSettingsPanel.svelte"
|
||||
import NavigationPanel from "./_components/Navigation/index.svelte"
|
||||
import ScreenSettingsPanel from "./_components/Screen/index.svelte"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
} from "stores/builder"
|
||||
import { onMount } from "svelte"
|
||||
import { fly } from "svelte/transition"
|
||||
import { findComponentPath } from "stores/builder/components/utils"
|
||||
import { findComponentPath } from "helpers/components"
|
||||
|
||||
let searchString
|
||||
let searchRef
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
appStore,
|
||||
navigationStore,
|
||||
selectedScreen,
|
||||
currentAsset,
|
||||
hoverStore,
|
||||
} from "stores/builder"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
|
@ -22,10 +21,7 @@
|
|||
notifications,
|
||||
} from "@budibase/bbui"
|
||||
import ErrorSVG from "@budibase/frontend-core/assets/error.svg?raw"
|
||||
import {
|
||||
findComponent,
|
||||
findComponentPath,
|
||||
} from "stores/builder/components/utils"
|
||||
import { findComponent, findComponentPath } from "helpers/components"
|
||||
import { isActive, goto } from "@roxi/routify"
|
||||
|
||||
let iframe
|
||||
|
@ -147,7 +143,7 @@
|
|||
const { key, ctrlKey } = data
|
||||
document.dispatchEvent(new KeyboardEvent("keydown", { key, ctrlKey }))
|
||||
} else if (type === "duplicate-component" && data.id) {
|
||||
const rootComponent = get(currentAsset).props
|
||||
const rootComponent = get(selectedScreen).props
|
||||
const component = findComponent(rootComponent, data.id)
|
||||
componentStore.copy(component)
|
||||
await componentStore.paste(component)
|
||||
|
@ -157,7 +153,7 @@
|
|||
loading = false
|
||||
} else if (type === "move-component") {
|
||||
const { componentId, destinationComponentId } = data
|
||||
const rootComponent = get(currentAsset).props
|
||||
const rootComponent = get(selectedScreen).props
|
||||
|
||||
// Get source and destination components
|
||||
const source = findComponent(rootComponent, componentId)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
componentStore,
|
||||
selectedComponent,
|
||||
} from "stores/builder"
|
||||
import { findComponent } from "stores/builder/components/utils"
|
||||
import { findComponent } from "helpers/components"
|
||||
import { goto, isActive } from "@roxi/routify"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
findComponentPath,
|
||||
getComponentText,
|
||||
getComponentName,
|
||||
} from "stores/builder/components/utils"
|
||||
} from "helpers/components"
|
||||
import { get } from "svelte/store"
|
||||
import { dndStore } from "./dndStore"
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import { writable, get } from "svelte/store"
|
||||
import {
|
||||
findComponentParent,
|
||||
findComponentPath,
|
||||
} from "stores/builder/components/utils"
|
||||
import { findComponentParent, findComponentPath } from "helpers/components"
|
||||
import { selectedScreen, componentStore } from "stores/builder"
|
||||
|
||||
export const DropPosition = {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
notifications,
|
||||
} from "@budibase/bbui"
|
||||
import ScreenDetailsModal from "components/design/ScreenDetailsModal.svelte"
|
||||
import sanitizeUrl from "builder/store/screenTemplates/utils/sanitizeUrl"
|
||||
import { makeComponentUnique } from "stores/builder/components/utils"
|
||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||
import { makeComponentUnique } from "helpers/components"
|
||||
|
||||
export let screenId
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
import ScreenDetailsModal from "components/design/ScreenDetailsModal.svelte"
|
||||
import DatasourceModal from "./DatasourceModal.svelte"
|
||||
import ScreenRoleModal from "./ScreenRoleModal.svelte"
|
||||
import sanitizeUrl from "builder/store/screenTemplates/utils/sanitizeUrl"
|
||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||
import { Modal, notifications } from "@budibase/bbui"
|
||||
import { screenStore, navigationStore, tables } from "stores/builder"
|
||||
import { get } from "svelte/store"
|
||||
import getTemplates from "builder/store/screenTemplates"
|
||||
import getTemplates from "templates"
|
||||
import { Roles } from "constants/backend"
|
||||
import { capitalise } from "helpers"
|
||||
import { goto } from "@roxi/routify"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import ICONS from "components/backend/DatasourceNavigator/icons"
|
||||
import { IntegrationNames } from "constants"
|
||||
import { onMount } from "svelte"
|
||||
import rowListScreen from "builder/store/screenTemplates/rowListScreen"
|
||||
import rowListScreen from "templates/rowListScreen"
|
||||
import DatasourceTemplateRow from "./DatasourceTemplateRow.svelte"
|
||||
|
||||
export let mode
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import { auth, admin } from "stores/portal"
|
||||
import { redirect } from "@roxi/routify"
|
||||
import { processStringSync } from "@budibase/string-templates"
|
||||
import DeleteLicenseKeyModal from "../../../../components/portal/licensing/DeleteLicenseKeyModal.svelte"
|
||||
import DeleteLicenseKeyModal from "components/portal/licensing/DeleteLicenseKeyModal.svelte"
|
||||
import { API } from "api"
|
||||
import { onMount } from "svelte"
|
||||
import { sdk } from "@budibase/shared-core"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
import { notifications } from "@budibase/bbui"
|
||||
import { SplitPage } from "@budibase/frontend-core"
|
||||
import { API } from "api"
|
||||
import { database } from "stores/builder"
|
||||
import { auth, admin } from "stores/portal"
|
||||
|
||||
let name = "My first app"
|
||||
|
@ -26,9 +25,6 @@
|
|||
|
||||
const createdApp = await API.createApp(data)
|
||||
|
||||
// Select Correct Application/DB in prep for creating user
|
||||
database.syncAppDatabase(createdApp)
|
||||
|
||||
// Update checklist - in case first app
|
||||
await admin.init()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { ModalContent, Body, Layout, Icon } from "@budibase/bbui"
|
||||
import { OnboardingType } from "../../../../../../constants"
|
||||
import { OnboardingType } from "constants"
|
||||
|
||||
export let chooseCreationType
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
import { get } from "svelte/store"
|
||||
import { Constants, Utils, fetchData } from "@budibase/frontend-core"
|
||||
import { API } from "api"
|
||||
import { OnboardingType } from "../../../../../constants"
|
||||
import { OnboardingType } from "constants"
|
||||
import ScimBanner from "../_components/SCIMBanner.svelte"
|
||||
import { sdk } from "@budibase/shared-core"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { redirect } from "@roxi/routify"
|
||||
import { auth } from "../stores/portal"
|
||||
import { auth } from "stores/portal"
|
||||
import { onMount } from "svelte"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { cloneDeep } from "lodash/fp"
|
|||
import { generate } from "shortid"
|
||||
import { createHistoryStore } from "stores/builder/history"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { updateReferencesInObject } from "builder/dataBinding"
|
||||
import { updateReferencesInObject } from "dataBinding"
|
||||
|
||||
const initialAutomationState = {
|
||||
automations: [],
|
||||
|
|
|
@ -11,18 +11,23 @@ import {
|
|||
findComponentParent,
|
||||
findAllMatchingComponents,
|
||||
makeComponentUnique,
|
||||
} from "stores/builder/components/utils"
|
||||
} from "helpers/components"
|
||||
import { getComponentFieldOptions } from "helpers/formFields"
|
||||
import { selectedScreen } from "../screens"
|
||||
import { screenStore, appStore, previewStore, tables } from "stores/builder"
|
||||
import { buildFormSchema, getSchemaForDatasource } from "builder/dataBinding"
|
||||
import { selectedScreen } from "./screens"
|
||||
import {
|
||||
screenStore,
|
||||
appStore,
|
||||
previewStore,
|
||||
tables,
|
||||
} from "stores/builder/index"
|
||||
import { buildFormSchema, getSchemaForDatasource } from "dataBinding"
|
||||
import {
|
||||
BUDIBASE_INTERNAL_DB_ID,
|
||||
DEFAULT_BB_DATASOURCE_ID,
|
||||
DB_TYPE_INTERNAL,
|
||||
DB_TYPE_EXTERNAL,
|
||||
} from "constants/backend"
|
||||
import BudiStore from "../BudiStore"
|
||||
import BudiStore from "./BudiStore"
|
||||
import { Utils } from "@budibase/frontend-core"
|
||||
|
||||
export const INITIAL_COMPONENTS_STATE = {
|
||||
|
@ -67,39 +72,6 @@ export class ComponentStore extends BudiStore {
|
|||
this.isCached = this.isCached.bind(this)
|
||||
this.cacheSettings = this.cacheSettings.bind(this)
|
||||
this.getComponentSettings = this.getComponentSettings.bind(this)
|
||||
|
||||
this.selected = derived(
|
||||
[this.store, selectedScreen],
|
||||
([$store, $selectedScreen]) => {
|
||||
if (
|
||||
$selectedScreen &&
|
||||
$store.selectedComponentId?.startsWith(`${$selectedScreen._id}-`)
|
||||
) {
|
||||
return $selectedScreen?.props
|
||||
}
|
||||
if (!$selectedScreen || !$store.selectedComponentId) {
|
||||
return null
|
||||
}
|
||||
const selected = findComponent(
|
||||
$selectedScreen?.props,
|
||||
$store.selectedComponentId
|
||||
)
|
||||
|
||||
const clone = selected ? cloneDeep(selected) : selected
|
||||
this.migrateSettings(clone)
|
||||
return clone
|
||||
}
|
||||
)
|
||||
|
||||
this.selectedComponentPath = derived(
|
||||
[this.store, selectedScreen],
|
||||
([$store, $selectedScreen]) => {
|
||||
return findComponentPath(
|
||||
$selectedScreen?.props,
|
||||
$store.selectedComponentId
|
||||
).map(component => component._id)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +169,7 @@ export class ComponentStore extends BudiStore {
|
|||
const componentPrefix = "@budibase/standard-components"
|
||||
let migrated = false
|
||||
|
||||
if (enrichedComponent?._component == `${componentPrefix}/formblock`) {
|
||||
if (enrichedComponent?._component === `${componentPrefix}/formblock`) {
|
||||
// Use default config if the 'buttons' prop has never been initialised
|
||||
if (!("buttons" in enrichedComponent)) {
|
||||
enrichedComponent["buttons"] =
|
||||
|
@ -1080,11 +1052,11 @@ export class ComponentStore extends BudiStore {
|
|||
* @param {object} definition
|
||||
* @example
|
||||
* '@budibase/standard-components/container'
|
||||
* @returns {boolean}
|
||||
* @returns {array} the settings
|
||||
*/
|
||||
cacheSettings(componentType, definition) {
|
||||
let settings = []
|
||||
if (definition && componentType) {
|
||||
if (definition) {
|
||||
settings = definition.settings?.filter(setting => !setting.section) ?? []
|
||||
definition.settings
|
||||
?.filter(setting => setting.section)
|
||||
|
@ -1096,6 +1068,7 @@ export class ComponentStore extends BudiStore {
|
|||
}))
|
||||
)
|
||||
})
|
||||
}
|
||||
this.update(state => ({
|
||||
...state,
|
||||
settingsCache: {
|
||||
|
@ -1103,7 +1076,7 @@ export class ComponentStore extends BudiStore {
|
|||
[componentType]: settings,
|
||||
},
|
||||
}))
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1129,18 +1102,49 @@ export class ComponentStore extends BudiStore {
|
|||
componentType = `@budibase/standard-components/${componentType}`
|
||||
}
|
||||
|
||||
if (this.isCached(componentType)) {
|
||||
return get(this.store).settingsCache[componentType]
|
||||
} else {
|
||||
const def = this.getDefinition(componentType)
|
||||
this.cacheSettings(componentType, def)
|
||||
return get(this.store).settingsCache[componentType]
|
||||
// Use cached value if possible
|
||||
const cachedValue = get(this.store).settingsCache[componentType]
|
||||
if (cachedValue) {
|
||||
return cachedValue
|
||||
}
|
||||
|
||||
// Otherwise cache and return new value
|
||||
const def = this.getDefinition(componentType)
|
||||
return this.cacheSettings(componentType, def)
|
||||
}
|
||||
}
|
||||
|
||||
export const componentStore = new ComponentStore()
|
||||
|
||||
export const selectedComponent = componentStore.selected
|
||||
export const selectedComponent = derived(
|
||||
[componentStore, selectedScreen],
|
||||
([$store, $selectedScreen]) => {
|
||||
if (
|
||||
$selectedScreen &&
|
||||
$store.selectedComponentId?.startsWith(`${$selectedScreen._id}-`)
|
||||
) {
|
||||
return $selectedScreen?.props
|
||||
}
|
||||
if (!$selectedScreen || !$store.selectedComponentId) {
|
||||
return null
|
||||
}
|
||||
const selected = findComponent(
|
||||
$selectedScreen?.props,
|
||||
$store.selectedComponentId
|
||||
)
|
||||
|
||||
export const selectedComponentPath = componentStore.selectedComponentPath
|
||||
const clone = selected ? cloneDeep(selected) : selected
|
||||
componentStore.migrateSettings(clone)
|
||||
return clone
|
||||
}
|
||||
)
|
||||
|
||||
export const selectedComponentPath = derived(
|
||||
[componentStore, selectedScreen],
|
||||
([$store, $selectedScreen]) => {
|
||||
return findComponentPath(
|
||||
$selectedScreen?.props,
|
||||
$store.selectedComponentId
|
||||
).map(component => component._id)
|
||||
}
|
||||
)
|
|
@ -1,16 +0,0 @@
|
|||
import { writable } from "svelte/store"
|
||||
|
||||
export const createDatabaseStore = () => {
|
||||
const store = writable({})
|
||||
|
||||
const syncAppDatabase = application => {
|
||||
store.set({ ...application.instance })
|
||||
}
|
||||
|
||||
return {
|
||||
subscribe: store.subscribe,
|
||||
syncAppDatabase,
|
||||
}
|
||||
}
|
||||
|
||||
export const database = createDatabaseStore()
|
|
@ -7,12 +7,7 @@ import {
|
|||
} from "./components"
|
||||
import { navigationStore } from "./navigation.js"
|
||||
import { themeStore } from "./theme.js"
|
||||
import {
|
||||
screenStore,
|
||||
selectedScreen,
|
||||
currentAsset,
|
||||
sortedScreens,
|
||||
} from "./screens.js"
|
||||
import { screenStore, selectedScreen, sortedScreens } from "./screens.js"
|
||||
import { builderStore } from "./builder.js"
|
||||
import { hoverStore } from "./hover.js"
|
||||
import { previewStore } from "./preview.js"
|
||||
|
@ -23,7 +18,6 @@ import {
|
|||
} from "./automations.js"
|
||||
import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js"
|
||||
import { deploymentStore } from "./deployments.js"
|
||||
import { database } from "./database.js"
|
||||
|
||||
// Backend
|
||||
import { tables } from "./tables"
|
||||
|
@ -39,7 +33,6 @@ import { flags } from "./flags"
|
|||
|
||||
export {
|
||||
layoutStore,
|
||||
database,
|
||||
appStore,
|
||||
componentStore,
|
||||
navigationStore,
|
||||
|
@ -52,7 +45,6 @@ export {
|
|||
automationStore,
|
||||
selectedAutomation,
|
||||
automationHistoryStore,
|
||||
currentAsset,
|
||||
sortedScreens,
|
||||
userStore,
|
||||
isOnlyUser,
|
||||
|
@ -82,13 +74,15 @@ export const reset = () => {
|
|||
}
|
||||
|
||||
const refreshBuilderData = async () => {
|
||||
await automationStore.actions.fetch()
|
||||
await datasources.init()
|
||||
await integrations.init()
|
||||
await queries.init()
|
||||
await tables.init()
|
||||
await roles.fetch()
|
||||
await flags.fetch()
|
||||
await Promise.all([
|
||||
automationStore.actions.fetch(),
|
||||
datasources.init(),
|
||||
integrations.init(),
|
||||
queries.init(),
|
||||
tables.init(),
|
||||
roles.fetch(),
|
||||
flags.fetch(),
|
||||
])
|
||||
}
|
||||
|
||||
const resetBuilderHistory = () => {
|
||||
|
@ -98,27 +92,16 @@ const resetBuilderHistory = () => {
|
|||
|
||||
export const initialise = async pkg => {
|
||||
const { application } = pkg
|
||||
|
||||
appStore.syncAppPackage(pkg)
|
||||
|
||||
appStore.syncAppRoutes()
|
||||
|
||||
await Promise.all([
|
||||
appStore.syncAppRoutes(),
|
||||
componentStore.refreshDefinitions(application?.appId),
|
||||
])
|
||||
builderStore.init(application)
|
||||
|
||||
appStore.syncAppPackage(pkg)
|
||||
navigationStore.syncAppNavigation(application?.navigation)
|
||||
|
||||
await componentStore.refreshDefinitions(application?.appId)
|
||||
|
||||
themeStore.syncAppTheme(application)
|
||||
|
||||
screenStore.syncAppScreens(pkg)
|
||||
|
||||
layoutStore.syncAppLayouts(pkg)
|
||||
|
||||
// required for api comms
|
||||
database.syncAppDatabase(application)
|
||||
|
||||
resetBuilderHistory()
|
||||
|
||||
await refreshBuilderData()
|
||||
}
|
||||
|
|
|
@ -16,12 +16,6 @@ export class LayoutStore extends BudiStore {
|
|||
this.syncAppLayouts = this.syncAppLayouts.bind(this)
|
||||
this.select = this.select.bind(this)
|
||||
this.deleteLayout = this.deleteLayout.bind(this)
|
||||
|
||||
this.selectedLayout = derived(this.store, $store => {
|
||||
return $store.layouts?.find(
|
||||
layout => layout._id === $store.selectedLayoutId
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
@ -78,4 +72,6 @@ export class LayoutStore extends BudiStore {
|
|||
|
||||
export const layoutStore = new LayoutStore()
|
||||
|
||||
export const selectedLayout = layoutStore.selectedLayout
|
||||
export const selectedLayout = derived(layoutStore, $store => {
|
||||
return $store.layouts?.find(layout => layout._id === $store.selectedLayoutId)
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import { derived, get } from "svelte/store"
|
|||
import { cloneDeep } from "lodash/fp"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import { RoleUtils, Utils } from "@budibase/frontend-core"
|
||||
import { findAllMatchingComponents } from "stores/builder/components/utils"
|
||||
import { findAllMatchingComponents } from "helpers/components"
|
||||
import {
|
||||
layoutStore,
|
||||
appStore,
|
||||
|
@ -39,12 +39,6 @@ export class ScreenStore extends BudiStore {
|
|||
this.sequentialScreenPatch = this.sequentialScreenPatch.bind(this)
|
||||
this.removeCustomLayout = this.removeCustomLayout.bind(this)
|
||||
|
||||
this.selected = derived(this.store, $store => {
|
||||
return get(this.store).screens.find(
|
||||
screen => screen._id === $store.selectedScreenId
|
||||
)
|
||||
})
|
||||
|
||||
this.history = createHistoryStore({
|
||||
getDoc: id => get(this.store).screens?.find(screen => screen._id === id),
|
||||
selectDoc: this.select,
|
||||
|
@ -485,9 +479,9 @@ export class ScreenStore extends BudiStore {
|
|||
|
||||
export const screenStore = new ScreenStore()
|
||||
|
||||
export const selectedScreen = screenStore.selected
|
||||
|
||||
export const currentAsset = selectedScreen
|
||||
export const selectedScreen = derived(screenStore, $store => {
|
||||
return $store.screens.find(screen => screen._id === $store.selectedScreenId)
|
||||
})
|
||||
|
||||
export const sortedScreens = derived(screenStore, $screenStore => {
|
||||
return $screenStore.screens.slice().sort((a, b) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { v4 } from "uuid"
|
||||
import { Component } from "builder/store/screenTemplates/utils/Component"
|
||||
import { Screen } from "builder/store/screenTemplates/utils/Screen"
|
||||
import { Component } from "templates/Component"
|
||||
import { Screen } from "templates/Screen"
|
||||
import { get } from "svelte/store"
|
||||
import {
|
||||
BUDIBASE_INTERNAL_DB_ID,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { writable } from "svelte/store"
|
||||
import { AppStatus } from "../../constants"
|
||||
import { AppStatus } from "constants"
|
||||
import { API } from "api"
|
||||
|
||||
// properties that should always come from the dev app, not the deployed
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component } from "./Component"
|
||||
import { getSchemaForDatasource } from "../../../dataBinding"
|
||||
import { getSchemaForDatasource } from "dataBinding"
|
||||
|
||||
const fieldTypeToComponentMap = {
|
||||
string: "stringfield",
|
|
@ -1,4 +1,4 @@
|
|||
import { Screen } from "./utils/Screen"
|
||||
import { Screen } from "./Screen"
|
||||
|
||||
export default {
|
||||
name: `Create from scratch`,
|
|
@ -1,6 +1,6 @@
|
|||
import sanitizeUrl from "./utils/sanitizeUrl"
|
||||
import { Screen } from "./utils/Screen"
|
||||
import { Component } from "./utils/Component"
|
||||
import sanitizeUrl from "helpers/sanitizeUrl"
|
||||
import { Screen } from "./Screen"
|
||||
import { Component } from "./Component"
|
||||
|
||||
export default function (datasources, mode = "table") {
|
||||
if (!Array.isArray(datasources)) {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue