-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(composer): use RenderComponent API in droppable component
- Loading branch information
Showing
8 changed files
with
111 additions
and
71 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
libs/composer/src/lib/composer-canvas/composer-canvas.component.html
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 +1 @@ | ||
<orc-orchestrator [config]="initialConfig"></orc-orchestrator> | ||
<orc-render-item [item]="initialConfig"></orc-render-item> |
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
30 changes: 6 additions & 24 deletions
30
libs/composer/src/lib/composer-droppable/composer-droppable-config.ts
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,29 +1,11 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { | ||
Option, | ||
OptionRequired, | ||
OrchestratorConfigItem, | ||
OrchestratorDynamicComponentType, | ||
} from '@orchestrator/core'; | ||
import { Option, OrchestratorConfigItem } from '@orchestrator/core'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
@Injectable({ providedIn: 'root' }) | ||
export class ComposerDroppableConfig<C = any> | ||
implements OrchestratorConfigItem<C> { | ||
@OptionRequired() | ||
component: string | OrchestratorDynamicComponentType<C>; | ||
|
||
@Option() | ||
config?: C; | ||
|
||
@Option() | ||
id?: string; | ||
|
||
@Option() | ||
classes?: string | string[] | { [name: string]: boolean }; | ||
|
||
@Option() | ||
attributes?: { [attr: string]: string }; | ||
|
||
export class ComposerDroppableConfig<C = any> { | ||
@Option() | ||
handlers?: { [event: string]: string | Function }; | ||
item?: OrchestratorConfigItem<C>; | ||
} |
5 changes: 5 additions & 0 deletions
5
libs/composer/src/lib/composer-droppable/composer-droppable.component.css
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
25 changes: 17 additions & 8 deletions
25
libs/composer/src/lib/composer-droppable/composer-droppable.component.html
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,9 +1,18 @@ | ||
<orc-orchestrator *ngIf="config.component" [config]="config"></orc-orchestrator> | ||
<div | ||
*ngIf="!config.component" | ||
class="drop-list" | ||
cdkDropList | ||
(cdkDropListDropped)="drop($event)" | ||
> | ||
<span class="drop-list-hint">Drop component here!</span> | ||
<div class="rendered-item" *ngIf="config?.item?.component; else dropTpl"> | ||
<orc-render-item [item]="config.item"></orc-render-item> | ||
</div> | ||
<ng-template #dropTpl> | ||
<div | ||
class="drop-list" | ||
cdkDropList | ||
(cdkDropListDropped)="drop($event, configInput.value)" | ||
> | ||
<span class="drop-list-hint">Drop component here!</span> | ||
</div> | ||
<nz-divider nzText="Set component configuration" nzDashed></nz-divider> | ||
<textarea | ||
#configInput | ||
nz-input | ||
[nzAutosize]="{ minRows: 2, maxRows: 6 }" | ||
></textarea> | ||
</ng-template> |
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