@fluid-topics/ft-search-results 1.1.65 → 1.1.67
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TemplateResult } from "lit";
|
|
1
|
+
import { PropertyValues, TemplateResult } from "lit";
|
|
2
2
|
import { ClusterPolicy, FtSearchResultsProperties } from "./ft-search-results.properties";
|
|
3
3
|
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
4
|
-
import type { FtSearchResultClusterEntry } from "@fluid-topics/public-api";
|
|
4
|
+
import type { FtPublicClusterSortCriterion, FtSearchResultClusterEntry } from "@fluid-topics/public-api";
|
|
5
5
|
import "@fluid-topics/ft-search-result-context";
|
|
6
6
|
import "@fluid-topics/ft-search-result-title";
|
|
7
7
|
import "@fluid-topics/ft-search-result-abstract";
|
|
@@ -11,11 +11,13 @@ export declare class FtSearchResults extends FtSearchResults_base implements FtS
|
|
|
11
11
|
clusterPolicy: ClusterPolicy;
|
|
12
12
|
displayNoResultsMessage: boolean;
|
|
13
13
|
renderResult: (resultOrCluster: FtSearchResultClusterEntry, index: number) => TemplateResult | string;
|
|
14
|
+
clusterSortCriterion: FtPublicClusterSortCriterion[];
|
|
14
15
|
private request?;
|
|
15
16
|
private results?;
|
|
16
17
|
private selectedResultByCluster;
|
|
17
18
|
constructor();
|
|
18
19
|
protected render(): unknown;
|
|
20
|
+
protected update(props: PropertyValues): void;
|
|
19
21
|
private onClusterChange;
|
|
20
22
|
private buildClusters;
|
|
21
23
|
private buildFullClusters;
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { repeat } from "lit/directives/repeat.js";
|
|
9
9
|
import { property } from "lit/decorators.js";
|
|
10
|
-
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { jsonProperty, redux } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { styles } from "./ft-search-results.styles";
|
|
12
12
|
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
13
13
|
import "@fluid-topics/ft-search-result-context";
|
|
@@ -24,6 +24,7 @@ class FtSearchResults extends withI18n(FtSearchComponent) {
|
|
|
24
24
|
<ft-search-result-title></ft-search-result-title>
|
|
25
25
|
<ft-search-result-abstract></ft-search-result-abstract>
|
|
26
26
|
`;
|
|
27
|
+
this.clusterSortCriterion = [];
|
|
27
28
|
this.selectedResultByCluster = {};
|
|
28
29
|
this.addI18nContext(resultsNumberContext);
|
|
29
30
|
}
|
|
@@ -44,6 +45,13 @@ class FtSearchResults extends withI18n(FtSearchComponent) {
|
|
|
44
45
|
`;
|
|
45
46
|
});
|
|
46
47
|
}
|
|
48
|
+
update(props) {
|
|
49
|
+
var _a;
|
|
50
|
+
super.update(props);
|
|
51
|
+
if (props.has("clusterSortCriterion") || props.has("stateManager") && this.clusterSortCriterion) {
|
|
52
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setClusterSortCriterion(this.clusterSortCriterion);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
onClusterChange(clusterId, result) {
|
|
48
56
|
this.selectedResultByCluster[clusterId] = result;
|
|
49
57
|
}
|
|
@@ -85,6 +93,9 @@ __decorate([
|
|
|
85
93
|
__decorate([
|
|
86
94
|
property({ attribute: false })
|
|
87
95
|
], FtSearchResults.prototype, "renderResult", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
jsonProperty([])
|
|
98
|
+
], FtSearchResults.prototype, "clusterSortCriterion", void 0);
|
|
88
99
|
__decorate([
|
|
89
100
|
redux()
|
|
90
101
|
], FtSearchResults.prototype, "request", void 0);
|
|
@@ -174,11 +174,11 @@ const Dt=Symbol.for(""),$t=t=>{if(t?.r===Dt)return t?._$litStatic$},Ft=t=>({_$li
|
|
|
174
174
|
`:this.editorMode?"Select a context and a label key.":e.nothing}update(t){var o;super.update(t),["context","key","defaultMessage"].some((o=>t.has(o)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(o=this.defaultMessage)&&void 0!==o?o:""})}}ze.elementDefinitions={},ze.styles=Ce,Ke([o.redux()],ze.prototype,"editorMode",void 0),Ke([a.property()],ze.prototype,"context",void 0),Ke([a.property()],ze.prototype,"key",void 0),Ke([o.jsonProperty([])],ze.prototype,"args",void 0),Ke([a.property()],ze.prototype,"defaultMessage",void 0);class Ae{static build(t){return new Ae(t)}static fromGwt(t){return new Ae(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,o)=>{const e=o;return t=>({context:this.name,key:e,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,o)=>(...t)=>Z.resolveMessage(this.name,o,...t)})}}o.customElement("ft-i18n")(ze);const ke=Ae.build("searchResultsNumber");var De=function(t,o,e,r){for(var a,i=arguments.length,n=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(a=t[l])&&(n=(i<3?a(n):i>3?a(o,e,n):a(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class $e extends(We(P)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>e.html`
|
|
175
175
|
<ft-search-result-title></ft-search-result-title>
|
|
176
176
|
<ft-search-result-abstract></ft-search-result-abstract>
|
|
177
|
-
`,this.selectedResultByCluster={},this.addI18nContext(ke)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return e.html`
|
|
177
|
+
`,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(ke)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return e.html`
|
|
178
178
|
<ft-typography part="no-results-message" variant="body1">${ke.messages.results(0)}</ft-typography>
|
|
179
179
|
`;const t=this.buildClusters();return r.repeat(t,(t=>t.id),((t,o)=>{var r;return e.html`
|
|
180
180
|
<ft-search-result-context .cluster=${t} index="${o}"
|
|
181
181
|
@ft-search-result-cluster-change="${o=>this.onClusterChange(t.id,o.detail)}">
|
|
182
182
|
${this.renderResult(null!==(r=this.selectedResultByCluster[t.id])&&void 0!==r?r:t.entries[0],o)}
|
|
183
183
|
</ft-search-result-context>
|
|
184
|
-
`}))}onClusterChange(t,o){this.selectedResultByCluster[t]=o}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,o;return null!==(o=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==o?o:[]}buildAllResultsClusters(){var t,o;let e=null!==(o=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==o?o:[];return this.request&&1===this.request.paging.page?e.slice(0,this.request.paging.perPage):e}clusterId(t){var o,e,r,a,i;return null!==(a=null!==(e=null===(o=t.map)||void 0===o?void 0:o.mapId)&&void 0!==e?e:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==a?a:null===(i=t.document)||void 0===i?void 0:i.documentId}}$e.styles=n,De([a.property({type:String,attribute:"cluster-policy"})],$e.prototype,"clusterPolicy",void 0),De([a.property({type:Boolean})],$e.prototype,"displayNoResultsMessage",void 0),De([a.property({attribute:!1})],$e.prototype,"renderResult",void 0),De([o.redux()],$e.prototype,"request",void 0),De([o.redux()],$e.prototype,"results",void 0),o.customElement("ft-search-results")($e),t.FtSearchResults=$e,t.FtSearchResultsCssVariables={},t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
184
|
+
`}))}update(t){var o;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(o=this.stateManager)||void 0===o||o.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,o){this.selectedResultByCluster[t]=o}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,o;return null!==(o=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==o?o:[]}buildAllResultsClusters(){var t,o;let e=null!==(o=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==o?o:[];return this.request&&1===this.request.paging.page?e.slice(0,this.request.paging.perPage):e}clusterId(t){var o,e,r,a,i;return null!==(a=null!==(e=null===(o=t.map)||void 0===o?void 0:o.mapId)&&void 0!==e?e:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==a?a:null===(i=t.document)||void 0===i?void 0:i.documentId}}$e.styles=n,De([a.property({type:String,attribute:"cluster-policy"})],$e.prototype,"clusterPolicy",void 0),De([a.property({type:Boolean})],$e.prototype,"displayNoResultsMessage",void 0),De([a.property({attribute:!1})],$e.prototype,"renderResult",void 0),De([o.jsonProperty([])],$e.prototype,"clusterSortCriterion",void 0),De([o.redux()],$e.prototype,"request",void 0),De([o.redux()],$e.prototype,"results",void 0),o.customElement("ft-search-results")($e),t.FtSearchResults=$e,t.FtSearchResultsCssVariables={},t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litRepeat,ftGlobals.litDecorators,ftGlobals.litUnsafeHTML);
|
|
@@ -344,11 +344,11 @@ function(t){return(e,o)=>{const{slot:r,selector:n}=t??{},i="slot"+(r?`[name=${r}
|
|
|
344
344
|
`:this.editorMode?"Select a context and a label key.":te}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}Tc.elementDefinitions={},Tc.styles=_c,Zc([Jn()],Tc.prototype,"editorMode",void 0),Zc([Se()],Tc.prototype,"context",void 0),Zc([Se()],Tc.prototype,"key",void 0),Zc([uo([])],Tc.prototype,"args",void 0),Zc([Se()],Tc.prototype,"defaultMessage",void 0);class Hc{static build(t){return new Hc(t)}static fromGwt(t){return new Hc(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Ws.resolveMessage(this.name,e,...t)})}}fo("ft-i18n")(Tc);const Gc=Hc.build("searchResultsNumber");var Vc=function(t,e,o,r){for(var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a};class qc extends(Dc(js)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>Jt`
|
|
345
345
|
<ft-search-result-title></ft-search-result-title>
|
|
346
346
|
<ft-search-result-abstract></ft-search-result-abstract>
|
|
347
|
-
`,this.selectedResultByCluster={},this.addI18nContext(Gc)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
|
|
347
|
+
`,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(Gc)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
|
|
348
348
|
<ft-typography part="no-results-message" variant="body1">${Gc.messages.results(0)}</ft-typography>
|
|
349
349
|
`;const t=this.buildClusters();return ze(t,(t=>t.id),((t,e)=>{var o;return Jt`
|
|
350
350
|
<ft-search-result-context .cluster=${t} index="${e}"
|
|
351
351
|
@ft-search-result-cluster-change="${e=>this.onClusterChange(t.id,e.detail)}">
|
|
352
352
|
${this.renderResult(null!==(o=this.selectedResultByCluster[t.id])&&void 0!==o?o:t.entries[0],e)}
|
|
353
353
|
</ft-search-result-context>
|
|
354
|
-
`}))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,n,i;return null!==(n=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==n?n:null===(i=t.document)||void 0===i?void 0:i.documentId}}qc.styles=is,Vc([Se({type:String,attribute:"cluster-policy"})],qc.prototype,"clusterPolicy",void 0),Vc([Se({type:Boolean})],qc.prototype,"displayNoResultsMessage",void 0),Vc([Se({attribute:!1})],qc.prototype,"renderResult",void 0),Vc([Jn()],qc.prototype,"request",void 0),Vc([Jn()],qc.prototype,"results",void 0),fo("ft-search-results")(qc),t.FtSearchResults=qc,t.FtSearchResultsCssVariables={},t.styles=is}({});
|
|
354
|
+
`}))}update(t){var e;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(e=this.stateManager)||void 0===e||e.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,n,i;return null!==(n=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==n?n:null===(i=t.document)||void 0===i?void 0:i.documentId}}qc.styles=is,Vc([Se({type:String,attribute:"cluster-policy"})],qc.prototype,"clusterPolicy",void 0),Vc([Se({type:Boolean})],qc.prototype,"displayNoResultsMessage",void 0),Vc([Se({attribute:!1})],qc.prototype,"renderResult",void 0),Vc([uo([])],qc.prototype,"clusterSortCriterion",void 0),Vc([Jn()],qc.prototype,"request",void 0),Vc([Jn()],qc.prototype,"results",void 0),fo("ft-search-results")(qc),t.FtSearchResults=qc,t.FtSearchResultsCssVariables={},t.styles=is}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-results",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.67",
|
|
4
4
|
"description": "Search result list for integrated search component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-search-result-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-search-result-context": "1.1.67",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.1.67",
|
|
24
24
|
"lit": "3.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@fluid-topics/public-api": "1.0.
|
|
27
|
+
"@fluid-topics/public-api": "1.0.67"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "8cda0812a8caec5b6d25c11e3dd416c005aca66a"
|
|
30
30
|
}
|