Skip to content

Commit

Permalink
fix(core): fix observable componentProps
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Feb 15, 2021
1 parent 192b882 commit dfe2e21
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion packages/antd/src/form-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const FormItem: ComposeFormItem = connect(
{ extract: 'required' },
(props, field) => {
if (isVoidField(field)) return props

if(!field) return props
const takeMessage = () => {
if (props.feedbackText) return props.feedbackText
if (field.errors.length) return field.errors
Expand All @@ -214,6 +214,7 @@ export const FormItem: ComposeFormItem = connect(
},
(props, field) => {
if (isVoidField(field)) return props
if(!field) return props
return {
feedbackStatus:
field.validateStatus === 'validating'
Expand All @@ -223,6 +224,7 @@ export const FormItem: ComposeFormItem = connect(
},
(props, field) => {
if (isVoidField(field)) return props
if(!field) return props
let asterisk = false
if (field.required) {
asterisk = true
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/models/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ export class Field<
inputValues: observable.ref,
decoratorType: observable.ref,
componentType: observable.ref,
decoratorProps: observable,
componentProps: observable,
decoratorProps: observable.shallow,
componentProps: observable.shallow,
validator: observable,
feedbacks: observable,
errors: computed,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/models/VoidField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ export class VoidField<Decorator = any, Component = any, TextType = any> {
mounted: observable.ref,
unmounted: observable.ref,
decoratorType: observable.ref,
decoratorProps: observable,
decoratorProps: observable.shallow,
componentType: observable.ref,
componentProps: observable,
componentProps: observable.shallow,
display: computed,
pattern: computed,
editable: computed,
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/ReactiveField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from 'react'
import { observer } from 'mobx-react-lite'
import { isFn, clone } from '@formily/shared'
import { isFn } from '@formily/shared'
import { isVoidField } from '@formily/core'
interface IReactiveFieldProps {
field: Formily.Core.Types.GeneralField
Expand Down Expand Up @@ -32,7 +32,7 @@ const ReactiveInternal: React.FC<IReactiveFieldProps> = (props) => {
}
return React.createElement(
field.decorator[0],
{ ...clone(field.decorator[1]) },
{ ...field.decorator[1] },
children
)
}
Expand All @@ -54,7 +54,7 @@ const ReactiveInternal: React.FC<IReactiveFieldProps> = (props) => {
: undefined
return React.createElement(
field.component[0],
{ disabled, readOnly, ...clone(field.component[1]), value, onChange },
{ disabled, readOnly, ...field.component[1], value, onChange },
children
)
}
Expand Down
1 change: 1 addition & 0 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"build:umd": "rollup --config"
},
"dependencies": {
"@formily/json-schema": "^2.0.0-beta.3",
"@formily/core": "^2.0.0-beta.3",
"@formily/shared": "^2.0.0-beta.3",
"@formily/validator": "^2.0.0-beta.3",
Expand Down

0 comments on commit dfe2e21

Please sign in to comment.