0.0.1-beta.4 • Published 8 years ago

ng-list-antd v0.0.1-beta.4

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

ng-list-antd

A simplify list of antd.

NPM version Build Status

Demo

Live Demo

Dependencies

  • ng-zorro-antd ^0.5.0

Usage & Installation

Install ng-list-antd from npm

npm install ng-list-antd --save

Import the NzListModule in to your root AppModule.

import { NzListModule } from 'ng-list-antd';
import { NgZorroAntdModule } from 'ng-zorro-antd';

@NgModule({
    imports: [BrowserModule, NzListModule, NgZorroAntdModule.forRoot()],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

Usage

import { Component, OnInit, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'demo-basic',
  template: `
    <nz-card>
        <ng-template #title>Basic list</ng-template>
        <ng-template #body>
            <nz-list [nzDataSource]="data" [nzItemLayout]="'horizontal'">
                <ng-template #nzTemplate let-item>
                    <nz-list-item>
                        <nz-list-item-meta
                            [nzTitle]="nzTitle"
                            nzAvatar="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
                            nzDescription="Ant Design, a design language for background applications, is refined by Ant UED Team">
                            <ng-template #nzTitle>
                                <a href="https://ng.ant.design">{{item.title}}</a>
                            </ng-template>
                        </nz-list-item-meta>
                    </nz-list-item>
                </ng-template>
            </nz-list>
        </ng-template>
    </nz-card>
`
})
export class DemoBasicComponent {
  data = [
    {
      title: 'Ant Design Title 1'
    },
    {
      title: 'Ant Design Title 2'
    },
    {
      title: 'Ant Design Title 3'
    },
    {
      title: 'Ant Design Title 4'
    }
  ];
}

API

nz-list

NameTypeDefaultSummary
nzDataSourceany[]Data record array to be displayed
nzBorderedbooleanfalseToggles rendering of the border around the list
nzGridNzListGridThe grid type of list. You can set grid to something like { gutter: 16, span: 6 }
nzItemTemplateRef<any>List item renderer
nzHeaderstring, TemplateRef<any>List header renderer
nzFooterstring, TemplateRef<any>List footer renderer
nzSizedefault,small,largedefaultSize of list
nzItemLayouthorizontal,verticalhorizontalThe layout of list, default is horizontal, If a vertical list is desired, set the itemLayout property to vertical
nzLoadingbooleanShows a loading indicator while the contents of the list are being fetched
nzLoadMoreTemplateRef<any>Shows a load more content
nzPaginationTemplateRef<any>Shows a pagination content
nzSplitbooleanToggles rendering of the split under the list item

NzListGrid

NameTypeDefaultSummary
spannumberraster number of cells to occupy, 0 corresponds to display: none
gutternumberspacing between grids
xsnumber<768px and also default setting, could be a span value or an object containing above props
smnumber≥768px, could be a span value or an object containing above props
mdnumber≥992px, could be a span value or an object containing above props
lgnumber≥1200px, could be a span value or an object containing above props
xlnumber≥1600px, could be a span value or an object containing above props
xxlnumberonly supported antd 3.x

nz-list-item

NameTypeDefaultSummary
nzContentstring, TemplateRef<any>Content renderer
nzExtrastring, TemplateRef<any>The extra content of list item. If itemLayout is vertical, shows the content on right, otherwise shows content on the far right.

nz-list-item-action

The actions content of list item. If itemLayout is vertical, shows the content on bottom, otherwise shows content on the far right.

nz-list-item-meta

NameTypeDefaultSummary
nzAvatarstring, TemplateRef<any>The avatar of list item
nzDescriptionstring, TemplateRef<any>The description of list item
nzTitlestring, TemplateRef<any>The title of list item

Troubleshooting

Please follow this guidelines when reporting bugs and feature requests:

  1. Use GitHub Issues board to report bugs and feature requests (not our email address)
  2. Please always write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.

Thanks for understanding!

License

The MIT License (see the LICENSE file for the full text)