import React from 'react'; import { LowCodeSchema } from '../types'; export * from './templateEngine'; export interface SchemaRendererProps { schema: LowCodeSchema; values: Record; config?: { ALLOWED_TAGS?: string[]; ALLOWED_ATTR?: string[]; }; fallbackContent?: React.ReactNode; useDefaultValues?: boolean; debug?: boolean; onRenderSuccess?: (html: string) => void; /** 沙箱配置 */ sandboxConfig?: { /** 是否启用沙箱模式 */ enabled?: boolean; /** 允许的全局对象列表 */ allowedGlobals?: string[]; /** 禁止的全局对象列表 */ forbiddenGlobals?: string[]; /** 是否允许访问 DOM */ allowDOM?: boolean; /** 执行超时时间(毫秒) */ timeout?: number; /** 是否启用严格模式 */ strictMode?: boolean; }; } /** * SchemaRenderer 组件 - Schema渲染器组件 * * 该组件根据JSON Schema和模板引擎渲染动态内容,支持模板语法、数据验证、错误处理等。 * 提供安全的内容渲染、模板解析、错误边界等功能。 * * @component * @description Schema渲染器组件,根据Schema和模板渲染动态内容 * @param {SchemaRendererProps} props - 组件属性 * @param {LowCodeSchema} props.schema - 渲染Schema定义 * @param {Record} props.values - 渲染数据值 * @param {Object} [props.config] - 渲染配置 * @param {string[]} [props.config.ALLOWED_TAGS] - 允许的HTML标签 * @param {string[]} [props.config.ALLOWED_ATTR] - 允许的HTML属性 * @param {React.ReactNode} [props.fallbackContent] - 回退内容 * @param {boolean} [props.useDefaultValues=true] - 是否使用默认值 * @param {boolean} [props.debug=true] - 是否启用调试模式 * * @example * ```tsx * {{title}}

{{content}}

' * } * }} * values={{ * title: '欢迎', * content: '这是一个动态渲染的内容' * }} * config={{ * ALLOWED_TAGS: ['h1', 'p', 'div'], * ALLOWED_ATTR: ['class', 'style'] * }} * /> * ``` * * @returns {React.ReactElement} 渲染的动态内容组件 * * @remarks * - 根据Schema和模板引擎渲染内容 * - 支持Mustache模板语法 * - 提供数据验证功能 * - 包含错误边界处理 * - 支持安全的内容渲染 * - 提供调试模式 * - 支持默认值处理 * - 响应式布局适配 */ export declare const SchemaRenderer: React.FC;