-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work for #3390: implement side-bar and property grid
- Loading branch information
Showing
10 changed files
with
126 additions
and
3 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
5 changes: 5 additions & 0 deletions
5
packages/survey-creator-angular/src/property-panel/object-selector.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ng-template #template> | ||
<div class="svc-object-selector" *ngIf="model.isVisible"> | ||
<sv-ng-list [model]="model.list"></sv-ng-list> | ||
</div> | ||
</ng-template> |
17 changes: 17 additions & 0 deletions
17
packages/survey-creator-angular/src/property-panel/object-selector.component.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component, Input } from "@angular/core"; | ||
import { AngularComponentFactory, BaseAngular } from "survey-angular-ui"; | ||
import { ObjectSelectorModel, SidebarTabModel } from "survey-creator-core"; | ||
|
||
@Component({ | ||
selector: "svc-object-selector", | ||
templateUrl: "./object-selector.component.html", | ||
styles: [":host { display: none; }"] | ||
}) | ||
export class ObjectSelectorComponent extends BaseAngular<ObjectSelectorModel> { | ||
@Input() model!: ObjectSelectorModel; | ||
protected getModel(): ObjectSelectorModel { | ||
return this.model; | ||
} | ||
} | ||
|
||
AngularComponentFactory.Instance.registerComponent("svc-object-selector", ObjectSelectorComponent); |
3 changes: 3 additions & 0 deletions
3
packages/survey-creator-angular/src/property-panel/property-grid.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<ng-template #template> | ||
<survey-content [model]="model.survey"></survey-content> | ||
</ng-template> |
24 changes: 24 additions & 0 deletions
24
packages/survey-creator-angular/src/property-panel/property-grid.component.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { PropertyGridViewModel } from "survey-creator-core"; | ||
import { Component, Input } from "@angular/core"; | ||
import { AngularComponentFactory, BaseAngular } from "survey-angular-ui"; | ||
import { QuestionFactory, QuestionButtonGroupModel } from "survey-core"; | ||
|
||
@Component({ | ||
selector: "svc-property-grid", | ||
templateUrl: "./property-grid.component.html", | ||
styles: [":host { display: none; }"] | ||
}) | ||
export class PropertyGridComponent extends BaseAngular<PropertyGridViewModel> { | ||
@Input() model!: PropertyGridViewModel; | ||
protected getModel(): PropertyGridViewModel { | ||
return this.model; | ||
} | ||
} | ||
|
||
QuestionFactory.Instance.registerQuestion("buttongroup", (name) => { | ||
var q = new QuestionButtonGroupModel(name); | ||
q.choices = QuestionFactory.DefaultChoices; | ||
return q; | ||
}); | ||
|
||
AngularComponentFactory.Instance.registerComponent("svc-property-grid", PropertyGridComponent); |
5 changes: 5 additions & 0 deletions
5
packages/survey-creator-angular/src/side-bar/side-bar-tab.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ng-template #template> | ||
<ng-container *ngIf="model.visible"> | ||
<ng-template [component]="{ name: model.componentName, data: { model: model.model } }"></ng-template> | ||
</ng-container> | ||
</ng-template> |
16 changes: 16 additions & 0 deletions
16
packages/survey-creator-angular/src/side-bar/side-bar-tab.component.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
import { Component, Input } from "@angular/core"; | ||
import { BaseAngular } from "survey-angular-ui"; | ||
import { SidebarTabModel } from "survey-creator-core"; | ||
|
||
@Component({ | ||
selector: "svc-side-bar-tab", | ||
templateUrl: "./side-bar-tab.component.html", | ||
styles: [":host { display: none; }"] | ||
}) | ||
export class SidebarTabComponent extends BaseAngular<SidebarTabModel> { | ||
@Input() model!: SidebarTabModel; | ||
protected getModel(): SidebarTabModel { | ||
return this.model; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/survey-creator-angular/src/side-bar/side-bar.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<ng-template #template> | ||
<div class="svc-side-bar" [class.svc-flyout-side-bar]="model.flyoutPanelMode" [visible]="model.hasVisibleTabs"> | ||
<div class="svc-side-bar__shadow" (click)="model.collapseSidebar()"></div> | ||
<div class="svc-flex-column svc-side-bar__wrapper"> | ||
<div class="svc-side-bar__container" [visible]="model.visible" #container> | ||
<div class="svc-side-bar__container-header"> | ||
<div class="svc-side-bar__container-actions"> | ||
<sv-action-bar [model]="model.toolbar"></sv-action-bar> | ||
</div> | ||
<div *ngIf="!!model.headerText" class="svc-side-bar__container-title"> | ||
{{model.headerText}} | ||
</div> | ||
</div> | ||
<div class="svc-side-bar__container-content"> | ||
<ng-container *ngFor="let tab of model.tabs"> | ||
<svc-side-bar-tab [model]="tab"></svc-side-bar-tab> | ||
</ng-container> | ||
</div> | ||
<div class="svc-side-bar__container-close"> | ||
<div class="sd-btn sd-btn--action svc-side-bar__container-close-button" | ||
(click)="model.collapseSidebar()"> {{ model.closeText }}</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</ng-template> |
24 changes: 24 additions & 0 deletions
24
packages/survey-creator-angular/src/side-bar/side-bar.component.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SidebarModel } from "survey-creator-core"; | ||
import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from "@angular/core"; | ||
import { BaseAngular } from "survey-angular-ui"; | ||
|
||
@Component({ | ||
selector: "svc-side-bar", | ||
templateUrl: "./side-bar.component.html", | ||
styles: [":host { display: none; }"] | ||
}) | ||
export class SidebarComponent extends BaseAngular<SidebarModel> implements AfterViewInit { | ||
@Input() model!: SidebarModel; | ||
@ViewChild("container") container!: ElementRef<HTMLElement>; | ||
protected getModel(): SidebarModel { | ||
return this.model; | ||
} | ||
|
||
override ngOnDestroy(): void { | ||
this.model.resetResizeManager(); | ||
super.ngOnDestroy(); | ||
} | ||
ngAfterViewInit(): void { | ||
this.model.initResizeManager(this.container.nativeElement); | ||
} | ||
} |