From cbd230a7e0950e61d2007ef34a8a41d78d3fc220 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Mon, 6 Jun 2022 22:59:02 -0700 Subject: [PATCH] wip expanding row for more details for attributes. see https://stackblitz.com/angular/eaajjobynjkl?file=src%2Fapp%2Ftable-expandable-rows-example.html see https://material.angular.io/components/table/examples#table-expandable-rows --- .../app/modules/detail/detail.component.html | 25 +++++++++++++++ .../app/modules/detail/detail.component.scss | 31 ++++++++++++++++++- .../app/modules/detail/detail.component.ts | 11 ++++++- 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/webapp/frontend/src/app/modules/detail/detail.component.html b/webapp/frontend/src/app/modules/detail/detail.component.html index 1d77ec8..67ccc8e 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.html +++ b/webapp/frontend/src/app/modules/detail/detail.component.html @@ -143,6 +143,7 @@ @@ -324,6 +325,27 @@ + + + + + + + + diff --git a/webapp/frontend/src/app/modules/detail/detail.component.scss b/webapp/frontend/src/app/modules/detail/detail.component.scss index 72eb4e1..947b793 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.scss +++ b/webapp/frontend/src/app/modules/detail/detail.component.scss @@ -1,7 +1,6 @@ @import 'treo'; detail { - } // ----------------------------------------------------------------------------------------------------- @@ -20,5 +19,35 @@ detail { } +} + +//table { +// width: 100%; +//} + +$primary: map-get($theme, primary); +$is-dark: map-get($theme, is-dark); +tr.attribute-detail-row { + height: 0; +} + +tr.attribute-row:not(.attribute-expanded-row):hover { + @if ($is-dark) { + background: rgba(0, 0, 0, 0.05); + } @else { + background: map-get($primary, 50); + } +} + +tr.attribute-row:not(.attribute-expanded-row):active { + background: #efefef; +} + +.attribute-row td { + border-bottom-width: 0; +} +.attribute-detail { + overflow: hidden; + display: flex; } diff --git a/webapp/frontend/src/app/modules/detail/detail.component.ts b/webapp/frontend/src/app/modules/detail/detail.component.ts index 020ef4a..048ab0c 100644 --- a/webapp/frontend/src/app/modules/detail/detail.component.ts +++ b/webapp/frontend/src/app/modules/detail/detail.component.ts @@ -11,11 +11,19 @@ import {MatDialog} from "@angular/material/dialog"; import humanizeDuration from 'humanize-duration'; import {TreoConfigService} from "../../../@treo/services/config"; import {AppConfig} from "../../core/config/app.config"; +import {animate, state, style, transition, trigger} from '@angular/animations'; @Component({ selector: 'detail', templateUrl: './detail.component.html', - styleUrls: ['./detail.component.scss'] + styleUrls: ['./detail.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 DetailComponent implements OnInit, AfterViewInit, OnDestroy { @@ -24,6 +32,7 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy { onlyCritical: boolean = true; // data: any; + expandedAttribute: any | null; metadata: any; device: any;
+
+
+
{{getAttributeName(attribute)}}
+
{{getAttributeName(attribute)}}
+
{{getAttributeName(attribute)}}
+
{{getAttributeName(attribute)}}
+
+
+ {{getAttributeDescription(attribute)}} + -- Wikipedia +
+
+