-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(antd): FormItem adds more attribute configuration #3727
Conversation
asterisk 就是 requiredMark,为啥要新增这个属性 |
因为我看asterisk是field.required的派生属性,做的是【必填态/选填态切换】,而requiredMark是基于前者,做【必填态/选填态样式切换】这件事,所以我理解不能混淆asterisk和requiredMark。@janryWang |
asterisk 就是用来控制星号是否展示的,没明白 requiredMark 的作用有啥特殊的呢 |
asterisk 控制星号是否展示; 可以枚举出以下5个场景你看下,可以帮助理解上面的定义:
场景1、2 也就是默认情况,本次PR扩展出场景345的支持 另外 requiredMark 是单纯的全局性 label 样式控制(已提交新的commit,将其提升到FormLayout),其值与 field 的状态无关。而 asterisk 会通过外层的field.required派生 |
这里直接把中文文案写死在代码里了,不能这么搞的,其实你的需求就是希望支持 asterisk 设置 false,但是 required 还生效吧 |
这块多语言怎么弄比较好?有没有可以参考的其他用例? @janryWang |
是的。准确的讲,我的需求是支持场景3、4的样式
|
建议直接自定义一个 FormItem 吧 |
。。。所以多语言目前无解么?
|
其实还好的,因为 FormItem 组件本身就是用来做 UI 渲染的,没有啥核心逻辑,UI 渲染,那就跟当前业务团队的设计规范息息相关了,跟设计规范实在有冲突,那就自定义 |
但这是 Antd 的原生样式,为什么不能官方支持去对齐呢?如果 Antd 之外的自定义样式我们自己去拉一个组件改我认为还可以接受 |
好吧,看来是我之前实现的时候漏掉了(也有可能是4.x后续迭代新增的属性),不过我对这个 PR 还有两个问题:
|
|
Codecov ReportBase: 96.57% // Head: 96.61% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## formily_next #3727 +/- ##
================================================
+ Coverage 96.57% 96.61% +0.03%
================================================
Files 152 152
Lines 6603 6668 +65
Branches 1835 1854 +19
================================================
+ Hits 6377 6442 +65
- Misses 199 226 +27
+ Partials 27 0 -27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
需要再改改,文件路径不能直接依赖 es目录的,会重复打包 |
|
Before submitting a pull request, please make sure the following is done...
master
orformily_next
.npm test
).npm run lint
) - we've done our best to make sure these rules match our internal linting guidelines.Please do not delete the above content
What have you changed?