Skip to content

Commit

Permalink
Work for #3390: implement translation tab
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Sep 1, 2022
1 parent 4b9b9c0 commit d40ee61
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/survey-creator-angular/src/angular-ui.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import { LogicAddButtonComponent } from "./tabs/logic/logic-add-btn.component";
import { ActionButtonComponent } from "./components/action-button.component";
import { LinkValueQuestionComponent } from "./questions/question-link-value.component";
import { EmbeddedSurveyQuestionComponent } from "./questions/question-embedded-survey.component";
import { TranslationTabComponent } from "./tabs/translation/translation.component";
import { TranslationSkeletonComponent } from "./tabs/translation/translation-line-skeleton.component";

@NgModule({
declarations: [CreatorComponent, DesignerTabComponent, SvgBundleComponent, TabbledMenuComponent, TabbedMenuItemComponent, TabbedMenuItemWrapperComponent, SidebarComponent, SidebarTabComponent, ObjectSelectorComponent, PropertyGridComponent, TextareaJsonEditorComponent, AceJsonEditorComponent, LogicTabComponent, LogicAddButtonComponent, ActionButtonComponent, LinkValueQuestionComponent, EmbeddedSurveyQuestionComponent],
declarations: [CreatorComponent, DesignerTabComponent, SvgBundleComponent, TabbledMenuComponent, TabbedMenuItemComponent, TabbedMenuItemWrapperComponent, SidebarComponent, SidebarTabComponent, ObjectSelectorComponent, PropertyGridComponent, TextareaJsonEditorComponent, AceJsonEditorComponent, LogicTabComponent, LogicAddButtonComponent, ActionButtonComponent, LinkValueQuestionComponent, EmbeddedSurveyQuestionComponent, TranslationTabComponent, TranslationSkeletonComponent],
imports: [
CommonModule, FormsModule, SurveyAngularModule
],
Expand Down
6 changes: 4 additions & 2 deletions packages/survey-creator-angular/src/creator.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChangeDetectorRef, Component, Input } from "@angular/core";
import { BaseAngular } from "survey-angular-ui";
import { AngularComponentFactory, BaseAngular, SurveyContentComponent } from "survey-angular-ui";
import { CreatorBase } from "survey-creator-core";

@Component({
Expand All @@ -23,4 +23,6 @@ export class CreatorComponent extends BaseAngular<CreatorBase> {
protected override onModelChanged(): void {
this.changeDetectorRef.detectChanges();
}
}
}

AngularComponentFactory.Instance.registerComponent("survey-widget", SurveyContentComponent);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ng-template #template>
<div class="sd-translation-line-skeleton"></div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from "@angular/core";
import { AngularComponentFactory } from "survey-angular-ui";

@Component({
selector: "sd-translation-line-skeleton",
templateUrl: "./translation-line-skeleton.component.html",
styles: [":host { display: none; }"]
})
export class TranslationSkeletonComponent { }
AngularComponentFactory.Instance.registerComponent("sd-translation-line-skeleton", TranslationSkeletonComponent);

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ng-template #template>
<div class="svc-creator-tab__content svc-translation-tab">
<div class="st-content">
<div *ngIf="model.isEmpty" class="st-no-strings">
<span>{{model.noStringsText}}</span>
</div>
<div *ngIf="!model.isEmpty" class="svc-flex-column st-strings-wrapper">
<div class="svc-flex-row st-strings-header">
<survey-content [model]="model.stringsHeaderSurvey"></survey-content>
</div>
<div class="svc-flex-row svc-plugin-tab__content st-strings">
<survey-content [model]="model.stringsSurvey"></survey-content>
</div>
</div>
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Component, Input } from "@angular/core";
import { AngularComponentFactory, BaseAngular } from "survey-angular-ui";
import { Translation } from "survey-creator-core";

@Component({
selector: "svc-tab-translation",
templateUrl: "./translation.component.html",
styles: [":host { display: none; }"]
})
export class TranslationTabComponent extends BaseAngular<Translation> {
@Input() model!: Translation;

protected getModel(): Translation {
return this.model;
}
}
AngularComponentFactory.Instance.registerComponent("svc-tab-translation", TranslationTabComponent);

Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
padding: calcSize(1) 0;
}

.st-table__cell:first-child {
.st-table__cell:first-of-type {
@include defaultBold;
color: $foreground;
max-width: 300px;
Expand All @@ -104,7 +104,7 @@
}
}

.st-panel-indent .st-table__cell:first-child {
.st-panel-indent .st-table__cell:first-of-type {
span {
padding-left: calcSize(6);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
.spg-table__cell:not(.spg-table__cell--detail-panel):first-of-type .spg-text {
padding-left: calcSize(2);
}
.spg-table__cell--actions:first-child {
.spg-table__cell--actions:first-of-type {
width: calcSize(6);
}
.spg-table__cell--actions > .spg-matrixdynamic__drag-element {
Expand Down

0 comments on commit d40ee61

Please sign in to comment.