@internetarchive/collection-browser 2.7.12 → 2.7.13
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 +13 -13
- package/dist/index.js +13 -13
- package/dist/src/app-root.d.ts +107 -107
- package/dist/src/app-root.js +531 -531
- 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/filter.d.ts +2 -2
- package/dist/src/assets/img/icons/filter.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 +606 -606
- package/dist/src/collection-browser.js +1677 -1677
- package/dist/src/collection-facets/facet-row.d.ts +30 -30
- package/dist/src/collection-facets/facet-row.js +118 -118
- 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 +13 -13
- package/dist/src/collection-facets/facets-template.js +44 -44
- package/dist/src/collection-facets/more-facets-content.d.ts +106 -106
- package/dist/src/collection-facets/more-facets-content.js +407 -407
- 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/smart-facets/dedupe.d.ts +10 -10
- package/dist/src/collection-facets/smart-facets/dedupe.js +33 -33
- package/dist/src/collection-facets/smart-facets/heuristics/browser-language-heuristic.d.ts +5 -5
- package/dist/src/collection-facets/smart-facets/heuristics/browser-language-heuristic.js +23 -23
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.d.ts +5 -5
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.js +44 -44
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.d.ts +5 -5
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js +172 -172
- package/dist/src/collection-facets/smart-facets/models.d.ts +26 -26
- package/dist/src/collection-facets/smart-facets/models.js +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +31 -31
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +240 -240
- package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +11 -11
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +86 -86
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +16 -16
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +100 -100
- package/dist/src/collection-facets/smart-facets/smart-facet-equals.d.ts +2 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-equals.js +12 -12
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.d.ts +5 -5
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +15 -15
- 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 +522 -522
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +245 -245
- package/dist/src/data-source/collection-browser-data-source-interface.js +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +377 -377
- package/dist/src/data-source/collection-browser-data-source.js +1004 -1001
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +44 -44
- 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 +79 -79
- 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 +58 -58
- package/dist/src/manage/manage-bar.js +159 -159
- package/dist/src/manage/remove-items-modal-content.d.ts +9 -9
- package/dist/src/manage/remove-items-modal-content.js +34 -34
- 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 +228 -228
- package/dist/src/models.js +401 -401
- package/dist/src/restoration-state-handler.d.ts +70 -70
- package/dist/src/restoration-state-handler.js +363 -363
- 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 +223 -223
- package/dist/src/sort-filter-bar/sort-filter-bar.js +697 -697
- package/dist/src/styles/ia-button.d.ts +2 -2
- package/dist/src/styles/ia-button.js +17 -17
- 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 +64 -64
- 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 +34 -34
- package/dist/src/tiles/grid/item-tile.js +158 -158
- 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 +18 -18
- package/dist/src/tiles/hover/tile-hover-pane.js +69 -69
- package/dist/src/tiles/image-block.d.ts +18 -18
- package/dist/src/tiles/image-block.js +89 -89
- 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 +19 -19
- package/dist/src/tiles/list/tile-list-compact.js +122 -122
- package/dist/src/tiles/list/tile-list.d.ts +54 -54
- package/dist/src/tiles/list/tile-list.js +323 -323
- 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 +8 -8
- package/dist/src/tiles/overlay/icon-overlay.js +25 -25
- package/dist/src/tiles/overlay/text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/text-overlay.js +31 -31
- 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 +230 -230
- 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 +28 -28
- package/dist/src/utils/analytics-events.js +30 -30
- 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/facet-utils.d.ts +83 -83
- package/dist/src/utils/facet-utils.js +145 -145
- 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 +27 -27
- 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 +1308 -1308
- package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
- package/dist/test/collection-facets/facet-row.test.js +227 -227
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +91 -91
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +141 -141
- 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 +690 -690
- 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 +107 -107
- 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 +2 -2
- package/dist/test/manage/manage-bar.test.js +100 -100
- package/dist/test/manage/remove-items-modal-content.test.d.ts +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +45 -45
- 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 +25 -25
- package/dist/test/mocks/mock-search-responses.js +942 -942
- package/dist/test/mocks/mock-search-service.d.ts +15 -15
- package/dist/test/mocks/mock-search-service.js +54 -54
- 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 +426 -426
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +38 -38
- 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 +56 -56
- 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 +30 -30
- 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/data-source/collection-browser-data-source.ts +5 -1
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,340 +1,340 @@
|
|
|
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 { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
|
|
13
|
-
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
14
|
-
import chevronIcon from './assets/img/icons/chevron';
|
|
15
|
-
import { srOnlyStyle } from './styles/sr-only';
|
|
16
|
-
import { sha1 } from './utils/sha1';
|
|
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
|
-
import './collection-facets/smart-facets/smart-facet-bar';
|
|
26
|
-
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
this.baseImageUrl = 'https://archive.org';
|
|
30
|
-
/**
|
|
31
|
-
* Which backend should be targeted by searches (e.g., metadata or FTS)
|
|
32
|
-
*/
|
|
33
|
-
this.searchType = SearchType.METADATA;
|
|
34
|
-
this.selectedSort = SortField.default;
|
|
35
|
-
this.selectedTitleFilter = null;
|
|
36
|
-
this.selectedCreatorFilter = null;
|
|
37
|
-
this.sortDirection = null;
|
|
38
|
-
this.defaultSortField = SortField.relevance;
|
|
39
|
-
this.defaultSortDirection = null;
|
|
40
|
-
this.pageSize = 50;
|
|
41
|
-
this.showSmartFacetBar = false;
|
|
42
|
-
/**
|
|
43
|
-
* Whether to show the date picker (above the facets)
|
|
44
|
-
*/
|
|
45
|
-
this.showHistogramDatePicker = false;
|
|
46
|
-
/**
|
|
47
|
-
* Whether placeholder views should be suppressed. If true, searches that produce an
|
|
48
|
-
* error or empty result set will simply show a blank results view instead of a placeholder.
|
|
49
|
-
*/
|
|
50
|
-
this.suppressPlaceholders = false;
|
|
51
|
-
/**
|
|
52
|
-
* Whether the result count text should be suppressed.
|
|
53
|
-
* If true, no "X Results" message will be shown.
|
|
54
|
-
*/
|
|
55
|
-
this.suppressResultCount = false;
|
|
56
|
-
/**
|
|
57
|
-
* Whether the scrolling result view should be suppressed entirely.
|
|
58
|
-
* If true, no infinite scroller (and thus no result tiles) will be rendered.
|
|
59
|
-
*/
|
|
60
|
-
this.suppressResultTiles = false;
|
|
61
|
-
/**
|
|
62
|
-
* Whether to suppress persistence of the query to the URL.
|
|
63
|
-
* If true, the `query` param will not be added to the URL or updated on query changes.
|
|
64
|
-
*/
|
|
65
|
-
this.suppressURLQuery = false;
|
|
66
|
-
/**
|
|
67
|
-
* Whether to suppress display of the sort bar.
|
|
68
|
-
* If true, the entire sort bar (incl. display modes) will be omitted from rendering.
|
|
69
|
-
*/
|
|
70
|
-
this.suppressSortBar = false;
|
|
71
|
-
/**
|
|
72
|
-
* Whether to suppress showing the display mode options in the sort bar.
|
|
73
|
-
* If true, those options will be omitted (though the rest of the sort bar may still render).
|
|
74
|
-
*/
|
|
75
|
-
this.suppressDisplayModes = false;
|
|
76
|
-
/**
|
|
77
|
-
* What strategy to use for when/whether to load facet data for a search.
|
|
78
|
-
*
|
|
79
|
-
* Defaults to `eager`, always loading facets immediately alongside search results.
|
|
80
|
-
*
|
|
81
|
-
* To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
|
|
82
|
-
* will delay loading facets in the mobile view until the "Filters" accordion is opened.
|
|
83
|
-
* Facets are still loaded eagerly when viewing the desktop layout.
|
|
84
|
-
*
|
|
85
|
-
* To further reduce facet requests for patrons who do not need to use them, this can be
|
|
86
|
-
* again reduced to `opt-in`, which will also require desktop users to explicitly request
|
|
87
|
-
* that they be loaded (in addition to the lazy mobile behavior described above).
|
|
88
|
-
*
|
|
89
|
-
* To entirely suppress facets from being loaded, this may be set to `off`.
|
|
90
|
-
*/
|
|
91
|
-
this.facetLoadStrategy = 'eager';
|
|
92
|
-
this.facetPaneVisible = false;
|
|
93
|
-
this.clearResultsOnEmptyQuery = false;
|
|
94
|
-
this.collectionPagePath = '/details/';
|
|
95
|
-
/** describes where this component is being used */
|
|
96
|
-
this.searchContext = analyticsCategories.default;
|
|
97
|
-
this.pageContext = 'search';
|
|
98
|
-
this.restorationStateHandler = new RestorationStateHandler({
|
|
99
|
-
context: this.pageContext,
|
|
100
|
-
});
|
|
101
|
-
this.mobileBreakpoint = 600;
|
|
102
|
-
this.loggedIn = false;
|
|
103
|
-
this.modalManager = undefined;
|
|
104
|
-
/**
|
|
105
|
-
* If item management UI active
|
|
106
|
-
*/
|
|
107
|
-
this.isManageView = false;
|
|
108
|
-
this.manageViewLabel = 'Select items to remove';
|
|
109
|
-
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
110
|
-
this.enableSortOptionsSlot = false;
|
|
111
|
-
/** Whether to display a smart results carousel above the full results */
|
|
112
|
-
this.showSmartResults = false;
|
|
113
|
-
/**
|
|
114
|
-
* The maximum number of pages we will load when a privileged user clicks
|
|
115
|
-
* the "Manage" button on the search page. Limited to 15 pages.
|
|
116
|
-
*/
|
|
117
|
-
this.maxPagesToManage = 15;
|
|
118
|
-
/**
|
|
119
|
-
* The results per page so we can paginate.
|
|
120
|
-
*
|
|
121
|
-
* This allows us to start in the middle of the search results and
|
|
122
|
-
* fetch data before or after the current page. If we don't have a key
|
|
123
|
-
* for the previous/next page, we'll fetch the next/previous page to populate it
|
|
124
|
-
*/
|
|
125
|
-
this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
|
|
126
|
-
/**
|
|
127
|
-
* The page that the consumer wants to load.
|
|
128
|
-
*/
|
|
129
|
-
this.initialPageNumber = 1;
|
|
130
|
-
/**
|
|
131
|
-
* This the the number of pages that we want to show.
|
|
132
|
-
*
|
|
133
|
-
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
134
|
-
* know how many cells we should render.
|
|
135
|
-
*/
|
|
136
|
-
this.pagesToRender = this.initialPageNumber;
|
|
137
|
-
/**
|
|
138
|
-
* Whether the initial page fetch for a new query is currently in progress.
|
|
139
|
-
*/
|
|
140
|
-
this.searchResultsLoading = false;
|
|
141
|
-
this.facetsLoading = false;
|
|
142
|
-
this.mobileView = false;
|
|
143
|
-
this.collapsibleFacetsVisible = false;
|
|
144
|
-
this.placeholderType = null;
|
|
145
|
-
/** Whether layout size analytics have been sent already. */
|
|
146
|
-
this.layoutSizeAnalyticsSent = false;
|
|
147
|
-
/**
|
|
148
|
-
* When we're animated scrolling to the page, we don't want to fetch
|
|
149
|
-
* all of the pages as it scrolls so this lets us know if we're scrolling
|
|
150
|
-
*/
|
|
151
|
-
this.isScrollingToCell = false;
|
|
152
|
-
/**
|
|
153
|
-
* When page width resizes from desktop to mobile, set true to
|
|
154
|
-
* disable expand/collapse transition when loading.
|
|
155
|
-
*/
|
|
156
|
-
this.isResizeToMobile = false;
|
|
157
|
-
/**
|
|
158
|
-
* Flag indicating that a new data source is currently being installed.
|
|
159
|
-
* During the install, any URL persistence operation should replace the current entry
|
|
160
|
-
* instead of creating a new one.
|
|
161
|
-
*/
|
|
162
|
-
this.dataSourceInstallInProgress = false;
|
|
163
|
-
this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
164
|
-
/**
|
|
165
|
-
* Updates the height of the left column according to its position on the page.
|
|
166
|
-
* Arrow function ensures proper `this` binding.
|
|
167
|
-
*/
|
|
168
|
-
this.updateLeftColumnHeight = () => {
|
|
169
|
-
var _a, _b, _c, _d, _e;
|
|
170
|
-
if (this.mobileView) {
|
|
171
|
-
(_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
|
|
175
|
-
const columnHeight = window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0);
|
|
176
|
-
const cssHeightValue = clientTop === 0
|
|
177
|
-
? null
|
|
178
|
-
: // Subtract off the column's top padding so that it doesn't overflow
|
|
179
|
-
`calc(${columnHeight}px - var(--leftColumnPaddingTop, 2rem))`;
|
|
180
|
-
(_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', cssHeightValue);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* Toggles whether the fade-out is visible at the bottom of the facets.
|
|
185
|
-
* It should only be visible if the facets are not scrolled to the bottom.
|
|
186
|
-
* Arrow function ensures proper `this` binding.
|
|
187
|
-
*/
|
|
188
|
-
this.updateFacetFadeOut = (entries) => {
|
|
189
|
-
var _a, _b;
|
|
190
|
-
const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
|
|
191
|
-
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);
|
|
192
|
-
};
|
|
193
|
-
// we only want to scroll on the very first query change
|
|
194
|
-
// so this keeps track of whether we've already set the initial query
|
|
195
|
-
this.initialQueryChangeHappened = false;
|
|
196
|
-
this.historyPopOccurred = false;
|
|
197
|
-
this.addController(this.dataSource);
|
|
198
|
-
}
|
|
199
|
-
tileModelAtCellIndex(index) {
|
|
200
|
-
const model = this.dataSource.getTileModelAt(index);
|
|
201
|
-
/**
|
|
202
|
-
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
203
|
-
* automated scroll, fetch the page and just return undefined.
|
|
204
|
-
* The datasource will be updated once the page is loaded and the cell will be rendered.
|
|
205
|
-
*
|
|
206
|
-
* We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
|
|
207
|
-
* user may never see.
|
|
208
|
-
*/
|
|
209
|
-
if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
|
|
210
|
-
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
211
|
-
this.dataSource.fetchPage(pageNumber);
|
|
212
|
-
}
|
|
213
|
-
return model;
|
|
214
|
-
}
|
|
215
|
-
// this is the total number of tiles we expect if
|
|
216
|
-
// the data returned is a full page worth
|
|
217
|
-
// this is useful for putting in placeholders for the expected number of tiles
|
|
218
|
-
get estimatedTileCount() {
|
|
219
|
-
return this.pagesToRender * this.pageSize;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Returns a promise resolving to a unique string that persists for the current browser session.
|
|
223
|
-
* Used in generating unique IDs for search requests, so that multiple requests coming from the
|
|
224
|
-
* same browser session can be identified.
|
|
225
|
-
*/
|
|
226
|
-
async getSessionId() {
|
|
227
|
-
try {
|
|
228
|
-
const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
|
|
229
|
-
if (storedSessionId) {
|
|
230
|
-
return storedSessionId;
|
|
231
|
-
}
|
|
232
|
-
// If we enter this method a second time while a first session ID is already being generated,
|
|
233
|
-
// ensure we produce the same ID from both calls instead of generating another one.
|
|
234
|
-
if (this.sessionIdGenPromise) {
|
|
235
|
-
return this.sessionIdGenPromise;
|
|
236
|
-
}
|
|
237
|
-
this.sessionIdGenPromise = sha1(Math.random().toString());
|
|
238
|
-
const newSessionId = await this.sessionIdGenPromise;
|
|
239
|
-
sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
|
|
240
|
-
return newSessionId;
|
|
241
|
-
}
|
|
242
|
-
catch (err) {
|
|
243
|
-
// Either we can't generate the hash or we're restricted from accessing sessionStorage
|
|
244
|
-
return '';
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Go to the given page of results
|
|
249
|
-
*
|
|
250
|
-
* @param pageNumber
|
|
251
|
-
*/
|
|
252
|
-
goToPage(pageNumber) {
|
|
253
|
-
this.initialPageNumber = pageNumber;
|
|
254
|
-
this.pagesToRender = pageNumber;
|
|
255
|
-
return this.scrollToPage(pageNumber);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Sets the state for whether the initial set of search results is loading in.
|
|
259
|
-
*/
|
|
260
|
-
setSearchResultsLoading(loading) {
|
|
261
|
-
this.searchResultsLoading = loading;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Sets the state for whether facet data is loading in
|
|
265
|
-
*/
|
|
266
|
-
setFacetsLoading(loading) {
|
|
267
|
-
this.facetsLoading = loading;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Sets the total number of results to be displayed for the current search
|
|
271
|
-
*/
|
|
272
|
-
setTotalResultCount(totalResults) {
|
|
273
|
-
this.totalResults = totalResults;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Clears all selected/negated facets, date ranges, and letter filters.
|
|
277
|
-
*
|
|
278
|
-
* By default, the current sort field/direction are not cleared,
|
|
279
|
-
* but this can be overridden by setting the `sort` option to `true`.
|
|
280
|
-
*
|
|
281
|
-
* Similarly, it is possible to finely control what is cleared by
|
|
282
|
-
* setting any of the `facets`, `dateRange`, or `letterFilters` flags
|
|
283
|
-
* in the options object.
|
|
284
|
-
*/
|
|
285
|
-
clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
|
|
286
|
-
// Don't bother clearing facets if none are checked, so that we don't
|
|
287
|
-
// trigger unnecessary update cycles.
|
|
288
|
-
if (facets && this.hasCheckedFacets) {
|
|
289
|
-
this.selectedFacets = getDefaultSelectedFacets();
|
|
290
|
-
}
|
|
291
|
-
if (dateRange) {
|
|
292
|
-
this.minSelectedDate = undefined;
|
|
293
|
-
this.maxSelectedDate = undefined;
|
|
294
|
-
}
|
|
295
|
-
if (letterFilters) {
|
|
296
|
-
this.selectedTitleFilter = null;
|
|
297
|
-
this.selectedCreatorFilter = null;
|
|
298
|
-
}
|
|
299
|
-
if (sort) {
|
|
300
|
-
this.sortDirection = null;
|
|
301
|
-
this.selectedSort = SortField.default;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Returns true if the current value of `this.selectedFacets` contains
|
|
306
|
-
* any facet buckets than have been selected or negated, or false otherwise.
|
|
307
|
-
*/
|
|
308
|
-
get hasCheckedFacets() {
|
|
309
|
-
if (!this.selectedFacets)
|
|
310
|
-
return false;
|
|
311
|
-
for (const facetGroup of Object.values(this.selectedFacets)) {
|
|
312
|
-
for (const bucket of Object.values(facetGroup)) {
|
|
313
|
-
if (bucket.state !== 'none')
|
|
314
|
-
return true;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Returns true if there are any currently selected/negated facet buckets,
|
|
321
|
-
* any selected date range, or any selected letter filters. False otherwise.
|
|
322
|
-
*
|
|
323
|
-
* Ignores sorting options.
|
|
324
|
-
*/
|
|
325
|
-
get hasActiveFilters() {
|
|
326
|
-
return !!(this.hasCheckedFacets ||
|
|
327
|
-
this.minSelectedDate ||
|
|
328
|
-
this.maxSelectedDate ||
|
|
329
|
-
this.selectedTitleFilter ||
|
|
330
|
-
this.selectedCreatorFilter);
|
|
331
|
-
}
|
|
332
|
-
willUpdate() {
|
|
333
|
-
this.setPlaceholderType();
|
|
334
|
-
}
|
|
335
|
-
render() {
|
|
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 { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
|
|
13
|
+
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
14
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
15
|
+
import { srOnlyStyle } from './styles/sr-only';
|
|
16
|
+
import { sha1 } from './utils/sha1';
|
|
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
|
+
import './collection-facets/smart-facets/smart-facet-bar';
|
|
26
|
+
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.baseImageUrl = 'https://archive.org';
|
|
30
|
+
/**
|
|
31
|
+
* Which backend should be targeted by searches (e.g., metadata or FTS)
|
|
32
|
+
*/
|
|
33
|
+
this.searchType = SearchType.METADATA;
|
|
34
|
+
this.selectedSort = SortField.default;
|
|
35
|
+
this.selectedTitleFilter = null;
|
|
36
|
+
this.selectedCreatorFilter = null;
|
|
37
|
+
this.sortDirection = null;
|
|
38
|
+
this.defaultSortField = SortField.relevance;
|
|
39
|
+
this.defaultSortDirection = null;
|
|
40
|
+
this.pageSize = 50;
|
|
41
|
+
this.showSmartFacetBar = false;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to show the date picker (above the facets)
|
|
44
|
+
*/
|
|
45
|
+
this.showHistogramDatePicker = false;
|
|
46
|
+
/**
|
|
47
|
+
* Whether placeholder views should be suppressed. If true, searches that produce an
|
|
48
|
+
* error or empty result set will simply show a blank results view instead of a placeholder.
|
|
49
|
+
*/
|
|
50
|
+
this.suppressPlaceholders = false;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the result count text should be suppressed.
|
|
53
|
+
* If true, no "X Results" message will be shown.
|
|
54
|
+
*/
|
|
55
|
+
this.suppressResultCount = false;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the scrolling result view should be suppressed entirely.
|
|
58
|
+
* If true, no infinite scroller (and thus no result tiles) will be rendered.
|
|
59
|
+
*/
|
|
60
|
+
this.suppressResultTiles = false;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to suppress persistence of the query to the URL.
|
|
63
|
+
* If true, the `query` param will not be added to the URL or updated on query changes.
|
|
64
|
+
*/
|
|
65
|
+
this.suppressURLQuery = false;
|
|
66
|
+
/**
|
|
67
|
+
* Whether to suppress display of the sort bar.
|
|
68
|
+
* If true, the entire sort bar (incl. display modes) will be omitted from rendering.
|
|
69
|
+
*/
|
|
70
|
+
this.suppressSortBar = false;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to suppress showing the display mode options in the sort bar.
|
|
73
|
+
* If true, those options will be omitted (though the rest of the sort bar may still render).
|
|
74
|
+
*/
|
|
75
|
+
this.suppressDisplayModes = false;
|
|
76
|
+
/**
|
|
77
|
+
* What strategy to use for when/whether to load facet data for a search.
|
|
78
|
+
*
|
|
79
|
+
* Defaults to `eager`, always loading facets immediately alongside search results.
|
|
80
|
+
*
|
|
81
|
+
* To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
|
|
82
|
+
* will delay loading facets in the mobile view until the "Filters" accordion is opened.
|
|
83
|
+
* Facets are still loaded eagerly when viewing the desktop layout.
|
|
84
|
+
*
|
|
85
|
+
* To further reduce facet requests for patrons who do not need to use them, this can be
|
|
86
|
+
* again reduced to `opt-in`, which will also require desktop users to explicitly request
|
|
87
|
+
* that they be loaded (in addition to the lazy mobile behavior described above).
|
|
88
|
+
*
|
|
89
|
+
* To entirely suppress facets from being loaded, this may be set to `off`.
|
|
90
|
+
*/
|
|
91
|
+
this.facetLoadStrategy = 'eager';
|
|
92
|
+
this.facetPaneVisible = false;
|
|
93
|
+
this.clearResultsOnEmptyQuery = false;
|
|
94
|
+
this.collectionPagePath = '/details/';
|
|
95
|
+
/** describes where this component is being used */
|
|
96
|
+
this.searchContext = analyticsCategories.default;
|
|
97
|
+
this.pageContext = 'search';
|
|
98
|
+
this.restorationStateHandler = new RestorationStateHandler({
|
|
99
|
+
context: this.pageContext,
|
|
100
|
+
});
|
|
101
|
+
this.mobileBreakpoint = 600;
|
|
102
|
+
this.loggedIn = false;
|
|
103
|
+
this.modalManager = undefined;
|
|
104
|
+
/**
|
|
105
|
+
* If item management UI active
|
|
106
|
+
*/
|
|
107
|
+
this.isManageView = false;
|
|
108
|
+
this.manageViewLabel = 'Select items to remove';
|
|
109
|
+
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
110
|
+
this.enableSortOptionsSlot = false;
|
|
111
|
+
/** Whether to display a smart results carousel above the full results */
|
|
112
|
+
this.showSmartResults = false;
|
|
113
|
+
/**
|
|
114
|
+
* The maximum number of pages we will load when a privileged user clicks
|
|
115
|
+
* the "Manage" button on the search page. Limited to 15 pages.
|
|
116
|
+
*/
|
|
117
|
+
this.maxPagesToManage = 15;
|
|
118
|
+
/**
|
|
119
|
+
* The results per page so we can paginate.
|
|
120
|
+
*
|
|
121
|
+
* This allows us to start in the middle of the search results and
|
|
122
|
+
* fetch data before or after the current page. If we don't have a key
|
|
123
|
+
* for the previous/next page, we'll fetch the next/previous page to populate it
|
|
124
|
+
*/
|
|
125
|
+
this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
|
|
126
|
+
/**
|
|
127
|
+
* The page that the consumer wants to load.
|
|
128
|
+
*/
|
|
129
|
+
this.initialPageNumber = 1;
|
|
130
|
+
/**
|
|
131
|
+
* This the the number of pages that we want to show.
|
|
132
|
+
*
|
|
133
|
+
* The data isn't necessarily loaded for all of the pages, but this lets us
|
|
134
|
+
* know how many cells we should render.
|
|
135
|
+
*/
|
|
136
|
+
this.pagesToRender = this.initialPageNumber;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the initial page fetch for a new query is currently in progress.
|
|
139
|
+
*/
|
|
140
|
+
this.searchResultsLoading = false;
|
|
141
|
+
this.facetsLoading = false;
|
|
142
|
+
this.mobileView = false;
|
|
143
|
+
this.collapsibleFacetsVisible = false;
|
|
144
|
+
this.placeholderType = null;
|
|
145
|
+
/** Whether layout size analytics have been sent already. */
|
|
146
|
+
this.layoutSizeAnalyticsSent = false;
|
|
147
|
+
/**
|
|
148
|
+
* When we're animated scrolling to the page, we don't want to fetch
|
|
149
|
+
* all of the pages as it scrolls so this lets us know if we're scrolling
|
|
150
|
+
*/
|
|
151
|
+
this.isScrollingToCell = false;
|
|
152
|
+
/**
|
|
153
|
+
* When page width resizes from desktop to mobile, set true to
|
|
154
|
+
* disable expand/collapse transition when loading.
|
|
155
|
+
*/
|
|
156
|
+
this.isResizeToMobile = false;
|
|
157
|
+
/**
|
|
158
|
+
* Flag indicating that a new data source is currently being installed.
|
|
159
|
+
* During the install, any URL persistence operation should replace the current entry
|
|
160
|
+
* instead of creating a new one.
|
|
161
|
+
*/
|
|
162
|
+
this.dataSourceInstallInProgress = false;
|
|
163
|
+
this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
164
|
+
/**
|
|
165
|
+
* Updates the height of the left column according to its position on the page.
|
|
166
|
+
* Arrow function ensures proper `this` binding.
|
|
167
|
+
*/
|
|
168
|
+
this.updateLeftColumnHeight = () => {
|
|
169
|
+
var _a, _b, _c, _d, _e;
|
|
170
|
+
if (this.mobileView) {
|
|
171
|
+
(_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
|
|
175
|
+
const columnHeight = window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0);
|
|
176
|
+
const cssHeightValue = clientTop === 0
|
|
177
|
+
? null
|
|
178
|
+
: // Subtract off the column's top padding so that it doesn't overflow
|
|
179
|
+
`calc(${columnHeight}px - var(--leftColumnPaddingTop, 2rem))`;
|
|
180
|
+
(_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', cssHeightValue);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Toggles whether the fade-out is visible at the bottom of the facets.
|
|
185
|
+
* It should only be visible if the facets are not scrolled to the bottom.
|
|
186
|
+
* Arrow function ensures proper `this` binding.
|
|
187
|
+
*/
|
|
188
|
+
this.updateFacetFadeOut = (entries) => {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
|
|
191
|
+
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);
|
|
192
|
+
};
|
|
193
|
+
// we only want to scroll on the very first query change
|
|
194
|
+
// so this keeps track of whether we've already set the initial query
|
|
195
|
+
this.initialQueryChangeHappened = false;
|
|
196
|
+
this.historyPopOccurred = false;
|
|
197
|
+
this.addController(this.dataSource);
|
|
198
|
+
}
|
|
199
|
+
tileModelAtCellIndex(index) {
|
|
200
|
+
const model = this.dataSource.getTileModelAt(index);
|
|
201
|
+
/**
|
|
202
|
+
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
203
|
+
* automated scroll, fetch the page and just return undefined.
|
|
204
|
+
* The datasource will be updated once the page is loaded and the cell will be rendered.
|
|
205
|
+
*
|
|
206
|
+
* We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
|
|
207
|
+
* user may never see.
|
|
208
|
+
*/
|
|
209
|
+
if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
|
|
210
|
+
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
211
|
+
this.dataSource.fetchPage(pageNumber);
|
|
212
|
+
}
|
|
213
|
+
return model;
|
|
214
|
+
}
|
|
215
|
+
// this is the total number of tiles we expect if
|
|
216
|
+
// the data returned is a full page worth
|
|
217
|
+
// this is useful for putting in placeholders for the expected number of tiles
|
|
218
|
+
get estimatedTileCount() {
|
|
219
|
+
return this.pagesToRender * this.pageSize;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Returns a promise resolving to a unique string that persists for the current browser session.
|
|
223
|
+
* Used in generating unique IDs for search requests, so that multiple requests coming from the
|
|
224
|
+
* same browser session can be identified.
|
|
225
|
+
*/
|
|
226
|
+
async getSessionId() {
|
|
227
|
+
try {
|
|
228
|
+
const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
|
|
229
|
+
if (storedSessionId) {
|
|
230
|
+
return storedSessionId;
|
|
231
|
+
}
|
|
232
|
+
// If we enter this method a second time while a first session ID is already being generated,
|
|
233
|
+
// ensure we produce the same ID from both calls instead of generating another one.
|
|
234
|
+
if (this.sessionIdGenPromise) {
|
|
235
|
+
return this.sessionIdGenPromise;
|
|
236
|
+
}
|
|
237
|
+
this.sessionIdGenPromise = sha1(Math.random().toString());
|
|
238
|
+
const newSessionId = await this.sessionIdGenPromise;
|
|
239
|
+
sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
|
|
240
|
+
return newSessionId;
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
// Either we can't generate the hash or we're restricted from accessing sessionStorage
|
|
244
|
+
return '';
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Go to the given page of results
|
|
249
|
+
*
|
|
250
|
+
* @param pageNumber
|
|
251
|
+
*/
|
|
252
|
+
goToPage(pageNumber) {
|
|
253
|
+
this.initialPageNumber = pageNumber;
|
|
254
|
+
this.pagesToRender = pageNumber;
|
|
255
|
+
return this.scrollToPage(pageNumber);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Sets the state for whether the initial set of search results is loading in.
|
|
259
|
+
*/
|
|
260
|
+
setSearchResultsLoading(loading) {
|
|
261
|
+
this.searchResultsLoading = loading;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Sets the state for whether facet data is loading in
|
|
265
|
+
*/
|
|
266
|
+
setFacetsLoading(loading) {
|
|
267
|
+
this.facetsLoading = loading;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Sets the total number of results to be displayed for the current search
|
|
271
|
+
*/
|
|
272
|
+
setTotalResultCount(totalResults) {
|
|
273
|
+
this.totalResults = totalResults;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Clears all selected/negated facets, date ranges, and letter filters.
|
|
277
|
+
*
|
|
278
|
+
* By default, the current sort field/direction are not cleared,
|
|
279
|
+
* but this can be overridden by setting the `sort` option to `true`.
|
|
280
|
+
*
|
|
281
|
+
* Similarly, it is possible to finely control what is cleared by
|
|
282
|
+
* setting any of the `facets`, `dateRange`, or `letterFilters` flags
|
|
283
|
+
* in the options object.
|
|
284
|
+
*/
|
|
285
|
+
clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
|
|
286
|
+
// Don't bother clearing facets if none are checked, so that we don't
|
|
287
|
+
// trigger unnecessary update cycles.
|
|
288
|
+
if (facets && this.hasCheckedFacets) {
|
|
289
|
+
this.selectedFacets = getDefaultSelectedFacets();
|
|
290
|
+
}
|
|
291
|
+
if (dateRange) {
|
|
292
|
+
this.minSelectedDate = undefined;
|
|
293
|
+
this.maxSelectedDate = undefined;
|
|
294
|
+
}
|
|
295
|
+
if (letterFilters) {
|
|
296
|
+
this.selectedTitleFilter = null;
|
|
297
|
+
this.selectedCreatorFilter = null;
|
|
298
|
+
}
|
|
299
|
+
if (sort) {
|
|
300
|
+
this.sortDirection = null;
|
|
301
|
+
this.selectedSort = SortField.default;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Returns true if the current value of `this.selectedFacets` contains
|
|
306
|
+
* any facet buckets than have been selected or negated, or false otherwise.
|
|
307
|
+
*/
|
|
308
|
+
get hasCheckedFacets() {
|
|
309
|
+
if (!this.selectedFacets)
|
|
310
|
+
return false;
|
|
311
|
+
for (const facetGroup of Object.values(this.selectedFacets)) {
|
|
312
|
+
for (const bucket of Object.values(facetGroup)) {
|
|
313
|
+
if (bucket.state !== 'none')
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Returns true if there are any currently selected/negated facet buckets,
|
|
321
|
+
* any selected date range, or any selected letter filters. False otherwise.
|
|
322
|
+
*
|
|
323
|
+
* Ignores sorting options.
|
|
324
|
+
*/
|
|
325
|
+
get hasActiveFilters() {
|
|
326
|
+
return !!(this.hasCheckedFacets ||
|
|
327
|
+
this.minSelectedDate ||
|
|
328
|
+
this.maxSelectedDate ||
|
|
329
|
+
this.selectedTitleFilter ||
|
|
330
|
+
this.selectedCreatorFilter);
|
|
331
|
+
}
|
|
332
|
+
willUpdate() {
|
|
333
|
+
this.setPlaceholderType();
|
|
334
|
+
}
|
|
335
|
+
render() {
|
|
336
336
|
return html `
|
|
337
|
-
${this.showSmartFacetBar
|
|
337
|
+
${this.showSmartFacetBar
|
|
338
338
|
? html ` <smart-facet-bar
|
|
339
339
|
.query=${this.baseQuery}
|
|
340
340
|
.aggregations=${this.dataSource.aggregations}
|
|
@@ -342,59 +342,59 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
342
342
|
.collectionTitles=${this.dataSource.collectionTitles}
|
|
343
343
|
.filterToggleActive=${this.facetPaneVisible}
|
|
344
344
|
@facetsChanged=${this.facetsChanged}
|
|
345
|
-
@filtersToggled=${() => {
|
|
346
|
-
this.facetPaneVisible = !this.facetPaneVisible;
|
|
345
|
+
@filtersToggled=${() => {
|
|
346
|
+
this.facetPaneVisible = !this.facetPaneVisible;
|
|
347
347
|
}}
|
|
348
|
-
></smart-facet-bar>`
|
|
348
|
+
></smart-facet-bar>`
|
|
349
349
|
: nothing}
|
|
350
350
|
|
|
351
351
|
<div
|
|
352
352
|
id="content-container"
|
|
353
353
|
class=${this.mobileView ? 'mobile' : 'desktop'}
|
|
354
354
|
>
|
|
355
|
-
${this.placeholderType
|
|
356
|
-
? this.emptyPlaceholderTemplate
|
|
355
|
+
${this.placeholderType
|
|
356
|
+
? this.emptyPlaceholderTemplate
|
|
357
357
|
: this.collectionBrowserTemplate}
|
|
358
358
|
</div>
|
|
359
|
-
`;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Determines what type of placeholder content should be shown instead of result tiles, if applicable.
|
|
363
|
-
* The placeholders indicate states where we have no results to show, which could be the result of:
|
|
364
|
-
* - No query is set (on the search page)
|
|
365
|
-
* - No results were returned for the most recent search
|
|
366
|
-
* - The collection being searched within has no viewable items
|
|
367
|
-
* - An error occurred on the most recent search attempt
|
|
368
|
-
*/
|
|
369
|
-
setPlaceholderType() {
|
|
370
|
-
var _a;
|
|
371
|
-
const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
372
|
-
const isCollection = !!this.withinCollection;
|
|
373
|
-
const isProfile = !!this.withinProfile;
|
|
374
|
-
const noResults = !this.searchResultsLoading &&
|
|
375
|
-
(this.dataSource.size === 0 || !this.searchService);
|
|
376
|
-
this.placeholderType = null;
|
|
377
|
-
if (this.suppressPlaceholders)
|
|
378
|
-
return;
|
|
379
|
-
if (!hasQuery && !isCollection && !isProfile) {
|
|
380
|
-
this.placeholderType = 'empty-query';
|
|
381
|
-
}
|
|
382
|
-
else if (noResults) {
|
|
383
|
-
// Within a collection, no query + no results means the collection simply has no viewable items.
|
|
384
|
-
// Otherwise, we must have a user query that produced 0 results.
|
|
385
|
-
this.placeholderType =
|
|
386
|
-
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
387
|
-
}
|
|
388
|
-
if (this.dataSource.queryErrorMessage) {
|
|
389
|
-
this.placeholderType =
|
|
390
|
-
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Template for the placeholder content to show when no results are available.
|
|
395
|
-
*/
|
|
396
|
-
get emptyPlaceholderTemplate() {
|
|
397
|
-
var _a;
|
|
359
|
+
`;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Determines what type of placeholder content should be shown instead of result tiles, if applicable.
|
|
363
|
+
* The placeholders indicate states where we have no results to show, which could be the result of:
|
|
364
|
+
* - No query is set (on the search page)
|
|
365
|
+
* - No results were returned for the most recent search
|
|
366
|
+
* - The collection being searched within has no viewable items
|
|
367
|
+
* - An error occurred on the most recent search attempt
|
|
368
|
+
*/
|
|
369
|
+
setPlaceholderType() {
|
|
370
|
+
var _a;
|
|
371
|
+
const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
372
|
+
const isCollection = !!this.withinCollection;
|
|
373
|
+
const isProfile = !!this.withinProfile;
|
|
374
|
+
const noResults = !this.searchResultsLoading &&
|
|
375
|
+
(this.dataSource.size === 0 || !this.searchService);
|
|
376
|
+
this.placeholderType = null;
|
|
377
|
+
if (this.suppressPlaceholders)
|
|
378
|
+
return;
|
|
379
|
+
if (!hasQuery && !isCollection && !isProfile) {
|
|
380
|
+
this.placeholderType = 'empty-query';
|
|
381
|
+
}
|
|
382
|
+
else if (noResults) {
|
|
383
|
+
// Within a collection, no query + no results means the collection simply has no viewable items.
|
|
384
|
+
// Otherwise, we must have a user query that produced 0 results.
|
|
385
|
+
this.placeholderType =
|
|
386
|
+
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
387
|
+
}
|
|
388
|
+
if (this.dataSource.queryErrorMessage) {
|
|
389
|
+
this.placeholderType =
|
|
390
|
+
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Template for the placeholder content to show when no results are available.
|
|
395
|
+
*/
|
|
396
|
+
get emptyPlaceholderTemplate() {
|
|
397
|
+
var _a;
|
|
398
398
|
return html `
|
|
399
399
|
<empty-placeholder
|
|
400
400
|
.placeholderType=${this.placeholderType}
|
|
@@ -403,33 +403,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
403
403
|
.detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
|
|
404
404
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
405
405
|
></empty-placeholder>
|
|
406
|
-
`;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Top-level template for rendering the left (facets) and right (results) columns.
|
|
410
|
-
*/
|
|
411
|
-
get collectionBrowserTemplate() {
|
|
406
|
+
`;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Top-level template for rendering the left (facets) and right (results) columns.
|
|
410
|
+
*/
|
|
411
|
+
get collectionBrowserTemplate() {
|
|
412
412
|
return html `
|
|
413
413
|
<div id="left-column-scroll-sentinel"></div>
|
|
414
414
|
${this.leftColumnTemplate} ${this.rightColumnTemplate}
|
|
415
|
-
`;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Template for either the mobile or desktop version of the left column, depending
|
|
419
|
-
* on current component state.
|
|
420
|
-
*/
|
|
421
|
-
get leftColumnTemplate() {
|
|
422
|
-
if (this.mobileView) {
|
|
423
|
-
return this.mobileLeftColumnTemplate;
|
|
424
|
-
}
|
|
425
|
-
return this.desktopLeftColumnTemplate;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Template for the mobile version of the "left column" (which in this case, appears
|
|
429
|
-
* *above* the search results rather than beside them), for rendering the
|
|
430
|
-
* accordion-style facets.
|
|
431
|
-
*/
|
|
432
|
-
get mobileLeftColumnTemplate() {
|
|
415
|
+
`;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Template for either the mobile or desktop version of the left column, depending
|
|
419
|
+
* on current component state.
|
|
420
|
+
*/
|
|
421
|
+
get leftColumnTemplate() {
|
|
422
|
+
if (this.mobileView) {
|
|
423
|
+
return this.mobileLeftColumnTemplate;
|
|
424
|
+
}
|
|
425
|
+
return this.desktopLeftColumnTemplate;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Template for the mobile version of the "left column" (which in this case, appears
|
|
429
|
+
* *above* the search results rather than beside them), for rendering the
|
|
430
|
+
* accordion-style facets.
|
|
431
|
+
*/
|
|
432
|
+
get mobileLeftColumnTemplate() {
|
|
433
433
|
return html `
|
|
434
434
|
<div
|
|
435
435
|
id="left-column"
|
|
@@ -438,12 +438,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
438
438
|
${this.facetTopViewSlot} ${this.resultsCountTemplate}
|
|
439
439
|
<div id="facets-header-container">${this.mobileFacetsTemplate}</div>
|
|
440
440
|
</div>
|
|
441
|
-
`;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Template for the desktop version of the left column, displaying the facets sidebar.
|
|
445
|
-
*/
|
|
446
|
-
get desktopLeftColumnTemplate() {
|
|
441
|
+
`;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Template for the desktop version of the left column, displaying the facets sidebar.
|
|
445
|
+
*/
|
|
446
|
+
get desktopLeftColumnTemplate() {
|
|
447
447
|
return html `
|
|
448
448
|
<div
|
|
449
449
|
id="left-column"
|
|
@@ -461,29 +461,29 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
461
461
|
</div>
|
|
462
462
|
<div id="facets-bottom-fade"></div>
|
|
463
463
|
</div>
|
|
464
|
-
`;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Slot which is placed at top of the facets area for user-profile page
|
|
468
|
-
* - mainly used to render userlists
|
|
469
|
-
*/
|
|
470
|
-
get facetTopViewSlot() {
|
|
464
|
+
`;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Slot which is placed at top of the facets area for user-profile page
|
|
468
|
+
* - mainly used to render userlists
|
|
469
|
+
*/
|
|
470
|
+
get facetTopViewSlot() {
|
|
471
471
|
return html `<div id="facet-top-view">
|
|
472
472
|
<slot name="facet-top-slot"></slot>
|
|
473
|
-
</div>`;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Template for the "X Results" count at the top of the search results.
|
|
477
|
-
* Changes to the "Searching..." label if the search results are still loading.
|
|
478
|
-
*/
|
|
479
|
-
get resultsCountTemplate() {
|
|
480
|
-
var _a;
|
|
481
|
-
if (this.suppressResultCount)
|
|
482
|
-
return nothing;
|
|
483
|
-
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
484
|
-
const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
|
|
485
|
-
const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
|
|
486
|
-
// Added data-testid for Playwright testing
|
|
473
|
+
</div>`;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Template for the "X Results" count at the top of the search results.
|
|
477
|
+
* Changes to the "Searching..." label if the search results are still loading.
|
|
478
|
+
*/
|
|
479
|
+
get resultsCountTemplate() {
|
|
480
|
+
var _a;
|
|
481
|
+
if (this.suppressResultCount)
|
|
482
|
+
return nothing;
|
|
483
|
+
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
484
|
+
const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
|
|
485
|
+
const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
|
|
486
|
+
// Added data-testid for Playwright testing
|
|
487
487
|
return html `
|
|
488
488
|
<div id="results-total" data-testid="results-total">
|
|
489
489
|
<span id="big-results-count">
|
|
@@ -493,46 +493,46 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
493
493
|
${shouldShowSearching ? nothing : resultsLabel}
|
|
494
494
|
</span>
|
|
495
495
|
</div>
|
|
496
|
-
`;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Template for the right column of the collection browser, where the result
|
|
500
|
-
* tiles and sort/filter bar are shown.
|
|
501
|
-
*/
|
|
502
|
-
get rightColumnTemplate() {
|
|
496
|
+
`;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Template for the right column of the collection browser, where the result
|
|
500
|
+
* tiles and sort/filter bar are shown.
|
|
501
|
+
*/
|
|
502
|
+
get rightColumnTemplate() {
|
|
503
503
|
return html `
|
|
504
504
|
<div
|
|
505
505
|
id="right-column"
|
|
506
506
|
class="column ${this.showSmartResults ? 'smart-results-spacing' : ''}"
|
|
507
507
|
>
|
|
508
|
-
${this.showSmartResults
|
|
509
|
-
? html `<slot name="smart-results"></slot>`
|
|
508
|
+
${this.showSmartResults
|
|
509
|
+
? html `<slot name="smart-results"></slot>`
|
|
510
510
|
: nothing}
|
|
511
511
|
<section id="results">
|
|
512
|
-
${this.showSmartResults
|
|
512
|
+
${this.showSmartResults
|
|
513
513
|
? html `<h2 class="results-section-heading">
|
|
514
514
|
${msg('All results')}
|
|
515
|
-
</h2>`
|
|
515
|
+
</h2>`
|
|
516
516
|
: nothing}
|
|
517
517
|
<div id="cb-top-view">
|
|
518
518
|
<slot name="cb-top-slot"></slot>
|
|
519
519
|
</div>
|
|
520
|
-
${this.isManageView
|
|
521
|
-
? this.manageBarTemplate
|
|
520
|
+
${this.isManageView
|
|
521
|
+
? this.manageBarTemplate
|
|
522
522
|
: this.sortFilterBarTemplate}
|
|
523
523
|
<slot name="cb-results"></slot>
|
|
524
|
-
${this.displayMode === `list-compact` && this.totalResults
|
|
525
|
-
? this.listHeaderTemplate
|
|
524
|
+
${this.displayMode === `list-compact` && this.totalResults
|
|
525
|
+
? this.listHeaderTemplate
|
|
526
526
|
: nothing}
|
|
527
527
|
${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
|
|
528
528
|
</section>
|
|
529
529
|
</div>
|
|
530
|
-
`;
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Template for the infinite scroller widget that contains the result tiles.
|
|
534
|
-
*/
|
|
535
|
-
get infiniteScrollerTemplate() {
|
|
530
|
+
`;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Template for the infinite scroller widget that contains the result tiles.
|
|
534
|
+
*/
|
|
535
|
+
get infiniteScrollerTemplate() {
|
|
536
536
|
return html `<infinite-scroller
|
|
537
537
|
class=${this.infiniteScrollerClasses}
|
|
538
538
|
itemCount=${this.placeholderType ? 0 : nothing}
|
|
@@ -541,29 +541,29 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
541
541
|
.placeholderCellTemplate=${this.placeholderCellTemplate}
|
|
542
542
|
@scrollThresholdReached=${this.scrollThresholdReached}
|
|
543
543
|
@visibleCellsChanged=${this.visibleCellsChanged}
|
|
544
|
-
>${this.displayMode === 'grid'
|
|
545
|
-
? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
|
|
544
|
+
>${this.displayMode === 'grid'
|
|
545
|
+
? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
|
|
546
546
|
: nothing}
|
|
547
|
-
</infinite-scroller>`;
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Produces a `classMap` indicating which classes the infinite scroller should have
|
|
551
|
-
* given the current display mode & placeholder case.
|
|
552
|
-
*/
|
|
553
|
-
get infiniteScrollerClasses() {
|
|
554
|
-
var _a;
|
|
555
|
-
return classMap({
|
|
556
|
-
[(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
|
|
557
|
-
hidden: !!this.placeholderType,
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Template for the sort & filtering bar that appears atop the search results.
|
|
562
|
-
*/
|
|
563
|
-
get sortFilterBarTemplate() {
|
|
564
|
-
var _a;
|
|
565
|
-
if (this.suppressSortBar)
|
|
566
|
-
return nothing;
|
|
547
|
+
</infinite-scroller>`;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Produces a `classMap` indicating which classes the infinite scroller should have
|
|
551
|
+
* given the current display mode & placeholder case.
|
|
552
|
+
*/
|
|
553
|
+
get infiniteScrollerClasses() {
|
|
554
|
+
var _a;
|
|
555
|
+
return classMap({
|
|
556
|
+
[(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
|
|
557
|
+
hidden: !!this.placeholderType,
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Template for the sort & filtering bar that appears atop the search results.
|
|
562
|
+
*/
|
|
563
|
+
get sortFilterBarTemplate() {
|
|
564
|
+
var _a;
|
|
565
|
+
if (this.suppressSortBar)
|
|
566
|
+
return nothing;
|
|
567
567
|
return html `
|
|
568
568
|
<sort-filter-bar
|
|
569
569
|
.defaultSortField=${this.defaultSortField}
|
|
@@ -588,16 +588,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
588
588
|
<slot name="sort-options" slot="sort-options"></slot>
|
|
589
589
|
<slot name="sort-options-right" slot="sort-options-right"></slot>
|
|
590
590
|
</sort-filter-bar>
|
|
591
|
-
`;
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Template for the manage bar UI that appears atop the search results when we are
|
|
595
|
-
* showing the management view. This generally replaces the sort bar when present.
|
|
596
|
-
*/
|
|
597
|
-
get manageBarTemplate() {
|
|
598
|
-
const manageViewModalMsg = this.profileElement === 'uploads'
|
|
599
|
-
? 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'
|
|
600
|
-
: nothing;
|
|
591
|
+
`;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Template for the manage bar UI that appears atop the search results when we are
|
|
595
|
+
* showing the management view. This generally replaces the sort bar when present.
|
|
596
|
+
*/
|
|
597
|
+
get manageBarTemplate() {
|
|
598
|
+
const manageViewModalMsg = this.profileElement === 'uploads'
|
|
599
|
+
? 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'
|
|
600
|
+
: nothing;
|
|
601
601
|
return html `
|
|
602
602
|
<manage-bar
|
|
603
603
|
.label=${this.manageViewLabel}
|
|
@@ -612,222 +612,222 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
612
612
|
@manageItems=${this.handleManageItems}
|
|
613
613
|
@selectAll=${() => this.dataSource.checkAllTiles()}
|
|
614
614
|
@unselectAll=${() => this.dataSource.uncheckAllTiles()}
|
|
615
|
-
@cancel=${() => {
|
|
616
|
-
this.isManageView = false;
|
|
617
|
-
this.dataSource.uncheckAllTiles();
|
|
618
|
-
if (this.searchResultsLoading)
|
|
619
|
-
this.dataSource.resetPages();
|
|
615
|
+
@cancel=${() => {
|
|
616
|
+
this.isManageView = false;
|
|
617
|
+
this.dataSource.uncheckAllTiles();
|
|
618
|
+
if (this.searchResultsLoading)
|
|
619
|
+
this.dataSource.resetPages();
|
|
620
620
|
}}
|
|
621
621
|
></manage-bar>
|
|
622
|
-
`;
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Handler for when the user requests to remove all checked items via the manage bar.
|
|
626
|
-
* Emits an `itemRemovalRequested` event with all checked tile models.
|
|
627
|
-
*/
|
|
628
|
-
handleRemoveItems() {
|
|
629
|
-
this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
|
|
630
|
-
detail: {
|
|
631
|
-
items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
|
|
632
|
-
},
|
|
633
|
-
}));
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Handler when user request to bulk edit from /search/ page
|
|
637
|
-
*/
|
|
638
|
-
handleManageItems() {
|
|
639
|
-
this.dispatchEvent(new CustomEvent('itemManagerRequested', {
|
|
640
|
-
detail: {
|
|
641
|
-
items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
|
|
642
|
-
},
|
|
643
|
-
}));
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Handler to show processing modal while removing item
|
|
647
|
-
*/
|
|
648
|
-
showRemoveItemsProcessingModal() {
|
|
649
|
-
var _a;
|
|
650
|
-
(_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsProcessingModal();
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Handler to show error modal when item removal failed
|
|
654
|
-
*/
|
|
655
|
-
showRemoveItemsErrorModal() {
|
|
656
|
-
var _a;
|
|
657
|
-
(_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsErrorModal();
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Removes all tile models that are currently checked & adjusts the paging
|
|
661
|
-
* of the data source to account for any new gaps in the data.
|
|
662
|
-
*/
|
|
663
|
-
removeCheckedTiles() {
|
|
664
|
-
this.dataSource.removeCheckedTiles();
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Handler for when the user changes the selected sort option or direction.
|
|
668
|
-
*/
|
|
669
|
-
userChangedSort(e) {
|
|
670
|
-
var _a;
|
|
671
|
-
const { selectedSort, sortDirection } = e.detail;
|
|
672
|
-
this.selectedSort = selectedSort;
|
|
673
|
-
this.sortDirection = sortDirection;
|
|
674
|
-
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
675
|
-
this.goToPage(1);
|
|
676
|
-
}
|
|
677
|
-
this.currentPage = 1;
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Fires an analytics event for sorting changes.
|
|
681
|
-
* @param prevSortDirection Which sort direction was previously set.
|
|
682
|
-
*/
|
|
683
|
-
sendSortByAnalytics(prevSortDirection) {
|
|
684
|
-
var _a;
|
|
685
|
-
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
686
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
687
|
-
category: this.searchContext,
|
|
688
|
-
action: analyticsActions.sortBy,
|
|
689
|
-
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Handler for when the selected sort option is updated, whether by the user
|
|
694
|
-
* themselves or programmatically.
|
|
695
|
-
*/
|
|
696
|
-
selectedSortChanged() {
|
|
697
|
-
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
698
|
-
this.dataSource.updatePrefixFiltersForCurrentSort();
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* An object representing the current sort field & direction.
|
|
702
|
-
*/
|
|
703
|
-
get sortParam() {
|
|
704
|
-
var _a;
|
|
705
|
-
const sortOption = SORT_OPTIONS[this.selectedSort];
|
|
706
|
-
if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
|
|
707
|
-
return null;
|
|
708
|
-
}
|
|
709
|
-
// If the sort option specified in the URL is unrecognized, we just use it as-is
|
|
710
|
-
const urlSortParam = new URL(window.location.href).searchParams.get('sort');
|
|
711
|
-
const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
|
|
712
|
-
// If the sort direction is still null at this point, then we assume ascending
|
|
713
|
-
// (i.e., it was unrecognized and had no directional flag)
|
|
714
|
-
if (!this.sortDirection)
|
|
715
|
-
this.sortDirection = 'asc';
|
|
716
|
-
if (!sortField)
|
|
717
|
-
return null;
|
|
718
|
-
return { field: sortField, direction: this.sortDirection };
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* An object representing the default sort field & direction, if none are explicitly set.
|
|
722
|
-
*/
|
|
723
|
-
get defaultSortParam() {
|
|
724
|
-
var _a;
|
|
725
|
-
const direction = (_a = this.defaultSortDirection) !== null && _a !== void 0 ? _a : 'asc';
|
|
726
|
-
const field = SORT_OPTIONS[this.defaultSortField].searchServiceKey;
|
|
727
|
-
if (!field)
|
|
728
|
-
return null;
|
|
729
|
-
return { field, direction };
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Handler for when the display mode option is changed (grid/list/compact-list views).
|
|
733
|
-
*/
|
|
734
|
-
displayModeChanged(e) {
|
|
735
|
-
var _a;
|
|
736
|
-
this.displayMode = e.detail.displayMode;
|
|
737
|
-
if (this.displayMode) {
|
|
738
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
739
|
-
category: this.searchContext,
|
|
740
|
-
action: analyticsActions.displayMode,
|
|
741
|
-
label: this.displayMode,
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Returns a query clause identifying the currently selected title filter,
|
|
747
|
-
* e.g., `firstTitle:X`.
|
|
748
|
-
*/
|
|
749
|
-
get titleQuery() {
|
|
750
|
-
return this.selectedTitleFilter
|
|
751
|
-
? `firstTitle:${this.selectedTitleFilter}`
|
|
752
|
-
: undefined;
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* Returns a query clause identifying the currently selected creator filter,
|
|
756
|
-
* e.g., `firstCreator:X`.
|
|
757
|
-
*/
|
|
758
|
-
get creatorQuery() {
|
|
759
|
-
return this.selectedCreatorFilter
|
|
760
|
-
? `firstCreator:${this.selectedCreatorFilter}`
|
|
761
|
-
: undefined;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Send Analytics when sorting by title's first letter
|
|
765
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
766
|
-
*/
|
|
767
|
-
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
768
|
-
var _a;
|
|
769
|
-
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
const cleared = prevSelectedLetter && !this.selectedTitleFilter;
|
|
773
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
774
|
-
category: this.searchContext,
|
|
775
|
-
action: analyticsActions.filterByTitle,
|
|
776
|
-
label: cleared
|
|
777
|
-
? `clear-${prevSelectedLetter}`
|
|
778
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Send Analytics when filtering by creator's first letter
|
|
783
|
-
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
784
|
-
*/
|
|
785
|
-
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
786
|
-
var _a;
|
|
787
|
-
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
|
|
791
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
792
|
-
category: this.searchContext,
|
|
793
|
-
action: analyticsActions.filterByCreator,
|
|
794
|
-
label: cleared
|
|
795
|
-
? `clear-${prevSelectedLetter}`
|
|
796
|
-
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Handler for changes to which letter is selected in the title alphabet bar.
|
|
801
|
-
*/
|
|
802
|
-
titleLetterSelected(e) {
|
|
803
|
-
this.selectedCreatorFilter = null;
|
|
804
|
-
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Handler for changes to which letter is selected in the creator alphabet bar.
|
|
808
|
-
*/
|
|
809
|
-
creatorLetterSelected(e) {
|
|
810
|
-
this.selectedTitleFilter = null;
|
|
811
|
-
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* The full template for how the facets should be structured in mobile view,
|
|
815
|
-
* including the collapsible container (with header) and the facets themselves.
|
|
816
|
-
*/
|
|
817
|
-
get mobileFacetsTemplate() {
|
|
818
|
-
if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
|
|
819
|
-
return nothing;
|
|
820
|
-
const toggleFacetsVisible = (e) => {
|
|
821
|
-
var _a;
|
|
822
|
-
const target = e.target;
|
|
823
|
-
this.isResizeToMobile = false;
|
|
824
|
-
this.collapsibleFacetsVisible = target.open;
|
|
825
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
826
|
-
category: this.searchContext,
|
|
827
|
-
action: analyticsActions.mobileFacetsToggled,
|
|
828
|
-
label: target.open ? 'open' : 'closed',
|
|
829
|
-
});
|
|
830
|
-
};
|
|
622
|
+
`;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Handler for when the user requests to remove all checked items via the manage bar.
|
|
626
|
+
* Emits an `itemRemovalRequested` event with all checked tile models.
|
|
627
|
+
*/
|
|
628
|
+
handleRemoveItems() {
|
|
629
|
+
this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
|
|
630
|
+
detail: {
|
|
631
|
+
items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
|
|
632
|
+
},
|
|
633
|
+
}));
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Handler when user request to bulk edit from /search/ page
|
|
637
|
+
*/
|
|
638
|
+
handleManageItems() {
|
|
639
|
+
this.dispatchEvent(new CustomEvent('itemManagerRequested', {
|
|
640
|
+
detail: {
|
|
641
|
+
items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
|
|
642
|
+
},
|
|
643
|
+
}));
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Handler to show processing modal while removing item
|
|
647
|
+
*/
|
|
648
|
+
showRemoveItemsProcessingModal() {
|
|
649
|
+
var _a;
|
|
650
|
+
(_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsProcessingModal();
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Handler to show error modal when item removal failed
|
|
654
|
+
*/
|
|
655
|
+
showRemoveItemsErrorModal() {
|
|
656
|
+
var _a;
|
|
657
|
+
(_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsErrorModal();
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Removes all tile models that are currently checked & adjusts the paging
|
|
661
|
+
* of the data source to account for any new gaps in the data.
|
|
662
|
+
*/
|
|
663
|
+
removeCheckedTiles() {
|
|
664
|
+
this.dataSource.removeCheckedTiles();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Handler for when the user changes the selected sort option or direction.
|
|
668
|
+
*/
|
|
669
|
+
userChangedSort(e) {
|
|
670
|
+
var _a;
|
|
671
|
+
const { selectedSort, sortDirection } = e.detail;
|
|
672
|
+
this.selectedSort = selectedSort;
|
|
673
|
+
this.sortDirection = sortDirection;
|
|
674
|
+
if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
675
|
+
this.goToPage(1);
|
|
676
|
+
}
|
|
677
|
+
this.currentPage = 1;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Fires an analytics event for sorting changes.
|
|
681
|
+
* @param prevSortDirection Which sort direction was previously set.
|
|
682
|
+
*/
|
|
683
|
+
sendSortByAnalytics(prevSortDirection) {
|
|
684
|
+
var _a;
|
|
685
|
+
const directionCleared = prevSortDirection && !this.sortDirection;
|
|
686
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
687
|
+
category: this.searchContext,
|
|
688
|
+
action: analyticsActions.sortBy,
|
|
689
|
+
label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Handler for when the selected sort option is updated, whether by the user
|
|
694
|
+
* themselves or programmatically.
|
|
695
|
+
*/
|
|
696
|
+
selectedSortChanged() {
|
|
697
|
+
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
698
|
+
this.dataSource.updatePrefixFiltersForCurrentSort();
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* An object representing the current sort field & direction.
|
|
702
|
+
*/
|
|
703
|
+
get sortParam() {
|
|
704
|
+
var _a;
|
|
705
|
+
const sortOption = SORT_OPTIONS[this.selectedSort];
|
|
706
|
+
if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
709
|
+
// If the sort option specified in the URL is unrecognized, we just use it as-is
|
|
710
|
+
const urlSortParam = new URL(window.location.href).searchParams.get('sort');
|
|
711
|
+
const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
|
|
712
|
+
// If the sort direction is still null at this point, then we assume ascending
|
|
713
|
+
// (i.e., it was unrecognized and had no directional flag)
|
|
714
|
+
if (!this.sortDirection)
|
|
715
|
+
this.sortDirection = 'asc';
|
|
716
|
+
if (!sortField)
|
|
717
|
+
return null;
|
|
718
|
+
return { field: sortField, direction: this.sortDirection };
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* An object representing the default sort field & direction, if none are explicitly set.
|
|
722
|
+
*/
|
|
723
|
+
get defaultSortParam() {
|
|
724
|
+
var _a;
|
|
725
|
+
const direction = (_a = this.defaultSortDirection) !== null && _a !== void 0 ? _a : 'asc';
|
|
726
|
+
const field = SORT_OPTIONS[this.defaultSortField].searchServiceKey;
|
|
727
|
+
if (!field)
|
|
728
|
+
return null;
|
|
729
|
+
return { field, direction };
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Handler for when the display mode option is changed (grid/list/compact-list views).
|
|
733
|
+
*/
|
|
734
|
+
displayModeChanged(e) {
|
|
735
|
+
var _a;
|
|
736
|
+
this.displayMode = e.detail.displayMode;
|
|
737
|
+
if (this.displayMode) {
|
|
738
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
739
|
+
category: this.searchContext,
|
|
740
|
+
action: analyticsActions.displayMode,
|
|
741
|
+
label: this.displayMode,
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Returns a query clause identifying the currently selected title filter,
|
|
747
|
+
* e.g., `firstTitle:X`.
|
|
748
|
+
*/
|
|
749
|
+
get titleQuery() {
|
|
750
|
+
return this.selectedTitleFilter
|
|
751
|
+
? `firstTitle:${this.selectedTitleFilter}`
|
|
752
|
+
: undefined;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Returns a query clause identifying the currently selected creator filter,
|
|
756
|
+
* e.g., `firstCreator:X`.
|
|
757
|
+
*/
|
|
758
|
+
get creatorQuery() {
|
|
759
|
+
return this.selectedCreatorFilter
|
|
760
|
+
? `firstCreator:${this.selectedCreatorFilter}`
|
|
761
|
+
: undefined;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Send Analytics when sorting by title's first letter
|
|
765
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
766
|
+
*/
|
|
767
|
+
sendFilterByTitleAnalytics(prevSelectedLetter) {
|
|
768
|
+
var _a;
|
|
769
|
+
if (!prevSelectedLetter && !this.selectedTitleFilter) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
const cleared = prevSelectedLetter && !this.selectedTitleFilter;
|
|
773
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
774
|
+
category: this.searchContext,
|
|
775
|
+
action: analyticsActions.filterByTitle,
|
|
776
|
+
label: cleared
|
|
777
|
+
? `clear-${prevSelectedLetter}`
|
|
778
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Send Analytics when filtering by creator's first letter
|
|
783
|
+
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
784
|
+
*/
|
|
785
|
+
sendFilterByCreatorAnalytics(prevSelectedLetter) {
|
|
786
|
+
var _a;
|
|
787
|
+
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
|
|
791
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
792
|
+
category: this.searchContext,
|
|
793
|
+
action: analyticsActions.filterByCreator,
|
|
794
|
+
label: cleared
|
|
795
|
+
? `clear-${prevSelectedLetter}`
|
|
796
|
+
: `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Handler for changes to which letter is selected in the title alphabet bar.
|
|
801
|
+
*/
|
|
802
|
+
titleLetterSelected(e) {
|
|
803
|
+
this.selectedCreatorFilter = null;
|
|
804
|
+
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Handler for changes to which letter is selected in the creator alphabet bar.
|
|
808
|
+
*/
|
|
809
|
+
creatorLetterSelected(e) {
|
|
810
|
+
this.selectedTitleFilter = null;
|
|
811
|
+
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* The full template for how the facets should be structured in mobile view,
|
|
815
|
+
* including the collapsible container (with header) and the facets themselves.
|
|
816
|
+
*/
|
|
817
|
+
get mobileFacetsTemplate() {
|
|
818
|
+
if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
|
|
819
|
+
return nothing;
|
|
820
|
+
const toggleFacetsVisible = (e) => {
|
|
821
|
+
var _a;
|
|
822
|
+
const target = e.target;
|
|
823
|
+
this.isResizeToMobile = false;
|
|
824
|
+
this.collapsibleFacetsVisible = target.open;
|
|
825
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
826
|
+
category: this.searchContext,
|
|
827
|
+
action: analyticsActions.mobileFacetsToggled,
|
|
828
|
+
label: target.open ? 'open' : 'closed',
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
831
|
return html `
|
|
832
832
|
<details id="mobile-filter-collapse" @toggle=${toggleFacetsVisible}>
|
|
833
833
|
<summary>
|
|
@@ -837,21 +837,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
837
837
|
</summary>
|
|
838
838
|
${this.facetsTemplate}
|
|
839
839
|
</details>
|
|
840
|
-
`;
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* The template for the facets component alone, without any surrounding wrappers.
|
|
844
|
-
*/
|
|
845
|
-
get facetsTemplate() {
|
|
846
|
-
if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
|
|
847
|
-
return nothing;
|
|
848
|
-
if (this.facetLoadStrategy === 'off') {
|
|
840
|
+
`;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* The template for the facets component alone, without any surrounding wrappers.
|
|
844
|
+
*/
|
|
845
|
+
get facetsTemplate() {
|
|
846
|
+
if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
|
|
847
|
+
return nothing;
|
|
848
|
+
if (this.facetLoadStrategy === 'off') {
|
|
849
849
|
return html `
|
|
850
850
|
<p class="facets-message">
|
|
851
851
|
${msg('Facets are temporarily unavailable.')}
|
|
852
852
|
</p>
|
|
853
|
-
`;
|
|
854
|
-
}
|
|
853
|
+
`;
|
|
854
|
+
}
|
|
855
855
|
const facets = html `
|
|
856
856
|
<collection-facets
|
|
857
857
|
@facetsChanged=${this.facetsChanged}
|
|
@@ -865,7 +865,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
865
865
|
.resizeObserver=${this.resizeObserver}
|
|
866
866
|
.searchType=${this.searchType}
|
|
867
867
|
.aggregations=${this.dataSource.aggregations}
|
|
868
|
-
.fullYearsHistogramAggregation=${this.dataSource
|
|
868
|
+
.fullYearsHistogramAggregation=${this.dataSource
|
|
869
869
|
.yearHistogramAggregation}
|
|
870
870
|
.minSelectedDate=${this.minSelectedDate}
|
|
871
871
|
.maxSelectedDate=${this.maxSelectedDate}
|
|
@@ -886,19 +886,19 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
886
886
|
.analyticsHandler=${this.analyticsHandler}
|
|
887
887
|
>
|
|
888
888
|
</collection-facets>
|
|
889
|
-
`;
|
|
890
|
-
// If we are using one of the opt-in facet load strategies, we may need to wrap the
|
|
891
|
-
// desktop view facets in a <details> widget so that patrons can opt into loading them.
|
|
892
|
-
// In the `opt-in-or-login` case, we only do this if they are not logged in.
|
|
893
|
-
const showDesktopOptInWidget = this.facetLoadStrategy === 'opt-in' ||
|
|
894
|
-
(this.facetLoadStrategy === 'opt-in-or-login' && !this.loggedIn);
|
|
895
|
-
if (showDesktopOptInWidget && !this.mobileView) {
|
|
889
|
+
`;
|
|
890
|
+
// If we are using one of the opt-in facet load strategies, we may need to wrap the
|
|
891
|
+
// desktop view facets in a <details> widget so that patrons can opt into loading them.
|
|
892
|
+
// In the `opt-in-or-login` case, we only do this if they are not logged in.
|
|
893
|
+
const showDesktopOptInWidget = this.facetLoadStrategy === 'opt-in' ||
|
|
894
|
+
(this.facetLoadStrategy === 'opt-in-or-login' && !this.loggedIn);
|
|
895
|
+
if (showDesktopOptInWidget && !this.mobileView) {
|
|
896
896
|
return html `
|
|
897
897
|
<details
|
|
898
898
|
class="desktop-facets-dropdown"
|
|
899
|
-
@toggle=${(e) => {
|
|
900
|
-
const target = e.target;
|
|
901
|
-
this.collapsibleFacetsVisible = target.open;
|
|
899
|
+
@toggle=${(e) => {
|
|
900
|
+
const target = e.target;
|
|
901
|
+
this.collapsibleFacetsVisible = target.open;
|
|
902
902
|
}}
|
|
903
903
|
>
|
|
904
904
|
<summary>
|
|
@@ -907,40 +907,40 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
907
907
|
</summary>
|
|
908
908
|
${facets}
|
|
909
909
|
</button>
|
|
910
|
-
`;
|
|
911
|
-
}
|
|
912
|
-
// Otherwise, just render the facets component bare
|
|
913
|
-
return facets;
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* The HTML template for the "Clear all filters" button, or `nothing` if no
|
|
917
|
-
* filters are currently active.
|
|
918
|
-
*
|
|
919
|
-
* @param mobile Whether to style/shorten the button for mobile view
|
|
920
|
-
*/
|
|
921
|
-
clearFiltersBtnTemplate(mobile) {
|
|
922
|
-
if (!this.hasActiveFilters)
|
|
923
|
-
return nothing;
|
|
924
|
-
const buttonClasses = classMap({
|
|
925
|
-
'clear-filters-btn': true,
|
|
926
|
-
mobile,
|
|
927
|
-
});
|
|
928
|
-
const buttonText = mobile ? 'Clear all' : 'Clear all filters';
|
|
910
|
+
`;
|
|
911
|
+
}
|
|
912
|
+
// Otherwise, just render the facets component bare
|
|
913
|
+
return facets;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* The HTML template for the "Clear all filters" button, or `nothing` if no
|
|
917
|
+
* filters are currently active.
|
|
918
|
+
*
|
|
919
|
+
* @param mobile Whether to style/shorten the button for mobile view
|
|
920
|
+
*/
|
|
921
|
+
clearFiltersBtnTemplate(mobile) {
|
|
922
|
+
if (!this.hasActiveFilters)
|
|
923
|
+
return nothing;
|
|
924
|
+
const buttonClasses = classMap({
|
|
925
|
+
'clear-filters-btn': true,
|
|
926
|
+
mobile,
|
|
927
|
+
});
|
|
928
|
+
const buttonText = mobile ? 'Clear all' : 'Clear all filters';
|
|
929
929
|
return html `
|
|
930
930
|
<div class="clear-filters-btn-row">
|
|
931
|
-
${mobile
|
|
932
|
-
? html `<span class="clear-filters-btn-separator"> </span>`
|
|
931
|
+
${mobile
|
|
932
|
+
? html `<span class="clear-filters-btn-separator"> </span>`
|
|
933
933
|
: nothing}
|
|
934
934
|
<button class=${buttonClasses} @click=${this.clearFilters}>
|
|
935
935
|
${buttonText}
|
|
936
936
|
</button>
|
|
937
937
|
</div>
|
|
938
|
-
`;
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
* Template for the table header content that appears atop the compact list view.
|
|
942
|
-
*/
|
|
943
|
-
get listHeaderTemplate() {
|
|
938
|
+
`;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Template for the table header content that appears atop the compact list view.
|
|
942
|
+
*/
|
|
943
|
+
get listHeaderTemplate() {
|
|
944
944
|
return html `
|
|
945
945
|
<div id="list-header">
|
|
946
946
|
<tile-dispatcher
|
|
@@ -953,711 +953,711 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
953
953
|
>
|
|
954
954
|
</tile-dispatcher>
|
|
955
955
|
</div>
|
|
956
|
-
`;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Handler for when the date picker's date range is changed.
|
|
960
|
-
*/
|
|
961
|
-
histogramDateRangeUpdated(e) {
|
|
962
|
-
var _a;
|
|
963
|
-
const { minDate, maxDate } = e.detail;
|
|
964
|
-
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
965
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
966
|
-
category: this.searchContext,
|
|
967
|
-
action: analyticsActions.histogramChanged,
|
|
968
|
-
label: this.dateRangeQueryClause,
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* The Lucene query corresponding to the current date range.
|
|
973
|
-
*/
|
|
974
|
-
get dateRangeQueryClause() {
|
|
975
|
-
if (!this.minSelectedDate || !this.maxSelectedDate) {
|
|
976
|
-
return undefined;
|
|
977
|
-
}
|
|
978
|
-
return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* Emits an event indicating a change in whether the manage mode is shown.
|
|
982
|
-
*/
|
|
983
|
-
emitManageModeChangedEvent() {
|
|
984
|
-
this.dispatchEvent(new CustomEvent('manageModeChanged', {
|
|
985
|
-
detail: this.isManageView,
|
|
986
|
-
}));
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Installs a new data source component and associated query state parameters into
|
|
990
|
-
* this component, causing it to efficiently update its views to represent the
|
|
991
|
-
* newly-provided data. In this way, one can reuse a single instance of
|
|
992
|
-
* <collection-browser> to handle multiple different sets of search results on
|
|
993
|
-
* a single page, each set of results being loaded & updated by its own data
|
|
994
|
-
* source.
|
|
995
|
-
*
|
|
996
|
-
* @param dataSource The data source component containing (or prepared to fetch)
|
|
997
|
-
* the tile data to be displayed.
|
|
998
|
-
* @param queryState The new query-related state that this component should
|
|
999
|
-
* represent, such as the search query, sort option, and any filters applied.
|
|
1000
|
-
*/
|
|
1001
|
-
async installDataSourceAndQueryState(dataSource, queryState) {
|
|
1002
|
-
var _a, _b;
|
|
1003
|
-
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
1004
|
-
if (this.dataSource)
|
|
1005
|
-
this.removeController(this.dataSource);
|
|
1006
|
-
this.dataSource = dataSource;
|
|
1007
|
-
this.addController(this.dataSource);
|
|
1008
|
-
this.baseQuery = queryState.baseQuery;
|
|
1009
|
-
this.profileElement = queryState.profileElement;
|
|
1010
|
-
this.searchType = queryState.searchType;
|
|
1011
|
-
this.selectedFacets =
|
|
1012
|
-
(_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
|
|
1013
|
-
this.minSelectedDate = queryState.minSelectedDate;
|
|
1014
|
-
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
1015
|
-
this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
|
|
1016
|
-
this.sortDirection = queryState.sortDirection;
|
|
1017
|
-
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
1018
|
-
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
1019
|
-
// We set this flag during the update to prevent the URL state persistence
|
|
1020
|
-
// from creating an unwanted extra history entry.
|
|
1021
|
-
this.dataSourceInstallInProgress = true;
|
|
1022
|
-
this.requestUpdate();
|
|
1023
|
-
await this.updateComplete;
|
|
1024
|
-
this.dataSourceInstallInProgress = false;
|
|
1025
|
-
if (!this.searchResultsLoading) {
|
|
1026
|
-
this.setTotalResultCount(this.dataSource.totalResults);
|
|
1027
|
-
this.setTileCount(this.dataSource.size);
|
|
1028
|
-
}
|
|
1029
|
-
this.refreshVisibleResults();
|
|
1030
|
-
}
|
|
1031
|
-
firstUpdated() {
|
|
1032
|
-
this.restoreState();
|
|
1033
|
-
this.setInitialSize();
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Determines the initial size of the content container and whether or not
|
|
1037
|
-
* the mobile layout should be used.
|
|
1038
|
-
*/
|
|
1039
|
-
setInitialSize() {
|
|
1040
|
-
this.contentWidth = this.contentContainer.getBoundingClientRect().width;
|
|
1041
|
-
this.mobileView =
|
|
1042
|
-
this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
|
|
1043
|
-
this.sendLayoutSizeAnalytics();
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Fires an analytics event indicating which type of layout was rendered:
|
|
1047
|
-
* mobile or desktop.
|
|
1048
|
-
*/
|
|
1049
|
-
sendLayoutSizeAnalytics() {
|
|
1050
|
-
if (this.analyticsHandler) {
|
|
1051
|
-
this.layoutSizeAnalyticsSent = true;
|
|
1052
|
-
this.analyticsHandler.sendEvent({
|
|
1053
|
-
category: this.searchContext,
|
|
1054
|
-
action: this.mobileView
|
|
1055
|
-
? analyticsActions.loadMobileView
|
|
1056
|
-
: analyticsActions.loadDesktopView,
|
|
1057
|
-
});
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
updated(changed) {
|
|
1061
|
-
var _a, _b, _c;
|
|
1062
|
-
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
1063
|
-
if (!this.leftColIntersectionObserver) {
|
|
1064
|
-
this.setupLeftColumnScrollListeners();
|
|
1065
|
-
}
|
|
1066
|
-
if (!this.facetsIntersectionObserver) {
|
|
1067
|
-
this.setupFacetsScrollListeners();
|
|
1068
|
-
}
|
|
1069
|
-
this.updateLeftColumnHeight();
|
|
1070
|
-
}
|
|
1071
|
-
if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
|
|
1072
|
-
this.sendLayoutSizeAnalytics();
|
|
1073
|
-
}
|
|
1074
|
-
if (changed.has('displayMode') ||
|
|
1075
|
-
changed.has('baseNavigationUrl') ||
|
|
1076
|
-
changed.has('baseImageUrl') ||
|
|
1077
|
-
changed.has('loggedIn')) {
|
|
1078
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
1079
|
-
}
|
|
1080
|
-
if (changed.has('baseQuery') ||
|
|
1081
|
-
changed.has('searchType') ||
|
|
1082
|
-
changed.has('withinCollection')) {
|
|
1083
|
-
// Unless this query/search type update is from the initial page load or the
|
|
1084
|
-
// result of hitting the back button,
|
|
1085
|
-
// we need to clear any existing filters since they may no longer be valid for
|
|
1086
|
-
// the new set of search results.
|
|
1087
|
-
if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
|
|
1088
|
-
// Ordinarily, we leave the sort param unchanged between searches.
|
|
1089
|
-
// However, if we are changing the target collection itself, we want the sort cleared too,
|
|
1090
|
-
// since different collections may have different sorting options available.
|
|
1091
|
-
const shouldClearSort = changed.has('withinCollection') &&
|
|
1092
|
-
!changed.has('selectedSort') &&
|
|
1093
|
-
!changed.has('sortDirection');
|
|
1094
|
-
// Otherwise, only clear filters that haven't been simultaneously applied in this update
|
|
1095
|
-
this.clearFilters({
|
|
1096
|
-
sort: shouldClearSort,
|
|
1097
|
-
facets: !changed.has('selectedFacets'),
|
|
1098
|
-
dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
|
|
1099
|
-
letterFilters: !(changed.has('selectedTitleFilter') ||
|
|
1100
|
-
changed.has('selectedCreatorFilter')),
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
if (changed.has('profileElement')) {
|
|
1105
|
-
this.applyDefaultProfileSort();
|
|
1106
|
-
}
|
|
1107
|
-
if (changed.has('baseQuery')) {
|
|
1108
|
-
this.emitBaseQueryChanged();
|
|
1109
|
-
}
|
|
1110
|
-
if (changed.has('searchType')) {
|
|
1111
|
-
this.emitSearchTypeChanged();
|
|
1112
|
-
}
|
|
1113
|
-
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
1114
|
-
this.persistState();
|
|
1115
|
-
}
|
|
1116
|
-
if (changed.has('baseQuery') ||
|
|
1117
|
-
changed.has('minSelectedDate') ||
|
|
1118
|
-
changed.has('maxSelectedDate') ||
|
|
1119
|
-
changed.has('selectedFacets') ||
|
|
1120
|
-
changed.has('searchService') ||
|
|
1121
|
-
changed.has('withinCollection') ||
|
|
1122
|
-
changed.has('withinProfile') ||
|
|
1123
|
-
changed.has('profileElement')) {
|
|
1124
|
-
this.dataSource.refreshLetterCounts();
|
|
1125
|
-
}
|
|
1126
|
-
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
1127
|
-
const prevSortDirection = changed.get('sortDirection');
|
|
1128
|
-
this.sendSortByAnalytics(prevSortDirection);
|
|
1129
|
-
this.selectedSortChanged();
|
|
1130
|
-
}
|
|
1131
|
-
if (changed.has('selectedTitleFilter')) {
|
|
1132
|
-
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
1133
|
-
}
|
|
1134
|
-
if (changed.has('selectedCreatorFilter')) {
|
|
1135
|
-
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
1136
|
-
}
|
|
1137
|
-
this.updateFacetReadiness();
|
|
1138
|
-
if (changed.has('baseQuery') ||
|
|
1139
|
-
changed.has('searchType') ||
|
|
1140
|
-
changed.has('selectedTitleFilter') ||
|
|
1141
|
-
changed.has('selectedCreatorFilter') ||
|
|
1142
|
-
changed.has('minSelectedDate') ||
|
|
1143
|
-
changed.has('maxSelectedDate') ||
|
|
1144
|
-
changed.has('selectedSort') ||
|
|
1145
|
-
changed.has('sortDirection') ||
|
|
1146
|
-
changed.has('selectedFacets') ||
|
|
1147
|
-
changed.has('searchService') ||
|
|
1148
|
-
changed.has('withinCollection') ||
|
|
1149
|
-
changed.has('withinProfile') ||
|
|
1150
|
-
changed.has('profileElement')) {
|
|
1151
|
-
this.handleQueryChange();
|
|
1152
|
-
}
|
|
1153
|
-
if (changed.has('searchResultsLoading')) {
|
|
1154
|
-
this.emitSearchResultsLoadingChanged();
|
|
1155
|
-
}
|
|
1156
|
-
if (changed.has('facetsLoading') &&
|
|
1157
|
-
this.facetsLoading &&
|
|
1158
|
-
this.collectionFacets) {
|
|
1159
|
-
this.collectionFacets.moreLinksVisible =
|
|
1160
|
-
this.searchType !== SearchType.FULLTEXT;
|
|
1161
|
-
}
|
|
1162
|
-
if (changed.has('pagesToRender')) {
|
|
1163
|
-
if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
|
|
1164
|
-
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
if (changed.has('isManageView')) {
|
|
1168
|
-
if (this.isManageView) {
|
|
1169
|
-
this.displayMode = 'grid';
|
|
1170
|
-
this.fetchManagableSearchResults();
|
|
1171
|
-
}
|
|
1172
|
-
else if (this.pageContext === 'search')
|
|
1173
|
-
(_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
|
|
1174
|
-
(_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
|
|
1175
|
-
this.emitManageModeChangedEvent();
|
|
1176
|
-
}
|
|
1177
|
-
if (changed.has('resizeObserver')) {
|
|
1178
|
-
const oldObserver = changed.get('resizeObserver');
|
|
1179
|
-
if (oldObserver)
|
|
1180
|
-
this.disconnectResizeObserver(oldObserver);
|
|
1181
|
-
this.setupResizeObserver();
|
|
1182
|
-
}
|
|
1183
|
-
this.ensureAvailableTilesDisplayed();
|
|
1184
|
-
}
|
|
1185
|
-
connectedCallback() {
|
|
1186
|
-
var _a;
|
|
1187
|
-
(_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1188
|
-
this.setupStateRestorationObserver();
|
|
1189
|
-
this.setupResizeObserver();
|
|
1190
|
-
}
|
|
1191
|
-
disconnectedCallback() {
|
|
1192
|
-
var _a, _b;
|
|
1193
|
-
if (this.resizeObserver) {
|
|
1194
|
-
this.disconnectResizeObserver(this.resizeObserver);
|
|
1195
|
-
}
|
|
1196
|
-
if (this.boundNavigationHandler) {
|
|
1197
|
-
window.removeEventListener('popstate', this.boundNavigationHandler);
|
|
1198
|
-
}
|
|
1199
|
-
(_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1200
|
-
(_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
1201
|
-
window.removeEventListener('resize', this.updateLeftColumnHeight);
|
|
1202
|
-
}
|
|
1203
|
-
handleResize(entry) {
|
|
1204
|
-
const previousView = this.mobileView;
|
|
1205
|
-
if (entry.target === this.contentContainer) {
|
|
1206
|
-
this.contentWidth = entry.contentRect.width;
|
|
1207
|
-
this.mobileView =
|
|
1208
|
-
this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
|
|
1209
|
-
// If changing from desktop to mobile disable transition
|
|
1210
|
-
if (this.mobileView && !previousView) {
|
|
1211
|
-
this.isResizeToMobile = true;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
// Ensure the facet sidebar remains sized correctly
|
|
1215
|
-
this.updateLeftColumnHeight();
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Ensures that if we have new results from the data source that are not yet
|
|
1219
|
-
* displayed in the infinite scroller, that they are immediately reflected
|
|
1220
|
-
* in the tile count.
|
|
1221
|
-
*/
|
|
1222
|
-
ensureAvailableTilesDisplayed() {
|
|
1223
|
-
if (this.infiniteScroller &&
|
|
1224
|
-
this.infiniteScroller.itemCount < this.dataSource.size) {
|
|
1225
|
-
this.setTileCount(this.dataSource.endOfDataReached
|
|
1226
|
-
? this.dataSource.size
|
|
1227
|
-
: this.estimatedTileCount);
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* Updates the data source with the current state of facet readiness for loading,
|
|
1232
|
-
* so that they will begin to load in at the appropriate time according to the
|
|
1233
|
-
* current facet loading strategy.
|
|
1234
|
-
*/
|
|
1235
|
-
updateFacetReadiness() {
|
|
1236
|
-
// There are two ways to opt into facet production:
|
|
1237
|
-
// (1) have the facets dropdown open, or
|
|
1238
|
-
// (2) if using the `opt-in-or-login` strategy, be logged into an account
|
|
1239
|
-
const optedIn = this.collapsibleFacetsVisible ||
|
|
1240
|
-
(this.facetLoadStrategy === 'opt-in-or-login' && this.loggedIn);
|
|
1241
|
-
// In desktop view, we are always ready to load facets *unless* we are using one of the
|
|
1242
|
-
// `opt-in` strategies and have not opted in (whether by login or UI interaction).
|
|
1243
|
-
const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(this.facetLoadStrategy);
|
|
1244
|
-
const desktopFacetsReady = !this.mobileView && (!usingOptInStrategy || optedIn);
|
|
1245
|
-
// In the mobile view, facets are considered ready provided we have opted in (whether by
|
|
1246
|
-
// login or UI interaction).
|
|
1247
|
-
const mobileFacetsReady = this.mobileView && optedIn;
|
|
1248
|
-
this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Sets up listeners for events that may require updating the left column height.
|
|
1252
|
-
*/
|
|
1253
|
-
setupLeftColumnScrollListeners() {
|
|
1254
|
-
var _a;
|
|
1255
|
-
// We observe intersections between the left column's scroll sentinel and
|
|
1256
|
-
// the viewport, so that we can ensure the left column is always sized to
|
|
1257
|
-
// match the _available_ viewport height. This should generally be more
|
|
1258
|
-
// performant than listening to scroll events on the page or column.
|
|
1259
|
-
const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
|
|
1260
|
-
if (leftColumnSentinel) {
|
|
1261
|
-
this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
|
|
1262
|
-
threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
|
|
1263
|
-
});
|
|
1264
|
-
this.leftColIntersectionObserver.observe(leftColumnSentinel);
|
|
1265
|
-
}
|
|
1266
|
-
// We also listen for window resize events, as they are not always captured
|
|
1267
|
-
// by the resize observer and can affect the desired height of the left column.
|
|
1268
|
-
window.addEventListener('resize', this.updateLeftColumnHeight);
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
|
|
1272
|
-
* Note this uses a separate IntersectionObserver from the left column, because we
|
|
1273
|
-
* don't need granular intersection thresholds for this.
|
|
1274
|
-
*/
|
|
1275
|
-
setupFacetsScrollListeners() {
|
|
1276
|
-
var _a;
|
|
1277
|
-
const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
|
|
1278
|
-
if (facetsSentinel) {
|
|
1279
|
-
this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
|
|
1280
|
-
this.facetsIntersectionObserver.observe(facetsSentinel);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
/**
|
|
1284
|
-
* Emits a `baseQueryChanged` event indicating an update to the search query.
|
|
1285
|
-
*/
|
|
1286
|
-
emitBaseQueryChanged() {
|
|
1287
|
-
this.dispatchEvent(new CustomEvent('baseQueryChanged', {
|
|
1288
|
-
detail: {
|
|
1289
|
-
baseQuery: this.baseQuery,
|
|
1290
|
-
},
|
|
1291
|
-
}));
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Emits a `searchTypeChanged` event indicating an update to the search type
|
|
1295
|
-
* (e.g., metadata vs. full-text).
|
|
1296
|
-
*/
|
|
1297
|
-
emitSearchTypeChanged() {
|
|
1298
|
-
this.dispatchEvent(new CustomEvent('searchTypeChanged', {
|
|
1299
|
-
detail: this.searchType,
|
|
1300
|
-
}));
|
|
1301
|
-
}
|
|
1302
|
-
/**
|
|
1303
|
-
* Emits a `queryStateChanged` event indicating that one or more of this component's
|
|
1304
|
-
* properties have changed in a way that could affect the set of search results.
|
|
1305
|
-
*/
|
|
1306
|
-
emitQueryStateChanged() {
|
|
1307
|
-
this.dispatchEvent(new CustomEvent('queryStateChanged', {
|
|
1308
|
-
detail: {
|
|
1309
|
-
baseQuery: this.baseQuery,
|
|
1310
|
-
withinCollection: this.withinCollection,
|
|
1311
|
-
withinProfile: this.withinProfile,
|
|
1312
|
-
profileElement: this.profileElement,
|
|
1313
|
-
searchType: this.searchType,
|
|
1314
|
-
selectedFacets: this.selectedFacets,
|
|
1315
|
-
minSelectedDate: this.minSelectedDate,
|
|
1316
|
-
maxSelectedDate: this.maxSelectedDate,
|
|
1317
|
-
selectedSort: this.selectedSort,
|
|
1318
|
-
sortDirection: this.sortDirection,
|
|
1319
|
-
selectedTitleFilter: this.selectedTitleFilter,
|
|
1320
|
-
selectedCreatorFilter: this.selectedCreatorFilter,
|
|
1321
|
-
},
|
|
1322
|
-
}));
|
|
1323
|
-
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Emits an `emptyResults` event indicating that we have received an empty result set
|
|
1326
|
-
* for the most recent query.
|
|
1327
|
-
*/
|
|
1328
|
-
emitEmptyResults() {
|
|
1329
|
-
this.dispatchEvent(new Event('emptyResults'));
|
|
1330
|
-
}
|
|
1331
|
-
disconnectResizeObserver(resizeObserver) {
|
|
1332
|
-
resizeObserver.removeObserver({
|
|
1333
|
-
target: this.contentContainer,
|
|
1334
|
-
handler: this,
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
setupResizeObserver() {
|
|
1338
|
-
if (!this.resizeObserver || !this.contentContainer)
|
|
1339
|
-
return;
|
|
1340
|
-
this.resizeObserver.addObserver({
|
|
1341
|
-
target: this.contentContainer,
|
|
1342
|
-
handler: this,
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
/**
|
|
1346
|
-
* When the visible cells change from the infinite scroller, we want to emit
|
|
1347
|
-
* which page is currently visible so the consumer can update its UI or the URL
|
|
1348
|
-
*
|
|
1349
|
-
* @param e
|
|
1350
|
-
* @returns
|
|
1351
|
-
*/
|
|
1352
|
-
visibleCellsChanged(e) {
|
|
1353
|
-
if (this.isScrollingToCell)
|
|
1354
|
-
return;
|
|
1355
|
-
const { visibleCellIndices } = e.detail;
|
|
1356
|
-
if (visibleCellIndices.length === 0)
|
|
1357
|
-
return;
|
|
1358
|
-
// For page determination, do not count more than a single page of visible cells,
|
|
1359
|
-
// since otherwise patrons using very tall screens will be treated as one page
|
|
1360
|
-
// further than they actually are.
|
|
1361
|
-
const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
|
|
1362
|
-
const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
|
|
1363
|
-
const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
|
|
1364
|
-
if (this.currentPage !== lastVisibleCellPage) {
|
|
1365
|
-
this.currentPage = lastVisibleCellPage;
|
|
1366
|
-
}
|
|
1367
|
-
const event = new CustomEvent('visiblePageChanged', {
|
|
1368
|
-
detail: {
|
|
1369
|
-
pageNumber: lastVisibleCellPage,
|
|
1370
|
-
},
|
|
1371
|
-
});
|
|
1372
|
-
this.dispatchEvent(event);
|
|
1373
|
-
}
|
|
1374
|
-
/**
|
|
1375
|
-
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
1376
|
-
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
1377
|
-
*
|
|
1378
|
-
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
1379
|
-
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
1380
|
-
*/
|
|
1381
|
-
get initialSearchComplete() {
|
|
1382
|
-
return this.dataSource.initialSearchComplete;
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Handler for whenever the component's properties change in a way that may require
|
|
1386
|
-
* fetching new results.
|
|
1387
|
-
*/
|
|
1388
|
-
async handleQueryChange() {
|
|
1389
|
-
var _a;
|
|
1390
|
-
// only reset if the query has actually changed
|
|
1391
|
-
if (!this.searchService ||
|
|
1392
|
-
this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
// If the new state prevents us from updating the search results, don't reset
|
|
1396
|
-
if (this.baseQuery && !this.dataSource.canPerformSearch) {
|
|
1397
|
-
return;
|
|
1398
|
-
}
|
|
1399
|
-
this.previousQueryKey = this.dataSource.pageFetchQueryKey;
|
|
1400
|
-
this.totalResults = undefined;
|
|
1401
|
-
this.pagesToRender =
|
|
1402
|
-
this.initialPageNumber === 1
|
|
1403
|
-
? 2 // First two pages are batched into one request when starting from page 1
|
|
1404
|
-
: this.initialPageNumber;
|
|
1405
|
-
// Reset the infinite scroller's item count, so that it
|
|
1406
|
-
// shows tile placeholders until the new query's results load in
|
|
1407
|
-
if (this.infiniteScroller) {
|
|
1408
|
-
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1409
|
-
this.infiniteScroller.reload();
|
|
1410
|
-
}
|
|
1411
|
-
if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
1412
|
-
this.defaultSortField = SortField.relevance;
|
|
1413
|
-
this.defaultSortDirection = null;
|
|
1414
|
-
}
|
|
1415
|
-
if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
|
|
1416
|
-
this.scrollToPage(this.initialPageNumber);
|
|
1417
|
-
}
|
|
1418
|
-
this.initialQueryChangeHappened = true;
|
|
1419
|
-
// if the query changed as part of a window.history pop event, we don't want to
|
|
1420
|
-
// persist the state because it overwrites the forward history
|
|
1421
|
-
if (!this.historyPopOccurred) {
|
|
1422
|
-
this.persistState();
|
|
1423
|
-
}
|
|
1424
|
-
this.historyPopOccurred = false;
|
|
1425
|
-
}
|
|
1426
|
-
setupStateRestorationObserver() {
|
|
1427
|
-
if (!this.boundNavigationHandler) {
|
|
1428
|
-
this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
|
|
1429
|
-
}
|
|
1430
|
-
// when the user navigates back, we want to update the UI to match the URL
|
|
1431
|
-
window.addEventListener('popstate', this.boundNavigationHandler);
|
|
1432
|
-
}
|
|
1433
|
-
historyNavigationHandler() {
|
|
1434
|
-
this.historyPopOccurred = true;
|
|
1435
|
-
this.restoreState();
|
|
1436
|
-
}
|
|
1437
|
-
restoreState() {
|
|
1438
|
-
var _a, _b, _c, _d, _e;
|
|
1439
|
-
const restorationState = this.restorationStateHandler.getRestorationState();
|
|
1440
|
-
this.displayMode = restorationState.displayMode;
|
|
1441
|
-
if (restorationState.searchType != null)
|
|
1442
|
-
this.searchType = restorationState.searchType;
|
|
1443
|
-
this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
|
|
1444
|
-
this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
|
|
1445
|
-
this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
|
|
1446
|
-
this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
|
|
1447
|
-
this.selectedFacets = restorationState.selectedFacets;
|
|
1448
|
-
if (!this.suppressURLQuery)
|
|
1449
|
-
this.baseQuery = restorationState.baseQuery;
|
|
1450
|
-
this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
|
|
1451
|
-
this.minSelectedDate = restorationState.minSelectedDate;
|
|
1452
|
-
this.maxSelectedDate = restorationState.maxSelectedDate;
|
|
1453
|
-
if (this.currentPage > 1) {
|
|
1454
|
-
this.goToPage(this.currentPage);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
persistState() {
|
|
1458
|
-
var _a, _b, _c, _d;
|
|
1459
|
-
const restorationState = {
|
|
1460
|
-
displayMode: this.displayMode,
|
|
1461
|
-
searchType: this.searchType,
|
|
1462
|
-
selectedSort: this.selectedSort,
|
|
1463
|
-
sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
|
|
1464
|
-
selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
|
|
1465
|
-
baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
|
|
1466
|
-
currentPage: this.currentPage,
|
|
1467
|
-
titleQuery: this.titleQuery,
|
|
1468
|
-
creatorQuery: this.creatorQuery,
|
|
1469
|
-
minSelectedDate: this.minSelectedDate,
|
|
1470
|
-
maxSelectedDate: this.maxSelectedDate,
|
|
1471
|
-
selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
|
|
1472
|
-
selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
|
|
1473
|
-
};
|
|
1474
|
-
this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Emits a `searchResultsLoadingChanged` event indicating that our loading state has
|
|
1478
|
-
* changed (either we have started loading new results, or we have finished loading them).
|
|
1479
|
-
*/
|
|
1480
|
-
emitSearchResultsLoadingChanged() {
|
|
1481
|
-
this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
|
|
1482
|
-
detail: {
|
|
1483
|
-
loading: this.searchResultsLoading,
|
|
1484
|
-
},
|
|
1485
|
-
}));
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* Handler for when the set of selected facets changes.
|
|
1489
|
-
*/
|
|
1490
|
-
facetsChanged(e) {
|
|
1491
|
-
this.selectedFacets = e.detail;
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
|
-
* Handler for when any facet is selected/unselected/hidden/unhidden.
|
|
1495
|
-
* Fires analytics indicating the type of facet event that took place.
|
|
1496
|
-
*/
|
|
1497
|
-
facetClickHandler({ detail: { facetType, bucket, negative }, }) {
|
|
1498
|
-
var _a;
|
|
1499
|
-
let action;
|
|
1500
|
-
if (negative) {
|
|
1501
|
-
action =
|
|
1502
|
-
bucket.state !== 'none'
|
|
1503
|
-
? analyticsActions.facetNegativeSelected
|
|
1504
|
-
: analyticsActions.facetNegativeDeselected;
|
|
1505
|
-
}
|
|
1506
|
-
else {
|
|
1507
|
-
action =
|
|
1508
|
-
bucket.state !== 'none'
|
|
1509
|
-
? analyticsActions.facetSelected
|
|
1510
|
-
: analyticsActions.facetDeselected;
|
|
1511
|
-
}
|
|
1512
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
1513
|
-
category: this.searchContext,
|
|
1514
|
-
action,
|
|
1515
|
-
label: facetType,
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
scrollToPage(pageNumber) {
|
|
1519
|
-
return new Promise(resolve => {
|
|
1520
|
-
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
1521
|
-
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
1522
|
-
// then scrolls to the cell
|
|
1523
|
-
setTimeout(() => {
|
|
1524
|
-
var _a;
|
|
1525
|
-
this.isScrollingToCell = true;
|
|
1526
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
|
|
1527
|
-
// This timeout is to give the scroll animation time to finish
|
|
1528
|
-
// then updating the infinite scroller once we're done scrolling
|
|
1529
|
-
// There's no scroll animation completion callback so we're
|
|
1530
|
-
// giving it 0.5s to finish.
|
|
1531
|
-
setTimeout(() => {
|
|
1532
|
-
var _a;
|
|
1533
|
-
this.isScrollingToCell = false;
|
|
1534
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1535
|
-
resolve();
|
|
1536
|
-
}, 500);
|
|
1537
|
-
}, 0);
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
/**
|
|
1541
|
-
* Whether sorting by relevance makes sense for the current state.
|
|
1542
|
-
* Currently equivalent to having a non-empty query.
|
|
1543
|
-
*/
|
|
1544
|
-
get isRelevanceSortAvailable() {
|
|
1545
|
-
var _a;
|
|
1546
|
-
return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
1547
|
-
}
|
|
1548
|
-
/**
|
|
1549
|
-
* Sets the total number of tiles displayed in the infinite scroller.
|
|
1550
|
-
*/
|
|
1551
|
-
setTileCount(count) {
|
|
1552
|
-
if (this.infiniteScroller) {
|
|
1553
|
-
this.infiniteScroller.itemCount = count;
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
/**
|
|
1557
|
-
* Applies any default sort option for the current collection, by checking
|
|
1558
|
-
* for one in the collection's metadata. If none is found, defaults to sorting
|
|
1559
|
-
* descending by:
|
|
1560
|
-
* - Date Favorited for fav-* collections
|
|
1561
|
-
* - Weekly views for all other collections
|
|
1562
|
-
*/
|
|
1563
|
-
applyDefaultCollectionSort(collectionInfo) {
|
|
1564
|
-
var _a, _b, _c;
|
|
1565
|
-
if (this.baseQuery) {
|
|
1566
|
-
// If there's a query set, then we default to relevance sorting regardless of
|
|
1567
|
-
// the collection metadata-specified sort.
|
|
1568
|
-
this.defaultSortField = SortField.relevance;
|
|
1569
|
-
this.defaultSortDirection = null;
|
|
1570
|
-
return;
|
|
1571
|
-
}
|
|
1572
|
-
// Favorite collections sort on Date Favorited by default.
|
|
1573
|
-
// Other collections fall back to sorting on weekly views.
|
|
1574
|
-
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-'))
|
|
1575
|
-
? '-favoritedate'
|
|
1576
|
-
: '-week';
|
|
1577
|
-
// The collection metadata may override the default sorting with something else
|
|
1578
|
-
const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
|
|
1579
|
-
// Prefer the metadata-specified sort if one exists
|
|
1580
|
-
const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
|
|
1581
|
-
// Account for both -field and field:dir formats
|
|
1582
|
-
let [field, dir] = defaultSortToApply.split(':');
|
|
1583
|
-
if (field.startsWith('-')) {
|
|
1584
|
-
field = field.slice(1);
|
|
1585
|
-
dir = 'desc';
|
|
1586
|
-
}
|
|
1587
|
-
else if (!['asc', 'desc'].includes(dir)) {
|
|
1588
|
-
dir = 'asc';
|
|
1589
|
-
}
|
|
1590
|
-
const sortOption = sortOptionFromAPIString(field);
|
|
1591
|
-
const sortField = sortOption.field;
|
|
1592
|
-
if (sortField && sortField !== SortField.default) {
|
|
1593
|
-
this.defaultSortField = sortField;
|
|
1594
|
-
this.defaultSortDirection = dir;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
/**
|
|
1598
|
-
* Applies the default sort option for the current profile element
|
|
1599
|
-
*/
|
|
1600
|
-
applyDefaultProfileSort() {
|
|
1601
|
-
if (this.profileElement) {
|
|
1602
|
-
const defaultSortField = defaultProfileElementSorts[this.profileElement];
|
|
1603
|
-
this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
|
|
1604
|
-
}
|
|
1605
|
-
else {
|
|
1606
|
-
this.defaultSortField = SortField.weeklyview;
|
|
1607
|
-
}
|
|
1608
|
-
this.defaultSortDirection = 'desc';
|
|
1609
|
-
}
|
|
1610
|
-
/**
|
|
1611
|
-
* This is useful for determining whether we need to reload the scroller.
|
|
1612
|
-
*
|
|
1613
|
-
* When the fetch completes, we need to reload the scroller if the cells for that
|
|
1614
|
-
* page are visible, but if the page is not currenlty visible, we don't need to reload
|
|
1615
|
-
*/
|
|
1616
|
-
get currentVisiblePageNumbers() {
|
|
1617
|
-
var _a, _b;
|
|
1618
|
-
const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
|
|
1619
|
-
const visiblePages = new Set();
|
|
1620
|
-
visibleCells.forEach(cellIndex => {
|
|
1621
|
-
const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
|
|
1622
|
-
visiblePages.add(visiblePage);
|
|
1623
|
-
});
|
|
1624
|
-
return Array.from(visiblePages);
|
|
1625
|
-
}
|
|
1626
|
-
/**
|
|
1627
|
-
* Refreshes all visible result cells in the infinite scroller.
|
|
1628
|
-
*/
|
|
1629
|
-
refreshVisibleResults() {
|
|
1630
|
-
var _a;
|
|
1631
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1632
|
-
}
|
|
1633
|
-
/**
|
|
1634
|
-
* Callback when a result is selected
|
|
1635
|
-
*/
|
|
1636
|
-
resultSelected(event) {
|
|
1637
|
-
var _a, _b, _c;
|
|
1638
|
-
if (this.isManageView) {
|
|
1639
|
-
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
1640
|
-
// this.mapDataSource(model => ({ ...model }));
|
|
1641
|
-
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
1642
|
-
if (cellIndex >= 0)
|
|
1643
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
|
|
1644
|
-
this.requestUpdate();
|
|
1645
|
-
}
|
|
1646
|
-
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
1647
|
-
category: this.searchContext,
|
|
1648
|
-
action: analyticsActions.resultSelected,
|
|
1649
|
-
label: event.detail.mediatype,
|
|
1650
|
-
});
|
|
1651
|
-
(_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
|
|
1652
|
-
category: this.searchContext,
|
|
1653
|
-
action: analyticsActions.resultSelected,
|
|
1654
|
-
label: `page-${this.currentPage}`,
|
|
1655
|
-
});
|
|
1656
|
-
}
|
|
1657
|
-
cellForIndex(index) {
|
|
1658
|
-
const model = this.tileModelAtCellIndex(index);
|
|
1659
|
-
if (!model)
|
|
1660
|
-
return undefined;
|
|
956
|
+
`;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Handler for when the date picker's date range is changed.
|
|
960
|
+
*/
|
|
961
|
+
histogramDateRangeUpdated(e) {
|
|
962
|
+
var _a;
|
|
963
|
+
const { minDate, maxDate } = e.detail;
|
|
964
|
+
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
965
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
966
|
+
category: this.searchContext,
|
|
967
|
+
action: analyticsActions.histogramChanged,
|
|
968
|
+
label: this.dateRangeQueryClause,
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* The Lucene query corresponding to the current date range.
|
|
973
|
+
*/
|
|
974
|
+
get dateRangeQueryClause() {
|
|
975
|
+
if (!this.minSelectedDate || !this.maxSelectedDate) {
|
|
976
|
+
return undefined;
|
|
977
|
+
}
|
|
978
|
+
return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Emits an event indicating a change in whether the manage mode is shown.
|
|
982
|
+
*/
|
|
983
|
+
emitManageModeChangedEvent() {
|
|
984
|
+
this.dispatchEvent(new CustomEvent('manageModeChanged', {
|
|
985
|
+
detail: this.isManageView,
|
|
986
|
+
}));
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Installs a new data source component and associated query state parameters into
|
|
990
|
+
* this component, causing it to efficiently update its views to represent the
|
|
991
|
+
* newly-provided data. In this way, one can reuse a single instance of
|
|
992
|
+
* <collection-browser> to handle multiple different sets of search results on
|
|
993
|
+
* a single page, each set of results being loaded & updated by its own data
|
|
994
|
+
* source.
|
|
995
|
+
*
|
|
996
|
+
* @param dataSource The data source component containing (or prepared to fetch)
|
|
997
|
+
* the tile data to be displayed.
|
|
998
|
+
* @param queryState The new query-related state that this component should
|
|
999
|
+
* represent, such as the search query, sort option, and any filters applied.
|
|
1000
|
+
*/
|
|
1001
|
+
async installDataSourceAndQueryState(dataSource, queryState) {
|
|
1002
|
+
var _a, _b;
|
|
1003
|
+
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
1004
|
+
if (this.dataSource)
|
|
1005
|
+
this.removeController(this.dataSource);
|
|
1006
|
+
this.dataSource = dataSource;
|
|
1007
|
+
this.addController(this.dataSource);
|
|
1008
|
+
this.baseQuery = queryState.baseQuery;
|
|
1009
|
+
this.profileElement = queryState.profileElement;
|
|
1010
|
+
this.searchType = queryState.searchType;
|
|
1011
|
+
this.selectedFacets =
|
|
1012
|
+
(_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
|
|
1013
|
+
this.minSelectedDate = queryState.minSelectedDate;
|
|
1014
|
+
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
1015
|
+
this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
|
|
1016
|
+
this.sortDirection = queryState.sortDirection;
|
|
1017
|
+
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
1018
|
+
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
1019
|
+
// We set this flag during the update to prevent the URL state persistence
|
|
1020
|
+
// from creating an unwanted extra history entry.
|
|
1021
|
+
this.dataSourceInstallInProgress = true;
|
|
1022
|
+
this.requestUpdate();
|
|
1023
|
+
await this.updateComplete;
|
|
1024
|
+
this.dataSourceInstallInProgress = false;
|
|
1025
|
+
if (!this.searchResultsLoading) {
|
|
1026
|
+
this.setTotalResultCount(this.dataSource.totalResults);
|
|
1027
|
+
this.setTileCount(this.dataSource.size);
|
|
1028
|
+
}
|
|
1029
|
+
this.refreshVisibleResults();
|
|
1030
|
+
}
|
|
1031
|
+
firstUpdated() {
|
|
1032
|
+
this.restoreState();
|
|
1033
|
+
this.setInitialSize();
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Determines the initial size of the content container and whether or not
|
|
1037
|
+
* the mobile layout should be used.
|
|
1038
|
+
*/
|
|
1039
|
+
setInitialSize() {
|
|
1040
|
+
this.contentWidth = this.contentContainer.getBoundingClientRect().width;
|
|
1041
|
+
this.mobileView =
|
|
1042
|
+
this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
|
|
1043
|
+
this.sendLayoutSizeAnalytics();
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Fires an analytics event indicating which type of layout was rendered:
|
|
1047
|
+
* mobile or desktop.
|
|
1048
|
+
*/
|
|
1049
|
+
sendLayoutSizeAnalytics() {
|
|
1050
|
+
if (this.analyticsHandler) {
|
|
1051
|
+
this.layoutSizeAnalyticsSent = true;
|
|
1052
|
+
this.analyticsHandler.sendEvent({
|
|
1053
|
+
category: this.searchContext,
|
|
1054
|
+
action: this.mobileView
|
|
1055
|
+
? analyticsActions.loadMobileView
|
|
1056
|
+
: analyticsActions.loadDesktopView,
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
updated(changed) {
|
|
1061
|
+
var _a, _b, _c;
|
|
1062
|
+
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
1063
|
+
if (!this.leftColIntersectionObserver) {
|
|
1064
|
+
this.setupLeftColumnScrollListeners();
|
|
1065
|
+
}
|
|
1066
|
+
if (!this.facetsIntersectionObserver) {
|
|
1067
|
+
this.setupFacetsScrollListeners();
|
|
1068
|
+
}
|
|
1069
|
+
this.updateLeftColumnHeight();
|
|
1070
|
+
}
|
|
1071
|
+
if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
|
|
1072
|
+
this.sendLayoutSizeAnalytics();
|
|
1073
|
+
}
|
|
1074
|
+
if (changed.has('displayMode') ||
|
|
1075
|
+
changed.has('baseNavigationUrl') ||
|
|
1076
|
+
changed.has('baseImageUrl') ||
|
|
1077
|
+
changed.has('loggedIn')) {
|
|
1078
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
1079
|
+
}
|
|
1080
|
+
if (changed.has('baseQuery') ||
|
|
1081
|
+
changed.has('searchType') ||
|
|
1082
|
+
changed.has('withinCollection')) {
|
|
1083
|
+
// Unless this query/search type update is from the initial page load or the
|
|
1084
|
+
// result of hitting the back button,
|
|
1085
|
+
// we need to clear any existing filters since they may no longer be valid for
|
|
1086
|
+
// the new set of search results.
|
|
1087
|
+
if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
|
|
1088
|
+
// Ordinarily, we leave the sort param unchanged between searches.
|
|
1089
|
+
// However, if we are changing the target collection itself, we want the sort cleared too,
|
|
1090
|
+
// since different collections may have different sorting options available.
|
|
1091
|
+
const shouldClearSort = changed.has('withinCollection') &&
|
|
1092
|
+
!changed.has('selectedSort') &&
|
|
1093
|
+
!changed.has('sortDirection');
|
|
1094
|
+
// Otherwise, only clear filters that haven't been simultaneously applied in this update
|
|
1095
|
+
this.clearFilters({
|
|
1096
|
+
sort: shouldClearSort,
|
|
1097
|
+
facets: !changed.has('selectedFacets'),
|
|
1098
|
+
dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
|
|
1099
|
+
letterFilters: !(changed.has('selectedTitleFilter') ||
|
|
1100
|
+
changed.has('selectedCreatorFilter')),
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
if (changed.has('profileElement')) {
|
|
1105
|
+
this.applyDefaultProfileSort();
|
|
1106
|
+
}
|
|
1107
|
+
if (changed.has('baseQuery')) {
|
|
1108
|
+
this.emitBaseQueryChanged();
|
|
1109
|
+
}
|
|
1110
|
+
if (changed.has('searchType')) {
|
|
1111
|
+
this.emitSearchTypeChanged();
|
|
1112
|
+
}
|
|
1113
|
+
if (changed.has('currentPage') || changed.has('displayMode')) {
|
|
1114
|
+
this.persistState();
|
|
1115
|
+
}
|
|
1116
|
+
if (changed.has('baseQuery') ||
|
|
1117
|
+
changed.has('minSelectedDate') ||
|
|
1118
|
+
changed.has('maxSelectedDate') ||
|
|
1119
|
+
changed.has('selectedFacets') ||
|
|
1120
|
+
changed.has('searchService') ||
|
|
1121
|
+
changed.has('withinCollection') ||
|
|
1122
|
+
changed.has('withinProfile') ||
|
|
1123
|
+
changed.has('profileElement')) {
|
|
1124
|
+
this.dataSource.refreshLetterCounts();
|
|
1125
|
+
}
|
|
1126
|
+
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
1127
|
+
const prevSortDirection = changed.get('sortDirection');
|
|
1128
|
+
this.sendSortByAnalytics(prevSortDirection);
|
|
1129
|
+
this.selectedSortChanged();
|
|
1130
|
+
}
|
|
1131
|
+
if (changed.has('selectedTitleFilter')) {
|
|
1132
|
+
this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
|
|
1133
|
+
}
|
|
1134
|
+
if (changed.has('selectedCreatorFilter')) {
|
|
1135
|
+
this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
|
|
1136
|
+
}
|
|
1137
|
+
this.updateFacetReadiness();
|
|
1138
|
+
if (changed.has('baseQuery') ||
|
|
1139
|
+
changed.has('searchType') ||
|
|
1140
|
+
changed.has('selectedTitleFilter') ||
|
|
1141
|
+
changed.has('selectedCreatorFilter') ||
|
|
1142
|
+
changed.has('minSelectedDate') ||
|
|
1143
|
+
changed.has('maxSelectedDate') ||
|
|
1144
|
+
changed.has('selectedSort') ||
|
|
1145
|
+
changed.has('sortDirection') ||
|
|
1146
|
+
changed.has('selectedFacets') ||
|
|
1147
|
+
changed.has('searchService') ||
|
|
1148
|
+
changed.has('withinCollection') ||
|
|
1149
|
+
changed.has('withinProfile') ||
|
|
1150
|
+
changed.has('profileElement')) {
|
|
1151
|
+
this.handleQueryChange();
|
|
1152
|
+
}
|
|
1153
|
+
if (changed.has('searchResultsLoading')) {
|
|
1154
|
+
this.emitSearchResultsLoadingChanged();
|
|
1155
|
+
}
|
|
1156
|
+
if (changed.has('facetsLoading') &&
|
|
1157
|
+
this.facetsLoading &&
|
|
1158
|
+
this.collectionFacets) {
|
|
1159
|
+
this.collectionFacets.moreLinksVisible =
|
|
1160
|
+
this.searchType !== SearchType.FULLTEXT;
|
|
1161
|
+
}
|
|
1162
|
+
if (changed.has('pagesToRender')) {
|
|
1163
|
+
if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
|
|
1164
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
if (changed.has('isManageView')) {
|
|
1168
|
+
if (this.isManageView) {
|
|
1169
|
+
this.displayMode = 'grid';
|
|
1170
|
+
this.fetchManagableSearchResults();
|
|
1171
|
+
}
|
|
1172
|
+
else if (this.pageContext === 'search')
|
|
1173
|
+
(_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
|
|
1174
|
+
(_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
|
|
1175
|
+
this.emitManageModeChangedEvent();
|
|
1176
|
+
}
|
|
1177
|
+
if (changed.has('resizeObserver')) {
|
|
1178
|
+
const oldObserver = changed.get('resizeObserver');
|
|
1179
|
+
if (oldObserver)
|
|
1180
|
+
this.disconnectResizeObserver(oldObserver);
|
|
1181
|
+
this.setupResizeObserver();
|
|
1182
|
+
}
|
|
1183
|
+
this.ensureAvailableTilesDisplayed();
|
|
1184
|
+
}
|
|
1185
|
+
connectedCallback() {
|
|
1186
|
+
var _a;
|
|
1187
|
+
(_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1188
|
+
this.setupStateRestorationObserver();
|
|
1189
|
+
this.setupResizeObserver();
|
|
1190
|
+
}
|
|
1191
|
+
disconnectedCallback() {
|
|
1192
|
+
var _a, _b;
|
|
1193
|
+
if (this.resizeObserver) {
|
|
1194
|
+
this.disconnectResizeObserver(this.resizeObserver);
|
|
1195
|
+
}
|
|
1196
|
+
if (this.boundNavigationHandler) {
|
|
1197
|
+
window.removeEventListener('popstate', this.boundNavigationHandler);
|
|
1198
|
+
}
|
|
1199
|
+
(_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1200
|
+
(_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
1201
|
+
window.removeEventListener('resize', this.updateLeftColumnHeight);
|
|
1202
|
+
}
|
|
1203
|
+
handleResize(entry) {
|
|
1204
|
+
const previousView = this.mobileView;
|
|
1205
|
+
if (entry.target === this.contentContainer) {
|
|
1206
|
+
this.contentWidth = entry.contentRect.width;
|
|
1207
|
+
this.mobileView =
|
|
1208
|
+
this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
|
|
1209
|
+
// If changing from desktop to mobile disable transition
|
|
1210
|
+
if (this.mobileView && !previousView) {
|
|
1211
|
+
this.isResizeToMobile = true;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
// Ensure the facet sidebar remains sized correctly
|
|
1215
|
+
this.updateLeftColumnHeight();
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Ensures that if we have new results from the data source that are not yet
|
|
1219
|
+
* displayed in the infinite scroller, that they are immediately reflected
|
|
1220
|
+
* in the tile count.
|
|
1221
|
+
*/
|
|
1222
|
+
ensureAvailableTilesDisplayed() {
|
|
1223
|
+
if (this.infiniteScroller &&
|
|
1224
|
+
this.infiniteScroller.itemCount < this.dataSource.size) {
|
|
1225
|
+
this.setTileCount(this.dataSource.endOfDataReached
|
|
1226
|
+
? this.dataSource.size
|
|
1227
|
+
: this.estimatedTileCount);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Updates the data source with the current state of facet readiness for loading,
|
|
1232
|
+
* so that they will begin to load in at the appropriate time according to the
|
|
1233
|
+
* current facet loading strategy.
|
|
1234
|
+
*/
|
|
1235
|
+
updateFacetReadiness() {
|
|
1236
|
+
// There are two ways to opt into facet production:
|
|
1237
|
+
// (1) have the facets dropdown open, or
|
|
1238
|
+
// (2) if using the `opt-in-or-login` strategy, be logged into an account
|
|
1239
|
+
const optedIn = this.collapsibleFacetsVisible ||
|
|
1240
|
+
(this.facetLoadStrategy === 'opt-in-or-login' && this.loggedIn);
|
|
1241
|
+
// In desktop view, we are always ready to load facets *unless* we are using one of the
|
|
1242
|
+
// `opt-in` strategies and have not opted in (whether by login or UI interaction).
|
|
1243
|
+
const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(this.facetLoadStrategy);
|
|
1244
|
+
const desktopFacetsReady = !this.mobileView && (!usingOptInStrategy || optedIn);
|
|
1245
|
+
// In the mobile view, facets are considered ready provided we have opted in (whether by
|
|
1246
|
+
// login or UI interaction).
|
|
1247
|
+
const mobileFacetsReady = this.mobileView && optedIn;
|
|
1248
|
+
this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Sets up listeners for events that may require updating the left column height.
|
|
1252
|
+
*/
|
|
1253
|
+
setupLeftColumnScrollListeners() {
|
|
1254
|
+
var _a;
|
|
1255
|
+
// We observe intersections between the left column's scroll sentinel and
|
|
1256
|
+
// the viewport, so that we can ensure the left column is always sized to
|
|
1257
|
+
// match the _available_ viewport height. This should generally be more
|
|
1258
|
+
// performant than listening to scroll events on the page or column.
|
|
1259
|
+
const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
|
|
1260
|
+
if (leftColumnSentinel) {
|
|
1261
|
+
this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
|
|
1262
|
+
threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
|
|
1263
|
+
});
|
|
1264
|
+
this.leftColIntersectionObserver.observe(leftColumnSentinel);
|
|
1265
|
+
}
|
|
1266
|
+
// We also listen for window resize events, as they are not always captured
|
|
1267
|
+
// by the resize observer and can affect the desired height of the left column.
|
|
1268
|
+
window.addEventListener('resize', this.updateLeftColumnHeight);
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
|
|
1272
|
+
* Note this uses a separate IntersectionObserver from the left column, because we
|
|
1273
|
+
* don't need granular intersection thresholds for this.
|
|
1274
|
+
*/
|
|
1275
|
+
setupFacetsScrollListeners() {
|
|
1276
|
+
var _a;
|
|
1277
|
+
const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
|
|
1278
|
+
if (facetsSentinel) {
|
|
1279
|
+
this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
|
|
1280
|
+
this.facetsIntersectionObserver.observe(facetsSentinel);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Emits a `baseQueryChanged` event indicating an update to the search query.
|
|
1285
|
+
*/
|
|
1286
|
+
emitBaseQueryChanged() {
|
|
1287
|
+
this.dispatchEvent(new CustomEvent('baseQueryChanged', {
|
|
1288
|
+
detail: {
|
|
1289
|
+
baseQuery: this.baseQuery,
|
|
1290
|
+
},
|
|
1291
|
+
}));
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Emits a `searchTypeChanged` event indicating an update to the search type
|
|
1295
|
+
* (e.g., metadata vs. full-text).
|
|
1296
|
+
*/
|
|
1297
|
+
emitSearchTypeChanged() {
|
|
1298
|
+
this.dispatchEvent(new CustomEvent('searchTypeChanged', {
|
|
1299
|
+
detail: this.searchType,
|
|
1300
|
+
}));
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Emits a `queryStateChanged` event indicating that one or more of this component's
|
|
1304
|
+
* properties have changed in a way that could affect the set of search results.
|
|
1305
|
+
*/
|
|
1306
|
+
emitQueryStateChanged() {
|
|
1307
|
+
this.dispatchEvent(new CustomEvent('queryStateChanged', {
|
|
1308
|
+
detail: {
|
|
1309
|
+
baseQuery: this.baseQuery,
|
|
1310
|
+
withinCollection: this.withinCollection,
|
|
1311
|
+
withinProfile: this.withinProfile,
|
|
1312
|
+
profileElement: this.profileElement,
|
|
1313
|
+
searchType: this.searchType,
|
|
1314
|
+
selectedFacets: this.selectedFacets,
|
|
1315
|
+
minSelectedDate: this.minSelectedDate,
|
|
1316
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
1317
|
+
selectedSort: this.selectedSort,
|
|
1318
|
+
sortDirection: this.sortDirection,
|
|
1319
|
+
selectedTitleFilter: this.selectedTitleFilter,
|
|
1320
|
+
selectedCreatorFilter: this.selectedCreatorFilter,
|
|
1321
|
+
},
|
|
1322
|
+
}));
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Emits an `emptyResults` event indicating that we have received an empty result set
|
|
1326
|
+
* for the most recent query.
|
|
1327
|
+
*/
|
|
1328
|
+
emitEmptyResults() {
|
|
1329
|
+
this.dispatchEvent(new Event('emptyResults'));
|
|
1330
|
+
}
|
|
1331
|
+
disconnectResizeObserver(resizeObserver) {
|
|
1332
|
+
resizeObserver.removeObserver({
|
|
1333
|
+
target: this.contentContainer,
|
|
1334
|
+
handler: this,
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
setupResizeObserver() {
|
|
1338
|
+
if (!this.resizeObserver || !this.contentContainer)
|
|
1339
|
+
return;
|
|
1340
|
+
this.resizeObserver.addObserver({
|
|
1341
|
+
target: this.contentContainer,
|
|
1342
|
+
handler: this,
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* When the visible cells change from the infinite scroller, we want to emit
|
|
1347
|
+
* which page is currently visible so the consumer can update its UI or the URL
|
|
1348
|
+
*
|
|
1349
|
+
* @param e
|
|
1350
|
+
* @returns
|
|
1351
|
+
*/
|
|
1352
|
+
visibleCellsChanged(e) {
|
|
1353
|
+
if (this.isScrollingToCell)
|
|
1354
|
+
return;
|
|
1355
|
+
const { visibleCellIndices } = e.detail;
|
|
1356
|
+
if (visibleCellIndices.length === 0)
|
|
1357
|
+
return;
|
|
1358
|
+
// For page determination, do not count more than a single page of visible cells,
|
|
1359
|
+
// since otherwise patrons using very tall screens will be treated as one page
|
|
1360
|
+
// further than they actually are.
|
|
1361
|
+
const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
|
|
1362
|
+
const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
|
|
1363
|
+
const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
|
|
1364
|
+
if (this.currentPage !== lastVisibleCellPage) {
|
|
1365
|
+
this.currentPage = lastVisibleCellPage;
|
|
1366
|
+
}
|
|
1367
|
+
const event = new CustomEvent('visiblePageChanged', {
|
|
1368
|
+
detail: {
|
|
1369
|
+
pageNumber: lastVisibleCellPage,
|
|
1370
|
+
},
|
|
1371
|
+
});
|
|
1372
|
+
this.dispatchEvent(event);
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
1376
|
+
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
1377
|
+
*
|
|
1378
|
+
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
1379
|
+
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
1380
|
+
*/
|
|
1381
|
+
get initialSearchComplete() {
|
|
1382
|
+
return this.dataSource.initialSearchComplete;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Handler for whenever the component's properties change in a way that may require
|
|
1386
|
+
* fetching new results.
|
|
1387
|
+
*/
|
|
1388
|
+
async handleQueryChange() {
|
|
1389
|
+
var _a;
|
|
1390
|
+
// only reset if the query has actually changed
|
|
1391
|
+
if (!this.searchService ||
|
|
1392
|
+
this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
// If the new state prevents us from updating the search results, don't reset
|
|
1396
|
+
if (this.baseQuery && !this.dataSource.canPerformSearch) {
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
this.previousQueryKey = this.dataSource.pageFetchQueryKey;
|
|
1400
|
+
this.totalResults = undefined;
|
|
1401
|
+
this.pagesToRender =
|
|
1402
|
+
this.initialPageNumber === 1
|
|
1403
|
+
? 2 // First two pages are batched into one request when starting from page 1
|
|
1404
|
+
: this.initialPageNumber;
|
|
1405
|
+
// Reset the infinite scroller's item count, so that it
|
|
1406
|
+
// shows tile placeholders until the new query's results load in
|
|
1407
|
+
if (this.infiniteScroller) {
|
|
1408
|
+
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1409
|
+
this.infiniteScroller.reload();
|
|
1410
|
+
}
|
|
1411
|
+
if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
1412
|
+
this.defaultSortField = SortField.relevance;
|
|
1413
|
+
this.defaultSortDirection = null;
|
|
1414
|
+
}
|
|
1415
|
+
if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
|
|
1416
|
+
this.scrollToPage(this.initialPageNumber);
|
|
1417
|
+
}
|
|
1418
|
+
this.initialQueryChangeHappened = true;
|
|
1419
|
+
// if the query changed as part of a window.history pop event, we don't want to
|
|
1420
|
+
// persist the state because it overwrites the forward history
|
|
1421
|
+
if (!this.historyPopOccurred) {
|
|
1422
|
+
this.persistState();
|
|
1423
|
+
}
|
|
1424
|
+
this.historyPopOccurred = false;
|
|
1425
|
+
}
|
|
1426
|
+
setupStateRestorationObserver() {
|
|
1427
|
+
if (!this.boundNavigationHandler) {
|
|
1428
|
+
this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
|
|
1429
|
+
}
|
|
1430
|
+
// when the user navigates back, we want to update the UI to match the URL
|
|
1431
|
+
window.addEventListener('popstate', this.boundNavigationHandler);
|
|
1432
|
+
}
|
|
1433
|
+
historyNavigationHandler() {
|
|
1434
|
+
this.historyPopOccurred = true;
|
|
1435
|
+
this.restoreState();
|
|
1436
|
+
}
|
|
1437
|
+
restoreState() {
|
|
1438
|
+
var _a, _b, _c, _d, _e;
|
|
1439
|
+
const restorationState = this.restorationStateHandler.getRestorationState();
|
|
1440
|
+
this.displayMode = restorationState.displayMode;
|
|
1441
|
+
if (restorationState.searchType != null)
|
|
1442
|
+
this.searchType = restorationState.searchType;
|
|
1443
|
+
this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
|
|
1444
|
+
this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
|
|
1445
|
+
this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
|
|
1446
|
+
this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
|
|
1447
|
+
this.selectedFacets = restorationState.selectedFacets;
|
|
1448
|
+
if (!this.suppressURLQuery)
|
|
1449
|
+
this.baseQuery = restorationState.baseQuery;
|
|
1450
|
+
this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
|
|
1451
|
+
this.minSelectedDate = restorationState.minSelectedDate;
|
|
1452
|
+
this.maxSelectedDate = restorationState.maxSelectedDate;
|
|
1453
|
+
if (this.currentPage > 1) {
|
|
1454
|
+
this.goToPage(this.currentPage);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
persistState() {
|
|
1458
|
+
var _a, _b, _c, _d;
|
|
1459
|
+
const restorationState = {
|
|
1460
|
+
displayMode: this.displayMode,
|
|
1461
|
+
searchType: this.searchType,
|
|
1462
|
+
selectedSort: this.selectedSort,
|
|
1463
|
+
sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
|
|
1464
|
+
selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
|
|
1465
|
+
baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
|
|
1466
|
+
currentPage: this.currentPage,
|
|
1467
|
+
titleQuery: this.titleQuery,
|
|
1468
|
+
creatorQuery: this.creatorQuery,
|
|
1469
|
+
minSelectedDate: this.minSelectedDate,
|
|
1470
|
+
maxSelectedDate: this.maxSelectedDate,
|
|
1471
|
+
selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
|
|
1472
|
+
selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
|
|
1473
|
+
};
|
|
1474
|
+
this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* Emits a `searchResultsLoadingChanged` event indicating that our loading state has
|
|
1478
|
+
* changed (either we have started loading new results, or we have finished loading them).
|
|
1479
|
+
*/
|
|
1480
|
+
emitSearchResultsLoadingChanged() {
|
|
1481
|
+
this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
|
|
1482
|
+
detail: {
|
|
1483
|
+
loading: this.searchResultsLoading,
|
|
1484
|
+
},
|
|
1485
|
+
}));
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Handler for when the set of selected facets changes.
|
|
1489
|
+
*/
|
|
1490
|
+
facetsChanged(e) {
|
|
1491
|
+
this.selectedFacets = e.detail;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Handler for when any facet is selected/unselected/hidden/unhidden.
|
|
1495
|
+
* Fires analytics indicating the type of facet event that took place.
|
|
1496
|
+
*/
|
|
1497
|
+
facetClickHandler({ detail: { facetType, bucket, negative }, }) {
|
|
1498
|
+
var _a;
|
|
1499
|
+
let action;
|
|
1500
|
+
if (negative) {
|
|
1501
|
+
action =
|
|
1502
|
+
bucket.state !== 'none'
|
|
1503
|
+
? analyticsActions.facetNegativeSelected
|
|
1504
|
+
: analyticsActions.facetNegativeDeselected;
|
|
1505
|
+
}
|
|
1506
|
+
else {
|
|
1507
|
+
action =
|
|
1508
|
+
bucket.state !== 'none'
|
|
1509
|
+
? analyticsActions.facetSelected
|
|
1510
|
+
: analyticsActions.facetDeselected;
|
|
1511
|
+
}
|
|
1512
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
1513
|
+
category: this.searchContext,
|
|
1514
|
+
action,
|
|
1515
|
+
label: facetType,
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
scrollToPage(pageNumber) {
|
|
1519
|
+
return new Promise(resolve => {
|
|
1520
|
+
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
1521
|
+
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
1522
|
+
// then scrolls to the cell
|
|
1523
|
+
setTimeout(() => {
|
|
1524
|
+
var _a;
|
|
1525
|
+
this.isScrollingToCell = true;
|
|
1526
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
|
|
1527
|
+
// This timeout is to give the scroll animation time to finish
|
|
1528
|
+
// then updating the infinite scroller once we're done scrolling
|
|
1529
|
+
// There's no scroll animation completion callback so we're
|
|
1530
|
+
// giving it 0.5s to finish.
|
|
1531
|
+
setTimeout(() => {
|
|
1532
|
+
var _a;
|
|
1533
|
+
this.isScrollingToCell = false;
|
|
1534
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1535
|
+
resolve();
|
|
1536
|
+
}, 500);
|
|
1537
|
+
}, 0);
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Whether sorting by relevance makes sense for the current state.
|
|
1542
|
+
* Currently equivalent to having a non-empty query.
|
|
1543
|
+
*/
|
|
1544
|
+
get isRelevanceSortAvailable() {
|
|
1545
|
+
var _a;
|
|
1546
|
+
return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Sets the total number of tiles displayed in the infinite scroller.
|
|
1550
|
+
*/
|
|
1551
|
+
setTileCount(count) {
|
|
1552
|
+
if (this.infiniteScroller) {
|
|
1553
|
+
this.infiniteScroller.itemCount = count;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Applies any default sort option for the current collection, by checking
|
|
1558
|
+
* for one in the collection's metadata. If none is found, defaults to sorting
|
|
1559
|
+
* descending by:
|
|
1560
|
+
* - Date Favorited for fav-* collections
|
|
1561
|
+
* - Weekly views for all other collections
|
|
1562
|
+
*/
|
|
1563
|
+
applyDefaultCollectionSort(collectionInfo) {
|
|
1564
|
+
var _a, _b, _c;
|
|
1565
|
+
if (this.baseQuery) {
|
|
1566
|
+
// If there's a query set, then we default to relevance sorting regardless of
|
|
1567
|
+
// the collection metadata-specified sort.
|
|
1568
|
+
this.defaultSortField = SortField.relevance;
|
|
1569
|
+
this.defaultSortDirection = null;
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
// Favorite collections sort on Date Favorited by default.
|
|
1573
|
+
// Other collections fall back to sorting on weekly views.
|
|
1574
|
+
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-'))
|
|
1575
|
+
? '-favoritedate'
|
|
1576
|
+
: '-week';
|
|
1577
|
+
// The collection metadata may override the default sorting with something else
|
|
1578
|
+
const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
|
|
1579
|
+
// Prefer the metadata-specified sort if one exists
|
|
1580
|
+
const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
|
|
1581
|
+
// Account for both -field and field:dir formats
|
|
1582
|
+
let [field, dir] = defaultSortToApply.split(':');
|
|
1583
|
+
if (field.startsWith('-')) {
|
|
1584
|
+
field = field.slice(1);
|
|
1585
|
+
dir = 'desc';
|
|
1586
|
+
}
|
|
1587
|
+
else if (!['asc', 'desc'].includes(dir)) {
|
|
1588
|
+
dir = 'asc';
|
|
1589
|
+
}
|
|
1590
|
+
const sortOption = sortOptionFromAPIString(field);
|
|
1591
|
+
const sortField = sortOption.field;
|
|
1592
|
+
if (sortField && sortField !== SortField.default) {
|
|
1593
|
+
this.defaultSortField = sortField;
|
|
1594
|
+
this.defaultSortDirection = dir;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Applies the default sort option for the current profile element
|
|
1599
|
+
*/
|
|
1600
|
+
applyDefaultProfileSort() {
|
|
1601
|
+
if (this.profileElement) {
|
|
1602
|
+
const defaultSortField = defaultProfileElementSorts[this.profileElement];
|
|
1603
|
+
this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
|
|
1604
|
+
}
|
|
1605
|
+
else {
|
|
1606
|
+
this.defaultSortField = SortField.weeklyview;
|
|
1607
|
+
}
|
|
1608
|
+
this.defaultSortDirection = 'desc';
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* This is useful for determining whether we need to reload the scroller.
|
|
1612
|
+
*
|
|
1613
|
+
* When the fetch completes, we need to reload the scroller if the cells for that
|
|
1614
|
+
* page are visible, but if the page is not currenlty visible, we don't need to reload
|
|
1615
|
+
*/
|
|
1616
|
+
get currentVisiblePageNumbers() {
|
|
1617
|
+
var _a, _b;
|
|
1618
|
+
const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
|
|
1619
|
+
const visiblePages = new Set();
|
|
1620
|
+
visibleCells.forEach(cellIndex => {
|
|
1621
|
+
const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
|
|
1622
|
+
visiblePages.add(visiblePage);
|
|
1623
|
+
});
|
|
1624
|
+
return Array.from(visiblePages);
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Refreshes all visible result cells in the infinite scroller.
|
|
1628
|
+
*/
|
|
1629
|
+
refreshVisibleResults() {
|
|
1630
|
+
var _a;
|
|
1631
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Callback when a result is selected
|
|
1635
|
+
*/
|
|
1636
|
+
resultSelected(event) {
|
|
1637
|
+
var _a, _b, _c;
|
|
1638
|
+
if (this.isManageView) {
|
|
1639
|
+
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
1640
|
+
// this.mapDataSource(model => ({ ...model }));
|
|
1641
|
+
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
1642
|
+
if (cellIndex >= 0)
|
|
1643
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
|
|
1644
|
+
this.requestUpdate();
|
|
1645
|
+
}
|
|
1646
|
+
(_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
|
|
1647
|
+
category: this.searchContext,
|
|
1648
|
+
action: analyticsActions.resultSelected,
|
|
1649
|
+
label: event.detail.mediatype,
|
|
1650
|
+
});
|
|
1651
|
+
(_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
|
|
1652
|
+
category: this.searchContext,
|
|
1653
|
+
action: analyticsActions.resultSelected,
|
|
1654
|
+
label: `page-${this.currentPage}`,
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
cellForIndex(index) {
|
|
1658
|
+
const model = this.tileModelAtCellIndex(index);
|
|
1659
|
+
if (!model)
|
|
1660
|
+
return undefined;
|
|
1661
1661
|
return html `
|
|
1662
1662
|
<tile-dispatcher
|
|
1663
1663
|
.collectionPagePath=${this.collectionPagePath}
|
|
@@ -1677,40 +1677,40 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1677
1677
|
@resultSelected=${(e) => this.resultSelected(e)}
|
|
1678
1678
|
>
|
|
1679
1679
|
</tile-dispatcher>
|
|
1680
|
-
`;
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1684
|
-
* increase the number of pages to render and start fetching data for the new page
|
|
1685
|
-
*/
|
|
1686
|
-
scrollThresholdReached() {
|
|
1687
|
-
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1688
|
-
this.pagesToRender += 1;
|
|
1689
|
-
this.dataSource.fetchPage(this.pagesToRender);
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
/**
|
|
1693
|
-
* Fetches search results for privileged users when in manage view.
|
|
1694
|
-
*
|
|
1695
|
-
* This method:
|
|
1696
|
-
* 1. Checks if we're in search context with > 100 results and not currently loading
|
|
1697
|
-
* 2. Resets the datasource pagination state
|
|
1698
|
-
* 3. Fetches first page with limit based on maxPagesToManage threshold
|
|
1699
|
-
* 4. Reloads the infinite scroller to display new results
|
|
1700
|
-
*/
|
|
1701
|
-
fetchManagableSearchResults() {
|
|
1702
|
-
var _a;
|
|
1703
|
-
if (this.pageContext === 'search' &&
|
|
1704
|
-
this.dataSource.totalResults > 100 &&
|
|
1705
|
-
!this.searchResultsLoading) {
|
|
1706
|
-
this.dataSource.resetPages();
|
|
1707
|
-
this.dataSource.fetchPage(1, this.maxPagesToManage);
|
|
1708
|
-
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
static get styles() {
|
|
1712
|
-
return [
|
|
1713
|
-
srOnlyStyle,
|
|
1680
|
+
`;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* When the user scrolls near to the bottom of the page, fetch the next page
|
|
1684
|
+
* increase the number of pages to render and start fetching data for the new page
|
|
1685
|
+
*/
|
|
1686
|
+
scrollThresholdReached() {
|
|
1687
|
+
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1688
|
+
this.pagesToRender += 1;
|
|
1689
|
+
this.dataSource.fetchPage(this.pagesToRender);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Fetches search results for privileged users when in manage view.
|
|
1694
|
+
*
|
|
1695
|
+
* This method:
|
|
1696
|
+
* 1. Checks if we're in search context with > 100 results and not currently loading
|
|
1697
|
+
* 2. Resets the datasource pagination state
|
|
1698
|
+
* 3. Fetches first page with limit based on maxPagesToManage threshold
|
|
1699
|
+
* 4. Reloads the infinite scroller to display new results
|
|
1700
|
+
*/
|
|
1701
|
+
fetchManagableSearchResults() {
|
|
1702
|
+
var _a;
|
|
1703
|
+
if (this.pageContext === 'search' &&
|
|
1704
|
+
this.dataSource.totalResults > 100 &&
|
|
1705
|
+
!this.searchResultsLoading) {
|
|
1706
|
+
this.dataSource.resetPages();
|
|
1707
|
+
this.dataSource.fetchPage(1, this.maxPagesToManage);
|
|
1708
|
+
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
static get styles() {
|
|
1712
|
+
return [
|
|
1713
|
+
srOnlyStyle,
|
|
1714
1714
|
css `
|
|
1715
1715
|
:host {
|
|
1716
1716
|
display: block;
|
|
@@ -2133,195 +2133,195 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
2133
2133
|
infinite-scroller.hidden {
|
|
2134
2134
|
display: none;
|
|
2135
2135
|
}
|
|
2136
|
-
`,
|
|
2137
|
-
];
|
|
2138
|
-
}
|
|
2139
|
-
};
|
|
2140
|
-
__decorate([
|
|
2141
|
-
property({ type: String })
|
|
2142
|
-
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
2143
|
-
__decorate([
|
|
2144
|
-
property({ type: String })
|
|
2145
|
-
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
2146
|
-
__decorate([
|
|
2147
|
-
property({ type: Object })
|
|
2148
|
-
], CollectionBrowser.prototype, "searchService", void 0);
|
|
2149
|
-
__decorate([
|
|
2150
|
-
property({ type: Number })
|
|
2151
|
-
], CollectionBrowser.prototype, "searchType", void 0);
|
|
2152
|
-
__decorate([
|
|
2153
|
-
property({ type: String })
|
|
2154
|
-
], CollectionBrowser.prototype, "withinCollection", void 0);
|
|
2155
|
-
__decorate([
|
|
2156
|
-
property({ type: String })
|
|
2157
|
-
], CollectionBrowser.prototype, "withinProfile", void 0);
|
|
2158
|
-
__decorate([
|
|
2159
|
-
property({ type: String })
|
|
2160
|
-
], CollectionBrowser.prototype, "profileElement", void 0);
|
|
2161
|
-
__decorate([
|
|
2162
|
-
property({ type: String })
|
|
2163
|
-
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
2164
|
-
__decorate([
|
|
2165
|
-
property({ type: String })
|
|
2166
|
-
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
2167
|
-
__decorate([
|
|
2168
|
-
property({ type: String })
|
|
2169
|
-
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
2170
|
-
__decorate([
|
|
2171
|
-
property({ type: String })
|
|
2172
|
-
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
2173
|
-
__decorate([
|
|
2174
|
-
property({ type: String })
|
|
2175
|
-
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
2176
|
-
__decorate([
|
|
2177
|
-
property({ type: String })
|
|
2178
|
-
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
2179
|
-
__decorate([
|
|
2180
|
-
property({ type: String })
|
|
2181
|
-
], CollectionBrowser.prototype, "defaultSortField", void 0);
|
|
2182
|
-
__decorate([
|
|
2183
|
-
property({ type: String })
|
|
2184
|
-
], CollectionBrowser.prototype, "defaultSortDirection", void 0);
|
|
2185
|
-
__decorate([
|
|
2186
|
-
property({ type: Number })
|
|
2187
|
-
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
2188
|
-
__decorate([
|
|
2189
|
-
property({ type: Number })
|
|
2190
|
-
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
2191
|
-
__decorate([
|
|
2192
|
-
property({ type: String })
|
|
2193
|
-
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
2194
|
-
__decorate([
|
|
2195
|
-
property({ type: String })
|
|
2196
|
-
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
2197
|
-
__decorate([
|
|
2198
|
-
property({ type: Object })
|
|
2199
|
-
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
2200
|
-
__decorate([
|
|
2201
|
-
property({ type: Boolean })
|
|
2202
|
-
], CollectionBrowser.prototype, "showSmartFacetBar", void 0);
|
|
2203
|
-
__decorate([
|
|
2204
|
-
property({ type: Boolean })
|
|
2205
|
-
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
2206
|
-
__decorate([
|
|
2207
|
-
property({ type: Boolean })
|
|
2208
|
-
], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
|
|
2209
|
-
__decorate([
|
|
2210
|
-
property({ type: Boolean })
|
|
2211
|
-
], CollectionBrowser.prototype, "suppressResultCount", void 0);
|
|
2212
|
-
__decorate([
|
|
2213
|
-
property({ type: Boolean })
|
|
2214
|
-
], CollectionBrowser.prototype, "suppressResultTiles", void 0);
|
|
2215
|
-
__decorate([
|
|
2216
|
-
property({ type: Boolean })
|
|
2217
|
-
], CollectionBrowser.prototype, "suppressURLQuery", void 0);
|
|
2218
|
-
__decorate([
|
|
2219
|
-
property({ type: Boolean })
|
|
2220
|
-
], CollectionBrowser.prototype, "suppressSortBar", void 0);
|
|
2221
|
-
__decorate([
|
|
2222
|
-
property({ type: Boolean })
|
|
2223
|
-
], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
|
|
2224
|
-
__decorate([
|
|
2225
|
-
property({ type: String })
|
|
2226
|
-
], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
|
|
2227
|
-
__decorate([
|
|
2228
|
-
property({ type: Boolean })
|
|
2229
|
-
], CollectionBrowser.prototype, "facetPaneVisible", void 0);
|
|
2230
|
-
__decorate([
|
|
2231
|
-
property({ type: Boolean })
|
|
2232
|
-
], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
|
|
2233
|
-
__decorate([
|
|
2234
|
-
property({ type: String })
|
|
2235
|
-
], CollectionBrowser.prototype, "collectionPagePath", void 0);
|
|
2236
|
-
__decorate([
|
|
2237
|
-
property({ type: String, reflect: true })
|
|
2238
|
-
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
2239
|
-
__decorate([
|
|
2240
|
-
property({ type: String })
|
|
2241
|
-
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
2242
|
-
__decorate([
|
|
2243
|
-
property({ type: Object })
|
|
2244
|
-
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
2245
|
-
__decorate([
|
|
2246
|
-
property({ type: Number })
|
|
2247
|
-
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
2248
|
-
__decorate([
|
|
2249
|
-
property({ type: Boolean })
|
|
2250
|
-
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
2251
|
-
__decorate([
|
|
2252
|
-
property({ type: Object })
|
|
2253
|
-
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
2254
|
-
__decorate([
|
|
2255
|
-
property({ type: Object })
|
|
2256
|
-
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
2257
|
-
__decorate([
|
|
2258
|
-
property({ type: Object })
|
|
2259
|
-
], CollectionBrowser.prototype, "featureFeedbackService", void 0);
|
|
2260
|
-
__decorate([
|
|
2261
|
-
property({ type: Object })
|
|
2262
|
-
], CollectionBrowser.prototype, "recaptchaManager", void 0);
|
|
2263
|
-
__decorate([
|
|
2264
|
-
property({ type: Boolean })
|
|
2265
|
-
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
2266
|
-
__decorate([
|
|
2267
|
-
property({ type: String })
|
|
2268
|
-
], CollectionBrowser.prototype, "manageViewLabel", void 0);
|
|
2269
|
-
__decorate([
|
|
2270
|
-
property({ type: Boolean })
|
|
2271
|
-
], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
|
|
2272
|
-
__decorate([
|
|
2273
|
-
property({ type: Boolean, reflect: true })
|
|
2274
|
-
], CollectionBrowser.prototype, "showSmartResults", void 0);
|
|
2275
|
-
__decorate([
|
|
2276
|
-
property({ type: Number })
|
|
2277
|
-
], CollectionBrowser.prototype, "maxPagesToManage", void 0);
|
|
2278
|
-
__decorate([
|
|
2279
|
-
property({ type: Object })
|
|
2280
|
-
], CollectionBrowser.prototype, "dataSource", void 0);
|
|
2281
|
-
__decorate([
|
|
2282
|
-
state()
|
|
2283
|
-
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
2284
|
-
__decorate([
|
|
2285
|
-
state()
|
|
2286
|
-
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
2287
|
-
__decorate([
|
|
2288
|
-
state()
|
|
2289
|
-
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
2290
|
-
__decorate([
|
|
2291
|
-
state()
|
|
2292
|
-
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
2293
|
-
__decorate([
|
|
2294
|
-
state()
|
|
2295
|
-
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
2296
|
-
__decorate([
|
|
2297
|
-
state()
|
|
2298
|
-
], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
|
|
2299
|
-
__decorate([
|
|
2300
|
-
state()
|
|
2301
|
-
], CollectionBrowser.prototype, "contentWidth", void 0);
|
|
2302
|
-
__decorate([
|
|
2303
|
-
state()
|
|
2304
|
-
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
2305
|
-
__decorate([
|
|
2306
|
-
query('#content-container')
|
|
2307
|
-
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
2308
|
-
__decorate([
|
|
2309
|
-
query('#left-column')
|
|
2310
|
-
], CollectionBrowser.prototype, "leftColumn", void 0);
|
|
2311
|
-
__decorate([
|
|
2312
|
-
query('collection-facets')
|
|
2313
|
-
], CollectionBrowser.prototype, "collectionFacets", void 0);
|
|
2314
|
-
__decorate([
|
|
2315
|
-
query('manage-bar')
|
|
2316
|
-
], CollectionBrowser.prototype, "manageBar", void 0);
|
|
2317
|
-
__decorate([
|
|
2318
|
-
property({ type: Object, attribute: false })
|
|
2319
|
-
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
2320
|
-
__decorate([
|
|
2321
|
-
query('infinite-scroller')
|
|
2322
|
-
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
2323
|
-
CollectionBrowser = __decorate([
|
|
2324
|
-
customElement('collection-browser')
|
|
2325
|
-
], CollectionBrowser);
|
|
2326
|
-
export { CollectionBrowser };
|
|
2136
|
+
`,
|
|
2137
|
+
];
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
__decorate([
|
|
2141
|
+
property({ type: String })
|
|
2142
|
+
], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
|
|
2143
|
+
__decorate([
|
|
2144
|
+
property({ type: String })
|
|
2145
|
+
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
2146
|
+
__decorate([
|
|
2147
|
+
property({ type: Object })
|
|
2148
|
+
], CollectionBrowser.prototype, "searchService", void 0);
|
|
2149
|
+
__decorate([
|
|
2150
|
+
property({ type: Number })
|
|
2151
|
+
], CollectionBrowser.prototype, "searchType", void 0);
|
|
2152
|
+
__decorate([
|
|
2153
|
+
property({ type: String })
|
|
2154
|
+
], CollectionBrowser.prototype, "withinCollection", void 0);
|
|
2155
|
+
__decorate([
|
|
2156
|
+
property({ type: String })
|
|
2157
|
+
], CollectionBrowser.prototype, "withinProfile", void 0);
|
|
2158
|
+
__decorate([
|
|
2159
|
+
property({ type: String })
|
|
2160
|
+
], CollectionBrowser.prototype, "profileElement", void 0);
|
|
2161
|
+
__decorate([
|
|
2162
|
+
property({ type: String })
|
|
2163
|
+
], CollectionBrowser.prototype, "baseQuery", void 0);
|
|
2164
|
+
__decorate([
|
|
2165
|
+
property({ type: String })
|
|
2166
|
+
], CollectionBrowser.prototype, "displayMode", void 0);
|
|
2167
|
+
__decorate([
|
|
2168
|
+
property({ type: String })
|
|
2169
|
+
], CollectionBrowser.prototype, "selectedSort", void 0);
|
|
2170
|
+
__decorate([
|
|
2171
|
+
property({ type: String })
|
|
2172
|
+
], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
|
|
2173
|
+
__decorate([
|
|
2174
|
+
property({ type: String })
|
|
2175
|
+
], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
|
|
2176
|
+
__decorate([
|
|
2177
|
+
property({ type: String })
|
|
2178
|
+
], CollectionBrowser.prototype, "sortDirection", void 0);
|
|
2179
|
+
__decorate([
|
|
2180
|
+
property({ type: String })
|
|
2181
|
+
], CollectionBrowser.prototype, "defaultSortField", void 0);
|
|
2182
|
+
__decorate([
|
|
2183
|
+
property({ type: String })
|
|
2184
|
+
], CollectionBrowser.prototype, "defaultSortDirection", void 0);
|
|
2185
|
+
__decorate([
|
|
2186
|
+
property({ type: Number })
|
|
2187
|
+
], CollectionBrowser.prototype, "pageSize", void 0);
|
|
2188
|
+
__decorate([
|
|
2189
|
+
property({ type: Number })
|
|
2190
|
+
], CollectionBrowser.prototype, "currentPage", void 0);
|
|
2191
|
+
__decorate([
|
|
2192
|
+
property({ type: String })
|
|
2193
|
+
], CollectionBrowser.prototype, "minSelectedDate", void 0);
|
|
2194
|
+
__decorate([
|
|
2195
|
+
property({ type: String })
|
|
2196
|
+
], CollectionBrowser.prototype, "maxSelectedDate", void 0);
|
|
2197
|
+
__decorate([
|
|
2198
|
+
property({ type: Object })
|
|
2199
|
+
], CollectionBrowser.prototype, "selectedFacets", void 0);
|
|
2200
|
+
__decorate([
|
|
2201
|
+
property({ type: Boolean })
|
|
2202
|
+
], CollectionBrowser.prototype, "showSmartFacetBar", void 0);
|
|
2203
|
+
__decorate([
|
|
2204
|
+
property({ type: Boolean })
|
|
2205
|
+
], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
|
|
2206
|
+
__decorate([
|
|
2207
|
+
property({ type: Boolean })
|
|
2208
|
+
], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
|
|
2209
|
+
__decorate([
|
|
2210
|
+
property({ type: Boolean })
|
|
2211
|
+
], CollectionBrowser.prototype, "suppressResultCount", void 0);
|
|
2212
|
+
__decorate([
|
|
2213
|
+
property({ type: Boolean })
|
|
2214
|
+
], CollectionBrowser.prototype, "suppressResultTiles", void 0);
|
|
2215
|
+
__decorate([
|
|
2216
|
+
property({ type: Boolean })
|
|
2217
|
+
], CollectionBrowser.prototype, "suppressURLQuery", void 0);
|
|
2218
|
+
__decorate([
|
|
2219
|
+
property({ type: Boolean })
|
|
2220
|
+
], CollectionBrowser.prototype, "suppressSortBar", void 0);
|
|
2221
|
+
__decorate([
|
|
2222
|
+
property({ type: Boolean })
|
|
2223
|
+
], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
|
|
2224
|
+
__decorate([
|
|
2225
|
+
property({ type: String })
|
|
2226
|
+
], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
|
|
2227
|
+
__decorate([
|
|
2228
|
+
property({ type: Boolean })
|
|
2229
|
+
], CollectionBrowser.prototype, "facetPaneVisible", void 0);
|
|
2230
|
+
__decorate([
|
|
2231
|
+
property({ type: Boolean })
|
|
2232
|
+
], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
|
|
2233
|
+
__decorate([
|
|
2234
|
+
property({ type: String })
|
|
2235
|
+
], CollectionBrowser.prototype, "collectionPagePath", void 0);
|
|
2236
|
+
__decorate([
|
|
2237
|
+
property({ type: String, reflect: true })
|
|
2238
|
+
], CollectionBrowser.prototype, "searchContext", void 0);
|
|
2239
|
+
__decorate([
|
|
2240
|
+
property({ type: String })
|
|
2241
|
+
], CollectionBrowser.prototype, "pageContext", void 0);
|
|
2242
|
+
__decorate([
|
|
2243
|
+
property({ type: Object })
|
|
2244
|
+
], CollectionBrowser.prototype, "restorationStateHandler", void 0);
|
|
2245
|
+
__decorate([
|
|
2246
|
+
property({ type: Number })
|
|
2247
|
+
], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
|
|
2248
|
+
__decorate([
|
|
2249
|
+
property({ type: Boolean })
|
|
2250
|
+
], CollectionBrowser.prototype, "loggedIn", void 0);
|
|
2251
|
+
__decorate([
|
|
2252
|
+
property({ type: Object })
|
|
2253
|
+
], CollectionBrowser.prototype, "resizeObserver", void 0);
|
|
2254
|
+
__decorate([
|
|
2255
|
+
property({ type: Object })
|
|
2256
|
+
], CollectionBrowser.prototype, "modalManager", void 0);
|
|
2257
|
+
__decorate([
|
|
2258
|
+
property({ type: Object })
|
|
2259
|
+
], CollectionBrowser.prototype, "featureFeedbackService", void 0);
|
|
2260
|
+
__decorate([
|
|
2261
|
+
property({ type: Object })
|
|
2262
|
+
], CollectionBrowser.prototype, "recaptchaManager", void 0);
|
|
2263
|
+
__decorate([
|
|
2264
|
+
property({ type: Boolean })
|
|
2265
|
+
], CollectionBrowser.prototype, "isManageView", void 0);
|
|
2266
|
+
__decorate([
|
|
2267
|
+
property({ type: String })
|
|
2268
|
+
], CollectionBrowser.prototype, "manageViewLabel", void 0);
|
|
2269
|
+
__decorate([
|
|
2270
|
+
property({ type: Boolean })
|
|
2271
|
+
], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
|
|
2272
|
+
__decorate([
|
|
2273
|
+
property({ type: Boolean, reflect: true })
|
|
2274
|
+
], CollectionBrowser.prototype, "showSmartResults", void 0);
|
|
2275
|
+
__decorate([
|
|
2276
|
+
property({ type: Number })
|
|
2277
|
+
], CollectionBrowser.prototype, "maxPagesToManage", void 0);
|
|
2278
|
+
__decorate([
|
|
2279
|
+
property({ type: Object })
|
|
2280
|
+
], CollectionBrowser.prototype, "dataSource", void 0);
|
|
2281
|
+
__decorate([
|
|
2282
|
+
state()
|
|
2283
|
+
], CollectionBrowser.prototype, "pagesToRender", void 0);
|
|
2284
|
+
__decorate([
|
|
2285
|
+
state()
|
|
2286
|
+
], CollectionBrowser.prototype, "searchResultsLoading", void 0);
|
|
2287
|
+
__decorate([
|
|
2288
|
+
state()
|
|
2289
|
+
], CollectionBrowser.prototype, "facetsLoading", void 0);
|
|
2290
|
+
__decorate([
|
|
2291
|
+
state()
|
|
2292
|
+
], CollectionBrowser.prototype, "totalResults", void 0);
|
|
2293
|
+
__decorate([
|
|
2294
|
+
state()
|
|
2295
|
+
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
2296
|
+
__decorate([
|
|
2297
|
+
state()
|
|
2298
|
+
], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
|
|
2299
|
+
__decorate([
|
|
2300
|
+
state()
|
|
2301
|
+
], CollectionBrowser.prototype, "contentWidth", void 0);
|
|
2302
|
+
__decorate([
|
|
2303
|
+
state()
|
|
2304
|
+
], CollectionBrowser.prototype, "placeholderType", void 0);
|
|
2305
|
+
__decorate([
|
|
2306
|
+
query('#content-container')
|
|
2307
|
+
], CollectionBrowser.prototype, "contentContainer", void 0);
|
|
2308
|
+
__decorate([
|
|
2309
|
+
query('#left-column')
|
|
2310
|
+
], CollectionBrowser.prototype, "leftColumn", void 0);
|
|
2311
|
+
__decorate([
|
|
2312
|
+
query('collection-facets')
|
|
2313
|
+
], CollectionBrowser.prototype, "collectionFacets", void 0);
|
|
2314
|
+
__decorate([
|
|
2315
|
+
query('manage-bar')
|
|
2316
|
+
], CollectionBrowser.prototype, "manageBar", void 0);
|
|
2317
|
+
__decorate([
|
|
2318
|
+
property({ type: Object, attribute: false })
|
|
2319
|
+
], CollectionBrowser.prototype, "analyticsHandler", void 0);
|
|
2320
|
+
__decorate([
|
|
2321
|
+
query('infinite-scroller')
|
|
2322
|
+
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
2323
|
+
CollectionBrowser = __decorate([
|
|
2324
|
+
customElement('collection-browser')
|
|
2325
|
+
], CollectionBrowser);
|
|
2326
|
+
export { CollectionBrowser };
|
|
2327
2327
|
//# sourceMappingURL=collection-browser.js.map
|