How to use the @angular/material/tree.MatTreeFlatDataSource function in @angular/material

To help you get started, we’ve selected a few @angular/material examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github notadd / ng-material-pro / projects / notadd / ng-material-pro / src / lib / transfer-picker / transfer-picker-source.component.ts View on Github external
ngOnInit() {
        this.treeFlattener = new MatTreeFlattener(
            this.transformer,
            this.getLevel,
            this.isExpandable,
            this.getChildren
        );
        this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
        this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);

        this.service
            .dataSourceChange
            .pipe(takeUntil(this.ngUnsubscribe))
            .subscribe(data => {
                this.dataSource.data = data;
                this.checklistSelection.clear();
            });

        this.service
            .selectedValuesChange
            .pipe(
                filter(values => !!values.length),
                takeUntil(this.ngUnsubscribe)
            )
            .subscribe(values => {
github catalyst-team / mlcomp / mlcomp / server / front / src / app / dag / dag-detail / code / code.component.ts View on Github external
name: node.name,
            level: level,
            content: node.content,
        };
    };

    treeControl = new FlatTreeControl(
        node => node.level, node => node.expandable);

    treeFlattener = new MatTreeFlattener(
        this.transformer,
        node => node.level,
        node => node.expandable,
        node => node.children);

    dataSource = new MatTreeFlatDataSource(this.treeControl,
        this.treeFlattener);

    constructor(private service: DagDetailService,
                private route: ActivatedRoute,
                private message_service: MessageService,
                private resource_service: DynamicresourceService,
                private sanitizer: DomSanitizer
    ) {

    }

    ngAfterViewInit() {
        let self = this;
        this.service.get_code(this.dag).subscribe(res => {
            self.dataSource.data = res.items;
        });
github notadd / ng-notadd / src / app / main / applications / roles-permissions / permissions / permissions.component.ts View on Github external
label: '本用户组及下属用户组的数据'
            },
            {
                value: 'all',
                label: '全部数据'
            }
        ];

        this.treeFlattener = new MatTreeFlattener(
            this.transformer,
            this.getLevel,
            this.isExpandable,
            this.getChildren
        );
        this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);
        this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);

        database.dataChange.subscribe(data => {
            this.dataSource.data = data;
        });
    }
github angular / components / src / material-examples / tree-flat-overview / tree-flat-overview-example.ts View on Github external
export class TreeFlatOverviewExample {
  private _transformer = (node: FoodNode, level: number) => {
    return {
      expandable: !!node.children && node.children.length > 0,
      name: node.name,
      level: level,
    };
  }

  treeControl = new FlatTreeControl(
      node => node.level, node => node.expandable);

  treeFlattener = new MatTreeFlattener(
      this._transformer, node => node.level, node => node.expandable, node => node.children);

  dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);

  constructor() {
    this.dataSource.data = TREE_DATA;
  }

  hasChild = (_: number, node: ExampleFlatNode) => node.expandable;
}
github babsey / nest-desktop / src / app / view / tree-view / tree-view.component.ts View on Github external
constructor(private database: Database) {
    this.treeFlattener = new MatTreeFlattener(this.transformer, this._getLevel,
      this._isExpandable, this._getChildren);
    this.treeControl = new FlatTreeControl(this._getLevel, this._isExpandable);
    this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);

    database.dataChange.subscribe(data => this.dataSource.data = data);

  }
github angular / components / src / material-examples / tree-loadmore / tree-loadmore-example.ts View on Github external
constructor(private _database: LoadmoreDatabase) {
    this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel,
      this.isExpandable, this.getChildren);

    this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable);

    this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);

    _database.dataChange.subscribe(data => {
      this.dataSource.data = data;
    });

    _database.initialize();
  }
github angular / components / src / dev-app / tree / checklist-tree-demo / checklist-tree-demo.ts View on Github external
constructor(private _database: ChecklistDatabase, private _changeDetectorRef: ChangeDetectorRef) {
    this.treeFlattener = new MatTreeFlattener(this.transformer, this.getLevel,
        this.isExpandable, this.getChildren);
    this.treeControl = new FlatTreeControl(
        this.getLevel, this.isExpandable);
    this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
    this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
    _database.dataChange.subscribe(data => this.dataSource.data = data);
  }
github phucan1108 / letportal / src / web-portal / src / app / modules / portal / modules / builder / pages / app-package / app-package.page.ts View on Github external
private transformer = (node: any, level: number) => {
        return {
            expandable: !!node.sub && node.sub.length > 0,
            name: node.name,
            level,
            id: node.name,
            numberChildren: !!node.sub ? node.sub.length : 0
        };
    }

    treeControl = new FlatTreeControl(
        node => node.level, node => node.expandable);
    treeFlattener = new MatTreeFlattener(
        this.transformer, node => node.level, node => node.expandable, (node: any) => node.sub);

    dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
    hasChild = (_: number, node: PackageNode) => node.expandable || node.level === 0;

    constructor(
        private activatedRoute: ActivatedRoute,
        private router: Router,
        private appsClient: AppsClient,
        private security: SecurityService,
        private downloadFileService: DownloadFileService,
        private fb: FormBuilder,
        private translate: TranslateService,
        private shortcut: ShortcutUtil,
        private pageService: PageService
    ) { 

    }