Skip to content

Commit

Permalink
fix(FormRender): broaden schema type
Browse files Browse the repository at this point in the history
  • Loading branch information
Barrior committed Oct 30, 2024
1 parent 12b52e0 commit 91d9c68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/form-render-react/src/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export type IFormRenderProps = IPartPartial<
/**
* 表单描述协议,带内置渲染器类型提示
*/
schema: IFormRenderRootSchema
schema: IFormRenderRootSchema<string>

/**
* FormRender 根节点样式名
Expand Down
10 changes: 6 additions & 4 deletions packages/search-react/src/utils/createDisplayedSchema.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import type { IFormRenderRootSchema } from '@schema-render/form-render-react'

type IRootSchema = IFormRenderRootSchema<string>

/**
* 创建折叠的 Schema
* @param rawSchema 原始 Schema
* @param collapsedNumber 折叠的个数
* @returns 折叠的 Schema
*/
function createCollapsedSchema(
rawSchema: IFormRenderRootSchema,
rawSchema: IRootSchema,
collapsedNumber: number
): IFormRenderRootSchema {
const collapsedProps: IFormRenderRootSchema['properties'] = {}
): IRootSchema {
const collapsedProps: IRootSchema['properties'] = {}

const displayedKeys = Object.keys(rawSchema.properties).slice(0, collapsedNumber)
for (const key of displayedKeys) {
Expand All @@ -31,7 +33,7 @@ interface ICreateSearchSchema {
/**
* 原始 Schema
*/
rawSchema: IFormRenderRootSchema
rawSchema: IRootSchema
/**
* 折叠的个数
*/
Expand Down

0 comments on commit 91d9c68

Please sign in to comment.