@internetarchive/collection-browser 3.4.1-alpha-webdev7761.2 → 3.4.1-alpha-webdev7761.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 +19 -28
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +14 -10
- package/dist/src/collection-browser.js +870 -886
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +3 -4
- 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/more-facets-content.js +145 -156
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +6 -10
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +4 -6
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +34 -50
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/combo-box/caret-closed.js +5 -11
- package/dist/src/combo-box/caret-closed.js.map +1 -1
- package/dist/src/combo-box/caret-open.js +5 -11
- package/dist/src/combo-box/caret-open.js.map +1 -1
- package/dist/src/combo-box/clear.d.ts +2 -0
- package/dist/src/combo-box/clear.js +11 -0
- package/dist/src/combo-box/clear.js.map +1 -0
- package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
- package/dist/src/combo-box/ia-combo-box.js +363 -272
- package/dist/src/combo-box/ia-combo-box.js.map +1 -1
- package/dist/src/combo-box/models.d.ts +14 -0
- package/dist/src/combo-box/models.js +32 -1
- package/dist/src/combo-box/models.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +35 -47
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/empty-placeholder.js +19 -18
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js +6 -10
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js +2 -2
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/manage/manage-bar.js +86 -92
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js +2 -2
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/models.js +36 -40
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +9 -10
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js +1 -2
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -38
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +79 -82
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +154 -164
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -43
- 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/grid/tile-stats.js +2 -3
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.js +5 -8
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.js +12 -19
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +114 -122
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +326 -347
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js +1 -2
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +2 -4
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js +2 -4
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +233 -241
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js +5 -9
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/tiles/tile-mediatype-icon.js +12 -19
- package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
- package/dist/src/utils/facet-utils.js +3 -5
- package/dist/src/utils/facet-utils.js.map +1 -1
- package/dist/src/utils/format-count.js +10 -10
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/src/utils/resolve-mediatype.js +2 -3
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +131 -185
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +60 -75
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js +17 -23
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +22 -32
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +22 -19
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +80 -97
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +11 -17
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +8 -14
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +7 -6
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +16 -26
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +23 -32
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +21 -33
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +10 -15
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +2 -3
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +13 -21
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +16 -18
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +16 -15
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +14 -19
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +73 -34
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +25 -25
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +13 -19
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +141 -168
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +9 -13
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +202 -231
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +97 -110
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
- package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/index.html +1 -1
- package/package.json +5 -3
- package/src/collection-browser.ts +3060 -3030
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/more-facets-content.ts +639 -639
- package/src/collection-facets.ts +1 -1
- package/src/combo-box/caret-closed.ts +5 -11
- package/src/combo-box/caret-open.ts +5 -11
- package/src/combo-box/clear.ts +11 -0
- package/src/combo-box/ia-combo-box.ts +1288 -1180
- package/src/combo-box/models.ts +31 -1
- package/src/manage/manage-bar.ts +247 -247
- package/src/restoration-state-handler.ts +5 -1
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/account-tile.ts +113 -113
- package/src/tiles/grid/collection-tile.ts +163 -163
- package/src/tiles/grid/item-tile.ts +340 -340
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/hover/hover-pane-controller.ts +613 -613
- package/src/tiles/hover/tile-hover-pane.ts +184 -184
- package/src/tiles/list/tile-list-compact.ts +239 -239
- package/src/tiles/list/tile-list.ts +700 -700
- package/src/tiles/tile-dispatcher.ts +517 -517
- package/src/utils/format-date.ts +62 -62
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
- package/test/tiles/list/tile-list-compact.test.ts +282 -282
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +283 -283
- package/test/utils/format-date.test.ts +89 -89
- package/tsconfig.json +8 -3
- package/vite.config.ts +29 -22
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
-
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
-
import type { TileModel } from '../models';
|
|
6
|
-
import { DateFormat, formatDate } from '../utils/format-date';
|
|
7
|
-
|
|
8
|
-
export abstract class BaseTileComponent extends LitElement {
|
|
9
|
-
@property({ type: Object }) model?: TileModel;
|
|
10
|
-
|
|
11
|
-
@property({ type: Number }) currentWidth?: number;
|
|
12
|
-
|
|
13
|
-
@property({ type: Number }) currentHeight?: number;
|
|
14
|
-
|
|
15
|
-
@property({ type: String }) baseNavigationUrl?: string;
|
|
16
|
-
|
|
17
|
-
@property({ type: String }) baseImageUrl?: string;
|
|
18
|
-
|
|
19
|
-
@property({ type: String }) collectionPagePath?: string;
|
|
20
|
-
|
|
21
|
-
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
22
|
-
|
|
23
|
-
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
24
|
-
|
|
25
|
-
@property({ type: String }) creatorFilter?: string;
|
|
26
|
-
|
|
27
|
-
@property({ type: Number }) mobileBreakpoint?: number;
|
|
28
|
-
|
|
29
|
-
@property({ type: Boolean }) loggedIn = false;
|
|
30
|
-
|
|
31
|
-
@property({ type: Boolean }) suppressBlurring = false;
|
|
32
|
-
|
|
33
|
-
@property({ type: Boolean }) useLocalTime = false;
|
|
34
|
-
|
|
35
|
-
protected displayValueProvider = new TileDisplayValueProvider();
|
|
36
|
-
|
|
37
|
-
protected willUpdate(changed: PropertyValues<this>) {
|
|
38
|
-
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
39
|
-
if (
|
|
40
|
-
changed.has('model') ||
|
|
41
|
-
changed.has('baseNavigationUrl') ||
|
|
42
|
-
changed.has('collectionPagePath') ||
|
|
43
|
-
changed.has('sortParam') ||
|
|
44
|
-
changed.has('defaultSortParam') ||
|
|
45
|
-
changed.has('creatorFilter')
|
|
46
|
-
) {
|
|
47
|
-
this.displayValueProvider = new TileDisplayValueProvider({
|
|
48
|
-
model: this.model,
|
|
49
|
-
baseNavigationUrl: this.baseNavigationUrl,
|
|
50
|
-
collectionPagePath: this.collectionPagePath,
|
|
51
|
-
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
52
|
-
creatorFilter: this.creatorFilter,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The formatted date string for given date and format type, taking into
|
|
59
|
-
* account whether this tile component should be using local time or UTC.
|
|
60
|
-
*/
|
|
61
|
-
protected getFormattedDate(date?: Date, format?: DateFormat): string {
|
|
62
|
-
const { useLocalTime } = this;
|
|
63
|
-
return formatDate(date, format, { useLocalTime });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
+
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
+
import type { TileModel } from '../models';
|
|
6
|
+
import { DateFormat, formatDate } from '../utils/format-date';
|
|
7
|
+
|
|
8
|
+
export abstract class BaseTileComponent extends LitElement {
|
|
9
|
+
@property({ type: Object }) model?: TileModel;
|
|
10
|
+
|
|
11
|
+
@property({ type: Number }) currentWidth?: number;
|
|
12
|
+
|
|
13
|
+
@property({ type: Number }) currentHeight?: number;
|
|
14
|
+
|
|
15
|
+
@property({ type: String }) baseNavigationUrl?: string;
|
|
16
|
+
|
|
17
|
+
@property({ type: String }) baseImageUrl?: string;
|
|
18
|
+
|
|
19
|
+
@property({ type: String }) collectionPagePath?: string;
|
|
20
|
+
|
|
21
|
+
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
22
|
+
|
|
23
|
+
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
24
|
+
|
|
25
|
+
@property({ type: String }) creatorFilter?: string;
|
|
26
|
+
|
|
27
|
+
@property({ type: Number }) mobileBreakpoint?: number;
|
|
28
|
+
|
|
29
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
30
|
+
|
|
31
|
+
@property({ type: Boolean }) suppressBlurring = false;
|
|
32
|
+
|
|
33
|
+
@property({ type: Boolean }) useLocalTime = false;
|
|
34
|
+
|
|
35
|
+
protected displayValueProvider = new TileDisplayValueProvider();
|
|
36
|
+
|
|
37
|
+
protected willUpdate(changed: PropertyValues<this>) {
|
|
38
|
+
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
39
|
+
if (
|
|
40
|
+
changed.has('model') ||
|
|
41
|
+
changed.has('baseNavigationUrl') ||
|
|
42
|
+
changed.has('collectionPagePath') ||
|
|
43
|
+
changed.has('sortParam') ||
|
|
44
|
+
changed.has('defaultSortParam') ||
|
|
45
|
+
changed.has('creatorFilter')
|
|
46
|
+
) {
|
|
47
|
+
this.displayValueProvider = new TileDisplayValueProvider({
|
|
48
|
+
model: this.model,
|
|
49
|
+
baseNavigationUrl: this.baseNavigationUrl,
|
|
50
|
+
collectionPagePath: this.collectionPagePath,
|
|
51
|
+
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
52
|
+
creatorFilter: this.creatorFilter,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The formatted date string for given date and format type, taking into
|
|
59
|
+
* account whether this tile component should be using local time or UTC.
|
|
60
|
+
*/
|
|
61
|
+
protected getFormattedDate(date?: Date, format?: DateFormat): string {
|
|
62
|
+
const { useLocalTime } = this;
|
|
63
|
+
return formatDate(date, format, { useLocalTime });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { css, html, nothing, TemplateResult } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { msg } from '@lit/localize';
|
|
4
|
-
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
-
|
|
6
|
-
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
7
|
-
import '../image-block';
|
|
8
|
-
import './tile-stats';
|
|
9
|
-
|
|
10
|
-
@customElement('account-tile')
|
|
11
|
-
export class AccountTile extends BaseTileComponent {
|
|
12
|
-
/*
|
|
13
|
-
* Reactive properties inherited from BaseTileComponent:
|
|
14
|
-
* - model?: TileModel;
|
|
15
|
-
* - currentWidth?: number;
|
|
16
|
-
* - currentHeight?: number;
|
|
17
|
-
* - baseNavigationUrl?: string;
|
|
18
|
-
* - baseImageUrl?: string;
|
|
19
|
-
* - collectionPagePath?: string;
|
|
20
|
-
* - sortParam: SortParam | null = null;
|
|
21
|
-
* - creatorFilter?: string;
|
|
22
|
-
* - mobileBreakpoint?: number;
|
|
23
|
-
* - loggedIn = false;
|
|
24
|
-
* - suppressBlurring = false;
|
|
25
|
-
* - useLocalTime = false;
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
@property({ type: Boolean }) showInfoButton = false;
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
return html`
|
|
32
|
-
<div class="container">
|
|
33
|
-
${this.infoButtonTemplate}
|
|
34
|
-
<div class="tile-details">
|
|
35
|
-
<div class="item-info">
|
|
36
|
-
${this.getAvatarTemplate} ${this.getTitleTemplate}
|
|
37
|
-
${this.getArchivistTemplate}
|
|
38
|
-
</div>
|
|
39
|
-
${this.getTileStatsTemplate}
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
private get getAvatarTemplate(): TemplateResult {
|
|
46
|
-
return html`
|
|
47
|
-
<image-block
|
|
48
|
-
.model=${this.model}
|
|
49
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
50
|
-
.viewSize=${'grid'}
|
|
51
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
52
|
-
>
|
|
53
|
-
</image-block>
|
|
54
|
-
`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
private get getTitleTemplate() {
|
|
58
|
-
return html`<div id="title">
|
|
59
|
-
<h4 class="truncated">${this.model?.identifier}</h4>
|
|
60
|
-
</div>`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private get getArchivistTemplate() {
|
|
64
|
-
return html`<div class="archivist-since">
|
|
65
|
-
<span>${this.displayValueProvider.accountLabel}</span>
|
|
66
|
-
</div>`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private get getTileStatsTemplate() {
|
|
70
|
-
return html`<tile-stats
|
|
71
|
-
.mediatype=${this.model?.mediatype}
|
|
72
|
-
.itemCount=${this.model?.itemCount}
|
|
73
|
-
.favCount=${this.model?.favCount}
|
|
74
|
-
.commentCount=${this.model?.commentCount}
|
|
75
|
-
>
|
|
76
|
-
</tile-stats>`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private get infoButtonTemplate(): TemplateResult | typeof nothing {
|
|
80
|
-
// ⓘ is an information icon
|
|
81
|
-
return this.showInfoButton
|
|
82
|
-
? html`<button class="info-button" @click=${this.infoButtonPressed}>
|
|
83
|
-
ⓘ
|
|
84
|
-
<span class="sr-only">${msg('More info')}</span>
|
|
85
|
-
</button>`
|
|
86
|
-
: nothing;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private infoButtonPressed(e: PointerEvent) {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
const event = new CustomEvent<{ x: number; y: number }>(
|
|
92
|
-
'infoButtonPressed',
|
|
93
|
-
{ detail: { x: e.clientX, y: e.clientY } },
|
|
94
|
-
);
|
|
95
|
-
this.dispatchEvent(event);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* CSS
|
|
100
|
-
*/
|
|
101
|
-
static get styles() {
|
|
102
|
-
const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
|
|
103
|
-
|
|
104
|
-
return [
|
|
105
|
-
baseTileStyles,
|
|
106
|
-
css`
|
|
107
|
-
.container {
|
|
108
|
-
border: 1px solid ${tileBorderColor};
|
|
109
|
-
}
|
|
110
|
-
`,
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
import { css, html, nothing, TemplateResult } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { msg } from '@lit/localize';
|
|
4
|
+
import { BaseTileComponent } from '../base-tile-component';
|
|
5
|
+
|
|
6
|
+
import { baseTileStyles } from './styles/tile-grid-shared-styles';
|
|
7
|
+
import '../image-block';
|
|
8
|
+
import './tile-stats';
|
|
9
|
+
|
|
10
|
+
@customElement('account-tile')
|
|
11
|
+
export class AccountTile extends BaseTileComponent {
|
|
12
|
+
/*
|
|
13
|
+
* Reactive properties inherited from BaseTileComponent:
|
|
14
|
+
* - model?: TileModel;
|
|
15
|
+
* - currentWidth?: number;
|
|
16
|
+
* - currentHeight?: number;
|
|
17
|
+
* - baseNavigationUrl?: string;
|
|
18
|
+
* - baseImageUrl?: string;
|
|
19
|
+
* - collectionPagePath?: string;
|
|
20
|
+
* - sortParam: SortParam | null = null;
|
|
21
|
+
* - creatorFilter?: string;
|
|
22
|
+
* - mobileBreakpoint?: number;
|
|
23
|
+
* - loggedIn = false;
|
|
24
|
+
* - suppressBlurring = false;
|
|
25
|
+
* - useLocalTime = false;
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
@property({ type: Boolean }) showInfoButton = false;
|
|
29
|
+
|
|
30
|
+
render() {
|
|
31
|
+
return html`
|
|
32
|
+
<div class="container">
|
|
33
|
+
${this.infoButtonTemplate}
|
|
34
|
+
<div class="tile-details">
|
|
35
|
+
<div class="item-info">
|
|
36
|
+
${this.getAvatarTemplate} ${this.getTitleTemplate}
|
|
37
|
+
${this.getArchivistTemplate}
|
|
38
|
+
</div>
|
|
39
|
+
${this.getTileStatsTemplate}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private get getAvatarTemplate(): TemplateResult {
|
|
46
|
+
return html`
|
|
47
|
+
<image-block
|
|
48
|
+
.model=${this.model}
|
|
49
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
50
|
+
.viewSize=${'grid'}
|
|
51
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
52
|
+
>
|
|
53
|
+
</image-block>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private get getTitleTemplate() {
|
|
58
|
+
return html`<div id="title">
|
|
59
|
+
<h4 class="truncated">${this.model?.identifier}</h4>
|
|
60
|
+
</div>`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private get getArchivistTemplate() {
|
|
64
|
+
return html`<div class="archivist-since">
|
|
65
|
+
<span>${this.displayValueProvider.accountLabel}</span>
|
|
66
|
+
</div>`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private get getTileStatsTemplate() {
|
|
70
|
+
return html`<tile-stats
|
|
71
|
+
.mediatype=${this.model?.mediatype}
|
|
72
|
+
.itemCount=${this.model?.itemCount}
|
|
73
|
+
.favCount=${this.model?.favCount}
|
|
74
|
+
.commentCount=${this.model?.commentCount}
|
|
75
|
+
>
|
|
76
|
+
</tile-stats>`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private get infoButtonTemplate(): TemplateResult | typeof nothing {
|
|
80
|
+
// ⓘ is an information icon
|
|
81
|
+
return this.showInfoButton
|
|
82
|
+
? html`<button class="info-button" @click=${this.infoButtonPressed}>
|
|
83
|
+
ⓘ
|
|
84
|
+
<span class="sr-only">${msg('More info')}</span>
|
|
85
|
+
</button>`
|
|
86
|
+
: nothing;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private infoButtonPressed(e: PointerEvent) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
const event = new CustomEvent<{ x: number; y: number }>(
|
|
92
|
+
'infoButtonPressed',
|
|
93
|
+
{ detail: { x: e.clientX, y: e.clientY } },
|
|
94
|
+
);
|
|
95
|
+
this.dispatchEvent(event);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* CSS
|
|
100
|
+
*/
|
|
101
|
+
static get styles() {
|
|
102
|
+
const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;
|
|
103
|
+
|
|
104
|
+
return [
|
|
105
|
+
baseTileStyles,
|
|
106
|
+
css`
|
|
107
|
+
.container {
|
|
108
|
+
border: 1px solid ${tileBorderColor};
|
|
109
|
+
}
|
|
110
|
+
`,
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
}
|