Skip to content

Commit

Permalink
Fix SourceData inspector styling
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Aug 16, 2024
1 parent 7cb24b0 commit 118e23c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
18 changes: 17 additions & 1 deletion erdblick_app/app/inspection.panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,23 @@ interface InspectorTab {
</ng-template>
</p-accordionTab>
</p-accordion>
`
`,
styles: [
`@layer erdblick {
.inspector-title {
display: flex;
gap: 4px;
justify-content: center;
align-items: center;
.p-button {
width: 30px;
height: 30px;
margin: 0;
}
}
}`,
]
})
export class InspectionPanelComponent implements OnInit
{
Expand Down
26 changes: 11 additions & 15 deletions erdblick_app/app/sourcedata.panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,15 @@ import {TreeTable} from "primeng/treetable";
<ng-template pTemplate="header">
<tr>
<th *ngFor="let col of columns"
[ngStyle]="{width: col.width ? col.width + 'px' : 'auto'}"
>
<th *ngFor="let col of columns">
{{ col.header }}
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowNode let-rowData="rowData">
<tr [ttRow]="rowNode" [class]="rowData.styleClass || ''">
<td *ngFor="let col of columns; let i = index"
[ngStyle]="{width: col.width ? col.width + 'px' : 'auto'}"
>
<td *ngFor="let col of columns; let i = index">
<p-treeTableToggler [rowNode]="rowNode" *ngIf="i == 0" />
<span *ngIf="filterFields.indexOf(col.key) != -1" [innerHTML]="col.transform(rowData[col.key]) | highlight: filterString"></span>
<span *ngIf="filterFields.indexOf(col.key) == -1" [innerHTML]="col.transform(rowData[col.key])"></span>
Expand Down Expand Up @@ -182,22 +178,23 @@ export class SourceDataPanelComponent implements OnInit {

selectItemWithAddress(address: bigint) {
let searchAddress: any = address;
let addressInRange: any;
if (this.addressFormat == coreLib.SourceDataAddressFormat.BIT_RANGE) {
searchAddress = {
offset: address >> BigInt(32) & BigInt(0xFFFFFFFF),
size: address & BigInt(0xFFFFFFFF),
}
}

console.log(`Highlighting item with address`, searchAddress);
const addressLow = typeof searchAddress === 'object' ? searchAddress['offset'] : searchAddress;
const addressHigh = addressLow + (typeof searchAddress === 'object' ? searchAddress['size'] : searchAddress);
const addressLow = typeof searchAddress === 'object' ? searchAddress['offset'] : searchAddress;
const addressHigh = addressLow + (typeof searchAddress === 'object' ? searchAddress['size'] : searchAddress);

let addressInRange = (addr: any) => {
if (typeof addr === 'object') {
addressInRange = (addr: any) => {
return addr.offset >= addressLow && addr.offset + addr.size <= addressHigh;
}
return addr == searchAddress
} else {
addressInRange = (addr: any) => {
return addr == searchAddress;
}
}

// Virtual row index (visible row index) of the first highlighted row, or undefined.
Expand Down Expand Up @@ -230,6 +227,7 @@ export class SourceDataPanelComponent implements OnInit {
}
};

console.log(`Highlighting item with address`, searchAddress);
this.treeData.forEach((item: TreeTableNode, index) => {
select(item, [], false, index);
});
Expand All @@ -251,6 +249,4 @@ export class SourceDataPanelComponent implements OnInit {
this.clearFilter();
}
}

protected readonly HTMLInputElement = HTMLInputElement;
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 118e23c

Please sign in to comment.