@internetarchive/collection-browser 1.14.17-alpha.30 → 1.14.17-alpha.32
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 +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/src/collection-browser.d.ts +1 -1
- package/dist/src/collection-browser.js +2 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +190 -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 +3 -183
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.d.ts +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/tiles/item-image.js +15 -2
- package/dist/src/tiles/item-image.js.map +1 -1
- package/index.ts +4 -2
- package/package.json +1 -1
- package/src/collection-browser.ts +3 -2
- package/src/data-source/collection-browser-data-source-interface.ts +230 -0
- package/src/data-source/collection-browser-data-source.ts +2 -222
- package/src/data-source/models.ts +1 -1
- package/src/tiles/item-image.ts +13 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { FilterMap, Aggregation, CollectionExtraInfo, AccountExtraInfo, PageElementMap } from "@internetarchive/search-service";
|
|
2
|
+
import type { ReactiveController } from "lit";
|
|
3
|
+
import type { PrefixFilterType, PrefixFilterCounts, TileModel } from "../models";
|
|
4
|
+
import type { PageSpecifierParams, CollectionTitles } from "./models";
|
|
5
|
+
export interface CollectionBrowserDataSourceInterface extends ReactiveController {
|
|
6
|
+
/**
|
|
7
|
+
* How many tile models are present in this data source
|
|
8
|
+
*/
|
|
9
|
+
readonly size: number;
|
|
10
|
+
/**
|
|
11
|
+
* How many results there are in the full result set for the current query
|
|
12
|
+
* (not necessarily all loaded yet).
|
|
13
|
+
*/
|
|
14
|
+
readonly totalResults: number;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the host has a valid set of properties for performing a search.
|
|
17
|
+
* For instance, on the search page this requires a valid search service and a
|
|
18
|
+
* non-empty query, while collection pages allow searching with an empty query
|
|
19
|
+
* for MDS but not FTS.
|
|
20
|
+
*/
|
|
21
|
+
readonly canPerformSearch: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the end of the set of results for the current query state has been
|
|
24
|
+
* encountered (i.e., the last page of results).
|
|
25
|
+
*/
|
|
26
|
+
readonly endOfDataReached: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* True if the initial work for a new query state has been completed (i.e., firing initial
|
|
29
|
+
* page/facet requests). False otherwise.
|
|
30
|
+
*/
|
|
31
|
+
readonly queryInitialized: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A string key compactly representing the current full search state, which can
|
|
34
|
+
* be used to determine, e.g., when a new search is required or whether an arriving
|
|
35
|
+
* response is outdated.
|
|
36
|
+
*/
|
|
37
|
+
readonly pageFetchQueryKey: string;
|
|
38
|
+
/**
|
|
39
|
+
* Similar to `pageFetchQueryKey`, but excluding properties that do not affect
|
|
40
|
+
* the validity of a set of facets (e.g., sort).
|
|
41
|
+
*/
|
|
42
|
+
readonly facetFetchQueryKey: string;
|
|
43
|
+
/**
|
|
44
|
+
* An object representing any collection- or profile-specific properties to be passed along
|
|
45
|
+
* to the search service, specifying the exact page/tab to fetch results for.
|
|
46
|
+
*/
|
|
47
|
+
readonly pageSpecifierParams: PageSpecifierParams | null;
|
|
48
|
+
/**
|
|
49
|
+
* A FilterMap object representing all filters applied to the current search,
|
|
50
|
+
* including any facets, letter filters, and date ranges.
|
|
51
|
+
*/
|
|
52
|
+
readonly filterMap: FilterMap;
|
|
53
|
+
/**
|
|
54
|
+
* The full set of aggregations retrieved for the current search.
|
|
55
|
+
*/
|
|
56
|
+
readonly aggregations?: Record<string, Aggregation>;
|
|
57
|
+
/**
|
|
58
|
+
* The `year_histogram` aggregation retrieved for the current search.
|
|
59
|
+
*/
|
|
60
|
+
readonly yearHistogramAggregation?: Aggregation;
|
|
61
|
+
/**
|
|
62
|
+
* A map from collection identifiers that appear on hits or aggregations for the
|
|
63
|
+
* current search, to their human-readable collection titles.
|
|
64
|
+
*/
|
|
65
|
+
readonly collectionTitles: CollectionTitles;
|
|
66
|
+
/**
|
|
67
|
+
* The "extra info" package provided by the PPS for collection pages, including details
|
|
68
|
+
* used to populate the target collection header & About tab content.
|
|
69
|
+
*/
|
|
70
|
+
readonly collectionExtraInfo?: CollectionExtraInfo;
|
|
71
|
+
/**
|
|
72
|
+
* The "extra info" package provided by the PPS for profile pages, including details
|
|
73
|
+
* used to populate the profile header.
|
|
74
|
+
*/
|
|
75
|
+
readonly accountExtraInfo?: AccountExtraInfo;
|
|
76
|
+
/**
|
|
77
|
+
* The set of requested page elements for profile pages, if applicable. These represent
|
|
78
|
+
* any content specific to the current profile tab.
|
|
79
|
+
*/
|
|
80
|
+
readonly pageElements?: PageElementMap;
|
|
81
|
+
/**
|
|
82
|
+
* An array of the current target collection's parent collections. Should include *all*
|
|
83
|
+
* ancestors in the collection hierarchy, not just the immediate parent.
|
|
84
|
+
*/
|
|
85
|
+
readonly parentCollections?: string[];
|
|
86
|
+
/**
|
|
87
|
+
* An object storing result counts for the current search bucketed by letter prefix.
|
|
88
|
+
* Keys are the result field on which the prefixes are considered (e.g., title/creator)
|
|
89
|
+
* and values are a Record mapping letters to their counts.
|
|
90
|
+
*/
|
|
91
|
+
readonly prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>>;
|
|
92
|
+
/**
|
|
93
|
+
* An array of all the tile models whose management checkboxes are checked
|
|
94
|
+
*/
|
|
95
|
+
readonly checkedTileModels: TileModel[];
|
|
96
|
+
/**
|
|
97
|
+
* An array of all the tile models whose management checkboxes are unchecked
|
|
98
|
+
*/
|
|
99
|
+
readonly uncheckedTileModels: TileModel[];
|
|
100
|
+
/**
|
|
101
|
+
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
102
|
+
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
103
|
+
*
|
|
104
|
+
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
105
|
+
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
106
|
+
*/
|
|
107
|
+
readonly initialSearchComplete: Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Resets the data source to its empty state, with no result pages, aggregations, etc.
|
|
110
|
+
*/
|
|
111
|
+
reset(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Adds the given page of tile models to the data source.
|
|
114
|
+
* If the given page number already exists, that page will be overwritten.
|
|
115
|
+
* @param pageNum Which page number to add (indexed starting from 1)
|
|
116
|
+
* @param pageTiles The array of tile models for the new page
|
|
117
|
+
*/
|
|
118
|
+
addPage(pageNum: number, pageTiles: TileModel[]): void;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the given page of tile models from the data source.
|
|
121
|
+
* @param pageNum Which page number to get (indexed starting from 1)
|
|
122
|
+
*/
|
|
123
|
+
getPage(pageNum: number): TileModel[];
|
|
124
|
+
/**
|
|
125
|
+
* Returns the full set of paged tile models stored in this data source.
|
|
126
|
+
*/
|
|
127
|
+
getAllPages(): Record<string, TileModel[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the data source contains any tiles for the given page number.
|
|
130
|
+
* @param pageNum Which page number to query (indexed starting from 1)
|
|
131
|
+
*/
|
|
132
|
+
hasPage(pageNum: number): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the single tile model appearing at the given index in the
|
|
135
|
+
* data source, with respect to the current page size. Returns `undefined` if
|
|
136
|
+
* the corresponding page is not present on the data source or if it does not
|
|
137
|
+
* contain a tile model at the corresponding index.
|
|
138
|
+
* @param index The 0-based index (within the full data source) of the tile to get
|
|
139
|
+
*/
|
|
140
|
+
getTileModelAt(index: number): TileModel | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Returns the first numeric tile index corresponding to the given tile model object,
|
|
143
|
+
* or -1 if the given tile model is not present.
|
|
144
|
+
* @param tile The tile model to search for in the data source
|
|
145
|
+
*/
|
|
146
|
+
indexOf(tile: TileModel): number;
|
|
147
|
+
/**
|
|
148
|
+
* Requests that the data source fire a backend request for the given page of results.
|
|
149
|
+
* @param pageNum Which page number to fetch results for
|
|
150
|
+
* @param numInitialPages How many pages should be batched together on an initial fetch
|
|
151
|
+
*/
|
|
152
|
+
fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Requests that the data source update its prefix bucket result counts for the given
|
|
155
|
+
* type of prefix filter.
|
|
156
|
+
* @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
|
|
157
|
+
*/
|
|
158
|
+
updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Changes the page size used by the data source, discarding any previously-fetched pages.
|
|
161
|
+
*
|
|
162
|
+
* **Note: this operation will reset any data stored in the data source!**
|
|
163
|
+
* @param pageSize
|
|
164
|
+
*/
|
|
165
|
+
setPageSize(pageSize: number): void;
|
|
166
|
+
/**
|
|
167
|
+
* Notifies the data source that a query change has occurred, which may trigger a data
|
|
168
|
+
* reset & new fetches.
|
|
169
|
+
*/
|
|
170
|
+
handleQueryChange(): void;
|
|
171
|
+
/**
|
|
172
|
+
* Applies the given map function to all of the tile models in every page of the data
|
|
173
|
+
* source.
|
|
174
|
+
* @param callback A callback function to apply on each tile model, as with Array.map
|
|
175
|
+
*/
|
|
176
|
+
map(callback: (model: TileModel, index: number, array: TileModel[]) => TileModel): void;
|
|
177
|
+
/**
|
|
178
|
+
* Checks every tile's management checkbox
|
|
179
|
+
*/
|
|
180
|
+
checkAllTiles(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Unchecks every tile's management checkbox
|
|
183
|
+
*/
|
|
184
|
+
uncheckAllTiles(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Removes all tile models that are currently checked & adjusts the paging
|
|
187
|
+
* of the data source to account for any new gaps in the data.
|
|
188
|
+
*/
|
|
189
|
+
removeCheckedTiles(): void;
|
|
190
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { FilterMap, Aggregation, CollectionExtraInfo, AccountExtraInfo, PageElementMap } from \"@internetarchive/search-service\";\nimport type { ReactiveController } from \"lit\";\nimport type { PrefixFilterType, PrefixFilterCounts, TileModel } from \"../models\";\nimport type { PageSpecifierParams, CollectionTitles } from \"./models\";\n\nexport interface CollectionBrowserDataSourceInterface\n extends ReactiveController {\n /**\n * How many tile models are present in this data source\n */\n readonly size: number;\n\n /**\n * How many results there are in the full result set for the current query\n * (not necessarily all loaded yet).\n */\n readonly totalResults: number;\n\n /**\n * Whether the host has a valid set of properties for performing a search.\n * For instance, on the search page this requires a valid search service and a\n * non-empty query, while collection pages allow searching with an empty query\n * for MDS but not FTS.\n */\n readonly canPerformSearch: boolean;\n\n /**\n * Whether the end of the set of results for the current query state has been\n * encountered (i.e., the last page of results).\n */\n readonly endOfDataReached: boolean;\n\n /**\n * True if the initial work for a new query state has been completed (i.e., firing initial\n * page/facet requests). False otherwise.\n */\n readonly queryInitialized: boolean;\n\n /**\n * A string key compactly representing the current full search state, which can\n * be used to determine, e.g., when a new search is required or whether an arriving\n * response is outdated.\n */\n readonly pageFetchQueryKey: string;\n\n /**\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\n * the validity of a set of facets (e.g., sort).\n */\n readonly facetFetchQueryKey: string;\n\n /**\n * An object representing any collection- or profile-specific properties to be passed along\n * to the search service, specifying the exact page/tab to fetch results for.\n */\n readonly pageSpecifierParams: PageSpecifierParams | null;\n\n /**\n * A FilterMap object representing all filters applied to the current search,\n * including any facets, letter filters, and date ranges.\n */\n readonly filterMap: FilterMap;\n\n /**\n * The full set of aggregations retrieved for the current search.\n */\n readonly aggregations?: Record<string, Aggregation>;\n\n /**\n * The `year_histogram` aggregation retrieved for the current search.\n */\n readonly yearHistogramAggregation?: Aggregation;\n\n /**\n * A map from collection identifiers that appear on hits or aggregations for the\n * current search, to their human-readable collection titles.\n */\n readonly collectionTitles: CollectionTitles;\n\n /**\n * The \"extra info\" package provided by the PPS for collection pages, including details\n * used to populate the target collection header & About tab content.\n */\n readonly collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * The \"extra info\" package provided by the PPS for profile pages, including details\n * used to populate the profile header.\n */\n readonly accountExtraInfo?: AccountExtraInfo;\n\n /**\n * The set of requested page elements for profile pages, if applicable. These represent\n * any content specific to the current profile tab.\n */\n readonly pageElements?: PageElementMap;\n\n /**\n * An array of the current target collection's parent collections. Should include *all*\n * ancestors in the collection hierarchy, not just the immediate parent.\n */\n readonly parentCollections?: string[];\n\n /**\n * An object storing result counts for the current search bucketed by letter prefix.\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\n * and values are a Record mapping letters to their counts.\n */\n readonly prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n >;\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n readonly checkedTileModels: TileModel[];\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n readonly uncheckedTileModels: TileModel[];\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n readonly initialSearchComplete: Promise<boolean>;\n\n /**\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\n */\n reset(): void;\n\n /**\n * Adds the given page of tile models to the data source.\n * If the given page number already exists, that page will be overwritten.\n * @param pageNum Which page number to add (indexed starting from 1)\n * @param pageTiles The array of tile models for the new page\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void;\n\n /**\n * Returns the given page of tile models from the data source.\n * @param pageNum Which page number to get (indexed starting from 1)\n */\n getPage(pageNum: number): TileModel[];\n\n /**\n * Returns the full set of paged tile models stored in this data source.\n */\n getAllPages(): Record<string, TileModel[]>;\n\n /**\n * Whether the data source contains any tiles for the given page number.\n * @param pageNum Which page number to query (indexed starting from 1)\n */\n hasPage(pageNum: number): boolean;\n\n /**\n * Returns the single tile model appearing at the given index in the\n * data source, with respect to the current page size. Returns `undefined` if\n * the corresponding page is not present on the data source or if it does not\n * contain a tile model at the corresponding index.\n * @param index The 0-based index (within the full data source) of the tile to get\n */\n getTileModelAt(index: number): TileModel | undefined;\n\n /**\n * Returns the first numeric tile index corresponding to the given tile model object,\n * or -1 if the given tile model is not present.\n * @param tile The tile model to search for in the data source\n */\n indexOf(tile: TileModel): number;\n\n /**\n * Requests that the data source fire a backend request for the given page of results.\n * @param pageNum Which page number to fetch results for\n * @param numInitialPages How many pages should be batched together on an initial fetch\n */\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\n\n /**\n * Requests that the data source update its prefix bucket result counts for the given\n * type of prefix filter.\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\n */\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\n\n /**\n * Changes the page size used by the data source, discarding any previously-fetched pages.\n *\n * **Note: this operation will reset any data stored in the data source!**\n * @param pageSize\n */\n setPageSize(pageSize: number): void;\n\n /**\n * Notifies the data source that a query change has occurred, which may trigger a data\n * reset & new fetches.\n */\n handleQueryChange(): void;\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source.\n * @param callback A callback function to apply on each tile model, as with Array.map\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void;\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void;\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void;\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void;\n}"]}
|
|
@@ -1,188 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
2
|
import { AccountExtraInfo, Aggregation, CollectionExtraInfo, FilterMap, PageElementMap, SearchParams } from '@internetarchive/search-service';
|
|
3
3
|
import { type PrefixFilterType, TileModel, PrefixFilterCounts, RequestKind } from '../models';
|
|
4
|
-
import type { CollectionBrowserSearchInterface,
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* How many tile models are present in this data source
|
|
8
|
-
*/
|
|
9
|
-
readonly size: number;
|
|
10
|
-
/**
|
|
11
|
-
* Whether the host has a valid set of properties for performing a search.
|
|
12
|
-
* For instance, on the search page this requires a valid search service and a
|
|
13
|
-
* non-empty query, while collection pages allow searching with an empty query
|
|
14
|
-
* for MDS but not FTS.
|
|
15
|
-
*/
|
|
16
|
-
readonly canPerformSearch: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Whether the end of the set of results for the current query state has been
|
|
19
|
-
* encountered (i.e., the last page of results).
|
|
20
|
-
*/
|
|
21
|
-
readonly endOfDataReached: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* True if the initial work for a new query state has been completed (i.e., firing initial
|
|
24
|
-
* page/facet requests). False otherwise.
|
|
25
|
-
*/
|
|
26
|
-
readonly queryInitialized: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* A string key compactly representing the current full search state, which can
|
|
29
|
-
* be used to determine, e.g., when a new search is required or whether an arriving
|
|
30
|
-
* response is outdated.
|
|
31
|
-
*/
|
|
32
|
-
readonly pageFetchQueryKey: string;
|
|
33
|
-
/**
|
|
34
|
-
* Similar to `pageFetchQueryKey`, but excluding properties that do not affect
|
|
35
|
-
* the validity of a set of facets (e.g., sort).
|
|
36
|
-
*/
|
|
37
|
-
readonly facetFetchQueryKey: string;
|
|
38
|
-
/**
|
|
39
|
-
* An object representing any collection- or profile-specific properties to be passed along
|
|
40
|
-
* to the search service, specifying the exact page/tab to fetch results for.
|
|
41
|
-
*/
|
|
42
|
-
readonly pageSpecifierParams: PageSpecifierParams | null;
|
|
43
|
-
/**
|
|
44
|
-
* A FilterMap object representing all filters applied to the current search,
|
|
45
|
-
* including any facets, letter filters, and date ranges.
|
|
46
|
-
*/
|
|
47
|
-
readonly filterMap: FilterMap;
|
|
48
|
-
/**
|
|
49
|
-
* The full set of aggregations retrieved for the current search.
|
|
50
|
-
*/
|
|
51
|
-
readonly aggregations?: Record<string, Aggregation>;
|
|
52
|
-
/**
|
|
53
|
-
* The `year_histogram` aggregation retrieved for the current search.
|
|
54
|
-
*/
|
|
55
|
-
readonly yearHistogramAggregation?: Aggregation;
|
|
56
|
-
/**
|
|
57
|
-
* A map from collection identifiers that appear on hits or aggregations for the
|
|
58
|
-
* current search, to their human-readable collection titles.
|
|
59
|
-
*/
|
|
60
|
-
readonly collectionTitles: CollectionTitles;
|
|
61
|
-
/**
|
|
62
|
-
* The "extra info" package provided by the PPS for collection pages, including details
|
|
63
|
-
* used to populate the target collection header & About tab content.
|
|
64
|
-
*/
|
|
65
|
-
readonly collectionExtraInfo?: CollectionExtraInfo;
|
|
66
|
-
/**
|
|
67
|
-
* The "extra info" package provided by the PPS for profile pages, including details
|
|
68
|
-
* used to populate the profile header.
|
|
69
|
-
*/
|
|
70
|
-
readonly accountExtraInfo?: AccountExtraInfo;
|
|
71
|
-
/**
|
|
72
|
-
* The set of requested page elements for profile pages, if applicable. These represent
|
|
73
|
-
* any content specific to the current profile tab.
|
|
74
|
-
*/
|
|
75
|
-
readonly pageElements?: PageElementMap;
|
|
76
|
-
/**
|
|
77
|
-
* An array of the current target collection's parent collections. Should include *all*
|
|
78
|
-
* ancestors in the collection hierarchy, not just the immediate parent.
|
|
79
|
-
*/
|
|
80
|
-
readonly parentCollections?: string[];
|
|
81
|
-
/**
|
|
82
|
-
* An object storing result counts for the current search bucketed by letter prefix.
|
|
83
|
-
* Keys are the result field on which the prefixes are considered (e.g., title/creator)
|
|
84
|
-
* and values are a Record mapping letters to their counts.
|
|
85
|
-
*/
|
|
86
|
-
readonly prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>>;
|
|
87
|
-
/**
|
|
88
|
-
* An array of all the tile models whose management checkboxes are checked
|
|
89
|
-
*/
|
|
90
|
-
readonly checkedTileModels: TileModel[];
|
|
91
|
-
/**
|
|
92
|
-
* An array of all the tile models whose management checkboxes are unchecked
|
|
93
|
-
*/
|
|
94
|
-
readonly uncheckedTileModels: TileModel[];
|
|
95
|
-
/**
|
|
96
|
-
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
97
|
-
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
98
|
-
*
|
|
99
|
-
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
100
|
-
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
101
|
-
*/
|
|
102
|
-
readonly initialSearchComplete: Promise<boolean>;
|
|
103
|
-
/**
|
|
104
|
-
* Resets the data source to its empty state, with no result pages, aggregations, etc.
|
|
105
|
-
*/
|
|
106
|
-
reset(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Adds the given page of tile models to the data source.
|
|
109
|
-
* If the given page number already exists, that page will be overwritten.
|
|
110
|
-
* @param pageNum Which page number to add (indexed starting from 1)
|
|
111
|
-
* @param pageTiles The array of tile models for the new page
|
|
112
|
-
*/
|
|
113
|
-
addPage(pageNum: number, pageTiles: TileModel[]): void;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the given page of tile models from the data source.
|
|
116
|
-
* @param pageNum Which page number to get (indexed starting from 1)
|
|
117
|
-
*/
|
|
118
|
-
getPage(pageNum: number): TileModel[];
|
|
119
|
-
/**
|
|
120
|
-
* Returns the full set of paged tile models stored in this data source.
|
|
121
|
-
*/
|
|
122
|
-
getAllPages(): Record<string, TileModel[]>;
|
|
123
|
-
/**
|
|
124
|
-
* Whether the data source contains any tiles for the given page number.
|
|
125
|
-
* @param pageNum Which page number to query (indexed starting from 1)
|
|
126
|
-
*/
|
|
127
|
-
hasPage(pageNum: number): boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Returns the single tile model appearing at the given index in the
|
|
130
|
-
* data source, with respect to the current page size. Returns `undefined` if
|
|
131
|
-
* the corresponding page is not present on the data source or if it does not
|
|
132
|
-
* contain a tile model at the corresponding index.
|
|
133
|
-
* @param index The 0-based index (within the full data source) of the tile to get
|
|
134
|
-
*/
|
|
135
|
-
getTileModelAt(index: number): TileModel | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* Returns the first numeric tile index corresponding to the given tile model object,
|
|
138
|
-
* or -1 if the given tile model is not present.
|
|
139
|
-
* @param tile The tile model to search for in the data source
|
|
140
|
-
*/
|
|
141
|
-
indexOf(tile: TileModel): number;
|
|
142
|
-
/**
|
|
143
|
-
* Requests that the data source fire a backend request for the given page of results.
|
|
144
|
-
* @param pageNum Which page number to fetch results for
|
|
145
|
-
* @param numInitialPages How many pages should be batched together on an initial fetch
|
|
146
|
-
*/
|
|
147
|
-
fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
|
|
148
|
-
/**
|
|
149
|
-
* Requests that the data source update its prefix bucket result counts for the given
|
|
150
|
-
* type of prefix filter.
|
|
151
|
-
* @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
|
|
152
|
-
*/
|
|
153
|
-
updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
|
|
154
|
-
/**
|
|
155
|
-
* Changes the page size used by the data source, discarding any previously-fetched pages.
|
|
156
|
-
*
|
|
157
|
-
* **Note: this operation will reset any data stored in the data source!**
|
|
158
|
-
* @param pageSize
|
|
159
|
-
*/
|
|
160
|
-
setPageSize(pageSize: number): void;
|
|
161
|
-
/**
|
|
162
|
-
* Notifies the data source that a query change has occurred, which may trigger a data
|
|
163
|
-
* reset & new fetches.
|
|
164
|
-
*/
|
|
165
|
-
handleQueryChange(): void;
|
|
166
|
-
/**
|
|
167
|
-
* Applies the given map function to all of the tile models in every page of the data
|
|
168
|
-
* source.
|
|
169
|
-
* @param callback A callback function to apply on each tile model, as with Array.map
|
|
170
|
-
*/
|
|
171
|
-
map(callback: (model: TileModel, index: number, array: TileModel[]) => TileModel): void;
|
|
172
|
-
/**
|
|
173
|
-
* Checks every tile's management checkbox
|
|
174
|
-
*/
|
|
175
|
-
checkAllTiles(): void;
|
|
176
|
-
/**
|
|
177
|
-
* Unchecks every tile's management checkbox
|
|
178
|
-
*/
|
|
179
|
-
uncheckAllTiles(): void;
|
|
180
|
-
/**
|
|
181
|
-
* Removes all tile models that are currently checked & adjusts the paging
|
|
182
|
-
* of the data source to account for any new gaps in the data.
|
|
183
|
-
*/
|
|
184
|
-
removeCheckedTiles(): void;
|
|
185
|
-
}
|
|
4
|
+
import type { CollectionBrowserSearchInterface, PageSpecifierParams } from './models';
|
|
5
|
+
import type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';
|
|
186
6
|
export declare class CollectionBrowserDataSource implements CollectionBrowserDataSourceInterface {
|
|
187
7
|
/** The host element to which this controller should attach listeners */
|
|
188
8
|
private readonly host;
|