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