@fluid-topics/ft-search-input 1.2.31 → 1.2.33
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/ft-search-input.d.ts +2 -0
- package/build/ft-search-input.js +12 -6
- package/build/ft-search-input.light.js +53 -53
- package/build/ft-search-input.min.js +31 -31
- package/package.json +10 -10
|
@@ -12,6 +12,7 @@ export declare class FtSearchInput extends FtSearchInput_base implements FtSearc
|
|
|
12
12
|
private forceCloseSuggestion;
|
|
13
13
|
launchSearchPath?: string;
|
|
14
14
|
useCustomSearchPath: boolean;
|
|
15
|
+
triggerSearchOnClear: boolean;
|
|
15
16
|
private input;
|
|
16
17
|
private suggestion;
|
|
17
18
|
private launchSearchButton;
|
|
@@ -19,6 +20,7 @@ export declare class FtSearchInput extends FtSearchInput_base implements FtSearc
|
|
|
19
20
|
private onSearchBarKeyDown;
|
|
20
21
|
private onSearchBarKeyUp;
|
|
21
22
|
private onInput;
|
|
23
|
+
private onClearInput;
|
|
22
24
|
private launchSearch;
|
|
23
25
|
private onSuggestionSelected;
|
|
24
26
|
}
|
package/build/ft-search-input.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
8
|
import { noTextInputDefaultClearButton, redux } from "@fluid-topics/ft-wc-utils";
|
|
9
9
|
import { styles } from "./ft-search-input.styles";
|
|
10
10
|
import { FtSearchComponent } from "@fluid-topics/ft-search-context/build/registration";
|
|
@@ -22,6 +22,7 @@ class FtSearchInput extends withI18n(FtSearchComponent) {
|
|
|
22
22
|
this.liveQuery = "";
|
|
23
23
|
this.forceCloseSuggestion = false;
|
|
24
24
|
this.useCustomSearchPath = false;
|
|
25
|
+
this.triggerSearchOnClear = false;
|
|
25
26
|
this.addI18nContext(searchInputContext);
|
|
26
27
|
}
|
|
27
28
|
render() {
|
|
@@ -61,11 +62,7 @@ class FtSearchInput extends withI18n(FtSearchComponent) {
|
|
|
61
62
|
icon="close"
|
|
62
63
|
round dense
|
|
63
64
|
label="${searchInputContext.messages.clearButton()}"
|
|
64
|
-
@click=${() =>
|
|
65
|
-
var _a;
|
|
66
|
-
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setLiveQuery("");
|
|
67
|
-
this.input.focus();
|
|
68
|
-
}}
|
|
65
|
+
@click=${() => this.onClearInput()}
|
|
69
66
|
></ft-button>
|
|
70
67
|
<div class="ft-search-input--separator"></div>
|
|
71
68
|
` : null}
|
|
@@ -115,6 +112,12 @@ class FtSearchInput extends withI18n(FtSearchComponent) {
|
|
|
115
112
|
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setLiveQuery(this.input.value);
|
|
116
113
|
this.forceCloseSuggestion = false;
|
|
117
114
|
}
|
|
115
|
+
onClearInput() {
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setLiveQuery("");
|
|
118
|
+
this.triggerSearchOnClear ? this.launchSearch("") : nothing;
|
|
119
|
+
this.input.focus();
|
|
120
|
+
}
|
|
118
121
|
launchSearch(query) {
|
|
119
122
|
var _a;
|
|
120
123
|
this.forceCloseSuggestion = true;
|
|
@@ -154,6 +157,9 @@ __decorate([
|
|
|
154
157
|
__decorate([
|
|
155
158
|
property({ type: Boolean })
|
|
156
159
|
], FtSearchInput.prototype, "useCustomSearchPath", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Boolean })
|
|
162
|
+
], FtSearchInput.prototype, "triggerSearchOnClear", void 0);
|
|
157
163
|
__decorate([
|
|
158
164
|
query(".ft-search-input--input")
|
|
159
165
|
], FtSearchInput.prototype, "input", void 0);
|