@fluid-topics/ft-search-type 1.0.61
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/README.md +19 -0
- package/build/FtSearchTypeMessages.d.ts +7 -0
- package/build/FtSearchTypeMessages.js +6 -0
- package/build/ft-search-type.css.d.ts +2 -0
- package/build/ft-search-type.css.js +5 -0
- package/build/ft-search-type.d.ts +14 -0
- package/build/ft-search-type.js +54 -0
- package/build/ft-search-type.light.js +1502 -0
- package/build/ft-search-type.min.js +1624 -0
- package/build/ft-search-type.properties.d.ts +2 -0
- package/build/ft-search-type.properties.js +1 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +7 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
List of search types in a designed search page context
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```shell
|
|
6
|
+
npm install @fluid-topics/ft-search-type
|
|
7
|
+
yarn add @fluid-topics/ft-search-type
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { html } from "lit"
|
|
14
|
+
import "@fluid-topics/ft-search-type"
|
|
15
|
+
|
|
16
|
+
function render() {
|
|
17
|
+
return html` <ft-search-type foo="bar"></ft-search-type> `
|
|
18
|
+
}
|
|
19
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n/build/generator/I18nMessageContext";
|
|
2
|
+
export interface SearchTypeMessages extends I18nMessages {
|
|
3
|
+
label(): string;
|
|
4
|
+
documentTitlesOnly(): string;
|
|
5
|
+
}
|
|
6
|
+
export declare const searchTypeContext: I18nMessageContext<SearchTypeMessages>;
|
|
7
|
+
export declare const searchTypeDefaultMessages: DefaultI18nMessages<SearchTypeMessages>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { I18nMessageContext } from "@fluid-topics/ft-i18n/build/generator/I18nMessageContext";
|
|
2
|
+
export const searchTypeContext = I18nMessageContext.build("designedSearchType");
|
|
3
|
+
export const searchTypeDefaultMessages = {
|
|
4
|
+
label: "Search scope",
|
|
5
|
+
documentTitlesOnly: "Search in document titles only",
|
|
6
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtSearchTypeProperties } from "./ft-search-type.properties";
|
|
3
|
+
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
4
|
+
declare const FtSearchType_base: typeof FtSearchComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
|
|
5
|
+
export declare class FtSearchType extends FtSearchType_base implements FtSearchTypeProperties {
|
|
6
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
7
|
+
static styles: import("lit").CSSResult;
|
|
8
|
+
private searchInDocumentTitlesOnly?;
|
|
9
|
+
private filter?;
|
|
10
|
+
constructor();
|
|
11
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
private onSelected;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
};
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { redux } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { styles } from "./ft-search-type.css";
|
|
10
|
+
import { FtFilter } from "@fluid-topics/ft-filter";
|
|
11
|
+
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
12
|
+
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
13
|
+
import { searchTypeContext, searchTypeDefaultMessages } from "./FtSearchTypeMessages";
|
|
14
|
+
import { query } from "lit/decorators.js";
|
|
15
|
+
import { searchInDocumentTitlesOnlySelector } from "@fluid-topics/ft-search-context";
|
|
16
|
+
class FtSearchType extends withI18n(FtSearchComponent) {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.addI18nContext(searchTypeContext, searchTypeDefaultMessages);
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
return html `
|
|
23
|
+
<ft-filter
|
|
24
|
+
label=${searchTypeContext.messages.label()}
|
|
25
|
+
.options=${[
|
|
26
|
+
{
|
|
27
|
+
label: searchTypeContext.messages.documentTitlesOnly(),
|
|
28
|
+
value: (selected) => { var _a; return (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setSearchInDocumentTitlesOnly(selected); },
|
|
29
|
+
selected: this.searchInDocumentTitlesOnly
|
|
30
|
+
}
|
|
31
|
+
]}
|
|
32
|
+
part="filter"
|
|
33
|
+
.exportpartsPrefixes=${["filter"]}
|
|
34
|
+
multivalued
|
|
35
|
+
@change=${this.onSelected}
|
|
36
|
+
></ft-filter>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
onSelected(event) {
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = this.filter) === null || _a === void 0 ? void 0 : _a.options.forEach(o => o.value(o.selected));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
FtSearchType.elementDefinitions = {
|
|
45
|
+
"ft-filter": FtFilter,
|
|
46
|
+
};
|
|
47
|
+
FtSearchType.styles = styles;
|
|
48
|
+
__decorate([
|
|
49
|
+
redux({ selector: searchInDocumentTitlesOnlySelector })
|
|
50
|
+
], FtSearchType.prototype, "searchInDocumentTitlesOnly", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
query("ft-filter")
|
|
53
|
+
], FtSearchType.prototype, "filter", void 0);
|
|
54
|
+
export { FtSearchType };
|