@exmg/exm-search 1.1.8 → 1.1.10-alpha.35
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.
|
@@ -18,8 +18,9 @@ export declare class ExmSearchBase extends ExmgElement {
|
|
|
18
18
|
detectOutsideClick(e: Event): void;
|
|
19
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
20
20
|
_getValue(): string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
private notifyChange;
|
|
22
|
+
private handleClear;
|
|
23
|
+
private handleKeyUp;
|
|
24
|
+
private handleBlur;
|
|
24
25
|
updated(changedProperties: Map<string, any>): void;
|
|
25
26
|
}
|
package/dist/exm-search-base.js
CHANGED
|
@@ -61,21 +61,18 @@ export class ExmSearchBase extends ExmgElement {
|
|
|
61
61
|
placeholder=${this.placeHolder}
|
|
62
62
|
value=${this.filterValue ? this.filterValue : ''}
|
|
63
63
|
onfocus="let value = this.value; this.value = null; this.value = value"
|
|
64
|
-
@keyup=${this.
|
|
64
|
+
@keyup=${this.handleKeyUp}
|
|
65
|
+
@blur=${this.handleBlur}
|
|
65
66
|
/>
|
|
66
67
|
${this.filterValue
|
|
67
|
-
? html `
|
|
68
|
-
<md-icon-button class="clear" @click=${this._handleClear}><md-icon>clear</md-icon></md-icon-button>
|
|
69
|
-
`
|
|
68
|
+
? html ` <md-icon-button class="clear" @click=${this.handleClear}><md-icon>clear</md-icon></md-icon-button> `
|
|
70
69
|
: nothing}
|
|
71
70
|
</div>
|
|
72
71
|
<div class="mode-default" @click=${() => this.focus()}>
|
|
73
72
|
<md-icon class="search">search</md-icon>
|
|
74
73
|
<span class="interactive-content">${this._getValue()}</span>
|
|
75
74
|
${this.filterValue
|
|
76
|
-
? html `
|
|
77
|
-
<md-icon-button class="clear" @click=${this._handleClear}><md-icon>clear</md-icon></md-icon-button>
|
|
78
|
-
`
|
|
75
|
+
? html ` <md-icon-button class="clear" @click=${this.handleClear}><md-icon>clear</md-icon></md-icon-button> `
|
|
79
76
|
: nothing}
|
|
80
77
|
</div>
|
|
81
78
|
</div>
|
|
@@ -84,10 +81,10 @@ export class ExmSearchBase extends ExmgElement {
|
|
|
84
81
|
_getValue() {
|
|
85
82
|
return this.filterValue || this.placeHolder;
|
|
86
83
|
}
|
|
87
|
-
|
|
84
|
+
notifyChange() {
|
|
88
85
|
this.fire('search-value-change', { value: this.filterValue }, this.bubbles);
|
|
89
86
|
}
|
|
90
|
-
|
|
87
|
+
handleClear(e) {
|
|
91
88
|
var _a;
|
|
92
89
|
e.stopPropagation();
|
|
93
90
|
e.preventDefault();
|
|
@@ -95,19 +92,22 @@ export class ExmSearchBase extends ExmgElement {
|
|
|
95
92
|
if (this.search) {
|
|
96
93
|
this.search.value = '';
|
|
97
94
|
}
|
|
98
|
-
this.
|
|
95
|
+
this.notifyChange();
|
|
99
96
|
(_a = this.search) === null || _a === void 0 ? void 0 : _a.focus();
|
|
100
97
|
}
|
|
101
|
-
|
|
98
|
+
handleKeyUp(e) {
|
|
102
99
|
const input = e.target;
|
|
103
100
|
if (this.filterValue !== input.value) {
|
|
104
101
|
this.filterValue = input.value;
|
|
105
|
-
this.
|
|
102
|
+
this.notifyChange();
|
|
106
103
|
}
|
|
107
104
|
if (e.key === 'Escape') {
|
|
108
105
|
this._hasFocus = false;
|
|
109
106
|
}
|
|
110
107
|
}
|
|
108
|
+
handleBlur() {
|
|
109
|
+
this.fire('search-blur', {}, this.bubbles);
|
|
110
|
+
}
|
|
111
111
|
updated(changedProperties) {
|
|
112
112
|
if (changedProperties.has('_hasFocus')) {
|
|
113
113
|
// after _hasFocus changed to true, focus the input
|
|
@@ -5,7 +5,7 @@ export const style = css `
|
|
|
5
5
|
--_hover-outline-color: var(--exm-search-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));
|
|
6
6
|
--_outline-width: var(--exm-search-outline-width, 1px);
|
|
7
7
|
--_outline-color: var(--exm-search-outline-color, var(--md-outlined-field-hover-outline-width, 1px));
|
|
8
|
-
--_container-shape: var(--exm-search-container-shape,
|
|
8
|
+
--_container-shape: var(--exm-search-container-shape, 3rem);
|
|
9
9
|
--_focus-input-text-color: var(--exm-search-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));
|
|
10
10
|
--_focus-label-text-color: var(--exm-search-focus-label-text-color, var(--md-sys-color-primary, #6750a4));
|
|
11
11
|
--_focus-icon-color: var(--exm-search-focus-icon-color, var(--md-sys-color-on-surface-variant, #49454f));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exmg/exm-search",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10-alpha.35+671db4b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,15 +9,12 @@
|
|
|
9
9
|
".": "./dist/index.js",
|
|
10
10
|
"./exm-search.js": "./dist/exm-search.js"
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
"@exmg/lit-base": "^3.0.
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@exmg/lit-base": "^3.0.3",
|
|
14
14
|
"@material/web": "^2.2.0",
|
|
15
|
-
"lit": "^3.
|
|
15
|
+
"lit": "^3.2.1",
|
|
16
16
|
"tslib": "^2.6.2"
|
|
17
17
|
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@exmg/lit-cli": "1.1.13"
|
|
20
|
-
},
|
|
21
18
|
"keywords": [
|
|
22
19
|
"web-components",
|
|
23
20
|
"lit",
|
|
@@ -39,5 +36,5 @@
|
|
|
39
36
|
"publishConfig": {
|
|
40
37
|
"access": "public"
|
|
41
38
|
},
|
|
42
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "671db4b2e04ae387cc0eba60fc4419b02036b70b"
|
|
43
40
|
}
|