@fluid-topics/ft-reader-topic-content 2.2.17 → 2.2.19
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.
|
@@ -2,7 +2,7 @@ import { PropertyValues } from "lit";
|
|
|
2
2
|
import { FtReaderTopicContentProperties } from "./ft-reader-topic-content.properties";
|
|
3
3
|
import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
|
|
4
4
|
import { FtReaderPage, FtReaderScrollTarget } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
5
|
-
import { FtMap } from "@fluid-topics/public-api";
|
|
5
|
+
import { FtMap, FtTocNodeFiltered } from "@fluid-topics/public-api";
|
|
6
6
|
import "@fluid-topics/ft-icon/build/define";
|
|
7
7
|
export declare class FtReaderTopicContent extends FtReaderTopicComponent implements FtReaderTopicContentProperties {
|
|
8
8
|
static styles: import("lit").CSSResult[];
|
|
@@ -15,6 +15,7 @@ export declare class FtReaderTopicContent extends FtReaderTopicComponent impleme
|
|
|
15
15
|
linkPreviewDialogId?: string;
|
|
16
16
|
scrollTarget?: FtReaderScrollTarget;
|
|
17
17
|
currentPage?: FtReaderPage;
|
|
18
|
+
filteredTocNodes?: Record<string, FtTocNodeFiltered>;
|
|
18
19
|
content?: string;
|
|
19
20
|
error?: Error;
|
|
20
21
|
searchInDocumentQuery?: string;
|
|
@@ -25,6 +26,7 @@ export declare class FtReaderTopicContent extends FtReaderTopicComponent impleme
|
|
|
25
26
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
26
27
|
protected update(props: PropertyValues): void;
|
|
27
28
|
private updateContent;
|
|
29
|
+
get isFiltered(): FtTocNodeFiltered | undefined;
|
|
28
30
|
protected contentAvailableCallback(props: PropertyValues<FtReaderTopicContent>): void;
|
|
29
31
|
processExpandingBlocks(): void;
|
|
30
32
|
processOpenApiSelect(): void;
|
|
@@ -20,7 +20,7 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
var _a, _b, _c;
|
|
23
|
-
if (!this.map || (!this.error && !this.content && ((_a = this.translationSourceLanguage) === null || _a === void 0 ? void 0 : _a.code) == ((_b = this.translationDestinationLanguage) === null || _b === void 0 ? void 0 : _b.code))) {
|
|
23
|
+
if (!this.map || (!this.error && !this.content && !this.isFiltered && ((_a = this.translationSourceLanguage) === null || _a === void 0 ? void 0 : _a.code) == ((_b = this.translationDestinationLanguage) === null || _b === void 0 ? void 0 : _b.code))) {
|
|
24
24
|
return html `
|
|
25
25
|
<section class="topic-loading"></section>
|
|
26
26
|
`;
|
|
@@ -36,7 +36,7 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
36
36
|
}
|
|
37
37
|
update(props) {
|
|
38
38
|
super.update(props);
|
|
39
|
-
if (["map", "tocNode", "translationDestinationLanguage", "translationProfileId"].some((p) => props.has(p))) {
|
|
39
|
+
if (["map", "tocNode", "translationDestinationLanguage", "translationProfileId", "filteredTocNodes"].some((p) => props.has(p))) {
|
|
40
40
|
this.updateContent();
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -44,19 +44,24 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
44
44
|
var _a;
|
|
45
45
|
this.error = undefined;
|
|
46
46
|
this.content = undefined;
|
|
47
|
-
if (this.
|
|
47
|
+
if (this.tocNode && !this.isFiltered) {
|
|
48
48
|
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.fetchTopicContent(this.tocNode).then((content) => this.contentPreprocessor(content || "<div class=\"empty-topic\"></div>")).then((content) => this.content = content).catch((e) => this.error = e);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
get isFiltered() {
|
|
52
|
+
var _a;
|
|
53
|
+
return this.tocNode && ((_a = this.filteredTocNodes) === null || _a === void 0 ? void 0 : _a[this.tocNode.tocId]);
|
|
54
|
+
}
|
|
51
55
|
contentAvailableCallback(props) {
|
|
52
|
-
var _a, _b, _c, _d, _e, _f
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57
|
+
var _g;
|
|
53
58
|
super.contentAvailableCallback(props);
|
|
54
59
|
if (!this.disableContextInteractions && ((_a = this.scrollTarget) === null || _a === void 0 ? void 0 : _a.section) && ((_b = this.tocNode) === null || _b === void 0 ? void 0 : _b.tocId) && ((_c = this.tocNode) === null || _c === void 0 ? void 0 : _c.tocId) === this.scrollTarget.tocId && this.content) {
|
|
55
|
-
const target = (
|
|
60
|
+
const target = (_g = (_d = this.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector(`[id="${this.scrollTarget.section}"], [name="${this.scrollTarget.section}"]`)) !== null && _g !== void 0 ? _g : this;
|
|
56
61
|
target.tabIndex = -1;
|
|
57
62
|
target.focus();
|
|
58
63
|
target.dispatchEvent(new Event("scroll-into-view", { bubbles: true, composed: true }));
|
|
59
|
-
(
|
|
64
|
+
(_e = this.stateManager) === null || _e === void 0 ? void 0 : _e.scrollDone();
|
|
60
65
|
}
|
|
61
66
|
if ((props.has("searchInDocumentQuery") || props.has("content")) && this.content) {
|
|
62
67
|
waitFor(() => this.topicContainer).then((topicContainer) => {
|
|
@@ -77,24 +82,25 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
77
82
|
});
|
|
78
83
|
}
|
|
79
84
|
if ((props.has("content") && this.content) || (props.has("error") && this.error)) {
|
|
80
|
-
performance.mark("fluid_topics__reader_topic_displayed__" + ((
|
|
85
|
+
performance.mark("fluid_topics__reader_topic_displayed__" + ((_f = this.tocNode) === null || _f === void 0 ? void 0 : _f.tocId));
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
processExpandingBlocks() {
|
|
84
89
|
for (const link of this.shadowRoot.querySelectorAll(".ft-expanding-block-link")) {
|
|
85
90
|
link.onclick = (e) => {
|
|
86
|
-
var _a, _b, _c
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
var _d;
|
|
87
93
|
e.stopPropagation();
|
|
88
94
|
e.preventDefault();
|
|
89
95
|
if (link.classList.contains("ft-expanding-exclusive")
|
|
90
96
|
&& !link.classList.contains("ft-expanding-block-expanded")) {
|
|
91
|
-
for (const block of Array.from((
|
|
97
|
+
for (const block of Array.from((_d = (_a = this.topicContainer) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ft-expanding-block-expanded")) !== null && _d !== void 0 ? _d : [])) {
|
|
92
98
|
block.classList.remove("ft-expanding-block-expanded");
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
link.classList.toggle("ft-expanding-block-expanded");
|
|
96
102
|
const targetId = link.getAttribute("data-expanding-block-target-id");
|
|
97
|
-
(
|
|
103
|
+
(_c = (_b = this.topicContainer) === null || _b === void 0 ? void 0 : _b.querySelector(`[id='` + targetId + `']`)) === null || _c === void 0 ? void 0 : _c.classList.toggle("ft-expanding-block-expanded");
|
|
98
104
|
};
|
|
99
105
|
}
|
|
100
106
|
}
|
|
@@ -127,7 +133,8 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
127
133
|
this.updateContent();
|
|
128
134
|
}
|
|
129
135
|
renderTopicContent() {
|
|
130
|
-
var _a, _b, _c, _d, _e
|
|
136
|
+
var _a, _b, _c, _d, _e;
|
|
137
|
+
var _f;
|
|
131
138
|
if (this.error) {
|
|
132
139
|
return html `
|
|
133
140
|
<div class="topic-on-error">
|
|
@@ -138,12 +145,12 @@ export class FtReaderTopicContent extends FtReaderTopicComponent {
|
|
|
138
145
|
</div>
|
|
139
146
|
`;
|
|
140
147
|
}
|
|
141
|
-
const customClasses = (
|
|
142
|
-
let topicLevel = (((
|
|
143
|
-
if (this.headingStartLevel != null && ((
|
|
144
|
-
topicLevel = (((
|
|
148
|
+
const customClasses = (_f = (_a = this.map) === null || _a === void 0 ? void 0 : _a.contentStyles.customCssClasses.join(" ")) !== null && _f !== void 0 ? _f : "";
|
|
149
|
+
let topicLevel = (((_b = this.tocNode) === null || _b === void 0 ? void 0 : _b.depth) || 1) + this.headingLevelsShift;
|
|
150
|
+
if (this.headingStartLevel != null && ((_c = this.currentPage) === null || _c === void 0 ? void 0 : _c.rootTocId)) {
|
|
151
|
+
topicLevel = (((_d = this.tocNode) === null || _d === void 0 ? void 0 : _d.depth) || 1) - (((_e = this.currentPage) === null || _e === void 0 ? void 0 : _e.rootDepth) || 1) + this.headingStartLevel;
|
|
145
152
|
}
|
|
146
|
-
return this.translationLoading || !this.content
|
|
153
|
+
return this.translationLoading || (!this.content && !this.isFiltered)
|
|
147
154
|
? html `
|
|
148
155
|
<ft-skeleton></ft-skeleton>`
|
|
149
156
|
: html `
|
|
@@ -201,6 +208,11 @@ __decorate([
|
|
|
201
208
|
__decorate([
|
|
202
209
|
redux({ store: "reader" })
|
|
203
210
|
], FtReaderTopicContent.prototype, "currentPage", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
redux({
|
|
213
|
+
store: "reader",
|
|
214
|
+
})
|
|
215
|
+
], FtReaderTopicContent.prototype, "filteredTocNodes", void 0);
|
|
204
216
|
__decorate([
|
|
205
217
|
state()
|
|
206
218
|
], FtReaderTopicContent.prototype, "content", void 0);
|