Render depends on menu items conditionally in chart settings + fix min max values (#15391)

closes
https://discord.com/channels/1130383047699738754/1430894689317294152

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
This commit is contained in:
nitin
2025-10-30 20:56:37 +05:30
committed by GitHub
parent 2510cbf614
commit ab0cb67686
8 changed files with 185 additions and 77 deletions
@@ -0,0 +1,22 @@
import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds';
import { type ChartSettingsItem } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup';
import { isNonEmptyString } from '@sniptt/guards';
export const shouldHideChartSetting = (
item: ChartSettingsItem,
objectMetadataId: string,
isGroupByEnabled: boolean,
): boolean => {
const hasNoObjectMetadata = !isNonEmptyString(objectMetadataId);
const dependsOnSource = item?.dependsOn?.includes(
CHART_CONFIGURATION_SETTING_IDS.SOURCE,
);
const dependsOnGroupBy = item?.dependsOn?.includes(
CHART_CONFIGURATION_SETTING_IDS.GROUP_BY,
);
return (
(hasNoObjectMetadata && (dependsOnSource ?? false)) ||
(!isGroupByEnabled && (dependsOnGroupBy ?? false))
);
};