@fluid-topics/ft-search-result-title 1.1.102 → 1.1.103
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,11 +1,13 @@
|
|
|
1
|
-
import { nothing, PropertyValues } from "lit";
|
|
1
|
+
import { nothing, PropertyValues, TemplateResult } from "lit";
|
|
2
2
|
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtSearchResultTitleProperties } from "./ft-search-result-title.properties";
|
|
4
4
|
import { FtSearchResultComponent } from "@fluid-topics/ft-search-result-context/build/registration";
|
|
5
5
|
export declare class FtSearchResultTitle extends FtSearchResultComponent implements FtSearchResultTitleProperties {
|
|
6
|
+
withoutLink: boolean;
|
|
6
7
|
static elementDefinitions: ElementDefinitionsMap;
|
|
7
8
|
static styles: import("lit").CSSResult;
|
|
8
|
-
protected render(): typeof nothing |
|
|
9
|
+
protected render(): typeof nothing | TemplateResult;
|
|
10
|
+
private renderTitle;
|
|
9
11
|
private onResultClick;
|
|
10
12
|
private selectTitle;
|
|
11
13
|
protected contentAvailableCallback(props: PropertyValues): void;
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
import { html, nothing } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
2
9
|
import { FtSearchResultComponent } from "@fluid-topics/ft-search-result-context/build/registration";
|
|
3
10
|
import { styles } from "./ft-search-result-title.styles";
|
|
4
11
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
5
12
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
6
13
|
import { getResultTarget, getResultUrl, SearchResultClickEvent } from "@fluid-topics/ft-search-result-context/build/utils";
|
|
7
14
|
class FtSearchResultTitle extends FtSearchResultComponent {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.withoutLink = false;
|
|
18
|
+
}
|
|
8
19
|
render() {
|
|
9
20
|
var _a;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
if (!this.result) {
|
|
22
|
+
return nothing;
|
|
23
|
+
}
|
|
24
|
+
return this.withoutLink
|
|
25
|
+
? this.renderTitle()
|
|
26
|
+
: html `
|
|
27
|
+
<a href="${getResultUrl(this.result)}"
|
|
28
|
+
@click=${this.onResultClick}
|
|
29
|
+
target="${getResultTarget(this.result, (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.openExternalDocumentInNewTab)}"
|
|
30
|
+
part="link">
|
|
31
|
+
${this.renderTitle()}
|
|
32
|
+
</a>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
renderTitle() {
|
|
36
|
+
return html `
|
|
37
|
+
<ft-typography variant="title" part="text">${unsafeHTML(this.selectTitle(this.result))}</ft-typography>
|
|
38
|
+
`;
|
|
15
39
|
}
|
|
16
40
|
onResultClick() {
|
|
17
41
|
this.dispatchEvent(new SearchResultClickEvent(this.result, this.rank));
|
|
@@ -36,4 +60,7 @@ FtSearchResultTitle.elementDefinitions = {
|
|
|
36
60
|
"ft-typography": FtTypography,
|
|
37
61
|
};
|
|
38
62
|
FtSearchResultTitle.styles = styles;
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Boolean })
|
|
65
|
+
], FtSearchResultTitle.prototype, "withoutLink", void 0);
|
|
39
66
|
export { FtSearchResultTitle };
|