@internetarchive/collection-browser 2.7.7-alpha.2 → 2.7.8-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/.github/workflows/ci.yml +3 -3
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +9 -1
- package/dist/src/app-root.js +40 -6
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/assets/img/icons/arrow-left.d.ts +1 -1
- package/dist/src/assets/img/icons/arrow-right.d.ts +1 -1
- package/dist/src/assets/img/icons/chevron.d.ts +1 -1
- package/dist/src/assets/img/icons/contract.d.ts +1 -1
- package/dist/src/assets/img/icons/empty-query.d.ts +1 -1
- package/dist/src/assets/img/icons/expand.d.ts +1 -1
- package/dist/src/assets/img/icons/eye-closed.d.ts +1 -1
- package/dist/src/assets/img/icons/eye.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
- package/dist/src/assets/img/icons/filter.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/null-result.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/circular-activity-indicator.d.ts +1 -1
- package/dist/src/circular-activity-indicator.js.map +1 -1
- package/dist/src/collection-browser.d.ts +21 -1
- package/dist/src/collection-browser.js +60 -17
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +5 -5
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
- package/dist/src/collection-facets/more-facets-content.js +4 -2
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +0 -1
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/dedupe.js.map +1 -1
- 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.js +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/models.d.ts +2 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +4 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.d.ts +2 -2
- package/dist/src/collection-facets/toggle-switch.js +2 -2
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +3 -2
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +4 -0
- 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 +4 -0
- package/dist/src/data-source/collection-browser-data-source.js +22 -8
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +1 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +2 -2
- package/dist/src/empty-placeholder.d.ts +1 -1
- package/dist/src/empty-placeholder.js +11 -10
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +86 -86
- package/dist/src/language-code-handler/language-code-mapping.js.map +1 -1
- package/dist/src/manage/manage-bar.d.ts +32 -9
- package/dist/src/manage/manage-bar.js +121 -27
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.d.ts +9 -0
- package/dist/src/manage/remove-items-modal-content.js +104 -0
- package/dist/src/manage/remove-items-modal-content.js.map +1 -0
- package/dist/src/mediatype/mediatype-config.js +0 -1
- package/dist/src/mediatype/mediatype-config.js.map +1 -1
- package/dist/src/models.d.ts +24 -15
- package/dist/src/models.js +3 -3
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +1 -0
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +9 -9
- 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/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +2 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +3 -2
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +1 -1
- package/dist/src/tiles/grid/tile-stats.js +2 -2
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +1 -3
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +1 -1
- package/dist/src/tiles/image-block.js +1 -1
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +1 -1
- package/dist/src/tiles/item-image.js +2 -2
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +6 -4
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/mediatype-icon.d.ts +1 -1
- package/dist/src/tiles/mediatype-icon.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/review-block.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -1
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/utils/facet-utils.js.map +1 -1
- package/dist/src/utils/format-count.d.ts +2 -2
- package/dist/src/utils/format-count.js +1 -0
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/format-date.d.ts +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/src/utils/format-unit-size.js.map +1 -1
- package/dist/src/utils/log.js +3 -1
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +17 -2
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +1 -4
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +1 -0
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +1 -0
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +3 -12
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +1 -0
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +1 -0
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +1 -0
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +1 -0
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +1 -0
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.d.ts +1 -0
- package/dist/test/manage/manage-bar.test.js +26 -10
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.d.ts +1 -0
- package/dist/test/manage/remove-items-modal-content.test.js +66 -0
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +1 -0
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +1 -0
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +1 -0
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +1 -0
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +23 -22
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +1 -0
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +1 -0
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +1 -0
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +1 -0
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +1 -0
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +1 -0
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/utils/format-count.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/dist/test/utils/local-date-from-utc.test.js.map +1 -1
- package/index.html +3 -0
- package/package.json +38 -40
- package/src/app-root.ts +60 -25
- package/src/collection-browser.ts +101 -50
- package/src/collection-facets/facets-template.ts +6 -7
- package/src/collection-facets/more-facets-content.ts +13 -11
- package/src/collection-facets/more-facets-pagination.ts +2 -3
- 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 +8 -6
- package/src/collection-facets/smart-facets/smart-facet-button.ts +3 -5
- 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 +19 -18
- package/src/data-source/collection-browser-data-source-interface.ts +6 -5
- package/src/data-source/collection-browser-data-source.ts +48 -37
- package/src/data-source/collection-browser-query-state.ts +1 -0
- package/src/empty-placeholder.ts +16 -19
- 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 +132 -38
- package/src/manage/remove-items-modal-content.ts +102 -0
- package/src/mediatype/mediatype-config.ts +0 -1
- package/src/models.ts +13 -3
- package/src/restoration-state-handler.ts +15 -14
- package/src/sort-filter-bar/alpha-bar.ts +17 -16
- package/src/sort-filter-bar/sort-filter-bar.ts +15 -14
- 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 +2 -4
- 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 +24 -22
- 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 +3 -2
- package/src/utils/format-date.ts +1 -1
- package/src/utils/format-unit-size.ts +1 -1
- package/src/utils/log.ts +3 -1
- package/test/collection-browser.test.ts +145 -123
- package/test/collection-facets/facet-row.test.ts +28 -31
- package/test/collection-facets/facets-template.test.ts +9 -9
- package/test/collection-facets/more-facets-content.test.ts +15 -14
- package/test/collection-facets/more-facets-pagination.test.ts +19 -18
- package/test/collection-facets/toggle-switch.test.ts +18 -28
- package/test/collection-facets.test.ts +37 -36
- package/test/data-source/collection-browser-data-source.test.ts +2 -2
- package/test/empty-placeholder.test.ts +7 -6
- package/test/expanded-date-picker.test.ts +18 -17
- package/test/icon-overlay.test.ts +1 -0
- package/test/image-block.test.ts +7 -6
- package/test/item-image.test.ts +1 -0
- package/test/manage/manage-bar.test.ts +52 -28
- package/test/manage/remove-items-modal-content.test.ts +82 -0
- package/test/mocks/mock-search-responses.ts +1 -2
- package/test/mocks/mock-search-service.ts +1 -1
- package/test/restoration-state-handler.test.ts +12 -12
- package/test/review-block.test.ts +2 -1
- 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 +39 -38
- package/test/text-overlay.test.ts +1 -0
- package/test/text-snippet-block.test.ts +6 -5
- package/test/tile-stats.test.ts +35 -26
- package/test/tiles/grid/account-tile.test.ts +3 -2
- package/test/tiles/grid/collection-tile.test.ts +4 -3
- package/test/tiles/grid/item-tile.test.ts +14 -13
- package/test/tiles/grid/search-tile.test.ts +2 -1
- 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 +2 -1
- package/test/tiles/list/tile-list.test.ts +11 -10
- 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 +1 -0
- package/.prettierignore +0 -1
- package/eslint.config.mjs +0 -53
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable no-continue */
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
css,
|
|
3
5
|
html,
|
|
@@ -66,7 +68,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
66
68
|
this.smartFacets,
|
|
67
69
|
f =>
|
|
68
70
|
`${f[0].label}|${f[0].facets[0].facetType}|${f[0].facets[0].bucketKey}`,
|
|
69
|
-
facet => this.makeSmartFacet(facet)
|
|
71
|
+
facet => this.makeSmartFacet(facet)
|
|
70
72
|
)}
|
|
71
73
|
</div>
|
|
72
74
|
`;
|
|
@@ -188,7 +190,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
188
190
|
key === 'mediatype' &&
|
|
189
191
|
this.selectedFacets &&
|
|
190
192
|
Object.values(this.selectedFacets.mediatype).some(
|
|
191
|
-
bucket => bucket.state !== 'none'
|
|
193
|
+
bucket => bucket.state !== 'none'
|
|
192
194
|
)
|
|
193
195
|
) {
|
|
194
196
|
continue;
|
|
@@ -208,7 +210,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
208
210
|
if (facetType === 'mediatype') {
|
|
209
211
|
facets.push(
|
|
210
212
|
[this.toSmartFacet(facetType, [unusedBuckets[0]])],
|
|
211
|
-
[this.toSmartFacet(facetType, [unusedBuckets[1]])]
|
|
213
|
+
[this.toSmartFacet(facetType, [unusedBuckets[1]])]
|
|
212
214
|
);
|
|
213
215
|
} else if (facetType === 'collection' || facetType === 'subject') {
|
|
214
216
|
const topBuckets = unusedBuckets.slice(0, 5);
|
|
@@ -224,7 +226,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
224
226
|
|
|
225
227
|
private toSmartFacet(
|
|
226
228
|
facetType: FacetOption,
|
|
227
|
-
buckets: Bucket[]
|
|
229
|
+
buckets: Bucket[]
|
|
228
230
|
// prefix = true
|
|
229
231
|
): SmartFacet {
|
|
230
232
|
return {
|
|
@@ -257,7 +259,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
257
259
|
this.selectedFacets,
|
|
258
260
|
facet.facetType,
|
|
259
261
|
facet.bucket,
|
|
260
|
-
true
|
|
262
|
+
true
|
|
261
263
|
);
|
|
262
264
|
}
|
|
263
265
|
|
|
@@ -284,7 +286,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
284
286
|
this.selectedFacets,
|
|
285
287
|
facet.facetType,
|
|
286
288
|
facet.bucket,
|
|
287
|
-
true
|
|
289
|
+
true
|
|
288
290
|
);
|
|
289
291
|
}
|
|
290
292
|
|
|
@@ -28,9 +28,7 @@ export class SmartFacetButton extends LitElement {
|
|
|
28
28
|
|
|
29
29
|
const displayText = capitalize(
|
|
30
30
|
(this.labelPrefix ? `${this.labelPrefix} ` : '') +
|
|
31
|
-
(this.facetInfo.label ??
|
|
32
|
-
firstFacet.displayText ??
|
|
33
|
-
firstFacet.bucketKey),
|
|
31
|
+
(this.facetInfo.label ?? firstFacet.displayText ?? firstFacet.bucketKey)
|
|
34
32
|
);
|
|
35
33
|
if (!displayText) return nothing;
|
|
36
34
|
|
|
@@ -63,7 +61,7 @@ export class SmartFacetButton extends LitElement {
|
|
|
63
61
|
for (const facet of this.facetInfo.facets) {
|
|
64
62
|
url.searchParams.append(
|
|
65
63
|
'and[]',
|
|
66
|
-
encodeURIComponent(`${facet.facetType}:"${facet.bucketKey}"`)
|
|
64
|
+
encodeURIComponent(`${facet.facetType}:"${facet.bucketKey}"`)
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
67
|
}
|
|
@@ -90,7 +88,7 @@ export class SmartFacetButton extends LitElement {
|
|
|
90
88
|
negative: false,
|
|
91
89
|
})),
|
|
92
90
|
},
|
|
93
|
-
})
|
|
91
|
+
})
|
|
94
92
|
);
|
|
95
93
|
}
|
|
96
94
|
|
|
@@ -67,7 +67,7 @@ export class SmartFacetDropdown extends LitElement {
|
|
|
67
67
|
private get activeDropdownOption(): optionInterface | undefined {
|
|
68
68
|
if (!this.activeFacetRef) return undefined;
|
|
69
69
|
return this.dropdownOptions.find(
|
|
70
|
-
opt => opt.id === this.activeFacetRef?.bucketKey
|
|
70
|
+
opt => opt.id === this.activeFacetRef?.bucketKey
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -77,7 +77,7 @@ export class SmartFacetDropdown extends LitElement {
|
|
|
77
77
|
let selectedSmartFacet;
|
|
78
78
|
for (const smartFacet of this.facetInfo) {
|
|
79
79
|
const selectedRef = smartFacet.facets.find(
|
|
80
|
-
b => b.bucketKey === e.detail.option.id
|
|
80
|
+
b => b.bucketKey === e.detail.option.id
|
|
81
81
|
);
|
|
82
82
|
if (selectedRef) {
|
|
83
83
|
this.activeFacetRef = selectedRef;
|
|
@@ -103,14 +103,14 @@ export class SmartFacetDropdown extends LitElement {
|
|
|
103
103
|
},
|
|
104
104
|
],
|
|
105
105
|
},
|
|
106
|
-
})
|
|
106
|
+
})
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
private onDropdownClick(): void {
|
|
111
111
|
log('smart dropdown: onDropdownClick', this);
|
|
112
112
|
this.dispatchEvent(
|
|
113
|
-
new CustomEvent<SmartFacetDropdown>('dropdownClick', { detail: this })
|
|
113
|
+
new CustomEvent<SmartFacetDropdown>('dropdownClick', { detail: this })
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -13,7 +13,7 @@ export class SmartQueryHeuristicGroup implements SmartQueryHeuristic {
|
|
|
13
13
|
|
|
14
14
|
async getRecommendedFacets(query: string): Promise<SmartFacet[]> {
|
|
15
15
|
const promises = SmartQueryHeuristicGroup.HEURISTICS.map(HeuristicCtor =>
|
|
16
|
-
new HeuristicCtor().getRecommendedFacets(query)
|
|
16
|
+
new HeuristicCtor().getRecommendedFacets(query)
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
return dedupe((await Promise.all(promises)).flat());
|
|
@@ -84,8 +84,8 @@ export class ToggleSwitch extends LitElement {
|
|
|
84
84
|
*/
|
|
85
85
|
get selectedLabel(): string {
|
|
86
86
|
return this.side === 'left'
|
|
87
|
-
?
|
|
88
|
-
:
|
|
87
|
+
? this.leftLabel ?? this.leftValue
|
|
88
|
+
: this.rightLabel ?? this.rightValue;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
private handleClick(): void {
|
package/src/collection-facets.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable import/no-duplicates */
|
|
1
2
|
import {
|
|
2
3
|
css,
|
|
3
4
|
html,
|
|
@@ -170,7 +171,7 @@ export class CollectionFacets extends LitElement {
|
|
|
170
171
|
: nothing}
|
|
171
172
|
${this.collectionPartOfTemplate}
|
|
172
173
|
${this.mergedFacets.map(facetGroup =>
|
|
173
|
-
this.getFacetGroupTemplate(facetGroup)
|
|
174
|
+
this.getFacetGroupTemplate(facetGroup)
|
|
174
175
|
)}
|
|
175
176
|
</div>
|
|
176
177
|
`;
|
|
@@ -348,7 +349,7 @@ export class CollectionFacets extends LitElement {
|
|
|
348
349
|
e: CustomEvent<{
|
|
349
350
|
minDate: string;
|
|
350
351
|
maxDate: string;
|
|
351
|
-
}
|
|
352
|
+
}>
|
|
352
353
|
): void => {
|
|
353
354
|
const { minDate, maxDate } = e.detail;
|
|
354
355
|
const event = new CustomEvent('histogramDateRangeUpdated', {
|
|
@@ -365,10 +366,10 @@ export class CollectionFacets extends LitElement {
|
|
|
365
366
|
|
|
366
367
|
facetDisplayOrder.forEach(facetKey => {
|
|
367
368
|
const selectedFacetGroup = this.selectedFacetGroups.find(
|
|
368
|
-
group => group.key === facetKey
|
|
369
|
+
group => group.key === facetKey
|
|
369
370
|
);
|
|
370
371
|
const aggregateFacetGroup = this.aggregationFacetGroups.find(
|
|
371
|
-
group => group.key === facetKey
|
|
372
|
+
group => group.key === facetKey
|
|
372
373
|
);
|
|
373
374
|
|
|
374
375
|
// if the user selected a facet, but it's not in the aggregation, we add it as-is
|
|
@@ -387,7 +388,7 @@ export class CollectionFacets extends LitElement {
|
|
|
387
388
|
let bucketsWithCount =
|
|
388
389
|
selectedFacetGroup?.buckets.map(bucket => {
|
|
389
390
|
const selectedBucket = aggregateFacetGroup.buckets.find(
|
|
390
|
-
b => b.key === bucket.key
|
|
391
|
+
b => b.key === bucket.key
|
|
391
392
|
);
|
|
392
393
|
return selectedBucket
|
|
393
394
|
? {
|
|
@@ -411,7 +412,7 @@ export class CollectionFacets extends LitElement {
|
|
|
411
412
|
* - additionally want to show all items (selected/suppressed) in page facet area
|
|
412
413
|
*/
|
|
413
414
|
let allowedFacetCount = Object.keys(
|
|
414
|
-
(selectedFacetGroup?.buckets as []) || []
|
|
415
|
+
(selectedFacetGroup?.buckets as []) || []
|
|
415
416
|
)?.length;
|
|
416
417
|
if (allowedFacetCount < this.allowedFacetCount) {
|
|
417
418
|
allowedFacetCount = this.allowedFacetCount; // splice start index from 0th
|
|
@@ -420,7 +421,7 @@ export class CollectionFacets extends LitElement {
|
|
|
420
421
|
// For lending facets, only include a specific subset of buckets
|
|
421
422
|
if (facetKey === 'lending') {
|
|
422
423
|
bucketsWithCount = bucketsWithCount.filter(
|
|
423
|
-
bucket => lendingFacetKeysVisibility[bucket.key as LendingFacetKey]
|
|
424
|
+
bucket => lendingFacetKeysVisibility[bucket.key as LendingFacetKey]
|
|
424
425
|
);
|
|
425
426
|
}
|
|
426
427
|
|
|
@@ -430,13 +431,13 @@ export class CollectionFacets extends LitElement {
|
|
|
430
431
|
// For mediatype facets, ensure the collection bucket is always shown if present
|
|
431
432
|
if (facetKey === 'mediatype') {
|
|
432
433
|
const collectionIndex = bucketsWithCount.findIndex(
|
|
433
|
-
bucket => bucket.key === 'collection'
|
|
434
|
+
bucket => bucket.key === 'collection'
|
|
434
435
|
);
|
|
435
436
|
|
|
436
437
|
if (collectionIndex >= allowedFacetCount) {
|
|
437
438
|
const [collectionBucket] = bucketsWithCount.splice(
|
|
438
439
|
collectionIndex,
|
|
439
|
-
1
|
|
440
|
+
1
|
|
440
441
|
);
|
|
441
442
|
|
|
442
443
|
// If we're showing lots of selected facets, ensure we're not cutting off the last one
|
|
@@ -483,7 +484,7 @@ export class CollectionFacets extends LitElement {
|
|
|
483
484
|
count: facetData.count,
|
|
484
485
|
state: facetData.state,
|
|
485
486
|
};
|
|
486
|
-
}
|
|
487
|
+
}
|
|
487
488
|
);
|
|
488
489
|
|
|
489
490
|
return {
|
|
@@ -491,7 +492,7 @@ export class CollectionFacets extends LitElement {
|
|
|
491
492
|
key: option,
|
|
492
493
|
buckets,
|
|
493
494
|
};
|
|
494
|
-
}
|
|
495
|
+
}
|
|
495
496
|
);
|
|
496
497
|
|
|
497
498
|
return facetGroups;
|
|
@@ -511,7 +512,7 @@ export class CollectionFacets extends LitElement {
|
|
|
511
512
|
if (!title) return;
|
|
512
513
|
|
|
513
514
|
let castedBuckets = aggregation.getSortedBuckets(
|
|
514
|
-
defaultFacetSort[option]
|
|
515
|
+
defaultFacetSort[option]
|
|
515
516
|
) as Bucket[];
|
|
516
517
|
|
|
517
518
|
if (option === 'collection') {
|
|
@@ -555,7 +556,7 @@ export class CollectionFacets extends LitElement {
|
|
|
555
556
|
* chevron for the mobile view
|
|
556
557
|
*/
|
|
557
558
|
private getFacetGroupTemplate(
|
|
558
|
-
facetGroup: FacetGroup
|
|
559
|
+
facetGroup: FacetGroup
|
|
559
560
|
): TemplateResult | typeof nothing {
|
|
560
561
|
if (!this.facetsLoading && facetGroup.buckets.length === 0) return nothing;
|
|
561
562
|
|
|
@@ -610,7 +611,7 @@ export class CollectionFacets extends LitElement {
|
|
|
610
611
|
return html`
|
|
611
612
|
${map(
|
|
612
613
|
Array(5).fill(null),
|
|
613
|
-
() => html`<facet-tombstone-row></facet-tombstone-row
|
|
614
|
+
() => html`<facet-tombstone-row></facet-tombstone-row>`
|
|
614
615
|
)}
|
|
615
616
|
`;
|
|
616
617
|
}
|
|
@@ -621,7 +622,7 @@ export class CollectionFacets extends LitElement {
|
|
|
621
622
|
* TODO: want to fire analytics?
|
|
622
623
|
*/
|
|
623
624
|
private searchMoreFacetsLink(
|
|
624
|
-
facetGroup: FacetGroup
|
|
625
|
+
facetGroup: FacetGroup
|
|
625
626
|
): TemplateResult | typeof nothing {
|
|
626
627
|
// Don't render More... links for FTS searches
|
|
627
628
|
if (!this.moreLinksVisible) {
|
|
@@ -653,7 +654,7 @@ export class CollectionFacets extends LitElement {
|
|
|
653
654
|
label: facetGroup.key,
|
|
654
655
|
});
|
|
655
656
|
this.dispatchEvent(
|
|
656
|
-
new CustomEvent('showMoreFacets', { detail: facetGroup.key })
|
|
657
|
+
new CustomEvent('showMoreFacets', { detail: facetGroup.key })
|
|
657
658
|
);
|
|
658
659
|
}}
|
|
659
660
|
data-testid="more-link-btn"
|
|
@@ -664,7 +665,7 @@ export class CollectionFacets extends LitElement {
|
|
|
664
665
|
|
|
665
666
|
async showMoreFacetsModal(
|
|
666
667
|
facetGroup: FacetGroup,
|
|
667
|
-
sortedBy: AggregationSortType
|
|
668
|
+
sortedBy: AggregationSortType
|
|
668
669
|
): Promise<void> {
|
|
669
670
|
const customModalContent = html`
|
|
670
671
|
<more-facets-content
|
|
@@ -723,7 +724,7 @@ export class CollectionFacets extends LitElement {
|
|
|
723
724
|
this.selectedFacets,
|
|
724
725
|
facetGroup.key,
|
|
725
726
|
e.detail.bucket,
|
|
726
|
-
true
|
|
727
|
+
true
|
|
727
728
|
);
|
|
728
729
|
|
|
729
730
|
const event = new CustomEvent<SelectedFacets>('facetsChanged', {
|
|
@@ -155,6 +155,11 @@ export interface CollectionBrowserDataSourceInterface
|
|
|
155
155
|
*/
|
|
156
156
|
reset(): void;
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Resets the data source to its pages.
|
|
160
|
+
*/
|
|
161
|
+
resetPages(): void;
|
|
162
|
+
|
|
158
163
|
/**
|
|
159
164
|
* Adds the given page of tile models to the data source.
|
|
160
165
|
* If the given page number already exists, that page will be overwritten.
|
|
@@ -280,11 +285,7 @@ export interface CollectionBrowserDataSourceInterface
|
|
|
280
285
|
* @param callback A callback function to apply on each tile model, as with Array.map
|
|
281
286
|
*/
|
|
282
287
|
map(
|
|
283
|
-
callback: (
|
|
284
|
-
model: TileModel,
|
|
285
|
-
index: number,
|
|
286
|
-
array: TileModel[],
|
|
287
|
-
) => TileModel,
|
|
288
|
+
callback: (model: TileModel, index: number, array: TileModel[]) => TileModel
|
|
288
289
|
): void;
|
|
289
290
|
|
|
290
291
|
/**
|
|
@@ -162,12 +162,13 @@ export class CollectionBrowserDataSource
|
|
|
162
162
|
return this._initialSearchCompletePromise;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// eslint-disable-next-line no-useless-constructor
|
|
165
166
|
constructor(
|
|
166
167
|
/** The host element to which this controller should attach listeners */
|
|
167
168
|
private readonly host: ReactiveControllerHost &
|
|
168
169
|
CollectionBrowserSearchInterface,
|
|
169
170
|
/** Default size of result pages */
|
|
170
|
-
private pageSize: number = 50
|
|
171
|
+
private pageSize: number = 50
|
|
171
172
|
) {
|
|
172
173
|
// Just setting some property values
|
|
173
174
|
}
|
|
@@ -245,6 +246,19 @@ export class CollectionBrowserDataSource
|
|
|
245
246
|
this.requestHostUpdate();
|
|
246
247
|
}
|
|
247
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @inheritdoc
|
|
251
|
+
*/
|
|
252
|
+
resetPages(): void {
|
|
253
|
+
if (Object.keys(this.pages).length !== this.host.maxPagesToManage) {
|
|
254
|
+
this.pages = {};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Invalidate any fetches in progress
|
|
258
|
+
this.fetchesInProgress.clear();
|
|
259
|
+
this.requestHostUpdate();
|
|
260
|
+
}
|
|
261
|
+
|
|
248
262
|
/**
|
|
249
263
|
* @inheritdoc
|
|
250
264
|
*/
|
|
@@ -263,13 +277,13 @@ export class CollectionBrowserDataSource
|
|
|
263
277
|
const pageStartIndex = this.pageSize * i;
|
|
264
278
|
this.addPage(
|
|
265
279
|
firstPageNum + i,
|
|
266
|
-
tiles.slice(pageStartIndex, pageStartIndex + this.pageSize)
|
|
280
|
+
tiles.slice(pageStartIndex, pageStartIndex + this.pageSize)
|
|
267
281
|
);
|
|
268
282
|
}
|
|
269
283
|
|
|
270
284
|
const visiblePages = this.host.currentVisiblePageNumbers;
|
|
271
285
|
const needsReload = visiblePages.some(
|
|
272
|
-
page => page >= firstPageNum && page <= firstPageNum + numPages
|
|
286
|
+
page => page >= firstPageNum && page <= firstPageNum + numPages
|
|
273
287
|
);
|
|
274
288
|
if (needsReload) {
|
|
275
289
|
this.refreshVisibleResults();
|
|
@@ -430,19 +444,16 @@ export class CollectionBrowserDataSource
|
|
|
430
444
|
* @inheritdoc
|
|
431
445
|
*/
|
|
432
446
|
map(
|
|
433
|
-
callback: (
|
|
434
|
-
model: TileModel,
|
|
435
|
-
index: number,
|
|
436
|
-
array: TileModel[],
|
|
437
|
-
) => TileModel,
|
|
447
|
+
callback: (model: TileModel, index: number, array: TileModel[]) => TileModel
|
|
438
448
|
): void {
|
|
449
|
+
if (!Object.keys(this.pages).length) return;
|
|
439
450
|
this.pages = Object.fromEntries(
|
|
440
451
|
Object.entries(this.pages).map(([page, tileModels]) => [
|
|
441
452
|
page,
|
|
442
453
|
tileModels.map((model, index, array) =>
|
|
443
|
-
model ? callback(model, index, array) : model
|
|
454
|
+
model ? callback(model, index, array) : model
|
|
444
455
|
),
|
|
445
|
-
])
|
|
456
|
+
])
|
|
446
457
|
);
|
|
447
458
|
this.requestHostUpdate();
|
|
448
459
|
this.refreshVisibleResults();
|
|
@@ -539,12 +550,12 @@ export class CollectionBrowserDataSource
|
|
|
539
550
|
* @returns A filtered array of tile models satisfying the predicate
|
|
540
551
|
*/
|
|
541
552
|
private getFilteredTileModels(
|
|
542
|
-
predicate: (model: TileModel, index: number, array: TileModel[]) => unknown
|
|
553
|
+
predicate: (model: TileModel, index: number, array: TileModel[]) => unknown
|
|
543
554
|
): TileModel[] {
|
|
544
555
|
return Object.values(this.pages)
|
|
545
556
|
.flat()
|
|
546
557
|
.filter((model, index, array) =>
|
|
547
|
-
model ? predicate(model, index, array) : false
|
|
558
|
+
model ? predicate(model, index, array) : false
|
|
548
559
|
);
|
|
549
560
|
}
|
|
550
561
|
|
|
@@ -656,25 +667,25 @@ export class CollectionBrowserDataSource
|
|
|
656
667
|
builder.addFilter(
|
|
657
668
|
'year',
|
|
658
669
|
this.host.minSelectedDate,
|
|
659
|
-
FilterConstraint.GREATER_OR_EQUAL
|
|
670
|
+
FilterConstraint.GREATER_OR_EQUAL
|
|
660
671
|
);
|
|
661
672
|
}
|
|
662
673
|
if (this.host.maxSelectedDate) {
|
|
663
674
|
builder.addFilter(
|
|
664
675
|
'year',
|
|
665
676
|
this.host.maxSelectedDate,
|
|
666
|
-
FilterConstraint.LESS_OR_EQUAL
|
|
677
|
+
FilterConstraint.LESS_OR_EQUAL
|
|
667
678
|
);
|
|
668
679
|
}
|
|
669
680
|
|
|
670
681
|
// Add any selected facets
|
|
671
682
|
if (this.host.selectedFacets) {
|
|
672
683
|
for (const [facetName, facetValues] of Object.entries(
|
|
673
|
-
this.host.selectedFacets
|
|
684
|
+
this.host.selectedFacets
|
|
674
685
|
)) {
|
|
675
686
|
const { name, values } = this.prepareFacetForFetch(
|
|
676
687
|
facetName,
|
|
677
|
-
facetValues
|
|
688
|
+
facetValues
|
|
678
689
|
);
|
|
679
690
|
for (const [value, bucket] of Object.entries(values)) {
|
|
680
691
|
let constraint;
|
|
@@ -696,14 +707,14 @@ export class CollectionBrowserDataSource
|
|
|
696
707
|
builder.addFilter(
|
|
697
708
|
'firstTitle',
|
|
698
709
|
this.host.selectedTitleFilter,
|
|
699
|
-
FilterConstraint.INCLUDE
|
|
710
|
+
FilterConstraint.INCLUDE
|
|
700
711
|
);
|
|
701
712
|
}
|
|
702
713
|
if (this.host.selectedCreatorFilter) {
|
|
703
714
|
builder.addFilter(
|
|
704
715
|
'firstCreator',
|
|
705
716
|
this.host.selectedCreatorFilter,
|
|
706
|
-
FilterConstraint.INCLUDE
|
|
717
|
+
FilterConstraint.INCLUDE
|
|
707
718
|
);
|
|
708
719
|
}
|
|
709
720
|
|
|
@@ -791,7 +802,7 @@ export class CollectionBrowserDataSource
|
|
|
791
802
|
if (!this.host.selectedFacets) return undefined;
|
|
792
803
|
const facetClauses = [];
|
|
793
804
|
for (const [facetName, facetValues] of Object.entries(
|
|
794
|
-
this.host.selectedFacets
|
|
805
|
+
this.host.selectedFacets
|
|
795
806
|
)) {
|
|
796
807
|
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
797
808
|
}
|
|
@@ -844,11 +855,11 @@ export class CollectionBrowserDataSource
|
|
|
844
855
|
*/
|
|
845
856
|
private buildFacetClause(
|
|
846
857
|
facetName: string,
|
|
847
|
-
facetValues: Record<string, FacetBucket
|
|
858
|
+
facetValues: Record<string, FacetBucket>
|
|
848
859
|
): string {
|
|
849
860
|
const { name: facetQueryName, values } = this.prepareFacetForFetch(
|
|
850
861
|
facetName,
|
|
851
|
-
facetValues
|
|
862
|
+
facetValues
|
|
852
863
|
);
|
|
853
864
|
const facetEntries = Object.entries(values);
|
|
854
865
|
if (facetEntries.length === 0) return '';
|
|
@@ -872,7 +883,7 @@ export class CollectionBrowserDataSource
|
|
|
872
883
|
*/
|
|
873
884
|
private prepareFacetForFetch(
|
|
874
885
|
facetName: string,
|
|
875
|
-
facetValues: Record<string, FacetBucket
|
|
886
|
+
facetValues: Record<string, FacetBucket>
|
|
876
887
|
): { name: string; values: Record<string, FacetBucket> } {
|
|
877
888
|
// eslint-disable-next-line prefer-const
|
|
878
889
|
let [normalizedName, normalizedValues] = [facetName, facetValues];
|
|
@@ -894,7 +905,7 @@ export class CollectionBrowserDataSource
|
|
|
894
905
|
*/
|
|
895
906
|
private joinFacetClauses(facetClauses: string[]): string | undefined {
|
|
896
907
|
const nonEmptyFacetClauses = facetClauses.filter(
|
|
897
|
-
clause => clause.length > 0
|
|
908
|
+
clause => clause.length > 0
|
|
898
909
|
);
|
|
899
910
|
return nonEmptyFacetClauses.length > 0
|
|
900
911
|
? `(${nonEmptyFacetClauses.join(' AND ')})`
|
|
@@ -928,12 +939,12 @@ export class CollectionBrowserDataSource
|
|
|
928
939
|
};
|
|
929
940
|
params.uid = await this.requestUID(
|
|
930
941
|
{ ...params, sort: sortParams },
|
|
931
|
-
'aggregations'
|
|
942
|
+
'aggregations'
|
|
932
943
|
);
|
|
933
944
|
|
|
934
945
|
const searchResponse = await this.host.searchService?.search(
|
|
935
946
|
params,
|
|
936
|
-
this.host.searchType
|
|
947
|
+
this.host.searchType
|
|
937
948
|
);
|
|
938
949
|
const success = searchResponse?.success;
|
|
939
950
|
|
|
@@ -950,10 +961,10 @@ export class CollectionBrowserDataSource
|
|
|
950
961
|
const detailMsg = searchResponse?.error?.details?.message;
|
|
951
962
|
|
|
952
963
|
if (!errorMsg && !detailMsg) {
|
|
953
|
-
// @ts-
|
|
964
|
+
// @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'
|
|
954
965
|
window?.Sentry?.captureMessage?.(
|
|
955
966
|
'Missing or malformed facet response from backend',
|
|
956
|
-
'error'
|
|
967
|
+
'error'
|
|
957
968
|
);
|
|
958
969
|
}
|
|
959
970
|
|
|
@@ -1048,7 +1059,7 @@ export class CollectionBrowserDataSource
|
|
|
1048
1059
|
// log('=== FIRING PAGE REQUEST ===', params);
|
|
1049
1060
|
const searchResponse = await this.host.searchService?.search(
|
|
1050
1061
|
params,
|
|
1051
|
-
this.host.searchType
|
|
1062
|
+
this.host.searchType
|
|
1052
1063
|
);
|
|
1053
1064
|
// log('=== RECEIVED PAGE RESPONSE IN CB ===', searchResponse);
|
|
1054
1065
|
const success = searchResponse?.success;
|
|
@@ -1070,7 +1081,7 @@ export class CollectionBrowserDataSource
|
|
|
1070
1081
|
|
|
1071
1082
|
if (!this.queryErrorMessage) {
|
|
1072
1083
|
this.queryErrorMessage = 'Missing or malformed response from backend';
|
|
1073
|
-
// @ts-
|
|
1084
|
+
// @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'
|
|
1074
1085
|
window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');
|
|
1075
1086
|
}
|
|
1076
1087
|
|
|
@@ -1097,7 +1108,7 @@ export class CollectionBrowserDataSource
|
|
|
1097
1108
|
|
|
1098
1109
|
if (this.collectionExtraInfo) {
|
|
1099
1110
|
this.parentCollections = [].concat(
|
|
1100
|
-
this.collectionExtraInfo.public_metadata?.collection ?? []
|
|
1111
|
+
this.collectionExtraInfo.public_metadata?.collection ?? []
|
|
1101
1112
|
);
|
|
1102
1113
|
}
|
|
1103
1114
|
} else if (this.host.withinProfile) {
|
|
@@ -1118,7 +1129,7 @@ export class CollectionBrowserDataSource
|
|
|
1118
1129
|
// Update the data source for each returned page.
|
|
1119
1130
|
// For loans and web archives, we must account for receiving more pages than we asked for.
|
|
1120
1131
|
const isUnpagedElement = ['lending', 'web_archives'].includes(
|
|
1121
|
-
this.host.profileElement
|
|
1132
|
+
this.host.profileElement!
|
|
1122
1133
|
);
|
|
1123
1134
|
if (isUnpagedElement) {
|
|
1124
1135
|
numPages = Math.ceil(results.length / this.pageSize);
|
|
@@ -1131,7 +1142,7 @@ export class CollectionBrowserDataSource
|
|
|
1131
1142
|
this.addFetchedResultsToDataSource(
|
|
1132
1143
|
pageNumber + i,
|
|
1133
1144
|
results.slice(pageStartIndex, pageStartIndex + this.pageSize),
|
|
1134
|
-
!isUnpagedElement || i === numPages - 1
|
|
1145
|
+
!isUnpagedElement || i === numPages - 1
|
|
1135
1146
|
);
|
|
1136
1147
|
}
|
|
1137
1148
|
}
|
|
@@ -1157,7 +1168,7 @@ export class CollectionBrowserDataSource
|
|
|
1157
1168
|
private addFetchedResultsToDataSource(
|
|
1158
1169
|
pageNumber: number,
|
|
1159
1170
|
results: SearchResult[],
|
|
1160
|
-
needsReload = true
|
|
1171
|
+
needsReload = true
|
|
1161
1172
|
): void {
|
|
1162
1173
|
const tiles: TileModel[] = [];
|
|
1163
1174
|
results?.forEach(result => {
|
|
@@ -1176,7 +1187,7 @@ export class CollectionBrowserDataSource
|
|
|
1176
1187
|
* Fetches the aggregation buckets for the given prefix filter type.
|
|
1177
1188
|
*/
|
|
1178
1189
|
private async fetchPrefixFilterBuckets(
|
|
1179
|
-
filterType: PrefixFilterType
|
|
1190
|
+
filterType: PrefixFilterType
|
|
1180
1191
|
): Promise<Bucket[]> {
|
|
1181
1192
|
const trimmedQuery = this.host.baseQuery?.trim();
|
|
1182
1193
|
if (!this.canPerformSearch) return [];
|
|
@@ -1196,12 +1207,12 @@ export class CollectionBrowserDataSource
|
|
|
1196
1207
|
};
|
|
1197
1208
|
params.uid = await this.requestUID(
|
|
1198
1209
|
{ ...params, sort: sortParams },
|
|
1199
|
-
'aggregations'
|
|
1210
|
+
'aggregations'
|
|
1200
1211
|
);
|
|
1201
1212
|
|
|
1202
1213
|
const searchResponse = await this.host.searchService?.search(
|
|
1203
1214
|
params,
|
|
1204
|
-
this.host.searchType
|
|
1215
|
+
this.host.searchType
|
|
1205
1216
|
);
|
|
1206
1217
|
|
|
1207
1218
|
return (searchResponse?.success?.response?.aggregations?.[
|
|
@@ -1229,7 +1240,7 @@ export class CollectionBrowserDataSource
|
|
|
1229
1240
|
acc[(bucket.key as string).toUpperCase()] = bucket.doc_count;
|
|
1230
1241
|
return acc;
|
|
1231
1242
|
},
|
|
1232
|
-
{}
|
|
1243
|
+
{}
|
|
1233
1244
|
);
|
|
1234
1245
|
|
|
1235
1246
|
this.requestHostUpdate();
|
|
@@ -38,6 +38,7 @@ export interface CollectionBrowserSearchInterface
|
|
|
38
38
|
readonly defaultSortField: SortField | null;
|
|
39
39
|
readonly facetLoadStrategy: FacetLoadStrategy;
|
|
40
40
|
readonly initialPageNumber: number;
|
|
41
|
+
readonly maxPagesToManage: number;
|
|
41
42
|
readonly currentVisiblePageNumbers: number[];
|
|
42
43
|
readonly clearResultsOnEmptyQuery?: boolean;
|
|
43
44
|
readonly dataSource?: CollectionBrowserDataSourceInterface;
|
package/src/empty-placeholder.ts
CHANGED
|
@@ -23,38 +23,35 @@ export type PlaceholderType =
|
|
|
23
23
|
@customElement('empty-placeholder')
|
|
24
24
|
export class EmptyPlaceholder extends LitElement {
|
|
25
25
|
private static readonly MESSAGE_EMPTY_QUERY = msg(
|
|
26
|
-
'To begin searching, enter a search term in the box above and hit "Go".'
|
|
26
|
+
'To begin searching, enter a search term in the box above and hit "Go".'
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
private static readonly MESSAGE_NO_SEARCH_RESULTS = msg(
|
|
30
30
|
'Your search did not match any items in the Archive. ' +
|
|
31
|
-
'Try different keywords or a more general search.'
|
|
31
|
+
'Try different keywords or a more general search.'
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
private static readonly MESSAGE_NO_COLLECTION_RESULTS = msg(
|
|
35
35
|
'Your search did not match any items in this collection. ' +
|
|
36
|
-
'Try different keywords or a more general search.'
|
|
36
|
+
'Try different keywords or a more general search.'
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
private static readonly MESSAGE_NO_VIEWABLE_MEMBERS = msg(
|
|
40
|
-
'This collection contains no viewable items.'
|
|
40
|
+
'This collection contains no viewable items.'
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
private static readonly MESSAGE_QUERY_ERROR = msg(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
If the problem persists, please let us know at
|
|
56
|
-
<a href="mailto:info@archive.org">info@archive.org</a>.`,
|
|
57
|
-
);
|
|
43
|
+
private static readonly MESSAGE_QUERY_ERROR = msg(html`The search engine
|
|
44
|
+
encountered an error, which might be related to your search query.
|
|
45
|
+
<a
|
|
46
|
+
href="https://help.archive.org/help/search-building-powerful-complex-queries/"
|
|
47
|
+
>
|
|
48
|
+
Tips for constructing search queries.
|
|
49
|
+
</a> `);
|
|
50
|
+
|
|
51
|
+
private static readonly MESSAGE_COLLECTION_ERROR = msg(html`The search engine
|
|
52
|
+
encountered an error while loading this collection. If the problem persists,
|
|
53
|
+
please let us know at
|
|
54
|
+
<a href="mailto:info@archive.org">info@archive.org</a>.`);
|
|
58
55
|
|
|
59
56
|
private static readonly QUERY_ERROR_DETAILS_MESSAGE = msg('Error details:');
|
|
60
57
|
|