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