@fluid-topics/ft-search-result-title 1.3.49 → 1.3.51
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.
|
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { property } from "lit/decorators.js";
|
|
9
|
+
import { accessResult } from "@fluid-topics/ft-wc-utils";
|
|
9
10
|
import { FtSearchResultComponent } from "@fluid-topics/ft-search-result-context/build/registration";
|
|
10
11
|
import { styles } from "./ft-search-result-title.styles";
|
|
11
|
-
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
12
|
+
import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
12
13
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
14
|
import { getResultTarget, getResultUrl } from "@fluid-topics/ft-search-result-context/build/utils";
|
|
14
15
|
import { SearchResultClickEvent, SearchResultOpenContextMenuEvent } from "@fluid-topics/ft-search-context/build/utils";
|
|
@@ -41,31 +42,23 @@ class FtSearchResultTitle extends FtSearchResultComponent {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
renderTitle() {
|
|
45
|
+
var _a;
|
|
44
46
|
return html `
|
|
45
|
-
<ft-typography variant="title" part="text">${unsafeHTML(
|
|
47
|
+
<ft-typography variant="${FtTypographyVariants.title}" part="text">${unsafeHTML((_a = accessResult(this.result)) === null || _a === void 0 ? void 0 : _a.htmlTitle)}</ft-typography>
|
|
46
48
|
`;
|
|
47
49
|
}
|
|
48
50
|
onResultClick() {
|
|
49
51
|
this.dispatchEvent(new SearchResultClickEvent(this.result, this.rank));
|
|
50
52
|
}
|
|
51
53
|
onContextMenu() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
selectTitle(result) {
|
|
55
|
-
switch (result.type) {
|
|
56
|
-
case "MAP":
|
|
57
|
-
return result.map.htmlTitle;
|
|
58
|
-
case "DOCUMENT":
|
|
59
|
-
return result.document.htmlTitle;
|
|
60
|
-
case "TOPIC":
|
|
61
|
-
return result.topic.htmlTitle;
|
|
54
|
+
if (this.result.type != "HTML_PACKAGE" && this.result.type != "HTML_PACKAGE_PAGE") {
|
|
55
|
+
this.dispatchEvent(new SearchResultOpenContextMenuEvent(this.result, this.rank));
|
|
62
56
|
}
|
|
63
|
-
return "";
|
|
64
57
|
}
|
|
65
58
|
contentAvailableCallback(props) {
|
|
66
59
|
var _a;
|
|
67
60
|
super.contentAvailableCallback(props);
|
|
68
|
-
this.shadowRoot.querySelectorAll(".kwicmatch").forEach(match => match.setAttribute("part", "kwicmatch"));
|
|
61
|
+
this.shadowRoot.querySelectorAll(".kwicmatch").forEach((match) => match.setAttribute("part", "kwicmatch"));
|
|
69
62
|
if (!this.withoutLink && props.has("rank") && this.rank != undefined) {
|
|
70
63
|
const focusCommand = (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.store.commands.consume(`focus-result-${this.rank}`);
|
|
71
64
|
if (focusCommand) {
|