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

List Component #4905

Closed
afc163 opened this issue Feb 16, 2017 · 36 comments
Closed

List Component #4905

afc163 opened this issue Feb 16, 2017 · 36 comments
Assignees

Comments

@afc163
Copy link
Member

afc163 commented Feb 16, 2017

@afc163 afc163 added 💄 Design It is a UI design issue 🕙 Plan labels Feb 16, 2017
@ghost
Copy link

ghost commented Mar 8, 2017

List组件计划什么时候可用?现有的组件怎么调制一个List?可不可以直接引入Material-UI的List组件?

@ddcat1115
Copy link
Contributor

ddcat1115 commented Mar 14, 2017

这个预计要到 3.0 才能用,你可以试下 Table[showHeader=false] 能不能满足需求

@afc163
Copy link
Member Author

afc163 commented Jun 21, 2017

image

@nikogu
Copy link
Contributor

nikogu commented Jul 28, 2017

内容形态太多了,只能抽离 content(像 card 一样),但是感觉外框不如 card 统一,不太好搞,除非设计上统一内部内容的部分规范,如新 card 那样。

<Card
  cover={<img src="xxxx" />}
  actions={[<Icon type="xx" />, <Icon type="xx" />, <Icon type="xx" />]}
+ title="title"
+ avatar={<Avatar src="xxxx" />}
+ description="description"
+ extraContent={<div>xxxx</div>}
/>

@nikogu
Copy link
Contributor

nikogu commented Jul 28, 2017

1

image

2

image

3

image

4

image

5

image

@nikogu
Copy link
Contributor

nikogu commented Aug 8, 2017

@afc163 @ddcat1115 看看 用法 和 API 是否可行

可配合 Card 使用,变成 Card List。

import { List } from 'antd';

ReactDOM.render(
  <div>
    <List
      toolbars={}  // 这两个位置形态固定,所以不抽离成组件,作为配置项
      footer={}
    >
      {/* 水平典型用法 */}
      <List.NewItem type='card | normal' />
      <List.Item>
        <List.Item.logo src='xxx' size={40} radius={40} />
        <List.Item.Meta
          title="Title"     
          description="描述"
        />
        <List.Item.Content>
          Content
        </List.Item.Content>
        <List.Item.Action>
          <a>操作一</a> | <a>操作二</a> 
        </List.Item.Action>
      </List.Item>

      {/* 竖直典型用法 */}
      <List.Item 
        vertical // 垂直形态
      >
        <List.Item.logo src='xxx' size={60} radius={5} />
        <List.Item.Meta
          title="Title"     
          description="描述"
          tags=['tag 1', 'tag 2', 'tag 3']
          extra={<Tags />}
        />
        <List.Item.Content>
          Content
        </List.Item.Content>
        <List.Item.Action 
          actions=[{
            icon: '',
            text: '156',
            href: '',
            onClick: () => {},
          }] 
        />
      </List.Item>
    </List>
  </div>
, mountNode);

@afc163
Copy link
Member Author

afc163 commented Aug 8, 2017

  • NewItem 直接用 Button[dashed]
  • toolbars 是啥?
  • vertical => layout="vertical"
  • Meta 下的 tags、extra 都不要,全部用 description 自定义。
  • logo => Avatar:和 Card 保持一致。
  • <List.Item.Action actions={[ ... ]}> 这种看着蛋疼,我也没想到好的方案。@nikogu 可以和 @ddcat1115 碰下,和 Card 一并再想想。

@nikogu
Copy link
Contributor

nikogu commented Aug 8, 2017

toolbars 是啥?

这货(其实就是 header?感觉 footer 和 header 都没必要,额外写模板好了):

image

<List.Item.Action actions={[ ... ]}> 这种看着蛋疼,我也没想到好的方案。

<List.Item.Action>
    <List.Item.IconText type="start" title="156" onClick={} /> // 这样如何,在 action 里面,默认加 `split`
</List.Item.Action>

@afc163
Copy link
Member Author

afc163 commented Aug 8, 2017

toolbars 不要包括在 List 里。

下面这个是 LoadMore,这个要有。而且,List 组件要集成抽象的 infinite load 的功能。

@ddcat1115
Copy link
Contributor

不管是横向还是竖向 List,action 位置应该都是固定的(行尾或者尾行),是不是用 prop 比用 child component 好点?

@ddcat1115
Copy link
Contributor

而且我觉得实现 List 的时候,不用考虑设计稿中的『网格列表』,也就是长得很像 Card 的那一块,因为这块跟普通认知里面的『列表』不一样,用户肯定不会想到去 List 里找这种效果,列表概念本来也比较宽泛,不可能看到一个一个排列的效果都在 List 里实现。

或者这块可以参考下 http://wiki.jikexueyuan.com/project/bootstrap4/components/card/#section-11

@afc163
Copy link
Member Author

afc163 commented Aug 8, 2017

对,不用考虑,那个就是 Card 和栅格配合。

@nikogu
Copy link
Contributor

nikogu commented Aug 8, 2017

@ddcat1115 action 这里,List 的场景有可能会有扩展:

image

所以如何抽离成套件的话,再灵活性和规范上面有一个平衡

@afc163
Copy link
Member Author

afc163 commented Aug 8, 2017

另外也要支持下面的最简用法。

<List.Item>
   xxxx
</List.Item>

@nikogu
Copy link
Contributor

nikogu commented Aug 8, 2017

actions 这个,要不支持两种:

  1. props,采用设计模板
  2. children,方便自定义
<List.Item.Action>
    <a>123</a> <Dropdown />
</List.Item.Action>

<List.Item.Action
    actions={}
/>

这样的话,虽然 actions props 确实很蛋疼,但是用起来还是方便不少。 @ddcat1115 怎么看

@ddcat1115
Copy link
Contributor

<List.Item actions={array} /> 这样会有什么问题吗?组件做的只是把每一个元素渲染出来,加上分割的竖线,然后渲染位置是固定的

@afc163
Copy link
Member Author

afc163 commented Aug 9, 2017

不要都支持,选一种。

@nikogu
Copy link
Contributor

nikogu commented Aug 9, 2017

#7150

@nikogu
Copy link
Contributor

nikogu commented Aug 11, 2017

bug

  • loading status should not show the load more button
  • List.Item margin bottom is 24px
  • need support title not highlight
  • use div replace p in List.Meta description prop

todo

<List grid={{ gutter: 16, column: 4 }}>
  <ListItem><Card /></ListItem>
  <ListItem><Card /></ListItem>
  <ListItem><Card /></ListItem>
  <ListItem><Card /></ListItem>
</List>

@afc163
Copy link
Member Author

afc163 commented Aug 21, 2017

Demo 演示顺序:

  • 最基本的,类似:
    image
  • 信息流,复杂一点,增加头像和描述:
    image
  • 完整全面的。
  • 其余功能...
  • 其余功能...
  • 其余功能...
  • 其余功能...
  • 其余功能...

@afc163
Copy link
Member Author

afc163 commented Sep 2, 2017

@nikogu 目前好像还没实现 scroll infinite load 功能?

@nikogu
Copy link
Contributor

nikogu commented Sep 2, 2017

@afc163 是的,还没有实现。。。。争取下周实现了

@afc163
Copy link
Member Author

afc163 commented Sep 6, 2017

  • Use Spin like Table[loading].
  • Use default size Spin.

@afc163
Copy link
Member Author

afc163 commented Sep 18, 2017

可以参考下 https://github.com/joshwnj/react-visibility-sensor 的实现

@nikogu nikogu assigned nikogu and unassigned ddcat1115 Sep 19, 2017
This was referenced Sep 19, 2017
@afc163
Copy link
Member Author

afc163 commented Sep 27, 2017

  • Scrolling loaded List 这个例子看不太懂,类似 breadcrumb 搞一个 iframe 内部滚动来演示(提示用户滚动)。https://ant.design/components/breadcrumb/#components-breadcrumb-demo-router
  • List virtualized 和 Scrolling loaded List 应该交换位置。
  • Basic 例子中有个『加载更多』按钮,但是没用。加载更多应该单独做一个例子。
  • 加载更多按钮点完之后变成 Spin 更合适,现在是个加载中按钮。
  • List virtualized 在 Firefox 下展示有问题。
  • List virtualized 的描述中应该解释下需要 virtualized 的意义(性能?)。
  • Scrolling loaded List 和 List virtualized 的 spin 位置比较奇怪。截图
  • 上面两个例子的 item height 都设置的太高了。
  • loading 遮罩范围不应包括 pagination。
  • 默认文案为英文:feat: make default locale to enUS #7553 (comment)

@nikogu

@nikogu
Copy link
Contributor

nikogu commented Sep 27, 2017

好的,着手改进~

Scrolling loaded List 这个例子看不太懂,类似 breadcrumb 搞一个 iframe 内部滚动来演示(提示用户滚动)

bisheng 对于 iframe 模式的依赖还需要看一下,暂时改成了 scrolling container 方式,效果还不错

nikogu added a commit that referenced this issue Oct 9, 2017
@nikogu nikogu mentioned this issue Oct 9, 2017
1 task
nikogu added a commit that referenced this issue Oct 10, 2017
nikogu added a commit that referenced this issue Oct 11, 2017
nikogu added a commit that referenced this issue Oct 11, 2017
afc163 pushed a commit that referenced this issue Oct 11, 2017
@afc163
Copy link
Member Author

afc163 commented Oct 11, 2017

  • 头像应该顶部对齐?视觉稿截图
  • 如果没有 content 不应该渲染出一个空 div。截图

nikogu added a commit that referenced this issue Oct 12, 2017
nikogu added a commit that referenced this issue Oct 12, 2017
@afc163
Copy link
Member Author

afc163 commented Nov 3, 2017

  • 没有空数据样式。

<List dataSource={[]} />

@afc163
Copy link
Member Author

afc163 commented Nov 11, 2017

@nikogu

@andriijas
Copy link
Contributor

@nikogu
@afc163 size property is missing in documentation (<list size="large" />) - running docs locally. I could fix it and send PR but only for english.

@andriijas
Copy link
Contributor

another issue seems to be if i have a list of cards, and i dont use grid prop in list, the last card item will not get 100% width

@nikogu
Copy link
Contributor

nikogu commented Nov 14, 2017

another issue seems to be if i have a list of cards, and i dont use grid prop in list, the last card item will not get 100% width

Yes, the width of List children is default to 100% unless you specify it.

@andriijas
Copy link
Contributor

@nikogu
Copy link
Contributor

nikogu commented Nov 15, 2017

@andriijas https://github.com/andriijas/create-react-app-playground/blob/master/src/routes/Users.js#L60

you need set itemLayout="vertical" to List.

...
<List
  itemLayout="vertical"
  dataSource={data}
...

@andriijas
Copy link
Contributor

thanks. sorry i missed that in the doc. feels a bit strange with horizontal as default but explicit is always better than implicit.

@benjycui benjycui mentioned this issue Nov 21, 2017
29 tasks
@afc163 afc163 closed this as completed Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants