@fluid-topics/ft-reader-search-in-document 1.1.40 → 1.1.42
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.
- package/build/events.d.ts +12 -0
- package/build/events.js +9 -0
- package/build/ft-reader-search-in-document.d.ts +1 -0
- package/build/ft-reader-search-in-document.js +18 -3
- package/build/ft-reader-search-in-document.light.js +81 -80
- package/build/ft-reader-search-in-document.min.js +416 -386
- package/build/{ft-reader-search-in-document.css.js → ft-reader-search-in-document.styles.js} +5 -5
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +14 -14
- /package/build/{ft-reader-search-in-document.css.d.ts → ft-reader-search-in-document.styles.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FtMetadata } from "@fluid-topics/public-api";
|
|
2
|
+
export declare class SearchInDocumentEvent extends CustomEvent<SearchInDocumentEventDetail> {
|
|
3
|
+
constructor(detail: SearchInDocumentEventDetail);
|
|
4
|
+
}
|
|
5
|
+
interface SearchInDocumentEventDetail {
|
|
6
|
+
mapId: string;
|
|
7
|
+
mapTitle: string;
|
|
8
|
+
metadata: FtMetadata[];
|
|
9
|
+
query: string;
|
|
10
|
+
searchResultsCount: number;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
package/build/events.js
ADDED
|
@@ -18,6 +18,7 @@ export declare class FtReaderSearchInDocument extends FtReaderSearchInDocument_b
|
|
|
18
18
|
private hideResultBreadcrumb;
|
|
19
19
|
private hideResultAbstract;
|
|
20
20
|
private hideResultsNumber;
|
|
21
|
+
private userHasDoneManualAction;
|
|
21
22
|
private uniqueId;
|
|
22
23
|
private get filters();
|
|
23
24
|
private renderResult;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
9
|
-
import { resultStyles, styles } from "./ft-reader-search-in-document.
|
|
9
|
+
import { resultStyles, styles } from "./ft-reader-search-in-document.styles";
|
|
10
10
|
import { FtButton } from "@fluid-topics/ft-button";
|
|
11
11
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
12
12
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
@@ -21,6 +21,7 @@ import "@fluid-topics/ft-search-result-abstract";
|
|
|
21
21
|
import { property, query } from "lit/decorators.js";
|
|
22
22
|
import { FtSearchLoadMoreButton } from "@fluid-topics/ft-search-load-more-button";
|
|
23
23
|
import { getResultUrl, SearchResultClickEvent } from "@fluid-topics/ft-search-result-context/build/utils";
|
|
24
|
+
import { SearchInDocumentEvent } from "./events";
|
|
24
25
|
class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
25
26
|
constructor() {
|
|
26
27
|
super(...arguments);
|
|
@@ -29,6 +30,7 @@ class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
|
29
30
|
this.hideResultBreadcrumb = false;
|
|
30
31
|
this.hideResultAbstract = false;
|
|
31
32
|
this.hideResultsNumber = false;
|
|
33
|
+
this.userHasDoneManualAction = false;
|
|
32
34
|
this.uniqueId = "search-in-document-" + ("" + Math.round(Math.random() * 999000)).padStart(6, "0");
|
|
33
35
|
}
|
|
34
36
|
get filters() {
|
|
@@ -71,9 +73,22 @@ class FtReaderSearchInDocument extends withI18n(FtReaderComponent) {
|
|
|
71
73
|
.filters=${this.filters}
|
|
72
74
|
scope="ALL_TOPICS"
|
|
73
75
|
ignoreEmptyQuery
|
|
74
|
-
@ft-search-request-change=${(e) => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setSearchInDocumentQuery(e.detail.query); }}
|
|
76
|
+
@ft-search-request-change=${(e) => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setSearchInDocumentQuery(e.detail.query); }}
|
|
77
|
+
@ft-search-results-change=${(e) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
if (this.userHasDoneManualAction) {
|
|
80
|
+
this.dispatchEvent(new SearchInDocumentEvent({
|
|
81
|
+
mapId: this.map.id,
|
|
82
|
+
mapTitle: this.map.title,
|
|
83
|
+
metadata: (_b = (_a = this.map) === null || _a === void 0 ? void 0 : _a.metadata) !== null && _b !== void 0 ? _b : [],
|
|
84
|
+
query: e.detail.request.query,
|
|
85
|
+
searchResultsCount: e.detail.paging.totalResultsCount
|
|
86
|
+
}));
|
|
87
|
+
this.userHasDoneManualAction = false;
|
|
88
|
+
}
|
|
89
|
+
}}>
|
|
75
90
|
<div class="ft-search-in-doc--container">
|
|
76
|
-
<ft-search-input></ft-search-input>
|
|
91
|
+
<ft-search-input @change="${() => this.userHasDoneManualAction = true}"></ft-search-input>
|
|
77
92
|
${this.hideResultsNumber ? nothing : html `
|
|
78
93
|
<ft-search-results-number @ft-search-result-click=${(e) => e.stopPropagation()}></ft-search-results-number>
|
|
79
94
|
`}
|