-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3659983
commit 5fe9f97
Showing
14 changed files
with
521 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-position-svg', | ||
standalone: true, | ||
template: ` | ||
<svg | ||
viewBox="0 0 1024 1024" | ||
[attr.width]="width" | ||
[attr.height]="height" | ||
fill="currentColor" | ||
focusable="false" | ||
aria-hidden="true" | ||
> | ||
<path | ||
d="M872,885 C893.879,885 911.64158,902.54379 911.994644,924.338274 L912,925 C912,947.1 894.1,965 872,965 L152,965 C130.121,965 112.35842,947.45621 112.005356,925.661726 L112,925 C112,902.9 129.9,885 152,885 L872,885 Z M512,60 C555.2,60 597.2,68.5 636.7,85.2 C674.8,101.3 709.1,124.4 738.5,153.8 C767.9,183.2 791,217.5 807.1,255.6 C823.8,295.1 832.3,337.1 832.3,380.3 C832.3,496.1 739.4,640.1 539.8,833.4 L512,860.3 L484.2,833.3 C284.6,640.1 191.7,496.1 191.7,380.3 C191.7,337.1 200.2,295.1 216.9,255.6 C233,217.5 256.1,183.2 285.5,153.8 C314.9,124.4 349.2,101.3 387.3,85.2 C426.8,68.5 468.8,60 512,60 Z M512,140 C447.8,140 387.5,165 342.1,210.4 C296.7,255.8 271.7,316.1 271.7,380.3 C271.7,424.4 293.5,479.4 336.5,543.8 C376.8,604 434.3,671.2 512,748.6 C589.6,671.2 647.2,604 687.5,543.8 C730.5,479.5 752.3,424.5 752.3,380.3 C752.3,316.1 727.3,255.8 681.9,210.4 C636.5,165 576.2,140 512,140 Z M512,228 C600.2,228 672,299.8 672,388 C672,476.2 600.2,548 512,548 C423.8,548 352,476.2 352,388 C352,299.8 423.8,228 512,228 Z M512,308 C467.9,308 432,343.9 432,388 C432,432.1 467.9,468 512,468 C556.1,468 592,432.1 592,388 C592,343.9 556.1,308 512,308 Z" | ||
></path> | ||
</svg> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class PositionSvg { | ||
@Input() width: string | number = '1em'; | ||
|
||
@Input() height: string | number = '1em'; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/app/components/widgets/node-path/node-path.widget.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@import 'ng-zorro-antd/style/themes/default.less'; | ||
@import '../../../../theme/variables.less'; | ||
|
||
.@{prefix-cls}-node-path { | ||
padding: 4px 10px !important; | ||
border-bottom: 1px solid var(--dn-panel-border-color); | ||
|
||
.@{prefix-cls}-icon { | ||
font-size: 11px; | ||
} | ||
|
||
.@{ant-prefix}-breadcrumb-separator { | ||
margin: 0 4px !important; | ||
} | ||
|
||
a { | ||
font-size: 12px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; | ||
import { usePrefix } from '@/app/utils'; | ||
import { HookService } from '@/app/services/hook.service'; | ||
import { Selection, TreeNode } from '@/app/core/models'; | ||
import { Hover } from '@/app/core/models/hover'; | ||
import { SharedModule } from '@/app/shared/shared.module'; | ||
import { IconWidget } from '@/app/components/widgets/icon/icon.widget'; | ||
import { NodeTitleWidget } from '@/app/components/widgets/node-title/node-title.widget'; | ||
|
||
@Component({ | ||
selector: 'app-node-path', | ||
template: ` | ||
@if (selected) { | ||
<nz-breadcrumb class="{{ prefix }}"> | ||
@for (node of nodes; track node; let key = $index) { | ||
<nz-breadcrumb-item> | ||
@if (key === 0) { | ||
<app-icon icon="Position" [style]="{ marginRight: '3px' }"></app-icon> | ||
} | ||
<a href=""> | ||
<app-node-title-widget [node]="node"></app-node-title-widget> | ||
</a> | ||
</nz-breadcrumb-item> | ||
<br /> | ||
} | ||
</nz-breadcrumb> | ||
} | ||
`, | ||
standalone: true, | ||
imports: [SharedModule, IconWidget, NodeTitleWidget], | ||
styleUrls: ['./node-path.widget.less'] | ||
}) | ||
export class NodePathWidget implements OnChanges { | ||
prefix = usePrefix('node-path'); | ||
|
||
@Input() workspaceId: string; | ||
|
||
@Input() maxItems: number; | ||
|
||
selection: Selection; | ||
|
||
selected: TreeNode; | ||
|
||
hover: Hover; | ||
|
||
nodes: TreeNode[] = []; | ||
|
||
constructor(private hookService: HookService) {} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (changes.workspaceId && changes.workspaceId.currentValue) { | ||
this.selected = this.hookService.useSelectedNode(this.workspaceId); | ||
this.selection = this.hookService.useSelection(this.workspaceId); | ||
this.hover = this.hookService.useHover(this.workspaceId); | ||
const maxItems = this.maxItems ?? 3; | ||
this.nodes = this.selected | ||
.getParents() | ||
.slice(0, maxItems - 1) | ||
.reverse() | ||
.concat(this.selected); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.