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