@internetarchive/collection-browser 1.10.1-alpha.4 → 1.11.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.
- package/dist/src/collection-browser.js +5 -18
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/restoration-state-handler.js +0 -4
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/test/collection-browser.test.js +148 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +10 -21
- package/src/restoration-state-handler.ts +0 -4
- package/test/collection-browser.test.ts +176 -0
|
@@ -202,7 +202,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
202
202
|
* in the options object.
|
|
203
203
|
*/
|
|
204
204
|
clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
|
|
205
|
-
console.log('clearFilters', facets);
|
|
206
205
|
// Don't bother clearing facets if none are checked, so that we don't
|
|
207
206
|
// trigger unnecessary update cycles.
|
|
208
207
|
if (facets && this.hasCheckedFacets) {
|
|
@@ -671,8 +670,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
671
670
|
}
|
|
672
671
|
updated(changed) {
|
|
673
672
|
var _a;
|
|
674
|
-
console.log('--- UPDATED ---');
|
|
675
|
-
[...changed.entries()].forEach(([k, v]) => console.log(k, ':', v, '->', this[k]));
|
|
676
673
|
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
677
674
|
if (!this.leftColIntersectionObserver) {
|
|
678
675
|
this.setupLeftColumnScrollListeners();
|
|
@@ -688,20 +685,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
688
685
|
changed.has('loggedIn')) {
|
|
689
686
|
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
690
687
|
}
|
|
691
|
-
if (changed.has('baseQuery') ||
|
|
688
|
+
if (changed.has('baseQuery') ||
|
|
689
|
+
changed.has('searchType') ||
|
|
690
|
+
changed.has('withinCollection')) {
|
|
692
691
|
// Unless this query/search type update is from the initial page load or the
|
|
693
692
|
// result of hitting the back button,
|
|
694
693
|
// we need to clear any existing filters since they may no longer be valid for
|
|
695
694
|
// the new set of search results.
|
|
696
695
|
if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
|
|
697
696
|
// Ordinarily, we leave the sort param unchanged between searches.
|
|
698
|
-
// However, if we are changing the target collection, we want the sort
|
|
699
|
-
// since different collections
|
|
697
|
+
// However, if we are changing the target collection itself, we want the sort cleared too,
|
|
698
|
+
// since different collections may have different sorting options available.
|
|
700
699
|
const shouldClearSort = changed.has('withinCollection') &&
|
|
701
700
|
!changed.has('selectedSort') &&
|
|
702
701
|
!changed.has('sortDirection');
|
|
703
702
|
// Otherwise, only clear filters that haven't been simultaneously applied in this update
|
|
704
|
-
console.log('clearing filters from update');
|
|
705
703
|
this.clearFilters({
|
|
706
704
|
sort: shouldClearSort,
|
|
707
705
|
facets: !changed.has('selectedFacets'),
|
|
@@ -739,16 +737,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
739
737
|
if (changed.has('selectedCreatorFilter')) {
|
|
740
738
|
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
741
739
|
}
|
|
742
|
-
// if (changed.has('withinCollection')) {
|
|
743
|
-
// // Because different collections can have different sort options available,
|
|
744
|
-
// // we clear the applied sort when the target collection changes.
|
|
745
|
-
// this.clearFilters({
|
|
746
|
-
// sort: true,
|
|
747
|
-
// facets: false,
|
|
748
|
-
// dateRange: false,
|
|
749
|
-
// letterFilters: false
|
|
750
|
-
// });
|
|
751
|
-
// }
|
|
752
740
|
if (changed.has('baseQuery') ||
|
|
753
741
|
changed.has('searchType') ||
|
|
754
742
|
changed.has('selectedTitleFilter') ||
|
|
@@ -904,7 +892,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
904
892
|
}
|
|
905
893
|
async handleQueryChange() {
|
|
906
894
|
var _a;
|
|
907
|
-
console.log('handling query change');
|
|
908
895
|
// only reset if the query has actually changed
|
|
909
896
|
if (!this.searchService || this.pageFetchQueryKey === this.previousQueryKey)
|
|
910
897
|
return;
|