Skip to content

Commit

Permalink
fix(json-schema): fix typo about transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 2, 2021
1 parent e6fd58e commit 498d311
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/json-schema/src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ const getReactions = (schema: ISchema, options: ISchemaFieldFactoryOptions) => {
}
}

const queryDepdency = (field: Formily.Core.Models.Field, pattern: string) => {
const queryDependency = (
field: Formily.Core.Models.Field,
pattern: string
) => {
const [target, path] = String(pattern).split(/\s*#\s*/)
return field.query(target).getIn(path || 'value')
}
Expand All @@ -401,12 +404,12 @@ const getReactions = (schema: ISchema, options: ISchemaFieldFactoryOptions) => {
dependencies: string[] | object
) => {
if (isArr(dependencies)) {
return dependencies.map((pattern) => queryDepdency(field, pattern))
return dependencies.map((pattern) => queryDependency(field, pattern))
} else if (isPlainObj(dependencies)) {
return reduce(
dependencies,
(buf, pattern, key) => {
buf[key] = queryDepdency(field, pattern)
buf[key] = queryDependency(field, pattern)
return buf
},
{}
Expand Down

0 comments on commit 498d311

Please sign in to comment.