@internetarchive/collection-browser 1.14.14-alpha.1 → 1.14.16-alpha.1
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +0 -2
- package/dist/src/app-root.js +0 -8
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +24 -169
- package/dist/src/collection-browser.js +68 -684
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +2 -2
- package/dist/src/collection-facets/facet-row.js +5 -10
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/facets-template.d.ts +2 -2
- package/dist/src/collection-facets/facets-template.js +2 -2
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +2 -9
- package/dist/src/collection-facets/more-facets-content.js +13 -18
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets.d.ts +2 -3
- package/dist/src/collection-facets.js +5 -9
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +402 -0
- package/dist/src/data-source/collection-browser-data-source.js +742 -0
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -0
- package/dist/src/data-source/models.d.ts +35 -0
- package/dist/src/data-source/models.js +2 -0
- package/dist/src/data-source/models.js.map +1 -0
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +2 -2
- package/dist/src/tiles/hover/hover-pane-controller.js +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +2 -2
- package/dist/src/tiles/hover/tile-hover-pane.js +2 -2
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +3 -3
- package/dist/src/tiles/list/tile-list.js +7 -13
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +2 -2
- package/dist/src/tiles/tile-dispatcher.js +2 -3
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +43 -67
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +6 -17
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +0 -5
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +0 -5
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/index.ts +4 -0
- package/package.json +3 -3
- package/src/app-root.ts +0 -10
- package/src/collection-browser.ts +79 -841
- package/src/collection-facets/facet-row.ts +4 -9
- package/src/collection-facets/facets-template.ts +3 -3
- package/src/collection-facets/more-facets-content.ts +15 -20
- package/src/collection-facets.ts +5 -10
- package/src/data-source/collection-browser-data-source.ts +1133 -0
- package/src/data-source/models.ts +45 -0
- package/src/tiles/hover/hover-pane-controller.ts +3 -3
- package/src/tiles/hover/tile-hover-pane.ts +3 -3
- package/src/tiles/list/tile-list.ts +13 -18
- package/src/tiles/tile-dispatcher.ts +3 -4
- package/test/collection-browser.test.ts +57 -79
- package/test/collection-facets/facet-row.test.ts +5 -18
- package/test/collection-facets.test.ts +0 -5
- package/test/tiles/list/tile-list.test.ts +0 -5
- package/dist/test/mocks/mock-collection-name-cache.d.ts +0 -9
- package/dist/test/mocks/mock-collection-name-cache.js +0 -18
- package/dist/test/mocks/mock-collection-name-cache.js.map +0 -1
- package/test/mocks/mock-collection-name-cache.ts +0 -24
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
nothing,
|
|
8
8
|
} from 'lit';
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
-
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
11
10
|
import eyeIcon from '../assets/img/icons/eye';
|
|
12
11
|
import eyeClosedIcon from '../assets/img/icons/eye-closed';
|
|
13
12
|
import type {
|
|
@@ -16,6 +15,7 @@ import type {
|
|
|
16
15
|
FacetEventDetails,
|
|
17
16
|
FacetState,
|
|
18
17
|
} from '../models';
|
|
18
|
+
import type { CollectionTitles } from '../data-source/models';
|
|
19
19
|
|
|
20
20
|
@customElement('facet-row')
|
|
21
21
|
export class FacetRow extends LitElement {
|
|
@@ -31,7 +31,7 @@ export class FacetRow extends LitElement {
|
|
|
31
31
|
|
|
32
32
|
/** The collection name cache for converting collection identifiers to titles */
|
|
33
33
|
@property({ type: Object })
|
|
34
|
-
|
|
34
|
+
collectionTitles?: CollectionTitles;
|
|
35
35
|
|
|
36
36
|
//
|
|
37
37
|
// COMPONENT LIFECYCLE METHODS
|
|
@@ -56,18 +56,13 @@ export class FacetRow extends LitElement {
|
|
|
56
56
|
const showOnlyCheckboxId = `${facetType}:${bucket.key}-show-only`;
|
|
57
57
|
const negativeCheckboxId = `${facetType}:${bucket.key}-negative`;
|
|
58
58
|
|
|
59
|
-
// For collections, we
|
|
60
|
-
// so we use the `async-collection-name` widget.
|
|
59
|
+
// For collections, we render the collection title as a link.
|
|
61
60
|
// For other facet types, we just have a static value to use.
|
|
62
61
|
const bucketTextDisplay =
|
|
63
62
|
facetType !== 'collection'
|
|
64
63
|
? html`${bucket.displayText ?? bucket.key}`
|
|
65
64
|
: html`<a href="/details/${bucket.key}">
|
|
66
|
-
|
|
67
|
-
.collectionNameCache=${this.collectionNameCache}
|
|
68
|
-
.identifier=${bucket.key}
|
|
69
|
-
placeholder="-"
|
|
70
|
-
></async-collection-name>
|
|
65
|
+
${this.collectionTitles?.get(bucket.key) ?? bucket.key}
|
|
71
66
|
</a> `;
|
|
72
67
|
|
|
73
68
|
const facetHidden = bucket.state === 'hidden';
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from 'lit';
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js';
|
|
10
10
|
import { repeat } from 'lit/directives/repeat.js';
|
|
11
|
-
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
12
11
|
import {
|
|
13
12
|
FacetGroup,
|
|
14
13
|
FacetBucket,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
getDefaultSelectedFacets,
|
|
17
16
|
FacetEventDetails,
|
|
18
17
|
} from '../models';
|
|
18
|
+
import type { CollectionTitles } from '../data-source/models';
|
|
19
19
|
import { FacetRow } from './facet-row';
|
|
20
20
|
|
|
21
21
|
@customElement('facets-template')
|
|
@@ -27,7 +27,7 @@ export class FacetsTemplate extends LitElement {
|
|
|
27
27
|
@property({ type: String }) renderOn?: string;
|
|
28
28
|
|
|
29
29
|
@property({ type: Object })
|
|
30
|
-
|
|
30
|
+
collectionTitles?: CollectionTitles;
|
|
31
31
|
|
|
32
32
|
private facetClicked(e: CustomEvent<FacetEventDetails>) {
|
|
33
33
|
const { bucket, negative } = e.detail;
|
|
@@ -126,7 +126,7 @@ export class FacetsTemplate extends LitElement {
|
|
|
126
126
|
bucket => html`<facet-row
|
|
127
127
|
.facetType=${facetGroup.key}
|
|
128
128
|
.bucket=${bucket}
|
|
129
|
-
.
|
|
129
|
+
.collectionTitles=${this.collectionTitles}
|
|
130
130
|
@facetClick=${this.facetClicked}
|
|
131
131
|
></facet-row>`
|
|
132
132
|
)}
|
|
@@ -13,13 +13,13 @@ import { customElement, property, state } from 'lit/decorators.js';
|
|
|
13
13
|
import {
|
|
14
14
|
Aggregation,
|
|
15
15
|
Bucket,
|
|
16
|
+
PageType,
|
|
16
17
|
SearchServiceInterface,
|
|
17
18
|
SearchParams,
|
|
18
19
|
SearchType,
|
|
19
20
|
AggregationSortType,
|
|
20
21
|
FilterMap,
|
|
21
22
|
} from '@internetarchive/search-service';
|
|
22
|
-
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
23
23
|
import type { ModalManagerInterface } from '@internetarchive/modal-manager';
|
|
24
24
|
import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
|
|
25
25
|
import {
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
valueFacetSort,
|
|
33
33
|
defaultFacetSort,
|
|
34
34
|
} from '../models';
|
|
35
|
+
import type { CollectionTitles } from '../data-source/models';
|
|
35
36
|
import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
|
|
36
37
|
import './more-facets-pagination';
|
|
37
38
|
import './facets-template';
|
|
@@ -61,7 +62,7 @@ export class MoreFacetsContent extends LitElement {
|
|
|
61
62
|
@property({ type: String }) withinCollection?: string;
|
|
62
63
|
|
|
63
64
|
@property({ type: Object })
|
|
64
|
-
|
|
65
|
+
collectionTitles?: CollectionTitles;
|
|
65
66
|
|
|
66
67
|
@property({ type: Object }) selectedFacets?: SelectedFacets;
|
|
67
68
|
|
|
@@ -142,7 +143,10 @@ export class MoreFacetsContent extends LitElement {
|
|
|
142
143
|
const aggregationsSize = 65535; // todo - do we want to have all the records at once?
|
|
143
144
|
|
|
144
145
|
const collectionParams = this.withinCollection
|
|
145
|
-
? {
|
|
146
|
+
? {
|
|
147
|
+
pageType: 'collection_details' as PageType,
|
|
148
|
+
pageTarget: this.withinCollection,
|
|
149
|
+
}
|
|
146
150
|
: null;
|
|
147
151
|
|
|
148
152
|
const params: SearchParams = {
|
|
@@ -159,6 +163,13 @@ export class MoreFacetsContent extends LitElement {
|
|
|
159
163
|
|
|
160
164
|
this.facetGroup = this.aggregationFacetGroups;
|
|
161
165
|
this.facetsLoading = false;
|
|
166
|
+
|
|
167
|
+
const collectionTitles = results?.success?.response?.collectionTitles;
|
|
168
|
+
if (collectionTitles) {
|
|
169
|
+
for (const [id, title] of Object.entries(collectionTitles)) {
|
|
170
|
+
this.collectionTitles?.set(id, title);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
private pageNumberClicked(e: CustomEvent<{ page: number }>) {
|
|
@@ -285,9 +296,6 @@ export class MoreFacetsContent extends LitElement {
|
|
|
285
296
|
!suppressedCollections[bucketKey] && !bucketKey?.startsWith('fav-')
|
|
286
297
|
);
|
|
287
298
|
});
|
|
288
|
-
|
|
289
|
-
// asynchronously load the collection name
|
|
290
|
-
this.preloadCollectionNames(castedBuckets);
|
|
291
299
|
}
|
|
292
300
|
|
|
293
301
|
// find length and pagination size for modal pagination
|
|
@@ -320,26 +328,13 @@ export class MoreFacetsContent extends LitElement {
|
|
|
320
328
|
return facetGroups;
|
|
321
329
|
}
|
|
322
330
|
|
|
323
|
-
/**
|
|
324
|
-
* for collections, we need to asynchronously load the collection name
|
|
325
|
-
* so we use the `async-collection-name` widget and for the rest, we have a static value to use
|
|
326
|
-
*
|
|
327
|
-
* @param castedBuckets
|
|
328
|
-
*/
|
|
329
|
-
private preloadCollectionNames(castedBuckets: any[]) {
|
|
330
|
-
const collectionIds = castedBuckets?.map(option => option.key);
|
|
331
|
-
const collectionIdsArray = Array.from(new Set(collectionIds)) as string[];
|
|
332
|
-
|
|
333
|
-
this.collectionNameCache?.preloadIdentifiers(collectionIdsArray);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
331
|
private get getMoreFacetsTemplate(): TemplateResult {
|
|
337
332
|
return html`
|
|
338
333
|
<facets-template
|
|
339
334
|
.facetGroup=${this.mergedFacets?.shift()}
|
|
340
335
|
.selectedFacets=${this.selectedFacets}
|
|
341
336
|
.renderOn=${'modal'}
|
|
342
|
-
.
|
|
337
|
+
.collectionTitles=${this.collectionTitles}
|
|
343
338
|
@selectedFacetsChanged=${(e: CustomEvent) => {
|
|
344
339
|
this.selectedFacets = e.detail;
|
|
345
340
|
}}
|
package/src/collection-facets.ts
CHANGED
|
@@ -22,8 +22,6 @@ import type {
|
|
|
22
22
|
} from '@internetarchive/search-service';
|
|
23
23
|
import '@internetarchive/histogram-date-range';
|
|
24
24
|
import '@internetarchive/feature-feedback';
|
|
25
|
-
import '@internetarchive/collection-name-cache';
|
|
26
|
-
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
27
25
|
import {
|
|
28
26
|
ModalConfig,
|
|
29
27
|
ModalManagerInterface,
|
|
@@ -47,6 +45,7 @@ import {
|
|
|
47
45
|
suppressedCollections,
|
|
48
46
|
defaultFacetSort,
|
|
49
47
|
} from './models';
|
|
48
|
+
import type { CollectionTitles } from './data-source/models';
|
|
50
49
|
import './collection-facets/more-facets-content';
|
|
51
50
|
import './collection-facets/facets-template';
|
|
52
51
|
import './collection-facets/facet-tombstone-row';
|
|
@@ -118,7 +117,7 @@ export class CollectionFacets extends LitElement {
|
|
|
118
117
|
analyticsHandler?: AnalyticsManagerInterface;
|
|
119
118
|
|
|
120
119
|
@property({ type: Object, attribute: false })
|
|
121
|
-
|
|
120
|
+
collectionTitles?: CollectionTitles;
|
|
122
121
|
|
|
123
122
|
@state() openFacets: Record<FacetOption, boolean> = {
|
|
124
123
|
subject: false,
|
|
@@ -188,11 +187,7 @@ export class CollectionFacets extends LitElement {
|
|
|
188
187
|
data-id=${collxn}
|
|
189
188
|
@click=${this.partOfCollectionClicked}
|
|
190
189
|
>
|
|
191
|
-
|
|
192
|
-
.collectionNameCache=${this.collectionNameCache}
|
|
193
|
-
.identifier=${collxn}
|
|
194
|
-
placeholder=${collxn}
|
|
195
|
-
></async-collection-name>
|
|
190
|
+
${this.collectionTitles?.get(collxn) ?? collxn}
|
|
196
191
|
</a>
|
|
197
192
|
</li>`;
|
|
198
193
|
})}
|
|
@@ -652,7 +647,7 @@ export class CollectionFacets extends LitElement {
|
|
|
652
647
|
.modalManager=${this.modalManager}
|
|
653
648
|
.searchService=${this.searchService}
|
|
654
649
|
.searchType=${this.searchType}
|
|
655
|
-
.
|
|
650
|
+
.collectionTitles=${this.collectionTitles}
|
|
656
651
|
.selectedFacets=${this.selectedFacets}
|
|
657
652
|
.sortedBy=${sortedBy}
|
|
658
653
|
@facetsChanged=${(e: CustomEvent) => {
|
|
@@ -694,7 +689,7 @@ export class CollectionFacets extends LitElement {
|
|
|
694
689
|
.facetGroup=${facetGroup}
|
|
695
690
|
.selectedFacets=${this.selectedFacets}
|
|
696
691
|
.renderOn=${'page'}
|
|
697
|
-
.
|
|
692
|
+
.collectionTitles=${this.collectionTitles}
|
|
698
693
|
@selectedFacetsChanged=${(e: CustomEvent) => {
|
|
699
694
|
const event = new CustomEvent<SelectedFacets>('facetsChanged', {
|
|
700
695
|
detail: e.detail,
|