selectic 3.0.22 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/selectic.common.js +540 -67
- package/dist/selectic.esm.js +541 -69
- package/doc/changeIcons.md +118 -0
- package/doc/changeText.md +1 -1
- package/doc/domProperties.md +57 -19
- package/doc/extendedProperties.md +83 -72
- package/doc/main.md +2 -0
- package/doc/params.md +177 -112
- package/doc/properties.md +42 -0
- package/package.json +4 -4
- package/src/ExtendedList.tsx +53 -6
- package/src/Filter.tsx +11 -9
- package/src/Icon.tsx +199 -0
- package/src/List.tsx +12 -6
- package/src/MainInput.tsx +15 -11
- package/src/Store.tsx +285 -123
- package/src/css/selectic.css +24 -0
- package/src/icons/caret-down.tsx +21 -0
- package/src/icons/caret-up.tsx +21 -0
- package/src/icons/check.tsx +23 -0
- package/src/icons/question.tsx +21 -0
- package/src/icons/search.tsx +21 -0
- package/src/icons/spinner.tsx +21 -0
- package/src/icons/strikeThrough.tsx +21 -0
- package/src/icons/times.tsx +21 -0
- package/src/index.tsx +78 -37
- package/test/Store/Store_computed.spec.js +84 -0
- package/test/Store/changeIcons.spec.js +154 -0
- package/test/Store/selectGroup.spec.js +389 -0
- package/test/Store/selectItem.spec.js +100 -46
- package/test/helper.js +38 -34
- package/types/ExtendedList.d.ts +7 -2
- package/types/Icon.d.ts +25 -0
- package/types/Store.d.ts +142 -5
- package/types/icons/caret-down.d.ts +6 -0
- package/types/icons/caret-up.d.ts +6 -0
- package/types/icons/check.d.ts +6 -0
- package/types/icons/question.d.ts +6 -0
- package/types/icons/search.d.ts +6 -0
- package/types/icons/spinner.d.ts +6 -0
- package/types/icons/strikeThrough.d.ts +6 -0
- package/types/icons/times.d.ts +6 -0
- package/types/index.d.ts +74 -1
package/dist/selectic.common.js
CHANGED
|
@@ -32,7 +32,7 @@ function styleInject(css, ref) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
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 top: var(--top-position, 0);\n z-index: 2000;\n height: auto;\n max-height: var(--availableSpace);\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 width: var(--list-width, 200px);\n min-width: 200px;\n display: grid;\n grid-template-rows: minmax(0, max-content) 1fr;\n}\n.selectic__extended-list.selectic-position-top {\n box-shadow: 2px -3px 12px 0px #888888;\n}\n.selectic__extended-list__list-container{\n overflow: auto;\n}\n.selectic__extended-list__list-items {\n max-height: calc(var(--selectic-input-height) * 10);\n min-width: max-content;\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.selectic .form-control-feedback.fa.selectic-search-scope {\n width: calc(var(--selectic-input-height) * 0.75);\n height: calc(var(--selectic-input-height) * 0.75);\n line-height: calc(var(--selectic-input-height) * 0.75);\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 top: var(--top-position, 0);\n z-index: 2000;\n height: auto;\n max-height: var(--availableSpace);\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 width: var(--list-width, 200px);\n min-width: 200px;\n display: grid;\n grid-template-rows: minmax(0, max-content) 1fr;\n}\n.selectic__extended-list.selectic-position-top {\n box-shadow: 2px -3px 12px 0px #888888;\n}\n.selectic__extended-list__list-container{\n overflow: auto;\n}\n.selectic__extended-list__list-items {\n max-height: calc(var(--selectic-input-height) * 10);\n min-width: max-content;\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__is-group.selectable {\n cursor: pointer;\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.selectic .form-control-feedback.fa.selectic-search-scope {\n width: calc(var(--selectic-input-height) * 0.75);\n height: calc(var(--selectic-input-height) * 0.75);\n line-height: calc(var(--selectic-input-height) * 0.75);\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/* {{{ icons */\n\n@keyframes selectic-animation-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(359deg);\n }\n}\n\n.selectic__icon {\n height: 1em;\n fill: currentColor;\n}\n\n.selectic-spin {\n animation: selectic-animation-spin 2s infinite linear;\n}\n\n/* }}} */\n";
|
|
36
36
|
styleInject(css_248z);
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -149,6 +149,12 @@ function compareOptions(oldOptions, newOptions) {
|
|
|
149
149
|
function changeTexts$1(texts) {
|
|
150
150
|
messages = Object.assign(messages, texts);
|
|
151
151
|
}
|
|
152
|
+
function changeIcons$1(newIcons, newFamilyIcon) {
|
|
153
|
+
icons = Object.assign(icons, newIcons);
|
|
154
|
+
if (newFamilyIcon) {
|
|
155
|
+
defaultFamilyIcon = newFamilyIcon;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
152
158
|
/* }}} */
|
|
153
159
|
let messages = {
|
|
154
160
|
noFetchMethod: 'Fetch callback is missing: it is not possible to retrieve data.',
|
|
@@ -169,6 +175,8 @@ let messages = {
|
|
|
169
175
|
unknownPropertyValue: 'property "%s" has incorrect values.',
|
|
170
176
|
wrongQueryResult: 'Query did not return all results.',
|
|
171
177
|
};
|
|
178
|
+
let defaultFamilyIcon = 'selectic';
|
|
179
|
+
let icons = {};
|
|
172
180
|
let closePreviousSelectic;
|
|
173
181
|
/* }}} */
|
|
174
182
|
let uid = 0;
|
|
@@ -186,6 +194,8 @@ class SelecticStore {
|
|
|
186
194
|
childOptions: [],
|
|
187
195
|
groups: [],
|
|
188
196
|
texts: null,
|
|
197
|
+
icons: null,
|
|
198
|
+
iconFamily: null,
|
|
189
199
|
params: {},
|
|
190
200
|
fetchCallback: null,
|
|
191
201
|
getItemsCallback: null,
|
|
@@ -196,47 +206,50 @@ class SelecticStore {
|
|
|
196
206
|
/* }}} */
|
|
197
207
|
/* {{{ data */
|
|
198
208
|
this.state = vue.reactive({
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
placeholder: '',
|
|
202
|
-
hideFilter: false,
|
|
203
|
-
keepFilterOpen: false,
|
|
204
|
-
allowRevert: undefined,
|
|
209
|
+
activeItemIdx: -1,
|
|
210
|
+
allOptions: [],
|
|
205
211
|
allowClearSelection: false,
|
|
206
|
-
|
|
212
|
+
allowRevert: undefined,
|
|
207
213
|
autoDisabled: true,
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
autoSelect: true,
|
|
215
|
+
disabled: false,
|
|
216
|
+
disableGroupSelection: false,
|
|
217
|
+
dynOptions: [],
|
|
218
|
+
filteredOptions: [],
|
|
219
|
+
forceSelectAll: 'auto',
|
|
220
|
+
groups: new Map(),
|
|
221
|
+
hideFilter: false,
|
|
210
222
|
internalValue: null,
|
|
211
223
|
isOpen: false,
|
|
224
|
+
keepFilterOpen: false,
|
|
225
|
+
listPosition: 'auto',
|
|
226
|
+
multiple: false,
|
|
227
|
+
offsetItem: 0,
|
|
228
|
+
optionBehaviorOperation: 'sort',
|
|
229
|
+
optionBehaviorOrder: ['O', 'D', 'E'],
|
|
230
|
+
pageSize: 100,
|
|
231
|
+
placeholder: '',
|
|
212
232
|
searchText: '',
|
|
213
|
-
selectionIsExcluded: false,
|
|
214
|
-
forceSelectAll: 'auto',
|
|
215
|
-
allOptions: [],
|
|
216
|
-
dynOptions: [],
|
|
217
|
-
filteredOptions: [],
|
|
218
233
|
selectedOptions: null,
|
|
234
|
+
selectionIsExcluded: false,
|
|
235
|
+
selectionOverflow: 'collapsed',
|
|
236
|
+
strictValue: false,
|
|
219
237
|
totalAllOptions: Infinity,
|
|
220
238
|
totalDynOptions: Infinity,
|
|
221
239
|
totalFilteredOptions: Infinity,
|
|
222
|
-
groups: new Map(),
|
|
223
|
-
offsetItem: 0,
|
|
224
|
-
activeItemIdx: -1,
|
|
225
|
-
pageSize: 100,
|
|
226
|
-
listPosition: 'auto',
|
|
227
|
-
optionBehaviorOperation: 'sort',
|
|
228
|
-
optionBehaviorOrder: ['O', 'D', 'E'],
|
|
229
240
|
status: {
|
|
230
|
-
searching: false,
|
|
231
|
-
errorMessage: '',
|
|
232
241
|
areAllSelected: false,
|
|
233
|
-
hasChanged: false,
|
|
234
242
|
automaticChange: false,
|
|
235
243
|
automaticClose: false,
|
|
244
|
+
errorMessage: '',
|
|
245
|
+
hasChanged: false,
|
|
246
|
+
searching: false,
|
|
236
247
|
},
|
|
237
248
|
});
|
|
238
249
|
this.data = vue.reactive({
|
|
239
250
|
labels: Object.assign({}, messages),
|
|
251
|
+
icons: Object.assign({}, icons),
|
|
252
|
+
iconFamily: defaultFamilyIcon,
|
|
240
253
|
itemsPerPage: 10,
|
|
241
254
|
doNotUpdate: false,
|
|
242
255
|
cacheItem: new Map(),
|
|
@@ -277,6 +290,9 @@ class SelecticStore {
|
|
|
277
290
|
this.elementOptions = vue.computed(() => {
|
|
278
291
|
return this.getElementOptions();
|
|
279
292
|
});
|
|
293
|
+
this.allowGroupSelection = vue.computed(() => {
|
|
294
|
+
return this.state.multiple && !this.isPartial.value && !this.state.disableGroupSelection;
|
|
295
|
+
});
|
|
280
296
|
/* }}} */
|
|
281
297
|
/* {{{ watch */
|
|
282
298
|
vue.watch(() => [this.props.options, this.props.childOptions], () => {
|
|
@@ -360,6 +376,9 @@ class SelecticStore {
|
|
|
360
376
|
if (this.props.texts) {
|
|
361
377
|
this.changeTexts(this.props.texts);
|
|
362
378
|
}
|
|
379
|
+
if (this.props.icons || this.props.iconFamily) {
|
|
380
|
+
this.changeIcons(this.props.icons, this.props.iconFamily);
|
|
381
|
+
}
|
|
363
382
|
this.addGroups(this.props.groups);
|
|
364
383
|
this.assertValueType();
|
|
365
384
|
this.buildAllOptions();
|
|
@@ -477,17 +496,38 @@ class SelecticStore {
|
|
|
477
496
|
}
|
|
478
497
|
return this.buildSelectedItems(ids);
|
|
479
498
|
}
|
|
499
|
+
selectGroup(id, itemsSelected) {
|
|
500
|
+
const state = this.state;
|
|
501
|
+
if (!vue.unref(this.allowGroupSelection)) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
const selectItem = this.selectItem.bind(this);
|
|
505
|
+
let hasChanged = false;
|
|
506
|
+
this.data.doNotUpdate = true;
|
|
507
|
+
const items = state.filteredOptions.filter((item) => {
|
|
508
|
+
const isInGroup = item.group === id && !item.exclusive && !item.disabled;
|
|
509
|
+
if (isInGroup) {
|
|
510
|
+
hasChanged = selectItem(item.id, itemsSelected, true) || hasChanged;
|
|
511
|
+
}
|
|
512
|
+
return isInGroup;
|
|
513
|
+
});
|
|
514
|
+
this.data.doNotUpdate = false;
|
|
515
|
+
if (hasChanged && items.length) {
|
|
516
|
+
this.updateFilteredOptions();
|
|
517
|
+
}
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
480
520
|
selectItem(id, selected, keepOpen = false) {
|
|
481
521
|
const state = this.state;
|
|
482
522
|
let hasChanged = false;
|
|
483
523
|
const item = state.allOptions.find((opt) => opt.id === id);
|
|
484
524
|
/* Check that item is not disabled */
|
|
485
525
|
if (item === null || item === void 0 ? void 0 : item.disabled) {
|
|
486
|
-
return;
|
|
526
|
+
return hasChanged;
|
|
487
527
|
}
|
|
488
528
|
if (state.strictValue && !this.hasValue(id)) {
|
|
489
529
|
/* reject invalid values */
|
|
490
|
-
return;
|
|
530
|
+
return hasChanged;
|
|
491
531
|
}
|
|
492
532
|
if (state.multiple) {
|
|
493
533
|
/* multiple = true */
|
|
@@ -535,12 +575,12 @@ class SelecticStore {
|
|
|
535
575
|
}
|
|
536
576
|
if (!selected) {
|
|
537
577
|
if (id !== oldValue) {
|
|
538
|
-
return;
|
|
578
|
+
return hasChanged;
|
|
539
579
|
}
|
|
540
580
|
id = null;
|
|
541
581
|
}
|
|
542
582
|
else if (id === oldValue) {
|
|
543
|
-
return;
|
|
583
|
+
return hasChanged;
|
|
544
584
|
}
|
|
545
585
|
if (keepOpen) {
|
|
546
586
|
/* if keepOpen is true it means that it is an automatic change */
|
|
@@ -552,6 +592,7 @@ class SelecticStore {
|
|
|
552
592
|
if (hasChanged) {
|
|
553
593
|
state.status.hasChanged = true;
|
|
554
594
|
}
|
|
595
|
+
return hasChanged;
|
|
555
596
|
}
|
|
556
597
|
toggleSelectAll() {
|
|
557
598
|
if (!this.state.multiple) {
|
|
@@ -621,6 +662,14 @@ class SelecticStore {
|
|
|
621
662
|
changeTexts(texts) {
|
|
622
663
|
this.data.labels = Object.assign({}, this.data.labels, texts);
|
|
623
664
|
}
|
|
665
|
+
changeIcons(icons, family) {
|
|
666
|
+
if (icons) {
|
|
667
|
+
this.data.icons = Object.assign({}, this.data.icons, icons);
|
|
668
|
+
}
|
|
669
|
+
if (typeof family === 'string') {
|
|
670
|
+
this.data.iconFamily = family;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
624
673
|
/* }}} */
|
|
625
674
|
/* {{{ private methods */
|
|
626
675
|
hasValue(id) {
|
|
@@ -725,6 +774,7 @@ class SelecticStore {
|
|
|
725
774
|
if (!this.data.doNotUpdate) {
|
|
726
775
|
this.state.filteredOptions = this.buildItems(this.state.filteredOptions);
|
|
727
776
|
this.buildSelectedOptions();
|
|
777
|
+
this.updateGroupSelection();
|
|
728
778
|
}
|
|
729
779
|
}
|
|
730
780
|
addGroups(groups) {
|
|
@@ -732,7 +782,7 @@ class SelecticStore {
|
|
|
732
782
|
this.state.groups.set(group.id, group.text);
|
|
733
783
|
});
|
|
734
784
|
}
|
|
735
|
-
|
|
785
|
+
/** This method is for the computed property listOptions */
|
|
736
786
|
getListOptions() {
|
|
737
787
|
const options = deepClone(this.props.options, ['data']);
|
|
738
788
|
const listOptions = [];
|
|
@@ -883,13 +933,11 @@ class SelecticStore {
|
|
|
883
933
|
/* Do not fetch again just build filteredOptions */
|
|
884
934
|
const search = this.state.searchText;
|
|
885
935
|
if (!search) {
|
|
886
|
-
this.
|
|
887
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
936
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
888
937
|
return;
|
|
889
938
|
}
|
|
890
939
|
const options = this.filterOptions(allOptions, search);
|
|
891
|
-
this.
|
|
892
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
940
|
+
this.setFilteredOptions(options);
|
|
893
941
|
}
|
|
894
942
|
}
|
|
895
943
|
async buildFilteredOptions() {
|
|
@@ -911,13 +959,11 @@ class SelecticStore {
|
|
|
911
959
|
/* Check if all options have been fetched */
|
|
912
960
|
if (hasFetchedAllItems) {
|
|
913
961
|
if (!search) {
|
|
914
|
-
this.
|
|
915
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
962
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
916
963
|
return;
|
|
917
964
|
}
|
|
918
965
|
const options = this.filterOptions(allOptions, search);
|
|
919
|
-
this.
|
|
920
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
966
|
+
this.setFilteredOptions(options);
|
|
921
967
|
return;
|
|
922
968
|
}
|
|
923
969
|
/* When we only have partial options */
|
|
@@ -928,8 +974,7 @@ class SelecticStore {
|
|
|
928
974
|
return;
|
|
929
975
|
}
|
|
930
976
|
if (!search && endIndex <= allOptionsLength) {
|
|
931
|
-
this.
|
|
932
|
-
this.state.totalFilteredOptions = totalAllOptions + this.state.groups.size;
|
|
977
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions), false, totalAllOptions + this.state.groups.size);
|
|
933
978
|
const isPartial = vue.unref(this.isPartial);
|
|
934
979
|
if (isPartial && this.state.totalDynOptions === Infinity) {
|
|
935
980
|
this.fetchData();
|
|
@@ -1043,7 +1088,7 @@ class SelecticStore {
|
|
|
1043
1088
|
/* Added options are the same as previous ones.
|
|
1044
1089
|
* Stop fetching to avoid infinite loop
|
|
1045
1090
|
*/
|
|
1046
|
-
if (!this.hasFetchedAllItems) {
|
|
1091
|
+
if (!vue.unref(this.hasFetchedAllItems)) {
|
|
1047
1092
|
/* Display error if all items are not fetch
|
|
1048
1093
|
* We can have the case where old value and result
|
|
1049
1094
|
* are the same but total is correct when the
|
|
@@ -1067,6 +1112,10 @@ class SelecticStore {
|
|
|
1067
1112
|
const previousItem = state.filteredOptions[filteredOptionsLength - 1];
|
|
1068
1113
|
const options = this.buildGroupItems(result, previousItem);
|
|
1069
1114
|
const nbGroups1 = this.nbGroups(options);
|
|
1115
|
+
/* replace existing options by what have been received
|
|
1116
|
+
* or add received options.
|
|
1117
|
+
* This allow to manage requests received in different orders.
|
|
1118
|
+
*/
|
|
1070
1119
|
state.filteredOptions.splice(offset + dynOffset, limit + nbGroups1, ...options);
|
|
1071
1120
|
}
|
|
1072
1121
|
let nbGroups = state.groups.size;
|
|
@@ -1074,6 +1123,7 @@ class SelecticStore {
|
|
|
1074
1123
|
nbGroups = this.nbGroups(state.filteredOptions);
|
|
1075
1124
|
}
|
|
1076
1125
|
state.totalFilteredOptions = total + nbGroups + dynOffset;
|
|
1126
|
+
this.updateGroupSelection();
|
|
1077
1127
|
if (search && state.totalFilteredOptions <= state.filteredOptions.length) {
|
|
1078
1128
|
this.addStaticFilteredOptions(true);
|
|
1079
1129
|
}
|
|
@@ -1122,8 +1172,7 @@ class SelecticStore {
|
|
|
1122
1172
|
options = this.filterOptions(vue.unref(this.elementOptions), search);
|
|
1123
1173
|
break;
|
|
1124
1174
|
}
|
|
1125
|
-
this.
|
|
1126
|
-
this.state.totalFilteredOptions += options.length;
|
|
1175
|
+
this.setFilteredOptions(options, true);
|
|
1127
1176
|
}
|
|
1128
1177
|
}
|
|
1129
1178
|
buildSelectedItems(ids) {
|
|
@@ -1265,8 +1314,368 @@ class SelecticStore {
|
|
|
1265
1314
|
state.hideFilter = state.totalAllOptions <= this.data.itemsPerPage;
|
|
1266
1315
|
}
|
|
1267
1316
|
}
|
|
1317
|
+
/** update group item, to mark them as selected if needed */
|
|
1318
|
+
updateGroupSelection() {
|
|
1319
|
+
const state = this.state;
|
|
1320
|
+
if (!vue.unref(this.allowGroupSelection)) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
const filteredOptions = state.filteredOptions;
|
|
1324
|
+
const groupIdx = new Map();
|
|
1325
|
+
const groupAllSelected = new Map();
|
|
1326
|
+
const groupNbItem = new Map();
|
|
1327
|
+
filteredOptions.forEach((option, idx) => {
|
|
1328
|
+
const groupId = option.group;
|
|
1329
|
+
if (option.isGroup) {
|
|
1330
|
+
const id = option.id;
|
|
1331
|
+
groupIdx.set(id, idx);
|
|
1332
|
+
groupAllSelected.set(id, true);
|
|
1333
|
+
}
|
|
1334
|
+
else if (groupId !== undefined) {
|
|
1335
|
+
if (option.disabled || option.exclusive) {
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
groupNbItem.set(groupId, (groupNbItem.get(groupId) || 0) + 1);
|
|
1339
|
+
if (!option.selected) {
|
|
1340
|
+
groupAllSelected.set(groupId, false);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
for (const [id, idx] of groupIdx.entries()) {
|
|
1345
|
+
const group = filteredOptions[idx];
|
|
1346
|
+
group.selected = !!(groupAllSelected.get(id) && groupNbItem.get(id));
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
/** assign new value to the filteredOptions and apply change depending on it */
|
|
1350
|
+
setFilteredOptions(options, add = false, length = 0) {
|
|
1351
|
+
if (!add) {
|
|
1352
|
+
this.state.filteredOptions = options;
|
|
1353
|
+
this.state.totalFilteredOptions = length || options.length;
|
|
1354
|
+
}
|
|
1355
|
+
else {
|
|
1356
|
+
this.state.filteredOptions.push(...options);
|
|
1357
|
+
this.state.totalFilteredOptions += length || options.length;
|
|
1358
|
+
}
|
|
1359
|
+
this.updateGroupSelection();
|
|
1360
|
+
}
|
|
1268
1361
|
}
|
|
1269
1362
|
|
|
1363
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1364
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1365
|
+
*/
|
|
1366
|
+
var __decorate$d = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1367
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1368
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1369
|
+
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;
|
|
1370
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1371
|
+
};
|
|
1372
|
+
let IconCaretDown = class IconCaretDown extends vtyx.Vue {
|
|
1373
|
+
render() {
|
|
1374
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1375
|
+
vtyx.h("path", { d: "M7,10L12,15L17,10H7Z" })));
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
IconCaretDown = __decorate$d([
|
|
1379
|
+
vtyx.Component
|
|
1380
|
+
], IconCaretDown);
|
|
1381
|
+
var IconCaretDown$1 = IconCaretDown;
|
|
1382
|
+
|
|
1383
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1384
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1385
|
+
*/
|
|
1386
|
+
var __decorate$c = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1387
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1388
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1389
|
+
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;
|
|
1390
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1391
|
+
};
|
|
1392
|
+
let IconCaretUp = class IconCaretUp extends vtyx.Vue {
|
|
1393
|
+
render() {
|
|
1394
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1395
|
+
vtyx.h("path", { d: "M7,15L12,10L17,15H7Z" })));
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
IconCaretUp = __decorate$c([
|
|
1399
|
+
vtyx.Component
|
|
1400
|
+
], IconCaretUp);
|
|
1401
|
+
var IconCaretUp$1 = IconCaretUp;
|
|
1402
|
+
|
|
1403
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1404
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1405
|
+
*/
|
|
1406
|
+
var __decorate$b = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1407
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1408
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1409
|
+
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;
|
|
1410
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1411
|
+
};
|
|
1412
|
+
let IconCheck = class IconCheck extends vtyx.Vue {
|
|
1413
|
+
render() {
|
|
1414
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1415
|
+
vtyx.h("path", { d: "M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" })));
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
IconCheck = __decorate$b([
|
|
1419
|
+
vtyx.Component
|
|
1420
|
+
], IconCheck);
|
|
1421
|
+
var IconCheck$1 = IconCheck;
|
|
1422
|
+
|
|
1423
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1424
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1425
|
+
*/
|
|
1426
|
+
var __decorate$a = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1427
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1428
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1429
|
+
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;
|
|
1430
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1431
|
+
};
|
|
1432
|
+
let IconQuestion = class IconQuestion extends vtyx.Vue {
|
|
1433
|
+
render() {
|
|
1434
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1435
|
+
vtyx.h("path", { d: "M10,19H13V22H10V19M12,2C17.35,2.22 19.68,7.62 16.5,11.67C15.67,12.67 14.33,13.33 13.67,14.17C13,15 13,16 13,17H10C10,15.33 10,13.92 10.67,12.92C11.33,11.92 12.67,11.33 13.5,10.67C15.92,8.43 15.32,5.26 12,5A3,3 0 0,0 9,8H6A6,6 0 0,1 12,2Z" })));
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
IconQuestion = __decorate$a([
|
|
1439
|
+
vtyx.Component
|
|
1440
|
+
], IconQuestion);
|
|
1441
|
+
var IconQuestion$1 = IconQuestion;
|
|
1442
|
+
|
|
1443
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1444
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1445
|
+
*/
|
|
1446
|
+
var __decorate$9 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1447
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1448
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1449
|
+
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;
|
|
1450
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1451
|
+
};
|
|
1452
|
+
let IconSearch = class IconSearch extends vtyx.Vue {
|
|
1453
|
+
render() {
|
|
1454
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1455
|
+
vtyx.h("path", { d: "M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" })));
|
|
1456
|
+
}
|
|
1457
|
+
};
|
|
1458
|
+
IconSearch = __decorate$9([
|
|
1459
|
+
vtyx.Component
|
|
1460
|
+
], IconSearch);
|
|
1461
|
+
var IconSearch$1 = IconSearch;
|
|
1462
|
+
|
|
1463
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1464
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1465
|
+
*/
|
|
1466
|
+
var __decorate$8 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1467
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1468
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1469
|
+
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;
|
|
1470
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1471
|
+
};
|
|
1472
|
+
let IconSpinner = class IconSpinner extends vtyx.Vue {
|
|
1473
|
+
render() {
|
|
1474
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1475
|
+
vtyx.h("path", { d: "M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z" })));
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
IconSpinner = __decorate$8([
|
|
1479
|
+
vtyx.Component
|
|
1480
|
+
], IconSpinner);
|
|
1481
|
+
var IconSpinner$1 = IconSpinner;
|
|
1482
|
+
|
|
1483
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1484
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1485
|
+
*/
|
|
1486
|
+
var __decorate$7 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1487
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1488
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1489
|
+
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;
|
|
1490
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1491
|
+
};
|
|
1492
|
+
let IconStrikeThrough = class IconStrikeThrough extends vtyx.Vue {
|
|
1493
|
+
render() {
|
|
1494
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1495
|
+
vtyx.h("path", { d: "M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" })));
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
IconStrikeThrough = __decorate$7([
|
|
1499
|
+
vtyx.Component
|
|
1500
|
+
], IconStrikeThrough);
|
|
1501
|
+
var IconStrikeThrough$1 = IconStrikeThrough;
|
|
1502
|
+
|
|
1503
|
+
/* This icon is from <https://github.com/Templarian/MaterialDesign>,
|
|
1504
|
+
* distributed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) license
|
|
1505
|
+
*/
|
|
1506
|
+
var __decorate$6 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1507
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1508
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1509
|
+
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;
|
|
1510
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1511
|
+
};
|
|
1512
|
+
let IconTimes = class IconTimes extends vtyx.Vue {
|
|
1513
|
+
render() {
|
|
1514
|
+
return (vtyx.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
1515
|
+
vtyx.h("path", { d: "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" })));
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
IconTimes = __decorate$6([
|
|
1519
|
+
vtyx.Component
|
|
1520
|
+
], IconTimes);
|
|
1521
|
+
var IconTimes$1 = IconTimes;
|
|
1522
|
+
|
|
1523
|
+
/* File Purpose:
|
|
1524
|
+
* Display the wanted icon.
|
|
1525
|
+
*/
|
|
1526
|
+
var __decorate$5 = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
1527
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1528
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1529
|
+
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;
|
|
1530
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1531
|
+
};
|
|
1532
|
+
let Icon = class Icon extends vtyx.Vue {
|
|
1533
|
+
/* }}} */
|
|
1534
|
+
/* {{{ computed */
|
|
1535
|
+
get rawIconValue() {
|
|
1536
|
+
const key = this.icon;
|
|
1537
|
+
const icon = this.store.data.icons[key];
|
|
1538
|
+
if (icon === undefined) {
|
|
1539
|
+
return key;
|
|
1540
|
+
}
|
|
1541
|
+
return icon;
|
|
1542
|
+
}
|
|
1543
|
+
get family() {
|
|
1544
|
+
const iconValue = this.rawIconValue;
|
|
1545
|
+
if (iconValue.startsWith('selectic:')) {
|
|
1546
|
+
return 'selectic';
|
|
1547
|
+
}
|
|
1548
|
+
if (iconValue.startsWith('raw:')) {
|
|
1549
|
+
return 'raw';
|
|
1550
|
+
}
|
|
1551
|
+
return this.store.data.iconFamily;
|
|
1552
|
+
}
|
|
1553
|
+
get iconValue() {
|
|
1554
|
+
const key = this.rawIconValue;
|
|
1555
|
+
if (key.includes(':')) {
|
|
1556
|
+
/* This is to retrieve value from string such as
|
|
1557
|
+
* 'selectic:spinner:spin' (and get only 'spinner') */
|
|
1558
|
+
const value = key.split(':');
|
|
1559
|
+
return value[1];
|
|
1560
|
+
}
|
|
1561
|
+
return key;
|
|
1562
|
+
}
|
|
1563
|
+
get vueIcon() {
|
|
1564
|
+
switch (this.icon) {
|
|
1565
|
+
case 'caret-down':
|
|
1566
|
+
return IconCaretDown$1;
|
|
1567
|
+
case 'caret-up':
|
|
1568
|
+
return IconCaretUp$1;
|
|
1569
|
+
case 'check':
|
|
1570
|
+
return IconCheck$1;
|
|
1571
|
+
case 'search':
|
|
1572
|
+
return IconSearch$1;
|
|
1573
|
+
case 'spinner':
|
|
1574
|
+
return IconSpinner$1;
|
|
1575
|
+
case 'strikethrough':
|
|
1576
|
+
return IconStrikeThrough$1;
|
|
1577
|
+
case 'times':
|
|
1578
|
+
return IconTimes$1;
|
|
1579
|
+
case 'question':
|
|
1580
|
+
default:
|
|
1581
|
+
return IconQuestion$1;
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
get spinClass() {
|
|
1585
|
+
var _a;
|
|
1586
|
+
let value = this.store.data.icons.spin;
|
|
1587
|
+
if (typeof value === 'string') {
|
|
1588
|
+
if (value.startsWith('selectic:')) {
|
|
1589
|
+
return 'selectic-spin';
|
|
1590
|
+
}
|
|
1591
|
+
if (value.includes(':')) {
|
|
1592
|
+
value = (_a = value.split(':')[1]) !== null && _a !== void 0 ? _a : 'spin';
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
value = 'spin';
|
|
1597
|
+
}
|
|
1598
|
+
const family = this.family;
|
|
1599
|
+
let prefix = '';
|
|
1600
|
+
switch (family) {
|
|
1601
|
+
case 'font-awesome-4':
|
|
1602
|
+
prefix = 'fa-';
|
|
1603
|
+
break;
|
|
1604
|
+
case 'font-awesome-5':
|
|
1605
|
+
prefix = 'fa-';
|
|
1606
|
+
break;
|
|
1607
|
+
case 'font-awesome-6':
|
|
1608
|
+
prefix = 'fa-';
|
|
1609
|
+
break;
|
|
1610
|
+
case '':
|
|
1611
|
+
case 'selectic':
|
|
1612
|
+
prefix = 'selectic-';
|
|
1613
|
+
break;
|
|
1614
|
+
case 'raw':
|
|
1615
|
+
prefix = '';
|
|
1616
|
+
break;
|
|
1617
|
+
default:
|
|
1618
|
+
prefix = 'selectic-';
|
|
1619
|
+
}
|
|
1620
|
+
return `${prefix}${value}`;
|
|
1621
|
+
}
|
|
1622
|
+
get spinActive() {
|
|
1623
|
+
return this.spin || this.rawIconValue.endsWith(':spin');
|
|
1624
|
+
}
|
|
1625
|
+
/* }}} */
|
|
1626
|
+
renderInnerIcon() {
|
|
1627
|
+
const component = this.vueIcon;
|
|
1628
|
+
return vtyx.h(component, {
|
|
1629
|
+
class: {
|
|
1630
|
+
'selectic__icon': true,
|
|
1631
|
+
[this.spinClass]: this.spinActive,
|
|
1632
|
+
},
|
|
1633
|
+
title: this.title,
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
renderSpanIcon(prefix) {
|
|
1637
|
+
const classSpin = this.spinActive && this.spinClass || '';
|
|
1638
|
+
return (vtyx.h("span", { class: `${prefix}${this.iconValue} ${classSpin}`, title: this.title }));
|
|
1639
|
+
}
|
|
1640
|
+
render() {
|
|
1641
|
+
const family = this.family;
|
|
1642
|
+
switch (family) {
|
|
1643
|
+
case '':
|
|
1644
|
+
case 'selectic':
|
|
1645
|
+
return this.renderInnerIcon();
|
|
1646
|
+
case 'font-awesome-4':
|
|
1647
|
+
return this.renderSpanIcon('fa fa-fw fa-');
|
|
1648
|
+
case 'font-awesome-5':
|
|
1649
|
+
return this.renderSpanIcon('fas fa-fw fa-');
|
|
1650
|
+
case 'font-awesome-4':
|
|
1651
|
+
return this.renderSpanIcon('fa-solid fa-fw fa-');
|
|
1652
|
+
case 'raw':
|
|
1653
|
+
return this.renderSpanIcon('');
|
|
1654
|
+
default:
|
|
1655
|
+
if (family.startsWith('prefix:')) {
|
|
1656
|
+
return this.renderSpanIcon(family.slice(7));
|
|
1657
|
+
}
|
|
1658
|
+
return this.renderInnerIcon();
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
__decorate$5([
|
|
1663
|
+
vtyx.Prop()
|
|
1664
|
+
], Icon.prototype, "store", void 0);
|
|
1665
|
+
__decorate$5([
|
|
1666
|
+
vtyx.Prop()
|
|
1667
|
+
], Icon.prototype, "icon", void 0);
|
|
1668
|
+
__decorate$5([
|
|
1669
|
+
vtyx.Prop()
|
|
1670
|
+
], Icon.prototype, "spin", void 0);
|
|
1671
|
+
__decorate$5([
|
|
1672
|
+
vtyx.Prop()
|
|
1673
|
+
], Icon.prototype, "title", void 0);
|
|
1674
|
+
Icon = __decorate$5([
|
|
1675
|
+
vtyx.Component
|
|
1676
|
+
], Icon);
|
|
1677
|
+
var Icon$1 = Icon;
|
|
1678
|
+
|
|
1270
1679
|
/* File Purpose:
|
|
1271
1680
|
* It displays the core element which is always visible (where selection is
|
|
1272
1681
|
* displayed) and handles all interaction with it.
|
|
@@ -1531,16 +1940,16 @@ let MainInput = class MainInput extends vtyx.Vue {
|
|
|
1531
1940
|
'selectic-item_text',
|
|
1532
1941
|
], title: this.store.state.placeholder }, this.store.state.placeholder)),
|
|
1533
1942
|
this.store.state.multiple && (vtyx.h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
|
|
1534
|
-
this.isSelectionReversed && (vtyx.h("
|
|
1943
|
+
this.isSelectionReversed && (vtyx.h(Icon$1, { icon: "strikethrough", store: this.store, class: "selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
|
|
1535
1944
|
this.showSelectedOptions.map((item) => (vtyx.h("div", { class: "single-value", style: item.style, title: item.title || item.text, on: {
|
|
1536
1945
|
click: () => this.$emit('item:click', item.id),
|
|
1537
1946
|
} },
|
|
1538
1947
|
vtyx.h("span", { class: "selectic-input__selected-items__value" }, item.text),
|
|
1539
|
-
!this.isDisabled && (vtyx.h(
|
|
1948
|
+
!this.isDisabled && (vtyx.h(Icon$1, { icon: "times", class: "selectic-input__selected-items__icon", store: this.store, on: {
|
|
1540
1949
|
'click.prevent.stop': () => this.selectItem(item.id),
|
|
1541
1950
|
} }))))),
|
|
1542
1951
|
this.moreSelectedNb && (vtyx.h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
|
|
1543
|
-
this.showClearAll && (vtyx.h(
|
|
1952
|
+
this.showClearAll && (vtyx.h(Icon$1, { icon: "times", class: "selectic-input__clear-icon", title: this.clearedLabel, store: this.store, on: { 'click.prevent.stop': this.clearSelection } }))),
|
|
1544
1953
|
vtyx.h("div", { class: [
|
|
1545
1954
|
'selectic__icon-container',
|
|
1546
1955
|
'form-control-feedback',
|
|
@@ -1548,7 +1957,7 @@ let MainInput = class MainInput extends vtyx.Vue {
|
|
|
1548
1957
|
], on: {
|
|
1549
1958
|
'click.prevent.stop': () => this.toggleFocus(),
|
|
1550
1959
|
} },
|
|
1551
|
-
vtyx.h(
|
|
1960
|
+
vtyx.h(Icon$1, { icon: "caret-down", class: "selectic-icon", store: this.store }))));
|
|
1552
1961
|
}
|
|
1553
1962
|
};
|
|
1554
1963
|
__decorate$4([
|
|
@@ -1696,7 +2105,7 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
|
|
|
1696
2105
|
vtyx.h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: state.searchText, on: {
|
|
1697
2106
|
'input.stop.prevent': this.onInput,
|
|
1698
2107
|
}, ref: "filterInput" }),
|
|
1699
|
-
vtyx.h("
|
|
2108
|
+
vtyx.h(Icon$1, { icon: "search", store: this.store, class: "selectic-search-scope form-control-feedback" })),
|
|
1700
2109
|
state.multiple && (vtyx.h("div", { class: "toggle-selectic" },
|
|
1701
2110
|
vtyx.h("label", { class: ['control-label', {
|
|
1702
2111
|
'selectic__label-disabled': this.disableSelectAll,
|
|
@@ -1716,12 +2125,8 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
|
|
|
1716
2125
|
!state.keepFilterOpen && (vtyx.h("div", { class: "curtain-handler", on: {
|
|
1717
2126
|
'click.prevent.stop': this.togglePanel,
|
|
1718
2127
|
} },
|
|
1719
|
-
vtyx.h(
|
|
1720
|
-
vtyx.h(
|
|
1721
|
-
'fa': true,
|
|
1722
|
-
'fa-caret-down': this.closed,
|
|
1723
|
-
'fa-caret-up': !this.closed,
|
|
1724
|
-
} })))));
|
|
2128
|
+
vtyx.h(Icon$1, { icon: "search", store: this.store }),
|
|
2129
|
+
vtyx.h(Icon$1, { icon: this.closed ? 'caret-down' : 'caret-up', store: this.store })))));
|
|
1725
2130
|
}
|
|
1726
2131
|
};
|
|
1727
2132
|
__decorate$3([
|
|
@@ -1781,7 +2186,7 @@ let List = class List extends vtyx.Vue {
|
|
|
1781
2186
|
text: '',
|
|
1782
2187
|
disabled: true,
|
|
1783
2188
|
selected: false,
|
|
1784
|
-
icon: '
|
|
2189
|
+
icon: 'current:spinner:spin',
|
|
1785
2190
|
isGroup: false,
|
|
1786
2191
|
});
|
|
1787
2192
|
}
|
|
@@ -1831,7 +2236,11 @@ let List = class List extends vtyx.Vue {
|
|
|
1831
2236
|
/* }}} */
|
|
1832
2237
|
/* {{{ methods */
|
|
1833
2238
|
click(option) {
|
|
1834
|
-
if (option.disabled
|
|
2239
|
+
if (option.disabled) {
|
|
2240
|
+
return;
|
|
2241
|
+
}
|
|
2242
|
+
if (option.isGroup) {
|
|
2243
|
+
this.store.selectGroup(option.id, !option.selected);
|
|
1835
2244
|
return;
|
|
1836
2245
|
}
|
|
1837
2246
|
this.store.selectItem(option.id);
|
|
@@ -1919,14 +2328,17 @@ let List = class List extends vtyx.Vue {
|
|
|
1919
2328
|
'mouseover': () => this.onMouseOver(idx),
|
|
1920
2329
|
}, class: ['selectic-item', option.className || '', {
|
|
1921
2330
|
'selected': option.selected,
|
|
2331
|
+
'selectable': vue.unref(this.store.allowGroupSelection) && option.isGroup && !option.disabled,
|
|
1922
2332
|
'selectic-item__active': idx + this.startIndex === this.store.state.activeItemIdx,
|
|
1923
2333
|
'selectic-item__disabled': !!option.disabled,
|
|
1924
2334
|
'selectic-item__exclusive': !!option.exclusive,
|
|
1925
2335
|
'selectic-item__is-in-group': !!option.group,
|
|
1926
2336
|
'selectic-item__is-group': option.isGroup,
|
|
1927
2337
|
}], style: option.style, title: option.title, key: 'selectic-item-' + (idx + this.startIndex) },
|
|
1928
|
-
this.isMultiple && (vtyx.h(
|
|
1929
|
-
option.icon && (
|
|
2338
|
+
this.isMultiple && (vtyx.h(Icon$1, { icon: "check", store: this.store, class: "selectic-item_icon" })),
|
|
2339
|
+
option.icon && (option.icon.includes(':')
|
|
2340
|
+
? vtyx.h(Icon$1, { icon: option.icon, store: this.store })
|
|
2341
|
+
: vtyx.h(Icon$1, { icon: `raw:${option.icon}`, store: this.store })),
|
|
1930
2342
|
option.text))),
|
|
1931
2343
|
!!this.bottomOffset && (vtyx.h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` })))));
|
|
1932
2344
|
}
|
|
@@ -1971,7 +2383,8 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
1971
2383
|
super(...arguments);
|
|
1972
2384
|
/* }}} */
|
|
1973
2385
|
/* {{{ data */
|
|
1974
|
-
this.
|
|
2386
|
+
this.topGroupName = ' ';
|
|
2387
|
+
this.topGroupId = null;
|
|
1975
2388
|
this.listHeight = 0;
|
|
1976
2389
|
this.listWidth = 200;
|
|
1977
2390
|
this.availableSpace = 0;
|
|
@@ -2115,6 +2528,24 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2115
2528
|
--availableSpace: ${availableSpace}px;
|
|
2116
2529
|
`;
|
|
2117
2530
|
}
|
|
2531
|
+
get topGroup() {
|
|
2532
|
+
const topGroupId = this.topGroupId;
|
|
2533
|
+
if (!topGroupId) {
|
|
2534
|
+
return undefined;
|
|
2535
|
+
}
|
|
2536
|
+
const group = this.store.state.filteredOptions.find((option) => {
|
|
2537
|
+
return option.id === topGroupId;
|
|
2538
|
+
});
|
|
2539
|
+
return group;
|
|
2540
|
+
}
|
|
2541
|
+
get topGroupSelected() {
|
|
2542
|
+
const group = this.topGroup;
|
|
2543
|
+
return !!(group === null || group === void 0 ? void 0 : group.selected);
|
|
2544
|
+
}
|
|
2545
|
+
get topGroupDisabled() {
|
|
2546
|
+
const group = this.topGroup;
|
|
2547
|
+
return !!(group === null || group === void 0 ? void 0 : group.disabled);
|
|
2548
|
+
}
|
|
2118
2549
|
/* }}} */
|
|
2119
2550
|
/* {{{ watch */
|
|
2120
2551
|
onFilteredOptionsChange() {
|
|
@@ -2128,13 +2559,17 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2128
2559
|
getGroup(id) {
|
|
2129
2560
|
const group = this.store.state.groups.get(id);
|
|
2130
2561
|
const groupName = group || ' ';
|
|
2131
|
-
this.
|
|
2562
|
+
this.topGroupName = groupName;
|
|
2563
|
+
this.topGroupId = id;
|
|
2132
2564
|
}
|
|
2133
2565
|
computeListSize() {
|
|
2134
2566
|
const box = this.$el.getBoundingClientRect();
|
|
2135
2567
|
this.listHeight = box.height;
|
|
2136
2568
|
this.listWidth = box.width;
|
|
2137
2569
|
}
|
|
2570
|
+
clickHeaderGroup() {
|
|
2571
|
+
this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
|
|
2572
|
+
}
|
|
2138
2573
|
/* }}} */
|
|
2139
2574
|
/* {{{ Life cycles */
|
|
2140
2575
|
mounted() {
|
|
@@ -2160,13 +2595,24 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2160
2595
|
`selectic-position-${this.position}`,
|
|
2161
2596
|
] },
|
|
2162
2597
|
!state.hideFilter && (vtyx.h(Filter, { store: this.store })),
|
|
2163
|
-
isGroup && (vtyx.h("span", { class:
|
|
2598
|
+
isGroup && (vtyx.h("span", { class: [
|
|
2599
|
+
'selectic-item selectic-item--header selectic-item__is-group',
|
|
2600
|
+
{
|
|
2601
|
+
selected: this.topGroupSelected,
|
|
2602
|
+
selectable: vue.unref(this.store.allowGroupSelection) && !this.topGroupDisabled,
|
|
2603
|
+
disabled: this.topGroupDisabled,
|
|
2604
|
+
},
|
|
2605
|
+
], on: {
|
|
2606
|
+
click: () => this.clickHeaderGroup(),
|
|
2607
|
+
} },
|
|
2608
|
+
this.topGroupSelected && (vtyx.h(Icon$1, { icon: "check", store: this.store, class: "selectic-item_icon" })),
|
|
2609
|
+
this.topGroupName)),
|
|
2164
2610
|
vtyx.h(List$1, { store: store, on: {
|
|
2165
2611
|
groupId: this.getGroup,
|
|
2166
2612
|
} }),
|
|
2167
2613
|
this.infoMessage && (vtyx.h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
|
|
2168
2614
|
this.searching && (vtyx.h("div", { class: "selectic__message" },
|
|
2169
|
-
vtyx.h(
|
|
2615
|
+
vtyx.h(Icon$1, { icon: "spinner", store: this.store, spin: true }),
|
|
2170
2616
|
this.searchingLabel)),
|
|
2171
2617
|
this.errorMessage && (vtyx.h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
|
|
2172
2618
|
}
|
|
@@ -2215,6 +2661,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
2215
2661
|
function changeTexts(texts) {
|
|
2216
2662
|
changeTexts$1(texts);
|
|
2217
2663
|
}
|
|
2664
|
+
function changeIcons(icons, iconFamily) {
|
|
2665
|
+
changeIcons$1(icons, iconFamily);
|
|
2666
|
+
}
|
|
2218
2667
|
let Selectic = class Selectic extends vtyx.Vue {
|
|
2219
2668
|
constructor() {
|
|
2220
2669
|
super(...arguments);
|
|
@@ -2303,15 +2752,19 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2303
2752
|
/* }}} */
|
|
2304
2753
|
/* {{{ methods */
|
|
2305
2754
|
/* {{{ public methods */
|
|
2306
|
-
|
|
2755
|
+
/** Reset the inner cache (mainly for dynamic mode if context has changed) */
|
|
2307
2756
|
clearCache(forceReset = false) {
|
|
2308
2757
|
this.store.clearCache(forceReset);
|
|
2309
2758
|
}
|
|
2310
|
-
|
|
2759
|
+
/** Allow to change all text of the component */
|
|
2311
2760
|
changeTexts(texts) {
|
|
2312
2761
|
this.store.changeTexts(texts);
|
|
2313
2762
|
}
|
|
2314
|
-
|
|
2763
|
+
/** Allow to change all icons of the component */
|
|
2764
|
+
changeIcons(icons, iconFamily) {
|
|
2765
|
+
this.store.changeIcons(icons, iconFamily);
|
|
2766
|
+
}
|
|
2767
|
+
/** Return the current selection */
|
|
2315
2768
|
getValue() {
|
|
2316
2769
|
const value = this.store.state.internalValue;
|
|
2317
2770
|
if (value === null && typeof this.params.emptyValue !== 'undefined') {
|
|
@@ -2319,7 +2772,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2319
2772
|
}
|
|
2320
2773
|
return value;
|
|
2321
2774
|
}
|
|
2322
|
-
|
|
2775
|
+
/** Return the current selection in Item format */
|
|
2323
2776
|
getSelectedItems() {
|
|
2324
2777
|
const values = this.store.state.internalValue;
|
|
2325
2778
|
if (values === null) {
|
|
@@ -2333,7 +2786,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2333
2786
|
}
|
|
2334
2787
|
return this.store.getItem(values);
|
|
2335
2788
|
}
|
|
2336
|
-
|
|
2789
|
+
/** Check if there are Options available in the components */
|
|
2337
2790
|
isEmpty() {
|
|
2338
2791
|
const total = this.store.state.totalAllOptions;
|
|
2339
2792
|
return total === 0;
|
|
@@ -2446,6 +2899,11 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2446
2899
|
this.changeTexts(texts);
|
|
2447
2900
|
}
|
|
2448
2901
|
}
|
|
2902
|
+
onIconsChange() {
|
|
2903
|
+
const icons = this.icons;
|
|
2904
|
+
const iconFamily = this.iconFamily;
|
|
2905
|
+
this.changeIcons(icons !== null && icons !== void 0 ? icons : {}, iconFamily);
|
|
2906
|
+
}
|
|
2449
2907
|
onDisabledChange() {
|
|
2450
2908
|
this.store.props.disabled = this.disabled;
|
|
2451
2909
|
}
|
|
@@ -2618,6 +3076,8 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2618
3076
|
selectionIsExcluded: this.selectionIsExcluded,
|
|
2619
3077
|
disabled: this.disabled,
|
|
2620
3078
|
texts: this.texts,
|
|
3079
|
+
icons: this.icons,
|
|
3080
|
+
iconFamily: this.iconFamily,
|
|
2621
3081
|
groups: deepClone(this.groups),
|
|
2622
3082
|
keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
|
|
2623
3083
|
params: {
|
|
@@ -2640,6 +3100,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2640
3100
|
listPosition: this.params.listPosition || 'auto',
|
|
2641
3101
|
optionBehavior: this.params.optionBehavior,
|
|
2642
3102
|
isOpen: ((_c = this.open) !== null && _c !== void 0 ? _c : false) !== false,
|
|
3103
|
+
disableGroupSelection: this.params.disableGroupSelection,
|
|
2643
3104
|
},
|
|
2644
3105
|
fetchCallback: this.params.fetchCallback,
|
|
2645
3106
|
getItemsCallback: this.params.getItemsCallback,
|
|
@@ -2648,6 +3109,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2648
3109
|
this._getMethods({
|
|
2649
3110
|
clearCache: this.clearCache.bind(this),
|
|
2650
3111
|
changeTexts: this.changeTexts.bind(this),
|
|
3112
|
+
changeIcons: this.changeIcons.bind(this),
|
|
2651
3113
|
getValue: this.getValue.bind(this),
|
|
2652
3114
|
getSelectedItems: this.getSelectedItems.bind(this),
|
|
2653
3115
|
isEmpty: this.isEmpty.bind(this),
|
|
@@ -2736,6 +3198,12 @@ __decorate([
|
|
|
2736
3198
|
__decorate([
|
|
2737
3199
|
vtyx.Prop()
|
|
2738
3200
|
], Selectic.prototype, "texts", void 0);
|
|
3201
|
+
__decorate([
|
|
3202
|
+
vtyx.Prop()
|
|
3203
|
+
], Selectic.prototype, "icons", void 0);
|
|
3204
|
+
__decorate([
|
|
3205
|
+
vtyx.Prop()
|
|
3206
|
+
], Selectic.prototype, "iconFamily", void 0);
|
|
2739
3207
|
__decorate([
|
|
2740
3208
|
vtyx.Prop({ default: false })
|
|
2741
3209
|
], Selectic.prototype, "noCache", void 0);
|
|
@@ -2767,6 +3235,10 @@ __decorate([
|
|
|
2767
3235
|
__decorate([
|
|
2768
3236
|
vtyx.Watch('texts', { deep: true })
|
|
2769
3237
|
], Selectic.prototype, "onTextsChange", null);
|
|
3238
|
+
__decorate([
|
|
3239
|
+
vtyx.Watch('iconFamily'),
|
|
3240
|
+
vtyx.Watch('icons', { deep: true })
|
|
3241
|
+
], Selectic.prototype, "onIconsChange", null);
|
|
2770
3242
|
__decorate([
|
|
2771
3243
|
vtyx.Watch('disabled')
|
|
2772
3244
|
], Selectic.prototype, "onDisabledChange", null);
|
|
@@ -2793,5 +3265,6 @@ Selectic = __decorate([
|
|
|
2793
3265
|
], Selectic);
|
|
2794
3266
|
var Selectic$1 = Selectic;
|
|
2795
3267
|
|
|
3268
|
+
exports.changeIcons = changeIcons;
|
|
2796
3269
|
exports.changeTexts = changeTexts;
|
|
2797
3270
|
exports["default"] = Selectic$1;
|