simp-select 1.1.21 → 1.1.23

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 CHANGED
@@ -17,8 +17,8 @@ npm install simp-select --save
17
17
  ```
18
18
  Or you can load it via a script tag as follows:
19
19
  ```
20
- <script src="https://unpkg.com/simp-select@1.1.21/dist/simpleSelect.js" ></script>
21
- <script src="https://unpkg.com/simp-select@1.1.21/dist/polyfill.js" ></script> - for IE 11
20
+ <script src="https://unpkg.com/simp-select@1.1.23/dist/simpleSelect.js" ></script>
21
+ <script src="https://unpkg.com/simp-select@1.1.23/dist/polyfill.js" ></script> - for IE 11
22
22
  Or get last version
23
23
  <script src="https://unpkg.com/simp-select"></script>
24
24
  ```
@@ -39,69 +39,71 @@ the variable `SimpSelect` attached to `window` or `this` depending on what envir
39
39
  ## API
40
40
  #### `new SimpSelect(selector, <options>)`
41
41
 
42
- | Property | Value |
43
- |----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
44
- | **selector**(required) | string(css selector), HTMLSelectElement, HTMLSelectElement(Array, HTMLSelectElement) |
45
- | **OPTIONS:** | |
46
- | **countShowSelected**:number* | <p>default: **3** </p> Show count selected options. If more then this count, showed template: Selected: 4<p>Or - `data-simple-count-shows-selected="3"` - in select</p> |
47
- | **isSearch**:boolean* | <p>default: **false** </p> Show input for filter items <p>Or - `data-simple-select-search="true"` - in select</p> |
48
- | **isSearchInDropdown**:boolean* | <p>default: **false** </p> Show search input inside dropdown <p>Or - `data-simple-select-search-dropdown="true"` - in select</p> |
49
- | **isConfirmInMulti**:boolean* | <p>default: **false** </p> Show buttons `OK` and `Cancel`. Only Multiselect <p>Or `data-simple-is-confirm="true" - in select`</> |
50
- | **isConfirmInMultiOkClickOutside**:boolean | <p>default: **false** </p> Click outside like click by button `OK`. Only if `isConfirmInMulti=true` |
51
- | **nativeOnDevice**:string[] | <p>default: **'Android', 'BlackBerry', 'iPhone', 'iPad', 'iPod', 'Opera Mini', 'IEMobile', 'Silk'** </p> The system default select list is rendered on the matched device(Check useragent ). |
52
- | **debounceTime**:number* | <p>default: **0** </p> The change event will not be triggered immediately, but after a specified amount of time. <p>Or `data-simple-debounce-time="1000"` in select</p> |
53
- | **floatWidth**:number* | <p>default: **767** </p> Minimum screen width of device below which the dropdown is rendered like popup. <p>Or `data-simple-float-width="500" in select. Or data-simple-float-none="true" - cancel for select`</p> |
54
- | **sepChars**:string | <p>default: **,** </p> Separator for selected element. Show |
55
- | **selectAll**:boolean* | <p>default: **false**</p> Show button - `Select all` <p>Or `data-simple-select-all="true"` in select</p> |
56
- | **selectAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `select all` |
57
- | **resetAll**:boolean* | <p>default: **false**</p> Show button - `Reset all` <p>Or `data-simple-reset-all="true"` in select</p> |
58
- | **resetAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `Reset all` |
59
- | **isCloneClass**:boolean | <p>default: **true**</p> Clone class from native select to wrapper created select |
60
- | **isRemoveTop**:boolean* | <p>default: **false**</p> Do not create top element (Title, arrow, search ) (default: false) <p>Or `data-simple-remove-top="true"` in select</p> |
61
- | **isUp**:boolean* | <p>default: **false**</p> Dropdown rendering the direction in which to open the dropdown (default: false) <p>Or `data-simple-up="true"` in select</p> |
62
- | **isAlwaysOpen**:boolean* | <p>default: **false**</p> Dropdown always open (default: false) <p>Or `data-simple-always-open="true"` in select</p> |
63
- | **isAlwaysOpenShowDisabledTabindex**:boolean* | <p>default: **false**</p> Set tabindex (tabindex="0") for disabled element (In Always open list) |
64
- | **isOnlyPlaceholder**:boolean* | <p>default: **false**</p> Show only placeholder. Don't show selected options (default: false) <p>Or `data-simple-is-only-placeholder="true"` in select</p> |
65
- | **detectNative**:function | <p>default: **none**</p> Return `true` if need rendering native select |
66
- | **changeBodyLi**:function | <p>default: **none**</p> Custom <li>(body) item renderer |
67
- | **locale**:{key: string} | <p>default: **simpleSelectLocale** **</p> Object of locales. ** |
68
- | **historyMaxSize**: number | <p>default: **0** </p> Maximum number of saved changes. |
69
- | **isScrollToCheckedFirst**: boolean | <p>default: **true** </p> Scroll to the first element. This works only on the first opening. |
70
- | **isScrollToCheckedAlways**: boolean | <p>default: **false** </p> Scroll to the first element. This works on each opening. |
71
- | **isDebounceStatusBar**: boolean | <p>default: **false** </p> Status bar if multiselect has debounce. <p>Or `data-simple-debounce-status-bar="true"` in select</p> |
72
- | **isDebounceStatusBarBottom**: boolean | <p>default: **false** </p> Location of the bar status in the dropdown (default in the Top element) |
73
- | **isNeedFormatTitle**: boolean | <p>default: **false** </p> If you need to clear the line for the title |
74
- | **formatTitle**: function | <p>default: **none** </p> Custom Line Clearing Function for Title |
75
- | **addClasses**: string | <p>default: **''** </p> Add classes for wrapper SimpSelect. <p>Or `data-simple-add-classes="class1 class2"` in select</p> |
76
- | ***Options only DOM elements*** | |
77
- | **data-simple-placeholder="text": Select** | Replace default placeholder (locale.title) |
78
- | **data-simple-item-html-before="<div>before</div>: Select** | Add HTML before content (for item Li) |
79
- | **data-simple-item-html-after="<div>after</div>": Select** | Add HTML after content (for item Li) |
80
- | **data-simple-add-classes="class1 class2": Select** | Add classes for wrapper SimpSelect |
81
- | **data-simple-html-before="<span>before</span>": option** | Add HTML before content (for item Li) |
82
- | **data-simple-html-after="<span>after</span>": option** | Add HTML after content (for item Li) |
83
- | **data-simple-show-checkbox: Select** | Show checkbox in item (Li) (for single select) |
84
- | ***Callbacks*** | |
85
- | **callbackInitialization: (item:SimpleSelectItem) => void** | Before initialization |
86
- | **callbackInitialized**:(item:SimpleSelectItem) => void; | After initialization |
87
- | **callbackOpen**: (item:SimpleSelectItem) => void; | Open dropdown |
88
- | **callbackClose**: (item:SimpleSelectItem) => void; | Close dropdown |
89
- | **callbackDestroyInit**: (item:SimpleSelectItem) => void; | Before destroy SimpSelect |
90
- | **callbackDestroy**: (item:SimpleSelectItem) => void; | After destroy SimpSelect |
91
- | **callbackChangeSelect** :(e: Event, item:SimpleSelectItem) => void; | Change SimpSelect (change options) |
92
- | ***Methods*** | |
93
- | **reload**:select(DomElement).SimpSelect.reload() | Reload SimpSelect. |
94
- | **update**:select(DomElement).SimpSelect.update() | Update list (ul in dropdown) |
95
- | **detach**:select(DomElement).SimpSelect.detach() | Detach SimpSelect. |
96
- | **getHistory**:select(DomElement).SimpSelect.getHistory() | Get history. |
97
- | **getHistoryLast**:select(DomElement).SimpSelect.getHistoryLast() | Get history - last element. |
98
- | **getHistoryFirst**:select(DomElement).SimpSelect.getHistoryFirst() | Get history - first element. |
99
- | **getInstance**:select(DomElement).SimpSelect.getInstance() | Get instance SimpSelect. |
100
- | ***const simpleSelect = new SimpleSelect('select')*** | Instance of the SimpleSelect plugin object |
101
- | **getSelectById('ID')**:simpleSelect.getSelectById('ID') | Get item SimpSelect for ID (data-simple-select-init="ID" - dem element select) |
102
- | **getSelectFirst()**:simpleSelect.getSelectFirst() | Get first item SimpSelect |
103
- | **getSelects()**:simpleSelect.getSelects() | Get list SimpSelect |
104
- | **getSelects()**:simpleSelect.getSelects() | Get list SimpSelect |
42
+ | Property | Value |
43
+ |----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
44
+ | **selector**(required) | string(css selector), HTMLSelectElement, HTMLSelectElement(Array, HTMLSelectElement) |
45
+ | **OPTIONS:** | |
46
+ | **countShowSelected**:number* | <p>default: **3** </p> Show count selected options. If more then this count, showed template: Selected: 4<p>Or - `data-simple-count-shows-selected="3"` - in select |
47
+ | **isSearch**:boolean* | <p>default: **false** </p> Show input for filter items <p>Or - `data-simple-select-search="true"` - in select |
48
+ | **isSearchInDropdown**:boolean* | <p>default: **false** </p> Show search input inside dropdown <p>Or - `data-simple-select-search-dropdown="true"` - in select |
49
+ | **isConfirmInMulti**:boolean* | <p>default: **false** </p> Show buttons `OK` and `Cancel`. Only Multiselect <p>Or `data-simple-is-confirm="true" - in select`</p> |
50
+ | **isConfirmInMultiOkClickOutside**:boolean | <p>default: **false** </p> Click outside like click by button `OK`. Only if `isConfirmInMulti=true` |
51
+ | **nativeOnDevice**:string[] | <p>default: **'Android', 'BlackBerry', 'iPhone', 'iPad', 'iPod', 'Opera Mini', 'IEMobile', 'Silk'** </p> The system default select list is rendered on the matched device(Check useragent ). |
52
+ | **debounceTime**:number* | <p>default: **0** </p> The change event will not be triggered immediately, but after a specified amount of time. <p>Or `data-simple-debounce-time="1000"` in select |
53
+ | **floatWidth**:number* | <p>default: **767** </p> Minimum screen width of device below which the dropdown is rendered like popup. <p>Or `data-simple-float-width="500" in select. Or data-simple-float-none="true" - cancel for select` |
54
+ | **sepChars**:string | <p>default: **,** </p> Separator for selected element. Show |
55
+ | **selectAll**:boolean* | <p>default: **false**</p> Show button - `Select all` <p>Or `data-simple-select-all="true"` in select |
56
+ | **selectAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `select all` |
57
+ | **resetAll**:boolean* | <p>default: **false**</p> Show button - `Reset all` <p>Or `data-simple-reset-all="true"` in select |
58
+ | **resetAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `Reset all` |
59
+ | **isCloneClass**:boolean | <p>default: **true**</p> Clone class from native select to wrapper created select |
60
+ | **isRemoveTop**:boolean* | <p>default: **false**</p> Do not create top element (Title, arrow, search ) (default: false) <p>Or `data-simple-remove-top="true"` in select |
61
+ | **isUp**:boolean* | <p>default: **false**</p> Dropdown rendering the direction in which to open the dropdown (default: false) <p>Or `data-simple-up="true"` in select |
62
+ | **isAlwaysOpen**:boolean* | <p>default: **false**</p> Dropdown always open (default: false) <p>Or `data-simple-always-open="true"` in select |
63
+ | **isAlwaysOpenShowDisabledTabindex**:boolean* | <p>default: **false**</p> Set tabindex (tabindex="0") for disabled element (In Always open list) |
64
+ | **isOnlyPlaceholder**:boolean* | <p>default: **false**</p> Show only placeholder. Don't show selected options (default: false) <p>Or `data-simple-is-only-placeholder="true"` in select |
65
+ | **detectNative**:function | <p>default: **none**</p> Return `true` if need rendering native select |
66
+ | **changeBodyLi**:function | <p>default: **none**</p> Custom <li>(body) item renderer |
67
+ | **locale**:{key: string} | <p>default: **simpleSelectLocale** **</p> Object of locales. ** |
68
+ | **historyMaxSize**: number | <p>default: **0** </p> Maximum number of saved changes. |
69
+ | **isScrollToCheckedFirst**: boolean | <p>default: **true** </p> Scroll to the first element. This works only on the first opening. |
70
+ | **isScrollToCheckedAlways**: boolean | <p>default: **false** </p> Scroll to the first element. This works on each opening. |
71
+ | **isDebounceStatusBar**: boolean | <p>default: **false** </p> Status bar if multiselect has debounce. <p>Or `data-simple-debounce-status-bar="true"` in select |
72
+ | **isDebounceStatusBarBottom**: boolean | <p>default: **false** </p> Location of the bar status in the dropdown (default in the Top element) |
73
+ | **isNeedFormatTitle**: boolean | <p>default: **false** </p> If you need to clear the line for the title |
74
+ | **formatTitle**: function | <p>default: **none** </p> Custom Line Clearing Function for Title |
75
+ | **isSetAttributeSizeMultiple**: boolean | <p>default: **''** </p> Add classes for wrapper SimpSelect. <p>Or `data-simple-add-classes="class1 class2"` in select |
76
+ | **attributeSizeMultiple**: number | <p>default: **true** (If the attribute is not set for Select) </p> Set attribute "size" for seletct multiple |
77
+ | **addClasses**: string | <p>default: **1** </p> Value for attribute "size" for seletct multiple |
78
+ | ***Options only DOM elements*** | |
79
+ | **data-simple-placeholder="text": Select** | Replace default placeholder (locale.title) |
80
+ | **data-simple-item-html-before="<div>before</div>: Select** | Add HTML before content (for item Li) |
81
+ | **data-simple-item-html-after="<div>after</div>": Select** | Add HTML after content (for item Li) |
82
+ | **data-simple-add-classes="class1 class2": Select** | Add classes for wrapper SimpSelect |
83
+ | **data-simple-html-before="<span>before</span>": option** | Add HTML before content (for item Li) |
84
+ | **data-simple-html-after="<span>after</span>": option** | Add HTML after content (for item Li) |
85
+ | **data-simple-show-checkbox: Select** | Show checkbox in item (Li) (for single select) |
86
+ | ***Callbacks*** | |
87
+ | **callbackInitialization: (item:SimpleSelectItem) => void** | Before initialization |
88
+ | **callbackInitialized**:(item:SimpleSelectItem) => void; | After initialization |
89
+ | **callbackOpen**: (item:SimpleSelectItem) => void; | Open dropdown |
90
+ | **callbackClose**: (item:SimpleSelectItem) => void; | Close dropdown |
91
+ | **callbackDestroyInit**: (item:SimpleSelectItem) => void; | Before destroy SimpSelect |
92
+ | **callbackDestroy**: (item:SimpleSelectItem) => void; | After destroy SimpSelect |
93
+ | **callbackChangeSelect** :(e: Event, item:SimpleSelectItem) => void; | Change SimpSelect (change options) |
94
+ | ***Methods*** | |
95
+ | **reload**:select(DomElement).SimpSelect.reload() | Reload SimpSelect. |
96
+ | **update**:select(DomElement).SimpSelect.update() | Update list (ul in dropdown) |
97
+ | **detach**:select(DomElement).SimpSelect.detach() | Detach SimpSelect. |
98
+ | **getHistory**:select(DomElement).SimpSelect.getHistory() | Get history. |
99
+ | **getHistoryLast**:select(DomElement).SimpSelect.getHistoryLast() | Get history - last element. |
100
+ | **getHistoryFirst**:select(DomElement).SimpSelect.getHistoryFirst() | Get history - first element. |
101
+ | **getInstance**:select(DomElement).SimpSelect.getInstance() | Get instance SimpSelect. |
102
+ | ***const simpleSelect = new SimpleSelect('select')*** | Instance of the SimpleSelect plugin object |
103
+ | **getSelectById('ID')**:simpleSelect.getSelectById('ID') | Get item SimpSelect for ID (data-simple-select-init="ID" - dem element select) |
104
+ | **getSelectFirst()**:simpleSelect.getSelectFirst() | Get first item SimpSelect |
105
+ | **getSelects()**:simpleSelect.getSelects() | Get list SimpSelect |
106
+ | **getSelects()**:simpleSelect.getSelects() | Get list SimpSelect |
105
107
 
106
108
  **Data attributes in DOM element(select) more important than initialization options.*
107
109
  ```
@@ -22,7 +22,7 @@
22
22
  .item {
23
23
  display: block;
24
24
  width: 250px;
25
- }</style><body><div id="app"></div><label for="firstSelect">firstSelect</label><div class="items"><div class="item"><select id="firstSelect" data-simple-float-width="1000"><option value="">choose</option><option value="custom-1">custom&nbsp;float&nbsp;1</option><option value="custom-2">custom float 2</option></select></div></div><div class="items"><div class="item"><select multiple="multiple" placeholder="custom width float" data-simple-float-width="1000"><option value="custom-1">custom float 1</option><option value="custom-2">custom float 2</option></select></div><div class="item"><select multiple="multiple" data-simple-placeholder="none float" data-simple-float-none="true"><option value="custom-none-1">none float 1</option><option value="custom-none-2">none float 2</option></select></div><div class="item"><select id="select_first" data-simple-placeholder="Custom title" data-simple-is-only-placeholder="true" multiple="multiple"><option value="a1">a 1</option><option value="a2">a 2</option><option value="a3">a 3</option><option value="a4">a 4</option><option value="a5">a 5</option></select></div><div class="item"><select multiple="multiple" data-simple-placeholder="custom placeholder" data-simple-is-confirm="true" data-simple-count-shows-selected="3"><option value="a1" data-simple-html-before="<span>|before| </span>" data-simple-html-after="<span> |after|</div>">b 1</option><option value="a22" disabled="disabled">b 2 dis</option><option value="a3">b 3</option><option value="a4">b 4</option><option value="a5">b 5</option></select></div><div class="item"><select id="select_second" data-simple-is-confirm="false" data-simple-reset-all="false" data-simple-select-all="true" data-simple-debounce-status-bar="true" data-simple-item-html-before="<span>before</span>" multiple="multiple" data-simple-debounce-time="1000"><optgroup label="Группа 1"><option value="1.1">multiple Опция 1.1</option></optgroup><optgroup label="Группа 2"><option value="2.1">multiple Опция 2.1</option><option value="2.2">multiple Опция 2.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="3.1">multiple Опция 3.1</option><option value="3.2">multiple Опция 3.2</option><option value="3.3">multiple Опция 3.3</option></optgroup></select></div><div class="item"><select data-simple-select-search-dropdown="true" data-simple-show-checkbox="true" class="color_red" data-simple-add-classes="class1" data-simple-select-search="false"><option value="">Выбрать</option><optgroup label="Группа 1"><option value="1">Группа 1: Опция 1.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 2.1</option><option value="1">Опция 2.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 3.1</option><option value="1">Опция 3.2</option><option value="1">Опция 3.3</option></optgroup></select></div><div class="item"><select multiple="multiple" data-simple-select-search="true" data-simple-placeholder="multi and search"><option value="1">multi 1.1</option><option value="1">multi 2.1</option><option value="1">multi 2.2</option><option value="1">multi 3.1</option><option value="1">multi 3.2</option><option value="1">multi 3.3</option></select></div><div class="item"><select data-simple-add-classes="class1 class2" data-simple-item-html-before="<div>before</div>" data-simple-item-html-after="<div>after</div>" data-simple-select-search-dropdown="true" data-simple-up="true"><option>Опция 5.1</option><option>Опция 5.2</option></select></div><div class="item"><select multiple="multiple" data-simple-reset-all="true" data-simple-select-all="true" data-simple-is-confirm="true" data-simple-placeholder="Custom events" id="customEvents"><option value="custom-events-1">none events 1</option><option value="custom-events-2">none events 2</option><option value="custom-events-3">none events 2</option><option value="custom-events-4">none events 2</option></select></div></div><div><p>Group checkbox</p><div class="items"><label class="item"><select data-simple-select-search-dropdown="true" data-simple-show-checkbox="true" data-simple-always-open="true" class="color_red" data-simple-add-classes="class1" data-simple-select-search="false"><optgroup label="Группа 1"><option value="1">Опция 6.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 6.1</option><option value="1">Опция 6.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 6.1</option><option value="1">Опция 6.2</option><option value="1">Опция 6.3</option></optgroup></select></label> <label class="item"><select data-simple-select-search="true" data-simple-always-open="true" data-simple-select-all="true" data-simple-reset-all="true" multiple="multiple"><optgroup label="Группа 1"><option value="1">Опция 7.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 7.1</option><option value="1">Опция 7.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1" selected="selected">Опция 7.1</option><option value="1">Опция 7.2</option><option value="1">Опция 7.3</option></optgroup></select></label> <label class="item"><select data-simple-select-search-dropdown="true" data-simple-always-open="true" data-simple-remove-top="true" multiple="multiple"><optgroup label="Группа 1"><option value="1">Опция 8.1</option></optgroup><optgroup label="Группа 2"><option value="1" disabled="disabled">Опция 8.1</option><option value="1">Опция 8.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 8.1</option><option value="1">Опция 8.2</option><option value="1">Опция 8.3</option></optgroup></select></label></div></div><script>const $customEvents = document.getElementById('customEvents');
25
+ }</style><body><div id="app"></div><label for="firstSelect">firstSelect</label><div class="items"><div class="item"><select id="firstSelect" data-simple-float-width="1000"><option value="">choose</option><option value="custom-1">custom&nbsp;float&nbsp;1</option><option value="custom-2">custom float 2</option></select></div></div><div class="items"><div class="item"><select multiple="multiple" size="1" placeholder="custom width float" data-simple-float-width="1000"><option value="custom-1">custom float 1</option><option value="custom-2">custom float 2</option></select></div><div class="item"><select multiple="multiple" data-simple-placeholder="none float" data-simple-float-none="true"><option value="custom-none-1">none float 1</option><option value="custom-none-2">none float 2</option></select></div><div class="item"><select id="select_first" data-simple-placeholder="Custom title" data-simple-is-only-placeholder="true" multiple="multiple"><option value="a1">a 1</option><option value="a2">a 2</option><option value="a3">a 3</option><option value="a4">a 4</option><option value="a5">a 5</option></select></div><div class="item"><select multiple="multiple" data-simple-placeholder="custom placeholder" data-simple-is-confirm="true" data-simple-count-shows-selected="3"><option value="a1" data-simple-html-before="<span>|before| </span>" data-simple-html-after="<span> |after|</div>">b 1</option><option value="a22" disabled="disabled">b 2 dis</option><option value="a3">b 3</option><option value="a4">b 4</option><option value="a5">b 5</option></select></div><div class="item"><select id="select_second" data-simple-is-confirm="false" data-simple-reset-all="false" data-simple-select-all="true" data-simple-debounce-status-bar="true" data-simple-item-html-before="<span>before</span>" multiple="multiple" data-simple-debounce-time="1000"><optgroup label="Группа 1"><option value="1.1">multiple Опция 1.1</option></optgroup><optgroup label="Группа 2"><option value="2.1">multiple Опция 2.1</option><option value="2.2">multiple Опция 2.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="3.1">multiple Опция 3.1</option><option value="3.2">multiple Опция 3.2</option><option value="3.3">multiple Опция 3.3</option></optgroup></select></div><div class="item"><select data-simple-select-search-dropdown="true" data-simple-show-checkbox="true" class="color_red" data-simple-add-classes="class1" data-simple-select-search="false"><option value="">Выбрать</option><optgroup label="Группа 1"><option value="1">Группа 1: Опция 1.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 2.1</option><option value="1">Опция 2.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 3.1</option><option value="1">Опция 3.2</option><option value="1">Опция 3.3</option></optgroup></select></div><div class="item"><select multiple="multiple" data-simple-select-search="true" data-simple-placeholder="multi and search"><option value="1">multi 1.1</option><option value="1">multi 2.1</option><option value="1">multi 2.2</option><option value="1">multi 3.1</option><option value="1">multi 3.2</option><option value="1">multi 3.3</option></select></div><div class="item"><select data-simple-add-classes="class1 class2" data-simple-item-html-before="<div>before</div>" data-simple-item-html-after="<div>after</div>" data-simple-select-search-dropdown="true" data-simple-up="true"><option>Опция 5.1</option><option>Опция 5.2</option></select></div><div class="item"><select multiple="multiple" data-simple-reset-all="true" data-simple-select-all="true" data-simple-is-confirm="true" data-simple-placeholder="Custom events" id="customEvents"><option value="custom-events-1">none events 1</option><option value="custom-events-2">none events 2</option><option value="custom-events-3">none events 2</option><option value="custom-events-4">none events 2</option></select></div></div><div><p>Group checkbox</p><div class="items"><label class="item"><select data-simple-select-search-dropdown="true" data-simple-show-checkbox="true" data-simple-always-open="true" class="color_red" data-simple-add-classes="class1" data-simple-select-search="false"><optgroup label="Группа 1"><option value="1">Опция 6.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 6.1</option><option value="1">Опция 6.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 6.1</option><option value="1">Опция 6.2</option><option value="1">Опция 6.3</option></optgroup></select></label> <label class="item"><select data-simple-select-search="true" data-simple-always-open="true" data-simple-select-all="true" data-simple-reset-all="true" multiple="multiple"><optgroup label="Группа 1"><option value="1">Опция 7.1</option></optgroup><optgroup label="Группа 2"><option value="1">Опция 7.1</option><option value="1">Опция 7.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1" selected="selected">Опция 7.1</option><option value="1">Опция 7.2</option><option value="1">Опция 7.3</option></optgroup></select></label> <label class="item"><select data-simple-select-search-dropdown="true" data-simple-always-open="true" data-simple-remove-top="true" multiple="multiple"><optgroup label="Группа 1"><option value="1">Опция 8.1</option></optgroup><optgroup label="Группа 2"><option value="1" disabled="disabled">Опция 8.1</option><option value="1">Опция 8.2</option></optgroup><optgroup label="Группа 3" disabled="disabled"><option value="1">Опция 8.1</option><option value="1">Опция 8.2</option><option value="1">Опция 8.3</option></optgroup></select></label></div></div><script>const $customEvents = document.getElementById('customEvents');
26
26
  $customEvents.addEventListener('change', (e) => {
27
27
  console.log('change', e);
28
28
  });
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("SimpleSelect",[],t):"object"==typeof exports?exports.SimpleSelect=t():e.SimpleSelect=t()}("undefined"==typeof self?this:self,(function(){return function(){"use strict";var e={737:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.initClass=t.nameMark=t.nameSelect=t.simpleSelectionOptions=t.simpleSelectLocale=void 0,t.simpleSelectLocale={noSearch:"No matches for",searchText:"Search",title:"Select",selected:"Selected:",all:"all",ok:"Ok",cancel:"Cancel",selectAll:"Select all",resetAll:"Reset all"},t.simpleSelectionOptions={isSearch:!1,searchTypeInput:"search",isSearchInDropdown:!1,countShowSelected:3,isOnlyPlaceholder:!1,historyMaxSize:0,isRemoveTop:!1,isConfirmInMulti:!1,isConfirmInMultiOkClickOutside:!1,nativeOnDevice:["Android","BlackBerry","iPhone","iPad","iPod","Opera Mini","IEMobile","Silk"],locale:t.simpleSelectLocale,sepChars:",",isUp:!1,isAlwaysOpen:!1,isAlwaysOpenShowDisabledTabindex:!1,floatWidth:767,isCloneClass:!0,selectAll:!1,selectAllAfterClose:!0,resetAll:!1,resetAllAfterClose:!0,isScrollToCheckedFirst:!0,isScrollToCheckedAlways:!1},t.nameSelect="SimpSelect";t.nameMark="".concat("simple-select-","init"),t.initClass="SimpleSel"},874:function(e,t,i){function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function n(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,u(s.key),s)}}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=c(e);if(t){var o=c(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}(this,i)}}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(){return r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(s){var n=Object.getOwnPropertyDescriptor(s,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},r.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function h(e,t,i){return(t=u(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleSelectItem=void 0;var p=i(679),d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(d,e);var t,i,s,u=l(d);function d(e,t,i){var s,n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),h(a(n=u.call(this,e,t,i)),"closeOutsideHandler",void 0),h(a(n),"closeEscHandler",void 0),h(a(n),"changeListener",void 0),h(a(n),"selectKeyDownListener",void 0),h(a(n),"searchHandler",void 0),h(a(n),"handleResize",void 0),h(a(n),"mql",null),h(a(n),"isInitialized",!1),h(a(n),"isFirstOpen",!1),h(a(n),"countOpen",0),h(a(n),"timeoutDebounceId",null),h(a(n),"history",[]),!e)throw Error("Select is required");return n.init(),r((s=a(n),c(d.prototype)),"initDom",s).call(s),n.initAfterDom(),setTimeout((function(){n.isInitialized=!0,(0,p.triggerCustomEvent)(n.$select,"initialized",{item:a(n)})}),10),n}return t=d,i=[{key:"init",value:function(){var e=this;this.changeListener=this.changeListenerInit.bind(this),this.selectKeyDownListener=this.selectKeyDownInit.bind(this),this.$select.addEventListener("change",this.changeListener),this.$select.addEventListener("keydown",this.selectKeyDownListener),this.searchHandler=this.searchHandlerInit.bind(this),this.closeOutsideHandler=this.closeOutsideHandlerInit.bind(this),this.closeEscHandler=this.closeEscHandlerInit.bind(this),this.handleResize=this.handleResizeInit.bind(this),this.options.callbackInitialization&&this.options.callbackInitialization(this),!this.isNative&&this.options.floatWidth&&(this.mql=window.matchMedia("screen and (max-width: ".concat(this.options.floatWidth,"px)")),this.mql&&(this.mql.onchange=this.handleResize,this.handleResizeInit(this.mql))),this.state.subscribe("isOpen",(function(t){if(t&&e.elemListBody){var i=e.options,s=i.isScrollToCheckedFirst,n=i.isScrollToCheckedAlways;e.isFirstOpen||!s||n||e.scrollToFirstChecked(),n&&e.scrollToFirstChecked()}t&&!e.isFirstOpen&&(e.isFirstOpen=!0),e.isInitialized&&(0,p.triggerCustomEvent)(e.$select,"".concat(t?"open":"close",".before"),{item:e}),e.toggleOpenHandler(),!t&&e.options.isConfirmInMulti&&e.createList(),t||e.elemInputSearch&&(e.elemInputSearch.value="",e.state.setState("filterStr","")),e.isInitialized&&(0,p.triggerCustomEvent)(e.$select,"".concat(t?"open":"close",".after"),{item:e})})),this.isNative||this.options.isAlwaysOpen||(this.elemTopBody.onclick=this.clickToggleOpen.bind(this),this.elemTopBody.onkeyup=this.clickToggleOpen.bind(this))}},{key:"scrollToFirstChecked",value:function(){if(this.elemListBody&&this.elemDropDownWrap){var e=this.elemListBody.querySelector('[data-sel-opt-checked="true"]');e&&(this.elemDropDownWrap.scrollTop=e.offsetTop)}}},{key:"handleResizeInit",value:function(e){e&&(e.matches?this.state.setState("isFloat",!0):this.state.setState("isFloat",!1))}},{key:"initAfterDom",value:function(){var e=this;this.confirmOk&&(this.confirmOk.onclick=this.confirmOkHandler.bind(this)),this.confirmNo&&(this.confirmNo.onclick=this.confirmNoHandler.bind(this)),this.options.callbackInitialized&&this.options.callbackInitialized(this),this.multiDebounceTime&&(this.multiDebounceChange=this.debounce(this.multiDebounceChange.bind(this),this.multiDebounceTime)),this.elemSelectAll&&(this.elemSelectAll.onclick=this.selectAllHandler.bind(this)),this.elemResetAll&&(this.elemResetAll.onclick=this.resetAllHandler.bind(this)),this.elemDropDownClose&&(this.elemDropDownClose.onclick=this.closeHandler.bind(this)),this.elemListBody&&this.elemListBody.addEventListener("keyup",(function(t){if("Enter"===t.key){var i=t.target;if(i&&(0,p.toCamelCase)("sel-opt-item")in i.dataset){t.preventDefault(),t.stopPropagation(),e.changeClickItem(i);var s=i.dataset[(0,p.toCamelCase)("sel-position")],n=e.elemListBody.querySelector('[data-sel-position="'.concat(s,'"]'));n&&n.focus()}}}))}},{key:"debounce",value:function(e,t){var i=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.timeoutDebounceId&&clearTimeout(i.timeoutDebounceId),i.timeoutDebounceId=setTimeout((function(){e.apply(void 0,n),i.timeoutDebounceId=null}),t)}}},{key:"confirmOkHandler",value:function(e){e.preventDefault(),this.confirmOkBuild()}},{key:"confirmOkBuild",value:function(){var e=this,t=this.$select.options;this.elemListBody&&(this.elemListBody.querySelectorAll("[data-sel-position]").forEach((function(i){var s=parseInt(i.dataset[(0,p.toCamelCase)("sel-position")],10);if(s||0===s){var n=t[s],o=n.disabled||"true"===i.getAttribute("data-sel-opt-disabled");if(n&&!o){var l="true"===i.dataset[(0,p.toCamelCase)("sel-opt-checked")];l!==n.selected&&e.addHistory(n,l),n.selected=l}}})),this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"multiConfirm",{item:this}))}},{key:"confirmNoHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1),(0,p.triggerCustomEvent)(this.$select,"multiCancel",{item:this})}},{key:"closeHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1)}},{key:"selectAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){var t,i=e.disabled;null!==(t=e.closest("optgroup"))&&void 0!==t&&t.disabled&&(i=!0),i||(e.selected=!0)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"selectAll",{item:this})}},{key:"resetAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){var t,i=e.disabled;null!==(t=e.closest("optgroup"))&&void 0!==t&&t.disabled&&(i=!0),i||(e.selected=!1)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"resetAll",{item:this})}},{key:"triggerSetup",value:function(e){if(0===e.button){var t=e.target.closest("li");t&&this.changeClickItem(t)}}},{key:"changeClickItemDom",value:function(e){var t=e.closest("[data-simple-select-gruop]");if("true"===e.dataset[(0,p.toCamelCase)("sel-opt-checked")]){if(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="false",e.classList.remove("SimpleSel__list_item--checked"),t){var i=Number(t.getAttribute("data-count-checked"))||1;t.setAttribute("data-count-checked",(i-1).toString())}}else if(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="true",e.classList.add("SimpleSel__list_item--checked"),t){var s=Number(t.getAttribute("data-count-checked"))||0;t.setAttribute("data-count-checked",(s+1).toString())}}},{key:"addHistory",value:function(e,t){this.options.historyMaxSize>0&&(this.history.push({value:e.value,text:e.innerHTML,selected:t,indexOption:e.index}),this.history.length>this.options.historyMaxSize&&(this.history=this.history.slice(this.history.length-this.options.historyMaxSize)),(0,p.triggerCustomEvent)(this.$select,"updateHistory",{item:this,history:this.history}))}},{key:"changeClickItem",value:function(e){if(e){var t=Number(e.dataset[(0,p.toCamelCase)("sel-position")])||0,i=this.$select.options[t],s=i.disabled||"true"===e.getAttribute("data-sel-opt-disabled");if(i&&!s)if(this.isMulti)if(this.options.isConfirmInMulti||this.isFloatWidth)this.changeClickItemDom(e);else{var n=!i.selected;i.selected=n,this.addHistory(i,n),this.changeClickItemDom(e),this.createList(),this.multiDebounceChangeAnimation(!0),this.multiDebounceChange()}else i.selected=!0,this.addHistory(i,!0),this.createList(),this.state.setState("isOpen",!1),this.triggerInit()}}},{key:"multiDebounceChange",value:function(){this.triggerInit()}},{key:"multiDebounceChangeAnimation",value:function(e){this.isDebounceStatusBar&&this.elemDebounceProgressBar&&(this.elemDebounceProgressBar.classList.remove("this--animating"),this.elemDebounceProgressBar.style.setProperty("--duration","0ms"),this.elemDebounceProgressBar.offsetWidth,e&&(this.elemDebounceProgressBar.style.setProperty("--duration","".concat(this.multiDebounceTime,"ms")),this.elemDebounceProgressBar.classList.add("this--animating")))}},{key:"triggerInit",value:function(){this.multiDebounceChangeAnimation(!1),(0,p.triggerInputEvent)(this.$select)}},{key:"clickToggleOpen",value:function(e){e.preventDefault(),this.isDisabled||("click"!==e.type?e instanceof KeyboardEvent&&"Enter"===e.key&&this.state.setState("isOpen",!this.state.getState("isOpen")):this.state.setState("isOpen",!this.state.getState("isOpen")))}},{key:"closeOutsideHandlerInit",value:function(e){var t=e.target;t&&(this.elemWrap.contains(t)||(this.options.isConfirmInMulti&&this.options.isConfirmInMultiOkClickOutside&&this.confirmOkBuild(),this.state.setState("isOpen",!1)))}},{key:"closeEscHandlerInit",value:function(e){"Escape"===e.code&&(e.preventDefault(),e.stopPropagation(),this.state.setState("isOpen",!1)),"Tab"===e.code&&(e.preventDefault(),e.stopPropagation(),this.elemWrap.contains(e.target)||this.state.setState("isOpen",!1)),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),e.stopPropagation(),this.keyBoardChangeChecked("ArrowDown"===e.key))}},{key:"keyBoardChangeChecked",value:function(e){var t=this.elemListBody.querySelectorAll('[data-sel-position]:not([data-sel-opt-disabled="true"])');if(t.length){var i,s=0;t.forEach((function(e,t){document.activeElement===e&&(s=t,i=e),e.removeAttribute("tabindex")})),(i=i?e?t[s+1]||t[0]:t[s-1]||t[t.length-1]:e?t[0]:t[t.length-1]).tabIndex=0,i.focus()}}},{key:"searchHandlerInit",value:function(e){var t=e.target;if(t){var i=t.value;this.state.setState("filterStr",i)}}},{key:"toggleOpen",value:function(){var e=this.state.getState("isOpen");this.state.setState("isOpen",!e)}},{key:"toggleOpenHandler",value:function(){var e=this;this.state.getState("isOpen")?(this.elemWrap.classList.add("SimpleSel--open"),document.addEventListener("click",this.closeOutsideHandler),document.addEventListener("keyup",this.closeEscHandler),this.elemInputSearch&&setTimeout((function(){e.elemInputSearch.focus()}),50),this.options.callbackOpen&&this.options.callbackOpen(this),this.countOpen++,this.elemDropDown&&setTimeout((function(){e.elemDropDown.scrollTop=0}),10)):(this.state.setState("filterList",""),this.elemWrap.classList.remove("SimpleSel--open"),document.removeEventListener("click",this.closeOutsideHandler),document.removeEventListener("keyup",this.closeEscHandler),this.timeoutDebounceId&&(clearTimeout(this.timeoutDebounceId),this.timeoutDebounceId=null,this.multiDebounceChangeAnimation(!1),this.triggerInit()),this.options.callbackClose&&this.countOpen>0&&this.options.callbackClose(this))}},{key:"changeListenerInit",value:function(e){this.options.callbackChangeSelect&&this.options.callbackChangeSelect(e,this),this.createList(!0)}},{key:"selectKeyDownInit",value:function(e){this.isNative||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}},{key:"getSelect",value:function(){return this.$select}},{key:"handlerChangeChecked",value:function(){this.elemListBody&&(this.elemListBody.onmouseup=this.triggerSetup.bind(this))}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[],i=this.$select.querySelectorAll("optgroup");if(i&&i.length?this.$select.querySelectorAll(":scope > *").forEach((function(e,i){var s=e instanceof HTMLOptGroupElement;t.push((0,p.getCreateListItem)(e,(i+1).toString(),s))})):t.push((0,p.getCreateListItem)(this.$select,"1",!1)),e){var s=this.state.getState("items");(0,p.compareObj)(s,t)||this.state.setState("items",t)}else this.state.setState("items",t)}},{key:"inputSearchHandler",value:function(){this.elemInputSearch&&this.elemInputSearch.addEventListener("input",this.searchHandler)}},{key:"detachItem",value:function(){this.options.callbackDestroyInit&&this.options.callbackDestroyInit(this);var e=this.elemWrap.parentNode;this.$select.removeEventListener("change",this.changeListener),this.elemInputSearch&&this.elemInputSearch.removeEventListener("input",this.searchHandler),this.confirmOk&&(this.confirmOk.onclick=null),this.confirmNo&&(this.confirmNo.onclick=null),e.replaceChild(this.$select,this.elemWrap),this.$select.classList.remove(this.classSelectInit),this.elemTopBody&&(this.elemTopBody.onclick=null,this.elemTopBody.onkeyup=null),this.elemListBody&&(this.elemListBody.onmouseup=null),this.elemSelectAll&&(this.elemSelectAll.onclick=null),this.elemResetAll&&(this.elemResetAll.onclick=null),this.options.callbackDestroy&&this.options.callbackDestroy(this),this.elemDropDownClose&&(this.elemDropDownClose.onclick=null),this.mql&&(this.mql.onchange=null,this.mql=null)}}],i&&n(t.prototype,i),s&&n(t,s),Object.defineProperty(t,"prototype",{writable:!1}),d}(i(844).SimpleSelectItemDOM);t.SimpleSelectItem=d},844:function(e,t,i){function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i<t;i++)s[i]=e[i];return s}function l(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,r(s.key),s)}}function a(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleSelectItemDOM=void 0;var c=i(679),h=i(972),u=i(737),p=function(){function e(t,i,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"options",void 0),a(this,"$select",void 0),a(this,"id",void 0),a(this,"titlePlaceholder",void 0),a(this,"isDisabled",!1),a(this,"isMulti",void 0),a(this,"state",(0,h.store)({items:[],isOpen:!1,filterStr:"",isFloat:!1})),a(this,"classSelectInit",(0,c.getClass)("select_init")),a(this,"isNative",void 0),a(this,"elemWrap",document.createElement("div")),a(this,"elemTop",document.createElement("div")),a(this,"elemTopBody",document.createElement("div")),a(this,"elemDropDownWrap",null),a(this,"elemDropDown",null),a(this,"elemDropDownClose",null),a(this,"elemListBody",null),a(this,"elemInputSearch",null),a(this,"elemTitle",void 0),a(this,"confirmWrap",null),a(this,"confirmOk",null),a(this,"confirmNo",null),a(this,"elemControl",null),a(this,"elemSelectAll",null),a(this,"elemResetAll",null),a(this,"elemDebounceProgressBar",null),a(this,"cloneClasses",""),a(this,"isShowCheckbox",!1),a(this,"bodyLiHTMLBeforeFromSelect",null),a(this,"bodyLiHTMLAfterFromSelect",null),a(this,"isFloatWidth",!1),a(this,"bodyOpenClass","".concat(u.initClass,"--body_open")),a(this,"multiDebounceTime",0),a(this,"isDebounceStatusBar",!1);var n=s.id,o=s.isNative;this.$select=t,this.isMulti=t.multiple,this.id=n,this.isNative=o,this.options=(0,c.cloneObj)(i),this.options.isDebounceStatusBar&&(this.isDebounceStatusBar=this.options.isDebounceStatusBar),this.options.isCloneClass&&(this.cloneClasses=this.$select.className),i.callbackInitialization&&(this.options.callbackInitialization=i.callbackInitialization),i.callbackInitialized&&(this.options.callbackInitialized=i.callbackInitialized),i.callbackOpen&&(this.options.callbackOpen=i.callbackOpen),i.callbackClose&&(this.options.callbackClose=i.callbackClose),i.callbackDestroyInit&&(this.options.callbackDestroyInit=i.callbackDestroyInit),i.callbackDestroy&&(this.options.callbackDestroy=i.callbackDestroy),i.callbackChangeSelect&&(this.options.callbackChangeSelect=i.callbackChangeSelect),i.changeBodyLi&&(this.options.changeBodyLi=i.changeBodyLi),i.formatTitle&&(this.options.formatTitle=i.formatTitle),this.isMulti&&this.$select.hasAttribute("data-simple-is-confirm")&&(this.options.isConfirmInMulti=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-is-confirm"))),this.optionOverride(),this.isDisabled=this.$select.disabled}var t,i,s;return t=e,i=[{key:"optionOverride",value:function(){var e=(0,c.toCamelCase)("simple-placeholder"),t=this.$select.dataset[e],i=this.$select.getAttribute("placeholder"),s=null==i?void 0:i.trim();if(this.titlePlaceholder=t?t||"":s||this.options.locale.title,this.$select.hasAttribute("data-simple-debounce-status-bar")&&(this.isDebounceStatusBar=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-debounce-status-bar"))),this.$select.hasAttribute("data-simple-reset-all")&&(this.options.resetAll=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-reset-all"))),this.$select.hasAttribute("data-simple-select-all")){var n=this.$select.getAttribute("data-simple-select-all");this.options.selectAll=(0,c.ifTrueDataAttr)(n)}var o=this.$select.dataset[(0,c.toCamelCase)("simple-show-checkbox")];this.isMulti?this.isShowCheckbox=!(o&&!(0,c.ifTrueDataAttr)(o)):"true"===o&&(this.isShowCheckbox=!0);var l=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-before")];l&&(this.bodyLiHTMLBeforeFromSelect=l);var a=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-after")];if(a&&(this.bodyLiHTMLAfterFromSelect=a),this.$select.hasAttribute("data-simple-up")&&(this.options.isUp=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-up"))),this.$select.hasAttribute("data-simple-is-only-placeholder")&&(this.options.isOnlyPlaceholder=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-is-only-placeholder"))),this.$select.hasAttribute("data-simple-remove-top")&&(this.options.isRemoveTop=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-remove-top"))),this.$select.hasAttribute("data-simple-float-none")&&(this.isFloatWidth=!1,this.options.floatWidth=0),this.$select.hasAttribute("data-simple-float-width")){var r=Number(this.$select.dataset[(0,c.toCamelCase)("simple-float-width")]);r&&(this.options.floatWidth=r)}this.$select.hasAttribute("data-simple-always-open")&&(this.options.isAlwaysOpen=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-always-open")),this.isNative=!1,this.isFloatWidth=!1,this.options.floatWidth=0),this.isMulti&&!this.options.isConfirmInMulti&&((0,c.toCamelCase)("simple-debounce-time")in this.$select.dataset?this.multiDebounceTime=Number(this.$select.dataset[(0,c.toCamelCase)("simple-debounce-time")]):(this.options.debounceTime||0===this.options.debounceTime)&&(this.multiDebounceTime=this.options.debounceTime))}},{key:"initDom",value:function(){var e=this;this.createList(!1),this.createHTML(),this.state.subscribe("filterStr",(function(t){e.createListHTML(!0)})),this.state.subscribe("items",(function(t){e.createListHTML(!0),e.createTitleHTML()})),this.state.subscribe("isOpen",(function(t){e.createListHTML(!1),e.createTitleHTML(),e.toggleTabIndex(t)})),this.state.subscribe("isFloat",(function(t){e.isFloatWidth=t;var i=(0,c.getClass)("float",!0);t?(e.elemWrap.classList.add(i),!document.body.classList.contains(e.bodyOpenClass)&&e.state.getState("isOpen")&&document.body.classList.add(e.bodyOpenClass)):(e.elemWrap.classList.remove(i),document.body.classList.contains(e.bodyOpenClass)&&document.body.classList.remove(e.bodyOpenClass))}))}},{key:"toggleTabIndex",value:function(e){var t=e||this.options.isAlwaysOpen?0:-1;this.state.getState("isFloat")&&(e?document.body.classList.add(this.bodyOpenClass):document.body.classList.remove(this.bodyOpenClass)),this.elemInputSearch&&(this.elemInputSearch.tabIndex=t),this.elemResetAll&&(this.elemResetAll.tabIndex=t),this.elemSelectAll&&(this.elemSelectAll.tabIndex=t),this.confirmOk&&(this.confirmOk.tabIndex=t),this.confirmNo&&(this.confirmNo.tabIndex=t)}},{key:"updateHTML",value:function(){this.createList(!0)}},{key:"createHTML",value:function(){this.$select.classList.add(this.classSelectInit),this.$select.tabIndex=-1,this.elemTopBody.className=(0,c.getClass)("top_body"),this.elemTopBody.tabIndex=this.isDisabled?-1:0,this.createIcon(),this.options.isRemoveTop||this.elemTop.appendChild(this.elemTopBody);var e=u.initClass;this.options.isCloneClass&&(e+=" ".concat(this.cloneClasses)),this.options.addClasses&&(e+=" ".concat(this.options.addClasses)),this.$select.hasAttribute("data-simple-add-classes")&&(e+=" ".concat(this.$select.getAttribute("data-simple-add-classes"))),this.isDisabled&&(e+=" ".concat((0,c.getClass)("disabled",!0))),this.options.isAlwaysOpen&&(e+=" ".concat((0,c.getClass)("always_open",!0))),this.options.isUp&&(e+=" ".concat((0,c.getClass)("up",!0))),e+=" ".concat(this.isMulti?(0,c.getClass)("multi",!0):(0,c.getClass)("single",!0)),this.elemWrap.className=e,this.elemWrap.dataset.countAll=this.$select.options.length.toString(),this.elemTop.className=(0,c.getClass)("top");var t=this.$select.parentNode;t&&(t.replaceChild(this.elemWrap,this.$select),this.elemWrap.appendChild(this.$select)),this.elemWrap.appendChild(this.elemTop),this.isNative?(this.$select.classList.add((0,c.getClass)("native",!0,this.classSelectInit)),this.elemWrap.classList.add((0,c.getClass)("native",!0))):(this.createDropDown(),this.createControlHTML(),this.createInputHTML()),this.createTitleHTML()}},{key:"createControlHTML",value:function(){if(this.elemDropDown&&this.isMulti&&(this.options.selectAll||this.options.resetAll)){this.elemControl=document.createElement("div"),this.elemControl.classList.add((0,c.getClass)("controls")),this.elemDropDown.insertBefore(this.elemControl,this.elemDropDown.childNodes[0]);var e=(0,c.getClass)("control");this.options.selectAll&&(this.elemSelectAll=(0,c.createButton)(),this.elemSelectAll.className="".concat(e," ").concat((0,c.getClass)("select_all",!0,e)),this.elemSelectAll.innerHTML='<span class="'.concat((0,c.getClass)("select_all__icon"),'"></span> ').concat(this.options.locale.selectAll),this.elemControl.appendChild(this.elemSelectAll)),this.options.resetAll&&(this.elemResetAll=(0,c.createButton)(),this.elemResetAll.className="".concat(e," ").concat((0,c.getClass)("reset_all",!0,e)),this.elemResetAll.innerHTML='<span class="'.concat((0,c.getClass)("reset_all__icon"),'"></span> ').concat(this.options.locale.resetAll),this.elemControl.appendChild(this.elemResetAll))}}},{key:"createIcon",value:function(){var e=document.createElement("span");e.className=(0,c.getClass)("icon"),this.elemTopBody.appendChild(e)}},{key:"createDropDown",value:function(){this.isNative||(this.elemDropDownWrap=document.createElement("div"),this.elemDropDownWrap.className=(0,c.getClass)("body"),this.options.isAlwaysOpen&&this.elemDropDownWrap.classList.add((0,c.getClass)("body-always_open",!0)),this.elemDropDown=document.createElement("div"),this.elemDropDown.className=(0,c.getClass)("body_wrap"),this.elemListBody=document.createElement("ul"),this.elemListBody.className=(0,c.getClass)("list"),this.isMulti&&this.isDebounceStatusBar&&this.multiDebounceTime&&(this.elemDebounceProgressBar=document.createElement("div"),this.elemDebounceProgressBar.className=(0,c.getClass)("debounce_progress_bar"),this.options.isDebounceStatusBarBottom?this.elemDropDown.append(this.elemDebounceProgressBar):this.elemTop.append(this.elemDebounceProgressBar)),this.elemDropDownWrap.append(this.elemDropDown),this.elemWrap.appendChild(this.elemDropDownWrap),this.elemDropDown.appendChild(this.elemListBody),this.elemDropDownClose=(0,c.createButton)(),this.elemDropDownClose.classList.add((0,c.getClass)("close")),this.elemDropDown.appendChild(this.elemDropDownClose),this.isMulti&&this.createIsConfirmInMultiHTML(),this.handlerChangeChecked())}},{key:"createIsConfirmInMultiHTML",value:function(){var e;this.confirmWrap=document.createElement("div");var t=(0,c.getClass)("bottom_control");this.confirmOk=(0,c.createButton)(),this.confirmNo=(0,c.createButton)(),this.confirmWrap.appendChild(this.confirmOk),this.confirmWrap.appendChild(this.confirmNo),this.confirmOk.innerHTML=this.options.locale.ok,this.confirmNo.innerHTML=this.options.locale.cancel,this.confirmOk.className="".concat(t," ").concat((0,c.getClass)("ok",!0,t)),this.confirmNo.className="".concat(t," ").concat((0,c.getClass)("no",!0,t));var i=(0,c.getClass)("bottom_controls");this.options.isConfirmInMulti||(i+=" ".concat((0,c.getClass)("hide",!0,i))),this.confirmWrap.className=i,null===(e=this.elemDropDown)||void 0===e||e.appendChild(this.confirmWrap)}},{key:"createTitleHTML",value:function(){var e=this;if(!this.options.isRemoveTop){if(!this.elemTitle){this.elemTitle=document.createElement("div");var t=(0,c.getClass)("title");this.options.isOnlyPlaceholder&&(t+=" ".concat((0,c.getClass)("only-placeholder",!0,t))),this.elemTitle.className=t,this.elemTopBody.insertBefore(this.elemTitle,this.elemTopBody.childNodes[0])}var i=this.getChecked();this.elemTop.title="";var s=!i.length,n=!!i.filter((function(e){return e.value})).length,o=this.titlePlaceholder;if(i.length&&!this.options.isOnlyPlaceholder){var l="",a="";i.forEach((function(t,i){0!==i&&(l+="".concat(e.options.sepChars,'<span class="').concat((0,c.getClass)("sep_space",!0),'">&nbsp;</span>'),a+="".concat(e.options.sepChars," ")),l+="".concat(t.title),a+="".concat(t.title)})),this.options.formatTitle?a=this.options.formatTitle(a):this.options.isNeedFormatTitle&&(a=(0,c.decodeHtmlEntities)(a)),this.elemTop.title=a;var r=this.options.countShowSelected,h=Number(this.$select.dataset.simpleCountShowsSelected);h&&h>0&&(r=h),i.length>r?(o="".concat(this.options.locale.selected," ").concat(i.length),this.$select.querySelectorAll("option").length===i.length&&(o+=" (".concat(this.options.locale.all,")"))):l&&(o=l)}this.elemTitle.innerHTML=o;var u=(0,c.getClass)("fill_with_value",!0);n?this.elemWrap.classList.add(u):this.elemWrap.classList.remove(u),s?(this.elemTitle.classList.add("SimpleSel__title--placeholder"),this.elemTitle.classList.remove("SimpleSel__title--fill"),this.elemWrap.classList.remove((0,c.getClass)("fill",!0))):(this.elemTitle.classList.remove("SimpleSel__title--placeholder"),this.elemTitle.classList.add("SimpleSel__title--fill"),this.elemWrap.classList.add((0,c.getClass)("fill",!0)))}}},{key:"filterList",value:function(){var e=this.state.getState("filterStr"),t=this.state.getState("items");if(!e)return t;e=e.toLowerCase();var i=(0,c.cloneObj)(t);return i.forEach((function(t){var i=!1;t.items.forEach((function(t){t.title.toLowerCase().indexOf(e)>=0?(i=!0,t.isShowFilter=!0):t.isShowFilter=!1})),t.isShowFilter=i})),i}},{key:"createListHTML",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.elemListBody){var i="",s=0,n=0,o=0,l=t?this.filterList():this.state.getState("items"),a=[];l.forEach((function(t){if(t.items.forEach((function(e){a.push({value:e.value,checked:e.checked,disabled:e.disabled||!!t.isDisabledGroup,isShowFilter:e.isShowFilter})})),t.isGroup){var l=e.createLi(t),r=l.result,h=l.countShow,u=l.countChecked,p=l.countCheckedFull,d='data-count-show="'.concat(h,'" ');d+='data-count-checked="'.concat(u,'" ');var m=(0,c.getClass)("group_items");t.isDisabledGroup&&(m+=" ".concat((0,c.getClass)("disabled",!0,m))),i+='<div class="'.concat(m,'" ').concat(d," data-simple-select-gruop>"),i+=r,i+="</div>",n+=u,s+=h,o+=p}else{var f=e.createLi(t),b=f.result,v=f.countShow,y=f.countChecked,g=f.countCheckedFull;i+=b,s+=v,n+=y,o+=g}}));var r=this.state.getState("filterStr");r&&r.length&&0===s&&(i='<div class="'.concat((0,c.getClass)("no_match"),'">'),i="".concat(this.options.locale.noSearch,' "').concat(r,'"'),i+="</div>"),this.elemWrap.dataset.countChecked=n.toString(),this.elemWrap.dataset.countCheckedFull=o.toString(),this.isMulti&&(this.elemWrap.dataset.checkAllMulti=this.$select.options.length===n?"yes":"no"),i=(0,c.removeExtraSpaces)(i);var h=[];this.elemListBody.querySelectorAll("[data-sel-opt-item]").forEach((function(e){h.push({value:e.getAttribute("data-sel-value"),checked:"true"===e.getAttribute("data-sel-opt-checked"),disabled:"true"===e.getAttribute("data-sel-opt-disabled")})})),(0,c.compareObj)(a,h)||(this.elemListBody.innerHTML=i,(0,c.triggerCustomEvent)(this.$select,"createListBuild",{item:this}))}}},{key:"createInputHTML",value:function(){var e=this.options.isSearch,t=this.options.isSearchInDropdown;if("simpleSelectSearch"in this.$select.dataset&&(e="false"!==this.$select.dataset.simpleSelectSearch),"simpleSelectSearchDropdown"in this.$select.dataset&&(t="false"!==this.$select.dataset.simpleSelectSearchDropdown),e||t){this.elemInputSearch=document.createElement("input"),this.elemInputSearch.type=this.options.searchTypeInput,this.elemInputSearch.tabIndex=-1,this.elemInputSearch.autocomplete="off",this.elemInputSearch.ariaAutoComplete="none",this.elemInputSearch.inputMode="off",this.elemInputSearch.placeholder=this.options.locale.searchText,this.elemInputSearch.name="".concat(u.initClass,"_name_").concat(this.id);var i=(0,c.getClass)("search");if(t){if(this.elemDropDown){var s=document.createElement("div");s.className=(0,c.getClass)("search_wrap"),this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("dropdown",!0,i)),s.appendChild(this.elemInputSearch),this.elemDropDown.insertBefore(s,this.elemDropDown.childNodes[0]),this.elemWrap.classList.add((0,c.getClass)("search_in_dropdown",!0)),this.elemWrap.dataset.search="dropdown"}}else this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("top",!0,i)),this.elemTop.appendChild(this.elemInputSearch),this.elemWrap.dataset.search="top";this.inputSearchHandler()}}},{key:"getChecked",value:function(){var e=this.state.getState("items"),t=[];return e.forEach((function(e){t=[].concat(n(t),n(e.items.filter((function(e){return e.checked}))))})),t}},{key:"createLi",value:function(e){var t=this,i="",s=0,n=0,o=0;if(!e.isShowFilter)return{result:i,countShow:s,countChecked:n,countCheckedFull:o};if(e.isGroup){var l=(0,c.getClass)("group");e.isDisabledGroup&&(l+=" ".concat((0,c.getClass)("disabled",!0,l))),i+='<div class="'.concat((0,c.getClass)("group_title"),'">').concat(e.titleGroup,"</div>"),i+='<ul class="'.concat(l,'">')}return e.items.forEach((function(l){if(l.isShowFilter){s++;var a=(0,c.getClass)("list_item"),r=!(!l.disabled&&!e.isDisabledGroup),h=a;l.checked&&(n++,h+=" ".concat((0,c.getClass)("checked",!0,a)),l.value&&o++),r&&(h+=" ".concat((0,c.getClass)("disabled",!0,a))),l.value||(h+=" ".concat((0,c.getClass)("not_value",!0,a)));var u='data-sel-group-id="'.concat(e.idGroup,'"');u+="data-sel-opt-item",u+=' data-sel-position="'.concat(l.position,'"'),u+=' data-sel-id="'.concat(l.id,'"'),l.value&&(u+=' data-sel-value="'.concat(l.value,'"')),u+=' data-sel-opt-checked="'.concat(l.checked,'"'),u+=' data-sel-opt-disabled="'.concat(r,'"'),t.options.isAlwaysOpen?r&&!t.options.isAlwaysOpenShowDisabledTabindex?u+=' tabindex="-1"':u+=' tabindex="0"':u+=' tabindex="-1"',i+='<li class="'.concat(h,'" ').concat(u,">");var p=t.createLiBody(l,t.$select.options[l.position]);i+="string"==typeof p?p:p.outerHTML,i+="</li>"}})),e.isGroup&&(i+="</ul>"),{result:i,countShow:s,countChecked:n,countCheckedFull:o}}},{key:"createLiBody",value:function(e,t){var i=document.createElement("div");i.className=(0,c.getClass)("list_item_body");var s="";return this.isShowCheckbox&&(s='<span class="'.concat((0,c.getClass)("list_item_icon"),'"></span>')),this.bodyLiHTMLBeforeFromSelect&&(s+=this.bodyLiHTMLBeforeFromSelect),t.hasAttribute("data-simple-html-before")&&(s+=t.getAttribute("data-simple-html-before")),s+="".concat(e.title),this.bodyLiHTMLAfterFromSelect&&(s+=this.bodyLiHTMLAfterFromSelect),t.hasAttribute("data-simple-html-after")&&(s+=t.getAttribute("data-simple-html-after")),i.innerHTML=s,this.options.changeBodyLi?this.options.changeBodyLi(i,t):i}},{key:"handlerChangeChecked",value:function(){console.error("This method need redefine")}},{key:"createList",value:function(e){console.error("This method need redefine")}},{key:"inputSearchHandler",value:function(){console.error("This method need redefine")}}],i&&l(t.prototype,i),s&&l(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.SimpleSelectItemDOM=p},679:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHtmlEntities=t.createButton=t.cloneObj=t.compareObj=t.getClass=t.getCreateListItem=t.createOptionItems=t.getCreateItem=t.triggerInputEvent=t.triggerCustomEvent=t.ifTrueDataAttr=t.createDataAttr=t.compareStringWithClearSpace=t.clearSpaceAndEmptyAttr=t.removeExtraSpaces=t.toCamelCase=void 0;var s=i(737);t.toCamelCase=function(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.removeExtraSpaces=function(e){return e.replace(/\s+/g," ").trim()};t.clearSpaceAndEmptyAttr=function(e){return e.replace(/\s+|=""/g,"")};t.compareStringWithClearSpace=function(e,i){return(0,t.clearSpaceAndEmptyAttr)(e)===(0,t.clearSpaceAndEmptyAttr)(i)};t.createDataAttr=function(e){return"data-".concat(e)};t.ifTrueDataAttr=function(e){return!!e&&("true"===e||"1"===e)},t.triggerCustomEvent=function(e,t,i){var s=new CustomEvent("simpSelect:".concat(t),{detail:i});e.dispatchEvent(s)},t.triggerInputEvent=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"change";try{var i=new Event(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(i)}catch(i){var s=new CustomEvent(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(s)}};t.getCreateItem=function(e,t){return{id:(t+1).toString(),position:e.index,title:e.innerHTML,value:e.getAttribute("value"),checked:e.selected,disabled:e.disabled,isShowFilter:!0}};t.createOptionItems=function(e,t,i){return{isGroup:e,idGroup:t,items:i,isShowFilter:!0}};t.getCreateListItem=function(e,i,s){if(e instanceof HTMLOptionElement)return(0,t.createOptionItems)(s,i,[(0,t.getCreateItem)(e,1)],!0);var n=e.querySelectorAll("option"),o=[];n.forEach((function(e,i){o.push((0,t.getCreateItem)(e,i))}));var l=(0,t.createOptionItems)(s,i,o,!0);return e instanceof HTMLOptGroupElement&&(l.titleGroup=e.label||"",l.isDisabledGroup=e.disabled||!1),l};t.getClass=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.initClass,n=t?"--":"__";return"".concat(i).concat(n).concat(e)};t.compareObj=function(e,t){return JSON.stringify(e)===JSON.stringify(t)};t.cloneObj=function(e){return JSON.parse(JSON.stringify(e))};t.createButton=function(){var e=document.createElement("button");return e.type="button",e.tabIndex=-1,e};t.decodeHtmlEntities=function(e){var t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}},972:function(e,t){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function n(e,t,s){return(t=function(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}Object.defineProperty(t,"__esModule",{value:!0}),t.store=void 0,t.store=function(e){var t={},i={},o=[],l=function(e){return e?e in t?t[e]:null:t},a=function(e,l){var a=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},t),r=t[e]||0==t[e]?t[e]:null;t[e]=l,e in i&&i[e].forEach((function(e){return e(l,r,t)})),o.forEach((function(i){return i(e,a,t)}))};return e&&Object.keys(e).forEach((function(t){a(t,e[t])})),{getState:l,setState:a,subscribe:function(e,t){e in i||(i[e]=[]),i[e].push(t);var s=l(e);return t(s,null,l()),function(){i[e]=i[e].filter((function(e){return e!==t}))}},subscribeAll:function(e){return o.push(e),e(null,null,l()),function(){o=o.filter((function(t){return t!==e}))}},unSubscribe:function(e,t){e in i&&(i[e]=i[e].filter((function(e){return e!==t})))}}}},181:function(e,t,i){i.r(t)}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,i),o.exports}i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return function(){var e=s;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){a(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function l(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,r(s.key),s)}}function a(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e){var i=function(e,i){if("object"!==t(e)||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,i||"default");if("object"!==t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"===t(i)?i:String(i)}var c=i(737),h=i(679),u=i(874);i(181);var p=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"callCount",Date.now()),a(this,"countInit",0),a(this,"$selects",[]),a(this,"options",void 0),a(this,"nameMarkTransform",(0,h.toCamelCase)(c.nameMark)),a(this,"dataNameMark",(0,h.createDataAttr)(c.nameMark)),a(this,"isNative",void 0),t||(t="select"),this.options=o(o({},c.simpleSelectionOptions),i),"string"==typeof t?this.init(Array.from(document.querySelectorAll(t))):t instanceof HTMLSelectElement?this.init([t]):t instanceof NodeList?this.init(Array.from(t)):Array.isArray(t)?this.init(t):console.warn("Wrong selector: ",t)}var t,i,s;return t=e,(i=[{key:"detectMobile",value:function(){if(this.options.detectNative)this.isNative=this.options.detectNative();else{for(var e=navigator.userAgent||navigator.vendor||window.opera,t=!1,i=0;i<this.options.nativeOnDevice.length;i++)e.toString().toLowerCase().indexOf(this.options.nativeOnDevice[i].toLowerCase())>0&&this.options.nativeOnDevice[i]&&(t=!0);this.isNative=t}}},{key:"init",value:function(e){var t=this;this.detectMobile(),e.forEach((function(e){t.build(e)}))}},{key:"createMethods",value:function(e){var t=this;return{getInstance:function(){return e},getHistory:function(){return e.history},getHistoryLast:function(){return e.history.length?e.history[e.history.length-1]:null},getHistoryFirst:function(){return e.history.length?e.history[0]:null},getNativeSelect:function(){return e.getSelect()},reload:function(){t.rebuild(e)},update:function(){e.updateHTML()},detach:function(){t.detach(e)}}}},{key:"setMethods",value:function(e){e.$select[c.nameSelect]=this.createMethods(e)}},{key:"setMethodsClear",value:function(e){delete e.$select[c.nameSelect]}},{key:"build",value:function(e){if(this.nameMarkTransform in e.dataset)console.warn("This element has already been initialized",e);else{this.countInit+=1;var t="".concat(this.callCount,"-").concat(this.countInit);e.setAttribute(this.dataNameMark,t);var i=new u.SimpleSelectItem(e,this.options,{id:t,isNative:this.isNative});this.$selects.push(i),this.setMethods(i)}}},{key:"detach",value:function(e){e.detachItem(),e.$select.removeAttribute(this.dataNameMark),this.setMethodsClear(e),this.$selects=this.$selects.filter((function(t){return t!==e}))}},{key:"rebuild",value:function(e){var t=e.$select;this.detach(e),this.build(t)}},{key:"getSelects",value:function(){return this.$selects}},{key:"getSelectFirst",value:function(){return this.createMethods(this.$selects[0])}},{key:"getSelectById",value:function(e){var t=this.$selects.filter((function(t){return t.id===e}))[0];return t?this.createMethods(t):null}}])&&l(t.prototype,i),s&&l(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.default=p}(),s=s.default}()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("SimpleSelect",[],t):"object"==typeof exports?exports.SimpleSelect=t():e.SimpleSelect=t()}("undefined"==typeof self?this:self,(function(){return function(){"use strict";var e={737:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.initClass=t.nameMark=t.nameSelect=t.simpleSelectionOptions=t.simpleSelectLocale=void 0,t.simpleSelectLocale={noSearch:"No matches for",searchText:"Search",title:"Select",selected:"Selected:",all:"all",ok:"Ok",cancel:"Cancel",selectAll:"Select all",resetAll:"Reset all"},t.simpleSelectionOptions={isSearch:!1,searchTypeInput:"search",isSearchInDropdown:!1,countShowSelected:3,isOnlyPlaceholder:!1,historyMaxSize:0,isRemoveTop:!1,isConfirmInMulti:!1,isConfirmInMultiOkClickOutside:!1,nativeOnDevice:["Android","BlackBerry","iPhone","iPad","iPod","Opera Mini","IEMobile","Silk"],locale:t.simpleSelectLocale,sepChars:",",isUp:!1,isAlwaysOpen:!1,isAlwaysOpenShowDisabledTabindex:!1,floatWidth:767,isCloneClass:!0,selectAll:!1,selectAllAfterClose:!0,resetAll:!1,resetAllAfterClose:!0,isScrollToCheckedFirst:!0,isScrollToCheckedAlways:!1,isSetAttributeSizeMultiple:!0,attributeSizeMultiple:1},t.nameSelect="SimpSelect";t.nameMark="".concat("simple-select-","init"),t.initClass="SimpleSel"},874:function(e,t,i){function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function n(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,u(s.key),s)}}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=c(e);if(t){var o=c(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}(this,i)}}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(){return r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(s){var n=Object.getOwnPropertyDescriptor(s,t);return n.get?n.get.call(arguments.length<3?e:i):n.value}},r.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function h(e,t,i){return(t=u(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleSelectItem=void 0;var p=i(679),d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(d,e);var t,i,s,u=l(d);function d(e,t,i){var s,n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),h(a(n=u.call(this,e,t,i)),"closeOutsideHandler",void 0),h(a(n),"closeEscHandler",void 0),h(a(n),"changeListener",void 0),h(a(n),"selectKeyDownListener",void 0),h(a(n),"searchHandler",void 0),h(a(n),"handleResize",void 0),h(a(n),"mql",null),h(a(n),"isInitialized",!1),h(a(n),"isFirstOpen",!1),h(a(n),"countOpen",0),h(a(n),"timeoutDebounceId",null),h(a(n),"history",[]),!e)throw Error("Select is required");return n.init(),r((s=a(n),c(d.prototype)),"initDom",s).call(s),n.initAfterDom(),setTimeout((function(){n.isInitialized=!0,(0,p.triggerCustomEvent)(n.$select,"initialized",{item:a(n)})}),10),n}return t=d,i=[{key:"init",value:function(){var e=this;this.changeListener=this.changeListenerInit.bind(this),this.selectKeyDownListener=this.selectKeyDownInit.bind(this),this.$select.addEventListener("change",this.changeListener),this.$select.addEventListener("keydown",this.selectKeyDownListener),this.searchHandler=this.searchHandlerInit.bind(this),this.closeOutsideHandler=this.closeOutsideHandlerInit.bind(this),this.closeEscHandler=this.closeEscHandlerInit.bind(this),this.handleResize=this.handleResizeInit.bind(this),this.options.callbackInitialization&&this.options.callbackInitialization(this),!this.isNative&&this.options.floatWidth&&(this.mql=window.matchMedia("screen and (max-width: ".concat(this.options.floatWidth,"px)")),this.mql&&(this.mql.onchange=this.handleResize,this.handleResizeInit(this.mql))),this.state.subscribe("isOpen",(function(t){if(t&&e.elemListBody){var i=e.options,s=i.isScrollToCheckedFirst,n=i.isScrollToCheckedAlways;e.isFirstOpen||!s||n||e.scrollToFirstChecked(),n&&e.scrollToFirstChecked()}t&&!e.isFirstOpen&&(e.isFirstOpen=!0),e.isInitialized&&(0,p.triggerCustomEvent)(e.$select,"".concat(t?"open":"close",".before"),{item:e}),e.toggleOpenHandler(),!t&&e.options.isConfirmInMulti&&e.createList(),t||e.elemInputSearch&&(e.elemInputSearch.value="",e.state.setState("filterStr","")),e.isInitialized&&(0,p.triggerCustomEvent)(e.$select,"".concat(t?"open":"close",".after"),{item:e})})),this.isNative||this.options.isAlwaysOpen||(this.elemTopBody.onclick=this.clickToggleOpen.bind(this),this.elemTopBody.onkeyup=this.clickToggleOpen.bind(this))}},{key:"scrollToFirstChecked",value:function(){if(this.elemListBody&&this.elemDropDownWrap){var e=this.elemListBody.querySelector('[data-sel-opt-checked="true"]');e&&(this.elemDropDownWrap.scrollTop=e.offsetTop)}}},{key:"handleResizeInit",value:function(e){e&&(e.matches?this.state.setState("isFloat",!0):this.state.setState("isFloat",!1))}},{key:"initAfterDom",value:function(){var e=this;this.confirmOk&&(this.confirmOk.onclick=this.confirmOkHandler.bind(this)),this.confirmNo&&(this.confirmNo.onclick=this.confirmNoHandler.bind(this)),this.options.callbackInitialized&&this.options.callbackInitialized(this),this.multiDebounceTime&&(this.multiDebounceChange=this.debounce(this.multiDebounceChange.bind(this),this.multiDebounceTime)),this.elemSelectAll&&(this.elemSelectAll.onclick=this.selectAllHandler.bind(this)),this.elemResetAll&&(this.elemResetAll.onclick=this.resetAllHandler.bind(this)),this.elemDropDownClose&&(this.elemDropDownClose.onclick=this.closeHandler.bind(this)),this.elemListBody&&this.elemListBody.addEventListener("keyup",(function(t){if("Enter"===t.key){var i=t.target;if(i&&(0,p.toCamelCase)("sel-opt-item")in i.dataset){t.preventDefault(),t.stopPropagation(),e.changeClickItem(i);var s=i.dataset[(0,p.toCamelCase)("sel-position")],n=e.elemListBody.querySelector('[data-sel-position="'.concat(s,'"]'));n&&n.focus()}}}))}},{key:"debounce",value:function(e,t){var i=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.timeoutDebounceId&&clearTimeout(i.timeoutDebounceId),i.timeoutDebounceId=setTimeout((function(){e.apply(void 0,n),i.timeoutDebounceId=null}),t)}}},{key:"confirmOkHandler",value:function(e){e.preventDefault(),this.confirmOkBuild()}},{key:"confirmOkBuild",value:function(){var e=this,t=this.$select.options;this.elemListBody&&(this.elemListBody.querySelectorAll("[data-sel-position]").forEach((function(i){var s=parseInt(i.dataset[(0,p.toCamelCase)("sel-position")],10);if(s||0===s){var n=t[s],o=n.disabled||"true"===i.getAttribute("data-sel-opt-disabled");if(n&&!o){var l="true"===i.dataset[(0,p.toCamelCase)("sel-opt-checked")];l!==n.selected&&e.addHistory(n,l),n.selected=l}}})),this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"multiConfirm",{item:this}))}},{key:"confirmNoHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1),(0,p.triggerCustomEvent)(this.$select,"multiCancel",{item:this})}},{key:"closeHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1)}},{key:"selectAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){var t,i=e.disabled;null!==(t=e.closest("optgroup"))&&void 0!==t&&t.disabled&&(i=!0),i||(e.selected=!0)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"selectAll",{item:this})}},{key:"resetAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){var t,i=e.disabled;null!==(t=e.closest("optgroup"))&&void 0!==t&&t.disabled&&(i=!0),i||(e.selected=!1)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit(),(0,p.triggerCustomEvent)(this.$select,"resetAll",{item:this})}},{key:"triggerSetup",value:function(e){if(0===e.button){var t=e.target.closest("li");t&&this.changeClickItem(t)}}},{key:"changeClickItemDom",value:function(e){var t=e.closest("[data-simple-select-gruop]");if("true"===e.dataset[(0,p.toCamelCase)("sel-opt-checked")]){if(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="false",e.classList.remove("SimpleSel__list_item--checked"),t){var i=Number(t.getAttribute("data-count-checked"))||1;t.setAttribute("data-count-checked",(i-1).toString())}}else if(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="true",e.classList.add("SimpleSel__list_item--checked"),t){var s=Number(t.getAttribute("data-count-checked"))||0;t.setAttribute("data-count-checked",(s+1).toString())}}},{key:"addHistory",value:function(e,t){this.options.historyMaxSize>0&&(this.history.push({value:e.value,text:e.innerHTML,selected:t,indexOption:e.index}),this.history.length>this.options.historyMaxSize&&(this.history=this.history.slice(this.history.length-this.options.historyMaxSize)),(0,p.triggerCustomEvent)(this.$select,"updateHistory",{item:this,history:this.history}))}},{key:"changeClickItem",value:function(e){if(e){var t=Number(e.dataset[(0,p.toCamelCase)("sel-position")])||0,i=this.$select.options[t],s=i.disabled||"true"===e.getAttribute("data-sel-opt-disabled");if(i&&!s)if(this.isMulti)if(this.options.isConfirmInMulti||this.isFloatWidth)this.changeClickItemDom(e);else{var n=!i.selected;i.selected=n,this.addHistory(i,n),this.changeClickItemDom(e),this.createList(),this.multiDebounceChangeAnimation(!0),this.multiDebounceChange()}else i.selected=!0,this.addHistory(i,!0),this.createList(),this.state.setState("isOpen",!1),this.triggerInit()}}},{key:"multiDebounceChange",value:function(){this.triggerInit()}},{key:"multiDebounceChangeAnimation",value:function(e){this.isDebounceStatusBar&&this.elemDebounceProgressBar&&(this.elemDebounceProgressBar.classList.remove("this--animating"),this.elemDebounceProgressBar.style.setProperty("--duration","0ms"),this.elemDebounceProgressBar.offsetWidth,e&&(this.elemDebounceProgressBar.style.setProperty("--duration","".concat(this.multiDebounceTime,"ms")),this.elemDebounceProgressBar.classList.add("this--animating")))}},{key:"triggerInit",value:function(){this.multiDebounceChangeAnimation(!1),(0,p.triggerInputEvent)(this.$select)}},{key:"clickToggleOpen",value:function(e){e.preventDefault(),this.isDisabled||("click"!==e.type?e instanceof KeyboardEvent&&"Enter"===e.key&&this.state.setState("isOpen",!this.state.getState("isOpen")):this.state.setState("isOpen",!this.state.getState("isOpen")))}},{key:"closeOutsideHandlerInit",value:function(e){var t=e.target;t&&(this.elemWrap.contains(t)||(this.options.isConfirmInMulti&&this.options.isConfirmInMultiOkClickOutside&&this.confirmOkBuild(),this.state.setState("isOpen",!1)))}},{key:"closeEscHandlerInit",value:function(e){"Escape"===e.code&&(e.preventDefault(),e.stopPropagation(),this.state.setState("isOpen",!1)),"Tab"===e.code&&(e.preventDefault(),e.stopPropagation(),this.elemWrap.contains(e.target)||this.state.setState("isOpen",!1)),"ArrowUp"!==e.key&&"ArrowDown"!==e.key||(e.preventDefault(),e.stopPropagation(),this.keyBoardChangeChecked("ArrowDown"===e.key))}},{key:"keyBoardChangeChecked",value:function(e){var t=this.elemListBody.querySelectorAll('[data-sel-position]:not([data-sel-opt-disabled="true"])');if(t.length){var i,s=0;t.forEach((function(e,t){document.activeElement===e&&(s=t,i=e),e.removeAttribute("tabindex")})),(i=i?e?t[s+1]||t[0]:t[s-1]||t[t.length-1]:e?t[0]:t[t.length-1]).tabIndex=0,i.focus()}}},{key:"searchHandlerInit",value:function(e){var t=e.target;if(t){var i=t.value;this.state.setState("filterStr",i)}}},{key:"toggleOpen",value:function(){var e=this.state.getState("isOpen");this.state.setState("isOpen",!e)}},{key:"toggleOpenHandler",value:function(){var e=this;this.state.getState("isOpen")?(this.elemWrap.classList.add("SimpleSel--open"),document.addEventListener("click",this.closeOutsideHandler),document.addEventListener("keyup",this.closeEscHandler),this.elemInputSearch&&setTimeout((function(){e.elemInputSearch.focus()}),50),this.options.callbackOpen&&this.options.callbackOpen(this),this.countOpen++,this.elemDropDown&&setTimeout((function(){e.elemDropDown.scrollTop=0}),10)):(this.state.setState("filterList",""),this.elemWrap.classList.remove("SimpleSel--open"),document.removeEventListener("click",this.closeOutsideHandler),document.removeEventListener("keyup",this.closeEscHandler),this.timeoutDebounceId&&(clearTimeout(this.timeoutDebounceId),this.timeoutDebounceId=null,this.multiDebounceChangeAnimation(!1),this.triggerInit()),this.options.callbackClose&&this.countOpen>0&&this.options.callbackClose(this))}},{key:"changeListenerInit",value:function(e){this.options.callbackChangeSelect&&this.options.callbackChangeSelect(e,this),this.createList(!0)}},{key:"selectKeyDownInit",value:function(e){this.isNative||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggleOpen())}},{key:"getSelect",value:function(){return this.$select}},{key:"handlerChangeChecked",value:function(){this.elemListBody&&(this.elemListBody.onmouseup=this.triggerSetup.bind(this))}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=[],i=this.$select.querySelectorAll("optgroup");if(i&&i.length?this.$select.querySelectorAll(":scope > *").forEach((function(e,i){var s=e instanceof HTMLOptGroupElement;t.push((0,p.getCreateListItem)(e,(i+1).toString(),s))})):t.push((0,p.getCreateListItem)(this.$select,"1",!1)),e){var s=this.state.getState("items");(0,p.compareObj)(s,t)||this.state.setState("items",t)}else this.state.setState("items",t)}},{key:"inputSearchHandler",value:function(){this.elemInputSearch&&this.elemInputSearch.addEventListener("input",this.searchHandler)}},{key:"detachItem",value:function(){this.options.callbackDestroyInit&&this.options.callbackDestroyInit(this);var e=this.elemWrap.parentNode;this.$select.removeEventListener("change",this.changeListener),this.elemInputSearch&&this.elemInputSearch.removeEventListener("input",this.searchHandler),this.confirmOk&&(this.confirmOk.onclick=null),this.confirmNo&&(this.confirmNo.onclick=null),e.replaceChild(this.$select,this.elemWrap),this.$select.classList.remove(this.classSelectInit),this.elemTopBody&&(this.elemTopBody.onclick=null,this.elemTopBody.onkeyup=null),this.elemListBody&&(this.elemListBody.onmouseup=null),this.elemSelectAll&&(this.elemSelectAll.onclick=null),this.elemResetAll&&(this.elemResetAll.onclick=null),this.options.callbackDestroy&&this.options.callbackDestroy(this),this.elemDropDownClose&&(this.elemDropDownClose.onclick=null),this.mql&&(this.mql.onchange=null,this.mql=null)}}],i&&n(t.prototype,i),s&&n(t,s),Object.defineProperty(t,"prototype",{writable:!1}),d}(i(844).SimpleSelectItemDOM);t.SimpleSelectItem=d},844:function(e,t,i){function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,s=new Array(t);i<t;i++)s[i]=e[i];return s}function l(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,r(s.key),s)}}function a(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleSelectItemDOM=void 0;var c=i(679),h=i(972),u=i(737),p=function(){function e(t,i,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"options",void 0),a(this,"$select",void 0),a(this,"id",void 0),a(this,"titlePlaceholder",void 0),a(this,"isDisabled",!1),a(this,"isMulti",void 0),a(this,"state",(0,h.store)({items:[],isOpen:!1,filterStr:"",isFloat:!1})),a(this,"classSelectInit",(0,c.getClass)("select_init")),a(this,"isNative",void 0),a(this,"elemWrap",document.createElement("div")),a(this,"elemTop",document.createElement("div")),a(this,"elemTopBody",document.createElement("div")),a(this,"elemDropDownWrap",null),a(this,"elemDropDown",null),a(this,"elemDropDownClose",null),a(this,"elemListBody",null),a(this,"elemInputSearch",null),a(this,"elemTitle",void 0),a(this,"confirmWrap",null),a(this,"confirmOk",null),a(this,"confirmNo",null),a(this,"elemControl",null),a(this,"elemSelectAll",null),a(this,"elemResetAll",null),a(this,"elemDebounceProgressBar",null),a(this,"cloneClasses",""),a(this,"isShowCheckbox",!1),a(this,"bodyLiHTMLBeforeFromSelect",null),a(this,"bodyLiHTMLAfterFromSelect",null),a(this,"isFloatWidth",!1),a(this,"bodyOpenClass","".concat(u.initClass,"--body_open")),a(this,"multiDebounceTime",0),a(this,"isDebounceStatusBar",!1);var n=s.id,o=s.isNative;this.$select=t,this.isMulti=t.multiple,this.id=n,this.isNative=o,this.options=(0,c.cloneObj)(i),this.options.isDebounceStatusBar&&(this.isDebounceStatusBar=this.options.isDebounceStatusBar),this.options.isCloneClass&&(this.cloneClasses=this.$select.className),i.callbackInitialization&&(this.options.callbackInitialization=i.callbackInitialization),i.callbackInitialized&&(this.options.callbackInitialized=i.callbackInitialized),i.callbackOpen&&(this.options.callbackOpen=i.callbackOpen),i.callbackClose&&(this.options.callbackClose=i.callbackClose),i.callbackDestroyInit&&(this.options.callbackDestroyInit=i.callbackDestroyInit),i.callbackDestroy&&(this.options.callbackDestroy=i.callbackDestroy),i.callbackChangeSelect&&(this.options.callbackChangeSelect=i.callbackChangeSelect),i.changeBodyLi&&(this.options.changeBodyLi=i.changeBodyLi),i.formatTitle&&(this.options.formatTitle=i.formatTitle),this.isMulti&&this.$select.hasAttribute("data-simple-is-confirm")&&(this.options.isConfirmInMulti=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-is-confirm"))),this.optionOverride(),this.isDisabled=this.$select.disabled}var t,i,s;return t=e,i=[{key:"optionOverride",value:function(){var e=(0,c.toCamelCase)("simple-placeholder"),t=this.$select.dataset[e],i=this.$select.getAttribute("placeholder"),s=null==i?void 0:i.trim();if(this.titlePlaceholder=t?t||"":s||this.options.locale.title,this.$select.hasAttribute("data-simple-debounce-status-bar")&&(this.isDebounceStatusBar=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-debounce-status-bar"))),this.$select.hasAttribute("data-simple-reset-all")&&(this.options.resetAll=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-reset-all"))),this.$select.hasAttribute("data-simple-select-all")){var n=this.$select.getAttribute("data-simple-select-all");this.options.selectAll=(0,c.ifTrueDataAttr)(n)}var o=this.$select.dataset[(0,c.toCamelCase)("simple-show-checkbox")];this.isMulti?this.isShowCheckbox=!(o&&!(0,c.ifTrueDataAttr)(o)):"true"===o&&(this.isShowCheckbox=!0);var l=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-before")];l&&(this.bodyLiHTMLBeforeFromSelect=l);var a=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-after")];if(a&&(this.bodyLiHTMLAfterFromSelect=a),this.$select.hasAttribute("data-simple-up")&&(this.options.isUp=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-up"))),this.$select.hasAttribute("data-simple-is-only-placeholder")&&(this.options.isOnlyPlaceholder=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-is-only-placeholder"))),this.$select.hasAttribute("data-simple-remove-top")&&(this.options.isRemoveTop=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-remove-top"))),this.$select.hasAttribute("data-simple-float-none")&&(this.isFloatWidth=!1,this.options.floatWidth=0),this.$select.hasAttribute("data-simple-float-width")){var r=Number(this.$select.dataset[(0,c.toCamelCase)("simple-float-width")]);r&&(this.options.floatWidth=r)}this.$select.hasAttribute("data-simple-always-open")&&(this.options.isAlwaysOpen=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-always-open")),this.isNative=!1,this.isFloatWidth=!1,this.options.floatWidth=0),this.isMulti&&!this.options.isConfirmInMulti&&((0,c.toCamelCase)("simple-debounce-time")in this.$select.dataset?this.multiDebounceTime=Number(this.$select.dataset[(0,c.toCamelCase)("simple-debounce-time")]):(this.options.debounceTime||0===this.options.debounceTime)&&(this.multiDebounceTime=this.options.debounceTime))}},{key:"initDom",value:function(){var e=this;this.createList(!1),this.createHTML(),this.state.subscribe("filterStr",(function(t){e.createListHTML(!0)})),this.state.subscribe("items",(function(t){e.createListHTML(!0),e.createTitleHTML()})),this.state.subscribe("isOpen",(function(t){e.createListHTML(!1),e.createTitleHTML(),e.toggleTabIndex(t)})),this.state.subscribe("isFloat",(function(t){e.isFloatWidth=t;var i=(0,c.getClass)("float",!0);t?(e.elemWrap.classList.add(i),!document.body.classList.contains(e.bodyOpenClass)&&e.state.getState("isOpen")&&document.body.classList.add(e.bodyOpenClass)):(e.elemWrap.classList.remove(i),document.body.classList.contains(e.bodyOpenClass)&&document.body.classList.remove(e.bodyOpenClass))}))}},{key:"toggleTabIndex",value:function(e){var t=e||this.options.isAlwaysOpen?0:-1;this.state.getState("isFloat")&&(e?document.body.classList.add(this.bodyOpenClass):document.body.classList.remove(this.bodyOpenClass)),this.elemInputSearch&&(this.elemInputSearch.tabIndex=t),this.elemResetAll&&(this.elemResetAll.tabIndex=t),this.elemSelectAll&&(this.elemSelectAll.tabIndex=t),this.confirmOk&&(this.confirmOk.tabIndex=t),this.confirmNo&&(this.confirmNo.tabIndex=t)}},{key:"updateHTML",value:function(){this.createList(!0)}},{key:"createHTML",value:function(){this.$select.classList.add(this.classSelectInit),this.$select.tabIndex=-1,this.elemTopBody.className=(0,c.getClass)("top_body"),this.elemTopBody.tabIndex=this.isDisabled?-1:0,this.createIcon(),this.options.isRemoveTop||this.elemTop.appendChild(this.elemTopBody);var e=u.initClass;this.options.isCloneClass&&(e+=" ".concat(this.cloneClasses)),this.options.addClasses&&(e+=" ".concat(this.options.addClasses)),this.$select.hasAttribute("data-simple-add-classes")&&(e+=" ".concat(this.$select.getAttribute("data-simple-add-classes"))),this.isDisabled&&(e+=" ".concat((0,c.getClass)("disabled",!0))),this.options.isAlwaysOpen&&(e+=" ".concat((0,c.getClass)("always_open",!0))),this.options.isUp&&(e+=" ".concat((0,c.getClass)("up",!0))),e+=" ".concat(this.isMulti?(0,c.getClass)("multi",!0):(0,c.getClass)("single",!0)),this.elemWrap.className=e,this.elemWrap.dataset.countAll=this.$select.options.length.toString(),this.elemTop.className=(0,c.getClass)("top");var t=this.$select.parentNode;t&&(t.replaceChild(this.elemWrap,this.$select),this.elemWrap.appendChild(this.$select)),this.elemWrap.appendChild(this.elemTop),this.isNative?(this.$select.classList.add((0,c.getClass)("native",!0,this.classSelectInit)),this.elemWrap.classList.add((0,c.getClass)("native",!0))):(this.createDropDown(),this.createControlHTML(),this.createInputHTML()),this.createTitleHTML()}},{key:"createControlHTML",value:function(){if(this.elemDropDown&&this.isMulti&&(this.options.selectAll||this.options.resetAll)){this.elemControl=document.createElement("div"),this.elemControl.classList.add((0,c.getClass)("controls")),this.elemDropDown.insertBefore(this.elemControl,this.elemDropDown.childNodes[0]);var e=(0,c.getClass)("control");this.options.selectAll&&(this.elemSelectAll=(0,c.createButton)(),this.elemSelectAll.className="".concat(e," ").concat((0,c.getClass)("select_all",!0,e)),this.elemSelectAll.innerHTML='<span class="'.concat((0,c.getClass)("select_all__icon"),'"></span> ').concat(this.options.locale.selectAll),this.elemControl.appendChild(this.elemSelectAll)),this.options.resetAll&&(this.elemResetAll=(0,c.createButton)(),this.elemResetAll.className="".concat(e," ").concat((0,c.getClass)("reset_all",!0,e)),this.elemResetAll.innerHTML='<span class="'.concat((0,c.getClass)("reset_all__icon"),'"></span> ').concat(this.options.locale.resetAll),this.elemControl.appendChild(this.elemResetAll))}}},{key:"createIcon",value:function(){var e=document.createElement("span");e.className=(0,c.getClass)("icon"),this.elemTopBody.appendChild(e)}},{key:"createDropDown",value:function(){this.isNative||(this.elemDropDownWrap=document.createElement("div"),this.elemDropDownWrap.className=(0,c.getClass)("body"),this.options.isAlwaysOpen&&this.elemDropDownWrap.classList.add((0,c.getClass)("body-always_open",!0)),this.elemDropDown=document.createElement("div"),this.elemDropDown.className=(0,c.getClass)("body_wrap"),this.elemListBody=document.createElement("ul"),this.elemListBody.className=(0,c.getClass)("list"),this.isMulti&&this.isDebounceStatusBar&&this.multiDebounceTime&&(this.elemDebounceProgressBar=document.createElement("div"),this.elemDebounceProgressBar.className=(0,c.getClass)("debounce_progress_bar"),this.options.isDebounceStatusBarBottom?this.elemDropDown.append(this.elemDebounceProgressBar):this.elemTop.append(this.elemDebounceProgressBar)),this.elemDropDownWrap.append(this.elemDropDown),this.elemWrap.appendChild(this.elemDropDownWrap),this.elemDropDown.appendChild(this.elemListBody),this.elemDropDownClose=(0,c.createButton)(),this.elemDropDownClose.classList.add((0,c.getClass)("close")),this.elemDropDown.appendChild(this.elemDropDownClose),this.isMulti&&this.createIsConfirmInMultiHTML(),this.handlerChangeChecked())}},{key:"createIsConfirmInMultiHTML",value:function(){var e;this.confirmWrap=document.createElement("div");var t=(0,c.getClass)("bottom_control");this.confirmOk=(0,c.createButton)(),this.confirmNo=(0,c.createButton)(),this.confirmWrap.appendChild(this.confirmOk),this.confirmWrap.appendChild(this.confirmNo),this.confirmOk.innerHTML=this.options.locale.ok,this.confirmNo.innerHTML=this.options.locale.cancel,this.confirmOk.className="".concat(t," ").concat((0,c.getClass)("ok",!0,t)),this.confirmNo.className="".concat(t," ").concat((0,c.getClass)("no",!0,t));var i=(0,c.getClass)("bottom_controls");this.options.isConfirmInMulti||(i+=" ".concat((0,c.getClass)("hide",!0,i))),this.confirmWrap.className=i,null===(e=this.elemDropDown)||void 0===e||e.appendChild(this.confirmWrap)}},{key:"createTitleHTML",value:function(){var e=this;if(!this.options.isRemoveTop){if(!this.elemTitle){this.elemTitle=document.createElement("div");var t=(0,c.getClass)("title");this.options.isOnlyPlaceholder&&(t+=" ".concat((0,c.getClass)("only-placeholder",!0,t))),this.elemTitle.className=t,this.elemTopBody.insertBefore(this.elemTitle,this.elemTopBody.childNodes[0])}var i=this.getChecked();this.elemTop.title="";var s=!i.length,n=!!i.filter((function(e){return e.value})).length,o=this.titlePlaceholder;if(i.length&&!this.options.isOnlyPlaceholder){var l="",a="";i.forEach((function(t,i){0!==i&&(l+="".concat(e.options.sepChars,'<span class="').concat((0,c.getClass)("sep_space",!0),'">&nbsp;</span>'),a+="".concat(e.options.sepChars," ")),l+="".concat(t.title),a+="".concat(t.title)})),this.options.formatTitle?a=this.options.formatTitle(a):this.options.isNeedFormatTitle&&(a=(0,c.decodeHtmlEntities)(a)),this.elemTop.title=a;var r=this.options.countShowSelected,h=Number(this.$select.dataset.simpleCountShowsSelected);h&&h>0&&(r=h),i.length>r?(o="".concat(this.options.locale.selected," ").concat(i.length),this.$select.querySelectorAll("option").length===i.length&&(o+=" (".concat(this.options.locale.all,")"))):l&&(o=l)}this.elemTitle.innerHTML=o;var u=(0,c.getClass)("fill_with_value",!0);n?this.elemWrap.classList.add(u):this.elemWrap.classList.remove(u),s?(this.elemTitle.classList.add("SimpleSel__title--placeholder"),this.elemTitle.classList.remove("SimpleSel__title--fill"),this.elemWrap.classList.remove((0,c.getClass)("fill",!0))):(this.elemTitle.classList.remove("SimpleSel__title--placeholder"),this.elemTitle.classList.add("SimpleSel__title--fill"),this.elemWrap.classList.add((0,c.getClass)("fill",!0)))}}},{key:"filterList",value:function(){var e=this.state.getState("filterStr"),t=this.state.getState("items");if(!e)return t;e=e.toLowerCase();var i=(0,c.cloneObj)(t);return i.forEach((function(t){var i=!1;t.items.forEach((function(t){t.title.toLowerCase().indexOf(e)>=0?(i=!0,t.isShowFilter=!0):t.isShowFilter=!1})),t.isShowFilter=i})),i}},{key:"createListHTML",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.elemListBody){var i="",s=0,n=0,o=0,l=t?this.filterList():this.state.getState("items"),a=[];l.forEach((function(t){if(t.items.forEach((function(e){a.push({value:e.value,checked:e.checked,disabled:e.disabled||!!t.isDisabledGroup,isShowFilter:e.isShowFilter})})),t.isGroup){var l=e.createLi(t),r=l.result,h=l.countShow,u=l.countChecked,p=l.countCheckedFull,d='data-count-show="'.concat(h,'" ');d+='data-count-checked="'.concat(u,'" ');var m=(0,c.getClass)("group_items");t.isDisabledGroup&&(m+=" ".concat((0,c.getClass)("disabled",!0,m))),i+='<div class="'.concat(m,'" ').concat(d," data-simple-select-gruop>"),i+=r,i+="</div>",n+=u,s+=h,o+=p}else{var f=e.createLi(t),b=f.result,v=f.countShow,y=f.countChecked,g=f.countCheckedFull;i+=b,s+=v,n+=y,o+=g}}));var r=this.state.getState("filterStr");r&&r.length&&0===s&&(i='<div class="'.concat((0,c.getClass)("no_match"),'">'),i="".concat(this.options.locale.noSearch,' "').concat(r,'"'),i+="</div>"),this.elemWrap.dataset.countChecked=n.toString(),this.elemWrap.dataset.countCheckedFull=o.toString(),this.isMulti&&(this.elemWrap.dataset.checkAllMulti=this.$select.options.length===n?"yes":"no"),i=(0,c.removeExtraSpaces)(i);var h=[];this.elemListBody.querySelectorAll("[data-sel-opt-item]").forEach((function(e){h.push({value:e.getAttribute("data-sel-value"),checked:"true"===e.getAttribute("data-sel-opt-checked"),disabled:"true"===e.getAttribute("data-sel-opt-disabled")})})),(0,c.compareObj)(a,h)||(this.elemListBody.innerHTML=i,(0,c.triggerCustomEvent)(this.$select,"createListBuild",{item:this}))}}},{key:"createInputHTML",value:function(){var e=this.options.isSearch,t=this.options.isSearchInDropdown;if("simpleSelectSearch"in this.$select.dataset&&(e="false"!==this.$select.dataset.simpleSelectSearch),"simpleSelectSearchDropdown"in this.$select.dataset&&(t="false"!==this.$select.dataset.simpleSelectSearchDropdown),e||t){this.elemInputSearch=document.createElement("input"),this.elemInputSearch.type=this.options.searchTypeInput,this.elemInputSearch.tabIndex=-1,this.elemInputSearch.autocomplete="off",this.elemInputSearch.ariaAutoComplete="none",this.elemInputSearch.inputMode="off",this.elemInputSearch.placeholder=this.options.locale.searchText,this.elemInputSearch.name="".concat(u.initClass,"_name_").concat(this.id);var i=(0,c.getClass)("search");if(t){if(this.elemDropDown){var s=document.createElement("div");s.className=(0,c.getClass)("search_wrap"),this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("dropdown",!0,i)),s.appendChild(this.elemInputSearch),this.elemDropDown.insertBefore(s,this.elemDropDown.childNodes[0]),this.elemWrap.classList.add((0,c.getClass)("search_in_dropdown",!0)),this.elemWrap.dataset.search="dropdown"}}else this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("top",!0,i)),this.elemTop.appendChild(this.elemInputSearch),this.elemWrap.dataset.search="top";this.inputSearchHandler()}}},{key:"getChecked",value:function(){var e=this.state.getState("items"),t=[];return e.forEach((function(e){t=[].concat(n(t),n(e.items.filter((function(e){return e.checked}))))})),t}},{key:"createLi",value:function(e){var t=this,i="",s=0,n=0,o=0;if(!e.isShowFilter)return{result:i,countShow:s,countChecked:n,countCheckedFull:o};if(e.isGroup){var l=(0,c.getClass)("group");e.isDisabledGroup&&(l+=" ".concat((0,c.getClass)("disabled",!0,l))),i+='<div class="'.concat((0,c.getClass)("group_title"),'">').concat(e.titleGroup,"</div>"),i+='<ul class="'.concat(l,'">')}return e.items.forEach((function(l){if(l.isShowFilter){s++;var a=(0,c.getClass)("list_item"),r=!(!l.disabled&&!e.isDisabledGroup),h=a;l.checked&&(n++,h+=" ".concat((0,c.getClass)("checked",!0,a)),l.value&&o++),r&&(h+=" ".concat((0,c.getClass)("disabled",!0,a))),l.value||(h+=" ".concat((0,c.getClass)("not_value",!0,a)));var u='data-sel-group-id="'.concat(e.idGroup,'"');u+="data-sel-opt-item",u+=' data-sel-position="'.concat(l.position,'"'),u+=' data-sel-id="'.concat(l.id,'"'),l.value&&(u+=' data-sel-value="'.concat(l.value,'"')),u+=' data-sel-opt-checked="'.concat(l.checked,'"'),u+=' data-sel-opt-disabled="'.concat(r,'"'),t.options.isAlwaysOpen?r&&!t.options.isAlwaysOpenShowDisabledTabindex?u+=' tabindex="-1"':u+=' tabindex="0"':u+=' tabindex="-1"',i+='<li class="'.concat(h,'" ').concat(u,">");var p=t.createLiBody(l,t.$select.options[l.position]);i+="string"==typeof p?p:p.outerHTML,i+="</li>"}})),e.isGroup&&(i+="</ul>"),{result:i,countShow:s,countChecked:n,countCheckedFull:o}}},{key:"createLiBody",value:function(e,t){var i=document.createElement("div");i.className=(0,c.getClass)("list_item_body");var s="";return this.isShowCheckbox&&(s='<span class="'.concat((0,c.getClass)("list_item_icon"),'"></span>')),this.bodyLiHTMLBeforeFromSelect&&(s+=this.bodyLiHTMLBeforeFromSelect),t.hasAttribute("data-simple-html-before")&&(s+=t.getAttribute("data-simple-html-before")),s+="".concat(e.title),this.bodyLiHTMLAfterFromSelect&&(s+=this.bodyLiHTMLAfterFromSelect),t.hasAttribute("data-simple-html-after")&&(s+=t.getAttribute("data-simple-html-after")),i.innerHTML=s,this.options.changeBodyLi?this.options.changeBodyLi(i,t):i}},{key:"handlerChangeChecked",value:function(){console.error("This method need redefine")}},{key:"createList",value:function(e){console.error("This method need redefine")}},{key:"inputSearchHandler",value:function(){console.error("This method need redefine")}}],i&&l(t.prototype,i),s&&l(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.SimpleSelectItemDOM=p},679:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHtmlEntities=t.createButton=t.cloneObj=t.compareObj=t.getClass=t.getCreateListItem=t.createOptionItems=t.getCreateItem=t.triggerInputEvent=t.triggerCustomEvent=t.ifTrueDataAttr=t.createDataAttr=t.compareStringWithClearSpace=t.clearSpaceAndEmptyAttr=t.removeExtraSpaces=t.toCamelCase=void 0;var s=i(737);t.toCamelCase=function(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.removeExtraSpaces=function(e){return e.replace(/\s+/g," ").trim()};t.clearSpaceAndEmptyAttr=function(e){return e.replace(/\s+|=""/g,"")};t.compareStringWithClearSpace=function(e,i){return(0,t.clearSpaceAndEmptyAttr)(e)===(0,t.clearSpaceAndEmptyAttr)(i)};t.createDataAttr=function(e){return"data-".concat(e)};t.ifTrueDataAttr=function(e){return!!e&&("true"===e||"1"===e)},t.triggerCustomEvent=function(e,t,i){var s=new CustomEvent("simpSelect:".concat(t),{detail:i});e.dispatchEvent(s)},t.triggerInputEvent=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"change";try{var i=new Event(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(i)}catch(i){var s=new CustomEvent(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(s)}};t.getCreateItem=function(e,t){return{id:(t+1).toString(),position:e.index,title:e.innerHTML,value:e.getAttribute("value"),checked:e.selected,disabled:e.disabled,isShowFilter:!0}};t.createOptionItems=function(e,t,i){return{isGroup:e,idGroup:t,items:i,isShowFilter:!0}};t.getCreateListItem=function(e,i,s){if(e instanceof HTMLOptionElement)return(0,t.createOptionItems)(s,i,[(0,t.getCreateItem)(e,1)],!0);var n=e.querySelectorAll("option"),o=[];n.forEach((function(e,i){o.push((0,t.getCreateItem)(e,i))}));var l=(0,t.createOptionItems)(s,i,o,!0);return e instanceof HTMLOptGroupElement&&(l.titleGroup=e.label||"",l.isDisabledGroup=e.disabled||!1),l};t.getClass=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.initClass,n=t?"--":"__";return"".concat(i).concat(n).concat(e)};t.compareObj=function(e,t){return JSON.stringify(e)===JSON.stringify(t)};t.cloneObj=function(e){return JSON.parse(JSON.stringify(e))};t.createButton=function(){var e=document.createElement("button");return e.type="button",e.tabIndex=-1,e};t.decodeHtmlEntities=function(e){var t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}},972:function(e,t){function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function n(e,t,s){return(t=function(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}Object.defineProperty(t,"__esModule",{value:!0}),t.store=void 0,t.store=function(e){var t={},i={},o=[],l=function(e){return e?e in t?t[e]:null:t},a=function(e,l){var a=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},t),r=t[e]||0==t[e]?t[e]:null;t[e]=l,e in i&&i[e].forEach((function(e){return e(l,r,t)})),o.forEach((function(i){return i(e,a,t)}))};return e&&Object.keys(e).forEach((function(t){a(t,e[t])})),{getState:l,setState:a,subscribe:function(e,t){e in i||(i[e]=[]),i[e].push(t);var s=l(e);return t(s,null,l()),function(){i[e]=i[e].filter((function(e){return e!==t}))}},subscribeAll:function(e){return o.push(e),e(null,null,l()),function(){o=o.filter((function(t){return t!==e}))}},unSubscribe:function(e,t){e in i&&(i[e]=i[e].filter((function(e){return e!==t})))}}}},181:function(e,t,i){i.r(t)}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,i),o.exports}i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return function(){var e=s;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function o(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(t){a(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function l(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,r(s.key),s)}}function a(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function r(e){var i=function(e,i){if("object"!==t(e)||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,i||"default");if("object"!==t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"===t(i)?i:String(i)}var c=i(737),h=i(679),u=i(874);i(181);var p=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"callCount",Date.now()),a(this,"countInit",0),a(this,"$selects",[]),a(this,"options",void 0),a(this,"nameMarkTransform",(0,h.toCamelCase)(c.nameMark)),a(this,"dataNameMark",(0,h.createDataAttr)(c.nameMark)),a(this,"isNative",void 0),t||(t="select"),this.options=o(o({},c.simpleSelectionOptions),i),"string"==typeof t?this.init(Array.from(document.querySelectorAll(t))):t instanceof HTMLSelectElement?this.init([t]):t instanceof NodeList?this.init(Array.from(t)):Array.isArray(t)?this.init(t):console.warn("Wrong selector: ",t)}var t,i,s;return t=e,(i=[{key:"detectMobile",value:function(){if(this.options.detectNative)this.isNative=this.options.detectNative();else{for(var e=navigator.userAgent||navigator.vendor||window.opera,t=!1,i=0;i<this.options.nativeOnDevice.length;i++)e.toString().toLowerCase().indexOf(this.options.nativeOnDevice[i].toLowerCase())>0&&this.options.nativeOnDevice[i]&&(t=!0);this.isNative=t}}},{key:"init",value:function(e){var t=this;this.detectMobile(),e.forEach((function(e){t.build(e)}))}},{key:"createMethods",value:function(e){var t=this;return{getInstance:function(){return e},getHistory:function(){return e.history},getHistoryLast:function(){return e.history.length?e.history[e.history.length-1]:null},getHistoryFirst:function(){return e.history.length?e.history[0]:null},getNativeSelect:function(){return e.getSelect()},reload:function(){t.rebuild(e)},update:function(){e.updateHTML()},detach:function(){t.detach(e)}}}},{key:"setMethods",value:function(e){e.$select[c.nameSelect]=this.createMethods(e)}},{key:"setMethodsClear",value:function(e){delete e.$select[c.nameSelect]}},{key:"build",value:function(e){if(this.nameMarkTransform in e.dataset)console.warn("This element has already been initialized",e);else{this.countInit+=1;var t,i="".concat(this.callCount,"-").concat(this.countInit);e.setAttribute(this.dataNameMark,i),e.multiple&&!e.size&&this.options.isSetAttributeSizeMultiple&&e.setAttribute("size",(null===(t=this.options.attributeSizeMultiple)||void 0===t?void 0:t.toString())||"1");var s=new u.SimpleSelectItem(e,this.options,{id:i,isNative:this.isNative});this.$selects.push(s),this.setMethods(s)}}},{key:"detach",value:function(e){e.detachItem(),e.$select.removeAttribute(this.dataNameMark),this.setMethodsClear(e),this.$selects=this.$selects.filter((function(t){return t!==e}))}},{key:"rebuild",value:function(e){var t=e.$select;this.detach(e),this.build(t)}},{key:"getSelects",value:function(){return this.$selects}},{key:"getSelectFirst",value:function(){return this.createMethods(this.$selects[0])}},{key:"getSelectById",value:function(e){var t=this.$selects.filter((function(t){return t.id===e}))[0];return t?this.createMethods(t):null}}])&&l(t.prototype,i),s&&l(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.default=p}(),s=s.default}()}));
@@ -49,6 +49,8 @@ export interface ISimpleSelectOptions {
49
49
  changeBodyLi?: (liBody: HTMLDivElement, option: HTMLOptionElement) => HTMLElement | string;
50
50
  isNeedFormatTitle?: boolean;
51
51
  formatTitle?: (title: string) => string;
52
+ isSetAttributeSizeMultiple?: boolean;
53
+ attributeSizeMultiple?: number;
52
54
  }
53
55
  export interface IItemLocalOptions {
54
56
  id: string;
package/docs/index.html CHANGED
@@ -9,8 +9,8 @@
9
9
 
10
10
  <link rel="stylesheet" href="./style.css">
11
11
 
12
- <link rel="stylesheet" href="https://unpkg.com/simp-select@1.1.7/dist/style.css">
13
- <script src="https://unpkg.com/simp-select@1.1.7/dist/simpleSelect.js"></script>
12
+ <link rel="stylesheet" href="https://unpkg.com/simp-select@1.1.23/dist/style.css">
13
+ <script src="https://unpkg.com/simp-select@1.1.23/dist/simpleSelect.js"></script>
14
14
 
15
15
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
16
16
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simp-select",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "simp-select - this plugin replaces the select",
5
5
  "main": "dist/simpleSelect.js",
6
6
  "types": "dist/simpleSelect.d.ts",
@@ -45,6 +45,8 @@ export const simpleSelectionOptions: ISimpleSelectOptions = {
45
45
  isScrollToCheckedFirst: true,
46
46
  isScrollToCheckedAlways: false,
47
47
 
48
+ isSetAttributeSizeMultiple: true,
49
+ attributeSizeMultiple: 1,
48
50
  };
49
51
 
50
52
  export const nameSelect = 'SimpSelect';
@@ -61,6 +61,7 @@
61
61
  <div class="item">
62
62
  <select
63
63
  multiple
64
+ size="1"
64
65
  placeholder="custom width float"
65
66
  data-simple-float-width="1000"
66
67
  >
@@ -126,6 +126,13 @@ export default class SimpleSelect {
126
126
  this.countInit += 1;
127
127
  const id = `${this.callCount}-${this.countInit}`;
128
128
  select.setAttribute(this.dataNameMark, id);
129
+ if (
130
+ select.multiple
131
+ && !select.size
132
+ && this.options.isSetAttributeSizeMultiple
133
+ ) {
134
+ select.setAttribute('size', this.options.attributeSizeMultiple?.toString() || '1');
135
+ }
129
136
  // this.$selects.push(select);
130
137
 
131
138
  const newSelect = new SimpleSelectItem(select, this.options, {
@@ -67,6 +67,9 @@ export interface ISimpleSelectOptions {
67
67
 
68
68
  isNeedFormatTitle?: boolean;
69
69
  formatTitle?: (title:string) => string;
70
+
71
+ isSetAttributeSizeMultiple?: boolean; // default true
72
+ attributeSizeMultiple?: number; // default 1
70
73
  }
71
74
  // export interface ISimpleSelectOptions extends Required<ISimpleSelectProps> {
72
75
  // }