simp-select 1.0.17 → 1.0.19

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.
@@ -0,0 +1,1367 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport"
6
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
+ <title>Example SimpSelect</title>
9
+
10
+ <link rel="stylesheet" href="./style.css">
11
+
12
+ <link rel="stylesheet" href="https://unpkg.com/simp-select@1.0.18/dist/style.css">
13
+ <script src="https://unpkg.com/simp-select@1.0.18/dist/simpleSelect.js"></script>
14
+
15
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
16
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
17
+
18
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify.min.js"></script>
19
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
20
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>
21
+ </head>
22
+ <body>
23
+ <script>
24
+ const options = {
25
+ "indent_size": 4,
26
+ "html": {
27
+ "end_with_newline": false,
28
+ "attributes": {
29
+
30
+ },
31
+ "indent_size": 2,
32
+ "indent_char": " ",
33
+ "wrap_attributes": "force-aligned",
34
+ "beautifiers": [
35
+ "JS-Beautify"
36
+ ],
37
+ "js": {
38
+ "indent_size": 2
39
+ },
40
+ "css": {
41
+ "indent_size": 2
42
+ }
43
+ },
44
+ "css": {
45
+ "indent_size": 1
46
+ },
47
+ "js": {
48
+ "preserve-newlines": true
49
+ }
50
+ }
51
+
52
+ function getHtml(id) {
53
+ return hljs.highlight(html_beautify(document.getElementById(id).innerHTML, options),
54
+ { language: 'html' }
55
+ ).value
56
+ }
57
+ function pasteCode(data) {
58
+ const codeElem = document.getElementById(data.codeId);
59
+
60
+ codeElem.innerHTML = getHtml(data.firstId);
61
+
62
+ if (data.secondId) {
63
+ let lineBreak;
64
+ if ('lineBreak' in data) {
65
+ lineBreak = data.lineBreak;
66
+ } else if( 'lineBreakText' in data ) {
67
+ lineBreak = '\n\n' + data.lineBreakText + '\n\n';
68
+ } else {
69
+ lineBreak = '\n\n';
70
+ }
71
+ codeElem.innerHTML += lineBreak;
72
+ codeElem.innerHTML += getHtml(data.secondId);
73
+ }
74
+ }
75
+ function getSelectValues(select) {
76
+ var result = [];
77
+ var options = select && select.options;
78
+ var opt;
79
+
80
+ for (var i=0, iLen=options.length; i<iLen; i++) {
81
+ opt = options[i];
82
+
83
+ if (opt.selected) {
84
+ result.push(opt.value || opt.text);
85
+ }
86
+ }
87
+ return result;
88
+ }
89
+ </script>
90
+
91
+ <div class="container">
92
+
93
+ <pre class="code"><code class="language-html">
94
+ &lt;script&gt;
95
+ new SimpleSelect('.jsSimpSelect')
96
+ &lt;/script&gt;
97
+ </code></pre>
98
+
99
+
100
+ </div>
101
+
102
+ <div class="container">
103
+ <details>
104
+ <summary class="description">Select/multiselect without setting</summary>
105
+
106
+ <pre class="code"><code class="language-html" id="code_1"></code></pre>
107
+
108
+ </details>
109
+
110
+ <div class="items">
111
+ <div class="item" id="example_1_1">
112
+ <select class="jsSimpSelect">
113
+ <option value="item-1">Select 1</option>
114
+ <option value="item-2">Select 2</option>
115
+ <option value="item-3">Select 3</option>
116
+ <option value="item-4">Select 4</option>
117
+ </select>
118
+ </div>
119
+ <div class="item" id="example_1_2">
120
+ <select
121
+ class="jsSimpSelect"
122
+ multiple
123
+ data-simple-placeholder="Multiselect"
124
+ >
125
+ <option value="item-1">Multiselect 1</option>
126
+ <option value="item-2">Multiselect 2</option>
127
+ <option value="item-3">Multiselect 3</option>
128
+ <option value="item-4">Multiselect 4</option>
129
+ </select>
130
+ </div>
131
+ </div>
132
+ <script>
133
+ pasteCode({
134
+ codeId: 'code_1',
135
+ firstId: 'example_1_1',
136
+ secondId: 'example_1_2',
137
+ lineBreakText: '\nMultiselect:'
138
+ });
139
+ </script>
140
+ </div>
141
+
142
+ <div class="container">
143
+ <details>
144
+ <summary class="description">Custom FLOAT (min 1500px) </summary>
145
+ <pre class="code"><code class="language-html" id="code_2"></code></pre>
146
+ </details>
147
+
148
+ <div class="items">
149
+ <div class="item" id="example_2_1">
150
+ <select
151
+ class="jsSimpSelect"
152
+ multiple
153
+ data-simple-placeholder="custom width float"
154
+ data-simple-float-width="1500"
155
+ >
156
+ <option value="custom-1">custom float 1</option>
157
+ <option value="custom-2">custom float 2</option>
158
+ </select>
159
+ </div>
160
+
161
+ <div class="item" id="example_2_2">
162
+ <select
163
+ id="example_2_2_select"
164
+ multiple
165
+ data-simple-placeholder="custom width float"
166
+ >
167
+ <option value="custom-1">custom float 2-1</option>
168
+ <option value="custom-2">custom float 2-2</option>
169
+ </select>
170
+ <script>
171
+ window.addEventListener('load', () => {
172
+ new SimpleSelect('#example_2_2_select', {
173
+ floatWidth: 1500
174
+ })
175
+ })
176
+ </script>
177
+ </div>
178
+
179
+ <script>
180
+ pasteCode({
181
+ codeId: 'code_2',
182
+ firstId: 'example_2_1',
183
+ secondId: 'example_2_2',
184
+ lineBreakText: 'OR'
185
+ });
186
+ </script>
187
+ </div>
188
+ </div>
189
+
190
+
191
+ <div class="container">
192
+ <details>
193
+ <summary class="description">Cancel FLOAT (default <= 767)</summary>
194
+ <pre class="code"><code class="language-html" id="code_3"></code></pre>
195
+ </details>
196
+
197
+ <div class="items">
198
+ <div class="item" id="example_3_1">
199
+ <select
200
+ class="jsSimpSelect"
201
+ multiple
202
+ data-simple-float-none="true"
203
+ data-simple-placeholder="Cancel float"
204
+ >
205
+ <optgroup label="Group 1" >
206
+ <option value="none float">Cancel float - 1.1</option>
207
+ <option value="none float">Cancel float - 1.2</option>
208
+ </optgroup>
209
+ <optgroup label="Group 2" >
210
+ <option value="none float">Cancel float - 1.1.1</option>
211
+ <option value="none float">Cancel float - 1.2.2</option>
212
+ </optgroup>
213
+ </select>
214
+ </div>
215
+
216
+ <div class="item" id="example_3_2">
217
+ <select
218
+ multiple
219
+ id="example_3_2_select"
220
+ data-simple-placeholder="custom width float"
221
+ >
222
+ <option value="none float">Cancel float - 2.1</option>
223
+ <option value="none float">Cancel float - 2.2</option>
224
+ </select>
225
+ <script>
226
+ window.addEventListener('load', () => {
227
+ new SimpleSelect('#example_3_2_select', {
228
+ floatWidth: 0
229
+ })
230
+ })
231
+ </script>
232
+ </div>
233
+
234
+ <script>
235
+ pasteCode({
236
+ codeId: 'code_3',
237
+ firstId: 'example_3_1',
238
+ secondId: 'example_3_2',
239
+ lineBreakText: 'OR'
240
+ });
241
+ </script>
242
+ </div>
243
+ </div>
244
+
245
+ <div class="container">
246
+ <details>
247
+ <summary class="description">Not show selected titles</summary>
248
+ <pre class="code"><code class="language-html" id="code_4"></code></pre>
249
+ </details>
250
+
251
+ <div class="items">
252
+ <div class="item_full" id="example_4">
253
+ <select
254
+ class="jsSimpSelect"
255
+ data-simple-is-only-placeholder="true"
256
+ data-simple-placeholder="Always show this title"
257
+ multiple>
258
+ <option value="a1">Item 1</option>
259
+ <option value="a2">Item 2</option>
260
+ <option value="a3">Item 3</option>
261
+ <option value="a4">Item 4</option>
262
+ <option value="a5">Item 5</option>
263
+ </select>
264
+ </div>
265
+
266
+
267
+ <script>
268
+ pasteCode({
269
+ codeId: 'code_4',
270
+ firstId: 'example_4',
271
+ });
272
+ </script>
273
+ </div>
274
+ </div>
275
+
276
+
277
+ <div class="container">
278
+ <details>
279
+ <summary class="description">Confirm selected</summary>
280
+ <pre class="code"><code class="language-html" id="code_5"></code></pre>
281
+ </details>
282
+
283
+ <div class="items">
284
+ <div class="item_full" id="example_5_1">
285
+ <select multiple
286
+ class="jsSimpSelect"
287
+ data-simple-placeholder="custom placeholder"
288
+ data-simple-is-confirm="true"
289
+ >
290
+ <option value="Item 1">Item 1</option>
291
+ <option value="Item 2" disabled="disabled">Item 2 disabled</option>
292
+ <option value="Item 3">Item 3</option>
293
+ <option value="Item 4">Item 4</option>
294
+ <option value="Item 5">Item 5</option>
295
+ </select>
296
+ </div>
297
+ <script>
298
+ pasteCode({
299
+ codeId: 'code_5',
300
+ firstId: 'example_5_1',
301
+ });
302
+ </script>
303
+ </div>
304
+ </div>
305
+
306
+ <div class="container">
307
+ <details>
308
+ <summary class="description">Confirm selected (js initialization)</summary>
309
+ <pre class="code"><code class="language-html" id="code_6"></code></pre>
310
+ </details>
311
+
312
+ <div class="items">
313
+ <div class="item" id="example_6_1">
314
+ <select multiple
315
+ id="example_6_1_select"
316
+ data-simple-placeholder="custom placeholder"
317
+ data-simple-is-confirm="true"
318
+ >
319
+ <option value="Item 1">Item 1</option>
320
+ <option value="Item 2" disabled="disabled">Item 2 disabled</option>
321
+ <option value="Item 3">Item 3</option>
322
+ <option value="Item 4">Item 4</option>
323
+ <option value="Item 5">Item 5</option>
324
+ </select>
325
+ <script>
326
+ window.addEventListener('load', () => {
327
+ new SimpleSelect('#example_6_1_select', {
328
+ isConfirmInMulti: true,
329
+ })
330
+ })
331
+ </script>
332
+ </div>
333
+ <div class="item" id="example_6_2">
334
+ <select multiple
335
+ id="example_6_2_select"
336
+ data-simple-placeholder="custom placeholder"
337
+ data-simple-is-confirm="true"
338
+ >
339
+ <option value="Item 1">Item 1</option>
340
+ <option value="Item 2" disabled="disabled">Item 2 disabled</option>
341
+ <option value="Item 3">Item 3</option>
342
+ <option value="Item 4">Item 4</option>
343
+ <option value="Item 5">Item 5</option>
344
+ </select>
345
+ <script>
346
+ window.addEventListener('load', () => {
347
+ new SimpleSelect('#example_6_2_select', {
348
+ isConfirmInMulti: true,
349
+ isConfirmInMultiOkClickOutside: true
350
+ })
351
+ })
352
+ </script>
353
+ </div>
354
+ <script>
355
+ pasteCode({
356
+ codeId: 'code_6',
357
+ firstId: 'example_6_1',
358
+ secondId: 'example_6_2',
359
+ lineBreakText: '\n<strong>Confirm by click outside:<strong>'
360
+ });
361
+ </script>
362
+ </div>
363
+ </div>
364
+
365
+ <div class="container">
366
+ <details>
367
+ <summary class="description">Show number of selected titles (default: 3)</summary>
368
+ <pre class="code"><code class="language-html" id="code_7"></code></pre>
369
+ </details>
370
+
371
+ <div class="items">
372
+ <div class="item" id="example_7_1">
373
+ <select multiple
374
+ class="jsSimpSelect"
375
+ data-simple-placeholder="custom placeholder"
376
+ data-simple-count-shows-selected="2"
377
+ >
378
+ <option value="Item 1">Item 1</option>
379
+ <option value="Item 2">Item 2</option>
380
+ <option value="Item 3">Item 3</option>
381
+ <option value="Item 4">Item 4</option>
382
+ <option value="Item 5">Item 5</option>
383
+ </select>
384
+ </div>
385
+ <div class="item" id="example_7_2">
386
+ <select multiple
387
+ id="example_7_2_select"
388
+ data-simple-placeholder="custom placeholder"
389
+ >
390
+ <option value="Item 1">Item 1</option>
391
+ <option value="Item 2">Item 2 </option>
392
+ <option value="Item 3">Item 3</option>
393
+ <option value="Item 4">Item 4</option>
394
+ <option value="Item 5">Item 5</option>
395
+ </select>
396
+ <script>
397
+ window.addEventListener('load', () => {
398
+ new SimpleSelect('#example_7_2_select', {
399
+ countShowSelected: 2
400
+ })
401
+ })
402
+ </script>
403
+ </div>
404
+ <script>
405
+ pasteCode({
406
+ codeId: 'code_7',
407
+ firstId: 'example_7_1',
408
+ secondId: 'example_7_2',
409
+ });
410
+ </script>
411
+ </div>
412
+ </div>
413
+
414
+
415
+ <div class="container">
416
+ <details>
417
+ <summary class="description">HTML content (after and before) in option (only DOM elements)</summary>
418
+ <pre class="code"><code class="language-html" id="code_8"></code></pre>
419
+ </details>
420
+
421
+ <div class="items">
422
+ <div class="item" id="example_8_1">
423
+ <select
424
+ class="jsSimpSelect"
425
+ multiple
426
+ >
427
+ <option value="item 1"
428
+ data-simple-html-before="<span>|before| </span>"
429
+ data-simple-html-after="<span> |after|</div>"
430
+ >Item 1</option>
431
+ <option value="item 2"
432
+ data-simple-html-after="<strong> |after|</strong>"
433
+ >Item 2</option>
434
+ <option value="item 3"
435
+ data-simple-html-before="<span> |before|</div>"
436
+ >Item 3</option>
437
+ <option value="item 4">Item 4</option>
438
+ <option value="item 5"
439
+ data-simple-html-before="<i>|before| </i>"
440
+ data-simple-html-after="<span> |after|</div>"
441
+ >Item 5</option>
442
+ </select>
443
+ </div>
444
+ <div class="item" id="example_8_2">
445
+ <select
446
+ class="jsSimpSelect"
447
+ >
448
+ <option value="item 1"
449
+ data-simple-html-before="<span>|before| </span>"
450
+ data-simple-html-after="<span> |after|</div>"
451
+ >Item 1</option>
452
+ <option value="item 2"
453
+ data-simple-html-after="<strong> |after|</strong>"
454
+ >Item 2</option>
455
+ <option value="item 3"
456
+ data-simple-html-before="<span> |before|</div>"
457
+ >Item 3</option>
458
+ <option value="item 4">Item 4</option>
459
+ <option value="item 5"
460
+ data-simple-html-before="<i>|before| </i>"
461
+ data-simple-html-after="<span> |after|</div>"
462
+ >Item 5</option>
463
+ </select>
464
+ </div>
465
+
466
+
467
+ <script>
468
+ pasteCode({
469
+ codeId: 'code_8',
470
+ firstId: 'example_8_1',
471
+ secondId: 'example_8_2',
472
+ });
473
+ </script>
474
+ </div>
475
+ </div>
476
+
477
+ <div class="container">
478
+ <details>
479
+ <summary class="description">HTML content (after and before) for all options (only DOM elements) </summary>
480
+ <pre class="code"><code class="language-html" id="code_8_3"></code></pre>
481
+ </details>
482
+
483
+ <div class="items">
484
+ <div class="item" id="example_8_3">
485
+ <select
486
+ class="jsSimpSelect"
487
+ data-simple-item-html-before="<span style='margin-right: 10px'>before</span>"
488
+ multiple
489
+ >
490
+ <option value="item 1">Item 1</option>
491
+ <option value="item 2">Item 2</option>
492
+ <option value="item 3">Item 3</option>
493
+ <option value="item 4">Item 4</option>
494
+ <option value="item 4">Item 4</option>
495
+
496
+ </select>
497
+ </div>
498
+ <div class="item" id="example_8_4">
499
+ <select
500
+ class="jsSimpSelect"
501
+ multiple
502
+ data-simple-item-html-after="<span style='padding-left: 10px; color: darkorange'>after</span>"
503
+ >
504
+ <option value="item 1">Item 1</option>
505
+ <option value="item 2">Item 2</option>
506
+ <option value="item 3">Item 3</option>
507
+ <option value="item 4">Item 4</option>
508
+ <option value="item 4">Item 4</option>
509
+
510
+ </select>
511
+ </div>
512
+
513
+
514
+ <script>
515
+ pasteCode({
516
+ codeId: 'code_8_3',
517
+ firstId: 'example_8_3',
518
+ secondId: 'example_8_3',
519
+ });
520
+ </script>
521
+ </div>
522
+ </div>
523
+
524
+
525
+ <div class="container">
526
+ <details>
527
+ <summary class="description">Select All</summary>
528
+ <pre class="code"><code class="language-html" id="code_9"></code></pre>
529
+ </details>
530
+
531
+ <div class="items">
532
+ <div class="item" id="example_9_1">
533
+ <select
534
+ class="jsSimpSelect"
535
+ multiple
536
+ data-simple-placeholder="Select all"
537
+ >
538
+ <optgroup label="Группа 1">
539
+ <option value="1.1">multiple Опция 1.1</option>
540
+ </optgroup>
541
+ <optgroup label="Группа 2">
542
+ <option value="2.1">multiple Опция 2.1</option>
543
+ <option value="2.2">multiple Опция 2.2</option>
544
+ </optgroup>
545
+ <optgroup label="Группа 3" disabled>
546
+ <option value="3.1">multiple Опция 3.1</option>
547
+ <option value="3.2">multiple Опция 3.2</option>
548
+ <option value="3.3">multiple Опция 3.3</option>
549
+ </optgroup>
550
+ </select>
551
+ </div>
552
+
553
+ <div class="item" id="example_9_2">
554
+ <select
555
+ multiple
556
+ id="example_9_2_select"
557
+ data-simple-placeholder="Select all"
558
+ >
559
+ <option value="Item 1">Item 1</option>
560
+ <option value="Item 2">Item 2</option>
561
+ <option value="Item 3">Item 3</option>
562
+ <option value="Item 4">Item 4</option>
563
+ <option value="Item 5">Item 5</option>
564
+ <option value="Item 6">Item 6</option>
565
+ </select>
566
+ <script>
567
+ window.addEventListener('load', () => {
568
+ new SimpleSelect('#example_9_2_select', {
569
+ selectAll: true,
570
+ })
571
+ })
572
+ </script>
573
+ </div>
574
+
575
+ <script>
576
+ pasteCode({
577
+ codeId: 'code_9',
578
+ firstId: 'example_9_1',
579
+ secondId: 'example_9_2',
580
+ lineBreakText: 'OR'
581
+ });
582
+ </script>
583
+ </div>
584
+ </div>
585
+
586
+ <div class="container">
587
+ <details>
588
+ <summary class="description">Reset All</summary>
589
+ <pre class="code"><code class="language-html" id="code_10"></code></pre>
590
+ </details>
591
+
592
+ <div class="items">
593
+ <div class="item" id="example_10_1">
594
+ <select
595
+ class="jsSimpSelect"
596
+ multiple
597
+ data-simple-reset-all="true"
598
+ data-simple-placeholder="Reset all"
599
+ >
600
+ <optgroup label="Группа 1">
601
+ <option value="1.1">multiple Опция 1.1</option>
602
+ </optgroup>
603
+ <optgroup label="Группа 2">
604
+ <option value="2.1">multiple Опция 2.1</option>
605
+ <option value="2.2">multiple Опция 2.2</option>
606
+ </optgroup>
607
+ <optgroup label="Группа 3" disabled>
608
+ <option value="3.1">multiple Опция 3.1</option>
609
+ <option value="3.2">multiple Опция 3.2</option>
610
+ <option value="3.3">multiple Опция 3.3</option>
611
+ </optgroup>
612
+ </select>
613
+ </div>
614
+
615
+ <div class="item" id="example_10_2">
616
+ <select
617
+ multiple
618
+ id="example_10_2_select"
619
+ data-simple-placeholder="Reset all"
620
+ >
621
+ <option value="Item 1">Item 1</option>
622
+ <option value="Item 2">Item 2</option>
623
+ <option value="Item 3">Item 3</option>
624
+ <option value="Item 4">Item 4</option>
625
+ <option value="Item 5">Item 5</option>
626
+ <option value="Item 6">Item 6</option>
627
+ </select>
628
+ <script>
629
+ window.addEventListener('load', () => {
630
+ new SimpleSelect('#example_10_2_select', {
631
+ resetAll: true
632
+ })
633
+ })
634
+ </script>
635
+ </div>
636
+
637
+ <script>
638
+ pasteCode({
639
+ codeId: 'code_10',
640
+ firstId: 'example_10_1',
641
+ secondId: 'example_10_2',
642
+ lineBreakText: 'OR'
643
+ });
644
+ </script>
645
+ </div>
646
+ </div>
647
+
648
+ <div class="container">
649
+ <details>
650
+ <summary class="description">Select and Reset All</summary>
651
+ <pre class="code"><code class="language-html" id="code_11"></code></pre>
652
+ </details>
653
+
654
+ <div class="items">
655
+ <div class="item" id="example_11_1">
656
+ <select
657
+ class="jsSimpSelect"
658
+ multiple
659
+ data-simple-select-all="true"
660
+ data-simple-reset-all="true"
661
+ data-simple-placeholder="Select and reset"
662
+ >
663
+ <option value="Item 1">Item 1</option>
664
+ <option value="Item 2">Item 2</option>
665
+ <option value="Item 3" disabled>Item 3</option>
666
+ <option value="Item 4">Item 4</option>
667
+ <option value="Item 5">Item 5</option>
668
+ <option value="Item 6">Item 6</option>
669
+ </select>
670
+ </div>
671
+
672
+ <div class="item" id="example_11_2">
673
+ <select
674
+ multiple
675
+ id="example_11_2_select"
676
+ data-simple-placeholder="Select and reset"
677
+ >
678
+ <option value="Item 1">Item 1</option>
679
+ <option value="Item 2">Item 2</option>
680
+ <option value="Item 3">Item 3</option>
681
+ <option value="Item 4">Item 4</option>
682
+ <option value="Item 5">Item 5</option>
683
+ <option value="Item 6">Item 6</option>
684
+ </select>
685
+ <script>
686
+ window.addEventListener('load', () => {
687
+ new SimpleSelect('#example_11_2_select', {
688
+ selectAll: true,
689
+ resetAll: true
690
+ })
691
+ })
692
+ </script>
693
+ </div>
694
+
695
+ <script>
696
+ pasteCode({
697
+ codeId: 'code_11',
698
+ firstId: 'example_11_1',
699
+ secondId: 'example_11_2',
700
+ lineBreakText: 'OR'
701
+ });
702
+ </script>
703
+ </div>
704
+ </div>
705
+
706
+
707
+
708
+
709
+ <div class="container">
710
+ <details>
711
+ <summary class="description">Debounce time (or at closing)</summary>
712
+ <pre class="code"><code class="language-html" id="code_12"></code></pre>
713
+ </details>
714
+
715
+ <div class="items jsDebounceChange">
716
+ <div class="item" id="example_12_1">
717
+ <select
718
+ class="jsSimpSelect"
719
+ multiple
720
+ data-simple-debounce-time="1000"
721
+ data-simple-placeholder="Debounce 1000ms"
722
+ >
723
+ <option value="Item 1">Item 1</option>
724
+ <option value="Item 2">Item 2</option>
725
+ <option value="Item 3">Item 3</option>
726
+ <option value="Item 4">Item 4</option>
727
+ <option value="Item 5">Item 5</option>
728
+ <option value="Item 6">Item 6</option>
729
+ </select>
730
+ </div>
731
+
732
+ <div class="item" id="example_12_2">
733
+ <select
734
+ id="example_12_2_select"
735
+ multiple
736
+ data-simple-placeholder="Debounce 1500ms"
737
+ >
738
+ <option value="Item 1">Item 1</option>
739
+ <option value="Item 2">Item 2</option>
740
+ <option value="Item 3">Item 3</option>
741
+ <option value="Item 4">Item 4</option>
742
+ <option value="Item 5">Item 5</option>
743
+ <option value="Item 6">Item 6</option>
744
+ </select>
745
+ <script>
746
+ window.addEventListener('load', () => {
747
+ new SimpleSelect('#example_12_2_select', {
748
+ debounceTime: 1500
749
+ })
750
+ })
751
+ </script>
752
+ </div>
753
+
754
+ <script>
755
+ document.querySelectorAll('.jsDebounceChange select').forEach(sel => {
756
+ sel.addEventListener('change', () => {
757
+ alert(`select update. New values: ${getSelectValues(sel)}`)
758
+ })
759
+ })
760
+ pasteCode({
761
+ codeId: 'code_12',
762
+ firstId: 'example_12_1',
763
+ secondId: 'example_12_2',
764
+ lineBreakText: 'OR'
765
+ });
766
+ </script>
767
+ </div>
768
+ </div>
769
+
770
+
771
+ <div class="container">
772
+ <details>
773
+ <summary class="description">Search</summary>
774
+ <pre class="code"><code class="language-html" id="code_13"></code></pre>
775
+ </details>
776
+
777
+ <div class="items">
778
+ <div class="item" id="example_13_1">
779
+ <select
780
+ class="jsSimpSelect"
781
+ data-simple-select-search="true"
782
+ data-simple-placeholder="Search"
783
+ >
784
+ <option value="Item 1">Item 1</option>
785
+ <option value="Item 2">Item 2</option>
786
+ <option value="Item 3">Item 3</option>
787
+ <option value="Item 4">Item 4</option>
788
+ <option value="Item 5">Item 5</option>
789
+ <option value="Item 6">Item 6</option>
790
+ </select>
791
+ </div>
792
+
793
+ <div class="item" id="example_13_2">
794
+ <select
795
+ id="example_13_2_select"
796
+ multiple
797
+ data-simple-placeholder="Search"
798
+ >
799
+ <option value="Item 1">Item 1</option>
800
+ <option value="Item 2">Item 2</option>
801
+ <option value="Item 3">Item 3</option>
802
+ <option value="Item 4">Item 4</option>
803
+ <option value="Item 5">Item 5</option>
804
+ <option value="Item 6">Item 6</option>
805
+ </select>
806
+ <script>
807
+ window.addEventListener('load', () => {
808
+ new SimpleSelect('#example_13_2_select', {
809
+ isSearch: true
810
+ })
811
+ })
812
+ </script>
813
+ </div>
814
+
815
+ <script>
816
+ pasteCode({
817
+ codeId: 'code_13',
818
+ firstId: 'example_13_1',
819
+ secondId: 'example_13_2',
820
+ lineBreakText: 'OR'
821
+ });
822
+ </script>
823
+ </div>
824
+ </div>
825
+
826
+ <div class="container">
827
+ <details>
828
+ <summary class="description">Search in dropdown</summary>
829
+ <pre class="code"><code class="language-html" id="code_14"></code></pre>
830
+ </details>
831
+
832
+ <div class="items">
833
+ <div class="item" id="example_14_1">
834
+ <select
835
+ class="jsSimpSelect"
836
+ data-simple-select-search-dropdown="true"
837
+ data-simple-placeholder="Search in dropdown"
838
+ >
839
+ <option value="Item 1">Item 1</option>
840
+ <option value="Item 2">Item 2</option>
841
+ <option value="Item 3">Item 3</option>
842
+ <option value="Item 4">Item 4</option>
843
+ <option value="Item 5">Item 5</option>
844
+ <option value="Item 6">Item 6</option>
845
+ </select>
846
+ </div>
847
+
848
+ <div class="item" id="example_14_2">
849
+ <select
850
+ id="example_14_2_select"
851
+ multiple
852
+ data-simple-placeholder="Search in dropdown"
853
+ >
854
+ <option value="Item 1">Item 1</option>
855
+ <option value="Item 2">Item 2</option>
856
+ <option value="Item 3">Item 3</option>
857
+ <option value="Item 4">Item 4</option>
858
+ <option value="Item 5">Item 5</option>
859
+ <option value="Item 6">Item 6</option>
860
+ </select>
861
+ <script>
862
+ window.addEventListener('load', () => {
863
+ new SimpleSelect('#example_14_2_select', {
864
+ isSearchInDropdown: true
865
+ })
866
+ })
867
+ </script>
868
+ </div>
869
+
870
+ <script>
871
+ pasteCode({
872
+ codeId: 'code_14',
873
+ firstId: 'example_14_1',
874
+ secondId: 'example_14_2',
875
+ lineBreakText: 'OR'
876
+ });
877
+ </script>
878
+ </div>
879
+ </div>
880
+
881
+
882
+
883
+
884
+ <div class="container">
885
+ <details>
886
+ <summary class="description">Show checkbox for select</summary>
887
+ <pre class="code"><code class="language-html" id="code_15"></code></pre>
888
+ </details>
889
+
890
+ <div class="items">
891
+ <div class="item_full" id="example_15_1">
892
+ <select
893
+ class="jsSimpSelect"
894
+ data-simple-show-checkbox="true"
895
+ >
896
+ <optgroup label="Группа 1">
897
+ <option value="1">Опция 1.1</option>
898
+ </optgroup>
899
+ <optgroup label="Группа 2">
900
+ <option value="1">Опция 2.1</option>
901
+ <option value="1">Опция 2.2</option>
902
+ </optgroup>
903
+ <optgroup label="Группа 3" disabled>
904
+ <option value="1">Опция 3.1</option>
905
+ <option value="1">Опция 3.2</option>
906
+ <option value="1">Опция 3.3</option>
907
+ </optgroup>
908
+ </select>
909
+ </div>
910
+
911
+ <script>
912
+ pasteCode({
913
+ codeId: 'code_15',
914
+ firstId: 'example_15_1',
915
+ });
916
+ </script>
917
+ </div>
918
+ </div>
919
+
920
+
921
+
922
+ <div class="container">
923
+ <details>
924
+ <summary class="description">Add classes for wrapper</summary>
925
+ <pre class="code"><code class="language-html" id="code_16"></code></pre>
926
+ </details>
927
+
928
+ <div class="items">
929
+ <div class="item_full" id="example_16_1">
930
+ <select
931
+ class="jsSimpSelect"
932
+ data-simple-add-classes="custom_class_1 custom_class_2"
933
+ >
934
+ <option value="Item 1">Item 1</option>
935
+ <option value="Item 2">Item 2</option>
936
+ <option value="Item 3">Item 3</option>
937
+ <option value="Item 4">Item 4</option>
938
+ <option value="Item 5">Item 5</option>
939
+ <option value="Item 6">Item 6</option>
940
+ </select>
941
+ </div>
942
+
943
+ <script>
944
+ pasteCode({
945
+ codeId: 'code_16',
946
+ firstId: 'example_16_1',
947
+ });
948
+ </script>
949
+ </div>
950
+ </div>
951
+
952
+
953
+
954
+
955
+
956
+
957
+ <div class="container">
958
+ <details>
959
+ <summary class="description">Dropdown always open</summary>
960
+ <pre class="code"><code class="language-html" id="code_18"></code></pre>
961
+ </details>
962
+
963
+ <div class="items">
964
+ <div class="item" id="example_18_1">
965
+ <select
966
+ multiple
967
+ class="jsSimpSelect"
968
+ data-simple-always-open="true"
969
+ data-simple-placeholder="Dropdown always open"
970
+ >
971
+ <option value="Item 1">Item 1</option>
972
+ <option value="Item 2">Item 2</option>
973
+ <option value="Item 3">Item 3</option>
974
+ <option value="Item 4">Item 4</option>
975
+ <option value="Item 5">Item 5</option>
976
+ <option value="Item 6">Item 6</option>
977
+ </select>
978
+ </div>
979
+
980
+ <div class="item" id="example_18_2">
981
+ <select
982
+ multiple
983
+ id="example_18_2_select"
984
+ data-simple-placeholder="Dropdown always open"
985
+ >
986
+ <option value="Item 1">Item 1</option>
987
+ <option value="Item 2">Item 2</option>
988
+ <option value="Item 3">Item 3</option>
989
+ <option value="Item 4">Item 4</option>
990
+ </select>
991
+ <script>
992
+ window.addEventListener('load', () => {
993
+ new SimpleSelect('#example_18_2_select', {
994
+ isAlwaysOpen: true
995
+ })
996
+ })
997
+ </script>
998
+ </div>
999
+
1000
+ <script>
1001
+ pasteCode({
1002
+ codeId: 'code_18',
1003
+ firstId: 'example_18_1',
1004
+ secondId: 'example_18_2',
1005
+ lineBreakText: 'OR'
1006
+ });
1007
+ </script>
1008
+ </div>
1009
+ </div>
1010
+
1011
+
1012
+ <div class="container">
1013
+ <details>
1014
+ <summary class="description">Dropdown always open and remove top (Title, arrow, search) </summary>
1015
+ <pre class="code"><code class="language-html" id="code_19"></code></pre>
1016
+ </details>
1017
+
1018
+ <div class="items">
1019
+ <div class="item" id="example_19_1">
1020
+ <select
1021
+ multiple
1022
+ class="jsSimpSelect"
1023
+ data-simple-always-open="true"
1024
+ data-simple-remove-top="true"
1025
+ >
1026
+ <option value="Item 1">Item 1</option>
1027
+ <option value="Item 2">Item 2</option>
1028
+ <option value="Item 3">Item 3</option>
1029
+ <option value="Item 4">Item 4</option>
1030
+ <option value="Item 5">Item 5</option>
1031
+ <option value="Item 6">Item 6</option>
1032
+ </select>
1033
+ </div>
1034
+
1035
+ <div class="item" id="example_19_2">
1036
+ <select
1037
+ multiple
1038
+ id="example_19_2_select"
1039
+ >
1040
+ <option value="Item 1">Item 1</option>
1041
+ <option value="Item 2">Item 2</option>
1042
+ <option value="Item 3">Item 3</option>
1043
+ <option value="Item 4">Item 4</option>
1044
+ </select>
1045
+ <script>
1046
+ window.addEventListener('load', () => {
1047
+ new SimpleSelect('#example_19_2_select', {
1048
+ isAlwaysOpen: true,
1049
+ isRemoveTop: true
1050
+ })
1051
+ })
1052
+ </script>
1053
+ </div>
1054
+
1055
+ <script>
1056
+ pasteCode({
1057
+ codeId: 'code_19',
1058
+ firstId: 'example_19_1',
1059
+ secondId: 'example_19_2',
1060
+ lineBreakText: 'OR'
1061
+ });
1062
+ </script>
1063
+ </div>
1064
+ </div>
1065
+
1066
+
1067
+
1068
+ <div class="container">
1069
+ <details>
1070
+ <summary class="description">Locale</summary>
1071
+ <pre class="code"><code class="language-html" id="code_20"></code></pre>
1072
+ </details>
1073
+
1074
+ <div class="items">
1075
+ <div class="item" id="example_20">
1076
+ <select
1077
+ multiple
1078
+ id="example_20_select"
1079
+ data-simple-placeholder="locale Ukraine"
1080
+ >
1081
+ <option value="Item 1">Item 1</option>
1082
+ <option value="Item 2">Item 2</option>
1083
+ <option value="Item 3">Item 3</option>
1084
+ <option value="Item 4">Item 4</option>
1085
+ </select>
1086
+ <script>
1087
+ window.addEventListener('load', () => {
1088
+ new SimpleSelect('#example_20_select', {
1089
+ isSearch: true,
1090
+ selectAll: true,
1091
+ resetAll: true,
1092
+ isConfirmInMulti: true,
1093
+ locale: {
1094
+ noSearch: 'Немає збігів для',
1095
+ searchText: 'Пошук',
1096
+ title: 'Виберіть',
1097
+ selected: 'Вибране:',
1098
+ all: 'Все',
1099
+ ok: 'Ok',
1100
+ cancel: 'Скасувати',
1101
+ selectAll: 'Вибрати все',
1102
+ resetAll: 'Скинути все',
1103
+ }
1104
+ })
1105
+ })
1106
+ </script>
1107
+ </div>
1108
+ <div class="item" id="example_20_1">
1109
+ <select
1110
+ multiple
1111
+ id="example_20_1_select"
1112
+ data-simple-placeholder="locale Russian"
1113
+ >
1114
+ <option value="Item 1">Item 1</option>
1115
+ <option value="Item 2">Item 2</option>
1116
+ <option value="Item 3">Item 3</option>
1117
+ <option value="Item 4">Item 4</option>
1118
+ </select>
1119
+ <script>
1120
+ window.addEventListener('load', () => {
1121
+ new SimpleSelect('#example_20_1_select', {
1122
+ isSearch: true,
1123
+ selectAll: true,
1124
+ resetAll: true,
1125
+ isConfirmInMulti: true,
1126
+ locale: {
1127
+ noSearch: 'Нет совпадений для',
1128
+ searchText: 'Поиск',
1129
+ title: 'Выберите',
1130
+ selected: 'Избранное:',
1131
+ all: 'Все',
1132
+ ok: 'Ok',
1133
+ cancel: 'Отменить',
1134
+ selectAll: 'Выбрать все',
1135
+ resetAll: 'Сбросить все',
1136
+ }
1137
+ })
1138
+ })
1139
+ </script>
1140
+ </div>
1141
+
1142
+ <script>
1143
+ pasteCode({
1144
+ codeId: 'code_20',
1145
+ firstId: 'example_20',
1146
+ secondId: 'example_20_1',
1147
+ });
1148
+ </script>
1149
+ </div>
1150
+ </div>
1151
+
1152
+
1153
+
1154
+ <div class="container">
1155
+ <details>
1156
+ <summary class="description">list native On Device (default: 'Android', 'BlackBerry', 'iPhone', 'iPad', 'iPod', 'Opera Mini', 'IEMobile', 'Silk')</summary>
1157
+ <pre class="code"><code class="language-html" id="code_21"></code></pre>
1158
+ </details>
1159
+
1160
+ <div class="items">
1161
+ <div class="item" id="example_21_1">
1162
+ <select
1163
+ multiple
1164
+ id="example_21_select"
1165
+ >
1166
+ <option value="Item 1">Item 1</option>
1167
+ <option value="Item 2">Item 2</option>
1168
+ <option value="Item 3">Item 3</option>
1169
+ <option value="Item 4">Item 4</option>
1170
+ </select>
1171
+ <script>
1172
+ window.addEventListener('load', () => {
1173
+ new SimpleSelect('#example_21_select', {
1174
+ nativeOnDevice: []
1175
+ })
1176
+ })
1177
+ </script>
1178
+ </div>
1179
+
1180
+
1181
+ <script>
1182
+ pasteCode({
1183
+ codeId: 'code_21',
1184
+ firstId: 'example_21_1',
1185
+ });
1186
+ </script>
1187
+ </div>
1188
+ </div>
1189
+
1190
+
1191
+
1192
+ <div class="container">
1193
+ <details>
1194
+ <summary class="description">detect Native (return boolean)</summary>
1195
+ <pre class="code"><code class="language-html" id="code_22"></code></pre>
1196
+ </details>
1197
+
1198
+ <div class="items">
1199
+ <div class="item" id="example_22_1">
1200
+ <select
1201
+ multiple
1202
+ id="example_22_select"
1203
+ data-simple-placeholder="Always native"
1204
+ >
1205
+ <option value="Item 1">Item 1</option>
1206
+ <option value="Item 2">Item 2</option>
1207
+ <option value="Item 3">Item 3</option>
1208
+ <option value="Item 4">Item 4</option>
1209
+ </select>
1210
+ <script>
1211
+ window.addEventListener('load', () => {
1212
+ new SimpleSelect('#example_22_select', {
1213
+ detectNative: function () {
1214
+ return true;
1215
+ }
1216
+ })
1217
+ })
1218
+ </script>
1219
+ </div>
1220
+ <div class="item" id="example_22_2">
1221
+ <select
1222
+ multiple
1223
+ id="example_22_2_select"
1224
+ data-simple-placeholder="Never native"
1225
+ >
1226
+ <option value="Item 1">Item 1</option>
1227
+ <option value="Item 2">Item 2</option>
1228
+ <option value="Item 3">Item 3</option>
1229
+ <option value="Item 4">Item 4</option>
1230
+ </select>
1231
+ <script>
1232
+ window.addEventListener('load', () => {
1233
+ new SimpleSelect('#example_22_2_select', {
1234
+ detectNative: function () {
1235
+ return false;
1236
+ }
1237
+ })
1238
+ })
1239
+ </script>
1240
+ </div>
1241
+
1242
+
1243
+ <script>
1244
+ pasteCode({
1245
+ codeId: 'code_22',
1246
+ firstId: 'example_22_1',
1247
+ secondId: 'example_22_2',
1248
+ lineBreakText: 'OR'
1249
+
1250
+ });
1251
+ </script>
1252
+ </div>
1253
+ </div>
1254
+
1255
+
1256
+
1257
+ <div class="container">
1258
+ <details>
1259
+ <summary class="description">Dropdown up</summary>
1260
+ <pre class="code"><code class="language-html" id="code_17"></code></pre>
1261
+ </details>
1262
+
1263
+ <div class="items">
1264
+ <div class="item" id="example_17_1">
1265
+ <select
1266
+ multiple
1267
+ class="jsSimpSelect"
1268
+ data-simple-up="true"
1269
+ data-simple-placeholder="Dropdown up"
1270
+ >
1271
+ <option value="Item 1">Item 1</option>
1272
+ <option value="Item 2">Item 2</option>
1273
+ <option value="Item 3">Item 3</option>
1274
+ <option value="Item 4">Item 4</option>
1275
+ <option value="Item 5">Item 5</option>
1276
+ <option value="Item 6">Item 6</option>
1277
+ </select>
1278
+ </div>
1279
+ <div class="item" id="example_17_2">
1280
+ <select
1281
+ multiple
1282
+ data-simple-placeholder="Dropdown up"
1283
+ id="example_17_2_select"
1284
+ >
1285
+ <option value="Item 1">Item 1</option>
1286
+ <option value="Item 2">Item 2</option>
1287
+ <option value="Item 3">Item 3</option>
1288
+ <option value="Item 4">Item 4</option>
1289
+ <option value="Item 5">Item 5</option>
1290
+ <option value="Item 6">Item 6</option>
1291
+ </select>
1292
+ <script>
1293
+ window.addEventListener('load', () => {
1294
+ new SimpleSelect('#example_17_2_select', {
1295
+ isUp: true
1296
+ })
1297
+ })
1298
+ </script>
1299
+ </div>
1300
+
1301
+ <script>
1302
+ pasteCode({
1303
+ codeId: 'code_17',
1304
+ firstId: 'example_17_1',
1305
+ secondId: 'example_17_2',
1306
+ lineBreakText: 'OR'
1307
+ });
1308
+ </script>
1309
+ </div>
1310
+ </div>
1311
+
1312
+
1313
+ <!--
1314
+
1315
+ <div class="container">
1316
+ <details>
1317
+ <summary class="description">TILE</summary>
1318
+ <pre class="code"><code class="language-html" id="code_"></code></pre>
1319
+ </details>
1320
+
1321
+ <div class="items">
1322
+ <div class="item" id="example_">
1323
+ <select
1324
+ class="jsSimpSelect"
1325
+ multiple
1326
+ >
1327
+ </select>
1328
+ </div>
1329
+
1330
+ <div class="item" id="example_">
1331
+ <select
1332
+ multiple
1333
+ data-simple-placeholder="custom width float"
1334
+ >
1335
+ </select>
1336
+ <script>
1337
+ window.addEventListener('load', () => {
1338
+ // new SimpleSelect('#example_2_2_select', {
1339
+ // floatWidth: 1500
1340
+ // })
1341
+ })
1342
+ </script>
1343
+ </div>
1344
+
1345
+ <script>
1346
+ // pasteCode({
1347
+ // codeId: 'code_2',
1348
+ // firstId: 'example_2_1',
1349
+ // secondId: 'example_2_2',
1350
+ // lineBreakText: 'OR'
1351
+ // });
1352
+ </script>
1353
+ </div>
1354
+ </div>
1355
+
1356
+ -->
1357
+
1358
+
1359
+ <script>
1360
+ new SimpleSelect('.jsSimpSelect')
1361
+ </script>
1362
+
1363
+
1364
+
1365
+
1366
+ </body>
1367
+ </html>