-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
docs(Form): add nest table demo #38798
base: master
Are you sure you want to change the base?
Conversation
ci 挂了,请检查。 |
d2a68df
to
e02b935
Compare
有几个问题请教下:
|
|
@@ -3279,6 +3279,7 @@ exports[`renders ./components/calendar/demo/customize-header.tsx extend context | |||
<div> | |||
<div | |||
class="rc-virtual-list" | |||
innerprops="[object Object]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该有这个。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问为什么我 test:update
后会有这个 innerprops
呢?😅
还有, 我看还有另外一种错误:
Snapshot
和 Received
中 div 的 style 不匹配,前者的 sytle 少了 border:0;padding:0
这两个样式
FAIL components/transfer/__tests__/demo.test.ts
● renders ./components/transfer/demo/tree-transfer.tsx correctly
expect(received).toMatchSnapshot()
Snapshot name: `renders ./components/transfer/demo/tree-transfer.tsx correctly 1`
- Snapshot - 1
+ Received + 1
@@ -41,11 +41,11 @@
/>
</div>
<div
aria-hidden="true"
class="ant-tree-treenode"
- style="position:absolute;pointer-events:none;visibility:hidden;height:0;overflow:hidden"
+ style="position:absolute;pointer-events:none;visibility:hidden;height:0;overflow:hidden;border:0;padding:0"
>
<div
class="ant-tree-indent"
>
<div
116 | type: 'demo',
117 | html,
> 118 | }).toMatchSnapshot();
| ^
119 |
120 | errSpy.mockRestore();
121 | },
at Object.toMatchSnapshot (tests/shared/demoTest.tsx:118:12)
这种错误该如何修改呢,手动修改 snapshots 应该不可取吧,毕竟下次 test:update
后这两个样式又没了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你需要更新本地 node_modules 到最新,然后再跑 test:update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢👏,snapshots 应该可以了。但 tooltip 组件的覆盖率降低了😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多等会儿, 可能没跑完
Codecov ReportBase: 100.00% // Head: 99.99% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #38798 +/- ##
===========================================
- Coverage 100.00% 99.99% -0.01%
===========================================
Files 591 591
Lines 10060 10060
Branches 2719 2719
===========================================
- Hits 10060 10059 -1
- Misses 0 1 +1
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. |
</Button> | ||
</Empty> | ||
)} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为啥要用 ConfigProvider ?直接用 Table 的 emptyText 可行么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有这个属性吗?不好意思我在文档里没搜到,如果有 emptyText 且支持 ReactNode 的话应该可以,我试下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是 locale={{ emptyText: ... }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
render(_, { field }) { | ||
return ( | ||
<Form.Item name={[field.name, 'age']} style={formItemStyle}> | ||
<InputNumber style={{ width: '100%' }} /> | ||
</Form.Item> | ||
); | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 多余了,直接用 =>
冲突了 |
ping |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
Sometimes, we need to handle
Array
data structure in form andTable
is built for displaying this kind of data. When I was new to ant-design, It was hard for me to do this. I hope this demo would help someone who might be confused with how to nest table in a form.📝 Changelog
Table
inForm
☑️ Self-Check before Merge