@internetarchive/collection-browser 3.3.3 → 3.3.4-alpha-webdev7761.0
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/src/collection-browser.d.ts +10 -2
- package/dist/src/collection-browser.js +112 -10
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +141 -140
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets.js +12 -0
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +10 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +19 -1
- package/dist/src/data-source/collection-browser-data-source.js +36 -18
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +11 -0
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.d.ts +2 -6
- package/dist/src/models.js +8 -12
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +1 -2
- package/dist/src/restoration-state-handler.js +3 -9
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -42
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/test/collection-browser.test.js +19 -9
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +23 -23
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +20 -20
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +5 -37
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +132 -7
- package/src/collection-facets/facet-row.ts +299 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets.ts +11 -0
- package/src/data-source/collection-browser-data-source-interface.ts +345 -333
- package/src/data-source/collection-browser-data-source.ts +59 -19
- package/src/data-source/collection-browser-query-state.ts +1 -7
- package/src/data-source/models.ts +13 -0
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +866 -870
- package/src/restoration-state-handler.ts +542 -544
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/test/collection-browser.test.ts +21 -11
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/restoration-state-handler.test.ts +480 -510
|
@@ -1,333 +1,345 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FilterMap,
|
|
3
|
-
Aggregation,
|
|
4
|
-
CollectionExtraInfo,
|
|
5
|
-
AccountExtraInfo,
|
|
6
|
-
PageElementMap,
|
|
7
|
-
SearchResponseSessionContext,
|
|
8
|
-
} from '@internetarchive/search-service';
|
|
9
|
-
import type { ReactiveController } from 'lit';
|
|
10
|
-
import type {
|
|
11
|
-
PrefixFilterType,
|
|
12
|
-
PrefixFilterCounts,
|
|
13
|
-
TileModel,
|
|
14
|
-
} from '../models';
|
|
15
|
-
import type {
|
|
16
|
-
PageSpecifierParams,
|
|
17
|
-
CollectionTitles,
|
|
18
|
-
TVChannelAliases,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
readonly
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The "extra info" package provided by the PPS for
|
|
109
|
-
* used to populate the
|
|
110
|
-
*/
|
|
111
|
-
readonly
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
readonly
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
readonly
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* An
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
*
|
|
194
|
-
* @param
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Returns the
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
* @param
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
*
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
*
|
|
269
|
-
* @param
|
|
270
|
-
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Sets the total
|
|
275
|
-
* @param
|
|
276
|
-
*/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Sets
|
|
281
|
-
*
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Notifies the data source that
|
|
301
|
-
*
|
|
302
|
-
*/
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
*
|
|
331
|
-
*/
|
|
332
|
-
|
|
333
|
-
|
|
1
|
+
import type {
|
|
2
|
+
FilterMap,
|
|
3
|
+
Aggregation,
|
|
4
|
+
CollectionExtraInfo,
|
|
5
|
+
AccountExtraInfo,
|
|
6
|
+
PageElementMap,
|
|
7
|
+
SearchResponseSessionContext,
|
|
8
|
+
} from '@internetarchive/search-service';
|
|
9
|
+
import type { ReactiveController } from 'lit';
|
|
10
|
+
import type {
|
|
11
|
+
PrefixFilterType,
|
|
12
|
+
PrefixFilterCounts,
|
|
13
|
+
TileModel,
|
|
14
|
+
} from '../models';
|
|
15
|
+
import type {
|
|
16
|
+
PageSpecifierParams,
|
|
17
|
+
CollectionTitles,
|
|
18
|
+
TVChannelAliases,
|
|
19
|
+
TVChannelMaps,
|
|
20
|
+
} from './models';
|
|
21
|
+
|
|
22
|
+
export interface CollectionBrowserDataSourceInterface
|
|
23
|
+
extends ReactiveController {
|
|
24
|
+
/**
|
|
25
|
+
* How many tile models are present in this data source
|
|
26
|
+
*/
|
|
27
|
+
readonly size: number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* How many results there are in the full result set for the current query
|
|
31
|
+
* (not necessarily all loaded yet).
|
|
32
|
+
*/
|
|
33
|
+
readonly totalResults: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Whether the host has a valid set of properties for performing a search.
|
|
37
|
+
* For instance, on the search page this requires a valid search service and a
|
|
38
|
+
* non-empty query, while collection pages allow searching with an empty query
|
|
39
|
+
* for MDS but not FTS.
|
|
40
|
+
*/
|
|
41
|
+
readonly canPerformSearch: boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether the end of the set of results for the current query state has been
|
|
45
|
+
* encountered (i.e., the last page of results).
|
|
46
|
+
*/
|
|
47
|
+
readonly endOfDataReached: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* True if the initial work for a new query state has been completed (i.e., firing initial
|
|
51
|
+
* page/facet requests). False otherwise.
|
|
52
|
+
*/
|
|
53
|
+
readonly queryInitialized: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A string key compactly representing the current full search state, which can
|
|
57
|
+
* be used to determine, e.g., when a new search is required or whether an arriving
|
|
58
|
+
* response is outdated.
|
|
59
|
+
*/
|
|
60
|
+
readonly pageFetchQueryKey: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Similar to `pageFetchQueryKey`, but excluding properties that do not affect
|
|
64
|
+
* the validity of a set of facets (e.g., sort).
|
|
65
|
+
*/
|
|
66
|
+
readonly facetFetchQueryKey: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* An object representing any collection- or profile-specific properties to be passed along
|
|
70
|
+
* to the search service, specifying the exact page/tab to fetch results for.
|
|
71
|
+
*/
|
|
72
|
+
readonly pageSpecifierParams: PageSpecifierParams | null;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A FilterMap object representing all filters applied to the current search,
|
|
76
|
+
* including any facets, letter filters, and date ranges.
|
|
77
|
+
*/
|
|
78
|
+
readonly filterMap: FilterMap;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The full set of aggregations retrieved for the current search.
|
|
82
|
+
*/
|
|
83
|
+
readonly aggregations?: Record<string, Aggregation>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The `year_histogram` or `date_histogram` aggregation retrieved for the current search.
|
|
87
|
+
*/
|
|
88
|
+
readonly histogramAggregation?: Aggregation;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A map from collection identifiers that appear on hits or aggregations for the
|
|
92
|
+
* current search, to their human-readable collection titles.
|
|
93
|
+
*/
|
|
94
|
+
readonly collectionTitles: CollectionTitles;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A map from TV channel names appearing in `creator` aggregations, to their
|
|
98
|
+
* more human-readable network names.
|
|
99
|
+
*/
|
|
100
|
+
readonly tvChannelAliases: TVChannelAliases;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* An object holding mappings from channels to networks, and programs to channels.
|
|
104
|
+
*/
|
|
105
|
+
readonly tvChannelMaps: TVChannelMaps;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The "extra info" package provided by the PPS for collection pages, including details
|
|
109
|
+
* used to populate the target collection header & About tab content.
|
|
110
|
+
*/
|
|
111
|
+
readonly collectionExtraInfo?: CollectionExtraInfo;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The "extra info" package provided by the PPS for profile pages, including details
|
|
115
|
+
* used to populate the profile header.
|
|
116
|
+
*/
|
|
117
|
+
readonly accountExtraInfo?: AccountExtraInfo;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Context about the user session that produced the search response, from the PPS.
|
|
121
|
+
*/
|
|
122
|
+
readonly sessionContext?: SearchResponseSessionContext;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The set of requested page elements for profile pages, if applicable. These represent
|
|
126
|
+
* any content specific to the current profile tab.
|
|
127
|
+
*/
|
|
128
|
+
readonly pageElements?: PageElementMap;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* An array of the current target collection's parent collections. Should include *all*
|
|
132
|
+
* ancestors in the collection hierarchy, not just the immediate parent.
|
|
133
|
+
*/
|
|
134
|
+
readonly parentCollections?: string[];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* An object storing result counts for the current search bucketed by letter prefix.
|
|
138
|
+
* Keys are the result field on which the prefixes are considered (e.g., title/creator)
|
|
139
|
+
* and values are a Record mapping letters to their counts.
|
|
140
|
+
*/
|
|
141
|
+
readonly prefixFilterCountMap: Partial<
|
|
142
|
+
Record<PrefixFilterType, PrefixFilterCounts>
|
|
143
|
+
>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Any error message from the most recent search results response.
|
|
147
|
+
*/
|
|
148
|
+
readonly queryErrorMessage?: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* An array of all the tile models whose management checkboxes are checked
|
|
152
|
+
*/
|
|
153
|
+
readonly checkedTileModels: TileModel[];
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An array of all the tile models whose management checkboxes are unchecked
|
|
157
|
+
*/
|
|
158
|
+
readonly uncheckedTileModels: TileModel[];
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* A Promise which, after each query change, resolves once the fetches for the initial
|
|
162
|
+
* search have completed. Waits for *both* the hits and aggregations fetches to finish.
|
|
163
|
+
*
|
|
164
|
+
* Ensure you await this component's `updateComplete` promise before awaiting this
|
|
165
|
+
* one, to ensure you do not await an obsolete promise from the previous update.
|
|
166
|
+
*/
|
|
167
|
+
readonly initialSearchComplete: Promise<boolean>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Resets the data source to its empty state, with no result pages, aggregations, etc.
|
|
171
|
+
*/
|
|
172
|
+
reset(): void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Resets the data source's result pages, keeping other state intact.
|
|
176
|
+
*/
|
|
177
|
+
resetPages(): void;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Adds the given page of tile models to the data source.
|
|
181
|
+
* If the given page number already exists, that page will be overwritten.
|
|
182
|
+
* This method expects that the provided tiles already fit the configured page size; it
|
|
183
|
+
* will not split them into multiple pages.
|
|
184
|
+
* @param pageNum Which page number to add (indexed starting from 1)
|
|
185
|
+
* @param pageTiles The array of tile models for the new page
|
|
186
|
+
*/
|
|
187
|
+
addPage(pageNum: number, pageTiles: TileModel[]): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Adds all of the given pages of tile models to the data source, splitting them into
|
|
191
|
+
* multiple pages according to the configured page size if necessary. Any pages that
|
|
192
|
+
* have tiles added by this method will have any existing content overwritten.
|
|
193
|
+
* @param firstPageNum Which page number to start adding pages from (pages are indexed starting from 1)
|
|
194
|
+
* @param tiles The full array of tile models to add across one or more pages
|
|
195
|
+
*/
|
|
196
|
+
addMultiplePages(firstPageNum: number, tiles: TileModel[]): void;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Returns the given page of tile models from the data source.
|
|
200
|
+
* @param pageNum Which page number to get (indexed starting from 1)
|
|
201
|
+
*/
|
|
202
|
+
getPage(pageNum: number): TileModel[];
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns the full set of paged tile models stored in this data source.
|
|
206
|
+
*/
|
|
207
|
+
getAllPages(): Record<string, TileModel[]>;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Whether the data source contains any tiles for the given page number.
|
|
211
|
+
* @param pageNum Which page number to query (indexed starting from 1)
|
|
212
|
+
*/
|
|
213
|
+
hasPage(pageNum: number): boolean;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Returns the single tile model appearing at the given index in the
|
|
217
|
+
* data source, with respect to the current page size. Returns `undefined` if
|
|
218
|
+
* the corresponding page is not present on the data source or if it does not
|
|
219
|
+
* contain a tile model at the corresponding index.
|
|
220
|
+
* @param index The 0-based index (within the full data source) of the tile to get
|
|
221
|
+
*/
|
|
222
|
+
getTileModelAt(index: number): TileModel | undefined;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Returns the first numeric tile index corresponding to the given tile model object,
|
|
226
|
+
* or -1 if the given tile model is not present.
|
|
227
|
+
* @param tile The tile model to search for in the data source
|
|
228
|
+
*/
|
|
229
|
+
indexOf(tile: TileModel): number;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Requests that the data source fire a backend request for the given page of results.
|
|
233
|
+
* @param pageNum Which page number to fetch results for
|
|
234
|
+
* @param numInitialPages How many pages should be batched together on an initial fetch
|
|
235
|
+
*/
|
|
236
|
+
fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Requests that the data source update its prefix bucket result counts for the given
|
|
240
|
+
* type of prefix filter.
|
|
241
|
+
* @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
|
|
242
|
+
*/
|
|
243
|
+
updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Fetches and caches the prefix filter counts for the current sort type,
|
|
247
|
+
* provided it is one that permits prefix filtering. (If not, this does nothing).
|
|
248
|
+
*/
|
|
249
|
+
updatePrefixFiltersForCurrentSort(): Promise<void>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Clears the cached letter counts for both title and creator, and
|
|
253
|
+
* fetches a new set of counts for whichever of them is the currently
|
|
254
|
+
* selected sort option (which may be neither).
|
|
255
|
+
*
|
|
256
|
+
* Call this whenever the counts are invalidated (e.g., by a query change).
|
|
257
|
+
*/
|
|
258
|
+
refreshLetterCounts(): void;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Returns the current page size of the data source.
|
|
262
|
+
*/
|
|
263
|
+
getPageSize(): number;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Changes the page size used by the data source, discarding any previously-fetched pages.
|
|
267
|
+
*
|
|
268
|
+
* **Note: this operation will reset any data stored in the data source!**
|
|
269
|
+
* @param pageSize
|
|
270
|
+
*/
|
|
271
|
+
setPageSize(pageSize: number): void;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Sets the total number of pages that should be batched together on each initial fetch.
|
|
275
|
+
* @param pages How many initial pages to batch
|
|
276
|
+
*/
|
|
277
|
+
setNumInitialPages(numPages: number): void;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Sets the total result count for this data source to the given value.
|
|
281
|
+
* @param count The number of total results to set
|
|
282
|
+
*/
|
|
283
|
+
setTotalResultCount(count: number): void;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Sets whether this data source should suppress further data fetches, i.e. ignore any
|
|
287
|
+
* future query changes on its host that would trigger a page/facet fetch.
|
|
288
|
+
* @param suppressed Whether further fetches for this data source should be suppressed
|
|
289
|
+
*/
|
|
290
|
+
setFetchesSuppressed(suppressed: boolean): void;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Sets whether the end of the current data has been reached, indicating whether further
|
|
294
|
+
* pages should be looked up.
|
|
295
|
+
* @param reached Whether we are at the end of the data for the current query state
|
|
296
|
+
*/
|
|
297
|
+
setEndOfDataReached(reached: boolean): void;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Notifies the data source that a query change has occurred, which may trigger a data
|
|
301
|
+
* reset & new fetches.
|
|
302
|
+
*/
|
|
303
|
+
handleQueryChange(): Promise<void>;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Notifies the data source that the readiness state of the facets has been changed, which
|
|
307
|
+
* may trigger facet fetches if they were previously delayed.
|
|
308
|
+
*/
|
|
309
|
+
handleFacetReadinessChange(ready: boolean): Promise<void>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Applies the given map function to all of the tile models in every page of the data
|
|
313
|
+
* source.
|
|
314
|
+
* @param callback A callback function to apply on each tile model, as with Array.map
|
|
315
|
+
*/
|
|
316
|
+
map(
|
|
317
|
+
callback: (
|
|
318
|
+
model: TileModel,
|
|
319
|
+
index: number,
|
|
320
|
+
array: TileModel[],
|
|
321
|
+
) => TileModel,
|
|
322
|
+
): void;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Checks every tile's management checkbox
|
|
326
|
+
*/
|
|
327
|
+
checkAllTiles(): void;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Unchecks every tile's management checkbox
|
|
331
|
+
*/
|
|
332
|
+
uncheckAllTiles(): void;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Removes all tile models that are currently checked & adjusts the paging
|
|
336
|
+
* of the data source to account for any new gaps in the data.
|
|
337
|
+
*/
|
|
338
|
+
removeCheckedTiles(): void;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Fires requests to populate the TV channel mappings (chan2network and programs2chan),
|
|
342
|
+
* or returns the existing Promise for any such request that has already been made.
|
|
343
|
+
*/
|
|
344
|
+
populateTVChannelMaps(): Promise<TVChannelMaps>;
|
|
345
|
+
}
|