@internetarchive/collection-browser 1.14.17-alpha.4 → 1.14.17-alpha.40
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 +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/src/collection-browser.d.ts +6 -13
- package/dist/src/collection-browser.js +56 -30
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +194 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
- package/dist/src/data-source/collection-browser-data-source.d.ts +62 -174
- package/dist/src/data-source/collection-browser-data-source.js +185 -64
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +42 -0
- package/dist/src/data-source/collection-browser-query-state.js +2 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
- package/dist/src/data-source/models.d.ts +1 -39
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/models.d.ts +3 -2
- package/dist/src/models.js +24 -22
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +1 -0
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +1 -0
- package/dist/src/tiles/grid/item-tile.js +28 -1
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +13 -8
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +3 -0
- package/dist/src/tiles/item-image.js +30 -2
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +1 -0
- package/dist/src/tiles/list/tile-list.js +30 -1
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +3 -2
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.d.ts +5 -1
- package/dist/src/tiles/tile-display-value-provider.js +15 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/test/collection-browser.test.js +2 -6
- package/dist/test/collection-browser.test.js.map +1 -1
- package/index.ts +3 -5
- package/package.json +2 -2
- package/src/collection-browser.ts +70 -49
- package/src/data-source/collection-browser-data-source-interface.ts +245 -0
- package/src/data-source/collection-browser-data-source.ts +237 -281
- package/src/data-source/collection-browser-query-state.ts +53 -0
- package/src/data-source/models.ts +0 -47
- package/src/models.ts +7 -3
- package/src/sort-filter-bar/sort-filter-bar.ts +1 -0
- package/src/tiles/grid/item-tile.ts +36 -1
- package/src/tiles/grid/tile-stats.ts +12 -7
- package/src/tiles/item-image.ts +28 -0
- package/src/tiles/list/tile-list.ts +37 -1
- package/src/tiles/tile-dispatcher.ts +2 -1
- package/src/tiles/tile-display-value-provider.ts +19 -1
- package/test/collection-browser.test.ts +2 -8
|
@@ -56,14 +56,11 @@ import {
|
|
|
56
56
|
RestorationStateHandler,
|
|
57
57
|
RestorationState,
|
|
58
58
|
} from './restoration-state-handler';
|
|
59
|
-
import {
|
|
60
|
-
CollectionBrowserDataSource,
|
|
61
|
-
CollectionBrowserDataSourceInterface,
|
|
62
|
-
} from './data-source/collection-browser-data-source';
|
|
59
|
+
import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
|
|
63
60
|
import type {
|
|
64
61
|
CollectionBrowserQueryState,
|
|
65
62
|
CollectionBrowserSearchInterface,
|
|
66
|
-
} from './data-source/
|
|
63
|
+
} from './data-source/collection-browser-query-state';
|
|
67
64
|
import chevronIcon from './assets/img/icons/chevron';
|
|
68
65
|
import type { PlaceholderType } from './empty-placeholder';
|
|
69
66
|
import './empty-placeholder';
|
|
@@ -77,6 +74,7 @@ import { sha1 } from './utils/sha1';
|
|
|
77
74
|
import type { CollectionFacets } from './collection-facets';
|
|
78
75
|
import type { ManageableItem } from './manage/manage-bar';
|
|
79
76
|
import { formatDate } from './utils/format-date';
|
|
77
|
+
import type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';
|
|
80
78
|
|
|
81
79
|
@customElement('collection-browser')
|
|
82
80
|
export class CollectionBrowser
|
|
@@ -134,6 +132,8 @@ export class CollectionBrowser
|
|
|
134
132
|
|
|
135
133
|
@property({ type: Boolean }) suppressFacets = false;
|
|
136
134
|
|
|
135
|
+
@property({ type: Boolean }) suppressSortBar = false;
|
|
136
|
+
|
|
137
137
|
@property({ type: Boolean }) clearResultsOnEmptyQuery = false;
|
|
138
138
|
|
|
139
139
|
@property({ type: String }) collectionPagePath: string = '/details/';
|
|
@@ -171,8 +171,6 @@ export class CollectionBrowser
|
|
|
171
171
|
|
|
172
172
|
@property({ type: Boolean }) isLoansTab = false;
|
|
173
173
|
|
|
174
|
-
@property({ type: String }) queryErrorMessage?: string;
|
|
175
|
-
|
|
176
174
|
/**
|
|
177
175
|
* The results per page so we can paginate.
|
|
178
176
|
*
|
|
@@ -249,9 +247,13 @@ export class CollectionBrowser
|
|
|
249
247
|
|
|
250
248
|
private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;
|
|
251
249
|
|
|
250
|
+
constructor() {
|
|
251
|
+
super();
|
|
252
|
+
this.addController(this.dataSource);
|
|
253
|
+
}
|
|
254
|
+
|
|
252
255
|
private tileModelAtCellIndex(index: number): TileModel | undefined {
|
|
253
|
-
const
|
|
254
|
-
const model = this.dataSource.getTileModelAt(offsetIndex);
|
|
256
|
+
const model = this.dataSource.getTileModelAt(index);
|
|
255
257
|
/**
|
|
256
258
|
* If we encounter a model we don't have yet and we're not in the middle of an
|
|
257
259
|
* automated scroll, fetch the page and just return undefined.
|
|
@@ -260,8 +262,8 @@ export class CollectionBrowser
|
|
|
260
262
|
* We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
|
|
261
263
|
* user may never see.
|
|
262
264
|
*/
|
|
263
|
-
if (!model && !this.isScrollingToCell) {
|
|
264
|
-
const pageNumber = Math.floor(
|
|
265
|
+
if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
|
|
266
|
+
const pageNumber = Math.floor(index / this.pageSize) + 1;
|
|
265
267
|
this.dataSource.fetchPage(pageNumber);
|
|
266
268
|
}
|
|
267
269
|
return model;
|
|
@@ -328,6 +330,7 @@ export class CollectionBrowser
|
|
|
328
330
|
* Sets the state for whether the initial set of search results is loading in.
|
|
329
331
|
*/
|
|
330
332
|
setSearchResultsLoading(loading: boolean): void {
|
|
333
|
+
console.log('setting search results loading to', loading);
|
|
331
334
|
this.searchResultsLoading = loading;
|
|
332
335
|
}
|
|
333
336
|
|
|
@@ -335,6 +338,7 @@ export class CollectionBrowser
|
|
|
335
338
|
* Sets the state for whether facet data is loading in
|
|
336
339
|
*/
|
|
337
340
|
setFacetsLoading(loading: boolean): void {
|
|
341
|
+
console.log('setting facets loading to', loading);
|
|
338
342
|
this.facetsLoading = loading;
|
|
339
343
|
}
|
|
340
344
|
|
|
@@ -449,7 +453,7 @@ export class CollectionBrowser
|
|
|
449
453
|
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
450
454
|
}
|
|
451
455
|
|
|
452
|
-
if (this.queryErrorMessage) {
|
|
456
|
+
if (this.dataSource.queryErrorMessage) {
|
|
453
457
|
this.placeholderType =
|
|
454
458
|
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
455
459
|
}
|
|
@@ -461,7 +465,7 @@ export class CollectionBrowser
|
|
|
461
465
|
.placeholderType=${this.placeholderType}
|
|
462
466
|
?isMobileView=${this.mobileView}
|
|
463
467
|
?isCollection=${!!this.withinCollection}
|
|
464
|
-
.detailMessage=${this.queryErrorMessage ?? ''}
|
|
468
|
+
.detailMessage=${this.dataSource.queryErrorMessage ?? ''}
|
|
465
469
|
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
466
470
|
></empty-placeholder>
|
|
467
471
|
${this.infiniteScrollerTemplate}
|
|
@@ -604,7 +608,9 @@ export class CollectionBrowser
|
|
|
604
608
|
});
|
|
605
609
|
}
|
|
606
610
|
|
|
607
|
-
private get sortFilterBarTemplate() {
|
|
611
|
+
private get sortFilterBarTemplate(): TemplateResult | typeof nothing {
|
|
612
|
+
if (this.suppressSortBar) return nothing;
|
|
613
|
+
|
|
608
614
|
return html`
|
|
609
615
|
<sort-filter-bar
|
|
610
616
|
.defaultSortField=${this.defaultSortField}
|
|
@@ -987,12 +993,49 @@ export class CollectionBrowser
|
|
|
987
993
|
);
|
|
988
994
|
}
|
|
989
995
|
|
|
996
|
+
async installDataSourceAndQueryState(
|
|
997
|
+
dataSource: CollectionBrowserDataSourceInterface,
|
|
998
|
+
queryState: CollectionBrowserQueryState
|
|
999
|
+
): Promise<void> {
|
|
1000
|
+
console.log('installing in CB:', dataSource, queryState);
|
|
1001
|
+
if (this.dataSource) this.removeController(this.dataSource);
|
|
1002
|
+
this.dataSource = dataSource;
|
|
1003
|
+
this.addController(this.dataSource);
|
|
1004
|
+
|
|
1005
|
+
this.baseQuery = queryState.baseQuery;
|
|
1006
|
+
this.profileElement = queryState.profileElement;
|
|
1007
|
+
this.searchType = queryState.searchType;
|
|
1008
|
+
this.selectedFacets = queryState.selectedFacets;
|
|
1009
|
+
this.minSelectedDate = queryState.minSelectedDate;
|
|
1010
|
+
this.maxSelectedDate = queryState.maxSelectedDate;
|
|
1011
|
+
this.selectedSort = queryState.selectedSort ?? SortField.default;
|
|
1012
|
+
this.sortDirection = queryState.sortDirection;
|
|
1013
|
+
this.selectedTitleFilter = queryState.selectedTitleFilter;
|
|
1014
|
+
this.selectedCreatorFilter = queryState.selectedCreatorFilter;
|
|
1015
|
+
|
|
1016
|
+
this.requestUpdate();
|
|
1017
|
+
await this.updateComplete;
|
|
1018
|
+
|
|
1019
|
+
if (!this.searchResultsLoading) {
|
|
1020
|
+
this.setTotalResultCount(this.dataSource.totalResults);
|
|
1021
|
+
this.setTileCount(this.dataSource.size);
|
|
1022
|
+
this.refreshVisibleResults();
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
990
1026
|
firstUpdated(): void {
|
|
991
1027
|
this.setupStateRestorationObserver();
|
|
992
1028
|
this.restoreState();
|
|
993
1029
|
}
|
|
994
1030
|
|
|
995
1031
|
updated(changed: PropertyValues) {
|
|
1032
|
+
console.log(
|
|
1033
|
+
'* CB UPDATED\n',
|
|
1034
|
+
[...changed.entries()]
|
|
1035
|
+
.map(([k, v]) => `${String(k)}: ${v} => ${this[k as keyof this]}`)
|
|
1036
|
+
.join('\n')
|
|
1037
|
+
);
|
|
1038
|
+
|
|
996
1039
|
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
997
1040
|
if (!this.leftColIntersectionObserver) {
|
|
998
1041
|
this.setupLeftColumnScrollListeners();
|
|
@@ -1252,7 +1295,8 @@ export class CollectionBrowser
|
|
|
1252
1295
|
);
|
|
1253
1296
|
}
|
|
1254
1297
|
|
|
1255
|
-
|
|
1298
|
+
emitQueryStateChanged() {
|
|
1299
|
+
console.log('emitting query state changed event');
|
|
1256
1300
|
this.dispatchEvent(
|
|
1257
1301
|
new CustomEvent<CollectionBrowserQueryState>('queryStateChanged', {
|
|
1258
1302
|
detail: {
|
|
@@ -1331,19 +1375,6 @@ export class CollectionBrowser
|
|
|
1331
1375
|
// this lets us store the query key so we know if it's actually changed or not
|
|
1332
1376
|
private previousQueryKey?: string;
|
|
1333
1377
|
|
|
1334
|
-
/**
|
|
1335
|
-
* Internal property to store the `resolve` function for the most recent
|
|
1336
|
-
* `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.
|
|
1337
|
-
*/
|
|
1338
|
-
private _initialSearchCompleteResolver!: (val: boolean) => void;
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
* Internal property to store the private value backing the `initialSearchComplete` getter.
|
|
1342
|
-
*/
|
|
1343
|
-
private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {
|
|
1344
|
-
this._initialSearchCompleteResolver = res;
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
1378
|
/**
|
|
1348
1379
|
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
1349
1380
|
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
@@ -1352,16 +1383,16 @@ export class CollectionBrowser
|
|
|
1352
1383
|
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
1353
1384
|
*/
|
|
1354
1385
|
get initialSearchComplete(): Promise<boolean> {
|
|
1355
|
-
return this.
|
|
1386
|
+
return this.dataSource.initialSearchComplete;
|
|
1356
1387
|
}
|
|
1357
1388
|
|
|
1358
1389
|
private async handleQueryChange() {
|
|
1359
|
-
console.log(
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
);
|
|
1390
|
+
// console.log(
|
|
1391
|
+
// 'CB: handling query change',
|
|
1392
|
+
// this.previousQueryKey,
|
|
1393
|
+
// this.dataSource.pageFetchQueryKey,
|
|
1394
|
+
// this.dataSource.canPerformSearch
|
|
1395
|
+
// );
|
|
1365
1396
|
// only reset if the query has actually changed
|
|
1366
1397
|
if (
|
|
1367
1398
|
!this.searchService ||
|
|
@@ -1382,7 +1413,7 @@ export class CollectionBrowser
|
|
|
1382
1413
|
JSON.stringify(this.selectedFacets)
|
|
1383
1414
|
);
|
|
1384
1415
|
this.previousQueryKey = this.dataSource.pageFetchQueryKey;
|
|
1385
|
-
this.emitQueryStateChanged();
|
|
1416
|
+
// this.emitQueryStateChanged();
|
|
1386
1417
|
|
|
1387
1418
|
this.tileModelOffset = 0;
|
|
1388
1419
|
this.totalResults = undefined;
|
|
@@ -1390,7 +1421,6 @@ export class CollectionBrowser
|
|
|
1390
1421
|
this.initialPageNumber === 1
|
|
1391
1422
|
? 2 // First two pages are batched into one request when starting from page 1
|
|
1392
1423
|
: this.initialPageNumber;
|
|
1393
|
-
this.queryErrorMessage = undefined;
|
|
1394
1424
|
|
|
1395
1425
|
// Reset the infinite scroller's item count, so that it
|
|
1396
1426
|
// shows tile placeholders until the new query's results load in
|
|
@@ -1416,16 +1446,8 @@ export class CollectionBrowser
|
|
|
1416
1446
|
}
|
|
1417
1447
|
this.historyPopOccurred = false;
|
|
1418
1448
|
|
|
1419
|
-
// Reset the `initialSearchComplete` promise with a new value for the imminent search
|
|
1420
|
-
this._initialSearchCompletePromise = new Promise(res => {
|
|
1421
|
-
this._initialSearchCompleteResolver = res;
|
|
1422
|
-
});
|
|
1423
|
-
|
|
1424
1449
|
// Fire the initial page and facets requests
|
|
1425
|
-
await this.dataSource.handleQueryChange();
|
|
1426
|
-
|
|
1427
|
-
// Resolve the `initialSearchComplete` promise for this search
|
|
1428
|
-
this._initialSearchCompleteResolver(true);
|
|
1450
|
+
// await this.dataSource.handleQueryChange();
|
|
1429
1451
|
}
|
|
1430
1452
|
|
|
1431
1453
|
private setupStateRestorationObserver() {
|
|
@@ -1665,8 +1687,7 @@ export class CollectionBrowser
|
|
|
1665
1687
|
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
1666
1688
|
// this.mapDataSource(model => ({ ...model }));
|
|
1667
1689
|
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
1668
|
-
if (cellIndex >= 0)
|
|
1669
|
-
this.infiniteScroller?.refreshCell(cellIndex - this.tileModelOffset);
|
|
1690
|
+
if (cellIndex >= 0) this.infiniteScroller?.refreshCell(cellIndex);
|
|
1670
1691
|
}
|
|
1671
1692
|
|
|
1672
1693
|
this.analyticsHandler?.sendEvent({
|
|
@@ -1713,7 +1734,7 @@ export class CollectionBrowser
|
|
|
1713
1734
|
* increase the number of pages to render and start fetching data for the new page
|
|
1714
1735
|
*/
|
|
1715
1736
|
private scrollThresholdReached() {
|
|
1716
|
-
if (!this.dataSource.endOfDataReached) {
|
|
1737
|
+
if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
|
|
1717
1738
|
this.pagesToRender += 1;
|
|
1718
1739
|
this.dataSource.fetchPage(this.pagesToRender);
|
|
1719
1740
|
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FilterMap,
|
|
3
|
+
Aggregation,
|
|
4
|
+
CollectionExtraInfo,
|
|
5
|
+
AccountExtraInfo,
|
|
6
|
+
PageElementMap,
|
|
7
|
+
} from '@internetarchive/search-service';
|
|
8
|
+
import type { ReactiveController } from 'lit';
|
|
9
|
+
import type {
|
|
10
|
+
PrefixFilterType,
|
|
11
|
+
PrefixFilterCounts,
|
|
12
|
+
TileModel,
|
|
13
|
+
} from '../models';
|
|
14
|
+
import type { PageSpecifierParams, CollectionTitles } from './models';
|
|
15
|
+
|
|
16
|
+
export interface CollectionBrowserDataSourceInterface
|
|
17
|
+
extends ReactiveController {
|
|
18
|
+
/**
|
|
19
|
+
* How many tile models are present in this data source
|
|
20
|
+
*/
|
|
21
|
+
readonly size: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* How many results there are in the full result set for the current query
|
|
25
|
+
* (not necessarily all loaded yet).
|
|
26
|
+
*/
|
|
27
|
+
readonly totalResults: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether the host has a valid set of properties for performing a search.
|
|
31
|
+
* For instance, on the search page this requires a valid search service and a
|
|
32
|
+
* non-empty query, while collection pages allow searching with an empty query
|
|
33
|
+
* for MDS but not FTS.
|
|
34
|
+
*/
|
|
35
|
+
readonly canPerformSearch: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether the end of the set of results for the current query state has been
|
|
39
|
+
* encountered (i.e., the last page of results).
|
|
40
|
+
*/
|
|
41
|
+
readonly endOfDataReached: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* True if the initial work for a new query state has been completed (i.e., firing initial
|
|
45
|
+
* page/facet requests). False otherwise.
|
|
46
|
+
*/
|
|
47
|
+
readonly queryInitialized: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A string key compactly representing the current full search state, which can
|
|
51
|
+
* be used to determine, e.g., when a new search is required or whether an arriving
|
|
52
|
+
* response is outdated.
|
|
53
|
+
*/
|
|
54
|
+
readonly pageFetchQueryKey: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Similar to `pageFetchQueryKey`, but excluding properties that do not affect
|
|
58
|
+
* the validity of a set of facets (e.g., sort).
|
|
59
|
+
*/
|
|
60
|
+
readonly facetFetchQueryKey: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* An object representing any collection- or profile-specific properties to be passed along
|
|
64
|
+
* to the search service, specifying the exact page/tab to fetch results for.
|
|
65
|
+
*/
|
|
66
|
+
readonly pageSpecifierParams: PageSpecifierParams | null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A FilterMap object representing all filters applied to the current search,
|
|
70
|
+
* including any facets, letter filters, and date ranges.
|
|
71
|
+
*/
|
|
72
|
+
readonly filterMap: FilterMap;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The full set of aggregations retrieved for the current search.
|
|
76
|
+
*/
|
|
77
|
+
readonly aggregations?: Record<string, Aggregation>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The `year_histogram` aggregation retrieved for the current search.
|
|
81
|
+
*/
|
|
82
|
+
readonly yearHistogramAggregation?: Aggregation;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A map from collection identifiers that appear on hits or aggregations for the
|
|
86
|
+
* current search, to their human-readable collection titles.
|
|
87
|
+
*/
|
|
88
|
+
readonly collectionTitles: CollectionTitles;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The "extra info" package provided by the PPS for collection pages, including details
|
|
92
|
+
* used to populate the target collection header & About tab content.
|
|
93
|
+
*/
|
|
94
|
+
readonly collectionExtraInfo?: CollectionExtraInfo;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The "extra info" package provided by the PPS for profile pages, including details
|
|
98
|
+
* used to populate the profile header.
|
|
99
|
+
*/
|
|
100
|
+
readonly accountExtraInfo?: AccountExtraInfo;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The set of requested page elements for profile pages, if applicable. These represent
|
|
104
|
+
* any content specific to the current profile tab.
|
|
105
|
+
*/
|
|
106
|
+
readonly pageElements?: PageElementMap;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An array of the current target collection's parent collections. Should include *all*
|
|
110
|
+
* ancestors in the collection hierarchy, not just the immediate parent.
|
|
111
|
+
*/
|
|
112
|
+
readonly parentCollections?: string[];
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* An object storing result counts for the current search bucketed by letter prefix.
|
|
116
|
+
* Keys are the result field on which the prefixes are considered (e.g., title/creator)
|
|
117
|
+
* and values are a Record mapping letters to their counts.
|
|
118
|
+
*/
|
|
119
|
+
readonly prefixFilterCountMap: Partial<
|
|
120
|
+
Record<PrefixFilterType, PrefixFilterCounts>
|
|
121
|
+
>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Any error message from the most recent search results response.
|
|
125
|
+
*/
|
|
126
|
+
readonly queryErrorMessage?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* An array of all the tile models whose management checkboxes are checked
|
|
130
|
+
*/
|
|
131
|
+
readonly checkedTileModels: TileModel[];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* An array of all the tile models whose management checkboxes are unchecked
|
|
135
|
+
*/
|
|
136
|
+
readonly uncheckedTileModels: TileModel[];
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
140
|
+
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
141
|
+
*
|
|
142
|
+
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
143
|
+
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
144
|
+
*/
|
|
145
|
+
readonly initialSearchComplete: Promise<boolean>;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Resets the data source to its empty state, with no result pages, aggregations, etc.
|
|
149
|
+
*/
|
|
150
|
+
reset(): void;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Adds the given page of tile models to the data source.
|
|
154
|
+
* If the given page number already exists, that page will be overwritten.
|
|
155
|
+
* @param pageNum Which page number to add (indexed starting from 1)
|
|
156
|
+
* @param pageTiles The array of tile models for the new page
|
|
157
|
+
*/
|
|
158
|
+
addPage(pageNum: number, pageTiles: TileModel[]): void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Returns the given page of tile models from the data source.
|
|
162
|
+
* @param pageNum Which page number to get (indexed starting from 1)
|
|
163
|
+
*/
|
|
164
|
+
getPage(pageNum: number): TileModel[];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Returns the full set of paged tile models stored in this data source.
|
|
168
|
+
*/
|
|
169
|
+
getAllPages(): Record<string, TileModel[]>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Whether the data source contains any tiles for the given page number.
|
|
173
|
+
* @param pageNum Which page number to query (indexed starting from 1)
|
|
174
|
+
*/
|
|
175
|
+
hasPage(pageNum: number): boolean;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Returns the single tile model appearing at the given index in the
|
|
179
|
+
* data source, with respect to the current page size. Returns `undefined` if
|
|
180
|
+
* the corresponding page is not present on the data source or if it does not
|
|
181
|
+
* contain a tile model at the corresponding index.
|
|
182
|
+
* @param index The 0-based index (within the full data source) of the tile to get
|
|
183
|
+
*/
|
|
184
|
+
getTileModelAt(index: number): TileModel | undefined;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the first numeric tile index corresponding to the given tile model object,
|
|
188
|
+
* or -1 if the given tile model is not present.
|
|
189
|
+
* @param tile The tile model to search for in the data source
|
|
190
|
+
*/
|
|
191
|
+
indexOf(tile: TileModel): number;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Requests that the data source fire a backend request for the given page of results.
|
|
195
|
+
* @param pageNum Which page number to fetch results for
|
|
196
|
+
* @param numInitialPages How many pages should be batched together on an initial fetch
|
|
197
|
+
*/
|
|
198
|
+
fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Requests that the data source update its prefix bucket result counts for the given
|
|
202
|
+
* type of prefix filter.
|
|
203
|
+
* @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
|
|
204
|
+
*/
|
|
205
|
+
updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Changes the page size used by the data source, discarding any previously-fetched pages.
|
|
209
|
+
*
|
|
210
|
+
* **Note: this operation will reset any data stored in the data source!**
|
|
211
|
+
* @param pageSize
|
|
212
|
+
*/
|
|
213
|
+
setPageSize(pageSize: number): void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Notifies the data source that a query change has occurred, which may trigger a data
|
|
217
|
+
* reset & new fetches.
|
|
218
|
+
*/
|
|
219
|
+
handleQueryChange(): void;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Applies the given map function to all of the tile models in every page of the data
|
|
223
|
+
* source.
|
|
224
|
+
* @param callback A callback function to apply on each tile model, as with Array.map
|
|
225
|
+
*/
|
|
226
|
+
map(
|
|
227
|
+
callback: (model: TileModel, index: number, array: TileModel[]) => TileModel
|
|
228
|
+
): void;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Checks every tile's management checkbox
|
|
232
|
+
*/
|
|
233
|
+
checkAllTiles(): void;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Unchecks every tile's management checkbox
|
|
237
|
+
*/
|
|
238
|
+
uncheckAllTiles(): void;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Removes all tile models that are currently checked & adjusts the paging
|
|
242
|
+
* of the data source to account for any new gaps in the data.
|
|
243
|
+
*/
|
|
244
|
+
removeCheckedTiles(): void;
|
|
245
|
+
}
|