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 disableBindings = false
|
||||
export let wide
|
||||
export let isolated = false
|
||||
|
||||
let highlightType
|
||||
|
||||
$: highlightedProp = $builderStore.highlightedSetting
|
||||
$: allBindings = getAllBindings(bindings, componentBindings, nested)
|
||||
$: allBindings = getAllBindings(bindings, componentBindings, nested, isolated)
|
||||
$: safeValue = getSafeValue(value, defaultValue, allBindings)
|
||||
$: replaceBindings = val => readableToRuntimeBinding(allBindings, val)
|
||||
|
||||
|
@ -36,7 +37,10 @@
|
|||
highlightedProp?.key === key ? `highlighted-${highlightedProp?.type}` : ""
|
||||
}
|
||||
|
||||
const getAllBindings = (bindings, componentBindings, nested) => {
|
||||
const getAllBindings = (bindings, componentBindings, nested, isolated) => {
|
||||
if (isolated) {
|
||||
bindings = []
|
||||
}
|
||||
if (!nested) {
|
||||
return bindings
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
{componentInstance}
|
||||
{componentDefinition}
|
||||
{bindings}
|
||||
{componentBindings}
|
||||
/>
|
||||
{/if}
|
||||
</Panel>
|
||||
|
|
|
@ -151,6 +151,7 @@
|
|||
propertyFocus={$builderStore.propertyFocus === setting.key}
|
||||
info={setting.info}
|
||||
disableBindings={setting.disableBindings}
|
||||
isolated={setting.isolated}
|
||||
props={{
|
||||
// Generic settings
|
||||
placeholder: setting.placeholder || null,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
export let conditions = []
|
||||
export let bindings = []
|
||||
export let componentBindings = []
|
||||
|
||||
const flipDurationMs = 150
|
||||
const actionOptions = [
|
||||
|
@ -55,6 +56,7 @@
|
|||
]
|
||||
|
||||
let dragDisabled = true
|
||||
|
||||
$: settings = componentStore
|
||||
.getComponentSettings($selectedComponent?._component)
|
||||
?.concat({
|
||||
|
@ -213,7 +215,10 @@
|
|||
options: definition.options,
|
||||
placeholder: definition.placeholder,
|
||||
}}
|
||||
nested={definition.nested}
|
||||
isolated={definition.isolated}
|
||||
{bindings}
|
||||
{componentBindings}
|
||||
/>
|
||||
{:else}
|
||||
<Select disabled placeholder=" " />
|
||||
|
|
|
@ -64,7 +64,12 @@
|
|||
Show, hide and update components in response to conditions being met.
|
||||
</svelte:fragment>
|
||||
<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>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -3089,6 +3089,12 @@
|
|||
"type": "tableConditions",
|
||||
"label": "Conditions",
|
||||
"key": "conditions"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"label": "Format",
|
||||
"key": "format",
|
||||
"info": "Changing format will display values as text"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -7685,7 +7691,9 @@
|
|||
{
|
||||
"type": "columns/grid",
|
||||
"key": "columns",
|
||||
"resetOn": "table"
|
||||
"resetOn": "table",
|
||||
"nested": true,
|
||||
"isolated": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { get, derived, readable } from "svelte/store"
|
||||
import { featuresStore } from "stores"
|
||||
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
|
||||
export let table
|
||||
|
@ -105,7 +105,10 @@
|
|||
order: idx,
|
||||
conditions: column.conditions,
|
||||
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) {
|
||||
overrides[column.field].width = column.width
|
||||
|
@ -114,12 +117,12 @@
|
|||
return overrides
|
||||
}
|
||||
|
||||
// const createFormatter = column => {
|
||||
// if (typeof column.format !== "string" || !column.format.trim().length) {
|
||||
// return null
|
||||
// }
|
||||
// return row => processStringSync(column.format, { [id]: row })
|
||||
// }
|
||||
const createFormatter = column => {
|
||||
if (typeof column.format !== "string" || !column.format.trim().length) {
|
||||
return null
|
||||
}
|
||||
return row => processStringSync(column.format, { [id]: row })
|
||||
}
|
||||
|
||||
const enrichButtons = buttons => {
|
||||
if (!buttons?.length) {
|
||||
|
|
|
@ -25,6 +25,8 @@ export interface ComponentSetting {
|
|||
selectAllFields?: boolean
|
||||
resetOn?: string | string[]
|
||||
settings?: ComponentSetting[]
|
||||
nested?: boolean
|
||||
isolated?: boolean
|
||||
dependsOn?:
|
||||
| string
|
||||
| {
|
||||
|
|
Loading…
Reference in New Issue