Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

OneMoreJack
Copy link
Contributor

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Sometimes, we need to handle Array data structure in form and Table 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

Language Changelog
🇺🇸 English Add demo about nesting Table in Form
🇨🇳 Chinese 新增在表单中嵌入表格的示例

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2022

@afc163
Copy link
Member

afc163 commented Dec 23, 2022

ci 挂了,请检查。

@OneMoreJack
Copy link
Contributor Author

有几个问题请教下:

  1. 之前 CI 没通过是因为 snapshot 没更新,更新文档的 snapshot 是运行 test:update 这个脚本吗?
  2. 现在打开项目会自动生成 components/version/token.tsx, 这个文件是不是应该添加到 .gitignore, 我看仓库代码里 version 目录下只有一个 index.tsx

@afc163
Copy link
Member

afc163 commented Dec 27, 2022

  1. 是的。
  2. 可以,不过我好像没遇到这个问题。

@@ -3279,6 +3279,7 @@ exports[`renders ./components/calendar/demo/customize-header.tsx extend context
<div>
<div
class="rc-virtual-list"
innerprops="[object Object]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不应该有这个。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请问为什么我 test:update 后会有这个 innerprops 呢?😅

还有, 我看还有另外一种错误:
SnapshotReceived 中 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 后这两个样式又没了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你需要更新本地 node_modules 到最新,然后再跑 test:update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢👏,snapshots 应该可以了。但 tooltip 组件的覆盖率降低了😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多等会儿, 可能没跑完

@codecov
Copy link

codecov bot commented Dec 30, 2022

Codecov Report

Base: 100.00% // Head: 99.99% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (cb2ebff) compared to base (06de226).
Patch has no changes to coverable lines.

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     
Impacted Files Coverage Δ
components/tooltip/index.tsx 98.96% <0.00%> (-1.04%) ⬇️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

</Button>
</Empty>
)}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为啥要用 ConfigProvider ?直接用 Table 的 emptyText 可行么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有这个属性吗?不好意思我在文档里没搜到,如果有 emptyText 且支持 ReactNode 的话应该可以,我试下

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是 locale={{ emptyText: ... }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Comment on lines 55 to 62
render(_, { field }) {
return (
<Form.Item name={[field.name, 'age']} style={formItemStyle}>
<InputNumber style={{ width: '100%' }} />
</Form.Item>
);
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return 多余了,直接用 =>

@afc163
Copy link
Member

afc163 commented May 6, 2023

冲突了

@afc163
Copy link
Member

afc163 commented May 27, 2023

ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants