diff --git a/src/app/components/table-viewer/table-viewer.component.html b/src/app/components/table-viewer/table-viewer.component.html index e34fa2a..7159336 100644 --- a/src/app/components/table-viewer/table-viewer.component.html +++ b/src/app/components/table-viewer/table-viewer.component.html @@ -20,8 +20,8 @@

settings Aide & Options
- +
- - - - - @@ -85,8 +79,34 @@

+ + + + + - + + diff --git a/src/app/components/table-viewer/table-viewer.component.scss b/src/app/components/table-viewer/table-viewer.component.scss index e4800ea..e377b3b 100644 --- a/src/app/components/table-viewer/table-viewer.component.scss +++ b/src/app/components/table-viewer/table-viewer.component.scss @@ -148,6 +148,12 @@ tr { background-color: black; } +tr:hover { + background-color: #222222; + cursor: pointer; +} + + .url-icon { color: $old-mauve; } @@ -156,6 +162,19 @@ tr { color: $old-mauve; } +tr.expanded-detail-row { + height: 0; +} + +.expanded-element-detail { + overflow: hidden; + display: flex; +} + +.expanded-element-description { + padding: 16px; +} + // End .end-text { diff --git a/src/app/components/table-viewer/table-viewer.component.ts b/src/app/components/table-viewer/table-viewer.component.ts index c5e9716..cbd4544 100644 --- a/src/app/components/table-viewer/table-viewer.component.ts +++ b/src/app/components/table-viewer/table-viewer.component.ts @@ -11,17 +11,27 @@ import { DataManagerService, DataSong } from 'src/app/services/data-manager.serv import { LocalStorageService } from 'src/app/services/local-storage.service'; import { MatDialog } from '@angular/material/dialog'; import { HelpWindowComponent } from '../help-window/help-window.component'; +import { animate, state, style, transition, trigger } from '@angular/animations'; @Component({ selector: 'app-table-viewer', templateUrl: './table-viewer.component.html', - styleUrls: ['./table-viewer.component.scss'] + styleUrls: ['./table-viewer.component.scss'], + animations: [ + trigger('detailExpand', [ + state('collapsed', style({height: '0px', minHeight: '0'})), + state('expanded', style({height: '*'})), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), + ]), + ], }) export class TableViewerComponent implements AfterViewInit { displayedColumns: string[]; dataSource: MatTableDataSource; + expandedElement?: DataSong; + selectedColumns: FormControl; selectedColumnsList: string[]; @@ -110,4 +120,16 @@ export class TableViewerComponent implements AfterViewInit { this.dialog.open(HelpWindowComponent); } + parseSongProperty(property: any): any | string { + if (property === undefined) return "/"; + if (Array.isArray(property)) return property.join(", "); + if (typeof property === "string" && length) return property.substring(0, length); + if (property instanceof Date) return property.toLocaleDateString() + ' ' + property.toLocaleTimeString(); + return property; + } + + generateDate(date: string): Date { + return new Date(date); + } + } diff --git a/src/app/constants/local-storage.ts b/src/app/constants/local-storage.ts index aff17d1..1903f50 100644 --- a/src/app/constants/local-storage.ts +++ b/src/app/constants/local-storage.ts @@ -1,6 +1,6 @@ import { DEFAULT_COLUMNS_ORDER } from "./table" -export const LOCAL_STORAGE_VERSION = "v3"; +export const LOCAL_STORAGE_VERSION = "v4"; export enum LocalStorageKey { TABLE_COLUMN_ORDER = "mellotron.setting.tableColumnOrder", diff --git a/src/app/constants/table.ts b/src/app/constants/table.ts index 87f174d..0d8ead0 100644 --- a/src/app/constants/table.ts +++ b/src/app/constants/table.ts @@ -8,13 +8,12 @@ export const COLUMN_NAMES_MAP: Record = { user: 'Utilisateur', cstName: 'Constitution', date: 'Date', - platform: 'Plateforme', url: 'URL', }; export const DEFAULT_COLUMNS_ORDER = Object.keys(COLUMN_NAMES_MAP); -export const NON_FILTER_KEYS = ['isWinner', 'platform', 'url']; +export const NON_FILTER_KEYS = ['isWinner', 'url']; export function filterPredicateFunction(currentKeys: string[]) { return (data: DataSong, filter: string): boolean => { diff --git a/src/app/services/data-manager.service.ts b/src/app/services/data-manager.service.ts index d0c4728..3684195 100644 --- a/src/app/services/data-manager.service.ts +++ b/src/app/services/data-manager.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { EMPTY_SONG, Song, SongPlatform } from 'chelys'; +import { EMPTY_SONG, Song } from 'chelys'; import { ALL_CONSTITUTIONS_DATA, DataConstitution } from '../constants/constitutions'; import names from '../../assets/names.json' diff --git a/src/assets/names.json b/src/assets/names.json index d35ac5c..363e3d1 100644 --- a/src/assets/names.json +++ b/src/assets/names.json @@ -1 +1 @@ -{"0xlRv92l2uV5RPBOaehCi08r9fQ2":"Nicky Mammouth","3OvnjaJEQfhz9FfizrSKE9vH23p2":"Le frère de Galadriel","E47Et0CSruO4x705pmp5tldzbK23":"Skully","EzKZMQbdAGYxyNbdLG7clcc8fcP2":"Touillette man","MFyRF6jk8kNxWf9shdHTlkpMmRt1":"Mr Lucky Goes Latin","O2HvFnVl9fVem27XZpSTSbSWsOL2":"I am very Bidon","UbbtyL9L1DfTDRDULtNYb8OvVrg2":"alex","bVuUaytBfDZXxfKFjg5hAzxlmbK2":"Noé Archiviste","gvb2XFss0fQgKOXEuq1eIne4sdI2":"Soda Stream","iImCc2DtcOSmUCEDkpZThfmTTko2":"Skaven Lord","jafbSws5qOMtuM7jj6NWQ2QTEsl2":"MICOLA","k0p39UgcBWQcAA6bV59eWNVRa3U2":"TableauBits","qnQiMpOFk9Y8iA1f5qRt0hIEVe13":"Busa (à la retraite)","v6Zc3x12BsVNJTyk5U00vvqhsmx2":"Poussin","zFJuPem5jXU4eZSvo1de82LlF1W2":"pamplemousse","JvVTL2HLvTcIDlekbIVs0sShzW33":"ilona"} \ No newline at end of file +{"0xlRv92l2uV5RPBOaehCi08r9fQ2":"Nicky","3OvnjaJEQfhz9FfizrSKE9vH23p2":"Le frère de Galadriel","E47Et0CSruO4x705pmp5tldzbK23":"Skully","EzKZMQbdAGYxyNbdLG7clcc8fcP2":"Touillette man","JvVTL2HLvTcIDlekbIVs0sShzW33":"ilona","MFyRF6jk8kNxWf9shdHTlkpMmRt1":"Mr Lucky Goes Latin","O2HvFnVl9fVem27XZpSTSbSWsOL2":"I am very Bidon","UbbtyL9L1DfTDRDULtNYb8OvVrg2":"alex","bVuUaytBfDZXxfKFjg5hAzxlmbK2":"Noé Archiviste","gvb2XFss0fQgKOXEuq1eIne4sdI2":"Soda Stream","iImCc2DtcOSmUCEDkpZThfmTTko2":"Skaven Lord","jafbSws5qOMtuM7jj6NWQ2QTEsl2":"MICOLA","k0p39UgcBWQcAA6bV59eWNVRa3U2":"TableauBits","qnQiMpOFk9Y8iA1f5qRt0hIEVe13":"Busa (à la retraite)","v6Zc3x12BsVNJTyk5U00vvqhsmx2":"Poussin","zFJuPem5jXU4eZSvo1de82LlF1W2":"pamplemousse"} \ No newline at end of file
@@ -50,12 +50,6 @@

{{row.author}} Plateforme {{platformToString(row.platform)}} Constitution {{row.date}} +
+
+ ID : {{element.id}}
+ Titre : {{element.title}}
+ Titre Alternatifs : {{parseSongProperty(element.altTitles)}}
+ Auteur : {{element.author}}
+ Album : {{parseSongProperty(element.album)}}
+ Genres : {{parseSongProperty(element.genres)}}
+ Langues : {{parseSongProperty(element.languages)}}
+ Année de sortie : {{parseSongProperty(element.releaseYear)}}
+ Date d'ajout : {{parseSongProperty(generateDate(element.addedDate))}}
+ Plateforme : {{platformToString(element.platform)}}
+ URL : {{element.url}} +
+
+