import { I as IEntityData } from './index-0OEeDC7T.mjs'; /** Dropdown/select option */ interface IOption { /** The option value (used for selection state) */ value: string | number; /** Display label shown to the user */ label: string; /** Whether this option is disabled (visible but not selectable) */ disabled?: boolean; /** Grouping label for option groups (e.g., select optgroup) */ group?: string; /** Icon identifier for rendering alongside the label */ icon?: string; /** Color indicator (e.g., for status badges) */ color?: string; } /** * Condition types for the v2 rule engine. * * Conditions can be field-level comparisons or logical combinations (AND/OR/NOT). * Used in IRule.when, IValidationRule.when, and IWizardStepCondition. */ /** A condition that compares a single field's value */ interface IFieldCondition { /** The field name to evaluate */ field: string; /** Comparison operator */ operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "greaterThanOrEqual" | "lessThanOrEqual" | "contains" | "notContains" | "startsWith" | "endsWith" | "in" | "notIn" | "isEmpty" | "isNotEmpty" | "matches" | "arrayContains" | "arrayNotContains" | "arrayLengthEquals" | "arrayLengthGreaterThan" | "arrayLengthLessThan"; /** The value to compare against. Not required for isEmpty/isNotEmpty. */ value?: unknown; } /** A logical combination of conditions */ interface ILogicalCondition { /** Logical operator to combine child conditions */ operator: "and" | "or" | "not"; /** Child conditions to combine */ conditions: ICondition[]; } /** Union type: either a field comparison or a logical combination */ type ICondition = IFieldCondition | ILogicalCondition; /** Type guard: checks if a condition is a logical condition (and/or/not) */ declare function isLogicalCondition(condition: ICondition): condition is ILogicalCondition; /** Type guard: checks if a condition is a field condition */ declare function isFieldCondition(condition: ICondition): condition is IFieldCondition; /** * Unified validation rule configuration. * * Handles sync, async, and cross-field validation through a single interface. * Validators are resolved by name from the unified ValidationRegistry. */ interface IValidationRule { /** Validator name (resolved from the unified ValidationRegistry) */ name: string; /** Parameters passed to the validator function */ params?: Record; /** Custom error message (overrides the validator's default) */ message?: string; /** Whether this validator is async (returns a Promise) */ async?: boolean; /** Debounce delay in ms for async validators */ debounceMs?: number; /** Conditional validation: only run when this condition is met */ when?: ICondition; } /** * Effects applied by a rule when its condition is met (or in the else branch). * * Any property set here overrides the field's base config. * The `fields` property can affect OTHER fields (cross-field effects). */ interface IFieldEffect { /** Override required state */ required?: boolean; /** Override hidden state */ hidden?: boolean; /** Override readOnly state */ readOnly?: boolean; /** Override field label */ label?: string; /** Swap the component type */ type?: string; /** Replace dropdown options */ options?: IOption[]; /** Replace validation rules */ validate?: IValidationRule[]; /** Override computed value expression */ computedValue?: string; /** Override field ordering */ fieldOrder?: string[]; /** Directly set the field's value when the rule condition is met */ setValue?: unknown; /** Apply effects to OTHER fields (keyed by field name) */ fields?: Record; } /** * A declarative rule that conditionally modifies field state. * * Rules replace the v1 dependencies, dependencyRules, dropdownDependencies, * and orderDependencies with a single unified system. */ interface IRule { /** Optional rule identifier (for debugging/tracing) */ id?: string; /** Condition that determines whether this rule fires */ when: ICondition; /** Effects applied when the condition is true */ then: IFieldEffect; /** Effects applied when the condition is false */ else?: IFieldEffect; /** Priority for conflict resolution (higher = wins). Default: 0. */ priority?: number; } /** * Static configuration for a single form field (v2 schema). * * This is the primary consumer-facing type used to define forms. * All dependency, validation, and state-management concerns use * the unified `rules` and `validate` arrays. */ interface IFieldConfig { /** UI component type key (e.g., "Textbox", "Dropdown", "Toggle"). Must match a registered component. */ type: string; /** Display label for the field (required in v2). */ label: string; /** Whether the field is required for form submission. Can be overridden by rules. */ required?: boolean; /** Whether the field is hidden by default. Can be toggled by rules. */ hidden?: boolean; /** Whether the field is read-only (rendered but not editable). Can be toggled by rules. */ readOnly?: boolean; /** Default value applied when the field is visible and its current value is null/undefined. */ defaultValue?: unknown; /** Computed value expression. Uses $values.fieldName for references, $fn.name() for value functions. */ computedValue?: string; /** If true, computedValue only runs during create (not edit). */ computeOnCreateOnly?: boolean; /** Static dropdown/select options. */ options?: IOption[]; /** Validation rules (unified: sync, async, cross-field, conditional). */ validate?: IValidationRule[]; /** Business rules (unified: replaces dependencies, dependencyRules, dropdownDependencies, orderDependencies). */ rules?: IRule[]; /** Field array item configs (full IFieldConfig, not stripped). Keys are field names within an item. */ items?: Record; /** Minimum number of items in a field array. */ minItems?: number; /** Maximum number of items in a field array. */ maxItems?: number; /** Arbitrary metadata passed through to the field component (e.g., icons, sort settings). */ config?: Record; /** Short description shown as field tooltip or help text. */ description?: string; /** Placeholder text for empty fields. */ placeholder?: string; /** Extended help text (e.g., shown in a popover or below the field). */ helpText?: string; /** Whether changing this field triggers a confirmation modal before save. */ confirmInput?: boolean; /** If true, the field is not rendered when the form is in create mode. */ hideOnCreate?: boolean; /** If true, the field ignores the layout-level disabled/readOnly override. */ skipLayoutReadOnly?: boolean; /** Whether the field is disabled at the layout level. */ disabled?: boolean; /** * Async function that loads options dynamically for select/radio/checkbox fields. * When present, overrides the static `options` array with the resolved result. * Results are cached per unique combination of `optionsDependsOn` field values. */ loadOptions?: (context: { fieldId: string; values: IEntityData; }) => Promise; /** * Field IDs whose values trigger a re-run of `loadOptions` when they change. * If omitted, `loadOptions` is only called once on mount. */ optionsDependsOn?: string[]; } export { type IOption as I, type IFieldConfig as a, type ICondition as b, type IFieldEffect as c, type IValidationRule as d, type IFieldCondition as e, type ILogicalCondition as f, type IRule as g, isLogicalCondition as h, isFieldCondition as i };