@enso-ui/select 3.0.9 → 3.0.13
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.
- package/package.json +1 -1
- package/src/bulma/EnsoSelect.vue +3 -2
- package/src/bulma/VueSelect.vue +22 -16
- package/src/renderless/CoreSelect.vue +14 -4
package/package.json
CHANGED
package/src/bulma/EnsoSelect.vue
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<vue-select v-bind="$attrs"
|
|
3
|
+
:http="http"
|
|
3
4
|
:i18n="i18n"
|
|
4
5
|
:error-handler="errorHandler"
|
|
5
|
-
:source="source ? route(source) : null"
|
|
6
|
+
:source="source ? route(source) : null"
|
|
6
7
|
ref="select">
|
|
7
8
|
<template #option="props">
|
|
8
9
|
<slot name="option"
|
|
@@ -19,7 +20,7 @@ export default {
|
|
|
19
20
|
|
|
20
21
|
components: { VueSelect },
|
|
21
22
|
|
|
22
|
-
inject: ['errorHandler', 'i18n', 'route'],
|
|
23
|
+
inject: ['errorHandler', 'http', 'i18n', 'route'],
|
|
23
24
|
|
|
24
25
|
props: {
|
|
25
26
|
source: {
|
package/src/bulma/VueSelect.vue
CHANGED
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
<dropdown-indicator :open="open" v-if="!disabled"/>
|
|
59
59
|
</button>
|
|
60
60
|
</template>
|
|
61
|
-
<template #controls
|
|
61
|
+
<template #controls="{ keydown }"
|
|
62
62
|
v-if="needsSearch">
|
|
63
|
-
<div class="
|
|
63
|
+
<div class="search">
|
|
64
64
|
<div class="control has-icons-right">
|
|
65
65
|
<input class="input"
|
|
66
66
|
v-bind="filterBindings"
|
|
67
67
|
type="text"
|
|
68
68
|
:placeholder="i18n(labels.search)"
|
|
69
|
-
v-on="filterEvents"
|
|
69
|
+
v-on="{ ...filterEvents, keydown }"
|
|
70
70
|
v-focus>
|
|
71
71
|
<search-mode class="is-right icon is-small search-mode"
|
|
72
72
|
v-bind="modeBindings"
|
|
@@ -199,6 +199,8 @@ export default {
|
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
<style lang="scss">
|
|
202
|
+
@import 'bulma/sass/utilities/derived-variables';
|
|
203
|
+
|
|
202
204
|
.vue-select {
|
|
203
205
|
.dropdown {
|
|
204
206
|
width: 100%;
|
|
@@ -211,6 +213,10 @@ export default {
|
|
|
211
213
|
height: unset;
|
|
212
214
|
min-height: 2.2125em;
|
|
213
215
|
|
|
216
|
+
&.has-error {
|
|
217
|
+
border-color: $danger;
|
|
218
|
+
}
|
|
219
|
+
|
|
214
220
|
.control-display {
|
|
215
221
|
&.with-clear-button {
|
|
216
222
|
max-width: calc(100% - 2.5em);
|
|
@@ -291,25 +297,25 @@ export default {
|
|
|
291
297
|
.dropdown-content {
|
|
292
298
|
width: 100%;
|
|
293
299
|
|
|
300
|
+
.search {
|
|
301
|
+
padding: 0 0.375rem 0.6rem;
|
|
302
|
+
|
|
303
|
+
.input {
|
|
304
|
+
height: 2em;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.search-mode {
|
|
308
|
+
right: 0.3em;
|
|
309
|
+
pointer-events: all;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
294
313
|
.dropdown-item {
|
|
295
314
|
text-overflow: ellipsis;
|
|
296
315
|
overflow-x: hidden;
|
|
297
316
|
white-space: nowrap;
|
|
298
317
|
padding: 0.375rem 2rem 0.375rem 0.6rem;
|
|
299
318
|
|
|
300
|
-
&.search {
|
|
301
|
-
padding: 0 0.375rem 0.6rem;
|
|
302
|
-
|
|
303
|
-
.input {
|
|
304
|
-
height: 2em;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.search-mode {
|
|
308
|
-
right: 0.3em;
|
|
309
|
-
pointer-events: all;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
319
|
.label.tag {
|
|
314
320
|
position: absolute;
|
|
315
321
|
padding: 0.3rem;
|
|
@@ -29,6 +29,10 @@ export default {
|
|
|
29
29
|
throw error;
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
+
http: {
|
|
33
|
+
default: null,
|
|
34
|
+
type: Function,
|
|
35
|
+
},
|
|
32
36
|
i18n: {
|
|
33
37
|
type: Function,
|
|
34
38
|
default: v => v,
|
|
@@ -106,6 +110,8 @@ export default {
|
|
|
106
110
|
'selection', 'update', 'update:modelValue',
|
|
107
111
|
],
|
|
108
112
|
|
|
113
|
+
inheritAttrs: false,
|
|
114
|
+
|
|
109
115
|
data: v => ({
|
|
110
116
|
allowsSelection: true,
|
|
111
117
|
internalValue: null,
|
|
@@ -225,6 +231,10 @@ export default {
|
|
|
225
231
|
},
|
|
226
232
|
|
|
227
233
|
created() {
|
|
234
|
+
if(!this.http && this.source !== null) {
|
|
235
|
+
throw Error('Using the serverside mode requires providing a http client');
|
|
236
|
+
}
|
|
237
|
+
|
|
228
238
|
this.init();
|
|
229
239
|
},
|
|
230
240
|
|
|
@@ -276,10 +286,10 @@ export default {
|
|
|
276
286
|
this.ongoingRequest.cancel();
|
|
277
287
|
}
|
|
278
288
|
|
|
279
|
-
this.ongoingRequest =
|
|
289
|
+
this.ongoingRequest = this.http.CancelToken.source();
|
|
280
290
|
this.loading = true;
|
|
281
291
|
|
|
282
|
-
|
|
292
|
+
this.http.get(this.source, {
|
|
283
293
|
params: this.requestParams(),
|
|
284
294
|
cancelToken: this.ongoingRequest.token,
|
|
285
295
|
}).then(({ data }) => {
|
|
@@ -289,7 +299,7 @@ export default {
|
|
|
289
299
|
this.loading = false;
|
|
290
300
|
}).catch(error => {
|
|
291
301
|
this.loading = false;
|
|
292
|
-
if (!
|
|
302
|
+
if (!this.http.isCancel(error)) {
|
|
293
303
|
this.errorHandler(error);
|
|
294
304
|
}
|
|
295
305
|
});
|
|
@@ -359,7 +369,7 @@ export default {
|
|
|
359
369
|
},
|
|
360
370
|
reload() {
|
|
361
371
|
if (!this.hasOptions && !this.readonly && !this.disabled) {
|
|
362
|
-
this.
|
|
372
|
+
this.fetchIfServerSide();
|
|
363
373
|
}
|
|
364
374
|
},
|
|
365
375
|
requestParams() {
|