@internetarchive/collection-browser 0.4.9-alpha.2 → 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 +1201 -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/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 +1 -0
- 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,45 +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
|
-
* 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
45
|
<h1>
|
|
@@ -54,32 +54,32 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
54
54
|
</h1>
|
|
55
55
|
${this.histogramTemplate}
|
|
56
56
|
</div>
|
|
57
|
-
`
|
|
57
|
+
`
|
|
58
58
|
: nothing}
|
|
59
59
|
${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
|
|
60
60
|
</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
|
|
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
|
|
83
83
|
: html `
|
|
84
84
|
<histogram-date-range
|
|
85
85
|
.minDate=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.first_bucket_key}
|
|
@@ -92,250 +92,250 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
92
92
|
.bins=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.buckets}
|
|
93
93
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
94
94
|
></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, _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];
|
|
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];
|
|
264
264
|
const collapser = html `
|
|
265
265
|
<span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
|
|
266
|
-
`;
|
|
266
|
+
`;
|
|
267
267
|
return html `
|
|
268
268
|
<div class="facet-group ${this.collapsableFacets ? 'mobile' : ''}">
|
|
269
269
|
<div class="facet-group-header">
|
|
270
270
|
<h1
|
|
271
|
-
@click=${() => {
|
|
272
|
-
const newOpenFacets = { ...this.openFacets };
|
|
273
|
-
newOpenFacets[key] = !isOpen;
|
|
274
|
-
this.openFacets = newOpenFacets;
|
|
271
|
+
@click=${() => {
|
|
272
|
+
const newOpenFacets = { ...this.openFacets };
|
|
273
|
+
newOpenFacets[key] = !isOpen;
|
|
274
|
+
this.openFacets = newOpenFacets;
|
|
275
275
|
}}
|
|
276
|
-
@keyup=${() => {
|
|
277
|
-
const newOpenFacets = { ...this.openFacets };
|
|
278
|
-
newOpenFacets[key] = !isOpen;
|
|
279
|
-
this.openFacets = newOpenFacets;
|
|
276
|
+
@keyup=${() => {
|
|
277
|
+
const newOpenFacets = { ...this.openFacets };
|
|
278
|
+
newOpenFacets[key] = !isOpen;
|
|
279
|
+
this.openFacets = newOpenFacets;
|
|
280
280
|
}}
|
|
281
281
|
>
|
|
282
282
|
${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
|
|
283
283
|
</h1>
|
|
284
284
|
</div>
|
|
285
285
|
<div class="facet-group-content ${isOpen ? 'open' : ''}">
|
|
286
|
-
${this.facetsLoading
|
|
287
|
-
? this.getTombstoneFacetGroupTemplate()
|
|
286
|
+
${this.facetsLoading
|
|
287
|
+
? this.getTombstoneFacetGroupTemplate()
|
|
288
288
|
: html `
|
|
289
289
|
${this.getFacetTemplate(facetGroup)}
|
|
290
290
|
${this.searchMoreFacetsLink(facetGroup)}
|
|
291
291
|
`}
|
|
292
292
|
</div>
|
|
293
293
|
</div>
|
|
294
|
-
`;
|
|
295
|
-
}
|
|
296
|
-
getTombstoneFacetGroupTemplate() {
|
|
297
|
-
// Render five tombstone rows
|
|
294
|
+
`;
|
|
295
|
+
}
|
|
296
|
+
getTombstoneFacetGroupTemplate() {
|
|
297
|
+
// Render five tombstone rows
|
|
298
298
|
return html `
|
|
299
299
|
${map(Array(5).fill(null), () => html `<facet-tombstone-row></facet-tombstone-row>`)}
|
|
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
|
-
}
|
|
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
|
+
}
|
|
320
320
|
return html `<button
|
|
321
321
|
class="more-link"
|
|
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 }));
|
|
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 }));
|
|
331
331
|
}}
|
|
332
332
|
>
|
|
333
333
|
More...
|
|
334
|
-
</button>`;
|
|
335
|
-
}
|
|
336
|
-
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
337
|
-
var _a, _b;
|
|
338
|
-
const facetAggrKey = facetGroup.key;
|
|
334
|
+
</button>`;
|
|
335
|
+
}
|
|
336
|
+
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
337
|
+
var _a, _b;
|
|
338
|
+
const facetAggrKey = facetGroup.key;
|
|
339
339
|
const customModalContent = html `
|
|
340
340
|
<more-facets-content
|
|
341
341
|
.analyticsHandler=${this.analyticsHandler}
|
|
@@ -350,52 +350,52 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
350
350
|
.languageCodeHandler=${this.languageCodeHandler}
|
|
351
351
|
.selectedFacets=${this.selectedFacets}
|
|
352
352
|
.sortedBy=${sortedBy}
|
|
353
|
-
@facetsChanged=${(e) => {
|
|
354
|
-
const event = new CustomEvent('facetsChanged', {
|
|
355
|
-
detail: e.detail,
|
|
356
|
-
bubbles: true,
|
|
357
|
-
composed: true,
|
|
358
|
-
});
|
|
359
|
-
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);
|
|
360
360
|
}}
|
|
361
361
|
>
|
|
362
362
|
</more-facets-content>
|
|
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) {
|
|
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) {
|
|
381
381
|
return html `
|
|
382
382
|
<facets-template
|
|
383
383
|
.facetGroup=${facetGroup}
|
|
384
384
|
.selectedFacets=${this.selectedFacets}
|
|
385
385
|
.renderOn=${'page'}
|
|
386
386
|
.collectionNameCache=${this.collectionNameCache}
|
|
387
|
-
@selectedFacetsChanged=${(e) => {
|
|
388
|
-
const event = new CustomEvent('facetsChanged', {
|
|
389
|
-
detail: e.detail,
|
|
390
|
-
bubbles: true,
|
|
391
|
-
composed: true,
|
|
392
|
-
});
|
|
393
|
-
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);
|
|
394
394
|
}}
|
|
395
395
|
></facets-template>
|
|
396
|
-
`;
|
|
397
|
-
}
|
|
398
|
-
static get styles() {
|
|
396
|
+
`;
|
|
397
|
+
}
|
|
398
|
+
static get styles() {
|
|
399
399
|
return css `
|
|
400
400
|
#container.loading {
|
|
401
401
|
opacity: 0.5;
|
|
@@ -477,80 +477,80 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
477
477
|
height: 15px;
|
|
478
478
|
cursor: pointer;
|
|
479
479
|
}
|
|
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 };
|
|
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
|