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