codecharta-visualization 1.117.0 → 1.119.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/app/codeCharta/services/loadInitialFile/urlExtractor.ts +2 -2
- package/app/codeCharta/state/selectors/accumulatedData/metricData/edgeMetricData.calculator.ts +5 -1
- package/app/codeCharta/state/selectors/primaryMetrics/primaryMetrics.selector.ts +7 -15
- package/app/codeCharta/state/store/dynamicSettings/colorRange/resetColorRange.effect.spec.ts +9 -0
- package/app/codeCharta/state/store/dynamicSettings/colorRange/resetColorRange.effect.ts +9 -0
- package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.scss +27 -0
- package/app/codeCharta/ui/attributeSideBar/attributeSideBar.component.spec.ts +18 -15
- package/app/codeCharta/ui/attributeSideBar/attributeSideBar.module.ts +10 -2
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath/nodePath.component.spec.ts +2 -2
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarPrimaryMetrics/attributeSideBarPrimaryMetric/attributeSideBarPrimaryMetric.component.html +7 -1
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarPrimaryMetrics/attributeSideBarPrimaryMetric/attributeSideBarPrimaryMetric.component.ts +1 -0
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarPrimaryMetrics/attributeSideBarPrimaryMetrics.component.html +20 -6
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarPrimaryMetrics/attributeSideBarPrimaryMetrics.component.ts +7 -4
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/attributeSideBarSecondaryMetrics.component.html +17 -3
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/attributeSideBarSecondaryMetrics.component.ts +8 -5
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/secondaryMetrics.selector.spec.ts +4 -23
- package/app/codeCharta/ui/attributeSideBar/attributeSideBarSecondaryMetrics/secondaryMetrics.selector.ts +4 -16
- package/app/codeCharta/ui/attributeSideBar/metricDeltaSelected/metricDeltaSelected.component.spec.ts +1 -1
- package/app/codeCharta/ui/attributeSideBar/util/edge.ts +0 -2
- package/app/codeCharta/ui/attributeSideBar/util/metric.ts +0 -2
- package/app/codeCharta/ui/codeMap/arrow/codeMap.arrow.service.ts +2 -5
- package/app/codeCharta/ui/customConfigs/customConfigs.module.ts +4 -3
- package/app/codeCharta/ui/customConfigs/uploadCustomConfigButton/uploadCustomConfigButton.component.ts +1 -1
- package/app/codeCharta/ui/fileExtensionBar/fileExtensionBar.component.spec.ts +3 -1
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +2 -2
- package/app/codeCharta/ui/legendPanel/legendBlock/legendBlock.component.html +24 -20
- package/app/codeCharta/ui/legendPanel/legendBlock/legendBlock.component.ts +10 -3
- package/app/codeCharta/ui/legendPanel/legendPanel.component.html +7 -13
- package/app/codeCharta/ui/legendPanel/legendPanel.component.scss +16 -18
- package/app/codeCharta/ui/legendPanel/legendPanel.component.spec.ts +34 -12
- package/app/codeCharta/ui/legendPanel/legendPanel.component.ts +8 -8
- package/app/codeCharta/ui/legendPanel/legendPanel.module.ts +3 -2
- package/app/codeCharta/ui/metricChooser/metricChooser.component.html +7 -2
- package/app/codeCharta/ui/metricChooser/metricChooser.component.scss +8 -0
- package/app/codeCharta/ui/metricChooser/metricChooser.component.spec.ts +39 -11
- package/app/codeCharta/ui/metricChooser/metricChooser.component.ts +2 -2
- package/app/codeCharta/ui/metricChooser/metricChooser.module.ts +3 -2
- package/app/codeCharta/ui/ribbonBar/areaMetricChooser/areaMetricChooser.component.html +1 -0
- package/app/codeCharta/ui/ribbonBar/areaMetricChooser/areaMetricChooser.component.spec.ts +17 -6
- package/app/codeCharta/ui/ribbonBar/colorMetricChooser/colorMetricChooser.component.html +1 -0
- package/app/codeCharta/ui/ribbonBar/colorMetricChooser/colorMetricChooser.component.spec.ts +19 -6
- package/app/codeCharta/ui/ribbonBar/edgeMetricChooser/edgeMetricChooser.component.html +1 -0
- package/app/codeCharta/ui/ribbonBar/edgeMetricChooser/edgeMetricChooser.component.spec.ts +15 -5
- package/app/codeCharta/ui/ribbonBar/heightMetricChooser/heightMetricChooser.component.html +1 -0
- package/app/codeCharta/ui/ribbonBar/heightMetricChooser/heightMetricChooser.component.spec.ts +21 -8
- package/app/codeCharta/ui/ribbonBar/heightMetricChooser/heightMetricChooser.module.ts +1 -1
- package/app/codeCharta/ui/ribbonBar/ribbonBar.module.ts +1 -1
- package/app/codeCharta/util/algorithm/streetLayout/horizontalStreet.ts +2 -2
- package/app/codeCharta/util/algorithm/streetLayout/verticalStreet.ts +2 -2
- package/app/codeCharta/util/dataMocks.ts +18 -1
- package/app/codeCharta/util/gameObjectsParser/gameObjectsImporter.ts +1 -1
- package/app/codeCharta/util/pipes/AttributeDescriptorTooltipPipeModule.ts +8 -0
- package/app/codeCharta/util/pipes/RemoveExtensionPipeModule.ts +8 -0
- package/app/codeCharta/util/pipes/TruncateTextPipeModule.ts +8 -0
- package/app/codeCharta/util/pipes/attributeDescriptorTooltip.pipe.spec.ts +61 -0
- package/app/codeCharta/util/pipes/attributeDescriptorTooltip.pipe.ts +19 -0
- package/dist/webpack/index.html +1 -1
- package/dist/webpack/main.0e368e65a1bdf78b.js +1 -0
- package/package.json +3 -3
- package/app/codeCharta/ui/attributeSideBar/util/metricDescriptors.ts +0 -30
- package/app/codeCharta/ui/legendPanel/selectors/legendAreaMetric.selector.ts +0 -10
- package/app/codeCharta/ui/legendPanel/selectors/legendColorMetric.selector.ts +0 -10
- package/app/codeCharta/ui/legendPanel/selectors/legendEdgeMetric.selector.spec.ts +0 -76
- package/app/codeCharta/ui/legendPanel/selectors/legendEdgeMetric.selector.ts +0 -25
- package/app/codeCharta/ui/legendPanel/selectors/legendHeightMetric.selector.ts +0 -10
- package/app/codeCharta/util/simplePipes/SimplePipesModule.ts +0 -9
- package/app/codeCharta/util/simplePipes/metricDescriptorTitle.pipe.spec.ts +0 -62
- package/app/codeCharta/util/simplePipes/metricDescriptorTitle.pipe.ts +0 -18
- package/dist/webpack/main.276ed7d686dd2d87.js +0 -1
- /package/app/codeCharta/ui/ribbonBar/colorMetricChooser/{heightMetricChooser.module.ts → colorMetricChooser.module.ts} +0 -0
- /package/app/codeCharta/ui/ribbonBar/heightMetricChooser/{areaMetricChooser.component.ts → heightMetricChooser.component.ts} +0 -0
- /package/app/codeCharta/util/{simplePipes → pipes}/removeExtension.pipe.spec.ts +0 -0
- /package/app/codeCharta/util/{simplePipes → pipes}/removeExtension.pipe.ts +0 -0
- /package/app/codeCharta/util/{truncateText.pipe.ts → pipes/truncateText.pipe.ts} +0 -0
- /package/app/codeCharta/util/{truncateText.spec.ts → pipes/truncateText.spec.ts} +0 -0
|
@@ -3,12 +3,15 @@ import { render, screen } from "@testing-library/angular"
|
|
|
3
3
|
import { expect } from "@jest/globals"
|
|
4
4
|
import userEvent from "@testing-library/user-event"
|
|
5
5
|
import { ColorMetricChooserComponent } from "./colorMetricChooser.component"
|
|
6
|
-
import { ColorMetricChooserModule } from "./
|
|
6
|
+
import { ColorMetricChooserModule } from "./colorMetricChooser.module"
|
|
7
7
|
import { MockStore, provideMockStore } from "@ngrx/store/testing"
|
|
8
8
|
import { metricDataSelector } from "../../../state/selectors/accumulatedData/metricData/metricData.selector"
|
|
9
9
|
import { hoveredNodeSelector } from "../../../state/selectors/hoveredNode.selector"
|
|
10
10
|
import { isColorMetricLinkedToHeightMetricSelector } from "../../../state/store/appSettings/isHeightAndColorMetricLinked/isColorMetricLinkedToHeightMetric.selector"
|
|
11
11
|
import { colorMetricSelector } from "../../../state/store/dynamicSettings/colorMetric/colorMetric.selector"
|
|
12
|
+
import { attributeDescriptorsSelector } from "../../../state/store/fileSettings/attributeDescriptors/attributeDescriptors.selector"
|
|
13
|
+
import { setColorMetric } from "../../../state/store/dynamicSettings/colorMetric/colorMetric.actions"
|
|
14
|
+
import { getLastAction } from "../../../util/testUtils/store.utils"
|
|
12
15
|
|
|
13
16
|
describe("colorMetricChooserComponent", () => {
|
|
14
17
|
beforeEach(() => {
|
|
@@ -28,7 +31,8 @@ describe("colorMetricChooserComponent", () => {
|
|
|
28
31
|
},
|
|
29
32
|
{ selector: colorMetricSelector, value: "aMetric" },
|
|
30
33
|
{ selector: hoveredNodeSelector, value: null },
|
|
31
|
-
{ selector: isColorMetricLinkedToHeightMetricSelector, value: false }
|
|
34
|
+
{ selector: isColorMetricLinkedToHeightMetricSelector, value: false },
|
|
35
|
+
{ selector: attributeDescriptorsSelector, value: {} }
|
|
32
36
|
]
|
|
33
37
|
})
|
|
34
38
|
]
|
|
@@ -37,19 +41,27 @@ describe("colorMetricChooserComponent", () => {
|
|
|
37
41
|
|
|
38
42
|
it("should be a select for color metric", async () => {
|
|
39
43
|
const nonDisabledIconColor = "color: rgb(68, 68, 68);"
|
|
40
|
-
const { container } = await render(ColorMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
44
|
+
const { container, detectChanges } = await render(ColorMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
41
45
|
|
|
42
46
|
expect(screen.getByRole("combobox").getAttribute("aria-disabled")).toBe("false")
|
|
43
47
|
|
|
44
|
-
await userEvent.click(await screen.findByText("aMetric
|
|
48
|
+
await userEvent.click(await screen.findByText("aMetric"))
|
|
45
49
|
expect(screen.getByPlaceholderText("Color Metric (highest value)")).not.toBe(null)
|
|
46
50
|
const options = screen.queryAllByRole("option")
|
|
47
51
|
expect(options[0].textContent).toMatch("aMetric (1)")
|
|
48
52
|
expect(options[1].textContent).toMatch("bMetric (2)")
|
|
49
53
|
|
|
54
|
+
const store = TestBed.inject(MockStore)
|
|
50
55
|
await userEvent.click(options[1])
|
|
51
|
-
|
|
52
|
-
expect(
|
|
56
|
+
|
|
57
|
+
expect(await getLastAction(store)).toEqual(setColorMetric({ value: "bMetric" }))
|
|
58
|
+
store.overrideSelector(colorMetricSelector, "bMetric")
|
|
59
|
+
store.refreshState()
|
|
60
|
+
detectChanges()
|
|
61
|
+
|
|
62
|
+
expect(screen.queryByText("aMetric")).toBe(null)
|
|
63
|
+
expect(screen.queryByText("bMetric")).not.toBe(null)
|
|
64
|
+
expect(container.querySelector("cc-metric-chooser").getAttribute("title")).toBe("Change color metric")
|
|
53
65
|
expect(container.querySelector(".fa.fa-paint-brush").getAttribute("style")).toEqual(nonDisabledIconColor)
|
|
54
66
|
})
|
|
55
67
|
|
|
@@ -62,6 +74,7 @@ describe("colorMetricChooserComponent", () => {
|
|
|
62
74
|
detectChanges()
|
|
63
75
|
|
|
64
76
|
expect(screen.getByRole("combobox").getAttribute("aria-disabled")).toBe("true")
|
|
77
|
+
expect(container.querySelector("cc-metric-chooser").getAttribute("title")).toBe("Currently linked to height metric")
|
|
65
78
|
expect(container.querySelector(".fa.fa-paint-brush").getAttribute("style")).toEqual(disabledIconColor)
|
|
66
79
|
})
|
|
67
80
|
})
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
[searchPlaceholder]="'Edge Metric (highest value)'"
|
|
8
8
|
[handleMetricChanged]="handleEdgeMetricChanged"
|
|
9
9
|
[type]="'edge'"
|
|
10
|
+
title="Change edge metric"
|
|
10
11
|
>
|
|
11
12
|
<div hoveredInformation class="cc-metric-chooser-hovered-container">
|
|
12
13
|
<div class="metric-value" *ngIf="hoveredEdgeValue$ | async; let hoveredEdgeValue">
|
|
@@ -9,6 +9,9 @@ import { metricDataSelector } from "../../../state/selectors/accumulatedData/met
|
|
|
9
9
|
import { edgeMetricSelector } from "../../../state/store/dynamicSettings/edgeMetric/edgeMetric.selector"
|
|
10
10
|
import { isEdgeMetricVisibleSelector } from "../../../state/store/appSettings/isEdgeMetricVisible/isEdgeMetricVisible.selector"
|
|
11
11
|
import { hoveredEdgeValueSelector } from "./hoveredEdgeValue.selector"
|
|
12
|
+
import { attributeDescriptorsSelector } from "../../../state/store/fileSettings/attributeDescriptors/attributeDescriptors.selector"
|
|
13
|
+
import { getLastAction } from "../../../util/testUtils/store.utils"
|
|
14
|
+
import { setEdgeMetric } from "../../../state/store/dynamicSettings/edgeMetric/edgeMetric.actions"
|
|
12
15
|
|
|
13
16
|
describe("edgeMetricChooserComponent", () => {
|
|
14
17
|
beforeEach(() => {
|
|
@@ -28,7 +31,8 @@ describe("edgeMetricChooserComponent", () => {
|
|
|
28
31
|
},
|
|
29
32
|
{ selector: edgeMetricSelector, value: "aMetric" },
|
|
30
33
|
{ selector: hoveredEdgeValueSelector, value: null },
|
|
31
|
-
{ selector: isEdgeMetricVisibleSelector, value: true }
|
|
34
|
+
{ selector: isEdgeMetricVisibleSelector, value: true },
|
|
35
|
+
{ selector: attributeDescriptorsSelector, value: {} }
|
|
32
36
|
]
|
|
33
37
|
})
|
|
34
38
|
]
|
|
@@ -36,17 +40,23 @@ describe("edgeMetricChooserComponent", () => {
|
|
|
36
40
|
})
|
|
37
41
|
|
|
38
42
|
it("should be a select for edge metric", async () => {
|
|
39
|
-
await render(EdgeMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
43
|
+
const { detectChanges } = await render(EdgeMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
40
44
|
|
|
41
|
-
await userEvent.click(await screen.findByText("aMetric
|
|
45
|
+
await userEvent.click(await screen.findByText("aMetric"))
|
|
42
46
|
expect(screen.getByPlaceholderText("Edge Metric (highest value)")).not.toBe(null)
|
|
43
47
|
const options = screen.queryAllByRole("option")
|
|
44
48
|
expect(options[0].textContent).toMatch("aMetric (1)")
|
|
45
49
|
expect(options[1].textContent).toMatch("bMetric (2)")
|
|
46
50
|
|
|
51
|
+
const store = TestBed.inject(MockStore)
|
|
47
52
|
await userEvent.click(options[1])
|
|
48
|
-
expect(
|
|
49
|
-
|
|
53
|
+
expect(await getLastAction(store)).toEqual(setEdgeMetric({ value: "bMetric" }))
|
|
54
|
+
store.overrideSelector(edgeMetricSelector, "bMetric")
|
|
55
|
+
store.refreshState()
|
|
56
|
+
detectChanges()
|
|
57
|
+
|
|
58
|
+
expect(screen.queryByText("aMetric")).toBe(null)
|
|
59
|
+
expect(screen.queryByText("bMetric")).not.toBe(null)
|
|
50
60
|
})
|
|
51
61
|
|
|
52
62
|
it("should reflect edge metric's visibility in its class name", async () => {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[selectedMetricName]="heightMetric$ | async"
|
|
5
5
|
[searchPlaceholder]="'Height Metric (highest value)'"
|
|
6
6
|
[handleMetricChanged]="handleHeightMetricChanged"
|
|
7
|
+
title="Change height metric"
|
|
7
8
|
>
|
|
8
9
|
<cc-metric-chooser-value-hovered hoveredInformation [metricFor]="'heightMetric'"></cc-metric-chooser-value-hovered>
|
|
9
10
|
</cc-metric-chooser>
|
package/app/codeCharta/ui/ribbonBar/heightMetricChooser/heightMetricChooser.component.spec.ts
CHANGED
|
@@ -2,14 +2,19 @@ import { TestBed } from "@angular/core/testing"
|
|
|
2
2
|
import { render, screen } from "@testing-library/angular"
|
|
3
3
|
import { expect } from "@jest/globals"
|
|
4
4
|
import userEvent from "@testing-library/user-event"
|
|
5
|
-
import { HeightMetricChooserComponent } from "./
|
|
5
|
+
import { HeightMetricChooserComponent } from "./heightMetricChooser.component"
|
|
6
6
|
import { HeightMetricChooserModule } from "./heightMetricChooser.module"
|
|
7
|
-
import { provideMockStore } from "@ngrx/store/testing"
|
|
7
|
+
import { MockStore, provideMockStore } from "@ngrx/store/testing"
|
|
8
8
|
import { metricDataSelector } from "../../../state/selectors/accumulatedData/metricData/metricData.selector"
|
|
9
9
|
import { heightMetricSelector } from "../../../state/store/dynamicSettings/heightMetric/heightMetric.selector"
|
|
10
10
|
import { hoveredNodeSelector } from "../../../state/selectors/hoveredNode.selector"
|
|
11
|
+
import { attributeDescriptorsSelector } from "../../../state/store/fileSettings/attributeDescriptors/attributeDescriptors.selector"
|
|
12
|
+
import { getLastAction } from "../../../util/testUtils/store.utils"
|
|
13
|
+
import { setHeightMetric } from "../../../state/store/dynamicSettings/heightMetric/heightMetric.actions"
|
|
11
14
|
|
|
12
15
|
describe("heightMetricChooserComponent", () => {
|
|
16
|
+
let store: MockStore
|
|
17
|
+
|
|
13
18
|
beforeEach(() => {
|
|
14
19
|
TestBed.configureTestingModule({
|
|
15
20
|
imports: [HeightMetricChooserModule],
|
|
@@ -26,7 +31,8 @@ describe("heightMetricChooserComponent", () => {
|
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
{ selector: heightMetricSelector, value: "aMetric" },
|
|
29
|
-
{ selector: hoveredNodeSelector, value: null }
|
|
34
|
+
{ selector: hoveredNodeSelector, value: null },
|
|
35
|
+
{ selector: attributeDescriptorsSelector, value: {} }
|
|
30
36
|
]
|
|
31
37
|
})
|
|
32
38
|
]
|
|
@@ -34,16 +40,23 @@ describe("heightMetricChooserComponent", () => {
|
|
|
34
40
|
})
|
|
35
41
|
|
|
36
42
|
it("should be a select for height metric", async () => {
|
|
37
|
-
await render(HeightMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
43
|
+
const { detectChanges } = await render(HeightMetricChooserComponent, { excludeComponentDeclaration: true })
|
|
44
|
+
store = TestBed.inject(MockStore)
|
|
38
45
|
|
|
39
|
-
await userEvent.click(await screen.findByText("aMetric
|
|
46
|
+
await userEvent.click(await screen.findByText("aMetric"))
|
|
40
47
|
expect(screen.getByPlaceholderText("Height Metric (highest value)")).not.toBe(null)
|
|
48
|
+
|
|
41
49
|
const options = screen.queryAllByRole("option")
|
|
42
50
|
expect(options[0].textContent).toMatch("aMetric (1)")
|
|
43
51
|
expect(options[1].textContent).toMatch("bMetric (2)")
|
|
44
|
-
|
|
45
52
|
await userEvent.click(options[1])
|
|
46
|
-
|
|
47
|
-
expect(
|
|
53
|
+
|
|
54
|
+
expect(await getLastAction(store)).toEqual(setHeightMetric({ value: "bMetric" }))
|
|
55
|
+
store.overrideSelector(heightMetricSelector, "bMetric")
|
|
56
|
+
store.refreshState()
|
|
57
|
+
detectChanges()
|
|
58
|
+
|
|
59
|
+
expect(screen.queryByText("aMetric")).toBe(null)
|
|
60
|
+
expect(screen.queryByText("bMetric")).not.toBe(null)
|
|
48
61
|
})
|
|
49
62
|
})
|
|
@@ -2,7 +2,7 @@ import { CommonModule } from "@angular/common"
|
|
|
2
2
|
import { NgModule } from "@angular/core"
|
|
3
3
|
import { MetricChooserModule } from "../../metricChooser/metricChooser.module"
|
|
4
4
|
import { MetricChooserValueHoveredModule } from "../../metricChooser/metricChooserValueHovered/metricChooserValueHovered.module"
|
|
5
|
-
import { HeightMetricChooserComponent } from "./
|
|
5
|
+
import { HeightMetricChooserComponent } from "./heightMetricChooser.component"
|
|
6
6
|
|
|
7
7
|
@NgModule({
|
|
8
8
|
imports: [CommonModule, MetricChooserModule, MetricChooserValueHoveredModule],
|
|
@@ -2,7 +2,7 @@ import { NgModule } from "@angular/core"
|
|
|
2
2
|
import { RibbonBarComponent } from "./ribbonBar.component"
|
|
3
3
|
import { AreaMetricChooserModule } from "./areaMetricChooser/areaMetricChooser.module"
|
|
4
4
|
import { HeightMetricChooserModule } from "./heightMetricChooser/heightMetricChooser.module"
|
|
5
|
-
import { ColorMetricChooserModule } from "./colorMetricChooser/
|
|
5
|
+
import { ColorMetricChooserModule } from "./colorMetricChooser/colorMetricChooser.module"
|
|
6
6
|
import { EdgeMetricChooserModule } from "./edgeMetricChooser/edgeMetricChooser.module"
|
|
7
7
|
import { ShowScenariosButtonModule } from "./showScenariosButton/showScenariosButton.module"
|
|
8
8
|
import { EdgeSettingsPanelModule } from "./edgeSettingsPanel/edgeSettingsPanel.module"
|
|
@@ -235,8 +235,8 @@ export default class HorizontalStreet extends Street {
|
|
|
235
235
|
* @param streetOrigin topleft point of street
|
|
236
236
|
*/
|
|
237
237
|
private calculateRightStreetOverhang(streetOrigin: Vector2): number {
|
|
238
|
-
const lastTopBox = this.topRow
|
|
239
|
-
const lastBottomBox = this.bottomRow
|
|
238
|
+
const lastTopBox = this.topRow.at(-1)
|
|
239
|
+
const lastBottomBox = this.bottomRow.at(-1)
|
|
240
240
|
const streetRightX = streetOrigin.x + this.width
|
|
241
241
|
const topOverhang =
|
|
242
242
|
lastTopBox instanceof VerticalStreet && lastTopBox.streetRect
|
|
@@ -173,8 +173,8 @@ export default class VerticalStreet extends Street {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
private calculateBottomStreetOverhang(streetOrigin: Vector2): number {
|
|
176
|
-
const lastLeftNode = this.leftRow
|
|
177
|
-
const lastRightNode = this.rightRow
|
|
176
|
+
const lastLeftNode = this.leftRow.at(-1)
|
|
177
|
+
const lastRightNode = this.rightRow.at(-1)
|
|
178
178
|
const streetBottomY = streetOrigin.y + this.height
|
|
179
179
|
const leftOverhang =
|
|
180
180
|
lastLeftNode instanceof HorizontalStreet && lastLeftNode.streetRect
|
|
@@ -131,7 +131,7 @@ export const TEST_ATTRIBUTE_DESCRIPTORS: AttributeDescriptors = {
|
|
|
131
131
|
description: "",
|
|
132
132
|
hintHighValue: "",
|
|
133
133
|
hintLowValue: "",
|
|
134
|
-
link: ""
|
|
134
|
+
link: "https://test.link"
|
|
135
135
|
},
|
|
136
136
|
c: {
|
|
137
137
|
title: undefined,
|
|
@@ -139,6 +139,23 @@ export const TEST_ATTRIBUTE_DESCRIPTORS: AttributeDescriptors = {
|
|
|
139
139
|
hintHighValue: undefined,
|
|
140
140
|
hintLowValue: undefined,
|
|
141
141
|
link: undefined
|
|
142
|
+
},
|
|
143
|
+
d: {
|
|
144
|
+
title: "",
|
|
145
|
+
description: "",
|
|
146
|
+
hintHighValue: "",
|
|
147
|
+
hintLowValue: "",
|
|
148
|
+
link: "https://test2.link"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export const TEST_ATTRIBUTE_DESCRIPTORS_FULL: AttributeDescriptors = {
|
|
153
|
+
fullMetric: {
|
|
154
|
+
title: "FullTestTitle",
|
|
155
|
+
description: "FullTestDescription",
|
|
156
|
+
hintHighValue: "FullTestHigh",
|
|
157
|
+
hintLowValue: "FullLowValue",
|
|
158
|
+
link: "https://test.abc"
|
|
142
159
|
}
|
|
143
160
|
}
|
|
144
161
|
|
|
@@ -158,7 +158,7 @@ function getCenteredRootPosition(rootFixedPosition: FixedPosition): FixedPositio
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
function wrapFilePath(filePath: string): string {
|
|
161
|
-
const filePathWithSlash = filePath.
|
|
161
|
+
const filePathWithSlash = filePath.replaceAll(".", "/")
|
|
162
162
|
const splitFilePath = filePath.split(".")
|
|
163
163
|
const fileName = splitFilePath.slice(-1)
|
|
164
164
|
// add file name again to the end because the file has been wrapped in a folder. (with the same name)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core"
|
|
2
|
+
import { AttributeDescriptorTooltipPipe } from "./attributeDescriptorTooltip.pipe"
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
declarations: [AttributeDescriptorTooltipPipe],
|
|
6
|
+
exports: [AttributeDescriptorTooltipPipe]
|
|
7
|
+
})
|
|
8
|
+
export class AttributeDescriptorTooltipPipeModule {}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AttributeDescriptorTooltipPipe } from "./attributeDescriptorTooltip.pipe"
|
|
2
|
+
import { AttributeDescriptor } from "../../codeCharta.model"
|
|
3
|
+
|
|
4
|
+
const testKey = "testKey"
|
|
5
|
+
const testTitle = "testTitle"
|
|
6
|
+
const testHighValue = "testHighValue"
|
|
7
|
+
const testLowValue = "testLowValue"
|
|
8
|
+
const testDescription = "testDescription"
|
|
9
|
+
const testLink = "testLink"
|
|
10
|
+
let pipe: AttributeDescriptorTooltipPipe
|
|
11
|
+
let aD: AttributeDescriptor
|
|
12
|
+
|
|
13
|
+
describe("attributeDescriptorTooltipPipe", () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
aD = {
|
|
16
|
+
title: null,
|
|
17
|
+
description: null,
|
|
18
|
+
hintLowValue: null,
|
|
19
|
+
hintHighValue: null,
|
|
20
|
+
link: null
|
|
21
|
+
}
|
|
22
|
+
pipe = new AttributeDescriptorTooltipPipe()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it("should return empty string for null", () => {
|
|
26
|
+
expect(pipe.transform(null, "")).toBe("")
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("should return empty string for undefined", () => {
|
|
30
|
+
expect(pipe.transform(undefined, "")).toBe("")
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it("should be key if only key is present", () => {
|
|
34
|
+
expect(pipe.transform(aD, testKey)).toBe(testKey)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('should be "title (key)" if present', () => {
|
|
38
|
+
aD.title = testTitle
|
|
39
|
+
expect(pipe.transform(aD, testKey)).toBe(`${testTitle} (${testKey})`)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("should contain : if more information available", () => {
|
|
43
|
+
aD.hintLowValue = testLowValue
|
|
44
|
+
expect(pipe.transform(aD, testKey)).toContain(":")
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it("should include full information", () => {
|
|
48
|
+
aD.title = testTitle
|
|
49
|
+
aD.description = testDescription
|
|
50
|
+
aD.hintHighValue = testHighValue
|
|
51
|
+
aD.hintLowValue = testLowValue
|
|
52
|
+
const result = `${testTitle} (${testKey}):\n${testDescription}\nHigh Values: ${testHighValue}\nLow Values: ${testLowValue}`
|
|
53
|
+
expect(pipe.transform(aD, testKey)).toBe(result)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it("should not include link", () => {
|
|
57
|
+
aD.description = testDescription
|
|
58
|
+
aD.link = testLink
|
|
59
|
+
expect(pipe.transform(aD, testKey)).toBe(`${testKey}:\n${testDescription}`)
|
|
60
|
+
})
|
|
61
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from "@angular/core"
|
|
2
|
+
import { AttributeDescriptor } from "../../codeCharta.model"
|
|
3
|
+
import { metricTitles } from "../metric/metricTitles"
|
|
4
|
+
|
|
5
|
+
@Pipe({ name: "attributeDescriptorTooltip" })
|
|
6
|
+
export class AttributeDescriptorTooltipPipe implements PipeTransform {
|
|
7
|
+
transform(attributeDescriptor: AttributeDescriptor, key: string): string {
|
|
8
|
+
if (attributeDescriptor == null) {
|
|
9
|
+
return metricTitles.get(key) ?? ""
|
|
10
|
+
}
|
|
11
|
+
const title: string = attributeDescriptor.title ? `${attributeDescriptor.title} (${key})` : `${key}`
|
|
12
|
+
|
|
13
|
+
let subtitle: string = attributeDescriptor.description ? `\n${attributeDescriptor.description}` : ""
|
|
14
|
+
subtitle += attributeDescriptor.hintHighValue ? `\nHigh Values: ${attributeDescriptor.hintHighValue}` : ""
|
|
15
|
+
subtitle += attributeDescriptor.hintLowValue ? `\nLow Values: ${attributeDescriptor.hintLowValue}` : ""
|
|
16
|
+
|
|
17
|
+
return subtitle.length > 0 ? `${title}:${subtitle}` : title
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/webpack/index.html
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
<body>
|
|
8
8
|
<cc-code-charta></cc-code-charta>
|
|
9
|
-
<script src="runtime.e384ce5b1b4e5942.js" type="module"></script><script src="polyfills.d69fe4da6218c8a9.js" type="module"></script><script src="main.
|
|
9
|
+
<script src="runtime.e384ce5b1b4e5942.js" type="module"></script><script src="polyfills.d69fe4da6218c8a9.js" type="module"></script><script src="main.0e368e65a1bdf78b.js" type="module"></script>
|
|
10
10
|
|
|
11
11
|
</body></html>
|