slim-select 2.0.2 → 2.2.0
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/README.md +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/render.d.ts +10 -3
- package/dist/select.d.ts +6 -6
- package/dist/settings.d.ts +0 -3
- package/dist/slimselect.cjs.js +202 -67
- package/dist/slimselect.css +1 -1
- package/dist/slimselect.css.map +1 -1
- package/dist/slimselect.es.js +202 -67
- package/dist/slimselect.global.js +202 -67
- package/dist/slimselect.js +202 -67
- package/dist/slimselect.min.js +1 -1
- package/dist/slimselect.umd.js +202 -67
- package/dist/slimselect.umd.min.js +1 -1
- package/dist/store.d.ts +5 -0
- package/docs/assets/data.js +7 -3
- package/docs/assets/home.css +1 -1
- package/docs/assets/home.js +1 -1
- package/docs/assets/index.css +1 -1
- package/docs/assets/index.js +7 -7
- package/docs/assets/index2.js +119 -35
- package/docs/assets/index3.js +39 -23
- package/docs/assets/index4.js +1 -1
- package/docs/assets/index5.js +147 -9
- package/docs/assets/install.js +4 -4
- package/docs/assets/selects.js +1 -1
- package/package.json +11 -3
- package/src/docs/app.vue +6 -5
- package/src/docs/{images → assets/images}/check-mark.svg +0 -0
- package/src/docs/{images → assets/images}/chrome.svg +0 -0
- package/src/docs/{images → assets/images}/firefox.svg +0 -0
- package/src/docs/{images → assets/images}/github.png +0 -0
- package/src/docs/{images → assets/images}/ie.svg +0 -0
- package/src/docs/{images → assets/images}/npm.png +0 -0
- package/src/docs/{images → assets/images}/opera.svg +0 -0
- package/src/docs/{images → assets/images}/safari.svg +0 -0
- package/src/docs/assets/scss/misc.scss +7 -0
- package/src/docs/env.d.ts +1 -0
- package/src/docs/pages/data.vue +4 -0
- package/src/docs/pages/events/addable.vue +22 -6
- package/src/docs/pages/events/before_after_change.vue +15 -1
- package/src/docs/pages/events/search.vue +31 -16
- package/src/docs/pages/frameworks/vue.vue +375 -7
- package/src/docs/pages/home.vue +104 -57
- package/src/docs/pages/methods/get_data.vue +2 -1
- package/src/docs/pages/methods/open_close.vue +1 -1
- package/src/docs/pages/settings/closable.vue +128 -0
- package/src/docs/pages/settings/index.vue +6 -3
- package/src/docs/pages/settings/select_all.vue +88 -0
- package/src/slim-select/index.ts +4 -2
- package/src/slim-select/render.ts +247 -59
- package/src/slim-select/rollup.config.mjs +5 -0
- package/src/slim-select/select.ts +48 -31
- package/src/slim-select/settings.ts +0 -4
- package/src/slim-select/slimselect.scss +112 -11
- package/src/slim-select/store.ts +19 -1
- package/src/vue/README.md +48 -0
- package/src/vue/dist/slimselectvue.es.js +1752 -0
- package/src/vue/dist/slimselectvue.global.js +1755 -0
- package/src/vue/dist/slimselectvue.ssr.js +1754 -0
- package/src/vue/hello.ts +5 -0
- package/src/vue/package.json +28 -0
- package/src/vue/rollup.config.mjs +44 -0
- package/src/vue/slimselect.vue +39 -5
- package/src/vue/tsconfig.json +14 -0
- package/src/docs/pages/settings/select_by_group.vue +0 -46
package/src/docs/pages/home.vue
CHANGED
|
@@ -95,41 +95,44 @@ export default defineComponent({
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.
|
|
98
|
+
.support {
|
|
99
|
+
.links {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
gap: var(--spacing);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.features {
|
|
107
|
+
flex: 1 1 auto;
|
|
99
108
|
display: flex;
|
|
100
|
-
|
|
109
|
+
flex-direction: column;
|
|
101
110
|
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
flex-direction: column;
|
|
111
|
+
.header {
|
|
112
|
+
padding: 0 0 var(--spacing) 0;
|
|
113
|
+
}
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
115
|
+
.row {
|
|
116
|
+
justify-content: space-around;
|
|
110
117
|
|
|
111
|
-
.
|
|
112
|
-
|
|
118
|
+
.list {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
list-style: none;
|
|
122
|
+
padding: 0px;
|
|
123
|
+
width: 200px;
|
|
124
|
+
margin: 0 auto;
|
|
113
125
|
|
|
114
|
-
|
|
126
|
+
li {
|
|
115
127
|
display: flex;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
align-items: center;
|
|
125
|
-
padding: 0 0 5px 0;
|
|
126
|
-
font-weight: bold;
|
|
127
|
-
font-size: 20px;
|
|
128
|
-
|
|
129
|
-
img {
|
|
130
|
-
width: 20px;
|
|
131
|
-
padding: 0 8px 0 0;
|
|
132
|
-
}
|
|
128
|
+
align-items: center;
|
|
129
|
+
padding: 0 0 5px 0;
|
|
130
|
+
font-weight: bold;
|
|
131
|
+
font-size: 20px;
|
|
132
|
+
|
|
133
|
+
img {
|
|
134
|
+
width: 20px;
|
|
135
|
+
padding: 0 8px 0 0;
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
}
|
|
@@ -160,34 +163,78 @@ export default defineComponent({
|
|
|
160
163
|
</div>
|
|
161
164
|
</div>
|
|
162
165
|
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
166
|
+
<br />
|
|
167
|
+
|
|
168
|
+
<div class="support">
|
|
169
|
+
<h2 class="header">Support</h2>
|
|
170
|
+
<p>Help support creators that make development easier!</p>
|
|
171
|
+
<div class="links">
|
|
172
|
+
<iframe
|
|
173
|
+
src="https://github.com/sponsors/brianvoe/button"
|
|
174
|
+
title="Sponsor brianvoe"
|
|
175
|
+
height="35"
|
|
176
|
+
width="116"
|
|
177
|
+
style="border: 0"
|
|
178
|
+
></iframe>
|
|
179
|
+
<a href="https://www.buymeacoffee.com/brianvoe" target="_blank"
|
|
180
|
+
><img
|
|
181
|
+
src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png"
|
|
182
|
+
alt="Buy Me A Coffee"
|
|
183
|
+
style="height: auto !important; width: auto !important"
|
|
184
|
+
/></a>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<br />
|
|
189
|
+
<div class="separator" />
|
|
190
|
+
<br />
|
|
191
|
+
|
|
192
|
+
<div class="features">
|
|
193
|
+
<h2 class="header">Features</h2>
|
|
194
|
+
|
|
195
|
+
<div class="row">
|
|
196
|
+
<ul class="list">
|
|
197
|
+
<li><img src="../assets/images/check-mark.svg" /> No Dependencies</li>
|
|
198
|
+
<li><img src="../assets/images/check-mark.svg" /> ~30kb - ~5kb gzip</li>
|
|
199
|
+
<li><img src="../assets/images/check-mark.svg" /> Single Select</li>
|
|
200
|
+
<li><img src="../assets/images/check-mark.svg" /> Multiple Select</li>
|
|
201
|
+
<li><img src="../assets/images/check-mark.svg" /> Addable Options</li>
|
|
202
|
+
<li><img src="../assets/images/check-mark.svg" /> Html Options</li>
|
|
203
|
+
<li><img src="../assets/images/check-mark.svg" /> Settable Data</li>
|
|
204
|
+
<li><img src="../assets/images/check-mark.svg" /> Callback Events</li>
|
|
205
|
+
<li><img src="../assets/images/check-mark.svg" /> Placeholders</li>
|
|
206
|
+
</ul>
|
|
207
|
+
<ul class="list">
|
|
208
|
+
<li><img src="../assets/images/check-mark.svg" /> Advanced Search</li>
|
|
209
|
+
<li><img src="../assets/images/check-mark.svg" /> Tabbable</li>
|
|
210
|
+
<li><img src="../assets/images/check-mark.svg" /> Disable Options</li>
|
|
211
|
+
<li><img src="../assets/images/check-mark.svg" /> Light Css</li>
|
|
212
|
+
<li><img src="../assets/images/check-mark.svg" /> Light Color Scheme</li>
|
|
213
|
+
<li><img src="../assets/images/check-mark.svg" /> Style Inheritance</li>
|
|
214
|
+
<li><img src="../assets/images/check-mark.svg" /> Clean Animations</li>
|
|
215
|
+
<li><img src="../assets/images/check-mark.svg" /> Performant</li>
|
|
216
|
+
<li><img src="../assets/images/check-mark.svg" /> Typescript</li>
|
|
217
|
+
</ul>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<br />
|
|
222
|
+
<div class="separator" />
|
|
223
|
+
<br />
|
|
224
|
+
|
|
225
|
+
<div class="frameworks">
|
|
226
|
+
<h2 class="header">Frameworks</h2>
|
|
227
|
+
<p>
|
|
228
|
+
SlimSelect is in the process of adding a few framework integrations.<br />
|
|
229
|
+
If you are an expert in any specific framework and would like to help out, please reach out!
|
|
230
|
+
</p>
|
|
231
|
+
<div class="row frameworks">
|
|
232
|
+
<router-link to="frameworks#vue">
|
|
233
|
+
<svg viewBox="0 0 128 128" width="100" height="100">
|
|
234
|
+
<path fill="#42b883" d="M78.8,10L64,35.4L49.2,10H0l64,110l64-110C128,10,78.8,10,78.8,10z"></path>
|
|
235
|
+
<path fill="#35495e" d="M78.8,10L64,35.4L49.2,10H25.6L64,76l38.4-66H78.8z"></path>
|
|
236
|
+
</svg>
|
|
237
|
+
</router-link>
|
|
191
238
|
</div>
|
|
192
239
|
</div>
|
|
193
240
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { defineComponent } from 'vue'
|
|
3
3
|
|
|
4
|
-
import SlimSelect
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
import { DataArray } from '../../../slim-select/store'
|
|
5
6
|
|
|
6
7
|
export default defineComponent({
|
|
7
8
|
name: 'GetData',
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'Closable',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.closableSingle as HTMLSelectElement,
|
|
11
|
+
})
|
|
12
|
+
new SlimSelect({
|
|
13
|
+
select: this.$refs.closableMultiple as HTMLSelectElement,
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div id="closable" class="content">
|
|
21
|
+
<h2 class="header">closable</h2>
|
|
22
|
+
<p>closable is a optgroup settings that adds the ability to have closable optgroup options.</p>
|
|
23
|
+
<p>Values: <strong>"off"</strong> | <strong>"open"</strong> | <strong>"close"</strong></p>
|
|
24
|
+
<p>Default: <strong>"off"</strong></p>
|
|
25
|
+
|
|
26
|
+
<div class="alert info">You can set closable either by data or by html dataset added to the optgroup element</div>
|
|
27
|
+
|
|
28
|
+
<div class="row">
|
|
29
|
+
<select ref="closableSingle">
|
|
30
|
+
<optgroup label="Label 1" data-closable="off">
|
|
31
|
+
<option value="value1">Value 1</option>
|
|
32
|
+
<option value="value2">Value 2</option>
|
|
33
|
+
<option value="value3">Value 3</option>
|
|
34
|
+
</optgroup>
|
|
35
|
+
<optgroup label="Label 2" data-closable="open">
|
|
36
|
+
<option value="value4">Value 4</option>
|
|
37
|
+
<option value="value5">Value 5</option>
|
|
38
|
+
<option value="value6">Value 6</option>
|
|
39
|
+
</optgroup>
|
|
40
|
+
<optgroup label="Label 3" data-closable="close">
|
|
41
|
+
<option value="value7">Value 7</option>
|
|
42
|
+
<option value="value8">Value 8</option>
|
|
43
|
+
<option value="value9">Value 9</option>
|
|
44
|
+
</optgroup>
|
|
45
|
+
</select>
|
|
46
|
+
<select ref="closableMultiple" multiple>
|
|
47
|
+
<optgroup label="Label 1" data-selectall="true" data-closable="off">
|
|
48
|
+
<option value="value1">Value 1</option>
|
|
49
|
+
<option value="value2">Value 2</option>
|
|
50
|
+
<option value="value3">Value 3</option>
|
|
51
|
+
</optgroup>
|
|
52
|
+
<optgroup label="Label 2" data-selectall="true" data-closable="open">
|
|
53
|
+
<option value="value4">Value 4</option>
|
|
54
|
+
<option value="value5">Value 5</option>
|
|
55
|
+
<option value="value6">Value 6</option>
|
|
56
|
+
</optgroup>
|
|
57
|
+
<optgroup label="Label 3" data-selectall="true" data-closable="close">
|
|
58
|
+
<option value="value7">Value 7</option>
|
|
59
|
+
<option value="value8">Value 8</option>
|
|
60
|
+
<option value="value9">Value 9</option>
|
|
61
|
+
</optgroup>
|
|
62
|
+
</select>
|
|
63
|
+
</div>
|
|
64
|
+
<br />
|
|
65
|
+
|
|
66
|
+
<h3>Via data</h3>
|
|
67
|
+
<pre>
|
|
68
|
+
<code class="language-javascript">
|
|
69
|
+
new SlimSelect({
|
|
70
|
+
select: '#selectElement',
|
|
71
|
+
data: [
|
|
72
|
+
{
|
|
73
|
+
label: 'Label 1',
|
|
74
|
+
closable: 'off',
|
|
75
|
+
options: [
|
|
76
|
+
{ text: 'Option 1', value: '1' },
|
|
77
|
+
{ text: 'Option 2', value: '2' },
|
|
78
|
+
{ text: 'Option 3', value: '3' },
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: 'Label 2',
|
|
83
|
+
closable: 'open',
|
|
84
|
+
options: [
|
|
85
|
+
{ text: 'Option 4', value: '4' },
|
|
86
|
+
{ text: 'Option 5', value: '5' },
|
|
87
|
+
{ text: 'Option 6', value: '6' },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: 'Label 3',
|
|
92
|
+
closable: 'close',
|
|
93
|
+
options: [
|
|
94
|
+
{ text: 'Option 7', value: '7' },
|
|
95
|
+
{ text: 'Option 8', value: '8' },
|
|
96
|
+
{ text: 'Option 9', value: '9' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
})
|
|
101
|
+
</code>
|
|
102
|
+
</pre>
|
|
103
|
+
<br />
|
|
104
|
+
|
|
105
|
+
<h3>Via html</h3>
|
|
106
|
+
<pre>
|
|
107
|
+
<code class="language-html">
|
|
108
|
+
<select ref="closable" multiple>
|
|
109
|
+
<optgroup label="Label 1" data-closable="off">
|
|
110
|
+
<option value="value1">Value 1</option>
|
|
111
|
+
<option value="value2">Value 2</option>
|
|
112
|
+
<option value="value3">Value 3</option>
|
|
113
|
+
</optgroup>
|
|
114
|
+
<optgroup label="Label 2" data-closable="open">
|
|
115
|
+
<option value="value4">Value 4</option>
|
|
116
|
+
<option value="value5">Value 5</option>
|
|
117
|
+
<option value="value6">Value 6</option>
|
|
118
|
+
</optgroup>
|
|
119
|
+
<optgroup label="Label 3" data-closable="close">
|
|
120
|
+
<option value="value7">Value 7</option>
|
|
121
|
+
<option value="value8">Value 8</option>
|
|
122
|
+
<option value="value9">Value 9</option>
|
|
123
|
+
</optgroup>
|
|
124
|
+
</select>
|
|
125
|
+
</code>
|
|
126
|
+
</pre>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
@@ -3,6 +3,7 @@ import { defineComponent } from 'vue'
|
|
|
3
3
|
|
|
4
4
|
// Components
|
|
5
5
|
import AlwaysOpen from './always_open.vue'
|
|
6
|
+
import Closable from './closable.vue'
|
|
6
7
|
import CloseOnSelect from './close_on_select.vue'
|
|
7
8
|
import ContentLocation from './content_location.vue'
|
|
8
9
|
import ContentPosition from './content_position.vue'
|
|
@@ -18,7 +19,7 @@ import OpenPosition from './open_position.vue'
|
|
|
18
19
|
import Placeholder from './placeholder.vue'
|
|
19
20
|
import Search from './search.vue'
|
|
20
21
|
import Select from './select.vue'
|
|
21
|
-
import
|
|
22
|
+
import SelectAll from './select_all.vue'
|
|
22
23
|
import ShowTooltip from './show_tooltip.vue'
|
|
23
24
|
import Styles from './styles.vue'
|
|
24
25
|
|
|
@@ -42,7 +43,8 @@ export default defineComponent({
|
|
|
42
43
|
Search,
|
|
43
44
|
CloseOnSelect,
|
|
44
45
|
ShowTooltip,
|
|
45
|
-
|
|
46
|
+
SelectAll,
|
|
47
|
+
Closable,
|
|
46
48
|
HideSelected,
|
|
47
49
|
},
|
|
48
50
|
})
|
|
@@ -67,7 +69,8 @@ export default defineComponent({
|
|
|
67
69
|
<Search />
|
|
68
70
|
<CloseOnSelect />
|
|
69
71
|
<ShowTooltip />
|
|
70
|
-
<
|
|
72
|
+
<SelectAll />
|
|
73
|
+
<Closable />
|
|
71
74
|
<HideSelected />
|
|
72
75
|
</div>
|
|
73
76
|
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'SelectAll',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.selectAll as HTMLSelectElement,
|
|
11
|
+
})
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div id="selectAll" class="content">
|
|
18
|
+
<h2 class="header">selectAll</h2>
|
|
19
|
+
<p>
|
|
20
|
+
selectAll is a setting that can be used to add a select all action to an optgroup. This setting can be set to true
|
|
21
|
+
or false. If set to true, a select all option will be added to the top of the selected values. If set to false or
|
|
22
|
+
not set at all, no select all action will be added to the optgroup.
|
|
23
|
+
</p>
|
|
24
|
+
<div class="alert info">You can set selectAll either by data or by html dataset added to the optgroup element</div>
|
|
25
|
+
|
|
26
|
+
<select ref="selectAll" multiple>
|
|
27
|
+
<optgroup label="Label 1" data-selectall="true">
|
|
28
|
+
<option value="value1">Value 1</option>
|
|
29
|
+
<option value="value2">Value 2</option>
|
|
30
|
+
<option value="value3">Value 3</option>
|
|
31
|
+
</optgroup>
|
|
32
|
+
<optgroup label="Label 2">
|
|
33
|
+
<option value="value4">Value 4</option>
|
|
34
|
+
<option value="value5">Value 5</option>
|
|
35
|
+
<option value="value6">Value 6</option>
|
|
36
|
+
</optgroup>
|
|
37
|
+
</select>
|
|
38
|
+
<br />
|
|
39
|
+
|
|
40
|
+
<h3>Via data</h3>
|
|
41
|
+
<pre>
|
|
42
|
+
<code class="language-javascript">
|
|
43
|
+
new SlimSelect({
|
|
44
|
+
select: '#selectElement',
|
|
45
|
+
data: [
|
|
46
|
+
{
|
|
47
|
+
label: 'Label 1',
|
|
48
|
+
selectAll: true,
|
|
49
|
+
options: [
|
|
50
|
+
{ text: 'Option 1', value: '1' },
|
|
51
|
+
{ text: 'Option 2', value: '2' },
|
|
52
|
+
{ text: 'Option 3', value: '3' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: 'Label 2',
|
|
57
|
+
selectAll: false,
|
|
58
|
+
options: [
|
|
59
|
+
{ text: 'Option 4', value: '4' },
|
|
60
|
+
{ text: 'Option 5', value: '5' },
|
|
61
|
+
{ text: 'Option 6', value: '6' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
})
|
|
66
|
+
</code>
|
|
67
|
+
</pre>
|
|
68
|
+
<br />
|
|
69
|
+
|
|
70
|
+
<h3>Via html</h3>
|
|
71
|
+
<pre>
|
|
72
|
+
<code class="language-html">
|
|
73
|
+
<select ref="selectAll" multiple>
|
|
74
|
+
<optgroup label="Label 1" data-selectall="true">
|
|
75
|
+
<option value="value1">Value 1</option>
|
|
76
|
+
<option value="value2">Value 2</option>
|
|
77
|
+
<option value="value3">Value 3</option>
|
|
78
|
+
</optgroup>
|
|
79
|
+
<optgroup label="Label 2">
|
|
80
|
+
<option value="value4">Value 4</option>
|
|
81
|
+
<option value="value5">Value 5</option>
|
|
82
|
+
<option value="value6">Value 6</option>
|
|
83
|
+
</optgroup>
|
|
84
|
+
</select>
|
|
85
|
+
</code>
|
|
86
|
+
</pre>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
package/src/slim-select/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface Config {
|
|
|
14
14
|
export interface Events {
|
|
15
15
|
search?: (searchValue: string, currentData: DataArray) => Promise<DataArrayPartial> | DataArrayPartial
|
|
16
16
|
searchFilter?: (option: Option, search: string) => boolean
|
|
17
|
-
addable?: (value: string) => OptionOptional | string
|
|
17
|
+
addable?: (value: string) => Promise<OptionOptional | string> | OptionOptional | string
|
|
18
18
|
beforeChange?: (newVal: Option[], oldVal: Option[]) => boolean | void
|
|
19
19
|
afterChange?: (newVal: Option[]) => void
|
|
20
20
|
beforeOpen?: () => void
|
|
@@ -92,7 +92,7 @@ export default class SlimSelect {
|
|
|
92
92
|
this.select.hideUI() // Hide the original select element
|
|
93
93
|
|
|
94
94
|
// Add select listeners
|
|
95
|
-
this.select.addSelectChangeListener((data:
|
|
95
|
+
this.select.addSelectChangeListener((data: DataArrayPartial) => {
|
|
96
96
|
// Run set data from the values given
|
|
97
97
|
this.setData(data)
|
|
98
98
|
})
|
|
@@ -126,6 +126,8 @@ export default class SlimSelect {
|
|
|
126
126
|
|
|
127
127
|
// Setup render class
|
|
128
128
|
this.render = new Render(this.settings, this.store, callbacks)
|
|
129
|
+
this.render.renderValues()
|
|
130
|
+
this.render.renderOptions(this.store.getData())
|
|
129
131
|
|
|
130
132
|
// Add render after original select element
|
|
131
133
|
if (this.selectEl.parentNode) {
|