clear highlight state as part of component select

This commit is contained in:
Peter Clement 2025-01-15 15:54:40 +00:00
parent 8763f5251c
commit 094881e807
3 changed files with 9 additions and 18 deletions

View File

@ -5,7 +5,6 @@
runtimeToReadableBinding,
} from "@/dataBinding"
import { builderStore } from "@/stores/builder"
import { onDestroy } from "svelte"
export let label = ""
export let labelHidden = false
@ -79,12 +78,6 @@
? defaultValue
: enriched
}
onDestroy(() => {
if (highlightedSettings) {
builderStore.highlightSetting(null)
}
})
</script>
<div

View File

@ -1,5 +1,4 @@
<script lang="ts">
import { onDestroy } from "svelte"
import { ActionButton, Modal, ModalContent, Combobox } from "@budibase/bbui"
import { getAllStateVariables } from "@/dataBinding"
import {
@ -94,17 +93,10 @@
}) {
componentStore.select(component.id)
// Delay highlighting until after component selection and re-render (i know this is disgusting)
setTimeout(() => {
component.settings.forEach(setting => {
builderStore.highlightSetting(setting)
})
}, 100)
component.settings.forEach(setting => {
builderStore.highlightSetting(setting)
})
}
onDestroy(() => {
builderStore.highlightSetting(undefined)
})
</script>
<ActionButton on:click={modal.show}>State</ActionButton>

View File

@ -20,6 +20,7 @@ import {
previewStore,
tables,
componentTreeNodesStore,
builderStore,
} from "@/stores/builder"
import { buildFormSchema, getSchemaForDatasource } from "@/dataBinding"
import {
@ -716,6 +717,11 @@ export class ComponentStore extends BudiStore<ComponentState> {
* @param {string} componentId
*/
select(componentId: string) {
builderStore.update(state => {
state.highlightedSettings = null
return state
})
this.update(state => {
state.selectedComponentId = componentId
return state