Restore format setting, fix conditional UI missing nested flag and component bindings, restrict format setting to own context only
This commit is contained in:
parent
ad063b7de6
commit
83e23ef578
|
@ -23,11 +23,12 @@
|
||||||
export let info = null
|
export let info = null
|
||||||
export let disableBindings = false
|
export let disableBindings = false
|
||||||
export let wide
|
export let wide
|
||||||
|
export let isolated = false
|
||||||
|
|
||||||
let highlightType
|
let highlightType
|
||||||
|
|
||||||
$: highlightedProp = $builderStore.highlightedSetting
|
$: highlightedProp = $builderStore.highlightedSetting
|
||||||
$: allBindings = getAllBindings(bindings, componentBindings, nested)
|
$: allBindings = getAllBindings(bindings, componentBindings, nested, isolated)
|
||||||
$: safeValue = getSafeValue(value, defaultValue, allBindings)
|
$: safeValue = getSafeValue(value, defaultValue, allBindings)
|
||||||
$: replaceBindings = val => readableToRuntimeBinding(allBindings, val)
|
$: replaceBindings = val => readableToRuntimeBinding(allBindings, val)
|
||||||
|
|
||||||
|
@ -36,7 +37,10 @@
|
||||||
highlightedProp?.key === key ? `highlighted-${highlightedProp?.type}` : ""
|
highlightedProp?.key === key ? `highlighted-${highlightedProp?.type}` : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAllBindings = (bindings, componentBindings, nested) => {
|
const getAllBindings = (bindings, componentBindings, nested, isolated) => {
|
||||||
|
if (isolated) {
|
||||||
|
bindings = []
|
||||||
|
}
|
||||||
if (!nested) {
|
if (!nested) {
|
||||||
return bindings
|
return bindings
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
{bindings}
|
{bindings}
|
||||||
|
{componentBindings}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
|
@ -151,6 +151,7 @@
|
||||||
propertyFocus={$builderStore.propertyFocus === setting.key}
|
propertyFocus={$builderStore.propertyFocus === setting.key}
|
||||||
info={setting.info}
|
info={setting.info}
|
||||||
disableBindings={setting.disableBindings}
|
disableBindings={setting.disableBindings}
|
||||||
|
isolated={setting.isolated}
|
||||||
props={{
|
props={{
|
||||||
// Generic settings
|
// Generic settings
|
||||||
placeholder: setting.placeholder || null,
|
placeholder: setting.placeholder || null,
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
export let conditions = []
|
export let conditions = []
|
||||||
export let bindings = []
|
export let bindings = []
|
||||||
|
export let componentBindings = []
|
||||||
|
|
||||||
const flipDurationMs = 150
|
const flipDurationMs = 150
|
||||||
const actionOptions = [
|
const actionOptions = [
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
let dragDisabled = true
|
let dragDisabled = true
|
||||||
|
|
||||||
$: settings = componentStore
|
$: settings = componentStore
|
||||||
.getComponentSettings($selectedComponent?._component)
|
.getComponentSettings($selectedComponent?._component)
|
||||||
?.concat({
|
?.concat({
|
||||||
|
@ -213,7 +215,10 @@
|
||||||
options: definition.options,
|
options: definition.options,
|
||||||
placeholder: definition.placeholder,
|
placeholder: definition.placeholder,
|
||||||
}}
|
}}
|
||||||
|
nested={definition.nested}
|
||||||
|
isolated={definition.isolated}
|
||||||
{bindings}
|
{bindings}
|
||||||
|
{componentBindings}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<Select disabled placeholder=" " />
|
<Select disabled placeholder=" " />
|
||||||
|
|
|
@ -64,7 +64,12 @@
|
||||||
Show, hide and update components in response to conditions being met.
|
Show, hide and update components in response to conditions being met.
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<Button cta slot="buttons" on:click={() => save()}>Save</Button>
|
<Button cta slot="buttons" on:click={() => save()}>Save</Button>
|
||||||
<ConditionalUIDrawer slot="body" bind:conditions={tempValue} {bindings} />
|
<ConditionalUIDrawer
|
||||||
|
slot="body"
|
||||||
|
bind:conditions={tempValue}
|
||||||
|
{bindings}
|
||||||
|
{componentBindings}
|
||||||
|
/>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -3089,6 +3089,12 @@
|
||||||
"type": "tableConditions",
|
"type": "tableConditions",
|
||||||
"label": "Conditions",
|
"label": "Conditions",
|
||||||
"key": "conditions"
|
"key": "conditions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "Format",
|
||||||
|
"key": "format",
|
||||||
|
"info": "Changing format will display values as text"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -7685,7 +7691,9 @@
|
||||||
{
|
{
|
||||||
"type": "columns/grid",
|
"type": "columns/grid",
|
||||||
"key": "columns",
|
"key": "columns",
|
||||||
"resetOn": "table"
|
"resetOn": "table",
|
||||||
|
"nested": true,
|
||||||
|
"isolated": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import { get, derived, readable } from "svelte/store"
|
import { get, derived, readable } from "svelte/store"
|
||||||
import { featuresStore } from "stores"
|
import { featuresStore } from "stores"
|
||||||
import { Grid } from "@budibase/frontend-core"
|
import { Grid } from "@budibase/frontend-core"
|
||||||
// import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
|
|
||||||
// table is actually any datasource, but called table for legacy compatibility
|
// table is actually any datasource, but called table for legacy compatibility
|
||||||
export let table
|
export let table
|
||||||
|
@ -105,7 +105,10 @@
|
||||||
order: idx,
|
order: idx,
|
||||||
conditions: column.conditions,
|
conditions: column.conditions,
|
||||||
visible: !!column.active,
|
visible: !!column.active,
|
||||||
// format: createFormatter(column),
|
format: createFormatter(column),
|
||||||
|
|
||||||
|
// Small hack to ensure we react to all changes when inside the builder
|
||||||
|
rand: Math.random(),
|
||||||
}
|
}
|
||||||
if (column.width) {
|
if (column.width) {
|
||||||
overrides[column.field].width = column.width
|
overrides[column.field].width = column.width
|
||||||
|
@ -114,12 +117,12 @@
|
||||||
return overrides
|
return overrides
|
||||||
}
|
}
|
||||||
|
|
||||||
// const createFormatter = column => {
|
const createFormatter = column => {
|
||||||
// if (typeof column.format !== "string" || !column.format.trim().length) {
|
if (typeof column.format !== "string" || !column.format.trim().length) {
|
||||||
// return null
|
return null
|
||||||
// }
|
}
|
||||||
// return row => processStringSync(column.format, { [id]: row })
|
return row => processStringSync(column.format, { [id]: row })
|
||||||
// }
|
}
|
||||||
|
|
||||||
const enrichButtons = buttons => {
|
const enrichButtons = buttons => {
|
||||||
if (!buttons?.length) {
|
if (!buttons?.length) {
|
||||||
|
|
|
@ -25,6 +25,8 @@ export interface ComponentSetting {
|
||||||
selectAllFields?: boolean
|
selectAllFields?: boolean
|
||||||
resetOn?: string | string[]
|
resetOn?: string | string[]
|
||||||
settings?: ComponentSetting[]
|
settings?: ComponentSetting[]
|
||||||
|
nested?: boolean
|
||||||
|
isolated?: boolean
|
||||||
dependsOn?:
|
dependsOn?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
|
|
Loading…
Reference in New Issue