Skip to content

Commit 9705b0a

Browse files
committed
refactor: remove deprecated ngx-perfect-scrollbar, use ngx-scrollbar instead
1 parent 36966f6 commit 9705b0a

7 files changed

+51
-66
lines changed

Diff for: angular.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"scripts": [],
4343
"allowedCommonJsDependencies": [
4444
"chart.js",
45-
"@coreui/chartjs/dist/js/coreui-chartjs.js"
45+
"bezier-easing"
4646
]
4747
},
4848
"configurations": {

Diff for: package-lock.json

+22-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@coreui/icons-angular": "~4.4.7",
3737
"@coreui/utils": "^2.0.1",
3838
"chart.js": "^3.9.1",
39-
"ngx-perfect-scrollbar": "^10.1.1",
39+
"ngx-scrollbar": "^11.0.0",
4040
"rxjs": "~7.8.1",
4141
"tslib": "^2.3.0",
4242
"zone.js": "~0.13.0"

Diff for: src/app/app.module.ts

+7-23
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { BrowserModule, Title } from '@angular/platform-browser';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55
import { ReactiveFormsModule } from '@angular/forms';
66

7-
import {
8-
PERFECT_SCROLLBAR_CONFIG,
9-
PerfectScrollbarConfigInterface,
10-
PerfectScrollbarModule,
11-
} from 'ngx-perfect-scrollbar';
7+
import { NgScrollbarModule } from 'ngx-scrollbar';
128

139
// Import routing module
1410
import { AppRoutingModule } from './app-routing.module';
@@ -17,11 +13,7 @@ import { AppRoutingModule } from './app-routing.module';
1713
import { AppComponent } from './app.component';
1814

1915
// Import containers
20-
import {
21-
DefaultFooterComponent,
22-
DefaultHeaderComponent,
23-
DefaultLayoutComponent,
24-
} from './containers';
16+
import { DefaultFooterComponent, DefaultHeaderComponent, DefaultLayoutComponent } from './containers';
2517

2618
import {
2719
AvatarModule,
@@ -41,19 +33,15 @@ import {
4133
SharedModule,
4234
SidebarModule,
4335
TabsModule,
44-
UtilitiesModule,
36+
UtilitiesModule
4537
} from '@coreui/angular';
4638

4739
import { IconModule, IconSetService } from '@coreui/icons-angular';
4840

49-
const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
50-
suppressScrollX: true,
51-
};
52-
5341
const APP_CONTAINERS = [
5442
DefaultFooterComponent,
5543
DefaultHeaderComponent,
56-
DefaultLayoutComponent,
44+
DefaultLayoutComponent
5745
];
5846

5947
@NgModule({
@@ -70,7 +58,6 @@ const APP_CONTAINERS = [
7058
HeaderModule,
7159
SidebarModule,
7260
IconModule,
73-
PerfectScrollbarModule,
7461
NavModule,
7562
ButtonModule,
7663
FormModule,
@@ -85,20 +72,17 @@ const APP_CONTAINERS = [
8572
BadgeModule,
8673
ListGroupModule,
8774
CardModule,
75+
NgScrollbarModule
8876
],
8977
providers: [
9078
{
9179
provide: LocationStrategy,
92-
useClass: HashLocationStrategy,
93-
},
94-
{
95-
provide: PERFECT_SCROLLBAR_CONFIG,
96-
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG,
80+
useClass: HashLocationStrategy
9781
},
9882
IconSetService,
9983
Title
10084
],
101-
bootstrap: [AppComponent],
85+
bootstrap: [AppComponent]
10286
})
10387
export class AppModule {
10488
}

Diff for: src/app/containers/default-layout/default-layout.component.html

+12-14
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,31 @@
1919
alt: 'CoreUI Logo'
2020
}"
2121
routerLink="./"
22-
>
23-
</c-sidebar-brand>
24-
<perfect-scrollbar [config]="perfectScrollbarConfig">
25-
<!-- [perfectScrollbar]="perfectScrollbarConfig"-->
26-
<c-sidebar-nav
27-
[navItems]="navItems"
28-
dropdownMode="close"
29-
>
30-
</c-sidebar-nav>
31-
</perfect-scrollbar>
22+
/>
23+
24+
<ng-scrollbar pointerEventsMethod="scrollbar">
25+
<c-sidebar-nav
26+
[navItems]="navItems"
27+
dropdownMode="close"
28+
/>
29+
</ng-scrollbar>
3230
<c-sidebar-toggler
3331
*ngIf="!sidebar.narrow"
3432
toggle="unfoldable"
3533
cSidebarToggle="sidebar"
36-
></c-sidebar-toggler>
34+
/>
3735
</c-sidebar>
3836

3937
<!--main-->
4038
<div class="wrapper d-flex flex-column min-vh-100 bg-light dark:bg-transparent">
4139
<!--app-header-->
42-
<app-default-header class="mb-4 d-print-none header header-sticky" position="sticky" sidebarId="sidebar"></app-default-header>
40+
<app-default-header class="mb-4 d-print-none header header-sticky" position="sticky" sidebarId="sidebar" />
4341
<!--app-body-->
4442
<div class="body flex-grow-1 px-3">
4543
<c-container breakpoint="lg" class="h-auto">
46-
<router-outlet></router-outlet>
44+
<router-outlet/>
4745
</c-container>
4846
</div>
4947
<!--app footer-->
50-
<app-default-footer></app-default-footer>
48+
<app-default-footer/>
5149
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:host {
2+
ng-scrollbar {
3+
--scrollbar-thumb-color: var(--cui-border-color, #999);
4+
--scrollbar-track-color: var(--cui-body-color, #fff);
5+
--scrollbar-hover-size: calc(var(--scrollbar-size) * 1.5);
6+
}
7+
}

Diff for: src/app/containers/default-layout/default-layout.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { navItems } from './_nav';
55
@Component({
66
selector: 'app-dashboard',
77
templateUrl: './default-layout.component.html',
8+
styleUrls: ['./default-layout.component.scss'],
89
})
910
export class DefaultLayoutComponent {
1011

0 commit comments

Comments
 (0)