@internetarchive/collection-browser 2.7.14-alpha-webdev7397.2 → 2.7.14-alpha-webdev7397.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/collection-browser.d.ts +1 -1
- package/dist/src/collection-browser.js +8 -12
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +2 -2
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +3 -0
- package/dist/src/data-source/collection-browser-data-source.js +3 -0
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/test/collection-browser.test.js +18 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.js +10 -0
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +11 -14
- package/src/data-source/collection-browser-data-source-interface.ts +2 -2
- package/src/data-source/collection-browser-data-source.ts +3 -0
- package/test/collection-browser.test.ts +24 -0
- package/test/data-source/collection-browser-data-source.test.ts +14 -0
|
@@ -596,7 +596,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
|
|
|
596
596
|
* Fetches search results for privileged users when in manage view.
|
|
597
597
|
*
|
|
598
598
|
* This method:
|
|
599
|
-
* 1. Checks if we're in search context
|
|
599
|
+
* 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
|
|
600
600
|
* 2. Resets the datasource pagination state
|
|
601
601
|
* 3. Fetches first page with limit based on maxPagesToManage threshold
|
|
602
602
|
* 4. Reloads the infinite scroller to display new results
|
|
@@ -1058,12 +1058,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
updated(changed) {
|
|
1060
1060
|
var _a, _b, _c;
|
|
1061
|
-
try {
|
|
1062
|
-
console.log('c-b updated', '\n' + [...changed.entries()].map(([k, v]) => `${String(k)}: ${JSON.stringify(v)} -> ${JSON.stringify(this[k])}`).join('\n'));
|
|
1063
|
-
}
|
|
1064
|
-
catch (err) {
|
|
1065
|
-
console.error(err);
|
|
1066
|
-
}
|
|
1067
1061
|
if (changed.has('placeholderType') && this.placeholderType === null) {
|
|
1068
1062
|
if (!this.leftColIntersectionObserver) {
|
|
1069
1063
|
this.setupLeftColumnScrollListeners();
|
|
@@ -1170,7 +1164,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1170
1164
|
}
|
|
1171
1165
|
}
|
|
1172
1166
|
if (changed.has('isManageView')) {
|
|
1173
|
-
console.log('isManageView changed', changed.get('isManageView'), this.isManageView);
|
|
1174
1167
|
if (this.isManageView) {
|
|
1175
1168
|
this.displayMode = 'grid';
|
|
1176
1169
|
this.fetchManageableSearchResults();
|
|
@@ -1178,7 +1171,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1178
1171
|
else if (this.pageContext === 'search')
|
|
1179
1172
|
(_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
|
|
1180
1173
|
(_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
|
|
1181
|
-
|
|
1174
|
+
// Only emit change event if changing b/w true & false, not on initial value set.
|
|
1175
|
+
if (changed.get('isManageView') !== undefined) {
|
|
1176
|
+
this.emitManageModeChangedEvent();
|
|
1177
|
+
}
|
|
1182
1178
|
}
|
|
1183
1179
|
if (changed.has('resizeObserver')) {
|
|
1184
1180
|
const oldObserver = changed.get('resizeObserver');
|
|
@@ -1699,17 +1695,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1699
1695
|
* Fetches search results for privileged users when in manage view.
|
|
1700
1696
|
*
|
|
1701
1697
|
* This method:
|
|
1702
|
-
* 1. Checks if we're in search context
|
|
1698
|
+
* 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
|
|
1703
1699
|
* 2. Resets the datasource pagination state
|
|
1704
1700
|
* 3. Fetches first page with limit based on maxPagesToManage threshold
|
|
1705
1701
|
* 4. Reloads the infinite scroller to display new results
|
|
1706
1702
|
*/
|
|
1707
1703
|
fetchManageableSearchResults() {
|
|
1708
1704
|
var _a;
|
|
1709
|
-
|
|
1705
|
+
const hasNotLoadedInitialResults = !this.dataSource.totalResults;
|
|
1706
|
+
const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
|
|
1710
1707
|
if (this.pageContext === 'search' &&
|
|
1711
|
-
(
|
|
1712
|
-
!this.dataSource.totalResults)) {
|
|
1708
|
+
(hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
|
|
1713
1709
|
this.dataSource.resetPages();
|
|
1714
1710
|
this.dataSource.fetchPage(1, this.maxPagesToManage);
|
|
1715
1711
|
(_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
|