@fluid-topics/ft-search-result-metadata 1.1.94 → 1.1.96
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.
|
@@ -212,9 +212,9 @@ class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultCompo
|
|
|
212
212
|
return "";
|
|
213
213
|
}
|
|
214
214
|
findClusterMetadataLabel() {
|
|
215
|
-
var _a;
|
|
215
|
+
var _a, _b;
|
|
216
216
|
const metadata = (_a = this.cluster) === null || _a === void 0 ? void 0 : _a.entries.flatMap(result => this.resultData(result).metadata.filter(m => m.key == this.key))[0];
|
|
217
|
-
return metadata === null || metadata === void 0 ? void 0 : metadata.label;
|
|
217
|
+
return (_b = metadata === null || metadata === void 0 ? void 0 : metadata.label) !== null && _b !== void 0 ? _b : this.key;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
FtSearchResultMetadata.elementDefinitions = {
|
|
@@ -994,6 +994,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
|
|
|
994
994
|
.iconVariant=${this.iconVariant}
|
|
995
995
|
icon="${this.internalIcon}"
|
|
996
996
|
label="${this.iconLabel}"
|
|
997
|
+
tooltipposition="top"
|
|
997
998
|
part="icon-button"
|
|
998
999
|
></ft-button>
|
|
999
1000
|
`:Mo.html`
|
|
@@ -1304,7 +1305,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
|
|
|
1304
1305
|
${this.metadataValue.length===0?pe.nothing:pe.html`
|
|
1305
1306
|
<span part="values">${this.metadataValue}</span>
|
|
1306
1307
|
`}
|
|
1307
|
-
`}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?gr.messages.noValuePresent(this.key):gr.messages.noKeySelected():Go.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var t,o,n;let i=(n=(o=(t=this.cluster)===null||t===void 0?void 0:t.entries)===null||o===void 0?void 0:o.map(a=>xt.ClusteringHelper.extractResultMetadata(a)))===null||n===void 0?void 0:n.map(a=>{var s;return(s=a.find(c=>c.key==this.key))===null||s===void 0?void 0:s.value});return new Set(i).size>1}getEllipsis(t){let o=this.maxLength?t.substring(0,this.maxLength):t;return o+(o.length<t.length?"\u2026":"")}update(t){var o,n,i,a,s,c,p,u,f;super.update(t),(t.has("result")||t.has("key")&&this.result||this.dateFormatOptionsChanged(t))&&(this.metadata=this.formatDateValues((o=this.resultData())===null||o===void 0?void 0:o.metadata.find(m=>m.key==this.key&&m.values.length>0)),this.metadataLabel=(i=(n=this.metadata)===null||n===void 0?void 0:n.label)!==null&&i!==void 0?i:this.findClusterMetadataLabel(),this.flatMetadata=xt.ClusteringHelper.flattenMetadata(this.metadata)),t.has("key")&&this.useAsClusterSwitch&&(t.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(t.get("key"))),this.key&&((s=this.resultStateManager)===null||s===void 0||s.registerMetadata(this.key))),t.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(c=this.resultStateManager)===null||c===void 0||c.registerMetadata(this.key):(p=this.resultStateManager)===null||p===void 0||p.unregisterMetadata(this.key)),(t.has("cluster")||t.has("result")||t.has("key")||t.has("useAsClusterSwitch"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((f=(u=this.cluster)===null||u===void 0?void 0:u.entries.length)!==null&&f!==void 0?f:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(t){var o,n;return t=t??this.result,(n=(o=t?.map)!==null&&o!==void 0?o:t?.topic)!==null&&n!==void 0?n:t?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.value}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${gr.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var t;let
|
|
1308
|
+
`}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?gr.messages.noValuePresent(this.key):gr.messages.noKeySelected():Go.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var t,o,n;let i=(n=(o=(t=this.cluster)===null||t===void 0?void 0:t.entries)===null||o===void 0?void 0:o.map(a=>xt.ClusteringHelper.extractResultMetadata(a)))===null||n===void 0?void 0:n.map(a=>{var s;return(s=a.find(c=>c.key==this.key))===null||s===void 0?void 0:s.value});return new Set(i).size>1}getEllipsis(t){let o=this.maxLength?t.substring(0,this.maxLength):t;return o+(o.length<t.length?"\u2026":"")}update(t){var o,n,i,a,s,c,p,u,f;super.update(t),(t.has("result")||t.has("key")&&this.result||this.dateFormatOptionsChanged(t))&&(this.metadata=this.formatDateValues((o=this.resultData())===null||o===void 0?void 0:o.metadata.find(m=>m.key==this.key&&m.values.length>0)),this.metadataLabel=(i=(n=this.metadata)===null||n===void 0?void 0:n.label)!==null&&i!==void 0?i:this.findClusterMetadataLabel(),this.flatMetadata=xt.ClusteringHelper.flattenMetadata(this.metadata)),t.has("key")&&this.useAsClusterSwitch&&(t.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(t.get("key"))),this.key&&((s=this.resultStateManager)===null||s===void 0||s.registerMetadata(this.key))),t.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(c=this.resultStateManager)===null||c===void 0||c.registerMetadata(this.key):(p=this.resultStateManager)===null||p===void 0||p.unregisterMetadata(this.key)),(t.has("cluster")||t.has("result")||t.has("key")||t.has("useAsClusterSwitch"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((f=(u=this.cluster)===null||u===void 0?void 0:u.entries.length)!==null&&f!==void 0?f:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(t){var o,n;return t=t??this.result,(n=(o=t?.map)!==null&&o!==void 0?o:t?.topic)!==null&&n!==void 0?n:t?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.value}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${gr.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var t,o;let n=(t=this.cluster)===null||t===void 0?void 0:t.entries.flatMap(i=>this.resultData(i).metadata.filter(a=>a.key==this.key))[0];return(o=n?.label)!==null&&o!==void 0?o:this.key}};J.elementDefinitions={"ft-tooltip":G,"ft-chip":X,"ft-floating-menu":gt,"ft-floating-menu-item":Ee,"ft-floating-menu-label":bt};J.styles=mi;be([(0,we.property)()],J.prototype,"key",void 0);be([(0,we.property)({type:Boolean})],J.prototype,"useChip",void 0);be([(0,we.property)({type:Boolean})],J.prototype,"useAsClusterSwitch",void 0);be([(0,we.property)({type:Boolean})],J.prototype,"goToDocumentOnSwitch",void 0);be([(0,we.property)({type:Boolean})],J.prototype,"displayLabel",void 0);be([(0,we.property)({type:Number,attribute:"max-length"})],J.prototype,"maxLength",void 0);be([(0,xt.redux)({store:L.name})],J.prototype,"editorMode",void 0);be([(0,xt.redux)({store:L.name,selector:e=>{var t,o;return(o=(t=e.metadataConfiguration)===null||t===void 0?void 0:t.descriptors)!==null&&o!==void 0?o:[]}})],J.prototype,"metadataDescriptors",void 0);be([(0,xt.redux)({store:"search"})],J.prototype,"request",void 0);be([(0,we.state)()],J.prototype,"metadata",void 0);be([(0,we.state)()],J.prototype,"metadataLabel",void 0);be([(0,we.state)()],J.prototype,"clustersByValue",void 0);be([(0,we.state)()],J.prototype,"clusterItems",void 0);be([(0,we.state)()],J.prototype,"flatMetadata",void 0);be([(0,we.state)()],J.prototype,"displayCluster",void 0);(0,mc.customElement)("ft-search-result-metadata")(J);})();
|
|
1308
1309
|
/*! Bundled license information:
|
|
1309
1310
|
|
|
1310
1311
|
@lit/reactive-element/css-tag.js:
|