import type { IPlatformComponent } from './platform/component'; export declare namespace LCDS { /** * 低码组件库开发规范 (LCDS, Lowcode Components Development Specification) * * 基于 LCDS 开发的组件库, 可以在云开发低码平台内使用 */ /** * 低码的平台方法的开发配置 */ export interface IAction { /** * 选填, 平台方法的唯一标识 * @maxLength 214 * @minLength 1 */ name?: string; /** * 选填, 平台方法可以接收的数据 * 需要符合 JSON SCHEMA 规范 * @default {} */ data?: any; /** * 选填, 组件对外开放的只读属性,可通过 $w.id1.xx 获取 * 需要符合 JSON SCHEMA 规范 */ properties?: any; /** * 选填, 平台方法适配的平台 * * 如果该字段为空, 则进行智能推断 */ platforms?: string[]; /** * 选填, 仅用于在低码平台的信息展示 */ meta?: { /** * 选填, 平台方法的别名, 建议用中文 */ title?: string; /** * 选填, 平台方法的简介, 建议用中文 */ description?: string; }; /** * 选填, 扩展字段, 尽量避免用 */ extra?: any; } /** * 低码组件开发配置 */ export interface IComponent { /** * 选填, 组件唯一标识 * @maxLength 214 * @minLength 1 */ name?: string; /** * 选填, 组件可以接收的数据, 用作组件props入参 * 需要符合 JSON SCHEMA 规范 * @default {} */ data?: any; /** * 选填, 组件可以被捕获的事件信息 * @default [] */ events?: IEvent[]; /** * 选填,组件样式 API */ classes?: IClasses[]; /** * 选填,组件属性 API, Object 类型 json schema */ properties?: any; /** * 选填,组件内定义的自定义方法 * @default [] */ methods?: IMethod[]; /** * 选填, 组件需要在运行时获取的配置项 * @deprecated */ compConfig?: { /** * 选填, 组件是否开启数据容器功能 * - 默认为 false * - 设置为 true 后,在组件内可通过调用 `onDataChange` 事件将内部数据挂载到组件的 `$context` 上下文对象 */ isDataContainer?: boolean; /** * 选填, 组件类型 * * 支持将表单类组件设置为 `formField`,即可在表单容器中收集值 */ componentType?: string; }; /** * 选填, 组件适配的平台 * * 如果该字段为空, 则进行智能推断 */ platforms?: string[]; /** * 选填, 仅用于在低码平台的信息展示 */ meta?: { /** * 选填, 组件英文标识 */ name?: string; /** * 选填, 用于生成组件 id 的前缀标识 */ componentName?: string; /** * 选填, 组件别名, 建议用中文 */ title?: string; /** * 选填, 组件简介, 建议用中文 */ description?: string; /** * 选填, 组件图标, 支持本地图片(大纲树里面用的) */ icon?: string; /** * 选填, 组件大图标 (组件列表里用的) */ figureIcon?: string; /** * 必填, 组件分类, 建议用中文 */ category: string; /** * 选填, 组件的排序权重 * @minimum 1 * @maximum 10000 */ componentOrder?: number; /** * 选填, 组件生效的平台 */ platform?: XPlatform[]; /** * 选填, 组件可见性配置 * * 默认均显示 * - `[]` 表示隐藏 * - `['APP']` 表示只在应用编辑器显示 * - `['COMPONENT']` 表示只在组件编辑器显示 */ visible?: VisibleItem[]; /** * 选填,组件模板配置 * {@link https://tapd.woa.com/20422223/prong/stories/view/1020422223884227747 使用文档} */ templates?: ITemplate[]; /** * 选填, 标识旧组件废弃,控制单组件升级按钮显隐 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002411487 使用文档} */ deprecated?: boolean; /** * 选填, 单组件渲染模式[升级/替换] * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002411487 使用文档} */ renderMode?: IRenderMode[]; /** * 选填, 组件说明文档的地址 */ docsUrl?: string; /** * 选填, 组件快捷编辑协议 */ shortcut?: IShortcut; /** * 选填,组件上下文协议 * * 配置后可通过 `$context.id.state.xx` 读取属性值 * @deprecated */ contextData?: { [key: string]: any; }; /** * 选填,组件相对位置限制 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002466153 使用文档} */ positionConstraint?: { /** * 可选,允许子组件类型 */ allowChildren?: { /** * 组件对应类型,对应 `componentConfig.componentType` */ componentType: string; /** * 是否允许为隔代子组件 */ recursive?: boolean; /** * 用户犯错提示 */ tip?: string; }[]; /** * 可选,允许父组件类型 */ allowParent?: { /** * 组件对应类型,对应` componentConfig.componentType` */ componentType: string; /** * 是否允许为隔代父组件 */ recursive: boolean; /** * 用户犯错提示 */ tip?: string; }[]; }; /** * 选填,搜索关键词 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002460167 使用文档} */ keyWords?: string[]; /** * 选填,属性面板提示,支持 markdown * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002460139 使用文档} */ propertyPanelTips?: string; /** * 选填,样式面板提示 */ stylePanelTips?: string; /** * 选填,禁用升级应用内所有的组件 */ disableUpgradeAll?: boolean; /** * 选填,检查功能 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002459983 使用文档} */ validate?: { /** * 规则名称 */ rule: string; options?: { /** * 标题,支持 markdown */ title: string; /** * 描述,支持 markdown */ description: string; /** * 类型 */ type: string; /** * 名称 */ name?: string; /** * 标签 */ label?: string; /** * 提示 */ tooltip?: string; /** * 选填,版本,版本,支持 markdown */ version?: string; /** * 可选,是否允许失败 */ allowFailure?: boolean; /** * 可选,限制当前选中平台,不填不限制,默认为 null */ matchedSelectedPlatform?: ('h5' | 'miniprogram' | 'pc')[]; /** * 可选,限制当前发布平台,不填不限制,默认为 'all' */ matchedPublishedPlatform?: ('web' | 'miniprogram' | 'all')[]; /** * 特殊字段,因 rule 的不同而不同 */ extra?: any; action?: { [key: string]: any; }; [k: string]: unknown; }; }[]; /** * 选填,样式配置属性屏蔽 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002470249 使用文档} */ inlineStyleForm?: { [key: string]: { visible: boolean; } | boolean; } | { $blockedAll: true; }; /** * 选填,属性分组信息 */ group?: { [key: string]: { 'x-index': number; expand: boolean; }; }; /** * 组件使用示例缩略图 */ previewImageUrl?: string; /** * 组件类型 */ componentType?: string; /** * preview 配置按钮 * {@link https://tapd.woa.com/TCB_new/markdown_wikis/show/#1220422223002676991 使用文档} */ previewOperation?: { /** * 选填,头部图标 */ headerIcon?: string; /** * 操作配置 */ operation: { /** 图标 */ icon: string; /** 标题 */ title: string; /** 行为,由编辑器提供 */ action: string; }[]; /** * 操作区域会插入的插槽名称 */ previewSlotName?: string; /** * 选填,插入插槽名称 * * - 指定拖动时插入的插槽名称 * - 比如 指定为 `contentSlot`,如果 `form` 指定了值为 `contentSlot`,则会插入到 `contentSlot` 中,而不是 `form` 里 */ insertSlotName?: string; }; queryGeneratorConfig?: { sceneConfig: { scenes: Array; availableScenes: Array; validCombinations: Array; enableSelectMultiple?: boolean; }; fieldsConfig?: { /** 是否支持配置 format? */ enableConfigFormat?: boolean; /** 是否显示字段标识的列? */ showFieldTypeColumn?: boolean; enableSelectFieldFormType?: boolean; }; apisConfig?: { /** 是否配置 record 和 total 的键值? */ enableConfigRecordAndTotalKey: boolean; }; mysqlConfig?: { /** 是否自动生成查询总条数语句? */ autoGenerateCountQuery?: boolean; /** * 计数名字 * * 表示 `SELECT COUNT(*) as count FROM xxx;` 的 `count`,如果指定 `countName` 为 `abc`,则输出 `sql SELECT COUNT(*) as abc FROM xxx;` */ countName?: string; }; /** * 绑定路径配置 * * 如果没有配置,默认就是 `params`,举例说明: * - 配置 `select.condition` 为 `'params.abc'`,则输出的 SQL 为 `SELECT aa FROM xxx WHERE key={{params.abc}}` * - 配置 `create.value` 为 `'params.hello'`,则输出的 SQL 为 `INSERT INTO xxx (a, b) VALUES ({{params.hello.a}}, {{params.hello.b }})` */ bindParamsPath?: Partial>>>; quickOperateButton?: { icon: string; targetField: string; content: string; }[]; }; globalConfig?: { [key: string]: any; }; }; /** * 选填, 扩展字段, 尽量避免用 */ extra?: any; /** * 选填, 是否容器组件 * * 容器可以包含子节点,但是不能配置插槽 */ isContainer?: boolean; /** * 默认样式 * defaultStyles 接收一个React.CSSProperties对象 */ defaultStyles?: { [key: string]: any; }; /** * 组件所包含的子组件树 */ items?: IPlatformComponent[]; } type Scene = 'batchCreate' | 'batchSelect' | 'batchDelete' | 'create' | 'select' | 'update'; type SceneTarget = 'condition' | 'value' | 'limit' | 'offset'; /** * 低码组件可以被捕获的事件信息 */ export interface IEvent { /** * 必填, 用作抛出和捕获事件的唯一标识 */ name: string; /** * 选填, 事件别名, 用于低码平台展示 */ title: string; /** * 选填 事件描述 */ description?: string; /** * 选填,事件生效的平台 */ 'x-platforms'?: XPlatform[]; /** * 事件参数对象 */ detail?: { [key: string]: any; }; } /** * 低码组件可以暴露的自定义方法 */ export interface IMethod { /** * 必填, 用作组件方法的唯一标识 */ name: string; /** * 必填, 组件方法别名, 用于低码平台展示 */ label: string; /** * 选填, 组件方法可以接收的数据 * 需要符合 JSON SCHEMA 规范 * * @default {} */ params?: any; /** * 选填, 组件自定义方法适配的平台 */ 'x-platforms'?: string[]; /** * 选填, 组件方法描述 */ description?: string; } export interface IRenderMode { /** * 必填, 转换的目标组件名称 */ component: string; /** * 必填, 表示升级还是替换 */ renderType: 'update' | 'replace'; /** * 选填, [源组件的属性路径]:[转换目标组件的属性路径] 标记属性路径的映射关系 */ props?: { [name: string]: string; }; /** * 选填, 表示升级组件所属组件库,默认与废弃组件同库 */ materialName?: string; /** * 选填, 升级说明 */ description?: string; } /** 组件/方法/属性所支持的平台 */ export type XPlatform = `${EPlatform}`; /** 组件/方法/属性所支持的平台枚举值 */ export enum EPlatform { /** * Web 端 * * *包含 `PCWEB` 和 `MOBILEWEB`* */ WEB = "WEB", /** * 移动端 * * *包含 `MP` 和 `MOBILEWEB`* */ MOBILE = "MOBILE", /** 小程序端 */ MP = "MP", /** 桌面 Web 端 */ PCWEB = "PCWEB", /** 移动 Web 端 */ MOBILEWEB = "MOBILEWEB" } /** 组件在应用编辑器/低码编辑器的生效情况*/ export type VisibleItem = 'APP' | 'COMPONENT'; /** 组件模板配置 */ export interface ITemplate { /** * 插入模板的节点或插槽 * 不设置或设置 $children 表示插入到当前组件,可配置多个节点或插槽并用逗号隔开 */ to?: '$children' | string; /** * 插入模板的时机 * 不设置或设置 $attached 表示刚拖入组件时执行,可配置多个属性名称并用逗号隔开 */ when?: '$attached' | string; /** * 插入的模板主体 * 目前仅支持 toml 配置语法,结构内容参考组件 CALS */ body?: string; /** * 插入模板时自动选中的节点 * 如 template[0] 表示选中所插入模板的第1个节点 */ autoSelectPath?: `template${string}`; /** * 见文档 https://iwiki.woa.com/p/4009680778#templatesindexremain */ remain?: string; } /** 组件快捷编辑协议 */ export interface IShortcut { /** * 选填,快捷编辑面板中支持的组件属性 */ props?: string[]; /** * 选填,快捷编辑面板中支持拖入的组件 */ extra?: { [key: string]: { 'x-component': 'container'; 'x-component-props'?: string[]; 'x-index'?: number; 'x-insert-path'?: string; }; }; } /** 组件样式 API */ export interface IClasses { /** * 样式名称 */ name: string; /** * 样式选择器 */ selector: string; /** * 样式片段代码(需要填写完整的样式代码) */ code?: string; /** * 样式说明 */ description?: string; } export {}; } //# sourceMappingURL=lcds.d.ts.map