@internetarchive/collection-browser 0.4.9-alpha.1 → 0.4.9
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 +281 -281
- package/dist/src/collection-browser.js +1204 -1200
- 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 +77 -77
- package/dist/src/collection-facets/more-facets-content.js +357 -357
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +192 -192
- package/dist/src/collection-facets.d.ts +83 -83
- package/dist/src/collection-facets.js +392 -392
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +11 -11
- package/dist/src/empty-placeholder.js +42 -42
- 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 +115 -114
- package/dist/src/models.js +125 -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 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +61 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -0
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -12
- package/dist/src/sort-filter-bar/alpha-bar.js +166 -58
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-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 +108 -108
- package/dist/src/sort-filter-bar/sort-filter-bar.js +438 -438
- 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 -17
- package/dist/src/tiles/grid/account-tile.js +68 -46
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.d.ts +17 -14
- package/dist/src/tiles/grid/collection-tile.js +75 -53
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +32 -29
- package/dist/src/tiles/grid/item-tile.js +126 -108
- 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 +44 -8
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
- package/dist/src/tiles/grid/tile-stats.js +40 -40
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -197
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -331
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- 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 +21 -21
- package/dist/src/tiles/list/tile-list-compact.js +99 -99
- package/dist/src/tiles/list/tile-list.d.ts +55 -55
- package/dist/src/tiles/list/tile-list.js +303 -297
- 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 -55
- package/dist/src/tiles/tile-dispatcher.js +203 -179
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- 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.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +508 -508
- 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 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +13 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -43
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +197 -197
- 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 +81 -60
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +81 -57
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +163 -142
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +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 +92 -92
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +163 -163
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -0
- package/dist/test/tiles/tile-dispatcher.test.js +101 -0
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -0
- 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 +1 -1
- package/renovate.json +6 -6
- package/src/collection-browser.ts +4 -0
- package/src/collection-facets.ts +3 -5
- package/src/models.ts +1 -0
- package/src/sort-filter-bar/alpha-bar-tooltip.ts +54 -0
- package/src/sort-filter-bar/alpha-bar.ts +133 -9
- package/src/tiles/grid/account-tile.ts +23 -1
- package/src/tiles/grid/collection-tile.ts +31 -2
- package/src/tiles/grid/item-tile.ts +22 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +37 -1
- package/src/tiles/hover/hover-pane-controller.ts +38 -1
- package/src/tiles/list/tile-list.ts +8 -1
- package/src/tiles/tile-dispatcher.ts +29 -2
- package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +17 -0
- package/test/sort-filter-bar/alpha-bar.test.ts +46 -1
- package/test/tiles/grid/account-tile.test.ts +27 -0
- package/test/tiles/grid/collection-tile.test.ts +30 -0
- package/test/tiles/grid/item-tile.test.ts +27 -0
- package/test/tiles/tile-dispatcher.test.ts +122 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,42 +1,45 @@
|
|
|
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
|
-
|
|
35
|
-
|
|
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() {
|
|
36
39
|
return html `
|
|
37
40
|
<div id="container" class="${this.facetsLoading ? 'loading' : ''}">
|
|
38
|
-
${this.showHistogramDatePicker &&
|
|
39
|
-
(this.fullYearsHistogramAggregation || this.fullYearAggregationLoading)
|
|
41
|
+
${this.showHistogramDatePicker &&
|
|
42
|
+
(this.fullYearsHistogramAggregation || this.fullYearAggregationLoading)
|
|
40
43
|
? html `
|
|
41
44
|
<div class="facet-group">
|
|
42
45
|
<h1>
|
|
@@ -51,32 +54,32 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
51
54
|
</h1>
|
|
52
55
|
${this.histogramTemplate}
|
|
53
56
|
</div>
|
|
54
|
-
`
|
|
57
|
+
`
|
|
55
58
|
: nothing}
|
|
56
59
|
${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
|
|
57
60
|
</div>
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
updated(changed) {
|
|
61
|
-
if (changed.has('selectedFacets')) {
|
|
62
|
-
this.dispatchFacetsChangedEvent();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// TODO: want to fire analytics?
|
|
66
|
-
dispatchFacetsChangedEvent() {
|
|
67
|
-
const event = new CustomEvent('facetsChanged', {
|
|
68
|
-
detail: this.selectedFacets,
|
|
69
|
-
});
|
|
70
|
-
this.dispatchEvent(event);
|
|
71
|
-
}
|
|
72
|
-
get currentYearsHistogramAggregation() {
|
|
73
|
-
var _a;
|
|
74
|
-
return (_a = this.aggregations) === null || _a === void 0 ? void 0 : _a.year_histogram;
|
|
75
|
-
}
|
|
76
|
-
get histogramTemplate() {
|
|
77
|
-
const { fullYearsHistogramAggregation } = this;
|
|
78
|
-
return this.fullYearAggregationLoading
|
|
79
|
-
? html `<div class="histogram-loading-indicator">…</div>` // Ellipsis block
|
|
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
|
|
80
83
|
: html `
|
|
81
84
|
<histogram-date-range
|
|
82
85
|
.minDate=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.first_bucket_key}
|
|
@@ -89,250 +92,250 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
89
92
|
.bins=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.buckets}
|
|
90
93
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
91
94
|
></histogram-date-range>
|
|
92
|
-
`;
|
|
93
|
-
}
|
|
94
|
-
histogramDateRangeUpdated(e) {
|
|
95
|
-
const { minDate, maxDate } = e.detail;
|
|
96
|
-
const event = new CustomEvent('histogramDateRangeUpdated', {
|
|
97
|
-
detail: { minDate, maxDate },
|
|
98
|
-
});
|
|
99
|
-
this.dispatchEvent(event);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Combines the selected facets with the aggregations to create a single list of facets
|
|
103
|
-
*/
|
|
104
|
-
get mergedFacets() {
|
|
105
|
-
const facetGroups = [];
|
|
106
|
-
facetDisplayOrder.forEach(facetKey => {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
const selectedFacetGroup = this.selectedFacetGroups.find(group => group.key === facetKey);
|
|
109
|
-
const aggregateFacetGroup = this.aggregationFacetGroups.find(group => group.key === facetKey);
|
|
110
|
-
// if the user selected a facet, but it's not in the aggregation, we add it as-is
|
|
111
|
-
if (selectedFacetGroup && !aggregateFacetGroup) {
|
|
112
|
-
facetGroups.push(selectedFacetGroup);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
// if we don't have an aggregate facet group, don't add this to the list
|
|
116
|
-
if (!aggregateFacetGroup)
|
|
117
|
-
return;
|
|
118
|
-
// start with either the selected group if we have one, or the aggregate group
|
|
119
|
-
const facetGroup = selectedFacetGroup !== null && selectedFacetGroup !== void 0 ? selectedFacetGroup : aggregateFacetGroup;
|
|
120
|
-
// attach the counts to the selected buckets
|
|
121
|
-
let bucketsWithCount = (_a = selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets.map(bucket => {
|
|
122
|
-
const selectedBucket = aggregateFacetGroup.buckets.find(b => b.key === bucket.key);
|
|
123
|
-
return selectedBucket
|
|
124
|
-
? {
|
|
125
|
-
...bucket,
|
|
126
|
-
count: selectedBucket.count,
|
|
127
|
-
}
|
|
128
|
-
: bucket;
|
|
129
|
-
})) !== null && _a !== void 0 ? _a : [];
|
|
130
|
-
// append any additional buckets that were not selected
|
|
131
|
-
aggregateFacetGroup.buckets.forEach(bucket => {
|
|
132
|
-
const existingBucket = bucketsWithCount.find(b => b.key === bucket.key);
|
|
133
|
-
if (existingBucket)
|
|
134
|
-
return;
|
|
135
|
-
bucketsWithCount.push(bucket);
|
|
136
|
-
});
|
|
137
|
-
// For lending facets, only include a specific subset of buckets
|
|
138
|
-
if (facetKey === 'lending') {
|
|
139
|
-
bucketsWithCount = bucketsWithCount.filter(bucket => lendingFacetKeysVisibility[bucket.key]);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* render limited facet items on page facet area
|
|
143
|
-
*
|
|
144
|
-
* - by-default we are showing 6 items
|
|
145
|
-
* - additionally want to show all items (selected/suppressed) in page facet area
|
|
146
|
-
*/
|
|
147
|
-
let allowedFacetCount = (_b = Object.keys((selectedFacetGroup === null || selectedFacetGroup === void 0 ? void 0 : selectedFacetGroup.buckets) || [])) === null || _b === void 0 ? void 0 : _b.length;
|
|
148
|
-
if (allowedFacetCount < this.allowedFacetCount) {
|
|
149
|
-
allowedFacetCount = this.allowedFacetCount; // splice start index from 0th
|
|
150
|
-
}
|
|
151
|
-
// splice how many items we want to show in page facet area
|
|
152
|
-
facetGroup.buckets = bucketsWithCount.splice(0, allowedFacetCount);
|
|
153
|
-
facetGroups.push(facetGroup);
|
|
154
|
-
});
|
|
155
|
-
return facetGroups;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Converts the selected facets to a `FacetGroup` array,
|
|
159
|
-
* which is easier to work with
|
|
160
|
-
*/
|
|
161
|
-
get selectedFacetGroups() {
|
|
162
|
-
if (!this.selectedFacets)
|
|
163
|
-
return [];
|
|
164
|
-
const facetGroups = Object.entries(this.selectedFacets).map(([key, selectedFacets]) => {
|
|
165
|
-
const option = key;
|
|
166
|
-
const title = facetTitles[option];
|
|
167
|
-
const buckets = Object.entries(selectedFacets).map(([value, facetData]) => {
|
|
168
|
-
var _a, _b, _c;
|
|
169
|
-
let displayText = value;
|
|
170
|
-
// for selected languages, we store the language code instead of the
|
|
171
|
-
// display name, so look up the name from the mapping
|
|
172
|
-
if (option === 'language') {
|
|
173
|
-
displayText =
|
|
174
|
-
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getLanguageNameFromCodeString(value)) !== null && _b !== void 0 ? _b : value;
|
|
175
|
-
}
|
|
176
|
-
// for lending facets, convert the key to a readable format
|
|
177
|
-
if (option === 'lending') {
|
|
178
|
-
displayText =
|
|
179
|
-
(_c = lendingFacetDisplayNames[value]) !== null && _c !== void 0 ? _c : value;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
displayText,
|
|
183
|
-
key: value,
|
|
184
|
-
count: facetData.count,
|
|
185
|
-
state: facetData.state,
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
|
-
return {
|
|
189
|
-
title,
|
|
190
|
-
key: option,
|
|
191
|
-
buckets,
|
|
192
|
-
};
|
|
193
|
-
});
|
|
194
|
-
return facetGroups;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Converts the raw `aggregations` to `FacetGroups`, which are easier to use
|
|
198
|
-
*/
|
|
199
|
-
get aggregationFacetGroups() {
|
|
200
|
-
var _a;
|
|
201
|
-
const facetGroups = [];
|
|
202
|
-
Object.entries((_a = this.aggregations) !== null && _a !== void 0 ? _a : []).forEach(([key, buckets]) => {
|
|
203
|
-
// the year_histogram data is in a different format so can't be handled here
|
|
204
|
-
if (key === 'year_histogram')
|
|
205
|
-
return;
|
|
206
|
-
const option = key;
|
|
207
|
-
const title = facetTitles[option];
|
|
208
|
-
if (!title)
|
|
209
|
-
return;
|
|
210
|
-
let castedBuckets = buckets.buckets;
|
|
211
|
-
if (option === 'collection') {
|
|
212
|
-
// we are not showing fav- collections or certain deemphasized collections in facets
|
|
213
|
-
castedBuckets = castedBuckets === null || castedBuckets === void 0 ? void 0 : castedBuckets.filter(bucket => {
|
|
214
|
-
var _a;
|
|
215
|
-
const bucketKey = (_a = bucket === null || bucket === void 0 ? void 0 : bucket.key) === null || _a === void 0 ? void 0 : _a.toString();
|
|
216
|
-
return (!suppressedCollections[bucketKey] && !(bucketKey === null || bucketKey === void 0 ? void 0 : bucketKey.startsWith('fav-')));
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const facetBuckets = castedBuckets.map(bucket => {
|
|
220
|
-
var _a, _b, _c;
|
|
221
|
-
let bucketKey = bucket.key;
|
|
222
|
-
let displayText = `${bucket.key}`;
|
|
223
|
-
// for languages, we need to search by language code instead of the
|
|
224
|
-
// display name, which is what we get from the search engine result
|
|
225
|
-
if (option === 'language') {
|
|
226
|
-
// const languageCodeKey = languageToCodeMap[bucket.key];
|
|
227
|
-
bucketKey =
|
|
228
|
-
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getCodeStringFromLanguageName(`${bucket.key}`)) !== null && _b !== void 0 ? _b : bucket.key;
|
|
229
|
-
// bucketKey = languageCodeKey ?? bucket.key;
|
|
230
|
-
}
|
|
231
|
-
// for lending facets, convert the bucket key to a readable format
|
|
232
|
-
if (option === 'lending') {
|
|
233
|
-
displayText =
|
|
234
|
-
(_c = lendingFacetDisplayNames[bucket.key]) !== null && _c !== void 0 ? _c : `${bucket.key}`;
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
displayText,
|
|
238
|
-
key: `${bucketKey}`,
|
|
239
|
-
count: bucket.doc_count,
|
|
240
|
-
state: 'none',
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
const group = {
|
|
244
|
-
title,
|
|
245
|
-
key: option,
|
|
246
|
-
buckets: facetBuckets,
|
|
247
|
-
};
|
|
248
|
-
facetGroups.push(group);
|
|
249
|
-
});
|
|
250
|
-
return facetGroups;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Generate the template for a facet group with a header and the collapsible
|
|
254
|
-
* chevron for the mobile view
|
|
255
|
-
*/
|
|
256
|
-
getFacetGroupTemplate(facetGroup) {
|
|
257
|
-
if (!this.facetsLoading && facetGroup.buckets.length === 0)
|
|
258
|
-
return nothing;
|
|
259
|
-
const { key } = facetGroup;
|
|
260
|
-
const isOpen = this.openFacets[key];
|
|
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, _b, _c;
|
|
172
|
+
let displayText = value;
|
|
173
|
+
// for selected languages, we store the language code instead of the
|
|
174
|
+
// display name, so look up the name from the mapping
|
|
175
|
+
if (option === 'language') {
|
|
176
|
+
displayText =
|
|
177
|
+
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getLanguageNameFromCodeString(value)) !== null && _b !== void 0 ? _b : value;
|
|
178
|
+
}
|
|
179
|
+
// for lending facets, convert the key to a readable format
|
|
180
|
+
if (option === 'lending') {
|
|
181
|
+
displayText =
|
|
182
|
+
(_c = lendingFacetDisplayNames[value]) !== null && _c !== void 0 ? _c : value;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
displayText,
|
|
186
|
+
key: value,
|
|
187
|
+
count: facetData.count,
|
|
188
|
+
state: facetData.state,
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
title,
|
|
193
|
+
key: option,
|
|
194
|
+
buckets,
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
return facetGroups;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Converts the raw `aggregations` to `FacetGroups`, which are easier to use
|
|
201
|
+
*/
|
|
202
|
+
get aggregationFacetGroups() {
|
|
203
|
+
var _a;
|
|
204
|
+
const facetGroups = [];
|
|
205
|
+
Object.entries((_a = this.aggregations) !== null && _a !== void 0 ? _a : []).forEach(([key, buckets]) => {
|
|
206
|
+
// the year_histogram data is in a different format so can't be handled here
|
|
207
|
+
if (key === 'year_histogram')
|
|
208
|
+
return;
|
|
209
|
+
const option = key;
|
|
210
|
+
const title = facetTitles[option];
|
|
211
|
+
if (!title)
|
|
212
|
+
return;
|
|
213
|
+
let castedBuckets = buckets.buckets;
|
|
214
|
+
if (option === 'collection') {
|
|
215
|
+
// we are not showing fav- collections or certain deemphasized collections in facets
|
|
216
|
+
castedBuckets = castedBuckets === null || castedBuckets === void 0 ? void 0 : castedBuckets.filter(bucket => {
|
|
217
|
+
var _a;
|
|
218
|
+
const bucketKey = (_a = bucket === null || bucket === void 0 ? void 0 : bucket.key) === null || _a === void 0 ? void 0 : _a.toString();
|
|
219
|
+
return (!suppressedCollections[bucketKey] && !(bucketKey === null || bucketKey === void 0 ? void 0 : bucketKey.startsWith('fav-')));
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const facetBuckets = castedBuckets.map(bucket => {
|
|
223
|
+
var _a, _b, _c;
|
|
224
|
+
let bucketKey = bucket.key;
|
|
225
|
+
let displayText = `${bucket.key}`;
|
|
226
|
+
// for languages, we need to search by language code instead of the
|
|
227
|
+
// display name, which is what we get from the search engine result
|
|
228
|
+
if (option === 'language') {
|
|
229
|
+
// const languageCodeKey = languageToCodeMap[bucket.key];
|
|
230
|
+
bucketKey =
|
|
231
|
+
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getCodeStringFromLanguageName(`${bucket.key}`)) !== null && _b !== void 0 ? _b : bucket.key;
|
|
232
|
+
// bucketKey = languageCodeKey ?? bucket.key;
|
|
233
|
+
}
|
|
234
|
+
// for lending facets, convert the bucket key to a readable format
|
|
235
|
+
if (option === 'lending') {
|
|
236
|
+
displayText =
|
|
237
|
+
(_c = lendingFacetDisplayNames[bucket.key]) !== null && _c !== void 0 ? _c : `${bucket.key}`;
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
displayText,
|
|
241
|
+
key: `${bucketKey}`,
|
|
242
|
+
count: bucket.doc_count,
|
|
243
|
+
state: 'none',
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
const group = {
|
|
247
|
+
title,
|
|
248
|
+
key: option,
|
|
249
|
+
buckets: facetBuckets,
|
|
250
|
+
};
|
|
251
|
+
facetGroups.push(group);
|
|
252
|
+
});
|
|
253
|
+
return facetGroups;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Generate the template for a facet group with a header and the collapsible
|
|
257
|
+
* chevron for the mobile view
|
|
258
|
+
*/
|
|
259
|
+
getFacetGroupTemplate(facetGroup) {
|
|
260
|
+
if (!this.facetsLoading && facetGroup.buckets.length === 0)
|
|
261
|
+
return nothing;
|
|
262
|
+
const { key } = facetGroup;
|
|
263
|
+
const isOpen = this.openFacets[key];
|
|
261
264
|
const collapser = html `
|
|
262
265
|
<span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
|
|
263
|
-
`;
|
|
266
|
+
`;
|
|
264
267
|
return html `
|
|
265
268
|
<div class="facet-group ${this.collapsableFacets ? 'mobile' : ''}">
|
|
266
269
|
<div class="facet-group-header">
|
|
267
270
|
<h1
|
|
268
|
-
@click=${() => {
|
|
269
|
-
const newOpenFacets = { ...this.openFacets };
|
|
270
|
-
newOpenFacets[key] = !isOpen;
|
|
271
|
-
this.openFacets = newOpenFacets;
|
|
271
|
+
@click=${() => {
|
|
272
|
+
const newOpenFacets = { ...this.openFacets };
|
|
273
|
+
newOpenFacets[key] = !isOpen;
|
|
274
|
+
this.openFacets = newOpenFacets;
|
|
272
275
|
}}
|
|
273
|
-
@keyup=${() => {
|
|
274
|
-
const newOpenFacets = { ...this.openFacets };
|
|
275
|
-
newOpenFacets[key] = !isOpen;
|
|
276
|
-
this.openFacets = newOpenFacets;
|
|
276
|
+
@keyup=${() => {
|
|
277
|
+
const newOpenFacets = { ...this.openFacets };
|
|
278
|
+
newOpenFacets[key] = !isOpen;
|
|
279
|
+
this.openFacets = newOpenFacets;
|
|
277
280
|
}}
|
|
278
281
|
>
|
|
279
282
|
${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
|
|
280
283
|
</h1>
|
|
281
284
|
</div>
|
|
282
285
|
<div class="facet-group-content ${isOpen ? 'open' : ''}">
|
|
283
|
-
${this.facetsLoading
|
|
284
|
-
? this.getTombstoneFacetGroupTemplate()
|
|
286
|
+
${this.facetsLoading
|
|
287
|
+
? this.getTombstoneFacetGroupTemplate()
|
|
285
288
|
: html `
|
|
286
289
|
${this.getFacetTemplate(facetGroup)}
|
|
287
290
|
${this.searchMoreFacetsLink(facetGroup)}
|
|
288
291
|
`}
|
|
289
292
|
</div>
|
|
290
293
|
</div>
|
|
291
|
-
`;
|
|
292
|
-
}
|
|
293
|
-
getTombstoneFacetGroupTemplate() {
|
|
294
|
-
// Render five tombstone rows
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
getTombstoneFacetGroupTemplate() {
|
|
297
|
+
// Render five tombstone rows
|
|
295
298
|
return html `
|
|
296
299
|
${map(Array(5).fill(null), () => html `<facet-tombstone-row></facet-tombstone-row>`)}
|
|
297
|
-
`;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Generate the More... link button just below the facets group
|
|
301
|
-
*
|
|
302
|
-
* TODO: want to fire analytics?
|
|
303
|
-
*/
|
|
304
|
-
searchMoreFacetsLink(facetGroup) {
|
|
305
|
-
// Don't render More... links for FTS searches
|
|
306
|
-
if (!this.moreLinksVisible) {
|
|
307
|
-
return nothing;
|
|
308
|
-
}
|
|
309
|
-
// Don't render More... links for lending facets
|
|
310
|
-
if (facetGroup.key === 'lending') {
|
|
311
|
-
return nothing;
|
|
312
|
-
}
|
|
313
|
-
// Don't render More... link if the number of facets < this.allowedFacetCount
|
|
314
|
-
if (Object.keys(facetGroup.buckets).length < this.allowedFacetCount) {
|
|
315
|
-
return nothing;
|
|
316
|
-
}
|
|
300
|
+
`;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Generate the More... link button just below the facets group
|
|
304
|
+
*
|
|
305
|
+
* TODO: want to fire analytics?
|
|
306
|
+
*/
|
|
307
|
+
searchMoreFacetsLink(facetGroup) {
|
|
308
|
+
// Don't render More... links for FTS searches
|
|
309
|
+
if (!this.moreLinksVisible) {
|
|
310
|
+
return nothing;
|
|
311
|
+
}
|
|
312
|
+
// Don't render More... links for lending facets
|
|
313
|
+
if (facetGroup.key === 'lending') {
|
|
314
|
+
return nothing;
|
|
315
|
+
}
|
|
316
|
+
// Don't render More... link if the number of facets < this.allowedFacetCount
|
|
317
|
+
if (Object.keys(facetGroup.buckets).length < this.allowedFacetCount) {
|
|
318
|
+
return nothing;
|
|
319
|
+
}
|
|
317
320
|
return html `<button
|
|
318
321
|
class="more-link"
|
|
319
|
-
@click=${() => {
|
|
320
|
-
var _a;
|
|
321
|
-
this.showMoreFacetsModal(facetGroup, 'count');
|
|
322
|
-
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
323
|
-
category: analyticsCategories.default,
|
|
324
|
-
action: analyticsActions.showMoreFacetsModal,
|
|
325
|
-
label: facetGroup.key,
|
|
326
|
-
});
|
|
327
|
-
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
322
|
+
@click=${() => {
|
|
323
|
+
var _a;
|
|
324
|
+
this.showMoreFacetsModal(facetGroup, 'count');
|
|
325
|
+
(_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
|
|
326
|
+
category: analyticsCategories.default,
|
|
327
|
+
action: analyticsActions.showMoreFacetsModal,
|
|
328
|
+
label: facetGroup.key,
|
|
329
|
+
});
|
|
330
|
+
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
328
331
|
}}
|
|
329
332
|
>
|
|
330
333
|
More...
|
|
331
|
-
</button>`;
|
|
332
|
-
}
|
|
333
|
-
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
334
|
-
var _a, _b;
|
|
335
|
-
const facetAggrKey = facetGroup.key;
|
|
334
|
+
</button>`;
|
|
335
|
+
}
|
|
336
|
+
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
337
|
+
var _a, _b;
|
|
338
|
+
const facetAggrKey = facetGroup.key;
|
|
336
339
|
const customModalContent = html `
|
|
337
340
|
<more-facets-content
|
|
338
341
|
.analyticsHandler=${this.analyticsHandler}
|
|
@@ -347,52 +350,52 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
347
350
|
.languageCodeHandler=${this.languageCodeHandler}
|
|
348
351
|
.selectedFacets=${this.selectedFacets}
|
|
349
352
|
.sortedBy=${sortedBy}
|
|
350
|
-
@facetsChanged=${(e) => {
|
|
351
|
-
const event = new CustomEvent('facetsChanged', {
|
|
352
|
-
detail: e.detail,
|
|
353
|
-
bubbles: true,
|
|
354
|
-
composed: true,
|
|
355
|
-
});
|
|
356
|
-
this.dispatchEvent(event);
|
|
353
|
+
@facetsChanged=${(e) => {
|
|
354
|
+
const event = new CustomEvent('facetsChanged', {
|
|
355
|
+
detail: e.detail,
|
|
356
|
+
bubbles: true,
|
|
357
|
+
composed: true,
|
|
358
|
+
});
|
|
359
|
+
this.dispatchEvent(event);
|
|
357
360
|
}}
|
|
358
361
|
>
|
|
359
362
|
</more-facets-content>
|
|
360
|
-
`;
|
|
361
|
-
const config = new ModalConfig({
|
|
362
|
-
bodyColor: '#fff',
|
|
363
|
-
headerColor: '#194880',
|
|
364
|
-
showHeaderLogo: false,
|
|
365
|
-
closeOnBackdropClick: true,
|
|
366
|
-
title: html `Select filters`,
|
|
367
|
-
});
|
|
368
|
-
(_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.classList.add('more-search-facets');
|
|
369
|
-
(_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.showModal({
|
|
370
|
-
config,
|
|
371
|
-
customModalContent,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Generate the list template for each bucket in a facet group
|
|
376
|
-
*/
|
|
377
|
-
getFacetTemplate(facetGroup) {
|
|
363
|
+
`;
|
|
364
|
+
const config = new ModalConfig({
|
|
365
|
+
bodyColor: '#fff',
|
|
366
|
+
headerColor: '#194880',
|
|
367
|
+
showHeaderLogo: false,
|
|
368
|
+
closeOnBackdropClick: true,
|
|
369
|
+
title: html `Select filters`,
|
|
370
|
+
});
|
|
371
|
+
(_a = this.modalManager) === null || _a === void 0 ? void 0 : _a.classList.add('more-search-facets');
|
|
372
|
+
(_b = this.modalManager) === null || _b === void 0 ? void 0 : _b.showModal({
|
|
373
|
+
config,
|
|
374
|
+
customModalContent,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Generate the list template for each bucket in a facet group
|
|
379
|
+
*/
|
|
380
|
+
getFacetTemplate(facetGroup) {
|
|
378
381
|
return html `
|
|
379
382
|
<facets-template
|
|
380
383
|
.facetGroup=${facetGroup}
|
|
381
384
|
.selectedFacets=${this.selectedFacets}
|
|
382
385
|
.renderOn=${'page'}
|
|
383
386
|
.collectionNameCache=${this.collectionNameCache}
|
|
384
|
-
@selectedFacetsChanged=${(e) => {
|
|
385
|
-
const event = new CustomEvent('facetsChanged', {
|
|
386
|
-
detail: e.detail,
|
|
387
|
-
bubbles: true,
|
|
388
|
-
composed: true,
|
|
389
|
-
});
|
|
390
|
-
this.dispatchEvent(event);
|
|
387
|
+
@selectedFacetsChanged=${(e) => {
|
|
388
|
+
const event = new CustomEvent('facetsChanged', {
|
|
389
|
+
detail: e.detail,
|
|
390
|
+
bubbles: true,
|
|
391
|
+
composed: true,
|
|
392
|
+
});
|
|
393
|
+
this.dispatchEvent(event);
|
|
391
394
|
}}
|
|
392
395
|
></facets-template>
|
|
393
|
-
`;
|
|
394
|
-
}
|
|
395
|
-
static get styles() {
|
|
396
|
+
`;
|
|
397
|
+
}
|
|
398
|
+
static get styles() {
|
|
396
399
|
return css `
|
|
397
400
|
#container.loading {
|
|
398
401
|
opacity: 0.5;
|
|
@@ -474,83 +477,80 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
474
477
|
height: 15px;
|
|
475
478
|
cursor: pointer;
|
|
476
479
|
}
|
|
477
|
-
`;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
__decorate([
|
|
481
|
-
property({ type: Object })
|
|
482
|
-
], CollectionFacets.prototype, "searchService", void 0);
|
|
483
|
-
__decorate([
|
|
484
|
-
property({ type: String })
|
|
485
|
-
], CollectionFacets.prototype, "searchType", void 0);
|
|
486
|
-
__decorate([
|
|
487
|
-
property({ type: Object })
|
|
488
|
-
], CollectionFacets.prototype, "aggregations", void 0);
|
|
489
|
-
__decorate([
|
|
490
|
-
property({ type: Object })
|
|
491
|
-
], CollectionFacets.prototype, "fullYearsHistogramAggregation", void 0);
|
|
492
|
-
__decorate([
|
|
493
|
-
property({ type: String })
|
|
494
|
-
], CollectionFacets.prototype, "minSelectedDate", void 0);
|
|
495
|
-
__decorate([
|
|
496
|
-
property({ type: String })
|
|
497
|
-
], CollectionFacets.prototype, "maxSelectedDate", void 0);
|
|
498
|
-
__decorate([
|
|
499
|
-
property({ type: Boolean })
|
|
500
|
-
], CollectionFacets.prototype, "moreLinksVisible", void 0);
|
|
501
|
-
__decorate([
|
|
502
|
-
property({ type: Boolean })
|
|
503
|
-
], CollectionFacets.prototype, "facetsLoading", void 0);
|
|
504
|
-
__decorate([
|
|
505
|
-
property({ type: Boolean })
|
|
506
|
-
], CollectionFacets.prototype, "fullYearAggregationLoading", void 0);
|
|
507
|
-
__decorate([
|
|
508
|
-
property({ type: Object })
|
|
509
|
-
], CollectionFacets.prototype, "selectedFacets", void 0);
|
|
510
|
-
__decorate([
|
|
511
|
-
property({ type: Boolean })
|
|
512
|
-
], CollectionFacets.prototype, "collapsableFacets", void 0);
|
|
513
|
-
__decorate([
|
|
514
|
-
property({ type: Boolean })
|
|
515
|
-
], CollectionFacets.prototype, "showHistogramDatePicker", void 0);
|
|
516
|
-
__decorate([
|
|
517
|
-
property({ type: String })
|
|
518
|
-
], CollectionFacets.prototype, "query", void 0);
|
|
519
|
-
__decorate([
|
|
520
|
-
property({ type: Object })
|
|
521
|
-
], CollectionFacets.prototype, "filterMap", void 0);
|
|
522
|
-
__decorate([
|
|
523
|
-
property({ type: Object, attribute: false })
|
|
524
|
-
], CollectionFacets.prototype, "modalManager", void 0);
|
|
525
|
-
__decorate([
|
|
526
|
-
property({ type: Object, attribute: false })
|
|
527
|
-
], CollectionFacets.prototype, "resizeObserver", void 0);
|
|
528
|
-
__decorate([
|
|
529
|
-
property({ type: Object, attribute: false })
|
|
530
|
-
], CollectionFacets.prototype, "featureFeedbackService", void 0);
|
|
531
|
-
__decorate([
|
|
532
|
-
property({ type: Object, attribute: false })
|
|
533
|
-
], CollectionFacets.prototype, "recaptchaManager", void 0);
|
|
534
|
-
__decorate([
|
|
535
|
-
property({ type: Object, attribute: false })
|
|
536
|
-
], CollectionFacets.prototype, "analyticsHandler", void 0);
|
|
537
|
-
__decorate([
|
|
538
|
-
property({ type: Object })
|
|
539
|
-
], CollectionFacets.prototype, "languageCodeHandler", void 0);
|
|
540
|
-
__decorate([
|
|
541
|
-
property({ type: Object })
|
|
542
|
-
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
543
|
-
__decorate([
|
|
544
|
-
property({ type: Function })
|
|
545
|
-
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
546
|
-
__decorate([
|
|
547
|
-
state()
|
|
548
|
-
], CollectionFacets.prototype, "openFacets", void 0);
|
|
549
|
-
__decorate([
|
|
550
|
-
|
|
551
|
-
], CollectionFacets
|
|
552
|
-
CollectionFacets
|
|
553
|
-
customElement('collection-facets')
|
|
554
|
-
], CollectionFacets);
|
|
555
|
-
export { CollectionFacets };
|
|
480
|
+
`;
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
__decorate([
|
|
484
|
+
property({ type: Object })
|
|
485
|
+
], CollectionFacets.prototype, "searchService", void 0);
|
|
486
|
+
__decorate([
|
|
487
|
+
property({ type: String })
|
|
488
|
+
], CollectionFacets.prototype, "searchType", void 0);
|
|
489
|
+
__decorate([
|
|
490
|
+
property({ type: Object })
|
|
491
|
+
], CollectionFacets.prototype, "aggregations", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ type: Object })
|
|
494
|
+
], CollectionFacets.prototype, "fullYearsHistogramAggregation", void 0);
|
|
495
|
+
__decorate([
|
|
496
|
+
property({ type: String })
|
|
497
|
+
], CollectionFacets.prototype, "minSelectedDate", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ type: String })
|
|
500
|
+
], CollectionFacets.prototype, "maxSelectedDate", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Boolean })
|
|
503
|
+
], CollectionFacets.prototype, "moreLinksVisible", void 0);
|
|
504
|
+
__decorate([
|
|
505
|
+
property({ type: Boolean })
|
|
506
|
+
], CollectionFacets.prototype, "facetsLoading", void 0);
|
|
507
|
+
__decorate([
|
|
508
|
+
property({ type: Boolean })
|
|
509
|
+
], CollectionFacets.prototype, "fullYearAggregationLoading", void 0);
|
|
510
|
+
__decorate([
|
|
511
|
+
property({ type: Object })
|
|
512
|
+
], CollectionFacets.prototype, "selectedFacets", void 0);
|
|
513
|
+
__decorate([
|
|
514
|
+
property({ type: Boolean })
|
|
515
|
+
], CollectionFacets.prototype, "collapsableFacets", void 0);
|
|
516
|
+
__decorate([
|
|
517
|
+
property({ type: Boolean })
|
|
518
|
+
], CollectionFacets.prototype, "showHistogramDatePicker", void 0);
|
|
519
|
+
__decorate([
|
|
520
|
+
property({ type: String })
|
|
521
|
+
], CollectionFacets.prototype, "query", void 0);
|
|
522
|
+
__decorate([
|
|
523
|
+
property({ type: Object })
|
|
524
|
+
], CollectionFacets.prototype, "filterMap", void 0);
|
|
525
|
+
__decorate([
|
|
526
|
+
property({ type: Object, attribute: false })
|
|
527
|
+
], CollectionFacets.prototype, "modalManager", void 0);
|
|
528
|
+
__decorate([
|
|
529
|
+
property({ type: Object, attribute: false })
|
|
530
|
+
], CollectionFacets.prototype, "resizeObserver", void 0);
|
|
531
|
+
__decorate([
|
|
532
|
+
property({ type: Object, attribute: false })
|
|
533
|
+
], CollectionFacets.prototype, "featureFeedbackService", void 0);
|
|
534
|
+
__decorate([
|
|
535
|
+
property({ type: Object, attribute: false })
|
|
536
|
+
], CollectionFacets.prototype, "recaptchaManager", void 0);
|
|
537
|
+
__decorate([
|
|
538
|
+
property({ type: Object, attribute: false })
|
|
539
|
+
], CollectionFacets.prototype, "analyticsHandler", void 0);
|
|
540
|
+
__decorate([
|
|
541
|
+
property({ type: Object, attribute: false })
|
|
542
|
+
], CollectionFacets.prototype, "languageCodeHandler", void 0);
|
|
543
|
+
__decorate([
|
|
544
|
+
property({ type: Object, attribute: false })
|
|
545
|
+
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
546
|
+
__decorate([
|
|
547
|
+
property({ type: Function })
|
|
548
|
+
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
549
|
+
__decorate([
|
|
550
|
+
state()
|
|
551
|
+
], CollectionFacets.prototype, "openFacets", void 0);
|
|
552
|
+
CollectionFacets = __decorate([
|
|
553
|
+
customElement('collection-facets')
|
|
554
|
+
], CollectionFacets);
|
|
555
|
+
export { CollectionFacets };
|
|
556
556
|
//# sourceMappingURL=collection-facets.js.map
|