跳转到内容

typedFieldComponentPipe

typedFieldComponentPipe<S, C>(schema, _config, cb): S

Defined in: packages/react/src/util/typed-field-component-pipe.ts:160

typedFieldPipe + 组件类型约束的组合形态。

按「路径 + 组件」写配置:

  • 回调里的 field 与 builder.get(path) 类型完全等价, 可以直接 get;
  • d.inputs 的 key 来自组件的非函数 props, d.outputs 的 key 来自函数 props。

component 可省: 不传时不下发 setComponent, 运行时自然按 schema 的 type 查配置, 类型层用同一个 type 反推表 —— 「校验用的类型」与「真正渲染的组件」依旧同源。 不需要组件类型时, 直接用 typedFieldPipe

注意: 必须使用返回值, 原 schema 不被修改。

S extends BaseSchema<any, any, any>

C extends PiCommonConfig<any, any, Record<string, PiTypeConfig<any, any[]>>, Record<string, PiWrapperConfig<any>>> | { define: PiCommonConfig; }

S

C

(define) => readonly FieldEntry[]

S