@internetarchive/collection-browser 0.3.2 → 0.3.3-alpha.2
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 +44 -43
- package/dist/src/app-root.js +242 -233
- 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 +1067 -1077
- 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 +74 -74
- package/dist/src/collection-facets/more-facets-content.js +330 -330
- 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 +73 -73
- package/dist/src/collection-facets.js +359 -359
- 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 +46 -45
- package/dist/src/restoration-state-handler.js +230 -220
- 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 +18 -18
- package/dist/src/utils/analytics-events.js +20 -20
- 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 +356 -330
- 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 +91 -91
- 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 +421 -421
- 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 +12 -1
- package/src/collection-browser.ts +26 -21
- package/src/restoration-state-handler.ts +19 -1
- package/test/collection-browser.test.ts +31 -2
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,67 +1,67 @@
|
|
|
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
|
-
let CollectionFacets = class CollectionFacets extends LitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.moreLinksVisible = true;
|
|
17
|
-
this.facetsLoading = false;
|
|
18
|
-
this.fullYearAggregationLoading = false;
|
|
19
|
-
this.collapsableFacets = false;
|
|
20
|
-
this.showHistogramDatePicker = false;
|
|
21
|
-
this.openFacets = {
|
|
22
|
-
subject: false,
|
|
23
|
-
lending: false,
|
|
24
|
-
mediatype: false,
|
|
25
|
-
language: false,
|
|
26
|
-
creator: false,
|
|
27
|
-
collection: false,
|
|
28
|
-
year: false,
|
|
29
|
-
};
|
|
30
|
-
this.allowedFacetCount = 6;
|
|
31
|
-
}
|
|
32
|
-
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 '@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
|
+
let CollectionFacets = class CollectionFacets extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.moreLinksVisible = true;
|
|
17
|
+
this.facetsLoading = false;
|
|
18
|
+
this.fullYearAggregationLoading = false;
|
|
19
|
+
this.collapsableFacets = false;
|
|
20
|
+
this.showHistogramDatePicker = false;
|
|
21
|
+
this.openFacets = {
|
|
22
|
+
subject: false,
|
|
23
|
+
lending: false,
|
|
24
|
+
mediatype: false,
|
|
25
|
+
language: false,
|
|
26
|
+
creator: false,
|
|
27
|
+
collection: false,
|
|
28
|
+
year: false,
|
|
29
|
+
};
|
|
30
|
+
this.allowedFacetCount = 6;
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
33
|
return html `
|
|
34
34
|
<div id="container" class="${this.facetsLoading ? 'loading' : ''}">
|
|
35
|
-
${this.showHistogramDatePicker && this.fullYearsHistogramAggregation
|
|
35
|
+
${this.showHistogramDatePicker && this.fullYearsHistogramAggregation
|
|
36
36
|
? html `
|
|
37
37
|
<div class="facet-group">
|
|
38
38
|
<h1>Year Published <feature-feedback></feature-feedback></h1>
|
|
39
39
|
${this.histogramTemplate}
|
|
40
40
|
</div>
|
|
41
|
-
`
|
|
41
|
+
`
|
|
42
42
|
: nothing}
|
|
43
43
|
${this.mergedFacets.map(facetGroup => this.getFacetGroupTemplate(facetGroup))}
|
|
44
44
|
</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;
|
|
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;
|
|
65
65
|
return html `
|
|
66
66
|
<histogram-date-range
|
|
67
67
|
.minDate=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.first_bucket_key}
|
|
@@ -74,185 +74,185 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
74
74
|
.bins=${fullYearsHistogramAggregation === null || fullYearsHistogramAggregation === void 0 ? void 0 : fullYearsHistogramAggregation.buckets}
|
|
75
75
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
76
76
|
></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];
|
|
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];
|
|
240
240
|
const collapser = html `
|
|
241
241
|
<span class="collapser ${isOpen ? 'open' : ''}"> ${chevronIcon} </span>
|
|
242
|
-
`;
|
|
242
|
+
`;
|
|
243
243
|
return html `
|
|
244
244
|
<div class="facet-group ${this.collapsableFacets ? 'mobile' : ''}">
|
|
245
245
|
<div class="facet-group-header">
|
|
246
246
|
<h1
|
|
247
|
-
@click=${() => {
|
|
248
|
-
const newOpenFacets = { ...this.openFacets };
|
|
249
|
-
newOpenFacets[key] = !isOpen;
|
|
250
|
-
this.openFacets = newOpenFacets;
|
|
247
|
+
@click=${() => {
|
|
248
|
+
const newOpenFacets = { ...this.openFacets };
|
|
249
|
+
newOpenFacets[key] = !isOpen;
|
|
250
|
+
this.openFacets = newOpenFacets;
|
|
251
251
|
}}
|
|
252
|
-
@keyup=${() => {
|
|
253
|
-
const newOpenFacets = { ...this.openFacets };
|
|
254
|
-
newOpenFacets[key] = !isOpen;
|
|
255
|
-
this.openFacets = newOpenFacets;
|
|
252
|
+
@keyup=${() => {
|
|
253
|
+
const newOpenFacets = { ...this.openFacets };
|
|
254
|
+
newOpenFacets[key] = !isOpen;
|
|
255
|
+
this.openFacets = newOpenFacets;
|
|
256
256
|
}}
|
|
257
257
|
>
|
|
258
258
|
${this.collapsableFacets ? collapser : nothing} ${facetGroup.title}
|
|
@@ -264,12 +264,12 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
264
264
|
${this.searchMoreFacetsLink(facetGroup)}
|
|
265
265
|
</div>
|
|
266
266
|
</div>
|
|
267
|
-
`;
|
|
268
|
-
}
|
|
269
|
-
moreFacetsSortingIcon(facetGroup) {
|
|
270
|
-
// Display the sorting icon for every facet group except lending
|
|
271
|
-
return facetGroup.key === 'lending'
|
|
272
|
-
? nothing
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
moreFacetsSortingIcon(facetGroup) {
|
|
270
|
+
// Display the sorting icon for every facet group except lending
|
|
271
|
+
return facetGroup.key === 'lending'
|
|
272
|
+
? nothing
|
|
273
273
|
: html `
|
|
274
274
|
<input
|
|
275
275
|
class="sorting-icon"
|
|
@@ -278,39 +278,39 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
278
278
|
src="https://archive.org/images/filter-count.png"
|
|
279
279
|
alt="Sort alphabetically"
|
|
280
280
|
/>
|
|
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
|
-
}
|
|
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
|
+
}
|
|
301
301
|
return html `<button
|
|
302
302
|
class="more-link"
|
|
303
|
-
@click=${() => {
|
|
304
|
-
this.showMoreFacetsModal(facetGroup, 'count');
|
|
305
|
-
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
303
|
+
@click=${() => {
|
|
304
|
+
this.showMoreFacetsModal(facetGroup, 'count');
|
|
305
|
+
this.dispatchEvent(new CustomEvent('showMoreFacets', { detail: facetGroup.key }));
|
|
306
306
|
}}
|
|
307
307
|
>
|
|
308
308
|
More...
|
|
309
|
-
</button>`;
|
|
310
|
-
}
|
|
311
|
-
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
312
|
-
var _a, _b;
|
|
313
|
-
const facetAggrKey = facetGroup.key;
|
|
309
|
+
</button>`;
|
|
310
|
+
}
|
|
311
|
+
async showMoreFacetsModal(facetGroup, sortedBy) {
|
|
312
|
+
var _a, _b;
|
|
313
|
+
const facetAggrKey = facetGroup.key;
|
|
314
314
|
const customModalContent = html `
|
|
315
315
|
<more-facets-content
|
|
316
316
|
.facetKey=${facetGroup.key}
|
|
@@ -323,52 +323,52 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
323
323
|
.languageCodeHandler=${this.languageCodeHandler}
|
|
324
324
|
.selectedFacets=${this.selectedFacets}
|
|
325
325
|
.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);
|
|
326
|
+
@facetsChanged=${(e) => {
|
|
327
|
+
const event = new CustomEvent('facetsChanged', {
|
|
328
|
+
detail: e.detail,
|
|
329
|
+
bubbles: true,
|
|
330
|
+
composed: true,
|
|
331
|
+
});
|
|
332
|
+
this.dispatchEvent(event);
|
|
333
333
|
}}
|
|
334
334
|
>
|
|
335
335
|
</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) {
|
|
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) {
|
|
354
354
|
return html `
|
|
355
355
|
<facets-template
|
|
356
356
|
.facetGroup=${facetGroup}
|
|
357
357
|
.selectedFacets=${this.selectedFacets}
|
|
358
358
|
.renderOn=${'page'}
|
|
359
359
|
.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);
|
|
360
|
+
@selectedFacetsChanged=${(e) => {
|
|
361
|
+
const event = new CustomEvent('facetsChanged', {
|
|
362
|
+
detail: e.detail,
|
|
363
|
+
bubbles: true,
|
|
364
|
+
composed: true,
|
|
365
|
+
});
|
|
366
|
+
this.dispatchEvent(event);
|
|
367
367
|
}}
|
|
368
368
|
></facets-template>
|
|
369
|
-
`;
|
|
370
|
-
}
|
|
371
|
-
static get styles() {
|
|
369
|
+
`;
|
|
370
|
+
}
|
|
371
|
+
static get styles() {
|
|
372
372
|
return css `
|
|
373
373
|
#container.loading {
|
|
374
374
|
opacity: 0.5;
|
|
@@ -441,68 +441,68 @@ let CollectionFacets = class CollectionFacets extends LitElement {
|
|
|
441
441
|
height: 15px;
|
|
442
442
|
cursor: pointer;
|
|
443
443
|
}
|
|
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, "languageCodeHandler", void 0);
|
|
492
|
-
__decorate([
|
|
493
|
-
property({ type: Object })
|
|
494
|
-
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
495
|
-
__decorate([
|
|
496
|
-
property({ type: Function })
|
|
497
|
-
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
498
|
-
__decorate([
|
|
499
|
-
state()
|
|
500
|
-
], CollectionFacets.prototype, "openFacets", void 0);
|
|
501
|
-
__decorate([
|
|
502
|
-
property({ type: Object, attribute: false })
|
|
503
|
-
], CollectionFacets.prototype, "allowedFacetCount", void 0);
|
|
504
|
-
CollectionFacets = __decorate([
|
|
505
|
-
customElement('collection-facets')
|
|
506
|
-
], CollectionFacets);
|
|
507
|
-
export { CollectionFacets };
|
|
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, "languageCodeHandler", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ type: Object })
|
|
494
|
+
], CollectionFacets.prototype, "collectionNameCache", void 0);
|
|
495
|
+
__decorate([
|
|
496
|
+
property({ type: Function })
|
|
497
|
+
], CollectionFacets.prototype, "onFacetClick", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
state()
|
|
500
|
+
], CollectionFacets.prototype, "openFacets", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ type: Object, attribute: false })
|
|
503
|
+
], CollectionFacets.prototype, "allowedFacetCount", void 0);
|
|
504
|
+
CollectionFacets = __decorate([
|
|
505
|
+
customElement('collection-facets')
|
|
506
|
+
], CollectionFacets);
|
|
507
|
+
export { CollectionFacets };
|
|
508
508
|
//# sourceMappingURL=collection-facets.js.map
|