some tidy up and revert highlightedSetting to obj
This commit is contained in:
parent
28c59d1d1c
commit
513e31d0b3
|
@ -26,18 +26,14 @@
|
|||
|
||||
let highlightType
|
||||
|
||||
$: highlightedSettings = $builderStore.highlightedSettings
|
||||
$: highlightedProp = $builderStore.highlightedSetting
|
||||
$: allBindings = getAllBindings(bindings, componentBindings, nested)
|
||||
$: safeValue = getSafeValue(value, defaultValue, allBindings)
|
||||
$: replaceBindings = val => readableToRuntimeBinding(allBindings, val)
|
||||
|
||||
$: if (value) {
|
||||
const highlightedSetting = highlightedSettings?.find(
|
||||
setting => setting.key === key
|
||||
)
|
||||
highlightType = highlightedSetting
|
||||
? `highlighted-${highlightedSetting.type}`
|
||||
: ""
|
||||
highlightType =
|
||||
highlightedProp?.key === key ? `highlighted-${highlightedProp?.type}` : ""
|
||||
}
|
||||
|
||||
const getAllBindings = (bindings, componentBindings, nested) => {
|
||||
|
|
|
@ -57,14 +57,13 @@
|
|||
$: id, (section = tabs[0])
|
||||
$: componentName = getComponentName(componentInstance)
|
||||
|
||||
$: highlightedSettings = $builderStore.highlightedSettings
|
||||
$: if (highlightedSettings?.length) {
|
||||
const settings = highlightedSettings.map(s => s.key)
|
||||
if (settings.includes("_conditions")) {
|
||||
$: highlightedSetting = $builderStore.highlightedSetting
|
||||
$: if (highlightedSetting) {
|
||||
if (highlightedSetting.key === "_conditions") {
|
||||
section = "conditions"
|
||||
} else if (settings.includes("_styles")) {
|
||||
} else if (highlightedSetting.key === "_styles") {
|
||||
section = "styles"
|
||||
} else if (settings.includes("_settings")) {
|
||||
} else if (highlightedSetting.key === "_settings") {
|
||||
section = "settings"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
let tempValue
|
||||
let drawer
|
||||
|
||||
$: highlighted = $builderStore.highlightedSettings?.find(
|
||||
setting => setting.key === "_conditions"
|
||||
)
|
||||
$: highlighted = $builderStore.highlightedSetting?.key === "_conditions"
|
||||
|
||||
const openDrawer = () => {
|
||||
tempValue = JSON.parse(JSON.stringify(componentInstance?._conditions ?? []))
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
|
||||
$: icon = componentDefinition?.icon
|
||||
|
||||
$: highlighted = $builderStore.highlightedSettings?.find(
|
||||
setting => setting.key === "_styles"
|
||||
)
|
||||
$: highlighted = $builderStore.highlightedSetting?.key === "_styles"
|
||||
|
||||
const openDrawer = () => {
|
||||
tempValue = runtimeToReadableBinding(
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import AppPreview from "./AppPreview.svelte"
|
||||
import { screenStore, appStore } from "@/stores/builder"
|
||||
import UndoRedoControl from "@/components/common/UndoRedoControl.svelte"
|
||||
import { ActionButton } from "@budibase/bbui"
|
||||
import BindingsPanel from "./BindingsPanel.svelte"
|
||||
</script>
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ import { App } from "@budibase/types"
|
|||
|
||||
interface BuilderState {
|
||||
previousTopNavPath: Record<string, string>
|
||||
highlightedSettings: Array<{
|
||||
highlightedSetting: {
|
||||
key: string
|
||||
type: "info" | string
|
||||
}> | null
|
||||
} | null
|
||||
propertyFocus: string | null
|
||||
builderSidePanel: boolean
|
||||
onboarding: boolean
|
||||
|
@ -24,7 +24,7 @@ interface BuilderState {
|
|||
|
||||
export const INITIAL_BUILDER_STATE: BuilderState = {
|
||||
previousTopNavPath: {},
|
||||
highlightedSettings: null,
|
||||
highlightedSetting: null,
|
||||
propertyFocus: null,
|
||||
builderSidePanel: false,
|
||||
onboarding: false,
|
||||
|
@ -76,29 +76,10 @@ export class BuilderStore extends BudiStore<BuilderState> {
|
|||
}
|
||||
|
||||
highlightSetting(key?: string, type?: string) {
|
||||
this.update(state => {
|
||||
if (!key) {
|
||||
return {
|
||||
this.update(state => ({
|
||||
...state,
|
||||
highlightedSettings: null,
|
||||
}
|
||||
}
|
||||
|
||||
const currentSettings = state.highlightedSettings || []
|
||||
|
||||
const settingExists = currentSettings.some(setting => setting.key === key)
|
||||
if (!settingExists) {
|
||||
return {
|
||||
...state,
|
||||
highlightedSettings: [
|
||||
...currentSettings,
|
||||
{ key, type: type || "info" },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
return state
|
||||
})
|
||||
highlightedSetting: key ? { key, type: type || "info" } : null,
|
||||
}))
|
||||
}
|
||||
|
||||
propertyFocus(key: string | null) {
|
||||
|
|
|
@ -718,7 +718,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
|||
*/
|
||||
select(componentId: string) {
|
||||
builderStore.update(state => {
|
||||
state.highlightedSettings = null
|
||||
state.highlightedSetting = null
|
||||
return state
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue