ng-simple-file-tree
TypeScript icon, indicating that this package has built-in type declarations

0.1.29 • Public • Published

Simple-file-tree

Simple file tree for displaying files in a tree structure made with angular

File tree can be configured with the following options:

export interface FileTreeOptions {
  highlightOpenFolders: boolean;
  folderBehaviourOnClick: 'select' | 'expand' | 'both';
  autoOpenCondition?: (item: CreateTreeItem) => boolean;
  autoSelectCondition?: (item: CreateTreeItem) => boolean;
  determineIconClass?: (item: CreateTreeItem) => string;
  expandAllFolders?: boolean;
  hierarchyLines?: {
    vertical?: boolean,
    horizontal?: boolean,
  },
  styles?: {
    all?: string,
    treeItem?: {
      default?: string,
      active?: string,
    },
    treeIcon?: string,
    chevron?: string,
    hierarchyLine?: {
      horizontal?: string,
      vertical?: {
        default?: string,
        active?: string,
      },
    },
  }
}

Example:

  options = {
    highlightOpenFolders: false,
    folderBehaviourOnClick: 'expand',
    hierarchyLines: {
      vertical: true
    },
    styles: {
      all: 'font-family: consolas',
    }
  }

File extensions are automatically inferred by getting the value at the end of the filename after .: so login.spec.js would have extension .js

You can also use the determineIconClass function to add icons with any package you want, so if you use bootstrap icons you could do:

function determineIcon(value: CreateTreeItem): string {
  return 'bi bi-1-circle-fill'
}

And if you want to add color you can define a css class with color:

.red {
  color: red;
}

and then pass that class as well

function determineIcon(value: CreateTreeItem): string {
  return 'bi bi-1-circle-fill red'
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.2915latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.2915
0.1.281
0.1.270
0.1.260
0.1.251
0.1.240
0.1.222
0.1.200
0.1.190
0.1.180
0.1.170
0.1.160
0.1.140
0.1.130
0.1.120
0.1.110
0.1.100
0.1.90
0.1.80
0.1.70
0.1.60
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i ng-simple-file-tree

Weekly Downloads

19

Version

0.1.29

License

none

Unpacked Size

175 kB

Total Files

27

Last publish

Collaborators

  • matthijssmets