Browse Source

Replace NgbNav with @angular/aria tabs in users component

Migrates the users component from ng-bootstrap's NgbNav to @angular/aria tab components for tab navigation. Updates the HTML structure and imports, adds a selectedTab property for tab state, and ensures the tab resets when opening the modal. Also updates peerDependencies for @angular/aria in package.json files.
pull/24689/head
Fahri Gedik 2 weeks ago
parent
commit
3e515d4b41
  1. 2
      npm/ng-packs/packages/feature-management/package.json
  2. 3
      npm/ng-packs/packages/identity/package.json
  3. 72
      npm/ng-packs/packages/identity/src/lib/components/users/users.component.html
  4. 12
      npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts

2
npm/ng-packs/packages/feature-management/package.json

@ -11,7 +11,7 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/aria": ">=21.0.0" "@angular/aria": "21.0.0"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

3
npm/ng-packs/packages/identity/package.json

@ -12,6 +12,9 @@
"@abp/ng.theme.shared": "~10.1.0-rc.1", "@abp/ng.theme.shared": "~10.1.0-rc.1",
"tslib": "^2.0.0" "tslib": "^2.0.0"
}, },
"peerDependencies": {
"@angular/aria": "21.0.0"
},
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
} }

72
npm/ng-packs/packages/identity/src/lib/components/users/users.component.html

@ -28,39 +28,47 @@
<ng-template #abpBody> <ng-template #abpBody>
@if (form) { @if (form) {
<form [formGroup]="form" (ngSubmit)="save()"> <form [formGroup]="form" (ngSubmit)="save()">
<ul ngbNav #nav="ngbNav" class="nav-tabs"> <div ngTabs selectionMode="follow">
<li ngbNavItem> <div ngTabList [(selectedTab)]="selectedTab" class="nav nav-tabs">
<a ngbNavLink>{{ 'AbpIdentity::UserInformations' | abpLocalization }}</a> <button ngTab #tabInfo="ngTab" [value]="'0'" class="nav-link" [class.active]="tabInfo.selected()" type="button">
<ng-template ngbNavContent> {{ 'AbpIdentity::UserInformations' | abpLocalization }}
<abp-extensible-form [selectedRecord]="selected"></abp-extensible-form> </button>
</ng-template> <button ngTab #tabRoles="ngTab" [value]="'1'" class="nav-link" [class.active]="tabRoles.selected()" type="button">
</li> {{ 'AbpIdentity::Roles' | abpLocalization }}
</button>
</div>
<li ngbNavItem> <div class="mt-2 fade-in-top">
<a ngbNavLink>{{ 'AbpIdentity::Roles' | abpLocalization }}</a> <div ngTabPanel [value]="'0'">
<ng-template ngbNavContent> <ng-template ngTabContent>
@for (roleGroup of roleGroups; track $index; let i = $index) { <abp-extensible-form [selectedRecord]="selected"></abp-extensible-form>
<div class="form-check mb-2"> </ng-template>
<abp-checkbox </div>
*abpReplaceableTemplate="{
inputs: { <div ngTabPanel [value]="'1'">
checkboxId: 'roles-' + i, <ng-template ngTabContent>
label: roles[i].name, @for (roleGroup of roleGroups; track $index; let i = $index) {
formControl: roleGroup.controls[roles[i].name] <div class="form-check mb-2">
}, <abp-checkbox
componentKey: inputKey *abpReplaceableTemplate="{
}" inputs: {
[checkboxId]="'roles-' + i" checkboxId: 'roles-' + i,
[formControl]="roleGroup.controls[roles[i].name]" label: roles[i].name,
[label]="roles[i].name" formControl: roleGroup.controls[roles[i].name]
> },
</abp-checkbox> componentKey: inputKey
</div> }"
} [checkboxId]="'roles-' + i"
</ng-template> [formControl]="roleGroup.controls[roles[i].name]"
</li> [label]="roles[i].name"
</ul> >
<div class="mt-2 fade-in-top" [ngbNavOutlet]="nav"></div> </abp-checkbox>
</div>
}
</ng-template>
</div>
</div>
</div>
</form> </form>
} @else { } @else {
<div class="text-center"><i class="fa fa-pulse fa-spinner" aria-hidden="true"></i></div> <div class="text-center"><i class="fa fa-pulse fa-spinner" aria-hidden="true"></i></div>

12
npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts

@ -52,7 +52,8 @@ import {
import { finalize, switchMap, tap } from 'rxjs/operators'; import { finalize, switchMap, tap } from 'rxjs/operators';
import { eIdentityComponents } from '../../enums/components'; import { eIdentityComponents } from '../../enums/components';
import { PageComponent } from '@abp/ng.components/page'; import { PageComponent } from '@abp/ng.components/page';
import { NgbDropdownModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
import { Tabs, TabList, Tab, TabPanel, TabContent } from '@angular/aria/tabs';
import { NgxValidateCoreModule } from '@ngx-validate/core'; import { NgxValidateCoreModule } from '@ngx-validate/core';
@Component({ @Component({
@ -70,7 +71,11 @@ import { NgxValidateCoreModule } from '@ngx-validate/core';
FormsModule, FormsModule,
PermissionManagementComponent, PermissionManagementComponent,
PageComponent, PageComponent,
NgbNavModule, Tabs,
TabList,
Tab,
TabPanel,
TabContent,
NgbDropdownModule, NgbDropdownModule,
NgxValidateCoreModule, NgxValidateCoreModule,
LocalizationPipe, LocalizationPipe,
@ -101,6 +106,8 @@ export class UsersComponent implements OnInit {
selected?: IdentityUserDto; selected?: IdentityUserDto;
selectedTab = '0';
selectedUserRoles?: IdentityRoleDto[]; selectedUserRoles?: IdentityRoleDto[];
roles?: IdentityRoleDto[]; roles?: IdentityRoleDto[];
@ -159,6 +166,7 @@ export class UsersComponent implements OnInit {
} }
openModal() { openModal() {
this.selectedTab = '0';
this.buildForm(); this.buildForm();
this.isModalVisible = true; this.isModalVisible = true;
} }

Loading…
Cancel
Save