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
|
setting => name === setting.resetOn
|
||||||
)
|
)
|
||||||
resetFields?.forEach(setting => {
|
resetFields?.forEach(setting => {
|
||||||
if (component[setting.key]) {
|
component[setting.key] = null
|
||||||
component[setting.key] = null
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -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) : []
|
||||||
|
|
Loading…
Reference in New Issue