Auto-select first item in DocumentsTab. Fix selection highlighting (#1645)

* Auto-select first document in documentsTab

* Fix style row selection by making selector more specific
This commit is contained in:
Laurent Nguyen 2023-10-10 05:19:35 +00:00 committed by GitHub
parent 8ff9a84004
commit f36fccd3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 13 deletions

View File

@ -1179,16 +1179,16 @@ menuQuickStart {
} }
} }
.gridRowSelected { #tbodycontent tr.gridRowSelected {
.active(); .active();
} }
.gridRowSelected:hover { #tbodycontent tr.gridRowSelected:hover {
cursor: default; cursor: default;
.hover(); .hover();
} }
.gridRowHighlighted { #tbodycontent tr.gridRowHighlighted {
border-style: dotted; border-style: dotted;
border-width: 2px; border-width: 2px;
} }
@ -2576,9 +2576,10 @@ a:link {
.querydropdown.placeholderVisible { .querydropdown.placeholderVisible {
font-style: italic; font-style: italic;
} }
.querydropdown.placeholderVisible::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ .querydropdown.placeholderVisible::placeholder {
/* Chrome, Firefox, Opera, Safari 10.1+ */
color: #767474; color: #767474;
opacity: 1; opacity: 1;
} }
.querydropdown:hover { .querydropdown:hover {
@ -2648,7 +2649,7 @@ a:link {
.nav-tabs > li.active > .tabNavContentContainer > .tab_Content > .tabNavText { .nav-tabs > li.active > .tabNavContentContainer > .tab_Content > .tabNavText {
font-weight: bolder; font-weight: bolder;
border-bottom: 2px solid rgba(0,120,212,1); border-bottom: 2px solid rgba(0, 120, 212, 1);
} }
.nav-tabs > li.active:focus > .tabNavContentContainer { .nav-tabs > li.active:focus > .tabNavContentContainer {
@ -3096,4 +3097,3 @@ a:link {
background: white; background: white;
height: 100%; height: 100%;
} }

View File

@ -346,6 +346,22 @@ export default class DocumentsTab extends TabsBase {
return true; return true;
} }
/**
* Query first page of documents
* Select and query first document and display content
*/
private async autoPopulateContent() {
// reset iterator
this._documentsIterator = this.createIterator();
// load documents
await this.loadNextPage();
// Select first document and load content
if (this.documentIds().length > 0) {
this.documentIds()[0].click();
}
}
public onShowFilterClick(): Q.Promise<any> { public onShowFilterClick(): Q.Promise<any> {
this.isFilterCreated(true); this.isFilterCreated(true);
this.isFilterExpanded(true); this.isFilterExpanded(true);
@ -380,10 +396,7 @@ export default class DocumentsTab extends TabsBase {
this.documentIds([]); this.documentIds([]);
try { try {
// reset iterator await this.autoPopulateContent();
this._documentsIterator = this.createIterator();
// load documents
await this.loadNextPage();
// collapse filter // collapse filter
this.appliedFilter(this.filterContent()); this.appliedFilter(this.filterContent());
this.isFilterExpanded(false); this.isFilterExpanded(false);
@ -406,6 +419,11 @@ export default class DocumentsTab extends TabsBase {
this.queryAbortController.abort(); this.queryAbortController.abort();
} }
/**
* TODO Doesn't seem to be used: remove?
* @param clickedDocumentId
* @returns
*/
public onDocumentIdClick(clickedDocumentId: DocumentId): Q.Promise<any> { public onDocumentIdClick(clickedDocumentId: DocumentId): Q.Promise<any> {
if (this.editorState() !== ViewModels.DocumentExplorerState.noDocumentSelected) { if (this.editorState() !== ViewModels.DocumentExplorerState.noDocumentSelected) {
return Q(); return Q();
@ -624,8 +642,7 @@ export default class DocumentsTab extends TabsBase {
if (!this._documentsIterator) { if (!this._documentsIterator) {
try { try {
this._documentsIterator = this.createIterator(); await this.autoPopulateContent();
await this.loadNextPage();
} catch (error) { } catch (error) {
if (this.onLoadStartKey != null && this.onLoadStartKey != undefined) { if (this.onLoadStartKey != null && this.onLoadStartKey != undefined) {
TelemetryProcessor.traceFailure( TelemetryProcessor.traceFailure(