Beta The evaluation function that determines if the condition is met.
This predicate function receives the subject to evaluate and optional parameters
for configuration. It should return true if the condition is satisfied,
false otherwise.
The function should be pure and side-effect free when possible, as it may be called frequently during UI rendering and updates.
true if the condition is met, false otherwise.
May throw an error if params has an unexpected type or required data is missing.
Simple boolean check
const evaluate = (deal: LimeObject) => deal.dealstatus === 'won';
Using params for configuration
const evaluate = (obj: LimeObject, params?: { propertyName: string }) => {
return obj.getValue(params.propertyName) !== null;
};
The value to evaluate. Type depends on the condition type. For 'limeobject' conditions, this is a LimeObject. For 'action' conditions, this is an Action.
Optional params: unknownOptional configuration data for the evaluation. Can be used to pass context-specific values like field names, thresholds, or other criteria. The evaluation function should validate params if used.
Unique identifier for this condition.
The ID is used to reference the condition when registering, removing, or looking it up from the ConditionRegistry. It must be unique across all registered conditions.
The type of subject this condition evaluates.
Common types include:
limeobject - Evaluates LimeObject instancesaction - Evaluates Action instancesCustom types can be defined for specialized evaluation contexts.
Represents a conditional evaluation rule that can be registered and used throughout the application.
Conditions are predicate functions that determine whether certain UI elements should be visible, enabled, or available based on runtime state. For example, they can be used to:
Each condition has a unique ID and a type that indicates what kind of subject it evaluates. The most common types are 'limeobject' and 'action', but custom types can be defined.
Example
Registering a simple LimeObject condition
Example
Condition with additional parameters
See