selectic 3.0.21 → 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 +545 -67
- package/dist/selectic.esm.js +546 -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 +290 -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], () => {
|
|
@@ -314,6 +330,11 @@ class SelecticStore {
|
|
|
314
330
|
}, { deep: true });
|
|
315
331
|
vue.watch(() => this.state.internalValue, () => {
|
|
316
332
|
this.buildSelectedOptions();
|
|
333
|
+
/* If there is only one item, and the previous selected value was
|
|
334
|
+
* different, then if we change it to the only available item we
|
|
335
|
+
* should disable Selectic (user has no more choice).
|
|
336
|
+
* This is why it is needed to check autoDisabled here. */
|
|
337
|
+
this.checkAutoDisabled();
|
|
317
338
|
}, { deep: true });
|
|
318
339
|
vue.watch(() => this.state.allOptions, () => {
|
|
319
340
|
this.checkAutoSelect();
|
|
@@ -355,6 +376,9 @@ class SelecticStore {
|
|
|
355
376
|
if (this.props.texts) {
|
|
356
377
|
this.changeTexts(this.props.texts);
|
|
357
378
|
}
|
|
379
|
+
if (this.props.icons || this.props.iconFamily) {
|
|
380
|
+
this.changeIcons(this.props.icons, this.props.iconFamily);
|
|
381
|
+
}
|
|
358
382
|
this.addGroups(this.props.groups);
|
|
359
383
|
this.assertValueType();
|
|
360
384
|
this.buildAllOptions();
|
|
@@ -472,17 +496,38 @@ class SelecticStore {
|
|
|
472
496
|
}
|
|
473
497
|
return this.buildSelectedItems(ids);
|
|
474
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
|
+
}
|
|
475
520
|
selectItem(id, selected, keepOpen = false) {
|
|
476
521
|
const state = this.state;
|
|
477
522
|
let hasChanged = false;
|
|
478
523
|
const item = state.allOptions.find((opt) => opt.id === id);
|
|
479
524
|
/* Check that item is not disabled */
|
|
480
525
|
if (item === null || item === void 0 ? void 0 : item.disabled) {
|
|
481
|
-
return;
|
|
526
|
+
return hasChanged;
|
|
482
527
|
}
|
|
483
528
|
if (state.strictValue && !this.hasValue(id)) {
|
|
484
529
|
/* reject invalid values */
|
|
485
|
-
return;
|
|
530
|
+
return hasChanged;
|
|
486
531
|
}
|
|
487
532
|
if (state.multiple) {
|
|
488
533
|
/* multiple = true */
|
|
@@ -530,12 +575,12 @@ class SelecticStore {
|
|
|
530
575
|
}
|
|
531
576
|
if (!selected) {
|
|
532
577
|
if (id !== oldValue) {
|
|
533
|
-
return;
|
|
578
|
+
return hasChanged;
|
|
534
579
|
}
|
|
535
580
|
id = null;
|
|
536
581
|
}
|
|
537
582
|
else if (id === oldValue) {
|
|
538
|
-
return;
|
|
583
|
+
return hasChanged;
|
|
539
584
|
}
|
|
540
585
|
if (keepOpen) {
|
|
541
586
|
/* if keepOpen is true it means that it is an automatic change */
|
|
@@ -547,6 +592,7 @@ class SelecticStore {
|
|
|
547
592
|
if (hasChanged) {
|
|
548
593
|
state.status.hasChanged = true;
|
|
549
594
|
}
|
|
595
|
+
return hasChanged;
|
|
550
596
|
}
|
|
551
597
|
toggleSelectAll() {
|
|
552
598
|
if (!this.state.multiple) {
|
|
@@ -616,6 +662,14 @@ class SelecticStore {
|
|
|
616
662
|
changeTexts(texts) {
|
|
617
663
|
this.data.labels = Object.assign({}, this.data.labels, texts);
|
|
618
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
|
+
}
|
|
619
673
|
/* }}} */
|
|
620
674
|
/* {{{ private methods */
|
|
621
675
|
hasValue(id) {
|
|
@@ -720,6 +774,7 @@ class SelecticStore {
|
|
|
720
774
|
if (!this.data.doNotUpdate) {
|
|
721
775
|
this.state.filteredOptions = this.buildItems(this.state.filteredOptions);
|
|
722
776
|
this.buildSelectedOptions();
|
|
777
|
+
this.updateGroupSelection();
|
|
723
778
|
}
|
|
724
779
|
}
|
|
725
780
|
addGroups(groups) {
|
|
@@ -727,7 +782,7 @@ class SelecticStore {
|
|
|
727
782
|
this.state.groups.set(group.id, group.text);
|
|
728
783
|
});
|
|
729
784
|
}
|
|
730
|
-
|
|
785
|
+
/** This method is for the computed property listOptions */
|
|
731
786
|
getListOptions() {
|
|
732
787
|
const options = deepClone(this.props.options, ['data']);
|
|
733
788
|
const listOptions = [];
|
|
@@ -878,13 +933,11 @@ class SelecticStore {
|
|
|
878
933
|
/* Do not fetch again just build filteredOptions */
|
|
879
934
|
const search = this.state.searchText;
|
|
880
935
|
if (!search) {
|
|
881
|
-
this.
|
|
882
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
936
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
883
937
|
return;
|
|
884
938
|
}
|
|
885
939
|
const options = this.filterOptions(allOptions, search);
|
|
886
|
-
this.
|
|
887
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
940
|
+
this.setFilteredOptions(options);
|
|
888
941
|
}
|
|
889
942
|
}
|
|
890
943
|
async buildFilteredOptions() {
|
|
@@ -906,13 +959,11 @@ class SelecticStore {
|
|
|
906
959
|
/* Check if all options have been fetched */
|
|
907
960
|
if (hasFetchedAllItems) {
|
|
908
961
|
if (!search) {
|
|
909
|
-
this.
|
|
910
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
962
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions));
|
|
911
963
|
return;
|
|
912
964
|
}
|
|
913
965
|
const options = this.filterOptions(allOptions, search);
|
|
914
|
-
this.
|
|
915
|
-
this.state.totalFilteredOptions = this.state.filteredOptions.length;
|
|
966
|
+
this.setFilteredOptions(options);
|
|
916
967
|
return;
|
|
917
968
|
}
|
|
918
969
|
/* When we only have partial options */
|
|
@@ -923,8 +974,7 @@ class SelecticStore {
|
|
|
923
974
|
return;
|
|
924
975
|
}
|
|
925
976
|
if (!search && endIndex <= allOptionsLength) {
|
|
926
|
-
this.
|
|
927
|
-
this.state.totalFilteredOptions = totalAllOptions + this.state.groups.size;
|
|
977
|
+
this.setFilteredOptions(this.buildGroupItems(allOptions), false, totalAllOptions + this.state.groups.size);
|
|
928
978
|
const isPartial = vue.unref(this.isPartial);
|
|
929
979
|
if (isPartial && this.state.totalDynOptions === Infinity) {
|
|
930
980
|
this.fetchData();
|
|
@@ -1038,7 +1088,7 @@ class SelecticStore {
|
|
|
1038
1088
|
/* Added options are the same as previous ones.
|
|
1039
1089
|
* Stop fetching to avoid infinite loop
|
|
1040
1090
|
*/
|
|
1041
|
-
if (!this.hasFetchedAllItems) {
|
|
1091
|
+
if (!vue.unref(this.hasFetchedAllItems)) {
|
|
1042
1092
|
/* Display error if all items are not fetch
|
|
1043
1093
|
* We can have the case where old value and result
|
|
1044
1094
|
* are the same but total is correct when the
|
|
@@ -1062,6 +1112,10 @@ class SelecticStore {
|
|
|
1062
1112
|
const previousItem = state.filteredOptions[filteredOptionsLength - 1];
|
|
1063
1113
|
const options = this.buildGroupItems(result, previousItem);
|
|
1064
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
|
+
*/
|
|
1065
1119
|
state.filteredOptions.splice(offset + dynOffset, limit + nbGroups1, ...options);
|
|
1066
1120
|
}
|
|
1067
1121
|
let nbGroups = state.groups.size;
|
|
@@ -1069,6 +1123,7 @@ class SelecticStore {
|
|
|
1069
1123
|
nbGroups = this.nbGroups(state.filteredOptions);
|
|
1070
1124
|
}
|
|
1071
1125
|
state.totalFilteredOptions = total + nbGroups + dynOffset;
|
|
1126
|
+
this.updateGroupSelection();
|
|
1072
1127
|
if (search && state.totalFilteredOptions <= state.filteredOptions.length) {
|
|
1073
1128
|
this.addStaticFilteredOptions(true);
|
|
1074
1129
|
}
|
|
@@ -1117,8 +1172,7 @@ class SelecticStore {
|
|
|
1117
1172
|
options = this.filterOptions(vue.unref(this.elementOptions), search);
|
|
1118
1173
|
break;
|
|
1119
1174
|
}
|
|
1120
|
-
this.
|
|
1121
|
-
this.state.totalFilteredOptions += options.length;
|
|
1175
|
+
this.setFilteredOptions(options, true);
|
|
1122
1176
|
}
|
|
1123
1177
|
}
|
|
1124
1178
|
buildSelectedItems(ids) {
|
|
@@ -1260,8 +1314,368 @@ class SelecticStore {
|
|
|
1260
1314
|
state.hideFilter = state.totalAllOptions <= this.data.itemsPerPage;
|
|
1261
1315
|
}
|
|
1262
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
|
+
}
|
|
1263
1361
|
}
|
|
1264
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
|
+
|
|
1265
1679
|
/* File Purpose:
|
|
1266
1680
|
* It displays the core element which is always visible (where selection is
|
|
1267
1681
|
* displayed) and handles all interaction with it.
|
|
@@ -1526,16 +1940,16 @@ let MainInput = class MainInput extends vtyx.Vue {
|
|
|
1526
1940
|
'selectic-item_text',
|
|
1527
1941
|
], title: this.store.state.placeholder }, this.store.state.placeholder)),
|
|
1528
1942
|
this.store.state.multiple && (vtyx.h("div", { class: "selectic-input__selected-items", ref: "selectedItems" },
|
|
1529
|
-
this.isSelectionReversed && (vtyx.h("
|
|
1943
|
+
this.isSelectionReversed && (vtyx.h(Icon$1, { icon: "strikethrough", store: this.store, class: "selectic-input__reverse-icon", title: this.reverseSelectionLabel })),
|
|
1530
1944
|
this.showSelectedOptions.map((item) => (vtyx.h("div", { class: "single-value", style: item.style, title: item.title || item.text, on: {
|
|
1531
1945
|
click: () => this.$emit('item:click', item.id),
|
|
1532
1946
|
} },
|
|
1533
1947
|
vtyx.h("span", { class: "selectic-input__selected-items__value" }, item.text),
|
|
1534
|
-
!this.isDisabled && (vtyx.h(
|
|
1948
|
+
!this.isDisabled && (vtyx.h(Icon$1, { icon: "times", class: "selectic-input__selected-items__icon", store: this.store, on: {
|
|
1535
1949
|
'click.prevent.stop': () => this.selectItem(item.id),
|
|
1536
1950
|
} }))))),
|
|
1537
1951
|
this.moreSelectedNb && (vtyx.h("div", { class: "single-value more-items", title: this.moreSelectedTitle }, this.moreSelectedNb)))),
|
|
1538
|
-
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 } }))),
|
|
1539
1953
|
vtyx.h("div", { class: [
|
|
1540
1954
|
'selectic__icon-container',
|
|
1541
1955
|
'form-control-feedback',
|
|
@@ -1543,7 +1957,7 @@ let MainInput = class MainInput extends vtyx.Vue {
|
|
|
1543
1957
|
], on: {
|
|
1544
1958
|
'click.prevent.stop': () => this.toggleFocus(),
|
|
1545
1959
|
} },
|
|
1546
|
-
vtyx.h(
|
|
1960
|
+
vtyx.h(Icon$1, { icon: "caret-down", class: "selectic-icon", store: this.store }))));
|
|
1547
1961
|
}
|
|
1548
1962
|
};
|
|
1549
1963
|
__decorate$4([
|
|
@@ -1691,7 +2105,7 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
|
|
|
1691
2105
|
vtyx.h("input", { type: "text", class: "form-control filter-input", placeholder: this.searchPlaceholder, value: state.searchText, on: {
|
|
1692
2106
|
'input.stop.prevent': this.onInput,
|
|
1693
2107
|
}, ref: "filterInput" }),
|
|
1694
|
-
vtyx.h("
|
|
2108
|
+
vtyx.h(Icon$1, { icon: "search", store: this.store, class: "selectic-search-scope form-control-feedback" })),
|
|
1695
2109
|
state.multiple && (vtyx.h("div", { class: "toggle-selectic" },
|
|
1696
2110
|
vtyx.h("label", { class: ['control-label', {
|
|
1697
2111
|
'selectic__label-disabled': this.disableSelectAll,
|
|
@@ -1711,12 +2125,8 @@ let FilterPanel = class FilterPanel extends vtyx.Vue {
|
|
|
1711
2125
|
!state.keepFilterOpen && (vtyx.h("div", { class: "curtain-handler", on: {
|
|
1712
2126
|
'click.prevent.stop': this.togglePanel,
|
|
1713
2127
|
} },
|
|
1714
|
-
vtyx.h(
|
|
1715
|
-
vtyx.h(
|
|
1716
|
-
'fa': true,
|
|
1717
|
-
'fa-caret-down': this.closed,
|
|
1718
|
-
'fa-caret-up': !this.closed,
|
|
1719
|
-
} })))));
|
|
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 })))));
|
|
1720
2130
|
}
|
|
1721
2131
|
};
|
|
1722
2132
|
__decorate$3([
|
|
@@ -1776,7 +2186,7 @@ let List = class List extends vtyx.Vue {
|
|
|
1776
2186
|
text: '',
|
|
1777
2187
|
disabled: true,
|
|
1778
2188
|
selected: false,
|
|
1779
|
-
icon: '
|
|
2189
|
+
icon: 'current:spinner:spin',
|
|
1780
2190
|
isGroup: false,
|
|
1781
2191
|
});
|
|
1782
2192
|
}
|
|
@@ -1826,7 +2236,11 @@ let List = class List extends vtyx.Vue {
|
|
|
1826
2236
|
/* }}} */
|
|
1827
2237
|
/* {{{ methods */
|
|
1828
2238
|
click(option) {
|
|
1829
|
-
if (option.disabled
|
|
2239
|
+
if (option.disabled) {
|
|
2240
|
+
return;
|
|
2241
|
+
}
|
|
2242
|
+
if (option.isGroup) {
|
|
2243
|
+
this.store.selectGroup(option.id, !option.selected);
|
|
1830
2244
|
return;
|
|
1831
2245
|
}
|
|
1832
2246
|
this.store.selectItem(option.id);
|
|
@@ -1914,14 +2328,17 @@ let List = class List extends vtyx.Vue {
|
|
|
1914
2328
|
'mouseover': () => this.onMouseOver(idx),
|
|
1915
2329
|
}, class: ['selectic-item', option.className || '', {
|
|
1916
2330
|
'selected': option.selected,
|
|
2331
|
+
'selectable': vue.unref(this.store.allowGroupSelection) && option.isGroup && !option.disabled,
|
|
1917
2332
|
'selectic-item__active': idx + this.startIndex === this.store.state.activeItemIdx,
|
|
1918
2333
|
'selectic-item__disabled': !!option.disabled,
|
|
1919
2334
|
'selectic-item__exclusive': !!option.exclusive,
|
|
1920
2335
|
'selectic-item__is-in-group': !!option.group,
|
|
1921
2336
|
'selectic-item__is-group': option.isGroup,
|
|
1922
2337
|
}], style: option.style, title: option.title, key: 'selectic-item-' + (idx + this.startIndex) },
|
|
1923
|
-
this.isMultiple && (vtyx.h(
|
|
1924
|
-
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 })),
|
|
1925
2342
|
option.text))),
|
|
1926
2343
|
!!this.bottomOffset && (vtyx.h("li", { class: "selectic-item", style: `height:${this.bottomOffset}px;` })))));
|
|
1927
2344
|
}
|
|
@@ -1966,7 +2383,8 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
1966
2383
|
super(...arguments);
|
|
1967
2384
|
/* }}} */
|
|
1968
2385
|
/* {{{ data */
|
|
1969
|
-
this.
|
|
2386
|
+
this.topGroupName = ' ';
|
|
2387
|
+
this.topGroupId = null;
|
|
1970
2388
|
this.listHeight = 0;
|
|
1971
2389
|
this.listWidth = 200;
|
|
1972
2390
|
this.availableSpace = 0;
|
|
@@ -2110,6 +2528,24 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2110
2528
|
--availableSpace: ${availableSpace}px;
|
|
2111
2529
|
`;
|
|
2112
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
|
+
}
|
|
2113
2549
|
/* }}} */
|
|
2114
2550
|
/* {{{ watch */
|
|
2115
2551
|
onFilteredOptionsChange() {
|
|
@@ -2123,13 +2559,17 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2123
2559
|
getGroup(id) {
|
|
2124
2560
|
const group = this.store.state.groups.get(id);
|
|
2125
2561
|
const groupName = group || ' ';
|
|
2126
|
-
this.
|
|
2562
|
+
this.topGroupName = groupName;
|
|
2563
|
+
this.topGroupId = id;
|
|
2127
2564
|
}
|
|
2128
2565
|
computeListSize() {
|
|
2129
2566
|
const box = this.$el.getBoundingClientRect();
|
|
2130
2567
|
this.listHeight = box.height;
|
|
2131
2568
|
this.listWidth = box.width;
|
|
2132
2569
|
}
|
|
2570
|
+
clickHeaderGroup() {
|
|
2571
|
+
this.store.selectGroup(this.topGroupId, !this.topGroupSelected);
|
|
2572
|
+
}
|
|
2133
2573
|
/* }}} */
|
|
2134
2574
|
/* {{{ Life cycles */
|
|
2135
2575
|
mounted() {
|
|
@@ -2155,13 +2595,24 @@ let ExtendedList = class ExtendedList extends vtyx.Vue {
|
|
|
2155
2595
|
`selectic-position-${this.position}`,
|
|
2156
2596
|
] },
|
|
2157
2597
|
!state.hideFilter && (vtyx.h(Filter, { store: this.store })),
|
|
2158
|
-
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)),
|
|
2159
2610
|
vtyx.h(List$1, { store: store, on: {
|
|
2160
2611
|
groupId: this.getGroup,
|
|
2161
2612
|
} }),
|
|
2162
2613
|
this.infoMessage && (vtyx.h("div", { class: "selectic__message alert-info" }, this.infoMessage)),
|
|
2163
2614
|
this.searching && (vtyx.h("div", { class: "selectic__message" },
|
|
2164
|
-
vtyx.h(
|
|
2615
|
+
vtyx.h(Icon$1, { icon: "spinner", store: this.store, spin: true }),
|
|
2165
2616
|
this.searchingLabel)),
|
|
2166
2617
|
this.errorMessage && (vtyx.h("div", { class: "selectic__message alert-danger", on: { click: () => store.resetErrorMessage() } }, this.errorMessage))));
|
|
2167
2618
|
}
|
|
@@ -2210,6 +2661,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
2210
2661
|
function changeTexts(texts) {
|
|
2211
2662
|
changeTexts$1(texts);
|
|
2212
2663
|
}
|
|
2664
|
+
function changeIcons(icons, iconFamily) {
|
|
2665
|
+
changeIcons$1(icons, iconFamily);
|
|
2666
|
+
}
|
|
2213
2667
|
let Selectic = class Selectic extends vtyx.Vue {
|
|
2214
2668
|
constructor() {
|
|
2215
2669
|
super(...arguments);
|
|
@@ -2298,15 +2752,19 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2298
2752
|
/* }}} */
|
|
2299
2753
|
/* {{{ methods */
|
|
2300
2754
|
/* {{{ public methods */
|
|
2301
|
-
|
|
2755
|
+
/** Reset the inner cache (mainly for dynamic mode if context has changed) */
|
|
2302
2756
|
clearCache(forceReset = false) {
|
|
2303
2757
|
this.store.clearCache(forceReset);
|
|
2304
2758
|
}
|
|
2305
|
-
|
|
2759
|
+
/** Allow to change all text of the component */
|
|
2306
2760
|
changeTexts(texts) {
|
|
2307
2761
|
this.store.changeTexts(texts);
|
|
2308
2762
|
}
|
|
2309
|
-
|
|
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 */
|
|
2310
2768
|
getValue() {
|
|
2311
2769
|
const value = this.store.state.internalValue;
|
|
2312
2770
|
if (value === null && typeof this.params.emptyValue !== 'undefined') {
|
|
@@ -2314,7 +2772,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2314
2772
|
}
|
|
2315
2773
|
return value;
|
|
2316
2774
|
}
|
|
2317
|
-
|
|
2775
|
+
/** Return the current selection in Item format */
|
|
2318
2776
|
getSelectedItems() {
|
|
2319
2777
|
const values = this.store.state.internalValue;
|
|
2320
2778
|
if (values === null) {
|
|
@@ -2328,7 +2786,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2328
2786
|
}
|
|
2329
2787
|
return this.store.getItem(values);
|
|
2330
2788
|
}
|
|
2331
|
-
|
|
2789
|
+
/** Check if there are Options available in the components */
|
|
2332
2790
|
isEmpty() {
|
|
2333
2791
|
const total = this.store.state.totalAllOptions;
|
|
2334
2792
|
return total === 0;
|
|
@@ -2441,6 +2899,11 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2441
2899
|
this.changeTexts(texts);
|
|
2442
2900
|
}
|
|
2443
2901
|
}
|
|
2902
|
+
onIconsChange() {
|
|
2903
|
+
const icons = this.icons;
|
|
2904
|
+
const iconFamily = this.iconFamily;
|
|
2905
|
+
this.changeIcons(icons !== null && icons !== void 0 ? icons : {}, iconFamily);
|
|
2906
|
+
}
|
|
2444
2907
|
onDisabledChange() {
|
|
2445
2908
|
this.store.props.disabled = this.disabled;
|
|
2446
2909
|
}
|
|
@@ -2613,6 +3076,8 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2613
3076
|
selectionIsExcluded: this.selectionIsExcluded,
|
|
2614
3077
|
disabled: this.disabled,
|
|
2615
3078
|
texts: this.texts,
|
|
3079
|
+
icons: this.icons,
|
|
3080
|
+
iconFamily: this.iconFamily,
|
|
2616
3081
|
groups: deepClone(this.groups),
|
|
2617
3082
|
keepOpenWithOtherSelectic: !!this.params.keepOpenWithOtherSelectic,
|
|
2618
3083
|
params: {
|
|
@@ -2635,6 +3100,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2635
3100
|
listPosition: this.params.listPosition || 'auto',
|
|
2636
3101
|
optionBehavior: this.params.optionBehavior,
|
|
2637
3102
|
isOpen: ((_c = this.open) !== null && _c !== void 0 ? _c : false) !== false,
|
|
3103
|
+
disableGroupSelection: this.params.disableGroupSelection,
|
|
2638
3104
|
},
|
|
2639
3105
|
fetchCallback: this.params.fetchCallback,
|
|
2640
3106
|
getItemsCallback: this.params.getItemsCallback,
|
|
@@ -2643,6 +3109,7 @@ let Selectic = class Selectic extends vtyx.Vue {
|
|
|
2643
3109
|
this._getMethods({
|
|
2644
3110
|
clearCache: this.clearCache.bind(this),
|
|
2645
3111
|
changeTexts: this.changeTexts.bind(this),
|
|
3112
|
+
changeIcons: this.changeIcons.bind(this),
|
|
2646
3113
|
getValue: this.getValue.bind(this),
|
|
2647
3114
|
getSelectedItems: this.getSelectedItems.bind(this),
|
|
2648
3115
|
isEmpty: this.isEmpty.bind(this),
|
|
@@ -2731,6 +3198,12 @@ __decorate([
|
|
|
2731
3198
|
__decorate([
|
|
2732
3199
|
vtyx.Prop()
|
|
2733
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);
|
|
2734
3207
|
__decorate([
|
|
2735
3208
|
vtyx.Prop({ default: false })
|
|
2736
3209
|
], Selectic.prototype, "noCache", void 0);
|
|
@@ -2762,6 +3235,10 @@ __decorate([
|
|
|
2762
3235
|
__decorate([
|
|
2763
3236
|
vtyx.Watch('texts', { deep: true })
|
|
2764
3237
|
], Selectic.prototype, "onTextsChange", null);
|
|
3238
|
+
__decorate([
|
|
3239
|
+
vtyx.Watch('iconFamily'),
|
|
3240
|
+
vtyx.Watch('icons', { deep: true })
|
|
3241
|
+
], Selectic.prototype, "onIconsChange", null);
|
|
2765
3242
|
__decorate([
|
|
2766
3243
|
vtyx.Watch('disabled')
|
|
2767
3244
|
], Selectic.prototype, "onDisabledChange", null);
|
|
@@ -2788,5 +3265,6 @@ Selectic = __decorate([
|
|
|
2788
3265
|
], Selectic);
|
|
2789
3266
|
var Selectic$1 = Selectic;
|
|
2790
3267
|
|
|
3268
|
+
exports.changeIcons = changeIcons;
|
|
2791
3269
|
exports.changeTexts = changeTexts;
|
|
2792
3270
|
exports["default"] = Selectic$1;
|