[Bug Report] field.pattern 的处理不符合预期
Closed this issue · 2 comments
chenos commented
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
const schema: ISchema = {
type: "object",
properties: {
hello2: {
type: "object",
"x-pattern": "readPretty",
"x-component": "Hello",
properties: {
hello1: {
type: "string",
"x-component": "Hello"
},
hello2: {
type: "string",
"x-editable": true,
"x-component": "Hello"
},
hello3: {
type: "string",
"x-disabled": true, // 希望这里 field.pattern: 'disabled', field.disabled: true
"x-component": "Hello"
}
}
}
}
};
What is expected?
希望 hello3 的 field.pattern: 'disabled', field.disabled: true
What is actually happening?
实际 hello3 的 field.pattern: 'readPretty', field.disabled: false
Package
@formily/core@2.3.0
janryWang commented
这里内部做了特化处理,readPretty 的区域不允许出现 disabled,主要是为了保证阅读态的视觉一致性
mytharcher commented
考虑在表单中,如果有按钮存在,如果整个表单是 readPretty 状态,此时希望按钮可以被设置为 disabled,但是由于 readPretty 覆盖了按钮的 disabled,导致按钮还是可点击状态。这种 case 应该不符合视觉一致性的初衷。
考虑这种情况在处理策略上存在一定冲突,把控制权交给开发者自行控制会不会更好?