1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-06 18:16:18 +00:00
TiddlyWiki5/core/ui/SideBarSegments/search.tid

80 lines
3.4 KiB
Plaintext
Raw Normal View History

2018-08-02 12:22:21 +00:00
title: $:/core/ui/SideBarSegments/search
tags: $:/tags/SideBarSegment
\whitespace trim
\define count-popup-button()
\whitespace trim
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="searchTerm" value={{{ [<searchTiddler>get[text]] }}}>
<$set name="resultCount" value="""<$count filter="[!is[system]search<searchTerm>]"/>""">
{{$:/language/Search/Matches}}
</$set>
</$set>
</$list>
</$button>
\end
\define search-results-list()
\whitespace trim
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
{{$:/core/ui/SearchResults}}
</$list>
\end
\define delete-state-tiddlers() <$action-deletetiddler $filter="[[$:/temp/search]] [<searchTiddler>] [<searchListState>]"/>
\define cancel-search-actions() <$action-deletetiddler $filter="[<__storeTitle__>] [<__tiddler__>] [<__selectionStateTitle__>]"/>
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
<div class="tc-sidebar-lists tc-sidebar-search">
2018-08-02 12:22:21 +00:00
<$vars searchTiddler="$:/temp/search/input" searchListState=<<qualify "$:/state/search-list/selected-item">> titleSearchFilter="[!is[system]search:title<userInput>sort[title]limit[250]]" allSearchFilter="[!is[system]search<userInput>sort[title]limit[250]]">
2018-08-02 12:22:21 +00:00
<div class="tc-search">
<$macrocall $name="keyboard-driven-input" tiddler="$:/temp/search" storeTitle=<<searchTiddler>>
selectionStateTitle=<<searchListState>> refreshTitle="$:/temp/search/refresh" type="search"
tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify "$:/state/popup/search-dropdown">>
class="tc-popup-handle" primaryListFilter=<<titleSearchFilter>> secondaryListFilter=<<allSearchFilter>>
filterMinLength={{$:/config/Search/MinLength}} inputCancelActions=<<cancel-search-actions>>
inputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> cancelPopups="yes" />
<$reveal state=<<searchTiddler>> type="nomatch" text="">
2018-08-02 12:22:21 +00:00
<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
<$action-setfield $tiddler="$:/temp/advancedsearch" text={{$:/temp/search}}/>
<<delete-state-tiddlers>>
2018-08-02 12:22:21 +00:00
<$action-navigate $to="$:/AdvancedSearch"/>
{{$:/core/images/advanced-search-button}}
</$button>
<$button class="tc-btn-invisible">
<<delete-state-tiddlers>>
2018-08-02 12:22:21 +00:00
{{$:/core/images/close-button}}
</$button>
<<count-popup-button>>
2018-08-02 12:22:21 +00:00
</$reveal>
<$reveal state=<<searchTiddler>> type="match" text="">
2018-08-02 12:22:21 +00:00
<$button to="$:/AdvancedSearch" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
{{$:/core/images/advanced-search-button}}
</$button>
</$reveal>
</div>
<$reveal tag="div" class="tc-block-dropdown-wrapper" state=<<searchTiddler>> type="nomatch" text="">
2018-08-02 12:22:21 +00:00
<$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<<qualify "$:/state/popup/search-dropdown">> type="nomatch" text="" default="">
<<search-results-list>>
2018-08-02 12:22:21 +00:00
</$reveal>
</$reveal>
</$vars>
2018-08-02 12:22:21 +00:00
</div>