slim-select 1.27.1 → 2.0.1
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/.github/ISSUE_TEMPLATE/issue-report.md +3 -3
- package/.nvmrc +1 -0
- package/.prettierrc +6 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +15 -5
- package/README.md +17 -19
- package/dist/helper.d.ts +1 -4
- package/dist/index.d.ts +38 -58
- package/dist/render.d.ts +109 -0
- package/dist/select.d.ts +31 -20
- package/dist/settings.d.ts +33 -0
- package/dist/slimselect.cjs.js +2 -0
- package/dist/slimselect.cjs.js.map +1 -0
- package/dist/slimselect.css +1 -2
- package/dist/slimselect.css.map +1 -0
- package/dist/slimselect.es.js +2 -0
- package/dist/slimselect.es.js.map +1 -0
- package/dist/slimselect.global.js +2 -0
- package/dist/slimselect.global.js.map +1 -0
- package/dist/slimselect.js +2 -1970
- package/dist/slimselect.js.map +1 -0
- package/dist/slimselect.umd.js +2 -0
- package/dist/slimselect.umd.js.map +1 -0
- package/dist/store.d.ts +71 -0
- package/docs/assets/check-mark.svg +6 -0
- package/docs/assets/data.js +59 -0
- package/docs/assets/home.css +1 -0
- package/docs/assets/home.js +1 -0
- package/docs/assets/index.css +1 -0
- package/docs/assets/index.js +16 -0
- package/docs/assets/index2.js +274 -0
- package/docs/assets/index3.js +126 -0
- package/docs/assets/index4.js +60 -0
- package/docs/assets/install.js +34 -0
- package/docs/assets/selects.js +55 -0
- package/docs/index.html +18 -5
- package/docs.go +3 -1
- package/index.html +16 -0
- package/jest.config.js +7 -0
- package/package.json +39 -35
- package/src/docs/app.vue +196 -73
- package/src/docs/assets/scss/_variables.scss +26 -10
- package/src/docs/assets/scss/alert.scss +12 -0
- package/src/docs/assets/scss/animations.scss +5 -3
- package/src/docs/assets/scss/button.scss +21 -0
- package/src/docs/assets/scss/index.scss +8 -6
- package/src/docs/assets/scss/input.scss +2 -2
- package/src/docs/assets/scss/layout.scss +195 -65
- package/src/docs/assets/scss/misc.scss +144 -34
- package/src/docs/assets/scss/prism.scss +155 -153
- package/src/docs/env.d.ts +12 -0
- package/src/docs/images/check-mark.svg +6 -0
- package/src/docs/images/chrome.svg +22 -0
- package/src/docs/images/firefox.svg +58 -0
- package/src/docs/images/github.png +0 -0
- package/src/docs/images/ie.svg +11 -0
- package/src/docs/images/npm.png +0 -0
- package/src/docs/images/opera.svg +15 -0
- package/src/docs/images/safari.svg +22 -0
- package/src/docs/main.ts +27 -0
- package/src/docs/pages/data.vue +130 -0
- package/src/docs/pages/events/addable.vue +79 -0
- package/src/docs/pages/events/before_after_change.vue +140 -0
- package/src/docs/pages/events/before_after_open_close.vue +122 -0
- package/src/docs/pages/events/error.vue +59 -0
- package/src/docs/pages/events/index.vue +33 -0
- package/src/docs/pages/events/search.vue +154 -0
- package/src/docs/pages/events/search_filter.vue +45 -0
- package/src/docs/pages/home.vue +131 -117
- package/src/docs/pages/install.vue +51 -74
- package/src/docs/pages/methods/destroy.vue +66 -0
- package/src/docs/pages/methods/enable_disable.vue +70 -0
- package/src/docs/pages/methods/get_data.vue +81 -0
- package/src/docs/pages/methods/get_selected.vue +78 -0
- package/src/docs/pages/methods/index.vue +36 -0
- package/src/docs/pages/methods/open_close.vue +63 -0
- package/src/docs/pages/methods/search.vue +62 -0
- package/src/docs/pages/methods/set_data.vue +106 -0
- package/src/docs/pages/methods/set_selected.vue +70 -0
- package/src/docs/pages/selects.vue +108 -114
- package/src/docs/pages/settings/always_open.vue +88 -0
- package/src/docs/pages/settings/close_on_select.vue +69 -0
- package/src/docs/pages/settings/content_location.vue +64 -0
- package/src/docs/pages/settings/content_position.vue +86 -0
- package/src/docs/pages/settings/css.vue +73 -0
- package/src/docs/pages/settings/data_attributes.vue +39 -0
- package/src/docs/pages/settings/deselect.vue +69 -0
- package/src/docs/pages/settings/display.vue +88 -0
- package/src/docs/pages/settings/hide_selected.vue +73 -0
- package/src/docs/pages/settings/html.vue +86 -0
- package/src/docs/pages/settings/index.vue +73 -0
- package/src/docs/pages/settings/mandatory.vue +91 -0
- package/src/docs/pages/settings/min_max.vue +61 -0
- package/src/docs/pages/settings/open_position.vue +60 -0
- package/src/docs/pages/settings/placeholder.vue +72 -0
- package/src/docs/pages/settings/search.vue +140 -0
- package/src/docs/pages/settings/select.vue +32 -0
- package/src/docs/pages/settings/select_by_group.vue +46 -0
- package/src/docs/pages/settings/show_tooltip.vue +44 -0
- package/src/docs/pages/settings/styles.vue +51 -0
- package/src/docs/router.ts +41 -13
- package/src/slim-select/helper.ts +25 -86
- package/src/slim-select/index.ts +317 -420
- package/src/slim-select/render.test.ts +39 -0
- package/src/slim-select/render.ts +1129 -0
- package/src/slim-select/rollup.config.mjs +40 -0
- package/src/slim-select/select.test.ts +155 -0
- package/src/slim-select/select.ts +280 -108
- package/src/slim-select/settings.ts +68 -0
- package/src/slim-select/slimselect.scss +263 -278
- package/src/slim-select/store.test.ts +220 -0
- package/src/slim-select/store.ts +320 -0
- package/src/slim-select/tsconfig.json +11 -5
- package/src/vue/slimselect.vue +61 -0
- package/tsconfig.json +10 -29
- package/vite.config.ts +18 -0
- package/.browserslistrc +0 -4
- package/.postcssrc.js +0 -5
- package/.travis.yml +0 -22
- package/babel.config.js +0 -5
- package/dist/config.d.ts +0 -83
- package/dist/data.d.ts +0 -50
- package/dist/slim.d.ts +0 -50
- package/dist/slimselect.min.css +0 -1
- package/dist/slimselect.min.js +0 -1
- package/dist/slimselect.min.mjs +0 -1
- package/docs/css/app.d5840d21.css +0 -1
- package/docs/css/chunk-vendors.fa8199af.css +0 -1
- package/docs/css/home.57020178.css +0 -1
- package/docs/css/install.baa5d3fb.css +0 -1
- package/docs/css/methods.728c742a.css +0 -1
- package/docs/css/options.b28a32ef.css +0 -1
- package/docs/css/selects.1a7e1e6a.css +0 -1
- package/docs/js/app.238ee382.js +0 -2
- package/docs/js/app.238ee382.js.map +0 -1
- package/docs/js/chunk-vendors.5125e3d8.js +0 -21
- package/docs/js/chunk-vendors.5125e3d8.js.map +0 -1
- package/docs/js/home.e7b28581.js +0 -2
- package/docs/js/home.e7b28581.js.map +0 -1
- package/docs/js/install.d4300783.js +0 -2
- package/docs/js/install.d4300783.js.map +0 -1
- package/docs/js/methods.fa1608f1.js +0 -11
- package/docs/js/methods.fa1608f1.js.map +0 -1
- package/docs/js/options.2c4ceb87.js +0 -2
- package/docs/js/options.2c4ceb87.js.map +0 -1
- package/docs/js/selects.1eeba693.js +0 -2
- package/docs/js/selects.1eeba693.js.map +0 -1
- package/src/docs/pages/methods.vue +0 -427
- package/src/docs/pages/options.vue +0 -1480
- package/src/main.ts +0 -29
- package/src/shims-vue.d.ts +0 -8
- package/src/slim-select/config.ts +0 -118
- package/src/slim-select/data.ts +0 -377
- package/src/slim-select/slim.ts +0 -775
- package/src/slim-select/webpack.config.js +0 -73
- package/tslint.json +0 -26
- package/vue.config.js +0 -23
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'Html',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.selectHtmlSingle as HTMLSelectElement,
|
|
11
|
+
settings: {
|
|
12
|
+
searchHighlight: true,
|
|
13
|
+
},
|
|
14
|
+
data: [
|
|
15
|
+
{
|
|
16
|
+
html: '<b>Bold Text</b>',
|
|
17
|
+
text: 'Bold Text',
|
|
18
|
+
value: 'bold text',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
html: '<i>Slim Select you are awesome</i>',
|
|
22
|
+
text: 'Slim Select awesome',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
html: '<div style="border: solid 1px #666666;">Border</div>',
|
|
26
|
+
text: 'Border',
|
|
27
|
+
value: 'border',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
new SlimSelect({
|
|
33
|
+
select: this.$refs.selectHtmlMulti as HTMLSelectElement,
|
|
34
|
+
settings: {
|
|
35
|
+
searchHighlight: true,
|
|
36
|
+
},
|
|
37
|
+
data: [
|
|
38
|
+
{
|
|
39
|
+
html: '<b>Bold Text</b>',
|
|
40
|
+
text: 'Bold Text',
|
|
41
|
+
value: 'bold text',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
html: '<i>Slim Select you are awesome</i>',
|
|
45
|
+
text: 'Slim Select awesome',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
html: '<div style="border: solid 1px #666666;">Border</div>',
|
|
49
|
+
text: 'Border',
|
|
50
|
+
value: 'border',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<div id="html" class="content">
|
|
60
|
+
<h2 class="header">html</h2>
|
|
61
|
+
<p>
|
|
62
|
+
Slim select has the ability to set custom html for the selected values and options dropdown. By default if the
|
|
63
|
+
html field is set it will use that for the selected values and the options dropdown. For a multiple select
|
|
64
|
+
selected values it will always use the text field.
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
<div class="row">
|
|
68
|
+
<select ref="selectHtmlSingle"></select>
|
|
69
|
+
<select ref="selectHtmlMulti" multiple></select>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<pre>
|
|
73
|
+
<code class="language-javascript">
|
|
74
|
+
var select = new SlimSelect({
|
|
75
|
+
select: '#selectElement',
|
|
76
|
+
data: [
|
|
77
|
+
{html: '<img height="30" width="30" src="http://lorempixel.com/30/30" /> Image', text: 'Image', value: 'image'},
|
|
78
|
+
{html: '<b>Bold Text</b>', text: 'Bold Text', value: 'bold text'},
|
|
79
|
+
{html: '<div style="border: solid 1px #666666;">Border</div>', text: 'Border', value: 'border'},
|
|
80
|
+
{html: '<i>Slim Select you are awesome</i>', text: 'Slim Select awesome'}
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
</code>
|
|
84
|
+
</pre>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
// Components
|
|
5
|
+
import AlwaysOpen from './always_open.vue'
|
|
6
|
+
import CloseOnSelect from './close_on_select.vue'
|
|
7
|
+
import ContentLocation from './content_location.vue'
|
|
8
|
+
import ContentPosition from './content_position.vue'
|
|
9
|
+
import Css from './css.vue'
|
|
10
|
+
import DataAttributes from './data_attributes.vue'
|
|
11
|
+
import Deselect from './deselect.vue'
|
|
12
|
+
import Display from './display.vue'
|
|
13
|
+
import HideSelected from './hide_selected.vue'
|
|
14
|
+
import Html from './html.vue'
|
|
15
|
+
import Mandatory from './mandatory.vue'
|
|
16
|
+
import MinMax from './min_max.vue'
|
|
17
|
+
import OpenPosition from './open_position.vue'
|
|
18
|
+
import Placeholder from './placeholder.vue'
|
|
19
|
+
import Search from './search.vue'
|
|
20
|
+
import Select from './select.vue'
|
|
21
|
+
import SelectByGroup from './select_by_group.vue'
|
|
22
|
+
import ShowTooltip from './show_tooltip.vue'
|
|
23
|
+
import Styles from './styles.vue'
|
|
24
|
+
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
name: 'Settings',
|
|
27
|
+
components: {
|
|
28
|
+
Select,
|
|
29
|
+
AlwaysOpen,
|
|
30
|
+
ContentLocation,
|
|
31
|
+
ContentPosition,
|
|
32
|
+
OpenPosition,
|
|
33
|
+
Placeholder,
|
|
34
|
+
Deselect,
|
|
35
|
+
Display,
|
|
36
|
+
Mandatory,
|
|
37
|
+
MinMax,
|
|
38
|
+
DataAttributes,
|
|
39
|
+
Css,
|
|
40
|
+
Styles,
|
|
41
|
+
Html,
|
|
42
|
+
Search,
|
|
43
|
+
CloseOnSelect,
|
|
44
|
+
ShowTooltip,
|
|
45
|
+
SelectByGroup,
|
|
46
|
+
HideSelected,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<div id="settings" class="contents">
|
|
53
|
+
<Select />
|
|
54
|
+
<AlwaysOpen />
|
|
55
|
+
<ContentLocation />
|
|
56
|
+
<ContentPosition />
|
|
57
|
+
<OpenPosition />
|
|
58
|
+
<Placeholder />
|
|
59
|
+
<Deselect />
|
|
60
|
+
<Display />
|
|
61
|
+
<Mandatory />
|
|
62
|
+
<MinMax />
|
|
63
|
+
<DataAttributes />
|
|
64
|
+
<Css />
|
|
65
|
+
<Styles />
|
|
66
|
+
<Html />
|
|
67
|
+
<Search />
|
|
68
|
+
<CloseOnSelect />
|
|
69
|
+
<ShowTooltip />
|
|
70
|
+
<SelectByGroup />
|
|
71
|
+
<HideSelected />
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'Mandatory',
|
|
8
|
+
mounted() {
|
|
9
|
+
const mandatorySelect = new SlimSelect({
|
|
10
|
+
select: this.$refs.selectMultiMandatory as HTMLSelectElement,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const mandatoryData = [
|
|
14
|
+
{ value: 'value1', text: 'Value 1', mandatory: true },
|
|
15
|
+
{ value: 'value2', text: 'Value 2' },
|
|
16
|
+
{ value: 'value3', text: 'Value 3' },
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
mandatorySelect.setData(mandatoryData)
|
|
20
|
+
mandatorySelect.setSelected(['value1', 'value3'])
|
|
21
|
+
|
|
22
|
+
new SlimSelect({
|
|
23
|
+
select: this.$refs.selectMultiMandatory2 as HTMLSelectElement,
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div id="mandatory" class="content">
|
|
31
|
+
<h2 class="header">mandatory</h2>
|
|
32
|
+
<p>
|
|
33
|
+
When using multi select you can set a mandatory on the option to prevent capability to deselect particular option.
|
|
34
|
+
Note options with mandatory flag is not selected by default, you need select them yourselfs.
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<div class="row">
|
|
38
|
+
<select ref="selectMultiMandatory" multiple></select>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<pre>
|
|
42
|
+
<code class="language-javascript">
|
|
43
|
+
const slim = new SlimSelect({
|
|
44
|
+
select: '#selectElement'
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const data = [
|
|
48
|
+
{ value: 'value1', text: 'Value 1', mandatory: true },
|
|
49
|
+
{ value: 'value2', text: 'Value 2' },
|
|
50
|
+
{ value: 'value3', text: 'Value 3' },
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
slim.setData(data)
|
|
54
|
+
slim.set(["value1", "value3"])
|
|
55
|
+
</code>
|
|
56
|
+
</pre>
|
|
57
|
+
|
|
58
|
+
<pre>
|
|
59
|
+
<code class="language-html">
|
|
60
|
+
<select id="selectMultiMandatory" multiple></select>
|
|
61
|
+
</code>
|
|
62
|
+
</pre>
|
|
63
|
+
|
|
64
|
+
<p>Or</p>
|
|
65
|
+
<div class="row">
|
|
66
|
+
<select ref="selectMultiMandatory2" multiple>
|
|
67
|
+
<option value="value1" data-mandatory="true" selected>Value 1</option>
|
|
68
|
+
<option value="value2" selected>Value 2</option>
|
|
69
|
+
<option value="value3">Value 3</option>
|
|
70
|
+
</select>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<pre>
|
|
74
|
+
<code class="language-javascript">
|
|
75
|
+
const slim = new SlimSelect({
|
|
76
|
+
select: '#selectElement'
|
|
77
|
+
});
|
|
78
|
+
</code>
|
|
79
|
+
</pre>
|
|
80
|
+
|
|
81
|
+
<pre>
|
|
82
|
+
<code class="language-html">
|
|
83
|
+
<select id="selectMultiMandatory" multiple>
|
|
84
|
+
<option value="value1" data-mandatory="true" selected>Value 1</option>
|
|
85
|
+
<option value="value2" selected>Value 2</option>
|
|
86
|
+
<option value="value3">Value 3</option>
|
|
87
|
+
</select>
|
|
88
|
+
</code>
|
|
89
|
+
</pre>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'MinMax',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.selectMultiMax as HTMLSelectElement,
|
|
11
|
+
settings: {
|
|
12
|
+
minSelected: 2,
|
|
13
|
+
maxSelected: 5,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div id="minmax" class="content">
|
|
22
|
+
<h2 class="header">Min/Max Selected</h2>
|
|
23
|
+
<p>When using multi select you can set a min and/or max on the amount of selections you can have.</p>
|
|
24
|
+
|
|
25
|
+
<div class="row">
|
|
26
|
+
<select ref="selectMultiMax" multiple>
|
|
27
|
+
<option value="value1">Value 1</option>
|
|
28
|
+
<option value="value2">Value 2</option>
|
|
29
|
+
<option value="value3">Value 3</option>
|
|
30
|
+
<option value="value4">Value 4</option>
|
|
31
|
+
<option value="value5">Value 5</option>
|
|
32
|
+
<option value="value6">Value 6</option>
|
|
33
|
+
</select>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<pre>
|
|
37
|
+
<code class="language-javascript">
|
|
38
|
+
let slim = new SlimSelect({
|
|
39
|
+
select: '#selectElement',
|
|
40
|
+
settings: {
|
|
41
|
+
minSelected: 2,
|
|
42
|
+
maxSelected: 5,
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
</code>
|
|
46
|
+
</pre>
|
|
47
|
+
|
|
48
|
+
<pre>
|
|
49
|
+
<code class="language-html">
|
|
50
|
+
<select id="selectMultiMax" multiple>
|
|
51
|
+
<option value="value1">Value 1</option>
|
|
52
|
+
<option value="value2">Value 2</option>
|
|
53
|
+
<option value="value3">Value 3</option>
|
|
54
|
+
<option value="value4">Value 4</option>
|
|
55
|
+
<option value="value5">Value 5</option>
|
|
56
|
+
<option value="value6">Value 6</option>
|
|
57
|
+
</select>
|
|
58
|
+
</code>
|
|
59
|
+
</pre>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'OpenPosition',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.openPositionUp as HTMLSelectElement,
|
|
11
|
+
settings: {
|
|
12
|
+
openPosition: 'up',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
new SlimSelect({
|
|
17
|
+
select: this.$refs.openPositionDown as HTMLSelectElement,
|
|
18
|
+
settings: {
|
|
19
|
+
openPosition: 'down',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div id="openPosition" class="content">
|
|
28
|
+
<h2 class="header">openPosition</h2>
|
|
29
|
+
<p>
|
|
30
|
+
openPosition is a string value that will decide where to show your content when it comes out. By default slim
|
|
31
|
+
select will try to put the content where it can without going off screen. But you may want to always show it in
|
|
32
|
+
one direction.
|
|
33
|
+
</p>
|
|
34
|
+
<p>Possible Options: <b>'auto', 'up' or 'down'</b>. Default is <b>'auto'</b></p>
|
|
35
|
+
|
|
36
|
+
<div class="row">
|
|
37
|
+
<select ref="openPositionUp">
|
|
38
|
+
<option value="up1">Up 1</option>
|
|
39
|
+
<option value="up2">Up 2</option>
|
|
40
|
+
<option value="up3">Up 3</option>
|
|
41
|
+
</select>
|
|
42
|
+
<select ref="openPositionDown">
|
|
43
|
+
<option value="down1">Down 1</option>
|
|
44
|
+
<option value="down2">Down 2</option>
|
|
45
|
+
<option value="down3">Down 3</option>
|
|
46
|
+
</select>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<pre>
|
|
50
|
+
<code class="language-javascript">
|
|
51
|
+
new SlimSelect({
|
|
52
|
+
select: '#selectElement',
|
|
53
|
+
settings: {
|
|
54
|
+
openPosition: 'auto' // 'auto', 'up' or 'down'
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
</code>
|
|
58
|
+
</pre>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'Placeholder',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.placeholderSingle as HTMLSelectElement,
|
|
11
|
+
settings: {
|
|
12
|
+
placeholderText: 'Custom Placeholder Text',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
new SlimSelect({
|
|
17
|
+
select: this.$refs.placeholderMultiple as HTMLSelectElement,
|
|
18
|
+
settings: {
|
|
19
|
+
placeholderText: 'Custom Placeholder Text',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<div id="placeholder" class="content">
|
|
28
|
+
<h2 class="header">placeholderText</h2>
|
|
29
|
+
<p>
|
|
30
|
+
Placeholders consists of setting the placeholder option value. The only difference is single selects require an
|
|
31
|
+
empty option with data-placeholder set to true. Default value is "Select Value".
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<div class="row">
|
|
35
|
+
<select ref="placeholderSingle">
|
|
36
|
+
<option data-placeholder="true"></option>
|
|
37
|
+
<option value="value1">Value 1</option>
|
|
38
|
+
<option value="value2">Value 2</option>
|
|
39
|
+
<option value="value3">Value 3</option>
|
|
40
|
+
</select>
|
|
41
|
+
<select ref="placeholderMultiple" multiple>
|
|
42
|
+
<option value="value1">Value 1</option>
|
|
43
|
+
<option value="value2">Value 2</option>
|
|
44
|
+
<option value="value3">Value 3</option>
|
|
45
|
+
</select>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<pre>
|
|
49
|
+
<code class="language-javascript">
|
|
50
|
+
new SlimSelect({
|
|
51
|
+
select: '#placeholder',
|
|
52
|
+
settings: {
|
|
53
|
+
placeholderText: 'Custom Placeholder Text',
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
</code>
|
|
57
|
+
</pre>
|
|
58
|
+
|
|
59
|
+
<pre>
|
|
60
|
+
<code class="language-html">
|
|
61
|
+
<!-- Set empty option with data-placeholder if you to have placeholder -->
|
|
62
|
+
<!-- text for single select, otherwise first option will be selected -->
|
|
63
|
+
<select id="placeholderSingle">
|
|
64
|
+
<option data-placeholder="true"></option>
|
|
65
|
+
<option value="value1">Value 1</option>
|
|
66
|
+
<option value="value2">Value 2</option>
|
|
67
|
+
<option value="value3">Value 3</option>
|
|
68
|
+
</select>
|
|
69
|
+
</code>
|
|
70
|
+
</pre>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'Search',
|
|
8
|
+
mounted() {
|
|
9
|
+
// Single
|
|
10
|
+
new SlimSelect({
|
|
11
|
+
select: this.$refs.showSearchSingle as HTMLSelectElement,
|
|
12
|
+
settings: {
|
|
13
|
+
showSearch: false,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
new SlimSelect({
|
|
17
|
+
select: this.$refs.searchTextSingle as HTMLSelectElement,
|
|
18
|
+
settings: {
|
|
19
|
+
searchText: 'Sorry, nothing to see here',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
new SlimSelect({
|
|
23
|
+
select: this.$refs.searchPlaceholderSingle as HTMLSelectElement,
|
|
24
|
+
settings: {
|
|
25
|
+
searchPlaceholder: 'Search for the good stuff!',
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
new SlimSelect({
|
|
29
|
+
select: this.$refs.searchHighlightSingle as HTMLSelectElement,
|
|
30
|
+
settings: {
|
|
31
|
+
searchHighlight: true,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Multiple
|
|
36
|
+
new SlimSelect({
|
|
37
|
+
select: this.$refs.showSearchMulti as HTMLSelectElement,
|
|
38
|
+
settings: {
|
|
39
|
+
showSearch: false,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
new SlimSelect({
|
|
43
|
+
select: this.$refs.searchTextMulti as HTMLSelectElement,
|
|
44
|
+
settings: {
|
|
45
|
+
searchText: 'Sorry nothing to see here',
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
new SlimSelect({
|
|
49
|
+
select: this.$refs.searchPlaceholderMulti as HTMLSelectElement,
|
|
50
|
+
settings: {
|
|
51
|
+
searchPlaceholder: 'Search for the good stuff!',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
new SlimSelect({
|
|
55
|
+
select: this.$refs.searchHighlightMulti as HTMLSelectElement,
|
|
56
|
+
settings: {
|
|
57
|
+
searchHighlight: true,
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div id="search" class="content">
|
|
66
|
+
<h2 class="header">showSearch / searchText / searchingText / searchHighlight</h2>
|
|
67
|
+
<p><b>showSearch</b> - is a boolean value that will decide whether or not to show the search. Default is true.</p>
|
|
68
|
+
<p>
|
|
69
|
+
<b>searchText</b> - is a string value that will show in the event there are no results. Default is 'No Results'.
|
|
70
|
+
</p>
|
|
71
|
+
<p>
|
|
72
|
+
<b>searchingText</b> - is a string value that will show during an fetch search request. Default is 'Searching...'.
|
|
73
|
+
</p>
|
|
74
|
+
<p>
|
|
75
|
+
<b>searchPlaceholder</b> - is a string value that will set the value of the input search placeholder text. Default
|
|
76
|
+
is 'Search'.
|
|
77
|
+
</p>
|
|
78
|
+
<p><b>searchHighlight</b> - is a boolean value that will highlight search results. Default is false.</p>
|
|
79
|
+
|
|
80
|
+
<div class="row" style="padding: 0 0 var(--spacing-half) 0">
|
|
81
|
+
<select ref="showSearchSingle">
|
|
82
|
+
<option value="dog">Dog</option>
|
|
83
|
+
<option value="cat">Cat</option>
|
|
84
|
+
<option value="bird">Bird</option>
|
|
85
|
+
</select>
|
|
86
|
+
<select ref="searchTextSingle">
|
|
87
|
+
<option value="dog">Dog</option>
|
|
88
|
+
<option value="cat">Cat</option>
|
|
89
|
+
<option value="bird">Bird</option>
|
|
90
|
+
</select>
|
|
91
|
+
<select ref="searchPlaceholderSingle">
|
|
92
|
+
<option value="dog">Dog</option>
|
|
93
|
+
<option value="cat">Cat</option>
|
|
94
|
+
<option value="bird">Bird</option>
|
|
95
|
+
</select>
|
|
96
|
+
<select ref="searchHighlightSingle">
|
|
97
|
+
<option value="dog">Dog</option>
|
|
98
|
+
<option value="cat">Cat</option>
|
|
99
|
+
<option value="bird">Bird</option>
|
|
100
|
+
</select>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="row">
|
|
104
|
+
<select ref="showSearchMulti" multiple>
|
|
105
|
+
<option value="dog">Dog</option>
|
|
106
|
+
<option value="cat">Cat</option>
|
|
107
|
+
<option value="bird">Bird</option>
|
|
108
|
+
</select>
|
|
109
|
+
<select ref="searchTextMulti" multiple>
|
|
110
|
+
<option value="dog">Dog</option>
|
|
111
|
+
<option value="cat">Cat</option>
|
|
112
|
+
<option value="bird">Bird</option>
|
|
113
|
+
</select>
|
|
114
|
+
<select ref="searchPlaceholderMulti" multiple>
|
|
115
|
+
<option value="dog">Dog</option>
|
|
116
|
+
<option value="cat">Cat</option>
|
|
117
|
+
<option value="bird">Bird</option>
|
|
118
|
+
</select>
|
|
119
|
+
<select ref="searchHighlightMulti" multiple>
|
|
120
|
+
<option value="dog">Dog</option>
|
|
121
|
+
<option value="cat">Cat</option>
|
|
122
|
+
<option value="bird">Bird</option>
|
|
123
|
+
</select>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<pre>
|
|
127
|
+
<code class="language-javascript">
|
|
128
|
+
let slim = new SlimSelect({
|
|
129
|
+
select: '#selectElement',
|
|
130
|
+
settings: {
|
|
131
|
+
showSearch: false,
|
|
132
|
+
searchText: 'Sorry nothing to see here',
|
|
133
|
+
searchPlaceholder: 'Search for the good stuff!',
|
|
134
|
+
searchHighlight: true
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
</code>
|
|
138
|
+
</pre>
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: 'Select',
|
|
6
|
+
})
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div id="select" class="content">
|
|
11
|
+
<h2 class="header">select</h2>
|
|
12
|
+
<p>
|
|
13
|
+
The select field is used to identify the select element that will be used to create slim select. You can use any
|
|
14
|
+
value you normally would in a querySelector or pass the element directly.
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<pre>
|
|
18
|
+
<code class="language-javascript">
|
|
19
|
+
new SlimSelect({
|
|
20
|
+
select: '#selectElement',
|
|
21
|
+
// or
|
|
22
|
+
select: document.querySelector('#selectElement')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// If you already have a currenlty running SlimSelect but lost the reference to it.
|
|
26
|
+
// You can access from the original select element.
|
|
27
|
+
let el = document.querySelector('#selectElement')
|
|
28
|
+
el.slim.open() // Or any other options/methods
|
|
29
|
+
</code>
|
|
30
|
+
</pre>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import SlimSelect from '../../../slim-select'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'SelectByGroup',
|
|
8
|
+
mounted() {
|
|
9
|
+
new SlimSelect({
|
|
10
|
+
select: this.$refs.selectByGroup as HTMLSelectElement,
|
|
11
|
+
settings: {
|
|
12
|
+
selectByGroup: true,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div id="selectByGroup" class="content">
|
|
21
|
+
<h2 class="header">selectByGroup</h2>
|
|
22
|
+
<p>
|
|
23
|
+
selectByGroup option is used to enable the selection of all options under a specific group by clicking that option
|
|
24
|
+
group's label.
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<select ref="selectByGroup" multiple>
|
|
28
|
+
<optgroup label="Label 1">
|
|
29
|
+
<option value="value1">Value 1</option>
|
|
30
|
+
<option value="value2">Value 2</option>
|
|
31
|
+
<option value="value3">Value 3</option>
|
|
32
|
+
</optgroup>
|
|
33
|
+
</select>
|
|
34
|
+
|
|
35
|
+
<pre>
|
|
36
|
+
<code class="language-javascript">
|
|
37
|
+
new SlimSelect({
|
|
38
|
+
select: '#selectByGroup',
|
|
39
|
+
settings: {
|
|
40
|
+
selectByGroup: true
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
</code>
|
|
44
|
+
</pre>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|