@internetarchive/collection-browser 1.8.0 → 1.9.0-alpha1
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/.editorconfig +29 -29
- package/.github/workflows/ci.yml +26 -26
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/app-root.d.ts +54 -54
- package/dist/src/app-root.js +293 -293
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-left.js +2 -2
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-right.js +2 -2
- package/dist/src/assets/img/icons/chevron.d.ts +2 -2
- package/dist/src/assets/img/icons/chevron.js +2 -2
- package/dist/src/assets/img/icons/contract.d.ts +2 -2
- package/dist/src/assets/img/icons/contract.js +2 -2
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.js +2 -2
- package/dist/src/assets/img/icons/expand.d.ts +2 -2
- package/dist/src/assets/img/icons/expand.js +2 -2
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
- package/dist/src/assets/img/icons/eye-closed.js +2 -2
- package/dist/src/assets/img/icons/eye.d.ts +2 -2
- package/dist/src/assets/img/icons/eye.js +2 -2
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +469 -469
- package/dist/src/collection-browser.js +1666 -1653
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +20 -20
- package/dist/src/collection-facets/facets-template.js +152 -152
- package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
- package/dist/src/collection-facets/more-facets-content.js +359 -359
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +196 -196
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
- package/dist/src/collection-facets/toggle-switch.js +94 -94
- package/dist/src/collection-facets.d.ts +99 -99
- package/dist/src/collection-facets.js +471 -471
- package/dist/src/empty-placeholder.d.ts +21 -21
- package/dist/src/empty-placeholder.js +69 -69
- package/dist/src/expanded-date-picker.d.ts +43 -43
- package/dist/src/expanded-date-picker.js +109 -109
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +162 -149
- package/dist/src/models.js +256 -195
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +70 -63
- package/dist/src/restoration-state-handler.js +355 -326
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
- package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.js +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +201 -199
- package/dist/src/sort-filter-bar/sort-filter-bar.js +622 -617
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- package/dist/src/styles/sr-only.d.ts +1 -1
- package/dist/src/styles/sr-only.js +2 -2
- package/dist/src/tiles/base-tile-component.d.ts +18 -18
- package/dist/src/tiles/base-tile-component.js +59 -59
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
- package/dist/src/tiles/grid/account-tile.d.ts +18 -18
- package/dist/src/tiles/grid/account-tile.js +72 -72
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
- package/dist/src/tiles/grid/collection-tile.js +80 -80
- package/dist/src/tiles/grid/item-tile.d.ts +27 -27
- package/dist/src/tiles/grid/item-tile.js +134 -134
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
- package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
- package/dist/src/tiles/grid/tile-stats.js +48 -48
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
- package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +72 -72
- package/dist/src/tiles/item-image.d.ts +35 -35
- package/dist/src/tiles/item-image.js +117 -117
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
- package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
- package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
- package/dist/src/tiles/list/tile-list-compact.js +114 -114
- package/dist/src/tiles/list/tile-list.d.ts +46 -46
- package/dist/src/tiles/list/tile-list.js +298 -298
- package/dist/src/tiles/mediatype-icon.d.ts +9 -9
- package/dist/src/tiles/mediatype-icon.js +47 -47
- package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/icon-overlay.js +40 -40
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/text-overlay.js +42 -42
- package/dist/src/tiles/text-snippet-block.d.ts +27 -27
- package/dist/src/tiles/text-snippet-block.js +73 -73
- package/dist/src/tiles/tile-dispatcher.d.ts +50 -50
- package/dist/src/tiles/tile-dispatcher.js +185 -185
- package/dist/src/tiles/tile-display-value-provider.d.ts +43 -43
- package/dist/src/tiles/tile-display-value-provider.js +80 -80
- package/dist/src/utils/analytics-events.d.ts +24 -24
- package/dist/src/utils/analytics-events.js +26 -26
- package/dist/src/utils/array-equals.d.ts +4 -4
- package/dist/src/utils/array-equals.js +10 -10
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +25 -25
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/src/utils/local-date-from-utc.d.ts +9 -9
- package/dist/src/utils/local-date-from-utc.js +15 -15
- package/dist/src/utils/sha1.d.ts +2 -2
- package/dist/src/utils/sha1.js +8 -8
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +808 -808
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +134 -134
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +133 -133
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
- package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +73 -73
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +645 -645
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +56 -56
- package/dist/test/expanded-date-picker.test.d.ts +1 -1
- package/dist/test/expanded-date-picker.test.js +95 -95
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +84 -84
- package/dist/test/mediatype-config.test.d.ts +1 -1
- package/dist/test/mediatype-config.test.js +16 -16
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
- package/dist/test/mocks/mock-analytics-handler.js +15 -15
- package/dist/test/mocks/mock-collection-name-cache.d.ts +9 -9
- package/dist/test/mocks/mock-collection-name-cache.js +17 -17
- package/dist/test/mocks/mock-search-responses.d.ts +19 -19
- package/dist/test/mocks/mock-search-responses.js +623 -623
- package/dist/test/mocks/mock-search-service.d.ts +15 -15
- package/dist/test/mocks/mock-search-service.js +48 -48
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +270 -218
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +378 -378
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -48
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +33 -33
- package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +76 -76
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +73 -73
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +254 -254
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +242 -242
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +67 -67
- package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
- package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
- package/dist/test/utils/array-equals.test.d.ts +1 -1
- package/dist/test/utils/array-equals.test.js +26 -26
- package/dist/test/utils/format-count.test.d.ts +1 -1
- package/dist/test/utils/format-count.test.js +23 -23
- package/dist/test/utils/format-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/dist/test/utils/format-unit-size.test.d.ts +1 -1
- package/dist/test/utils/format-unit-size.test.js +17 -17
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
- package/dist/test/utils/local-date-from-utc.test.js +26 -26
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +1 -1
- package/renovate.json +6 -6
- package/src/collection-browser.ts +24 -8
- package/src/models.ts +193 -109
- package/src/restoration-state-handler.ts +66 -40
- package/src/sort-filter-bar/sort-filter-bar.ts +34 -27
- package/test/restoration-state-handler.test.ts +68 -1
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, html, css, nothing, } from 'lit';
|
|
3
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
|
-
import '@internetarchive/ia-dropdown';
|
|
5
|
-
import {
|
|
6
|
-
import './alpha-bar';
|
|
7
|
-
import { sortUpIcon } from './img/sort-toggle-up';
|
|
8
|
-
import { sortDownIcon } from './img/sort-toggle-down';
|
|
9
|
-
import { sortDisabledIcon } from './img/sort-toggle-disabled';
|
|
10
|
-
import { tileIcon } from './img/tile';
|
|
11
|
-
import { listIcon } from './img/list';
|
|
12
|
-
import { compactIcon } from './img/compact';
|
|
13
|
-
import { srOnlyStyle } from '../styles/sr-only';
|
|
14
|
-
let SortFilterBar = class SortFilterBar extends LitElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
/** The default sort direction to use if none is set */
|
|
18
|
-
this.defaultSortDirection = null;
|
|
19
|
-
/** The default sort field to use if none is set */
|
|
20
|
-
this.defaultSortField = SortField.relevance;
|
|
21
|
-
/** The current sort direction (asc/desc), or null if none is set */
|
|
22
|
-
this.sortDirection = null;
|
|
23
|
-
/** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */
|
|
24
|
-
this.selectedSort = SortField.default;
|
|
25
|
-
/** The currently selected title letter filter, or null if none is set */
|
|
26
|
-
this.selectedTitleFilter = null;
|
|
27
|
-
/** The currently selected creator letter filter, or null if none is set */
|
|
28
|
-
this.selectedCreatorFilter = null;
|
|
29
|
-
/** Whether to show the Relevance sort option (default `true`) */
|
|
30
|
-
this.showRelevance = true;
|
|
31
|
-
/**
|
|
32
|
-
* Which of the alphabet bars (title/creator) should be shown, or null if one
|
|
33
|
-
* should not currently be rendered.
|
|
34
|
-
*/
|
|
35
|
-
this.alphaSelectorVisible = null;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the transparent backdrop to catch clicks outside the dropdown menu
|
|
38
|
-
* should be rendered.
|
|
39
|
-
*/
|
|
40
|
-
this.dropdownBackdropVisible = false;
|
|
41
|
-
/**
|
|
42
|
-
* The width of the desktop view sort option container, updated upon each resize.
|
|
43
|
-
* Used for dynamically determining whether to use desktop or mobile view.
|
|
44
|
-
*/
|
|
45
|
-
this.desktopSortContainerWidth = 0;
|
|
46
|
-
/**
|
|
47
|
-
* The width of the full sort bar, updated upon each resize.
|
|
48
|
-
* Used for dynamically determining whether to use desktop or mobile view.
|
|
49
|
-
*/
|
|
50
|
-
this.selectorBarContainerWidth = 0;
|
|
51
|
-
this.boundSortBarSelectorEscapeListener = (e) => {
|
|
52
|
-
if (e.key === 'Escape') {
|
|
53
|
-
this.closeDropdowns();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css, nothing, } from 'lit';
|
|
3
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
|
+
import '@internetarchive/ia-dropdown';
|
|
5
|
+
import { SORT_OPTIONS, SortField, } from '../models';
|
|
6
|
+
import './alpha-bar';
|
|
7
|
+
import { sortUpIcon } from './img/sort-toggle-up';
|
|
8
|
+
import { sortDownIcon } from './img/sort-toggle-down';
|
|
9
|
+
import { sortDisabledIcon } from './img/sort-toggle-disabled';
|
|
10
|
+
import { tileIcon } from './img/tile';
|
|
11
|
+
import { listIcon } from './img/list';
|
|
12
|
+
import { compactIcon } from './img/compact';
|
|
13
|
+
import { srOnlyStyle } from '../styles/sr-only';
|
|
14
|
+
let SortFilterBar = class SortFilterBar extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/** The default sort direction to use if none is set */
|
|
18
|
+
this.defaultSortDirection = null;
|
|
19
|
+
/** The default sort field to use if none is set */
|
|
20
|
+
this.defaultSortField = SortField.relevance;
|
|
21
|
+
/** The current sort direction (asc/desc), or null if none is set */
|
|
22
|
+
this.sortDirection = null;
|
|
23
|
+
/** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */
|
|
24
|
+
this.selectedSort = SortField.default;
|
|
25
|
+
/** The currently selected title letter filter, or null if none is set */
|
|
26
|
+
this.selectedTitleFilter = null;
|
|
27
|
+
/** The currently selected creator letter filter, or null if none is set */
|
|
28
|
+
this.selectedCreatorFilter = null;
|
|
29
|
+
/** Whether to show the Relevance sort option (default `true`) */
|
|
30
|
+
this.showRelevance = true;
|
|
31
|
+
/**
|
|
32
|
+
* Which of the alphabet bars (title/creator) should be shown, or null if one
|
|
33
|
+
* should not currently be rendered.
|
|
34
|
+
*/
|
|
35
|
+
this.alphaSelectorVisible = null;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the transparent backdrop to catch clicks outside the dropdown menu
|
|
38
|
+
* should be rendered.
|
|
39
|
+
*/
|
|
40
|
+
this.dropdownBackdropVisible = false;
|
|
41
|
+
/**
|
|
42
|
+
* The width of the desktop view sort option container, updated upon each resize.
|
|
43
|
+
* Used for dynamically determining whether to use desktop or mobile view.
|
|
44
|
+
*/
|
|
45
|
+
this.desktopSortContainerWidth = 0;
|
|
46
|
+
/**
|
|
47
|
+
* The width of the full sort bar, updated upon each resize.
|
|
48
|
+
* Used for dynamically determining whether to use desktop or mobile view.
|
|
49
|
+
*/
|
|
50
|
+
this.selectorBarContainerWidth = 0;
|
|
51
|
+
this.boundSortBarSelectorEscapeListener = (e) => {
|
|
52
|
+
if (e.key === 'Escape') {
|
|
53
|
+
this.closeDropdowns();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
58
|
return html `
|
|
59
59
|
<div id="container">
|
|
60
60
|
<section id="sort-bar" aria-label="Sorting options">
|
|
@@ -74,256 +74,256 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
74
74
|
${this.dropdownBackdropVisible ? this.dropdownBackdrop : nothing}
|
|
75
75
|
${this.alphaBarTemplate}
|
|
76
76
|
</div>
|
|
77
|
-
`;
|
|
78
|
-
}
|
|
79
|
-
updated(changed) {
|
|
80
|
-
if (changed.has('displayMode')) {
|
|
81
|
-
this.displayModeChanged();
|
|
82
|
-
}
|
|
83
|
-
if (changed.has('selectedSort') && this.sortDirection === null) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
updated(changed) {
|
|
80
|
+
if (changed.has('displayMode')) {
|
|
81
|
+
this.displayModeChanged();
|
|
82
|
+
}
|
|
83
|
+
if (changed.has('selectedSort') && this.sortDirection === null) {
|
|
84
|
+
const sortOption = SORT_OPTIONS[this.finalizedSortField];
|
|
85
|
+
this.sortDirection = sortOption.defaultSortDirection;
|
|
86
|
+
}
|
|
87
|
+
if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {
|
|
88
|
+
this.alphaSelectorVisible = 'title';
|
|
89
|
+
}
|
|
90
|
+
if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {
|
|
91
|
+
this.alphaSelectorVisible = 'creator';
|
|
92
|
+
}
|
|
93
|
+
if (changed.has('dropdownBackdropVisible')) {
|
|
94
|
+
this.setupEscapeListeners();
|
|
95
|
+
}
|
|
96
|
+
if (changed.has('resizeObserver')) {
|
|
97
|
+
const oldObserver = changed.get('resizeObserver');
|
|
98
|
+
if (oldObserver)
|
|
99
|
+
this.disconnectResizeObserver(oldObserver);
|
|
100
|
+
this.setupResizeObserver();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
setupEscapeListeners() {
|
|
104
|
+
if (this.dropdownBackdropVisible) {
|
|
105
|
+
document.addEventListener('keydown', this.boundSortBarSelectorEscapeListener);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
document.removeEventListener('keydown', this.boundSortBarSelectorEscapeListener);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
disconnectedCallback() {
|
|
112
|
+
if (this.resizeObserver) {
|
|
113
|
+
this.disconnectResizeObserver(this.resizeObserver);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
disconnectResizeObserver(resizeObserver) {
|
|
117
|
+
resizeObserver.removeObserver({
|
|
118
|
+
target: this.sortSelectorContainer,
|
|
119
|
+
handler: this,
|
|
120
|
+
});
|
|
121
|
+
resizeObserver.removeObserver({
|
|
122
|
+
target: this.desktopSortContainer,
|
|
123
|
+
handler: this,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
setupResizeObserver() {
|
|
127
|
+
if (!this.resizeObserver)
|
|
128
|
+
return;
|
|
129
|
+
this.resizeObserver.addObserver({
|
|
130
|
+
target: this.sortSelectorContainer,
|
|
131
|
+
handler: this,
|
|
132
|
+
});
|
|
133
|
+
this.resizeObserver.addObserver({
|
|
134
|
+
target: this.desktopSortContainer,
|
|
135
|
+
handler: this,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
handleResize(entry) {
|
|
139
|
+
if (entry.target === this.desktopSortContainer) {
|
|
140
|
+
this.desktopSortContainerWidth = entry.contentRect.width;
|
|
141
|
+
}
|
|
142
|
+
else if (entry.target === this.sortSelectorContainer) {
|
|
143
|
+
this.selectorBarContainerWidth = entry.contentRect.width;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Whether to show the mobile sort bar because there is not enough space
|
|
148
|
+
* for the desktop sort bar.
|
|
149
|
+
*/
|
|
150
|
+
get mobileSelectorVisible() {
|
|
151
|
+
return this.selectorBarContainerWidth - 10 < this.desktopSortContainerWidth;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Template to render the alphabet bar, or `nothing` if it should not be rendered
|
|
155
|
+
* for the current sort
|
|
156
|
+
*/
|
|
157
|
+
get alphaBarTemplate() {
|
|
158
|
+
if (!['title', 'creator'].includes(this.selectedSort))
|
|
159
|
+
return nothing;
|
|
160
|
+
if (this.alphaSelectorVisible === null) {
|
|
161
|
+
if (this.selectedSort === 'creator')
|
|
162
|
+
return this.creatorSelectorBar;
|
|
163
|
+
if (this.selectedSort === 'title')
|
|
164
|
+
return this.titleSelectorBar;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return this.alphaSelectorVisible === 'creator'
|
|
168
|
+
? this.creatorSelectorBar
|
|
169
|
+
: this.titleSelectorBar;
|
|
170
|
+
}
|
|
171
|
+
return nothing;
|
|
172
|
+
}
|
|
173
|
+
/** Template to render the sort direction toggle button */
|
|
174
|
+
get sortDirectionSelectorTemplate() {
|
|
175
|
+
const oppositeSortDirectionReadable = this.sortDirection === 'asc' ? 'descending' : 'ascending';
|
|
176
|
+
const srLabel = `Change to ${oppositeSortDirectionReadable} sort`;
|
|
176
177
|
return html `
|
|
177
178
|
<button
|
|
178
179
|
class="sort-direction-selector"
|
|
179
|
-
?disabled=${this.
|
|
180
|
+
?disabled=${!this.canChangeSortDirection}
|
|
180
181
|
@click=${this.handleSortDirectionClicked}
|
|
181
182
|
>
|
|
182
183
|
<span class="sr-only">${srLabel}</span>
|
|
183
184
|
${this.sortDirectionIcon}
|
|
184
185
|
</button>
|
|
185
|
-
`;
|
|
186
|
-
}
|
|
187
|
-
/** Template to render the sort direction button's icon in the correct current state */
|
|
188
|
-
get sortDirectionIcon() {
|
|
189
|
-
//
|
|
190
|
-
if (this.
|
|
191
|
-
return html `<div class="sort-direction-icon">${sortDisabledIcon}</div>`;
|
|
192
|
-
}
|
|
193
|
-
// For all other sorts, show the ascending/descending direction
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
/** Template to render the sort direction button's icon in the correct current state */
|
|
189
|
+
get sortDirectionIcon() {
|
|
190
|
+
// Show a fully disabled icon for sort options without direction support
|
|
191
|
+
if (!this.canChangeSortDirection) {
|
|
192
|
+
return html `<div class="sort-direction-icon">${sortDisabledIcon}</div>`;
|
|
193
|
+
}
|
|
194
|
+
// For all other sorts, show the ascending/descending direction
|
|
194
195
|
return html `
|
|
195
196
|
<div class="sort-direction-icon">
|
|
196
197
|
${this.finalizedSortDirection === 'asc' ? sortUpIcon : sortDownIcon}
|
|
197
198
|
</div>
|
|
198
|
-
`;
|
|
199
|
-
}
|
|
200
|
-
/** The template to render all the sort options in desktop view */
|
|
201
|
-
get desktopSortSelectorTemplate() {
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
/** The template to render all the sort options in desktop view */
|
|
202
|
+
get desktopSortSelectorTemplate() {
|
|
202
203
|
return html `
|
|
203
204
|
<div
|
|
204
205
|
id="desktop-sort-container"
|
|
205
206
|
class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}
|
|
206
207
|
>
|
|
207
208
|
<ul id="desktop-sort-selector">
|
|
208
|
-
${this.showRelevance
|
|
209
|
+
${this.showRelevance
|
|
209
210
|
? html `<li>
|
|
210
|
-
${this.getSortDisplayOption(SortField.relevance, {
|
|
211
|
-
onClick: () => {
|
|
212
|
-
this.dropdownBackdropVisible = false;
|
|
213
|
-
if (this.finalizedSortField !== SortField.relevance) {
|
|
214
|
-
this.clearAlphaBarFilters();
|
|
215
|
-
this.setSelectedSort(SortField.relevance);
|
|
216
|
-
}
|
|
217
|
-
},
|
|
211
|
+
${this.getSortDisplayOption(SortField.relevance, {
|
|
212
|
+
onClick: () => {
|
|
213
|
+
this.dropdownBackdropVisible = false;
|
|
214
|
+
if (this.finalizedSortField !== SortField.relevance) {
|
|
215
|
+
this.clearAlphaBarFilters();
|
|
216
|
+
this.setSelectedSort(SortField.relevance);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
218
219
|
})}
|
|
219
|
-
</li>`
|
|
220
|
+
</li>`
|
|
220
221
|
: nothing}
|
|
221
222
|
<li>${this.viewsDropdownTemplate}</li>
|
|
222
223
|
<li>
|
|
223
|
-
${this.getSortDisplayOption(SortField.title, {
|
|
224
|
-
onClick: () => {
|
|
225
|
-
this.dropdownBackdropVisible = false;
|
|
226
|
-
if (this.finalizedSortField !== SortField.title) {
|
|
227
|
-
this.alphaSelectorVisible = 'title';
|
|
228
|
-
this.selectedCreatorFilter = null;
|
|
229
|
-
this.setSelectedSort(SortField.title);
|
|
230
|
-
this.emitCreatorLetterChangedEvent();
|
|
231
|
-
}
|
|
232
|
-
},
|
|
224
|
+
${this.getSortDisplayOption(SortField.title, {
|
|
225
|
+
onClick: () => {
|
|
226
|
+
this.dropdownBackdropVisible = false;
|
|
227
|
+
if (this.finalizedSortField !== SortField.title) {
|
|
228
|
+
this.alphaSelectorVisible = 'title';
|
|
229
|
+
this.selectedCreatorFilter = null;
|
|
230
|
+
this.setSelectedSort(SortField.title);
|
|
231
|
+
this.emitCreatorLetterChangedEvent();
|
|
232
|
+
}
|
|
233
|
+
},
|
|
233
234
|
})}
|
|
234
235
|
</li>
|
|
235
236
|
<li>${this.dateDropdownTemplate}</li>
|
|
236
237
|
<li>
|
|
237
|
-
${this.getSortDisplayOption(SortField.creator, {
|
|
238
|
-
onClick: () => {
|
|
239
|
-
this.dropdownBackdropVisible = false;
|
|
240
|
-
if (this.finalizedSortField !== SortField.creator) {
|
|
241
|
-
this.alphaSelectorVisible = 'creator';
|
|
242
|
-
this.selectedTitleFilter = null;
|
|
243
|
-
this.setSelectedSort(SortField.creator);
|
|
244
|
-
this.emitTitleLetterChangedEvent();
|
|
245
|
-
}
|
|
246
|
-
},
|
|
238
|
+
${this.getSortDisplayOption(SortField.creator, {
|
|
239
|
+
onClick: () => {
|
|
240
|
+
this.dropdownBackdropVisible = false;
|
|
241
|
+
if (this.finalizedSortField !== SortField.creator) {
|
|
242
|
+
this.alphaSelectorVisible = 'creator';
|
|
243
|
+
this.selectedTitleFilter = null;
|
|
244
|
+
this.setSelectedSort(SortField.creator);
|
|
245
|
+
this.emitTitleLetterChangedEvent();
|
|
246
|
+
}
|
|
247
|
+
},
|
|
247
248
|
})}
|
|
248
249
|
</li>
|
|
249
250
|
</ul>
|
|
250
251
|
</div>
|
|
251
|
-
`;
|
|
252
|
-
}
|
|
253
|
-
/** The template to render all the sort options in mobile view */
|
|
254
|
-
get mobileSortSelectorTemplate() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
(field !== SortField.relevance
|
|
252
|
+
`;
|
|
253
|
+
}
|
|
254
|
+
/** The template to render all the sort options in mobile view */
|
|
255
|
+
get mobileSortSelectorTemplate() {
|
|
256
|
+
const displayedOptions = Object.values(SORT_OPTIONS)
|
|
257
|
+
.filter(opt => opt.shownInSortBar)
|
|
258
|
+
.filter(opt => this.showRelevance || opt.field !== SortField.relevance);
|
|
258
259
|
return html `
|
|
259
260
|
<div
|
|
260
261
|
id="mobile-sort-container"
|
|
261
262
|
class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}
|
|
262
263
|
>
|
|
263
|
-
${this.getSortDropdown({
|
|
264
|
-
displayName: html `${
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.
|
|
274
|
-
|
|
275
|
-
},
|
|
264
|
+
${this.getSortDropdown({
|
|
265
|
+
displayName: html `${SORT_OPTIONS[this.finalizedSortField]
|
|
266
|
+
.displayName}`,
|
|
267
|
+
id: 'mobile-dropdown',
|
|
268
|
+
selected: true,
|
|
269
|
+
dropdownOptions: displayedOptions.map(opt => this.getDropdownOption(opt.field)),
|
|
270
|
+
selectedOption: this.finalizedSortField,
|
|
271
|
+
onOptionSelected: this.mobileSortChanged,
|
|
272
|
+
onDropdownClick: () => {
|
|
273
|
+
this.dropdownBackdropVisible = this.mobileDropdown.open;
|
|
274
|
+
this.mobileDropdown.classList.toggle('open', this.mobileDropdown.open);
|
|
275
|
+
},
|
|
276
276
|
})}
|
|
277
277
|
</div>
|
|
278
|
-
`;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* This generates each of the non-dropdown sort option links.
|
|
282
|
-
*
|
|
283
|
-
* It manages the display value and the selected state of the option.
|
|
284
|
-
*
|
|
285
|
-
* @param sortField
|
|
286
|
-
* @param options {
|
|
287
|
-
* onClick?: (e: Event) => void; If this is provided, it will also be called when the option is clicked.
|
|
288
|
-
* displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.
|
|
289
|
-
* selected?: boolean; true if the option is selected. Defaults to the selectedSort === sortField.
|
|
290
|
-
* }
|
|
291
|
-
* @returns
|
|
292
|
-
*/
|
|
293
|
-
getSortDisplayOption(sortField, options) {
|
|
294
|
-
var _a, _b;
|
|
295
|
-
const isSelected = (_a = options === null || options === void 0 ? void 0 : options.selected) !== null && _a !== void 0 ? _a : this.finalizedSortField === sortField;
|
|
296
|
-
const displayName = (_b = options === null || options === void 0 ? void 0 : options.displayName) !== null && _b !== void 0 ? _b :
|
|
278
|
+
`;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* This generates each of the non-dropdown sort option links.
|
|
282
|
+
*
|
|
283
|
+
* It manages the display value and the selected state of the option.
|
|
284
|
+
*
|
|
285
|
+
* @param sortField
|
|
286
|
+
* @param options {
|
|
287
|
+
* onClick?: (e: Event) => void; If this is provided, it will also be called when the option is clicked.
|
|
288
|
+
* displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.
|
|
289
|
+
* selected?: boolean; true if the option is selected. Defaults to the selectedSort === sortField.
|
|
290
|
+
* }
|
|
291
|
+
* @returns
|
|
292
|
+
*/
|
|
293
|
+
getSortDisplayOption(sortField, options) {
|
|
294
|
+
var _a, _b;
|
|
295
|
+
const isSelected = (_a = options === null || options === void 0 ? void 0 : options.selected) !== null && _a !== void 0 ? _a : this.finalizedSortField === sortField;
|
|
296
|
+
const displayName = (_b = options === null || options === void 0 ? void 0 : options.displayName) !== null && _b !== void 0 ? _b : SORT_OPTIONS[sortField].displayName;
|
|
297
297
|
return html `
|
|
298
298
|
<button
|
|
299
299
|
class=${isSelected ? 'selected' : nothing}
|
|
300
300
|
data-title="${displayName}"
|
|
301
|
-
@click=${(e) => {
|
|
302
|
-
var _a;
|
|
303
|
-
e.preventDefault();
|
|
304
|
-
(_a = options === null || options === void 0 ? void 0 : options.onClick) === null || _a === void 0 ? void 0 : _a.call(options, e);
|
|
301
|
+
@click=${(e) => {
|
|
302
|
+
var _a;
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
(_a = options === null || options === void 0 ? void 0 : options.onClick) === null || _a === void 0 ? void 0 : _a.call(options, e);
|
|
305
305
|
}}
|
|
306
306
|
>
|
|
307
307
|
${displayName}
|
|
308
308
|
</button>
|
|
309
|
-
`;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Generates a dropdown component containing multiple grouped sort options.
|
|
313
|
-
*
|
|
314
|
-
* @param options.displayName The name to use for the dropdown's visible label
|
|
315
|
-
* @param options.id The id to apply to the dropdown element
|
|
316
|
-
* @param options.dropdownOptions An array of option objects used to populate the dropdown
|
|
317
|
-
* @param options.selectedOption The id of the option that should be initially selected
|
|
318
|
-
* @param options.selected A boolean indicating whether this dropdown should use its
|
|
319
|
-
* selected appearance
|
|
320
|
-
* @param options.onOptionSelected A handler for optionSelected events coming from the dropdown
|
|
321
|
-
* @param options.onDropdownClick A handler for click events on the dropdown
|
|
322
|
-
* @param options.onLabelInteraction A handler for click events and Enter/Space keydown events
|
|
323
|
-
* on the dropdown's label
|
|
324
|
-
*/
|
|
325
|
-
getSortDropdown(options) {
|
|
326
|
-
var _a, _b, _c, _d, _e;
|
|
309
|
+
`;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Generates a dropdown component containing multiple grouped sort options.
|
|
313
|
+
*
|
|
314
|
+
* @param options.displayName The name to use for the dropdown's visible label
|
|
315
|
+
* @param options.id The id to apply to the dropdown element
|
|
316
|
+
* @param options.dropdownOptions An array of option objects used to populate the dropdown
|
|
317
|
+
* @param options.selectedOption The id of the option that should be initially selected
|
|
318
|
+
* @param options.selected A boolean indicating whether this dropdown should use its
|
|
319
|
+
* selected appearance
|
|
320
|
+
* @param options.onOptionSelected A handler for optionSelected events coming from the dropdown
|
|
321
|
+
* @param options.onDropdownClick A handler for click events on the dropdown
|
|
322
|
+
* @param options.onLabelInteraction A handler for click events and Enter/Space keydown events
|
|
323
|
+
* on the dropdown's label
|
|
324
|
+
*/
|
|
325
|
+
getSortDropdown(options) {
|
|
326
|
+
var _a, _b, _c, _d, _e;
|
|
327
327
|
return html `
|
|
328
328
|
<ia-dropdown
|
|
329
329
|
id=${(_a = options.id) !== null && _a !== void 0 ? _a : nothing}
|
|
@@ -342,118 +342,118 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
342
342
|
slot="dropdown-label"
|
|
343
343
|
data-title="${options.displayName.values}"
|
|
344
344
|
@click=${(_e = options.onLabelInteraction) !== null && _e !== void 0 ? _e : nothing}
|
|
345
|
-
@keydown=${options.onLabelInteraction
|
|
346
|
-
? (e) => {
|
|
347
|
-
var _a;
|
|
348
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
349
|
-
(_a = options.onLabelInteraction) === null || _a === void 0 ? void 0 : _a.call(options, e);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
345
|
+
@keydown=${options.onLabelInteraction
|
|
346
|
+
? (e) => {
|
|
347
|
+
var _a;
|
|
348
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
349
|
+
(_a = options.onLabelInteraction) === null || _a === void 0 ? void 0 : _a.call(options, e);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
352
|
: nothing}
|
|
353
353
|
>
|
|
354
354
|
${options.displayName}
|
|
355
355
|
</span>
|
|
356
356
|
</ia-dropdown>
|
|
357
|
-
`;
|
|
358
|
-
}
|
|
359
|
-
/** Generates a single dropdown option object for the given sort field */
|
|
360
|
-
getDropdownOption(sortField) {
|
|
361
|
-
return {
|
|
362
|
-
id: sortField,
|
|
363
|
-
selectedHandler: () => {
|
|
364
|
-
this.selectDropdownSortField(sortField);
|
|
365
|
-
},
|
|
357
|
+
`;
|
|
358
|
+
}
|
|
359
|
+
/** Generates a single dropdown option object for the given sort field */
|
|
360
|
+
getDropdownOption(sortField) {
|
|
361
|
+
return {
|
|
362
|
+
id: sortField,
|
|
363
|
+
selectedHandler: () => {
|
|
364
|
+
this.selectDropdownSortField(sortField);
|
|
365
|
+
},
|
|
366
366
|
label: html `
|
|
367
367
|
<span class="dropdown-option-label">
|
|
368
|
-
${
|
|
368
|
+
${SORT_OPTIONS[sortField].displayName}
|
|
369
369
|
</span>
|
|
370
|
-
`,
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
/** Handler for when any sort dropdown option is selected */
|
|
374
|
-
dropdownOptionSelected(e) {
|
|
375
|
-
this.dropdownBackdropVisible = false;
|
|
376
|
-
this.clearAlphaBarFilters();
|
|
377
|
-
this.setSelectedSort(e.detail.option.id);
|
|
378
|
-
}
|
|
379
|
-
/** The template to render for the views dropdown */
|
|
380
|
-
get viewsDropdownTemplate() {
|
|
381
|
-
return this.getSortDropdown({
|
|
382
|
-
displayName: html `${this.viewSortField}`,
|
|
383
|
-
id: 'views-dropdown',
|
|
384
|
-
selected: this.viewOptionSelected,
|
|
385
|
-
dropdownOptions: [
|
|
386
|
-
this.getDropdownOption(SortField.weeklyview),
|
|
387
|
-
this.getDropdownOption(SortField.alltimeview),
|
|
388
|
-
],
|
|
389
|
-
selectedOption: this.viewOptionSelected ? this.selectedSort : '',
|
|
390
|
-
onOptionSelected: this.dropdownOptionSelected,
|
|
391
|
-
onDropdownClick: () => {
|
|
392
|
-
this.dateDropdown.open = false;
|
|
393
|
-
this.dropdownBackdropVisible = this.viewsDropdown.open;
|
|
394
|
-
this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);
|
|
395
|
-
},
|
|
396
|
-
onLabelInteraction: (e) => {
|
|
397
|
-
if (!this.viewsDropdown.open && !this.viewOptionSelected) {
|
|
398
|
-
e.stopPropagation();
|
|
399
|
-
this.clearAlphaBarFilters();
|
|
400
|
-
this.setSelectedSort(SortField.weeklyview);
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
/** The template to render for the date dropdown */
|
|
406
|
-
get dateDropdownTemplate() {
|
|
407
|
-
return this.getSortDropdown({
|
|
408
|
-
displayName: html `${this.dateSortField}`,
|
|
409
|
-
id: 'date-dropdown',
|
|
410
|
-
selected: this.dateOptionSelected,
|
|
411
|
-
dropdownOptions: [
|
|
412
|
-
this.getDropdownOption(SortField.date),
|
|
413
|
-
this.getDropdownOption(SortField.datearchived),
|
|
414
|
-
this.getDropdownOption(SortField.datereviewed),
|
|
415
|
-
this.getDropdownOption(SortField.dateadded),
|
|
416
|
-
],
|
|
417
|
-
selectedOption: this.dateOptionSelected ? this.selectedSort : '',
|
|
418
|
-
onOptionSelected: this.dropdownOptionSelected,
|
|
419
|
-
onDropdownClick: () => {
|
|
420
|
-
this.viewsDropdown.open = false;
|
|
421
|
-
this.dropdownBackdropVisible = this.dateDropdown.open;
|
|
422
|
-
this.dateDropdown.classList.toggle('open', this.dateDropdown.open);
|
|
423
|
-
},
|
|
424
|
-
onLabelInteraction: (e) => {
|
|
425
|
-
if (!this.dateDropdown.open && !this.dateOptionSelected) {
|
|
426
|
-
e.stopPropagation();
|
|
427
|
-
this.clearAlphaBarFilters();
|
|
428
|
-
this.setSelectedSort(SortField.date);
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
/** Handler for when a new mobile sort dropdown option is selected */
|
|
434
|
-
mobileSortChanged(e) {
|
|
435
|
-
this.dropdownBackdropVisible = false;
|
|
436
|
-
const sortField = e.detail.option.id;
|
|
437
|
-
this.setSelectedSort(sortField);
|
|
438
|
-
this.alphaSelectorVisible = null;
|
|
439
|
-
if (sortField !== 'title' && this.selectedTitleFilter) {
|
|
440
|
-
this.selectedTitleFilter = null;
|
|
441
|
-
this.emitTitleLetterChangedEvent();
|
|
442
|
-
}
|
|
443
|
-
if (sortField !== 'creator' && this.selectedCreatorFilter) {
|
|
444
|
-
this.selectedCreatorFilter = null;
|
|
445
|
-
this.emitCreatorLetterChangedEvent();
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
/** Template for rendering the three display mode options */
|
|
449
|
-
get displayOptionTemplate() {
|
|
370
|
+
`,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/** Handler for when any sort dropdown option is selected */
|
|
374
|
+
dropdownOptionSelected(e) {
|
|
375
|
+
this.dropdownBackdropVisible = false;
|
|
376
|
+
this.clearAlphaBarFilters();
|
|
377
|
+
this.setSelectedSort(e.detail.option.id);
|
|
378
|
+
}
|
|
379
|
+
/** The template to render for the views dropdown */
|
|
380
|
+
get viewsDropdownTemplate() {
|
|
381
|
+
return this.getSortDropdown({
|
|
382
|
+
displayName: html `${this.viewSortField}`,
|
|
383
|
+
id: 'views-dropdown',
|
|
384
|
+
selected: this.viewOptionSelected,
|
|
385
|
+
dropdownOptions: [
|
|
386
|
+
this.getDropdownOption(SortField.weeklyview),
|
|
387
|
+
this.getDropdownOption(SortField.alltimeview),
|
|
388
|
+
],
|
|
389
|
+
selectedOption: this.viewOptionSelected ? this.selectedSort : '',
|
|
390
|
+
onOptionSelected: this.dropdownOptionSelected,
|
|
391
|
+
onDropdownClick: () => {
|
|
392
|
+
this.dateDropdown.open = false;
|
|
393
|
+
this.dropdownBackdropVisible = this.viewsDropdown.open;
|
|
394
|
+
this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);
|
|
395
|
+
},
|
|
396
|
+
onLabelInteraction: (e) => {
|
|
397
|
+
if (!this.viewsDropdown.open && !this.viewOptionSelected) {
|
|
398
|
+
e.stopPropagation();
|
|
399
|
+
this.clearAlphaBarFilters();
|
|
400
|
+
this.setSelectedSort(SortField.weeklyview);
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
/** The template to render for the date dropdown */
|
|
406
|
+
get dateDropdownTemplate() {
|
|
407
|
+
return this.getSortDropdown({
|
|
408
|
+
displayName: html `${this.dateSortField}`,
|
|
409
|
+
id: 'date-dropdown',
|
|
410
|
+
selected: this.dateOptionSelected,
|
|
411
|
+
dropdownOptions: [
|
|
412
|
+
this.getDropdownOption(SortField.date),
|
|
413
|
+
this.getDropdownOption(SortField.datearchived),
|
|
414
|
+
this.getDropdownOption(SortField.datereviewed),
|
|
415
|
+
this.getDropdownOption(SortField.dateadded),
|
|
416
|
+
],
|
|
417
|
+
selectedOption: this.dateOptionSelected ? this.selectedSort : '',
|
|
418
|
+
onOptionSelected: this.dropdownOptionSelected,
|
|
419
|
+
onDropdownClick: () => {
|
|
420
|
+
this.viewsDropdown.open = false;
|
|
421
|
+
this.dropdownBackdropVisible = this.dateDropdown.open;
|
|
422
|
+
this.dateDropdown.classList.toggle('open', this.dateDropdown.open);
|
|
423
|
+
},
|
|
424
|
+
onLabelInteraction: (e) => {
|
|
425
|
+
if (!this.dateDropdown.open && !this.dateOptionSelected) {
|
|
426
|
+
e.stopPropagation();
|
|
427
|
+
this.clearAlphaBarFilters();
|
|
428
|
+
this.setSelectedSort(SortField.date);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/** Handler for when a new mobile sort dropdown option is selected */
|
|
434
|
+
mobileSortChanged(e) {
|
|
435
|
+
this.dropdownBackdropVisible = false;
|
|
436
|
+
const sortField = e.detail.option.id;
|
|
437
|
+
this.setSelectedSort(sortField);
|
|
438
|
+
this.alphaSelectorVisible = null;
|
|
439
|
+
if (sortField !== 'title' && this.selectedTitleFilter) {
|
|
440
|
+
this.selectedTitleFilter = null;
|
|
441
|
+
this.emitTitleLetterChangedEvent();
|
|
442
|
+
}
|
|
443
|
+
if (sortField !== 'creator' && this.selectedCreatorFilter) {
|
|
444
|
+
this.selectedCreatorFilter = null;
|
|
445
|
+
this.emitCreatorLetterChangedEvent();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/** Template for rendering the three display mode options */
|
|
449
|
+
get displayOptionTemplate() {
|
|
450
450
|
return html `
|
|
451
451
|
<ul>
|
|
452
452
|
<li>
|
|
453
453
|
<button
|
|
454
454
|
id="grid-button"
|
|
455
|
-
@click=${() => {
|
|
456
|
-
this.displayMode = 'grid';
|
|
455
|
+
@click=${() => {
|
|
456
|
+
this.displayMode = 'grid';
|
|
457
457
|
}}
|
|
458
458
|
class=${this.displayMode === 'grid' ? 'active' : ''}
|
|
459
459
|
title="Tile view"
|
|
@@ -464,8 +464,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
464
464
|
<li>
|
|
465
465
|
<button
|
|
466
466
|
id="list-detail-button"
|
|
467
|
-
@click=${() => {
|
|
468
|
-
this.displayMode = 'list-detail';
|
|
467
|
+
@click=${() => {
|
|
468
|
+
this.displayMode = 'list-detail';
|
|
469
469
|
}}
|
|
470
470
|
class=${this.displayMode === 'list-detail' ? 'active' : ''}
|
|
471
471
|
title="List view"
|
|
@@ -476,8 +476,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
476
476
|
<li>
|
|
477
477
|
<button
|
|
478
478
|
id="list-compact-button"
|
|
479
|
-
@click=${() => {
|
|
480
|
-
this.displayMode = 'list-compact';
|
|
479
|
+
@click=${() => {
|
|
480
|
+
this.displayMode = 'list-compact';
|
|
481
481
|
}}
|
|
482
482
|
class=${this.displayMode === 'list-compact' ? 'active' : ''}
|
|
483
483
|
title="Compact list view"
|
|
@@ -486,210 +486,215 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
486
486
|
</button>
|
|
487
487
|
</li>
|
|
488
488
|
</ul>
|
|
489
|
-
`;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Template for rendering the transparent backdrop to capture clicks outside the
|
|
493
|
-
* dropdown menu while it is open.
|
|
494
|
-
*/
|
|
495
|
-
get dropdownBackdrop() {
|
|
489
|
+
`;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Template for rendering the transparent backdrop to capture clicks outside the
|
|
493
|
+
* dropdown menu while it is open.
|
|
494
|
+
*/
|
|
495
|
+
get dropdownBackdrop() {
|
|
496
496
|
return html `
|
|
497
497
|
<div
|
|
498
498
|
id="sort-selector-backdrop"
|
|
499
499
|
@keyup=${this.closeDropdowns}
|
|
500
500
|
@click=${this.closeDropdowns}
|
|
501
501
|
></div>
|
|
502
|
-
`;
|
|
503
|
-
}
|
|
504
|
-
/** Closes all of the sorting dropdown components' menus */
|
|
505
|
-
closeDropdowns() {
|
|
506
|
-
this.dropdownBackdropVisible = false;
|
|
507
|
-
const allDropdowns = [
|
|
508
|
-
this.viewsDropdown,
|
|
509
|
-
this.dateDropdown,
|
|
510
|
-
this.mobileDropdown,
|
|
511
|
-
];
|
|
512
|
-
for (const dropdown of allDropdowns) {
|
|
513
|
-
dropdown.open = false;
|
|
514
|
-
dropdown.classList.remove('open');
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
selectDropdownSortField(sortField) {
|
|
518
|
-
// When a dropdown sort option is selected, we additionally need to clear the backdrop
|
|
519
|
-
this.dropdownBackdropVisible = false;
|
|
520
|
-
this.setSelectedSort(sortField);
|
|
521
|
-
}
|
|
522
|
-
clearAlphaBarFilters() {
|
|
523
|
-
this.alphaSelectorVisible = null;
|
|
524
|
-
this.selectedTitleFilter = null;
|
|
525
|
-
this.selectedCreatorFilter = null;
|
|
526
|
-
this.emitTitleLetterChangedEvent();
|
|
527
|
-
this.emitCreatorLetterChangedEvent();
|
|
528
|
-
}
|
|
529
|
-
setSortDirection(sortDirection) {
|
|
530
|
-
this.sortDirection = sortDirection;
|
|
531
|
-
this.emitSortChangedEvent();
|
|
532
|
-
}
|
|
533
|
-
/** Toggles the current sort direction between 'asc' and 'desc' */
|
|
534
|
-
toggleSortDirection() {
|
|
535
|
-
this.setSortDirection(this.finalizedSortDirection === 'desc' ? 'asc' : 'desc');
|
|
536
|
-
}
|
|
537
|
-
handleSortDirectionClicked() {
|
|
538
|
-
if (!this.sortDirection &&
|
|
539
|
-
this.defaultSortField &&
|
|
540
|
-
this.defaultSortDirection) {
|
|
541
|
-
// When the sort direction is merely defaulted (not set by the user), clicking
|
|
542
|
-
// the toggled button should "promote" the default sort to an explicitly-set one
|
|
543
|
-
// and then toggle it as usual.
|
|
544
|
-
this.selectedSort = this.defaultSortField;
|
|
545
|
-
this.sortDirection = this.defaultSortDirection;
|
|
546
|
-
}
|
|
547
|
-
this.toggleSortDirection();
|
|
548
|
-
}
|
|
549
|
-
setSelectedSort(sort) {
|
|
550
|
-
this.selectedSort = sort;
|
|
551
|
-
// Apply this field's default sort direction
|
|
552
|
-
|
|
553
|
-
this.
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
*
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
*
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
502
|
+
`;
|
|
503
|
+
}
|
|
504
|
+
/** Closes all of the sorting dropdown components' menus */
|
|
505
|
+
closeDropdowns() {
|
|
506
|
+
this.dropdownBackdropVisible = false;
|
|
507
|
+
const allDropdowns = [
|
|
508
|
+
this.viewsDropdown,
|
|
509
|
+
this.dateDropdown,
|
|
510
|
+
this.mobileDropdown,
|
|
511
|
+
];
|
|
512
|
+
for (const dropdown of allDropdowns) {
|
|
513
|
+
dropdown.open = false;
|
|
514
|
+
dropdown.classList.remove('open');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
selectDropdownSortField(sortField) {
|
|
518
|
+
// When a dropdown sort option is selected, we additionally need to clear the backdrop
|
|
519
|
+
this.dropdownBackdropVisible = false;
|
|
520
|
+
this.setSelectedSort(sortField);
|
|
521
|
+
}
|
|
522
|
+
clearAlphaBarFilters() {
|
|
523
|
+
this.alphaSelectorVisible = null;
|
|
524
|
+
this.selectedTitleFilter = null;
|
|
525
|
+
this.selectedCreatorFilter = null;
|
|
526
|
+
this.emitTitleLetterChangedEvent();
|
|
527
|
+
this.emitCreatorLetterChangedEvent();
|
|
528
|
+
}
|
|
529
|
+
setSortDirection(sortDirection) {
|
|
530
|
+
this.sortDirection = sortDirection;
|
|
531
|
+
this.emitSortChangedEvent();
|
|
532
|
+
}
|
|
533
|
+
/** Toggles the current sort direction between 'asc' and 'desc' */
|
|
534
|
+
toggleSortDirection() {
|
|
535
|
+
this.setSortDirection(this.finalizedSortDirection === 'desc' ? 'asc' : 'desc');
|
|
536
|
+
}
|
|
537
|
+
handleSortDirectionClicked() {
|
|
538
|
+
if (!this.sortDirection &&
|
|
539
|
+
this.defaultSortField &&
|
|
540
|
+
this.defaultSortDirection) {
|
|
541
|
+
// When the sort direction is merely defaulted (not set by the user), clicking
|
|
542
|
+
// the toggled button should "promote" the default sort to an explicitly-set one
|
|
543
|
+
// and then toggle it as usual.
|
|
544
|
+
this.selectedSort = this.defaultSortField;
|
|
545
|
+
this.sortDirection = this.defaultSortDirection;
|
|
546
|
+
}
|
|
547
|
+
this.toggleSortDirection();
|
|
548
|
+
}
|
|
549
|
+
setSelectedSort(sort) {
|
|
550
|
+
this.selectedSort = sort;
|
|
551
|
+
// Apply this field's default sort direction
|
|
552
|
+
const sortOption = SORT_OPTIONS[sort];
|
|
553
|
+
this.sortDirection = sortOption.defaultSortDirection;
|
|
554
|
+
this.emitSortChangedEvent();
|
|
555
|
+
}
|
|
556
|
+
/** The current sort field, or the default one if no explicit sort is set */
|
|
557
|
+
get finalizedSortField() {
|
|
558
|
+
return this.selectedSort === SortField.default
|
|
559
|
+
? this.defaultSortField
|
|
560
|
+
: this.selectedSort;
|
|
561
|
+
}
|
|
562
|
+
/** The current sort direction, or the default one if no explicit direction is set */
|
|
563
|
+
get finalizedSortDirection() {
|
|
564
|
+
return this.sortDirection === null
|
|
565
|
+
? this.defaultSortDirection
|
|
566
|
+
: this.sortDirection;
|
|
567
|
+
}
|
|
568
|
+
/** Whether the sort direction button should be enabled for the current sort */
|
|
569
|
+
get canChangeSortDirection() {
|
|
570
|
+
return SORT_OPTIONS[this.finalizedSortField].canSetDirection;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* There are four date sort options.
|
|
574
|
+
*
|
|
575
|
+
* This checks to see if the current sort is one of them.
|
|
576
|
+
*
|
|
577
|
+
* @readonly
|
|
578
|
+
* @private
|
|
579
|
+
* @type {boolean}
|
|
580
|
+
* @memberof SortFilterBar
|
|
581
|
+
*/
|
|
582
|
+
get dateOptionSelected() {
|
|
583
|
+
const dateSortFields = [
|
|
584
|
+
SortField.datearchived,
|
|
585
|
+
SortField.date,
|
|
586
|
+
SortField.datereviewed,
|
|
587
|
+
SortField.dateadded,
|
|
588
|
+
];
|
|
589
|
+
return dateSortFields.includes(this.finalizedSortField);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* There are two view sort options.
|
|
593
|
+
*
|
|
594
|
+
* This checks to see if the current sort is one of them.
|
|
595
|
+
*
|
|
596
|
+
* @readonly
|
|
597
|
+
* @private
|
|
598
|
+
* @type {boolean}
|
|
599
|
+
* @memberof SortFilterBar
|
|
600
|
+
*/
|
|
601
|
+
get viewOptionSelected() {
|
|
602
|
+
const viewSortFields = [
|
|
603
|
+
SortField.alltimeview,
|
|
604
|
+
SortField.weeklyview,
|
|
605
|
+
];
|
|
606
|
+
return viewSortFields.includes(this.finalizedSortField);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* The display name of the current date field
|
|
610
|
+
*
|
|
611
|
+
* @readonly
|
|
612
|
+
* @private
|
|
613
|
+
* @type {string}
|
|
614
|
+
* @memberof SortFilterBar
|
|
615
|
+
*/
|
|
616
|
+
get dateSortField() {
|
|
617
|
+
var _a;
|
|
618
|
+
const defaultDateSort = SORT_OPTIONS[SortField.date];
|
|
619
|
+
const currentDateSort = this.dateOptionSelected
|
|
620
|
+
? (_a = SORT_OPTIONS[this.finalizedSortField]) !== null && _a !== void 0 ? _a : defaultDateSort
|
|
621
|
+
: defaultDateSort;
|
|
622
|
+
return currentDateSort.displayName;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* The display name of the current view field
|
|
626
|
+
*
|
|
627
|
+
* @readonly
|
|
628
|
+
* @private
|
|
629
|
+
* @type {string}
|
|
630
|
+
* @memberof SortFilterBar
|
|
631
|
+
*/
|
|
632
|
+
get viewSortField() {
|
|
633
|
+
var _a;
|
|
634
|
+
const defaultViewSort = SORT_OPTIONS[SortField.weeklyview];
|
|
635
|
+
const currentViewSort = this.viewOptionSelected
|
|
636
|
+
? (_a = SORT_OPTIONS[this.finalizedSortField]) !== null && _a !== void 0 ? _a : defaultViewSort
|
|
637
|
+
: defaultViewSort;
|
|
638
|
+
return currentViewSort.displayName;
|
|
639
|
+
}
|
|
640
|
+
get titleSelectorBar() {
|
|
641
|
+
var _a;
|
|
637
642
|
return html ` <alpha-bar
|
|
638
643
|
.selectedLetter=${this.selectedTitleFilter}
|
|
639
644
|
.letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.title}
|
|
640
645
|
ariaLandmarkLabel="Filter by title letter"
|
|
641
646
|
@letterChanged=${this.titleLetterChanged}
|
|
642
|
-
></alpha-bar>`;
|
|
643
|
-
}
|
|
644
|
-
get creatorSelectorBar() {
|
|
645
|
-
var _a;
|
|
647
|
+
></alpha-bar>`;
|
|
648
|
+
}
|
|
649
|
+
get creatorSelectorBar() {
|
|
650
|
+
var _a;
|
|
646
651
|
return html ` <alpha-bar
|
|
647
652
|
.selectedLetter=${this.selectedCreatorFilter}
|
|
648
653
|
.letterCounts=${(_a = this.prefixFilterCountMap) === null || _a === void 0 ? void 0 : _a.creator}
|
|
649
654
|
ariaLandmarkLabel="Filter by creator letter"
|
|
650
655
|
@letterChanged=${this.creatorLetterChanged}
|
|
651
|
-
></alpha-bar>`;
|
|
652
|
-
}
|
|
653
|
-
titleLetterChanged(e) {
|
|
654
|
-
var _a;
|
|
655
|
-
this.selectedTitleFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
|
|
656
|
-
this.emitTitleLetterChangedEvent();
|
|
657
|
-
}
|
|
658
|
-
creatorLetterChanged(e) {
|
|
659
|
-
var _a;
|
|
660
|
-
this.selectedCreatorFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
|
|
661
|
-
this.emitCreatorLetterChangedEvent();
|
|
662
|
-
}
|
|
663
|
-
emitTitleLetterChangedEvent() {
|
|
664
|
-
const event = new CustomEvent('titleLetterChanged', {
|
|
665
|
-
detail: { selectedLetter: this.selectedTitleFilter },
|
|
666
|
-
});
|
|
667
|
-
this.dispatchEvent(event);
|
|
668
|
-
}
|
|
669
|
-
emitCreatorLetterChangedEvent() {
|
|
670
|
-
const event = new CustomEvent('creatorLetterChanged', {
|
|
671
|
-
detail: { selectedLetter: this.selectedCreatorFilter },
|
|
672
|
-
});
|
|
673
|
-
this.dispatchEvent(event);
|
|
674
|
-
}
|
|
675
|
-
displayModeChanged() {
|
|
676
|
-
const event = new CustomEvent('displayModeChanged', {
|
|
677
|
-
detail: { displayMode: this.displayMode },
|
|
678
|
-
});
|
|
679
|
-
this.dispatchEvent(event);
|
|
680
|
-
}
|
|
681
|
-
emitSortChangedEvent() {
|
|
682
|
-
const event = new CustomEvent('sortChanged', {
|
|
683
|
-
detail: {
|
|
684
|
-
selectedSort: this.selectedSort,
|
|
685
|
-
sortDirection: this.sortDirection,
|
|
686
|
-
},
|
|
687
|
-
});
|
|
688
|
-
this.dispatchEvent(event);
|
|
689
|
-
}
|
|
690
|
-
static get styles() {
|
|
691
|
-
return [
|
|
692
|
-
srOnlyStyle,
|
|
656
|
+
></alpha-bar>`;
|
|
657
|
+
}
|
|
658
|
+
titleLetterChanged(e) {
|
|
659
|
+
var _a;
|
|
660
|
+
this.selectedTitleFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
|
|
661
|
+
this.emitTitleLetterChangedEvent();
|
|
662
|
+
}
|
|
663
|
+
creatorLetterChanged(e) {
|
|
664
|
+
var _a;
|
|
665
|
+
this.selectedCreatorFilter = (_a = e.detail.selectedLetter) !== null && _a !== void 0 ? _a : null;
|
|
666
|
+
this.emitCreatorLetterChangedEvent();
|
|
667
|
+
}
|
|
668
|
+
emitTitleLetterChangedEvent() {
|
|
669
|
+
const event = new CustomEvent('titleLetterChanged', {
|
|
670
|
+
detail: { selectedLetter: this.selectedTitleFilter },
|
|
671
|
+
});
|
|
672
|
+
this.dispatchEvent(event);
|
|
673
|
+
}
|
|
674
|
+
emitCreatorLetterChangedEvent() {
|
|
675
|
+
const event = new CustomEvent('creatorLetterChanged', {
|
|
676
|
+
detail: { selectedLetter: this.selectedCreatorFilter },
|
|
677
|
+
});
|
|
678
|
+
this.dispatchEvent(event);
|
|
679
|
+
}
|
|
680
|
+
displayModeChanged() {
|
|
681
|
+
const event = new CustomEvent('displayModeChanged', {
|
|
682
|
+
detail: { displayMode: this.displayMode },
|
|
683
|
+
});
|
|
684
|
+
this.dispatchEvent(event);
|
|
685
|
+
}
|
|
686
|
+
emitSortChangedEvent() {
|
|
687
|
+
const event = new CustomEvent('sortChanged', {
|
|
688
|
+
detail: {
|
|
689
|
+
selectedSort: this.selectedSort,
|
|
690
|
+
sortDirection: this.sortDirection,
|
|
691
|
+
},
|
|
692
|
+
});
|
|
693
|
+
this.dispatchEvent(event);
|
|
694
|
+
}
|
|
695
|
+
static get styles() {
|
|
696
|
+
return [
|
|
697
|
+
srOnlyStyle,
|
|
693
698
|
css `
|
|
694
699
|
#container {
|
|
695
700
|
position: relative;
|
|
@@ -913,69 +918,69 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
913
918
|
white-space: nowrap;
|
|
914
919
|
user-select: none;
|
|
915
920
|
}
|
|
916
|
-
`,
|
|
917
|
-
];
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
|
-
__decorate([
|
|
921
|
-
property({ type: String })
|
|
922
|
-
], SortFilterBar.prototype, "displayMode", void 0);
|
|
923
|
-
__decorate([
|
|
924
|
-
property({ type: String })
|
|
925
|
-
], SortFilterBar.prototype, "defaultSortDirection", void 0);
|
|
926
|
-
__decorate([
|
|
927
|
-
property({ type: String })
|
|
928
|
-
], SortFilterBar.prototype, "defaultSortField", void 0);
|
|
929
|
-
__decorate([
|
|
930
|
-
property({ type: String })
|
|
931
|
-
], SortFilterBar.prototype, "sortDirection", void 0);
|
|
932
|
-
__decorate([
|
|
933
|
-
property({ type: String })
|
|
934
|
-
], SortFilterBar.prototype, "selectedSort", void 0);
|
|
935
|
-
__decorate([
|
|
936
|
-
property({ type: String })
|
|
937
|
-
], SortFilterBar.prototype, "selectedTitleFilter", void 0);
|
|
938
|
-
__decorate([
|
|
939
|
-
property({ type: String })
|
|
940
|
-
], SortFilterBar.prototype, "selectedCreatorFilter", void 0);
|
|
941
|
-
__decorate([
|
|
942
|
-
property({ type: Boolean })
|
|
943
|
-
], SortFilterBar.prototype, "showRelevance", void 0);
|
|
944
|
-
__decorate([
|
|
945
|
-
property({ type: Object })
|
|
946
|
-
], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
|
|
947
|
-
__decorate([
|
|
948
|
-
property({ type: Object })
|
|
949
|
-
], SortFilterBar.prototype, "resizeObserver", void 0);
|
|
950
|
-
__decorate([
|
|
951
|
-
state()
|
|
952
|
-
], SortFilterBar.prototype, "alphaSelectorVisible", void 0);
|
|
953
|
-
__decorate([
|
|
954
|
-
state()
|
|
955
|
-
], SortFilterBar.prototype, "dropdownBackdropVisible", void 0);
|
|
956
|
-
__decorate([
|
|
957
|
-
state()
|
|
958
|
-
], SortFilterBar.prototype, "desktopSortContainerWidth", void 0);
|
|
959
|
-
__decorate([
|
|
960
|
-
state()
|
|
961
|
-
], SortFilterBar.prototype, "selectorBarContainerWidth", void 0);
|
|
962
|
-
__decorate([
|
|
963
|
-
query('#desktop-sort-container')
|
|
964
|
-
], SortFilterBar.prototype, "desktopSortContainer", void 0);
|
|
965
|
-
__decorate([
|
|
966
|
-
query('#sort-selector-container')
|
|
967
|
-
], SortFilterBar.prototype, "sortSelectorContainer", void 0);
|
|
968
|
-
__decorate([
|
|
969
|
-
query('#views-dropdown')
|
|
970
|
-
], SortFilterBar.prototype, "viewsDropdown", void 0);
|
|
971
|
-
__decorate([
|
|
972
|
-
query('#date-dropdown')
|
|
973
|
-
], SortFilterBar.prototype, "dateDropdown", void 0);
|
|
974
|
-
__decorate([
|
|
975
|
-
query('#mobile-dropdown')
|
|
976
|
-
], SortFilterBar.prototype, "mobileDropdown", void 0);
|
|
977
|
-
SortFilterBar = __decorate([
|
|
978
|
-
customElement('sort-filter-bar')
|
|
979
|
-
], SortFilterBar);
|
|
980
|
-
export { SortFilterBar };
|
|
921
|
+
`,
|
|
922
|
+
];
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
__decorate([
|
|
926
|
+
property({ type: String })
|
|
927
|
+
], SortFilterBar.prototype, "displayMode", void 0);
|
|
928
|
+
__decorate([
|
|
929
|
+
property({ type: String })
|
|
930
|
+
], SortFilterBar.prototype, "defaultSortDirection", void 0);
|
|
931
|
+
__decorate([
|
|
932
|
+
property({ type: String })
|
|
933
|
+
], SortFilterBar.prototype, "defaultSortField", void 0);
|
|
934
|
+
__decorate([
|
|
935
|
+
property({ type: String })
|
|
936
|
+
], SortFilterBar.prototype, "sortDirection", void 0);
|
|
937
|
+
__decorate([
|
|
938
|
+
property({ type: String })
|
|
939
|
+
], SortFilterBar.prototype, "selectedSort", void 0);
|
|
940
|
+
__decorate([
|
|
941
|
+
property({ type: String })
|
|
942
|
+
], SortFilterBar.prototype, "selectedTitleFilter", void 0);
|
|
943
|
+
__decorate([
|
|
944
|
+
property({ type: String })
|
|
945
|
+
], SortFilterBar.prototype, "selectedCreatorFilter", void 0);
|
|
946
|
+
__decorate([
|
|
947
|
+
property({ type: Boolean })
|
|
948
|
+
], SortFilterBar.prototype, "showRelevance", void 0);
|
|
949
|
+
__decorate([
|
|
950
|
+
property({ type: Object })
|
|
951
|
+
], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
|
|
952
|
+
__decorate([
|
|
953
|
+
property({ type: Object })
|
|
954
|
+
], SortFilterBar.prototype, "resizeObserver", void 0);
|
|
955
|
+
__decorate([
|
|
956
|
+
state()
|
|
957
|
+
], SortFilterBar.prototype, "alphaSelectorVisible", void 0);
|
|
958
|
+
__decorate([
|
|
959
|
+
state()
|
|
960
|
+
], SortFilterBar.prototype, "dropdownBackdropVisible", void 0);
|
|
961
|
+
__decorate([
|
|
962
|
+
state()
|
|
963
|
+
], SortFilterBar.prototype, "desktopSortContainerWidth", void 0);
|
|
964
|
+
__decorate([
|
|
965
|
+
state()
|
|
966
|
+
], SortFilterBar.prototype, "selectorBarContainerWidth", void 0);
|
|
967
|
+
__decorate([
|
|
968
|
+
query('#desktop-sort-container')
|
|
969
|
+
], SortFilterBar.prototype, "desktopSortContainer", void 0);
|
|
970
|
+
__decorate([
|
|
971
|
+
query('#sort-selector-container')
|
|
972
|
+
], SortFilterBar.prototype, "sortSelectorContainer", void 0);
|
|
973
|
+
__decorate([
|
|
974
|
+
query('#views-dropdown')
|
|
975
|
+
], SortFilterBar.prototype, "viewsDropdown", void 0);
|
|
976
|
+
__decorate([
|
|
977
|
+
query('#date-dropdown')
|
|
978
|
+
], SortFilterBar.prototype, "dateDropdown", void 0);
|
|
979
|
+
__decorate([
|
|
980
|
+
query('#mobile-dropdown')
|
|
981
|
+
], SortFilterBar.prototype, "mobileDropdown", void 0);
|
|
982
|
+
SortFilterBar = __decorate([
|
|
983
|
+
customElement('sort-filter-bar')
|
|
984
|
+
], SortFilterBar);
|
|
985
|
+
export { SortFilterBar };
|
|
981
986
|
//# sourceMappingURL=sort-filter-bar.js.map
|