Git Product home page Git Product logo

ng-tree-antd's Introduction

ng-tree-antd

A antd style of based on angular-tree-component.

NPM version Build Status

Demo

Live Demo & stackblitz

Dependencies

  • angular-tree-component ^7.0.1

Usage & Installation

Install ng-tree-antd from npm

npm install ng-tree-antd --save

Import the NzTreeModule in to your root AppModule.

import { NzTreeModule } from 'ng-tree-antd';
import { NgZorroAntdModule } from 'ng-zorro-antd';

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

Usage

import { Component } from '@angular/core';
import { generateData } from './generate-data';

@Component({
  selector: 'demo',
  template: `
  <nz-tree [nzNodes]="nodes"
           [nzOptions]="options"
           (nzEvent)="onEvent($event)"></nz-tree>
  `
})
export class DemoDraggableComponent {
  nodes = [
    {
      name: 'root1'
    },
    {
      name: 'root2'
    },
    {
      name: 'root3'
    },
    {
      name: 'async root4',
      hasChildren: true
    }
  ];

  options = {
    allowDrag: true
  };

  onEvent(ev: any) {
    console.log('onEvent', ev);
  }
}

nzNodes DATA

the nzNodes is array of the tree, and each node may contain the following fileds:

  • id unique id
  • name default displayed filed, you can setting displayField of options property
  • checked specifies whether the checkbox is selected
  • disableCheckbox disable checkbox
  • halfChecked achieve a 'check all' effect
  • children an array of the node's children.
  • hasChildren for async data load, so you need setting getChildren of options property

API

Name Type Default Summary
nzNodes any[] see inputs
nzAutoExpandParent boolean, number false 是否自动展开父节点,当数字时展开最大节点
nzCheckable boolean false Add a checkbox before the node
nzShowLine boolean false Shows a connecting line
nzOptions TreeOptions see options
nzTitle TemplateRef Custom title
nzLoading TemplateRef Custom Loading
nzShiftSelectedMulti boolean true selected multi when shift key
nzToggleExpanded EventEmitter see events
nzActivate EventEmitter
nzDeactivate EventEmitter
nzFocus EventEmitter
nzBlur EventEmitter
nzUpdateData EventEmitter
nzInitialized EventEmitter
nzMoveNode EventEmitter
nzCopyNode EventEmitter
nzLoadNodeChildren EventEmitter
nzChangeFilter EventEmitter
nzEvent EventEmitter
nzStateChange EventEmitter
nzCheck EventEmitter fired checkbox is changed

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)

ng-tree-antd's People

Contributors

cipchk avatar mo-gong avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.