@dile/ui 2.1.32 → 2.1.34
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import '../../icon/icon.js';
|
|
3
3
|
import { searchIcon, clearIcon } from '@dile/icons/index.js';
|
|
4
|
+
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
4
5
|
|
|
5
|
-
export class DileInputSearch extends LitElement {
|
|
6
|
+
export class DileInputSearch extends DileEmmitChange(LitElement) {
|
|
6
7
|
static styles = [
|
|
7
8
|
css`
|
|
8
9
|
:host {
|
|
@@ -53,6 +54,8 @@ export class DileInputSearch extends LitElement {
|
|
|
53
54
|
disabled: { type: Boolean },
|
|
54
55
|
readOnly: { type: Boolean },
|
|
55
56
|
errored: { type: Boolean },
|
|
57
|
+
/** Name for this input field */
|
|
58
|
+
name: { type: String },
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
61
|
|
|
@@ -69,6 +72,12 @@ export class DileInputSearch extends LitElement {
|
|
|
69
72
|
this.input = this.shadowRoot.getElementById('elinput');
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
updated(changedProperties) {
|
|
76
|
+
if(changedProperties.has('value')) {
|
|
77
|
+
this.emmitChange();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
render() {
|
|
73
82
|
return html`
|
|
74
83
|
<div class="${this.errored ? "errored" : ""}">
|
|
@@ -3,11 +3,15 @@ import '../../input/input-search.js';
|
|
|
3
3
|
import '../../spinner/spinner-horizontal.js';
|
|
4
4
|
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
5
5
|
import '../select.js';
|
|
6
|
+
import { messageStyles } from '../../input/src/message-styles.js';
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
8
10
|
|
|
9
11
|
static get styles() {
|
|
10
|
-
return
|
|
12
|
+
return [
|
|
13
|
+
messageStyles,
|
|
14
|
+
css`
|
|
11
15
|
* {
|
|
12
16
|
box-sizing: border-box;
|
|
13
17
|
}
|
|
@@ -50,7 +54,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
50
54
|
margin-bottom: 0;
|
|
51
55
|
--dile-input-width: 100%;
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
`];
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
static get properties() {
|
|
@@ -94,7 +98,11 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
94
98
|
/* When static is true there is no posibility to search, then all the options are displayed on the select on initialization */
|
|
95
99
|
static: {
|
|
96
100
|
type: Boolean,
|
|
97
|
-
}
|
|
101
|
+
},
|
|
102
|
+
/** Message Displayed */
|
|
103
|
+
message: { type: String },
|
|
104
|
+
/** Hide errors on input */
|
|
105
|
+
hideErrorOnInput: { type: Boolean },
|
|
98
106
|
};
|
|
99
107
|
}
|
|
100
108
|
|
|
@@ -176,6 +184,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
176
184
|
: this.static ? this.loadingOrLoadedTemplate : this.searchTemplate
|
|
177
185
|
}
|
|
178
186
|
</div>
|
|
187
|
+
${this.messageTemplate}
|
|
179
188
|
`;
|
|
180
189
|
}
|
|
181
190
|
|
|
@@ -203,6 +212,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
203
212
|
@focus=${this.onFocus}
|
|
204
213
|
@dile-input-search=${this.onTextInput}
|
|
205
214
|
delay="${this.delay}"
|
|
215
|
+
@element-changed=${this.hideErrorOnInteraction}
|
|
206
216
|
></dile-input-search>
|
|
207
217
|
<div class="anchor">
|
|
208
218
|
<section class="${this.opened && this.keyword.length > 0 ? 'opened' : ''}">
|
|
@@ -253,6 +263,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
253
263
|
id="elselect"
|
|
254
264
|
@element-changed=${this.doSelected}
|
|
255
265
|
name="generated-select-field"
|
|
266
|
+
?errored=${this.errored}
|
|
256
267
|
>
|
|
257
268
|
<select slot="select">
|
|
258
269
|
<option value="">${this.selectDefaultPlaceholder}</option>
|
|
@@ -264,6 +275,15 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
264
275
|
`;
|
|
265
276
|
}
|
|
266
277
|
|
|
278
|
+
get messageTemplate() {
|
|
279
|
+
return html`
|
|
280
|
+
${this.message
|
|
281
|
+
? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>`
|
|
282
|
+
: ''
|
|
283
|
+
}
|
|
284
|
+
`
|
|
285
|
+
}
|
|
286
|
+
|
|
267
287
|
onFocus() {
|
|
268
288
|
this.opened = true;
|
|
269
289
|
}
|
|
@@ -271,6 +291,13 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
271
291
|
onTextInput(e) {
|
|
272
292
|
this.keyword = e.detail.keyword;
|
|
273
293
|
this.loadData();
|
|
294
|
+
this.hideErrorOnInteraction();
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
hideErrorOnInteraction() {
|
|
298
|
+
if (this.hideErrorOnInput && this.errored) {
|
|
299
|
+
this.clearError();
|
|
300
|
+
}
|
|
274
301
|
}
|
|
275
302
|
|
|
276
303
|
loadData() {
|
|
@@ -308,6 +335,12 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
308
335
|
this.isSelected = true;
|
|
309
336
|
}
|
|
310
337
|
e.stopPropagation();
|
|
338
|
+
this.hideErrorOnInteraction();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
clearError() {
|
|
342
|
+
this.errored = false;
|
|
343
|
+
this.message = '';
|
|
311
344
|
}
|
|
312
345
|
|
|
313
346
|
onClearSelected() {
|
|
@@ -321,6 +354,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
321
354
|
this.search.focus();
|
|
322
355
|
});
|
|
323
356
|
}
|
|
357
|
+
this.hideErrorOnInteraction();
|
|
324
358
|
}
|
|
325
359
|
|
|
326
360
|
close() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.34",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "e3f1c5d2850016066910a97ca26eee78543bb247"
|
|
30
30
|
}
|