Skip to content

Commit

Permalink
fix(schema-renderer): fix linkage can not access expressionScope (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Mar 16, 2020
1 parent b755498 commit 27de669
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/zh-cn/schema-develop/introduction.md
Expand Up @@ -29,11 +29,13 @@ const App = () => {
components={{
Input
}}
labelCol={7}
wrapperCol={12}
onSubmit={console.log}
schema={{
type: 'object',
"x-component-props":{
labelCol:7,
wrapperCol:12
},
properties: {
string: {
type: 'string',
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Expand Up @@ -776,6 +776,8 @@ export function createForm<FieldProps, VirtualFieldProps>(
})
}

//1. 无法自动交换通过移动来新增删除子列表元素的状态
//2. 暂时不支持通过setFieldState修改值场景的状态交换
function swapState($from: number, $to: number) {
const keys: string[] = ['initialValue', 'visibleCacheValue', 'values']
const arrayName = field.getSourceState(state => state.name)
Expand Down
3 changes: 2 additions & 1 deletion packages/react-schema-renderer/src/shared/linkage.ts
Expand Up @@ -47,7 +47,7 @@ export const parseLinkages = (
{
getFieldState,
getFormState,
scope
scope: outerScope
}: {
getFieldState?: IFormActions['getFieldState']
getFormState?: IFormActions['getFormState']
Expand All @@ -65,6 +65,7 @@ export const parseLinkages = (
const targetState = getFieldState ? getFieldState(newTarget) : {}
const fieldValue = fieldName.getIn(formState.values)
const _scope = {
...outerScope,
...scope,
$value: fieldValue,
$self: fieldState || {},
Expand Down

0 comments on commit 27de669

Please sign in to comment.