Skip to content

Commit 935391f

Browse files
committed
修复lockId无效问题
1 parent 935e311 commit 935391f

File tree

16 files changed

+65
-54
lines changed

16 files changed

+65
-54
lines changed

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html style="width:100%;height:100%;overflow:auto"><head><meta charset="utf-8"><title>Layout</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"><style>.demo{width:1100px;height:500px;margin:50px auto;background:#fff;font-size:12px;overflow:auto}.rw-layout-content{height:200px}.rw-layout.rw-layout-has-sider{text-align:center;background:#3ba0e9}.rw-layout-sider{width:200px;text-align:center;background:#3ba0e9;color:#fff}.rw-layout-footer,.rw-layout-header{background:#7dbcea;color:#fff;height:64px;line-height:64px;text-align:center}.rw-layout-content{background:rgba(16,142,233,1);color:#fff;text-align:center}</style><link href="static/css/2.71a0092d.chunk.css" rel="stylesheet"><link href="static/css/index.3626f3b8.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime~index.f795885b.js"></script><script src="static/js/2.71a0092d.chunk.js"></script><script src="static/js/index.3626f3b8.chunk.js"></script></body></html>
1+
<!doctype html><html style="width:100%;height:100%;overflow:auto"><head><meta charset="utf-8"><title>Layout</title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"><style>.demo{width:1100px;height:500px;margin:50px auto;background:#fff;font-size:12px;overflow:auto}.rw-layout-content{height:200px}.rw-layout.rw-layout-has-sider{text-align:center;background:#3ba0e9}.rw-layout-sider{width:200px;text-align:center;background:#3ba0e9;color:#fff}.rw-layout-footer,.rw-layout-header{background:#7dbcea;color:#fff;height:64px;line-height:64px;text-align:center}.rw-layout-content{background:rgba(16,142,233,1);color:#fff;text-align:center}</style><link href="static/css/2.71a0092d.chunk.css" rel="stylesheet"><link href="static/css/index.ebecbc26.chunk.css" rel="stylesheet"></head><body style="background:#f5f5f5"><div class="demo" id="demo"></div><script src="static/js/runtime~index.f795885b.js"></script><script src="static/js/2.71a0092d.chunk.js"></script><script src="static/js/index.ebecbc26.chunk.js"></script></body></html>

docs/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"index.css": "static/css/index.3626f3b8.chunk.css",
3-
"index.js": "static/js/index.3626f3b8.chunk.js",
2+
"index.css": "static/css/index.ebecbc26.chunk.css",
3+
"index.js": "static/js/index.ebecbc26.chunk.js",
44
"runtime~index.js": "static/js/runtime~index.f795885b.js",
55
"static/css/2.71a0092d.chunk.css": "static/css/2.71a0092d.chunk.css",
66
"static/js/2.71a0092d.chunk.js": "static/js/2.71a0092d.chunk.js",

docs/static/js/index.3626f3b8.chunk.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/static/js/index.ebecbc26.chunk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/Form.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ function (_React$Component) {
485485
};
486486

487487
_proto.getFormContext = function getFormContext() {
488-
return Object.create(this);
488+
return {
489+
form: this
490+
};
489491
};
490492

491493
_proto.render = function render() {

esm/FormItem.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ function (_React$Component) {
6868
}
6969
});
7070

71-
var form = _this.context;
71+
var form = _this.getForm();
72+
7273
form.addField(_assertThisInitialized(_this));
7374
return _this;
7475
}
@@ -80,11 +81,11 @@ function (_React$Component) {
8081
};
8182

8283
_proto.getForm = function getForm() {
83-
return this.context;
84+
return this.context.form;
8485
};
8586

8687
_proto.componentWillUnmount = function componentWillUnmount() {
87-
var form = this.context;
88+
var form = this.getForm();
8889
form.removeField(this);
8990
};
9091

@@ -99,38 +100,38 @@ function (_React$Component) {
99100
};
100101

101102
_proto.getValidateDelay = function getValidateDelay() {
102-
var form = this.context;
103+
var form = this.getForm();
103104
var validateDelay = form.props.validateDelay;
104105
var props = this.props;
105106
return "validateDelay" in props ? props.validateDelay : validateDelay;
106107
};
107108

108109
_proto.hasError = function hasError() {
109-
var form = this.context;
110+
var form = this.getForm();
110111
var name = this.props.name;
111112
return form.hasError(name);
112113
};
113114

114115
_proto.getError = function getError() {
115-
var form = this.context;
116+
var form = this.getForm();
116117
var name = this.props.name;
117118
return form.getError(name);
118119
};
119120

120121
_proto.cleanError = function cleanError() {
121-
var form = this.context;
122+
var form = this.getForm();
122123
var name = this.props.name;
123124
return form.cleanError(name);
124125
};
125126

126127
_proto.setError = function setError(message) {
127-
var form = this.context;
128+
var form = this.getForm();
128129
var name = this.props.name;
129130
return form.setError(name, message);
130131
};
131132

132133
_proto.isValidating = function isValidating() {
133-
var form = this.context;
134+
var form = this.getForm();
134135
var name = this.props.name;
135136
return form.isFieldValidating(name);
136137
};
@@ -140,19 +141,19 @@ function (_React$Component) {
140141
triggerType = "none";
141142
}
142143

143-
var form = this.context;
144+
var form = this.getForm();
144145
var name = this.props.name;
145146
form.validateField(name, callback, triggerType);
146147
};
147148

148149
_proto.getValue = function getValue() {
149-
var form = this.context;
150+
var form = this.getForm();
150151
var name = this.props.name;
151152
return form.getValue(name);
152153
};
153154

154155
_proto.setValue = function setValue(value, callback) {
155-
var form = this.context;
156+
var form = this.getForm();
156157
var name = this.props.name;
157158
form.setValue(name, value, callback);
158159
};
@@ -218,13 +219,13 @@ function (_React$Component) {
218219
};
219220

220221
_proto.getFormProps = function getFormProps(prop, defaultValue) {
221-
var form = this.context;
222+
var form = this.getForm();
222223
var formProps = form.props;
223224
return formProps[prop] || defaultValue;
224225
};
225226

226227
_proto.getProp = function getProp(prop, defaultValue) {
227-
var form = this.context;
228+
var form = this.getForm();
228229
var formProps = form.props;
229230
var props = this.props;
230231
return prop in props ? props[prop] : formProps[prop] || defaultValue;

esm/useForm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
import React from "react";
33
import FormContext from "./FormContext";
44
export default (function () {
5-
return React.useContext(FormContext);
5+
var context = React.useContext(FormContext);
6+
return context.form;
67
});

examples/demos/demo1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class DEMO extends Component {
8383
validateTrigger={["change", "blur"]}
8484
getDefaultFieldValue={() => ""}
8585
ref={form => (this.form = form)}
86-
formValue={formValue}
86+
// formValue={formValue}
8787
onChange={formValue => this.setState({ formValue })}
8888
onSubmit={this.onSubmit}
8989
renderFieldExtra={this.renderFieldExtra}

lib/Form.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,9 @@ function (_React$Component) {
496496
};
497497

498498
_proto.getFormContext = function getFormContext() {
499-
return Object.create(this);
499+
return {
500+
form: this
501+
};
500502
};
501503

502504
_proto.render = function render() {

0 commit comments

Comments
 (0)