@dile/ui 2.5.2 → 2.5.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.
|
@@ -107,6 +107,8 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
107
107
|
message: { type: String },
|
|
108
108
|
/** Hide errors on input */
|
|
109
109
|
hideErrorOnInput: { type: Boolean },
|
|
110
|
+
/** Additional query string data */
|
|
111
|
+
additionalQueryString: {type: Object },
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -294,7 +296,6 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
onTextInput(e) {
|
|
297
|
-
console.log('onTextInput', e);
|
|
298
299
|
this.keyword = e.detail.keyword;
|
|
299
300
|
this.loadData();
|
|
300
301
|
this.hideErrorOnInteraction();
|
|
@@ -309,11 +310,28 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
309
310
|
loadData() {
|
|
310
311
|
this.loading = true;
|
|
311
312
|
this.ajaxError = false;
|
|
312
|
-
|
|
313
|
+
const url = this.computeRequestURL();
|
|
314
|
+
|
|
315
|
+
fetch(url)
|
|
313
316
|
.then(response => response.json())
|
|
314
317
|
.then(json => this.registerData(json))
|
|
315
318
|
.catch(error => this.registerError(error));
|
|
316
319
|
}
|
|
320
|
+
|
|
321
|
+
computeRequestURL() {
|
|
322
|
+
const baseUrl = `${this.endpoint}?${this.queryStringVariable}=${this.keyword}`;
|
|
323
|
+
|
|
324
|
+
if (this.additionalQueryString && typeof this.additionalQueryString === 'object') {
|
|
325
|
+
const additionalParams = Object.entries(this.additionalQueryString)
|
|
326
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
327
|
+
.join('&');
|
|
328
|
+
|
|
329
|
+
return `${baseUrl}&${additionalParams}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return baseUrl;
|
|
333
|
+
}
|
|
334
|
+
|
|
317
335
|
|
|
318
336
|
registerError(err) {
|
|
319
337
|
this.ajaxError = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.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": "
|
|
29
|
+
"gitHead": "213421f317cd0fcaa7b6ca20834d292fce8ded7f"
|
|
30
30
|
}
|