@internetarchive/collection-browser 0.4.4-alpha.1 → 0.4.4
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 +17 -2
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +2 -40
- package/dist/src/collection-browser.js +45 -116
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +11 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/styles/item-image-styles.js +5 -1
- package/dist/src/styles/item-image-styles.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +15 -2
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +6 -6
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +15 -7
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +197 -0
- package/dist/src/tiles/hover/hover-pane-controller.js +349 -0
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -0
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -0
- package/dist/src/tiles/hover/tile-hover-pane.js +88 -0
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -0
- package/dist/src/tiles/image-block.js +4 -0
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/list/date-label.js +3 -3
- package/dist/src/tiles/list/date-label.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js +4 -3
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +15 -5
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +2 -0
- package/dist/src/tiles/list/tile-list.js +63 -5
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js +4 -4
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +21 -2
- package/dist/src/tiles/tile-dispatcher.js +79 -9
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +6 -72
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +64 -0
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +1 -1
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.js +279 -0
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.js +14 -0
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -0
- package/dist/test/tiles/list/tile-list.test.js +46 -1
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/index.html +1 -0
- package/package.json +2 -2
- package/src/app-root.ts +17 -2
- package/src/collection-browser.ts +42 -138
- package/src/sort-filter-bar/sort-filter-bar.ts +12 -1
- package/src/styles/item-image-styles.ts +5 -1
- package/src/tiles/grid/item-tile.ts +15 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +6 -6
- package/src/tiles/grid/tile-stats.ts +15 -7
- package/src/tiles/hover/hover-pane-controller.ts +469 -0
- package/src/tiles/hover/tile-hover-pane.ts +79 -0
- package/src/tiles/image-block.ts +4 -0
- package/src/tiles/list/date-label.ts +3 -3
- package/src/tiles/list/tile-list-compact-header.ts +4 -3
- package/src/tiles/list/tile-list-compact.ts +15 -5
- package/src/tiles/list/tile-list.ts +67 -5
- package/src/tiles/text-snippet-block.ts +4 -4
- package/src/tiles/tile-dispatcher.ts +95 -7
- package/test/collection-browser.test.ts +7 -101
- package/test/sort-filter-bar/sort-filter-bar.test.ts +89 -0
- package/test/tiles/grid/account-tile.test.ts +1 -1
- package/test/tiles/hover/hover-pane-controller.test.ts +349 -0
- package/test/tiles/hover/tile-hover-pane.test.ts +19 -0
- package/test/tiles/list/tile-list.test.ts +58 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-snippet-block.js","sourceRoot":"","sources":["../../../src/tiles/text-snippet-block.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAAhD;;QAC6B,aAAQ,GAAc,EAAE,CAAC;QAExB,aAAQ,GAAW,SAAS,CAAC;IA8G3D,CAAC;IA5GC,MAAM;;QACJ,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAA;YAAE,OAAO,IAAI,CAAA,GAAG,OAAO,EAAE,CAAC;QAEpD,OAAO,IAAI,CAAA;;mCAEoB,IAAI,CAAC,QAAQ;YACpC,IAAI,CAAC,sBAAsB;;;KAGlC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,IAAY,sBAAsB;QAChC,OAAO,IAAI,CAAA;iBACE,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAA,YAAY,CAAC;KACzD,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,IAAY,gBAAgB;;QAC1B,OAAO,MAAA,IAAI,CAAC,QAAQ,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE;YAC5B,MAAM,OAAO,GAAG,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YAC5C,MAAM,SAAS,GAAqB,EAAE,CAAC;YAEvC,0DAA0D;YAC1D,4EAA4E;YAC5E,qDAAqD;YACrD,+EAA+E;YAC/E,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;gBAC3B,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE;oBACvB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA;cACf,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;oBACrB,KAAK,CAAC,CAAC,CAAC;WACjB,CAAC,CAAC;oBACH,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;iBACvC;aACF;YAED,kDAAkD;YAClD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAExC,gDAAgD;YAChD,OAAO,IAAI,CAAA,SAAS,SAAS,SAAS,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCT,CAAC;IACJ,CAAC;CACF,CAAA;AAhH4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAA0B;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA8B;AAH9C,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAiH5B;SAjHY,gBAAgB","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { join } from 'lit/directives/join.js';\n\n@customElement('text-snippet-block')\nexport class TextSnippetBlock extends LitElement {\n @property({ type: Array }) snippets?: string[] = [];\n\n @property({ type: String }) viewSize: string = 'desktop';\n\n render() {\n if (!this.snippets?.length) return html`${nothing}`;\n\n return html`\n <div class=\"container\">\n <div class=\"snippet-view ${this.viewSize}\">\n ${this.ellipsisJoinedSnippets}\n </div>\n </div>\n `;\n }\n\n /**\n * An array of HTML templates derived from the snippets, with ellipses inserted\n * at the beginning, end, and between each pair of snippets.\n */\n private get ellipsisJoinedSnippets(): TemplateResult {\n return html`\n … ${join(this.snippetTemplates, html` … `)} …\n `;\n }\n\n /**\n * Returns an array of HTML span templates containing this item's snippets with all of\n * their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.\n *\n * This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags\n * in the snippets intact (as inert text), rather than stripping them away with DOMPurify.\n *\n * Note on `<em>` vs. `<mark>`:\n * The old search page snippets had search keywords demarcated with `<em>` tags.\n * The `<mark>` tag is semantically more accurate for this use case than `<em>`,\n * but screen-reader behavior may be different. `<em>` will likely be read in a\n * different tone, while `<mark>` is often read no differently than ordinary text\n * in many screen-readers (though there are ways to work around this if needed).\n */\n private get snippetTemplates(): TemplateResult[] | undefined {\n return this.snippets?.map(s => {\n const matches = s.matchAll(/{{{(.+?)}}}/gs);\n const templates: TemplateResult[] = [];\n\n // Convert each match into an HTML template that includes:\n // - Everything from the end of the previous match (or the beginning of the\n // string) up to the current match, as raw text.\n // - The current match (excluding the curly braces) wrapped in a `<mark>` tag.\n let index = 0;\n for (const match of matches) {\n if (match.index != null) {\n templates.push(html`\n ${s.slice(index, match.index)}\n <mark>${match[1]}</mark>\n `);\n index = match.index + match[0].length;\n }\n }\n\n // Include any text from the last match to the end\n templates.push(html`${s.slice(index)}`);\n\n // Squash everything into a single span template\n return html`<span>${templates}</span>`;\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n .container {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n width: 100
|
|
1
|
+
{"version":3,"file":"text-snippet-block.js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IAAI,CAAA;cACf,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;oBACrB,KAAK,CAAC,CAAC,CAAC;WACjB,CAAC,CAAC;oBACH,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;iBACvC;aACF;YAED,kDAAkD;YAClD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAA,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAExC,gDAAgD;YAChD,OAAO,IAAI,CAAA,SAAS,SAAS,SAAS,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCT,CAAC;IACJ,CAAC;CACF,CAAA;AAhH4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAA0B;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA8B;AAH9C,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAiH5B;SAjHY,gBAAgB","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n LitElement,\n nothing,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { join } from 'lit/directives/join.js';\n\n@customElement('text-snippet-block')\nexport class TextSnippetBlock extends LitElement {\n @property({ type: Array }) snippets?: string[] = [];\n\n @property({ type: String }) viewSize: string = 'desktop';\n\n render() {\n if (!this.snippets?.length) return html`${nothing}`;\n\n return html`\n <div class=\"container\">\n <div class=\"snippet-view ${this.viewSize}\">\n ${this.ellipsisJoinedSnippets}\n </div>\n </div>\n `;\n }\n\n /**\n * An array of HTML templates derived from the snippets, with ellipses inserted\n * at the beginning, end, and between each pair of snippets.\n */\n private get ellipsisJoinedSnippets(): TemplateResult {\n return html`\n … ${join(this.snippetTemplates, html` … `)} …\n `;\n }\n\n /**\n * Returns an array of HTML span templates containing this item's snippets with all of\n * their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.\n *\n * This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags\n * in the snippets intact (as inert text), rather than stripping them away with DOMPurify.\n *\n * Note on `<em>` vs. `<mark>`:\n * The old search page snippets had search keywords demarcated with `<em>` tags.\n * The `<mark>` tag is semantically more accurate for this use case than `<em>`,\n * but screen-reader behavior may be different. `<em>` will likely be read in a\n * different tone, while `<mark>` is often read no differently than ordinary text\n * in many screen-readers (though there are ways to work around this if needed).\n */\n private get snippetTemplates(): TemplateResult[] | undefined {\n return this.snippets?.map(s => {\n const matches = s.matchAll(/{{{(.+?)}}}/gs);\n const templates: TemplateResult[] = [];\n\n // Convert each match into an HTML template that includes:\n // - Everything from the end of the previous match (or the beginning of the\n // string) up to the current match, as raw text.\n // - The current match (excluding the curly braces) wrapped in a `<mark>` tag.\n let index = 0;\n for (const match of matches) {\n if (match.index != null) {\n templates.push(html`\n ${s.slice(index, match.index)}\n <mark>${match[1]}</mark>\n `);\n index = match.index + match[0].length;\n }\n }\n\n // Include any text from the last match to the end\n templates.push(html`${s.slice(index)}`);\n\n // Squash everything into a single span template\n return html`<span>${templates}</span>`;\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n .container {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n width: calc(100% - 10px);\n border-left: 5px solid #194880;\n margin-top: var(--containerTopMargin, 10px);\n margin-left: var(--containerLeftMargin, 0px);\n border-radius: 3px;\n box-sizing: border-box;\n }\n\n .snippet-view {\n display: -webkit-box;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n font-size: 14px;\n overflow: hidden;\n overflow-wrap: break-word;\n -webkit-line-clamp: var(--maxLines, 3);\n -webkit-box-orient: vertical;\n margin-left: 5px;\n }\n\n .grid {\n font-size: 1.2rem;\n line-height: 1.5rem;\n }\n\n .list {\n margin: 0;\n padding-left: 15px;\n font-size: 1.4rem;\n line-height: 2rem;\n }\n\n mark {\n /* blue, 20% transparency */\n background-color: #0000ff33;\n color: inherit;\n }\n `;\n }\n}\n"]}
|
|
@@ -6,10 +6,13 @@ import type { TileDisplayMode, TileModel } from '../models';
|
|
|
6
6
|
import './grid/collection-tile';
|
|
7
7
|
import './grid/item-tile';
|
|
8
8
|
import './grid/account-tile';
|
|
9
|
+
import './hover/tile-hover-pane';
|
|
9
10
|
import './list/tile-list';
|
|
10
11
|
import './list/tile-list-compact';
|
|
11
12
|
import './list/tile-list-compact-header';
|
|
12
|
-
|
|
13
|
+
import type { TileHoverPane } from './hover/tile-hover-pane';
|
|
14
|
+
import { HoverPaneProperties, HoverPaneProviderInterface } from './hover/hover-pane-controller';
|
|
15
|
+
export declare class TileDispatcher extends LitElement implements SharedResizeObserverResizeHandlerInterface, HoverPaneProviderInterface {
|
|
13
16
|
tileDisplayMode?: TileDisplayMode;
|
|
14
17
|
model?: TileModel;
|
|
15
18
|
baseNavigationUrl?: string;
|
|
@@ -18,14 +21,30 @@ export declare class TileDispatcher extends LitElement implements SharedResizeOb
|
|
|
18
21
|
resizeObserver?: SharedResizeObserverInterface;
|
|
19
22
|
collectionNameCache?: CollectionNameCacheInterface;
|
|
20
23
|
sortParam: SortParam | null;
|
|
21
|
-
private container;
|
|
22
24
|
mobileBreakpoint?: number;
|
|
23
25
|
baseImageUrl?: string;
|
|
24
26
|
loggedIn: boolean;
|
|
27
|
+
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
28
|
+
enableHoverPane: boolean;
|
|
29
|
+
private hoverPaneController?;
|
|
30
|
+
private container;
|
|
31
|
+
private hoverPane?;
|
|
32
|
+
/** Maps each display mode to whether hover panes should appear in that mode */
|
|
33
|
+
private static readonly HOVER_PANE_DISPLAY_MODES;
|
|
25
34
|
render(): import("lit-html").TemplateResult<1>;
|
|
35
|
+
protected firstUpdated(): void;
|
|
26
36
|
private get headerTemplate();
|
|
27
37
|
private get tileTemplate();
|
|
28
38
|
private get linkTileTemplate();
|
|
39
|
+
/**
|
|
40
|
+
* Whether hover pane behavior should be prepared for this tile
|
|
41
|
+
* (e.g., whether mouse listeners should be attached, etc.)
|
|
42
|
+
*/
|
|
43
|
+
private get shouldPrepareHoverPane();
|
|
44
|
+
/** @inheritdoc */
|
|
45
|
+
getHoverPane(): TileHoverPane | undefined;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
getHoverPaneProps(): HoverPaneProperties;
|
|
29
48
|
handleResize(entry: ResizeObserverEntry): void;
|
|
30
49
|
disconnectedCallback(): void;
|
|
31
50
|
private stopResizeObservation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var TileDispatcher_1;
|
|
1
2
|
import { __decorate } from "tslib";
|
|
2
3
|
import { css, html, LitElement, nothing } from 'lit';
|
|
3
4
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
@@ -5,24 +6,40 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
5
6
|
import './grid/collection-tile';
|
|
6
7
|
import './grid/item-tile';
|
|
7
8
|
import './grid/account-tile';
|
|
9
|
+
import './hover/tile-hover-pane';
|
|
8
10
|
import './list/tile-list';
|
|
9
11
|
import './list/tile-list-compact';
|
|
10
12
|
import './list/tile-list-compact-header';
|
|
11
|
-
|
|
13
|
+
import { HoverPaneController, } from './hover/hover-pane-controller';
|
|
14
|
+
let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends LitElement {
|
|
12
15
|
constructor() {
|
|
13
16
|
super(...arguments);
|
|
14
17
|
this.sortParam = null;
|
|
15
18
|
this.loggedIn = false;
|
|
19
|
+
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
20
|
+
this.enableHoverPane = false;
|
|
16
21
|
}
|
|
17
22
|
render() {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const isGridMode = this.tileDisplayMode === 'grid';
|
|
25
|
+
const hoverPaneTemplate = (_b = (_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.getTemplate()) !== null && _b !== void 0 ? _b : nothing;
|
|
18
26
|
return html `
|
|
19
|
-
<div id="container">
|
|
27
|
+
<div id="container" class=${isGridMode ? 'hoverable' : nothing}>
|
|
20
28
|
${this.tileDisplayMode === 'list-header'
|
|
21
29
|
? this.headerTemplate
|
|
22
30
|
: this.tileTemplate}
|
|
31
|
+
${hoverPaneTemplate}
|
|
23
32
|
</div>
|
|
24
33
|
`;
|
|
25
34
|
}
|
|
35
|
+
firstUpdated() {
|
|
36
|
+
if (this.shouldPrepareHoverPane) {
|
|
37
|
+
this.hoverPaneController = new HoverPaneController(this, {
|
|
38
|
+
mobileBreakpoint: this.mobileBreakpoint,
|
|
39
|
+
enableLongPress: false,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
26
43
|
get headerTemplate() {
|
|
27
44
|
const { currentWidth, sortParam, mobileBreakpoint } = this;
|
|
28
45
|
return html `
|
|
@@ -47,13 +64,32 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
47
64
|
return html `
|
|
48
65
|
<a
|
|
49
66
|
href="${this.baseNavigationUrl}/details/${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}"
|
|
50
|
-
title=${
|
|
67
|
+
title=${this.shouldPrepareHoverPane
|
|
68
|
+
? nothing // Don't show title tooltips when we have the tile info popups
|
|
69
|
+
: ifDefined((_b = this.model) === null || _b === void 0 ? void 0 : _b.title)}
|
|
51
70
|
@click=${() => this.dispatchEvent(new CustomEvent('resultSelected', { detail: this.model }))}
|
|
52
71
|
>
|
|
53
72
|
${this.tile}
|
|
54
73
|
</a>
|
|
55
74
|
`;
|
|
56
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether hover pane behavior should be prepared for this tile
|
|
78
|
+
* (e.g., whether mouse listeners should be attached, etc.)
|
|
79
|
+
*/
|
|
80
|
+
get shouldPrepareHoverPane() {
|
|
81
|
+
return (this.enableHoverPane &&
|
|
82
|
+
!!this.tileDisplayMode &&
|
|
83
|
+
TileDispatcher_1.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]);
|
|
84
|
+
}
|
|
85
|
+
/** @inheritdoc */
|
|
86
|
+
getHoverPane() {
|
|
87
|
+
return this.hoverPane;
|
|
88
|
+
}
|
|
89
|
+
/** @inheritdoc */
|
|
90
|
+
getHoverPaneProps() {
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
57
93
|
handleResize(entry) {
|
|
58
94
|
this.currentWidth = entry.contentRect.width;
|
|
59
95
|
this.currentHeight = entry.contentRect.height;
|
|
@@ -170,11 +206,14 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
170
206
|
}
|
|
171
207
|
|
|
172
208
|
#container {
|
|
209
|
+
position: relative;
|
|
173
210
|
height: 100%;
|
|
211
|
+
border-radius: 4px;
|
|
174
212
|
}
|
|
175
213
|
|
|
176
|
-
#
|
|
177
|
-
|
|
214
|
+
#container.hoverable:hover {
|
|
215
|
+
box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);
|
|
216
|
+
transition: box-shadow 0.1s ease;
|
|
178
217
|
}
|
|
179
218
|
|
|
180
219
|
a {
|
|
@@ -182,15 +221,40 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
182
221
|
height: 100%;
|
|
183
222
|
color: unset;
|
|
184
223
|
text-decoration: none;
|
|
224
|
+
transition: transform 0.05s ease;
|
|
185
225
|
}
|
|
186
226
|
|
|
187
227
|
a :first-child {
|
|
188
228
|
display: block;
|
|
189
229
|
height: 100%;
|
|
190
230
|
}
|
|
231
|
+
|
|
232
|
+
#touch-backdrop {
|
|
233
|
+
position: fixed;
|
|
234
|
+
width: 100vw;
|
|
235
|
+
height: 100vh;
|
|
236
|
+
top: 0;
|
|
237
|
+
left: 0;
|
|
238
|
+
z-index: 1;
|
|
239
|
+
background: transparent;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
tile-hover-pane {
|
|
243
|
+
position: absolute;
|
|
244
|
+
top: 0;
|
|
245
|
+
left: -9999px;
|
|
246
|
+
z-index: 2;
|
|
247
|
+
}
|
|
191
248
|
`;
|
|
192
249
|
}
|
|
193
250
|
};
|
|
251
|
+
/** Maps each display mode to whether hover panes should appear in that mode */
|
|
252
|
+
TileDispatcher.HOVER_PANE_DISPLAY_MODES = {
|
|
253
|
+
grid: true,
|
|
254
|
+
'list-compact': true,
|
|
255
|
+
'list-detail': false,
|
|
256
|
+
'list-header': false,
|
|
257
|
+
};
|
|
194
258
|
__decorate([
|
|
195
259
|
property({ type: String })
|
|
196
260
|
], TileDispatcher.prototype, "tileDisplayMode", void 0);
|
|
@@ -215,9 +279,6 @@ __decorate([
|
|
|
215
279
|
__decorate([
|
|
216
280
|
property({ type: Object })
|
|
217
281
|
], TileDispatcher.prototype, "sortParam", void 0);
|
|
218
|
-
__decorate([
|
|
219
|
-
query('#container')
|
|
220
|
-
], TileDispatcher.prototype, "container", void 0);
|
|
221
282
|
__decorate([
|
|
222
283
|
property({ type: Number })
|
|
223
284
|
], TileDispatcher.prototype, "mobileBreakpoint", void 0);
|
|
@@ -227,7 +288,16 @@ __decorate([
|
|
|
227
288
|
__decorate([
|
|
228
289
|
property({ type: Boolean })
|
|
229
290
|
], TileDispatcher.prototype, "loggedIn", void 0);
|
|
230
|
-
|
|
291
|
+
__decorate([
|
|
292
|
+
property({ type: Boolean })
|
|
293
|
+
], TileDispatcher.prototype, "enableHoverPane", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
query('#container')
|
|
296
|
+
], TileDispatcher.prototype, "container", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
query('tile-hover-pane')
|
|
299
|
+
], TileDispatcher.prototype, "hoverPane", void 0);
|
|
300
|
+
TileDispatcher = TileDispatcher_1 = __decorate([
|
|
231
301
|
customElement('tile-dispatcher')
|
|
232
302
|
], TileDispatcher);
|
|
233
303
|
export { TileDispatcher };
|
|
@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AyCT,CAAC;IACJ,CAAC;CACF,CAAA;AA9N6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAA4B;AAE3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAoC;AAE1C;IAApB,KAAK,CAAC,YAAY,CAAC;iDAAoC;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AA3BnC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkO1B;SAlOY,cAAc","sourcesContent":["import { css, html, LitElement, 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 { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @query('#container') private container!: HTMLDivElement;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n render() {\n return html`\n <div id=\"container\">\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n </div>\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.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${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 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 get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\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 .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\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 .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\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 height: 100%;\n }\n\n #delete-button {\n float: right;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\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,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD,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,EACL,mBAAmB,GAIpB,MAAM,+BAA+B,CAAC;AAGvC,IAAa,cAAc,sBAA3B,MAAa,cACX,SAAQ,UAAU;IADpB;;QAqB8B,cAAS,GAAqB,IAAI,CAAC;QAMlC,aAAQ,GAAG,KAAK,CAAC;QAE9C,uFAAuF;QAC1D,oBAAe,GAAG,KAAK,CAAC;IAoRvD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B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAtCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkT1B;SAlTY,cAAc","sourcesContent":["import { css, html, LitElement, 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 { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } 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 {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\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.baseNavigationUrl}/details/${this.model?.identifier}\"\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 /**\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 /** @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 get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\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 .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\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 .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\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: 1;\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"]}
|
|
@@ -240,72 +240,6 @@ describe('Collection Browser', () => {
|
|
|
240
240
|
},
|
|
241
241
|
});
|
|
242
242
|
});
|
|
243
|
-
it('fires a separate date histogram query when year facets are applied', async () => {
|
|
244
|
-
var _a, _b, _c;
|
|
245
|
-
const searchService = new MockSearchService();
|
|
246
|
-
const selectedFacets = {
|
|
247
|
-
subject: {},
|
|
248
|
-
lending: {},
|
|
249
|
-
mediatype: {},
|
|
250
|
-
language: {},
|
|
251
|
-
creator: {},
|
|
252
|
-
collection: {},
|
|
253
|
-
year: {
|
|
254
|
-
'2000': {
|
|
255
|
-
key: '2000',
|
|
256
|
-
state: 'selected',
|
|
257
|
-
count: 123,
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
};
|
|
261
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
262
|
-
</collection-browser>`);
|
|
263
|
-
el.baseQuery = 'collection:foo';
|
|
264
|
-
el.showHistogramDatePicker = true;
|
|
265
|
-
el.selectedFacets = selectedFacets;
|
|
266
|
-
await el.updateComplete;
|
|
267
|
-
expect((_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.aggregations) === null || _b === void 0 ? void 0 : _b.simpleParams).to.deep.equal(['year']); // Explicitly requests year aggregations
|
|
268
|
-
expect((_c = searchService.searchParams) === null || _c === void 0 ? void 0 : _c.query).to.equal('collection:foo' // No date clause on query
|
|
269
|
-
);
|
|
270
|
-
});
|
|
271
|
-
it('fires a separate date histogram query when a date range is applied', async () => {
|
|
272
|
-
var _a, _b, _c;
|
|
273
|
-
const searchService = new MockSearchService();
|
|
274
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
275
|
-
</collection-browser>`);
|
|
276
|
-
el.baseQuery = 'collection:foo';
|
|
277
|
-
el.showHistogramDatePicker = true;
|
|
278
|
-
el.minSelectedDate = '1995';
|
|
279
|
-
el.maxSelectedDate = '2005';
|
|
280
|
-
await el.updateComplete;
|
|
281
|
-
expect((_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.aggregations) === null || _b === void 0 ? void 0 : _b.simpleParams).to.deep.equal(['year']); // Explicitly requests year aggregations
|
|
282
|
-
expect((_c = searchService.searchParams) === null || _c === void 0 ? void 0 : _c.query).to.equal('collection:foo' // No date clause on query
|
|
283
|
-
);
|
|
284
|
-
});
|
|
285
|
-
it('does not fire a separate date histogram query when no date filters are applied', async () => {
|
|
286
|
-
var _a, _b;
|
|
287
|
-
const searchService = new MockSearchService();
|
|
288
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
289
|
-
</collection-browser>`);
|
|
290
|
-
el.baseQuery = 'collection:foo';
|
|
291
|
-
el.showHistogramDatePicker = true;
|
|
292
|
-
await el.updateComplete;
|
|
293
|
-
expect((_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.aggregations) === null || _b === void 0 ? void 0 : _b.simpleParams).to.satisfy((aggTypes) => !aggTypes || !aggTypes.includes('year') // Not requesting year aggregations explicitly
|
|
294
|
-
);
|
|
295
|
-
});
|
|
296
|
-
it('does not fire a separate date histogram query when date picker is disabled', async () => {
|
|
297
|
-
var _a, _b;
|
|
298
|
-
const searchService = new MockSearchService();
|
|
299
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
300
|
-
</collection-browser>`);
|
|
301
|
-
el.baseQuery = 'collection:foo';
|
|
302
|
-
el.showHistogramDatePicker = false;
|
|
303
|
-
el.minSelectedDate = '1995';
|
|
304
|
-
el.maxSelectedDate = '2005';
|
|
305
|
-
await el.updateComplete;
|
|
306
|
-
expect((_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.aggregations) === null || _b === void 0 ? void 0 : _b.simpleParams).to.satisfy((aggTypes) => !aggTypes || !aggTypes.includes('year') // Not requesting year aggregations explicitly
|
|
307
|
-
);
|
|
308
|
-
});
|
|
309
243
|
it('fails gracefully if no search service provided', async () => {
|
|
310
244
|
var _a;
|
|
311
245
|
const el = await fixture(html `<collection-browser></collection-browser>`);
|
|
@@ -605,7 +539,11 @@ describe('Collection Browser', () => {
|
|
|
605
539
|
const searchService = new MockSearchService();
|
|
606
540
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
607
541
|
</collection-browser>`);
|
|
608
|
-
// Infinite scroller won't exist unless there's a base query
|
|
542
|
+
// Infinite scroller won't exist unless there's a base query.
|
|
543
|
+
// First ensure that we don't throw errors when it doesn't exist.
|
|
544
|
+
await el.goToPage(1);
|
|
545
|
+
// And make sure it correctly calls scrollToCell when the
|
|
546
|
+
// infinite scroller does exist.
|
|
609
547
|
el.baseQuery = 'collection:foo';
|
|
610
548
|
await el.updateComplete;
|
|
611
549
|
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
@@ -613,11 +551,7 @@ describe('Collection Browser', () => {
|
|
|
613
551
|
const oldScrollToCell = infiniteScroller.scrollToCell;
|
|
614
552
|
const spy = sinon.spy();
|
|
615
553
|
infiniteScroller.scrollToCell = spy;
|
|
616
|
-
el.goToPage(1);
|
|
617
|
-
// Give it a second to scroll
|
|
618
|
-
await new Promise(res => {
|
|
619
|
-
setTimeout(res, 1000);
|
|
620
|
-
});
|
|
554
|
+
await el.goToPage(1);
|
|
621
555
|
expect(spy.callCount).to.equal(1);
|
|
622
556
|
infiniteScroller.scrollToCell = oldScrollToCell;
|
|
623
557
|
});
|