1
0
Fork 0
mirror of synced 2024-07-07 07:15:43 +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
)
resetFields?.forEach(setting => {
if (component[setting.key]) {
component[setting.key] = null
}
component[setting.key] = null
})
if (

View file

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