@internetarchive/collection-browser 2.19.1-alpha-webdev7818.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/src/app-root.js +606 -605
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.js +26 -9
  4. package/dist/src/collection-browser.js.map +1 -1
  5. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  6. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  7. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  8. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  9. package/dist/src/collection-facets.js +263 -263
  10. package/dist/src/collection-facets.js.map +1 -1
  11. package/dist/src/expanded-date-picker.js +52 -52
  12. package/dist/src/expanded-date-picker.js.map +1 -1
  13. package/dist/src/models.d.ts +13 -0
  14. package/dist/src/models.js +41 -0
  15. package/dist/src/models.js.map +1 -1
  16. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +79 -24
  17. package/dist/src/sort-filter-bar/sort-filter-bar.js +201 -119
  18. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  19. package/dist/src/tiles/grid/item-tile.js +139 -139
  20. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  21. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +118 -118
  22. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list.js +289 -289
  24. package/dist/src/tiles/list/tile-list.js.map +1 -1
  25. package/dist/src/tiles/tile-dispatcher.js +200 -200
  26. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  27. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +157 -11
  28. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/app-root.ts +1140 -1140
  31. package/src/collection-browser.ts +30 -8
  32. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  33. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  34. package/src/collection-facets.ts +990 -990
  35. package/src/expanded-date-picker.ts +191 -191
  36. package/src/models.ts +48 -0
  37. package/src/sort-filter-bar/sort-filter-bar.ts +220 -126
  38. package/src/tiles/grid/item-tile.ts +339 -339
  39. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +129 -129
  40. package/src/tiles/list/tile-list.ts +688 -688
  41. package/src/tiles/tile-dispatcher.ts +486 -486
  42. package/test/sort-filter-bar/sort-filter-bar.test.ts +205 -12
  43. package/tsconfig.json +1 -1
@@ -16,11 +16,16 @@ import '@internetarchive/ia-dropdown';
16
16
  import type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';
17
17
  import type { SortDirection } from '@internetarchive/search-service';
18
18
  import {
19
+ ALL_DATE_SORT_FIELDS,
20
+ ALL_VIEWS_SORT_FIELDS,
19
21
  CollectionDisplayMode,
22
+ DateSortField,
23
+ defaultSortAvailability,
20
24
  PrefixFilterCounts,
21
25
  PrefixFilterType,
22
26
  SORT_OPTIONS,
23
27
  SortField,
28
+ ViewsSortField,
24
29
  } from '../models';
25
30
  import './alpha-bar';
26
31
 
@@ -51,6 +56,13 @@ export class SortFilterBar
51
56
  SortField.default
52
57
  > = SortField.relevance;
53
58
 
59
+ /** Which view sort option to expose by default. */
60
+ @property({ type: String }) defaultViewSort: ViewsSortField =
61
+ SortField.weeklyview;
62
+
63
+ /** Which date sort option to expose by default */
64
+ @property({ type: String }) defaultDateSort: DateSortField = SortField.date;
65
+
54
66
  /** The current sort direction (asc/desc), or null if none is set */
55
67
  @property({ type: String }) sortDirection: SortDirection | null = null;
56
68
 
@@ -63,11 +75,20 @@ export class SortFilterBar
63
75
  /** The currently selected creator letter filter, or null if none is set */
64
76
  @property({ type: String }) selectedCreatorFilter: string | null = null;
65
77
 
66
- /** Whether to show the Relevance sort option (default `true`) */
67
- @property({ type: Boolean }) showRelevance: boolean = true;
68
-
69
- /** Whether to show the Date Favorited sort option instead of Date Published/Archived/Reviewed (default `false`) */
70
- @property({ type: Boolean }) showDateFavorited: boolean = false;
78
+ /**
79
+ * Map defining which sortable fields should be included on the sort bar.
80
+ *
81
+ * E.g.,
82
+ * ```
83
+ * {
84
+ * [SortField.relevance]: true,
85
+ * [SortField.date]: false,
86
+ * [SortField.title]: true,
87
+ * ...
88
+ * }
89
+ * ```
90
+ */
91
+ @property({ type: Object }) sortFieldAvailability = defaultSortAvailability;
71
92
 
72
93
  /** Whether to replace the default sort options with a slot for customization (default `false`) */
73
94
  @property({ type: Boolean, reflect: true }) enableSortOptionsSlot: boolean =
@@ -88,12 +109,12 @@ export class SortFilterBar
88
109
  /**
89
110
  * The Views sort option that was most recently selected (or the default, if none has been selected yet)
90
111
  */
91
- @state() private lastSelectedViewSort = SortField.weeklyview;
112
+ @state() private lastSelectedViewSort = this.defaultViewSort;
92
113
 
93
114
  /**
94
115
  * The Date sort option that was most recently selected (or the default, if none has been selected yet)
95
116
  */
96
- @state() private lastSelectedDateSort = this.defaultDateSortField;
117
+ @state() private lastSelectedDateSort = this.defaultDateSort;
97
118
 
98
119
  /**
99
120
  * Which of the alphabet bars (title/creator) should be shown, or null if one
@@ -135,11 +156,11 @@ export class SortFilterBar
135
156
 
136
157
  /** The dropdown component containing options for weekly and all-time views */
137
158
  @query('#views-dropdown')
138
- private viewsDropdown!: IaDropdown;
159
+ private viewsDropdown?: IaDropdown;
139
160
 
140
- /** The dropdown component containing the four date options */
161
+ /** The dropdown component containing all the available date options */
141
162
  @query('#date-dropdown')
142
- private dateDropdown!: IaDropdown;
163
+ private dateDropdown?: IaDropdown;
143
164
 
144
165
  /** The single, consolidated dropdown component shown in mobile view */
145
166
  @query('#mobile-dropdown')
@@ -193,19 +214,18 @@ export class SortFilterBar
193
214
  }
194
215
 
195
216
  if (this.viewOptionSelected) {
196
- this.lastSelectedViewSort = this.finalizedSortField;
217
+ this.lastSelectedViewSort = this.finalizedSortField as ViewsSortField;
197
218
  } else if (this.dateOptionSelected) {
198
- this.lastSelectedDateSort = this.finalizedSortField;
219
+ this.lastSelectedDateSort = this.finalizedSortField as DateSortField;
199
220
  }
200
221
  }
201
222
 
202
- // If we change which dropdown options are available, ensure the correct default becomes selected.
203
- // Currently, Date Favorited is the only dropdown option whose presence/absence can change.
204
- if (
205
- changed.has('showDateFavorited') &&
206
- changed.get('showDateFavorited') !== this.showDateFavorited
207
- ) {
208
- this.lastSelectedDateSort = this.defaultDateSortField;
223
+ // If we change which dropdown options are defaulted, update the default selections
224
+ if (changed.has('defaultViewSort')) {
225
+ this.lastSelectedViewSort = this.defaultViewSort;
226
+ }
227
+ if (changed.has('defaultDateSort')) {
228
+ this.lastSelectedDateSort = this.defaultDateSort;
209
229
  }
210
230
  }
211
231
 
@@ -378,47 +398,11 @@ export class SortFilterBar
378
398
  class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}
379
399
  >
380
400
  <ul id="desktop-sort-selector">
381
- ${this.showRelevance
382
- ? html`<li>
383
- ${this.getSortDisplayOption(SortField.relevance, {
384
- onClick: () => {
385
- this.dropdownBackdropVisible = false;
386
- if (this.finalizedSortField !== SortField.relevance) {
387
- this.clearAlphaBarFilters();
388
- this.setSelectedSort(SortField.relevance);
389
- }
390
- },
391
- })}
392
- </li>`
393
- : nothing}
394
- <li>${this.viewsDropdownTemplate}</li>
395
- <li>
396
- ${this.getSortDisplayOption(SortField.title, {
397
- onClick: () => {
398
- this.dropdownBackdropVisible = false;
399
- if (this.finalizedSortField !== SortField.title) {
400
- this.alphaSelectorVisible = 'title';
401
- this.selectedCreatorFilter = null;
402
- this.setSelectedSort(SortField.title);
403
- this.emitCreatorLetterChangedEvent();
404
- }
405
- },
406
- })}
407
- </li>
408
- <li>${this.dateDropdownTemplate}</li>
409
- <li>
410
- ${this.getSortDisplayOption(SortField.creator, {
411
- onClick: () => {
412
- this.dropdownBackdropVisible = false;
413
- if (this.finalizedSortField !== SortField.creator) {
414
- this.alphaSelectorVisible = 'creator';
415
- this.selectedTitleFilter = null;
416
- this.setSelectedSort(SortField.creator);
417
- this.emitTitleLetterChangedEvent();
418
- }
419
- },
420
- })}
421
- </li>
401
+ <li>${this.relevanceSortSelectorTemplate}</li>
402
+ <li>${this.allViewsSortOptionsTemplate}</li>
403
+ <li>${this.titleSortSelectorTemplate}</li>
404
+ <li>${this.allDateSortOptionsTemplate}</li>
405
+ <li>${this.creatorSortSelectorTemplate}</li>
422
406
  </ul>
423
407
  </div>
424
408
  `;
@@ -426,12 +410,9 @@ export class SortFilterBar
426
410
 
427
411
  /** The template to render all the sort options in mobile view */
428
412
  private get mobileSortSelectorTemplate() {
429
- const displayedOptions = Object.values(SORT_OPTIONS)
430
- .filter(opt => opt.shownInSortBar)
431
- .filter(opt => this.showRelevance || opt.field !== SortField.relevance)
432
- .filter(
433
- opt => this.showDateFavorited || opt.field !== SortField.datefavorited,
434
- );
413
+ const displayedOptions = Object.values(SORT_OPTIONS).filter(
414
+ opt => opt.shownInSortBar && this.sortFieldAvailability[opt.field],
415
+ );
435
416
 
436
417
  return html`
437
418
  <div
@@ -439,7 +420,7 @@ export class SortFilterBar
439
420
  class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}
440
421
  >
441
422
  ${this.getSortDropdown({
442
- displayName: html`${SORT_OPTIONS[this.finalizedSortField].displayName}`,
423
+ displayName: SORT_OPTIONS[this.finalizedSortField].displayName,
443
424
  id: 'mobile-dropdown',
444
425
  selected: true,
445
426
  dropdownOptions: displayedOptions.map(opt =>
@@ -460,37 +441,37 @@ export class SortFilterBar
460
441
  }
461
442
 
462
443
  /**
463
- * This generates each of the non-dropdown sort option links.
444
+ * This generates each of the non-dropdown sort option buttons.
464
445
  *
465
446
  * It manages the display value and the selected state of the option.
466
447
  *
467
- * @param sortField
468
- * @param options {
469
- * onClick?: (e: Event) => void; If this is provided, it will also be called when the option is clicked.
470
- * displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.
471
- * selected?: boolean; true if the option is selected. Defaults to the selectedSort === sortField.
472
- * }
473
- * @returns
448
+ * @param sortField Which sort field the button represents
449
+ * @param options Additional options:
450
+ * - `onSelected?: (e: Event) => void;` If this is provided, it will also be called when the option is selected.
451
+ * Default is to clear any selected alphabetical filters.
474
452
  */
475
- private getSortDisplayOption(
453
+ private getSortSelectorButton(
476
454
  sortField: SortField,
477
455
  options?: {
478
- displayName?: TemplateResult;
479
- selected?: boolean;
480
- onClick?: (e: Event) => void;
456
+ onSelected?: (e: Event) => void;
481
457
  },
482
458
  ): TemplateResult {
483
- const isSelected =
484
- options?.selected ?? this.finalizedSortField === sortField;
485
- const displayName =
486
- options?.displayName ?? SORT_OPTIONS[sortField].displayName;
459
+ const isSelected = this.finalizedSortField === sortField;
460
+ const displayName = SORT_OPTIONS[sortField].displayName;
461
+ const onSelected =
462
+ options?.onSelected ?? (() => this.clearAlphaBarFilters());
463
+
487
464
  return html`
488
465
  <button
489
- class=${isSelected ? 'selected' : nothing}
490
- data-title="${displayName}"
466
+ class=${isSelected ? 'selected' : ''}
467
+ data-title=${displayName}
491
468
  @click=${(e: Event) => {
492
469
  e.preventDefault();
493
- options?.onClick?.(e);
470
+ this.dropdownBackdropVisible = false;
471
+ if (this.finalizedSortField !== sortField) {
472
+ onSelected?.(e);
473
+ this.setSelectedSort(sortField);
474
+ }
494
475
  }}
495
476
  >
496
477
  ${displayName}
@@ -513,8 +494,8 @@ export class SortFilterBar
513
494
  * on the dropdown's label
514
495
  */
515
496
  private getSortDropdown(options: {
516
- displayName: TemplateResult;
517
- id?: string;
497
+ displayName: string;
498
+ id: string;
518
499
  dropdownOptions: optionInterface[];
519
500
  selectedOption?: string;
520
501
  selected: boolean;
@@ -524,8 +505,8 @@ export class SortFilterBar
524
505
  }): TemplateResult {
525
506
  return html`
526
507
  <ia-dropdown
527
- id=${options.id ?? nothing}
528
- class=${options.selected ? 'selected' : nothing}
508
+ id=${options.id}
509
+ class=${options.selected ? 'selected' : ''}
529
510
  displayCaret
530
511
  closeOnSelect
531
512
  includeSelectedOption
@@ -538,7 +519,7 @@ export class SortFilterBar
538
519
  <span
539
520
  class="dropdown-label"
540
521
  slot="dropdown-label"
541
- data-title="${options.displayName.values}"
522
+ data-title=${options.displayName}
542
523
  @click=${options.onLabelInteraction ?? nothing}
543
524
  @keydown=${options.onLabelInteraction
544
525
  ? (e: KeyboardEvent) => {
@@ -577,31 +558,102 @@ export class SortFilterBar
577
558
  const sortField = e.detail.option.id as SortField;
578
559
  this.setSelectedSort(sortField);
579
560
  if (this.viewOptionSelected) {
580
- this.lastSelectedViewSort = sortField;
561
+ this.lastSelectedViewSort = sortField as ViewsSortField;
581
562
  } else if (this.dateOptionSelected) {
582
- this.lastSelectedDateSort = sortField;
563
+ this.lastSelectedDateSort = sortField as DateSortField;
583
564
  }
584
565
  }
585
566
 
586
- /** The template to render for the views dropdown */
567
+ //
568
+ // SORT OPTION TEMPLATES
569
+ //
570
+
571
+ /**
572
+ * Template for the Relevance sort selector button, or `nothing` if the relevance
573
+ * field is not available for display.
574
+ */
575
+ private get relevanceSortSelectorTemplate(): TemplateResult | typeof nothing {
576
+ if (!this.sortFieldAvailability.relevance) return nothing;
577
+ return this.getSortSelectorButton(SortField.relevance);
578
+ }
579
+
580
+ /**
581
+ * Template for the Views sort selector button.
582
+ * This is shown instead of the views dropdown when only a single views sort field
583
+ * is available.
584
+ */
585
+ private get viewsSortSelectorTemplate(): TemplateResult | typeof nothing {
586
+ const { availableViewsFields } = this;
587
+ if (availableViewsFields.length < 1) return nothing;
588
+ return this.getSortSelectorButton(availableViewsFields[0]);
589
+ }
590
+
591
+ /**
592
+ * Template for the Title sort selector button, or `nothing` if the title field is
593
+ * not available for display.
594
+ */
595
+ private get titleSortSelectorTemplate(): TemplateResult | typeof nothing {
596
+ if (!this.sortFieldAvailability.title) return nothing;
597
+
598
+ return this.getSortSelectorButton(SortField.title, {
599
+ onSelected: () => {
600
+ this.alphaSelectorVisible = 'title';
601
+ this.selectedCreatorFilter = null;
602
+ this.emitCreatorLetterChangedEvent();
603
+ },
604
+ });
605
+ }
606
+
607
+ /**
608
+ * Template for the Date sort selector button.
609
+ * This is shown instead of the dates dropdown when only a single date sort field
610
+ * is available.
611
+ */
612
+ private get dateSortSelectorTemplate(): TemplateResult | typeof nothing {
613
+ const { availableDateFields } = this;
614
+ if (availableDateFields.length < 1) return nothing;
615
+ return this.getSortSelectorButton(availableDateFields[0]);
616
+ }
617
+
618
+ /**
619
+ * Template for the Creator sort selector button, or `nothing` if the creator field
620
+ * is not available for display.
621
+ */
622
+ private get creatorSortSelectorTemplate(): TemplateResult | typeof nothing {
623
+ if (!this.sortFieldAvailability.creator) return nothing;
624
+
625
+ return this.getSortSelectorButton(SortField.creator, {
626
+ onSelected: () => {
627
+ this.alphaSelectorVisible = 'creator';
628
+ this.selectedTitleFilter = null;
629
+ this.emitTitleLetterChangedEvent();
630
+ },
631
+ });
632
+ }
633
+
634
+ /**
635
+ * Template for the Views dropdown, shown when 2+ views sort fields are available.
636
+ */
587
637
  private get viewsDropdownTemplate(): TemplateResult {
638
+ const displayedOptions = ALL_VIEWS_SORT_FIELDS.filter(
639
+ field => this.sortFieldAvailability[field],
640
+ ).map(field => this.getDropdownOption(field));
641
+
588
642
  return this.getSortDropdown({
589
- displayName: html`${this.viewSortDisplayName}`,
643
+ displayName: this.viewSortDisplayName,
590
644
  id: 'views-dropdown',
591
645
  selected: this.viewOptionSelected,
592
- dropdownOptions: [
593
- this.getDropdownOption(SortField.weeklyview),
594
- this.getDropdownOption(SortField.alltimeview),
595
- ],
646
+ dropdownOptions: displayedOptions,
596
647
  selectedOption: this.viewOptionSelected ? this.finalizedSortField : '',
597
648
  onOptionSelected: this.dropdownOptionSelected,
598
649
  onDropdownClick: () => {
599
- this.dateDropdown.open = false;
600
- this.dropdownBackdropVisible = this.viewsDropdown.open;
601
- this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);
650
+ if (this.dateDropdown) this.dateDropdown.open = false;
651
+ const viewsDropdown = this.viewsDropdown as IaDropdown;
652
+ this.dropdownBackdropVisible = viewsDropdown.open;
653
+ viewsDropdown.classList.toggle('open', viewsDropdown.open);
602
654
  },
603
655
  onLabelInteraction: (e: Event) => {
604
- if (!this.viewsDropdown.open && !this.viewOptionSelected) {
656
+ if (!this.viewsDropdown?.open && !this.viewOptionSelected) {
605
657
  e.stopPropagation();
606
658
  this.clearAlphaBarFilters();
607
659
  this.setSelectedSort(this.lastSelectedViewSort);
@@ -610,30 +662,29 @@ export class SortFilterBar
610
662
  });
611
663
  }
612
664
 
613
- /** The template to render for the date dropdown */
665
+ /**
666
+ * Template for the Date dropdown, shown when 2+ date sort fields are available.
667
+ */
614
668
  private get dateDropdownTemplate(): TemplateResult {
669
+ const displayedOptions = ALL_DATE_SORT_FIELDS.filter(
670
+ field => this.sortFieldAvailability[field],
671
+ ).map(field => this.getDropdownOption(field));
672
+
615
673
  return this.getSortDropdown({
616
- displayName: html`${this.dateSortDisplayName}`,
674
+ displayName: this.dateSortDisplayName,
617
675
  id: 'date-dropdown',
618
676
  selected: this.dateOptionSelected,
619
- dropdownOptions: [
620
- ...(this.showDateFavorited
621
- ? [this.getDropdownOption(SortField.datefavorited)]
622
- : []),
623
- this.getDropdownOption(SortField.date),
624
- this.getDropdownOption(SortField.datearchived),
625
- this.getDropdownOption(SortField.datereviewed),
626
- this.getDropdownOption(SortField.dateadded),
627
- ],
677
+ dropdownOptions: displayedOptions,
628
678
  selectedOption: this.dateOptionSelected ? this.finalizedSortField : '',
629
679
  onOptionSelected: this.dropdownOptionSelected,
630
680
  onDropdownClick: () => {
631
- this.viewsDropdown.open = false;
632
- this.dropdownBackdropVisible = this.dateDropdown.open;
633
- this.dateDropdown.classList.toggle('open', this.dateDropdown.open);
681
+ if (this.viewsDropdown) this.viewsDropdown.open = false;
682
+ const dateDropdown = this.dateDropdown as IaDropdown;
683
+ this.dropdownBackdropVisible = dateDropdown.open;
684
+ dateDropdown.classList.toggle('open', dateDropdown.open);
634
685
  },
635
686
  onLabelInteraction: (e: Event) => {
636
- if (!this.dateDropdown.open && !this.dateOptionSelected) {
687
+ if (!this.dateDropdown?.open && !this.dateOptionSelected) {
637
688
  e.stopPropagation();
638
689
  this.clearAlphaBarFilters();
639
690
  this.setSelectedSort(this.lastSelectedDateSort);
@@ -642,6 +693,38 @@ export class SortFilterBar
642
693
  });
643
694
  }
644
695
 
696
+ /**
697
+ * Provides the appropriate template to use for Views sorting, depending on how many
698
+ * views sort fields are available.
699
+ */
700
+ private get allViewsSortOptionsTemplate(): TemplateResult | typeof nothing {
701
+ const numViewsSortOptions = this.availableViewsFields.length;
702
+ switch (numViewsSortOptions) {
703
+ case 0:
704
+ return nothing;
705
+ case 1:
706
+ return this.viewsSortSelectorTemplate;
707
+ default:
708
+ return this.viewsDropdownTemplate;
709
+ }
710
+ }
711
+
712
+ /**
713
+ * Provides the appropriate template to use for Date sorting, depending on how many
714
+ * date sort fields are available.
715
+ */
716
+ private get allDateSortOptionsTemplate(): TemplateResult | typeof nothing {
717
+ const numDateSortOptions = this.availableDateFields.length;
718
+ switch (numDateSortOptions) {
719
+ case 0:
720
+ return nothing;
721
+ case 1:
722
+ return this.dateSortSelectorTemplate;
723
+ default:
724
+ return this.dateDropdownTemplate;
725
+ }
726
+ }
727
+
645
728
  /** Handler for when a new mobile sort dropdown option is selected */
646
729
  private mobileSortChanged(e: CustomEvent<{ option: optionInterface }>) {
647
730
  this.dropdownBackdropVisible = false;
@@ -731,6 +814,7 @@ export class SortFilterBar
731
814
  this.mobileDropdown,
732
815
  ];
733
816
  for (const dropdown of allDropdowns) {
817
+ if (!dropdown) continue;
734
818
  dropdown.open = false;
735
819
  dropdown.classList.remove('open');
736
820
  }
@@ -844,14 +928,6 @@ export class SortFilterBar
844
928
  return viewSortFields.includes(this.finalizedSortField);
845
929
  }
846
930
 
847
- /**
848
- * The default field for the date sort dropdown.
849
- * This is Date Favorited when that option is available, or Date Published otherwise.
850
- */
851
- private get defaultDateSortField(): SortField {
852
- return this.showDateFavorited ? SortField.datefavorited : SortField.date;
853
- }
854
-
855
931
  /**
856
932
  * The display name of the last selected date field
857
933
  *
@@ -876,6 +952,24 @@ export class SortFilterBar
876
952
  return SORT_OPTIONS[this.lastSelectedViewSort].displayName;
877
953
  }
878
954
 
955
+ /**
956
+ * Array of all the views sorts that should be shown
957
+ */
958
+ private get availableViewsFields(): SortField[] {
959
+ return ALL_VIEWS_SORT_FIELDS.filter(
960
+ field => this.sortFieldAvailability[field],
961
+ );
962
+ }
963
+
964
+ /**
965
+ * Array of all the date sorts that should be shown
966
+ */
967
+ private get availableDateFields(): SortField[] {
968
+ return ALL_DATE_SORT_FIELDS.filter(
969
+ field => this.sortFieldAvailability[field],
970
+ );
971
+ }
972
+
879
973
  private get titleSelectorBar() {
880
974
  return html` <alpha-bar
881
975
  .selectedLetter=${this.selectedTitleFilter}