/** * 规则构建器状态管理 Context * 使用 React Context + useReducer 模式实现全局状态管理 */ import React, { type ReactNode } from 'react'; import type { RuleBuilderState, RuleBuilderAction, RuleGroupDto, FieldDefinition, ValidationResult } from '../types'; /** * Context 类型定义 */ interface RuleBuilderContextValue { /** 当前状态 */ state: RuleBuilderState; /** Dispatch 方法 */ dispatch: React.Dispatch; } /** * Provider Props */ interface RuleBuilderProviderProps { /** 子组件 */ children: ReactNode; /** 初始规则组 */ initialRule?: RuleGroupDto; /** 字段定义列表 */ fields: FieldDefinition[]; } /** * RuleBuilder Provider 组件 */ export declare function RuleBuilderProvider({ children, initialRule, fields, }: RuleBuilderProviderProps): JSX.Element; /** * 使用 RuleBuilder Context 的 Hook * @throws {Error} 如果在 Provider 外部使用 */ export declare function useRuleBuilderContext(): RuleBuilderContextValue; /** * 便捷 Hook: 获取当前规则组 */ export declare function useRuleGroup(): RuleGroupDto; /** * 便捷 Hook: 获取字段列表 */ export declare function useFields(): FieldDefinition[]; /** * 便捷 Hook: 获取加载状态 */ export declare function useLoading(): boolean; /** * 便捷 Hook: 获取验证结果 */ export declare function useValidation(): ValidationResult; /** * 便捷 Hook: 获取修改状态 */ export declare function useIsDirty(): boolean; /** * 便捷 Hook: 获取 state */ export declare function useRuleBuilderState(): RuleBuilderState; /** * 便捷 Hook: 获取 dispatch */ export declare function useRuleBuilderDispatch(): React.Dispatch; /** * 便捷 Hook: 获取字段列表(别名,与 useFields 相同) */ export declare function useRuleBuilderFields(): FieldDefinition[]; /** * 便捷 Hook: 获取验证结果(别名,与 useValidation 相同) */ export declare function useRuleBuilderValidation(): ValidationResult; export {};