@internetarchive/collection-browser 1.13.0 → 1.14.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/app-root.d.ts +10 -0
- package/dist/src/app-root.js +27 -0
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +51 -1
- package/dist/src/collection-browser.js +172 -14
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets.d.ts +1 -0
- package/dist/src/collection-facets.js +14 -1
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/manage/manage-bar.d.ts +26 -0
- package/dist/src/manage/manage-bar.js +147 -0
- package/dist/src/manage/manage-bar.js.map +1 -0
- package/dist/src/models.d.ts +1 -0
- package/dist/src/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +13 -0
- package/dist/src/tiles/tile-dispatcher.js +70 -2
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +144 -1
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/item-image.test.js +2 -0
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.d.ts +1 -0
- package/dist/test/manage/manage-bar.test.js +73 -0
- package/dist/test/manage/manage-bar.test.js.map +1 -0
- package/dist/test/mocks/mock-search-responses.js +2 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +1 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +40 -0
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/package.json +2 -2
- package/src/app-root.ts +29 -0
- package/src/collection-browser.ts +197 -10
- package/src/collection-facets.ts +13 -1
- package/src/manage/manage-bar.ts +151 -0
- package/src/models.ts +1 -0
- package/src/tiles/tile-dispatcher.ts +71 -5
- package/test/collection-browser.test.ts +198 -1
- package/test/item-image.test.ts +2 -0
- package/test/manage/manage-bar.test.ts +107 -0
- package/test/mocks/mock-search-responses.ts +2 -0
- package/test/tiles/hover/hover-pane-controller.test.ts +1 -0
- package/test/tiles/tile-dispatcher.test.ts +52 -0
|
@@ -3,6 +3,7 @@ import { __decorate } from "tslib";
|
|
|
3
3
|
import { css, html, nothing } from 'lit';
|
|
4
4
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import { msg } from '@lit/localize';
|
|
6
7
|
import './grid/collection-tile';
|
|
7
8
|
import './grid/item-tile';
|
|
8
9
|
import './grid/account-tile';
|
|
@@ -28,8 +29,10 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
28
29
|
* - loggedIn = false;
|
|
29
30
|
*/
|
|
30
31
|
super(...arguments);
|
|
32
|
+
this.isManageView = false;
|
|
31
33
|
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
32
34
|
this.enableHoverPane = false;
|
|
35
|
+
this.manageCheckTitle = msg('Remove this item from the list');
|
|
33
36
|
}
|
|
34
37
|
render() {
|
|
35
38
|
var _a, _b;
|
|
@@ -40,7 +43,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
40
43
|
${this.tileDisplayMode === 'list-header'
|
|
41
44
|
? this.headerTemplate
|
|
42
45
|
: this.tileTemplate}
|
|
43
|
-
${hoverPaneTemplate}
|
|
46
|
+
${this.manageCheckTemplate} ${hoverPaneTemplate}
|
|
44
47
|
</div>
|
|
45
48
|
`;
|
|
46
49
|
}
|
|
@@ -80,7 +83,8 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
80
83
|
title=${this.shouldPrepareHoverPane
|
|
81
84
|
? nothing // Don't show title tooltips when we have the tile info popups
|
|
82
85
|
: ifDefined((_c = this.model) === null || _c === void 0 ? void 0 : _c.title)}
|
|
83
|
-
@click=${
|
|
86
|
+
@click=${this.handleLinkClicked}
|
|
87
|
+
@contextmenu=${this.handleLinkContextMenu}
|
|
84
88
|
>
|
|
85
89
|
${this.tile}
|
|
86
90
|
</a>
|
|
@@ -97,6 +101,24 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
97
101
|
}
|
|
98
102
|
return this.displayValueProvider.itemPageUrl(this.model.identifier, this.model.mediatype === 'collection');
|
|
99
103
|
}
|
|
104
|
+
get manageCheckTemplate() {
|
|
105
|
+
var _a;
|
|
106
|
+
if (!this.isManageView || this.tileDisplayMode !== 'grid')
|
|
107
|
+
return nothing;
|
|
108
|
+
return html `
|
|
109
|
+
<div class="manage-check">
|
|
110
|
+
<input
|
|
111
|
+
type="checkbox"
|
|
112
|
+
title=${this.manageCheckTitle}
|
|
113
|
+
.checked=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.checked}
|
|
114
|
+
@change=${() => {
|
|
115
|
+
if (this.model)
|
|
116
|
+
this.model.checked = !this.model.checked;
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
100
122
|
/**
|
|
101
123
|
* Whether hover pane behavior should be prepared for this tile
|
|
102
124
|
* (e.g., whether mouse listeners should be attached, etc.)
|
|
@@ -145,6 +167,28 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
145
167
|
this.startResizeObservation();
|
|
146
168
|
}
|
|
147
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Handler for when the tile link is left-clicked. Emits the `resultSelected` event.
|
|
172
|
+
* In manage view, it also checks/unchecks the tile.
|
|
173
|
+
*/
|
|
174
|
+
handleLinkClicked(e) {
|
|
175
|
+
if (this.isManageView) {
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
if (this.model)
|
|
178
|
+
this.model.checked = !this.model.checked;
|
|
179
|
+
}
|
|
180
|
+
this.dispatchEvent(new CustomEvent('resultSelected', { detail: this.model }));
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Handler for when the tile link is right-clicked.
|
|
184
|
+
* In manage view, it opens the item in a new tab. Otherwise, does nothing.
|
|
185
|
+
*/
|
|
186
|
+
handleLinkContextMenu(e) {
|
|
187
|
+
if (this.isManageView && this.linkTileHref !== nothing) {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
window.open(this.linkTileHref, '_blank');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
148
192
|
tileInfoButtonPressed(e) {
|
|
149
193
|
var _a;
|
|
150
194
|
(_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.toggleHoverPane({
|
|
@@ -167,6 +211,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
167
211
|
.currentWidth=${currentWidth}
|
|
168
212
|
.currentHeight=${currentHeight}
|
|
169
213
|
.creatorFilter=${creatorFilter}
|
|
214
|
+
.isManageView=${this.isManageView}
|
|
170
215
|
?showInfoButton=${!this.isHoverEnabled}
|
|
171
216
|
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
172
217
|
>
|
|
@@ -179,6 +224,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
179
224
|
.currentWidth=${currentWidth}
|
|
180
225
|
.currentHeight=${currentHeight}
|
|
181
226
|
.creatorFilter=${creatorFilter}
|
|
227
|
+
.isManageView=${this.isManageView}
|
|
182
228
|
?showInfoButton=${!this.isHoverEnabled}
|
|
183
229
|
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
184
230
|
>
|
|
@@ -194,6 +240,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
194
240
|
.sortParam=${sortParam}
|
|
195
241
|
.creatorFilter=${creatorFilter}
|
|
196
242
|
.loggedIn=${this.loggedIn}
|
|
243
|
+
.isManageView=${this.isManageView}
|
|
197
244
|
?showInfoButton=${!this.isHoverEnabled}
|
|
198
245
|
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
199
246
|
>
|
|
@@ -279,6 +326,21 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
279
326
|
height: 100%;
|
|
280
327
|
}
|
|
281
328
|
|
|
329
|
+
.manage-check {
|
|
330
|
+
position: absolute;
|
|
331
|
+
right: 0;
|
|
332
|
+
top: 0;
|
|
333
|
+
border: 5px solid #2c2c2c;
|
|
334
|
+
border-radius: 3px;
|
|
335
|
+
background-color: #2c2c2c;
|
|
336
|
+
z-index: 1;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.manage-check > input[type='checkbox'] {
|
|
340
|
+
display: block;
|
|
341
|
+
margin: 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
282
344
|
#touch-backdrop {
|
|
283
345
|
position: fixed;
|
|
284
346
|
width: 100vw;
|
|
@@ -308,6 +370,9 @@ TileDispatcher.HOVER_PANE_DISPLAY_MODES = {
|
|
|
308
370
|
__decorate([
|
|
309
371
|
property({ type: String })
|
|
310
372
|
], TileDispatcher.prototype, "tileDisplayMode", void 0);
|
|
373
|
+
__decorate([
|
|
374
|
+
property({ type: Boolean })
|
|
375
|
+
], TileDispatcher.prototype, "isManageView", void 0);
|
|
311
376
|
__decorate([
|
|
312
377
|
property({ type: Object })
|
|
313
378
|
], TileDispatcher.prototype, "resizeObserver", void 0);
|
|
@@ -317,6 +382,9 @@ __decorate([
|
|
|
317
382
|
__decorate([
|
|
318
383
|
property({ type: Boolean })
|
|
319
384
|
], TileDispatcher.prototype, "enableHoverPane", void 0);
|
|
385
|
+
__decorate([
|
|
386
|
+
property({ type: String })
|
|
387
|
+
], TileDispatcher.prototype, "manageCheckTitle", void 0);
|
|
320
388
|
__decorate([
|
|
321
389
|
query('#container')
|
|
322
390
|
], TileDispatcher.prototype, "container", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/t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AAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AApCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAgW1B;SAhWY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA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rB,IAAI,CAAC,QAAQ;;qBAEd,CAAC;YAChB;gBACE,OAAO,OAAO,CAAC;SAClB;IACH,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6ET,CAAC;IACJ,CAAC;CACF,CAAA;AArXC,+EAA+E;AACvD,uCAAwB,GAG5C;IACF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACpB,CAAA;AAjC0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAEjC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAGtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAEzB;AAKF;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AA1CvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAia1B;SAjaY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n @property({ type: String }) manageCheckTitle = msg(\n 'Remove this item from the list'\n );\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.manageCheckTemplate} ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle}\n .checked=${this.model?.checked}\n @change=${() => {\n if (this.model) this.model.checked = !this.model.checked;\n }}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
|
|
@@ -866,7 +866,8 @@ describe('Collection Browser', () => {
|
|
|
866
866
|
el.baseQuery = 'collection:foo';
|
|
867
867
|
await el.updateComplete;
|
|
868
868
|
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
869
|
-
infiniteScroller.
|
|
869
|
+
infiniteScroller.refreshAllVisibleCells =
|
|
870
|
+
infiniteScrollerRefreshSpy;
|
|
870
871
|
expect(infiniteScrollerRefreshSpy.called).to.be.false;
|
|
871
872
|
expect(infiniteScrollerRefreshSpy.callCount).to.equal(0);
|
|
872
873
|
// testing: `loggedIn`
|
|
@@ -1067,5 +1068,147 @@ describe('Collection Browser', () => {
|
|
|
1067
1068
|
expect(el.minSelectedDate).not.to.exist;
|
|
1068
1069
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1069
1070
|
});
|
|
1071
|
+
it('shows manage bar interface instead of sort bar when in manage view', async () => {
|
|
1072
|
+
var _a, _b, _c, _d;
|
|
1073
|
+
const searchService = new MockSearchService();
|
|
1074
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1075
|
+
</collection-browser>`);
|
|
1076
|
+
el.baseQuery = 'foo';
|
|
1077
|
+
await el.updateComplete;
|
|
1078
|
+
await el.initialSearchComplete;
|
|
1079
|
+
el.isManageView = true;
|
|
1080
|
+
await el.updateComplete;
|
|
1081
|
+
expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('manage-bar')).to.exist;
|
|
1082
|
+
expect((_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('sort-filter-bar')).not.to.exist;
|
|
1083
|
+
el.isManageView = false;
|
|
1084
|
+
await el.updateComplete;
|
|
1085
|
+
expect((_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('manage-bar')).not.to.exist;
|
|
1086
|
+
expect((_d = el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('sort-filter-bar')).to.exist;
|
|
1087
|
+
});
|
|
1088
|
+
it('switches to grid display mode when manage view activated', async () => {
|
|
1089
|
+
const searchService = new MockSearchService();
|
|
1090
|
+
const el = await fixture(html `<collection-browser
|
|
1091
|
+
.searchService=${searchService}
|
|
1092
|
+
.baseQuery=${'foo'}
|
|
1093
|
+
.displayMode=${'list-detail'}
|
|
1094
|
+
>
|
|
1095
|
+
</collection-browser>`);
|
|
1096
|
+
el.isManageView = true;
|
|
1097
|
+
await el.updateComplete;
|
|
1098
|
+
expect(el.displayMode).to.equal('grid');
|
|
1099
|
+
});
|
|
1100
|
+
it('can remove all checked tiles', async () => {
|
|
1101
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1102
|
+
const searchService = new MockSearchService();
|
|
1103
|
+
const el = await fixture(html `<collection-browser
|
|
1104
|
+
.searchService=${searchService}
|
|
1105
|
+
.baseNavigationUrl=${''}
|
|
1106
|
+
>
|
|
1107
|
+
</collection-browser>`);
|
|
1108
|
+
el.baseQuery = 'foo';
|
|
1109
|
+
el.pageSize = 1; // To hit the edge case of a page break while offsetting tiles
|
|
1110
|
+
await el.updateComplete;
|
|
1111
|
+
await el.initialSearchComplete;
|
|
1112
|
+
el.isManageView = true;
|
|
1113
|
+
await el.updateComplete;
|
|
1114
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1115
|
+
expect(infiniteScroller).to.exist;
|
|
1116
|
+
let tiles = (_b = infiniteScroller.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('tile-dispatcher');
|
|
1117
|
+
expect(tiles).to.exist.and.have.length(2);
|
|
1118
|
+
const firstTile = tiles[0];
|
|
1119
|
+
const firstTileLink = (_c = firstTile.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('a[href]');
|
|
1120
|
+
expect((_d = firstTile.model) === null || _d === void 0 ? void 0 : _d.identifier).to.equal('foo');
|
|
1121
|
+
expect(firstTileLink).to.exist;
|
|
1122
|
+
// No effect if no tiles checked
|
|
1123
|
+
el.removeCheckedTiles();
|
|
1124
|
+
await el.updateComplete;
|
|
1125
|
+
tiles = (_e = infiniteScroller.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelectorAll('tile-dispatcher');
|
|
1126
|
+
expect(tiles).to.exist.and.have.length(2);
|
|
1127
|
+
// Check the first tile
|
|
1128
|
+
firstTileLink.click();
|
|
1129
|
+
expect((_f = firstTile.model) === null || _f === void 0 ? void 0 : _f.checked).to.be.true;
|
|
1130
|
+
// Remove checked tiles and verify that we only kept the second tile
|
|
1131
|
+
el.removeCheckedTiles();
|
|
1132
|
+
await el.updateComplete;
|
|
1133
|
+
tiles = (_g = infiniteScroller.shadowRoot) === null || _g === void 0 ? void 0 : _g.querySelectorAll('tile-dispatcher');
|
|
1134
|
+
expect(tiles).to.exist.and.have.length(1);
|
|
1135
|
+
expect((_h = tiles[0].model) === null || _h === void 0 ? void 0 : _h.identifier).to.equal('bar');
|
|
1136
|
+
});
|
|
1137
|
+
it('can check/uncheck all tiles', async () => {
|
|
1138
|
+
const searchService = new MockSearchService();
|
|
1139
|
+
const el = await fixture(html `<collection-browser
|
|
1140
|
+
.searchService=${searchService}
|
|
1141
|
+
.baseNavigationUrl=${''}
|
|
1142
|
+
>
|
|
1143
|
+
</collection-browser>`);
|
|
1144
|
+
el.baseQuery = 'foo';
|
|
1145
|
+
await el.updateComplete;
|
|
1146
|
+
await el.initialSearchComplete;
|
|
1147
|
+
el.isManageView = true;
|
|
1148
|
+
await el.updateComplete;
|
|
1149
|
+
expect(el.checkedTileModels.length).to.equal(0);
|
|
1150
|
+
expect(el.uncheckedTileModels.length).to.equal(2);
|
|
1151
|
+
el.checkAllTiles();
|
|
1152
|
+
expect(el.checkedTileModels.length).to.equal(2);
|
|
1153
|
+
expect(el.uncheckedTileModels.length).to.equal(0);
|
|
1154
|
+
el.uncheckAllTiles();
|
|
1155
|
+
expect(el.checkedTileModels.length).to.equal(0);
|
|
1156
|
+
expect(el.uncheckedTileModels.length).to.equal(2);
|
|
1157
|
+
});
|
|
1158
|
+
it('emits event when item removal requested', async () => {
|
|
1159
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1160
|
+
const spy = sinon.spy();
|
|
1161
|
+
const searchService = new MockSearchService();
|
|
1162
|
+
const el = await fixture(html `<collection-browser
|
|
1163
|
+
.searchService=${searchService}
|
|
1164
|
+
.baseNavigationUrl=${''}
|
|
1165
|
+
@itemRemovalRequested=${spy}
|
|
1166
|
+
>
|
|
1167
|
+
</collection-browser>`);
|
|
1168
|
+
el.baseQuery = 'foo';
|
|
1169
|
+
await el.updateComplete;
|
|
1170
|
+
await el.initialSearchComplete;
|
|
1171
|
+
el.isManageView = true;
|
|
1172
|
+
await el.updateComplete;
|
|
1173
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1174
|
+
expect(infiniteScroller).to.exist;
|
|
1175
|
+
const tiles = (_b = infiniteScroller.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('tile-dispatcher');
|
|
1176
|
+
expect(tiles).to.exist.and.have.length(2);
|
|
1177
|
+
const firstTile = tiles[0];
|
|
1178
|
+
const firstTileLink = (_c = firstTile.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('a[href]');
|
|
1179
|
+
expect((_d = firstTile.model) === null || _d === void 0 ? void 0 : _d.identifier).to.equal('foo');
|
|
1180
|
+
expect(firstTileLink).to.exist;
|
|
1181
|
+
// Check the first tile
|
|
1182
|
+
firstTileLink.click();
|
|
1183
|
+
await el.updateComplete;
|
|
1184
|
+
const manageBar = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('manage-bar');
|
|
1185
|
+
expect(manageBar).to.exist;
|
|
1186
|
+
// Emit remove event from manage bar
|
|
1187
|
+
manageBar.dispatchEvent(new CustomEvent('removeItems'));
|
|
1188
|
+
await el.updateComplete;
|
|
1189
|
+
expect(spy.callCount).to.equal(1);
|
|
1190
|
+
expect(spy.args[0].length).to.equal(1);
|
|
1191
|
+
expect((_j = (_h = (_g = (_f = spy.args[0][0]) === null || _f === void 0 ? void 0 : _f.detail) === null || _g === void 0 ? void 0 : _g.items) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.identifier).to.equal('foo');
|
|
1192
|
+
});
|
|
1193
|
+
it('disables manage view when manage bar cancelled', async () => {
|
|
1194
|
+
var _a;
|
|
1195
|
+
const searchService = new MockSearchService();
|
|
1196
|
+
const el = await fixture(html `<collection-browser
|
|
1197
|
+
.searchService=${searchService}
|
|
1198
|
+
.baseNavigationUrl=${''}
|
|
1199
|
+
>
|
|
1200
|
+
</collection-browser>`);
|
|
1201
|
+
el.baseQuery = 'foo';
|
|
1202
|
+
await el.updateComplete;
|
|
1203
|
+
await el.initialSearchComplete;
|
|
1204
|
+
el.isManageView = true;
|
|
1205
|
+
await el.updateComplete;
|
|
1206
|
+
const manageBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('manage-bar');
|
|
1207
|
+
expect(manageBar).to.exist;
|
|
1208
|
+
// Emit remove event from manage bar
|
|
1209
|
+
manageBar.dispatchEvent(new CustomEvent('cancel'));
|
|
1210
|
+
await el.updateComplete;
|
|
1211
|
+
expect(el.isManageView).to.be.false;
|
|
1212
|
+
});
|
|
1070
1213
|
});
|
|
1071
1214
|
//# sourceMappingURL=collection-browser.test.js.map
|