@internetarchive/collection-browser 0.3.10-alpha.1 → 0.4.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 +48 -48
- package/dist/src/app-root.js +258 -258
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-left.js +2 -2
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-right.js +2 -2
- package/dist/src/assets/img/icons/chevron.d.ts +2 -2
- package/dist/src/assets/img/icons/chevron.js +2 -2
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.js +2 -2
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
- package/dist/src/assets/img/icons/eye-closed.js +2 -2
- package/dist/src/assets/img/icons/eye.d.ts +2 -2
- package/dist/src/assets/img/icons/eye.js +2 -2
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +5 -17
- package/dist/src/assets/img/icons/login-required.js.map +1 -1
- 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 +3 -19
- package/dist/src/assets/img/icons/restricted.js.map +1 -1
- 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 +315 -278
- package/dist/src/collection-browser.js +1275 -1119
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +16 -16
- package/dist/src/collection-facets/facets-template.js +125 -125
- package/dist/src/collection-facets/more-facets-content.d.ts +77 -76
- package/dist/src/collection-facets/more-facets-content.js +357 -353
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- 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 +78 -77
- package/dist/src/collection-facets.js +393 -389
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +11 -11
- package/dist/src/empty-placeholder.js +42 -42
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +112 -103
- package/dist/src/models.js +125 -117
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +45 -46
- package/dist/src/restoration-state-handler.js +230 -230
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +12 -9
- package/dist/src/sort-filter-bar/alpha-bar.js +69 -50
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- 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 +108 -107
- package/dist/src/sort-filter-bar/sort-filter-bar.js +430 -423
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +12 -15
- package/dist/src/styles/item-image-styles.js.map +1 -1
- 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 +89 -87
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
- package/dist/src/tiles/grid/tile-stats.js +40 -40
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +77 -69
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +31 -31
- package/dist/src/tiles/item-image.js +106 -106
- package/dist/src/tiles/list/account-label.d.ts +1 -1
- package/dist/src/tiles/list/account-label.js +6 -6
- package/dist/src/tiles/list/date-label.d.ts +1 -1
- package/dist/src/tiles/list/date-label.js +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
- package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
- package/dist/src/tiles/list/tile-list-compact.js +93 -93
- package/dist/src/tiles/list/tile-list.d.ts +50 -50
- package/dist/src/tiles/list/tile-list.js +276 -276
- 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 +10 -7
- package/dist/src/tiles/overlay/icon-overlay.js +63 -33
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -0
- package/dist/src/tiles/overlay/icon-text-overlay.js +83 -0
- package/dist/src/tiles/overlay/icon-text-overlay.js.map +1 -0
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -8
- package/dist/src/tiles/overlay/text-overlay.js +63 -35
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.d.ts +29 -29
- package/dist/src/tiles/text-snippet-block.js +81 -81
- package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
- package/dist/src/tiles/tile-dispatcher.js +128 -128
- package/dist/src/utils/analytics-events.d.ts +22 -22
- package/dist/src/utils/analytics-events.js +24 -24
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +23 -23
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +647 -575
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +62 -62
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +114 -114
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +544 -544
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +33 -33
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +80 -80
- package/dist/test/item-image.test.js.map +1 -1
- 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 +12 -10
- package/dist/test/mocks/mock-search-responses.js +341 -271
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +40 -36
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +125 -126
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.js +44 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -0
- 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 +145 -113
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -41
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +33 -33
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +107 -107
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +123 -123
- package/dist/test/utils/format-count.test.d.ts +1 -1
- package/dist/test/utils/format-count.test.js +23 -23
- package/dist/test/utils/format-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +3 -3
- package/renovate.json +6 -6
- package/src/app-root.ts +1 -1
- package/src/assets/img/icons/login-required.ts +3 -15
- package/src/assets/img/icons/restricted.ts +1 -17
- package/src/collection-browser.ts +273 -57
- package/src/collection-facets/more-facets-content.ts +6 -2
- package/src/collection-facets.ts +6 -2
- package/src/models.ts +15 -0
- package/src/restoration-state-handler.ts +7 -5
- package/src/sort-filter-bar/alpha-bar.ts +26 -9
- package/src/sort-filter-bar/sort-filter-bar.ts +9 -0
- package/src/styles/item-image-styles.ts +3 -6
- package/src/tiles/grid/item-tile.ts +2 -0
- package/src/tiles/image-block.ts +8 -0
- package/src/tiles/overlay/icon-overlay.ts +33 -3
- package/src/tiles/overlay/icon-text-overlay.ts +75 -0
- package/src/tiles/overlay/text-overlay.ts +34 -7
- package/test/collection-browser.test.ts +90 -10
- package/test/collection-facets/more-facets-content.test.ts +2 -2
- package/test/item-image.test.ts +2 -2
- package/test/mocks/mock-search-responses.ts +78 -0
- package/test/mocks/mock-search-service.ts +6 -0
- package/test/restoration-state-handler.test.ts +0 -3
- package/test/sort-filter-bar/alpha-bar.test.ts +52 -0
- package/test/sort-filter-bar/sort-filter-bar.test.ts +44 -0
- package/test/text-overlay.test.ts +10 -3
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,188 +1,193 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/* eslint-disable import/no-duplicates */
|
|
3
|
-
import { html, css, LitElement, nothing, } from 'lit';
|
|
4
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
-
import { SearchType, } from '@internetarchive/search-service';
|
|
7
|
-
import '@internetarchive/infinite-scroller';
|
|
8
|
-
import './tiles/tile-dispatcher';
|
|
9
|
-
import './tiles/collection-browser-loading-tile';
|
|
10
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
11
|
-
import './collection-facets';
|
|
12
|
-
import './circular-activity-indicator';
|
|
13
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
14
|
-
import { SortField, SortFieldToMetadataField, defaultSelectedFacets, } from './models';
|
|
15
|
-
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
16
|
-
import chevronIcon from './assets/img/icons/chevron';
|
|
17
|
-
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
|
|
18
|
-
import './empty-placeholder';
|
|
19
|
-
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
20
|
-
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.baseImageUrl = 'https://archive.org';
|
|
24
|
-
this.searchType = SearchType.METADATA;
|
|
25
|
-
this.sortParam = null;
|
|
26
|
-
this.selectedSort = SortField.relevance;
|
|
27
|
-
this.selectedTitleFilter = null;
|
|
28
|
-
this.selectedCreatorFilter = null;
|
|
29
|
-
this.sortDirection = null;
|
|
30
|
-
this.pageSize = 50;
|
|
31
|
-
this.showHistogramDatePicker = false;
|
|
32
|
-
/** describes where this component is being used */
|
|
33
|
-
this.searchContext = analyticsCategories.default;
|
|
34
|
-
this.pageContext = 'search';
|
|
35
|
-
this.restorationStateHandler = new RestorationStateHandler({
|
|
36
|
-
context: this.pageContext,
|
|
37
|
-
});
|
|
38
|
-
this.mobileBreakpoint = 600;
|
|
39
|
-
this.loggedIn = false;
|
|
40
|
-
this.modalManager = undefined;
|
|
41
|
-
/**
|
|
42
|
-
* If item management UI active
|
|
43
|
-
*/
|
|
44
|
-
this.isManageView = false;
|
|
45
|
-
/**
|
|
46
|
-
* The page that the consumer wants to load.
|
|
47
|
-
*/
|
|
48
|
-
this.initialPageNumber = 1;
|
|
49
|
-
/**
|
|
50
|
-
* This the the number of pages that we want to show.
|
|
51
|
-
*
|
|
52
|
-
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
53
|
-
* know how many cells we should render.
|
|
54
|
-
*/
|
|
55
|
-
this.pagesToRender = this.initialPageNumber;
|
|
56
|
-
this.searchResultsLoading = false;
|
|
57
|
-
this.facetsLoading = false;
|
|
58
|
-
this.fullYearAggregationLoading = false;
|
|
59
|
-
this.mobileView = false;
|
|
60
|
-
this.mobileFacetsVisible = false;
|
|
61
|
-
this.placeholderType = null;
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
this
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
this
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// the
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
this.
|
|
143
|
-
this.
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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 { FilterConstraint, FilterMapBuilder, 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, prefixFilterAggregationKeys, } from './models';
|
|
15
|
+
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
16
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
17
|
+
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
|
|
18
|
+
import './empty-placeholder';
|
|
19
|
+
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
20
|
+
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.baseImageUrl = 'https://archive.org';
|
|
24
|
+
this.searchType = SearchType.METADATA;
|
|
25
|
+
this.sortParam = null;
|
|
26
|
+
this.selectedSort = SortField.relevance;
|
|
27
|
+
this.selectedTitleFilter = null;
|
|
28
|
+
this.selectedCreatorFilter = null;
|
|
29
|
+
this.sortDirection = null;
|
|
30
|
+
this.pageSize = 50;
|
|
31
|
+
this.showHistogramDatePicker = false;
|
|
32
|
+
/** describes where this component is being used */
|
|
33
|
+
this.searchContext = analyticsCategories.default;
|
|
34
|
+
this.pageContext = 'search';
|
|
35
|
+
this.restorationStateHandler = new RestorationStateHandler({
|
|
36
|
+
context: this.pageContext,
|
|
37
|
+
});
|
|
38
|
+
this.mobileBreakpoint = 600;
|
|
39
|
+
this.loggedIn = false;
|
|
40
|
+
this.modalManager = undefined;
|
|
41
|
+
/**
|
|
42
|
+
* If item management UI active
|
|
43
|
+
*/
|
|
44
|
+
this.isManageView = false;
|
|
45
|
+
/**
|
|
46
|
+
* The page that the consumer wants to load.
|
|
47
|
+
*/
|
|
48
|
+
this.initialPageNumber = 1;
|
|
49
|
+
/**
|
|
50
|
+
* This the the number of pages that we want to show.
|
|
51
|
+
*
|
|
52
|
+
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
53
|
+
* know how many cells we should render.
|
|
54
|
+
*/
|
|
55
|
+
this.pagesToRender = this.initialPageNumber;
|
|
56
|
+
this.searchResultsLoading = false;
|
|
57
|
+
this.facetsLoading = false;
|
|
58
|
+
this.fullYearAggregationLoading = false;
|
|
59
|
+
this.mobileView = false;
|
|
60
|
+
this.mobileFacetsVisible = false;
|
|
61
|
+
this.placeholderType = null;
|
|
62
|
+
this.prefixFilterCountMap = {};
|
|
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
|
+
/**
|
|
149
|
+
* Manually requests to perform a search, which will only be executed if one of
|
|
150
|
+
* the query, the search type, or the sort has changed.
|
|
151
|
+
*/
|
|
152
|
+
requestSearch() {
|
|
153
|
+
this.handleQueryChange();
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
this.setPlaceholderType();
|
|
156
157
|
return html `
|
|
157
158
|
<div
|
|
158
159
|
id="content-container"
|
|
159
160
|
class=${this.mobileView ? 'mobile' : 'desktop'}
|
|
160
161
|
>
|
|
161
|
-
${this.placeholderType
|
|
162
|
-
? this.emptyPlaceholderTemplate
|
|
162
|
+
${this.placeholderType
|
|
163
|
+
? this.emptyPlaceholderTemplate
|
|
163
164
|
: this.collectionBrowserTemplate}
|
|
164
165
|
</div>
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
167
|
-
setPlaceholderType() {
|
|
168
|
-
this.placeholderType = null;
|
|
169
|
-
if (!this.baseQuery) {
|
|
170
|
-
this.placeholderType = 'empty-query';
|
|
171
|
-
}
|
|
172
|
-
if ((!this.searchResultsLoading && this.totalResults === 0) ||
|
|
173
|
-
!this.searchService) {
|
|
174
|
-
this.placeholderType = 'null-result';
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
get emptyPlaceholderTemplate() {
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
setPlaceholderType() {
|
|
169
|
+
this.placeholderType = null;
|
|
170
|
+
if (!this.baseQuery) {
|
|
171
|
+
this.placeholderType = 'empty-query';
|
|
172
|
+
}
|
|
173
|
+
if ((!this.searchResultsLoading && this.totalResults === 0) ||
|
|
174
|
+
!this.searchService) {
|
|
175
|
+
this.placeholderType = 'null-result';
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
get emptyPlaceholderTemplate() {
|
|
178
179
|
return html `
|
|
179
180
|
<empty-placeholder
|
|
180
181
|
.placeholderType=${this.placeholderType}
|
|
181
182
|
?isMobileView=${this.mobileView}
|
|
182
183
|
></empty-placeholder>
|
|
183
|
-
`;
|
|
184
|
-
}
|
|
185
|
-
get collectionBrowserTemplate() {
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
get collectionBrowserTemplate() {
|
|
187
|
+
var _a;
|
|
188
|
+
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
189
|
+
const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
|
|
190
|
+
const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
|
|
186
191
|
return html `<div
|
|
187
192
|
id="left-column"
|
|
188
193
|
class="column${this.isResizeToMobile ? ' preload' : ''}"
|
|
@@ -191,19 +196,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
191
196
|
${this.mobileView ? this.mobileFacetsTemplate : nothing}
|
|
192
197
|
<div id="results-total">
|
|
193
198
|
<span id="big-results-count">
|
|
194
|
-
${
|
|
195
|
-
? this.totalResults.toLocaleString()
|
|
196
|
-
: '-'}
|
|
199
|
+
${shouldShowSearching ? html `Searching…` : resultsCount}
|
|
197
200
|
</span>
|
|
198
201
|
<span id="big-results-label">
|
|
199
|
-
${
|
|
202
|
+
${shouldShowSearching ? nothing : resultsLabel}
|
|
200
203
|
</span>
|
|
201
204
|
</div>
|
|
202
205
|
</div>
|
|
203
206
|
<div
|
|
204
207
|
id="facets-container"
|
|
205
|
-
class=${!this.mobileView || this.mobileFacetsVisible
|
|
206
|
-
? 'expanded'
|
|
208
|
+
class=${!this.mobileView || this.mobileFacetsVisible
|
|
209
|
+
? 'expanded'
|
|
207
210
|
: ''}
|
|
208
211
|
>
|
|
209
212
|
${this.facetsTemplate}
|
|
@@ -211,22 +214,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
211
214
|
</div>
|
|
212
215
|
<div id="right-column" class="column">
|
|
213
216
|
${this.sortFilterBarTemplate}
|
|
214
|
-
${this.displayMode === `list-compact`
|
|
215
|
-
? this.listHeaderTemplate
|
|
217
|
+
${this.displayMode === `list-compact`
|
|
218
|
+
? this.listHeaderTemplate
|
|
216
219
|
: nothing}
|
|
217
220
|
${this.infiniteScrollerTemplate}
|
|
218
|
-
</div>`;
|
|
219
|
-
}
|
|
220
|
-
get infiniteScrollerTemplate() {
|
|
221
|
+
</div>`;
|
|
222
|
+
}
|
|
223
|
+
get infiniteScrollerTemplate() {
|
|
221
224
|
return html `<infinite-scroller
|
|
222
225
|
class="${ifDefined(this.displayMode)}"
|
|
223
226
|
.cellProvider=${this}
|
|
224
227
|
.placeholderCellTemplate=${this.placeholderCellTemplate}
|
|
225
228
|
@scrollThresholdReached=${this.scrollThresholdReached}
|
|
226
229
|
@visibleCellsChanged=${this.visibleCellsChanged}
|
|
227
|
-
></infinite-scroller>`;
|
|
228
|
-
}
|
|
229
|
-
get sortFilterBarTemplate() {
|
|
230
|
+
></infinite-scroller>`;
|
|
231
|
+
}
|
|
232
|
+
get sortFilterBarTemplate() {
|
|
230
233
|
return html `
|
|
231
234
|
<sort-filter-bar
|
|
232
235
|
.selectedSort=${this.selectedSort}
|
|
@@ -234,6 +237,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
234
237
|
.displayMode=${this.displayMode}
|
|
235
238
|
.selectedTitleFilter=${this.selectedTitleFilter}
|
|
236
239
|
.selectedCreatorFilter=${this.selectedCreatorFilter}
|
|
240
|
+
.prefixFilterCountMap=${this.prefixFilterCountMap}
|
|
237
241
|
.resizeObserver=${this.resizeObserver}
|
|
238
242
|
@sortChanged=${this.userChangedSort}
|
|
239
243
|
@displayModeChanged=${this.displayModeChanged}
|
|
@@ -241,114 +245,116 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
241
245
|
@creatorLetterChanged=${this.creatorLetterSelected}
|
|
242
246
|
>
|
|
243
247
|
</sort-filter-bar>
|
|
244
|
-
`;
|
|
245
|
-
}
|
|
246
|
-
userChangedSort(e) {
|
|
247
|
-
var _a;
|
|
248
|
-
const { selectedSort, sortDirection } = e.detail;
|
|
249
|
-
this.selectedSort = selectedSort;
|
|
250
|
-
this.sortDirection = sortDirection;
|
|
251
|
-
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
252
|
-
this.goToPage(1);
|
|
253
|
-
}
|
|
254
|
-
this.currentPage = 1;
|
|
255
|
-
}
|
|
256
|
-
sendSortByAnalytics(prevSortDirection) {
|
|
257
|
-
var _a;
|
|
258
|
-
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
259
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
260
|
-
category: this.searchContext,
|
|
261
|
-
action: analyticsActions.sortBy,
|
|
262
|
-
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
selectedSortChanged() {
|
|
266
|
-
if (this.selectedSort === 'relevance' || this.sortDirection === null) {
|
|
267
|
-
this.sortParam = null;
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const sortField = SortFieldToMetadataField[this.selectedSort];
|
|
271
|
-
if (!sortField)
|
|
272
|
-
return;
|
|
273
|
-
this.sortParam = { field: sortField, direction: this.sortDirection };
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
userChangedSort(e) {
|
|
251
|
+
var _a;
|
|
252
|
+
const { selectedSort, sortDirection } = e.detail;
|
|
253
|
+
this.selectedSort = selectedSort;
|
|
254
|
+
this.sortDirection = sortDirection;
|
|
255
|
+
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
256
|
+
this.goToPage(1);
|
|
257
|
+
}
|
|
258
|
+
this.currentPage = 1;
|
|
259
|
+
}
|
|
260
|
+
sendSortByAnalytics(prevSortDirection) {
|
|
261
|
+
var _a;
|
|
262
|
+
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
263
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
264
|
+
category: this.searchContext,
|
|
265
|
+
action: analyticsActions.sortBy,
|
|
266
|
+
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
selectedSortChanged() {
|
|
270
|
+
if (this.selectedSort === 'relevance' || this.sortDirection === null) {
|
|
271
|
+
this.sortParam = null;
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const sortField = SortFieldToMetadataField[this.selectedSort];
|
|
275
|
+
if (!sortField)
|
|
276
|
+
return;
|
|
277
|
+
this.sortParam = { field: sortField, direction: this.sortDirection };
|
|
278
|
+
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
279
|
+
this.updatePrefixFiltersForCurrentSort();
|
|
280
|
+
}
|
|
281
|
+
displayModeChanged(e) {
|
|
282
|
+
var _a;
|
|
283
|
+
this.displayMode = e.detail.displayMode;
|
|
284
|
+
if (this.displayMode) {
|
|
285
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
286
|
+
category: this.searchContext,
|
|
287
|
+
action: analyticsActions.displayMode,
|
|
288
|
+
label: this.displayMode,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/** Send Analytics when sorting by title's first letter
|
|
293
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
294
|
+
* */
|
|
295
|
+
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
296
|
+
var _a;
|
|
297
|
+
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const cleared = prevSelectedLetter && this.selectedTitleFilter === null;
|
|
301
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
302
|
+
category: this.searchContext,
|
|
303
|
+
action: analyticsActions.filterByTitle,
|
|
304
|
+
label: cleared
|
|
305
|
+
? `clear-${prevSelectedLetter}`
|
|
306
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
selectedTitleLetterChanged() {
|
|
310
|
+
this.titleQuery = this.selectedTitleFilter
|
|
311
|
+
? `firstTitle:${this.selectedTitleFilter}`
|
|
312
|
+
: undefined;
|
|
313
|
+
}
|
|
314
|
+
/** Send Analytics when filtering by creator's first letter
|
|
315
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
316
|
+
* */
|
|
317
|
+
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
318
|
+
var _a;
|
|
319
|
+
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const cleared = prevSelectedLetter && this.selectedCreatorFilter === null;
|
|
323
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
324
|
+
category: this.searchContext,
|
|
325
|
+
action: analyticsActions.filterByCreator,
|
|
326
|
+
label: cleared
|
|
327
|
+
? `clear-${prevSelectedLetter}`
|
|
328
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
selectedCreatorLetterChanged() {
|
|
332
|
+
this.creatorQuery = this.selectedCreatorFilter
|
|
333
|
+
? `firstCreator:${this.selectedCreatorFilter}`
|
|
334
|
+
: undefined;
|
|
335
|
+
}
|
|
336
|
+
titleLetterSelected(e) {
|
|
337
|
+
this.selectedCreatorFilter = null;
|
|
338
|
+
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
339
|
+
}
|
|
340
|
+
creatorLetterSelected(e) {
|
|
341
|
+
this.selectedTitleFilter = null;
|
|
342
|
+
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
343
|
+
}
|
|
344
|
+
get facetDataLoading() {
|
|
345
|
+
return this.facetsLoading || this.fullYearAggregationLoading;
|
|
346
|
+
}
|
|
347
|
+
get mobileFacetsTemplate() {
|
|
342
348
|
return html `
|
|
343
349
|
<div id="mobile-filter-collapse">
|
|
344
350
|
<h1
|
|
345
|
-
@click=${() => {
|
|
346
|
-
this.isResizeToMobile = false;
|
|
347
|
-
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
351
|
+
@click=${() => {
|
|
352
|
+
this.isResizeToMobile = false;
|
|
353
|
+
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
348
354
|
}}
|
|
349
|
-
@keyup=${() => {
|
|
350
|
-
this.isResizeToMobile = false;
|
|
351
|
-
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
355
|
+
@keyup=${() => {
|
|
356
|
+
this.isResizeToMobile = false;
|
|
357
|
+
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
352
358
|
}}
|
|
353
359
|
>
|
|
354
360
|
<span class="collapser ${this.mobileFacetsVisible ? 'open' : ''}">
|
|
@@ -357,9 +363,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
357
363
|
Filters
|
|
358
364
|
</h1>
|
|
359
365
|
</div>
|
|
360
|
-
`;
|
|
361
|
-
}
|
|
362
|
-
get facetsTemplate() {
|
|
366
|
+
`;
|
|
367
|
+
}
|
|
368
|
+
get facetsTemplate() {
|
|
363
369
|
return html `
|
|
364
370
|
<collection-facets
|
|
365
371
|
@facetsChanged=${this.facetsChanged}
|
|
@@ -375,7 +381,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
375
381
|
.collectionNameCache=${this.collectionNameCache}
|
|
376
382
|
.languageCodeHandler=${this.languageCodeHandler}
|
|
377
383
|
.showHistogramDatePicker=${this.showHistogramDatePicker}
|
|
378
|
-
.
|
|
384
|
+
.query=${this.filteredQuery}
|
|
385
|
+
.filterMap=${this.filterMap}
|
|
379
386
|
.modalManager=${this.modalManager}
|
|
380
387
|
?collapsableFacets=${this.mobileView}
|
|
381
388
|
?facetsLoading=${this.facetDataLoading}
|
|
@@ -384,16 +391,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
384
391
|
.analyticsHandler=${this.analyticsHandler}
|
|
385
392
|
>
|
|
386
393
|
</collection-facets>
|
|
387
|
-
`;
|
|
388
|
-
}
|
|
389
|
-
get loadingTemplate() {
|
|
394
|
+
`;
|
|
395
|
+
}
|
|
396
|
+
get loadingTemplate() {
|
|
390
397
|
return html `
|
|
391
398
|
<div class="loading-cover">
|
|
392
399
|
<circular-activity-indicator></circular-activity-indicator>
|
|
393
400
|
</div>
|
|
394
|
-
`;
|
|
395
|
-
}
|
|
396
|
-
get listHeaderTemplate() {
|
|
401
|
+
`;
|
|
402
|
+
}
|
|
403
|
+
get listHeaderTemplate() {
|
|
397
404
|
return html `
|
|
398
405
|
<div id="list-header">
|
|
399
406
|
<tile-dispatcher
|
|
@@ -405,679 +412,826 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
405
412
|
>
|
|
406
413
|
</tile-dispatcher>
|
|
407
414
|
</div>
|
|
408
|
-
`;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
var _a
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
if (changed.has('displayMode')
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
changed.has('
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
changed.
|
|
465
|
-
|
|
466
|
-
this.
|
|
467
|
-
}
|
|
468
|
-
if (changed.has('
|
|
469
|
-
|
|
470
|
-
this.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
if (changed.has('
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
this.
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}));
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
this.
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
this.
|
|
568
|
-
this.
|
|
569
|
-
this.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
this.
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
this.
|
|
610
|
-
this.
|
|
611
|
-
this.
|
|
612
|
-
this.
|
|
613
|
-
this.
|
|
614
|
-
this.
|
|
615
|
-
this.
|
|
616
|
-
this.
|
|
617
|
-
this.
|
|
618
|
-
this.
|
|
619
|
-
this.currentPage
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
this.
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
if (
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
(
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
*
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
//
|
|
886
|
-
if (this.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
*
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
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
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
(
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
415
|
+
`;
|
|
416
|
+
}
|
|
417
|
+
histogramDateRangeUpdated(e) {
|
|
418
|
+
var _a;
|
|
419
|
+
const { minDate, maxDate } = e.detail;
|
|
420
|
+
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
421
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
422
|
+
category: this.searchContext,
|
|
423
|
+
action: analyticsActions.histogramChanged,
|
|
424
|
+
label: this.dateRangeQueryClause,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
get dateRangeQueryClause() {
|
|
428
|
+
if (!this.minSelectedDate || !this.maxSelectedDate) {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
431
|
+
return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
|
|
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('searchType')) {
|
|
449
|
+
this.emitSearchTypeChanged();
|
|
450
|
+
}
|
|
451
|
+
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
452
|
+
this.persistState();
|
|
453
|
+
}
|
|
454
|
+
if (changed.has('baseQuery') ||
|
|
455
|
+
changed.has('titleQuery') ||
|
|
456
|
+
changed.has('creatorQuery') ||
|
|
457
|
+
changed.has('minSelectedDate') ||
|
|
458
|
+
changed.has('maxSelectedDate') ||
|
|
459
|
+
changed.has('sortParam') ||
|
|
460
|
+
changed.has('selectedFacets') ||
|
|
461
|
+
changed.has('searchService')) {
|
|
462
|
+
this.handleQueryChange();
|
|
463
|
+
}
|
|
464
|
+
if (changed.has('baseQuery') ||
|
|
465
|
+
changed.has('minSelectedDate') ||
|
|
466
|
+
changed.has('maxSelectedDate') ||
|
|
467
|
+
changed.has('selectedFacets')) {
|
|
468
|
+
this.refreshLetterCounts();
|
|
469
|
+
}
|
|
470
|
+
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
471
|
+
const prevSortDirection = changed.get('sortDirection');
|
|
472
|
+
this.sendSortByAnalytics(prevSortDirection);
|
|
473
|
+
this.selectedSortChanged();
|
|
474
|
+
}
|
|
475
|
+
if (changed.has('selectedTitleFilter')) {
|
|
476
|
+
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
477
|
+
this.selectedTitleLetterChanged();
|
|
478
|
+
}
|
|
479
|
+
if (changed.has('selectedCreatorFilter')) {
|
|
480
|
+
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
481
|
+
this.selectedCreatorLetterChanged();
|
|
482
|
+
}
|
|
483
|
+
if (changed.has('pagesToRender')) {
|
|
484
|
+
if (!this.endOfDataReached && this.infiniteScroller) {
|
|
485
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (changed.has('resizeObserver')) {
|
|
489
|
+
const oldObserver = changed.get('resizeObserver');
|
|
490
|
+
if (oldObserver)
|
|
491
|
+
this.disconnectResizeObserver(oldObserver);
|
|
492
|
+
this.setupResizeObserver();
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
disconnectedCallback() {
|
|
496
|
+
if (this.resizeObserver) {
|
|
497
|
+
this.disconnectResizeObserver(this.resizeObserver);
|
|
498
|
+
}
|
|
499
|
+
if (this.boundNavigationHandler) {
|
|
500
|
+
window.removeEventListener('popstate', this.boundNavigationHandler);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
handleResize(entry) {
|
|
504
|
+
const previousView = this.mobileView;
|
|
505
|
+
if (entry.target === this.contentContainer) {
|
|
506
|
+
this.mobileView = entry.contentRect.width < this.mobileBreakpoint;
|
|
507
|
+
// If changing from desktop to mobile disable transition
|
|
508
|
+
if (this.mobileView && !previousView) {
|
|
509
|
+
this.isResizeToMobile = true;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
emitBaseQueryChanged() {
|
|
514
|
+
this.dispatchEvent(new CustomEvent('baseQueryChanged', {
|
|
515
|
+
detail: {
|
|
516
|
+
baseQuery: this.baseQuery,
|
|
517
|
+
},
|
|
518
|
+
}));
|
|
519
|
+
}
|
|
520
|
+
emitSearchTypeChanged() {
|
|
521
|
+
this.dispatchEvent(new CustomEvent('searchTypeChanged', {
|
|
522
|
+
detail: this.searchType,
|
|
523
|
+
}));
|
|
524
|
+
}
|
|
525
|
+
disconnectResizeObserver(resizeObserver) {
|
|
526
|
+
resizeObserver.removeObserver({
|
|
527
|
+
target: this.contentContainer,
|
|
528
|
+
handler: this,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
setupResizeObserver() {
|
|
532
|
+
if (!this.resizeObserver)
|
|
533
|
+
return;
|
|
534
|
+
this.resizeObserver.addObserver({
|
|
535
|
+
target: this.contentContainer,
|
|
536
|
+
handler: this,
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* When the visible cells change from the infinite scroller, we want to emit
|
|
541
|
+
* which page is currently visible so the consumer can update its UI or the URL
|
|
542
|
+
*
|
|
543
|
+
* @param e
|
|
544
|
+
* @returns
|
|
545
|
+
*/
|
|
546
|
+
visibleCellsChanged(e) {
|
|
547
|
+
if (this.isScrollingToCell)
|
|
548
|
+
return;
|
|
549
|
+
const { visibleCellIndices } = e.detail;
|
|
550
|
+
if (visibleCellIndices.length === 0)
|
|
551
|
+
return;
|
|
552
|
+
const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
|
|
553
|
+
const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
|
|
554
|
+
if (this.currentPage !== lastVisibleCellPage) {
|
|
555
|
+
this.currentPage = lastVisibleCellPage;
|
|
556
|
+
}
|
|
557
|
+
const event = new CustomEvent('visiblePageChanged', {
|
|
558
|
+
detail: {
|
|
559
|
+
pageNumber: lastVisibleCellPage,
|
|
560
|
+
},
|
|
561
|
+
});
|
|
562
|
+
this.dispatchEvent(event);
|
|
563
|
+
}
|
|
564
|
+
async handleQueryChange() {
|
|
565
|
+
var _a;
|
|
566
|
+
// only reset if the query has actually changed
|
|
567
|
+
if (!this.searchService || this.pageFetchQueryKey === this.previousQueryKey)
|
|
568
|
+
return;
|
|
569
|
+
this.previousQueryKey = this.pageFetchQueryKey;
|
|
570
|
+
this.dataSource = {};
|
|
571
|
+
this.totalResults = undefined;
|
|
572
|
+
this.aggregations = undefined;
|
|
573
|
+
this.fullYearsHistogramAggregation = undefined;
|
|
574
|
+
this.pageFetchesInProgress = {};
|
|
575
|
+
this.endOfDataReached = false;
|
|
576
|
+
this.pagesToRender = this.initialPageNumber;
|
|
577
|
+
// Reset the infinite scroller's item count, so that it
|
|
578
|
+
// shows tile placeholders until the new query's results load in
|
|
579
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
580
|
+
if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
|
|
581
|
+
this.scrollToPage(this.initialPageNumber);
|
|
582
|
+
}
|
|
583
|
+
this.initialQueryChangeHappened = true;
|
|
584
|
+
// if the query changed as part of a window.history pop event, we don't want to
|
|
585
|
+
// persist the state because it overwrites the forward history
|
|
586
|
+
if (!this.historyPopOccurred) {
|
|
587
|
+
this.persistState();
|
|
588
|
+
this.historyPopOccurred = false;
|
|
589
|
+
}
|
|
590
|
+
await Promise.all([
|
|
591
|
+
this.doInitialPageFetch(),
|
|
592
|
+
this.fetchFacets(),
|
|
593
|
+
// Only fetch histogram data separately if we need it b/c of date filters
|
|
594
|
+
this.shouldRequestYearHistogram && this.fetchFullYearHistogram(),
|
|
595
|
+
]);
|
|
596
|
+
}
|
|
597
|
+
setupStateRestorationObserver() {
|
|
598
|
+
if (this.boundNavigationHandler)
|
|
599
|
+
return;
|
|
600
|
+
this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
|
|
601
|
+
// when the user navigates back, we want to update the UI to match the URL
|
|
602
|
+
window.addEventListener('popstate', this.boundNavigationHandler);
|
|
603
|
+
}
|
|
604
|
+
historyNavigationHandler() {
|
|
605
|
+
this.historyPopOccurred = true;
|
|
606
|
+
this.restoreState();
|
|
607
|
+
}
|
|
608
|
+
restoreState() {
|
|
609
|
+
var _a, _b, _c, _d, _e, _f;
|
|
610
|
+
const restorationState = this.restorationStateHandler.getRestorationState();
|
|
611
|
+
this.displayMode = restorationState.displayMode;
|
|
612
|
+
if (restorationState.searchType != null)
|
|
613
|
+
this.searchType = restorationState.searchType;
|
|
614
|
+
this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.relevance;
|
|
615
|
+
this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
|
|
616
|
+
this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
|
|
617
|
+
this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
|
|
618
|
+
this.selectedFacets = restorationState.selectedFacets;
|
|
619
|
+
this.baseQuery = restorationState.baseQuery;
|
|
620
|
+
this.titleQuery = restorationState.titleQuery;
|
|
621
|
+
this.creatorQuery = restorationState.creatorQuery;
|
|
622
|
+
this.sortParam = (_e = restorationState.sortParam) !== null && _e !== void 0 ? _e : null;
|
|
623
|
+
this.currentPage = (_f = restorationState.currentPage) !== null && _f !== void 0 ? _f : 1;
|
|
624
|
+
this.minSelectedDate = restorationState.minSelectedDate;
|
|
625
|
+
this.maxSelectedDate = restorationState.maxSelectedDate;
|
|
626
|
+
if (this.currentPage > 1) {
|
|
627
|
+
this.goToPage(this.currentPage);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
persistState() {
|
|
631
|
+
var _a, _b, _c, _d, _e;
|
|
632
|
+
const restorationState = {
|
|
633
|
+
displayMode: this.displayMode,
|
|
634
|
+
searchType: this.searchType,
|
|
635
|
+
sortParam: (_a = this.sortParam) !== null && _a !== void 0 ? _a : undefined,
|
|
636
|
+
selectedSort: this.selectedSort,
|
|
637
|
+
sortDirection: (_b = this.sortDirection) !== null && _b !== void 0 ? _b : undefined,
|
|
638
|
+
selectedFacets: (_c = this.selectedFacets) !== null && _c !== void 0 ? _c : defaultSelectedFacets,
|
|
639
|
+
baseQuery: this.baseQuery,
|
|
640
|
+
currentPage: this.currentPage,
|
|
641
|
+
titleQuery: this.titleQuery,
|
|
642
|
+
creatorQuery: this.creatorQuery,
|
|
643
|
+
minSelectedDate: this.minSelectedDate,
|
|
644
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
645
|
+
selectedTitleFilter: (_d = this.selectedTitleFilter) !== null && _d !== void 0 ? _d : undefined,
|
|
646
|
+
selectedCreatorFilter: (_e = this.selectedCreatorFilter) !== null && _e !== void 0 ? _e : undefined,
|
|
647
|
+
};
|
|
648
|
+
this.restorationStateHandler.persistState(restorationState);
|
|
649
|
+
}
|
|
650
|
+
async doInitialPageFetch() {
|
|
651
|
+
this.searchResultsLoading = true;
|
|
652
|
+
await this.fetchPage(this.initialPageNumber);
|
|
653
|
+
this.searchResultsLoading = false;
|
|
654
|
+
}
|
|
655
|
+
get filterMap() {
|
|
656
|
+
const builder = new FilterMapBuilder();
|
|
657
|
+
// Add the date range, if applicable
|
|
658
|
+
if (this.minSelectedDate) {
|
|
659
|
+
builder.addFilter('year', this.minSelectedDate, FilterConstraint.GREATER_OR_EQUAL);
|
|
660
|
+
}
|
|
661
|
+
if (this.maxSelectedDate) {
|
|
662
|
+
builder.addFilter('year', this.maxSelectedDate, FilterConstraint.LESS_OR_EQUAL);
|
|
663
|
+
}
|
|
664
|
+
// Add any selected facets
|
|
665
|
+
if (this.selectedFacets) {
|
|
666
|
+
for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
|
|
667
|
+
const { name, values } = this.prepareFacetForFetch(facetName, facetValues);
|
|
668
|
+
for (const [value, bucket] of Object.entries(values)) {
|
|
669
|
+
let constraint;
|
|
670
|
+
if (bucket.state === 'selected') {
|
|
671
|
+
constraint = FilterConstraint.INCLUDE;
|
|
672
|
+
}
|
|
673
|
+
else if (bucket.state === 'hidden') {
|
|
674
|
+
constraint = FilterConstraint.EXCLUDE;
|
|
675
|
+
}
|
|
676
|
+
if (constraint) {
|
|
677
|
+
builder.addFilter(name, value, constraint);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
const filterMap = builder.build();
|
|
683
|
+
// TEMP: At present, the backend search engine incorrectly returns 0 results if
|
|
684
|
+
// the _first_ language filter contains a space, so let's try to avoid that if possible.
|
|
685
|
+
if (filterMap.language) {
|
|
686
|
+
for (const [value, constraint] of Object.entries(filterMap.language)) {
|
|
687
|
+
if (value.includes(' ')) {
|
|
688
|
+
// Delete and re-add this filter to make it the last one on the parent object
|
|
689
|
+
// (Technically this isn't in the standard, but most browser impls output
|
|
690
|
+
// object keys in the order they were added.)
|
|
691
|
+
delete filterMap.language[value];
|
|
692
|
+
filterMap.language[value] = constraint;
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
// As soon as we reach one without a space, we're done
|
|
696
|
+
break;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return filterMap;
|
|
701
|
+
}
|
|
702
|
+
/** The base query joined with any title/creator letter filters */
|
|
703
|
+
get filteredQuery() {
|
|
704
|
+
if (!this.baseQuery)
|
|
705
|
+
return undefined;
|
|
706
|
+
let filteredQuery = this.baseQuery;
|
|
707
|
+
const { sortFilterQueries } = this;
|
|
708
|
+
if (sortFilterQueries) {
|
|
709
|
+
filteredQuery += ` AND ${sortFilterQueries}`;
|
|
710
|
+
}
|
|
711
|
+
return filteredQuery;
|
|
712
|
+
}
|
|
713
|
+
/** The full query, including year facets and date range clauses */
|
|
714
|
+
get fullQuery() {
|
|
715
|
+
if (!this.baseQuery)
|
|
716
|
+
return undefined;
|
|
717
|
+
let fullQuery = this.baseQuery;
|
|
718
|
+
const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;
|
|
719
|
+
if (facetQuery) {
|
|
720
|
+
fullQuery += ` AND ${facetQuery}`;
|
|
721
|
+
}
|
|
722
|
+
if (dateRangeQueryClause) {
|
|
723
|
+
fullQuery += ` AND ${dateRangeQueryClause}`;
|
|
724
|
+
}
|
|
725
|
+
if (sortFilterQueries) {
|
|
726
|
+
fullQuery += ` AND ${sortFilterQueries}`;
|
|
727
|
+
}
|
|
728
|
+
return fullQuery;
|
|
729
|
+
}
|
|
730
|
+
/** The full query without any title/creator letter filters */
|
|
731
|
+
get fullQueryWithoutAlphaFilters() {
|
|
732
|
+
if (!this.baseQuery)
|
|
733
|
+
return undefined;
|
|
734
|
+
let fullQuery = this.baseQuery;
|
|
735
|
+
const { facetQuery, dateRangeQueryClause } = this;
|
|
736
|
+
if (facetQuery) {
|
|
737
|
+
fullQuery += ` AND ${facetQuery}`;
|
|
738
|
+
}
|
|
739
|
+
if (dateRangeQueryClause) {
|
|
740
|
+
fullQuery += ` AND ${dateRangeQueryClause}`;
|
|
741
|
+
}
|
|
742
|
+
return fullQuery;
|
|
743
|
+
}
|
|
744
|
+
/** The full query without any year facets or date range clauses */
|
|
745
|
+
get fullQueryWithoutDates() {
|
|
746
|
+
if (!this.baseQuery)
|
|
747
|
+
return undefined;
|
|
748
|
+
let fullQuery = this.baseQuery;
|
|
749
|
+
const { facetQueryWithoutYear, sortFilterQueries } = this;
|
|
750
|
+
if (facetQueryWithoutYear) {
|
|
751
|
+
fullQuery += ` AND ${facetQueryWithoutYear}`;
|
|
752
|
+
}
|
|
753
|
+
if (sortFilterQueries) {
|
|
754
|
+
fullQuery += ` AND ${sortFilterQueries}`;
|
|
755
|
+
}
|
|
756
|
+
return fullQuery;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Generates a query string for the given facets
|
|
760
|
+
*
|
|
761
|
+
* Example: `mediatype:("collection" OR "audio" OR -"etree") AND year:("2000" OR "2001")`
|
|
762
|
+
*/
|
|
763
|
+
get facetQuery() {
|
|
764
|
+
if (!this.selectedFacets)
|
|
765
|
+
return undefined;
|
|
766
|
+
const facetClauses = [];
|
|
767
|
+
for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
|
|
768
|
+
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
769
|
+
}
|
|
770
|
+
return this.joinFacetClauses(facetClauses);
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Generates a query string for the currently selected facets, excluding 'year' facets.
|
|
774
|
+
*
|
|
775
|
+
* Example: `mediatype:("collection" OR "audio" OR -"etree") AND subject:("foo" OR -"bar")`
|
|
776
|
+
*/
|
|
777
|
+
get facetQueryWithoutYear() {
|
|
778
|
+
if (!this.selectedFacets)
|
|
779
|
+
return undefined;
|
|
780
|
+
const facetClauses = [];
|
|
781
|
+
for (const [facetName, facetValues] of Object.entries(this.selectedFacets)) {
|
|
782
|
+
if (facetName !== 'year') {
|
|
783
|
+
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return this.joinFacetClauses(facetClauses);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Builds an OR-joined facet clause for the given facet name and values.
|
|
790
|
+
*
|
|
791
|
+
* E.g., for name `subject` and values
|
|
792
|
+
* `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`
|
|
793
|
+
* this will produce the clause
|
|
794
|
+
* `subject:("foo" OR -"bar")`.
|
|
795
|
+
*
|
|
796
|
+
* @param facetName The facet type (e.g., 'collection')
|
|
797
|
+
* @param facetValues The facet buckets, mapped by their keys
|
|
798
|
+
*/
|
|
799
|
+
buildFacetClause(facetName, facetValues) {
|
|
800
|
+
const { name: facetQueryName, values } = this.prepareFacetForFetch(facetName, facetValues);
|
|
801
|
+
const facetEntries = Object.entries(values);
|
|
802
|
+
if (facetEntries.length === 0)
|
|
803
|
+
return '';
|
|
804
|
+
const facetValuesArray = [];
|
|
805
|
+
for (const [key, facetData] of facetEntries) {
|
|
806
|
+
const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';
|
|
807
|
+
facetValuesArray.push(`${plusMinusPrefix}"${key}"`);
|
|
808
|
+
}
|
|
809
|
+
const valueQuery = facetValuesArray.join(` OR `);
|
|
810
|
+
return `${facetQueryName}:(${valueQuery})`;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Handles some special pre-request normalization steps for certain facet types
|
|
814
|
+
* that require them.
|
|
815
|
+
*
|
|
816
|
+
* @param facetName The name of the facet type (e.g., 'language')
|
|
817
|
+
* @param facetValues An array of values for that facet type
|
|
818
|
+
*/
|
|
819
|
+
prepareFacetForFetch(facetName, facetValues) {
|
|
820
|
+
let [normalizedName, normalizedValues] = [facetName, facetValues];
|
|
821
|
+
// The full "search engine" name of the lending field is "lending___status"
|
|
822
|
+
if (facetName === 'lending') {
|
|
823
|
+
normalizedName = 'lending___status';
|
|
824
|
+
}
|
|
825
|
+
// Language codes like "en-US|en-GB|en" need to be broken apart into individual values
|
|
826
|
+
if (facetName === 'language') {
|
|
827
|
+
normalizedValues = {};
|
|
828
|
+
for (const [facetValue, facetData] of Object.entries(facetValues)) {
|
|
829
|
+
const languages = this.languageCodeHandler.getCodeArrayFromCodeString(facetValue);
|
|
830
|
+
for (const lang of languages) {
|
|
831
|
+
normalizedValues[lang] = { ...facetData };
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return {
|
|
836
|
+
name: normalizedName,
|
|
837
|
+
values: normalizedValues,
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Takes an array of facet clauses, and combines them into a
|
|
842
|
+
* full AND-joined facet query string. Empty clauses are ignored.
|
|
843
|
+
*/
|
|
844
|
+
joinFacetClauses(facetClauses) {
|
|
845
|
+
const nonEmptyFacetClauses = facetClauses.filter(clause => clause.length > 0);
|
|
846
|
+
return nonEmptyFacetClauses.length > 0
|
|
847
|
+
? `(${nonEmptyFacetClauses.join(' AND ')})`
|
|
848
|
+
: undefined;
|
|
849
|
+
}
|
|
850
|
+
facetsChanged(e) {
|
|
851
|
+
this.selectedFacets = e.detail;
|
|
852
|
+
}
|
|
853
|
+
facetClickHandler(name, facetSelected, negative) {
|
|
854
|
+
var _a, _b;
|
|
855
|
+
if (negative) {
|
|
856
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
857
|
+
category: this.searchContext,
|
|
858
|
+
action: facetSelected
|
|
859
|
+
? analyticsActions.facetNegativeSelected
|
|
860
|
+
: analyticsActions.facetNegativeDeselected,
|
|
861
|
+
label: name,
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
866
|
+
category: this.searchContext,
|
|
867
|
+
action: facetSelected
|
|
868
|
+
? analyticsActions.facetSelected
|
|
869
|
+
: analyticsActions.facetDeselected,
|
|
870
|
+
label: name,
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
async fetchFacets() {
|
|
875
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
876
|
+
if (!this.filteredQuery)
|
|
877
|
+
return;
|
|
878
|
+
const params = {
|
|
879
|
+
query: this.filteredQuery,
|
|
880
|
+
rows: 0,
|
|
881
|
+
filters: this.filterMap,
|
|
882
|
+
// Fetch a few extra buckets beyond the 6 we show, in case some get suppressed
|
|
883
|
+
aggregationsSize: 10,
|
|
884
|
+
// Note: we don't need an aggregations param to fetch the default aggregations from the PPS.
|
|
885
|
+
// The default aggregations for the search_results page type should be what we need here.
|
|
886
|
+
};
|
|
887
|
+
this.facetsLoading = true;
|
|
888
|
+
this.previousSearchType = this.searchType;
|
|
889
|
+
const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params, this.searchType));
|
|
890
|
+
this.facetsLoading = false;
|
|
891
|
+
this.aggregations = (_b = results === null || results === void 0 ? void 0 : results.success) === null || _b === void 0 ? void 0 : _b.response.aggregations;
|
|
892
|
+
// If we're not fetching year histogram data separately, set it from the newly-fetched aggregations
|
|
893
|
+
if (!this.shouldRequestYearHistogram) {
|
|
894
|
+
this.fullYearsHistogramAggregation =
|
|
895
|
+
(_f = (_e = (_d = (_c = results === null || results === void 0 ? void 0 : results.success) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.aggregations) === null || _e === void 0 ? void 0 : _e.year_histogram) !== null && _f !== void 0 ? _f : (_j = (_h = (_g = results === null || results === void 0 ? void 0 : results.success) === null || _g === void 0 ? void 0 : _g.response) === null || _h === void 0 ? void 0 : _h.aggregations) === null || _j === void 0 ? void 0 : _j['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* The query key is a string that uniquely identifies the current query
|
|
900
|
+
* without the date range.
|
|
901
|
+
*
|
|
902
|
+
* If this doesn't change, we don't need to re-fetch the histogram date range
|
|
903
|
+
*/
|
|
904
|
+
get fullQueryNoDateKey() {
|
|
905
|
+
var _a, _b;
|
|
906
|
+
return `${this.fullQueryWithoutDates}-${this.searchType}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* This method is similar to fetching the facets above,
|
|
910
|
+
* but only fetching the year histogram. There is a subtle difference
|
|
911
|
+
* in how you have to fetch the year histogram where you can't use the
|
|
912
|
+
* advanced JSON syntax like the other aggregations. It's a special
|
|
913
|
+
* case that @ximm put it place.
|
|
914
|
+
*/
|
|
915
|
+
async fetchFullYearHistogram() {
|
|
916
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
917
|
+
const { fullQueryNoDateKey } = this;
|
|
918
|
+
if (!this.fullQueryWithoutDates ||
|
|
919
|
+
fullQueryNoDateKey === this.previousFullQueryNoDate) {
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
this.previousFullQueryNoDate = fullQueryNoDateKey;
|
|
923
|
+
const aggregations = {
|
|
924
|
+
simpleParams: ['year'],
|
|
925
|
+
};
|
|
926
|
+
const params = {
|
|
927
|
+
query: this.fullQueryWithoutDates,
|
|
928
|
+
aggregations,
|
|
929
|
+
rows: 0,
|
|
930
|
+
};
|
|
931
|
+
this.fullYearAggregationLoading = true;
|
|
932
|
+
const results = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params, this.searchType));
|
|
933
|
+
this.fullYearAggregationLoading = false;
|
|
934
|
+
this.fullYearsHistogramAggregation =
|
|
935
|
+
(_e = (_d = (_c = (_b = results === null || results === void 0 ? void 0 : results.success) === null || _b === void 0 ? void 0 : _b.response) === null || _c === void 0 ? void 0 : _c.aggregations) === null || _d === void 0 ? void 0 : _d.year_histogram) !== null && _e !== void 0 ? _e : (_h = (_g = (_f = results === null || results === void 0 ? void 0 : results.success) === null || _f === void 0 ? void 0 : _f.response) === null || _g === void 0 ? void 0 : _g.aggregations) === null || _h === void 0 ? void 0 : _h['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* We only want to send a separate request for the year_histogram data
|
|
939
|
+
* if (a) the date picker component is enabled and (b) there is a year facet or date-range filter applied.
|
|
940
|
+
*
|
|
941
|
+
* Otherwise, we should just be using the histogram data supplied by the "normal" facet request.
|
|
942
|
+
*/
|
|
943
|
+
get shouldRequestYearHistogram() {
|
|
944
|
+
var _a, _b;
|
|
945
|
+
const datePickerEnabled = this.showHistogramDatePicker;
|
|
946
|
+
const hasDateRange = !!this.dateRangeQueryClause;
|
|
947
|
+
const hasYearFacet = Object.keys((_b = (_a = this.selectedFacets) === null || _a === void 0 ? void 0 : _a.year) !== null && _b !== void 0 ? _b : {}).length > 0;
|
|
948
|
+
return datePickerEnabled && (hasDateRange || hasYearFacet);
|
|
949
|
+
}
|
|
950
|
+
scrollToPage(pageNumber) {
|
|
951
|
+
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
952
|
+
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
953
|
+
// then scrolls to the cell
|
|
954
|
+
setTimeout(() => {
|
|
955
|
+
this.isScrollingToCell = true;
|
|
956
|
+
this.infiniteScroller.scrollToCell(cellIndexToScrollTo, true);
|
|
957
|
+
// This timeout is to give the scroll animation time to finish
|
|
958
|
+
// then updating the infinite scroller once we're done scrolling
|
|
959
|
+
// There's no scroll animation completion callback so we're
|
|
960
|
+
// giving it 0.5s to finish.
|
|
961
|
+
setTimeout(() => {
|
|
962
|
+
this.isScrollingToCell = false;
|
|
963
|
+
this.infiniteScroller.reload();
|
|
964
|
+
}, 500);
|
|
965
|
+
}, 0);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* The query key is a string that uniquely identifies the current search.
|
|
969
|
+
* It consists of:
|
|
970
|
+
* - The current base query
|
|
971
|
+
* - The current search type
|
|
972
|
+
* - Any currently-applied facets
|
|
973
|
+
* - Any currently-applied date range
|
|
974
|
+
* - Any currently-applied prefix filters
|
|
975
|
+
* - The current sort options
|
|
976
|
+
*
|
|
977
|
+
* This lets us keep track of queries so we don't persist data that's
|
|
978
|
+
* no longer relevant.
|
|
979
|
+
*/
|
|
980
|
+
get pageFetchQueryKey() {
|
|
981
|
+
var _a, _b;
|
|
982
|
+
return `${this.fullQuery}-${this.searchType}-${(_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field}-${(_b = this.sortParam) === null || _b === void 0 ? void 0 : _b.direction}`;
|
|
983
|
+
}
|
|
984
|
+
async fetchPage(pageNumber) {
|
|
985
|
+
var _a, _b, _c, _d, _e;
|
|
986
|
+
if (!this.filteredQuery)
|
|
987
|
+
return;
|
|
988
|
+
// if we already have data, don't fetch again
|
|
989
|
+
if (this.dataSource[pageNumber])
|
|
990
|
+
return;
|
|
991
|
+
if (this.endOfDataReached)
|
|
992
|
+
return;
|
|
993
|
+
// if a fetch is already in progress for this query and page, don't fetch again
|
|
994
|
+
const { pageFetchQueryKey } = this;
|
|
995
|
+
const pageFetches = (_a = this.pageFetchesInProgress[pageFetchQueryKey]) !== null && _a !== void 0 ? _a : new Set();
|
|
996
|
+
if (pageFetches.has(pageNumber))
|
|
997
|
+
return;
|
|
998
|
+
pageFetches.add(pageNumber);
|
|
999
|
+
this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;
|
|
1000
|
+
const sortParams = this.sortParam ? [this.sortParam] : [];
|
|
1001
|
+
const params = {
|
|
1002
|
+
query: this.filteredQuery,
|
|
1003
|
+
page: pageNumber,
|
|
1004
|
+
rows: this.pageSize,
|
|
1005
|
+
sort: sortParams,
|
|
1006
|
+
filters: this.filterMap,
|
|
1007
|
+
aggregations: { omit: true },
|
|
1008
|
+
};
|
|
1009
|
+
const searchResponse = await ((_b = this.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.searchType));
|
|
1010
|
+
const success = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success;
|
|
1011
|
+
if (!success)
|
|
1012
|
+
return;
|
|
1013
|
+
this.totalResults = success.response.totalResults;
|
|
1014
|
+
// this is checking to see if the query has changed since the data was fetched
|
|
1015
|
+
// if so, we just want to discard the data since there should be a new query
|
|
1016
|
+
// right behind it
|
|
1017
|
+
const searchQuery = success.request.clientParameters.user_query;
|
|
1018
|
+
const searchSort = success.request.clientParameters.sort;
|
|
1019
|
+
let sortChanged = false;
|
|
1020
|
+
if (!searchSort || searchSort.length === 0) {
|
|
1021
|
+
// if we went from no sort to sort, the sort has changed
|
|
1022
|
+
if (this.sortParam) {
|
|
1023
|
+
sortChanged = true;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
// check if the sort has changed
|
|
1028
|
+
for (const sortType of searchSort) {
|
|
1029
|
+
const [field, direction] = sortType.split(':');
|
|
1030
|
+
if (field !== ((_c = this.sortParam) === null || _c === void 0 ? void 0 : _c.field) ||
|
|
1031
|
+
direction !== ((_d = this.sortParam) === null || _d === void 0 ? void 0 : _d.direction)) {
|
|
1032
|
+
sortChanged = true;
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
const queryChangedSinceFetch = searchQuery !== this.filteredQuery || sortChanged;
|
|
1038
|
+
if (queryChangedSinceFetch)
|
|
1039
|
+
return;
|
|
1040
|
+
const { results } = success.response;
|
|
1041
|
+
if (results && results.length > 0) {
|
|
1042
|
+
this.preloadCollectionNames(results);
|
|
1043
|
+
this.updateDataSource(pageNumber, results);
|
|
1044
|
+
}
|
|
1045
|
+
// When we reach the end of the data, we can set the infinite scroller's
|
|
1046
|
+
// item count to the real total number of results (rather than the
|
|
1047
|
+
// temporary estimates based on pages rendered so far).
|
|
1048
|
+
if (results.length < this.pageSize) {
|
|
1049
|
+
this.endOfDataReached = true;
|
|
1050
|
+
this.infiniteScroller.itemCount = this.totalResults;
|
|
1051
|
+
}
|
|
1052
|
+
(_e = this.pageFetchesInProgress[pageFetchQueryKey]) === null || _e === void 0 ? void 0 : _e.delete(pageNumber);
|
|
1053
|
+
this.searchResultsLoading = false;
|
|
1054
|
+
}
|
|
1055
|
+
preloadCollectionNames(results) {
|
|
1056
|
+
var _a;
|
|
1057
|
+
const collectionIds = results
|
|
1058
|
+
.map(result => { var _a; return (_a = result.collection) === null || _a === void 0 ? void 0 : _a.values; })
|
|
1059
|
+
.flat();
|
|
1060
|
+
const collectionIdsArray = Array.from(new Set(collectionIds));
|
|
1061
|
+
(_a = this.collectionNameCache) === null || _a === void 0 ? void 0 : _a.preloadIdentifiers(collectionIdsArray);
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* This is useful for determining whether we need to reload the scroller.
|
|
1065
|
+
*
|
|
1066
|
+
* When the fetch completes, we need to reload the scroller if the cells for that
|
|
1067
|
+
* page are visible, but if the page is not currenlty visible, we don't need to reload
|
|
1068
|
+
*/
|
|
1069
|
+
get currentVisiblePageNumbers() {
|
|
1070
|
+
var _a, _b;
|
|
1071
|
+
const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
|
|
1072
|
+
const visiblePages = new Set();
|
|
1073
|
+
visibleCells.forEach(cellIndex => {
|
|
1074
|
+
const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
|
|
1075
|
+
visiblePages.add(visiblePage);
|
|
1076
|
+
});
|
|
1077
|
+
return Array.from(visiblePages);
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Update the datasource from the fetch response
|
|
1081
|
+
*
|
|
1082
|
+
* @param pageNumber
|
|
1083
|
+
* @param results
|
|
1084
|
+
*/
|
|
1085
|
+
updateDataSource(pageNumber, results) {
|
|
1086
|
+
// copy our existing datasource so when we set it below, it gets set
|
|
1087
|
+
// instead of modifying the existing dataSource since object changes
|
|
1088
|
+
// don't trigger a re-render
|
|
1089
|
+
const datasource = { ...this.dataSource };
|
|
1090
|
+
const tiles = [];
|
|
1091
|
+
results === null || results === void 0 ? void 0 : results.forEach(result => {
|
|
1092
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
1093
|
+
if (!result.identifier)
|
|
1094
|
+
return;
|
|
1095
|
+
let loginRequired = false;
|
|
1096
|
+
let contentWarning = false;
|
|
1097
|
+
// Check if item and item in "modifying" collection, setting above flags
|
|
1098
|
+
if (((_a = result.collection) === null || _a === void 0 ? void 0 : _a.values.length) &&
|
|
1099
|
+
((_b = result.mediatype) === null || _b === void 0 ? void 0 : _b.value) !== 'collection') {
|
|
1100
|
+
for (const collection of (_d = (_c = result.collection) === null || _c === void 0 ? void 0 : _c.values) !== null && _d !== void 0 ? _d : []) {
|
|
1101
|
+
if (collection === 'loggedin') {
|
|
1102
|
+
loginRequired = true;
|
|
1103
|
+
if (contentWarning)
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
if (collection === 'no-preview') {
|
|
1107
|
+
contentWarning = true;
|
|
1108
|
+
if (loginRequired)
|
|
1109
|
+
break;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
tiles.push({
|
|
1114
|
+
averageRating: (_e = result.avg_rating) === null || _e === void 0 ? void 0 : _e.value,
|
|
1115
|
+
collections: (_g = (_f = result.collection) === null || _f === void 0 ? void 0 : _f.values) !== null && _g !== void 0 ? _g : [],
|
|
1116
|
+
commentCount: (_j = (_h = result.num_reviews) === null || _h === void 0 ? void 0 : _h.value) !== null && _j !== void 0 ? _j : 0,
|
|
1117
|
+
creator: (_k = result.creator) === null || _k === void 0 ? void 0 : _k.value,
|
|
1118
|
+
creators: (_m = (_l = result.creator) === null || _l === void 0 ? void 0 : _l.values) !== null && _m !== void 0 ? _m : [],
|
|
1119
|
+
dateAdded: (_o = result.addeddate) === null || _o === void 0 ? void 0 : _o.value,
|
|
1120
|
+
dateArchived: (_p = result.publicdate) === null || _p === void 0 ? void 0 : _p.value,
|
|
1121
|
+
datePublished: (_q = result.date) === null || _q === void 0 ? void 0 : _q.value,
|
|
1122
|
+
dateReviewed: (_r = result.reviewdate) === null || _r === void 0 ? void 0 : _r.value,
|
|
1123
|
+
description: (_s = result.description) === null || _s === void 0 ? void 0 : _s.values.join('\n'),
|
|
1124
|
+
favCount: (_u = (_t = result.num_favorites) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : 0,
|
|
1125
|
+
identifier: result.identifier,
|
|
1126
|
+
issue: (_v = result.issue) === null || _v === void 0 ? void 0 : _v.value,
|
|
1127
|
+
itemCount: (_x = (_w = result.item_count) === null || _w === void 0 ? void 0 : _w.value) !== null && _x !== void 0 ? _x : 0,
|
|
1128
|
+
mediatype: (_z = (_y = result.mediatype) === null || _y === void 0 ? void 0 : _y.value) !== null && _z !== void 0 ? _z : 'data',
|
|
1129
|
+
snippets: (_1 = (_0 = result.highlight) === null || _0 === void 0 ? void 0 : _0.values) !== null && _1 !== void 0 ? _1 : [],
|
|
1130
|
+
source: (_2 = result.source) === null || _2 === void 0 ? void 0 : _2.value,
|
|
1131
|
+
subjects: (_4 = (_3 = result.subject) === null || _3 === void 0 ? void 0 : _3.values) !== null && _4 !== void 0 ? _4 : [],
|
|
1132
|
+
title: this.etreeTitle((_5 = result.title) === null || _5 === void 0 ? void 0 : _5.value, (_6 = result.mediatype) === null || _6 === void 0 ? void 0 : _6.value, (_7 = result.collection) === null || _7 === void 0 ? void 0 : _7.values),
|
|
1133
|
+
volume: (_8 = result.volume) === null || _8 === void 0 ? void 0 : _8.value,
|
|
1134
|
+
viewCount: (_10 = (_9 = result.downloads) === null || _9 === void 0 ? void 0 : _9.value) !== null && _10 !== void 0 ? _10 : 0,
|
|
1135
|
+
weeklyViewCount: (_11 = result.week) === null || _11 === void 0 ? void 0 : _11.value,
|
|
1136
|
+
loginRequired,
|
|
1137
|
+
contentWarning,
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
datasource[pageNumber] = tiles;
|
|
1141
|
+
this.dataSource = datasource;
|
|
1142
|
+
const visiblePages = this.currentVisiblePageNumbers;
|
|
1143
|
+
const needsReload = visiblePages.includes(pageNumber);
|
|
1144
|
+
if (needsReload) {
|
|
1145
|
+
this.infiniteScroller.reload();
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
/** Fetches the aggregation buckets for the given prefix filter type. */
|
|
1149
|
+
async fetchPrefixFilterBuckets(filterType) {
|
|
1150
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1151
|
+
if (!this.fullQueryWithoutAlphaFilters)
|
|
1152
|
+
return [];
|
|
1153
|
+
const filterAggregationKey = prefixFilterAggregationKeys[filterType];
|
|
1154
|
+
const params = {
|
|
1155
|
+
query: this.fullQueryWithoutAlphaFilters,
|
|
1156
|
+
rows: 0,
|
|
1157
|
+
// Only fetch the firstTitle or firstCreator aggregation
|
|
1158
|
+
aggregations: { simpleParams: [filterAggregationKey] },
|
|
1159
|
+
// Fetch all 26 letter buckets
|
|
1160
|
+
aggregationsSize: 26,
|
|
1161
|
+
};
|
|
1162
|
+
const searchResponse = await ((_a = this.searchService) === null || _a === void 0 ? void 0 : _a.search(params, this.searchType));
|
|
1163
|
+
return ((_f = (_e = (_d = (_c = (_b = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success) === null || _b === void 0 ? void 0 : _b.response) === null || _c === void 0 ? void 0 : _c.aggregations) === null || _d === void 0 ? void 0 : _d[filterAggregationKey]) === null || _e === void 0 ? void 0 : _e.buckets) !== null && _f !== void 0 ? _f : []);
|
|
1164
|
+
}
|
|
1165
|
+
/** Fetches and caches the prefix filter counts for the given filter type. */
|
|
1166
|
+
async updatePrefixFilterCounts(filterType) {
|
|
1167
|
+
const buckets = await this.fetchPrefixFilterBuckets(filterType);
|
|
1168
|
+
// Unpack the aggregation buckets into a simple map like { 'A': 50, 'B': 25, ... }
|
|
1169
|
+
this.prefixFilterCountMap = { ...this.prefixFilterCountMap }; // Clone the object to trigger an update
|
|
1170
|
+
this.prefixFilterCountMap[filterType] = buckets.reduce((acc, bucket) => {
|
|
1171
|
+
acc[bucket.key.toUpperCase()] = bucket.doc_count;
|
|
1172
|
+
return acc;
|
|
1173
|
+
}, {});
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Fetches and caches the prefix filter counts for the current sort type,
|
|
1177
|
+
* provided it is one that permits prefix filtering. (If not, this does nothing).
|
|
1178
|
+
*/
|
|
1179
|
+
async updatePrefixFiltersForCurrentSort() {
|
|
1180
|
+
if (['title', 'creator'].includes(this.selectedSort)) {
|
|
1181
|
+
const filterType = this.selectedSort;
|
|
1182
|
+
if (!this.prefixFilterCountMap[filterType]) {
|
|
1183
|
+
this.updatePrefixFilterCounts(filterType);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Clears the cached letter counts for both title and creator, and
|
|
1189
|
+
* fetches a new set of counts for whichever of them is the currently
|
|
1190
|
+
* selected sort option (which may be neither).
|
|
1191
|
+
*
|
|
1192
|
+
* Call this whenever the counts are invalidated (e.g., by a query change).
|
|
1193
|
+
*/
|
|
1194
|
+
refreshLetterCounts() {
|
|
1195
|
+
this.prefixFilterCountMap = {};
|
|
1196
|
+
this.updatePrefixFiltersForCurrentSort();
|
|
1197
|
+
}
|
|
1198
|
+
/*
|
|
1199
|
+
* Convert etree titles
|
|
1200
|
+
* "[Creator] Live at [Place] on [Date]" => "[Date]: [Place]"
|
|
1201
|
+
*
|
|
1202
|
+
* Todo: Check collection(s) for etree, need to get as array.
|
|
1203
|
+
* Current search-service only returns first collection as string.
|
|
1204
|
+
*/
|
|
1205
|
+
etreeTitle(title, mediatype, collections) {
|
|
1206
|
+
if (mediatype === 'etree' || (collections === null || collections === void 0 ? void 0 : collections.includes('etree'))) {
|
|
1207
|
+
const regex = /^(.*) Live at (.*) on (\d\d\d\d-\d\d-\d\d)$/;
|
|
1208
|
+
const newTitle = title === null || title === void 0 ? void 0 : title.replace(regex, '$3: $2');
|
|
1209
|
+
if (newTitle) {
|
|
1210
|
+
return `${newTitle}`;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
return title !== null && title !== void 0 ? title : '';
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Callback when a result is selected
|
|
1217
|
+
*/
|
|
1218
|
+
resultSelected(event) {
|
|
1219
|
+
var _a, _b;
|
|
1220
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
1221
|
+
category: this.searchContext,
|
|
1222
|
+
action: analyticsActions.resultSelected,
|
|
1223
|
+
label: event.detail.mediatype,
|
|
1224
|
+
});
|
|
1225
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
1226
|
+
category: this.searchContext,
|
|
1227
|
+
action: analyticsActions.resultSelected,
|
|
1228
|
+
label: `page-${this.currentPage}`,
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
cellForIndex(index) {
|
|
1232
|
+
const model = this.tileModelAtCellIndex(index);
|
|
1233
|
+
if (!model)
|
|
1234
|
+
return undefined;
|
|
1081
1235
|
return html `
|
|
1082
1236
|
<tile-dispatcher
|
|
1083
1237
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
@@ -1092,17 +1246,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1092
1246
|
@resultSelected=${(e) => this.resultSelected(e)}
|
|
1093
1247
|
>
|
|
1094
1248
|
</tile-dispatcher>
|
|
1095
|
-
`;
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1099
|
-
* increase the number of pages to render and start fetching data for the new page
|
|
1100
|
-
*/
|
|
1101
|
-
scrollThresholdReached() {
|
|
1102
|
-
this.
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
}
|
|
1249
|
+
`;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1253
|
+
* increase the number of pages to render and start fetching data for the new page
|
|
1254
|
+
*/
|
|
1255
|
+
scrollThresholdReached() {
|
|
1256
|
+
if (!this.endOfDataReached) {
|
|
1257
|
+
this.pagesToRender += 1;
|
|
1258
|
+
this.fetchPage(this.pagesToRender);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1106
1262
|
CollectionBrowser.styles = css `
|
|
1107
1263
|
:host {
|
|
1108
1264
|
display: block;
|
|
@@ -1308,138 +1464,138 @@ CollectionBrowser.styles = css `
|
|
|
1308
1464
|
29rem
|
|
1309
1465
|
);
|
|
1310
1466
|
}
|
|
1311
|
-
`;
|
|
1312
|
-
__decorate([
|
|
1313
|
-
property({ type: String })
|
|
1314
|
-
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1315
|
-
__decorate([
|
|
1316
|
-
property({ type: String })
|
|
1317
|
-
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1318
|
-
__decorate([
|
|
1319
|
-
property({ type: Object })
|
|
1320
|
-
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1321
|
-
__decorate([
|
|
1322
|
-
property({ type: String })
|
|
1323
|
-
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1324
|
-
__decorate([
|
|
1325
|
-
property({ type: String })
|
|
1326
|
-
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1327
|
-
__decorate([
|
|
1328
|
-
property({ type: String })
|
|
1329
|
-
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1330
|
-
__decorate([
|
|
1331
|
-
property({ type: Object })
|
|
1332
|
-
], CollectionBrowser.prototype, "sortParam", void 0);
|
|
1333
|
-
__decorate([
|
|
1334
|
-
property({ type: String })
|
|
1335
|
-
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1336
|
-
__decorate([
|
|
1337
|
-
property({ type: String })
|
|
1338
|
-
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1339
|
-
__decorate([
|
|
1340
|
-
property({ type: String })
|
|
1341
|
-
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1342
|
-
__decorate([
|
|
1343
|
-
property({ type: String })
|
|
1344
|
-
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1345
|
-
__decorate([
|
|
1346
|
-
property({ type:
|
|
1347
|
-
], CollectionBrowser.prototype, "
|
|
1348
|
-
__decorate([
|
|
1349
|
-
property({ type:
|
|
1350
|
-
], CollectionBrowser.prototype, "
|
|
1351
|
-
__decorate([
|
|
1352
|
-
property({ type:
|
|
1353
|
-
], CollectionBrowser.prototype, "
|
|
1354
|
-
__decorate([
|
|
1355
|
-
property({ type: String })
|
|
1356
|
-
], CollectionBrowser.prototype, "
|
|
1357
|
-
__decorate([
|
|
1358
|
-
property({ type:
|
|
1359
|
-
], CollectionBrowser.prototype, "
|
|
1360
|
-
__decorate([
|
|
1361
|
-
property({ type:
|
|
1362
|
-
], CollectionBrowser.prototype, "
|
|
1363
|
-
__decorate([
|
|
1364
|
-
property({ type: String })
|
|
1365
|
-
], CollectionBrowser.prototype, "
|
|
1366
|
-
__decorate([
|
|
1367
|
-
property({ type:
|
|
1368
|
-
], CollectionBrowser.prototype, "
|
|
1369
|
-
__decorate([
|
|
1370
|
-
property({ type:
|
|
1371
|
-
], CollectionBrowser.prototype, "
|
|
1372
|
-
__decorate([
|
|
1373
|
-
property({ type:
|
|
1374
|
-
], CollectionBrowser.prototype, "
|
|
1375
|
-
__decorate([
|
|
1376
|
-
property({ type:
|
|
1377
|
-
], CollectionBrowser.prototype, "
|
|
1378
|
-
__decorate([
|
|
1379
|
-
property({ type:
|
|
1380
|
-
], CollectionBrowser.prototype, "
|
|
1381
|
-
__decorate([
|
|
1382
|
-
property({ type:
|
|
1383
|
-
], CollectionBrowser.prototype, "
|
|
1384
|
-
__decorate([
|
|
1385
|
-
property({ type:
|
|
1386
|
-
], CollectionBrowser.prototype, "
|
|
1387
|
-
__decorate([
|
|
1388
|
-
property({ type:
|
|
1389
|
-
], CollectionBrowser.prototype, "
|
|
1390
|
-
__decorate([
|
|
1391
|
-
property({ type:
|
|
1392
|
-
], CollectionBrowser.prototype, "
|
|
1393
|
-
__decorate([
|
|
1394
|
-
property({ type:
|
|
1395
|
-
], CollectionBrowser.prototype, "
|
|
1396
|
-
__decorate([
|
|
1397
|
-
|
|
1398
|
-
], CollectionBrowser.prototype, "
|
|
1399
|
-
__decorate([
|
|
1400
|
-
state()
|
|
1401
|
-
], CollectionBrowser.prototype, "
|
|
1402
|
-
__decorate([
|
|
1403
|
-
state()
|
|
1404
|
-
], CollectionBrowser.prototype, "
|
|
1405
|
-
__decorate([
|
|
1406
|
-
state()
|
|
1407
|
-
], CollectionBrowser.prototype, "
|
|
1408
|
-
__decorate([
|
|
1409
|
-
state()
|
|
1410
|
-
], CollectionBrowser.prototype, "
|
|
1411
|
-
__decorate([
|
|
1412
|
-
state()
|
|
1413
|
-
], CollectionBrowser.prototype, "
|
|
1414
|
-
__decorate([
|
|
1415
|
-
state()
|
|
1416
|
-
], CollectionBrowser.prototype, "
|
|
1417
|
-
__decorate([
|
|
1418
|
-
state()
|
|
1419
|
-
], CollectionBrowser.prototype, "
|
|
1420
|
-
__decorate([
|
|
1421
|
-
state()
|
|
1422
|
-
], CollectionBrowser.prototype, "
|
|
1423
|
-
__decorate([
|
|
1424
|
-
state()
|
|
1425
|
-
], CollectionBrowser.prototype, "
|
|
1426
|
-
__decorate([
|
|
1427
|
-
state()
|
|
1428
|
-
], CollectionBrowser.prototype, "
|
|
1429
|
-
__decorate([
|
|
1430
|
-
state()
|
|
1431
|
-
], CollectionBrowser.prototype, "
|
|
1432
|
-
__decorate([
|
|
1433
|
-
query('#content-container')
|
|
1434
|
-
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
1435
|
-
__decorate([
|
|
1436
|
-
property({ type: Object, attribute: false })
|
|
1437
|
-
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
1438
|
-
__decorate([
|
|
1439
|
-
query('infinite-scroller')
|
|
1440
|
-
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
1441
|
-
CollectionBrowser = __decorate([
|
|
1442
|
-
customElement('collection-browser')
|
|
1443
|
-
], CollectionBrowser);
|
|
1444
|
-
export { CollectionBrowser };
|
|
1467
|
+
`;
|
|
1468
|
+
__decorate([
|
|
1469
|
+
property({ type: String })
|
|
1470
|
+
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1471
|
+
__decorate([
|
|
1472
|
+
property({ type: String })
|
|
1473
|
+
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1474
|
+
__decorate([
|
|
1475
|
+
property({ type: Object })
|
|
1476
|
+
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1477
|
+
__decorate([
|
|
1478
|
+
property({ type: String })
|
|
1479
|
+
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1480
|
+
__decorate([
|
|
1481
|
+
property({ type: String })
|
|
1482
|
+
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1483
|
+
__decorate([
|
|
1484
|
+
property({ type: String })
|
|
1485
|
+
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1486
|
+
__decorate([
|
|
1487
|
+
property({ type: Object })
|
|
1488
|
+
], CollectionBrowser.prototype, "sortParam", void 0);
|
|
1489
|
+
__decorate([
|
|
1490
|
+
property({ type: String })
|
|
1491
|
+
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1492
|
+
__decorate([
|
|
1493
|
+
property({ type: String })
|
|
1494
|
+
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1495
|
+
__decorate([
|
|
1496
|
+
property({ type: String })
|
|
1497
|
+
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1498
|
+
__decorate([
|
|
1499
|
+
property({ type: String })
|
|
1500
|
+
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1501
|
+
__decorate([
|
|
1502
|
+
property({ type: Number })
|
|
1503
|
+
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
1504
|
+
__decorate([
|
|
1505
|
+
property({ type: Object })
|
|
1506
|
+
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
1507
|
+
__decorate([
|
|
1508
|
+
property({ type: String })
|
|
1509
|
+
], CollectionBrowser.prototype, "titleQuery", void 0);
|
|
1510
|
+
__decorate([
|
|
1511
|
+
property({ type: String })
|
|
1512
|
+
], CollectionBrowser.prototype, "creatorQuery", void 0);
|
|
1513
|
+
__decorate([
|
|
1514
|
+
property({ type: Number })
|
|
1515
|
+
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
1516
|
+
__decorate([
|
|
1517
|
+
property({ type: String })
|
|
1518
|
+
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
1519
|
+
__decorate([
|
|
1520
|
+
property({ type: String })
|
|
1521
|
+
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
1522
|
+
__decorate([
|
|
1523
|
+
property({ type: Object })
|
|
1524
|
+
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
1525
|
+
__decorate([
|
|
1526
|
+
property({ type: Boolean })
|
|
1527
|
+
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
1528
|
+
__decorate([
|
|
1529
|
+
property({ type: String, reflect: true })
|
|
1530
|
+
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
1531
|
+
__decorate([
|
|
1532
|
+
property({ type: Object })
|
|
1533
|
+
], CollectionBrowser.prototype, "collectionNameCache", void 0);
|
|
1534
|
+
__decorate([
|
|
1535
|
+
property({ type: String })
|
|
1536
|
+
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
1537
|
+
__decorate([
|
|
1538
|
+
property({ type: Object })
|
|
1539
|
+
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
1540
|
+
__decorate([
|
|
1541
|
+
property({ type: Number })
|
|
1542
|
+
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
1543
|
+
__decorate([
|
|
1544
|
+
property({ type: Boolean })
|
|
1545
|
+
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
1546
|
+
__decorate([
|
|
1547
|
+
property({ type: Object })
|
|
1548
|
+
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
1549
|
+
__decorate([
|
|
1550
|
+
property({ type: Boolean })
|
|
1551
|
+
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
1552
|
+
__decorate([
|
|
1553
|
+
state()
|
|
1554
|
+
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
1555
|
+
__decorate([
|
|
1556
|
+
state()
|
|
1557
|
+
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
1558
|
+
__decorate([
|
|
1559
|
+
state()
|
|
1560
|
+
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
1561
|
+
__decorate([
|
|
1562
|
+
state()
|
|
1563
|
+
], CollectionBrowser.prototype, "fullYearAggregationLoading", void 0);
|
|
1564
|
+
__decorate([
|
|
1565
|
+
state()
|
|
1566
|
+
], CollectionBrowser.prototype, "aggregations", void 0);
|
|
1567
|
+
__decorate([
|
|
1568
|
+
state()
|
|
1569
|
+
], CollectionBrowser.prototype, "fullYearsHistogramAggregation", void 0);
|
|
1570
|
+
__decorate([
|
|
1571
|
+
state()
|
|
1572
|
+
], CollectionBrowser.prototype, "previousSearchType", void 0);
|
|
1573
|
+
__decorate([
|
|
1574
|
+
state()
|
|
1575
|
+
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
1576
|
+
__decorate([
|
|
1577
|
+
state()
|
|
1578
|
+
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
1579
|
+
__decorate([
|
|
1580
|
+
state()
|
|
1581
|
+
], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
|
|
1582
|
+
__decorate([
|
|
1583
|
+
state()
|
|
1584
|
+
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
1585
|
+
__decorate([
|
|
1586
|
+
state()
|
|
1587
|
+
], CollectionBrowser.prototype, "prefixFilterCountMap", void 0);
|
|
1588
|
+
__decorate([
|
|
1589
|
+
query('#content-container')
|
|
1590
|
+
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
1591
|
+
__decorate([
|
|
1592
|
+
property({ type: Object, attribute: false })
|
|
1593
|
+
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
1594
|
+
__decorate([
|
|
1595
|
+
query('infinite-scroller')
|
|
1596
|
+
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
1597
|
+
CollectionBrowser = __decorate([
|
|
1598
|
+
customElement('collection-browser')
|
|
1599
|
+
], CollectionBrowser);
|
|
1600
|
+
export { CollectionBrowser };
|
|
1445
1601
|
//# sourceMappingURL=collection-browser.js.map
|