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