diff options
| author | bobzel <zzzman@gmail.com> | 2024-01-27 12:43:20 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-01-27 12:43:20 -0500 |
| commit | e17a812f8a8a2c389bf098f7a30c8326881d4dc6 (patch) | |
| tree | 13c227b4eac488f51480732f7090aefbb8925b4a /src/client/views/search | |
| parent | 0ea81ce3582c739078b86ea3bc1b58bdeb3fe839 (diff) | |
added searchable flag to docoption types. fixed searchbox scrolling and showing results. added search by key and exact match.
Diffstat (limited to 'src/client/views/search')
| -rw-r--r-- | src/client/views/search/SearchBox.scss | 1 | ||||
| -rw-r--r-- | src/client/views/search/SearchBox.tsx | 27 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/client/views/search/SearchBox.scss b/src/client/views/search/SearchBox.scss index 09e459f7d..94e64b952 100644 --- a/src/client/views/search/SearchBox.scss +++ b/src/client/views/search/SearchBox.scss @@ -8,6 +8,7 @@ background: none; z-index: 1000; padding: 0px; + overflow: auto; cursor: default; .searchBox-bar { diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index c8caff9fa..0b664beaa 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -162,12 +162,13 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() { * which the first letter is capitalized. This is used when displaying the type on the * right side of each search result. */ - static formatType(type: String): String { - if (type === 'pdf') { - return 'PDF'; - } else if (type === 'image') { - return 'Img'; - } + static formatType(type: string, colType: string): String { + switch (type) { + case DocumentType.PDF : return 'PDF'; + case DocumentType.IMG : return 'Img'; + case DocumentType.RTF : return 'Rtf'; + case DocumentType.COL : return 'Col:'+colType.substring(0,3); + } // prettier-ignore return type.charAt(0).toUpperCase() + type.substring(1, 3); } @@ -183,7 +184,7 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() { @action searchCollection(query: string) { this._selectedResult = undefined; - this._results = SearchUtil.SearchCollection(CollectionDockingView.Instance?.Document, query); + this._results = SearchUtil.SearchCollection(CollectionDockingView.Instance?.Document, query, this._docTypeString === 'keys'); this.computePageRanks(); } @@ -357,11 +358,11 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() { */ @computed public get selectOptions() { - const selectValues = ['all', DocumentType.RTF, DocumentType.IMG, DocumentType.PDF, DocumentType.WEB, DocumentType.VID, DocumentType.AUDIO, DocumentType.COL]; + const selectValues = ['all', DocumentType.RTF, DocumentType.IMG, DocumentType.PDF, DocumentType.WEB, DocumentType.VID, DocumentType.AUDIO, DocumentType.COL, 'keys']; return selectValues.map(value => ( <option key={value} value={value}> - {SearchBox.formatType(value)} + {SearchBox.formatType(value, '')} </option> )); } @@ -387,10 +388,10 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() { className += ' searchBox-results-scroll-view-result-selected'; } - const formattedType = SearchBox.formatType(StrCast(result[0].type)); + const formattedType = SearchBox.formatType(StrCast(result[0].type), StrCast(result[0].type_collection)); const title = result[0].title; - if (this._docTypeString === 'all' || this._docTypeString === result[0].type) { + if (this._docTypeString === 'keys' || this._docTypeString === 'all' || this._docTypeString === result[0].type) { validResults++; resultsJSX.push( <Tooltip key={result[0][Id]} placement={'right'} title={<div className="dash-tooltip">{title as string}</div>}> @@ -412,7 +413,9 @@ export class SearchBox extends ViewBoxBaseComponent<SearchBoxProps>() { }} className={className}> <div className="searchBox-result-title">{title as string}</div> - <div className="searchBox-result-type">{formattedType}</div> + <div className="searchBox-result-type" style={{ color: SettingsManager.userVariantColor }}> + {formattedType} + </div> <div className="searchBox-result-keys" style={{ color: SettingsManager.userVariantColor }}> {result[1].join(', ')} </div> |
