@@ -15,7 +15,7 @@ import { MatDialog } from '@angular/material/dialog'
15
15
import { MatPaginatorIntl , PageEvent } from '@angular/material/paginator'
16
16
import { isEmpty } from 'lodash'
17
17
import { Observable , Subject } from 'rxjs'
18
- import { first } from 'rxjs/operators'
18
+ import { first , take } from 'rxjs/operators'
19
19
import { PlatformInfo , PlatformInfoService } from 'src/app/cdk/platform-info'
20
20
import {
21
21
ADD_EVENT_ACTION ,
@@ -34,7 +34,7 @@ import {
34
34
UserRecord ,
35
35
UserRecordOptions ,
36
36
} from 'src/app/types/record.local'
37
- import { SortData } from 'src/app/types/sort'
37
+ import { SortData , SortOrderType } from 'src/app/types/sort'
38
38
39
39
import { UserInfo } from '../../../types'
40
40
import { ModalDeleteItemsComponent } from '../modals/modal-delete-item/modal-delete-items.component'
@@ -49,6 +49,7 @@ import { WorkBibtexModalComponent } from './modals/work-bibtex-modal/work-bibtex
49
49
import { ModalCombineWorksWithSelectorComponent } from '../work/modals/modal-combine-works-with-selector/modal-combine-works-with-selector.component'
50
50
import { GroupingSuggestions } from 'src/app/types/works.endpoint'
51
51
import { AnnouncerService } from 'src/app/core/announcer/announcer.service'
52
+ import { TogglzService } from '../../../core/togglz/togglz.service'
52
53
53
54
@Component ( {
54
55
selector : 'app-work-stack-group' ,
@@ -127,6 +128,8 @@ export class WorkStackGroupComponent implements OnInit {
127
128
platform : PlatformInfo
128
129
selectedWorks : string [ ] = [ ]
129
130
selectAll : false
131
+ sourceSorting = false
132
+ sortTypes : SortOrderType [ ] = [ 'title' , 'start' , 'end' ]
130
133
131
134
@ViewChildren ( 'selectAllCheckbox' ) selectAllCheckbox : MatCheckbox
132
135
@ViewChildren ( 'appWorkStacks' ) appWorkStacks : QueryList < WorkStackComponent >
@@ -138,10 +141,15 @@ export class WorkStackGroupComponent implements OnInit {
138
141
private _record : RecordService ,
139
142
private _works : RecordWorksService ,
140
143
private _matPaginatorIntl : MatPaginatorIntl ,
141
- private _announce : AnnouncerService
144
+ private _announce : AnnouncerService ,
145
+ private _togglz : TogglzService
142
146
) { }
143
147
144
148
ngOnInit ( ) : void {
149
+ this . _togglz
150
+ . getStateOf ( 'SOURCE_SORTING' )
151
+ . pipe ( take ( 1 ) )
152
+ . subscribe ( ( value ) => ( this . sourceSorting = value ) )
145
153
this . $loading = this . _works . $loading
146
154
this . _record
147
155
. getRecord ( { publicRecordId : this . isPublicRecord } )
@@ -163,6 +171,9 @@ export class WorkStackGroupComponent implements OnInit {
163
171
this . _platform . get ( ) . subscribe ( ( platform ) => {
164
172
this . platform = platform
165
173
} )
174
+ if ( this . sourceSorting ) {
175
+ this . sortTypes . push ( 'source' )
176
+ }
166
177
}
167
178
168
179
private getGroupingSuggestions ( ) {
0 commit comments