Skip to content

Commit 5c912f4

Browse files
Merge pull request #55 from Foblex/examples-docs
Examples docs
2 parents ecfed74 + d75b639 commit 5c912f4

File tree

160 files changed

+1645
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1645
-287
lines changed

angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
}
3131
],
3232
"styles": [
33+
// "projects/f-docs/src/assets/styles/styles.scss",
3334
"src/styles/styles.scss"
3435
],
3536
"scripts": [],

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"scripts": {
1313
"ng": "ng",
1414
"start": "ng serve",
15+
"start-shared": "ng serve --host 0.0.0.0",
1516
"build": "ng build && cp dist/f-flow-portal/browser/index.html dist/f-flow-portal/browser/404.html",
1617
"watch": "ng build --watch --configuration development",
1718
"test": "ng test f-flow",
@@ -65,13 +66,14 @@
6566
"@angular/ssr": "^18.2.3",
6667
"@foblex/2d": "1.1.0",
6768
"@foblex/drag-toolkit": "1.1.0",
68-
"@foblex/f-docs": "1.3.3",
69+
"@foblex/f-docs": "1.3.5",
6970
"@foblex/mediator": "1.1.0",
7071
"@foblex/platform": "1.0.3",
7172
"@foblex/utils": "1.1.0",
7273
"dagre": "^0.8.5",
7374
"elkjs": "^0.9.3",
7475
"express": "^4.18.2",
76+
"html2canvas": "^1.4.1",
7577
"rxjs": "~7.8.0",
7678
"tslib": "^2.3.0",
7779
"zone.js": "~0.14.3"
@@ -82,6 +84,7 @@
8284
"@angular/compiler-cli": "^18.2.0",
8385
"@types/dagre": "^0.7.52",
8486
"@types/express": "^4.17.17",
87+
"@types/html2canvas": "^1.0.0",
8588
"@types/jasmine": "~5.1.0",
8689
"@types/node": "^18.18.0",
8790
"jasmine-core": "~5.1.0",

projects/f-examples/_flow-common.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
--minimap-node-selected-color: #a8b1ff;
3939
--minimap-view-color: rgba(100, 108, 255, 0.16);
4040
}
41+
42+
--form-field-text-color: var(--node-color);
43+
--form-field-background: var(--minimap-view-color);
44+
--form-field-panel-shadow: var(--shadow-4);
45+
--form-field-panel-background: var(--node-background-color);
46+
--form-field-active-color: var(--minimap-node-selected-color);
4147
}
4248

4349
@mixin connection {
@@ -108,8 +114,8 @@
108114
}
109115

110116
@mixin node {
111-
width: 100px;
112-
padding: 4px;
117+
width: 120px;
118+
padding: 24px;
113119
color: var(--node-color);
114120
text-align: center;
115121
background: var(--node-background-color);
@@ -124,7 +130,6 @@
124130

125131
@mixin connectors {
126132

127-
128133
.connectors-line {
129134
position: absolute;
130135
display: flex;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
::ng-deep {
2+
3+
.f-form-field {
4+
--mdc-filled-text-field-container-color: var(--form-field-background); //container-background
5+
--mdc-filled-text-field-label-text-color: var(--form-field-text-color); //label color
6+
--mdc-filled-text-field-hover-label-text-color: var(--form-field-text-color); //label color
7+
--mdc-filled-text-field-focus-label-text-color: var(--form-field-active-color); //label color
8+
--mdc-filled-text-field-active-indicator-color: var(--form-field-text-color); //active color
9+
--mdc-filled-text-field-focus-active-indicator-color: var(--form-field-active-color); //focus color
10+
--mdc-filled-text-field-hover-active-indicator-color: var(--form-field-active-color); //focus color
11+
12+
.mdc-text-field {
13+
.mat-mdc-form-field-flex {
14+
.mat-mdc-select {
15+
--mat-select-enabled-trigger-text-color: var(--form-field-text-color);
16+
--mat-select-placeholder-text-color: var(--form-field-text-color);
17+
--mat-select-enabled-arrow-color: var(--form-field-text-color);
18+
--mat-select-focused-arrow-color: var(--form-field-active-color);
19+
}
20+
}
21+
}
22+
}
23+
}
24+
25+
::ng-deep {
26+
27+
.f-select-panel {
28+
--mat-select-panel-background-color: var(--form-field-panel-background);
29+
--mat-select-container-elevation-shadow: var(--form-field-panel-shadow);
30+
31+
--mat-option-selected-state-label-text-color: var(--form-field-active-color);
32+
--mat-option-label-text-color: var(--form-field-text-color);
33+
--mat-option-selected-state-layer-color: var(--form-field-background);
34+
--mat-option-hover-state-layer-color: var(--form-field-background);
35+
--mat-option-focus-state-layer-color: var(--form-field-background);
36+
37+
--mat-option-min-height: calc(48px * var(--flow-scale, 1));
38+
--mat-option-label-text-size: calc(14px * var(--flow-scale, 1));
39+
--mat-option-label-text-line-height: calc(16px * var(--flow-scale, 1));
40+
--mat-option-padding: 0 calc(16px * var(--flow-scale, 1));
41+
--mat-panel-padding: calc(8px * var(--flow-scale, 1)) 0;
42+
43+
&.mat-mdc-select-panel {
44+
padding: var(--mat-panel-padding);
45+
46+
.mat-mdc-option {
47+
min-height: var(--mat-option-min-height);
48+
padding: var(--mat-option-padding);
49+
50+
.mat-pseudo-checkbox {
51+
display: none;
52+
}
53+
}
54+
}
55+
}
56+
}
57+
58+
::ng-deep {
59+
.mat-mdc-button {
60+
--mat-text-button-state-layer-color: var(--form-field-active-color);
61+
--mdc-text-button-label-text-color: var(--form-field-text-color);
62+
}
63+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<f-flow fDraggable (fLoaded)="onLoaded()" (fCreateConnection)="addConnection($event)">
2+
<f-canvas>
3+
<f-connection-for-create></f-connection-for-create>
4+
5+
@for (connection of connections; track connection.inputId) {
6+
<f-connection [fReassignDisabled]="true"
7+
[fOutputId]="connection.outputId" [fInputId]="connection.inputId">
8+
</f-connection>
9+
}
10+
11+
<div fNode fDragHandle [fNodePosition]="{ x: 24, y: 24 }" fNodeOutput fOutputConnectableSide="right">drag me</div>
12+
<div fNode fDragHandle [fNodePosition]="{ x: 244, y: 24 }" fNodeInput fInputConnectableSide="left">to me</div>
13+
14+
</f-canvas>
15+
</f-flow>
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
@use "../../flow-common";
22

3-
::ng-deep groups-simple-example {
3+
::ng-deep drag-to-connect {
44
@include flow-common.connection;
55
}
66

77
.f-node {
88
@include flow-common.node;
9-
cursor: default;
109
}
1110

12-
.f-group {
13-
background-color: red;
14-
opacity: 0.3;
15-
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ViewChild } from '@angular/core';
2+
import { FCanvasComponent, FCreateConnectionEvent, FFlowModule } from '@foblex/flow';
3+
4+
@Component({
5+
selector: 'drag-to-connect',
6+
styleUrls: [ './drag-to-connect.component.scss' ],
7+
templateUrl: './drag-to-connect.component.html',
8+
changeDetection: ChangeDetectionStrategy.OnPush,
9+
standalone: true,
10+
imports: [
11+
FFlowModule
12+
]
13+
})
14+
export class DragToConnectComponent {
15+
16+
@ViewChild(FCanvasComponent, { static: true })
17+
public fCanvas!: FCanvasComponent;
18+
19+
public connections: { outputId: string, inputId: string }[] = [];
20+
21+
constructor(
22+
private changeDetectorRef: ChangeDetectorRef
23+
) {
24+
}
25+
26+
public addConnection(event: FCreateConnectionEvent): void {
27+
if(!event.fInputId) {
28+
return;
29+
}
30+
this.connections.push({ outputId: event.fOutputId, inputId: event.fInputId });
31+
this.changeDetectorRef.detectChanges();
32+
}
33+
34+
public onLoaded(): void {
35+
this.fCanvas.resetScaleAndCenter(false);
36+
}
37+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<f-flow fDraggable (fLoaded)="onLoaded()" (fReassignConnection)="reassignConnection($event)">
2+
<f-canvas>
3+
@for (connection of connections;track connection.inputId) {
4+
<f-connection fBehavior="floating"
5+
[fOutputId]="connection.outputId" [fInputId]="connection.inputId">
6+
</f-connection>
7+
}
8+
9+
<div fNode fDragHandle [fNodePosition]="{ x: 24, y: 24 }" fNodeOutput fOutputId="1">Output</div>
10+
<div fNode fDragHandle [fNodePosition]="{ x: 224, y: 24 }" fNodeInput fInputId="2">Input</div>
11+
<div fNode fDragHandle [fNodePosition]="{ x: 224, y: 124 }" fNodeInput>Input</div>
12+
</f-canvas>
13+
</f-flow>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@use "../../flow-common";
2+
3+
::ng-deep drag-to-reassign {
4+
@include flow-common.connection;
5+
.f-connection {
6+
.f-connection-drag-handle {
7+
fill: var(--connection-color);
8+
}
9+
}
10+
}
11+
12+
.f-node {
13+
@include flow-common.node;
14+
}
15+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ViewChild } from '@angular/core';
2+
import { FCanvasComponent, FFlowModule, FReassignConnectionEvent } from '@foblex/flow';
3+
4+
@Component({
5+
selector: 'drag-to-reassign',
6+
styleUrls: [ './drag-to-reassign.component.scss' ],
7+
templateUrl: './drag-to-reassign.component.html',
8+
changeDetection: ChangeDetectionStrategy.OnPush,
9+
standalone: true,
10+
imports: [
11+
FFlowModule
12+
]
13+
})
14+
export class DragToReassignComponent {
15+
16+
@ViewChild(FCanvasComponent, { static: true })
17+
public fCanvas!: FCanvasComponent;
18+
19+
public connections: { outputId: string, inputId: string }[] = [
20+
{ outputId: '1', inputId: '2' },
21+
];
22+
23+
constructor(
24+
private changeDetectorRef: ChangeDetectorRef
25+
) {
26+
}
27+
28+
public reassignConnection(event: FReassignConnectionEvent): void {
29+
if(!event.newFInputId) {
30+
return;
31+
}
32+
this.connections = [ { outputId: event.fOutputId, inputId: event.newFInputId } ];
33+
this.changeDetectorRef.detectChanges();
34+
}
35+
36+
public onLoaded(): void {
37+
this.fCanvas.resetScaleAndCenter(false);
38+
}
39+
}

0 commit comments

Comments
 (0)