UNPKG

@schema-render/form-render-react

Version:

Out-of-the-box form rendering library based on Core and Antd.

50 lines (49 loc) 2.35 kB
import type { IBaseSchema, IRootSchema } from '@schema-render/core-react'; import type { CheckboxOptionType } from 'antd'; import type { ReactNode } from 'react'; import type { IInnerFormRenderProps } from '../typings'; type IAntdOptions = Array<CheckboxOptionType | string | number>; /** * 添加操作行为 Schema */ export declare function addActionsSchema(schema: IRootSchema, actionsRestSchema?: Partial<IBaseSchema>): { properties: { [x: string]: import("@schema-render/core-react").IObjectSchema<string> | import("@schema-render/core-react").IArraySchema<string> | IBaseSchema<string> | { renderType: string; type?: import("@schema-render/core-react").IType | undefined; renderOptions?: import("@schema-render/core-react").IObjectAny | undefined; title?: string | undefined; titleDescription?: string | undefined; description?: string | undefined; required?: string | boolean | undefined; disabled?: string | boolean | undefined; readonly?: string | boolean | undefined; hidden?: string | boolean | undefined; className?: string | undefined; style?: import("@schema-render/core-react").IObjectAny | undefined; span?: number | undefined; spanStart?: number | undefined; rules?: import("@schema-render/core-react").IRuleItem[] | undefined; }; }; renderType: "Root"; }; /** * 计算 normal 模式下 actions 左偏移值 */ export declare function calcActionsMarginLeft({ itemLayout, labelWidth, labelGap, }: Pick<IInnerFormRenderProps, 'itemLayout' | 'labelWidth' | 'labelGap'>): number; /** * 获取 Antd options 选项 label 数据 * @param options Antd options * @param checkedValues label 对应的 value 值,可以多个 */ export declare function getOptionsLabels(options?: IAntdOptions, checkedValues?: (CheckboxOptionType['value'] | undefined)[]): ReactNode[]; /** * 查找选中的 Antd options 选项数据 */ export declare function getCheckedOptions(options?: IAntdOptions, checkedValues?: CheckboxOptionType['value'][]): CheckboxOptionType[]; /** * 校验是否是空值:null、undefined 和空字符串判断为空 */ export declare function isEmpty(value: unknown): value is null | undefined | ''; export {};