Skip to content

Commit

Permalink
#5659 Extract Rating items to separated component - better css and co…
Browse files Browse the repository at this point in the history
…mponent integration

Fixes #5659
  • Loading branch information
novikov82 committed Feb 15, 2023
1 parent c9fd115 commit 8926f59
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BaseAngular } from "../../base-angular";
import { AngularComponentFactory } from "../../component-factory";

@Component({
selector: "sv-ng-rating-item, '[sv-ng-rating-item]'",
selector: "sv-ng-rating-item",
templateUrl: "./rating-item.component.html",
styleUrls: ["../../hide-host.scss"],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<legend role="presentation" class="sv-hidden"></legend>
<span *ngIf="model.hasMinLabel" [class]="model.cssClasses.minText" [model]="model.locMinRateDescription" sv-ng-string>
</span>
<sv-ng-rating-item *ngFor="let item of model.renderedRateItems; index as index; trackBy: trackByFn" [model]="model" [item]="item" [index]="index">
</sv-ng-rating-item>
<ng-template *ngFor="let item of model.renderedRateItems; index as index; trackBy: trackByFn" [component]="{ name: 'sv-rating-item', data: {model: model, item: item, index: index }}"></ng-template>
<span *ngIf="model.hasMaxLabel" [class]="model.cssClasses.maxText" [model]="model.locMaxRateDescription" sv-ng-string></span>
</fieldset>
</div>
3 changes: 1 addition & 2 deletions src/defaultV2-theme/blocks/sd-rating.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
font-size: calcSize(2);
}

legend+.sd-rating__item,
legend+sv-ng-rating-item+.sd-rating__item {
legend~.sd-rating__item:first-of-type {
margin-inline-start: 2px;
}

Expand Down
6 changes: 3 additions & 3 deletions src/vue/rating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
:class="question.cssClasses.minText">
<survey-string :locString="question.locMinRateDescription" />
</span>
<sv-rating-item
<component
v-for="(item, index) in question.renderedRateItems"
:is="('sv-rating-item')"
:item="item"
:index="index"
:question="question"
>
</sv-rating-item>
></component>
<span v-if="question.hasMaxLabel"
:class="question.cssClasses.maxText"
>
Expand Down

0 comments on commit 8926f59

Please sign in to comment.