@internetarchive/collection-browser 3.1.1-alpha-webdev6778.7 → 3.1.1-alpha-webdev6778.8
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/app-root.js +606 -606
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +140 -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/smart-facets/smart-facet-bar.js +75 -75
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -3
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/expanded-date-picker.js +52 -52
- package/dist/src/expanded-date-picker.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.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.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/src/tiles/list/tile-list-compact.js +97 -97
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/utils/analytics-events.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +187 -187
- 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/sort-filter-bar/sort-filter-bar.test.js +37 -37
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +64 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +57 -57
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/package.json +1 -1
- package/src/app-root.ts +1140 -1140
- package/src/collection-browser.ts +1 -1
- package/src/collection-facets/facet-row.ts +296 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
- package/src/data-source/collection-browser-data-source-interface.ts +333 -333
- package/src/data-source/collection-browser-data-source.ts +2 -4
- package/src/data-source/models.ts +43 -43
- package/src/expanded-date-picker.ts +191 -191
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +870 -870
- package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
- package/src/tiles/base-tile-component.ts +53 -53
- package/src/tiles/grid/account-tile.ts +112 -112
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/list/tile-list-compact.ts +236 -236
- package/src/utils/analytics-events.ts +29 -29
- package/src/utils/format-date.ts +42 -42
- package/test/collection-browser.test.ts +2359 -2359
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
- package/test/tiles/grid/item-tile.test.ts +464 -464
- package/test/tiles/list/tile-list-compact.test.ts +228 -228
- package/test/utils/format-date.test.ts +39 -39
package/src/app-root.ts
CHANGED
|
@@ -1,1140 +1,1140 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AnalyticsEvent,
|
|
3
|
-
AnalyticsManager,
|
|
4
|
-
} from '@internetarchive/analytics-manager';
|
|
5
|
-
import {
|
|
6
|
-
SearchService,
|
|
7
|
-
SearchServiceInterface,
|
|
8
|
-
SearchType,
|
|
9
|
-
} from '@internetarchive/search-service';
|
|
10
|
-
import { html, css, LitElement, PropertyValues, nothing } from 'lit';
|
|
11
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
12
|
-
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
13
|
-
|
|
14
|
-
import type { ModalManagerInterface } from '@internetarchive/modal-manager';
|
|
15
|
-
import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
|
|
16
|
-
import type { CollectionBrowser } from '../src/collection-browser';
|
|
17
|
-
|
|
18
|
-
import '../src/collection-browser';
|
|
19
|
-
|
|
20
|
-
@customElement('app-root')
|
|
21
|
-
export class AppRoot extends LitElement {
|
|
22
|
-
private searchService: SearchServiceInterface =
|
|
23
|
-
this.initSearchServiceFromUrlParams();
|
|
24
|
-
|
|
25
|
-
private resizeObserver = new SharedResizeObserver();
|
|
26
|
-
|
|
27
|
-
@state() private toggleSlots: boolean = false;
|
|
28
|
-
|
|
29
|
-
@state() private currentPage?: number;
|
|
30
|
-
|
|
31
|
-
@state() private searchQuery?: string;
|
|
32
|
-
|
|
33
|
-
@state() private withinCollection?: string;
|
|
34
|
-
|
|
35
|
-
@state() private cellWidth: number = 18;
|
|
36
|
-
|
|
37
|
-
@state() private cellHeight: number = 29;
|
|
38
|
-
|
|
39
|
-
@state() private rowGap: number = 1.7;
|
|
40
|
-
|
|
41
|
-
@state() private colGap: number = 1.7;
|
|
42
|
-
|
|
43
|
-
@state() private suppressFacets: boolean = false;
|
|
44
|
-
|
|
45
|
-
@state() private lazyLoadFacets: boolean = false;
|
|
46
|
-
|
|
47
|
-
@state() private loggedIn: boolean = false;
|
|
48
|
-
|
|
49
|
-
@state() private searchType: SearchType = SearchType.METADATA;
|
|
50
|
-
|
|
51
|
-
@property({ type: Object, reflect: false }) latestAction?: AnalyticsEvent;
|
|
52
|
-
|
|
53
|
-
@query('#base-query-field') private baseQueryField!: HTMLInputElement;
|
|
54
|
-
|
|
55
|
-
@query('#base-collection-field')
|
|
56
|
-
private baseCollectionField!: HTMLInputElement;
|
|
57
|
-
|
|
58
|
-
@query('#page-number-input') private pageNumberInput!: HTMLInputElement;
|
|
59
|
-
|
|
60
|
-
@query('collection-browser') private collectionBrowser!: CollectionBrowser;
|
|
61
|
-
|
|
62
|
-
@query('modal-manager') private modalManager!: ModalManagerInterface;
|
|
63
|
-
|
|
64
|
-
private analyticsManager = new AnalyticsManager();
|
|
65
|
-
|
|
66
|
-
private analyticsHandler: AnalyticsManagerInterface = {
|
|
67
|
-
sendPing: this.sendAnalytics.bind(this),
|
|
68
|
-
sendEvent: this.sendAnalytics.bind(this),
|
|
69
|
-
sendEventNoSampling: this.sendAnalytics.bind(this),
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
private sendAnalytics(ae: AnalyticsEvent) {
|
|
73
|
-
console.log('Analytics Received ----', ae);
|
|
74
|
-
this.latestAction = ae;
|
|
75
|
-
this.analyticsManager?.sendEvent(ae);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private initSearchServiceFromUrlParams() {
|
|
79
|
-
const params = new URL(window.location.href).searchParams;
|
|
80
|
-
return new SearchService({
|
|
81
|
-
includeCredentials: false,
|
|
82
|
-
baseUrl: params.get('search_base_url') ?? undefined,
|
|
83
|
-
servicePath: params.get('search_service_path') ?? undefined,
|
|
84
|
-
debuggingEnabled: !!params.get('debugging'),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private searchPressed(e: Event) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
this.searchQuery = this.baseQueryField.value;
|
|
91
|
-
this.collectionBrowser.searchType = this.searchType;
|
|
92
|
-
|
|
93
|
-
this.goToCurrentPage();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
private collectionChanged(e: Event) {
|
|
97
|
-
e.preventDefault();
|
|
98
|
-
this.withinCollection = this.baseCollectionField.value;
|
|
99
|
-
this.collectionBrowser.withinCollection = this.withinCollection;
|
|
100
|
-
|
|
101
|
-
this.goToCurrentPage();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
private goToCurrentPage() {
|
|
105
|
-
const page = this.currentPage ?? 1;
|
|
106
|
-
if (page > 1) {
|
|
107
|
-
this.collectionBrowser.goToPage(page);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
private changePagePressed(e: Event) {
|
|
112
|
-
e.preventDefault();
|
|
113
|
-
this.currentPage = this.pageNumberInput.valueAsNumber;
|
|
114
|
-
this.collectionBrowser.goToPage(this.currentPage);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
protected override updated(changed: PropertyValues): void {
|
|
118
|
-
if (changed.has('currentPage') && this.currentPage) {
|
|
119
|
-
this.pageNumberInput.value = this.currentPage.toString();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (changed.has('searchQuery')) {
|
|
123
|
-
this.queryUpdated();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private queryUpdated() {
|
|
128
|
-
this.collectionBrowser.baseQuery = this.searchQuery;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private get getClass() {
|
|
132
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
133
|
-
|
|
134
|
-
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
render() {
|
|
138
|
-
return html`
|
|
139
|
-
<div class="dev-tool-container">
|
|
140
|
-
<div id="dev-tools" class=${this.getClass}>
|
|
141
|
-
<div id="search-and-page-inputs">
|
|
142
|
-
<form @submit=${this.searchPressed}>
|
|
143
|
-
<label for="base-query-field"> Query: </label>
|
|
144
|
-
<input
|
|
145
|
-
type="text"
|
|
146
|
-
id="base-query-field"
|
|
147
|
-
.value=${this.searchQuery ?? ''}
|
|
148
|
-
/>
|
|
149
|
-
<input type="submit" value="Search" />
|
|
150
|
-
</form>
|
|
151
|
-
<form @submit=${this.changePagePressed}>
|
|
152
|
-
<label for="page-number-input"> Page: </label>
|
|
153
|
-
<input type="number" value="1" id="page-number-input" />
|
|
154
|
-
<input type="submit" value="Go" />
|
|
155
|
-
</form>
|
|
156
|
-
</div>
|
|
157
|
-
<div>
|
|
158
|
-
<form @submit=${this.collectionChanged}>
|
|
159
|
-
<label for="base-collection-field"> Within collection: </label>
|
|
160
|
-
<input
|
|
161
|
-
type="text"
|
|
162
|
-
id="base-collection-field"
|
|
163
|
-
.value=${this.withinCollection ?? ''}
|
|
164
|
-
/>
|
|
165
|
-
<input type="submit" value="Search" />
|
|
166
|
-
</form>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<div id="search-types">
|
|
170
|
-
Search type:
|
|
171
|
-
<span class="search-type">
|
|
172
|
-
<input
|
|
173
|
-
type="radio"
|
|
174
|
-
id="default-search"
|
|
175
|
-
name="search-type"
|
|
176
|
-
value="default"
|
|
177
|
-
.checked=${this.searchType === SearchType.DEFAULT}
|
|
178
|
-
@click=${this.searchTypeSelected}
|
|
179
|
-
/>
|
|
180
|
-
<label for="default-search">Default</label>
|
|
181
|
-
</span>
|
|
182
|
-
<span class="search-type">
|
|
183
|
-
<input
|
|
184
|
-
type="radio"
|
|
185
|
-
id="metadata-search"
|
|
186
|
-
name="search-type"
|
|
187
|
-
value="metadata"
|
|
188
|
-
.checked=${this.searchType === SearchType.METADATA}
|
|
189
|
-
@click=${this.searchTypeSelected}
|
|
190
|
-
/>
|
|
191
|
-
<label for="metadata-search">Metadata</label>
|
|
192
|
-
</span>
|
|
193
|
-
<span class="search-type">
|
|
194
|
-
<input
|
|
195
|
-
type="radio"
|
|
196
|
-
id="fulltext-search"
|
|
197
|
-
name="search-type"
|
|
198
|
-
value="fulltext"
|
|
199
|
-
.checked=${this.searchType === SearchType.FULLTEXT}
|
|
200
|
-
@click=${this.searchTypeSelected}
|
|
201
|
-
/>
|
|
202
|
-
<label for="fulltext-search">Full text</label>
|
|
203
|
-
</span>
|
|
204
|
-
<span class="search-type">
|
|
205
|
-
<input
|
|
206
|
-
type="radio"
|
|
207
|
-
id="tv-search"
|
|
208
|
-
name="search-type"
|
|
209
|
-
value="tv"
|
|
210
|
-
.checked=${this.searchType === SearchType.TV}
|
|
211
|
-
@click=${this.searchTypeSelected}
|
|
212
|
-
/>
|
|
213
|
-
<label for="tv-search">TV</label>
|
|
214
|
-
</span>
|
|
215
|
-
<span class="search-type">
|
|
216
|
-
<input
|
|
217
|
-
type="radio"
|
|
218
|
-
id="radio-search"
|
|
219
|
-
name="search-type"
|
|
220
|
-
value="radio"
|
|
221
|
-
.checked=${this.searchType === SearchType.RADIO}
|
|
222
|
-
@click=${this.searchTypeSelected}
|
|
223
|
-
/>
|
|
224
|
-
<label for="radio-search">Radio</label>
|
|
225
|
-
</span>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
<div id="toggle-controls">
|
|
229
|
-
<button
|
|
230
|
-
@click=${() => {
|
|
231
|
-
const details =
|
|
232
|
-
this.shadowRoot?.getElementById('cell-size-control');
|
|
233
|
-
details?.classList.toggle('hidden');
|
|
234
|
-
const rowGapControls =
|
|
235
|
-
this.shadowRoot?.getElementById('cell-gap-control');
|
|
236
|
-
rowGapControls?.classList.toggle('hidden');
|
|
237
|
-
}}
|
|
238
|
-
>
|
|
239
|
-
Toggle Cell Controls
|
|
240
|
-
</button>
|
|
241
|
-
<button
|
|
242
|
-
@click=${() => {
|
|
243
|
-
const details = this.shadowRoot?.getElementById(
|
|
244
|
-
'latest-event-details',
|
|
245
|
-
);
|
|
246
|
-
details?.classList.toggle('hidden');
|
|
247
|
-
}}
|
|
248
|
-
>
|
|
249
|
-
Last Event Captured
|
|
250
|
-
</button>
|
|
251
|
-
</div>
|
|
252
|
-
|
|
253
|
-
<div id="last-event">
|
|
254
|
-
<pre id="latest-event-details" class="hidden">
|
|
255
|
-
${JSON.stringify(this.latestAction, null, 2)}
|
|
256
|
-
</pre
|
|
257
|
-
>
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
<fieldset class="cell-controls">
|
|
261
|
-
<legend>Cell Controls</legend>
|
|
262
|
-
<div>
|
|
263
|
-
<label for="cell-width-slider">Cell width:</label>
|
|
264
|
-
<input
|
|
265
|
-
type="range"
|
|
266
|
-
min="10"
|
|
267
|
-
max="100"
|
|
268
|
-
value="18"
|
|
269
|
-
step="0.1"
|
|
270
|
-
id="cell-width-slider"
|
|
271
|
-
@input=${this.widthChanged}
|
|
272
|
-
/>
|
|
273
|
-
<span>${this.cellWidth}rem</span>
|
|
274
|
-
</div>
|
|
275
|
-
<div>
|
|
276
|
-
<label for="cell-height-slider">Cell height:</label>
|
|
277
|
-
<input
|
|
278
|
-
type="range"
|
|
279
|
-
min="10"
|
|
280
|
-
max="100"
|
|
281
|
-
value="29"
|
|
282
|
-
step="0.1"
|
|
283
|
-
id="cell-height-slider"
|
|
284
|
-
@input=${this.heightChanged}
|
|
285
|
-
/>
|
|
286
|
-
<span>${this.cellHeight}rem</span>
|
|
287
|
-
</div>
|
|
288
|
-
<div>
|
|
289
|
-
<label for="cell-row-gap-slider">Row gap:</label>
|
|
290
|
-
<input
|
|
291
|
-
type="range"
|
|
292
|
-
min="0"
|
|
293
|
-
max="5"
|
|
294
|
-
value="1.7"
|
|
295
|
-
step="0.1"
|
|
296
|
-
id="cell-row-gap-slider"
|
|
297
|
-
@input=${this.rowGapChanged}
|
|
298
|
-
/>
|
|
299
|
-
<span>${this.rowGap}rem</span>
|
|
300
|
-
</div>
|
|
301
|
-
<div>
|
|
302
|
-
<label for="cell-col-gap-slider">Col gap:</label>
|
|
303
|
-
<input
|
|
304
|
-
type="range"
|
|
305
|
-
min="0"
|
|
306
|
-
max="5"
|
|
307
|
-
value="1.7"
|
|
308
|
-
step="0.1"
|
|
309
|
-
id="cell-col-gap-slider"
|
|
310
|
-
@input=${this.colGapChanged}
|
|
311
|
-
/>
|
|
312
|
-
<span>${this.colGap}rem</span>
|
|
313
|
-
</div>
|
|
314
|
-
</fieldset>
|
|
315
|
-
|
|
316
|
-
<fieldset class="other-controls">
|
|
317
|
-
<legend>Other Controls</legend>
|
|
318
|
-
<div class="checkbox-control">
|
|
319
|
-
<input
|
|
320
|
-
type="checkbox"
|
|
321
|
-
id="simulate-login"
|
|
322
|
-
@click=${this.loginChanged}
|
|
323
|
-
/>
|
|
324
|
-
<label for="simulate-login">Simulate login</label>
|
|
325
|
-
</div>
|
|
326
|
-
<div class="checkbox-control">
|
|
327
|
-
<input
|
|
328
|
-
type="checkbox"
|
|
329
|
-
id="enable-date-picker"
|
|
330
|
-
checked
|
|
331
|
-
@click=${this.datePickerChanged}
|
|
332
|
-
/>
|
|
333
|
-
<label for="enable-date-picker">Enable date picker</label>
|
|
334
|
-
</div>
|
|
335
|
-
<div class="checkbox-control">
|
|
336
|
-
<input
|
|
337
|
-
type="checkbox"
|
|
338
|
-
id="enable-facets"
|
|
339
|
-
checked
|
|
340
|
-
@click=${this.facetsChanged}
|
|
341
|
-
/>
|
|
342
|
-
<label for="enable-facets">Enable facets</label>
|
|
343
|
-
</div>
|
|
344
|
-
<div class="checkbox-control indent">
|
|
345
|
-
<input
|
|
346
|
-
type="checkbox"
|
|
347
|
-
id="lazy-load-facets"
|
|
348
|
-
?disabled=${this.suppressFacets}
|
|
349
|
-
@click=${this.lazyLoadFacetsChanged}
|
|
350
|
-
/>
|
|
351
|
-
<label for="lazy-load-facets">Lazy load facets</label>
|
|
352
|
-
</div>
|
|
353
|
-
<div class="checkbox-control">
|
|
354
|
-
<input
|
|
355
|
-
type="checkbox"
|
|
356
|
-
id="enable-management"
|
|
357
|
-
@click=${this.manageModeCheckboxChanged}
|
|
358
|
-
/>
|
|
359
|
-
<label for="enable-management">Enable manage mode</label>
|
|
360
|
-
</div>
|
|
361
|
-
<div class="checkbox-control indent">
|
|
362
|
-
<input
|
|
363
|
-
type="checkbox"
|
|
364
|
-
id="enable-search-management"
|
|
365
|
-
@click=${this.SearchManageModeCheckboxChanged}
|
|
366
|
-
/>
|
|
367
|
-
<label for="enable-search-management">Search</label>
|
|
368
|
-
</div>
|
|
369
|
-
<div class="checkbox-control">
|
|
370
|
-
<input
|
|
371
|
-
type="checkbox"
|
|
372
|
-
id="enable-smart-facet-bar"
|
|
373
|
-
@click=${this.smartFacetBarCheckboxChanged}
|
|
374
|
-
/>
|
|
375
|
-
<label for="enable-smart-facet-bar">Enable smart facet bar</label>
|
|
376
|
-
</div>
|
|
377
|
-
</fieldset>
|
|
378
|
-
|
|
379
|
-
<fieldset class="cb-visual-appearance">
|
|
380
|
-
<legend>CB Visual Appearance</legend>
|
|
381
|
-
<div class="checkbox-control">
|
|
382
|
-
<input
|
|
383
|
-
type="checkbox"
|
|
384
|
-
id="show-facet-group-outline-check"
|
|
385
|
-
@click=${this.toggleFacetGroupOutline}
|
|
386
|
-
/>
|
|
387
|
-
<label for="show-facet-group-outline-check">
|
|
388
|
-
Show facet group outlines
|
|
389
|
-
</label>
|
|
390
|
-
</div>
|
|
391
|
-
<div class="checkbox-control">
|
|
392
|
-
<input
|
|
393
|
-
type="checkbox"
|
|
394
|
-
id="show-outline-check"
|
|
395
|
-
@click=${this.outlineChanged}
|
|
396
|
-
/>
|
|
397
|
-
<label for="show-outline-check">Show cell outlines</label>
|
|
398
|
-
</div>
|
|
399
|
-
</fieldset>
|
|
400
|
-
|
|
401
|
-
<fieldset class="user-profile-controls">
|
|
402
|
-
<legend>User Profile Controls</legend>
|
|
403
|
-
<div class="checkbox-control">
|
|
404
|
-
<input
|
|
405
|
-
type="checkbox"
|
|
406
|
-
id="enable-facet-top-slot"
|
|
407
|
-
@click=${this.facetTopSlotCheckboxChanged}
|
|
408
|
-
/>
|
|
409
|
-
<label for="enable-facet-top-slot">Show facet top slot</label>
|
|
410
|
-
</div>
|
|
411
|
-
<div class="checkbox-control">
|
|
412
|
-
<input
|
|
413
|
-
type="checkbox"
|
|
414
|
-
id="enable-cb-top-slot"
|
|
415
|
-
@click=${this.cbTopSlotCheckboxChanged}
|
|
416
|
-
/>
|
|
417
|
-
<label for="enable-cb-top-slot">Show CB top slot</label>
|
|
418
|
-
</div>
|
|
419
|
-
<div class="checkbox-control">
|
|
420
|
-
<input
|
|
421
|
-
type="checkbox"
|
|
422
|
-
id="enable-sortbar-left-slot"
|
|
423
|
-
@click=${this.sortBarLeftSlotCheckboxChanged}
|
|
424
|
-
/>
|
|
425
|
-
<label for="enable-sortbar-left-slot"
|
|
426
|
-
>Show sortbar left slot</label
|
|
427
|
-
>
|
|
428
|
-
</div>
|
|
429
|
-
<div class="checkbox-control">
|
|
430
|
-
<input
|
|
431
|
-
type="checkbox"
|
|
432
|
-
id="enable-sortbar-right-slot"
|
|
433
|
-
@click=${this.sortBarRightSlotCheckboxChanged}
|
|
434
|
-
/>
|
|
435
|
-
<label for="enable-sortbar-right-slot"
|
|
436
|
-
>Show sortbar right slot</label
|
|
437
|
-
>
|
|
438
|
-
</div>
|
|
439
|
-
<div class="checkbox-control">
|
|
440
|
-
<input
|
|
441
|
-
type="checkbox"
|
|
442
|
-
id="enable-result-last-tile-slot"
|
|
443
|
-
@click=${this.resultLastTileSlotCheckboxChanged}
|
|
444
|
-
/>
|
|
445
|
-
<label for="enable-result-last-tile-slot">
|
|
446
|
-
Show result last tile slot
|
|
447
|
-
</label>
|
|
448
|
-
</div>
|
|
449
|
-
<div class="checkbox-control">
|
|
450
|
-
<input
|
|
451
|
-
type="checkbox"
|
|
452
|
-
id="enable-replaced-sort-options"
|
|
453
|
-
@click=${this.replaceSortOptionsChanged}
|
|
454
|
-
/>
|
|
455
|
-
<label for="enable-replaced-sort-options">
|
|
456
|
-
Show replaced sort options
|
|
457
|
-
</label>
|
|
458
|
-
</div>
|
|
459
|
-
</fieldset>
|
|
460
|
-
|
|
461
|
-
<fieldset class="user-profile-controls">
|
|
462
|
-
<legend>Set Placeholder Types</legend>
|
|
463
|
-
<div class="checkbox-control">
|
|
464
|
-
<input
|
|
465
|
-
id="enable-loading-placeholder"
|
|
466
|
-
type="radio"
|
|
467
|
-
@click=${() => this.setPlaceholderType('loading-placeholder')}
|
|
468
|
-
name="placeholder-radio"
|
|
469
|
-
/>
|
|
470
|
-
<label for="enable-loading-placeholder"
|
|
471
|
-
>Loading Placeholder</label
|
|
472
|
-
>
|
|
473
|
-
</div>
|
|
474
|
-
<div class="checkbox-control">
|
|
475
|
-
<input
|
|
476
|
-
id="enable-empty-placeholder"
|
|
477
|
-
type="radio"
|
|
478
|
-
@click=${() => this.setPlaceholderType('error-placeholder')}
|
|
479
|
-
value="empty-placeholder"
|
|
480
|
-
name="placeholder-radio"
|
|
481
|
-
/>
|
|
482
|
-
<label for="enable-empty-placeholder">Empty Placeholder</label>
|
|
483
|
-
</div>
|
|
484
|
-
</fieldset>
|
|
485
|
-
</div>
|
|
486
|
-
<button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}>
|
|
487
|
-
Toggle Search Controls
|
|
488
|
-
</button>
|
|
489
|
-
</div>
|
|
490
|
-
<div id="collection-browser-container">
|
|
491
|
-
<collection-browser
|
|
492
|
-
facetPaneVisible
|
|
493
|
-
.baseNavigationUrl=${'https://archive.org'}
|
|
494
|
-
.baseImageUrl=${'https://archive.org'}
|
|
495
|
-
.searchService=${this.searchService}
|
|
496
|
-
.resizeObserver=${this.resizeObserver}
|
|
497
|
-
.showHistogramDatePicker=${true}
|
|
498
|
-
.suppressFacets=${this.suppressFacets}
|
|
499
|
-
.lazyLoadFacets=${this.lazyLoadFacets}
|
|
500
|
-
.loggedIn=${this.loggedIn}
|
|
501
|
-
.modalManager=${this.modalManager}
|
|
502
|
-
.analyticsHandler=${this.analyticsHandler}
|
|
503
|
-
.pageContext=${'search'}
|
|
504
|
-
@visiblePageChanged=${this.visiblePageChanged}
|
|
505
|
-
@baseQueryChanged=${this.baseQueryChanged}
|
|
506
|
-
@searchTypeChanged=${this.searchTypeChanged}
|
|
507
|
-
@manageModeChanged=${this.manageModeChanged}
|
|
508
|
-
@itemRemovalRequested=${this.handleItemRemovalRequest}
|
|
509
|
-
@itemManagerRequested=${this.handleItemManagerRequest}
|
|
510
|
-
>
|
|
511
|
-
${this.toggleSlots
|
|
512
|
-
? html`<div slot="sortbar-left-slot">Sort Slot</div>`
|
|
513
|
-
: nothing}
|
|
514
|
-
${this.toggleSlots
|
|
515
|
-
? html`<div slot="facet-top-slot">Facet Slot</div>`
|
|
516
|
-
: nothing}
|
|
517
|
-
</collection-browser>
|
|
518
|
-
</div>
|
|
519
|
-
<modal-manager></modal-manager>
|
|
520
|
-
`;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
private async setPlaceholderType(type: string) {
|
|
524
|
-
switch (type) {
|
|
525
|
-
case 'loading-placeholder':
|
|
526
|
-
this.collectionBrowser.baseQuery = '';
|
|
527
|
-
this.collectionBrowser.suppressPlaceholders = true;
|
|
528
|
-
this.collectionBrowser.clearResultsOnEmptyQuery = true;
|
|
529
|
-
this.requestUpdate();
|
|
530
|
-
await this.collectionBrowser.updateComplete;
|
|
531
|
-
break;
|
|
532
|
-
default:
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
private baseQueryChanged(e: CustomEvent<{ baseQuery?: string }>): void {
|
|
538
|
-
this.searchQuery = e.detail.baseQuery;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/** Handler for search type changes coming from collection browser */
|
|
542
|
-
private searchTypeChanged(e: CustomEvent<SearchType>): void {
|
|
543
|
-
this.searchType = e.detail;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
/** Handler for user input selecting a search type */
|
|
547
|
-
private searchTypeSelected(e: Event) {
|
|
548
|
-
const target = e.target as HTMLInputElement;
|
|
549
|
-
this.searchType = this.searchTypeFromSelectedOption(target.value);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
private searchTypeFromSelectedOption(option: string): SearchType {
|
|
553
|
-
switch (option) {
|
|
554
|
-
case 'metadata':
|
|
555
|
-
return SearchType.METADATA;
|
|
556
|
-
case 'fulltext':
|
|
557
|
-
return SearchType.FULLTEXT;
|
|
558
|
-
case 'tv':
|
|
559
|
-
return SearchType.TV;
|
|
560
|
-
case 'radio':
|
|
561
|
-
return SearchType.RADIO;
|
|
562
|
-
default:
|
|
563
|
-
return SearchType.DEFAULT;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
private loginChanged(e: Event) {
|
|
568
|
-
const target = e.target as HTMLInputElement;
|
|
569
|
-
if (target.checked) {
|
|
570
|
-
this.loggedIn = true;
|
|
571
|
-
} else {
|
|
572
|
-
this.loggedIn = false;
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
private outlineChanged(e: Event) {
|
|
577
|
-
const target = e.target as HTMLInputElement;
|
|
578
|
-
if (target.checked) {
|
|
579
|
-
this.collectionBrowser.style.setProperty(
|
|
580
|
-
'--infiniteScrollerCellOutline',
|
|
581
|
-
'1px solid #33D1FF',
|
|
582
|
-
);
|
|
583
|
-
} else {
|
|
584
|
-
this.collectionBrowser.style.removeProperty(
|
|
585
|
-
'--infiniteScrollerCellOutline',
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
private toggleDevTools() {
|
|
591
|
-
const pageUrl = new URL(window.location.href);
|
|
592
|
-
const { searchParams } = pageUrl;
|
|
593
|
-
|
|
594
|
-
if (searchParams.get('hide-dev-tools')) {
|
|
595
|
-
searchParams.delete('hide-dev-tools');
|
|
596
|
-
} else {
|
|
597
|
-
searchParams.set('hide-dev-tools', 'true');
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
this.shadowRoot?.getElementById('dev-tools')?.classList.toggle('hidden');
|
|
601
|
-
|
|
602
|
-
if (window.history.replaceState) {
|
|
603
|
-
window.history.replaceState(
|
|
604
|
-
{
|
|
605
|
-
path: pageUrl.toString(),
|
|
606
|
-
},
|
|
607
|
-
'',
|
|
608
|
-
pageUrl.toString(),
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
private toggleFacetGroupOutline(e: Event) {
|
|
614
|
-
const target = e.target as HTMLInputElement;
|
|
615
|
-
if (target.checked) {
|
|
616
|
-
this.collectionBrowser.classList.add('showFacetGroupOutlines');
|
|
617
|
-
this.modalManager.classList.add('showFacetGroupOutlines');
|
|
618
|
-
} else {
|
|
619
|
-
this.collectionBrowser.classList.remove('showFacetGroupOutlines');
|
|
620
|
-
this.modalManager.classList.remove('showFacetGroupOutlines');
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
private datePickerChanged(e: Event) {
|
|
625
|
-
const target = e.target as HTMLInputElement;
|
|
626
|
-
this.collectionBrowser.showHistogramDatePicker = target.checked;
|
|
627
|
-
|
|
628
|
-
// When disabling the date picker from the demo app, also clear any existing date range params
|
|
629
|
-
if (!this.collectionBrowser.showHistogramDatePicker) {
|
|
630
|
-
this.collectionBrowser.minSelectedDate = undefined;
|
|
631
|
-
this.collectionBrowser.maxSelectedDate = undefined;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
private facetsChanged(e: Event) {
|
|
636
|
-
const target = e.target as HTMLInputElement;
|
|
637
|
-
this.suppressFacets = !target.checked;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
private lazyLoadFacetsChanged(e: Event) {
|
|
641
|
-
const target = e.target as HTMLInputElement;
|
|
642
|
-
this.lazyLoadFacets = target.checked;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Handler for when collection browser's manage mode changes.
|
|
647
|
-
* This lets us disable the checkbox in the dev panel when the user cancels out
|
|
648
|
-
* of manage mode from within collection browser.
|
|
649
|
-
*/
|
|
650
|
-
private manageModeChanged(e: CustomEvent<boolean>): void {
|
|
651
|
-
const manageCheckbox = this.shadowRoot?.querySelector(
|
|
652
|
-
'#enable-management',
|
|
653
|
-
) as HTMLInputElement;
|
|
654
|
-
if (manageCheckbox) manageCheckbox.checked = e.detail;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* Handler for item removal
|
|
659
|
-
*/
|
|
660
|
-
private handleItemRemovalRequest(e: CustomEvent) {
|
|
661
|
-
this.collectionBrowser.showRemoveItemsProcessingModal();
|
|
662
|
-
console.log('itemRemovalRequested: ', e.detail.items);
|
|
663
|
-
|
|
664
|
-
setTimeout(() => {
|
|
665
|
-
// execute item-removal-service, and response is successfully deleted
|
|
666
|
-
const status = false;
|
|
667
|
-
|
|
668
|
-
if (status) {
|
|
669
|
-
// looking for success?
|
|
670
|
-
this.collectionBrowser.isManageView = false;
|
|
671
|
-
this.modalManager?.closeModal();
|
|
672
|
-
this.modalManager?.classList.remove('remove-items');
|
|
673
|
-
} else {
|
|
674
|
-
// looking for failure?
|
|
675
|
-
this.collectionBrowser.showRemoveItemsErrorModal();
|
|
676
|
-
}
|
|
677
|
-
}, 2000); // let's wait to see processing modal
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Handler when item manage requested
|
|
682
|
-
*/
|
|
683
|
-
private handleItemManagerRequest(e: CustomEvent) {
|
|
684
|
-
console.log('itemManagerRequested: ', e.detail.items);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Handler for when the dev panel's "Enable manage mode" checkbox is changed.
|
|
689
|
-
*/
|
|
690
|
-
private manageModeCheckboxChanged(e: Event) {
|
|
691
|
-
const target = e.target as HTMLInputElement;
|
|
692
|
-
this.collectionBrowser.isManageView = target.checked;
|
|
693
|
-
this.collectionBrowser.manageViewLabel =
|
|
694
|
-
'Select items to remove (customizable texts)';
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* Handler when the dev panel's "Enable manage mode -> Search" checkbox is changed.
|
|
699
|
-
*/
|
|
700
|
-
private SearchManageModeCheckboxChanged(e: Event) {
|
|
701
|
-
const target = e.target as HTMLInputElement;
|
|
702
|
-
this.collectionBrowser.pageContext = target.checked
|
|
703
|
-
? 'search'
|
|
704
|
-
: 'collection';
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Handler for when the dev panel's "Enable smart facet bar" checkbox is changed.
|
|
709
|
-
*/
|
|
710
|
-
private smartFacetBarCheckboxChanged(e: Event) {
|
|
711
|
-
const target = e.target as HTMLInputElement;
|
|
712
|
-
this.collectionBrowser.showSmartFacetBar = target.checked;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Handler for when the dev panel's "Show facet top slot" checkbox is changed.
|
|
717
|
-
*/
|
|
718
|
-
private facetTopSlotCheckboxChanged(e: Event) {
|
|
719
|
-
const target = e.target as HTMLInputElement;
|
|
720
|
-
|
|
721
|
-
const p = document.createElement('p');
|
|
722
|
-
p.style.setProperty('border', '1px solid #000');
|
|
723
|
-
p.textContent = 'New stuff as a child.';
|
|
724
|
-
p.style.setProperty('height', '20rem');
|
|
725
|
-
p.style.backgroundColor = '#00000';
|
|
726
|
-
p.setAttribute('slot', 'facet-top-slot');
|
|
727
|
-
|
|
728
|
-
if (target.checked) {
|
|
729
|
-
this.collectionBrowser.appendChild(p);
|
|
730
|
-
} else {
|
|
731
|
-
this.collectionBrowser.removeChild(
|
|
732
|
-
this.collectionBrowser.lastElementChild as Element,
|
|
733
|
-
);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
private toggleSlotOptions() {
|
|
738
|
-
this.toggleSlots = !this.toggleSlots;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
private resultLastTileSlotCheckboxChanged(e: Event) {
|
|
742
|
-
const target = e.target as HTMLInputElement;
|
|
743
|
-
|
|
744
|
-
const div = document.createElement('div');
|
|
745
|
-
const title = document.createElement('h3');
|
|
746
|
-
title.textContent = 'Upload';
|
|
747
|
-
|
|
748
|
-
div.setAttribute('slot', 'result-last-tile');
|
|
749
|
-
div.setAttribute('class', 'result-last-tile');
|
|
750
|
-
div.appendChild(title);
|
|
751
|
-
|
|
752
|
-
if (target.checked) {
|
|
753
|
-
this.collectionBrowser.appendChild(div);
|
|
754
|
-
} else {
|
|
755
|
-
this.collectionBrowser.removeChild(
|
|
756
|
-
this.collectionBrowser.lastElementChild as Element,
|
|
757
|
-
);
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* Handler for when the dev panel's "Show cb top slot" checkbox is changed.
|
|
763
|
-
*/
|
|
764
|
-
private cbTopSlotCheckboxChanged(e: Event) {
|
|
765
|
-
const target = e.target as HTMLInputElement;
|
|
766
|
-
|
|
767
|
-
const p = document.createElement('p');
|
|
768
|
-
p.style.setProperty('border', '1px solid #000');
|
|
769
|
-
p.textContent = 'My Favorite list header.';
|
|
770
|
-
p.style.setProperty('height', '10rem');
|
|
771
|
-
p.style.backgroundColor = '#00000';
|
|
772
|
-
p.setAttribute('slot', 'cb-top-slot');
|
|
773
|
-
|
|
774
|
-
if (target.checked) {
|
|
775
|
-
this.collectionBrowser.appendChild(p);
|
|
776
|
-
} else {
|
|
777
|
-
this.collectionBrowser.removeChild(
|
|
778
|
-
this.collectionBrowser.lastElementChild as Element,
|
|
779
|
-
);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Handler for when the dev panel's "Show sort bar top left slot" checkbox is changed.
|
|
785
|
-
*/
|
|
786
|
-
private sortBarLeftSlotCheckboxChanged(e: Event) {
|
|
787
|
-
const target = e.target as HTMLInputElement;
|
|
788
|
-
|
|
789
|
-
if (target.checked) {
|
|
790
|
-
const div = document.createElement('div');
|
|
791
|
-
div.style.setProperty('border', '1px solid #000');
|
|
792
|
-
div.textContent = 'Btn';
|
|
793
|
-
div.style.setProperty('height', '3rem');
|
|
794
|
-
div.style.setProperty('width', '3rem');
|
|
795
|
-
div.setAttribute('slot', 'sort-options-left');
|
|
796
|
-
|
|
797
|
-
this.collectionBrowser.appendChild(div);
|
|
798
|
-
} else {
|
|
799
|
-
const slottedEl = this.collectionBrowser.querySelector(
|
|
800
|
-
'[slot="sort-options-left"]',
|
|
801
|
-
);
|
|
802
|
-
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Handler for when the dev panel's "Show sort bar top right slot" checkbox is changed.
|
|
808
|
-
*/
|
|
809
|
-
private sortBarRightSlotCheckboxChanged(e: Event) {
|
|
810
|
-
const target = e.target as HTMLInputElement;
|
|
811
|
-
|
|
812
|
-
if (target.checked) {
|
|
813
|
-
const div = document.createElement('div');
|
|
814
|
-
div.style.setProperty('border', '1px solid #000');
|
|
815
|
-
div.textContent = 'Search bar';
|
|
816
|
-
div.style.setProperty('height', '3rem');
|
|
817
|
-
div.style.setProperty('width', '15rem');
|
|
818
|
-
div.setAttribute('slot', 'sort-options-right');
|
|
819
|
-
|
|
820
|
-
this.collectionBrowser.appendChild(div);
|
|
821
|
-
} else {
|
|
822
|
-
const slottedEl = this.collectionBrowser.querySelector(
|
|
823
|
-
'[slot="sort-options-right"]',
|
|
824
|
-
);
|
|
825
|
-
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
private rowGapChanged(e: Event) {
|
|
830
|
-
const input = e.target as HTMLInputElement;
|
|
831
|
-
this.rowGap = parseFloat(input.value);
|
|
832
|
-
this.collectionBrowser.style.setProperty(
|
|
833
|
-
'--collectionBrowserRowGap',
|
|
834
|
-
`${input.value}rem`,
|
|
835
|
-
);
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
private colGapChanged(e: Event) {
|
|
839
|
-
const input = e.target as HTMLInputElement;
|
|
840
|
-
this.colGap = parseFloat(input.value);
|
|
841
|
-
this.collectionBrowser.style.setProperty(
|
|
842
|
-
'--collectionBrowserColGap',
|
|
843
|
-
`${input.value}rem`,
|
|
844
|
-
);
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
private widthChanged(e: Event) {
|
|
848
|
-
const input = e.target as HTMLInputElement;
|
|
849
|
-
this.cellWidth = parseFloat(input.value);
|
|
850
|
-
this.collectionBrowser.style.setProperty(
|
|
851
|
-
'--collectionBrowserCellMinWidth',
|
|
852
|
-
`${input.value}rem`,
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
private heightChanged(e: Event) {
|
|
857
|
-
const input = e.target as HTMLInputElement;
|
|
858
|
-
this.cellHeight = parseFloat(input.value);
|
|
859
|
-
this.collectionBrowser.style.setProperty(
|
|
860
|
-
'--collectionBrowserCellMinHeight',
|
|
861
|
-
`${input.value}rem`,
|
|
862
|
-
);
|
|
863
|
-
this.collectionBrowser.style.setProperty(
|
|
864
|
-
'--collectionBrowserCellMaxHeight',
|
|
865
|
-
`${input.value}rem`,
|
|
866
|
-
);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
private visiblePageChanged(e: CustomEvent<{ pageNumber: number }>) {
|
|
870
|
-
const { pageNumber } = e.detail;
|
|
871
|
-
if (pageNumber === this.currentPage) return;
|
|
872
|
-
this.currentPage = pageNumber;
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
/**
|
|
876
|
-
* Handler for when the dev panel's "Replace sort options" checkbox is changed.
|
|
877
|
-
*/
|
|
878
|
-
private replaceSortOptionsChanged(e: Event) {
|
|
879
|
-
const target = e.target as HTMLInputElement;
|
|
880
|
-
|
|
881
|
-
if (target.checked) {
|
|
882
|
-
const p = document.createElement('p');
|
|
883
|
-
p.style.setProperty('border', '1px solid #000');
|
|
884
|
-
p.textContent = 'New stuff as a child.';
|
|
885
|
-
p.style.setProperty('height', '20px');
|
|
886
|
-
p.setAttribute('slot', 'sort-options');
|
|
887
|
-
|
|
888
|
-
this.collectionBrowser.appendChild(p);
|
|
889
|
-
this.collectionBrowser.enableSortOptionsSlot = true;
|
|
890
|
-
} else {
|
|
891
|
-
const slottedEl = this.collectionBrowser.querySelector(
|
|
892
|
-
'[slot="sort-options"]',
|
|
893
|
-
);
|
|
894
|
-
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
895
|
-
this.collectionBrowser.enableSortOptionsSlot = false;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
static styles = css`
|
|
900
|
-
:host {
|
|
901
|
-
display: block;
|
|
902
|
-
--primaryButtonBGColor: #194880;
|
|
903
|
-
--ia-theme-link-color: #4b64ff;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/* add the following styles to ensure proper modal visibility */
|
|
907
|
-
body.modal-manager-open {
|
|
908
|
-
overflow: hidden;
|
|
909
|
-
}
|
|
910
|
-
modal-manager {
|
|
911
|
-
display: none;
|
|
912
|
-
}
|
|
913
|
-
modal-manager[mode='open'] {
|
|
914
|
-
display: block;
|
|
915
|
-
}
|
|
916
|
-
modal-manager.remove-items {
|
|
917
|
-
--modalWidth: 58rem;
|
|
918
|
-
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
919
|
-
--modalTitleLineHeight: 4rem;
|
|
920
|
-
--modalTitleFontSize: 1.8rem;
|
|
921
|
-
}
|
|
922
|
-
modal-manager.more-search-facets {
|
|
923
|
-
--modalWidth: 85rem;
|
|
924
|
-
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
925
|
-
--modalTitleLineHeight: 4rem;
|
|
926
|
-
--modalTitleFontSize: 1.8rem;
|
|
927
|
-
--modalCornerRadius: 0;
|
|
928
|
-
--modalBottomPadding: 0;
|
|
929
|
-
--modalBottomMargin: 0;
|
|
930
|
-
--modalScrollOffset: 0;
|
|
931
|
-
--modalCornerRadius: 0.5rem;
|
|
932
|
-
}
|
|
933
|
-
modal-manager.expanded-date-picker {
|
|
934
|
-
--modalWidth: 58rem;
|
|
935
|
-
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
936
|
-
--modalTitleLineHeight: 4rem;
|
|
937
|
-
--modalTitleFontSize: 1.8rem;
|
|
938
|
-
--modalCornerRadius: 0;
|
|
939
|
-
--modalBottomPadding: 0;
|
|
940
|
-
--modalBottomMargin: 0;
|
|
941
|
-
--modalScrollOffset: 0;
|
|
942
|
-
--modalCornerRadius: 0.5rem;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
input,
|
|
946
|
-
button {
|
|
947
|
-
font-size: 1.6rem;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
modal-manager.showFacetGroupOutlines,
|
|
951
|
-
collection-browser.showFacetGroupOutlines {
|
|
952
|
-
--facet-row-border-top: 1px solid red;
|
|
953
|
-
--facet-row-border-bottom: 1px solid blue;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
collection-browser {
|
|
957
|
-
/* Same as production */
|
|
958
|
-
max-width: 135rem;
|
|
959
|
-
margin: auto;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
#collection-browser-container {
|
|
963
|
-
/* Same as production */
|
|
964
|
-
padding-left: 0.5rem;
|
|
965
|
-
margin-bottom: 2rem;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
#base-query-field {
|
|
969
|
-
width: 300px;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
.dev-tool-container {
|
|
973
|
-
position: relative;
|
|
974
|
-
}
|
|
975
|
-
#dev-tools {
|
|
976
|
-
position: relative;
|
|
977
|
-
top: 0;
|
|
978
|
-
left: 0;
|
|
979
|
-
z-index: 1;
|
|
980
|
-
-webkit-backdrop-filter: blur(10px);
|
|
981
|
-
backdrop-filter: blur(10px);
|
|
982
|
-
padding: 0.5rem 1rem;
|
|
983
|
-
border: 1px solid black;
|
|
984
|
-
font-size: 1.4rem;
|
|
985
|
-
background: #ffffffb3;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
#dev-tools > * {
|
|
989
|
-
display: flex;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
#toggle-dev-tools-btn {
|
|
993
|
-
position: fixed;
|
|
994
|
-
left: 77.4%;
|
|
995
|
-
top: 0;
|
|
996
|
-
background: red;
|
|
997
|
-
padding: 5px;
|
|
998
|
-
color: white;
|
|
999
|
-
font-size: 1.4rem;
|
|
1000
|
-
margin: 0;
|
|
1001
|
-
z-index: 1;
|
|
1002
|
-
cursor: pointer;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
#search-and-page-inputs {
|
|
1006
|
-
flex-wrap: wrap;
|
|
1007
|
-
row-gap: 2px;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
#search-and-page-inputs > form {
|
|
1011
|
-
margin-right: 1rem;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
#search-and-page-inputs label {
|
|
1015
|
-
display: inline-block;
|
|
1016
|
-
min-width: 50px;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
#page-number-input {
|
|
1020
|
-
width: 75px;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
.search-type {
|
|
1024
|
-
margin-right: 1rem;
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
.cell-controls {
|
|
1028
|
-
display: flex;
|
|
1029
|
-
flex-wrap: wrap;
|
|
1030
|
-
}
|
|
1031
|
-
.cell-controls div {
|
|
1032
|
-
display: flex;
|
|
1033
|
-
align-items: center;
|
|
1034
|
-
}
|
|
1035
|
-
.cell-controls input[type='range'] {
|
|
1036
|
-
width: 120px;
|
|
1037
|
-
}
|
|
1038
|
-
#cell-controls label {
|
|
1039
|
-
display: inline-block;
|
|
1040
|
-
width: 10rem;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
#cell-size-control,
|
|
1044
|
-
#cell-gap-control {
|
|
1045
|
-
flex-basis: calc(50% - 1rem);
|
|
1046
|
-
flex-grow: 1;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
#cell-gap-control {
|
|
1050
|
-
margin-left: 1rem;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
#checkbox-controls {
|
|
1054
|
-
padding-top: 0.5rem;
|
|
1055
|
-
flex-wrap: wrap;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
.checkbox-control {
|
|
1059
|
-
flex-basis: 50%;
|
|
1060
|
-
}
|
|
1061
|
-
.checkbox-control.indent {
|
|
1062
|
-
margin-left: 10px;
|
|
1063
|
-
}
|
|
1064
|
-
.checkbox-control label {
|
|
1065
|
-
user-select: none;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
#last-event {
|
|
1069
|
-
background-color: aliceblue;
|
|
1070
|
-
padding: 5px;
|
|
1071
|
-
margin: 5px auto;
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
.hidden {
|
|
1075
|
-
display: none;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
#toggle-controls {
|
|
1079
|
-
background-color: lightskyblue;
|
|
1080
|
-
padding: 5px;
|
|
1081
|
-
margin: 5px auto;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
#search-types {
|
|
1085
|
-
margin: 5px auto;
|
|
1086
|
-
background-color: aliceblue;
|
|
1087
|
-
font-size: 1.6rem;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
// slots
|
|
1091
|
-
div[slot='cb-top-slot'] {
|
|
1092
|
-
height: 50px;
|
|
1093
|
-
border: 1px solid red;
|
|
1094
|
-
background: bisque;
|
|
1095
|
-
}
|
|
1096
|
-
div[slot='facet-top-slot'] {
|
|
1097
|
-
border: 1px solid red;
|
|
1098
|
-
width: 100%;
|
|
1099
|
-
height: 150px;
|
|
1100
|
-
background-color: darkseagreen;
|
|
1101
|
-
}
|
|
1102
|
-
div[slot='sort-slot-left'] {
|
|
1103
|
-
height: 50px;
|
|
1104
|
-
border: 1px solid red;
|
|
1105
|
-
background: bisque;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
|
-
/* user profile controls */
|
|
1109
|
-
.user-profile-controls {
|
|
1110
|
-
width: fit-content;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
fieldset {
|
|
1114
|
-
display: inline-block !important;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
.result-last-tile {
|
|
1118
|
-
border-radius: 4px;
|
|
1119
|
-
background-color: white;
|
|
1120
|
-
border: 3px dashed #555;
|
|
1121
|
-
box-shadow: none;
|
|
1122
|
-
display: grid;
|
|
1123
|
-
align-content: center;
|
|
1124
|
-
}
|
|
1125
|
-
.result-last-tile:hover {
|
|
1126
|
-
box-shadow: rgba(8, 8, 32, 0.8) 0 0 6px 2px;
|
|
1127
|
-
transition: box-shadow 0.1s ease 0s;
|
|
1128
|
-
cursor: pointer;
|
|
1129
|
-
border: 3px dashed #4b64ff;
|
|
1130
|
-
}
|
|
1131
|
-
.result-last-tile h3 {
|
|
1132
|
-
margin-bottom: 4rem;
|
|
1133
|
-
margin: 0px auto;
|
|
1134
|
-
font-size: 2.8rem;
|
|
1135
|
-
color: rgb(44, 44, 44);
|
|
1136
|
-
font-weight: 200;
|
|
1137
|
-
text-align: center;
|
|
1138
|
-
}
|
|
1139
|
-
`;
|
|
1140
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
AnalyticsEvent,
|
|
3
|
+
AnalyticsManager,
|
|
4
|
+
} from '@internetarchive/analytics-manager';
|
|
5
|
+
import {
|
|
6
|
+
SearchService,
|
|
7
|
+
SearchServiceInterface,
|
|
8
|
+
SearchType,
|
|
9
|
+
} from '@internetarchive/search-service';
|
|
10
|
+
import { html, css, LitElement, PropertyValues, nothing } from 'lit';
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
12
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
13
|
+
|
|
14
|
+
import type { ModalManagerInterface } from '@internetarchive/modal-manager';
|
|
15
|
+
import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
|
|
16
|
+
import type { CollectionBrowser } from '../src/collection-browser';
|
|
17
|
+
|
|
18
|
+
import '../src/collection-browser';
|
|
19
|
+
|
|
20
|
+
@customElement('app-root')
|
|
21
|
+
export class AppRoot extends LitElement {
|
|
22
|
+
private searchService: SearchServiceInterface =
|
|
23
|
+
this.initSearchServiceFromUrlParams();
|
|
24
|
+
|
|
25
|
+
private resizeObserver = new SharedResizeObserver();
|
|
26
|
+
|
|
27
|
+
@state() private toggleSlots: boolean = false;
|
|
28
|
+
|
|
29
|
+
@state() private currentPage?: number;
|
|
30
|
+
|
|
31
|
+
@state() private searchQuery?: string;
|
|
32
|
+
|
|
33
|
+
@state() private withinCollection?: string;
|
|
34
|
+
|
|
35
|
+
@state() private cellWidth: number = 18;
|
|
36
|
+
|
|
37
|
+
@state() private cellHeight: number = 29;
|
|
38
|
+
|
|
39
|
+
@state() private rowGap: number = 1.7;
|
|
40
|
+
|
|
41
|
+
@state() private colGap: number = 1.7;
|
|
42
|
+
|
|
43
|
+
@state() private suppressFacets: boolean = false;
|
|
44
|
+
|
|
45
|
+
@state() private lazyLoadFacets: boolean = false;
|
|
46
|
+
|
|
47
|
+
@state() private loggedIn: boolean = false;
|
|
48
|
+
|
|
49
|
+
@state() private searchType: SearchType = SearchType.METADATA;
|
|
50
|
+
|
|
51
|
+
@property({ type: Object, reflect: false }) latestAction?: AnalyticsEvent;
|
|
52
|
+
|
|
53
|
+
@query('#base-query-field') private baseQueryField!: HTMLInputElement;
|
|
54
|
+
|
|
55
|
+
@query('#base-collection-field')
|
|
56
|
+
private baseCollectionField!: HTMLInputElement;
|
|
57
|
+
|
|
58
|
+
@query('#page-number-input') private pageNumberInput!: HTMLInputElement;
|
|
59
|
+
|
|
60
|
+
@query('collection-browser') private collectionBrowser!: CollectionBrowser;
|
|
61
|
+
|
|
62
|
+
@query('modal-manager') private modalManager!: ModalManagerInterface;
|
|
63
|
+
|
|
64
|
+
private analyticsManager = new AnalyticsManager();
|
|
65
|
+
|
|
66
|
+
private analyticsHandler: AnalyticsManagerInterface = {
|
|
67
|
+
sendPing: this.sendAnalytics.bind(this),
|
|
68
|
+
sendEvent: this.sendAnalytics.bind(this),
|
|
69
|
+
sendEventNoSampling: this.sendAnalytics.bind(this),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
private sendAnalytics(ae: AnalyticsEvent) {
|
|
73
|
+
console.log('Analytics Received ----', ae);
|
|
74
|
+
this.latestAction = ae;
|
|
75
|
+
this.analyticsManager?.sendEvent(ae);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private initSearchServiceFromUrlParams() {
|
|
79
|
+
const params = new URL(window.location.href).searchParams;
|
|
80
|
+
return new SearchService({
|
|
81
|
+
includeCredentials: false,
|
|
82
|
+
baseUrl: params.get('search_base_url') ?? undefined,
|
|
83
|
+
servicePath: params.get('search_service_path') ?? undefined,
|
|
84
|
+
debuggingEnabled: !!params.get('debugging'),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private searchPressed(e: Event) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
this.searchQuery = this.baseQueryField.value;
|
|
91
|
+
this.collectionBrowser.searchType = this.searchType;
|
|
92
|
+
|
|
93
|
+
this.goToCurrentPage();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private collectionChanged(e: Event) {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
this.withinCollection = this.baseCollectionField.value;
|
|
99
|
+
this.collectionBrowser.withinCollection = this.withinCollection;
|
|
100
|
+
|
|
101
|
+
this.goToCurrentPage();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private goToCurrentPage() {
|
|
105
|
+
const page = this.currentPage ?? 1;
|
|
106
|
+
if (page > 1) {
|
|
107
|
+
this.collectionBrowser.goToPage(page);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private changePagePressed(e: Event) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
this.currentPage = this.pageNumberInput.valueAsNumber;
|
|
114
|
+
this.collectionBrowser.goToPage(this.currentPage);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
protected override updated(changed: PropertyValues): void {
|
|
118
|
+
if (changed.has('currentPage') && this.currentPage) {
|
|
119
|
+
this.pageNumberInput.value = this.currentPage.toString();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (changed.has('searchQuery')) {
|
|
123
|
+
this.queryUpdated();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private queryUpdated() {
|
|
128
|
+
this.collectionBrowser.baseQuery = this.searchQuery;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private get getClass() {
|
|
132
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
133
|
+
|
|
134
|
+
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
render() {
|
|
138
|
+
return html`
|
|
139
|
+
<div class="dev-tool-container">
|
|
140
|
+
<div id="dev-tools" class=${this.getClass}>
|
|
141
|
+
<div id="search-and-page-inputs">
|
|
142
|
+
<form @submit=${this.searchPressed}>
|
|
143
|
+
<label for="base-query-field"> Query: </label>
|
|
144
|
+
<input
|
|
145
|
+
type="text"
|
|
146
|
+
id="base-query-field"
|
|
147
|
+
.value=${this.searchQuery ?? ''}
|
|
148
|
+
/>
|
|
149
|
+
<input type="submit" value="Search" />
|
|
150
|
+
</form>
|
|
151
|
+
<form @submit=${this.changePagePressed}>
|
|
152
|
+
<label for="page-number-input"> Page: </label>
|
|
153
|
+
<input type="number" value="1" id="page-number-input" />
|
|
154
|
+
<input type="submit" value="Go" />
|
|
155
|
+
</form>
|
|
156
|
+
</div>
|
|
157
|
+
<div>
|
|
158
|
+
<form @submit=${this.collectionChanged}>
|
|
159
|
+
<label for="base-collection-field"> Within collection: </label>
|
|
160
|
+
<input
|
|
161
|
+
type="text"
|
|
162
|
+
id="base-collection-field"
|
|
163
|
+
.value=${this.withinCollection ?? ''}
|
|
164
|
+
/>
|
|
165
|
+
<input type="submit" value="Search" />
|
|
166
|
+
</form>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<div id="search-types">
|
|
170
|
+
Search type:
|
|
171
|
+
<span class="search-type">
|
|
172
|
+
<input
|
|
173
|
+
type="radio"
|
|
174
|
+
id="default-search"
|
|
175
|
+
name="search-type"
|
|
176
|
+
value="default"
|
|
177
|
+
.checked=${this.searchType === SearchType.DEFAULT}
|
|
178
|
+
@click=${this.searchTypeSelected}
|
|
179
|
+
/>
|
|
180
|
+
<label for="default-search">Default</label>
|
|
181
|
+
</span>
|
|
182
|
+
<span class="search-type">
|
|
183
|
+
<input
|
|
184
|
+
type="radio"
|
|
185
|
+
id="metadata-search"
|
|
186
|
+
name="search-type"
|
|
187
|
+
value="metadata"
|
|
188
|
+
.checked=${this.searchType === SearchType.METADATA}
|
|
189
|
+
@click=${this.searchTypeSelected}
|
|
190
|
+
/>
|
|
191
|
+
<label for="metadata-search">Metadata</label>
|
|
192
|
+
</span>
|
|
193
|
+
<span class="search-type">
|
|
194
|
+
<input
|
|
195
|
+
type="radio"
|
|
196
|
+
id="fulltext-search"
|
|
197
|
+
name="search-type"
|
|
198
|
+
value="fulltext"
|
|
199
|
+
.checked=${this.searchType === SearchType.FULLTEXT}
|
|
200
|
+
@click=${this.searchTypeSelected}
|
|
201
|
+
/>
|
|
202
|
+
<label for="fulltext-search">Full text</label>
|
|
203
|
+
</span>
|
|
204
|
+
<span class="search-type">
|
|
205
|
+
<input
|
|
206
|
+
type="radio"
|
|
207
|
+
id="tv-search"
|
|
208
|
+
name="search-type"
|
|
209
|
+
value="tv"
|
|
210
|
+
.checked=${this.searchType === SearchType.TV}
|
|
211
|
+
@click=${this.searchTypeSelected}
|
|
212
|
+
/>
|
|
213
|
+
<label for="tv-search">TV</label>
|
|
214
|
+
</span>
|
|
215
|
+
<span class="search-type">
|
|
216
|
+
<input
|
|
217
|
+
type="radio"
|
|
218
|
+
id="radio-search"
|
|
219
|
+
name="search-type"
|
|
220
|
+
value="radio"
|
|
221
|
+
.checked=${this.searchType === SearchType.RADIO}
|
|
222
|
+
@click=${this.searchTypeSelected}
|
|
223
|
+
/>
|
|
224
|
+
<label for="radio-search">Radio</label>
|
|
225
|
+
</span>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<div id="toggle-controls">
|
|
229
|
+
<button
|
|
230
|
+
@click=${() => {
|
|
231
|
+
const details =
|
|
232
|
+
this.shadowRoot?.getElementById('cell-size-control');
|
|
233
|
+
details?.classList.toggle('hidden');
|
|
234
|
+
const rowGapControls =
|
|
235
|
+
this.shadowRoot?.getElementById('cell-gap-control');
|
|
236
|
+
rowGapControls?.classList.toggle('hidden');
|
|
237
|
+
}}
|
|
238
|
+
>
|
|
239
|
+
Toggle Cell Controls
|
|
240
|
+
</button>
|
|
241
|
+
<button
|
|
242
|
+
@click=${() => {
|
|
243
|
+
const details = this.shadowRoot?.getElementById(
|
|
244
|
+
'latest-event-details',
|
|
245
|
+
);
|
|
246
|
+
details?.classList.toggle('hidden');
|
|
247
|
+
}}
|
|
248
|
+
>
|
|
249
|
+
Last Event Captured
|
|
250
|
+
</button>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<div id="last-event">
|
|
254
|
+
<pre id="latest-event-details" class="hidden">
|
|
255
|
+
${JSON.stringify(this.latestAction, null, 2)}
|
|
256
|
+
</pre
|
|
257
|
+
>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<fieldset class="cell-controls">
|
|
261
|
+
<legend>Cell Controls</legend>
|
|
262
|
+
<div>
|
|
263
|
+
<label for="cell-width-slider">Cell width:</label>
|
|
264
|
+
<input
|
|
265
|
+
type="range"
|
|
266
|
+
min="10"
|
|
267
|
+
max="100"
|
|
268
|
+
value="18"
|
|
269
|
+
step="0.1"
|
|
270
|
+
id="cell-width-slider"
|
|
271
|
+
@input=${this.widthChanged}
|
|
272
|
+
/>
|
|
273
|
+
<span>${this.cellWidth}rem</span>
|
|
274
|
+
</div>
|
|
275
|
+
<div>
|
|
276
|
+
<label for="cell-height-slider">Cell height:</label>
|
|
277
|
+
<input
|
|
278
|
+
type="range"
|
|
279
|
+
min="10"
|
|
280
|
+
max="100"
|
|
281
|
+
value="29"
|
|
282
|
+
step="0.1"
|
|
283
|
+
id="cell-height-slider"
|
|
284
|
+
@input=${this.heightChanged}
|
|
285
|
+
/>
|
|
286
|
+
<span>${this.cellHeight}rem</span>
|
|
287
|
+
</div>
|
|
288
|
+
<div>
|
|
289
|
+
<label for="cell-row-gap-slider">Row gap:</label>
|
|
290
|
+
<input
|
|
291
|
+
type="range"
|
|
292
|
+
min="0"
|
|
293
|
+
max="5"
|
|
294
|
+
value="1.7"
|
|
295
|
+
step="0.1"
|
|
296
|
+
id="cell-row-gap-slider"
|
|
297
|
+
@input=${this.rowGapChanged}
|
|
298
|
+
/>
|
|
299
|
+
<span>${this.rowGap}rem</span>
|
|
300
|
+
</div>
|
|
301
|
+
<div>
|
|
302
|
+
<label for="cell-col-gap-slider">Col gap:</label>
|
|
303
|
+
<input
|
|
304
|
+
type="range"
|
|
305
|
+
min="0"
|
|
306
|
+
max="5"
|
|
307
|
+
value="1.7"
|
|
308
|
+
step="0.1"
|
|
309
|
+
id="cell-col-gap-slider"
|
|
310
|
+
@input=${this.colGapChanged}
|
|
311
|
+
/>
|
|
312
|
+
<span>${this.colGap}rem</span>
|
|
313
|
+
</div>
|
|
314
|
+
</fieldset>
|
|
315
|
+
|
|
316
|
+
<fieldset class="other-controls">
|
|
317
|
+
<legend>Other Controls</legend>
|
|
318
|
+
<div class="checkbox-control">
|
|
319
|
+
<input
|
|
320
|
+
type="checkbox"
|
|
321
|
+
id="simulate-login"
|
|
322
|
+
@click=${this.loginChanged}
|
|
323
|
+
/>
|
|
324
|
+
<label for="simulate-login">Simulate login</label>
|
|
325
|
+
</div>
|
|
326
|
+
<div class="checkbox-control">
|
|
327
|
+
<input
|
|
328
|
+
type="checkbox"
|
|
329
|
+
id="enable-date-picker"
|
|
330
|
+
checked
|
|
331
|
+
@click=${this.datePickerChanged}
|
|
332
|
+
/>
|
|
333
|
+
<label for="enable-date-picker">Enable date picker</label>
|
|
334
|
+
</div>
|
|
335
|
+
<div class="checkbox-control">
|
|
336
|
+
<input
|
|
337
|
+
type="checkbox"
|
|
338
|
+
id="enable-facets"
|
|
339
|
+
checked
|
|
340
|
+
@click=${this.facetsChanged}
|
|
341
|
+
/>
|
|
342
|
+
<label for="enable-facets">Enable facets</label>
|
|
343
|
+
</div>
|
|
344
|
+
<div class="checkbox-control indent">
|
|
345
|
+
<input
|
|
346
|
+
type="checkbox"
|
|
347
|
+
id="lazy-load-facets"
|
|
348
|
+
?disabled=${this.suppressFacets}
|
|
349
|
+
@click=${this.lazyLoadFacetsChanged}
|
|
350
|
+
/>
|
|
351
|
+
<label for="lazy-load-facets">Lazy load facets</label>
|
|
352
|
+
</div>
|
|
353
|
+
<div class="checkbox-control">
|
|
354
|
+
<input
|
|
355
|
+
type="checkbox"
|
|
356
|
+
id="enable-management"
|
|
357
|
+
@click=${this.manageModeCheckboxChanged}
|
|
358
|
+
/>
|
|
359
|
+
<label for="enable-management">Enable manage mode</label>
|
|
360
|
+
</div>
|
|
361
|
+
<div class="checkbox-control indent">
|
|
362
|
+
<input
|
|
363
|
+
type="checkbox"
|
|
364
|
+
id="enable-search-management"
|
|
365
|
+
@click=${this.SearchManageModeCheckboxChanged}
|
|
366
|
+
/>
|
|
367
|
+
<label for="enable-search-management">Search</label>
|
|
368
|
+
</div>
|
|
369
|
+
<div class="checkbox-control">
|
|
370
|
+
<input
|
|
371
|
+
type="checkbox"
|
|
372
|
+
id="enable-smart-facet-bar"
|
|
373
|
+
@click=${this.smartFacetBarCheckboxChanged}
|
|
374
|
+
/>
|
|
375
|
+
<label for="enable-smart-facet-bar">Enable smart facet bar</label>
|
|
376
|
+
</div>
|
|
377
|
+
</fieldset>
|
|
378
|
+
|
|
379
|
+
<fieldset class="cb-visual-appearance">
|
|
380
|
+
<legend>CB Visual Appearance</legend>
|
|
381
|
+
<div class="checkbox-control">
|
|
382
|
+
<input
|
|
383
|
+
type="checkbox"
|
|
384
|
+
id="show-facet-group-outline-check"
|
|
385
|
+
@click=${this.toggleFacetGroupOutline}
|
|
386
|
+
/>
|
|
387
|
+
<label for="show-facet-group-outline-check">
|
|
388
|
+
Show facet group outlines
|
|
389
|
+
</label>
|
|
390
|
+
</div>
|
|
391
|
+
<div class="checkbox-control">
|
|
392
|
+
<input
|
|
393
|
+
type="checkbox"
|
|
394
|
+
id="show-outline-check"
|
|
395
|
+
@click=${this.outlineChanged}
|
|
396
|
+
/>
|
|
397
|
+
<label for="show-outline-check">Show cell outlines</label>
|
|
398
|
+
</div>
|
|
399
|
+
</fieldset>
|
|
400
|
+
|
|
401
|
+
<fieldset class="user-profile-controls">
|
|
402
|
+
<legend>User Profile Controls</legend>
|
|
403
|
+
<div class="checkbox-control">
|
|
404
|
+
<input
|
|
405
|
+
type="checkbox"
|
|
406
|
+
id="enable-facet-top-slot"
|
|
407
|
+
@click=${this.facetTopSlotCheckboxChanged}
|
|
408
|
+
/>
|
|
409
|
+
<label for="enable-facet-top-slot">Show facet top slot</label>
|
|
410
|
+
</div>
|
|
411
|
+
<div class="checkbox-control">
|
|
412
|
+
<input
|
|
413
|
+
type="checkbox"
|
|
414
|
+
id="enable-cb-top-slot"
|
|
415
|
+
@click=${this.cbTopSlotCheckboxChanged}
|
|
416
|
+
/>
|
|
417
|
+
<label for="enable-cb-top-slot">Show CB top slot</label>
|
|
418
|
+
</div>
|
|
419
|
+
<div class="checkbox-control">
|
|
420
|
+
<input
|
|
421
|
+
type="checkbox"
|
|
422
|
+
id="enable-sortbar-left-slot"
|
|
423
|
+
@click=${this.sortBarLeftSlotCheckboxChanged}
|
|
424
|
+
/>
|
|
425
|
+
<label for="enable-sortbar-left-slot"
|
|
426
|
+
>Show sortbar left slot</label
|
|
427
|
+
>
|
|
428
|
+
</div>
|
|
429
|
+
<div class="checkbox-control">
|
|
430
|
+
<input
|
|
431
|
+
type="checkbox"
|
|
432
|
+
id="enable-sortbar-right-slot"
|
|
433
|
+
@click=${this.sortBarRightSlotCheckboxChanged}
|
|
434
|
+
/>
|
|
435
|
+
<label for="enable-sortbar-right-slot"
|
|
436
|
+
>Show sortbar right slot</label
|
|
437
|
+
>
|
|
438
|
+
</div>
|
|
439
|
+
<div class="checkbox-control">
|
|
440
|
+
<input
|
|
441
|
+
type="checkbox"
|
|
442
|
+
id="enable-result-last-tile-slot"
|
|
443
|
+
@click=${this.resultLastTileSlotCheckboxChanged}
|
|
444
|
+
/>
|
|
445
|
+
<label for="enable-result-last-tile-slot">
|
|
446
|
+
Show result last tile slot
|
|
447
|
+
</label>
|
|
448
|
+
</div>
|
|
449
|
+
<div class="checkbox-control">
|
|
450
|
+
<input
|
|
451
|
+
type="checkbox"
|
|
452
|
+
id="enable-replaced-sort-options"
|
|
453
|
+
@click=${this.replaceSortOptionsChanged}
|
|
454
|
+
/>
|
|
455
|
+
<label for="enable-replaced-sort-options">
|
|
456
|
+
Show replaced sort options
|
|
457
|
+
</label>
|
|
458
|
+
</div>
|
|
459
|
+
</fieldset>
|
|
460
|
+
|
|
461
|
+
<fieldset class="user-profile-controls">
|
|
462
|
+
<legend>Set Placeholder Types</legend>
|
|
463
|
+
<div class="checkbox-control">
|
|
464
|
+
<input
|
|
465
|
+
id="enable-loading-placeholder"
|
|
466
|
+
type="radio"
|
|
467
|
+
@click=${() => this.setPlaceholderType('loading-placeholder')}
|
|
468
|
+
name="placeholder-radio"
|
|
469
|
+
/>
|
|
470
|
+
<label for="enable-loading-placeholder"
|
|
471
|
+
>Loading Placeholder</label
|
|
472
|
+
>
|
|
473
|
+
</div>
|
|
474
|
+
<div class="checkbox-control">
|
|
475
|
+
<input
|
|
476
|
+
id="enable-empty-placeholder"
|
|
477
|
+
type="radio"
|
|
478
|
+
@click=${() => this.setPlaceholderType('error-placeholder')}
|
|
479
|
+
value="empty-placeholder"
|
|
480
|
+
name="placeholder-radio"
|
|
481
|
+
/>
|
|
482
|
+
<label for="enable-empty-placeholder">Empty Placeholder</label>
|
|
483
|
+
</div>
|
|
484
|
+
</fieldset>
|
|
485
|
+
</div>
|
|
486
|
+
<button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}>
|
|
487
|
+
Toggle Search Controls
|
|
488
|
+
</button>
|
|
489
|
+
</div>
|
|
490
|
+
<div id="collection-browser-container">
|
|
491
|
+
<collection-browser
|
|
492
|
+
facetPaneVisible
|
|
493
|
+
.baseNavigationUrl=${'https://archive.org'}
|
|
494
|
+
.baseImageUrl=${'https://archive.org'}
|
|
495
|
+
.searchService=${this.searchService}
|
|
496
|
+
.resizeObserver=${this.resizeObserver}
|
|
497
|
+
.showHistogramDatePicker=${true}
|
|
498
|
+
.suppressFacets=${this.suppressFacets}
|
|
499
|
+
.lazyLoadFacets=${this.lazyLoadFacets}
|
|
500
|
+
.loggedIn=${this.loggedIn}
|
|
501
|
+
.modalManager=${this.modalManager}
|
|
502
|
+
.analyticsHandler=${this.analyticsHandler}
|
|
503
|
+
.pageContext=${'search'}
|
|
504
|
+
@visiblePageChanged=${this.visiblePageChanged}
|
|
505
|
+
@baseQueryChanged=${this.baseQueryChanged}
|
|
506
|
+
@searchTypeChanged=${this.searchTypeChanged}
|
|
507
|
+
@manageModeChanged=${this.manageModeChanged}
|
|
508
|
+
@itemRemovalRequested=${this.handleItemRemovalRequest}
|
|
509
|
+
@itemManagerRequested=${this.handleItemManagerRequest}
|
|
510
|
+
>
|
|
511
|
+
${this.toggleSlots
|
|
512
|
+
? html`<div slot="sortbar-left-slot">Sort Slot</div>`
|
|
513
|
+
: nothing}
|
|
514
|
+
${this.toggleSlots
|
|
515
|
+
? html`<div slot="facet-top-slot">Facet Slot</div>`
|
|
516
|
+
: nothing}
|
|
517
|
+
</collection-browser>
|
|
518
|
+
</div>
|
|
519
|
+
<modal-manager></modal-manager>
|
|
520
|
+
`;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
private async setPlaceholderType(type: string) {
|
|
524
|
+
switch (type) {
|
|
525
|
+
case 'loading-placeholder':
|
|
526
|
+
this.collectionBrowser.baseQuery = '';
|
|
527
|
+
this.collectionBrowser.suppressPlaceholders = true;
|
|
528
|
+
this.collectionBrowser.clearResultsOnEmptyQuery = true;
|
|
529
|
+
this.requestUpdate();
|
|
530
|
+
await this.collectionBrowser.updateComplete;
|
|
531
|
+
break;
|
|
532
|
+
default:
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
private baseQueryChanged(e: CustomEvent<{ baseQuery?: string }>): void {
|
|
538
|
+
this.searchQuery = e.detail.baseQuery;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/** Handler for search type changes coming from collection browser */
|
|
542
|
+
private searchTypeChanged(e: CustomEvent<SearchType>): void {
|
|
543
|
+
this.searchType = e.detail;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/** Handler for user input selecting a search type */
|
|
547
|
+
private searchTypeSelected(e: Event) {
|
|
548
|
+
const target = e.target as HTMLInputElement;
|
|
549
|
+
this.searchType = this.searchTypeFromSelectedOption(target.value);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
private searchTypeFromSelectedOption(option: string): SearchType {
|
|
553
|
+
switch (option) {
|
|
554
|
+
case 'metadata':
|
|
555
|
+
return SearchType.METADATA;
|
|
556
|
+
case 'fulltext':
|
|
557
|
+
return SearchType.FULLTEXT;
|
|
558
|
+
case 'tv':
|
|
559
|
+
return SearchType.TV;
|
|
560
|
+
case 'radio':
|
|
561
|
+
return SearchType.RADIO;
|
|
562
|
+
default:
|
|
563
|
+
return SearchType.DEFAULT;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
private loginChanged(e: Event) {
|
|
568
|
+
const target = e.target as HTMLInputElement;
|
|
569
|
+
if (target.checked) {
|
|
570
|
+
this.loggedIn = true;
|
|
571
|
+
} else {
|
|
572
|
+
this.loggedIn = false;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
private outlineChanged(e: Event) {
|
|
577
|
+
const target = e.target as HTMLInputElement;
|
|
578
|
+
if (target.checked) {
|
|
579
|
+
this.collectionBrowser.style.setProperty(
|
|
580
|
+
'--infiniteScrollerCellOutline',
|
|
581
|
+
'1px solid #33D1FF',
|
|
582
|
+
);
|
|
583
|
+
} else {
|
|
584
|
+
this.collectionBrowser.style.removeProperty(
|
|
585
|
+
'--infiniteScrollerCellOutline',
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
private toggleDevTools() {
|
|
591
|
+
const pageUrl = new URL(window.location.href);
|
|
592
|
+
const { searchParams } = pageUrl;
|
|
593
|
+
|
|
594
|
+
if (searchParams.get('hide-dev-tools')) {
|
|
595
|
+
searchParams.delete('hide-dev-tools');
|
|
596
|
+
} else {
|
|
597
|
+
searchParams.set('hide-dev-tools', 'true');
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
this.shadowRoot?.getElementById('dev-tools')?.classList.toggle('hidden');
|
|
601
|
+
|
|
602
|
+
if (window.history.replaceState) {
|
|
603
|
+
window.history.replaceState(
|
|
604
|
+
{
|
|
605
|
+
path: pageUrl.toString(),
|
|
606
|
+
},
|
|
607
|
+
'',
|
|
608
|
+
pageUrl.toString(),
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
private toggleFacetGroupOutline(e: Event) {
|
|
614
|
+
const target = e.target as HTMLInputElement;
|
|
615
|
+
if (target.checked) {
|
|
616
|
+
this.collectionBrowser.classList.add('showFacetGroupOutlines');
|
|
617
|
+
this.modalManager.classList.add('showFacetGroupOutlines');
|
|
618
|
+
} else {
|
|
619
|
+
this.collectionBrowser.classList.remove('showFacetGroupOutlines');
|
|
620
|
+
this.modalManager.classList.remove('showFacetGroupOutlines');
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
private datePickerChanged(e: Event) {
|
|
625
|
+
const target = e.target as HTMLInputElement;
|
|
626
|
+
this.collectionBrowser.showHistogramDatePicker = target.checked;
|
|
627
|
+
|
|
628
|
+
// When disabling the date picker from the demo app, also clear any existing date range params
|
|
629
|
+
if (!this.collectionBrowser.showHistogramDatePicker) {
|
|
630
|
+
this.collectionBrowser.minSelectedDate = undefined;
|
|
631
|
+
this.collectionBrowser.maxSelectedDate = undefined;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
private facetsChanged(e: Event) {
|
|
636
|
+
const target = e.target as HTMLInputElement;
|
|
637
|
+
this.suppressFacets = !target.checked;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
private lazyLoadFacetsChanged(e: Event) {
|
|
641
|
+
const target = e.target as HTMLInputElement;
|
|
642
|
+
this.lazyLoadFacets = target.checked;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Handler for when collection browser's manage mode changes.
|
|
647
|
+
* This lets us disable the checkbox in the dev panel when the user cancels out
|
|
648
|
+
* of manage mode from within collection browser.
|
|
649
|
+
*/
|
|
650
|
+
private manageModeChanged(e: CustomEvent<boolean>): void {
|
|
651
|
+
const manageCheckbox = this.shadowRoot?.querySelector(
|
|
652
|
+
'#enable-management',
|
|
653
|
+
) as HTMLInputElement;
|
|
654
|
+
if (manageCheckbox) manageCheckbox.checked = e.detail;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Handler for item removal
|
|
659
|
+
*/
|
|
660
|
+
private handleItemRemovalRequest(e: CustomEvent) {
|
|
661
|
+
this.collectionBrowser.showRemoveItemsProcessingModal();
|
|
662
|
+
console.log('itemRemovalRequested: ', e.detail.items);
|
|
663
|
+
|
|
664
|
+
setTimeout(() => {
|
|
665
|
+
// execute item-removal-service, and response is successfully deleted
|
|
666
|
+
const status = false;
|
|
667
|
+
|
|
668
|
+
if (status) {
|
|
669
|
+
// looking for success?
|
|
670
|
+
this.collectionBrowser.isManageView = false;
|
|
671
|
+
this.modalManager?.closeModal();
|
|
672
|
+
this.modalManager?.classList.remove('remove-items');
|
|
673
|
+
} else {
|
|
674
|
+
// looking for failure?
|
|
675
|
+
this.collectionBrowser.showRemoveItemsErrorModal();
|
|
676
|
+
}
|
|
677
|
+
}, 2000); // let's wait to see processing modal
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Handler when item manage requested
|
|
682
|
+
*/
|
|
683
|
+
private handleItemManagerRequest(e: CustomEvent) {
|
|
684
|
+
console.log('itemManagerRequested: ', e.detail.items);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Handler for when the dev panel's "Enable manage mode" checkbox is changed.
|
|
689
|
+
*/
|
|
690
|
+
private manageModeCheckboxChanged(e: Event) {
|
|
691
|
+
const target = e.target as HTMLInputElement;
|
|
692
|
+
this.collectionBrowser.isManageView = target.checked;
|
|
693
|
+
this.collectionBrowser.manageViewLabel =
|
|
694
|
+
'Select items to remove (customizable texts)';
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Handler when the dev panel's "Enable manage mode -> Search" checkbox is changed.
|
|
699
|
+
*/
|
|
700
|
+
private SearchManageModeCheckboxChanged(e: Event) {
|
|
701
|
+
const target = e.target as HTMLInputElement;
|
|
702
|
+
this.collectionBrowser.pageContext = target.checked
|
|
703
|
+
? 'search'
|
|
704
|
+
: 'collection';
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Handler for when the dev panel's "Enable smart facet bar" checkbox is changed.
|
|
709
|
+
*/
|
|
710
|
+
private smartFacetBarCheckboxChanged(e: Event) {
|
|
711
|
+
const target = e.target as HTMLInputElement;
|
|
712
|
+
this.collectionBrowser.showSmartFacetBar = target.checked;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Handler for when the dev panel's "Show facet top slot" checkbox is changed.
|
|
717
|
+
*/
|
|
718
|
+
private facetTopSlotCheckboxChanged(e: Event) {
|
|
719
|
+
const target = e.target as HTMLInputElement;
|
|
720
|
+
|
|
721
|
+
const p = document.createElement('p');
|
|
722
|
+
p.style.setProperty('border', '1px solid #000');
|
|
723
|
+
p.textContent = 'New stuff as a child.';
|
|
724
|
+
p.style.setProperty('height', '20rem');
|
|
725
|
+
p.style.backgroundColor = '#00000';
|
|
726
|
+
p.setAttribute('slot', 'facet-top-slot');
|
|
727
|
+
|
|
728
|
+
if (target.checked) {
|
|
729
|
+
this.collectionBrowser.appendChild(p);
|
|
730
|
+
} else {
|
|
731
|
+
this.collectionBrowser.removeChild(
|
|
732
|
+
this.collectionBrowser.lastElementChild as Element,
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
private toggleSlotOptions() {
|
|
738
|
+
this.toggleSlots = !this.toggleSlots;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
private resultLastTileSlotCheckboxChanged(e: Event) {
|
|
742
|
+
const target = e.target as HTMLInputElement;
|
|
743
|
+
|
|
744
|
+
const div = document.createElement('div');
|
|
745
|
+
const title = document.createElement('h3');
|
|
746
|
+
title.textContent = 'Upload';
|
|
747
|
+
|
|
748
|
+
div.setAttribute('slot', 'result-last-tile');
|
|
749
|
+
div.setAttribute('class', 'result-last-tile');
|
|
750
|
+
div.appendChild(title);
|
|
751
|
+
|
|
752
|
+
if (target.checked) {
|
|
753
|
+
this.collectionBrowser.appendChild(div);
|
|
754
|
+
} else {
|
|
755
|
+
this.collectionBrowser.removeChild(
|
|
756
|
+
this.collectionBrowser.lastElementChild as Element,
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Handler for when the dev panel's "Show cb top slot" checkbox is changed.
|
|
763
|
+
*/
|
|
764
|
+
private cbTopSlotCheckboxChanged(e: Event) {
|
|
765
|
+
const target = e.target as HTMLInputElement;
|
|
766
|
+
|
|
767
|
+
const p = document.createElement('p');
|
|
768
|
+
p.style.setProperty('border', '1px solid #000');
|
|
769
|
+
p.textContent = 'My Favorite list header.';
|
|
770
|
+
p.style.setProperty('height', '10rem');
|
|
771
|
+
p.style.backgroundColor = '#00000';
|
|
772
|
+
p.setAttribute('slot', 'cb-top-slot');
|
|
773
|
+
|
|
774
|
+
if (target.checked) {
|
|
775
|
+
this.collectionBrowser.appendChild(p);
|
|
776
|
+
} else {
|
|
777
|
+
this.collectionBrowser.removeChild(
|
|
778
|
+
this.collectionBrowser.lastElementChild as Element,
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Handler for when the dev panel's "Show sort bar top left slot" checkbox is changed.
|
|
785
|
+
*/
|
|
786
|
+
private sortBarLeftSlotCheckboxChanged(e: Event) {
|
|
787
|
+
const target = e.target as HTMLInputElement;
|
|
788
|
+
|
|
789
|
+
if (target.checked) {
|
|
790
|
+
const div = document.createElement('div');
|
|
791
|
+
div.style.setProperty('border', '1px solid #000');
|
|
792
|
+
div.textContent = 'Btn';
|
|
793
|
+
div.style.setProperty('height', '3rem');
|
|
794
|
+
div.style.setProperty('width', '3rem');
|
|
795
|
+
div.setAttribute('slot', 'sort-options-left');
|
|
796
|
+
|
|
797
|
+
this.collectionBrowser.appendChild(div);
|
|
798
|
+
} else {
|
|
799
|
+
const slottedEl = this.collectionBrowser.querySelector(
|
|
800
|
+
'[slot="sort-options-left"]',
|
|
801
|
+
);
|
|
802
|
+
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Handler for when the dev panel's "Show sort bar top right slot" checkbox is changed.
|
|
808
|
+
*/
|
|
809
|
+
private sortBarRightSlotCheckboxChanged(e: Event) {
|
|
810
|
+
const target = e.target as HTMLInputElement;
|
|
811
|
+
|
|
812
|
+
if (target.checked) {
|
|
813
|
+
const div = document.createElement('div');
|
|
814
|
+
div.style.setProperty('border', '1px solid #000');
|
|
815
|
+
div.textContent = 'Search bar';
|
|
816
|
+
div.style.setProperty('height', '3rem');
|
|
817
|
+
div.style.setProperty('width', '15rem');
|
|
818
|
+
div.setAttribute('slot', 'sort-options-right');
|
|
819
|
+
|
|
820
|
+
this.collectionBrowser.appendChild(div);
|
|
821
|
+
} else {
|
|
822
|
+
const slottedEl = this.collectionBrowser.querySelector(
|
|
823
|
+
'[slot="sort-options-right"]',
|
|
824
|
+
);
|
|
825
|
+
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
private rowGapChanged(e: Event) {
|
|
830
|
+
const input = e.target as HTMLInputElement;
|
|
831
|
+
this.rowGap = parseFloat(input.value);
|
|
832
|
+
this.collectionBrowser.style.setProperty(
|
|
833
|
+
'--collectionBrowserRowGap',
|
|
834
|
+
`${input.value}rem`,
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
private colGapChanged(e: Event) {
|
|
839
|
+
const input = e.target as HTMLInputElement;
|
|
840
|
+
this.colGap = parseFloat(input.value);
|
|
841
|
+
this.collectionBrowser.style.setProperty(
|
|
842
|
+
'--collectionBrowserColGap',
|
|
843
|
+
`${input.value}rem`,
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
private widthChanged(e: Event) {
|
|
848
|
+
const input = e.target as HTMLInputElement;
|
|
849
|
+
this.cellWidth = parseFloat(input.value);
|
|
850
|
+
this.collectionBrowser.style.setProperty(
|
|
851
|
+
'--collectionBrowserCellMinWidth',
|
|
852
|
+
`${input.value}rem`,
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
private heightChanged(e: Event) {
|
|
857
|
+
const input = e.target as HTMLInputElement;
|
|
858
|
+
this.cellHeight = parseFloat(input.value);
|
|
859
|
+
this.collectionBrowser.style.setProperty(
|
|
860
|
+
'--collectionBrowserCellMinHeight',
|
|
861
|
+
`${input.value}rem`,
|
|
862
|
+
);
|
|
863
|
+
this.collectionBrowser.style.setProperty(
|
|
864
|
+
'--collectionBrowserCellMaxHeight',
|
|
865
|
+
`${input.value}rem`,
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
private visiblePageChanged(e: CustomEvent<{ pageNumber: number }>) {
|
|
870
|
+
const { pageNumber } = e.detail;
|
|
871
|
+
if (pageNumber === this.currentPage) return;
|
|
872
|
+
this.currentPage = pageNumber;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Handler for when the dev panel's "Replace sort options" checkbox is changed.
|
|
877
|
+
*/
|
|
878
|
+
private replaceSortOptionsChanged(e: Event) {
|
|
879
|
+
const target = e.target as HTMLInputElement;
|
|
880
|
+
|
|
881
|
+
if (target.checked) {
|
|
882
|
+
const p = document.createElement('p');
|
|
883
|
+
p.style.setProperty('border', '1px solid #000');
|
|
884
|
+
p.textContent = 'New stuff as a child.';
|
|
885
|
+
p.style.setProperty('height', '20px');
|
|
886
|
+
p.setAttribute('slot', 'sort-options');
|
|
887
|
+
|
|
888
|
+
this.collectionBrowser.appendChild(p);
|
|
889
|
+
this.collectionBrowser.enableSortOptionsSlot = true;
|
|
890
|
+
} else {
|
|
891
|
+
const slottedEl = this.collectionBrowser.querySelector(
|
|
892
|
+
'[slot="sort-options"]',
|
|
893
|
+
);
|
|
894
|
+
if (slottedEl) this.collectionBrowser.removeChild(slottedEl);
|
|
895
|
+
this.collectionBrowser.enableSortOptionsSlot = false;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
static styles = css`
|
|
900
|
+
:host {
|
|
901
|
+
display: block;
|
|
902
|
+
--primaryButtonBGColor: #194880;
|
|
903
|
+
--ia-theme-link-color: #4b64ff;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/* add the following styles to ensure proper modal visibility */
|
|
907
|
+
body.modal-manager-open {
|
|
908
|
+
overflow: hidden;
|
|
909
|
+
}
|
|
910
|
+
modal-manager {
|
|
911
|
+
display: none;
|
|
912
|
+
}
|
|
913
|
+
modal-manager[mode='open'] {
|
|
914
|
+
display: block;
|
|
915
|
+
}
|
|
916
|
+
modal-manager.remove-items {
|
|
917
|
+
--modalWidth: 58rem;
|
|
918
|
+
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
919
|
+
--modalTitleLineHeight: 4rem;
|
|
920
|
+
--modalTitleFontSize: 1.8rem;
|
|
921
|
+
}
|
|
922
|
+
modal-manager.more-search-facets {
|
|
923
|
+
--modalWidth: 85rem;
|
|
924
|
+
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
925
|
+
--modalTitleLineHeight: 4rem;
|
|
926
|
+
--modalTitleFontSize: 1.8rem;
|
|
927
|
+
--modalCornerRadius: 0;
|
|
928
|
+
--modalBottomPadding: 0;
|
|
929
|
+
--modalBottomMargin: 0;
|
|
930
|
+
--modalScrollOffset: 0;
|
|
931
|
+
--modalCornerRadius: 0.5rem;
|
|
932
|
+
}
|
|
933
|
+
modal-manager.expanded-date-picker {
|
|
934
|
+
--modalWidth: 58rem;
|
|
935
|
+
--modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
|
|
936
|
+
--modalTitleLineHeight: 4rem;
|
|
937
|
+
--modalTitleFontSize: 1.8rem;
|
|
938
|
+
--modalCornerRadius: 0;
|
|
939
|
+
--modalBottomPadding: 0;
|
|
940
|
+
--modalBottomMargin: 0;
|
|
941
|
+
--modalScrollOffset: 0;
|
|
942
|
+
--modalCornerRadius: 0.5rem;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
input,
|
|
946
|
+
button {
|
|
947
|
+
font-size: 1.6rem;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
modal-manager.showFacetGroupOutlines,
|
|
951
|
+
collection-browser.showFacetGroupOutlines {
|
|
952
|
+
--facet-row-border-top: 1px solid red;
|
|
953
|
+
--facet-row-border-bottom: 1px solid blue;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
collection-browser {
|
|
957
|
+
/* Same as production */
|
|
958
|
+
max-width: 135rem;
|
|
959
|
+
margin: auto;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
#collection-browser-container {
|
|
963
|
+
/* Same as production */
|
|
964
|
+
padding-left: 0.5rem;
|
|
965
|
+
margin-bottom: 2rem;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
#base-query-field {
|
|
969
|
+
width: 300px;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
.dev-tool-container {
|
|
973
|
+
position: relative;
|
|
974
|
+
}
|
|
975
|
+
#dev-tools {
|
|
976
|
+
position: relative;
|
|
977
|
+
top: 0;
|
|
978
|
+
left: 0;
|
|
979
|
+
z-index: 1;
|
|
980
|
+
-webkit-backdrop-filter: blur(10px);
|
|
981
|
+
backdrop-filter: blur(10px);
|
|
982
|
+
padding: 0.5rem 1rem;
|
|
983
|
+
border: 1px solid black;
|
|
984
|
+
font-size: 1.4rem;
|
|
985
|
+
background: #ffffffb3;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
#dev-tools > * {
|
|
989
|
+
display: flex;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
#toggle-dev-tools-btn {
|
|
993
|
+
position: fixed;
|
|
994
|
+
left: 77.4%;
|
|
995
|
+
top: 0;
|
|
996
|
+
background: red;
|
|
997
|
+
padding: 5px;
|
|
998
|
+
color: white;
|
|
999
|
+
font-size: 1.4rem;
|
|
1000
|
+
margin: 0;
|
|
1001
|
+
z-index: 1;
|
|
1002
|
+
cursor: pointer;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
#search-and-page-inputs {
|
|
1006
|
+
flex-wrap: wrap;
|
|
1007
|
+
row-gap: 2px;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
#search-and-page-inputs > form {
|
|
1011
|
+
margin-right: 1rem;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
#search-and-page-inputs label {
|
|
1015
|
+
display: inline-block;
|
|
1016
|
+
min-width: 50px;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
#page-number-input {
|
|
1020
|
+
width: 75px;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
.search-type {
|
|
1024
|
+
margin-right: 1rem;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.cell-controls {
|
|
1028
|
+
display: flex;
|
|
1029
|
+
flex-wrap: wrap;
|
|
1030
|
+
}
|
|
1031
|
+
.cell-controls div {
|
|
1032
|
+
display: flex;
|
|
1033
|
+
align-items: center;
|
|
1034
|
+
}
|
|
1035
|
+
.cell-controls input[type='range'] {
|
|
1036
|
+
width: 120px;
|
|
1037
|
+
}
|
|
1038
|
+
#cell-controls label {
|
|
1039
|
+
display: inline-block;
|
|
1040
|
+
width: 10rem;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
#cell-size-control,
|
|
1044
|
+
#cell-gap-control {
|
|
1045
|
+
flex-basis: calc(50% - 1rem);
|
|
1046
|
+
flex-grow: 1;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
#cell-gap-control {
|
|
1050
|
+
margin-left: 1rem;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
#checkbox-controls {
|
|
1054
|
+
padding-top: 0.5rem;
|
|
1055
|
+
flex-wrap: wrap;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
.checkbox-control {
|
|
1059
|
+
flex-basis: 50%;
|
|
1060
|
+
}
|
|
1061
|
+
.checkbox-control.indent {
|
|
1062
|
+
margin-left: 10px;
|
|
1063
|
+
}
|
|
1064
|
+
.checkbox-control label {
|
|
1065
|
+
user-select: none;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
#last-event {
|
|
1069
|
+
background-color: aliceblue;
|
|
1070
|
+
padding: 5px;
|
|
1071
|
+
margin: 5px auto;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
.hidden {
|
|
1075
|
+
display: none;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
#toggle-controls {
|
|
1079
|
+
background-color: lightskyblue;
|
|
1080
|
+
padding: 5px;
|
|
1081
|
+
margin: 5px auto;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
#search-types {
|
|
1085
|
+
margin: 5px auto;
|
|
1086
|
+
background-color: aliceblue;
|
|
1087
|
+
font-size: 1.6rem;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
// slots
|
|
1091
|
+
div[slot='cb-top-slot'] {
|
|
1092
|
+
height: 50px;
|
|
1093
|
+
border: 1px solid red;
|
|
1094
|
+
background: bisque;
|
|
1095
|
+
}
|
|
1096
|
+
div[slot='facet-top-slot'] {
|
|
1097
|
+
border: 1px solid red;
|
|
1098
|
+
width: 100%;
|
|
1099
|
+
height: 150px;
|
|
1100
|
+
background-color: darkseagreen;
|
|
1101
|
+
}
|
|
1102
|
+
div[slot='sort-slot-left'] {
|
|
1103
|
+
height: 50px;
|
|
1104
|
+
border: 1px solid red;
|
|
1105
|
+
background: bisque;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/* user profile controls */
|
|
1109
|
+
.user-profile-controls {
|
|
1110
|
+
width: fit-content;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
fieldset {
|
|
1114
|
+
display: inline-block !important;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
.result-last-tile {
|
|
1118
|
+
border-radius: 4px;
|
|
1119
|
+
background-color: white;
|
|
1120
|
+
border: 3px dashed #555;
|
|
1121
|
+
box-shadow: none;
|
|
1122
|
+
display: grid;
|
|
1123
|
+
align-content: center;
|
|
1124
|
+
}
|
|
1125
|
+
.result-last-tile:hover {
|
|
1126
|
+
box-shadow: rgba(8, 8, 32, 0.8) 0 0 6px 2px;
|
|
1127
|
+
transition: box-shadow 0.1s ease 0s;
|
|
1128
|
+
cursor: pointer;
|
|
1129
|
+
border: 3px dashed #4b64ff;
|
|
1130
|
+
}
|
|
1131
|
+
.result-last-tile h3 {
|
|
1132
|
+
margin-bottom: 4rem;
|
|
1133
|
+
margin: 0px auto;
|
|
1134
|
+
font-size: 2.8rem;
|
|
1135
|
+
color: rgb(44, 44, 44);
|
|
1136
|
+
font-weight: 200;
|
|
1137
|
+
text-align: center;
|
|
1138
|
+
}
|
|
1139
|
+
`;
|
|
1140
|
+
}
|