PR Feedback and fixes for the edit field popover
This commit is contained in:
parent
61cbd45806
commit
4a1e969b7c
|
@ -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 (
|
||||
|
|
|
@ -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) : []
|
||||
|
|
Loading…
Reference in New Issue