@dile/ui 2.21.1 → 2.21.3

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,7 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import '../radio.js';
4
- import '../input/input-message.js';
4
+ import '../../input/input-message.js';
5
5
 
6
6
  export class DileRadioGroup extends DileEmmitChange(LitElement) {
7
7
  static styles = [
@@ -20,6 +20,9 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
20
20
  position: relative;
21
21
  margin-bottom: 10px;
22
22
  }
23
+ #result {
24
+ margin-bottom: 0.5rem;
25
+ }
23
26
  label {
24
27
  display: block;
25
28
  margin-bottom: var(--dile-input-label-margin-bottom, 4px);
@@ -83,11 +86,11 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
83
86
  displayProperty: { type: String },
84
87
  idProperty: { type: String },
85
88
  delay: { type: Number },
86
- opened: {
89
+ opened: {
87
90
  type: Boolean,
88
91
  state: true,
89
92
  },
90
- keyword: {
93
+ keyword: {
91
94
  type: String,
92
95
  state: true,
93
96
  },
@@ -102,7 +105,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
102
105
  /* When static is true there is no posibility to search, then all the options are displayed on the select on initialization */
103
106
  static: {
104
107
  type: Boolean,
105
- },
108
+ },
106
109
  /** Message Displayed */
107
110
  message: { type: String },
108
111
  /** Hide errors on input */
@@ -166,9 +169,9 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
166
169
  .then(json => this.registerText(json))
167
170
  .catch(error => this.registerError(error));
168
171
  }
169
-
172
+
170
173
  registerText(json) {
171
- this.selectedText = json[this.resultDataProperty][this.displayProperty];
174
+ this.selectedText = json[this.resultDataProperty][this.displayProperty];
172
175
  this.loading = false;
173
176
  }
174
177
 
@@ -198,9 +201,9 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
198
201
 
199
202
  get selectedTemplate() {
200
203
  return html`
201
- <dile-input-search
204
+ <dile-input-search
202
205
  id="result"
203
- ?errored=${this.errored}
206
+ ?errored=${this.errored}
204
207
  ?disabled=${this.disabled}
205
208
  value="${this.selectedText}"
206
209
  readOnly
@@ -212,11 +215,11 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
212
215
 
213
216
  get searchTemplate() {
214
217
  return html`
215
- <dile-input-search
218
+ <dile-input-search
216
219
  id="search"
217
- placeholder="${this.placeholder}"
218
- label="${this.label}"
219
- ?errored=${this.errored}
220
+ placeholder="${this.placeholder}"
221
+ label="${this.label}"
222
+ ?errored=${this.errored}
220
223
  ?disabled=${this.disabled}
221
224
  @focus=${this.onFocus}
222
225
  @dile-input-search=${this.onTextInput}
@@ -267,8 +270,8 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
267
270
 
268
271
  get dataTemplate() {
269
272
  return html`
270
- <dile-select
271
- id="elselect"
273
+ <dile-select
274
+ id="elselect"
272
275
  @element-changed=${this.doSelected}
273
276
  name="generated-select-field"
274
277
  ?errored=${this.errored}
@@ -279,13 +282,13 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
279
282
  <option value="${item[this.idProperty]}">${item[this.displayProperty]}</option>
280
283
  `)}
281
284
  </select>
282
- </dile-select>
285
+ </dile-select>
283
286
  `;
284
287
  }
285
288
 
286
289
  get messageTemplate() {
287
290
  return html`
288
- ${this.message
291
+ ${this.message
289
292
  ? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>`
290
293
  : ''
291
294
  }
@@ -312,38 +315,38 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
312
315
  this.loading = true;
313
316
  this.ajaxError = false;
314
317
  const url = this.computeRequestURL();
315
-
318
+
316
319
  fetch(url)
317
320
  .then(response => response.json())
318
321
  .then(json => this.registerData(json))
319
322
  .catch(error => this.registerError(error));
320
323
  }
321
-
324
+
322
325
  computeRequestURL() {
323
326
  const baseUrl = `${this.endpoint}?${this.queryStringVariable}=${this.keyword}`;
324
-
327
+
325
328
  if (this.additionalQueryString && typeof this.additionalQueryString === 'object') {
326
329
  const additionalParams = Object.entries(this.additionalQueryString)
327
330
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
328
331
  .join('&');
329
-
332
+
330
333
  return `${baseUrl}&${additionalParams}`;
331
334
  }
332
-
335
+
333
336
  return baseUrl;
334
337
  }
335
-
338
+
336
339
 
337
340
  registerError(err) {
338
341
  this.ajaxError = true;
339
342
  this.loading = false;
340
343
  }
341
-
344
+
342
345
  registerData(json) {
343
346
  this.data = this.getResultData(json);
344
347
  this.updateComplete.then( () => this.loading = false )
345
348
  }
346
-
349
+
347
350
  getResultData(json) {
348
351
  if (this.resultDataProperty === undefined || this.resultDataProperty === '') {
349
352
  return json;
@@ -401,12 +404,12 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
401
404
  }
402
405
 
403
406
  dispatchSelectedTextChanged() {
404
- this.dispatchEvent(new CustomEvent('dile-select-ajax-selected-text-changed',
405
- {
407
+ this.dispatchEvent(new CustomEvent('dile-select-ajax-selected-text-changed',
408
+ {
406
409
  bubbles: true,
407
410
  composed: true,
408
411
  detail: { selectedText: this.selectedText }
409
412
  }
410
413
  ));
411
414
  }
412
- }
415
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/ui",
3
- "version": "2.21.1",
3
+ "version": "2.21.3",
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": "e9639442e17f7bd3e467a1177dc233bb9913dc1e"
29
+ "gitHead": "67e2e845295d11fcdbf3dedcc989d26b821005d4"
30
30
  }