@dile/ui 2.1.32 → 2.1.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.
|
@@ -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
|
|
|
@@ -253,6 +262,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
253
262
|
id="elselect"
|
|
254
263
|
@element-changed=${this.doSelected}
|
|
255
264
|
name="generated-select-field"
|
|
265
|
+
?errored=${this.errored}
|
|
256
266
|
>
|
|
257
267
|
<select slot="select">
|
|
258
268
|
<option value="">${this.selectDefaultPlaceholder}</option>
|
|
@@ -264,6 +274,15 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
264
274
|
`;
|
|
265
275
|
}
|
|
266
276
|
|
|
277
|
+
get messageTemplate() {
|
|
278
|
+
return html`
|
|
279
|
+
${this.message
|
|
280
|
+
? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>`
|
|
281
|
+
: ''
|
|
282
|
+
}
|
|
283
|
+
`
|
|
284
|
+
}
|
|
285
|
+
|
|
267
286
|
onFocus() {
|
|
268
287
|
this.opened = true;
|
|
269
288
|
}
|
|
@@ -271,6 +290,13 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
271
290
|
onTextInput(e) {
|
|
272
291
|
this.keyword = e.detail.keyword;
|
|
273
292
|
this.loadData();
|
|
293
|
+
this.hideErrorOnInteraction();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
hideErrorOnInteraction() {
|
|
297
|
+
if (this.hideErrorOnInput && this.errored) {
|
|
298
|
+
this.clearError();
|
|
299
|
+
}
|
|
274
300
|
}
|
|
275
301
|
|
|
276
302
|
loadData() {
|
|
@@ -308,6 +334,12 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
308
334
|
this.isSelected = true;
|
|
309
335
|
}
|
|
310
336
|
e.stopPropagation();
|
|
337
|
+
this.hideErrorOnInteraction();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
clearError() {
|
|
341
|
+
this.errored = false;
|
|
342
|
+
this.message = '';
|
|
311
343
|
}
|
|
312
344
|
|
|
313
345
|
onClearSelected() {
|
|
@@ -321,6 +353,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
321
353
|
this.search.focus();
|
|
322
354
|
});
|
|
323
355
|
}
|
|
356
|
+
this.hideErrorOnInteraction();
|
|
324
357
|
}
|
|
325
358
|
|
|
326
359
|
close() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.33",
|
|
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": "425ca943ebe7570e00cb8875b117ee6af3d4b955"
|
|
30
30
|
}
|