-
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
eece1ad
commit 61c012c
Showing
9 changed files
with
99 additions
and
13 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
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 { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { SharedModule } from '../../shared/shared.module'; | ||
import { usePrefix } from '../../utils'; | ||
|
||
@Component({ | ||
selector: 'app-viewport', | ||
standalone: true, | ||
imports: [SharedModule], | ||
template: ` | ||
<div class="{{ prefix }}"> | ||
<ng-content></ng-content> | ||
</div> | ||
`, | ||
styleUrls: ['../styles/styles.less'], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ViewportComponent { | ||
prefix = usePrefix('viewport'); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,51 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input, OnChanges, signal, SimpleChanges } from '@angular/core'; | ||
import { WorkspacePanelItemComponent } from '@/app/components/panels/workspace-panel.component'; | ||
import { WorkbenchTypes } from '@/app/core/types'; | ||
import { Workbench } from '@/app/core/models/workbench'; | ||
import { ViewportComponent } from '@/app/components/container/viewport.component'; | ||
|
||
@Component({ | ||
selector: 'app-view-panel', | ||
standalone: true, | ||
imports: [], | ||
imports: [WorkspacePanelItemComponent, ViewportComponent], | ||
template: ` | ||
<div> | ||
<ng-content></ng-content> | ||
</div> | ||
@if (workbench.type == 'DESIGNABLE') { | ||
<app-viewport> | ||
<ng-content></ng-content> | ||
</app-viewport> | ||
} @else { | ||
<div [style]="defaultStyle()"> | ||
<ng-content></ng-content> | ||
</div> | ||
} | ||
`, | ||
styles: [``], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ViewPanelComponent {} | ||
export class ViewPanelComponent implements OnChanges { | ||
@Input() scrollable: boolean = true; | ||
|
||
@Input() type: WorkbenchTypes; | ||
|
||
@Input() dragTipsDirection?: 'left' | 'right'; | ||
|
||
workbench: Workbench = { type: 'DESIGNABLE' } as any; | ||
|
||
defaultStyle = signal({ | ||
overflow: 'overlay', | ||
height: '100%', | ||
cursor: 'auto', | ||
userSelect: 'text' | ||
}); | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (changes.scrollable) { | ||
this.defaultStyle.set({ | ||
overflow: this.scrollable ? 'overlay' : 'hidden', | ||
height: '100%', | ||
cursor: 'auto', | ||
userSelect: 'text' | ||
}); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { WorkspacePanelItemComponent } from './workspace-panel.component'; | ||
|
||
@Component({ | ||
selector: 'app-viewport-panel', | ||
standalone: true, | ||
imports: [], | ||
imports: [WorkspacePanelItemComponent], | ||
template: ` | ||
<div> | ||
<app-workspace-panel-item [style]="style" [flexible]="flexible"> | ||
<ng-content></ng-content> | ||
</div> | ||
</app-workspace-panel-item> | ||
`, | ||
styles: [``], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ViewportPanelComponent {} | ||
export class ViewportPanelComponent { | ||
@Input() style: { [p: string]: any }; | ||
|
||
@Input() flexible: boolean = true; | ||
} |
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,15 @@ | ||
import { WorkbenchTypes } from '../types'; | ||
import { Engine } from './engine'; | ||
import { Workspace } from './workspace'; | ||
|
||
export class Workbench { | ||
workspaces: Workspace[]; | ||
|
||
currentWorkspace: Workspace; | ||
|
||
activeWorkspace: Workspace; | ||
|
||
engine: Engine; | ||
|
||
type: WorkbenchTypes = 'DESIGNABLE'; | ||
} |
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 @@ | ||
export class Workspace {} |
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