in packages/core/src/models/Field.ts [220:278]
protected makeReactive() {
if (this.designable) return
this.disposers.push(
createReaction(
() => this.value,
(value) => {
this.notify(LifeCycleTypes.ON_FIELD_VALUE_CHANGE)
if (isValid(value)) {
if (this.selfModified && !this.caches.inputting) {
validateSelf(this)
}
if (!isEmpty(value) && this.display === 'none') {
this.caches.value = toJS(value)
this.form.deleteValuesIn(this.path)
}
}
}
),
createReaction(
() => this.initialValue,
() => {
this.notify(LifeCycleTypes.ON_FIELD_INITIAL_VALUE_CHANGE)
}
),
createReaction(
() => this.display,
(display) => {
const value = this.value
if (display !== 'none') {
if (value === undefined && this.caches.value !== undefined) {
this.setValue(this.caches.value)
this.caches.value = undefined
}
} else {
this.caches.value = toJS(value) ?? toJS(this.initialValue)
this.form.deleteValuesIn(this.path)
}
if (display === 'none' || display === 'hidden') {
this.setFeedback({
type: 'error',
messages: [],
})
}
}
),
createReaction(
() => this.pattern,
(pattern) => {
if (pattern !== 'editable') {
this.setFeedback({
type: 'error',
messages: [],
})
}
}
)
)
createReactions(this)
}