@internetarchive/collection-browser 1.14.17-beta.5 → 1.14.18-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -29
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +12 -11
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +83 -83
- package/dist/src/app-root.js +438 -489
- 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/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +384 -406
- package/dist/src/collection-browser.js +1342 -1363
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +30 -30
- package/dist/src/collection-facets/facet-row.js +114 -114
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +17 -17
- package/dist/src/collection-facets/facets-template.js +114 -114
- package/dist/src/collection-facets/more-facets-content.d.ts +70 -70
- package/dist/src/collection-facets/more-facets-content.js +354 -369
- 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 +196 -196
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
- package/dist/src/collection-facets/toggle-switch.js +94 -94
- package/dist/src/collection-facets.d.ts +103 -103
- package/dist/src/collection-facets.js +513 -510
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +217 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
- package/dist/src/data-source/collection-browser-data-source.d.ts +352 -434
- package/dist/src/data-source/collection-browser-data-source.js +911 -800
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +43 -0
- package/dist/src/data-source/collection-browser-query-state.js +2 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
- package/dist/src/data-source/models.d.ts +28 -62
- package/dist/src/data-source/models.js +8 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +23 -23
- package/dist/src/empty-placeholder.js +74 -74
- package/dist/src/expanded-date-picker.d.ts +43 -43
- package/dist/src/expanded-date-picker.js +109 -109
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/manage/manage-bar.d.ts +26 -26
- package/dist/src/manage/manage-bar.js +53 -53
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +91 -91
- package/dist/src/models.d.ts +197 -180
- package/dist/src/models.js +380 -269
- 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 +355 -355
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
- package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.js +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +210 -210
- package/dist/src/sort-filter-bar/sort-filter-bar.js +653 -652
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- package/dist/src/styles/sr-only.d.ts +1 -1
- package/dist/src/styles/sr-only.js +2 -2
- package/dist/src/tiles/base-tile-component.d.ts +19 -19
- package/dist/src/tiles/base-tile-component.js +63 -63
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
- package/dist/src/tiles/grid/account-tile.d.ts +18 -18
- package/dist/src/tiles/grid/account-tile.js +72 -72
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
- package/dist/src/tiles/grid/collection-tile.js +80 -80
- package/dist/src/tiles/grid/item-tile.d.ts +28 -27
- package/dist/src/tiles/grid/item-tile.js +162 -135
- 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/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 +58 -53
- 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/tile-hover-pane.d.ts +15 -15
- package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +73 -73
- package/dist/src/tiles/item-image.d.ts +39 -36
- package/dist/src/tiles/item-image.js +155 -127
- 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.d.ts +15 -15
- package/dist/src/tiles/list/tile-list-compact.js +115 -115
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +47 -46
- package/dist/src/tiles/list/tile-list.js +327 -296
- 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/overlay/icon-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/icon-overlay.js +40 -40
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/text-overlay.js +42 -42
- package/dist/src/tiles/text-snippet-block.d.ts +27 -27
- package/dist/src/tiles/text-snippet-block.js +73 -73
- package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
- package/dist/src/tiles/tile-dispatcher.js +232 -231
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.d.ts +47 -43
- package/dist/src/tiles/tile-display-value-provider.js +94 -80
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/utils/analytics-events.d.ts +25 -25
- package/dist/src/utils/analytics-events.js +27 -27
- package/dist/src/utils/array-equals.d.ts +4 -4
- package/dist/src/utils/array-equals.js +10 -10
- package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -0
- package/dist/src/utils/collapse-repeated-quotes.js +14 -0
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -0
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +25 -25
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/src/utils/local-date-from-utc.d.ts +9 -9
- package/dist/src/utils/local-date-from-utc.js +15 -15
- package/dist/src/utils/log.d.ts +7 -0
- package/dist/src/utils/log.js +16 -0
- package/dist/src/utils/log.js.map +1 -0
- package/dist/src/utils/resolve-mediatype.d.ts +8 -0
- package/dist/src/utils/resolve-mediatype.js +24 -0
- package/dist/src/utils/resolve-mediatype.js.map +1 -0
- 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 +1211 -1149
- 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 +203 -203
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +105 -105
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +133 -133
- package/dist/test/collection-facets/more-facets-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 +117 -117
- package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +73 -73
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +653 -648
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -0
- package/dist/test/data-source/collection-browser-data-source.test.js +80 -0
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -0
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +63 -63
- package/dist/test/expanded-date-picker.test.d.ts +1 -1
- package/dist/test/expanded-date-picker.test.js +95 -95
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +85 -86
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.d.ts +1 -1
- package/dist/test/manage/manage-bar.test.js +72 -72
- package/dist/test/mediatype-config.test.d.ts +1 -1
- package/dist/test/mediatype-config.test.js +16 -16
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
- package/dist/test/mocks/mock-analytics-handler.js +15 -15
- package/dist/test/mocks/mock-search-responses.d.ts +24 -21
- package/dist/test/mocks/mock-search-responses.js +840 -709
- 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 +53 -50
- 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/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +418 -418
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -48
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +95 -33
- 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 +76 -76
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +73 -73
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +298 -254
- 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 +51 -51
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -258
- 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 +13 -13
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +283 -239
- 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 +106 -94
- 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-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/dist/test/utils/format-unit-size.test.d.ts +1 -1
- package/dist/test/utils/format-unit-size.test.js +17 -17
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
- package/dist/test/utils/local-date-from-utc.test.js +26 -26
- package/index.ts +3 -5
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +3 -4
- package/renovate.json +6 -6
- package/src/app-root.ts +30 -85
- package/src/collection-browser.ts +112 -139
- package/src/collection-facets/more-facets-content.ts +0 -19
- package/src/collection-facets.ts +6 -4
- package/src/data-source/collection-browser-data-source-interface.ts +272 -0
- package/src/data-source/collection-browser-data-source.ts +314 -379
- package/src/data-source/collection-browser-query-state.ts +54 -0
- package/src/data-source/models.ts +8 -45
- package/src/manage/manage-bar.ts +1 -1
- package/src/models.ts +164 -3
- package/src/sort-filter-bar/sort-filter-bar.ts +2 -1
- package/src/tiles/grid/item-tile.ts +36 -1
- package/src/tiles/grid/tile-stats.ts +12 -7
- package/src/tiles/item-image.ts +28 -0
- package/src/tiles/list/tile-list-compact.ts +1 -1
- package/src/tiles/list/tile-list.ts +43 -5
- package/src/tiles/tile-dispatcher.ts +2 -1
- package/src/tiles/tile-display-value-provider.ts +20 -2
- package/src/utils/collapse-repeated-quotes.ts +13 -0
- package/src/utils/log.ts +16 -0
- package/src/utils/resolve-mediatype.ts +26 -0
- package/test/collection-browser.test.ts +161 -50
- package/test/collection-facets/more-facets-content.test.ts +4 -2
- package/test/collection-facets.test.ts +5 -0
- package/test/data-source/collection-browser-data-source.test.ts +103 -0
- package/test/item-image.test.ts +34 -36
- package/test/mocks/mock-search-responses.ts +144 -0
- package/test/mocks/mock-search-service.ts +6 -0
- package/test/tile-stats.test.ts +104 -0
- package/test/tiles/grid/item-tile.test.ts +55 -0
- package/test/tiles/hover/hover-pane-controller.test.ts +19 -17
- package/test/tiles/list/tile-list.test.ts +55 -0
- package/test/tiles/tile-dispatcher.test.ts +13 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/types/sentry.d.ts +0 -1
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
} from '@internetarchive/infinite-scroller';
|
|
19
19
|
import {
|
|
20
20
|
CollectionExtraInfo,
|
|
21
|
+
PageElementName,
|
|
21
22
|
SearchServiceInterface,
|
|
22
23
|
SearchType,
|
|
23
24
|
SortDirection,
|
|
@@ -31,12 +32,6 @@ import '@internetarchive/infinite-scroller';
|
|
|
31
32
|
import type { ModalManagerInterface } from '@internetarchive/modal-manager';
|
|
32
33
|
import type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';
|
|
33
34
|
import type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';
|
|
34
|
-
import './tiles/tile-dispatcher';
|
|
35
|
-
import './tiles/collection-browser-loading-tile';
|
|
36
|
-
import './sort-filter-bar/sort-filter-bar';
|
|
37
|
-
import './manage/manage-bar';
|
|
38
|
-
import './collection-facets';
|
|
39
|
-
import './circular-activity-indicator';
|
|
40
35
|
import {
|
|
41
36
|
SelectedFacets,
|
|
42
37
|
SortField,
|
|
@@ -44,38 +39,42 @@ import {
|
|
|
44
39
|
getDefaultSelectedFacets,
|
|
45
40
|
TileModel,
|
|
46
41
|
CollectionDisplayMode,
|
|
47
|
-
PrefixFilterType,
|
|
48
|
-
PrefixFilterCounts,
|
|
49
42
|
FacetEventDetails,
|
|
50
43
|
sortOptionFromAPIString,
|
|
51
44
|
SORT_OPTIONS,
|
|
45
|
+
defaultProfileElementSorts,
|
|
52
46
|
} from './models';
|
|
53
47
|
import {
|
|
54
48
|
RestorationStateHandlerInterface,
|
|
55
49
|
RestorationStateHandler,
|
|
56
50
|
RestorationState,
|
|
57
51
|
} from './restoration-state-handler';
|
|
58
|
-
import {
|
|
59
|
-
CollectionBrowserDataSource,
|
|
60
|
-
CollectionBrowserDataSourceInterface,
|
|
61
|
-
} from './data-source/collection-browser-data-source';
|
|
52
|
+
import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
|
|
62
53
|
import type {
|
|
63
54
|
CollectionBrowserQueryState,
|
|
64
55
|
CollectionBrowserSearchInterface,
|
|
65
|
-
} from './data-source/
|
|
66
|
-
import
|
|
67
|
-
import type {
|
|
68
|
-
import './
|
|
69
|
-
|
|
56
|
+
} from './data-source/collection-browser-query-state';
|
|
57
|
+
import type { CollectionFacets } from './collection-facets';
|
|
58
|
+
import type { ManageableItem } from './manage/manage-bar';
|
|
59
|
+
import type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';
|
|
70
60
|
import {
|
|
71
61
|
analyticsActions,
|
|
72
62
|
analyticsCategories,
|
|
73
63
|
} from './utils/analytics-events';
|
|
64
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
74
65
|
import { srOnlyStyle } from './styles/sr-only';
|
|
75
66
|
import { sha1 } from './utils/sha1';
|
|
76
|
-
import type { CollectionFacets } from './collection-facets';
|
|
77
|
-
import type { ManageableItem } from './manage/manage-bar';
|
|
78
67
|
import { formatDate } from './utils/format-date';
|
|
68
|
+
import { log } from './utils/log';
|
|
69
|
+
import type { PlaceholderType } from './empty-placeholder';
|
|
70
|
+
|
|
71
|
+
import './empty-placeholder';
|
|
72
|
+
import './tiles/tile-dispatcher';
|
|
73
|
+
import './tiles/collection-browser-loading-tile';
|
|
74
|
+
import './sort-filter-bar/sort-filter-bar';
|
|
75
|
+
import './manage/manage-bar';
|
|
76
|
+
import './collection-facets';
|
|
77
|
+
import './circular-activity-indicator';
|
|
79
78
|
|
|
80
79
|
@customElement('collection-browser')
|
|
81
80
|
export class CollectionBrowser
|
|
@@ -97,7 +96,7 @@ export class CollectionBrowser
|
|
|
97
96
|
|
|
98
97
|
@property({ type: String }) withinProfile?: string;
|
|
99
98
|
|
|
100
|
-
@property({ type: String }) profileElement?:
|
|
99
|
+
@property({ type: String }) profileElement?: PageElementName;
|
|
101
100
|
|
|
102
101
|
@property({ type: String }) baseQuery?: string;
|
|
103
102
|
|
|
@@ -133,6 +132,8 @@ export class CollectionBrowser
|
|
|
133
132
|
|
|
134
133
|
@property({ type: Boolean }) suppressFacets = false;
|
|
135
134
|
|
|
135
|
+
@property({ type: Boolean }) suppressSortBar = false;
|
|
136
|
+
|
|
136
137
|
@property({ type: Boolean }) clearResultsOnEmptyQuery = false;
|
|
137
138
|
|
|
138
139
|
@property({ type: String }) collectionPagePath: string = '/details/';
|
|
@@ -170,8 +171,6 @@ export class CollectionBrowser
|
|
|
170
171
|
|
|
171
172
|
@property({ type: Boolean }) isLoansTab = false;
|
|
172
173
|
|
|
173
|
-
@property({ type: String }) queryErrorMessage?: string;
|
|
174
|
-
|
|
175
174
|
/**
|
|
176
175
|
* The results per page so we can paginate.
|
|
177
176
|
*
|
|
@@ -217,10 +216,6 @@ export class CollectionBrowser
|
|
|
217
216
|
|
|
218
217
|
@state() private placeholderType: PlaceholderType = null;
|
|
219
218
|
|
|
220
|
-
@state() private prefixFilterCountMap: Partial<
|
|
221
|
-
Record<PrefixFilterType, PrefixFilterCounts>
|
|
222
|
-
> = {};
|
|
223
|
-
|
|
224
219
|
@query('#content-container') private contentContainer!: HTMLDivElement;
|
|
225
220
|
|
|
226
221
|
@query('#left-column') private leftColumn?: HTMLDivElement;
|
|
@@ -236,11 +231,6 @@ export class CollectionBrowser
|
|
|
236
231
|
*/
|
|
237
232
|
private isScrollingToCell = false;
|
|
238
233
|
|
|
239
|
-
/**
|
|
240
|
-
* When we've reached the end of the data, stop trying to fetch more
|
|
241
|
-
*/
|
|
242
|
-
private endOfDataReached = false;
|
|
243
|
-
|
|
244
234
|
/**
|
|
245
235
|
* When page width resizes from desktop to mobile, set true to
|
|
246
236
|
* disable expand/collapse transition when loading.
|
|
@@ -253,9 +243,13 @@ export class CollectionBrowser
|
|
|
253
243
|
|
|
254
244
|
private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
255
245
|
|
|
246
|
+
constructor() {
|
|
247
|
+
super();
|
|
248
|
+
this.addController(this.dataSource);
|
|
249
|
+
}
|
|
250
|
+
|
|
256
251
|
private tileModelAtCellIndex(index: number): TileModel | undefined {
|
|
257
|
-
const
|
|
258
|
-
const model = this.dataSource.getTileModelAt(offsetIndex);
|
|
252
|
+
const model = this.dataSource.getTileModelAt(index);
|
|
259
253
|
/**
|
|
260
254
|
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
261
255
|
* automated scroll, fetch the page and just return undefined.
|
|
@@ -263,16 +257,9 @@ export class CollectionBrowser
|
|
|
263
257
|
*
|
|
264
258
|
* We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
|
|
265
259
|
* user may never see.
|
|
266
|
-
*
|
|
267
|
-
* No need to fetch if placeholder is being displayed
|
|
268
260
|
*/
|
|
269
|
-
if (!
|
|
270
|
-
const pageNumber = Math.floor(
|
|
271
|
-
console.warn('****** FETCH PAGE tileModelAtCellIndex', {
|
|
272
|
-
pageNumber,
|
|
273
|
-
offsetIndex,
|
|
274
|
-
pageSize: this.pageSize,
|
|
275
|
-
});
|
|
261
|
+
if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
|
|
262
|
+
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
276
263
|
this.dataSource.fetchPage(pageNumber);
|
|
277
264
|
}
|
|
278
265
|
return model;
|
|
@@ -427,6 +414,7 @@ export class CollectionBrowser
|
|
|
427
414
|
}
|
|
428
415
|
|
|
429
416
|
render() {
|
|
417
|
+
this.setPlaceholderType();
|
|
430
418
|
return html`
|
|
431
419
|
<div
|
|
432
420
|
id="content-container"
|
|
@@ -459,7 +447,7 @@ export class CollectionBrowser
|
|
|
459
447
|
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
460
448
|
}
|
|
461
449
|
|
|
462
|
-
if (this.queryErrorMessage) {
|
|
450
|
+
if (this.dataSource.queryErrorMessage) {
|
|
463
451
|
this.placeholderType =
|
|
464
452
|
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
465
453
|
}
|
|
@@ -471,7 +459,7 @@ export class CollectionBrowser
|
|
|
471
459
|
.placeholderType=${this.placeholderType}
|
|
472
460
|
?isMobileView=${this.mobileView}
|
|
473
461
|
?isCollection=${!!this.withinCollection}
|
|
474
|
-
.detailMessage=${this.queryErrorMessage ?? ''}
|
|
462
|
+
.detailMessage=${this.dataSource.queryErrorMessage ?? ''}
|
|
475
463
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
476
464
|
></empty-placeholder>
|
|
477
465
|
${this.infiniteScrollerTemplate}
|
|
@@ -593,7 +581,6 @@ export class CollectionBrowser
|
|
|
593
581
|
}
|
|
594
582
|
|
|
595
583
|
private get infiniteScrollerTemplate() {
|
|
596
|
-
console.warn('infiniteScrollerTemplate', this.placeholderType);
|
|
597
584
|
return html`<infinite-scroller
|
|
598
585
|
class=${this.infiniteScrollerClasses}
|
|
599
586
|
itemCount=${this.placeholderType ? 0 : nothing}
|
|
@@ -615,7 +602,9 @@ export class CollectionBrowser
|
|
|
615
602
|
});
|
|
616
603
|
}
|
|
617
604
|
|
|
618
|
-
private get sortFilterBarTemplate() {
|
|
605
|
+
private get sortFilterBarTemplate(): TemplateResult | typeof nothing {
|
|
606
|
+
if (this.suppressSortBar) return nothing;
|
|
607
|
+
|
|
619
608
|
return html`
|
|
620
609
|
<sort-filter-bar
|
|
621
610
|
.defaultSortField=${this.defaultSortField}
|
|
@@ -670,10 +659,11 @@ export class CollectionBrowser
|
|
|
670
659
|
this.dispatchEvent(
|
|
671
660
|
new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {
|
|
672
661
|
detail: {
|
|
673
|
-
items: this.dataSource.checkedTileModels.map(model =>
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
662
|
+
items: this.dataSource.checkedTileModels.map(model => {
|
|
663
|
+
const cloned = model.clone();
|
|
664
|
+
cloned.dateStr = formatDate(model.datePublished, 'long');
|
|
665
|
+
return cloned as ManageableItem;
|
|
666
|
+
}),
|
|
677
667
|
},
|
|
678
668
|
})
|
|
679
669
|
);
|
|
@@ -717,7 +707,7 @@ export class CollectionBrowser
|
|
|
717
707
|
|
|
718
708
|
private selectedSortChanged(): void {
|
|
719
709
|
// Lazy-load the alphabet counts for title/creator sort bar as needed
|
|
720
|
-
this.updatePrefixFiltersForCurrentSort();
|
|
710
|
+
this.dataSource.updatePrefixFiltersForCurrentSort();
|
|
721
711
|
}
|
|
722
712
|
|
|
723
713
|
get sortParam(): SortParam | null {
|
|
@@ -876,7 +866,7 @@ export class CollectionBrowser
|
|
|
876
866
|
@facetsChanged=${this.facetsChanged}
|
|
877
867
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
878
868
|
.collectionPagePath=${this.collectionPagePath}
|
|
879
|
-
.parentCollections=${this.dataSource.parentCollections
|
|
869
|
+
.parentCollections=${this.dataSource.parentCollections}
|
|
880
870
|
.withinCollection=${this.withinCollection}
|
|
881
871
|
.searchService=${this.searchService}
|
|
882
872
|
.featureFeedbackService=${this.featureFeedbackService}
|
|
@@ -997,20 +987,44 @@ export class CollectionBrowser
|
|
|
997
987
|
);
|
|
998
988
|
}
|
|
999
989
|
|
|
990
|
+
async installDataSourceAndQueryState(
|
|
991
|
+
dataSource: CollectionBrowserDataSourceInterface,
|
|
992
|
+
queryState: CollectionBrowserQueryState
|
|
993
|
+
): Promise<void> {
|
|
994
|
+
log('Installing data source & query state in CB:', dataSource, queryState);
|
|
995
|
+
if (this.dataSource) this.removeController(this.dataSource);
|
|
996
|
+
this.dataSource = dataSource;
|
|
997
|
+
this.addController(this.dataSource);
|
|
998
|
+
|
|
999
|
+
this.baseQuery = queryState.baseQuery;
|
|
1000
|
+
this.profileElement = queryState.profileElement;
|
|
1001
|
+
this.searchType = queryState.searchType;
|
|
1002
|
+
this.selectedFacets =
|
|
1003
|
+
queryState.selectedFacets ?? getDefaultSelectedFacets();
|
|
1004
|
+
this.minSelectedDate = queryState.minSelectedDate;
|
|
1005
|
+
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
1006
|
+
this.selectedSort = queryState.selectedSort ?? SortField.default;
|
|
1007
|
+
this.sortDirection = queryState.sortDirection;
|
|
1008
|
+
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
1009
|
+
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
1010
|
+
|
|
1011
|
+
this.requestUpdate();
|
|
1012
|
+
await this.updateComplete;
|
|
1013
|
+
|
|
1014
|
+
if (!this.searchResultsLoading) {
|
|
1015
|
+
this.setTotalResultCount(this.dataSource.totalResults);
|
|
1016
|
+
this.setTileCount(this.dataSource.size);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
this.refreshVisibleResults();
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1000
1022
|
firstUpdated(): void {
|
|
1001
1023
|
this.setupStateRestorationObserver();
|
|
1002
1024
|
this.restoreState();
|
|
1003
1025
|
}
|
|
1004
1026
|
|
|
1005
|
-
willUpdate() {
|
|
1006
|
-
this.setPlaceholderType();
|
|
1007
|
-
console.warn('willUpdate *** ', this.placeholderType);
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
1027
|
updated(changed: PropertyValues) {
|
|
1011
|
-
console.warn('updated *** ', {
|
|
1012
|
-
changed,
|
|
1013
|
-
});
|
|
1014
1028
|
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
1015
1029
|
if (!this.leftColIntersectionObserver) {
|
|
1016
1030
|
this.setupLeftColumnScrollListeners();
|
|
@@ -1025,8 +1039,7 @@ export class CollectionBrowser
|
|
|
1025
1039
|
changed.has('displayMode') ||
|
|
1026
1040
|
changed.has('baseNavigationUrl') ||
|
|
1027
1041
|
changed.has('baseImageUrl') ||
|
|
1028
|
-
changed.has('loggedIn')
|
|
1029
|
-
(changed.has('baseQuery') && !this.baseQuery)
|
|
1042
|
+
changed.has('loggedIn')
|
|
1030
1043
|
) {
|
|
1031
1044
|
this.infiniteScroller?.reload();
|
|
1032
1045
|
}
|
|
@@ -1064,6 +1077,10 @@ export class CollectionBrowser
|
|
|
1064
1077
|
}
|
|
1065
1078
|
}
|
|
1066
1079
|
|
|
1080
|
+
if (changed.has('profileElement')) {
|
|
1081
|
+
this.applyDefaultProfileSort();
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1067
1084
|
if (changed.has('baseQuery')) {
|
|
1068
1085
|
this.emitBaseQueryChanged();
|
|
1069
1086
|
}
|
|
@@ -1081,9 +1098,11 @@ export class CollectionBrowser
|
|
|
1081
1098
|
changed.has('maxSelectedDate') ||
|
|
1082
1099
|
changed.has('selectedFacets') ||
|
|
1083
1100
|
changed.has('searchService') ||
|
|
1084
|
-
changed.has('withinCollection')
|
|
1101
|
+
changed.has('withinCollection') ||
|
|
1102
|
+
changed.has('withinProfile') ||
|
|
1103
|
+
changed.has('profileElement')
|
|
1085
1104
|
) {
|
|
1086
|
-
this.refreshLetterCounts();
|
|
1105
|
+
this.dataSource.refreshLetterCounts();
|
|
1087
1106
|
}
|
|
1088
1107
|
|
|
1089
1108
|
if (changed.has('selectedSort') || changed.has('sortDirection')) {
|
|
@@ -1135,7 +1154,7 @@ export class CollectionBrowser
|
|
|
1135
1154
|
}
|
|
1136
1155
|
|
|
1137
1156
|
if (changed.has('pagesToRender')) {
|
|
1138
|
-
if (!this.endOfDataReached && this.infiniteScroller) {
|
|
1157
|
+
if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
|
|
1139
1158
|
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1140
1159
|
}
|
|
1141
1160
|
}
|
|
@@ -1271,7 +1290,7 @@ export class CollectionBrowser
|
|
|
1271
1290
|
);
|
|
1272
1291
|
}
|
|
1273
1292
|
|
|
1274
|
-
|
|
1293
|
+
emitQueryStateChanged() {
|
|
1275
1294
|
this.dispatchEvent(
|
|
1276
1295
|
new CustomEvent<CollectionBrowserQueryState>('queryStateChanged', {
|
|
1277
1296
|
detail: {
|
|
@@ -1350,19 +1369,6 @@ export class CollectionBrowser
|
|
|
1350
1369
|
// this lets us store the query key so we know if it's actually changed or not
|
|
1351
1370
|
private previousQueryKey?: string;
|
|
1352
1371
|
|
|
1353
|
-
/**
|
|
1354
|
-
* Internal property to store the `resolve` function for the most recent
|
|
1355
|
-
* `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.
|
|
1356
|
-
*/
|
|
1357
|
-
private _initialSearchCompleteResolver!: (val: boolean) => void;
|
|
1358
|
-
|
|
1359
|
-
/**
|
|
1360
|
-
* Internal property to store the private value backing the `initialSearchComplete` getter.
|
|
1361
|
-
*/
|
|
1362
|
-
private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {
|
|
1363
|
-
this._initialSearchCompleteResolver = res;
|
|
1364
|
-
});
|
|
1365
|
-
|
|
1366
1372
|
/**
|
|
1367
1373
|
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
1368
1374
|
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
@@ -1371,15 +1377,10 @@ export class CollectionBrowser
|
|
|
1371
1377
|
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
1372
1378
|
*/
|
|
1373
1379
|
get initialSearchComplete(): Promise<boolean> {
|
|
1374
|
-
return this.
|
|
1380
|
+
return this.dataSource.initialSearchComplete;
|
|
1375
1381
|
}
|
|
1376
1382
|
|
|
1377
1383
|
private async handleQueryChange() {
|
|
1378
|
-
console.log('CB: handling query change', {
|
|
1379
|
-
previousQueryKey: this.previousQueryKey,
|
|
1380
|
-
ds_pageFetchQueryKey: this.dataSource.pageFetchQueryKey,
|
|
1381
|
-
ds_canPerformSearch: this.dataSource.canPerformSearch,
|
|
1382
|
-
});
|
|
1383
1384
|
// only reset if the query has actually changed
|
|
1384
1385
|
if (
|
|
1385
1386
|
!this.searchService ||
|
|
@@ -1394,21 +1395,15 @@ export class CollectionBrowser
|
|
|
1394
1395
|
)
|
|
1395
1396
|
return;
|
|
1396
1397
|
|
|
1397
|
-
console.log('CB will reset', {
|
|
1398
|
-
baseQuery: this.baseQuery,
|
|
1399
|
-
selectedFacets: JSON.stringify(this.selectedFacets),
|
|
1400
|
-
});
|
|
1401
1398
|
this.previousQueryKey = this.dataSource.pageFetchQueryKey;
|
|
1402
|
-
this.emitQueryStateChanged();
|
|
1399
|
+
// this.emitQueryStateChanged();
|
|
1403
1400
|
|
|
1404
1401
|
this.tileModelOffset = 0;
|
|
1405
1402
|
this.totalResults = undefined;
|
|
1406
|
-
this.endOfDataReached = false;
|
|
1407
1403
|
this.pagesToRender =
|
|
1408
1404
|
this.initialPageNumber === 1
|
|
1409
1405
|
? 2 // First two pages are batched into one request when starting from page 1
|
|
1410
1406
|
: this.initialPageNumber;
|
|
1411
|
-
this.queryErrorMessage = undefined;
|
|
1412
1407
|
|
|
1413
1408
|
// Reset the infinite scroller's item count, so that it
|
|
1414
1409
|
// shows tile placeholders until the new query's results load in
|
|
@@ -1434,16 +1429,8 @@ export class CollectionBrowser
|
|
|
1434
1429
|
}
|
|
1435
1430
|
this.historyPopOccurred = false;
|
|
1436
1431
|
|
|
1437
|
-
// Reset the `initialSearchComplete` promise with a new value for the imminent search
|
|
1438
|
-
this._initialSearchCompletePromise = new Promise(res => {
|
|
1439
|
-
this._initialSearchCompleteResolver = res;
|
|
1440
|
-
});
|
|
1441
|
-
|
|
1442
1432
|
// Fire the initial page and facets requests
|
|
1443
|
-
await this.dataSource.handleQueryChange();
|
|
1444
|
-
|
|
1445
|
-
// Resolve the `initialSearchComplete` promise for this search
|
|
1446
|
-
this._initialSearchCompleteResolver(true);
|
|
1433
|
+
// await this.dataSource.handleQueryChange();
|
|
1447
1434
|
}
|
|
1448
1435
|
|
|
1449
1436
|
private setupStateRestorationObserver() {
|
|
@@ -1580,7 +1567,7 @@ export class CollectionBrowser
|
|
|
1580
1567
|
* - Date Favorited for fav-* collections
|
|
1581
1568
|
* - Weekly views for all other collections
|
|
1582
1569
|
*/
|
|
1583
|
-
applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo) {
|
|
1570
|
+
applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo): void {
|
|
1584
1571
|
if (this.baseQuery) {
|
|
1585
1572
|
// If there's a query set, then we default to relevance sorting regardless of
|
|
1586
1573
|
// the collection metadata-specified sort.
|
|
@@ -1624,6 +1611,24 @@ export class CollectionBrowser
|
|
|
1624
1611
|
}
|
|
1625
1612
|
}
|
|
1626
1613
|
|
|
1614
|
+
/**
|
|
1615
|
+
* Applies the default sort option for the current profile element
|
|
1616
|
+
*/
|
|
1617
|
+
applyDefaultProfileSort(): void {
|
|
1618
|
+
if (this.profileElement) {
|
|
1619
|
+
const defaultSortField = defaultProfileElementSorts[this.profileElement];
|
|
1620
|
+
this.defaultSortField = defaultSortField ?? SortField.weeklyview;
|
|
1621
|
+
} else {
|
|
1622
|
+
this.defaultSortField = SortField.weeklyview;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
this.defaultSortDirection = 'desc';
|
|
1626
|
+
this.defaultSortParam = {
|
|
1627
|
+
field: this.defaultSortField,
|
|
1628
|
+
direction: this.defaultSortDirection,
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1627
1632
|
/**
|
|
1628
1633
|
* This is useful for determining whether we need to reload the scroller.
|
|
1629
1634
|
*
|
|
@@ -1647,33 +1652,6 @@ export class CollectionBrowser
|
|
|
1647
1652
|
this.infiniteScroller?.refreshAllVisibleCells();
|
|
1648
1653
|
}
|
|
1649
1654
|
|
|
1650
|
-
/**
|
|
1651
|
-
* Fetches and caches the prefix filter counts for the current sort type,
|
|
1652
|
-
* provided it is one that permits prefix filtering. (If not, this does nothing).
|
|
1653
|
-
*/
|
|
1654
|
-
private async updatePrefixFiltersForCurrentSort(): Promise<void> {
|
|
1655
|
-
if (['title', 'creator'].includes(this.selectedSort)) {
|
|
1656
|
-
const filterType = this.selectedSort as PrefixFilterType;
|
|
1657
|
-
if (!this.prefixFilterCountMap[filterType]) {
|
|
1658
|
-
this.dataSource.updatePrefixFilterCounts(filterType);
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1664
|
-
* Clears the cached letter counts for both title and creator, and
|
|
1665
|
-
* fetches a new set of counts for whichever of them is the currently
|
|
1666
|
-
* selected sort option (which may be neither).
|
|
1667
|
-
*
|
|
1668
|
-
* Call this whenever the counts are invalidated (e.g., by a query change).
|
|
1669
|
-
*/
|
|
1670
|
-
private refreshLetterCounts(): void {
|
|
1671
|
-
if (Object.keys(this.prefixFilterCountMap).length > 0) {
|
|
1672
|
-
this.prefixFilterCountMap = {};
|
|
1673
|
-
}
|
|
1674
|
-
this.updatePrefixFiltersForCurrentSort();
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
1655
|
/**
|
|
1678
1656
|
* Callback when a result is selected
|
|
1679
1657
|
*/
|
|
@@ -1682,8 +1660,7 @@ export class CollectionBrowser
|
|
|
1682
1660
|
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
1683
1661
|
// this.mapDataSource(model => ({ ...model }));
|
|
1684
1662
|
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
1685
|
-
if (cellIndex >= 0)
|
|
1686
|
-
this.infiniteScroller?.refreshCell(cellIndex - this.tileModelOffset);
|
|
1663
|
+
if (cellIndex >= 0) this.infiniteScroller?.refreshCell(cellIndex);
|
|
1687
1664
|
}
|
|
1688
1665
|
|
|
1689
1666
|
this.analyticsHandler?.sendEvent({
|
|
@@ -1714,7 +1691,7 @@ export class CollectionBrowser
|
|
|
1714
1691
|
.collectionTitles=${this.dataSource.collectionTitles}
|
|
1715
1692
|
.sortParam=${this.sortParam}
|
|
1716
1693
|
.defaultSortParam=${this.defaultSortParam}
|
|
1717
|
-
.creatorFilter=${this.selectedCreatorFilter
|
|
1694
|
+
.creatorFilter=${this.selectedCreatorFilter}
|
|
1718
1695
|
.mobileBreakpoint=${this.mobileBreakpoint}
|
|
1719
1696
|
.loggedIn=${this.loggedIn}
|
|
1720
1697
|
.isManageView=${this.isManageView}
|
|
@@ -1730,12 +1707,8 @@ export class CollectionBrowser
|
|
|
1730
1707
|
* increase the number of pages to render and start fetching data for the new page
|
|
1731
1708
|
*/
|
|
1732
1709
|
private scrollThresholdReached() {
|
|
1733
|
-
if (!this.endOfDataReached) {
|
|
1710
|
+
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1734
1711
|
this.pagesToRender += 1;
|
|
1735
|
-
console.warn(
|
|
1736
|
-
'****** FETCH PAGE scrollThresholdReached',
|
|
1737
|
-
this.pagesToRender
|
|
1738
|
-
);
|
|
1739
1712
|
this.dataSource.fetchPage(this.pagesToRender);
|
|
1740
1713
|
}
|
|
1741
1714
|
}
|
|
@@ -2058,9 +2031,9 @@ export class CollectionBrowser
|
|
|
2058
2031
|
--collectionBrowserCellMinWidth,
|
|
2059
2032
|
100%
|
|
2060
2033
|
);
|
|
2061
|
-
--infiniteScrollerCellMinHeight:
|
|
2034
|
+
--infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */
|
|
2062
2035
|
--infiniteScrollerCellMaxHeight: 56px;
|
|
2063
|
-
--infiniteScrollerRowGap:
|
|
2036
|
+
--infiniteScrollerRowGap: 10px;
|
|
2064
2037
|
}
|
|
2065
2038
|
|
|
2066
2039
|
infinite-scroller.list-detail {
|
|
@@ -135,12 +135,6 @@ export class MoreFacetsContent extends LitElement {
|
|
|
135
135
|
*/
|
|
136
136
|
async updateSpecificFacets(): Promise<void> {
|
|
137
137
|
const trimmedQuery = this.query?.trim();
|
|
138
|
-
|
|
139
|
-
console.log('updateSpecificFacets', {
|
|
140
|
-
trimmedQuery,
|
|
141
|
-
withinCollection: this.withinCollection,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
138
|
if (!trimmedQuery && !this.withinCollection) return;
|
|
145
139
|
|
|
146
140
|
const aggregations = {
|
|
@@ -164,25 +158,12 @@ export class MoreFacetsContent extends LitElement {
|
|
|
164
158
|
rows: 0, // todo - do we want server-side pagination with offset/page/limit flag?
|
|
165
159
|
};
|
|
166
160
|
|
|
167
|
-
console.log('updateSpecificFacets', {
|
|
168
|
-
params,
|
|
169
|
-
searchType: this.searchType,
|
|
170
|
-
});
|
|
171
|
-
console.log(' *** firing facet call *** ');
|
|
172
|
-
|
|
173
161
|
const results = await this.searchService?.search(params, this.searchType);
|
|
174
162
|
this.aggregations = results?.success?.response.aggregations;
|
|
175
163
|
|
|
176
164
|
this.facetGroup = this.aggregationFacetGroups;
|
|
177
165
|
this.facetsLoading = false;
|
|
178
166
|
|
|
179
|
-
console.log(' *** Returned facet call *** ', {
|
|
180
|
-
results,
|
|
181
|
-
aggregations: this.aggregations,
|
|
182
|
-
facetGroup: this.facetGroup,
|
|
183
|
-
facetsLoading: this.facetsLoading,
|
|
184
|
-
});
|
|
185
|
-
|
|
186
167
|
const collectionTitles = results?.success?.response?.collectionTitles;
|
|
187
168
|
if (collectionTitles) {
|
|
188
169
|
for (const [id, title] of Object.entries(collectionTitles)) {
|
package/src/collection-facets.ts
CHANGED
|
@@ -302,14 +302,16 @@ export class CollectionFacets extends LitElement {
|
|
|
302
302
|
|
|
303
303
|
private get histogramTemplate() {
|
|
304
304
|
const { fullYearsHistogramAggregation } = this;
|
|
305
|
+
const minDate = fullYearsHistogramAggregation?.first_bucket_key;
|
|
306
|
+
const maxDate = fullYearsHistogramAggregation?.last_bucket_key;
|
|
305
307
|
return this.fullYearAggregationLoading
|
|
306
308
|
? html`<div class="histogram-loading-indicator">…</div>` // Ellipsis block
|
|
307
309
|
: html`
|
|
308
310
|
<histogram-date-range
|
|
309
|
-
.minDate=${
|
|
310
|
-
.maxDate=${
|
|
311
|
-
.minSelectedDate=${this.minSelectedDate}
|
|
312
|
-
.maxSelectedDate=${this.maxSelectedDate}
|
|
311
|
+
.minDate=${minDate}
|
|
312
|
+
.maxDate=${maxDate}
|
|
313
|
+
.minSelectedDate=${this.minSelectedDate ?? minDate}
|
|
314
|
+
.maxSelectedDate=${this.maxSelectedDate ?? maxDate}
|
|
313
315
|
.updateDelay=${100}
|
|
314
316
|
missingDataMessage="..."
|
|
315
317
|
.width=${this.collapsableFacets && this.contentWidth
|