@internetarchive/collection-browser 2.7.8 → 2.7.9

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.
@@ -131,6 +131,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
131
131
  enableSortOptionsSlot: boolean;
132
132
  /** Whether to display a smart results carousel above the full results */
133
133
  showSmartResults: boolean;
134
+ /**
135
+ * The maximum number of pages we will load when a privileged user clicks
136
+ * the "Manage" button on the search page. Limited to 15 pages.
137
+ */
138
+ maxPagesToManage: number;
134
139
  /**
135
140
  * The results per page so we can paginate.
136
141
  *
@@ -587,5 +592,15 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
587
592
  * increase the number of pages to render and start fetching data for the new page
588
593
  */
589
594
  private scrollThresholdReached;
595
+ /**
596
+ * Fetches search results for privileged users when in manage view.
597
+ *
598
+ * This method:
599
+ * 1. Checks if we're in search context with > 100 results and not currently loading
600
+ * 2. Resets the datasource pagination state
601
+ * 3. Fetches first page with limit based on maxPagesToManage threshold
602
+ * 4. Reloads the infinite scroller to display new results
603
+ */
604
+ private fetchManagableSearchResults;
590
605
  static get styles(): import("lit").CSSResult[];
591
606
  }
@@ -110,6 +110,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
110
110
  this.enableSortOptionsSlot = false;
111
111
  /** Whether to display a smart results carousel above the full results */
112
112
  this.showSmartResults = false;
113
+ /**
114
+ * The maximum number of pages we will load when a privileged user clicks
115
+ * the "Manage" button on the search page. Limited to 15 pages.
116
+ */
117
+ this.maxPagesToManage = 15;
113
118
  /**
114
119
  * The results per page so we can paginate.
115
120
  *
@@ -605,6 +610,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
605
610
  @cancel=${() => {
606
611
  this.isManageView = false;
607
612
  this.dataSource.uncheckAllTiles();
613
+ if (this.searchResultsLoading)
614
+ this.dataSource.resetPages();
608
615
  }}
609
616
  ></manage-bar>
610
617
  `;
@@ -1046,7 +1053,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1046
1053
  }
1047
1054
  }
1048
1055
  updated(changed) {
1049
- var _a, _b;
1056
+ var _a, _b, _c;
1050
1057
  if (changed.has('placeholderType') && this.placeholderType === null) {
1051
1058
  if (!this.leftColIntersectionObserver) {
1052
1059
  this.setupLeftColumnScrollListeners();
@@ -1153,9 +1160,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1153
1160
  }
1154
1161
  }
1155
1162
  if (changed.has('isManageView')) {
1156
- if (this.isManageView)
1163
+ if (this.isManageView) {
1157
1164
  this.displayMode = 'grid';
1158
- (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
1165
+ this.fetchManagableSearchResults();
1166
+ }
1167
+ else if (this.pageContext === 'search')
1168
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1169
+ (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1159
1170
  this.emitManageModeChangedEvent();
1160
1171
  }
1161
1172
  if (changed.has('resizeObserver')) {
@@ -1673,6 +1684,25 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1673
1684
  this.dataSource.fetchPage(this.pagesToRender);
1674
1685
  }
1675
1686
  }
1687
+ /**
1688
+ * Fetches search results for privileged users when in manage view.
1689
+ *
1690
+ * This method:
1691
+ * 1. Checks if we're in search context with > 100 results and not currently loading
1692
+ * 2. Resets the datasource pagination state
1693
+ * 3. Fetches first page with limit based on maxPagesToManage threshold
1694
+ * 4. Reloads the infinite scroller to display new results
1695
+ */
1696
+ fetchManagableSearchResults() {
1697
+ var _a;
1698
+ if (this.pageContext === 'search' &&
1699
+ this.dataSource.totalResults > 100 &&
1700
+ !this.searchResultsLoading) {
1701
+ this.dataSource.resetPages();
1702
+ this.dataSource.fetchPage(1, this.maxPagesToManage);
1703
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1704
+ }
1705
+ }
1676
1706
  static get styles() {
1677
1707
  return [
1678
1708
  srOnlyStyle,
@@ -2238,6 +2268,9 @@ __decorate([
2238
2268
  __decorate([
2239
2269
  property({ type: Boolean, reflect: true })
2240
2270
  ], CollectionBrowser.prototype, "showSmartResults", void 0);
2271
+ __decorate([
2272
+ property({ type: Number })
2273
+ ], CollectionBrowser.prototype, "maxPagesToManage", void 0);
2241
2274
  __decorate([
2242
2275
  property({ type: Object })
2243
2276
  ], CollectionBrowser.prototype, "dataSource", void 0);