Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions live-editing/configs/HierarchicalGridConfigGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export class HierarchicalGridConfigGenerator implements IConfigGenerator {
public generateConfigs(): Config[] {
const configs = new Array<Config>();

configs.push(new Config({
component: 'HierarchicalGridOverviewComponent',
additionalFiles: ['/src/app/data/jazz-catalogue.ts'],
appConfig: BaseAppConfig
}));

configs.push(new Config({
additionalFiles: ['/src/app/directives/prevent-scroll.directive.ts', '/src/app/data/singersData.ts',
'/src/app/hierarchical-grid/models.ts'],
Expand Down
2,680 changes: 2,680 additions & 0 deletions src/app/data/jazz-catalogue.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<igx-hierarchical-grid #grid
class="jazz-grid"
[data]="data"
primaryKey="ID"
[rowHeight]="54"
[allowFiltering]="true"
filterMode="excelStyleFilter"
[moving]="true"
[showExpandAll]="true"
[sortingOptions]="singleSort"
[sortingExpressions]="sorting">

<igx-grid-toolbar>
<igx-grid-toolbar-title>Jazz artists catalogue</igx-grid-toolbar-title>
<igx-grid-toolbar-actions>
<igx-input-group class="artist-search" type="border">
<igx-prefix>
<igx-icon aria-hidden="true">search</igx-icon>
</igx-prefix>
<input #search igxInput placeholder="Search artist" aria-label="Search artist" (input)="searchArtist(grid, search.value)" />
@if (search.value) {
<igx-suffix>
<button igxIconButton="flat" type="button" class="artist-search__clear" aria-label="Clear search" (click)="clearSearch(grid, search)">
<igx-icon>clear</igx-icon>
</button>
</igx-suffix>
}
</igx-input-group>
</igx-grid-toolbar-actions>
</igx-grid-toolbar>

<igx-column field="Artist" header="Artist" width="206px" [sortable]="true">
<ng-template igxCell let-cell="cell">
<div class="artist">
@if (cell.row.data.Photo) {
<igx-avatar class="artist__avatar" shape="circle" [src]="artistPhotoFolder + cell.row.data.Photo"></igx-avatar>
} @else {
<igx-avatar class="artist__avatar" shape="circle" [initials]="initials(cell.value)" aria-hidden="true"></igx-avatar>
}
<div class="artist__text">
<span class="artist__name">{{ cell.value }}</span>
<span class="artist__instrument">{{ cell.row.data.Instrument }}</span>
</div>
</div>
</ng-template>
</igx-column>
<igx-column field="Style" header="Style" width="148px" [sortable]="true">
<ng-template igxCell let-style>
<igx-chip class="style-chip" [attr.data-style]="style" outlined [tabIndex]="-1">{{ style }}</igx-chip>
</ng-template>
</igx-column>
<igx-column field="Origin" header="Origin" width="188px" [sortable]="true"></igx-column>
<igx-column field="Debut" header="Debut" width="112px" [sortable]="true"></igx-column>
<igx-column field="Status" header="Status" width="124px" [sortable]="true">
<ng-template igxCell let-status>
<div class="status">
<igx-badge class="status__dot" [attr.data-status]="status" dot aria-hidden="true"></igx-badge>
<span class="status__text">{{ status }}</span>
</div>
</ng-template>
</igx-column>
<igx-column field="TourStart" header="Tour Dates" dataType="date" width="216px" [sortable]="true">
<ng-template igxCell let-cell="cell">
@if (cell.row.data.TourStart && cell.row.data.TourEnd) {
<div class="tour-dates">
<igx-icon aria-hidden="true">date_range</igx-icon>
<span>{{ formatTourDates(cell.row.data.TourStart, cell.row.data.TourEnd) }}</span>
</div>
} @else {
<span class="tour-dates tour-dates--none">No dates announced</span>
}
</ng-template>
</igx-column>
<igx-column field="AlbumCount" header="Albums" dataType="number" width="132px" [sortable]="true"></igx-column>
<igx-column field="GrammyWins" header="Grammy Awards" width="148px" [filterable]="false">
<ng-template igxCell let-cell="cell">
<div class="two-lines">
<span class="two-lines__primary">{{ formatCount(cell.row.data.GrammyWins, 'win') }}</span>
<span class="two-lines__secondary">{{ formatCount(cell.row.data.GrammyNominations, 'nomination') }}</span>
</div>
</ng-template>
</igx-column>
<igx-column field="MonthlyListeners" header="Monthly Listeners" width="184px" [sortable]="true" [formatter]="formatListeners">
<ng-template igxCell let-cell="cell">
<div class="two-lines">
<span class="two-lines__primary">{{ formatListeners(cell.row.data.MonthlyListeners) }}</span>
<span class="two-lines__secondary">{{ formatListenersChange(cell.row.data.ListenersChange) }}</span>
</div>
</ng-template>
</igx-column>
<igx-column field="Rating" header="Rating" width="174px" [sortable]="true" [formatter]="formatRating" [cellTemplate]="ratingTemplate"></igx-column>
<igx-column header="Actions" width="100px" [filterable]="false">
<ng-template igxCell let-cell="cell">
<div class="actions" (click)="keepFromGrid($event)" (keydown)="keepFromGrid($event)">
<button igxIconButton="flat" type="button" class="actions__favorite"
[attr.aria-label]="'Favorite ' + cell.row.data.Artist" [attr.aria-pressed]="cell.row.data.Favorite"
(click)="toggleFavorite(cell.row)">
<igx-icon>{{ cell.row.data.Favorite ? 'favorite' : 'favorite_border' }}</igx-icon>
</button>
<button igxIconButton="flat" type="button" [attr.aria-label]="'Delete ' + cell.row.data.Artist" (click)="cell.row.grid.deleteRow(cell.row.key)">
<igx-icon>delete</igx-icon>
</button>
</div>
</ng-template>
</igx-column>

<igx-row-island key="Albums" primaryKey="ID" [rowHeight]="54" [allowFiltering]="true" filterMode="excelStyleFilter"
[moving]="true" [showExpandAll]="true" [sortingOptions]="singleSort">
<igx-column field="Album" header="Album" width="286px" [sortable]="true">
<ng-template igxCell let-cell="cell">
<div class="album">
@if (cell.row.data.Cover) {
<igx-avatar class="album__cover" shape="rounded" [src]="albumCoverFolder + cell.row.data.Cover"></igx-avatar>
} @else {
<igx-avatar class="album__cover" shape="rounded" icon="album" aria-hidden="true"></igx-avatar>
}
<div class="album__text">
<span class="album__name">{{ cell.value }}</span>
<span class="album__label">{{ cell.row.data.Label }}</span>
</div>
</div>
</ng-template>
</igx-column>
<igx-column field="Released" header="Released" dataType="date" width="150px" [sortable]="true" [pipeArgs]="dateFormat"></igx-column>
<igx-column field="Award" header="Awards" width="190px" [sortable]="true">
<ng-template igxCell let-award>
@if (award) {
<igx-chip class="award-chip" [attr.data-award]="award" outlined [tabIndex]="-1">
<igx-icon igxPrefix aria-hidden="true">star</igx-icon>
{{ award }}
</igx-chip>
}
</ng-template>
</igx-column>
<igx-column field="Duration" header="Duration" dataType="number" width="130px" [sortable]="true" [formatter]="formatMinutes"></igx-column>
<igx-column field="Tracks" header="Tracks" dataType="number" width="120px" [sortable]="true"></igx-column>
<igx-column field="Rating" header="Rating" width="180px" [sortable]="true" [formatter]="formatRating" [cellTemplate]="ratingTemplate"></igx-column>
<igx-column field="Format" header="Format" width="210px" [sortable]="true">
<ng-template igxCell let-format>
<div class="format-chips">
@for (item of format.split(', '); track item) {
<igx-chip class="format-chip" [tabIndex]="-1">{{ item }}</igx-chip>
}
</div>
</ng-template>
</igx-column>
<igx-column field="Price" header="Price" dataType="number" width="130px" [sortable]="true" [formatter]="formatPrice"></igx-column>
<igx-column field="Sold" header="Sold" dataType="number" width="140px" [sortable]="true" [formatter]="formatThousands"></igx-column>
<igx-column header="Actions" width="100px" [filterable]="false">
<ng-template igxCell let-cell="cell">
<div class="actions" (click)="keepFromGrid($event)" (keydown)="keepFromGrid($event)">
<button igxIconButton="flat" type="button" class="actions__favorite"
[attr.aria-label]="'Favorite ' + cell.row.data.Album" [attr.aria-pressed]="cell.row.data.Favorite"
(click)="toggleFavorite(cell.row)">
<igx-icon>{{ cell.row.data.Favorite ? 'favorite' : 'favorite_border' }}</igx-icon>
</button>
<button igxIconButton="flat" type="button" [attr.aria-label]="'Share ' + cell.row.data.Album">
<igx-icon>share</igx-icon>
</button>
</div>
</ng-template>
</igx-column>

<igx-row-island key="Songs" primaryKey="ID" [rowHeight]="48" [allowFiltering]="true" filterMode="excelStyleFilter"
[moving]="true" [sortingOptions]="singleSort">
<igx-column field="Number" header="No." dataType="number" width="80px" [sortable]="true" [filterable]="false" [formatter]="formatTrackNumber"></igx-column>
<igx-column field="Title" header="Title" width="210px" [sortable]="true">
<ng-template igxCell let-title>
<div class="song-title">
<igx-icon aria-hidden="true">music_note</igx-icon>
<span class="song-title__text">{{ title }}</span>
</div>
</ng-template>
</igx-column>
<igx-column field="Composer" header="Composer" width="210px" [sortable]="true"></igx-column>
<igx-column field="Type" header="Type" width="154px" [sortable]="true">
<ng-template igxCell let-type>
<div class="status">
<igx-badge class="status__dot" [attr.data-type]="type" dot aria-hidden="true"></igx-badge>
<span class="status__text">{{ type }}</span>
</div>
</ng-template>
</igx-column>
<igx-column field="Duration" header="Duration" dataType="number" width="110px" [filterable]="false" [formatter]="formatSongDuration"></igx-column>
<igx-column field="Recorded" header="Recorded" dataType="date" width="140px" [sortable]="true" [pipeArgs]="dateFormat"></igx-column>
<igx-column field="Popularity" header="Popularity" width="192px" [sortable]="true" [formatter]="formatPercent">
<ng-template igxCell let-popularity>
<igx-linear-bar
class="popularity"
[value]="popularity"
[textVisibility]="false"
[animate]="false"
[attr.aria-label]="'Popularity ' + popularity + '%'">
</igx-linear-bar>
</ng-template>
</igx-column>
<igx-column field="Plays" header="Plays" dataType="number" width="130px" [sortable]="true"></igx-column>
<igx-column field="Rating" header="Rating" width="176px" [sortable]="true" [formatter]="formatRating" [cellTemplate]="ratingTemplate"></igx-column>
<igx-column field="Likes" header="Likes" width="110px" [sortable]="true" [formatter]="formatThousands">
<ng-template igxCell let-likes>
<div class="likes">
<igx-icon aria-hidden="true">favorite</igx-icon>
<span>{{ formatThousands(likes) }}</span>
</div>
</ng-template>
</igx-column>
<igx-column header="Play" width="100px" [filterable]="false">
<ng-template igxCell let-cell="cell">
<div class="actions" (click)="keepFromGrid($event)" (keydown)="keepFromGrid($event)">
<button igxIconButton="flat" type="button"
[attr.aria-label]="(cell.row.data.ID === playingSongId ? 'Pause ' : 'Play ') + cell.row.data.Title"
(click)="togglePlay(cell.row)">
<igx-icon>{{ cell.row.data.ID === playingSongId ? 'pause' : 'play_arrow' }}</igx-icon>
</button>
<button igxIconButton="flat" type="button" [attr.aria-label]="'Repeat ' + cell.row.data.Title">
<igx-icon>repeat</igx-icon>
</button>
</div>
</ng-template>
</igx-column>
</igx-row-island>
</igx-row-island>

<igx-paginator [perPage]="10" [selectOptions]="[5, 10, 15, 25, 50]"></igx-paginator>
</igx-hierarchical-grid>

<ng-template #ratingTemplate let-rating>
<div class="rating" role="img" [attr.aria-label]="'Rated ' + formatRating(rating) + ' out of 5'">
@for (star of ratingStars(rating); track $index) {
<igx-icon class="rating__star" [attr.data-star]="star">{{ star }}</igx-icon>
}
<span class="rating__value" aria-hidden="true">{{ formatRating(rating) }}</span>
</div>
</ng-template>
Loading