selectic 1.3.11 → 3.0.3

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.
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vtyx = require('vtyx');
6
+ var vue = require('vue');
6
7
 
7
8
  function styleInject(css, ref) {
8
9
  if ( ref === void 0 ) ref = {};
@@ -31,21 +32,16 @@ function styleInject(css, ref) {
31
32
  }
32
33
  }
33
34
 
34
- var css_248z = "/* {{{ Variables */\n\n:root {\n --selectic-font-size: 14px;\n --selectic-cursor-disabled: not-allowed;\n\n /* The main element */\n --selectic-color: #555555;\n --selectic-bg: #ffffff;\n\n /* The main element (when disabled) */\n --selectic-color-disabled: #787878;\n --selectic-bg-disabled: #eeeeee;\n\n /* The list */\n --selectic-panel-bg: #f0f0f0;\n --selectic-separator-bordercolor: #cccccc;\n /* --selectic-item-color: var(--selectic-color); /* Can be set in any CSS configuration */\n\n /* The current selected item */\n --selectic-selected-item-color: #428bca;\n\n /* When mouse is over items or by selecting with key arrows */\n --selectic-active-item-color: #ffffff;\n --selectic-active-item-bg: #66afe9;\n\n /* Selected values in main element */\n --selectic-value-bg: #f0f0f0;\n /* --selectic-more-items-bg: var(--selectic-info-bg); /* can be set in any CSS configuration */\n /* --selectic-more-items-color: var(--selectic-info-color); /* can be set in any CSS configuration */\n --selectic-more-items-bg-disabled: #cccccc;\n\n /* Information message */\n --selectic-info-bg: #5bc0de;\n --selectic-info-color: #ffffff;\n\n /* Error message */\n --selectic-error-bg: #b72c29;\n --selectic-error-color: #ffffff;\n\n /* XXX: Currently it is important to keep this size for a correct scroll\n * height estimation */\n --selectic-input-height: 30px;\n}\n\n/* }}} */\n/* {{{ Bootstrap equivalent style */\n\n.selectic .form-control {\n display: block;\n width: 100%;\n height: calc(var(--selectic-input-height) - 2px);\n font-size: var(--selectic-font-size);\n line-height: 1.42857143;\n color: var(--selectic-color);\n background-color: var(--selectic-bg);\n background-image: none;\n border: 1px solid var(--selectic-separator-bordercolor); /* should use a better variable */\n border-radius: 4px;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;\n}\n.selectic .has-feedback {\n position: relative;\n}\n.selectic .has-feedback .form-control {\n padding-right: calc(var(--selectic-input-height) + 4px);\n}\n\n.selectic .form-control-feedback.fa,\n.selectic .form-control-feedback {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n display: block;\n width: calc(var(--selectic-input-height) + 4px);\n height: calc(var(--selectic-input-height) + 4px);\n line-height: var(--selectic-input-height);\n text-align: center;\n pointer-events: none;\n}\n\n.selectic .alert-info {\n background-color: var(--selectic-info-bg);\n color: var(--selectic-info-color);\n}\n\n.selectic .alert-danger {\n background-color: var(--selectic-error-bg);\n color: var(--selectic-error-color);\n}\n\n/* }}} */\n\n.selectic * {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n.selectic.form-control {\n display: inline-block;\n padding: 0;\n cursor: pointer;\n border: unset;\n}\n\n.has-feedback .selectic__icon-container.form-control-feedback {\n right: 0;\n}\n\n/* The input which contains the selected value\n * XXX: This input should stay hidden behind other elements, but is \"visible\"\n * (in term of DOM point of view) in order to get and to trigger the `focus`\n * DOM event. */\n.selectic__input-value {\n position: fixed;\n opacity: 0;\n z-index: -1000;\n top: -100px;\n}\n\n/* XXX: .form-control has been added to this selector to improve priority and\n * override some rules of the original .form-control */\n.selectic-input.form-control {\n display: inline-flex;\n justify-content: space-between;\n overflow: hidden;\n width: 100%;\n min-height: var(--selectic-input-height);\n padding-top: 0;\n padding-bottom: 0;\n padding-left: 5px;\n line-height: calc(var(--selectic-input-height) - 4px);\n color: var(--selectic-color);\n}\n\n.selectic-input__reverse-icon {\n align-self: center;\n margin-right: 3px;\n cursor: default;\n}\n.selectic-input__clear-icon {\n align-self: center;\n margin-left: 3px;\n cursor: pointer;\n}\n.selectic-input__clear-icon:hover {\n color: var(--selectic-selected-item-color);\n}\n\n.selectic-input.focused {\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n}\n\n.selectic-input.disabled {\n cursor: var(--selectic-cursor-disabled);\n background-color: var(--selectic-bg-disabled);\n}\n.selectic-input.disabled .more-items {\n\tbackground-color: var(--selectic-more-items-bg-disabled);\n}\n\n.selectic-input__selected-items {\n display: inline-flex;\n flex-wrap: nowrap;\n align-items: center;\n white-space: nowrap;\n}\n\n.selectic-input__selected-items__placeholder {\n font-style: italic;\n opacity: 0.7;\n white-space: nowrap;\n}\n\n.selectic-icon {\n color: var(--selectic-color);\n text-align: center;\n vertical-align: middle;\n}\n\n.selectic__extended-list {\n position: fixed;\n z-index: 2000;\n height: auto;\n background-color: var(--selectic-bg, #ffffff);\n box-shadow: 2px 5px 12px 0px #888888;\n border-radius: 0 0 4px 4px;\n padding: 0;\n min-width: 200px;\n}\n.selectic__extended-list__list-items {\n max-height: calc(var(--selectic-input-height) * 10);\n overflow: auto;\n padding-left: 0;\n}\n\n.selectic-item {\n display: block;\n position: relative;\n box-sizing: border-box;\n padding: 2px 8px;\n color: var(--selectic-item-color, var(--selectic-color));\n min-height: calc(var(--selectic-input-height) - 3px);\n list-style-type: none;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.selectic-item_text {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.selectic-item:not(.selected) .selectic-item_icon {\n opacity: 0;\n}\n\n.selectic-item__active {\n background-color: var(--selectic-active-item-bg);\n color: var(--selectic-active-item-color);\n}\n.selectic-item__active:not(.selected) .selectic-item_icon {\n opacity: 0.2;\n}\n\n.selectic-item__disabled {\n color: var(--selectic-color-disabled);\n background-color: var(--selectic-bg-disabled);\n}\n\n.selectic-item__is-in-group {\n padding-left: 2em;\n}\n\n.selectic-item__is-group {\n font-weight: bold;\n cursor: default;\n}\n\n.selectic-item.selected {\n color: var(--selectic-selected-item-color);\n}\n.selectic-search-scope {\n color: #e0e0e0;\n left: auto;\n right: 10px;\n}\n\n.selectic__message {\n text-align: center;\n padding: 3px;\n}\n\n.selectic .filter-panel {\n padding: 3px;\n margin-left: 0px;\n margin-right: 0px;\n background-color: var(--selectic-panel-bg);\n border-bottom: 1px solid var(--selectic-separator-bordercolor);\n}\n\n.selectic .panelclosed {\n max-height: 0px;\n transition: max-height 0.3s ease-out;\n overflow: hidden;\n}\n\n.panelopened {\n max-height: 200px;\n transition: max-height 0.3s ease-in;\n overflow: hidden;\n}\n\n.selectic .filter-panel__input {\n padding-left: 0px;\n padding-right: 0px;\n padding-bottom: 10px;\n margin-bottom: 0px;\n}\n.selectic .filter-input {\n height: calc(var(--selectic-input-height) * 0.75);\n}\n\n.selectic .checkbox-filter {\n padding: 5px;\n text-align: center;\n}\n\n.selectic .curtain-handler {\n text-align: center;\n}\n\n.selectic .toggle-selectic {\n margin: 5px;\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.selectic .toggle-boolean-select-all-toggle {\n display: inline;\n margin-right: 15px;\n}\n\n.selectic .toggle-boolean-excluding-toggle {\n display: inline;\n margin-right: 15px;\n}\n\n.selectic .single-value {\n display: grid;\n grid-template: \"value icon\" 1fr / max-content max-content;\n\n padding: 2px;\n padding-left: 5px;\n margin-left: 0;\n margin-right: 5px;\n /* margin top/bottom are mainly to create a gutter in multilines */\n margin-top: 2px;\n margin-bottom: 2px;\n\n border-radius: 3px;\n background-color: var(--selectic-value-bg);\n max-height: calc(var(--selectic-input-height) - 10px);\n max-width: 100%;\n min-width: 30px;\n\n overflow: hidden;\n white-space: nowrap;\n line-height: initial;\n vertical-align: middle;\n}\n\n.selectic .more-items {\n display: inline-block;\n\n padding-left: 5px;\n padding-right: 5px;\n border-radius: 10px;\n\n background-color: var(--selectic-more-items-bg, var(--selectic-info-bg));\n color: var(--selectic-more-items-color, var(--selectic-info-color));\n cursor: help;\n}\n.selectic-input__selected-items__value {\n grid-area: value;\n align-self: center;\n justify-self: normal;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n\n.selectic-input__selected-items__icon {\n grid-area: icon;\n align-self: center;\n justify-self: center;\n margin-left: 5px;\n}\n.selectic-input__selected-items__icon:hover {\n color: var(--selectic-selected-item-color);\n}\n\n.selectic__label-disabled {\n opacity: 0.5;\n transition: opacity 400ms;\n}\n\n/* XXX: override padding of bootstrap input-sm.\n * This padding introduce a line shift. */\n.selectic.input-sm {\n padding: 0;\n}\n\n/* {{{ overflow multiline */\n\n.selectic--overflow-multiline,\n.selectic--overflow-multiline.form-control,\n.selectic--overflow-multiline .form-control {\n height: unset;\n}\n\n.selectic--overflow-multiline .selectic-input {\n overflow: unset;\n}\n\n.selectic--overflow-multiline .selectic-input__selected-items {\n flex-wrap: wrap;\n}\n\n/* }}} */\n";
35
+ var css_248z = "/* {{{ Variables */\n\n:root {\n --selectic-font-size: 14px;\n --selectic-cursor-disabled: not-allowed;\n\n /* The main element */\n --selectic-color: #555555;\n --selectic-bg: #ffffff;\n\n /* The main element (when disabled) */\n --selectic-color-disabled: #787878;\n --selectic-bg-disabled: #eeeeee;\n\n /* The list */\n --selectic-panel-bg: #f0f0f0;\n --selectic-separator-bordercolor: #cccccc;\n /* --selectic-item-color: var(--selectic-color); /* Can be set in any CSS configuration */\n\n /* The current selected item */\n --selectic-selected-item-color: #428bca;\n\n /* When mouse is over items or by selecting with key arrows */\n --selectic-active-item-color: #ffffff;\n --selectic-active-item-bg: #66afe9;\n\n /* Selected values in main element */\n --selectic-value-bg: #f0f0f0;\n /* --selectic-more-items-bg: var(--selectic-info-bg); /* can be set in any CSS configuration */\n /* --selectic-more-items-color: var(--selectic-info-color); /* can be set in any CSS configuration */\n --selectic-more-items-bg-disabled: #cccccc;\n\n /* Information message */\n --selectic-info-bg: #5bc0de;\n --selectic-info-color: #ffffff;\n\n /* Error message */\n --selectic-error-bg: #b72c29;\n --selectic-error-color: #ffffff;\n\n /* XXX: Currently it is important to keep this size for a correct scroll\n * height estimation */\n --selectic-input-height: 30px;\n}\n\n/* }}} */\n/* {{{ Bootstrap equivalent style */\n\n.selectic .form-control {\n display: block;\n width: 100%;\n height: calc(var(--selectic-input-height) - 2px);\n font-size: var(--selectic-font-size);\n line-height: 1.42857143;\n color: var(--selectic-color);\n background-color: var(--selectic-bg);\n background-image: none;\n border: 1px solid var(--selectic-separator-bordercolor); /* should use a better variable */\n border-radius: 4px;\n box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;\n}\n.selectic .has-feedback {\n position: relative;\n}\n.selectic .has-feedback .form-control {\n padding-right: calc(var(--selectic-input-height) + 4px);\n}\n\n.selectic .form-control-feedback.fa,\n.selectic .form-control-feedback {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n display: block;\n width: calc(var(--selectic-input-height) + 4px);\n height: calc(var(--selectic-input-height) + 4px);\n line-height: var(--selectic-input-height);\n text-align: center;\n pointer-events: none;\n}\n\n.selectic .alert-info {\n background-color: var(--selectic-info-bg);\n color: var(--selectic-info-color);\n}\n\n.selectic .alert-danger {\n background-color: var(--selectic-error-bg);\n color: var(--selectic-error-color);\n}\n\n/* }}} */\n\n.selectic * {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n\n.selectic.form-control {\n display: inline-block;\n padding: 0;\n cursor: pointer;\n border: unset;\n}\n\n.has-feedback .selectic__icon-container.form-control-feedback {\n right: 0;\n}\n\n/* The input which contains the selected value\n * XXX: This input should stay hidden behind other elements, but is \"visible\"\n * (in term of DOM point of view) in order to get and to trigger the `focus`\n * DOM event. */\n.selectic__input-value {\n position: fixed;\n opacity: 0;\n z-index: -1000;\n top: -100px;\n}\n\n/* XXX: .form-control has been added to this selector to improve priority and\n * override some rules of the original .form-control */\n.selectic-input.form-control {\n display: inline-flex;\n justify-content: space-between;\n overflow: hidden;\n width: 100%;\n min-height: var(--selectic-input-height);\n padding-top: 0;\n padding-bottom: 0;\n padding-left: 5px;\n line-height: calc(var(--selectic-input-height) - 4px);\n color: var(--selectic-color);\n}\n\n.selectic-input__reverse-icon {\n align-self: center;\n margin-right: 3px;\n cursor: default;\n}\n.selectic-input__clear-icon {\n align-self: center;\n margin-left: 3px;\n cursor: pointer;\n}\n.selectic-input__clear-icon:hover {\n color: var(--selectic-selected-item-color);\n}\n\n.selectic-input.focused {\n border-bottom-left-radius: 0px;\n border-bottom-right-radius: 0px;\n}\n\n.selectic-input.disabled {\n cursor: var(--selectic-cursor-disabled);\n background-color: var(--selectic-bg-disabled);\n}\n.selectic-input.disabled .more-items {\n\tbackground-color: var(--selectic-more-items-bg-disabled);\n}\n\n.selectic-input__selected-items {\n display: inline-flex;\n flex-wrap: nowrap;\n align-items: center;\n white-space: nowrap;\n}\n\n.selectic-input__selected-items__placeholder {\n font-style: italic;\n opacity: 0.7;\n white-space: nowrap;\n}\n\n.selectic-icon {\n color: var(--selectic-color);\n text-align: center;\n vertical-align: middle;\n}\n\n.selectic__extended-list {\n position: fixed;\n z-index: 2000;\n height: auto;\n background-color: var(--selectic-bg, #ffffff);\n box-shadow: 2px 5px 12px 0px #888888;\n border-radius: 0 0 4px 4px;\n padding: 0;\n min-width: 200px;\n}\n.selectic__extended-list__list-items {\n max-height: calc(var(--selectic-input-height) * 10);\n overflow: auto;\n padding-left: 0;\n}\n\n.selectic-item {\n display: block;\n position: relative;\n box-sizing: border-box;\n padding: 2px 8px;\n color: var(--selectic-item-color, var(--selectic-color));\n min-height: calc(var(--selectic-input-height) - 3px);\n list-style-type: none;\n white-space: nowrap;\n cursor: pointer;\n}\n\n.selectic-item_text {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.selectic-item:not(.selected) .selectic-item_icon {\n opacity: 0;\n}\n\n.selectic-item_text {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.selectic-item__active {\n background-color: var(--selectic-active-item-bg);\n color: var(--selectic-active-item-color);\n}\n.selectic-item__active:not(.selected) .selectic-item_icon {\n opacity: 0.2;\n}\n\n.selectic-item__disabled {\n color: var(--selectic-color-disabled);\n background-color: var(--selectic-bg-disabled);\n}\n\n.selectic-item__is-in-group {\n padding-left: 2em;\n}\n\n.selectic-item__is-group {\n font-weight: bold;\n cursor: default;\n}\n\n.selectic-item.selected {\n color: var(--selectic-selected-item-color);\n}\n.selectic-search-scope {\n color: #e0e0e0;\n left: auto;\n right: 10px;\n}\n\n.selectic__message {\n text-align: center;\n padding: 3px;\n}\n\n.selectic .filter-panel {\n padding: 3px;\n margin-left: 0px;\n margin-right: 0px;\n background-color: var(--selectic-panel-bg);\n border-bottom: 1px solid var(--selectic-separator-bordercolor);\n}\n\n.selectic .panelclosed {\n max-height: 0px;\n transition: max-height 0.3s ease-out;\n overflow: hidden;\n}\n\n.panelopened {\n max-height: 200px;\n transition: max-height 0.3s ease-in;\n overflow: hidden;\n}\n\n.selectic .filter-panel__input {\n padding-left: 0px;\n padding-right: 0px;\n padding-bottom: 10px;\n margin-bottom: 0px;\n}\n.selectic .filter-input {\n height: calc(var(--selectic-input-height) * 0.75);\n}\n\n.selectic .checkbox-filter {\n padding: 5px;\n text-align: center;\n}\n\n.selectic .curtain-handler {\n text-align: center;\n}\n\n.selectic .toggle-selectic {\n margin: 5px;\n padding-left: 0px;\n padding-right: 0px;\n}\n\n.selectic .toggle-boolean-select-all-toggle {\n display: inline;\n margin-right: 15px;\n}\n\n.selectic .toggle-boolean-excluding-toggle {\n display: inline;\n margin-right: 15px;\n}\n\n.selectic .single-value {\n display: grid;\n grid-template: \"value icon\" 1fr / max-content max-content;\n\n padding: 2px;\n padding-left: 5px;\n margin-left: 0;\n margin-right: 5px;\n /* margin top/bottom are mainly to create a gutter in multilines */\n margin-top: 2px;\n margin-bottom: 2px;\n\n border-radius: 3px;\n background-color: var(--selectic-value-bg);\n max-height: calc(var(--selectic-input-height) - 10px);\n max-width: 100%;\n min-width: 30px;\n\n overflow: hidden;\n white-space: nowrap;\n line-height: initial;\n vertical-align: middle;\n}\n\n.selectic .more-items {\n display: inline-block;\n\n padding-left: 5px;\n padding-right: 5px;\n border-radius: 10px;\n\n background-color: var(--selectic-more-items-bg, var(--selectic-info-bg));\n color: var(--selectic-more-items-color, var(--selectic-info-color));\n cursor: help;\n}\n.selectic-input__selected-items__value {\n grid-area: value;\n align-self: center;\n justify-self: normal;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n}\n\n.selectic-input__selected-items__icon {\n grid-area: icon;\n align-self: center;\n justify-self: center;\n margin-left: 5px;\n}\n.selectic-input__selected-items__icon:hover {\n color: var(--selectic-selected-item-color);\n}\n\n.selectic__label-disabled {\n opacity: 0.5;\n transition: opacity 400ms;\n}\n\n/* XXX: override padding of bootstrap input-sm.\n * This padding introduce a line shift. */\n.selectic.input-sm {\n padding: 0;\n}\n\n/* {{{ overflow multiline */\n\n.selectic--overflow-multiline,\n.selectic--overflow-multiline.form-control,\n.selectic--overflow-multiline .form-control {\n height: unset;\n}\n\n.selectic--overflow-multiline .selectic-input {\n overflow: unset;\n}\n\n.selectic--overflow-multiline .selectic-input__selected-items {\n flex-wrap: wrap;\n}\n\n/* }}} */\n";
35
36
  styleInject(css_248z);
36
37
 
37
38
  /* File Purpose:
38
39
  * It keeps and computes all states at a single place.
39
- * Every inner components of Selectic should comunicate with this file to
40
+ * Every inner components of Selectic should communicate with this file to
40
41
  * change or to get states.
41
42
  */
42
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
43
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
44
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
45
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
46
- return c > 3 && r && Object.defineProperty(target, key, r), r;
47
- };
48
43
  /* }}} */
44
+ /* {{{ Helper */
49
45
  /**
50
46
  * Escape search string to consider regexp special characters as they
51
47
  * are and not like special characters.
@@ -62,6 +58,26 @@ function convertToRegExp(name, flag = 'i') {
62
58
  .replace(/\*/g, '.*');
63
59
  return new RegExp(pattern, flag);
64
60
  }
61
+ /** Does the same as Object.assign but does not replace if value is undefined */
62
+ function assignObject(obj, ...sourceObjects) {
63
+ const result = obj;
64
+ for (const source of sourceObjects) {
65
+ for (const key of Object.keys(source)) {
66
+ const value = source[key];
67
+ if (value === undefined) {
68
+ continue;
69
+ }
70
+ result[key] = value;
71
+ }
72
+ }
73
+ return result;
74
+ }
75
+ /* }}} */
76
+ /* {{{ Static */
77
+ function changeTexts$1(texts) {
78
+ messages = Object.assign(messages, texts);
79
+ }
80
+ /* }}} */
65
81
  let messages = {
66
82
  noFetchMethod: 'Fetch callback is missing: it is not possible to retrieve data.',
67
83
  searchPlaceholder: 'Search',
@@ -81,24 +97,17 @@ let messages = {
81
97
  unknownPropertyValue: 'property "%s" has incorrect values.',
82
98
  };
83
99
  let closePreviousSelectic;
84
- /* {{{ Static */
85
- function changeTexts(texts) {
86
- messages = Object.assign(messages, texts);
87
- }
88
100
  /* }}} */
89
- let SelecticStore = class SelecticStore extends vtyx.Vue {
90
- constructor() {
91
- /* {{{ props */
92
- super(...arguments);
93
- /* }}} */
101
+ let uid = 0;
102
+ class SelecticStore {
103
+ constructor(props = {}) {
94
104
  /* {{{ data */
95
- /* Number of items displayed in a page (before scrolling) */
96
- this.itemsPerPage = 10;
97
- this.state = {
105
+ this.state = vue.reactive({
98
106
  multiple: false,
99
107
  disabled: false,
100
108
  placeholder: '',
101
109
  hideFilter: false,
110
+ keepFilterOpen: false,
102
111
  allowRevert: undefined,
103
112
  allowClearSelection: false,
104
113
  autoSelect: true,
@@ -128,45 +137,157 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
128
137
  errorMessage: '',
129
138
  areAllSelected: false,
130
139
  hasChanged: false,
140
+ automaticChange: false,
141
+ automaticClose: false,
131
142
  },
143
+ });
144
+ /* Do not need reactivity */
145
+ this.requestId = 0;
146
+ this._uid = ++uid;
147
+ /* {{{ Props */
148
+ const defaultProps = {
149
+ value: null,
150
+ selectionIsExcluded: false,
151
+ disabled: false,
152
+ options: null,
153
+ childOptions: [],
154
+ groups: [],
155
+ texts: null,
156
+ params: {},
157
+ fetchCallback: null,
158
+ getItemsCallback: null,
159
+ keepOpenWithOtherSelectic: false,
132
160
  };
133
- this.labels = Object.assign({}, messages);
134
- /* used to avoid checking and updating table while doing batch stuff */
135
- this.doNotUpdate = false;
136
- this.cacheItem = new Map();
137
- this.activeOrder = 'D';
138
- this.dynOffset = 0;
161
+ const propsVal = assignObject(defaultProps, props);
162
+ this.props = vue.reactive(propsVal);
139
163
  /* }}} */
140
- }
141
- /* }}} */
142
- /* {{{ computed */
143
- /* Number of item to pre-display */
144
- get marginSize() {
145
- return this.state.pageSize / 2;
146
- }
147
- get isPartial() {
148
- const state = this.state;
149
- let isPartial = typeof this.fetchCallback === 'function';
150
- if (isPartial && state.optionBehaviorOperation === 'force' && this.activeOrder !== 'D') {
151
- isPartial = false;
164
+ /* {{{ data */
165
+ this.data = vue.reactive({
166
+ labels: Object.assign({}, messages),
167
+ itemsPerPage: 10,
168
+ doNotUpdate: false,
169
+ cacheItem: new Map(),
170
+ activeOrder: 'D',
171
+ dynOffset: 0,
172
+ });
173
+ /* }}} */
174
+ /* {{{ computed */
175
+ this.marginSize = vue.computed(() => {
176
+ return this.state.pageSize / 2;
177
+ });
178
+ this.isPartial = vue.computed(() => {
179
+ const state = this.state;
180
+ let isPartial = typeof this.props.fetchCallback === 'function';
181
+ if (isPartial &&
182
+ state.optionBehaviorOperation === 'force' &&
183
+ this.data.activeOrder !== 'D') {
184
+ isPartial = false;
185
+ }
186
+ return isPartial;
187
+ });
188
+ this.hasAllItems = vue.computed(() => {
189
+ const state = this.state;
190
+ const nbItems = state.totalFilteredOptions + state.groups.size;
191
+ return this.state.filteredOptions.length >= nbItems;
192
+ });
193
+ this.hasFetchedAllItems = vue.computed(() => {
194
+ const isPartial = vue.unref(this.isPartial);
195
+ if (!isPartial) {
196
+ return true;
197
+ }
198
+ const state = this.state;
199
+ return state.dynOptions.length === state.totalDynOptions;
200
+ });
201
+ this.listOptions = vue.computed(() => {
202
+ return this.getListOptions();
203
+ });
204
+ this.elementOptions = vue.computed(() => {
205
+ return this.getElementOptions();
206
+ });
207
+ /* }}} */
208
+ /* {{{ watch */
209
+ vue.watch(() => [this.props.options, this.props.childOptions], () => {
210
+ this.data.cacheItem.clear();
211
+ this.setAutomaticClose();
212
+ this.commit('isOpen', false);
213
+ this.buildAllOptions(true);
214
+ this.buildSelectedOptions();
215
+ });
216
+ vue.watch(() => [this.listOptions, this.elementOptions], () => {
217
+ /* TODO: transform allOptions as a computed properties and this
218
+ * watcher become useless */
219
+ this.buildAllOptions(true);
220
+ });
221
+ vue.watch(() => this.props.value, () => {
222
+ var _a;
223
+ const value = (_a = this.props.value) !== null && _a !== void 0 ? _a : null;
224
+ this.commit('internalValue', value);
225
+ });
226
+ vue.watch(() => this.props.selectionIsExcluded, () => {
227
+ this.commit('selectionIsExcluded', this.props.selectionIsExcluded);
228
+ });
229
+ vue.watch(() => this.props.disabled, () => {
230
+ this.commit('disabled', this.props.disabled);
231
+ });
232
+ vue.watch(() => this.state.filteredOptions, () => {
233
+ let areAllSelected = false;
234
+ const hasAllItems = vue.unref(this.hasAllItems);
235
+ if (hasAllItems) {
236
+ const selectionIsExcluded = +this.state.selectionIsExcluded;
237
+ /* eslint-disable-next-line no-bitwise */
238
+ areAllSelected = this.state.filteredOptions.every((item) => !!(+item.selected ^ selectionIsExcluded));
239
+ }
240
+ this.state.status.areAllSelected = areAllSelected;
241
+ });
242
+ vue.watch(() => this.state.internalValue, () => {
243
+ this.buildSelectedOptions();
244
+ });
245
+ vue.watch(() => this.state.allOptions, () => {
246
+ this.checkAutoSelect();
247
+ this.checkAutoDisabled();
248
+ });
249
+ vue.watch(() => this.state.totalAllOptions, () => {
250
+ this.checkHideFilter();
251
+ });
252
+ /* }}} */
253
+ this.closeSelectic = () => {
254
+ this.setAutomaticClose();
255
+ this.commit('isOpen', false);
256
+ };
257
+ const value = this.props.value;
258
+ /* set initial value for non reactive attribute */
259
+ this.cacheRequest = new Map();
260
+ const stateParam = Object.assign({}, this.props.params);
261
+ if (stateParam.optionBehavior) {
262
+ this.buildOptionBehavior(stateParam.optionBehavior, stateParam);
263
+ delete stateParam.optionBehavior;
152
264
  }
153
- return isPartial;
154
- }
155
- get hasAllItems() {
156
- const nbItems = this.state.totalFilteredOptions + this.state.groups.size;
157
- return this.state.filteredOptions.length >= nbItems;
158
- }
159
- get hasFetchedAllItems() {
160
- const state = this.state;
161
- if (!this.isPartial) {
162
- return true;
265
+ if (stateParam.hideFilter === 'auto') {
266
+ delete stateParam.hideFilter;
267
+ }
268
+ else if (stateParam.hideFilter === 'open') {
269
+ this.state.keepFilterOpen = true;
270
+ delete stateParam.hideFilter;
271
+ }
272
+ /* Update state */
273
+ assignObject(this.state, stateParam);
274
+ /* XXX: should be done in 2 lines, in order to set the multiple state
275
+ * and ensure convertValue run with correct state */
276
+ assignObject(this.state, {
277
+ internalValue: this.convertTypeValue(value),
278
+ selectionIsExcluded: props.selectionIsExcluded,
279
+ disabled: props.disabled,
280
+ });
281
+ this.checkHideFilter();
282
+ if (this.props.texts) {
283
+ this.changeTexts(this.props.texts);
163
284
  }
164
- return state.dynOptions.length === state.totalDynOptions;
165
- }
166
- get closeSelectic() {
167
- return () => this.commit('isOpen', false);
285
+ this.addGroups(this.props.groups);
286
+ this.assertValueType();
287
+ this.buildAllOptions();
288
+ this.buildSelectedOptions();
289
+ this.checkAutoDisabled();
168
290
  }
169
- /* }}} */
170
291
  /* {{{ methods */
171
292
  /* {{{ public methods */
172
293
  commit(name, value) {
@@ -204,7 +325,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
204
325
  if (typeof closePreviousSelectic === 'function') {
205
326
  closePreviousSelectic();
206
327
  }
207
- if (!this.keepOpenWithOtherSelectic) {
328
+ if (!this.props.keepOpenWithOtherSelectic) {
208
329
  closePreviousSelectic = this.closeSelectic;
209
330
  }
210
331
  }
@@ -223,15 +344,24 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
223
344
  break;
224
345
  case 'disabled':
225
346
  if (value) {
347
+ this.setAutomaticClose();
226
348
  this.commit('isOpen', false);
227
349
  }
228
350
  break;
229
351
  }
230
352
  }
353
+ setAutomaticChange() {
354
+ this.state.status.automaticChange = true;
355
+ setTimeout(() => this.state.status.automaticChange = false, 0);
356
+ }
357
+ setAutomaticClose() {
358
+ this.state.status.automaticClose = true;
359
+ setTimeout(() => this.state.status.automaticClose = false, 0);
360
+ }
231
361
  getItem(id) {
232
362
  let item;
233
363
  if (this.hasItemInStore(id)) {
234
- item = this.cacheItem.get(id);
364
+ item = this.data.cacheItem.get(id);
235
365
  }
236
366
  else {
237
367
  this.getItems([id]);
@@ -244,7 +374,8 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
244
374
  }
245
375
  async getItems(ids) {
246
376
  const itemsToFetch = ids.filter((id) => !this.hasItemInStore(id));
247
- if (itemsToFetch.length && typeof this.getItemsCallback === 'function') {
377
+ const getItemsCallback = this.props.getItemsCallback;
378
+ if (itemsToFetch.length && typeof getItemsCallback === 'function') {
248
379
  const cacheRequest = this.cacheRequest;
249
380
  const requestId = itemsToFetch.toString();
250
381
  let promise;
@@ -252,16 +383,17 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
252
383
  promise = cacheRequest.get(requestId);
253
384
  }
254
385
  else {
255
- promise = this.getItemsCallback(itemsToFetch);
386
+ promise = getItemsCallback(itemsToFetch);
256
387
  cacheRequest.set(requestId, promise);
257
388
  promise.then(() => {
258
389
  cacheRequest.delete(requestId);
259
390
  });
260
391
  }
261
392
  const items = await promise;
393
+ const cacheItem = this.data.cacheItem;
262
394
  for (const item of items) {
263
395
  if (item) {
264
- this.cacheItem.set(item.id, item);
396
+ cacheItem.set(item.id, item);
265
397
  }
266
398
  }
267
399
  }
@@ -270,8 +402,9 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
270
402
  selectItem(id, selected, keepOpen = false) {
271
403
  const state = this.state;
272
404
  let hasChanged = false;
405
+ const isPartial = vue.unref(this.isPartial);
273
406
  /* Check that item is not disabled */
274
- if (!this.isPartial) {
407
+ if (!isPartial) {
275
408
  const item = state.allOptions.find((opt) => opt.id === id);
276
409
  if (item && item.disabled) {
277
410
  return;
@@ -322,6 +455,10 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
322
455
  else if (id === oldValue) {
323
456
  return;
324
457
  }
458
+ if (keepOpen) {
459
+ /* if keepOpen is true it means that it is an automatic change */
460
+ this.setAutomaticChange();
461
+ }
325
462
  this.commit('internalValue', id);
326
463
  hasChanged = true;
327
464
  }
@@ -333,13 +470,15 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
333
470
  if (!this.state.multiple) {
334
471
  return;
335
472
  }
336
- if (!this.hasAllItems) {
473
+ const hasAllItems = vue.unref(this.hasAllItems);
474
+ if (!hasAllItems) {
475
+ const labels = this.data.labels;
337
476
  if (this.state.searchText) {
338
- this.state.status.errorMessage = this.labels.cannotSelectAllSearchedItems;
477
+ this.state.status.errorMessage = labels.cannotSelectAllSearchedItems;
339
478
  return;
340
479
  }
341
480
  if (!this.state.allowRevert) {
342
- this.state.status.errorMessage = this.labels.cannotSelectAllRevertItems;
481
+ this.state.status.errorMessage = labels.cannotSelectAllRevertItems;
343
482
  return;
344
483
  }
345
484
  const value = this.state.internalValue;
@@ -352,9 +491,9 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
352
491
  }
353
492
  const selectAll = !this.state.status.areAllSelected;
354
493
  this.state.status.areAllSelected = selectAll;
355
- this.doNotUpdate = true;
494
+ this.data.doNotUpdate = true;
356
495
  this.state.filteredOptions.forEach((item) => this.selectItem(item.id, selectAll));
357
- this.doNotUpdate = false;
496
+ this.data.doNotUpdate = false;
358
497
  this.updateFilteredOptions();
359
498
  }
360
499
  resetChange() {
@@ -364,8 +503,9 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
364
503
  this.state.status.errorMessage = '';
365
504
  }
366
505
  clearCache(forceReset = false) {
367
- const total = this.isPartial ? Infinity : 0;
368
- this.cacheItem.clear();
506
+ const isPartial = vue.unref(this.isPartial);
507
+ const total = isPartial ? Infinity : 0;
508
+ this.data.cacheItem.clear();
369
509
  this.state.allOptions = [];
370
510
  this.state.totalAllOptions = total;
371
511
  this.state.totalDynOptions = total;
@@ -392,7 +532,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
392
532
  this.buildFilteredOptions();
393
533
  }
394
534
  changeTexts(texts) {
395
- this.labels = Object.assign({}, this.labels, texts);
535
+ this.data.labels = Object.assign({}, this.data.labels, texts);
396
536
  }
397
537
  /* }}} */
398
538
  /* {{{ private methods */
@@ -408,22 +548,47 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
408
548
  }
409
549
  return this.state.filteredOptions.find(findId) ||
410
550
  this.state.dynOptions.find(findId) ||
411
- this.getListOptions().find(findId) ||
412
- this.getElementOptions().find(findId);
551
+ vue.unref(this.listOptions).find(findId) ||
552
+ vue.unref(this.elementOptions).find(findId);
553
+ }
554
+ convertTypeValue(oldValue) {
555
+ const state = this.state;
556
+ const isMultiple = state.multiple;
557
+ let newValue = oldValue;
558
+ if (isMultiple) {
559
+ if (!Array.isArray(oldValue)) {
560
+ newValue = oldValue === null ? [] : [oldValue];
561
+ }
562
+ }
563
+ else {
564
+ if (Array.isArray(oldValue)) {
565
+ const value = oldValue[0];
566
+ newValue = typeof value === 'undefined' ? null : value;
567
+ }
568
+ }
569
+ return newValue;
570
+ }
571
+ assertValueType() {
572
+ const state = this.state;
573
+ const internalValue = state.internalValue;
574
+ const newValue = this.convertTypeValue(internalValue);
575
+ if (newValue !== internalValue) {
576
+ this.setAutomaticChange();
577
+ state.internalValue = newValue;
578
+ }
413
579
  }
414
- assertCorrectValue(forceStrict = false) {
580
+ assertCorrectValue(applyStrict = false) {
415
581
  const state = this.state;
582
+ this.assertValueType();
416
583
  const internalValue = state.internalValue;
417
584
  const selectionIsExcluded = state.selectionIsExcluded;
418
585
  const isMultiple = state.multiple;
419
586
  const checkStrict = state.strictValue;
420
587
  let newValue = internalValue;
421
- const isPartial = this.isPartial;
588
+ const isPartial = vue.unref(this.isPartial);
422
589
  if (isMultiple) {
423
- if (!Array.isArray(internalValue)) {
424
- newValue = internalValue === null ? [] : [internalValue];
425
- }
426
- if (selectionIsExcluded && this.hasFetchedAllItems) {
590
+ const hasFetchedAllItems = vue.unref(this.hasFetchedAllItems);
591
+ if (selectionIsExcluded && hasFetchedAllItems) {
427
592
  newValue = state.allOptions.reduce((values, option) => {
428
593
  const id = option.id;
429
594
  if (!internalValue.includes(id)) {
@@ -435,10 +600,6 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
435
600
  }
436
601
  }
437
602
  else {
438
- if (Array.isArray(internalValue)) {
439
- const value = internalValue[0];
440
- newValue = typeof value === 'undefined' ? null : value;
441
- }
442
603
  state.selectionIsExcluded = false;
443
604
  }
444
605
  if (checkStrict) {
@@ -448,20 +609,23 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
448
609
  filteredValue = newValue
449
610
  .filter((value) => this.hasItemInStore(value));
450
611
  isDifferent = filteredValue.length !== newValue.length;
451
- if (isDifferent && isPartial && !forceStrict) {
452
- this.getItems(newValue).then(() => this.assertCorrectValue(true));
612
+ if (isDifferent && isPartial && !applyStrict) {
613
+ this.getItems(newValue)
614
+ .then(() => this.assertCorrectValue(true));
453
615
  return;
454
616
  }
455
617
  }
456
- else if (!this.hasItemInStore(newValue)) {
618
+ else if (newValue !== null && !this.hasItemInStore(newValue)) {
457
619
  filteredValue = null;
458
620
  isDifferent = true;
459
- if (isPartial && !forceStrict) {
460
- this.getItems([newValue]).then(() => this.assertCorrectValue(true));
621
+ if (isPartial && !applyStrict) {
622
+ this.getItems([newValue])
623
+ .then(() => this.assertCorrectValue(true));
461
624
  return;
462
625
  }
463
626
  }
464
627
  if (isDifferent) {
628
+ this.setAutomaticChange();
465
629
  newValue = filteredValue;
466
630
  }
467
631
  }
@@ -471,8 +635,9 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
471
635
  }
472
636
  }
473
637
  updateFilteredOptions() {
474
- if (!this.doNotUpdate) {
638
+ if (!this.data.doNotUpdate) {
475
639
  this.state.filteredOptions = this.buildItems(this.state.filteredOptions);
640
+ this.buildSelectedOptions();
476
641
  }
477
642
  }
478
643
  addGroups(groups) {
@@ -480,13 +645,14 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
480
645
  this.state.groups.set(group.id, group.text);
481
646
  });
482
647
  }
483
- /* XXX: This is not a computed property to avoid consuming more memory */
648
+ /* This method is for the computed property listOptions */
484
649
  getListOptions() {
485
- const options = this.options;
650
+ const options = this.props.options;
486
651
  const listOptions = [];
487
652
  if (!Array.isArray(options)) {
488
653
  return listOptions;
489
654
  }
655
+ const state = this.state;
490
656
  options.forEach((option) => {
491
657
  /* manage simple string */
492
658
  if (typeof option === 'string') {
@@ -499,13 +665,13 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
499
665
  const group = option.group;
500
666
  const subOptions = option.options;
501
667
  /* check for groups */
502
- if (group && !this.state.groups.has(group)) {
503
- this.state.groups.set(group, String(group));
668
+ if (group && !state.groups.has(group)) {
669
+ state.groups.set(group, String(group));
504
670
  }
505
671
  /* check for sub options */
506
672
  if (subOptions) {
507
673
  const groupId = option.id;
508
- this.state.groups.set(groupId, option.text);
674
+ state.groups.set(groupId, option.text);
509
675
  subOptions.forEach((subOpt) => {
510
676
  subOpt.group = groupId;
511
677
  });
@@ -516,24 +682,25 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
516
682
  });
517
683
  return listOptions;
518
684
  }
519
- /* XXX: This is not a computed property to avoid consuming more memory */
685
+ /* This method is for the computed property elementOptions */
520
686
  getElementOptions() {
521
- const options = this.childOptions;
687
+ const options = this.props.childOptions;
522
688
  const childOptions = [];
523
- if (!Array.isArray(options)) {
689
+ if (!Array.isArray(options) || options.length === 0) {
524
690
  return childOptions;
525
691
  }
692
+ const state = this.state;
526
693
  options.forEach((option) => {
527
694
  const group = option.group;
528
695
  const subOptions = option.options;
529
696
  /* check for groups */
530
- if (group && !this.state.groups.has(group)) {
531
- this.state.groups.set(group, String(group));
697
+ if (group && !state.groups.has(group)) {
698
+ state.groups.set(group, String(group));
532
699
  }
533
700
  /* check for sub options */
534
701
  if (subOptions) {
535
702
  const groupId = option.id;
536
- this.state.groups.set(groupId, option.text);
703
+ state.groups.set(groupId, option.text);
537
704
  const sOpts = subOptions.map((subOpt) => {
538
705
  return Object.assign({}, subOpt, {
539
706
  group: groupId,
@@ -552,6 +719,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
552
719
  let elementOptions = [];
553
720
  const optionBehaviorOrder = this.state.optionBehaviorOrder;
554
721
  let length = Infinity;
722
+ const isPartial = vue.unref(this.isPartial);
555
723
  const arrayFromOrder = (orderValue) => {
556
724
  switch (orderValue) {
557
725
  case 'O': return listOptions;
@@ -569,7 +737,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
569
737
  return 0;
570
738
  };
571
739
  if (!keepFetched) {
572
- if (this.isPartial) {
740
+ if (isPartial) {
573
741
  this.state.totalAllOptions = Infinity;
574
742
  this.state.totalDynOptions = Infinity;
575
743
  }
@@ -577,14 +745,14 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
577
745
  this.state.totalDynOptions = 0;
578
746
  }
579
747
  }
580
- listOptions = this.getListOptions();
581
- elementOptions = this.getElementOptions();
748
+ listOptions = vue.unref(this.listOptions);
749
+ elementOptions = vue.unref(this.elementOptions);
582
750
  if (this.state.optionBehaviorOperation === 'force') {
583
751
  const orderValue = optionBehaviorOrder.find((value) => lengthFromOrder(value) > 0);
584
752
  allOptions.push(...arrayFromOrder(orderValue));
585
753
  length = lengthFromOrder(orderValue);
586
- this.activeOrder = orderValue;
587
- this.dynOffset = 0;
754
+ this.data.activeOrder = orderValue;
755
+ this.data.dynOffset = 0;
588
756
  }
589
757
  else {
590
758
  /* sort */
@@ -593,7 +761,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
593
761
  const list = arrayFromOrder(orderValue);
594
762
  const lngth = lengthFromOrder(orderValue);
595
763
  if (orderValue === 'D') {
596
- this.dynOffset = offset;
764
+ this.data.dynOffset = offset;
597
765
  }
598
766
  else {
599
767
  offset += lngth;
@@ -604,7 +772,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
604
772
  break;
605
773
  }
606
774
  }
607
- this.activeOrder = 'D';
775
+ this.data.activeOrder = 'D';
608
776
  length = optionBehaviorOrder.reduce((total, orderValue) => total + lengthFromOrder(orderValue), 0);
609
777
  }
610
778
  this.state.allOptions = allOptions;
@@ -612,13 +780,16 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
612
780
  this.state.totalAllOptions = length;
613
781
  }
614
782
  else {
615
- if (!this.isPartial) {
783
+ if (!isPartial) {
616
784
  this.state.totalAllOptions = allOptions.length;
617
785
  }
618
786
  }
619
787
  this.state.filteredOptions = [];
620
788
  this.state.totalFilteredOptions = Infinity;
621
- this.buildFilteredOptions();
789
+ this.buildFilteredOptions().then(() => {
790
+ /* XXX: To recompute for strict mode and auto-select */
791
+ this.assertCorrectValue();
792
+ });
622
793
  }
623
794
  async buildFilteredOptions() {
624
795
  if (!this.state.isOpen) {
@@ -630,12 +801,14 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
630
801
  const totalAllOptions = this.state.totalAllOptions;
631
802
  const allOptionsLength = allOptions.length;
632
803
  let filteredOptionsLength = this.state.filteredOptions.length;
633
- if (this.hasAllItems) {
804
+ const hasAllItems = vue.unref(this.hasAllItems);
805
+ if (hasAllItems) {
634
806
  /* Everything has already been fetched and stored in filteredOptions */
635
807
  return;
636
808
  }
809
+ const hasFetchedAllItems = vue.unref(this.hasFetchedAllItems);
637
810
  /* Check if all options have been fetched */
638
- if (this.hasFetchedAllItems) {
811
+ if (hasFetchedAllItems) {
639
812
  if (!search) {
640
813
  this.state.filteredOptions = this.buildGroupItems(allOptions);
641
814
  this.state.totalFilteredOptions = this.state.filteredOptions.length;
@@ -648,7 +821,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
648
821
  }
649
822
  /* When we only have partial options */
650
823
  const offsetItem = this.state.offsetItem;
651
- const marginSize = this.marginSize;
824
+ const marginSize = vue.unref(this.marginSize);
652
825
  const endIndex = offsetItem + marginSize;
653
826
  if (endIndex <= filteredOptionsLength) {
654
827
  return;
@@ -656,7 +829,8 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
656
829
  if (!search && endIndex <= allOptionsLength) {
657
830
  this.state.filteredOptions = this.buildGroupItems(allOptions);
658
831
  this.state.totalFilteredOptions = totalAllOptions + this.state.groups.size;
659
- if (this.isPartial && this.state.totalDynOptions === Infinity) {
832
+ const isPartial = vue.unref(this.isPartial);
833
+ if (isPartial && this.state.totalDynOptions === Infinity) {
660
834
  this.fetchData();
661
835
  }
662
836
  return;
@@ -664,7 +838,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
664
838
  if (filteredOptionsLength === 0 && this.state.optionBehaviorOperation === 'sort') {
665
839
  this.addStaticFilteredOptions();
666
840
  filteredOptionsLength = this.state.filteredOptions.length;
667
- this.dynOffset = filteredOptionsLength;
841
+ this.data.dynOffset = filteredOptionsLength;
668
842
  if (endIndex <= filteredOptionsLength) {
669
843
  return;
670
844
  }
@@ -673,77 +847,83 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
673
847
  }
674
848
  async buildSelectedOptions() {
675
849
  const internalValue = this.state.internalValue;
676
- if (this.state.multiple) {
850
+ const state = this.state;
851
+ if (state.multiple) {
677
852
  /* display partial information about selected items */
678
- this.state.selectedOptions = this.buildSelectedItems(internalValue);
853
+ state.selectedOptions = this.buildSelectedItems(internalValue);
679
854
  const items = await this.getItems(internalValue).catch(() => []);
680
- if (internalValue !== this.state.internalValue) {
855
+ if (internalValue !== state.internalValue) {
681
856
  /* Values have been deprecated */
682
857
  return;
683
858
  }
684
859
  if (items.length !== internalValue.length) {
685
- if (!this.state.strictValue) {
686
- const updatedItems = this.state.selectedOptions.map((option) => {
860
+ if (!state.strictValue) {
861
+ const updatedItems = state.selectedOptions.map((option) => {
687
862
  const foundItem = items.find((item) => item.id === option.id);
688
863
  return foundItem || option;
689
864
  });
690
- this.state.selectedOptions = updatedItems;
865
+ state.selectedOptions = updatedItems;
691
866
  }
692
867
  else {
693
868
  const itemIds = items.map((item) => item.id);
869
+ this.setAutomaticChange();
694
870
  this.commit('internalValue', itemIds);
695
871
  }
696
872
  return;
697
873
  }
698
874
  /* display full information about selected items */
699
- this.state.selectedOptions = items;
875
+ state.selectedOptions = items;
700
876
  }
701
877
  else if (internalValue === null) {
702
- this.state.selectedOptions = null;
878
+ state.selectedOptions = null;
703
879
  }
704
880
  else {
705
881
  /* display partial information about selected items */
706
- this.state.selectedOptions = this.buildSelectedItems([internalValue])[0];
882
+ state.selectedOptions = this.buildSelectedItems([internalValue])[0];
707
883
  const items = await this.getItems([internalValue]).catch(() => []);
708
- if (internalValue !== this.state.internalValue) {
884
+ if (internalValue !== state.internalValue) {
709
885
  /* Values have been deprecated */
710
886
  return;
711
887
  }
712
888
  if (!items.length) {
713
- if (this.state.strictValue) {
889
+ if (state.strictValue) {
890
+ this.setAutomaticChange();
714
891
  this.commit('internalValue', null);
715
892
  }
716
893
  return;
717
894
  }
718
895
  /* display full information about selected items */
719
- this.state.selectedOptions = items[0];
896
+ state.selectedOptions = items[0];
720
897
  }
721
898
  }
722
899
  async fetchData() {
723
900
  const state = this.state;
724
- if (!this.fetchCallback) {
725
- state.status.errorMessage = this.labels.noFetchMethod;
901
+ const labels = this.data.labels;
902
+ const fetchCallback = this.props.fetchCallback;
903
+ if (!fetchCallback) {
904
+ state.status.errorMessage = labels.noFetchMethod;
726
905
  return;
727
906
  }
728
907
  const search = state.searchText;
729
908
  const filteredOptionsLength = state.filteredOptions.length;
730
909
  const offsetItem = state.offsetItem;
731
910
  const pageSize = state.pageSize;
732
- const marginSize = this.marginSize;
911
+ const marginSize = vue.unref(this.marginSize);
733
912
  const endIndex = offsetItem + marginSize;
913
+ const dynOffset = this.data.dynOffset;
734
914
  /* Run the query */
735
915
  this.state.status.searching = true;
736
916
  /* Manage cases where offsetItem is not equal to the last item received */
737
- const offset = filteredOptionsLength - this.nbGroups(state.filteredOptions) - this.dynOffset;
917
+ const offset = filteredOptionsLength - this.nbGroups(state.filteredOptions) - dynOffset;
738
918
  const nbItems = endIndex - offset;
739
919
  const limit = Math.ceil(nbItems / pageSize) * pageSize;
740
920
  try {
741
921
  const requestId = ++this.requestId;
742
- const { total: rTotal, result } = await this.fetchCallback(search, offset, limit);
922
+ const { total: rTotal, result } = await fetchCallback(search, offset, limit);
743
923
  let total = rTotal;
744
924
  /* Assert result is correctly formatted */
745
925
  if (!Array.isArray(result)) {
746
- throw new Error(this.labels.wrongFormattedData);
926
+ throw new Error(labels.wrongFormattedData);
747
927
  }
748
928
  /* Handle case where total is not returned */
749
929
  if (typeof total !== 'number') {
@@ -757,7 +937,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
757
937
  /* update cache */
758
938
  state.totalDynOptions = total;
759
939
  state.dynOptions.splice(offset, limit, ...result);
760
- this.$nextTick(() => this.buildAllOptions(true));
940
+ setTimeout(() => this.buildAllOptions(true), 0);
761
941
  }
762
942
  /* Check request is not obsolete */
763
943
  if (requestId !== this.requestId) {
@@ -770,13 +950,13 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
770
950
  const previousItem = state.filteredOptions[filteredOptionsLength - 1];
771
951
  const options = this.buildGroupItems(result, previousItem);
772
952
  const nbGroups1 = this.nbGroups(options);
773
- state.filteredOptions.splice(offset + this.dynOffset, limit + nbGroups1, ...options);
953
+ state.filteredOptions.splice(offset + dynOffset, limit + nbGroups1, ...options);
774
954
  }
775
955
  let nbGroups = state.groups.size;
776
956
  if (offset + limit >= total) {
777
957
  nbGroups = this.nbGroups(state.filteredOptions);
778
958
  }
779
- state.totalFilteredOptions = total + nbGroups + this.dynOffset;
959
+ state.totalFilteredOptions = total + nbGroups + dynOffset;
780
960
  if (search && state.totalFilteredOptions <= state.filteredOptions.length) {
781
961
  this.addStaticFilteredOptions(true);
782
962
  }
@@ -819,10 +999,10 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
819
999
  }
820
1000
  switch (order) {
821
1001
  case 'O':
822
- options = this.filterOptions(this.getListOptions(), search);
1002
+ options = this.filterOptions(vue.unref(this.listOptions), search);
823
1003
  break;
824
1004
  case 'E':
825
- options = this.filterOptions(this.getElementOptions(), search);
1005
+ options = this.filterOptions(vue.unref(this.elementOptions), search);
826
1006
  break;
827
1007
  }
828
1008
  this.state.filteredOptions.push(...options);
@@ -831,7 +1011,8 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
831
1011
  }
832
1012
  buildSelectedItems(ids) {
833
1013
  return this.buildItems(ids.map((id) => {
834
- const item = this.cacheItem.get(id);
1014
+ const cacheItem = this.data.cacheItem;
1015
+ const item = cacheItem.get(id);
835
1016
  return item || {
836
1017
  id,
837
1018
  text: String(id),
@@ -839,11 +1020,12 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
839
1020
  }));
840
1021
  }
841
1022
  hasItemInStore(id) {
842
- let item = this.cacheItem.get(id);
1023
+ const cacheItem = this.data.cacheItem;
1024
+ let item = cacheItem.get(id);
843
1025
  if (!item) {
844
1026
  item = this.getValue(id);
845
1027
  if (item) {
846
- this.cacheItem.set(item.id, item);
1028
+ cacheItem.set(item.id, item);
847
1029
  }
848
1030
  }
849
1031
  return !!item;
@@ -860,7 +1042,7 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
860
1042
  disabled: false,
861
1043
  isGroup: false,
862
1044
  }, option, {
863
- // tslint:disable-next-line:no-bitwise
1045
+ /* eslint-disable-next-line no-bitwise */
864
1046
  selected: !!(+selected.includes(id) ^ selectionIsExcluded),
865
1047
  });
866
1048
  });
@@ -892,7 +1074,8 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
892
1074
  isValid = isValid && ['sort', 'force'].includes(operation);
893
1075
  isValid = isValid && /^[ODE]+$/.test(order);
894
1076
  if (!isValid) {
895
- this.state.status.errorMessage = this.labels.unknownPropertyValue.replace(/%s/, 'optionBehavior');
1077
+ const labels = this.data.labels;
1078
+ this.state.status.errorMessage = labels.unknownPropertyValue.replace(/%s/, 'optionBehavior');
896
1079
  operation = 'sort';
897
1080
  orderArray = ['O', 'D', 'E'];
898
1081
  }
@@ -919,14 +1102,17 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
919
1102
  for (const option of options) {
920
1103
  if (!option.disabled) {
921
1104
  this.selectItem(option.id, true, true);
1105
+ this.checkAutoDisabled();
922
1106
  return;
923
1107
  }
924
1108
  }
925
1109
  }
926
1110
  checkAutoDisabled() {
927
1111
  const state = this.state;
928
- const doNotCheck = this.disabled || this.isPartial || !state.autoDisabled;
929
- if (doNotCheck || !this.hasFetchedAllItems) {
1112
+ const isPartial = vue.unref(this.isPartial);
1113
+ const doNotCheck = isPartial || this.props.disabled || !state.autoDisabled;
1114
+ const hasFetchedAllItems = vue.unref(this.hasFetchedAllItems);
1115
+ if (doNotCheck || !hasFetchedAllItems) {
930
1116
  return;
931
1117
  }
932
1118
  const enabledOptions = state.allOptions.filter((opt) => !opt.disabled);
@@ -938,7 +1124,10 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
938
1124
  const isEmpty = nb === 0;
939
1125
  const hasOnlyOneOption = nb === 1 && hasValidValue && !state.allowClearSelection;
940
1126
  if (hasOnlyOneOption || isEmpty) {
941
- this.commit('isOpen', false);
1127
+ if (state.isOpen) {
1128
+ this.setAutomaticClose();
1129
+ this.commit('isOpen', false);
1130
+ }
942
1131
  this.commit('disabled', true);
943
1132
  }
944
1133
  else {
@@ -946,174 +1135,32 @@ let SelecticStore = class SelecticStore extends vtyx.Vue {
946
1135
  }
947
1136
  }
948
1137
  checkHideFilter() {
949
- if (this.params && this.params.hideFilter !== 'auto') {
1138
+ const params = this.props.params;
1139
+ if (params && params.hideFilter !== 'auto') {
950
1140
  return;
951
1141
  }
952
1142
  const state = this.state;
953
- if (state.multiple || this.isPartial) {
1143
+ const isPartial = vue.unref(this.isPartial);
1144
+ if (state.multiple || isPartial) {
954
1145
  state.hideFilter = false;
955
1146
  }
956
1147
  else {
957
- state.hideFilter = state.totalAllOptions <= this.itemsPerPage;
1148
+ state.hideFilter = state.totalAllOptions <= this.data.itemsPerPage;
958
1149
  }
959
1150
  }
960
- /* }}} */
961
- /* }}} */
962
- /* {{{ watch */
963
- onOptionsChange(options = [], oldOptions = []) {
964
- if (JSON.stringify(options) === JSON.stringify(oldOptions)) {
965
- /* There is no real difference, only a change of reference */
966
- return;
967
- }
968
- this.cacheItem.clear();
969
- this.commit('isOpen', false);
970
- this.buildAllOptions(true);
971
- this.assertCorrectValue();
972
- this.buildSelectedOptions();
973
- }
974
- onChildOptionsChange(childOptions = [], oldChildOptions = []) {
975
- if (JSON.stringify(childOptions) === JSON.stringify(oldChildOptions)) {
976
- /* There is no real difference, only a change of reference */
977
- return;
978
- }
979
- this.cacheItem.clear();
980
- this.commit('isOpen', false);
981
- this.buildAllOptions(true);
982
- this.assertCorrectValue();
983
- this.buildSelectedOptions();
984
- }
985
- onValueChange() {
986
- const value = typeof this.value === 'undefined' ? null : this.value;
987
- this.commit('internalValue', value);
988
- }
989
- onSelectionExcludedChange() {
990
- this.commit('selectionIsExcluded', this.selectionIsExcluded);
991
- }
992
- onDisabledChange() {
993
- this.commit('disabled', this.disabled);
994
- }
995
- onFilteredChange() {
996
- let areAllSelected = false;
997
- if (this.hasAllItems) {
998
- const selectionIsExcluded = +this.state.selectionIsExcluded;
999
- // tslint:disable-next-line:no-bitwise
1000
- areAllSelected = this.state.filteredOptions.every((item) => !!(+item.selected ^ selectionIsExcluded));
1001
- }
1002
- this.state.status.areAllSelected = areAllSelected;
1003
- }
1004
- onInternalValueChange() {
1005
- this.buildSelectedOptions();
1006
- }
1007
- onAllOptionChange() {
1008
- this.checkAutoSelect();
1009
- this.checkAutoDisabled();
1010
- }
1011
- onTotalAllOptionsChange() {
1012
- this.checkHideFilter();
1013
- }
1014
- /* }}} */
1015
- /* {{{ life cycles methods */
1016
- created() {
1017
- const value = typeof this.value === 'undefined' ? null : this.value;
1018
- /* set initial value for non reactive attribute */
1019
- this.requestId = 0;
1020
- this.cacheRequest = new Map();
1021
- const stateParam = Object.assign({}, this.params);
1022
- if (stateParam.optionBehavior) {
1023
- this.buildOptionBehavior(stateParam.optionBehavior, stateParam);
1024
- delete stateParam.optionBehavior;
1025
- }
1026
- this.state = Object.assign(this.state, stateParam, {
1027
- internalValue: value,
1028
- selectionIsExcluded: this.selectionIsExcluded,
1029
- disabled: this.disabled,
1030
- });
1031
- this.checkHideFilter();
1032
- if (this.texts) {
1033
- this.changeTexts(this.texts);
1034
- }
1035
- this.addGroups(this.groups);
1036
- this.buildAllOptions();
1037
- this.assertCorrectValue();
1038
- this.buildSelectedOptions();
1039
- }
1040
- };
1041
- __decorate([
1042
- vtyx.Prop()
1043
- ], SelecticStore.prototype, "value", void 0);
1044
- __decorate([
1045
- vtyx.Prop({ default: false })
1046
- ], SelecticStore.prototype, "selectionIsExcluded", void 0);
1047
- __decorate([
1048
- vtyx.Prop({ default: false })
1049
- ], SelecticStore.prototype, "disabled", void 0);
1050
- __decorate([
1051
- vtyx.Prop()
1052
- ], SelecticStore.prototype, "options", void 0);
1053
- __decorate([
1054
- vtyx.Prop()
1055
- ], SelecticStore.prototype, "childOptions", void 0);
1056
- __decorate([
1057
- vtyx.Prop({ default: () => [] })
1058
- ], SelecticStore.prototype, "groups", void 0);
1059
- __decorate([
1060
- vtyx.Prop()
1061
- ], SelecticStore.prototype, "texts", void 0);
1062
- __decorate([
1063
- vtyx.Prop()
1064
- ], SelecticStore.prototype, "params", void 0);
1065
- __decorate([
1066
- vtyx.Prop()
1067
- ], SelecticStore.prototype, "fetchCallback", void 0);
1068
- __decorate([
1069
- vtyx.Prop()
1070
- ], SelecticStore.prototype, "getItemsCallback", void 0);
1071
- __decorate([
1072
- vtyx.Prop({ default: false })
1073
- ], SelecticStore.prototype, "keepOpenWithOtherSelectic", void 0);
1074
- __decorate([
1075
- vtyx.Watch('options')
1076
- ], SelecticStore.prototype, "onOptionsChange", null);
1077
- __decorate([
1078
- vtyx.Watch('childOptions')
1079
- ], SelecticStore.prototype, "onChildOptionsChange", null);
1080
- __decorate([
1081
- vtyx.Watch('value')
1082
- ], SelecticStore.prototype, "onValueChange", null);
1083
- __decorate([
1084
- vtyx.Watch('selectionIsExcluded')
1085
- ], SelecticStore.prototype, "onSelectionExcludedChange", null);
1086
- __decorate([
1087
- vtyx.Watch('disabled')
1088
- ], SelecticStore.prototype, "onDisabledChange", null);
1089
- __decorate([
1090
- vtyx.Watch('state.filteredOptions')
1091
- ], SelecticStore.prototype, "onFilteredChange", null);
1092
- __decorate([
1093
- vtyx.Watch('state.internalValue')
1094
- ], SelecticStore.prototype, "onInternalValueChange", null);
1095
- __decorate([
1096
- vtyx.Watch('state.allOptions')
1097
- ], SelecticStore.prototype, "onAllOptionChange", null);
1098
- __decorate([
1099
- vtyx.Watch('state.totalAllOptions')
1100
- ], SelecticStore.prototype, "onTotalAllOptionsChange", null);
1101
- SelecticStore = __decorate([
1102
- vtyx.Component
1103
- ], SelecticStore);
1104
- var Store = SelecticStore;
1151
+ }
1105
1152
 
1106
1153
  /* File Purpose:
1107
1154
  * It displays the core element which is always visible (where selection is
1108
1155
  * displayed) and handles all interaction with it.
1109
1156
  */
1110
- var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
1157
+ var __decorate$4 = (this && this.__decorate) || function (decorators, target, key, desc) {
1111
1158
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1112
1159
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1113
1160
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1114
1161
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1115
1162
  };
1116
- let Selectic = class Selectic extends vtyx.Vue {
1163
+ let MainInput = class MainInput extends vtyx.Vue {
1117
1164
  constructor() {
1118
1165
  super(...arguments);
1119
1166
  /* }}} */
@@ -1159,7 +1206,7 @@ let Selectic = class Selectic extends vtyx.Vue {
1159
1206
  get clearedLabel() {
1160
1207
  const isMultiple = this.store.state.multiple;
1161
1208
  const labelKey = isMultiple ? 'clearSelections' : 'clearSelection';
1162
- return this.store.labels[labelKey];
1209
+ return this.store.data.labels[labelKey];
1163
1210
  }
1164
1211
  get singleSelectedItem() {
1165
1212
  const state = this.store.state;
@@ -1185,7 +1232,7 @@ let Selectic = class Selectic extends vtyx.Vue {
1185
1232
  }
1186
1233
  get reverseSelectionLabel() {
1187
1234
  const labelKey = 'reverseSelection';
1188
- return this.store.labels[labelKey];
1235
+ return this.store.data.labels[labelKey];
1189
1236
  }
1190
1237
  get formatItem() {
1191
1238
  const formatSelection = this.store.state.formatSelection;
@@ -1222,8 +1269,9 @@ let Selectic = class Selectic extends vtyx.Vue {
1222
1269
  if (!store.state.multiple || nbHiddenItems === 0) {
1223
1270
  return '';
1224
1271
  }
1225
- const text = nbHiddenItems === 1 ? store.labels.moreSelectedItem
1226
- : store.labels.moreSelectedItems;
1272
+ const labels = store.data.labels;
1273
+ const text = nbHiddenItems === 1 ? labels.moreSelectedItem
1274
+ : labels.moreSelectedItems;
1227
1275
  return text.replace(/%d/, nbHiddenItems.toString());
1228
1276
  }
1229
1277
  get moreSelectedTitle() {
@@ -1305,59 +1353,58 @@ let Selectic = class Selectic extends vtyx.Vue {
1305
1353
  }
1306
1354
  /* }}} */
1307
1355
  render() {
1308
- const h = this.renderWrapper();
1309
- return (h("div", { class: "has-feedback", on: {
1356
+ return (vtyx.h("div", { class: "has-feedback", on: {
1310
1357
  'click.prevent.stop': () => this.toggleFocus(),
1311
1358
  } },
1312
- h("div", { id: this.selecticId, class: ['selectic-input form-control',
1359
+ vtyx.h("div", { id: this.selecticId, class: ['selectic-input form-control',
1313
1360
  {
1314
1361
  focused: this.store.state.isOpen,
1315
1362
  disabled: this.store.state.disabled,
1316
1363
  }] },
1317
- this.hasValue && !this.store.state.multiple && (h("span", { class: "selectic-item_text", style: this.singleStyle, title: this.singleSelectedItem || '' }, this.singleSelectedItem)),
1318
- this.displayPlaceholder && (h("span", { class: [
1364
+ this.hasValue && !this.store.state.multiple && (vtyx.h("span", { class: "selectic-item_text", style: this.singleStyle, title: this.singleSelectedItem || '' }, this.singleSelectedItem)),
1365
+ this.displayPlaceholder && (vtyx.h("span", { class: [
1319
1366
  'selectic-input__selected-items__placeholder',
1320
1367
  'selectic-item_text',
1321
1368
  ], title: this.store.state.placeholder }, this.store.state.placeholder)),
1322
- this.store.state.multiple && (h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
1323
- this.isSelectionReversed && (h("span", { class: "fa fa-strikethrough selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
1324
- this.showSelectedOptions.map((item) => (h("div", { class: "single-value", style: item.style, title: item.text, on: {
1369
+ this.store.state.multiple && (vtyx.h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
1370
+ this.isSelectionReversed && (vtyx.h("span", { class: "fa fa-strikethrough selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
1371
+ this.showSelectedOptions.map((item) => (vtyx.h("div", { class: "single-value", style: item.style, title: item.text, on: {
1325
1372
  click: () => this.$emit('item:click', item.id),
1326
1373
  } },
1327
- h("span", { class: "selectic-input__selected-items__value" }, item.text),
1328
- !this.isDisabled && (h("span", { class: "fa fa-times selectic-input__selected-items__icon", on: {
1374
+ vtyx.h("span", { class: "selectic-input__selected-items__value" }, item.text),
1375
+ !this.isDisabled && (vtyx.h("span", { class: "fa fa-times selectic-input__selected-items__icon", on: {
1329
1376
  'click.prevent.stop': () => this.selectItem(item.id),
1330
1377
  } }))))),
1331
- this.moreSelectedNb && (h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
1332
- this.showClearAll && (h("span", { class: "fa fa-times selectic-input__clear-icon", title: this.clearedLabel, on: { 'click.prevent.stop': this.clearSelection } }))),
1333
- h("div", { class: [
1378
+ this.moreSelectedNb && (vtyx.h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
1379
+ this.showClearAll && (vtyx.h("span", { class: "fa fa-times selectic-input__clear-icon", title: this.clearedLabel, on: { 'click.prevent.stop': this.clearSelection } }))),
1380
+ vtyx.h("div", { class: [
1334
1381
  'selectic__icon-container',
1335
1382
  'form-control-feedback',
1336
1383
  { focused: this.store.state.isOpen }
1337
1384
  ], on: {
1338
1385
  'click.prevent.stop': () => this.toggleFocus(),
1339
1386
  } },
1340
- h("span", { class: "fa fa-caret-down selectic-icon" }))));
1387
+ vtyx.h("span", { class: "fa fa-caret-down selectic-icon" }))));
1341
1388
  }
1342
1389
  };
1343
- __decorate$1([
1390
+ __decorate$4([
1344
1391
  vtyx.Prop()
1345
- ], Selectic.prototype, "store", void 0);
1346
- __decorate$1([
1392
+ ], MainInput.prototype, "store", void 0);
1393
+ __decorate$4([
1347
1394
  vtyx.Prop({ default: '' })
1348
- ], Selectic.prototype, "id", void 0);
1349
- __decorate$1([
1395
+ ], MainInput.prototype, "id", void 0);
1396
+ __decorate$4([
1350
1397
  vtyx.Watch('store.state.internalValue')
1351
- ], Selectic.prototype, "onInternalChange", null);
1352
- Selectic = __decorate$1([
1398
+ ], MainInput.prototype, "onInternalChange", null);
1399
+ MainInput = __decorate$4([
1353
1400
  vtyx.Component
1354
- ], Selectic);
1355
- var MainInput = Selectic;
1401
+ ], MainInput);
1402
+ var MainInput$1 = MainInput;
1356
1403
 
1357
1404
  /* File Purpose:
1358
1405
  * It manages all controls which can filter the data.
1359
1406
  */
1360
- var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
1407
+ var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
1361
1408
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1362
1409
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1363
1410
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1373,7 +1420,7 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1373
1420
  /* }}} */
1374
1421
  /* {{{ computed */
1375
1422
  get searchPlaceholder() {
1376
- return this.store.labels.searchPlaceholder;
1423
+ return this.store.data.labels.searchPlaceholder;
1377
1424
  }
1378
1425
  get selectionIsExcluded() {
1379
1426
  return this.store.state.selectionIsExcluded;
@@ -1383,12 +1430,12 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1383
1430
  const state = store.state;
1384
1431
  const isMultiple = state.multiple;
1385
1432
  const hasItems = state.filteredOptions.length === 0;
1386
- const canNotSelect = !!state.searchText && !store.hasAllItems;
1433
+ const canNotSelect = !!state.searchText && !vue.unref(store.hasAllItems);
1387
1434
  return !isMultiple || hasItems || canNotSelect;
1388
1435
  }
1389
1436
  get disableRevert() {
1390
1437
  const store = this.store;
1391
- return !store.state.multiple || !store.hasFetchedAllItems;
1438
+ return !store.state.multiple || !vue.unref(store.hasFetchedAllItems);
1392
1439
  }
1393
1440
  get enableRevert() {
1394
1441
  const state = this.store.state;
@@ -1408,11 +1455,11 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1408
1455
  return;
1409
1456
  }
1410
1457
  this.closed = false;
1411
- el.value += key;
1412
- this.store.commit('searchText', el.value);
1413
- setTimeout(() => {
1414
- el.focus();
1415
- }, 0);
1458
+ if (el) {
1459
+ el.value += key;
1460
+ this.store.commit('searchText', el.value);
1461
+ }
1462
+ this.getFocus();
1416
1463
  }
1417
1464
  }
1418
1465
  onInput(evt) {
@@ -1426,11 +1473,16 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1426
1473
  this.store.commit('selectionIsExcluded', !this.selectionIsExcluded);
1427
1474
  }
1428
1475
  togglePanel() {
1476
+ if (this.store.state.keepFilterOpen === true) {
1477
+ this.closed = false;
1478
+ return;
1479
+ }
1429
1480
  this.closed = !this.closed;
1430
1481
  }
1431
1482
  getFocus() {
1432
- if (!this.closed) {
1433
- setTimeout(() => this.$refs.filterInput.focus(), 0);
1483
+ const el = this.$refs.filterInput;
1484
+ if (!this.closed && el) {
1485
+ setTimeout(() => el.focus(), 0);
1434
1486
  }
1435
1487
  }
1436
1488
  /* }}} */
@@ -1441,7 +1493,8 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1441
1493
  /* }}} */
1442
1494
  /* {{{ Life cycle */
1443
1495
  mounted() {
1444
- this.closed = !this.store.state.searchText;
1496
+ const state = this.store.state;
1497
+ this.closed = !state.keepFilterOpen && !state.searchText;
1445
1498
  document.addEventListener('keypress', this.onKeyPressed);
1446
1499
  this.getFocus();
1447
1500
  }
@@ -1450,51 +1503,53 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
1450
1503
  }
1451
1504
  /* }}} */
1452
1505
  render() {
1453
- const h = this.renderWrapper();
1454
- return (h("div", { class: "filter-panel" },
1455
- h("div", { class: {
1506
+ const store = this.store;
1507
+ const state = store.state;
1508
+ const labels = store.data.labels;
1509
+ return (vtyx.h("div", { class: "filter-panel" },
1510
+ vtyx.h("div", { class: {
1456
1511
  panelclosed: this.closed,
1457
1512
  panelopened: !this.closed,
1458
1513
  } },
1459
- h("div", { class: "filter-panel__input form-group has-feedback" },
1460
- h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: this.store.state.searchText, on: {
1514
+ vtyx.h("div", { class: "filter-panel__input form-group has-feedback" },
1515
+ vtyx.h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: state.searchText, on: {
1461
1516
  'input.stop.prevent': this.onInput,
1462
1517
  }, ref: "filterInput" }),
1463
- h("span", { class: "fa fa-search selectic-search-scope\n form-control-feedback" })),
1464
- this.store.state.multiple && (h("div", { class: "toggle-selectic" },
1465
- h("label", { class: ['control-label', {
1518
+ vtyx.h("span", { class: "fa fa-search selectic-search-scope\n form-control-feedback" })),
1519
+ state.multiple && (vtyx.h("div", { class: "toggle-selectic" },
1520
+ vtyx.h("label", { class: ['control-label', {
1466
1521
  'selectic__label-disabled': this.disableSelectAll,
1467
1522
  }] },
1468
- h("input", { type: "checkbox", checked: this.store.state.status.areAllSelected, disabled: this.disableSelectAll, on: {
1523
+ vtyx.h("input", { type: "checkbox", checked: state.status.areAllSelected, disabled: this.disableSelectAll, on: {
1469
1524
  change: this.onSelectAll,
1470
1525
  } }),
1471
- this.store.labels.selectAll))),
1472
- this.enableRevert && (h("div", { class: ['toggle-selectic', {
1526
+ labels.selectAll))),
1527
+ this.enableRevert && (vtyx.h("div", { class: ['toggle-selectic', {
1473
1528
  'selectic__label-disabled': this.disableRevert,
1474
1529
  }] },
1475
- h("label", { class: "control-label" },
1476
- h("input", { type: "checkbox", checked: this.selectionIsExcluded, disabled: this.disableRevert, on: {
1530
+ vtyx.h("label", { class: "control-label" },
1531
+ vtyx.h("input", { type: "checkbox", checked: this.selectionIsExcluded, disabled: this.disableRevert, on: {
1477
1532
  change: this.onExclude,
1478
1533
  } }),
1479
- this.store.labels.excludeResult)))),
1480
- h("div", { class: "curtain-handler", on: {
1534
+ labels.excludeResult)))),
1535
+ !state.keepFilterOpen && (vtyx.h("div", { class: "curtain-handler", on: {
1481
1536
  'click.prevent.stop': this.togglePanel,
1482
1537
  } },
1483
- h("span", { class: "fa fa-search" }),
1484
- h("span", { class: {
1538
+ vtyx.h("span", { class: "fa fa-search" }),
1539
+ vtyx.h("span", { class: {
1485
1540
  'fa': true,
1486
1541
  'fa-caret-down': this.closed,
1487
1542
  'fa-caret-up': !this.closed,
1488
- } }))));
1543
+ } })))));
1489
1544
  }
1490
1545
  };
1491
- __decorate$2([
1546
+ __decorate$3([
1492
1547
  vtyx.Prop()
1493
1548
  ], FilterPanel.prototype, "store", void 0);
1494
- __decorate$2([
1549
+ __decorate$3([
1495
1550
  vtyx.Watch('closed')
1496
1551
  ], FilterPanel.prototype, "onClosed", null);
1497
- FilterPanel = __decorate$2([
1552
+ FilterPanel = __decorate$3([
1498
1553
  vtyx.Component
1499
1554
  ], FilterPanel);
1500
1555
  var Filter = FilterPanel;
@@ -1503,7 +1558,7 @@ var Filter = FilterPanel;
1503
1558
  * It displays each item in an efficient way (optimizes DOM consumption).
1504
1559
  * It handles interactions with these items.
1505
1560
  */
1506
- var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
1561
+ var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
1507
1562
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1508
1563
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1509
1564
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1527,7 +1582,8 @@ let List = class List extends vtyx.Vue {
1527
1582
  return this.store.state.multiple;
1528
1583
  }
1529
1584
  get itemsMargin() {
1530
- return this.store.marginSize;
1585
+ /* XXX: I don't really know when we should use value or not... */
1586
+ return vue.unref(this.store.marginSize);
1531
1587
  }
1532
1588
  get shortOptions() {
1533
1589
  const endIndex = this.endIndex;
@@ -1559,7 +1615,7 @@ let List = class List extends vtyx.Vue {
1559
1615
  }
1560
1616
  get startIndex() {
1561
1617
  const endIndex = this.endIndex;
1562
- const idx = endIndex - this.store.itemsPerPage - 3 * this.itemsMargin;
1618
+ const idx = endIndex - this.store.data.itemsPerPage - 3 * this.itemsMargin;
1563
1619
  return Math.max(0, idx);
1564
1620
  }
1565
1621
  get leftItems() {
@@ -1603,7 +1659,8 @@ let List = class List extends vtyx.Vue {
1603
1659
  const scrollTop = this.$refs.elList.scrollTop;
1604
1660
  const topIndex = Math.floor(scrollTop / this.itemHeight);
1605
1661
  const total = this.totalItems;
1606
- const bottomIndex = Math.min(topIndex + this.store.itemsPerPage, total);
1662
+ const itemsPerPage = this.store.data.itemsPerPage;
1663
+ const bottomIndex = Math.min(topIndex + itemsPerPage, total);
1607
1664
  this.debounce(() => this.store.commit('offsetItem', bottomIndex));
1608
1665
  this.computeGroupId(topIndex);
1609
1666
  }
@@ -1671,12 +1728,11 @@ let List = class List extends vtyx.Vue {
1671
1728
  }
1672
1729
  /* }}} */
1673
1730
  render() {
1674
- const h = this.renderWrapper();
1675
- return (h("ul", { on: {
1731
+ return (vtyx.h("ul", { on: {
1676
1732
  scroll: this.checkOffset,
1677
1733
  }, ref: "elList" },
1678
- !!this.topOffset && (h("li", { class: "selectic-item", style: `height:${this.topOffset}px;` })),
1679
- this.shortOptions.map((option, idx) => (h("li", { on: {
1734
+ !!this.topOffset && (vtyx.h("li", { class: "selectic-item", style: `height:${this.topOffset}px;` })),
1735
+ this.shortOptions.map((option, idx) => (vtyx.h("li", { on: {
1680
1736
  'click.prevent.stop': () => this.click(option),
1681
1737
  'mouseover': () => this.onMouseOver(idx),
1682
1738
  }, class: ['selectic-item', option.className || '', {
@@ -1686,28 +1742,28 @@ let List = class List extends vtyx.Vue {
1686
1742
  'selectic-item__is-in-group': !!option.group,
1687
1743
  'selectic-item__is-group': option.isGroup,
1688
1744
  }], style: option.style, title: option.title, key: 'selectic-item-' + (idx + this.startIndex) },
1689
- this.isMultiple && (h("span", { class: "fa fa-fw fa-check selectic-item_icon" })),
1690
- option.icon && (h("span", { class: option.icon })),
1745
+ this.isMultiple && (vtyx.h("span", { class: "fa fa-fw fa-check selectic-item_icon" })),
1746
+ option.icon && (vtyx.h("span", { class: option.icon })),
1691
1747
  option.text))),
1692
- !!this.bottomOffset && (h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` }))));
1748
+ !!this.bottomOffset && (vtyx.h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` }))));
1693
1749
  }
1694
1750
  };
1695
- __decorate$3([
1751
+ __decorate$2([
1696
1752
  vtyx.Prop()
1697
1753
  ], List.prototype, "store", void 0);
1698
- __decorate$3([
1754
+ __decorate$2([
1699
1755
  vtyx.Watch('store.state.activeItemIdx')
1700
1756
  ], List.prototype, "onIndexChange", null);
1701
- __decorate$3([
1757
+ __decorate$2([
1702
1758
  vtyx.Watch('store.state.offsetItem')
1703
1759
  ], List.prototype, "onOffsetChange", null);
1704
- __decorate$3([
1760
+ __decorate$2([
1705
1761
  vtyx.Watch('filteredOptions')
1706
1762
  ], List.prototype, "onFilteredOptionsChange", null);
1707
- __decorate$3([
1763
+ __decorate$2([
1708
1764
  vtyx.Watch('groupId')
1709
1765
  ], List.prototype, "onGroupIdChange", null);
1710
- List = __decorate$3([
1766
+ List = __decorate$2([
1711
1767
  vtyx.Component
1712
1768
  ], List);
1713
1769
  var List$1 = List;
@@ -1716,7 +1772,7 @@ var List$1 = List;
1716
1772
  * It manages the panel which is displayed when Selectic is open.
1717
1773
  * Content of inner elements are related to dedicated files.
1718
1774
  */
1719
- var __decorate$4 = (this && this.__decorate) || function (decorators, target, key, desc) {
1775
+ var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
1720
1776
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1721
1777
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1722
1778
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -1735,7 +1791,7 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
1735
1791
  /* }}} */
1736
1792
  /* {{{ computed */
1737
1793
  get searchingLabel() {
1738
- return this.store.labels.searching;
1794
+ return this.store.data.labels.searching;
1739
1795
  }
1740
1796
  get searching() {
1741
1797
  return this.store.state.status.searching;
@@ -1750,9 +1806,9 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
1750
1806
  const store = this.store;
1751
1807
  if (store.state.filteredOptions.length === 0) {
1752
1808
  if (store.state.searchText) {
1753
- return store.labels.noResult;
1809
+ return store.data.labels.noResult;
1754
1810
  }
1755
- return store.labels.noData;
1811
+ return store.data.labels.noData;
1756
1812
  }
1757
1813
  return '';
1758
1814
  }
@@ -1849,10 +1905,10 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
1849
1905
  /* }}} */
1850
1906
  /* {{{ watch */
1851
1907
  onFilteredOptionsChange() {
1852
- vtyx.Vue.nextTick(this.computeListSize, this);
1908
+ this.$nextTick(this.computeListSize);
1853
1909
  }
1854
1910
  onHideFilterChange() {
1855
- vtyx.Vue.nextTick(this.computeListSize, this);
1911
+ this.$nextTick(this.computeListSize);
1856
1912
  }
1857
1913
  /* }}} */
1858
1914
  /* {{{ methods */
@@ -1882,47 +1938,48 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
1882
1938
  }
1883
1939
  /* }}} */
1884
1940
  render() {
1885
- const h = this.renderWrapper();
1886
1941
  const store = this.store;
1887
1942
  const state = store.state;
1888
- return (h("div", { style: this.positionStyle, class: "selectic selectic__extended-list" },
1889
- !state.hideFilter && (h(Filter, { store: this.store })),
1890
- state.groups.size > 0 && state.totalFilteredOptions > store.itemsPerPage && (h("span", { class: "selectic-item selectic-item--header selectic-item__is-group" }, this.topGroup)),
1891
- h(List$1, { store: store, class: "selectic__extended-list__list-items", on: {
1943
+ const isGroup = state.groups.size > 0 &&
1944
+ state.totalFilteredOptions > store.data.itemsPerPage;
1945
+ return (vtyx.h("div", { style: this.positionStyle, class: "selectic selectic__extended-list" },
1946
+ !state.hideFilter && (vtyx.h(Filter, { store: this.store })),
1947
+ isGroup && (vtyx.h("span", { class: "selectic-item selectic-item--header selectic-item__is-group" }, this.topGroup)),
1948
+ vtyx.h(List$1, { store: store, class: "selectic__extended-list__list-items", on: {
1892
1949
  groupId: this.getGroup,
1893
1950
  } }),
1894
- this.infoMessage && (h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
1895
- this.searching && (h("div", { class: "selectic__message" },
1896
- h("span", { class: "fa fa-spinner fa-spin" }),
1951
+ this.infoMessage && (vtyx.h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
1952
+ this.searching && (vtyx.h("div", { class: "selectic__message" },
1953
+ vtyx.h("span", { class: "fa fa-spinner fa-spin" }),
1897
1954
  this.searchingLabel)),
1898
- this.errorMessage && (h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
1955
+ this.errorMessage && (vtyx.h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
1899
1956
  }
1900
1957
  };
1901
- __decorate$4([
1958
+ __decorate$1([
1902
1959
  vtyx.Prop()
1903
1960
  ], ExtendedList.prototype, "store", void 0);
1904
- __decorate$4([
1961
+ __decorate$1([
1905
1962
  vtyx.Prop({ default: 0 })
1906
1963
  ], ExtendedList.prototype, "elementLeft", void 0);
1907
- __decorate$4([
1964
+ __decorate$1([
1908
1965
  vtyx.Prop({ default: 0 })
1909
1966
  ], ExtendedList.prototype, "elementRight", void 0);
1910
- __decorate$4([
1967
+ __decorate$1([
1911
1968
  vtyx.Prop({ default: 0 })
1912
1969
  ], ExtendedList.prototype, "elementTop", void 0);
1913
- __decorate$4([
1970
+ __decorate$1([
1914
1971
  vtyx.Prop({ default: 0 })
1915
1972
  ], ExtendedList.prototype, "elementBottom", void 0);
1916
- __decorate$4([
1973
+ __decorate$1([
1917
1974
  vtyx.Prop({ default: 300 })
1918
1975
  ], ExtendedList.prototype, "width", void 0);
1919
- __decorate$4([
1976
+ __decorate$1([
1920
1977
  vtyx.Watch('store.state.filteredOptions')
1921
1978
  ], ExtendedList.prototype, "onFilteredOptionsChange", null);
1922
- __decorate$4([
1979
+ __decorate$1([
1923
1980
  vtyx.Watch('store.state.hideFilter')
1924
1981
  ], ExtendedList.prototype, "onHideFilterChange", null);
1925
- ExtendedList = __decorate$4([
1982
+ ExtendedList = __decorate$1([
1926
1983
  vtyx.Component
1927
1984
  ], ExtendedList);
1928
1985
  var ExtendedList$1 = ExtendedList;
@@ -1933,16 +1990,16 @@ var ExtendedList$1 = ExtendedList;
1933
1990
  * these items dynamically which allow to build very long list without loading
1934
1991
  * all data.
1935
1992
  */
1936
- var __decorate$5 = (this && this.__decorate) || function (decorators, target, key, desc) {
1993
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
1937
1994
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1938
1995
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1939
1996
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1940
1997
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1941
1998
  };
1942
- function changeTexts$1(texts) {
1943
- changeTexts(texts);
1999
+ function changeTexts(texts) {
2000
+ changeTexts$1(texts);
1944
2001
  }
1945
- let Selectic$1 = class Selectic extends vtyx.Vue {
2002
+ let Selectic = class Selectic extends vtyx.Vue {
1946
2003
  constructor() {
1947
2004
  super(...arguments);
1948
2005
  /* }}} */
@@ -1952,15 +2009,16 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
1952
2009
  this.elementLeft = 0;
1953
2010
  this.elementRight = 0;
1954
2011
  this.width = 0;
2012
+ this.hasBeenRendered = false;
1955
2013
  this.store = {};
1956
2014
  }
1957
2015
  /* }}} */
1958
2016
  /* {{{ computed */
1959
2017
  get isFocused() {
1960
- if (!this.store || !this.store.state) {
2018
+ if (!this.hasBeenRendered) {
1961
2019
  return false;
1962
2020
  }
1963
- return this.store.state.isOpen;
2021
+ return !!this.store.state.isOpen;
1964
2022
  }
1965
2023
  get scrollListener() {
1966
2024
  return this.computeOffset.bind(this, true);
@@ -2068,15 +2126,15 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2068
2126
  }
2069
2127
  computeOffset(doNotAddListener = false) {
2070
2128
  const mainInput = this.$refs.mainInput;
2071
- if (!mainInput || !mainInput.$el) {
2129
+ const mainEl = mainInput === null || mainInput === void 0 ? void 0 : mainInput.$el;
2130
+ if (!mainEl) {
2072
2131
  /* This method has been called too soon (before render function) */
2073
2132
  return;
2074
2133
  }
2075
- const mainEl = mainInput.$el;
2076
2134
  const _elementsListeners = this._elementsListeners;
2077
2135
  /* add listeners */
2078
2136
  if (!doNotAddListener) {
2079
- let el = mainInput.$el;
2137
+ let el = mainEl;
2080
2138
  while (el) {
2081
2139
  el.addEventListener('scroll', this.scrollListener, { passive: true });
2082
2140
  _elementsListeners.push(el);
@@ -2115,7 +2173,7 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2115
2173
  window.addEventListener('resize', this.windowResize, false);
2116
2174
  document.addEventListener('click', this.outsideListener, true);
2117
2175
  this.computeOffset();
2118
- this.$emit('open', this);
2176
+ this.emit('open');
2119
2177
  }
2120
2178
  else {
2121
2179
  this.removeListeners();
@@ -2123,7 +2181,7 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2123
2181
  this.$emit('change', this.getValue(), state.selectionIsExcluded, this);
2124
2182
  this.store.resetChange();
2125
2183
  }
2126
- this.$emit('close', this);
2184
+ this.emit('close');
2127
2185
  }
2128
2186
  }
2129
2187
  compareValues(oldValue, newValue) {
@@ -2150,10 +2208,10 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2150
2208
  }
2151
2209
  }
2152
2210
  onExcludedChange() {
2153
- this.store.selectionIsExcluded = this.selectionIsExcluded;
2211
+ this.store.props.selectionIsExcluded = this.selectionIsExcluded;
2154
2212
  }
2155
2213
  onOptionsChange() {
2156
- this.store.options = this.options;
2214
+ this.store.props.options = Array.from(this.options);
2157
2215
  }
2158
2216
  onTextsChange() {
2159
2217
  const texts = this.texts;
@@ -2162,7 +2220,7 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2162
2220
  }
2163
2221
  }
2164
2222
  onDisabledChange() {
2165
- this.store.disabled = this.disabled;
2223
+ this.store.props.disabled = this.disabled;
2166
2224
  }
2167
2225
  onGroupsChanged() {
2168
2226
  this.store.changeGroups(this.groups);
@@ -2181,13 +2239,14 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2181
2239
  const oldValue = this._oldValue;
2182
2240
  const value = this.getValue();
2183
2241
  const areSimilar = this.compareValues(oldValue, value);
2184
- /* should not trigger when initializing internalValue, but should do if it changes the inital value */
2242
+ /* should not trigger when initializing internalValue, but should do
2243
+ * if it changes the initial value */
2185
2244
  const canTrigger = (oldValue !== undefined || !this.hasGivenValue) && !areSimilar;
2186
2245
  if (canTrigger) {
2187
2246
  const selectionIsExcluded = this.store.state.selectionIsExcluded;
2188
- this.$emit('input', value, selectionIsExcluded, this);
2247
+ this.emit('input', value, selectionIsExcluded);
2189
2248
  if (!this.isFocused) {
2190
- this.$emit('change', value, selectionIsExcluded, this);
2249
+ this.emit('change', value, selectionIsExcluded);
2191
2250
  this.store.resetChange();
2192
2251
  }
2193
2252
  }
@@ -2210,243 +2269,298 @@ let Selectic$1 = class Selectic extends vtyx.Vue {
2210
2269
  this.store.commit('isOpen', false);
2211
2270
  }, 0);
2212
2271
  }
2213
- extractFromNode(node, text = '') {
2214
- var _a, _b, _c, _d, _e, _f, _g;
2215
- function styleToString(staticStyle) {
2216
- if (!staticStyle) {
2217
- return;
2218
- }
2219
- let styles = [];
2220
- for (const [key, value] of Object.entries(staticStyle)) {
2221
- styles.push(`${key}: ${value}`);
2222
- }
2223
- return styles.join(';');
2224
- }
2225
- const domProps = (_a = node.data) === null || _a === void 0 ? void 0 : _a.domProps;
2226
- const attrs = (_b = node.data) === null || _b === void 0 ? void 0 : _b.attrs;
2227
- const id = (_e = (_d = (_c = domProps === null || domProps === void 0 ? void 0 : domProps.value) !== null && _c !== void 0 ? _c : attrs === null || attrs === void 0 ? void 0 : attrs.value) !== null && _d !== void 0 ? _d : attrs === null || attrs === void 0 ? void 0 : attrs.id) !== null && _e !== void 0 ? _e : text;
2228
- const className = (_f = node.data) === null || _f === void 0 ? void 0 : _f.staticClass;
2229
- const style = styleToString((_g = node.data) === null || _g === void 0 ? void 0 : _g.staticStyle);
2230
- const optVal = {
2231
- id,
2232
- text,
2233
- className,
2234
- style,
2235
- };
2236
- if (attrs) {
2237
- for (const [key, val] of Object.entries(attrs)) {
2238
- switch (key) {
2239
- case 'title':
2240
- optVal.title = val;
2241
- break;
2242
- case 'disabled':
2243
- if (val === false) {
2244
- optVal.disabled = false;
2245
- }
2246
- else {
2247
- optVal.disabled = true;
2248
- }
2249
- break;
2250
- case 'group':
2251
- optVal.group = val;
2252
- break;
2253
- case 'icon':
2254
- optVal.icon = val;
2255
- break;
2256
- case 'data':
2257
- optVal.data = val;
2258
- break;
2259
- default:
2260
- if (key.startsWith('data')) {
2261
- if (typeof optVal.data !== 'object') {
2262
- optVal.data = {};
2263
- }
2264
- optVal.data[key.slice(5)] = val;
2265
- }
2266
- }
2267
- }
2272
+ _emit(event, ...args) {
2273
+ this.$emit(event, ...args);
2274
+ if (typeof this._on === 'function') {
2275
+ this._on(event, ...args);
2268
2276
  }
2269
- return optVal;
2270
- }
2271
- extractOptionFromNode(node) {
2272
- const children = node.children;
2273
- const text = (children && children[0].text || '').trim();
2274
- return this.extractFromNode(node, text);
2275
2277
  }
2276
- extractOptgroupFromNode(node) {
2277
- var _a;
2278
- const attrs = (_a = node.data) === null || _a === void 0 ? void 0 : _a.attrs;
2279
- const children = node.children || [];
2280
- const text = (attrs === null || attrs === void 0 ? void 0 : attrs.label) || '';
2281
- const options = [];
2282
- for (const child of children) {
2283
- if (child.tag === 'option') {
2284
- options.push(this.extractOptionFromNode(child));
2285
- }
2278
+ emit(event, value, isExcluded) {
2279
+ const automatic = this.store.state.status.automaticChange;
2280
+ const options = {
2281
+ instance: this,
2282
+ eventType: event,
2283
+ automatic,
2284
+ };
2285
+ switch (event) {
2286
+ case 'input':
2287
+ case 'change':
2288
+ const changeOptions = Object.assign({
2289
+ isExcluded: isExcluded,
2290
+ }, options);
2291
+ this._emit(event, value, changeOptions);
2292
+ break;
2293
+ case 'open':
2294
+ case 'focus':
2295
+ this._emit('open', options);
2296
+ this._emit('focus', options);
2297
+ break;
2298
+ case 'close':
2299
+ case 'blur':
2300
+ this._emit('close', options);
2301
+ this._emit('blur', options);
2302
+ break;
2303
+ case 'item:click':
2304
+ this._emit(event, value, options);
2305
+ break;
2286
2306
  }
2287
- const opt = this.extractFromNode(node, text);
2288
- opt.options = options;
2289
- return opt;
2290
2307
  }
2308
+ // private extractFromNode(node: Vue.VNode, text = ''): OptionValue {
2309
+ // function styleToString(staticStyle?: {[key: string]: string}): string | undefined {
2310
+ // if (!staticStyle) {
2311
+ // return;
2312
+ // }
2313
+ // let styles = [];
2314
+ // for (const [key, value] of Object.entries(staticStyle)) {
2315
+ // styles.push(`${key}: ${value}`);
2316
+ // }
2317
+ // return styles.join(';');
2318
+ // }
2319
+ // const domProps = node.data?.domProps;
2320
+ // const attrs = node.data?.attrs;
2321
+ // const id = domProps?.value ?? attrs?.value ?? attrs?.id ?? text;
2322
+ // const className = node.data?.staticClass;
2323
+ // const style = styleToString(node.data?.staticStyle);
2324
+ // const optVal: OptionValue = {
2325
+ // id,
2326
+ // text,
2327
+ // className,
2328
+ // style,
2329
+ // };
2330
+ // if (attrs) {
2331
+ // for (const [key, val] of Object.entries(attrs)) {
2332
+ // switch(key) {
2333
+ // case 'title':
2334
+ // optVal.title = val;
2335
+ // break;
2336
+ // case 'disabled':
2337
+ // if (val === false) {
2338
+ // optVal.disabled = false;
2339
+ // } else {
2340
+ // optVal.disabled = true;
2341
+ // }
2342
+ // break;
2343
+ // case 'group':
2344
+ // optVal.group = val;
2345
+ // break;
2346
+ // case 'icon':
2347
+ // optVal.icon = val;
2348
+ // break;
2349
+ // case 'data':
2350
+ // optVal.data = val;
2351
+ // break;
2352
+ // default:
2353
+ // if (key.startsWith('data')) {
2354
+ // if (typeof optVal.data !== 'object') {
2355
+ // optVal.data = {};
2356
+ // }
2357
+ // optVal.data[key.slice(5)] = val;
2358
+ // }
2359
+ // }
2360
+ // }
2361
+ // }
2362
+ // return optVal;
2363
+ // }
2364
+ // private extractOptionFromNode(node: Vue.VNode): OptionValue {
2365
+ // const children = node.children;
2366
+ // const text = (children && children[0].text || '').trim();
2367
+ // return this.extractFromNode(node, text);
2368
+ // }
2369
+ // private extractOptgroupFromNode(node: Vue.VNode): OptionValue {
2370
+ // const attrs = node.data?.attrs;
2371
+ // const children = node.children || [];
2372
+ // const text = attrs?.label || '';
2373
+ // const options: OptionValue[] = [];
2374
+ // for (const child of children) {
2375
+ // if (child.tag === 'option') {
2376
+ // options.push(this.extractOptionFromNode(child));
2377
+ // }
2378
+ // }
2379
+ // const opt = this.extractFromNode(node, text);
2380
+ // opt.options = options;
2381
+ // return opt;
2382
+ // }
2291
2383
  /* }}} */
2292
2384
  /* {{{ Life cycle */
2293
2385
  created() {
2386
+ var _a, _b, _c;
2294
2387
  this._elementsListeners = [];
2295
- this.store = new Store({ propsData: {
2296
- options: this.options,
2297
- value: this.value,
2298
- selectionIsExcluded: this.selectionIsExcluded,
2299
- disabled: this.disabled,
2300
- texts: this.texts,
2301
- groups: this.groups,
2302
- keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
2303
- params: {
2304
- multiple: this.multiple,
2305
- pageSize: this.params.pageSize || 100,
2306
- hideFilter: this.params.hideFilter !== undefined
2307
- ? this.params.hideFilter : 'auto',
2308
- allowRevert: this.params.allowRevert,
2309
- allowClearSelection: this.params.allowClearSelection || false,
2310
- autoSelect: this.params.autoSelect === undefined
2311
- ? !this.multiple && !this.params.fetchCallback
2312
- : this.params.autoSelect,
2313
- autoDisabled: typeof this.params.autoDisabled === 'boolean'
2314
- ? this.params.autoDisabled : true,
2315
- strictValue: this.params.strictValue || false,
2316
- selectionOverflow: this.params.selectionOverflow || 'collapsed',
2317
- placeholder: this.placeholder,
2318
- formatOption: this.params.formatOption,
2319
- formatSelection: this.params.formatSelection,
2320
- listPosition: this.params.listPosition || 'auto',
2321
- optionBehavior: this.params.optionBehavior,
2322
- isOpen: !!this.open,
2323
- },
2324
- fetchCallback: this.params.fetchCallback,
2325
- getItemsCallback: this.params.getItemsCallback,
2326
- } });
2388
+ this.store = new SelecticStore({
2389
+ options: this.options,
2390
+ value: this.value,
2391
+ selectionIsExcluded: this.selectionIsExcluded,
2392
+ disabled: this.disabled,
2393
+ texts: this.texts,
2394
+ groups: this.groups,
2395
+ keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
2396
+ params: {
2397
+ multiple: ((_a = this.multiple) !== null && _a !== void 0 ? _a : false) !== false,
2398
+ pageSize: this.params.pageSize || 100,
2399
+ hideFilter: (_b = this.params.hideFilter) !== null && _b !== void 0 ? _b : 'auto',
2400
+ allowRevert: this.params.allowRevert,
2401
+ allowClearSelection: this.params.allowClearSelection || false,
2402
+ autoSelect: this.params.autoSelect === undefined
2403
+ ? !this.multiple && !this.params.fetchCallback
2404
+ : this.params.autoSelect,
2405
+ autoDisabled: typeof this.params.autoDisabled === 'boolean'
2406
+ ? this.params.autoDisabled : true,
2407
+ strictValue: this.params.strictValue || false,
2408
+ selectionOverflow: this.params.selectionOverflow || 'collapsed',
2409
+ placeholder: this.placeholder,
2410
+ formatOption: this.params.formatOption,
2411
+ formatSelection: this.params.formatSelection,
2412
+ listPosition: this.params.listPosition || 'auto',
2413
+ optionBehavior: this.params.optionBehavior,
2414
+ isOpen: ((_c = this.open) !== null && _c !== void 0 ? _c : false) !== false,
2415
+ },
2416
+ fetchCallback: this.params.fetchCallback,
2417
+ getItemsCallback: this.params.getItemsCallback,
2418
+ });
2419
+ if (typeof this._getMethods === 'function') {
2420
+ this._getMethods({
2421
+ clearCache: this.clearCache.bind(this),
2422
+ changeTexts: this.changeTexts.bind(this),
2423
+ getValue: this.getValue.bind(this),
2424
+ getSelectedItems: this.getSelectedItems.bind(this),
2425
+ isEmpty: this.isEmpty.bind(this),
2426
+ toggleOpen: this.toggleOpen.bind(this),
2427
+ });
2428
+ }
2327
2429
  }
2328
2430
  mounted() {
2329
- setTimeout(() => this.computeOffset(), 0);
2431
+ setTimeout(() => {
2432
+ this.hasBeenRendered = true;
2433
+ this.computeOffset();
2434
+ }, 100);
2330
2435
  }
2331
2436
  beforeUpdate() {
2332
- const elements = this.$slots.default;
2333
- if (!elements) {
2334
- this.store.childOptions = [];
2335
- return;
2336
- }
2337
- const options = [];
2338
- for (const node of elements) {
2339
- if (node.tag === 'option') {
2340
- const prop = this.extractOptionFromNode(node);
2341
- options.push(prop);
2342
- }
2343
- else if (node.tag === 'optgroup') {
2344
- const prop = this.extractOptgroupFromNode(node);
2345
- options.push(prop);
2346
- }
2347
- }
2348
- this.store.childOptions = options;
2437
+ // const elements = this.$slots.default;
2438
+ // if (!elements) {
2439
+ // this.store.childOptions = [];
2440
+ // return;
2441
+ // }
2442
+ // const options = [];
2443
+ // for (const node of elements) {
2444
+ // if (node.tag === 'option') {
2445
+ // const prop = this.extractOptionFromNode(node);
2446
+ // options.push(prop);
2447
+ // } else
2448
+ // if (node.tag === 'optgroup') {
2449
+ // const prop = this.extractOptgroupFromNode(node);
2450
+ // options.push(prop);
2451
+ // }
2452
+ // }
2453
+ // this.store.childOptions = options;
2349
2454
  }
2350
2455
  beforeDestroy() {
2351
2456
  this.removeListeners();
2352
2457
  }
2353
2458
  /* }}} */
2354
2459
  render() {
2355
- const h = this.renderWrapper();
2356
2460
  const id = this.id || undefined;
2357
- return (h("div", { class: this.selecticClass, title: this.title, "data-selectic": "true", on: {
2358
- 'click.prevent.stop': () => this.store.commit('isOpen', true),
2461
+ const store = this.store;
2462
+ if (!store.state) {
2463
+ return; /* component is not ready yet */
2464
+ }
2465
+ return (vtyx.h("div", { class: this.selecticClass, title: this.title, "data-selectic": "true", on: {
2466
+ 'click.prevent.stop': () => store.commit('isOpen', true),
2359
2467
  } },
2360
- h("input", { type: "text", id: id, value: this.inputValue, class: "selectic__input-value", on: {
2361
- focus: () => this.store.commit('isOpen', true),
2468
+ vtyx.h("input", { type: "text", id: id, value: this.inputValue, class: "selectic__input-value", on: {
2469
+ focus: () => store.commit('isOpen', true),
2362
2470
  blur: this.checkFocus,
2363
2471
  } }),
2364
- h(MainInput, { store: this.store, id: id, on: {
2365
- 'item:click': (id) => this.$emit('item:click', id, this),
2472
+ vtyx.h(MainInput$1, { store: store, id: id, on: {
2473
+ 'item:click': (id) => this.emit('item:click', id),
2366
2474
  }, ref: "mainInput" }),
2367
- this.isFocused && (h(ExtendedList$1, { class: this.className, store: this.store, elementBottom: this.elementBottom, elementTop: this.elementTop, elementLeft: this.elementLeft, elementRight: this.elementRight, width: this.width, ref: "extendedList" }))));
2475
+ this.isFocused && (vtyx.h(ExtendedList$1, { class: this.className, store: store, elementBottom: this.elementBottom, elementTop: this.elementTop, elementLeft: this.elementLeft, elementRight: this.elementRight, width: this.width, ref: "extendedList" }))));
2368
2476
  }
2369
2477
  };
2370
- __decorate$5([
2478
+ __decorate([
2371
2479
  vtyx.Prop()
2372
- ], Selectic$1.prototype, "value", void 0);
2373
- __decorate$5([
2480
+ ], Selectic.prototype, "value", void 0);
2481
+ __decorate([
2374
2482
  vtyx.Prop({ default: false })
2375
- ], Selectic$1.prototype, "selectionIsExcluded", void 0);
2376
- __decorate$5([
2483
+ ], Selectic.prototype, "selectionIsExcluded", void 0);
2484
+ __decorate([
2377
2485
  vtyx.Prop({ default: () => [] })
2378
- ], Selectic$1.prototype, "options", void 0);
2379
- __decorate$5([
2486
+ ], Selectic.prototype, "options", void 0);
2487
+ __decorate([
2380
2488
  vtyx.Prop({ default: () => [] })
2381
- ], Selectic$1.prototype, "groups", void 0);
2382
- __decorate$5([
2489
+ ], Selectic.prototype, "groups", void 0);
2490
+ __decorate([
2383
2491
  vtyx.Prop({ default: false })
2384
- ], Selectic$1.prototype, "multiple", void 0);
2385
- __decorate$5([
2492
+ ], Selectic.prototype, "multiple", void 0);
2493
+ __decorate([
2386
2494
  vtyx.Prop({ default: false })
2387
- ], Selectic$1.prototype, "disabled", void 0);
2388
- __decorate$5([
2495
+ ], Selectic.prototype, "disabled", void 0);
2496
+ __decorate([
2389
2497
  vtyx.Prop({ default: '' })
2390
- ], Selectic$1.prototype, "placeholder", void 0);
2391
- __decorate$5([
2498
+ ], Selectic.prototype, "placeholder", void 0);
2499
+ __decorate([
2392
2500
  vtyx.Prop({ default: '' })
2393
- ], Selectic$1.prototype, "id", void 0);
2394
- __decorate$5([
2501
+ ], Selectic.prototype, "id", void 0);
2502
+ __decorate([
2395
2503
  vtyx.Prop({ default: '' })
2396
- ], Selectic$1.prototype, "className", void 0);
2397
- __decorate$5([
2504
+ ], Selectic.prototype, "className", void 0);
2505
+ __decorate([
2398
2506
  vtyx.Prop()
2399
- ], Selectic$1.prototype, "title", void 0);
2400
- __decorate$5([
2507
+ ], Selectic.prototype, "title", void 0);
2508
+ __decorate([
2401
2509
  vtyx.Prop()
2402
- ], Selectic$1.prototype, "texts", void 0);
2403
- __decorate$5([
2510
+ ], Selectic.prototype, "texts", void 0);
2511
+ __decorate([
2404
2512
  vtyx.Prop({ default: false })
2405
- ], Selectic$1.prototype, "noCache", void 0);
2406
- __decorate$5([
2513
+ ], Selectic.prototype, "noCache", void 0);
2514
+ __decorate([
2407
2515
  vtyx.Prop()
2408
- ], Selectic$1.prototype, "open", void 0);
2409
- __decorate$5([
2516
+ ], Selectic.prototype, "open", void 0);
2517
+ __decorate([
2410
2518
  vtyx.Prop({ default: () => ({
2411
2519
  allowClearSelection: false,
2412
2520
  strictValue: false,
2413
2521
  selectionOverflow: 'collapsed',
2414
2522
  }) })
2415
- ], Selectic$1.prototype, "params", void 0);
2416
- __decorate$5([
2523
+ ], Selectic.prototype, "params", void 0);
2524
+ __decorate([
2525
+ vtyx.Prop()
2526
+ ], Selectic.prototype, "_on", void 0);
2527
+ __decorate([
2528
+ vtyx.Prop()
2529
+ ], Selectic.prototype, "_getMethods", void 0);
2530
+ __decorate([
2417
2531
  vtyx.Watch('value')
2418
- ], Selectic$1.prototype, "onValueChange", null);
2419
- __decorate$5([
2532
+ ], Selectic.prototype, "onValueChange", null);
2533
+ __decorate([
2420
2534
  vtyx.Watch('selectionIsExcluded')
2421
- ], Selectic$1.prototype, "onExcludedChange", null);
2422
- __decorate$5([
2535
+ ], Selectic.prototype, "onExcludedChange", null);
2536
+ __decorate([
2423
2537
  vtyx.Watch('options')
2424
- ], Selectic$1.prototype, "onOptionsChange", null);
2425
- __decorate$5([
2538
+ ], Selectic.prototype, "onOptionsChange", null);
2539
+ __decorate([
2426
2540
  vtyx.Watch('texts')
2427
- ], Selectic$1.prototype, "onTextsChange", null);
2428
- __decorate$5([
2541
+ ], Selectic.prototype, "onTextsChange", null);
2542
+ __decorate([
2429
2543
  vtyx.Watch('disabled')
2430
- ], Selectic$1.prototype, "onDisabledChange", null);
2431
- __decorate$5([
2544
+ ], Selectic.prototype, "onDisabledChange", null);
2545
+ __decorate([
2432
2546
  vtyx.Watch('groups')
2433
- ], Selectic$1.prototype, "onGroupsChanged", null);
2434
- __decorate$5([
2547
+ ], Selectic.prototype, "onGroupsChanged", null);
2548
+ __decorate([
2435
2549
  vtyx.Watch('placeholder')
2436
- ], Selectic$1.prototype, "onPlaceholderChanged", null);
2437
- __decorate$5([
2550
+ ], Selectic.prototype, "onPlaceholderChanged", null);
2551
+ __decorate([
2438
2552
  vtyx.Watch('open')
2439
- ], Selectic$1.prototype, "onOpenChanged", null);
2440
- __decorate$5([
2553
+ ], Selectic.prototype, "onOpenChanged", null);
2554
+ __decorate([
2441
2555
  vtyx.Watch('isFocused')
2442
- ], Selectic$1.prototype, "onFocusChanged", null);
2443
- __decorate$5([
2556
+ ], Selectic.prototype, "onFocusChanged", null);
2557
+ __decorate([
2444
2558
  vtyx.Watch('store.state.internalValue')
2445
- ], Selectic$1.prototype, "onInternalValueChange", null);
2446
- Selectic$1 = __decorate$5([
2559
+ ], Selectic.prototype, "onInternalValueChange", null);
2560
+ Selectic = __decorate([
2447
2561
  vtyx.Component
2448
- ], Selectic$1);
2449
- var Selectic$2 = Selectic$1;
2562
+ ], Selectic);
2563
+ var Selectic$1 = Selectic;
2450
2564
 
2451
- exports.changeTexts = changeTexts$1;
2452
- exports.default = Selectic$2;
2565
+ exports.changeTexts = changeTexts;
2566
+ exports["default"] = Selectic$1;