Replies: 2 comments 3 replies
-
|
这样改了之后对现有API的影响是什么 |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
这个要现在调整吗? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
描述
FormLayout 目前使用了 2 个 context 来维护配置信息,导致的问题:
使用场景
首先我封装了一个 SchemaForm,SchemaForm 中嵌套了@formily/antd Form 组件,即表单层面存在一个 FormLayout 配置信息。
然后我使用 FormLayout 再封装一个 FormBlock 组件,用来实现 V1 中的表单布局。
目前一个表单中的结构可能为:
问题
额外的负担
语义 & 功能缺失
现在假设 SchemaForm & FormBlock 中的 FormLayout 为 shallow=false,按照 shallow 的语义,CustomUIComponent 组件中 useFormLayout 获取到的 layout 是否应该为
Object.assign( {}, ... parentLayout, SchemaForm#layout, FormBLock#layout )?目前的设置只能获取到父节点的 layout 信息。建议
把 FormLayout & FormShallowLayout 合并成 FormLayout,然后根据 shallow 属性来传递 context value 即可:
Beta Was this translation helpful? Give feedback.
All reactions