@internetarchive/collection-browser 2.7.13-alpha1 → 2.7.13-alpha2
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/app-root.d.ts +2 -1
- package/dist/src/app-root.js +10 -10
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +2 -6
- package/dist/src/collection-browser.js +19 -22
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/test/collection-browser.test.js +10 -10
- package/dist/test/collection-browser.test.js.map +1 -1
- package/package.json +1 -1
- package/src/app-root.ts +11 -10
- package/src/collection-browser.ts +15 -22
- package/test/collection-browser.test.ts +10 -10
package/package.json
CHANGED
package/src/app-root.ts
CHANGED
|
@@ -131,13 +131,17 @@ export class AppRoot extends LitElement {
|
|
|
131
131
|
|
|
132
132
|
private get getClass() {
|
|
133
133
|
const searchParams = new URLSearchParams(window.location.search);
|
|
134
|
-
|
|
135
134
|
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
private get
|
|
137
|
+
private get isManageView() {
|
|
138
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
139
|
+
return searchParams.get('manage') ? true : false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private get urlBasedManageView() {
|
|
139
143
|
const searchParams = new URLSearchParams(window.location.search);
|
|
140
|
-
return searchParams.get('manage') ?
|
|
144
|
+
return searchParams.get('manage') ? true : false;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
render() {
|
|
@@ -489,7 +493,8 @@ export class AppRoot extends LitElement {
|
|
|
489
493
|
.modalManager=${this.modalManager}
|
|
490
494
|
.analyticsHandler=${this.analyticsHandler}
|
|
491
495
|
.pageContext=${'search'}
|
|
492
|
-
.
|
|
496
|
+
.isManageView=${this.isManageView}
|
|
497
|
+
.urlBasedManageView=${this.urlBasedManageView}
|
|
493
498
|
@visiblePageChanged=${this.visiblePageChanged}
|
|
494
499
|
@baseQueryChanged=${this.baseQueryChanged}
|
|
495
500
|
@searchTypeChanged=${this.searchTypeChanged}
|
|
@@ -723,7 +728,7 @@ export class AppRoot extends LitElement {
|
|
|
723
728
|
|
|
724
729
|
if (status) {
|
|
725
730
|
// looking for success?
|
|
726
|
-
this.collectionBrowser.
|
|
731
|
+
this.collectionBrowser.isManageView = false;
|
|
727
732
|
this.modalManager?.closeModal();
|
|
728
733
|
this.modalManager?.classList.remove('remove-items');
|
|
729
734
|
} else {
|
|
@@ -745,11 +750,7 @@ export class AppRoot extends LitElement {
|
|
|
745
750
|
*/
|
|
746
751
|
private manageModeCheckboxChanged(e: Event) {
|
|
747
752
|
const target = e.target as HTMLInputElement;
|
|
748
|
-
|
|
749
|
-
this.collectionBrowser.manageViewMode = 'manual';
|
|
750
|
-
} else {
|
|
751
|
-
this.collectionBrowser.manageViewMode = '';
|
|
752
|
-
}
|
|
753
|
+
this.collectionBrowser.isManageView = target.checked;
|
|
753
754
|
this.collectionBrowser.manageViewLabel =
|
|
754
755
|
'Select items to remove (customizable texts)';
|
|
755
756
|
}
|
|
@@ -240,12 +240,8 @@ export class CollectionBrowser
|
|
|
240
240
|
/**
|
|
241
241
|
* If item management UI active
|
|
242
242
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
* - 'initial': Initial mode activated through &manage=1 parameter
|
|
246
|
-
* - 'manual': Manual mode activated through user interaction eg. Manage|Remove items button
|
|
247
|
-
*/
|
|
248
|
-
@property({ type: String }) manageViewMode: 'initial' | 'manual' | '' = '';
|
|
243
|
+
@property({ type: Boolean }) isManageView = false;
|
|
244
|
+
@property({ type: Boolean }) urlBasedManageView = false;
|
|
249
245
|
|
|
250
246
|
@property({ type: String }) manageViewLabel = 'Select items to remove';
|
|
251
247
|
|
|
@@ -557,7 +553,7 @@ export class CollectionBrowser
|
|
|
557
553
|
|
|
558
554
|
if (!hasQuery && !isCollection && !isProfile) {
|
|
559
555
|
this.placeholderType = 'empty-query';
|
|
560
|
-
} else if (noResults && this.
|
|
556
|
+
} else if (noResults && !this.isManageView) {
|
|
561
557
|
// Within a collection, no query + no results means the collection simply has no viewable items.
|
|
562
558
|
// Otherwise, we must have a user query that produced 0 results.
|
|
563
559
|
this.placeholderType =
|
|
@@ -704,7 +700,7 @@ export class CollectionBrowser
|
|
|
704
700
|
<div id="cb-top-view">
|
|
705
701
|
<slot name="cb-top-slot"></slot>
|
|
706
702
|
</div>
|
|
707
|
-
${this.
|
|
703
|
+
${this.isManageView
|
|
708
704
|
? this.manageBarTemplate
|
|
709
705
|
: this.sortFilterBarTemplate}
|
|
710
706
|
<slot name="cb-results"></slot>
|
|
@@ -804,7 +800,7 @@ export class CollectionBrowser
|
|
|
804
800
|
@selectAll=${() => this.dataSource.checkAllTiles()}
|
|
805
801
|
@unselectAll=${() => this.dataSource.uncheckAllTiles()}
|
|
806
802
|
@cancel=${() => {
|
|
807
|
-
this.
|
|
803
|
+
this.isManageView = false;
|
|
808
804
|
this.dataSource.uncheckAllTiles();
|
|
809
805
|
if (this.searchResultsLoading) this.dataSource.resetPages();
|
|
810
806
|
}}
|
|
@@ -1108,7 +1104,7 @@ export class CollectionBrowser
|
|
|
1108
1104
|
.contentWidth=${this.contentWidth}
|
|
1109
1105
|
.query=${this.baseQuery}
|
|
1110
1106
|
.filterMap=${this.dataSource.filterMap}
|
|
1111
|
-
.isManageView=${
|
|
1107
|
+
.isManageView=${this.isManageView}
|
|
1112
1108
|
.modalManager=${this.modalManager}
|
|
1113
1109
|
?collapsableFacets=${this.mobileView}
|
|
1114
1110
|
?facetsLoading=${this.facetsLoading}
|
|
@@ -1231,8 +1227,8 @@ export class CollectionBrowser
|
|
|
1231
1227
|
*/
|
|
1232
1228
|
private emitManageModeChangedEvent(): void {
|
|
1233
1229
|
this.dispatchEvent(
|
|
1234
|
-
new CustomEvent<
|
|
1235
|
-
detail: this.
|
|
1230
|
+
new CustomEvent<boolean>('manageModeChanged', {
|
|
1231
|
+
detail: this.isManageView,
|
|
1236
1232
|
}),
|
|
1237
1233
|
);
|
|
1238
1234
|
}
|
|
@@ -1459,12 +1455,9 @@ export class CollectionBrowser
|
|
|
1459
1455
|
}
|
|
1460
1456
|
}
|
|
1461
1457
|
|
|
1462
|
-
if (changed.has('
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
this.infiniteScroller.itemCount = this.estimatedTileCount;
|
|
1466
|
-
|
|
1467
|
-
if (this.manageViewMode) {
|
|
1458
|
+
if (changed.has('isManageView')) {
|
|
1459
|
+
if (this.isManageView) {
|
|
1460
|
+
console.log('here1');
|
|
1468
1461
|
this.displayMode = 'grid';
|
|
1469
1462
|
this.fetchManagableSearchResults();
|
|
1470
1463
|
} else if (this.pageContext === 'search') this.infiniteScroller?.reload();
|
|
@@ -1478,7 +1471,7 @@ export class CollectionBrowser
|
|
|
1478
1471
|
'resizeObserver',
|
|
1479
1472
|
) as SharedResizeObserverInterface;
|
|
1480
1473
|
if (oldObserver) this.disconnectResizeObserver(oldObserver);
|
|
1481
|
-
|
|
1474
|
+
this.setupResizeObserver();
|
|
1482
1475
|
}
|
|
1483
1476
|
|
|
1484
1477
|
this.ensureAvailableTilesDisplayed();
|
|
@@ -2049,7 +2042,7 @@ export class CollectionBrowser
|
|
|
2049
2042
|
* Callback when a result is selected
|
|
2050
2043
|
*/
|
|
2051
2044
|
resultSelected(event: CustomEvent<TileModel>): void {
|
|
2052
|
-
if (this.
|
|
2045
|
+
if (this.isManageView) {
|
|
2053
2046
|
// Checked/unchecked state change -- rerender to ensure it propagates
|
|
2054
2047
|
// this.mapDataSource(model => ({ ...model }));
|
|
2055
2048
|
const cellIndex = this.dataSource.indexOf(event.detail);
|
|
@@ -2089,7 +2082,7 @@ export class CollectionBrowser
|
|
|
2089
2082
|
.creatorFilter=${this.selectedCreatorFilter}
|
|
2090
2083
|
.mobileBreakpoint=${this.mobileBreakpoint}
|
|
2091
2084
|
.loggedIn=${this.loggedIn}
|
|
2092
|
-
.isManageView=${
|
|
2085
|
+
.isManageView=${this.isManageView}
|
|
2093
2086
|
?enableHoverPane=${true}
|
|
2094
2087
|
@resultSelected=${(e: CustomEvent) => this.resultSelected(e)}
|
|
2095
2088
|
>
|
|
@@ -2122,7 +2115,7 @@ export class CollectionBrowser
|
|
|
2122
2115
|
(this.pageContext === 'search' &&
|
|
2123
2116
|
this.dataSource.totalResults > 100 &&
|
|
2124
2117
|
!this.searchResultsLoading) ||
|
|
2125
|
-
this.
|
|
2118
|
+
this.urlBasedManageView
|
|
2126
2119
|
) {
|
|
2127
2120
|
console.log('here22');
|
|
2128
2121
|
this.dataSource.resetPages();
|
|
@@ -1712,13 +1712,13 @@ describe('Collection Browser', () => {
|
|
|
1712
1712
|
await el.updateComplete;
|
|
1713
1713
|
await el.initialSearchComplete;
|
|
1714
1714
|
|
|
1715
|
-
el.
|
|
1715
|
+
el.isManageView = true;
|
|
1716
1716
|
await el.updateComplete;
|
|
1717
1717
|
|
|
1718
1718
|
expect(el.shadowRoot?.querySelector('manage-bar')).to.exist;
|
|
1719
1719
|
expect(el.shadowRoot?.querySelector('sort-filter-bar')).not.to.exist;
|
|
1720
1720
|
|
|
1721
|
-
el.
|
|
1721
|
+
el.isManageView = false;
|
|
1722
1722
|
await el.updateComplete;
|
|
1723
1723
|
|
|
1724
1724
|
expect(el.shadowRoot?.querySelector('manage-bar')).not.to.exist;
|
|
@@ -1736,7 +1736,7 @@ describe('Collection Browser', () => {
|
|
|
1736
1736
|
</collection-browser>`,
|
|
1737
1737
|
);
|
|
1738
1738
|
|
|
1739
|
-
el.
|
|
1739
|
+
el.isManageView = true;
|
|
1740
1740
|
await el.updateComplete;
|
|
1741
1741
|
|
|
1742
1742
|
expect(el.displayMode).to.equal('grid');
|
|
@@ -1757,7 +1757,7 @@ describe('Collection Browser', () => {
|
|
|
1757
1757
|
await el.updateComplete;
|
|
1758
1758
|
await el.initialSearchComplete;
|
|
1759
1759
|
|
|
1760
|
-
el.
|
|
1760
|
+
el.isManageView = true;
|
|
1761
1761
|
await el.updateComplete;
|
|
1762
1762
|
|
|
1763
1763
|
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
@@ -1815,7 +1815,7 @@ describe('Collection Browser', () => {
|
|
|
1815
1815
|
await el.updateComplete;
|
|
1816
1816
|
await el.initialSearchComplete;
|
|
1817
1817
|
|
|
1818
|
-
el.
|
|
1818
|
+
el.isManageView = true;
|
|
1819
1819
|
await el.updateComplete;
|
|
1820
1820
|
|
|
1821
1821
|
expect(el.dataSource.checkedTileModels.length).to.equal(0);
|
|
@@ -1846,7 +1846,7 @@ describe('Collection Browser', () => {
|
|
|
1846
1846
|
await el.updateComplete;
|
|
1847
1847
|
await el.initialSearchComplete;
|
|
1848
1848
|
|
|
1849
|
-
el.
|
|
1849
|
+
el.isManageView = true;
|
|
1850
1850
|
await el.updateComplete;
|
|
1851
1851
|
|
|
1852
1852
|
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
@@ -1893,7 +1893,7 @@ describe('Collection Browser', () => {
|
|
|
1893
1893
|
await el.updateComplete;
|
|
1894
1894
|
await el.initialSearchComplete;
|
|
1895
1895
|
|
|
1896
|
-
el.
|
|
1896
|
+
el.isManageView = true;
|
|
1897
1897
|
await el.updateComplete;
|
|
1898
1898
|
|
|
1899
1899
|
const manageBar = el.shadowRoot?.querySelector('manage-bar');
|
|
@@ -1903,7 +1903,7 @@ describe('Collection Browser', () => {
|
|
|
1903
1903
|
manageBar!.dispatchEvent(new CustomEvent('cancel'));
|
|
1904
1904
|
|
|
1905
1905
|
await el.updateComplete;
|
|
1906
|
-
expect(el.
|
|
1906
|
+
expect(el.isManageView).to.be.false;
|
|
1907
1907
|
});
|
|
1908
1908
|
|
|
1909
1909
|
it('enable/disable manage view delete button when you selectAll/unselectAll', async () => {
|
|
@@ -1917,7 +1917,7 @@ describe('Collection Browser', () => {
|
|
|
1917
1917
|
await el.updateComplete;
|
|
1918
1918
|
await el.initialSearchComplete;
|
|
1919
1919
|
|
|
1920
|
-
el.
|
|
1920
|
+
el.isManageView = true;
|
|
1921
1921
|
await el.updateComplete;
|
|
1922
1922
|
|
|
1923
1923
|
const manageBar = el.shadowRoot?.querySelector('manage-bar');
|
|
@@ -2018,7 +2018,7 @@ describe('Collection Browser', () => {
|
|
|
2018
2018
|
const numberOfPages = 15;
|
|
2019
2019
|
|
|
2020
2020
|
el.baseQuery = 'jack';
|
|
2021
|
-
el.
|
|
2021
|
+
el.isManageView = true;
|
|
2022
2022
|
await el.dataSource.fetchPage(1, numberOfPages);
|
|
2023
2023
|
await el.updateComplete;
|
|
2024
2024
|
|