|
37 | 37 | )
|
38 | 38 | </template>
|
39 | 39 | <script>
|
| 40 | +/*global Vue:true*/ |
40 | 41 | import abstractField from "./abstractField";
|
41 | 42 |
|
42 | 43 | export default {
|
43 |
| - mixins: [abstractField], |
44 |
| - computed: { |
45 |
| - options() { |
46 |
| - let values = this.schema.values; |
47 |
| - if (typeof(values) == "function") { |
48 |
| - return values.apply(this, [this.model, this.schema]); |
49 |
| - } else { |
50 |
| - return values; |
51 |
| - } |
52 |
| - } |
53 |
| - }, |
54 |
| - methods: { |
55 |
| - updateSelected(value, id) { |
56 |
| - this.value = value; |
57 |
| - }, |
58 |
| - addTag(newTag, id) { |
59 |
| - let onNewTag = this.schema.selectOptions.onNewTag; |
60 |
| - if (typeof(onNewTag) == "function") { |
61 |
| - onNewTag(newTag, id, this.options, this.value); |
62 |
| - } |
63 |
| - }, |
64 |
| - onSearchChange(searchQuery, id) { |
65 |
| - let onSearch = this.schema.selectOptions.onSearch; |
66 |
| - if (typeof(onSearch) == "function") { |
67 |
| - onSearch(searchQuery, id, this.options); |
68 |
| - } |
69 |
| - }, |
70 |
| - onSelect(selectedOption, id) { |
71 |
| - // console.log("onSelect", selectedOption, id); |
72 |
| - }, |
73 |
| - onRemove(removedOption, id) { |
74 |
| - // console.log("onRemove", removedOption, id); |
75 |
| - }, |
76 |
| - onOpen(id) { |
77 |
| - // console.log("onOpen", id); |
78 |
| - }, |
79 |
| - onClose(value, id) { |
80 |
| - // console.log("onClose", value, id); |
81 |
| - } |
82 |
| - }, |
83 |
| - created() { |
84 |
| - // Check if the component is loaded |
85 |
| - if (window.VueMultiselect) { |
86 |
| - Vue.component("multiselect", window.VueMultiselect.default); |
87 |
| - } else { |
88 |
| - console.error("'vue-multiselect' is missing. Please download from https://github.com/monterail/vue-multiselect and load the script in the HTML head section!"); |
89 |
| - } |
90 |
| - } |
| 44 | + mixins: [abstractField], |
| 45 | + computed: { |
| 46 | + options() { |
| 47 | + let values = this.schema.values; |
| 48 | + if (typeof(values) == "function") { |
| 49 | + return values.apply(this, [this.model, this.schema]); |
| 50 | + } else { |
| 51 | + return values; |
| 52 | + } |
| 53 | + } |
| 54 | + }, |
| 55 | + methods: { |
| 56 | + updateSelected(value/*, id*/) { |
| 57 | + this.value = value; |
| 58 | + }, |
| 59 | + addTag(newTag, id) { |
| 60 | + let onNewTag = this.schema.selectOptions.onNewTag; |
| 61 | + if (typeof(onNewTag) == "function") { |
| 62 | + onNewTag(newTag, id, this.options, this.value); |
| 63 | + } |
| 64 | + }, |
| 65 | + onSearchChange(searchQuery, id) { |
| 66 | + let onSearch = this.schema.selectOptions.onSearch; |
| 67 | + if (typeof(onSearch) == "function") { |
| 68 | + onSearch(searchQuery, id, this.options); |
| 69 | + } |
| 70 | + }, |
| 71 | + onSelect(/*selectedOption, id*/) { |
| 72 | + // console.log("onSelect", selectedOption, id); |
| 73 | + }, |
| 74 | + onRemove(/*removedOption, id*/) { |
| 75 | + // console.log("onRemove", removedOption, id); |
| 76 | + }, |
| 77 | + onOpen(/*id*/) { |
| 78 | + // console.log("onOpen", id); |
| 79 | + }, |
| 80 | + onClose(/*value, id*/) { |
| 81 | + // console.log("onClose", value, id); |
| 82 | + } |
| 83 | + }, |
| 84 | + created() { |
| 85 | + // Check if the component is loaded |
| 86 | + if (window.VueMultiselect) { |
| 87 | + Vue.component("multiselect", window.VueMultiselect.default); |
| 88 | + } else { |
| 89 | + console.error("'vue-multiselect' is missing. Please download from https://github.com/monterail/vue-multiselect and load the script in the HTML head section!"); |
| 90 | + } |
| 91 | + } |
91 | 92 | };
|
92 | 93 | </script>
|
93 | 94 |
|
0 commit comments