diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.html b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.html index 665c94c609c6..39899e0c2b4f 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.html +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.html @@ -1,6 +1,6 @@ -{{ label() }} - +
{{ label() }}
+
@switch (type()) { @case ('flag') { @@ -45,7 +45,7 @@ } } } - +
@if (actionBtnType() !== 'none') { diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.scss b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.scss index 6ba52f9513f4..e7c2e601a695 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.scss +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.scss @@ -46,7 +46,7 @@ button { } } -td { +dd { width: 100%; } diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.spec.ts b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.spec.ts index 7a3fd5c5832a..42b94afc1b61 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.spec.ts +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-details-row/route-details-row.component.spec.ts @@ -34,10 +34,10 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('dataKey', 'value'); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); - const dataElements = fixture.debugElement.queryAll(By.css('td')); + const dataElements = fixture.debugElement.queryAll(By.css('dd')); expect(dataElements.length).toEqual(1); expect(dataElements[0].nativeElement.innerText).toEqual('Route Data'); }); @@ -48,7 +48,7 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('dataKey', 'isActive'); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); const dataElements = fixture.debugElement.queryAll(By.css('.tag-active')); @@ -62,7 +62,7 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('dataKey', 'isLazy'); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); const dataElements = fixture.debugElement.queryAll(By.css('.tag-inactive')); @@ -77,7 +77,7 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('actionBtnType', 'view-source'); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); const dataElements = fixture.debugElement.queryAll(By.css('button')); @@ -92,7 +92,7 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('actionBtnDisabled', true); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); const dataElements = fixture.debugElement.queryAll(By.css('button')); @@ -107,7 +107,7 @@ describe('RouteDetailsRowComponent', () => { fixture.componentRef.setInput('actionBtnType', 'view-source'); await fixture.whenStable(); - const labelElement = fixture.debugElement.query(By.css('th')); + const labelElement = fixture.debugElement.query(By.css('dt')); expect(labelElement.nativeElement.innerText).toEqual('Route Title'); const dataElements = fixture.debugElement.queryAll(By.css('button')); diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-tree.component.html b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-tree.component.html index 9d21a1a0d413..5b289a02043d 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-tree.component.html +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/router-tree/router-tree.component.html @@ -48,9 +48,9 @@

Routes Details

- +
@if (!data.matcher) { -
Routes Details actionBtnType="navigate" [actionBtnTooltip]="'Navigate to ' + data.path" (actionBtnClick)="navigateRoute(route)" - > + > } @else { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewFunctionSource(data.matcher, 'matcher')" - > + > } @if (!data.redirectTo) { - Routes Details actionBtnTooltip="View source" [actionBtnDisabled]="!!data?.isLazy" (actionBtnClick)="viewComponentSource(data.component)" - > + > } @else { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewFunctionSource(data.redirectTo, 'redirectTo')" - > + > } @if (data.pathMatch) { - +
} @if (data.data) { - + > } @if (data.resolvers) { - Routes Details [data]="data" actionBtnType="view-source" (actionBtnClick)="viewSourceFromRouter($event, 'resolvers')" - > + > } @if (data.canActivateGuards && data.canActivateGuards.length > 0) { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewSourceFromRouter($event, 'canActivate')" - > + > } @if (data.canActivateChildGuards && data.canActivateChildGuards.length > 0) { - + > } @if (data.canDeactivateGuards && data.canDeactivateGuards.length > 0) { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewSourceFromRouter($event, 'canDeactivate')" - > + > } @if (data.canMatchGuards && data.canMatchGuards.length > 0) { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewSourceFromRouter($event, 'canMatch')" - > + > } @if (data.providers && data.providers.length > 0) { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewSourceFromRouter($event, 'providers')" - > + > } @if (data.title) { - Routes Details actionBtnType="view-source" actionBtnTooltip="View source" (actionBtnClick)="viewFunctionSource(data.title, 'title')" - > + > } @if (data.runGuardsAndResolvers) { - Routes Details (actionBtnClick)=" viewFunctionSource(data.runGuardsAndResolvers, 'runGuardsAndResolvers') " - > + > } - - +
- -
+ >
+
+ diff --git a/devtools/projects/ng-devtools/src/styles/_tables.scss b/devtools/projects/ng-devtools/src/styles/_tables.scss index de01b0a1e412..718354b6b35f 100644 --- a/devtools/projects/ng-devtools/src/styles/_tables.scss +++ b/devtools/projects/ng-devtools/src/styles/_tables.scss @@ -38,3 +38,32 @@ table.ng-table { padding: 0.625rem 0.375rem; } } + +dl.ng-dl { + width: 100%; + margin: 0; + + > div, + > [ng-route-details-row] { + display: flex; + align-items: center; + border-bottom: 1px solid var(--senary-contrast); + padding: 0.625rem 0.375rem; + + dt { + @extend %body-bold-01; + margin: 0; + flex: 0 0 30%; + overflow: hidden; + text-overflow: ellipsis; + } + + dd { + @extend %body-01; + margin: 0; + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + } + } +}