feat: add conditional logic types (ConditionOperator, ConditionRule, FieldConditions)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ad9a2cfbb0
commit
e334ad7aab
1 changed files with 27 additions and 0 deletions
27
src/types.ts
27
src/types.ts
|
|
@ -17,6 +17,31 @@ export type FieldType =
|
|||
| 'color'
|
||||
| 'time';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Conditional Logic
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type ConditionOperator =
|
||||
| 'equals'
|
||||
| 'not_equals'
|
||||
| 'contains'
|
||||
| 'not_contains'
|
||||
| 'is_empty'
|
||||
| 'is_not_empty'
|
||||
| 'greater_than'
|
||||
| 'less_than';
|
||||
|
||||
export interface ConditionRule {
|
||||
fieldId: string;
|
||||
operator: ConditionOperator;
|
||||
value?: unknown;
|
||||
}
|
||||
|
||||
export interface FieldConditions {
|
||||
logic: 'and' | 'or';
|
||||
rules: ConditionRule[];
|
||||
}
|
||||
|
||||
export interface FormField {
|
||||
id: string;
|
||||
label: string;
|
||||
|
|
@ -34,6 +59,8 @@ export interface FormField {
|
|||
max?: number;
|
||||
/** For slider: step increment. */
|
||||
step?: number;
|
||||
/** Conditional visibility rules. If undefined, field is always visible. */
|
||||
conditions?: FieldConditions;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue