-
Notifications
You must be signed in to change notification settings - Fork 12
AF-243 Remove MaterialUI from examples #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc9ba7f
Remove unused refs in example
kamilEf 415fb4a
AF-243 Remove MaterialUI from examples
kamilEf 5d7ab21
AF-243 Remove MaterialUI from examples
kamilEf 2acb254
AF-243 Remove MaterialUI from examples
kamilEf 880678f
AF-243 Remove MaterialUI from examples
kamilEf 34375db
AF-243 Remove MaterialUI from examples
kamilEf 60bf227
AF-243 Remove MaterialUI from examples
kamilEf 15dd3f4
AF-243 Remove MaterialUI from examples
kamilEf 0a7eead
minor style change
lukasz-jazwa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
apps/docs/src/components/angular/examples/angular-material-node/angular-material-node.astro
This file contains hidden or 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,5 @@ | ||
| --- | ||
| import { DiagramComponent } from './diagram.component'; | ||
| --- | ||
|
|
||
| <DiagramComponent client:only="angular" /> |
11 changes: 11 additions & 0 deletions
11
apps/docs/src/components/angular/examples/angular-material-node/diagram.component.scss
This file contains hidden or 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,11 @@ | ||
| :host { | ||
| flex: 1; | ||
| display: flex; | ||
| } | ||
|
|
||
| .diagram { | ||
| flex: 1; | ||
| display: flex; | ||
| height: 20rem; | ||
| font-family: 'Poppins', sans-serif; | ||
| } |
72 changes: 72 additions & 0 deletions
72
apps/docs/src/components/angular/examples/angular-material-node/diagram.component.ts
This file contains hidden or 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,72 @@ | ||
| import '@angular/compiler'; | ||
| import { Component } from '@angular/core'; | ||
| import { | ||
| initializeModel, | ||
| NgDiagramComponent, | ||
| NgDiagramNodeTemplateMap, | ||
| provideNgDiagram, | ||
| type NgDiagramConfig, | ||
| } from 'ng-diagram'; | ||
|
|
||
| import { NodeComponent } from './node/node.component'; | ||
|
|
||
| enum NodeTemplateType { | ||
| CustomNodeType = 'customNodeType', | ||
| } | ||
|
|
||
| @Component({ | ||
| imports: [NgDiagramComponent], | ||
| providers: [provideNgDiagram()], | ||
| template: ` | ||
| <div class="not-content diagram"> | ||
| <ng-diagram | ||
| [model]="model" | ||
| [config]="config" | ||
| [nodeTemplateMap]="nodeTemplateMap" | ||
| /> | ||
| </div> | ||
| `, | ||
| styleUrl: './diagram.component.scss', | ||
| }) | ||
| export class DiagramComponent { | ||
| nodeTemplateMap = new NgDiagramNodeTemplateMap([ | ||
| [NodeTemplateType.CustomNodeType, NodeComponent], | ||
| ]); | ||
|
|
||
| config = { | ||
| zoom: { | ||
| max: 3, | ||
| }, | ||
| } satisfies NgDiagramConfig; | ||
|
|
||
| model = initializeModel({ | ||
| nodes: [ | ||
| { | ||
| id: '1', | ||
| position: { x: 50, y: 20 }, | ||
| type: 'customNodeType', | ||
| data: { | ||
| name: 'Node 1', | ||
| description: | ||
| 'This is Node 1. This node is a custom node with a custom template.', | ||
| tooltip: 'Node 1 is a custom node', | ||
| status: 'Active', | ||
| }, | ||
| }, | ||
| { | ||
| id: '2', | ||
| position: { x: 400, y: 20 }, | ||
| type: 'customNodeType', | ||
| data: { | ||
| name: 'Node 2', | ||
| description: | ||
| 'This is Node 2. Initial status is red. This node is a custom node with a custom template.', | ||
| tooltip: 'Node 2 is a custom node', | ||
| status: 'Error', | ||
| }, | ||
| }, | ||
| ], | ||
| edges: [], | ||
| metadata: { viewport: { x: 0, y: 0, scale: 1 } }, | ||
kamilEf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
| } | ||
40 changes: 40 additions & 0 deletions
40
apps/docs/src/components/angular/examples/angular-material-node/node/node.component.html
This file contains hidden or 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,40 @@ | ||
| <div class="node"> | ||
| <div class="node-header"> | ||
| <div> | ||
| {{ node().data.name }} | ||
| </div> | ||
| <div> | ||
| <mat-chip [style.backgroundColor]="nodeStatus()"> | ||
| {{ this.node().data.status }} | ||
| </mat-chip> | ||
| </div> | ||
| </div> | ||
| <div class="node-body" title="{{ node().data.tooltip }}"> | ||
| <mat-accordion> | ||
| <mat-expansion-panel> | ||
| <mat-expansion-panel-header> | ||
| <mat-panel-title>Description</mat-panel-title> | ||
| </mat-expansion-panel-header> | ||
| <p>{{ node().data.description }}</p> | ||
| </mat-expansion-panel> | ||
| <mat-expansion-panel> | ||
| <mat-expansion-panel-header> | ||
| <mat-panel-title>Options</mat-panel-title> | ||
| </mat-expansion-panel-header> | ||
| <form> | ||
| <mat-form-field> | ||
| <mat-select | ||
| (selectionChange)="onColorChange($event)" | ||
| [value]="this.node().data.status" | ||
| name="status" | ||
| > | ||
| <mat-option value="Active">Active</mat-option> | ||
| <mat-option value="Inactive">Inactive</mat-option> | ||
| <mat-option value="Error">Error</mat-option> | ||
| </mat-select> | ||
| </mat-form-field> | ||
| </form> | ||
| </mat-expansion-panel> | ||
| </mat-accordion> | ||
| </div> | ||
| </div> |
56 changes: 56 additions & 0 deletions
56
apps/docs/src/components/angular/examples/angular-material-node/node/node.component.scss
kamilEf marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,56 @@ | ||
| :host { | ||
| display: flex; | ||
| width: 100%; | ||
| height: 100%; | ||
| border-radius: 10px; | ||
| border: 1px solid var(--ngd-node-stroke-primary-default); | ||
| background-color: var(--ngd-node-bg-primary-default); | ||
|
|
||
| .node { | ||
| display: flex; | ||
| flex-direction: column; | ||
| padding: 12px; | ||
| border-radius: 10px; | ||
|
|
||
| &-header { | ||
| font-weight: bold; | ||
| margin-bottom: 10px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| vertical-align: middle; | ||
| align-items: center; | ||
| justify-items: center; | ||
|
|
||
| .mat-mdc-chip { | ||
| --mdc-chip-label-text-color: white !important; | ||
| } | ||
| } | ||
|
|
||
| &-body { | ||
| font-size: 12px; | ||
| cursor: help; | ||
|
|
||
| p { | ||
| width: 180px; | ||
| } | ||
|
|
||
| .mat-expansion-panel { | ||
| --mat-expansion-container-background-color: var( | ||
| --ngd-node-stroke-primary-default | ||
| ); | ||
| --mat-expansion-header-text-color: var(--ngd-txt-primary-default); | ||
| --mat-expansion-container-text-color: var(--ngd-txt-primary-default); | ||
| --mat-expansion-header-indicator-color: var(--ngd-txt-primary-default); | ||
| } | ||
|
|
||
| form { | ||
| height: 50px; | ||
| margin-top: 8px; | ||
|
|
||
| .mat-mdc-form-field { | ||
| min-width: 120px; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
58 changes: 58 additions & 0 deletions
58
apps/docs/src/components/angular/examples/angular-material-node/node/node.component.ts
This file contains hidden or 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,58 @@ | ||
| import { Component, computed, inject, input, signal } from '@angular/core'; | ||
| import { FormsModule } from '@angular/forms'; | ||
| import { MatChipsModule } from '@angular/material/chips'; | ||
| import { MatExpansionModule } from '@angular/material/expansion'; | ||
| import { MatFormFieldModule } from '@angular/material/form-field'; | ||
| import { MatInputModule } from '@angular/material/input'; | ||
| import { MatSelectModule } from '@angular/material/select'; | ||
| import { | ||
| NgDiagramModelService, | ||
| NgDiagramNodeRotateAdornmentComponent, | ||
| NgDiagramNodeSelectedDirective, | ||
| type NgDiagramNodeTemplate, | ||
| type Node, | ||
| } from 'ng-diagram'; | ||
|
|
||
| export type NodeData = { | ||
| name: string; | ||
| status: string; | ||
| description: string; | ||
| tooltip: string; | ||
| }; | ||
|
|
||
| @Component({ | ||
| selector: 'node', | ||
| imports: [ | ||
| NgDiagramNodeRotateAdornmentComponent, | ||
| MatSelectModule, | ||
| MatFormFieldModule, | ||
| FormsModule, | ||
| MatInputModule, | ||
| MatChipsModule, | ||
| MatExpansionModule, | ||
| ], | ||
| hostDirectives: [ | ||
| { directive: NgDiagramNodeSelectedDirective, inputs: ['node'] }, | ||
| ], | ||
| templateUrl: './node.component.html', | ||
| styleUrls: ['./node.component.scss'], | ||
| }) | ||
| export class NodeComponent implements NgDiagramNodeTemplate<NodeData> { | ||
| private readonly modelService = inject(NgDiagramModelService); | ||
| readonly panelOpenState = signal(false); | ||
| node = input.required<Node<NodeData>>(); | ||
| nodeStatus = computed(() => | ||
| this.node().data.status === 'Active' | ||
| ? 'green' | ||
| : this.node().data.status === 'Error' | ||
| ? 'red' | ||
| : 'orange' | ||
| ); | ||
|
|
||
| onColorChange({ value }: any) { | ||
| this.modelService.updateNodeData(this.node().id, { | ||
| ...this.node().data, | ||
| status: value, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.