diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte
index e25abb918a..27b879ed0e 100644
--- a/packages/bbui/src/Form/Core/Picker.svelte
+++ b/packages/bbui/src/Form/Core/Picker.svelte
@@ -33,7 +33,7 @@
let focus = false
let pickerButton
- $: focus = autofocus && pickerButton
+ $: focus = autofocus && pickerButton !== null
$: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
$: filteredOptions = getFilteredOptions(
@@ -88,6 +88,14 @@
class:is-focused={focus}
bind:this={pickerButton}
on:mousedown={onClick}
+ on:keydown={e => {
+ var keycode = e.key
+ if (focus) {
+ if (keycode === "Enter") {
+ onClick(e)
+ }
+ }
+ }}
on:focus={() => {
focus = true
}}
diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index 3e7ceb2efc..a0327b3f88 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -417,28 +417,12 @@ export const getFrontendStore = () => {
}
parentComponent._children.push(componentInstance)
- const definition = store.actions.components.getDefinition(componentName)
-
// Save components and update UI
await store.actions.preview.saveSelected()
store.update(state => {
state.currentView = "component"
state.selectedComponentId = componentInstance._id
- const focusSetting = definition.settings.filter(setting => {
- return setting.required
- })
- const mappedSettings = focusSetting.map(setting => {
- return {
- key: setting.key,
- target: state.selectedComponentId,
- location: "component_settings",
- }
- })
-
- if (focusSetting.length) {
- state.builderFocus = mappedSettings
- }
return state
})
diff --git a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
index bc8a0d362f..130ee29597 100644
--- a/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/ComponentSettingsSection.svelte
@@ -6,6 +6,7 @@
import ResetFieldsButton from "./PropertyControls/ResetFieldsButton.svelte"
import { getComponentForSettingType } from "./PropertyControls/componentSettings"
import { Utils } from "@budibase/frontend-core"
+ import { onMount } from "svelte"
export let componentDefinition
export let componentInstance
@@ -78,8 +79,41 @@
if (!$store.builderFocus) {
return false
}
- return setting.required === true
+ return (
+ setting.required === true && $store.builderFocus[0].key === setting.key
+ )
}
+
+ onMount(() => {
+ const emptyFields = (definition, options) => {
+ if (!options) {
+ return []
+ }
+ return definition?.settings
+ ? definition.settings.filter(setting => {
+ return (
+ setting.required &&
+ (!options[setting.key] || options[setting.key] == "")
+ )
+ })
+ : []
+ }
+
+ let target = emptyFields(componentDefinition, componentInstance)[0]
+
+ if (target) {
+ store.update(state => ({
+ ...state,
+ builderFocus: [
+ {
+ location: "component_settings",
+ key: target.key,
+ target: componentInstance._id,
+ },
+ ],
+ }))
+ }
+ })
{#each sections as section, idx (section.name)}
diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte
index 1e19508744..92d865a200 100644
--- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte
+++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/DataSourceSelect.svelte
@@ -25,6 +25,7 @@
export let otherSources
export let showAllQueries
export let bindings = []
+ export let autofocus = false
const dispatch = createEventDispatcher()
const arrayTypes = ["attachment", "array"]
@@ -158,6 +159,7 @@
value={text}
options={[text]}
on:click={dropdownRight.show}
+ {autofocus}
/>
{#if value?.type === "query"}
diff --git a/packages/client/manifest.json b/packages/client/manifest.json
index 9b0330e250..ad8de1a6d2 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -975,7 +975,8 @@
{
"type": "text",
"label": "URL",
- "key": "url"
+ "key": "url",
+ "required": true
},
{
"type": "select",
@@ -3255,7 +3256,8 @@
{
"type": "dataSource",
"label": "Data",
- "key": "dataSource"
+ "key": "dataSource",
+ "required": true
},
{
"type": "filter",
@@ -3324,7 +3326,7 @@
],
"hasChildren": true,
"showEmptyState": false,
- "info": "Row selection is only compatible with internal or SQL tables",
+ "info": "Row selection is only compatible with internal or SQL tables",
"settings": [
{
"type": "dataProvider",
diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte
index 3c29cb875b..a1550cf72f 100644
--- a/packages/client/src/components/Component.svelte
+++ b/packages/client/src/components/Component.svelte
@@ -154,6 +154,7 @@
selected,
name,
editing,
+ type: instance._component,
})
const initialise = instance => {
diff --git a/packages/client/src/components/app/BackgroundImage.svelte b/packages/client/src/components/app/BackgroundImage.svelte
index 43eede632e..909e0fd3fd 100644
--- a/packages/client/src/components/app/BackgroundImage.svelte
+++ b/packages/client/src/components/app/BackgroundImage.svelte
@@ -28,25 +28,7 @@
class="placeholder"
use:styleable={{ ...$component.styles, empty: true }}
>
-