Table: Fix migrations from old angular table for cell color modes (#65760)

* Table: Fix migrations from old angular table

* Update defaults
This commit is contained in:
Torkel Ödegaard
2023-04-06 09:19:26 +02:00
committed by GitHub
parent c4c406aacd
commit 3843c73162
3 changed files with 150 additions and 141 deletions

View File

@@ -163,8 +163,10 @@ const migrateTableStyleToOverride = (style: Style) => {
if (style.colorMode) {
override.properties.push({
id: 'custom.displayMode',
value: colorModeMap[style.colorMode],
id: 'custom.cellOptions',
value: {
type: colorModeMap[style.colorMode],
},
});
}
@@ -200,11 +202,11 @@ const migrateDefaults = (prevDefaults: Style) => {
displayName: prevDefaults.alias,
custom: {
align: prevDefaults.align === 'auto' ? null : prevDefaults.align,
displayMode: colorModeMap[prevDefaults.colorMode],
},
},
isNil
);
if (prevDefaults.thresholds.length) {
const thresholds: ThresholdsConfig = {
mode: ThresholdsMode.Absolute,
@@ -212,6 +214,12 @@ const migrateDefaults = (prevDefaults: Style) => {
};
defaults.thresholds = thresholds;
}
if (prevDefaults.colorMode) {
defaults.custom.cellOptions = {
type: colorModeMap[prevDefaults.colorMode],
};
}
}
return defaults;
};