v0.7.3
This commit is contained in:
Vendored
+135
@@ -0,0 +1,135 @@
|
||||
import React from 'react';
|
||||
|
||||
/** rc-field-form 内部钩子的注册标识 */
|
||||
declare const HOOK_MARK: "RC_FORM_INTERNAL_HOOKS";
|
||||
/**
|
||||
* 按布局 code 拉取布局结构定义(字段、主题、栅格设置等),code 变化时重新请求
|
||||
* @param {string} code 布局的唯一编码
|
||||
* @returns {Object} 布局结构数据,初始为 `{ items: [] }`
|
||||
*/
|
||||
declare function useStructure(code: string): any;
|
||||
/**
|
||||
* 关联表单字段值,支持初始值表达式求值、watch 联动更新以及经 DataConverter 转换后的展示值
|
||||
* @param {string} name 字段名(rc-field-form 的字段路径)
|
||||
* @param {Object} setting 字段取值相关配置
|
||||
* @param {*} [setting.initialValue] 初始值,或语言为 javascript 时的表达式源码
|
||||
* @param {string} [setting.initialValueLanguage] 初始值类型,'javascript' 时把 initialValue 当表达式执行
|
||||
* @param {*} [setting.convertJs] 用于生成展示值的转换表达式(交给 DataConverter 处理)
|
||||
* @param {*} [setting.convertJsSetting] convertJs 表达式的附加配置
|
||||
* @param {string} [setting.type='string'] 字段值的目标类型,用于类型转换
|
||||
* @param {*} [pContext] 表达式里 getFieldValueForBasicForm 取值用的外层表单实例
|
||||
* @returns {[*, *]} [经 convertJs 转换后的展示值(未配置时等于原值), 原始字段值]
|
||||
*/
|
||||
declare function useField(name: string, { initialValue, initialValueLanguage, convertJs, convertJsSetting, type, }: {
|
||||
initialValue?: any;
|
||||
initialValueLanguage?: string;
|
||||
convertJs?: any;
|
||||
convertJsSetting?: any;
|
||||
type?: string;
|
||||
}, pContext?: any): [any, any];
|
||||
/**
|
||||
* 按 (y, x) 排序将字段列表归一化为渲染项列表(每项已用给定的 ItemWidget 渲染成元素)
|
||||
* @param {Array} fields 字段配置列表
|
||||
* @param {Function} ItemWidget 用于渲染每个字段的组件
|
||||
* @param {*} [basicForm] 传给每个字段渲染项的外层表单实例
|
||||
* @returns {Array} 已排序并渲染完成的元素列表
|
||||
*/
|
||||
declare function useGridLayoutFields(fields: any[], ItemWidget: Function, basicForm?: any): any[];
|
||||
/**
|
||||
* 执行一段 JS 表达式/函数并跟踪其依赖的表单字段,依赖字段变化时自动重新执行
|
||||
* @param {string} fn 要执行的表达式源码,为空时直接返回 initialValue
|
||||
* @param {*} initialValue 初始值/执行出错时的回退值
|
||||
* @param {Object} [params] 传给表达式的额外参数
|
||||
* @param {Object} [fns] 传给表达式的额外可调用函数
|
||||
* @param {*} [basicForm] 表达式里 getFieldValueForBasicForm 取值用的外层表单实例
|
||||
* @param {string} [resultType] 结果值的目标类型,用于类型转换
|
||||
* @returns {[*, *]} [执行结果(按 resultType 转换后), 执行出错时的错误对象]
|
||||
*/
|
||||
declare function useFnRun(fn: string, initialValue: any, params?: any, fns?: any, basicForm?: any, resultType?: string): [any, any];
|
||||
|
||||
/**
|
||||
* 按 widget 标识异步加载并渲染对应的部件组件,加载完成前不渲染任何内容;
|
||||
* 加载出错时渲染错误信息文本
|
||||
* @param {Object} props
|
||||
* @param {string} [props.widget] 部件标识;以 `@` 或 `blob:` 开头时按原样使用,否则拼接 widgetPrefix 前缀
|
||||
* @param {string} [props.widgetPrefix='@pkg/ff/grid-layouts'] widget 非绝对标识时使用的前缀
|
||||
* @param {*} [props.basicForm] 表达式求值/字段联动用的外层表单实例
|
||||
*/
|
||||
declare function GridLayoutWidget({ widget, widgetPrefix, basicForm, ...props }: {
|
||||
widget?: string;
|
||||
widgetPrefix?: string;
|
||||
basicForm?: any;
|
||||
}): undefined;
|
||||
|
||||
/**
|
||||
* 按 theme 标识异步加载主题外壳组件,并把每个分组(items)渲染成 itemRender 生成的内容后传给主题组件;
|
||||
* theme 未指定时不渲染,加载出错时渲染错误信息文本
|
||||
* @param {Object} props
|
||||
* @param {string} [props.theme] 主题组件标识,通过 core.getWidgetComponent 加载
|
||||
* @param {*} [props.basicForm] 传给主题组件及各分组内容的外层表单实例
|
||||
* @param {Array} [props.items=[{key:'default',label:'默认'}]] 分组配置列表
|
||||
* @param {Array} [props.fields=[]] 全部布局字段,按分组 key 过滤后分给对应 items 项
|
||||
* @param {Function} [props.itemRender] 生成单个分组渲染内容的函数,签名为 (item, fields, children)
|
||||
* @param {Array} [props.chunks=[]] 额外附加在 items 之后、不参与过滤的分组项
|
||||
* @param {*} [props.children] 仅附加给 key 为 'default' 的分组的内容
|
||||
* @param {Object} [props.$setting={}] 传给主题组件的基础设置,会与 themeSetting 合并
|
||||
*/
|
||||
declare function GridLayoutFramework({ theme, basicForm, items, fields, itemRender, chunks, children, $setting, ...themeSetting }: {
|
||||
theme?: string;
|
||||
basicForm?: any;
|
||||
items?: any[];
|
||||
fields?: any[];
|
||||
itemRender?: Function;
|
||||
chunks?: any[];
|
||||
children?: any;
|
||||
$setting?: any;
|
||||
}): undefined;
|
||||
|
||||
/**
|
||||
* 栅格布局容器,按 fields 描述的位置/尺寸渲染各字段部件,并托管一个 rc-field-form 表单;
|
||||
* 指定 theme 时委托 GridLayoutFramework 渲染主题外壳,否则直接渲染默认分组
|
||||
* @param {Object} props
|
||||
* @param {string} [props.name] 表单字段容器名(即 __LAYOUT_KEY__ 语义,由 GridLayoutHoc 传入)
|
||||
* @param {*} [props.form] 外部传入的 rc-field-form 表单实例,不传时内部自建
|
||||
* @param {*} [props.basicForm] 表达式求值/字段联动用的外层表单实例
|
||||
* @param {Object} [props.style] 容器行内样式
|
||||
* @param {string} [props.className] 容器额外 class 名
|
||||
* @param {number} [props.cols=12] 栅格列数
|
||||
* @param {number} [props.rowHeight=21] 栅格行高(px)
|
||||
* @param {[number, number]} [props.containerPadding=[0, 0]] 容器内边距 [纵向, 横向](px)
|
||||
* @param {[number, number]} [props.itemMargin=[4, 0]] 字段项间距 [纵向, 横向](px)
|
||||
* @param {Object} [props.formProps={}] 注入为 `__PROPS__` 字段值的表单级参数
|
||||
* @param {Array} [props.formFields=[]] 额外注入的表单字段(与 formProps 一并作为初始 fields)
|
||||
* @param {Array} [props.fields=[]] 布局字段配置列表(位置、尺寸、部件类型等)
|
||||
* @param {Object} [props.data] 初始化/回填表单的数据
|
||||
* @param {string} [props.theme] 主题组件标识,指定时通过 GridLayoutFramework 渲染主题外壳
|
||||
* @param {Object} [props.themeProps={}] 传给主题组件的额外参数
|
||||
* @param {Array} [props.groups=[{key:'default',label:'默认'}]] 字段分组配置,用于主题多分组渲染
|
||||
* @param {*} [props.children] 附加渲染在字段项之后的内容
|
||||
*/
|
||||
declare function GridLayout({ name, form: initForm, basicForm, style, className, cols, rowHeight, containerPadding, itemMargin, formProps, formFields, fields, data, theme, themeProps, groups, children, ...props }: {
|
||||
name?: string;
|
||||
form?: any;
|
||||
basicForm?: any;
|
||||
style?: any;
|
||||
className?: string;
|
||||
cols?: number;
|
||||
rowHeight?: number;
|
||||
containerPadding?: [number, number];
|
||||
itemMargin?: [number, number];
|
||||
formProps?: any;
|
||||
formFields?: any[];
|
||||
fields?: any[];
|
||||
data?: any;
|
||||
theme?: string;
|
||||
themeProps?: any;
|
||||
groups?: any[];
|
||||
children?: any;
|
||||
}): React.JSX.Element;
|
||||
declare const _default: ({ code, data, ...props }: {
|
||||
[x: string]: any;
|
||||
code: any;
|
||||
data: any;
|
||||
}) => React.JSX.Element;
|
||||
|
||||
export { GridLayout, GridLayoutFramework, GridLayoutWidget, HOOK_MARK, _default as default, useField, useFnRun, useGridLayoutFields, useStructure };
|
||||
Reference in New Issue
Block a user