components icon indicating copy to clipboard operation
components copied to clipboard

mat-tree

Open kara opened this issue 9 years ago • 94 comments

kara avatar Feb 17 '17 22:02 kara

Quickly ! ! !

RainingNight avatar Mar 20 '17 03:03 RainingNight

Simple Material Design for tree:

angular io material tree view

Photoshop Source here

I can work on implementation after approve.

vyakymenko avatar Apr 15 '17 08:04 vyakymenko

Proposing code design:

JSON Example:

{
	"data": [{
		"label": "Tree Item Collapsed",
		"data": "Tree Item Collapsed Data",
		"expandIcon": "fa-folder-open",
		"collapseIcon": "fa-folder",
		"children": []
	}, {
		"label": "Tree Item Expanded",
		"data": "Tree Item Expanded Data",
		"expandIcon": "fa-folder-open",
		"collapseIcon": "fa-folder",
		"children": [{
			"label": "Bookmarks",
			"data": "Bookmarks Data",
			"icon": "fa-bookmarks"
		}, {
			"label": "Chart",
			"data": "Chart Data",
			"expandedIcon": "fa-chart"
		}]
	}, {
		"label": "Bookmarks",
		"data": "Bookmarks Data",
		"icon": "fa-bookmarks"
	}, {
		"label": "Chart",
		"data": "Chart Data",
		"expandedIcon": "fa-chart"
	}]
}

Attributes: data - Data array of treenodes selectionType - Selection type, "single", "multiple", maybe "checkbox?". selection - Single treenode instance or an array to refer to the selections. orientation - Tree orientation.

Events: nodeExpand - Callback to invoke when a node is expanded. nodeCollapse - Callback to invoke when a node is expanded. nodeSelect - Callback to invoke when a node is unselected. nodeUnselect - Callback to invoke when a node is selected.

Lazy Loading?

Drag-n-Drop?

vyakymenko avatar Apr 15 '17 08:04 vyakymenko

Looking forward to the release of the Tree!!

alvachien avatar Apr 24 '17 05:04 alvachien

Will try to implement this weekend.

vyakymenko avatar Apr 24 '17 18:04 vyakymenko

The tree component's design and implementation are in-progress.

tinayuangao avatar Apr 24 '17 19:04 tinayuangao

@tinayuangao , thanks for info, will wait for updates.

vyakymenko avatar Apr 24 '17 19:04 vyakymenko

Too slowly!

RainingNight avatar Apr 25 '17 03:04 RainingNight

@vyakymenko The status for the tree in README.md still 'Not started'

alvachien avatar May 05 '17 17:05 alvachien

@alvachien , because I have not started it per comment from @tinayuangao: The tree component's design and implementation are in-progress.

vyakymenko avatar May 05 '17 18:05 vyakymenko

While a official <md-tree> is developed, I find out "angular-tree-component". It supports templates & themes (eg putting <md-icon> and/or <md-checkbox> into it)

image

https://angular2-tree.readme.io/docs

alescdb avatar May 09 '17 12:05 alescdb

@alescdb angular2-tree-component works fine for me, however I wasn't able to find any custom icons (e.g. file or folder icon before labels) inclusion in documentation. Do you have any such example? Appreciate help.

ajaysattikar avatar May 12 '17 22:05 ajaysattikar

@ajaysattikar; using a custom template (https://angular2-tree.readme.io/docs/templates) should do the trick, something that looks like that :

<tree-root [nodes]="nodes">
  <ng-template #treeNodeTemplate let-node let-index="index">
    <md-icon>{{ node.data.icon }}</md-icon>
    {{ node.data.name }}
  </ng-template>
</tree-root>

nodes should look like :

nodes = [
    {
      id: 1,
      name: 'My Folder',
      icon: 'folder'
      children: [
        { id: 2, name: 'My File 1', icon: 'insert_drive_file' },
        { id: 3, name: 'My File 2', icon: 'insert_drive_file' }
      ]
    },
    {
      id: 4,
      name: 'Other Folder',
      icon: 'folder'
    }
  ];

I hope this help!

alescdb avatar May 13 '17 05:05 alescdb

I have to say that I'm against using the generic data term. Everything is data and there is always a better description. Call it children or nodes or whatever. I like @alescdb structuring. It's clear and has no bloat.

EDIT: I think it would be nice if instead of icon we could put a component in there like a checkbox or radio button.

SargoDarya avatar May 19 '17 08:05 SargoDarya

@alescdb It would be nice to have an indeterminate icon in the root folder if the user selected some items in its child nodes.

gocs avatar Jun 16 '17 06:06 gocs

+1 @kara It would be nice to have an indeterminate icon before label

finalxcode avatar Jun 22 '17 06:06 finalxcode

urgent need

westfalenxqq avatar Jun 28 '17 15:06 westfalenxqq

Hi, @vyakymenko what will be the design for grand children ? will it be like we will add children in children object ?

mahmud152 avatar Jun 30 '17 10:06 mahmud152

For those following this thread, the sneak-peek implementation that the Material team has in mind can be found here.

The source code is not available, but it looks like it draws on new cdk-tree and cdk-node elements. The best comparison would be to say that it looks like a pretty-printer for JSON objects (with select option), using Material, and very similar to the angular2-tree linked above by @alescdb

CaerusKaru avatar Jul 06 '17 21:07 CaerusKaru

looks realy nice, would be great to implement good drag'n'drop for nodes - that what is lacking most in other tree implementations i tried. angular2-tree for me is best i tried - but developers stopped supporting systemjs :(

unnamed666 avatar Jul 09 '17 18:07 unnamed666