@fluid-topics/ft-reader-search-in-document 1.1.59 → 1.1.60
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/build/ReaderSearchInDocumentMessages.d.ts +5 -0
- package/build/ReaderSearchInDocumentMessages.js +2 -0
- package/build/ft-reader-search-in-document.d.ts +1 -0
- package/build/ft-reader-search-in-document.js +4 -2
- package/build/ft-reader-search-in-document.light.js +7 -6
- package/build/ft-reader-search-in-document.min.js +7 -6
- package/package.json +14 -14
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
|
|
2
|
+
export interface ReaderSearchInDocumentMessages extends I18nMessages {
|
|
3
|
+
placeholder(): string;
|
|
4
|
+
}
|
|
5
|
+
export declare const readerSearchInDocumentContext: I18nMessageContext<ReaderSearchInDocumentMessages>;
|
|
@@ -10,6 +10,7 @@ declare const FtReaderSearchInDocument_base: typeof FtReaderComponent & import("
|
|
|
10
10
|
export declare class FtReaderSearchInDocument extends FtReaderSearchInDocument_base implements FtReaderSearchInDocumentProperties {
|
|
11
11
|
static elementDefinitions: ElementDefinitionsMap;
|
|
12
12
|
static styles: import("lit").CSSResult;
|
|
13
|
+
constructor();
|
|
13
14
|
map?: FtMap;
|
|
14
15
|
private searchInDocumentQuery;
|
|
15
16
|
private searchContext?;
|
|
@@ -22,9 +22,10 @@ import { property, query } from "lit/decorators.js";
|
|
|
22
22
|
import { FtSearchLoadMoreButton } from "@fluid-topics/ft-search-load-more-button";
|
|
23
23
|
import { getResultUrl, SearchResultClickEvent } from "@fluid-topics/ft-search-result-context/build/utils";
|
|
24
24
|
import { SearchInDocumentEvent } from "./events";
|
|
25
|
+
import { readerSearchInDocumentContext } from "./ReaderSearchInDocumentMessages";
|
|
25
26
|
class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
26
27
|
constructor() {
|
|
27
|
-
super(
|
|
28
|
+
super();
|
|
28
29
|
this.searchInDocumentQuery = "";
|
|
29
30
|
this.hideResultTitle = false;
|
|
30
31
|
this.hideResultBreadcrumb = false;
|
|
@@ -32,6 +33,7 @@ class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
|
32
33
|
this.hideResultsNumber = false;
|
|
33
34
|
this.userHasDoneManualAction = false;
|
|
34
35
|
this.uniqueId = "search-in-document-" + ("" + Math.round(Math.random() * 999000)).padStart(6, "0");
|
|
36
|
+
this.addI18nContext(readerSearchInDocumentContext);
|
|
35
37
|
}
|
|
36
38
|
get filters() {
|
|
37
39
|
return [
|
|
@@ -88,7 +90,7 @@ class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
|
88
90
|
}
|
|
89
91
|
}}>
|
|
90
92
|
<div class="ft-search-in-doc--container">
|
|
91
|
-
<ft-search-input @change="${() => this.userHasDoneManualAction = true}"></ft-search-input>
|
|
93
|
+
<ft-search-input placeholder=${readerSearchInDocumentContext.messages.placeholder()} @change="${() => this.userHasDoneManualAction = true}"></ft-search-input>
|
|
92
94
|
${this.hideResultsNumber ? nothing : html `
|
|
93
95
|
<ft-search-results-number @ft-search-result-click=${(e) => e.stopPropagation()}></ft-search-results-number>
|
|
94
96
|
`}
|
|
@@ -1123,15 +1123,16 @@ const Do=Symbol.for(""),Bo=t=>{if(t?.r===Do)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
1123
1123
|
</div>
|
|
1124
1124
|
`}onSuggestKeyDown(t){var o,e,r,i,n,a;switch(t.key){case"ArrowUp":null===(r=null!==(e=null===(o=this.getFocusedSuggestionElement())||void 0===o?void 0:o.previousElementSibling)&&void 0!==e?e:this.getLastSuggestionElement())||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(i=this.getFocusedSuggestionElement())||void 0===i?void 0:i.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,o){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,o)}onSuggestSelected(t,o){t.preventDefault(),this.dispatchEvent(new Di(o))}getIcon(t){const o="DOCUMENT"===t.type?or.file_format:or.fluid_topics;let r;switch(t.type){case"MAP":r="BOOK"===t.editorialType?Ye.BOOK:Ye.ARTICLE;break;case"DOCUMENT":r=function(t,o){var e,r,i,n;t=(null!=t?t:"").toLowerCase(),o=(null!=o?o:"").toLowerCase();const[a,l]=((null!==(e=tr.get(t))&&void 0!==e?e:t)+"/").split("/");return null!==(n=null!==(i=null!==(r=Je.get(l))&&void 0!==r?r:Je.get(o))&&void 0!==i?i:Je.get(a))&&void 0!==n?n:Ve.UNKNOWN}(t.mimeType,t.filenameExtension);break;case"TOPIC":r=Ye.TOPICS}return e.html`
|
|
1125
1125
|
<ft-icon .variant="${o}" .value="${r}" part="suggestion-icon"></ft-icon>
|
|
1126
|
-
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};Bi.elementDefinitions={"ft-ripple":to,"ft-typography":jo,"ft-icon":rr},Bi.styles=[o.wordWrap,Ki],Ai([o.redux()],Bi.prototype,"suggestResults",void 0),Bi=Ai([r.customElement("ft-search-input-suggestion")],Bi);var Fi=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Ti extends(Tr(xi)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.addI18nContext(Zi)}render(){var t,o;let r={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(o=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==o&&o,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return e.html`
|
|
1126
|
+
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};Bi.elementDefinitions={"ft-ripple":to,"ft-typography":jo,"ft-icon":rr},Bi.styles=[o.wordWrap,Ki],Ai([o.redux()],Bi.prototype,"suggestResults",void 0),Bi=Ai([r.customElement("ft-search-input-suggestion")],Bi);var Fi=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Ti extends(Tr(xi)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.placeholder=Zi.messages.placeholder(),this.addI18nContext(Zi)}render(){var t,o;let r={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(o=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==o&&o,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return e.html`
|
|
1127
1127
|
<div class="${i.classMap(r)}" @focusout=${()=>this.forceCloseSuggestion=!1}>
|
|
1128
1128
|
<div class="ft-search-input--input-container" part="input-container" tabindex="-1">
|
|
1129
1129
|
<div class="ft-search-input--input-outline" part="input-outline">
|
|
1130
1130
|
<input class="ft-search-input--input ft-typography--body2"
|
|
1131
1131
|
part="input"
|
|
1132
1132
|
type="text"
|
|
1133
|
-
placeholder="${
|
|
1133
|
+
placeholder="${this.placeholder}"
|
|
1134
1134
|
.value="${this.liveQuery}"
|
|
1135
|
+
@input=${t=>this.onInput(t)}
|
|
1135
1136
|
@keydown=${t=>this.onSearchBarKeyDown(t)}
|
|
1136
1137
|
@keyup=${t=>this.onSearchBarKeyUp(t)}>
|
|
1137
1138
|
</div>
|
|
@@ -1160,7 +1161,7 @@ const Do=Symbol.for(""),Bo=t=>{if(t?.r===Do)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
1160
1161
|
></ft-button>
|
|
1161
1162
|
</div>
|
|
1162
1163
|
</div>
|
|
1163
|
-
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){
|
|
1164
|
+
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){switch(t.key){case"Backspace":t.stopPropagation();break;case"Enter":this.launchSearch(this.input.value)}}onInput(t){var o;null===(o=this.stateManager)||void 0===o||o.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(t){var o;null===(o=this.stateManager)||void 0===o||o.setQuery(t),this.forceCloseSuggestion=!0,this.dispatchEvent(new CustomEvent("change"))}onSuggestionSelected(t){this.launchSearch(t.detail)}}Ti.elementDefinitions={"ft-search-input-suggestion":Bi,"ft-button":sr},Ti.styles=[Wt,hr],Fi([o.redux()],Ti.prototype,"request",void 0),Fi([o.redux()],Ti.prototype,"liveQuery",void 0),Fi([o.redux()],Ti.prototype,"suggestResults",void 0),Fi([r.state()],Ti.prototype,"forceCloseSuggestion",void 0),Fi([r.property({type:String})],Ti.prototype,"placeholder",void 0),Fi([r.query(".ft-search-input--input")],Ti.prototype,"input",void 0),Fi([r.query("ft-search-input-suggestion")],Ti.prototype,"suggestion",void 0),o.customElement("ft-search-input")(Ti);const Hi=e.css`
|
|
1164
1165
|
[part="no-results-message"] {
|
|
1165
1166
|
text-align: center;
|
|
1166
1167
|
padding: 12px;
|
|
@@ -1222,7 +1223,7 @@ const Do=Symbol.for(""),Bo=t=>{if(t?.r===Do)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
1222
1223
|
<ft-button @click="${this.loadMore}">
|
|
1223
1224
|
${pn.messages.searchPageLoadMore()}
|
|
1224
1225
|
</ft-button>
|
|
1225
|
-
`}loadMore(){var t;null===(t=this.stateManager)||void 0===t||t.setPageNumber(this.currentPage+1)}}dn.elementDefinitions={"ft-button":sr},dn.styles=cn,fn([o.redux({store:"search",selector:t=>{var o,e;return null!==(e=null===(o=t.paging)||void 0===o?void 0:o.currentPage)&&void 0!==e?e:1}})],dn.prototype,"currentPage",void 0),fn([o.redux({store:"search",selector:t=>{var o,e;return null===(e=null===(o=t.paging)||void 0===o?void 0:o.isLastPage)||void 0===e||e}})],dn.prototype,"isLastPage",void 0),o.customElement("ft-search-load-more-button")(dn);class hn extends CustomEvent{constructor(t){super("ft-reader-search-in-document",{composed:!0,bubbles:!0,detail:t})}}
|
|
1226
|
+
`}loadMore(){var t;null===(t=this.stateManager)||void 0===t||t.setPageNumber(this.currentPage+1)}}dn.elementDefinitions={"ft-button":sr},dn.styles=cn,fn([o.redux({store:"search",selector:t=>{var o,e;return null!==(e=null===(o=t.paging)||void 0===o?void 0:o.currentPage)&&void 0!==e?e:1}})],dn.prototype,"currentPage",void 0),fn([o.redux({store:"search",selector:t=>{var o,e;return null===(e=null===(o=t.paging)||void 0===o?void 0:o.isLastPage)||void 0===e||e}})],dn.prototype,"isLastPage",void 0),o.customElement("ft-search-load-more-button")(dn);class hn extends CustomEvent{constructor(t){super("ft-reader-search-in-document",{composed:!0,bubbles:!0,detail:t})}}const un=Gr.build("designedReaderSearchInDocument");var gn=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class yn extends(Tr(Ri)){constructor(){super(),this.searchInDocumentQuery="",this.hideResultTitle=!1,this.hideResultBreadcrumb=!1,this.hideResultAbstract=!1,this.hideResultsNumber=!1,this.userHasDoneManualAction=!1,this.uniqueId="search-in-document-"+(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.addI18nContext(un)}get filters(){return[{negative:!1,key:"ft:publicationId",values:[this.map.id]}]}renderResult(t,o){var r;return e.html`
|
|
1226
1227
|
<style> ${vr}</style>
|
|
1227
1228
|
<a href="${Ji(t)}" @click="${()=>this.onLinkClick(t,o)} }">
|
|
1228
1229
|
<ft-card clickable noheader>
|
|
@@ -1248,7 +1249,7 @@ const Do=Symbol.for(""),Bo=t=>{if(t?.r===Do)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
1248
1249
|
@ft-search-request-change=${t=>{var o;return null===(o=this.stateManager)||void 0===o?void 0:o.setSearchInDocumentQuery(t.detail.query)}}
|
|
1249
1250
|
@ft-search-results-change=${t=>{var o,e;this.userHasDoneManualAction&&(this.dispatchEvent(new hn({mapId:this.map.id,mapTitle:this.map.title,metadata:null!==(e=null===(o=this.map)||void 0===o?void 0:o.metadata)&&void 0!==e?e:[],query:t.detail.request.query,searchResultsCount:t.detail.paging.totalResultsCount})),this.userHasDoneManualAction=!1)}}>
|
|
1250
1251
|
<div class="ft-search-in-doc--container">
|
|
1251
|
-
<ft-search-input @change="${()=>this.userHasDoneManualAction=!0}"></ft-search-input>
|
|
1252
|
+
<ft-search-input placeholder=${un.messages.placeholder()} @change="${()=>this.userHasDoneManualAction=!0}"></ft-search-input>
|
|
1252
1253
|
${this.hideResultsNumber?e.nothing:e.html`
|
|
1253
1254
|
<ft-search-results-number @ft-search-result-click=${t=>t.stopPropagation()}></ft-search-results-number>
|
|
1254
1255
|
`}
|
|
@@ -1261,4 +1262,4 @@ const Do=Symbol.for(""),Bo=t=>{if(t?.r===Do)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
1261
1262
|
</slot>
|
|
1262
1263
|
</div>
|
|
1263
1264
|
</ft-search-context>
|
|
1264
|
-
`:e.nothing}update(t){super.update(t),t.has("map")&&this.searchContext&&this.searchContext.clear(),["hideResultTitle","hideResultBreadcrumb","hideResultAbstract"].some((o=>t.has(o)))&&this.searchResults&&this.searchResults.requestUpdate()}onLinkClick(t,o){this.dispatchEvent(new on(t,o))}}
|
|
1265
|
+
`:e.nothing}update(t){super.update(t),t.has("map")&&this.searchContext&&this.searchContext.clear(),["hideResultTitle","hideResultBreadcrumb","hideResultAbstract"].some((o=>t.has(o)))&&this.searchResults&&this.searchResults.requestUpdate()}onLinkClick(t,o){this.dispatchEvent(new on(t,o))}}yn.elementDefinitions={"ft-button":sr,"ft-typography":jo,"ft-search-context":Ci,"ft-search-input":Ti,"ft-search-results-number":zi,"ft-search-results":an,"ft-search-load-more-button":dn},yn.styles=xr,gn([o.redux()],yn.prototype,"map",void 0),gn([o.redux()],yn.prototype,"searchInDocumentQuery",void 0),gn([r.query("ft-search-context")],yn.prototype,"searchContext",void 0),gn([r.query("ft-search-results")],yn.prototype,"searchResults",void 0),gn([r.property({type:Boolean})],yn.prototype,"hideResultTitle",void 0),gn([r.property({type:Boolean})],yn.prototype,"hideResultBreadcrumb",void 0),gn([r.property({type:Boolean})],yn.prototype,"hideResultAbstract",void 0),gn([r.property({type:Boolean})],yn.prototype,"hideResultsNumber",void 0),o.customElement("ft-reader-search-in-document")(yn),t.FtReaderSearchInDocument=yn,t.FtReaderSearchInDocumentCssVariables=mr,t.resultStyles=vr,t.styles=xr}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML,ftGlobals.litRepeat);
|
|
@@ -1293,15 +1293,16 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
|
|
|
1293
1293
|
</div>
|
|
1294
1294
|
`}onSuggestKeyDown(t){var e,o,r,i,n,a;switch(t.key){case"ArrowUp":null===(r=null!==(o=null===(e=this.getFocusedSuggestionElement())||void 0===e?void 0:e.previousElementSibling)&&void 0!==o?o:this.getLastSuggestionElement())||void 0===r||r.focus(),t.preventDefault(),t.stopPropagation();break;case"ArrowDown":null===(a=null!==(n=null===(i=this.getFocusedSuggestionElement())||void 0===i?void 0:i.nextElementSibling)&&void 0!==n?n:this.getFirstSuggestionElement())||void 0===a||a.focus(),t.preventDefault(),t.stopPropagation()}}onSuggestKeyUp(t,e){"Enter"!==t.key&&" "!==t.key||this.onSuggestSelected(t,e)}onSuggestSelected(t,e){t.preventDefault(),this.dispatchEvent(new Qu(e))}getIcon(t){const e="DOCUMENT"===t.type?yc.file_format:yc.fluid_topics;let o;switch(t.type){case"MAP":o="BOOK"===t.editorialType?uc.BOOK:uc.ARTICLE;break;case"DOCUMENT":o=function(t,e){var o,r,i,n;t=(null!=t?t:"").toLowerCase(),e=(null!=e?e:"").toLowerCase();const[a,s]=((null!==(o=gc.get(t))&&void 0!==o?o:t)+"/").split("/");return null!==(n=null!==(i=null!==(r=pc.get(s))&&void 0!==r?r:pc.get(e))&&void 0!==i?i:pc.get(a))&&void 0!==n?n:fc.UNKNOWN}(t.mimeType,t.filenameExtension);break;case"TOPIC":o=uc.TOPICS}return Jt`
|
|
1295
1295
|
<ft-icon .variant="${e}" .value="${o}" part="suggestion-icon"></ft-icon>
|
|
1296
|
-
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};tf.elementDefinitions={"ft-ripple":Ql,"ft-typography":sc,"ft-icon":mc},tf.styles=[Yi,Ju],Xu([on()],tf.prototype,"suggestResults",void 0),tf=Xu([xe("ft-search-input-suggestion")],tf);var ef=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class of extends(ou(Au)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.addI18nContext(Yu)}render(){var t,e;let o={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(e=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==e&&e,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return Jt`
|
|
1296
|
+
`}getFocusedSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion:focus-within")}getLastSuggestionElement(){let t=this.shadowRoot.querySelectorAll(".ft-search-input-suggestion--suggestion");return t.length>0?t[t.length-1]:null}getFirstSuggestionElement(){return this.shadowRoot.querySelector(".ft-search-input-suggestion--suggestion")}focusFirstSuggestion(){var t;null===(t=this.getFirstSuggestionElement())||void 0===t||t.focus()}};tf.elementDefinitions={"ft-ripple":Ql,"ft-typography":sc,"ft-icon":mc},tf.styles=[Yi,Ju],Xu([on()],tf.prototype,"suggestResults",void 0),tf=Xu([xe("ft-search-input-suggestion")],tf);var ef=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class of extends(ou(Au)){constructor(){super(),this.liveQuery="",this.forceCloseSuggestion=!1,this.placeholder=Yu.messages.placeholder(),this.addI18nContext(Yu)}render(){var t,e;let o={"ft-search-input":!0,"ft-search-input--with-suggestions":null!==(e=null===(t=this.suggestResults)||void 0===t?void 0:t.length)&&void 0!==e&&e,"ft-search-input--with-suggestions-closed":this.forceCloseSuggestion};return Jt`
|
|
1297
1297
|
<div class="${Ke(o)}" @focusout=${()=>this.forceCloseSuggestion=!1}>
|
|
1298
1298
|
<div class="ft-search-input--input-container" part="input-container" tabindex="-1">
|
|
1299
1299
|
<div class="ft-search-input--input-outline" part="input-outline">
|
|
1300
1300
|
<input class="ft-search-input--input ft-typography--body2"
|
|
1301
1301
|
part="input"
|
|
1302
1302
|
type="text"
|
|
1303
|
-
placeholder="${
|
|
1303
|
+
placeholder="${this.placeholder}"
|
|
1304
1304
|
.value="${this.liveQuery}"
|
|
1305
|
+
@input=${t=>this.onInput(t)}
|
|
1305
1306
|
@keydown=${t=>this.onSearchBarKeyDown(t)}
|
|
1306
1307
|
@keyup=${t=>this.onSearchBarKeyUp(t)}>
|
|
1307
1308
|
</div>
|
|
@@ -1330,7 +1331,7 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
|
|
|
1330
1331
|
></ft-button>
|
|
1331
1332
|
</div>
|
|
1332
1333
|
</div>
|
|
1333
|
-
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){
|
|
1334
|
+
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){switch(t.key){case"Backspace":t.stopPropagation();break;case"Enter":this.launchSearch(this.input.value)}}onInput(t){var e;null===(e=this.stateManager)||void 0===e||e.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(t){var e;null===(e=this.stateManager)||void 0===e||e.setQuery(t),this.forceCloseSuggestion=!0,this.dispatchEvent(new CustomEvent("change"))}onSuggestionSelected(t){this.launchSearch(t.detail)}}of.elementDefinitions={"ft-search-input-suggestion":tf,"ft-button":Sc},of.styles=[Ul,$c],ef([on()],of.prototype,"request",void 0),ef([on()],of.prototype,"liveQuery",void 0),ef([on()],of.prototype,"suggestResults",void 0),ef([Ce()],of.prototype,"forceCloseSuggestion",void 0),ef([Se({type:String})],of.prototype,"placeholder",void 0),ef([Re(".ft-search-input--input")],of.prototype,"input",void 0),ef([Re("ft-search-input-suggestion")],of.prototype,"suggestion",void 0),go("ft-search-input")(of);const rf=ht`
|
|
1334
1335
|
[part="no-results-message"] {
|
|
1335
1336
|
text-align: center;
|
|
1336
1337
|
padding: 12px;
|
|
@@ -1392,7 +1393,7 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
|
|
|
1392
1393
|
<ft-button @click="${this.loadMore}">
|
|
1393
1394
|
${Nf.messages.searchPageLoadMore()}
|
|
1394
1395
|
</ft-button>
|
|
1395
|
-
`}loadMore(){var t;null===(t=this.stateManager)||void 0===t||t.setPageNumber(this.currentPage+1)}}Rf.elementDefinitions={"ft-button":Sc},Rf.styles=Cf,Ef([on({store:"search",selector:t=>{var e,o;return null!==(o=null===(e=t.paging)||void 0===e?void 0:e.currentPage)&&void 0!==o?o:1}})],Rf.prototype,"currentPage",void 0),Ef([on({store:"search",selector:t=>{var e,o;return null===(o=null===(e=t.paging)||void 0===e?void 0:e.isLastPage)||void 0===o||o}})],Rf.prototype,"isLastPage",void 0),go("ft-search-load-more-button")(Rf);class $f extends CustomEvent{constructor(t){super("ft-reader-search-in-document",{composed:!0,bubbles:!0,detail:t})}}
|
|
1396
|
+
`}loadMore(){var t;null===(t=this.stateManager)||void 0===t||t.setPageNumber(this.currentPage+1)}}Rf.elementDefinitions={"ft-button":Sc},Rf.styles=Cf,Ef([on({store:"search",selector:t=>{var e,o;return null!==(o=null===(e=t.paging)||void 0===e?void 0:e.currentPage)&&void 0!==o?o:1}})],Rf.prototype,"currentPage",void 0),Ef([on({store:"search",selector:t=>{var e,o;return null===(o=null===(e=t.paging)||void 0===e?void 0:e.isLastPage)||void 0===o||o}})],Rf.prototype,"isLastPage",void 0),go("ft-search-load-more-button")(Rf);class $f extends CustomEvent{constructor(t){super("ft-reader-search-in-document",{composed:!0,bubbles:!0,detail:t})}}const If=su.build("designedReaderSearchInDocument");var kf=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Lf extends(ou(Ku)){constructor(){super(),this.searchInDocumentQuery="",this.hideResultTitle=!1,this.hideResultBreadcrumb=!1,this.hideResultAbstract=!1,this.hideResultsNumber=!1,this.userHasDoneManualAction=!1,this.uniqueId="search-in-document-"+(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.addI18nContext(If)}get filters(){return[{negative:!1,key:"ft:publicationId",values:[this.map.id]}]}renderResult(t,e){var o;return Jt`
|
|
1396
1397
|
<style> ${Bc}</style>
|
|
1397
1398
|
<a href="${gf(t)}" @click="${()=>this.onLinkClick(t,e)} }">
|
|
1398
1399
|
<ft-card clickable noheader>
|
|
@@ -1418,7 +1419,7 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
|
|
|
1418
1419
|
@ft-search-request-change=${t=>{var e;return null===(e=this.stateManager)||void 0===e?void 0:e.setSearchInDocumentQuery(t.detail.query)}}
|
|
1419
1420
|
@ft-search-results-change=${t=>{var e,o;this.userHasDoneManualAction&&(this.dispatchEvent(new $f({mapId:this.map.id,mapTitle:this.map.title,metadata:null!==(o=null===(e=this.map)||void 0===e?void 0:e.metadata)&&void 0!==o?o:[],query:t.detail.request.query,searchResultsCount:t.detail.paging.totalResultsCount})),this.userHasDoneManualAction=!1)}}>
|
|
1420
1421
|
<div class="ft-search-in-doc--container">
|
|
1421
|
-
<ft-search-input @change="${()=>this.userHasDoneManualAction=!0}"></ft-search-input>
|
|
1422
|
+
<ft-search-input placeholder=${If.messages.placeholder()} @change="${()=>this.userHasDoneManualAction=!0}"></ft-search-input>
|
|
1422
1423
|
${this.hideResultsNumber?te:Jt`
|
|
1423
1424
|
<ft-search-results-number @ft-search-result-click=${t=>t.stopPropagation()}></ft-search-results-number>
|
|
1424
1425
|
`}
|
|
@@ -1431,4 +1432,4 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
|
|
|
1431
1432
|
</slot>
|
|
1432
1433
|
</div>
|
|
1433
1434
|
</ft-search-context>
|
|
1434
|
-
`:te}update(t){super.update(t),t.has("map")&&this.searchContext&&this.searchContext.clear(),["hideResultTitle","hideResultBreadcrumb","hideResultAbstract"].some((e=>t.has(e)))&&this.searchResults&&this.searchResults.requestUpdate()}onLinkClick(t,e){this.dispatchEvent(new bf(t,e))}}
|
|
1435
|
+
`:te}update(t){super.update(t),t.has("map")&&this.searchContext&&this.searchContext.clear(),["hideResultTitle","hideResultBreadcrumb","hideResultAbstract"].some((e=>t.has(e)))&&this.searchResults&&this.searchResults.requestUpdate()}onLinkClick(t,e){this.dispatchEvent(new bf(t,e))}}Lf.elementDefinitions={"ft-button":Sc,"ft-typography":sc,"ft-search-context":ju,"ft-search-input":of,"ft-search-results-number":qu,"ft-search-results":Of,"ft-search-load-more-button":Rf},Lf.styles=Ac,kf([on()],Lf.prototype,"map",void 0),kf([on()],Lf.prototype,"searchInDocumentQuery",void 0),kf([Re("ft-search-context")],Lf.prototype,"searchContext",void 0),kf([Re("ft-search-results")],Lf.prototype,"searchResults",void 0),kf([Se({type:Boolean})],Lf.prototype,"hideResultTitle",void 0),kf([Se({type:Boolean})],Lf.prototype,"hideResultBreadcrumb",void 0),kf([Se({type:Boolean})],Lf.prototype,"hideResultAbstract",void 0),kf([Se({type:Boolean})],Lf.prototype,"hideResultsNumber",void 0),go("ft-reader-search-in-document")(Lf),t.FtReaderSearchInDocument=Lf,t.FtReaderSearchInDocumentCssVariables=Wc,t.resultStyles=Bc,t.styles=Ac}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-search-in-document",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.60",
|
|
4
4
|
"description": "A search component to retrieve occurrences in documents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-button": "1.1.
|
|
23
|
-
"@fluid-topics/ft-card": "1.1.
|
|
24
|
-
"@fluid-topics/ft-i18n": "1.1.
|
|
25
|
-
"@fluid-topics/ft-search-context": "1.1.
|
|
26
|
-
"@fluid-topics/ft-search-input": "1.1.
|
|
27
|
-
"@fluid-topics/ft-search-load-more-button": "1.1.
|
|
28
|
-
"@fluid-topics/ft-search-result-abstract": "1.1.
|
|
29
|
-
"@fluid-topics/ft-search-result-title": "1.1.
|
|
30
|
-
"@fluid-topics/ft-search-results": "1.1.
|
|
31
|
-
"@fluid-topics/ft-search-results-number": "1.1.
|
|
32
|
-
"@fluid-topics/ft-typography": "1.1.
|
|
33
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-button": "1.1.60",
|
|
23
|
+
"@fluid-topics/ft-card": "1.1.60",
|
|
24
|
+
"@fluid-topics/ft-i18n": "1.1.60",
|
|
25
|
+
"@fluid-topics/ft-search-context": "1.1.60",
|
|
26
|
+
"@fluid-topics/ft-search-input": "1.1.60",
|
|
27
|
+
"@fluid-topics/ft-search-load-more-button": "1.1.60",
|
|
28
|
+
"@fluid-topics/ft-search-result-abstract": "1.1.60",
|
|
29
|
+
"@fluid-topics/ft-search-result-title": "1.1.60",
|
|
30
|
+
"@fluid-topics/ft-search-results": "1.1.60",
|
|
31
|
+
"@fluid-topics/ft-search-results-number": "1.1.60",
|
|
32
|
+
"@fluid-topics/ft-typography": "1.1.60",
|
|
33
|
+
"@fluid-topics/ft-wc-utils": "1.1.60",
|
|
34
34
|
"@fluid-topics/public-api": "1.0.63",
|
|
35
35
|
"lit": "3.1.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "508d561509be8c615dfc3de6780ab51e87c2fb22"
|
|
38
38
|
}
|