FieldOverrides: Add value mappings editor to standard config properties registry (#22648)

This commit is contained in:
Dominik Prokop
2020-03-09 15:09:32 +01:00
committed by GitHub
parent 9716289196
commit 9d858220ce
4 changed files with 141 additions and 5 deletions

View File

@@ -136,8 +136,6 @@ export function applyFieldOverrides(options: ApplyFieldOverrideOptions): DataFra
}
}
// console.log(config)
// Try harder to set a real value that is not 'other'
let type = field.type;
if (!type || type === FieldType.other) {
@@ -242,7 +240,6 @@ function setDynamicConfigValue(config: FieldConfig, value: DynamicConfigValue, c
export function setFieldConfigDefaults(config: FieldConfig, defaults: FieldConfig, context: FieldOverrideEnv) {
if (defaults) {
const keys = Object.keys(defaults);
for (const key of keys) {
if (key === 'custom') {
if (!context.custom) {
@@ -275,6 +272,11 @@ const processFieldConfigValue = (
const currentConfig = destination[key];
if (currentConfig === null || currentConfig === undefined) {
const item = registry.getIfExists(key);
if (!item) {
console.warn(`No processor available for ${key} config property`);
return;
}
if (item && item.shouldApply(context.field!)) {
const val = item.process(source[key], context, item.settings);
if (val !== undefined && val !== null) {