@internetarchive/collection-browser 0.3.1-alpha.2 → 0.3.1-alpha.3
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/collection-browser.js +12 -8
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +150 -148
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +135 -124
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +1 -2
- package/dist/src/restoration-state-handler.js +0 -11
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +205 -204
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/utils/format-count.js +1 -0
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/test/collection-facets.test.js +205 -2
- package/dist/test/collection-facets.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +5 -1
- package/src/collection-facets/facets-template.ts +294 -292
- package/src/collection-facets/more-facets-content.ts +518 -507
- package/src/restoration-state-handler.ts +1 -13
- package/src/tiles/list/tile-list.ts +509 -508
- package/src/utils/format-count.ts +96 -95
- package/test/collection-facets.test.ts +510 -247
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SortDirection, SortParam } from '@internetarchive/search-service';
|
|
2
2
|
import { getCookie, setCookie } from 'typescript-cookie';
|
|
3
3
|
import {
|
|
4
4
|
MetadataFieldToSortField,
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
|
|
15
15
|
export interface RestorationState {
|
|
16
16
|
displayMode?: CollectionDisplayMode;
|
|
17
|
-
searchType?: SearchType;
|
|
18
17
|
sortParam?: SortParam;
|
|
19
18
|
selectedSort?: SortField;
|
|
20
19
|
sortDirection?: SortDirection;
|
|
@@ -88,17 +87,12 @@ export class RestorationStateHandler
|
|
|
88
87
|
private persistQueryStateToUrl(state: RestorationState) {
|
|
89
88
|
const url = new URL(window.location.href);
|
|
90
89
|
const { searchParams } = url;
|
|
91
|
-
searchParams.delete('sin');
|
|
92
90
|
searchParams.delete('sort');
|
|
93
91
|
searchParams.delete('query');
|
|
94
92
|
searchParams.delete('page');
|
|
95
93
|
searchParams.delete('and[]');
|
|
96
94
|
searchParams.delete('not[]');
|
|
97
95
|
|
|
98
|
-
if (state.searchType) {
|
|
99
|
-
searchParams.set('sin', state.searchType === SearchType.FULLTEXT ? 'TXT' : '');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
96
|
if (state.sortParam) {
|
|
103
97
|
const prefix = state.sortParam.direction === 'desc' ? '-' : '';
|
|
104
98
|
searchParams.set('sort', `${prefix}${state.sortParam.field}`);
|
|
@@ -161,7 +155,6 @@ export class RestorationStateHandler
|
|
|
161
155
|
|
|
162
156
|
private loadQueryStateFromUrl(): RestorationState {
|
|
163
157
|
const url = new URL(window.location.href);
|
|
164
|
-
const searchInside = url.searchParams.get('sin');
|
|
165
158
|
const pageNumber = url.searchParams.get('page');
|
|
166
159
|
const searchQuery = url.searchParams.get('query');
|
|
167
160
|
const sortQuery = url.searchParams.get('sort');
|
|
@@ -180,11 +173,6 @@ export class RestorationStateHandler
|
|
|
180
173
|
},
|
|
181
174
|
};
|
|
182
175
|
|
|
183
|
-
if (searchInside) {
|
|
184
|
-
restorationState.searchType = searchInside === 'TXT'
|
|
185
|
-
? SearchType.FULLTEXT
|
|
186
|
-
: SearchType.METADATA;
|
|
187
|
-
}
|
|
188
176
|
if (pageNumber) {
|
|
189
177
|
const parsed = parseInt(pageNumber, 10);
|
|
190
178
|
restorationState.currentPage = parsed;
|