@internetarchive/collection-browser 4.7.1-alpha-webdev9189.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/src/app-root.js +0 -2
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/assets/img/icons/check.d.ts +2 -0
  4. package/dist/src/assets/img/icons/check.js +5 -0
  5. package/dist/src/assets/img/icons/check.js.map +1 -0
  6. package/dist/src/collection-browser.js +2 -24
  7. package/dist/src/collection-browser.js.map +1 -1
  8. package/dist/src/collection-facets/facet-row-template.d.ts +38 -0
  9. package/dist/src/collection-facets/facet-row-template.js +200 -0
  10. package/dist/src/collection-facets/facet-row-template.js.map +1 -0
  11. package/dist/src/collection-facets/facet-row.js +11 -186
  12. package/dist/src/collection-facets/facet-row.js.map +1 -1
  13. package/dist/src/collection-facets/models.d.ts +7 -2
  14. package/dist/src/collection-facets/models.js +7 -2
  15. package/dist/src/collection-facets/models.js.map +1 -1
  16. package/dist/src/collection-facets/more-facets-content.d.ts +87 -21
  17. package/dist/src/collection-facets/more-facets-content.js +477 -200
  18. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  19. package/dist/src/collection-facets/more-facets-scroller.d.ts +85 -0
  20. package/dist/src/collection-facets/more-facets-scroller.js +428 -0
  21. package/dist/src/collection-facets/more-facets-scroller.js.map +1 -0
  22. package/dist/src/collection-facets/page-window.d.ts +73 -0
  23. package/dist/src/collection-facets/page-window.js +202 -0
  24. package/dist/src/collection-facets/page-window.js.map +1 -0
  25. package/dist/src/collection-facets/toggle-switch.js +1 -0
  26. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  27. package/dist/src/models.d.ts +4 -0
  28. package/dist/src/models.js +16 -0
  29. package/dist/src/models.js.map +1 -1
  30. package/dist/src/sort-filter-bar/sort-filter-bar.js +0 -1
  31. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  32. package/dist/src/utils/log.d.ts +1 -4
  33. package/dist/src/utils/normalize-filter-text.d.ts +28 -0
  34. package/dist/src/utils/normalize-filter-text.js +35 -0
  35. package/dist/src/utils/normalize-filter-text.js.map +1 -0
  36. package/dist/test/collection-browser.test.js +0 -34
  37. package/dist/test/collection-browser.test.js.map +1 -1
  38. package/dist/test/collection-facets/more-facets-content.test.js +367 -17
  39. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  40. package/dist/test/collection-facets/more-facets-scroller.test.d.ts +1 -0
  41. package/dist/test/collection-facets/more-facets-scroller.test.js +288 -0
  42. package/dist/test/collection-facets/more-facets-scroller.test.js.map +1 -0
  43. package/dist/test/collection-facets/page-window.test.d.ts +1 -0
  44. package/dist/test/collection-facets/page-window.test.js +175 -0
  45. package/dist/test/collection-facets/page-window.test.js.map +1 -0
  46. package/dist/test/mocks/mock-search-responses.d.ts +6 -0
  47. package/dist/test/mocks/mock-search-responses.js +52 -0
  48. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  49. package/dist/test/mocks/mock-search-service.js +2 -1
  50. package/dist/test/mocks/mock-search-service.js.map +1 -1
  51. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +0 -22
  52. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  53. package/dist/test/utils/normalize-filter-text.test.d.ts +1 -0
  54. package/dist/test/utils/normalize-filter-text.test.js +69 -0
  55. package/dist/test/utils/normalize-filter-text.test.js.map +1 -0
  56. package/docs/design/column-virtualization.md +214 -0
  57. package/package.json +3 -1
  58. package/src/app-root.ts +0 -2
  59. package/src/assets/img/icons/check.ts +5 -0
  60. package/src/collection-browser.ts +4 -26
  61. package/src/collection-facets/facet-row-template.ts +242 -0
  62. package/src/collection-facets/facet-row.ts +15 -202
  63. package/src/collection-facets/models.ts +8 -2
  64. package/src/collection-facets/more-facets-content.ts +528 -221
  65. package/src/collection-facets/more-facets-scroller.ts +485 -0
  66. package/src/collection-facets/page-window.ts +247 -0
  67. package/src/collection-facets/toggle-switch.ts +1 -0
  68. package/src/models.ts +17 -0
  69. package/src/sort-filter-bar/sort-filter-bar.ts +0 -1
  70. package/src/utils/normalize-filter-text.ts +54 -0
  71. package/test/collection-browser.test.ts +0 -55
  72. package/test/collection-facets/more-facets-content.test.ts +509 -24
  73. package/test/collection-facets/more-facets-scroller.test.ts +401 -0
  74. package/test/collection-facets/page-window.test.ts +208 -0
  75. package/test/mocks/mock-search-responses.ts +56 -0
  76. package/test/mocks/mock-search-service.ts +2 -0
  77. package/test/sort-filter-bar/sort-filter-bar.test.ts +0 -29
  78. package/test/utils/normalize-filter-text.test.ts +87 -0
  79. package/web-test-runner.config.mjs +7 -2
  80. package/dist/src/collection-facets/more-facets-pagination.d.ts +0 -36
  81. package/dist/src/collection-facets/more-facets-pagination.js +0 -260
  82. package/dist/src/collection-facets/more-facets-pagination.js.map +0 -1
  83. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +0 -1
  84. package/dist/test/collection-facets/more-facets-pagination.test.js +0 -126
  85. package/dist/test/collection-facets/more-facets-pagination.test.js.map +0 -1
  86. package/src/collection-facets/more-facets-pagination.ts +0 -294
  87. package/test/collection-facets/more-facets-pagination.test.ts +0 -201
@@ -5,8 +5,8 @@ import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manag
5
5
  import { SelectedFacets, FacetOption } from '../models';
6
6
  import type { CollectionTitles, PageSpecifierParams, TVChannelAliases } from '../data-source/models';
7
7
  import '@internetarchive/elements/ia-status-indicator/ia-status-indicator';
8
- import './more-facets-pagination';
9
- import './facets-template';
8
+ import '@internetarchive/ia-clearable-text-input';
9
+ import './more-facets-scroller';
10
10
  import './toggle-switch';
11
11
  export declare class MoreFacetsContent extends LitElement {
12
12
  facetKey?: FacetOption;
@@ -17,10 +17,6 @@ export declare class MoreFacetsContent extends LitElement {
17
17
  pageSpecifierParams?: PageSpecifierParams;
18
18
  collectionTitles?: CollectionTitles;
19
19
  tvChannelAliases?: TVChannelAliases;
20
- /**
21
- * Maximum number of facets to show per page within the modal.
22
- */
23
- facetsPerPage: number;
24
20
  /**
25
21
  * Whether we are waiting for facet data to load.
26
22
  * We begin with this set to true so that we show an initial loading indicator.
@@ -51,14 +47,45 @@ export declare class MoreFacetsContent extends LitElement {
51
47
  */
52
48
  private unappliedFacetChanges;
53
49
  /**
54
- * Which page of facets we are showing.
50
+ * Text the patron has entered to narrow down the facet values shown.
51
+ */
52
+ private filterText;
53
+ /**
54
+ * Whether the search for this facet's values failed, either with an error
55
+ * result or by throwing.
56
+ */
57
+ private loadFailed;
58
+ /**
59
+ * The buckets from `facetGroup` that match `filterText`, in display order.
60
+ * Derived in `willUpdate`.
61
+ */
62
+ private filteredBuckets;
63
+ /**
64
+ * Each bucket's display text in the normalized form that filtering compares
65
+ * against, keyed by bucket key. Filled lazily so that each value is only
66
+ * normalized once, however many times the filter text changes.
55
67
  */
56
- private pageNumber;
68
+ private filterKeys;
69
+ /**
70
+ * The values currently selected or hidden, in the order they were selected.
71
+ * Shown as chiclets above the list. Derived in `willUpdate`.
72
+ */
73
+ private chosenBuckets;
74
+ /**
75
+ * Position of a chiclet that was just removed, whose neighbor should get
76
+ * focus once it's gone.
77
+ */
78
+ private chicletFocusIndex?;
79
+ private scroller?;
80
+ private filterInput?;
57
81
  willUpdate(changed: PropertyValues): void;
82
+ updated(changed: PropertyValues): void;
58
83
  firstUpdated(): void;
84
+ disconnectedCallback(): void;
59
85
  /**
60
86
  * Close more facets modal on Escape click
61
87
  */
88
+ private escapeHandler;
62
89
  private setupEscapeListeners;
63
90
  /**
64
91
  * Whether facet requests are for the search_results page type (either defaulted or explicitly).
@@ -70,38 +97,77 @@ export declare class MoreFacetsContent extends LitElement {
70
97
  */
71
98
  updateSpecificFacets(): Promise<void>;
72
99
  /**
73
- * Handler for page number changes from the pagination widget.
100
+ * Combines the selected facets with the aggregations into the single list of
101
+ * values the dialog shows. Selected and hidden values keep their place in the
102
+ * current sort order rather than moving to the front; the chiclets above the
103
+ * list are what call them out.
74
104
  */
75
- private pageNumberClicked;
105
+ private get mergedFacets();
76
106
  /**
77
- * Combines the selected facets with the aggregations to create a single list of facets
107
+ * This facet type's selections: the ones made before the dialog opened,
108
+ * overridden by any unapplied changes made in it. Values stay in the order
109
+ * they were first selected, and cleared ones remain with state `'none'`.
78
110
  */
79
- private get mergedFacets();
111
+ private get currentSelections();
80
112
  /**
81
- * Converts the selected facets for the current facet key to a `FacetGroup`,
82
- * which is easier to work with.
113
+ * The values that are currently selected or hidden, in the order they were
114
+ * selected, as they appear in `facetGroup`.
83
115
  */
84
- private get selectedFacetGroup();
116
+ private listChosenBuckets;
117
+ /**
118
+ * Inserts `bucket` ahead of the first bucket that the current sort would put
119
+ * after it.
120
+ */
121
+ private insertInSortOrder;
122
+ /**
123
+ * Orders two buckets the way the aggregations are ordered for the current
124
+ * sort (see `getSortedBuckets` in search-service).
125
+ */
126
+ private compareForSort;
127
+ /**
128
+ * The text patrons see for a bucket: the collection title for collections,
129
+ * and the bucket key for everything else.
130
+ */
131
+ private displayTextFor;
85
132
  /**
86
133
  * Converts the raw `aggregations` for the current facet key to a `FacetGroup`,
87
134
  * which is easier to work with.
88
135
  */
89
136
  private get aggregationFacetGroup();
90
137
  /**
91
- * Returns a FacetGroup representing only the current page of facet buckets to show.
138
+ * The buckets whose visible text contains the filter text, ignoring case,
139
+ * accents and punctuation.
140
+ */
141
+ private filterBuckets;
142
+ private filterKeyFor;
143
+ /**
144
+ * Whether the patron's filter text has ruled out every value
92
145
  */
93
- private get facetGroupForCurrentPage();
146
+ private get noValuesMatch();
94
147
  private get moreFacetsTemplate();
95
- private get loaderTemplate();
96
148
  /**
97
- * How many pages of facets to show in the modal pagination widget
149
+ * A chiclet for each selected or hidden value, each with a button to clear it
98
150
  */
99
- private get paginationSize();
100
- private get facetsPaginationTemplate();
151
+ private get chicletsTemplate();
152
+ private chicletTemplate;
153
+ private get noMatchesTemplate();
154
+ private get loadErrorTemplate();
155
+ private get loaderTemplate();
101
156
  private get footerTemplate();
102
157
  private sortFacetAggregation;
103
158
  private get modalHeaderTemplate();
104
159
  render(): TemplateResult<1>;
160
+ /**
161
+ * Handler for typing in (or clearing) the filter text field
162
+ */
163
+ private filterTextChanged;
164
+ private facetClicked;
165
+ /**
166
+ * Clears the selection a chiclet stands for, which removes the chiclet and
167
+ * unchecks the value in the list.
168
+ */
169
+ private chicletRemoved;
170
+ private pageChanged;
105
171
  private applySearchFacetsClicked;
106
172
  private cancelClick;
107
173
  static get styles(): CSSResultGroup;