Skip to content

Commit

Permalink
fix(@uform/atnd/next): fix #97
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jun 15, 2019
1 parent ded188e commit 68ed3a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions packages/antd/src/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,16 @@ const isTableColItem = (path, getSchema) => {

registerFieldMiddleware(Field => {
return props => {
const { name, errors, editable, path, required, schema, getSchema } = props
const {
name,
errors,
editable,
path,
required,
schema,
schemaPath,
getSchema
} = props
if (path.length === 0) return React.createElement(Field, props) // 根节点是不需要包FormItem的
return React.createElement(
FormConsumer,
Expand All @@ -479,7 +488,7 @@ registerFieldMiddleware(Field => {
label: schema.title,
noMinHeight: schema.type === 'object' && !schema['x-component'],
isTableColItem: isTableColItem(
path.slice(0, path.length - 2),
schemaPath.slice(0, schemaPath.length - 2),
getSchema
),
type: schema['x-component'] || schema['type'],
Expand Down
13 changes: 11 additions & 2 deletions packages/next/src/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,16 @@ const isTableColItem = (path, getSchema) => {

registerFieldMiddleware(Field => {
return props => {
const { name, editable, errors, path, schema, getSchema, required } = props
const {
name,
editable,
errors,
path,
schemaPath,
schema,
getSchema,
required
} = props
if (path.length === 0) return React.createElement(Field, props) // 根节点是不需要包FormItem的
return React.createElement(
FormConsumer,
Expand All @@ -382,7 +391,7 @@ registerFieldMiddleware(Field => {
label: schema.title,
noMinHeight: schema.type === 'object' && !schema['x-component'],
isTableColItem: isTableColItem(
path.slice(0, path.length - 2),
schemaPath.slice(0, schemaPath.length - 2),
getSchema
),
type: schema['x-component'] || schema['type'],
Expand Down

0 comments on commit 68ed3a3

Please sign in to comment.