@internetarchive/collection-browser 0.4.11 → 0.4.13-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -29
- package/.github/workflows/ci.yml +26 -26
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/app-root.d.ts +50 -50
- package/dist/src/app-root.js +278 -278
- 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/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.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/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 +280 -279
- package/dist/src/collection-browser.js +1178 -1156
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +16 -16
- package/dist/src/collection-facets/facets-template.js +125 -125
- package/dist/src/collection-facets/more-facets-content.d.ts +76 -75
- package/dist/src/collection-facets/more-facets-content.js +354 -377
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +197 -195
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -0
- package/dist/src/collection-facets/toggle-switch.js +184 -0
- package/dist/src/collection-facets/toggle-switch.js.map +1 -0
- package/dist/src/collection-facets.d.ts +81 -81
- package/dist/src/collection-facets.js +376 -385
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +13 -11
- package/dist/src/empty-placeholder.js +80 -44
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +119 -115
- package/dist/src/models.js +136 -125
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +45 -45
- package/dist/src/restoration-state-handler.js +230 -230
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +25 -26
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -20
- 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 +3 -3
- package/dist/src/sort-filter-bar/img/list.js.map +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +15 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +17 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js.map +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js +17 -0
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js.map +1 -0
- 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 +189 -108
- package/dist/src/sort-filter-bar/sort-filter-bar.js +708 -614
- 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/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 +20 -20
- package/dist/src/tiles/grid/account-tile.js +64 -64
- package/dist/src/tiles/grid/collection-tile.d.ts +17 -17
- package/dist/src/tiles/grid/collection-tile.js +71 -71
- package/dist/src/tiles/grid/item-tile.d.ts +32 -32
- package/dist/src/tiles/grid/item-tile.js +130 -126
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +7 -7
- package/dist/src/tiles/grid/tile-stats.d.ts +11 -10
- package/dist/src/tiles/grid/tile-stats.js +44 -40
- 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 +72 -72
- package/dist/src/tiles/item-image.d.ts +35 -35
- package/dist/src/tiles/item-image.js +117 -117
- package/dist/src/tiles/list/account-label.d.ts +1 -1
- package/dist/src/tiles/list/account-label.js +6 -6
- package/dist/src/tiles/list/date-label.d.ts +1 -1
- package/dist/src/tiles/list/date-label.js +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
- package/dist/src/tiles/list/tile-list-compact.d.ts +22 -21
- package/dist/src/tiles/list/tile-list-compact.js +114 -101
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +55 -55
- package/dist/src/tiles/list/tile-list.js +304 -301
- 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 +58 -58
- package/dist/src/tiles/tile-dispatcher.js +194 -194
- package/dist/src/utils/analytics-events.d.ts +22 -22
- package/dist/src/utils/analytics-events.js +24 -24
- 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 +23 -23
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +584 -584
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +62 -62
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +114 -114
- 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 -0
- package/dist/test/collection-facets/toggle-switch.test.js +87 -0
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -0
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +460 -460
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +33 -33
- 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 +84 -84
- 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-collection-name-cache.d.ts +7 -7
- package/dist/test/mocks/mock-collection-name-cache.js +13 -13
- package/dist/test/mocks/mock-search-responses.d.ts +12 -12
- package/dist/test/mocks/mock-search-responses.js +341 -341
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +40 -40
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +125 -125
- 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 +372 -199
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +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 +33 -33
- 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 +158 -158
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
- 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 +104 -92
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +175 -163
- 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 +67 -67
- 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/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +4 -3
- package/renovate.json +6 -6
- package/src/collection-browser.ts +28 -1
- package/src/collection-facets/more-facets-content.ts +25 -48
- package/src/collection-facets/more-facets-pagination.ts +5 -3
- package/src/collection-facets/toggle-switch.ts +184 -0
- package/src/collection-facets.ts +1 -10
- package/src/empty-placeholder.ts +53 -7
- package/src/models.ts +23 -8
- package/src/sort-filter-bar/alpha-bar-tooltip.ts +1 -2
- package/src/sort-filter-bar/img/list.ts +1 -1
- package/src/sort-filter-bar/img/sort-toggle-disabled.ts +15 -0
- package/src/sort-filter-bar/img/sort-toggle-down.ts +17 -0
- package/src/sort-filter-bar/img/sort-toggle-up.ts +17 -0
- package/src/sort-filter-bar/sort-filter-bar.ts +433 -303
- package/src/tiles/grid/item-tile.ts +6 -1
- package/src/tiles/grid/tile-stats.ts +3 -1
- package/src/tiles/list/tile-list-compact.ts +15 -2
- package/src/tiles/list/tile-list.ts +3 -0
- package/test/collection-facets/toggle-switch.test.ts +154 -0
- package/test/sort-filter-bar/sort-filter-bar.test.ts +377 -101
- package/test/tiles/list/tile-list-compact.test.ts +14 -0
- package/test/tiles/list/tile-list.test.ts +14 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,85 +1,76 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/* eslint-disable import/no-duplicates */
|
|
3
|
-
import { css, html, LitElement, nothing, } from 'lit';
|
|
4
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
|
-
import { map } from 'lit/directives/map.js';
|
|
6
|
-
import '@internetarchive/histogram-date-range';
|
|
7
|
-
import '@internetarchive/feature-feedback';
|
|
8
|
-
import '@internetarchive/collection-name-cache';
|
|
9
|
-
import { ModalConfig, } from '@internetarchive/modal-manager';
|
|
10
|
-
import chevronIcon from './assets/img/icons/chevron';
|
|
11
|
-
import { facetDisplayOrder, facetTitles, lendingFacetDisplayNames, lendingFacetKeysVisibility, suppressedCollections, } from './models';
|
|
12
|
-
import './collection-facets/more-facets-content';
|
|
13
|
-
import './collection-facets/facets-template';
|
|
14
|
-
import './collection-facets/facet-tombstone-row';
|
|
15
|
-
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
16
|
-
let CollectionFacets = class CollectionFacets extends LitElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.moreLinksVisible = true;
|
|
20
|
-
this.facetsLoading = false;
|
|
21
|
-
this.fullYearAggregationLoading = false;
|
|
22
|
-
this.collapsableFacets = false;
|
|
23
|
-
this.showHistogramDatePicker = false;
|
|
24
|
-
this.openFacets = {
|
|
25
|
-
subject: false,
|
|
26
|
-
lending: false,
|
|
27
|
-
mediatype: false,
|
|
28
|
-
language: false,
|
|
29
|
-
creator: false,
|
|
30
|
-
collection: false,
|
|
31
|
-
year: false,
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Maximum # of facet buckets to render per facet group
|
|
35
|
-
*/
|
|
36
|
-
this.allowedFacetCount = 6;
|
|
37
|
-
}
|
|
38
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
/* eslint-disable import/no-duplicates */
|
|
3
|
+
import { css, html, LitElement, nothing, } from 'lit';
|
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
|
+
import { map } from 'lit/directives/map.js';
|
|
6
|
+
import '@internetarchive/histogram-date-range';
|
|
7
|
+
import '@internetarchive/feature-feedback';
|
|
8
|
+
import '@internetarchive/collection-name-cache';
|
|
9
|
+
import { ModalConfig, } from '@internetarchive/modal-manager';
|
|
10
|
+
import chevronIcon from './assets/img/icons/chevron';
|
|
11
|
+
import { facetDisplayOrder, facetTitles, lendingFacetDisplayNames, lendingFacetKeysVisibility, suppressedCollections, } from './models';
|
|
12
|
+
import './collection-facets/more-facets-content';
|
|
13
|
+
import './collection-facets/facets-template';
|
|
14
|
+
import './collection-facets/facet-tombstone-row';
|
|
15
|
+
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
16
|
+
let CollectionFacets = class CollectionFacets extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.moreLinksVisible = true;
|
|
20
|
+
this.facetsLoading = false;
|
|
21
|
+
this.fullYearAggregationLoading = false;
|
|
22
|
+
this.collapsableFacets = false;
|
|
23
|
+
this.showHistogramDatePicker = false;
|
|
24
|
+
this.openFacets = {
|
|
25
|
+
subject: false,
|
|
26
|
+
lending: false,
|
|
27
|
+
mediatype: false,
|
|
28
|
+
language: false,
|
|
29
|
+
creator: false,
|
|
30
|
+
collection: false,
|
|
31
|
+
year: false,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Maximum # of facet buckets to render per facet group
|
|
35
|
+
*/
|
|
36
|
+
this.allowedFacetCount = 6;
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
39
|
return html `
|
|
40
40
|
<div id="container" class="${this.facetsLoading ? 'loading' : ''}">
|
|
41
|
-
${this.showHistogramDatePicker &&
|
|
42
|
-
(this.fullYearsHistogramAggregation || this.fullYearAggregationLoading)
|
|
41
|
+
${this.showHistogramDatePicker &&
|
|
42
|
+
(this.fullYearsHistogramAggregation || this.fullYearAggregationLoading)
|
|
43
43
|
? html `
|
|
44
44
|
<div class="facet-group">
|
|
45
|
-
<h1>
|
|
46
|
-
Year Published
|
|
47
|
-
<feature-feedback
|
|
48
|
-
featureIdentifier="HistogramDatePicker"
|
|
49
|
-
prompt="What do you think of the Histogram Date Picker?"
|
|
50
|
-
.featureFeedbackService=${this.featureFeedbackService}
|
|
51
|
-
.resizeObserver=${this.resizeObserver}
|
|
52
|
-
.recaptchaManager=${this.recaptchaManager}
|
|
53
|
-
></feature-feedback>
|
|
54
|
-
</h1>
|
|
45
|
+
<h1>Year Published</h1>
|
|
55
46
|
${this.histogramTemplate}
|
|
56
47
|
</div>
|
|
57
|
-
`
|
|
48
|
+
`
|
|
58
49
|
: nothing}
|
|
59
50
|
${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
|
|
60
51
|
</div>
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
updated(changed) {
|
|
64
|
-
if (changed.has('selectedFacets')) {
|
|
65
|
-
this.dispatchFacetsChangedEvent();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// TODO: want to fire analytics?
|
|
69
|
-
dispatchFacetsChangedEvent() {
|
|
70
|
-
const event = new CustomEvent('facetsChanged', {
|
|
71
|
-
detail: this.selectedFacets,
|
|
72
|
-
});
|
|
73
|
-
this.dispatchEvent(event);
|
|
74
|
-
}
|
|
75
|
-
get currentYearsHistogramAggregation() {
|
|
76
|
-
var _a;
|
|
77
|
-
return (_a = this.aggregations) === null || _a === void 0 ? void 0 : _a.year_histogram;
|
|
78
|
-
}
|
|
79
|
-
get histogramTemplate() {
|
|
80
|
-
const { fullYearsHistogramAggregation } = this;
|
|
81
|
-
return this.fullYearAggregationLoading
|
|
82
|
-
? html `<div class="histogram-loading-indicator">…</div>` // Ellipsis block
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
updated(changed) {
|
|
55
|
+
if (changed.has('selectedFacets')) {
|
|
56
|
+
this.dispatchFacetsChangedEvent();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// TODO: want to fire analytics?
|
|
60
|
+
dispatchFacetsChangedEvent() {
|
|
61
|
+
const event = new CustomEvent('facetsChanged', {
|
|
62
|
+
detail: this.selectedFacets,
|
|
63
|
+
});
|
|
64
|
+
this.dispatchEvent(event);
|
|
65
|
+
}
|
|
66
|
+
get currentYearsHistogramAggregation() {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_a = this.aggregations) === null || _a === void 0 ? void 0 : _a.year_histogram;
|
|
69
|
+
}
|
|
70
|
+
get histogramTemplate() {
|
|
71
|
+
const { fullYearsHistogramAggregation } = this;
|
|
72
|
+
return this.fullYearAggregationLoading
|
|
73
|
+
? html `<div class="histogram-loading-indicator">…</div>` // Ellipsis block
|
|
83
74
|
: html `
|
|
84
75
|
<histogram-date-range
|
|
85
76
|
.minDate=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.first_bucket_key}
|
|
@@ -92,236 +83,236 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
92
83
|
.bins=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.buckets}
|
|
93
84
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
94
85
|
></histogram-date-range>
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
histogramDateRangeUpdated(e) {
|
|
98
|
-
const { minDate, maxDate } = e.detail;
|
|
99
|
-
const event = new CustomEvent('histogramDateRangeUpdated', {
|
|
100
|
-
detail: { minDate, maxDate },
|
|
101
|
-
});
|
|
102
|
-
this.dispatchEvent(event);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Combines the selected facets with the aggregations to create a single list of facets
|
|
106
|
-
*/
|
|
107
|
-
get mergedFacets() {
|
|
108
|
-
const facetGroups = [];
|
|
109
|
-
facetDisplayOrder.forEach(facetKey => {
|
|
110
|
-
var _a, _b;
|
|
111
|
-
const selectedFacetGroup = this.selectedFacetGroups.find(group => group.key === facetKey);
|
|
112
|
-
const aggregateFacetGroup = this.aggregationFacetGroups.find(group => group.key === facetKey);
|
|
113
|
-
// if the user selected a facet, but it's not in the aggregation, we add it as-is
|
|
114
|
-
if (selectedFacetGroup && !aggregateFacetGroup) {
|
|
115
|
-
facetGroups.push(selectedFacetGroup);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
// if we don't have an aggregate facet group, don't add this to the list
|
|
119
|
-
if (!aggregateFacetGroup)
|
|
120
|
-
return;
|
|
121
|
-
// start with either the selected group if we have one, or the aggregate group
|
|
122
|
-
const facetGroup = selectedFacetGroup !== null && selectedFacetGroup !== void 0 ? selectedFacetGroup : aggregateFacetGroup;
|
|
123
|
-
// attach the counts to the selected buckets
|
|
124
|
-
let bucketsWithCount = (_a = selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets.map(bucket => {
|
|
125
|
-
const selectedBucket = aggregateFacetGroup.buckets.find(b => b.key === bucket.key);
|
|
126
|
-
return selectedBucket
|
|
127
|
-
? {
|
|
128
|
-
...bucket,
|
|
129
|
-
count: selectedBucket.count,
|
|
130
|
-
}
|
|
131
|
-
: bucket;
|
|
132
|
-
})) !== null && _a !== void 0 ? _a : [];
|
|
133
|
-
// append any additional buckets that were not selected
|
|
134
|
-
aggregateFacetGroup.buckets.forEach(bucket => {
|
|
135
|
-
const existingBucket = bucketsWithCount.find(b => b.key === bucket.key);
|
|
136
|
-
if (existingBucket)
|
|
137
|
-
return;
|
|
138
|
-
bucketsWithCount.push(bucket);
|
|
139
|
-
});
|
|
140
|
-
// For lending facets, only include a specific subset of buckets
|
|
141
|
-
if (facetKey === 'lending') {
|
|
142
|
-
bucketsWithCount = bucketsWithCount.filter(bucket => lendingFacetKeysVisibility[bucket.key]);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* render limited facet items on page facet area
|
|
146
|
-
*
|
|
147
|
-
* - by-default we are showing 6 items
|
|
148
|
-
* - additionally want to show all items (selected/suppressed) in page facet area
|
|
149
|
-
*/
|
|
150
|
-
let allowedFacetCount = (_b = Object.keys((selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets) || [])) === null || _b === void 0 ? void 0 : _b.length;
|
|
151
|
-
if (allowedFacetCount < this.allowedFacetCount) {
|
|
152
|
-
allowedFacetCount = this.allowedFacetCount; // splice start index from 0th
|
|
153
|
-
}
|
|
154
|
-
// splice how many items we want to show in page facet area
|
|
155
|
-
facetGroup.buckets = bucketsWithCount.splice(0, allowedFacetCount);
|
|
156
|
-
facetGroups.push(facetGroup);
|
|
157
|
-
});
|
|
158
|
-
return facetGroups;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Converts the selected facets to a `FacetGroup` array,
|
|
162
|
-
* which is easier to work with
|
|
163
|
-
*/
|
|
164
|
-
get selectedFacetGroups() {
|
|
165
|
-
if (!this.selectedFacets)
|
|
166
|
-
return [];
|
|
167
|
-
const facetGroups = Object.entries(this.selectedFacets).map(([key, selectedFacets]) => {
|
|
168
|
-
const option = key;
|
|
169
|
-
const title = facetTitles[option];
|
|
170
|
-
const buckets = Object.entries(selectedFacets).map(([value, facetData]) => {
|
|
171
|
-
var _a;
|
|
172
|
-
let displayText = value;
|
|
173
|
-
// for lending facets, convert the key to a readable format
|
|
174
|
-
if (option === 'lending') {
|
|
175
|
-
displayText =
|
|
176
|
-
(_a = lendingFacetDisplayNames[value]) !== null && _a !== void 0 ? _a : value;
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
displayText,
|
|
180
|
-
key: value,
|
|
181
|
-
count: facetData.count,
|
|
182
|
-
state: facetData.state,
|
|
183
|
-
};
|
|
184
|
-
});
|
|
185
|
-
return {
|
|
186
|
-
title,
|
|
187
|
-
key: option,
|
|
188
|
-
buckets,
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
return facetGroups;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Converts the raw `aggregations` to `FacetGroups`, which are easier to use
|
|
195
|
-
*/
|
|
196
|
-
get aggregationFacetGroups() {
|
|
197
|
-
var _a;
|
|
198
|
-
const facetGroups = [];
|
|
199
|
-
Object.entries((_a = this.aggregations) !== null && _a !== void 0 ? _a : []).forEach(([key, buckets]) => {
|
|
200
|
-
// the year_histogram data is in a different format so can't be handled here
|
|
201
|
-
if (key === 'year_histogram')
|
|
202
|
-
return;
|
|
203
|
-
const option = key;
|
|
204
|
-
const title = facetTitles[option];
|
|
205
|
-
if (!title)
|
|
206
|
-
return;
|
|
207
|
-
let castedBuckets = buckets.buckets;
|
|
208
|
-
if (option === 'collection') {
|
|
209
|
-
// we are not showing fav- collections or certain deemphasized collections in facets
|
|
210
|
-
castedBuckets = castedBuckets === null || castedBuckets === void 0 ? void 0 : castedBuckets.filter(bucket => {
|
|
211
|
-
var _a;
|
|
212
|
-
const bucketKey = (_a = bucket === null || bucket === void 0 ? void 0 : bucket.key) === null || _a === void 0 ? void 0 : _a.toString();
|
|
213
|
-
return (!suppressedCollections[bucketKey] && !(bucketKey === null || bucketKey === void 0 ? void 0 : bucketKey.startsWith('fav-')));
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
const facetBuckets = castedBuckets.map(bucket => {
|
|
217
|
-
var _a;
|
|
218
|
-
const bucketKey = bucket.key;
|
|
219
|
-
let displayText = `${bucket.key}`;
|
|
220
|
-
// for lending facets, convert the bucket key to a readable format
|
|
221
|
-
if (option === 'lending') {
|
|
222
|
-
displayText =
|
|
223
|
-
(_a = lendingFacetDisplayNames[bucket.key]) !== null && _a !== void 0 ? _a : `${bucket.key}`;
|
|
224
|
-
}
|
|
225
|
-
return {
|
|
226
|
-
displayText,
|
|
227
|
-
key: `${bucketKey}`,
|
|
228
|
-
count: bucket.doc_count,
|
|
229
|
-
state: 'none',
|
|
230
|
-
};
|
|
231
|
-
});
|
|
232
|
-
const group = {
|
|
233
|
-
title,
|
|
234
|
-
key: option,
|
|
235
|
-
buckets: facetBuckets,
|
|
236
|
-
};
|
|
237
|
-
facetGroups.push(group);
|
|
238
|
-
});
|
|
239
|
-
return facetGroups;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Generate the template for a facet group with a header and the collapsible
|
|
243
|
-
* chevron for the mobile view
|
|
244
|
-
*/
|
|
245
|
-
getFacetGroupTemplate(facetGroup) {
|
|
246
|
-
if (!this.facetsLoading && facetGroup.buckets.length === 0)
|
|
247
|
-
return nothing;
|
|
248
|
-
const { key } = facetGroup;
|
|
249
|
-
const isOpen = this.openFacets[key];
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
histogramDateRangeUpdated(e) {
|
|
89
|
+
const { minDate, maxDate } = e.detail;
|
|
90
|
+
const event = new CustomEvent('histogramDateRangeUpdated', {
|
|
91
|
+
detail: { minDate, maxDate },
|
|
92
|
+
});
|
|
93
|
+
this.dispatchEvent(event);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Combines the selected facets with the aggregations to create a single list of facets
|
|
97
|
+
*/
|
|
98
|
+
get mergedFacets() {
|
|
99
|
+
const facetGroups = [];
|
|
100
|
+
facetDisplayOrder.forEach(facetKey => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const selectedFacetGroup = this.selectedFacetGroups.find(group => group.key === facetKey);
|
|
103
|
+
const aggregateFacetGroup = this.aggregationFacetGroups.find(group => group.key === facetKey);
|
|
104
|
+
// if the user selected a facet, but it's not in the aggregation, we add it as-is
|
|
105
|
+
if (selectedFacetGroup && !aggregateFacetGroup) {
|
|
106
|
+
facetGroups.push(selectedFacetGroup);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// if we don't have an aggregate facet group, don't add this to the list
|
|
110
|
+
if (!aggregateFacetGroup)
|
|
111
|
+
return;
|
|
112
|
+
// start with either the selected group if we have one, or the aggregate group
|
|
113
|
+
const facetGroup = selectedFacetGroup !== null && selectedFacetGroup !== void 0 ? selectedFacetGroup : aggregateFacetGroup;
|
|
114
|
+
// attach the counts to the selected buckets
|
|
115
|
+
let bucketsWithCount = (_a = selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets.map(bucket => {
|
|
116
|
+
const selectedBucket = aggregateFacetGroup.buckets.find(b => b.key === bucket.key);
|
|
117
|
+
return selectedBucket
|
|
118
|
+
? {
|
|
119
|
+
...bucket,
|
|
120
|
+
count: selectedBucket.count,
|
|
121
|
+
}
|
|
122
|
+
: bucket;
|
|
123
|
+
})) !== null && _a !== void 0 ? _a : [];
|
|
124
|
+
// append any additional buckets that were not selected
|
|
125
|
+
aggregateFacetGroup.buckets.forEach(bucket => {
|
|
126
|
+
const existingBucket = bucketsWithCount.find(b => b.key === bucket.key);
|
|
127
|
+
if (existingBucket)
|
|
128
|
+
return;
|
|
129
|
+
bucketsWithCount.push(bucket);
|
|
130
|
+
});
|
|
131
|
+
// For lending facets, only include a specific subset of buckets
|
|
132
|
+
if (facetKey === 'lending') {
|
|
133
|
+
bucketsWithCount = bucketsWithCount.filter(bucket => lendingFacetKeysVisibility[bucket.key]);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* render limited facet items on page facet area
|
|
137
|
+
*
|
|
138
|
+
* - by-default we are showing 6 items
|
|
139
|
+
* - additionally want to show all items (selected/suppressed) in page facet area
|
|
140
|
+
*/
|
|
141
|
+
let allowedFacetCount = (_b = Object.keys((selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets) || [])) === null || _b === void 0 ? void 0 : _b.length;
|
|
142
|
+
if (allowedFacetCount < this.allowedFacetCount) {
|
|
143
|
+
allowedFacetCount = this.allowedFacetCount; // splice start index from 0th
|
|
144
|
+
}
|
|
145
|
+
// splice how many items we want to show in page facet area
|
|
146
|
+
facetGroup.buckets = bucketsWithCount.splice(0, allowedFacetCount);
|
|
147
|
+
facetGroups.push(facetGroup);
|
|
148
|
+
});
|
|
149
|
+
return facetGroups;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Converts the selected facets to a `FacetGroup` array,
|
|
153
|
+
* which is easier to work with
|
|
154
|
+
*/
|
|
155
|
+
get selectedFacetGroups() {
|
|
156
|
+
if (!this.selectedFacets)
|
|
157
|
+
return [];
|
|
158
|
+
const facetGroups = Object.entries(this.selectedFacets).map(([key, selectedFacets]) => {
|
|
159
|
+
const option = key;
|
|
160
|
+
const title = facetTitles[option];
|
|
161
|
+
const buckets = Object.entries(selectedFacets).map(([value, facetData]) => {
|
|
162
|
+
var _a;
|
|
163
|
+
let displayText = value;
|
|
164
|
+
// for lending facets, convert the key to a readable format
|
|
165
|
+
if (option === 'lending') {
|
|
166
|
+
displayText =
|
|
167
|
+
(_a = lendingFacetDisplayNames[value]) !== null && _a !== void 0 ? _a : value;
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
displayText,
|
|
171
|
+
key: value,
|
|
172
|
+
count: facetData.count,
|
|
173
|
+
state: facetData.state,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
title,
|
|
178
|
+
key: option,
|
|
179
|
+
buckets,
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
return facetGroups;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Converts the raw `aggregations` to `FacetGroups`, which are easier to use
|
|
186
|
+
*/
|
|
187
|
+
get aggregationFacetGroups() {
|
|
188
|
+
var _a;
|
|
189
|
+
const facetGroups = [];
|
|
190
|
+
Object.entries((_a = this.aggregations) !== null && _a !== void 0 ? _a : []).forEach(([key, buckets]) => {
|
|
191
|
+
// the year_histogram data is in a different format so can't be handled here
|
|
192
|
+
if (key === 'year_histogram')
|
|
193
|
+
return;
|
|
194
|
+
const option = key;
|
|
195
|
+
const title = facetTitles[option];
|
|
196
|
+
if (!title)
|
|
197
|
+
return;
|
|
198
|
+
let castedBuckets = buckets.buckets;
|
|
199
|
+
if (option === 'collection') {
|
|
200
|
+
// we are not showing fav- collections or certain deemphasized collections in facets
|
|
201
|
+
castedBuckets = castedBuckets === null || castedBuckets === void 0 ? void 0 : castedBuckets.filter(bucket => {
|
|
202
|
+
var _a;
|
|
203
|
+
const bucketKey = (_a = bucket === null || bucket === void 0 ? void 0 : bucket.key) === null || _a === void 0 ? void 0 : _a.toString();
|
|
204
|
+
return (!suppressedCollections[bucketKey] && !(bucketKey === null || bucketKey === void 0 ? void 0 : bucketKey.startsWith('fav-')));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
const facetBuckets = castedBuckets.map(bucket => {
|
|
208
|
+
var _a;
|
|
209
|
+
const bucketKey = bucket.key;
|
|
210
|
+
let displayText = `${bucket.key}`;
|
|
211
|
+
// for lending facets, convert the bucket key to a readable format
|
|
212
|
+
if (option === 'lending') {
|
|
213
|
+
displayText =
|
|
214
|
+
(_a = lendingFacetDisplayNames[bucket.key]) !== null && _a !== void 0 ? _a : `${bucket.key}`;
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
displayText,
|
|
218
|
+
key: `${bucketKey}`,
|
|
219
|
+
count: bucket.doc_count,
|
|
220
|
+
state: 'none',
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
const group = {
|
|
224
|
+
title,
|
|
225
|
+
key: option,
|
|
226
|
+
buckets: facetBuckets,
|
|
227
|
+
};
|
|
228
|
+
facetGroups.push(group);
|
|
229
|
+
});
|
|
230
|
+
return facetGroups;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Generate the template for a facet group with a header and the collapsible
|
|
234
|
+
* chevron for the mobile view
|
|
235
|
+
*/
|
|
236
|
+
getFacetGroupTemplate(facetGroup) {
|
|
237
|
+
if (!this.facetsLoading && facetGroup.buckets.length === 0)
|
|
238
|
+
return nothing;
|
|
239
|
+
const { key } = facetGroup;
|
|
240
|
+
const isOpen = this.openFacets[key];
|
|
250
241
|
const collapser = html `
|
|
251
242
|
<span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
|
|
252
|
-
`;
|
|
243
|
+
`;
|
|
253
244
|
return html `
|
|
254
245
|
<div class="facet-group ${this.collapsableFacets ? 'mobile' : ''}">
|
|
255
246
|
<div class="facet-group-header">
|
|
256
247
|
<h1
|
|
257
|
-
@click=${() => {
|
|
258
|
-
const newOpenFacets = { ...this.openFacets };
|
|
259
|
-
newOpenFacets[key] = !isOpen;
|
|
260
|
-
this.openFacets = newOpenFacets;
|
|
248
|
+
@click=${() => {
|
|
249
|
+
const newOpenFacets = { ...this.openFacets };
|
|
250
|
+
newOpenFacets[key] = !isOpen;
|
|
251
|
+
this.openFacets = newOpenFacets;
|
|
261
252
|
}}
|
|
262
|
-
@keyup=${() => {
|
|
263
|
-
const newOpenFacets = { ...this.openFacets };
|
|
264
|
-
newOpenFacets[key] = !isOpen;
|
|
265
|
-
this.openFacets = newOpenFacets;
|
|
253
|
+
@keyup=${() => {
|
|
254
|
+
const newOpenFacets = { ...this.openFacets };
|
|
255
|
+
newOpenFacets[key] = !isOpen;
|
|
256
|
+
this.openFacets = newOpenFacets;
|
|
266
257
|
}}
|
|
267
258
|
>
|
|
268
259
|
${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
|
|
269
260
|
</h1>
|
|
270
261
|
</div>
|
|
271
262
|
<div class="facet-group-content ${isOpen ? 'open' : ''}">
|
|
272
|
-
${this.facetsLoading
|
|
273
|
-
? this.getTombstoneFacetGroupTemplate()
|
|
263
|
+
${this.facetsLoading
|
|
264
|
+
? this.getTombstoneFacetGroupTemplate()
|
|
274
265
|
: html `
|
|
275
266
|
${this.getFacetTemplate(facetGroup)}
|
|
276
267
|
${this.searchMoreFacetsLink(facetGroup)}
|
|
277
268
|
`}
|
|
278
269
|
</div>
|
|
279
270
|
</div>
|
|
280
|
-
`;
|
|
281
|
-
}
|
|
282
|
-
getTombstoneFacetGroupTemplate() {
|
|
283
|
-
// Render five tombstone rows
|
|
271
|
+
`;
|
|
272
|
+
}
|
|
273
|
+
getTombstoneFacetGroupTemplate() {
|
|
274
|
+
// Render five tombstone rows
|
|
284
275
|
return html `
|
|
285
276
|
${map(Array(5).fill(null), () => html `<facet-tombstone-row></facet-tombstone-row>`)}
|
|
286
|
-
`;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Generate the More... link button just below the facets group
|
|
290
|
-
*
|
|
291
|
-
* TODO: want to fire analytics?
|
|
292
|
-
*/
|
|
293
|
-
searchMoreFacetsLink(facetGroup) {
|
|
294
|
-
// Don't render More... links for FTS searches
|
|
295
|
-
if (!this.moreLinksVisible) {
|
|
296
|
-
return nothing;
|
|
297
|
-
}
|
|
298
|
-
// Don't render More... links for lending facets
|
|
299
|
-
if (facetGroup.key === 'lending') {
|
|
300
|
-
return nothing;
|
|
301
|
-
}
|
|
302
|
-
// Don't render More... link if the number of facets < this.allowedFacetCount
|
|
303
|
-
if (Object.keys(facetGroup.buckets).length < this.allowedFacetCount) {
|
|
304
|
-
return nothing;
|
|
305
|
-
}
|
|
277
|
+
`;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Generate the More... link button just below the facets group
|
|
281
|
+
*
|
|
282
|
+
* TODO: want to fire analytics?
|
|
283
|
+
*/
|
|
284
|
+
searchMoreFacetsLink(facetGroup) {
|
|
285
|
+
// Don't render More... links for FTS searches
|
|
286
|
+
if (!this.moreLinksVisible) {
|
|
287
|
+
return nothing;
|
|
288
|
+
}
|
|
289
|
+
// Don't render More... links for lending facets
|
|
290
|
+
if (facetGroup.key === 'lending') {
|
|
291
|
+
return nothing;
|
|
292
|
+
}
|
|
293
|
+
// Don't render More... link if the number of facets < this.allowedFacetCount
|
|
294
|
+
if (Object.keys(facetGroup.buckets).length < this.allowedFacetCount) {
|
|
295
|
+
return nothing;
|
|
296
|
+
}
|
|
306
297
|
return html `<button
|
|
307
298
|
class="more-link"
|
|
308
|
-
@click=${() => {
|
|
309
|
-
var _a;
|
|
310
|
-
this.showMoreFacetsModal(facetGroup, 'count');
|
|
311
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
312
|
-
category: analyticsCategories.default,
|
|
313
|
-
action: analyticsActions.showMoreFacetsModal,
|
|
314
|
-
label: facetGroup.key,
|
|
315
|
-
});
|
|
316
|
-
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
299
|
+
@click=${() => {
|
|
300
|
+
var _a;
|
|
301
|
+
this.showMoreFacetsModal(facetGroup, 'count');
|
|
302
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
303
|
+
category: analyticsCategories.default,
|
|
304
|
+
action: analyticsActions.showMoreFacetsModal,
|
|
305
|
+
label: facetGroup.key,
|
|
306
|
+
});
|
|
307
|
+
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
317
308
|
}}
|
|
318
309
|
>
|
|
319
310
|
More...
|
|
320
|
-
</button>`;
|
|
321
|
-
}
|
|
322
|
-
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
323
|
-
var _a, _b;
|
|
324
|
-
const facetAggrKey = facetGroup.key;
|
|
311
|
+
</button>`;
|
|
312
|
+
}
|
|
313
|
+
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
314
|
+
var _a, _b;
|
|
315
|
+
const facetAggrKey = facetGroup.key;
|
|
325
316
|
const customModalContent = html `
|
|
326
317
|
<more-facets-content
|
|
327
318
|
.analyticsHandler=${this.analyticsHandler}
|
|
@@ -335,52 +326,52 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
335
326
|
.collectionNameCache=${this.collectionNameCache}
|
|
336
327
|
.selectedFacets=${this.selectedFacets}
|
|
337
328
|
.sortedBy=${sortedBy}
|
|
338
|
-
@facetsChanged=${(e) => {
|
|
339
|
-
const event = new CustomEvent('facetsChanged', {
|
|
340
|
-
detail: e.detail,
|
|
341
|
-
bubbles: true,
|
|
342
|
-
composed: true,
|
|
343
|
-
});
|
|
344
|
-
this.dispatchEvent(event);
|
|
329
|
+
@facetsChanged=${(e) => {
|
|
330
|
+
const event = new CustomEvent('facetsChanged', {
|
|
331
|
+
detail: e.detail,
|
|
332
|
+
bubbles: true,
|
|
333
|
+
composed: true,
|
|
334
|
+
});
|
|
335
|
+
this.dispatchEvent(event);
|
|
345
336
|
}}
|
|
346
337
|
>
|
|
347
338
|
</more-facets-content>
|
|
348
|
-
`;
|
|
349
|
-
const config = new ModalConfig({
|
|
350
|
-
bodyColor: '#fff',
|
|
351
|
-
headerColor: '#194880',
|
|
352
|
-
showHeaderLogo: false,
|
|
353
|
-
closeOnBackdropClick: true,
|
|
354
|
-
title: html `Select filters`,
|
|
355
|
-
});
|
|
356
|
-
(_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.classList.add('more-search-facets');
|
|
357
|
-
(_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.showModal({
|
|
358
|
-
config,
|
|
359
|
-
customModalContent,
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Generate the list template for each bucket in a facet group
|
|
364
|
-
*/
|
|
365
|
-
getFacetTemplate(facetGroup) {
|
|
339
|
+
`;
|
|
340
|
+
const config = new ModalConfig({
|
|
341
|
+
bodyColor: '#fff',
|
|
342
|
+
headerColor: '#194880',
|
|
343
|
+
showHeaderLogo: false,
|
|
344
|
+
closeOnBackdropClick: true,
|
|
345
|
+
title: html `Select filters`,
|
|
346
|
+
});
|
|
347
|
+
(_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.classList.add('more-search-facets');
|
|
348
|
+
(_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.showModal({
|
|
349
|
+
config,
|
|
350
|
+
customModalContent,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Generate the list template for each bucket in a facet group
|
|
355
|
+
*/
|
|
356
|
+
getFacetTemplate(facetGroup) {
|
|
366
357
|
return html `
|
|
367
358
|
<facets-template
|
|
368
359
|
.facetGroup=${facetGroup}
|
|
369
360
|
.selectedFacets=${this.selectedFacets}
|
|
370
361
|
.renderOn=${'page'}
|
|
371
362
|
.collectionNameCache=${this.collectionNameCache}
|
|
372
|
-
@selectedFacetsChanged=${(e) => {
|
|
373
|
-
const event = new CustomEvent('facetsChanged', {
|
|
374
|
-
detail: e.detail,
|
|
375
|
-
bubbles: true,
|
|
376
|
-
composed: true,
|
|
377
|
-
});
|
|
378
|
-
this.dispatchEvent(event);
|
|
363
|
+
@selectedFacetsChanged=${(e) => {
|
|
364
|
+
const event = new CustomEvent('facetsChanged', {
|
|
365
|
+
detail: e.detail,
|
|
366
|
+
bubbles: true,
|
|
367
|
+
composed: true,
|
|
368
|
+
});
|
|
369
|
+
this.dispatchEvent(event);
|
|
379
370
|
}}
|
|
380
371
|
></facets-template>
|
|
381
|
-
`;
|
|
382
|
-
}
|
|
383
|
-
static get styles() {
|
|
372
|
+
`;
|
|
373
|
+
}
|
|
374
|
+
static get styles() {
|
|
384
375
|
return css `
|
|
385
376
|
#container.loading {
|
|
386
377
|
opacity: 0.5;
|
|
@@ -462,77 +453,77 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
462
453
|
height: 15px;
|
|
463
454
|
cursor: pointer;
|
|
464
455
|
}
|
|
465
|
-
`;
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
__decorate([
|
|
469
|
-
property({ type: Object })
|
|
470
|
-
], CollectionFacets.prototype, "searchService", void 0);
|
|
471
|
-
__decorate([
|
|
472
|
-
property({ type: String })
|
|
473
|
-
], CollectionFacets.prototype, "searchType", void 0);
|
|
474
|
-
__decorate([
|
|
475
|
-
property({ type: Object })
|
|
476
|
-
], CollectionFacets.prototype, "aggregations", void 0);
|
|
477
|
-
__decorate([
|
|
478
|
-
property({ type: Object })
|
|
479
|
-
], CollectionFacets.prototype, "fullYearsHistogramAggregation", void 0);
|
|
480
|
-
__decorate([
|
|
481
|
-
property({ type: String })
|
|
482
|
-
], CollectionFacets.prototype, "minSelectedDate", void 0);
|
|
483
|
-
__decorate([
|
|
484
|
-
property({ type: String })
|
|
485
|
-
], CollectionFacets.prototype, "maxSelectedDate", void 0);
|
|
486
|
-
__decorate([
|
|
487
|
-
property({ type: Boolean })
|
|
488
|
-
], CollectionFacets.prototype, "moreLinksVisible", void 0);
|
|
489
|
-
__decorate([
|
|
490
|
-
property({ type: Boolean })
|
|
491
|
-
], CollectionFacets.prototype, "facetsLoading", void 0);
|
|
492
|
-
__decorate([
|
|
493
|
-
property({ type: Boolean })
|
|
494
|
-
], CollectionFacets.prototype, "fullYearAggregationLoading", void 0);
|
|
495
|
-
__decorate([
|
|
496
|
-
property({ type: Object })
|
|
497
|
-
], CollectionFacets.prototype, "selectedFacets", void 0);
|
|
498
|
-
__decorate([
|
|
499
|
-
property({ type: Boolean })
|
|
500
|
-
], CollectionFacets.prototype, "collapsableFacets", void 0);
|
|
501
|
-
__decorate([
|
|
502
|
-
property({ type: Boolean })
|
|
503
|
-
], CollectionFacets.prototype, "showHistogramDatePicker", void 0);
|
|
504
|
-
__decorate([
|
|
505
|
-
property({ type: String })
|
|
506
|
-
], CollectionFacets.prototype, "query", void 0);
|
|
507
|
-
__decorate([
|
|
508
|
-
property({ type: Object })
|
|
509
|
-
], CollectionFacets.prototype, "filterMap", void 0);
|
|
510
|
-
__decorate([
|
|
511
|
-
property({ type: Object, attribute: false })
|
|
512
|
-
], CollectionFacets.prototype, "modalManager", void 0);
|
|
513
|
-
__decorate([
|
|
514
|
-
property({ type: Object, attribute: false })
|
|
515
|
-
], CollectionFacets.prototype, "resizeObserver", void 0);
|
|
516
|
-
__decorate([
|
|
517
|
-
property({ type: Object, attribute: false })
|
|
518
|
-
], CollectionFacets.prototype, "featureFeedbackService", void 0);
|
|
519
|
-
__decorate([
|
|
520
|
-
property({ type: Object, attribute: false })
|
|
521
|
-
], CollectionFacets.prototype, "recaptchaManager", void 0);
|
|
522
|
-
__decorate([
|
|
523
|
-
property({ type: Object, attribute: false })
|
|
524
|
-
], CollectionFacets.prototype, "analyticsHandler", void 0);
|
|
525
|
-
__decorate([
|
|
526
|
-
property({ type: Object, attribute: false })
|
|
527
|
-
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
528
|
-
__decorate([
|
|
529
|
-
property({ type: Function })
|
|
530
|
-
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
531
|
-
__decorate([
|
|
532
|
-
state()
|
|
533
|
-
], CollectionFacets.prototype, "openFacets", void 0);
|
|
534
|
-
CollectionFacets = __decorate([
|
|
535
|
-
customElement('collection-facets')
|
|
536
|
-
], CollectionFacets);
|
|
537
|
-
export { CollectionFacets };
|
|
456
|
+
`;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
__decorate([
|
|
460
|
+
property({ type: Object })
|
|
461
|
+
], CollectionFacets.prototype, "searchService", void 0);
|
|
462
|
+
__decorate([
|
|
463
|
+
property({ type: String })
|
|
464
|
+
], CollectionFacets.prototype, "searchType", void 0);
|
|
465
|
+
__decorate([
|
|
466
|
+
property({ type: Object })
|
|
467
|
+
], CollectionFacets.prototype, "aggregations", void 0);
|
|
468
|
+
__decorate([
|
|
469
|
+
property({ type: Object })
|
|
470
|
+
], CollectionFacets.prototype, "fullYearsHistogramAggregation", void 0);
|
|
471
|
+
__decorate([
|
|
472
|
+
property({ type: String })
|
|
473
|
+
], CollectionFacets.prototype, "minSelectedDate", void 0);
|
|
474
|
+
__decorate([
|
|
475
|
+
property({ type: String })
|
|
476
|
+
], CollectionFacets.prototype, "maxSelectedDate", void 0);
|
|
477
|
+
__decorate([
|
|
478
|
+
property({ type: Boolean })
|
|
479
|
+
], CollectionFacets.prototype, "moreLinksVisible", void 0);
|
|
480
|
+
__decorate([
|
|
481
|
+
property({ type: Boolean })
|
|
482
|
+
], CollectionFacets.prototype, "facetsLoading", void 0);
|
|
483
|
+
__decorate([
|
|
484
|
+
property({ type: Boolean })
|
|
485
|
+
], CollectionFacets.prototype, "fullYearAggregationLoading", void 0);
|
|
486
|
+
__decorate([
|
|
487
|
+
property({ type: Object })
|
|
488
|
+
], CollectionFacets.prototype, "selectedFacets", void 0);
|
|
489
|
+
__decorate([
|
|
490
|
+
property({ type: Boolean })
|
|
491
|
+
], CollectionFacets.prototype, "collapsableFacets", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ type: Boolean })
|
|
494
|
+
], CollectionFacets.prototype, "showHistogramDatePicker", void 0);
|
|
495
|
+
__decorate([
|
|
496
|
+
property({ type: String })
|
|
497
|
+
], CollectionFacets.prototype, "query", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ type: Object })
|
|
500
|
+
], CollectionFacets.prototype, "filterMap", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Object, attribute: false })
|
|
503
|
+
], CollectionFacets.prototype, "modalManager", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
property({ type: Object, attribute: false })
|
|
506
|
+
], CollectionFacets.prototype, "resizeObserver", void 0);
|
|
507
|
+
__decorate([
|
|
508
|
+
property({ type: Object, attribute: false })
|
|
509
|
+
], CollectionFacets.prototype, "featureFeedbackService", void 0);
|
|
510
|
+
__decorate([
|
|
511
|
+
property({ type: Object, attribute: false })
|
|
512
|
+
], CollectionFacets.prototype, "recaptchaManager", void 0);
|
|
513
|
+
__decorate([
|
|
514
|
+
property({ type: Object, attribute: false })
|
|
515
|
+
], CollectionFacets.prototype, "analyticsHandler", void 0);
|
|
516
|
+
__decorate([
|
|
517
|
+
property({ type: Object, attribute: false })
|
|
518
|
+
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
519
|
+
__decorate([
|
|
520
|
+
property({ type: Function })
|
|
521
|
+
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
522
|
+
__decorate([
|
|
523
|
+
state()
|
|
524
|
+
], CollectionFacets.prototype, "openFacets", void 0);
|
|
525
|
+
CollectionFacets = __decorate([
|
|
526
|
+
customElement('collection-facets')
|
|
527
|
+
], CollectionFacets);
|
|
528
|
+
export { CollectionFacets };
|
|
538
529
|
//# sourceMappingURL=collection-facets.js.map
|