Skip to content

Commit

Permalink
fix: dropdown in settings policy[3141]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihar committed Dec 12, 2024
1 parent 213343f commit e58ac71
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@
<!-- </mat-form-field>-->

<div class="p-fluid">
<label for="themeDropdown">Theme</label>
<label for="themeDropdown" class="dropdown-label">Theme</label>
<p-dropdown
[(ngModel)]="theme"
[options]="themes"
optionLabel="name"
[appendTo]="'body'"
(onChange)="onSelectTheme()"
placeholder="Выберите тему"
id="themeDropdown">
id="themeDropdown"
[style]="{ 'outline': 'none', 'box-shadow': 'none' }"
>
<ng-template let-option pTemplate="selectedItem">
{{ option.name }}
</ng-template>
<ng-template let-option pTemplate="item">
{{ option.name }}
</ng-template>
</p-dropdown>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,27 @@
width: 180px;
height: 32px;
}

.settings-select,
.settings-select ::ng-deep p-dropdown .p-dropdown{
height: 38px !important;
}

.settings-select .p-fluid{
position: relative;
line-height: 0.2;
}

.settings-select .dropdown-label {
position: absolute;
z-index: 1000;
width: 36px;
font-size: 10px;
background: white;
height: 5px;
left: 10px;
}

.settings-select ::ng-deep p-dropdown .p-dropdown-label {
padding: 18px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PolicySettingsComponent implements OnInit {

public isSyntax: boolean = false;
public settingsTab: number = 0;
public themes!: Theme[];
public _themes!: Theme[];
public theme!: Theme;
public allBlocks!: any[];
public roles: string[];
Expand Down Expand Up @@ -108,6 +108,18 @@ export class PolicySettingsComponent implements OnInit {
}
}

get themes(): any[] {
return this._themes ?? []
}

set themes(value: any[]) {
this._themes = value.map(theme => {
theme.value = theme.id;
theme.name = theme._name
return theme;
});
}

ngOnInit(): void {
this.settingsTab = 0;
this.allBlocks = this.registeredService.getAll();
Expand Down

0 comments on commit e58ac71

Please sign in to comment.