simp-select 1.0.6 → 1.0.7

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,7 +17,7 @@ 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.0.6/dist/simpleSelect.js" />
20
+ <script src="https://unpkg.com/simp-select@1.0.7/dist/simpleSelect.js" />
21
21
  Or get last version
22
22
  <script src="https://unpkg.com/simp-select" />
23
23
  ```
@@ -38,47 +38,53 @@ the variable `SimpSelect` attached to `window` or `this` depending on what envir
38
38
  ## API
39
39
  #### `new ScrollToVertical(selector, <options>)`
40
40
 
41
- | Property | Value |
42
- |-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43
- | **selector**(required) | string(css selector), HTMLSelectElement, HTMLSelectElement(Array, HTMLSelectElement) |
44
- | **OPTIONS:** | |
45
- | **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> |
46
- | **isSearch**:boolean* | <p>default: **false** </p> Show input for filter items <p>Or - `data-simple-select-search="true"` - in select</p> |
47
- | **isSearchInDropdown**:boolean* | <p>default: **false** </p> Show search input inside dropdown <p>Or - `data-simple-select-search-dropdown="true"` - in select</p> |
48
- | **isConfirmInMulti**:boolean* | <p>default: **false** </p> Show buttons `OK` and `Cansel`. Only Multiselect <p>Or `data-simple-is-confirm="true" - in select`</> |
49
- | **isConfirmInMultiOkClickOutside**:boolean | <p>default: **false** </p> Click outside like click by button `OK`. Only if `isConfirmInMulti=true` |
50
- | **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 ). |
51
- | **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> |
52
- | **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`</p> |
53
- | **sepChars**:string | <p>default: **,** </p> Separator for selected element. Show |
54
- | **selectAll**:boolean* | <p>default: **false**</p> Show button - `Select all` <p>Or `data-simple-select-all="true"` in select</p> |
55
- | **selectAllAfterClose**:boolean | <p>default: **false**</p> Close dropdown after click for `select all` |
56
- | **resetAll**:boolean* | <p>default: **false**</p> Show button - `Reset all` <p>Or `data-simple-reset-all="true"` in select</p> |
57
- | **resetAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `Reset all` |
58
- | **isCloneClass**:boolean | <p>default: **true**</p> Clone class from native select to wrapper created select |
59
- | **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> |
60
- | **detectNative**:function | <p>default: **none**</p> Return `true` if need rendering native select |
61
- | **changeBodyLi**:function | <p>default: **none**</p> Custom <li>(body) item renderer |
62
- | **locale**:{key: string} | <p>default: **simpleSelectLocale** **</p> Object of locales. ** |
63
- | ***Options only DOM elements*** | |
64
- | **data-simple-placeholder="text": Select** | Replace default placeholder (locale.title) |
65
- | **data-simple-item-html-before="<div>before</div>: Select** | Add HTML before content (for item Li) |
66
- | **data-simple-item-html-after="<div>after</div>": Select** | Add HTML after content (for item Li) |
67
- | **data-simple-add-classes="class1 class2": Select** | Add classes for wrapper SimpSelect |
68
- | **data-simple-html-before="<span>before</span>": option** | Add HTML before content (for item Li) |
69
- | **data-simple-html-after="<span>after</span>": option** | Add HTML after content (for item Li) |
70
- | ***Callbacks*** | |
71
- | **callbackInitialization: (item:SimpleSelectItem) => void** | Before initialization |
72
- | **callbackInitialized**:(item:SimpleSelectItem) => void; | After initialization |
73
- | **callbackOpen**: (item:SimpleSelectItem) => void; | Open dropdown |
74
- | **callbackClose**:Open dropdown | Close dropdown |
75
- | **callbackDestroyInit**: (item:SimpleSelectItem) => void; | Before destroy SimpSelect |
76
- | **callbackDestroy**: (item:SimpleSelectItem) => void; | After destroy SimpSelect |
77
- | **callbackChangeSelect** :(e: Event, item:SimpleSelectItem) => void; | Change SimpSelect (change options) |
78
- | ***Methods*** | |
79
- | **reload**:select(DomElement).SimSelect.reload() | Reload SimpSelect. |
80
- | **update**:select(DomElement).SimSelect.update() | Update SimpSelect. |
81
- | **detach**:select(DomElement).SimSelect.detach() | detach SimpSelect. |
41
+ | Property | Value |
42
+ |----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43
+ | **selector**(required) | string(css selector), HTMLSelectElement, HTMLSelectElement(Array, HTMLSelectElement) |
44
+ | **OPTIONS:** | |
45
+ | **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> |
46
+ | **isSearch**:boolean* | <p>default: **false** </p> Show input for filter items <p>Or - `data-simple-select-search="true"` - in select</p> |
47
+ | **isSearchInDropdown**:boolean* | <p>default: **false** </p> Show search input inside dropdown <p>Or - `data-simple-select-search-dropdown="true"` - in select</p> |
48
+ | **isConfirmInMulti**:boolean* | <p>default: **false** </p> Show buttons `OK` and `Cansel`. Only Multiselect <p>Or `data-simple-is-confirm="true" - in select`</> |
49
+ | **isConfirmInMultiOkClickOutside**:boolean | <p>default: **false** </p> Click outside like click by button `OK`. Only if `isConfirmInMulti=true` |
50
+ | **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 ). |
51
+ | **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> |
52
+ | **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`</p> |
53
+ | **sepChars**:string | <p>default: **,** </p> Separator for selected element. Show |
54
+ | **selectAll**:boolean* | <p>default: **false**</p> Show button - `Select all` <p>Or `data-simple-select-all="true"` in select</p> |
55
+ | **selectAllAfterClose**:boolean | <p>default: **false**</p> Close dropdown after click for `select all` |
56
+ | **resetAll**:boolean* | <p>default: **false**</p> Show button - `Reset all` <p>Or `data-simple-reset-all="true"` in select</p> |
57
+ | **resetAllAfterClose**:boolean | <p>default: **true**</p> Close dropdown after click for `Reset all` |
58
+ | **isCloneClass**:boolean | <p>default: **true**</p> Clone class from native select to wrapper created select |
59
+ | **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> |
60
+ | **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> |
61
+ | **detectNative**:function | <p>default: **none**</p> Return `true` if need rendering native select |
62
+ | **changeBodyLi**:function | <p>default: **none**</p> Custom <li>(body) item renderer |
63
+ | **locale**:{key: string} | <p>default: **simpleSelectLocale** **</p> Object of locales. ** |
64
+ | ***Options only DOM elements*** | |
65
+ | **data-simple-placeholder="text": Select** | Replace default placeholder (locale.title) |
66
+ | **data-simple-item-html-before="<div>before</div>: Select** | Add HTML before content (for item Li) |
67
+ | **data-simple-item-html-after="<div>after</div>": Select** | Add HTML after content (for item Li) |
68
+ | **data-simple-add-classes="class1 class2": Select** | Add classes for wrapper SimpSelect |
69
+ | **data-simple-html-before="<span>before</span>": option** | Add HTML before content (for item Li) |
70
+ | **data-simple-html-after="<span>after</span>": option** | Add HTML after content (for item Li) |
71
+ | **data-simple-show-checkbox: Select** | Show checkbox in item (Li) (for single select) |
72
+ | ***Callbacks*** | |
73
+ | **callbackInitialization: (item:SimpleSelectItem) => void** | Before initialization |
74
+ | **callbackInitialized**:(item:SimpleSelectItem) => void; | After initialization |
75
+ | **callbackOpen**: (item:SimpleSelectItem) => void; | Open dropdown |
76
+ | **callbackClose**:Open dropdown | Close dropdown |
77
+ | **callbackDestroyInit**: (item:SimpleSelectItem) => void; | Before destroy SimpSelect |
78
+ | **callbackDestroy**: (item:SimpleSelectItem) => void; | After destroy SimpSelect |
79
+ | **callbackChangeSelect** :(e: Event, item:SimpleSelectItem) => void; | Change SimpSelect (change options) |
80
+ | ***Methods*** | |
81
+ | **reload**:select(DomElement).SimpSelect.reload() | Reload SimpSelect. |
82
+ | **update**:select(DomElement).SimpSelect.update() | Update list (ul in dropdown) |
83
+ | **detach**:select(DomElement).SimpSelect.detach() | Detach SimpSelect. |
84
+ | ***const simpleSelect = new SimpleSelect('select')*** | Instance of the SimpleSelect plugin object |
85
+ | **getSelectById('ID')**:simpleSelect.getSelectById('ID') | Get item SimpSelect for ID (data-simple-select-init="ID" - dem element select) |
86
+ | **getSelectFirst()**:simpleSelect.getSelectFirst() | Get first item SimpSelect |
87
+ | **getSelects()**:simpleSelect.getSelects() | Get list SimpSelect |
82
88
 
83
89
  **Data attributes in DOM element(select) more important than initialization options.*
84
90
  ```
@@ -1,6 +1,6 @@
1
1
  import { ISimpleSelectLocale, ISimpleSelectOptions } from '../types/simpleSelect.types';
2
2
  export declare const simpleSelectLocale: ISimpleSelectLocale;
3
3
  export declare const simpleSelectionOptions: ISimpleSelectOptions;
4
- export declare const nameSelect = "SimSel";
4
+ export declare const nameSelect = "SimpSelect";
5
5
  export declare const nameMark = "simple-select-init";
6
6
  export declare const initClass = "SimpleSel";
@@ -21,7 +21,7 @@
21
21
  }
22
22
  .item {
23
23
  width: 250px;
24
- }</style><body><div id="app"></div><div class="items"><div class="item"><select id="select_first" disabled="disabled" 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="false" 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-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"><optgroup label="Группа 1"><option value="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 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><script>const sel = new SimpleSelect('select', {
24
+ }</style><body><div id="app"></div><div class="items"><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-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"><optgroup label="Группа 1"><option value="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 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><script>const sel = new SimpleSelect('select', {
25
25
  // callbackOpen: (item) => {
26
26
  // console.log('open', item);
27
27
  // },
@@ -15,7 +15,7 @@ export default class SimpleSelect {
15
15
  detectMobile(): void;
16
16
  private init;
17
17
  createMethods(select: SimpleSelectItem): {
18
- getInstance: () => HTMLSelectElement;
18
+ getNativeSelect: () => HTMLSelectElement;
19
19
  reload(): void;
20
20
  update(): void;
21
21
  detach(): void;
@@ -27,13 +27,13 @@ export default class SimpleSelect {
27
27
  rebuild(selectsItems: SimpleSelectItem): void;
28
28
  getSelects(): SimpleSelectItem[];
29
29
  getSelectFirst(): {
30
- getInstance: () => HTMLSelectElement;
30
+ getNativeSelect: () => HTMLSelectElement;
31
31
  reload(): void;
32
32
  update(): void;
33
33
  detach(): void;
34
34
  };
35
35
  getSelectById(id: string): {
36
- getInstance: () => HTMLSelectElement;
36
+ getNativeSelect: () => HTMLSelectElement;
37
37
  reload(): void;
38
38
  update(): void;
39
39
  detach(): void;
@@ -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(){var e={737:function(e,t){"use strict";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",cansel:"Cansel",selectAll:"Select all",resetAll:"Reset all"},t.simpleSelectionOptions={isSearch:!1,isSearchInDropdown:!1,countShowSelected:3,isConfirmInMulti:!1,isConfirmInMultiOkClickOutside:!1,nativeOnDevice:["Android","BlackBerry","iPhone","iPad","iPod","Opera Mini","IEMobile","Silk"],locale:t.simpleSelectLocale,sepChars:",",isUp:!1,floatWidth:767,isCloneClass:!0,selectAll:!1,selectAllAfterClose:!0,resetAll:!1,resetAllAfterClose:!0},t.nameSelect="SimSel";t.nameMark="".concat("simple-select-","init"),t.initClass="SimpleSel"},874:function(e,t,i){"use strict";function n(e){return n="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},n(e)}function s(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h(n.key),n)}}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,s=c(e);if(t){var o=c(this).constructor;i=Reflect.construct(s,arguments,o)}else i=s.apply(this,arguments);return function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return r(e)}(this,i)}}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){return a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n){var s=Object.getOwnPropertyDescriptor(n,t);return s.get?s.get.call(arguments.length<3?e:i):s.value}},a.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t,i){return(t=h(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function h(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!==n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(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,n,h=l(d);function d(e,t,i){var n,s;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),u(r(s=h.call(this,e,t,i)),"closeOutsideHandler",void 0),u(r(s),"closeEscHandler",void 0),u(r(s),"changeListener",void 0),u(r(s),"searchHandler",void 0),u(r(s),"handleResize",void 0),u(r(s),"mql",null),u(r(s),"countOpen",0),u(r(s),"multiDebounceTime",0),u(r(s),"timeoutDebounceId",null),!e)throw Error("Select is required");return s.init(),a((n=r(s),c(d.prototype)),"initDom",n).call(n),s.initAfterDom(),s}return t=d,i=[{key:"init",value:function(){var e=this;this.changeListener=this.changeListenerInit.bind(this),this.$select.addEventListener("change",this.changeListener),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){e.toggleOpenHandler(),!t&&e.options.isConfirmInMulti&&e.createList(),t||e.elemInputSearch&&(e.elemInputSearch.value="",e.state.setState("filterStr",""))})),this.state.subscribe("filterStr",(function(t){e.filterList(t)})),this.isNative||(this.elemTopBody.onclick=this.clickToggleOpen.bind(this),this.elemTopBody.onkeyup=this.clickToggleOpen.bind(this))}},{key:"handleResizeInit",value:function(e){e&&(e.matches?this.state.setState("isFloat",!0):this.state.setState("isFloat",!1))}},{key:"initAfterDom",value:function(){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.isMulti&&!this.options.isConfirmInMulti&&((0,p.toCamelCase)("simple-debounce-time")in this.$select.dataset?this.multiDebounceTime=Number(this.$select.dataset[(0,p.toCamelCase)("simple-debounce-time")]):(this.options.debounceTime||0===this.options.debounceTime)&&(this.multiDebounceTime=this.options.debounceTime)),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))}},{key:"debounce",value:function(e,t){var i=this;return function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];i.timeoutDebounceId&&clearTimeout(i.timeoutDebounceId),i.timeoutDebounceId=setTimeout((function(){e.apply(void 0,s),i.timeoutDebounceId=null}),t)}}},{key:"confirmOkHandler",value:function(e){e.preventDefault(),this.confirmOkBuild()}},{key:"confirmOkBuild",value:function(){var e=this.$select.options;this.elemListBody&&(this.elemListBody.querySelectorAll("[data-sel-position]").forEach((function(t){var i=parseInt(t.dataset[(0,p.toCamelCase)("sel-position")],10);if(i||0===i){var n=e[i];n&&!n.disabled&&(n.selected="true"===t.dataset[(0,p.toCamelCase)("sel-opt-checked")])}})),this.state.setState("isOpen",!1),this.triggerInit())}},{key:"confirmNoHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1)}},{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){e.disabled||(e.selected=!0)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit()}},{key:"resetAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){e.disabled||(e.selected=!1)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit()}},{key:"triggerSetup",value:function(e){if(0===e.button){var t=e.target.closest("li");t&&this.changeClickItem(t)}}},{key:"changeClickItem",value:function(e){if(e){var t=Number(e.dataset[(0,p.toCamelCase)("sel-position")])||0,i=this.$select.options[t];i&&!i.disabled&&(this.isMulti?this.options.isConfirmInMulti||this.isFloatWidth?"true"===e.dataset[(0,p.toCamelCase)("sel-opt-checked")]?(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="false",e.classList.remove("SimpleSel__list_item--checked")):(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="true",e.classList.add("SimpleSel__list_item--checked")):(i.selected=!i.selected,this.createList(),this.multiDebounceChange()):(i.selected=!i.selected,this.createList(),this.state.setState("isOpen",!1),this.triggerInit()))}}},{key:"multiDebounceChange",value:function(){this.triggerInit()}},{key:"triggerInit",value:function(){(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){if("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)),"Enter"===e.key){var t=e.target;t&&(0,p.toCamelCase)("sel-opt-item")in t.dataset&&(e.preventDefault(),e.stopPropagation(),this.changeClickItem(t))}}},{key:"keyBoardChangeChecked",value:function(e){var t=this.elemListBody.querySelectorAll('[data-sel-position]:not([data-sel-opt-disabled="true"])');if(t.length){var i,n=0;t.forEach((function(e,t){document.activeElement===e&&(n=t,i=e),e.removeAttribute("tabindex")})),(i=i?e?t[n+1]||t[0]:t[n-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:"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&&this.elemInputSearch.focus(),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.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:"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?i.forEach((function(e,i){t.push((0,p.getCreateListItem)(e,(i+1).toString(),!0))})):t.push((0,p.getCreateListItem)(this.$select,"1",!1)),e){var n=this.state.getState("items");(0,p.compareObj)(n,t)||this.state.setState("items",t)}else this.state.setState("items",t)}},{key:"filterList",value:function(e){e=e.toLowerCase();var t=(0,p.cloneObj)(this.state.getState("items"));t.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})),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&&s(t.prototype,i),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),d}(i(844).SimpleSelectItemDOM);t.SimpleSelectItem=d},844:function(e,t,i){"use strict";function n(e){return n="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},n(e)}function s(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,n=new Array(t);i<t;i++)n[i]=e[i];return n}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function r(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var s=i.call(e,t||"default");if("object"!==n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleSelectItemDOM=void 0;var c=i(679),u=i(972),h=i(737),p=function(){function e(t,i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"options",void 0),r(this,"$select",void 0),r(this,"id",void 0),r(this,"titlePlaceholder",void 0),r(this,"isDisabled",!1),r(this,"isMulti",void 0),r(this,"state",(0,u.store)({items:[],isOpen:!1,filterStr:"",isFloat:!1})),r(this,"classSelectInit",(0,c.getClass)("select_init")),r(this,"isNative",void 0),r(this,"elemWrap",document.createElement("div")),r(this,"elemTop",document.createElement("div")),r(this,"elemTopBody",document.createElement("div")),r(this,"elemDropDown",null),r(this,"elemDropDownClose",null),r(this,"elemListBody",null),r(this,"elemInputSearch",null),r(this,"elemTitle",void 0),r(this,"confirmOk",null),r(this,"confirmNo",null),r(this,"elemControl",null),r(this,"elemSelectAll",null),r(this,"elemResetAll",null),r(this,"cloneClasses",""),r(this,"isShowCheckbox",!1),r(this,"bodyLiHTMLBeforeFromSelect",null),r(this,"bodyLiHTMLAfterFromSelect",null),r(this,"isFloatWidth",!1),r(this,"bodyOpenClass","".concat(h.initClass,"--body_open"));var s=n.id,o=n.isNative;this.$select=t,this.isMulti=t.multiple,this.id=s,this.isNative=o,this.options=(0,c.cloneObj)(i),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),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,n;return t=e,(i=[{key:"optionOverride",value:function(){var e=(0,c.toCamelCase)("simple-placeholder");this.$select.dataset[e]?this.titlePlaceholder=this.$select.dataset[e]||"":this.titlePlaceholder=this.options.locale.title;var t=(0,c.toCamelCase)("simple-reset-all");if(t in this.$select.dataset){var i=this.$select.dataset[t];this.options.resetAll=!("false"===i||"0"===i)}if(this.$select.hasAttribute("data-simple-select-all")){var n=this.$select.getAttribute("data-simple-select-all");this.options.selectAll=(0,c.ifTrueDataAttr)(n)}var s=this.$select.dataset[(0,c.toCamelCase)("simple-show-checkbox")];this.isMulti?this.isShowCheckbox=!(s&&!(0,c.ifTrueDataAttr)(s)):"true"===s&&(this.isShowCheckbox=!0);var o=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-before")];o&&(this.bodyLiHTMLBeforeFromSelect=o);var l=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-after")];l&&(this.bodyLiHTMLAfterFromSelect=l),this.$select.hasAttribute("data-simple-up")&&(this.options.isUp=(0,c.ifTrueDataAttr)(this.$select.getAttribute("data-simple-up")))}},{key:"initDom",value:function(){var e=this;this.createList(!1),this.createHTML(),this.state.subscribe("items",(function(t){e.createListHTML(),e.createTitleHTML()})),this.state.subscribe("isOpen",(function(t){e.createListHTML(),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):e.elemWrap.classList.remove(i)}))}},{key:"toggleTabIndex",value:function(e){var t=e?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.elemTop.appendChild(this.elemTopBody);var e=h.initClass;this.options.isCloneClass&&(e+=" ".concat(this.cloneClasses)),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.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.elemDropDown=document.createElement("div"),this.elemDropDown.className=(0,c.getClass)("body"),this.elemListBody=document.createElement("ul"),this.elemListBody.className=(0,c.getClass)("list"),this.elemWrap.appendChild(this.elemDropDown),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,t=document.createElement("div"),i=(0,c.getClass)("bottom_control");this.confirmOk=(0,c.createButton)(),this.confirmNo=(0,c.createButton)(),t.appendChild(this.confirmOk),t.appendChild(this.confirmNo),this.confirmOk.innerHTML=this.options.locale.ok,this.confirmNo.innerHTML=this.options.locale.cansel,this.confirmOk.className="".concat(i," ").concat((0,c.getClass)("ok",!0,i)),this.confirmNo.className="".concat(i," ").concat((0,c.getClass)("no",!0,i));var n=(0,c.getClass)("bottom_controls");this.options.isConfirmInMulti||(n+=" ".concat((0,c.getClass)("hide",!0,n))),t.className=n,null===(e=this.elemDropDown)||void 0===e||e.appendChild(t)}},{key:"createTitleHTML",value:function(){var e=this;this.elemTitle||(this.elemTitle=document.createElement("div"),this.elemTitle.className=(0,c.getClass)("title"),this.elemTopBody.insertBefore(this.elemTitle,this.elemTopBody.childNodes[0]));var t=this.getChecked();this.elemTop.title="";var i=!t.length,n=this.titlePlaceholder;if(t.length){var s="";t.forEach((function(t,i){0!==i&&(s+="".concat(e.options.sepChars,'<span class="').concat((0,c.getClass)("sep_space",!0),'">&nbsp;</span>')),s+="".concat(t.title)})),this.elemTop.title=s;var o=this.options.countShowSelected,l=Number(this.$select.dataset.simpleCountShowsSelected);l&&l>0&&(o=l),t.length>o?(n="".concat(this.options.locale.selected," ").concat(t.length),this.$select.querySelectorAll("option").length===t.length&&(n+=" (".concat(this.options.locale.all,")"))):s&&(n=s)}this.elemTitle.innerHTML=n,i?(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:"createListHTML",value:function(){var e=this;if(this.elemListBody){var t="",i=0,n=0,s=0;this.state.getState("items").forEach((function(o){if(o.isGroup){var l=e.createLi(o),r=l.result,a=l.countShow,u=l.countChecked,h=l.countCheckedFull;t+='<div class="'.concat((0,c.getClass)("group_items"),'">'),t+=r,t+="</div>",n+=u,i+=a,s+=h}else{var p=e.createLi(o),d=p.result,m=p.countShow,f=p.countChecked,b=p.countCheckedFull;t+=d,i+=m,n+=f,s+=b}}));var o=this.state.getState("filterStr");o&&o.length&&0===i&&(t='<div class="'.concat((0,c.getClass)("no_match"),'">'),t="".concat(this.options.locale.noSearch,' "').concat(o,'"'),t+="</div>"),this.elemWrap.dataset.countChecked=n.toString(),this.elemWrap.dataset.countCheckedFull=s.toString(),this.isMulti&&(this.elemWrap.dataset.checkAllMulti=this.$select.options.length===n?"yes":"no"),this.elemListBody.innerHTML=t}}},{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="text",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(h.initClass,"_name_").concat(this.id);var i=(0,c.getClass)("search");t?this.elemDropDown&&(this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("dropdown",!0,i)),this.elemDropDown.insertBefore(this.elemInputSearch,this.elemDropDown.childNodes[0])):(this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("top",!0,i)),this.elemTop.appendChild(this.elemInputSearch)),this.inputSearchHandler()}}},{key:"getChecked",value:function(){var e=this.state.getState("items"),t=[];return e.forEach((function(e){t=[].concat(s(t),s(e.items.filter((function(e){return e.checked}))))})),t}},{key:"createLi",value:function(e){var t=this,i="",n=0,s=0,o=0;return e.isShowFilter?(e.isGroup&&(i+='<label class="'.concat((0,c.getClass)("group_title"),'">').concat(e.titleGroup,"</label>"),i+='<ul class="'.concat((0,c.getClass)("group"),'">')),e.items.forEach((function(l){if(l.isShowFilter){n++;var r=(0,c.getClass)("list_item"),a=r;l.checked&&(s++,a+=" ".concat((0,c.getClass)("checked",!0,r)),l.value&&o++),l.disabled&&(a+=" ".concat((0,c.getClass)("disabled",!0,r))),l.value||(a+=" ".concat((0,c.getClass)("not_value",!0,r)));var u='data-sel-group-id="'.concat(e.idGroup,'"');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-item",u+=' data-sel-opt-checked="'.concat(l.checked,'"'),u+=' data-sel-opt-disabled="'.concat(l.disabled,'"'),i+='<li class="'.concat(a,'" ').concat(u,">");var h=t.createLiBody(l,t.$select.options[l.position]);i+="string"==typeof h?h:h.outerHTML,i+="</li>"}})),e.isGroup&&(i+="</ul>"),{result:i,countShow:n,countChecked:s,countCheckedFull:o}):{result:i,countShow:n,countChecked:s,countCheckedFull:o}}},{key:"createLiBody",value:function(e,t){var i=document.createElement("div");i.className=(0,c.getClass)("list_item_body");var n="";return this.isShowCheckbox&&(n='<span class="'.concat((0,c.getClass)("list_item_icon"),'"></span>')),this.bodyLiHTMLBeforeFromSelect&&(n+=this.bodyLiHTMLBeforeFromSelect),t.hasAttribute("data-simple-html-before")&&(n+=t.getAttribute("data-simple-html-before")),n+="".concat(e.title),this.bodyLiHTMLAfterFromSelect&&(n+=this.bodyLiHTMLAfterFromSelect),t.hasAttribute("data-simple-html-after")&&(n+=t.getAttribute("data-simple-html-after")),i.innerHTML=n,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")}}])&&l(t.prototype,i),n&&l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.SimpleSelectItemDOM=p},679:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createButton=t.cloneObj=t.compareObj=t.getClass=t.getCreateListItem=t.triggerInputEvent=t.ifTrueDataAttr=t.createDataAttr=t.toCamelCase=void 0;var n=i(737);t.toCamelCase=function(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))};t.createDataAttr=function(e){return"data-".concat(e)};t.ifTrueDataAttr=function(e){return!!e&&("true"===e||"1"===e)},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 n=new CustomEvent(t,{bubbles:!0,cancelable:!0});e.dispatchEvent(n)}};t.getCreateListItem=function(e,t,i){var n=e.querySelectorAll("option"),s=[];n.forEach((function(e,t){s.push({id:(t+1).toString(),position:e.index,title:e.innerHTML,value:e.getAttribute("value"),checked:e.selected,disabled:e.disabled,isShowFilter:!0})}));var o={isGroup:i,idGroup:t,items:s,isShowFilter:!0};return e instanceof HTMLOptGroupElement&&(o.titleGroup=e.label||"",o.isDisabledGroup=e.disabled||!1),o};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]:n.initClass,s=t?"--":"__";return"".concat(i).concat(s).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}},972:function(e,t){"use strict";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 n(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!==i(s))return s;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:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,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},r=function(e,l){var r=function(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){s(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}({},t),a=t[e]||0==t[e]?t[e]:null;t[e]=l,e in i&&i[e].forEach((function(e){return e(l,a,t)})),o.forEach((function(i){return i(e,r,t)}))};return e&&Object.keys(e).forEach((function(t){r(t,e[t])})),{getState:l,setState:r,subscribe:function(e,t){e in i||(i[e]=[]),i[e].push(t);var n=l(e);return t(n,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){"use strict";i.r(t)},245:function(){var e,t,i,n;Array.from||(Array.from=(e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},i=Math.pow(2,53)-1,n=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),i)},function(e){var i=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var s,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!t(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}for(var l,r=n(i.length),a=t(this)?Object(new this(r)):new Array(r),c=0;c<r;)l=i[c],a[c]=o?void 0===s?o(l,c):o.call(s,l,c):l,c+=1;return a.length=r,a})),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var i,n;if(null==this)throw new TypeError(" this is null or not defined");var s=Object(this),o=s.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(i=t),n=0;n<o;){var l;n in s&&(l=s[n],e.call(i,l,n,s)),n++}}),"undefined"!=typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){t=t||window;for(var i=0;i<this.length;i++)e.call(t,this[i],i,this)}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}e.prototype=window.Event.prototype,window.CustomEvent=e}()}},t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n](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 n={};return function(){"use strict";var e=n;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 s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function o(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){r(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}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function r(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(e){var i=function(e,i){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,i||"default");if("object"!==t(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(e,"string");return"symbol"===t(i)?i:String(i)}i(245);var c=i(737),u=i(679),h=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),r(this,"callCount",Date.now()),r(this,"countInit",0),r(this,"$selects",[]),r(this,"options",void 0),r(this,"nameMarkTransform",(0,u.toCamelCase)(c.nameMark)),r(this,"dataNameMark",(0,u.createDataAttr)(c.nameMark)),r(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,n;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.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 h.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),n&&l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();e.default=p}(),n=n.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(){var e={737:function(e,t){"use strict";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",cansel:"Cansel",selectAll:"Select all",resetAll:"Reset all"},t.simpleSelectionOptions={isSearch:!1,isSearchInDropdown:!1,countShowSelected:3,isOnlyPlaceholder:!1,isConfirmInMulti:!1,isConfirmInMultiOkClickOutside:!1,nativeOnDevice:["Android","BlackBerry","iPhone","iPad","iPod","Opera Mini","IEMobile","Silk"],locale:t.simpleSelectLocale,sepChars:",",isUp:!1,floatWidth:767,isCloneClass:!0,selectAll:!1,selectAllAfterClose:!0,resetAll:!1,resetAllAfterClose:!0},t.nameSelect="SimpSelect";t.nameMark="".concat("simple-select-","init"),t.initClass="SimpleSel"},874:function(e,t,i){"use strict";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,h(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 r(e)}(this,i)}}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){return a="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}},a.apply(this,arguments)}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function u(e,t,i){return(t=h(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function h(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,h=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),u(r(n=h.call(this,e,t,i)),"closeOutsideHandler",void 0),u(r(n),"closeEscHandler",void 0),u(r(n),"changeListener",void 0),u(r(n),"searchHandler",void 0),u(r(n),"handleResize",void 0),u(r(n),"mql",null),u(r(n),"countOpen",0),u(r(n),"multiDebounceTime",0),u(r(n),"timeoutDebounceId",null),!e)throw Error("Select is required");return n.init(),a((s=r(n),c(d.prototype)),"initDom",s).call(s),n.initAfterDom(),n}return t=d,i=[{key:"init",value:function(){var e=this;this.changeListener=this.changeListenerInit.bind(this),this.$select.addEventListener("change",this.changeListener),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){e.toggleOpenHandler(),!t&&e.options.isConfirmInMulti&&e.createList(),t||e.elemInputSearch&&(e.elemInputSearch.value="",e.state.setState("filterStr",""))})),this.state.subscribe("filterStr",(function(t){e.filterList(t)})),this.isNative||(this.elemTopBody.onclick=this.clickToggleOpen.bind(this),this.elemTopBody.onkeyup=this.clickToggleOpen.bind(this))}},{key:"handleResizeInit",value:function(e){e&&(e.matches?this.state.setState("isFloat",!0):this.state.setState("isFloat",!1))}},{key:"initAfterDom",value:function(){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.isMulti&&!this.options.isConfirmInMulti&&((0,p.toCamelCase)("simple-debounce-time")in this.$select.dataset?this.multiDebounceTime=Number(this.$select.dataset[(0,p.toCamelCase)("simple-debounce-time")]):(this.options.debounceTime||0===this.options.debounceTime)&&(this.multiDebounceTime=this.options.debounceTime)),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))}},{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.$select.options;this.elemListBody&&(this.elemListBody.querySelectorAll("[data-sel-position]").forEach((function(t){var i=parseInt(t.dataset[(0,p.toCamelCase)("sel-position")],10);if(i||0===i){var s=e[i];s&&!s.disabled&&(s.selected="true"===t.dataset[(0,p.toCamelCase)("sel-opt-checked")])}})),this.state.setState("isOpen",!1),this.triggerInit())}},{key:"confirmNoHandler",value:function(e){e.preventDefault(),this.state.setState("isOpen",!1)}},{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){e.disabled||(e.selected=!0)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit()}},{key:"resetAllHandler",value:function(e){e.preventDefault(),Array.from(this.$select.options).forEach((function(e){e.disabled||(e.selected=!1)})),this.createList(),this.options.selectAllAfterClose&&this.state.setState("isOpen",!1),this.triggerInit()}},{key:"triggerSetup",value:function(e){if(0===e.button){var t=e.target.closest("li");t&&this.changeClickItem(t)}}},{key:"changeClickItem",value:function(e){if(e){var t=Number(e.dataset[(0,p.toCamelCase)("sel-position")])||0,i=this.$select.options[t];i&&!i.disabled&&(this.isMulti?this.options.isConfirmInMulti||this.isFloatWidth?"true"===e.dataset[(0,p.toCamelCase)("sel-opt-checked")]?(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="false",e.classList.remove("SimpleSel__list_item--checked")):(e.dataset[(0,p.toCamelCase)("sel-opt-checked")]="true",e.classList.add("SimpleSel__list_item--checked")):(i.selected=!i.selected,this.createList(),this.multiDebounceChange()):(i.selected=!i.selected,this.createList(),this.state.setState("isOpen",!1),this.triggerInit()))}}},{key:"multiDebounceChange",value:function(){this.triggerInit()}},{key:"triggerInit",value:function(){(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){if("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)),"Enter"===e.key){var t=e.target;t&&(0,p.toCamelCase)("sel-opt-item")in t.dataset&&(e.preventDefault(),e.stopPropagation(),this.changeClickItem(t))}}},{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:"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&&this.elemInputSearch.focus(),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.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:"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?i.forEach((function(e,i){t.push((0,p.getCreateListItem)(e,(i+1).toString(),!0))})):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:"filterList",value:function(e){e=e.toLowerCase();var t=(0,p.cloneObj)(this.state.getState("items"));t.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})),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){"use strict";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,a(s.key),s)}}function r(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(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),u=i(972),h=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),r(this,"options",void 0),r(this,"$select",void 0),r(this,"id",void 0),r(this,"titlePlaceholder",void 0),r(this,"isDisabled",!1),r(this,"isMulti",void 0),r(this,"state",(0,u.store)({items:[],isOpen:!1,filterStr:"",isFloat:!1})),r(this,"classSelectInit",(0,c.getClass)("select_init")),r(this,"isNative",void 0),r(this,"elemWrap",document.createElement("div")),r(this,"elemTop",document.createElement("div")),r(this,"elemTopBody",document.createElement("div")),r(this,"elemDropDown",null),r(this,"elemDropDownClose",null),r(this,"elemListBody",null),r(this,"elemInputSearch",null),r(this,"elemTitle",void 0),r(this,"confirmOk",null),r(this,"confirmNo",null),r(this,"elemControl",null),r(this,"elemSelectAll",null),r(this,"elemResetAll",null),r(this,"cloneClasses",""),r(this,"isShowCheckbox",!1),r(this,"bodyLiHTMLBeforeFromSelect",null),r(this,"bodyLiHTMLAfterFromSelect",null),r(this,"isFloatWidth",!1),r(this,"bodyOpenClass","".concat(h.initClass,"--body_open"));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.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),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");if(this.$select.dataset[e]?this.titlePlaceholder=this.$select.dataset[e]||"":this.titlePlaceholder=this.options.locale.title,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 t=this.$select.getAttribute("data-simple-select-all");this.options.selectAll=(0,c.ifTrueDataAttr)(t)}var i=this.$select.dataset[(0,c.toCamelCase)("simple-show-checkbox")];this.isMulti?this.isShowCheckbox=!(i&&!(0,c.ifTrueDataAttr)(i)):"true"===i&&(this.isShowCheckbox=!0);var s=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-before")];s&&(this.bodyLiHTMLBeforeFromSelect=s);var n=this.$select.dataset[(0,c.toCamelCase)("simple-item-html-after")];n&&(this.bodyLiHTMLAfterFromSelect=n),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")))}},{key:"initDom",value:function(){var e=this;this.createList(!1),this.createHTML(),this.state.subscribe("items",(function(t){e.createListHTML(),e.createTitleHTML()})),this.state.subscribe("isOpen",(function(t){e.createListHTML(),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):e.elemWrap.classList.remove(i)}))}},{key:"toggleTabIndex",value:function(e){var t=e?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.elemTop.appendChild(this.elemTopBody);var e=h.initClass;this.options.isCloneClass&&(e+=" ".concat(this.cloneClasses)),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.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.elemDropDown=document.createElement("div"),this.elemDropDown.className=(0,c.getClass)("body"),this.elemListBody=document.createElement("ul"),this.elemListBody.className=(0,c.getClass)("list"),this.elemWrap.appendChild(this.elemDropDown),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,t=document.createElement("div"),i=(0,c.getClass)("bottom_control");this.confirmOk=(0,c.createButton)(),this.confirmNo=(0,c.createButton)(),t.appendChild(this.confirmOk),t.appendChild(this.confirmNo),this.confirmOk.innerHTML=this.options.locale.ok,this.confirmNo.innerHTML=this.options.locale.cansel,this.confirmOk.className="".concat(i," ").concat((0,c.getClass)("ok",!0,i)),this.confirmNo.className="".concat(i," ").concat((0,c.getClass)("no",!0,i));var s=(0,c.getClass)("bottom_controls");this.options.isConfirmInMulti||(s+=" ".concat((0,c.getClass)("hide",!0,s))),t.className=s,null===(e=this.elemDropDown)||void 0===e||e.appendChild(t)}},{key:"createTitleHTML",value:function(){var e=this;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=this.titlePlaceholder;if(i.length&&!this.options.isOnlyPlaceholder){var o="";i.forEach((function(t,i){0!==i&&(o+="".concat(e.options.sepChars,'<span class="').concat((0,c.getClass)("sep_space",!0),'">&nbsp;</span>')),o+="".concat(t.title)})),this.elemTop.title=o;var l=this.options.countShowSelected,r=Number(this.$select.dataset.simpleCountShowsSelected);r&&r>0&&(l=r),i.length>l?(n="".concat(this.options.locale.selected," ").concat(i.length),this.$select.querySelectorAll("option").length===i.length&&(n+=" (".concat(this.options.locale.all,")"))):o&&(n=o)}this.elemTitle.innerHTML=n,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:"createListHTML",value:function(){var e=this;if(this.elemListBody){var t="",i=0,s=0,n=0;this.state.getState("items").forEach((function(o){if(o.isGroup){var l=e.createLi(o),r=l.result,a=l.countShow,u=l.countChecked,h=l.countCheckedFull;t+='<div class="'.concat((0,c.getClass)("group_items"),'">'),t+=r,t+="</div>",s+=u,i+=a,n+=h}else{var p=e.createLi(o),d=p.result,m=p.countShow,f=p.countChecked,b=p.countCheckedFull;t+=d,i+=m,s+=f,n+=b}}));var o=this.state.getState("filterStr");o&&o.length&&0===i&&(t='<div class="'.concat((0,c.getClass)("no_match"),'">'),t="".concat(this.options.locale.noSearch,' "').concat(o,'"'),t+="</div>"),this.elemWrap.dataset.countChecked=s.toString(),this.elemWrap.dataset.countCheckedFull=n.toString(),this.isMulti&&(this.elemWrap.dataset.checkAllMulti=this.$select.options.length===s?"yes":"no"),this.elemListBody.innerHTML=t}}},{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="text",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(h.initClass,"_name_").concat(this.id);var i=(0,c.getClass)("search");t?this.elemDropDown&&(this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("dropdown",!0,i)),this.elemDropDown.insertBefore(this.elemInputSearch,this.elemDropDown.childNodes[0])):(this.elemInputSearch.className="".concat(i," ").concat((0,c.getClass)("top",!0,i)),this.elemTop.appendChild(this.elemInputSearch)),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;return e.isShowFilter?(e.isGroup&&(i+='<label class="'.concat((0,c.getClass)("group_title"),'">').concat(e.titleGroup,"</label>"),i+='<ul class="'.concat((0,c.getClass)("group"),'">')),e.items.forEach((function(l){if(l.isShowFilter){s++;var r=(0,c.getClass)("list_item"),a=r;l.checked&&(n++,a+=" ".concat((0,c.getClass)("checked",!0,r)),l.value&&o++),l.disabled&&(a+=" ".concat((0,c.getClass)("disabled",!0,r))),l.value||(a+=" ".concat((0,c.getClass)("not_value",!0,r)));var u='data-sel-group-id="'.concat(e.idGroup,'"');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-item",u+=' data-sel-opt-checked="'.concat(l.checked,'"'),u+=' data-sel-opt-disabled="'.concat(l.disabled,'"'),i+='<li class="'.concat(a,'" ').concat(u,">");var h=t.createLiBody(l,t.$select.options[l.position]);i+="string"==typeof h?h:h.outerHTML,i+="</li>"}})),e.isGroup&&(i+="</ul>"),{result:i,countShow:s,countChecked:n,countCheckedFull:o}):{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")}}])&&l(t.prototype,i),s&&l(t,s),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.SimpleSelectItemDOM=p},679:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createButton=t.cloneObj=t.compareObj=t.getClass=t.getCreateListItem=t.triggerInputEvent=t.ifTrueDataAttr=t.createDataAttr=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.createDataAttr=function(e){return"data-".concat(e)};t.ifTrueDataAttr=function(e){return!!e&&("true"===e||"1"===e)},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.getCreateListItem=function(e,t,i){var s=e.querySelectorAll("option"),n=[];s.forEach((function(e,t){n.push({id:(t+1).toString(),position:e.index,title:e.innerHTML,value:e.getAttribute("value"),checked:e.selected,disabled:e.disabled,isShowFilter:!0})}));var o={isGroup:i,idGroup:t,items:n,isShowFilter:!0};return e instanceof HTMLOptGroupElement&&(o.titleGroup=e.label||"",o.isDisabledGroup=e.disabled||!1),o};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}},972:function(e,t){"use strict";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},r=function(e,l){var r=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),a=t[e]||0==t[e]?t[e]:null;t[e]=l,e in i&&i[e].forEach((function(e){return e(l,a,t)})),o.forEach((function(i){return i(e,r,t)}))};return e&&Object.keys(e).forEach((function(t){r(t,e[t])})),{getState:l,setState:r,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){"use strict";i.r(t)},245:function(){var e,t,i,s;Array.from||(Array.from=(e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},i=Math.pow(2,53)-1,s=function(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),i)},function(e){var i=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var n,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!t(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}for(var l,r=s(i.length),a=t(this)?Object(new this(r)):new Array(r),c=0;c<r;)l=i[c],a[c]=o?void 0===n?o(l,c):o.call(n,l,c):l,c+=1;return a.length=r,a})),Array.prototype.forEach||(Array.prototype.forEach=function(e,t){var i,s;if(null==this)throw new TypeError(" this is null or not defined");var n=Object(this),o=n.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(i=t),s=0;s<o;){var l;s in n&&(l=n[s],e.call(i,l,s,n)),s++}}),"undefined"!=typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(e,t){t=t||window;for(var i=0;i<this.length;i++)e.call(t,this[i],i,this)}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),function(){if("function"==typeof window.CustomEvent)return!1;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}e.prototype=window.Event.prototype,window.CustomEvent=e}()}},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(){"use strict";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){r(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,a(s.key),s)}}function r(e,t,i){return(t=a(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function a(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)}i(245);var c=i(737),u=i(679),h=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),r(this,"callCount",Date.now()),r(this,"countInit",0),r(this,"$selects",[]),r(this,"options",void 0),r(this,"nameMarkTransform",(0,u.toCamelCase)(c.nameMark)),r(this,"dataNameMark",(0,u.createDataAttr)(c.nameMark)),r(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{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 h.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}()}));
@@ -26,6 +26,7 @@ export interface ISimpleSelectOptions {
26
26
  resetAll: boolean;
27
27
  resetAllAfterClose: boolean;
28
28
  isCloneClass: boolean;
29
+ isOnlyPlaceholder: boolean;
29
30
  isUp: boolean;
30
31
  detectNative?: () => boolean;
31
32
  callbackInitialization?: (item: SimpleSelectItem) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simp-select",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "simp-select - this plugin replaces the select",
5
5
  "main": "dist/simpleSelect.js",
6
6
  "types": "dist/simpleSelect.d.ts",
@@ -16,6 +16,8 @@ export const simpleSelectionOptions: ISimpleSelectOptions = {
16
16
  isSearchInDropdown: false,
17
17
 
18
18
  countShowSelected: 3,
19
+ isOnlyPlaceholder: false,
20
+
19
21
  isConfirmInMulti: false,
20
22
  isConfirmInMultiOkClickOutside: false,
21
23
 
@@ -34,7 +36,7 @@ export const simpleSelectionOptions: ISimpleSelectOptions = {
34
36
 
35
37
  };
36
38
 
37
- export const nameSelect = 'SimSel';
39
+ export const nameSelect = 'SimpSelect';
38
40
  const markPrefix = 'simple-select-';
39
41
  export const nameMark = `${markPrefix}init`;
40
42
 
@@ -46,7 +46,9 @@
46
46
  <div class="items">
47
47
  <div class="item">
48
48
  <select id="select_first"
49
- disabled
49
+
50
+ data-simple-placeholder="Custom title"
51
+ data-simple-is-only-placeholder="true"
50
52
  multiple>
51
53
  <option value="a1">a 1</option>
52
54
  <option value="a2">a 2</option>
@@ -58,7 +60,7 @@
58
60
  <div class="item">
59
61
  <select multiple
60
62
  data-simple-placeholder="custom placeholder"
61
- data-simple-is-confirm="false"
63
+ data-simple-is-confirm="true"
62
64
  data-simple-count-shows-selected="3">
63
65
  <option value="a1"
64
66
  data-simple-html-before="<span>|before| </span>"
@@ -135,15 +137,16 @@
135
137
  <!--
136
138
 
137
139
  <select
138
- data-simple-select-search
139
- data-simple-select-search-dropdown
140
+ data-simple-select-search="true"
141
+ data-simple-select-search-dropdown="true"
142
+ data-simple-is-only-placeholder="true"
140
143
  data-simple-count-shows-selected="3"
141
144
  data-simple-is-confirm="true" // only multiselect
142
145
  data-simple-debounce-time="1000" // only multiselect
143
146
  data-simple-placeholder="text"
144
147
  data-simple-reset-all="true" // only multiselect
145
148
  data-simple-select-all="true" // only multiselect
146
- !data-simple-show-checkbox="true" // only not multiselect
149
+ data-simple-show-checkbox="true" // only not multiselect
147
150
 
148
151
  !data-simple-item-html-before="<div>before</div>"
149
152
  !data-simple-item-html-after="<div>after</div>"
@@ -80,7 +80,7 @@ export default class SimpleSelect {
80
80
  createMethods(select: SimpleSelectItem) {
81
81
  const self = this;
82
82
  return {
83
- getInstance: () => select.getSelect(),
83
+ getNativeSelect: () => select.getSelect(),
84
84
  reload() {
85
85
  self.rebuild(select);
86
86
  },
@@ -130,10 +130,8 @@ export class SimpleSelectItemDOM {
130
130
  this.titlePlaceholder = this.options.locale.title;
131
131
  }
132
132
 
133
- const dataResetAll = toCamelCase('simple-reset-all');
134
- if (dataResetAll in this.$select.dataset) {
135
- const resReset = this.$select.dataset[dataResetAll];
136
- this.options.resetAll = !(resReset === 'false' || resReset === '0');
133
+ if (this.$select.hasAttribute('data-simple-reset-all')) {
134
+ this.options.resetAll = ifTrueDataAttr(this.$select.getAttribute('data-simple-reset-all'));
137
135
  }
138
136
  // const dataSelect = toCamelCase('simple-select-all');
139
137
  // if (dataSelect in this.$select.dataset) {
@@ -164,6 +162,10 @@ export class SimpleSelectItemDOM {
164
162
  if (this.$select.hasAttribute('data-simple-up')) {
165
163
  this.options.isUp = ifTrueDataAttr(this.$select.getAttribute('data-simple-up'));
166
164
  }
165
+
166
+ if (this.$select.hasAttribute('data-simple-is-only-placeholder')) {
167
+ this.options.isOnlyPlaceholder = ifTrueDataAttr(this.$select.getAttribute('data-simple-is-only-placeholder'));
168
+ }
167
169
  }
168
170
 
169
171
  initDom() {
@@ -363,7 +365,11 @@ export class SimpleSelectItemDOM {
363
365
  private createTitleHTML() {
364
366
  if (!this.elemTitle) {
365
367
  this.elemTitle = document.createElement('div');
366
- this.elemTitle.className = getClass('title');
368
+ let classesTitle = getClass('title');
369
+ if (this.options.isOnlyPlaceholder) {
370
+ classesTitle += ` ${getClass('only-placeholder', true, classesTitle)}`;
371
+ }
372
+ this.elemTitle.className = classesTitle;
367
373
  // this.elemTopBody.prepend(this.elemTitle);
368
374
  this.elemTopBody.insertBefore(this.elemTitle, this.elemTopBody.childNodes[0]);
369
375
  }
@@ -371,9 +377,10 @@ export class SimpleSelectItemDOM {
371
377
  const itemsChecked = this.getChecked();
372
378
 
373
379
  this.elemTop.title = '';
380
+
374
381
  const isPlaceholder = !itemsChecked.length;
375
382
  let title:string = this.titlePlaceholder;
376
- if (itemsChecked.length) {
383
+ if (itemsChecked.length && !this.options.isOnlyPlaceholder) {
377
384
  let attrTitle = '';
378
385
  itemsChecked.forEach((item, index) => {
379
386
  if (index !== 0) {
@@ -35,6 +35,7 @@ export interface ISimpleSelectOptions {
35
35
  resetAllAfterClose: boolean;
36
36
  isCloneClass: boolean;
37
37
 
38
+ isOnlyPlaceholder: boolean;
38
39
  isUp: boolean;
39
40
 
40
41
  detectNative?: () => boolean;