fix(ag-grid): fix conditional formatting theme colors and module extensibility (#35605)

This commit is contained in:
Gabriel Torres Ruiz
2025-10-22 21:39:00 -04:00
committed by GitHub
parent 79918a7939
commit 5e4a80e5d0
14 changed files with 243 additions and 82 deletions

View File

@@ -76,7 +76,7 @@ export default memo(function ColumnConfigItem({
alignItems: 'center',
position: 'absolute',
right: 3 * sizeUnit,
top: 3 * sizeUnit,
top: 4 * sizeUnit,
transform: 'translateY(-50%)',
gap: sizeUnit,
color: theme.colorTextSecondary,

View File

@@ -17,7 +17,7 @@
* under the License.
*/
import { useMemo, useState, useEffect } from 'react';
import { styled, SupersetTheme, t, useTheme } from '@superset-ui/core';
import { styled, t } from '@superset-ui/core';
import { GenericDataType } from '@apache-superset/core/api/core';
import {
Comparator,
@@ -56,10 +56,11 @@ const JustifyEnd = styled.div`
justify-content: flex-end;
`;
const colorSchemeOptions = (theme: SupersetTheme) => [
{ value: theme.colorSuccessBg, label: t('success') },
{ value: theme.colorWarningBg, label: t('alert') },
{ value: theme.colorErrorBg, label: t('error') },
// Use theme token names instead of hex values to support theme switching
const colorSchemeOptions = () => [
{ value: 'colorSuccessBg', label: t('success') },
{ value: 'colorWarningBg', label: t('alert') },
{ value: 'colorErrorBg', label: t('error') },
];
const operatorOptions = [
@@ -238,9 +239,8 @@ export const FormattingPopoverContent = ({
columns: { label: string; value: string; dataType: GenericDataType }[];
extraColorChoices?: { label: string; value: string }[];
}) => {
const theme = useTheme();
const [form] = Form.useForm();
const colorScheme = colorSchemeOptions(theme);
const colorScheme = colorSchemeOptions();
const [showOperatorFields, setShowOperatorFields] = useState(
config === undefined ||
(config?.colorScheme !== ColorSchemeEnum.Green &&