-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathsetting-management.component.ts
More file actions
42 lines (35 loc) · 1.33 KB
/
setting-management.component.ts
File metadata and controls
42 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { ABP, ForDirective, LocalizationPipe, PermissionDirective } from '@abp/ng.core';
import { SettingTabsService } from '@abp/ng.setting-management/config';
import { Component, inject, OnDestroy, OnInit, TrackByFunction } from '@angular/core';
import { Subscription } from 'rxjs';
import { NgComponentOutlet } from '@angular/common';
import { PageComponent } from '@abp/ng.components/page';
import { Tab, Tabs, TabList, TabPanel } from '@angular/aria/tabs';
@Component({
selector: 'abp-setting-management',
templateUrl: './setting-management.component.html',
imports: [NgComponentOutlet, PageComponent, LocalizationPipe, PermissionDirective, ForDirective, Tabs, TabList, Tab, TabPanel],
styles: [`
:host [ngTabPanel][inert] {
display: none;
}
`],
})
export class SettingManagementComponent implements OnDestroy, OnInit {
private settingTabsService = inject(SettingTabsService);
private subscription = new Subscription();
settings: ABP.Tab[] = [];
selected!: ABP.Tab;
trackByFn: TrackByFunction<ABP.Tab> = (_, item) => item.name;
ngOnDestroy() {
this.subscription.unsubscribe();
}
ngOnInit() {
this.subscription.add(
this.settingTabsService.visible$.subscribe(settings => {
this.settings = settings;
if (!this.selected) this.selected = this.settings[0];
}),
);
}
}