mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 06:06:18 -08:00
fix: group sorting logic
This commit is contained in:
1 parent
fac3a9d49e
commit
c1a54ee466
4 files changed
+18
-7
No files matched your search
+1
-1
@@ -57,7 +57,7 @@
|
||||
</ng-template>
|
||||
<mat-nav-list id="groups-list">
|
||||
<mat-accordion multi>
|
||||
@for (groups of groupedChannels | keyvalue; track $index) {
|
||||
@for (groups of groupedChannels | keyvalue: groupsComparator; track $index) {
|
||||
@if (groups.value.length > 0) {
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
|
||||
+12
-1
@@ -4,7 +4,7 @@ import {
|
||||
moveItemInArray,
|
||||
} from '@angular/cdk/drag-drop';
|
||||
import { ScrollingModule } from '@angular/cdk/scrolling';
|
||||
import { CommonModule, TitleCasePipe } from '@angular/common';
|
||||
import { CommonModule, TitleCasePipe, KeyValue } from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
ElementRef,
|
||||
@@ -171,4 +171,15 @@ export class ChannelListContainerComponent {
|
||||
ngOnDestroy() {
|
||||
this.store.dispatch(PlaylistActions.setChannels({ channels: [] }));
|
||||
}
|
||||
|
||||
groupsComparator = (a: KeyValue<string, any[]>, b: KeyValue<string, any[]>): number => {
|
||||
const numA = parseInt(a.key.replace(/\D/g, ''));
|
||||
const numB = parseInt(b.key.replace(/\D/g, ''));
|
||||
|
||||
if (!isNaN(numA) && !isNaN(numB)) {
|
||||
return numA - numB;
|
||||
}
|
||||
|
||||
return a.key.localeCompare(b.key);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user