@internetarchive/collection-browser 2.1.3 → 2.1.4-alpha.2
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/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +12 -12
- package/dist/index.js +12 -12
- package/dist/src/app-root.d.ts +88 -84
- package/dist/src/app-root.js +487 -452
- 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/contract.d.ts +2 -2
- package/dist/src/assets/img/icons/contract.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/expand.d.ts +2 -2
- package/dist/src/assets/img/icons/expand.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/favorite-unfilled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-unfilled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +395 -394
- package/dist/src/collection-browser.js +1363 -1356
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +30 -30
- package/dist/src/collection-facets/facet-row.js +114 -114
- 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 +17 -17
- package/dist/src/collection-facets/facets-template.js +114 -114
- package/dist/src/collection-facets/more-facets-content.d.ts +70 -70
- package/dist/src/collection-facets/more-facets-content.js +354 -354
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +196 -196
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
- package/dist/src/collection-facets/toggle-switch.js +94 -94
- package/dist/src/collection-facets.d.ts +103 -103
- package/dist/src/collection-facets.js +509 -509
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +232 -232
- package/dist/src/data-source/collection-browser-data-source-interface.js +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +360 -360
- package/dist/src/data-source/collection-browser-data-source.js +930 -930
- package/dist/src/data-source/collection-browser-query-state.d.ts +43 -43
- package/dist/src/data-source/collection-browser-query-state.js +1 -1
- package/dist/src/data-source/models.d.ts +28 -28
- package/dist/src/data-source/models.js +8 -8
- package/dist/src/empty-placeholder.d.ts +23 -23
- package/dist/src/empty-placeholder.js +74 -74
- package/dist/src/expanded-date-picker.d.ts +43 -43
- package/dist/src/expanded-date-picker.js +109 -109
- 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/manage/manage-bar.d.ts +26 -26
- package/dist/src/manage/manage-bar.js +53 -53
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +91 -91
- package/dist/src/models.d.ts +198 -198
- package/dist/src/models.js +381 -381
- package/dist/src/restoration-state-handler.d.ts +70 -70
- package/dist/src/restoration-state-handler.js +357 -357
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
- package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
- 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-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.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 +221 -219
- package/dist/src/sort-filter-bar/sort-filter-bar.js +695 -685
- 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 +9 -9
- package/dist/src/styles/sr-only.d.ts +1 -1
- package/dist/src/styles/sr-only.js +2 -2
- package/dist/src/tiles/base-tile-component.d.ts +19 -19
- package/dist/src/tiles/base-tile-component.js +63 -63
- 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 +18 -18
- package/dist/src/tiles/grid/account-tile.js +72 -72
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
- package/dist/src/tiles/grid/collection-tile.js +80 -80
- package/dist/src/tiles/grid/item-tile.d.ts +30 -30
- package/dist/src/tiles/grid/item-tile.js +149 -149
- package/dist/src/tiles/grid/search-tile.d.ts +10 -10
- package/dist/src/tiles/grid/search-tile.js +51 -51
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
- package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
- package/dist/src/tiles/grid/tile-stats.js +53 -53
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
- package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +73 -73
- package/dist/src/tiles/item-image.d.ts +39 -39
- package/dist/src/tiles/item-image.js +154 -154
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
- package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
- package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
- package/dist/src/tiles/list/tile-list-compact.js +114 -114
- package/dist/src/tiles/list/tile-list.d.ts +50 -50
- package/dist/src/tiles/list/tile-list.js +315 -315
- 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 -10
- package/dist/src/tiles/overlay/icon-overlay.js +40 -40
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/text-overlay.js +42 -42
- package/dist/src/tiles/review-block.d.ts +12 -12
- package/dist/src/tiles/review-block.js +56 -56
- package/dist/src/tiles/text-snippet-block.d.ts +27 -27
- package/dist/src/tiles/text-snippet-block.js +73 -73
- package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
- package/dist/src/tiles/tile-dispatcher.js +232 -232
- package/dist/src/tiles/tile-display-value-provider.d.ts +47 -47
- package/dist/src/tiles/tile-display-value-provider.js +94 -94
- package/dist/src/utils/analytics-events.d.ts +25 -25
- package/dist/src/utils/analytics-events.js +27 -27
- package/dist/src/utils/array-equals.d.ts +4 -4
- package/dist/src/utils/array-equals.js +10 -10
- package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -11
- package/dist/src/utils/collapse-repeated-quotes.js +13 -13
- 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 +25 -25
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/src/utils/local-date-from-utc.d.ts +9 -9
- package/dist/src/utils/local-date-from-utc.js +15 -15
- package/dist/src/utils/log.d.ts +7 -7
- package/dist/src/utils/log.js +15 -15
- package/dist/src/utils/resolve-mediatype.d.ts +8 -8
- package/dist/src/utils/resolve-mediatype.js +23 -23
- package/dist/src/utils/sha1.d.ts +2 -2
- package/dist/src/utils/sha1.js +8 -8
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +1215 -1215
- package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
- package/dist/test/collection-facets/facet-row.test.js +203 -203
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +105 -105
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +133 -133
- 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/toggle-switch.test.d.ts +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +73 -73
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +652 -652
- package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.js +89 -89
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +63 -63
- package/dist/test/expanded-date-picker.test.d.ts +1 -1
- package/dist/test/expanded-date-picker.test.js +95 -95
- 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 +85 -85
- package/dist/test/manage/manage-bar.test.d.ts +1 -1
- package/dist/test/manage/manage-bar.test.js +72 -72
- 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-search-responses.d.ts +24 -24
- package/dist/test/mocks/mock-search-responses.js +840 -840
- package/dist/test/mocks/mock-search-service.d.ts +15 -15
- package/dist/test/mocks/mock-search-service.js +53 -53
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +270 -270
- package/dist/test/review-block.test.d.ts +1 -1
- package/dist/test/review-block.test.js +44 -44
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
- 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 +420 -420
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -48
- 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 +81 -81
- package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +76 -76
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +73 -73
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +312 -312
- package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +51 -51
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -259
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +297 -297
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +100 -100
- package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
- package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
- package/dist/test/utils/array-equals.test.d.ts +1 -1
- package/dist/test/utils/array-equals.test.js +26 -26
- 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/dist/test/utils/format-unit-size.test.d.ts +1 -1
- package/dist/test/utils/format-unit-size.test.js +17 -17
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
- package/dist/test/utils/local-date-from-utc.test.js +26 -26
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +1 -1
- package/renovate.json +6 -6
- package/src/app-root.ts +59 -23
- package/src/collection-browser.ts +6 -1
- package/src/sort-filter-bar/sort-filter-bar.ts +10 -1
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/types/sentry.d.ts +0 -1
|
@@ -1,314 +1,315 @@
|
|
|
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 { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import { msg } from '@lit/localize';
|
|
7
|
-
import { SearchType, } from '@internetarchive/search-service';
|
|
8
|
-
import '@internetarchive/infinite-scroller';
|
|
9
|
-
import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
|
|
10
|
-
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
11
|
-
import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
|
|
12
|
-
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
13
|
-
import chevronIcon from './assets/img/icons/chevron';
|
|
14
|
-
import { srOnlyStyle } from './styles/sr-only';
|
|
15
|
-
import { sha1 } from './utils/sha1';
|
|
16
|
-
import { formatDate } from './utils/format-date';
|
|
17
|
-
import { log } from './utils/log';
|
|
18
|
-
import './empty-placeholder';
|
|
19
|
-
import './tiles/tile-dispatcher';
|
|
20
|
-
import './tiles/collection-browser-loading-tile';
|
|
21
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
22
|
-
import './manage/manage-bar';
|
|
23
|
-
import './collection-facets';
|
|
24
|
-
import './circular-activity-indicator';
|
|
25
|
-
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
26
|
-
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
this.baseImageUrl = 'https://archive.org';
|
|
29
|
-
this.searchType = SearchType.METADATA;
|
|
30
|
-
this.defaultSortParam = null;
|
|
31
|
-
this.selectedSort = SortField.default;
|
|
32
|
-
this.selectedTitleFilter = null;
|
|
33
|
-
this.selectedCreatorFilter = null;
|
|
34
|
-
this.sortDirection = null;
|
|
35
|
-
this.pageSize = 50;
|
|
36
|
-
this.showHistogramDatePicker = false;
|
|
37
|
-
this.suppressPlaceholders = false;
|
|
38
|
-
this.suppressResultCount = false;
|
|
39
|
-
this.suppressResultTiles = false;
|
|
40
|
-
this.suppressURLQuery = false;
|
|
41
|
-
this.suppressFacets = false;
|
|
42
|
-
this.suppressSortBar = false;
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
this
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
//
|
|
136
|
-
this
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// the
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
//
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.
|
|
270
|
-
this.
|
|
271
|
-
this.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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 { classMap } from 'lit/directives/class-map.js';
|
|
6
|
+
import { msg } from '@lit/localize';
|
|
7
|
+
import { SearchType, } from '@internetarchive/search-service';
|
|
8
|
+
import '@internetarchive/infinite-scroller';
|
|
9
|
+
import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
|
|
10
|
+
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
11
|
+
import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
|
|
12
|
+
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
13
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
14
|
+
import { srOnlyStyle } from './styles/sr-only';
|
|
15
|
+
import { sha1 } from './utils/sha1';
|
|
16
|
+
import { formatDate } from './utils/format-date';
|
|
17
|
+
import { log } from './utils/log';
|
|
18
|
+
import './empty-placeholder';
|
|
19
|
+
import './tiles/tile-dispatcher';
|
|
20
|
+
import './tiles/collection-browser-loading-tile';
|
|
21
|
+
import './sort-filter-bar/sort-filter-bar';
|
|
22
|
+
import './manage/manage-bar';
|
|
23
|
+
import './collection-facets';
|
|
24
|
+
import './circular-activity-indicator';
|
|
25
|
+
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.baseImageUrl = 'https://archive.org';
|
|
29
|
+
this.searchType = SearchType.METADATA;
|
|
30
|
+
this.defaultSortParam = null;
|
|
31
|
+
this.selectedSort = SortField.default;
|
|
32
|
+
this.selectedTitleFilter = null;
|
|
33
|
+
this.selectedCreatorFilter = null;
|
|
34
|
+
this.sortDirection = null;
|
|
35
|
+
this.pageSize = 50;
|
|
36
|
+
this.showHistogramDatePicker = false;
|
|
37
|
+
this.suppressPlaceholders = false;
|
|
38
|
+
this.suppressResultCount = false;
|
|
39
|
+
this.suppressResultTiles = false;
|
|
40
|
+
this.suppressURLQuery = false;
|
|
41
|
+
this.suppressFacets = false;
|
|
42
|
+
this.suppressSortBar = false;
|
|
43
|
+
this.suppressDisplayModes = false;
|
|
44
|
+
this.clearResultsOnEmptyQuery = false;
|
|
45
|
+
this.collectionPagePath = '/details/';
|
|
46
|
+
/** describes where this component is being used */
|
|
47
|
+
this.searchContext = analyticsCategories.default;
|
|
48
|
+
this.pageContext = 'search';
|
|
49
|
+
this.restorationStateHandler = new RestorationStateHandler({
|
|
50
|
+
context: this.pageContext,
|
|
51
|
+
});
|
|
52
|
+
this.mobileBreakpoint = 600;
|
|
53
|
+
this.loggedIn = false;
|
|
54
|
+
this.modalManager = undefined;
|
|
55
|
+
/**
|
|
56
|
+
* If item management UI active
|
|
57
|
+
*/
|
|
58
|
+
this.isManageView = false;
|
|
59
|
+
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
60
|
+
this.enableSortOptionsSlot = false;
|
|
61
|
+
/**
|
|
62
|
+
* The results per page so we can paginate.
|
|
63
|
+
*
|
|
64
|
+
* This allows us to start in the middle of the search results and
|
|
65
|
+
* fetch data before or after the current page. If we don't have a key
|
|
66
|
+
* for the previous/next page, we'll fetch the next/previous page to populate it
|
|
67
|
+
*/
|
|
68
|
+
this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
|
|
69
|
+
/**
|
|
70
|
+
* The page that the consumer wants to load.
|
|
71
|
+
*/
|
|
72
|
+
this.initialPageNumber = 1;
|
|
73
|
+
/**
|
|
74
|
+
* This the the number of pages that we want to show.
|
|
75
|
+
*
|
|
76
|
+
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
77
|
+
* know how many cells we should render.
|
|
78
|
+
*/
|
|
79
|
+
this.pagesToRender = this.initialPageNumber;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the initial page fetch for a new query is currently in progress.
|
|
82
|
+
*/
|
|
83
|
+
this.searchResultsLoading = false;
|
|
84
|
+
this.facetsLoading = false;
|
|
85
|
+
this.mobileView = false;
|
|
86
|
+
this.mobileFacetsVisible = false;
|
|
87
|
+
this.defaultSortField = SortField.relevance;
|
|
88
|
+
this.defaultSortDirection = null;
|
|
89
|
+
this.placeholderType = null;
|
|
90
|
+
/**
|
|
91
|
+
* When we're animated scrolling to the page, we don't want to fetch
|
|
92
|
+
* all of the pages as it scrolls so this lets us know if we're scrolling
|
|
93
|
+
*/
|
|
94
|
+
this.isScrollingToCell = false;
|
|
95
|
+
/**
|
|
96
|
+
* When page width resizes from desktop to mobile, set true to
|
|
97
|
+
* disable expand/collapse transition when loading.
|
|
98
|
+
*/
|
|
99
|
+
this.isResizeToMobile = false;
|
|
100
|
+
/**
|
|
101
|
+
* Flag indicating that a new data source is currently being installed.
|
|
102
|
+
* During the install, any URL persistence operation should replace the current entry
|
|
103
|
+
* instead of creating a new one.
|
|
104
|
+
*/
|
|
105
|
+
this.dataSourceInstallInProgress = false;
|
|
106
|
+
this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
107
|
+
/**
|
|
108
|
+
* How many tiles to offset the data source by, to account for any removed tiles.
|
|
109
|
+
*/
|
|
110
|
+
this.tileModelOffset = 0;
|
|
111
|
+
/**
|
|
112
|
+
* Updates the height of the left column according to its position on the page.
|
|
113
|
+
* Arrow function ensures proper `this` binding.
|
|
114
|
+
*/
|
|
115
|
+
this.updateLeftColumnHeight = () => {
|
|
116
|
+
var _a, _b, _c, _d, _e;
|
|
117
|
+
if (this.mobileView) {
|
|
118
|
+
(_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
|
|
122
|
+
(_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Toggles whether the fade-out is visible at the bottom of the facets.
|
|
127
|
+
* It should only be visible if the facets are not scrolled to the bottom.
|
|
128
|
+
* Arrow function ensures proper `this` binding.
|
|
129
|
+
*/
|
|
130
|
+
this.updateFacetFadeOut = (entries) => {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
|
|
133
|
+
fadeElmt === null || fadeElmt === void 0 ? void 0 : fadeElmt.classList.toggle('hidden', (_b = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _b === void 0 ? void 0 : _b.isIntersecting);
|
|
134
|
+
};
|
|
135
|
+
// we only want to scroll on the very first query change
|
|
136
|
+
// so this keeps track of whether we've already set the initial query
|
|
137
|
+
this.initialQueryChangeHappened = false;
|
|
138
|
+
this.historyPopOccurred = false;
|
|
139
|
+
this.addController(this.dataSource);
|
|
140
|
+
}
|
|
141
|
+
tileModelAtCellIndex(index) {
|
|
142
|
+
const model = this.dataSource.getTileModelAt(index);
|
|
143
|
+
/**
|
|
144
|
+
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
145
|
+
* automated scroll, fetch the page and just return undefined.
|
|
146
|
+
* The datasource will be updated once the page is loaded and the cell will be rendered.
|
|
147
|
+
*
|
|
148
|
+
* We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
|
|
149
|
+
* user may never see.
|
|
150
|
+
*/
|
|
151
|
+
if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
|
|
152
|
+
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
153
|
+
this.dataSource.fetchPage(pageNumber);
|
|
154
|
+
}
|
|
155
|
+
return model;
|
|
156
|
+
}
|
|
157
|
+
// this is the total number of tiles we expect if
|
|
158
|
+
// the data returned is a full page worth
|
|
159
|
+
// this is useful for putting in placeholders for the expected number of tiles
|
|
160
|
+
get estimatedTileCount() {
|
|
161
|
+
return this.pagesToRender * this.pageSize;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Returns a promise resolving to a unique string that persists for the current browser session.
|
|
165
|
+
* Used in generating unique IDs for search requests, so that multiple requests coming from the
|
|
166
|
+
* same browser session can be identified.
|
|
167
|
+
*/
|
|
168
|
+
async getSessionId() {
|
|
169
|
+
try {
|
|
170
|
+
const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
|
|
171
|
+
if (storedSessionId) {
|
|
172
|
+
return storedSessionId;
|
|
173
|
+
}
|
|
174
|
+
// If we enter this method a second time while a first session ID is already being generated,
|
|
175
|
+
// ensure we produce the same ID from both calls instead of generating another one.
|
|
176
|
+
if (this.sessionIdGenPromise) {
|
|
177
|
+
return this.sessionIdGenPromise;
|
|
178
|
+
}
|
|
179
|
+
this.sessionIdGenPromise = sha1(Math.random().toString());
|
|
180
|
+
const newSessionId = await this.sessionIdGenPromise;
|
|
181
|
+
sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
|
|
182
|
+
return newSessionId;
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
// Either we can't generate the hash or we're restricted from accessing sessionStorage
|
|
186
|
+
return '';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Go to the given page of results
|
|
191
|
+
*
|
|
192
|
+
* @param pageNumber
|
|
193
|
+
*/
|
|
194
|
+
goToPage(pageNumber) {
|
|
195
|
+
this.initialPageNumber = pageNumber;
|
|
196
|
+
this.pagesToRender = pageNumber;
|
|
197
|
+
return this.scrollToPage(pageNumber);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Sets the state for whether the initial set of search results is loading in.
|
|
201
|
+
*/
|
|
202
|
+
setSearchResultsLoading(loading) {
|
|
203
|
+
this.searchResultsLoading = loading;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Sets the state for whether facet data is loading in
|
|
207
|
+
*/
|
|
208
|
+
setFacetsLoading(loading) {
|
|
209
|
+
this.facetsLoading = loading;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Sets the total number of results to be displayed for the current search
|
|
213
|
+
*/
|
|
214
|
+
setTotalResultCount(totalResults) {
|
|
215
|
+
this.totalResults = totalResults;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Clears all selected/negated facets, date ranges, and letter filters.
|
|
219
|
+
*
|
|
220
|
+
* By default, the current sort field/direction are not cleared,
|
|
221
|
+
* but this can be overridden by setting the `sort` option to `true`.
|
|
222
|
+
*
|
|
223
|
+
* Similarly, it is possible to finely control what is cleared by
|
|
224
|
+
* setting any of the `facets`, `dateRange`, or `letterFilters` flags
|
|
225
|
+
* in the options object.
|
|
226
|
+
*/
|
|
227
|
+
clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
|
|
228
|
+
// Don't bother clearing facets if none are checked, so that we don't
|
|
229
|
+
// trigger unnecessary update cycles.
|
|
230
|
+
if (facets && this.hasCheckedFacets) {
|
|
231
|
+
this.selectedFacets = getDefaultSelectedFacets();
|
|
232
|
+
}
|
|
233
|
+
if (dateRange) {
|
|
234
|
+
this.minSelectedDate = undefined;
|
|
235
|
+
this.maxSelectedDate = undefined;
|
|
236
|
+
}
|
|
237
|
+
if (letterFilters) {
|
|
238
|
+
this.selectedTitleFilter = null;
|
|
239
|
+
this.selectedCreatorFilter = null;
|
|
240
|
+
}
|
|
241
|
+
if (sort) {
|
|
242
|
+
this.sortDirection = null;
|
|
243
|
+
this.selectedSort = SortField.default;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Returns true if the current value of `this.selectedFacets` contains
|
|
248
|
+
* any facet buckets than have been selected or negated, or false otherwise.
|
|
249
|
+
*/
|
|
250
|
+
get hasCheckedFacets() {
|
|
251
|
+
if (!this.selectedFacets)
|
|
252
|
+
return false;
|
|
253
|
+
for (const facetGroup of Object.values(this.selectedFacets)) {
|
|
254
|
+
for (const bucket of Object.values(facetGroup)) {
|
|
255
|
+
if (bucket.state !== 'none')
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Returns true if there are any currently selected/negated facet buckets,
|
|
263
|
+
* any selected date range, or any selected letter filters. False otherwise.
|
|
264
|
+
*
|
|
265
|
+
* Ignores sorting options.
|
|
266
|
+
*/
|
|
267
|
+
get hasActiveFilters() {
|
|
268
|
+
return !!(this.hasCheckedFacets ||
|
|
269
|
+
this.minSelectedDate ||
|
|
270
|
+
this.maxSelectedDate ||
|
|
271
|
+
this.selectedTitleFilter ||
|
|
272
|
+
this.selectedCreatorFilter);
|
|
273
|
+
}
|
|
274
|
+
render() {
|
|
275
|
+
this.setPlaceholderType();
|
|
275
276
|
return html `
|
|
276
277
|
<div
|
|
277
278
|
id="content-container"
|
|
278
279
|
class=${this.mobileView ? 'mobile' : 'desktop'}
|
|
279
280
|
>
|
|
280
|
-
${this.placeholderType
|
|
281
|
-
? this.emptyPlaceholderTemplate
|
|
281
|
+
${this.placeholderType
|
|
282
|
+
? this.emptyPlaceholderTemplate
|
|
282
283
|
: this.collectionBrowserTemplate}
|
|
283
284
|
</div>
|
|
284
|
-
`;
|
|
285
|
-
}
|
|
286
|
-
setPlaceholderType() {
|
|
287
|
-
var _a;
|
|
288
|
-
const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
289
|
-
const isCollection = !!this.withinCollection;
|
|
290
|
-
const isProfile = !!this.withinProfile;
|
|
291
|
-
const noResults = !this.searchResultsLoading &&
|
|
292
|
-
(this.dataSource.size === 0 || !this.searchService);
|
|
293
|
-
this.placeholderType = null;
|
|
294
|
-
if (this.suppressPlaceholders)
|
|
295
|
-
return;
|
|
296
|
-
if (!hasQuery && !isCollection && !isProfile) {
|
|
297
|
-
this.placeholderType = 'empty-query';
|
|
298
|
-
}
|
|
299
|
-
else if (noResults) {
|
|
300
|
-
// Within a collection, no query + no results means the collection simply has no viewable items.
|
|
301
|
-
// Otherwise, we must have a user query that produced 0 results.
|
|
302
|
-
this.placeholderType =
|
|
303
|
-
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
304
|
-
}
|
|
305
|
-
if (this.dataSource.queryErrorMessage) {
|
|
306
|
-
this.placeholderType =
|
|
307
|
-
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
get emptyPlaceholderTemplate() {
|
|
311
|
-
var _a;
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
setPlaceholderType() {
|
|
288
|
+
var _a;
|
|
289
|
+
const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
290
|
+
const isCollection = !!this.withinCollection;
|
|
291
|
+
const isProfile = !!this.withinProfile;
|
|
292
|
+
const noResults = !this.searchResultsLoading &&
|
|
293
|
+
(this.dataSource.size === 0 || !this.searchService);
|
|
294
|
+
this.placeholderType = null;
|
|
295
|
+
if (this.suppressPlaceholders)
|
|
296
|
+
return;
|
|
297
|
+
if (!hasQuery && !isCollection && !isProfile) {
|
|
298
|
+
this.placeholderType = 'empty-query';
|
|
299
|
+
}
|
|
300
|
+
else if (noResults) {
|
|
301
|
+
// Within a collection, no query + no results means the collection simply has no viewable items.
|
|
302
|
+
// Otherwise, we must have a user query that produced 0 results.
|
|
303
|
+
this.placeholderType =
|
|
304
|
+
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
305
|
+
}
|
|
306
|
+
if (this.dataSource.queryErrorMessage) {
|
|
307
|
+
this.placeholderType =
|
|
308
|
+
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
get emptyPlaceholderTemplate() {
|
|
312
|
+
var _a;
|
|
312
313
|
return html `
|
|
313
314
|
<empty-placeholder
|
|
314
315
|
.placeholderType=${this.placeholderType}
|
|
@@ -317,33 +318,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
317
318
|
.detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
|
|
318
319
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
319
320
|
></empty-placeholder>
|
|
320
|
-
`;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Top-level template for rendering the left (facets) and right (results) columns.
|
|
324
|
-
*/
|
|
325
|
-
get collectionBrowserTemplate() {
|
|
321
|
+
`;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Top-level template for rendering the left (facets) and right (results) columns.
|
|
325
|
+
*/
|
|
326
|
+
get collectionBrowserTemplate() {
|
|
326
327
|
return html `
|
|
327
328
|
<div id="left-column-scroll-sentinel"></div>
|
|
328
329
|
${this.leftColumnTemplate} ${this.rightColumnTemplate}
|
|
329
|
-
`;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Template for either the mobile or desktop version of the left column, depending
|
|
333
|
-
* on current component state.
|
|
334
|
-
*/
|
|
335
|
-
get leftColumnTemplate() {
|
|
336
|
-
if (this.mobileView) {
|
|
337
|
-
return this.mobileLeftColumnTemplate;
|
|
338
|
-
}
|
|
339
|
-
return this.desktopLeftColumnTemplate;
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Template for the mobile version of the "left column" (which in this case, appears
|
|
343
|
-
* *above* the search results rather than beside them), for rendering the
|
|
344
|
-
* accordion-style facets.
|
|
345
|
-
*/
|
|
346
|
-
get mobileLeftColumnTemplate() {
|
|
330
|
+
`;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Template for either the mobile or desktop version of the left column, depending
|
|
334
|
+
* on current component state.
|
|
335
|
+
*/
|
|
336
|
+
get leftColumnTemplate() {
|
|
337
|
+
if (this.mobileView) {
|
|
338
|
+
return this.mobileLeftColumnTemplate;
|
|
339
|
+
}
|
|
340
|
+
return this.desktopLeftColumnTemplate;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Template for the mobile version of the "left column" (which in this case, appears
|
|
344
|
+
* *above* the search results rather than beside them), for rendering the
|
|
345
|
+
* accordion-style facets.
|
|
346
|
+
*/
|
|
347
|
+
get mobileLeftColumnTemplate() {
|
|
347
348
|
return html `
|
|
348
349
|
<div
|
|
349
350
|
id="left-column"
|
|
@@ -352,12 +353,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
352
353
|
${this.facetTopViewSlot} ${this.resultsCountTemplate}
|
|
353
354
|
<div id="facets-header-container">${this.mobileFacetsTemplate}</div>
|
|
354
355
|
</div>
|
|
355
|
-
`;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Template for the desktop version of the left column, displaying the facets sidebar.
|
|
359
|
-
*/
|
|
360
|
-
get desktopLeftColumnTemplate() {
|
|
356
|
+
`;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Template for the desktop version of the left column, displaying the facets sidebar.
|
|
360
|
+
*/
|
|
361
|
+
get desktopLeftColumnTemplate() {
|
|
361
362
|
return html `
|
|
362
363
|
<div id="left-column" class="column">
|
|
363
364
|
${this.facetTopViewSlot}
|
|
@@ -371,28 +372,28 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
371
372
|
</div>
|
|
372
373
|
<div id="facets-bottom-fade"></div>
|
|
373
374
|
</div>
|
|
374
|
-
`;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Slot which is placed at top of the facets area for user-profile page
|
|
378
|
-
* - mainly used to render userlists
|
|
379
|
-
*/
|
|
380
|
-
get facetTopViewSlot() {
|
|
375
|
+
`;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Slot which is placed at top of the facets area for user-profile page
|
|
379
|
+
* - mainly used to render userlists
|
|
380
|
+
*/
|
|
381
|
+
get facetTopViewSlot() {
|
|
381
382
|
return html `<div id="facet-top-view">
|
|
382
383
|
<slot name="facet-top-slot"></slot>
|
|
383
|
-
</div>`;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Template for the "X Results" count at the top of the search results.
|
|
387
|
-
* Changes to the "Searching..." label if the search results are still loading.
|
|
388
|
-
*/
|
|
389
|
-
get resultsCountTemplate() {
|
|
390
|
-
var _a;
|
|
391
|
-
if (this.suppressResultCount)
|
|
392
|
-
return nothing;
|
|
393
|
-
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
394
|
-
const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
|
|
395
|
-
const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
|
|
384
|
+
</div>`;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Template for the "X Results" count at the top of the search results.
|
|
388
|
+
* Changes to the "Searching..." label if the search results are still loading.
|
|
389
|
+
*/
|
|
390
|
+
get resultsCountTemplate() {
|
|
391
|
+
var _a;
|
|
392
|
+
if (this.suppressResultCount)
|
|
393
|
+
return nothing;
|
|
394
|
+
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
395
|
+
const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
|
|
396
|
+
const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
|
|
396
397
|
return html `
|
|
397
398
|
<div id="results-total">
|
|
398
399
|
<span id="big-results-count">
|
|
@@ -402,30 +403,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
402
403
|
${shouldShowSearching ? nothing : resultsLabel}
|
|
403
404
|
</span>
|
|
404
405
|
</div>
|
|
405
|
-
`;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Template for the right column of the collection browser, where the result
|
|
409
|
-
* tiles and sort/filter bar are shown.
|
|
410
|
-
*/
|
|
411
|
-
get rightColumnTemplate() {
|
|
406
|
+
`;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Template for the right column of the collection browser, where the result
|
|
410
|
+
* tiles and sort/filter bar are shown.
|
|
411
|
+
*/
|
|
412
|
+
get rightColumnTemplate() {
|
|
412
413
|
return html `
|
|
413
414
|
<div id="right-column" class="column">
|
|
414
415
|
<div id="cb-top-view">
|
|
415
416
|
<slot name="cb-top-slot"></slot>
|
|
416
417
|
</div>
|
|
417
|
-
${this.isManageView
|
|
418
|
-
? this.manageBarTemplate
|
|
418
|
+
${this.isManageView
|
|
419
|
+
? this.manageBarTemplate
|
|
419
420
|
: this.sortFilterBarTemplate}
|
|
420
421
|
<slot name="cb-results"></slot>
|
|
421
|
-
${this.displayMode === `list-compact`
|
|
422
|
-
? this.listHeaderTemplate
|
|
422
|
+
${this.displayMode === `list-compact`
|
|
423
|
+
? this.listHeaderTemplate
|
|
423
424
|
: nothing}
|
|
424
425
|
${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
|
|
425
426
|
</div>
|
|
426
|
-
`;
|
|
427
|
-
}
|
|
428
|
-
get infiniteScrollerTemplate() {
|
|
427
|
+
`;
|
|
428
|
+
}
|
|
429
|
+
get infiniteScrollerTemplate() {
|
|
429
430
|
return html `<infinite-scroller
|
|
430
431
|
class=${this.infiniteScrollerClasses}
|
|
431
432
|
itemCount=${this.placeholderType ? 0 : nothing}
|
|
@@ -434,22 +435,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
434
435
|
.placeholderCellTemplate=${this.placeholderCellTemplate}
|
|
435
436
|
@scrollThresholdReached=${this.scrollThresholdReached}
|
|
436
437
|
@visibleCellsChanged=${this.visibleCellsChanged}
|
|
437
|
-
>${this.displayMode === 'grid'
|
|
438
|
-
? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
|
|
438
|
+
>${this.displayMode === 'grid'
|
|
439
|
+
? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
|
|
439
440
|
: nothing}
|
|
440
|
-
</infinite-scroller>`;
|
|
441
|
-
}
|
|
442
|
-
get infiniteScrollerClasses() {
|
|
443
|
-
var _a;
|
|
444
|
-
return classMap({
|
|
445
|
-
[(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
|
|
446
|
-
hidden: !!this.placeholderType,
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
get sortFilterBarTemplate() {
|
|
450
|
-
var _a;
|
|
451
|
-
if (this.suppressSortBar)
|
|
452
|
-
return nothing;
|
|
441
|
+
</infinite-scroller>`;
|
|
442
|
+
}
|
|
443
|
+
get infiniteScrollerClasses() {
|
|
444
|
+
var _a;
|
|
445
|
+
return classMap({
|
|
446
|
+
[(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
|
|
447
|
+
hidden: !!this.placeholderType,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
get sortFilterBarTemplate() {
|
|
451
|
+
var _a;
|
|
452
|
+
if (this.suppressSortBar)
|
|
453
|
+
return nothing;
|
|
453
454
|
return html `
|
|
454
455
|
<sort-filter-bar
|
|
455
456
|
.defaultSortField=${this.defaultSortField}
|
|
@@ -464,6 +465,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
464
465
|
.prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
|
|
465
466
|
.resizeObserver=${this.resizeObserver}
|
|
466
467
|
.enableSortOptionsSlot=${this.enableSortOptionsSlot}
|
|
468
|
+
.suppressDisplayModes=${this.suppressDisplayModes}
|
|
467
469
|
@sortChanged=${this.userChangedSort}
|
|
468
470
|
@displayModeChanged=${this.displayModeChanged}
|
|
469
471
|
@titleLetterChanged=${this.titleLetterSelected}
|
|
@@ -471,10 +473,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
471
473
|
>
|
|
472
474
|
<slot name="sort-options-left" slot="sort-options-left"></slot>
|
|
473
475
|
<slot name="sort-options" slot="sort-options"></slot>
|
|
476
|
+
<slot name="sort-options-right" slot="sort-options-right"></slot>
|
|
474
477
|
</sort-filter-bar>
|
|
475
|
-
`;
|
|
476
|
-
}
|
|
477
|
-
get manageBarTemplate() {
|
|
478
|
+
`;
|
|
479
|
+
}
|
|
480
|
+
get manageBarTemplate() {
|
|
478
481
|
return html `
|
|
479
482
|
<manage-bar
|
|
480
483
|
showSelectAll
|
|
@@ -482,163 +485,163 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
482
485
|
@removeItems=${this.handleRemoveItems}
|
|
483
486
|
@selectAll=${() => this.dataSource.checkAllTiles()}
|
|
484
487
|
@unselectAll=${() => this.dataSource.uncheckAllTiles()}
|
|
485
|
-
@cancel=${() => {
|
|
486
|
-
this.isManageView = false;
|
|
487
|
-
this.dataSource.uncheckAllTiles();
|
|
488
|
+
@cancel=${() => {
|
|
489
|
+
this.isManageView = false;
|
|
490
|
+
this.dataSource.uncheckAllTiles();
|
|
488
491
|
}}
|
|
489
492
|
></manage-bar>
|
|
490
|
-
`;
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Handler for when the user requests to remove all checked items via the manage bar.
|
|
494
|
-
* Emits an `itemRemovalRequested` event with all checked tile models.
|
|
495
|
-
*/
|
|
496
|
-
handleRemoveItems() {
|
|
497
|
-
this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
|
|
498
|
-
detail: {
|
|
499
|
-
items: this.dataSource.checkedTileModels.map(model => {
|
|
500
|
-
const cloned = model.clone();
|
|
501
|
-
cloned.dateStr = formatDate(model.datePublished, 'long');
|
|
502
|
-
return cloned;
|
|
503
|
-
}),
|
|
504
|
-
},
|
|
505
|
-
}));
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Removes all tile models that are currently checked & adjusts the paging
|
|
509
|
-
* of the data source to account for any new gaps in the data.
|
|
510
|
-
*/
|
|
511
|
-
removeCheckedTiles() {
|
|
512
|
-
this.dataSource.removeCheckedTiles();
|
|
513
|
-
}
|
|
514
|
-
userChangedSort(e) {
|
|
515
|
-
var _a;
|
|
516
|
-
const { selectedSort, sortDirection } = e.detail;
|
|
517
|
-
this.selectedSort = selectedSort;
|
|
518
|
-
this.sortDirection = sortDirection;
|
|
519
|
-
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
520
|
-
this.goToPage(1);
|
|
521
|
-
}
|
|
522
|
-
this.currentPage = 1;
|
|
523
|
-
}
|
|
524
|
-
sendSortByAnalytics(prevSortDirection) {
|
|
525
|
-
var _a;
|
|
526
|
-
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
527
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
528
|
-
category: this.searchContext,
|
|
529
|
-
action: analyticsActions.sortBy,
|
|
530
|
-
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
selectedSortChanged() {
|
|
534
|
-
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
535
|
-
this.dataSource.updatePrefixFiltersForCurrentSort();
|
|
536
|
-
}
|
|
537
|
-
get sortParam() {
|
|
538
|
-
var _a;
|
|
539
|
-
const sortOption = SORT_OPTIONS[this.selectedSort];
|
|
540
|
-
if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
|
|
541
|
-
return null;
|
|
542
|
-
}
|
|
543
|
-
// If the sort option specified in the URL is unrecognized, we just use it as-is
|
|
544
|
-
const urlSortParam = new URL(window.location.href).searchParams.get('sort');
|
|
545
|
-
const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
|
|
546
|
-
// If the sort direction is still null at this point, then we assume ascending
|
|
547
|
-
// (i.e., it was unrecognized and had no directional flag)
|
|
548
|
-
if (!this.sortDirection)
|
|
549
|
-
this.sortDirection = 'asc';
|
|
550
|
-
if (!sortField)
|
|
551
|
-
return null;
|
|
552
|
-
return { field: sortField, direction: this.sortDirection };
|
|
553
|
-
}
|
|
554
|
-
displayModeChanged(e) {
|
|
555
|
-
var _a;
|
|
556
|
-
this.displayMode = e.detail.displayMode;
|
|
557
|
-
if (this.displayMode) {
|
|
558
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
559
|
-
category: this.searchContext,
|
|
560
|
-
action: analyticsActions.displayMode,
|
|
561
|
-
label: this.displayMode,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Returns a query clause identifying the currently selected title filter,
|
|
567
|
-
* e.g., `firstTitle:X`.
|
|
568
|
-
*/
|
|
569
|
-
get titleQuery() {
|
|
570
|
-
return this.selectedTitleFilter
|
|
571
|
-
? `firstTitle:${this.selectedTitleFilter}`
|
|
572
|
-
: undefined;
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Returns a query clause identifying the currently selected creator filter,
|
|
576
|
-
* e.g., `firstCreator:X`.
|
|
577
|
-
*/
|
|
578
|
-
get creatorQuery() {
|
|
579
|
-
return this.selectedCreatorFilter
|
|
580
|
-
? `firstCreator:${this.selectedCreatorFilter}`
|
|
581
|
-
: undefined;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Send Analytics when sorting by title's first letter
|
|
585
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
586
|
-
*/
|
|
587
|
-
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
588
|
-
var _a;
|
|
589
|
-
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
const cleared = prevSelectedLetter && !this.selectedTitleFilter;
|
|
593
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
594
|
-
category: this.searchContext,
|
|
595
|
-
action: analyticsActions.filterByTitle,
|
|
596
|
-
label: cleared
|
|
597
|
-
? `clear-${prevSelectedLetter}`
|
|
598
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Send Analytics when filtering by creator's first letter
|
|
603
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
604
|
-
*/
|
|
605
|
-
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
606
|
-
var _a;
|
|
607
|
-
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
|
|
611
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
612
|
-
category: this.searchContext,
|
|
613
|
-
action: analyticsActions.filterByCreator,
|
|
614
|
-
label: cleared
|
|
615
|
-
? `clear-${prevSelectedLetter}`
|
|
616
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Handler for changes to which letter is selected in the title alphabet bar.
|
|
621
|
-
*/
|
|
622
|
-
titleLetterSelected(e) {
|
|
623
|
-
this.selectedCreatorFilter = null;
|
|
624
|
-
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Handler for changes to which letter is selected in the creator alphabet bar.
|
|
628
|
-
*/
|
|
629
|
-
creatorLetterSelected(e) {
|
|
630
|
-
this.selectedTitleFilter = null;
|
|
631
|
-
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* The full template for how the facets should be structured in mobile view,
|
|
635
|
-
* including the collapsible container (with header) and the facets themselves.
|
|
636
|
-
*/
|
|
637
|
-
get mobileFacetsTemplate() {
|
|
638
|
-
const toggleFacetsVisible = () => {
|
|
639
|
-
this.isResizeToMobile = false;
|
|
640
|
-
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
641
|
-
};
|
|
493
|
+
`;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Handler for when the user requests to remove all checked items via the manage bar.
|
|
497
|
+
* Emits an `itemRemovalRequested` event with all checked tile models.
|
|
498
|
+
*/
|
|
499
|
+
handleRemoveItems() {
|
|
500
|
+
this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
|
|
501
|
+
detail: {
|
|
502
|
+
items: this.dataSource.checkedTileModels.map(model => {
|
|
503
|
+
const cloned = model.clone();
|
|
504
|
+
cloned.dateStr = formatDate(model.datePublished, 'long');
|
|
505
|
+
return cloned;
|
|
506
|
+
}),
|
|
507
|
+
},
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Removes all tile models that are currently checked & adjusts the paging
|
|
512
|
+
* of the data source to account for any new gaps in the data.
|
|
513
|
+
*/
|
|
514
|
+
removeCheckedTiles() {
|
|
515
|
+
this.dataSource.removeCheckedTiles();
|
|
516
|
+
}
|
|
517
|
+
userChangedSort(e) {
|
|
518
|
+
var _a;
|
|
519
|
+
const { selectedSort, sortDirection } = e.detail;
|
|
520
|
+
this.selectedSort = selectedSort;
|
|
521
|
+
this.sortDirection = sortDirection;
|
|
522
|
+
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
523
|
+
this.goToPage(1);
|
|
524
|
+
}
|
|
525
|
+
this.currentPage = 1;
|
|
526
|
+
}
|
|
527
|
+
sendSortByAnalytics(prevSortDirection) {
|
|
528
|
+
var _a;
|
|
529
|
+
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
530
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
531
|
+
category: this.searchContext,
|
|
532
|
+
action: analyticsActions.sortBy,
|
|
533
|
+
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
selectedSortChanged() {
|
|
537
|
+
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
538
|
+
this.dataSource.updatePrefixFiltersForCurrentSort();
|
|
539
|
+
}
|
|
540
|
+
get sortParam() {
|
|
541
|
+
var _a;
|
|
542
|
+
const sortOption = SORT_OPTIONS[this.selectedSort];
|
|
543
|
+
if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
// If the sort option specified in the URL is unrecognized, we just use it as-is
|
|
547
|
+
const urlSortParam = new URL(window.location.href).searchParams.get('sort');
|
|
548
|
+
const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
|
|
549
|
+
// If the sort direction is still null at this point, then we assume ascending
|
|
550
|
+
// (i.e., it was unrecognized and had no directional flag)
|
|
551
|
+
if (!this.sortDirection)
|
|
552
|
+
this.sortDirection = 'asc';
|
|
553
|
+
if (!sortField)
|
|
554
|
+
return null;
|
|
555
|
+
return { field: sortField, direction: this.sortDirection };
|
|
556
|
+
}
|
|
557
|
+
displayModeChanged(e) {
|
|
558
|
+
var _a;
|
|
559
|
+
this.displayMode = e.detail.displayMode;
|
|
560
|
+
if (this.displayMode) {
|
|
561
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
562
|
+
category: this.searchContext,
|
|
563
|
+
action: analyticsActions.displayMode,
|
|
564
|
+
label: this.displayMode,
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Returns a query clause identifying the currently selected title filter,
|
|
570
|
+
* e.g., `firstTitle:X`.
|
|
571
|
+
*/
|
|
572
|
+
get titleQuery() {
|
|
573
|
+
return this.selectedTitleFilter
|
|
574
|
+
? `firstTitle:${this.selectedTitleFilter}`
|
|
575
|
+
: undefined;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Returns a query clause identifying the currently selected creator filter,
|
|
579
|
+
* e.g., `firstCreator:X`.
|
|
580
|
+
*/
|
|
581
|
+
get creatorQuery() {
|
|
582
|
+
return this.selectedCreatorFilter
|
|
583
|
+
? `firstCreator:${this.selectedCreatorFilter}`
|
|
584
|
+
: undefined;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Send Analytics when sorting by title's first letter
|
|
588
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
589
|
+
*/
|
|
590
|
+
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
591
|
+
var _a;
|
|
592
|
+
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const cleared = prevSelectedLetter && !this.selectedTitleFilter;
|
|
596
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
597
|
+
category: this.searchContext,
|
|
598
|
+
action: analyticsActions.filterByTitle,
|
|
599
|
+
label: cleared
|
|
600
|
+
? `clear-${prevSelectedLetter}`
|
|
601
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Send Analytics when filtering by creator's first letter
|
|
606
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
607
|
+
*/
|
|
608
|
+
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
609
|
+
var _a;
|
|
610
|
+
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
|
|
614
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
615
|
+
category: this.searchContext,
|
|
616
|
+
action: analyticsActions.filterByCreator,
|
|
617
|
+
label: cleared
|
|
618
|
+
? `clear-${prevSelectedLetter}`
|
|
619
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Handler for changes to which letter is selected in the title alphabet bar.
|
|
624
|
+
*/
|
|
625
|
+
titleLetterSelected(e) {
|
|
626
|
+
this.selectedCreatorFilter = null;
|
|
627
|
+
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Handler for changes to which letter is selected in the creator alphabet bar.
|
|
631
|
+
*/
|
|
632
|
+
creatorLetterSelected(e) {
|
|
633
|
+
this.selectedTitleFilter = null;
|
|
634
|
+
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* The full template for how the facets should be structured in mobile view,
|
|
638
|
+
* including the collapsible container (with header) and the facets themselves.
|
|
639
|
+
*/
|
|
640
|
+
get mobileFacetsTemplate() {
|
|
641
|
+
const toggleFacetsVisible = () => {
|
|
642
|
+
this.isResizeToMobile = false;
|
|
643
|
+
this.mobileFacetsVisible = !this.mobileFacetsVisible;
|
|
644
|
+
};
|
|
642
645
|
return html `
|
|
643
646
|
<details
|
|
644
647
|
id="mobile-filter-collapse"
|
|
@@ -652,19 +655,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
652
655
|
</summary>
|
|
653
656
|
${this.facetsTemplate}
|
|
654
657
|
</details>
|
|
655
|
-
`;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* The template for the facets component alone, without any surrounding wrappers.
|
|
659
|
-
*/
|
|
660
|
-
get facetsTemplate() {
|
|
661
|
-
if (this.suppressFacets) {
|
|
658
|
+
`;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The template for the facets component alone, without any surrounding wrappers.
|
|
662
|
+
*/
|
|
663
|
+
get facetsTemplate() {
|
|
664
|
+
if (this.suppressFacets) {
|
|
662
665
|
return html `
|
|
663
666
|
<p class="facets-message">
|
|
664
667
|
${msg('Facets are temporarily unavailable.')}
|
|
665
668
|
</p>
|
|
666
|
-
`;
|
|
667
|
-
}
|
|
669
|
+
`;
|
|
670
|
+
}
|
|
668
671
|
return html `
|
|
669
672
|
<collection-facets
|
|
670
673
|
@facetsChanged=${this.facetsChanged}
|
|
@@ -678,7 +681,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
678
681
|
.resizeObserver=${this.resizeObserver}
|
|
679
682
|
.searchType=${this.searchType}
|
|
680
683
|
.aggregations=${this.dataSource.aggregations}
|
|
681
|
-
.fullYearsHistogramAggregation=${this.dataSource
|
|
684
|
+
.fullYearsHistogramAggregation=${this.dataSource
|
|
682
685
|
.yearHistogramAggregation}
|
|
683
686
|
.minSelectedDate=${this.minSelectedDate}
|
|
684
687
|
.maxSelectedDate=${this.maxSelectedDate}
|
|
@@ -699,41 +702,41 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
699
702
|
.analyticsHandler=${this.analyticsHandler}
|
|
700
703
|
>
|
|
701
704
|
</collection-facets>
|
|
702
|
-
`;
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* The HTML template for the "Clear all filters" button, or `nothing` if no
|
|
706
|
-
* filters are currently active.
|
|
707
|
-
*
|
|
708
|
-
* @param mobile Whether to style/shorten the button for mobile view
|
|
709
|
-
*/
|
|
710
|
-
clearFiltersBtnTemplate(mobile) {
|
|
711
|
-
if (!this.hasActiveFilters)
|
|
712
|
-
return nothing;
|
|
713
|
-
const buttonClasses = classMap({
|
|
714
|
-
'clear-filters-btn': true,
|
|
715
|
-
mobile,
|
|
716
|
-
});
|
|
717
|
-
const buttonText = mobile ? 'Clear all' : 'Clear all filters';
|
|
705
|
+
`;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* The HTML template for the "Clear all filters" button, or `nothing` if no
|
|
709
|
+
* filters are currently active.
|
|
710
|
+
*
|
|
711
|
+
* @param mobile Whether to style/shorten the button for mobile view
|
|
712
|
+
*/
|
|
713
|
+
clearFiltersBtnTemplate(mobile) {
|
|
714
|
+
if (!this.hasActiveFilters)
|
|
715
|
+
return nothing;
|
|
716
|
+
const buttonClasses = classMap({
|
|
717
|
+
'clear-filters-btn': true,
|
|
718
|
+
mobile,
|
|
719
|
+
});
|
|
720
|
+
const buttonText = mobile ? 'Clear all' : 'Clear all filters';
|
|
718
721
|
return html `
|
|
719
722
|
<div class="clear-filters-btn-row">
|
|
720
|
-
${mobile
|
|
721
|
-
? html `<span class="clear-filters-btn-separator"> </span>`
|
|
723
|
+
${mobile
|
|
724
|
+
? html `<span class="clear-filters-btn-separator"> </span>`
|
|
722
725
|
: nothing}
|
|
723
726
|
<button class=${buttonClasses} @click=${this.clearFilters}>
|
|
724
727
|
${buttonText}
|
|
725
728
|
</button>
|
|
726
729
|
</div>
|
|
727
|
-
`;
|
|
728
|
-
}
|
|
729
|
-
get loadingTemplate() {
|
|
730
|
+
`;
|
|
731
|
+
}
|
|
732
|
+
get loadingTemplate() {
|
|
730
733
|
return html `
|
|
731
734
|
<div class="loading-cover">
|
|
732
735
|
<circular-activity-indicator></circular-activity-indicator>
|
|
733
736
|
</div>
|
|
734
|
-
`;
|
|
735
|
-
}
|
|
736
|
-
get listHeaderTemplate() {
|
|
737
|
+
`;
|
|
738
|
+
}
|
|
739
|
+
get listHeaderTemplate() {
|
|
737
740
|
return html `
|
|
738
741
|
<div id="list-header">
|
|
739
742
|
<tile-dispatcher
|
|
@@ -746,599 +749,600 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
746
749
|
>
|
|
747
750
|
</tile-dispatcher>
|
|
748
751
|
</div>
|
|
749
|
-
`;
|
|
750
|
-
}
|
|
751
|
-
histogramDateRangeUpdated(e) {
|
|
752
|
-
var _a;
|
|
753
|
-
const { minDate, maxDate } = e.detail;
|
|
754
|
-
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
755
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
756
|
-
category: this.searchContext,
|
|
757
|
-
action: analyticsActions.histogramChanged,
|
|
758
|
-
label: this.dateRangeQueryClause,
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
get dateRangeQueryClause() {
|
|
762
|
-
if (!this.minSelectedDate || !this.maxSelectedDate) {
|
|
763
|
-
return undefined;
|
|
764
|
-
}
|
|
765
|
-
return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* Emits an event indicating a change in whether the manage mode is shown.
|
|
769
|
-
*/
|
|
770
|
-
emitManageModeChangedEvent() {
|
|
771
|
-
this.dispatchEvent(new CustomEvent('manageModeChanged', {
|
|
772
|
-
detail: this.isManageView,
|
|
773
|
-
}));
|
|
774
|
-
}
|
|
775
|
-
async installDataSourceAndQueryState(dataSource, queryState) {
|
|
776
|
-
var _a, _b;
|
|
777
|
-
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
778
|
-
if (this.dataSource)
|
|
779
|
-
this.removeController(this.dataSource);
|
|
780
|
-
this.dataSource = dataSource;
|
|
781
|
-
this.addController(this.dataSource);
|
|
782
|
-
this.baseQuery = queryState.baseQuery;
|
|
783
|
-
this.profileElement = queryState.profileElement;
|
|
784
|
-
this.searchType = queryState.searchType;
|
|
785
|
-
this.selectedFacets =
|
|
786
|
-
(_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
|
|
787
|
-
this.minSelectedDate = queryState.minSelectedDate;
|
|
788
|
-
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
789
|
-
this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
|
|
790
|
-
this.sortDirection = queryState.sortDirection;
|
|
791
|
-
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
792
|
-
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
793
|
-
// We set this flag during the update to prevent the URL state persistence
|
|
794
|
-
// from creating an unwanted extra history entry.
|
|
795
|
-
this.dataSourceInstallInProgress = true;
|
|
796
|
-
this.requestUpdate();
|
|
797
|
-
await this.updateComplete;
|
|
798
|
-
this.dataSourceInstallInProgress = false;
|
|
799
|
-
if (!this.searchResultsLoading) {
|
|
800
|
-
this.setTotalResultCount(this.dataSource.totalResults);
|
|
801
|
-
this.setTileCount(this.dataSource.size);
|
|
802
|
-
}
|
|
803
|
-
this.refreshVisibleResults();
|
|
804
|
-
}
|
|
805
|
-
firstUpdated() {
|
|
806
|
-
this.restoreState();
|
|
807
|
-
}
|
|
808
|
-
updated(changed) {
|
|
809
|
-
var _a, _b;
|
|
810
|
-
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
811
|
-
if (!this.leftColIntersectionObserver) {
|
|
812
|
-
this.setupLeftColumnScrollListeners();
|
|
813
|
-
}
|
|
814
|
-
if (!this.facetsIntersectionObserver) {
|
|
815
|
-
this.setupFacetsScrollListeners();
|
|
816
|
-
}
|
|
817
|
-
this.updateLeftColumnHeight();
|
|
818
|
-
}
|
|
819
|
-
if (changed.has('displayMode') ||
|
|
820
|
-
changed.has('baseNavigationUrl') ||
|
|
821
|
-
changed.has('baseImageUrl') ||
|
|
822
|
-
changed.has('loggedIn')) {
|
|
823
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
824
|
-
}
|
|
825
|
-
if (changed.has('baseQuery') ||
|
|
826
|
-
changed.has('searchType') ||
|
|
827
|
-
changed.has('withinCollection')) {
|
|
828
|
-
// Unless this query/search type update is from the initial page load or the
|
|
829
|
-
// result of hitting the back button,
|
|
830
|
-
// we need to clear any existing filters since they may no longer be valid for
|
|
831
|
-
// the new set of search results.
|
|
832
|
-
if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
|
|
833
|
-
// Ordinarily, we leave the sort param unchanged between searches.
|
|
834
|
-
// However, if we are changing the target collection itself, we want the sort cleared too,
|
|
835
|
-
// since different collections may have different sorting options available.
|
|
836
|
-
const shouldClearSort = changed.has('withinCollection') &&
|
|
837
|
-
!changed.has('selectedSort') &&
|
|
838
|
-
!changed.has('sortDirection');
|
|
839
|
-
// Otherwise, only clear filters that haven't been simultaneously applied in this update
|
|
840
|
-
this.clearFilters({
|
|
841
|
-
sort: shouldClearSort,
|
|
842
|
-
facets: !changed.has('selectedFacets'),
|
|
843
|
-
dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
|
|
844
|
-
letterFilters: !(changed.has('selectedTitleFilter') ||
|
|
845
|
-
changed.has('selectedCreatorFilter')),
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
if (changed.has('profileElement')) {
|
|
850
|
-
this.applyDefaultProfileSort();
|
|
851
|
-
}
|
|
852
|
-
if (changed.has('baseQuery')) {
|
|
853
|
-
this.emitBaseQueryChanged();
|
|
854
|
-
}
|
|
855
|
-
if (changed.has('searchType')) {
|
|
856
|
-
this.emitSearchTypeChanged();
|
|
857
|
-
}
|
|
858
|
-
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
859
|
-
this.persistState();
|
|
860
|
-
}
|
|
861
|
-
if (changed.has('baseQuery') ||
|
|
862
|
-
changed.has('minSelectedDate') ||
|
|
863
|
-
changed.has('maxSelectedDate') ||
|
|
864
|
-
changed.has('selectedFacets') ||
|
|
865
|
-
changed.has('searchService') ||
|
|
866
|
-
changed.has('withinCollection') ||
|
|
867
|
-
changed.has('withinProfile') ||
|
|
868
|
-
changed.has('profileElement')) {
|
|
869
|
-
this.dataSource.refreshLetterCounts();
|
|
870
|
-
}
|
|
871
|
-
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
872
|
-
const prevSortDirection = changed.get('sortDirection');
|
|
873
|
-
this.sendSortByAnalytics(prevSortDirection);
|
|
874
|
-
this.selectedSortChanged();
|
|
875
|
-
}
|
|
876
|
-
if (changed.has('selectedTitleFilter')) {
|
|
877
|
-
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
878
|
-
}
|
|
879
|
-
if (changed.has('selectedCreatorFilter')) {
|
|
880
|
-
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
881
|
-
}
|
|
882
|
-
if (changed.has('baseQuery') ||
|
|
883
|
-
changed.has('searchType') ||
|
|
884
|
-
changed.has('selectedTitleFilter') ||
|
|
885
|
-
changed.has('selectedCreatorFilter') ||
|
|
886
|
-
changed.has('minSelectedDate') ||
|
|
887
|
-
changed.has('maxSelectedDate') ||
|
|
888
|
-
changed.has('selectedSort') ||
|
|
889
|
-
changed.has('sortDirection') ||
|
|
890
|
-
changed.has('selectedFacets') ||
|
|
891
|
-
changed.has('searchService') ||
|
|
892
|
-
changed.has('withinCollection') ||
|
|
893
|
-
changed.has('withinProfile') ||
|
|
894
|
-
changed.has('profileElement')) {
|
|
895
|
-
this.handleQueryChange();
|
|
896
|
-
}
|
|
897
|
-
if (changed.has('searchResultsLoading')) {
|
|
898
|
-
this.emitSearchResultsLoadingChanged();
|
|
899
|
-
}
|
|
900
|
-
if (changed.has('facetsLoading') &&
|
|
901
|
-
this.facetsLoading &&
|
|
902
|
-
this.collectionFacets) {
|
|
903
|
-
this.collectionFacets.moreLinksVisible =
|
|
904
|
-
this.searchType !== SearchType.FULLTEXT;
|
|
905
|
-
}
|
|
906
|
-
if (changed.has('pagesToRender')) {
|
|
907
|
-
if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
|
|
908
|
-
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
if (changed.has('isManageView')) {
|
|
912
|
-
if (this.isManageView)
|
|
913
|
-
this.displayMode = 'grid';
|
|
914
|
-
(_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
|
|
915
|
-
this.emitManageModeChangedEvent();
|
|
916
|
-
}
|
|
917
|
-
if (changed.has('resizeObserver')) {
|
|
918
|
-
const oldObserver = changed.get('resizeObserver');
|
|
919
|
-
if (oldObserver)
|
|
920
|
-
this.disconnectResizeObserver(oldObserver);
|
|
921
|
-
this.setupResizeObserver();
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
connectedCallback() {
|
|
925
|
-
var _a;
|
|
926
|
-
(_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
927
|
-
this.setupStateRestorationObserver();
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
(
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
this.
|
|
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
|
-
this.facetsIntersectionObserver.
|
|
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
|
-
const
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
if
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
this.
|
|
1083
|
-
this.
|
|
1084
|
-
this.
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
//
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
this.infiniteScroller.
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
this.
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
//
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
//
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
this.
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
this.
|
|
1130
|
-
this.
|
|
1131
|
-
this.
|
|
1132
|
-
this.
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
this.
|
|
1137
|
-
this.
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
//
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
//
|
|
1203
|
-
//
|
|
1204
|
-
//
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
*
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
* -
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
//
|
|
1242
|
-
|
|
1243
|
-
this.
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
//
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
this.
|
|
1269
|
-
this.
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
this.
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
//
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
752
|
+
`;
|
|
753
|
+
}
|
|
754
|
+
histogramDateRangeUpdated(e) {
|
|
755
|
+
var _a;
|
|
756
|
+
const { minDate, maxDate } = e.detail;
|
|
757
|
+
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
758
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
759
|
+
category: this.searchContext,
|
|
760
|
+
action: analyticsActions.histogramChanged,
|
|
761
|
+
label: this.dateRangeQueryClause,
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
get dateRangeQueryClause() {
|
|
765
|
+
if (!this.minSelectedDate || !this.maxSelectedDate) {
|
|
766
|
+
return undefined;
|
|
767
|
+
}
|
|
768
|
+
return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Emits an event indicating a change in whether the manage mode is shown.
|
|
772
|
+
*/
|
|
773
|
+
emitManageModeChangedEvent() {
|
|
774
|
+
this.dispatchEvent(new CustomEvent('manageModeChanged', {
|
|
775
|
+
detail: this.isManageView,
|
|
776
|
+
}));
|
|
777
|
+
}
|
|
778
|
+
async installDataSourceAndQueryState(dataSource, queryState) {
|
|
779
|
+
var _a, _b;
|
|
780
|
+
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
781
|
+
if (this.dataSource)
|
|
782
|
+
this.removeController(this.dataSource);
|
|
783
|
+
this.dataSource = dataSource;
|
|
784
|
+
this.addController(this.dataSource);
|
|
785
|
+
this.baseQuery = queryState.baseQuery;
|
|
786
|
+
this.profileElement = queryState.profileElement;
|
|
787
|
+
this.searchType = queryState.searchType;
|
|
788
|
+
this.selectedFacets =
|
|
789
|
+
(_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
|
|
790
|
+
this.minSelectedDate = queryState.minSelectedDate;
|
|
791
|
+
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
792
|
+
this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
|
|
793
|
+
this.sortDirection = queryState.sortDirection;
|
|
794
|
+
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
795
|
+
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
796
|
+
// We set this flag during the update to prevent the URL state persistence
|
|
797
|
+
// from creating an unwanted extra history entry.
|
|
798
|
+
this.dataSourceInstallInProgress = true;
|
|
799
|
+
this.requestUpdate();
|
|
800
|
+
await this.updateComplete;
|
|
801
|
+
this.dataSourceInstallInProgress = false;
|
|
802
|
+
if (!this.searchResultsLoading) {
|
|
803
|
+
this.setTotalResultCount(this.dataSource.totalResults);
|
|
804
|
+
this.setTileCount(this.dataSource.size);
|
|
805
|
+
}
|
|
806
|
+
this.refreshVisibleResults();
|
|
807
|
+
}
|
|
808
|
+
firstUpdated() {
|
|
809
|
+
this.restoreState();
|
|
810
|
+
}
|
|
811
|
+
updated(changed) {
|
|
812
|
+
var _a, _b;
|
|
813
|
+
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
814
|
+
if (!this.leftColIntersectionObserver) {
|
|
815
|
+
this.setupLeftColumnScrollListeners();
|
|
816
|
+
}
|
|
817
|
+
if (!this.facetsIntersectionObserver) {
|
|
818
|
+
this.setupFacetsScrollListeners();
|
|
819
|
+
}
|
|
820
|
+
this.updateLeftColumnHeight();
|
|
821
|
+
}
|
|
822
|
+
if (changed.has('displayMode') ||
|
|
823
|
+
changed.has('baseNavigationUrl') ||
|
|
824
|
+
changed.has('baseImageUrl') ||
|
|
825
|
+
changed.has('loggedIn')) {
|
|
826
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
827
|
+
}
|
|
828
|
+
if (changed.has('baseQuery') ||
|
|
829
|
+
changed.has('searchType') ||
|
|
830
|
+
changed.has('withinCollection')) {
|
|
831
|
+
// Unless this query/search type update is from the initial page load or the
|
|
832
|
+
// result of hitting the back button,
|
|
833
|
+
// we need to clear any existing filters since they may no longer be valid for
|
|
834
|
+
// the new set of search results.
|
|
835
|
+
if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
|
|
836
|
+
// Ordinarily, we leave the sort param unchanged between searches.
|
|
837
|
+
// However, if we are changing the target collection itself, we want the sort cleared too,
|
|
838
|
+
// since different collections may have different sorting options available.
|
|
839
|
+
const shouldClearSort = changed.has('withinCollection') &&
|
|
840
|
+
!changed.has('selectedSort') &&
|
|
841
|
+
!changed.has('sortDirection');
|
|
842
|
+
// Otherwise, only clear filters that haven't been simultaneously applied in this update
|
|
843
|
+
this.clearFilters({
|
|
844
|
+
sort: shouldClearSort,
|
|
845
|
+
facets: !changed.has('selectedFacets'),
|
|
846
|
+
dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
|
|
847
|
+
letterFilters: !(changed.has('selectedTitleFilter') ||
|
|
848
|
+
changed.has('selectedCreatorFilter')),
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (changed.has('profileElement')) {
|
|
853
|
+
this.applyDefaultProfileSort();
|
|
854
|
+
}
|
|
855
|
+
if (changed.has('baseQuery')) {
|
|
856
|
+
this.emitBaseQueryChanged();
|
|
857
|
+
}
|
|
858
|
+
if (changed.has('searchType')) {
|
|
859
|
+
this.emitSearchTypeChanged();
|
|
860
|
+
}
|
|
861
|
+
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
862
|
+
this.persistState();
|
|
863
|
+
}
|
|
864
|
+
if (changed.has('baseQuery') ||
|
|
865
|
+
changed.has('minSelectedDate') ||
|
|
866
|
+
changed.has('maxSelectedDate') ||
|
|
867
|
+
changed.has('selectedFacets') ||
|
|
868
|
+
changed.has('searchService') ||
|
|
869
|
+
changed.has('withinCollection') ||
|
|
870
|
+
changed.has('withinProfile') ||
|
|
871
|
+
changed.has('profileElement')) {
|
|
872
|
+
this.dataSource.refreshLetterCounts();
|
|
873
|
+
}
|
|
874
|
+
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
875
|
+
const prevSortDirection = changed.get('sortDirection');
|
|
876
|
+
this.sendSortByAnalytics(prevSortDirection);
|
|
877
|
+
this.selectedSortChanged();
|
|
878
|
+
}
|
|
879
|
+
if (changed.has('selectedTitleFilter')) {
|
|
880
|
+
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
881
|
+
}
|
|
882
|
+
if (changed.has('selectedCreatorFilter')) {
|
|
883
|
+
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
884
|
+
}
|
|
885
|
+
if (changed.has('baseQuery') ||
|
|
886
|
+
changed.has('searchType') ||
|
|
887
|
+
changed.has('selectedTitleFilter') ||
|
|
888
|
+
changed.has('selectedCreatorFilter') ||
|
|
889
|
+
changed.has('minSelectedDate') ||
|
|
890
|
+
changed.has('maxSelectedDate') ||
|
|
891
|
+
changed.has('selectedSort') ||
|
|
892
|
+
changed.has('sortDirection') ||
|
|
893
|
+
changed.has('selectedFacets') ||
|
|
894
|
+
changed.has('searchService') ||
|
|
895
|
+
changed.has('withinCollection') ||
|
|
896
|
+
changed.has('withinProfile') ||
|
|
897
|
+
changed.has('profileElement')) {
|
|
898
|
+
this.handleQueryChange();
|
|
899
|
+
}
|
|
900
|
+
if (changed.has('searchResultsLoading')) {
|
|
901
|
+
this.emitSearchResultsLoadingChanged();
|
|
902
|
+
}
|
|
903
|
+
if (changed.has('facetsLoading') &&
|
|
904
|
+
this.facetsLoading &&
|
|
905
|
+
this.collectionFacets) {
|
|
906
|
+
this.collectionFacets.moreLinksVisible =
|
|
907
|
+
this.searchType !== SearchType.FULLTEXT;
|
|
908
|
+
}
|
|
909
|
+
if (changed.has('pagesToRender')) {
|
|
910
|
+
if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
|
|
911
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (changed.has('isManageView')) {
|
|
915
|
+
if (this.isManageView)
|
|
916
|
+
this.displayMode = 'grid';
|
|
917
|
+
(_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
|
|
918
|
+
this.emitManageModeChangedEvent();
|
|
919
|
+
}
|
|
920
|
+
if (changed.has('resizeObserver')) {
|
|
921
|
+
const oldObserver = changed.get('resizeObserver');
|
|
922
|
+
if (oldObserver)
|
|
923
|
+
this.disconnectResizeObserver(oldObserver);
|
|
924
|
+
this.setupResizeObserver();
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
connectedCallback() {
|
|
928
|
+
var _a;
|
|
929
|
+
(_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
930
|
+
this.setupStateRestorationObserver();
|
|
931
|
+
this.setupResizeObserver();
|
|
932
|
+
}
|
|
933
|
+
disconnectedCallback() {
|
|
934
|
+
var _a, _b;
|
|
935
|
+
if (this.resizeObserver) {
|
|
936
|
+
this.disconnectResizeObserver(this.resizeObserver);
|
|
937
|
+
}
|
|
938
|
+
if (this.boundNavigationHandler) {
|
|
939
|
+
window.removeEventListener('popstate', this.boundNavigationHandler);
|
|
940
|
+
}
|
|
941
|
+
(_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
942
|
+
(_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
943
|
+
window.removeEventListener('resize', this.updateLeftColumnHeight);
|
|
944
|
+
}
|
|
945
|
+
handleResize(entry) {
|
|
946
|
+
const previousView = this.mobileView;
|
|
947
|
+
if (entry.target === this.contentContainer) {
|
|
948
|
+
this.contentWidth = entry.contentRect.width;
|
|
949
|
+
this.mobileView =
|
|
950
|
+
this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
|
|
951
|
+
// If changing from desktop to mobile disable transition
|
|
952
|
+
if (this.mobileView && !previousView) {
|
|
953
|
+
this.isResizeToMobile = true;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
// Ensure the facet sidebar remains sized correctly
|
|
957
|
+
this.updateLeftColumnHeight();
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Sets up listeners for events that may require updating the left column height.
|
|
961
|
+
*/
|
|
962
|
+
setupLeftColumnScrollListeners() {
|
|
963
|
+
var _a;
|
|
964
|
+
// We observe intersections between the left column's scroll sentinel and
|
|
965
|
+
// the viewport, so that we can ensure the left column is always sized to
|
|
966
|
+
// match the _available_ viewport height. This should generally be more
|
|
967
|
+
// performant than listening to scroll events on the page or column.
|
|
968
|
+
const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
|
|
969
|
+
if (leftColumnSentinel) {
|
|
970
|
+
this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
|
|
971
|
+
threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
|
|
972
|
+
});
|
|
973
|
+
this.leftColIntersectionObserver.observe(leftColumnSentinel);
|
|
974
|
+
}
|
|
975
|
+
// We also listen for window resize events, as they are not always captured
|
|
976
|
+
// by the resize observer and can affect the desired height of the left column.
|
|
977
|
+
window.addEventListener('resize', this.updateLeftColumnHeight);
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
|
|
981
|
+
* Note this uses a separate IntersectionObserver from the left column, because we
|
|
982
|
+
* don't need granular intersection thresholds for this.
|
|
983
|
+
*/
|
|
984
|
+
setupFacetsScrollListeners() {
|
|
985
|
+
var _a;
|
|
986
|
+
const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
|
|
987
|
+
if (facetsSentinel) {
|
|
988
|
+
this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
|
|
989
|
+
this.facetsIntersectionObserver.observe(facetsSentinel);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
emitBaseQueryChanged() {
|
|
993
|
+
this.dispatchEvent(new CustomEvent('baseQueryChanged', {
|
|
994
|
+
detail: {
|
|
995
|
+
baseQuery: this.baseQuery,
|
|
996
|
+
},
|
|
997
|
+
}));
|
|
998
|
+
}
|
|
999
|
+
emitSearchTypeChanged() {
|
|
1000
|
+
this.dispatchEvent(new CustomEvent('searchTypeChanged', {
|
|
1001
|
+
detail: this.searchType,
|
|
1002
|
+
}));
|
|
1003
|
+
}
|
|
1004
|
+
emitQueryStateChanged() {
|
|
1005
|
+
this.dispatchEvent(new CustomEvent('queryStateChanged', {
|
|
1006
|
+
detail: {
|
|
1007
|
+
baseQuery: this.baseQuery,
|
|
1008
|
+
withinCollection: this.withinCollection,
|
|
1009
|
+
withinProfile: this.withinProfile,
|
|
1010
|
+
profileElement: this.profileElement,
|
|
1011
|
+
searchType: this.searchType,
|
|
1012
|
+
selectedFacets: this.selectedFacets,
|
|
1013
|
+
minSelectedDate: this.minSelectedDate,
|
|
1014
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
1015
|
+
selectedSort: this.selectedSort,
|
|
1016
|
+
sortDirection: this.sortDirection,
|
|
1017
|
+
selectedTitleFilter: this.selectedTitleFilter,
|
|
1018
|
+
selectedCreatorFilter: this.selectedCreatorFilter,
|
|
1019
|
+
},
|
|
1020
|
+
}));
|
|
1021
|
+
}
|
|
1022
|
+
emitEmptyResults() {
|
|
1023
|
+
this.dispatchEvent(new Event('emptyResults'));
|
|
1024
|
+
}
|
|
1025
|
+
disconnectResizeObserver(resizeObserver) {
|
|
1026
|
+
resizeObserver.removeObserver({
|
|
1027
|
+
target: this.contentContainer,
|
|
1028
|
+
handler: this,
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
setupResizeObserver() {
|
|
1032
|
+
if (!this.resizeObserver || !this.contentContainer)
|
|
1033
|
+
return;
|
|
1034
|
+
this.resizeObserver.addObserver({
|
|
1035
|
+
target: this.contentContainer,
|
|
1036
|
+
handler: this,
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* When the visible cells change from the infinite scroller, we want to emit
|
|
1041
|
+
* which page is currently visible so the consumer can update its UI or the URL
|
|
1042
|
+
*
|
|
1043
|
+
* @param e
|
|
1044
|
+
* @returns
|
|
1045
|
+
*/
|
|
1046
|
+
visibleCellsChanged(e) {
|
|
1047
|
+
if (this.isScrollingToCell)
|
|
1048
|
+
return;
|
|
1049
|
+
const { visibleCellIndices } = e.detail;
|
|
1050
|
+
if (visibleCellIndices.length === 0)
|
|
1051
|
+
return;
|
|
1052
|
+
const lastVisibleCellIndex = visibleCellIndices[visibleCellIndices.length - 1];
|
|
1053
|
+
const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
|
|
1054
|
+
if (this.currentPage !== lastVisibleCellPage) {
|
|
1055
|
+
this.currentPage = lastVisibleCellPage;
|
|
1056
|
+
}
|
|
1057
|
+
const event = new CustomEvent('visiblePageChanged', {
|
|
1058
|
+
detail: {
|
|
1059
|
+
pageNumber: lastVisibleCellPage,
|
|
1060
|
+
},
|
|
1061
|
+
});
|
|
1062
|
+
this.dispatchEvent(event);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
1066
|
+
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
1067
|
+
*
|
|
1068
|
+
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
1069
|
+
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
1070
|
+
*/
|
|
1071
|
+
get initialSearchComplete() {
|
|
1072
|
+
return this.dataSource.initialSearchComplete;
|
|
1073
|
+
}
|
|
1074
|
+
async handleQueryChange() {
|
|
1075
|
+
var _a;
|
|
1076
|
+
// only reset if the query has actually changed
|
|
1077
|
+
if (!this.searchService ||
|
|
1078
|
+
this.dataSource.pageFetchQueryKey === this.previousQueryKey)
|
|
1079
|
+
return;
|
|
1080
|
+
// If the new state prevents us from updating the search results, don't reset
|
|
1081
|
+
if (!this.dataSource.canPerformSearch &&
|
|
1082
|
+
!(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
|
|
1083
|
+
return;
|
|
1084
|
+
this.previousQueryKey = this.dataSource.pageFetchQueryKey;
|
|
1085
|
+
// this.emitQueryStateChanged();
|
|
1086
|
+
this.tileModelOffset = 0;
|
|
1087
|
+
this.totalResults = undefined;
|
|
1088
|
+
this.pagesToRender =
|
|
1089
|
+
this.initialPageNumber === 1
|
|
1090
|
+
? 2 // First two pages are batched into one request when starting from page 1
|
|
1091
|
+
: this.initialPageNumber;
|
|
1092
|
+
// Reset the infinite scroller's item count, so that it
|
|
1093
|
+
// shows tile placeholders until the new query's results load in
|
|
1094
|
+
if (this.infiniteScroller) {
|
|
1095
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1096
|
+
this.infiniteScroller.reload();
|
|
1097
|
+
}
|
|
1098
|
+
if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
1099
|
+
this.defaultSortField = SortField.relevance;
|
|
1100
|
+
this.defaultSortDirection = null;
|
|
1101
|
+
}
|
|
1102
|
+
if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
|
|
1103
|
+
this.scrollToPage(this.initialPageNumber);
|
|
1104
|
+
}
|
|
1105
|
+
this.initialQueryChangeHappened = true;
|
|
1106
|
+
// if the query changed as part of a window.history pop event, we don't want to
|
|
1107
|
+
// persist the state because it overwrites the forward history
|
|
1108
|
+
if (!this.historyPopOccurred) {
|
|
1109
|
+
this.persistState();
|
|
1110
|
+
}
|
|
1111
|
+
this.historyPopOccurred = false;
|
|
1112
|
+
// Fire the initial page and facets requests
|
|
1113
|
+
// await this.dataSource.handleQueryChange();
|
|
1114
|
+
}
|
|
1115
|
+
setupStateRestorationObserver() {
|
|
1116
|
+
if (!this.boundNavigationHandler) {
|
|
1117
|
+
this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
|
|
1118
|
+
}
|
|
1119
|
+
// when the user navigates back, we want to update the UI to match the URL
|
|
1120
|
+
window.addEventListener('popstate', this.boundNavigationHandler);
|
|
1121
|
+
}
|
|
1122
|
+
historyNavigationHandler() {
|
|
1123
|
+
this.historyPopOccurred = true;
|
|
1124
|
+
this.restoreState();
|
|
1125
|
+
}
|
|
1126
|
+
restoreState() {
|
|
1127
|
+
var _a, _b, _c, _d, _e;
|
|
1128
|
+
const restorationState = this.restorationStateHandler.getRestorationState();
|
|
1129
|
+
this.displayMode = restorationState.displayMode;
|
|
1130
|
+
if (restorationState.searchType != null)
|
|
1131
|
+
this.searchType = restorationState.searchType;
|
|
1132
|
+
this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
|
|
1133
|
+
this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
|
|
1134
|
+
this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
|
|
1135
|
+
this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
|
|
1136
|
+
this.selectedFacets = restorationState.selectedFacets;
|
|
1137
|
+
if (!this.suppressURLQuery)
|
|
1138
|
+
this.baseQuery = restorationState.baseQuery;
|
|
1139
|
+
this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
|
|
1140
|
+
this.minSelectedDate = restorationState.minSelectedDate;
|
|
1141
|
+
this.maxSelectedDate = restorationState.maxSelectedDate;
|
|
1142
|
+
if (this.currentPage > 1) {
|
|
1143
|
+
this.goToPage(this.currentPage);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
persistState() {
|
|
1147
|
+
var _a, _b, _c, _d;
|
|
1148
|
+
const restorationState = {
|
|
1149
|
+
displayMode: this.displayMode,
|
|
1150
|
+
searchType: this.searchType,
|
|
1151
|
+
selectedSort: this.selectedSort,
|
|
1152
|
+
sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
|
|
1153
|
+
selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
|
|
1154
|
+
baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
|
|
1155
|
+
currentPage: this.currentPage,
|
|
1156
|
+
titleQuery: this.titleQuery,
|
|
1157
|
+
creatorQuery: this.creatorQuery,
|
|
1158
|
+
minSelectedDate: this.minSelectedDate,
|
|
1159
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
1160
|
+
selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
|
|
1161
|
+
selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
|
|
1162
|
+
};
|
|
1163
|
+
this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
|
|
1164
|
+
}
|
|
1165
|
+
emitSearchResultsLoadingChanged() {
|
|
1166
|
+
this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
|
|
1167
|
+
detail: {
|
|
1168
|
+
loading: this.searchResultsLoading,
|
|
1169
|
+
},
|
|
1170
|
+
}));
|
|
1171
|
+
}
|
|
1172
|
+
facetsChanged(e) {
|
|
1173
|
+
this.selectedFacets = e.detail;
|
|
1174
|
+
}
|
|
1175
|
+
facetClickHandler({ detail: { facetType, bucket, negative }, }) {
|
|
1176
|
+
var _a;
|
|
1177
|
+
let action;
|
|
1178
|
+
if (negative) {
|
|
1179
|
+
action =
|
|
1180
|
+
bucket.state !== 'none'
|
|
1181
|
+
? analyticsActions.facetNegativeSelected
|
|
1182
|
+
: analyticsActions.facetNegativeDeselected;
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
action =
|
|
1186
|
+
bucket.state !== 'none'
|
|
1187
|
+
? analyticsActions.facetSelected
|
|
1188
|
+
: analyticsActions.facetDeselected;
|
|
1189
|
+
}
|
|
1190
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
1191
|
+
category: this.searchContext,
|
|
1192
|
+
action,
|
|
1193
|
+
label: facetType,
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
scrollToPage(pageNumber) {
|
|
1197
|
+
return new Promise(resolve => {
|
|
1198
|
+
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
1199
|
+
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
1200
|
+
// then scrolls to the cell
|
|
1201
|
+
setTimeout(() => {
|
|
1202
|
+
var _a;
|
|
1203
|
+
this.isScrollingToCell = true;
|
|
1204
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
|
|
1205
|
+
// This timeout is to give the scroll animation time to finish
|
|
1206
|
+
// then updating the infinite scroller once we're done scrolling
|
|
1207
|
+
// There's no scroll animation completion callback so we're
|
|
1208
|
+
// giving it 0.5s to finish.
|
|
1209
|
+
setTimeout(() => {
|
|
1210
|
+
var _a;
|
|
1211
|
+
this.isScrollingToCell = false;
|
|
1212
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1213
|
+
resolve();
|
|
1214
|
+
}, 500);
|
|
1215
|
+
}, 0);
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Whether sorting by relevance makes sense for the current state.
|
|
1220
|
+
* Currently equivalent to having a non-empty query.
|
|
1221
|
+
*/
|
|
1222
|
+
get isRelevanceSortAvailable() {
|
|
1223
|
+
var _a;
|
|
1224
|
+
return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Sets the total number of tiles displayed in the infinite scroller.
|
|
1228
|
+
*/
|
|
1229
|
+
setTileCount(count) {
|
|
1230
|
+
if (this.infiniteScroller) {
|
|
1231
|
+
this.infiniteScroller.itemCount = count;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Applies any default sort option for the current collection, by checking
|
|
1236
|
+
* for one in the collection's metadata. If none is found, defaults to sorting
|
|
1237
|
+
* descending by:
|
|
1238
|
+
* - Date Favorited for fav-* collections
|
|
1239
|
+
* - Weekly views for all other collections
|
|
1240
|
+
*/
|
|
1241
|
+
applyDefaultCollectionSort(collectionInfo) {
|
|
1242
|
+
var _a, _b, _c;
|
|
1243
|
+
if (this.baseQuery) {
|
|
1244
|
+
// If there's a query set, then we default to relevance sorting regardless of
|
|
1245
|
+
// the collection metadata-specified sort.
|
|
1246
|
+
this.defaultSortField = SortField.relevance;
|
|
1247
|
+
this.defaultSortDirection = null;
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
// Favorite collections sort on Date Favorited by default.
|
|
1251
|
+
// Other collections fall back to sorting on weekly views.
|
|
1252
|
+
const baseDefaultSort = ((_b = (_a = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _a === void 0 ? void 0 : _a.identifier) === null || _b === void 0 ? void 0 : _b.startsWith('fav-'))
|
|
1253
|
+
? '-favoritedate'
|
|
1254
|
+
: '-week';
|
|
1255
|
+
// The collection metadata may override the default sorting with something else
|
|
1256
|
+
const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
|
|
1257
|
+
// Prefer the metadata-specified sort if one exists
|
|
1258
|
+
const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
|
|
1259
|
+
// Account for both -field and field:dir formats
|
|
1260
|
+
let [field, dir] = defaultSortToApply.split(':');
|
|
1261
|
+
if (field.startsWith('-')) {
|
|
1262
|
+
field = field.slice(1);
|
|
1263
|
+
dir = 'desc';
|
|
1264
|
+
}
|
|
1265
|
+
else if (!['asc', 'desc'].includes(dir)) {
|
|
1266
|
+
dir = 'asc';
|
|
1267
|
+
}
|
|
1268
|
+
const sortOption = sortOptionFromAPIString(field);
|
|
1269
|
+
const sortField = sortOption.field;
|
|
1270
|
+
if (sortField && sortField !== SortField.default) {
|
|
1271
|
+
this.defaultSortField = sortField;
|
|
1272
|
+
this.defaultSortDirection = dir;
|
|
1273
|
+
this.defaultSortParam = {
|
|
1274
|
+
field: this.defaultSortField,
|
|
1275
|
+
direction: this.defaultSortDirection,
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Applies the default sort option for the current profile element
|
|
1281
|
+
*/
|
|
1282
|
+
applyDefaultProfileSort() {
|
|
1283
|
+
if (this.profileElement) {
|
|
1284
|
+
const defaultSortField = defaultProfileElementSorts[this.profileElement];
|
|
1285
|
+
this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
this.defaultSortField = SortField.weeklyview;
|
|
1289
|
+
}
|
|
1290
|
+
this.defaultSortDirection = 'desc';
|
|
1291
|
+
this.defaultSortParam = {
|
|
1292
|
+
field: this.defaultSortField,
|
|
1293
|
+
direction: this.defaultSortDirection,
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* This is useful for determining whether we need to reload the scroller.
|
|
1298
|
+
*
|
|
1299
|
+
* When the fetch completes, we need to reload the scroller if the cells for that
|
|
1300
|
+
* page are visible, but if the page is not currenlty visible, we don't need to reload
|
|
1301
|
+
*/
|
|
1302
|
+
get currentVisiblePageNumbers() {
|
|
1303
|
+
var _a, _b;
|
|
1304
|
+
const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
|
|
1305
|
+
const visiblePages = new Set();
|
|
1306
|
+
visibleCells.forEach(cellIndex => {
|
|
1307
|
+
const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
|
|
1308
|
+
visiblePages.add(visiblePage);
|
|
1309
|
+
});
|
|
1310
|
+
return Array.from(visiblePages);
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Refreshes all visible result cells in the infinite scroller.
|
|
1314
|
+
*/
|
|
1315
|
+
refreshVisibleResults() {
|
|
1316
|
+
var _a;
|
|
1317
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Callback when a result is selected
|
|
1321
|
+
*/
|
|
1322
|
+
resultSelected(event) {
|
|
1323
|
+
var _a, _b, _c;
|
|
1324
|
+
if (this.isManageView) {
|
|
1325
|
+
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
1326
|
+
// this.mapDataSource(model => ({ ...model }));
|
|
1327
|
+
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
1328
|
+
if (cellIndex >= 0)
|
|
1329
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
|
|
1330
|
+
}
|
|
1331
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
1332
|
+
category: this.searchContext,
|
|
1333
|
+
action: analyticsActions.resultSelected,
|
|
1334
|
+
label: event.detail.mediatype,
|
|
1335
|
+
});
|
|
1336
|
+
(_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
|
|
1337
|
+
category: this.searchContext,
|
|
1338
|
+
action: analyticsActions.resultSelected,
|
|
1339
|
+
label: `page-${this.currentPage}`,
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
cellForIndex(index) {
|
|
1343
|
+
const model = this.tileModelAtCellIndex(index);
|
|
1344
|
+
if (!model)
|
|
1345
|
+
return undefined;
|
|
1342
1346
|
return html `
|
|
1343
1347
|
<tile-dispatcher
|
|
1344
1348
|
.collectionPagePath=${this.collectionPagePath}
|
|
@@ -1358,21 +1362,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1358
1362
|
@resultSelected=${(e) => this.resultSelected(e)}
|
|
1359
1363
|
>
|
|
1360
1364
|
</tile-dispatcher>
|
|
1361
|
-
`;
|
|
1362
|
-
}
|
|
1363
|
-
/**
|
|
1364
|
-
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1365
|
-
* increase the number of pages to render and start fetching data for the new page
|
|
1366
|
-
*/
|
|
1367
|
-
scrollThresholdReached() {
|
|
1368
|
-
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1369
|
-
this.pagesToRender += 1;
|
|
1370
|
-
this.dataSource.fetchPage(this.pagesToRender);
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
static get styles() {
|
|
1374
|
-
return [
|
|
1375
|
-
srOnlyStyle,
|
|
1365
|
+
`;
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1369
|
+
* increase the number of pages to render and start fetching data for the new page
|
|
1370
|
+
*/
|
|
1371
|
+
scrollThresholdReached() {
|
|
1372
|
+
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1373
|
+
this.pagesToRender += 1;
|
|
1374
|
+
this.dataSource.fetchPage(this.pagesToRender);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
static get styles() {
|
|
1378
|
+
return [
|
|
1379
|
+
srOnlyStyle,
|
|
1376
1380
|
css `
|
|
1377
1381
|
:host {
|
|
1378
1382
|
display: block;
|
|
@@ -1747,177 +1751,180 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1747
1751
|
infinite-scroller.hidden {
|
|
1748
1752
|
display: none;
|
|
1749
1753
|
}
|
|
1750
|
-
`,
|
|
1751
|
-
];
|
|
1752
|
-
}
|
|
1753
|
-
};
|
|
1754
|
-
__decorate([
|
|
1755
|
-
property({ type: String })
|
|
1756
|
-
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1757
|
-
__decorate([
|
|
1758
|
-
property({ type: String })
|
|
1759
|
-
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1760
|
-
__decorate([
|
|
1761
|
-
property({ type: Object })
|
|
1762
|
-
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1763
|
-
__decorate([
|
|
1764
|
-
property({ type: String })
|
|
1765
|
-
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1766
|
-
__decorate([
|
|
1767
|
-
property({ type: String })
|
|
1768
|
-
], CollectionBrowser.prototype, "withinCollection", void 0);
|
|
1769
|
-
__decorate([
|
|
1770
|
-
property({ type: String })
|
|
1771
|
-
], CollectionBrowser.prototype, "withinProfile", void 0);
|
|
1772
|
-
__decorate([
|
|
1773
|
-
property({ type: String })
|
|
1774
|
-
], CollectionBrowser.prototype, "profileElement", void 0);
|
|
1775
|
-
__decorate([
|
|
1776
|
-
property({ type: String })
|
|
1777
|
-
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1778
|
-
__decorate([
|
|
1779
|
-
property({ type: String })
|
|
1780
|
-
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1781
|
-
__decorate([
|
|
1782
|
-
property({ type: Object })
|
|
1783
|
-
], CollectionBrowser.prototype, "defaultSortParam", void 0);
|
|
1784
|
-
__decorate([
|
|
1785
|
-
property({ type: String })
|
|
1786
|
-
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1787
|
-
__decorate([
|
|
1788
|
-
property({ type: String })
|
|
1789
|
-
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1790
|
-
__decorate([
|
|
1791
|
-
property({ type: String })
|
|
1792
|
-
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1793
|
-
__decorate([
|
|
1794
|
-
property({ type: String })
|
|
1795
|
-
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1796
|
-
__decorate([
|
|
1797
|
-
property({ type: Number })
|
|
1798
|
-
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
1799
|
-
__decorate([
|
|
1800
|
-
property({ type: Number })
|
|
1801
|
-
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
1802
|
-
__decorate([
|
|
1803
|
-
property({ type: String })
|
|
1804
|
-
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
1805
|
-
__decorate([
|
|
1806
|
-
property({ type: String })
|
|
1807
|
-
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
1808
|
-
__decorate([
|
|
1809
|
-
property({ type: Object })
|
|
1810
|
-
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
1811
|
-
__decorate([
|
|
1812
|
-
property({ type: Boolean })
|
|
1813
|
-
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
1814
|
-
__decorate([
|
|
1815
|
-
property({ type: Boolean })
|
|
1816
|
-
], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
|
|
1817
|
-
__decorate([
|
|
1818
|
-
property({ type: Boolean })
|
|
1819
|
-
], CollectionBrowser.prototype, "suppressResultCount", void 0);
|
|
1820
|
-
__decorate([
|
|
1821
|
-
property({ type: Boolean })
|
|
1822
|
-
], CollectionBrowser.prototype, "suppressResultTiles", void 0);
|
|
1823
|
-
__decorate([
|
|
1824
|
-
property({ type: Boolean })
|
|
1825
|
-
], CollectionBrowser.prototype, "suppressURLQuery", void 0);
|
|
1826
|
-
__decorate([
|
|
1827
|
-
property({ type: Boolean })
|
|
1828
|
-
], CollectionBrowser.prototype, "suppressFacets", void 0);
|
|
1829
|
-
__decorate([
|
|
1830
|
-
property({ type: Boolean })
|
|
1831
|
-
], CollectionBrowser.prototype, "suppressSortBar", void 0);
|
|
1832
|
-
__decorate([
|
|
1833
|
-
property({ type: Boolean })
|
|
1834
|
-
], CollectionBrowser.prototype, "
|
|
1835
|
-
__decorate([
|
|
1836
|
-
property({ type:
|
|
1837
|
-
], CollectionBrowser.prototype, "
|
|
1838
|
-
__decorate([
|
|
1839
|
-
property({ type: String
|
|
1840
|
-
], CollectionBrowser.prototype, "
|
|
1841
|
-
__decorate([
|
|
1842
|
-
property({ type: String })
|
|
1843
|
-
], CollectionBrowser.prototype, "
|
|
1844
|
-
__decorate([
|
|
1845
|
-
property({ type:
|
|
1846
|
-
], CollectionBrowser.prototype, "
|
|
1847
|
-
__decorate([
|
|
1848
|
-
property({ type:
|
|
1849
|
-
], CollectionBrowser.prototype, "
|
|
1850
|
-
__decorate([
|
|
1851
|
-
property({ type:
|
|
1852
|
-
], CollectionBrowser.prototype, "
|
|
1853
|
-
__decorate([
|
|
1854
|
-
property({ type:
|
|
1855
|
-
], CollectionBrowser.prototype, "
|
|
1856
|
-
__decorate([
|
|
1857
|
-
property({ type: Object })
|
|
1858
|
-
], CollectionBrowser.prototype, "
|
|
1859
|
-
__decorate([
|
|
1860
|
-
property({ type: Object })
|
|
1861
|
-
], CollectionBrowser.prototype, "
|
|
1862
|
-
__decorate([
|
|
1863
|
-
property({ type: Object })
|
|
1864
|
-
], CollectionBrowser.prototype, "
|
|
1865
|
-
__decorate([
|
|
1866
|
-
property({ type:
|
|
1867
|
-
], CollectionBrowser.prototype, "
|
|
1868
|
-
__decorate([
|
|
1869
|
-
property({ type: Boolean })
|
|
1870
|
-
], CollectionBrowser.prototype, "
|
|
1871
|
-
__decorate([
|
|
1872
|
-
property({ type:
|
|
1873
|
-
], CollectionBrowser.prototype, "
|
|
1874
|
-
__decorate([
|
|
1875
|
-
|
|
1876
|
-
], CollectionBrowser.prototype, "
|
|
1877
|
-
__decorate([
|
|
1878
|
-
state()
|
|
1879
|
-
], CollectionBrowser.prototype, "
|
|
1880
|
-
__decorate([
|
|
1881
|
-
state()
|
|
1882
|
-
], CollectionBrowser.prototype, "
|
|
1883
|
-
__decorate([
|
|
1884
|
-
state()
|
|
1885
|
-
], CollectionBrowser.prototype, "
|
|
1886
|
-
__decorate([
|
|
1887
|
-
state()
|
|
1888
|
-
], CollectionBrowser.prototype, "
|
|
1889
|
-
__decorate([
|
|
1890
|
-
state()
|
|
1891
|
-
], CollectionBrowser.prototype, "
|
|
1892
|
-
__decorate([
|
|
1893
|
-
state()
|
|
1894
|
-
], CollectionBrowser.prototype, "
|
|
1895
|
-
__decorate([
|
|
1896
|
-
state()
|
|
1897
|
-
], CollectionBrowser.prototype, "
|
|
1898
|
-
__decorate([
|
|
1899
|
-
state()
|
|
1900
|
-
], CollectionBrowser.prototype, "
|
|
1901
|
-
__decorate([
|
|
1902
|
-
state()
|
|
1903
|
-
], CollectionBrowser.prototype, "
|
|
1904
|
-
__decorate([
|
|
1905
|
-
|
|
1906
|
-
], CollectionBrowser.prototype, "
|
|
1907
|
-
__decorate([
|
|
1908
|
-
query('#
|
|
1909
|
-
], CollectionBrowser.prototype, "
|
|
1910
|
-
__decorate([
|
|
1911
|
-
query('
|
|
1912
|
-
], CollectionBrowser.prototype, "
|
|
1913
|
-
__decorate([
|
|
1914
|
-
|
|
1915
|
-
], CollectionBrowser.prototype, "
|
|
1916
|
-
__decorate([
|
|
1917
|
-
|
|
1918
|
-
], CollectionBrowser.prototype, "
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
], CollectionBrowser);
|
|
1922
|
-
|
|
1754
|
+
`,
|
|
1755
|
+
];
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
__decorate([
|
|
1759
|
+
property({ type: String })
|
|
1760
|
+
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
1761
|
+
__decorate([
|
|
1762
|
+
property({ type: String })
|
|
1763
|
+
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
1764
|
+
__decorate([
|
|
1765
|
+
property({ type: Object })
|
|
1766
|
+
], CollectionBrowser.prototype, "searchService", void 0);
|
|
1767
|
+
__decorate([
|
|
1768
|
+
property({ type: String })
|
|
1769
|
+
], CollectionBrowser.prototype, "searchType", void 0);
|
|
1770
|
+
__decorate([
|
|
1771
|
+
property({ type: String })
|
|
1772
|
+
], CollectionBrowser.prototype, "withinCollection", void 0);
|
|
1773
|
+
__decorate([
|
|
1774
|
+
property({ type: String })
|
|
1775
|
+
], CollectionBrowser.prototype, "withinProfile", void 0);
|
|
1776
|
+
__decorate([
|
|
1777
|
+
property({ type: String })
|
|
1778
|
+
], CollectionBrowser.prototype, "profileElement", void 0);
|
|
1779
|
+
__decorate([
|
|
1780
|
+
property({ type: String })
|
|
1781
|
+
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
1782
|
+
__decorate([
|
|
1783
|
+
property({ type: String })
|
|
1784
|
+
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
1785
|
+
__decorate([
|
|
1786
|
+
property({ type: Object })
|
|
1787
|
+
], CollectionBrowser.prototype, "defaultSortParam", void 0);
|
|
1788
|
+
__decorate([
|
|
1789
|
+
property({ type: String })
|
|
1790
|
+
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
1791
|
+
__decorate([
|
|
1792
|
+
property({ type: String })
|
|
1793
|
+
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
1794
|
+
__decorate([
|
|
1795
|
+
property({ type: String })
|
|
1796
|
+
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
1797
|
+
__decorate([
|
|
1798
|
+
property({ type: String })
|
|
1799
|
+
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
1800
|
+
__decorate([
|
|
1801
|
+
property({ type: Number })
|
|
1802
|
+
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
1803
|
+
__decorate([
|
|
1804
|
+
property({ type: Number })
|
|
1805
|
+
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
1806
|
+
__decorate([
|
|
1807
|
+
property({ type: String })
|
|
1808
|
+
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
1809
|
+
__decorate([
|
|
1810
|
+
property({ type: String })
|
|
1811
|
+
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
1812
|
+
__decorate([
|
|
1813
|
+
property({ type: Object })
|
|
1814
|
+
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
1815
|
+
__decorate([
|
|
1816
|
+
property({ type: Boolean })
|
|
1817
|
+
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
1818
|
+
__decorate([
|
|
1819
|
+
property({ type: Boolean })
|
|
1820
|
+
], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
|
|
1821
|
+
__decorate([
|
|
1822
|
+
property({ type: Boolean })
|
|
1823
|
+
], CollectionBrowser.prototype, "suppressResultCount", void 0);
|
|
1824
|
+
__decorate([
|
|
1825
|
+
property({ type: Boolean })
|
|
1826
|
+
], CollectionBrowser.prototype, "suppressResultTiles", void 0);
|
|
1827
|
+
__decorate([
|
|
1828
|
+
property({ type: Boolean })
|
|
1829
|
+
], CollectionBrowser.prototype, "suppressURLQuery", void 0);
|
|
1830
|
+
__decorate([
|
|
1831
|
+
property({ type: Boolean })
|
|
1832
|
+
], CollectionBrowser.prototype, "suppressFacets", void 0);
|
|
1833
|
+
__decorate([
|
|
1834
|
+
property({ type: Boolean })
|
|
1835
|
+
], CollectionBrowser.prototype, "suppressSortBar", void 0);
|
|
1836
|
+
__decorate([
|
|
1837
|
+
property({ type: Boolean })
|
|
1838
|
+
], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
|
|
1839
|
+
__decorate([
|
|
1840
|
+
property({ type: Boolean })
|
|
1841
|
+
], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
|
|
1842
|
+
__decorate([
|
|
1843
|
+
property({ type: String })
|
|
1844
|
+
], CollectionBrowser.prototype, "collectionPagePath", void 0);
|
|
1845
|
+
__decorate([
|
|
1846
|
+
property({ type: String, reflect: true })
|
|
1847
|
+
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
1848
|
+
__decorate([
|
|
1849
|
+
property({ type: String })
|
|
1850
|
+
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
1851
|
+
__decorate([
|
|
1852
|
+
property({ type: Object })
|
|
1853
|
+
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
1854
|
+
__decorate([
|
|
1855
|
+
property({ type: Number })
|
|
1856
|
+
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
1857
|
+
__decorate([
|
|
1858
|
+
property({ type: Boolean })
|
|
1859
|
+
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
1860
|
+
__decorate([
|
|
1861
|
+
property({ type: Object })
|
|
1862
|
+
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
1863
|
+
__decorate([
|
|
1864
|
+
property({ type: Object })
|
|
1865
|
+
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
1866
|
+
__decorate([
|
|
1867
|
+
property({ type: Object })
|
|
1868
|
+
], CollectionBrowser.prototype, "featureFeedbackService", void 0);
|
|
1869
|
+
__decorate([
|
|
1870
|
+
property({ type: Object })
|
|
1871
|
+
], CollectionBrowser.prototype, "recaptchaManager", void 0);
|
|
1872
|
+
__decorate([
|
|
1873
|
+
property({ type: Boolean })
|
|
1874
|
+
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
1875
|
+
__decorate([
|
|
1876
|
+
property({ type: Boolean })
|
|
1877
|
+
], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
|
|
1878
|
+
__decorate([
|
|
1879
|
+
property({ type: Object })
|
|
1880
|
+
], CollectionBrowser.prototype, "dataSource", void 0);
|
|
1881
|
+
__decorate([
|
|
1882
|
+
state()
|
|
1883
|
+
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
1884
|
+
__decorate([
|
|
1885
|
+
state()
|
|
1886
|
+
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
1887
|
+
__decorate([
|
|
1888
|
+
state()
|
|
1889
|
+
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
1890
|
+
__decorate([
|
|
1891
|
+
state()
|
|
1892
|
+
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
1893
|
+
__decorate([
|
|
1894
|
+
state()
|
|
1895
|
+
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
1896
|
+
__decorate([
|
|
1897
|
+
state()
|
|
1898
|
+
], CollectionBrowser.prototype, "mobileFacetsVisible", void 0);
|
|
1899
|
+
__decorate([
|
|
1900
|
+
state()
|
|
1901
|
+
], CollectionBrowser.prototype, "contentWidth", void 0);
|
|
1902
|
+
__decorate([
|
|
1903
|
+
state()
|
|
1904
|
+
], CollectionBrowser.prototype, "defaultSortField", void 0);
|
|
1905
|
+
__decorate([
|
|
1906
|
+
state()
|
|
1907
|
+
], CollectionBrowser.prototype, "defaultSortDirection", void 0);
|
|
1908
|
+
__decorate([
|
|
1909
|
+
state()
|
|
1910
|
+
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
1911
|
+
__decorate([
|
|
1912
|
+
query('#content-container')
|
|
1913
|
+
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
1914
|
+
__decorate([
|
|
1915
|
+
query('#left-column')
|
|
1916
|
+
], CollectionBrowser.prototype, "leftColumn", void 0);
|
|
1917
|
+
__decorate([
|
|
1918
|
+
query('collection-facets')
|
|
1919
|
+
], CollectionBrowser.prototype, "collectionFacets", void 0);
|
|
1920
|
+
__decorate([
|
|
1921
|
+
property({ type: Object, attribute: false })
|
|
1922
|
+
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
1923
|
+
__decorate([
|
|
1924
|
+
query('infinite-scroller')
|
|
1925
|
+
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
1926
|
+
CollectionBrowser = __decorate([
|
|
1927
|
+
customElement('collection-browser')
|
|
1928
|
+
], CollectionBrowser);
|
|
1929
|
+
export { CollectionBrowser };
|
|
1923
1930
|
//# sourceMappingURL=collection-browser.js.map
|