@internetarchive/collection-browser 0.3.7 → 0.3.8
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/.editorconfig +29 -29
- package/.github/workflows/ci.yml +26 -26
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/app-root.d.ts +48 -47
- package/dist/src/app-root.js +271 -250
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-left.js +2 -2
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-right.js +2 -2
- package/dist/src/assets/img/icons/chevron.d.ts +2 -2
- package/dist/src/assets/img/icons/chevron.js +2 -2
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.js +2 -2
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
- package/dist/src/assets/img/icons/eye-closed.js +2 -2
- package/dist/src/assets/img/icons/eye.d.ts +2 -2
- package/dist/src/assets/img/icons/eye.js +2 -2
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +278 -246
- package/dist/src/collection-browser.js +1105 -1031
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +16 -16
- package/dist/src/collection-facets/facets-template.js +125 -125
- package/dist/src/collection-facets/more-facets-content.d.ts +76 -76
- package/dist/src/collection-facets/more-facets-content.js +353 -353
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +192 -192
- package/dist/src/collection-facets.d.ts +77 -77
- package/dist/src/collection-facets.js +388 -389
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +11 -11
- package/dist/src/empty-placeholder.js +42 -42
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +103 -103
- package/dist/src/models.js +117 -117
- package/dist/src/restoration-state-handler.d.ts +46 -46
- package/dist/src/restoration-state-handler.js +230 -230
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +9 -9
- package/dist/src/sort-filter-bar/alpha-bar.js +41 -41
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.js +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +107 -107
- package/dist/src/sort-filter-bar/sort-filter-bar.js +423 -423
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
- package/dist/src/tiles/grid/account-tile.d.ts +8 -8
- package/dist/src/tiles/grid/account-tile.js +20 -20
- package/dist/src/tiles/grid/collection-tile.d.ts +7 -7
- package/dist/src/tiles/grid/collection-tile.js +23 -23
- package/dist/src/tiles/grid/item-tile.d.ts +24 -24
- package/dist/src/tiles/grid/item-tile.js +87 -87
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
- package/dist/src/tiles/grid/tile-stats.js +40 -40
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +69 -69
- package/dist/src/tiles/item-image.d.ts +31 -31
- package/dist/src/tiles/item-image.js +103 -103
- package/dist/src/tiles/list/account-label.d.ts +1 -1
- package/dist/src/tiles/list/account-label.js +6 -6
- package/dist/src/tiles/list/date-label.d.ts +1 -1
- package/dist/src/tiles/list/date-label.js +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
- package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
- package/dist/src/tiles/list/tile-list-compact.js +93 -93
- package/dist/src/tiles/list/tile-list.d.ts +50 -50
- package/dist/src/tiles/list/tile-list.js +275 -272
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/mediatype-icon.d.ts +9 -9
- package/dist/src/tiles/mediatype-icon.js +47 -47
- package/dist/src/tiles/overlay/icon-overlay.d.ts +7 -7
- package/dist/src/tiles/overlay/icon-overlay.js +30 -30
- package/dist/src/tiles/overlay/text-overlay.d.ts +8 -8
- package/dist/src/tiles/overlay/text-overlay.js +31 -31
- package/dist/src/tiles/text-snippet-block.d.ts +29 -29
- package/dist/src/tiles/text-snippet-block.js +81 -81
- package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
- package/dist/src/tiles/tile-dispatcher.js +128 -128
- package/dist/src/utils/analytics-events.d.ts +22 -22
- package/dist/src/utils/analytics-events.js +24 -24
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +23 -23
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +583 -444
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +62 -62
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +114 -114
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +544 -498
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +33 -33
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +56 -56
- package/dist/test/mediatype-config.test.d.ts +1 -1
- package/dist/test/mediatype-config.test.js +16 -16
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
- package/dist/test/mocks/mock-analytics-handler.js +15 -15
- package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
- package/dist/test/mocks/mock-collection-name-cache.js +13 -13
- package/dist/test/mocks/mock-search-responses.d.ts +10 -8
- package/dist/test/mocks/mock-search-responses.js +271 -198
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +36 -32
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +126 -126
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +113 -113
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +41 -41
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +33 -33
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +107 -107
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +96 -67
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/utils/format-count.test.d.ts +1 -1
- package/dist/test/utils/format-count.test.js +23 -23
- package/dist/test/utils/format-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +3 -3
- package/renovate.json +6 -6
- package/src/app-root.ts +32 -9
- package/src/collection-browser.ts +130 -35
- package/src/collection-facets.ts +2 -3
- package/src/tiles/list/tile-list.ts +6 -2
- package/test/collection-browser.test.ts +207 -0
- package/test/collection-facets.test.ts +67 -0
- package/test/mocks/mock-search-responses.ts +82 -0
- package/test/mocks/mock-search-service.ts +6 -0
- package/test/tiles/list/tile-list.test.ts +40 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,188 +1,188 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/* eslint-disable import/no-duplicates */
|
|
3
|
-
import { html, css, LitElement, nothing, } from 'lit';
|
|
4
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
-
import { SearchType, } from '@internetarchive/search-service';
|
|
7
|
-
import '@internetarchive/infinite-scroller';
|
|
8
|
-
import './tiles/tile-dispatcher';
|
|
9
|
-
import './tiles/collection-browser-loading-tile';
|
|
10
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
11
|
-
import './collection-facets';
|
|
12
|
-
import './circular-activity-indicator';
|
|
13
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
14
|
-
import { SortField, SortFieldToMetadataField, defaultSelectedFacets, } from './models';
|
|
15
|
-
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
16
|
-
import chevronIcon from './assets/img/icons/chevron';
|
|
17
|
-
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
|
|
18
|
-
import './empty-placeholder';
|
|
19
|
-
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
20
|
-
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.baseImageUrl = 'https://archive.org';
|
|
24
|
-
this.searchType = SearchType.METADATA;
|
|
25
|
-
this.sortParam = null;
|
|
26
|
-
this.selectedSort = SortField.relevance;
|
|
27
|
-
this.selectedTitleFilter = null;
|
|
28
|
-
this.selectedCreatorFilter = null;
|
|
29
|
-
this.sortDirection = null;
|
|
30
|
-
this.pageSize = 50;
|
|
31
|
-
this.showHistogramDatePicker = false;
|
|
32
|
-
/** describes where this component is being used */
|
|
33
|
-
this.searchContext = analyticsCategories.default;
|
|
34
|
-
this.pageContext = 'search';
|
|
35
|
-
this.restorationStateHandler = new RestorationStateHandler({
|
|
36
|
-
context: this.pageContext,
|
|
37
|
-
});
|
|
38
|
-
this.mobileBreakpoint = 600;
|
|
39
|
-
this.loggedIn = false;
|
|
40
|
-
this.modalManager = undefined;
|
|
41
|
-
/**
|
|
42
|
-
* If item management UI active
|
|
43
|
-
*/
|
|
44
|
-
this.isManageView = false;
|
|
45
|
-
/**
|
|
46
|
-
* The page that the consumer wants to load.
|
|
47
|
-
*/
|
|
48
|
-
this.initialPageNumber = 1;
|
|
49
|
-
/**
|
|
50
|
-
* This the the number of pages that we want to show.
|
|
51
|
-
*
|
|
52
|
-
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
53
|
-
* know how many cells we should render.
|
|
54
|
-
*/
|
|
55
|
-
this.pagesToRender = this.initialPageNumber;
|
|
56
|
-
this.searchResultsLoading = false;
|
|
57
|
-
this.facetsLoading = false;
|
|
58
|
-
this.fullYearAggregationLoading = false;
|
|
59
|
-
this.mobileView = false;
|
|
60
|
-
this.mobileFacetsVisible = false;
|
|
61
|
-
this.placeholderType = null;
|
|
62
|
-
this.languageCodeHandler = new LanguageCodeHandler();
|
|
63
|
-
/**
|
|
64
|
-
* When we're animated scrolling to the page, we don't want to fetch
|
|
65
|
-
* all of the pages as it scrolls so this lets us know if we're scrolling
|
|
66
|
-
*/
|
|
67
|
-
this.isScrollingToCell = false;
|
|
68
|
-
/**
|
|
69
|
-
* When we've reached the end of the data, stop trying to fetch more
|
|
70
|
-
*/
|
|
71
|
-
this.endOfDataReached = false;
|
|
72
|
-
/**
|
|
73
|
-
* When page width resizes from desktop to mobile, set true to
|
|
74
|
-
* disable expand/collapse transition when loading.
|
|
75
|
-
*/
|
|
76
|
-
this.isResizeToMobile = false;
|
|
77
|
-
this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
78
|
-
/**
|
|
79
|
-
* The results per page so we can paginate.
|
|
80
|
-
*
|
|
81
|
-
* This allows us to start in the middle of the search results and
|
|
82
|
-
* fetch data before or after the current page. If we don't have a key
|
|
83
|
-
* for the previous/next page, we'll fetch the next/previous page to populate it
|
|
84
|
-
*/
|
|
85
|
-
this.dataSource = {};
|
|
86
|
-
// we only want to scroll on the very first query change
|
|
87
|
-
// so this keeps track of whether we've already set the initial query
|
|
88
|
-
this.initialQueryChangeHappened = false;
|
|
89
|
-
this.historyPopOccurred = false;
|
|
90
|
-
// this maps the query to the pages being fetched for that query
|
|
91
|
-
this.pageFetchesInProgress = {};
|
|
92
|
-
}
|
|
93
|
-
tileModelAtCellIndex(index) {
|
|
94
|
-
var _a;
|
|
95
|
-
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
96
|
-
const itemIndex = index % this.pageSize;
|
|
97
|
-
const model = (_a = this.dataSource[pageNumber]) === null || _a === void 0 ? void 0 : _a[itemIndex];
|
|
98
|
-
/**
|
|
99
|
-
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
100
|
-
* automated scroll, fetch the page and just return undefined.
|
|
101
|
-
* The datasource will be updated once the page is loaded and the cell will be rendered.
|
|
102
|
-
*
|
|
103
|
-
* We disable it during the automated scroll since we may fetch pages for cells the
|
|
104
|
-
* user may never see.
|
|
105
|
-
*/
|
|
106
|
-
if (!model && !this.isScrollingToCell) {
|
|
107
|
-
this.fetchPage(pageNumber);
|
|
108
|
-
}
|
|
109
|
-
return model;
|
|
110
|
-
}
|
|
111
|
-
get sortFilterQueries() {
|
|
112
|
-
const queries = [this.titleQuery, this.creatorQuery];
|
|
113
|
-
return queries.filter(q => q).join(' AND ');
|
|
114
|
-
}
|
|
115
|
-
// this is the total number of tiles we expect if
|
|
116
|
-
// the data returned is a full page worth
|
|
117
|
-
// this is useful for putting in placeholders for the expected number of tiles
|
|
118
|
-
get estimatedTileCount() {
|
|
119
|
-
return this.pagesToRender * this.pageSize;
|
|
120
|
-
}
|
|
121
|
-
// this is the actual number of tiles in the datasource,
|
|
122
|
-
// which is useful for removing excess placeholder tiles
|
|
123
|
-
// once we reached the end of the data
|
|
124
|
-
get actualTileCount() {
|
|
125
|
-
return Object.keys(this.dataSource).reduce((acc, page) => acc + this.dataSource[page].length, 0);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Go to the given page of results
|
|
129
|
-
*
|
|
130
|
-
* @param pageNumber
|
|
131
|
-
*/
|
|
132
|
-
goToPage(pageNumber) {
|
|
133
|
-
this.initialPageNumber = pageNumber;
|
|
134
|
-
this.pagesToRender = pageNumber;
|
|
135
|
-
this.scrollToPage(pageNumber);
|
|
136
|
-
}
|
|
137
|
-
clearFilters() {
|
|
138
|
-
this.selectedFacets = defaultSelectedFacets;
|
|
139
|
-
this.sortParam = null;
|
|
140
|
-
this.selectedTitleFilter = null;
|
|
141
|
-
this.selectedCreatorFilter = null;
|
|
142
|
-
this.titleQuery = undefined;
|
|
143
|
-
this.creatorQuery = undefined;
|
|
144
|
-
this.selectedSort = SortField.relevance;
|
|
145
|
-
this.sortDirection = null;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Manually requests to perform a search, which will only be executed if one of
|
|
149
|
-
* the query, the search type, or the sort has changed.
|
|
150
|
-
*/
|
|
151
|
-
requestSearch() {
|
|
152
|
-
this.handleQueryChange();
|
|
153
|
-
}
|
|
154
|
-
render() {
|
|
155
|
-
this.setPlaceholderType();
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
/* eslint-disable import/no-duplicates */
|
|
3
|
+
import { html, css, LitElement, nothing, } from 'lit';
|
|
4
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import { SearchType, } from '@internetarchive/search-service';
|
|
7
|
+
import '@internetarchive/infinite-scroller';
|
|
8
|
+
import './tiles/tile-dispatcher';
|
|
9
|
+
import './tiles/collection-browser-loading-tile';
|
|
10
|
+
import './sort-filter-bar/sort-filter-bar';
|
|
11
|
+
import './collection-facets';
|
|
12
|
+
import './circular-activity-indicator';
|
|
13
|
+
import './sort-filter-bar/sort-filter-bar';
|
|
14
|
+
import { SortField, SortFieldToMetadataField, defaultSelectedFacets, } from './models';
|
|
15
|
+
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
16
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
17
|
+
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
|
|
18
|
+
import './empty-placeholder';
|
|
19
|
+
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
20
|
+
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.baseImageUrl = 'https://archive.org';
|
|
24
|
+
this.searchType = SearchType.METADATA;
|
|
25
|
+
this.sortParam = null;
|
|
26
|
+
this.selectedSort = SortField.relevance;
|
|
27
|
+
this.selectedTitleFilter = null;
|
|
28
|
+
this.selectedCreatorFilter = null;
|
|
29
|
+
this.sortDirection = null;
|
|
30
|
+
this.pageSize = 50;
|
|
31
|
+
this.showHistogramDatePicker = false;
|
|
32
|
+
/** describes where this component is being used */
|
|
33
|
+
this.searchContext = analyticsCategories.default;
|
|
34
|
+
this.pageContext = 'search';
|
|
35
|
+
this.restorationStateHandler = new RestorationStateHandler({
|
|
36
|
+
context: this.pageContext,
|
|
37
|
+
});
|
|
38
|
+
this.mobileBreakpoint = 600;
|
|
39
|
+
this.loggedIn = false;
|
|
40
|
+
this.modalManager = undefined;
|
|
41
|
+
/**
|
|
42
|
+
* If item management UI active
|
|
43
|
+
*/
|
|
44
|
+
this.isManageView = false;
|
|
45
|
+
/**
|
|
46
|
+
* The page that the consumer wants to load.
|
|
47
|
+
*/
|
|
48
|
+
this.initialPageNumber = 1;
|
|
49
|
+
/**
|
|
50
|
+
* This the the number of pages that we want to show.
|
|
51
|
+
*
|
|
52
|
+
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
53
|
+
* know how many cells we should render.
|
|
54
|
+
*/
|
|
55
|
+
this.pagesToRender = this.initialPageNumber;
|
|
56
|
+
this.searchResultsLoading = false;
|
|
57
|
+
this.facetsLoading = false;
|
|
58
|
+
this.fullYearAggregationLoading = false;
|
|
59
|
+
this.mobileView = false;
|
|
60
|
+
this.mobileFacetsVisible = false;
|
|
61
|
+
this.placeholderType = null;
|
|
62
|
+
this.languageCodeHandler = new LanguageCodeHandler();
|
|
63
|
+
/**
|
|
64
|
+
* When we're animated scrolling to the page, we don't want to fetch
|
|
65
|
+
* all of the pages as it scrolls so this lets us know if we're scrolling
|
|
66
|
+
*/
|
|
67
|
+
this.isScrollingToCell = false;
|
|
68
|
+
/**
|
|
69
|
+
* When we've reached the end of the data, stop trying to fetch more
|
|
70
|
+
*/
|
|
71
|
+
this.endOfDataReached = false;
|
|
72
|
+
/**
|
|
73
|
+
* When page width resizes from desktop to mobile, set true to
|
|
74
|
+
* disable expand/collapse transition when loading.
|
|
75
|
+
*/
|
|
76
|
+
this.isResizeToMobile = false;
|
|
77
|
+
this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
78
|
+
/**
|
|
79
|
+
* The results per page so we can paginate.
|
|
80
|
+
*
|
|
81
|
+
* This allows us to start in the middle of the search results and
|
|
82
|
+
* fetch data before or after the current page. If we don't have a key
|
|
83
|
+
* for the previous/next page, we'll fetch the next/previous page to populate it
|
|
84
|
+
*/
|
|
85
|
+
this.dataSource = {};
|
|
86
|
+
// we only want to scroll on the very first query change
|
|
87
|
+
// so this keeps track of whether we've already set the initial query
|
|
88
|
+
this.initialQueryChangeHappened = false;
|
|
89
|
+
this.historyPopOccurred = false;
|
|
90
|
+
// this maps the query to the pages being fetched for that query
|
|
91
|
+
this.pageFetchesInProgress = {};
|
|
92
|
+
}
|
|
93
|
+
tileModelAtCellIndex(index) {
|
|
94
|
+
var _a;
|
|
95
|
+
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
96
|
+
const itemIndex = index % this.pageSize;
|
|
97
|
+
const model = (_a = this.dataSource[pageNumber]) === null || _a === void 0 ? void 0 : _a[itemIndex];
|
|
98
|
+
/**
|
|
99
|
+
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
100
|
+
* automated scroll, fetch the page and just return undefined.
|
|
101
|
+
* The datasource will be updated once the page is loaded and the cell will be rendered.
|
|
102
|
+
*
|
|
103
|
+
* We disable it during the automated scroll since we may fetch pages for cells the
|
|
104
|
+
* user may never see.
|
|
105
|
+
*/
|
|
106
|
+
if (!model && !this.isScrollingToCell) {
|
|
107
|
+
this.fetchPage(pageNumber);
|
|
108
|
+
}
|
|
109
|
+
return model;
|
|
110
|
+
}
|
|
111
|
+
get sortFilterQueries() {
|
|
112
|
+
const queries = [this.titleQuery, this.creatorQuery];
|
|
113
|
+
return queries.filter(q => q).join(' AND ');
|
|
114
|
+
}
|
|
115
|
+
// this is the total number of tiles we expect if
|
|
116
|
+
// the data returned is a full page worth
|
|
117
|
+
// this is useful for putting in placeholders for the expected number of tiles
|
|
118
|
+
get estimatedTileCount() {
|
|
119
|
+
return this.pagesToRender * this.pageSize;
|
|
120
|
+
}
|
|
121
|
+
// this is the actual number of tiles in the datasource,
|
|
122
|
+
// which is useful for removing excess placeholder tiles
|
|
123
|
+
// once we reached the end of the data
|
|
124
|
+
get actualTileCount() {
|
|
125
|
+
return Object.keys(this.dataSource).reduce((acc, page) => acc + this.dataSource[page].length, 0);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Go to the given page of results
|
|
129
|
+
*
|
|
130
|
+
* @param pageNumber
|
|
131
|
+
*/
|
|
132
|
+
goToPage(pageNumber) {
|
|
133
|
+
this.initialPageNumber = pageNumber;
|
|
134
|
+
this.pagesToRender = pageNumber;
|
|
135
|
+
this.scrollToPage(pageNumber);
|
|
136
|
+
}
|
|
137
|
+
clearFilters() {
|
|
138
|
+
this.selectedFacets = defaultSelectedFacets;
|
|
139
|
+
this.sortParam = null;
|
|
140
|
+
this.selectedTitleFilter = null;
|
|
141
|
+
this.selectedCreatorFilter = null;
|
|
142
|
+
this.titleQuery = undefined;
|
|
143
|
+
this.creatorQuery = undefined;
|
|
144
|
+
this.selectedSort = SortField.relevance;
|
|
145
|
+
this.sortDirection = null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Manually requests to perform a search, which will only be executed if one of
|
|
149
|
+
* the query, the search type, or the sort has changed.
|
|
150
|
+
*/
|
|
151
|
+
requestSearch() {
|
|
152
|
+
this.handleQueryChange();
|
|
153
|
+
}
|
|
154
|
+
render() {
|
|
155
|
+
this.setPlaceholderType();
|
|
156
156
|
return html `
|
|
157
157
|
<div
|
|
158
158
|
id="content-container"
|
|
159
159
|
class=${this.mobileView ? 'mobile' : 'desktop'}
|
|
160
160
|
>
|
|
161
|
-
${this.placeholderType
|
|
162
|
-
? this.emptyPlaceholderTemplate
|
|
161
|
+
${this.placeholderType
|
|
162
|
+
? this.emptyPlaceholderTemplate
|
|
163
163
|
: this.collectionBrowserTemplate}
|
|
164
164
|
</div>
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
167
|
-
setPlaceholderType() {
|
|
168
|
-
this.placeholderType = null;
|
|
169
|
-
if (!this.baseQuery) {
|
|
170
|
-
this.placeholderType = 'empty-query';
|
|
171
|
-
}
|
|
172
|
-
if ((!this.searchResultsLoading && this.totalResults === 0) ||
|
|
173
|
-
!this.searchService) {
|
|
174
|
-
this.placeholderType = 'null-result';
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
get emptyPlaceholderTemplate() {
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
setPlaceholderType() {
|
|
168
|
+
this.placeholderType = null;
|
|
169
|
+
if (!this.baseQuery) {
|
|
170
|
+
this.placeholderType = 'empty-query';
|
|
171
|
+
}
|
|
172
|
+
if ((!this.searchResultsLoading && this.totalResults === 0) ||
|
|
173
|
+
!this.searchService) {
|
|
174
|
+
this.placeholderType = 'null-result';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
get emptyPlaceholderTemplate() {
|
|
178
178
|
return html `
|
|
179
179
|
<empty-placeholder
|
|
180
180
|
.placeholderType=${this.placeholderType}
|
|
181
181
|
?isMobileView=${this.mobileView}
|
|
182
182
|
></empty-placeholder>
|
|
183
|
-
`;
|
|
184
|
-
}
|
|
185
|
-
get collectionBrowserTemplate() {
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
get collectionBrowserTemplate() {
|
|
186
186
|
return html `<div
|
|
187
187
|
id="left-column"
|
|
188
188
|
class="column${this.isResizeToMobile ? ' preload' : ''}"
|
|
@@ -191,8 +191,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
191
191
|
${this.mobileView ? this.mobileFacetsTemplate : nothing}
|
|
192
192
|
<div id="results-total">
|
|
193
193
|
<span id="big-results-count">
|
|
194
|
-
${this.totalResults !== undefined
|
|
195
|
-
? this.totalResults.toLocaleString()
|
|
194
|
+
${this.totalResults !== undefined
|
|
195
|
+
? this.totalResults.toLocaleString()
|
|
196
196
|
: '-'}
|
|
197
197
|
</span>
|
|
198
198
|
<span id="big-results-label">
|
|
@@ -202,8 +202,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
202
202
|
</div>
|
|
203
203
|
<div
|
|
204
204
|
id="facets-container"
|
|
205
|
-
class=${!this.mobileView || this.mobileFacetsVisible
|
|
206
|
-
? 'expanded'
|
|
205
|
+
class=${!this.mobileView || this.mobileFacetsVisible
|
|
206
|
+
? 'expanded'
|
|
207
207
|
: ''}
|
|
208
208
|
>
|
|
209
209
|
${this.facetsTemplate}
|
|
@@ -211,22 +211,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
211
211
|
</div>
|
|
212
212
|
<div id="right-column" class="column">
|
|
213
213
|
${this.sortFilterBarTemplate}
|
|
214
|
-
${this.displayMode === `list-compact`
|
|
215
|
-
? this.listHeaderTemplate
|
|
214
|
+
${this.displayMode === `list-compact`
|
|
215
|
+
? this.listHeaderTemplate
|
|
216
216
|
: nothing}
|
|
217
217
|
${this.infiniteScrollerTemplate}
|
|
218
|
-
</div>`;
|
|
219
|
-
}
|
|
220
|
-
get infiniteScrollerTemplate() {
|
|
218
|
+
</div>`;
|
|
219
|
+
}
|
|
220
|
+
get infiniteScrollerTemplate() {
|
|
221
221
|
return html `<infinite-scroller
|
|
222
222
|
class="${ifDefined(this.displayMode)}"
|
|
223
223
|
.cellProvider=${this}
|
|
224
224
|
.placeholderCellTemplate=${this.placeholderCellTemplate}
|
|
225
225
|
@scrollThresholdReached=${this.scrollThresholdReached}
|
|
226
226
|
@visibleCellsChanged=${this.visibleCellsChanged}
|
|
227
|
-
></infinite-scroller>`;
|
|
228
|
-
}
|
|
229
|
-
get sortFilterBarTemplate() {
|
|
227
|
+
></infinite-scroller>`;
|
|
228
|
+
}
|
|
229
|
+
get sortFilterBarTemplate() {
|
|
230
230
|
return html `
|
|
231
231
|
<sort-filter-bar
|
|
232
232
|
.selectedSort=${this.selectedSort}
|
|
@@ -241,114 +241,114 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
241
241
|
@creatorLetterChanged=${this.creatorLetterSelected}
|
|
242
242
|
>
|
|
243
243
|
</sort-filter-bar>
|
|
244
|
-
`;
|
|
245
|
-
}
|
|
246
|
-
userChangedSort(e) {
|
|
247
|
-
var _a;
|
|
248
|
-
const { selectedSort, sortDirection } = e.detail;
|
|
249
|
-
this.selectedSort = selectedSort;
|
|
250
|
-
this.sortDirection = sortDirection;
|
|
251
|
-
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
252
|
-
this.goToPage(1);
|
|
253
|
-
}
|
|
254
|
-
this.currentPage = 1;
|
|
255
|
-
}
|
|
256
|
-
sendSortByAnalytics(prevSortDirection) {
|
|
257
|
-
var _a;
|
|
258
|
-
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
259
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
260
|
-
category: this.searchContext,
|
|
261
|
-
action: analyticsActions.sortBy,
|
|
262
|
-
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
selectedSortChanged() {
|
|
266
|
-
if (this.selectedSort === 'relevance' || this.sortDirection === null) {
|
|
267
|
-
this.sortParam = null;
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const sortField = SortFieldToMetadataField[this.selectedSort];
|
|
271
|
-
if (!sortField)
|
|
272
|
-
return;
|
|
273
|
-
this.sortParam = { field: sortField, direction: this.sortDirection };
|
|
274
|
-
}
|
|
275
|
-
displayModeChanged(e) {
|
|
276
|
-
var _a;
|
|
277
|
-
this.displayMode = e.detail.displayMode;
|
|
278
|
-
if (this.displayMode) {
|
|
279
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
280
|
-
category: this.searchContext,
|
|
281
|
-
action: analyticsActions.displayMode,
|
|
282
|
-
label: this.displayMode,
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
/** Send Analytics when sorting by title's first letter
|
|
287
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
288
|
-
* */
|
|
289
|
-
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
290
|
-
var _a;
|
|
291
|
-
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
const cleared = prevSelectedLetter && this.selectedTitleFilter === null;
|
|
295
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
296
|
-
category: this.searchContext,
|
|
297
|
-
action: analyticsActions.filterByTitle,
|
|
298
|
-
label: cleared
|
|
299
|
-
? `clear-${prevSelectedLetter}`
|
|
300
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
selectedTitleLetterChanged() {
|
|
304
|
-
this.titleQuery = this.selectedTitleFilter
|
|
305
|
-
? `firstTitle:${this.selectedTitleFilter}`
|
|
306
|
-
: undefined;
|
|
307
|
-
}
|
|
308
|
-
/** Send Analytics when filtering by creator's first letter
|
|
309
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
310
|
-
* */
|
|
311
|
-
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
312
|
-
var _a;
|
|
313
|
-
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
const cleared = prevSelectedLetter && this.selectedCreatorFilter === null;
|
|
317
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
318
|
-
category: this.searchContext,
|
|
319
|
-
action: analyticsActions.filterByCreator,
|
|
320
|
-
label: cleared
|
|
321
|
-
? `clear-${prevSelectedLetter}`
|
|
322
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
selectedCreatorLetterChanged() {
|
|
326
|
-
this.creatorQuery = this.selectedCreatorFilter
|
|
327
|
-
? `firstCreator:${this.selectedCreatorFilter}`
|
|
328
|
-
: undefined;
|
|
329
|
-
}
|
|
330
|
-
titleLetterSelected(e) {
|
|
331
|
-
this.selectedCreatorFilter = null;
|
|
332
|
-
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
333
|
-
}
|
|
334
|
-
creatorLetterSelected(e) {
|
|
335
|
-
this.selectedTitleFilter = null;
|
|
336
|
-
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
337
|
-
}
|
|
338
|
-
get facetDataLoading() {
|
|
339
|
-
return this.facetsLoading || this.fullYearAggregationLoading;
|
|
340
|
-
}
|
|
341
|
-
get mobileFacetsTemplate() {
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
userChangedSort(e) {
|
|
247
|
+
var _a;
|
|
248
|
+
const { selectedSort, sortDirection } = e.detail;
|
|
249
|
+
this.selectedSort = selectedSort;
|
|
250
|
+
this.sortDirection = sortDirection;
|
|
251
|
+
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
252
|
+
this.goToPage(1);
|
|
253
|
+
}
|
|
254
|
+
this.currentPage = 1;
|
|
255
|
+
}
|
|
256
|
+
sendSortByAnalytics(prevSortDirection) {
|
|
257
|
+
var _a;
|
|
258
|
+
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
259
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
260
|
+
category: this.searchContext,
|
|
261
|
+
action: analyticsActions.sortBy,
|
|
262
|
+
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
selectedSortChanged() {
|
|
266
|
+
if (this.selectedSort === 'relevance' || this.sortDirection === null) {
|
|
267
|
+
this.sortParam = null;
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const sortField = SortFieldToMetadataField[this.selectedSort];
|
|
271
|
+
if (!sortField)
|
|
272
|
+
return;
|
|
273
|
+
this.sortParam = { field: sortField, direction: this.sortDirection };
|
|
274
|
+
}
|
|
275
|
+
displayModeChanged(e) {
|
|
276
|
+
var _a;
|
|
277
|
+
this.displayMode = e.detail.displayMode;
|
|
278
|
+
if (this.displayMode) {
|
|
279
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
280
|
+
category: this.searchContext,
|
|
281
|
+
action: analyticsActions.displayMode,
|
|
282
|
+
label: this.displayMode,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** Send Analytics when sorting by title's first letter
|
|
287
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
288
|
+
* */
|
|
289
|
+
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
290
|
+
var _a;
|
|
291
|
+
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const cleared = prevSelectedLetter && this.selectedTitleFilter === null;
|
|
295
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
296
|
+
category: this.searchContext,
|
|
297
|
+
action: analyticsActions.filterByTitle,
|
|
298
|
+
label: cleared
|
|
299
|
+
? `clear-${prevSelectedLetter}`
|
|
300
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
selectedTitleLetterChanged() {
|
|
304
|
+
this.titleQuery = this.selectedTitleFilter
|
|
305
|
+
? `firstTitle:${this.selectedTitleFilter}`
|
|
306
|
+
: undefined;
|
|
307
|
+
}
|
|
308
|
+
/** Send Analytics when filtering by creator's first letter
|
|
309
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
310
|
+
* */
|
|
311
|
+
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
312
|
+
var _a;
|
|
313
|
+
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const cleared = prevSelectedLetter && this.selectedCreatorFilter === null;
|
|
317
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
318
|
+
category: this.searchContext,
|
|
319
|
+
action: analyticsActions.filterByCreator,
|
|
320
|
+
label: cleared
|
|
321
|
+
? `clear-${prevSelectedLetter}`
|
|
322
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
selectedCreatorLetterChanged() {
|
|
326
|
+
this.creatorQuery = this.selectedCreatorFilter
|
|
327
|
+
? `firstCreator:${this.selectedCreatorFilter}`
|
|
328
|
+
: undefined;
|
|
329
|
+
}
|
|
330
|
+
titleLetterSelected(e) {
|
|
331
|
+
this.selectedCreatorFilter = null;
|
|
332
|
+
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
333
|
+
}
|
|
334
|
+
creatorLetterSelected(e) {
|
|
335
|
+
this.selectedTitleFilter = null;
|
|
336
|
+
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
337
|
+
}
|
|
338
|
+
get facetDataLoading() {
|
|
339
|
+
return this.facetsLoading || this.fullYearAggregationLoading;
|
|
340
|
+
}
|
|
341
|
+
get mobileFacetsTemplate() {
|
|
342
342
|
return html `
|
|
343
343
|
<div id="mobile-filter-collapse">
|
|
344
344
|
<h1
|
|
345
|
-
@click=${() => {
|
|
346
|
-
this.isResizeToMobile = false;
|
|
347
|
-
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
345
|
+
@click=${() => {
|
|
346
|
+
this.isResizeToMobile = false;
|
|
347
|
+
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
348
348
|
}}
|
|
349
|
-
@keyup=${() => {
|
|
350
|
-
this.isResizeToMobile = false;
|
|
351
|
-
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
349
|
+
@keyup=${() => {
|
|
350
|
+
this.isResizeToMobile = false;
|
|
351
|
+
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
352
352
|
}}
|
|
353
353
|
>
|
|
354
354
|
<span class="collapser ${this.mobileFacetsVisible ? 'open' : ''}">
|
|
@@ -357,9 +357,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
357
357
|
Filters
|
|
358
358
|
</h1>
|
|
359
359
|
</div>
|
|
360
|
-
`;
|
|
361
|
-
}
|
|
362
|
-
get facetsTemplate() {
|
|
360
|
+
`;
|
|
361
|
+
}
|
|
362
|
+
get facetsTemplate() {
|
|
363
363
|
return html `
|
|
364
364
|
<collection-facets
|
|
365
365
|
@facetsChanged=${this.facetsChanged}
|
|
@@ -384,16 +384,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
384
384
|
.analyticsHandler=${this.analyticsHandler}
|
|
385
385
|
>
|
|
386
386
|
</collection-facets>
|
|
387
|
-
`;
|
|
388
|
-
}
|
|
389
|
-
get loadingTemplate() {
|
|
387
|
+
`;
|
|
388
|
+
}
|
|
389
|
+
get loadingTemplate() {
|
|
390
390
|
return html `
|
|
391
391
|
<div class="loading-cover">
|
|
392
392
|
<circular-activity-indicator></circular-activity-indicator>
|
|
393
393
|
</div>
|
|
394
|
-
`;
|
|
395
|
-
}
|
|
396
|
-
get listHeaderTemplate() {
|
|
394
|
+
`;
|
|
395
|
+
}
|
|
396
|
+
get listHeaderTemplate() {
|
|
397
397
|
return html `
|
|
398
398
|
<div id="list-header">
|
|
399
399
|
<tile-dispatcher
|
|
@@ -405,10 +405,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
405
405
|
>
|
|
406
406
|
</tile-dispatcher>
|
|
407
407
|
</div>
|
|
408
|
-
`;
|
|
409
|
-
}
|
|
410
|
-
get queryDebuggingTemplate() {
|
|
411
|
-
var _a, _b;
|
|
408
|
+
`;
|
|
409
|
+
}
|
|
410
|
+
get queryDebuggingTemplate() {
|
|
411
|
+
var _a, _b;
|
|
412
412
|
return html `
|
|
413
413
|
<div>
|
|
414
414
|
<ul>
|
|
@@ -420,590 +420,664 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
420
420
|
<li>Full Query: ${this.fullQuery}</li>
|
|
421
421
|
</ul>
|
|
422
422
|
</div>
|
|
423
|
-
`;
|
|
424
|
-
}
|
|
425
|
-
histogramDateRangeUpdated(e) {
|
|
426
|
-
var _a;
|
|
427
|
-
const { minDate, maxDate } = e.detail;
|
|
428
|
-
this.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
this.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
changed.has('
|
|
446
|
-
changed.has('
|
|
447
|
-
(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
changed.has('
|
|
461
|
-
changed.has('
|
|
462
|
-
changed.has('
|
|
463
|
-
changed.has('
|
|
464
|
-
changed.has('
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
this.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
this.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* @
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
this.
|
|
566
|
-
|
|
567
|
-
this.
|
|
568
|
-
this.
|
|
569
|
-
this.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
this.
|
|
583
|
-
this.
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
this.
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
this.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
this.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
this.
|
|
610
|
-
this.
|
|
611
|
-
this.
|
|
612
|
-
this.
|
|
613
|
-
this.
|
|
614
|
-
this.
|
|
615
|
-
this.
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
if (
|
|
727
|
-
return;
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
*
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
//
|
|
789
|
-
//
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
this.
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
this.
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
var _a;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
(
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
//
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
423
|
+
`;
|
|
424
|
+
}
|
|
425
|
+
histogramDateRangeUpdated(e) {
|
|
426
|
+
var _a;
|
|
427
|
+
const { minDate, maxDate } = e.detail;
|
|
428
|
+
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
429
|
+
this.dateRangeQueryClause = `year:[${minDate} TO ${maxDate}]`;
|
|
430
|
+
if (this.dateRangeQueryClause) {
|
|
431
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
432
|
+
category: this.searchContext,
|
|
433
|
+
action: analyticsActions.histogramChanged,
|
|
434
|
+
label: this.dateRangeQueryClause,
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
firstUpdated() {
|
|
439
|
+
this.setupStateRestorationObserver();
|
|
440
|
+
this.restoreState();
|
|
441
|
+
}
|
|
442
|
+
updated(changed) {
|
|
443
|
+
var _a;
|
|
444
|
+
if (changed.has('displayMode') ||
|
|
445
|
+
changed.has('baseNavigationUrl') ||
|
|
446
|
+
changed.has('baseImageUrl') ||
|
|
447
|
+
changed.has('loggedIn')) {
|
|
448
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
449
|
+
}
|
|
450
|
+
if (changed.has('baseQuery')) {
|
|
451
|
+
this.emitBaseQueryChanged();
|
|
452
|
+
}
|
|
453
|
+
if (changed.has('searchType')) {
|
|
454
|
+
this.emitSearchTypeChanged();
|
|
455
|
+
}
|
|
456
|
+
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
457
|
+
this.persistState();
|
|
458
|
+
}
|
|
459
|
+
if (changed.has('baseQuery') ||
|
|
460
|
+
changed.has('titleQuery') ||
|
|
461
|
+
changed.has('creatorQuery') ||
|
|
462
|
+
changed.has('dateRangeQueryClause') ||
|
|
463
|
+
changed.has('sortParam') ||
|
|
464
|
+
changed.has('selectedFacets') ||
|
|
465
|
+
changed.has('searchService')) {
|
|
466
|
+
this.handleQueryChange();
|
|
467
|
+
}
|
|
468
|
+
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
469
|
+
const prevSortDirection = changed.get('sortDirection');
|
|
470
|
+
this.sendSortByAnalytics(prevSortDirection);
|
|
471
|
+
this.selectedSortChanged();
|
|
472
|
+
}
|
|
473
|
+
if (changed.has('selectedTitleFilter')) {
|
|
474
|
+
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
475
|
+
this.selectedTitleLetterChanged();
|
|
476
|
+
}
|
|
477
|
+
if (changed.has('selectedCreatorFilter')) {
|
|
478
|
+
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
479
|
+
this.selectedCreatorLetterChanged();
|
|
480
|
+
}
|
|
481
|
+
if (changed.has('pagesToRender')) {
|
|
482
|
+
if (!this.endOfDataReached && this.infiniteScroller) {
|
|
483
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (changed.has('resizeObserver')) {
|
|
487
|
+
const oldObserver = changed.get('resizeObserver');
|
|
488
|
+
if (oldObserver)
|
|
489
|
+
this.disconnectResizeObserver(oldObserver);
|
|
490
|
+
this.setupResizeObserver();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
disconnectedCallback() {
|
|
494
|
+
if (this.resizeObserver) {
|
|
495
|
+
this.disconnectResizeObserver(this.resizeObserver);
|
|
496
|
+
}
|
|
497
|
+
if (this.boundNavigationHandler) {
|
|
498
|
+
window.removeEventListener('popstate', this.boundNavigationHandler);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
handleResize(entry) {
|
|
502
|
+
const previousView = this.mobileView;
|
|
503
|
+
if (entry.target === this.contentContainer) {
|
|
504
|
+
this.mobileView = entry.contentRect.width < this.mobileBreakpoint;
|
|
505
|
+
// If changing from desktop to mobile disable transition
|
|
506
|
+
if (this.mobileView && !previousView) {
|
|
507
|
+
this.isResizeToMobile = true;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
emitBaseQueryChanged() {
|
|
512
|
+
this.dispatchEvent(new CustomEvent('baseQueryChanged', {
|
|
513
|
+
detail: {
|
|
514
|
+
baseQuery: this.baseQuery,
|
|
515
|
+
},
|
|
516
|
+
}));
|
|
517
|
+
}
|
|
518
|
+
emitSearchTypeChanged() {
|
|
519
|
+
this.dispatchEvent(new CustomEvent('searchTypeChanged', {
|
|
520
|
+
detail: this.searchType,
|
|
521
|
+
}));
|
|
522
|
+
}
|
|
523
|
+
disconnectResizeObserver(resizeObserver) {
|
|
524
|
+
resizeObserver.removeObserver({
|
|
525
|
+
target: this.contentContainer,
|
|
526
|
+
handler: this,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
setupResizeObserver() {
|
|
530
|
+
if (!this.resizeObserver)
|
|
531
|
+
return;
|
|
532
|
+
this.resizeObserver.addObserver({
|
|
533
|
+
target: this.contentContainer,
|
|
534
|
+
handler: this,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* When the visible cells change from the infinite scroller, we want to emit
|
|
539
|
+
* which page is currently visible so the consumer can update its UI or the URL
|
|
540
|
+
*
|
|
541
|
+
* @param e
|
|
542
|
+
* @returns
|
|
543
|
+
*/
|
|
544
|
+
visibleCellsChanged(e) {
|
|
545
|
+
if (this.isScrollingToCell)
|
|
546
|
+
return;
|
|
547
|
+
const { visibleCellIndices } = e.detail;
|
|
548
|
+
if (visibleCellIndices.length === 0)
|
|
549
|
+
return;
|
|
550
|
+
const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
|
|
551
|
+
const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
|
|
552
|
+
if (this.currentPage !== lastVisibleCellPage) {
|
|
553
|
+
this.currentPage = lastVisibleCellPage;
|
|
554
|
+
}
|
|
555
|
+
const event = new CustomEvent('visiblePageChanged', {
|
|
556
|
+
detail: {
|
|
557
|
+
pageNumber: lastVisibleCellPage,
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
this.dispatchEvent(event);
|
|
561
|
+
}
|
|
562
|
+
async handleQueryChange() {
|
|
563
|
+
var _a;
|
|
564
|
+
// only reset if the query has actually changed
|
|
565
|
+
if (!this.searchService || this.pageFetchQueryKey === this.previousQueryKey)
|
|
566
|
+
return;
|
|
567
|
+
this.previousQueryKey = this.pageFetchQueryKey;
|
|
568
|
+
this.dataSource = {};
|
|
569
|
+
this.pageFetchesInProgress = {};
|
|
570
|
+
this.endOfDataReached = false;
|
|
571
|
+
this.pagesToRender = this.initialPageNumber;
|
|
572
|
+
// Reset the infinite scroller's item count, so that it
|
|
573
|
+
// shows tile placeholders until the new query's results load in
|
|
574
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
575
|
+
if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
|
|
576
|
+
this.scrollToPage(this.initialPageNumber);
|
|
577
|
+
}
|
|
578
|
+
this.initialQueryChangeHappened = true;
|
|
579
|
+
// if the query changed as part of a window.history pop event, we don't want to
|
|
580
|
+
// persist the state because it overwrites the forward history
|
|
581
|
+
if (!this.historyPopOccurred) {
|
|
582
|
+
this.persistState();
|
|
583
|
+
this.historyPopOccurred = false;
|
|
584
|
+
}
|
|
585
|
+
await Promise.all([
|
|
586
|
+
this.doInitialPageFetch(),
|
|
587
|
+
this.fetchFacets(),
|
|
588
|
+
// Only fetch histogram data separately if we need it b/c of date filters
|
|
589
|
+
this.shouldRequestYearHistogram && this.fetchFullYearHistogram(),
|
|
590
|
+
]);
|
|
591
|
+
}
|
|
592
|
+
setupStateRestorationObserver() {
|
|
593
|
+
if (this.boundNavigationHandler)
|
|
594
|
+
return;
|
|
595
|
+
this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
|
|
596
|
+
// when the user navigates back, we want to update the UI to match the URL
|
|
597
|
+
window.addEventListener('popstate', this.boundNavigationHandler);
|
|
598
|
+
}
|
|
599
|
+
historyNavigationHandler() {
|
|
600
|
+
this.historyPopOccurred = true;
|
|
601
|
+
this.restoreState();
|
|
602
|
+
}
|
|
603
|
+
restoreState() {
|
|
604
|
+
var _a, _b, _c, _d, _e, _f;
|
|
605
|
+
const restorationState = this.restorationStateHandler.getRestorationState();
|
|
606
|
+
this.displayMode = restorationState.displayMode;
|
|
607
|
+
if (restorationState.searchType != null)
|
|
608
|
+
this.searchType = restorationState.searchType;
|
|
609
|
+
this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.relevance;
|
|
610
|
+
this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
|
|
611
|
+
this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
|
|
612
|
+
this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
|
|
613
|
+
this.selectedFacets = restorationState.selectedFacets;
|
|
614
|
+
this.baseQuery = restorationState.baseQuery;
|
|
615
|
+
this.titleQuery = restorationState.titleQuery;
|
|
616
|
+
this.creatorQuery = restorationState.creatorQuery;
|
|
617
|
+
this.dateRangeQueryClause = restorationState.dateRangeQueryClause;
|
|
618
|
+
this.sortParam = (_e = restorationState.sortParam) !== null && _e !== void 0 ? _e : null;
|
|
619
|
+
this.currentPage = (_f = restorationState.currentPage) !== null && _f !== void 0 ? _f : 1;
|
|
620
|
+
this.minSelectedDate = restorationState.minSelectedDate;
|
|
621
|
+
this.maxSelectedDate = restorationState.maxSelectedDate;
|
|
622
|
+
if (this.currentPage > 1) {
|
|
623
|
+
this.goToPage(this.currentPage);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
persistState() {
|
|
627
|
+
var _a, _b, _c, _d, _e;
|
|
628
|
+
const restorationState = {
|
|
629
|
+
displayMode: this.displayMode,
|
|
630
|
+
searchType: this.searchType,
|
|
631
|
+
sortParam: (_a = this.sortParam) !== null && _a !== void 0 ? _a : undefined,
|
|
632
|
+
selectedSort: this.selectedSort,
|
|
633
|
+
sortDirection: (_b = this.sortDirection) !== null && _b !== void 0 ? _b : undefined,
|
|
634
|
+
selectedFacets: (_c = this.selectedFacets) !== null && _c !== void 0 ? _c : defaultSelectedFacets,
|
|
635
|
+
baseQuery: this.baseQuery,
|
|
636
|
+
currentPage: this.currentPage,
|
|
637
|
+
dateRangeQueryClause: this.dateRangeQueryClause,
|
|
638
|
+
titleQuery: this.titleQuery,
|
|
639
|
+
creatorQuery: this.creatorQuery,
|
|
640
|
+
minSelectedDate: this.minSelectedDate,
|
|
641
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
642
|
+
selectedTitleFilter: (_d = this.selectedTitleFilter) !== null && _d !== void 0 ? _d : undefined,
|
|
643
|
+
selectedCreatorFilter: (_e = this.selectedCreatorFilter) !== null && _e !== void 0 ? _e : undefined,
|
|
644
|
+
};
|
|
645
|
+
this.restorationStateHandler.persistState(restorationState);
|
|
646
|
+
}
|
|
647
|
+
async doInitialPageFetch() {
|
|
648
|
+
this.searchResultsLoading = true;
|
|
649
|
+
await this.fetchPage(this.initialPageNumber);
|
|
650
|
+
this.searchResultsLoading = false;
|
|
651
|
+
}
|
|
652
|
+
/** The full query, including year facets and date range clauses */
|
|
653
|
+
get fullQuery() {
|
|
654
|
+
if (!this.baseQuery)
|
|
655
|
+
return undefined;
|
|
656
|
+
let fullQuery = this.baseQuery;
|
|
657
|
+
const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;
|
|
658
|
+
if (facetQuery) {
|
|
659
|
+
fullQuery += ` AND ${facetQuery}`;
|
|
660
|
+
}
|
|
661
|
+
if (dateRangeQueryClause) {
|
|
662
|
+
fullQuery += ` AND ${dateRangeQueryClause}`;
|
|
663
|
+
}
|
|
664
|
+
if (sortFilterQueries) {
|
|
665
|
+
fullQuery += ` AND ${sortFilterQueries}`;
|
|
666
|
+
}
|
|
667
|
+
return fullQuery;
|
|
668
|
+
}
|
|
669
|
+
/** The full query without any year facets or date range clauses */
|
|
670
|
+
get fullQueryWithoutDates() {
|
|
671
|
+
if (!this.baseQuery)
|
|
672
|
+
return undefined;
|
|
673
|
+
let fullQuery = this.baseQuery;
|
|
674
|
+
const { facetQueryWithoutYear, sortFilterQueries } = this;
|
|
675
|
+
if (facetQueryWithoutYear) {
|
|
676
|
+
fullQuery += ` AND ${facetQueryWithoutYear}`;
|
|
677
|
+
}
|
|
678
|
+
if (sortFilterQueries) {
|
|
679
|
+
fullQuery += ` AND ${sortFilterQueries}`;
|
|
680
|
+
}
|
|
681
|
+
return fullQuery;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Generates a query string for the given facets
|
|
685
|
+
*
|
|
686
|
+
* Example: `mediatype:("collection" OR "audio" OR -"etree") AND year:("2000" OR "2001")`
|
|
687
|
+
*/
|
|
688
|
+
get facetQuery() {
|
|
689
|
+
if (!this.selectedFacets)
|
|
690
|
+
return undefined;
|
|
691
|
+
const facetClauses = [];
|
|
692
|
+
for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
|
|
693
|
+
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
694
|
+
}
|
|
695
|
+
return this.joinFacetClauses(facetClauses);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Generates a query string for the currently selected facets, excluding 'year' facets.
|
|
699
|
+
*
|
|
700
|
+
* Example: `mediatype:("collection" OR "audio" OR -"etree") AND subject:("foo" OR -"bar")`
|
|
701
|
+
*/
|
|
702
|
+
get facetQueryWithoutYear() {
|
|
703
|
+
if (!this.selectedFacets)
|
|
704
|
+
return undefined;
|
|
705
|
+
const facetClauses = [];
|
|
706
|
+
for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
|
|
707
|
+
if (facetName !== 'year') {
|
|
708
|
+
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return this.joinFacetClauses(facetClauses);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Builds an OR-joined facet clause for the given facet name and values.
|
|
715
|
+
*
|
|
716
|
+
* E.g., for name `subject` and values
|
|
717
|
+
* `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`
|
|
718
|
+
* this will produce the clause
|
|
719
|
+
* `subject:("foo" OR -"bar")`.
|
|
720
|
+
*
|
|
721
|
+
* @param facetName The facet type (e.g., 'collection')
|
|
722
|
+
* @param facetValues The facet buckets, mapped by their keys
|
|
723
|
+
*/
|
|
724
|
+
buildFacetClause(facetName, facetValues) {
|
|
725
|
+
const facetEntries = Object.entries(facetValues);
|
|
726
|
+
if (facetEntries.length === 0)
|
|
727
|
+
return '';
|
|
728
|
+
const facetQueryName = facetName === 'lending' ? 'lending___status' : facetName;
|
|
729
|
+
const facetValuesArray = [];
|
|
730
|
+
for (const [key, facetData] of facetEntries) {
|
|
731
|
+
const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';
|
|
732
|
+
if (facetName === 'language') {
|
|
733
|
+
const languages = this.languageCodeHandler.getCodeArrayFromCodeString(key);
|
|
734
|
+
for (const language of languages) {
|
|
735
|
+
facetValuesArray.push(`${plusMinusPrefix}"${language}"`);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
facetValuesArray.push(`${plusMinusPrefix}"${key}"`);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
const valueQuery = facetValuesArray.join(` OR `);
|
|
743
|
+
return `${facetQueryName}:(${valueQuery})`;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Takes an array of facet clauses, and combines them into a
|
|
747
|
+
* full AND-joined facet query string. Empty clauses are ignored.
|
|
748
|
+
*/
|
|
749
|
+
joinFacetClauses(facetClauses) {
|
|
750
|
+
const nonEmptyFacetClauses = facetClauses.filter(clause => clause.length > 0);
|
|
751
|
+
return nonEmptyFacetClauses.length > 0
|
|
752
|
+
? `(${nonEmptyFacetClauses.join(' AND ')})`
|
|
753
|
+
: undefined;
|
|
754
|
+
}
|
|
755
|
+
facetsChanged(e) {
|
|
756
|
+
this.selectedFacets = e.detail;
|
|
757
|
+
}
|
|
758
|
+
facetClickHandler(name, facetSelected, negative) {
|
|
759
|
+
var _a, _b;
|
|
760
|
+
if (negative) {
|
|
761
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
762
|
+
category: this.searchContext,
|
|
763
|
+
action: facetSelected
|
|
764
|
+
? analyticsActions.facetNegativeSelected
|
|
765
|
+
: analyticsActions.facetNegativeDeselected,
|
|
766
|
+
label: name,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
771
|
+
category: this.searchContext,
|
|
772
|
+
action: facetSelected
|
|
773
|
+
? analyticsActions.facetSelected
|
|
774
|
+
: analyticsActions.facetDeselected,
|
|
775
|
+
label: name,
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
async fetchFacets() {
|
|
780
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
781
|
+
if (!this.fullQuery)
|
|
782
|
+
return;
|
|
783
|
+
const params = {
|
|
784
|
+
query: this.fullQuery,
|
|
785
|
+
rows: 0,
|
|
786
|
+
// Fetch a few extra buckets beyond the 6 we show, in case some get suppressed
|
|
787
|
+
aggregationsSize: 10,
|
|
788
|
+
// Note: we don't need an aggregations param to fetch the default aggregations from the PPS.
|
|
789
|
+
// The default aggregations for the search_results page type should be what we need here.
|
|
790
|
+
};
|
|
791
|
+
this.facetsLoading = true;
|
|
792
|
+
this.previousSearchType = this.searchType;
|
|
793
|
+
const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params, this.searchType));
|
|
794
|
+
this.facetsLoading = false;
|
|
795
|
+
this.aggregations = (_b = results === null || results === void 0 ? void 0 : results.success) === null || _b === void 0 ? void 0 : _b.response.aggregations;
|
|
796
|
+
// If we're not fetching year histogram data separately, set it from the newly-fetched aggregations
|
|
797
|
+
if (!this.shouldRequestYearHistogram) {
|
|
798
|
+
this.fullYearsHistogramAggregation =
|
|
799
|
+
(_f = (_e = (_d = (_c = results === null || results === void 0 ? void 0 : results.success) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.aggregations) === null || _e === void 0 ? void 0 : _e.year_histogram) !== null && _f !== void 0 ? _f : (_j = (_h = (_g = results === null || results === void 0 ? void 0 : results.success) === null || _g === void 0 ? void 0 : _g.response) === null || _h === void 0 ? void 0 : _h.aggregations) === null || _j === void 0 ? void 0 : _j['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* The query key is a string that uniquely identifies the current query
|
|
804
|
+
* without the date range.
|
|
805
|
+
*
|
|
806
|
+
* If this doesn't change, we don't need to re-fetch the histogram date range
|
|
807
|
+
*/
|
|
808
|
+
get fullQueryNoDateKey() {
|
|
809
|
+
var _a, _b;
|
|
810
|
+
return `${this.fullQueryWithoutDates}-${this.searchType}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* This method is similar to fetching the facets above,
|
|
814
|
+
* but only fetching the year histogram. There is a subtle difference
|
|
815
|
+
* in how you have to fetch the year histogram where you can't use the
|
|
816
|
+
* advanced JSON syntax like the other aggregations. It's a special
|
|
817
|
+
* case that @ximm put it place.
|
|
818
|
+
*/
|
|
819
|
+
async fetchFullYearHistogram() {
|
|
820
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
821
|
+
const { fullQueryNoDateKey } = this;
|
|
822
|
+
if (!this.fullQueryWithoutDates ||
|
|
823
|
+
fullQueryNoDateKey === this.previousFullQueryNoDate) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
this.previousFullQueryNoDate = fullQueryNoDateKey;
|
|
827
|
+
const aggregations = {
|
|
828
|
+
simpleParams: ['year'],
|
|
829
|
+
};
|
|
830
|
+
const params = {
|
|
831
|
+
query: this.fullQueryWithoutDates,
|
|
832
|
+
aggregations,
|
|
833
|
+
rows: 0,
|
|
834
|
+
};
|
|
835
|
+
this.fullYearAggregationLoading = true;
|
|
836
|
+
const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params, this.searchType));
|
|
837
|
+
this.fullYearAggregationLoading = false;
|
|
838
|
+
this.fullYearsHistogramAggregation =
|
|
839
|
+
(_e = (_d = (_c = (_b = results === null || results === void 0 ? void 0 : results.success) === null || _b === void 0 ? void 0 : _b.response) === null || _c === void 0 ? void 0 : _c.aggregations) === null || _d === void 0 ? void 0 : _d.year_histogram) !== null && _e !== void 0 ? _e : (_h = (_g = (_f = results === null || results === void 0 ? void 0 : results.success) === null || _f === void 0 ? void 0 : _f.response) === null || _g === void 0 ? void 0 : _g.aggregations) === null || _h === void 0 ? void 0 : _h['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* We only want to send a separate request for the year_histogram data
|
|
843
|
+
* if (a) the date picker component is enabled and (b) there is a year facet or date-range filter applied.
|
|
844
|
+
*
|
|
845
|
+
* Otherwise, we should just be using the histogram data supplied by the "normal" facet request.
|
|
846
|
+
*/
|
|
847
|
+
get shouldRequestYearHistogram() {
|
|
848
|
+
var _a, _b;
|
|
849
|
+
const datePickerEnabled = this.showHistogramDatePicker;
|
|
850
|
+
const hasDateRange = !!this.dateRangeQueryClause;
|
|
851
|
+
const hasYearFacet = Object.keys((_b = (_a = this.selectedFacets) === null || _a === void 0 ? void 0 : _a.year) !== null && _b !== void 0 ? _b : {}).length > 0;
|
|
852
|
+
return datePickerEnabled && (hasDateRange || hasYearFacet);
|
|
853
|
+
}
|
|
854
|
+
scrollToPage(pageNumber) {
|
|
855
|
+
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
856
|
+
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
857
|
+
// then scrolls to the cell
|
|
858
|
+
setTimeout(() => {
|
|
859
|
+
this.isScrollingToCell = true;
|
|
860
|
+
this.infiniteScroller.scrollToCell(cellIndexToScrollTo, true);
|
|
861
|
+
// This timeout is to give the scroll animation time to finish
|
|
862
|
+
// then updating the infinite scroller once we're done scrolling
|
|
863
|
+
// There's no scroll animation completion callback so we're
|
|
864
|
+
// giving it 0.5s to finish.
|
|
865
|
+
setTimeout(() => {
|
|
866
|
+
this.isScrollingToCell = false;
|
|
867
|
+
this.infiniteScroller.reload();
|
|
868
|
+
}, 500);
|
|
869
|
+
}, 0);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* The query key is a string that uniquely identifies the current query
|
|
873
|
+
*
|
|
874
|
+
* This lets us keep track of queries so we don't persist data that's
|
|
875
|
+
* no longer relevant.
|
|
876
|
+
*/
|
|
877
|
+
get pageFetchQueryKey() {
|
|
878
|
+
var _a, _b;
|
|
879
|
+
return `${this.fullQuery}-${this.searchType}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
|
|
880
|
+
}
|
|
881
|
+
async fetchPage(pageNumber) {
|
|
882
|
+
var _a, _b, _c, _d, _e;
|
|
883
|
+
if (!this.fullQuery)
|
|
884
|
+
return;
|
|
885
|
+
// if we already have data, don't fetch again
|
|
886
|
+
if (this.dataSource[pageNumber])
|
|
887
|
+
return;
|
|
888
|
+
if (this.endOfDataReached)
|
|
889
|
+
return;
|
|
890
|
+
// if a fetch is already in progress for this query and page, don't fetch again
|
|
891
|
+
const { pageFetchQueryKey } = this;
|
|
892
|
+
const pageFetches = (_a = this.pageFetchesInProgress[pageFetchQueryKey]) !== null && _a !== void 0 ? _a : new Set();
|
|
893
|
+
if (pageFetches.has(pageNumber))
|
|
894
|
+
return;
|
|
895
|
+
pageFetches.add(pageNumber);
|
|
896
|
+
this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;
|
|
897
|
+
const sortParams = this.sortParam ? [this.sortParam] : [];
|
|
898
|
+
const params = {
|
|
899
|
+
query: this.fullQuery,
|
|
900
|
+
page: pageNumber,
|
|
901
|
+
rows: this.pageSize,
|
|
902
|
+
sort: sortParams,
|
|
903
|
+
aggregations: { omit: true },
|
|
904
|
+
};
|
|
905
|
+
const searchResponse = await ((_b = this.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.searchType));
|
|
906
|
+
const success = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success;
|
|
907
|
+
if (!success)
|
|
908
|
+
return;
|
|
909
|
+
this.totalResults = success.response.totalResults;
|
|
910
|
+
// this is checking to see if the query has changed since the data was fetched
|
|
911
|
+
// if so, we just want to discard the data since there should be a new query
|
|
912
|
+
// right behind it
|
|
913
|
+
const searchQuery = success.request.clientParameters.user_query;
|
|
914
|
+
const searchSort = success.request.clientParameters.sort;
|
|
915
|
+
let sortChanged = false;
|
|
916
|
+
if (!searchSort || searchSort.length === 0) {
|
|
917
|
+
// if we went from no sort to sort, the sort has changed
|
|
918
|
+
if (this.sortParam) {
|
|
919
|
+
sortChanged = true;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
else {
|
|
923
|
+
// check if the sort has changed
|
|
924
|
+
for (const sortType of searchSort) {
|
|
925
|
+
const [field, direction] = sortType.split(':');
|
|
926
|
+
if (field !== ((_c = this.sortParam) === null || _c === void 0 ? void 0 : _c.field) ||
|
|
927
|
+
direction !== ((_d = this.sortParam) === null || _d === void 0 ? void 0 : _d.direction)) {
|
|
928
|
+
sortChanged = true;
|
|
929
|
+
break;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
const queryChangedSinceFetch = searchQuery !== this.fullQuery || sortChanged;
|
|
934
|
+
if (queryChangedSinceFetch)
|
|
935
|
+
return;
|
|
936
|
+
const { results } = success.response;
|
|
937
|
+
if (results && results.length > 0) {
|
|
938
|
+
this.preloadCollectionNames(results);
|
|
939
|
+
this.updateDataSource(pageNumber, results);
|
|
940
|
+
}
|
|
941
|
+
if (results.length < this.pageSize) {
|
|
942
|
+
this.endOfDataReached = true;
|
|
943
|
+
// this updates the infinite scroller to show the actual size
|
|
944
|
+
if (this.infiniteScroller) {
|
|
945
|
+
this.infiniteScroller.itemCount = this.actualTileCount;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
(_e = this.pageFetchesInProgress[pageFetchQueryKey]) === null || _e === void 0 ? void 0 : _e.delete(pageNumber);
|
|
949
|
+
this.searchResultsLoading = false;
|
|
950
|
+
}
|
|
951
|
+
preloadCollectionNames(results) {
|
|
952
|
+
var _a;
|
|
953
|
+
const collectionIds = results
|
|
954
|
+
.map(result => { var _a; return (_a = result.collection) === null || _a === void 0 ? void 0 : _a.values; })
|
|
955
|
+
.flat();
|
|
956
|
+
const collectionIdsArray = Array.from(new Set(collectionIds));
|
|
957
|
+
(_a = this.collectionNameCache) === null || _a === void 0 ? void 0 : _a.preloadIdentifiers(collectionIdsArray);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* This is useful for determining whether we need to reload the scroller.
|
|
961
|
+
*
|
|
962
|
+
* When the fetch completes, we need to reload the scroller if the cells for that
|
|
963
|
+
* page are visible, but if the page is not currenlty visible, we don't need to reload
|
|
964
|
+
*/
|
|
965
|
+
get currentVisiblePageNumbers() {
|
|
966
|
+
var _a, _b;
|
|
967
|
+
const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
|
|
968
|
+
const visiblePages = new Set();
|
|
969
|
+
visibleCells.forEach(cellIndex => {
|
|
970
|
+
const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
|
|
971
|
+
visiblePages.add(visiblePage);
|
|
972
|
+
});
|
|
973
|
+
return Array.from(visiblePages);
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Update the datasource from the fetch response
|
|
977
|
+
*
|
|
978
|
+
* @param pageNumber
|
|
979
|
+
* @param results
|
|
980
|
+
*/
|
|
981
|
+
updateDataSource(pageNumber, results) {
|
|
982
|
+
// copy our existing datasource so when we set it below, it gets set
|
|
983
|
+
// instead of modifying the existing dataSource since object changes
|
|
984
|
+
// don't trigger a re-render
|
|
985
|
+
const datasource = { ...this.dataSource };
|
|
986
|
+
const tiles = [];
|
|
987
|
+
results === null || results === void 0 ? void 0 : results.forEach(result => {
|
|
988
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
989
|
+
if (!result.identifier)
|
|
990
|
+
return;
|
|
991
|
+
let loginRequired = false;
|
|
992
|
+
let contentWarning = false;
|
|
993
|
+
// Check if item and item in "modifying" collection, setting above flags
|
|
994
|
+
if (((_a = result.collection) === null || _a === void 0 ? void 0 : _a.values.length) &&
|
|
995
|
+
((_b = result.mediatype) === null || _b === void 0 ? void 0 : _b.value) !== 'collection') {
|
|
996
|
+
for (const collection of (_d = (_c = result.collection) === null || _c === void 0 ? void 0 : _c.values) !== null && _d !== void 0 ? _d : []) {
|
|
997
|
+
if (collection === 'loggedin') {
|
|
998
|
+
loginRequired = true;
|
|
999
|
+
if (contentWarning)
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
if (collection === 'no-preview') {
|
|
1003
|
+
contentWarning = true;
|
|
1004
|
+
if (loginRequired)
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
tiles.push({
|
|
1010
|
+
averageRating: (_e = result.avg_rating) === null || _e === void 0 ? void 0 : _e.value,
|
|
1011
|
+
collections: (_g = (_f = result.collection) === null || _f === void 0 ? void 0 : _f.values) !== null && _g !== void 0 ? _g : [],
|
|
1012
|
+
commentCount: (_j = (_h = result.num_reviews) === null || _h === void 0 ? void 0 : _h.value) !== null && _j !== void 0 ? _j : 0,
|
|
1013
|
+
creator: (_k = result.creator) === null || _k === void 0 ? void 0 : _k.value,
|
|
1014
|
+
creators: (_m = (_l = result.creator) === null || _l === void 0 ? void 0 : _l.values) !== null && _m !== void 0 ? _m : [],
|
|
1015
|
+
dateAdded: (_o = result.addeddate) === null || _o === void 0 ? void 0 : _o.value,
|
|
1016
|
+
dateArchived: (_p = result.publicdate) === null || _p === void 0 ? void 0 : _p.value,
|
|
1017
|
+
datePublished: (_q = result.date) === null || _q === void 0 ? void 0 : _q.value,
|
|
1018
|
+
dateReviewed: (_r = result.reviewdate) === null || _r === void 0 ? void 0 : _r.value,
|
|
1019
|
+
description: (_s = result.description) === null || _s === void 0 ? void 0 : _s.values.join('\n'),
|
|
1020
|
+
favCount: (_u = (_t = result.num_favorites) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : 0,
|
|
1021
|
+
identifier: result.identifier,
|
|
1022
|
+
issue: (_v = result.issue) === null || _v === void 0 ? void 0 : _v.value,
|
|
1023
|
+
itemCount: (_x = (_w = result.item_count) === null || _w === void 0 ? void 0 : _w.value) !== null && _x !== void 0 ? _x : 0,
|
|
1024
|
+
mediatype: (_z = (_y = result.mediatype) === null || _y === void 0 ? void 0 : _y.value) !== null && _z !== void 0 ? _z : 'data',
|
|
1025
|
+
snippets: (_1 = (_0 = result.highlight) === null || _0 === void 0 ? void 0 : _0.values) !== null && _1 !== void 0 ? _1 : [],
|
|
1026
|
+
source: (_2 = result.source) === null || _2 === void 0 ? void 0 : _2.value,
|
|
1027
|
+
subjects: (_4 = (_3 = result.subject) === null || _3 === void 0 ? void 0 : _3.values) !== null && _4 !== void 0 ? _4 : [],
|
|
1028
|
+
title: this.etreeTitle((_5 = result.title) === null || _5 === void 0 ? void 0 : _5.value, (_6 = result.mediatype) === null || _6 === void 0 ? void 0 : _6.value, (_7 = result.collection) === null || _7 === void 0 ? void 0 : _7.values),
|
|
1029
|
+
volume: (_8 = result.volume) === null || _8 === void 0 ? void 0 : _8.value,
|
|
1030
|
+
viewCount: (_10 = (_9 = result.downloads) === null || _9 === void 0 ? void 0 : _9.value) !== null && _10 !== void 0 ? _10 : 0,
|
|
1031
|
+
weeklyViewCount: (_11 = result.week) === null || _11 === void 0 ? void 0 : _11.value,
|
|
1032
|
+
loginRequired,
|
|
1033
|
+
contentWarning,
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
datasource[pageNumber] = tiles;
|
|
1037
|
+
this.dataSource = datasource;
|
|
1038
|
+
const visiblePages = this.currentVisiblePageNumbers;
|
|
1039
|
+
const needsReload = visiblePages.includes(pageNumber);
|
|
1040
|
+
if (needsReload) {
|
|
1041
|
+
this.infiniteScroller.reload();
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
/*
|
|
1045
|
+
* Convert etree titles
|
|
1046
|
+
* "[Creator] Live at [Place] on [Date]" => "[Date]: [Place]"
|
|
1047
|
+
*
|
|
1048
|
+
* Todo: Check collection(s) for etree, need to get as array.
|
|
1049
|
+
* Current search-service only returns first collection as string.
|
|
1050
|
+
*/
|
|
1051
|
+
etreeTitle(title, mediatype, collections) {
|
|
1052
|
+
if (mediatype === 'etree' || (collections === null || collections === void 0 ? void 0 : collections.includes('etree'))) {
|
|
1053
|
+
const regex = /^(.*) Live at (.*) on (\d\d\d\d-\d\d-\d\d)$/;
|
|
1054
|
+
const newTitle = title === null || title === void 0 ? void 0 : title.replace(regex, '$3: $2');
|
|
1055
|
+
if (newTitle) {
|
|
1056
|
+
return `${newTitle}`;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
return title !== null && title !== void 0 ? title : '';
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Callback when a result is selected
|
|
1063
|
+
*/
|
|
1064
|
+
resultSelected(event) {
|
|
1065
|
+
var _a, _b;
|
|
1066
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
1067
|
+
category: this.searchContext,
|
|
1068
|
+
action: analyticsActions.resultSelected,
|
|
1069
|
+
label: event.detail.mediatype,
|
|
1070
|
+
});
|
|
1071
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
1072
|
+
category: this.searchContext,
|
|
1073
|
+
action: analyticsActions.resultSelected,
|
|
1074
|
+
label: `page-${this.currentPage}`,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
cellForIndex(index) {
|
|
1078
|
+
const model = this.tileModelAtCellIndex(index);
|
|
1079
|
+
if (!model)
|
|
1080
|
+
return undefined;
|
|
1007
1081
|
return html `
|
|
1008
1082
|
<tile-dispatcher
|
|
1009
1083
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
@@ -1018,17 +1092,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1018
1092
|
@resultSelected=${(e) => this.resultSelected(e)}
|
|
1019
1093
|
>
|
|
1020
1094
|
</tile-dispatcher>
|
|
1021
|
-
`;
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1025
|
-
* increase the number of pages to render and start fetching data for the new page
|
|
1026
|
-
*/
|
|
1027
|
-
scrollThresholdReached() {
|
|
1028
|
-
this.pagesToRender += 1;
|
|
1029
|
-
this.fetchPage(this.pagesToRender);
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1095
|
+
`;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1099
|
+
* increase the number of pages to render and start fetching data for the new page
|
|
1100
|
+
*/
|
|
1101
|
+
scrollThresholdReached() {
|
|
1102
|
+
this.pagesToRender += 1;
|
|
1103
|
+
this.fetchPage(this.pagesToRender);
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1032
1106
|
CollectionBrowser.styles = css `
|
|
1033
1107
|
:host {
|
|
1034
1108
|
display: block;
|
|
@@ -1234,138 +1308,138 @@ CollectionBrowser.styles = css `
|
|
|
1234
1308
|
29rem
|
|
1235
1309
|
);
|
|
1236
1310
|
}
|
|
1237
|
-
`;
|
|
1238
|
-
__decorate([
|
|
1239
|
-
property({ type: String })
|
|
1240
|
-
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1241
|
-
__decorate([
|
|
1242
|
-
property({ type: String })
|
|
1243
|
-
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1244
|
-
__decorate([
|
|
1245
|
-
property({ type: Object })
|
|
1246
|
-
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1247
|
-
__decorate([
|
|
1248
|
-
property({ type: String })
|
|
1249
|
-
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1250
|
-
__decorate([
|
|
1251
|
-
property({ type: String })
|
|
1252
|
-
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1253
|
-
__decorate([
|
|
1254
|
-
property({ type: String })
|
|
1255
|
-
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1256
|
-
__decorate([
|
|
1257
|
-
property({ type: Object })
|
|
1258
|
-
], CollectionBrowser.prototype, "sortParam", void 0);
|
|
1259
|
-
__decorate([
|
|
1260
|
-
property({ type: String })
|
|
1261
|
-
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1262
|
-
__decorate([
|
|
1263
|
-
property({ type: String })
|
|
1264
|
-
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1265
|
-
__decorate([
|
|
1266
|
-
property({ type: String })
|
|
1267
|
-
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1268
|
-
__decorate([
|
|
1269
|
-
property({ type: String })
|
|
1270
|
-
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1271
|
-
__decorate([
|
|
1272
|
-
property({ type: String })
|
|
1273
|
-
], CollectionBrowser.prototype, "dateRangeQueryClause", void 0);
|
|
1274
|
-
__decorate([
|
|
1275
|
-
property({ type: Number })
|
|
1276
|
-
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
1277
|
-
__decorate([
|
|
1278
|
-
property({ type: Object })
|
|
1279
|
-
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
1280
|
-
__decorate([
|
|
1281
|
-
property({ type: String })
|
|
1282
|
-
], CollectionBrowser.prototype, "titleQuery", void 0);
|
|
1283
|
-
__decorate([
|
|
1284
|
-
property({ type: String })
|
|
1285
|
-
], CollectionBrowser.prototype, "creatorQuery", void 0);
|
|
1286
|
-
__decorate([
|
|
1287
|
-
property({ type: Number })
|
|
1288
|
-
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
1289
|
-
__decorate([
|
|
1290
|
-
property({ type: String })
|
|
1291
|
-
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
1292
|
-
__decorate([
|
|
1293
|
-
property({ type: String })
|
|
1294
|
-
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
1295
|
-
__decorate([
|
|
1296
|
-
property({ type: Object })
|
|
1297
|
-
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
1298
|
-
__decorate([
|
|
1299
|
-
property({ type: Boolean })
|
|
1300
|
-
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
1301
|
-
__decorate([
|
|
1302
|
-
property({ type: String, reflect: true })
|
|
1303
|
-
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
1304
|
-
__decorate([
|
|
1305
|
-
property({ type: Object })
|
|
1306
|
-
], CollectionBrowser.prototype, "collectionNameCache", void 0);
|
|
1307
|
-
__decorate([
|
|
1308
|
-
property({ type: String })
|
|
1309
|
-
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
1310
|
-
__decorate([
|
|
1311
|
-
property({ type: Object })
|
|
1312
|
-
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
1313
|
-
__decorate([
|
|
1314
|
-
property({ type: Number })
|
|
1315
|
-
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
1316
|
-
__decorate([
|
|
1317
|
-
property({ type: Boolean })
|
|
1318
|
-
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
1319
|
-
__decorate([
|
|
1320
|
-
property({ type: Object })
|
|
1321
|
-
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
1322
|
-
__decorate([
|
|
1323
|
-
property({ type: Boolean })
|
|
1324
|
-
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
1325
|
-
__decorate([
|
|
1326
|
-
state()
|
|
1327
|
-
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
1328
|
-
__decorate([
|
|
1329
|
-
state()
|
|
1330
|
-
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
1331
|
-
__decorate([
|
|
1332
|
-
state()
|
|
1333
|
-
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
1334
|
-
__decorate([
|
|
1335
|
-
state()
|
|
1336
|
-
], CollectionBrowser.prototype, "fullYearAggregationLoading", void 0);
|
|
1337
|
-
__decorate([
|
|
1338
|
-
state()
|
|
1339
|
-
], CollectionBrowser.prototype, "aggregations", void 0);
|
|
1340
|
-
__decorate([
|
|
1341
|
-
state()
|
|
1342
|
-
], CollectionBrowser.prototype, "fullYearsHistogramAggregation", void 0);
|
|
1343
|
-
__decorate([
|
|
1344
|
-
state()
|
|
1345
|
-
], CollectionBrowser.prototype, "previousSearchType", void 0);
|
|
1346
|
-
__decorate([
|
|
1347
|
-
state()
|
|
1348
|
-
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
1349
|
-
__decorate([
|
|
1350
|
-
state()
|
|
1351
|
-
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
1352
|
-
__decorate([
|
|
1353
|
-
state()
|
|
1354
|
-
], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
|
|
1355
|
-
__decorate([
|
|
1356
|
-
state()
|
|
1357
|
-
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
1358
|
-
__decorate([
|
|
1359
|
-
query('#content-container')
|
|
1360
|
-
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
1361
|
-
__decorate([
|
|
1362
|
-
property({ type: Object, attribute: false })
|
|
1363
|
-
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
1364
|
-
__decorate([
|
|
1365
|
-
query('infinite-scroller')
|
|
1366
|
-
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
1367
|
-
CollectionBrowser = __decorate([
|
|
1368
|
-
customElement('collection-browser')
|
|
1369
|
-
], CollectionBrowser);
|
|
1370
|
-
export { CollectionBrowser };
|
|
1311
|
+
`;
|
|
1312
|
+
__decorate([
|
|
1313
|
+
property({ type: String })
|
|
1314
|
+
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1315
|
+
__decorate([
|
|
1316
|
+
property({ type: String })
|
|
1317
|
+
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1318
|
+
__decorate([
|
|
1319
|
+
property({ type: Object })
|
|
1320
|
+
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1321
|
+
__decorate([
|
|
1322
|
+
property({ type: String })
|
|
1323
|
+
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1324
|
+
__decorate([
|
|
1325
|
+
property({ type: String })
|
|
1326
|
+
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1327
|
+
__decorate([
|
|
1328
|
+
property({ type: String })
|
|
1329
|
+
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1330
|
+
__decorate([
|
|
1331
|
+
property({ type: Object })
|
|
1332
|
+
], CollectionBrowser.prototype, "sortParam", void 0);
|
|
1333
|
+
__decorate([
|
|
1334
|
+
property({ type: String })
|
|
1335
|
+
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1336
|
+
__decorate([
|
|
1337
|
+
property({ type: String })
|
|
1338
|
+
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1339
|
+
__decorate([
|
|
1340
|
+
property({ type: String })
|
|
1341
|
+
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1342
|
+
__decorate([
|
|
1343
|
+
property({ type: String })
|
|
1344
|
+
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1345
|
+
__decorate([
|
|
1346
|
+
property({ type: String })
|
|
1347
|
+
], CollectionBrowser.prototype, "dateRangeQueryClause", void 0);
|
|
1348
|
+
__decorate([
|
|
1349
|
+
property({ type: Number })
|
|
1350
|
+
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
1351
|
+
__decorate([
|
|
1352
|
+
property({ type: Object })
|
|
1353
|
+
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
1354
|
+
__decorate([
|
|
1355
|
+
property({ type: String })
|
|
1356
|
+
], CollectionBrowser.prototype, "titleQuery", void 0);
|
|
1357
|
+
__decorate([
|
|
1358
|
+
property({ type: String })
|
|
1359
|
+
], CollectionBrowser.prototype, "creatorQuery", void 0);
|
|
1360
|
+
__decorate([
|
|
1361
|
+
property({ type: Number })
|
|
1362
|
+
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
1363
|
+
__decorate([
|
|
1364
|
+
property({ type: String })
|
|
1365
|
+
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
1366
|
+
__decorate([
|
|
1367
|
+
property({ type: String })
|
|
1368
|
+
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
1369
|
+
__decorate([
|
|
1370
|
+
property({ type: Object })
|
|
1371
|
+
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
1372
|
+
__decorate([
|
|
1373
|
+
property({ type: Boolean })
|
|
1374
|
+
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
1375
|
+
__decorate([
|
|
1376
|
+
property({ type: String, reflect: true })
|
|
1377
|
+
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
1378
|
+
__decorate([
|
|
1379
|
+
property({ type: Object })
|
|
1380
|
+
], CollectionBrowser.prototype, "collectionNameCache", void 0);
|
|
1381
|
+
__decorate([
|
|
1382
|
+
property({ type: String })
|
|
1383
|
+
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
1384
|
+
__decorate([
|
|
1385
|
+
property({ type: Object })
|
|
1386
|
+
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
1387
|
+
__decorate([
|
|
1388
|
+
property({ type: Number })
|
|
1389
|
+
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
1390
|
+
__decorate([
|
|
1391
|
+
property({ type: Boolean })
|
|
1392
|
+
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
1393
|
+
__decorate([
|
|
1394
|
+
property({ type: Object })
|
|
1395
|
+
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
1396
|
+
__decorate([
|
|
1397
|
+
property({ type: Boolean })
|
|
1398
|
+
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
1399
|
+
__decorate([
|
|
1400
|
+
state()
|
|
1401
|
+
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
1402
|
+
__decorate([
|
|
1403
|
+
state()
|
|
1404
|
+
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
1405
|
+
__decorate([
|
|
1406
|
+
state()
|
|
1407
|
+
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
1408
|
+
__decorate([
|
|
1409
|
+
state()
|
|
1410
|
+
], CollectionBrowser.prototype, "fullYearAggregationLoading", void 0);
|
|
1411
|
+
__decorate([
|
|
1412
|
+
state()
|
|
1413
|
+
], CollectionBrowser.prototype, "aggregations", void 0);
|
|
1414
|
+
__decorate([
|
|
1415
|
+
state()
|
|
1416
|
+
], CollectionBrowser.prototype, "fullYearsHistogramAggregation", void 0);
|
|
1417
|
+
__decorate([
|
|
1418
|
+
state()
|
|
1419
|
+
], CollectionBrowser.prototype, "previousSearchType", void 0);
|
|
1420
|
+
__decorate([
|
|
1421
|
+
state()
|
|
1422
|
+
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
1423
|
+
__decorate([
|
|
1424
|
+
state()
|
|
1425
|
+
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
1426
|
+
__decorate([
|
|
1427
|
+
state()
|
|
1428
|
+
], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
|
|
1429
|
+
__decorate([
|
|
1430
|
+
state()
|
|
1431
|
+
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
1432
|
+
__decorate([
|
|
1433
|
+
query('#content-container')
|
|
1434
|
+
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
1435
|
+
__decorate([
|
|
1436
|
+
property({ type: Object, attribute: false })
|
|
1437
|
+
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
1438
|
+
__decorate([
|
|
1439
|
+
query('infinite-scroller')
|
|
1440
|
+
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
1441
|
+
CollectionBrowser = __decorate([
|
|
1442
|
+
customElement('collection-browser')
|
|
1443
|
+
], CollectionBrowser);
|
|
1444
|
+
export { CollectionBrowser };
|
|
1371
1445
|
//# sourceMappingURL=collection-browser.js.map
|