diff --git a/erdblick_app/app/app.module.ts b/erdblick_app/app/app.module.ts index fea4d7d3..37f666c7 100644 --- a/erdblick_app/app/app.module.ts +++ b/erdblick_app/app/app.module.ts @@ -60,6 +60,7 @@ import {InputTextareaModule} from "primeng/inputtextarea"; import {FloatLabelModule} from "primeng/floatlabel"; import {TabViewModule} from "primeng/tabview"; import {OnEnterClickDirective} from "./keyboard.service"; +import {DropdownModule} from "primeng/dropdown"; export function initializeServices(styleService: StyleService, mapService: MapService, coordService: CoordinatesService) { return async () => { @@ -127,7 +128,8 @@ export function initializeServices(styleService: StyleService, mapService: MapSe ButtonGroupModule, TabViewModule, BreadcrumbModule, - TableModule + TableModule, + DropdownModule ], providers: [ { diff --git a/erdblick_app/app/editor.component.ts b/erdblick_app/app/editor.component.ts index b842f136..d2cf960f 100644 --- a/erdblick_app/app/editor.component.ts +++ b/erdblick_app/app/editor.component.ts @@ -80,7 +80,9 @@ const completionsList = [ {label: "relation", type: "keyword"}, {label: "attribute", type: "keyword"}, {label: "normal", type: "keyword"}, - {label: "highlight", type: "keyword"}, + {label: "none", type: "keyword"}, + {label: "selection", type: "keyword"}, + {label: "hover", type: "keyword"}, {label: "Lane", type: "keyword"}, {label: "Boundary", type: "keyword"} ] diff --git a/erdblick_app/app/feature.panel.component.ts b/erdblick_app/app/feature.panel.component.ts index 918eb93a..b6dff187 100644 --- a/erdblick_app/app/feature.panel.component.ts +++ b/erdblick_app/app/feature.panel.component.ts @@ -73,15 +73,9 @@ interface Column { - void +} + @Component({ selector: 'inspection-panel', template: ` @@ -25,6 +32,10 @@ interface InspectorTab { {{ tabs[activeIndex].title || '' }} + + @@ -47,12 +58,13 @@ interface InspectorTab { align-items: center; .p-button { - width: 30px; - height: 30px; + width: 1.75em; + height: 1.75em; margin: 0; } } - }`, + } + `, ] }) export class InspectionPanelComponent @@ -61,7 +73,12 @@ export class InspectionPanelComponent tabs: InspectorTab[] = []; activeIndex = 0; - constructor(public inspectionService: InspectionService, private parameterService: ParametersService) { + layerMenuItems: SourceLayerMenuItem[] = []; + selectedLayerItem?: SourceLayerMenuItem; + + constructor(public inspectionService: InspectionService, + public mapService: MapService, + private parameterService: ParametersService) { this.pushFeatureInspector(); this.inspectionService.featureTree.pipe(distinctUntilChanged()).subscribe((tree: string) => { @@ -88,6 +105,25 @@ export class InspectionPanelComponent this.inspectionService.selectedSourceData.pipe(distinctUntilChanged(selectedSourceDataEqualTo)).subscribe(selection => { if (selection) { this.reset(); + const map = this.mapService.maps.getValue().get(selection.mapId); + if (map) { + this.layerMenuItems = Array.from(map.layers.values()).filter(item => item.type == "SourceData").map(item => { + return { + label: SourceDataPanelComponent.layerNameForLayerId(item.layerId), + disabled: item.layerId === selection.layerId, + command: () => { + let sourceData = {...selection}; + sourceData.layerId = item.layerId; + sourceData.address = BigInt(0); + + this.inspectionService.selectedSourceData.next(sourceData); + }, + }; + }); + this.selectedLayerItem = this.layerMenuItems.filter(item => item.disabled).pop(); + } else { + this.layerMenuItems = []; + } this.pushSourceDataInspector(selection); } }) @@ -122,8 +158,8 @@ export class InspectionPanelComponent pushSourceDataInspector(data: SelectedSourceData) { let tab = { - title: SourceDataPanelComponent.layerNameForLayerId(data.layerId), - icon: "pi-database", + title: "Source Data", + icon: "", component: SourceDataPanelComponent, inputs: { sourceData: data @@ -155,4 +191,14 @@ export class InspectionPanelComponent this.tabs.pop(); } } + + onSelectedLayerItem() { + if (this.selectedLayerItem && !this.selectedLayerItem.disabled) { + this.selectedLayerItem.command(); + } + } + + onDropdownClick(event: MouseEvent) { + event.stopPropagation(); + } } diff --git a/erdblick_app/app/sourcedata.panel.component.ts b/erdblick_app/app/sourcedata.panel.component.ts index 4cbabe3d..e13833e9 100644 --- a/erdblick_app/app/sourcedata.panel.component.ts +++ b/erdblick_app/app/sourcedata.panel.component.ts @@ -41,7 +41,6 @@ import {Menu} from "primeng/menu"; /> - @@ -80,15 +79,13 @@ import {Menu} from "primeng/menu"; - - ` }) export class SourceDataPanelComponent implements OnInit { @Input() sourceData!: SelectedSourceData; @ViewChild('tt') table!: TreeTable; - @ViewChild('layerMenuItemsMenu') layerListMenu!: Menu; + // @ViewChild('layerMenuItemsMenu') layerListMenu!: Menu; treeData: TreeTableNode[] = []; filterFields = [ @@ -108,10 +105,10 @@ export class SourceDataPanelComponent implements OnInit { errorMessage = ""; isExpanded = false; - layerMenuItems: any[] = []; + // layerMenuItems: any[] = []; /** - * Returns a human readable layer name for a layer id. + * Returns a human-readable layer name for a layer id. * * @param layerId Layer id to get the name for */ @@ -147,33 +144,9 @@ export class SourceDataPanelComponent implements OnInit { this.loading = false; }); - this.mapService.maps.subscribe(maps => { - const map = maps.get(this.sourceData.mapId); - if (map) { - this.layerMenuItems = [ - { - label: "Switch Layer", - items: Array.from(map.layers.values()) - .filter(item => item.type == "SourceData") - .map(item => { - return { - label: SourceDataPanelComponent.layerNameForLayerId(item.layerId), - disabled: item.layerId === this.sourceData.layerId, - command: () => { - let sourceData = {...this.sourceData}; - sourceData.layerId = item.layerId; - sourceData.address = BigInt(0); - - this.inspectionService.selectedSourceData.next(sourceData); - }, - }; - }), - }, - ]; - } else { - this.layerMenuItems = []; - } - }); + // this.mapService.maps.subscribe(maps => { + // + // }); } /** diff --git a/erdblick_app/styles.scss b/erdblick_app/styles.scss index 42a96d49..3ca3362a 100644 --- a/erdblick_app/styles.scss +++ b/erdblick_app/styles.scss @@ -1,6 +1,15 @@ @import "primeicons/primeicons.css"; @layer primeng, erdblick; +.source-layer-dropdown { + margin-left: 0.25em; + + .p-dropdown-label { + padding: 0.4em; + min-width: 13em; + } +} + body { overflow: hidden; height: 100vh !important; @@ -112,6 +121,18 @@ body { right: 0.75rem; } +.inspect-panel-small-header { + .p-accordion-header .p-accordion-header-link { + padding-top: 0.5em !important; + padding-bottom: 0.5em !important; + } + + .resizable-container { + height: calc(100vh - 7.5em) !important; + max-height: calc(100vh - 7.5em) !important; + } +} + .inspect-panel { position: absolute; top: 0.5em; @@ -120,7 +141,7 @@ body { z-index: 110; .p-accordion-header .p-accordion-header-link { - padding: 0.8em; + padding: 0.95em; } .p-accordion-content { @@ -150,15 +171,15 @@ body { } .resizable-container { - width: 30em; - height: 30em; + width: 40em; + height: calc(100vh - 10.5em); min-width: 30em; min-height: 18em; resize: both; overflow: auto; direction: rtl; - max-width: calc(100vw - 27em); - max-height: calc(100vh - 8.5em); + max-width: calc(100vw - 28em); + max-height: calc(100vh - 10.5em); * { direction: ltr; @@ -185,12 +206,13 @@ body { border-collapse: collapse; td { - padding: 0px; + padding: 0 0 0 0.5em; height: 26px; + border-right: 1px solid #e5e7eb; } th { - padding: 0px; + padding: 0; height: 26px; } @@ -202,7 +224,12 @@ body { /* Style used for highlighting individual table rows. */ tr.highlight { - background: hsl(105, 30%, 90%); + color: black; + background: var(--green-100); + + td { + border-color: darkgrey; + } } } }