1
0
Fork 0
mirror of synced 2024-08-10 23:51:24 +12:00

PR Feedback and fixes for the edit field popover

This commit is contained in:
Dean 2023-09-06 09:09:43 +01:00
parent 61cbd45806
commit 4a1e969b7c
2 changed files with 17 additions and 16 deletions

View file

@ -1250,9 +1250,7 @@ export const getFrontendStore = () => {
setting => name === setting.resetOn setting => name === setting.resetOn
) )
resetFields?.forEach(setting => { resetFields?.forEach(setting => {
if (component[setting.key]) { component[setting.key] = null
component[setting.key] = null
}
}) })
if ( if (

View file

@ -21,6 +21,9 @@
let fieldList let fieldList
let schema let schema
let cachedValue let cachedValue
let options
let sanitisedValue
let unconfigured
$: bindings = getBindableProperties($selectedScreen, componentInstance._id) $: bindings = getBindableProperties($selectedScreen, componentInstance._id)
$: actionType = componentInstance.actionType $: actionType = componentInstance.actionType
@ -36,15 +39,22 @@
$: datasource = getDatasourceForProvider($currentAsset, componentInstance) $: datasource = getDatasourceForProvider($currentAsset, componentInstance)
$: resourceId = datasource.resourceId || datasource.tableId $: resourceId = datasource.resourceId || datasource.tableId
$: if (!isEqual(value, cachedValue) || resourceId) { $: if (!isEqual(value, cachedValue)) {
cachedValue = cloneDeep(value) cachedValue = cloneDeep(value)
schema = getSchema($currentAsset, datasource)
} }
$: options = Object.keys(schema || {}) const updateState = value => {
$: sanitisedValue = getValidColumns(convertOldFieldFormat(value), options) schema = getSchema($currentAsset, datasource)
$: updateSanitsedFields(sanitisedValue) options = Object.keys(schema || {})
$: unconfigured = buildUnconfiguredOptions(schema, sanitisedFields) sanitisedValue = getValidColumns(convertOldFieldFormat(value), options)
updateSanitsedFields(sanitisedValue)
unconfigured = buildUnconfiguredOptions(schema, sanitisedFields)
fieldList = [...sanitisedFields, ...unconfigured]
.map(buildSudoInstance)
.filter(x => x != null)
}
$: updateState(cachedValue, resourceId)
// Builds unused ones only // Builds unused ones only
const buildUnconfiguredOptions = (schema, selected) => { const buildUnconfiguredOptions = (schema, selected) => {
@ -98,7 +108,6 @@
if (instance._component) { if (instance._component) {
return instance return instance
} }
const type = getComponentForField(instance.field, schema) const type = getComponentForField(instance.field, schema)
if (!type) { if (!type) {
return null return null
@ -119,12 +128,6 @@
return { ...instance, ...pseudoComponentInstance } return { ...instance, ...pseudoComponentInstance }
} }
$: if (sanitisedFields) {
fieldList = [...sanitisedFields, ...unconfigured]
.map(buildSudoInstance)
.filter(x => x != null)
}
const processItemUpdate = e => { const processItemUpdate = e => {
const updatedField = e.detail const updatedField = e.detail
const parentFieldsUpdated = fieldList ? cloneDeep(fieldList) : [] const parentFieldsUpdated = fieldList ? cloneDeep(fieldList) : []