slim-select 2.2.0 → 2.2.2

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.
Files changed (118) hide show
  1. package/dist/helpers.d.ts +1 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/select.d.ts +1 -1
  4. package/dist/slimselect.cjs.js +62 -40
  5. package/dist/slimselect.es.js +62 -40
  6. package/dist/slimselect.global.js +62 -40
  7. package/dist/slimselect.js +62 -40
  8. package/dist/slimselect.min.js +1 -1
  9. package/dist/slimselect.umd.js +62 -40
  10. package/dist/slimselect.umd.min.js +1 -1
  11. package/package.json +1 -3
  12. package/src/slim-select/helpers.ts +4 -0
  13. package/src/slim-select/index.ts +26 -2
  14. package/src/slim-select/render.ts +5 -3
  15. package/src/slim-select/select.ts +12 -3
  16. package/src/vue/dist/slim-select/helpers.d.ts +5 -0
  17. package/src/vue/dist/slim-select/index.d.ts +45 -0
  18. package/src/vue/dist/slim-select/render.d.ts +116 -0
  19. package/src/vue/dist/slim-select/select.d.ts +33 -0
  20. package/src/vue/dist/slim-select/settings.d.ts +30 -0
  21. package/src/vue/dist/slim-select/store.d.ts +76 -0
  22. package/src/vue/dist/slimselectvue.es.js +114 -43
  23. package/src/vue/dist/slimselectvue.global.js +114 -43
  24. package/src/vue/dist/slimselectvue.ssr.js +114 -43
  25. package/src/vue/dist/vue/hello.d.ts +2 -0
  26. package/src/vue/dist/vue/slimselect.vue.d.ts +309 -0
  27. package/src/vue/package.json +2 -3
  28. package/src/vue/slimselect.vue +66 -2
  29. package/src/vue/tsconfig.json +3 -3
  30. package/tsconfig.json +9 -2
  31. package/.github/FUNDING.yml +0 -12
  32. package/.github/ISSUE_TEMPLATE/issue-report.md +0 -14
  33. package/.vscode/extensions.json +0 -3
  34. package/.vscode/settings.json +0 -17
  35. package/docs/404.html +0 -42
  36. package/docs/CNAME +0 -1
  37. package/docs/assets/check-mark.svg +0 -6
  38. package/docs/assets/data.js +0 -63
  39. package/docs/assets/home.css +0 -1
  40. package/docs/assets/home.js +0 -1
  41. package/docs/assets/index.css +0 -1
  42. package/docs/assets/index.js +0 -16
  43. package/docs/assets/index2.js +0 -358
  44. package/docs/assets/index3.js +0 -142
  45. package/docs/assets/index4.js +0 -60
  46. package/docs/assets/index5.js +0 -149
  47. package/docs/assets/install.js +0 -34
  48. package/docs/assets/selects.js +0 -55
  49. package/docs/favicon.ico +0 -0
  50. package/docs/index.html +0 -36
  51. package/public/404.html +0 -42
  52. package/public/CNAME +0 -1
  53. package/public/favicon.ico +0 -0
  54. package/slimselect.gif +0 -0
  55. package/src/docs/app.vue +0 -228
  56. package/src/docs/assets/images/check-mark.svg +0 -6
  57. package/src/docs/assets/images/chrome.svg +0 -22
  58. package/src/docs/assets/images/firefox.svg +0 -58
  59. package/src/docs/assets/images/github.png +0 -0
  60. package/src/docs/assets/images/ie.svg +0 -11
  61. package/src/docs/assets/images/npm.png +0 -0
  62. package/src/docs/assets/images/opera.svg +0 -15
  63. package/src/docs/assets/images/safari.svg +0 -22
  64. package/src/docs/assets/scss/_variables.scss +0 -26
  65. package/src/docs/assets/scss/alert.scss +0 -12
  66. package/src/docs/assets/scss/animations.scss +0 -8
  67. package/src/docs/assets/scss/button.scss +0 -21
  68. package/src/docs/assets/scss/index.scss +0 -8
  69. package/src/docs/assets/scss/input.scss +0 -3
  70. package/src/docs/assets/scss/layout.scss +0 -250
  71. package/src/docs/assets/scss/misc.scss +0 -162
  72. package/src/docs/assets/scss/prism.scss +0 -157
  73. package/src/docs/env.d.ts +0 -13
  74. package/src/docs/main.ts +0 -27
  75. package/src/docs/pages/data.vue +0 -134
  76. package/src/docs/pages/events/addable.vue +0 -95
  77. package/src/docs/pages/events/before_after_change.vue +0 -154
  78. package/src/docs/pages/events/before_after_open_close.vue +0 -122
  79. package/src/docs/pages/events/error.vue +0 -59
  80. package/src/docs/pages/events/index.vue +0 -33
  81. package/src/docs/pages/events/search.vue +0 -169
  82. package/src/docs/pages/events/search_filter.vue +0 -45
  83. package/src/docs/pages/frameworks/index.vue +0 -18
  84. package/src/docs/pages/frameworks/vue.vue +0 -407
  85. package/src/docs/pages/home.vue +0 -241
  86. package/src/docs/pages/install.vue +0 -105
  87. package/src/docs/pages/methods/destroy.vue +0 -66
  88. package/src/docs/pages/methods/enable_disable.vue +0 -70
  89. package/src/docs/pages/methods/get_data.vue +0 -82
  90. package/src/docs/pages/methods/get_selected.vue +0 -78
  91. package/src/docs/pages/methods/index.vue +0 -36
  92. package/src/docs/pages/methods/open_close.vue +0 -63
  93. package/src/docs/pages/methods/search.vue +0 -62
  94. package/src/docs/pages/methods/set_data.vue +0 -106
  95. package/src/docs/pages/methods/set_selected.vue +0 -70
  96. package/src/docs/pages/selects.vue +0 -213
  97. package/src/docs/pages/settings/always_open.vue +0 -88
  98. package/src/docs/pages/settings/closable.vue +0 -128
  99. package/src/docs/pages/settings/close_on_select.vue +0 -69
  100. package/src/docs/pages/settings/content_location.vue +0 -64
  101. package/src/docs/pages/settings/content_position.vue +0 -86
  102. package/src/docs/pages/settings/css.vue +0 -73
  103. package/src/docs/pages/settings/data_attributes.vue +0 -39
  104. package/src/docs/pages/settings/deselect.vue +0 -69
  105. package/src/docs/pages/settings/display.vue +0 -88
  106. package/src/docs/pages/settings/hide_selected.vue +0 -73
  107. package/src/docs/pages/settings/html.vue +0 -86
  108. package/src/docs/pages/settings/index.vue +0 -76
  109. package/src/docs/pages/settings/mandatory.vue +0 -91
  110. package/src/docs/pages/settings/min_max.vue +0 -61
  111. package/src/docs/pages/settings/open_position.vue +0 -60
  112. package/src/docs/pages/settings/placeholder.vue +0 -72
  113. package/src/docs/pages/settings/search.vue +0 -140
  114. package/src/docs/pages/settings/select.vue +0 -32
  115. package/src/docs/pages/settings/select_all.vue +0 -88
  116. package/src/docs/pages/settings/show_tooltip.vue +0 -44
  117. package/src/docs/pages/settings/styles.vue +0 -51
  118. package/src/docs/router.ts +0 -50
@@ -1,63 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- import SlimSelect from '../../../slim-select'
5
-
6
- export default defineComponent({
7
- name: 'OpenClose',
8
- data() {
9
- return {
10
- openCloseSingle: null as SlimSelect | null,
11
- openCloseMultiple: null as SlimSelect | null,
12
- }
13
- },
14
- mounted() {
15
- // Open / Close
16
- this.openCloseSingle = new SlimSelect({
17
- select: this.$refs.openCloseSingle as HTMLSelectElement,
18
- })
19
- this.openCloseMultiple = new SlimSelect({
20
- select: this.$refs.openCloseMultiple as HTMLSelectElement,
21
- })
22
- },
23
- methods: {
24
- setOpenClose() {
25
- if (!this.openCloseSingle!.settings.isOpen) {
26
- this.openCloseSingle!.open()
27
- this.openCloseMultiple!.open()
28
- }
29
- },
30
- },
31
- })
32
- </script>
33
-
34
- <template>
35
- <div class="content">
36
- <h2 class="header">open / close</h2>
37
- <p>The open and close methods will do just that.</p>
38
-
39
- <div class="row">
40
- <div class="btn" @click="setOpenClose">Open/Close</div>
41
- <select ref="openCloseSingle">
42
- <option value="value1">Value 1</option>
43
- <option value="value2">Value 2</option>
44
- <option value="value3">Value 3</option>
45
- </select>
46
- <select ref="openCloseMultiple" multiple>
47
- <option value="value1">Value 1</option>
48
- <option value="value2">Value 2</option>
49
- <option value="value3">Value 3</option>
50
- </select>
51
- </div>
52
- <pre>
53
- <code class="language-javascript">
54
- var select = new SlimSelect({
55
- select: '#selectElement',
56
- })
57
- select.open()
58
- // or
59
- select.close()
60
- </code>
61
- </pre>
62
- </div>
63
- </template>
@@ -1,62 +0,0 @@
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
- data() {
9
- return {
10
- searchSingle: null as SlimSelect | null,
11
- searchMultiple: null as SlimSelect | null,
12
- }
13
- },
14
- mounted() {
15
- this.searchSingle = new SlimSelect({
16
- select: this.$refs.searchSingle as HTMLSelectElement,
17
- })
18
- this.searchMultiple = new SlimSelect({
19
- select: this.$refs.searchMultiple as HTMLSelectElement,
20
- })
21
- },
22
- methods: {
23
- setSearch() {
24
- this.searchSingle!.open()
25
- this.searchSingle!.search('value 2')
26
-
27
- this.searchMultiple!.open()
28
- this.searchMultiple!.search('value 2')
29
- },
30
- },
31
- })
32
- </script>
33
-
34
- <template>
35
- <div id="search" class="content">
36
- <h2 class="header">search</h2>
37
- <p>The search method will update the search input field and search the data against that value.</p>
38
-
39
- <div class="row">
40
- <div class="btn" @click="setSearch">Set Search</div>
41
- <select ref="searchSingle">
42
- <option value="value1">Value 1</option>
43
- <option value="value2">Value 2</option>
44
- <option value="value3">Value 3</option>
45
- </select>
46
- <select ref="searchMultiple" multiple>
47
- <option value="value1">Value 1</option>
48
- <option value="value2">Value 2</option>
49
- <option value="value3">Value 3</option>
50
- </select>
51
- </div>
52
-
53
- <pre>
54
- <code class="language-javascript">
55
- var select = new SlimSelect({
56
- select: '#selectElement'
57
- })
58
- select.search('value')
59
- </code>
60
- </pre>
61
- </div>
62
- </template>
@@ -1,106 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- import SlimSelect from '../../../slim-select'
5
-
6
- export default defineComponent({
7
- name: 'SetData',
8
- data() {
9
- return {
10
- setDataSingle: null as SlimSelect | null,
11
- setDataMultiple: null as SlimSelect | null,
12
- }
13
- },
14
- mounted() {
15
- // Set Data
16
- this.setDataSingle = new SlimSelect({
17
- select: this.$refs.setDataSingle as HTMLSelectElement,
18
- events: {
19
- error: (err: Error) => {
20
- console.error(err)
21
- },
22
- },
23
- })
24
- this.setDataMultiple = new SlimSelect({
25
- select: this.$refs.setDataMultiple as HTMLSelectElement,
26
- events: {
27
- error: (err: Error) => {
28
- console.error(err)
29
- },
30
- },
31
- })
32
- },
33
- methods: {
34
- setData() {
35
- // Fetch random json array data from gofakeit
36
- fetch('https://api.gofakeit.com/json', {
37
- method: 'POST',
38
- headers: {
39
- 'Content-Type': 'application/json',
40
- },
41
- body: JSON.stringify({
42
- type: 'array',
43
- rowcount: 10,
44
- indent: false,
45
- fields: [
46
- { name: 'text', function: 'generate', params: { str: '{firstname} {lastname}' } },
47
- { name: 'selected', function: 'bool' },
48
- ],
49
- }),
50
- })
51
- .then((res) => res.json())
52
- .then((data) => {
53
- this.setDataSingle!.setData(data)
54
- this.setDataMultiple!.setData(data)
55
- })
56
- .catch((err) => console.error(err))
57
- },
58
- },
59
- })
60
- </script>
61
-
62
- <template>
63
- <div id="setData" class="content">
64
- <h2 class="header">setData</h2>
65
- <p>
66
- The setData method can take in an array of objects. This will set the options of the original select and rerender
67
- slim select.
68
- </p>
69
- <div class="alert info">
70
- If you use a single select but an option is not selected it will select the first option.
71
- </div>
72
- <div class="alert info">
73
- If you use a single select but pass in data with multiple selected options, the first option will be selected.
74
- </div>
75
- <div class="alert info">
76
- To get a better break down of possible data options see <router-link to="/data#types">data</router-link>
77
- </div>
78
-
79
- <div class="row">
80
- <div class="btn" @click="setData">Set Data</div>
81
- <select ref="setDataSingle"></select>
82
- <select ref="setDataMultiple" multiple></select>
83
- </div>
84
-
85
- <pre>
86
- <code class="language-javascript">
87
- var select = new SlimSelect({
88
- select: '#selectElement'
89
- })
90
-
91
- // Array of objects
92
- select.setData([
93
- {text: 'Value 1', value: 'value1'},
94
- {text: 'Value 2', value: 'value2'},
95
- {
96
- label: 'Group 1',
97
- options: [
98
- {text: 'Value 3', value: 'value3'},
99
- {text: 'Value 4', value: 'value4'},
100
- ]
101
- }
102
- ])
103
- </code>
104
- </pre>
105
- </div>
106
- </template>
@@ -1,70 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- import SlimSelect from '../../../slim-select'
5
-
6
- export default defineComponent({
7
- name: 'SetSelected',
8
- data() {
9
- return {
10
- selectedSingle: null as SlimSelect | null,
11
- selectedMultiple: null as SlimSelect | null,
12
- }
13
- },
14
- mounted() {
15
- this.selectedSingle = new SlimSelect({
16
- select: this.$refs.selectedSingle as HTMLSelectElement,
17
- })
18
- this.selectedMultiple = new SlimSelect({
19
- select: this.$refs.selectedMultiple as HTMLSelectElement,
20
- })
21
- },
22
- methods: {
23
- setSelected() {
24
- this.selectedSingle!.open()
25
- this.selectedSingle!.setSelected('value2')
26
- this.selectedMultiple!.open()
27
- this.selectedMultiple!.setSelected(['value1', 'value3'])
28
-
29
- setTimeout(() => {
30
- this.selectedSingle!.close()
31
- this.selectedMultiple!.close()
32
- }, 1000)
33
- },
34
- },
35
- })
36
- </script>
37
-
38
- <template>
39
- <div id="setSelected" class="content">
40
- <h2 class="header">setSelected</h2>
41
- <p>The setSelected method will set the selected value(s) of the select.</p>
42
- <p>setSelected will accept both string or array of strings.</p>
43
-
44
- <div class="row">
45
- <div class="btn" @click="setSelected">Set Selected</div>
46
-
47
- <select ref="selectedSingle">
48
- <option value="value1">Value 1</option>
49
- <option value="value2">Value 2</option>
50
- <option value="value3">Value 3</option>
51
- </select>
52
-
53
- <select ref="selectedMultiple" multiple>
54
- <option value="value1">Value 1</option>
55
- <option value="value2">Value 2</option>
56
- <option value="value3">Value 3</option>
57
- </select>
58
- </div>
59
-
60
- <pre>
61
- <code class="language-javascript">
62
- var select = new SlimSelect({
63
- select: '#selectElement'
64
- })
65
- select.setSelected('value1' /* or */ ['value1', 'value3'])
66
- console.log(select.getSelected())
67
- </code>
68
- </pre>
69
- </div>
70
- </template>
@@ -1,213 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- import SlimSelect from '../../slim-select'
5
-
6
- export default defineComponent({
7
- name: 'Selects',
8
- data() {
9
- return {
10
- states: [
11
- { abv: 'AL', state: 'Alabama' },
12
- { abv: 'AK', state: 'Alaska' },
13
- { abv: 'AZ', state: 'Arizona' },
14
- { abv: 'AR', state: 'Arkansas' },
15
- { abv: 'CA', state: 'California' },
16
- { abv: 'CO', state: 'Colorado' },
17
- { abv: 'CT', state: 'Connecticut' },
18
- { abv: 'DE', state: 'Delaware' },
19
- { abv: 'FL', state: 'Florida' },
20
- { abv: 'GA', state: 'Georgia' },
21
- { abv: 'HI', state: 'Hawaii' },
22
- { abv: 'ID', state: 'Idaho' },
23
- { abv: 'IL', state: 'Illinois' },
24
- { abv: 'IN', state: 'Indiana' },
25
- { abv: 'IA', state: 'Iowa' },
26
- { abv: 'KS', state: 'Kansas' },
27
- { abv: 'KY', state: 'Kentucky' },
28
- { abv: 'LA', state: 'Louisiana' },
29
- { abv: 'ME', state: 'Maine' },
30
- { abv: 'MD', state: 'Maryland' },
31
- { abv: 'MA', state: 'Massachusetts' },
32
- { abv: 'MI', state: 'Michigan' },
33
- { abv: 'MN', state: 'Minnesota' },
34
- { abv: 'MS', state: 'Mississippi' },
35
- { abv: 'MO', state: 'Missouri' },
36
- { abv: 'MT', state: 'Montana' },
37
- { abv: 'NE', state: 'Nebraska' },
38
- { abv: 'NV', state: 'Nevada' },
39
- { abv: 'NH', state: 'New Hampshire' },
40
- { abv: 'NJ', state: 'New Jersey' },
41
- { abv: 'NM', state: 'New Mexico' },
42
- { abv: 'NY', state: 'New York' },
43
- { abv: 'NC', state: 'North Carolina' },
44
- { abv: 'ND', state: 'North Dakota' },
45
- { abv: 'OH', state: 'Ohio' },
46
- { abv: 'OK', state: 'Oklahoma' },
47
- { abv: 'OR', state: 'Oregon' },
48
- { abv: 'PA', state: 'Pennsylvania' },
49
- { abv: 'RI', state: 'Rhode Island' },
50
- { abv: 'SC', state: 'South Carolina' },
51
- { abv: 'SD', state: 'South Dakota' },
52
- { abv: 'TN', state: 'Tennessee', selected: true },
53
- { abv: 'TX', state: 'Texas' },
54
- { abv: 'UT', state: 'Utah' },
55
- { abv: 'VT', state: 'Vermont' },
56
- { abv: 'VA', state: 'Virginia' },
57
- { abv: 'WA', state: 'Washington' },
58
- { abv: 'WV', state: 'West Virginia' },
59
- { abv: 'WI', state: 'Wisconsin' },
60
- { abv: 'WY', state: 'Wyoming' },
61
- ],
62
- foods: [
63
- { label: 'Dairy', options: ['Milk', 'Cheese', 'Butter', 'Ice Cream'] },
64
- { label: 'Meat', options: ['Beef', 'Ham', 'Pork', 'Sausage', 'Chicken', 'Turkey'] },
65
- { label: 'Fruits', options: ['Apple', 'Banana', 'Grape', 'Orange', 'Strawberry', 'Blueberry', 'Raspberry'] },
66
- {
67
- label: 'Vegetables',
68
- options: ['Carrot', 'Tomato', 'Broccoli', 'Celery', 'Corn', 'Pumpkin', 'Kale', 'Spinach'],
69
- },
70
- ],
71
- }
72
- },
73
- mounted() {
74
- // Single
75
- new SlimSelect({
76
- select: this.$refs.single as HTMLSelectElement,
77
- })
78
- new SlimSelect({
79
- select: this.$refs.singleOptgroup as HTMLSelectElement,
80
- })
81
-
82
- // Multiple
83
- new SlimSelect({
84
- select: this.$refs.multiple as HTMLSelectElement,
85
- })
86
- const multiGroup = new SlimSelect({
87
- select: this.$refs.multipleOptgroup as HTMLSelectElement,
88
- })
89
- multiGroup.setSelected(['Cheese', 'Apple', 'Corn'])
90
- },
91
- })
92
- </script>
93
-
94
- <template>
95
- <div id="selects" class="contents">
96
- <div id="single" class="content">
97
- <h2 class="header">Single</h2>
98
- <p>
99
- Basic single select usage with Slim Select is extremely easy. Just set the select value to your select element.
100
- </p>
101
- <div class="row">
102
- <div>
103
- <h4>Options</h4>
104
- <select ref="single">
105
- <option v-for="value in states" :key="value.abv" :value="value.abv" :selected="value.selected">
106
- {{ value.state }}
107
- </option>
108
- </select>
109
- </div>
110
- <div>
111
- <h4>Optgroups</h4>
112
- <select ref="singleOptgroup">
113
- <optgroup v-for="food in foods" :key="food.label" :label="food.label">
114
- <option v-for="option in food.options" :key="option" :value="option">{{ option }}</option>
115
- </optgroup>
116
- </select>
117
- </div>
118
- </div>
119
-
120
- <pre>
121
- <code class="language-javascript">
122
- new SlimSelect({
123
- select: '#single'
124
- })
125
- </code>
126
- </pre>
127
-
128
- <pre>
129
- <code class="language-html">
130
- &lt;!-- Options --&gt;
131
- &lt;select id="single"&gt;
132
- &lt;option value="value 1"&gt;Value 1&lt;/option&gt;
133
- &lt;option value="value 2"&gt;Value 2&lt;/option&gt;
134
- &lt;option value="value 3"&gt;Value 3&lt;/option&gt;
135
- &lt;/select&gt;
136
-
137
- &lt;!-- Optgroups --&gt;
138
- &lt;select id="single-optgroups"&gt;
139
- &lt;optgroup label="Label 1"&gt;
140
- &lt;option value="value 1"&gt;Value 1&lt;/option&gt;
141
- &lt;option value="value 2"&gt;Value 2&lt;/option&gt;
142
- &lt;option value="value 3"&gt;Value 3&lt;/option&gt;
143
- &lt;/optgroup&gt;
144
- &lt;optgroup label="Label 2"&gt;
145
- &lt;option value="value 21"&gt;Value 1&lt;/option&gt;
146
- &lt;option value="value 22"&gt;Value 2&lt;/option&gt;
147
- &lt;option value="value 23"&gt;Value 3&lt;/option&gt;
148
- &lt;/optgroup&gt;
149
- &lt;/select&gt;
150
- </code>
151
- </pre>
152
- </div>
153
-
154
- <div id="multiple" class="content">
155
- <h2 class="header">Multiple</h2>
156
- <p>
157
- Multi selects work just the same as a single select. The only difference is setting the multiple attribute on
158
- your select.
159
- </p>
160
- <div class="row">
161
- <div>
162
- <h4>Options</h4>
163
- <select ref="multiple" multiple>
164
- <option v-for="value in states" :value="value.abv" :key="value.abv" :selected="value.selected">
165
- {{ value.state }}
166
- </option>
167
- </select>
168
- </div>
169
- <div>
170
- <h4>Optgroups</h4>
171
- <select ref="multipleOptgroup" multiple>
172
- <optgroup v-for="food in foods" :key="food.label" :label="food.label">
173
- <option v-for="option in food.options" :key="option" :value="option">{{ option }}</option>
174
- </optgroup>
175
- </select>
176
- </div>
177
- </div>
178
-
179
- <pre>
180
- <code class="language-javascript">
181
- new SlimSelect({
182
- select: '#multiple'
183
- })
184
- </code>
185
- </pre>
186
-
187
- <pre>
188
- <code class="language-html">
189
- &lt;!-- Options --&gt;
190
- &lt;select id="multiple" multiple&gt;
191
- &lt;option value="value 1"&gt;Value 1&lt;/option&gt;
192
- &lt;option value="value 2"&gt;Value 2&lt;/option&gt;
193
- &lt;option value="value 3"&gt;Value 3&lt;/option&gt;
194
- &lt;/select&gt;
195
-
196
- &lt;!-- Optgroups --&gt;
197
- &lt;select id="multiple-optgroups" multiple&gt;
198
- &lt;optgroup label="Label 1"&gt;
199
- &lt;option value="value 1"&gt;Value 1&lt;/option&gt;
200
- &lt;option value="value 2"&gt;Value 2&lt;/option&gt;
201
- &lt;option value="value 3"&gt;Value 3&lt;/option&gt;
202
- &lt;/optgroup&gt;
203
- &lt;optgroup label="Label 2"&gt;
204
- &lt;option value="value 21"&gt;Value 1&lt;/option&gt;
205
- &lt;option value="value 22"&gt;Value 2&lt;/option&gt;
206
- &lt;option value="value 23"&gt;Value 3&lt;/option&gt;
207
- &lt;/optgroup&gt;
208
- &lt;/select&gt;
209
- </code>
210
- </pre>
211
- </div>
212
- </div>
213
- </template>
@@ -1,88 +0,0 @@
1
- <script lang="ts">
2
- import { defineComponent } from 'vue'
3
-
4
- import SlimSelect from '../../../slim-select'
5
-
6
- export default defineComponent({
7
- name: 'AlwaysOpen',
8
- mounted() {
9
- new SlimSelect({
10
- select: this.$refs.alwaysOpenSingle as HTMLSelectElement,
11
- settings: {
12
- alwaysOpen: true,
13
- contentLocation: this.$refs.alwaysOpenSingleContent as HTMLElement,
14
- contentPosition: 'relative',
15
- },
16
- })
17
-
18
- new SlimSelect({
19
- select: this.$refs.alwaysOpenMultiple as HTMLSelectElement,
20
- settings: {
21
- alwaysOpen: true,
22
- contentLocation: this.$refs.alwaysOpenMultipleContent as HTMLElement,
23
- contentPosition: 'relative',
24
- },
25
- })
26
- },
27
- })
28
- </script>
29
-
30
- <template>
31
- <div id="alwaysOpen" class="content">
32
- <h2 class="header">alwaysOpen</h2>
33
- <p>
34
- alwaysOpen option is used to keep the select open at all times. This is useful for when you want to display the
35
- options at all times.
36
- </p>
37
-
38
- <div class="row">
39
- <div style="height: auto">
40
- <select ref="alwaysOpenSingle">
41
- <option value="value1">Value 1</option>
42
- <option value="value2">Value 2</option>
43
- <option value="value3">Value 3</option>
44
- </select>
45
- <div ref="alwaysOpenSingleContent"></div>
46
- </div>
47
-
48
- <div style="height: auto">
49
- <select ref="alwaysOpenMultiple" multiple>
50
- <option value="value1">Value 1</option>
51
- <option value="value2">Value 2</option>
52
- <option value="value3">Value 3</option>
53
- <option value="value4">Value 4</option>
54
- </select>
55
- <div ref="alwaysOpenMultipleContent"></div>
56
- </div>
57
- </div>
58
-
59
- <pre>
60
- <code class="language-javascript">
61
- new SlimSelect({
62
- select: '#selectElement',
63
- settings: {
64
- alwaysOpen: true,
65
-
66
- // In various situations it may be useful to set the contentLocation
67
- // to an element that will display best
68
- contentLocation: document.getElementById('local'), ,
69
- contentPosition: 'relative',
70
- }
71
- })
72
- </code>
73
- </pre>
74
-
75
- <pre>
76
- <code class="language-html">
77
- &lt;select id="selectElement"&gt;
78
- &lt;option value="value1"&gt;Value 1&lt;/option&gt;
79
- &lt;option value="value2"&gt;Value 2&lt;/option&gt;
80
- &lt;option value="value3"&gt;Value 3&lt;/option&gt;
81
- &lt;/select&gt;
82
-
83
- &lt;!-- The content will go in this div --&gt;
84
- &lt;div id="local"&gt;&lt;/div&gt;
85
- </code>
86
- </pre>
87
- </div>
88
- </template>