@internetarchive/collection-browser 2.7.13 → 2.7.14
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/.github/workflows/gh-pages-main.yml +2 -2
- package/.github/workflows/pr-preview.yml +2 -2
- package/.prettierignore +1 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +1 -1
- package/dist/src/app-root.js +4 -4
- 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.js +1 -2
- 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 +2 -4
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +1 -0
- 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 +1 -4
- 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 +2 -3
- package/dist/src/collection-facets.js.map +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.js +8 -9
- package/dist/src/data-source/collection-browser-data-source.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 +10 -11
- 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.js +16 -16
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/mediatype/mediatype-config.js +1 -0
- package/dist/src/mediatype/mediatype-config.js.map +1 -1
- package/dist/src/models.d.ts +15 -15
- package/dist/src/models.js +3 -3
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +0 -1
- 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 +1 -2
- 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 +2 -3
- 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 +3 -1
- 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 +4 -6
- 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 +0 -1
- 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 +1 -3
- 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 +4 -3
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +4 -1
- 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 +0 -1
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +0 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +12 -3
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +4 -4
- 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 +0 -1
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +4 -3
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +0 -1
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +0 -1
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +0 -1
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +2 -3
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +0 -1
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- 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 +0 -1
- 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 +0 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +0 -1
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +0 -1
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +22 -23
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +0 -1
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +0 -1
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +0 -1
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +0 -1
- 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 +0 -1
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +0 -1
- 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/eslint.config.mjs +53 -0
- package/index.html +0 -3
- package/package.json +41 -39
- package/src/app-root.ts +21 -22
- package/src/collection-browser.ts +36 -38
- 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 +37 -34
- 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 +125 -124
- 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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import {
|
|
3
2
|
html,
|
|
4
3
|
css,
|
|
@@ -220,11 +219,10 @@ export class CollectionBrowser
|
|
|
220
219
|
@property({ type: String }) pageContext: CollectionBrowserContext = 'search';
|
|
221
220
|
|
|
222
221
|
@property({ type: Object })
|
|
223
|
-
restorationStateHandler: RestorationStateHandlerInterface =
|
|
224
|
-
{
|
|
222
|
+
restorationStateHandler: RestorationStateHandlerInterface =
|
|
223
|
+
new RestorationStateHandler({
|
|
225
224
|
context: this.pageContext,
|
|
226
|
-
}
|
|
227
|
-
);
|
|
225
|
+
});
|
|
228
226
|
|
|
229
227
|
@property({ type: Number }) mobileBreakpoint = 600;
|
|
230
228
|
|
|
@@ -394,7 +392,7 @@ export class CollectionBrowser
|
|
|
394
392
|
|
|
395
393
|
sessionStorage?.setItem('cb-session', newSessionId);
|
|
396
394
|
return newSessionId;
|
|
397
|
-
} catch
|
|
395
|
+
} catch {
|
|
398
396
|
// Either we can't generate the hash or we're restricted from accessing sessionStorage
|
|
399
397
|
return '';
|
|
400
398
|
}
|
|
@@ -815,13 +813,13 @@ export class CollectionBrowser
|
|
|
815
813
|
*/
|
|
816
814
|
private handleRemoveItems(): void {
|
|
817
815
|
this.dispatchEvent(
|
|
818
|
-
new CustomEvent<{ items:
|
|
816
|
+
new CustomEvent<{ items: string[] }>('itemRemovalRequested', {
|
|
819
817
|
detail: {
|
|
820
818
|
items: this.dataSource.checkedTileModels.map(model =>
|
|
821
|
-
model?.identifier ? model.identifier : ''
|
|
819
|
+
model?.identifier ? model.identifier : '',
|
|
822
820
|
),
|
|
823
821
|
},
|
|
824
|
-
})
|
|
822
|
+
}),
|
|
825
823
|
);
|
|
826
824
|
}
|
|
827
825
|
|
|
@@ -830,13 +828,13 @@ export class CollectionBrowser
|
|
|
830
828
|
*/
|
|
831
829
|
private handleManageItems(): void {
|
|
832
830
|
this.dispatchEvent(
|
|
833
|
-
new CustomEvent<{ items:
|
|
831
|
+
new CustomEvent<{ items: string[] }>('itemManagerRequested', {
|
|
834
832
|
detail: {
|
|
835
833
|
items: this.dataSource.checkedTileModels.map(model =>
|
|
836
|
-
model?.identifier ? model.identifier : ''
|
|
834
|
+
model?.identifier ? model.identifier : '',
|
|
837
835
|
),
|
|
838
836
|
},
|
|
839
|
-
})
|
|
837
|
+
}),
|
|
840
838
|
);
|
|
841
839
|
}
|
|
842
840
|
|
|
@@ -869,7 +867,7 @@ export class CollectionBrowser
|
|
|
869
867
|
e: CustomEvent<{
|
|
870
868
|
selectedSort: SortField;
|
|
871
869
|
sortDirection: SortDirection | null;
|
|
872
|
-
}
|
|
870
|
+
}>,
|
|
873
871
|
) {
|
|
874
872
|
const { selectedSort, sortDirection } = e.detail;
|
|
875
873
|
this.selectedSort = selectedSort;
|
|
@@ -943,7 +941,7 @@ export class CollectionBrowser
|
|
|
943
941
|
* Handler for when the display mode option is changed (grid/list/compact-list views).
|
|
944
942
|
*/
|
|
945
943
|
private displayModeChanged(
|
|
946
|
-
e: CustomEvent<{ displayMode?: CollectionDisplayMode }
|
|
944
|
+
e: CustomEvent<{ displayMode?: CollectionDisplayMode }>,
|
|
947
945
|
): void {
|
|
948
946
|
this.displayMode = e.detail.displayMode;
|
|
949
947
|
|
|
@@ -1000,7 +998,7 @@ export class CollectionBrowser
|
|
|
1000
998
|
* labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
|
|
1001
999
|
*/
|
|
1002
1000
|
private sendFilterByCreatorAnalytics(
|
|
1003
|
-
prevSelectedLetter: string | null
|
|
1001
|
+
prevSelectedLetter: string | null,
|
|
1004
1002
|
): void {
|
|
1005
1003
|
if (!prevSelectedLetter && !this.selectedCreatorFilter) {
|
|
1006
1004
|
return;
|
|
@@ -1020,7 +1018,7 @@ export class CollectionBrowser
|
|
|
1020
1018
|
* Handler for changes to which letter is selected in the title alphabet bar.
|
|
1021
1019
|
*/
|
|
1022
1020
|
private titleLetterSelected(
|
|
1023
|
-
e: CustomEvent<{ selectedLetter: string | null }
|
|
1021
|
+
e: CustomEvent<{ selectedLetter: string | null }>,
|
|
1024
1022
|
): void {
|
|
1025
1023
|
this.selectedCreatorFilter = null;
|
|
1026
1024
|
this.selectedTitleFilter = e.detail.selectedLetter;
|
|
@@ -1030,7 +1028,7 @@ export class CollectionBrowser
|
|
|
1030
1028
|
* Handler for changes to which letter is selected in the creator alphabet bar.
|
|
1031
1029
|
*/
|
|
1032
1030
|
private creatorLetterSelected(
|
|
1033
|
-
e: CustomEvent<{ selectedLetter: string | null }
|
|
1031
|
+
e: CustomEvent<{ selectedLetter: string | null }>,
|
|
1034
1032
|
): void {
|
|
1035
1033
|
this.selectedTitleFilter = null;
|
|
1036
1034
|
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
@@ -1151,7 +1149,7 @@ export class CollectionBrowser
|
|
|
1151
1149
|
* @param mobile Whether to style/shorten the button for mobile view
|
|
1152
1150
|
*/
|
|
1153
1151
|
private clearFiltersBtnTemplate(
|
|
1154
|
-
mobile: boolean
|
|
1152
|
+
mobile: boolean,
|
|
1155
1153
|
): TemplateResult | typeof nothing {
|
|
1156
1154
|
if (!this.hasActiveFilters) return nothing;
|
|
1157
1155
|
|
|
@@ -1200,7 +1198,7 @@ export class CollectionBrowser
|
|
|
1200
1198
|
e: CustomEvent<{
|
|
1201
1199
|
minDate: string;
|
|
1202
1200
|
maxDate: string;
|
|
1203
|
-
}
|
|
1201
|
+
}>,
|
|
1204
1202
|
) {
|
|
1205
1203
|
const { minDate, maxDate } = e.detail;
|
|
1206
1204
|
[this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
|
|
@@ -1230,7 +1228,7 @@ export class CollectionBrowser
|
|
|
1230
1228
|
this.dispatchEvent(
|
|
1231
1229
|
new CustomEvent<boolean>('manageModeChanged', {
|
|
1232
1230
|
detail: this.isManageView,
|
|
1233
|
-
})
|
|
1231
|
+
}),
|
|
1234
1232
|
);
|
|
1235
1233
|
}
|
|
1236
1234
|
|
|
@@ -1249,7 +1247,7 @@ export class CollectionBrowser
|
|
|
1249
1247
|
*/
|
|
1250
1248
|
async installDataSourceAndQueryState(
|
|
1251
1249
|
dataSource: CollectionBrowserDataSourceInterface,
|
|
1252
|
-
queryState: CollectionBrowserQueryState
|
|
1250
|
+
queryState: CollectionBrowserQueryState,
|
|
1253
1251
|
): Promise<void> {
|
|
1254
1252
|
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
1255
1253
|
if (this.dataSource) this.removeController(this.dataSource);
|
|
@@ -1408,12 +1406,12 @@ export class CollectionBrowser
|
|
|
1408
1406
|
|
|
1409
1407
|
if (changed.has('selectedTitleFilter')) {
|
|
1410
1408
|
this.sendFilterByTitleAnalytics(
|
|
1411
|
-
changed.get('selectedTitleFilter') as string
|
|
1409
|
+
changed.get('selectedTitleFilter') as string,
|
|
1412
1410
|
);
|
|
1413
1411
|
}
|
|
1414
1412
|
if (changed.has('selectedCreatorFilter')) {
|
|
1415
1413
|
this.sendFilterByCreatorAnalytics(
|
|
1416
|
-
changed.get('selectedCreatorFilter') as string
|
|
1414
|
+
changed.get('selectedCreatorFilter') as string,
|
|
1417
1415
|
);
|
|
1418
1416
|
}
|
|
1419
1417
|
|
|
@@ -1468,7 +1466,7 @@ export class CollectionBrowser
|
|
|
1468
1466
|
|
|
1469
1467
|
if (changed.has('resizeObserver')) {
|
|
1470
1468
|
const oldObserver = changed.get(
|
|
1471
|
-
'resizeObserver'
|
|
1469
|
+
'resizeObserver',
|
|
1472
1470
|
) as SharedResizeObserverInterface;
|
|
1473
1471
|
if (oldObserver) this.disconnectResizeObserver(oldObserver);
|
|
1474
1472
|
this.setupResizeObserver();
|
|
@@ -1525,7 +1523,7 @@ export class CollectionBrowser
|
|
|
1525
1523
|
this.setTileCount(
|
|
1526
1524
|
this.dataSource.endOfDataReached
|
|
1527
1525
|
? this.dataSource.size
|
|
1528
|
-
: this.estimatedTileCount
|
|
1526
|
+
: this.estimatedTileCount,
|
|
1529
1527
|
);
|
|
1530
1528
|
}
|
|
1531
1529
|
}
|
|
@@ -1546,7 +1544,7 @@ export class CollectionBrowser
|
|
|
1546
1544
|
// In desktop view, we are always ready to load facets *unless* we are using one of the
|
|
1547
1545
|
// `opt-in` strategies and have not opted in (whether by login or UI interaction).
|
|
1548
1546
|
const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(
|
|
1549
|
-
this.facetLoadStrategy
|
|
1547
|
+
this.facetLoadStrategy,
|
|
1550
1548
|
);
|
|
1551
1549
|
const desktopFacetsReady =
|
|
1552
1550
|
!this.mobileView && (!usingOptInStrategy || optedIn);
|
|
@@ -1556,7 +1554,7 @@ export class CollectionBrowser
|
|
|
1556
1554
|
const mobileFacetsReady = this.mobileView && optedIn;
|
|
1557
1555
|
|
|
1558
1556
|
this.dataSource.handleFacetReadinessChange(
|
|
1559
|
-
desktopFacetsReady || mobileFacetsReady
|
|
1557
|
+
desktopFacetsReady || mobileFacetsReady,
|
|
1560
1558
|
);
|
|
1561
1559
|
}
|
|
1562
1560
|
|
|
@@ -1569,14 +1567,14 @@ export class CollectionBrowser
|
|
|
1569
1567
|
// match the _available_ viewport height. This should generally be more
|
|
1570
1568
|
// performant than listening to scroll events on the page or column.
|
|
1571
1569
|
const leftColumnSentinel = this.shadowRoot?.querySelector(
|
|
1572
|
-
'#left-column-scroll-sentinel'
|
|
1570
|
+
'#left-column-scroll-sentinel',
|
|
1573
1571
|
);
|
|
1574
1572
|
if (leftColumnSentinel) {
|
|
1575
1573
|
this.leftColIntersectionObserver = new IntersectionObserver(
|
|
1576
1574
|
this.updateLeftColumnHeight,
|
|
1577
1575
|
{
|
|
1578
1576
|
threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
|
|
1579
|
-
}
|
|
1577
|
+
},
|
|
1580
1578
|
);
|
|
1581
1579
|
this.leftColIntersectionObserver.observe(leftColumnSentinel);
|
|
1582
1580
|
}
|
|
@@ -1593,11 +1591,11 @@ export class CollectionBrowser
|
|
|
1593
1591
|
*/
|
|
1594
1592
|
private setupFacetsScrollListeners(): void {
|
|
1595
1593
|
const facetsSentinel = this.shadowRoot?.querySelector(
|
|
1596
|
-
'#facets-scroll-sentinel'
|
|
1594
|
+
'#facets-scroll-sentinel',
|
|
1597
1595
|
);
|
|
1598
1596
|
if (facetsSentinel) {
|
|
1599
1597
|
this.facetsIntersectionObserver = new IntersectionObserver(
|
|
1600
|
-
this.updateFacetFadeOut
|
|
1598
|
+
this.updateFacetFadeOut,
|
|
1601
1599
|
);
|
|
1602
1600
|
this.facetsIntersectionObserver.observe(facetsSentinel);
|
|
1603
1601
|
}
|
|
@@ -1642,7 +1640,7 @@ export class CollectionBrowser
|
|
|
1642
1640
|
detail: {
|
|
1643
1641
|
baseQuery: this.baseQuery,
|
|
1644
1642
|
},
|
|
1645
|
-
})
|
|
1643
|
+
}),
|
|
1646
1644
|
);
|
|
1647
1645
|
}
|
|
1648
1646
|
|
|
@@ -1654,7 +1652,7 @@ export class CollectionBrowser
|
|
|
1654
1652
|
this.dispatchEvent(
|
|
1655
1653
|
new CustomEvent<SearchType>('searchTypeChanged', {
|
|
1656
1654
|
detail: this.searchType,
|
|
1657
|
-
})
|
|
1655
|
+
}),
|
|
1658
1656
|
);
|
|
1659
1657
|
}
|
|
1660
1658
|
|
|
@@ -1679,7 +1677,7 @@ export class CollectionBrowser
|
|
|
1679
1677
|
selectedTitleFilter: this.selectedTitleFilter,
|
|
1680
1678
|
selectedCreatorFilter: this.selectedCreatorFilter,
|
|
1681
1679
|
},
|
|
1682
|
-
})
|
|
1680
|
+
}),
|
|
1683
1681
|
);
|
|
1684
1682
|
}
|
|
1685
1683
|
|
|
@@ -1692,7 +1690,7 @@ export class CollectionBrowser
|
|
|
1692
1690
|
}
|
|
1693
1691
|
|
|
1694
1692
|
private disconnectResizeObserver(
|
|
1695
|
-
resizeObserver: SharedResizeObserverInterface
|
|
1693
|
+
resizeObserver: SharedResizeObserverInterface,
|
|
1696
1694
|
) {
|
|
1697
1695
|
resizeObserver.removeObserver({
|
|
1698
1696
|
target: this.contentContainer,
|
|
@@ -1716,7 +1714,7 @@ export class CollectionBrowser
|
|
|
1716
1714
|
* @returns
|
|
1717
1715
|
*/
|
|
1718
1716
|
private visibleCellsChanged(
|
|
1719
|
-
e: CustomEvent<{ visibleCellIndices: number[] }
|
|
1717
|
+
e: CustomEvent<{ visibleCellIndices: number[] }>,
|
|
1720
1718
|
) {
|
|
1721
1719
|
if (this.isScrollingToCell) return;
|
|
1722
1720
|
const { visibleCellIndices } = e.detail;
|
|
@@ -1864,7 +1862,7 @@ export class CollectionBrowser
|
|
|
1864
1862
|
};
|
|
1865
1863
|
this.restorationStateHandler.persistState(
|
|
1866
1864
|
restorationState,
|
|
1867
|
-
this.dataSourceInstallInProgress
|
|
1865
|
+
this.dataSourceInstallInProgress,
|
|
1868
1866
|
);
|
|
1869
1867
|
}
|
|
1870
1868
|
|
|
@@ -1878,7 +1876,7 @@ export class CollectionBrowser
|
|
|
1878
1876
|
detail: {
|
|
1879
1877
|
loading: this.searchResultsLoading,
|
|
1880
1878
|
},
|
|
1881
|
-
})
|
|
1879
|
+
}),
|
|
1882
1880
|
);
|
|
1883
1881
|
}
|
|
1884
1882
|
|
|
@@ -44,12 +44,13 @@ export class FacetsTemplate extends LitElement {
|
|
|
44
44
|
${repeat(
|
|
45
45
|
facetBuckets,
|
|
46
46
|
bucket => `${facetGroup.key}:${bucket.key}`,
|
|
47
|
-
bucket =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
bucket =>
|
|
48
|
+
html`<facet-row
|
|
49
|
+
.facetType=${facetGroup.key}
|
|
50
|
+
.bucket=${bucket}
|
|
51
|
+
.collectionTitles=${this.collectionTitles}
|
|
52
|
+
@facetClick=${this.facetClicked}
|
|
53
|
+
></facet-row>`,
|
|
53
54
|
)}
|
|
54
55
|
</div>
|
|
55
56
|
`;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable dot-notation */
|
|
2
|
-
/* eslint-disable lit-a11y/click-events-have-key-events */
|
|
3
1
|
import {
|
|
4
2
|
css,
|
|
5
3
|
CSSResultGroup,
|
|
@@ -39,7 +37,7 @@ import type {
|
|
|
39
37
|
CollectionTitles,
|
|
40
38
|
PageSpecifierParams,
|
|
41
39
|
} from '../data-source/models';
|
|
42
|
-
import '@internetarchive/ia-activity-indicator
|
|
40
|
+
import '@internetarchive/ia-activity-indicator';
|
|
43
41
|
import './more-facets-pagination';
|
|
44
42
|
import './facets-template';
|
|
45
43
|
import {
|
|
@@ -247,7 +245,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
247
245
|
const bucketsWithCount =
|
|
248
246
|
selectedFacetGroup?.buckets.map(bucket => {
|
|
249
247
|
const selectedBucket = aggregationFacetGroup.buckets.find(
|
|
250
|
-
b => b.key === bucket.key
|
|
248
|
+
b => b.key === bucket.key,
|
|
251
249
|
);
|
|
252
250
|
return selectedBucket
|
|
253
251
|
? {
|
|
@@ -265,7 +263,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
265
263
|
// Append any additional buckets that were not selected
|
|
266
264
|
aggregationFacetGroup.buckets.forEach(bucket => {
|
|
267
265
|
const existingBucket = selectedFacetGroup?.buckets.find(
|
|
268
|
-
b => b.key === bucket.key
|
|
266
|
+
b => b.key === bucket.key,
|
|
269
267
|
);
|
|
270
268
|
if (existingBucket) return;
|
|
271
269
|
bucketsWithCount.push(bucket);
|
|
@@ -305,7 +303,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
305
303
|
count: data?.count,
|
|
306
304
|
state: data?.state,
|
|
307
305
|
};
|
|
308
|
-
}
|
|
306
|
+
},
|
|
309
307
|
);
|
|
310
308
|
|
|
311
309
|
return {
|
|
@@ -329,7 +327,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
329
327
|
|
|
330
328
|
// Order the facets according to the current sort option
|
|
331
329
|
let sortedBuckets = currentAggregation.getSortedBuckets(
|
|
332
|
-
this.sortedBy
|
|
330
|
+
this.sortedBy,
|
|
333
331
|
) as Bucket[];
|
|
334
332
|
|
|
335
333
|
if (this.facetKey === 'collection') {
|
|
@@ -371,7 +369,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
371
369
|
const firstBucketIndexOnPage = (this.pageNumber - 1) * this.facetsPerPage;
|
|
372
370
|
const truncatedBuckets = facetGroup.buckets.slice(
|
|
373
371
|
firstBucketIndexOnPage,
|
|
374
|
-
firstBucketIndexOnPage + this.facetsPerPage
|
|
372
|
+
firstBucketIndexOnPage + this.facetsPerPage,
|
|
375
373
|
);
|
|
376
374
|
|
|
377
375
|
return {
|
|
@@ -391,7 +389,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
391
389
|
this.unappliedFacetChanges = updateSelectedFacetBucket(
|
|
392
390
|
this.unappliedFacetChanges,
|
|
393
391
|
this.facetKey,
|
|
394
|
-
e.detail.bucket
|
|
392
|
+
e.detail.bucket,
|
|
395
393
|
);
|
|
396
394
|
}
|
|
397
395
|
}}
|
|
@@ -454,7 +452,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
454
452
|
private sortFacetAggregation(facetSortType: AggregationSortType) {
|
|
455
453
|
this.sortedBy = facetSortType;
|
|
456
454
|
this.dispatchEvent(
|
|
457
|
-
new CustomEvent('sortedFacets', { detail: this.sortedBy })
|
|
455
|
+
new CustomEvent('sortedFacets', { detail: this.sortedBy }),
|
|
458
456
|
);
|
|
459
457
|
}
|
|
460
458
|
|
|
@@ -475,11 +473,11 @@ export class MoreFacetsContent extends LitElement {
|
|
|
475
473
|
leftValue=${AggregationSortType.COUNT}
|
|
476
474
|
leftLabel="Count"
|
|
477
475
|
rightValue=${valueFacetSort[this.facetKey]}
|
|
478
|
-
rightLabel=${this.facetGroup?.title}
|
|
476
|
+
.rightLabel=${this.facetGroup?.title}
|
|
479
477
|
side=${defaultSwitchSide}
|
|
480
478
|
@change=${(e: CustomEvent<string>) => {
|
|
481
479
|
this.sortFacetAggregation(
|
|
482
|
-
Number(e.detail) as AggregationSortType
|
|
480
|
+
Number(e.detail) as AggregationSortType,
|
|
483
481
|
);
|
|
484
482
|
}}
|
|
485
483
|
></toggle-switch>`
|
|
@@ -504,7 +502,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
504
502
|
private applySearchFacetsClicked() {
|
|
505
503
|
const mergedSelections = mergeSelectedFacets(
|
|
506
504
|
this.selectedFacets,
|
|
507
|
-
this.unappliedFacetChanges
|
|
505
|
+
this.unappliedFacetChanges,
|
|
508
506
|
);
|
|
509
507
|
|
|
510
508
|
const event = new CustomEvent<SelectedFacets>('facetsChanged', {
|
|
@@ -31,6 +31,7 @@ export class MoreFacetsPagination extends LitElement {
|
|
|
31
31
|
this.observePageCount();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
35
|
override updated(changed: Map<string, any>) {
|
|
35
36
|
if (changed.has('size')) {
|
|
36
37
|
this.observePageCount();
|
|
@@ -175,7 +176,7 @@ export class MoreFacetsPagination extends LitElement {
|
|
|
175
176
|
detail: { page: this.currentPage },
|
|
176
177
|
bubbles: true,
|
|
177
178
|
composed: true,
|
|
178
|
-
})
|
|
179
|
+
}),
|
|
179
180
|
);
|
|
180
181
|
}
|
|
181
182
|
|
|
@@ -219,7 +220,7 @@ export class MoreFacetsPagination extends LitElement {
|
|
|
219
220
|
page =>
|
|
220
221
|
html`${page !== 0
|
|
221
222
|
? this.getPageTemplate(page)
|
|
222
|
-
: this.getEllipsisTemplate}
|
|
223
|
+
: this.getEllipsisTemplate}`,
|
|
223
224
|
)}
|
|
224
225
|
`;
|
|
225
226
|
}
|
|
@@ -16,7 +16,7 @@ export function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {
|
|
|
16
16
|
let result: SmartFacet[] = [...facetsUnnested];
|
|
17
17
|
for (const curFacet of facetsUnnested) {
|
|
18
18
|
result = result.filter(
|
|
19
|
-
sf => curFacet === sf || !smartFacetEquals(curFacet, sf)
|
|
19
|
+
sf => curFacet === sf || !smartFacetEquals(curFacet, sf),
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -30,7 +30,7 @@ export function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {
|
|
|
30
30
|
const subresult: SmartFacet[] = [];
|
|
31
31
|
for (const curFacet of curFacetArray) {
|
|
32
32
|
const existing = result.find(sfa =>
|
|
33
|
-
sfa.find(sf => smartFacetEquals(curFacet, sf))
|
|
33
|
+
sfa.find(sf => smartFacetEquals(curFacet, sf)),
|
|
34
34
|
);
|
|
35
35
|
if (!existing) subresult.push(curFacet);
|
|
36
36
|
}
|
|
@@ -43,7 +43,7 @@ export class QueryKeywordsHeuristic implements SmartQueryHeuristic {
|
|
|
43
43
|
const recommendations: SmartFacet[] = [];
|
|
44
44
|
|
|
45
45
|
for (const [keyword, facets] of Object.entries(
|
|
46
|
-
QueryKeywordsHeuristic.KEYWORDS
|
|
46
|
+
QueryKeywordsHeuristic.KEYWORDS,
|
|
47
47
|
)) {
|
|
48
48
|
if (query.includes(keyword)) {
|
|
49
49
|
recommendations.push(...facets);
|
|
@@ -147,12 +147,12 @@ export class WikidataHeuristic implements SmartQueryHeuristic {
|
|
|
147
147
|
const urlQuery = encodeURIComponent(query);
|
|
148
148
|
|
|
149
149
|
const wikidataResponse = await fetch(
|
|
150
|
-
`https://www.wikidata.org/w/api.php?action=wbsearchentities&search=${urlQuery}&format=json&language=en&uselang=en&origin=*&type=item&limit=5
|
|
150
|
+
`https://www.wikidata.org/w/api.php?action=wbsearchentities&search=${urlQuery}&format=json&language=en&uselang=en&origin=*&type=item&limit=5`,
|
|
151
151
|
);
|
|
152
152
|
const searchResults = await wikidataResponse.json();
|
|
153
153
|
|
|
154
154
|
for (const [keyword, facets] of Object.entries(
|
|
155
|
-
WikidataHeuristic.ENTITIES
|
|
155
|
+
WikidataHeuristic.ENTITIES,
|
|
156
156
|
)) {
|
|
157
157
|
const keywordRegex = new RegExp(`\\b${keyword}\\b`);
|
|
158
158
|
if (keywordRegex.test(searchResults.search[0]?.description)) {
|
|
@@ -171,20 +171,20 @@ export class WikidataHeuristic implements SmartQueryHeuristic {
|
|
|
171
171
|
if (f.displayText) {
|
|
172
172
|
replaced.displayText = replaced.displayText?.replace(
|
|
173
173
|
'__QUERY',
|
|
174
|
-
entityName
|
|
174
|
+
entityName,
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
return replaced;
|
|
179
179
|
}),
|
|
180
|
-
} as SmartFacet
|
|
181
|
-
)
|
|
180
|
+
}) as SmartFacet,
|
|
181
|
+
),
|
|
182
182
|
);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
return recommendations;
|
|
187
|
-
} catch
|
|
187
|
+
} catch {
|
|
188
188
|
return [];
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-continue */
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
css,
|
|
5
3
|
html,
|
|
@@ -68,7 +66,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
68
66
|
this.smartFacets,
|
|
69
67
|
f =>
|
|
70
68
|
`${f[0].label}|${f[0].facets[0].facetType}|${f[0].facets[0].bucketKey}`,
|
|
71
|
-
facet => this.makeSmartFacet(facet)
|
|
69
|
+
facet => this.makeSmartFacet(facet),
|
|
72
70
|
)}
|
|
73
71
|
</div>
|
|
74
72
|
`;
|
|
@@ -190,7 +188,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
190
188
|
key === 'mediatype' &&
|
|
191
189
|
this.selectedFacets &&
|
|
192
190
|
Object.values(this.selectedFacets.mediatype).some(
|
|
193
|
-
bucket => bucket.state !== 'none'
|
|
191
|
+
bucket => bucket.state !== 'none',
|
|
194
192
|
)
|
|
195
193
|
) {
|
|
196
194
|
continue;
|
|
@@ -210,7 +208,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
210
208
|
if (facetType === 'mediatype') {
|
|
211
209
|
facets.push(
|
|
212
210
|
[this.toSmartFacet(facetType, [unusedBuckets[0]])],
|
|
213
|
-
[this.toSmartFacet(facetType, [unusedBuckets[1]])]
|
|
211
|
+
[this.toSmartFacet(facetType, [unusedBuckets[1]])],
|
|
214
212
|
);
|
|
215
213
|
} else if (facetType === 'collection' || facetType === 'subject') {
|
|
216
214
|
const topBuckets = unusedBuckets.slice(0, 5);
|
|
@@ -226,7 +224,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
226
224
|
|
|
227
225
|
private toSmartFacet(
|
|
228
226
|
facetType: FacetOption,
|
|
229
|
-
buckets: Bucket[]
|
|
227
|
+
buckets: Bucket[],
|
|
230
228
|
// prefix = true
|
|
231
229
|
): SmartFacet {
|
|
232
230
|
return {
|
|
@@ -259,7 +257,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
259
257
|
this.selectedFacets,
|
|
260
258
|
facet.facetType,
|
|
261
259
|
facet.bucket,
|
|
262
|
-
true
|
|
260
|
+
true,
|
|
263
261
|
);
|
|
264
262
|
}
|
|
265
263
|
|
|
@@ -286,7 +284,7 @@ export class SmartFacetBar extends LitElement {
|
|
|
286
284
|
this.selectedFacets,
|
|
287
285
|
facet.facetType,
|
|
288
286
|
facet.bucket,
|
|
289
|
-
true
|
|
287
|
+
true,
|
|
290
288
|
);
|
|
291
289
|
}
|
|
292
290
|
|
|
@@ -28,7 +28,9 @@ export class SmartFacetButton extends LitElement {
|
|
|
28
28
|
|
|
29
29
|
const displayText = capitalize(
|
|
30
30
|
(this.labelPrefix ? `${this.labelPrefix} ` : '') +
|
|
31
|
-
(this.facetInfo.label ??
|
|
31
|
+
(this.facetInfo.label ??
|
|
32
|
+
firstFacet.displayText ??
|
|
33
|
+
firstFacet.bucketKey),
|
|
32
34
|
);
|
|
33
35
|
if (!displayText) return nothing;
|
|
34
36
|
|
|
@@ -61,7 +63,7 @@ export class SmartFacetButton extends LitElement {
|
|
|
61
63
|
for (const facet of this.facetInfo.facets) {
|
|
62
64
|
url.searchParams.append(
|
|
63
65
|
'and[]',
|
|
64
|
-
encodeURIComponent(`${facet.facetType}:"${facet.bucketKey}"`)
|
|
66
|
+
encodeURIComponent(`${facet.facetType}:"${facet.bucketKey}"`),
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -88,7 +90,7 @@ export class SmartFacetButton extends LitElement {
|
|
|
88
90
|
negative: false,
|
|
89
91
|
})),
|
|
90
92
|
},
|
|
91
|
-
})
|
|
93
|
+
}),
|
|
92
94
|
);
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -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
|
-
? this.leftLabel ?? this.leftValue
|
|
88
|
-
: this.rightLabel ?? this.rightValue;
|
|
87
|
+
? (this.leftLabel ?? this.leftValue)
|
|
88
|
+
: (this.rightLabel ?? this.rightValue);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
private handleClick(): void {
|