Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import type { EngineFieldSchema } from "store/features/engine/engineState";
import type { EngineFieldValue } from "shared/lib/entities/entitiesTypes";
import { evaluateConditions } from "shared/lib/conditionsFilter";
export const isEngineFieldVisible = (
field: EngineFieldSchema,
args: Record<string, EngineFieldValue>,
defaultValues: Record<string, number | string | boolean | undefined>,
ignoreConditions?: string[],
) => {
Iif (!field.conditions) {
return true;
}
return evaluateConditions(
field.conditions,
(key) => args[key]?.value ?? defaultValues[key],
ignoreConditions,
);
};
|