Table: Fixes issue with fixed min and auto max with bar gauge cell (#31316)

This commit is contained in:
Torkel Ödegaard
2021-02-18 16:56:47 +01:00
committed by GitHub
parent debb82e124
commit e9576853c1

View File

@@ -65,14 +65,20 @@ function getMinMaxAndDelta(field: Field): NumericRange {
};
}
/**
* @internal
*/
export function getFieldConfigWithMinMax(field: Field, local?: boolean): FieldConfig {
const { config } = field;
let { min, max } = config;
if (isNumber(min) && !isNumber(max)) {
return config; // noop
if (isNumber(min) && isNumber(max)) {
return config;
}
if (local || !field.state?.range) {
return { ...config, ...getMinMaxAndDelta(field) };
}
return { ...config, ...field.state.range };
}